diff --git a/.travis.yml b/.travis.yml index 8655b27d4ed..718356e8075 100644 --- a/.travis.yml +++ b/.travis.yml @@ -257,7 +257,7 @@ script: # Ensure we catch errors set -e # Exclusions are defined in the ruleset.xml file - phpcs -s -n -p -d memory_limit=-1 --colors --tab-width=4 --standard=dev/codesniffer/ruleset.xml --encoding=utf-8 . + phpcs -s -n -p -d memory_limit=-1 --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 . set +e echo @@ -287,10 +287,13 @@ script: php upgrade.php 3.9.0 4.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade390400.log php upgrade2.php 3.9.0 4.0.0 MAIN_MODULE_API,MAIN_MODULE_SUPPLIERPROPOSAL > $TRAVIS_BUILD_DIR/upgrade390400-2.log php step5.php 3.9.0 4.0.0 > $TRAVIS_BUILD_DIR/upgrade390400-3.log + php upgrade.php 4.0.0 5.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade400500.log + php upgrade2.php 4.0.0 5.0.0 MAIN_MODULE_API,MAIN_MODULE_SUPPLIERPROPOSAL > $TRAVIS_BUILD_DIR/upgrade400500-2.log + php step5.php 4.0.0 5.0.0 > $TRAVIS_BUILD_DIR/upgrade400500-3.log cd - set +e echo - #cat $TRAVIS_BUILD_DIR/upgrade390400-2.log + #cat $TRAVIS_BUILD_DIR/upgrade400500-2.log #cat /tmp/dolibarr_install.log - | diff --git a/.tx/config b/.tx/config index c4ec45cd3b2..010227f6e61 100644 --- a/.tx/config +++ b/.tx/config @@ -170,7 +170,7 @@ source_file = htdocs/langs/en_US/interventions.lang source_lang = en_US type = MOZILLAPROPERTIES -[dolibarr.languages] +[dolibarr.languages-not-res] file_filter = htdocs/langs//languages.lang source_file = htdocs/langs/en_US/languages.lang source_lang = en_US diff --git a/COPYRIGHT b/COPYRIGHT index b8cf93e595a..4fbff121147 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -38,9 +38,8 @@ jQuery UI 1.11.4 GPL and MIT License Yes jQuery select2 3.5.2 GPL and Apache License Yes JS library plugin for sexier multiselect jQuery blockUI 2.70.0 GPL and MIT License Yes JS library plugin blockUI (to use ajax popups) jQuery Colorpicker 1.1 MIT License Yes JS library for color picker for a defined list of colors -jQuery DataTables 1.9.4 BSD Yes JS library for tables output jQuery FileUpload 5.0.3 GPL and MIT License Yes JS library to upload files -jQuery Flot 0.7 MIT License Yes JS library to build graph +jQuery Flot 0.8.3 MIT License Yes JS library to build graph jQuery JCrop 0.9.8 GPL and MIT License Yes JS library plugin Crop (to crop images) jQuery Jeditable 1.7.1 GPL and MIT License Yes JS library plugin jeditable (to edit in place) jQuery jNotify 1.1.00 Apache Software License 2.0 Yes JS library plugin jNotify (to use ajax popups) @@ -52,7 +51,7 @@ jQuery Mobile 1.3.0 GPL and MIT License Yes jQuery TableDnD 0.6 GPL and MIT License Yes JS library plugin TableDnD (to reorder table rows) jQuery Timepicker 1.1.0 GPL and MIT License Yes JS library Timepicker addon for Datepicker jQuery Tiptip 1.3 GPL and MIT License Yes JS library for tooltips -jsGantt 1.2 BSD License Yes JS library (to build Gantt reports) +jsGanttImproved 1.7.5.2 BSD License Yes JS library (to build Gantt reports) JsTimezoneDetect 1.0.6 MIT License Yes JS library to detect user timezone For licenses compatibility informations: diff --git a/ChangeLog b/ChangeLog index e3d40f3a04c..359ae891b50 100644 --- a/ChangeLog +++ b/ChangeLog @@ -12,67 +12,124 @@ Upgrading to any other version or any other database system is abolutely require make a Dolibarr upgrade. -***** ChangeLog for 4.0 compared to 3.9.* ***** -For users: -NEW: Add reccuring invoice feature and automatic generation of invoices. +***** ChangeLog for 5.0.0 compared to 4.0.* ***** +For users: +... + +WARNING: + +Following changes may create regression for some external modules, but were necessary to make +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. +- Method expensereport->delete(id, user) has been replaced with ->delete(user) + Method warehouse->delete(id) has been replace with ->delete(user) + This is to follow good practice to make a fetch on object before deleting it. +- The form to add a product to a draft proposal/order/invoice from the product card is hidden by default. + It was not commonly used and usage generates some problems (cost price for margin calculation not entered, vat setting). + Set constant PRODUCT_ADD_FORM_ADD_TO to retrieve it. +- The javascript "datatables" library was used to be provided into Dolibarr sources, but it was not used by application. + So there is no reason to maintain its compatibility with other dolibarr components. If an external module need this + library, this external module must embed hte library in his own sources/packages. +- Trigger name SUPPLIER_PROPOSAL_CREATE has been renamed into PROPOSAL_SUPPLIER_CREATE +- A new paramater sqlfilters was introduced to allow filter on any fields int the REST API. Few old parameters + no more required were also removed. Use this new one if you ware using one of them. + + +***** ChangeLog for 4.0.1 compared to 4.0.0 ***** +FIX: #2853 +FIX: #2991 +FIX: #3128 +FIX: #5699 +FIX: #5734 +FIX: #5742 error on project list if an extra field separator is added. +FIX: #5746 chrome php Try a fix. Not sure it solved all problems reported +FIX: #5748 Bug: Error updating to 4.0.1 with Postgresql. Field must be varchar. +FIX: #5750 Bug: CmailFile::server_parse enters an infinite loop if $server_response is false +FIX: #5752 Bug VAT NPR not propagated during proposal cloning +FIX: #5763 Bug: Cannot Create Supplier Price Request +FIX: #5770 Dolibarr doesn't modify correctly the hour of a task +FIX: #5776 +FIX: #5802 Incoterms not set +FIX: #5813 Bug: Incoterms not being read correctly +FIX: #5818 +FIX: alignement of intervention status +FIX: Clean of search fields +FIX: Creation of donation should go back on card after creation +FIX: Date visible on project overview +FIX: Execute a dedicated job from its id may results of launching other jobs too. +FIX: Failed to export contact categories with contact extra fields +FIX: inversion customer/supplier price +FIX: link "back to list" was not visible. +FIX: Lost filter on opportunities +FIX: Mandatory field payment term was not css highlighted. +FIX: Menu users not visible on dolidroid. +FIX: SEC for HTB23302 +FIX: The email test sender in email setup was broken +FIX: Translation of "Name" is not a good choice for floow-up. +FIX: Update of maxnbrun on job list failed. +FIX: Value of payment term and project are not set on correct default value when invoice generated from template. +FIX: vat dictionary should allow enter and edit multiple values for localtaxes, separated by: (ex -19:-15) +FIX: Vat not visible in dictionnary + +***** ChangeLog for 4.0.0 compared to 3.9.* ***** +For users: +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 @@ -94,33 +151,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 @@ -140,8 +199,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: @@ -161,7 +221,41 @@ So if you included it into your module, change your code like this to be compati if (! $res) include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_pre_headers.tpl.php'; - +***** ChangeLog for 3.9.3 compared to 3.9.2 ***** +FIX: #4383 $userid not defined +FIX: #4448 $filebonprev is not used, $this->filename now +FIX: #4455 +FIX: #4749 +FIX: #4756 +FIX: #4828 +FIX: #4926 +FIX: #4964 buyprice in customer from shipping buyprice wasn't load in expedition::fetch_lines +FIX: #5004 +FIX: #5068 +FIX: #5170 tva sign with INVOICE_POSITIVE_CREDIT_NOTE option +FIX: #5338 use of not initialized var $aphour, $apmin, etc +FIX: #5343 +FIX: #5380 +FIX: #5383 bad object id on don delete +FIX: #5414 +FIX: #5470 User of expense report in bank transactions page is not correct +FIX: a case of corrupted ODT by Word that insert when it should not. +FIX: Can't create thirdparty or validate invoice if profid is mandatory and profid does not exists for other countries +FIX: dasboard wrong for late invoice +FIX: duplicate jquery.js files +FIX: extrafield cloned on project clone +FIX: Failed to open file +FIX: Filter on opportunity amount and budget +FIX: form_confirm to delete payment on supplier invoice +FIX: javascript error with german-switzerland language +FIX: large expense note +FIX: Missing original .js file (license violation if sources are not provided) +FIX: Option strict mode compatibility +FIX: product stats all bloc module without enbaled test +FIX: receiving link never works +FIX: task ODT company object not correctly retrieved +FIX: Translate group perms as it is done into user perms +FIX: We must take the last recent defined price when using price level ***** ChangeLog for 3.9.2 compared to 3.9.1 ***** FIX: #4813 Won translation for the key OppStatusWON instead OppStatusWIN @@ -425,7 +519,68 @@ This is list of hooks modified: - Remove deprecated Product::hidden property - + +***** ChangeLog for 3.8.5 compared to 3.8.4 ***** +FIX: #3815 Call to undefined function local_by_date(). +FIX: #4424 Missing email of user popup in supplier orders area +FIX: #4442 Missing translation in Banks menu +FIX: #4448 $filebonprev is not used, $this->filename now +FIX: #4455 +FIX: #4737 Bank transacion type selector translation is cropped +FIX: #4742 Able to delete a supplier invoice with a registered payment +FIX: #4743 UI glitch in project summary page +FIX: #4747 Missing UI background when registering a supplier invoice payment +FIX: #4748 Supplier invoice payment confirmation amount is not translated +FIX: #4749 +FIX: #4756 +FIX: #4766 VAT not shown in supplier invoice popup +FIX: #4809 - Duplicate functions with different content +FIX: #4851 Project selector in supplier invoices shows the project label twice +FIX: #4870 +FIX: #5008 SQL error when editing the reference of a supplier invoice that already exists +FIX: #5048 Product supplier list display only one produc +FIX: #5170 tva sign with INVOICE_POSITIVE_CREDIT_NOTE option +FIX: #5203 +FIX: #5207 +FIX: #5338 use of not initialized var $aphour, $apmin, etc +FIX: #5380 +FIX: #5383 bad object id on don delete +FIX: #5474 Country_id of "Don" object is still empty +FIX: Accountancy - 3.8 - Chart of accounts are limited on only one country +FIX: Bad include and param for project numbering module call +FIX: Box disabled because bugged +FIX: bug on email template +FIX: Can correct stock of lot using eatby or sell by date +FIX: Can make a movement on "out of sell" products +FIX: Can't create thirdparty or validate invoice if profid is mandatory and profid does not exists for other countries +FIX: can't fetch by siret or siren because of first "if" +FIX: Check stock of product by warehouse if $entrepot_id defined on shippings +FIX: correct display of minimum buying price +FIX: Creation of thumb image for size "small" was not done. +FIX: Direction of movement lost if an error occurs +FIX: dont retrieve new buying price on margin display +FIX: Duplicate records into export +FIX: Email templates not compatible with Multicompany +FIX: end of select when no fournprice +FIX: finished parameters not used +FIX: hook on group card called but not initialized +FIX: It doesn't check if there is enough stock to update the lines of orders/invoices +FIX: large expense note +FIX: missing column when module was installed before standard integration +FIX: Missing database escaping on supplier price insert/update +FIX: Not filtering correctly when come from dashboard +FIX: PROPAL_MERGE_PDF with PRODUCT_USE_OLD_PATH +FIX: real min buying price +FIX: receiving link never works +FIX: same page added several times on mergepropal option +FIX: search on date into supplier invoice list dont work because of status -1 +FIX: Search supplier ref on contract +FIX: SQL error function on getAvailableDiscounts function, on bill create mode if socid is empty +FIX: systematic rounding causes prices to be updated without reason +FIX: task ODT company object not correctly retrieved +FIX: Template email must take care of positino column +FIX: VAT rate can be negative. Example spain selling to morroco. + ***** ChangeLog for 3.8.4 compared to 3.8.3 ***** FIX: #3694 FIX: #3798 #2519 Cron jobs would never be executed @@ -838,7 +993,7 @@ NEW: add hook in send mail NEW: Add hooks on list of members to allow an external module to add more fields into list view. NEW: Add hooks to allow an external module to complete list of events into calendar views. NEW: Add opportunity amount on project card. -NEW: Add option THEME_ELDY_DISABLE_IMAGE to disable images into menu eldy. +NEW: Add option THEME_TOPMENU_DISABLE_IMAGE to disable images into menu eldy. NEW: add PDF icon on linked element into project NEW: add "productpricecard" hook and uniformize code NEW: Add ref and label of project into export diff --git a/Dockerfile b/Dockerfile index a5eb941c781..00a5d0ef567 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,14 +1,19 @@ FROM php:5.6-apache -RUN apt-get update && apt-get install -y libpng12-dev libjpeg-dev \ +RUN apt-get update && apt-get install -y libpng12-dev libjpeg-dev libldap2-dev \ && rm -rf /var/lib/apt/lists/* \ && docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr \ - && docker-php-ext-install gd - -RUN docker-php-ext-install mysqli + && docker-php-ext-install gd \ + && docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu/ \ + && docker-php-ext-install ldap \ + && docker-php-ext-install mysqli \ + && apt-get purge -y libpng12-dev libjpeg-dev libldap2-dev COPY htdocs/ /var/www/html/ RUN chown -hR www-data:www-data /var/www/html -EXPOSE 80 \ No newline at end of file +VOLUME /var/www/html/conf +VOLUME /var/www/html/documents + +EXPOSE 80 diff --git a/PITCHME.md b/PITCHME.md new file mode 100644 index 00000000000..9cbda142cdb --- /dev/null +++ b/PITCHME.md @@ -0,0 +1,377 @@ +#HSLIDE + +## Dolibarr ERP CRM +##### A GitPitch Feature Tour + +#HSLIDE +## Slideshow Theme Switcher +Available bottom-left of screen. | +Start switching themes right now! + +#HSLIDE + +## Tip! +For best viewing experience press **F** key to go fullscreen. + +#HSLIDE + +## Markdown Slides +Press Down key for details. | +See GitPitch Wiki for details. + + +#VSLIDE + +#### Use GitHub Flavored Markdown +#### For Slide Content Creation + +
+ +The same tool you use to create project **READMEs** and **Wikis** for your Git repos. + +#HSLIDE + +## Code Slides +Press Down key for examples. | +See GitPitch Wiki for details. + +#VSLIDE + +#### Use Markdown Code Blocks + +
+ +And enjoy code syntax highlighting for dozens of languages powered by highlight.js. + +#VSLIDE + +```JavaScript +// JavaScript Code Block + +$('button').click(function(){ + $('h1, h2, p').addClass('blue') + $('div').removeClass('important') + $('h3').toggleClass('error') + $('#foo').attr('alt', 'Lorem Ipsum') +}); +``` + +#VSLIDE + +```Scala +// Scala Code Block + +HashMap params = HashMap(n -> 10, mean -> 5) + +// Define executable for R stats#rnorm function call. +OCPUTask task = OCPU.R() + .pkg("stats") + .function("rnorm") + .input(params.asJava) + .library() +``` + +#VSLIDE + +```Go +// Go Code Block + +package main + +import "fmt" + +func swap(x, y string) (string, string) { + return y, x +} + +func main() { + a, b := swap("hello", "world") + fmt.Println(a, b) +} +``` + +#HSLIDE + +## GIST Slides +Press Down key for examples. | +See GitPitch Wiki for details. + +#VSLIDE + +#### GitHub GIST +#### Building Blocks For Any Presentation + +
+ +Enjoy 100% reusable code snippets, excellent syntax highlighting, code indentation and styling. + +#VSLIDE?gist=8da53731fd54bab9d5c6 + +#VSLIDE?gist=28ee3d19ddef9d51b15adbdfe9ed48da + +#HSLIDE + +## Image Slides +## [ Inline ] +Press Down key for examples. | +See GitPitch Wiki for details. + +#VSLIDE + +#### Make A Visual Statement + +
+ +Use inline images to lend a *visual punch* to your slideshow presentations. + + +#VSLIDE + +Inline Image at Absolute URL + +![Image-Absolute](https://d1z75bzl1vljy2.cloudfront.net/kitchen-sink/octocat-privateinvestocat.jpg) + +the Private Investocat by jeejkang + + +#VSLIDE + +Inline Image at GitHub Repo Relative URL + +![Image-Absolute](assets/octocat-de-los-muertos.jpg) + +the Octocat-De-Los-Muertos by cameronmcefee + + +#VSLIDE + +Animated GIFs Work Too! + +![Image-Relative](https://d1z75bzl1vljy2.cloudfront.net/kitchen-sink/octocat-daftpunkocat.gif) + +the Daftpunktocat-Guy by jeejkang + +#HSLIDE + +## Image Slides +## [ Background ] +Press Down key for examples. | +See GitPitch Wiki for details. + +#VSLIDE + +#### Make A Bold Visual Statement + +
+ +Use high-resolution background images for maximum impact. + +#VSLIDE?image=https://d1z75bzl1vljy2.cloudfront.net/kitchen-sink/victory.jpg + +#VSLIDE?image=https://d1z75bzl1vljy2.cloudfront.net/kitchen-sink/127.jpg + + +#HSLIDE + +## Video Slides +## [ Inline ] +Press Down key for examples. | +See GitPitch Wiki for details. + +#VSLIDE + +#### Bring Your Presentations Alive + +
+ +Embed *YouTube*, *Vimeo*, *MP4* and *WebM* inline on any slide. + +#VSLIDE + +![YouTube Video](https://www.youtube.com/embed/dNJdJIwCF_Y) + +#VSLIDE + +![Vimeo Video](https://player.vimeo.com/video/125471012) + +#VSLIDE + +![MP4 Video](http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4) + + +#HSLIDE + +## Video Slides +## [ Background ] +Press Down key for examples. | +See GitPitch Wiki for details. + +#VSLIDE + +#### Maximize The Viewer Experience + +
+ +Go fullscreen with *MP4* and *WebM* videos. + +#VSLIDE?video=http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4 + +#HSLIDE + +## Math Notation Slides +Press Down key for examples. | +See GitPitch Wiki for details. + +#VSLIDE + + +#### Beautiful Math Rendered Beautifully + +
+ +Use *TeX*, *LaTeX* and *MathML* markup powered by MathJax. + +#VSLIDE + +`$$\sum_{i=0}^n i^2 = \frac{(n^2+n)(2n+1)}{6}$$` + +#VSLIDE + +`\begin{align} +\dot{x} & = \sigma(y-x) \\ +\dot{y} & = \rho x - y - xz \\ +\dot{z} & = -\beta z + xy +\end{align}` + +#VSLIDE + +##### The Cauchy-Schwarz Inequality + +`\[ +\left( \sum_{k=1}^n a_k b_k \right)^{\!\!2} \leq + \left( \sum_{k=1}^n a_k^2 \right) \left( \sum_{k=1}^n b_k^2 \right) +\]` + +#VSLIDE + +##### The probability of getting \(k\) heads when flipping \(n\) coins is: + +`\[P(E) = {n \choose k} p^k (1-p)^{ n-k} \]` + +#VSLIDE + +##### In-line Mathematics + +This expression `\(\sqrt{3x-1}+(1+x)^2\)` is an example of an inline equation. + +#HSLIDE + +## Slide Fragments +Press Down key for examples. | +See GitPitch Wiki for details. + +#VSLIDE + +#### Reveal Slide Concepts Piecemeal + +
+ +Step through slide content in sequence to slowly reveal the bigger picture. + +#VSLIDE + +- Java +- Groovy +- Kotlin +- Scala +- The JVM rocks! + +#VSLIDE + + + + + + + + + + + + + + + + + + + + + + +
FirstnameLastnameAge
JillSmith25
EveJackson94
JohnDoe43
+ +#HSLIDE +## PITCHME.yaml Settings +Press Down key for examples. | +See GitPitch Wiki for details. + +#VSLIDE + +#### Stamp Your Own Look and Feel + +
+ +Set a default theme, custom logo, custom css, background image, and preferred code syntax highlighting style. + +#VSLIDE + +#### Customize Slideshow Behavior + +
+ +Enable auto-slide with custom slide intervals, presentation looping, and RTL flow. + + +#HSLIDE +## Slideshow Keyboard Controls +Press Down key for examples. | +See GitPitch Wiki for details. + +#VSLIDE + +#### Try Out These Great Features Now! + +
+ +| Mode | On Key | Off Key | +| ---- | :------: | :--------: | +| Fullscreen | F | Esc | +| Overview | O | O | +| Blackout | B | B | +| Help | ? | Esc | + + +#HSLIDE + +## GitPitch Social +Press Down key for examples. | +See GitPitch Wiki for details. + +#VSLIDE + +#### Slideshows Designed For Sharing + +
+ +- View any slideshow at its public URL +- [Promote](https://github.com/gitpitch/gitpitch/wiki/Slideshow-GitHub-Badge) any slideshow using a GitHub badge +- [Embed](https://github.com/gitpitch/gitpitch/wiki/Slideshow-Embedding) any slideshow within a blog or website +- [Share](https://github.com/gitpitch/gitpitch/wiki/Slideshow-Sharing) any slideshow on Twitter, LinkedIn, etc +- [Print](https://github.com/gitpitch/gitpitch/wiki/Slideshow-Printing) any slideshow as a PDF document +- [Download and present](https://github.com/gitpitch/gitpitch/wiki/Slideshow-Offline) any slideshow offline + +#HSLIDE + +## GO FOR IT. +## JUST ADD PITCHME.md ;) \ No newline at end of file diff --git a/README-FR.md b/README-FR.md index b3ce951c975..41edb8ba50e 100644 --- a/README-FR.md +++ b/README-FR.md @@ -3,7 +3,7 @@ Dolibarr ERP & CRM est un logiciel moderne pour gérer votre activité (société, association, auto-entrepreneurs, artisans). Il est simple d'utilisation et modulaire, vous permettant de n'activez que les fonctions dont vous avez besoin (contacts, fournisseurs, factures, commandes, stocks, agenda, ...). -![ScreenShot](http://www.dolibarr.org/images/dolibarr_screenshot1_640x480.png) +![ScreenShot](https://www.dolibarr.org/images/dolibarr_screenshot1_640x480.png) @@ -23,9 +23,9 @@ Ubuntu) ou DoliRpm (la version tout-en-un de Dolibarr pour Fedora, Redhat, OpenSuse, Mandriva ou Mageia). Vous pouvez les télécharger depuis la rubrique *download* du portail officiel: -http://www.dolibarr.org/ +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...) @@ -139,13 +139,13 @@ Suivez le projet Dolibarr project sur les réseaux francophones - Facebook: - Google+: -- Twitter: +- Twitter: ou sur les réseaux anglophones - [Facebook](https://www.facebook.com/dolibarr) - [Google+](https://plus.google.com/+DolibarrOrg) -- [Twitter](http://www.twitter.com/dolibarr) +- [Twitter](https://www.twitter.com/dolibarr) - [LinkedIn](https://www.linkedin.com/company/association-dolibarr) - [YouTube](https://www.youtube.com/user/DolibarrERPCRM) - [GitHub](https://github.com/Dolibarr/dolibarr) diff --git a/README.md b/README.md index a3a542b194e..64579486985 100644 --- a/README.md +++ b/README.md @@ -2,15 +2,15 @@ ![Build status](https://img.shields.io/travis/Dolibarr/dolibarr/develop.svg) ![Downloads per day](https://img.shields.io/sourceforge/dm/dolibarr.svg) -Dolibarr ERP & CRM is a modern software to manage your organization's activity (contacts, suppliers, invoices, orders, stocks, agenda, ...). +Dolibarr ERP & CRM is a modern software package to manage your organization's activity (contacts, suppliers, invoices, orders, stocks, agenda, ...). -It's an Open Source software (wrote in PHP language) designed for small and medium companies, foundation and freelances. +It's an Open Source software (wrote in PHP language) designed for small, medium or large companies, foundations and freelances. You can freely use, study, modify or distribute it according to its Free Software licence. You can use it as a standalone application or as a web application to be able to access it from the Internet or a LAN. -![ScreenShot](http://www.dolibarr.org/images/dolibarr_screenshot1_640x400.png) +![ScreenShot](https://www.dolibarr.org/images/dolibarr_screenshot1_640x400.png) ## LICENSE @@ -24,7 +24,7 @@ Other licenses apply for some included dependencies. See [COPYRIGHT](https://git ### Download -Releases can be downloaded from [official website](http://www.dolibarr.org/). +Releases can be downloaded from [official website](https://www.dolibarr.org/). ### Simple setup @@ -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: @@ -133,7 +133,7 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog) ### Extending -Dolibarr can be extended with a lot of other external modules from third party developers available at the [DoliStore](http://www.dolistore.com). +Dolibarr can be extended with a lot of other external modules from third party developers available at the [DoliStore](https://www.dolistore.com). ## FUTURE @@ -165,7 +165,7 @@ Follow Dolibarr project on: - [Facebook](https://www.facebook.com/dolibarr) - [Google+](https://plus.google.com/+DolibarrOrg) -- [Twitter](http://www.twitter.com/dolibarr) +- [Twitter](https://www.twitter.com/dolibarr) - [LinkedIn](https://www.linkedin.com/company/association-dolibarr) - [YouTube](https://www.youtube.com/user/DolibarrERPCRM) - [GitHub](https://github.com/Dolibarr/dolibarr) diff --git a/build/README-FR b/build/README-FR deleted file mode 100644 index b677e545595..00000000000 --- a/build/README-FR +++ /dev/null @@ -1,78 +0,0 @@ -README (French) -################################ -Building packages -################################ - -Les sous repertoires du repertoire "build" contiennent tous les fichiers -requis pour packager Dolibarr de maniere automatisee. -On trouve plusieurs outils: - -- Pour construire un package Dolibarr complet, il suffit de -> Editer la version dans le fichier makepack-dolibarr.pl -> Lancer la commande perl makepack-dolibarr.pl - -- Pour construire un package d'une traduction, il suffit de lancer le script -> perl makepack-dolibarrlang.pl - -- Pour construire un package d'un theme, il suffit de lancer le script -> perl makepack-dolibarrtheme.pl - -- Pour construire un package d'un module, il suffit de lancer le script -> perl makepack-dolibarrmodule.pl - -- Pour construire un package DoliWamp autoexe: -> Installer InnoSetup (http://www.jrsoftware.org) -> Installer WampServer dans "C:\Program Files\Wamp" (http://www.wampserver.com) -> Installer les addon WampServer afin d'y mettre les versions: - Apache2.2.6, Mysql5.0.45, Php5.2.5 -> Modifier dans le fichier build/exe/doliwamp.iss la variable SourceDir - afin d'y mettre le repository Dolibarr. -> Modifier AppVerName et OutputBaseFilename. -> Lancer innosetup, ouvrir le fichier build/exe/doliwamp.iss et cliquer sur - le bouton "Compile". Le fichier .exe sera fabrique dans le repertoire build. - -- Pour generer la documentation developpeur, lancer le script -> perl dolybarr-doxygen-build.pl - - -Note: - -Le repertoire build et tout ce qu'il contient n'est absolument pas requis -pour faire fonctionner Dolibarr. Ils ne servent qu'a la generation des -packages. Certains packages, une fois construit, n'incluent par le repertoire -"build". - -On trouve dans le repertoire "build", les sous-repertoires utilises par -l'outil makepack-dolibarr.pl: - -* deb: -Fichier de config pour construire un package Debian. - -* rpm: -Fichier de config pour construire un package Redhat ou Mandrake. - -* tgz: -Fichier de config pour construire un package tgz. - -* exe: -Fichier de config pour construire un package exe pour Windows des sources -ou pour construire l'assistant d'installation complet DoliWamp. - -* zip: -Fichier de config pour construire un package zip. - -* live: -Fichier pour fabriquer un live CD de demo de Dolibarr. - -* patch: -Fichier exemple de generation de fichier patch pour diffusion d'une -modification de Dolibarr. - -* doap: -Fichier descriptif DOAP pour promouvoir/decrire la version de Dolibarr. - -* pad: -Fichier descriptif PAD pour promouvoir/decrire la version de Dolibarr. - -* dmg: -Fichier de config pour construire un package dmg DoliMamp pour Mac OS X diff --git a/build/debian/README.howto b/build/debian/README.howto index 6632d6e8e84..86b2acababb 100644 --- a/build/debian/README.howto +++ b/build/debian/README.howto @@ -154,8 +154,10 @@ tag 729538 -moreinfo ##### Testing a package into unstable env Check you have a mysql server available from another interface than "localhost". -Comment line in /etc/mysql/my.cnf if required and restart mysql -#bind-address = 127.0.0.1 +Set line in /etc/mysql/my.cnf if required and restart mysql + +[mysqld] +bind-address = * Create a chroot called "unstable-amd64-sbuild". Chroot env is stored into /srv/chroot directory. @@ -170,6 +172,8 @@ Puis pour se connecter et préparer l'environnement > schroot -c name_of_chroot > cat /etc/debian_chroot to check which debian branch we are into > vi /usr/sbin/policy-rc.d and replace return code 101 (not allowed) into 0 (ok) +> apt-get update +> apt-get upgrade > apt-get install links mysql-client To test a package @@ -185,7 +189,7 @@ To test a package If there is a problem launching apache, because port is already used, change it into your chroot install with > vi /etc/apache2/ports.conf Then restart. -Then you can call/test dolibarr with http://localhost:port/dolibarr/ (It can be also called from host). +Then you can call/test dolibarr with http://localhost:port/dolibarr/ . It can be also called FROM HOST (port must be a not used port on host). @@ -288,16 +292,21 @@ from origin/upstream and origin/pristine. > debian/get-orig-source.sh If script fails with error Bad certificate, you can set "export PERL_LWP_SSL_VERIFY_HOSTNAME=0" to solve this. -* Edit tgz file to remove +* Edit orig.tar.gz file to remove +- debian - htdocs/includes/ckeditor -- htdocs/includes/jquery/plugins/datatables/extras/TableTools/swf -- htdocs/includes/phpexcel -- htdocs/includes/tcpdf +- htdocs/includes/jszip +- htdocs/includes/jquery/plugins/datatables +- htdocs/includes/mike42 +- htdocs/includes/phpexcel or htdocs/includes/phpoffice +- htdocs/includes/swiftmailer +- htdocs/includes/restler/framework/Luracast/Restler/explorer +- htdocs/includes/tcpdf or htdocs/includes/tecnickcom And rename file into dolibarr-x.y.z+dfsgw.tgz (x.y.z = version, w start from 1 and is increased for each new git-import-orig already done) -* Staying into git root directory, run +* Staying into projet gitted root directory, run > git-import-orig -vv ../dolibarr-x.y.z+dfsgw.tgz --debian-branch=[master|jessie] --upstream-branch=[upstream|upstream-3.5.x] and enter version when requested with format x.y.z+dfsgw diff --git a/build/debian/conf.php.install b/build/debian/conf.php.install index c0ba3bdb120..c27d9e0985b 100644 --- a/build/debian/conf.php.install +++ b/build/debian/conf.php.install @@ -100,9 +100,8 @@ $dolibarr_main_db_pass=''; # This parameter contains the name of the driver used to access your # Dolibarr database. # Default value: none -# Possible values: mysql, mysqli, pgsql +# Possible values: mysqli, pgsql # Examples: -# $dolibarr_main_db_type='mysql'; # $dolibarr_main_db_type='mysqli'; # $dolibarr_main_db_type='pgsql'; # diff --git a/build/debian/control b/build/debian/control index d25c752c14c..37689ef9bcc 100755 --- a/build/debian/control +++ b/build/debian/control @@ -13,10 +13,10 @@ Architecture: all Depends: libapache2-mod-php5 | libapache2-mod-php5filter | php5-cgi | php5-fpm | php5, php5-cli, # Required PHP extensions - php5-mysql | php5-mysqli, php5-curl, php5-gd, php5-ldap, php5-geoip, + php5-mysql | php5-mysqli, php5-curl, php5-gd, php5-ldap, # Required PHP libraries php-pear, php-mail-mime, -# php-tcpdf, libfpdi-php, +# php-tcpdf, # libfpdf-tpl-php, php-fpdf, # libphp-adodb, # libnusoap-php, @@ -26,15 +26,15 @@ 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 -Suggests: www-browser +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 for small - and medium companies, foundations or freelances. It includes different + Dolibarr ERP & CRM is an easy to use open source/free software package for + companies, foundations or freelances. It includes different features for Enterprise Resource Planning (ERP) and Customer Relationship Management (CRM) but also for different other activities. . diff --git a/build/debian/copyright b/build/debian/copyright index e568996551e..8207df4b6d7 100644 --- a/build/debian/copyright +++ b/build/debian/copyright @@ -1,7 +1,7 @@ Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: Dolibarr Upstream-Contact: Laurent Destailleur -Source: http://www.dolibarr.org/files/stable/standard/ +Source: https://www.dolibarr.org/files/stable/standard/ Files: * Copyright: 2002-2009, Rodolphe Quiedeville @@ -197,9 +197,6 @@ License: GPL-2+ On Debian systems, the full text of the GNU General Public License version 2 can be found in the file `/usr/share/common-licenses/GPL-2'. -Comment: - Those files are not shipped in the binary package as we - configure Dolibarr to use the library packaged in "libfpdi-php". Files: htdocs/includes/geoip/* Copyright: 2007 MaxMind LLC diff --git a/build/debian/dolibarr.docs b/build/debian/dolibarr.docs index 5d4b554ef74..b43bf86b50f 100644 --- a/build/debian/dolibarr.docs +++ b/build/debian/dolibarr.docs @@ -1,2 +1 @@ README.md -README-FR.md diff --git a/build/debian/dolibarr.postinst b/build/debian/dolibarr.postinst index 5f61ffe2083..4b946fda433 100644 --- a/build/debian/dolibarr.postinst +++ b/build/debian/dolibarr.postinst @@ -147,7 +147,6 @@ case "$1" in # File already exist. We add params not found. #echo Add new params to overwrite path to use shared libraries/fonts #grep -q -c "dolibarr_lib_ADODB_PATH" $config || [ ! -d "/usr/share/php/adodb" ] || echo "" >> $config - #grep -q -c "dolibarr_lib_FPDI_PATH" $config || [ ! -d "/usr/share/php/fpdi" ] || echo "" >> $config ##grep -q -c "dolibarr_lib_GEOIP_PATH" $config || echo "" >> $config #grep -q -c "dolibarr_lib_NUSOAP_PATH" $config || [ ! -d "/usr/share/php/nusoap" ] || echo "" >> $config #grep -q -c "dolibarr_lib_ODTPHP_PATHTOPCLZIP" $config || [ ! -d "/usr/share/php/libphp-pclzip" ] || echo "" >> $config diff --git a/build/debian/install.forced.php.install b/build/debian/install.forced.php.install index 57ab33464bc..56eef3287a6 100644 --- a/build/debian/install.forced.php.install +++ b/build/debian/install.forced.php.install @@ -30,8 +30,6 @@ $force_install_lockinstall='444'; // - not removed from package (see rm in rules file), // - declared into dependencies (see Depends in control file) //$force_dolibarr_lib_TCPDF_PATH=''; -//$force_dolibarr_lib_FPDF_PATH='/usr/share/php/fpdf'; -//$force_dolibarr_lib_FPDI_PATH='/usr/share/php/fpdi'; //$force_dolibarr_lib_ADODB_PATH='/usr/share/php/adodb'; //$force_dolibarr_lib_GEOIP_PATH=''; //$force_dolibarr_lib_NUSOAP_PATH='/usr/share/php/nusoap'; diff --git a/build/debian/rules b/build/debian/rules index bd3a9badb09..50866c03e68 100755 --- a/build/debian/rules +++ b/build/debian/rules @@ -79,7 +79,6 @@ override_dh_install: # clean from all PHP embedded libraries (we use package dependencies instead) # rm -fr htdocs/includes/adodbtime -# rm -fr htdocs/includes/fpdfi # rm -fr htdocs/includes/geoip # rm -fr htdocs/includes/nusoap # rm -fr htdocs/includes/odtphp/zip/pclzip diff --git a/build/debian/source/lintian-overrides b/build/debian/source/lintian-overrides index a6c41886810..603c27ef4cd 100644 --- a/build/debian/source/lintian-overrides +++ b/build/debian/source/lintian-overrides @@ -1,3 +1,5 @@ # Remove warning, we want to keep both standard and minified sources. dolibarr: source-contains-prebuilt-javascript-object htdocs/includes/jsgantt/* -dolibarr: source-contains-prebuilt-javascript-object htdocs/includes/jquery/* \ No newline at end of file +dolibarr: source-contains-prebuilt-javascript-object htdocs/includes/jquery/* +# This is a textual data file +source-is-missing htdocs/includes/mobiledetect/mobiledetectlib/Mobile_Detect.json \ No newline at end of file diff --git a/build/debian/watch b/build/debian/watch index a5b736c1f65..8206a7f8b7a 100644 --- a/build/debian/watch +++ b/build/debian/watch @@ -2,4 +2,4 @@ version=3 #http://sf.net/dolibarr/dolibarr-(.+)\.tgz -http://www.dolibarr.org/files/stable/standard/dolibarr-(.+)\.tgz +http://www.dolibarr.org/files/stable/package_debian-ubuntu/dolibarr_(.+)\.orig\.tar\.gz diff --git a/build/doxygen/doxygen_footer.html b/build/doxygen/doxygen_footer.html index e11df270ddc..a6d5bdfb293 100644 --- a/build/doxygen/doxygen_footer.html +++ b/build/doxygen/doxygen_footer.html @@ -4,17 +4,14 @@ File added into doxygen generated documentation - @@ -22,7 +19,7 @@ File added into doxygen generated documentation +for $projectname by Doxygen $doxygenversion @@ -35,11 +32,20 @@ google_ad_width = 468; google_ad_height = 60; //--> - +
+ + + + + + \ No newline at end of file diff --git a/build/doxygen/doxygen_header.html b/build/doxygen/doxygen_header.html index 0c2e189136b..fe316d2081e 100644 --- a/build/doxygen/doxygen_header.html +++ b/build/doxygen/doxygen_header.html @@ -1,6 +1,4 @@ - + @@ -14,7 +12,23 @@ File added into doxygen generated documentation + + + + + +
diff --git a/build/exe/doliwamp/Languages/MyCatalan.isl b/build/exe/doliwamp/Languages/MyCatalan.isl index a78042e795b..d8b86eae5ba 100644 --- a/build/exe/doliwamp/Languages/MyCatalan.isl +++ b/build/exe/doliwamp/Languages/MyCatalan.isl @@ -20,7 +20,7 @@ DoYouWantToStart=Vol iniciar el proc TechnicalParameters=Parmetres tcnics IfFirstInstall=Si es tracta de la primera instal laci, haur d'especificar alguns parmetres tcnics. Si no els entn, no sabeu o va a procedir a una actualitzaci, deixi els camps amb els valors proposats per defecte. -; WARNING !!! STRINGS HERE MUST BE LOWER THAN 60 CHARACTERS +; WARNING !!! STRINGS HERE MUST BE LOWER THAN 70 CHARACTERS SMTPServer=Servidor SMTP (El seu o el del seu ISP, nicament primera instal.laci) : ApachePort=Puerto Apache (nicament primera instal.laci, normalment s el 80) : MySqlPort=Puerto Mysql (nicament primera instal.laci, normalment s el 3306) : @@ -31,6 +31,7 @@ FailedToDeleteLock=FailedToDeleteLock=Error en l'eliminaci PortAlreadyInUse=Sembla que el port %1 ja est sent utilitzat. Es recomana cancellar, tornar enrere i especificar un altre valor per al port% 2. Cancellar i escollir un altre valor? FirefoxDetected=S'ha detectat Firefox al seu ordinador. Voleu activar per defecte com a navegador per Dolibarr? +ChromeDetected=S'ha detectat Chrome al seu ordinador. Voleu activar per defecte com a navegador per Dolibarr? ChooseDefaultBrowser=Esculli el seu navegador per defecte. Si no est segur, simplement feu clic a Obrir: LaunchNow=Llanar ara Dolibarr diff --git a/build/exe/doliwamp/Languages/MyEnglish.isl b/build/exe/doliwamp/Languages/MyEnglish.isl index ed85010db1b..6e70f3c12f3 100644 --- a/build/exe/doliwamp/Languages/MyEnglish.isl +++ b/build/exe/doliwamp/Languages/MyEnglish.isl @@ -31,6 +31,7 @@ FailedToDeleteLock=Failed to delete the file %1/www/dolibarr/install.lock. You c PortAlreadyInUse=Port %1 seems to be already in use. You should cancel to go back and choose another value for %2 port. Cancel choice and choose another value ? FirefoxDetected=Firefox has been detected on your computer. Would you like to use it as the default browser for Dolibarr ? +ChromeDetected=Chrome has been detected on your computer. Would you like to use it as the default browser for Dolibarr ? ChooseDefaultBrowser=Please choose your default browser. If you are not sure, just click Open : LaunchNow=Launch Dolibarr now diff --git a/build/exe/doliwamp/Languages/MyFrench.isl b/build/exe/doliwamp/Languages/MyFrench.isl index 0fd71f96bfb..1daf4425e68 100644 --- a/build/exe/doliwamp/Languages/MyFrench.isl +++ b/build/exe/doliwamp/Languages/MyFrench.isl @@ -21,10 +21,10 @@ TechnicalParameters=Param IfFirstInstall=S'il s'agit de la premire installation, merci de spcifier ces quelques paramtres techniques. Si vous ne les comprennez pas, tes non sr, ou procdez une mise jour, laissez les champs avec les valeurs proposes par dfaut. -; WARNING !!! STRINGS FOR THIS 4 STRINGS MUST BE LOWER THAN 60 CHARACTERS -SMTPServer=Serveur SMTP (le votre ou celui de votre FAI, premire installation uniquement) : -ApachePort=Port Apache (premire installation uniquement, le choix standard est 80) : -MySqlPort=Port Mysql (premire installation uniquement, le choix standard est 3306) : +; WARNING !!! STRINGS FOR THIS 4 STRINGS MUST BE LOWER THAN 70 CHARACTERS +SMTPServer=Serveur SMTP (le votre ou de votre FAI, premire installation uniquement): +ApachePort=Port Apache (premire installation uniquement, le choix standard est 80): +MySqlPort=Port Mysql (premire installation uniquement, le choix standard est 3306): MySqlPassword=Mot de passe serveur+base MySql de root (premire installation uniquement): FailedToDeleteLock=Echec de la suppression du fichier %1/www/dolibarr/install.lock. Vous pouvez ignorer l'avertissement mais il est possible que vous deviez le supprimer manuellement plus tard. Dans ce cas, cela vous sera signal. Cliquez sur OK pour continuer... @@ -32,6 +32,7 @@ FailedToDeleteLock=Echec de la suppression du fichier %1/www/dolibarr/install.lo PortAlreadyInUse=Le port %1 semble dj utilis. Il est recommand d'annuler pour revenir en arrire et spcifier une autre valeur pour le port %2. Annuler le choix et choisir une autre valeur ? FirefoxDetected=Firefox a t dtect sur votre ordinateur. Voulez-vous en faire votre navigateur par dfaut pour Dolibarr ? +ChromeDetected=Chrome a t dtect sur votre ordinateur. Voulez-vous en faire votre navigateur par dfaut pour Dolibarr ? ChooseDefaultBrowser=Merci de choisir votre navigateur par dfaut. Si vous n'tes pas sr, cliquez simplement sur Ouvrir : LaunchNow=Lancer Dolibarr maintenant diff --git a/build/exe/doliwamp/Languages/MySpanish.isl b/build/exe/doliwamp/Languages/MySpanish.isl index 24a0c981e09..63c0136f351 100644 --- a/build/exe/doliwamp/Languages/MySpanish.isl +++ b/build/exe/doliwamp/Languages/MySpanish.isl @@ -20,7 +20,7 @@ DoYouWantToStart= TechnicalParameters=Parmetros tcnicos IfFirstInstall=Si se trata de la primera instalacin, deber especificar algunos parmetros tcnicos. Si no los entiende, no est seguro o va a proceder a una actualizacin, deje los campos con los valores propuestos por defecto. -; WARNING !!! STRINGS HERE MUST BE LOWER THAN 60 CHARACTERS +; WARNING !!! STRINGS HERE MUST BE LOWER THAN 70 CHARACTERS SMTPServer=Servidor SMTP (El suyo o el de su ISP, nicamente primera instalacin) : ApachePort=Puerto Apache (nicamente primera instalacin, normalmente es el 80) : MySqlPort=Puerto Mysql (nicamente primera instalacin, normalmente es el 3306) : @@ -31,6 +31,7 @@ FailedToDeleteLock=Error en la eliminaci PortAlreadyInUse=Parece que el puerto %1 ya esta siendo usado. Se recomienda cancelar, volver atras y especificar otro valor para el puerto %2. Cancelar y escojer otro valor? FirefoxDetected=Se ha detectado Firefox en su ordenador. Desea activarlo por defecto como navegador para Dolibarr ? +ChromeDetected=Se ha detectado Chrome en su ordenador. Desea activarlo por defecto como navegador para Dolibarr ? ChooseDefaultBrowser=Escoja su navegador por defecto. Si no est seguro, simplementa haga clic en Abrir : LaunchNow=Lanzar ahora Dolibarr diff --git a/build/exe/doliwamp/dolibarr.conf.install b/build/exe/doliwamp/dolibarr.conf.install index 40b8dea7784..db7a3ddc048 100644 --- a/build/exe/doliwamp/dolibarr.conf.install +++ b/build/exe/doliwamp/dolibarr.conf.install @@ -1,6 +1,6 @@ Alias /dolibarr "WAMPROOT/www/dolibarr/htdocs/" -# NOTE: +# NOTE FOR APACHE 2.2: # To restrict access to dolibarr from outside set lines # # Order Deny,Allow @@ -12,10 +12,18 @@ Alias /dolibarr "WAMPROOT/www/dolibarr/htdocs/" # Order Allow,Deny # Allow from all # +# NOTE FOR APACHE 2.3: +# To restrict access to dolibarr from outside set lines +# +# Require local +# +# instead of +# +# Require all granted +# Options Indexes FollowSymLinks MultiViews AllowOverride all - Order Allow,Deny - Allow from all + Require all granted \ No newline at end of file diff --git a/build/exe/doliwamp/doliwamp.bmp b/build/exe/doliwamp/doliwamp.bmp index 52b1320d111..3414e100306 100644 Binary files a/build/exe/doliwamp/doliwamp.bmp and b/build/exe/doliwamp/doliwamp.bmp differ diff --git a/build/exe/doliwamp/doliwamp.iss b/build/exe/doliwamp/doliwamp.iss index 8c6130437ac..34757a5123a 100644 --- a/build/exe/doliwamp/doliwamp.iss +++ b/build/exe/doliwamp/doliwamp.iss @@ -42,6 +42,7 @@ SolidCompression=yes WizardImageFile=build\exe\doliwamp\doliwamp.bmp WizardSmallImageFile=build\exe\doliwamp\doliwampsmall.bmp SetupIconFile=doc\images\dolibarr.ico +;To say the installer must be ran as admin PrivilegesRequired=admin DisableProgramGroupPage=yes ChangesEnvironment=no @@ -99,17 +100,18 @@ Source: "build\exe\doliwamp\builddemosslfiles.bat.install"; DestDir: "{app}\"; F Source: "build\exe\doliwamp\UsedPort.exe"; DestDir: "{app}\"; Flags: ignoreversion; ; PhpMyAdmin, Apache, Php, Mysql ; Put here path of Wampserver applications -; Value OK: apache 2.2.6, php 5.2.5 (5.2.11, 5.3.0 and 5.3.1 fails if php_exif, php_pgsql, php_zip is on), mysql 5.0.45 or 5.1.36 -; Value OK: apache 2.2.11, php 5.3.0 (if no php_exif, php_pgsql, php_zip), mysql 5.0.45 or 5.1.36 +; Value OK: apache 2.2.6, php 5.2.5 (5.2.11, 5.3.0 and 5.3.1 fails if php_exif, php_pgsql, php_zip is on), mysql 5.0.45 +; Value OK: apache 2.2.11, php 5.3.0 (if no php_exif, php_pgsql, php_zip), mysql 5.0.45 +; Value ???: apache 2.4.19, php 5.5.12, mysql 5.0.45 instead of 5.6.17 (wampserver2.5-Apache-2.4.9-Mysql-5.6.17-php5.5.12-32b.exe) Source: "C:\Program Files\Wamp\apps\phpmyadmin4.1.14\*.*"; DestDir: "{app}\apps\phpmyadmin4.1.14"; Flags: ignoreversion recursesubdirs; Excludes: "config.inc.php,wampserver.conf,*.log,*_log,darkblue_orange" Source: "C:\Program Files\Wamp\bin\apache\apache2.4.9\*.*"; DestDir: "{app}\bin\apache\apache2.4.9"; Flags: ignoreversion recursesubdirs; Excludes: "php.ini,httpd.conf,wampserver.conf,*.log,*_log" Source: "C:\Program Files\Wamp\bin\php\php5.5.12\*.*"; DestDir: "{app}\bin\php\php5.5.12"; Flags: ignoreversion recursesubdirs; Excludes: "php.ini,phpForApache.ini,wampserver.conf,*.log,*_log" -Source: "C:\Program Files\Wamp\bin\mysql\mysql5.6.17\*.*"; DestDir: "{app}\bin\mysql\mysql5.6.17"; Flags: ignoreversion recursesubdirs; Excludes: "my.ini,data\*,wampserver.conf,*.log,*_log,MySQLInstanceConfig.exe" +Source: "C:\Program Files\Wamp\bin\mysql\mysql5.0.45\*.*"; DestDir: "{app}\bin\mysql\mysql5.0.45"; Flags: ignoreversion recursesubdirs; Excludes: "my.ini,data\*,wampserver.conf,*.log,*_log,MySQLInstanceConfig.exe" ; Mysql data files (does not overwrite if exists) Source: "build\exe\doliwamp\mysql\*.*"; DestDir: "{app}\bin\mysql\data\mysql"; Flags: onlyifdoesntexist ignoreversion recursesubdirs; Excludes: ".gitignore,.project,CVS\*,Thumbs.db" ; Dolibarr Source: "htdocs\*.*"; DestDir: "{app}\www\dolibarr\htdocs"; Flags: ignoreversion recursesubdirs; Excludes: ".gitignore,.project,CVS\*,Thumbs.db,custom\*,custom2\*,documents\*,includes\ckeditor\_source\*,includes\savant\*,includes\phpmailer\*,jquery\plugins\template\*,nltechno*\*,PHPExcel\Shared\PDF\*,PHPExcel\Shared\PCLZip\*,tcpdf\fonts\dejavu-fonts-ttf-2.33\*,tcpdf\fonts\freefont-20100919\*,tcpdf\fonts\utils\*,*\conf.php,*\conf.php.mysql,*\conf.php.old,*\conf.php.postgres,*\conf.php.sav,*\install.forced.php" -Source: "dev\*.*"; DestDir: "{app}\www\dolibarr\dev"; Flags: ignoreversion recursesubdirs; Excludes: ".gitignore,.project,CVS\*,Thumbs.db,dbmodel\*,fpdf\*,initdata\*,iso-normes\*,licence\*,phpcheckstyle\*,phpunit\*,samples\*,test\*,uml\*,vagrant\*,xdebug\*" +Source: "dev\*.*"; DestDir: "{app}\www\dolibarr\dev"; Flags: ignoreversion recursesubdirs; Excludes: ".gitignore,.project,CVS\*,Thumbs.db,dbmodel\*,fpdf\*,initdata\*,initdemo\*,iso-normes\*,licence\*,phpcheckstyle\*,phpunit\*,samples\*,test\*,uml\*,vagrant\*,xdebug\*" Source: "doc\*.*"; DestDir: "{app}\www\dolibarr\doc"; Flags: ignoreversion recursesubdirs; Excludes: ".gitignore,.project,CVS\*,Thumbs.db,wiki\*,plaquette\*,dev\*,images\dolibarr_screenshot2.png,images\dolibarr_screenshot3.png,images\dolibarr_screenshot4.png,images\dolibarr_screenshot5.png,images\dolibarr_screenshot6.png,images\dolibarr_screenshot7.png,images\dolibarr_screenshot8.png,images\dolibarr_screenshot9.png,images\dolibarr_screenshot10.png,images\dolibarr_screenshot11.png,images\dolibarr_screenshot12.png" Source: "scripts\*.*"; DestDir: "{app}\www\dolibarr\scripts"; Flags: ignoreversion recursesubdirs; Excludes: ".gitignore,.project,CVS\*,Thumbs.db,product\materiel.net.php,product\import-product.php" Source: "*.*"; DestDir: "{app}\www\dolibarr"; Flags: ignoreversion; Excludes: ".gitignore,.project,CVS\*,Thumbs.db,default.properties,install.lock" @@ -118,8 +120,8 @@ Source: "build\exe\doliwamp\phpmyadmin.conf.install"; DestDir: "{app}\alias"; Fl Source: "build\exe\doliwamp\dolibarr.conf.install"; DestDir: "{app}\alias"; Flags: ignoreversion; Source: "build\exe\doliwamp\config.inc.php.install"; DestDir: "{app}\apps\phpmyadmin4.1.14"; Flags: ignoreversion; Source: "build\exe\doliwamp\httpd.conf.install"; DestDir: "{app}\bin\apache\apache2.4.9\conf"; Flags: ignoreversion; -Source: "build\exe\doliwamp\my.ini.install"; DestDir: "{app}\bin\mysql\mysql5.5.12"; Flags: ignoreversion; -Source: "build\exe\doliwamp\php.ini.install"; DestDir: "{app}\bin\php\php5.6.17"; Flags: ignoreversion; +Source: "build\exe\doliwamp\my.ini.install"; DestDir: "{app}\bin\mysql\mysql5.0.45"; Flags: ignoreversion; +Source: "build\exe\doliwamp\php.ini.install"; DestDir: "{app}\bin\php\php5.5.12"; Flags: ignoreversion; Source: "build\exe\doliwamp\index.php.install"; DestDir: "{app}\www"; Flags: ignoreversion; Source: "build\exe\doliwamp\install.forced.php.install"; DestDir: "{app}\www\dolibarr\htdocs\install"; Flags: ignoreversion; Source: "build\exe\doliwamp\openssl.conf"; DestDir: "{app}"; Flags: ignoreversion; @@ -145,6 +147,16 @@ Name: "{userdesktop}\Dolibarr Help center"; Filename: "{app}\rundolihelp.bat"; W ;Name: "{userstartup}\DoliWamp server"; Filename: "{app}\startdoliwamp.bat"; WorkingDir: "{app}"; Flags: runminimized; IconFilename: {app}\www\dolibarr\doc\images\dolibarr.ico +[Registry] +; Add "run as admin" flag. Same than command line: reg add "HKCU\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" /v "" /t REG_SZ /d RUNASADMIN +Root: "HKLM"; Subkey: "SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers"; ValueType: string; ValueName: "{app}\startdoliwamp.bat"; ValueData: "RUNASADMIN"; +Root: "HKLM"; Subkey: "SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers"; ValueType: string; ValueName: "{app}\stopdoliwamp.bat"; ValueData: "RUNASADMIN"; +Root: "HKLM32"; Subkey: "SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers"; ValueType: string; ValueName: "{app}\startdoliwamp.bat"; ValueData: "RUNASADMIN"; +Root: "HKLM32"; Subkey: "SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers"; ValueType: string; ValueName: "{app}\stopdoliwamp.bat"; ValueData: "RUNASADMIN"; +Root: "HKLM64"; Subkey: "SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers"; ValueType: string; ValueName: "{app}\startdoliwamp.bat"; ValueData: "RUNASADMIN"; Check: IsWin64 +Root: "HKLM64"; Subkey: "SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers"; ValueType: string; ValueName: "{app}\stopdoliwamp.bat"; ValueData: "RUNASADMIN"; Check: IsWin64 + + [Code] //variables globales @@ -197,7 +209,7 @@ begin //version des applis, a modifier pour chaque version de WampServer 2 apacheVersion := '2.4.9'; phpVersion := '5.5.12' ; - mysqlVersion := '5.6.17'; + mysqlVersion := '5.0.45'; phpmyadminVersion := '4.1.14'; smtpServer := 'localhost'; @@ -232,9 +244,9 @@ begin if RegQueryStringValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\MSCRM','SMTPServer', value) then begin if value <> '' then smtpServer:=value; - end - end - end + end; + end; + end; end; if RegQueryStringValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\NLTechno\DoliWamp','apachePort', value) then @@ -255,14 +267,13 @@ begin // Prepare an object calle "Page" of type wpInstalling. // Object will be show later in NextButtonClick function. - Page := CreateInputQueryPage(wpInstalling, - CustomMessage('TechnicalParameters'), '', - CustomMessage('IfFirstInstall')); + Page := CreateInputQueryPage(wpInstalling, CustomMessage('TechnicalParameters'), '', CustomMessage('IfFirstInstall')); // TODO Add control differently if first install or update if firstinstall then begin + // False means it's not a password edit Page.Add(CustomMessage('SMTPServer'), False); Page.Add(CustomMessage('ApachePort'), False); Page.Add(CustomMessage('MySqlPort'), False); @@ -270,6 +281,7 @@ begin end else begin + // False means it's not a password edit Page.Add(CustomMessage('SMTPServer'), False); Page.Add(CustomMessage('ApachePort'), False); Page.Add(CustomMessage('MySqlPort'), False); @@ -309,8 +321,7 @@ function NextButtonClick(CurPageID: Integer): Boolean; var myResult: Integer; var res: Boolean; var paramok: Boolean; -var datadirold: String; -var datadirnew: String; +var datadir: String; var exedirold: String; var exedirnew: String; var themessage: String; @@ -329,10 +340,22 @@ begin winPath := ExpandConstant('{win}'); pathWithSlashes := path; StringChange (pathWithSlashes, '\','/'); - datadirold := pathWithSlashes+'/bin/mysql/mysql5.6.17/data'; - datadirnew := pathWithSlashes+'/bin/mysql/data'; - exedirold := pathWithSlashes+'/bin/mysql/mysql5.6.17'; - exedirnew := pathWithSlashes+'/bin/mysql/mysql5.6.17'; + datadir := pathWithSlashes+'/bin/mysql/data'; + exedirold := pathWithSlashes+'/bin/mysql/mysql5.0.45'; + exedirnew := pathWithSlashes+'/bin/mysql/mysql5.0.45'; + + + //---------------------------------------------- + // Test if msvcr110 DLL has been installed + //---------------------------------------------- + + if not FileExists ('c:/windows/system32/msvcr110.dll') and not FileExists ('c:/windows/sysWOW64/msvcr110.dll') and not FileExists ('c:/winnt/system32/msvcr110.dll') and not FileExists ('c:/winnt/sysWOW64/msvcr110.dll') then + begin + // TODO Copy file or ask to install package ? + //CustomMessage('YouWillInstallDoliWamp')+#13#13 + MsgBox('The package vcredist_x86.exe must have been installed first. It seems it is not. Please install it first from http://www.microsoft.com/en-us/download/details.aspx?id=30679 then restart DoliWamp installation/upgrade.',mbInformation,MB_OK); + end; + // If we have a new database version, we should only copy old my.ini file into new directory // and change only all basedir= strings to use new version. Like this, data dir is still correct. @@ -401,7 +424,7 @@ begin begin themessage := FmtMessage(CustomMessage('FailedToDeleteLock'),[pathWithSlashes]); MsgBox(themessage,mbInformation,MB_OK); - end + end; // Check if parameters already defined in conf.php file @@ -522,13 +545,29 @@ begin begin //navigateur browser := 'iexplore.exe'; - if FileExists (pfPath+'/Mozilla Firefox/firefox.exe') then + + if browser = 'iexplore.exe' then begin - if MsgBox(CustomMessage('FirefoxDetected'),mbConfirmation,MB_YESNO) = IDYES then + if FileExists (pfPath+'/Google/Chrome/Application/chrome.exe') then begin - browser := pfPath+'/Mozilla Firefox/firefox.exe'; + if MsgBox(CustomMessage('ChromeDetected'),mbConfirmation,MB_YESNO) = IDYES then + begin + browser := pfPath+'/Google/Chrome/Application/chrome.exe'; + end; end; end; + + if browser = 'iexplore.exe' then + begin + if FileExists (pfPath+'/Mozilla Firefox/firefox.exe') then + begin + if MsgBox(CustomMessage('FirefoxDetected'),mbConfirmation,MB_YESNO) = IDYES then + begin + browser := pfPath+'/Mozilla Firefox/firefox.exe'; + end; + end; + end; + if browser = 'iexplore.exe' then begin if FileExists (pfPath+'/Internet Explorer/iexplore.exe') then @@ -558,7 +597,7 @@ begin StringChangeEx (srcContents, 'WAMPAPACHEPORT', myporta, True); StringChangeEx (srcContents, 'WAMPAPACHEPSSL', myportas, True); SaveStringToFile(destFileA,srcContents, False); - end + end; if MsgBox(CustomMessage('DoliWampWillStartApacheMysql'),mbConfirmation,MB_YESNO) = IDYES then @@ -581,7 +620,7 @@ begin StringChangeEx (srcContents, 'WAMPPHPMYADMINVERSION', phpmyadminVersion, True); SaveStringToFile(destFile,srcContents, False); - end + end; DeleteFile(srcFile); @@ -593,15 +632,29 @@ begin destFile := pathWithSlashes+'/alias/dolibarr.conf'; srcFile := pathWithSlashes+'/alias/dolibarr.conf.install'; - if not FileExists (destFile) and FileExists(srcFile) then + if FileExists(srcFile) then begin - LoadStringFromFile (srcFile, srcContents); + if not FileExists (destFile) then + begin + LoadStringFromFile (srcFile, srcContents); - StringChangeEx (srcContents, 'WAMPROOT', pathWithSlashes, True); - StringChangeEx (srcContents, 'WAMPMYSQLNEWPASSWORD', mypass, True); + StringChangeEx (srcContents, 'WAMPROOT', pathWithSlashes, True); + StringChangeEx (srcContents, 'WAMPMYSQLNEWPASSWORD', mypass, True); - SaveStringToFile(destFile, srcContents, False); - end + SaveStringToFile(destFile, srcContents, False); + end + else + begin + // We must replace to use format 2.4 of apache + DeleteFile(destFile); + LoadStringFromFile (srcFile, srcContents); + + StringChangeEx (srcContents, 'WAMPROOT', pathWithSlashes, True); + StringChangeEx (srcContents, 'WAMPMYSQLNEWPASSWORD', mypass, True); + + SaveStringToFile(destFile, srcContents, False); + end; + end; DeleteFile(srcFile); @@ -614,14 +667,25 @@ begin destFile := pathWithSlashes+'/apps/phpmyadmin'+phpmyadminVersion+'/config.inc.php'; srcFile := pathWithSlashes+'/apps/phpmyadmin'+phpmyadminVersion+'/config.inc.php.install'; - if not FileExists (destFile) and FileExists (srcFile) then + if FileExists(srcFile) then begin - // sinon on prends le fichier par defaut - LoadStringFromFile (srcFile, srcContents); - StringChangeEx (srcContents, 'WAMPMYSQLNEWPASSWORD', mypass, True); - StringChangeEx (srcContents, 'WAMPMYSQLPORT', myport, True); - SaveStringToFile(destFile,srcContents, False); - end + if not FileExists (destFile) then + begin + LoadStringFromFile (srcFile, srcContents); + StringChangeEx (srcContents, 'WAMPMYSQLNEWPASSWORD', mypass, True); + StringChangeEx (srcContents, 'WAMPMYSQLPORT', myport, True); + SaveStringToFile(destFile,srcContents, False); + end + else + begin + // We must replace to use format 2.4 of apache + DeleteFile(destFile); + LoadStringFromFile (srcFile, srcContents); + StringChangeEx (srcContents, 'WAMPMYSQLNEWPASSWORD', mypass, True); + StringChangeEx (srcContents, 'WAMPMYSQLPORT', myport, True); + SaveStringToFile(destFile,srcContents, False); + end; + end; @@ -644,7 +708,7 @@ begin StringChangeEx (srcContents, 'WAMPAPACHEPSSL', myportas, True); SaveStringToFile(destFile,srcContents, False); - end + end; @@ -663,10 +727,10 @@ begin //installDir et version de php StringChangeEx (srcContents, 'WAMPROOT', pathWithSlashes, True); StringChangeEx (srcContents, 'WAMPMYSQLPORT', myport, True); - StringChangeEx (srcContents, 'WAMPMYSQLVERSION', myport, True); + StringChangeEx (srcContents, 'WAMPMYSQLVERSION', mysqlVersion, True); SaveStringToFile(destFile,srcContents, False); - end + end; @@ -698,7 +762,7 @@ begin StringChangeEx (srcContents, 'WAMPAPACHEPORT', myporta, True); StringChangeEx (srcContents, 'WAMPAPACHEPSSL', myportas, True); SaveStringToFile(destFile, srcContents, False); - end + end; @@ -721,7 +785,7 @@ begin StringChangeEx (srcContents, 'WAMPMYSQLNEWPASSWORD', mypass, True); SaveStringToFile(destFile,srcContents, False); - end + end; @@ -737,32 +801,12 @@ begin LoadStringFromFile (srcFile, srcContents); //version de apache et mysql + StringChangeEx (srcContents, 'WAMPROOT', pathWithSlashes, True); StringChangeEx (srcContents, 'WAMPMYSQLVERSION', mysqlVersion, True); StringChangeEx (srcContents, 'WAMPAPACHEVERSION', apacheVersion, True); SaveStringToFile(destFile,srcContents, False); - end - - - - //---------------------------------------------- - // Create file install_services_auto.bat (always) - //---------------------------------------------- - - destFile := pathWithSlashes+'/install_services_auto.bat'; - srcFile := pathWithSlashes+'/install_services_auto.bat.install'; - - if FileExists (srcFile) then - begin - LoadStringFromFile (srcFile, srcContents); - - //version de apache et mysql - StringChangeEx (srcContents, 'WAMPMYSQLVERSION', mysqlVersion, True); - StringChangeEx (srcContents, 'WAMPAPACHEVERSION', apacheVersion, True); - - SaveStringToFile(destFile,srcContents, False); - end - + end; @@ -778,11 +822,12 @@ begin LoadStringFromFile (srcFile, srcContents); //version de apache et mysql + StringChangeEx (srcContents, 'WAMPROOT', pathWithSlashes, True); StringChangeEx (srcContents, 'WAMPMYSQLVERSION', mysqlVersion, True); StringChangeEx (srcContents, 'WAMPAPACHEVERSION', apacheVersion, True); SaveStringToFile(destFile,srcContents, False); - end + end; @@ -803,7 +848,7 @@ begin StringChangeEx (srcContents, 'WAMPMYSQLNEWPASSWORD', mypass, True); SaveStringToFile(destFile,srcContents, False); - end + end; //---------------------------------------------- @@ -824,7 +869,7 @@ begin StringChangeEx (srcContents, 'WAMPMYSQLPORT', myport, True); SaveStringToFile(destFile,srcContents, False); - end + end; //---------------------------------------------- @@ -845,7 +890,7 @@ begin StringChangeEx (srcContents, 'WAMPMYSQLPORT', myport, True); SaveStringToFile(destFile,srcContents, False); - end + end; //---------------------------------------------- @@ -864,7 +909,7 @@ begin StringChangeEx (srcContents, 'WAMPAPACHEVERSION', apacheVersion, True); SaveStringToFile(destFile,srcContents, False); - end + end; //---------------------------------------------- @@ -881,7 +926,7 @@ begin StringChangeEx (srcContents, 'WAMPSMTP', mysmtp, True); StringChangeEx (srcContents, 'WAMPPHPVERSION', phpVersion, True); SaveStringToFile(destFile,srcContents, False); - end + end; //---------------------------------------------- // Create file php.ini in apache (if not exists) @@ -897,7 +942,7 @@ begin StringChangeEx (srcContents, 'WAMPSMTP', mysmtp, True); StringChangeEx (srcContents, 'WAMPPHPVERSION', phpVersion, True); SaveStringToFile(destFile,srcContents, False); - end + end; @@ -939,7 +984,7 @@ begin res := False; - end + end; end else @@ -949,9 +994,9 @@ begin res := False; - end + end; - end + end; Result := res; @@ -966,7 +1011,6 @@ end; procedure DeinitializeSetup(); begin // DeleteFile(path+'\install_services.bat'); -// DeleteFile(path+'\install_services_auto.bat'); end; @@ -1003,7 +1047,7 @@ Filename: "{app}\rundoliwamp.bat"; Description: {cm:LaunchNow}; Flags: shellexec [UninstallDelete] Type: files; Name: "{app}\*.*" -Type: files; Name: "{app}\bin\mysql\mysql5.6.17\*.*" +Type: files; Name: "{app}\bin\mysql\mysql5.0.45\*.*" Type: filesandordirs; Name: "{app}\alias" Type: filesandordirs; Name: "{app}\apps" Type: filesandordirs; Name: "{app}\bin\apache" diff --git a/build/exe/doliwamp/doliwampsmall.bmp b/build/exe/doliwamp/doliwampsmall.bmp index f19e98fd19a..f4d51aa0229 100644 Binary files a/build/exe/doliwamp/doliwampsmall.bmp and b/build/exe/doliwamp/doliwampsmall.bmp differ diff --git a/build/exe/doliwamp/httpd.conf.install b/build/exe/doliwamp/httpd.conf.install index bfe17b07d42..b2b3a9a8118 100644 --- a/build/exe/doliwamp/httpd.conf.install +++ b/build/exe/doliwamp/httpd.conf.install @@ -66,19 +66,23 @@ Listen WAMPAPACHEPORT # LoadModule actions_module modules/mod_actions.so LoadModule alias_module modules/mod_alias.so +LoadModule allowmethods_module modules/mod_allowmethods.so LoadModule asis_module modules/mod_asis.so LoadModule auth_basic_module modules/mod_auth_basic.so #LoadModule auth_digest_module modules/mod_auth_digest.so #LoadModule authn_anon_module modules/mod_authn_anon.so #LoadModule authn_dbm_module modules/mod_authn_dbm.so -LoadModule authn_default_module modules/mod_authn_default.so LoadModule authn_file_module modules/mod_authn_file.so +LoadModule authz_core_module modules/mod_authz_core.so #LoadModule authz_dbm_module modules/mod_authz_dbm.so -LoadModule authz_default_module modules/mod_authz_default.so +#LoadModule authz_default_module modules/mod_authz_default.so LoadModule authz_groupfile_module modules/mod_authz_groupfile.so LoadModule authz_host_module modules/mod_authz_host.so LoadModule authz_user_module modules/mod_authz_user.so LoadModule autoindex_module modules/mod_autoindex.so +LoadModule buffer_module modules/mod_buffer.so +LoadModule cache_module modules/mod_cache.so +LoadModule cache_disk_module modules/mod_cache_disk.so #LoadModule cern_meta_module modules/mod_cern_meta.so LoadModule cgi_module modules/mod_cgi.so #LoadModule dav_module modules/mod_dav.so @@ -96,23 +100,23 @@ LoadModule isapi_module modules/mod_isapi.so LoadModule log_config_module modules/mod_log_config.so LoadModule mime_module modules/mod_mime.so #LoadModule mime_magic_module modules/mod_mime_magic.so +LoadModule negotiation_module modules/mod_negotiation.so #LoadModule proxy_module modules/mod_proxy.so #LoadModule proxy_ajp_module modules/mod_proxy_ajp.so #LoadModule proxy_balancer_module modules/mod_proxy_balancer.so #LoadModule proxy_connect_module modules/mod_proxy_connect.so #LoadModule proxy_http_module modules/mod_proxy_http.so #LoadModule proxy_ftp_module modules/mod_proxy_ftp.so -LoadModule negotiation_module modules/mod_negotiation.so LoadModule rewrite_module modules/mod_rewrite.so LoadModule setenvif_module modules/mod_setenvif.so #LoadModule speling_module modules/mod_speling.so +#LoadModule ssl_module modules/mod_ssl.so LoadModule status_module modules/mod_status.so #LoadModule unique_id_module modules/mod_unique_id.so LoadModule userdir_module modules/mod_userdir.so #LoadModule usertrack_module modules/mod_usertrack.so LoadModule vhost_alias_module modules/mod_vhost_alias.so -#LoadModule ssl_module modules/mod_ssl.so -LoadModule php5_module "WAMPROOT/bin/php/phpWAMPPHPVERSION/php5apache2_2.dll" +LoadModule php5_module "WAMPROOT/bin/php/phpWAMPPHPVERSION/php5apache2_4.dll" # # ExtendedStatus controls whether Apache will generate "full" status @@ -123,9 +127,9 @@ ExtendedStatus On SetHandler server-status -Order Deny,Allow -Deny from all -Allow from localhost, 127.0.0.1 +Require local +#Require ip 1.2.3.4 +#Require host 1.2.3.4 @@ -211,9 +215,7 @@ KeepAliveTimeout 30 Options FollowSymLinks AllowOverride None - Order deny,allow - Deny from all - Satisfy all + Require all denied # @@ -253,9 +255,13 @@ KeepAliveTimeout 30 # Controls who can get stuff from this server. # # onlineoffline tag - don't remove - Order Deny,Allow - Deny from all - Allow from 127.0.0.1 + + Require all granted + + + Require ip 127.0.0.1 + Require host localhost + @@ -272,8 +278,7 @@ KeepAliveTimeout 30 # viewed by Web clients. # - Order allow,deny - Deny from all + Require all denied # @@ -359,8 +364,7 @@ LogLevel warn AllowOverride None Options None - Order allow,deny - Allow from all + Require all granted # @@ -410,7 +414,7 @@ LogLevel warn # keep browsers from trying to display binary files as though they are # text. # -DefaultType text/plain +#DefaultType text/plain # diff --git a/build/exe/doliwamp/install_services.bat.install b/build/exe/doliwamp/install_services.bat.install index 991e6f040aa..5ad43827f86 100644 --- a/build/exe/doliwamp/install_services.bat.install +++ b/build/exe/doliwamp/install_services.bat.install @@ -8,6 +8,8 @@ echo ---- Execute install_services.bat >> doliwamp.log 2>>&1 REM NET STOP doliwampapache REM NET STOP doliwampmysqld +cd "WAMPROOT" + REM Apache x.x .\bin\apache\apacheWAMPAPACHEVERSION\bin\httpd.exe -k install -n doliwampapache REM reg add HKLM\SYSTEM\CurrentControlSet\Services\doliwampapache /V Start /t REG_DWORD /d 3 /f @@ -19,3 +21,5 @@ REM Mysql 5.1+ REM .\bin\mysql\mysqlWAMPMYSQLVERSION\bin\mysqld.exe --install doliwampmysqld echo ---- End script >> doliwamp.log 2>>&1 + +REM pause diff --git a/build/exe/doliwamp/my.ini.install b/build/exe/doliwamp/my.ini.install index c855cc27a66..e1a9495e20b 100644 --- a/build/exe/doliwamp/my.ini.install +++ b/build/exe/doliwamp/my.ini.install @@ -77,10 +77,6 @@ log-error=WAMPROOT/logs/mysql.log #Path to the database root datadir=WAMPROOT/bin/mysql/data -# The default character set that will be used when a new schema or table is -# created and no character set is defined -default-character-set=latin1 - # The default storage engine that will be used when create new tables when default-storage-engine=INNODB @@ -101,13 +97,6 @@ max_connections=255 # slowdown instead of a performance improvement. query_cache_size=8M -# The number of open tables for all threads. Increasing this value -# increases the number of file descriptors that mysqld requires. -# Therefore you have to make sure to set the amount of open files -# allowed to at least 4096 in the variable "open-files-limit" in -# section [mysqld_safe] -table_cache=510 - # Maximum size for internal (in-memory) temporary tables. If a table # grows larger than this value, it is automatically converted to disk # based table This limitation is for a single table. There can be many @@ -125,18 +114,6 @@ thread_cache_size=12 #*** MyISAM Specific options -# The maximum size of the temporary file MySQL is allowed to use while -# recreating the index (during REPAIR, ALTER TABLE or LOAD DATA INFILE. -# If the file-size would be bigger than this, the index will be created -# through the key cache (which is slower). -myisam_max_sort_file_size=100G - -# If the temporary file used for fast index creation would be bigger -# than using the key cache by the amount specified here, then prefer the -# key cache method. This is mainly used to force long character keys in -# large tables to use the slower key cache method to create the index. -myisam_max_extra_sort_file_size=100G - # If the temporary file used for fast index creation would be bigger # than using the key cache by the amount specified here, then prefer the # key cache method. This is mainly used to force long character keys in @@ -170,13 +147,6 @@ sort_buffer_size=203K # and speed up some things. #skip-innodb -# Additional memory pool that is used by InnoDB to store metadata -# information. If InnoDB requires more memory for this purpose it will -# start to allocate it from the OS. As this is fast enough on most -# recent operating systems, you normally do not need to change this -# value. SHOW INNODB STATUS will display the current amount used. -innodb_additional_mem_pool_size=2M - # If set to 1, InnoDB will flush (fsync) the transaction logs to the # disk at each commit, which offers full ACID behavior. If you are # willing to compromise this safety, and you are running small @@ -226,7 +196,7 @@ port=WAMPMYSQLPORT #Path to installation directory. All paths are usually resolved relative to this. -basedir=WAMPROOT/bin/mysql/mysql5.6.17 +basedir=WAMPROOT/bin/mysql/mysqlWAMPMYSQLVERSION #log file log-error=WAMPROOT/logs/mysql.log @@ -234,10 +204,6 @@ log-error=WAMPROOT/logs/mysql.log #Path to the database root datadir=WAMPROOT/bin/mysql/data -# The default character set that will be used when a new schema or table is -# created and no character set is defined -default-character-set=latin1 - # The default storage engine that will be used when create new tables when default-storage-engine=INNODB @@ -258,13 +224,6 @@ max_connections=255 # slowdown instead of a performance improvement. query_cache_size=8M -# The number of open tables for all threads. Increasing this value -# increases the number of file descriptors that mysqld requires. -# Therefore you have to make sure to set the amount of open files -# allowed to at least 4096 in the variable "open-files-limit" in -# section [mysqld_safe] -table_cache=510 - # Maximum size for internal (in-memory) temporary tables. If a table # grows larger than this value, it is automatically converted to disk # based table This limitation is for a single table. There can be many @@ -282,18 +241,6 @@ thread_cache_size=12 #*** MyISAM Specific options -# The maximum size of the temporary file MySQL is allowed to use while -# recreating the index (during REPAIR, ALTER TABLE or LOAD DATA INFILE. -# If the file-size would be bigger than this, the index will be created -# through the key cache (which is slower). -myisam_max_sort_file_size=100G - -# If the temporary file used for fast index creation would be bigger -# than using the key cache by the amount specified here, then prefer the -# key cache method. This is mainly used to force long character keys in -# large tables to use the slower key cache method to create the index. -myisam_max_extra_sort_file_size=100G - # If the temporary file used for fast index creation would be bigger # than using the key cache by the amount specified here, then prefer the # key cache method. This is mainly used to force long character keys in @@ -327,13 +274,6 @@ sort_buffer_size=203K # and speed up some things. #skip-innodb -# Additional memory pool that is used by InnoDB to store metadata -# information. If InnoDB requires more memory for this purpose it will -# start to allocate it from the OS. As this is fast enough on most -# recent operating systems, you normally do not need to change this -# value. SHOW INNODB STATUS will display the current amount used. -innodb_additional_mem_pool_size=2M - # If set to 1, InnoDB will flush (fsync) the transaction logs to the # disk at each commit, which offers full ACID behavior. If you are # willing to compromise this safety, and you are running small diff --git a/build/exe/doliwamp/phpmyadmin.conf.install b/build/exe/doliwamp/phpmyadmin.conf.install index ff7045835fa..5f0e806d47b 100644 --- a/build/exe/doliwamp/phpmyadmin.conf.install +++ b/build/exe/doliwamp/phpmyadmin.conf.install @@ -1,22 +1,29 @@ Alias /phpmyadmin "WAMPROOT/apps/phpmyadminWAMPPHPMYADMINVERSION/" -# to give access to phpmyadmin from outside -# replace the lines +# NOTE FOR APACHE 2.2: +# To grant access to dolibarr from outside set lines # -# Order Deny,Allow +# Order Allow,Deny +# Allow from all +# +# instead of +# +# Order Deny,Allow # Deny from all # Allow from 127.0.0.1 # -# by +# NOTE FOR APACHE 2.3: +# To grant access to dolibarr from outside set lines # -# Order Allow,Deny -# Allow from all +# Require all granted +# +# instead of +# +# Require local # Options Indexes FollowSymLinks MultiViews AllowOverride all - Order Deny,Allow - Deny from all - Allow from 127.0.0.1 + Require local \ No newline at end of file diff --git a/build/exe/doliwamp/startdoliwamp.bat b/build/exe/doliwamp/startdoliwamp.bat index d6842c56010..6e1d6f2641d 100644 --- a/build/exe/doliwamp/startdoliwamp.bat +++ b/build/exe/doliwamp/startdoliwamp.bat @@ -10,9 +10,11 @@ NET START doliwampapache >> doliwamp.log 2>>&1 echo NET START doliwampmysqld >> doliwamp.log 2>>&1 NET START doliwampmysqld >> doliwamp.log 2>>&1 +REM You can also check logs into c:/dolibarr/logs if start fails + echo Please wait... echo ---- End script >> doliwamp.log 2>>&1 REM sleep is not a Windows commande -REM sleep 1 -ping 1.1.1.1 -n 1 -w 1000 > nul \ No newline at end of file +REM sleep 2 +ping 127.0.0.1 -n 2 -w 1000 > nul diff --git a/build/exe/doliwamp/startdoliwamp_manual_donotuse.bat.install b/build/exe/doliwamp/startdoliwamp_manual_donotuse.bat.install index 751302c0633..c8e33e4620b 100644 --- a/build/exe/doliwamp/startdoliwamp_manual_donotuse.bat.install +++ b/build/exe/doliwamp/startdoliwamp_manual_donotuse.bat.install @@ -13,5 +13,6 @@ echo echo Running Mysql as user process (this process does not return so we use "start") start WAMPROOT\bin\mysql\mysqlWAMPMYSQLVERSION\bin\mysqld-nt.exe --defaults-file=WAMPROOT\bin\mysql\mysqlWAMPMYSQLVERSION\my.ini --console +REM start WAMPROOT\bin\mysql\mysqlWAMPMYSQLVERSION\bin\mysqld.exe --defaults-file=WAMPROOT\bin\mysql\mysqlWAMPMYSQLVERSION\my.ini --console pause \ No newline at end of file diff --git a/build/exe/doliwamp/stopdoliwamp.bat b/build/exe/doliwamp/stopdoliwamp.bat index e4d2ce07c29..e7f8caefb77 100644 --- a/build/exe/doliwamp/stopdoliwamp.bat +++ b/build/exe/doliwamp/stopdoliwamp.bat @@ -15,4 +15,6 @@ echo ---- End script >> doliwamp.log 2>>&1 REM sleep is not a Windows command REM sleep 1 -ping 1.1.1.1 -n 1 -w 1000 > nul \ No newline at end of file +ping 1.1.1.1 -n 1 -w 1000 > nul + +REM pause diff --git a/build/exe/doliwamp/uninstall_services.bat.install b/build/exe/doliwamp/uninstall_services.bat.install index 52b166c19d4..0f12a29b6e2 100644 --- a/build/exe/doliwamp/uninstall_services.bat.install +++ b/build/exe/doliwamp/uninstall_services.bat.install @@ -3,10 +3,19 @@ REM -------------------------------------------------------- REM This script install Apache and Mysql DoliWamp services REM -------------------------------------------------------- +cd "WAMPROOT" + echo ---- Execute uninstall_services.bat >> doliwamp.log 2>>&1 NET STOP doliwampapache .\bin\apache\apacheWAMPAPACHEVERSION\bin\httpd.exe -k uninstall -n doliwampapache + NET STOP doliwampmysqld +REM Mysql 5.0- .\bin\mysql\mysqlWAMPMYSQLVERSION\bin\mysqld-nt.exe --remove doliwampmysqld +REM Mysql 5.1+ +REM .\bin\mysql\mysqlWAMPMYSQLVERSION\bin\mysqld.exe --remove doliwampmysqld + REM wampmanager.exe -quit -id={doliwampserver} echo ---- End script >> doliwamp.log 2>>&1 + +REM pause diff --git a/build/generate_filecheck_xml.php b/build/generate_filelist_xml.php similarity index 85% rename from build/generate_filecheck_xml.php rename to build/generate_filelist_xml.php index 665bb3a65d1..1bc0e2b6620 100644 --- a/build/generate_filecheck_xml.php +++ b/build/generate_filelist_xml.php @@ -32,11 +32,33 @@ if (substr($sapi_type, 0, 3) == 'cgi') { exit; } +require_once($path."../htdocs/master.inc.php"); +require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"); -// Main + +/* + * Main + */ + +if (empty($argv[1])) +{ + print "Usage: ".$script_file." release=x.y.z\n"; + exit -1; +} parse_str($argv[1]); + +if ($release != DOL_VERSION) +{ + print 'Error: release is not version declared into filefunc.in.php.'."\n"; + exit -1; +} + //$outputfile=dirname(__FILE__).'/../htdocs/install/filelist-'.$release.'.xml'; -$outputfile=dirname(__FILE__).'/../htdocs/install/filelist.xml'; +$outputdir=dirname(__FILE__).'/../htdocs/install'; +print 'Delete current files '.$outputdir.'/filelist*.xml'."\n"; +dol_delete_file($outputdir.'/filelist*.xml',0,1,1); + +$outputfile=$outputdir.'/filelist-'.$release.'.xml'; $fp = fopen($outputfile,'w'); fputs($fp, ''."\n"); fputs($fp, ''."\n"); diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl index 45c8e0a6f42..41ae64834e4 100755 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -53,7 +53,7 @@ if (-d "/usr/src/RPM") { $RPMDIR="/usr/src/RPM"; } # mandrake use vars qw/ $REVISION $VERSION /; -$VERSION="3.3"; +$VERSION="4.0"; @@ -173,6 +173,7 @@ $build =~ s/-.*$//g; # now build is 0+nmu1 for example $FILENAMEDEBNATIVE="${PROJECT}_${MAJOR}.${MINOR}.${build}"; $FILENAMEDEB="${PROJECT}_${MAJOR}.${MINOR}.${newbuild}"; +$FILENAMEDEBSHORT="${PROJECT}_${MAJOR}.${MINOR}.${build}"; my $copyalreadydone=0; @@ -316,8 +317,13 @@ print "\n"; if ($CHOOSEDTARGET{'-CHKSUM'}) { print 'Create xml check file with md5 checksum with command php '.$SOURCE.'/build/generate_filecheck_xml.php release='.$MAJOR.'.'.$MINOR.'.'.$BUILD."\n"; - $ret=`php $SOURCE/build/generate_filecheck_xml.php release=$MAJOR.$MINOR.$BUILD`; + $ret=`php $SOURCE/build/generate_filelist_xml.php release=$MAJOR.$MINOR.$BUILD`; print $ret."\n"; + # Copy to final dir + $NEWDESTI=$DESTI; + print "Copy \"$SOURCE/htdocs/install/filelist-$MAJOR.$MINOR.$BUILD.xml\" to $NEWDESTI/signatures/filelist-$MAJOR.$MINOR.$BUILD.xml\n"; + use File::Copy qw(copy); + copy "$SOURCE/htdocs/install/filelist-$MAJOR.$MINOR.$BUILD.xml", "$NEWDESTI/signatures/filelist-$MAJOR.$MINOR.$BUILD.xml"; } @@ -356,25 +362,29 @@ if ($nboftargetok) { # Test that the ChangeLog is ok $TMPBUILDTOCHECKCHANGELOG=$BUILD; $TMPBUILDTOCHECKCHANGELOG =~ s/\-rc\d*//; + $TMPBUILDTOCHECKCHANGELOG =~ s/\-beta\d*//; print "Check if ChangeLog is ok for version $MAJOR.$MINOR\.$TMPBUILDTOCHECKCHANGELOG\n"; $ret=`grep "ChangeLog for $MAJOR.$MINOR\.$TMPBUILDTOCHECKCHANGELOG" "$SOURCE/ChangeLog" 2>&1`; if (! $ret) { print "Error: The ChangeLogFile was not updated. Run the following command before building package for $MAJOR.$MINOR.$BUILD:\n"; - if (! $BUILD || $BUILD eq '0-rc') # For a major version - { - print 'cd ~/git/dolibarr_'.$MAJOR.'.'.$MINOR.'; git log `git rev-list --boundary '.$MAJOR.'.'.$MINOR.'..origin/develop | grep ^- | cut -c2- | head -n 1`.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e \'^FIX\|NEW\' | sort -u | sed \'s/FIXED:/FIX:/g\' | sed \'s/FIXED :/FIX:/g\' | sed \'s/FIX :/FIX:/g\' | sed \'s/FIX /FIX: /g\' | sed \'s/NEW :/NEW:/g\' | sed \'s/NEW /NEW: /g\' > /tmp/aaa'; - } - else # For a maintenance release - { - print 'cd ~/git/dolibarr_'.$MAJOR.'.'.$MINOR.'; git log '.$MAJOR.'.'.$MINOR.'.'.($BUILD-1).'.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e \'^FIX\|NEW\' | sort -u | sed \'s/FIXED:/FIX:/g\' | sed \'s/FIXED :/FIX:/g\' | sed \'s/FIX :/FIX:/g\' | sed \'s/FIX /FIX: /g\' | sed \'s/NEW :/NEW:/g\' | sed \'s/NEW /NEW: /g\' > /tmp/aaa'; - } - print "\n"; - exit; } else { - print "ChangeLog for $MAJOR.$MINOR\.$BUILD was found into '$SOURCE/ChangeLog'\n"; + print "ChangeLog for $MAJOR.$MINOR\.$BUILD was found into '$SOURCE/ChangeLog. But you can regenerate it with commande:'\n"; + } + if (! $BUILD || $BUILD eq '0-rc') # For a major version + { + print 'cd ~/git/dolibarr_'.$MAJOR.'.'.$MINOR.'; git log `git rev-list --boundary '.$MAJOR.'.'.$MINOR.'..origin/develop | grep ^- | cut -c2- | head -n 1`.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e \'^FIX\|NEW\' | sort -u | sed \'s/FIXED:/FIX:/g\' | sed \'s/FIXED :/FIX:/g\' | sed \'s/FIX :/FIX:/g\' | sed \'s/FIX /FIX: /g\' | sed \'s/NEW :/NEW:/g\' | sed \'s/NEW /NEW: /g\' > /tmp/aaa'; + } + else # For a maintenance release + { + print 'cd ~/git/dolibarr_'.$MAJOR.'.'.$MINOR.'; git log '.$MAJOR.'.'.$MINOR.'.'.($BUILD-1).'.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e \'^FIX\|NEW\' | sort -u | sed \'s/FIXED:/FIX:/g\' | sed \'s/FIXED :/FIX:/g\' | sed \'s/FIX :/FIX:/g\' | sed \'s/FIX /FIX: /g\' | sed \'s/NEW :/NEW:/g\' | sed \'s/NEW /NEW: /g\' > /tmp/aaa'; + } + print "\n"; + if (! $ret) + { + exit; } print 'Run git tag -a -m "'.$MAJOR.'.'.$MINOR.'.'.$BUILD.'" "'.$MAJOR.'.'.$MINOR.'.'.$BUILD.'"'."\n"; @@ -388,10 +398,15 @@ if ($nboftargetok) { { print 'Run git tag -a -f -m "'.$MAJOR.'.'.$MINOR.'.'.$BUILD.'" "'.$MAJOR.'.'.$MINOR.'.'.$BUILD.'"'."\n"; $ret=`git tag -a -f -m "$MAJOR.$MINOR.$BUILD" "$MAJOR.$MINOR.$BUILD"`; + print 'Run git push -f --tags'."\n"; + $ret=`git push -f --tags`; } } - print 'Run git push --tags'."\n"; - $ret=`git push --tags`; + else + { + print 'Run git push --tags'."\n"; + $ret=`git push --tags`; + } chdir("$olddir"); } @@ -458,6 +473,7 @@ if ($nboftargetok) { $ret=`rm -fr $BUILDROOT/$PROJECT/dev/codetemplates`; $ret=`rm -fr $BUILDROOT/$PROJECT/dev/dbmodel`; $ret=`rm -fr $BUILDROOT/$PROJECT/dev/initdata`; + $ret=`rm -fr $BUILDROOT/$PROJECT/dev/initdemo`; $ret=`rm -fr $BUILDROOT/$PROJECT/dev/iso-normes`; $ret=`rm -fr $BUILDROOT/$PROJECT/dev/ldap`; $ret=`rm -fr $BUILDROOT/$PROJECT/dev/licence`; @@ -595,7 +611,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'; } @@ -627,7 +643,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'; } @@ -664,7 +680,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'; } @@ -705,7 +721,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; } @@ -791,7 +807,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'; } @@ -822,7 +838,7 @@ if ($nboftargetok) { $ret=`$cmd`; print "Remove other files\n"; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/README-FR`; + $ret=`rm -f $BUILDROOT/$PROJECT.tmp/README-FR.md`; $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/README`; $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/README-FR`; $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/aps`; @@ -994,7 +1010,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'; } @@ -1080,7 +1096,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'; } @@ -1109,6 +1125,7 @@ if ($nboftargetok) { print "Move $SOURCE/build/$FILENAMEEXEDOLIWAMP.exe to $NEWDESTI/$FILENAMEEXEDOLIWAMP.exe\n"; $ret=`mv "$SOURCE/build/$FILENAMEEXEDOLIWAMP.exe" "$NEWDESTI/$FILENAMEEXEDOLIWAMP.exe"`; + print "Remove tmp file $SOURCE/build/exe/doliwamp/doliwamp.tmp.iss\n"; $ret=`rm "$SOURCE/build/exe/doliwamp/doliwamp.tmp.iss"`; next; @@ -1121,21 +1138,41 @@ if ($nboftargetok) { { if ($CHOOSEDPUBLISH{$target} < 0) { next; } - print "\nList of files to publish\n"; + print "\nList of files to publish (BUILD=$BUILD)\n"; %filestoscansf=( + "$DESTI/signatures/filelist-$MAJOR.$MINOR.$BUILD.xml"=>'signatures', "$DESTI/package_rpm_generic/$FILENAMERPM"=>'Dolibarr installer for Fedora-Redhat-Mandriva-Opensuse (DoliRpm)', "$DESTI/package_debian-ubuntu/${FILENAMEDEB}_all.deb"=>'Dolibarr installer for Debian-Ubuntu (DoliDeb)', + "$DESTI/package_debian-ubuntu/${FILENAMEDEBSHORT}.orig.tar.gz"=>'none', "$DESTI/package_windows/$FILENAMEEXEDOLIWAMP.exe"=>'Dolibarr installer for Windows (DoliWamp)', "$DESTI/standard/$FILENAMETGZ.tgz"=>'Dolibarr ERP-CRM', "$DESTI/standard/$FILENAMETGZ.zip"=>'Dolibarr ERP-CRM' ); %filestoscanstableasso=( + "$DESTI/signatures/filelist-$MAJOR.$MINOR.$BUILD.xml"=>'signatures', "$DESTI/package_rpm_generic/$FILENAMERPM"=>'package_rpm_generic', "$DESTI/package_debian-ubuntu/${FILENAMEDEB}_all.deb"=>'package_debian-ubuntu', + "$DESTI/package_debian-ubuntu/${FILENAMEDEBSHORT}.orig.tar.gz"=>'package_debian-ubuntu', "$DESTI/package_windows/$FILENAMEEXEDOLIWAMP.exe"=>'package_windows', "$DESTI/standard/$FILENAMETGZ.tgz"=>'standard', "$DESTI/standard/$FILENAMETGZ.zip"=>'standard' ); + if ($target eq 'ASSO' && $BUILD =~ /[a-z]/i) { # Not stable + %filestoscansf=( + "$DESTI/$FILENAMERPM"=>'Dolibarr installer for Fedora-Redhat-Mandriva-Opensuse (DoliRpm)', + "$DESTI/${FILENAMEDEB}_all.deb"=>'Dolibarr installer for Debian-Ubuntu (DoliDeb)', + "$DESTI/$FILENAMEEXEDOLIWAMP.exe"=>'Dolibarr installer for Windows (DoliWamp)', + "$DESTI/$FILENAMETGZ.tgz"=>'Dolibarr ERP-CRM', + "$DESTI/$FILENAMETGZ.zip"=>'Dolibarr ERP-CRM' + ); + %filestoscanstableasso=( + "$DESTI/$FILENAMERPM"=>'', + "$DESTI/${FILENAMEDEB}_all.deb"=>'', + "$DESTI/$FILENAMEEXEDOLIWAMP.exe"=>'', + "$DESTI/$FILENAMETGZ.tgz"=>'', + "$DESTI/$FILENAMETGZ.zip"=>'' + ); + } use POSIX qw/strftime/; foreach my $file (sort keys %filestoscansf) @@ -1177,7 +1214,7 @@ if ($nboftargetok) { print "\n"; - if ($target eq 'SF') { + if ($target eq 'SF' && $filestoscan{$file} ne 'none') { $destFolder="$NEWPUBLISH/$filestoscan{$file}/".$MAJOR.'.'.$MINOR.'.'.$BUILD; } elsif ($target eq 'ASSO' and $NEWPUBLISH =~ /stable/) { diff --git a/build/pad/DoliWamp.pml b/build/pad/DoliWamp.pml index 401cff6d7a5..fa2da1902aa 100644 --- a/build/pad/DoliWamp.pml +++ b/build/pad/DoliWamp.pml @@ -1,195 +1,195 @@ - - - PADGen 3.1.1.47 - - - DoliWamp - 3.5.0 - 01 - 01 - 2014 - - - - Freeware - Major Update - Install and Uninstall - Win2000,Win7 x32,Win7 x64,Win98,WinOther,WinServer,WinVista,WinVista x64,WinXP,Other - English,Arabic,Catalan,Chinese,Dutch,Finnish,French,German,Icelandic,Italian,Norwegian,Polish,Portuguese,Romanian,Russian,Slovenian,Spanish,Swedish,Turkish - http://www.dolibarr.org - Business - Business::Accounting & Finance - None - - 26048004 - 25437 - 24.84 - - - N - - Days - - - - - - - - - doliwamp, dolibarr, erp, crm, invoices, commercial proposals, orders, accounting, stock, products, agenda, bank, business, company, foundation, management - DoliWamp, Dolibarr ERP/CRM for Windows - DoliWamp, the easy to use Dolibarr for Windows to manage your company,foundation - DoliWamp is the Dolibarr ERP/CRM for Windows, the easy to use open source software to manage your activity (invoices, customers, suppliers, contracts, agenda, emailings...) and any other things a small or mid-sized business or a foundation needs. - DoliWamp is the Dolibarr ERP/CRM autoinstaller for Windows users with no technical knowledge to install Dolibarr and all its prerequisites (Apache, Mysql, PHP) with just one auto-exe file. Dolibarr ERP/CRM is a software package built by modules addition (you enable only features you need), to manage small or mid-sized businesses, freelancers or foundations. - DoliWamp is the Dolibarr ERP/CRM for Windows. Dolibarr ERP & CRM is a software built by modules addition (you enable only features you need), to manage small or mid-sized businesses, freelancers or foundations (You can manage or follow contacts, invoices, orders, commercial proposals, products, stock management, agenda, mass emailings, members of a foundation, bank accounts...). Based on a WAMP, MAMP or LAMP server (Apache, Mysql, PHP for all Operating Systems), you can install it as a standalone program or use it from anywhere with any web browser. Dolibarr is an OpenSource project. It differs from other ERP or CRM softwares (like OpenAguila, OpenBravo, OpenERP, Neogia, Compiere, etc) because everything was made to be more simple: Simple to install, Simple to use, Simple to develop. -DoliWamp is the auto-installer for Windows users with no technical knowledge to install Dolibarr ERP/CRM and all its prerequisites (Apache, Mysql, PHP) with just one auto-exe file. - - - doliwamp, dolibarr, erp, crm, factures, devis, facturation, commandes, compta, trésorerie, stocks, produits, agenda, comptes bancaires, associations, entreprises, PME, TPE - DoliWamp, Dolibarr ERP/CRM pour Windows - DoliWamp, la distribution de Dolibarr pour gérer votre entreprise ou association - DoliWamp est la version spécialisée pour Windows de Dolibarr ERP-CRM, le logiciel simple et OpenSource pour gérer votre activité (factures, devis, facturation, commandes, compta, trésorerie, stocks, produits, agenda, comptes bancaires, associations) - DoliWamp est la version spécialisée pour Windows de Dolibarr ERP-CRM, le logiciel simple et OpenSource pour gérer votre activité (factures, devis, facturation, commandes, compta, trésorerie, stocks, produits, agenda, comptes bancaires, associations) - DoliWamp est la version spécialisée pour Windows de Dolibarr ERP-CRM, le logiciel simple et OpenSource pour gérer votre activité (factures, devis, facturation, commandes, compta, trésorerie, stocks, produits, agenda, comptes bancaires, associations) - - - doliwamp, dolibarr, erp, crm, gestionale, medie imprese, fondazioni - DoliWamp, Dolibarr ERP/CRM per Windows - Gestionale open source e gratuito per piccole e medie imprese, fondazioni - Dolibarr è un a gestionale open source e gratuito per piccole e medie imprese, fondazioni e liberi professionisti. Include varie funzionalità per Enterprise Resource Planning e gestione dei clienti (CRM), ma anche ulteriori attività. - Dolibarr è un programma gestionale open source e gratuito per piccole e medie imprese, fondazioni e liberi professionisti. Include varie funzionalità per Enterprise Resource Planning e gestione dei clienti (CRM), ma anche ulteriori attività. Dolibar è progettato per poter fornire solo ciò di cui hai bisogno ed essere facile da usare. - Dolibarr è un programma gestionale open source e gratuito per piccole e medie imprese, fondazioni e liberi professionisti. Include varie funzionalità per Enterprise Resource Planning e gestione dei clienti (CRM), ma anche ulteriori attività. Dolibar è progettato per poter fornire solo ciò di cui hai bisogno ed essere facile da usare. Dolibar è completamente web-based, progettato per poter fornire solo ciò di cui hai bisogno ed essere facile da usare. - - - - - http://www.nltechno.com/pages/dolibarrwinbin.php - http://www.nltechno.com/pages/dolibarrwinbin.php - http://www.dolibarr.org/images/dolibarr_screenshot1.png - http://www.dolibarr.org/images/dolibarr.gif - http://www.dolibarr.org/files/pad_doliwamp.xml - - - http://www.dolibarr.org/files/doliwamp.exe - http://www.dolibarr.org/files/doliwamp.exe - - - - - - GNU GPL - GNU GPL - - - Y - 1.4 - http://pad.asp-software.org/extensions/Affiliates.htm - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Y - N - - - + + + PADGen 3.1.1.47 + + + DoliWamp + 3.5.0 + 01 + 01 + 2014 + + + + Freeware + Major Update + Install and Uninstall + Win2000,Win7 x32,Win7 x64,Win98,WinOther,WinServer,WinVista,WinVista x64,WinXP,Other + English,Arabic,Catalan,Chinese,Dutch,Finnish,French,German,Icelandic,Italian,Norwegian,Polish,Portuguese,Romanian,Russian,Slovenian,Spanish,Swedish,Turkish + http://www.dolibarr.org + Business + Business::Accounting & Finance + None + + 26048004 + 25437 + 24.84 + + + N + + Days + + + + + + + + + doliwamp, dolibarr, erp, crm, invoices, commercial proposals, orders, accounting, stock, products, agenda, bank, business, company, foundation, management + DoliWamp, Dolibarr ERP/CRM for Windows + DoliWamp, the easy to use Dolibarr for Windows to manage your company,foundation + DoliWamp is the Dolibarr ERP/CRM for Windows, the easy to use open source software to manage your activity (invoices, customers, suppliers, contracts, agenda, emailings...) and any other things a small or mid-sized business or a foundation needs. + DoliWamp is the Dolibarr ERP/CRM autoinstaller for Windows users with no technical knowledge to install Dolibarr and all its prerequisites (Apache, Mysql, PHP) with just one auto-exe file. Dolibarr ERP/CRM is a software package built by modules addition (you enable only features you need), to manage small or mid-sized businesses, freelancers or foundations. + DoliWamp is the Dolibarr ERP/CRM for Windows. Dolibarr ERP & CRM is a software built by modules addition (you enable only features you need), to manage small or mid-sized businesses, freelancers or foundations (You can manage or follow contacts, invoices, orders, commercial proposals, products, stock management, agenda, mass emailings, members of a foundation, bank accounts...). Based on a WAMP, MAMP or LAMP server (Apache, Mysql, PHP for all Operating Systems), you can install it as a standalone program or use it from anywhere with any web browser. Dolibarr is an OpenSource project. It differs from other ERP or CRM softwares (like OpenAguila, OpenBravo, OpenERP, Neogia, Compiere, etc) because everything was made to be more simple: Simple to install, Simple to use, Simple to develop. +DoliWamp is the auto-installer for Windows users with no technical knowledge to install Dolibarr ERP/CRM and all its prerequisites (Apache, Mysql, PHP) with just one auto-exe file. + + + doliwamp, dolibarr, erp, crm, factures, devis, facturation, commandes, compta, trésorerie, stocks, produits, agenda, comptes bancaires, associations, entreprises, PME, TPE + DoliWamp, Dolibarr ERP/CRM pour Windows + DoliWamp, la distribution de Dolibarr pour gérer votre entreprise ou association + DoliWamp est la version spécialisée pour Windows de Dolibarr ERP-CRM, le logiciel simple et OpenSource pour gérer votre activité (factures, devis, facturation, commandes, compta, trésorerie, stocks, produits, agenda, comptes bancaires, associations) + DoliWamp est la version spécialisée pour Windows de Dolibarr ERP-CRM, le logiciel simple et OpenSource pour gérer votre activité (factures, devis, facturation, commandes, compta, trésorerie, stocks, produits, agenda, comptes bancaires, associations) + DoliWamp est la version spécialisée pour Windows de Dolibarr ERP-CRM, le logiciel simple et OpenSource pour gérer votre activité (factures, devis, facturation, commandes, compta, trésorerie, stocks, produits, agenda, comptes bancaires, associations) + + + doliwamp, dolibarr, erp, crm, gestionale, medie imprese, fondazioni + DoliWamp, Dolibarr ERP/CRM per Windows + Gestionale open source e gratuito per piccole e medie imprese, fondazioni + Dolibarr è un a gestionale open source e gratuito per piccole e medie imprese, fondazioni e liberi professionisti. Include varie funzionalità per Enterprise Resource Planning e gestione dei clienti (CRM), ma anche ulteriori attività. + Dolibarr è un programma gestionale open source e gratuito per piccole e medie imprese, fondazioni e liberi professionisti. Include varie funzionalità per Enterprise Resource Planning e gestione dei clienti (CRM), ma anche ulteriori attività. Dolibar è progettato per poter fornire solo ciò di cui hai bisogno ed essere facile da usare. + Dolibarr è un programma gestionale open source e gratuito per piccole e medie imprese, fondazioni e liberi professionisti. Include varie funzionalità per Enterprise Resource Planning e gestione dei clienti (CRM), ma anche ulteriori attività. Dolibar è progettato per poter fornire solo ciò di cui hai bisogno ed essere facile da usare. Dolibar è completamente web-based, progettato per poter fornire solo ciò di cui hai bisogno ed essere facile da usare. + + + + + http://www.nltechno.com/pages/dolibarrwinbin.php + http://www.nltechno.com/pages/dolibarrwinbin.php + http://www.dolibarr.org/images/dolibarr_screenshot1.png + http://www.dolibarr.org/images/dolibarr.gif + http://www.dolibarr.org/files/pad_doliwamp.xml + + + http://www.dolibarr.org/files/doliwamp.exe + http://www.dolibarr.org/files/doliwamp.exe + + + + + + GNU GPL + GNU GPL + + + Y + 1.4 + http://pad.asp-software.org/extensions/Affiliates.htm + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Y + N + + + diff --git a/build/pad/Dolibarr.pml b/build/pad/Dolibarr.pml index 6dafb6b0d7d..3ef5e16137c 100644 --- a/build/pad/Dolibarr.pml +++ b/build/pad/Dolibarr.pml @@ -1,202 +1,202 @@ - - - PADGen 3.1.1.47 - - - Dolibarr - 3.5.0 - 01 - 01 - 2014 - - - - Freeware - Major Update - No Install Support - Linux,Mac OS X,Mac Other,Unix,Win2000,Win7 x32,Win7 x64,Win98,WinOther,WinServer,WinVista,WinVista x64,WinXP,Other - English,Arabic,Catalan,Chinese,Danish,Dutch,Finnish,French,German,Greek,Icelandic,Italian,Norwegian,Polish,Portuguese,Romanian,Russian,Slovenian,Spanish,Swedish,Turkish - http://www.dolibarr.org - Business - Business::Accounting & Finance - None - - 9359175 - 9139 - 8.93 - - - N - - Days - - - - - - - - - dolibarr, erp, crm, invoices, commercial proposals, orders, accounting, stock, products, agenda, bank, business, company, foundation, management, sme, doliwamp - Dolibarr ERP & CRM - Dolibarr ERP & CRM, the easy to use open source software to manage your activity - Dolibarr ERP & CRM, the easy to use open source software to manage your activity (invoices, customers, suppliers, contracts, agenda, emailings...) and any other things a small or mid-sized business or a foundation needs to follow. - Dolibarr ERP & CRM is a software built by modules addition (you enable only features you need), to manage small or medium companies, freelancers or foundations. We can say Dolibarr is an ERP or CRM. Dolibarr is also available with an auto-installer for Windows users with no technical knowledge to install Dolibarr and all its prerequisites (Apache, Mysql, PHP) with just one auto-exe file. See DoliWamp software for this. - Dolibarr ERP & CRM is a software built by modules addition (you enable only features you need), to manage small or mid-sized businesses, freelancers or foundations. We can say Dolibarr is an ERP or CRM (or both depending on activated modules). It's an OpenSource project base on a WAMP, MAMP or LAMP server (Apache, Mysql, PHP for all Operating Systems). Dolibarr differs from other ERP or CRM softwares (like OpenAguila, OpenBravo, OpenERP, Neogia, Compiere, etc) because everything was made to be more simple: -Simple to install -Simple to use -Simple to develop -Note that Dolibarr is also available with an auto-installer for Windows or Ubuntu users with no technical knowledge to install Dolibarr and all its prerequisites (Apache, Mysql, PHP) with just one auto-exe file. This version is called DoliWamp (for Windows) or DoliBuntu (for Ubuntu/Debian). - - - erp, crm, gestionale, medie imprese, fondazioni - Gestionale open source e gratuito - Gestionale open source e gratuito per piccole e medie imprese, fondazioni - Dolibarr è un a gestionale open source e gratuito per piccole e medie imprese, fondazioni e liberi professionisti. Include varie funzionalità per Enterprise Resource Planning e gestione dei clienti (CRM), ma anche ulteriori attività. - Dolibarr è un programma gestionale open source e gratuito per piccole e medie imprese, fondazioni e liberi professionisti. Include varie funzionalità per Enterprise Resource Planning e gestione dei clienti (CRM), ma anche ulteriori attività. Dolibar è progettato per poter fornire solo ciò di cui hai bisogno ed essere facile da usare. - Dolibarr è un programma gestionale open source e gratuito per piccole e medie imprese, fondazioni e liberi professionisti. Include varie funzionalità per Enterprise Resource Planning e gestione dei clienti (CRM), ma anche ulteriori attività. Dolibar è progettato per poter fornire solo ciò di cui hai bisogno ed essere facile da usare. Dolibar è completamente web-based, progettato per poter fornire solo ciò di cui hai bisogno ed essere facile da usare. - - - dolibarr, erp, crm, invoices, commercial proposals, orders, accounting, stock, products, agenda, bank, business, company, foundation, management, sme, doliwamp - Dolibarr ERP & CRM - Dolibarr ERP & CRM, le gestionnaire simple pour gérer votre activité - Dolibarr ERP & CRM, le logiciel simple et OpenSource pour gérer votre activité (factures, devis, facturation, commandes, compta, trésorerie, stocks, produits, agenda, comptes bancaires, associations) - Dolibarr ERP/CRM est un logiciel modulaire (on n'active que les fonctions que l'on désire) de gestions de TPE/PME, d'indépendants, d'entrepreneurs ou d'associations. En terme plus techniques, c'est un ERP et CRM. C'est un projet OpenSource qui s'exécute au sein d'un serveur Web et peut donc être accessible depuis n'importe quel lieu disposant d'une connexion Internet (Projet basé sur un serveur WAMP, MAMP ou LAMP: Apache, MySQL, PHP). - Dolibarr ERP/CRM est un logiciel modulaire (on n'active que les fonctions que l'on désire) de gestions de TPE/PME, d'indépendants, d'entrepreneurs ou d'associations. En terme plus techniques, c'est un ERP et CRM. C'est un projet OpenSource qui s'exécute au sein d'un serveur Web et peut donc être accessible depuis n'importe quel lieu disposant d'une connexion Internet (Projet basé sur un serveur WAMP, MAMP ou LAMP: Apache, MySQL, PHP). Dolibarr vient compléter les offres déjà nombreuses de logiciels de cette catégorie (comme OpenBravo, OpenERP, SugarCRM, Neogia, Compiere, etc.) mais se démarque par le fait qu'ici tout est fait pour offrir de la simplicité (règle des 3 S): -Simple pour l'installation (avec au choix des installeurs clé en main pour ceux qui ignorent comment installer un serveur Web, ou une installation manuelle) -Simple pour l'utilisation (fonctions modulaires pour ne pas surcharger les menus, informations claires à la saisie) -Simple pour le développement (pas de frameworks lourds). -Dolibarr intègre en effet sa propre architecture (design patterns) permettant à tout développeur d'être tout de suite opérationnel sans connaissances particulières autre que le PHP. - - - - - http://www.dolibarr.org - http://www.dolibarr.org - http://www.dolibarr.org/images/dolibarr_screenshot1.png - http://www.dolibarr.org/images/dolibarr.gif - http://www.dolibarr.org/files/pad_dolibarr.xml - - - http://www.dolibarr.org/files/dolibarr.tgz - http://www.dolibarr.org/files/dolibarr.tgz - - - - - - GNU GPL - GNU GPL - - - Y - 1.4 - http://pad.asp-software.org/extensions/Affiliates.htm - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Y - N - - - + + + PADGen 3.1.1.47 + + + Dolibarr + 3.5.0 + 01 + 01 + 2014 + + + + Freeware + Major Update + No Install Support + Linux,Mac OS X,Mac Other,Unix,Win2000,Win7 x32,Win7 x64,Win98,WinOther,WinServer,WinVista,WinVista x64,WinXP,Other + English,Arabic,Catalan,Chinese,Danish,Dutch,Finnish,French,German,Greek,Icelandic,Italian,Norwegian,Polish,Portuguese,Romanian,Russian,Slovenian,Spanish,Swedish,Turkish + http://www.dolibarr.org + Business + Business::Accounting & Finance + None + + 9359175 + 9139 + 8.93 + + + N + + Days + + + + + + + + + dolibarr, erp, crm, invoices, commercial proposals, orders, accounting, stock, products, agenda, bank, business, company, foundation, management, sme, doliwamp + Dolibarr ERP & CRM + Dolibarr ERP & CRM, the easy to use open source software to manage your activity + Dolibarr ERP & CRM, the easy to use open source software to manage your activity (invoices, customers, suppliers, contracts, agenda, emailings...) and any other things a small or mid-sized business or a foundation needs to follow. + Dolibarr ERP & CRM is a software built by modules addition (you enable only features you need), to manage small or medium companies, freelancers or foundations. We can say Dolibarr is an ERP or CRM. Dolibarr is also available with an auto-installer for Windows users with no technical knowledge to install Dolibarr and all its prerequisites (Apache, Mysql, PHP) with just one auto-exe file. See DoliWamp software for this. + Dolibarr ERP & CRM is a software built by modules addition (you enable only features you need), to manage small or mid-sized businesses, freelancers or foundations. We can say Dolibarr is an ERP or CRM (or both depending on activated modules). It's an OpenSource project base on a WAMP, MAMP or LAMP server (Apache, Mysql, PHP for all Operating Systems). Dolibarr differs from other ERP or CRM softwares (like OpenAguila, OpenBravo, OpenERP, Neogia, Compiere, etc) because everything was made to be more simple: +Simple to install +Simple to use +Simple to develop +Note that Dolibarr is also available with an auto-installer for Windows or Ubuntu users with no technical knowledge to install Dolibarr and all its prerequisites (Apache, Mysql, PHP) with just one auto-exe file. This version is called DoliWamp (for Windows) or DoliBuntu (for Ubuntu/Debian). + + + erp, crm, gestionale, medie imprese, fondazioni + Gestionale open source e gratuito + Gestionale open source e gratuito per piccole e medie imprese, fondazioni + Dolibarr è un a gestionale open source e gratuito per piccole e medie imprese, fondazioni e liberi professionisti. Include varie funzionalità per Enterprise Resource Planning e gestione dei clienti (CRM), ma anche ulteriori attività. + Dolibarr è un programma gestionale open source e gratuito per piccole e medie imprese, fondazioni e liberi professionisti. Include varie funzionalità per Enterprise Resource Planning e gestione dei clienti (CRM), ma anche ulteriori attività. Dolibar è progettato per poter fornire solo ciò di cui hai bisogno ed essere facile da usare. + Dolibarr è un programma gestionale open source e gratuito per piccole e medie imprese, fondazioni e liberi professionisti. Include varie funzionalità per Enterprise Resource Planning e gestione dei clienti (CRM), ma anche ulteriori attività. Dolibar è progettato per poter fornire solo ciò di cui hai bisogno ed essere facile da usare. Dolibar è completamente web-based, progettato per poter fornire solo ciò di cui hai bisogno ed essere facile da usare. + + + dolibarr, erp, crm, invoices, commercial proposals, orders, accounting, stock, products, agenda, bank, business, company, foundation, management, sme, doliwamp + Dolibarr ERP & CRM + Dolibarr ERP & CRM, le gestionnaire simple pour gérer votre activité + Dolibarr ERP & CRM, le logiciel simple et OpenSource pour gérer votre activité (factures, devis, facturation, commandes, compta, trésorerie, stocks, produits, agenda, comptes bancaires, associations) + Dolibarr ERP/CRM est un logiciel modulaire (on n'active que les fonctions que l'on désire) de gestions de TPE/PME, d'indépendants, d'entrepreneurs ou d'associations. En terme plus techniques, c'est un ERP et CRM. C'est un projet OpenSource qui s'exécute au sein d'un serveur Web et peut donc être accessible depuis n'importe quel lieu disposant d'une connexion Internet (Projet basé sur un serveur WAMP, MAMP ou LAMP: Apache, MySQL, PHP). + Dolibarr ERP/CRM est un logiciel modulaire (on n'active que les fonctions que l'on désire) de gestions de TPE/PME, d'indépendants, d'entrepreneurs ou d'associations. En terme plus techniques, c'est un ERP et CRM. C'est un projet OpenSource qui s'exécute au sein d'un serveur Web et peut donc être accessible depuis n'importe quel lieu disposant d'une connexion Internet (Projet basé sur un serveur WAMP, MAMP ou LAMP: Apache, MySQL, PHP). Dolibarr vient compléter les offres déjà nombreuses de logiciels de cette catégorie (comme OpenBravo, OpenERP, SugarCRM, Neogia, Compiere, etc.) mais se démarque par le fait qu'ici tout est fait pour offrir de la simplicité (règle des 3 S): +Simple pour l'installation (avec au choix des installeurs clé en main pour ceux qui ignorent comment installer un serveur Web, ou une installation manuelle) +Simple pour l'utilisation (fonctions modulaires pour ne pas surcharger les menus, informations claires à la saisie) +Simple pour le développement (pas de frameworks lourds). +Dolibarr intègre en effet sa propre architecture (design patterns) permettant à tout développeur d'être tout de suite opérationnel sans connaissances particulières autre que le PHP. + + + + + http://www.dolibarr.org + http://www.dolibarr.org + http://www.dolibarr.org/images/dolibarr_screenshot1.png + http://www.dolibarr.org/images/dolibarr.gif + http://www.dolibarr.org/files/pad_dolibarr.xml + + + http://www.dolibarr.org/files/dolibarr.tgz + http://www.dolibarr.org/files/dolibarr.tgz + + + + + + GNU GPL + GNU GPL + + + Y + 1.4 + http://pad.asp-software.org/extensions/Affiliates.htm + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Y + N + + + diff --git a/build/pad/pad_dolibarr.xml b/build/pad/pad_dolibarr.xml index 0f09644cb9a..0920a19311d 100644 --- a/build/pad/pad_dolibarr.xml +++ b/build/pad/pad_dolibarr.xml @@ -1,232 +1,232 @@ - - - - 3.11 - PADGen 3.1.1.47 http://www.padgen.org - Portable Application Description, or PAD for short, is a data set that is used by shareware authors to disseminate information to anyone interested in their software products. To find out more go to http://pad.asp-software.org - - - Dolibarr team - 11 rue raymond Queneau - - Rueil Malmaison - - 92500 - FRANCE - http://www.dolibarr.org - - Dolibarr team - Dolibarr team - dolibarr-dev@nongnu.org - Dolibarr team - Dolibarr team - dolibarr-dev@nongnu.org - - - dolibarr-dev@nongnu.org - dolibarr-dev@nongnu.org - dolibarr-dev@nongnu.org - - - - - - - - Dolibarr - 3.5 - 01 - 01 - 2014 - - - - Freeware - Major Update - No Install Support - Linux,Mac OS X,Mac Other,Unix,Win2000,Win7 x32,Win7 x64,Win98,WinOther,WinServer,WinVista,WinVista x64,WinXP,Other - English,Arabic,Catalan,Chinese,Danish,Dutch,Finnish,French,German,Greek,Icelandic,Italian,Norwegian,Polish,Portuguese,Romanian,Russian,Slovenian,Spanish,Swedish,Turkish - Increase performances, Setup process is easier, Reduce number of clicks required to use software - Business - Business::Accounting & Finance - None - - 18037439 - 18037 - 18.03 - - - N - - Days - - - - - - - - - dolibarr, erp, crm, invoices, commercial proposals, orders, accounting, stock, products, agenda, bank, business, company, foundation, management, sme, doliwamp - Dolibarr ERP & CRM - Dolibarr ERP & CRM, the easy to use open source software to manage your activity - Dolibarr ERP & CRM, the easy to use open source software to manage your activity (invoices, customers, suppliers, contracts, agenda, emailings...) and any other things a small or mid-sized business or a foundation needs to manage. - Dolibarr ERP & CRM is a software built by modules addition (you enable only features you need), to manage small or medium companies, freelancers or foundations. We can say Dolibarr is an ERP or CRM. Dolibarr is also available with an auto-installer for Windows users with no technical knowledge to install Dolibarr and all its prerequisites (Apache, Mysql, PHP) with just one auto-exe file. See DoliWamp software for this. - Dolibarr ERP & CRM is a software built by modules addition (you enable only features you need), to manage small or mid-sized businesses, freelancers or foundations. We can say Dolibarr is an ERP or CRM (or both depending on activated modules). It's an OpenSource project base on a WAMP, MAMP or LAMP server (Apache, Mysql, PHP for all Operating Systems). Dolibarr differs from other ERP or CRM softwares (like OpenAguila, OpenBravo, OpenERP, Neogia, Compiere, etc) because everything was made to be more simple: -Simple to install -Simple to use -Simple to develop -Note that Dolibarr is also available with an auto-installer for Windows or Ubuntu users with no technical knowledge to install Dolibarr and all its prerequisites (Apache, Mysql, PHP) with just one auto-exe file. This version is called DoliWamp (for Windows) or DoliBuntu (for Ubuntu/Debian). - - - dolibarr, erp, crm, invoices, commercial proposals, orders, accounting, stock, products, agenda, bank, business, company, foundation, management, sme, doliwamp - Dolibarr ERP & CRM - Dolibarr ERP & CRM, le gestionnaire simple pour gérer votre activité - Dolibarr ERP & CRM, le logiciel simple et OpenSource pour gérer votre activité (factures, devis, facturation, commandes, compta, trésorerie, stocks, produits, agenda, comptes bancaires, associations) - Dolibarr ERP & CRM est un logiciel modulaire (on n'active que les fonctions que l'on désire) de gestions de TPE/PME, d'indépendants, d'entrepreneurs ou d'associations. En terme plus techniques, c'est un ERP et CRM. C'est un projet OpenSource qui s'exécute au sein d'un serveur Web et peut donc être accessible depuis n'importe quel lieu disposant d'une connexion Internet (Projet basé sur un serveur WAMP, MAMP ou LAMP: Apache, MySQL, PHP). - Dolibarr ERP & CRM est un logiciel modulaire (on n'active que les fonctions que l'on désire) de gestions de TPE/PME, d'indépendants, d'entrepreneurs ou d'associations. En terme plus techniques, c'est un ERP et CRM. C'est un projet OpenSource qui s'exécute au sein d'un serveur Web et peut donc être accessible depuis n'importe quel lieu disposant d'une connexion Internet (Projet basé sur un serveur WAMP, MAMP ou LAMP: Apache, MySQL, PHP). Dolibarr vient compléter les offres déjà nombreuses de logiciels de cette catégorie (comme OpenBravo, OpenERP, SugarCRM, Neogia, Compiere, etc.) mais se démarque par le fait qu'ici tout est fait pour offrir de la simplicité (règle des 3 S): -Simple pour l'installation (avec au choix des installeurs clé en main pour ceux qui ignorent comment installer un serveur Web, ou une installation manuelle) -Simple pour l'utilisation (fonctions modulaires pour ne pas surcharger les menus, informations claires à la saisie) -Simple pour le développement (pas de frameworks lourds). -Dolibarr intègre en effet sa propre architecture (design patterns) permettant à tout développeur d'être tout de suite opérationnel sans connaissances particulières autre que le PHP. - - - erp, crm, gestionale, medie imprese, fondazioni - Gestionale open source e gratuito - Gestionale open source e gratuito per piccole e medie imprese, fondazioni - Dolibarr è un a gestionale open source e gratuito per piccole e medie imprese, fondazioni e liberi professionisti. Include varie funzionalità per Enterprise Resource Planning e gestione dei clienti (CRM), ma anche ulteriori attività. - Dolibarr è un programma gestionale open source e gratuito per piccole e medie imprese, fondazioni e liberi professionisti. Include varie funzionalità per Enterprise Resource Planning e gestione dei clienti (CRM), ma anche ulteriori attività. Dolibar è progettato per poter fornire solo ciò di cui hai bisogno ed essere facile da usare. - Dolibarr è un programma gestionale open source e gratuito per piccole e medie imprese, fondazioni e liberi professionisti. Include varie funzionalità per Enterprise Resource Planning e gestione dei clienti (CRM), ma anche ulteriori attività. Dolibar è progettato per poter fornire solo ciò di cui hai bisogno ed essere facile da usare. Dolibar è completamente web-based, progettato per poter fornire solo ciò di cui hai bisogno ed essere facile da usare. - - - - - http://www.dolibarr.org - http://www.dolibarr.org - http://www.dolibarr.org/images/dolibarr_screenshot1.png - http://www.dolibarr.org/images/dolibarr.gif - http://www.dolibarr.org/files/pad_dolibarr.xml - - - http://www.dolibarr.org/files/dolibarr.tgz - http://www.dolibarr.org/files/dolibarr.tgz - - - - - - GNU GPL - GNU GPL - - - Y - 1.4 - http://pad.asp-software.org/extensions/Affiliates.htm - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Y - N - - - + + + + 3.11 + PADGen 3.1.1.47 http://www.padgen.org + Portable Application Description, or PAD for short, is a data set that is used by shareware authors to disseminate information to anyone interested in their software products. To find out more go to http://pad.asp-software.org + + + Dolibarr team + 11 rue raymond Queneau + + Rueil Malmaison + + 92500 + FRANCE + http://www.dolibarr.org + + Dolibarr team + Dolibarr team + dolibarr-dev@nongnu.org + Dolibarr team + Dolibarr team + dolibarr-dev@nongnu.org + + + dolibarr-dev@nongnu.org + dolibarr-dev@nongnu.org + dolibarr-dev@nongnu.org + + + + + + + + Dolibarr + 3.5 + 01 + 01 + 2014 + + + + Freeware + Major Update + No Install Support + Linux,Mac OS X,Mac Other,Unix,Win2000,Win7 x32,Win7 x64,Win98,WinOther,WinServer,WinVista,WinVista x64,WinXP,Other + English,Arabic,Catalan,Chinese,Danish,Dutch,Finnish,French,German,Greek,Icelandic,Italian,Norwegian,Polish,Portuguese,Romanian,Russian,Slovenian,Spanish,Swedish,Turkish + Increase performances, Setup process is easier, Reduce number of clicks required to use software + Business + Business::Accounting & Finance + None + + 18037439 + 18037 + 18.03 + + + N + + Days + + + + + + + + + dolibarr, erp, crm, invoices, commercial proposals, orders, accounting, stock, products, agenda, bank, business, company, foundation, management, sme, doliwamp + Dolibarr ERP & CRM + Dolibarr ERP & CRM, the easy to use open source software to manage your activity + Dolibarr ERP & CRM, the easy to use open source software to manage your activity (invoices, customers, suppliers, contracts, agenda, emailings...) and any other things a small or mid-sized business or a foundation needs to manage. + Dolibarr ERP & CRM is a software built by modules addition (you enable only features you need), to manage small or medium companies, freelancers or foundations. We can say Dolibarr is an ERP or CRM. Dolibarr is also available with an auto-installer for Windows users with no technical knowledge to install Dolibarr and all its prerequisites (Apache, Mysql, PHP) with just one auto-exe file. See DoliWamp software for this. + Dolibarr ERP & CRM is a software built by modules addition (you enable only features you need), to manage small or mid-sized businesses, freelancers or foundations. We can say Dolibarr is an ERP or CRM (or both depending on activated modules). It's an OpenSource project base on a WAMP, MAMP or LAMP server (Apache, Mysql, PHP for all Operating Systems). Dolibarr differs from other ERP or CRM softwares (like OpenAguila, OpenBravo, OpenERP, Neogia, Compiere, etc) because everything was made to be more simple: +Simple to install +Simple to use +Simple to develop +Note that Dolibarr is also available with an auto-installer for Windows or Ubuntu users with no technical knowledge to install Dolibarr and all its prerequisites (Apache, Mysql, PHP) with just one auto-exe file. This version is called DoliWamp (for Windows) or DoliBuntu (for Ubuntu/Debian). + + + dolibarr, erp, crm, invoices, commercial proposals, orders, accounting, stock, products, agenda, bank, business, company, foundation, management, sme, doliwamp + Dolibarr ERP & CRM + Dolibarr ERP & CRM, le gestionnaire simple pour gérer votre activité + Dolibarr ERP & CRM, le logiciel simple et OpenSource pour gérer votre activité (factures, devis, facturation, commandes, compta, trésorerie, stocks, produits, agenda, comptes bancaires, associations) + Dolibarr ERP & CRM est un logiciel modulaire (on n'active que les fonctions que l'on désire) de gestions de TPE/PME, d'indépendants, d'entrepreneurs ou d'associations. En terme plus techniques, c'est un ERP et CRM. C'est un projet OpenSource qui s'exécute au sein d'un serveur Web et peut donc être accessible depuis n'importe quel lieu disposant d'une connexion Internet (Projet basé sur un serveur WAMP, MAMP ou LAMP: Apache, MySQL, PHP). + Dolibarr ERP & CRM est un logiciel modulaire (on n'active que les fonctions que l'on désire) de gestions de TPE/PME, d'indépendants, d'entrepreneurs ou d'associations. En terme plus techniques, c'est un ERP et CRM. C'est un projet OpenSource qui s'exécute au sein d'un serveur Web et peut donc être accessible depuis n'importe quel lieu disposant d'une connexion Internet (Projet basé sur un serveur WAMP, MAMP ou LAMP: Apache, MySQL, PHP). Dolibarr vient compléter les offres déjà nombreuses de logiciels de cette catégorie (comme OpenBravo, OpenERP, SugarCRM, Neogia, Compiere, etc.) mais se démarque par le fait qu'ici tout est fait pour offrir de la simplicité (règle des 3 S): +Simple pour l'installation (avec au choix des installeurs clé en main pour ceux qui ignorent comment installer un serveur Web, ou une installation manuelle) +Simple pour l'utilisation (fonctions modulaires pour ne pas surcharger les menus, informations claires à la saisie) +Simple pour le développement (pas de frameworks lourds). +Dolibarr intègre en effet sa propre architecture (design patterns) permettant à tout développeur d'être tout de suite opérationnel sans connaissances particulières autre que le PHP. + + + erp, crm, gestionale, medie imprese, fondazioni + Gestionale open source e gratuito + Gestionale open source e gratuito per piccole e medie imprese, fondazioni + Dolibarr è un a gestionale open source e gratuito per piccole e medie imprese, fondazioni e liberi professionisti. Include varie funzionalità per Enterprise Resource Planning e gestione dei clienti (CRM), ma anche ulteriori attività. + Dolibarr è un programma gestionale open source e gratuito per piccole e medie imprese, fondazioni e liberi professionisti. Include varie funzionalità per Enterprise Resource Planning e gestione dei clienti (CRM), ma anche ulteriori attività. Dolibar è progettato per poter fornire solo ciò di cui hai bisogno ed essere facile da usare. + Dolibarr è un programma gestionale open source e gratuito per piccole e medie imprese, fondazioni e liberi professionisti. Include varie funzionalità per Enterprise Resource Planning e gestione dei clienti (CRM), ma anche ulteriori attività. Dolibar è progettato per poter fornire solo ciò di cui hai bisogno ed essere facile da usare. Dolibar è completamente web-based, progettato per poter fornire solo ciò di cui hai bisogno ed essere facile da usare. + + + + + http://www.dolibarr.org + http://www.dolibarr.org + http://www.dolibarr.org/images/dolibarr_screenshot1.png + http://www.dolibarr.org/images/dolibarr.gif + http://www.dolibarr.org/files/pad_dolibarr.xml + + + http://www.dolibarr.org/files/dolibarr.tgz + http://www.dolibarr.org/files/dolibarr.tgz + + + + + + GNU GPL + GNU GPL + + + Y + 1.4 + http://pad.asp-software.org/extensions/Affiliates.htm + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Y + N + + + diff --git a/build/pad/pad_doliwamp.xml b/build/pad/pad_doliwamp.xml index c59a3695e5d..8abf126d5f7 100644 --- a/build/pad/pad_doliwamp.xml +++ b/build/pad/pad_doliwamp.xml @@ -1,225 +1,225 @@ - - - - 3.11 - PADGen 3.1.1.47 http://www.padgen.org - Portable Application Description, or PAD for short, is a data set that is used by shareware authors to disseminate information to anyone interested in their software products. To find out more go to http://pad.asp-software.org - - - NLTechno - 11 Rue raymond Queneau - - Rueil Malmaison - - 92500 - FRANCE - http://www.nltechno.com - - NLTechno - NLTechno - contact@nltechno.com - NLTechno - NLTechno - contact@nltechno.com - - - support@nltechno.com - support@nltechno.com - support@nltechno.com - - - - - - - - DoliWamp - 3.5 - 01 - 01 - 2014 - - - - Freeware - Major Update - Install and Uninstall - Win2000,Win7 x32,Win7 x64,Win98,WinOther,WinServer,WinVista,WinVista x64,WinXP,Other - English,Arabic,Catalan,Chinese,Dutch,Finnish,French,German,Icelandic,Italian,Norwegian,Polish,Portuguese,Romanian,Russian,Slovenian,Spanish,Swedish,Turkish - Increase performances, Setup process is easier, Reduce number of clicks required to use software - Business - Business::Accounting & Finance - None - - 26048004 - 25437 - 24.84 - - - N - - Days - - - - - - - - - doliwamp, dolibarr, erp, crm, invoices, commercial proposals, orders, accounting, stock, products, agenda, bank, business, company, foundation, management - DoliWamp, Dolibarr ERP/CRM for Windows - DoliWamp, the easy to use Dolibarr for Windows to manage your company,foundation - DoliWamp is the Dolibarr ERP/CRM for Windows, the easy to use open source software to manage your activity (invoices, customers, suppliers, contracts, agenda, emailings...) and any other things a small or mid-sized business or a foundation needs. - DoliWamp is the Dolibarr ERP/CRM autoinstaller for Windows users with no technical knowledge to install Dolibarr and all its prerequisites (Apache, Mysql, PHP) with just one auto-exe file. Dolibarr ERP/CRM is a software package built by modules addition (you enable only features you need), to manage small or mid-sized businesses, freelancers or foundations. - DoliWamp is the Dolibarr ERP/CRM for Windows. Dolibarr ERP & CRM is a software built by modules addition (you enable only features you need), to manage small or mid-sized businesses, freelancers or foundations (You can manage or follow contacts, invoices, orders, commercial proposals, products, stock management, agenda, mass emailings, members of a foundation, bank accounts...). Based on a WAMP, MAMP or LAMP server (Apache, Mysql, PHP for all Operating Systems), you can install it as a standalone program or use it from anywhere with any web browser. Dolibarr is an OpenSource project. It differs from other ERP or CRM softwares (like OpenAguila, OpenBravo, OpenERP, Neogia, Compiere, etc) because everything was made to be more simple: Simple to install, Simple to use, Simple to develop. -DoliWamp is the auto-installer for Windows users with no technical knowledge to install Dolibarr ERP/CRM and all its prerequisites (Apache, Mysql, PHP) with just one auto-exe file. - - - doliwamp, dolibarr, erp, crm, factures, devis, facturation, commandes, compta, trésorerie, stocks, produits, agenda, comptes bancaires, associations, entreprises, PME, TPE - DoliWamp, Dolibarr ERP/CRM pour Windows - DoliWamp, la distribution de Dolibarr pour gérer votre entreprise ou association - DoliWamp est la version spécialisée pour Windows de Dolibarr ERP-CRM, le logiciel simple et OpenSource pour gérer votre activité (factures, devis, facturation, commandes, compta, trésorerie, stocks, produits, agenda, comptes bancaires, associations) - DoliWamp est la version spécialisée pour Windows de Dolibarr ERP-CRM, le logiciel simple et OpenSource pour gérer votre activité (factures, devis, facturation, commandes, compta, trésorerie, stocks, produits, agenda, comptes bancaires, associations) - DoliWamp est la version spécialisée pour Windows de Dolibarr ERP-CRM, le logiciel simple et OpenSource pour gérer votre activité (factures, devis, facturation, commandes, compta, trésorerie, stocks, produits, agenda, comptes bancaires, associations) - - - doliwamp, dolibarr, erp, crm, gestionale, medie imprese, fondazioni - DoliWamp, Dolibarr ERP/CRM per Windows - Gestionale open source e gratuito per piccole e medie imprese, fondazioni - Dolibarr è un a gestionale open source e gratuito per piccole e medie imprese, fondazioni e liberi professionisti. Include varie funzionalità per Enterprise Resource Planning e gestione dei clienti (CRM), ma anche ulteriori attività. - Dolibarr è un programma gestionale open source e gratuito per piccole e medie imprese, fondazioni e liberi professionisti. Include varie funzionalità per Enterprise Resource Planning e gestione dei clienti (CRM), ma anche ulteriori attività. Dolibar è progettato per poter fornire solo ciò di cui hai bisogno ed essere facile da usare. - Dolibarr è un programma gestionale open source e gratuito per piccole e medie imprese, fondazioni e liberi professionisti. Include varie funzionalità per Enterprise Resource Planning e gestione dei clienti (CRM), ma anche ulteriori attività. Dolibar è progettato per poter fornire solo ciò di cui hai bisogno ed essere facile da usare. Dolibar è completamente web-based, progettato per poter fornire solo ciò di cui hai bisogno ed essere facile da usare. - - - - - http://www.nltechno.com/doliwamp/ - http://www.nltechno.com/doliwamp/ - http://www.dolibarr.org/images/dolibarr_screenshot1.png - http://www.dolibarr.org/images/dolibarr.gif - http://www.dolibarr.org/files/pad_doliwamp.xml - - - http://www.dolibarr.org/files/doliwamp.exe - http://www.dolibarr.org/files/doliwamp.exe - - - - - - GNU GPL - GNU GPL - - - Y - 1.4 - http://pad.asp-software.org/extensions/Affiliates.htm - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Y - N - - - + + + + 3.11 + PADGen 3.1.1.47 http://www.padgen.org + Portable Application Description, or PAD for short, is a data set that is used by shareware authors to disseminate information to anyone interested in their software products. To find out more go to http://pad.asp-software.org + + + NLTechno + 11 Rue raymond Queneau + + Rueil Malmaison + + 92500 + FRANCE + http://www.nltechno.com + + NLTechno + NLTechno + contact@nltechno.com + NLTechno + NLTechno + contact@nltechno.com + + + support@nltechno.com + support@nltechno.com + support@nltechno.com + + + + + + + + DoliWamp + 3.5 + 01 + 01 + 2014 + + + + Freeware + Major Update + Install and Uninstall + Win2000,Win7 x32,Win7 x64,Win98,WinOther,WinServer,WinVista,WinVista x64,WinXP,Other + English,Arabic,Catalan,Chinese,Dutch,Finnish,French,German,Icelandic,Italian,Norwegian,Polish,Portuguese,Romanian,Russian,Slovenian,Spanish,Swedish,Turkish + Increase performances, Setup process is easier, Reduce number of clicks required to use software + Business + Business::Accounting & Finance + None + + 26048004 + 25437 + 24.84 + + + N + + Days + + + + + + + + + doliwamp, dolibarr, erp, crm, invoices, commercial proposals, orders, accounting, stock, products, agenda, bank, business, company, foundation, management + DoliWamp, Dolibarr ERP/CRM for Windows + DoliWamp, the easy to use Dolibarr for Windows to manage your company,foundation + DoliWamp is the Dolibarr ERP/CRM for Windows, the easy to use open source software to manage your activity (invoices, customers, suppliers, contracts, agenda, emailings...) and any other things a small or mid-sized business or a foundation needs. + DoliWamp is the Dolibarr ERP/CRM autoinstaller for Windows users with no technical knowledge to install Dolibarr and all its prerequisites (Apache, Mysql, PHP) with just one auto-exe file. Dolibarr ERP/CRM is a software package built by modules addition (you enable only features you need), to manage small or mid-sized businesses, freelancers or foundations. + DoliWamp is the Dolibarr ERP/CRM for Windows. Dolibarr ERP & CRM is a software built by modules addition (you enable only features you need), to manage small or mid-sized businesses, freelancers or foundations (You can manage or follow contacts, invoices, orders, commercial proposals, products, stock management, agenda, mass emailings, members of a foundation, bank accounts...). Based on a WAMP, MAMP or LAMP server (Apache, Mysql, PHP for all Operating Systems), you can install it as a standalone program or use it from anywhere with any web browser. Dolibarr is an OpenSource project. It differs from other ERP or CRM softwares (like OpenAguila, OpenBravo, OpenERP, Neogia, Compiere, etc) because everything was made to be more simple: Simple to install, Simple to use, Simple to develop. +DoliWamp is the auto-installer for Windows users with no technical knowledge to install Dolibarr ERP/CRM and all its prerequisites (Apache, Mysql, PHP) with just one auto-exe file. + + + doliwamp, dolibarr, erp, crm, factures, devis, facturation, commandes, compta, trésorerie, stocks, produits, agenda, comptes bancaires, associations, entreprises, PME, TPE + DoliWamp, Dolibarr ERP/CRM pour Windows + DoliWamp, la distribution de Dolibarr pour gérer votre entreprise ou association + DoliWamp est la version spécialisée pour Windows de Dolibarr ERP-CRM, le logiciel simple et OpenSource pour gérer votre activité (factures, devis, facturation, commandes, compta, trésorerie, stocks, produits, agenda, comptes bancaires, associations) + DoliWamp est la version spécialisée pour Windows de Dolibarr ERP-CRM, le logiciel simple et OpenSource pour gérer votre activité (factures, devis, facturation, commandes, compta, trésorerie, stocks, produits, agenda, comptes bancaires, associations) + DoliWamp est la version spécialisée pour Windows de Dolibarr ERP-CRM, le logiciel simple et OpenSource pour gérer votre activité (factures, devis, facturation, commandes, compta, trésorerie, stocks, produits, agenda, comptes bancaires, associations) + + + doliwamp, dolibarr, erp, crm, gestionale, medie imprese, fondazioni + DoliWamp, Dolibarr ERP/CRM per Windows + Gestionale open source e gratuito per piccole e medie imprese, fondazioni + Dolibarr è un a gestionale open source e gratuito per piccole e medie imprese, fondazioni e liberi professionisti. Include varie funzionalità per Enterprise Resource Planning e gestione dei clienti (CRM), ma anche ulteriori attività. + Dolibarr è un programma gestionale open source e gratuito per piccole e medie imprese, fondazioni e liberi professionisti. Include varie funzionalità per Enterprise Resource Planning e gestione dei clienti (CRM), ma anche ulteriori attività. Dolibar è progettato per poter fornire solo ciò di cui hai bisogno ed essere facile da usare. + Dolibarr è un programma gestionale open source e gratuito per piccole e medie imprese, fondazioni e liberi professionisti. Include varie funzionalità per Enterprise Resource Planning e gestione dei clienti (CRM), ma anche ulteriori attività. Dolibar è progettato per poter fornire solo ciò di cui hai bisogno ed essere facile da usare. Dolibar è completamente web-based, progettato per poter fornire solo ciò di cui hai bisogno ed essere facile da usare. + + + + + http://www.nltechno.com/doliwamp/ + http://www.nltechno.com/doliwamp/ + http://www.dolibarr.org/images/dolibarr_screenshot1.png + http://www.dolibarr.org/images/dolibarr.gif + http://www.dolibarr.org/files/pad_doliwamp.xml + + + http://www.dolibarr.org/files/doliwamp.exe + http://www.dolibarr.org/files/doliwamp.exe + + + + + + GNU GPL + GNU GPL + + + Y + 1.4 + http://pad.asp-software.org/extensions/Affiliates.htm + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Y + N + + + diff --git a/build/rpm/dolibarr_fedora.spec b/build/rpm/dolibarr_fedora.spec index 0cd72f99cdd..4ad1441104d 100755 --- a/build/rpm/dolibarr_fedora.spec +++ b/build/rpm/dolibarr_fedora.spec @@ -192,6 +192,7 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/loan %_datadir/dolibarr/htdocs/mailmanspip %_datadir/dolibarr/htdocs/margin +%_datadir/dolibarr/htdocs/multicurrency %_datadir/dolibarr/htdocs/opensurvey %_datadir/dolibarr/htdocs/paybox %_datadir/dolibarr/htdocs/paypal @@ -206,6 +207,7 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/theme %_datadir/dolibarr/htdocs/user %_datadir/dolibarr/htdocs/webservices +%_datadir/dolibarr/htdocs/websites %_datadir/dolibarr/htdocs/*.ico %_datadir/dolibarr/htdocs/*.patch %_datadir/dolibarr/htdocs/*.php diff --git a/build/rpm/dolibarr_generic.spec b/build/rpm/dolibarr_generic.spec index 043088bf5d6..f20b2047225 100755 --- a/build/rpm/dolibarr_generic.spec +++ b/build/rpm/dolibarr_generic.spec @@ -272,6 +272,7 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/loan %_datadir/dolibarr/htdocs/mailmanspip %_datadir/dolibarr/htdocs/margin +%_datadir/dolibarr/htdocs/multicurrency %_datadir/dolibarr/htdocs/opensurvey %_datadir/dolibarr/htdocs/paybox %_datadir/dolibarr/htdocs/paypal @@ -286,6 +287,7 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/theme %_datadir/dolibarr/htdocs/user %_datadir/dolibarr/htdocs/webservices +%_datadir/dolibarr/htdocs/websites %_datadir/dolibarr/htdocs/*.ico %_datadir/dolibarr/htdocs/*.patch %_datadir/dolibarr/htdocs/*.php diff --git a/build/rpm/dolibarr_mandriva.spec b/build/rpm/dolibarr_mandriva.spec index 3f439bb4a9a..ca836bc47d6 100755 --- a/build/rpm/dolibarr_mandriva.spec +++ b/build/rpm/dolibarr_mandriva.spec @@ -189,6 +189,7 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/loan %_datadir/dolibarr/htdocs/mailmanspip %_datadir/dolibarr/htdocs/margin +%_datadir/dolibarr/htdocs/multicurrency %_datadir/dolibarr/htdocs/opensurvey %_datadir/dolibarr/htdocs/paybox %_datadir/dolibarr/htdocs/paypal @@ -203,6 +204,7 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/theme %_datadir/dolibarr/htdocs/user %_datadir/dolibarr/htdocs/webservices +%_datadir/dolibarr/htdocs/websites %_datadir/dolibarr/htdocs/*.ico %_datadir/dolibarr/htdocs/*.patch %_datadir/dolibarr/htdocs/*.php diff --git a/build/rpm/dolibarr_opensuse.spec b/build/rpm/dolibarr_opensuse.spec index cc21d7083b3..fcff3363213 100755 --- a/build/rpm/dolibarr_opensuse.spec +++ b/build/rpm/dolibarr_opensuse.spec @@ -200,6 +200,7 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/loan %_datadir/dolibarr/htdocs/mailmanspip %_datadir/dolibarr/htdocs/margin +%_datadir/dolibarr/htdocs/multicurrency %_datadir/dolibarr/htdocs/opensurvey %_datadir/dolibarr/htdocs/paybox %_datadir/dolibarr/htdocs/paypal @@ -214,6 +215,7 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/theme %_datadir/dolibarr/htdocs/user %_datadir/dolibarr/htdocs/webservices +%_datadir/dolibarr/htdocs/websites %_datadir/dolibarr/htdocs/*.ico %_datadir/dolibarr/htdocs/*.patch %_datadir/dolibarr/htdocs/*.php diff --git a/composer.json b/composer.json index fb3109fbc40..2aa9dd216d6 100644 --- a/composer.json +++ b/composer.json @@ -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": { @@ -30,7 +38,8 @@ "jakub-onderka/php-parallel-lint": "^0", "jakub-onderka/php-console-highlighter": "^0", "phpunit/phpunit": "^4", - "squizlabs/php_codesniffer": "^2" + "squizlabs/php_codesniffer": "^2", + "phpunit/phpunit-selenium": "^2" }, "suggest": { "ext-mysqlnd": "To use with MySQL or MariaDB", @@ -46,7 +55,6 @@ "ext-soap": "Native SOAP", "ext-zip": "ODT and Excel support", "ext-xml": "Excel support", - "firephp/firephp-core": "Logging to Firebug console support", - "raven/raven": "Sentry logging server support" + "firephp/firephp-core": "Logging to Firebug console support" } } diff --git a/dev/README b/dev/README index 88011d07509..337928507fc 100644 --- a/dev/README +++ b/dev/README @@ -7,7 +7,7 @@ provided with a standard release. There is also some documentation on Dolibarr Wiki: -http://wiki.dolibarr.org/ +https://wiki.dolibarr.org/ and -http://www.dolibarr.org/html_doxygen/index.html +https://doxygen.dolibarr.org/ diff --git a/dev/examples/README b/dev/examples/code/README similarity index 100% rename from dev/examples/README rename to dev/examples/code/README diff --git a/dev/examples/create_invoice.php b/dev/examples/code/create_invoice.php similarity index 100% rename from dev/examples/create_invoice.php rename to dev/examples/code/create_invoice.php diff --git a/dev/examples/create_order.php b/dev/examples/code/create_order.php similarity index 100% rename from dev/examples/create_order.php rename to dev/examples/code/create_order.php diff --git a/dev/examples/create_product.php b/dev/examples/code/create_product.php similarity index 100% rename from dev/examples/create_product.php rename to dev/examples/code/create_product.php diff --git a/dev/examples/create_user.php b/dev/examples/code/create_user.php similarity index 100% rename from dev/examples/create_user.php rename to dev/examples/code/create_user.php diff --git a/dev/examples/get_contracts.php b/dev/examples/code/get_contracts.php similarity index 100% rename from dev/examples/get_contracts.php rename to dev/examples/code/get_contracts.php diff --git a/dev/ical/event_recu.txt b/dev/examples/ical/event_recu.txt similarity index 100% rename from dev/ical/event_recu.txt rename to dev/examples/ical/event_recu.txt diff --git a/dev/ldap/README b/dev/examples/ldap/README similarity index 100% rename from dev/ldap/README rename to dev/examples/ldap/README diff --git a/dev/ldap/ldapadd_sample1.txt b/dev/examples/ldap/ldapadd_sample1.txt similarity index 100% rename from dev/ldap/ldapadd_sample1.txt rename to dev/examples/ldap/ldapadd_sample1.txt diff --git a/dev/ldap/ldapadd_sample2.txt b/dev/examples/ldap/ldapadd_sample2.txt similarity index 100% rename from dev/ldap/ldapadd_sample2.txt rename to dev/examples/ldap/ldapadd_sample2.txt diff --git a/dev/ldap/ldapadd_sample3.txt b/dev/examples/ldap/ldapadd_sample3.txt similarity index 100% rename from dev/ldap/ldapadd_sample3.txt rename to dev/examples/ldap/ldapadd_sample3.txt diff --git a/dev/ldap/ldapdelete_sample1.txt b/dev/examples/ldap/ldapdelete_sample1.txt similarity index 100% rename from dev/ldap/ldapdelete_sample1.txt rename to dev/examples/ldap/ldapdelete_sample1.txt diff --git a/dev/ldap/ldapdelete_sample3.txt b/dev/examples/ldap/ldapdelete_sample3.txt similarity index 100% rename from dev/ldap/ldapdelete_sample3.txt rename to dev/examples/ldap/ldapdelete_sample3.txt diff --git a/dev/ldap/ldapmodify_sample1.txt b/dev/examples/ldap/ldapmodify_sample1.txt similarity index 100% rename from dev/ldap/ldapmodify_sample1.txt rename to dev/examples/ldap/ldapmodify_sample1.txt diff --git a/dev/ldap/ldapsearch_sample1.txt b/dev/examples/ldap/ldapsearch_sample1.txt similarity index 100% rename from dev/ldap/ldapsearch_sample1.txt rename to dev/examples/ldap/ldapsearch_sample1.txt diff --git a/dev/ldap/setup_example_activedirectory.jpg b/dev/examples/ldap/setup_example_activedirectory.jpg similarity index 100% rename from dev/ldap/setup_example_activedirectory.jpg rename to dev/examples/ldap/setup_example_activedirectory.jpg diff --git a/dev/mail/README b/dev/examples/mail/README similarity index 100% rename from dev/mail/README rename to dev/examples/mail/README diff --git a/dev/mail/dolibarr_mail_attachement.txt b/dev/examples/mail/dolibarr_mail_attachement.txt similarity index 100% rename from dev/mail/dolibarr_mail_attachement.txt rename to dev/examples/mail/dolibarr_mail_attachement.txt diff --git a/dev/mail/dolibarr_mail_attachementHTML.txt b/dev/examples/mail/dolibarr_mail_attachementHTML.txt similarity index 100% rename from dev/mail/dolibarr_mail_attachementHTML.txt rename to dev/examples/mail/dolibarr_mail_attachementHTML.txt diff --git a/dev/mail/dolibarr_mail_attachementwithimageHTML.txt b/dev/examples/mail/dolibarr_mail_attachementwithimageHTML.txt similarity index 100% rename from dev/mail/dolibarr_mail_attachementwithimageHTML.txt rename to dev/examples/mail/dolibarr_mail_attachementwithimageHTML.txt diff --git a/dev/mail/dolibarr_mail_simple.txt b/dev/examples/mail/dolibarr_mail_simple.txt similarity index 100% rename from dev/mail/dolibarr_mail_simple.txt rename to dev/examples/mail/dolibarr_mail_simple.txt diff --git a/dev/mail/dolibarr_mail_simpleHTML.txt b/dev/examples/mail/dolibarr_mail_simpleHTML.txt similarity index 100% rename from dev/mail/dolibarr_mail_simpleHTML.txt rename to dev/examples/mail/dolibarr_mail_simpleHTML.txt diff --git a/dev/mail/dolibarr_mail_universal.txt b/dev/examples/mail/dolibarr_mail_universal.txt similarity index 100% rename from dev/mail/dolibarr_mail_universal.txt rename to dev/examples/mail/dolibarr_mail_universal.txt diff --git a/dev/mail/dolibarr_mail_withimageHTML.txt b/dev/examples/mail/dolibarr_mail_withimageHTML.txt similarity index 100% rename from dev/mail/dolibarr_mail_withimageHTML.txt rename to dev/examples/mail/dolibarr_mail_withimageHTML.txt diff --git a/dev/mail/source_email_from_thirdparty.txt b/dev/examples/mail/source_email_from_thirdparty.txt similarity index 100% rename from dev/mail/source_email_from_thirdparty.txt rename to dev/examples/mail/source_email_from_thirdparty.txt diff --git a/dev/initdata/README b/dev/initdata/README index 1db130dfe3e..97f5f0d3cd7 100644 --- a/dev/initdata/README +++ b/dev/initdata/README @@ -2,4 +2,4 @@ README ------ Scripts in this directory can be used to load or purge data of a database instance. -WARNING: This may erase data. +WARNING: Some of this script may delete definitely data. diff --git a/dev/initdata/generate-invoice.php b/dev/initdata/generate-invoice.php index e7c274040de..716060f0379 100755 --- a/dev/initdata/generate-invoice.php +++ b/dev/initdata/generate-invoice.php @@ -31,8 +31,8 @@ if (substr($sapi_type, 0, 3) == 'cgi') { } // Recupere root dolibarr -$path=preg_replace('/generate-facture.php/i','',$_SERVER["PHP_SELF"]); -require ($path."../../htdocs/master.inc.php"); +//$path=preg_replace('/generate-produit.php/i','',$_SERVER["PHP_SELF"]); +require (__DIR__. '/../../htdocs/master.inc.php'); require_once(DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php"); require_once(DOL_DOCUMENT_ROOT."/societe/class/societe.class.php"); diff --git a/dev/initdata/generate-order.php b/dev/initdata/generate-order.php index 9e96bbd781b..0bba1c5af5b 100755 --- a/dev/initdata/generate-order.php +++ b/dev/initdata/generate-order.php @@ -32,8 +32,8 @@ if (substr($sapi_type, 0, 3) == 'cgi') { } // Recupere root dolibarr -$path=preg_replace('/generate-commande.php/i','',$_SERVER["PHP_SELF"]); -require ($path."../../htdocs/master.inc.php"); +//$path=preg_replace('/generate-commande.php/i','',$_SERVER["PHP_SELF"]); +require (__DIR__. '/../../htdocs/master.inc.php'); include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; diff --git a/dev/initdata/generate-product.php b/dev/initdata/generate-product.php index fbdde96f95a..3ae44b00b3a 100755 --- a/dev/initdata/generate-product.php +++ b/dev/initdata/generate-product.php @@ -32,8 +32,8 @@ if (substr($sapi_type, 0, 3) == 'cgi') { } // Recupere root dolibarr -$path=preg_replace('/generate-produit.php/i','',$_SERVER["PHP_SELF"]); -require ($path."../../htdocs/master.inc.php"); +//$path=preg_replace('/generate-produit.php/i','',$_SERVER["PHP_SELF"]); +require (__DIR__. '/../../htdocs/master.inc.php'); include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; diff --git a/dev/initdata/generate-proposal.php b/dev/initdata/generate-proposal.php index 071efc0298f..713f1ca4069 100755 --- a/dev/initdata/generate-proposal.php +++ b/dev/initdata/generate-proposal.php @@ -32,8 +32,8 @@ if (substr($sapi_type, 0, 3) == 'cgi') { } // Recupere root dolibarr -$path=preg_replace('/generate-propale.php/i','',$_SERVER["PHP_SELF"]); -require ($path."../../htdocs/master.inc.php"); +//$path=preg_replace('/generate-propale.php/i','',$_SERVER["PHP_SELF"]); +require (__DIR__. '/../../htdocs/master.inc.php'); require_once(DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php"); require_once(DOL_DOCUMENT_ROOT."/comm/propal/class/propal.class.php"); require_once(DOL_DOCUMENT_ROOT."/commande/class/commande.class.php"); diff --git a/dev/initdata/generate-thirdparty.php b/dev/initdata/generate-thirdparty.php index 8c3a6e3e86e..992ab61f4ef 100755 --- a/dev/initdata/generate-thirdparty.php +++ b/dev/initdata/generate-thirdparty.php @@ -32,8 +32,8 @@ if (substr($sapi_type, 0, 3) == 'cgi') { } // Recupere root dolibarr -$path=preg_replace('/generate-societe.php/i','',$_SERVER["PHP_SELF"]); -require ($path."../../htdocs/master.inc.php"); +//$path=preg_replace('/generate-societe.php/i','',$_SERVER["PHP_SELF"]); +require (__DIR__. '/../../htdocs/master.inc.php'); include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; diff --git a/dev/initdata/import-products.php b/dev/initdata/import-products.php index 3c467fbfff5..a08e3b6066e 100755 --- a/dev/initdata/import-products.php +++ b/dev/initdata/import-products.php @@ -1,6 +1,7 @@ #!/usr/bin/env php + * Copyright (C) 2016 Juanjo Menent * * 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 @@ -56,7 +57,7 @@ $error=0; @set_time_limit(0); print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." *****\n"; -dol_syslog($script_file." launched with arg ".join(',',$argv)); +dol_syslog($script_file." launched with arg ".implode(',',$argv)); $mode = $argv[1]; $filepath = $argv[2]; diff --git a/dev/initdata/import-thirdparties.php b/dev/initdata/import-thirdparties.php index 199807473f8..08ad248ecc0 100755 --- a/dev/initdata/import-thirdparties.php +++ b/dev/initdata/import-thirdparties.php @@ -1,6 +1,7 @@ #!/usr/bin/env php + * Copyright (C) 2016 Juanjo Menent * * 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 @@ -56,7 +57,7 @@ $error=0; @set_time_limit(0); print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." *****\n"; -dol_syslog($script_file." launched with arg ".join(',',$argv)); +dol_syslog($script_file." launched with arg ".implode(',',$argv)); $mode = $argv[1]; $filepath = $argv[2]; diff --git a/dev/initdata/import-users.php b/dev/initdata/import-users.php index 355f41e9886..3aaa9c11a4a 100755 --- a/dev/initdata/import-users.php +++ b/dev/initdata/import-users.php @@ -1,6 +1,7 @@ #!/usr/bin/env php + * Copyright (C) 2016 Juanjo Menent * * 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 @@ -56,7 +57,7 @@ $error=0; @set_time_limit(0); print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." *****\n"; -dol_syslog($script_file." launched with arg ".join(',',$argv)); +dol_syslog($script_file." launched with arg ".implode(',',$argv)); $mode = $argv[1]; $filepath = $argv[2]; diff --git a/dev/initdata/purge-data.php b/dev/initdata/purge-data.php index 232ab1b5c41..f89a3ba2698 100755 --- a/dev/initdata/purge-data.php +++ b/dev/initdata/purge-data.php @@ -1,7 +1,7 @@ #!/usr/bin/env php - * + * Copyright (C) 2016 Juanjo Menent * 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 @@ -146,7 +146,7 @@ $sqls=array( @set_time_limit(0); print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." *****\n"; -dol_syslog($script_file." launched with arg ".join(',',$argv)); +dol_syslog($script_file." launched with arg ".implode(',',$argv)); $mode = $argv[1]; $option = $argv[2]; @@ -154,14 +154,14 @@ $option = $argv[2]; if (empty($mode) || ! in_array($mode,array('test','confirm'))) { print "Usage: $script_file (test|confirm) (all|option)\n"; print "\n"; - print "option can be ".join(',',array_keys($sqls))."\n"; + print "option can be ".implode(',',array_keys($sqls))."\n"; exit(-1); } if (empty($option) || ! in_array($option, array_merge(array('all'),array_keys($sqls))) ) { print "Usage: $script_file (test|confirm) (all|option)\n"; print "\n"; - print "option can be ".join(',',array_keys($sqls))."\n"; + print "option can be ".implode(',',array_keys($sqls))."\n"; exit(-1); } diff --git a/dev/initdemo/documents_demo/doctemplates/invoices/template_invoice.odt b/dev/initdemo/documents_demo/doctemplates/invoices/template_invoice.odt deleted file mode 100644 index dad29a292ef..00000000000 Binary files a/dev/initdemo/documents_demo/doctemplates/invoices/template_invoice.odt and /dev/null differ diff --git a/dev/initdemo/documents_demo/doctemplates/orders/template_order.odt b/dev/initdemo/documents_demo/doctemplates/orders/template_order.odt deleted file mode 100644 index 100afe5dac4..00000000000 Binary files a/dev/initdemo/documents_demo/doctemplates/orders/template_order.odt and /dev/null differ diff --git a/dev/initdemo/documents_demo/doctemplates/projects/template_project.odt b/dev/initdemo/documents_demo/doctemplates/projects/template_project.odt deleted file mode 100644 index fca796a26dd..00000000000 Binary files a/dev/initdemo/documents_demo/doctemplates/projects/template_project.odt and /dev/null differ diff --git a/dev/initdemo/documents_demo/doctemplates/proposals/template_proposal.odt b/dev/initdemo/documents_demo/doctemplates/proposals/template_proposal.odt deleted file mode 100644 index 8ece83c989c..00000000000 Binary files a/dev/initdemo/documents_demo/doctemplates/proposals/template_proposal.odt and /dev/null differ diff --git a/dev/initdemo/documents_demo/doctemplates/tasks/template_task_summary.odt b/dev/initdemo/documents_demo/doctemplates/tasks/template_task_summary.odt deleted file mode 100644 index 76984ebcf8c..00000000000 Binary files a/dev/initdemo/documents_demo/doctemplates/tasks/template_task_summary.odt and /dev/null differ diff --git a/dev/initdemo/documents_demo/doctemplates/thirdparties/template_thirdparty.odt b/dev/initdemo/documents_demo/doctemplates/thirdparties/template_thirdparty.odt deleted file mode 100644 index bfc4fa822f2..00000000000 Binary files a/dev/initdemo/documents_demo/doctemplates/thirdparties/template_thirdparty.odt and /dev/null differ diff --git a/dev/initdemo/documents_demo/medias/image/myimagesforemailing/dolicloud_logo_white.png b/dev/initdemo/documents_demo/medias/image/myimagesforemailing/dolicloud_logo_white.png new file mode 100644 index 00000000000..3632504200d Binary files /dev/null and b/dev/initdemo/documents_demo/medias/image/myimagesforemailing/dolicloud_logo_white.png differ diff --git a/dev/initdemo/documents_demo/produit/DOLICLOUD/dolicloud_logo.png b/dev/initdemo/documents_demo/produit/DOLICLOUD/dolicloud_logo.png new file mode 100644 index 00000000000..6cb078b8ef9 Binary files /dev/null and b/dev/initdemo/documents_demo/produit/DOLICLOUD/dolicloud_logo.png differ diff --git a/dev/initdemo/documents_demo/produit/DOLICLOUD/thumbs/dolicloud_logo_mini.png b/dev/initdemo/documents_demo/produit/DOLICLOUD/thumbs/dolicloud_logo_mini.png new file mode 100644 index 00000000000..fdaaedc73ce Binary files /dev/null and b/dev/initdemo/documents_demo/produit/DOLICLOUD/thumbs/dolicloud_logo_mini.png differ diff --git a/dev/initdemo/documents_demo/produit/DOLICLOUD/thumbs/dolicloud_logo_small.png b/dev/initdemo/documents_demo/produit/DOLICLOUD/thumbs/dolicloud_logo_small.png new file mode 100644 index 00000000000..948dc776a7f Binary files /dev/null and b/dev/initdemo/documents_demo/produit/DOLICLOUD/thumbs/dolicloud_logo_small.png differ diff --git a/dev/initdemo/documents_demo/societe/contact/10/eldy_php.jpg b/dev/initdemo/documents_demo/societe/contact/10/eldy_php.jpg new file mode 100644 index 00000000000..8ca631331f5 Binary files /dev/null and b/dev/initdemo/documents_demo/societe/contact/10/eldy_php.jpg differ diff --git a/dev/initdemo/documents_demo/societe/contact/10/photos/ldestailleur_200x200.jpg b/dev/initdemo/documents_demo/societe/contact/10/photos/ldestailleur_200x200.jpg new file mode 100644 index 00000000000..df68aa5f64f Binary files /dev/null and b/dev/initdemo/documents_demo/societe/contact/10/photos/ldestailleur_200x200.jpg differ diff --git a/dev/initdemo/documents_demo/societe/contact/10/photos/thumbs/ldestailleur_200x200_mini.jpg b/dev/initdemo/documents_demo/societe/contact/10/photos/thumbs/ldestailleur_200x200_mini.jpg new file mode 100644 index 00000000000..aca4a6e0586 Binary files /dev/null and b/dev/initdemo/documents_demo/societe/contact/10/photos/thumbs/ldestailleur_200x200_mini.jpg differ diff --git a/dev/initdemo/documents_demo/societe/contact/10/photos/thumbs/ldestailleur_200x200_small.jpg b/dev/initdemo/documents_demo/societe/contact/10/photos/thumbs/ldestailleur_200x200_small.jpg new file mode 100644 index 00000000000..266ee91d60a Binary files /dev/null and b/dev/initdemo/documents_demo/societe/contact/10/photos/thumbs/ldestailleur_200x200_small.jpg differ diff --git a/dev/initdemo/documents_demo/societe/contact/10/thumbs/eldy_php_mini.jpg b/dev/initdemo/documents_demo/societe/contact/10/thumbs/eldy_php_mini.jpg new file mode 100644 index 00000000000..b630d716d8d Binary files /dev/null and b/dev/initdemo/documents_demo/societe/contact/10/thumbs/eldy_php_mini.jpg differ diff --git a/dev/initdemo/documents_demo/societe/contact/10/thumbs/eldy_php_small.jpg b/dev/initdemo/documents_demo/societe/contact/10/thumbs/eldy_php_small.jpg new file mode 100644 index 00000000000..7da84194e18 Binary files /dev/null and b/dev/initdemo/documents_demo/societe/contact/10/thumbs/eldy_php_small.jpg differ diff --git a/dev/initdemo/documents_demo/supplier_proposal/RQ1607-0001/RQ1607-0001.pdf b/dev/initdemo/documents_demo/supplier_proposal/RQ1607-0001/RQ1607-0001.pdf new file mode 100644 index 00000000000..3bcf9d841c5 Binary files /dev/null and b/dev/initdemo/documents_demo/supplier_proposal/RQ1607-0001/RQ1607-0001.pdf differ diff --git a/dev/initdemo/documents_demo/users/9/1/eldy_php.jpg b/dev/initdemo/documents_demo/users/9/1/eldy_php.jpg new file mode 100644 index 00000000000..8ca631331f5 Binary files /dev/null and b/dev/initdemo/documents_demo/users/9/1/eldy_php.jpg differ diff --git a/dev/initdemo/documents_demo/users/9/1/thumbs/eldy_php_mini.jpg b/dev/initdemo/documents_demo/users/9/1/thumbs/eldy_php_mini.jpg new file mode 100644 index 00000000000..d7c66abb178 Binary files /dev/null and b/dev/initdemo/documents_demo/users/9/1/thumbs/eldy_php_mini.jpg differ diff --git a/dev/initdemo/documents_demo/users/9/1/thumbs/eldy_php_small.jpg b/dev/initdemo/documents_demo/users/9/1/thumbs/eldy_php_small.jpg new file mode 100644 index 00000000000..045d8372878 Binary files /dev/null and b/dev/initdemo/documents_demo/users/9/1/thumbs/eldy_php_small.jpg differ diff --git a/dev/initdemo/initdemo.sh b/dev/initdemo/initdemo.sh index 10dc671e09d..497d3abbf50 100755 --- a/dev/initdemo/initdemo.sh +++ b/dev/initdemo/initdemo.sh @@ -15,7 +15,7 @@ export mydir=`echo "$0" | sed -e 's/initdemo.sh//'`; -if [ "x$mydir" = "x" ] +if [ "x$mydir" = 'x' -o "x$mydir" = 'x./' ] then export mydir="." fi @@ -132,24 +132,7 @@ then exit;; esac - # ---------------------------- chemin d'acces du repertoire documents - #DIALOG=${DIALOG=dialog} - #fichtemp=`tempfile 2>/dev/null` || fichtemp=/tmp/test$$ - #trap "rm -f $fichtemp" 0 1 2 5 15 - #$DIALOG --title "Init Dolibarr with demo values" --clear \ - # --inputbox "Full path to documents directory (ex: /var/www/dolibarr/documents)- no / at end :" 16 55 2> $fichtemp - - #valret=$? - - #case $valret in - # 0) - #docs=`cat $fichtemp`;; - # 1) - #exit;; - # 255) - #exit;; - #esac - + # ---------------------------- confirmation DIALOG=${DIALOG=dialog} $DIALOG --title "Init Dolibarr with demo values" --clear \ @@ -177,6 +160,25 @@ echo "mysql -P$port -u$admin -p***** $base < $mydir/$dumpfile" mysql -P$port -u$admin $passwd $base < $mydir/$dumpfile export res=$? + +# ---------------------------- copy demo files +export documentdir=`cat $mydir/../../htdocs/conf/conf.php | grep '^\$dolibarr_main_data_root' | sed -e 's/$dolibarr_main_data_root=//' | sed -e 's/;//' | sed -e "s/'//g" ` +if [ "x$documentdir" != "x" ] +then + echo cp -pr $mydir/documents_demo/* "$documentdir/" + cp -pr $mydir/documents_demo/* "$documentdir/" + echo cp -pr $mydir/../../htdocs/install/doctemplates/* "$documentdir/doctemplates/" + cp -pr $mydir/../../htdocs/install/doctemplates/* "$documentdir/doctemplates/" + mkdir -p "$documentdir/ecm/Administrative documents" + mkdir -p "$documentdir/ecm/Images" + echo cp -pr $mydir/../../doc/images/* "$documentdir/ecm/Images" + cp -pr $mydir/../../doc/images/* "$documentdir/ecm/Images" +else + echo Detection of documents directory failed so demo files were not copied. +fi + + + if [ "x$res" = "x0" ] then echo "Success, file successfully loaded." diff --git a/dev/initdemo/mysqldump_dolibarr_4.0.0.sql b/dev/initdemo/mysqldump_dolibarr_4.0.0.sql new file mode 100644 index 00000000000..e8580cdff28 --- /dev/null +++ b/dev/initdemo/mysqldump_dolibarr_4.0.0.sql @@ -0,0 +1,8576 @@ +-- MySQL dump 10.13 Distrib 5.5.50, for debian-linux-gnu (x86_64) +-- +-- Host: localhost Database: dolibarr_4 +-- ------------------------------------------------------ +-- Server version 5.5.50-0ubuntu0.14.04.1 + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- +-- Table structure for table `llx_accounting_account` +-- + +DROP TABLE IF EXISTS `llx_accounting_account`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_accounting_account` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `entity` int(11) NOT NULL DEFAULT '1', + `datec` datetime DEFAULT NULL, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `fk_pcg_version` varchar(32) DEFAULT NULL, + `pcg_type` varchar(20) NOT NULL, + `pcg_subtype` varchar(20) NOT NULL, + `account_number` varchar(32) DEFAULT NULL, + `account_parent` int(11) DEFAULT '0', + `label` varchar(255) DEFAULT NULL, + `fk_accounting_category` int(11) DEFAULT '0', + `fk_user_author` int(11) DEFAULT NULL, + `fk_user_modif` int(11) DEFAULT NULL, + `active` tinyint(4) NOT NULL DEFAULT '1', + PRIMARY KEY (`rowid`), + KEY `idx_accountingaccount_fk_pcg_version` (`fk_pcg_version`), + KEY `idx_accounting_account_account_number` (`account_number`), + CONSTRAINT `fk_accountingaccount_fk_pcg_version` FOREIGN KEY (`fk_pcg_version`) REFERENCES `llx_accounting_system` (`pcg_version`) +) ENGINE=InnoDB AUTO_INCREMENT=4785 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_accounting_account` +-- + +LOCK TABLES `llx_accounting_account` WRITE; +/*!40000 ALTER TABLE `llx_accounting_account` DISABLE KEYS */; +INSERT INTO `llx_accounting_account` VALUES (1,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','CAPIT','CAPITAL','101',1401,'Capital',0,NULL,NULL,1),(2,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','CAPIT','XXXXXX','105',1401,'Ecarts de réévaluation',0,NULL,NULL,1),(3,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','CAPIT','XXXXXX','1061',1401,'Réserve légale',0,NULL,NULL,1),(4,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','CAPIT','XXXXXX','1063',1401,'Réserves statutaires ou contractuelles',0,NULL,NULL,1),(5,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','CAPIT','XXXXXX','1064',1401,'Réserves réglementées',0,NULL,NULL,1),(6,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','CAPIT','XXXXXX','1068',1401,'Autres réserves',0,NULL,NULL,1),(7,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','CAPIT','XXXXXX','108',1401,'Compte de l\'exploitant',0,NULL,NULL,1),(8,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','CAPIT','XXXXXX','12',1401,'Résultat de l\'exercice',0,NULL,NULL,1),(9,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','CAPIT','XXXXXX','145',1401,'Amortissements dérogatoires',0,NULL,NULL,1),(10,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','CAPIT','XXXXXX','146',1401,'Provision spéciale de réévaluation',0,NULL,NULL,1),(11,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','CAPIT','XXXXXX','147',1401,'Plus-values réinvesties',0,NULL,NULL,1),(12,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','CAPIT','XXXXXX','148',1401,'Autres provisions réglementées',0,NULL,NULL,1),(13,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','CAPIT','XXXXXX','15',1401,'Provisions pour risques et charges',0,NULL,NULL,1),(14,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','CAPIT','XXXXXX','16',1401,'Emprunts et dettes assimilees',0,NULL,NULL,1),(15,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','IMMO','XXXXXX','20',1402,'Immobilisations incorporelles',0,NULL,NULL,1),(16,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','IMMO','XXXXXX','201',15,'Frais d\'établissement',0,NULL,NULL,1),(17,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','IMMO','XXXXXX','206',15,'Droit au bail',0,NULL,NULL,1),(18,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','IMMO','XXXXXX','207',15,'Fonds commercial',0,NULL,NULL,1),(19,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','IMMO','XXXXXX','208',15,'Autres immobilisations incorporelles',0,NULL,NULL,1),(20,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','IMMO','XXXXXX','21',1402,'Immobilisations corporelles',0,NULL,NULL,1),(21,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','IMMO','XXXXXX','23',1402,'Immobilisations en cours',0,NULL,NULL,1),(22,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','IMMO','XXXXXX','27',1402,'Autres immobilisations financieres',0,NULL,NULL,1),(23,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','IMMO','XXXXXX','280',1402,'Amortissements des immobilisations incorporelles',0,NULL,NULL,1),(24,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','IMMO','XXXXXX','281',1402,'Amortissements des immobilisations corporelles',0,NULL,NULL,1),(25,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','IMMO','XXXXXX','290',1402,'Provisions pour dépréciation des immobilisations incorporelles',0,NULL,NULL,1),(26,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','IMMO','XXXXXX','291',1402,'Provisions pour dépréciation des immobilisations corporelles',0,NULL,NULL,1),(27,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','IMMO','XXXXXX','297',1402,'Provisions pour dépréciation des autres immobilisations financières',0,NULL,NULL,1),(28,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','STOCK','XXXXXX','31',1403,'Matieres premières',0,NULL,NULL,1),(29,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','STOCK','XXXXXX','32',1403,'Autres approvisionnements',0,NULL,NULL,1),(30,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','STOCK','XXXXXX','33',1403,'En-cours de production de biens',0,NULL,NULL,1),(31,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','STOCK','XXXXXX','34',1403,'En-cours de production de services',0,NULL,NULL,1),(32,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','STOCK','XXXXXX','35',1403,'Stocks de produits',0,NULL,NULL,1),(33,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','STOCK','XXXXXX','37',1403,'Stocks de marchandises',0,NULL,NULL,1),(34,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','STOCK','XXXXXX','391',1403,'Provisions pour dépréciation des matières premières',0,NULL,NULL,1),(35,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','STOCK','XXXXXX','392',1403,'Provisions pour dépréciation des autres approvisionnements',0,NULL,NULL,1),(36,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','STOCK','XXXXXX','393',1403,'Provisions pour dépréciation des en-cours de production de biens',0,NULL,NULL,1),(37,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','STOCK','XXXXXX','394',1403,'Provisions pour dépréciation des en-cours de production de services',0,NULL,NULL,1),(38,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','STOCK','XXXXXX','395',1403,'Provisions pour dépréciation des stocks de produits',0,NULL,NULL,1),(39,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','STOCK','XXXXXX','397',1403,'Provisions pour dépréciation des stocks de marchandises',0,NULL,NULL,1),(40,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','TIERS','SUPPLIER','400',1404,'Fournisseurs et Comptes rattachés',0,NULL,NULL,1),(41,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','TIERS','XXXXXX','409',1404,'Fournisseurs débiteurs',0,NULL,NULL,1),(42,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','TIERS','CUSTOMER','410',1404,'Clients et Comptes rattachés',0,NULL,NULL,1),(43,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','TIERS','XXXXXX','419',1404,'Clients créditeurs',0,NULL,NULL,1),(44,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','TIERS','XXXXXX','421',1404,'Personnel',0,NULL,NULL,1),(45,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','TIERS','XXXXXX','428',1404,'Personnel',0,NULL,NULL,1),(46,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','TIERS','XXXXXX','43',1404,'Sécurité sociale et autres organismes sociaux',0,NULL,NULL,1),(47,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','TIERS','XXXXXX','444',1404,'Etat - impôts sur bénéfice',0,NULL,NULL,1),(48,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','TIERS','XXXXXX','445',1404,'Etat - Taxes sur chiffre affaires',0,NULL,NULL,1),(49,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','TIERS','XXXXXX','447',1404,'Autres impôts, taxes et versements assimilés',0,NULL,NULL,1),(50,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','TIERS','XXXXXX','45',1404,'Groupe et associes',0,NULL,NULL,1),(51,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','TIERS','XXXXXX','455',50,'Associés',0,NULL,NULL,1),(52,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','TIERS','XXXXXX','46',1404,'Débiteurs divers et créditeurs divers',0,NULL,NULL,1),(53,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','TIERS','XXXXXX','47',1404,'Comptes transitoires ou d\'attente',0,NULL,NULL,1),(54,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','TIERS','XXXXXX','481',1404,'Charges à répartir sur plusieurs exercices',0,NULL,NULL,1),(55,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','TIERS','XXXXXX','486',1404,'Charges constatées d\'avance',0,NULL,NULL,1),(56,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','TIERS','XXXXXX','487',1404,'Produits constatés d\'avance',0,NULL,NULL,1),(57,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','TIERS','XXXXXX','491',1404,'Provisions pour dépréciation des comptes de clients',0,NULL,NULL,1),(58,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','TIERS','XXXXXX','496',1404,'Provisions pour dépréciation des comptes de débiteurs divers',0,NULL,NULL,1),(59,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','FINAN','XXXXXX','50',1405,'Valeurs mobilières de placement',0,NULL,NULL,1),(60,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','FINAN','BANK','51',1405,'Banques, établissements financiers et assimilés',0,NULL,NULL,1),(61,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','FINAN','CASH','53',1405,'Caisse',0,NULL,NULL,1),(62,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','FINAN','XXXXXX','54',1405,'Régies d\'avance et accréditifs',0,NULL,NULL,1),(63,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','FINAN','XXXXXX','58',1405,'Virements internes',0,NULL,NULL,1),(64,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','FINAN','XXXXXX','590',1405,'Provisions pour dépréciation des valeurs mobilières de placement',0,NULL,NULL,1),(65,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','CHARGE','PRODUCT','60',1406,'Achats',0,NULL,NULL,1),(66,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','CHARGE','XXXXXX','603',65,'Variations des stocks',0,NULL,NULL,1),(67,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','CHARGE','SERVICE','61',1406,'Services extérieurs',0,NULL,NULL,1),(68,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','CHARGE','XXXXXX','62',1406,'Autres services extérieurs',0,NULL,NULL,1),(69,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','CHARGE','XXXXXX','63',1406,'Impôts, taxes et versements assimiles',0,NULL,NULL,1),(70,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','CHARGE','XXXXXX','641',1406,'Rémunérations du personnel',0,NULL,NULL,1),(71,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','CHARGE','XXXXXX','644',1406,'Rémunération du travail de l\'exploitant',0,NULL,NULL,1),(72,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','CHARGE','SOCIAL','645',1406,'Charges de sécurité sociale et de prévoyance',0,NULL,NULL,1),(73,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','CHARGE','XXXXXX','646',1406,'Cotisations sociales personnelles de l\'exploitant',0,NULL,NULL,1),(74,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','CHARGE','XXXXXX','65',1406,'Autres charges de gestion courante',0,NULL,NULL,1),(75,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','CHARGE','XXXXXX','66',1406,'Charges financières',0,NULL,NULL,1),(76,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','CHARGE','XXXXXX','67',1406,'Charges exceptionnelles',0,NULL,NULL,1),(77,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','CHARGE','XXXXXX','681',1406,'Dotations aux amortissements et aux provisions',0,NULL,NULL,1),(78,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','CHARGE','XXXXXX','686',1406,'Dotations aux amortissements et aux provisions',0,NULL,NULL,1),(79,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','CHARGE','XXXXXX','687',1406,'Dotations aux amortissements et aux provisions',0,NULL,NULL,1),(80,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','CHARGE','XXXXXX','691',1406,'Participation des salariés aux résultats',0,NULL,NULL,1),(81,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','CHARGE','XXXXXX','695',1406,'Impôts sur les bénéfices',0,NULL,NULL,1),(82,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','CHARGE','XXXXXX','697',1406,'Imposition forfaitaire annuelle des sociétés',0,NULL,NULL,1),(83,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','CHARGE','XXXXXX','699',1406,'Produits',0,NULL,NULL,1),(84,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','PROD','PRODUCT','701',1407,'Ventes de produits finis',0,NULL,NULL,1),(85,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','PROD','SERVICE','706',1407,'Prestations de services',0,NULL,NULL,1),(86,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','PROD','PRODUCT','707',1407,'Ventes de marchandises',0,NULL,NULL,1),(87,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','PROD','PRODUCT','708',1407,'Produits des activités annexes',0,NULL,NULL,1),(88,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','PROD','XXXXXX','709',1407,'Rabais, remises et ristournes accordés par l\'entreprise',0,NULL,NULL,1),(89,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','PROD','XXXXXX','713',1407,'Variation des stocks',0,NULL,NULL,1),(90,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','PROD','XXXXXX','72',1407,'Production immobilisée',0,NULL,NULL,1),(91,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','PROD','XXXXXX','73',1407,'Produits nets partiels sur opérations à long terme',0,NULL,NULL,1),(92,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','PROD','XXXXXX','74',1407,'Subventions d\'exploitation',0,NULL,NULL,1),(93,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','PROD','XXXXXX','75',1407,'Autres produits de gestion courante',0,NULL,NULL,1),(94,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','PROD','XXXXXX','753',93,'Jetons de présence et rémunérations d\'administrateurs, gérants,...',0,NULL,NULL,1),(95,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','PROD','XXXXXX','754',93,'Ristournes perçues des coopératives',0,NULL,NULL,1),(96,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','PROD','XXXXXX','755',93,'Quotes-parts de résultat sur opérations faites en commun',0,NULL,NULL,1),(97,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','PROD','XXXXXX','76',1407,'Produits financiers',0,NULL,NULL,1),(98,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','PROD','XXXXXX','77',1407,'Produits exceptionnels',0,NULL,NULL,1),(99,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','PROD','XXXXXX','781',1407,'Reprises sur amortissements et provisions',0,NULL,NULL,1),(100,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','PROD','XXXXXX','786',1407,'Reprises sur provisions pour risques',0,NULL,NULL,1),(101,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','PROD','XXXXXX','787',1407,'Reprises sur provisions',0,NULL,NULL,1),(102,1,NULL,'2016-01-22 17:28:15','PCG99-ABREGE','PROD','XXXXXX','79',1407,'Transferts de charges',0,NULL,NULL,1),(103,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CAPIT','XXXXXX','10',1501,'Capital et réserves',0,NULL,NULL,1),(104,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CAPIT','CAPITAL','101',103,'Capital',0,NULL,NULL,1),(105,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CAPIT','XXXXXX','104',103,'Primes liées au capital social',0,NULL,NULL,1),(106,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CAPIT','XXXXXX','105',103,'Ecarts de réévaluation',0,NULL,NULL,1),(107,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CAPIT','XXXXXX','106',103,'Réserves',0,NULL,NULL,1),(108,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CAPIT','XXXXXX','107',103,'Ecart d\'equivalence',0,NULL,NULL,1),(109,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CAPIT','XXXXXX','108',103,'Compte de l\'exploitant',0,NULL,NULL,1),(110,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CAPIT','XXXXXX','109',103,'Actionnaires : capital souscrit - non appelé',0,NULL,NULL,1),(111,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CAPIT','XXXXXX','11',1501,'Report à nouveau (solde créditeur ou débiteur)',0,NULL,NULL,1),(112,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CAPIT','XXXXXX','110',111,'Report à nouveau (solde créditeur)',0,NULL,NULL,1),(113,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CAPIT','XXXXXX','119',111,'Report à nouveau (solde débiteur)',0,NULL,NULL,1),(114,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CAPIT','XXXXXX','12',1501,'Résultat de l\'exercice (bénéfice ou perte)',0,NULL,NULL,1),(115,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CAPIT','XXXXXX','120',114,'Résultat de l\'exercice (bénéfice)',0,NULL,NULL,1),(116,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CAPIT','XXXXXX','129',114,'Résultat de l\'exercice (perte)',0,NULL,NULL,1),(117,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CAPIT','XXXXXX','13',1501,'Subventions d\'investissement',0,NULL,NULL,1),(118,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CAPIT','XXXXXX','131',117,'Subventions d\'équipement',0,NULL,NULL,1),(119,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CAPIT','XXXXXX','138',117,'Autres subventions d\'investissement',0,NULL,NULL,1),(120,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CAPIT','XXXXXX','139',117,'Subventions d\'investissement inscrites au compte de résultat',0,NULL,NULL,1),(121,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CAPIT','XXXXXX','14',1501,'Provisions réglementées',0,NULL,NULL,1),(122,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CAPIT','XXXXXX','142',121,'Provisions réglementées relatives aux immobilisations',0,NULL,NULL,1),(123,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CAPIT','XXXXXX','143',121,'Provisions réglementées relatives aux stocks',0,NULL,NULL,1),(124,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CAPIT','XXXXXX','144',121,'Provisions réglementées relatives aux autres éléments de l\'actif',0,NULL,NULL,1),(125,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CAPIT','XXXXXX','145',121,'Amortissements dérogatoires',0,NULL,NULL,1),(126,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CAPIT','XXXXXX','146',121,'Provision spéciale de réévaluation',0,NULL,NULL,1),(127,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CAPIT','XXXXXX','147',121,'Plus-values réinvesties',0,NULL,NULL,1),(128,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CAPIT','XXXXXX','148',121,'Autres provisions réglementées',0,NULL,NULL,1),(129,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CAPIT','XXXXXX','15',1501,'Provisions pour risques et charges',0,NULL,NULL,1),(130,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CAPIT','XXXXXX','151',129,'Provisions pour risques',0,NULL,NULL,1),(131,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CAPIT','XXXXXX','153',129,'Provisions pour pensions et obligations similaires',0,NULL,NULL,1),(132,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CAPIT','XXXXXX','154',129,'Provisions pour restructurations',0,NULL,NULL,1),(133,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CAPIT','XXXXXX','155',129,'Provisions pour impôts',0,NULL,NULL,1),(134,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CAPIT','XXXXXX','156',129,'Provisions pour renouvellement des immobilisations (entreprises concessionnaires)',0,NULL,NULL,1),(135,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CAPIT','XXXXXX','157',129,'Provisions pour charges à répartir sur plusieurs exercices',0,NULL,NULL,1),(136,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CAPIT','XXXXXX','158',129,'Autres provisions pour charges',0,NULL,NULL,1),(137,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CAPIT','XXXXXX','16',1501,'Emprunts et dettes assimilees',0,NULL,NULL,1),(138,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CAPIT','XXXXXX','161',137,'Emprunts obligataires convertibles',0,NULL,NULL,1),(139,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CAPIT','XXXXXX','163',137,'Autres emprunts obligataires',0,NULL,NULL,1),(140,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CAPIT','XXXXXX','164',137,'Emprunts auprès des établissements de crédit',0,NULL,NULL,1),(141,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CAPIT','XXXXXX','165',137,'Dépôts et cautionnements reçus',0,NULL,NULL,1),(142,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CAPIT','XXXXXX','166',137,'Participation des salariés aux résultats',0,NULL,NULL,1),(143,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CAPIT','XXXXXX','167',137,'Emprunts et dettes assortis de conditions particulières',0,NULL,NULL,1),(144,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CAPIT','XXXXXX','168',137,'Autres emprunts et dettes assimilées',0,NULL,NULL,1),(145,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CAPIT','XXXXXX','169',137,'Primes de remboursement des obligations',0,NULL,NULL,1),(146,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CAPIT','XXXXXX','17',1501,'Dettes rattachées à des participations',0,NULL,NULL,1),(147,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CAPIT','XXXXXX','171',146,'Dettes rattachées à des participations (groupe)',0,NULL,NULL,1),(148,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CAPIT','XXXXXX','174',146,'Dettes rattachées à des participations (hors groupe)',0,NULL,NULL,1),(149,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CAPIT','XXXXXX','178',146,'Dettes rattachées à des sociétés en participation',0,NULL,NULL,1),(150,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CAPIT','XXXXXX','18',1501,'Comptes de liaison des établissements et sociétés en participation',0,NULL,NULL,1),(151,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CAPIT','XXXXXX','181',150,'Comptes de liaison des établissements',0,NULL,NULL,1),(152,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CAPIT','XXXXXX','186',150,'Biens et prestations de services échangés entre établissements (charges)',0,NULL,NULL,1),(153,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CAPIT','XXXXXX','187',150,'Biens et prestations de services échangés entre établissements (produits)',0,NULL,NULL,1),(154,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CAPIT','XXXXXX','188',150,'Comptes de liaison des sociétés en participation',0,NULL,NULL,1),(155,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','IMMO','XXXXXX','20',1502,'Immobilisations incorporelles',0,NULL,NULL,1),(156,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','IMMO','XXXXXX','201',155,'Frais d\'établissement',0,NULL,NULL,1),(157,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','IMMO','XXXXXX','203',155,'Frais de recherche et de développement',0,NULL,NULL,1),(158,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','IMMO','XXXXXX','205',155,'Concessions et droits similaires, brevets, licences, marques, procédés, logiciels, droits et valeurs similaires',0,NULL,NULL,1),(159,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','IMMO','XXXXXX','206',155,'Droit au bail',0,NULL,NULL,1),(160,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','IMMO','XXXXXX','207',155,'Fonds commercial',0,NULL,NULL,1),(161,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','IMMO','XXXXXX','208',155,'Autres immobilisations incorporelles',0,NULL,NULL,1),(162,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','IMMO','XXXXXX','21',1502,'Immobilisations corporelles',0,NULL,NULL,1),(163,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','IMMO','XXXXXX','211',162,'Terrains',0,NULL,NULL,1),(164,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','IMMO','XXXXXX','212',162,'Agencements et aménagements de terrains',0,NULL,NULL,1),(165,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','IMMO','XXXXXX','213',162,'Constructions',0,NULL,NULL,1),(166,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','IMMO','XXXXXX','214',162,'Constructions sur sol d\'autrui',0,NULL,NULL,1),(167,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','IMMO','XXXXXX','215',162,'Installations techniques, matériels et outillage industriels',0,NULL,NULL,1),(168,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','IMMO','XXXXXX','218',162,'Autres immobilisations corporelles',0,NULL,NULL,1),(169,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','IMMO','XXXXXX','22',1502,'Immobilisations mises en concession',0,NULL,NULL,1),(170,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','IMMO','XXXXXX','23',1502,'Immobilisations en cours',0,NULL,NULL,1),(171,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','IMMO','XXXXXX','231',170,'Immobilisations corporelles en cours',0,NULL,NULL,1),(172,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','IMMO','XXXXXX','232',170,'Immobilisations incorporelles en cours',0,NULL,NULL,1),(173,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','IMMO','XXXXXX','237',170,'Avances et acomptes versés sur immobilisations incorporelles',0,NULL,NULL,1),(174,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','IMMO','XXXXXX','238',170,'Avances et acomptes versés sur commandes d\'immobilisations corporelles',0,NULL,NULL,1),(175,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','IMMO','XXXXXX','25',1502,'Parts dans des entreprises liées et créances sur des entreprises liées',0,NULL,NULL,1),(176,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','IMMO','XXXXXX','26',1502,'Participations et créances rattachées à des participations',0,NULL,NULL,1),(177,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','IMMO','XXXXXX','261',176,'Titres de participation',0,NULL,NULL,1),(178,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','IMMO','XXXXXX','266',176,'Autres formes de participation',0,NULL,NULL,1),(179,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','IMMO','XXXXXX','267',176,'Créances rattachées à des participations',0,NULL,NULL,1),(180,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','IMMO','XXXXXX','268',176,'Créances rattachées à des sociétés en participation',0,NULL,NULL,1),(181,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','IMMO','XXXXXX','269',176,'Versements restant à effectuer sur titres de participation non libérés',0,NULL,NULL,1),(182,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','IMMO','XXXXXX','27',1502,'Autres immobilisations financieres',0,NULL,NULL,1),(183,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','IMMO','XXXXXX','271',183,'Titres immobilisés autres que les titres immobilisés de l\'activité de portefeuille (droit de propriété)',0,NULL,NULL,1),(184,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','IMMO','XXXXXX','272',183,'Titres immobilisés (droit de créance)',0,NULL,NULL,1),(185,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','IMMO','XXXXXX','273',183,'Titres immobilisés de l\'activité de portefeuille',0,NULL,NULL,1),(186,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','IMMO','XXXXXX','274',183,'Prêts',0,NULL,NULL,1),(187,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','IMMO','XXXXXX','275',183,'Dépôts et cautionnements versés',0,NULL,NULL,1),(188,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','IMMO','XXXXXX','276',183,'Autres créances immobilisées',0,NULL,NULL,1),(189,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','IMMO','XXXXXX','277',183,'(Actions propres ou parts propres)',0,NULL,NULL,1),(190,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','IMMO','XXXXXX','279',183,'Versements restant à effectuer sur titres immobilisés non libérés',0,NULL,NULL,1),(191,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','IMMO','XXXXXX','28',1502,'Amortissements des immobilisations',0,NULL,NULL,1),(192,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','IMMO','XXXXXX','280',191,'Amortissements des immobilisations incorporelles',0,NULL,NULL,1),(193,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','IMMO','XXXXXX','281',191,'Amortissements des immobilisations corporelles',0,NULL,NULL,1),(194,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','IMMO','XXXXXX','282',191,'Amortissements des immobilisations mises en concession',0,NULL,NULL,1),(195,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','IMMO','XXXXXX','29',1502,'Dépréciations des immobilisations',0,NULL,NULL,1),(196,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','IMMO','XXXXXX','290',195,'Dépréciations des immobilisations incorporelles',0,NULL,NULL,1),(197,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','IMMO','XXXXXX','291',195,'Dépréciations des immobilisations corporelles',0,NULL,NULL,1),(198,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','IMMO','XXXXXX','292',195,'Dépréciations des immobilisations mises en concession',0,NULL,NULL,1),(199,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','IMMO','XXXXXX','293',195,'Dépréciations des immobilisations en cours',0,NULL,NULL,1),(200,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','IMMO','XXXXXX','296',195,'Provisions pour dépréciation des participations et créances rattachées à des participations',0,NULL,NULL,1),(201,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','IMMO','XXXXXX','297',195,'Provisions pour dépréciation des autres immobilisations financières',0,NULL,NULL,1),(202,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','STOCK','XXXXXX','31',1503,'Matières premières (et fournitures)',0,NULL,NULL,1),(203,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','STOCK','XXXXXX','311',202,'Matières (ou groupe) A',0,NULL,NULL,1),(204,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','STOCK','XXXXXX','312',202,'Matières (ou groupe) B',0,NULL,NULL,1),(205,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','STOCK','XXXXXX','317',202,'Fournitures A, B, C,',0,NULL,NULL,1),(206,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','STOCK','XXXXXX','32',1503,'Autres approvisionnements',0,NULL,NULL,1),(207,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','STOCK','XXXXXX','321',206,'Matières consommables',0,NULL,NULL,1),(208,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','STOCK','XXXXXX','322',206,'Fournitures consommables',0,NULL,NULL,1),(209,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','STOCK','XXXXXX','326',206,'Emballages',0,NULL,NULL,1),(210,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','STOCK','XXXXXX','33',1503,'En-cours de production de biens',0,NULL,NULL,1),(211,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','STOCK','XXXXXX','331',210,'Produits en cours',0,NULL,NULL,1),(212,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','STOCK','XXXXXX','335',210,'Travaux en cours',0,NULL,NULL,1),(213,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','STOCK','XXXXXX','34',1503,'En-cours de production de services',0,NULL,NULL,1),(214,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','STOCK','XXXXXX','341',213,'Etudes en cours',0,NULL,NULL,1),(215,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','STOCK','XXXXXX','345',213,'Prestations de services en cours',0,NULL,NULL,1),(216,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','STOCK','XXXXXX','35',1503,'Stocks de produits',0,NULL,NULL,1),(217,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','STOCK','XXXXXX','351',216,'Produits intermédiaires',0,NULL,NULL,1),(218,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','STOCK','XXXXXX','355',216,'Produits finis',0,NULL,NULL,1),(219,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','STOCK','XXXXXX','358',216,'Produits résiduels (ou matières de récupération)',0,NULL,NULL,1),(220,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','STOCK','XXXXXX','37',1503,'Stocks de marchandises',0,NULL,NULL,1),(221,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','STOCK','XXXXXX','371',220,'Marchandises (ou groupe) A',0,NULL,NULL,1),(222,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','STOCK','XXXXXX','372',220,'Marchandises (ou groupe) B',0,NULL,NULL,1),(223,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','STOCK','XXXXXX','39',1503,'Provisions pour dépréciation des stocks et en-cours',0,NULL,NULL,1),(224,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','STOCK','XXXXXX','391',223,'Provisions pour dépréciation des matières premières',0,NULL,NULL,1),(225,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','STOCK','XXXXXX','392',223,'Provisions pour dépréciation des autres approvisionnements',0,NULL,NULL,1),(226,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','STOCK','XXXXXX','393',223,'Provisions pour dépréciation des en-cours de production de biens',0,NULL,NULL,1),(227,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','STOCK','XXXXXX','394',223,'Provisions pour dépréciation des en-cours de production de services',0,NULL,NULL,1),(228,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','STOCK','XXXXXX','395',223,'Provisions pour dépréciation des stocks de produits',0,NULL,NULL,1),(229,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','STOCK','XXXXXX','397',223,'Provisions pour dépréciation des stocks de marchandises',0,NULL,NULL,1),(230,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','TIERS','XXXXXX','40',1504,'Fournisseurs et Comptes rattachés',0,NULL,NULL,1),(231,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','TIERS','XXXXXX','400',230,'Fournisseurs et Comptes rattachés',0,NULL,NULL,1),(232,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','TIERS','SUPPLIER','401',230,'Fournisseurs',0,NULL,NULL,1),(233,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','TIERS','XXXXXX','403',230,'Fournisseurs - Effets à payer',0,NULL,NULL,1),(234,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','TIERS','XXXXXX','404',230,'Fournisseurs d\'immobilisations',0,NULL,NULL,1),(235,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','TIERS','XXXXXX','405',230,'Fournisseurs d\'immobilisations - Effets à payer',0,NULL,NULL,1),(236,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','TIERS','XXXXXX','408',230,'Fournisseurs - Factures non parvenues',0,NULL,NULL,1),(237,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','TIERS','XXXXXX','409',230,'Fournisseurs débiteurs',0,NULL,NULL,1),(238,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','TIERS','XXXXXX','41',1504,'Clients et comptes rattachés',0,NULL,NULL,1),(239,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','TIERS','XXXXXX','410',238,'Clients et Comptes rattachés',0,NULL,NULL,1),(240,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','TIERS','CUSTOMER','411',238,'Clients',0,NULL,NULL,1),(241,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','TIERS','XXXXXX','413',238,'Clients - Effets à recevoir',0,NULL,NULL,1),(242,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','TIERS','XXXXXX','416',238,'Clients douteux ou litigieux',0,NULL,NULL,1),(243,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','TIERS','XXXXXX','418',238,'Clients - Produits non encore facturés',0,NULL,NULL,1),(244,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','TIERS','XXXXXX','419',238,'Clients créditeurs',0,NULL,NULL,1),(245,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','TIERS','XXXXXX','42',1504,'Personnel et comptes rattachés',0,NULL,NULL,1),(246,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','TIERS','XXXXXX','421',245,'Personnel - Rémunérations dues',0,NULL,NULL,1),(247,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','TIERS','XXXXXX','422',245,'Comités d\'entreprises, d\'établissement, ...',0,NULL,NULL,1),(248,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','TIERS','XXXXXX','424',245,'Participation des salariés aux résultats',0,NULL,NULL,1),(249,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','TIERS','XXXXXX','425',245,'Personnel - Avances et acomptes',0,NULL,NULL,1),(250,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','TIERS','XXXXXX','426',245,'Personnel - Dépôts',0,NULL,NULL,1),(251,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','TIERS','XXXXXX','427',245,'Personnel - Oppositions',0,NULL,NULL,1),(252,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','TIERS','XXXXXX','428',245,'Personnel - Charges à payer et produits à recevoir',0,NULL,NULL,1),(253,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','TIERS','XXXXXX','43',1504,'Sécurité sociale et autres organismes sociaux',0,NULL,NULL,1),(254,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','TIERS','XXXXXX','431',253,'Sécurité sociale',0,NULL,NULL,1),(255,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','TIERS','XXXXXX','437',253,'Autres organismes sociaux',0,NULL,NULL,1),(256,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','TIERS','XXXXXX','438',253,'Organismes sociaux - Charges à payer et produits à recevoir',0,NULL,NULL,1),(257,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','TIERS','XXXXXX','44',1504,'État et autres collectivités publiques',0,NULL,NULL,1),(258,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','TIERS','XXXXXX','441',257,'État - Subventions à recevoir',0,NULL,NULL,1),(259,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','TIERS','XXXXXX','442',257,'Etat - Impôts et taxes recouvrables sur des tiers',0,NULL,NULL,1),(260,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','TIERS','XXXXXX','443',257,'Opérations particulières avec l\'Etat, les collectivités publiques, les organismes internationaux',0,NULL,NULL,1),(261,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','TIERS','XXXXXX','444',257,'Etat - Impôts sur les bénéfices',0,NULL,NULL,1),(262,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','TIERS','XXXXXX','445',257,'Etat - Taxes sur le chiffre d\'affaires',0,NULL,NULL,1),(263,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','TIERS','XXXXXX','446',257,'Obligations cautionnées',0,NULL,NULL,1),(264,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','TIERS','XXXXXX','447',257,'Autres impôts, taxes et versements assimilés',0,NULL,NULL,1),(265,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','TIERS','XXXXXX','448',257,'Etat - Charges à payer et produits à recevoir',0,NULL,NULL,1),(266,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','TIERS','XXXXXX','449',257,'Quotas d\'émission à restituer à l\'Etat',0,NULL,NULL,1),(267,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','TIERS','XXXXXX','45',1504,'Groupe et associes',0,NULL,NULL,1),(268,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','TIERS','XXXXXX','451',267,'Groupe',0,NULL,NULL,1),(269,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','TIERS','XXXXXX','455',267,'Associés - Comptes courants',0,NULL,NULL,1),(270,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','TIERS','XXXXXX','456',267,'Associés - Opérations sur le capital',0,NULL,NULL,1),(271,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','TIERS','XXXXXX','457',267,'Associés - Dividendes à payer',0,NULL,NULL,1),(272,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','TIERS','XXXXXX','458',267,'Associés - Opérations faites en commun et en G.I.E.',0,NULL,NULL,1),(273,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','TIERS','XXXXXX','46',1504,'Débiteurs divers et créditeurs divers',0,NULL,NULL,1),(274,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','TIERS','XXXXXX','462',273,'Créances sur cessions d\'immobilisations',0,NULL,NULL,1),(275,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','TIERS','XXXXXX','464',273,'Dettes sur acquisitions de valeurs mobilières de placement',0,NULL,NULL,1),(276,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','TIERS','XXXXXX','465',273,'Créances sur cessions de valeurs mobilières de placement',0,NULL,NULL,1),(277,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','TIERS','XXXXXX','467',273,'Autres comptes débiteurs ou créditeurs',0,NULL,NULL,1),(278,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','TIERS','XXXXXX','468',273,'Divers - Charges à payer et produits à recevoir',0,NULL,NULL,1),(279,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','TIERS','XXXXXX','47',1504,'Comptes transitoires ou d\'attente',0,NULL,NULL,1),(280,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','TIERS','XXXXXX','471',279,'Comptes d\'attente',0,NULL,NULL,1),(281,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','TIERS','XXXXXX','476',279,'Différence de conversion - Actif',0,NULL,NULL,1),(282,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','TIERS','XXXXXX','477',279,'Différences de conversion - Passif',0,NULL,NULL,1),(283,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','TIERS','XXXXXX','478',279,'Autres comptes transitoires',0,NULL,NULL,1),(284,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','TIERS','XXXXXX','48',1504,'Comptes de régularisation',0,NULL,NULL,1),(285,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','TIERS','XXXXXX','481',284,'Charges à répartir sur plusieurs exercices',0,NULL,NULL,1),(286,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','TIERS','XXXXXX','486',284,'Charges constatées d\'avance',0,NULL,NULL,1),(287,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','TIERS','XXXXXX','487',284,'Produits constatés d\'avance',0,NULL,NULL,1),(288,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','TIERS','XXXXXX','488',284,'Comptes de répartition périodique des charges et des produits',0,NULL,NULL,1),(289,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','TIERS','XXXXXX','489',284,'Quotas d\'émission alloués par l\'Etat',0,NULL,NULL,1),(290,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','TIERS','XXXXXX','49',1504,'Provisions pour dépréciation des comptes de tiers',0,NULL,NULL,1),(291,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','TIERS','XXXXXX','491',290,'Provisions pour dépréciation des comptes de clients',0,NULL,NULL,1),(292,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','TIERS','XXXXXX','495',290,'Provisions pour dépréciation des comptes du groupe et des associés',0,NULL,NULL,1),(293,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','TIERS','XXXXXX','496',290,'Provisions pour dépréciation des comptes de débiteurs divers',0,NULL,NULL,1),(294,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','FINAN','XXXXXX','50',1505,'Valeurs mobilières de placement',0,NULL,NULL,1),(295,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','FINAN','XXXXXX','501',294,'Parts dans des entreprises liées',0,NULL,NULL,1),(296,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','FINAN','XXXXXX','502',294,'Actions propres',0,NULL,NULL,1),(297,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','FINAN','XXXXXX','503',294,'Actions',0,NULL,NULL,1),(298,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','FINAN','XXXXXX','504',294,'Autres titres conférant un droit de propriété',0,NULL,NULL,1),(299,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','FINAN','XXXXXX','505',294,'Obligations et bons émis par la société et rachetés par elle',0,NULL,NULL,1),(300,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','FINAN','XXXXXX','506',294,'Obligations',0,NULL,NULL,1),(301,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','FINAN','XXXXXX','507',294,'Bons du Trésor et bons de caisse à court terme',0,NULL,NULL,1),(302,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','FINAN','XXXXXX','508',294,'Autres valeurs mobilières de placement et autres créances assimilées',0,NULL,NULL,1),(303,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','FINAN','XXXXXX','509',294,'Versements restant à effectuer sur valeurs mobilières de placement non libérées',0,NULL,NULL,1),(304,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','FINAN','XXXXXX','51',1505,'Banques, établissements financiers et assimilés',0,NULL,NULL,1),(305,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','FINAN','XXXXXX','511',304,'Valeurs à l\'encaissement',0,NULL,NULL,1),(306,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','FINAN','BANK','512',304,'Banques',0,NULL,NULL,1),(307,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','FINAN','XXXXXX','514',304,'Chèques postaux',0,NULL,NULL,1),(308,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','FINAN','XXXXXX','515',304,'\"Caisses\" du Trésor et des établissements publics',0,NULL,NULL,1),(309,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','FINAN','XXXXXX','516',304,'Sociétés de bourse',0,NULL,NULL,1),(310,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','FINAN','XXXXXX','517',304,'Autres organismes financiers',0,NULL,NULL,1),(311,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','FINAN','XXXXXX','518',304,'Intérêts courus',0,NULL,NULL,1),(312,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','FINAN','XXXXXX','519',304,'Concours bancaires courants',0,NULL,NULL,1),(313,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','FINAN','XXXXXX','52',1505,'Instruments de trésorerie',0,NULL,NULL,1),(314,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','FINAN','CASH','53',1505,'Caisse',0,NULL,NULL,1),(315,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','FINAN','XXXXXX','531',314,'Caisse siège social',0,NULL,NULL,1),(316,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','FINAN','XXXXXX','532',314,'Caisse succursale (ou usine) A',0,NULL,NULL,1),(317,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','FINAN','XXXXXX','533',314,'Caisse succursale (ou usine) B',0,NULL,NULL,1),(318,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','FINAN','XXXXXX','54',1505,'Régies d\'avance et accréditifs',0,NULL,NULL,1),(319,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','FINAN','XXXXXX','58',1505,'Virements internes',0,NULL,NULL,1),(320,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','FINAN','XXXXXX','59',1505,'Provisions pour dépréciation des comptes financiers',0,NULL,NULL,1),(321,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','FINAN','XXXXXX','590',320,'Provisions pour dépréciation des valeurs mobilières de placement',0,NULL,NULL,1),(322,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CHARGE','PRODUCT','60',1506,'Achats',0,NULL,NULL,1),(323,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CHARGE','XXXXXX','601',322,'Achats stockés - Matières premières (et fournitures)',0,NULL,NULL,1),(324,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CHARGE','XXXXXX','602',322,'Achats stockés - Autres approvisionnements',0,NULL,NULL,1),(325,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CHARGE','XXXXXX','603',322,'Variations des stocks (approvisionnements et marchandises)',0,NULL,NULL,1),(326,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CHARGE','XXXXXX','604',322,'Achats stockés - Matières premières (et fournitures)',0,NULL,NULL,1),(327,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CHARGE','XXXXXX','605',322,'Achats de matériel, équipements et travaux',0,NULL,NULL,1),(328,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CHARGE','XXXXXX','606',322,'Achats non stockés de matière et fournitures',0,NULL,NULL,1),(329,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CHARGE','XXXXXX','607',322,'Achats de marchandises',0,NULL,NULL,1),(330,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CHARGE','XXXXXX','608',322,'(Compte réservé, le cas échéant, à la récapitulation des frais accessoires incorporés aux achats)',0,NULL,NULL,1),(331,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CHARGE','XXXXXX','609',322,'Rabais, remises et ristournes obtenus sur achats',0,NULL,NULL,1),(332,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CHARGE','SERVICE','61',1506,'Services extérieurs',0,NULL,NULL,1),(333,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CHARGE','XXXXXX','611',332,'Sous-traitance générale',0,NULL,NULL,1),(334,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CHARGE','XXXXXX','612',332,'Redevances de crédit-bail',0,NULL,NULL,1),(335,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CHARGE','XXXXXX','613',332,'Locations',0,NULL,NULL,1),(336,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CHARGE','XXXXXX','614',332,'Charges locatives et de copropriété',0,NULL,NULL,1),(337,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CHARGE','XXXXXX','615',332,'Entretien et réparations',0,NULL,NULL,1),(338,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CHARGE','XXXXXX','616',332,'Primes d\'assurances',0,NULL,NULL,1),(339,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CHARGE','XXXXXX','617',332,'Etudes et recherches',0,NULL,NULL,1),(340,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CHARGE','XXXXXX','618',332,'Divers',0,NULL,NULL,1),(341,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CHARGE','XXXXXX','619',332,'Rabais, remises et ristournes obtenus sur services extérieurs',0,NULL,NULL,1),(342,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CHARGE','XXXXXX','62',1506,'Autres services extérieurs',0,NULL,NULL,1),(343,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CHARGE','XXXXXX','621',342,'Personnel extérieur à l\'entreprise',0,NULL,NULL,1),(344,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CHARGE','XXXXXX','622',342,'Rémunérations d\'intermédiaires et honoraires',0,NULL,NULL,1),(345,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CHARGE','XXXXXX','623',342,'Publicité, publications, relations publiques',0,NULL,NULL,1),(346,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CHARGE','XXXXXX','624',342,'Transports de biens et transports collectifs du personnel',0,NULL,NULL,1),(347,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CHARGE','XXXXXX','625',342,'Déplacements, missions et réceptions',0,NULL,NULL,1),(348,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CHARGE','XXXXXX','626',342,'Frais postaux et de télécommunications',0,NULL,NULL,1),(349,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CHARGE','XXXXXX','627',342,'Services bancaires et assimilés',0,NULL,NULL,1),(350,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CHARGE','XXXXXX','628',342,'Divers',0,NULL,NULL,1),(351,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CHARGE','XXXXXX','629',342,'Rabais, remises et ristournes obtenus sur autres services extérieurs',0,NULL,NULL,1),(352,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CHARGE','XXXXXX','63',1506,'Impôts, taxes et versements assimilés',0,NULL,NULL,1),(353,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CHARGE','XXXXXX','631',352,'Impôts, taxes et versements assimilés sur rémunérations (administrations des impôts)',0,NULL,NULL,1),(354,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CHARGE','XXXXXX','633',352,'Impôts, taxes et versements assimilés sur rémunérations (autres organismes)',0,NULL,NULL,1),(355,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CHARGE','XXXXXX','635',352,'Autres impôts, taxes et versements assimilés (administrations des impôts)',0,NULL,NULL,1),(356,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CHARGE','XXXXXX','637',352,'Autres impôts, taxes et versements assimilés (autres organismes)',0,NULL,NULL,1),(357,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CHARGE','XXXXXX','64',1506,'Charges de personnel',0,NULL,NULL,1),(358,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CHARGE','XXXXXX','641',357,'Rémunérations du personnel',0,NULL,NULL,1),(359,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CHARGE','XXXXXX','644',357,'Rémunération du travail de l\'exploitant',0,NULL,NULL,1),(360,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CHARGE','SOCIAL','645',357,'Charges de sécurité sociale et de prévoyance',0,NULL,NULL,1),(361,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CHARGE','XXXXXX','646',357,'Cotisations sociales personnelles de l\'exploitant',0,NULL,NULL,1),(362,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CHARGE','XXXXXX','647',357,'Autres charges sociales',0,NULL,NULL,1),(363,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CHARGE','XXXXXX','648',357,'Autres charges de personnel',0,NULL,NULL,1),(364,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CHARGE','XXXXXX','65',1506,'Autres charges de gestion courante',0,NULL,NULL,1),(365,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CHARGE','XXXXXX','651',364,'Redevances pour concessions, brevets, licences, marques, procédés, logiciels, droits et valeurs similaires',0,NULL,NULL,1),(366,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CHARGE','XXXXXX','653',364,'Jetons de présence',0,NULL,NULL,1),(367,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CHARGE','XXXXXX','654',364,'Pertes sur créances irrécouvrables',0,NULL,NULL,1),(368,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CHARGE','XXXXXX','655',364,'Quote-part de résultat sur opérations faites en commun',0,NULL,NULL,1),(369,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CHARGE','XXXXXX','658',364,'Charges diverses de gestion courante',0,NULL,NULL,1),(370,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CHARGE','XXXXXX','66',1506,'Charges financières',0,NULL,NULL,1),(371,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CHARGE','XXXXXX','661',370,'Charges d\'intérêts',0,NULL,NULL,1),(372,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CHARGE','XXXXXX','664',370,'Pertes sur créances liées à des participations',0,NULL,NULL,1),(373,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CHARGE','XXXXXX','665',370,'Escomptes accordés',0,NULL,NULL,1),(374,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CHARGE','XXXXXX','666',370,'Pertes de change',0,NULL,NULL,1),(375,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CHARGE','XXXXXX','667',370,'Charges nettes sur cessions de valeurs mobilières de placement',0,NULL,NULL,1),(376,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CHARGE','XXXXXX','668',370,'Autres charges financières',0,NULL,NULL,1),(377,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CHARGE','XXXXXX','67',1506,'Charges exceptionnelles',0,NULL,NULL,1),(378,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CHARGE','XXXXXX','671',377,'Charges exceptionnelles sur opérations de gestion',0,NULL,NULL,1),(379,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CHARGE','XXXXXX','672',377,'(Compte à la disposition des entités pour enregistrer, en cours d\'exercice, les charges sur exercices antérieurs)',0,NULL,NULL,1),(380,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CHARGE','XXXXXX','675',377,'Valeurs comptables des éléments d\'actif cédés',0,NULL,NULL,1),(381,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CHARGE','XXXXXX','678',377,'Autres charges exceptionnelles',0,NULL,NULL,1),(382,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CHARGE','XXXXXX','68',1506,'Dotations aux amortissements et aux provisions',0,NULL,NULL,1),(383,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CHARGE','XXXXXX','681',382,'Dotations aux amortissements et aux provisions - Charges d\'exploitation',0,NULL,NULL,1),(384,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CHARGE','XXXXXX','686',382,'Dotations aux amortissements et aux provisions - Charges financières',0,NULL,NULL,1),(385,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CHARGE','XXXXXX','687',382,'Dotations aux amortissements et aux provisions - Charges exceptionnelles',0,NULL,NULL,1),(386,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CHARGE','XXXXXX','69',1506,'Participation des salariés - impôts sur les bénéfices et assimiles',0,NULL,NULL,1),(387,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CHARGE','XXXXXX','691',386,'Participation des salariés aux résultats',0,NULL,NULL,1),(388,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CHARGE','XXXXXX','695',386,'Impôts sur les bénéfices',0,NULL,NULL,1),(389,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CHARGE','XXXXXX','696',386,'Suppléments d\'impôt sur les sociétés liés aux distributions',0,NULL,NULL,1),(390,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CHARGE','XXXXXX','697',386,'Imposition forfaitaire annuelle des sociétés',0,NULL,NULL,1),(391,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CHARGE','XXXXXX','698',386,'Intégration fiscale',0,NULL,NULL,1),(392,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','CHARGE','XXXXXX','699',386,'Produits - Reports en arrière des déficits',0,NULL,NULL,1),(393,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','PROD','XXXXXX','70',1507,'Ventes de produits fabriqués, prestations de services, marchandises',0,NULL,NULL,1),(394,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','PROD','PRODUCT','701',393,'Ventes de produits finis',0,NULL,NULL,1),(395,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','PROD','XXXXXX','702',393,'Ventes de produits intermédiaires',0,NULL,NULL,1),(396,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','PROD','XXXXXX','703',393,'Ventes de produits résiduels',0,NULL,NULL,1),(397,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','PROD','XXXXXX','704',393,'Travaux',0,NULL,NULL,1),(398,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','PROD','XXXXXX','705',393,'Etudes',0,NULL,NULL,1),(399,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','PROD','SERVICE','706',393,'Prestations de services',0,NULL,NULL,1),(400,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','PROD','PRODUCT','707',393,'Ventes de marchandises',0,NULL,NULL,1),(401,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','PROD','PRODUCT','708',393,'Produits des activités annexes',0,NULL,NULL,1),(402,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','PROD','XXXXXX','709',393,'Rabais, remises et ristournes accordés par l\'entreprise',0,NULL,NULL,1),(403,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','PROD','XXXXXX','71',1507,'Production stockée (ou déstockage)',0,NULL,NULL,1),(404,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','PROD','XXXXXX','713',403,'Variation des stocks (en-cours de production, produits)',0,NULL,NULL,1),(405,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','PROD','XXXXXX','72',1507,'Production immobilisée',0,NULL,NULL,1),(406,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','PROD','XXXXXX','721',405,'Immobilisations incorporelles',0,NULL,NULL,1),(407,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','PROD','XXXXXX','722',405,'Immobilisations corporelles',0,NULL,NULL,1),(408,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','PROD','XXXXXX','74',1507,'Subventions d\'exploitation',0,NULL,NULL,1),(409,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','PROD','XXXXXX','75',1507,'Autres produits de gestion courante',0,NULL,NULL,1),(410,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','PROD','XXXXXX','751',409,'Redevances pour concessions, brevets, licences, marques, procédés, logiciels, droits et valeurs similaires',0,NULL,NULL,1),(411,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','PROD','XXXXXX','752',409,'Revenus des immeubles non affectés à des activités professionnelles',0,NULL,NULL,1),(412,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','PROD','XXXXXX','753',409,'Jetons de présence et rémunérations d\'administrateurs, gérants,...',0,NULL,NULL,1),(413,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','PROD','XXXXXX','754',409,'Ristournes perçues des coopératives (provenant des excédents)',0,NULL,NULL,1),(414,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','PROD','XXXXXX','755',409,'Quotes-parts de résultat sur opérations faites en commun',0,NULL,NULL,1),(415,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','PROD','XXXXXX','758',409,'Produits divers de gestion courante',0,NULL,NULL,1),(416,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','PROD','XXXXXX','76',1507,'Produits financiers',0,NULL,NULL,1),(417,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','PROD','XXXXXX','761',416,'Produits de participations',0,NULL,NULL,1),(418,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','PROD','XXXXXX','762',416,'Produits des autres immobilisations financières',0,NULL,NULL,1),(419,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','PROD','XXXXXX','763',416,'Revenus des autres créances',0,NULL,NULL,1),(420,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','PROD','XXXXXX','764',416,'Revenus des valeurs mobilières de placement',0,NULL,NULL,1),(421,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','PROD','XXXXXX','765',416,'Escomptes obtenus',0,NULL,NULL,1),(422,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','PROD','XXXXXX','766',416,'Gains de change',0,NULL,NULL,1),(423,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','PROD','XXXXXX','767',416,'Produits nets sur cessions de valeurs mobilières de placement',0,NULL,NULL,1),(424,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','PROD','XXXXXX','768',416,'Autres produits financiers',0,NULL,NULL,1),(425,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','PROD','XXXXXX','77',1507,'Produits exceptionnels',0,NULL,NULL,1),(426,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','PROD','XXXXXX','771',425,'Produits exceptionnels sur opérations de gestion',0,NULL,NULL,1),(427,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','PROD','XXXXXX','772',425,'(Compte à la disposition des entités pour enregistrer, en cours d\'exercice, les produits sur exercices antérieurs)',0,NULL,NULL,1),(428,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','PROD','XXXXXX','775',425,'Produits des cessions d\'éléments d\'actif',0,NULL,NULL,1),(429,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','PROD','XXXXXX','777',425,'Quote-part des subventions d\'investissement virée au résultat de l\'exercice',0,NULL,NULL,1),(430,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','PROD','XXXXXX','778',425,'Autres produits exceptionnels',0,NULL,NULL,1),(431,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','PROD','XXXXXX','78',1507,'Reprises sur amortissements et provisions',0,NULL,NULL,1),(432,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','PROD','XXXXXX','781',431,'Reprises sur amortissements et provisions (à inscrire dans les produits d\'exploitation)',0,NULL,NULL,1),(433,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','PROD','XXXXXX','786',431,'Reprises sur provisions pour risques (à inscrire dans les produits financiers)',0,NULL,NULL,1),(434,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','PROD','XXXXXX','787',431,'Reprises sur provisions (à inscrire dans les produits exceptionnels)',0,NULL,NULL,1),(435,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','PROD','XXXXXX','79',1507,'Transferts de charges',0,NULL,NULL,1),(436,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','PROD','XXXXXX','791',435,'Transferts de charges d\'exploitation ',0,NULL,NULL,1),(437,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','PROD','XXXXXX','796',435,'Transferts de charges financières',0,NULL,NULL,1),(438,1,NULL,'2016-01-22 17:28:15','PCG99-BASE','PROD','XXXXXX','797',435,'Transferts de charges exceptionnelles',0,NULL,NULL,1),(439,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','10',1351,'Capital',0,NULL,NULL,1),(440,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','100',439,'Capital souscrit ou capital personnel',0,NULL,NULL,1),(441,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','1000',440,'Capital non amorti',0,NULL,NULL,1),(442,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','1001',440,'Capital amorti',0,NULL,NULL,1),(443,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','101',439,'Capital non appelé',0,NULL,NULL,1),(444,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','109',439,'Compte de l\'exploitant',0,NULL,NULL,1),(445,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','1090',444,'Opérations courantes',0,NULL,NULL,1),(446,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','1091',444,'Impôts personnels',0,NULL,NULL,1),(447,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','1092',444,'Rémunérations et autres avantages',0,NULL,NULL,1),(448,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','11',1351,'Primes d\'émission',0,NULL,NULL,1),(449,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','12',1351,'Plus-values de réévaluation',0,NULL,NULL,1),(450,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','120',449,'Plus-values de réévaluation sur immobilisations incorporelles',0,NULL,NULL,1),(451,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','1200',450,'Plus-values de réévaluation',0,NULL,NULL,1),(452,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','1201',450,'Reprises de réductions de valeur',0,NULL,NULL,1),(453,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','121',449,'Plus-values de réévaluation sur immobilisations corporelles',0,NULL,NULL,1),(454,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','1210',453,'Plus-values de réévaluation',0,NULL,NULL,1),(455,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','1211',453,'Reprises de réductions de valeur',0,NULL,NULL,1),(456,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','122',449,'Plus-values de réévaluation sur immobilisations financières',0,NULL,NULL,1),(457,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','1220',456,'Plus-values de réévaluation',0,NULL,NULL,1),(458,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','1221',456,'Reprises de réductions de valeur',0,NULL,NULL,1),(459,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','123',449,'Plus-values de réévaluation sur stocks',0,NULL,NULL,1),(460,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','124',449,'Reprises de réductions de valeur sur placements de trésorerie',0,NULL,NULL,1),(461,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','13',1351,'Réserve',0,NULL,NULL,1),(462,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','130',461,'Réserve légale',0,NULL,NULL,1),(463,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','131',461,'Réserves indisponibles',0,NULL,NULL,1),(464,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','1310',463,'Réserve pour actions propres',0,NULL,NULL,1),(465,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','1311',463,'Autres réserves indisponibles',0,NULL,NULL,1),(466,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','132',461,'Réserves immunisées',0,NULL,NULL,1),(467,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','133',461,'Réserves disponibles',0,NULL,NULL,1),(468,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','1330',467,'Réserve pour régularisation de dividendes',0,NULL,NULL,1),(469,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','1331',467,'Réserve pour renouvellement des immobilisations',0,NULL,NULL,1),(470,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','1332',467,'Réserve pour installations en faveur du personnel 1333 Réserves libres',0,NULL,NULL,1),(471,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','14',1351,'Bénéfice reporté (ou perte reportée)',0,NULL,NULL,1),(472,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','15',1351,'Subsides en capital',0,NULL,NULL,1),(473,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','150',472,'Montants obtenus',0,NULL,NULL,1),(474,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','151',472,'Montants transférés aux résultats',0,NULL,NULL,1),(475,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','16',1351,'Provisions pour risques et charges',0,NULL,NULL,1),(476,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','160',475,'Provisions pour pensions et obligations similaires',0,NULL,NULL,1),(477,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','161',475,'Provisions pour charges fiscales',0,NULL,NULL,1),(478,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','162',475,'Provisions pour grosses réparations et gros entretiens',0,NULL,NULL,1),(479,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','163',475,'à 169 Provisions pour autres risques et charges',0,NULL,NULL,1),(480,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','164',475,'Provisions pour sûretés personnelles ou réelles constituées à l\'appui de dettes et d\'engagements de tiers',0,NULL,NULL,1),(481,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','165',475,'Provisions pour engagements relatifs à l\'acquisition ou à la cession d\'immobilisations',0,NULL,NULL,1),(482,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','166',475,'Provisions pour exécution de commandes passées ou reçues',0,NULL,NULL,1),(483,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','167',475,'Provisions pour positions et marchés à terme en devises ou positions et marchés à terme en marchandises',0,NULL,NULL,1),(484,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','168',475,'Provisions pour garanties techniques attachées aux ventes et prestations déjà effectuées par l\'entreprise',0,NULL,NULL,1),(485,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','169',475,'Provisions pour autres risques et charges',0,NULL,NULL,1),(486,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','1690',485,'Pour litiges en cours',0,NULL,NULL,1),(487,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','1691',485,'Pour amendes, doubles droits et pénalités',0,NULL,NULL,1),(488,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','1692',485,'Pour propre assureur',0,NULL,NULL,1),(489,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','1693',485,'Pour risques inhérents aux opérations de crédits à moyen ou long terme',0,NULL,NULL,1),(490,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','1695',485,'Provision pour charge de liquidation',0,NULL,NULL,1),(491,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','1696',485,'Provision pour départ de personnel',0,NULL,NULL,1),(492,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','1699',485,'Pour risques divers',0,NULL,NULL,1),(493,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','17',1351,'Dettes à plus d\'un an',0,NULL,NULL,1),(494,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','170',493,'Emprunts subordonnés',0,NULL,NULL,1),(495,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','1700',494,'Convertibles',0,NULL,NULL,1),(496,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','1701',494,'Non convertibles',0,NULL,NULL,1),(497,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','171',493,'Emprunts obligataires non subordonnés',0,NULL,NULL,1),(498,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','1710',498,'Convertibles',0,NULL,NULL,1),(499,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','1711',498,'Non convertibles',0,NULL,NULL,1),(500,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','172',493,'Dettes de location-financement et assimilés',0,NULL,NULL,1),(501,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','1720',500,'Dettes de location-financement de biens immobiliers',0,NULL,NULL,1),(502,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','1721',500,'Dettes de location-financement de biens mobiliers',0,NULL,NULL,1),(503,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','1722',500,'Dettes sur droits réels sur immeubles',0,NULL,NULL,1),(504,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','173',493,'Etablissements de crédit',0,NULL,NULL,1),(505,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','1730',504,'Dettes en compte',0,NULL,NULL,1),(506,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','17300',505,'Banque A',0,NULL,NULL,1),(507,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','17301',505,'Banque B',0,NULL,NULL,1),(508,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','17302',505,'Banque C',0,NULL,NULL,1),(509,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','17303',505,'Banque D',0,NULL,NULL,1),(510,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','1731',504,'Promesses',0,NULL,NULL,1),(511,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','17310',510,'Banque A',0,NULL,NULL,1),(512,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','17311',510,'Banque B',0,NULL,NULL,1),(513,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','17312',510,'Banque C',0,NULL,NULL,1),(514,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','17313',510,'Banque D',0,NULL,NULL,1),(515,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','1732',504,'Crédits d\'acceptation',0,NULL,NULL,1),(516,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','17320',515,'Banque A',0,NULL,NULL,1),(517,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','17321',515,'Banque B',0,NULL,NULL,1),(518,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','17322',515,'Banque C',0,NULL,NULL,1),(519,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','17323',515,'Banque D',0,NULL,NULL,1),(520,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','174',493,'Autres emprunts',0,NULL,NULL,1),(521,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','175',493,'Dettes commerciales',0,NULL,NULL,1),(522,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','1750',521,'Fournisseurs : dettes en compte',0,NULL,NULL,1),(523,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','17500',522,'Entreprises apparentées',0,NULL,NULL,1),(524,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','175000',523,'Entreprises liées',0,NULL,NULL,1),(525,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','175001',523,'Entreprises avec lesquelles il existe un lien de participation',0,NULL,NULL,1),(526,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','17501',522,'Fournisseurs ordinaires',0,NULL,NULL,1),(527,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','175010',526,'Fournisseurs belges',0,NULL,NULL,1),(528,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','175011',526,'Fournisseurs C.E.E.',0,NULL,NULL,1),(529,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','175012',526,'Fournisseurs importation',0,NULL,NULL,1),(530,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','1751',521,'Effets à payer',0,NULL,NULL,1),(531,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','17510',530,'Entreprises apparentées',0,NULL,NULL,1),(532,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','175100',531,'Entreprises liées',0,NULL,NULL,1),(533,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','175101',531,'Entreprises avec lesquelles il existe un lien de participation',0,NULL,NULL,1),(534,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','17511',530,'Fournisseurs ordinaires',0,NULL,NULL,1),(535,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','175110',534,'Fournisseurs belges',0,NULL,NULL,1),(536,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','175111',534,'Fournisseurs C.E.E.',0,NULL,NULL,1),(537,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','175112',534,'Fournisseurs importation',0,NULL,NULL,1),(538,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','176',493,'Acomptes reçus sur commandes',0,NULL,NULL,1),(539,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','178',493,'Cautionnements reçus en numéraires',0,NULL,NULL,1),(540,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','179',493,'Dettes diverses',0,NULL,NULL,1),(541,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','1790',540,'Entreprises liées',0,NULL,NULL,1),(542,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','1791',540,'Autres entreprises avec lesquelles il existe un lien de participation',0,NULL,NULL,1),(543,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','1792',540,'Administrateurs, gérants et associés',0,NULL,NULL,1),(544,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','1794',540,'Rentes viagères capitalisées',0,NULL,NULL,1),(545,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','1798',540,'Dettes envers les coparticipants des associations momentanées et en participation',0,NULL,NULL,1),(546,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','1799',540,'Autres dettes diverses',0,NULL,NULL,1),(547,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','CAPIT','XXXXXX','18',1351,'Comptes de liaison des établissements et succursales',0,NULL,NULL,1),(548,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','20',1352,'Frais d\'établissement',0,NULL,NULL,1),(549,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','200',548,'Frais de constitution et d\'augmentation de capital',0,NULL,NULL,1),(550,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2000',549,'Frais de constitution et d\'augmentation de capital',0,NULL,NULL,1),(551,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2009',549,'Amortissements sur frais de constitution et d\'augmentation de capital',0,NULL,NULL,1),(552,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','201',548,'Frais d\'émission d\'emprunts et primes de remboursement',0,NULL,NULL,1),(553,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2010',552,'Agios sur emprunts et frais d\'émission d\'emprunts',0,NULL,NULL,1),(554,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2019',552,'Amortissements sur agios sur emprunts et frais d\'émission d\'emprunts',0,NULL,NULL,1),(555,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','202',548,'Autres frais d\'établissement',0,NULL,NULL,1),(556,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2020',555,'Autres frais d\'établissement',0,NULL,NULL,1),(557,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2029',555,'Amortissements sur autres frais d\'établissement',0,NULL,NULL,1),(558,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','203',548,'Intérêts intercalaires',0,NULL,NULL,1),(559,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2030',558,'Intérêts intercalaires',0,NULL,NULL,1),(560,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2039',558,'Amortissements sur intérêts intercalaires',0,NULL,NULL,1),(561,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','204',548,'Frais de restructuration',0,NULL,NULL,1),(562,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2040',561,'Coût des frais de restructuration',0,NULL,NULL,1),(563,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2049',561,'Amortissements sur frais de restructuration',0,NULL,NULL,1),(564,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','21',1352,'Immobilisations incorporelles',0,NULL,NULL,1),(565,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','210',564,'Frais de recherche et de développement',0,NULL,NULL,1),(566,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2100',565,'Frais de recherche et de mise au point',0,NULL,NULL,1),(567,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2108',565,'Plus-values actées sur frais de recherche et de mise au point',0,NULL,NULL,1),(568,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2109',565,'Amortissements sur frais de recherche et de mise au point',0,NULL,NULL,1),(569,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','211',564,'Concessions, brevets, licences, savoir-faire, marque et droits similaires',0,NULL,NULL,1),(570,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2110',569,'Concessions, brevets, licences, marques, etc',0,NULL,NULL,1),(571,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2118',569,'Plus-values actées sur concessions, etc',0,NULL,NULL,1),(572,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2119',569,'Amortissements sur concessions, etc',0,NULL,NULL,1),(573,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','212',564,'Goodwill',0,NULL,NULL,1),(574,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2120',573,'Coût d\'acquisition',0,NULL,NULL,1),(575,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2128',573,'Plus-values actées',0,NULL,NULL,1),(576,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2129',573,'Amortissements sur goodwill',0,NULL,NULL,1),(577,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','213',564,'Acomptes versés',0,NULL,NULL,1),(578,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','22',1352,'Terrains et constructions',0,NULL,NULL,1),(579,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','220',578,'Terrains',0,NULL,NULL,1),(580,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2200',579,'Terrains',0,NULL,NULL,1),(581,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2201',579,'Frais d\'acquisition sur terrains',0,NULL,NULL,1),(582,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2208',579,'Plus-values actées sur terrains',0,NULL,NULL,1),(583,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2209',579,'Amortissements et réductions de valeur',0,NULL,NULL,1),(584,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','22090',583,'Amortissements sur frais d\'acquisition',0,NULL,NULL,1),(585,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','22091',583,'Réductions de valeur sur terrains',0,NULL,NULL,1),(586,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','221',578,'Constructions',0,NULL,NULL,1),(587,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2210',586,'Bâtiments industriels',0,NULL,NULL,1),(588,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2211',586,'Bâtiments administratifs et commerciaux',0,NULL,NULL,1),(589,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2212',586,'Autres bâtiments d\'exploitation',0,NULL,NULL,1),(590,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2213',586,'Voies de transport et ouvrages d\'art',0,NULL,NULL,1),(591,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2215',586,'Constructions sur sol d\'autrui',0,NULL,NULL,1),(592,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2216',586,'Frais d\'acquisition sur constructions',0,NULL,NULL,1),(593,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2218',586,'Plus-values actées',0,NULL,NULL,1),(594,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','22180',593,'Sur bâtiments industriels',0,NULL,NULL,1),(595,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','22181',593,'Sur bâtiments administratifs et commerciaux',0,NULL,NULL,1),(596,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','22182',593,'Sur autres bâtiments d\'exploitation',0,NULL,NULL,1),(597,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','22184',593,'Sur voies de transport et ouvrages d\'art',0,NULL,NULL,1),(598,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2219',586,'Amortissements sur constructions',0,NULL,NULL,1),(599,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','22190',598,'Sur bâtiments industriels',0,NULL,NULL,1),(600,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','22191',598,'Sur bâtiments administratifs et commerciaux',0,NULL,NULL,1),(601,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','22192',598,'Sur autres bâtiments d\'exploitation',0,NULL,NULL,1),(602,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','22194',598,'Sur voies de transport et ouvrages d\'art',0,NULL,NULL,1),(603,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','22195',598,'Sur constructions sur sol d\'autrui',0,NULL,NULL,1),(604,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','22196',598,'Sur frais d\'acquisition sur constructions',0,NULL,NULL,1),(605,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','222',578,'Terrains bâtis',0,NULL,NULL,1),(606,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2220',605,'Valeur d\'acquisition',0,NULL,NULL,1),(607,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','22200',606,'Bâtiments industriels',0,NULL,NULL,1),(608,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','22201',606,'Bâtiments administratifs et commerciaux',0,NULL,NULL,1),(609,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','22202',606,'Autres bâtiments d\'exploitation',0,NULL,NULL,1),(610,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','22203',606,'Voies de transport et ouvrages d\'art',0,NULL,NULL,1),(611,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','22204',606,'Frais d\'acquisition des terrains à bâtir',0,NULL,NULL,1),(612,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2228',605,'Plus-values actées',0,NULL,NULL,1),(613,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','22280',612,'Sur bâtiments industriels',0,NULL,NULL,1),(614,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','22281',612,'Sur bâtiments administratifs et commerciaux',0,NULL,NULL,1),(615,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','22282',612,'Sur autres bâtiments d\'exploitation',0,NULL,NULL,1),(616,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','22283',612,'Sur voies de transport et ouvrages d\'art',0,NULL,NULL,1),(617,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2229',605,'Amortissements sur terrains bâtis',0,NULL,NULL,1),(618,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','22290',617,'Sur bâtiments industriels',0,NULL,NULL,1),(619,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','22291',617,'Sur bâtiments administratifs et commerciaux',0,NULL,NULL,1),(620,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','22292',617,'Sur autres bâtiments d\'exploitation',0,NULL,NULL,1),(621,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','22293',617,'Sur voies de transport et ouvrages d\'art',0,NULL,NULL,1),(622,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','22294',617,'Sur frais d\'acquisition des terrains bâtis',0,NULL,NULL,1),(623,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','223',578,'Autres droits réels sur des immeubles',0,NULL,NULL,1),(624,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2230',623,'Valeur d\'acquisition',0,NULL,NULL,1),(625,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2238',623,'Plus-values actées',0,NULL,NULL,1),(626,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2239',623,'Amortissements',0,NULL,NULL,1),(627,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','23',1352,'Installations, machines et outillages',0,NULL,NULL,1),(628,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','230',627,'Installations',0,NULL,NULL,1),(629,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2300',628,'Installations bâtiments industriels',0,NULL,NULL,1),(630,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2301',628,'Installations bâtiments administratifs et commerciaux',0,NULL,NULL,1),(631,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2302',628,'Installations bâtiments d\'exploitation',0,NULL,NULL,1),(632,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2303',628,'Installations voies de transport et ouvrages d\'art',0,NULL,NULL,1),(633,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2300',628,'Installation d\'eau',0,NULL,NULL,1),(634,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2301',628,'Installation d\'électricité',0,NULL,NULL,1),(635,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2302',628,'Installation de vapeur',0,NULL,NULL,1),(636,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2303',628,'Installation de gaz',0,NULL,NULL,1),(637,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2304',628,'Installation de chauffage',0,NULL,NULL,1),(638,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2305',628,'Installation de conditionnement d\'air',0,NULL,NULL,1),(639,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2306',628,'Installation de chargement',0,NULL,NULL,1),(640,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','231',627,'Machines',0,NULL,NULL,1),(641,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2310',640,'Division A',0,NULL,NULL,1),(642,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2311',640,'Division B',0,NULL,NULL,1),(643,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2312',640,'Division C',0,NULL,NULL,1),(644,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','237',627,'Outillage',0,NULL,NULL,1),(645,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2370',644,'Division A',0,NULL,NULL,1),(646,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2371',644,'Division B',0,NULL,NULL,1),(647,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2372',644,'Division C',0,NULL,NULL,1),(648,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','238',627,'Plus-values actées',0,NULL,NULL,1),(649,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2380',648,'Sur installations',0,NULL,NULL,1),(650,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2381',648,'Sur machines',0,NULL,NULL,1),(651,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2382',648,'Sur outillage',0,NULL,NULL,1),(652,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','239',627,'Amortissements',0,NULL,NULL,1),(653,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2390',652,'Sur installations',0,NULL,NULL,1),(654,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2391',652,'Sur machines',0,NULL,NULL,1),(655,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2392',652,'Sur outillage',0,NULL,NULL,1),(656,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','24',1352,'Mobilier et matériel roulant',0,NULL,NULL,1),(657,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','240',656,'Mobilier',0,NULL,NULL,1),(658,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2400',656,'Mobilier',0,NULL,NULL,1),(659,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','24000',658,'Mobilier des bâtiments industriels',0,NULL,NULL,1),(660,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','24001',658,'Mobilier des bâtiments administratifs et commerciaux',0,NULL,NULL,1),(661,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','24002',658,'Mobilier des autres bâtiments d\'exploitation',0,NULL,NULL,1),(662,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','24003',658,'Mobilier oeuvres sociales',0,NULL,NULL,1),(663,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2401',657,'Matériel de bureau et de service social',0,NULL,NULL,1),(664,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','24010',663,'Des bâtiments industriels',0,NULL,NULL,1),(665,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','24011',663,'Des bâtiments administratifs et commerciaux',0,NULL,NULL,1),(666,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','24012',663,'Des autres bâtiments d\'exploitation',0,NULL,NULL,1),(667,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','24013',663,'Des oeuvres sociales',0,NULL,NULL,1),(668,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2408',657,'Plus-values actées',0,NULL,NULL,1),(669,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','24080',668,'Plus-values actées sur mobilier',0,NULL,NULL,1),(670,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','24081',668,'Plus-values actées sur matériel de bureau et service social',0,NULL,NULL,1),(671,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2409',657,'Amortissements',0,NULL,NULL,1),(672,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','24090',671,'Amortissements sur mobilier',0,NULL,NULL,1),(673,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','24091',671,'Amortissements sur matériel de bureau et service social',0,NULL,NULL,1),(674,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','241',656,'Matériel roulant',0,NULL,NULL,1),(675,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2410',674,'Matériel automobile',0,NULL,NULL,1),(676,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','24100',675,'Voitures',0,NULL,NULL,1),(677,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','24105',675,'Camions',0,NULL,NULL,1),(678,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2411',674,'Matériel ferroviaire',0,NULL,NULL,1),(679,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2412',674,'Matériel fluvial',0,NULL,NULL,1),(680,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2413',674,'Matériel naval',0,NULL,NULL,1),(681,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2414',674,'Matériel aérien',0,NULL,NULL,1),(682,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2418',674,'Plus-values sur matériel roulant',0,NULL,NULL,1),(683,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','24180',682,'Plus-values sur matériel automobile',0,NULL,NULL,1),(684,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','24181',682,'Idem sur matériel ferroviaire',0,NULL,NULL,1),(685,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','24182',682,'Idem sur matériel fluvial',0,NULL,NULL,1),(686,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','24183',682,'Idem sur matériel naval',0,NULL,NULL,1),(687,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','24184',682,'Idem sur matériel aérien',0,NULL,NULL,1),(688,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2419',674,'Amortissements sur matériel roulant',0,NULL,NULL,1),(689,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','24190',688,'Amortissements sur matériel automobile',0,NULL,NULL,1),(690,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','24191',688,'Idem sur matériel ferroviaire',0,NULL,NULL,1),(691,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','24192',688,'Idem sur matériel fluvial',0,NULL,NULL,1),(692,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','24193',688,'Idem sur matériel naval',0,NULL,NULL,1),(693,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','24194',688,'Idem sur matériel aérien',0,NULL,NULL,1),(694,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','25',1352,'Immobilisation détenues en location-financement et droits similaires',0,NULL,NULL,1),(695,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','250',694,'Terrains et constructions',0,NULL,NULL,1),(696,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2500',695,'Terrains',0,NULL,NULL,1),(697,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2501',695,'Constructions',0,NULL,NULL,1),(698,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2508',695,'Plus-values sur emphytéose, leasing et droits similaires : terrains et constructions',0,NULL,NULL,1),(699,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2509',695,'Amortissements et réductions de valeur sur terrains et constructions en leasing',0,NULL,NULL,1),(700,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','251',694,'Installations, machines et outillage',0,NULL,NULL,1),(701,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2510',700,'Installations',0,NULL,NULL,1),(702,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2511',700,'Machines',0,NULL,NULL,1),(703,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2512',700,'Outillage',0,NULL,NULL,1),(704,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2518',700,'Plus-values actées sur installations machines et outillage pris en leasing',0,NULL,NULL,1),(705,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2519',700,'Amortissements sur installations machines et outillage pris en leasing',0,NULL,NULL,1),(706,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','252',694,'Mobilier et matériel roulant',0,NULL,NULL,1),(707,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2520',706,'Mobilier',0,NULL,NULL,1),(708,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2521',706,'Matériel roulant',0,NULL,NULL,1),(709,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2528',706,'Plus-values actées sur mobilier et matériel roulant en leasing',0,NULL,NULL,1),(710,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2529',706,'Amortissements sur mobilier et matériel roulant en leasing',0,NULL,NULL,1),(711,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','26',1352,'Autres immobilisations corporelles',0,NULL,NULL,1),(712,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','260',711,'Frais d\'aménagements de locaux pris en location',0,NULL,NULL,1),(713,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','261',711,'Maison d\'habitation',0,NULL,NULL,1),(714,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','262',711,'Réserve immobilière',0,NULL,NULL,1),(715,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','263',711,'Matériel d\'emballage',0,NULL,NULL,1),(716,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','264',711,'Emballages récupérables',0,NULL,NULL,1),(717,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','268',711,'Plus-values actées sur autres immobilisations corporelles',0,NULL,NULL,1),(718,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','269',711,'Amortissements sur autres immobilisations corporelles',0,NULL,NULL,1),(719,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2690',718,'Amortissements sur frais d\'aménagement des locaux pris en location',0,NULL,NULL,1),(720,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2691',718,'Amortissements sur maison d\'habitation',0,NULL,NULL,1),(721,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2692',718,'Amortissements sur réserve immobilière',0,NULL,NULL,1),(722,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2693',718,'Amortissements sur matériel d\'emballage',0,NULL,NULL,1),(723,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2694',718,'Amortissements sur emballages récupérables',0,NULL,NULL,1),(724,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','27',1352,'Immobilisations corporelles en cours et acomptes versés',0,NULL,NULL,1),(725,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','270',724,'Immobilisations en cours',0,NULL,NULL,1),(726,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2700',725,'Constructions',0,NULL,NULL,1),(727,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2701',725,'Installations machines et outillage',0,NULL,NULL,1),(728,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2702',725,'Mobilier et matériel roulant',0,NULL,NULL,1),(729,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2703',725,'Autres immobilisations corporelles',0,NULL,NULL,1),(730,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','271',724,'Avances et acomptes versés sur immobilisations en cours',0,NULL,NULL,1),(731,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','28',1352,'Immobilisations financières',0,NULL,NULL,1),(732,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','280',731,'Participations dans des entreprises liées',0,NULL,NULL,1),(733,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2800',732,'Valeur d\'acquisition (peut être subdivisé par participation)',0,NULL,NULL,1),(734,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2801',732,'Montants non appelés (idem)',0,NULL,NULL,1),(735,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2808',732,'Plus-values actées (idem)',0,NULL,NULL,1),(736,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2809',732,'Réductions de valeurs actées (idem)',0,NULL,NULL,1),(737,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','281',731,'Créances sur des entreprises liées',0,NULL,NULL,1),(738,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2810',737,'Créances en compte',0,NULL,NULL,1),(739,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2811',737,'Effets à recevoir',0,NULL,NULL,1),(740,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2812',737,'Titres à revenu fixes',0,NULL,NULL,1),(741,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2817',737,'Créances douteuses',0,NULL,NULL,1),(742,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2819',737,'Réductions de valeurs actées',0,NULL,NULL,1),(743,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','282',731,'Participations dans des entreprises avec lesquelles il existe un lien de participation',0,NULL,NULL,1),(744,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2820',743,'Valeur d\'acquisition (peut être subdivisé par participation)',0,NULL,NULL,1),(745,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2821',743,'Montants non appelés (idem)',0,NULL,NULL,1),(746,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2828',743,'Plus-values actées (idem)',0,NULL,NULL,1),(747,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2829',743,'Réductions de valeurs actées (idem)',0,NULL,NULL,1),(748,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','283',731,'Créances sur des entreprises avec lesquelles il existe un lien de participation',0,NULL,NULL,1),(749,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2830',748,'Créances en compte',0,NULL,NULL,1),(750,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2831',748,'Effets à recevoir',0,NULL,NULL,1),(751,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2832',748,'Titres à revenu fixe',0,NULL,NULL,1),(752,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2837',748,'Créances douteuses',0,NULL,NULL,1),(753,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','2839',748,'Réductions de valeurs actées',0,NULL,NULL,1),(754,1,NULL,'2016-01-22 17:28:15','PCMN-BASE','IMMO','XXXXXX','284',731,'Autres actions et parts',0,NULL,NULL,1),(755,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','IMMO','XXXXXX','2840',754,'Valeur d\'acquisition',0,NULL,NULL,1),(756,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','IMMO','XXXXXX','2841',754,'Montants non appelés',0,NULL,NULL,1),(757,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','IMMO','XXXXXX','2848',754,'Plus-values actées',0,NULL,NULL,1),(758,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','IMMO','XXXXXX','2849',754,'Réductions de valeur actées',0,NULL,NULL,1),(759,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','IMMO','XXXXXX','285',731,'Autres créances',0,NULL,NULL,1),(760,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','IMMO','XXXXXX','2850',759,'Créances en compte',0,NULL,NULL,1),(761,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','IMMO','XXXXXX','2851',759,'Effets à recevoir',0,NULL,NULL,1),(762,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','IMMO','XXXXXX','2852',759,'Titres à revenu fixe',0,NULL,NULL,1),(763,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','IMMO','XXXXXX','2857',759,'Créances douteuses',0,NULL,NULL,1),(764,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','IMMO','XXXXXX','2859',759,'Réductions de valeur actées',0,NULL,NULL,1),(765,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','IMMO','XXXXXX','288',731,'Cautionnements versés en numéraires',0,NULL,NULL,1),(766,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','IMMO','XXXXXX','2880',765,'Téléphone, téléfax, télex',0,NULL,NULL,1),(767,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','IMMO','XXXXXX','2881',765,'Gaz',0,NULL,NULL,1),(768,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','IMMO','XXXXXX','2882',765,'Eau',0,NULL,NULL,1),(769,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','IMMO','XXXXXX','2883',765,'Electricité',0,NULL,NULL,1),(770,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','IMMO','XXXXXX','2887',765,'Autres cautionnements versés en numéraires',0,NULL,NULL,1),(771,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','IMMO','XXXXXX','29',1352,'Créances à plus d\'un an',0,NULL,NULL,1),(772,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','IMMO','XXXXXX','290',771,'Créances commerciales',0,NULL,NULL,1),(773,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','IMMO','XXXXXX','2900',772,'Clients',0,NULL,NULL,1),(774,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','IMMO','XXXXXX','29000',773,'Créances en compte sur entreprises liées',0,NULL,NULL,1),(775,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','IMMO','XXXXXX','29001',773,'Sur entreprises avec lesquelles il existe un lien de participation',0,NULL,NULL,1),(776,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','IMMO','XXXXXX','29002',773,'Sur clients Belgique',0,NULL,NULL,1),(777,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','IMMO','XXXXXX','29003',773,'Sur clients C.E.E.',0,NULL,NULL,1),(778,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','IMMO','XXXXXX','29004',773,'Sur clients exportation hors C.E.E.',0,NULL,NULL,1),(779,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','IMMO','XXXXXX','29005',773,'Créances sur les coparticipants (associations momentanées)',0,NULL,NULL,1),(780,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','IMMO','XXXXXX','2901',772,'Effets à recevoir',0,NULL,NULL,1),(781,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','IMMO','XXXXXX','29010',780,'Sur entreprises liées',0,NULL,NULL,1),(782,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','IMMO','XXXXXX','29011',780,'Sur entreprises avec lesquelles il existe un lien de participation',0,NULL,NULL,1),(783,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','IMMO','XXXXXX','29012',780,'Sur clients Belgique',0,NULL,NULL,1),(784,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','IMMO','XXXXXX','29013',780,'Sur clients C.E.E.',0,NULL,NULL,1),(785,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','IMMO','XXXXXX','29014',780,'Sur clients exportation hors C.E.E.',0,NULL,NULL,1),(786,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','IMMO','XXXXXX','2905',772,'Retenues sur garanties',0,NULL,NULL,1),(787,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','IMMO','XXXXXX','2906',772,'Acomptes versés',0,NULL,NULL,1),(788,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','IMMO','XXXXXX','2907',772,'Créances douteuses (à ventiler comme clients 2900)',0,NULL,NULL,1),(789,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','IMMO','XXXXXX','2909',772,'Réductions de valeur actées (à ventiler comme clients 2900)',0,NULL,NULL,1),(790,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','IMMO','XXXXXX','291',771,'Autres créances',0,NULL,NULL,1),(791,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','IMMO','XXXXXX','2910',790,'Créances en compte',0,NULL,NULL,1),(792,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','IMMO','XXXXXX','29100',791,'Sur entreprises liées',0,NULL,NULL,1),(793,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','IMMO','XXXXXX','29101',791,'Sur entreprises avec lesquelles il existe un lien de participation',0,NULL,NULL,1),(794,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','IMMO','XXXXXX','29102',791,'Sur autres débiteurs',0,NULL,NULL,1),(795,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','IMMO','XXXXXX','2911',790,'Effets à recevoir',0,NULL,NULL,1),(796,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','IMMO','XXXXXX','29110',795,'Sur entreprises liées',0,NULL,NULL,1),(797,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','IMMO','XXXXXX','29111',795,'Sur entreprises avec lesquelles il existe un lien de participation',0,NULL,NULL,1),(798,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','IMMO','XXXXXX','29112',795,'Sur autres débiteurs',0,NULL,NULL,1),(799,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','IMMO','XXXXXX','2912',790,'Créances résultant de la cession d\'immobilisations données en leasing',0,NULL,NULL,1),(800,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','IMMO','XXXXXX','2917',790,'Créances douteuses',0,NULL,NULL,1),(801,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','IMMO','XXXXXX','2919',790,'Réductions de valeur actées',0,NULL,NULL,1),(802,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','STOCK','XXXXXX','30',1353,'Approvisionnements - matières premières',0,NULL,NULL,1),(803,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','STOCK','XXXXXX','300',802,'Valeur d\'acquisition',0,NULL,NULL,1),(804,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','STOCK','XXXXXX','309',802,'Réductions de valeur actées',0,NULL,NULL,1),(805,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','STOCK','XXXXXX','31',1353,'Approvsionnements et fournitures',0,NULL,NULL,1),(806,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','STOCK','XXXXXX','310',805,'Valeur d\'acquisition',0,NULL,NULL,1),(807,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','STOCK','XXXXXX','3100',806,'Matières d\'approvisionnement',0,NULL,NULL,1),(808,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','STOCK','XXXXXX','3101',806,'Energie, charbon, coke, mazout, essence, propane',0,NULL,NULL,1),(809,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','STOCK','XXXXXX','3102',806,'Produits d\'entretien',0,NULL,NULL,1),(810,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','STOCK','XXXXXX','3103',806,'Fournitures diverses et petit outillage',0,NULL,NULL,1),(811,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','STOCK','XXXXXX','3104',806,'Imprimés et fournitures de bureau',0,NULL,NULL,1),(812,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','STOCK','XXXXXX','3105',806,'Fournitures de services sociaux',0,NULL,NULL,1),(813,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','STOCK','XXXXXX','3106',806,'Emballages commerciaux',0,NULL,NULL,1),(814,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','STOCK','XXXXXX','31060',813,'Emballages perdus',0,NULL,NULL,1),(815,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','STOCK','XXXXXX','31061',813,'Emballages récupérables',0,NULL,NULL,1),(816,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','STOCK','XXXXXX','319',805,'Réductions de valeur actées',0,NULL,NULL,1),(817,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','STOCK','XXXXXX','32',1353,'En cours de fabrication',0,NULL,NULL,1),(818,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','STOCK','XXXXXX','320',817,'Valeur d\'acquisition',0,NULL,NULL,1),(819,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','STOCK','XXXXXX','3200',818,'Produits semi-ouvrés',0,NULL,NULL,1),(820,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','STOCK','XXXXXX','3201',818,'Produits en cours de fabrication',0,NULL,NULL,1),(821,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','STOCK','XXXXXX','3202',818,'Travaux en cours',0,NULL,NULL,1),(822,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','STOCK','XXXXXX','3205',818,'Déchets',0,NULL,NULL,1),(823,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','STOCK','XXXXXX','3206',818,'Rebuts',0,NULL,NULL,1),(824,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','STOCK','XXXXXX','3209',818,'Travaux en association momentanée',0,NULL,NULL,1),(825,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','STOCK','XXXXXX','329',817,'Réductions de valeur actées',0,NULL,NULL,1),(826,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','STOCK','XXXXXX','33',1353,'Produits finis',0,NULL,NULL,1),(827,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','STOCK','XXXXXX','330',826,'Valeur d\'acquisition',0,NULL,NULL,1),(828,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','STOCK','XXXXXX','3300',827,'Produits finis',0,NULL,NULL,1),(829,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','STOCK','XXXXXX','339',826,'Réductions de valeur actées',0,NULL,NULL,1),(830,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','STOCK','XXXXXX','34',1353,'Marchandises',0,NULL,NULL,1),(831,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','STOCK','XXXXXX','340',830,'Valeur d\'acquisition',0,NULL,NULL,1),(832,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','STOCK','XXXXXX','3400',831,'Groupe A',0,NULL,NULL,1),(833,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','STOCK','XXXXXX','3401',831,'Groupe B',0,NULL,NULL,1),(834,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','STOCK','XXXXXX','3402',831,'Groupe C',0,NULL,NULL,1),(835,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','STOCK','XXXXXX','349',830,'Réductions de valeur actées',0,NULL,NULL,1),(836,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','STOCK','XXXXXX','35',1353,'Immeubles destinés à la vente',0,NULL,NULL,1),(837,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','STOCK','XXXXXX','350',836,'Valeur d\'acquisition',0,NULL,NULL,1),(838,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','STOCK','XXXXXX','3500',837,'Immeuble A',0,NULL,NULL,1),(839,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','STOCK','XXXXXX','3501',837,'Immeuble B',0,NULL,NULL,1),(840,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','STOCK','XXXXXX','3502',837,'Immeuble C',0,NULL,NULL,1),(841,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','STOCK','XXXXXX','351',836,'Immeubles construits en vue de leur revente',0,NULL,NULL,1),(842,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','STOCK','XXXXXX','3510',841,'Immeuble A',0,NULL,NULL,1),(843,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','STOCK','XXXXXX','3511',841,'Immeuble B',0,NULL,NULL,1),(844,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','STOCK','XXXXXX','3512',841,'Immeuble C',0,NULL,NULL,1),(845,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','STOCK','XXXXXX','359',836,'Réductions de valeurs actées',0,NULL,NULL,1),(846,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','STOCK','XXXXXX','36',1353,'Acomptes versés sur achats pour stocks',0,NULL,NULL,1),(847,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','STOCK','XXXXXX','360',846,'Acomptes versés (à ventiler éventuellement par catégorie)',0,NULL,NULL,1),(848,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','STOCK','XXXXXX','369',846,'Réductions de valeur actées',0,NULL,NULL,1),(849,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','STOCK','XXXXXX','37',1353,'Commandes en cours d\'exécution',0,NULL,NULL,1),(850,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','STOCK','XXXXXX','370',849,'Valeur d\'acquisition',0,NULL,NULL,1),(851,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','STOCK','XXXXXX','371',849,'Bénéfice pris en compte',0,NULL,NULL,1),(852,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','STOCK','XXXXXX','379',849,'Réductions de valeur actées',0,NULL,NULL,1),(853,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','40',1354,'Créances commerciales',0,NULL,NULL,1),(854,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','400',853,'Clients',0,NULL,NULL,1),(855,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4007',854,'Rabais, remises et ristournes à accorder et autres notes de crédit à établir',0,NULL,NULL,1),(856,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4008',854,'Créances résultant de livraisons de biens (associations momentanées)',0,NULL,NULL,1),(857,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','401',853,'Effets à recevoir',0,NULL,NULL,1),(858,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4010',857,'Effets à recevoir',0,NULL,NULL,1),(859,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4013',857,'Effets à l\'encaissement',0,NULL,NULL,1),(860,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4015',857,'Effets à l\'escompte',0,NULL,NULL,1),(861,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','402',853,'Clients, créances courantes, entreprises apparentées, administrateurs et gérants',0,NULL,NULL,1),(862,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4020',861,'Entreprises liées',0,NULL,NULL,1),(863,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4021',861,'Autres entreprises avec lesquelles il existe un lien de participation',0,NULL,NULL,1),(864,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4022',861,'Administrateurs et gérants d\'entreprise',0,NULL,NULL,1),(865,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','403',853,'Effets à recevoir sur entreprises apparentées et administrateurs et gérants',0,NULL,NULL,1),(866,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4030',865,'Entreprises liées',0,NULL,NULL,1),(867,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4031',865,'Autres entreprises avec lesquelles il existe un lien de participation',0,NULL,NULL,1),(868,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4032',865,'Administrateurs et gérants de l\'entreprise',0,NULL,NULL,1),(869,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','404',853,'Produits à recevoir (factures à établir)',0,NULL,NULL,1),(870,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','405',853,'Clients : retenues sur garanties',0,NULL,NULL,1),(871,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','406',853,'Acomptes versés',0,NULL,NULL,1),(872,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','407',853,'Créances douteuses',0,NULL,NULL,1),(873,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','408',853,'Compensation clients',0,NULL,NULL,1),(874,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','409',853,'Réductions de valeur actées',0,NULL,NULL,1),(875,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','41',1354,'Autres créances',0,NULL,NULL,1),(876,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','410',875,'Capital appelé, non versé',0,NULL,NULL,1),(877,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4100',876,'Appels de fonds',0,NULL,NULL,1),(878,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4101',876,'Actionnaires défaillants',0,NULL,NULL,1),(879,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','411',875,'T.V.A. à récupérer',0,NULL,NULL,1),(880,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4110',879,'T.V.A. due',0,NULL,NULL,1),(881,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4111',879,'T.V.A. déductible',0,NULL,NULL,1),(882,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4112',879,'Compte courant administration T.V.A.',0,NULL,NULL,1),(883,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4118',879,'Taxe d\'égalisation due',0,NULL,NULL,1),(884,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','412',875,'Impôts et versements fiscaux à récupérer',0,NULL,NULL,1),(885,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4120',884,'Impôts belges sur le résultat',0,NULL,NULL,1),(886,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4125',884,'Autres impôts belges',0,NULL,NULL,1),(887,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4128',884,'Impôts étrangers',0,NULL,NULL,1),(888,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','414',875,'Produits à recevoir',0,NULL,NULL,1),(889,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','416',875,'Créances diverses',0,NULL,NULL,1),(890,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4160',889,'Associés (compte d\'apport en société)',0,NULL,NULL,1),(891,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4161',889,'Avances et prêts au personnel',0,NULL,NULL,1),(892,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4162',889,'Compte courant des associés en S.P.R.L.',0,NULL,NULL,1),(893,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4163',889,'Compte courant des administrateurs et gérants',0,NULL,NULL,1),(894,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4164',889,'Créances sur sociétés apparentées',0,NULL,NULL,1),(895,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4166',889,'Emballages et matériel à rendre',0,NULL,NULL,1),(896,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4167',889,'Etat et établissements publics',0,NULL,NULL,1),(897,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','41670',896,'Subsides à recevoir',0,NULL,NULL,1),(898,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','41671',896,'Autres créances',0,NULL,NULL,1),(899,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4168',889,'Rabais, ristournes et remises à obtenir et autres avoirs non encore reçus',0,NULL,NULL,1),(900,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','417',875,'Créances douteuses',0,NULL,NULL,1),(901,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','418',875,'Cautionnements versés en numéraires',0,NULL,NULL,1),(902,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','419',875,'Réductions de valeur actées',0,NULL,NULL,1),(903,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','42',1354,'Dettes à plus d\'un an échéant dans l\'année',0,NULL,NULL,1),(904,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','420',903,'Emprunts subordonnés',0,NULL,NULL,1),(905,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4200',904,'Convertibles',0,NULL,NULL,1),(906,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4201',904,'Non convertibles',0,NULL,NULL,1),(907,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','421',903,'Emprunts obligataires non subordonnés',0,NULL,NULL,1),(908,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4210',907,'Convertibles',0,NULL,NULL,1),(909,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4211',907,'Non convertibles',0,NULL,NULL,1),(910,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','422',903,'Dettes de location-financement et assimilées',0,NULL,NULL,1),(911,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4220',910,'Financement de biens immobiliers',0,NULL,NULL,1),(912,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4221',910,'Financement de biens mobiliers',0,NULL,NULL,1),(913,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','423',903,'Etablissements de crédit',0,NULL,NULL,1),(914,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4230',913,'Dettes en compte',0,NULL,NULL,1),(915,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4231',913,'Promesses',0,NULL,NULL,1),(916,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4232',913,'Crédits d\'acceptation',0,NULL,NULL,1),(917,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','424',903,'Autres emprunts',0,NULL,NULL,1),(918,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','425',903,'Dettes commerciales',0,NULL,NULL,1),(919,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4250',918,'Fournisseurs',0,NULL,NULL,1),(920,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4251',918,'Effets à payer',0,NULL,NULL,1),(921,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','426',903,'Cautionnements reçus en numéraires',0,NULL,NULL,1),(922,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','429',903,'Dettes diverses',0,NULL,NULL,1),(923,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4290',922,'Entreprises liées',0,NULL,NULL,1),(924,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4291',922,'Entreprises avec lesquelles il existe un lien de participation',0,NULL,NULL,1),(925,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4292',922,'Administrateurs, gérants, associés',0,NULL,NULL,1),(926,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4299',922,'Autres dettes',0,NULL,NULL,1),(927,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','43',1354,'Dettes financières',0,NULL,NULL,1),(928,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','430',927,'Etablissements de crédit. Emprunts en compte à terme fixe',0,NULL,NULL,1),(929,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','431',927,'Etablissements de crédit. Promesses',0,NULL,NULL,1),(930,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','432',927,'Etablissements de crédit. Crédits d\'acceptation',0,NULL,NULL,1),(931,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','433',927,'Etablissements de crédit. Dettes en compte courant',0,NULL,NULL,1),(932,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','439',927,'Autres emprunts',0,NULL,NULL,1),(933,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','44',1354,'Dettes commerciales',0,NULL,NULL,1),(934,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','440',933,'Fournisseurs',0,NULL,NULL,1),(935,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4400',934,'Entreprises apparentées',0,NULL,NULL,1),(936,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','44000',935,'Entreprises liées',0,NULL,NULL,1),(937,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','44001',935,'Entreprises avec lesquelles il existe un lien de participation',0,NULL,NULL,1),(938,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4401',934,'Fournisseurs ordinaires',0,NULL,NULL,1),(939,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','44010',938,'Fournisseurs belges',0,NULL,NULL,1),(940,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','44011',938,'Fournisseurs CEE',0,NULL,NULL,1),(941,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','44012',938,'Fournisseurs importation',0,NULL,NULL,1),(942,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4402',934,'Dettes envers les coparticipants (associations momentanées)',0,NULL,NULL,1),(943,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4403',934,'Fournisseurs - retenues de garanties',0,NULL,NULL,1),(944,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','441',933,'Effets à payer',0,NULL,NULL,1),(945,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4410',944,'Entreprises apparentées',0,NULL,NULL,1),(946,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','44100',945,'Entreprises liées',0,NULL,NULL,1),(947,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','44101',945,'Entreprises avec lesquelles il existe un lien de participation',0,NULL,NULL,1),(948,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4411',944,'Fournisseurs ordinaires',0,NULL,NULL,1),(949,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','44110',948,'Fournisseurs belges',0,NULL,NULL,1),(950,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','44111',948,'Fournisseurs CEE',0,NULL,NULL,1),(951,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','44112',948,'Fournisseurs importation',0,NULL,NULL,1),(952,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','444',933,'Factures à recevoir',0,NULL,NULL,1),(953,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','446',933,'Acomptes reçus',0,NULL,NULL,1),(954,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','448',933,'Compensations fournisseurs',0,NULL,NULL,1),(955,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','45',1354,'Dettes fiscales, salariales et sociales',0,NULL,NULL,1),(956,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','450',955,'Dettes fiscales estimées',0,NULL,NULL,1),(957,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4501',956,'Impôts sur le résultat',0,NULL,NULL,1),(958,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4505',956,'Autres impôts en Belgique',0,NULL,NULL,1),(959,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4508',956,'Impôts à l\'étranger',0,NULL,NULL,1),(960,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','451',955,'T.V.A. à payer',0,NULL,NULL,1),(961,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4510',960,'T.V.A. due',0,NULL,NULL,1),(962,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4511',960,'T.V.A. déductible',0,NULL,NULL,1),(963,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4512',960,'Compte courant administration T.V.A.',0,NULL,NULL,1),(964,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4518',960,'Taxe d\'égalisation due',0,NULL,NULL,1),(965,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','452',955,'Impôts et taxes à payer',0,NULL,NULL,1),(966,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4520',965,'Autres impôts sur le résultat',0,NULL,NULL,1),(967,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4525',965,'Autres impôts et taxes en Belgique',0,NULL,NULL,1),(968,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','45250',967,'Précompte immobilier',0,NULL,NULL,1),(969,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','45251',967,'Impôts communaux à payer',0,NULL,NULL,1),(970,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','45252',967,'Impôts provinciaux à payer',0,NULL,NULL,1),(971,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','45253',967,'Autres impôts et taxes à payer',0,NULL,NULL,1),(972,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4528',965,'Impôts et taxes à l\'étranger',0,NULL,NULL,1),(973,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','453',955,'Précomptes retenus',0,NULL,NULL,1),(974,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4530',973,'Précompte professionnel retenu sur rémunérations',0,NULL,NULL,1),(975,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4531',973,'Précompte professionnel retenu sur tantièmes',0,NULL,NULL,1),(976,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4532',973,'Précompte mobilier retenu sur dividendes attribués',0,NULL,NULL,1),(977,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4533',973,'Précompte mobilier retenu sur intérêts payés',0,NULL,NULL,1),(978,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4538',973,'Autres précomptes retenus',0,NULL,NULL,1),(979,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','454',955,'Office National de la Sécurité Sociale',0,NULL,NULL,1),(980,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4540',979,'Arriérés',0,NULL,NULL,1),(981,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4541',979,'1er trimestre',0,NULL,NULL,1),(982,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4542',979,'2ème trimestre',0,NULL,NULL,1),(983,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4543',979,'3ème trimestre',0,NULL,NULL,1),(984,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4544',979,'4ème trimestre',0,NULL,NULL,1),(985,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','455',955,'Rémunérations',0,NULL,NULL,1),(986,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4550',985,'Administrateurs, gérants et commissaires (non réviseurs)',0,NULL,NULL,1),(987,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4551',985,'Direction',0,NULL,NULL,1),(988,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4552',985,'Employés',0,NULL,NULL,1),(989,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4553',985,'Ouvriers',0,NULL,NULL,1),(990,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','456',955,'Pécules de vacances',0,NULL,NULL,1),(991,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4560',990,'Direction',0,NULL,NULL,1),(992,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4561',990,'Employés',0,NULL,NULL,1),(993,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4562',990,'Ouvriers',0,NULL,NULL,1),(994,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','459',955,'Autres dettes sociales',0,NULL,NULL,1),(995,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4590',994,'Provision pour gratifications de fin d\'année',0,NULL,NULL,1),(996,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4591',994,'Départs de personnel',0,NULL,NULL,1),(997,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4592',994,'Oppositions sur rémunérations',0,NULL,NULL,1),(998,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4593',994,'Assurances relatives au personnel',0,NULL,NULL,1),(999,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','45930',998,'Assurance loi',0,NULL,NULL,1),(1000,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','45931',998,'Assurance salaire garanti',0,NULL,NULL,1),(1001,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','45932',998,'Assurance groupe',0,NULL,NULL,1),(1002,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','45933',998,'Assurances individuelles',0,NULL,NULL,1),(1003,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4594',994,'Caisse d\'assurances sociales pour travailleurs indépendants',0,NULL,NULL,1),(1004,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4597',994,'Dettes et provisions sociales diverses',0,NULL,NULL,1),(1005,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','46',1354,'Acomptes reçus sur commande',0,NULL,NULL,1),(1006,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','47',1354,'Dettes découlant de l\'affectation des résultats',0,NULL,NULL,1),(1007,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','470',1006,'Dividendes et tantièmes d\'exercices antérieurs',0,NULL,NULL,1),(1008,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','471',1006,'Dividendes de l\'exercice',0,NULL,NULL,1),(1009,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','472',1006,'Tantièmes de l\'exercice',0,NULL,NULL,1),(1010,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','473',1006,'Autres allocataires',0,NULL,NULL,1),(1011,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','48',4,'Dettes diverses',0,NULL,NULL,1),(1012,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','480',1011,'Obligations et coupons échus',0,NULL,NULL,1),(1013,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','481',1011,'Actionnaires - capital à rembourser',0,NULL,NULL,1),(1014,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','482',1011,'Participation du personnel à payer',0,NULL,NULL,1),(1015,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','483',1011,'Acomptes reçus d\'autres tiers à moins d\'un an',0,NULL,NULL,1),(1016,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','486',1011,'Emballages et matériel consignés',0,NULL,NULL,1),(1017,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','488',1011,'Cautionnements reçus en numéraires',0,NULL,NULL,1),(1018,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','489',1011,'Autres dettes diverses',0,NULL,NULL,1),(1019,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','49',1354,'Comptes de régularisation et compte d\'attente',0,NULL,NULL,1),(1020,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','490',1019,'Charges à reporter (à subdiviser par catégorie de charges)',0,NULL,NULL,1),(1021,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','491',1019,'Produits acquis',0,NULL,NULL,1),(1022,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4910',1021,'Produits d\'exploitation',0,NULL,NULL,1),(1023,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','49100',1022,'Ristournes et rabais à obtenir',0,NULL,NULL,1),(1024,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','49101',1022,'Commissions à obtenir',0,NULL,NULL,1),(1025,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','49102',1022,'Autres produits d\'exploitation (redevances par exemple)',0,NULL,NULL,1),(1026,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4911',1021,'Produits financiers',0,NULL,NULL,1),(1027,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','49110',1026,'Intérêts courus et non échus sur prêts et débits',0,NULL,NULL,1),(1028,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','49111',1026,'Autres produits financiers',0,NULL,NULL,1),(1029,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','492',1019,'Charges à imputer (à subdiviser par catégorie de charges)',0,NULL,NULL,1),(1030,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','493',1019,'Produits à reporter',0,NULL,NULL,1),(1031,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4930',1030,'Produits d\'exploitation à reporter',0,NULL,NULL,1),(1032,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4931',1030,'Produits financiers à reporter',0,NULL,NULL,1),(1033,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','499',1019,'Comptes d\'attente',0,NULL,NULL,1),(1034,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4990',1033,'Compte d\'attente',0,NULL,NULL,1),(1035,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4991',1033,'Compte de répartition périodique des charges',0,NULL,NULL,1),(1036,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','TIERS','XXXXXX','4999',1033,'Transferts d\'exercice',0,NULL,NULL,1),(1037,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','FINAN','XXXXXX','50',1355,'Actions propres',0,NULL,NULL,1),(1038,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','FINAN','XXXXXX','51',1355,'Actions et parts',0,NULL,NULL,1),(1039,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','FINAN','XXXXXX','510',1038,'Valeur d\'acquisition',0,NULL,NULL,1),(1040,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','FINAN','XXXXXX','511',1038,'Montants non appelés',0,NULL,NULL,1),(1041,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','FINAN','XXXXXX','519',1038,'Réductions de valeur actées',0,NULL,NULL,1),(1042,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','FINAN','XXXXXX','52',1355,'Titres à revenus fixes',0,NULL,NULL,1),(1043,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','FINAN','XXXXXX','520',1042,'Valeur d\'acquisition',0,NULL,NULL,1),(1044,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','FINAN','XXXXXX','529',1042,'Réductions de valeur actées',0,NULL,NULL,1),(1045,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','FINAN','XXXXXX','53',1355,'Dépots à terme',0,NULL,NULL,1),(1046,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','FINAN','XXXXXX','530',1045,'De plus d\'un an',0,NULL,NULL,1),(1047,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','FINAN','XXXXXX','531',1045,'De plus d\'un mois et à un an au plus',0,NULL,NULL,1),(1048,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','FINAN','XXXXXX','532',1045,'d\'un mois au plus',0,NULL,NULL,1),(1049,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','FINAN','XXXXXX','539',1045,'Réductions de valeur actées',0,NULL,NULL,1),(1050,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','FINAN','XXXXXX','54',1355,'Valeurs échues à l\'encaissement',0,NULL,NULL,1),(1051,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','FINAN','XXXXXX','540',1050,'Chèques à encaisser',0,NULL,NULL,1),(1052,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','FINAN','XXXXXX','541',1050,'Coupons à encaisser',0,NULL,NULL,1),(1053,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','FINAN','XXXXXX','55',1355,'Etablissements de crédit - Comptes ouverts auprès des divers établissements.',0,NULL,NULL,1),(1054,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','FINAN','XXXXXX','550',1053,'Comptes courants',0,NULL,NULL,1),(1055,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','FINAN','XXXXXX','551',1053,'Chèques émis',0,NULL,NULL,1),(1056,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','FINAN','XXXXXX','559',1053,'Réductions de valeur actées',0,NULL,NULL,1),(1057,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','FINAN','XXXXXX','56',1355,'Office des chèques postaux',0,NULL,NULL,1),(1058,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','FINAN','XXXXXX','560',1057,'Compte courant',0,NULL,NULL,1),(1059,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','FINAN','XXXXXX','561',1057,'Chèques émis',0,NULL,NULL,1),(1060,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','FINAN','XXXXXX','57',1355,'Caisses',0,NULL,NULL,1),(1061,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','FINAN','XXXXXX','570',1060,'à 577 Caisses - espèces ( 0 - centrale ; 7 - succursales et agences)',0,NULL,NULL,1),(1062,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','FINAN','XXXXXX','578',1060,'Caisses - timbres ( 0 - fiscaux ; 1 - postaux)',0,NULL,NULL,1),(1063,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','FINAN','XXXXXX','58',1355,'Virements internes',0,NULL,NULL,1),(1064,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','60',1356,'Approvisionnements et marchandises',0,NULL,NULL,1),(1065,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','600',1064,'Achats de matières premières',0,NULL,NULL,1),(1066,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','601',1064,'Achats de fournitures',0,NULL,NULL,1),(1067,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','602',1064,'Achats de services, travaux et études',0,NULL,NULL,1),(1068,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','603',1064,'Sous-traitances générales',0,NULL,NULL,1),(1069,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','604',1064,'Achats de marchandises',0,NULL,NULL,1),(1070,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','605',1064,'Achats d\'immeubles destinés à la revente',0,NULL,NULL,1),(1071,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','608',1064,'Remises , ristournes et rabais obtenus sur achats',0,NULL,NULL,1),(1072,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','609',1064,'Variations de stocks',0,NULL,NULL,1),(1073,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6090',1072,'De matières premières',0,NULL,NULL,1),(1074,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6091',1072,'De fournitures',0,NULL,NULL,1),(1075,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6094',1072,'De marchandises',0,NULL,NULL,1),(1076,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6095',1072,'d\'immeubles destinés à la vente',0,NULL,NULL,1),(1077,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','61',1356,'Services et biens divers',0,NULL,NULL,1),(1078,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','610',1077,'Loyers et charges locatives',0,NULL,NULL,1),(1079,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6100',1078,'Loyers divers',0,NULL,NULL,1),(1080,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6101',1078,'Charges locatives (assurances, frais de confort,etc)',0,NULL,NULL,1),(1081,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','611',1077,'Entretien et réparation (fournitures et prestations)',0,NULL,NULL,1),(1082,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','612',1077,'Fournitures faites à l\'entreprise',0,NULL,NULL,1),(1083,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6120',1082,'Eau, gaz, électricité, vapeur',0,NULL,NULL,1),(1084,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','61200',1083,'Eau',0,NULL,NULL,1),(1085,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','61201',1083,'Gaz',0,NULL,NULL,1),(1086,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','61202',1083,'Electricité',0,NULL,NULL,1),(1087,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','61203',1083,'Vapeur',0,NULL,NULL,1),(1088,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6121',1082,'Téléphone, télégrammes, télex, téléfax, frais postaux',0,NULL,NULL,1),(1089,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','61210',1088,'Téléphone',0,NULL,NULL,1),(1090,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','61211',1088,'Télégrammes',0,NULL,NULL,1),(1091,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','61212',1088,'Télex et téléfax',0,NULL,NULL,1),(1092,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','61213',1088,'Frais postaux',0,NULL,NULL,1),(1093,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6122',1082,'Livres, bibliothèque',0,NULL,NULL,1),(1094,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6123',1082,'Imprimés et fournitures de bureau (si non comptabilisé au 601)',0,NULL,NULL,1),(1095,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','613',1077,'Rétributions de tiers',0,NULL,NULL,1),(1096,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6130',1095,'Redevances et royalties',0,NULL,NULL,1),(1097,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','61300',1096,'Redevances pour brevets, licences, marques et accessoires',0,NULL,NULL,1),(1098,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','61301',1096,'Autres redevances (procédés de fabrication)',0,NULL,NULL,1),(1099,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6131',1095,'Assurances non relatives au personnel',0,NULL,NULL,1),(1100,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','61310',1099,'Assurance incendie',0,NULL,NULL,1),(1101,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','61311',1099,'Assurance vol',0,NULL,NULL,1),(1102,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','61312',1099,'Assurance autos',0,NULL,NULL,1),(1103,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','61313',1099,'Assurance crédit',0,NULL,NULL,1),(1104,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','61314',1099,'Assurances frais généraux',0,NULL,NULL,1),(1105,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6132',1095,'Divers',0,NULL,NULL,1),(1106,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','61320',1105,'Commissions aux tiers',0,NULL,NULL,1),(1107,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','61321',1105,'Honoraires d\'avocats, d\'experts, etc',0,NULL,NULL,1),(1108,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','61322',1105,'Cotisations aux groupements professionnels',0,NULL,NULL,1),(1109,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','61323',1105,'Dons, libéralités, etc',0,NULL,NULL,1),(1110,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','61324',1105,'Frais de contentieux',0,NULL,NULL,1),(1111,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','61325',1105,'Publications légales',0,NULL,NULL,1),(1112,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6133',1095,'Transports et déplacements',0,NULL,NULL,1),(1113,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','61330',1112,'Transports de personnel',0,NULL,NULL,1),(1114,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','61331',1112,'Voyages, déplacements et représentations',0,NULL,NULL,1),(1115,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6134',1095,'Personnel intérimaire',0,NULL,NULL,1),(1116,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','614',1077,'Annonces, publicité, propagande et documentation',0,NULL,NULL,1),(1117,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6140',1116,'Annonces et insertions',0,NULL,NULL,1),(1118,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6141',1116,'Catalogues et imprimés',0,NULL,NULL,1),(1119,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6142',1116,'Echantillons',0,NULL,NULL,1),(1120,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6143',1116,'Foires et expositions',0,NULL,NULL,1),(1121,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6144',1116,'Primes',0,NULL,NULL,1),(1122,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6145',1116,'Cadeaux à la clientèle',0,NULL,NULL,1),(1123,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6146',1116,'Missions et réceptions',0,NULL,NULL,1),(1124,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6147',1116,'Documentation',0,NULL,NULL,1),(1125,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','615',1077,'Sous-traitants',0,NULL,NULL,1),(1126,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6150',1125,'Sous-traitants pour activités propres',0,NULL,NULL,1),(1127,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6151',1125,'Sous-traitants d\'associations momentanées (coparticipants)',0,NULL,NULL,1),(1128,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6152',1125,'Quote-part bénéficiaire des coparticipants',0,NULL,NULL,1),(1129,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','617',1077,'Personnel intérimaire et personnes mises à la disposition de l\'entreprise',0,NULL,NULL,1),(1130,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','618',1077,'Rémunérations, primes pour assurances extralégales, pensions de retraite et de survie des administrateurs, gérants et associés actifs qui ne sont pas attribuées en vertu d\'un contrat de travail',0,NULL,NULL,1),(1131,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','62',1356,'Rémunérations, charges sociales et pensions',0,NULL,NULL,1),(1132,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','620',1131,'Rémunérations et avantages sociaux directs',0,NULL,NULL,1),(1133,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6200',1132,'Administrateurs ou gérants',0,NULL,NULL,1),(1134,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6201',1132,'Personnel de direction',0,NULL,NULL,1),(1135,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6202',1132,'Employés',0,NULL,NULL,1),(1136,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6203',1132,'Ouvriers',0,NULL,NULL,1),(1137,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6204',1132,'Autres membres du personnel',0,NULL,NULL,1),(1138,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','621',1131,'Cotisations patronales d\'assurances sociales',0,NULL,NULL,1),(1139,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6210',1138,'Sur salaires',0,NULL,NULL,1),(1140,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6211',1138,'Sur appointements et commissions',0,NULL,NULL,1),(1141,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','622',1131,'Primes patronales pour assurances extralégales',0,NULL,NULL,1),(1142,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','623',1131,'Autres frais de personnel',0,NULL,NULL,1),(1143,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6230',1142,'Assurances du personnel',0,NULL,NULL,1),(1144,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','62300',1143,'Assurances loi, responsabilité civile, chemin du travail',0,NULL,NULL,1),(1145,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','62301',1143,'Assurance salaire garanti',0,NULL,NULL,1),(1146,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','62302',1143,'Assurances individuelles',0,NULL,NULL,1),(1147,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6231',1142,'Charges sociales diverses',0,NULL,NULL,1),(1148,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','62310',1147,'Jours fériés payés',0,NULL,NULL,1),(1149,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','62311',1147,'Salaire hebdomadaire garanti',0,NULL,NULL,1),(1150,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','62312',1147,'Allocations familiales complémentaires',0,NULL,NULL,1),(1151,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6232',1142,'Charges sociales des administrateurs, gérants et commissaires',0,NULL,NULL,1),(1152,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','62320',1151,'Allocations familiales complémentaires pour non salariés',0,NULL,NULL,1),(1153,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','62321',1151,'Lois sociales pour indépendants',0,NULL,NULL,1),(1154,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','62322',1151,'Divers',0,NULL,NULL,1),(1155,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','624',1131,'Pensions de retraite et de survie',0,NULL,NULL,1),(1156,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6240',1155,'Administrateurs et gérants',0,NULL,NULL,1),(1157,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6241',1155,'Personnel',0,NULL,NULL,1),(1158,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','625',1131,'Provision pour pécule de vacances',0,NULL,NULL,1),(1159,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6250',1158,'Dotations',0,NULL,NULL,1),(1160,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6251',1158,'Utilisations et reprises',0,NULL,NULL,1),(1161,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','63',1356,'Amortissements, réductions de valeur et provisions pour risques et charges',0,NULL,NULL,1),(1162,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','630',1161,'Dotations aux amortissements et aux réductions de valeur sur immobilisations',0,NULL,NULL,1),(1163,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6300',1162,'Dotations aux amortissements sur frais d\'établissement',0,NULL,NULL,1),(1164,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6301',1162,'Dotations aux amortissements sur immobilisations incorporelles',0,NULL,NULL,1),(1165,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6302',1162,'Dotations aux amortissements sur immobilisations corporelles',0,NULL,NULL,1),(1166,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6308',1162,'Dotations aux réductions de valeur sur immobilisations incorporelles',0,NULL,NULL,1),(1167,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6309',1162,'Dotations aux réductions de valeur sur immobilisations corporelles',0,NULL,NULL,1),(1168,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','631',1161,'Réductions de valeur sur stocks',0,NULL,NULL,1),(1169,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6310',1168,'Dotations',0,NULL,NULL,1),(1170,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6311',1168,'Reprises',0,NULL,NULL,1),(1171,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','632',1161,'Réductions de valeur sur commandes en cours d\'exécution',0,NULL,NULL,1),(1172,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6320',1171,'Dotations',0,NULL,NULL,1),(1173,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6321',1171,'Reprises',0,NULL,NULL,1),(1174,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','633',1161,'Réductions de valeur sur créances commerciales à plus d\'un an',0,NULL,NULL,1),(1175,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6330',1174,'Dotations',0,NULL,NULL,1),(1176,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6331',1174,'Reprises',0,NULL,NULL,1),(1177,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','634',1161,'Réductions de valeur sur créances commerciales à un an au plus',0,NULL,NULL,1),(1178,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6340',1177,'Dotations',0,NULL,NULL,1),(1179,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6341',1177,'Reprises',0,NULL,NULL,1),(1180,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','635',1161,'Provisions pour pensions et obligations similaires',0,NULL,NULL,1),(1181,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6350',1180,'Dotations',0,NULL,NULL,1),(1182,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6351',1180,'Utilisations et reprises',0,NULL,NULL,1),(1183,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','636',11613,'Provisions pour grosses réparations et gros entretiens',0,NULL,NULL,1),(1184,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6360',1183,'Dotations',0,NULL,NULL,1),(1185,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6361',1183,'Utilisations et reprises',0,NULL,NULL,1),(1186,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','637',1161,'Provisions pour autres risques et charges',0,NULL,NULL,1),(1187,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6370',1186,'Dotations',0,NULL,NULL,1),(1188,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6371',1186,'Utilisations et reprises',0,NULL,NULL,1),(1189,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','64',1356,'Autres charges d\'exploitation',0,NULL,NULL,1),(1190,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','640',1189,'Charges fiscales d\'exploitation',0,NULL,NULL,1),(1191,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6400',1190,'Taxes et impôts directs',0,NULL,NULL,1),(1192,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','64000',1191,'Taxes sur autos et camions',0,NULL,NULL,1),(1193,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6401',1190,'Taxes et impôts indirects',0,NULL,NULL,1),(1194,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','64010',1193,'Timbres fiscaux pris en charge par la firme',0,NULL,NULL,1),(1195,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','64011',1193,'Droits d\'enregistrement',0,NULL,NULL,1),(1196,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','64012',1193,'T.V.A. non déductible',0,NULL,NULL,1),(1197,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6402',1190,'Impôts provinciaux et communaux',0,NULL,NULL,1),(1198,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','64020',1197,'Taxe sur la force motrice',0,NULL,NULL,1),(1199,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','64021',1197,'Taxe sur le personnel occupé',0,NULL,NULL,1),(1200,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6403',1190,'Taxes diverses',0,NULL,NULL,1),(1201,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','641',1189,'Moins-values sur réalisations courantes d\'immobilisations corporelles',0,NULL,NULL,1),(1202,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','642',1189,'Moins-values sur réalisations de créances commerciales',0,NULL,NULL,1),(1203,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','643',1189,'à 648 Charges d\'exploitations diverses',0,NULL,NULL,1),(1204,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','649',1189,'Charges d\'exploitation portées à l\'actif au titre de restructuration',0,NULL,NULL,1),(1205,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','65',1356,'Charges financières',0,NULL,NULL,1),(1206,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','650',1205,'Charges des dettes',0,NULL,NULL,1),(1207,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6500',1206,'Intérêts, commissions et frais afférents aux dettes',0,NULL,NULL,1),(1208,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6501',1206,'Amortissements des agios et frais d\'émission d\'emprunts',0,NULL,NULL,1),(1209,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6502',1206,'Autres charges de dettes',0,NULL,NULL,1),(1210,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6503',1206,'Intérêts intercalaires portés à l\'actif',0,NULL,NULL,1),(1211,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','651',1205,'Réductions de valeur sur actifs circulants',0,NULL,NULL,1),(1212,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6510',1211,'Dotations',0,NULL,NULL,1),(1213,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6511',1211,'Reprises',0,NULL,NULL,1),(1214,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','652',1205,'Moins-values sur réalisation d\'actifs circulants',0,NULL,NULL,1),(1215,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','653',1205,'Charges d\'escompte de créances',0,NULL,NULL,1),(1216,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','654',1205,'Différences de change',0,NULL,NULL,1),(1217,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','655',1205,'Ecarts de conversion des devises',0,NULL,NULL,1),(1218,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','656',1205,'Frais de banques, de chèques postaux',0,NULL,NULL,1),(1219,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','657',1205,'Commissions sur ouvertures de crédit, cautions et avals',0,NULL,NULL,1),(1220,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','658',1205,'Frais de vente des titres',0,NULL,NULL,1),(1221,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','66',1356,'Charges exceptionnelles',0,NULL,NULL,1),(1222,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','660',1221,'Amortissements et réductions de valeur exceptionnels',0,NULL,NULL,1),(1223,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6600',1222,'Sur frais d\'établissement',0,NULL,NULL,1),(1224,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6601',1222,'Sur immobilisations incorporelles',0,NULL,NULL,1),(1225,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6602',1222,'Sur immobilisations corporelles',0,NULL,NULL,1),(1226,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','661',1221,'Réductions de valeur sur immobilisations financières',0,NULL,NULL,1),(1227,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','662',1221,'Provisions pour risques et charges exceptionnels',0,NULL,NULL,1),(1228,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','663',1221,'Moins-values sur réalisation d\'actifs immobilisés',0,NULL,NULL,1),(1229,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6630',1228,'Sur immobilisations incorporelles',0,NULL,NULL,1),(1230,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6631',1228,'Sur immobilisations corporelles',0,NULL,NULL,1),(1231,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6632',1228,'Sur immobilisations détenues en location-financement et droits similaires',0,NULL,NULL,1),(1232,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6633',1228,'Sur immobilisations financières',0,NULL,NULL,1),(1233,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6634',1228,'Sur immeubles acquis ou construits en vue de la revente',0,NULL,NULL,1),(1234,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','664',1221,'à 668 Autres charges exceptionnelles',0,NULL,NULL,1),(1235,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','664',1221,'Pénalités et amendes diverses',0,NULL,NULL,1),(1236,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','665',1221,'Différence de charge',0,NULL,NULL,1),(1237,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','669',1221,'Charges exceptionnelles transférées à l\'actif en frais de restructuration',0,NULL,NULL,1),(1238,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','67',1356,'Impôts sur le résultat',0,NULL,NULL,1),(1239,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','670',1238,'Impôts belges sur le résultat de l\'exercice',0,NULL,NULL,1),(1240,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6700',1239,'Impôts et précomptes dus ou versés',0,NULL,NULL,1),(1241,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6701',1239,'Excédent de versements d\'impôts et précomptes porté à l\'actif',0,NULL,NULL,1),(1242,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6702',1239,'Charges fiscales estimées',0,NULL,NULL,1),(1243,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','671',1238,'Impôts belges sur le résultat d\'exercices antérieurs',0,NULL,NULL,1),(1244,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6710',1243,'Suppléments d\'impôts dus ou versés',0,NULL,NULL,1),(1245,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6711',1243,'Suppléments d\'impôts estimés',0,NULL,NULL,1),(1246,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','6712',1243,'Provisions fiscales constituées',0,NULL,NULL,1),(1247,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','672',1238,'Impôts étrangers sur le résultat de l\'exercice',0,NULL,NULL,1),(1248,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','673',1238,'Impôts étrangers sur le résultat d\'exercices antérieurs',0,NULL,NULL,1),(1249,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','68',1356,'Transferts aux réserves immunisées',0,NULL,NULL,1),(1250,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','69',1356,'Affectation des résultats',0,NULL,NULL,1),(1251,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','690',1250,'Perte reportée de l\'exercice précédent',0,NULL,NULL,1),(1252,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','691',1250,'Dotation à la réserve légale',0,NULL,NULL,1),(1253,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','692',1250,'Dotation aux autres réserves',0,NULL,NULL,1),(1254,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','693',1250,'Bénéfice à reporter',0,NULL,NULL,1),(1255,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','694',1250,'Rémunération du capital',0,NULL,NULL,1),(1256,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','695',1250,'Administrateurs ou gérants',0,NULL,NULL,1),(1257,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','CHARGE','XXXXXX','696',1250,'Autres allocataires',0,NULL,NULL,1),(1258,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','70',1357,'Chiffre d\'affaires',0,NULL,NULL,1),(1260,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','700',1258,'Ventes de marchandises',0,NULL,NULL,1),(1261,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','7000',1260,'Ventes en Belgique',0,NULL,NULL,1),(1262,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','7001',1260,'Ventes dans les pays membres de la C.E.E.',0,NULL,NULL,1),(1263,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','7002',1260,'Ventes à l\'exportation',0,NULL,NULL,1),(1264,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','701',1258,'Ventes de produits finis',0,NULL,NULL,1),(1265,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','7010',1264,'Ventes en Belgique',0,NULL,NULL,1),(1266,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','7011',1264,'Ventes dans les pays membres de la C.E.E.',0,NULL,NULL,1),(1267,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','7012',1264,'Ventes à l\'exportation',0,NULL,NULL,1),(1268,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','702',1258,'Ventes de déchets et rebuts',0,NULL,NULL,1),(1269,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','7020',1268,'Ventes en Belgique',0,NULL,NULL,1),(1270,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','7021',1268,'Ventes dans les pays membres de la C.E.E.',0,NULL,NULL,1),(1271,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','7022',1268,'Ventes à l\'exportation',0,NULL,NULL,1),(1272,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','703',1258,'Ventes d\'emballages récupérables',0,NULL,NULL,1),(1273,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','704',1258,'Facturations des travaux en cours (associations momentanées)',0,NULL,NULL,1),(1274,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','705',1258,'Prestations de services',0,NULL,NULL,1),(1275,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','7050',1274,'Prestations de services en Belgique',0,NULL,NULL,1),(1276,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','7051',1274,'Prestations de services dans les pays membres de la C.E.E.',0,NULL,NULL,1),(1277,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','7052',1274,'Prestations de services en vue de l\'exportation',0,NULL,NULL,1),(1278,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','706',1258,'Pénalités et dédits obtenus par l\'entreprise',0,NULL,NULL,1),(1279,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','708',1258,'Remises, ristournes et rabais accordés',0,NULL,NULL,1),(1280,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','7080',1279,'Sur ventes de marchandises',0,NULL,NULL,1),(1281,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','7081',1279,'Sur ventes de produits finis',0,NULL,NULL,1),(1282,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','7082',1279,'Sur ventes de déchets et rebuts',0,NULL,NULL,1),(1283,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','7083',1279,'Sur prestations de services',0,NULL,NULL,1),(1284,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','7084',1279,'Mali sur travaux facturés aux associations momentanées',0,NULL,NULL,1),(1285,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','71',1357,'Variation des stocks et des commandes en cours d\'exécution',0,NULL,NULL,1),(1286,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','712',1285,'Des en cours de fabrication',0,NULL,NULL,1),(1287,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','713',1285,'Des produits finis',0,NULL,NULL,1),(1288,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','715',1285,'Des immeubles construits destinés à la vente',0,NULL,NULL,1),(1289,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','717',1285,'Des commandes en cours d\'exécution',0,NULL,NULL,1),(1290,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','7170',1289,'Commandes en cours - Coût de revient',0,NULL,NULL,1),(1291,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','71700',1290,'Coût des commandes en cours d\'exécution',0,NULL,NULL,1),(1292,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','71701',1290,'Coût des travaux en cours des associations momentanées',0,NULL,NULL,1),(1293,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','7171',1289,'Bénéfices portés en compte sur commandes en cours',0,NULL,NULL,1),(1294,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','71710',1293,'Sur commandes en cours d\'exécution',0,NULL,NULL,1),(1295,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','71711',1293,'Sur travaux en cours des associations momentanées',0,NULL,NULL,1),(1296,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','72',1357,'Production immobilisée',0,NULL,NULL,1),(1297,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','720',1296,'En frais d\'établissement',0,NULL,NULL,1),(1298,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','721',1296,'En immobilisations incorporelles',0,NULL,NULL,1),(1299,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','722',1296,'En immobilisations corporelles',0,NULL,NULL,1),(1300,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','723',1296,'En immobilisations en cours',0,NULL,NULL,1),(1301,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','74',1357,'Autres produits d\'exploitation',0,NULL,NULL,1),(1302,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','740',1301,'Subsides d\'exploitation et montants compensatoires',0,NULL,NULL,1),(1303,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','741',1301,'Plus-values sur réalisations courantes d\'immobilisations corporelles',0,NULL,NULL,1),(1304,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','742',1301,'Plus-values sur réalisations de créances commerciales',0,NULL,NULL,1),(1305,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','743',1301,'à 749 Produits d\'exploitation divers',0,NULL,NULL,1),(1306,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','743',1301,'Produits de services exploités dans l\'intérêt du personnel',0,NULL,NULL,1),(1307,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','744',1301,'Commissions et courtages',0,NULL,NULL,1),(1308,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','745',1301,'Redevances pour brevets et licences',0,NULL,NULL,1),(1309,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','746',1301,'Prestations de services (transports, études, etc)',0,NULL,NULL,1),(1310,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','747',1301,'Revenus des immeubles affectés aux activités non professionnelles',0,NULL,NULL,1),(1311,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','748',1301,'Locations diverses à caractère professionnel',0,NULL,NULL,1),(1312,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','749',1301,'Produits divers',0,NULL,NULL,1),(1313,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','7490',1312,'Bonis sur reprises d\'emballages consignés',0,NULL,NULL,1),(1314,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','7491',1312,'Bonis sur travaux en associations momentanées',0,NULL,NULL,1),(1315,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','75',1357,'Produits financiers',0,NULL,NULL,1),(1316,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','750',1315,'Produits des immobilisations financières',0,NULL,NULL,1),(1317,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','7500',1316,'Revenus des actions',0,NULL,NULL,1),(1318,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','7501',1316,'Revenus des obligations',0,NULL,NULL,1),(1319,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','7502',1316,'Revenus des créances à plus d\'un an',0,NULL,NULL,1),(1320,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','751',1315,'Produits des actifs circulants',0,NULL,NULL,1),(1321,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','752',1315,'Plus-values sur réalisations d\'actifs circulants',0,NULL,NULL,1),(1322,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','753',1315,'Subsides en capital et en intérêts',0,NULL,NULL,1),(1323,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','754',1315,'Différences de change',0,NULL,NULL,1),(1324,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','755',1315,'Ecarts de conversion des devises',0,NULL,NULL,1),(1325,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','756',1315,'à 759 Produits financiers divers',0,NULL,NULL,1),(1326,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','756',1315,'Produits des autres créances',0,NULL,NULL,1),(1327,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','757',1315,'Escomptes obtenus',0,NULL,NULL,1),(1328,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','76',1357,'Produits exceptionnels',0,NULL,NULL,1),(1329,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','760',1328,'Reprises d\'amortissements et de réductions de valeur',0,NULL,NULL,1),(1330,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','7600',1329,'Sur immobilisations incorporelles',0,NULL,NULL,1),(1331,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','7601',1329,'Sur immobilisations corporelles',0,NULL,NULL,1),(1332,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','761',1328,'Reprises de réductions de valeur sur immobilisations financières',0,NULL,NULL,1),(1333,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','762',1328,'Reprises de provisions pour risques et charges exceptionnelles',0,NULL,NULL,1),(1334,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','763',1328,'Plus-values sur réalisation d\'actifs immobilisés',0,NULL,NULL,1),(1335,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','7630',1334,'Sur immobilisations incorporelles',0,NULL,NULL,1),(1336,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','7631',1334,'Sur immobilisations corporelles',0,NULL,NULL,1),(1337,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','7632',1334,'Sur immobilisations financières',0,NULL,NULL,1),(1338,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','764',1328,'Autres produits exceptionnels',0,NULL,NULL,1),(1339,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','77',1357,'Régularisations d\'impôts et reprises de provisions fiscales',0,NULL,NULL,1),(1340,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','771',1339,'Impôts belges sur le résultat',0,NULL,NULL,1),(1341,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','7710',1340,'Régularisations d\'impôts dus ou versés',0,NULL,NULL,1),(1342,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','7711',1340,'Régularisations d\'impôts estimés',0,NULL,NULL,1),(1343,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','7712',1340,'Reprises de provisions fiscales',0,NULL,NULL,1),(1344,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','773',1339,'Impôts étrangers sur le résultat',0,NULL,NULL,1),(1345,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','79',1357,'Affectation aux résultats',0,NULL,NULL,1),(1346,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','790',1345,'Bénéfice reporté de l\'exercice précédent',0,NULL,NULL,1),(1347,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','791',1345,'Prélèvement sur le capital et les primes d\'émission',0,NULL,NULL,1),(1348,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','792',1345,'Prélèvement sur les réserves',0,NULL,NULL,1),(1349,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','793',1345,'Perte à reporter',0,NULL,NULL,1),(1350,1,NULL,'2016-01-22 17:28:16','PCMN-BASE','PROD','XXXXXX','794',1345,'Intervention d\'associés (ou du propriétaire) dans la perte',0,NULL,NULL,1),(1351,1,NULL,'2016-07-30 11:12:54','PCMN-BASE','CAPIT','XXXXXX','1',0,'Fonds propres, provisions pour risques et charges et dettes à plus d\'un an',0,NULL,NULL,1),(1352,1,NULL,'2016-07-30 11:12:54','PCMN-BASE','IMMO','XXXXXX','2',0,'Frais d\'établissement. Actifs immobilisés et créances à plus d\'un an',0,NULL,NULL,1),(1353,1,NULL,'2016-07-30 11:12:54','PCMN-BASE','STOCK','XXXXXX','3',0,'Stock et commandes en cours d\'exécution',0,NULL,NULL,1),(1354,1,NULL,'2016-07-30 11:12:54','PCMN-BASE','TIERS','XXXXXX','4',0,'Créances et dettes à un an au plus',0,NULL,NULL,1),(1355,1,NULL,'2016-07-30 11:12:54','PCMN-BASE','FINAN','XXXXXX','5',0,'Placement de trésorerie et de valeurs disponibles',0,NULL,NULL,1),(1356,1,NULL,'2016-07-30 11:12:54','PCMN-BASE','CHARGE','XXXXXX','6',0,'Charges',0,NULL,NULL,1),(1357,1,NULL,'2016-07-30 11:12:54','PCMN-BASE','PROD','XXXXXX','7',0,'Produits',0,NULL,NULL,1),(1401,1,NULL,'2016-07-30 11:12:54','PCG99-ABREGE','CAPIT','XXXXXX','1',0,'Fonds propres, provisions pour risques et charges et dettes à plus d\'un an',0,NULL,NULL,1),(1402,1,NULL,'2016-07-30 11:12:54','PCG99-ABREGE','IMMO','XXXXXX','2',0,'Frais d\'établissement. Actifs immobilisés et créances à plus d\'un an',0,NULL,NULL,1),(1403,1,NULL,'2016-07-30 11:12:54','PCG99-ABREGE','STOCK','XXXXXX','3',0,'Stock et commandes en cours d\'exécution',0,NULL,NULL,1),(1404,1,NULL,'2016-07-30 11:12:54','PCG99-ABREGE','TIERS','XXXXXX','4',0,'Créances et dettes à un an au plus',0,NULL,NULL,1),(1405,1,NULL,'2016-07-30 11:12:54','PCG99-ABREGE','FINAN','XXXXXX','5',0,'Placement de trésorerie et de valeurs disponibles',0,NULL,NULL,1),(1406,1,NULL,'2016-07-30 11:12:54','PCG99-ABREGE','CHARGE','XXXXXX','6',0,'Charges',0,NULL,NULL,1),(1407,1,NULL,'2016-07-30 11:12:54','PCG99-ABREGE','PROD','XXXXXX','7',0,'Produits',0,NULL,NULL,1),(1501,1,NULL,'2016-07-30 11:12:54','PCG99-BASE','CAPIT','XXXXXX','1',0,'Fonds propres, provisions pour risques et charges et dettes à plus d\'un an',0,NULL,NULL,1),(1502,1,NULL,'2016-07-30 11:12:54','PCG99-BASE','IMMO','XXXXXX','2',0,'Frais d\'établissement. Actifs immobilisés et créances à plus d\'un an',0,NULL,NULL,1),(1503,1,NULL,'2016-07-30 11:12:54','PCG99-BASE','STOCK','XXXXXX','3',0,'Stock et commandes en cours d\'exécution',0,NULL,NULL,1),(1504,1,NULL,'2016-07-30 11:12:54','PCG99-BASE','TIERS','XXXXXX','4',0,'Créances et dettes à un an au plus',0,NULL,NULL,1),(1505,1,NULL,'2016-07-30 11:12:54','PCG99-BASE','FINAN','XXXXXX','5',0,'Placement de trésorerie et de valeurs disponibles',0,NULL,NULL,1),(1506,1,NULL,'2016-07-30 11:12:54','PCG99-BASE','CHARGE','XXXXXX','6',0,'Charges',0,NULL,NULL,1),(1507,1,NULL,'2016-07-30 11:12:54','PCG99-BASE','PROD','XXXXXX','7',0,'Produits',0,NULL,NULL,1),(4001,1,NULL,'2016-07-30 11:12:54','PCG08-PYME','FINANCIACION','XXXXXX','1',0,'Financiación básica',0,NULL,NULL,1),(4002,1,NULL,'2016-07-30 11:12:54','PCG08-PYME','ACTIVO','XXXXXX','2',0,'Activo no corriente',0,NULL,NULL,1),(4003,1,NULL,'2016-07-30 11:12:54','PCG08-PYME','EXISTENCIAS','XXXXXX','3',0,'Existencias',0,NULL,NULL,1),(4004,1,NULL,'2016-07-30 11:12:54','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','4',0,'Acreedores y deudores por operaciones comerciales',0,NULL,NULL,1),(4005,1,NULL,'2016-07-30 11:12:54','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','5',0,'Cuentas financieras',0,NULL,NULL,1),(4006,1,NULL,'2016-07-30 11:12:54','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6',0,'Compras y gastos',0,NULL,NULL,1),(4007,1,NULL,'2016-07-30 11:12:54','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','7',0,'Ventas e ingresos',0,NULL,NULL,1),(4008,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','10',4001,'CAPITAL',0,NULL,NULL,1),(4009,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','100',4008,'Capital social',0,NULL,NULL,1),(4010,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','101',4008,'Fondo social',0,NULL,NULL,1),(4011,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','CAPITAL','102',4008,'Capital',0,NULL,NULL,1),(4012,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','103',4008,'Socios por desembolsos no exigidos',0,NULL,NULL,1),(4013,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','1030',4012,'Socios por desembolsos no exigidos capital social',0,NULL,NULL,1),(4014,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','1034',4012,'Socios por desembolsos no exigidos capital pendiente de inscripción',0,NULL,NULL,1),(4015,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','104',4008,'Socios por aportaciones no dineradas pendientes',0,NULL,NULL,1),(4016,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','1040',4015,'Socios por aportaciones no dineradas pendientes capital social',0,NULL,NULL,1),(4017,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','1044',4015,'Socios por aportaciones no dineradas pendientes capital pendiente de inscripción',0,NULL,NULL,1),(4018,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','108',4008,'Acciones o participaciones propias en situaciones especiales',0,NULL,NULL,1),(4019,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','109',4008,'Acciones o participaciones propias para reducción de capital',0,NULL,NULL,1),(4020,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','11',4001,'Reservas y otros instrumentos de patrimonio',0,NULL,NULL,1),(4021,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','110',4020,'Prima de emisión o asunción',0,NULL,NULL,1),(4022,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','111',4020,'Otros instrumentos de patrimonio neto',0,NULL,NULL,1),(4023,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','1110',4022,'Patrimonio neto por emisión de instrumentos financieros compuestos',0,NULL,NULL,1),(4024,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','1111',4022,'Resto de instrumentos de patrimoio neto',0,NULL,NULL,1),(4025,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','112',4020,'Reserva legal',0,NULL,NULL,1),(4026,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','113',4020,'Reservas voluntarias',0,NULL,NULL,1),(4027,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','114',4020,'Reservas especiales',0,NULL,NULL,1),(4028,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','1140',4027,'Reservas para acciones o participaciones de la sociedad dominante',0,NULL,NULL,1),(4029,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','1141',4027,'Reservas estatutarias',0,NULL,NULL,1),(4030,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','1142',4027,'Reservas por capital amortizado',0,NULL,NULL,1),(4031,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','1143',4027,'Reservas por fondo de comercio',0,NULL,NULL,1),(4032,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','1144',4028,'Reservas por acciones propias aceptadas en garantía',0,NULL,NULL,1),(4033,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','115',4020,'Reservas por pérdidas y ganancias actuariales y otros ajustes',0,NULL,NULL,1),(4034,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','118',4020,'Aportaciones de socios o propietarios',0,NULL,NULL,1),(4035,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','119',4020,'Diferencias por ajuste del capital a euros',0,NULL,NULL,1),(4036,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','12',4001,'Resultados pendientes de aplicación',0,NULL,NULL,1),(4037,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','120',4036,'Remanente',0,NULL,NULL,1),(4038,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','121',4036,'Resultados negativos de ejercicios anteriores',0,NULL,NULL,1),(4039,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','129',4036,'Resultado del ejercicio',0,NULL,NULL,1),(4040,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','13',4001,'Subvenciones, donaciones y ajustes por cambio de valor',0,NULL,NULL,1),(4041,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','130',4040,'Subvenciones oficiales de capital',0,NULL,NULL,1),(4042,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','131',4040,'Donaciones y legados de capital',0,NULL,NULL,1),(4043,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','132',4040,'Otras subvenciones, donaciones y legados',0,NULL,NULL,1),(4044,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','133',4040,'Ajustes por valoración en activos financieros disponibles para la venta',0,NULL,NULL,1),(4045,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','134',4040,'Operaciones de cobertura',0,NULL,NULL,1),(4046,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','1340',4045,'Cobertura de flujos de efectivo',0,NULL,NULL,1),(4047,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','1341',4045,'Cobertura de una inversión neta en un negocio extranjero',0,NULL,NULL,1),(4048,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','135',4040,'Diferencias de conversión',0,NULL,NULL,1),(4049,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','136',4040,'Ajustes por valoración en activos no corrientes y grupos enajenables de elementos mantenidos para la venta',0,NULL,NULL,1),(4050,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','137',4040,'Ingresos fiscales a distribuir en varios ejercicios',0,NULL,NULL,1),(4051,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','1370',4050,'Ingresos fiscales por diferencias permanentes a distribuir en varios ejercicios',0,NULL,NULL,1),(4052,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','1371',4050,'Ingresos fiscales por deducciones y bonificaciones a distribuir en varios ejercicios',0,NULL,NULL,1),(4053,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','14',4001,'Provisiones',0,NULL,NULL,1),(4054,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','141',4053,'Provisión para impuestos',0,NULL,NULL,1),(4055,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','142',4053,'Provisión para otras responsabilidades',0,NULL,NULL,1),(4056,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','143',4053,'Provisión por desmantelamiento, retiro o rehabilitación del inmovilizado',0,NULL,NULL,1),(4057,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','145',4053,'Provisión para actuaciones medioambientales',0,NULL,NULL,1),(4058,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','15',4001,'Deudas a largo plazo con características especiales',0,NULL,NULL,1),(4059,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','150',4058,'Acciones o participaciones a largo plazo consideradas como pasivos financieros',0,NULL,NULL,1),(4060,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','153',4058,'Desembolsos no exigidos por acciones o participaciones consideradas como pasivos financieros',0,NULL,NULL,1),(4061,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','1533',4060,'Desembolsos no exigidos empresas del grupo',0,NULL,NULL,1),(4062,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','1534',4060,'Desembolsos no exigidos empresas asociadas',0,NULL,NULL,1),(4063,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','1535',4060,'Desembolsos no exigidos otras partes vinculadas',0,NULL,NULL,1),(4064,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','1536',4060,'Otros desembolsos no exigidos',0,NULL,NULL,1),(4065,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','154',4058,'Aportaciones no dinerarias pendientes por acciones o participaciones consideradas como pasivos financieros',0,NULL,NULL,1),(4066,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','1543',4065,'Aportaciones no dinerarias pendientes empresas del grupo',0,NULL,NULL,1),(4067,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','1544',4065,'Aportaciones no dinerarias pendientes empresas asociadas',0,NULL,NULL,1),(4068,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','1545',4065,'Aportaciones no dinerarias pendientes otras partes vinculadas',0,NULL,NULL,1),(4069,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','1546',4065,'Otras aportaciones no dinerarias pendientes',0,NULL,NULL,1),(4070,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','16',4001,'Deudas a largo plazo con partes vinculadas',0,NULL,NULL,1),(4071,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','160',4070,'Deudas a largo plazo con entidades de crédito vinculadas',0,NULL,NULL,1),(4072,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','1603',4071,'Deudas a largo plazo con entidades de crédito empresas del grupo',0,NULL,NULL,1),(4073,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','1604',4071,'Deudas a largo plazo con entidades de crédito empresas asociadas',0,NULL,NULL,1),(4074,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','1605',4071,'Deudas a largo plazo con otras entidades de crédito vinculadas',0,NULL,NULL,1),(4075,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','161',4070,'Proveedores de inmovilizado a largo plazo partes vinculadas',0,NULL,NULL,1),(4076,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','1613',4075,'Proveedores de inmovilizado a largo plazo empresas del grupo',0,NULL,NULL,1),(4077,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','1614',4075,'Proveedores de inmovilizado a largo plazo empresas asociadas',0,NULL,NULL,1),(4078,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','1615',4075,'Proveedores de inmovilizado a largo plazo otras partes vinculadas',0,NULL,NULL,1),(4079,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','162',4070,'Acreedores por arrendamiento financiero a largo plazo partes vinculadas',0,NULL,NULL,1),(4080,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','1623',4079,'Acreedores por arrendamiento financiero a largo plazo empresas del grupo',0,NULL,NULL,1),(4081,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','1624',4080,'Acreedores por arrendamiento financiero a largo plazo empresas asociadas',0,NULL,NULL,1),(4082,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','1625',4080,'Acreedores por arrendamiento financiero a largo plazo otras partes vinculadas',0,NULL,NULL,1),(4083,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','163',4070,'Otras deudas a largo plazo con partes vinculadas',0,NULL,NULL,1),(4084,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','1633',4083,'Otras deudas a largo plazo empresas del grupo',0,NULL,NULL,1),(4085,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','1634',4083,'Otras deudas a largo plazo empresas asociadas',0,NULL,NULL,1),(4086,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','1635',4083,'Otras deudas a largo plazo otras partes vinculadas',0,NULL,NULL,1),(4087,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','17',4001,'Deudas a largo plazo por préstamos recibidos empresitos y otros conceptos',0,NULL,NULL,1),(4088,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','170',4087,'Deudas a largo plazo con entidades de crédito',0,NULL,NULL,1),(4089,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','171',4087,'Deudas a largo plazo',0,NULL,NULL,1),(4090,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','172',4087,'Deudas a largo plazo transformables en suvbenciones donaciones y legados',0,NULL,NULL,1),(4091,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','173',4087,'Proveedores de inmovilizado a largo plazo',0,NULL,NULL,1),(4092,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','174',4087,'Acreedores por arrendamiento financiero a largo plazo',0,NULL,NULL,1),(4093,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','175',4087,'Efectos a pagar a largo plazo',0,NULL,NULL,1),(4094,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','176',4087,'Pasivos por derivados financieros a largo plazo',0,NULL,NULL,1),(4095,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','177',4087,'Obligaciones y bonos',0,NULL,NULL,1),(4096,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','179',4087,'Deudas representadas en otros valores negociables',0,NULL,NULL,1),(4097,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','18',4001,'Pasivos por fianzas garantias y otros conceptos a largo plazo',0,NULL,NULL,1),(4098,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','180',4097,'Fianzas recibidas a largo plazo',0,NULL,NULL,1),(4099,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','181',4097,'Anticipos recibidos por ventas o prestaciones de servicios a largo plazo',0,NULL,NULL,1),(4100,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','185',4097,'Depositos recibidos a largo plazo',0,NULL,NULL,1),(4101,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','19',4001,'Situaciones transitorias de financiación',0,NULL,NULL,1),(4102,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','190',4101,'Acciones o participaciones emitidas',0,NULL,NULL,1),(4103,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','192',4101,'Suscriptores de acciones',0,NULL,NULL,1),(4104,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','194',4101,'Capital emitido pendiente de inscripción',0,NULL,NULL,1),(4105,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','195',4101,'Acciones o participaciones emitidas consideradas como pasivos financieros',0,NULL,NULL,1),(4106,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','197',4101,'Suscriptores de acciones consideradas como pasivos financieros',0,NULL,NULL,1),(4107,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','FINANCIACION','XXXXXX','199',4101,'Acciones o participaciones emitidas consideradas como pasivos financieros pendientes de inscripción',0,NULL,NULL,1),(4108,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','20',4002,'Inmovilizaciones intangibles',0,NULL,NULL,1),(4109,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','200',4108,'Investigación',0,NULL,NULL,1),(4110,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','201',4108,'Desarrollo',0,NULL,NULL,1),(4111,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','202',4108,'Concesiones administrativas',0,NULL,NULL,1),(4112,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','203',4108,'Propiedad industrial',0,NULL,NULL,1),(4113,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','205',4108,'Derechos de transpaso',0,NULL,NULL,1),(4114,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','206',4108,'Aplicaciones informáticas',0,NULL,NULL,1),(4115,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','209',4108,'Anticipos para inmovilizaciones intangibles',0,NULL,NULL,1),(4116,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','21',4002,'Inmovilizaciones materiales',0,NULL,NULL,1),(4117,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','210',4116,'Terrenos y bienes naturales',0,NULL,NULL,1),(4118,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','211',4116,'Construcciones',0,NULL,NULL,1),(4119,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','212',4116,'Instalaciones técnicas',0,NULL,NULL,1),(4120,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','213',4116,'Maquinaria',0,NULL,NULL,1),(4121,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','214',4116,'Utillaje',0,NULL,NULL,1),(4122,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','215',4116,'Otras instalaciones',0,NULL,NULL,1),(4123,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','216',4116,'Mobiliario',0,NULL,NULL,1),(4124,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','217',4116,'Equipos para procesos de información',0,NULL,NULL,1),(4125,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','218',4116,'Elementos de transporte',0,NULL,NULL,1),(4126,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','219',4116,'Otro inmovilizado material',0,NULL,NULL,1),(4127,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','22',4002,'Inversiones inmobiliarias',0,NULL,NULL,1),(4128,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','220',4127,'Inversiones en terreons y bienes naturales',0,NULL,NULL,1),(4129,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','221',4127,'Inversiones en construcciones',0,NULL,NULL,1),(4130,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','23',4002,'Inmovilizaciones materiales en curso',0,NULL,NULL,1),(4131,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','230',4130,'Adaptación de terrenos y bienes naturales',0,NULL,NULL,1),(4132,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','231',4130,'Construcciones en curso',0,NULL,NULL,1),(4133,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','232',4130,'Instalaciones técnicas en montaje',0,NULL,NULL,1),(4134,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','233',4130,'Maquinaria en montaje',0,NULL,NULL,1),(4135,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','237',4130,'Equipos para procesos de información en montaje',0,NULL,NULL,1),(4136,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','239',4130,'Anticipos para inmovilizaciones materiales',0,NULL,NULL,1),(4137,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','24',4002,'Inversiones financieras a largo plazo en partes vinculadas',0,NULL,NULL,1),(4138,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','240',4137,'Participaciones a largo plazo en partes vinculadas',0,NULL,NULL,1),(4139,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','2403',4138,'Participaciones a largo plazo en empresas del grupo',0,NULL,NULL,1),(4140,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','2404',4138,'Participaciones a largo plazo en empresas asociadas',0,NULL,NULL,1),(4141,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','2405',4138,'Participaciones a largo plazo en otras partes vinculadas',0,NULL,NULL,1),(4142,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','241',4137,'Valores representativos de deuda a largo plazo de partes vinculadas',0,NULL,NULL,1),(4143,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','2413',4142,'Valores representativos de deuda a largo plazo de empresas del grupo',0,NULL,NULL,1),(4144,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','2414',4142,'Valores representativos de deuda a largo plazo de empresas asociadas',0,NULL,NULL,1),(4145,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','2415',4142,'Valores representativos de deuda a largo plazo de otras partes vinculadas',0,NULL,NULL,1),(4146,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','242',4137,'Créditos a largo plazo a partes vinculadas',0,NULL,NULL,1),(4147,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','2423',4146,'Créditos a largo plazo a empresas del grupo',0,NULL,NULL,1),(4148,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','2424',4146,'Créditos a largo plazo a empresas asociadas',0,NULL,NULL,1),(4149,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','2425',4146,'Créditos a largo plazo a otras partes vinculadas',0,NULL,NULL,1),(4150,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','249',4137,'Desembolsos pendientes sobre participaciones a largo plazo en partes vinculadas',0,NULL,NULL,1),(4151,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','2493',4150,'Desembolsos pendientes sobre participaciones a largo plazo en empresas del grupo',0,NULL,NULL,1),(4152,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','2494',4150,'Desembolsos pendientes sobre participaciones a largo plazo en empresas asociadas',0,NULL,NULL,1),(4153,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','2495',4150,'Desembolsos pendientes sobre participaciones a largo plazo en otras partes vinculadas',0,NULL,NULL,1),(4154,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','25',4002,'Otras inversiones financieras a largo plazo',0,NULL,NULL,1),(4155,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','250',4154,'Inversiones financieras a largo plazo en instrumentos de patrimonio',0,NULL,NULL,1),(4156,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','251',4154,'Valores representativos de deuda a largo plazo',0,NULL,NULL,1),(4157,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','252',4154,'Créditos a largo plazo',0,NULL,NULL,1),(4158,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','253',4154,'Créditos a largo plazo por enajenación de inmovilizado',0,NULL,NULL,1),(4159,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','254',4154,'Créditos a largo plazo al personal',0,NULL,NULL,1),(4160,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','255',4154,'Activos por derivados financieros a largo plazo',0,NULL,NULL,1),(4161,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','258',4154,'Imposiciones a largo plazo',0,NULL,NULL,1),(4162,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','259',4154,'Desembolsos pendientes sobre participaciones en el patrimonio neto a largo plazo',0,NULL,NULL,1),(4163,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','26',4002,'Fianzas y depósitos constituidos a largo plazo',0,NULL,NULL,1),(4164,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','260',4163,'Fianzas constituidas a largo plazo',0,NULL,NULL,1),(4165,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','261',4163,'Depósitos constituidos a largo plazo',0,NULL,NULL,1),(4166,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','28',4002,'Amortización acumulada del inmovilizado',0,NULL,NULL,1),(4167,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','280',4166,'Amortización acumulado del inmovilizado intangible',0,NULL,NULL,1),(4168,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','2800',4167,'Amortización acumulada de investigación',0,NULL,NULL,1),(4169,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','2801',4167,'Amortización acumulada de desarrollo',0,NULL,NULL,1),(4170,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','2802',4167,'Amortización acumulada de concesiones administrativas',0,NULL,NULL,1),(4171,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','2803',4167,'Amortización acumulada de propiedad industrial',0,NULL,NULL,1),(4172,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','2805',4167,'Amortización acumulada de derechos de transpaso',0,NULL,NULL,1),(4173,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','2806',4167,'Amortización acumulada de aplicaciones informáticas',0,NULL,NULL,1),(4174,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','281',4166,'Amortización acumulado del inmovilizado material',0,NULL,NULL,1),(4175,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','2811',4174,'Amortización acumulada de construcciones',0,NULL,NULL,1),(4176,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','2812',4174,'Amortización acumulada de instalaciones técnicas',0,NULL,NULL,1),(4177,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','2813',4174,'Amortización acumulada de maquinaria',0,NULL,NULL,1),(4178,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','2814',4174,'Amortización acumulada de utillaje',0,NULL,NULL,1),(4179,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','2815',4174,'Amortización acumulada de otras instalaciones',0,NULL,NULL,1),(4180,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','2816',4174,'Amortización acumulada de mobiliario',0,NULL,NULL,1),(4181,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','2817',4174,'Amortización acumulada de equipos para proceso de información',0,NULL,NULL,1),(4182,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','2818',4174,'Amortización acumulada de elementos de transporte',0,NULL,NULL,1),(4183,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','2819',4175,'Amortización acumulada de otro inmovilizado material',0,NULL,NULL,1),(4184,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','282',4166,'Amortización acumulada de las inversiones inmobiliarias',0,NULL,NULL,1),(4185,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','29',4002,'Deterioro de valor de activos no corrientes',0,NULL,NULL,1),(4186,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','290',4185,'Deterioro de valor del inmovilizado intangible',0,NULL,NULL,1),(4187,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','2900',4186,'Deterioro de valor de investigación',0,NULL,NULL,1),(4188,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','2901',4186,'Deterioro de valor de desarrollo',0,NULL,NULL,1),(4189,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','2902',4186,'Deterioro de valor de concesiones administrativas',0,NULL,NULL,1),(4190,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','2903',4186,'Deterioro de valor de propiedad industrial',0,NULL,NULL,1),(4191,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','2905',4186,'Deterioro de valor de derechos de transpaso',0,NULL,NULL,1),(4192,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','2906',4186,'Deterioro de valor de aplicaciones informáticas',0,NULL,NULL,1),(4193,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','291',4185,'Deterioro de valor del inmovilizado material',0,NULL,NULL,1),(4194,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','2910',4193,'Deterioro de valor de terrenos y bienes naturales',0,NULL,NULL,1),(4195,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','2911',4193,'Deterioro de valor de construcciones',0,NULL,NULL,1),(4196,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','2912',4193,'Deterioro de valor de instalaciones técnicas',0,NULL,NULL,1),(4197,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','2913',4193,'Deterioro de valor de maquinaria',0,NULL,NULL,1),(4198,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','2914',4193,'Deterioro de valor de utillajes',0,NULL,NULL,1),(4199,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','2915',4194,'Deterioro de valor de otras instalaciones',0,NULL,NULL,1),(4200,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','2916',4194,'Deterioro de valor de mobiliario',0,NULL,NULL,1),(4201,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','2917',4194,'Deterioro de valor de equipos para proceso de información',0,NULL,NULL,1),(4202,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','2918',4194,'Deterioro de valor de elementos de transporte',0,NULL,NULL,1),(4203,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','2919',4194,'Deterioro de valor de otro inmovilizado material',0,NULL,NULL,1),(4204,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','292',4185,'Deterioro de valor de las inversiones inmobiliarias',0,NULL,NULL,1),(4205,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','2920',4204,'Deterioro de valor de terrenos y bienes naturales',0,NULL,NULL,1),(4206,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','2921',4204,'Deterioro de valor de construcciones',0,NULL,NULL,1),(4207,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','293',4185,'Deterioro de valor de participaciones a largo plazo en partes vinculadas',0,NULL,NULL,1),(4208,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','2933',4207,'Deterioro de valor de participaciones a largo plazo en empresas del grupo',0,NULL,NULL,1),(4209,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','2934',4207,'Deterioro de valor de sobre participaciones a largo plazo en empresas asociadas',0,NULL,NULL,1),(4210,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','2935',4207,'Deterioro de valor de sobre participaciones a largo plazo en otras partes vinculadas',0,NULL,NULL,1),(4211,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','294',4185,'Deterioro de valor de valores representativos de deuda a largo plazo en partes vinculadas',0,NULL,NULL,1),(4212,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','2943',4211,'Deterioro de valor de valores representativos de deuda a largo plazo en empresas del grupo',0,NULL,NULL,1),(4213,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','2944',4211,'Deterioro de valor de valores representativos de deuda a largo plazo en empresas asociadas',0,NULL,NULL,1),(4214,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','2945',4211,'Deterioro de valor de valores representativos de deuda a largo plazo en otras partes vinculadas',0,NULL,NULL,1),(4215,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','295',4185,'Deterioro de valor de créditos a largo plazo a partes vinculadas',0,NULL,NULL,1),(4216,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','2953',4215,'Deterioro de valor de créditos a largo plazo a empresas del grupo',0,NULL,NULL,1),(4217,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','2954',4215,'Deterioro de valor de créditos a largo plazo a empresas asociadas',0,NULL,NULL,1),(4218,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','2955',4215,'Deterioro de valor de créditos a largo plazo a otras partes vinculadas',0,NULL,NULL,1),(4219,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','296',4185,'Deterioro de valor de participaciones en el patrimonio netoa largo plazo',0,NULL,NULL,1),(4220,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','297',4185,'Deterioro de valor de valores representativos de deuda a largo plazo',0,NULL,NULL,1),(4221,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACTIVO','XXXXXX','298',4185,'Deterioro de valor de créditos a largo plazo',0,NULL,NULL,1),(4222,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','EXISTENCIAS','XXXXXX','30',4003,'Comerciales',0,NULL,NULL,1),(4223,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','EXISTENCIAS','XXXXXX','300',4222,'Mercaderías A',0,NULL,NULL,1),(4224,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','EXISTENCIAS','XXXXXX','301',4222,'Mercaderías B',0,NULL,NULL,1),(4225,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','EXISTENCIAS','XXXXXX','31',4003,'Materias primas',0,NULL,NULL,1),(4226,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','EXISTENCIAS','XXXXXX','310',4225,'Materias primas A',0,NULL,NULL,1),(4227,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','EXISTENCIAS','XXXXXX','311',4225,'Materias primas B',0,NULL,NULL,1),(4228,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','EXISTENCIAS','XXXXXX','32',4003,'Otros aprovisionamientos',0,NULL,NULL,1),(4229,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','EXISTENCIAS','XXXXXX','320',4228,'Elementos y conjuntos incorporables',0,NULL,NULL,1),(4230,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','EXISTENCIAS','XXXXXX','321',4228,'Combustibles',0,NULL,NULL,1),(4231,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','EXISTENCIAS','XXXXXX','322',4228,'Repuestos',0,NULL,NULL,1),(4232,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','EXISTENCIAS','XXXXXX','325',4228,'Materiales diversos',0,NULL,NULL,1),(4233,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','EXISTENCIAS','XXXXXX','326',4228,'Embalajes',0,NULL,NULL,1),(4234,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','EXISTENCIAS','XXXXXX','327',4228,'Envases',0,NULL,NULL,1),(4235,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','EXISTENCIAS','XXXXXX','328',4229,'Material de oficina',0,NULL,NULL,1),(4236,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','EXISTENCIAS','XXXXXX','33',4003,'Productos en curso',0,NULL,NULL,1),(4237,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','EXISTENCIAS','XXXXXX','330',4236,'Productos en curos A',0,NULL,NULL,1),(4238,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','EXISTENCIAS','XXXXXX','331',4236,'Productos en curso B',0,NULL,NULL,1),(4239,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','EXISTENCIAS','XXXXXX','34',4003,'Productos semiterminados',0,NULL,NULL,1),(4240,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','EXISTENCIAS','XXXXXX','340',4239,'Productos semiterminados A',0,NULL,NULL,1),(4241,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','EXISTENCIAS','XXXXXX','341',4239,'Productos semiterminados B',0,NULL,NULL,1),(4242,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','EXISTENCIAS','XXXXXX','35',4003,'Productos terminados',0,NULL,NULL,1),(4243,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','EXISTENCIAS','XXXXXX','350',4242,'Productos terminados A',0,NULL,NULL,1),(4244,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','EXISTENCIAS','XXXXXX','351',4242,'Productos terminados B',0,NULL,NULL,1),(4245,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','EXISTENCIAS','XXXXXX','36',4003,'Subproductos, residuos y materiales recuperados',0,NULL,NULL,1),(4246,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','EXISTENCIAS','XXXXXX','360',4245,'Subproductos A',0,NULL,NULL,1),(4247,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','EXISTENCIAS','XXXXXX','361',4245,'Subproductos B',0,NULL,NULL,1),(4248,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','EXISTENCIAS','XXXXXX','365',4245,'Residuos A',0,NULL,NULL,1),(4249,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','EXISTENCIAS','XXXXXX','366',4245,'Residuos B',0,NULL,NULL,1),(4250,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','EXISTENCIAS','XXXXXX','368',4245,'Materiales recuperados A',0,NULL,NULL,1),(4251,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','EXISTENCIAS','XXXXXX','369',4245,'Materiales recuperados B',0,NULL,NULL,1),(4252,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','EXISTENCIAS','XXXXXX','39',4003,'Deterioro de valor de las existencias',0,NULL,NULL,1),(4253,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','EXISTENCIAS','XXXXXX','390',4252,'Deterioro de valor de las mercaderías',0,NULL,NULL,1),(4254,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','EXISTENCIAS','XXXXXX','391',4252,'Deterioro de valor de las materias primas',0,NULL,NULL,1),(4255,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','EXISTENCIAS','XXXXXX','392',4252,'Deterioro de valor de otros aprovisionamientos',0,NULL,NULL,1),(4256,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','EXISTENCIAS','XXXXXX','393',4252,'Deterioro de valor de los productos en curso',0,NULL,NULL,1),(4257,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','EXISTENCIAS','XXXXXX','394',4252,'Deterioro de valor de los productos semiterminados',0,NULL,NULL,1),(4258,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','EXISTENCIAS','XXXXXX','395',4252,'Deterioro de valor de los productos terminados',0,NULL,NULL,1),(4259,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','EXISTENCIAS','XXXXXX','396',4252,'Deterioro de valor de los subproductos, residuos y materiales recuperados',0,NULL,NULL,1),(4260,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','PROVEEDORES','40',4004,'Proveedores',0,NULL,NULL,1),(4261,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','PROVEEDORES','400',4260,'Proveedores',0,NULL,NULL,1),(4262,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','4000',4261,'Proveedores euros',0,NULL,NULL,1),(4263,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','4004',4261,'Proveedores moneda extranjera',0,NULL,NULL,1),(4264,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','4009',4261,'Proveedores facturas pendientes de recibir o formalizar',0,NULL,NULL,1),(4265,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','401',4260,'Proveedores efectos comerciales a pagar',0,NULL,NULL,1),(4266,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','403',4260,'Proveedores empresas del grupo',0,NULL,NULL,1),(4267,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','4030',4266,'Proveedores empresas del grupo euros',0,NULL,NULL,1),(4268,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','4031',4266,'Efectos comerciales a pagar empresas del grupo',0,NULL,NULL,1),(4269,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','4034',4266,'Proveedores empresas del grupo moneda extranjera',0,NULL,NULL,1),(4270,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','4036',4266,'Envases y embalajes a devolver a proveedores empresas del grupo',0,NULL,NULL,1),(4271,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','4039',4266,'Proveedores empresas del grupo facturas pendientes de recibir o de formalizar',0,NULL,NULL,1),(4272,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','404',4260,'Proveedores empresas asociadas',0,NULL,NULL,1),(4273,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','405',4260,'Proveedores otras partes vinculadas',0,NULL,NULL,1),(4274,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','406',4260,'Envases y embalajes a devolver a proveedores',0,NULL,NULL,1),(4275,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','407',4260,'Anticipos a proveedores',0,NULL,NULL,1),(4276,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','41',4004,'Acreedores varios',0,NULL,NULL,1),(4277,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','410',4276,'Acreedores por prestaciones de servicios',0,NULL,NULL,1),(4278,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','4100',4277,'Acreedores por prestaciones de servicios euros',0,NULL,NULL,1),(4279,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','4104',4277,'Acreedores por prestaciones de servicios moneda extranjera',0,NULL,NULL,1),(4280,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','4109',4277,'Acreedores por prestaciones de servicios facturas pendientes de recibir o formalizar',0,NULL,NULL,1),(4281,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','411',4276,'Acreedores efectos comerciales a pagar',0,NULL,NULL,1),(4282,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','419',4276,'Acreedores por operaciones en común',0,NULL,NULL,1),(4283,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','CLIENTES','43',4004,'Clientes',0,NULL,NULL,1),(4284,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','CLIENTES','430',4283,'Clientes',0,NULL,NULL,1),(4285,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','4300',4284,'Clientes euros',0,NULL,NULL,1),(4286,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','4304',4284,'Clientes moneda extranjera',0,NULL,NULL,1),(4287,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','4309',4284,'Clientes facturas pendientes de formalizar',0,NULL,NULL,1),(4288,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','431',4283,'Clientes efectos comerciales a cobrar',0,NULL,NULL,1),(4289,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','4310',4288,'Efectos comerciales en cartera',0,NULL,NULL,1),(4290,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','4311',4288,'Efectos comerciales descontados',0,NULL,NULL,1),(4291,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','4312',4288,'Efectos comerciales en gestión de cobro',0,NULL,NULL,1),(4292,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','4315',4288,'Efectos comerciales impagados',0,NULL,NULL,1),(4293,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','432',4283,'Clientes operaciones de factoring',0,NULL,NULL,1),(4294,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','433',4283,'Clientes empresas del grupo',0,NULL,NULL,1),(4295,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','4330',4294,'Clientes empresas del grupo euros',0,NULL,NULL,1),(4296,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','4331',4294,'Efectos comerciales a cobrar empresas del grupo',0,NULL,NULL,1),(4297,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','4332',4294,'Clientes empresas del grupo operaciones de factoring',0,NULL,NULL,1),(4298,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','4334',4294,'Clientes empresas del grupo moneda extranjera',0,NULL,NULL,1),(4299,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','4336',4294,'Clientes empresas del grupo dudoso cobro',0,NULL,NULL,1),(4300,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','4337',4294,'Envases y embalajes a devolver a clientes empresas del grupo',0,NULL,NULL,1),(4301,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','4339',4294,'Clientes empresas del grupo facturas pendientes de formalizar',0,NULL,NULL,1),(4302,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','434',4283,'Clientes empresas asociadas',0,NULL,NULL,1),(4303,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','435',4283,'Clientes otras partes vinculadas',0,NULL,NULL,1),(4304,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','436',4283,'Clientes de dudoso cobro',0,NULL,NULL,1),(4305,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','437',4283,'Envases y embalajes a devolver por clientes',0,NULL,NULL,1),(4306,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','438',4283,'Anticipos de clientes',0,NULL,NULL,1),(4307,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','44',4004,'Deudores varios',0,NULL,NULL,1),(4308,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','440',4307,'Deudores',0,NULL,NULL,1),(4309,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','4400',4308,'Deudores euros',0,NULL,NULL,1),(4310,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','4404',4308,'Deudores moneda extranjera',0,NULL,NULL,1),(4311,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','4409',4308,'Deudores facturas pendientes de formalizar',0,NULL,NULL,1),(4312,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','441',4307,'Deudores efectos comerciales a cobrar',0,NULL,NULL,1),(4313,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','4410',4312,'Deudores efectos comerciales en cartera',0,NULL,NULL,1),(4314,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','4411',4312,'Deudores efectos comerciales descontados',0,NULL,NULL,1),(4315,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','4412',4312,'Deudores efectos comerciales en gestión de cobro',0,NULL,NULL,1),(4316,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','4415',4312,'Deudores efectos comerciales impagados',0,NULL,NULL,1),(4317,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','446',4307,'Deudores de dusoso cobro',0,NULL,NULL,1),(4318,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','449',4307,'Deudores por operaciones en común',0,NULL,NULL,1),(4319,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','46',4004,'Personal',0,NULL,NULL,1),(4320,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','460',4319,'Anticipos de renumeraciones',0,NULL,NULL,1),(4321,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','465',4319,'Renumeraciones pendientes de pago',0,NULL,NULL,1),(4322,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','47',4004,'Administraciones Públicas',0,NULL,NULL,1),(4323,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','470',4322,'Hacienda Pública deudora por diversos conceptos',0,NULL,NULL,1),(4324,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','4700',4323,'Hacienda Pública deudora por IVA',0,NULL,NULL,1),(4325,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','4708',4323,'Hacienda Pública deudora por subvenciones concedidas',0,NULL,NULL,1),(4326,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','4709',4323,'Hacienda Pública deudora por devolución de impuestos',0,NULL,NULL,1),(4327,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','471',4322,'Organismos de la Seguridad Social deudores',0,NULL,NULL,1),(4328,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','472',4322,'Hacienda Pública IVA soportado',0,NULL,NULL,1),(4329,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','473',4322,'Hacienda Pública retenciones y pagos a cuenta',0,NULL,NULL,1),(4330,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','474',4322,'Activos por impuesto diferido',0,NULL,NULL,1),(4331,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','4740',4330,'Activos por diferencias temporarias deducibles',0,NULL,NULL,1),(4332,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','4742',4330,'Derechos por deducciones y bonificaciones pendientes de aplicar',0,NULL,NULL,1),(4333,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','4745',4330,'Crédito por pérdidasa compensar del ejercicio',0,NULL,NULL,1),(4334,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','475',4322,'Hacienda Pública acreedora por conceptos fiscales',0,NULL,NULL,1),(4335,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','4750',4334,'Hacienda Pública acreedora por IVA',0,NULL,NULL,1),(4336,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','4751',4334,'Hacienda Pública acreedora por retenciones practicadas',0,NULL,NULL,1),(4337,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','4752',4334,'Hacienda Pública acreedora por impuesto sobre sociedades',0,NULL,NULL,1),(4338,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','4758',4334,'Hacienda Pública acreedora por subvenciones a integrar',0,NULL,NULL,1),(4339,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','476',4322,'Organismos de la Seguridad Social acreedores',0,NULL,NULL,1),(4340,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','477',4322,'Hacienda Pública IVA repercutido',0,NULL,NULL,1),(4341,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','479',4322,'Pasivos por diferencias temporarias imponibles',0,NULL,NULL,1),(4342,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','48',4004,'Ajustes por periodificación',0,NULL,NULL,1),(4343,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','480',4342,'Gastos anticipados',0,NULL,NULL,1),(4344,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','485',4342,'Ingresos anticipados',0,NULL,NULL,1),(4345,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','49',4004,'Deterioro de valor de créditos comerciales y provisiones a corto plazo',0,NULL,NULL,1),(4346,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','490',4345,'Deterioro de valor de créditos por operaciones comerciales',0,NULL,NULL,1),(4347,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','493',4345,'Deterioro de valor de créditos por operaciones comerciales con partes vinculadas',0,NULL,NULL,1),(4348,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','4933',4347,'Deterioro de valor de créditos por operaciones comerciales con empresas del grupo',0,NULL,NULL,1),(4349,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','4934',4347,'Deterioro de valor de créditos por operaciones comerciales con empresas asociadas',0,NULL,NULL,1),(4350,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','4935',4347,'Deterioro de valor de créditos por operaciones comerciales con otras partes vinculadas',0,NULL,NULL,1),(4351,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','499',4345,'Provisiones por operaciones comerciales',0,NULL,NULL,1),(4352,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','4994',4351,'Provisión para contratos anerosos',0,NULL,NULL,1),(4353,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','ACREEDORES_DEUDORES','XXXXXX','4999',4351,'Provisión para otras operaciones comerciales',0,NULL,NULL,1),(4354,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','50',4005,'Emprésitos deudas con características especiales y otras emisiones análogas a corto plazo',0,NULL,NULL,1),(4355,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','500',4354,'Obligaciones y bonos a corto plazo',0,NULL,NULL,1),(4356,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','502',4354,'Acciones o participaciones a corto plazo consideradas como pasivos financieros',0,NULL,NULL,1),(4357,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','505',4354,'Deudas representadas en otros valores negociables a corto plazo',0,NULL,NULL,1),(4358,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','506',4354,'Intereses a corto plazo de emprésitos y otras emisiones analógicas',0,NULL,NULL,1),(4359,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','507',4354,'Dividendos de acciones o participaciones consideradas como pasivos financieros',0,NULL,NULL,1),(4360,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','509',4354,'Valores negociables amortizados',0,NULL,NULL,1),(4361,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','5090',4360,'Obligaciones y bonos amortizados',0,NULL,NULL,1),(4362,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','5095',4360,'Otros valores negociables amortizados',0,NULL,NULL,1),(4363,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','51',4005,'Deudas a corto plazo con partes vinculadas',0,NULL,NULL,1),(4364,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','510',4363,'Deudas a corto plazo con entidades de crédito vinculadas',0,NULL,NULL,1),(4365,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','5103',4364,'Deudas a corto plazo con entidades de crédito empresas del grupo',0,NULL,NULL,1),(4366,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','5104',4364,'Deudas a corto plazo con entidades de crédito empresas asociadas',0,NULL,NULL,1),(4367,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','5105',4364,'Deudas a corto plazo con otras entidades de crédito vinculadas',0,NULL,NULL,1),(4368,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','511',4363,'Proveedores de inmovilizado a corto plazo partes vinculadas',0,NULL,NULL,1),(4369,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','5113',4368,'Proveedores de inmovilizado a corto plazo empresas del grupo',0,NULL,NULL,1),(4370,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','5114',4368,'Proveedores de inmovilizado a corto plazo empresas asociadas',0,NULL,NULL,1),(4371,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','5115',4368,'Proveedores de inmovilizado a corto plazo otras partes vinculadas',0,NULL,NULL,1),(4372,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','512',4363,'Acreedores por arrendamiento financiero a corto plazo partes vinculadas',0,NULL,NULL,1),(4373,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','5123',4372,'Acreedores por arrendamiento financiero a corto plazo empresas del grupo',0,NULL,NULL,1),(4374,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','5124',4372,'Acreedores por arrendamiento financiero a corto plazo empresas asociadas',0,NULL,NULL,1),(4375,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','5125',4372,'Acreedores por arrendamiento financiero a corto plazo otras partes vinculadas',0,NULL,NULL,1),(4376,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','513',4363,'Otras deudas a corto plazo con partes vinculadas',0,NULL,NULL,1),(4377,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','5133',4376,'Otras deudas a corto plazo con empresas del grupo',0,NULL,NULL,1),(4378,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','5134',4376,'Otras deudas a corto plazo con empresas asociadas',0,NULL,NULL,1),(4379,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','5135',4376,'Otras deudas a corto plazo con partes vinculadas',0,NULL,NULL,1),(4380,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','514',4363,'Intereses a corto plazo con partes vinculadas',0,NULL,NULL,1),(4381,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','5143',4380,'Intereses a corto plazo empresas del grupo',0,NULL,NULL,1),(4382,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','5144',4380,'Intereses a corto plazo empresas asociadas',0,NULL,NULL,1),(4383,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','5145',4380,'Intereses deudas a corto plazo partes vinculadas',0,NULL,NULL,1),(4384,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','52',4005,'Deudas a corto plazo por préstamos recibidos y otros conceptos',0,NULL,NULL,1),(4385,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','520',4384,'Deudas a corto plazo con entidades de crédito',0,NULL,NULL,1),(4386,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','5200',4385,'Préstamos a corto plazo de entidades de crédito',0,NULL,NULL,1),(4387,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','5201',4385,'Deudas a corto plazo por crédito dispuesto',0,NULL,NULL,1),(4388,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','5208',4385,'Deudas por efectos descontados',0,NULL,NULL,1),(4389,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','5209',4385,'Deudas por operaciones de factoring',0,NULL,NULL,1),(4390,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','521',4384,'Deudas a corto plazo',0,NULL,NULL,1),(4391,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','522',4384,'Deudas a corto plazo transformables en subvenciones donaciones y legados',0,NULL,NULL,1),(4392,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','523',4384,'Proveedores de inmovilizado a corto plazo',0,NULL,NULL,1),(4393,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','526',4384,'Dividendo activo a pagar',0,NULL,NULL,1),(4394,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','527',4384,'Intereses a corto plazo de deudas con entidades de crédito',0,NULL,NULL,1),(4395,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','528',4384,'Intereses a corto plazo de deudas',0,NULL,NULL,1),(4396,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','529',4384,'Provisiones a corto plazo',0,NULL,NULL,1),(4397,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','5291',4396,'Provisión a corto plazo para impuestos',0,NULL,NULL,1),(4398,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','5292',4396,'Provisión a corto plazo para otras responsabilidades',0,NULL,NULL,1),(4399,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','5293',4396,'Provisión a corto plazo por desmantelamiento retiro o rehabilitación del inmovilizado',0,NULL,NULL,1),(4400,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','5295',4396,'Provisión a corto plazo para actuaciones medioambientales',0,NULL,NULL,1),(4401,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','53',4005,'Inversiones financieras a corto plazo en partes vinculadas',0,NULL,NULL,1),(4402,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','530',4401,'Participaciones a corto plazo en partes vinculadas',0,NULL,NULL,1),(4403,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','5303',4402,'Participaciones a corto plazo en empresas del grupo',0,NULL,NULL,1),(4404,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','5304',4402,'Participaciones a corto plazo en empresas asociadas',0,NULL,NULL,1),(4405,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','5305',4402,'Participaciones a corto plazo en otras partes vinculadas',0,NULL,NULL,1),(4406,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','531',4401,'Valores representativos de deuda a corto plazo de partes vinculadas',0,NULL,NULL,1),(4407,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','5313',4406,'Valores representativos de deuda a corto plazo de empresas del grupo',0,NULL,NULL,1),(4408,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','5314',4406,'Valores representativos de deuda a corto plazo de empresas asociadas',0,NULL,NULL,1),(4409,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','5315',4406,'Valores representativos de deuda a corto plazo de otras partes vinculadas',0,NULL,NULL,1),(4410,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','532',4401,'Créditos a corto plazo a partes vinculadas',0,NULL,NULL,1),(4411,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','5323',4410,'Créditos a corto plazo a empresas del grupo',0,NULL,NULL,1),(4412,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','5324',4410,'Créditos a corto plazo a empresas asociadas',0,NULL,NULL,1),(4413,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','5325',4410,'Créditos a corto plazo a otras partes vinculadas',0,NULL,NULL,1),(4414,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','533',4401,'Intereses a corto plazo de valores representativos de deuda de partes vinculadas',0,NULL,NULL,1),(4415,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','5333',4414,'Intereses a corto plazo de valores representativos de deuda en empresas del grupo',0,NULL,NULL,1),(4416,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','5334',4414,'Intereses a corto plazo de valores representativos de deuda en empresas asociadas',0,NULL,NULL,1),(4417,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','5335',4414,'Intereses a corto plazo de valores representativos de deuda en otras partes vinculadas',0,NULL,NULL,1),(4418,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','534',4401,'Intereses a corto plazo de créditos a partes vinculadas',0,NULL,NULL,1),(4419,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','5343',4418,'Intereses a corto plazo de créditos a empresas del grupo',0,NULL,NULL,1),(4420,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','5344',4418,'Intereses a corto plazo de créditos a empresas asociadas',0,NULL,NULL,1),(4421,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','5345',4418,'Intereses a corto plazo de créditos a otras partes vinculadas',0,NULL,NULL,1),(4422,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','535',4401,'Dividendo a cobrar de inversiones financieras en partes vinculadas',0,NULL,NULL,1),(4423,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','5353',4422,'Dividendo a cobrar de empresas del grupo',0,NULL,NULL,1),(4424,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','5354',4422,'Dividendo a cobrar de empresas asociadas',0,NULL,NULL,1),(4425,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','5355',4422,'Dividendo a cobrar de otras partes vinculadas',0,NULL,NULL,1),(4426,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','539',4401,'Desembolsos pendientes sobre participaciones a corto plazo en partes vinculadas',0,NULL,NULL,1),(4427,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','5393',4426,'Desembolsos pendientes sobre participaciones a corto plazo en empresas del grupo',0,NULL,NULL,1),(4428,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','5394',4426,'Desembolsos pendientes sobre participaciones a corto plazo en empresas asociadas',0,NULL,NULL,1),(4429,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','5395',4426,'Desembolsos pendientes sobre participaciones a corto plazo en otras partes vinculadas',0,NULL,NULL,1),(4430,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','54',4005,'Otras inversiones financieras a corto plazo',0,NULL,NULL,1),(4431,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','540',4430,'Inversiones financieras a corto plazo en instrumentos de patrimonio',0,NULL,NULL,1),(4432,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','541',4430,'Valores representativos de deuda a corto plazo',0,NULL,NULL,1),(4433,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','542',4430,'Créditos a corto plazo',0,NULL,NULL,1),(4434,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','543',4430,'Créditos a corto plazo por enejenación de inmovilizado',0,NULL,NULL,1),(4435,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','544',4430,'Créditos a corto plazo al personal',0,NULL,NULL,1),(4436,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','545',4430,'Dividendo a cobrar',0,NULL,NULL,1),(4437,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','546',4430,'Intereses a corto plazo de valores reprsentativos de deuda',0,NULL,NULL,1),(4438,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','547',4430,'Intereses a corto plazo de créditos',0,NULL,NULL,1),(4439,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','548',4430,'Imposiciones a corto plazo',0,NULL,NULL,1),(4440,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','549',4430,'Desembolsos pendientes sobre participaciones en el patrimonio neto a corto plazo',0,NULL,NULL,1),(4441,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','55',4005,'Otras cuentas no bancarias',0,NULL,NULL,1),(4442,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','550',4441,'Titular de la explotación',0,NULL,NULL,1),(4443,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','551',4441,'Cuenta corriente con socios y administradores',0,NULL,NULL,1),(4444,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','552',4441,'Cuenta corriente otras personas y entidades vinculadas',0,NULL,NULL,1),(4445,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','5523',4444,'Cuenta corriente con empresas del grupo',0,NULL,NULL,1),(4446,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','5524',4444,'Cuenta corriente con empresas asociadas',0,NULL,NULL,1),(4447,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','5525',4444,'Cuenta corriente con otras partes vinculadas',0,NULL,NULL,1),(4448,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','554',4441,'Cuenta corriente con uniones temporales de empresas y comunidades de bienes',0,NULL,NULL,1),(4449,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','555',4441,'Partidas pendientes de aplicación',0,NULL,NULL,1),(4450,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','556',4441,'Desembolsos exigidos sobre participaciones en el patrimonio neto',0,NULL,NULL,1),(4451,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','5563',4450,'Desembolsos exigidos sobre participaciones empresas del grupo',0,NULL,NULL,1),(4452,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','5564',4450,'Desembolsos exigidos sobre participaciones empresas asociadas',0,NULL,NULL,1),(4453,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','5565',4450,'Desembolsos exigidos sobre participaciones otras partes vinculadas',0,NULL,NULL,1),(4454,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','5566',4450,'Desembolsos exigidos sobre participaciones otras empresas',0,NULL,NULL,1),(4455,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','557',4441,'Dividendo activo a cuenta',0,NULL,NULL,1),(4456,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','558',4441,'Socios por desembolsos exigidos',0,NULL,NULL,1),(4457,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','5580',4456,'Socios por desembolsos exigidos sobre acciones o participaciones ordinarias',0,NULL,NULL,1),(4458,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','5585',4456,'Socios por desembolsos exigidos sobre acciones o participaciones consideradas como pasivos financieros',0,NULL,NULL,1),(4459,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','559',4441,'Derivados financieros a corto plazo',0,NULL,NULL,1),(4460,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','5590',4459,'Activos por derivados financieros a corto plazo',0,NULL,NULL,1),(4461,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','5595',4459,'Pasivos por derivados financieros a corto plazo',0,NULL,NULL,1),(4462,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','56',4005,'Finanzas y depósitos recibidos y constituidos a corto plazo y ajustes por periodificación',0,NULL,NULL,1),(4463,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','560',4462,'Finanzas recibidas a corto plazo',0,NULL,NULL,1),(4464,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','561',4462,'Depósitos recibidos a corto plazo',0,NULL,NULL,1),(4465,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','565',4462,'Finanzas constituidas a corto plazo',0,NULL,NULL,1),(4466,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','566',4462,'Depósitos constituidos a corto plazo',0,NULL,NULL,1),(4467,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','567',4462,'Intereses pagados por anticipado',0,NULL,NULL,1),(4468,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','568',4462,'Intereses cobrados a corto plazo',0,NULL,NULL,1),(4469,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','57',4005,'Tesorería',0,NULL,NULL,1),(4470,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','CAJA','570',4469,'Caja euros',0,NULL,NULL,1),(4471,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','571',4469,'Caja moneda extranjera',0,NULL,NULL,1),(4472,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','BANCOS','572',4469,'Bancos e instituciones de crédito cc vista euros',0,NULL,NULL,1),(4473,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','573',4469,'Bancos e instituciones de crédito cc vista moneda extranjera',0,NULL,NULL,1),(4474,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','574',4469,'Bancos e instituciones de crédito cuentas de ahorro euros',0,NULL,NULL,1),(4475,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','575',4469,'Bancos e instituciones de crédito cuentas de ahorro moneda extranjera',0,NULL,NULL,1),(4476,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','576',4469,'Inversiones a corto plazo de gran liquidez',0,NULL,NULL,1),(4477,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','59',4005,'Deterioro del valor de las inversiones financieras a corto plazo',0,NULL,NULL,1),(4478,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','593',4477,'Deterioro del valor de participaciones a corto plazo en partes vinculadas',0,NULL,NULL,1),(4479,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','5933',4478,'Deterioro del valor de participaciones a corto plazo en empresas del grupo',0,NULL,NULL,1),(4480,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','5934',4478,'Deterioro del valor de participaciones a corto plazo en empresas asociadas',0,NULL,NULL,1),(4481,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','5935',4478,'Deterioro del valor de participaciones a corto plazo en otras partes vinculadas',0,NULL,NULL,1),(4482,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','594',4477,'Deterioro del valor de valores representativos de deuda a corto plazo en partes vinculadas',0,NULL,NULL,1),(4483,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','5943',4482,'Deterioro del valor de valores representativos de deuda a corto plazo en empresas del grupo',0,NULL,NULL,1),(4484,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','5944',4482,'Deterioro del valor de valores representativos de deuda a corto plazo en empresas asociadas',0,NULL,NULL,1),(4485,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','5945',4482,'Deterioro del valor de valores representativos de deuda a corto plazo en otras partes vinculadas',0,NULL,NULL,1),(4486,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','595',4477,'Deterioro del valor de créditos a corto plazo en partes vinculadas',0,NULL,NULL,1),(4487,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','5953',4486,'Deterioro del valor de créditos a corto plazo en empresas del grupo',0,NULL,NULL,1),(4488,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','5954',4486,'Deterioro del valor de créditos a corto plazo en empresas asociadas',0,NULL,NULL,1),(4489,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','5955',4486,'Deterioro del valor de créditos a corto plazo en otras partes vinculadas',0,NULL,NULL,1),(4490,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','596',4477,'Deterioro del valor de participaciones a corto plazo',0,NULL,NULL,1),(4491,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','597',4477,'Deterioro del valor de valores representativos de deuda a corto plazo',0,NULL,NULL,1),(4492,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','CUENTAS_FINANCIERAS','XXXXXX','598',4477,'Deterioro de valor de créditos a corto plazo',0,NULL,NULL,1),(4493,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','60',4006,'Compras',0,NULL,NULL,1),(4494,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','COMPRAS','600',4493,'Compras de mercaderías',0,NULL,NULL,1),(4495,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','COMPRAS','601',4493,'Compras de materias primas',0,NULL,NULL,1),(4496,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','602',4493,'Compras de otros aprovisionamientos',0,NULL,NULL,1),(4497,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','606',4493,'Descuentos sobre compras por pronto pago',0,NULL,NULL,1),(4498,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6060',4497,'Descuentos sobre compras por pronto pago de mercaderías',0,NULL,NULL,1),(4499,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6061',4497,'Descuentos sobre compras por pronto pago de materias primas',0,NULL,NULL,1),(4500,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6062',4497,'Descuentos sobre compras por pronto pago de otros aprovisionamientos',0,NULL,NULL,1),(4501,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','COMPRAS','607',4493,'Trabajos realizados por otras empresas',0,NULL,NULL,1),(4502,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','608',4493,'Devoluciones de compras y operaciones similares',0,NULL,NULL,1),(4503,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6080',4502,'Devoluciones de compras de mercaderías',0,NULL,NULL,1),(4504,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6081',4502,'Devoluciones de compras de materias primas',0,NULL,NULL,1),(4505,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6082',4502,'Devoluciones de compras de otros aprovisionamientos',0,NULL,NULL,1),(4506,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','609',4493,'Rappels por compras',0,NULL,NULL,1),(4507,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6090',4506,'Rappels por compras de mercaderías',0,NULL,NULL,1),(4508,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6091',4506,'Rappels por compras de materias primas',0,NULL,NULL,1),(4509,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6092',4506,'Rappels por compras de otros aprovisionamientos',0,NULL,NULL,1),(4510,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','61',4006,'Variación de existencias',0,NULL,NULL,1),(4511,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','610',4510,'Variación de existencias de mercaderías',0,NULL,NULL,1),(4512,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','611',4510,'Variación de existencias de materias primas',0,NULL,NULL,1),(4513,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','612',4510,'Variación de existencias de otros aprovisionamientos',0,NULL,NULL,1),(4514,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','62',4006,'Servicios exteriores',0,NULL,NULL,1),(4515,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','620',4514,'Gastos en investigación y desarrollo del ejercicio',0,NULL,NULL,1),(4516,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','621',4514,'Arrendamientos y cánones',0,NULL,NULL,1),(4517,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','622',4514,'Reparaciones y conservación',0,NULL,NULL,1),(4518,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','623',4514,'Servicios profesionales independientes',0,NULL,NULL,1),(4519,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','624',4514,'Transportes',0,NULL,NULL,1),(4520,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','625',4514,'Primas de seguros',0,NULL,NULL,1),(4521,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','626',4514,'Servicios bancarios y similares',0,NULL,NULL,1),(4522,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','627',4514,'Publicidad, propaganda y relaciones públicas',0,NULL,NULL,1),(4523,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','628',4514,'Suministros',0,NULL,NULL,1),(4524,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','629',4514,'Otros servicios',0,NULL,NULL,1),(4525,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','63',4006,'Tributos',0,NULL,NULL,1),(4526,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','630',4525,'Impuesto sobre benecifios',0,NULL,NULL,1),(4527,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6300',4526,'Impuesto corriente',0,NULL,NULL,1),(4528,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6301',4526,'Impuesto diferido',0,NULL,NULL,1),(4529,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','631',4525,'Otros tributos',0,NULL,NULL,1),(4530,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','633',4525,'Ajustes negativos en la imposición sobre beneficios',0,NULL,NULL,1),(4531,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','634',4525,'Ajustes negativos en la imposición indirecta',0,NULL,NULL,1),(4532,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6341',4531,'Ajustes negativos en IVA de activo corriente',0,NULL,NULL,1),(4533,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6342',4531,'Ajustes negativos en IVA de inversiones',0,NULL,NULL,1),(4534,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','636',4525,'Devolución de impuestos',0,NULL,NULL,1),(4535,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','638',4525,'Ajustes positivos en la imposición sobre beneficios',0,NULL,NULL,1),(4536,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','639',4525,'Ajustes positivos en la imposición directa',0,NULL,NULL,1),(4537,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6391',4536,'Ajustes positivos en IVA de activo corriente',0,NULL,NULL,1),(4538,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6392',4536,'Ajustes positivos en IVA de inversiones',0,NULL,NULL,1),(4539,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','64',4006,'Gastos de personal',0,NULL,NULL,1),(4540,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','640',4539,'Sueldos y salarios',0,NULL,NULL,1),(4541,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','641',4539,'Indemnizaciones',0,NULL,NULL,1),(4542,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','642',4539,'Seguridad social a cargo de la empresa',0,NULL,NULL,1),(4543,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','649',4539,'Otros gastos sociales',0,NULL,NULL,1),(4544,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','65',4006,'Otros gastos de gestión',0,NULL,NULL,1),(4545,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','650',4544,'Pérdidas de créditos comerciales incobrables',0,NULL,NULL,1),(4546,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','651',4544,'Resultados de operaciones en común',0,NULL,NULL,1),(4547,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6510',4546,'Beneficio transferido gestor',0,NULL,NULL,1),(4548,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6511',4546,'Pérdida soportada participe o asociado no gestor',0,NULL,NULL,1),(4549,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','659',4544,'Otras pérdidas en gestión corriente',0,NULL,NULL,1),(4550,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','66',4006,'Gastos financieros',0,NULL,NULL,1),(4551,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','660',4550,'Gastos financieros por actualización de provisiones',0,NULL,NULL,1),(4552,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','661',4550,'Intereses de obligaciones y bonos',0,NULL,NULL,1),(4553,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6610',4452,'Intereses de obligaciones y bonos a largo plazo empresas del grupo',0,NULL,NULL,1),(4554,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6611',4452,'Intereses de obligaciones y bonos a largo plazo empresas asociadas',0,NULL,NULL,1),(4555,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6612',4452,'Intereses de obligaciones y bonos a largo plazo otras partes vinculadas',0,NULL,NULL,1),(4556,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6613',4452,'Intereses de obligaciones y bonos a largo plazo otras empresas',0,NULL,NULL,1),(4557,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6615',4452,'Intereses de obligaciones y bonos a corto plazo empresas del grupo',0,NULL,NULL,1),(4558,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6616',4452,'Intereses de obligaciones y bonos a corto plazo empresas asociadas',0,NULL,NULL,1),(4559,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6617',4452,'Intereses de obligaciones y bonos a corto plazo otras partes vinculadas',0,NULL,NULL,1),(4560,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6618',4452,'Intereses de obligaciones y bonos a corto plazo otras empresas',0,NULL,NULL,1),(4561,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','662',4550,'Intereses de deudas',0,NULL,NULL,1),(4562,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6620',4561,'Intereses de deudas empresas del grupo',0,NULL,NULL,1),(4563,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6621',4561,'Intereses de deudas empresas asociadas',0,NULL,NULL,1),(4564,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6622',4561,'Intereses de deudas otras partes vinculadas',0,NULL,NULL,1),(4565,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6623',4561,'Intereses de deudas con entidades de crédito',0,NULL,NULL,1),(4566,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6624',4561,'Intereses de deudas otras empresas',0,NULL,NULL,1),(4567,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','663',4550,'Pérdidas por valorización de activos y pasivos financieros por su valor razonable',0,NULL,NULL,1),(4568,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','664',4550,'Gastos por dividendos de acciones o participaciones consideradas como pasivos financieros',0,NULL,NULL,1),(4569,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6640',4568,'Dividendos de pasivos empresas del grupo',0,NULL,NULL,1),(4570,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6641',4568,'Dividendos de pasivos empresas asociadas',0,NULL,NULL,1),(4571,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6642',4568,'Dividendos de pasivos otras partes vinculadas',0,NULL,NULL,1),(4572,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6643',4568,'Dividendos de pasivos otras empresas',0,NULL,NULL,1),(4573,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','665',4550,'Intereses por descuento de efectos y operaciones de factoring',0,NULL,NULL,1),(4574,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6650',4573,'Intereses por descuento de efectos en entidades de crédito del grupo',0,NULL,NULL,1),(4575,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6651',4573,'Intereses por descuento de efectos en entidades de crédito asociadas',0,NULL,NULL,1),(4576,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6652',4573,'Intereses por descuento de efectos en entidades de crédito vinculadas',0,NULL,NULL,1),(4577,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6653',4573,'Intereses por descuento de efectos en otras entidades de crédito',0,NULL,NULL,1),(4578,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6654',4573,'Intereses por operaciones de factoring con entidades de crédito del grupo',0,NULL,NULL,1),(4579,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6655',4573,'Intereses por operaciones de factoring con entidades de crédito asociadas',0,NULL,NULL,1),(4580,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6656',4573,'Intereses por operaciones de factoring con otras entidades de crédito vinculadas',0,NULL,NULL,1),(4581,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6657',4573,'Intereses por operaciones de factoring con otras entidades de crédito',0,NULL,NULL,1),(4582,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','666',4550,'Pérdidas en participaciones y valores representativos de deuda',0,NULL,NULL,1),(4583,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6660',4582,'Pérdidas en valores representativos de deuda a largo plazo empresas del grupo',0,NULL,NULL,1),(4584,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6661',4582,'Pérdidas en valores representativos de deuda a largo plazo empresas asociadas',0,NULL,NULL,1),(4585,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6662',4582,'Pérdidas en valores representativos de deuda a largo plazo otras partes vinculadas',0,NULL,NULL,1),(4586,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6663',4582,'Pérdidas en participaciones y valores representativos de deuda a largo plazo otras empresas',0,NULL,NULL,1),(4587,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6665',4582,'Pérdidas en participaciones y valores representativos de deuda a corto plazo empresas del grupo',0,NULL,NULL,1),(4588,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6666',4582,'Pérdidas en participaciones y valores representativos de deuda a corto plazo empresas asociadas',0,NULL,NULL,1),(4589,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6667',4582,'Pérdidas en valores representativos de deuda a corto plazo otras partes vinculadas',0,NULL,NULL,1),(4590,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6668',4582,'Pérdidas en valores representativos de deuda a corto plazo otras empresas',0,NULL,NULL,1),(4591,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','667',4550,'Pérdidas de créditos no comerciales',0,NULL,NULL,1),(4592,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6670',4591,'Pérdidas de créditos a largo plazo empresas del grupo',0,NULL,NULL,1),(4593,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6671',4591,'Pérdidas de créditos a largo plazo empresas asociadas',0,NULL,NULL,1),(4594,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6672',4591,'Pérdidas de créditos a largo plazo otras partes vinculadas',0,NULL,NULL,1),(4595,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6673',4591,'Pérdidas de créditos a largo plazo otras empresas',0,NULL,NULL,1),(4596,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6675',4591,'Pérdidas de créditos a corto plazo empresas del grupo',0,NULL,NULL,1),(4597,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6676',4591,'Pérdidas de créditos a corto plazo empresas asociadas',0,NULL,NULL,1),(4598,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6677',4591,'Pérdidas de créditos a corto plazo otras partes vinculadas',0,NULL,NULL,1),(4599,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6678',4591,'Pérdidas de créditos a corto plazo otras empresas',0,NULL,NULL,1),(4600,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','668',4550,'Diferencias negativas de cambio',0,NULL,NULL,1),(4601,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','669',4550,'Otros gastos financieros',0,NULL,NULL,1),(4602,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','67',4006,'Pérdidas procedentes de activos no corrientes y gastos excepcionales',0,NULL,NULL,1),(4603,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','670',4602,'Pérdidas procedentes del inmovilizado intangible',0,NULL,NULL,1),(4604,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','671',4602,'Pérdidas procedentes del inmovilizado material',0,NULL,NULL,1),(4605,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','672',4602,'Pérdidas procedentes de las inversiones inmobiliarias',0,NULL,NULL,1),(4607,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','673',4602,'Pérdidas procedentes de participaciones a largo plazo en partes vinculadas',0,NULL,NULL,1),(4608,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6733',4607,'Pérdidas procedentes de participaciones a largo plazo empresas del grupo',0,NULL,NULL,1),(4609,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6734',4607,'Pérdidas procedentes de participaciones a largo plazo empresas asociadas',0,NULL,NULL,1),(4610,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6735',4607,'Pérdidas procedentes de participaciones a largo plazo otras partes vinculadas',0,NULL,NULL,1),(4611,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','675',4602,'Pérdidas por operaciones con obligaciones propias',0,NULL,NULL,1),(4612,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','678',4602,'Gastos excepcionales',0,NULL,NULL,1),(4613,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','68',4006,'Dotaciones para amortizaciones',0,NULL,NULL,1),(4614,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','680',4613,'Amortización del inmovilizado intangible',0,NULL,NULL,1),(4615,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','681',4613,'Amortización del inmovilizado material',0,NULL,NULL,1),(4616,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','682',4613,'Amortización de las inversiones inmobiliarias',0,NULL,NULL,1),(4617,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','69',4006,'Pérdidas por deterioro y otras dotaciones',0,NULL,NULL,1),(4618,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','690',4617,'Pérdidas por deterioro del inmovilizado intangible',0,NULL,NULL,1),(4619,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','691',4617,'Pérdidas por deterioro del inmovilizado material',0,NULL,NULL,1),(4620,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','692',4617,'Pérdidas por deterioro de las inversiones inmobiliarias',0,NULL,NULL,1),(4621,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','693',4617,'Pérdidas por deterioro de existencias',0,NULL,NULL,1),(4622,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6930',4621,'Pérdidas por deterioro de productos terminados y en curso de fabricación',0,NULL,NULL,1),(4623,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6931',4621,'Pérdidas por deterioro de mercaderías',0,NULL,NULL,1),(4624,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6932',4621,'Pérdidas por deterioro de materias primas',0,NULL,NULL,1),(4625,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6933',4621,'Pérdidas por deterioro de otros aprovisionamientos',0,NULL,NULL,1),(4626,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','694',4617,'Pérdidas por deterioro de créditos por operaciones comerciales',0,NULL,NULL,1),(4627,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','695',4617,'Dotación a la provisión por operaciones comerciales',0,NULL,NULL,1),(4628,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6954',4627,'Dotación a la provisión por contratos onerosos',0,NULL,NULL,1),(4629,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6959',4628,'Dotación a la provisión para otras operaciones comerciales',0,NULL,NULL,1),(4630,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','696',4617,'Pérdidas por deterioro de participaciones y valores representativos de deuda a largo plazo',0,NULL,NULL,1),(4631,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6960',4630,'Pérdidas por deterioro de participaciones en instrumentos de patrimonio neto a largo plazo empresas del grupo',0,NULL,NULL,1),(4632,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6961',4630,'Pérdidas por deterioro de participaciones en instrumentos de patrimonio neto a largo plazo empresas asociadas',0,NULL,NULL,1),(4633,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6962',4630,'Pérdidas por deterioro de participaciones en instrumentos de patrimonio neto a largo plazo otras partes vinculadas',0,NULL,NULL,1),(4634,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6963',4630,'Pérdidas por deterioro de participaciones en instrumentos de patrimonio neto a largo plazo otras empresas',0,NULL,NULL,1),(4635,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6965',4630,'Pérdidas por deterioro en valores representativos de deuda a largo plazo empresas del grupo',0,NULL,NULL,1),(4636,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6966',4630,'Pérdidas por deterioro en valores representativos de deuda a largo plazo empresas asociadas',0,NULL,NULL,1),(4637,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6967',4630,'Pérdidas por deterioro en valores representativos de deuda a largo plazo otras partes vinculadas',0,NULL,NULL,1),(4638,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6968',4630,'Pérdidas por deterioro en valores representativos de deuda a largo plazo otras empresas',0,NULL,NULL,1),(4639,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','697',4617,'Pérdidas por deterioro de créditos a largo plazo',0,NULL,NULL,1),(4640,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6970',4639,'Pérdidas por deterioro de créditos a largo plazo empresas del grupo',0,NULL,NULL,1),(4641,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6971',4639,'Pérdidas por deterioro de créditos a largo plazo empresas asociadas',0,NULL,NULL,1),(4642,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6972',4639,'Pérdidas por deterioro de créditos a largo plazo otras partes vinculadas',0,NULL,NULL,1),(4643,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6973',4639,'Pérdidas por deterioro de créditos a largo plazo otras empresas',0,NULL,NULL,1),(4644,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','698',4617,'Pérdidas por deterioro de participaciones y valores representativos de deuda a corto plazo',0,NULL,NULL,1),(4645,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6980',4644,'Pérdidas por deterioro de participaciones en instrumentos de patrimonio neto a corto plazo empresas del grupo',0,NULL,NULL,1),(4646,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6981',4644,'Pérdidas por deterioro de participaciones en instrumentos de patrimonio neto a corto plazo empresas asociadas',0,NULL,NULL,1),(4647,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6985',4644,'Pérdidas por deterioro en valores representativos de deuda a corto plazo empresas del grupo',0,NULL,NULL,1),(4648,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6986',4644,'Pérdidas por deterioro en valores representativos de deuda a corto plazo empresas asociadas',0,NULL,NULL,1),(4649,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6988',4644,'Pérdidas por deterioro en valores representativos de deuda a corto plazo de otras empresas',0,NULL,NULL,1),(4650,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','699',4617,'Pérdidas por deterioro de crédito a corto plazo',0,NULL,NULL,1),(4651,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6990',4650,'Pérdidas por deterioro de crédito a corto plazo empresas del grupo',0,NULL,NULL,1),(4652,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6991',4650,'Pérdidas por deterioro de crédito a corto plazo empresas asociadas',0,NULL,NULL,1),(4653,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6992',4650,'Pérdidas por deterioro de crédito a corto plazo otras partes vinculadas',0,NULL,NULL,1),(4654,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','COMPRAS_GASTOS','XXXXXX','6993',4650,'Pérdidas por deterioro de crédito a corto plazo otras empresas',0,NULL,NULL,1),(4655,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','70',4007,'Ventas',0,NULL,NULL,1),(4656,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','VENTAS','700',4655,'Ventas de mercaderías',0,NULL,NULL,1),(4657,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','VENTAS','701',4655,'Ventas de productos terminados',0,NULL,NULL,1),(4658,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','702',4655,'Ventas de productos semiterminados',0,NULL,NULL,1),(4659,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','703',4655,'Ventas de subproductos y residuos',0,NULL,NULL,1),(4660,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','704',4655,'Ventas de envases y embalajes',0,NULL,NULL,1),(4661,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','VENTAS','705',4655,'Prestaciones de servicios',0,NULL,NULL,1),(4662,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','706',4655,'Descuentos sobre ventas por pronto pago',0,NULL,NULL,1),(4663,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','7060',4662,'Descuentos sobre ventas por pronto pago de mercaderías',0,NULL,NULL,1),(4664,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','7061',4662,'Descuentos sobre ventas por pronto pago de productos terminados',0,NULL,NULL,1),(4665,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','7062',4662,'Descuentos sobre ventas por pronto pago de productos semiterminados',0,NULL,NULL,1),(4666,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','7063',4662,'Descuentos sobre ventas por pronto pago de subproductos y residuos',0,NULL,NULL,1),(4667,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','708',4655,'Devoluciones de ventas y operacioes similares',0,NULL,NULL,1),(4668,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','7080',4667,'Devoluciones de ventas de mercaderías',0,NULL,NULL,1),(4669,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','7081',4667,'Devoluciones de ventas de productos terminados',0,NULL,NULL,1),(4670,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','7082',4667,'Devoluciones de ventas de productos semiterminados',0,NULL,NULL,1),(4671,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','7083',4667,'Devoluciones de ventas de subproductos y residuos',0,NULL,NULL,1),(4672,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','7084',4667,'Devoluciones de ventas de envases y embalajes',0,NULL,NULL,1),(4673,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','71',4007,'Variación de existencias',0,NULL,NULL,1),(4674,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','710',4673,'Variación de existencias de productos en curso',0,NULL,NULL,1),(4675,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','711',4673,'Variación de existencias de productos semiterminados',0,NULL,NULL,1),(4676,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','712',4673,'Variación de existencias de productos terminados',0,NULL,NULL,1),(4677,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','713',4673,'Variación de existencias de subproductos, residuos y materiales recuperados',0,NULL,NULL,1),(4678,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','73',4007,'Trabajos realizados para la empresa',0,NULL,NULL,1),(4679,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','730',4678,'Trabajos realizados para el inmovilizado intangible',0,NULL,NULL,1),(4680,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','731',4678,'Trabajos realizados para el inmovilizado tangible',0,NULL,NULL,1),(4681,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','732',4678,'Trabajos realizados en inversiones inmobiliarias',0,NULL,NULL,1),(4682,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','733',4678,'Trabajos realizados para el inmovilizado material en curso',0,NULL,NULL,1),(4683,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','74',4007,'Subvenciones, donaciones y legados',0,NULL,NULL,1),(4684,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','740',4683,'Subvenciones, donaciones y legados a la explotación',0,NULL,NULL,1),(4685,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','746',4683,'Subvenciones, donaciones y legados de capital transferidos al resultado del ejercicio',0,NULL,NULL,1),(4686,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','747',4683,'Otras subvenciones, donaciones y legados transferidos al resultado del ejercicio',0,NULL,NULL,1),(4687,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','75',4007,'Otros ingresos de gestión',0,NULL,NULL,1),(4688,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','751',4687,'Resultados de operaciones en común',0,NULL,NULL,1),(4689,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','7510',4688,'Pérdida transferida gestor',0,NULL,NULL,1),(4690,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','7511',4688,'Beneficio atribuido participe o asociado no gestor',0,NULL,NULL,1),(4691,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','752',4687,'Ingreso por arrendamiento',0,NULL,NULL,1),(4692,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','753',4687,'Ingresos de propiedad industrial cedida en explotación',0,NULL,NULL,1),(4693,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','754',4687,'Ingresos por comisiones',0,NULL,NULL,1),(4694,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','755',4687,'Ingresos por servicios al personal',0,NULL,NULL,1),(4695,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','759',4687,'Ingresos por servicios diversos',0,NULL,NULL,1),(4696,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','76',4007,'Ingresos financieros',0,NULL,NULL,1),(4697,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','760',4696,'Ingresos de participaciones en instrumentos de patrimonio',0,NULL,NULL,1),(4698,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','7600',4697,'Ingresos de participaciones en instrumentos de patrimonio empresas del grupo',0,NULL,NULL,1),(4699,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','7601',4697,'Ingresos de participaciones en instrumentos de patrimonio empresas asociadas',0,NULL,NULL,1),(4700,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','7602',4697,'Ingresos de participaciones en instrumentos de patrimonio otras partes asociadas',0,NULL,NULL,1),(4701,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','7603',4697,'Ingresos de participaciones en instrumentos de patrimonio otras empresas',0,NULL,NULL,1),(4702,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','761',4696,'Ingresos de valores representativos de deuda',0,NULL,NULL,1),(4703,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','7610',4702,'Ingresos de valores representativos de deuda empresas del grupo',0,NULL,NULL,1),(4704,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','7611',4702,'Ingresos de valores representativos de deuda empresas asociadas',0,NULL,NULL,1),(4705,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','7612',4702,'Ingresos de valores representativos de deuda otras partes asociadas',0,NULL,NULL,1),(4706,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','7613',4702,'Ingresos de valores representativos de deuda otras empresas',0,NULL,NULL,1),(4707,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','762',4696,'Ingresos de créditos',0,NULL,NULL,1),(4708,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','7620',4707,'Ingresos de créditos a largo plazo',0,NULL,NULL,1),(4709,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','76200',4708,'Ingresos de crédito a largo plazo empresas del grupo',0,NULL,NULL,1),(4710,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','76201',4708,'Ingresos de crédito a largo plazo empresas asociadas',0,NULL,NULL,1),(4711,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','76202',4708,'Ingresos de crédito a largo plazo otras partes asociadas',0,NULL,NULL,1),(4712,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','76203',4708,'Ingresos de crédito a largo plazo otras empresas',0,NULL,NULL,1),(4713,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','7621',4707,'Ingresos de créditos a corto plazo',0,NULL,NULL,1),(4714,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','76210',4713,'Ingresos de crédito a corto plazo empresas del grupo',0,NULL,NULL,1),(4715,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','76211',4713,'Ingresos de crédito a corto plazo empresas asociadas',0,NULL,NULL,1),(4716,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','76212',4713,'Ingresos de crédito a corto plazo otras partes asociadas',0,NULL,NULL,1),(4717,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','76213',4713,'Ingresos de crédito a corto plazo otras empresas',0,NULL,NULL,1),(4718,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','763',4696,'Beneficios por valorización de activos y pasivos financieros por su valor razonable',0,NULL,NULL,1),(4719,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','766',4696,'Beneficios en participaciones y valores representativos de deuda',0,NULL,NULL,1),(4720,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','7660',4719,'Beneficios en participaciones y valores representativos de deuda a largo plazo empresas del grupo',0,NULL,NULL,1),(4721,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','7661',4719,'Beneficios en participaciones y valores representativos de deuda a largo plazo empresas asociadas',0,NULL,NULL,1),(4722,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','7662',4719,'Beneficios en participaciones y valores representativos de deuda a largo plazo otras partes asociadas',0,NULL,NULL,1),(4723,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','7663',4719,'Beneficios en participaciones y valores representativos de deuda a largo plazo otras empresas',0,NULL,NULL,1),(4724,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','7665',4719,'Beneficios en participaciones y valores representativos de deuda a corto plazo empresas del grupo',0,NULL,NULL,1),(4725,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','7666',4719,'Beneficios en participaciones y valores representativos de deuda a corto plazo empresas asociadas',0,NULL,NULL,1),(4726,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','7667',4719,'Beneficios en participaciones y valores representativos de deuda a corto plazo otras partes asociadas',0,NULL,NULL,1),(4727,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','7668',4719,'Beneficios en participaciones y valores representativos de deuda a corto plazo otras empresas',0,NULL,NULL,1),(4728,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','768',4696,'Diferencias positivas de cambio',0,NULL,NULL,1),(4729,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','769',4696,'Otros ingresos financieros',0,NULL,NULL,1),(4730,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','77',4007,'Beneficios procedentes de activos no corrientes e ingresos excepcionales',0,NULL,NULL,1),(4731,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','770',4730,'Beneficios procedentes del inmovilizado intangible',0,NULL,NULL,1),(4732,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','771',4730,'Beneficios procedentes del inmovilizado material',0,NULL,NULL,1),(4733,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','772',4730,'Beneficios procedentes de las inversiones inmobiliarias',0,NULL,NULL,1),(4734,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','773',4730,'Beneficios procedentes de participaciones a largo plazo en partes vinculadas',0,NULL,NULL,1),(4735,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','7733',4734,'Beneficios procedentes de participaciones a largo plazo empresas del grupo',0,NULL,NULL,1),(4736,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','7734',4734,'Beneficios procedentes de participaciones a largo plazo empresas asociadas',0,NULL,NULL,1),(4737,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','7735',4734,'Beneficios procedentes de participaciones a largo plazo otras partes vinculadas',0,NULL,NULL,1),(4738,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','775',4730,'Beneficios por operaciones con obligaciones propias',0,NULL,NULL,1),(4739,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','778',4730,'Ingresos excepcionales',0,NULL,NULL,1),(4741,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','79',4007,'Excesos y aplicaciones de provisiones y pérdidas por deterioro',0,NULL,NULL,1),(4742,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','790',4741,'Revisión del deterioro del inmovilizado intangible',0,NULL,NULL,1),(4743,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','791',4741,'Revisión del deterioro del inmovilizado material',0,NULL,NULL,1),(4744,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','792',4741,'Revisión del deterioro de las inversiones inmobiliarias',0,NULL,NULL,1),(4745,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','793',4741,'Revisión del deterioro de las existencias',0,NULL,NULL,1),(4746,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','7930',4745,'Revisión del deterioro de productos terminados y en curso de fabricación',0,NULL,NULL,1),(4747,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','7931',4745,'Revisión del deterioro de mercaderías',0,NULL,NULL,1),(4748,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','7932',4745,'Revisión del deterioro de materias primas',0,NULL,NULL,1),(4749,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','7933',4745,'Revisión del deterioro de otros aprovisionamientos',0,NULL,NULL,1),(4750,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','794',4741,'Revisión del deterioro de créditos por operaciones comerciales',0,NULL,NULL,1),(4751,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','795',4741,'Exceso de provisiones',0,NULL,NULL,1),(4752,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','7951',4751,'Exceso de provisión para impuestos',0,NULL,NULL,1),(4753,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','7952',4751,'Exceso de provisión para otras responsabilidades',0,NULL,NULL,1),(4755,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','7954',4751,'Exceso de provisión para operaciones comerciales',0,NULL,NULL,1),(4756,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','79544',4755,'Exceso de provisión por contratos onerosos',0,NULL,NULL,1),(4757,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','79549',4755,'Exceso de provisión para otras operaciones comerciales',0,NULL,NULL,1),(4758,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','7955',4751,'Exceso de provisión para actuaciones medioambienteales',0,NULL,NULL,1),(4759,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','796',4741,'Revisión del deterioro de participaciones y valores representativos de deuda a largo plazo',0,NULL,NULL,1),(4760,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','7960',4759,'Revisión del deterioro de participaciones en instrumentos de patrimonio neto a largo plazo empresas del grupo',0,NULL,NULL,1),(4761,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','7961',4759,'Revisión del deterioro de participaciones en instrumentos de patrimonio neto a largo plazo empresas asociadas',0,NULL,NULL,1),(4762,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','7962',4759,'Revisión del deterioro de participaciones en instrumentos de patrimonio neto a largo plazo otras partes vinculadas',0,NULL,NULL,1),(4763,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','7963',4759,'Revisión del deterioro de participaciones en instrumentos de patrimonio neto a largo plazo otras empresas',0,NULL,NULL,1),(4764,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','7965',4759,'Revisión del deterioro de valores representativos a largo plazo empresas del grupo',0,NULL,NULL,1),(4765,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','7966',4759,'Revisión del deterioro de valores representativos a largo plazo empresas asociadas',0,NULL,NULL,1),(4766,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','7967',4759,'Revisión del deterioro de valores representativos a largo otras partes vinculadas',0,NULL,NULL,1),(4767,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','7968',4759,'Revisión del deterioro de valores representativos a largo plazo otras empresas',0,NULL,NULL,1),(4768,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','797',4741,'Revisión del deterioro de créditos a largo plazo',0,NULL,NULL,1),(4769,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','7970',4768,'Revisión del deterioro de créditos a largo plazo empresas del grupo',0,NULL,NULL,1),(4770,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','7971',4768,'Revisión del deterioro de créditos a largo plazo empresas asociadas',0,NULL,NULL,1),(4771,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','7972',4768,'Revisión del deterioro de créditos a largo plazo otras partes vinculadas',0,NULL,NULL,1),(4772,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','7973',4768,'Revisión del deterioro de créditos a largo plazo otras empresas',0,NULL,NULL,1),(4773,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','798',4741,'Revisión del deterioro de participaciones y valores representativos de deuda a corto plazo',0,NULL,NULL,1),(4774,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','7980',4773,'Revisión del deterioro de participaciones en instrumentos de patrimonio neto a corto plazo empresas del grupo',0,NULL,NULL,1),(4775,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','7981',4773,'Revisión del deterioro de participaciones en instrumentos de patrimonio neto a corto plazo empresas asociadas',0,NULL,NULL,1),(4776,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','7985',4773,'Revisión del deterioro de valores representativos de deuda a corto plazo empresas del grupo',0,NULL,NULL,1),(4777,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','7986',4773,'Revisión del deterioro de valores representativos de deuda a corto plazo empresas asociadas',0,NULL,NULL,1),(4778,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','7987',4773,'Revisión del deterioro de valores representativos de deuda a corto plazo otras partes vinculadas',0,NULL,NULL,1),(4779,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','7988',4773,'Revisión del deterioro de valores representativos de deuda a corto plazo otras empresas',0,NULL,NULL,1),(4780,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','799',4741,'Revisión del deterioro de créditos a corto plazo',0,NULL,NULL,1),(4781,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','7990',4780,'Revisión del deterioro de créditos a corto plazo empresas del grupo',0,NULL,NULL,1),(4782,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','7991',4780,'Revisión del deterioro de créditos a corto plazo empresas asociadas',0,NULL,NULL,1),(4783,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','7992',4780,'Revisión del deterioro de créditos a corto plazo otras partes vinculadas',0,NULL,NULL,1),(4784,1,NULL,'2016-01-22 17:28:16','PCG08-PYME','VENTAS_E_INGRESOS','XXXXXX','7993',4780,'Revisión del deterioro de créditos a corto plazo otras empresas',0,NULL,NULL,1); +/*!40000 ALTER TABLE `llx_accounting_account` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_accounting_bookkeeping` +-- + +DROP TABLE IF EXISTS `llx_accounting_bookkeeping`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_accounting_bookkeeping` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `doc_date` date NOT NULL, + `doc_type` varchar(30) NOT NULL, + `doc_ref` varchar(300) NOT NULL, + `fk_doc` int(11) NOT NULL, + `fk_docdet` int(11) NOT NULL, + `code_tiers` varchar(24) DEFAULT NULL, + `numero_compte` varchar(32) DEFAULT NULL, + `label_compte` varchar(128) NOT NULL, + `debit` double NOT NULL, + `credit` double NOT NULL, + `montant` double NOT NULL, + `sens` varchar(1) DEFAULT NULL, + `fk_user_author` int(11) NOT NULL, + `import_key` varchar(14) DEFAULT NULL, + `code_journal` varchar(10) DEFAULT NULL, + `piece_num` int(11) NOT NULL, + `validated` tinyint(4) NOT NULL DEFAULT '0', + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_accounting_bookkeeping` +-- + +LOCK TABLES `llx_accounting_bookkeeping` WRITE; +/*!40000 ALTER TABLE `llx_accounting_bookkeeping` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_accounting_bookkeeping` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_accounting_fiscalyear` +-- + +DROP TABLE IF EXISTS `llx_accounting_fiscalyear`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_accounting_fiscalyear` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `label` varchar(128) NOT NULL, + `date_start` date DEFAULT NULL, + `date_end` date DEFAULT NULL, + `statut` tinyint(4) NOT NULL DEFAULT '0', + `entity` int(11) NOT NULL DEFAULT '1', + `datec` datetime NOT NULL, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `fk_user_author` int(11) DEFAULT NULL, + `fk_user_modif` int(11) DEFAULT NULL, + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_accounting_fiscalyear` +-- + +LOCK TABLES `llx_accounting_fiscalyear` WRITE; +/*!40000 ALTER TABLE `llx_accounting_fiscalyear` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_accounting_fiscalyear` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_accounting_journal` +-- + +DROP TABLE IF EXISTS `llx_accounting_journal`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_accounting_journal` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `code` varchar(32) NOT NULL, + `label` varchar(128) NOT NULL, + `nature` smallint(6) NOT NULL DEFAULT '0', + `active` smallint(6) DEFAULT '0', + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_accounting_journal_code` (`code`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_accounting_journal` +-- + +LOCK TABLES `llx_accounting_journal` WRITE; +/*!40000 ALTER TABLE `llx_accounting_journal` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_accounting_journal` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_accounting_system` +-- + +DROP TABLE IF EXISTS `llx_accounting_system`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_accounting_system` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `pcg_version` varchar(32) DEFAULT NULL, + `label` varchar(128) NOT NULL, + `active` smallint(6) DEFAULT '0', + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_accounting_system_pcg_version` (`pcg_version`) +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_accounting_system` +-- + +LOCK TABLES `llx_accounting_system` WRITE; +/*!40000 ALTER TABLE `llx_accounting_system` DISABLE KEYS */; +INSERT INTO `llx_accounting_system` VALUES (1,'PCG99-ABREGE','The simple accountancy french plan',1),(2,'PCG99-BASE','The base accountancy french plan',1),(3,'PCMN-BASE','The base accountancy belgium plan',1),(4,'PCG08-PYME','The PYME accountancy spanish plan',1); +/*!40000 ALTER TABLE `llx_accounting_system` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_actioncomm` +-- + +DROP TABLE IF EXISTS `llx_actioncomm`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_actioncomm` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `ref_ext` varchar(128) DEFAULT NULL, + `entity` int(11) NOT NULL DEFAULT '1', + `datep` datetime DEFAULT NULL, + `datep2` datetime DEFAULT NULL, + `fk_action` int(11) DEFAULT NULL, + `code` varchar(32) DEFAULT NULL, + `label` varchar(128) NOT NULL, + `datec` datetime DEFAULT NULL, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `fk_user_author` int(11) DEFAULT NULL, + `fk_user_mod` int(11) DEFAULT NULL, + `fk_project` int(11) DEFAULT NULL, + `fk_soc` int(11) DEFAULT NULL, + `fk_contact` int(11) DEFAULT NULL, + `fk_parent` int(11) NOT NULL DEFAULT '0', + `fk_user_action` int(11) DEFAULT NULL, + `transparency` int(11) DEFAULT NULL, + `fk_user_done` int(11) DEFAULT NULL, + `priority` smallint(6) DEFAULT NULL, + `fulldayevent` smallint(6) NOT NULL DEFAULT '0', + `punctual` smallint(6) NOT NULL DEFAULT '1', + `percent` smallint(6) NOT NULL DEFAULT '0', + `location` varchar(128) DEFAULT NULL, + `durationp` double DEFAULT NULL, + `durationa` double DEFAULT NULL, + `note` text, + `fk_element` int(11) DEFAULT NULL, + `elementtype` varchar(255) DEFAULT NULL, + `email_msgid` varchar(256) DEFAULT NULL, + `email_subject` varchar(256) DEFAULT NULL, + `email_from` varchar(256) DEFAULT NULL, + `email_sender` varchar(256) DEFAULT NULL, + `email_to` varchar(256) DEFAULT NULL, + `email_tocc` varchar(256) DEFAULT NULL, + `email_tobcc` varchar(256) DEFAULT NULL, + `errors_to` varchar(256) DEFAULT NULL, + `recurid` varchar(128) DEFAULT NULL, + `recurrule` varchar(128) DEFAULT NULL, + `recurdateend` datetime DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `idx_actioncomm_fk_soc` (`fk_soc`), + KEY `idx_actioncomm_fk_contact` (`fk_contact`), + KEY `idx_actioncomm_fk_element` (`fk_element`), + KEY `idx_actioncomm_code` (`code`) +) ENGINE=InnoDB AUTO_INCREMENT=239 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_actioncomm` +-- + +LOCK TABLES `llx_actioncomm` WRITE; +/*!40000 ALTER TABLE `llx_actioncomm` DISABLE KEYS */; +INSERT INTO `llx_actioncomm` VALUES (1,NULL,1,'2010-07-08 14:21:44','2010-07-08 14:21:44',50,NULL,'Company AAA and Co added into Dolibarr','2010-07-08 14:21:44','2014-12-21 12:50:33',1,NULL,NULL,1,NULL,0,1,NULL,1,0,0,1,100,'',NULL,NULL,'Company AAA and Co added into Dolibarr\nAuthor: admin',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(2,NULL,1,'2010-07-08 14:23:48','2010-07-08 14:23:48',50,NULL,'Company Belin SARL added into Dolibarr','2010-07-08 14:23:48','2014-12-21 12:50:33',1,NULL,NULL,2,NULL,0,1,NULL,1,0,0,1,100,'',NULL,NULL,'Company Belin SARL added into Dolibarr\nAuthor: admin',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(3,NULL,1,'2010-07-08 22:42:12','2010-07-08 22:42:12',50,NULL,'Company Spanish Comp added into Dolibarr','2010-07-08 22:42:12','2014-12-21 12:50:33',1,NULL,NULL,3,NULL,0,1,NULL,1,0,0,1,100,'',NULL,NULL,'Company Spanish Comp added into Dolibarr\nAuthor: admin',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(4,NULL,1,'2010-07-08 22:48:18','2010-07-08 22:48:18',50,NULL,'Company Prospector Vaalen added into Dolibarr','2010-07-08 22:48:18','2014-12-21 12:50:33',1,NULL,NULL,4,NULL,0,1,NULL,1,0,0,1,100,'',NULL,NULL,'Company Prospector Vaalen added into Dolibarr\nAuthor: admin',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(5,NULL,1,'2010-07-08 23:22:57','2010-07-08 23:22:57',50,NULL,'Company NoCountry Co added into Dolibarr','2010-07-08 23:22:57','2014-12-21 12:50:33',1,NULL,NULL,5,NULL,0,1,NULL,1,0,0,1,100,'',NULL,NULL,'Company NoCountry Co added into Dolibarr\nAuthor: admin',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(6,NULL,1,'2010-07-09 00:15:09','2010-07-09 00:15:09',50,NULL,'Company Swiss customer added into Dolibarr','2010-07-09 00:15:09','2014-12-21 12:50:33',1,NULL,NULL,6,NULL,0,1,NULL,1,0,0,1,100,'',NULL,NULL,'Company Swiss customer added into Dolibarr\nAuthor: admin',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(7,NULL,1,'2010-07-09 01:24:26','2010-07-09 01:24:26',50,NULL,'Company Generic customer added into Dolibarr','2010-07-09 01:24:26','2014-12-21 12:50:33',1,NULL,NULL,7,NULL,0,1,NULL,1,0,0,1,100,'',NULL,NULL,'Company Generic customer added into Dolibarr\nAuthor: admin',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(8,NULL,1,'2010-07-10 14:54:27','2010-07-10 14:54:27',50,NULL,'Société Client salon ajoutée dans Dolibarr','2010-07-10 14:54:27','2014-12-21 12:50:33',1,NULL,NULL,8,NULL,0,1,NULL,1,0,0,1,100,'',NULL,NULL,'Société Client salon ajoutée dans Dolibarr\nAuteur: admin',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(9,NULL,1,'2010-07-10 14:54:44','2010-07-10 14:54:44',50,NULL,'Société Client salon invidivdu ajoutée dans Doliba','2010-07-10 14:54:44','2014-12-21 12:50:33',1,NULL,NULL,9,NULL,0,1,NULL,1,0,0,1,100,'',NULL,NULL,'Société Client salon invidivdu ajoutée dans Dolibarr\nAuteur: admin',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(10,NULL,1,'2010-07-10 14:56:10','2010-07-10 14:56:10',50,NULL,'Facture FA1007-0001 validée dans Dolibarr','2010-07-10 14:56:10','2014-12-21 12:50:33',1,NULL,NULL,9,NULL,0,1,NULL,1,0,0,1,100,'',NULL,NULL,'Facture FA1007-0001 validée dans Dolibarr\nAuteur: admin',1,'invoice',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(11,NULL,1,'2010-07-10 14:58:53','2010-07-10 14:58:53',50,NULL,'Facture FA1007-0001 validée dans Dolibarr','2010-07-10 14:58:53','2014-12-21 12:50:33',1,NULL,NULL,9,NULL,0,1,NULL,1,0,0,1,100,'',NULL,NULL,'Facture FA1007-0001 validée dans Dolibarr\nAuteur: admin',1,'invoice',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(12,NULL,1,'2010-07-10 15:00:55','2010-07-10 15:00:55',50,NULL,'Facture FA1007-0001 passée à payée dans Dolibarr','2010-07-10 15:00:55','2014-12-21 12:50:33',1,NULL,NULL,9,NULL,0,1,NULL,1,0,0,1,100,'',NULL,NULL,'Facture FA1007-0001 passée à payée dans Dolibarr\nAuteur: admin',1,'invoice',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(13,NULL,1,'2010-07-10 15:13:08','2010-07-10 15:13:08',50,NULL,'Société Smith Vick ajoutée dans Dolibarr','2010-07-10 15:13:08','2014-12-21 12:50:33',1,NULL,NULL,10,NULL,0,1,NULL,1,0,0,1,100,'',NULL,NULL,'Société Smith Vick ajoutée dans Dolibarr\nAuteur: admin',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(14,NULL,1,'2010-07-10 15:21:00','2010-07-10 16:21:00',5,NULL,'RDV avec mon chef','2010-07-10 15:21:48','2010-07-10 13:21:48',1,NULL,NULL,NULL,NULL,0,1,NULL,NULL,0,0,1,0,'',3600,NULL,'',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(15,NULL,1,'2010-07-10 18:18:16','2010-07-10 18:18:16',50,NULL,'Contrat CONTRAT1 validé dans Dolibarr','2010-07-10 18:18:16','2014-12-21 12:50:33',1,NULL,NULL,2,NULL,0,1,NULL,1,0,0,1,100,'',NULL,NULL,'Contrat CONTRAT1 validé dans Dolibarr\nAuteur: admin',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(16,NULL,1,'2010-07-10 18:35:57','2010-07-10 18:35:57',50,NULL,'Société Mon client ajoutée dans Dolibarr','2010-07-10 18:35:57','2014-12-21 12:50:33',1,NULL,NULL,11,NULL,0,1,NULL,1,0,0,1,100,'',NULL,NULL,'Société Mon client ajoutée dans Dolibarr\nAuteur: admin',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(17,NULL,1,'2010-07-11 16:18:08','2010-07-11 16:18:08',50,NULL,'Société Dupont Alain ajoutée dans Dolibarr','2010-07-11 16:18:08','2014-12-21 12:50:33',1,NULL,NULL,12,NULL,0,1,NULL,1,0,0,1,100,'',NULL,NULL,'Société Dupont Alain ajoutée dans Dolibarr\nAuteur: admin',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(18,NULL,1,'2010-07-11 17:11:00','2010-07-11 17:17:00',5,NULL,'Rendez-vous','2010-07-11 17:11:22','2010-07-11 15:11:22',1,NULL,NULL,NULL,NULL,0,1,NULL,NULL,0,0,1,0,'gfgdfgdf',360,NULL,'',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(19,NULL,1,'2010-07-11 17:13:20','2010-07-11 17:13:20',50,NULL,'Société Vendeur de chips ajoutée dans Dolibarr','2010-07-11 17:13:20','2014-12-21 12:50:33',1,NULL,NULL,13,NULL,0,1,NULL,1,0,0,1,100,'',NULL,NULL,'Société Vendeur de chips ajoutée dans Dolibarr\nAuteur: admin',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(20,NULL,1,'2010-07-11 17:15:42','2010-07-11 17:15:42',50,NULL,'Commande CF1007-0001 validée','2010-07-11 17:15:42','2014-12-21 12:50:33',1,NULL,NULL,13,NULL,0,1,NULL,1,0,0,1,100,'',NULL,NULL,'Commande CF1007-0001 validée\nAuteur: admin',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(21,NULL,1,'2010-07-11 18:47:33','2010-07-11 18:47:33',50,NULL,'Commande CF1007-0002 validée','2010-07-11 18:47:33','2014-12-21 12:50:33',1,NULL,NULL,1,NULL,0,1,NULL,1,0,0,1,100,'',NULL,NULL,'Commande CF1007-0002 validée\nAuteur: admin',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(22,NULL,1,'2010-07-18 11:36:18','2010-07-18 11:36:18',50,NULL,'Proposition PR1007-0003 validée','2010-07-18 11:36:18','2014-12-21 12:50:33',1,NULL,NULL,4,NULL,0,1,NULL,1,0,0,1,100,'',NULL,NULL,'Proposition PR1007-0003 validée\nAuteur: admin',3,'propal',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(23,NULL,1,'2011-07-18 20:49:58','2011-07-18 20:49:58',50,NULL,'Invoice FA1007-0002 validated in Dolibarr','2011-07-18 20:49:58','2014-12-21 12:50:33',1,NULL,NULL,2,NULL,0,1,NULL,1,0,0,1,-1,'',NULL,NULL,'Invoice FA1007-0002 validated in Dolibarr\nAuthor: admin',2,'invoice',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(24,NULL,1,'2011-07-28 01:37:00',NULL,1,NULL,'Phone call','2011-07-28 01:37:48','2011-07-27 23:37:48',1,NULL,NULL,NULL,2,0,1,NULL,NULL,0,0,1,-1,'',NULL,NULL,'',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(25,NULL,1,'2011-08-01 02:31:24','2011-08-01 02:31:24',50,NULL,'Company mmm added into Dolibarr','2011-08-01 02:31:24','2014-12-21 12:50:33',1,NULL,NULL,15,NULL,0,1,NULL,1,0,0,1,-1,'',NULL,NULL,'Company mmm added into Dolibarr\nAuthor: admin',15,'societe',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(26,NULL,1,'2011-08-01 02:31:43','2011-08-01 02:31:43',50,NULL,'Company ppp added into Dolibarr','2011-08-01 02:31:43','2014-12-21 12:50:33',1,NULL,NULL,16,NULL,0,1,NULL,1,0,0,1,-1,'',NULL,NULL,'Company ppp added into Dolibarr\nAuthor: admin',16,'societe',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(27,NULL,1,'2011-08-01 02:41:26','2011-08-01 02:41:26',50,NULL,'Company aaa added into Dolibarr','2011-08-01 02:41:26','2014-12-21 12:50:33',1,NULL,NULL,17,NULL,0,1,NULL,1,0,0,1,-1,'',NULL,NULL,'Company aaa added into Dolibarr\nAuthor: admin',17,'societe',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(28,NULL,1,'2011-08-01 03:34:11','2011-08-01 03:34:11',50,NULL,'Invoice FA1108-0003 validated in Dolibarr','2011-08-01 03:34:11','2014-12-21 12:50:33',1,NULL,NULL,7,NULL,0,1,NULL,1,0,0,1,-1,'',NULL,NULL,'Invoice FA1108-0003 validated in Dolibarr\nAuthor: admin',5,'invoice',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(29,NULL,1,'2011-08-01 03:34:11','2011-08-01 03:34:11',50,NULL,'Invoice FA1108-0003 validated in Dolibarr','2011-08-01 03:34:11','2014-12-21 12:50:33',1,NULL,NULL,7,NULL,0,1,NULL,1,0,0,1,-1,'',NULL,NULL,'Invoice FA1108-0003 changed to paid in Dolibarr\nAuthor: admin',5,'invoice',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(30,NULL,1,'2011-08-06 20:33:54','2011-08-06 20:33:54',50,NULL,'Invoice FA1108-0004 validated in Dolibarr','2011-08-06 20:33:54','2014-12-21 12:50:33',1,NULL,NULL,7,NULL,0,1,NULL,1,0,0,1,-1,'',NULL,NULL,'Invoice FA1108-0004 validated in Dolibarr\nAuthor: admin',6,'invoice',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(31,NULL,1,'2011-08-06 20:33:54','2011-08-06 20:33:54',50,NULL,'Invoice FA1108-0004 validated in Dolibarr','2011-08-06 20:33:54','2014-12-21 12:50:33',1,NULL,NULL,7,NULL,0,1,NULL,1,0,0,1,-1,'',NULL,NULL,'Invoice FA1108-0004 changed to paid in Dolibarr\nAuthor: admin',6,'invoice',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(38,NULL,1,'2011-08-08 02:41:55','2011-08-08 02:41:55',50,NULL,'Invoice FA1108-0005 validated in Dolibarr','2011-08-08 02:41:55','2014-12-21 12:50:33',1,NULL,NULL,2,NULL,0,1,NULL,1,0,0,1,-1,'',NULL,NULL,'Invoice FA1108-0005 validated in Dolibarr\nAuthor: admin',8,'invoice',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(40,NULL,1,'2011-08-08 02:53:40','2011-08-08 02:53:40',50,NULL,'Invoice FA1108-0005 changed to paid in Dolibarr','2011-08-08 02:53:40','2014-12-21 12:50:33',1,NULL,NULL,2,NULL,0,1,NULL,1,0,0,1,-1,'',NULL,NULL,'Invoice FA1108-0005 changed to paid in Dolibarr\nAuthor: admin',8,'invoice',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(41,NULL,1,'2011-08-08 02:54:05','2011-08-08 02:54:05',50,NULL,'Invoice FA1007-0002 changed to paid in Dolibarr','2011-08-08 02:54:05','2014-12-21 12:50:33',1,NULL,NULL,2,NULL,0,1,NULL,1,0,0,1,-1,'',NULL,NULL,'Invoice FA1007-0002 changed to paid in Dolibarr\nAuthor: admin',2,'invoice',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(42,NULL,1,'2011-08-08 02:55:04','2011-08-08 02:55:04',50,NULL,'Invoice FA1107-0006 validated in Dolibarr','2011-08-08 02:55:04','2014-12-21 12:50:33',1,NULL,NULL,10,NULL,0,1,NULL,1,0,0,1,-1,'',NULL,NULL,'Invoice FA1107-0006 validated in Dolibarr\nAuthor: admin',3,'invoice',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(43,NULL,1,'2011-08-08 02:55:26','2011-08-08 02:55:26',50,NULL,'Invoice FA1108-0007 validated in Dolibarr','2011-08-08 02:55:26','2014-12-21 12:50:33',1,NULL,NULL,10,NULL,0,1,NULL,1,0,0,1,-1,'',NULL,NULL,'Invoice FA1108-0007 validated in Dolibarr\nAuthor: admin',9,'invoice',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(44,NULL,1,'2011-08-08 02:55:58','2011-08-08 02:55:58',50,NULL,'Invoice FA1107-0006 changed to paid in Dolibarr','2011-08-08 02:55:58','2014-12-21 12:50:33',1,NULL,NULL,10,NULL,0,1,NULL,1,0,0,1,-1,'',NULL,NULL,'Invoice FA1107-0006 changed to paid in Dolibarr\nAuthor: admin',3,'invoice',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(45,NULL,1,'2011-08-08 03:04:22','2011-08-08 03:04:22',50,NULL,'Order CO1108-0001 validated','2011-08-08 03:04:22','2014-12-21 12:50:33',1,NULL,NULL,1,NULL,0,1,NULL,1,0,0,1,-1,'',NULL,NULL,'Order CO1108-0001 validated\nAuthor: admin',5,'order',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(46,NULL,1,'2011-08-08 13:59:09','2011-08-08 13:59:09',50,NULL,'Order CO1107-0002 validated','2011-08-08 13:59:10','2014-12-21 12:50:33',1,NULL,NULL,1,NULL,0,1,NULL,1,0,0,1,-1,'',NULL,NULL,'Order CO1107-0002 validated\nAuthor: admin',1,'order',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(47,NULL,1,'2011-08-08 14:24:18','2011-08-08 14:24:18',50,NULL,'Proposal PR1007-0001 validated','2011-08-08 14:24:18','2014-12-21 12:50:33',1,NULL,NULL,2,NULL,0,1,NULL,1,0,0,1,-1,'',NULL,NULL,'Proposal PR1007-0001 validated\nAuthor: admin',1,'propal',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(48,NULL,1,'2011-08-08 14:24:24','2011-08-08 14:24:24',50,NULL,'Proposal PR1108-0004 validated','2011-08-08 14:24:24','2014-12-21 12:50:33',1,NULL,NULL,17,NULL,0,1,NULL,1,0,0,1,-1,'',NULL,NULL,'Proposal PR1108-0004 validated\nAuthor: admin',4,'propal',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(49,NULL,1,'2011-08-08 15:04:37','2011-08-08 15:04:37',50,NULL,'Order CF1108-0003 validated','2011-08-08 15:04:37','2014-12-21 12:50:33',1,NULL,NULL,17,NULL,0,1,NULL,1,0,0,1,-1,'',NULL,NULL,'Order CF1108-0003 validated\nAuthor: admin',6,'order_supplier',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(50,NULL,1,'2012-12-08 17:56:47','2012-12-08 17:56:47',40,NULL,'Facture AV1212-0001 validée dans Dolibarr','2012-12-08 17:56:47','2014-12-21 12:50:33',1,NULL,NULL,10,NULL,0,1,NULL,1,0,0,1,-1,'',NULL,NULL,'Facture AV1212-0001 validée dans Dolibarr\nAuteur: admin',10,'invoice',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(51,NULL,1,'2012-12-08 17:57:11','2012-12-08 17:57:11',40,NULL,'Facture AV1212-0001 validée dans Dolibarr','2012-12-08 17:57:11','2014-12-21 12:50:33',1,NULL,NULL,10,NULL,0,1,NULL,1,0,0,1,-1,'',NULL,NULL,'Facture AV1212-0001 validée dans Dolibarr\nAuteur: admin',10,'invoice',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(52,NULL,1,'2012-12-08 17:58:27','2012-12-08 17:58:27',40,NULL,'Facture FA1212-0008 validée dans Dolibarr','2012-12-08 17:58:27','2014-12-21 12:50:33',1,NULL,NULL,10,NULL,0,1,NULL,1,0,0,1,-1,'',NULL,NULL,'Facture FA1212-0008 validée dans Dolibarr\nAuteur: admin',11,'invoice',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(53,NULL,1,'2012-12-08 18:20:49','2012-12-08 18:20:49',40,NULL,'Facture AV1212-0002 validée dans Dolibarr','2012-12-08 18:20:49','2014-12-21 12:50:33',1,NULL,NULL,10,NULL,0,1,NULL,1,0,0,1,-1,'',NULL,NULL,'Facture AV1212-0002 validée dans Dolibarr\nAuteur: admin',12,'invoice',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(54,NULL,1,'2012-12-09 18:35:07','2012-12-09 18:35:07',40,NULL,'Facture AV1212-0002 passée à payée dans Dolibarr','2012-12-09 18:35:07','2014-12-21 12:50:33',1,NULL,NULL,10,NULL,0,1,NULL,1,0,0,1,-1,'',NULL,NULL,'Facture AV1212-0002 passée à payée dans Dolibarr\nAuteur: admin',12,'invoice',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(55,NULL,1,'2012-12-09 20:14:42','2012-12-09 20:14:42',40,NULL,'Société doe john ajoutée dans Dolibarr','2012-12-09 20:14:42','2014-12-21 12:50:33',1,NULL,NULL,18,NULL,0,1,NULL,1,0,0,1,-1,'',NULL,NULL,'Société doe john ajoutée dans Dolibarr\nAuteur: admin',18,'societe',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(56,NULL,1,'2012-12-12 18:54:19','2012-12-12 18:54:19',40,NULL,'Facture FA1212-0009 validée dans Dolibarr','2012-12-12 18:54:19','2014-12-21 12:50:33',1,NULL,NULL,1,NULL,0,1,NULL,1,0,0,1,-1,'',NULL,NULL,'Facture FA1212-0009 validée dans Dolibarr\nAuteur: admin',55,'invoice',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(121,NULL,1,'2012-12-06 10:00:00',NULL,50,NULL,'aaab','2012-12-21 17:48:08','2012-12-21 16:54:07',3,1,NULL,NULL,NULL,0,3,NULL,NULL,1,0,1,-1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(122,NULL,1,'2012-12-21 18:09:52','2012-12-21 18:09:52',40,NULL,'Facture client FA1007-0001 envoyée par EMail','2012-12-21 18:09:52','2014-12-21 12:50:33',1,NULL,NULL,9,NULL,0,1,NULL,1,0,0,1,-1,'',NULL,NULL,'Mail envoyé par Firstname SuperAdminName à laurent@destailleur.fr.\nSujet du mail: Envoi facture FA1007-0001\nCorps du mail:\nVeuillez trouver ci-joint la facture FA1007-0001\r\n\r\nVous pouvez cliquer sur le lien sécurisé ci-dessous pour effectuer votre paiement via Paypal\r\n\r\nhttp://localhost/dolibarrnew/public/paypal/newpayment.php?source=invoice&ref=FA1007-0001&securekey=50c82fab36bb3b6aa83e2a50691803b2\r\n\r\nCordialement',1,'invoice',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(123,NULL,1,'2013-01-06 13:13:57','2013-01-06 13:13:57',40,NULL,'Facture 16 validée dans Dolibarr','2013-01-06 13:13:57','2014-12-21 12:50:33',1,NULL,NULL,1,NULL,0,1,NULL,1,0,0,1,-1,'',NULL,NULL,'Facture 16 validée dans Dolibarr\nAuteur: admin',16,'invoice_supplier',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(124,NULL,1,'2013-01-12 12:23:05','2013-01-12 12:23:05',40,NULL,'Patient aaa ajouté','2013-01-12 12:23:05','2014-12-21 12:50:33',1,NULL,NULL,19,NULL,0,1,NULL,1,0,0,1,-1,'',NULL,NULL,'Patient aaa ajouté\nAuteur: admin',19,'societe',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(125,NULL,1,'2013-01-12 12:52:20','2013-01-12 12:52:20',40,NULL,'Patient pppoo ajouté','2013-01-12 12:52:20','2014-12-21 12:50:33',1,NULL,NULL,20,NULL,0,1,NULL,1,0,0,1,-1,'',NULL,NULL,'Patient pppoo ajouté\nAuteur: admin',20,'societe',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(127,NULL,1,'2013-01-19 18:22:48','2013-01-19 18:22:48',40,NULL,'Facture FS1301-0001 validée dans Dolibarr','2013-01-19 18:22:48','2014-12-21 12:50:33',1,NULL,NULL,1,NULL,0,1,NULL,1,0,0,1,-1,'',NULL,NULL,'Facture FS1301-0001 validée dans Dolibarr\nAuteur: admin',148,'invoice',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(128,NULL,1,'2013-01-19 18:31:10','2013-01-19 18:31:10',40,NULL,'Facture FA6801-0010 validée dans Dolibarr','2013-01-19 18:31:10','2014-12-21 12:50:33',1,NULL,NULL,1,NULL,0,1,NULL,1,0,0,1,-1,'',NULL,NULL,'Facture FA6801-0010 validée dans Dolibarr\nAuteur: admin',150,'invoice',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(129,NULL,1,'2013-01-19 18:31:10','2013-01-19 18:31:10',40,NULL,'Facture FA6801-0010 passée à payée dans Dolibarr','2013-01-19 18:31:10','2014-12-21 12:50:33',1,NULL,NULL,1,NULL,0,1,NULL,1,0,0,1,-1,'',NULL,NULL,'Facture FA6801-0010 passée à payée dans Dolibarr\nAuteur: admin',150,'invoice',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(130,NULL,1,'2013-01-19 18:31:58','2013-01-19 18:31:58',40,NULL,'Facture FS1301-0002 validée dans Dolibarr','2013-01-19 18:31:58','2014-12-21 12:50:33',1,NULL,NULL,1,NULL,0,1,NULL,1,0,0,1,-1,'',NULL,NULL,'Facture FS1301-0002 validée dans Dolibarr\nAuteur: admin',151,'invoice',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(131,NULL,1,'2013-01-19 18:31:58','2013-01-19 18:31:58',40,NULL,'Facture FS1301-0002 passée à payée dans Dolibarr','2013-01-19 18:31:58','2014-12-21 12:50:33',1,NULL,NULL,1,NULL,0,1,NULL,1,0,0,1,-1,'',NULL,NULL,'Facture FS1301-0002 passée à payée dans Dolibarr\nAuteur: admin',151,'invoice',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(132,NULL,1,'2013-01-23 15:07:54','2013-01-23 15:07:54',50,NULL,'Consultation 24 saisie (aaa)','2013-01-23 15:07:54','2014-12-21 12:50:33',1,NULL,NULL,19,NULL,0,1,NULL,1,0,0,1,-1,'',NULL,NULL,'Consultation 24 saisie (aaa)\nAuteur: admin',24,'cabinetmed_cons',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(133,NULL,1,'2013-01-23 16:56:58','2013-01-23 16:56:58',40,NULL,'Patient pa ajouté','2013-01-23 16:56:58','2014-12-21 12:50:33',1,NULL,NULL,21,NULL,0,1,NULL,1,0,0,1,-1,'',NULL,NULL,'Patient pa ajouté\nAuteur: admin',21,'societe',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(134,NULL,1,'2013-01-23 17:34:00',NULL,50,NULL,'bbcv','2013-01-23 17:35:21','2013-01-23 16:35:21',1,NULL,1,2,NULL,0,1,NULL,NULL,0,0,1,-1,'',NULL,NULL,'',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(135,NULL,1,'2013-02-12 15:54:00','2013-02-12 15:54:00',40,NULL,'Facture FA1212-0011 validée dans Dolibarr','2013-02-12 15:54:37','2014-12-21 12:50:33',1,1,NULL,7,NULL,0,1,NULL,1,0,0,1,50,NULL,NULL,NULL,'Facture FA1212-0011 validée dans Dolibarr
\r\nAuteur: admin',13,'invoice',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(136,NULL,1,'2013-02-12 17:06:51','2013-02-12 17:06:51',40,NULL,'Commande CO1107-0003 validée','2013-02-12 17:06:51','2014-12-21 12:50:33',1,NULL,NULL,1,NULL,0,1,NULL,1,0,0,1,-1,'',NULL,NULL,'Commande CO1107-0003 validée\nAuteur: admin',2,'order',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(137,NULL,1,'2013-02-17 16:22:10','2013-02-17 16:22:10',40,NULL,'Proposition PR1302-0009 validée','2013-02-17 16:22:10','2014-12-21 12:50:33',1,NULL,NULL,19,NULL,0,1,NULL,1,0,0,1,-1,'',NULL,NULL,'Proposition PR1302-0009 validée\nAuteur: admin',9,'propal',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(138,NULL,1,'2013-02-17 16:27:00','2013-02-17 16:27:00',40,NULL,'Facture FA1302-0012 validée dans Dolibarr','2013-02-17 16:27:00','2014-12-21 12:50:33',1,NULL,NULL,18,NULL,0,1,NULL,1,0,0,1,-1,'',NULL,NULL,'Facture FA1302-0012 validée dans Dolibarr\nAuteur: admin',152,'invoice',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(139,NULL,1,'2013-02-17 16:27:29','2013-02-17 16:27:29',40,NULL,'Proposition PR1302-0010 validée','2013-02-17 16:27:29','2014-12-21 12:50:33',1,NULL,NULL,18,NULL,0,1,NULL,1,0,0,1,-1,'',NULL,NULL,'Proposition PR1302-0010 validée\nAuteur: admin',11,'propal',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(140,NULL,1,'2013-02-17 18:27:56','2013-02-17 18:27:56',40,NULL,'Commande CO1107-0004 validée','2013-02-17 18:27:56','2014-12-21 12:50:33',1,NULL,NULL,1,NULL,0,1,NULL,1,0,0,1,-1,'',NULL,NULL,'Commande CO1107-0004 validée\nAuteur: admin',3,'order',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(141,NULL,1,'2013-02-17 18:38:14','2013-02-17 18:38:14',40,NULL,'Commande CO1302-0005 validée','2013-02-17 18:38:14','2014-12-21 12:50:33',1,NULL,NULL,18,NULL,0,1,NULL,1,0,0,1,-1,'',NULL,NULL,'Commande CO1302-0005 validée\nAuteur: admin',7,'order',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(142,NULL,1,'2013-02-26 22:57:50','2013-02-26 22:57:50',40,NULL,'Company pppp added into Dolibarr','2013-02-26 22:57:50','2014-12-21 12:50:33',1,NULL,NULL,22,NULL,0,1,NULL,1,0,0,1,-1,'',NULL,NULL,'Company pppp added into Dolibarr\nAuthor: admin',22,'societe',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(143,NULL,1,'2013-02-26 22:58:13','2013-02-26 22:58:13',40,NULL,'Company ttttt added into Dolibarr','2013-02-26 22:58:13','2014-12-21 12:50:33',1,NULL,NULL,23,NULL,0,1,NULL,1,0,0,1,-1,'',NULL,NULL,'Company ttttt added into Dolibarr\nAuthor: admin',23,'societe',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(144,NULL,1,'2013-02-27 10:00:00','2013-02-27 19:20:00',5,NULL,'Rendez-vous','2013-02-27 19:20:53','2013-02-27 18:20:53',1,NULL,NULL,NULL,NULL,0,1,NULL,1,0,0,1,-1,'',33600,NULL,'',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(145,NULL,1,'2013-02-27 19:28:00',NULL,2,NULL,'fdsfsd','2013-02-27 19:28:48','2013-02-27 18:29:53',1,1,NULL,NULL,NULL,0,1,NULL,1,0,0,1,-1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(146,NULL,1,'2013-03-06 10:05:07','2013-03-06 10:05:07',40,NULL,'Contrat (PROV3) validé dans Dolibarr','2013-03-06 10:05:07','2014-12-21 12:50:33',1,NULL,NULL,19,NULL,0,1,NULL,1,0,0,1,-1,'',NULL,NULL,'Contrat (PROV3) validé dans Dolibarr\nAuteur: admin',3,'contract',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(147,NULL,1,'2013-03-06 16:43:37','2013-03-06 16:43:37',40,NULL,'Facture FA1307-0013 validée dans Dolibarr','2013-03-06 16:43:37','2014-12-21 12:50:33',1,NULL,NULL,12,NULL,0,1,NULL,1,0,0,1,-1,'',NULL,NULL,'Facture FA1307-0013 validée dans Dolibarr\nAuteur: admin',158,'invoice',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(148,NULL,1,'2013-03-06 16:44:12','2013-03-06 16:44:12',40,NULL,'Facture FA1407-0014 validée dans Dolibarr','2013-03-06 16:44:12','2014-12-21 12:50:33',1,NULL,NULL,12,NULL,0,1,NULL,1,0,0,1,-1,'',NULL,NULL,'Facture FA1407-0014 validée dans Dolibarr\nAuteur: admin',159,'invoice',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(149,NULL,1,'2013-03-06 16:47:48','2013-03-06 16:47:48',40,NULL,'Facture FA1507-0015 validée dans Dolibarr','2013-03-06 16:47:48','2014-12-21 12:50:33',1,NULL,NULL,12,NULL,0,1,NULL,1,0,0,1,-1,'',NULL,NULL,'Facture FA1507-0015 validée dans Dolibarr\nAuteur: admin',160,'invoice',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(150,NULL,1,'2013-03-06 16:48:16','2013-03-06 16:48:16',40,NULL,'Facture FA1607-0016 validée dans Dolibarr','2013-03-06 16:48:16','2014-12-21 12:50:33',1,NULL,NULL,12,NULL,0,1,NULL,1,0,0,1,-1,'',NULL,NULL,'Facture FA1607-0016 validée dans Dolibarr\nAuteur: admin',161,'invoice',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(151,NULL,1,'2013-03-06 17:13:59','2013-03-06 17:13:59',40,NULL,'Société smith smith ajoutée dans Dolibarr','2013-03-06 17:13:59','2014-12-21 12:50:33',1,NULL,NULL,24,NULL,0,1,NULL,1,0,0,1,-1,'',NULL,NULL,'Société smith smith ajoutée dans Dolibarr\nAuteur: admin',24,'societe',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(152,NULL,1,'2013-03-08 10:02:22','2013-03-08 10:02:22',40,NULL,'Proposition (PROV12) validée dans Dolibarr','2013-03-08 10:02:22','2014-12-21 12:50:33',1,NULL,NULL,23,NULL,0,1,NULL,1,0,0,1,-1,'',NULL,NULL,'Proposition (PROV12) validée dans Dolibarr\nAuteur: admin',12,'propal',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(203,NULL,1,'2013-03-09 19:39:27','2013-03-09 19:39:27',40,'AC_ORDER_SUPPLIER_VALIDATE','Commande CF1303-0004 validée','2013-03-09 19:39:27','2014-12-21 12:50:33',1,NULL,NULL,1,NULL,0,1,NULL,1,0,0,1,-1,'',NULL,NULL,'Commande CF1303-0004 validée\nAuteur: admin',13,'order_supplier',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(204,NULL,1,'2013-03-10 15:47:37','2013-03-10 15:47:37',40,'AC_COMPANY_CREATE','Patient créé','2013-03-10 15:47:37','2014-12-21 12:50:33',1,NULL,NULL,25,NULL,0,1,NULL,1,0,0,1,-1,'',NULL,NULL,'Patient créé\nAuteur: admin',25,'societe',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(205,NULL,1,'2013-03-10 15:57:32','2013-03-10 15:57:32',40,'AC_COMPANY_CREATE','Tiers créé','2013-03-10 15:57:32','2014-12-21 12:50:33',1,NULL,NULL,26,NULL,0,1,NULL,1,0,0,1,-1,'',NULL,NULL,'Tiers créé\nAuteur: admin',26,'societe',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(206,NULL,1,'2013-03-10 15:58:28','2013-03-10 15:58:28',40,'AC_BILL_VALIDATE','Facture FA1303-0017 validée','2013-03-10 15:58:28','2014-12-21 12:50:33',1,NULL,NULL,26,NULL,0,1,NULL,1,0,0,1,-1,'',NULL,NULL,'Facture FA1303-0017 validée\nAuteur: admin',208,'invoice',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(207,NULL,1,'2013-03-19 09:38:10','2013-03-19 09:38:10',40,'AC_BILL_VALIDATE','Facture FA1303-0018 validée','2013-03-19 09:38:10','2014-12-21 12:50:33',1,NULL,NULL,19,NULL,0,1,NULL,1,0,0,1,-1,'',NULL,NULL,'Facture FA1303-0018 validée\nAuteur: admin',209,'invoice',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(208,NULL,1,'2013-03-20 14:30:11','2013-03-20 14:30:11',40,'AC_BILL_VALIDATE','Facture FA1107-0019 validée','2013-03-20 14:30:11','2014-12-21 12:50:33',1,NULL,NULL,10,NULL,0,1,NULL,1,0,0,1,-1,'',NULL,NULL,'Facture FA1107-0019 validée\nAuteur: admin',210,'invoice',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(209,NULL,1,'2013-03-22 09:40:25','2013-03-22 09:40:25',40,'AC_BILL_VALIDATE','Facture FA1303-0020 validée','2013-03-22 09:40:25','2014-12-21 12:50:33',1,NULL,NULL,19,NULL,0,1,NULL,1,0,0,1,-1,'',NULL,NULL,'Facture FA1303-0020 validée\nAuteur: admin',211,'invoice',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(210,NULL,1,'2013-03-23 17:16:25','2013-03-23 17:16:25',40,'AC_BILL_VALIDATE','Facture FA1303-0020 validée','2013-03-23 17:16:25','2014-12-21 12:50:33',1,NULL,NULL,19,NULL,0,1,NULL,1,0,0,1,-1,'',NULL,NULL,'Facture FA1303-0020 validée\nAuteur: admin',211,'invoice',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(211,NULL,1,'2013-03-23 18:08:27','2013-03-23 18:08:27',40,'AC_BILL_VALIDATE','Facture FA1307-0013 validée','2013-03-23 18:08:27','2014-12-21 12:50:33',1,NULL,NULL,12,NULL,0,1,NULL,1,0,0,1,-1,'',NULL,NULL,'Facture FA1307-0013 validée\nAuteur: admin',158,'invoice',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(212,NULL,1,'2013-03-24 15:54:00','2013-03-24 15:54:00',40,'AC_BILL_VALIDATE','Facture FA1212-0021 validée','2013-03-24 15:54:00','2014-12-21 12:50:33',1,NULL,NULL,1,NULL,0,1,NULL,1,0,0,1,-1,'',NULL,NULL,'Facture FA1212-0021 validée\nAuteur: admin',32,'invoice',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(213,NULL,1,'2013-11-07 01:02:39','2013-11-07 01:02:39',40,'AC_COMPANY_CREATE','Third party created','2013-11-07 01:02:39','2014-12-21 12:50:33',1,NULL,NULL,27,NULL,0,1,0,1,0,0,1,-1,'',NULL,NULL,'Third party created\nAuthor: admin',27,'societe',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(214,NULL,1,'2013-11-07 01:05:22','2013-11-07 01:05:22',40,'AC_COMPANY_CREATE','Third party created','2013-11-07 01:05:22','2014-12-21 12:50:33',1,NULL,NULL,28,NULL,0,1,0,1,0,0,1,-1,'',NULL,NULL,'Third party created\nAuthor: admin',28,'societe',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(215,NULL,1,'2013-11-07 01:07:07','2013-11-07 01:07:07',40,'AC_COMPANY_CREATE','Third party created','2013-11-07 01:07:07','2014-12-21 12:50:33',1,NULL,NULL,29,NULL,0,1,0,1,0,0,1,-1,'',NULL,NULL,'Third party created\nAuthor: admin',29,'societe',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(216,NULL,1,'2013-11-07 01:07:58','2013-11-07 01:07:58',40,'AC_COMPANY_CREATE','Third party created','2013-11-07 01:07:58','2014-12-21 12:50:33',1,NULL,NULL,30,NULL,0,1,0,1,0,0,1,-1,'',NULL,NULL,'Third party created\nAuthor: admin',30,'societe',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(217,NULL,1,'2013-11-07 01:10:09','2013-11-07 01:10:09',40,'AC_COMPANY_CREATE','Third party created','2013-11-07 01:10:09','2014-12-21 12:50:33',1,NULL,NULL,31,NULL,0,1,0,1,0,0,1,-1,'',NULL,NULL,'Third party created\nAuthor: admin',31,'societe',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(218,NULL,1,'2013-11-07 01:15:57','2013-11-07 01:15:57',40,'AC_COMPANY_CREATE','Third party created','2013-11-07 01:15:57','2014-12-21 12:50:33',1,NULL,NULL,32,NULL,0,1,0,1,0,0,1,-1,'',NULL,NULL,'Third party created\nAuthor: admin',32,'societe',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(219,NULL,1,'2013-11-07 01:16:51','2013-11-07 01:16:51',40,'AC_COMPANY_CREATE','Third party created','2013-11-07 01:16:51','2014-12-21 12:50:33',1,NULL,NULL,33,NULL,0,1,0,1,0,0,1,-1,'',NULL,NULL,'Third party created\nAuthor: admin',33,'societe',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(220,NULL,1,'2014-03-02 17:24:04','2014-03-02 17:24:04',40,'AC_BILL_VALIDATE','Invoice FA1302-0022 validated','2014-03-02 17:24:04','2014-12-21 12:50:33',1,NULL,NULL,18,NULL,0,1,0,1,0,0,1,-1,'',NULL,NULL,'Invoice FA1302-0022 validated\nAuthor: admin',157,'invoice',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(221,NULL,1,'2014-03-02 17:24:28','2014-03-02 17:24:28',40,'AC_BILL_VALIDATE','Invoice FA1303-0020 validated','2014-03-02 17:24:28','2014-12-21 12:50:33',1,NULL,NULL,19,NULL,0,1,0,1,0,0,1,-1,'',NULL,NULL,'Invoice FA1303-0020 validated\nAuthor: admin',211,'invoice',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(222,NULL,1,'2014-03-05 10:00:00','2014-03-05 10:00:00',5,NULL,'RDV John','2014-03-02 19:54:48','2014-03-02 18:55:29',1,1,NULL,NULL,NULL,0,1,0,NULL,0,0,1,-1,NULL,NULL,NULL,'gfdgdfgdf',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(223,NULL,1,'2014-03-13 10:00:00','2014-03-17 00:00:00',50,NULL,'Congress','2014-03-02 19:55:11','2014-03-02 18:55:11',1,NULL,NULL,NULL,NULL,0,1,0,NULL,0,0,1,-1,'',309600,NULL,'',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(224,NULL,1,'2014-03-14 10:00:00',NULL,1,NULL,'Call john','2014-03-02 19:55:56','2014-03-02 18:55:56',1,NULL,NULL,NULL,NULL,0,1,0,NULL,0,0,1,0,'',NULL,NULL,'tttt',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(225,NULL,1,'2014-03-02 20:11:31','2014-03-02 20:11:31',40,'AC_BILL_UNVALIDATE','Invoice FA1303-0020 go back to draft status','2014-03-02 20:11:31','2014-12-21 12:50:33',1,NULL,NULL,19,NULL,0,1,0,1,0,0,1,-1,'',NULL,NULL,'Invoice FA1303-0020 go back to draft status\nAuthor: admin',211,'invoice',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(226,NULL,1,'2014-03-02 20:13:39','2014-03-02 20:13:39',40,'AC_BILL_VALIDATE','Invoice FA1303-0020 validated','2014-03-02 20:13:39','2014-12-21 12:50:33',1,NULL,NULL,19,NULL,0,1,0,1,0,0,1,-1,'',NULL,NULL,'Invoice FA1303-0020 validated\nAuthor: admin',211,'invoice',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(227,NULL,1,'2014-03-03 19:20:10','2014-03-03 19:20:10',40,'AC_BILL_VALIDATE','Invoice FA1212-0023 validated','2014-03-03 19:20:10','2014-12-21 12:50:33',1,NULL,NULL,1,NULL,0,1,0,1,0,0,1,-1,'',NULL,NULL,'Invoice FA1212-0023 validated\nAuthor: admin',33,'invoice',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(228,NULL,1,'2014-03-03 19:20:25','2014-03-03 19:20:25',40,'AC_BILL_CANCEL','Invoice FA1212-0023 canceled in Dolibarr','2014-03-03 19:20:25','2014-12-21 12:50:33',1,NULL,NULL,1,NULL,0,1,0,1,0,0,1,-1,'',NULL,NULL,'Invoice FA1212-0023 canceled in Dolibarr\nAuthor: admin',33,'invoice',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(229,NULL,1,'2014-03-03 19:20:56','2014-03-03 19:20:56',40,'AC_BILL_VALIDATE','Invoice AV1403-0003 validated','2014-03-03 19:20:56','2014-12-21 12:50:33',1,NULL,NULL,1,NULL,0,1,0,1,0,0,1,-1,'',NULL,NULL,'Invoice AV1403-0003 validated\nAuthor: admin',212,'invoice',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(230,NULL,1,'2014-03-03 19:21:29','2014-03-03 19:21:29',40,'AC_BILL_UNVALIDATE','Invoice AV1403-0003 go back to draft status','2014-03-03 19:21:29','2014-12-21 12:50:33',1,NULL,NULL,1,NULL,0,1,0,1,0,0,1,-1,'',NULL,NULL,'Invoice AV1403-0003 go back to draft status\nAuthor: admin',212,'invoice',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(231,NULL,1,'2014-03-03 19:22:16','2014-03-03 19:22:16',40,'AC_BILL_VALIDATE','Invoice AV1303-0003 validated','2014-03-03 19:22:16','2014-12-21 12:50:33',1,NULL,NULL,1,NULL,0,1,0,1,0,0,1,-1,'',NULL,NULL,'Invoice AV1303-0003 validated\nAuthor: admin',213,'invoice',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(232,NULL,1,'2016-01-22 18:54:39','2016-01-22 18:54:39',40,'AC_OTH_AUTO','Invoice 16 validated','2016-01-22 18:54:39','2016-01-22 17:54:39',12,NULL,NULL,1,NULL,0,12,0,NULL,0,0,1,-1,'',NULL,NULL,'Invoice 16 validated\nAuthor: admin',16,'invoice_supplier',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(233,NULL,1,'2016-01-22 18:54:46','2016-01-22 18:54:46',40,'AC_OTH_AUTO','Invoice 16 validated','2016-01-22 18:54:46','2016-01-22 17:54:46',12,NULL,NULL,1,NULL,0,12,0,NULL,0,0,1,-1,'',NULL,NULL,'Invoice 16 validated\nAuthor: admin',16,'invoice_supplier',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(234,NULL,1,'2016-07-05 10:00:00','2016-07-05 11:19:00',5,'AC_RDV','Meeting with my boss','2016-07-31 18:19:48','2016-07-31 14:19:48',12,NULL,NULL,NULL,NULL,0,12,1,NULL,0,0,1,-1,'',4740,NULL,'',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(235,NULL,1,'2016-07-13 00:00:00','2016-07-14 23:59:59',50,'AC_OTH','Trip at Las Vegas','2016-07-31 18:20:36','2016-07-31 14:20:36',12,NULL,4,NULL,2,0,12,1,NULL,0,1,1,-1,'',172799,NULL,'',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(236,NULL,1,'2016-07-29 10:00:00',NULL,4,'AC_EMAIL','Remind to send an email','2016-07-31 18:21:04','2016-07-31 14:21:04',12,NULL,NULL,NULL,NULL,0,4,0,NULL,0,0,1,-1,'',NULL,NULL,'',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(237,NULL,1,'2016-07-01 10:00:00',NULL,1,'AC_TEL','Phone call with Mr Vaalen','2016-07-31 18:22:04','2016-07-31 14:22:04',12,NULL,6,4,NULL,0,13,0,NULL,0,0,1,-1,'',NULL,NULL,'',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(238,NULL,1,'2016-08-02 10:00:00','2016-08-02 12:00:00',5,'AC_RDV','Meeting on radium','2016-08-01 01:15:50','2016-07-31 21:15:50',12,NULL,8,10,10,0,12,1,NULL,0,0,1,-1,'',7200,NULL,'',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); +/*!40000 ALTER TABLE `llx_actioncomm` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_actioncomm_extrafields` +-- + +DROP TABLE IF EXISTS `llx_actioncomm_extrafields`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_actioncomm_extrafields` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `fk_object` int(11) NOT NULL, + `import_key` varchar(14) DEFAULT NULL, + PRIMARY KEY (`rowid`), + KEY `idx_actioncomm_extrafields` (`fk_object`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_actioncomm_extrafields` +-- + +LOCK TABLES `llx_actioncomm_extrafields` WRITE; +/*!40000 ALTER TABLE `llx_actioncomm_extrafields` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_actioncomm_extrafields` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_actioncomm_resources` +-- + +DROP TABLE IF EXISTS `llx_actioncomm_resources`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_actioncomm_resources` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `fk_actioncomm` int(11) NOT NULL, + `element_type` varchar(50) NOT NULL, + `fk_element` int(11) NOT NULL, + `answer_status` varchar(50) DEFAULT NULL, + `mandatory` smallint(6) DEFAULT NULL, + `transparency` smallint(6) DEFAULT '1', + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_actioncomm_resources` (`fk_actioncomm`,`element_type`,`fk_element`), + KEY `idx_actioncomm_resources_fk_element` (`fk_element`) +) ENGINE=InnoDB AUTO_INCREMENT=121 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_actioncomm_resources` +-- + +LOCK TABLES `llx_actioncomm_resources` WRITE; +/*!40000 ALTER TABLE `llx_actioncomm_resources` DISABLE KEYS */; +INSERT INTO `llx_actioncomm_resources` VALUES (1,1,'user',1,NULL,NULL,1),(2,2,'user',1,NULL,NULL,1),(3,3,'user',1,NULL,NULL,1),(4,4,'user',1,NULL,NULL,1),(5,5,'user',1,NULL,NULL,1),(6,6,'user',1,NULL,NULL,1),(7,7,'user',1,NULL,NULL,1),(8,8,'user',1,NULL,NULL,1),(9,9,'user',1,NULL,NULL,1),(10,10,'user',1,NULL,NULL,1),(11,11,'user',1,NULL,NULL,1),(12,12,'user',1,NULL,NULL,1),(13,13,'user',1,NULL,NULL,1),(14,14,'user',1,NULL,NULL,1),(15,15,'user',1,NULL,NULL,1),(16,16,'user',1,NULL,NULL,1),(17,17,'user',1,NULL,NULL,1),(18,18,'user',1,NULL,NULL,1),(19,19,'user',1,NULL,NULL,1),(20,20,'user',1,NULL,NULL,1),(21,21,'user',1,NULL,NULL,1),(22,22,'user',1,NULL,NULL,1),(23,23,'user',1,NULL,NULL,1),(24,24,'user',1,NULL,NULL,1),(25,25,'user',1,NULL,NULL,1),(26,26,'user',1,NULL,NULL,1),(27,27,'user',1,NULL,NULL,1),(28,28,'user',1,NULL,NULL,1),(29,29,'user',1,NULL,NULL,1),(30,30,'user',1,NULL,NULL,1),(31,31,'user',1,NULL,NULL,1),(32,38,'user',1,NULL,NULL,1),(33,40,'user',1,NULL,NULL,1),(34,41,'user',1,NULL,NULL,1),(35,42,'user',1,NULL,NULL,1),(36,43,'user',1,NULL,NULL,1),(37,44,'user',1,NULL,NULL,1),(38,45,'user',1,NULL,NULL,1),(39,46,'user',1,NULL,NULL,1),(40,47,'user',1,NULL,NULL,1),(41,48,'user',1,NULL,NULL,1),(42,49,'user',1,NULL,NULL,1),(43,50,'user',1,NULL,NULL,1),(44,51,'user',1,NULL,NULL,1),(45,52,'user',1,NULL,NULL,1),(46,53,'user',1,NULL,NULL,1),(47,54,'user',1,NULL,NULL,1),(48,55,'user',1,NULL,NULL,1),(49,56,'user',1,NULL,NULL,1),(50,121,'user',3,NULL,NULL,1),(51,122,'user',1,NULL,NULL,1),(52,123,'user',1,NULL,NULL,1),(53,124,'user',1,NULL,NULL,1),(54,125,'user',1,NULL,NULL,1),(55,127,'user',1,NULL,NULL,1),(56,128,'user',1,NULL,NULL,1),(57,129,'user',1,NULL,NULL,1),(58,130,'user',1,NULL,NULL,1),(59,131,'user',1,NULL,NULL,1),(60,132,'user',1,NULL,NULL,1),(61,133,'user',1,NULL,NULL,1),(62,134,'user',1,NULL,NULL,1),(63,135,'user',1,NULL,NULL,1),(64,136,'user',1,NULL,NULL,1),(65,137,'user',1,NULL,NULL,1),(66,138,'user',1,NULL,NULL,1),(67,139,'user',1,NULL,NULL,1),(68,140,'user',1,NULL,NULL,1),(69,141,'user',1,NULL,NULL,1),(70,142,'user',1,NULL,NULL,1),(71,143,'user',1,NULL,NULL,1),(72,144,'user',1,NULL,NULL,1),(73,145,'user',1,NULL,NULL,1),(74,146,'user',1,NULL,NULL,1),(75,147,'user',1,NULL,NULL,1),(76,148,'user',1,NULL,NULL,1),(77,149,'user',1,NULL,NULL,1),(78,150,'user',1,NULL,NULL,1),(79,151,'user',1,NULL,NULL,1),(80,152,'user',1,NULL,NULL,1),(81,203,'user',1,NULL,NULL,1),(82,204,'user',1,NULL,NULL,1),(83,205,'user',1,NULL,NULL,1),(84,206,'user',1,NULL,NULL,1),(85,207,'user',1,NULL,NULL,1),(86,208,'user',1,NULL,NULL,1),(87,209,'user',1,NULL,NULL,1),(88,210,'user',1,NULL,NULL,1),(89,211,'user',1,NULL,NULL,1),(90,212,'user',1,NULL,NULL,1),(91,213,'user',1,NULL,NULL,1),(92,214,'user',1,NULL,NULL,1),(93,215,'user',1,NULL,NULL,1),(94,216,'user',1,NULL,NULL,1),(95,217,'user',1,NULL,NULL,1),(96,218,'user',1,NULL,NULL,1),(97,219,'user',1,NULL,NULL,1),(98,220,'user',1,NULL,NULL,1),(99,221,'user',1,NULL,NULL,1),(100,222,'user',1,NULL,NULL,1),(101,223,'user',1,NULL,NULL,1),(102,224,'user',1,NULL,NULL,1),(103,225,'user',1,NULL,NULL,1),(104,226,'user',1,NULL,NULL,1),(105,227,'user',1,NULL,NULL,1),(106,228,'user',1,NULL,NULL,1),(107,229,'user',1,NULL,NULL,1),(108,230,'user',1,NULL,NULL,1),(109,231,'user',1,NULL,NULL,1),(110,232,'user',12,'0',0,0),(111,233,'user',12,'0',0,0),(112,234,'user',12,'0',0,1),(113,235,'user',12,'0',0,1),(114,236,'user',4,'0',0,0),(115,237,'user',13,'0',0,0),(116,237,'user',16,'0',0,0),(117,237,'user',18,'0',0,0),(118,238,'user',12,'0',0,1),(119,238,'user',3,'0',0,1),(120,238,'user',10,'0',0,1); +/*!40000 ALTER TABLE `llx_actioncomm_resources` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_adherent` +-- + +DROP TABLE IF EXISTS `llx_adherent`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_adherent` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `entity` int(11) NOT NULL DEFAULT '1', + `ref_ext` varchar(128) DEFAULT NULL, + `civility` varchar(6) DEFAULT NULL, + `lastname` varchar(50) DEFAULT NULL, + `firstname` varchar(50) DEFAULT NULL, + `login` varchar(50) DEFAULT NULL, + `pass` varchar(50) DEFAULT NULL, + `pass_crypted` varchar(128) DEFAULT NULL, + `fk_adherent_type` int(11) NOT NULL, + `morphy` varchar(3) NOT NULL, + `societe` varchar(128) DEFAULT NULL, + `fk_soc` int(11) DEFAULT NULL, + `address` text, + `zip` varchar(10) DEFAULT NULL, + `town` varchar(50) DEFAULT NULL, + `state_id` varchar(50) DEFAULT NULL, + `country` varchar(50) DEFAULT NULL, + `email` varchar(255) DEFAULT NULL, + `skype` varchar(255) DEFAULT NULL, + `phone` varchar(30) DEFAULT NULL, + `phone_perso` varchar(30) DEFAULT NULL, + `phone_mobile` varchar(30) DEFAULT NULL, + `birth` date DEFAULT NULL, + `photo` varchar(255) DEFAULT NULL, + `statut` smallint(6) NOT NULL DEFAULT '0', + `public` smallint(6) NOT NULL DEFAULT '0', + `datefin` datetime DEFAULT NULL, + `note_private` text, + `note_public` text, + `datevalid` datetime DEFAULT NULL, + `datec` datetime DEFAULT NULL, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `fk_user_author` int(11) DEFAULT NULL, + `fk_user_mod` int(11) DEFAULT NULL, + `fk_user_valid` int(11) DEFAULT NULL, + `canvas` varchar(32) DEFAULT NULL, + `import_key` varchar(14) DEFAULT NULL, + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_adherent_login` (`login`,`entity`), + UNIQUE KEY `uk_adherent_fk_soc` (`fk_soc`), + KEY `idx_adherent_fk_adherent_type` (`fk_adherent_type`), + CONSTRAINT `adherent_fk_soc` FOREIGN KEY (`fk_soc`) REFERENCES `llx_societe` (`rowid`), + CONSTRAINT `fk_adherent_adherent_type` FOREIGN KEY (`fk_adherent_type`) REFERENCES `llx_adherent_type` (`rowid`) +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_adherent` +-- + +LOCK TABLES `llx_adherent` WRITE; +/*!40000 ALTER TABLE `llx_adherent` DISABLE KEYS */; +INSERT INTO `llx_adherent` VALUES (1,1,NULL,NULL,'Smith','Vick','vsmith','vsx1n8tf',NULL,2,'phy',NULL,10,NULL,NULL,NULL,NULL,'102','vsmith@email.com',NULL,NULL,NULL,NULL,'1960-07-07',NULL,1,0,'2012-07-09 00:00:00',NULL,NULL,'2010-07-10 15:12:56','2010-07-08 23:50:00','2013-03-20 13:30:11',1,1,1,NULL,NULL),(2,1,NULL,NULL,'Curie','Pierre','pcurie','pcuriedolibarr',NULL,2,'phy',NULL,12,NULL,NULL,NULL,NULL,'1','pcurie@example.com','',NULL,NULL,NULL,'1972-07-08',NULL,1,1,'2017-07-17 00:00:00',NULL,NULL,'2010-07-10 15:03:32','2010-07-10 15:03:09','2015-10-05 19:57:57',1,12,1,NULL,NULL),(3,1,NULL,NULL,'john','doe','john','8bs6gty5',NULL,2,'phy',NULL,NULL,NULL,NULL,NULL,NULL,'1','johndoe@email.com',NULL,NULL,NULL,NULL,NULL,NULL,1,0,NULL,NULL,NULL,'2011-07-18 21:28:00','2011-07-18 21:10:09','2015-10-03 09:28:46',1,1,1,NULL,NULL),(4,1,NULL,NULL,'smith','smith','Smith','s6hjp10f',NULL,2,'phy',NULL,NULL,NULL,NULL,NULL,NULL,'11','smith@email.com',NULL,NULL,NULL,NULL,NULL,NULL,1,0,NULL,NULL,NULL,'2011-07-18 21:27:52','2011-07-18 21:27:44','2015-10-03 09:40:27',1,1,1,NULL,NULL); +/*!40000 ALTER TABLE `llx_adherent` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_adherent_extrafields` +-- + +DROP TABLE IF EXISTS `llx_adherent_extrafields`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_adherent_extrafields` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `fk_object` int(11) NOT NULL, + `zzz` varchar(125) DEFAULT NULL, + `aaa` varchar(255) DEFAULT NULL, + `sssss` varchar(255) DEFAULT NULL, + `import_key` varchar(14) DEFAULT NULL, + PRIMARY KEY (`rowid`), + KEY `idx_adherent_options` (`fk_object`), + KEY `idx_adherent_extrafields` (`fk_object`) +) ENGINE=InnoDB AUTO_INCREMENT=64 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_adherent_extrafields` +-- + +LOCK TABLES `llx_adherent_extrafields` WRITE; +/*!40000 ALTER TABLE `llx_adherent_extrafields` DISABLE KEYS */; +INSERT INTO `llx_adherent_extrafields` VALUES (62,'2011-07-18 19:10:09',3,NULL,NULL,NULL,NULL),(63,'2011-07-18 19:27:44',4,NULL,NULL,NULL,NULL); +/*!40000 ALTER TABLE `llx_adherent_extrafields` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_adherent_type` +-- + +DROP TABLE IF EXISTS `llx_adherent_type`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_adherent_type` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `entity` int(11) NOT NULL DEFAULT '1', + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `statut` smallint(6) NOT NULL DEFAULT '0', + `libelle` varchar(50) NOT NULL, + `cotisation` varchar(3) NOT NULL DEFAULT 'yes', + `vote` varchar(3) NOT NULL DEFAULT 'yes', + `note` text, + `mail_valid` text, + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_adherent_type_libelle` (`libelle`,`entity`) +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_adherent_type` +-- + +LOCK TABLES `llx_adherent_type` WRITE; +/*!40000 ALTER TABLE `llx_adherent_type` DISABLE KEYS */; +INSERT INTO `llx_adherent_type` VALUES (1,1,'2010-07-08 21:41:55',1,'Board members','1','1','','
'),(2,1,'2010-07-08 21:41:43',1,'Standard members','1','0','','
'); +/*!40000 ALTER TABLE `llx_adherent_type` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_adherent_type_extrafields` +-- + +DROP TABLE IF EXISTS `llx_adherent_type_extrafields`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_adherent_type_extrafields` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `fk_object` int(11) NOT NULL, + `import_key` varchar(14) DEFAULT NULL, + PRIMARY KEY (`rowid`), + KEY `idx_adherent_type_extrafields` (`fk_object`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_adherent_type_extrafields` +-- + +LOCK TABLES `llx_adherent_type_extrafields` WRITE; +/*!40000 ALTER TABLE `llx_adherent_type_extrafields` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_adherent_type_extrafields` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_advtargetemailing` +-- + +DROP TABLE IF EXISTS `llx_advtargetemailing`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_advtargetemailing` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(200) NOT NULL, + `entity` int(11) NOT NULL DEFAULT '1', + `fk_mailing` int(11) NOT NULL, + `filtervalue` text, + `fk_user_author` int(11) NOT NULL, + `datec` datetime NOT NULL, + `fk_user_mod` int(11) NOT NULL, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_advtargetemailing_name` (`name`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_advtargetemailing` +-- + +LOCK TABLES `llx_advtargetemailing` WRITE; +/*!40000 ALTER TABLE `llx_advtargetemailing` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_advtargetemailing` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_bank` +-- + +DROP TABLE IF EXISTS `llx_bank`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_bank` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `datec` datetime DEFAULT NULL, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `datev` date DEFAULT NULL, + `dateo` date DEFAULT NULL, + `amount` double(24,8) NOT NULL DEFAULT '0.00000000', + `label` varchar(255) DEFAULT NULL, + `fk_account` int(11) DEFAULT NULL, + `fk_user_author` int(11) DEFAULT NULL, + `fk_user_rappro` int(11) DEFAULT NULL, + `fk_type` varchar(6) DEFAULT NULL, + `num_releve` varchar(50) DEFAULT NULL, + `num_chq` varchar(50) DEFAULT NULL, + `rappro` tinyint(4) DEFAULT '0', + `note` text, + `fk_bordereau` int(11) DEFAULT '0', + `banque` varchar(255) DEFAULT NULL, + `emetteur` varchar(255) DEFAULT NULL, + `author` varchar(40) DEFAULT NULL, + PRIMARY KEY (`rowid`), + KEY `idx_bank_datev` (`datev`), + KEY `idx_bank_dateo` (`dateo`), + KEY `idx_bank_fk_account` (`fk_account`), + KEY `idx_bank_rappro` (`rappro`), + KEY `idx_bank_num_releve` (`num_releve`) +) ENGINE=InnoDB AUTO_INCREMENT=32 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_bank` +-- + +LOCK TABLES `llx_bank` WRITE; +/*!40000 ALTER TABLE `llx_bank` DISABLE KEYS */; +INSERT INTO `llx_bank` VALUES (1,'2010-07-08 23:56:14','2016-07-30 15:16:10','2016-07-08','2016-07-08',2000.00000000,'(Initial balance)',1,NULL,1,'SOLD','201210',NULL,1,NULL,0,NULL,NULL,NULL),(2,'2010-07-09 00:00:24','2016-07-30 15:16:10','2016-07-09','2016-07-09',500.00000000,'(Initial balance)',2,NULL,NULL,'SOLD',NULL,NULL,0,NULL,0,NULL,NULL,NULL),(3,'2010-07-10 13:33:42','2016-07-30 15:16:10','2016-07-10','2016-07-10',0.00000000,'(Solde initial)',3,NULL,NULL,'SOLD',NULL,NULL,0,NULL,0,NULL,NULL,NULL),(5,'2011-07-18 20:50:24','2016-07-30 15:16:10','2016-07-08','2016-07-08',20.00000000,'(CustomerInvoicePayment)',1,1,NULL,'CB','201107',NULL,1,NULL,0,NULL,NULL,NULL),(6,'2011-07-18 20:50:47','2016-07-30 15:16:10','2016-07-08','2016-07-08',10.00000000,'(CustomerInvoicePayment)',3,1,NULL,'LIQ',NULL,NULL,0,NULL,0,NULL,NULL,NULL),(8,'2011-08-01 03:34:11','2016-07-30 15:21:31','2015-08-01','2015-08-01',5.63000000,'(CustomerInvoicePayment)',1,1,1,'CB','201210',NULL,1,NULL,0,NULL,NULL,NULL),(12,'2011-08-05 23:11:37','2016-07-30 15:21:31','2015-08-05','2015-08-05',-10.00000000,'(SocialContributionPayment)',1,1,1,'VIR','201210',NULL,1,NULL,0,NULL,NULL,NULL),(13,'2011-08-06 20:33:54','2016-07-30 15:21:31','2015-08-06','2015-08-06',5.98000000,'(CustomerInvoicePayment)',3,1,NULL,'LIQ',NULL,NULL,0,NULL,0,NULL,NULL,NULL),(14,'2011-08-08 02:53:40','2016-07-30 15:21:31','2015-08-08','2015-08-08',26.10000000,'(CustomerInvoicePayment)',3,1,NULL,'LIQ',NULL,NULL,0,NULL,0,NULL,NULL,NULL),(15,'2011-08-08 02:55:58','2016-07-30 15:21:31','2015-08-08','2015-08-08',26.96000000,'(CustomerInvoicePayment)',1,1,1,'TIP','201211',NULL,1,NULL,0,NULL,NULL,NULL),(16,'2012-12-09 15:28:44','2016-07-30 15:21:31','2015-12-09','2015-12-09',2.00000000,'(CustomerInvoicePayment)',3,1,NULL,'LIQ',NULL,NULL,0,NULL,0,NULL,NULL,NULL),(17,'2012-12-09 15:28:53','2016-07-30 15:21:31','2015-12-09','2015-12-09',-2.00000000,'(CustomerInvoicePaymentBack)',3,1,NULL,'LIQ',NULL,NULL,0,NULL,0,NULL,NULL,NULL),(18,'2012-12-09 17:35:55','2016-07-30 15:21:31','2015-12-09','2015-12-09',-2.00000000,'(CustomerInvoicePaymentBack)',3,1,NULL,'LIQ',NULL,NULL,0,NULL,0,NULL,NULL,NULL),(19,'2012-12-09 17:37:02','2016-07-30 15:21:31','2015-12-09','2015-12-09',2.00000000,'(CustomerInvoicePayment)',3,1,NULL,'LIQ',NULL,NULL,0,NULL,0,NULL,NULL,NULL),(20,'2012-12-09 18:35:07','2016-07-30 15:21:31','2015-12-09','2015-12-09',-2.00000000,'(CustomerInvoicePaymentBack)',3,1,NULL,'LIQ',NULL,NULL,0,NULL,0,NULL,NULL,NULL),(21,'2012-12-12 18:54:33','2016-07-30 15:21:31','2015-12-12','2015-12-12',1.00000000,'(CustomerInvoicePayment)',1,1,1,'TIP','201210',NULL,1,NULL,0,NULL,NULL,NULL),(22,'2013-03-06 16:48:16','2016-07-30 15:16:10','2016-03-06','2016-03-06',20.00000000,'(SubscriptionPayment)',3,1,NULL,'LIQ',NULL,NULL,0,NULL,0,NULL,NULL,NULL),(23,'2013-03-20 14:30:11','2016-07-30 15:16:10','2016-03-20','2016-03-20',10.00000000,'(SubscriptionPayment)',1,1,NULL,'VIR',NULL,NULL,0,NULL,0,NULL,NULL,NULL),(24,'2014-03-02 19:57:58','2016-07-30 15:16:10','2016-07-09','2016-07-09',605.00000000,'(CustomerInvoicePayment)',1,1,NULL,'VIR',NULL,NULL,0,NULL,0,NULL,'111',NULL),(26,'2014-03-02 20:01:39','2016-07-30 15:16:10','2016-03-19','2016-03-19',500.00000000,'(CustomerInvoicePayment)',3,1,NULL,'LIQ',NULL,NULL,0,NULL,0,NULL,NULL,NULL),(27,'2014-03-02 20:02:06','2016-07-30 15:16:10','2016-03-21','2016-03-21',400.00000000,'(CustomerInvoicePayment)',1,1,NULL,'VIR',NULL,NULL,0,NULL,0,NULL,'ABC and Co',NULL),(28,'2014-03-03 19:22:32','2016-07-30 15:21:31','2015-10-03','2015-10-03',-400.00000000,'(CustomerInvoicePaymentBack)',3,1,NULL,'LIQ',NULL,NULL,0,NULL,0,NULL,NULL,NULL),(29,'2014-03-03 19:23:16','2016-07-30 15:16:10','2016-03-10','2016-03-10',-300.00000000,'(CustomerInvoicePaymentBack)',3,1,NULL,'LIQ',NULL,NULL,0,NULL,0,NULL,NULL,NULL),(30,'2016-01-22 18:56:34','2016-01-22 17:56:34','2016-01-22','2016-01-22',-900.00000000,'(SupplierInvoicePayment)',1,12,NULL,'LIQ',NULL,NULL,0,NULL,0,NULL,NULL,NULL),(31,'2016-07-30 22:42:14','2016-07-30 14:42:14','2016-07-30','2016-07-30',0.00000000,'(Initial balance)',4,0,NULL,'SOLD',NULL,NULL,0,NULL,0,NULL,NULL,NULL); +/*!40000 ALTER TABLE `llx_bank` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_bank_account` +-- + +DROP TABLE IF EXISTS `llx_bank_account`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_bank_account` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `datec` datetime DEFAULT NULL, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `ref` varchar(12) NOT NULL, + `label` varchar(30) NOT NULL, + `entity` int(11) NOT NULL DEFAULT '1', + `bank` varchar(60) DEFAULT NULL, + `code_banque` varchar(128) DEFAULT NULL, + `code_guichet` varchar(6) DEFAULT NULL, + `number` varchar(255) DEFAULT NULL, + `cle_rib` varchar(5) DEFAULT NULL, + `bic` varchar(11) DEFAULT NULL, + `iban_prefix` varchar(34) DEFAULT NULL, + `country_iban` varchar(2) DEFAULT NULL, + `cle_iban` varchar(2) DEFAULT NULL, + `domiciliation` varchar(255) DEFAULT NULL, + `state_id` varchar(50) DEFAULT NULL, + `fk_pays` int(11) NOT NULL, + `proprio` varchar(60) DEFAULT NULL, + `owner_address` text, + `courant` smallint(6) NOT NULL DEFAULT '0', + `clos` smallint(6) NOT NULL DEFAULT '0', + `rappro` smallint(6) DEFAULT '1', + `url` varchar(128) DEFAULT NULL, + `account_number` varchar(32) DEFAULT NULL, + `accountancy_journal` varchar(16) DEFAULT NULL, + `currency_code` varchar(3) NOT NULL, + `min_allowed` int(11) DEFAULT '0', + `min_desired` int(11) DEFAULT '0', + `comment` text, + `fk_user_author` int(11) DEFAULT NULL, + `fk_user_modif` int(11) DEFAULT NULL, + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_bank_account_label` (`label`,`entity`) +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_bank_account` +-- + +LOCK TABLES `llx_bank_account` WRITE; +/*!40000 ALTER TABLE `llx_bank_account` DISABLE KEYS */; +INSERT INTO `llx_bank_account` VALUES (1,'2010-07-08 23:56:14','2016-07-30 14:45:12','SWIBAC','Swiss bank account',1,'Switz Gold Bank','','','123456789','','','NL39RABO0314043352',NULL,NULL,'21 jum street',NULL,6,'Mac Golder','11 big road,\r\nZurich',1,0,1,NULL,'','','EUR',1500,1500,'',NULL,NULL),(2,'2010-07-09 00:00:24','2016-07-30 15:17:18','SWIBAC2','Swiss bank account old',1,'Switz Silver Bank','','','','','','NL07SNSB0908534915',NULL,NULL,'Road bankrupt\r\nZurich',NULL,6,'','',1,1,1,NULL,'','','EUR',200,400,'',NULL,NULL),(3,'2010-07-10 13:33:42','2010-07-10 11:33:42','ACCOUNTCASH','Account for cash',1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'3',1,NULL,NULL,2,0,1,NULL,'',NULL,'EUR',0,0,'
',NULL,NULL),(4,'2016-07-30 18:42:14','2016-07-30 14:44:45','LUXBAC','Luxemburg Bank Account',1,'Lux Platinuium Bank','','','','','','NL46INGB0687674581',NULL,NULL,'',NULL,140,'','',1,0,1,NULL,'','','EUR',NULL,NULL,'',NULL,NULL); +/*!40000 ALTER TABLE `llx_bank_account` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_bank_account_extrafields` +-- + +DROP TABLE IF EXISTS `llx_bank_account_extrafields`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_bank_account_extrafields` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `fk_object` int(11) NOT NULL, + `import_key` varchar(14) DEFAULT NULL, + PRIMARY KEY (`rowid`), + KEY `idx_bank_account_extrafields` (`fk_object`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_bank_account_extrafields` +-- + +LOCK TABLES `llx_bank_account_extrafields` WRITE; +/*!40000 ALTER TABLE `llx_bank_account_extrafields` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_bank_account_extrafields` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_bank_categ` +-- + +DROP TABLE IF EXISTS `llx_bank_categ`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_bank_categ` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `label` varchar(255) DEFAULT NULL, + `entity` int(11) NOT NULL DEFAULT '1', + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_bank_categ` +-- + +LOCK TABLES `llx_bank_categ` WRITE; +/*!40000 ALTER TABLE `llx_bank_categ` DISABLE KEYS */; +INSERT INTO `llx_bank_categ` VALUES (1,'Bank category one',1),(2,'Bank category two',1); +/*!40000 ALTER TABLE `llx_bank_categ` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_bank_class` +-- + +DROP TABLE IF EXISTS `llx_bank_class`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_bank_class` ( + `lineid` int(11) NOT NULL, + `fk_categ` int(11) NOT NULL, + UNIQUE KEY `uk_bank_class_lineid` (`lineid`,`fk_categ`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_bank_class` +-- + +LOCK TABLES `llx_bank_class` WRITE; +/*!40000 ALTER TABLE `llx_bank_class` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_bank_class` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_bank_url` +-- + +DROP TABLE IF EXISTS `llx_bank_url`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_bank_url` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `fk_bank` int(11) DEFAULT NULL, + `url_id` int(11) DEFAULT NULL, + `url` varchar(255) DEFAULT NULL, + `label` varchar(255) DEFAULT NULL, + `type` varchar(24) NOT NULL, + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_bank_url` (`fk_bank`,`type`) +) ENGINE=InnoDB AUTO_INCREMENT=55 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_bank_url` +-- + +LOCK TABLES `llx_bank_url` WRITE; +/*!40000 ALTER TABLE `llx_bank_url` DISABLE KEYS */; +INSERT INTO `llx_bank_url` VALUES (3,5,2,'/compta/paiement/card.php?id=','(paiement)','payment'),(4,5,2,'/comm/card.php?socid=','Belin SARL','company'),(5,6,3,'/compta/paiement/card.php?id=','(paiement)','payment'),(6,6,2,'/comm/card.php?socid=','Belin SARL','company'),(9,8,5,'/compta/paiement/card.php?id=','(paiement)','payment'),(10,8,7,'/comm/card.php?socid=','Generic customer','company'),(17,12,4,'/compta/payment_sc/card.php?id=','(paiement)','payment_sc'),(18,12,4,'/compta/charges.php?id=','Assurance Chomage (fff)','sc'),(19,13,6,'/dolibarrnew/compta/paiement/card.php?id=','(paiement)','payment'),(20,13,7,'/dolibarrnew/comm/card.php?socid=','Generic customer','company'),(21,14,8,'/compta/paiement/card.php?id=','(paiement)','payment'),(22,14,2,'/comm/card.php?socid=','Belin SARL','company'),(23,15,9,'/compta/paiement/card.php?id=','(paiement)','payment'),(24,15,10,'/comm/card.php?socid=','Smith Vick','company'),(25,16,17,'/dolibarrnew/compta/paiement/card.php?id=','(paiement)','payment'),(26,16,10,'/dolibarrnew/comm/card.php?socid=','Smith Vick','company'),(27,17,18,'/dolibarrnew/compta/paiement/card.php?id=','(paiement)','payment'),(28,17,10,'/dolibarrnew/comm/card.php?socid=','Smith Vick','company'),(29,18,19,'/dolibarrnew/compta/paiement/card.php?id=','(paiement)','payment'),(30,18,10,'/dolibarrnew/comm/card.php?socid=','Smith Vick','company'),(31,19,20,'/dolibarrnew/compta/paiement/card.php?id=','(paiement)','payment'),(32,19,10,'/dolibarrnew/comm/card.php?socid=','Smith Vick','company'),(33,20,21,'/dolibarrnew/compta/paiement/card.php?id=','(paiement)','payment'),(34,20,10,'/dolibarrnew/comm/card.php?socid=','Smith Vick','company'),(35,21,23,'/compta/paiement/card.php?id=','(paiement)','payment'),(36,21,1,'/comm/card.php?socid=','ABC and Co','company'),(37,22,24,'/dolibarrnew/compta/paiement/card.php?id=','(paiement)','payment'),(38,22,12,'/dolibarrnew/comm/card.php?socid=','Dupont Alain','company'),(39,23,25,'/dolibarrnew/compta/paiement/card.php?id=','(paiement)','payment'),(40,23,10,'/dolibarrnew/comm/card.php?socid=','Smith Vick','company'),(41,24,26,'/compta/paiement/card.php?id=','(paiement)','payment'),(42,24,1,'/comm/card.php?socid=','ABC and Co','company'),(45,26,29,'/compta/paiement/card.php?id=','(paiement)','payment'),(46,26,1,'/comm/card.php?socid=','ABC and Co','company'),(47,27,30,'/compta/paiement/card.php?id=','(paiement)','payment'),(48,27,1,'/comm/card.php?socid=','ABC and Co','company'),(49,28,32,'/dolibarr_new/compta/paiement/card.php?id=','(paiement)','payment'),(50,28,1,'/dolibarr_new/comm/card.php?socid=','ABC and Co','company'),(51,29,33,'/dolibarr_new/compta/paiement/card.php?id=','(paiement)','payment'),(52,29,1,'/dolibarr_new/comm/card.php?socid=','ABC and Co','company'),(53,30,1,'/dolibarr_3.8/htdocs/fourn/paiement/card.php?id=','(paiement)','payment_supplier'),(54,30,1,'/dolibarr_3.8/htdocs/fourn/card.php?socid=','Indian SAS','company'); +/*!40000 ALTER TABLE `llx_bank_url` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_bookmark` +-- + +DROP TABLE IF EXISTS `llx_bookmark`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_bookmark` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `fk_soc` int(11) DEFAULT NULL, + `fk_user` int(11) NOT NULL, + `dateb` datetime DEFAULT NULL, + `url` varchar(255) NOT NULL, + `target` varchar(16) DEFAULT NULL, + `title` varchar(64) DEFAULT NULL, + `favicon` varchar(24) DEFAULT NULL, + `position` int(11) DEFAULT '0', + `entity` int(11) NOT NULL DEFAULT '1', + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_bookmark_url` (`fk_user`,`url`), + UNIQUE KEY `uk_bookmark_title` (`fk_user`,`title`) +) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_bookmark` +-- + +LOCK TABLES `llx_bookmark` WRITE; +/*!40000 ALTER TABLE `llx_bookmark` DISABLE KEYS */; +INSERT INTO `llx_bookmark` VALUES (1,NULL,0,'2010-07-09 01:29:03','http://wiki.dolibarr.org','1','Online documentation','none',1,1),(2,NULL,0,'2010-07-09 01:30:15','http://www.dolibarr.org','1','Official portal','none',2,1),(3,NULL,0,'2010-07-09 01:30:53','http://www.dolistore.com','1','DoliStore','none',10,1),(4,NULL,0,'2010-07-09 01:31:35','http://asso.dolibarr.org/index.php/Main_Page','1','The foundation','none',0,1),(5,NULL,0,'2014-03-02 16:40:41','http://www.facebook.com/dolibarr','1','Facebook page','none',50,1),(6,NULL,0,'2014-03-02 16:41:12','http://www.twitter.com/dolibarr','1','Twitter channel','none',60,1),(7,NULL,0,'2014-03-02 16:42:08','http://plus.google.com/+DolibarrOrg','1','Google+ page','none',55,1); +/*!40000 ALTER TABLE `llx_bookmark` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_bordereau_cheque` +-- + +DROP TABLE IF EXISTS `llx_bordereau_cheque`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_bordereau_cheque` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `datec` datetime NOT NULL, + `date_bordereau` date DEFAULT NULL, + `ref` varchar(30) NOT NULL, + `entity` int(11) NOT NULL DEFAULT '1', + `amount` double(24,8) NOT NULL, + `nbcheque` smallint(6) NOT NULL, + `fk_bank_account` int(11) DEFAULT NULL, + `fk_user_author` int(11) DEFAULT NULL, + `note` text, + `statut` smallint(6) NOT NULL DEFAULT '0', + `ref_ext` varchar(255) DEFAULT NULL, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_bordereau_cheque` (`ref`,`entity`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_bordereau_cheque` +-- + +LOCK TABLES `llx_bordereau_cheque` WRITE; +/*!40000 ALTER TABLE `llx_bordereau_cheque` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_bordereau_cheque` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_boxes` +-- + +DROP TABLE IF EXISTS `llx_boxes`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_boxes` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `entity` int(11) NOT NULL DEFAULT '1', + `box_id` int(11) NOT NULL, + `position` smallint(6) NOT NULL, + `box_order` varchar(3) NOT NULL, + `fk_user` int(11) NOT NULL DEFAULT '0', + `maxline` int(11) DEFAULT NULL, + `params` varchar(255) DEFAULT NULL, + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_boxes` (`entity`,`box_id`,`position`,`fk_user`), + KEY `idx_boxes_boxid` (`box_id`), + KEY `idx_boxes_fk_user` (`fk_user`), + CONSTRAINT `fk_boxes_box_id` FOREIGN KEY (`box_id`) REFERENCES `llx_boxes_def` (`rowid`) +) ENGINE=InnoDB AUTO_INCREMENT=1032 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_boxes` +-- + +LOCK TABLES `llx_boxes` WRITE; +/*!40000 ALTER TABLE `llx_boxes` DISABLE KEYS */; +INSERT INTO `llx_boxes` VALUES (253,2,323,0,'0',0,NULL,NULL),(304,2,324,0,'0',0,NULL,NULL),(305,2,325,0,'0',0,NULL,NULL),(306,2,326,0,'0',0,NULL,NULL),(307,2,327,0,'0',0,NULL,NULL),(308,2,328,0,'0',0,NULL,NULL),(309,2,329,0,'0',0,NULL,NULL),(310,2,330,0,'0',0,NULL,NULL),(311,2,331,0,'0',0,NULL,NULL),(312,2,332,0,'0',0,NULL,NULL),(313,2,333,0,'0',0,NULL,NULL),(314,1,347,0,'0',0,NULL,NULL),(315,1,348,0,'0',0,NULL,NULL),(316,1,349,0,'0',0,NULL,NULL),(317,1,350,0,'0',0,NULL,NULL),(344,1,374,0,'0',0,NULL,NULL),(347,1,377,0,'0',0,NULL,NULL),(348,1,378,0,'0',0,NULL,NULL),(349,1,379,0,'0',0,NULL,NULL),(354,1,384,0,'0',0,NULL,NULL),(355,1,385,0,'0',0,NULL,NULL),(356,1,386,0,'0',0,NULL,NULL),(357,1,387,0,'0',0,NULL,NULL),(358,1,388,0,'0',0,NULL,NULL),(359,1,389,0,'0',0,NULL,NULL),(360,1,390,0,'0',0,NULL,NULL),(361,1,391,0,'0',0,NULL,NULL),(362,1,392,0,'0',0,NULL,NULL),(363,1,393,0,'0',0,NULL,NULL),(366,1,396,0,'0',0,NULL,NULL),(387,1,403,0,'0',0,NULL,NULL),(392,1,409,0,'0',0,NULL,NULL),(393,1,410,0,'0',0,NULL,NULL),(394,1,411,0,'0',0,NULL,NULL),(395,1,412,0,'0',0,NULL,NULL),(396,1,413,0,'0',0,NULL,NULL),(397,1,414,0,'0',0,NULL,NULL),(398,1,415,0,'0',0,NULL,NULL),(399,1,416,0,'0',0,NULL,NULL),(400,1,417,0,'0',0,NULL,NULL),(401,1,418,0,'0',0,NULL,NULL),(492,1,386,0,'A01',12,NULL,NULL),(493,1,392,0,'A02',12,NULL,NULL),(494,1,412,0,'A03',12,NULL,NULL),(495,1,377,0,'A04',12,NULL,NULL),(496,1,387,0,'A05',12,NULL,NULL),(497,1,347,0,'A06',12,NULL,NULL),(498,1,396,0,'B01',12,NULL,NULL),(499,1,384,0,'B02',12,NULL,NULL),(500,1,385,0,'B03',12,NULL,NULL),(501,1,419,0,'0',0,NULL,NULL),(1019,1,392,0,'A01',2,NULL,NULL),(1020,1,386,0,'A02',2,NULL,NULL),(1021,1,412,0,'A03',2,NULL,NULL),(1022,1,347,0,'A04',2,NULL,NULL),(1023,1,393,0,'A05',2,NULL,NULL),(1024,1,387,0,'A06',2,NULL,NULL),(1025,1,389,0,'A07',2,NULL,NULL),(1026,1,416,0,'A08',2,NULL,NULL),(1027,1,396,0,'B01',2,NULL,NULL),(1028,1,377,0,'B02',2,NULL,NULL),(1029,1,379,0,'B03',2,NULL,NULL),(1030,1,384,0,'B04',2,NULL,NULL),(1031,1,419,0,'B05',2,NULL,NULL); +/*!40000 ALTER TABLE `llx_boxes` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_boxes_def` +-- + +DROP TABLE IF EXISTS `llx_boxes_def`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_boxes_def` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `file` varchar(200) NOT NULL, + `entity` int(11) NOT NULL DEFAULT '1', + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `note` varchar(130) DEFAULT NULL, + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_boxes_def` (`file`,`entity`,`note`) +) ENGINE=InnoDB AUTO_INCREMENT=420 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_boxes_def` +-- + +LOCK TABLES `llx_boxes_def` WRITE; +/*!40000 ALTER TABLE `llx_boxes_def` DISABLE KEYS */; +INSERT INTO `llx_boxes_def` VALUES (188,'box_services_vendus.php',1,'2011-08-05 20:40:27',NULL),(323,'box_actions.php',2,'2013-03-13 15:29:19',NULL),(324,'box_clients.php',2,'2013-03-13 20:21:35',NULL),(325,'box_prospect.php',2,'2013-03-13 20:21:35',NULL),(326,'box_contacts.php',2,'2013-03-13 20:21:35',NULL),(327,'box_activity.php',2,'2013-03-13 20:21:35','(WarningUsingThisBoxSlowDown)'),(328,'box_propales.php',2,'2013-03-13 20:32:38',NULL),(329,'box_comptes.php',2,'2013-03-13 20:33:09',NULL),(330,'box_factures_imp.php',2,'2013-03-13 20:33:09',NULL),(331,'box_factures.php',2,'2013-03-13 20:33:09',NULL),(332,'box_produits.php',2,'2013-03-13 20:33:09',NULL),(333,'box_produits_alerte_stock.php',2,'2013-03-13 20:33:09',NULL),(346,'box_googlemaps@google',1,'2013-11-07 00:01:39',NULL),(347,'box_clients.php',1,'2015-11-15 22:05:57',NULL),(348,'box_prospect.php',1,'2015-11-15 22:05:57',NULL),(349,'box_contacts.php',1,'2015-11-15 22:05:57',NULL),(350,'box_activity.php',1,'2015-11-15 22:05:57','(WarningUsingThisBoxSlowDown)'),(374,'box_services_contracts.php',1,'2015-11-15 22:38:37',NULL),(377,'box_project.php',1,'2015-11-15 22:38:44',NULL),(378,'box_task.php',1,'2015-11-15 22:38:44',NULL),(379,'box_members.php',1,'2015-11-15 22:39:17',NULL),(384,'box_factures_imp.php',1,'2015-11-15 22:39:46',NULL),(385,'box_factures.php',1,'2015-11-15 22:39:46',NULL),(386,'box_graph_invoices_permonth.php',1,'2015-11-15 22:39:46',NULL),(387,'box_comptes.php',1,'2015-11-15 22:39:46',NULL),(388,'box_contracts.php',1,'2015-11-15 22:39:52',NULL),(389,'box_services_expired.php',1,'2015-11-15 22:39:52',NULL),(390,'box_ficheinter.php',1,'2015-11-15 22:39:56',NULL),(391,'box_bookmarks.php',1,'2015-11-15 22:40:51',NULL),(392,'box_graph_propales_permonth.php',1,'2015-11-15 22:41:47',NULL),(393,'box_propales.php',1,'2015-11-15 22:41:47',NULL),(396,'box_graph_product_distribution.php',1,'2015-11-15 22:41:47',NULL),(403,'box_goodcustomers.php',1,'2016-07-30 11:13:20','(WarningUsingThisBoxSlowDown)'),(404,'box_external_rss.php',1,'2016-07-30 11:15:25','1 (Dolibarr.org News)'),(409,'box_produits.php',1,'2016-07-30 13:38:11',NULL),(410,'box_produits_alerte_stock.php',1,'2016-07-30 13:38:11',NULL),(411,'box_commandes.php',1,'2016-07-30 13:38:11',NULL),(412,'box_graph_orders_permonth.php',1,'2016-07-30 13:38:11',NULL),(413,'box_graph_invoices_supplier_permonth.php',1,'2016-07-30 13:38:11',NULL),(414,'box_graph_orders_supplier_permonth.php',1,'2016-07-30 13:38:11',NULL),(415,'box_fournisseurs.php',1,'2016-07-30 13:38:11',NULL),(416,'box_factures_fourn_imp.php',1,'2016-07-30 13:38:11',NULL),(417,'box_factures_fourn.php',1,'2016-07-30 13:38:11',NULL),(418,'box_supplier_orders.php',1,'2016-07-30 13:38:11',NULL),(419,'box_actions.php',1,'2016-07-30 15:42:32',NULL); +/*!40000 ALTER TABLE `llx_boxes_def` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_budget` +-- + +DROP TABLE IF EXISTS `llx_budget`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_budget` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `entity` int(11) NOT NULL DEFAULT '1', + `label` varchar(255) NOT NULL, + `status` int(11) DEFAULT NULL, + `note` text, + `date_start` date DEFAULT NULL, + `date_end` date DEFAULT NULL, + `datec` datetime DEFAULT NULL, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `fk_user_creat` int(11) DEFAULT NULL, + `fk_user_modif` int(11) DEFAULT NULL, + `import_key` int(11) DEFAULT NULL, + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_budget` +-- + +LOCK TABLES `llx_budget` WRITE; +/*!40000 ALTER TABLE `llx_budget` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_budget` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_budget_lines` +-- + +DROP TABLE IF EXISTS `llx_budget_lines`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_budget_lines` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `fk_budget` int(11) NOT NULL, + `fk_project_ids` varchar(255) NOT NULL, + `amount` double(24,8) NOT NULL, + `datec` datetime DEFAULT NULL, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `fk_user_creat` int(11) DEFAULT NULL, + `fk_user_modif` int(11) DEFAULT NULL, + `import_key` int(11) DEFAULT NULL, + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_budget_lines` (`fk_budget`,`fk_project_ids`), + CONSTRAINT `fk_budget_lines_budget` FOREIGN KEY (`fk_budget`) REFERENCES `llx_budget` (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_budget_lines` +-- + +LOCK TABLES `llx_budget_lines` WRITE; +/*!40000 ALTER TABLE `llx_budget_lines` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_budget_lines` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_c_accounting_category` +-- + +DROP TABLE IF EXISTS `llx_c_accounting_category`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_c_accounting_category` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `code` varchar(16) NOT NULL, + `label` varchar(255) NOT NULL, + `range_account` varchar(255) NOT NULL, + `sens` tinyint(4) NOT NULL DEFAULT '0', + `category_type` tinyint(4) NOT NULL DEFAULT '0', + `formula` varchar(255) NOT NULL, + `position` int(11) DEFAULT '0', + `fk_country` int(11) DEFAULT NULL, + `active` int(11) DEFAULT '1', + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_c_accounting_category` (`code`) +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_c_accounting_category` +-- + +LOCK TABLES `llx_c_accounting_category` WRITE; +/*!40000 ALTER TABLE `llx_c_accounting_category` DISABLE KEYS */; +INSERT INTO `llx_c_accounting_category` VALUES (1,'VTE','Ventes de marchandises','707xxx',0,0,'',10,1,1),(2,'MAR','Coût d achats marchandises vendues','603xxx | 607xxx | 609xxx',0,0,'',20,1,1),(3,'MARGE','Marge commerciale','',0,1,'1 + 2',30,1,1); +/*!40000 ALTER TABLE `llx_c_accounting_category` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_c_action_trigger` +-- + +DROP TABLE IF EXISTS `llx_c_action_trigger`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_c_action_trigger` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `code` varchar(32) NOT NULL, + `label` varchar(128) NOT NULL, + `description` varchar(255) DEFAULT NULL, + `elementtype` varchar(16) NOT NULL, + `rang` int(11) DEFAULT '0', + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_action_trigger_code` (`code`), + KEY `idx_action_trigger_rang` (`rang`) +) ENGINE=InnoDB AUTO_INCREMENT=180 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_c_action_trigger` +-- + +LOCK TABLES `llx_c_action_trigger` WRITE; +/*!40000 ALTER TABLE `llx_c_action_trigger` DISABLE KEYS */; +INSERT INTO `llx_c_action_trigger` VALUES (131,'COMPANY_SENTBYMAIL','Mails sent from third party card','Executed when you send email from third party card','societe',1),(132,'COMPANY_CREATE','Third party created','Executed when a third party is created','societe',1),(133,'PROPAL_VALIDATE','Customer proposal validated','Executed when a commercial proposal is validated','propal',2),(134,'PROPAL_SENTBYMAIL','Commercial proposal sent by mail','Executed when a commercial proposal is sent by mail','propal',3),(135,'ORDER_VALIDATE','Customer order validate','Executed when a customer order is validated','commande',4),(136,'ORDER_CLOSE','Customer order classify delivered','Executed when a customer order is set delivered','commande',5),(137,'ORDER_CLASSIFY_BILLED','Customer order classify billed','Executed when a customer order is set to billed','commande',5),(138,'ORDER_CANCEL','Customer order canceled','Executed when a customer order is canceled','commande',5),(139,'ORDER_SENTBYMAIL','Customer order sent by mail','Executed when a customer order is sent by mail ','commande',5),(140,'BILL_VALIDATE','Customer invoice validated','Executed when a customer invoice is approved','facture',6),(141,'BILL_PAYED','Customer invoice payed','Executed when a customer invoice is payed','facture',7),(142,'BILL_CANCEL','Customer invoice canceled','Executed when a customer invoice is conceled','facture',8),(143,'BILL_SENTBYMAIL','Customer invoice sent by mail','Executed when a customer invoice is sent by mail','facture',9),(144,'BILL_UNVALIDATE','Customer invoice unvalidated','Executed when a customer invoice status set back to draft','facture',10),(145,'ORDER_SUPPLIER_VALIDATE','Supplier order validated','Executed when a supplier order is validated','order_supplier',11),(146,'ORDER_SUPPLIER_APPROVE','Supplier order request approved','Executed when a supplier order is approved','order_supplier',12),(147,'ORDER_SUPPLIER_REFUSE','Supplier order request refused','Executed when a supplier order is refused','order_supplier',13),(148,'ORDER_SUPPLIER_SENTBYMAIL','Supplier order sent by mail','Executed when a supplier order is sent by mail','order_supplier',14),(149,'BILL_SUPPLIER_VALIDATE','Supplier invoice validated','Executed when a supplier invoice is validated','invoice_supplier',15),(150,'BILL_SUPPLIER_PAYED','Supplier invoice payed','Executed when a supplier invoice is payed','invoice_supplier',16),(151,'BILL_SUPPLIER_SENTBYMAIL','Supplier invoice sent by mail','Executed when a supplier invoice is sent by mail','invoice_supplier',17),(152,'BILL_SUPPLIER_CANCELED','Supplier invoice cancelled','Executed when a supplier invoice is cancelled','invoice_supplier',17),(153,'CONTRACT_VALIDATE','Contract validated','Executed when a contract is validated','contrat',18),(154,'SHIPPING_VALIDATE','Shipping validated','Executed when a shipping is validated','shipping',20),(155,'SHIPPING_SENTBYMAIL','Shipping sent by mail','Executed when a shipping is sent by mail','shipping',21),(156,'MEMBER_VALIDATE','Member validated','Executed when a member is validated','member',22),(157,'MEMBER_SUBSCRIPTION','Member subscribed','Executed when a member is subscribed','member',23),(158,'MEMBER_RESILIATE','Member resiliated','Executed when a member is resiliated','member',24),(159,'MEMBER_MODIFY','Member modified','Executed when a member is modified','member',24),(160,'MEMBER_DELETE','Member deleted','Executed when a member is deleted','member',25),(161,'FICHINTER_VALIDATE','Intervention validated','Executed when a intervention is validated','ficheinter',19),(162,'FICHINTER_CLASSIFY_BILLED','Intervention set billed','Executed when a intervention is set to billed (when option FICHINTER_CLASSIFY_BILLED is set)','ficheinter',19),(163,'FICHINTER_CLASSIFY_UNBILLED','Intervention set unbilled','Executed when a intervention is set to unbilled (when option FICHINTER_CLASSIFY_BILLED is set)','ficheinter',19),(164,'FICHINTER_REOPEN','Intervention opened','Executed when a intervention is re-opened','ficheinter',19),(165,'FICHINTER_SENTBYMAIL','Intervention sent by mail','Executed when a intervention is sent by mail','ficheinter',19),(166,'PROJECT_CREATE','Project creation','Executed when a project is created','project',140),(167,'PROPAL_CLOSE_SIGNED','Customer proposal closed signed','Executed when a customer proposal is closed signed','propal',2),(168,'PROPAL_CLOSE_REFUSED','Customer proposal closed refused','Executed when a customer proposal is closed refused','propal',2),(169,'PROPAL_CLASSIFY_BILLED','Customer proposal set billed','Executed when a customer proposal is set to billed','propal',2),(170,'TASK_CREATE','Task created','Executed when a project task is created','project',35),(171,'TASK_MODIFY','Task modified','Executed when a project task is modified','project',36),(172,'TASK_DELETE','Task deleted','Executed when a project task is deleted','project',37),(173,'BILL_SUPPLIER_UNVALIDATE','Supplier invoice unvalidated','Executed when a supplier invoice status is set back to draft','invoice_supplier',15),(174,'PROJECT_MODIFY','Project modified','Executed when a project is modified','project',141),(175,'PROJECT_DELETE','Project deleted','Executed when a project is deleted','project',142),(176,'ORDER_SUPPLIER_CREATE','Supplier order validated','Executed when a supplier order is validated','order_supplier',11),(177,'ORDER_SUPPLIER_SUBMIT','Supplier order request submited','Executed when a supplier order is approved','order_supplier',12),(178,'ORDER_SUPPLIER_RECEIVE','Supplier order request received','Executed when a supplier order is received','order_supplier',12),(179,'ORDER_SUPPLIER_CLASSIFY_BILLED','Supplier order set billed','Executed when a supplier order is set as billed','order_supplier',14); +/*!40000 ALTER TABLE `llx_c_action_trigger` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_c_actioncomm` +-- + +DROP TABLE IF EXISTS `llx_c_actioncomm`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_c_actioncomm` ( + `id` int(11) NOT NULL, + `code` varchar(12) NOT NULL, + `type` varchar(10) NOT NULL DEFAULT 'system', + `libelle` varchar(48) NOT NULL, + `module` varchar(16) DEFAULT NULL, + `active` tinyint(4) NOT NULL DEFAULT '1', + `todo` tinyint(4) DEFAULT NULL, + `position` int(11) NOT NULL DEFAULT '0', + `color` varchar(9) DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `uk_c_actioncomm` (`code`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_c_actioncomm` +-- + +LOCK TABLES `llx_c_actioncomm` WRITE; +/*!40000 ALTER TABLE `llx_c_actioncomm` DISABLE KEYS */; +INSERT INTO `llx_c_actioncomm` VALUES (1,'AC_TEL','system','Phone call',NULL,1,NULL,2,NULL),(2,'AC_FAX','system','Send Fax',NULL,1,NULL,3,NULL),(3,'AC_PROP','systemauto','Send commercial proposal by email','propal',0,NULL,10,NULL),(4,'AC_EMAIL','system','Send Email',NULL,1,NULL,4,NULL),(5,'AC_RDV','system','Rendez-vous',NULL,1,NULL,1,NULL),(8,'AC_COM','systemauto','Send customer order by email','order',0,NULL,8,NULL),(9,'AC_FAC','systemauto','Send customer invoice by email','invoice',0,NULL,6,NULL),(10,'AC_SHIP','systemauto','Send shipping by email','shipping',0,NULL,11,NULL),(11,'AC_INT','system','Intervention on site',NULL,1,NULL,4,NULL),(30,'AC_SUP_ORD','systemauto','Send supplier order by email','order_supplier',0,NULL,9,NULL),(31,'AC_SUP_INV','systemauto','Send supplier invoice by email','invoice_supplier',0,NULL,7,NULL),(40,'AC_OTH_AUTO','systemauto','Other (automatically inserted events)',NULL,1,NULL,20,NULL),(50,'AC_OTH','system','Other (manually inserted events)',NULL,1,NULL,5,NULL),(100700,'AC_CABMED','module','Send document by email','cabinetmed',0,NULL,100,NULL); +/*!40000 ALTER TABLE `llx_c_actioncomm` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_c_availability` +-- + +DROP TABLE IF EXISTS `llx_c_availability`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_c_availability` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `code` varchar(30) NOT NULL, + `label` varchar(60) NOT NULL, + `active` tinyint(4) NOT NULL DEFAULT '1', + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_c_availability` (`code`) +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_c_availability` +-- + +LOCK TABLES `llx_c_availability` WRITE; +/*!40000 ALTER TABLE `llx_c_availability` DISABLE KEYS */; +INSERT INTO `llx_c_availability` VALUES (1,'AV_NOW','Immediate',1),(2,'AV_1W','1 week',1),(3,'AV_2W','2 weeks',1),(4,'AV_3W','3 weeks',1); +/*!40000 ALTER TABLE `llx_c_availability` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_c_barcode_type` +-- + +DROP TABLE IF EXISTS `llx_c_barcode_type`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_c_barcode_type` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `code` varchar(16) NOT NULL, + `entity` int(11) NOT NULL DEFAULT '1', + `libelle` varchar(50) NOT NULL, + `coder` varchar(16) NOT NULL, + `example` varchar(16) NOT NULL, + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_c_barcode_type` (`code`,`entity`) +) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_c_barcode_type` +-- + +LOCK TABLES `llx_c_barcode_type` WRITE; +/*!40000 ALTER TABLE `llx_c_barcode_type` DISABLE KEYS */; +INSERT INTO `llx_c_barcode_type` VALUES (1,'EAN8',1,'EAN8','0','1234567'),(2,'EAN13',1,'EAN13','phpbarcode','123456789012'),(3,'UPC',1,'UPC','0','123456789012'),(4,'ISBN',1,'ISBN','0','123456789'),(5,'C39',1,'Code 39','0','1234567890'),(6,'C128',1,'Code 128','tcpdfbarcode','ABCD1234567890'),(13,'DATAMATRIX',1,'Datamatrix','0','1234567xyz'),(14,'QRCODE',1,'Qr Code','0','www.dolibarr.org'); +/*!40000 ALTER TABLE `llx_c_barcode_type` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_c_chargesociales` +-- + +DROP TABLE IF EXISTS `llx_c_chargesociales`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_c_chargesociales` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `libelle` varchar(80) DEFAULT NULL, + `deductible` smallint(6) NOT NULL DEFAULT '0', + `active` tinyint(4) NOT NULL DEFAULT '1', + `code` varchar(12) NOT NULL, + `fk_pays` int(11) NOT NULL DEFAULT '1', + `module` varchar(32) DEFAULT NULL, + `accountancy_code` varchar(32) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=4110 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_c_chargesociales` +-- + +LOCK TABLES `llx_c_chargesociales` WRITE; +/*!40000 ALTER TABLE `llx_c_chargesociales` DISABLE KEYS */; +INSERT INTO `llx_c_chargesociales` VALUES (1,'Allocations familiales',1,1,'TAXFAM',1,NULL,NULL),(2,'CSG Deductible',1,1,'TAXCSGD',1,NULL,NULL),(3,'CSG/CRDS NON Deductible',0,1,'TAXCSGND',1,NULL,NULL),(10,'Taxe apprentissage',0,1,'TAXAPP',1,NULL,NULL),(11,'Taxe professionnelle',0,1,'TAXPRO',1,NULL,NULL),(12,'Cotisation foncière des entreprises',0,1,'TAXCFE',1,NULL,NULL),(13,'Cotisation sur la valeur ajoutée des entreprises',0,1,'TAXCVAE',1,NULL,NULL),(20,'Impots locaux/fonciers',0,1,'TAXFON',1,NULL,NULL),(25,'Impots revenus',0,1,'TAXREV',1,NULL,NULL),(30,'Assurance Sante',0,1,'TAXSECU',1,NULL,NULL),(40,'Mutuelle',0,1,'TAXMUT',1,NULL,NULL),(50,'Assurance vieillesse',0,1,'TAXRET',1,NULL,NULL),(60,'Assurance Chomage',0,1,'TAXCHOM',1,NULL,NULL),(201,'ONSS',1,1,'TAXBEONSS',2,NULL,NULL),(210,'Precompte professionnel',1,1,'TAXBEPREPRO',2,NULL,NULL),(220,'Prime d\'existence',1,1,'TAXBEPRIEXI',2,NULL,NULL),(230,'Precompte immobilier',1,1,'TAXBEPREIMMO',2,NULL,NULL),(4101,'Krankenversicherung',1,1,'TAXATKV',41,NULL,NULL),(4102,'Unfallversicherung',1,1,'TAXATUV',41,NULL,NULL),(4103,'Pensionsversicherung',1,1,'TAXATPV',41,NULL,NULL),(4104,'Arbeitslosenversicherung',1,1,'TAXATAV',41,NULL,NULL),(4105,'Insolvenzentgeltsicherungsfond',1,1,'TAXATIESG',41,NULL,NULL),(4106,'Wohnbauförderung',1,1,'TAXATWF',41,NULL,NULL),(4107,'Arbeiterkammerumlage',1,1,'TAXATAK',41,NULL,NULL),(4108,'Mitarbeitervorsorgekasse',1,1,'TAXATMVK',41,NULL,NULL),(4109,'Familienlastenausgleichsfond',1,1,'TAXATFLAF',41,NULL,NULL); +/*!40000 ALTER TABLE `llx_c_chargesociales` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_c_civility` +-- + +DROP TABLE IF EXISTS `llx_c_civility`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_c_civility` ( + `rowid` int(11) NOT NULL, + `code` varchar(6) NOT NULL, + `label` varchar(50) DEFAULT NULL, + `active` tinyint(4) NOT NULL DEFAULT '1', + `module` varchar(32) DEFAULT NULL, + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_c_civility` (`code`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_c_civility` +-- + +LOCK TABLES `llx_c_civility` WRITE; +/*!40000 ALTER TABLE `llx_c_civility` DISABLE KEYS */; +INSERT INTO `llx_c_civility` VALUES (1,'MME','Madame',1,NULL),(3,'MR','Monsieur',1,NULL),(5,'MLE','Mademoiselle',1,NULL),(7,'MTRE','Maître',1,NULL),(8,'DR','Docteur',1,NULL); +/*!40000 ALTER TABLE `llx_c_civility` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_c_country` +-- + +DROP TABLE IF EXISTS `llx_c_country`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_c_country` ( + `rowid` int(11) NOT NULL, + `code` varchar(2) NOT NULL, + `code_iso` varchar(3) DEFAULT NULL, + `label` varchar(50) NOT NULL, + `active` tinyint(4) NOT NULL DEFAULT '1', + `favorite` tinyint(4) NOT NULL DEFAULT '0', + PRIMARY KEY (`rowid`), + UNIQUE KEY `idx_c_country_code` (`code`), + UNIQUE KEY `idx_c_country_label` (`label`), + UNIQUE KEY `idx_c_country_code_iso` (`code_iso`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_c_country` +-- + +LOCK TABLES `llx_c_country` WRITE; +/*!40000 ALTER TABLE `llx_c_country` DISABLE KEYS */; +INSERT INTO `llx_c_country` VALUES (0,'',NULL,'-',1,1),(1,'FR','FRA','France',1,0),(2,'BE','BEL','Belgium',1,0),(3,'IT','ITA','Italy',1,0),(4,'ES','ESP','Spain',1,0),(5,'DE','DEU','Germany',1,0),(6,'CH','CHE','Switzerland',1,0),(7,'GB','GBR','United Kingdom',1,0),(8,'IE','IRL','Irland',1,0),(9,'CN','CHN','China',1,0),(10,'TN','TUN','Tunisia',1,0),(11,'US','USA','United States',1,0),(12,'MA','MAR','Maroc',1,0),(13,'DZ','DZA','Algeria',1,0),(14,'CA','CAN','Canada',1,0),(15,'TG','TGO','Togo',1,0),(16,'GA','GAB','Gabon',1,0),(17,'NL','NLD','Nerderland',1,0),(18,'HU','HUN','Hongrie',1,0),(19,'RU','RUS','Russia',1,0),(20,'SE','SWE','Sweden',1,0),(21,'CI','CIV','Côte d\'Ivoire',1,0),(22,'SN','SEN','Senegal',1,0),(23,'AR','ARG','Argentine',1,0),(24,'CM','CMR','Cameroun',1,0),(25,'PT','PRT','Portugal',1,0),(26,'SA','SAU','Saudi Arabia',1,0),(27,'MC','MCO','Monaco',1,0),(28,'AU','AUS','Australia',1,0),(29,'SG','SGP','Singapour',1,0),(30,'AF','AFG','Afghanistan',1,0),(31,'AX','ALA','Iles Aland',1,0),(32,'AL','ALB','Albanie',1,0),(33,'AS','ASM','Samoa américaines',1,0),(34,'AD','AND','Andorre',1,0),(35,'AO','AGO','Angola',1,0),(36,'AI','AIA','Anguilla',1,0),(37,'AQ','ATA','Antarctique',1,0),(38,'AG','ATG','Antigua-et-Barbuda',1,0),(39,'AM','ARM','Arménie',1,0),(40,'AW','ABW','Aruba',1,0),(41,'AT','AUT','Autriche',1,0),(42,'AZ','AZE','Azerbaïdjan',1,0),(43,'BS','BHS','Bahamas',1,0),(44,'BH','BHR','Bahreïn',1,0),(45,'BD','BGD','Bangladesh',1,0),(46,'BB','BRB','Barbade',1,0),(47,'BY','BLR','Biélorussie',1,0),(48,'BZ','BLZ','Belize',1,0),(49,'BJ','BEN','Bénin',1,0),(50,'BM','BMU','Bermudes',1,0),(51,'BT','BTN','Bhoutan',1,0),(52,'BO','BOL','Bolivie',1,0),(53,'BA','BIH','Bosnie-Herzégovine',1,0),(54,'BW','BWA','Botswana',1,0),(55,'BV','BVT','Ile Bouvet',1,0),(56,'BR','BRA','Brazil',1,0),(57,'IO','IOT','Territoire britannique de l\'Océan Indien',1,0),(58,'BN','BRN','Brunei',1,0),(59,'BG','BGR','Bulgarie',1,0),(60,'BF','BFA','Burkina Faso',1,0),(61,'BI','BDI','Burundi',1,0),(62,'KH','KHM','Cambodge',1,0),(63,'CV','CPV','Cap-Vert',1,0),(64,'KY','CYM','Iles Cayman',1,0),(65,'CF','CAF','République centrafricaine',1,0),(66,'TD','TCD','Tchad',1,0),(67,'CL','CHL','Chili',1,0),(68,'CX','CXR','Ile Christmas',1,0),(69,'CC','CCK','Iles des Cocos (Keeling)',1,0),(70,'CO','COL','Colombie',1,0),(71,'KM','COM','Comores',1,0),(72,'CG','COG','Congo',1,0),(73,'CD','COD','République démocratique du Congo',1,0),(74,'CK','COK','Iles Cook',1,0),(75,'CR','CRI','Costa Rica',1,0),(76,'HR','HRV','Croatie',1,0),(77,'CU','CUB','Cuba',1,0),(78,'CY','CYP','Chypre',1,0),(79,'CZ','CZE','République Tchèque',1,0),(80,'DK','DNK','Danemark',1,0),(81,'DJ','DJI','Djibouti',1,0),(82,'DM','DMA','Dominique',1,0),(83,'DO','DOM','République Dominicaine',1,0),(84,'EC','ECU','Equateur',1,0),(85,'EG','EGY','Egypte',1,0),(86,'SV','SLV','Salvador',1,0),(87,'GQ','GNQ','Guinée Equatoriale',1,0),(88,'ER','ERI','Erythrée',1,0),(89,'EE','EST','Estonia',1,0),(90,'ET','ETH','Ethiopie',1,0),(91,'FK','FLK','Iles Falkland',1,0),(92,'FO','FRO','Iles Féroé',1,0),(93,'FJ','FJI','Iles Fidji',1,0),(94,'FI','FIN','Finlande',1,0),(95,'GF','GUF','Guyane française',1,0),(96,'PF','PYF','Polynésie française',1,0),(97,'TF','ATF','Terres australes françaises',1,0),(98,'GM','GMB','Gambie',1,0),(99,'GE','GEO','Georgia',1,0),(100,'GH','GHA','Ghana',1,0),(101,'GI','GIB','Gibraltar',1,0),(102,'GR','GRC','Greece',1,0),(103,'GL','GRL','Groenland',1,0),(104,'GD','GRD','Grenade',1,0),(106,'GU','GUM','Guam',1,0),(107,'GT','GTM','Guatemala',1,0),(108,'GN','GIN','Guinea',1,0),(109,'GW','GNB','Guinea-Bissao',1,0),(111,'HT','HTI','Haiti',1,0),(112,'HM','HMD','Iles Heard et McDonald',1,0),(113,'VA','VAT','Saint-Siège (Vatican)',1,0),(114,'HN','HND','Honduras',1,0),(115,'HK','HKG','Hong Kong',1,0),(116,'IS','ISL','Islande',1,0),(117,'IN','IND','India',1,0),(118,'ID','IDN','Indonésie',1,0),(119,'IR','IRN','Iran',1,0),(120,'IQ','IRQ','Iraq',1,0),(121,'IL','ISR','Israel',1,0),(122,'JM','JAM','Jamaïque',1,0),(123,'JP','JPN','Japon',1,0),(124,'JO','JOR','Jordanie',1,0),(125,'KZ','KAZ','Kazakhstan',1,0),(126,'KE','KEN','Kenya',1,0),(127,'KI','KIR','Kiribati',1,0),(128,'KP','PRK','North Corea',1,0),(129,'KR','KOR','South Corea',1,0),(130,'KW','KWT','Koweït',1,0),(131,'KG','KGZ','Kirghizistan',1,0),(132,'LA','LAO','Laos',1,0),(133,'LV','LVA','Lettonie',1,0),(134,'LB','LBN','Liban',1,0),(135,'LS','LSO','Lesotho',1,0),(136,'LR','LBR','Liberia',1,0),(137,'LY','LBY','Libye',1,0),(138,'LI','LIE','Liechtenstein',1,0),(139,'LT','LTU','Lituanie',1,0),(140,'LU','LUX','Luxembourg',1,0),(141,'MO','MAC','Macao',1,0),(142,'MK','MKD','ex-République yougoslave de Macédoine',1,0),(143,'MG','MDG','Madagascar',1,0),(144,'MW','MWI','Malawi',1,0),(145,'MY','MYS','Malaisie',1,0),(146,'MV','MDV','Maldives',1,0),(147,'ML','MLI','Mali',1,0),(148,'MT','MLT','Malte',1,0),(149,'MH','MHL','Iles Marshall',1,0),(151,'MR','MRT','Mauritanie',1,0),(152,'MU','MUS','Maurice',1,0),(153,'YT','MYT','Mayotte',1,0),(154,'MX','MEX','Mexique',1,0),(155,'FM','FSM','Micronésie',1,0),(156,'MD','MDA','Moldavie',1,0),(157,'MN','MNG','Mongolie',1,0),(158,'MS','MSR','Monserrat',1,0),(159,'MZ','MOZ','Mozambique',1,0),(160,'MM','MMR','Birmanie (Myanmar)',1,0),(161,'NA','NAM','Namibie',1,0),(162,'NR','NRU','Nauru',1,0),(163,'NP','NPL','Népal',1,0),(164,'AN',NULL,'Antilles néerlandaises',1,0),(165,'NC','NCL','Nouvelle-Calédonie',1,0),(166,'NZ','NZL','Nouvelle-Zélande',1,0),(167,'NI','NIC','Nicaragua',1,0),(168,'NE','NER','Niger',1,0),(169,'NG','NGA','Nigeria',1,0),(170,'NU','NIU','Nioué',1,0),(171,'NF','NFK','Ile Norfolk',1,0),(172,'MP','MNP','Mariannes du Nord',1,0),(173,'NO','NOR','Norvège',1,0),(174,'OM','OMN','Oman',1,0),(175,'PK','PAK','Pakistan',1,0),(176,'PW','PLW','Palaos',1,0),(177,'PS','PSE','Territoire Palestinien Occupé',1,0),(178,'PA','PAN','Panama',1,0),(179,'PG','PNG','Papouasie-Nouvelle-Guinée',1,0),(180,'PY','PRY','Paraguay',1,0),(181,'PE','PER','Peru',1,0),(182,'PH','PHL','Philippines',1,0),(183,'PN','PCN','Iles Pitcairn',1,0),(184,'PL','POL','Pologne',1,0),(185,'PR','PRI','Porto Rico',1,0),(186,'QA','QAT','Qatar',1,0),(188,'RO','ROU','Roumanie',1,0),(189,'RW','RWA','Rwanda',1,0),(190,'SH','SHN','Sainte-Hélène',1,0),(191,'KN','KNA','Saint-Christophe-et-Niévès',1,0),(192,'LC','LCA','Sainte-Lucie',1,0),(193,'PM','SPM','Saint-Pierre-et-Miquelon',1,0),(194,'VC','VCT','Saint-Vincent-et-les-Grenadines',1,0),(195,'WS','WSM','Samoa',1,0),(196,'SM','SMR','Saint-Marin',1,0),(197,'ST','STP','Sao Tomé-et-Principe',1,0),(198,'RS','SRB','Serbie',1,0),(199,'SC','SYC','Seychelles',1,0),(200,'SL','SLE','Sierra Leone',1,0),(201,'SK','SVK','Slovaquie',1,0),(202,'SI','SVN','Slovénie',1,0),(203,'SB','SLB','Iles Salomon',1,0),(204,'SO','SOM','Somalie',1,0),(205,'ZA','ZAF','Afrique du Sud',1,0),(206,'GS','SGS','Iles Géorgie du Sud et Sandwich du Sud',1,0),(207,'LK','LKA','Sri Lanka',1,0),(208,'SD','SDN','Soudan',1,0),(209,'SR','SUR','Suriname',1,0),(210,'SJ','SJM','Iles Svalbard et Jan Mayen',1,0),(211,'SZ','SWZ','Swaziland',1,0),(212,'SY','SYR','Syrie',1,0),(213,'TW','TWN','Taïwan',1,0),(214,'TJ','TJK','Tadjikistan',1,0),(215,'TZ','TZA','Tanzanie',1,0),(216,'TH','THA','Thaïlande',1,0),(217,'TL','TLS','Timor Oriental',1,0),(218,'TK','TKL','Tokélaou',1,0),(219,'TO','TON','Tonga',1,0),(220,'TT','TTO','Trinité-et-Tobago',1,0),(221,'TR','TUR','Turquie',1,0),(222,'TM','TKM','Turkménistan',1,0),(223,'TC','TCA','Iles Turks-et-Caicos',1,0),(224,'TV','TUV','Tuvalu',1,0),(225,'UG','UGA','Ouganda',1,0),(226,'UA','UKR','Ukraine',1,0),(227,'xx','ARE','Émirats arabes unishh',1,0),(228,'UM','UMI','Iles mineures éloignées des États-Unis',1,0),(229,'UY','URY','Uruguay',1,0),(230,'UZ','UZB','Ouzbékistan',1,0),(231,'VU','VUT','Vanuatu',1,0),(232,'VE','VEN','Vénézuela',1,0),(233,'VN','VNM','Viêt Nam',1,0),(234,'VG','VGB','Iles Vierges britanniques',1,0),(235,'VI','VIR','Iles Vierges américaines',1,0),(236,'WF','WLF','Wallis-et-Futuna',1,0),(237,'EH','ESH','Sahara occidental',1,0),(238,'YE','YEM','Yémen',1,0),(239,'ZM','ZMB','Zambie',1,0),(240,'ZW','ZWE','Zimbabwe',1,0),(241,'GG','GGY','Guernesey',1,0),(242,'IM','IMN','Ile de Man',1,0),(243,'JE','JEY','Jersey',1,0),(244,'ME','MNE','Monténégro',1,0),(245,'BL','BLM','Saint-Barthélemy',1,0),(246,'MF','MAF','Saint-Martin',1,0),(247,'hh',NULL,'hhh',1,0); +/*!40000 ALTER TABLE `llx_c_country` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_c_currencies` +-- + +DROP TABLE IF EXISTS `llx_c_currencies`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_c_currencies` ( + `code_iso` varchar(3) NOT NULL, + `label` varchar(64) NOT NULL, + `unicode` varchar(32) DEFAULT NULL, + `active` tinyint(4) NOT NULL DEFAULT '1', + PRIMARY KEY (`code_iso`), + UNIQUE KEY `uk_c_currencies_code_iso` (`code_iso`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_c_currencies` +-- + +LOCK TABLES `llx_c_currencies` WRITE; +/*!40000 ALTER TABLE `llx_c_currencies` DISABLE KEYS */; +INSERT INTO `llx_c_currencies` VALUES ('AED','United Arab Emirates Dirham',NULL,1),('AFN','Afghanistan Afghani','[1547]',1),('ALL','Albania Leklll','[76,101,107]',1),('ANG','Netherlands Antilles Guilder','[402]',1),('ARP','Pesos argentins',NULL,0),('ARS','Argentino Peso','[36]',1),('ATS','Shiliing autrichiens',NULL,0),('AUD','Australia Dollar','[36]',1),('AWG','Aruba Guilder','[402]',1),('AZN','Azerbaijan New Manat','[1084,1072,1085]',1),('BAM','Bosnia and Herzegovina Convertible Marka','[75,77]',1),('BBD','Barbados Dollar','[36]',1),('BEF','Francs belges',NULL,0),('BGN','Bulgaria Lev','[1083,1074]',1),('BMD','Bermuda Dollar','[36]',1),('BND','Brunei Darussalam Dollar','[36]',1),('BOB','Bolivia Boliviano','[36,98]',1),('BRL','Brazil Real','[82,36]',1),('BSD','Bahamas Dollar','[36]',1),('BWP','Botswana Pula','[80]',1),('BYR','Belarus Ruble','[112,46]',1),('BZD','Belize Dollar','[66,90,36]',1),('CAD','Canada Dollar','[36]',1),('CHF','Switzerland Franc','[67,72,70]',1),('CLP','Chile Peso','[36]',1),('CNY','China Yuan Renminbi','[165]',1),('COP','Colombia Peso','[36]',1),('CRC','Costa Rica Colon','[8353]',1),('CUP','Cuba Peso','[8369]',1),('CZK','Czech Republic Koruna','[75,269]',1),('DEM','Deutsch mark',NULL,0),('DKK','Denmark Krone','[107,114]',1),('DOP','Dominican Republic Peso','[82,68,36]',1),('DZD','Algeria Dinar',NULL,1),('EEK','Estonia Kroon','[107,114]',1),('EGP','Egypt Pound','[163]',1),('ESP','Pesete',NULL,0),('EUR','Euro Member Countries','[8364]',1),('FIM','Mark finlandais',NULL,0),('FJD','Fiji Dollar','[36]',1),('FKP','Falkland Islands (Malvinas) Pound','[163]',1),('FRF','Francs francais',NULL,0),('GBP','United Kingdom Pound','[163]',1),('GGP','Guernsey Pound','[163]',1),('GHC','Ghana Cedis','[162]',1),('GIP','Gibraltar Pound','[163]',1),('GRD','Drachme (grece)',NULL,0),('GTQ','Guatemala Quetzal','[81]',1),('GYD','Guyana Dollar','[36]',1),('hhh','ddd','[]',1),('HKD','Hong Kong Dollar','[36]',1),('HNL','Honduras Lempira','[76]',1),('HRK','Croatia Kuna','[107,110]',1),('HUF','Hungary Forint','[70,116]',1),('IDR','Indonesia Rupiah','[82,112]',1),('IEP','Livres irlandaises',NULL,0),('ILS','Israel Shekel','[8362]',1),('IMP','Isle of Man Pound','[163]',1),('INR','India Rupee',NULL,1),('IRR','Iran Rial','[65020]',1),('ISK','Iceland Krona','[107,114]',1),('ITL','Lires',NULL,0),('JEP','Jersey Pound','[163]',1),('JMD','Jamaica Dollar','[74,36]',1),('JPY','Japan Yen','[165]',1),('KES','Kenya Shilling',NULL,1),('KGS','Kyrgyzstan Som','[1083,1074]',1),('KHR','Cambodia Riel','[6107]',1),('KPW','Korea (North) Won','[8361]',1),('KRW','Korea (South) Won','[8361]',1),('KYD','Cayman Islands Dollar','[36]',1),('KZT','Kazakhstan Tenge','[1083,1074]',1),('LAK','Laos Kip','[8365]',1),('LBP','Lebanon Pound','[163]',1),('LKR','Sri Lanka Rupee','[8360]',1),('LRD','Liberia Dollar','[36]',1),('LTL','Lithuania Litas','[76,116]',1),('LUF','Francs luxembourgeois',NULL,0),('LVL','Latvia Lat','[76,115]',1),('MAD','Morocco Dirham',NULL,1),('MKD','Macedonia Denar','[1076,1077,1085]',1),('MNT','Mongolia Tughrik','[8366]',1),('MRO','Mauritania Ouguiya',NULL,1),('MUR','Mauritius Rupee','[8360]',1),('MXN','Mexico Peso','[36]',1),('MXP','Pesos Mexicans',NULL,0),('MYR','Malaysia Ringgit','[82,77]',1),('MZN','Mozambique Metical','[77,84]',1),('NAD','Namibia Dollar','[36]',1),('NGN','Nigeria Naira','[8358]',1),('NIO','Nicaragua Cordoba','[67,36]',1),('NLG','Florins',NULL,0),('NOK','Norway Krone','[107,114]',1),('NPR','Nepal Rupee','[8360]',1),('NZD','New Zealand Dollar','[36]',1),('OMR','Oman Rial','[65020]',1),('PAB','Panama Balboa','[66,47,46]',1),('PEN','Peru Nuevo Sol','[83,47,46]',1),('PHP','Philippines Peso','[8369]',1),('PKR','Pakistan Rupee','[8360]',1),('PLN','Poland Zloty','[122,322]',1),('PTE','Escudos',NULL,0),('PYG','Paraguay Guarani','[71,115]',1),('QAR','Qatar Riyal','[65020]',1),('RON','Romania New Leu','[108,101,105]',1),('RSD','Serbia Dinar','[1044,1080,1085,46]',1),('RUB','Russia Ruble','[1088,1091,1073]',1),('SAR','Saudi Arabia Riyal','[65020]',1),('SBD','Solomon Islands Dollar','[36]',1),('SCR','Seychelles Rupee','[8360]',1),('SEK','Sweden Krona','[107,114]',1),('SGD','Singapore Dollar','[36]',1),('SHP','Saint Helena Pound','[163]',1),('SKK','Couronnes slovaques',NULL,0),('SOS','Somalia Shilling','[83]',1),('SRD','Suriname Dollar','[36]',1),('SUR','Rouble',NULL,0),('SVC','El Salvador Colon','[36]',1),('SYP','Syria Pound','[163]',1),('THB','Thailand Baht','[3647]',1),('TND','Tunisia Dinar',NULL,1),('TRL','Turkey Lira','[84,76]',1),('TRY','Turkey Lira','[8356]',1),('TTD','Trinidad and Tobago Dollar','[84,84,36]',1),('TVD','Tuvalu Dollar','[36]',1),('TWD','Taiwan New Dollar','[78,84,36]',1),('UAH','Ukraine Hryvna','[8372]',1),('USD','United States Dollar','[36]',1),('UYU','Uruguay Peso','[36,85]',1),('UZS','Uzbekistan Som','[1083,1074]',1),('VEF','Venezuela Bolivar Fuerte','[66,115]',1),('VND','Viet Nam Dong','[8363]',1),('XAF','Communaute Financiere Africaine (BEAC) CFA Franc',NULL,1),('XCD','East Caribbean Dollar','[36]',1),('XEU','Ecus',NULL,0),('XOF','Communaute Financiere Africaine (BCEAO) Franc',NULL,1),('XPF','Franc pacifique (XPF)',NULL,1),('YER','Yemen Rial','[65020]',1),('ZAR','South Africa Rand','[82]',1),('ZWD','Zimbabwe Dollar','[90,36]',1); +/*!40000 ALTER TABLE `llx_c_currencies` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_c_departements` +-- + +DROP TABLE IF EXISTS `llx_c_departements`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_c_departements` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `code_departement` varchar(6) NOT NULL, + `fk_region` int(11) DEFAULT NULL, + `cheflieu` varchar(50) DEFAULT NULL, + `tncc` int(11) DEFAULT NULL, + `ncc` varchar(50) DEFAULT NULL, + `nom` varchar(50) DEFAULT NULL, + `active` tinyint(4) NOT NULL DEFAULT '1', + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_departements` (`code_departement`,`fk_region`), + KEY `idx_departements_fk_region` (`fk_region`), + CONSTRAINT `fk_departements_code_region` FOREIGN KEY (`fk_region`) REFERENCES `llx_c_regions` (`code_region`), + CONSTRAINT `fk_departements_fk_region` FOREIGN KEY (`fk_region`) REFERENCES `llx_c_regions` (`code_region`) +) ENGINE=InnoDB AUTO_INCREMENT=2049 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_c_departements` +-- + +LOCK TABLES `llx_c_departements` WRITE; +/*!40000 ALTER TABLE `llx_c_departements` DISABLE KEYS */; +INSERT INTO `llx_c_departements` VALUES (1,'0',0,'0',0,'-','-',1),(2,'01',82,'01053',5,'AIN','Ain',1),(3,'02',22,'02408',5,'AISNE','Aisne',1),(4,'03',83,'03190',5,'ALLIER','Allier',1),(5,'04',93,'04070',4,'ALPES-DE-HAUTE-PROVENCE','Alpes-de-Haute-Provence',1),(6,'05',93,'05061',4,'HAUTES-ALPES','Hautes-Alpes',1),(7,'06',93,'06088',4,'ALPES-MARITIMES','Alpes-Maritimes',1),(8,'07',82,'07186',5,'ARDECHE','Ardèche',1),(9,'08',21,'08105',4,'ARDENNES','Ardennes',1),(10,'09',73,'09122',5,'ARIEGE','Ariège',1),(11,'10',21,'10387',5,'AUBE','Aube',1),(12,'11',91,'11069',5,'AUDE','Aude',1),(13,'12',73,'12202',5,'AVEYRON','Aveyron',1),(14,'13',93,'13055',4,'BOUCHES-DU-RHONE','Bouches-du-Rhône',1),(15,'14',25,'14118',2,'CALVADOS','Calvados',1),(16,'15',83,'15014',2,'CANTAL','Cantal',1),(17,'16',54,'16015',3,'CHARENTE','Charente',1),(18,'17',54,'17300',3,'CHARENTE-MARITIME','Charente-Maritime',1),(19,'18',24,'18033',2,'CHER','Cher',1),(20,'19',74,'19272',3,'CORREZE','Corrèze',1),(21,'2A',94,'2A004',3,'CORSE-DU-SUD','Corse-du-Sud',1),(22,'2B',94,'2B033',3,'HAUTE-CORSE','Haute-Corse',1),(23,'21',26,'21231',3,'COTE-D\'OR','Côte-d\'Or',1),(24,'22',53,'22278',4,'COTES-D\'ARMOR','Côtes-d\'Armor',1),(25,'23',74,'23096',3,'CREUSE','Creuse',1),(26,'24',72,'24322',3,'DORDOGNE','Dordogne',1),(27,'25',43,'25056',2,'DOUBS','Doubs',1),(28,'26',82,'26362',3,'DROME','Drôme',1),(29,'27',23,'27229',5,'EURE','Eure',1),(30,'28',24,'28085',1,'EURE-ET-LOIR','Eure-et-Loir',1),(31,'29',53,'29232',2,'FINISTERE','Finistère',1),(32,'30',91,'30189',2,'GARD','Gard',1),(33,'31',73,'31555',3,'HAUTE-GARONNE','Haute-Garonne',1),(34,'32',73,'32013',2,'GERS','Gers',1),(35,'33',72,'33063',3,'GIRONDE','Gironde',1),(36,'34',91,'34172',5,'HERAULT','Hérault',1),(37,'35',53,'35238',1,'ILLE-ET-VILAINE','Ille-et-Vilaine',1),(38,'36',24,'36044',5,'INDRE','Indre',1),(39,'37',24,'37261',1,'INDRE-ET-LOIRE','Indre-et-Loire',1),(40,'38',82,'38185',5,'ISERE','Isère',1),(41,'39',43,'39300',2,'JURA','Jura',1),(42,'40',72,'40192',4,'LANDES','Landes',1),(43,'41',24,'41018',0,'LOIR-ET-CHER','Loir-et-Cher',1),(44,'42',82,'42218',3,'LOIRE','Loire',1),(45,'43',83,'43157',3,'HAUTE-LOIRE','Haute-Loire',1),(46,'44',52,'44109',3,'LOIRE-ATLANTIQUE','Loire-Atlantique',1),(47,'45',24,'45234',2,'LOIRET','Loiret',1),(48,'46',73,'46042',2,'LOT','Lot',1),(49,'47',72,'47001',0,'LOT-ET-GARONNE','Lot-et-Garonne',1),(50,'48',91,'48095',3,'LOZERE','Lozère',1),(51,'49',52,'49007',0,'MAINE-ET-LOIRE','Maine-et-Loire',1),(52,'50',25,'50502',3,'MANCHE','Manche',1),(53,'51',21,'51108',3,'MARNE','Marne',1),(54,'52',21,'52121',3,'HAUTE-MARNE','Haute-Marne',1),(55,'53',52,'53130',3,'MAYENNE','Mayenne',1),(56,'54',41,'54395',0,'MEURTHE-ET-MOSELLE','Meurthe-et-Moselle',1),(57,'55',41,'55029',3,'MEUSE','Meuse',1),(58,'56',53,'56260',2,'MORBIHAN','Morbihan',1),(59,'57',41,'57463',3,'MOSELLE','Moselle',1),(60,'58',26,'58194',3,'NIEVRE','Nièvre',1),(61,'59',31,'59350',2,'NORD','Nord',1),(62,'60',22,'60057',5,'OISE','Oise',1),(63,'61',25,'61001',5,'ORNE','Orne',1),(64,'62',31,'62041',2,'PAS-DE-CALAIS','Pas-de-Calais',1),(65,'63',83,'63113',2,'PUY-DE-DOME','Puy-de-Dôme',1),(66,'64',72,'64445',4,'PYRENEES-ATLANTIQUES','Pyrénées-Atlantiques',1),(67,'65',73,'65440',4,'HAUTES-PYRENEES','Hautes-Pyrénées',1),(68,'66',91,'66136',4,'PYRENEES-ORIENTALES','Pyrénées-Orientales',1),(69,'67',42,'67482',2,'BAS-RHIN','Bas-Rhin',1),(70,'68',42,'68066',2,'HAUT-RHIN','Haut-Rhin',1),(71,'69',82,'69123',2,'RHONE','Rhône',1),(72,'70',43,'70550',3,'HAUTE-SAONE','Haute-Saône',1),(73,'71',26,'71270',0,'SAONE-ET-LOIRE','Saône-et-Loire',1),(74,'72',52,'72181',3,'SARTHE','Sarthe',1),(75,'73',82,'73065',3,'SAVOIE','Savoie',1),(76,'74',82,'74010',3,'HAUTE-SAVOIE','Haute-Savoie',1),(77,'75',11,'75056',0,'PARIS','Paris',1),(78,'76',23,'76540',3,'SEINE-MARITIME','Seine-Maritime',1),(79,'77',11,'77288',0,'SEINE-ET-MARNE','Seine-et-Marne',1),(80,'78',11,'78646',4,'YVELINES','Yvelines',1),(81,'79',54,'79191',4,'DEUX-SEVRES','Deux-Sèvres',1),(82,'80',22,'80021',3,'SOMME','Somme',1),(83,'81',73,'81004',2,'TARN','Tarn',1),(84,'82',73,'82121',0,'TARN-ET-GARONNE','Tarn-et-Garonne',1),(85,'83',93,'83137',2,'VAR','Var',1),(86,'84',93,'84007',0,'VAUCLUSE','Vaucluse',1),(87,'85',52,'85191',3,'VENDEE','Vendée',1),(88,'86',54,'86194',3,'VIENNE','Vienne',1),(89,'87',74,'87085',3,'HAUTE-VIENNE','Haute-Vienne',1),(90,'88',41,'88160',4,'VOSGES','Vosges',1),(91,'89',26,'89024',5,'YONNE','Yonne',1),(92,'90',43,'90010',0,'TERRITOIRE DE BELFORT','Territoire de Belfort',1),(93,'91',11,'91228',5,'ESSONNE','Essonne',1),(94,'92',11,'92050',4,'HAUTS-DE-SEINE','Hauts-de-Seine',1),(95,'93',11,'93008',3,'SEINE-SAINT-DENIS','Seine-Saint-Denis',1),(96,'94',11,'94028',2,'VAL-DE-MARNE','Val-de-Marne',1),(97,'95',11,'95500',2,'VAL-D\'OISE','Val-d\'Oise',1),(98,'971',1,'97105',3,'GUADELOUPE','Guadeloupe',1),(99,'972',2,'97209',3,'MARTINIQUE','Martinique',1),(100,'973',3,'97302',3,'GUYANE','Guyane',1),(101,'974',4,'97411',3,'REUNION','Réunion',1),(102,'01',201,'',1,'ANVERS','Anvers',1),(103,'02',203,'',3,'BRUXELLES-CAPITALE','Bruxelles-Capitale',1),(104,'03',202,'',2,'BRABANT-WALLON','Brabant-Wallon',1),(105,'04',201,'',1,'BRABANT-FLAMAND','Brabant-Flamand',1),(106,'05',201,'',1,'FLANDRE-OCCIDENTALE','Flandre-Occidentale',1),(107,'06',201,'',1,'FLANDRE-ORIENTALE','Flandre-Orientale',1),(108,'07',202,'',2,'HAINAUT','Hainaut',1),(109,'08',201,'',2,'LIEGE','Liège',1),(110,'09',202,'',1,'LIMBOURG','Limbourg',1),(111,'10',202,'',2,'LUXEMBOURG','Luxembourg',1),(112,'11',201,'',2,'NAMUR','Namur',1),(113,'NSW',2801,'',1,'','New South Wales',1),(114,'VIC',2801,'',1,'','Victoria',1),(115,'QLD',2801,'',1,'','Queensland',1),(116,'SA',2801,'',1,'','South Australia',1),(117,'ACT',2801,'',1,'','Australia Capital Territory',1),(118,'TAS',2801,'',1,'','Tasmania',1),(119,'WA',2801,'',1,'','Western Australia',1),(120,'NT',2801,'',1,'','Northern Territory',1),(121,'VI',419,'',19,'ALAVA','Álava',1),(122,'AB',404,'',4,'ALBACETE','Albacete',1),(123,'A',411,'',11,'ALICANTE','Alicante',1),(124,'AL',401,'',1,'ALMERIA','Almería',1),(125,'AV',403,'',3,'AVILA','Avila',1),(126,'BA',412,'',12,'BADAJOZ','Badajoz',1),(127,'PM',414,'',14,'ISLAS BALEARES','Islas Baleares',1),(128,'B',406,'',6,'BARCELONA','Barcelona',1),(129,'BU',403,'',8,'BURGOS','Burgos',1),(130,'CC',412,'',12,'CACERES','Cáceres',1),(131,'CA',401,'',1,'CADIz','Cádiz',1),(132,'CS',411,'',11,'CASTELLON','Castellón',1),(133,'CR',404,'',4,'CIUDAD REAL','Ciudad Real',1),(134,'CO',401,'',1,'CORDOBA','Córdoba',1),(135,'C',413,'',13,'LA CORUÑA','La Coruña',1),(136,'CU',404,'',4,'CUENCA','Cuenca',1),(137,'GI',406,'',6,'GERONA','Gerona',1),(138,'GR',401,'',1,'GRANADA','Granada',1),(139,'GU',404,'',4,'GUADALAJARA','Guadalajara',1),(140,'SS',419,'',19,'GUIPUZCOA','Guipúzcoa',1),(141,'H',401,'',1,'HUELVA','Huelva',1),(142,'HU',402,'',2,'HUESCA','Huesca',1),(143,'J',401,'',1,'JAEN','Jaén',1),(144,'LE',403,'',3,'LEON','León',1),(145,'L',406,'',6,'LERIDA','Lérida',1),(146,'LO',415,'',15,'LA RIOJA','La Rioja',1),(147,'LU',413,'',13,'LUGO','Lugo',1),(148,'M',416,'',16,'MADRID','Madrid',1),(149,'MA',401,'',1,'MALAGA','Málaga',1),(150,'MU',417,'',17,'MURCIA','Murcia',1),(151,'NA',408,'',8,'NAVARRA','Navarra',1),(152,'OR',413,'',13,'ORENSE','Orense',1),(153,'O',418,'',18,'ASTURIAS','Asturias',1),(154,'P',403,'',3,'PALENCIA','Palencia',1),(155,'GC',405,'',5,'LAS PALMAS','Las Palmas',1),(156,'PO',413,'',13,'PONTEVEDRA','Pontevedra',1),(157,'SA',403,'',3,'SALAMANCA','Salamanca',1),(158,'TF',405,'',5,'STA. CRUZ DE TENERIFE','Sta. Cruz de Tenerife',1),(159,'S',410,'',10,'CANTABRIA','Cantabria',1),(160,'SG',403,'',3,'SEGOVIA','Segovia',1),(161,'SE',401,'',1,'SEVILLA','Sevilla',1),(162,'SO',403,'',3,'SORIA','Soria',1),(163,'T',406,'',6,'TARRAGONA','Tarragona',1),(164,'TE',402,'',2,'TERUEL','Teruel',1),(165,'TO',404,'',5,'TOLEDO','Toledo',1),(166,'V',411,'',11,'VALENCIA','Valencia',1),(167,'VA',403,'',3,'VALLADOLID','Valladolid',1),(168,'BI',419,'',19,'VIZCAYA','Vizcaya',1),(169,'ZA',403,'',3,'ZAMORA','Zamora',1),(170,'Z',402,'',1,'ZARAGOZA','Zaragoza',1),(171,'CE',407,'',7,'CEUTA','Ceuta',1),(172,'ML',409,'',9,'MELILLA','Melilla',1),(174,'AG',601,NULL,NULL,'ARGOVIE','Argovie',1),(175,'AI',601,NULL,NULL,'APPENZELL RHODES INTERIEURES','Appenzell Rhodes intérieures',1),(176,'AR',601,NULL,NULL,'APPENZELL RHODES EXTERIEURES','Appenzell Rhodes extérieures',1),(177,'BE',601,NULL,NULL,'BERNE','Berne',1),(178,'BL',601,NULL,NULL,'BALE CAMPAGNE','Bâle Campagne',1),(179,'BS',601,NULL,NULL,'BALE VILLE','Bâle Ville',1),(180,'FR',601,NULL,NULL,'FRIBOURG','Fribourg',1),(181,'GE',601,NULL,NULL,'GENEVE','Genève',1),(182,'GL',601,NULL,NULL,'GLARIS','Glaris',1),(183,'GR',601,NULL,NULL,'GRISONS','Grisons',1),(184,'JU',601,NULL,NULL,'JURA','Jura',1),(185,'LU',601,NULL,NULL,'LUCERNE','Lucerne',1),(186,'NE',601,NULL,NULL,'NEUCHATEL','Neuchâtel',1),(187,'NW',601,NULL,NULL,'NIDWALD','Nidwald',1),(188,'OW',601,NULL,NULL,'OBWALD','Obwald',1),(189,'SG',601,NULL,NULL,'SAINT-GALL','Saint-Gall',1),(190,'SH',601,NULL,NULL,'SCHAFFHOUSE','Schaffhouse',1),(191,'SO',601,NULL,NULL,'SOLEURE','Soleure',1),(192,'SZ',601,NULL,NULL,'SCHWYZ','Schwyz',1),(193,'TG',601,NULL,NULL,'THURGOVIE','Thurgovie',1),(194,'TI',601,NULL,NULL,'TESSIN','Tessin',1),(195,'UR',601,NULL,NULL,'URI','Uri',1),(196,'VD',601,NULL,NULL,'VAUD','Vaud',1),(197,'VS',601,NULL,NULL,'VALAIS','Valais',1),(198,'ZG',601,NULL,NULL,'ZUG','Zug',1),(199,'ZH',601,NULL,NULL,'ZURICH','Zürich',1),(200,'AL',1101,'',0,'ALABAMA','Alabama',1),(201,'AK',1101,'',0,'ALASKA','Alaska',1),(202,'AZ',1101,'',0,'ARIZONA','Arizona',1),(203,'AR',1101,'',0,'ARKANSAS','Arkansas',1),(204,'CA',1101,'',0,'CALIFORNIA','California',1),(205,'CO',1101,'',0,'COLORADO','Colorado',1),(206,'CT',1101,'',0,'CONNECTICUT','Connecticut',1),(207,'DE',1101,'',0,'DELAWARE','Delaware',1),(208,'FL',1101,'',0,'FLORIDA','Florida',1),(209,'GA',1101,'',0,'GEORGIA','Georgia',1),(210,'HI',1101,'',0,'HAWAII','Hawaii',1),(211,'ID',1101,'',0,'IDAHO','Idaho',1),(212,'IL',1101,'',0,'ILLINOIS','Illinois',1),(213,'IN',1101,'',0,'INDIANA','Indiana',1),(214,'IA',1101,'',0,'IOWA','Iowa',1),(215,'KS',1101,'',0,'KANSAS','Kansas',1),(216,'KY',1101,'',0,'KENTUCKY','Kentucky',1),(217,'LA',1101,'',0,'LOUISIANA','Louisiana',1),(218,'ME',1101,'',0,'MAINE','Maine',1),(219,'MD',1101,'',0,'MARYLAND','Maryland',1),(220,'MA',1101,'',0,'MASSACHUSSETTS','Massachusetts',1),(221,'MI',1101,'',0,'MICHIGAN','Michigan',1),(222,'MN',1101,'',0,'MINNESOTA','Minnesota',1),(223,'MS',1101,'',0,'MISSISSIPPI','Mississippi',1),(224,'MO',1101,'',0,'MISSOURI','Missouri',1),(225,'MT',1101,'',0,'MONTANA','Montana',1),(226,'NE',1101,'',0,'NEBRASKA','Nebraska',1),(227,'NV',1101,'',0,'NEVADA','Nevada',1),(228,'NH',1101,'',0,'NEW HAMPSHIRE','New Hampshire',1),(229,'NJ',1101,'',0,'NEW JERSEY','New Jersey',1),(230,'NM',1101,'',0,'NEW MEXICO','New Mexico',1),(231,'NY',1101,'',0,'NEW YORK','New York',1),(232,'NC',1101,'',0,'NORTH CAROLINA','North Carolina',1),(233,'ND',1101,'',0,'NORTH DAKOTA','North Dakota',1),(234,'OH',1101,'',0,'OHIO','Ohio',1),(235,'OK',1101,'',0,'OKLAHOMA','Oklahoma',1),(236,'OR',1101,'',0,'OREGON','Oregon',1),(237,'PA',1101,'',0,'PENNSYLVANIA','Pennsylvania',1),(238,'RI',1101,'',0,'RHODE ISLAND','Rhode Island',1),(239,'SC',1101,'',0,'SOUTH CAROLINA','South Carolina',1),(240,'SD',1101,'',0,'SOUTH DAKOTA','South Dakota',1),(241,'TN',1101,'',0,'TENNESSEE','Tennessee',1),(242,'TX',1101,'',0,'TEXAS','Texas',1),(243,'UT',1101,'',0,'UTAH','Utah',1),(244,'VT',1101,'',0,'VERMONT','Vermont',1),(245,'VA',1101,'',0,'VIRGINIA','Virginia',1),(246,'WA',1101,'',0,'WASHINGTON','Washington',1),(247,'WV',1101,'',0,'WEST VIRGINIA','West Virginia',1),(248,'WI',1101,'',0,'WISCONSIN','Wisconsin',1),(249,'WY',1101,'',0,'WYOMING','Wyoming',1),(250,'SS',8601,NULL,NULL,NULL,'San Salvador',1),(251,'SA',8603,NULL,NULL,NULL,'Santa Ana',1),(252,'AH',8603,NULL,NULL,NULL,'Ahuachapan',1),(253,'SO',8603,NULL,NULL,NULL,'Sonsonate',1),(254,'US',8602,NULL,NULL,NULL,'Usulutan',1),(255,'SM',8602,NULL,NULL,NULL,'San Miguel',1),(256,'MO',8602,NULL,NULL,NULL,'Morazan',1),(257,'LU',8602,NULL,NULL,NULL,'La Union',1),(258,'LL',8601,NULL,NULL,NULL,'La Libertad',1),(259,'CH',8601,NULL,NULL,NULL,'Chalatenango',1),(260,'CA',8601,NULL,NULL,NULL,'Cabañas',1),(261,'LP',8601,NULL,NULL,NULL,'La Paz',1),(262,'SV',8601,NULL,NULL,NULL,'San Vicente',1),(263,'CU',8601,NULL,NULL,NULL,'Cuscatlan',1),(264,'2301',2301,'',0,'CATAMARCA','Catamarca',1),(265,'2302',2301,'',0,'JUJUY','Jujuy',1),(266,'2303',2301,'',0,'TUCAMAN','Tucamán',1),(267,'2304',2301,'',0,'SANTIAGO DEL ESTERO','Santiago del Estero',1),(268,'2305',2301,'',0,'SALTA','Salta',1),(269,'2306',2302,'',0,'CHACO','Chaco',1),(270,'2307',2302,'',0,'CORRIENTES','Corrientes',1),(271,'2308',2302,'',0,'ENTRE RIOS','Entre Ríos',1),(272,'2309',2302,'',0,'FORMOSA','Formosa',1),(273,'2310',2302,'',0,'SANTA FE','Santa Fe',1),(274,'2311',2303,'',0,'LA RIOJA','La Rioja',1),(275,'2312',2303,'',0,'MENDOZA','Mendoza',1),(276,'2313',2303,'',0,'SAN JUAN','San Juan',1),(277,'2314',2303,'',0,'SAN LUIS','San Luis',1),(278,'2315',2304,'',0,'CORDOBA','Córdoba',1),(279,'2316',2304,'',0,'BUENOS AIRES','Buenos Aires',1),(280,'2317',2304,'',0,'CABA','Caba',1),(281,'2318',2305,'',0,'LA PAMPA','La Pampa',1),(282,'2319',2305,'',0,'NEUQUEN','Neuquén',1),(283,'2320',2305,'',0,'RIO NEGRO','Río Negro',1),(284,'2321',2305,'',0,'CHUBUT','Chubut',1),(285,'2322',2305,'',0,'SANTA CRUZ','Santa Cruz',1),(286,'2323',2305,'',0,'TIERRA DEL FUEGO','Tierra del Fuego',1),(287,'2324',2305,'',0,'ISLAS MALVINAS','Islas Malvinas',1),(288,'2325',2305,'',0,'ANTARTIDA','Antártida',1),(289,'AN',11701,NULL,0,'AN','Andaman & Nicobar',1),(290,'AP',11701,NULL,0,'AP','Andhra Pradesh',1),(291,'AR',11701,NULL,0,'AR','Arunachal Pradesh',1),(292,'AS',11701,NULL,0,'AS','Assam',1),(293,'BR',11701,NULL,0,'BR','Bihar',1),(294,'CG',11701,NULL,0,'CG','Chattisgarh',1),(295,'CH',11701,NULL,0,'CH','Chandigarh',1),(296,'DD',11701,NULL,0,'DD','Daman & Diu',1),(297,'DL',11701,NULL,0,'DL','Delhi',1),(298,'DN',11701,NULL,0,'DN','Dadra and Nagar Haveli',1),(299,'GA',11701,NULL,0,'GA','Goa',1),(300,'GJ',11701,NULL,0,'GJ','Gujarat',1),(301,'HP',11701,NULL,0,'HP','Himachal Pradesh',1),(302,'HR',11701,NULL,0,'HR','Haryana',1),(303,'JH',11701,NULL,0,'JH','Jharkhand',1),(304,'JK',11701,NULL,0,'JK','Jammu & Kashmir',1),(305,'KA',11701,NULL,0,'KA','Karnataka',1),(306,'KL',11701,NULL,0,'KL','Kerala',1),(307,'LD',11701,NULL,0,'LD','Lakshadweep',1),(308,'MH',11701,NULL,0,'MH','Maharashtra',1),(309,'ML',11701,NULL,0,'ML','Meghalaya',1),(310,'MN',11701,NULL,0,'MN','Manipur',1),(311,'MP',11701,NULL,0,'MP','Madhya Pradesh',1),(312,'MZ',11701,NULL,0,'MZ','Mizoram',1),(313,'NL',11701,NULL,0,'NL','Nagaland',1),(314,'OR',11701,NULL,0,'OR','Orissa',1),(315,'PB',11701,NULL,0,'PB','Punjab',1),(316,'PY',11701,NULL,0,'PY','Puducherry',1),(317,'RJ',11701,NULL,0,'RJ','Rajasthan',1),(318,'SK',11701,NULL,0,'SK','Sikkim',1),(319,'TN',11701,NULL,0,'TN','Tamil Nadu',1),(320,'TR',11701,NULL,0,'TR','Tripura',1),(321,'UL',11701,NULL,0,'UL','Uttarakhand',1),(322,'UP',11701,NULL,0,'UP','Uttar Pradesh',1),(323,'WB',11701,NULL,0,'WB','West Bengal',1),(374,'151',6715,'',0,'151','Arica',1),(375,'152',6715,'',0,'152','Parinacota',1),(376,'011',6701,'',0,'011','Iquique',1),(377,'014',6701,'',0,'014','Tamarugal',1),(378,'021',6702,'',0,'021','Antofagasa',1),(379,'022',6702,'',0,'022','El Loa',1),(380,'023',6702,'',0,'023','Tocopilla',1),(381,'031',6703,'',0,'031','Copiapó',1),(382,'032',6703,'',0,'032','Chañaral',1),(383,'033',6703,'',0,'033','Huasco',1),(384,'041',6704,'',0,'041','Elqui',1),(385,'042',6704,'',0,'042','Choapa',1),(386,'043',6704,'',0,'043','Limarí',1),(387,'051',6705,'',0,'051','Valparaíso',1),(388,'052',6705,'',0,'052','Isla de Pascua',1),(389,'053',6705,'',0,'053','Los Andes',1),(390,'054',6705,'',0,'054','Petorca',1),(391,'055',6705,'',0,'055','Quillota',1),(392,'056',6705,'',0,'056','San Antonio',1),(393,'057',6705,'',0,'057','San Felipe de Aconcagua',1),(394,'058',6705,'',0,'058','Marga Marga',1),(395,'061',6706,'',0,'061','Cachapoal',1),(396,'062',6706,'',0,'062','Cardenal Caro',1),(397,'063',6706,'',0,'063','Colchagua',1),(398,'071',6707,'',0,'071','Talca',1),(399,'072',6707,'',0,'072','Cauquenes',1),(400,'073',6707,'',0,'073','Curicó',1),(401,'074',6707,'',0,'074','Linares',1),(402,'081',6708,'',0,'081','Concepción',1),(403,'082',6708,'',0,'082','Arauco',1),(404,'083',6708,'',0,'083','Biobío',1),(405,'084',6708,'',0,'084','Ñuble',1),(406,'091',6709,'',0,'091','Cautín',1),(407,'092',6709,'',0,'092','Malleco',1),(408,'141',6714,'',0,'141','Valdivia',1),(409,'142',6714,'',0,'142','Ranco',1),(410,'101',6710,'',0,'101','Llanquihue',1),(411,'102',6710,'',0,'102','Chiloé',1),(412,'103',6710,'',0,'103','Osorno',1),(413,'104',6710,'',0,'104','Palena',1),(414,'111',6711,'',0,'111','Coihaique',1),(415,'112',6711,'',0,'112','Aisén',1),(416,'113',6711,'',0,'113','Capitán Prat',1),(417,'114',6711,'',0,'114','General Carrera',1),(418,'121',6712,'',0,'121','Magallanes',1),(419,'122',6712,'',0,'122','Antártica Chilena',1),(420,'123',6712,'',0,'123','Tierra del Fuego',1),(421,'124',6712,'',0,'124','Última Esperanza',1),(422,'131',6713,'',0,'131','Santiago',1),(423,'132',6713,'',0,'132','Cordillera',1),(424,'133',6713,'',0,'133','Chacabuco',1),(425,'134',6713,'',0,'134','Maipo',1),(426,'135',6713,'',0,'135','Melipilla',1),(427,'136',6713,'',0,'136','Talagante',1),(428,'DIF',15401,'',0,'DIF','Distrito Federal',1),(429,'AGS',15401,'',0,'AGS','Aguascalientes',1),(430,'BCN',15401,'',0,'BCN','Baja California Norte',1),(431,'BCS',15401,'',0,'BCS','Baja California Sur',1),(432,'CAM',15401,'',0,'CAM','Campeche',1),(433,'CHP',15401,'',0,'CHP','Chiapas',1),(434,'CHI',15401,'',0,'CHI','Chihuahua',1),(435,'COA',15401,'',0,'COA','Coahuila',1),(436,'COL',15401,'',0,'COL','Colima',1),(437,'DUR',15401,'',0,'DUR','Durango',1),(438,'GTO',15401,'',0,'GTO','Guanajuato',1),(439,'GRO',15401,'',0,'GRO','Guerrero',1),(440,'HGO',15401,'',0,'HGO','Hidalgo',1),(441,'JAL',15401,'',0,'JAL','Jalisco',1),(442,'MEX',15401,'',0,'MEX','México',1),(443,'MIC',15401,'',0,'MIC','Michoacán de Ocampo',1),(444,'MOR',15401,'',0,'MOR','Morelos',1),(445,'NAY',15401,'',0,'NAY','Nayarit',1),(446,'NLE',15401,'',0,'NLE','Nuevo León',1),(447,'OAX',15401,'',0,'OAX','Oaxaca',1),(448,'PUE',15401,'',0,'PUE','Puebla',1),(449,'QRO',15401,'',0,'QRO','Querétaro',1),(451,'ROO',15401,'',0,'ROO','Quintana Roo',1),(452,'SLP',15401,'',0,'SLP','San Luis Potosí',1),(453,'SIN',15401,'',0,'SIN','Sinaloa',1),(454,'SON',15401,'',0,'SON','Sonora',1),(455,'TAB',15401,'',0,'TAB','Tabasco',1),(456,'TAM',15401,'',0,'TAM','Tamaulipas',1),(457,'TLX',15401,'',0,'TLX','Tlaxcala',1),(458,'VER',15401,'',0,'VER','Veracruz',1),(459,'YUC',15401,'',0,'YUC','Yucatán',1),(460,'ZAC',15401,'',0,'ZAC','Zacatecas',1),(461,'ANT',7001,'',0,'ANT','Antioquia',1),(462,'BOL',7001,'',0,'BOL','Bolívar',1),(463,'BOY',7001,'',0,'BOY','Boyacá',1),(464,'CAL',7001,'',0,'CAL','Caldas',1),(465,'CAU',7001,'',0,'CAU','Cauca',1),(466,'CUN',7001,'',0,'CUN','Cundinamarca',1),(467,'HUI',7001,'',0,'HUI','Huila',1),(468,'LAG',7001,'',0,'LAG','La Guajira',1),(469,'MET',7001,'',0,'MET','Meta',1),(470,'NAR',7001,'',0,'NAR','Nariño',1),(471,'NDS',7001,'',0,'NDS','Norte de Santander',1),(472,'SAN',7001,'',0,'SAN','Santander',1),(473,'SUC',7001,'',0,'SUC','Sucre',1),(474,'TOL',7001,'',0,'TOL','Tolima',1),(475,'VAC',7001,'',0,'VAC','Valle del Cauca',1),(476,'RIS',7001,'',0,'RIS','Risalda',1),(477,'ATL',7001,'',0,'ATL','Atlántico',1),(478,'COR',7001,'',0,'COR','Córdoba',1),(479,'SAP',7001,'',0,'SAP','San Andrés, Providencia y Santa Catalina',1),(480,'ARA',7001,'',0,'ARA','Arauca',1),(481,'CAS',7001,'',0,'CAS','Casanare',1),(482,'AMA',7001,'',0,'AMA','Amazonas',1),(483,'CAQ',7001,'',0,'CAQ','Caquetá',1),(484,'CHO',7001,'',0,'CHO','Chocó',1),(485,'GUA',7001,'',0,'GUA','Guainía',1),(486,'GUV',7001,'',0,'GUV','Guaviare',1),(487,'PUT',7001,'',0,'PUT','Putumayo',1),(488,'QUI',7001,'',0,'QUI','Quindío',1),(489,'VAU',7001,'',0,'VAU','Vaupés',1),(490,'BOG',7001,'',0,'BOG','Bogotá',1),(491,'VID',7001,'',0,'VID','Vichada',1),(492,'CES',7001,'',0,'CES','Cesar',1),(493,'MAG',7001,'',0,'MAG','Magdalena',1),(494,'AT',11401,'',0,'AT','Atlántida',1),(495,'CH',11401,'',0,'CH','Choluteca',1),(496,'CL',11401,'',0,'CL','Colón',1),(497,'CM',11401,'',0,'CM','Comayagua',1),(498,'CO',11401,'',0,'CO','Copán',1),(499,'CR',11401,'',0,'CR','Cortés',1),(500,'EP',11401,'',0,'EP','El Paraíso',1),(501,'FM',11401,'',0,'FM','Francisco Morazán',1),(502,'GD',11401,'',0,'GD','Gracias a Dios',1),(503,'IN',11401,'',0,'IN','Intibucá',1),(504,'IB',11401,'',0,'IB','Islas de la Bahía',1),(505,'LP',11401,'',0,'LP','La Paz',1),(506,'LM',11401,'',0,'LM','Lempira',1),(507,'OC',11401,'',0,'OC','Ocotepeque',1),(508,'OL',11401,'',0,'OL','Olancho',1),(509,'SB',11401,'',0,'SB','Santa Bárbara',1),(510,'VL',11401,'',0,'VL','Valle',1),(511,'YO',11401,'',0,'YO','Yoro',1),(512,'DC',11401,'',0,'DC','Distrito Central',1),(652,'CC',4601,'Oistins',0,'CC','Christ Church',1),(655,'SA',4601,'Greenland',0,'SA','Saint Andrew',1),(656,'SG',4601,'Bulkeley',0,'SG','Saint George',1),(657,'JA',4601,'Holetown',0,'JA','Saint James',1),(658,'SJ',4601,'Four Roads',0,'SJ','Saint John',1),(659,'SB',4601,'Bathsheba',0,'SB','Saint Joseph',1),(660,'SL',4601,'Crab Hill',0,'SL','Saint Lucy',1),(661,'SM',4601,'Bridgetown',0,'SM','Saint Michael',1),(662,'SP',4601,'Speightstown',0,'SP','Saint Peter',1),(663,'SC',4601,'Crane',0,'SC','Saint Philip',1),(664,'ST',4601,'Hillaby',0,'ST','Saint Thomas',1),(777,'AG',315,NULL,NULL,NULL,'AGRIGENTO',1),(778,'AL',312,NULL,NULL,NULL,'ALESSANDRIA',1),(779,'AN',310,NULL,NULL,NULL,'ANCONA',1),(780,'AO',319,NULL,NULL,NULL,'AOSTA',1),(781,'AR',316,NULL,NULL,NULL,'AREZZO',1),(782,'AP',310,NULL,NULL,NULL,'ASCOLI PICENO',1),(783,'AT',312,NULL,NULL,NULL,'ASTI',1),(784,'AV',304,NULL,NULL,NULL,'AVELLINO',1),(785,'BA',313,NULL,NULL,NULL,'BARI',1),(786,'BT',313,NULL,NULL,NULL,'BARLETTA-ANDRIA-TRANI',1),(787,'BL',320,NULL,NULL,NULL,'BELLUNO',1),(788,'BN',304,NULL,NULL,NULL,'BENEVENTO',1),(789,'BG',309,NULL,NULL,NULL,'BERGAMO',1),(790,'BI',312,NULL,NULL,NULL,'BIELLA',1),(791,'BO',305,NULL,NULL,NULL,'BOLOGNA',1),(792,'BZ',317,NULL,NULL,NULL,'BOLZANO',1),(793,'BS',309,NULL,NULL,NULL,'BRESCIA',1),(794,'BR',313,NULL,NULL,NULL,'BRINDISI',1),(795,'CA',314,NULL,NULL,NULL,'CAGLIARI',1),(796,'CL',315,NULL,NULL,NULL,'CALTANISSETTA',1),(797,'CB',311,NULL,NULL,NULL,'CAMPOBASSO',1),(798,'CI',314,NULL,NULL,NULL,'CARBONIA-IGLESIAS',1),(799,'CE',304,NULL,NULL,NULL,'CASERTA',1),(800,'CT',315,NULL,NULL,NULL,'CATANIA',1),(801,'CZ',303,NULL,NULL,NULL,'CATANZARO',1),(802,'CH',301,NULL,NULL,NULL,'CHIETI',1),(803,'CO',309,NULL,NULL,NULL,'COMO',1),(804,'CS',303,NULL,NULL,NULL,'COSENZA',1),(805,'CR',309,NULL,NULL,NULL,'CREMONA',1),(806,'KR',303,NULL,NULL,NULL,'CROTONE',1),(807,'CN',312,NULL,NULL,NULL,'CUNEO',1),(808,'EN',315,NULL,NULL,NULL,'ENNA',1),(809,'FM',310,NULL,NULL,NULL,'FERMO',1),(810,'FE',305,NULL,NULL,NULL,'FERRARA',1),(811,'FI',316,NULL,NULL,NULL,'FIRENZE',1),(812,'FG',313,NULL,NULL,NULL,'FOGGIA',1),(813,'FC',305,NULL,NULL,NULL,'FORLI-CESENA',1),(814,'FR',307,NULL,NULL,NULL,'FROSINONE',1),(815,'GE',308,NULL,NULL,NULL,'GENOVA',1),(816,'GO',306,NULL,NULL,NULL,'GORIZIA',1),(817,'GR',316,NULL,NULL,NULL,'GROSSETO',1),(818,'IM',308,NULL,NULL,NULL,'IMPERIA',1),(819,'IS',311,NULL,NULL,NULL,'ISERNIA',1),(820,'SP',308,NULL,NULL,NULL,'LA SPEZIA',1),(821,'AQ',301,NULL,NULL,NULL,'L AQUILA',1),(822,'LT',307,NULL,NULL,NULL,'LATINA',1),(823,'LE',313,NULL,NULL,NULL,'LECCE',1),(824,'LC',309,NULL,NULL,NULL,'LECCO',1),(825,'LI',314,NULL,NULL,NULL,'LIVORNO',1),(826,'LO',309,NULL,NULL,NULL,'LODI',1),(827,'LU',316,NULL,NULL,NULL,'LUCCA',1),(828,'MC',310,NULL,NULL,NULL,'MACERATA',1),(829,'MN',309,NULL,NULL,NULL,'MANTOVA',1),(830,'MS',316,NULL,NULL,NULL,'MASSA-CARRARA',1),(831,'MT',302,NULL,NULL,NULL,'MATERA',1),(832,'VS',314,NULL,NULL,NULL,'MEDIO CAMPIDANO',1),(833,'ME',315,NULL,NULL,NULL,'MESSINA',1),(834,'MI',309,NULL,NULL,NULL,'MILANO',1),(835,'MB',309,NULL,NULL,NULL,'MONZA e BRIANZA',1),(836,'MO',305,NULL,NULL,NULL,'MODENA',1),(837,'NA',304,NULL,NULL,NULL,'NAPOLI',1),(838,'NO',312,NULL,NULL,NULL,'NOVARA',1),(839,'NU',314,NULL,NULL,NULL,'NUORO',1),(840,'OG',314,NULL,NULL,NULL,'OGLIASTRA',1),(841,'OT',314,NULL,NULL,NULL,'OLBIA-TEMPIO',1),(842,'OR',314,NULL,NULL,NULL,'ORISTANO',1),(843,'PD',320,NULL,NULL,NULL,'PADOVA',1),(844,'PA',315,NULL,NULL,NULL,'PALERMO',1),(845,'PR',305,NULL,NULL,NULL,'PARMA',1),(846,'PV',309,NULL,NULL,NULL,'PAVIA',1),(847,'PG',318,NULL,NULL,NULL,'PERUGIA',1),(848,'PU',310,NULL,NULL,NULL,'PESARO e URBINO',1),(849,'PE',301,NULL,NULL,NULL,'PESCARA',1),(850,'PC',305,NULL,NULL,NULL,'PIACENZA',1),(851,'PI',316,NULL,NULL,NULL,'PISA',1),(852,'PT',316,NULL,NULL,NULL,'PISTOIA',1),(853,'PN',306,NULL,NULL,NULL,'PORDENONE',1),(854,'PZ',302,NULL,NULL,NULL,'POTENZA',1),(855,'PO',316,NULL,NULL,NULL,'PRATO',1),(856,'RG',315,NULL,NULL,NULL,'RAGUSA',1),(857,'RA',305,NULL,NULL,NULL,'RAVENNA',1),(858,'RC',303,NULL,NULL,NULL,'REGGIO CALABRIA',1),(859,'RE',305,NULL,NULL,NULL,'REGGIO NELL EMILIA',1),(860,'RI',307,NULL,NULL,NULL,'RIETI',1),(861,'RN',305,NULL,NULL,NULL,'RIMINI',1),(862,'RM',307,NULL,NULL,NULL,'ROMA',1),(863,'RO',320,NULL,NULL,NULL,'ROVIGO',1),(864,'SA',304,NULL,NULL,NULL,'SALERNO',1),(865,'SS',314,NULL,NULL,NULL,'SASSARI',1),(866,'SV',308,NULL,NULL,NULL,'SAVONA',1),(867,'SI',316,NULL,NULL,NULL,'SIENA',1),(868,'SR',315,NULL,NULL,NULL,'SIRACUSA',1),(869,'SO',309,NULL,NULL,NULL,'SONDRIO',1),(870,'TA',313,NULL,NULL,NULL,'TARANTO',1),(871,'TE',301,NULL,NULL,NULL,'TERAMO',1),(872,'TR',318,NULL,NULL,NULL,'TERNI',1),(873,'TO',312,NULL,NULL,NULL,'TORINO',1),(874,'TP',315,NULL,NULL,NULL,'TRAPANI',1),(875,'TN',317,NULL,NULL,NULL,'TRENTO',1),(876,'TV',320,NULL,NULL,NULL,'TREVISO',1),(877,'TS',306,NULL,NULL,NULL,'TRIESTE',1),(878,'UD',306,NULL,NULL,NULL,'UDINE',1),(879,'VA',309,NULL,NULL,NULL,'VARESE',1),(880,'VE',320,NULL,NULL,NULL,'VENEZIA',1),(881,'VB',312,NULL,NULL,NULL,'VERBANO-CUSIO-OSSOLA',1),(882,'VC',312,NULL,NULL,NULL,'VERCELLI',1),(883,'VR',320,NULL,NULL,NULL,'VERONA',1),(884,'VV',303,NULL,NULL,NULL,'VIBO VALENTIA',1),(885,'VI',320,NULL,NULL,NULL,'VICENZA',1),(886,'VT',307,NULL,NULL,NULL,'VITERBO',1),(1036,'VE-L',23201,'',0,'VE-L','Mérida',1),(1037,'VE-T',23201,'',0,'VE-T','Trujillo',1),(1038,'VE-E',23201,'',0,'VE-E','Barinas',1),(1039,'VE-M',23202,'',0,'VE-M','Miranda',1),(1040,'VE-W',23202,'',0,'VE-W','Vargas',1),(1041,'VE-A',23202,'',0,'VE-A','Distrito Capital',1),(1042,'VE-D',23203,'',0,'VE-D','Aragua',1),(1043,'VE-G',23203,'',0,'VE-G','Carabobo',1),(1044,'VE-I',23204,'',0,'VE-I','Falcón',1),(1045,'VE-K',23204,'',0,'VE-K','Lara',1),(1046,'VE-U',23204,'',0,'VE-U','Yaracuy',1),(1047,'VE-F',23205,'',0,'VE-F','Bolívar',1),(1048,'VE-X',23205,'',0,'VE-X','Amazonas',1),(1049,'VE-Y',23205,'',0,'VE-Y','Delta Amacuro',1),(1050,'VE-O',23206,'',0,'VE-O','Nueva Esparta',1),(1051,'VE-Z',23206,'',0,'VE-Z','Dependencias Federales',1),(1052,'VE-C',23207,'',0,'VE-C','Apure',1),(1053,'VE-J',23207,'',0,'VE-J','Guárico',1),(1054,'VE-H',23207,'',0,'VE-H','Cojedes',1),(1055,'VE-P',23207,'',0,'VE-P','Portuguesa',1),(1056,'VE-B',23208,'',0,'VE-B','Anzoátegui',1),(1057,'VE-N',23208,'',0,'VE-N','Monagas',1),(1058,'VE-R',23208,'',0,'VE-R','Sucre',1),(1059,'VE-V',23209,'',0,'VE-V','Zulia',1),(1060,'VE-S',23209,'',0,'VE-S','Táchira',1),(1061,'66',10201,NULL,NULL,NULL,'?????',1),(1062,'00',10205,NULL,NULL,NULL,'?????',1),(1063,'01',10205,NULL,NULL,NULL,'?????',1),(1064,'02',10205,NULL,NULL,NULL,'?????',1),(1065,'03',10205,NULL,NULL,NULL,'??????',1),(1066,'04',10205,NULL,NULL,NULL,'?????',1),(1067,'05',10205,NULL,NULL,NULL,'??????',1),(1068,'06',10203,NULL,NULL,NULL,'??????',1),(1069,'07',10203,NULL,NULL,NULL,'???????????',1),(1070,'08',10203,NULL,NULL,NULL,'??????',1),(1071,'09',10203,NULL,NULL,NULL,'?????',1),(1072,'10',10203,NULL,NULL,NULL,'??????',1),(1073,'11',10203,NULL,NULL,NULL,'??????',1),(1074,'12',10203,NULL,NULL,NULL,'?????????',1),(1075,'13',10206,NULL,NULL,NULL,'????',1),(1076,'14',10206,NULL,NULL,NULL,'?????????',1),(1077,'15',10206,NULL,NULL,NULL,'????????',1),(1078,'16',10206,NULL,NULL,NULL,'???????',1),(1079,'17',10213,NULL,NULL,NULL,'???????',1),(1080,'18',10213,NULL,NULL,NULL,'????????',1),(1081,'19',10213,NULL,NULL,NULL,'??????',1),(1082,'20',10213,NULL,NULL,NULL,'???????',1),(1083,'21',10212,NULL,NULL,NULL,'????????',1),(1084,'22',10212,NULL,NULL,NULL,'??????',1),(1085,'23',10212,NULL,NULL,NULL,'????????',1),(1086,'24',10212,NULL,NULL,NULL,'???????',1),(1087,'25',10212,NULL,NULL,NULL,'????????',1),(1088,'26',10212,NULL,NULL,NULL,'???????',1),(1089,'27',10202,NULL,NULL,NULL,'??????',1),(1090,'28',10202,NULL,NULL,NULL,'?????????',1),(1091,'29',10202,NULL,NULL,NULL,'????????',1),(1092,'30',10202,NULL,NULL,NULL,'??????',1),(1093,'31',10209,NULL,NULL,NULL,'????????',1),(1094,'32',10209,NULL,NULL,NULL,'???????',1),(1095,'33',10209,NULL,NULL,NULL,'????????',1),(1096,'34',10209,NULL,NULL,NULL,'???????',1),(1097,'35',10209,NULL,NULL,NULL,'????????',1),(1098,'36',10211,NULL,NULL,NULL,'???????????????',1),(1099,'37',10211,NULL,NULL,NULL,'?????',1),(1100,'38',10211,NULL,NULL,NULL,'?????',1),(1101,'39',10207,NULL,NULL,NULL,'????????',1),(1102,'40',10207,NULL,NULL,NULL,'???????',1),(1103,'41',10207,NULL,NULL,NULL,'??????????',1),(1104,'42',10207,NULL,NULL,NULL,'?????',1),(1105,'43',10207,NULL,NULL,NULL,'???????',1),(1106,'44',10208,NULL,NULL,NULL,'??????',1),(1107,'45',10208,NULL,NULL,NULL,'??????',1),(1108,'46',10208,NULL,NULL,NULL,'??????',1),(1109,'47',10208,NULL,NULL,NULL,'?????',1),(1110,'48',10208,NULL,NULL,NULL,'????',1),(1111,'49',10210,NULL,NULL,NULL,'??????',1),(1112,'50',10210,NULL,NULL,NULL,'????',1),(1113,'51',10210,NULL,NULL,NULL,'????????',1),(1114,'52',10210,NULL,NULL,NULL,'????????',1),(1115,'53',10210,NULL,NULL,NULL,'???-??????',1),(1116,'54',10210,NULL,NULL,NULL,'??',1),(1117,'55',10210,NULL,NULL,NULL,'?????',1),(1118,'56',10210,NULL,NULL,NULL,'???????',1),(1119,'57',10210,NULL,NULL,NULL,'?????',1),(1120,'58',10210,NULL,NULL,NULL,'?????',1),(1121,'59',10210,NULL,NULL,NULL,'?????',1),(1122,'60',10210,NULL,NULL,NULL,'?????',1),(1123,'61',10210,NULL,NULL,NULL,'?????',1),(1124,'62',10204,NULL,NULL,NULL,'????????',1),(1125,'63',10204,NULL,NULL,NULL,'??????',1),(1126,'64',10204,NULL,NULL,NULL,'???????',1),(1127,'65',10204,NULL,NULL,NULL,'?????',1),(1128,'AL01',1301,'',0,'','Wilaya d\'Adrar',1),(1129,'AL02',1301,'',0,'','Wilaya de Chlef',1),(1130,'AL03',1301,'',0,'','Wilaya de Laghouat',1),(1131,'AL04',1301,'',0,'','Wilaya d\'Oum El Bouaghi',1),(1132,'AL05',1301,'',0,'','Wilaya de Batna',1),(1133,'AL06',1301,'',0,'','Wilaya de Béjaïa',1),(1134,'AL07',1301,'',0,'','Wilaya de Biskra',1),(1135,'AL08',1301,'',0,'','Wilaya de Béchar',1),(1136,'AL09',1301,'',0,'','Wilaya de Blida',1),(1137,'AL11',1301,'',0,'','Wilaya de Bouira',1),(1138,'AL12',1301,'',0,'','Wilaya de Tamanrasset',1),(1139,'AL13',1301,'',0,'','Wilaya de Tébessa',1),(1140,'AL14',1301,'',0,'','Wilaya de Tlemcen',1),(1141,'AL15',1301,'',0,'','Wilaya de Tiaret',1),(1142,'AL16',1301,'',0,'','Wilaya de Tizi Ouzou',1),(1143,'AL17',1301,'',0,'','Wilaya d\'Alger',1),(1144,'AL18',1301,'',0,'','Wilaya de Djelfa',1),(1145,'AL19',1301,'',0,'','Wilaya de Jijel',1),(1146,'AL20',1301,'',0,'','Wilaya de Sétif ',1),(1147,'AL21',1301,'',0,'','Wilaya de Saïda',1),(1148,'AL22',1301,'',0,'','Wilaya de Skikda',1),(1149,'AL23',1301,'',0,'','Wilaya de Sidi Bel Abbès',1),(1150,'AL24',1301,'',0,'','Wilaya d\'Annaba',1),(1151,'AL25',1301,'',0,'','Wilaya de Guelma',1),(1152,'AL26',1301,'',0,'','Wilaya de Constantine',1),(1153,'AL27',1301,'',0,'','Wilaya de Médéa',1),(1154,'AL28',1301,'',0,'','Wilaya de Mostaganem',1),(1155,'AL29',1301,'',0,'','Wilaya de M\'Sila',1),(1156,'AL30',1301,'',0,'','Wilaya de Mascara',1),(1157,'AL31',1301,'',0,'','Wilaya d\'Ouargla',1),(1158,'AL32',1301,'',0,'','Wilaya d\'Oran',1),(1159,'AL33',1301,'',0,'','Wilaya d\'El Bayadh',1),(1160,'AL34',1301,'',0,'','Wilaya d\'Illizi',1),(1161,'AL35',1301,'',0,'','Wilaya de Bordj Bou Arreridj',1),(1162,'AL36',1301,'',0,'','Wilaya de Boumerdès',1),(1163,'AL37',1301,'',0,'','Wilaya d\'El Tarf',1),(1164,'AL38',1301,'',0,'','Wilaya de Tindouf',1),(1165,'AL39',1301,'',0,'','Wilaya de Tissemsilt',1),(1166,'AL40',1301,'',0,'','Wilaya d\'El Oued',1),(1167,'AL41',1301,'',0,'','Wilaya de Khenchela',1),(1168,'AL42',1301,'',0,'','Wilaya de Souk Ahras',1),(1169,'AL43',1301,'',0,'','Wilaya de Tipaza',1),(1170,'AL44',1301,'',0,'','Wilaya de Mila',1),(1171,'AL45',1301,'',0,'','Wilaya d\'Aïn Defla',1),(1172,'AL46',1301,'',0,'','Wilaya de Naâma',1),(1173,'AL47',1301,'',0,'','Wilaya d\'Aïn Témouchent',1),(1174,'AL48',1301,'',0,'','Wilaya de Ghardaia',1),(1175,'AL49',1301,'',0,'','Wilaya de Relizane',1),(1176,'MA',1209,'',0,'','Province de Benslimane',1),(1177,'MA1',1209,'',0,'','Province de Berrechid',1),(1178,'MA2',1209,'',0,'','Province de Khouribga',1),(1179,'MA3',1209,'',0,'','Province de Settat',1),(1180,'MA4',1210,'',0,'','Province d\'El Jadida',1),(1181,'MA5',1210,'',0,'','Province de Safi',1),(1182,'MA6',1210,'',0,'','Province de Sidi Bennour',1),(1183,'MA7',1210,'',0,'','Province de Youssoufia',1),(1184,'MA6B',1205,'',0,'','Préfecture de Fès',1),(1185,'MA7B',1205,'',0,'','Province de Boulemane',1),(1186,'MA8',1205,'',0,'','Province de Moulay Yacoub',1),(1187,'MA9',1205,'',0,'','Province de Sefrou',1),(1188,'MA8A',1202,'',0,'','Province de Kénitra',1),(1189,'MA9A',1202,'',0,'','Province de Sidi Kacem',1),(1190,'MA10',1202,'',0,'','Province de Sidi Slimane',1),(1191,'MA11',1208,'',0,'','Préfecture de Casablanca',1),(1192,'MA12',1208,'',0,'','Préfecture de Mohammédia',1),(1193,'MA13',1208,'',0,'','Province de Médiouna',1),(1194,'MA14',1208,'',0,'','Province de Nouaceur',1),(1195,'MA15',1214,'',0,'','Province d\'Assa-Zag',1),(1196,'MA16',1214,'',0,'','Province d\'Es-Semara',1),(1197,'MA17A',1214,'',0,'','Province de Guelmim',1),(1198,'MA18',1214,'',0,'','Province de Tata',1),(1199,'MA19',1214,'',0,'','Province de Tan-Tan',1),(1200,'MA15',1215,'',0,'','Province de Boujdour',1),(1201,'MA16',1215,'',0,'','Province de Lâayoune',1),(1202,'MA17',1215,'',0,'','Province de Tarfaya',1),(1203,'MA18',1211,'',0,'','Préfecture de Marrakech',1),(1204,'MA19',1211,'',0,'','Province d\'Al Haouz',1),(1205,'MA20',1211,'',0,'','Province de Chichaoua',1),(1206,'MA21',1211,'',0,'','Province d\'El Kelâa des Sraghna',1),(1207,'MA22',1211,'',0,'','Province d\'Essaouira',1),(1208,'MA23',1211,'',0,'','Province de Rehamna',1),(1209,'MA24',1206,'',0,'','Préfecture de Meknès',1),(1210,'MA25',1206,'',0,'','Province d’El Hajeb',1),(1211,'MA26',1206,'',0,'','Province d\'Errachidia',1),(1212,'MA27',1206,'',0,'','Province d’Ifrane',1),(1213,'MA28',1206,'',0,'','Province de Khénifra',1),(1214,'MA29',1206,'',0,'','Province de Midelt',1),(1215,'MA30',1204,'',0,'','Préfecture d\'Oujda-Angad',1),(1216,'MA31',1204,'',0,'','Province de Berkane',1),(1217,'MA32',1204,'',0,'','Province de Driouch',1),(1218,'MA33',1204,'',0,'','Province de Figuig',1),(1219,'MA34',1204,'',0,'','Province de Jerada',1),(1220,'MA35',1204,'',0,'','Province de Nadorgg',1),(1221,'MA36',1204,'',0,'','Province de Taourirt',1),(1222,'MA37',1216,'',0,'','Province d\'Aousserd',1),(1223,'MA38',1216,'',0,'','Province d\'Oued Ed-Dahab',1),(1224,'MA39',1207,'',0,'','Préfecture de Rabat',1),(1225,'MA40',1207,'',0,'','Préfecture de Skhirat-Témara',1),(1226,'MA41',1207,'',0,'','Préfecture de Salé',1),(1227,'MA42',1207,'',0,'','Province de Khémisset',1),(1228,'MA43',1213,'',0,'','Préfecture d\'Agadir Ida-Outanane',1),(1229,'MA44',1213,'',0,'','Préfecture d\'Inezgane-Aït Melloul',1),(1230,'MA45',1213,'',0,'','Province de Chtouka-Aït Baha',1),(1231,'MA46',1213,'',0,'','Province d\'Ouarzazate',1),(1232,'MA47',1213,'',0,'','Province de Sidi Ifni',1),(1233,'MA48',1213,'',0,'','Province de Taroudant',1),(1234,'MA49',1213,'',0,'','Province de Tinghir',1),(1235,'MA50',1213,'',0,'','Province de Tiznit',1),(1236,'MA51',1213,'',0,'','Province de Zagora',1),(1237,'MA52',1212,'',0,'','Province d\'Azilal',1),(1238,'MA53',1212,'',0,'','Province de Beni Mellal',1),(1239,'MA54',1212,'',0,'','Province de Fquih Ben Salah',1),(1240,'MA55',1201,'',0,'','Préfecture de M\'diq-Fnideq',1),(1241,'MA56',1201,'',0,'','Préfecture de Tanger-Asilah',1),(1242,'MA57',1201,'',0,'','Province de Chefchaouen',1),(1243,'MA58',1201,'',0,'','Province de Fahs-Anjra',1),(1244,'MA59',1201,'',0,'','Province de Larache',1),(1245,'MA60',1201,'',0,'','Province d\'Ouezzane',1),(1246,'MA61',1201,'',0,'','Province de Tétouan',1),(1247,'MA62',1203,'',0,'','Province de Guercif',1),(1248,'MA63',1203,'',0,'','Province d\'Al Hoceïma',1),(1249,'MA64',1203,'',0,'','Province de Taounate',1),(1250,'MA65',1203,'',0,'','Province de Taza',1),(1251,'MA6A',1205,'',0,'','Préfecture de Fès',1),(1252,'MA7A',1205,'',0,'','Province de Boulemane',1),(1253,'MA15A',1214,'',0,'','Province d\'Assa-Zag',1),(1254,'MA16A',1214,'',0,'','Province d\'Es-Semara',1),(1255,'MA18A',1211,'',0,'','Préfecture de Marrakech',1),(1256,'MA19A',1214,'',0,'','Province de Tan-Tan',1),(1257,'MA19B',1214,'',0,'','Province de Tan-Tan',1),(1258,'TN01',1001,'',0,'','Ariana',1),(1259,'TN02',1001,'',0,'','Béja',1),(1260,'TN03',1001,'',0,'','Ben Arous',1),(1261,'TN04',1001,'',0,'','Bizerte',1),(1262,'TN05',1001,'',0,'','Gabès',1),(1263,'TN06',1001,'',0,'','Gafsa',1),(1264,'TN07',1001,'',0,'','Jendouba',1),(1265,'TN08',1001,'',0,'','Kairouan',1),(1266,'TN09',1001,'',0,'','Kasserine',1),(1267,'TN10',1001,'',0,'','Kébili',1),(1268,'TN11',1001,'',0,'','La Manouba',1),(1269,'TN12',1001,'',0,'','Le Kef',1),(1270,'TN13',1001,'',0,'','Mahdia',1),(1271,'TN14',1001,'',0,'','Médenine',1),(1272,'TN15',1001,'',0,'','Monastir',1),(1273,'TN16',1001,'',0,'','Nabeul',1),(1274,'TN17',1001,'',0,'','Sfax',1),(1275,'TN18',1001,'',0,'','Sidi Bouzid',1),(1276,'TN19',1001,'',0,'','Siliana',1),(1277,'TN20',1001,'',0,'','Sousse',1),(1278,'TN21',1001,'',0,'','Tataouine',1),(1279,'TN22',1001,'',0,'','Tozeur',1),(1280,'TN23',1001,'',0,'','Tunis',1),(1281,'TN24',1001,'',0,'','Zaghouan',1),(1287,'976',6,'97601',3,'MAYOTTE','Mayotte',1),(1513,'ON',1401,'',1,'','Ontario',1),(1514,'QC',1401,'',1,'','Quebec',1),(1515,'NS',1401,'',1,'','Nova Scotia',1),(1516,'NB',1401,'',1,'','New Brunswick',1),(1517,'MB',1401,'',1,'','Manitoba',1),(1518,'BC',1401,'',1,'','British Columbia',1),(1519,'PE',1401,'',1,'','Prince Edward Island',1),(1520,'SK',1401,'',1,'','Saskatchewan',1),(1521,'AB',1401,'',1,'','Alberta',1),(1522,'NL',1401,'',1,'','Newfoundland and Labrador',1),(1575,'BW',501,NULL,NULL,'BADEN-WÜRTTEMBERG','Baden-Württemberg',1),(1576,'BY',501,NULL,NULL,'BAYERN','Bayern',1),(1577,'BE',501,NULL,NULL,'BERLIN','Berlin',1),(1578,'BB',501,NULL,NULL,'BRANDENBURG','Brandenburg',1),(1579,'HB',501,NULL,NULL,'BREMEN','Bremen',1),(1580,'HH',501,NULL,NULL,'HAMBURG','Hamburg',1),(1581,'HE',501,NULL,NULL,'HESSEN','Hessen',1),(1582,'MV',501,NULL,NULL,'MECKLENBURG-VORPOMMERN','Mecklenburg-Vorpommern',1),(1583,'NI',501,NULL,NULL,'NIEDERSACHSEN','Niedersachsen',1),(1584,'NW',501,NULL,NULL,'NORDRHEIN-WESTFALEN','Nordrhein-Westfalen',1),(1585,'RP',501,NULL,NULL,'RHEINLAND-PFALZ','Rheinland-Pfalz',1),(1586,'SL',501,NULL,NULL,'SAARLAND','Saarland',1),(1587,'SN',501,NULL,NULL,'SACHSEN','Sachsen',1),(1588,'ST',501,NULL,NULL,'SACHSEN-ANHALT','Sachsen-Anhalt',1),(1589,'SH',501,NULL,NULL,'SCHLESWIG-HOLSTEIN','Schleswig-Holstein',1),(1590,'TH',501,NULL,NULL,'THÜRINGEN','Thüringen',1),(1592,'67',10205,'',0,'','Δράμα',1),(1684,'701',701,NULL,0,NULL,'Bedfordshire',1),(1685,'702',701,NULL,0,NULL,'Berkshire',1),(1686,'703',701,NULL,0,NULL,'Bristol, City of',1),(1687,'704',701,NULL,0,NULL,'Buckinghamshire',1),(1688,'705',701,NULL,0,NULL,'Cambridgeshire',1),(1689,'706',701,NULL,0,NULL,'Cheshire',1),(1690,'707',701,NULL,0,NULL,'Cleveland',1),(1691,'708',701,NULL,0,NULL,'Cornwall',1),(1692,'709',701,NULL,0,NULL,'Cumberland',1),(1693,'710',701,NULL,0,NULL,'Cumbria',1),(1694,'711',701,NULL,0,NULL,'Derbyshire',1),(1695,'712',701,NULL,0,NULL,'Devon',1),(1696,'713',701,NULL,0,NULL,'Dorset',1),(1697,'714',701,NULL,0,NULL,'Co. Durham',1),(1698,'715',701,NULL,0,NULL,'East Riding of Yorkshire',1),(1699,'716',701,NULL,0,NULL,'East Sussex',1),(1700,'717',701,NULL,0,NULL,'Essex',1),(1701,'718',701,NULL,0,NULL,'Gloucestershire',1),(1702,'719',701,NULL,0,NULL,'Greater Manchester',1),(1703,'720',701,NULL,0,NULL,'Hampshire',1),(1704,'721',701,NULL,0,NULL,'Hertfordshire',1),(1705,'722',701,NULL,0,NULL,'Hereford and Worcester',1),(1706,'723',701,NULL,0,NULL,'Herefordshire',1),(1707,'724',701,NULL,0,NULL,'Huntingdonshire',1),(1708,'725',701,NULL,0,NULL,'Isle of Man',1),(1709,'726',701,NULL,0,NULL,'Isle of Wight',1),(1710,'727',701,NULL,0,NULL,'Jersey',1),(1711,'728',701,NULL,0,NULL,'Kent',1),(1712,'729',701,NULL,0,NULL,'Lancashire',1),(1713,'730',701,NULL,0,NULL,'Leicestershire',1),(1714,'731',701,NULL,0,NULL,'Lincolnshire',1),(1715,'732',701,NULL,0,NULL,'London - City of London',1),(1716,'733',701,NULL,0,NULL,'Merseyside',1),(1717,'734',701,NULL,0,NULL,'Middlesex',1),(1718,'735',701,NULL,0,NULL,'Norfolk',1),(1719,'736',701,NULL,0,NULL,'North Yorkshire',1),(1720,'737',701,NULL,0,NULL,'North Riding of Yorkshire',1),(1721,'738',701,NULL,0,NULL,'Northamptonshire',1),(1722,'739',701,NULL,0,NULL,'Northumberland',1),(1723,'740',701,NULL,0,NULL,'Nottinghamshire',1),(1724,'741',701,NULL,0,NULL,'Oxfordshire',1),(1725,'742',701,NULL,0,NULL,'Rutland',1),(1726,'743',701,NULL,0,NULL,'Shropshire',1),(1727,'744',701,NULL,0,NULL,'Somerset',1),(1728,'745',701,NULL,0,NULL,'Staffordshire',1),(1729,'746',701,NULL,0,NULL,'Suffolk',1),(1730,'747',701,NULL,0,NULL,'Surrey',1),(1731,'748',701,NULL,0,NULL,'Sussex',1),(1732,'749',701,NULL,0,NULL,'Tyne and Wear',1),(1733,'750',701,NULL,0,NULL,'Warwickshire',1),(1734,'751',701,NULL,0,NULL,'West Midlands',1),(1735,'752',701,NULL,0,NULL,'West Sussex',1),(1736,'753',701,NULL,0,NULL,'West Yorkshire',1),(1737,'754',701,NULL,0,NULL,'West Riding of Yorkshire',1),(1738,'755',701,NULL,0,NULL,'Wiltshire',1),(1739,'756',701,NULL,0,NULL,'Worcestershire',1),(1740,'757',701,NULL,0,NULL,'Yorkshire',1),(1741,'758',702,NULL,0,NULL,'Anglesey',1),(1742,'759',702,NULL,0,NULL,'Breconshire',1),(1743,'760',702,NULL,0,NULL,'Caernarvonshire',1),(1744,'761',702,NULL,0,NULL,'Cardiganshire',1),(1745,'762',702,NULL,0,NULL,'Carmarthenshire',1),(1746,'763',702,NULL,0,NULL,'Ceredigion',1),(1747,'764',702,NULL,0,NULL,'Denbighshire',1),(1748,'765',702,NULL,0,NULL,'Flintshire',1),(1749,'766',702,NULL,0,NULL,'Glamorgan',1),(1750,'767',702,NULL,0,NULL,'Gwent',1),(1751,'768',702,NULL,0,NULL,'Gwynedd',1),(1752,'769',702,NULL,0,NULL,'Merionethshire',1),(1753,'770',702,NULL,0,NULL,'Monmouthshire',1),(1754,'771',702,NULL,0,NULL,'Mid Glamorgan',1),(1755,'772',702,NULL,0,NULL,'Montgomeryshire',1),(1756,'773',702,NULL,0,NULL,'Pembrokeshire',1),(1757,'774',702,NULL,0,NULL,'Powys',1),(1758,'775',702,NULL,0,NULL,'Radnorshire',1),(1759,'776',702,NULL,0,NULL,'South Glamorgan',1),(1760,'777',703,NULL,0,NULL,'Aberdeen, City of',1),(1761,'778',703,NULL,0,NULL,'Angus',1),(1762,'779',703,NULL,0,NULL,'Argyll',1),(1763,'780',703,NULL,0,NULL,'Ayrshire',1),(1764,'781',703,NULL,0,NULL,'Banffshire',1),(1765,'782',703,NULL,0,NULL,'Berwickshire',1),(1766,'783',703,NULL,0,NULL,'Bute',1),(1767,'784',703,NULL,0,NULL,'Caithness',1),(1768,'785',703,NULL,0,NULL,'Clackmannanshire',1),(1769,'786',703,NULL,0,NULL,'Dumfriesshire',1),(1770,'787',703,NULL,0,NULL,'Dumbartonshire',1),(1771,'788',703,NULL,0,NULL,'Dundee, City of',1),(1772,'789',703,NULL,0,NULL,'East Lothian',1),(1773,'790',703,NULL,0,NULL,'Fife',1),(1774,'791',703,NULL,0,NULL,'Inverness',1),(1775,'792',703,NULL,0,NULL,'Kincardineshire',1),(1776,'793',703,NULL,0,NULL,'Kinross-shire',1),(1777,'794',703,NULL,0,NULL,'Kirkcudbrightshire',1),(1778,'795',703,NULL,0,NULL,'Lanarkshire',1),(1779,'796',703,NULL,0,NULL,'Midlothian',1),(1780,'797',703,NULL,0,NULL,'Morayshire',1),(1781,'798',703,NULL,0,NULL,'Nairnshire',1),(1782,'799',703,NULL,0,NULL,'Orkney',1),(1783,'800',703,NULL,0,NULL,'Peebleshire',1),(1784,'801',703,NULL,0,NULL,'Perthshire',1),(1785,'802',703,NULL,0,NULL,'Renfrewshire',1),(1786,'803',703,NULL,0,NULL,'Ross & Cromarty',1),(1787,'804',703,NULL,0,NULL,'Roxburghshire',1),(1788,'805',703,NULL,0,NULL,'Selkirkshire',1),(1789,'806',703,NULL,0,NULL,'Shetland',1),(1790,'807',703,NULL,0,NULL,'Stirlingshire',1),(1791,'808',703,NULL,0,NULL,'Sutherland',1),(1792,'809',703,NULL,0,NULL,'West Lothian',1),(1793,'810',703,NULL,0,NULL,'Wigtownshire',1),(1794,'811',704,NULL,0,NULL,'Antrim',1),(1795,'812',704,NULL,0,NULL,'Armagh',1),(1796,'813',704,NULL,0,NULL,'Co. Down',1),(1797,'814',704,NULL,0,NULL,'Co. Fermanagh',1),(1798,'815',704,NULL,0,NULL,'Co. Londonderry',1),(1849,'GR',1701,NULL,NULL,NULL,'Groningen',1),(1850,'FR',1701,NULL,NULL,NULL,'Friesland',1),(1851,'DR',1701,NULL,NULL,NULL,'Drenthe',1),(1852,'OV',1701,NULL,NULL,NULL,'Overijssel',1),(1853,'GD',1701,NULL,NULL,NULL,'Gelderland',1),(1854,'FL',1701,NULL,NULL,NULL,'Flevoland',1),(1855,'UT',1701,NULL,NULL,NULL,'Utrecht',1),(1856,'NH',1701,NULL,NULL,NULL,'Noord-Holland',1),(1857,'ZH',1701,NULL,NULL,NULL,'Zuid-Holland',1),(1858,'ZL',1701,NULL,NULL,NULL,'Zeeland',1),(1859,'NB',1701,NULL,NULL,NULL,'Noord-Brabant',1),(1860,'LB',1701,NULL,NULL,NULL,'Limburg',1),(1900,'AC',5601,'ACRE',0,'AC','Acre',1),(1901,'AL',5601,'ALAGOAS',0,'AL','Alagoas',1),(1902,'AP',5601,'AMAPA',0,'AP','Amapá',1),(1903,'AM',5601,'AMAZONAS',0,'AM','Amazonas',1),(1904,'BA',5601,'BAHIA',0,'BA','Bahia',1),(1905,'CE',5601,'CEARA',0,'CE','Ceará',1),(1906,'ES',5601,'ESPIRITO SANTO',0,'ES','Espirito Santo',1),(1907,'GO',5601,'GOIAS',0,'GO','Goiás',1),(1908,'MA',5601,'MARANHAO',0,'MA','Maranhão',1),(1909,'MT',5601,'MATO GROSSO',0,'MT','Mato Grosso',1),(1910,'MS',5601,'MATO GROSSO DO SUL',0,'MS','Mato Grosso do Sul',1),(1911,'MG',5601,'MINAS GERAIS',0,'MG','Minas Gerais',1),(1912,'PA',5601,'PARA',0,'PA','Pará',1),(1913,'PB',5601,'PARAIBA',0,'PB','Paraiba',1),(1914,'PR',5601,'PARANA',0,'PR','Paraná',1),(1915,'PE',5601,'PERNAMBUCO',0,'PE','Pernambuco',1),(1916,'PI',5601,'PIAUI',0,'PI','Piauí',1),(1917,'RJ',5601,'RIO DE JANEIRO',0,'RJ','Rio de Janeiro',1),(1918,'RN',5601,'RIO GRANDE DO NORTE',0,'RN','Rio Grande do Norte',1),(1919,'RS',5601,'RIO GRANDE DO SUL',0,'RS','Rio Grande do Sul',1),(1920,'RO',5601,'RONDONIA',0,'RO','Rondônia',1),(1921,'RR',5601,'RORAIMA',0,'RR','Roraima',1),(1922,'SC',5601,'SANTA CATARINA',0,'SC','Santa Catarina',1),(1923,'SE',5601,'SERGIPE',0,'SE','Sergipe',1),(1924,'SP',5601,'SAO PAULO',0,'SP','Sao Paulo',1),(1925,'TO',5601,'TOCANTINS',0,'TO','Tocantins',1),(1926,'DF',5601,'DISTRITO FEDERAL',0,'DF','Distrito Federal',1),(1927,'001',5201,'',0,'','Belisario Boeto',1),(1928,'002',5201,'',0,'','Hernando Siles',1),(1929,'003',5201,'',0,'','Jaime Zudáñez',1),(1930,'004',5201,'',0,'','Juana Azurduy de Padilla',1),(1931,'005',5201,'',0,'','Luis Calvo',1),(1932,'006',5201,'',0,'','Nor Cinti',1),(1933,'007',5201,'',0,'','Oropeza',1),(1934,'008',5201,'',0,'','Sud Cinti',1),(1935,'009',5201,'',0,'','Tomina',1),(1936,'010',5201,'',0,'','Yamparáez',1),(1937,'011',5202,'',0,'','Abel Iturralde',1),(1938,'012',5202,'',0,'','Aroma',1),(1939,'013',5202,'',0,'','Bautista Saavedra',1),(1940,'014',5202,'',0,'','Caranavi',1),(1941,'015',5202,'',0,'','Eliodoro Camacho',1),(1942,'016',5202,'',0,'','Franz Tamayo',1),(1943,'017',5202,'',0,'','Gualberto Villarroel',1),(1944,'018',5202,'',0,'','Ingaví',1),(1945,'019',5202,'',0,'','Inquisivi',1),(1946,'020',5202,'',0,'','José Ramón Loayza',1),(1947,'021',5202,'',0,'','Larecaja',1),(1948,'022',5202,'',0,'','Los Andes (Bolivia)',1),(1949,'023',5202,'',0,'','Manco Kapac',1),(1950,'024',5202,'',0,'','Muñecas',1),(1951,'025',5202,'',0,'','Nor Yungas',1),(1952,'026',5202,'',0,'','Omasuyos',1),(1953,'027',5202,'',0,'','Pacajes',1),(1954,'028',5202,'',0,'','Pedro Domingo Murillo',1),(1955,'029',5202,'',0,'','Sud Yungas',1),(1956,'030',5202,'',0,'','General José Manuel Pando',1),(1957,'031',5203,'',0,'','Arani',1),(1958,'032',5203,'',0,'','Arque',1),(1959,'033',5203,'',0,'','Ayopaya',1),(1960,'034',5203,'',0,'','Bolívar (Bolivia)',1),(1961,'035',5203,'',0,'','Campero',1),(1962,'036',5203,'',0,'','Capinota',1),(1963,'037',5203,'',0,'','Cercado (Cochabamba)',1),(1964,'038',5203,'',0,'','Esteban Arze',1),(1965,'039',5203,'',0,'','Germán Jordán',1),(1966,'040',5203,'',0,'','José Carrasco',1),(1967,'041',5203,'',0,'','Mizque',1),(1968,'042',5203,'',0,'','Punata',1),(1969,'043',5203,'',0,'','Quillacollo',1),(1970,'044',5203,'',0,'','Tapacarí',1),(1971,'045',5203,'',0,'','Tiraque',1),(1972,'046',5203,'',0,'','Chapare',1),(1973,'047',5204,'',0,'','Carangas',1),(1974,'048',5204,'',0,'','Cercado (Oruro)',1),(1975,'049',5204,'',0,'','Eduardo Avaroa',1),(1976,'050',5204,'',0,'','Ladislao Cabrera',1),(1977,'051',5204,'',0,'','Litoral de Atacama',1),(1978,'052',5204,'',0,'','Mejillones',1),(1979,'053',5204,'',0,'','Nor Carangas',1),(1980,'054',5204,'',0,'','Pantaleón Dalence',1),(1981,'055',5204,'',0,'','Poopó',1),(1982,'056',5204,'',0,'','Sabaya',1),(1983,'057',5204,'',0,'','Sajama',1),(1984,'058',5204,'',0,'','San Pedro de Totora',1),(1985,'059',5204,'',0,'','Saucarí',1),(1986,'060',5204,'',0,'','Sebastián Pagador',1),(1987,'061',5204,'',0,'','Sud Carangas',1),(1988,'062',5204,'',0,'','Tomás Barrón',1),(1989,'063',5205,'',0,'','Alonso de Ibáñez',1),(1990,'064',5205,'',0,'','Antonio Quijarro',1),(1991,'065',5205,'',0,'','Bernardino Bilbao',1),(1992,'066',5205,'',0,'','Charcas (Potosí)',1),(1993,'067',5205,'',0,'','Chayanta',1),(1994,'068',5205,'',0,'','Cornelio Saavedra',1),(1995,'069',5205,'',0,'','Daniel Campos',1),(1996,'070',5205,'',0,'','Enrique Baldivieso',1),(1997,'071',5205,'',0,'','José María Linares',1),(1998,'072',5205,'',0,'','Modesto Omiste',1),(1999,'073',5205,'',0,'','Nor Chichas',1),(2000,'074',5205,'',0,'','Nor Lípez',1),(2001,'075',5205,'',0,'','Rafael Bustillo',1),(2002,'076',5205,'',0,'','Sud Chichas',1),(2003,'077',5205,'',0,'','Sud Lípez',1),(2004,'078',5205,'',0,'','Tomás Frías',1),(2005,'079',5206,'',0,'','Aniceto Arce',1),(2006,'080',5206,'',0,'','Burdet O\'Connor',1),(2007,'081',5206,'',0,'','Cercado (Tarija)',1),(2008,'082',5206,'',0,'','Eustaquio Méndez',1),(2009,'083',5206,'',0,'','José María Avilés',1),(2010,'084',5206,'',0,'','Gran Chaco',1),(2011,'085',5207,'',0,'','Andrés Ibáñez',1),(2012,'086',5207,'',0,'','Caballero',1),(2013,'087',5207,'',0,'','Chiquitos',1),(2014,'088',5207,'',0,'','Cordillera (Bolivia)',1),(2015,'089',5207,'',0,'','Florida',1),(2016,'090',5207,'',0,'','Germán Busch',1),(2017,'091',5207,'',0,'','Guarayos',1),(2018,'092',5207,'',0,'','Ichilo',1),(2019,'093',5207,'',0,'','Obispo Santistevan',1),(2020,'094',5207,'',0,'','Sara',1),(2021,'095',5207,'',0,'','Vallegrande',1),(2022,'096',5207,'',0,'','Velasco',1),(2023,'097',5207,'',0,'','Warnes',1),(2024,'098',5207,'',0,'','Ángel Sandóval',1),(2025,'099',5207,'',0,'','Ñuflo de Chaves',1),(2026,'100',5208,'',0,'','Cercado (Beni)',1),(2027,'101',5208,'',0,'','Iténez',1),(2028,'102',5208,'',0,'','Mamoré',1),(2029,'103',5208,'',0,'','Marbán',1),(2030,'104',5208,'',0,'','Moxos',1),(2031,'105',5208,'',0,'','Vaca Díez',1),(2032,'106',5208,'',0,'','Yacuma',1),(2033,'107',5208,'',0,'','General José Ballivián Segurola',1),(2034,'108',5209,'',0,'','Abuná',1),(2035,'109',5209,'',0,'','Madre de Dios',1),(2036,'110',5209,'',0,'','Manuripi',1),(2037,'111',5209,'',0,'','Nicolás Suárez',1),(2038,'112',5209,'',0,'','General Federico Román',1),(2039,'B',4101,NULL,NULL,'BURGENLAND','Burgenland',1),(2040,'K',4101,NULL,NULL,'KAERNTEN','Kärnten',1),(2041,'N',4101,NULL,NULL,'NIEDEROESTERREICH','Niederösterreich',1),(2042,'O',4101,NULL,NULL,'OBEROESTERREICH','Oberösterreich',1),(2043,'S',4101,NULL,NULL,'SALZBURG','Salzburg',1),(2044,'ST',4101,NULL,NULL,'STEIERMARK','Steiermark',1),(2045,'T',4101,NULL,NULL,'TIROL','Tirol',1),(2046,'V',4101,NULL,NULL,'VORARLBERG','Vorarlberg',1),(2047,'W',4101,NULL,NULL,'WIEN','Wien',1),(2048,'2326',2305,'',0,'MISIONES','Misiones',1); +/*!40000 ALTER TABLE `llx_c_departements` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_c_ecotaxe` +-- + +DROP TABLE IF EXISTS `llx_c_ecotaxe`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_c_ecotaxe` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `code` varchar(64) NOT NULL, + `libelle` varchar(255) DEFAULT NULL, + `price` double(24,8) DEFAULT NULL, + `organization` varchar(255) DEFAULT NULL, + `fk_pays` int(11) NOT NULL, + `active` tinyint(4) NOT NULL DEFAULT '1', + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_c_ecotaxe` (`code`) +) ENGINE=InnoDB AUTO_INCREMENT=39 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_c_ecotaxe` +-- + +LOCK TABLES `llx_c_ecotaxe` WRITE; +/*!40000 ALTER TABLE `llx_c_ecotaxe` DISABLE KEYS */; +INSERT INTO `llx_c_ecotaxe` VALUES (1,'ER-A-A','Materiels electriques < 0,2kg',0.01000000,'ERP',1,1),(2,'ER-A-B','Materiels electriques >= 0,2 kg et < 0,5 kg',0.03000000,'ERP',1,1),(3,'ER-A-C','Materiels electriques >= 0,5 kg et < 1 kg',0.04000000,'ERP',1,1),(4,'ER-A-D','Materiels electriques >= 1 kg et < 2 kg',0.13000000,'ERP',1,1),(5,'ER-A-E','Materiels electriques >= 2 kg et < 4kg',0.21000000,'ERP',1,1),(6,'ER-A-F','Materiels electriques >= 4 kg et < 8 kg',0.42000000,'ERP',1,1),(7,'ER-A-G','Materiels electriques >= 8 kg et < 15 kg',0.84000000,'ERP',1,1),(8,'ER-A-H','Materiels electriques >= 15 kg et < 20 kg',1.25000000,'ERP',1,1),(9,'ER-A-I','Materiels electriques >= 20 kg et < 30 kg',1.88000000,'ERP',1,1),(10,'ER-A-J','Materiels electriques >= 30 kg',3.34000000,'ERP',1,1),(11,'ER-M-1','TV, Moniteurs < 9kg',0.84000000,'ERP',1,1),(12,'ER-M-2','TV, Moniteurs >= 9kg et < 15kg',1.67000000,'ERP',1,1),(13,'ER-M-3','TV, Moniteurs >= 15kg et < 30kg',3.34000000,'ERP',1,1),(14,'ER-M-4','TV, Moniteurs >= 30 kg',6.69000000,'ERP',1,1),(15,'EC-A-A','Materiels electriques 0,2 kg max',0.00840000,'Ecologic',1,1),(16,'EC-A-B','Materiels electriques 0,21 kg min - 0,50 kg max',0.02500000,'Ecologic',1,1),(17,'EC-A-C','Materiels electriques 0,51 kg min - 1 kg max',0.04000000,'Ecologic',1,1),(18,'EC-A-D','Materiels electriques 1,01 kg min - 2,5 kg max',0.13000000,'Ecologic',1,1),(19,'EC-A-E','Materiels electriques 2,51 kg min - 4 kg max',0.21000000,'Ecologic',1,1),(20,'EC-A-F','Materiels electriques 4,01 kg min - 8 kg max',0.42000000,'Ecologic',1,1),(21,'EC-A-G','Materiels electriques 8,01 kg min - 12 kg max',0.63000000,'Ecologic',1,1),(22,'EC-A-H','Materiels electriques 12,01 kg min - 20 kg max',1.05000000,'Ecologic',1,1),(23,'EC-A-I','Materiels electriques 20,01 kg min',1.88000000,'Ecologic',1,1),(24,'EC-M-1','TV, Moniteurs 9 kg max',0.84000000,'Ecologic',1,1),(25,'EC-M-2','TV, Moniteurs 9,01 kg min - 18 kg max',1.67000000,'Ecologic',1,1),(26,'EC-M-3','TV, Moniteurs 18,01 kg min - 36 kg max',3.34000000,'Ecologic',1,1),(27,'EC-M-4','TV, Moniteurs 36,01 kg min',6.69000000,'Ecologic',1,1),(28,'ES-M-1','TV, Moniteurs <= 20 pouces',0.84000000,'Eco-systemes',1,1),(29,'ES-M-2','TV, Moniteurs > 20 pouces et <= 32 pouces',3.34000000,'Eco-systemes',1,1),(30,'ES-M-3','TV, Moniteurs > 32 pouces et autres grands ecrans',6.69000000,'Eco-systemes',1,1),(31,'ES-A-A','Ordinateur fixe, Audio home systems (HIFI), elements hifi separes',0.84000000,'Eco-systemes',1,1),(32,'ES-A-B','Ordinateur portable, CD-RCR, VCR, lecteurs et enregistreurs DVD, instruments de musique et caisses de resonance, haut parleurs...',0.25000000,'Eco-systemes',1,1),(33,'ES-A-C','Imprimante, photocopieur, telecopieur',0.42000000,'Eco-systemes',1,1),(34,'ES-A-D','Accessoires, clavier, souris, PDA, imprimante photo, appareil photo, gps, telephone, repondeur, telephone sans fil, modem, telecommande, casque, camescope, baladeur mp3, radio portable, radio K7 et CD portable, radio reveil',0.08400000,'Eco-systemes',1,1),(35,'ES-A-E','GSM',0.00840000,'Eco-systemes',1,1),(36,'ES-A-F','Jouets et equipements de loisirs et de sports < 0,5 kg',0.04200000,'Eco-systemes',1,1),(37,'ES-A-G','Jouets et equipements de loisirs et de sports > 0,5 kg',0.17000000,'Eco-systemes',1,1),(38,'ES-A-H','Jouets et equipements de loisirs et de sports > 10 kg',1.25000000,'Eco-systemes',1,1); +/*!40000 ALTER TABLE `llx_c_ecotaxe` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_c_effectif` +-- + +DROP TABLE IF EXISTS `llx_c_effectif`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_c_effectif` ( + `id` int(11) NOT NULL, + `code` varchar(12) NOT NULL, + `libelle` varchar(30) DEFAULT NULL, + `active` tinyint(4) NOT NULL DEFAULT '1', + `module` varchar(32) DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `uk_c_effectif` (`code`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_c_effectif` +-- + +LOCK TABLES `llx_c_effectif` WRITE; +/*!40000 ALTER TABLE `llx_c_effectif` DISABLE KEYS */; +INSERT INTO `llx_c_effectif` VALUES (0,'EF0','-',1,NULL),(1,'EF1-5','1 - 5',1,NULL),(2,'EF6-10','6 - 10',1,NULL),(3,'EF11-50','11 - 50',1,NULL),(4,'EF51-100','51 - 100',1,NULL),(5,'EF100-500','100 - 500',1,NULL),(6,'EF500-','> 500',1,NULL); +/*!40000 ALTER TABLE `llx_c_effectif` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_c_email_templates` +-- + +DROP TABLE IF EXISTS `llx_c_email_templates`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_c_email_templates` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `entity` int(11) NOT NULL DEFAULT '1', + `module` varchar(32) DEFAULT NULL, + `type_template` varchar(32) DEFAULT NULL, + `lang` varchar(6) DEFAULT NULL, + `private` smallint(6) NOT NULL DEFAULT '0', + `fk_user` int(11) DEFAULT NULL, + `datec` datetime DEFAULT NULL, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `label` varchar(255) DEFAULT NULL, + `position` smallint(6) DEFAULT NULL, + `active` tinyint(4) NOT NULL DEFAULT '1', + `topic` text, + `content` text, + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_c_email_templates` (`entity`,`label`,`lang`), + KEY `idx_type` (`type_template`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_c_email_templates` +-- + +LOCK TABLES `llx_c_email_templates` WRITE; +/*!40000 ALTER TABLE `llx_c_email_templates` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_c_email_templates` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_c_field_list` +-- + +DROP TABLE IF EXISTS `llx_c_field_list`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_c_field_list` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `element` varchar(64) NOT NULL, + `entity` int(11) NOT NULL DEFAULT '1', + `name` varchar(32) NOT NULL, + `alias` varchar(32) NOT NULL, + `title` varchar(32) NOT NULL, + `align` varchar(6) DEFAULT 'left', + `sort` tinyint(4) NOT NULL DEFAULT '1', + `search` tinyint(4) NOT NULL DEFAULT '0', + `enabled` varchar(255) DEFAULT '1', + `rang` int(11) DEFAULT '0', + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_c_field_list` +-- + +LOCK TABLES `llx_c_field_list` WRITE; +/*!40000 ALTER TABLE `llx_c_field_list` DISABLE KEYS */; +INSERT INTO `llx_c_field_list` VALUES (1,'2011-02-06 11:18:30','product_default',1,'p.ref','ref','Ref','left',1,1,'1',1),(2,'2011-02-06 11:18:30','product_default',1,'p.label','label','Label','left',1,1,'1',2),(3,'2011-02-06 11:18:30','product_default',1,'p.barcode','barcode','BarCode','center',1,1,'$conf->barcode->enabled',3),(4,'2011-02-06 11:18:30','product_default',1,'p.tms','datem','DateModification','center',1,0,'1',4),(5,'2011-02-06 11:18:30','product_default',1,'p.price','price','SellingPriceHT','right',1,0,'1',5),(6,'2011-02-06 11:18:30','product_default',1,'p.price_ttc','price_ttc','SellingPriceTTC','right',1,0,'1',6),(7,'2011-02-06 11:18:30','product_default',1,'p.stock','stock','Stock','right',0,0,'$conf->stock->enabled',7),(8,'2011-02-06 11:18:30','product_default',1,'p.envente','status','Status','right',1,0,'1',8); +/*!40000 ALTER TABLE `llx_c_field_list` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_c_format_cards` +-- + +DROP TABLE IF EXISTS `llx_c_format_cards`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_c_format_cards` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `code` varchar(50) NOT NULL, + `name` varchar(50) NOT NULL, + `paper_size` varchar(20) NOT NULL, + `orientation` varchar(1) NOT NULL, + `metric` varchar(5) NOT NULL, + `leftmargin` double(24,8) NOT NULL, + `topmargin` double(24,8) NOT NULL, + `nx` int(11) NOT NULL, + `ny` int(11) NOT NULL, + `spacex` double(24,8) NOT NULL, + `spacey` double(24,8) NOT NULL, + `width` double(24,8) NOT NULL, + `height` double(24,8) NOT NULL, + `font_size` int(11) NOT NULL, + `custom_x` double(24,8) NOT NULL, + `custom_y` double(24,8) NOT NULL, + `active` int(11) NOT NULL, + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_c_format_cards` +-- + +LOCK TABLES `llx_c_format_cards` WRITE; +/*!40000 ALTER TABLE `llx_c_format_cards` DISABLE KEYS */; +INSERT INTO `llx_c_format_cards` VALUES (1,'5160','Avery-5160, WL-875WX','letter','P','mm',5.58165000,12.70000000,3,10,3.55600000,0.00000000,65.87490000,25.40000000,7,0.00000000,0.00000000,1),(2,'5161','Avery-5161, WL-75WX','letter','P','mm',4.44500000,12.70000000,2,10,3.96800000,0.00000000,101.60000000,25.40000000,7,0.00000000,0.00000000,1),(3,'5162','Avery-5162, WL-100WX','letter','P','mm',3.87350000,22.35200000,2,7,4.95400000,0.00000000,101.60000000,33.78100000,8,0.00000000,0.00000000,1),(4,'5163','Avery-5163, WL-125WX','letter','P','mm',4.57200000,12.70000000,2,5,3.55600000,0.00000000,101.60000000,50.80000000,10,0.00000000,0.00000000,1),(5,'5164','5164 (Letter)','letter','P','in',0.14800000,0.50000000,2,3,0.20310000,0.00000000,4.00000000,3.33000000,12,0.00000000,0.00000000,0),(6,'8600','Avery-8600','letter','P','mm',7.10000000,19.00000000,3,10,9.50000000,3.10000000,66.60000000,25.40000000,7,0.00000000,0.00000000,1),(7,'99012','DYMO 99012 89*36mm','custom','L','mm',1.00000000,1.00000000,1,1,0.00000000,0.00000000,36.00000000,89.00000000,10,36.00000000,89.00000000,1),(8,'99014','DYMO 99014 101*54mm','custom','L','mm',1.00000000,1.00000000,1,1,0.00000000,0.00000000,54.00000000,101.00000000,10,54.00000000,101.00000000,1),(9,'AVERYC32010','Avery-C32010','A4','P','mm',15.00000000,13.00000000,2,5,10.00000000,0.00000000,85.00000000,54.00000000,10,0.00000000,0.00000000,1),(10,'CARD','Dolibarr Business cards','A4','P','mm',15.00000000,15.00000000,2,5,0.00000000,0.00000000,85.00000000,54.00000000,10,0.00000000,0.00000000,1),(11,'L7163','Avery-L7163','A4','P','mm',5.00000000,15.00000000,2,7,2.50000000,0.00000000,99.10000000,38.10000000,8,0.00000000,0.00000000,1); +/*!40000 ALTER TABLE `llx_c_format_cards` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_c_forme_juridique` +-- + +DROP TABLE IF EXISTS `llx_c_forme_juridique`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_c_forme_juridique` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `code` int(11) NOT NULL, + `fk_pays` int(11) NOT NULL, + `libelle` varchar(255) DEFAULT NULL, + `isvatexempted` tinyint(4) NOT NULL DEFAULT '0', + `active` tinyint(4) NOT NULL DEFAULT '1', + `module` varchar(32) DEFAULT NULL, + `position` int(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_c_forme_juridique` (`code`) +) ENGINE=InnoDB AUTO_INCREMENT=100216 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_c_forme_juridique` +-- + +LOCK TABLES `llx_c_forme_juridique` WRITE; +/*!40000 ALTER TABLE `llx_c_forme_juridique` DISABLE KEYS */; +INSERT INTO `llx_c_forme_juridique` VALUES (100009,0,0,'-',0,1,NULL,0),(100010,2301,23,'Monotributista',0,1,NULL,0),(100011,2302,23,'Sociedad Civil',0,1,NULL,0),(100012,2303,23,'Sociedades Comerciales',0,1,NULL,0),(100013,2304,23,'Sociedades de Hecho',0,1,NULL,0),(100014,2305,23,'Sociedades Irregulares',0,1,NULL,0),(100015,2306,23,'Sociedad Colectiva',0,1,NULL,0),(100016,2307,23,'Sociedad en Comandita Simple',0,1,NULL,0),(100017,2308,23,'Sociedad de Capital e Industria',0,1,NULL,0),(100018,2309,23,'Sociedad Accidental o en participación',0,1,NULL,0),(100019,2310,23,'Sociedad de Responsabilidad Limitada',0,1,NULL,0),(100020,2311,23,'Sociedad Anónima',0,1,NULL,0),(100021,2312,23,'Sociedad Anónima con Participación Estatal Mayoritaria',0,1,NULL,0),(100022,2313,23,'Sociedad en Comandita por Acciones (arts. 315 a 324, LSC)',0,1,NULL,0),(100023,11,1,'Artisan Commerçant (EI)',0,1,NULL,0),(100024,12,1,'Commerçant (EI)',0,1,NULL,0),(100025,13,1,'Artisan (EI)',0,1,NULL,0),(100026,14,1,'Officier public ou ministériel',0,1,NULL,0),(100027,15,1,'Profession libérale (EI)',0,1,NULL,0),(100028,16,1,'Exploitant agricole',0,1,NULL,0),(100029,17,1,'Agent commercial',0,1,NULL,0),(100030,18,1,'Associé Gérant de société',0,1,NULL,0),(100031,19,1,'Personne physique',0,1,NULL,0),(100032,21,1,'Indivision',0,1,NULL,0),(100033,22,1,'Société créée de fait',0,1,NULL,0),(100034,23,1,'Société en participation',0,1,NULL,0),(100035,27,1,'Paroisse hors zone concordataire',0,1,NULL,0),(100036,29,1,'Groupement de droit privé non doté de la personnalité morale',0,1,NULL,0),(100037,31,1,'Personne morale de droit étranger, immatriculée au RCS',0,1,NULL,0),(100038,32,1,'Personne morale de droit étranger, non immatriculée au RCS',0,1,NULL,0),(100039,35,1,'Régime auto-entrepreneur',0,1,NULL,0),(100040,41,1,'Etablissement public ou régie à caractère industriel ou commercial',0,1,NULL,0),(100041,51,1,'Société coopérative commerciale particulière',0,1,NULL,0),(100042,52,1,'Société en nom collectif',0,1,NULL,0),(100043,53,1,'Société en commandite',0,1,NULL,0),(100044,54,1,'Société à responsabilité limitée (SARL)',0,1,NULL,0),(100045,55,1,'Société anonyme à conseil d administration',0,1,NULL,0),(100046,56,1,'Société anonyme à directoire',0,1,NULL,0),(100047,57,1,'Société par actions simplifiée (SAS)',0,1,NULL,0),(100048,58,1,'Entreprise Unipersonnelle à Responsabilité Limitée (EURL)',0,1,NULL,0),(100049,59,1,'Société par actions simplifiée unipersonnelle (SASU)',0,1,NULL,0),(100050,60,1,'Entreprise Individuelle à Responsabilité Limitée (EIRL)',0,1,NULL,0),(100051,61,1,'Caisse d\'épargne et de prévoyance',0,1,NULL,0),(100052,62,1,'Groupement d\'intérêt économique (GIE)',0,1,NULL,0),(100053,63,1,'Société coopérative agricole',0,1,NULL,0),(100054,64,1,'Société non commerciale d assurances',0,1,NULL,0),(100055,65,1,'Société civile',0,1,NULL,0),(100056,69,1,'Personnes de droit privé inscrites au RCS',0,1,NULL,0),(100057,71,1,'Administration de l état',0,1,NULL,0),(100058,72,1,'Collectivité territoriale',0,1,NULL,0),(100059,73,1,'Etablissement public administratif',0,1,NULL,0),(100060,74,1,'Personne morale de droit public administratif',0,1,NULL,0),(100061,81,1,'Organisme gérant régime de protection social à adhésion obligatoire',0,1,NULL,0),(100062,82,1,'Organisme mutualiste',0,1,NULL,0),(100063,83,1,'Comité d entreprise',0,1,NULL,0),(100064,84,1,'Organisme professionnel',0,1,NULL,0),(100065,85,1,'Organisme de retraite à adhésion non obligatoire',0,1,NULL,0),(100066,91,1,'Syndicat de propriétaires',0,1,NULL,0),(100067,92,1,'Association loi 1901 ou assimilé',0,1,NULL,0),(100068,93,1,'Fondation',0,1,NULL,0),(100069,99,1,'Personne morale de droit privé',0,1,NULL,0),(100070,200,2,'Indépendant',0,1,NULL,0),(100071,201,2,'SPRL - Société à responsabilité limitée',0,1,NULL,0),(100072,202,2,'SA - Société Anonyme',0,1,NULL,0),(100073,203,2,'SCRL - Société coopérative à responsabilité limitée',0,1,NULL,0),(100074,204,2,'ASBL - Association sans but Lucratif',0,1,NULL,0),(100075,205,2,'SCRI - Société coopérative à responsabilité illimitée',0,1,NULL,0),(100076,206,2,'SCS - Société en commandite simple',0,1,NULL,0),(100077,207,2,'SCA - Société en commandite par action',0,1,NULL,0),(100078,208,2,'SNC - Société en nom collectif',0,1,NULL,0),(100079,209,2,'GIE - Groupement d intérêt économique',0,1,NULL,0),(100080,210,2,'GEIE - Groupement européen d intérêt économique',0,1,NULL,0),(100081,220,2,'Eenmanszaak',0,1,NULL,0),(100082,221,2,'BVBA - Besloten vennootschap met beperkte aansprakelijkheid',0,1,NULL,0),(100083,222,2,'NV - Naamloze Vennootschap',0,1,NULL,0),(100084,223,2,'CVBA - Coöperatieve vennootschap met beperkte aansprakelijkheid',0,1,NULL,0),(100085,224,2,'VZW - Vereniging zonder winstoogmerk',0,1,NULL,0),(100086,225,2,'CVOA - Coöperatieve vennootschap met onbeperkte aansprakelijkheid ',0,1,NULL,0),(100087,226,2,'GCV - Gewone commanditaire vennootschap',0,1,NULL,0),(100088,227,2,'Comm.VA - Commanditaire vennootschap op aandelen',0,1,NULL,0),(100089,228,2,'VOF - Vennootschap onder firma',0,1,NULL,0),(100090,229,2,'VS0 - Vennootschap met sociaal oogmerk',0,1,NULL,0),(100091,500,5,'GmbH - Gesellschaft mit beschränkter Haftung',0,1,NULL,0),(100092,501,5,'AG - Aktiengesellschaft ',0,1,NULL,0),(100093,502,5,'GmbH&Co. KG - Gesellschaft mit beschränkter Haftung & Compagnie Kommanditgesellschaft',0,1,NULL,0),(100094,503,5,'Gewerbe - Personengesellschaft',0,1,NULL,0),(100095,504,5,'UG - Unternehmergesellschaft -haftungsbeschränkt-',0,1,NULL,0),(100096,505,5,'GbR - Gesellschaft des bürgerlichen Rechts',0,1,NULL,0),(100097,506,5,'KG - Kommanditgesellschaft',0,1,NULL,0),(100098,507,5,'Ltd. - Limited Company',0,1,NULL,0),(100099,508,5,'OHG - Offene Handelsgesellschaft',0,1,NULL,0),(100100,10201,102,'Ατομική επιχείρηση',0,1,NULL,0),(100101,10202,102,'Εταιρική επιχείρηση',0,1,NULL,0),(100102,10203,102,'Ομόρρυθμη Εταιρεία Ο.Ε',0,1,NULL,0),(100103,10204,102,'Ετερόρρυθμη Εταιρεία Ε.Ε',0,1,NULL,0),(100104,10205,102,'Εταιρεία Περιορισμένης Ευθύνης Ε.Π.Ε',0,1,NULL,0),(100105,10206,102,'Ανώνυμη Εταιρεία Α.Ε',0,1,NULL,0),(100106,10207,102,'Ανώνυμη ναυτιλιακή εταιρεία Α.Ν.Ε',0,1,NULL,0),(100107,10208,102,'Συνεταιρισμός',0,1,NULL,0),(100108,10209,102,'Συμπλοιοκτησία',0,1,NULL,0),(100109,301,3,'Società semplice',0,1,NULL,0),(100110,302,3,'Società in nome collettivo s.n.c.',0,1,NULL,0),(100111,303,3,'Società in accomandita semplice s.a.s.',0,1,NULL,0),(100112,304,3,'Società per azioni s.p.a.',0,1,NULL,0),(100113,305,3,'Società a responsabilità limitata s.r.l.',0,1,NULL,0),(100114,306,3,'Società in accomandita per azioni s.a.p.a.',0,1,NULL,0),(100115,307,3,'Società cooperativa a r.l.',0,1,NULL,0),(100116,308,3,'Società consortile',0,1,NULL,0),(100117,309,3,'Società europea',0,1,NULL,0),(100118,310,3,'Società cooperativa europea',0,1,NULL,0),(100119,311,3,'Società unipersonale',0,1,NULL,0),(100120,312,3,'Società di professionisti',0,1,NULL,0),(100121,313,3,'Società di fatto',0,1,NULL,0),(100122,315,3,'Società apparente',0,1,NULL,0),(100123,316,3,'Impresa individuale ',0,1,NULL,0),(100124,317,3,'Impresa coniugale',0,1,NULL,0),(100125,318,3,'Impresa familiare',0,1,NULL,0),(100126,319,3,'Consorzio cooperativo',0,1,NULL,0),(100127,320,3,'Società cooperativa sociale',0,1,NULL,0),(100128,321,3,'Società cooperativa di consumo',0,1,NULL,0),(100129,322,3,'Società cooperativa agricola',0,1,NULL,0),(100130,323,3,'A.T.I. Associazione temporanea di imprese',0,1,NULL,0),(100131,324,3,'R.T.I. Raggruppamento temporaneo di imprese',0,1,NULL,0),(100132,325,3,'Studio associato',0,1,NULL,0),(100133,600,6,'Raison Individuelle',0,1,NULL,0),(100134,601,6,'Société Simple',0,1,NULL,0),(100135,602,6,'Société en nom collectif',0,1,NULL,0),(100136,603,6,'Société en commandite',0,1,NULL,0),(100137,604,6,'Société anonyme (SA)',0,1,NULL,0),(100138,605,6,'Société en commandite par actions',0,1,NULL,0),(100139,606,6,'Société à responsabilité limitée (SARL)',0,1,NULL,0),(100140,607,6,'Société coopérative',0,1,NULL,0),(100141,608,6,'Association',0,1,NULL,0),(100142,609,6,'Fondation',0,1,NULL,0),(100143,700,7,'Sole Trader',0,1,NULL,0),(100144,701,7,'Partnership',0,1,NULL,0),(100145,702,7,'Private Limited Company by shares (LTD)',0,1,NULL,0),(100146,703,7,'Public Limited Company',0,1,NULL,0),(100147,704,7,'Workers Cooperative',0,1,NULL,0),(100148,705,7,'Limited Liability Partnership',0,1,NULL,0),(100149,706,7,'Franchise',0,1,NULL,0),(100150,1000,10,'Société à responsabilité limitée (SARL)',0,1,NULL,0),(100151,1001,10,'Société en Nom Collectif (SNC)',0,1,NULL,0),(100152,1002,10,'Société en Commandite Simple (SCS)',0,1,NULL,0),(100153,1003,10,'société en participation',0,1,NULL,0),(100154,1004,10,'Société Anonyme (SA)',0,1,NULL,0),(100155,1005,10,'Société Unipersonnelle à Responsabilité Limitée (SUARL)',0,1,NULL,0),(100156,1006,10,'Groupement d\'intérêt économique (GEI)',0,1,NULL,0),(100157,1007,10,'Groupe de sociétés',0,1,NULL,0),(100158,1701,17,'Eenmanszaak',0,1,NULL,0),(100159,1702,17,'Maatschap',0,1,NULL,0),(100160,1703,17,'Vennootschap onder firma',0,1,NULL,0),(100161,1704,17,'Commanditaire vennootschap',0,1,NULL,0),(100162,1705,17,'Besloten vennootschap (BV)',0,1,NULL,0),(100163,1706,17,'Naamloze Vennootschap (NV)',0,1,NULL,0),(100164,1707,17,'Vereniging',0,1,NULL,0),(100165,1708,17,'Stichting',0,1,NULL,0),(100166,1709,17,'Coöperatie met beperkte aansprakelijkheid (BA)',0,1,NULL,0),(100167,1710,17,'Coöperatie met uitgesloten aansprakelijkheid (UA)',0,1,NULL,0),(100168,1711,17,'Coöperatie met wettelijke aansprakelijkheid (WA)',0,1,NULL,0),(100169,1712,17,'Onderlinge waarborgmaatschappij',0,1,NULL,0),(100170,401,4,'Empresario Individual',0,1,NULL,0),(100171,402,4,'Comunidad de Bienes',0,1,NULL,0),(100172,403,4,'Sociedad Civil',0,1,NULL,0),(100173,404,4,'Sociedad Colectiva',0,1,NULL,0),(100174,405,4,'Sociedad Limitada',0,1,NULL,0),(100175,406,4,'Sociedad Anónima',0,1,NULL,0),(100176,407,4,'Sociedad Comanditaria por Acciones',0,1,NULL,0),(100177,408,4,'Sociedad Comanditaria Simple',0,1,NULL,0),(100178,409,4,'Sociedad Laboral',0,1,NULL,0),(100179,410,4,'Sociedad Cooperativa',0,1,NULL,0),(100180,411,4,'Sociedad de Garantía Recíproca',0,1,NULL,0),(100181,412,4,'Entidad de Capital-Riesgo',0,1,NULL,0),(100182,413,4,'Agrupación de Interés Económico',0,1,NULL,0),(100183,414,4,'Sociedad de Inversión Mobiliaria',0,1,NULL,0),(100184,415,4,'Agrupación sin Ánimo de Lucro',0,1,NULL,0),(100185,15201,152,'Mauritius Private Company Limited By Shares',0,1,NULL,0),(100186,15202,152,'Mauritius Company Limited By Guarantee',0,1,NULL,0),(100187,15203,152,'Mauritius Public Company Limited By Shares',0,1,NULL,0),(100188,15204,152,'Mauritius Foreign Company',0,1,NULL,0),(100189,15205,152,'Mauritius GBC1 (Offshore Company)',0,1,NULL,0),(100190,15206,152,'Mauritius GBC2 (International Company)',0,1,NULL,0),(100191,15207,152,'Mauritius General Partnership',0,1,NULL,0),(100192,15208,152,'Mauritius Limited Partnership',0,1,NULL,0),(100193,15209,152,'Mauritius Sole Proprietorship',0,1,NULL,0),(100194,15210,152,'Mauritius Trusts',0,1,NULL,0),(100195,15401,154,'Sociedad en nombre colectivo',0,1,NULL,0),(100196,15402,154,'Sociedad en comandita simple',0,1,NULL,0),(100197,15403,154,'Sociedad de responsabilidad limitada',0,1,NULL,0),(100198,15404,154,'Sociedad anónima',0,1,NULL,0),(100199,15405,154,'Sociedad en comandita por acciones',0,1,NULL,0),(100200,15406,154,'Sociedad cooperativa',0,1,NULL,0),(100201,4100,41,'GmbH - Gesellschaft mit beschränkter Haftung',0,1,NULL,0),(100202,4101,41,'GesmbH - Gesellschaft mit beschränkter Haftung',0,1,NULL,0),(100203,4102,41,'AG - Aktiengesellschaft',0,1,NULL,0),(100204,4103,41,'EWIV - Europäische wirtschaftliche Interessenvereinigung',0,1,NULL,0),(100205,4104,41,'KEG - Kommanditerwerbsgesellschaft',0,1,NULL,0),(100206,4105,41,'OEG - Offene Erwerbsgesellschaft',0,1,NULL,0),(100207,4106,41,'OHG - Offene Handelsgesellschaft',0,1,NULL,0),(100208,4107,41,'AG & Co KG - Kommanditgesellschaft',0,1,NULL,0),(100209,4108,41,'GmbH & Co KG - Kommanditgesellschaft',0,1,NULL,0),(100210,4109,41,'KG - Kommanditgesellschaft',0,1,NULL,0),(100211,4110,41,'OG - Offene Gesellschaft',0,1,NULL,0),(100212,4111,41,'GbR - Gesellschaft nach bürgerlichem Recht',0,1,NULL,0),(100213,4112,41,'GesbR - Gesellschaft nach bürgerlichem Recht',0,1,NULL,0),(100214,4113,41,'GesnbR - Gesellschaft nach bürgerlichem Recht',0,1,NULL,0),(100215,4114,41,'e.U. - eingetragener Einzelunternehmer',0,1,NULL,0); +/*!40000 ALTER TABLE `llx_c_forme_juridique` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_c_holiday_types` +-- + +DROP TABLE IF EXISTS `llx_c_holiday_types`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_c_holiday_types` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `code` varchar(16) NOT NULL, + `label` varchar(255) NOT NULL, + `affect` int(11) NOT NULL, + `delay` int(11) NOT NULL, + `newByMonth` double(8,5) NOT NULL DEFAULT '0.00000', + `fk_country` int(11) DEFAULT NULL, + `active` int(11) DEFAULT '1', + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_c_holiday_types` (`code`) +) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_c_holiday_types` +-- + +LOCK TABLES `llx_c_holiday_types` WRITE; +/*!40000 ALTER TABLE `llx_c_holiday_types` DISABLE KEYS */; +INSERT INTO `llx_c_holiday_types` VALUES (1,'LEAVE_SICK','Sick leave',0,0,0.00000,NULL,1),(2,'LEAVE_OTHER','Other leave',0,0,0.00000,NULL,1),(3,'LEAVE_PAID','Paid vacation',1,7,0.00000,NULL,1),(4,'LEAVE_RTT_FR','RTT',1,7,0.83000,1,0),(5,'LEAVE_PAID_FR','Paid vacation',1,30,2.08334,1,0); +/*!40000 ALTER TABLE `llx_c_holiday_types` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_c_hrm_department` +-- + +DROP TABLE IF EXISTS `llx_c_hrm_department`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_c_hrm_department` ( + `rowid` int(11) NOT NULL, + `pos` tinyint(4) NOT NULL DEFAULT '0', + `code` varchar(16) NOT NULL, + `label` varchar(50) DEFAULT NULL, + `active` tinyint(4) NOT NULL DEFAULT '1', + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_c_hrm_department` +-- + +LOCK TABLES `llx_c_hrm_department` WRITE; +/*!40000 ALTER TABLE `llx_c_hrm_department` DISABLE KEYS */; +INSERT INTO `llx_c_hrm_department` VALUES (1,5,'MANAGEMENT','Management',1),(2,10,'GESTION','Gestion',1),(3,15,'TRAINING','Training',1),(4,20,'IT','Inform. Technology (IT)',1),(5,25,'MARKETING','Marketing',1),(6,30,'SALES','Sales',1),(7,35,'LEGAL','Legal',1),(8,40,'FINANCIAL','Financial accounting',1),(9,45,'HUMANRES','Human resources',1),(10,50,'PURCHASING','Purchasing',1),(11,55,'SERVICES','Services',1),(12,60,'CUSTOMSERV','Customer service',1),(13,65,'CONSULTING','Consulting',1),(14,70,'LOGISTIC','Logistics',1),(15,75,'CONSTRUCT','Engineering/design',1),(16,80,'PRODUCTION','Manufacturing',1),(17,85,'QUALITY','Quality assurance',1),(18,85,'MAINT','Plant assurance',1); +/*!40000 ALTER TABLE `llx_c_hrm_department` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_c_hrm_function` +-- + +DROP TABLE IF EXISTS `llx_c_hrm_function`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_c_hrm_function` ( + `rowid` int(11) NOT NULL, + `pos` tinyint(4) NOT NULL DEFAULT '0', + `code` varchar(16) NOT NULL, + `label` varchar(50) DEFAULT NULL, + `c_level` tinyint(4) NOT NULL DEFAULT '0', + `active` tinyint(4) NOT NULL DEFAULT '1', + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_c_hrm_function` +-- + +LOCK TABLES `llx_c_hrm_function` WRITE; +/*!40000 ALTER TABLE `llx_c_hrm_function` DISABLE KEYS */; +INSERT INTO `llx_c_hrm_function` VALUES (1,5,'EXECBOARD','Executive board',0,1),(2,10,'MANAGDIR','Managing director',1,1),(3,15,'ACCOUNTMANAG','Account manager',0,1),(4,20,'ENGAGDIR','Engagement director',1,1),(5,25,'DIRECTOR','Director',1,1),(6,30,'PROJMANAG','Project manager',0,1),(7,35,'DEPHEAD','Department head',0,1),(8,40,'SECRETAR','Secretary',0,1),(9,45,'EMPLOYEE','Department employee',0,1); +/*!40000 ALTER TABLE `llx_c_hrm_function` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_c_incoterms` +-- + +DROP TABLE IF EXISTS `llx_c_incoterms`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_c_incoterms` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `code` varchar(3) NOT NULL, + `libelle` varchar(255) NOT NULL, + `active` tinyint(4) NOT NULL DEFAULT '1', + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_c_incoterms` (`code`) +) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_c_incoterms` +-- + +LOCK TABLES `llx_c_incoterms` WRITE; +/*!40000 ALTER TABLE `llx_c_incoterms` DISABLE KEYS */; +INSERT INTO `llx_c_incoterms` VALUES (1,'EXW','Ex Works, au départ non chargé, non dédouané sortie d\'usine (uniquement adapté aux flux domestiques, nationaux)',1),(2,'FCA','Free Carrier, marchandises dédouanées et chargées dans le pays de départ, chez le vendeur ou chez le commissionnaire de transport de l\'acheteur',1),(3,'FAS','Free Alongside Ship, sur le quai du port de départ',1),(4,'FOB','Free On Board, chargé sur le bateau, les frais de chargement dans celui-ci étant fonction du liner term indiqué par la compagnie maritime (à la charge du vendeur)',1),(5,'CFR','Cost and Freight, chargé dans le bateau, livraison au port de départ, frais payés jusqu\'au port d\'arrivée, sans assurance pour le transport, non déchargé du navire à destination (les frais de déchargement sont inclus ou non au port d\'arrivée)',1),(6,'CIF','Cost, Insurance and Freight, chargé sur le bateau, frais jusqu\'au port d\'arrivée, avec l\'assurance marchandise transportée souscrite par le vendeur pour le compte de l\'acheteur',1),(7,'CPT','Carriage Paid To, livraison au premier transporteur, frais jusqu\'au déchargement du mode de transport, sans assurance pour le transport',1),(8,'CIP','Carriage and Insurance Paid to, idem CPT, avec assurance marchandise transportée souscrite par le vendeur pour le compte de l\'acheteur',1),(9,'DAT','Delivered At Terminal, marchandises (déchargées) livrées sur quai, dans un terminal maritime, fluvial, aérien, routier ou ferroviaire désigné (dédouanement import, et post-acheminement payés par l\'acheteur)',1),(10,'DAP','Delivered At Place, marchandises (non déchargées) mises à disposition de l\'acheteur dans le pays d\'importation au lieu précisé dans le contrat (déchargement, dédouanement import payé par l\'acheteur)',1),(11,'DDP','Delivered Duty Paid, marchandises (non déchargées) livrées à destination finale, dédouanement import et taxes à la charge du vendeur ; l\'acheteur prend en charge uniquement le déchargement (si exclusion des taxes type TVA, le préciser clairement)',1); +/*!40000 ALTER TABLE `llx_c_incoterms` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_c_input_method` +-- + +DROP TABLE IF EXISTS `llx_c_input_method`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_c_input_method` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `code` varchar(30) DEFAULT NULL, + `libelle` varchar(60) DEFAULT NULL, + `active` tinyint(4) NOT NULL DEFAULT '1', + `module` varchar(32) DEFAULT NULL, + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_c_methode_commande_fournisseur` (`code`), + UNIQUE KEY `uk_c_input_method` (`code`) +) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_c_input_method` +-- + +LOCK TABLES `llx_c_input_method` WRITE; +/*!40000 ALTER TABLE `llx_c_input_method` DISABLE KEYS */; +INSERT INTO `llx_c_input_method` VALUES (1,'OrderByMail','Courrier',1,NULL),(2,'OrderByFax','Fax',1,NULL),(3,'OrderByEMail','EMail',1,NULL),(4,'OrderByPhone','Téléphone',1,NULL),(5,'OrderByWWW','En ligne',1,NULL); +/*!40000 ALTER TABLE `llx_c_input_method` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_c_input_reason` +-- + +DROP TABLE IF EXISTS `llx_c_input_reason`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_c_input_reason` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `code` varchar(30) NOT NULL, + `label` varchar(60) NOT NULL, + `active` tinyint(4) NOT NULL DEFAULT '1', + `module` varchar(32) DEFAULT NULL, + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_c_input_reason` (`code`) +) ENGINE=MyISAM AUTO_INCREMENT=12 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_c_input_reason` +-- + +LOCK TABLES `llx_c_input_reason` WRITE; +/*!40000 ALTER TABLE `llx_c_input_reason` DISABLE KEYS */; +INSERT INTO `llx_c_input_reason` VALUES (1,'SRC_INTE','Web site',1,NULL),(2,'SRC_CAMP_MAIL','Mailing campaign',1,NULL),(3,'SRC_CAMP_PHO','Phone campaign',1,NULL),(4,'SRC_CAMP_FAX','Fax campaign',1,NULL),(5,'SRC_COMM','Commercial contact',1,NULL),(6,'SRC_SHOP','Shop contact',1,NULL),(7,'SRC_CAMP_EMAIL','EMailing campaign',1,NULL),(8,'SRC_WOM','Word of mouth',1,NULL),(9,'SRC_PARTNER','Partner',1,NULL),(10,'SRC_EMPLOYEE','Employee',1,NULL),(11,'SRC_SPONSORING','Sponsoring',1,NULL); +/*!40000 ALTER TABLE `llx_c_input_reason` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_c_lead_status` +-- + +DROP TABLE IF EXISTS `llx_c_lead_status`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_c_lead_status` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `code` varchar(10) DEFAULT NULL, + `label` varchar(50) DEFAULT NULL, + `position` int(11) DEFAULT NULL, + `percent` double(5,2) DEFAULT NULL, + `active` tinyint(4) NOT NULL DEFAULT '1', + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_c_lead_status_code` (`code`) +) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_c_lead_status` +-- + +LOCK TABLES `llx_c_lead_status` WRITE; +/*!40000 ALTER TABLE `llx_c_lead_status` DISABLE KEYS */; +INSERT INTO `llx_c_lead_status` VALUES (1,'PROSP','Prospection',10,0.00,1),(2,'QUAL','Qualification',20,20.00,1),(3,'PROPO','Proposal',30,40.00,1),(4,'NEGO','Negotiation',40,60.00,1),(5,'PENDING','Pending',50,50.00,0),(6,'WON','Won',60,100.00,1),(7,'LOST','Lost',70,0.00,1); +/*!40000 ALTER TABLE `llx_c_lead_status` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_c_methode_commande_fournisseur` +-- + +DROP TABLE IF EXISTS `llx_c_methode_commande_fournisseur`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_c_methode_commande_fournisseur` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `code` varchar(30) DEFAULT NULL, + `libelle` varchar(60) DEFAULT NULL, + `active` tinyint(4) NOT NULL DEFAULT '1', + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_c_methode_commande_fournisseur` (`code`) +) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_c_methode_commande_fournisseur` +-- + +LOCK TABLES `llx_c_methode_commande_fournisseur` WRITE; +/*!40000 ALTER TABLE `llx_c_methode_commande_fournisseur` DISABLE KEYS */; +INSERT INTO `llx_c_methode_commande_fournisseur` VALUES (1,'OrderByMail','Courrier',1),(2,'OrderByFax','Fax',1),(3,'OrderByEMail','EMail',1),(4,'OrderByPhone','Téléphone',1),(5,'OrderByWWW','En ligne',1); +/*!40000 ALTER TABLE `llx_c_methode_commande_fournisseur` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_c_paiement` +-- + +DROP TABLE IF EXISTS `llx_c_paiement`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_c_paiement` ( + `id` int(11) NOT NULL, + `code` varchar(6) NOT NULL, + `libelle` varchar(62) DEFAULT NULL, + `type` smallint(6) DEFAULT NULL, + `active` tinyint(4) NOT NULL DEFAULT '1', + `accountancy_code` varchar(32) DEFAULT NULL, + `module` varchar(32) DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `uk_c_paiement` (`code`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_c_paiement` +-- + +LOCK TABLES `llx_c_paiement` WRITE; +/*!40000 ALTER TABLE `llx_c_paiement` DISABLE KEYS */; +INSERT INTO `llx_c_paiement` VALUES (0,'','-',3,1,NULL,NULL),(1,'TIP','TIP',2,0,NULL,NULL),(2,'VIR','Virement',2,1,NULL,NULL),(3,'PRE','Prélèvement',2,1,NULL,NULL),(4,'LIQ','Espèces',2,1,NULL,NULL),(6,'CB','Carte Bancaire',2,1,NULL,NULL),(7,'CHQ','Chèque',2,1,NULL,NULL),(50,'VAD','Paiement en ligne',2,0,NULL,NULL),(51,'TRA','Traite',2,0,NULL,NULL),(52,'LCR','LCR',2,0,NULL,NULL),(53,'FAC','Factor',2,0,NULL,NULL); +/*!40000 ALTER TABLE `llx_c_paiement` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_c_paper_format` +-- + +DROP TABLE IF EXISTS `llx_c_paper_format`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_c_paper_format` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `code` varchar(16) NOT NULL, + `label` varchar(50) NOT NULL, + `width` float(6,2) DEFAULT '0.00', + `height` float(6,2) DEFAULT '0.00', + `unit` varchar(5) NOT NULL, + `active` tinyint(4) NOT NULL DEFAULT '1', + `module` varchar(32) DEFAULT NULL, + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB AUTO_INCREMENT=226 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_c_paper_format` +-- + +LOCK TABLES `llx_c_paper_format` WRITE; +/*!40000 ALTER TABLE `llx_c_paper_format` DISABLE KEYS */; +INSERT INTO `llx_c_paper_format` VALUES (1,'EU4A0','Format 4A0',1682.00,2378.00,'mm',1,NULL),(2,'EU2A0','Format 2A0',1189.00,1682.00,'mm',1,NULL),(3,'EUA0','Format A0',840.00,1189.00,'mm',1,NULL),(4,'EUA1','Format A1',594.00,840.00,'mm',1,NULL),(5,'EUA2','Format A2',420.00,594.00,'mm',1,NULL),(6,'EUA3','Format A3',297.00,420.00,'mm',1,NULL),(7,'EUA4','Format A4',210.00,297.00,'mm',1,NULL),(8,'EUA5','Format A5',148.00,210.00,'mm',1,NULL),(9,'EUA6','Format A6',105.00,148.00,'mm',1,NULL),(100,'USLetter','Format Letter (A)',216.00,279.00,'mm',1,NULL),(105,'USLegal','Format Legal',216.00,356.00,'mm',1,NULL),(110,'USExecutive','Format Executive',190.00,254.00,'mm',1,NULL),(115,'USLedger','Format Ledger/Tabloid (B)',279.00,432.00,'mm',1,NULL),(200,'CAP1','Format Canadian P1',560.00,860.00,'mm',1,NULL),(205,'CAP2','Format Canadian P2',430.00,560.00,'mm',1,NULL),(210,'CAP3','Format Canadian P3',280.00,430.00,'mm',1,NULL),(215,'CAP4','Format Canadian P4',215.00,280.00,'mm',1,NULL),(220,'CAP5','Format Canadian P5',140.00,215.00,'mm',1,NULL),(225,'CAP6','Format Canadian P6',107.00,140.00,'mm',1,NULL); +/*!40000 ALTER TABLE `llx_c_paper_format` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_c_payment_term` +-- + +DROP TABLE IF EXISTS `llx_c_payment_term`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_c_payment_term` ( + `rowid` int(11) NOT NULL, + `code` varchar(16) DEFAULT NULL, + `sortorder` smallint(6) DEFAULT NULL, + `active` tinyint(4) DEFAULT '1', + `libelle` varchar(255) DEFAULT NULL, + `libelle_facture` text, + `fdm` tinyint(4) DEFAULT NULL, + `nbjour` smallint(6) DEFAULT NULL, + `decalage` smallint(6) DEFAULT NULL, + `module` varchar(32) DEFAULT NULL, + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_c_payment_term` +-- + +LOCK TABLES `llx_c_payment_term` WRITE; +/*!40000 ALTER TABLE `llx_c_payment_term` DISABLE KEYS */; +INSERT INTO `llx_c_payment_term` VALUES (1,'RECEP',1,1,'A réception','Réception de facture',0,0,NULL,NULL),(2,'30D',2,1,'30 jours','Réglement à 30 jours',0,30,NULL,NULL),(3,'30DENDMONTH',3,1,'30 jours fin de mois','Réglement à 30 jours fin de mois',1,30,NULL,NULL),(4,'60D',4,1,'60 jours','Réglement à 60 jours',0,60,NULL,NULL),(5,'60DENDMONTH',5,1,'60 jours fin de mois','Réglement à 60 jours fin de mois',1,60,NULL,NULL),(6,'PT_ORDER',6,1,'A réception de commande','A réception de commande',0,0,NULL,NULL),(7,'PT_DELIVERY',7,1,'Livraison','Règlement à la livraison',0,0,NULL,NULL),(8,'PT_5050',8,1,'50 et 50','Règlement 50% à la commande, 50% à la livraison',0,0,NULL,NULL); +/*!40000 ALTER TABLE `llx_c_payment_term` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_c_pays` +-- + +DROP TABLE IF EXISTS `llx_c_pays`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_c_pays` ( + `rowid` int(11) NOT NULL, + `code` varchar(2) NOT NULL, + `code_iso` varchar(3) DEFAULT NULL, + `libelle` varchar(50) NOT NULL, + `active` tinyint(4) NOT NULL DEFAULT '1', + PRIMARY KEY (`rowid`), + UNIQUE KEY `idx_c_pays_code` (`code`), + UNIQUE KEY `idx_c_pays_libelle` (`libelle`), + UNIQUE KEY `idx_c_pays_code_iso` (`code_iso`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_c_pays` +-- + +LOCK TABLES `llx_c_pays` WRITE; +/*!40000 ALTER TABLE `llx_c_pays` DISABLE KEYS */; +INSERT INTO `llx_c_pays` VALUES (0,'',NULL,'-',1),(1,'FR',NULL,'France',1),(2,'BE',NULL,'Belgium',1),(3,'IT',NULL,'Italy',1),(4,'ES',NULL,'Spain',1),(5,'DE',NULL,'Germany',1),(6,'CH',NULL,'Suisse',1),(7,'GB',NULL,'United Kingdow',1),(8,'IE',NULL,'Irland',1),(9,'CN',NULL,'China',1),(10,'TN',NULL,'Tunisie',1),(11,'US',NULL,'United States',1),(12,'MA',NULL,'Maroc',1),(13,'DZ',NULL,'Algérie',1),(14,'CA',NULL,'Canada',1),(15,'TG',NULL,'Togo',1),(16,'GA',NULL,'Gabon',1),(17,'NL',NULL,'Nerderland',1),(18,'HU',NULL,'Hongrie',1),(19,'RU',NULL,'Russia',1),(20,'SE',NULL,'Sweden',1),(21,'CI',NULL,'Côte d\'Ivoire',1),(22,'SN',NULL,'Sénégal',1),(23,'AR',NULL,'Argentine',1),(24,'CM',NULL,'Cameroun',1),(25,'PT',NULL,'Portugal',1),(26,'SA',NULL,'Arabie Saoudite',1),(27,'MC',NULL,'Monaco',1),(28,'AU',NULL,'Australia',1),(29,'SG',NULL,'Singapour',1),(30,'AF',NULL,'Afghanistan',1),(31,'AX',NULL,'Iles Aland',1),(32,'AL',NULL,'Albanie',1),(33,'AS',NULL,'Samoa américaines',1),(34,'AD',NULL,'Andorre',1),(35,'AO',NULL,'Angola',1),(36,'AI',NULL,'Anguilla',1),(37,'AQ',NULL,'Antarctique',1),(38,'AG',NULL,'Antigua-et-Barbuda',1),(39,'AM',NULL,'Arménie',1),(40,'AW',NULL,'Aruba',1),(41,'AT',NULL,'Autriche',1),(42,'AZ',NULL,'Azerbaïdjan',1),(43,'BS',NULL,'Bahamas',1),(44,'BH',NULL,'Bahreïn',1),(45,'BD',NULL,'Bangladesh',1),(46,'BB',NULL,'Barbade',1),(47,'BY',NULL,'Biélorussie',1),(48,'BZ',NULL,'Belize',1),(49,'BJ',NULL,'Bénin',1),(50,'BM',NULL,'Bermudes',1),(51,'BT',NULL,'Bhoutan',1),(52,'BO',NULL,'Bolivie',1),(53,'BA',NULL,'Bosnie-Herzégovine',1),(54,'BW',NULL,'Botswana',1),(55,'BV',NULL,'Ile Bouvet',1),(56,'BR',NULL,'Brésil',1),(57,'IO',NULL,'Territoire britannique de l\'Océan Indien',1),(58,'BN',NULL,'Brunei',1),(59,'BG',NULL,'Bulgarie',1),(60,'BF',NULL,'Burkina Faso',1),(61,'BI',NULL,'Burundi',1),(62,'KH',NULL,'Cambodge',1),(63,'CV',NULL,'Cap-Vert',1),(64,'KY',NULL,'Iles Cayman',1),(65,'CF',NULL,'République centrafricaine',1),(66,'TD',NULL,'Tchad',1),(67,'CL',NULL,'Chili',1),(68,'CX',NULL,'Ile Christmas',1),(69,'CC',NULL,'Iles des Cocos (Keeling)',1),(70,'CO',NULL,'Colombie',1),(71,'KM',NULL,'Comores',1),(72,'CG',NULL,'Congo',1),(73,'CD',NULL,'République démocratique du Congo',1),(74,'CK',NULL,'Iles Cook',1),(75,'CR',NULL,'Costa Rica',1),(76,'HR',NULL,'Croatie',1),(77,'CU',NULL,'Cuba',1),(78,'CY',NULL,'Chypre',1),(79,'CZ',NULL,'République Tchèque',1),(80,'DK',NULL,'Danemark',1),(81,'DJ',NULL,'Djibouti',1),(82,'DM',NULL,'Dominique',1),(83,'DO',NULL,'République Dominicaine',1),(84,'EC',NULL,'Equateur',1),(85,'EG',NULL,'Egypte',1),(86,'SV',NULL,'Salvador',1),(87,'GQ',NULL,'Guinée Equatoriale',1),(88,'ER',NULL,'Erythrée',1),(89,'EE',NULL,'Estonie',1),(90,'ET',NULL,'Ethiopie',1),(91,'FK',NULL,'Iles Falkland',1),(92,'FO',NULL,'Iles Féroé',1),(93,'FJ',NULL,'Iles Fidji',1),(94,'FI',NULL,'Finlande',1),(95,'GF',NULL,'Guyane française',1),(96,'PF',NULL,'Polynésie française',1),(97,'TF',NULL,'Terres australes françaises',1),(98,'GM',NULL,'Gambie',1),(99,'GE',NULL,'Géorgie',1),(100,'GH',NULL,'Ghana',1),(101,'GI',NULL,'Gibraltar',1),(102,'GR',NULL,'Grèce',1),(103,'GL',NULL,'Groenland',1),(104,'GD',NULL,'Grenade',1),(105,'GP',NULL,'Guadeloupe',1),(106,'GU',NULL,'Guam',1),(107,'GT',NULL,'Guatemala',1),(108,'GN',NULL,'Guinée',1),(109,'GW',NULL,'Guinée-Bissao',1),(110,'GY',NULL,'Guyana',1),(111,'HT',NULL,'Haiti',1),(112,'HM',NULL,'Iles Heard et McDonald',1),(113,'VA',NULL,'Saint-Siège (Vatican)',1),(114,'HN',NULL,'Honduras',1),(115,'HK',NULL,'Hong Kong',1),(116,'IS',NULL,'Islande',1),(117,'IN',NULL,'India',1),(118,'ID',NULL,'Indonésie',1),(119,'IR',NULL,'Iran',1),(120,'IQ',NULL,'Iraq',1),(121,'IL',NULL,'Israel',1),(122,'JM',NULL,'Jamaïque',1),(123,'JP',NULL,'Japon',1),(124,'JO',NULL,'Jordanie',1),(125,'KZ',NULL,'Kazakhstan',1),(126,'KE',NULL,'Kenya',1),(127,'KI',NULL,'Kiribati',1),(128,'KP',NULL,'Corée du Nord',1),(129,'KR',NULL,'Corée du Sud',1),(130,'KW',NULL,'Koweït',1),(131,'KG',NULL,'Kirghizistan',1),(132,'LA',NULL,'Laos',1),(133,'LV',NULL,'Lettonie',1),(134,'LB',NULL,'Liban',1),(135,'LS',NULL,'Lesotho',1),(136,'LR',NULL,'Liberia',1),(137,'LY',NULL,'Libye',1),(138,'LI',NULL,'Liechtenstein',1),(139,'LT',NULL,'Lituanie',1),(140,'LU',NULL,'Luxembourg',1),(141,'MO',NULL,'Macao',1),(142,'MK',NULL,'ex-République yougoslave de Macédoine',1),(143,'MG',NULL,'Madagascar',1),(144,'MW',NULL,'Malawi',1),(145,'MY',NULL,'Malaisie',1),(146,'MV',NULL,'Maldives',1),(147,'ML',NULL,'Mali',1),(148,'MT',NULL,'Malte',1),(149,'MH',NULL,'Iles Marshall',1),(150,'MQ',NULL,'Martinique',1),(151,'MR',NULL,'Mauritanie',1),(152,'MU',NULL,'Maurice',1),(153,'YT',NULL,'Mayotte',1),(154,'MX',NULL,'Mexique',1),(155,'FM',NULL,'Micronésie',1),(156,'MD',NULL,'Moldavie',1),(157,'MN',NULL,'Mongolie',1),(158,'MS',NULL,'Monserrat',1),(159,'MZ',NULL,'Mozambique',1),(160,'MM',NULL,'Birmanie (Myanmar)',1),(161,'NA',NULL,'Namibie',1),(162,'NR',NULL,'Nauru',1),(163,'NP',NULL,'Népal',1),(164,'AN',NULL,'Antilles néerlandaises',1),(165,'NC',NULL,'Nouvelle-Calédonie',1),(166,'NZ',NULL,'Nouvelle-Zélande',1),(167,'NI',NULL,'Nicaragua',1),(168,'NE',NULL,'Niger',1),(169,'NG',NULL,'Nigeria',1),(170,'NU',NULL,'Nioué',1),(171,'NF',NULL,'Ile Norfolk',1),(172,'MP',NULL,'Mariannes du Nord',1),(173,'NO',NULL,'Norvège',1),(174,'OM',NULL,'Oman',1),(175,'PK',NULL,'Pakistan',1),(176,'PW',NULL,'Palaos',1),(177,'PS',NULL,'territoire Palestinien Occupé',1),(178,'PA',NULL,'Panama',1),(179,'PG',NULL,'Papouasie-Nouvelle-Guinée',1),(180,'PY',NULL,'Paraguay',1),(181,'PE',NULL,'Pérou',1),(182,'PH',NULL,'Philippines',1),(183,'PN',NULL,'Iles Pitcairn',1),(184,'PL',NULL,'Pologne',1),(185,'PR',NULL,'Porto Rico',1),(186,'QA',NULL,'Qatar',1),(187,'RE',NULL,'Réunion',1),(188,'RO',NULL,'Roumanie',1),(189,'RW',NULL,'Rwanda',1),(190,'SH',NULL,'Sainte-Hélène',1),(191,'KN',NULL,'Saint-Christophe-et-Niévès',1),(192,'LC',NULL,'Sainte-Lucie',1),(193,'PM',NULL,'Saint-Pierre-et-Miquelon',1),(194,'VC',NULL,'Saint-Vincent-et-les-Grenadines',1),(195,'WS',NULL,'Samoa',1),(196,'SM',NULL,'Saint-Marin',1),(197,'ST',NULL,'Sao Tomé-et-Principe',1),(198,'RS',NULL,'Serbie',1),(199,'SC',NULL,'Seychelles',1),(200,'SL',NULL,'Sierra Leone',1),(201,'SK',NULL,'Slovaquie',1),(202,'SI',NULL,'Slovénie',1),(203,'SB',NULL,'Iles Salomon',1),(204,'SO',NULL,'Somalie',1),(205,'ZA',NULL,'Afrique du Sud',1),(206,'GS',NULL,'Iles Géorgie du Sud et Sandwich du Sud',1),(207,'LK',NULL,'Sri Lanka',1),(208,'SD',NULL,'Soudan',1),(209,'SR',NULL,'Suriname',1),(210,'SJ',NULL,'Iles Svalbard et Jan Mayen',1),(211,'SZ',NULL,'Swaziland',1),(212,'SY',NULL,'Syrie',1),(213,'TW',NULL,'Taïwan',1),(214,'TJ',NULL,'Tadjikistan',1),(215,'TZ',NULL,'Tanzanie',1),(216,'TH',NULL,'Thaïlande',1),(217,'TL',NULL,'Timor Oriental',1),(218,'TK',NULL,'Tokélaou',1),(219,'TO',NULL,'Tonga',1),(220,'TT',NULL,'Trinité-et-Tobago',1),(221,'TR',NULL,'Turquie',1),(222,'TM',NULL,'Turkménistan',1),(223,'TC',NULL,'Iles Turks-et-Caicos',1),(224,'TV',NULL,'Tuvalu',1),(225,'UG',NULL,'Ouganda',1),(226,'UA',NULL,'Ukraine',1),(227,'AE',NULL,'Émirats arabes unis',1),(228,'UM',NULL,'Iles mineures éloignées des États-Unis',1),(229,'UY',NULL,'Uruguay',1),(230,'UZ',NULL,'Ouzbékistan',1),(231,'VU',NULL,'Vanuatu',1),(232,'VE',NULL,'Vénézuela',1),(233,'VN',NULL,'Viêt Nam',1),(234,'VG',NULL,'Iles Vierges britanniques',1),(235,'VI',NULL,'Iles Vierges américaines',1),(236,'WF',NULL,'Wallis-et-Futuna',1),(237,'EH',NULL,'Sahara occidental',1),(238,'YE',NULL,'Yémen',1),(239,'ZM',NULL,'Zambie',1),(240,'ZW',NULL,'Zimbabwe',1),(241,'GG',NULL,'Guernesey',1),(242,'IM',NULL,'Ile de Man',1),(243,'JE',NULL,'Jersey',1),(244,'ME',NULL,'Monténégro',1),(245,'BL',NULL,'Saint-Barthélemy',1),(246,'MF',NULL,'Saint-Martin',1); +/*!40000 ALTER TABLE `llx_c_pays` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_c_price_expression` +-- + +DROP TABLE IF EXISTS `llx_c_price_expression`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_c_price_expression` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `title` varchar(20) NOT NULL, + `expression` varchar(80) NOT NULL, + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_c_price_expression` +-- + +LOCK TABLES `llx_c_price_expression` WRITE; +/*!40000 ALTER TABLE `llx_c_price_expression` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_c_price_expression` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_c_price_global_variable` +-- + +DROP TABLE IF EXISTS `llx_c_price_global_variable`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_c_price_global_variable` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `code` varchar(20) NOT NULL, + `description` text, + `value` double(24,8) DEFAULT '0.00000000', + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_c_price_global_variable` +-- + +LOCK TABLES `llx_c_price_global_variable` WRITE; +/*!40000 ALTER TABLE `llx_c_price_global_variable` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_c_price_global_variable` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_c_price_global_variable_updater` +-- + +DROP TABLE IF EXISTS `llx_c_price_global_variable_updater`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_c_price_global_variable_updater` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `type` int(11) NOT NULL, + `description` text, + `parameters` text, + `fk_variable` int(11) NOT NULL, + `update_interval` int(11) DEFAULT '0', + `next_update` int(11) DEFAULT '0', + `last_status` text, + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_c_price_global_variable_updater` +-- + +LOCK TABLES `llx_c_price_global_variable_updater` WRITE; +/*!40000 ALTER TABLE `llx_c_price_global_variable_updater` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_c_price_global_variable_updater` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_c_propalst` +-- + +DROP TABLE IF EXISTS `llx_c_propalst`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_c_propalst` ( + `id` smallint(6) NOT NULL, + `code` varchar(12) NOT NULL, + `label` varchar(30) DEFAULT NULL, + `active` tinyint(4) NOT NULL DEFAULT '1', + PRIMARY KEY (`id`), + UNIQUE KEY `uk_c_propalst` (`code`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_c_propalst` +-- + +LOCK TABLES `llx_c_propalst` WRITE; +/*!40000 ALTER TABLE `llx_c_propalst` DISABLE KEYS */; +INSERT INTO `llx_c_propalst` VALUES (0,'PR_DRAFT','Brouillon',1),(1,'PR_OPEN','Ouverte',1),(2,'PR_SIGNED','Signée',1),(3,'PR_NOTSIGNED','Non Signée',1),(4,'PR_FAC','Facturée',1); +/*!40000 ALTER TABLE `llx_c_propalst` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_c_prospectlevel` +-- + +DROP TABLE IF EXISTS `llx_c_prospectlevel`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_c_prospectlevel` ( + `code` varchar(12) NOT NULL, + `label` varchar(30) DEFAULT NULL, + `sortorder` smallint(6) DEFAULT NULL, + `active` smallint(6) NOT NULL DEFAULT '1', + `module` varchar(32) DEFAULT NULL, + PRIMARY KEY (`code`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_c_prospectlevel` +-- + +LOCK TABLES `llx_c_prospectlevel` WRITE; +/*!40000 ALTER TABLE `llx_c_prospectlevel` DISABLE KEYS */; +INSERT INTO `llx_c_prospectlevel` VALUES ('PL_HIGH','High',4,1,NULL),('PL_LOW','Low',2,1,NULL),('PL_MEDIUM','Medium',3,1,NULL),('PL_NONE','None',1,1,NULL); +/*!40000 ALTER TABLE `llx_c_prospectlevel` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_c_regions` +-- + +DROP TABLE IF EXISTS `llx_c_regions`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_c_regions` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `code_region` int(11) NOT NULL, + `fk_pays` int(11) NOT NULL, + `cheflieu` varchar(50) DEFAULT NULL, + `tncc` int(11) DEFAULT NULL, + `nom` varchar(50) DEFAULT NULL, + `active` tinyint(4) NOT NULL DEFAULT '1', + PRIMARY KEY (`rowid`), + UNIQUE KEY `code_region` (`code_region`), + UNIQUE KEY `uk_code_region` (`code_region`), + KEY `idx_c_regions_fk_pays` (`fk_pays`), + CONSTRAINT `fk_c_regions_fk_pays` FOREIGN KEY (`fk_pays`) REFERENCES `llx_c_pays` (`rowid`) +) ENGINE=InnoDB AUTO_INCREMENT=23344 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_c_regions` +-- + +LOCK TABLES `llx_c_regions` WRITE; +/*!40000 ALTER TABLE `llx_c_regions` DISABLE KEYS */; +INSERT INTO `llx_c_regions` VALUES (1,0,0,'0',0,'-',1),(101,1,1,'97105',3,'Guadeloupe',1),(102,2,1,'97209',3,'Martinique',1),(103,3,1,'97302',3,'Guyane',1),(104,4,1,'97411',3,'Réunion',1),(105,11,1,'75056',1,'Île-de-France',1),(106,21,1,'51108',0,'Champagne-Ardenne',1),(107,22,1,'80021',0,'Picardie',1),(108,23,1,'76540',0,'Haute-Normandie',1),(109,24,1,'45234',2,'Centre',1),(110,25,1,'14118',0,'Basse-Normandie',1),(111,26,1,'21231',0,'Bourgogne',1),(112,31,1,'59350',2,'Nord-Pas-de-Calais',1),(113,41,1,'57463',0,'Lorraine',1),(114,42,1,'67482',1,'Alsace',1),(115,43,1,'25056',0,'Franche-Comté',1),(116,52,1,'44109',4,'Pays de la Loire',1),(117,53,1,'35238',0,'Bretagne',1),(118,54,1,'86194',2,'Poitou-Charentes',1),(119,72,1,'33063',1,'Aquitaine',1),(120,73,1,'31555',0,'Midi-Pyrénées',1),(121,74,1,'87085',2,'Limousin',1),(122,82,1,'69123',2,'Rhône-Alpes',1),(123,83,1,'63113',1,'Auvergne',1),(124,91,1,'34172',2,'Languedoc-Roussillon',1),(125,93,1,'13055',0,'Provence-Alpes-Côte d\'Azur',1),(126,94,1,'2A004',0,'Corse',1),(201,201,2,'',1,'Flandre',1),(202,202,2,'',2,'Wallonie',1),(203,203,2,'',3,'Bruxelles-Capitale',1),(301,301,3,NULL,1,'Abruzzo',1),(302,302,3,NULL,1,'Basilicata',1),(303,303,3,NULL,1,'Calabria',1),(304,304,3,NULL,1,'Campania',1),(305,305,3,NULL,1,'Emilia-Romagna',1),(306,306,3,NULL,1,'Friuli-Venezia Giulia',1),(307,307,3,NULL,1,'Lazio',1),(308,308,3,NULL,1,'Liguria',1),(309,309,3,NULL,1,'Lombardia',1),(310,310,3,NULL,1,'Marche',1),(311,311,3,NULL,1,'Molise',1),(312,312,3,NULL,1,'Piemonte',1),(313,313,3,NULL,1,'Puglia',1),(314,314,3,NULL,1,'Sardegna',1),(315,315,3,NULL,1,'Sicilia',1),(316,316,3,NULL,1,'Toscana',1),(317,317,3,NULL,1,'Trentino-Alto Adige',1),(318,318,3,NULL,1,'Umbria',1),(319,319,3,NULL,1,'Valle d Aosta',1),(320,320,3,NULL,1,'Veneto',1),(401,401,4,'',0,'Andalucia',1),(402,402,4,'',0,'Aragón',1),(403,403,4,'',0,'Castilla y León',1),(404,404,4,'',0,'Castilla la Mancha',1),(405,405,4,'',0,'Canarias',1),(406,406,4,'',0,'Cataluña',1),(407,407,4,'',0,'Comunidad de Ceuta',1),(408,408,4,'',0,'Comunidad Foral de Navarra',1),(409,409,4,'',0,'Comunidad de Melilla',1),(410,410,4,'',0,'Cantabria',1),(411,411,4,'',0,'Comunidad Valenciana',1),(412,412,4,'',0,'Extemadura',1),(413,413,4,'',0,'Galicia',1),(414,414,4,'',0,'Islas Baleares',1),(415,415,4,'',0,'La Rioja',1),(416,416,4,'',0,'Comunidad de Madrid',1),(417,417,4,'',0,'Región de Murcia',1),(418,418,4,'',0,'Principado de Asturias',1),(419,419,4,'',0,'Pais Vasco',1),(601,601,6,'',1,'Cantons',1),(1001,1001,10,'',0,'Ariana',1),(1002,1002,10,'',0,'Béja',1),(1003,1003,10,'',0,'Ben Arous',1),(1004,1004,10,'',0,'Bizerte',1),(1005,1005,10,'',0,'Gabès',1),(1006,1006,10,'',0,'Gafsa',1),(1007,1007,10,'',0,'Jendouba',1),(1008,1008,10,'',0,'Kairouan',1),(1009,1009,10,'',0,'Kasserine',1),(1010,1010,10,'',0,'Kébili',1),(1011,1011,10,'',0,'La Manouba',1),(1012,1012,10,'',0,'Le Kef',1),(1013,1013,10,'',0,'Mahdia',1),(1014,1014,10,'',0,'Médenine',1),(1015,1015,10,'',0,'Monastir',1),(1016,1016,10,'',0,'Nabeul',1),(1017,1017,10,'',0,'Sfax',1),(1018,1018,10,'',0,'Sidi Bouzid',1),(1019,1019,10,'',0,'Siliana',1),(1020,1020,10,'',0,'Sousse',1),(1021,1021,10,'',0,'Tataouine',1),(1022,1022,10,'',0,'Tozeur',1),(1023,1023,10,'',0,'Tunis',1),(1024,1024,10,'',0,'Zaghouan',1),(1101,1101,11,'',0,'United-States',1),(1201,1201,12,'',0,'Tanger-Tétouan',1),(1202,1202,12,'',0,'Gharb-Chrarda-Beni Hssen',1),(1203,1203,12,'',0,'Taza-Al Hoceima-Taounate',1),(1204,1204,12,'',0,'L\'Oriental',1),(1205,1205,12,'',0,'Fès-Boulemane',1),(1206,1206,12,'',0,'Meknès-Tafialet',1),(1207,1207,12,'',0,'Rabat-Salé-Zemour-Zaër',1),(1208,1208,12,'',0,'Grand Cassablanca',1),(1209,1209,12,'',0,'Chaouia-Ouardigha',1),(1210,1210,12,'',0,'Doukahla-Adba',1),(1211,1211,12,'',0,'Marrakech-Tensift-Al Haouz',1),(1212,1212,12,'',0,'Tadla-Azilal',1),(1213,1213,12,'',0,'Sous-Massa-Drâa',1),(1214,1214,12,'',0,'Guelmim-Es Smara',1),(1215,1215,12,'',0,'Laâyoune-Boujdour-Sakia el Hamra',1),(1216,1216,12,'',0,'Oued Ed-Dahab Lagouira',1),(1301,1301,13,'',0,'Algerie',1),(2301,2301,23,'',0,'Norte',1),(2302,2302,23,'',0,'Litoral',1),(2303,2303,23,'',0,'Cuyana',1),(2304,2304,23,'',0,'Central',1),(2305,2305,23,'',0,'Patagonia',1),(2801,2801,28,'',0,'Australia',1),(4601,4601,46,'',0,'Barbados',1),(6701,6701,67,NULL,NULL,'Tarapacá',1),(6702,6702,67,NULL,NULL,'Antofagasta',1),(6703,6703,67,NULL,NULL,'Atacama',1),(6704,6704,67,NULL,NULL,'Coquimbo',1),(6705,6705,67,NULL,NULL,'Valparaíso',1),(6706,6706,67,NULL,NULL,'General Bernardo O Higgins',1),(6707,6707,67,NULL,NULL,'Maule',1),(6708,6708,67,NULL,NULL,'Biobío',1),(6709,6709,67,NULL,NULL,'Raucanía',1),(6710,6710,67,NULL,NULL,'Los Lagos',1),(6711,6711,67,NULL,NULL,'Aysén General Carlos Ibáñez del Campo',1),(6712,6712,67,NULL,NULL,'Magallanes y Antártica Chilena',1),(6713,6713,67,NULL,NULL,'Santiago',1),(6714,6714,67,NULL,NULL,'Los Ríos',1),(6715,6715,67,NULL,NULL,'Arica y Parinacota',1),(7001,7001,70,'',0,'Colombie',1),(8601,8601,86,NULL,NULL,'Central',1),(8602,8602,86,NULL,NULL,'Oriental',1),(8603,8603,86,NULL,NULL,'Occidental',1),(10201,10201,102,NULL,NULL,'??????',1),(10202,10202,102,NULL,NULL,'?????? ??????',1),(10203,10203,102,NULL,NULL,'???????? ?????????',1),(10204,10204,102,NULL,NULL,'?????',1),(10205,10205,102,NULL,NULL,'????????? ????????? ??? ?????',1),(10206,10206,102,NULL,NULL,'???????',1),(10207,10207,102,NULL,NULL,'????? ?????',1),(10208,10208,102,NULL,NULL,'?????? ??????',1),(10209,10209,102,NULL,NULL,'????????????',1),(10210,10210,102,NULL,NULL,'????? ??????',1),(10211,10211,102,NULL,NULL,'?????? ??????',1),(10212,10212,102,NULL,NULL,'????????',1),(10213,10213,102,NULL,NULL,'?????? ?????????',1),(11401,11401,114,'',0,'Honduras',1),(11701,11701,117,'',0,'India',1),(15201,15201,152,'',0,'Rivière Noire',1),(15202,15202,152,'',0,'Flacq',1),(15203,15203,152,'',0,'Grand Port',1),(15204,15204,152,'',0,'Moka',1),(15205,15205,152,'',0,'Pamplemousses',1),(15206,15206,152,'',0,'Plaines Wilhems',1),(15207,15207,152,'',0,'Port-Louis',1),(15208,15208,152,'',0,'Rivière du Rempart',1),(15209,15209,152,'',0,'Savanne',1),(15210,15210,152,'',0,'Rodrigues',1),(15211,15211,152,'',0,'Les îles Agaléga',1),(15212,15212,152,'',0,'Les écueils des Cargados Carajos',1),(15401,15401,154,'',0,'Mexique',1),(23201,23201,232,'',0,'Los Andes',1),(23202,23202,232,'',0,'Capital',1),(23203,23203,232,'',0,'Central',1),(23204,23204,232,'',0,'Cento Occidental',1),(23205,23205,232,'',0,'Guayana',1),(23206,23206,232,'',0,'Insular',1),(23207,23207,232,'',0,'Los Llanos',1),(23208,23208,232,'',0,'Nor-Oriental',1),(23209,23209,232,'',0,'Zuliana',1),(23215,6,1,'97601',3,'Mayotte',1),(23280,420,4,'',0,'Otros',1),(23281,501,5,'',0,'Deutschland',1),(23296,701,7,'',0,'England',1),(23297,702,7,'',0,'Wales',1),(23298,703,7,'',0,'Scotland',1),(23299,704,7,'',0,'Northern Ireland',1),(23325,1401,14,'',0,'Canada',1),(23326,1701,17,'',0,'Provincies van Nederland ',1),(23333,5601,56,'',0,'Brasil',1),(23334,5201,52,'',0,'Chuquisaca',1),(23335,5202,52,'',0,'La Paz',1),(23336,5203,52,'',0,'Cochabamba',1),(23337,5204,52,'',0,'Oruro',1),(23338,5205,52,'',0,'Potosí',1),(23339,5206,52,'',0,'Tarija',1),(23340,5207,52,'',0,'Santa Cruz',1),(23341,5208,52,'',0,'El Beni',1),(23342,5209,52,'',0,'Pando',1),(23343,4101,41,'',0,'Österreich',1); +/*!40000 ALTER TABLE `llx_c_regions` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_c_revenuestamp` +-- + +DROP TABLE IF EXISTS `llx_c_revenuestamp`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_c_revenuestamp` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `fk_pays` int(11) NOT NULL, + `taux` double NOT NULL, + `note` varchar(128) DEFAULT NULL, + `active` tinyint(4) NOT NULL DEFAULT '1', + `accountancy_code_sell` varchar(32) DEFAULT NULL, + `accountancy_code_buy` varchar(32) DEFAULT NULL, + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB AUTO_INCREMENT=102 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_c_revenuestamp` +-- + +LOCK TABLES `llx_c_revenuestamp` WRITE; +/*!40000 ALTER TABLE `llx_c_revenuestamp` DISABLE KEYS */; +INSERT INTO `llx_c_revenuestamp` VALUES (101,10,0.4,'Revenue stamp tunisia',1,NULL,NULL); +/*!40000 ALTER TABLE `llx_c_revenuestamp` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_c_shipment_mode` +-- + +DROP TABLE IF EXISTS `llx_c_shipment_mode`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_c_shipment_mode` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `code` varchar(30) NOT NULL, + `libelle` varchar(50) NOT NULL, + `description` text, + `tracking` varchar(256) NOT NULL, + `active` tinyint(4) DEFAULT '0', + `module` varchar(32) DEFAULT NULL, + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_c_shipment_mode` +-- + +LOCK TABLES `llx_c_shipment_mode` WRITE; +/*!40000 ALTER TABLE `llx_c_shipment_mode` DISABLE KEYS */; +INSERT INTO `llx_c_shipment_mode` VALUES (1,'2010-10-09 23:43:16','CATCH','Catch','Catch by client','',1,NULL),(2,'2010-10-09 23:43:16','TRANS','Transporter','Generic transporter','',1,NULL),(3,'2010-10-09 23:43:16','COLSUI','Colissimo Suivi','Colissimo Suivi','',0,NULL),(4,'2011-07-18 17:28:27','LETTREMAX','Lettre Max','Courrier Suivi et Lettre Max','',0,NULL),(9,'2013-02-24 01:48:18','UPS','UPS','United Parcel Service','http://wwwapps.ups.com/etracking/tracking.cgi?InquiryNumber2=&InquiryNumber3=&tracknums_displayed=3&loc=fr_FR&TypeOfInquiryNumber=T&HTMLVersion=4.0&InquiryNumber22=&InquiryNumber32=&track=Track&Suivi.x=64&Suivi.y=7&Suivi=Valider&InquiryNumber1={TRACKID}',0,NULL),(10,'2013-02-24 01:48:18','KIALA','KIALA','Relais Kiala','http://www.kiala.fr/tnt/delivery/{TRACKID}',0,NULL),(11,'2013-02-24 01:48:18','GLS','GLS','General Logistics Systems','http://www.gls-group.eu/276-I-PORTAL-WEB/content/GLS/FR01/FR/5004.htm?txtAction=71000&txtRefNo={TRACKID}',0,NULL),(12,'2013-02-24 01:48:18','CHRONO','Chronopost','Chronopost','http://www.chronopost.fr/expedier/inputLTNumbersNoJahia.do?listeNumeros={TRACKID}',0,NULL); +/*!40000 ALTER TABLE `llx_c_shipment_mode` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_c_stcomm` +-- + +DROP TABLE IF EXISTS `llx_c_stcomm`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_c_stcomm` ( + `id` int(11) NOT NULL, + `code` varchar(12) NOT NULL, + `libelle` varchar(30) DEFAULT NULL, + `active` tinyint(4) NOT NULL DEFAULT '1', + `picto` varchar(128) DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `uk_c_stcomm` (`code`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_c_stcomm` +-- + +LOCK TABLES `llx_c_stcomm` WRITE; +/*!40000 ALTER TABLE `llx_c_stcomm` DISABLE KEYS */; +INSERT INTO `llx_c_stcomm` VALUES (-1,'ST_NO','Do not contact',1,NULL),(0,'ST_NEVER','Never contacted',1,NULL),(1,'ST_TODO','To contact',1,NULL),(2,'ST_PEND','Contact in progress',1,NULL),(3,'ST_DONE','Contacted',1,NULL); +/*!40000 ALTER TABLE `llx_c_stcomm` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_c_tva` +-- + +DROP TABLE IF EXISTS `llx_c_tva`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_c_tva` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `fk_pays` int(11) NOT NULL, + `code` varchar(10) DEFAULT '', + `taux` double NOT NULL, + `localtax1` varchar(20) DEFAULT NULL, + `localtax1_type` varchar(10) NOT NULL DEFAULT '0', + `localtax2` varchar(20) DEFAULT NULL, + `localtax2_type` varchar(10) NOT NULL DEFAULT '0', + `recuperableonly` int(11) NOT NULL DEFAULT '0', + `note` varchar(128) DEFAULT NULL, + `active` tinyint(4) NOT NULL DEFAULT '1', + `accountancy_code_sell` varchar(32) DEFAULT NULL, + `accountancy_code_buy` varchar(32) DEFAULT NULL, + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_c_tva_id` (`fk_pays`,`code`,`taux`,`recuperableonly`) +) ENGINE=InnoDB AUTO_INCREMENT=2469 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_c_tva` +-- + +LOCK TABLES `llx_c_tva` WRITE; +/*!40000 ALTER TABLE `llx_c_tva` DISABLE KEYS */; +INSERT INTO `llx_c_tva` VALUES (11,1,'',20,NULL,'0',NULL,'0',0,'VAT standard rate (France hors DOM-TOM)',1,NULL,NULL),(12,1,'',8.5,NULL,'0',NULL,'0',0,'VAT standard rate (DOM sauf Guyane et Saint-Martin)',0,NULL,NULL),(13,1,'',8.5,NULL,'0',NULL,'0',1,'VAT standard rate (DOM sauf Guyane et Saint-Martin), non perçu par le vendeur mais récupérable par acheteur',0,NULL,NULL),(14,1,'',5.5,NULL,'0',NULL,'0',0,'VAT reduced rate (France hors DOM-TOM)',1,NULL,NULL),(15,1,'',0,NULL,'0',NULL,'0',0,'VAT Rate 0 ou non applicable',1,NULL,NULL),(16,1,'',2.1,NULL,'0',NULL,'0',0,'VAT super-reduced rate',1,NULL,NULL),(17,1,'',10,NULL,'0',NULL,'0',0,'VAT reduced rate',1,NULL,NULL),(21,2,'',21,NULL,'0',NULL,'0',0,'VAT standard rate',1,NULL,NULL),(22,2,'',6,NULL,'0',NULL,'0',0,'VAT reduced rate',1,NULL,NULL),(23,2,'',0,NULL,'0',NULL,'0',0,'VAT Rate 0 ou non applicable',1,NULL,NULL),(24,2,'',12,NULL,'0',NULL,'0',0,'VAT reduced rate',1,NULL,NULL),(31,3,'',21,NULL,'0',NULL,'0',0,'VAT standard rate',1,NULL,NULL),(32,3,'',10,NULL,'0',NULL,'0',0,'VAT reduced rate',1,NULL,NULL),(33,3,'',4,NULL,'0',NULL,'0',0,'VAT super-reduced rate',1,NULL,NULL),(34,3,'',0,NULL,'0',NULL,'0',0,'VAT Rate 0',1,NULL,NULL),(41,4,'',21,'5.2','3','-19:-15:-9','5',0,'VAT standard rate',1,NULL,NULL),(42,4,'',10,'1.4','3','-19:-15:-9','5',0,'VAT reduced rate',1,NULL,NULL),(43,4,'',4,'0.5','3','-19:-15:-9','5',0,'VAT super-reduced rate',1,NULL,NULL),(44,4,'',0,'0','3','-19:-15:-9','5',0,'VAT Rate 0',1,NULL,NULL),(51,5,'',19,NULL,'0',NULL,'0',0,'allgemeine Ust.',1,NULL,NULL),(52,5,'',7,NULL,'0',NULL,'0',0,'ermäßigte USt.',1,NULL,NULL),(53,5,'',0,NULL,'0',NULL,'0',0,'keine USt.',1,NULL,NULL),(54,5,'',5.5,NULL,'0',NULL,'0',0,'USt. Forst',0,NULL,NULL),(55,5,'',10.7,NULL,'0',NULL,'0',0,'USt. Landwirtschaft',0,NULL,NULL),(61,6,'',8,NULL,'0',NULL,'0',0,'VAT standard rate',1,NULL,NULL),(62,6,'',3.8,NULL,'0',NULL,'0',0,'VAT reduced rate',1,NULL,NULL),(63,6,'',2.5,NULL,'0',NULL,'0',0,'VAT super-reduced rate',1,NULL,NULL),(64,6,'',0,NULL,'0',NULL,'0',0,'VAT Rate 0',1,NULL,NULL),(71,7,'',20,NULL,'0',NULL,'0',0,'VAT standard rate',1,NULL,NULL),(72,7,'',17.5,NULL,'0',NULL,'0',0,'VAT standard rate before 2011',1,NULL,NULL),(73,7,'',5,NULL,'0',NULL,'0',0,'VAT reduced rate',1,NULL,NULL),(74,7,'',0,NULL,'0',NULL,'0',0,'VAT Rate 0',1,NULL,NULL),(81,8,'',0,NULL,'0',NULL,'0',0,'VAT Rate 0',1,NULL,NULL),(82,8,'',23,NULL,'0',NULL,'0',0,'VAT standard rate',1,NULL,NULL),(83,8,'',13.5,NULL,'0',NULL,'0',0,'VAT reduced rate',1,NULL,NULL),(84,8,'',9,NULL,'0',NULL,'0',0,'VAT reduced rate',1,NULL,NULL),(85,8,'',4.8,NULL,'0',NULL,'0',0,'VAT reduced rate',1,NULL,NULL),(91,9,'',17,NULL,'0',NULL,'0',0,'VAT standard rate',1,NULL,NULL),(92,9,'',13,NULL,'0',NULL,'0',0,'VAT reduced rate 0',1,NULL,NULL),(93,9,'',3,NULL,'0',NULL,'0',0,'VAT super reduced rate 0',1,NULL,NULL),(94,9,'',0,NULL,'0',NULL,'0',0,'VAT Rate 0',1,NULL,NULL),(101,10,'',6,'1','4','0','0',0,'VAT 6%',1,NULL,NULL),(102,10,'',12,'1','4','0','0',0,'VAT 12%',1,NULL,NULL),(103,10,'',18,'1','4','0','0',0,'VAT 18%',1,NULL,NULL),(104,10,'',7.5,'1','4','0','0',0,'VAT 6% Majoré à 25% (7.5%)',1,NULL,NULL),(105,10,'',15,'1','4','0','0',0,'VAT 12% Majoré à 25% (15%)',1,NULL,NULL),(106,10,'',22.5,'1','4','0','0',0,'VAT 18% Majoré à 25% (22.5%)',1,NULL,NULL),(107,10,'',0,'1','4','0','0',0,'VAT Rate 0',1,NULL,NULL),(111,11,'',0,NULL,'0',NULL,'0',0,'No Sales Tax',1,NULL,NULL),(112,11,'',4,NULL,'0',NULL,'0',0,'Sales Tax 4%',1,NULL,NULL),(113,11,'',6,NULL,'0',NULL,'0',0,'Sales Tax 6%',1,NULL,NULL),(121,12,'',20,NULL,'0',NULL,'0',0,'VAT standard rate',1,NULL,NULL),(122,12,'',14,NULL,'0',NULL,'0',0,'VAT reduced rate',1,NULL,NULL),(123,12,'',10,NULL,'0',NULL,'0',0,'VAT reduced rate',1,NULL,NULL),(124,12,'',7,NULL,'0',NULL,'0',0,'VAT super-reduced rate',1,NULL,NULL),(125,12,'',0,NULL,'0',NULL,'0',0,'VAT Rate 0',1,NULL,NULL),(141,14,'',7,NULL,'0',NULL,'0',0,'VAT standard rate',1,NULL,NULL),(142,14,'',0,NULL,'0',NULL,'0',0,'VAT Rate 0',1,NULL,NULL),(143,14,'',5,'9.975','1',NULL,'0',0,'GST/TPS and PST/TVQ rate for Province',1,NULL,NULL),(171,17,'',19,NULL,'0',NULL,'0',0,'Algemeen BTW tarief',1,NULL,NULL),(172,17,'',6,NULL,'0',NULL,'0',0,'Verlaagd BTW tarief',1,NULL,NULL),(173,17,'',0,NULL,'0',NULL,'0',0,'0 BTW tarief',1,NULL,NULL),(174,17,'',21,NULL,'0',NULL,'0',0,'Algemeen BTW tarief (vanaf 1 oktober 2012)',0,NULL,NULL),(201,20,'',25,NULL,'0',NULL,'0',0,'VAT standard rate',1,NULL,NULL),(202,20,'',12,NULL,'0',NULL,'0',0,'VAT reduced rate',1,NULL,NULL),(203,20,'',6,NULL,'0',NULL,'0',0,'VAT super-reduced rate',1,NULL,NULL),(204,20,'',0,NULL,'0',NULL,'0',0,'VAT Rate 0',1,NULL,NULL),(211,21,'',0,'0','0','0','0',0,'IVA Rate 0',1,NULL,NULL),(212,21,'',18,'7.5','2','0','0',0,'IVA standard rate',1,NULL,NULL),(221,22,'',18,NULL,'0',NULL,'0',0,'VAT standard rate',1,NULL,NULL),(222,22,'',10,NULL,'0',NULL,'0',0,'VAT reduced rate',1,NULL,NULL),(223,22,'',0,NULL,'0',NULL,'0',0,'VAT Rate 0',1,NULL,NULL),(231,23,'',21,NULL,'0',NULL,'0',0,'IVA standard rate',1,NULL,NULL),(232,23,'',10.5,NULL,'0',NULL,'0',0,'IVA reduced rate',1,NULL,NULL),(233,23,'',0,NULL,'0',NULL,'0',0,'IVA Rate 0',1,NULL,NULL),(241,24,'',19.25,NULL,'0',NULL,'0',0,'VAT standard rate',1,NULL,NULL),(242,24,'',0,NULL,'0',NULL,'0',0,'VAT Rate 0',1,NULL,NULL),(251,25,'',23,NULL,'0',NULL,'0',0,'VAT standard rate',1,NULL,NULL),(252,25,'',13,NULL,'0',NULL,'0',0,'VAT reduced rate',1,NULL,NULL),(253,25,'',0,NULL,'0',NULL,'0',0,'VAT Rate 0',1,NULL,NULL),(254,25,'',6,NULL,'0',NULL,'0',0,'VAT reduced rate',1,NULL,NULL),(261,26,'',0,NULL,'0',NULL,'0',0,'VAT Rate 0',1,NULL,NULL),(271,27,'',19.6,NULL,'0',NULL,'0',0,'VAT standard rate (France hors DOM-TOM)',1,NULL,NULL),(272,27,'',8.5,NULL,'0',NULL,'0',0,'VAT standard rate (DOM sauf Guyane et Saint-Martin)',0,NULL,NULL),(273,27,'',8.5,NULL,'0',NULL,'0',1,'VAT standard rate (DOM sauf Guyane et Saint-Martin), non perçu par le vendeur mais récupérable par acheteur',0,NULL,NULL),(274,27,'',5.5,NULL,'0',NULL,'0',0,'VAT reduced rate (France hors DOM-TOM)',0,NULL,NULL),(275,27,'',0,NULL,'0',NULL,'0',0,'VAT Rate 0 ou non applicable',1,NULL,NULL),(276,27,'',2.1,NULL,'0',NULL,'0',0,'VAT super-reduced rate',1,NULL,NULL),(277,27,'',7,NULL,'0',NULL,'0',0,'VAT reduced rate',1,NULL,NULL),(281,28,'',10,NULL,'0',NULL,'0',0,'VAT standard rate',1,NULL,NULL),(282,28,'',0,NULL,'0',NULL,'0',0,'VAT Rate 0',1,NULL,NULL),(411,41,'',20,NULL,'0',NULL,'0',0,'VAT standard rate',1,NULL,NULL),(412,41,'',10,NULL,'0',NULL,'0',0,'VAT reduced rate',1,NULL,NULL),(413,41,'',0,NULL,'0',NULL,'0',0,'VAT Rate 0',1,NULL,NULL),(461,46,'',0,NULL,'0',NULL,'0',0,'No VAT',1,NULL,NULL),(462,46,'',15,NULL,'0',NULL,'0',0,'VAT 15%',1,NULL,NULL),(463,46,'',7.5,NULL,'0',NULL,'0',0,'VAT 7.5%',1,NULL,NULL),(561,56,'',0,NULL,'0',NULL,'0',0,'VAT reduced rate',1,NULL,NULL),(591,59,'',20,NULL,'0',NULL,'0',0,'VAT standard rate',1,NULL,NULL),(592,59,'',7,NULL,'0',NULL,'0',0,'VAT reduced rate',1,NULL,NULL),(593,59,'',0,NULL,'0',NULL,'0',0,'VAT Rate 0',1,NULL,NULL),(671,67,'',19,NULL,'0',NULL,'0',0,'VAT standard rate',1,NULL,NULL),(672,67,'',0,NULL,'0',NULL,'0',0,'VAT Rate 0',1,NULL,NULL),(801,80,'',25,NULL,'0',NULL,'0',0,'VAT standard rate',1,NULL,NULL),(802,80,'',0,NULL,'0',NULL,'0',0,'VAT Rate 0',1,NULL,NULL),(861,86,'',13,NULL,'0',NULL,'0',0,'IVA 13',1,NULL,NULL),(862,86,'',0,NULL,'0',NULL,'0',0,'SIN IVA',1,NULL,NULL),(1141,114,'',0,NULL,'0',NULL,'0',0,'No ISV',1,NULL,NULL),(1142,114,'',12,NULL,'0',NULL,'0',0,'ISV 12%',1,NULL,NULL),(1161,116,'',25.5,NULL,'0',NULL,'0',0,'VAT standard rate',1,NULL,NULL),(1162,116,'',7,NULL,'0',NULL,'0',0,'VAT reduced rate',1,NULL,NULL),(1163,116,'',0,NULL,'0',NULL,'0',0,'VAT rate 0',1,NULL,NULL),(1171,117,'',12.5,NULL,'0',NULL,'0',0,'VAT standard rate',1,NULL,NULL),(1172,117,'',4,NULL,'0',NULL,'0',0,'VAT reduced rate',1,NULL,NULL),(1173,117,'',1,NULL,'0',NULL,'0',0,'VAT super-reduced rate',1,NULL,NULL),(1174,117,'',0,NULL,'0',NULL,'0',0,'VAT Rate 0',1,NULL,NULL),(1231,123,'',0,NULL,'0',NULL,'0',0,'VAT Rate 0',1,NULL,NULL),(1232,123,'',5,NULL,'0',NULL,'0',0,'VAT Rate 5',1,NULL,NULL),(1401,140,'',15,NULL,'0',NULL,'0',0,'VAT standard rate',1,NULL,NULL),(1402,140,'',12,NULL,'0',NULL,'0',0,'VAT reduced rate',1,NULL,NULL),(1403,140,'',6,NULL,'0',NULL,'0',0,'VAT reduced rate',1,NULL,NULL),(1404,140,'',3,NULL,'0',NULL,'0',0,'VAT super-reduced rate',1,NULL,NULL),(1405,140,'',0,NULL,'0',NULL,'0',0,'VAT Rate 0',1,NULL,NULL),(1481,148,'',18,NULL,'0',NULL,'0',0,'VAT standard rate',1,NULL,NULL),(1482,148,'',7,NULL,'0',NULL,'0',0,'VAT reduced rate',1,NULL,NULL),(1483,148,'',5,NULL,'0',NULL,'0',0,'VAT super-reduced rate',1,NULL,NULL),(1484,148,'',0,NULL,'0',NULL,'0',0,'VAT Rate 0',1,NULL,NULL),(1511,151,'',0,NULL,'0',NULL,'0',0,'VAT Rate 0',1,NULL,NULL),(1512,151,'',14,NULL,'0',NULL,'0',0,'VAT Rate 14',1,NULL,NULL),(1521,152,'',0,NULL,'0',NULL,'0',0,'VAT Rate 0',1,NULL,NULL),(1522,152,'',15,NULL,'0',NULL,'0',0,'VAT Rate 15',1,NULL,NULL),(1541,154,'',0,NULL,'0',NULL,'0',0,'No VAT',1,NULL,NULL),(1542,154,'',16,NULL,'0',NULL,'0',0,'VAT 16%',1,NULL,NULL),(1543,154,'',10,NULL,'0',NULL,'0',0,'VAT Frontero',1,NULL,NULL),(1662,166,'',15,NULL,'0',NULL,'0',0,'VAT standard rate',1,NULL,NULL),(1663,166,'',0,NULL,'0',NULL,'0',0,'VAT Rate 0',1,NULL,NULL),(1692,169,'',5,NULL,'0',NULL,'0',0,'VAT standard rate',1,NULL,NULL),(1693,169,'',0,NULL,'0',NULL,'0',0,'VAT Rate 0',1,NULL,NULL),(1731,173,'',25,NULL,'0',NULL,'0',0,'VAT standard rate',1,NULL,NULL),(1732,173,'',14,NULL,'0',NULL,'0',0,'VAT reduced rate',1,NULL,NULL),(1733,173,'',8,NULL,'0',NULL,'0',0,'VAT reduced rate',1,NULL,NULL),(1734,173,'',0,NULL,'0',NULL,'0',0,'VAT Rate 0',1,NULL,NULL),(1811,181,'',18,NULL,'0',NULL,'0',0,'VAT standard rate',1,NULL,NULL),(1812,181,'',0,NULL,'0',NULL,'0',0,'VAT Rate 0',1,NULL,NULL),(1841,184,'',20,NULL,'0',NULL,'0',0,'VAT standard rate',1,NULL,NULL),(1842,184,'',7,NULL,'0',NULL,'0',0,'VAT reduced rate',1,NULL,NULL),(1843,184,'',3,NULL,'0',NULL,'0',0,'VAT reduced rate',1,NULL,NULL),(1844,184,'',0,NULL,'0',NULL,'0',0,'VAT Rate 0',1,NULL,NULL),(1881,188,'',24,NULL,'0',NULL,'0',0,'VAT standard rate',1,NULL,NULL),(1882,188,'',9,NULL,'0',NULL,'0',0,'VAT reduced rate',1,NULL,NULL),(1883,188,'',0,NULL,'0',NULL,'0',0,'VAT Rate 0',1,NULL,NULL),(1884,188,'',5,NULL,'0',NULL,'0',0,'VAT reduced rate',1,NULL,NULL),(1931,193,'',0,NULL,'0',NULL,'0',0,'No VAT in SPM',1,NULL,NULL),(2011,201,'',19,NULL,'0',NULL,'0',0,'VAT standard rate',1,NULL,NULL),(2012,201,'',10,NULL,'0',NULL,'0',0,'VAT reduced rate',1,NULL,NULL),(2013,201,'',0,NULL,'0',NULL,'0',0,'VAT Rate 0',1,NULL,NULL),(2021,202,'',22,NULL,'0',NULL,'0',0,'VAT standard rate',1,NULL,NULL),(2022,202,'',9.5,NULL,'0',NULL,'0',0,'VAT reduced rate',1,NULL,NULL),(2023,202,'',0,NULL,'0',NULL,'0',0,'VAT Rate 0',1,NULL,NULL),(2051,205,'',0,NULL,'0',NULL,'0',0,'No VAT',1,NULL,NULL),(2052,205,'',14,NULL,'0',NULL,'0',0,'VAT 14%',1,NULL,NULL),(2131,213,'',5,NULL,'0',NULL,'0',0,'VAT 5%',1,NULL,NULL),(2261,226,'',20,NULL,'0',NULL,'0',0,'VAT standart rate',1,NULL,NULL),(2262,226,'',0,NULL,'0',NULL,'0',0,'VAT Rate 0',1,NULL,NULL),(2321,232,'',0,NULL,'0',NULL,'0',0,'No VAT',1,NULL,NULL),(2322,232,'',12,NULL,'0',NULL,'0',0,'VAT 12%',1,NULL,NULL),(2323,232,'',8,NULL,'0',NULL,'0',0,'VAT 8%',1,NULL,NULL),(2461,246,'',0,NULL,'0',NULL,'0',0,'VAT Rate 0',1,NULL,NULL),(2462,102,'',23,'0','0','0','0',0,'Κανονικός Φ.Π.Α.',1,NULL,NULL),(2463,102,'',0,'0','0','0','0',0,'Μηδενικό Φ.Π.Α.',1,NULL,NULL),(2464,102,'',13,'0','0','0','0',0,'Μειωμένος Φ.Π.Α.',1,NULL,NULL),(2465,102,'',6.5,'0','0','0','0',0,'Υπερμειωμένος Φ.Π.Α.',1,NULL,NULL),(2466,102,'',16,'0','0','0','0',0,'Νήσων κανονικός Φ.Π.Α.',1,NULL,NULL),(2467,102,'',9,'0','0','0','0',0,'Νήσων μειωμένος Φ.Π.Α.',1,NULL,NULL),(2468,102,'',5,'0','0','0','0',0,'Νήσων υπερμειωμένος Φ.Π.Α.',1,NULL,NULL); +/*!40000 ALTER TABLE `llx_c_tva` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_c_type_contact` +-- + +DROP TABLE IF EXISTS `llx_c_type_contact`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_c_type_contact` ( + `rowid` int(11) NOT NULL, + `element` varchar(30) NOT NULL, + `source` varchar(8) NOT NULL DEFAULT 'external', + `code` varchar(32) NOT NULL, + `libelle` varchar(64) NOT NULL, + `active` tinyint(4) NOT NULL DEFAULT '1', + `module` varchar(32) DEFAULT NULL, + `position` int(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_c_type_contact_id` (`element`,`source`,`code`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_c_type_contact` +-- + +LOCK TABLES `llx_c_type_contact` WRITE; +/*!40000 ALTER TABLE `llx_c_type_contact` DISABLE KEYS */; +INSERT INTO `llx_c_type_contact` VALUES (10,'contrat','internal','SALESREPSIGN','Commercial signataire du contrat',1,NULL,0),(11,'contrat','internal','SALESREPFOLL','Commercial suivi du contrat',1,NULL,0),(20,'contrat','external','BILLING','Contact client facturation contrat',1,NULL,0),(21,'contrat','external','CUSTOMER','Contact client suivi contrat',1,NULL,0),(22,'contrat','external','SALESREPSIGN','Contact client signataire contrat',1,NULL,0),(31,'propal','internal','SALESREPFOLL','Commercial à l\'origine de la propale',1,NULL,0),(40,'propal','external','BILLING','Contact client facturation propale',1,NULL,0),(41,'propal','external','CUSTOMER','Contact client suivi propale',1,NULL,0),(50,'facture','internal','SALESREPFOLL','Responsable suivi du paiement',1,NULL,0),(60,'facture','external','BILLING','Contact client facturation',1,NULL,0),(61,'facture','external','SHIPPING','Contact client livraison',1,NULL,0),(62,'facture','external','SERVICE','Contact client prestation',1,NULL,0),(70,'invoice_supplier','internal','SALESREPFOLL','Responsable suivi du paiement',1,NULL,0),(71,'invoice_supplier','external','BILLING','Contact fournisseur facturation',1,NULL,0),(72,'invoice_supplier','external','SHIPPING','Contact fournisseur livraison',1,NULL,0),(73,'invoice_supplier','external','SERVICE','Contact fournisseur prestation',1,NULL,0),(80,'agenda','internal','ACTOR','Responsable',1,NULL,0),(81,'agenda','internal','GUEST','Guest',1,NULL,0),(85,'agenda','external','ACTOR','Responsable',1,NULL,0),(86,'agenda','external','GUEST','Guest',1,NULL,0),(91,'commande','internal','SALESREPFOLL','Responsable suivi de la commande',1,NULL,0),(100,'commande','external','BILLING','Contact client facturation commande',1,NULL,0),(101,'commande','external','CUSTOMER','Contact client suivi commande',1,NULL,0),(102,'commande','external','SHIPPING','Contact client livraison commande',1,NULL,0),(120,'fichinter','internal','INTERREPFOLL','Responsable suivi de l\'intervention',1,NULL,0),(121,'fichinter','internal','INTERVENING','Intervenant',1,NULL,0),(130,'fichinter','external','BILLING','Contact client facturation intervention',1,NULL,0),(131,'fichinter','external','CUSTOMER','Contact client suivi de l\'intervention',1,NULL,0),(140,'order_supplier','internal','SALESREPFOLL','Responsable suivi de la commande',1,NULL,0),(141,'order_supplier','internal','SHIPPING','Responsable réception de la commande',1,NULL,0),(142,'order_supplier','external','BILLING','Contact fournisseur facturation commande',1,NULL,0),(143,'order_supplier','external','CUSTOMER','Contact fournisseur suivi commande',1,NULL,0),(145,'order_supplier','external','SHIPPING','Contact fournisseur livraison commande',1,NULL,0),(150,'dolresource','internal','USERINCHARGE','In charge of resource',1,NULL,0),(151,'dolresource','external','THIRDINCHARGE','In charge of resource',1,NULL,0),(160,'project','internal','PROJECTLEADER','Chef de Projet',1,NULL,0),(161,'project','internal','PROJECTCONTRIBUTOR','Intervenant',1,NULL,0),(170,'project','external','PROJECTLEADER','Chef de Projet',1,NULL,0),(171,'project','external','PROJECTCONTRIBUTOR','Intervenant',1,NULL,0),(180,'project_task','internal','TASKEXECUTIVE','Responsable',1,NULL,0),(181,'project_task','internal','TASKCONTRIBUTOR','Intervenant',1,NULL,0),(190,'project_task','external','TASKEXECUTIVE','Responsable',1,NULL,0),(191,'project_task','external','TASKCONTRIBUTOR','Intervenant',1,NULL,0),(200,'societe','external','GENERALREF','Généraliste (référent)',0,'cabinetmed',0),(201,'societe','external','GENERALISTE','Généraliste',0,'cabinetmed',0),(210,'societe','external','SPECCHIROR','Chirurgien ortho',0,'cabinetmed',0),(211,'societe','external','SPECCHIROT','Chirurgien autre',0,'cabinetmed',0),(220,'societe','external','SPECDERMA','Dermatologue',0,'cabinetmed',0),(225,'societe','external','SPECENDOC','Endocrinologue',0,'cabinetmed',0),(230,'societe','external','SPECGYNECO','Gynécologue',0,'cabinetmed',0),(240,'societe','external','SPECGASTRO','Gastroantérologue',0,'cabinetmed',0),(245,'societe','external','SPECINTERNE','Interniste',0,'cabinetmed',0),(250,'societe','external','SPECCARDIO','Cardiologue',0,'cabinetmed',0),(260,'societe','external','SPECNEPHRO','Néphrologue',0,'cabinetmed',0),(263,'societe','external','SPECPNEUMO','Pneumologue',0,'cabinetmed',0),(265,'societe','external','SPECNEURO','Neurologue',0,'cabinetmed',0),(270,'societe','external','SPECRHUMATO','Rhumatologue',0,'cabinetmed',0),(280,'societe','external','KINE','Kinésithérapeute',0,'cabinetmed',0); +/*!40000 ALTER TABLE `llx_c_type_contact` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_c_type_fees` +-- + +DROP TABLE IF EXISTS `llx_c_type_fees`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_c_type_fees` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `code` varchar(12) NOT NULL, + `label` varchar(30) DEFAULT NULL, + `accountancy_code` varchar(32) DEFAULT NULL, + `active` tinyint(4) NOT NULL DEFAULT '1', + `module` varchar(32) DEFAULT NULL, + `position` int(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + UNIQUE KEY `uk_c_type_fees` (`code`) +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_c_type_fees` +-- + +LOCK TABLES `llx_c_type_fees` WRITE; +/*!40000 ALTER TABLE `llx_c_type_fees` DISABLE KEYS */; +INSERT INTO `llx_c_type_fees` VALUES (1,'TF_OTHER','Other',NULL,1,NULL,0),(2,'TF_TRIP','Trip',NULL,1,NULL,0),(3,'TF_LUNCH','Lunch',NULL,1,NULL,0); +/*!40000 ALTER TABLE `llx_c_type_fees` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_c_type_resource` +-- + +DROP TABLE IF EXISTS `llx_c_type_resource`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_c_type_resource` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `code` varchar(32) NOT NULL, + `label` varchar(64) NOT NULL, + `active` tinyint(4) NOT NULL DEFAULT '1', + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_c_type_resource_id` (`label`,`code`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_c_type_resource` +-- + +LOCK TABLES `llx_c_type_resource` WRITE; +/*!40000 ALTER TABLE `llx_c_type_resource` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_c_type_resource` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_c_typent` +-- + +DROP TABLE IF EXISTS `llx_c_typent`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_c_typent` ( + `id` int(11) NOT NULL, + `code` varchar(12) NOT NULL, + `libelle` varchar(30) DEFAULT NULL, + `fk_country` int(11) DEFAULT NULL, + `active` tinyint(4) NOT NULL DEFAULT '1', + `module` varchar(32) DEFAULT NULL, + `position` int(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + UNIQUE KEY `uk_c_typent` (`code`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_c_typent` +-- + +LOCK TABLES `llx_c_typent` WRITE; +/*!40000 ALTER TABLE `llx_c_typent` DISABLE KEYS */; +INSERT INTO `llx_c_typent` VALUES (0,'TE_UNKNOWN','-',NULL,1,NULL,0),(1,'TE_STARTUP','Start-up',NULL,0,NULL,0),(2,'TE_GROUP','Grand groupe',NULL,1,NULL,0),(3,'TE_MEDIUM','PME/PMI',NULL,1,NULL,0),(4,'TE_SMALL','TPE',NULL,1,NULL,0),(5,'TE_ADMIN','Administration',NULL,1,NULL,0),(6,'TE_WHOLE','Grossiste',NULL,0,NULL,0),(7,'TE_RETAIL','Revendeur',NULL,0,NULL,0),(8,'TE_PRIVATE','Particulier',NULL,1,NULL,0),(100,'TE_OTHER','Autres',NULL,1,NULL,0),(231,'TE_A_RI','Responsable Inscripto',23,0,NULL,0),(232,'TE_B_RNI','Responsable No Inscripto',23,0,NULL,0),(233,'TE_C_FE','Consumidor Final/Exento',23,0,NULL,0); +/*!40000 ALTER TABLE `llx_c_typent` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_c_units` +-- + +DROP TABLE IF EXISTS `llx_c_units`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_c_units` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `code` varchar(3) DEFAULT NULL, + `label` varchar(50) DEFAULT NULL, + `short_label` varchar(5) DEFAULT NULL, + `active` tinyint(4) NOT NULL DEFAULT '1', + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_c_units_code` (`code`) +) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_c_units` +-- + +LOCK TABLES `llx_c_units` WRITE; +/*!40000 ALTER TABLE `llx_c_units` DISABLE KEYS */; +INSERT INTO `llx_c_units` VALUES (1,'P','piece','p',1),(2,'SET','set','se',1),(3,'S','second','s',1),(4,'H','hour','h',1),(5,'D','day','d',1),(6,'KG','kilogram','kg',1),(7,'G','gram','g',1),(8,'M','meter','m',1),(9,'LM','linear meter','lm',1),(10,'M2','square meter','m2',1),(11,'M3','cubic meter','m3',1),(12,'L','liter','l',1); +/*!40000 ALTER TABLE `llx_c_units` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_c_ziptown` +-- + +DROP TABLE IF EXISTS `llx_c_ziptown`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_c_ziptown` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `code` varchar(5) DEFAULT NULL, + `fk_county` int(11) DEFAULT NULL, + `fk_pays` int(11) NOT NULL DEFAULT '0', + `zip` varchar(10) NOT NULL, + `town` varchar(255) NOT NULL, + `active` tinyint(4) NOT NULL DEFAULT '1', + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_ziptown_fk_pays` (`zip`,`town`,`fk_pays`), + KEY `idx_c_ziptown_fk_county` (`fk_county`), + KEY `idx_c_ziptown_fk_pays` (`fk_pays`), + KEY `idx_c_ziptown_zip` (`zip`), + CONSTRAINT `fk_c_ziptown_fk_county` FOREIGN KEY (`fk_county`) REFERENCES `llx_c_departements` (`rowid`), + CONSTRAINT `fk_c_ziptown_fk_pays` FOREIGN KEY (`fk_pays`) REFERENCES `llx_c_pays` (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_c_ziptown` +-- + +LOCK TABLES `llx_c_ziptown` WRITE; +/*!40000 ALTER TABLE `llx_c_ziptown` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_c_ziptown` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_categorie` +-- + +DROP TABLE IF EXISTS `llx_categorie`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_categorie` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `fk_parent` int(11) NOT NULL DEFAULT '0', + `label` varchar(255) NOT NULL, + `type` tinyint(4) NOT NULL DEFAULT '1', + `entity` int(11) NOT NULL DEFAULT '1', + `description` text, + `fk_soc` int(11) DEFAULT NULL, + `visible` tinyint(4) NOT NULL DEFAULT '1', + `import_key` varchar(14) DEFAULT NULL, + `color` varchar(8) DEFAULT NULL, + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_categorie_ref` (`entity`,`fk_parent`,`label`,`type`), + KEY `idx_categorie_type` (`type`), + KEY `idx_categorie_label` (`label`) +) ENGINE=InnoDB AUTO_INCREMENT=30 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_categorie` +-- + +LOCK TABLES `llx_categorie` WRITE; +/*!40000 ALTER TABLE `llx_categorie` DISABLE KEYS */; +INSERT INTO `llx_categorie` VALUES (1,0,'Preferred Partners',1,1,'This category is used to tag suppliers that are Prefered Partners',NULL,0,NULL,'005fbf'),(2,0,'MyCategory',1,1,'This is description of MyCategory for customer and prospects
',NULL,0,NULL,NULL),(3,7,'Hot products',1,1,'This is description of hot products
',NULL,0,NULL,NULL),(4,0,'Merchant',1,1,'Category dedicated to merchant third parties',NULL,0,NULL,'bf5f00'),(5,7,'Bio Fairtrade',0,1,'',NULL,0,NULL,NULL),(6,7,'Bio AB',0,1,'',NULL,0,NULL,NULL),(7,9,'Bio',0,1,'This product is a BIO product',NULL,0,NULL,NULL),(8,7,'Bio Dynamic',0,1,'',NULL,0,NULL,NULL),(9,0,'High Quality Product',0,1,'Label dedicated for High quality products',NULL,0,NULL,'7f7f00'),(10,0,'Reserved for VIP',0,1,'Product of thi category are reserved to VIP customers',NULL,0,NULL,'7f0000'),(11,9,'ISO',0,1,'Product of this category has an ISO label',NULL,0,NULL,NULL),(12,0,'VIP',2,1,'',NULL,0,NULL,'bf5f00'),(13,0,'Region North',2,1,'Customer of North Region',NULL,0,NULL,'7f007f'),(14,0,'Regular customer',2,1,'',NULL,0,NULL,'5fbf00'),(15,13,'Region North A',2,1,'',NULL,0,NULL,'bf00bf'),(17,0,'MyTag1',4,1,'',NULL,0,NULL,NULL),(18,0,'Met during meeting',4,1,'',NULL,0,NULL,'ff7f00'),(19,17,'MySubTag1',4,1,'',NULL,0,NULL,NULL),(20,13,'Region North B',2,1,'',NULL,0,NULL,'bf005f'),(21,0,'Region South',2,1,'',NULL,0,NULL,NULL),(22,21,'Region South A',2,1,'',NULL,0,NULL,NULL),(23,21,'Region South B',2,1,'',NULL,0,NULL,NULL),(24,0,'Limited Edition',0,1,'This is a limited edition',NULL,0,NULL,'ff7f00'),(25,0,'Imported products',0,1,'For product we have to import from another country',NULL,0,NULL,NULL),(26,28,'Friends',4,1,'Category of friends contact',NULL,0,NULL,'00bf00'),(27,28,'Family',4,1,'Category of family contacts',NULL,0,NULL,'007f3f'),(28,0,'Personal contacts',4,1,'For personal contacts',NULL,0,NULL,'007f3f'),(29,0,'Online only merchant',1,1,'',NULL,0,NULL,'aaaaff'); +/*!40000 ALTER TABLE `llx_categorie` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_categorie_account` +-- + +DROP TABLE IF EXISTS `llx_categorie_account`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_categorie_account` ( + `fk_categorie` int(11) NOT NULL, + `fk_account` int(11) NOT NULL, + `import_key` varchar(14) DEFAULT NULL, + PRIMARY KEY (`fk_categorie`,`fk_account`), + KEY `idx_categorie_account_fk_categorie` (`fk_categorie`), + KEY `idx_categorie_account_fk_account` (`fk_account`), + CONSTRAINT `fk_categorie_account_categorie_rowid` FOREIGN KEY (`fk_categorie`) REFERENCES `llx_categorie` (`rowid`), + CONSTRAINT `fk_categorie_account_fk_account` FOREIGN KEY (`fk_account`) REFERENCES `llx_bank_account` (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_categorie_account` +-- + +LOCK TABLES `llx_categorie_account` WRITE; +/*!40000 ALTER TABLE `llx_categorie_account` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_categorie_account` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_categorie_association` +-- + +DROP TABLE IF EXISTS `llx_categorie_association`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_categorie_association` ( + `fk_categorie_mere` int(11) NOT NULL, + `fk_categorie_fille` int(11) NOT NULL, + UNIQUE KEY `uk_categorie_association` (`fk_categorie_mere`,`fk_categorie_fille`), + UNIQUE KEY `uk_categorie_association_fk_categorie_fille` (`fk_categorie_fille`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_categorie_association` +-- + +LOCK TABLES `llx_categorie_association` WRITE; +/*!40000 ALTER TABLE `llx_categorie_association` DISABLE KEYS */; +INSERT INTO `llx_categorie_association` VALUES (3,5),(9,11); +/*!40000 ALTER TABLE `llx_categorie_association` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_categorie_contact` +-- + +DROP TABLE IF EXISTS `llx_categorie_contact`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_categorie_contact` ( + `fk_categorie` int(11) NOT NULL, + `fk_socpeople` int(11) NOT NULL, + `import_key` varchar(14) DEFAULT NULL, + PRIMARY KEY (`fk_categorie`,`fk_socpeople`), + KEY `idx_categorie_contact_fk_categorie` (`fk_categorie`), + KEY `idx_categorie_contact_fk_socpeople` (`fk_socpeople`), + CONSTRAINT `fk_categorie_contact_categorie_rowid` FOREIGN KEY (`fk_categorie`) REFERENCES `llx_categorie` (`rowid`), + CONSTRAINT `fk_categorie_contact_fk_socpeople` FOREIGN KEY (`fk_socpeople`) REFERENCES `llx_socpeople` (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_categorie_contact` +-- + +LOCK TABLES `llx_categorie_contact` WRITE; +/*!40000 ALTER TABLE `llx_categorie_contact` DISABLE KEYS */; +INSERT INTO `llx_categorie_contact` VALUES (18,3,NULL),(18,6,NULL),(19,6,NULL),(26,9,NULL),(27,7,NULL),(27,8,NULL),(27,10,NULL); +/*!40000 ALTER TABLE `llx_categorie_contact` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_categorie_fournisseur` +-- + +DROP TABLE IF EXISTS `llx_categorie_fournisseur`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_categorie_fournisseur` ( + `fk_categorie` int(11) NOT NULL, + `fk_soc` int(11) NOT NULL, + `import_key` varchar(14) DEFAULT NULL, + PRIMARY KEY (`fk_categorie`,`fk_soc`), + KEY `idx_categorie_fournisseur_fk_categorie` (`fk_categorie`), + KEY `idx_categorie_fournisseur_fk_societe` (`fk_soc`), + CONSTRAINT `fk_categorie_fournisseur_categorie_rowid` FOREIGN KEY (`fk_categorie`) REFERENCES `llx_categorie` (`rowid`), + CONSTRAINT `fk_categorie_fournisseur_fk_soc` FOREIGN KEY (`fk_soc`) REFERENCES `llx_societe` (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_categorie_fournisseur` +-- + +LOCK TABLES `llx_categorie_fournisseur` WRITE; +/*!40000 ALTER TABLE `llx_categorie_fournisseur` DISABLE KEYS */; +INSERT INTO `llx_categorie_fournisseur` VALUES (1,2,NULL),(1,10,NULL),(9,2,NULL); +/*!40000 ALTER TABLE `llx_categorie_fournisseur` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_categorie_lang` +-- + +DROP TABLE IF EXISTS `llx_categorie_lang`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_categorie_lang` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `fk_category` int(11) NOT NULL DEFAULT '0', + `lang` varchar(5) NOT NULL DEFAULT '0', + `label` varchar(255) NOT NULL, + `description` text, + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_category_lang` (`fk_category`,`lang`), + CONSTRAINT `fk_category_lang_fk_category` FOREIGN KEY (`fk_category`) REFERENCES `llx_categorie` (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_categorie_lang` +-- + +LOCK TABLES `llx_categorie_lang` WRITE; +/*!40000 ALTER TABLE `llx_categorie_lang` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_categorie_lang` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_categorie_member` +-- + +DROP TABLE IF EXISTS `llx_categorie_member`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_categorie_member` ( + `fk_categorie` int(11) NOT NULL, + `fk_member` int(11) NOT NULL, + PRIMARY KEY (`fk_categorie`,`fk_member`), + KEY `idx_categorie_member_fk_categorie` (`fk_categorie`), + KEY `idx_categorie_member_fk_member` (`fk_member`), + CONSTRAINT `fk_categorie_member_categorie_rowid` FOREIGN KEY (`fk_categorie`) REFERENCES `llx_categorie` (`rowid`), + CONSTRAINT `fk_categorie_member_member_rowid` FOREIGN KEY (`fk_member`) REFERENCES `llx_adherent` (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_categorie_member` +-- + +LOCK TABLES `llx_categorie_member` WRITE; +/*!40000 ALTER TABLE `llx_categorie_member` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_categorie_member` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_categorie_product` +-- + +DROP TABLE IF EXISTS `llx_categorie_product`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_categorie_product` ( + `fk_categorie` int(11) NOT NULL, + `fk_product` int(11) NOT NULL, + `import_key` varchar(14) DEFAULT NULL, + PRIMARY KEY (`fk_categorie`,`fk_product`), + KEY `idx_categorie_product_fk_categorie` (`fk_categorie`), + KEY `idx_categorie_product_fk_product` (`fk_product`), + CONSTRAINT `fk_categorie_product_categorie_rowid` FOREIGN KEY (`fk_categorie`) REFERENCES `llx_categorie` (`rowid`), + CONSTRAINT `fk_categorie_product_product_rowid` FOREIGN KEY (`fk_product`) REFERENCES `llx_product` (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_categorie_product` +-- + +LOCK TABLES `llx_categorie_product` WRITE; +/*!40000 ALTER TABLE `llx_categorie_product` DISABLE KEYS */; +INSERT INTO `llx_categorie_product` VALUES (5,2,NULL),(6,2,NULL),(8,4,NULL),(9,5,NULL),(9,12,NULL),(10,3,NULL),(10,4,NULL),(24,1,NULL),(24,11,NULL),(25,10,NULL); +/*!40000 ALTER TABLE `llx_categorie_product` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_categorie_project` +-- + +DROP TABLE IF EXISTS `llx_categorie_project`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_categorie_project` ( + `fk_categorie` int(11) NOT NULL, + `fk_project` int(11) NOT NULL, + `import_key` varchar(14) DEFAULT NULL, + PRIMARY KEY (`fk_categorie`,`fk_project`), + KEY `idx_categorie_project_fk_categorie` (`fk_categorie`), + KEY `idx_categorie_project_fk_project` (`fk_project`), + CONSTRAINT `fk_categorie_project_categorie_rowid` FOREIGN KEY (`fk_categorie`) REFERENCES `llx_categorie` (`rowid`), + CONSTRAINT `fk_categorie_project_fk_project` FOREIGN KEY (`fk_project`) REFERENCES `llx_projet` (`rowid`), + CONSTRAINT `fk_categorie_project_fk_project_rowid` FOREIGN KEY (`fk_project`) REFERENCES `llx_projet` (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_categorie_project` +-- + +LOCK TABLES `llx_categorie_project` WRITE; +/*!40000 ALTER TABLE `llx_categorie_project` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_categorie_project` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_categorie_societe` +-- + +DROP TABLE IF EXISTS `llx_categorie_societe`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_categorie_societe` ( + `fk_categorie` int(11) NOT NULL, + `fk_soc` int(11) NOT NULL, + `import_key` varchar(14) DEFAULT NULL, + PRIMARY KEY (`fk_categorie`,`fk_soc`), + KEY `idx_categorie_societe_fk_categorie` (`fk_categorie`), + KEY `idx_categorie_societe_fk_societe` (`fk_soc`), + CONSTRAINT `fk_categorie_societe_categorie_rowid` FOREIGN KEY (`fk_categorie`) REFERENCES `llx_categorie` (`rowid`), + CONSTRAINT `fk_categorie_societe_fk_soc` FOREIGN KEY (`fk_soc`) REFERENCES `llx_societe` (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_categorie_societe` +-- + +LOCK TABLES `llx_categorie_societe` WRITE; +/*!40000 ALTER TABLE `llx_categorie_societe` DISABLE KEYS */; +INSERT INTO `llx_categorie_societe` VALUES (2,2,NULL),(2,19,NULL),(12,10,NULL); +/*!40000 ALTER TABLE `llx_categorie_societe` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_categorie_user` +-- + +DROP TABLE IF EXISTS `llx_categorie_user`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_categorie_user` ( + `fk_categorie` int(11) NOT NULL, + `fk_user` int(11) NOT NULL, + `import_key` varchar(14) DEFAULT NULL, + PRIMARY KEY (`fk_categorie`,`fk_user`), + KEY `idx_categorie_user_fk_categorie` (`fk_categorie`), + KEY `idx_categorie_user_fk_user` (`fk_user`), + CONSTRAINT `fk_categorie_user_categorie_rowid` FOREIGN KEY (`fk_categorie`) REFERENCES `llx_categorie` (`rowid`), + CONSTRAINT `fk_categorie_user_fk_user` FOREIGN KEY (`fk_user`) REFERENCES `llx_user` (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_categorie_user` +-- + +LOCK TABLES `llx_categorie_user` WRITE; +/*!40000 ALTER TABLE `llx_categorie_user` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_categorie_user` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_categories_extrafields` +-- + +DROP TABLE IF EXISTS `llx_categories_extrafields`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_categories_extrafields` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `fk_object` int(11) NOT NULL, + `import_key` varchar(14) DEFAULT NULL, + PRIMARY KEY (`rowid`), + KEY `idx_categories_extrafields` (`fk_object`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_categories_extrafields` +-- + +LOCK TABLES `llx_categories_extrafields` WRITE; +/*!40000 ALTER TABLE `llx_categories_extrafields` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_categories_extrafields` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_chargesociales` +-- + +DROP TABLE IF EXISTS `llx_chargesociales`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_chargesociales` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `date_ech` datetime NOT NULL, + `libelle` varchar(80) NOT NULL, + `entity` int(11) NOT NULL DEFAULT '1', + `fk_type` int(11) NOT NULL, + `amount` double NOT NULL DEFAULT '0', + `paye` smallint(6) NOT NULL DEFAULT '0', + `periode` date DEFAULT NULL, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `date_creation` datetime DEFAULT NULL, + `date_valid` datetime DEFAULT NULL, + `import_key` varchar(14) DEFAULT NULL, + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_chargesociales` +-- + +LOCK TABLES `llx_chargesociales` WRITE; +/*!40000 ALTER TABLE `llx_chargesociales` DISABLE KEYS */; +INSERT INTO `llx_chargesociales` VALUES (4,'2011-08-09 00:00:00','fff',1,60,10,1,'2011-08-01','2012-12-08 13:11:10',NULL,NULL,NULL); +/*!40000 ALTER TABLE `llx_chargesociales` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_commande` +-- + +DROP TABLE IF EXISTS `llx_commande`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_commande` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `fk_soc` int(11) NOT NULL, + `fk_projet` int(11) DEFAULT NULL, + `ref` varchar(30) NOT NULL, + `entity` int(11) NOT NULL DEFAULT '1', + `ref_ext` varchar(255) DEFAULT NULL, + `ref_int` varchar(255) DEFAULT NULL, + `ref_client` varchar(255) DEFAULT NULL, + `date_creation` datetime DEFAULT NULL, + `date_valid` datetime DEFAULT NULL, + `date_cloture` datetime DEFAULT NULL, + `date_commande` date DEFAULT NULL, + `fk_user_author` int(11) DEFAULT NULL, + `fk_user_modif` int(11) DEFAULT NULL, + `fk_user_valid` int(11) DEFAULT NULL, + `fk_user_cloture` int(11) DEFAULT NULL, + `source` smallint(6) DEFAULT NULL, + `fk_statut` smallint(6) DEFAULT '0', + `amount_ht` double DEFAULT '0', + `remise_percent` double DEFAULT '0', + `remise_absolue` double DEFAULT '0', + `remise` double DEFAULT '0', + `tva` double(24,8) DEFAULT '0.00000000', + `localtax1` double(24,8) DEFAULT '0.00000000', + `localtax2` double(24,8) DEFAULT '0.00000000', + `total_ht` double(24,8) DEFAULT '0.00000000', + `total_ttc` double(24,8) DEFAULT '0.00000000', + `note_private` text, + `note_public` text, + `model_pdf` varchar(255) DEFAULT NULL, + `facture` tinyint(4) DEFAULT '0', + `fk_account` int(11) DEFAULT NULL, + `fk_currency` varchar(3) DEFAULT NULL, + `fk_cond_reglement` int(11) DEFAULT NULL, + `fk_mode_reglement` int(11) DEFAULT NULL, + `date_livraison` date DEFAULT NULL, + `fk_shipping_method` int(11) DEFAULT NULL, + `fk_warehouse` int(11) DEFAULT NULL, + `fk_availability` int(11) DEFAULT NULL, + `fk_input_reason` int(11) DEFAULT NULL, + `fk_delivery_address` int(11) DEFAULT NULL, + `import_key` varchar(14) DEFAULT NULL, + `extraparams` varchar(255) DEFAULT NULL, + `fk_incoterms` int(11) DEFAULT NULL, + `location_incoterms` varchar(255) DEFAULT NULL, + `fk_multicurrency` int(11) DEFAULT NULL, + `multicurrency_code` varchar(255) DEFAULT NULL, + `multicurrency_tx` double(24,8) DEFAULT '1.00000000', + `multicurrency_total_ht` double(24,8) DEFAULT '0.00000000', + `multicurrency_total_tva` double(24,8) DEFAULT '0.00000000', + `multicurrency_total_ttc` double(24,8) DEFAULT '0.00000000', + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_commande_ref` (`ref`,`entity`), + KEY `idx_commande_fk_soc` (`fk_soc`), + KEY `idx_commande_fk_user_author` (`fk_user_author`), + KEY `idx_commande_fk_user_valid` (`fk_user_valid`), + KEY `idx_commande_fk_user_cloture` (`fk_user_cloture`), + KEY `idx_commande_fk_projet` (`fk_projet`), + KEY `idx_commande_fk_account` (`fk_account`), + KEY `idx_commande_fk_currency` (`fk_currency`), + CONSTRAINT `fk_commande_fk_projet` FOREIGN KEY (`fk_projet`) REFERENCES `llx_projet` (`rowid`), + CONSTRAINT `fk_commande_fk_soc` FOREIGN KEY (`fk_soc`) REFERENCES `llx_societe` (`rowid`), + CONSTRAINT `fk_commande_fk_user_author` FOREIGN KEY (`fk_user_author`) REFERENCES `llx_user` (`rowid`), + CONSTRAINT `fk_commande_fk_user_cloture` FOREIGN KEY (`fk_user_cloture`) REFERENCES `llx_user` (`rowid`), + CONSTRAINT `fk_commande_fk_user_valid` FOREIGN KEY (`fk_user_valid`) REFERENCES `llx_user` (`rowid`) +) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_commande` +-- + +LOCK TABLES `llx_commande` WRITE; +/*!40000 ALTER TABLE `llx_commande` DISABLE KEYS */; +INSERT INTO `llx_commande` VALUES (1,'2016-07-30 15:13:20',1,NULL,'CO1107-0002',1,NULL,NULL,'','2011-07-20 15:23:12','2016-08-08 13:59:09',NULL,'2016-07-20',1,NULL,1,NULL,NULL,1,0,0,NULL,0,0.00000000,0.00000000,0.00000000,10.00000000,10.00000000,'','','einstein',0,NULL,NULL,1,1,NULL,NULL,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1.00000000,0.00000000,0.00000000,0.00000000),(2,'2016-07-30 15:13:20',1,NULL,'CO1107-0003',1,NULL,NULL,'','2011-07-20 23:20:12','2018-02-12 17:06:51',NULL,'2016-07-21',1,NULL,1,NULL,NULL,1,0,0,NULL,0,0.00000000,0.00000000,0.00000000,10.00000000,10.00000000,'','','einstein',0,NULL,NULL,0,NULL,NULL,NULL,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1.00000000,0.00000000,0.00000000,0.00000000),(3,'2016-07-30 15:13:20',1,NULL,'CO1107-0004',1,NULL,NULL,'','2011-07-20 23:22:53','2018-02-17 18:27:56',NULL,'2016-07-21',1,NULL,1,NULL,NULL,1,0,0,NULL,0,0.00000000,0.00000000,0.00000000,30.00000000,30.00000000,'','','einstein',0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1.00000000,0.00000000,0.00000000,0.00000000),(5,'2016-07-30 15:12:32',1,NULL,'CO1108-0001',1,NULL,NULL,'','2011-08-08 03:04:11','2015-08-08 03:04:21',NULL,'2015-08-08',1,NULL,1,NULL,NULL,2,0,0,NULL,0,0.00000000,0.00000000,0.00000000,10.00000000,10.00000000,'','','einstein',0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1.00000000,0.00000000,0.00000000,0.00000000),(6,'2016-07-30 15:13:20',19,NULL,'(PROV6)',1,NULL,NULL,'','2013-02-17 16:22:14',NULL,NULL,'2016-02-17',1,NULL,NULL,NULL,NULL,0,0,0,NULL,0,11.76000000,0.00000000,0.00000000,60.00000000,71.76000000,'','','einstein',0,NULL,NULL,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1.00000000,0.00000000,0.00000000,0.00000000); +/*!40000 ALTER TABLE `llx_commande` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_commande_extrafields` +-- + +DROP TABLE IF EXISTS `llx_commande_extrafields`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_commande_extrafields` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `fk_object` int(11) NOT NULL, + `import_key` varchar(14) DEFAULT NULL, + PRIMARY KEY (`rowid`), + KEY `idx_commande_extrafields` (`fk_object`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_commande_extrafields` +-- + +LOCK TABLES `llx_commande_extrafields` WRITE; +/*!40000 ALTER TABLE `llx_commande_extrafields` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_commande_extrafields` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_commande_fournisseur` +-- + +DROP TABLE IF EXISTS `llx_commande_fournisseur`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_commande_fournisseur` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `fk_soc` int(11) NOT NULL, + `ref` varchar(255) DEFAULT NULL, + `entity` int(11) NOT NULL DEFAULT '1', + `ref_ext` varchar(255) DEFAULT NULL, + `ref_supplier` varchar(255) DEFAULT NULL, + `fk_projet` int(11) DEFAULT '0', + `date_creation` datetime DEFAULT NULL, + `date_valid` datetime DEFAULT NULL, + `date_approve` datetime DEFAULT NULL, + `date_approve2` datetime DEFAULT NULL, + `date_commande` date DEFAULT NULL, + `fk_user_author` int(11) DEFAULT NULL, + `fk_user_modif` int(11) DEFAULT NULL, + `fk_user_valid` int(11) DEFAULT NULL, + `fk_user_approve` int(11) DEFAULT NULL, + `fk_user_approve2` int(11) DEFAULT NULL, + `source` smallint(6) NOT NULL, + `fk_statut` smallint(6) DEFAULT '0', + `billed` smallint(6) DEFAULT '0', + `amount_ht` double DEFAULT '0', + `remise_percent` double DEFAULT '0', + `remise` double DEFAULT '0', + `tva` double(24,8) DEFAULT '0.00000000', + `localtax1` double(24,8) DEFAULT '0.00000000', + `localtax2` double(24,8) DEFAULT '0.00000000', + `total_ht` double(24,8) DEFAULT '0.00000000', + `total_ttc` double(24,8) DEFAULT '0.00000000', + `note_private` text, + `note_public` text, + `model_pdf` varchar(255) DEFAULT NULL, + `fk_input_method` int(11) DEFAULT '0', + `fk_cond_reglement` int(11) DEFAULT '0', + `fk_mode_reglement` int(11) DEFAULT '0', + `import_key` varchar(14) DEFAULT NULL, + `extraparams` varchar(255) DEFAULT NULL, + `date_livraison` datetime DEFAULT NULL, + `fk_account` int(11) DEFAULT NULL, + `fk_incoterms` int(11) DEFAULT NULL, + `location_incoterms` varchar(255) DEFAULT NULL, + `fk_multicurrency` int(11) DEFAULT NULL, + `multicurrency_code` varchar(255) DEFAULT NULL, + `multicurrency_tx` double(24,8) DEFAULT '1.00000000', + `multicurrency_total_ht` double(24,8) DEFAULT '0.00000000', + `multicurrency_total_tva` double(24,8) DEFAULT '0.00000000', + `multicurrency_total_ttc` double(24,8) DEFAULT '0.00000000', + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_commande_fournisseur_ref` (`ref`,`fk_soc`,`entity`), + KEY `idx_commande_fournisseur_fk_soc` (`fk_soc`), + KEY `billed` (`billed`), + CONSTRAINT `fk_commande_fournisseur_fk_soc` FOREIGN KEY (`fk_soc`) REFERENCES `llx_societe` (`rowid`) +) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_commande_fournisseur` +-- + +LOCK TABLES `llx_commande_fournisseur` WRITE; +/*!40000 ALTER TABLE `llx_commande_fournisseur` DISABLE KEYS */; +INSERT INTO `llx_commande_fournisseur` VALUES (1,'2016-07-30 16:11:52',13,'CF1007-0001',1,NULL,NULL,NULL,'2016-07-11 17:13:40','2016-07-11 17:15:42',NULL,NULL,'2016-07-11',1,NULL,1,NULL,NULL,0,5,0,0,0,0,39.20000000,0.00000000,0.00000000,200.00000000,239.20000000,NULL,NULL,'muscadet',2,0,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1.00000000,0.00000000,0.00000000,0.00000000),(2,'2016-07-30 16:11:52',1,'CF1007-0002',1,NULL,NULL,NULL,'2016-07-11 18:46:28','2016-07-11 18:47:33',NULL,NULL,'2016-07-11',1,NULL,1,NULL,NULL,0,3,0,0,0,0,0.00000000,0.00000000,0.00000000,200.00000000,200.00000000,NULL,NULL,'muscadet',4,0,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1.00000000,0.00000000,0.00000000,0.00000000),(3,'2012-12-08 13:11:07',17,'(PROV3)',1,NULL,NULL,NULL,'2011-08-04 23:00:52',NULL,NULL,NULL,NULL,1,NULL,NULL,NULL,NULL,0,0,0,0,0,0,0.00000000,0.00000000,0.00000000,0.00000000,0.00000000,NULL,NULL,'muscadet',0,0,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1.00000000,0.00000000,0.00000000,0.00000000),(4,'2012-12-08 13:11:07',17,'(PROV4)',1,NULL,NULL,NULL,'2011-08-04 23:19:32',NULL,NULL,NULL,NULL,1,NULL,NULL,NULL,NULL,0,0,0,0,0,0,0.00000000,0.00000000,0.00000000,0.00000000,0.00000000,NULL,NULL,'muscadet',0,0,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1.00000000,0.00000000,0.00000000,0.00000000),(13,'2016-07-30 16:11:52',1,'CF1303-0004',1,NULL,NULL,NULL,'2016-03-09 19:39:18','2016-03-09 19:39:27','2016-03-09 19:39:32',NULL,'2016-03-09',1,NULL,1,1,NULL,0,3,0,0,0,0,0.00000000,0.00000000,0.00000000,10.00000000,10.00000000,NULL,NULL,'muscadet',1,0,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1.00000000,0.00000000,0.00000000,0.00000000); +/*!40000 ALTER TABLE `llx_commande_fournisseur` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_commande_fournisseur_dispatch` +-- + +DROP TABLE IF EXISTS `llx_commande_fournisseur_dispatch`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_commande_fournisseur_dispatch` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `fk_commande` int(11) DEFAULT NULL, + `fk_product` int(11) DEFAULT NULL, + `fk_commandefourndet` int(11) NOT NULL DEFAULT '0', + `qty` float DEFAULT NULL, + `fk_entrepot` int(11) DEFAULT NULL, + `fk_user` int(11) DEFAULT NULL, + `datec` datetime DEFAULT NULL, + `comment` varchar(255) DEFAULT NULL, + `status` int(11) DEFAULT NULL, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `batch` varchar(30) DEFAULT NULL, + `eatby` date DEFAULT NULL, + `sellby` date DEFAULT NULL, + PRIMARY KEY (`rowid`), + KEY `idx_commande_fournisseur_dispatch_fk_commande` (`fk_commande`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_commande_fournisseur_dispatch` +-- + +LOCK TABLES `llx_commande_fournisseur_dispatch` WRITE; +/*!40000 ALTER TABLE `llx_commande_fournisseur_dispatch` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_commande_fournisseur_dispatch` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_commande_fournisseur_extrafields` +-- + +DROP TABLE IF EXISTS `llx_commande_fournisseur_extrafields`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_commande_fournisseur_extrafields` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `fk_object` int(11) NOT NULL, + `import_key` varchar(14) DEFAULT NULL, + PRIMARY KEY (`rowid`), + KEY `idx_commande_fournisseur_extrafields` (`fk_object`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_commande_fournisseur_extrafields` +-- + +LOCK TABLES `llx_commande_fournisseur_extrafields` WRITE; +/*!40000 ALTER TABLE `llx_commande_fournisseur_extrafields` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_commande_fournisseur_extrafields` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_commande_fournisseur_log` +-- + +DROP TABLE IF EXISTS `llx_commande_fournisseur_log`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_commande_fournisseur_log` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `datelog` datetime NOT NULL, + `fk_commande` int(11) NOT NULL, + `fk_statut` smallint(6) NOT NULL, + `fk_user` int(11) NOT NULL, + `comment` varchar(255) DEFAULT NULL, + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB AUTO_INCREMENT=34 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_commande_fournisseur_log` +-- + +LOCK TABLES `llx_commande_fournisseur_log` WRITE; +/*!40000 ALTER TABLE `llx_commande_fournisseur_log` DISABLE KEYS */; +INSERT INTO `llx_commande_fournisseur_log` VALUES (1,'2010-07-11 15:13:40','2010-07-11 17:13:40',1,0,1,NULL),(2,'2010-07-11 15:15:42','2010-07-11 17:15:42',1,1,1,NULL),(3,'2010-07-11 15:16:28','2010-07-11 17:16:28',1,2,1,NULL),(4,'2010-07-11 15:19:14','2010-07-11 00:00:00',1,3,1,NULL),(5,'2010-07-11 15:19:36','2010-07-11 00:00:00',1,5,1,NULL),(6,'2010-07-11 16:46:28','2010-07-11 18:46:28',2,0,1,NULL),(7,'2010-07-11 16:47:33','2010-07-11 18:47:33',2,1,1,NULL),(8,'2010-07-11 16:47:41','2010-07-11 18:47:41',2,2,1,NULL),(9,'2010-07-11 16:48:00','2010-07-11 00:00:00',2,3,1,NULL),(10,'2011-08-04 21:00:52','2011-08-04 23:00:52',3,0,1,NULL),(11,'2011-08-04 21:19:32','2011-08-04 23:19:32',4,0,1,NULL),(12,'2011-08-04 21:22:16','2011-08-04 23:22:16',5,0,1,NULL),(13,'2011-08-04 21:22:54','2011-08-04 23:22:54',6,0,1,NULL),(14,'2011-08-04 21:23:29','2011-08-04 23:23:29',7,0,1,NULL),(15,'2011-08-04 21:36:10','2011-08-04 23:36:10',8,0,1,NULL),(19,'2011-08-08 13:04:37','2011-08-08 15:04:37',6,1,1,NULL),(20,'2011-08-08 13:04:38','2011-08-08 15:04:38',6,2,1,NULL),(29,'2013-03-09 18:39:18','2013-03-09 19:39:18',13,0,1,NULL),(30,'2013-03-09 18:39:27','2013-03-09 19:39:27',13,1,1,NULL),(31,'2013-03-09 18:39:32','2013-03-09 19:39:32',13,2,1,NULL),(32,'2013-03-09 18:39:41','2013-03-09 00:00:00',13,3,1,'hf'),(33,'2013-03-22 09:26:38','2013-03-22 10:26:38',14,0,1,NULL); +/*!40000 ALTER TABLE `llx_commande_fournisseur_log` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_commande_fournisseurdet` +-- + +DROP TABLE IF EXISTS `llx_commande_fournisseurdet`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_commande_fournisseurdet` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `fk_commande` int(11) NOT NULL, + `fk_parent_line` int(11) DEFAULT NULL, + `fk_product` int(11) DEFAULT NULL, + `ref` varchar(50) DEFAULT NULL, + `label` varchar(255) DEFAULT NULL, + `description` text, + `tva_tx` double(6,3) DEFAULT '0.000', + `localtax1_tx` double(6,3) DEFAULT '0.000', + `localtax1_type` varchar(10) NOT NULL DEFAULT '0', + `localtax2_tx` double(6,3) DEFAULT '0.000', + `localtax2_type` varchar(10) NOT NULL DEFAULT '0', + `qty` double DEFAULT NULL, + `remise_percent` double DEFAULT '0', + `remise` double DEFAULT '0', + `subprice` double(24,8) DEFAULT '0.00000000', + `total_ht` double(24,8) DEFAULT '0.00000000', + `total_tva` double(24,8) DEFAULT '0.00000000', + `total_localtax1` double(24,8) DEFAULT '0.00000000', + `total_localtax2` double(24,8) DEFAULT '0.00000000', + `total_ttc` double(24,8) DEFAULT '0.00000000', + `product_type` int(11) DEFAULT '0', + `date_start` datetime DEFAULT NULL, + `date_end` datetime DEFAULT NULL, + `info_bits` int(11) DEFAULT '0', + `import_key` varchar(14) DEFAULT NULL, + `special_code` int(11) DEFAULT '0', + `rang` int(11) DEFAULT '0', + `fk_unit` int(11) DEFAULT NULL, + `fk_multicurrency` int(11) DEFAULT NULL, + `multicurrency_code` varchar(255) DEFAULT NULL, + `multicurrency_subprice` double(24,8) DEFAULT '0.00000000', + `multicurrency_total_ht` double(24,8) DEFAULT '0.00000000', + `multicurrency_total_tva` double(24,8) DEFAULT '0.00000000', + `multicurrency_total_ttc` double(24,8) DEFAULT '0.00000000', + PRIMARY KEY (`rowid`), + KEY `fk_commande_fournisseurdet_fk_unit` (`fk_unit`), + CONSTRAINT `fk_commande_fournisseurdet_fk_unit` FOREIGN KEY (`fk_unit`) REFERENCES `llx_c_units` (`rowid`) +) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_commande_fournisseurdet` +-- + +LOCK TABLES `llx_commande_fournisseurdet` WRITE; +/*!40000 ALTER TABLE `llx_commande_fournisseurdet` DISABLE KEYS */; +INSERT INTO `llx_commande_fournisseurdet` VALUES (1,1,NULL,NULL,'','','Chips',19.600,0.000,'',0.000,'',10,0,0,20.00000000,200.00000000,39.20000000,0.00000000,0.00000000,239.20000000,0,NULL,NULL,0,NULL,0,0,NULL,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000),(2,2,NULL,4,'ABCD','Decapsuleur','',0.000,0.000,'',0.000,'',20,0,0,10.00000000,200.00000000,0.00000000,0.00000000,0.00000000,200.00000000,0,NULL,NULL,0,NULL,0,0,NULL,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000),(6,13,NULL,NULL,'','','dfgdf',0.000,0.000,'0',0.000,'0',1,0,0,10.00000000,10.00000000,0.00000000,0.00000000,0.00000000,10.00000000,0,NULL,NULL,0,NULL,0,0,NULL,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000); +/*!40000 ALTER TABLE `llx_commande_fournisseurdet` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_commande_fournisseurdet_extrafields` +-- + +DROP TABLE IF EXISTS `llx_commande_fournisseurdet_extrafields`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_commande_fournisseurdet_extrafields` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `fk_object` int(11) NOT NULL, + `import_key` varchar(14) DEFAULT NULL, + PRIMARY KEY (`rowid`), + KEY `idx_commande_fournisseurdet_extrafields` (`fk_object`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_commande_fournisseurdet_extrafields` +-- + +LOCK TABLES `llx_commande_fournisseurdet_extrafields` WRITE; +/*!40000 ALTER TABLE `llx_commande_fournisseurdet_extrafields` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_commande_fournisseurdet_extrafields` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_commandedet` +-- + +DROP TABLE IF EXISTS `llx_commandedet`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_commandedet` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `fk_commande` int(11) DEFAULT NULL, + `fk_parent_line` int(11) DEFAULT NULL, + `fk_product` int(11) DEFAULT NULL, + `label` varchar(255) DEFAULT NULL, + `description` text, + `tva_tx` double(6,3) DEFAULT NULL, + `localtax1_tx` double(6,3) DEFAULT NULL, + `localtax1_type` varchar(10) NOT NULL DEFAULT '0', + `localtax2_tx` double(6,3) DEFAULT NULL, + `localtax2_type` varchar(10) NOT NULL DEFAULT '0', + `qty` double DEFAULT NULL, + `remise_percent` double DEFAULT '0', + `remise` double DEFAULT '0', + `fk_remise_except` int(11) DEFAULT NULL, + `price` double DEFAULT NULL, + `subprice` double(24,8) DEFAULT '0.00000000', + `total_ht` double(24,8) DEFAULT '0.00000000', + `total_tva` double(24,8) DEFAULT '0.00000000', + `total_localtax1` double(24,8) DEFAULT '0.00000000', + `total_localtax2` double(24,8) DEFAULT '0.00000000', + `total_ttc` double(24,8) DEFAULT '0.00000000', + `product_type` int(11) DEFAULT '0', + `date_start` datetime DEFAULT NULL, + `date_end` datetime DEFAULT NULL, + `info_bits` int(11) DEFAULT '0', + `fk_product_fournisseur_price` int(11) DEFAULT NULL, + `buy_price_ht` double(24,8) DEFAULT '0.00000000', + `special_code` int(10) unsigned DEFAULT '0', + `rang` int(11) DEFAULT '0', + `import_key` varchar(14) DEFAULT NULL, + `fk_unit` int(11) DEFAULT NULL, + `fk_multicurrency` int(11) DEFAULT NULL, + `multicurrency_code` varchar(255) DEFAULT NULL, + `multicurrency_subprice` double(24,8) DEFAULT '0.00000000', + `multicurrency_total_ht` double(24,8) DEFAULT '0.00000000', + `multicurrency_total_tva` double(24,8) DEFAULT '0.00000000', + `multicurrency_total_ttc` double(24,8) DEFAULT '0.00000000', + PRIMARY KEY (`rowid`), + KEY `idx_commandedet_fk_commande` (`fk_commande`), + KEY `idx_commandedet_fk_product` (`fk_product`), + KEY `fk_commandedet_fk_unit` (`fk_unit`), + CONSTRAINT `fk_commandedet_fk_commande` FOREIGN KEY (`fk_commande`) REFERENCES `llx_commande` (`rowid`), + CONSTRAINT `fk_commandedet_fk_unit` FOREIGN KEY (`fk_unit`) REFERENCES `llx_c_units` (`rowid`) +) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_commandedet` +-- + +LOCK TABLES `llx_commandedet` WRITE; +/*!40000 ALTER TABLE `llx_commandedet` DISABLE KEYS */; +INSERT INTO `llx_commandedet` VALUES (1,1,NULL,NULL,NULL,'Product 1',0.000,0.000,'',0.000,'',1,0,0,NULL,10,10.00000000,10.00000000,0.00000000,0.00000000,0.00000000,10.00000000,0,NULL,NULL,0,NULL,0.00000000,0,1,NULL,NULL,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000),(2,1,NULL,2,NULL,'',0.000,0.000,'',0.000,'',1,0,0,NULL,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000,0.00000000,0,NULL,NULL,0,NULL,0.00000000,0,2,NULL,NULL,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000),(3,1,NULL,5,NULL,'cccc',0.000,0.000,'',0.000,'',1,0,0,NULL,0,0.00000000,0.00000000,0.00000000,0.00000000,0.00000000,0.00000000,0,NULL,NULL,0,NULL,0.00000000,0,3,NULL,NULL,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000),(4,2,NULL,NULL,NULL,'hgf',0.000,0.000,'',0.000,'',1,0,0,NULL,10,10.00000000,10.00000000,0.00000000,0.00000000,0.00000000,10.00000000,0,NULL,NULL,0,NULL,0.00000000,0,1,NULL,NULL,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000),(10,5,NULL,NULL,NULL,'gfdgdf',0.000,0.000,'',0.000,'',1,0,0,NULL,10,10.00000000,10.00000000,0.00000000,0.00000000,0.00000000,10.00000000,0,NULL,NULL,0,NULL,0.00000000,0,1,NULL,NULL,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000),(11,6,NULL,NULL,NULL,'gdfg',19.600,0.000,'',0.000,'',1,0,0,NULL,10,10.00000000,10.00000000,1.96000000,0.00000000,0.00000000,11.96000000,0,NULL,NULL,0,NULL,0.00000000,0,1,NULL,NULL,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000),(12,6,NULL,NULL,NULL,'gfdgd',19.600,0.000,'',0.000,'',1,0,0,NULL,50,50.00000000,50.00000000,9.80000000,0.00000000,0.00000000,59.80000000,1,NULL,NULL,0,NULL,0.00000000,0,2,NULL,NULL,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000),(14,3,NULL,NULL,NULL,'gdfgdf',0.000,0.000,'',0.000,'',1,0,0,NULL,10,10.00000000,10.00000000,0.00000000,0.00000000,0.00000000,10.00000000,1,NULL,NULL,0,NULL,0.00000000,0,1,NULL,NULL,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000),(15,3,NULL,NULL,NULL,'fghfgh',0.000,0.000,'',0.000,'',1,0,0,NULL,20,20.00000000,20.00000000,0.00000000,0.00000000,0.00000000,20.00000000,0,NULL,NULL,0,NULL,0.00000000,0,2,NULL,NULL,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000); +/*!40000 ALTER TABLE `llx_commandedet` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_commandedet_extrafields` +-- + +DROP TABLE IF EXISTS `llx_commandedet_extrafields`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_commandedet_extrafields` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `fk_object` int(11) NOT NULL, + `import_key` varchar(14) DEFAULT NULL, + PRIMARY KEY (`rowid`), + KEY `idx_commandedet_extrafields` (`fk_object`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_commandedet_extrafields` +-- + +LOCK TABLES `llx_commandedet_extrafields` WRITE; +/*!40000 ALTER TABLE `llx_commandedet_extrafields` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_commandedet_extrafields` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_const` +-- + +DROP TABLE IF EXISTS `llx_const`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_const` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(255) NOT NULL, + `entity` int(11) NOT NULL DEFAULT '1', + `value` text NOT NULL, + `type` varchar(6) DEFAULT NULL, + `visible` tinyint(4) NOT NULL DEFAULT '1', + `note` text, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_const` (`name`,`entity`) +) ENGINE=InnoDB AUTO_INCREMENT=5815 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_const` +-- + +LOCK TABLES `llx_const` WRITE; +/*!40000 ALTER TABLE `llx_const` DISABLE KEYS */; +INSERT INTO `llx_const` VALUES (5,'SYSLOG_LEVEL',0,'7','chaine',0,'Level of debug info to show','2010-07-08 11:17:57'),(8,'MAIN_UPLOAD_DOC',0,'2048','chaine',0,'Max size for file upload (0 means no upload allowed)','2010-07-08 11:17:57'),(9,'MAIN_SEARCHFORM_SOCIETE',0,'1','yesno',0,'Show form for quick company search','2010-07-08 11:17:57'),(10,'MAIN_SEARCHFORM_CONTACT',0,'1','yesno',0,'Show form for quick contact search','2010-07-08 11:17:57'),(11,'MAIN_SEARCHFORM_PRODUITSERVICE',0,'1','yesno',0,'Show form for quick product search','2010-07-08 11:17:58'),(12,'MAIN_SEARCHFORM_ADHERENT',0,'1','yesno',0,'Show form for quick member search','2010-07-08 11:17:58'),(16,'MAIN_SIZE_LISTE_LIMIT',0,'25','chaine',0,'Longueur maximum des listes','2010-07-08 11:17:58'),(17,'MAIN_SHOW_WORKBOARD',0,'1','yesno',0,'Affichage tableau de bord de travail Dolibarr','2010-07-08 11:17:58'),(29,'MAIN_DELAY_NOT_ACTIVATED_SERVICES',1,'0','chaine',0,'Tolérance de retard avant alerte (en jours) sur services à activer','2010-07-08 11:17:58'),(33,'SOCIETE_NOLIST_COURRIER',0,'1','yesno',0,'Liste les fichiers du repertoire courrier','2010-07-08 11:17:58'),(36,'ADHERENT_MAIL_REQUIRED',1,'1','yesno',0,'EMail required to create a new member','2010-07-08 11:17:58'),(37,'ADHERENT_MAIL_FROM',1,'adherents@domain.com','chaine',0,'Sender EMail for automatic emails','2010-07-08 11:17:58'),(38,'ADHERENT_MAIL_RESIL',1,'Your subscription has been resiliated.\r\nWe hope to see you soon again','texte',0,'Mail resiliation','2010-07-08 11:17:58'),(39,'ADHERENT_MAIL_VALID',1,'Your subscription has been validated.\r\nThis is a remind of your personal information :\r\n\r\n%INFOS%\r\n\r\n','texte',0,'Mail de validation','2010-07-08 11:17:59'),(40,'ADHERENT_MAIL_COTIS',1,'Hello %PRENOM%,\r\nThanks for your subscription.\r\nThis email confirms that your subscription has been received and processed.\r\n\r\n','texte',0,'Mail de validation de cotisation','2010-07-08 11:17:59'),(41,'ADHERENT_MAIL_VALID_SUBJECT',1,'Your subscription has been validated','chaine',0,'Sujet du mail de validation','2010-07-08 11:17:59'),(42,'ADHERENT_MAIL_RESIL_SUBJECT',1,'Resiliating your subscription','chaine',0,'Sujet du mail de resiliation','2010-07-08 11:17:59'),(43,'ADHERENT_MAIL_COTIS_SUBJECT',1,'Receipt of your subscription','chaine',0,'Sujet du mail de validation de cotisation','2010-07-08 11:17:59'),(44,'MAILING_EMAIL_FROM',1,'dolibarr@domain.com','chaine',0,'EMail emmetteur pour les envois d emailings','2010-07-08 11:17:59'),(45,'ADHERENT_USE_MAILMAN',1,'0','yesno',0,'Utilisation de Mailman','2010-07-08 11:17:59'),(46,'ADHERENT_MAILMAN_UNSUB_URL',1,'http://lists.domain.com/cgi-bin/mailman/admin/%LISTE%/members?adminpw=%MAILMAN_ADMINPW%&user=%EMAIL%','chaine',0,'Url de desinscription aux listes mailman','2010-07-08 11:17:59'),(47,'ADHERENT_MAILMAN_URL',1,'http://lists.domain.com/cgi-bin/mailman/admin/%LISTE%/members?adminpw=%MAILMAN_ADMINPW%&send_welcome_msg_to_this_batch=1&subscribees=%EMAIL%','chaine',0,'Url pour les inscriptions mailman','2010-07-08 11:17:59'),(48,'ADHERENT_MAILMAN_LISTS',1,'test-test,test-test2','chaine',0,'Listes auxquelles inscrire les nouveaux adherents','2010-07-08 11:17:59'),(49,'ADHERENT_MAILMAN_ADMINPW',1,'','chaine',0,'Mot de passe Admin des liste mailman','2010-07-08 11:17:59'),(50,'ADHERENT_MAILMAN_SERVER',1,'lists.domain.com','chaine',0,'Serveur hebergeant les interfaces d Admin des listes mailman','2010-07-08 11:17:59'),(51,'ADHERENT_MAILMAN_LISTS_COTISANT',1,'','chaine',0,'Liste(s) auxquelles les nouveaux cotisants sont inscris automatiquement','2010-07-08 11:17:59'),(52,'ADHERENT_USE_SPIP',1,'0','yesno',0,'Utilisation de SPIP ?','2010-07-08 11:17:59'),(53,'ADHERENT_USE_SPIP_AUTO',1,'0','yesno',0,'Utilisation de SPIP automatiquement','2010-07-08 11:17:59'),(54,'ADHERENT_SPIP_USER',1,'user','chaine',0,'user spip','2010-07-08 11:17:59'),(55,'ADHERENT_SPIP_PASS',1,'pass','chaine',0,'Pass de connection','2010-07-08 11:17:59'),(56,'ADHERENT_SPIP_SERVEUR',1,'localhost','chaine',0,'serveur spip','2010-07-08 11:17:59'),(57,'ADHERENT_SPIP_DB',1,'spip','chaine',0,'db spip','2010-07-08 11:17:59'),(58,'ADHERENT_CARD_HEADER_TEXT',1,'%ANNEE%','chaine',0,'Texte imprime sur le haut de la carte adherent','2010-07-08 11:17:59'),(59,'ADHERENT_CARD_FOOTER_TEXT',1,'Association AZERTY','chaine',0,'Texte imprime sur le bas de la carte adherent','2010-07-08 11:17:59'),(61,'FCKEDITOR_ENABLE_USER',1,'1','yesno',0,'Activation fckeditor sur notes utilisateurs','2010-07-08 11:17:59'),(62,'FCKEDITOR_ENABLE_SOCIETE',1,'1','yesno',0,'Activation fckeditor sur notes societe','2010-07-08 11:17:59'),(63,'FCKEDITOR_ENABLE_PRODUCTDESC',1,'1','yesno',0,'Activation fckeditor sur notes produits','2010-07-08 11:17:59'),(64,'FCKEDITOR_ENABLE_MEMBER',1,'1','yesno',0,'Activation fckeditor sur notes adherent','2010-07-08 11:17:59'),(65,'FCKEDITOR_ENABLE_MAILING',1,'1','yesno',0,'Activation fckeditor sur emailing','2010-07-08 11:17:59'),(67,'DON_ADDON_MODEL',1,'html_cerfafr','chaine',0,'','2010-07-08 11:18:00'),(68,'PROPALE_ADDON',1,'mod_propale_marbre','chaine',0,'','2010-07-08 11:18:00'),(69,'PROPALE_ADDON_PDF',1,'azur','chaine',0,'','2010-07-08 11:18:00'),(70,'COMMANDE_ADDON',1,'mod_commande_marbre','chaine',0,'','2010-07-08 11:18:00'),(71,'COMMANDE_ADDON_PDF',1,'einstein','chaine',0,'','2010-07-08 11:18:00'),(72,'COMMANDE_SUPPLIER_ADDON',1,'mod_commande_fournisseur_muguet','chaine',0,'','2010-07-08 11:18:00'),(73,'COMMANDE_SUPPLIER_ADDON_PDF',1,'muscadet','chaine',0,'','2010-07-08 11:18:00'),(74,'EXPEDITION_ADDON',1,'enlevement','chaine',0,'','2010-07-08 11:18:00'),(76,'FICHEINTER_ADDON',1,'pacific','chaine',0,'','2010-07-08 11:18:00'),(77,'FICHEINTER_ADDON_PDF',1,'soleil','chaine',0,'','2010-07-08 11:18:00'),(79,'FACTURE_ADDON_PDF',1,'crabe','chaine',0,'','2010-07-08 11:18:00'),(80,'PROPALE_VALIDITY_DURATION',1,'15','chaine',0,'Durée de validitée des propales','2010-07-08 11:18:00'),(230,'COMPANY_ADDON_PDF_ODT_PATH',1,'DOL_DATA_ROOT/doctemplates/thirdparties','chaine',0,NULL,'2010-07-08 11:26:20'),(238,'LIVRAISON_ADDON_PDF',1,'typhon','chaine',0,'Nom du gestionnaire de generation des commandes en PDF','2010-07-08 11:26:27'),(239,'LIVRAISON_ADDON_NUMBER',1,'mod_livraison_jade','chaine',0,'Nom du gestionnaire de numerotation des bons de livraison','2013-03-20 13:17:36'),(242,'MAIN_SUBMODULE_EXPEDITION',1,'1','chaine',0,'','2010-07-08 11:26:34'),(245,'FACTURE_ADDON_PDF_ODT_PATH',1,'DOL_DATA_ROOT/doctemplates/invoices','chaine',0,NULL,'2010-07-08 11:28:53'),(249,'DON_FORM',1,'fsfe.fr.php','chaine',0,'Nom du gestionnaire de formulaire de dons','2010-07-08 11:29:00'),(253,'ADHERENT_BANK_USE_AUTO',1,'','yesno',0,'Insertion automatique des cotisation dans le compte banquaire','2010-07-08 11:29:05'),(254,'ADHERENT_BANK_ACCOUNT',1,'','chaine',0,'ID du Compte banquaire utilise','2010-07-08 11:29:05'),(255,'ADHERENT_BANK_CATEGORIE',1,'','chaine',0,'ID de la categorie banquaire des cotisations','2010-07-08 11:29:05'),(256,'ADHERENT_ETIQUETTE_TYPE',1,'L7163','chaine',0,'Type d etiquette (pour impression de planche d etiquette)','2010-07-08 11:29:05'),(269,'PROJECT_ADDON_PDF',1,'baleine','chaine',0,'Nom du gestionnaire de generation des projets en PDF','2010-07-08 11:29:33'),(270,'PROJECT_ADDON',1,'mod_project_simple','chaine',0,'Nom du gestionnaire de numerotation des projets','2010-07-08 11:29:33'),(368,'STOCK_USERSTOCK_AUTOCREATE',1,'1','chaine',0,'','2010-07-08 22:44:59'),(369,'EXPEDITION_ADDON_PDF',1,'merou','chaine',0,'','2010-07-08 22:58:07'),(370,'MAIN_SUBMODULE_LIVRAISON',1,'1','chaine',0,'','2010-07-08 23:00:29'),(377,'FACTURE_ADDON',1,'mod_facture_terre','chaine',0,'','2010-07-08 23:08:12'),(380,'ADHERENT_CARD_TEXT',1,'%TYPE% n° %ID%\r\n%PRENOM% %NOM%\r\n<%EMAIL%>\r\n%ADRESSE%\r\n%CP% %VILLE%\r\n%PAYS%','',0,'Texte imprime sur la carte adherent','2010-07-08 23:14:46'),(381,'ADHERENT_CARD_TEXT_RIGHT',1,'aaa','',0,'','2010-07-08 23:14:55'),(384,'PRODUIT_SOUSPRODUITS',1,'1','chaine',0,'','2010-07-08 23:22:12'),(385,'PRODUIT_USE_SEARCH_TO_SELECT',1,'1','chaine',0,'','2010-07-08 23:22:19'),(386,'STOCK_CALCULATE_ON_SHIPMENT',1,'1','chaine',0,'','2010-07-08 23:23:21'),(387,'STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER',1,'1','chaine',0,'','2010-07-08 23:23:26'),(392,'MAIN_AGENDA_XCAL_EXPORTKEY',1,'dolibarr','chaine',0,'','2010-07-08 23:27:50'),(393,'MAIN_AGENDA_EXPORT_PAST_DELAY',1,'100','chaine',0,'','2010-07-08 23:27:50'),(610,'CASHDESK_ID_THIRDPARTY',1,'7','chaine',0,'','2010-07-11 17:08:18'),(611,'CASHDESK_ID_BANKACCOUNT_CASH',1,'3','chaine',0,'','2010-07-11 17:08:18'),(612,'CASHDESK_ID_BANKACCOUNT_CHEQUE',1,'1','chaine',0,'','2010-07-11 17:08:18'),(613,'CASHDESK_ID_BANKACCOUNT_CB',1,'1','chaine',0,'','2010-07-11 17:08:18'),(614,'CASHDESK_ID_WAREHOUSE',1,'2','chaine',0,'','2010-07-11 17:08:18'),(660,'LDAP_USER_DN',1,'ou=users,dc=my-domain,dc=com','chaine',0,NULL,'2010-07-18 10:25:27'),(661,'LDAP_GROUP_DN',1,'ou=groups,dc=my-domain,dc=com','chaine',0,NULL,'2010-07-18 10:25:27'),(662,'LDAP_FILTER_CONNECTION',1,'&(objectClass=user)(objectCategory=person)','chaine',0,NULL,'2010-07-18 10:25:27'),(663,'LDAP_FIELD_LOGIN',1,'uid','chaine',0,NULL,'2010-07-18 10:25:27'),(664,'LDAP_FIELD_FULLNAME',1,'cn','chaine',0,NULL,'2010-07-18 10:25:27'),(665,'LDAP_FIELD_NAME',1,'sn','chaine',0,NULL,'2010-07-18 10:25:27'),(666,'LDAP_FIELD_FIRSTNAME',1,'givenname','chaine',0,NULL,'2010-07-18 10:25:27'),(667,'LDAP_FIELD_MAIL',1,'mail','chaine',0,NULL,'2010-07-18 10:25:27'),(668,'LDAP_FIELD_PHONE',1,'telephonenumber','chaine',0,NULL,'2010-07-18 10:25:27'),(669,'LDAP_FIELD_FAX',1,'facsimiletelephonenumber','chaine',0,NULL,'2010-07-18 10:25:27'),(670,'LDAP_FIELD_MOBILE',1,'mobile','chaine',0,NULL,'2010-07-18 10:25:27'),(671,'LDAP_SERVER_TYPE',1,'openldap','chaine',0,'','2010-07-18 10:25:46'),(672,'LDAP_SERVER_PROTOCOLVERSION',1,'3','chaine',0,'','2010-07-18 10:25:47'),(673,'LDAP_SERVER_HOST',1,'localhost','chaine',0,'','2010-07-18 10:25:47'),(674,'LDAP_SERVER_PORT',1,'389','chaine',0,'','2010-07-18 10:25:47'),(675,'LDAP_SERVER_USE_TLS',1,'0','chaine',0,'','2010-07-18 10:25:47'),(676,'LDAP_SYNCHRO_ACTIVE',1,'dolibarr2ldap','chaine',0,'','2010-07-18 10:25:47'),(677,'LDAP_CONTACT_ACTIVE',1,'1','chaine',0,'','2010-07-18 10:25:47'),(678,'LDAP_MEMBER_ACTIVE',1,'1','chaine',0,'','2010-07-18 10:25:47'),(974,'MAIN_MODULE_WORKFLOW_TRIGGERS',1,'1','chaine',0,NULL,'2011-07-18 18:02:20'),(975,'WORKFLOW_PROPAL_AUTOCREATE_ORDER',1,'1','chaine',0,'','2011-07-18 18:02:24'),(979,'PRELEVEMENT_USER',1,'1','chaine',0,'','2011-07-18 18:05:50'),(980,'PRELEVEMENT_NUMERO_NATIONAL_EMETTEUR',1,'1234567','chaine',0,'','2011-07-18 18:05:50'),(981,'PRELEVEMENT_ID_BANKACCOUNT',1,'1','chaine',0,'','2011-07-18 18:05:50'),(983,'FACTURE_RIB_NUMBER',1,'1','chaine',0,'','2011-07-18 18:35:14'),(984,'FACTURE_CHQ_NUMBER',1,'1','chaine',0,'','2011-07-18 18:35:14'),(1016,'GOOGLE_DUPLICATE_INTO_GCAL',1,'1','chaine',0,'','2011-07-18 21:40:20'),(1152,'SOCIETE_CODECLIENT_ADDON',1,'mod_codeclient_monkey','chaine',0,'','2011-07-29 20:50:02'),(1231,'MAIN_UPLOAD_DOC',1,'2048','chaine',0,'','2011-07-29 21:04:00'),(1234,'MAIN_UMASK',1,'0664','chaine',0,'','2011-07-29 21:04:11'),(1240,'MAIN_LOGEVENTS_USER_LOGIN',1,'1','chaine',0,'','2011-07-29 21:05:01'),(1241,'MAIN_LOGEVENTS_USER_LOGIN_FAILED',1,'1','chaine',0,'','2011-07-29 21:05:01'),(1242,'MAIN_LOGEVENTS_USER_LOGOUT',1,'1','chaine',0,'','2011-07-29 21:05:01'),(1243,'MAIN_LOGEVENTS_USER_CREATE',1,'1','chaine',0,'','2011-07-29 21:05:01'),(1244,'MAIN_LOGEVENTS_USER_MODIFY',1,'1','chaine',0,'','2011-07-29 21:05:01'),(1245,'MAIN_LOGEVENTS_USER_NEW_PASSWORD',1,'1','chaine',0,'','2011-07-29 21:05:01'),(1246,'MAIN_LOGEVENTS_USER_ENABLEDISABLE',1,'1','chaine',0,'','2011-07-29 21:05:01'),(1247,'MAIN_LOGEVENTS_USER_DELETE',1,'1','chaine',0,'','2011-07-29 21:05:01'),(1248,'MAIN_LOGEVENTS_GROUP_CREATE',1,'1','chaine',0,'','2011-07-29 21:05:01'),(1249,'MAIN_LOGEVENTS_GROUP_MODIFY',1,'1','chaine',0,'','2011-07-29 21:05:01'),(1250,'MAIN_LOGEVENTS_GROUP_DELETE',1,'1','chaine',0,'','2011-07-29 21:05:01'),(1251,'MAIN_BOXES_MAXLINES',1,'5','',0,'','2011-07-29 21:05:42'),(1482,'EXPEDITION_ADDON_NUMBER',1,'mod_expedition_safor','chaine',0,'Nom du gestionnaire de numerotation des expeditions','2011-08-05 17:53:11'),(1490,'CONTRACT_ADDON',1,'mod_contract_serpis','chaine',0,'Nom du gestionnaire de numerotation des contrats','2011-08-05 18:11:58'),(1677,'COMMANDE_ADDON_PDF_ODT_PATH',1,'DOL_DATA_ROOT/doctemplates/orders','chaine',0,NULL,'2012-12-08 13:11:02'),(1698,'PRODUCT_CODEPRODUCT_ADDON',1,'mod_codeproduct_leopard','yesno',0,'Module to control product codes','2012-12-08 13:11:25'),(1719,'ACCOUNTING_USEDICTTOEDIT',1,'1','chaine',1,'','2012-12-08 13:15:00'),(1724,'PROPALE_ADDON_PDF_ODT_PATH',1,'DOL_DATA_ROOT/doctemplates/proposals','chaine',0,NULL,'2012-12-08 13:17:14'),(1730,'OPENSTREETMAP_ENABLE_MAPS',1,'1','chaine',0,'','2012-12-08 13:22:47'),(1731,'OPENSTREETMAP_ENABLE_MAPS_CONTACTS',1,'1','chaine',0,'','2012-12-08 13:22:47'),(1732,'OPENSTREETMAP_ENABLE_MAPS_MEMBERS',1,'1','chaine',0,'','2012-12-08 13:22:47'),(1733,'OPENSTREETMAP_MAPS_ZOOM_LEVEL',1,'15','chaine',0,'','2012-12-08 13:22:47'),(1737,'MAIN_INFO_SOCIETE_COUNTRY',2,'1:FR:France','chaine',0,'','2013-02-26 21:56:28'),(1738,'MAIN_INFO_SOCIETE_NOM',2,'aaa','chaine',0,'','2012-12-08 14:08:14'),(1739,'MAIN_INFO_SOCIETE_STATE',2,'0','chaine',0,'','2013-02-27 14:20:27'),(1740,'MAIN_MONNAIE',2,'EUR','chaine',0,'','2012-12-08 14:08:14'),(1741,'MAIN_LANG_DEFAULT',2,'auto','chaine',0,'','2012-12-08 14:08:14'),(1742,'MAIN_MAIL_EMAIL_FROM',2,'dolibarr-robot@domain.com','chaine',0,'EMail emetteur pour les emails automatiques Dolibarr','2012-12-08 14:08:14'),(1743,'MAIN_MENU_STANDARD',2,'eldy_menu.php','chaine',0,'Module de gestion de la barre de menu du haut pour utilisateurs internes','2013-02-11 19:43:54'),(1744,'MAIN_MENUFRONT_STANDARD',2,'eldy_menu.php','chaine',0,'Module de gestion de la barre de menu du haut pour utilisateurs externes','2013-02-11 19:43:54'),(1745,'MAIN_MENU_SMARTPHONE',2,'iphone_backoffice.php','chaine',0,'Module de gestion de la barre de menu smartphone pour utilisateurs internes','2012-12-08 14:08:14'),(1746,'MAIN_MENUFRONT_SMARTPHONE',2,'iphone_frontoffice.php','chaine',0,'Module de gestion de la barre de menu smartphone pour utilisateurs externes','2012-12-08 14:08:14'),(1747,'MAIN_THEME',2,'eldy','chaine',0,'Default theme','2012-12-08 14:08:14'),(1748,'MAIN_DELAY_ACTIONS_TODO',2,'7','chaine',0,'Tolérance de retard avant alerte (en jours) sur actions planifiées non réalisées','2012-12-08 14:08:14'),(1749,'MAIN_DELAY_ORDERS_TO_PROCESS',2,'2','chaine',0,'Tolérance de retard avant alerte (en jours) sur commandes clients non traitées','2012-12-08 14:08:14'),(1750,'MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS',2,'7','chaine',0,'Tolérance de retard avant alerte (en jours) sur commandes fournisseurs non traitées','2012-12-08 14:08:14'),(1751,'MAIN_DELAY_PROPALS_TO_CLOSE',2,'31','chaine',0,'Tolérance de retard avant alerte (en jours) sur propales à cloturer','2012-12-08 14:08:14'),(1752,'MAIN_DELAY_PROPALS_TO_BILL',2,'7','chaine',0,'Tolérance de retard avant alerte (en jours) sur propales non facturées','2012-12-08 14:08:14'),(1753,'MAIN_DELAY_CUSTOMER_BILLS_UNPAYED',2,'31','chaine',0,'Tolérance de retard avant alerte (en jours) sur factures client impayées','2012-12-08 14:08:14'),(1754,'MAIN_DELAY_SUPPLIER_BILLS_TO_PAY',2,'2','chaine',0,'Tolérance de retard avant alerte (en jours) sur factures fournisseur impayées','2012-12-08 14:08:14'),(1755,'MAIN_DELAY_NOT_ACTIVATED_SERVICES',2,'0','chaine',0,'Tolérance de retard avant alerte (en jours) sur services à activer','2012-12-08 14:08:14'),(1756,'MAIN_DELAY_RUNNING_SERVICES',2,'0','chaine',0,'Tolérance de retard avant alerte (en jours) sur services expirés','2012-12-08 14:08:14'),(1757,'MAIN_DELAY_MEMBERS',2,'31','chaine',0,'Tolérance de retard avant alerte (en jours) sur cotisations adhérent en retard','2012-12-08 14:08:14'),(1758,'MAIN_DELAY_TRANSACTIONS_TO_CONCILIATE',2,'62','chaine',0,'Tolérance de retard avant alerte (en jours) sur rapprochements bancaires à faire','2012-12-08 14:08:14'),(1759,'MAILING_EMAIL_FROM',2,'dolibarr@domain.com','chaine',0,'EMail emmetteur pour les envois d emailings','2012-12-08 14:08:14'),(1760,'MAIN_INFO_SOCIETE_COUNTRY',3,'1:FR:France','chaine',0,'','2013-02-26 21:56:28'),(1761,'MAIN_INFO_SOCIETE_NOM',3,'bbb','chaine',0,'','2012-12-08 14:08:20'),(1762,'MAIN_INFO_SOCIETE_STATE',3,'0','chaine',0,'','2013-02-27 14:20:27'),(1763,'MAIN_MONNAIE',3,'EUR','chaine',0,'','2012-12-08 14:08:20'),(1764,'MAIN_LANG_DEFAULT',3,'auto','chaine',0,'','2012-12-08 14:08:20'),(1765,'MAIN_MAIL_EMAIL_FROM',3,'dolibarr-robot@domain.com','chaine',0,'EMail emetteur pour les emails automatiques Dolibarr','2012-12-08 14:08:20'),(1766,'MAIN_MENU_STANDARD',3,'eldy_menu.php','chaine',0,'Module de gestion de la barre de menu du haut pour utilisateurs internes','2013-02-11 19:43:54'),(1767,'MAIN_MENUFRONT_STANDARD',3,'eldy_menu.php','chaine',0,'Module de gestion de la barre de menu du haut pour utilisateurs externes','2013-02-11 19:43:54'),(1768,'MAIN_MENU_SMARTPHONE',3,'iphone_backoffice.php','chaine',0,'Module de gestion de la barre de menu smartphone pour utilisateurs internes','2012-12-08 14:08:20'),(1769,'MAIN_MENUFRONT_SMARTPHONE',3,'iphone_frontoffice.php','chaine',0,'Module de gestion de la barre de menu smartphone pour utilisateurs externes','2012-12-08 14:08:20'),(1770,'MAIN_THEME',3,'eldy','chaine',0,'Default theme','2012-12-08 14:08:20'),(1771,'MAIN_DELAY_ACTIONS_TODO',3,'7','chaine',0,'Tolérance de retard avant alerte (en jours) sur actions planifiées non réalisées','2012-12-08 14:08:20'),(1772,'MAIN_DELAY_ORDERS_TO_PROCESS',3,'2','chaine',0,'Tolérance de retard avant alerte (en jours) sur commandes clients non traitées','2012-12-08 14:08:20'),(1773,'MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS',3,'7','chaine',0,'Tolérance de retard avant alerte (en jours) sur commandes fournisseurs non traitées','2012-12-08 14:08:20'),(1774,'MAIN_DELAY_PROPALS_TO_CLOSE',3,'31','chaine',0,'Tolérance de retard avant alerte (en jours) sur propales à cloturer','2012-12-08 14:08:20'),(1775,'MAIN_DELAY_PROPALS_TO_BILL',3,'7','chaine',0,'Tolérance de retard avant alerte (en jours) sur propales non facturées','2012-12-08 14:08:20'),(1776,'MAIN_DELAY_CUSTOMER_BILLS_UNPAYED',3,'31','chaine',0,'Tolérance de retard avant alerte (en jours) sur factures client impayées','2012-12-08 14:08:20'),(1777,'MAIN_DELAY_SUPPLIER_BILLS_TO_PAY',3,'2','chaine',0,'Tolérance de retard avant alerte (en jours) sur factures fournisseur impayées','2012-12-08 14:08:20'),(1778,'MAIN_DELAY_NOT_ACTIVATED_SERVICES',3,'0','chaine',0,'Tolérance de retard avant alerte (en jours) sur services à activer','2012-12-08 14:08:20'),(1779,'MAIN_DELAY_RUNNING_SERVICES',3,'0','chaine',0,'Tolérance de retard avant alerte (en jours) sur services expirés','2012-12-08 14:08:20'),(1780,'MAIN_DELAY_MEMBERS',3,'31','chaine',0,'Tolérance de retard avant alerte (en jours) sur cotisations adhérent en retard','2012-12-08 14:08:20'),(1781,'MAIN_DELAY_TRANSACTIONS_TO_CONCILIATE',3,'62','chaine',0,'Tolérance de retard avant alerte (en jours) sur rapprochements bancaires à faire','2012-12-08 14:08:20'),(1782,'MAILING_EMAIL_FROM',3,'dolibarr@domain.com','chaine',0,'EMail emmetteur pour les envois d emailings','2012-12-08 14:08:20'),(1803,'SYSLOG_FILE',1,'DOL_DATA_ROOT/dolibarr.log','chaine',0,'','2012-12-08 14:15:08'),(1804,'SYSLOG_HANDLERS',1,'[\"mod_syslog_file\"]','chaine',0,'','2012-12-08 14:15:08'),(1805,'MAIN_MODULE_SKINCOLOREDITOR',3,'1',NULL,0,NULL,'2012-12-08 14:35:40'),(1806,'MAIN_MODULE_SKINCOLOREDITOR_TABS_0',3,'user:+tabskincoloreditors:ColorEditor:skincoloreditor@skincoloreditor:/skincoloreditor/usercolors.php?id=__ID__','chaine',0,NULL,'2012-12-08 14:35:40'),(1922,'PAYPAL_API_SANDBOX',1,'1','chaine',0,'','2012-12-12 12:11:05'),(1923,'PAYPAL_API_USER',1,'seller_1355312017_biz_api1.nltechno.com','chaine',0,'','2012-12-12 12:11:05'),(1924,'PAYPAL_API_PASSWORD',1,'1355312040','chaine',0,'','2012-12-12 12:11:05'),(1925,'PAYPAL_API_SIGNATURE',1,'AXqqdsWBzvfn0q5iNmbuiDv1y.3EAXIMWyl4C5KvDReR9HDwwAd6dQ4Q','chaine',0,'','2012-12-12 12:11:05'),(1926,'PAYPAL_API_INTEGRAL_OR_PAYPALONLY',1,'integral','chaine',0,'','2012-12-12 12:11:05'),(1927,'PAYPAL_SECURITY_TOKEN',1,'50c82fab36bb3b6aa83e2a50691803b2','chaine',0,'','2012-12-12 12:11:05'),(1928,'PAYPAL_SECURITY_TOKEN_UNIQUE',1,'0','chaine',0,'','2012-12-12 12:11:05'),(1929,'PAYPAL_ADD_PAYMENT_URL',1,'1','chaine',0,'','2012-12-12 12:11:05'),(1980,'MAIN_PDF_FORMAT',1,'EUA4','chaine',0,'','2012-12-12 19:58:05'),(1981,'MAIN_PROFID1_IN_ADDRESS',1,'0','chaine',0,'','2012-12-12 19:58:05'),(1982,'MAIN_PROFID2_IN_ADDRESS',1,'0','chaine',0,'','2012-12-12 19:58:05'),(1983,'MAIN_PROFID3_IN_ADDRESS',1,'0','chaine',0,'','2012-12-12 19:58:05'),(1984,'MAIN_PROFID4_IN_ADDRESS',1,'0','chaine',0,'','2012-12-12 19:58:05'),(1985,'MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT',1,'0','chaine',0,'','2012-12-12 19:58:05'),(1990,'MAIN_SMS_SENDMODE',1,'ovh','chaine',0,'This is to enable OVH SMS engine','2012-12-17 21:19:01'),(2040,'MAIN_MAIL_SMTP_PORT',1,'465','chaine',0,'','2015-07-19 13:41:06'),(2041,'MAIN_MAIL_SMTP_SERVER',1,'smtp.mail.com','chaine',0,'','2015-07-19 13:41:06'),(2044,'MAIN_MAIL_EMAIL_TLS',1,'1','chaine',0,'','2015-07-19 13:41:06'),(2251,'FCKEDITOR_TEST',1,'Test
\r\n\"\"fdfs','chaine',0,'','2012-12-19 19:12:24'),(2293,'SYSTEMTOOLS_MYSQLDUMP',1,'/usr/bin/mysqldump','chaine',0,'','2012-12-27 02:02:00'),(2835,'MAIN_USE_CONNECT_TIMEOUT',1,'10','chaine',0,'','2013-01-16 19:28:50'),(2836,'MAIN_USE_RESPONSE_TIMEOUT',1,'30','chaine',0,'','2013-01-16 19:28:50'),(2837,'MAIN_PROXY_USE',1,'0','chaine',0,'','2013-01-16 19:28:50'),(2838,'MAIN_PROXY_HOST',1,'localhost','chaine',0,'','2013-01-16 19:28:50'),(2839,'MAIN_PROXY_PORT',1,'8080','chaine',0,'','2013-01-16 19:28:50'),(2840,'MAIN_PROXY_USER',1,'aaa','chaine',0,'','2013-01-16 19:28:50'),(2841,'MAIN_PROXY_PASS',1,'bbb','chaine',0,'','2013-01-16 19:28:50'),(2848,'OVHSMS_NICK',1,'BN196-OVH','chaine',0,'','2013-01-16 19:32:36'),(2849,'OVHSMS_PASS',1,'bigone-10','chaine',0,'','2013-01-16 19:32:36'),(2850,'OVHSMS_SOAPURL',1,'https://www.ovh.com/soapi/soapi-re-1.55.wsdl','chaine',0,'','2013-01-16 19:32:36'),(2854,'THEME_ELDY_RGB',1,'bfbf00','chaine',0,'','2013-01-18 10:02:53'),(2855,'THEME_ELDY_ENABLE_PERSONALIZED',1,'0','chaine',0,'','2013-01-18 10:02:55'),(2858,'MAIN_SESSION_TIMEOUT',1,'2000','chaine',0,'','2013-01-19 17:01:53'),(2862,'TICKET_ADDON',1,'mod_ticket_avenc','chaine',0,'Nom du gestionnaire de numerotation des tickets','2013-01-19 17:16:10'),(2867,'FACSIM_ADDON',1,'mod_facsim_alcoy','chaine',0,'','2013-01-19 17:16:25'),(2868,'POS_SERVICES',1,'0','chaine',0,'','2013-01-19 17:16:51'),(2869,'POS_USE_TICKETS',1,'1','chaine',0,'','2013-01-19 17:16:51'),(2870,'POS_MAX_TTC',1,'100','chaine',0,'','2013-01-19 17:16:51'),(3190,'MAIN_MODULE_HOLIDAY',2,'1',NULL,0,NULL,'2013-02-01 08:52:34'),(3191,'MAIN_MODULE_HOLIDAY_TABS_0',2,'user:+paidholidays:CPTitreMenu:holiday:$user->rights->holiday->write:/holiday/index.php?mainmenu=holiday&id=__ID__','chaine',0,NULL,'2013-02-01 08:52:34'),(3195,'INVOICE_SUPPLIER_ADDON_PDF',1,'canelle','chaine',0,'','2013-02-10 19:50:27'),(3199,'MAIN_FORCE_RELOAD_PAGE',1,'1','chaine',0,NULL,'2013-02-12 16:22:55'),(3217,'MAIN_PDF_TITLE_BACKGROUND_COLOR',1,'240,240,240','chaine',1,'','2013-02-13 15:18:02'),(3223,'OVH_THIRDPARTY_IMPORT',1,'2','chaine',0,'','2013-02-13 16:20:18'),(3241,'COMPANY_USE_SEARCH_TO_SELECT',1,'2','chaine',0,'','2013-02-17 14:33:39'),(3409,'AGENDA_USE_EVENT_TYPE',1,'1','chaine',0,'','2013-02-27 18:12:24'),(3886,'MAIN_REMOVE_INSTALL_WARNING',1,'1','chaine',1,'','2013-03-02 18:32:50'),(4013,'MAIN_DELAY_ACTIONS_TODO',1,'7','chaine',0,'','2013-03-06 08:59:12'),(4014,'MAIN_DELAY_PROPALS_TO_CLOSE',1,'31','chaine',0,'','2013-03-06 08:59:12'),(4015,'MAIN_DELAY_PROPALS_TO_BILL',1,'7','chaine',0,'','2013-03-06 08:59:12'),(4016,'MAIN_DELAY_ORDERS_TO_PROCESS',1,'2','chaine',0,'','2013-03-06 08:59:12'),(4017,'MAIN_DELAY_CUSTOMER_BILLS_UNPAYED',1,'31','chaine',0,'','2013-03-06 08:59:12'),(4018,'MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS',1,'7','chaine',0,'','2013-03-06 08:59:12'),(4019,'MAIN_DELAY_SUPPLIER_BILLS_TO_PAY',1,'2','chaine',0,'','2013-03-06 08:59:12'),(4020,'MAIN_DELAY_RUNNING_SERVICES',1,'-15','chaine',0,'','2013-03-06 08:59:12'),(4021,'MAIN_DELAY_TRANSACTIONS_TO_CONCILIATE',1,'62','chaine',0,'','2013-03-06 08:59:13'),(4022,'MAIN_DELAY_MEMBERS',1,'31','chaine',0,'','2013-03-06 08:59:13'),(4023,'MAIN_DISABLE_METEO',1,'0','chaine',0,'','2013-03-06 08:59:13'),(4044,'ADHERENT_VAT_FOR_SUBSCRIPTIONS',1,'0','',0,'','2013-03-06 16:06:38'),(4047,'ADHERENT_BANK_USE',1,'bankviainvoice','',0,'','2013-03-06 16:12:30'),(4049,'PHPSANE_SCANIMAGE',1,'/usr/bin/scanimage','chaine',0,'','2013-03-06 21:54:13'),(4050,'PHPSANE_PNMTOJPEG',1,'/usr/bin/pnmtojpeg','chaine',0,'','2013-03-06 21:54:13'),(4051,'PHPSANE_PNMTOTIFF',1,'/usr/bin/pnmtotiff','chaine',0,'','2013-03-06 21:54:13'),(4052,'PHPSANE_OCR',1,'/usr/bin/gocr','chaine',0,'','2013-03-06 21:54:13'),(4548,'ECM_AUTO_TREE_ENABLED',1,'1','chaine',0,'','2013-03-10 15:57:21'),(4579,'MAIN_MODULE_AGENDA',2,'1',NULL,0,NULL,'2013-03-13 15:29:19'),(4580,'MAIN_AGENDA_ACTIONAUTO_COMPANY_CREATE',2,'1','chaine',0,NULL,'2013-03-13 15:29:19'),(4581,'MAIN_AGENDA_ACTIONAUTO_CONTRACT_VALIDATE',2,'1','chaine',0,NULL,'2013-03-13 15:29:19'),(4582,'MAIN_AGENDA_ACTIONAUTO_PROPAL_VALIDATE',2,'1','chaine',0,NULL,'2013-03-13 15:29:19'),(4583,'MAIN_AGENDA_ACTIONAUTO_PROPAL_SENTBYMAIL',2,'1','chaine',0,NULL,'2013-03-13 15:29:19'),(4584,'MAIN_AGENDA_ACTIONAUTO_ORDER_VALIDATE',2,'1','chaine',0,NULL,'2013-03-13 15:29:19'),(4585,'MAIN_AGENDA_ACTIONAUTO_ORDER_SENTBYMAIL',2,'1','chaine',0,NULL,'2013-03-13 15:29:19'),(4586,'MAIN_AGENDA_ACTIONAUTO_BILL_VALIDATE',2,'1','chaine',0,NULL,'2013-03-13 15:29:19'),(4587,'MAIN_AGENDA_ACTIONAUTO_BILL_PAYED',2,'1','chaine',0,NULL,'2013-03-13 15:29:19'),(4588,'MAIN_AGENDA_ACTIONAUTO_BILL_CANCEL',2,'1','chaine',0,NULL,'2013-03-13 15:29:19'),(4589,'MAIN_AGENDA_ACTIONAUTO_BILL_SENTBYMAIL',2,'1','chaine',0,NULL,'2013-03-13 15:29:19'),(4590,'MAIN_AGENDA_ACTIONAUTO_ORDER_SUPPLIER_VALIDATE',2,'1','chaine',0,NULL,'2013-03-13 15:29:19'),(4591,'MAIN_AGENDA_ACTIONAUTO_BILL_SUPPLIER_VALIDATE',2,'1','chaine',0,NULL,'2013-03-13 15:29:19'),(4592,'MAIN_AGENDA_ACTIONAUTO_SHIPPING_VALIDATE',2,'1','chaine',0,NULL,'2013-03-13 15:29:19'),(4593,'MAIN_AGENDA_ACTIONAUTO_SHIPPING_SENTBYMAIL',2,'1','chaine',0,NULL,'2013-03-13 15:29:19'),(4594,'MAIN_AGENDA_ACTIONAUTO_BILL_UNVALIDATE',2,'1','chaine',0,NULL,'2013-03-13 15:29:19'),(4595,'MAIN_MODULE_GOOGLE',2,'1',NULL,0,NULL,'2013-03-13 15:29:47'),(4596,'MAIN_MODULE_GOOGLE_TABS_0',2,'agenda:+gcal:MenuAgendaGoogle:google@google:$conf->google->enabled && $conf->global->GOOGLE_ENABLE_AGENDA:/google/index.php','chaine',0,NULL,'2013-03-13 15:29:47'),(4597,'MAIN_MODULE_GOOGLE_TABS_1',2,'user:+gsetup:GoogleUserConf:google@google:$conf->google->enabled && $conf->global->GOOGLE_DUPLICATE_INTO_GCAL:/google/admin/google_calsync_user.php?id=__ID__','chaine',0,NULL,'2013-03-13 15:29:47'),(4598,'MAIN_MODULE_GOOGLE_TRIGGERS',2,'1','chaine',0,NULL,'2013-03-13 15:29:47'),(4599,'MAIN_MODULE_GOOGLE_HOOKS',2,'[\"toprightmenu\"]','chaine',0,NULL,'2013-03-13 15:29:47'),(4688,'GOOGLE_ENABLE_AGENDA',2,'1','chaine',0,'','2013-03-13 15:36:29'),(4689,'GOOGLE_AGENDA_NAME1',2,'eldy','chaine',0,'','2013-03-13 15:36:29'),(4690,'GOOGLE_AGENDA_SRC1',2,'eldy10@mail.com','chaine',0,'','2013-03-13 15:36:29'),(4691,'GOOGLE_AGENDA_COLOR1',2,'BE6D00','chaine',0,'','2013-03-13 15:36:29'),(4692,'GOOGLE_AGENDA_COLOR2',2,'7A367A','chaine',0,'','2013-03-13 15:36:29'),(4693,'GOOGLE_AGENDA_COLOR3',2,'7A367A','chaine',0,'','2013-03-13 15:36:29'),(4694,'GOOGLE_AGENDA_COLOR4',2,'7A367A','chaine',0,'','2013-03-13 15:36:29'),(4695,'GOOGLE_AGENDA_COLOR5',2,'7A367A','chaine',0,'','2013-03-13 15:36:29'),(4696,'GOOGLE_AGENDA_TIMEZONE',2,'Europe/Paris','chaine',0,'','2013-03-13 15:36:29'),(4697,'GOOGLE_AGENDA_NB',2,'5','chaine',0,'','2013-03-13 15:36:29'),(4698,'MAIN_DISABLE_ALL_MAILS',1,'0','chaine',0,'','2013-03-13 17:22:24'),(4699,'MAIN_MAIL_SENDMODE',1,'mail','chaine',0,'','2015-07-19 13:41:06'),(4700,'MAIN_MAIL_SMTPS_ID',1,'eldy10@mail.com','chaine',0,'','2015-07-19 13:41:06'),(4701,'MAIN_MAIL_SMTPS_PW',1,'bidonge','chaine',0,'','2015-07-19 13:41:06'),(4711,'GOOGLE_ENABLE_AGENDA',1,'1','chaine',0,'','2013-03-13 19:37:38'),(4712,'GOOGLE_AGENDA_NAME1',1,'asso master','chaine',0,'','2013-03-13 19:37:38'),(4713,'GOOGLE_AGENDA_SRC1',1,'assodolibarr@mail.com','chaine',0,'','2013-03-13 19:37:38'),(4714,'GOOGLE_AGENDA_COLOR1',1,'1B887A','chaine',0,'','2013-03-13 19:37:38'),(4715,'GOOGLE_AGENDA_COLOR2',1,'7A367A','chaine',0,'','2013-03-13 19:37:38'),(4716,'GOOGLE_AGENDA_COLOR3',1,'7A367A','chaine',0,'','2013-03-13 19:37:38'),(4717,'GOOGLE_AGENDA_COLOR4',1,'7A367A','chaine',0,'','2013-03-13 19:37:38'),(4718,'GOOGLE_AGENDA_COLOR5',1,'7A367A','chaine',0,'','2013-03-13 19:37:38'),(4719,'GOOGLE_AGENDA_TIMEZONE',1,'Europe/Paris','chaine',0,'','2013-03-13 19:37:38'),(4720,'GOOGLE_AGENDA_NB',1,'5','chaine',0,'','2013-03-13 19:37:38'),(4725,'SOCIETE_CODECLIENT_ADDON',2,'mod_codeclient_leopard','chaine',0,'Module to control third parties codes','2013-03-13 20:21:35'),(4726,'SOCIETE_CODECOMPTA_ADDON',2,'mod_codecompta_panicum','chaine',0,'Module to control third parties codes','2013-03-13 20:21:35'),(4727,'SOCIETE_FISCAL_MONTH_START',2,'','chaine',0,'Mettre le numero du mois du debut d\\\'annee fiscale, ex: 9 pour septembre','2013-03-13 20:21:35'),(4728,'MAIN_SEARCHFORM_SOCIETE',2,'1','yesno',0,'Show form for quick company search','2013-03-13 20:21:35'),(4729,'MAIN_SEARCHFORM_CONTACT',2,'1','yesno',0,'Show form for quick contact search','2013-03-13 20:21:35'),(4730,'COMPANY_ADDON_PDF_ODT_PATH',2,'DOL_DATA_ROOT/doctemplates/thirdparties','chaine',0,NULL,'2013-03-13 20:21:35'),(4743,'MAIN_MODULE_CLICKTODIAL',2,'1',NULL,0,NULL,'2013-03-13 20:30:28'),(4744,'MAIN_MODULE_NOTIFICATION',2,'1',NULL,0,NULL,'2013-03-13 20:30:34'),(4745,'MAIN_MODULE_WEBSERVICES',2,'1',NULL,0,NULL,'2013-03-13 20:30:41'),(4746,'MAIN_MODULE_PROPALE',2,'1',NULL,0,NULL,'2013-03-13 20:32:38'),(4747,'PROPALE_ADDON_PDF',2,'azur','chaine',0,'Nom du gestionnaire de generation des propales en PDF','2013-03-13 20:32:38'),(4748,'PROPALE_ADDON',2,'mod_propale_marbre','chaine',0,'Nom du gestionnaire de numerotation des propales','2013-03-13 20:32:38'),(4749,'PROPALE_VALIDITY_DURATION',2,'15','chaine',0,'Duration of validity of business proposals','2013-03-13 20:32:38'),(4750,'PROPALE_ADDON_PDF_ODT_PATH',2,'DOL_DATA_ROOT/doctemplates/proposals','chaine',0,NULL,'2013-03-13 20:32:38'),(4752,'MAIN_MODULE_TAX',2,'1',NULL,0,NULL,'2013-03-13 20:32:47'),(4753,'MAIN_MODULE_DON',2,'1',NULL,0,NULL,'2013-03-13 20:32:54'),(4754,'DON_ADDON_MODEL',2,'html_cerfafr','chaine',0,'Nom du gestionnaire de generation de recu de dons','2013-03-13 20:32:54'),(4755,'POS_USE_TICKETS',2,'1','chaine',0,'','2013-03-13 20:33:09'),(4756,'POS_MAX_TTC',2,'100','chaine',0,'','2013-03-13 20:33:09'),(4757,'MAIN_MODULE_POS',2,'1',NULL,0,NULL,'2013-03-13 20:33:09'),(4758,'TICKET_ADDON',2,'mod_ticket_avenc','chaine',0,'Nom du gestionnaire de numerotation des tickets','2013-03-13 20:33:09'),(4759,'MAIN_MODULE_BANQUE',2,'1',NULL,0,NULL,'2013-03-13 20:33:09'),(4760,'MAIN_MODULE_FACTURE',2,'1',NULL,0,NULL,'2013-03-13 20:33:09'),(4761,'FACTURE_ADDON_PDF',2,'crabe','chaine',0,'Name of PDF model of invoice','2013-03-13 20:33:09'),(4762,'FACTURE_ADDON',2,'mod_facture_terre','chaine',0,'Name of numbering numerotation rules of invoice','2013-03-13 20:33:09'),(4763,'FACTURE_ADDON_PDF_ODT_PATH',2,'DOL_DATA_ROOT/doctemplates/invoices','chaine',0,NULL,'2013-03-13 20:33:09'),(4764,'MAIN_MODULE_SOCIETE',2,'1',NULL,0,NULL,'2013-03-13 20:33:09'),(4765,'MAIN_MODULE_PRODUCT',2,'1',NULL,0,NULL,'2013-03-13 20:33:09'),(4766,'PRODUCT_CODEPRODUCT_ADDON',2,'mod_codeproduct_leopard','chaine',0,'Module to control product codes','2013-03-13 20:33:09'),(4767,'MAIN_SEARCHFORM_PRODUITSERVICE',2,'1','yesno',0,'Show form for quick product search','2013-03-13 20:33:09'),(4772,'FACSIM_ADDON',2,'mod_facsim_alcoy','chaine',0,'','2013-03-13 20:33:32'),(4773,'MAIN_MODULE_MAILING',2,'1',NULL,0,NULL,'2013-03-13 20:33:37'),(4774,'MAIN_MODULE_OPENSURVEY',2,'1',NULL,0,NULL,'2013-03-13 20:33:42'),(4782,'AGENDA_USE_EVENT_TYPE',2,'1','chaine',0,'','2013-03-13 20:53:36'),(4884,'AGENDA_DISABLE_EXT',2,'1','chaine',0,'','2013-03-13 22:03:40'),(4928,'COMMANDE_SUPPLIER_ADDON_NUMBER',1,'mod_commande_fournisseur_muguet','chaine',0,'Nom du gestionnaire de numerotation des commandes fournisseur','2013-03-22 09:24:29'),(4929,'INVOICE_SUPPLIER_ADDON_NUMBER',1,'mod_facture_fournisseur_cactus','chaine',0,'Nom du gestionnaire de numerotation des factures fournisseur','2013-03-22 09:24:29'),(5001,'MAIN_CRON_KEY',0,'bc54582fe30d5d4a830c6f582ec28810','chaine',0,'','2013-03-23 17:54:53'),(5009,'CRON_KEY',0,'2c2e755c20be2014098f629865598006','chaine',0,'','2013-03-23 18:06:24'),(5075,'MAIN_MENU_STANDARD',1,'eldy_menu.php','chaine',0,'','2013-03-24 02:51:13'),(5076,'MAIN_MENU_SMARTPHONE',1,'eldy_menu.php','chaine',0,'','2013-03-24 02:51:13'),(5077,'MAIN_MENUFRONT_STANDARD',1,'eldy_menu.php','chaine',0,'','2013-03-24 02:51:13'),(5078,'MAIN_MENUFRONT_SMARTPHONE',1,'eldy_menu.php','chaine',0,'','2013-03-24 02:51:13'),(5139,'SOCIETE_ADD_REF_IN_LIST',1,'','yesno',0,'Display customer ref into select list','2013-09-08 23:06:08'),(5150,'PROJECT_TASK_ADDON_PDF',1,'','chaine',0,'Name of PDF/ODT tasks manager class','2013-09-08 23:06:14'),(5151,'PROJECT_TASK_ADDON',1,'mod_task_simple','chaine',0,'Name of Numbering Rule task manager class','2013-09-08 23:06:14'),(5152,'PROJECT_TASK_ADDON_PDF_ODT_PATH',1,'DOL_DATA_ROOT/doctemplates/tasks','chaine',0,'','2013-09-08 23:06:14'),(5195,'GOOGLE_DUPLICATE_INTO_THIRDPARTIES',1,'1','chaine',0,'','2013-11-07 00:02:34'),(5196,'GOOGLE_DUPLICATE_INTO_CONTACTS',1,'0','chaine',0,'','2013-11-07 00:02:34'),(5197,'GOOGLE_DUPLICATE_INTO_MEMBERS',1,'0','chaine',0,'','2013-11-07 00:02:34'),(5198,'GOOGLE_CONTACT_LOGIN',1,'eldy10@mail.com','chaine',0,'','2013-11-07 00:02:34'),(5199,'GOOGLE_CONTACT_PASSWORD',1,'bidonge','chaine',0,'','2013-11-07 00:02:34'),(5200,'GOOGLE_TAG_PREFIX',1,'Dolibarr (Thirdparties)','chaine',0,'','2013-11-07 00:02:34'),(5201,'GOOGLE_TAG_PREFIX_CONTACTS',1,'Dolibarr (Contacts/Addresses)','chaine',0,'','2013-11-07 00:02:34'),(5202,'GOOGLE_TAG_PREFIX_MEMBERS',1,'Dolibarr (Members)','chaine',0,'','2013-11-07 00:02:34'),(5239,'BOOKMARKS_SHOW_IN_MENU',1,'10','chaine',0,'','2014-03-02 15:42:26'),(5271,'DONATION_ART200',1,'','yesno',0,'Option Française - Eligibilité Art200 du CGI','2014-12-21 12:51:28'),(5272,'DONATION_ART238',1,'','yesno',0,'Option Française - Eligibilité Art238 bis du CGI','2014-12-21 12:51:28'),(5273,'DONATION_ART885',1,'','yesno',0,'Option Française - Eligibilité Art885-0 V bis du CGI','2014-12-21 12:51:28'),(5274,'DONATION_MESSAGE',1,'Thank you','chaine',0,'Message affiché sur le récépissé de versements ou dons','2014-12-21 12:51:28'),(5288,'DONATION_ACCOUNTINGACCOUNT',1,'7581','chaine',0,'Compte comptable de remise des versements ou dons','2015-07-19 13:41:21'),(5317,'INVOICE_CAN_ALWAYS_BE_REMOVED',1,'1','chaine',1,'','2015-10-03 09:25:30'),(5338,'MAIN_LANG_DEFAULT',1,'en_US','chaine',0,'','2015-10-03 10:11:33'),(5339,'MAIN_MULTILANGS',1,'1','chaine',0,'','2015-10-03 10:11:33'),(5340,'MAIN_SIZE_LISTE_LIMIT',1,'25','chaine',0,'','2015-10-03 10:11:33'),(5341,'MAIN_DISABLE_JAVASCRIPT',1,'0','chaine',0,'','2015-10-03 10:11:33'),(5342,'MAIN_BUTTON_HIDE_UNAUTHORIZED',1,'0','chaine',0,'','2015-10-03 10:11:33'),(5343,'MAIN_START_WEEK',1,'1','chaine',0,'','2015-10-03 10:11:33'),(5344,'MAIN_DEFAULT_WORKING_DAYS',1,'1-5','chaine',0,'','2015-10-03 10:11:33'),(5345,'MAIN_DEFAULT_WORKING_HOURS',1,'9-18','chaine',0,'','2015-10-03 10:11:33'),(5346,'MAIN_SHOW_LOGO',1,'1','chaine',0,'','2015-10-03 10:11:33'),(5347,'MAIN_FIRSTNAME_NAME_POSITION',1,'0','chaine',0,'','2015-10-03 10:11:33'),(5348,'MAIN_THEME',1,'eldy','chaine',0,'','2015-10-03 10:11:33'),(5349,'MAIN_SEARCHFORM_CONTACT',1,'1','chaine',0,'','2015-10-03 10:11:33'),(5350,'MAIN_SEARCHFORM_SOCIETE',1,'1','chaine',0,'','2015-10-03 10:11:33'),(5351,'MAIN_SEARCHFORM_PRODUITSERVICE',1,'1','chaine',0,'','2015-10-03 10:11:33'),(5352,'MAIN_SEARCHFORM_PRODUITSERVICE_SUPPLIER',1,'0','chaine',0,'','2015-10-03 10:11:33'),(5353,'MAIN_SEARCHFORM_ADHERENT',1,'1','chaine',0,'','2015-10-03 10:11:33'),(5354,'MAIN_SEARCHFORM_PROJECT',1,'0','chaine',0,'','2015-10-03 10:11:33'),(5355,'MAIN_HELPCENTER_DISABLELINK',0,'1','chaine',0,'','2015-10-03 10:11:33'),(5356,'MAIN_HOME',1,'__(NoteSomeFeaturesAreDisabled)__
\r\n
\r\n__(SomeTranslationAreUncomplete)__
','chaine',0,'','2015-10-03 10:11:33'),(5357,'MAIN_HELP_DISABLELINK',0,'0','chaine',0,'','2015-10-03 10:11:33'),(5358,'MAIN_BUGTRACK_ENABLELINK',1,'0','chaine',0,'','2015-10-03 10:11:33'),(5359,'THEME_ELDY_USE_HOVER',1,'1','chaine',0,'','2015-10-03 10:11:33'),(5394,'FCKEDITOR_ENABLE_DETAILS',1,'1','yesno',0,'WYSIWIG for products details lines for all entities','2015-11-04 15:27:44'),(5395,'FCKEDITOR_ENABLE_USERSIGN',1,'1','yesno',0,'WYSIWIG for user signature','2015-11-04 15:27:44'),(5396,'FCKEDITOR_ENABLE_MAIL',1,'1','yesno',0,'WYSIWIG for products details lines for all entities','2015-11-04 15:27:44'),(5398,'CATEGORIE_RECURSIV_ADD',1,'','yesno',0,'Affect parent categories','2015-11-04 15:27:46'),(5403,'MAIN_MODULE_FCKEDITOR',1,'1',NULL,0,NULL,'2015-11-04 15:41:40'),(5404,'MAIN_MODULE_CATEGORIE',1,'1',NULL,0,NULL,'2015-11-04 15:41:43'),(5415,'EXPEDITION_ADDON_PDF_ODT_PATH',1,'DOL_DATA_ROOT/doctemplates/shipment','chaine',0,NULL,'2015-11-15 22:38:28'),(5416,'LIVRAISON_ADDON_PDF_ODT_PATH',1,'DOL_DATA_ROOT/doctemplates/delivery','chaine',0,NULL,'2015-11-15 22:38:28'),(5419,'MAIN_MODULE_CASHDESK',1,'1',NULL,0,NULL,'2015-11-15 22:38:33'),(5426,'MAIN_MODULE_PROJET',1,'1',NULL,0,NULL,'2015-11-15 22:38:44'),(5427,'PROJECT_ADDON_PDF_ODT_PATH',1,'DOL_DATA_ROOT/doctemplates/projects','chaine',0,NULL,'2015-11-15 22:38:44'),(5428,'PROJECT_USE_OPPORTUNIES',1,'1','chaine',0,NULL,'2015-11-15 22:38:44'),(5430,'MAIN_MODULE_EXPORT',1,'1',NULL,0,NULL,'2015-11-15 22:38:56'),(5431,'MAIN_MODULE_IMPORT',1,'1',NULL,0,NULL,'2015-11-15 22:38:58'),(5432,'MAIN_MODULE_MAILING',1,'1',NULL,0,NULL,'2015-11-15 22:39:00'),(5434,'EXPENSEREPORT_ADDON_PDF',1,'standard','chaine',0,'Name of manager to build PDF expense reports documents','2015-11-15 22:39:05'),(5435,'MAIN_MODULE_SALARIES',1,'1',NULL,0,NULL,'2015-11-15 22:39:08'),(5436,'SALARIES_ACCOUNTING_ACCOUNT_PAYMENT',1,'421','chaine',0,NULL,'2015-11-15 22:39:08'),(5437,'SALARIES_ACCOUNTING_ACCOUNT_CHARGE',1,'641','chaine',0,NULL,'2015-11-15 22:39:08'),(5440,'MAIN_MODULE_ADHERENT',1,'1',NULL,0,NULL,'2015-11-15 22:39:17'),(5441,'ADHERENT_ETIQUETTE_TEXT',1,'%FULLNAME%\n%ADDRESS%\n%ZIP% %TOWN%\n%COUNTRY%','texte',0,'Text to print on member address sheets','2015-11-15 22:39:17'),(5442,'MAIN_MODULE_TAX',1,'1',NULL,0,NULL,'2015-11-15 22:39:22'),(5443,'MAIN_MODULE_PRELEVEMENT',1,'1',NULL,0,NULL,'2015-11-15 22:39:33'),(5449,'MAIN_MODULE_COMPTABILITE',1,'1',NULL,0,NULL,'2015-11-15 22:39:46'),(5452,'MAIN_MODULE_BANQUE',1,'1',NULL,0,NULL,'2015-11-15 22:39:46'),(5453,'MAIN_MODULE_CONTRAT',1,'1',NULL,0,NULL,'2015-11-15 22:39:52'),(5455,'MAIN_MODULE_FICHEINTER',1,'1',NULL,0,NULL,'2015-11-15 22:39:56'),(5458,'MAIN_MODULE_BOOKMARK',1,'1',NULL,0,NULL,'2015-11-15 22:40:51'),(5459,'MAIN_MODULE_PAYPAL',1,'1',NULL,0,NULL,'2015-11-15 22:41:02'),(5460,'MAIN_MODULE_MARGIN',1,'1',NULL,0,NULL,'2015-11-15 22:41:47'),(5461,'MAIN_MODULE_MARGIN_TABS_0',1,'product:+margin:Margins:margins:$user->rights->margins->liretous:/margin/tabs/productMargins.php?id=__ID__','chaine',0,NULL,'2015-11-15 22:41:47'),(5462,'MAIN_MODULE_MARGIN_TABS_1',1,'thirdparty:+margin:Margins:margins:empty($user->societe_id) && $user->rights->margins->liretous && ($object->client > 0):/margin/tabs/thirdpartyMargins.php?socid=__ID__','chaine',0,NULL,'2015-11-15 22:41:47'),(5463,'MAIN_MODULE_PROPALE',1,'1',NULL,0,NULL,'2015-11-15 22:41:47'),(5483,'GENBARCODE_BARCODETYPE_THIRDPARTY',1,'6','chaine',0,'','2016-01-16 15:49:43'),(5484,'PRODUIT_DEFAULT_BARCODE_TYPE',1,'2','chaine',0,'','2016-01-16 15:49:46'),(5539,'PRODUCT_USE_OLD_PATH_FOR_PHOTO',0,'0','chaine',1,'Use old path for products images','2016-01-22 13:34:23'),(5540,'MAIN_SOAP_DEBUG',1,'0','chaine',1,'','2016-01-22 13:34:57'),(5541,'MODULE_GOOGLE_DEBUG',1,'0','chaine',1,'','2016-01-22 13:34:57'),(5543,'MAIN_MAIL_DEBUG',1,'1','chaine',1,'','2016-01-22 13:35:24'),(5548,'MAIN_MODULE_ECM',1,'1',NULL,0,NULL,'2016-01-22 17:26:43'),(5551,'MAIN_MODULE_HOLIDAY',1,'1',NULL,0,NULL,'2016-01-22 17:26:43'),(5552,'MAIN_MODULE_HOLIDAY_TABS_0',1,'user:+paidholidays:CPTitreMenu:holiday:$user->rights->holiday->read:/holiday/list.php?mainmenu=holiday&id=__ID__','chaine',0,NULL,'2016-01-22 17:26:43'),(5555,'MAIN_MODULE_SERVICE',1,'1',NULL,0,NULL,'2016-01-22 17:26:43'),(5560,'MAILING_LIMIT_SENDBYWEB',0,'25','chaine',1,'Number of targets to defined packet size when sending mass email','2016-01-22 17:28:18'),(5561,'SYSLOG_HANDLERS',0,'[\"mod_syslog_file\"]','chaine',0,'Which logger to use','2016-01-22 17:28:18'),(5562,'SYSLOG_FILE',0,'DOL_DATA_ROOT/dolibarr.log','chaine',0,'Directory where to write log file','2016-01-22 17:28:18'),(5568,'MAIN_MAIL_EMAIL_FROM',1,'robot@domain.com','chaine',0,'EMail emetteur pour les emails automatiques Dolibarr','2016-01-22 17:28:18'),(5586,'MAIN_DELAY_EXPENSEREPORTS_TO_PAY',1,'31','chaine',0,'Tolérance de retard avant alerte (en jours) sur les notes de frais impayées','2016-01-22 17:28:18'),(5587,'MAIN_FIX_FOR_BUGGED_MTA',1,'1','chaine',1,'Set constant to fix email ending from PHP with some linux ike system','2016-01-22 17:28:18'),(5589,'MAIN_MODULE_USER',0,'1',NULL,0,NULL,'2016-01-22 17:28:42'),(5590,'MAIN_VERSION_LAST_INSTALL',0,'3.8.3','chaine',0,'Dolibarr version when install','2016-01-22 17:28:42'),(5604,'MAIN_INFO_SOCIETE_LOGO',1,'mybigcompany.png','chaine',0,'','2016-01-22 17:33:49'),(5605,'MAIN_INFO_SOCIETE_LOGO_SMALL',1,'mybigcompany_small.png','chaine',0,'','2016-01-22 17:33:49'),(5606,'MAIN_INFO_SOCIETE_LOGO_MINI',1,'mybigcompany_mini.png','chaine',0,'','2016-01-22 17:33:49'),(5612,'MAIN_ENABLE_LOG_TO_HTML',0,'0','chaine',1,'If this option is set to 1, it is possible to see log output at end of HTML sources by adding paramater logtohtml=1 on URL','2016-03-13 10:54:45'),(5614,'MAIN_SIZE_SHORTLISTE_LIMIT',1,'4','chaine',0,'Longueur maximum des listes courtes (fiche client)','2016-03-13 10:54:46'),(5622,'MAIN_MODULE_BARCODE',1,'1',NULL,0,NULL,'2016-07-30 11:12:59'),(5623,'MAIN_MODULE_FACTURE',1,'1',NULL,0,NULL,'2016-07-30 11:12:59'),(5624,'MAIN_VERSION_LAST_UPGRADE',0,'4.0.0-rc2','chaine',0,'Dolibarr version for last upgrade','2016-07-30 11:13:02'),(5626,'MAIN_MODULE_SUPPLIERPROPOSAL',1,'1',NULL,0,NULL,'2016-07-30 11:13:20'),(5627,'SUPPLIER_PROPOSAL_ADDON_PDF',1,'aurore','chaine',0,'Name of submodule to generate PDF for supplier quotation request','2016-07-30 11:13:20'),(5628,'SUPPLIER_PROPOSAL_ADDON',1,'mod_supplier_proposal_marbre','chaine',0,'Name of submodule to number supplier quotation request','2016-07-30 11:13:20'),(5629,'SUPPLIER_PROPOSAL_ADDON_PDF_ODT_PATH',1,'DOL_DATA_ROOT/doctemplates/supplier_proposal','chaine',0,NULL,'2016-07-30 11:13:20'),(5632,'MAIN_MODULE_RESOURCE',1,'1',NULL,0,NULL,'2016-07-30 11:13:32'),(5633,'MAIN_MODULE_API',1,'1',NULL,0,NULL,'2016-07-30 11:13:54'),(5634,'MAIN_MODULE_WEBSERVICES',1,'1',NULL,0,NULL,'2016-07-30 11:13:56'),(5635,'WEBSERVICES_KEY',1,'dolibarrkey','chaine',0,'','2016-07-30 11:14:04'),(5636,'MAIN_MODULE_CRON',1,'1',NULL,0,NULL,'2016-07-30 11:14:25'),(5637,'MAIN_MODULE_SYSLOG',0,'1',NULL,0,NULL,'2016-07-30 11:14:27'),(5638,'MAIN_MODULE_EXTERNALRSS',1,'1',NULL,0,NULL,'2016-07-30 11:15:04'),(5639,'EXTERNAL_RSS_TITLE_1',1,'Dolibarr.org News','chaine',0,'','2016-07-30 11:15:25'),(5640,'EXTERNAL_RSS_URLRSS_1',1,'https://www.dolibarr.org/rss','chaine',0,'','2016-07-30 11:15:25'),(5641,'MAIN_MODULE_DON',1,'1',NULL,0,NULL,'2016-07-30 11:16:22'),(5642,'SOCIETE_CODECOMPTA_ADDON',1,'mod_codecompta_aquarium','chaine',0,'','2016-07-30 11:16:42'),(5680,'MAIN_INFO_SOCIETE_COUNTRY',1,'14:CA:Canada','chaine',0,'','2016-07-30 11:19:05'),(5681,'MAIN_INFO_SOCIETE_NOM',1,'MyBigCompany','chaine',0,'','2016-07-30 11:19:05'),(5682,'MAIN_INFO_SOCIETE_ADDRESS',1,'21 Jump street','chaine',0,'','2016-07-30 11:19:05'),(5683,'MAIN_INFO_SOCIETE_TOWN',1,'MyTown','chaine',0,'','2016-07-30 11:19:05'),(5684,'MAIN_INFO_SOCIETE_ZIP',1,'75500','chaine',0,'','2016-07-30 11:19:05'),(5685,'MAIN_INFO_SOCIETE_STATE',1,'1514','chaine',0,'','2016-07-30 11:19:05'),(5686,'MAIN_MONNAIE',1,'EUR','chaine',0,'','2016-07-30 11:19:05'),(5687,'MAIN_INFO_SOCIETE_TEL',1,'09123123','chaine',0,'','2016-07-30 11:19:05'),(5688,'MAIN_INFO_SOCIETE_FAX',1,'09123124','chaine',0,'','2016-07-30 11:19:05'),(5689,'MAIN_INFO_SOCIETE_MAIL',1,'myemail@mybigcompany.com','chaine',0,'','2016-07-30 11:19:05'),(5690,'MAIN_INFO_SOCIETE_WEB',1,'http://www.dolibarr.org','chaine',0,'','2016-07-30 11:19:05'),(5691,'MAIN_INFO_SOCIETE_NOTE',1,'This is note about my company','chaine',0,'','2016-07-30 11:19:05'),(5692,'MAIN_INFO_SOCIETE_GENCOD',1,'1234567890','chaine',0,'','2016-07-30 11:19:05'),(5693,'MAIN_INFO_SOCIETE_MANAGERS',1,'Zack Zeceo','chaine',0,'','2016-07-30 11:19:05'),(5694,'MAIN_INFO_CAPITAL',1,'10000','chaine',0,'','2016-07-30 11:19:05'),(5695,'MAIN_INFO_SOCIETE_FORME_JURIDIQUE',1,'0','chaine',0,'','2016-07-30 11:19:05'),(5696,'MAIN_INFO_SIREN',1,'123456','chaine',0,'','2016-07-30 11:19:05'),(5697,'MAIN_INFO_TVAINTRA',1,'FR1234567','chaine',0,'','2016-07-30 11:19:05'),(5698,'MAIN_INFO_SOCIETE_OBJECT',1,'A company demo to show how Dolibarr ERP CRM is wonderfull','chaine',0,'','2016-07-30 11:19:05'),(5699,'SOCIETE_FISCAL_MONTH_START',1,'1','chaine',0,'','2016-07-30 11:19:05'),(5700,'FACTURE_TVAOPTION',1,'1','chaine',0,'','2016-07-30 11:19:05'),(5701,'FACTURE_LOCAL_TAX1_OPTION',1,'localtax1on','chaine',0,'','2016-07-30 11:19:05'),(5702,'MAIN_INFO_VALUE_LOCALTAX1',1,'0','chaine',0,'','2016-07-30 11:19:05'),(5703,'MAIN_INFO_LOCALTAX_CALC1',1,'0','chaine',0,'','2016-07-30 11:19:05'),(5704,'PROJECT_USE_OPPORTUNITIES',1,'1','chaine',0,'','2016-07-30 11:19:17'),(5707,'CASHDESK_NO_DECREASE_STOCK',1,'1','chaine',0,'','2016-07-30 13:38:11'),(5708,'MAIN_MODULE_PRODUCTBATCH',1,'1',NULL,0,NULL,'2016-07-30 13:38:11'),(5710,'MAIN_MODULE_STOCK',1,'1',NULL,0,NULL,'2016-07-30 13:38:11'),(5711,'MAIN_MODULE_PRODUCT',1,'1',NULL,0,NULL,'2016-07-30 13:38:11'),(5712,'MAIN_MODULE_EXPEDITION',1,'1',NULL,0,NULL,'2016-07-30 13:38:11'),(5713,'MAIN_MODULE_COMMANDE',1,'1',NULL,0,NULL,'2016-07-30 13:38:11'),(5715,'MAIN_MODULE_FOURNISSEUR',1,'1',NULL,0,NULL,'2016-07-30 13:38:11'),(5716,'MAIN_MODULE_SOCIETE',1,'1',NULL,0,NULL,'2016-07-30 13:38:11'),(5765,'MAIN_MODULE_AGENDA',1,'1',NULL,0,NULL,'2016-07-30 15:42:32'),(5766,'MAIN_AGENDA_ACTIONAUTO_COMPANY_SENTBYMAIL',1,'1','chaine',0,NULL,'2016-07-30 15:42:32'),(5767,'MAIN_AGENDA_ACTIONAUTO_COMPANY_CREATE',1,'1','chaine',0,NULL,'2016-07-30 15:42:32'),(5768,'MAIN_AGENDA_ACTIONAUTO_PROPAL_VALIDATE',1,'1','chaine',0,NULL,'2016-07-30 15:42:32'),(5769,'MAIN_AGENDA_ACTIONAUTO_PROPAL_CLOSE_SIGNED',1,'1','chaine',0,NULL,'2016-07-30 15:42:32'),(5770,'MAIN_AGENDA_ACTIONAUTO_PROPAL_CLOSE_REFUSED',1,'1','chaine',0,NULL,'2016-07-30 15:42:32'),(5771,'MAIN_AGENDA_ACTIONAUTO_PROPAL_CLASSIFY_BILLED',1,'1','chaine',0,NULL,'2016-07-30 15:42:32'),(5772,'MAIN_AGENDA_ACTIONAUTO_PROPAL_SENTBYMAIL',1,'1','chaine',0,NULL,'2016-07-30 15:42:32'),(5773,'MAIN_AGENDA_ACTIONAUTO_ORDER_VALIDATE',1,'1','chaine',0,NULL,'2016-07-30 15:42:32'),(5774,'MAIN_AGENDA_ACTIONAUTO_ORDER_CLOSE',1,'1','chaine',0,NULL,'2016-07-30 15:42:32'),(5775,'MAIN_AGENDA_ACTIONAUTO_ORDER_CLASSIFY_BILLED',1,'1','chaine',0,NULL,'2016-07-30 15:42:32'),(5776,'MAIN_AGENDA_ACTIONAUTO_ORDER_CANCEL',1,'1','chaine',0,NULL,'2016-07-30 15:42:32'),(5777,'MAIN_AGENDA_ACTIONAUTO_ORDER_SENTBYMAIL',1,'1','chaine',0,NULL,'2016-07-30 15:42:32'),(5778,'MAIN_AGENDA_ACTIONAUTO_BILL_VALIDATE',1,'1','chaine',0,NULL,'2016-07-30 15:42:32'),(5779,'MAIN_AGENDA_ACTIONAUTO_BILL_PAYED',1,'1','chaine',0,NULL,'2016-07-30 15:42:32'),(5780,'MAIN_AGENDA_ACTIONAUTO_BILL_CANCEL',1,'1','chaine',0,NULL,'2016-07-30 15:42:32'),(5781,'MAIN_AGENDA_ACTIONAUTO_BILL_SENTBYMAIL',1,'1','chaine',0,NULL,'2016-07-30 15:42:32'),(5782,'MAIN_AGENDA_ACTIONAUTO_BILL_UNVALIDATE',1,'1','chaine',0,NULL,'2016-07-30 15:42:32'),(5783,'MAIN_AGENDA_ACTIONAUTO_ORDER_SUPPLIER_VALIDATE',1,'1','chaine',0,NULL,'2016-07-30 15:42:32'),(5784,'MAIN_AGENDA_ACTIONAUTO_ORDER_SUPPLIER_APPROVE',1,'1','chaine',0,NULL,'2016-07-30 15:42:32'),(5785,'MAIN_AGENDA_ACTIONAUTO_ORDER_SUPPLIER_SUBMIT',1,'1','chaine',0,NULL,'2016-07-30 15:42:32'),(5786,'MAIN_AGENDA_ACTIONAUTO_ORDER_SUPPLIER_RECEIVE',1,'1','chaine',0,NULL,'2016-07-30 15:42:32'),(5787,'MAIN_AGENDA_ACTIONAUTO_ORDER_SUPPLIER_REFUSE',1,'1','chaine',0,NULL,'2016-07-30 15:42:32'),(5788,'MAIN_AGENDA_ACTIONAUTO_ORDER_SUPPLIER_SENTBYMAIL',1,'1','chaine',0,NULL,'2016-07-30 15:42:32'),(5789,'MAIN_AGENDA_ACTIONAUTO_ORDER_SUPPLIER_CLASSIFY_BILLED',1,'1','chaine',0,NULL,'2016-07-30 15:42:32'),(5790,'MAIN_AGENDA_ACTIONAUTO_BILL_SUPPLIER_VALIDATE',1,'1','chaine',0,NULL,'2016-07-30 15:42:32'),(5791,'MAIN_AGENDA_ACTIONAUTO_BILL_SUPPLIER_UNVALIDATE',1,'1','chaine',0,NULL,'2016-07-30 15:42:32'),(5792,'MAIN_AGENDA_ACTIONAUTO_BILL_SUPPLIER_PAYED',1,'1','chaine',0,NULL,'2016-07-30 15:42:32'),(5793,'MAIN_AGENDA_ACTIONAUTO_BILL_SUPPLIER_SENTBYMAIL',1,'1','chaine',0,NULL,'2016-07-30 15:42:32'),(5794,'MAIN_AGENDA_ACTIONAUTO_BILL_SUPPLIER_CANCELED',1,'1','chaine',0,NULL,'2016-07-30 15:42:32'),(5795,'MAIN_AGENDA_ACTIONAUTO_CONTRACT_VALIDATE',1,'1','chaine',0,NULL,'2016-07-30 15:42:32'),(5796,'MAIN_AGENDA_ACTIONAUTO_FICHINTER_VALIDATE',1,'1','chaine',0,NULL,'2016-07-30 15:42:32'),(5797,'MAIN_AGENDA_ACTIONAUTO_FICHINTER_CLASSIFY_BILLED',1,'1','chaine',0,NULL,'2016-07-30 15:42:32'),(5798,'MAIN_AGENDA_ACTIONAUTO_FICHINTER_CLASSIFY_UNBILLED',1,'1','chaine',0,NULL,'2016-07-30 15:42:32'),(5799,'MAIN_AGENDA_ACTIONAUTO_FICHINTER_REOPEN',1,'1','chaine',0,NULL,'2016-07-30 15:42:32'),(5800,'MAIN_AGENDA_ACTIONAUTO_FICHINTER_SENTBYMAIL',1,'1','chaine',0,NULL,'2016-07-30 15:42:32'),(5801,'MAIN_AGENDA_ACTIONAUTO_SHIPPING_VALIDATE',1,'1','chaine',0,NULL,'2016-07-30 15:42:32'),(5802,'MAIN_AGENDA_ACTIONAUTO_SHIPPING_SENTBYMAIL',1,'1','chaine',0,NULL,'2016-07-30 15:42:32'),(5803,'MAIN_AGENDA_ACTIONAUTO_MEMBER_VALIDATE',1,'1','chaine',0,NULL,'2016-07-30 15:42:32'),(5804,'MAIN_AGENDA_ACTIONAUTO_MEMBER_SUBSCRIPTION',1,'1','chaine',0,NULL,'2016-07-30 15:42:32'),(5805,'MAIN_AGENDA_ACTIONAUTO_MEMBER_RESILIATE',1,'1','chaine',0,NULL,'2016-07-30 15:42:32'),(5806,'MAIN_AGENDA_ACTIONAUTO_MEMBER_MODIFY',1,'1','chaine',0,NULL,'2016-07-30 15:42:32'),(5807,'MAIN_AGENDA_ACTIONAUTO_MEMBER_DELETE',1,'1','chaine',0,NULL,'2016-07-30 15:42:32'),(5808,'MARGIN_TYPE',1,'costprice','chaine',0,'','2016-07-30 16:32:18'),(5809,'DISPLAY_MARGIN_RATES',1,'1','chaine',0,'','2016-07-30 16:32:20'),(5810,'MAIN_FEATURES_LEVEL',0,'0','chaine',1,'Level of features to show (0=stable only, 1=stable+experimental, 2=stable+experimental+development','2016-07-30 18:36:15'),(5812,'MAIN_MODULE_OPENSURVEY',1,'1',NULL,0,NULL,'2016-07-30 19:04:07'),(5813,'USER_PASSWORD_PATTERN',1,'8;1;1;1;3;1','chaine',0,'','2016-07-31 16:04:58'),(5814,'MAIN_MODULE_EXPENSEREPORT',1,'1',NULL,0,NULL,'2016-07-31 21:14:32'); +/*!40000 ALTER TABLE `llx_const` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_contrat` +-- + +DROP TABLE IF EXISTS `llx_contrat`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_contrat` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `ref` varchar(30) DEFAULT NULL, + `ref_ext` varchar(30) DEFAULT NULL, + `ref_supplier` varchar(30) DEFAULT NULL, + `entity` int(11) NOT NULL DEFAULT '1', + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `datec` datetime DEFAULT NULL, + `date_contrat` datetime DEFAULT NULL, + `statut` smallint(6) DEFAULT '0', + `mise_en_service` datetime DEFAULT NULL, + `fin_validite` datetime DEFAULT NULL, + `date_cloture` datetime DEFAULT NULL, + `fk_soc` int(11) NOT NULL, + `fk_projet` int(11) DEFAULT NULL, + `fk_commercial_signature` int(11) DEFAULT NULL, + `fk_commercial_suivi` int(11) DEFAULT NULL, + `fk_user_author` int(11) NOT NULL DEFAULT '0', + `fk_user_mise_en_service` int(11) DEFAULT NULL, + `fk_user_cloture` int(11) DEFAULT NULL, + `note_private` text, + `note_public` text, + `model_pdf` varchar(255) DEFAULT NULL, + `import_key` varchar(14) DEFAULT NULL, + `extraparams` varchar(255) DEFAULT NULL, + `ref_customer` varchar(30) DEFAULT NULL, + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_contrat_ref` (`ref`,`entity`), + KEY `idx_contrat_fk_soc` (`fk_soc`), + KEY `idx_contrat_fk_user_author` (`fk_user_author`), + CONSTRAINT `fk_contrat_fk_soc` FOREIGN KEY (`fk_soc`) REFERENCES `llx_societe` (`rowid`), + CONSTRAINT `fk_contrat_user_author` FOREIGN KEY (`fk_user_author`) REFERENCES `llx_user` (`rowid`) +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_contrat` +-- + +LOCK TABLES `llx_contrat` WRITE; +/*!40000 ALTER TABLE `llx_contrat` DISABLE KEYS */; +INSERT INTO `llx_contrat` VALUES (1,'CONTRACT1',NULL,NULL,1,'2010-07-08 23:53:55','2010-07-09 01:53:25','2010-07-09 00:00:00',1,NULL,NULL,NULL,3,NULL,2,2,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(2,'CONTRAT1',NULL,NULL,1,'2010-07-10 16:18:16','2010-07-10 18:13:37','2010-07-10 00:00:00',1,NULL,NULL,NULL,2,NULL,2,2,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(3,'CT1303-0001',NULL,NULL,1,'2013-03-06 09:05:07','2013-03-06 10:04:57','2013-03-06 00:00:00',1,NULL,NULL,NULL,19,NULL,1,1,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); +/*!40000 ALTER TABLE `llx_contrat` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_contrat_extrafields` +-- + +DROP TABLE IF EXISTS `llx_contrat_extrafields`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_contrat_extrafields` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `fk_object` int(11) NOT NULL, + `import_key` varchar(14) DEFAULT NULL, + PRIMARY KEY (`rowid`), + KEY `idx_contrat_extrafields` (`fk_object`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_contrat_extrafields` +-- + +LOCK TABLES `llx_contrat_extrafields` WRITE; +/*!40000 ALTER TABLE `llx_contrat_extrafields` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_contrat_extrafields` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_contratdet` +-- + +DROP TABLE IF EXISTS `llx_contratdet`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_contratdet` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `fk_contrat` int(11) NOT NULL, + `fk_product` int(11) DEFAULT NULL, + `statut` smallint(6) DEFAULT '0', + `label` text, + `description` text, + `fk_remise_except` int(11) DEFAULT NULL, + `date_commande` datetime DEFAULT NULL, + `date_ouverture_prevue` datetime DEFAULT NULL, + `date_ouverture` datetime DEFAULT NULL, + `date_fin_validite` datetime DEFAULT NULL, + `date_cloture` datetime DEFAULT NULL, + `tva_tx` double(6,3) DEFAULT '0.000', + `localtax1_tx` double(6,3) DEFAULT '0.000', + `localtax1_type` varchar(10) NOT NULL DEFAULT '0', + `localtax2_tx` double(6,3) DEFAULT '0.000', + `localtax2_type` varchar(10) NOT NULL DEFAULT '0', + `qty` double NOT NULL, + `remise_percent` double DEFAULT '0', + `subprice` double(24,8) DEFAULT '0.00000000', + `price_ht` double DEFAULT NULL, + `remise` double DEFAULT '0', + `total_ht` double(24,8) DEFAULT '0.00000000', + `total_tva` double(24,8) DEFAULT '0.00000000', + `total_localtax1` double(24,8) DEFAULT '0.00000000', + `total_localtax2` double(24,8) DEFAULT '0.00000000', + `total_ttc` double(24,8) DEFAULT '0.00000000', + `product_type` int(11) DEFAULT '1', + `info_bits` int(11) DEFAULT '0', + `fk_product_fournisseur_price` int(11) DEFAULT NULL, + `buy_price_ht` double(24,8) DEFAULT '0.00000000', + `fk_user_author` int(11) NOT NULL DEFAULT '0', + `fk_user_ouverture` int(11) DEFAULT NULL, + `fk_user_cloture` int(11) DEFAULT NULL, + `commentaire` text, + `fk_unit` int(11) DEFAULT NULL, + `fk_multicurrency` int(11) DEFAULT NULL, + `multicurrency_code` varchar(255) DEFAULT NULL, + `multicurrency_subprice` double(24,8) DEFAULT '0.00000000', + `multicurrency_total_ht` double(24,8) DEFAULT '0.00000000', + `multicurrency_total_tva` double(24,8) DEFAULT '0.00000000', + `multicurrency_total_ttc` double(24,8) DEFAULT '0.00000000', + PRIMARY KEY (`rowid`), + KEY `idx_contratdet_fk_contrat` (`fk_contrat`), + KEY `idx_contratdet_fk_product` (`fk_product`), + KEY `idx_contratdet_date_ouverture_prevue` (`date_ouverture_prevue`), + KEY `idx_contratdet_date_ouverture` (`date_ouverture`), + KEY `idx_contratdet_date_fin_validite` (`date_fin_validite`), + KEY `fk_contratdet_fk_unit` (`fk_unit`), + CONSTRAINT `fk_contratdet_fk_contrat` FOREIGN KEY (`fk_contrat`) REFERENCES `llx_contrat` (`rowid`), + CONSTRAINT `fk_contratdet_fk_product` FOREIGN KEY (`fk_product`) REFERENCES `llx_product` (`rowid`), + CONSTRAINT `fk_contratdet_fk_unit` FOREIGN KEY (`fk_unit`) REFERENCES `llx_c_units` (`rowid`) +) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_contratdet` +-- + +LOCK TABLES `llx_contratdet` WRITE; +/*!40000 ALTER TABLE `llx_contratdet` DISABLE KEYS */; +INSERT INTO `llx_contratdet` VALUES (1,'2013-03-06 09:00:00',1,3,4,'','',NULL,NULL,'2010-07-09 00:00:00','2010-07-09 12:00:00','2013-03-15 00:00:00',NULL,0.000,0.000,'',0.000,'',1,0,0.00000000,0,NULL,0.00000000,0.00000000,0.00000000,0.00000000,0.00000000,1,0,0,0.00000000,0,1,1,'',NULL,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000),(2,'2010-07-10 16:14:14',2,NULL,0,'','Abonnement annuel assurance',NULL,NULL,'2010-07-10 00:00:00',NULL,'2011-07-10 00:00:00',NULL,1.000,0.000,'',0.000,'',1,0,10.00000000,10,0,10.00000000,0.10000000,0.00000000,0.00000000,10.10000000,1,0,NULL,0.00000000,0,NULL,NULL,NULL,NULL,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000),(3,'2013-03-05 10:20:58',2,3,5,'','gdfg',NULL,NULL,'2010-07-10 00:00:00','2010-07-10 12:00:00','2011-07-09 00:00:00','2013-03-06 12:00:00',4.000,0.000,'',0.000,'',1,0,0.00000000,0,NULL,0.00000000,0.00000000,0.00000000,0.00000000,0.00000000,1,0,0,0.00000000,0,1,1,'',NULL,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000),(4,'2012-12-08 13:11:17',2,3,0,'','',NULL,NULL,'2010-07-10 00:00:00',NULL,NULL,NULL,0.000,0.000,'',0.000,'',1,10,40.00000000,40,NULL,36.00000000,0.00000000,0.00000000,0.00000000,36.00000000,1,0,NULL,0.00000000,0,NULL,1,'',NULL,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000),(5,'2013-03-06 09:05:40',3,NULL,4,'','gfdg',NULL,NULL,NULL,'2013-03-06 12:00:00','2013-03-07 12:00:00',NULL,0.000,0.000,'',0.000,'',1,0,10.00000000,10,NULL,10.00000000,0.00000000,0.00000000,0.00000000,10.00000000,1,0,0,0.00000000,0,1,1,'',NULL,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000); +/*!40000 ALTER TABLE `llx_contratdet` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_contratdet_extrafields` +-- + +DROP TABLE IF EXISTS `llx_contratdet_extrafields`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_contratdet_extrafields` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `fk_object` int(11) NOT NULL, + `import_key` varchar(14) DEFAULT NULL, + PRIMARY KEY (`rowid`), + KEY `idx_contratdet_extrafields` (`fk_object`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_contratdet_extrafields` +-- + +LOCK TABLES `llx_contratdet_extrafields` WRITE; +/*!40000 ALTER TABLE `llx_contratdet_extrafields` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_contratdet_extrafields` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_contratdet_log` +-- + +DROP TABLE IF EXISTS `llx_contratdet_log`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_contratdet_log` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `fk_contratdet` int(11) NOT NULL, + `date` datetime NOT NULL, + `statut` smallint(6) NOT NULL, + `fk_user_author` int(11) NOT NULL, + `commentaire` text, + PRIMARY KEY (`rowid`), + KEY `idx_contratdet_log_fk_contratdet` (`fk_contratdet`), + KEY `idx_contratdet_log_date` (`date`), + CONSTRAINT `fk_contratdet_log_fk_contratdet` FOREIGN KEY (`fk_contratdet`) REFERENCES `llx_contratdet` (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_contratdet_log` +-- + +LOCK TABLES `llx_contratdet_log` WRITE; +/*!40000 ALTER TABLE `llx_contratdet_log` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_contratdet_log` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_cotisation` +-- + +DROP TABLE IF EXISTS `llx_cotisation`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_cotisation` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `datec` datetime DEFAULT NULL, + `fk_adherent` int(11) DEFAULT NULL, + `dateadh` datetime DEFAULT NULL, + `datef` date DEFAULT NULL, + `cotisation` double DEFAULT NULL, + `fk_bank` int(11) DEFAULT NULL, + `note` text, + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_cotisation` (`fk_adherent`,`dateadh`) +) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_cotisation` +-- + +LOCK TABLES `llx_cotisation` WRITE; +/*!40000 ALTER TABLE `llx_cotisation` DISABLE KEYS */; +INSERT INTO `llx_cotisation` VALUES (1,'2010-07-10 13:05:30','2010-07-10 15:05:30',2,'2010-07-10 00:00:00','2011-07-10',20,NULL,'Adhésion/cotisation 2010'),(2,'2010-07-11 14:20:00','2010-07-11 16:20:00',2,'2011-07-11 00:00:00','2012-07-10',10,NULL,'Adhésion/cotisation 2011'),(3,'2010-07-18 10:20:33','2010-07-18 12:20:33',2,'2012-07-11 00:00:00','2013-07-17',10,NULL,'Adhésion/cotisation 2012'),(4,'2013-03-06 15:43:37','2013-03-06 16:43:37',2,'2013-07-18 00:00:00','2014-07-17',10,NULL,'Adhésion/cotisation 2013'),(5,'2013-03-06 15:44:12','2013-03-06 16:44:12',2,'2014-07-18 00:00:00','2015-07-17',11,NULL,'Adhésion/cotisation 2014'),(6,'2013-03-06 15:47:48','2013-03-06 16:47:48',2,'2015-07-18 00:00:00','2016-07-17',10,NULL,'Adhésion/cotisation 2015'),(7,'2013-03-06 15:48:16','2013-03-06 16:48:16',2,'2016-07-18 00:00:00','2017-07-17',20,22,'Adhésion/cotisation 2016'),(8,'2013-03-20 13:17:57','2013-03-20 14:17:57',1,'2010-07-10 00:00:00','2011-07-09',10,NULL,'Adhésion/cotisation 2010'),(10,'2013-03-20 13:30:11','2013-03-20 14:30:11',1,'2011-07-10 00:00:00','2012-07-09',10,23,'Adhésion/cotisation 2011'); +/*!40000 ALTER TABLE `llx_cotisation` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_cronjob` +-- + +DROP TABLE IF EXISTS `llx_cronjob`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_cronjob` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `datec` datetime DEFAULT NULL, + `jobtype` varchar(10) NOT NULL, + `label` text NOT NULL, + `command` varchar(255) DEFAULT NULL, + `classesname` varchar(255) DEFAULT NULL, + `objectname` varchar(255) DEFAULT NULL, + `methodename` varchar(255) DEFAULT NULL, + `params` text, + `md5params` varchar(32) DEFAULT NULL, + `module_name` varchar(255) DEFAULT NULL, + `priority` int(11) DEFAULT '0', + `datelastrun` datetime DEFAULT NULL, + `datenextrun` datetime DEFAULT NULL, + `datestart` datetime DEFAULT NULL, + `dateend` datetime DEFAULT NULL, + `datelastresult` datetime DEFAULT NULL, + `lastresult` text, + `lastoutput` text, + `unitfrequency` varchar(255) NOT NULL DEFAULT '3600', + `frequency` int(11) NOT NULL DEFAULT '0', + `nbrun` int(11) DEFAULT NULL, + `status` int(11) NOT NULL DEFAULT '1', + `fk_user_author` int(11) DEFAULT NULL, + `fk_user_mod` int(11) DEFAULT NULL, + `note` text, + `libname` varchar(255) DEFAULT NULL, + `entity` int(11) DEFAULT '0', + `maxrun` int(11) NOT NULL DEFAULT '0', + `autodelete` int(11) DEFAULT '0', + `fk_mailing` int(11) DEFAULT NULL, + `test` varchar(255) DEFAULT '1', + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_cronjob` +-- + +LOCK TABLES `llx_cronjob` WRITE; +/*!40000 ALTER TABLE `llx_cronjob` DISABLE KEYS */; +INSERT INTO `llx_cronjob` VALUES (1,'2013-03-23 18:18:39','2013-03-23 19:18:39','command','aaa','aaaa','','','','','','',0,NULL,NULL,'2013-03-23 19:18:00',NULL,NULL,NULL,NULL,'3600',3600,0,0,1,1,'',NULL,0,0,0,NULL,'1'),(2,'2016-07-30 11:12:59','2016-07-30 15:12:59','method','RecurringInvoices',NULL,'compta/facture/class/facture-rec.class.php','FactureRec','createRecurringInvoices',NULL,NULL,'facture',0,NULL,NULL,'2016-07-30 15:12:59',NULL,NULL,NULL,NULL,'86400',1,NULL,1,NULL,NULL,'Generate recurring invoices',NULL,1,0,0,NULL,''),(3,'2016-07-30 11:14:25','2016-07-30 15:14:25','method','PurgeDeleteTemporaryFilesShort',NULL,'core/class/utils.class.php','Utils','purgeFiles',NULL,NULL,'cron',10,NULL,NULL,'2016-07-30 15:14:25',NULL,NULL,NULL,NULL,'604800',2,NULL,1,NULL,NULL,'PurgeDeleteTemporaryFiles',NULL,1,0,0,NULL,'1'),(4,'2016-07-30 11:14:25','2016-07-30 15:14:25','method','MakeLocalDatabaseDumpShort',NULL,'core/class/utils.class.php','Utils','dumpDatabase','none',NULL,'cron',20,NULL,NULL,'2016-07-30 15:14:25',NULL,NULL,NULL,NULL,'604800',1,NULL,0,NULL,NULL,'MakeLocalDatabaseDump',NULL,1,0,0,NULL,'1'); +/*!40000 ALTER TABLE `llx_cronjob` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_deplacement` +-- + +DROP TABLE IF EXISTS `llx_deplacement`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_deplacement` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `ref` varchar(30) DEFAULT NULL, + `entity` int(11) NOT NULL DEFAULT '1', + `datec` datetime NOT NULL, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `dated` datetime DEFAULT NULL, + `fk_user` int(11) NOT NULL, + `fk_user_author` int(11) DEFAULT NULL, + `fk_user_modif` int(11) DEFAULT NULL, + `type` varchar(12) NOT NULL, + `fk_statut` int(11) NOT NULL DEFAULT '1', + `km` double DEFAULT NULL, + `fk_soc` int(11) DEFAULT NULL, + `fk_projet` int(11) DEFAULT '0', + `note_private` text, + `note_public` text, + `extraparams` varchar(255) DEFAULT NULL, + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_deplacement` +-- + +LOCK TABLES `llx_deplacement` WRITE; +/*!40000 ALTER TABLE `llx_deplacement` DISABLE KEYS */; +INSERT INTO `llx_deplacement` VALUES (1,NULL,1,'2010-07-09 01:58:04','2010-07-08 23:58:18','2010-07-09 12:00:00',2,1,NULL,'TF_LUNCH',1,10,2,1,NULL,NULL,NULL); +/*!40000 ALTER TABLE `llx_deplacement` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_document_model` +-- + +DROP TABLE IF EXISTS `llx_document_model`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_document_model` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `nom` varchar(50) DEFAULT NULL, + `entity` int(11) NOT NULL DEFAULT '1', + `type` varchar(20) NOT NULL, + `libelle` varchar(255) DEFAULT NULL, + `description` text, + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_document_model` (`nom`,`type`,`entity`) +) ENGINE=InnoDB AUTO_INCREMENT=279 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_document_model` +-- + +LOCK TABLES `llx_document_model` WRITE; +/*!40000 ALTER TABLE `llx_document_model` DISABLE KEYS */; +INSERT INTO `llx_document_model` VALUES (9,'merou',1,'shipping',NULL,NULL),(15,'fsfe.fr.php',1,'donation',NULL,NULL),(181,'generic_invoice_odt',1,'invoice','ODT templates','FACTURE_ADDON_PDF_ODT_PATH'),(193,'canelle2',1,'invoice_supplier','canelle2',NULL),(195,'canelle',1,'invoice_supplier','canelle',NULL),(198,'azur',2,'propal',NULL,NULL),(199,'html_cerfafr',2,'donation',NULL,NULL),(200,'crabe',2,'invoice',NULL,NULL),(201,'generic_odt',1,'company','ODT templates','COMPANY_ADDON_PDF_ODT_PATH'),(250,'baleine',1,'project',NULL,NULL),(255,'soleil',1,'ficheinter',NULL,NULL),(256,'azur',1,'propal',NULL,NULL),(269,'crabe',1,'invoice',NULL,NULL),(270,'aurore',1,'supplier_proposal',NULL,NULL),(272,'html_cerfafr',1,'donation',NULL,NULL),(273,'beluga',1,'project','beluga',NULL),(274,'rouget',1,'shipping',NULL,NULL),(275,'typhon',1,'delivery',NULL,NULL),(276,'einstein',1,'order',NULL,NULL),(277,'muscadet',1,'order_supplier',NULL,NULL),(278,'standard',1,'expensereport',NULL,NULL); +/*!40000 ALTER TABLE `llx_document_model` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_don` +-- + +DROP TABLE IF EXISTS `llx_don`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_don` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `ref` varchar(30) DEFAULT NULL, + `entity` int(11) NOT NULL DEFAULT '1', + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `fk_statut` smallint(6) NOT NULL DEFAULT '0', + `datec` datetime DEFAULT NULL, + `datedon` datetime DEFAULT NULL, + `amount` double DEFAULT '0', + `fk_payment` int(11) DEFAULT NULL, + `paid` smallint(6) NOT NULL DEFAULT '0', + `firstname` varchar(50) DEFAULT NULL, + `lastname` varchar(50) DEFAULT NULL, + `societe` varchar(50) DEFAULT NULL, + `address` text, + `zip` varchar(10) DEFAULT NULL, + `town` varchar(50) DEFAULT NULL, + `country` varchar(50) DEFAULT NULL, + `fk_country` int(11) NOT NULL, + `email` varchar(255) DEFAULT NULL, + `phone` varchar(24) DEFAULT NULL, + `phone_mobile` varchar(24) DEFAULT NULL, + `public` smallint(6) NOT NULL DEFAULT '1', + `fk_projet` int(11) DEFAULT NULL, + `fk_user_author` int(11) NOT NULL, + `fk_user_valid` int(11) DEFAULT NULL, + `note_private` text, + `note_public` text, + `model_pdf` varchar(255) DEFAULT NULL, + `import_key` varchar(14) DEFAULT NULL, + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_don` +-- + +LOCK TABLES `llx_don` WRITE; +/*!40000 ALTER TABLE `llx_don` DISABLE KEYS */; +INSERT INTO `llx_don` VALUES (1,NULL,1,'2010-07-08 23:57:17',1,'2010-07-09 01:55:33','2010-07-09 12:00:00',10,1,0,'Donator','','Guest company','','','','France',0,'',NULL,NULL,1,1,1,1,'',NULL,'html_cerfafr',NULL); +/*!40000 ALTER TABLE `llx_don` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_don_extrafields` +-- + +DROP TABLE IF EXISTS `llx_don_extrafields`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_don_extrafields` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `fk_object` int(11) NOT NULL, + `import_key` varchar(14) DEFAULT NULL, + PRIMARY KEY (`rowid`), + KEY `idx_don_extrafields` (`fk_object`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_don_extrafields` +-- + +LOCK TABLES `llx_don_extrafields` WRITE; +/*!40000 ALTER TABLE `llx_don_extrafields` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_don_extrafields` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_ecm_directories` +-- + +DROP TABLE IF EXISTS `llx_ecm_directories`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_ecm_directories` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `label` varchar(64) NOT NULL, + `entity` int(11) NOT NULL DEFAULT '1', + `fk_parent` int(11) DEFAULT NULL, + `description` varchar(255) NOT NULL, + `cachenbofdoc` int(11) NOT NULL DEFAULT '0', + `fullpath` varchar(750) DEFAULT NULL, + `extraparams` varchar(255) DEFAULT NULL, + `date_c` datetime DEFAULT NULL, + `date_m` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `fk_user_c` int(11) DEFAULT NULL, + `fk_user_m` int(11) DEFAULT NULL, + `acl` text, + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_ecm_directories` (`label`,`fk_parent`,`entity`), + KEY `idx_ecm_directories_fk_user_c` (`fk_user_c`), + KEY `idx_ecm_directories_fk_user_m` (`fk_user_m`), + CONSTRAINT `fk_ecm_directories_fk_user_c` FOREIGN KEY (`fk_user_c`) REFERENCES `llx_user` (`rowid`), + CONSTRAINT `fk_ecm_directories_fk_user_m` FOREIGN KEY (`fk_user_m`) REFERENCES `llx_user` (`rowid`) +) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_ecm_directories` +-- + +LOCK TABLES `llx_ecm_directories` WRITE; +/*!40000 ALTER TABLE `llx_ecm_directories` DISABLE KEYS */; +INSERT INTO `llx_ecm_directories` VALUES (8,'Administrative documents',1,0,'Directory to store administrative contacts',0,NULL,NULL,'2016-07-30 16:54:41','2016-07-30 12:54:41',12,NULL,NULL),(9,'Images',1,0,'',34,NULL,NULL,'2016-07-30 16:55:33','2016-07-30 13:24:41',12,NULL,NULL); +/*!40000 ALTER TABLE `llx_ecm_directories` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_ecm_documents` +-- + +DROP TABLE IF EXISTS `llx_ecm_documents`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_ecm_documents` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `ref` varchar(16) NOT NULL, + `entity` int(11) NOT NULL DEFAULT '1', + `filename` varchar(255) NOT NULL, + `filesize` int(11) NOT NULL, + `filemime` varchar(32) NOT NULL, + `fullpath_dol` varchar(255) NOT NULL, + `fullpath_orig` varchar(255) NOT NULL, + `description` text, + `manualkeyword` text, + `fk_create` int(11) NOT NULL, + `fk_update` int(11) DEFAULT NULL, + `date_c` datetime NOT NULL, + `date_u` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `fk_directory` int(11) DEFAULT NULL, + `fk_status` smallint(6) DEFAULT '0', + `private` smallint(6) DEFAULT '0', + `crc` varchar(32) NOT NULL DEFAULT '', + `cryptkey` varchar(50) NOT NULL DEFAULT '', + `cipher` varchar(50) NOT NULL DEFAULT 'twofish', + PRIMARY KEY (`rowid`), + UNIQUE KEY `idx_ecm_documents` (`fullpath_dol`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_ecm_documents` +-- + +LOCK TABLES `llx_ecm_documents` WRITE; +/*!40000 ALTER TABLE `llx_ecm_documents` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_ecm_documents` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_ecm_files` +-- + +DROP TABLE IF EXISTS `llx_ecm_files`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_ecm_files` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `label` varchar(64) NOT NULL, + `entity` int(11) NOT NULL DEFAULT '1', + `filename` varchar(255) NOT NULL, + `fullpath` varchar(750) NOT NULL, + `fullpath_orig` varchar(750) DEFAULT NULL, + `description` text, + `keywords` text, + `cover` text, + `extraparams` varchar(255) DEFAULT NULL, + `date_c` datetime DEFAULT NULL, + `date_m` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `fk_user_c` int(11) DEFAULT NULL, + `fk_user_m` int(11) DEFAULT NULL, + `acl` text, + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_ecm_files` (`label`,`entity`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_ecm_files` +-- + +LOCK TABLES `llx_ecm_files` WRITE; +/*!40000 ALTER TABLE `llx_ecm_files` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_ecm_files` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_element_contact` +-- + +DROP TABLE IF EXISTS `llx_element_contact`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_element_contact` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `datecreate` datetime DEFAULT NULL, + `statut` smallint(6) DEFAULT '5', + `element_id` int(11) NOT NULL, + `fk_c_type_contact` int(11) NOT NULL, + `fk_socpeople` int(11) NOT NULL, + PRIMARY KEY (`rowid`), + UNIQUE KEY `idx_element_contact_idx1` (`element_id`,`fk_c_type_contact`,`fk_socpeople`), + KEY `fk_element_contact_fk_c_type_contact` (`fk_c_type_contact`), + KEY `idx_element_contact_fk_socpeople` (`fk_socpeople`), + CONSTRAINT `fk_element_contact_fk_c_type_contact` FOREIGN KEY (`fk_c_type_contact`) REFERENCES `llx_c_type_contact` (`rowid`) +) ENGINE=InnoDB AUTO_INCREMENT=29 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_element_contact` +-- + +LOCK TABLES `llx_element_contact` WRITE; +/*!40000 ALTER TABLE `llx_element_contact` DISABLE KEYS */; +INSERT INTO `llx_element_contact` VALUES (1,'2010-07-09 00:49:43',4,1,160,1),(2,'2010-07-09 00:49:56',4,2,160,1),(3,'2010-07-09 00:50:19',4,3,160,1),(4,'2010-07-09 00:50:42',4,4,160,1),(5,'2010-07-09 01:52:36',4,1,120,1),(6,'2010-07-09 01:53:25',4,1,10,2),(7,'2010-07-09 01:53:25',4,1,11,2),(8,'2010-07-10 18:13:37',4,2,10,2),(9,'2010-07-10 18:13:37',4,2,11,2),(11,'2010-07-11 16:22:36',4,5,160,1),(12,'2010-07-11 16:23:53',4,2,180,1),(13,'2013-01-23 15:04:27',4,19,200,5),(14,'2013-01-23 16:06:37',4,19,210,2),(15,'2013-01-23 16:12:43',4,19,220,2),(16,'2013-03-06 10:04:57',4,3,10,1),(17,'2013-03-06 10:04:57',4,3,11,1),(18,'2014-12-21 13:52:41',4,3,180,1),(19,'2014-12-21 13:55:39',4,4,180,1),(20,'2014-12-21 14:16:58',4,5,180,1),(21,'2016-07-30 15:29:07',4,6,160,12),(22,'2016-07-30 15:29:48',4,7,160,12),(23,'2016-07-30 15:30:25',4,8,160,12),(24,'2016-07-30 15:33:27',4,6,180,12),(25,'2016-07-30 15:33:39',4,7,180,12),(26,'2016-07-30 15:33:54',4,8,180,12),(27,'2016-07-30 15:34:09',4,9,180,12),(28,'2016-07-31 18:27:20',4,9,160,12); +/*!40000 ALTER TABLE `llx_element_contact` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_element_element` +-- + +DROP TABLE IF EXISTS `llx_element_element`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_element_element` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `fk_source` int(11) NOT NULL, + `sourcetype` varchar(32) NOT NULL, + `fk_target` int(11) NOT NULL, + `targettype` varchar(32) NOT NULL, + PRIMARY KEY (`rowid`), + UNIQUE KEY `idx_element_element_idx1` (`fk_source`,`sourcetype`,`fk_target`,`targettype`), + KEY `idx_element_element_fk_target` (`fk_target`) +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_element_element` +-- + +LOCK TABLES `llx_element_element` WRITE; +/*!40000 ALTER TABLE `llx_element_element` DISABLE KEYS */; +INSERT INTO `llx_element_element` VALUES (1,2,'contrat',2,'facture'),(2,2,'propal',1,'commande'),(3,5,'commande',1,'shipping'); +/*!40000 ALTER TABLE `llx_element_element` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_element_resources` +-- + +DROP TABLE IF EXISTS `llx_element_resources`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_element_resources` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `element_id` int(11) DEFAULT NULL, + `element_type` varchar(64) DEFAULT NULL, + `resource_id` int(11) DEFAULT NULL, + `resource_type` varchar(64) DEFAULT NULL, + `busy` int(11) DEFAULT NULL, + `mandatory` int(11) DEFAULT NULL, + `fk_user_create` int(11) DEFAULT NULL, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `duree` double DEFAULT NULL, + PRIMARY KEY (`rowid`), + UNIQUE KEY `idx_element_resources_idx1` (`resource_id`,`resource_type`,`element_id`,`element_type`), + KEY `idx_element_element_element_id` (`element_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_element_resources` +-- + +LOCK TABLES `llx_element_resources` WRITE; +/*!40000 ALTER TABLE `llx_element_resources` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_element_resources` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_element_tag` +-- + +DROP TABLE IF EXISTS `llx_element_tag`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_element_tag` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `entity` int(11) NOT NULL DEFAULT '1', + `lang` varchar(5) NOT NULL, + `tag` varchar(255) NOT NULL, + `fk_element` int(11) NOT NULL, + `element` varchar(64) NOT NULL, + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_element_tag` (`entity`,`lang`,`tag`,`fk_element`,`element`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_element_tag` +-- + +LOCK TABLES `llx_element_tag` WRITE; +/*!40000 ALTER TABLE `llx_element_tag` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_element_tag` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_entrepot` +-- + +DROP TABLE IF EXISTS `llx_entrepot`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_entrepot` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `datec` datetime DEFAULT NULL, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `label` varchar(255) NOT NULL, + `entity` int(11) NOT NULL DEFAULT '1', + `description` text, + `lieu` varchar(64) DEFAULT NULL, + `address` varchar(255) DEFAULT NULL, + `zip` varchar(10) DEFAULT NULL, + `town` varchar(50) DEFAULT NULL, + `fk_departement` int(11) DEFAULT NULL, + `fk_pays` int(11) DEFAULT '0', + `statut` tinyint(4) DEFAULT '1', + `valo_pmp` float(12,4) DEFAULT NULL, + `fk_user_author` int(11) DEFAULT NULL, + `import_key` varchar(14) DEFAULT NULL, + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_entrepot_label` (`label`,`entity`) +) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_entrepot` +-- + +LOCK TABLES `llx_entrepot` WRITE; +/*!40000 ALTER TABLE `llx_entrepot` DISABLE KEYS */; +INSERT INTO `llx_entrepot` VALUES (1,'2010-07-09 00:31:22','2010-07-08 22:40:36','WAREHOUSEHOUSTON',1,'Warehouse located at Houston','Warehouse houston','','','Houston',NULL,11,1,NULL,1,NULL),(2,'2010-07-09 00:41:03','2010-07-08 22:41:03','WAREHOUSEPARIS',1,'
','Warehouse Paris','','75000','Paris',NULL,1,1,NULL,1,NULL),(3,'2010-07-11 16:18:59','2016-07-30 13:52:08','Stock personnel Dupont',1,'Cet entrepôt représente le stock personnel de Alain Dupont','','','','',NULL,2,1,NULL,1,NULL),(9,'2015-10-03 11:47:41','2015-10-03 09:47:41','Personal stock Marie Curie',1,'This warehouse represents personal stock of Marie Curie','','','','',NULL,1,1,NULL,1,NULL),(10,'2015-10-05 09:07:52','2016-07-30 13:52:24','Personal stock Alex Theceo',1,'This warehouse represents personal stock of Alex Theceo','','','','',NULL,3,1,NULL,1,NULL),(12,'2015-10-05 21:29:35','2015-10-05 19:29:35','Personal stock Charly Commery',1,'This warehouse represents personal stock of Charly Commery','','','','',NULL,1,1,NULL,11,NULL),(13,'2015-10-05 21:33:33','2016-07-30 13:51:38','Personal stock Sam Scientol',1,'This warehouse represents personal stock of Sam Scientol','','','7500','Paris',NULL,1,0,NULL,11,NULL),(18,'2016-01-22 17:27:02','2016-01-22 16:27:02','Personal stock Laurent Destailleur',1,'This warehouse represents personal stock of Laurent Destailleur','','','','',NULL,1,1,NULL,12,NULL),(19,'2016-07-30 16:50:23','2016-07-30 12:50:23','Personal stock Eldy',1,'This warehouse represents personal stock of Eldy','','','','',NULL,14,1,NULL,12,NULL); +/*!40000 ALTER TABLE `llx_entrepot` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_establishment` +-- + +DROP TABLE IF EXISTS `llx_establishment`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_establishment` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `entity` int(11) NOT NULL DEFAULT '1', + `name` varchar(50) DEFAULT NULL, + `address` varchar(255) DEFAULT NULL, + `zip` varchar(25) DEFAULT NULL, + `town` varchar(50) DEFAULT NULL, + `fk_state` int(11) DEFAULT '0', + `fk_country` int(11) DEFAULT '0', + `profid1` varchar(20) DEFAULT NULL, + `profid2` varchar(20) DEFAULT NULL, + `profid3` varchar(20) DEFAULT NULL, + `phone` varchar(20) DEFAULT NULL, + `fk_user_author` int(11) NOT NULL, + `fk_user_mod` int(11) NOT NULL, + `datec` datetime NOT NULL, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `status` tinyint(4) DEFAULT '1', + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_establishment` +-- + +LOCK TABLES `llx_establishment` WRITE; +/*!40000 ALTER TABLE `llx_establishment` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_establishment` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_event_element` +-- + +DROP TABLE IF EXISTS `llx_event_element`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_event_element` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `fk_source` int(11) NOT NULL, + `fk_target` int(11) NOT NULL, + `targettype` varchar(32) NOT NULL, + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_event_element` +-- + +LOCK TABLES `llx_event_element` WRITE; +/*!40000 ALTER TABLE `llx_event_element` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_event_element` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_events` +-- + +DROP TABLE IF EXISTS `llx_events`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_events` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `type` varchar(32) NOT NULL, + `entity` int(11) NOT NULL DEFAULT '1', + `dateevent` datetime DEFAULT NULL, + `fk_user` int(11) DEFAULT NULL, + `description` varchar(250) NOT NULL, + `ip` varchar(32) NOT NULL, + `user_agent` varchar(255) DEFAULT NULL, + `fk_object` int(11) DEFAULT NULL, + PRIMARY KEY (`rowid`), + KEY `idx_events_dateevent` (`dateevent`) +) ENGINE=InnoDB AUTO_INCREMENT=781 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_events` +-- + +LOCK TABLES `llx_events` WRITE; +/*!40000 ALTER TABLE `llx_events` DISABLE KEYS */; +INSERT INTO `llx_events` VALUES (30,'2011-07-18 18:23:06','USER_LOGOUT',1,'2011-07-18 20:23:06',1,'(UserLogoff,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(31,'2011-07-18 18:23:12','USER_LOGIN_FAILED',1,'2011-07-18 20:23:12',NULL,'Identifiants login ou mot de passe incorrects - login=admin','127.0.0.1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(32,'2011-07-18 18:23:17','USER_LOGIN',1,'2011-07-18 20:23:17',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(33,'2011-07-18 20:10:51','USER_LOGIN_FAILED',1,'2011-07-18 22:10:51',NULL,'Identifiants login ou mot de passe incorrects - login=admin','127.0.0.1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(34,'2011-07-18 20:10:55','USER_LOGIN',1,'2011-07-18 22:10:55',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(35,'2011-07-18 21:18:57','USER_LOGIN',1,'2011-07-18 23:18:57',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(36,'2011-07-20 10:34:10','USER_LOGIN',1,'2011-07-20 12:34:10',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(37,'2011-07-20 12:36:44','USER_LOGIN',1,'2011-07-20 14:36:44',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(38,'2011-07-20 13:20:51','USER_LOGIN_FAILED',1,'2011-07-20 15:20:51',NULL,'Identifiants login ou mot de passe incorrects - login=admin','127.0.0.1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(39,'2011-07-20 13:20:54','USER_LOGIN',1,'2011-07-20 15:20:54',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(40,'2011-07-20 15:03:46','USER_LOGIN_FAILED',1,'2011-07-20 17:03:46',NULL,'Identifiants login ou mot de passe incorrects - login=admin','127.0.0.1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(41,'2011-07-20 15:03:55','USER_LOGIN',1,'2011-07-20 17:03:55',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(42,'2011-07-20 18:05:05','USER_LOGIN_FAILED',1,'2011-07-20 20:05:05',NULL,'Identifiants login ou mot de passe incorrects - login=admin','127.0.0.1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(43,'2011-07-20 18:05:08','USER_LOGIN',1,'2011-07-20 20:05:08',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(44,'2011-07-20 21:08:53','USER_LOGIN_FAILED',1,'2011-07-20 23:08:53',NULL,'Identifiants login ou mot de passe incorrects - login=admin','127.0.0.1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(45,'2011-07-20 21:08:56','USER_LOGIN',1,'2011-07-20 23:08:56',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(46,'2011-07-21 01:26:12','USER_LOGIN',1,'2011-07-21 03:26:12',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(47,'2011-07-21 22:35:45','USER_LOGIN_FAILED',1,'2011-07-22 00:35:45',NULL,'Identifiants login ou mot de passe incorrects - login=admin','127.0.0.1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(48,'2011-07-21 22:35:49','USER_LOGIN',1,'2011-07-22 00:35:49',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(49,'2011-07-26 23:09:47','USER_LOGIN_FAILED',1,'2011-07-27 01:09:47',NULL,'Identifiants login ou mot de passe incorrects - login=admin','127.0.0.1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(50,'2011-07-26 23:09:50','USER_LOGIN',1,'2011-07-27 01:09:50',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(51,'2011-07-27 17:02:27','USER_LOGIN_FAILED',1,'2011-07-27 19:02:27',NULL,'Identifiants login ou mot de passe incorrects - login=admin','127.0.0.1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(52,'2011-07-27 17:02:32','USER_LOGIN',1,'2011-07-27 19:02:32',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(53,'2011-07-27 23:33:37','USER_LOGIN_FAILED',1,'2011-07-28 01:33:37',NULL,'Identifiants login ou mot de passe incorrects - login=admin','127.0.0.1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(54,'2011-07-27 23:33:41','USER_LOGIN',1,'2011-07-28 01:33:41',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(55,'2011-07-28 18:20:36','USER_LOGIN_FAILED',1,'2011-07-28 20:20:36',NULL,'Identifiants login ou mot de passe incorrects - login=admin','127.0.0.1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(56,'2011-07-28 18:20:38','USER_LOGIN',1,'2011-07-28 20:20:38',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(57,'2011-07-28 20:13:30','USER_LOGIN_FAILED',1,'2011-07-28 22:13:30',NULL,'Identifiants login ou mot de passe incorrects - login=admin','127.0.0.1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(58,'2011-07-28 20:13:34','USER_LOGIN',1,'2011-07-28 22:13:34',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(59,'2011-07-28 20:22:51','USER_LOGIN',1,'2011-07-28 22:22:51',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(60,'2011-07-28 23:05:06','USER_LOGIN',1,'2011-07-29 01:05:06',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(61,'2011-07-29 20:15:50','USER_LOGIN_FAILED',1,'2011-07-29 22:15:50',NULL,'Identifiants login ou mot de passe incorrects - login=admin','127.0.0.1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(62,'2011-07-29 20:15:53','USER_LOGIN',1,'2011-07-29 22:15:53',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(68,'2011-07-29 20:51:01','USER_LOGOUT',1,'2011-07-29 22:51:01',1,'(UserLogoff,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(69,'2011-07-29 20:51:05','USER_LOGIN',1,'2011-07-29 22:51:05',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(70,'2011-07-30 08:46:20','USER_LOGIN_FAILED',1,'2011-07-30 10:46:20',NULL,'Identifiants login ou mot de passe incorrects - login=admin','127.0.0.1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(71,'2011-07-30 08:46:38','USER_LOGIN_FAILED',1,'2011-07-30 10:46:38',NULL,'Identifiants login ou mot de passe incorrects - login=admin','127.0.0.1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(72,'2011-07-30 08:46:42','USER_LOGIN',1,'2011-07-30 10:46:42',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(73,'2011-07-30 10:05:12','USER_LOGIN_FAILED',1,'2011-07-30 12:05:12',NULL,'Identifiants login ou mot de passe incorrects - login=admin','127.0.0.1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(74,'2011-07-30 10:05:15','USER_LOGIN',1,'2011-07-30 12:05:15',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(75,'2011-07-30 12:15:46','USER_LOGIN',1,'2011-07-30 14:15:46',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(76,'2011-07-31 22:19:30','USER_LOGIN',1,'2011-08-01 00:19:30',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(77,'2011-07-31 23:32:52','USER_LOGIN',1,'2011-08-01 01:32:52',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(78,'2011-08-01 01:24:50','USER_LOGIN_FAILED',1,'2011-08-01 03:24:50',NULL,'Identifiants login ou mot de passe incorrects - login=admin','127.0.0.1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(79,'2011-08-01 01:24:54','USER_LOGIN',1,'2011-08-01 03:24:54',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(80,'2011-08-01 19:31:36','USER_LOGIN_FAILED',1,'2011-08-01 21:31:35',NULL,'Identifiants login ou mot de passe incorrects - login=admin','127.0.0.1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(81,'2011-08-01 19:31:39','USER_LOGIN',1,'2011-08-01 21:31:39',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(82,'2011-08-01 20:01:36','USER_LOGIN',1,'2011-08-01 22:01:36',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(83,'2011-08-01 20:52:54','USER_LOGIN_FAILED',1,'2011-08-01 22:52:54',NULL,'Identifiants login ou mot de passe incorrects - login=admin','127.0.0.1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(84,'2011-08-01 20:52:58','USER_LOGIN',1,'2011-08-01 22:52:58',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(85,'2011-08-01 21:17:28','USER_LOGIN_FAILED',1,'2011-08-01 23:17:28',NULL,'Identifiants login ou mot de passe incorrects - login=admin','127.0.0.1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(86,'2011-08-01 21:17:31','USER_LOGIN',1,'2011-08-01 23:17:31',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(87,'2011-08-04 11:55:17','USER_LOGIN',1,'2011-08-04 13:55:17',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(88,'2011-08-04 20:19:03','USER_LOGIN_FAILED',1,'2011-08-04 22:19:03',NULL,'Identifiants login ou mot de passe incorrects - login=admin','127.0.0.1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(89,'2011-08-04 20:19:07','USER_LOGIN',1,'2011-08-04 22:19:07',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(90,'2011-08-05 17:51:42','USER_LOGIN_FAILED',1,'2011-08-05 19:51:42',NULL,'Identifiants login ou mot de passe incorrects - login=admin','127.0.0.1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(91,'2011-08-05 17:51:47','USER_LOGIN',1,'2011-08-05 19:51:47',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(92,'2011-08-05 17:56:03','USER_LOGIN',1,'2011-08-05 19:56:03',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(93,'2011-08-05 17:59:10','USER_LOGIN',1,'2011-08-05 19:59:10',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux i686) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.100 Safari/534.30',NULL),(94,'2011-08-05 18:01:58','USER_LOGIN',1,'2011-08-05 20:01:58',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux i686) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.100 Safari/534.30',NULL),(95,'2011-08-05 19:59:56','USER_LOGIN',1,'2011-08-05 21:59:56',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(96,'2011-08-06 18:33:22','USER_LOGIN',1,'2011-08-06 20:33:22',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(97,'2011-08-07 00:56:59','USER_LOGIN',1,'2011-08-07 02:56:59',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(98,'2011-08-07 22:49:14','USER_LOGIN',1,'2011-08-08 00:49:14',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(99,'2011-08-07 23:05:18','USER_LOGOUT',1,'2011-08-08 01:05:18',1,'(UserLogoff,admin)','::1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(105,'2011-08-08 00:41:09','USER_LOGIN',1,'2011-08-08 02:41:09',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(106,'2011-08-08 11:58:55','USER_LOGIN',1,'2011-08-08 13:58:55',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(107,'2011-08-08 14:35:48','USER_LOGIN',1,'2011-08-08 16:35:48',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(108,'2011-08-08 14:36:31','USER_LOGOUT',1,'2011-08-08 16:36:31',1,'(UserLogoff,admin)','::1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(109,'2011-08-08 14:38:28','USER_LOGIN',1,'2011-08-08 16:38:28',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(110,'2011-08-08 14:39:02','USER_LOGOUT',1,'2011-08-08 16:39:02',1,'(UserLogoff,admin)','::1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(111,'2011-08-08 14:39:10','USER_LOGIN',1,'2011-08-08 16:39:10',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(112,'2011-08-08 14:39:28','USER_LOGOUT',1,'2011-08-08 16:39:28',1,'(UserLogoff,admin)','::1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(113,'2011-08-08 14:39:37','USER_LOGIN',1,'2011-08-08 16:39:37',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(114,'2011-08-08 14:50:02','USER_LOGOUT',1,'2011-08-08 16:50:02',1,'(UserLogoff,admin)','::1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(115,'2011-08-08 14:51:45','USER_LOGIN_FAILED',1,'2011-08-08 16:51:45',NULL,'Identifiants login ou mot de passe incorrects - login=','::1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(116,'2011-08-08 14:51:52','USER_LOGIN',1,'2011-08-08 16:51:52',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(117,'2011-08-08 15:09:54','USER_LOGOUT',1,'2011-08-08 17:09:54',1,'(UserLogoff,admin)','::1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(118,'2011-08-08 15:10:19','USER_LOGIN_FAILED',1,'2011-08-08 17:10:19',NULL,'Identifiants login ou mot de passe incorrects - login=','::1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(119,'2011-08-08 15:10:28','USER_LOGIN',1,'2011-08-08 17:10:28',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(121,'2011-08-08 15:14:58','USER_LOGOUT',1,'2011-08-08 17:14:58',1,'(UserLogoff,admin)','::1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(122,'2011-08-08 15:15:00','USER_LOGIN_FAILED',1,'2011-08-08 17:15:00',NULL,'Identifiants login ou mot de passe incorrects - login=','::1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(123,'2011-08-08 15:17:57','USER_LOGIN',1,'2011-08-08 17:17:57',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(124,'2011-08-08 15:35:56','USER_LOGOUT',1,'2011-08-08 17:35:56',1,'(UserLogoff,admin)','::1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(125,'2011-08-08 15:36:05','USER_LOGIN',1,'2011-08-08 17:36:05',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(126,'2011-08-08 17:32:42','USER_LOGIN',1,'2011-08-08 19:32:42',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0',NULL),(127,'2012-12-08 13:49:37','USER_LOGOUT',1,'2012-12-08 14:49:37',1,'(UserLogoff,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11',NULL),(128,'2012-12-08 13:49:42','USER_LOGIN',1,'2012-12-08 14:49:42',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11',NULL),(129,'2012-12-08 13:50:12','USER_LOGOUT',1,'2012-12-08 14:50:12',1,'(UserLogoff,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11',NULL),(130,'2012-12-08 13:50:14','USER_LOGIN',1,'2012-12-08 14:50:14',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11',NULL),(131,'2012-12-08 13:50:17','USER_LOGOUT',1,'2012-12-08 14:50:17',1,'(UserLogoff,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11',NULL),(132,'2012-12-08 13:52:47','USER_LOGIN',1,'2012-12-08 14:52:47',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11',NULL),(133,'2012-12-08 13:53:08','USER_MODIFY',1,'2012-12-08 14:53:08',1,'User admin modified','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11',NULL),(134,'2012-12-08 14:08:45','USER_LOGOUT',1,'2012-12-08 15:08:45',1,'(UserLogoff,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11',NULL),(135,'2012-12-08 14:09:09','USER_LOGIN',1,'2012-12-08 15:09:09',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11',NULL),(136,'2012-12-08 14:11:43','USER_LOGOUT',1,'2012-12-08 15:11:43',1,'(UserLogoff,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11',NULL),(137,'2012-12-08 14:11:45','USER_LOGIN',1,'2012-12-08 15:11:45',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11',NULL),(138,'2012-12-08 14:22:53','USER_LOGOUT',1,'2012-12-08 15:22:53',1,'(UserLogoff,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11',NULL),(139,'2012-12-08 14:22:54','USER_LOGIN',1,'2012-12-08 15:22:54',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11',NULL),(140,'2012-12-08 14:23:10','USER_LOGOUT',1,'2012-12-08 15:23:10',1,'(UserLogoff,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11',NULL),(141,'2012-12-08 14:23:11','USER_LOGIN',1,'2012-12-08 15:23:11',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11',NULL),(142,'2012-12-08 14:23:49','USER_LOGOUT',1,'2012-12-08 15:23:49',1,'(UserLogoff,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11',NULL),(143,'2012-12-08 14:23:50','USER_LOGIN',1,'2012-12-08 15:23:50',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11',NULL),(144,'2012-12-08 14:28:08','USER_LOGOUT',1,'2012-12-08 15:28:08',1,'(UserLogoff,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11',NULL),(145,'2012-12-08 14:35:15','USER_LOGIN',1,'2012-12-08 15:35:15',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11',NULL),(146,'2012-12-08 14:35:18','USER_LOGOUT',1,'2012-12-08 15:35:18',1,'(UserLogoff,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11',NULL),(147,'2012-12-08 14:36:07','USER_LOGIN',1,'2012-12-08 15:36:07',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11',NULL),(148,'2012-12-08 14:36:09','USER_LOGOUT',1,'2012-12-08 15:36:09',1,'(UserLogoff,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11',NULL),(149,'2012-12-08 14:36:41','USER_LOGIN',1,'2012-12-08 15:36:41',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11',NULL),(150,'2012-12-08 15:59:13','USER_LOGIN',1,'2012-12-08 16:59:13',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11',NULL),(151,'2012-12-09 11:49:52','USER_LOGIN',1,'2012-12-09 12:49:52',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11',NULL),(152,'2012-12-09 13:46:31','USER_LOGIN',1,'2012-12-09 14:46:31',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11',NULL),(153,'2012-12-09 19:03:14','USER_LOGIN',1,'2012-12-09 20:03:14',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11',NULL),(154,'2012-12-10 00:16:31','USER_LOGIN',1,'2012-12-10 01:16:31',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11',NULL),(170,'2012-12-11 22:03:31','USER_LOGIN',1,'2012-12-11 23:03:31',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11',NULL),(171,'2012-12-12 00:32:39','USER_LOGIN',1,'2012-12-12 01:32:39',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11',NULL),(172,'2012-12-12 10:49:59','USER_LOGIN',1,'2012-12-12 11:49:59',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11',NULL),(175,'2012-12-12 10:57:40','USER_MODIFY',1,'2012-12-12 11:57:40',1,'Modification utilisateur admin','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11',NULL),(176,'2012-12-12 13:29:15','USER_LOGIN',1,'2012-12-12 14:29:15',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11',NULL),(177,'2012-12-12 13:30:15','USER_LOGIN',1,'2012-12-12 14:30:15',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11',NULL),(178,'2012-12-12 13:40:08','USER_LOGOUT',1,'2012-12-12 14:40:08',1,'(UserLogoff,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11',NULL),(179,'2012-12-12 13:40:10','USER_LOGIN',1,'2012-12-12 14:40:10',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11',NULL),(180,'2012-12-12 13:40:26','USER_MODIFY',1,'2012-12-12 14:40:26',1,'Modification utilisateur admin','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11',NULL),(181,'2012-12-12 13:40:34','USER_LOGOUT',1,'2012-12-12 14:40:34',1,'(UserLogoff,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11',NULL),(182,'2012-12-12 13:42:23','USER_LOGIN',1,'2012-12-12 14:42:23',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11',NULL),(183,'2012-12-12 13:43:02','USER_NEW_PASSWORD',1,'2012-12-12 14:43:02',NULL,'Changement mot de passe de admin','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11',NULL),(184,'2012-12-12 13:43:25','USER_LOGOUT',1,'2012-12-12 14:43:25',1,'(UserLogoff,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11',NULL),(185,'2012-12-12 13:43:27','USER_LOGIN_FAILED',1,'2012-12-12 14:43:27',NULL,'Identifiants login ou mot de passe incorrects - login=admin','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11',NULL),(186,'2012-12-12 13:43:30','USER_LOGIN',1,'2012-12-12 14:43:30',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11',NULL),(187,'2012-12-12 14:52:11','USER_LOGIN',1,'2012-12-12 15:52:11',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11',NULL),(188,'2012-12-12 17:53:00','USER_LOGIN_FAILED',1,'2012-12-12 18:53:00',NULL,'Identifiants login ou mot de passe incorrects - login=admin','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11',NULL),(189,'2012-12-12 17:53:07','USER_LOGIN_FAILED',1,'2012-12-12 18:53:07',NULL,'Identifiants login ou mot de passe incorrects - login=admin','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11',NULL),(190,'2012-12-12 17:53:51','USER_NEW_PASSWORD',1,'2012-12-12 18:53:51',NULL,'Changement mot de passe de admin','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11',NULL),(191,'2012-12-12 17:54:00','USER_LOGIN',1,'2012-12-12 18:54:00',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11',NULL),(192,'2012-12-12 17:54:10','USER_NEW_PASSWORD',1,'2012-12-12 18:54:10',1,'Changement mot de passe de admin','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11',NULL),(193,'2012-12-12 17:54:10','USER_MODIFY',1,'2012-12-12 18:54:10',1,'Modification utilisateur admin','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11',NULL),(194,'2012-12-12 18:57:09','USER_LOGIN',1,'2012-12-12 19:57:09',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11',NULL),(195,'2012-12-12 23:04:08','USER_LOGIN',1,'2012-12-13 00:04:08',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11',NULL),(196,'2012-12-17 20:03:14','USER_LOGIN',1,'2012-12-17 21:03:14',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11',NULL),(197,'2012-12-17 21:18:45','USER_LOGIN',1,'2012-12-17 22:18:45',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11',NULL),(198,'2012-12-17 22:30:08','USER_LOGIN',1,'2012-12-17 23:30:08',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11',NULL),(199,'2012-12-18 23:32:03','USER_LOGIN',1,'2012-12-19 00:32:03',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11',NULL),(200,'2012-12-19 09:38:03','USER_LOGIN',1,'2012-12-19 10:38:03',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11',NULL),(201,'2012-12-19 11:23:35','USER_LOGIN',1,'2012-12-19 12:23:35',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11',NULL),(202,'2012-12-19 12:46:22','USER_LOGIN',1,'2012-12-19 13:46:22',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11',NULL),(214,'2012-12-19 19:11:31','USER_LOGIN',1,'2012-12-19 20:11:31',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11',NULL),(215,'2012-12-21 16:36:57','USER_LOGIN',1,'2012-12-21 17:36:57',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11',NULL),(216,'2012-12-21 16:38:43','USER_NEW_PASSWORD',1,'2012-12-21 17:38:43',1,'Changement mot de passe de adupont','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11',NULL),(217,'2012-12-21 16:38:43','USER_MODIFY',1,'2012-12-21 17:38:43',1,'Modification utilisateur adupont','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11',NULL),(218,'2012-12-21 16:38:51','USER_LOGOUT',1,'2012-12-21 17:38:51',1,'(UserLogoff,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11',NULL),(219,'2012-12-21 16:38:55','USER_LOGIN',1,'2012-12-21 17:38:55',3,'(UserLogged,adupont)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11',NULL),(220,'2012-12-21 16:48:18','USER_LOGOUT',1,'2012-12-21 17:48:18',3,'(UserLogoff,adupont)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11',NULL),(221,'2012-12-21 16:48:20','USER_LOGIN',1,'2012-12-21 17:48:20',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11',NULL),(222,'2012-12-26 18:28:18','USER_LOGIN',1,'2012-12-26 19:28:18',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11',NULL),(223,'2012-12-26 20:00:24','USER_LOGIN',1,'2012-12-26 21:00:24',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11',NULL),(224,'2012-12-27 01:10:27','USER_LOGIN',1,'2012-12-27 02:10:27',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11',NULL),(225,'2012-12-28 19:12:08','USER_LOGIN',1,'2012-12-28 20:12:08',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11',NULL),(226,'2012-12-28 20:16:58','USER_LOGIN',1,'2012-12-28 21:16:58',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11',NULL),(227,'2012-12-29 14:35:46','USER_LOGIN',1,'2012-12-29 15:35:46',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11',NULL),(228,'2012-12-29 14:37:59','USER_LOGOUT',1,'2012-12-29 15:37:59',1,'(UserLogoff,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11',NULL),(229,'2012-12-29 14:38:00','USER_LOGIN',1,'2012-12-29 15:38:00',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11',NULL),(230,'2012-12-29 17:16:48','USER_LOGIN',1,'2012-12-29 18:16:48',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11',NULL),(231,'2012-12-31 12:02:59','USER_LOGIN',1,'2012-12-31 13:02:59',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11',NULL),(232,'2013-01-02 20:32:51','USER_LOGIN',1,'2013-01-02 21:32:51',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:17.0) Gecko/20100101 Firefox/17.0',NULL),(233,'2013-01-02 20:58:59','USER_LOGIN',1,'2013-01-02 21:58:59',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11',NULL),(234,'2013-01-03 09:25:07','USER_LOGIN',1,'2013-01-03 10:25:07',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11',NULL),(235,'2013-01-03 19:39:31','USER_LOGIN',1,'2013-01-03 20:39:31',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11',NULL),(236,'2013-01-04 22:40:19','USER_LOGIN',1,'2013-01-04 23:40:19',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11',NULL),(237,'2013-01-05 12:59:59','USER_LOGIN',1,'2013-01-05 13:59:59',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11',NULL),(238,'2013-01-05 15:28:52','USER_LOGIN',1,'2013-01-05 16:28:52',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11',NULL),(239,'2013-01-05 17:02:08','USER_LOGIN',1,'2013-01-05 18:02:08',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11',NULL),(240,'2013-01-06 12:13:33','USER_LOGIN',1,'2013-01-06 13:13:33',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11',NULL),(241,'2013-01-07 01:21:15','USER_LOGIN',1,'2013-01-07 02:21:15',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11',NULL),(242,'2013-01-07 01:46:31','USER_LOGOUT',1,'2013-01-07 02:46:31',1,'(UserLogoff,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11',NULL),(243,'2013-01-07 19:54:50','USER_LOGIN',1,'2013-01-07 20:54:50',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11',NULL),(244,'2013-01-08 21:55:01','USER_LOGIN',1,'2013-01-08 22:55:01',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11',NULL),(245,'2013-01-09 11:13:28','USER_LOGIN',1,'2013-01-09 12:13:28',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11',NULL),(246,'2013-01-10 18:30:46','USER_LOGIN',1,'2013-01-10 19:30:46',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11',NULL),(247,'2013-01-11 18:03:26','USER_LOGIN',1,'2013-01-11 19:03:26',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11',NULL),(248,'2013-01-12 11:15:04','USER_LOGIN',1,'2013-01-12 12:15:04',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11',NULL),(249,'2013-01-12 14:42:44','USER_LOGIN',1,'2013-01-12 15:42:44',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11',NULL),(250,'2013-01-13 12:07:17','USER_LOGIN',1,'2013-01-13 13:07:17',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11',NULL),(251,'2013-01-13 17:37:58','USER_LOGIN',1,'2013-01-13 18:37:58',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11',NULL),(252,'2013-01-13 19:24:21','USER_LOGIN',1,'2013-01-13 20:24:21',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11',NULL),(253,'2013-01-13 19:29:19','USER_LOGOUT',1,'2013-01-13 20:29:19',1,'(UserLogoff,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11',NULL),(254,'2013-01-13 21:39:39','USER_LOGIN',1,'2013-01-13 22:39:39',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11',NULL),(255,'2013-01-14 00:52:21','USER_LOGIN',1,'2013-01-14 01:52:21',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11',NULL),(256,'2013-01-16 11:34:31','USER_LOGIN',1,'2013-01-16 12:34:31',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.52 Safari/537.17',NULL),(257,'2013-01-16 15:36:21','USER_LOGIN',1,'2013-01-16 16:36:21',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.52 Safari/537.17',NULL),(258,'2013-01-16 19:17:36','USER_LOGIN',1,'2013-01-16 20:17:36',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.52 Safari/537.17',NULL),(259,'2013-01-16 19:48:08','GROUP_CREATE',1,'2013-01-16 20:48:08',1,'Création groupe ggg','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.52 Safari/537.17',NULL),(260,'2013-01-16 21:48:53','USER_LOGIN',1,'2013-01-16 22:48:53',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.52 Safari/537.17',NULL),(261,'2013-01-17 19:55:53','USER_LOGIN',1,'2013-01-17 20:55:53',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.52 Safari/537.17',NULL),(262,'2013-01-18 09:48:01','USER_LOGIN',1,'2013-01-18 10:48:01',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.52 Safari/537.17',NULL),(263,'2013-01-18 13:22:36','USER_LOGIN',1,'2013-01-18 14:22:36',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.52 Safari/537.17',NULL),(264,'2013-01-18 16:10:23','USER_LOGIN',1,'2013-01-18 17:10:22',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.52 Safari/537.17',NULL),(265,'2013-01-18 17:41:40','USER_LOGIN',1,'2013-01-18 18:41:40',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.52 Safari/537.17',NULL),(266,'2013-01-19 14:33:48','USER_LOGIN',1,'2013-01-19 15:33:48',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.52 Safari/537.17',NULL),(267,'2013-01-19 16:47:43','USER_LOGIN',1,'2013-01-19 17:47:43',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.52 Safari/537.17',NULL),(268,'2013-01-19 16:59:43','USER_LOGIN',1,'2013-01-19 17:59:43',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.52 Safari/537.17',NULL),(269,'2013-01-19 17:00:22','USER_LOGIN',1,'2013-01-19 18:00:22',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.52 Safari/537.17',NULL),(270,'2013-01-19 17:04:16','USER_LOGOUT',1,'2013-01-19 18:04:16',1,'(UserLogoff,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.52 Safari/537.17',NULL),(271,'2013-01-19 17:04:18','USER_LOGIN',1,'2013-01-19 18:04:18',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.52 Safari/537.17',NULL),(272,'2013-01-20 00:34:19','USER_LOGIN',1,'2013-01-20 01:34:19',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.52 Safari/537.17',NULL),(273,'2013-01-21 11:54:17','USER_LOGIN',1,'2013-01-21 12:54:17',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.52 Safari/537.17',NULL),(274,'2013-01-21 13:48:15','USER_LOGIN',1,'2013-01-21 14:48:15',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.52 Safari/537.17',NULL),(275,'2013-01-21 14:30:22','USER_LOGIN',1,'2013-01-21 15:30:22',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.52 Safari/537.17',NULL),(276,'2013-01-21 15:10:46','USER_LOGIN',1,'2013-01-21 16:10:46',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.52 Safari/537.17',NULL),(277,'2013-01-21 17:27:43','USER_LOGIN',1,'2013-01-21 18:27:43',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.52 Safari/537.17',NULL),(278,'2013-01-21 21:48:15','USER_LOGIN',1,'2013-01-21 22:48:15',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.52 Safari/537.17',NULL),(279,'2013-01-21 21:50:42','USER_LOGIN',1,'2013-01-21 22:50:42',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.52 Safari/537.17',NULL),(280,'2013-01-23 09:28:26','USER_LOGIN',1,'2013-01-23 10:28:26',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.56 Safari/537.17',NULL),(281,'2013-01-23 13:21:57','USER_LOGIN',1,'2013-01-23 14:21:57',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.56 Safari/537.17',NULL),(282,'2013-01-23 16:52:00','USER_LOGOUT',1,'2013-01-23 17:52:00',1,'(UserLogoff,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.56 Safari/537.17',NULL),(283,'2013-01-23 16:52:05','USER_LOGIN_FAILED',1,'2013-01-23 17:52:05',NULL,'Bad value for login or password - login=bbb','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.56 Safari/537.17',NULL),(284,'2013-01-23 16:52:09','USER_LOGIN',1,'2013-01-23 17:52:09',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.56 Safari/537.17',NULL),(285,'2013-01-23 16:52:27','USER_CREATE',1,'2013-01-23 17:52:27',1,'Création utilisateur aaa','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.56 Safari/537.17',NULL),(286,'2013-01-23 16:52:27','USER_NEW_PASSWORD',1,'2013-01-23 17:52:27',1,'Changement mot de passe de aaa','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.56 Safari/537.17',NULL),(287,'2013-01-23 16:52:37','USER_CREATE',1,'2013-01-23 17:52:37',1,'Création utilisateur bbb','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.56 Safari/537.17',NULL),(288,'2013-01-23 16:52:37','USER_NEW_PASSWORD',1,'2013-01-23 17:52:37',1,'Changement mot de passe de bbb','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.56 Safari/537.17',NULL),(289,'2013-01-23 16:53:15','USER_LOGOUT',1,'2013-01-23 17:53:15',1,'(UserLogoff,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.56 Safari/537.17',NULL),(290,'2013-01-23 16:53:20','USER_LOGIN',1,'2013-01-23 17:53:20',4,'(UserLogged,aaa)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.56 Safari/537.17',NULL),(291,'2013-01-23 19:16:58','USER_LOGIN',1,'2013-01-23 20:16:58',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.56 Safari/537.17',NULL),(292,'2013-01-26 10:54:07','USER_LOGIN',1,'2013-01-26 11:54:07',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.56 Safari/537.17',NULL),(293,'2013-01-29 10:15:36','USER_LOGIN',1,'2013-01-29 11:15:36',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.56 Safari/537.17',NULL),(294,'2013-01-30 17:42:50','USER_LOGIN',1,'2013-01-30 18:42:50',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.56 Safari/537.17',NULL),(295,'2013-02-01 08:49:55','USER_LOGIN',1,'2013-02-01 09:49:55',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.57 Safari/537.17',NULL),(296,'2013-02-01 08:51:57','USER_LOGOUT',1,'2013-02-01 09:51:57',1,'(UserLogoff,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.57 Safari/537.17',NULL),(297,'2013-02-01 08:52:39','USER_LOGIN',1,'2013-02-01 09:52:39',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.57 Safari/537.17',NULL),(298,'2013-02-01 21:03:01','USER_LOGIN',1,'2013-02-01 22:03:01',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.57 Safari/537.17',NULL),(299,'2013-02-10 19:48:39','USER_LOGIN',1,'2013-02-10 20:48:39',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.57 Safari/537.17',NULL),(300,'2013-02-10 20:46:48','USER_LOGIN',1,'2013-02-10 21:46:48',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.57 Safari/537.17',NULL),(301,'2013-02-10 21:39:23','USER_LOGIN',1,'2013-02-10 22:39:23',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.57 Safari/537.17',NULL),(302,'2013-02-11 19:00:13','USER_LOGIN',1,'2013-02-11 20:00:13',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.57 Safari/537.17',NULL),(303,'2013-02-11 19:43:44','USER_LOGIN_FAILED',1,'2013-02-11 20:43:44',NULL,'Unknown column \'u.fk_user\' in \'field list\'','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.57 Safari/537.17',NULL),(304,'2013-02-11 19:44:01','USER_LOGIN',1,'2013-02-11 20:44:01',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.57 Safari/537.17',NULL),(305,'2013-02-12 00:27:35','USER_LOGIN',1,'2013-02-12 01:27:35',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.57 Safari/537.17',NULL),(306,'2013-02-12 00:27:38','USER_LOGOUT',1,'2013-02-12 01:27:38',1,'(UserLogoff,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.57 Safari/537.17',NULL),(307,'2013-02-12 00:28:07','USER_LOGIN',1,'2013-02-12 01:28:07',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.57 Safari/537.17',NULL),(308,'2013-02-12 00:28:09','USER_LOGOUT',1,'2013-02-12 01:28:09',1,'(UserLogoff,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.57 Safari/537.17',NULL),(309,'2013-02-12 00:28:26','USER_LOGIN',1,'2013-02-12 01:28:26',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.57 Safari/537.17',NULL),(310,'2013-02-12 00:28:30','USER_LOGOUT',1,'2013-02-12 01:28:30',1,'(UserLogoff,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.57 Safari/537.17',NULL),(311,'2013-02-12 12:42:15','USER_LOGIN',1,'2013-02-12 13:42:15',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.57 Safari/537.17',NULL),(312,'2013-02-12 13:46:16','USER_LOGIN',1,'2013-02-12 14:46:16',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.69 Safari/537.17',NULL),(313,'2013-02-12 14:54:28','USER_LOGIN',1,'2013-02-12 15:54:28',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.69 Safari/537.17',NULL),(314,'2013-02-12 16:04:46','USER_LOGIN',1,'2013-02-12 17:04:46',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.69 Safari/537.17',NULL),(315,'2013-02-13 14:02:43','USER_LOGIN',1,'2013-02-13 15:02:43',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.69 Safari/537.17',NULL),(316,'2013-02-13 14:48:30','USER_LOGIN',1,'2013-02-13 15:48:30',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.69 Safari/537.17',NULL),(317,'2013-02-13 17:44:53','USER_LOGIN',1,'2013-02-13 18:44:53',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.69 Safari/537.17',NULL),(318,'2013-02-15 08:44:36','USER_LOGIN',1,'2013-02-15 09:44:36',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.69 Safari/537.17',NULL),(319,'2013-02-15 08:53:20','USER_LOGIN',1,'2013-02-15 09:53:20',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.69 Safari/537.17',NULL),(320,'2013-02-16 19:10:28','USER_LOGIN',1,'2013-02-16 20:10:28',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.69 Safari/537.17',NULL),(321,'2013-02-16 19:22:40','USER_CREATE',1,'2013-02-16 20:22:40',1,'Création utilisateur aaab','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.69 Safari/537.17',NULL),(322,'2013-02-16 19:22:40','USER_NEW_PASSWORD',1,'2013-02-16 20:22:40',1,'Changement mot de passe de aaab','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.69 Safari/537.17',NULL),(323,'2013-02-16 19:48:15','USER_CREATE',1,'2013-02-16 20:48:15',1,'Création utilisateur zzz','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.69 Safari/537.17',NULL),(324,'2013-02-16 19:48:15','USER_NEW_PASSWORD',1,'2013-02-16 20:48:15',1,'Changement mot de passe de zzz','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.69 Safari/537.17',NULL),(325,'2013-02-16 19:50:08','USER_CREATE',1,'2013-02-16 20:50:08',1,'Création utilisateur zzzg','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.69 Safari/537.17',NULL),(326,'2013-02-16 19:50:08','USER_NEW_PASSWORD',1,'2013-02-16 20:50:08',1,'Changement mot de passe de zzzg','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.69 Safari/537.17',NULL),(327,'2013-02-16 21:20:03','USER_LOGIN',1,'2013-02-16 22:20:03',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.69 Safari/537.17',NULL),(328,'2013-02-17 14:30:51','USER_LOGIN',1,'2013-02-17 15:30:51',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.69 Safari/537.17',NULL),(329,'2013-02-17 17:21:22','USER_LOGIN',1,'2013-02-17 18:21:22',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.69 Safari/537.17',NULL),(330,'2013-02-17 17:48:43','USER_MODIFY',1,'2013-02-17 18:48:43',1,'Modification utilisateur aaa','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.69 Safari/537.17',NULL),(331,'2013-02-17 17:48:47','USER_MODIFY',1,'2013-02-17 18:48:47',1,'Modification utilisateur aaa','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.69 Safari/537.17',NULL),(332,'2013-02-17 17:48:51','USER_MODIFY',1,'2013-02-17 18:48:51',1,'Modification utilisateur aaa','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.69 Safari/537.17',NULL),(333,'2013-02-17 17:48:56','USER_MODIFY',1,'2013-02-17 18:48:56',1,'Modification utilisateur aaa','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.69 Safari/537.17',NULL),(334,'2013-02-18 22:00:01','USER_LOGIN',1,'2013-02-18 23:00:01',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.69 Safari/537.17',NULL),(335,'2013-02-19 08:19:52','USER_LOGIN',1,'2013-02-19 09:19:52',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.69 Safari/537.17',NULL),(336,'2013-02-19 22:00:52','USER_LOGIN',1,'2013-02-19 23:00:52',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.69 Safari/537.17',NULL),(337,'2013-02-20 09:34:52','USER_LOGIN',1,'2013-02-20 10:34:52',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.69 Safari/537.17',NULL),(338,'2013-02-20 13:12:28','USER_LOGIN',1,'2013-02-20 14:12:28',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.69 Safari/537.17',NULL),(339,'2013-02-20 17:19:44','USER_LOGIN',1,'2013-02-20 18:19:44',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.69 Safari/537.17',NULL),(340,'2013-02-20 19:07:21','USER_MODIFY',1,'2013-02-20 20:07:21',1,'Modification utilisateur adupont','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.69 Safari/537.17',NULL),(341,'2013-02-20 19:47:17','USER_LOGIN',1,'2013-02-20 20:47:17',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.69 Safari/537.17',NULL),(342,'2013-02-20 19:48:01','USER_MODIFY',1,'2013-02-20 20:48:01',1,'Modification utilisateur aaa','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.69 Safari/537.17',NULL),(343,'2013-02-21 08:27:07','USER_LOGIN',1,'2013-02-21 09:27:07',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.69 Safari/537.17',NULL),(344,'2013-02-23 13:34:13','USER_LOGIN',1,'2013-02-23 14:34:13',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.69 Safari/537.17',NULL),(345,'2013-02-24 01:06:41','USER_LOGIN_FAILED',1,'2013-02-24 02:06:41',NULL,'Bad value for login or password - login=admin','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(346,'2013-02-24 01:06:45','USER_LOGIN_FAILED',1,'2013-02-24 02:06:45',NULL,'Bad value for login or password - login=admin','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(347,'2013-02-24 01:06:55','USER_LOGIN_FAILED',1,'2013-02-24 02:06:55',NULL,'Bad value for login or password - login=admin','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(348,'2013-02-24 01:07:03','USER_LOGIN_FAILED',1,'2013-02-24 02:07:03',NULL,'Bad value for login or password - login=admin','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(349,'2013-02-24 01:07:21','USER_LOGIN_FAILED',1,'2013-02-24 02:07:21',NULL,'Bad value for login or password - login=admin','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(350,'2013-02-24 01:08:12','USER_LOGIN_FAILED',1,'2013-02-24 02:08:12',NULL,'Bad value for login or password - login=admin','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(351,'2013-02-24 01:08:42','USER_LOGIN_FAILED',1,'2013-02-24 02:08:42',NULL,'Bad value for login or password - login=admin','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(352,'2013-02-24 01:08:50','USER_LOGIN_FAILED',1,'2013-02-24 02:08:50',NULL,'Bad value for login or password - login=admin','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(353,'2013-02-24 01:09:08','USER_LOGIN_FAILED',1,'2013-02-24 02:09:08',NULL,'Bad value for login or password - login=admin','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(354,'2013-02-24 01:09:42','USER_LOGIN_FAILED',1,'2013-02-24 02:09:42',NULL,'Bad value for login or password - login=admin','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(355,'2013-02-24 01:09:50','USER_LOGIN_FAILED',1,'2013-02-24 02:09:50',NULL,'Bad value for login or password - login=admin','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(356,'2013-02-24 01:10:05','USER_LOGIN_FAILED',1,'2013-02-24 02:10:05',NULL,'Bad value for login or password - login=admin','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(357,'2013-02-24 01:10:22','USER_LOGIN_FAILED',1,'2013-02-24 02:10:22',NULL,'Bad value for login or password - login=admin','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(358,'2013-02-24 01:10:30','USER_LOGIN_FAILED',1,'2013-02-24 02:10:30',NULL,'Bad value for login or password - login=admin','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(359,'2013-02-24 01:10:56','USER_LOGIN_FAILED',1,'2013-02-24 02:10:56',NULL,'Bad value for login or password - login=admin','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(360,'2013-02-24 01:11:26','USER_LOGIN_FAILED',1,'2013-02-24 02:11:26',NULL,'Bad value for login or password - login=admin','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(361,'2013-02-24 01:12:06','USER_LOGIN_FAILED',1,'2013-02-24 02:12:06',NULL,'Bad value for login or password - login=admin','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(362,'2013-02-24 01:21:14','USER_LOGIN_FAILED',1,'2013-02-24 02:21:14',NULL,'Bad value for login or password - login=admin','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(363,'2013-02-24 01:21:25','USER_LOGIN_FAILED',1,'2013-02-24 02:21:25',NULL,'Bad value for login or password - login=admin','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(364,'2013-02-24 01:21:54','USER_LOGIN_FAILED',1,'2013-02-24 02:21:54',NULL,'Bad value for login or password - login=admin','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(365,'2013-02-24 01:22:14','USER_LOGIN_FAILED',1,'2013-02-24 02:22:14',NULL,'Bad value for login or password - login=admin','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(366,'2013-02-24 01:22:37','USER_LOGIN_FAILED',1,'2013-02-24 02:22:37',NULL,'Bad value for login or password - login=admin','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(367,'2013-02-24 01:23:01','USER_LOGIN_FAILED',1,'2013-02-24 02:23:01',NULL,'Bad value for login or password - login=admin','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(368,'2013-02-24 01:23:39','USER_LOGIN_FAILED',1,'2013-02-24 02:23:39',NULL,'Bad value for login or password - login=admin','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(369,'2013-02-24 01:24:04','USER_LOGIN_FAILED',1,'2013-02-24 02:24:04',NULL,'Bad value for login or password - login=admin','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(370,'2013-02-24 01:24:39','USER_LOGIN_FAILED',1,'2013-02-24 02:24:39',NULL,'Bad value for login or password - login=aa','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(371,'2013-02-24 01:25:01','USER_LOGIN_FAILED',1,'2013-02-24 02:25:01',NULL,'Bad value for login or password - login=aa','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(372,'2013-02-24 01:25:12','USER_LOGIN_FAILED',1,'2013-02-24 02:25:12',NULL,'Bad value for login or password - login=aa','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(373,'2013-02-24 01:27:30','USER_LOGIN_FAILED',1,'2013-02-24 02:27:30',NULL,'Bad value for login or password - login=aa','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(374,'2013-02-24 01:28:00','USER_LOGIN_FAILED',1,'2013-02-24 02:28:00',NULL,'Bad value for login or password - login=aa','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(375,'2013-02-24 01:28:35','USER_LOGIN_FAILED',1,'2013-02-24 02:28:35',NULL,'Bad value for login or password - login=aa','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(376,'2013-02-24 01:29:03','USER_LOGIN_FAILED',1,'2013-02-24 02:29:03',NULL,'Bad value for login or password - login=aa','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(377,'2013-02-24 01:29:55','USER_LOGIN_FAILED',1,'2013-02-24 02:29:55',NULL,'Bad value for login or password - login=aa','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(378,'2013-02-24 01:32:40','USER_LOGIN_FAILED',1,'2013-02-24 02:32:40',NULL,'Bad value for login or password - login=aa','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(379,'2013-02-24 01:39:33','USER_LOGIN_FAILED',1,'2013-02-24 02:39:33',NULL,'Identifiants login ou mot de passe incorrects - login=aa','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(380,'2013-02-24 01:39:38','USER_LOGIN_FAILED',1,'2013-02-24 02:39:38',NULL,'Identifiants login ou mot de passe incorrects - login=aa','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(381,'2013-02-24 01:39:47','USER_LOGIN_FAILED',1,'2013-02-24 02:39:47',NULL,'Identifiants login ou mot de passe incorrects - login=lmkm','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(382,'2013-02-24 01:40:54','USER_LOGIN_FAILED',1,'2013-02-24 02:40:54',NULL,'Identifiants login ou mot de passe incorrects - login=lmkm','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(383,'2013-02-24 01:47:57','USER_LOGIN_FAILED',1,'2013-02-24 02:47:57',NULL,'Identifiants login ou mot de passe incorrects - login=lmkm','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(384,'2013-02-24 01:48:05','USER_LOGIN_FAILED',1,'2013-02-24 02:48:05',NULL,'Identifiants login ou mot de passe incorrects - login=admin','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(385,'2013-02-24 01:48:07','USER_LOGIN_FAILED',1,'2013-02-24 02:48:07',NULL,'Unknown column \'u.lastname\' in \'field list\'','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(386,'2013-02-24 01:48:35','USER_LOGIN',1,'2013-02-24 02:48:35',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(387,'2013-02-24 01:56:32','USER_LOGIN',1,'2013-02-24 02:56:32',1,'(UserLogged,admin)','192.168.0.254','Mozilla/5.0 (Linux; U; Android 2.2; en-us; sdk Build/FRF91) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1',NULL),(388,'2013-02-24 02:05:55','USER_LOGOUT',1,'2013-02-24 03:05:55',1,'(UserLogoff,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(389,'2013-02-24 02:39:52','USER_LOGIN',1,'2013-02-24 03:39:52',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(390,'2013-02-24 02:51:10','USER_LOGOUT',1,'2013-02-24 03:51:10',1,'(UserLogoff,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(391,'2013-02-24 12:46:41','USER_LOGIN',1,'2013-02-24 13:46:41',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(392,'2013-02-24 12:46:52','USER_LOGOUT',1,'2013-02-24 13:46:52',1,'(UserLogoff,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(393,'2013-02-24 12:46:56','USER_LOGIN',1,'2013-02-24 13:46:56',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(394,'2013-02-24 12:47:56','USER_LOGOUT',1,'2013-02-24 13:47:56',1,'(UserLogoff,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(395,'2013-02-24 12:48:00','USER_LOGIN',1,'2013-02-24 13:48:00',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(396,'2013-02-24 12:48:11','USER_LOGOUT',1,'2013-02-24 13:48:11',1,'(UserLogoff,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(397,'2013-02-24 12:48:32','USER_LOGIN',1,'2013-02-24 13:48:32',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(398,'2013-02-24 12:52:22','USER_LOGOUT',1,'2013-02-24 13:52:22',1,'(UserLogoff,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(399,'2013-02-24 12:52:27','USER_LOGIN',1,'2013-02-24 13:52:27',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(400,'2013-02-24 12:52:54','USER_LOGOUT',1,'2013-02-24 13:52:54',1,'(UserLogoff,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(401,'2013-02-24 12:52:59','USER_LOGIN',1,'2013-02-24 13:52:59',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(402,'2013-02-24 12:55:39','USER_LOGOUT',1,'2013-02-24 13:55:39',1,'(UserLogoff,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(403,'2013-02-24 12:55:59','USER_LOGIN',1,'2013-02-24 13:55:59',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(404,'2013-02-24 12:56:07','USER_LOGOUT',1,'2013-02-24 13:56:07',1,'(UserLogoff,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(405,'2013-02-24 12:56:23','USER_LOGIN',1,'2013-02-24 13:56:23',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(406,'2013-02-24 12:56:46','USER_LOGOUT',1,'2013-02-24 13:56:46',1,'(UserLogoff,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(407,'2013-02-24 12:58:30','USER_LOGIN',1,'2013-02-24 13:58:30',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(408,'2013-02-24 12:58:33','USER_LOGOUT',1,'2013-02-24 13:58:33',1,'(UserLogoff,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(409,'2013-02-24 12:58:51','USER_LOGIN',1,'2013-02-24 13:58:51',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(410,'2013-02-24 12:58:58','USER_LOGOUT',1,'2013-02-24 13:58:58',1,'(UserLogoff,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(411,'2013-02-24 13:18:53','USER_LOGIN',1,'2013-02-24 14:18:53',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(412,'2013-02-24 13:19:52','USER_LOGOUT',1,'2013-02-24 14:19:52',1,'(UserLogoff,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(413,'2013-02-24 15:39:31','USER_LOGIN_FAILED',1,'2013-02-24 16:39:31',NULL,'ErrorBadValueForCode - login=admin','127.0.0.1',NULL,NULL),(414,'2013-02-24 15:42:07','USER_LOGIN',1,'2013-02-24 16:42:07',1,'(UserLogged,admin)','127.0.0.1',NULL,NULL),(415,'2013-02-24 15:42:52','USER_LOGOUT',1,'2013-02-24 16:42:52',1,'(UserLogoff,admin)','127.0.0.1','Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_0 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8A293 Safari/6531.22.7',NULL),(416,'2013-02-24 16:04:21','USER_LOGIN',1,'2013-02-24 17:04:21',1,'(UserLogged,admin)','192.168.0.254','Mozilla/5.0 (Linux; U; Android 2.2; en-us; sdk Build/FRF91) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1',NULL),(417,'2013-02-24 16:11:28','USER_LOGIN_FAILED',1,'2013-02-24 17:11:28',NULL,'ErrorBadValueForCode - login=admin','127.0.0.1','Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_0 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8A293 Safari/6531.22.7',NULL),(418,'2013-02-24 16:11:37','USER_LOGIN',1,'2013-02-24 17:11:37',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_0 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8A293 Safari/6531.22.7',NULL),(419,'2013-02-24 16:36:52','USER_LOGOUT',1,'2013-02-24 17:36:52',1,'(UserLogoff,admin)','192.168.0.254','Mozilla/5.0 (Linux; U; Android 2.2; en-us; sdk Build/FRF91) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1',NULL),(420,'2013-02-24 16:40:37','USER_LOGIN',1,'2013-02-24 17:40:37',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(421,'2013-02-24 16:57:16','USER_LOGIN',1,'2013-02-24 17:57:16',1,'(UserLogged,admin)','192.168.0.254','Mozilla/5.0 (Linux; U; Android 2.2; en-us; sdk Build/FRF91) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1 - 2131034114',NULL),(422,'2013-02-24 17:01:30','USER_LOGOUT',1,'2013-02-24 18:01:30',1,'(UserLogoff,admin)','192.168.0.254','Mozilla/5.0 (Linux; U; Android 2.2; en-us; sdk Build/FRF91) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1 - 2131034114',NULL),(423,'2013-02-24 17:02:33','USER_LOGIN',1,'2013-02-24 18:02:33',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(424,'2013-02-24 17:14:22','USER_LOGOUT',1,'2013-02-24 18:14:22',1,'(UserLogoff,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(425,'2013-02-24 17:15:07','USER_LOGIN_FAILED',1,'2013-02-24 18:15:07',NULL,'Identifiants login ou mot de passe incorrects - login=admin','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(426,'2013-02-24 17:15:20','USER_LOGIN',1,'2013-02-24 18:15:20',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(427,'2013-02-24 17:20:14','USER_LOGIN',1,'2013-02-24 18:20:14',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(428,'2013-02-24 17:20:51','USER_LOGIN',1,'2013-02-24 18:20:51',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(429,'2013-02-24 17:20:54','USER_LOGOUT',1,'2013-02-24 18:20:54',1,'(UserLogoff,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(430,'2013-02-24 17:21:19','USER_LOGIN',1,'2013-02-24 18:21:19',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(431,'2013-02-24 17:32:35','USER_LOGIN',1,'2013-02-24 18:32:35',1,'(UserLogged,admin)','192.168.0.254','Mozilla/5.0 (Linux; U; Android 2.2; en-us; sdk Build/FRF91) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1 - 2131034114',NULL),(432,'2013-02-24 18:28:48','USER_LOGIN',1,'2013-02-24 19:28:48',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(433,'2013-02-24 18:29:27','USER_LOGOUT',1,'2013-02-24 19:29:27',1,'(UserLogoff,admin)','127.0.0.1','Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_0 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8A293 Safari/6531.22.7',NULL),(434,'2013-02-24 18:29:32','USER_LOGIN',1,'2013-02-24 19:29:32',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_0 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8A293 Safari/6531.22.7',NULL),(435,'2013-02-24 20:13:13','USER_LOGOUT',1,'2013-02-24 21:13:13',1,'(UserLogoff,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(436,'2013-02-24 20:13:17','USER_LOGIN',1,'2013-02-24 21:13:17',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(437,'2013-02-25 08:57:16','USER_LOGIN',1,'2013-02-25 09:57:16',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(438,'2013-02-25 08:57:59','USER_LOGOUT',1,'2013-02-25 09:57:59',1,'(UserLogoff,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(439,'2013-02-25 09:15:02','USER_LOGIN',1,'2013-02-25 10:15:02',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(440,'2013-02-25 09:15:50','USER_LOGOUT',1,'2013-02-25 10:15:50',1,'(UserLogoff,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(441,'2013-02-25 09:15:57','USER_LOGIN',1,'2013-02-25 10:15:57',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(442,'2013-02-25 09:16:12','USER_LOGOUT',1,'2013-02-25 10:16:12',1,'(UserLogoff,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(443,'2013-02-25 09:16:19','USER_LOGIN',1,'2013-02-25 10:16:19',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(444,'2013-02-25 09:16:25','USER_LOGOUT',1,'2013-02-25 10:16:25',1,'(UserLogoff,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(445,'2013-02-25 09:16:39','USER_LOGIN_FAILED',1,'2013-02-25 10:16:39',NULL,'Bad value for login or password - login=admin','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(446,'2013-02-25 09:16:42','USER_LOGIN_FAILED',1,'2013-02-25 10:16:42',NULL,'Bad value for login or password - login=admin','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(447,'2013-02-25 09:16:54','USER_LOGIN_FAILED',1,'2013-02-25 10:16:54',NULL,'Identificadors d'usuari o contrasenya incorrectes - login=gfdg','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(448,'2013-02-25 09:17:53','USER_LOGIN',1,'2013-02-25 10:17:53',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(449,'2013-02-25 09:18:37','USER_LOGOUT',1,'2013-02-25 10:18:37',1,'(UserLogoff,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(450,'2013-02-25 09:18:41','USER_LOGIN',1,'2013-02-25 10:18:41',4,'(UserLogged,aaa)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(451,'2013-02-25 09:18:47','USER_LOGOUT',1,'2013-02-25 10:18:47',4,'(UserLogoff,aaa)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(452,'2013-02-25 10:05:34','USER_LOGIN',1,'2013-02-25 11:05:34',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(453,'2013-02-26 21:51:40','USER_LOGIN',1,'2013-02-26 22:51:40',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(454,'2013-02-26 23:30:06','USER_LOGIN',1,'2013-02-27 00:30:06',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(455,'2013-02-27 14:13:11','USER_LOGIN',1,'2013-02-27 15:13:11',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(456,'2013-02-27 18:12:06','USER_LOGIN_FAILED',1,'2013-02-27 19:12:06',NULL,'Identifiants login ou mot de passe incorrects - login=admin','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(457,'2013-02-27 18:12:10','USER_LOGIN',1,'2013-02-27 19:12:10',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(458,'2013-02-27 20:20:08','USER_LOGIN',1,'2013-02-27 21:20:08',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(459,'2013-03-01 22:12:03','USER_LOGIN',1,'2013-03-01 23:12:03',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(460,'2013-03-02 11:45:50','USER_LOGIN',1,'2013-03-02 12:45:50',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(461,'2013-03-02 15:53:51','USER_LOGIN_FAILED',1,'2013-03-02 16:53:51',NULL,'Identifiants login ou mot de passe incorrects - login=admin','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(462,'2013-03-02 15:53:53','USER_LOGIN',1,'2013-03-02 16:53:53',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(463,'2013-03-02 18:32:32','USER_LOGIN',1,'2013-03-02 19:32:32',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(464,'2013-03-02 22:59:36','USER_LOGIN',1,'2013-03-02 23:59:36',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(465,'2013-03-03 16:26:26','USER_LOGIN',1,'2013-03-03 17:26:26',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(466,'2013-03-03 22:50:27','USER_LOGIN',1,'2013-03-03 23:50:27',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(467,'2013-03-04 08:29:27','USER_LOGIN',1,'2013-03-04 09:29:27',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(468,'2013-03-04 18:27:28','USER_LOGIN',1,'2013-03-04 19:27:28',1,'(UserLogged,admin)','192.168.0.254','Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; NP06)',NULL),(469,'2013-03-04 19:27:23','USER_LOGIN',1,'2013-03-04 20:27:23',1,'(UserLogged,admin)','192.168.0.254','Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)',NULL),(470,'2013-03-04 19:35:14','USER_LOGIN',1,'2013-03-04 20:35:14',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(471,'2013-03-04 19:55:49','USER_LOGIN',1,'2013-03-04 20:55:49',1,'(UserLogged,admin)','192.168.0.254','Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0)',NULL),(472,'2013-03-04 21:16:13','USER_LOGIN',1,'2013-03-04 22:16:13',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(473,'2013-03-05 10:17:30','USER_LOGIN',1,'2013-03-05 11:17:30',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(474,'2013-03-05 11:02:43','USER_LOGIN',1,'2013-03-05 12:02:43',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(475,'2013-03-05 23:14:39','USER_LOGIN',1,'2013-03-06 00:14:39',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(476,'2013-03-06 08:58:57','USER_LOGIN',1,'2013-03-06 09:58:57',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(477,'2013-03-06 14:29:40','USER_LOGIN',1,'2013-03-06 15:29:40',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(478,'2013-03-06 21:53:02','USER_LOGIN',1,'2013-03-06 22:53:02',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(479,'2013-03-07 21:14:39','USER_LOGIN',1,'2013-03-07 22:14:39',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(480,'2013-03-08 00:06:05','USER_LOGIN',1,'2013-03-08 01:06:05',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(481,'2013-03-08 01:38:13','USER_LOGIN',1,'2013-03-08 02:38:13',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(482,'2013-03-08 08:59:50','USER_LOGIN',1,'2013-03-08 09:59:50',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(483,'2013-03-09 12:08:51','USER_LOGIN',1,'2013-03-09 13:08:51',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(484,'2013-03-09 15:19:53','USER_LOGIN',1,'2013-03-09 16:19:53',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(495,'2013-03-09 18:06:21','USER_LOGIN',1,'2013-03-09 19:06:21',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(496,'2013-03-09 20:01:24','USER_LOGIN',1,'2013-03-09 21:01:24',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(497,'2013-03-09 23:36:45','USER_LOGIN',1,'2013-03-10 00:36:45',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(498,'2013-03-10 14:37:13','USER_LOGIN',1,'2013-03-10 15:37:13',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(499,'2013-03-10 17:54:12','USER_LOGIN',1,'2013-03-10 18:54:12',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(500,'2013-03-11 08:57:09','USER_LOGIN',1,'2013-03-11 09:57:09',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(501,'2013-03-11 22:05:13','USER_LOGIN',1,'2013-03-11 23:05:13',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(502,'2013-03-12 08:34:27','USER_LOGIN',1,'2013-03-12 09:34:27',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(503,'2013-03-13 09:11:02','USER_LOGIN',1,'2013-03-13 10:11:02',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(504,'2013-03-13 10:02:11','USER_LOGIN',1,'2013-03-13 11:02:11',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(505,'2013-03-13 13:20:58','USER_LOGIN',1,'2013-03-13 14:20:58',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(506,'2013-03-13 16:19:28','USER_LOGIN',1,'2013-03-13 17:19:28',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(507,'2013-03-13 18:34:30','USER_LOGIN',1,'2013-03-13 19:34:30',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(508,'2013-03-14 08:25:02','USER_LOGIN',1,'2013-03-14 09:25:02',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(509,'2013-03-14 19:15:22','USER_LOGIN',1,'2013-03-14 20:15:22',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(510,'2013-03-14 21:58:53','USER_LOGIN',1,'2013-03-14 22:58:53',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(511,'2013-03-14 21:58:59','USER_LOGOUT',1,'2013-03-14 22:58:59',1,'(UserLogoff,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(512,'2013-03-14 21:59:07','USER_LOGIN',1,'2013-03-14 22:59:07',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(513,'2013-03-14 22:58:22','USER_LOGOUT',1,'2013-03-14 23:58:22',1,'(UserLogoff,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(514,'2013-03-14 23:00:25','USER_LOGIN',1,'2013-03-15 00:00:25',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(515,'2013-03-16 12:14:28','USER_LOGIN',1,'2013-03-16 13:14:28',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(516,'2013-03-16 16:09:01','USER_LOGIN',1,'2013-03-16 17:09:01',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(517,'2013-03-16 16:57:11','USER_LOGIN',1,'2013-03-16 17:57:11',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(518,'2013-03-16 19:31:31','USER_LOGIN',1,'2013-03-16 20:31:31',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22',NULL),(519,'2013-03-17 17:44:39','USER_LOGIN',1,'2013-03-17 18:44:39',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.172 Safari/537.22',NULL),(520,'2013-03-17 20:40:57','USER_LOGIN',1,'2013-03-17 21:40:57',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.172 Safari/537.22',NULL),(521,'2013-03-17 23:14:05','USER_LOGIN',1,'2013-03-18 00:14:05',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.172 Safari/537.22',NULL),(522,'2013-03-17 23:28:47','USER_LOGOUT',1,'2013-03-18 00:28:47',1,'(UserLogoff,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.172 Safari/537.22',NULL),(523,'2013-03-17 23:28:54','USER_LOGIN',1,'2013-03-18 00:28:54',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.172 Safari/537.22',NULL),(524,'2013-03-18 17:37:30','USER_LOGIN',1,'2013-03-18 18:37:30',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.172 Safari/537.22',NULL),(525,'2013-03-18 18:11:37','USER_LOGIN',1,'2013-03-18 19:11:37',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.172 Safari/537.22',NULL),(526,'2013-03-19 08:35:08','USER_LOGIN',1,'2013-03-19 09:35:08',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.172 Safari/537.22',NULL),(527,'2013-03-19 09:20:23','USER_LOGIN',1,'2013-03-19 10:20:23',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.172 Safari/537.22',NULL),(528,'2013-03-20 13:17:13','USER_LOGIN',1,'2013-03-20 14:17:13',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.172 Safari/537.22',NULL),(529,'2013-03-20 14:44:31','USER_LOGIN',1,'2013-03-20 15:44:31',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.172 Safari/537.22',NULL),(530,'2013-03-20 18:24:25','USER_LOGIN',1,'2013-03-20 19:24:25',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.172 Safari/537.22',NULL),(531,'2013-03-20 19:15:54','USER_LOGIN',1,'2013-03-20 20:15:54',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.172 Safari/537.22',NULL),(532,'2013-03-21 18:40:47','USER_LOGIN',1,'2013-03-21 19:40:47',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.172 Safari/537.22',NULL),(533,'2013-03-21 21:42:24','USER_LOGIN',1,'2013-03-21 22:42:24',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.172 Safari/537.22',NULL),(534,'2013-03-22 08:39:23','USER_LOGIN',1,'2013-03-22 09:39:23',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.172 Safari/537.22',NULL),(535,'2013-03-23 13:04:55','USER_LOGIN',1,'2013-03-23 14:04:55',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.172 Safari/537.22',NULL),(536,'2013-03-23 15:47:43','USER_LOGIN',1,'2013-03-23 16:47:43',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.172 Safari/537.22',NULL),(537,'2013-03-23 22:56:36','USER_LOGIN',1,'2013-03-23 23:56:36',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.172 Safari/537.22',NULL),(538,'2013-03-24 01:22:32','USER_LOGIN',1,'2013-03-24 02:22:32',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.172 Safari/537.22',NULL),(539,'2013-03-24 14:40:42','USER_LOGIN',1,'2013-03-24 15:40:42',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.172 Safari/537.22',NULL),(540,'2013-03-24 15:30:26','USER_LOGOUT',1,'2013-03-24 16:30:26',1,'(UserLogoff,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.172 Safari/537.22',NULL),(541,'2013-03-24 15:30:29','USER_LOGIN',1,'2013-03-24 16:30:29',2,'(UserLogged,demo)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.172 Safari/537.22',NULL),(542,'2013-03-24 15:49:40','USER_LOGOUT',1,'2013-03-24 16:49:40',2,'(UserLogoff,demo)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.172 Safari/537.22',NULL),(543,'2013-03-24 15:49:48','USER_LOGIN',1,'2013-03-24 16:49:48',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.172 Safari/537.22',NULL),(544,'2013-03-24 15:52:35','USER_MODIFY',1,'2013-03-24 16:52:35',1,'Modification utilisateur zzzg','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.172 Safari/537.22',NULL),(545,'2013-03-24 15:52:52','USER_MODIFY',1,'2013-03-24 16:52:52',1,'Modification utilisateur zzzg','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.172 Safari/537.22',NULL),(546,'2013-03-24 15:53:09','USER_MODIFY',1,'2013-03-24 16:53:09',1,'Modification utilisateur zzzg','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.172 Safari/537.22',NULL),(547,'2013-03-24 15:53:23','USER_MODIFY',1,'2013-03-24 16:53:23',1,'Modification utilisateur zzzg','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.172 Safari/537.22',NULL),(548,'2013-03-24 16:00:04','USER_MODIFY',1,'2013-03-24 17:00:04',1,'Modification utilisateur zzzg','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.172 Safari/537.22',NULL),(549,'2013-03-24 16:01:50','USER_MODIFY',1,'2013-03-24 17:01:50',1,'Modification utilisateur zzzg','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.172 Safari/537.22',NULL),(550,'2013-03-24 16:10:14','USER_MODIFY',1,'2013-03-24 17:10:14',1,'Modification utilisateur zzzg','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.172 Safari/537.22',NULL),(551,'2013-03-24 16:55:13','USER_LOGIN',1,'2013-03-24 17:55:13',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.172 Safari/537.22',NULL),(552,'2013-03-24 17:44:29','USER_LOGIN',1,'2013-03-24 18:44:29',1,'(UserLogged,admin)','::1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.172 Safari/537.22',NULL),(553,'2013-09-08 23:06:26','USER_LOGIN',1,'2013-09-09 01:06:26',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.57 Safari/537.36',NULL),(554,'2013-10-21 22:32:28','USER_LOGIN',1,'2013-10-22 00:32:28',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.66 Safari/537.36',NULL),(555,'2013-10-21 22:32:48','USER_LOGIN',1,'2013-10-22 00:32:48',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.66 Safari/537.36',NULL),(556,'2013-11-07 00:01:51','USER_LOGIN',1,'2013-11-07 01:01:51',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.114 Safari/537.36',NULL),(557,'2014-03-02 15:21:07','USER_LOGIN',1,'2014-03-02 16:21:07',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.117 Safari/537.36',NULL),(558,'2014-03-02 15:36:53','USER_LOGIN',1,'2014-03-02 16:36:53',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.117 Safari/537.36',NULL),(559,'2014-03-02 18:54:23','USER_LOGIN',1,'2014-03-02 19:54:23',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.117 Safari/537.36',NULL),(560,'2014-03-02 19:11:17','USER_LOGIN',1,'2014-03-02 20:11:17',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.117 Safari/537.36',NULL),(561,'2014-03-03 18:19:24','USER_LOGIN',1,'2014-03-03 19:19:24',1,'(UserLogged,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.117 Safari/537.36',NULL),(562,'2014-12-21 12:51:38','USER_LOGIN',1,'2014-12-21 13:51:38',1,'(UserLogged,admin) - TZ=1;TZString=CET;Screen=1920x969','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.111 Safari/537.36',NULL),(563,'2014-12-21 19:52:09','USER_LOGIN',1,'2014-12-21 20:52:09',1,'(UserLogged,admin) - TZ=1;TZString=CET;Screen=1920x969','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.111 Safari/537.36',NULL),(566,'2015-10-03 08:49:43','USER_NEW_PASSWORD',1,'2015-10-03 10:49:43',1,'Password change for admin','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(567,'2015-10-03 08:49:43','USER_MODIFY',1,'2015-10-03 10:49:43',1,'User admin modified','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(568,'2015-10-03 09:03:12','USER_MODIFY',1,'2015-10-03 11:03:12',1,'User admin modified','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(569,'2015-10-03 09:03:42','USER_MODIFY',1,'2015-10-03 11:03:42',1,'User admin modified','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(570,'2015-10-03 09:07:36','USER_MODIFY',1,'2015-10-03 11:07:36',1,'User demo modified','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(571,'2015-10-03 09:08:58','USER_NEW_PASSWORD',1,'2015-10-03 11:08:58',1,'Password change for pcurie','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(572,'2015-10-03 09:08:58','USER_MODIFY',1,'2015-10-03 11:08:58',1,'User pcurie modified','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(573,'2015-10-03 09:09:23','USER_MODIFY',1,'2015-10-03 11:09:23',1,'User pcurie modified','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(574,'2015-10-03 09:11:04','USER_NEW_PASSWORD',1,'2015-10-03 11:11:04',1,'Password change for athestudent','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(575,'2015-10-03 09:11:04','USER_MODIFY',1,'2015-10-03 11:11:04',1,'User athestudent modified','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(576,'2015-10-03 09:11:53','USER_MODIFY',1,'2015-10-03 11:11:53',1,'User abookkeeper modified','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(577,'2015-10-03 09:42:12','USER_LOGIN_FAILED',1,'2015-10-03 11:42:11',NULL,'Bad value for login or password - login=admin','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(578,'2015-10-03 09:42:19','USER_LOGIN_FAILED',1,'2015-10-03 11:42:19',NULL,'Bad value for login or password - login=admin','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(579,'2015-10-03 09:42:42','USER_LOGIN_FAILED',1,'2015-10-03 11:42:42',NULL,'Bad value for login or password - login=aeinstein','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(580,'2015-10-03 09:43:50','USER_LOGIN',1,'2015-10-03 11:43:50',1,'(UserLogged,admin) - TZ=1;TZString=Europe/Berlin;Screen=1600x788','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(581,'2015-10-03 09:44:44','GROUP_MODIFY',1,'2015-10-03 11:44:44',1,'Group Sale representatives modified','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(582,'2015-10-03 09:46:25','GROUP_CREATE',1,'2015-10-03 11:46:25',1,'Group Management created','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(583,'2015-10-03 09:46:46','GROUP_CREATE',1,'2015-10-03 11:46:46',1,'Group Scientists created','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(584,'2015-10-03 09:47:41','USER_CREATE',1,'2015-10-03 11:47:41',1,'User mcurie created','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(585,'2015-10-03 09:47:41','USER_NEW_PASSWORD',1,'2015-10-03 11:47:41',1,'Password change for mcurie','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(586,'2015-10-03 09:47:53','USER_MODIFY',1,'2015-10-03 11:47:53',1,'User mcurie modified','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(587,'2015-10-03 09:48:32','USER_DELETE',1,'2015-10-03 11:48:32',1,'User bbb removed','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(588,'2015-10-03 09:48:52','USER_MODIFY',1,'2015-10-03 11:48:52',1,'User bookkeeper modified','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(589,'2015-10-03 10:01:28','USER_MODIFY',1,'2015-10-03 12:01:28',1,'User bookkeeper modified','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(590,'2015-10-03 10:01:39','USER_MODIFY',1,'2015-10-03 12:01:39',1,'User bookkeeper modified','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(591,'2015-10-05 06:32:38','USER_LOGIN_FAILED',1,'2015-10-05 08:32:38',NULL,'Bad value for login or password - login=admin','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(592,'2015-10-05 06:32:44','USER_LOGIN',1,'2015-10-05 08:32:44',1,'(UserLogged,admin) - TZ=1;TZString=Europe/Berlin;Screen=1590x767','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(593,'2015-10-05 07:07:52','USER_CREATE',1,'2015-10-05 09:07:52',1,'User atheceo created','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(594,'2015-10-05 07:07:52','USER_NEW_PASSWORD',1,'2015-10-05 09:07:52',1,'Password change for atheceo','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(595,'2015-10-05 07:09:08','USER_NEW_PASSWORD',1,'2015-10-05 09:09:08',1,'Password change for aeinstein','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(596,'2015-10-05 07:09:08','USER_MODIFY',1,'2015-10-05 09:09:08',1,'User aeinstein modified','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(597,'2015-10-05 07:09:46','USER_CREATE',1,'2015-10-05 09:09:46',1,'User admin created','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(598,'2015-10-05 07:09:46','USER_NEW_PASSWORD',1,'2015-10-05 09:09:46',1,'Password change for admin','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(599,'2015-10-05 07:10:20','USER_MODIFY',1,'2015-10-05 09:10:20',1,'User demo modified','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(600,'2015-10-05 07:10:48','USER_MODIFY',1,'2015-10-05 09:10:48',1,'User admin modified','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(601,'2015-10-05 07:11:22','USER_NEW_PASSWORD',1,'2015-10-05 09:11:22',1,'Password change for bbookkeeper','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(602,'2015-10-05 07:11:22','USER_MODIFY',1,'2015-10-05 09:11:22',1,'User bbookkeeper modified','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(603,'2015-10-05 07:12:37','USER_MODIFY',1,'2015-10-05 09:12:37',1,'User admin modified','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(604,'2015-10-05 07:13:27','USER_MODIFY',1,'2015-10-05 09:13:27',1,'User demo modified','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(605,'2015-10-05 07:13:52','USER_MODIFY',1,'2015-10-05 09:13:52',1,'User admin modified','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(606,'2015-10-05 07:14:35','USER_LOGOUT',1,'2015-10-05 09:14:35',1,'(UserLogoff,aeinstein)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(607,'2015-10-05 07:14:40','USER_LOGIN_FAILED',1,'2015-10-05 09:14:40',NULL,'Bad value for login or password - login=admin','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(608,'2015-10-05 07:14:44','USER_LOGIN_FAILED',1,'2015-10-05 09:14:44',NULL,'Bad value for login or password - login=admin','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(609,'2015-10-05 07:14:49','USER_LOGIN',1,'2015-10-05 09:14:49',12,'(UserLogged,admin) - TZ=1;TZString=Europe/Berlin;Screen=1590x767','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(610,'2015-10-05 07:57:18','USER_MODIFY',1,'2015-10-05 09:57:18',12,'User aeinstein modified','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(611,'2015-10-05 08:06:54','USER_LOGOUT',1,'2015-10-05 10:06:54',12,'(UserLogoff,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(612,'2015-10-05 08:07:03','USER_LOGIN',1,'2015-10-05 10:07:03',11,'(UserLogged,atheceo) - TZ=1;TZString=Europe/Berlin;Screen=1590x767','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(613,'2015-10-05 19:18:46','USER_LOGIN',1,'2015-10-05 21:18:46',11,'(UserLogged,atheceo) - TZ=1;TZString=Europe/Berlin;Screen=1590x767','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(614,'2015-10-05 19:29:35','USER_CREATE',1,'2015-10-05 21:29:35',11,'User ccommercy created','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(615,'2015-10-05 19:29:35','USER_NEW_PASSWORD',1,'2015-10-05 21:29:35',11,'Password change for ccommercy','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(616,'2015-10-05 19:30:13','GROUP_CREATE',1,'2015-10-05 21:30:13',11,'Group Commercial created','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(617,'2015-10-05 19:31:37','USER_NEW_PASSWORD',1,'2015-10-05 21:31:37',11,'Password change for admin','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(618,'2015-10-05 19:31:37','USER_MODIFY',1,'2015-10-05 21:31:37',11,'User admin modified','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(619,'2015-10-05 19:32:00','USER_MODIFY',1,'2015-10-05 21:32:00',11,'User admin modified','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(620,'2015-10-05 19:33:33','USER_CREATE',1,'2015-10-05 21:33:33',11,'User sscientol created','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(621,'2015-10-05 19:33:33','USER_NEW_PASSWORD',1,'2015-10-05 21:33:33',11,'Password change for sscientol','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(622,'2015-10-05 19:33:47','USER_NEW_PASSWORD',1,'2015-10-05 21:33:47',11,'Password change for mcurie','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(623,'2015-10-05 19:33:47','USER_MODIFY',1,'2015-10-05 21:33:47',11,'User mcurie modified','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(624,'2015-10-05 19:34:23','USER_NEW_PASSWORD',1,'2015-10-05 21:34:23',11,'Password change for pcurie','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(625,'2015-10-05 19:34:23','USER_MODIFY',1,'2015-10-05 21:34:23',11,'User pcurie modified','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(626,'2015-10-05 19:34:42','USER_MODIFY',1,'2015-10-05 21:34:42',11,'User aeinstein modified','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(627,'2015-10-05 19:36:06','USER_NEW_PASSWORD',1,'2015-10-05 21:36:06',11,'Password change for ccommercy','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(628,'2015-10-05 19:36:06','USER_MODIFY',1,'2015-10-05 21:36:06',11,'User ccommercy modified','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(629,'2015-10-05 19:36:57','USER_NEW_PASSWORD',1,'2015-10-05 21:36:57',11,'Password change for atheceo','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(630,'2015-10-05 19:36:57','USER_MODIFY',1,'2015-10-05 21:36:57',11,'User atheceo modified','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(631,'2015-10-05 19:37:27','USER_LOGOUT',1,'2015-10-05 21:37:27',11,'(UserLogoff,atheceo)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(632,'2015-10-05 19:37:35','USER_LOGIN_FAILED',1,'2015-10-05 21:37:35',NULL,'Bad value for login or password - login=admin','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(633,'2015-10-05 19:37:39','USER_LOGIN_FAILED',1,'2015-10-05 21:37:39',NULL,'Bad value for login or password - login=admin','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(634,'2015-10-05 19:37:44','USER_LOGIN_FAILED',1,'2015-10-05 21:37:44',NULL,'Bad value for login or password - login=admin','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(635,'2015-10-05 19:37:49','USER_LOGIN_FAILED',1,'2015-10-05 21:37:49',NULL,'Bad value for login or password - login=admin','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(636,'2015-10-05 19:38:12','USER_LOGIN_FAILED',1,'2015-10-05 21:38:12',NULL,'Bad value for login or password - login=admin','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(637,'2015-10-05 19:40:48','USER_LOGIN_FAILED',1,'2015-10-05 21:40:48',NULL,'Bad value for login or password - login=admin','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(638,'2015-10-05 19:40:55','USER_LOGIN',1,'2015-10-05 21:40:55',12,'(UserLogged,admin) - TZ=1;TZString=Europe/Berlin;Screen=1590x767','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(639,'2015-10-05 19:43:34','USER_MODIFY',1,'2015-10-05 21:43:34',12,'User aeinstein modified','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(640,'2015-10-05 19:45:43','USER_CREATE',1,'2015-10-05 21:45:43',12,'User aaa created','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(641,'2015-10-05 19:45:43','USER_NEW_PASSWORD',1,'2015-10-05 21:45:43',12,'Password change for aaa','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(642,'2015-10-05 19:46:18','USER_DELETE',1,'2015-10-05 21:46:18',12,'User aaa removed','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(643,'2015-10-05 19:47:09','USER_MODIFY',1,'2015-10-05 21:47:09',12,'User demo modified','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(644,'2015-10-05 19:47:22','USER_MODIFY',1,'2015-10-05 21:47:22',12,'User demo modified','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(645,'2015-10-05 19:52:05','USER_MODIFY',1,'2015-10-05 21:52:05',12,'User sscientol modified','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(646,'2015-10-05 19:52:23','USER_MODIFY',1,'2015-10-05 21:52:23',12,'User bbookkeeper modified','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(647,'2015-10-05 19:54:54','USER_NEW_PASSWORD',1,'2015-10-05 21:54:54',12,'Password change for zzeceo','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(648,'2015-10-05 19:54:54','USER_MODIFY',1,'2015-10-05 21:54:54',12,'User zzeceo modified','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(649,'2015-10-05 19:57:02','USER_MODIFY',1,'2015-10-05 21:57:02',12,'User zzeceo modified','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(650,'2015-10-05 19:57:57','USER_NEW_PASSWORD',1,'2015-10-05 21:57:57',12,'Password change for pcurie','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(651,'2015-10-05 19:57:57','USER_MODIFY',1,'2015-10-05 21:57:57',12,'User pcurie modified','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(652,'2015-10-05 19:59:42','USER_NEW_PASSWORD',1,'2015-10-05 21:59:42',12,'Password change for admin','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(653,'2015-10-05 19:59:42','USER_MODIFY',1,'2015-10-05 21:59:42',12,'User admin modified','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(654,'2015-10-05 20:00:21','USER_MODIFY',1,'2015-10-05 22:00:21',12,'User adminx modified','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(655,'2015-10-05 20:05:36','USER_MODIFY',1,'2015-10-05 22:05:36',12,'User admin modified','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(656,'2015-10-05 20:06:25','USER_MODIFY',1,'2015-10-05 22:06:25',12,'User ccommercy modified','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(657,'2015-10-05 20:07:18','USER_MODIFY',1,'2015-10-05 22:07:18',12,'User mcurie modified','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(658,'2015-10-05 20:07:36','USER_MODIFY',1,'2015-10-05 22:07:36',12,'User aeinstein modified','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(659,'2015-10-05 20:08:34','USER_MODIFY',1,'2015-10-05 22:08:34',12,'User bbookkeeper modified','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(660,'2015-10-05 20:47:52','USER_CREATE',1,'2015-10-05 22:47:52',12,'User cc1 created','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(661,'2015-10-05 20:47:52','USER_NEW_PASSWORD',1,'2015-10-05 22:47:52',12,'Password change for cc1','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(662,'2015-10-05 20:47:55','USER_LOGOUT',1,'2015-10-05 22:47:55',12,'(UserLogoff,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(663,'2015-10-05 20:48:08','USER_LOGIN',1,'2015-10-05 22:48:08',11,'(UserLogged,zzeceo) - TZ=1;TZString=Europe/Berlin;Screen=1590x434','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(664,'2015-10-05 20:48:39','USER_CREATE',1,'2015-10-05 22:48:39',11,'User cc2 created','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(665,'2015-10-05 20:48:39','USER_NEW_PASSWORD',1,'2015-10-05 22:48:39',11,'Password change for cc2','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(666,'2015-10-05 20:48:59','USER_NEW_PASSWORD',1,'2015-10-05 22:48:59',11,'Password change for cc1','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(667,'2015-10-05 20:48:59','USER_MODIFY',1,'2015-10-05 22:48:59',11,'User cc1 modified','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(668,'2015-10-05 21:06:36','USER_LOGOUT',1,'2015-10-05 23:06:35',11,'(UserLogoff,zzeceo)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(669,'2015-10-05 21:06:44','USER_LOGIN_FAILED',1,'2015-10-05 23:06:44',NULL,'Bad value for login or password - login=cc1','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(670,'2015-10-05 21:07:12','USER_LOGIN_FAILED',1,'2015-10-05 23:07:12',NULL,'Bad value for login or password - login=cc1','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(671,'2015-10-05 21:07:19','USER_LOGIN_FAILED',1,'2015-10-05 23:07:19',NULL,'Bad value for login or password - login=admin','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(672,'2015-10-05 21:07:27','USER_LOGIN_FAILED',1,'2015-10-05 23:07:27',NULL,'Bad value for login or password - login=admin','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(673,'2015-10-05 21:07:32','USER_LOGIN',1,'2015-10-05 23:07:32',12,'(UserLogged,admin) - TZ=1;TZString=Europe/Berlin;Screen=1590x767','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(674,'2015-10-05 21:12:28','USER_NEW_PASSWORD',1,'2015-10-05 23:12:28',12,'Password change for cc1','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(675,'2015-10-05 21:12:28','USER_MODIFY',1,'2015-10-05 23:12:28',12,'User cc1 modified','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(676,'2015-10-05 21:13:00','USER_CREATE',1,'2015-10-05 23:13:00',12,'User aaa created','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(677,'2015-10-05 21:13:00','USER_NEW_PASSWORD',1,'2015-10-05 23:13:00',12,'Password change for aaa','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(678,'2015-10-05 21:13:40','USER_DELETE',1,'2015-10-05 23:13:40',12,'User aaa removed','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(679,'2015-10-05 21:14:47','USER_LOGOUT',1,'2015-10-05 23:14:47',12,'(UserLogoff,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(680,'2015-10-05 21:14:56','USER_LOGIN',1,'2015-10-05 23:14:56',16,'(UserLogged,cc1) - TZ=1;TZString=Europe/Berlin;Screen=1590x767','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(681,'2015-10-05 21:15:56','USER_LOGOUT',1,'2015-10-05 23:15:56',16,'(UserLogoff,cc1)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(682,'2015-10-05 21:16:06','USER_LOGIN',1,'2015-10-05 23:16:06',17,'(UserLogged,cc2) - TZ=1;TZString=Europe/Berlin;Screen=1590x767','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(683,'2015-10-05 21:37:25','USER_LOGOUT',1,'2015-10-05 23:37:25',17,'(UserLogoff,cc2)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(684,'2015-10-05 21:37:31','USER_LOGIN',1,'2015-10-05 23:37:31',16,'(UserLogged,cc1) - TZ=1;TZString=Europe/Berlin;Screen=1590x767','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(685,'2015-10-05 21:43:53','USER_LOGOUT',1,'2015-10-05 23:43:53',16,'(UserLogoff,cc1)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(686,'2015-10-05 21:44:00','USER_LOGIN',1,'2015-10-05 23:44:00',12,'(UserLogged,admin) - TZ=1;TZString=Europe/Berlin;Screen=1590x767','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(687,'2015-10-05 21:46:17','USER_LOGOUT',1,'2015-10-05 23:46:17',12,'(UserLogoff,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(688,'2015-10-05 21:46:24','USER_LOGIN',1,'2015-10-05 23:46:24',16,'(UserLogged,cc1) - TZ=1;TZString=Europe/Berlin;Screen=1590x767','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',NULL),(689,'2015-11-04 15:17:06','USER_LOGIN',1,'2015-11-04 16:17:06',12,'(UserLogged,admin) - TZ=1;TZString=Europe/Berlin;Screen=1600x790','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36',NULL),(690,'2015-11-15 22:04:04','USER_LOGIN',1,'2015-11-15 23:04:04',12,'(UserLogged,admin) - TZ=1;TZString=Europe/Berlin;Screen=1600x790','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36',NULL),(691,'2015-11-15 22:23:45','USER_MODIFY',1,'2015-11-15 23:23:45',12,'User ccommercy modified','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36',NULL),(692,'2015-11-15 22:24:22','USER_MODIFY',1,'2015-11-15 23:24:22',12,'User cc1 modified','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36',NULL),(693,'2015-11-15 22:24:53','USER_MODIFY',1,'2015-11-15 23:24:53',12,'User cc2 modified','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36',NULL),(694,'2015-11-15 22:25:17','USER_MODIFY',1,'2015-11-15 23:25:17',12,'User cc1 modified','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36',NULL),(695,'2015-11-15 22:45:37','USER_LOGOUT',1,'2015-11-15 23:45:37',12,'(UserLogoff,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36',NULL),(696,'2015-11-18 13:41:02','USER_LOGIN',1,'2015-11-18 14:41:02',2,'(UserLogged,demo) - TZ=1;TZString=Europe/Berlin;Screen=1600x790','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36',NULL),(697,'2015-11-18 14:23:35','USER_LOGIN',1,'2015-11-18 15:23:35',2,'(UserLogged,demo) - TZ=1;TZString=Europe/Berlin;Screen=1600x790','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36',NULL),(698,'2015-11-18 15:15:46','USER_LOGOUT',1,'2015-11-18 16:15:46',2,'(UserLogoff,demo)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36',NULL),(699,'2015-11-18 15:15:51','USER_LOGIN',1,'2015-11-18 16:15:51',2,'(UserLogged,demo) - TZ=1;TZString=Europe/Berlin;Screen=1600x790','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36',NULL),(700,'2015-11-30 17:52:08','USER_LOGIN',1,'2015-11-30 18:52:08',12,'(UserLogged,admin) - TZ=1;TZString=Europe/Berlin;Screen=1600x790','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36',NULL),(701,'2016-01-10 16:45:43','USER_LOGIN',1,'2016-01-10 17:45:43',2,'(UserLogged,demo) - TZ=1;TZString=Europe/Berlin;Screen=1600x790','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36',NULL),(702,'2016-01-10 16:45:52','USER_LOGOUT',1,'2016-01-10 17:45:52',2,'(UserLogoff,demo)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36',NULL),(703,'2016-01-10 16:46:06','USER_LOGIN',1,'2016-01-10 17:46:06',12,'(UserLogged,admin) - TZ=1;TZString=Europe/Berlin;Screen=1600x790','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36',NULL),(704,'2016-01-16 14:53:47','USER_LOGIN',1,'2016-01-16 15:53:47',12,'(UserLogged,admin) - TZ=1;TZString=Europe/Berlin;Screen=1600x790','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36',NULL),(705,'2016-01-16 15:04:29','USER_LOGOUT',1,'2016-01-16 16:04:29',12,'(UserLogoff,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36',NULL),(706,'2016-01-16 15:04:40','USER_LOGIN',1,'2016-01-16 16:04:40',12,'(UserLogged,admin) - TZ=1;TZString=Europe/Berlin;Screen=1600x790','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36',NULL),(707,'2016-01-22 09:33:26','USER_LOGIN',1,'2016-01-22 10:33:26',2,'(UserLogged,demo) - TZ=1;TZString=Europe/Berlin;Screen=1600x790','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36',NULL),(708,'2016-01-22 09:35:19','USER_LOGOUT',1,'2016-01-22 10:35:19',2,'(UserLogoff,demo)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36',NULL),(709,'2016-01-22 09:35:29','USER_LOGIN',1,'2016-01-22 10:35:29',12,'(UserLogged,admin) - TZ=1;TZString=Europe/Berlin;Screen=1600x790','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36',NULL),(710,'2016-01-22 10:47:34','USER_CREATE',1,'2016-01-22 11:47:34',12,'User aaa created','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36',NULL),(711,'2016-01-22 10:47:34','USER_NEW_PASSWORD',1,'2016-01-22 11:47:34',12,'Password change for aaa','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36',NULL),(712,'2016-01-22 12:07:56','USER_LOGIN',1,'2016-01-22 13:07:56',12,'(UserLogged,admin) - TZ=1;TZString=Europe/Berlin;Screen=1600x790','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36',NULL),(713,'2016-01-22 12:36:25','USER_NEW_PASSWORD',1,'2016-01-22 13:36:25',12,'Password change for admin','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36',NULL),(714,'2016-01-22 12:36:25','USER_MODIFY',1,'2016-01-22 13:36:25',12,'User admin modified','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36',NULL),(715,'2016-01-22 12:56:32','USER_MODIFY',1,'2016-01-22 13:56:32',12,'User admin modified','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36',NULL),(716,'2016-01-22 12:58:05','USER_MODIFY',1,'2016-01-22 13:58:05',12,'User admin modified','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36',NULL),(717,'2016-01-22 13:01:02','USER_MODIFY',1,'2016-01-22 14:01:02',12,'User admin modified','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36',NULL),(718,'2016-01-22 13:01:18','USER_MODIFY',1,'2016-01-22 14:01:18',12,'User admin modified','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36',NULL),(719,'2016-01-22 13:13:42','USER_MODIFY',1,'2016-01-22 14:13:42',12,'User admin modified','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36',NULL),(720,'2016-01-22 13:15:20','USER_DELETE',1,'2016-01-22 14:15:20',12,'User aaa removed','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36',NULL),(721,'2016-01-22 13:19:21','USER_LOGOUT',1,'2016-01-22 14:19:21',12,'(UserLogoff,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36',NULL),(722,'2016-01-22 13:19:32','USER_LOGIN',1,'2016-01-22 14:19:32',2,'(UserLogged,demo) - TZ=1;TZString=Europe/Berlin;Screen=1600x790','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36',NULL),(723,'2016-01-22 13:19:51','USER_LOGOUT',1,'2016-01-22 14:19:51',2,'(UserLogoff,demo)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36',NULL),(724,'2016-01-22 13:20:01','USER_LOGIN',1,'2016-01-22 14:20:01',12,'(UserLogged,admin) - TZ=1;TZString=Europe/Berlin;Screen=1600x790','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36',NULL),(725,'2016-01-22 13:28:22','USER_LOGOUT',1,'2016-01-22 14:28:22',12,'(UserLogoff,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36',NULL),(726,'2016-01-22 13:28:35','USER_LOGIN',1,'2016-01-22 14:28:35',2,'(UserLogged,demo) - TZ=1;TZString=Europe/Berlin;Screen=1600x790','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36',NULL),(727,'2016-01-22 13:33:54','USER_LOGOUT',1,'2016-01-22 14:33:54',2,'(UserLogoff,demo)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36',NULL),(728,'2016-01-22 13:34:05','USER_LOGIN',1,'2016-01-22 14:34:05',12,'(UserLogged,admin) - TZ=1;TZString=Europe/Berlin;Screen=1600x790','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36',NULL),(729,'2016-01-22 13:51:46','USER_MODIFY',1,'2016-01-22 14:51:46',12,'User ccommercy modified','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36',NULL),(730,'2016-01-22 16:20:12','USER_LOGIN',1,'2016-01-22 17:20:12',2,'(UserLogged,demo) - TZ=1;TZString=Europe/Berlin;Screen=1600x790','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.82 Safari/537.36',NULL),(731,'2016-01-22 16:20:22','USER_LOGOUT',1,'2016-01-22 17:20:22',2,'(UserLogoff,demo)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.82 Safari/537.36',NULL),(732,'2016-01-22 16:20:36','USER_LOGIN',1,'2016-01-22 17:20:36',12,'(UserLogged,admin) - TZ=1;TZString=Europe/Berlin;Screen=1600x790','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.82 Safari/537.36',NULL),(733,'2016-01-22 16:27:02','USER_CREATE',1,'2016-01-22 17:27:02',12,'User ldestailleur created','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.82 Safari/537.36',NULL),(734,'2016-01-22 16:27:02','USER_NEW_PASSWORD',1,'2016-01-22 17:27:02',12,'Password change for ldestailleur','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.82 Safari/537.36',NULL),(735,'2016-01-22 16:28:34','USER_MODIFY',1,'2016-01-22 17:28:34',12,'User ldestailleur modified','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.82 Safari/537.36',NULL),(736,'2016-01-22 16:30:01','USER_ENABLEDISABLE',1,'2016-01-22 17:30:01',12,'User cc2 activated','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.82 Safari/537.36',NULL),(737,'2016-01-22 17:11:06','USER_LOGIN',1,'2016-01-22 18:11:06',12,'(UserLogged,admin) - TZ=1;TZString=Europe/Berlin;Screen=1600x790','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.82 Safari/537.36',NULL),(738,'2016-01-22 18:00:02','USER_DELETE',1,'2016-01-22 19:00:02',12,'User zzz removed','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.82 Safari/537.36',NULL),(739,'2016-01-22 18:01:40','USER_DELETE',1,'2016-01-22 19:01:40',12,'User aaab removed','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.82 Safari/537.36',NULL),(740,'2016-01-22 18:01:52','USER_DELETE',1,'2016-01-22 19:01:52',12,'User zzzg removed','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.82 Safari/537.36',NULL),(741,'2016-03-13 10:54:59','USER_LOGIN',1,'2016-03-13 14:54:59',12,'(UserLogged,admin) - TZ=1;TZString=Europe/Paris;Screen=1920x971','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.87 Safari/537.36',NULL),(742,'2016-07-30 11:13:10','USER_LOGIN',1,'2016-07-30 15:13:10',12,'(UserLogged,admin) - TZ=1;TZString=Europe/Paris;Screen=1920x937','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36',NULL),(743,'2016-07-30 12:50:23','USER_CREATE',1,'2016-07-30 16:50:23',12,'User eldy created','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36',NULL),(744,'2016-07-30 12:50:23','USER_CREATE',1,'2016-07-30 16:50:23',12,'User eldy created','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36',NULL),(745,'2016-07-30 12:50:23','USER_NEW_PASSWORD',1,'2016-07-30 16:50:23',12,'Password change for eldy','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36',NULL),(746,'2016-07-30 12:50:38','USER_MODIFY',1,'2016-07-30 16:50:38',12,'User eldy modified','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36',NULL),(747,'2016-07-30 12:50:54','USER_DELETE',1,'2016-07-30 16:50:54',12,'User eldy removed','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36',NULL),(748,'2016-07-30 12:51:23','USER_NEW_PASSWORD',1,'2016-07-30 16:51:23',12,'Password change for ldestailleur','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36',NULL),(749,'2016-07-30 12:51:23','USER_MODIFY',1,'2016-07-30 16:51:23',12,'User ldestailleur modified','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36',NULL),(750,'2016-07-30 18:26:58','USER_LOGIN',1,'2016-07-30 22:26:58',18,'(UserLogged,ldestailleur) - TZ=1;TZString=Europe/Paris;Screen=1920x937','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36',NULL),(751,'2016-07-30 18:27:40','USER_LOGOUT',1,'2016-07-30 22:27:40',18,'(UserLogoff,ldestailleur)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36',NULL),(752,'2016-07-30 18:27:47','USER_LOGIN',1,'2016-07-30 22:27:47',12,'(UserLogged,admin) - TZ=1;TZString=Europe/Paris;Screen=1920x937','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36',NULL),(753,'2016-07-30 19:00:00','USER_LOGOUT',1,'2016-07-30 23:00:00',12,'(UserLogoff,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36',NULL),(754,'2016-07-30 19:00:04','USER_LOGIN',1,'2016-07-30 23:00:04',2,'(UserLogged,demo) - TZ=1;TZString=Europe/Paris;Screen=1920x937','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36',NULL),(755,'2016-07-30 19:00:14','USER_LOGOUT',1,'2016-07-30 23:00:14',2,'(UserLogoff,demo)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36',NULL),(756,'2016-07-30 19:00:19','USER_LOGIN',1,'2016-07-30 23:00:19',12,'(UserLogged,admin) - TZ=1;TZString=Europe/Paris;Screen=1920x937','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36',NULL),(757,'2016-07-30 19:00:43','USER_LOGOUT',1,'2016-07-30 23:00:43',12,'(UserLogoff,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36',NULL),(758,'2016-07-30 19:00:48','USER_LOGIN',1,'2016-07-30 23:00:48',2,'(UserLogged,demo) - TZ=1;TZString=Europe/Paris;Screen=1920x937','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36',NULL),(759,'2016-07-30 19:03:52','USER_LOGOUT',1,'2016-07-30 23:03:52',2,'(UserLogoff,demo)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36',NULL),(760,'2016-07-30 19:03:57','USER_LOGIN_FAILED',1,'2016-07-30 23:03:57',NULL,'Bad value for login or password - login=admin','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36',NULL),(761,'2016-07-30 19:03:59','USER_LOGIN',1,'2016-07-30 23:03:59',12,'(UserLogged,admin) - TZ=1;TZString=Europe/Paris;Screen=1920x937','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36',NULL),(762,'2016-07-30 19:04:13','USER_LOGOUT',1,'2016-07-30 23:04:13',12,'(UserLogoff,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36',NULL),(763,'2016-07-30 19:04:17','USER_LOGIN',1,'2016-07-30 23:04:17',2,'(UserLogged,demo) - TZ=1;TZString=Europe/Paris;Screen=1920x937','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36',NULL),(764,'2016-07-30 19:04:26','USER_LOGOUT',1,'2016-07-30 23:04:26',2,'(UserLogoff,demo)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36',NULL),(765,'2016-07-30 19:04:31','USER_LOGIN',1,'2016-07-30 23:04:31',12,'(UserLogged,admin) - TZ=1;TZString=Europe/Paris;Screen=1920x937','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36',NULL),(766,'2016-07-30 19:10:50','USER_LOGOUT',1,'2016-07-30 23:10:50',12,'(UserLogoff,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36',NULL),(767,'2016-07-30 19:10:54','USER_LOGIN',1,'2016-07-30 23:10:54',2,'(UserLogged,demo) - TZ=1;TZString=Europe/Paris;Screen=1920x937','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36',NULL),(768,'2016-07-31 10:15:52','USER_LOGIN',1,'2016-07-31 14:15:52',12,'(UserLogged,admin) - TZ=;TZString=;Screen=x','127.0.0.1','Lynx/2.8.8pre.4 libwww-FM/2.14 SSL-MM/1.4.1 GNUTLS/2.12.23',NULL),(769,'2016-07-31 10:16:27','USER_LOGIN',1,'2016-07-31 14:16:27',12,'(UserLogged,admin) - TZ=1;TZString=Europe/Paris;Screen=1920x937','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36',NULL),(770,'2016-07-31 10:32:14','USER_LOGIN',1,'2016-07-31 14:32:14',12,'(UserLogged,admin) - TZ=;TZString=;Screen=x','127.0.0.1','Lynx/2.8.8pre.4 libwww-FM/2.14 SSL-MM/1.4.1 GNUTLS/2.12.23',NULL),(771,'2016-07-31 10:36:28','USER_LOGIN',1,'2016-07-31 14:36:28',12,'(UserLogged,admin) - TZ=;TZString=;Screen=x','127.0.0.1','Links (2.8; Linux 3.19.0-46-generic x86_64; GNU C 4.8.2; text)',NULL),(772,'2016-07-31 10:40:10','USER_LOGIN',1,'2016-07-31 14:40:10',12,'(UserLogged,admin) - TZ=;TZString=;Screen=x','127.0.0.1','Links (2.8; Linux 3.19.0-46-generic x86_64; GNU C 4.8.2; text)',NULL),(773,'2016-07-31 10:54:16','USER_LOGIN',1,'2016-07-31 14:54:16',12,'(UserLogged,admin) - TZ=;TZString=;Screen=x','127.0.0.1','Lynx/2.8.8pre.4 libwww-FM/2.14 SSL-MM/1.4.1 GNUTLS/2.12.23',NULL),(774,'2016-07-31 12:52:52','USER_LOGIN',1,'2016-07-31 16:52:52',12,'(UserLogged,admin) - TZ=1;TZString=Europe/Paris;Screen=1920x592','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36',NULL),(775,'2016-07-31 13:25:33','USER_LOGOUT',1,'2016-07-31 17:25:33',12,'(UserLogoff,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36',NULL),(776,'2016-07-31 13:26:32','USER_LOGIN',1,'2016-07-31 17:26:32',12,'(UserLogged,admin) - TZ=1;TZString=Europe/Paris;Screen=1280x751','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36',NULL),(777,'2016-07-31 14:13:57','USER_LOGOUT',1,'2016-07-31 18:13:57',12,'(UserLogoff,admin)','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36',NULL),(778,'2016-07-31 14:14:04','USER_LOGIN',1,'2016-07-31 18:14:04',12,'(UserLogged,admin) - TZ=1;TZString=Europe/Paris;Screen=1920x937','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36',NULL),(779,'2016-07-31 16:04:35','USER_LOGIN',1,'2016-07-31 20:04:34',12,'(UserLogged,admin) - TZ=1;TZString=Europe/Paris;Screen=1920x937','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36',NULL),(780,'2016-07-31 21:14:14','USER_LOGIN',1,'2016-08-01 01:14:14',12,'(UserLogged,admin) - TZ=1;TZString=Europe/Paris;Screen=1920x937','127.0.0.1','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36',NULL); +/*!40000 ALTER TABLE `llx_events` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_expedition` +-- + +DROP TABLE IF EXISTS `llx_expedition`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_expedition` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `ref` varchar(30) NOT NULL, + `entity` int(11) NOT NULL DEFAULT '1', + `ref_customer` varchar(30) DEFAULT NULL, + `fk_soc` int(11) NOT NULL, + `ref_ext` varchar(30) DEFAULT NULL, + `ref_int` varchar(30) DEFAULT NULL, + `date_creation` datetime DEFAULT NULL, + `fk_user_author` int(11) DEFAULT NULL, + `date_valid` datetime DEFAULT NULL, + `fk_user_valid` int(11) DEFAULT NULL, + `date_expedition` datetime DEFAULT NULL, + `date_delivery` datetime DEFAULT NULL, + `fk_address` int(11) DEFAULT NULL, + `fk_shipping_method` int(11) DEFAULT NULL, + `tracking_number` varchar(50) DEFAULT NULL, + `fk_statut` smallint(6) DEFAULT '0', + `height` float DEFAULT NULL, + `height_unit` int(11) DEFAULT NULL, + `width` float DEFAULT NULL, + `size_units` int(11) DEFAULT NULL, + `size` float DEFAULT NULL, + `weight_units` int(11) DEFAULT NULL, + `weight` float DEFAULT NULL, + `note_private` text, + `note_public` text, + `model_pdf` varchar(255) DEFAULT NULL, + `fk_incoterms` int(11) DEFAULT NULL, + `location_incoterms` varchar(255) DEFAULT NULL, + `import_key` varchar(14) DEFAULT NULL, + `extraparams` varchar(255) DEFAULT NULL, + `billed` smallint(6) DEFAULT '0', + PRIMARY KEY (`rowid`), + UNIQUE KEY `idx_expedition_uk_ref` (`ref`,`entity`), + KEY `idx_expedition_fk_soc` (`fk_soc`), + KEY `idx_expedition_fk_user_author` (`fk_user_author`), + KEY `idx_expedition_fk_user_valid` (`fk_user_valid`), + KEY `idx_expedition_fk_shipping_method` (`fk_shipping_method`), + CONSTRAINT `fk_expedition_fk_shipping_method` FOREIGN KEY (`fk_shipping_method`) REFERENCES `llx_c_shipment_mode` (`rowid`), + CONSTRAINT `fk_expedition_fk_soc` FOREIGN KEY (`fk_soc`) REFERENCES `llx_societe` (`rowid`), + CONSTRAINT `fk_expedition_fk_user_author` FOREIGN KEY (`fk_user_author`) REFERENCES `llx_user` (`rowid`), + CONSTRAINT `fk_expedition_fk_user_valid` FOREIGN KEY (`fk_user_valid`) REFERENCES `llx_user` (`rowid`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_expedition` +-- + +LOCK TABLES `llx_expedition` WRITE; +/*!40000 ALTER TABLE `llx_expedition` DISABLE KEYS */; +INSERT INTO `llx_expedition` VALUES (1,'2016-01-22 17:33:03','SH1302-0001',1,NULL,1,NULL,NULL,'2011-08-08 03:05:34',1,'2013-02-17 18:22:51',1,NULL,'2011-08-09 00:00:00',NULL,NULL,'',1,NULL,NULL,NULL,0,NULL,0,NULL,NULL,NULL,'merou',NULL,NULL,NULL,NULL,0); +/*!40000 ALTER TABLE `llx_expedition` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_expedition_extrafields` +-- + +DROP TABLE IF EXISTS `llx_expedition_extrafields`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_expedition_extrafields` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `fk_object` int(11) NOT NULL, + `import_key` varchar(14) DEFAULT NULL, + PRIMARY KEY (`rowid`), + KEY `idx_expedition_extrafields` (`fk_object`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_expedition_extrafields` +-- + +LOCK TABLES `llx_expedition_extrafields` WRITE; +/*!40000 ALTER TABLE `llx_expedition_extrafields` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_expedition_extrafields` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_expedition_methode` +-- + +DROP TABLE IF EXISTS `llx_expedition_methode`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_expedition_methode` ( + `rowid` int(11) NOT NULL, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `code` varchar(30) NOT NULL, + `libelle` varchar(50) NOT NULL, + `description` text, + `active` tinyint(4) DEFAULT '0', + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_expedition_methode` +-- + +LOCK TABLES `llx_expedition_methode` WRITE; +/*!40000 ALTER TABLE `llx_expedition_methode` DISABLE KEYS */; +INSERT INTO `llx_expedition_methode` VALUES (1,'2010-07-08 11:18:00','CATCH','Catch','Catch by client',1),(2,'2010-07-08 11:18:00','TRANS','Transporter','Generic transporter',1),(3,'2010-07-08 11:18:01','COLSUI','Colissimo Suivi','Colissimo Suivi',0); +/*!40000 ALTER TABLE `llx_expedition_methode` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_expeditiondet` +-- + +DROP TABLE IF EXISTS `llx_expeditiondet`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_expeditiondet` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `fk_expedition` int(11) NOT NULL, + `fk_origin_line` int(11) DEFAULT NULL, + `fk_entrepot` int(11) DEFAULT NULL, + `qty` double DEFAULT NULL, + `rang` int(11) DEFAULT '0', + PRIMARY KEY (`rowid`), + KEY `idx_expeditiondet_fk_expedition` (`fk_expedition`), + CONSTRAINT `fk_expeditiondet_fk_expedition` FOREIGN KEY (`fk_expedition`) REFERENCES `llx_expedition` (`rowid`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_expeditiondet` +-- + +LOCK TABLES `llx_expeditiondet` WRITE; +/*!40000 ALTER TABLE `llx_expeditiondet` DISABLE KEYS */; +INSERT INTO `llx_expeditiondet` VALUES (1,1,10,3,1,0); +/*!40000 ALTER TABLE `llx_expeditiondet` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_expeditiondet_batch` +-- + +DROP TABLE IF EXISTS `llx_expeditiondet_batch`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_expeditiondet_batch` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `fk_expeditiondet` int(11) NOT NULL, + `eatby` date DEFAULT NULL, + `sellby` date DEFAULT NULL, + `batch` varchar(30) DEFAULT NULL, + `qty` double NOT NULL DEFAULT '0', + `fk_origin_stock` int(11) NOT NULL, + PRIMARY KEY (`rowid`), + KEY `idx_fk_expeditiondet` (`fk_expeditiondet`), + CONSTRAINT `fk_expeditiondet_batch_fk_expeditiondet` FOREIGN KEY (`fk_expeditiondet`) REFERENCES `llx_expeditiondet` (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_expeditiondet_batch` +-- + +LOCK TABLES `llx_expeditiondet_batch` WRITE; +/*!40000 ALTER TABLE `llx_expeditiondet_batch` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_expeditiondet_batch` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_expeditiondet_extrafields` +-- + +DROP TABLE IF EXISTS `llx_expeditiondet_extrafields`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_expeditiondet_extrafields` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `fk_object` int(11) NOT NULL, + `import_key` varchar(14) DEFAULT NULL, + PRIMARY KEY (`rowid`), + KEY `idx_expeditiondet_extrafields` (`fk_object`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_expeditiondet_extrafields` +-- + +LOCK TABLES `llx_expeditiondet_extrafields` WRITE; +/*!40000 ALTER TABLE `llx_expeditiondet_extrafields` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_expeditiondet_extrafields` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_expensereport` +-- + +DROP TABLE IF EXISTS `llx_expensereport`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_expensereport` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `ref` varchar(50) NOT NULL, + `entity` int(11) NOT NULL DEFAULT '1', + `ref_number_int` int(11) DEFAULT NULL, + `ref_ext` int(11) DEFAULT NULL, + `total_ht` double(24,8) DEFAULT '0.00000000', + `total_tva` double(24,8) DEFAULT '0.00000000', + `localtax1` double(24,8) DEFAULT '0.00000000', + `localtax2` double(24,8) DEFAULT '0.00000000', + `total_ttc` double(24,8) DEFAULT '0.00000000', + `date_debut` date NOT NULL, + `date_fin` date NOT NULL, + `date_create` datetime NOT NULL, + `date_valid` datetime DEFAULT NULL, + `date_approve` datetime DEFAULT NULL, + `date_refuse` datetime DEFAULT NULL, + `date_cancel` datetime DEFAULT NULL, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `fk_user_author` int(11) NOT NULL, + `fk_user_modif` int(11) DEFAULT NULL, + `fk_user_valid` int(11) DEFAULT NULL, + `fk_user_validator` int(11) DEFAULT NULL, + `fk_user_approve` int(11) DEFAULT NULL, + `fk_user_refuse` int(11) DEFAULT NULL, + `fk_user_cancel` int(11) DEFAULT NULL, + `fk_statut` int(11) NOT NULL, + `fk_c_paiement` int(11) DEFAULT NULL, + `paid` smallint(6) NOT NULL DEFAULT '0', + `note_public` text, + `note_private` text, + `detail_refuse` varchar(255) DEFAULT NULL, + `detail_cancel` varchar(255) DEFAULT NULL, + `integration_compta` int(11) DEFAULT NULL, + `fk_bank_account` int(11) DEFAULT NULL, + `model_pdf` varchar(50) DEFAULT NULL, + `fk_multicurrency` int(11) DEFAULT NULL, + `multicurrency_code` varchar(255) DEFAULT NULL, + `multicurrency_tx` double(24,8) DEFAULT '1.00000000', + `multicurrency_total_ht` double(24,8) DEFAULT '0.00000000', + `multicurrency_total_tva` double(24,8) DEFAULT '0.00000000', + `multicurrency_total_ttc` double(24,8) DEFAULT '0.00000000', + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_expensereport` +-- + +LOCK TABLES `llx_expensereport` WRITE; +/*!40000 ALTER TABLE `llx_expensereport` DISABLE KEYS */; +INSERT INTO `llx_expensereport` VALUES (1,'ADMIN-ER00002-150101',1,2,NULL,8.33000000,1.67000000,0.00000000,0.00000000,10.00000000,'2015-01-01','2015-01-03','2016-01-22 19:03:37','2016-01-22 19:06:50',NULL,NULL,NULL,'2016-01-22 18:06:50',12,NULL,12,12,NULL,NULL,NULL,2,NULL,0,'Holidays',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1.00000000,0.00000000,0.00000000,0.00000000),(2,'(PROV2)',1,NULL,NULL,141.67000000,28.33000000,0.00000000,0.00000000,170.00000000,'2015-02-01','2015-02-28','2016-01-22 19:04:44',NULL,NULL,NULL,NULL,'2016-01-22 18:06:21',12,12,NULL,12,NULL,NULL,NULL,0,NULL,0,'Work on projet X','','',NULL,NULL,NULL,NULL,NULL,NULL,1.00000000,0.00000000,0.00000000,0.00000000); +/*!40000 ALTER TABLE `llx_expensereport` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_expensereport_det` +-- + +DROP TABLE IF EXISTS `llx_expensereport_det`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_expensereport_det` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `fk_expensereport` int(11) NOT NULL, + `fk_c_type_fees` int(11) NOT NULL, + `fk_projet` int(11) DEFAULT NULL, + `comments` text NOT NULL, + `product_type` int(11) DEFAULT '-1', + `qty` double NOT NULL, + `value_unit` double NOT NULL, + `remise_percent` double DEFAULT NULL, + `tva_tx` double(6,3) DEFAULT NULL, + `localtax1_tx` double(6,3) DEFAULT '0.000', + `localtax1_type` varchar(10) DEFAULT NULL, + `localtax2_tx` double(6,3) DEFAULT '0.000', + `localtax2_type` varchar(10) DEFAULT NULL, + `total_ht` double(24,8) NOT NULL DEFAULT '0.00000000', + `total_tva` double(24,8) NOT NULL DEFAULT '0.00000000', + `total_localtax1` double(24,8) DEFAULT '0.00000000', + `total_localtax2` double(24,8) DEFAULT '0.00000000', + `total_ttc` double(24,8) NOT NULL DEFAULT '0.00000000', + `date` date NOT NULL, + `info_bits` int(11) DEFAULT '0', + `special_code` int(11) DEFAULT '0', + `rang` int(11) DEFAULT '0', + `import_key` varchar(14) DEFAULT NULL, + `fk_multicurrency` int(11) DEFAULT NULL, + `multicurrency_code` varchar(255) DEFAULT NULL, + `multicurrency_subprice` double(24,8) DEFAULT '0.00000000', + `multicurrency_total_ht` double(24,8) DEFAULT '0.00000000', + `multicurrency_total_tva` double(24,8) DEFAULT '0.00000000', + `multicurrency_total_ttc` double(24,8) DEFAULT '0.00000000', + `fk_facture` int(11) DEFAULT '0', + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_expensereport_det` +-- + +LOCK TABLES `llx_expensereport_det` WRITE; +/*!40000 ALTER TABLE `llx_expensereport_det` DISABLE KEYS */; +INSERT INTO `llx_expensereport_det` VALUES (1,1,3,1,'',-1,1,10,NULL,20.000,0.000,NULL,0.000,NULL,8.33000000,1.67000000,0.00000000,0.00000000,10.00000000,'2015-01-01',0,0,0,NULL,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000,0),(2,2,3,4,'',-1,1,20,NULL,20.000,0.000,NULL,0.000,NULL,16.67000000,3.33000000,0.00000000,0.00000000,20.00000000,'2015-01-07',0,0,0,NULL,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000,0),(3,2,2,5,'Train',-1,1,150,NULL,20.000,0.000,NULL,0.000,NULL,125.00000000,25.00000000,0.00000000,0.00000000,150.00000000,'2015-02-05',0,0,0,NULL,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000,0); +/*!40000 ALTER TABLE `llx_expensereport_det` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_export_compta` +-- + +DROP TABLE IF EXISTS `llx_export_compta`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_export_compta` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `ref` varchar(12) NOT NULL, + `date_export` datetime NOT NULL, + `fk_user` int(11) NOT NULL, + `note` text, + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_export_compta` +-- + +LOCK TABLES `llx_export_compta` WRITE; +/*!40000 ALTER TABLE `llx_export_compta` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_export_compta` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_export_model` +-- + +DROP TABLE IF EXISTS `llx_export_model`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_export_model` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `fk_user` int(11) NOT NULL DEFAULT '0', + `label` varchar(50) NOT NULL, + `type` varchar(20) NOT NULL, + `field` text NOT NULL, + `filter` text, + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_export_model` (`label`,`type`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_export_model` +-- + +LOCK TABLES `llx_export_model` WRITE; +/*!40000 ALTER TABLE `llx_export_model` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_export_model` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_extrafields` +-- + +DROP TABLE IF EXISTS `llx_extrafields`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_extrafields` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `elementtype` varchar(64) NOT NULL DEFAULT 'member', + `name` varchar(64) NOT NULL, + `entity` int(11) NOT NULL DEFAULT '1', + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `label` varchar(255) NOT NULL, + `type` varchar(8) DEFAULT NULL, + `size` varchar(8) DEFAULT NULL, + `pos` int(11) DEFAULT '0', + `alwayseditable` int(11) DEFAULT '0', + `param` text, + `fieldunique` int(11) DEFAULT '0', + `fieldrequired` int(11) DEFAULT '0', + `perms` varchar(255) DEFAULT NULL, + `list` int(11) DEFAULT '0', + `ishidden` int(11) DEFAULT '0', + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_extrafields_name` (`name`,`entity`,`elementtype`) +) ENGINE=InnoDB AUTO_INCREMENT=28 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_extrafields` +-- + +LOCK TABLES `llx_extrafields` WRITE; +/*!40000 ALTER TABLE `llx_extrafields` DISABLE KEYS */; +INSERT INTO `llx_extrafields` VALUES (2,'adherent','zzz',1,'2013-09-08 23:04:20','zzz','varchar','255',0,0,NULL,0,0,NULL,0,0),(23,'societe','anotheraddedfield',1,'2015-10-03 09:36:35','Another added field','varchar','15',0,1,'a:1:{s:7:\"options\";a:1:{s:0:\"\";N;}}',0,0,NULL,0,0),(27,'projet','priority',1,'2016-07-30 11:28:27','Priority','select','',0,1,'a:1:{s:7:\"options\";a:5:{i:1;s:1:\"1\";i:2;s:1:\"2\";i:3;s:1:\"3\";i:4;s:1:\"4\";i:5;s:1:\"5\";}}',0,0,NULL,0,0); +/*!40000 ALTER TABLE `llx_extrafields` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_facture` +-- + +DROP TABLE IF EXISTS `llx_facture`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_facture` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `facnumber` varchar(30) NOT NULL, + `entity` int(11) NOT NULL DEFAULT '1', + `ref_ext` varchar(255) DEFAULT NULL, + `ref_int` varchar(255) DEFAULT NULL, + `type` smallint(6) NOT NULL DEFAULT '0', + `ref_client` varchar(255) DEFAULT NULL, + `increment` varchar(10) DEFAULT NULL, + `fk_soc` int(11) NOT NULL, + `datec` datetime DEFAULT NULL, + `datef` date DEFAULT NULL, + `date_valid` date DEFAULT NULL, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `paye` smallint(6) NOT NULL DEFAULT '0', + `amount` double(24,8) NOT NULL DEFAULT '0.00000000', + `remise_percent` double DEFAULT '0', + `remise_absolue` double DEFAULT '0', + `remise` double DEFAULT '0', + `close_code` varchar(16) DEFAULT NULL, + `close_note` varchar(128) DEFAULT NULL, + `tva` double(24,8) DEFAULT '0.00000000', + `localtax1` double(24,8) DEFAULT '0.00000000', + `localtax2` double(24,8) DEFAULT '0.00000000', + `revenuestamp` double(24,8) DEFAULT '0.00000000', + `total` double(24,8) DEFAULT '0.00000000', + `total_ttc` double(24,8) DEFAULT '0.00000000', + `fk_statut` smallint(6) NOT NULL DEFAULT '0', + `fk_user_author` int(11) DEFAULT NULL, + `fk_user_modif` int(11) DEFAULT NULL, + `fk_user_valid` int(11) DEFAULT NULL, + `fk_facture_source` int(11) DEFAULT NULL, + `fk_projet` int(11) DEFAULT NULL, + `fk_account` int(11) DEFAULT NULL, + `fk_currency` varchar(3) DEFAULT NULL, + `fk_cond_reglement` int(11) NOT NULL DEFAULT '1', + `fk_mode_reglement` int(11) DEFAULT NULL, + `date_lim_reglement` date DEFAULT NULL, + `note_private` text, + `note_public` text, + `model_pdf` varchar(255) DEFAULT NULL, + `import_key` varchar(14) DEFAULT NULL, + `extraparams` varchar(255) DEFAULT NULL, + `situation_cycle_ref` smallint(6) DEFAULT NULL, + `situation_counter` smallint(6) DEFAULT NULL, + `situation_final` smallint(6) DEFAULT NULL, + `fk_incoterms` int(11) DEFAULT NULL, + `location_incoterms` varchar(255) DEFAULT NULL, + `date_pointoftax` date DEFAULT NULL, + `fk_multicurrency` int(11) DEFAULT NULL, + `multicurrency_code` varchar(255) DEFAULT NULL, + `multicurrency_tx` double(24,8) DEFAULT '1.00000000', + `multicurrency_total_ht` double(24,8) DEFAULT '0.00000000', + `multicurrency_total_tva` double(24,8) DEFAULT '0.00000000', + `multicurrency_total_ttc` double(24,8) DEFAULT '0.00000000', + PRIMARY KEY (`rowid`), + UNIQUE KEY `idx_facture_uk_facnumber` (`facnumber`,`entity`), + KEY `idx_facture_fk_soc` (`fk_soc`), + KEY `idx_facture_fk_user_author` (`fk_user_author`), + KEY `idx_facture_fk_user_valid` (`fk_user_valid`), + KEY `idx_facture_fk_facture_source` (`fk_facture_source`), + KEY `idx_facture_fk_projet` (`fk_projet`), + KEY `idx_facture_fk_account` (`fk_account`), + KEY `idx_facture_fk_currency` (`fk_currency`), + KEY `idx_facture_fk_statut` (`fk_statut`), + CONSTRAINT `fk_facture_fk_facture_source` FOREIGN KEY (`fk_facture_source`) REFERENCES `llx_facture` (`rowid`), + CONSTRAINT `fk_facture_fk_projet` FOREIGN KEY (`fk_projet`) REFERENCES `llx_projet` (`rowid`), + CONSTRAINT `fk_facture_fk_soc` FOREIGN KEY (`fk_soc`) REFERENCES `llx_societe` (`rowid`), + CONSTRAINT `fk_facture_fk_user_author` FOREIGN KEY (`fk_user_author`) REFERENCES `llx_user` (`rowid`), + CONSTRAINT `fk_facture_fk_user_valid` FOREIGN KEY (`fk_user_valid`) REFERENCES `llx_user` (`rowid`) +) ENGINE=InnoDB AUTO_INCREMENT=214 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_facture` +-- + +LOCK TABLES `llx_facture` WRITE; +/*!40000 ALTER TABLE `llx_facture` DISABLE KEYS */; +INSERT INTO `llx_facture` VALUES (2,'FA1007-0002',1,NULL,NULL,0,NULL,NULL,2,'2010-07-10 18:20:13','2016-07-10',NULL,'2016-07-30 15:13:20',1,10.00000000,NULL,NULL,0,NULL,NULL,0.10000000,0.00000000,0.00000000,0.00000000,46.00000000,46.10000000,2,1,NULL,1,NULL,NULL,NULL,NULL,1,0,'2016-07-10',NULL,NULL,'crabe',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1.00000000,0.00000000,0.00000000,0.00000000),(3,'FA1107-0006',1,NULL,NULL,0,NULL,NULL,10,'2011-07-18 20:33:35','2016-07-18',NULL,'2016-07-30 15:13:20',1,0.00000000,NULL,NULL,0,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000,15.00000000,15.00000000,2,1,NULL,1,NULL,1,NULL,NULL,1,0,'2016-07-18',NULL,NULL,'crabe',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1.00000000,0.00000000,0.00000000,0.00000000),(5,'FA1108-0003',1,NULL,NULL,0,NULL,NULL,7,'2011-08-01 03:34:11','2015-08-01',NULL,'2016-07-30 15:12:32',1,0.00000000,NULL,NULL,0,NULL,NULL,0.63000000,0.00000000,0.00000000,0.00000000,5.00000000,5.63000000,2,1,NULL,1,NULL,NULL,NULL,NULL,0,6,'2015-08-01',NULL,NULL,'crabe',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1.00000000,0.00000000,0.00000000,0.00000000),(6,'FA1108-0004',1,NULL,NULL,0,NULL,NULL,7,'2011-08-06 20:33:53','2015-08-06',NULL,'2016-07-30 15:12:32',1,0.00000000,NULL,NULL,0,NULL,NULL,0.98000000,0.00000000,0.00000000,0.00000000,5.00000000,5.98000000,2,1,NULL,1,NULL,NULL,NULL,NULL,0,4,'2015-08-06','Cash\nReceived : 6 EUR\nRendu : 0.02 EUR\n\n--------------------------------------',NULL,'crabe',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1.00000000,0.00000000,0.00000000,0.00000000),(8,'FA1108-0005',1,NULL,NULL,3,NULL,NULL,2,'2011-08-08 02:41:44','2015-08-08',NULL,'2016-07-30 15:12:32',1,0.00000000,NULL,NULL,0,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000,10.00000000,10.00000000,2,1,NULL,1,NULL,NULL,NULL,NULL,1,0,'2015-08-08',NULL,NULL,'crabe',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1.00000000,0.00000000,0.00000000,0.00000000),(9,'FA1108-0007',1,NULL,NULL,3,NULL,NULL,10,'2011-08-08 02:55:14','2015-08-08',NULL,'2016-07-30 15:12:32',0,0.00000000,NULL,NULL,0,NULL,NULL,1.96000000,0.00000000,0.00000000,0.00000000,10.00000000,11.96000000,1,1,NULL,1,NULL,NULL,NULL,NULL,1,0,'2015-08-08',NULL,NULL,'crabe',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1.00000000,0.00000000,0.00000000,0.00000000),(10,'AV1212-0001',1,NULL,NULL,2,NULL,NULL,10,'2012-12-08 17:45:20','2015-12-08','2015-12-08','2016-07-30 15:12:32',0,0.00000000,NULL,NULL,0,NULL,NULL,-0.63000000,0.00000000,0.00000000,0.00000000,-11.00000000,-11.63000000,1,1,NULL,1,3,NULL,NULL,NULL,0,0,'2015-12-08',NULL,NULL,'crabe',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1.00000000,0.00000000,0.00000000,0.00000000),(12,'AV1212-0002',1,NULL,NULL,2,NULL,NULL,10,'2012-12-08 18:20:14','2015-12-08','2015-12-08','2016-07-30 15:12:32',1,0.00000000,NULL,NULL,0,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000,-5.00000000,-5.00000000,2,1,NULL,1,3,NULL,NULL,NULL,0,0,'2015-12-08',NULL,NULL,'crabe',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1.00000000,0.00000000,0.00000000,0.00000000),(13,'FA1212-0011',1,NULL,NULL,0,NULL,NULL,7,'2012-12-09 20:04:19','2015-12-09','2016-02-12','2016-07-30 15:12:32',0,0.00000000,NULL,NULL,0,NULL,NULL,2.74000000,0.00000000,0.00000000,0.00000000,14.00000000,16.74000000,1,1,NULL,1,NULL,NULL,NULL,NULL,1,0,'2015-12-09',NULL,NULL,'crabe',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1.00000000,0.00000000,0.00000000,0.00000000),(32,'FA1212-0021',1,NULL,NULL,0,NULL,NULL,1,'2012-12-11 09:34:23','2015-12-11','2016-03-24','2016-07-30 15:12:32',0,0.00000000,NULL,NULL,0,NULL,NULL,90.00000000,0.00000000,0.00000000,0.60000000,520.00000000,610.60000000,1,1,NULL,1,NULL,NULL,NULL,NULL,1,0,'2015-12-11','This is a comment (private)','This is a comment (public)','crabe',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1.00000000,0.00000000,0.00000000,0.00000000),(33,'FA1212-0023',1,NULL,NULL,0,NULL,NULL,1,'2012-12-11 09:34:23','2015-12-11','2017-03-03','2016-07-30 15:12:32',0,0.00000000,NULL,NULL,0,'abandon',NULL,0.24000000,0.00000000,0.00000000,0.00000000,2.48000000,2.72000000,3,1,NULL,1,NULL,NULL,NULL,NULL,1,0,'2015-12-11','This is a comment (private)','This is a comment (public)','crabe',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1.00000000,0.00000000,0.00000000,0.00000000),(55,'FA1212-0009',1,NULL,NULL,0,NULL,NULL,1,'2012-12-11 09:35:51','2015-12-11','2015-12-12','2016-07-30 15:12:32',0,0.00000000,NULL,NULL,0,NULL,NULL,0.24000000,0.00000000,0.00000000,0.00000000,2.48000000,2.72000000,1,1,NULL,1,NULL,NULL,NULL,NULL,1,0,'2015-12-11','This is a comment (private)','This is a comment (public)','generic_invoice_odt:/home/ldestailleur/git/dolibarr_3.8/documents/doctemplates/invoices/template_invoice.odt',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1.00000000,0.00000000,0.00000000,0.00000000),(148,'FS1301-0001',1,NULL,NULL,0,NULL,NULL,1,'2013-01-19 18:22:48','2016-01-19','2016-01-19','2016-07-30 15:13:20',0,0.00000000,NULL,NULL,0,NULL,NULL,0.63000000,0.00000000,0.00000000,0.00000000,5.00000000,5.63000000,1,1,NULL,1,NULL,NULL,NULL,NULL,0,1,'2016-01-19',NULL,NULL,'',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1.00000000,0.00000000,0.00000000,0.00000000),(149,'(PROV149)',1,NULL,NULL,0,NULL,NULL,1,'2013-01-19 18:30:05','2016-01-19',NULL,'2016-07-30 15:13:20',0,0.00000000,NULL,NULL,0,NULL,NULL,1.96000000,0.00000000,0.00000000,0.00000000,10.00000000,11.96000000,0,1,NULL,NULL,NULL,NULL,NULL,NULL,0,0,'2016-01-19',NULL,NULL,'crabe',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1.00000000,0.00000000,0.00000000,0.00000000),(150,'FA6801-0010',1,NULL,NULL,0,NULL,NULL,1,'2013-01-19 18:31:10','2016-01-19','2016-01-19','2016-07-30 15:13:20',1,0.00000000,NULL,NULL,0,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000,0.00000000,0.00000000,2,1,NULL,1,NULL,NULL,NULL,NULL,0,1,'2016-01-19',NULL,NULL,'',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1.00000000,0.00000000,0.00000000,0.00000000),(151,'FS1301-0002',1,NULL,NULL,0,NULL,NULL,1,'2013-01-19 18:31:58','2016-01-19','2016-01-19','2016-07-30 15:13:20',1,0.00000000,NULL,NULL,0,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000,0.00000000,0.00000000,2,1,NULL,1,NULL,NULL,NULL,NULL,0,1,'2016-01-19',NULL,NULL,'',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1.00000000,0.00000000,0.00000000,0.00000000),(160,'FA1507-0015',1,NULL,NULL,0,NULL,NULL,12,'2013-03-06 16:47:48','2016-07-18','2014-03-06','2016-07-30 15:13:20',0,0.00000000,NULL,NULL,0,NULL,NULL,1.11000000,0.00000000,0.00000000,0.00000000,8.89000000,10.00000000,1,1,NULL,1,NULL,NULL,NULL,NULL,1,0,'2016-07-18',NULL,NULL,'crabe',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1.00000000,0.00000000,0.00000000,0.00000000),(210,'FA1107-0019',1,NULL,NULL,0,NULL,NULL,10,'2013-03-20 14:30:11','2016-07-10','2018-03-20','2016-07-30 15:13:20',0,0.00000000,NULL,NULL,0,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000,10.00000000,10.00000000,1,1,NULL,1,NULL,NULL,NULL,NULL,1,0,'2016-07-10',NULL,NULL,'generic_invoice_odt:/home/ldestailleur/git/dolibarr_3.8/documents/doctemplates/invoices/template_invoice.odt',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1.00000000,0.00000000,0.00000000,0.00000000),(211,'FA1303-0020',1,NULL,NULL,0,NULL,NULL,19,'2013-03-22 09:40:10','2016-03-22','2017-03-02','2016-07-30 15:13:20',0,0.00000000,NULL,NULL,0,NULL,NULL,17.64000000,0.00000000,0.00000000,0.40000000,340.00000000,358.04000000,1,1,NULL,1,NULL,NULL,NULL,NULL,1,0,'2016-03-22',NULL,NULL,'crabe',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1.00000000,0.00000000,0.00000000,0.00000000),(213,'AV1303-0003',1,NULL,NULL,2,NULL,NULL,1,'2014-03-03 19:22:03','2016-03-03','2017-03-03','2016-07-30 15:13:20',0,0.00000000,NULL,NULL,0,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000,-1000.00000000,-1000.00000000,1,1,NULL,1,32,NULL,NULL,NULL,0,0,'2016-03-03',NULL,NULL,'crabe',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1.00000000,0.00000000,0.00000000,0.00000000); +/*!40000 ALTER TABLE `llx_facture` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_facture_extrafields` +-- + +DROP TABLE IF EXISTS `llx_facture_extrafields`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_facture_extrafields` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `fk_object` int(11) NOT NULL, + `import_key` varchar(14) DEFAULT NULL, + PRIMARY KEY (`rowid`), + KEY `idx_facture_extrafields` (`fk_object`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_facture_extrafields` +-- + +LOCK TABLES `llx_facture_extrafields` WRITE; +/*!40000 ALTER TABLE `llx_facture_extrafields` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_facture_extrafields` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_facture_fourn` +-- + +DROP TABLE IF EXISTS `llx_facture_fourn`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_facture_fourn` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `ref` varchar(255) NOT NULL, + `ref_supplier` varchar(255) DEFAULT NULL, + `entity` int(11) NOT NULL DEFAULT '1', + `ref_ext` varchar(255) DEFAULT NULL, + `type` smallint(6) NOT NULL DEFAULT '0', + `fk_soc` int(11) NOT NULL, + `datec` datetime DEFAULT NULL, + `datef` date DEFAULT NULL, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `libelle` varchar(255) DEFAULT NULL, + `paye` smallint(6) NOT NULL DEFAULT '0', + `amount` double(24,8) NOT NULL DEFAULT '0.00000000', + `remise` double(24,8) DEFAULT '0.00000000', + `close_code` varchar(16) DEFAULT NULL, + `close_note` varchar(128) DEFAULT NULL, + `tva` double(24,8) DEFAULT '0.00000000', + `localtax1` double(24,8) DEFAULT '0.00000000', + `localtax2` double(24,8) DEFAULT '0.00000000', + `total` double(24,8) DEFAULT '0.00000000', + `total_ht` double(24,8) DEFAULT '0.00000000', + `total_tva` double(24,8) DEFAULT '0.00000000', + `total_ttc` double(24,8) DEFAULT '0.00000000', + `fk_statut` smallint(6) NOT NULL DEFAULT '0', + `fk_user_author` int(11) DEFAULT NULL, + `fk_user_modif` int(11) DEFAULT NULL, + `fk_user_valid` int(11) DEFAULT NULL, + `fk_facture_source` int(11) DEFAULT NULL, + `fk_projet` int(11) DEFAULT NULL, + `fk_account` int(11) DEFAULT NULL, + `fk_cond_reglement` int(11) DEFAULT NULL, + `fk_mode_reglement` int(11) DEFAULT NULL, + `date_lim_reglement` date DEFAULT NULL, + `note_private` text, + `note_public` text, + `model_pdf` varchar(255) DEFAULT NULL, + `import_key` varchar(14) DEFAULT NULL, + `extraparams` varchar(255) DEFAULT NULL, + `fk_incoterms` int(11) DEFAULT NULL, + `location_incoterms` varchar(255) DEFAULT NULL, + `fk_multicurrency` int(11) DEFAULT NULL, + `multicurrency_code` varchar(255) DEFAULT NULL, + `multicurrency_tx` double(24,8) DEFAULT '1.00000000', + `multicurrency_total_ht` double(24,8) DEFAULT '0.00000000', + `multicurrency_total_tva` double(24,8) DEFAULT '0.00000000', + `multicurrency_total_ttc` double(24,8) DEFAULT '0.00000000', + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_facture_fourn_ref` (`ref`,`entity`), + UNIQUE KEY `uk_facture_fourn_ref_supplier` (`ref_supplier`,`fk_soc`,`entity`), + KEY `idx_facture_fourn_date_lim_reglement` (`date_lim_reglement`), + KEY `idx_facture_fourn_fk_soc` (`fk_soc`), + KEY `idx_facture_fourn_fk_user_author` (`fk_user_author`), + KEY `idx_facture_fourn_fk_user_valid` (`fk_user_valid`), + KEY `idx_facture_fourn_fk_projet` (`fk_projet`), + CONSTRAINT `fk_facture_fourn_fk_projet` FOREIGN KEY (`fk_projet`) REFERENCES `llx_projet` (`rowid`), + CONSTRAINT `fk_facture_fourn_fk_soc` FOREIGN KEY (`fk_soc`) REFERENCES `llx_societe` (`rowid`), + CONSTRAINT `fk_facture_fourn_fk_user_author` FOREIGN KEY (`fk_user_author`) REFERENCES `llx_user` (`rowid`), + CONSTRAINT `fk_facture_fourn_fk_user_valid` FOREIGN KEY (`fk_user_valid`) REFERENCES `llx_user` (`rowid`) +) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_facture_fourn` +-- + +LOCK TABLES `llx_facture_fourn` WRITE; +/*!40000 ALTER TABLE `llx_facture_fourn` DISABLE KEYS */; +INSERT INTO `llx_facture_fourn` VALUES (16,'16','FR70813',1,NULL,0,1,'2012-12-19 15:24:11','2003-04-11','2016-01-22 17:54:46','OVH FR70813',0,0.00000000,0.00000000,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000,829.00000000,162.48000000,991.48000000,1,1,NULL,12,NULL,NULL,NULL,1,NULL,'2003-04-11','','',NULL,NULL,NULL,NULL,NULL,NULL,NULL,1.00000000,0.00000000,0.00000000,0.00000000),(17,'17','FR81385',1,NULL,0,1,'2013-02-13 17:19:35','2003-06-04','2016-01-22 17:56:56','OVH FR81385',0,0.00000000,0.00000000,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000,26.00000000,5.10000000,31.10000000,0,1,NULL,NULL,NULL,NULL,NULL,1,NULL,'2003-06-04','','','canelle',NULL,NULL,NULL,NULL,NULL,NULL,1.00000000,0.00000000,0.00000000,0.00000000),(18,'18','FR81385',1,NULL,0,2,'2013-02-13 17:20:25','2003-06-04','2015-07-19 13:40:54','OVH FR81385',0,0.00000000,0.00000000,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000,26.00000000,5.10000000,31.10000000,0,1,NULL,NULL,NULL,NULL,NULL,1,NULL,'2003-06-04','','',NULL,NULL,NULL,NULL,NULL,NULL,NULL,1.00000000,0.00000000,0.00000000,0.00000000),(19,'19','FR813852',1,NULL,0,2,'2013-03-16 17:59:02','2013-03-16','2015-07-19 13:40:54','OVH FR81385',0,0.00000000,0.00000000,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000,26.00000000,5.10000000,31.10000000,0,1,NULL,NULL,NULL,NULL,NULL,1,NULL,NULL,'','',NULL,NULL,NULL,NULL,NULL,NULL,NULL,1.00000000,0.00000000,0.00000000,0.00000000); +/*!40000 ALTER TABLE `llx_facture_fourn` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_facture_fourn_det` +-- + +DROP TABLE IF EXISTS `llx_facture_fourn_det`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_facture_fourn_det` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `fk_facture_fourn` int(11) NOT NULL, + `fk_parent_line` int(11) DEFAULT NULL, + `fk_product` int(11) DEFAULT NULL, + `ref` varchar(50) DEFAULT NULL, + `label` varchar(255) DEFAULT NULL, + `description` text, + `pu_ht` double(24,8) DEFAULT NULL, + `pu_ttc` double(24,8) DEFAULT NULL, + `qty` double DEFAULT NULL, + `remise_percent` double DEFAULT '0', + `tva_tx` double(6,3) DEFAULT NULL, + `localtax1_tx` double(6,3) DEFAULT '0.000', + `localtax1_type` varchar(10) NOT NULL DEFAULT '0', + `localtax2_tx` double(6,3) DEFAULT '0.000', + `localtax2_type` varchar(10) NOT NULL DEFAULT '0', + `total_ht` double(24,8) DEFAULT NULL, + `tva` double(24,8) DEFAULT NULL, + `total_localtax1` double(24,8) DEFAULT '0.00000000', + `total_localtax2` double(24,8) DEFAULT '0.00000000', + `total_ttc` double(24,8) DEFAULT NULL, + `product_type` int(11) DEFAULT '0', + `date_start` datetime DEFAULT NULL, + `date_end` datetime DEFAULT NULL, + `info_bits` int(11) NOT NULL DEFAULT '0', + `import_key` varchar(14) DEFAULT NULL, + `fk_code_ventilation` int(11) NOT NULL DEFAULT '0', + `special_code` int(11) DEFAULT '0', + `rang` int(11) DEFAULT '0', + `fk_unit` int(11) DEFAULT NULL, + `fk_multicurrency` int(11) DEFAULT NULL, + `multicurrency_code` varchar(255) DEFAULT NULL, + `multicurrency_subprice` double(24,8) DEFAULT '0.00000000', + `multicurrency_total_ht` double(24,8) DEFAULT '0.00000000', + `multicurrency_total_tva` double(24,8) DEFAULT '0.00000000', + `multicurrency_total_ttc` double(24,8) DEFAULT '0.00000000', + PRIMARY KEY (`rowid`), + KEY `idx_facture_fourn_det_fk_facture` (`fk_facture_fourn`), + KEY `fk_facture_fourn_det_fk_unit` (`fk_unit`), + CONSTRAINT `fk_facture_fourn_det_fk_facture` FOREIGN KEY (`fk_facture_fourn`) REFERENCES `llx_facture_fourn` (`rowid`), + CONSTRAINT `fk_facture_fourn_det_fk_unit` FOREIGN KEY (`fk_unit`) REFERENCES `llx_c_units` (`rowid`) +) ENGINE=InnoDB AUTO_INCREMENT=53 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_facture_fourn_det` +-- + +LOCK TABLES `llx_facture_fourn_det` WRITE; +/*!40000 ALTER TABLE `llx_facture_fourn_det` DISABLE KEYS */; +INSERT INTO `llx_facture_fourn_det` VALUES (44,16,NULL,NULL,NULL,NULL,'ref :sd.loc.sp.512.6
6 mois - Location de SuperPlan avec la connexion 512kbs
Du 11/04/2003 à 11/10/2003',414.00000000,495.14400000,1,0,19.600,0.000,'',0.000,'',414.00000000,81.14000000,0.00000000,0.00000000,495.14000000,0,NULL,NULL,0,NULL,0,0,0,NULL,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000),(45,16,NULL,NULL,NULL,NULL,'ref :sd.loc.sp.512.6
6 mois - Location de SuperPlan avec la connexion 512kbs
Du 11/10/2003 à 11/04/2004',414.00000000,495.14400000,1,0,19.600,0.000,'',0.000,'',414.00000000,81.14000000,0.00000000,0.00000000,495.14000000,0,NULL,NULL,0,NULL,0,0,0,NULL,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000),(46,16,NULL,NULL,NULL,NULL,'ref :sd.installation.annuel
Frais de mise en service d\'un serveur dédié pour un paiement annuel
',1.00000000,1.19600000,1,0,19.600,0.000,'',0.000,'',1.00000000,0.20000000,0.00000000,0.00000000,1.20000000,0,NULL,NULL,0,NULL,0,0,0,NULL,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000),(47,17,NULL,NULL,NULL,NULL,'ref :bk.full250.creation
Création du compte backup ftp 250Mo.
',1.00000000,1.19600000,1,0,19.600,0.000,'',0.000,'',1.00000000,0.20000000,0.00000000,0.00000000,1.20000000,0,NULL,NULL,0,NULL,0,0,0,NULL,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000),(48,17,NULL,NULL,NULL,NULL,'ref :bk.full250.12
Redevance pour un backup de 250Mo sur 12 mois
',25.00000000,29.90000000,1,0,19.600,0.000,'',0.000,'',25.00000000,4.90000000,0.00000000,0.00000000,29.90000000,0,NULL,NULL,0,NULL,0,0,0,NULL,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000),(49,18,NULL,NULL,NULL,NULL,'ref :bk.full250.creation
Création du compte backup ftp 250Mo.
',1.00000000,1.19600000,1,0,19.600,0.000,'',0.000,'',1.00000000,0.20000000,0.00000000,0.00000000,1.20000000,0,NULL,NULL,0,NULL,0,0,0,NULL,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000),(50,18,NULL,NULL,NULL,NULL,'ref :bk.full250.12
Redevance pour un backup de 250Mo sur 12 mois
',25.00000000,29.90000000,1,0,19.600,0.000,'',0.000,'',25.00000000,4.90000000,0.00000000,0.00000000,29.90000000,0,NULL,NULL,0,NULL,0,0,0,NULL,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000),(51,19,NULL,NULL,NULL,NULL,'ref :bk.full250.creation
Création du compte backup ftp 250Mo.
',1.00000000,1.19600000,1,0,19.600,0.000,'0',0.000,'0',1.00000000,0.20000000,0.00000000,0.00000000,1.20000000,0,NULL,NULL,0,NULL,0,0,0,NULL,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000),(52,19,NULL,NULL,NULL,NULL,'ref :bk.full250.12
Redevance pour un backup de 250Mo sur 12 mois
',25.00000000,29.90000000,1,0,19.600,0.000,'0',0.000,'0',25.00000000,4.90000000,0.00000000,0.00000000,29.90000000,0,NULL,NULL,0,NULL,0,0,0,NULL,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000); +/*!40000 ALTER TABLE `llx_facture_fourn_det` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_facture_fourn_det_extrafields` +-- + +DROP TABLE IF EXISTS `llx_facture_fourn_det_extrafields`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_facture_fourn_det_extrafields` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `fk_object` int(11) NOT NULL, + `import_key` varchar(14) DEFAULT NULL, + PRIMARY KEY (`rowid`), + KEY `idx_facture_fourn_det_extrafields` (`fk_object`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_facture_fourn_det_extrafields` +-- + +LOCK TABLES `llx_facture_fourn_det_extrafields` WRITE; +/*!40000 ALTER TABLE `llx_facture_fourn_det_extrafields` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_facture_fourn_det_extrafields` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_facture_fourn_extrafields` +-- + +DROP TABLE IF EXISTS `llx_facture_fourn_extrafields`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_facture_fourn_extrafields` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `fk_object` int(11) NOT NULL, + `import_key` varchar(14) DEFAULT NULL, + PRIMARY KEY (`rowid`), + KEY `idx_facture_fourn_extrafields` (`fk_object`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_facture_fourn_extrafields` +-- + +LOCK TABLES `llx_facture_fourn_extrafields` WRITE; +/*!40000 ALTER TABLE `llx_facture_fourn_extrafields` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_facture_fourn_extrafields` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_facture_rec` +-- + +DROP TABLE IF EXISTS `llx_facture_rec`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_facture_rec` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `titre` varchar(50) NOT NULL, + `entity` int(11) NOT NULL DEFAULT '1', + `fk_soc` int(11) NOT NULL, + `datec` datetime DEFAULT NULL, + `amount` double(24,8) NOT NULL DEFAULT '0.00000000', + `remise` double DEFAULT '0', + `remise_percent` double DEFAULT '0', + `remise_absolue` double DEFAULT '0', + `tva` double(24,8) DEFAULT '0.00000000', + `localtax1` double(24,8) DEFAULT '0.00000000', + `localtax2` double(24,8) DEFAULT '0.00000000', + `total` double(24,8) DEFAULT '0.00000000', + `total_ttc` double(24,8) DEFAULT '0.00000000', + `fk_user_author` int(11) DEFAULT NULL, + `fk_projet` int(11) DEFAULT NULL, + `fk_cond_reglement` int(11) DEFAULT '0', + `fk_mode_reglement` int(11) DEFAULT '0', + `date_lim_reglement` date DEFAULT NULL, + `note_private` text, + `note_public` text, + `last_gen` varchar(7) DEFAULT NULL, + `unit_frequency` varchar(2) DEFAULT 'd', + `date_when` datetime DEFAULT NULL, + `date_last_gen` datetime DEFAULT NULL, + `nb_gen_done` int(11) DEFAULT NULL, + `nb_gen_max` int(11) DEFAULT NULL, + `frequency` int(11) DEFAULT NULL, + `usenewprice` int(11) DEFAULT '0', + `revenuestamp` double(24,8) DEFAULT '0.00000000', + `auto_validate` int(11) DEFAULT '0', + `fk_account` int(11) DEFAULT '0', + `fk_multicurrency` int(11) DEFAULT NULL, + `multicurrency_code` varchar(255) DEFAULT NULL, + `multicurrency_tx` double(24,8) DEFAULT '1.00000000', + `multicurrency_total_ht` double(24,8) DEFAULT '0.00000000', + `multicurrency_total_tva` double(24,8) DEFAULT '0.00000000', + `multicurrency_total_ttc` double(24,8) DEFAULT '0.00000000', + PRIMARY KEY (`rowid`), + UNIQUE KEY `idx_facture_rec_uk_titre` (`titre`,`entity`), + KEY `idx_facture_rec_fk_soc` (`fk_soc`), + KEY `idx_facture_rec_fk_user_author` (`fk_user_author`), + KEY `idx_facture_rec_fk_projet` (`fk_projet`), + CONSTRAINT `fk_facture_rec_fk_projet` FOREIGN KEY (`fk_projet`) REFERENCES `llx_projet` (`rowid`), + CONSTRAINT `fk_facture_rec_fk_soc` FOREIGN KEY (`fk_soc`) REFERENCES `llx_societe` (`rowid`), + CONSTRAINT `fk_facture_rec_fk_user_author` FOREIGN KEY (`fk_user_author`) REFERENCES `llx_user` (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_facture_rec` +-- + +LOCK TABLES `llx_facture_rec` WRITE; +/*!40000 ALTER TABLE `llx_facture_rec` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_facture_rec` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_facturedet` +-- + +DROP TABLE IF EXISTS `llx_facturedet`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_facturedet` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `fk_facture` int(11) NOT NULL, + `fk_parent_line` int(11) DEFAULT NULL, + `fk_product` int(11) DEFAULT NULL, + `label` varchar(255) DEFAULT NULL, + `description` text, + `tva_tx` double(6,3) DEFAULT NULL, + `localtax1_tx` double(6,3) DEFAULT '0.000', + `localtax1_type` varchar(10) NOT NULL DEFAULT '0', + `localtax2_tx` double(6,3) DEFAULT '0.000', + `localtax2_type` varchar(10) NOT NULL DEFAULT '0', + `qty` double DEFAULT NULL, + `remise_percent` double DEFAULT '0', + `remise` double DEFAULT '0', + `fk_remise_except` int(11) DEFAULT NULL, + `subprice` double(24,8) DEFAULT NULL, + `price` double(24,8) DEFAULT NULL, + `total_ht` double(24,8) DEFAULT NULL, + `total_tva` double(24,8) DEFAULT NULL, + `total_localtax1` double(24,8) DEFAULT '0.00000000', + `total_localtax2` double(24,8) DEFAULT '0.00000000', + `total_ttc` double(24,8) DEFAULT NULL, + `product_type` int(11) DEFAULT '0', + `date_start` datetime DEFAULT NULL, + `date_end` datetime DEFAULT NULL, + `info_bits` int(11) DEFAULT '0', + `fk_product_fournisseur_price` int(11) DEFAULT NULL, + `buy_price_ht` double(24,8) DEFAULT '0.00000000', + `fk_code_ventilation` int(11) NOT NULL DEFAULT '0', + `special_code` int(10) unsigned DEFAULT '0', + `rang` int(11) DEFAULT '0', + `fk_contract_line` int(11) DEFAULT NULL, + `import_key` varchar(14) DEFAULT NULL, + `situation_percent` double DEFAULT NULL, + `fk_prev_id` int(11) DEFAULT NULL, + `fk_unit` int(11) DEFAULT NULL, + `fk_multicurrency` int(11) DEFAULT NULL, + `multicurrency_code` varchar(255) DEFAULT NULL, + `multicurrency_subprice` double(24,8) DEFAULT '0.00000000', + `multicurrency_total_ht` double(24,8) DEFAULT '0.00000000', + `multicurrency_total_tva` double(24,8) DEFAULT '0.00000000', + `multicurrency_total_ttc` double(24,8) DEFAULT '0.00000000', + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_fk_remise_except` (`fk_remise_except`,`fk_facture`), + KEY `idx_facturedet_fk_facture` (`fk_facture`), + KEY `idx_facturedet_fk_product` (`fk_product`), + KEY `fk_facturedet_fk_unit` (`fk_unit`), + CONSTRAINT `fk_facturedet_fk_facture` FOREIGN KEY (`fk_facture`) REFERENCES `llx_facture` (`rowid`), + CONSTRAINT `fk_facturedet_fk_unit` FOREIGN KEY (`fk_unit`) REFERENCES `llx_c_units` (`rowid`) +) ENGINE=InnoDB AUTO_INCREMENT=1027 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_facturedet` +-- + +LOCK TABLES `llx_facturedet` WRITE; +/*!40000 ALTER TABLE `llx_facturedet` DISABLE KEYS */; +INSERT INTO `llx_facturedet` VALUES (3,2,NULL,3,NULL,'Service S1',0.000,0.000,'',0.000,'',1,10,4,NULL,40.00000000,36.00000000,36.00000000,0.00000000,0.00000000,0.00000000,36.00000000,1,'2010-07-10 00:00:00',NULL,0,NULL,0.00000000,0,0,2,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000),(4,2,NULL,NULL,NULL,'Abonnement annuel assurance',1.000,0.000,'',0.000,'',1,0,0,NULL,10.00000000,10.00000000,10.00000000,0.10000000,0.00000000,0.00000000,10.10000000,0,'2010-07-10 00:00:00','2011-07-10 00:00:00',0,NULL,0.00000000,0,0,3,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000),(11,3,NULL,4,NULL,'afsdfsdfsdfsdf',0.000,0.000,'',0.000,'',1,0,0,NULL,5.00000000,5.00000000,5.00000000,0.00000000,0.00000000,0.00000000,5.00000000,0,NULL,NULL,0,NULL,0.00000000,0,0,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000),(12,3,NULL,NULL,NULL,'dfdfd',0.000,0.000,'',0.000,'',1,0,0,NULL,10.00000000,10.00000000,10.00000000,0.00000000,0.00000000,0.00000000,10.00000000,0,NULL,NULL,0,NULL,0.00000000,0,0,2,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000),(13,5,NULL,4,NULL,'Decapsuleur',12.500,0.000,'',0.000,'',1,0,0,NULL,5.00000000,5.00000000,5.00000000,0.63000000,0.00000000,0.00000000,5.63000000,0,NULL,NULL,0,NULL,0.00000000,0,0,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000),(14,6,NULL,4,NULL,'Decapsuleur',19.600,0.000,'',0.000,'',1,0,0,NULL,5.00000000,5.00000000,5.00000000,0.98000000,0.00000000,0.00000000,5.98000000,0,NULL,NULL,0,NULL,0.00000000,0,0,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000),(21,8,NULL,NULL,NULL,'dddd',0.000,0.000,'',0.000,'',1,0,0,NULL,10.00000000,10.00000000,10.00000000,0.00000000,0.00000000,0.00000000,10.00000000,0,NULL,NULL,0,NULL,0.00000000,0,0,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000),(22,9,NULL,NULL,NULL,'ggg',19.600,0.000,'',0.000,'',1,0,0,NULL,10.00000000,10.00000000,10.00000000,1.96000000,0.00000000,0.00000000,11.96000000,0,NULL,NULL,0,NULL,0.00000000,0,0,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000),(23,10,NULL,4,NULL,'',12.500,0.000,'',0.000,'',1,0,0,NULL,-5.00000000,NULL,-5.00000000,-0.63000000,0.00000000,0.00000000,-5.63000000,0,NULL,NULL,0,NULL,12.00000000,0,0,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000),(24,10,NULL,1,NULL,'A beatifull pink dress\r\nlkm',0.000,0.000,'',0.000,'',1,0,0,NULL,-6.00000000,NULL,-6.00000000,0.00000000,0.00000000,0.00000000,-6.00000000,0,NULL,NULL,0,0,0.00000000,0,0,2,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000),(26,12,NULL,1,NULL,'A beatifull pink dress\r\nhfghf',0.000,0.000,'',0.000,'',1,0,0,NULL,-5.00000000,NULL,-5.00000000,0.00000000,0.00000000,0.00000000,-5.00000000,0,NULL,NULL,0,0,0.00000000,0,0,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000),(27,13,NULL,NULL,NULL,'gdfgdf',19.600,0.000,'',0.000,'',1.4,0,0,NULL,10.00000000,NULL,14.00000000,2.74000000,0.00000000,0.00000000,16.74000000,0,NULL,NULL,0,NULL,0.00000000,0,0,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000),(137,33,NULL,NULL,NULL,'Desc',10.000,0.000,'',0.000,'',1,0,0,NULL,1.24000000,NULL,1.24000000,0.12000000,0.00000000,0.00000000,1.36000000,0,NULL,NULL,0,NULL,0.00000000,0,0,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000),(138,33,NULL,NULL,NULL,'Desc',10.000,0.000,'',0.000,'',1,0,0,NULL,1.24000000,NULL,1.24000000,0.12000000,0.00000000,0.00000000,1.36000000,0,NULL,NULL,0,NULL,0.00000000,0,0,2,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000),(256,55,NULL,NULL,NULL,'Desc',10.000,0.000,'',0.000,'',1,0,0,NULL,1.24000000,NULL,1.24000000,0.12000000,0.00000000,0.00000000,1.36000000,0,NULL,NULL,0,NULL,0.00000000,0,0,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000),(257,55,NULL,NULL,NULL,'Desc',10.000,0.000,'',0.000,'',1,0,0,NULL,1.24000000,NULL,1.24000000,0.12000000,0.00000000,0.00000000,1.36000000,0,NULL,NULL,0,NULL,0.00000000,0,0,2,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000),(753,13,NULL,2,NULL,'(Pays d\'origine: Albanie)',0.000,0.000,'',0.000,'',1,0,0,NULL,0.00000000,NULL,0.00000000,0.00000000,0.00000000,0.00000000,0.00000000,0,NULL,NULL,0,0,0.00000000,0,0,2,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000),(754,148,NULL,11,NULL,'hfghf',0.000,0.000,'',0.000,'',1,0,0,NULL,0.00000000,NULL,0.00000000,0.00000000,0.00000000,0.00000000,0.00000000,0,NULL,NULL,0,NULL,0.00000000,0,0,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000),(755,148,NULL,4,NULL,'Decapsuleur',12.500,0.000,'',0.000,'',1,0,0,NULL,5.00000000,NULL,5.00000000,0.63000000,0.00000000,0.00000000,5.63000000,0,NULL,NULL,0,NULL,0.00000000,0,0,2,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000),(756,149,NULL,5,NULL,'aaaa',19.600,0.000,'',0.000,'',1,0,0,NULL,10.00000000,NULL,10.00000000,1.96000000,0.00000000,0.00000000,11.96000000,0,NULL,NULL,0,NULL,0.00000000,0,0,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000),(757,150,NULL,2,NULL,'Product P1',12.500,0.000,'',0.000,'',1,0,0,NULL,0.00000000,NULL,0.00000000,0.00000000,0.00000000,0.00000000,0.00000000,0,NULL,NULL,0,NULL,0.00000000,0,0,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000),(758,151,NULL,2,NULL,'Product P1',12.500,0.000,'',0.000,'',1,0,0,NULL,0.00000000,NULL,0.00000000,0.00000000,0.00000000,0.00000000,0.00000000,0,NULL,NULL,0,NULL,0.00000000,0,0,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000),(768,32,NULL,NULL,NULL,'mlml',18.000,0.000,'',0.000,'',1,0,0,NULL,100.00000000,NULL,100.00000000,18.00000000,0.00000000,0.00000000,118.00000000,0,NULL,NULL,0,NULL,46.00000000,0,0,3,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000),(769,32,NULL,NULL,NULL,'mlkml',18.000,0.000,'',0.000,'',1,0,0,NULL,400.00000000,NULL,400.00000000,72.00000000,0.00000000,0.00000000,472.00000000,0,NULL,NULL,0,NULL,300.00000000,0,0,4,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000),(772,160,NULL,NULL,NULL,'Adhésion/cotisation 2015',12.500,0.000,'',0.000,'',1,0,0,NULL,8.88889000,NULL,8.89000000,1.11000000,0.00000000,0.00000000,10.00000000,1,'2015-07-18 00:00:00','2016-07-17 00:00:00',0,NULL,0.00000000,0,0,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000),(776,32,NULL,NULL,NULL,'fsdfsdfds',0.000,0.000,'0',0.000,'0',1,0,0,NULL,10.00000000,NULL,10.00000000,0.00000000,0.00000000,0.00000000,10.00000000,0,NULL,NULL,0,NULL,0.00000000,0,0,5,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000),(777,32,NULL,NULL,NULL,'fsdfsdfds',0.000,0.000,'0',0.000,'0',1,0,0,NULL,10.00000000,NULL,10.00000000,0.00000000,0.00000000,0.00000000,10.00000000,0,NULL,NULL,0,NULL,0.00000000,0,0,6,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000),(779,32,NULL,NULL,NULL,'fsdfds',0.000,0.000,'0',0.000,'0',0,0,0,NULL,0.00000000,NULL,0.00000000,0.00000000,0.00000000,0.00000000,0.00000000,9,NULL,NULL,0,0,0.00000000,0,0,2,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000),(780,32,NULL,NULL,NULL,'ffsdf',0.000,0.000,'0',0.000,'0',0,0,0,NULL,0.00000000,NULL,0.00000000,0.00000000,0.00000000,0.00000000,0.00000000,9,NULL,NULL,0,NULL,0.00000000,0,1790,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000),(1022,210,NULL,NULL,NULL,'Adhésion/cotisation 2011',0.000,0.000,'0',0.000,'0',1,0,0,NULL,10.00000000,NULL,10.00000000,0.00000000,0.00000000,0.00000000,10.00000000,1,'2011-07-10 00:00:00','2012-07-09 00:00:00',0,NULL,0.00000000,0,0,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000),(1023,211,NULL,NULL,NULL,'Samsung Android x4',0.000,0.000,'0',0.000,'0',1,0,0,NULL,250.00000000,NULL,250.00000000,0.00000000,0.00000000,0.00000000,250.00000000,0,NULL,NULL,0,NULL,200.00000000,0,0,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000),(1024,211,NULL,1,NULL,'A beatifull pink dress\r\nSize XXL',19.600,0.000,'0',0.000,'0',1,10,0,NULL,100.00000000,NULL,90.00000000,17.64000000,0.00000000,0.00000000,107.64000000,0,NULL,NULL,0,NULL,90.00000000,0,0,2,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000),(1026,213,NULL,1,NULL,'A beatifull pink dress',0.000,0.000,'0',0.000,'0',10,0,0,NULL,-100.00000000,NULL,-1000.00000000,0.00000000,0.00000000,0.00000000,-1000.00000000,0,NULL,NULL,0,NULL,0.00000000,0,0,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000); +/*!40000 ALTER TABLE `llx_facturedet` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_facturedet_extrafields` +-- + +DROP TABLE IF EXISTS `llx_facturedet_extrafields`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_facturedet_extrafields` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `fk_object` int(11) NOT NULL, + `import_key` varchar(14) DEFAULT NULL, + PRIMARY KEY (`rowid`), + KEY `idx_facturedet_extrafields` (`fk_object`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_facturedet_extrafields` +-- + +LOCK TABLES `llx_facturedet_extrafields` WRITE; +/*!40000 ALTER TABLE `llx_facturedet_extrafields` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_facturedet_extrafields` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_facturedet_rec` +-- + +DROP TABLE IF EXISTS `llx_facturedet_rec`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_facturedet_rec` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `fk_facture` int(11) NOT NULL, + `fk_parent_line` int(11) DEFAULT NULL, + `fk_product` int(11) DEFAULT NULL, + `product_type` int(11) DEFAULT '0', + `label` varchar(255) DEFAULT NULL, + `description` text, + `tva_tx` double(6,3) DEFAULT NULL, + `localtax1_tx` double(6,3) DEFAULT '0.000', + `localtax1_type` varchar(10) NOT NULL DEFAULT '0', + `localtax2_tx` double(6,3) DEFAULT '0.000', + `localtax2_type` varchar(10) NOT NULL DEFAULT '0', + `qty` double DEFAULT NULL, + `remise_percent` double DEFAULT '0', + `remise` double DEFAULT '0', + `subprice` double(24,8) DEFAULT NULL, + `price` double(24,8) DEFAULT NULL, + `total_ht` double(24,8) DEFAULT NULL, + `total_tva` double(24,8) DEFAULT NULL, + `total_localtax1` double(24,8) DEFAULT '0.00000000', + `total_localtax2` double(24,8) DEFAULT '0.00000000', + `total_ttc` double(24,8) DEFAULT NULL, + `info_bits` int(11) DEFAULT '0', + `special_code` int(10) unsigned DEFAULT '0', + `rang` int(11) DEFAULT '0', + `fk_contract_line` int(11) DEFAULT NULL, + `fk_unit` int(11) DEFAULT NULL, + `import_key` varchar(14) DEFAULT NULL, + `fk_multicurrency` int(11) DEFAULT NULL, + `multicurrency_code` varchar(255) DEFAULT NULL, + `multicurrency_subprice` double(24,8) DEFAULT '0.00000000', + `multicurrency_total_ht` double(24,8) DEFAULT '0.00000000', + `multicurrency_total_tva` double(24,8) DEFAULT '0.00000000', + `multicurrency_total_ttc` double(24,8) DEFAULT '0.00000000', + PRIMARY KEY (`rowid`), + KEY `fk_facturedet_rec_fk_unit` (`fk_unit`), + CONSTRAINT `fk_facturedet_rec_fk_unit` FOREIGN KEY (`fk_unit`) REFERENCES `llx_c_units` (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_facturedet_rec` +-- + +LOCK TABLES `llx_facturedet_rec` WRITE; +/*!40000 ALTER TABLE `llx_facturedet_rec` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_facturedet_rec` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_fichinter` +-- + +DROP TABLE IF EXISTS `llx_fichinter`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_fichinter` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `fk_soc` int(11) NOT NULL, + `fk_projet` int(11) DEFAULT '0', + `fk_contrat` int(11) DEFAULT '0', + `ref` varchar(30) NOT NULL, + `entity` int(11) NOT NULL DEFAULT '1', + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `datec` datetime DEFAULT NULL, + `date_valid` datetime DEFAULT NULL, + `datei` date DEFAULT NULL, + `fk_user_author` int(11) DEFAULT NULL, + `fk_user_modif` int(11) DEFAULT NULL, + `fk_user_valid` int(11) DEFAULT NULL, + `fk_statut` smallint(6) DEFAULT '0', + `duree` double DEFAULT NULL, + `dateo` date DEFAULT NULL, + `datee` date DEFAULT NULL, + `datet` date DEFAULT NULL, + `description` text, + `note_private` text, + `note_public` text, + `model_pdf` varchar(255) DEFAULT NULL, + `extraparams` varchar(255) DEFAULT NULL, + `ref_ext` varchar(255) DEFAULT NULL, + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_fichinter_ref` (`ref`,`entity`), + KEY `idx_fichinter_fk_soc` (`fk_soc`), + CONSTRAINT `fk_fichinter_fk_soc` FOREIGN KEY (`fk_soc`) REFERENCES `llx_societe` (`rowid`) +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_fichinter` +-- + +LOCK TABLES `llx_fichinter` WRITE; +/*!40000 ALTER TABLE `llx_fichinter` DISABLE KEYS */; +INSERT INTO `llx_fichinter` VALUES (1,2,1,0,'FI1007-0001',1,'2016-01-22 17:39:37','2010-07-09 01:42:41','2016-01-22 18:39:37',NULL,1,NULL,12,1,10800,NULL,NULL,NULL,NULL,NULL,NULL,'soleil',NULL,NULL),(2,1,NULL,0,'FI1007-0002',1,'2012-12-08 13:11:07','2010-07-11 16:07:51',NULL,NULL,1,NULL,NULL,0,3600,NULL,NULL,NULL,'ferfrefeferf',NULL,NULL,'soleil',NULL,NULL),(3,2,NULL,0,'FI1511-0003',1,'2016-07-30 15:51:16','2015-11-18 15:57:34','2016-01-22 18:38:46',NULL,2,NULL,12,1,36000,NULL,NULL,NULL,NULL,NULL,NULL,'soleil',NULL,NULL); +/*!40000 ALTER TABLE `llx_fichinter` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_fichinter_extrafields` +-- + +DROP TABLE IF EXISTS `llx_fichinter_extrafields`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_fichinter_extrafields` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `fk_object` int(11) NOT NULL, + `import_key` varchar(14) DEFAULT NULL, + PRIMARY KEY (`rowid`), + KEY `idx_ficheinter_extrafields` (`fk_object`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_fichinter_extrafields` +-- + +LOCK TABLES `llx_fichinter_extrafields` WRITE; +/*!40000 ALTER TABLE `llx_fichinter_extrafields` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_fichinter_extrafields` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_fichinterdet` +-- + +DROP TABLE IF EXISTS `llx_fichinterdet`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_fichinterdet` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `fk_fichinter` int(11) DEFAULT NULL, + `fk_parent_line` int(11) DEFAULT NULL, + `date` datetime DEFAULT NULL, + `description` text, + `duree` int(11) DEFAULT NULL, + `rang` int(11) DEFAULT '0', + PRIMARY KEY (`rowid`), + KEY `idx_fichinterdet_fk_fichinter` (`fk_fichinter`), + CONSTRAINT `fk_fichinterdet_fk_fichinter` FOREIGN KEY (`fk_fichinter`) REFERENCES `llx_fichinter` (`rowid`) +) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_fichinterdet` +-- + +LOCK TABLES `llx_fichinterdet` WRITE; +/*!40000 ALTER TABLE `llx_fichinterdet` DISABLE KEYS */; +INSERT INTO `llx_fichinterdet` VALUES (1,1,NULL,'2010-07-07 04:00:00','Intervention sur site',3600,0),(2,1,NULL,'2010-07-08 11:00:00','Other actions on client site.',7200,0),(3,2,NULL,'2010-07-11 05:00:00','Pres',3600,0),(5,3,NULL,'2015-11-18 09:00:00','Intervention on building windows 1',32400,0),(6,3,NULL,'2016-01-22 00:00:00','Intervention on building windows 2',3600,0); +/*!40000 ALTER TABLE `llx_fichinterdet` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_fichinterdet_extrafields` +-- + +DROP TABLE IF EXISTS `llx_fichinterdet_extrafields`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_fichinterdet_extrafields` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `fk_object` int(11) NOT NULL, + `import_key` varchar(14) DEFAULT NULL, + PRIMARY KEY (`rowid`), + KEY `idx_ficheinterdet_extrafields` (`fk_object`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_fichinterdet_extrafields` +-- + +LOCK TABLES `llx_fichinterdet_extrafields` WRITE; +/*!40000 ALTER TABLE `llx_fichinterdet_extrafields` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_fichinterdet_extrafields` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_holiday` +-- + +DROP TABLE IF EXISTS `llx_holiday`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_holiday` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `fk_user` int(11) NOT NULL, + `date_create` datetime NOT NULL, + `description` varchar(255) NOT NULL, + `date_debut` date NOT NULL, + `date_fin` date NOT NULL, + `halfday` int(11) DEFAULT '0', + `statut` int(11) NOT NULL DEFAULT '1', + `fk_validator` int(11) NOT NULL, + `date_valid` datetime DEFAULT NULL, + `fk_user_valid` int(11) DEFAULT NULL, + `date_refuse` datetime DEFAULT NULL, + `fk_user_refuse` int(11) DEFAULT NULL, + `date_cancel` datetime DEFAULT NULL, + `fk_user_cancel` int(11) DEFAULT NULL, + `detail_refuse` varchar(250) DEFAULT NULL, + `note_private` text, + `note_public` text, + `note` text, + `fk_user_create` int(11) DEFAULT NULL, + `fk_type` int(11) NOT NULL DEFAULT '1', + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `entity` int(11) NOT NULL DEFAULT '1', + PRIMARY KEY (`rowid`), + KEY `idx_holiday_fk_user` (`fk_user`), + KEY `idx_holiday_date_debut` (`date_debut`), + KEY `idx_holiday_date_fin` (`date_fin`), + KEY `idx_holiday_fk_user_create` (`fk_user_create`), + KEY `idx_holiday_date_create` (`date_create`), + KEY `idx_holiday_fk_validator` (`fk_validator`), + KEY `idx_holiday_entity` (`entity`) +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_holiday` +-- + +LOCK TABLES `llx_holiday` WRITE; +/*!40000 ALTER TABLE `llx_holiday` DISABLE KEYS */; +INSERT INTO `llx_holiday` VALUES (1,1,'2013-02-17 19:06:35','gdf','2013-02-10','2013-02-11',0,3,1,'2013-02-17 19:06:57',1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1,'0000-00-00 00:00:00',1),(2,12,'2016-01-22 19:10:01','','2016-01-04','2016-01-08',0,1,11,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12,5,'0000-00-00 00:00:00',1),(3,13,'2016-01-22 19:10:29','','2016-01-11','2016-01-13',0,2,11,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12,5,'0000-00-00 00:00:00',1); +/*!40000 ALTER TABLE `llx_holiday` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_holiday_config` +-- + +DROP TABLE IF EXISTS `llx_holiday_config`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_holiday_config` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(255) NOT NULL, + `value` text, + PRIMARY KEY (`rowid`), + UNIQUE KEY `name` (`name`) +) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_holiday_config` +-- + +LOCK TABLES `llx_holiday_config` WRITE; +/*!40000 ALTER TABLE `llx_holiday_config` DISABLE KEYS */; +INSERT INTO `llx_holiday_config` VALUES (1,'userGroup','1'),(2,'lastUpdate','20160730194419'),(3,'nbUser',''),(4,'delayForRequest','31'),(5,'AlertValidatorDelay','0'),(6,'AlertValidatorSolde','0'),(7,'nbHolidayDeducted','1'),(8,'nbHolidayEveryMonth','2.08334'); +/*!40000 ALTER TABLE `llx_holiday_config` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_holiday_events` +-- + +DROP TABLE IF EXISTS `llx_holiday_events`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_holiday_events` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `entity` int(11) NOT NULL DEFAULT '1', + `name` varchar(255) NOT NULL, + `value` text NOT NULL, + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_holiday_name` (`name`,`entity`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_holiday_events` +-- + +LOCK TABLES `llx_holiday_events` WRITE; +/*!40000 ALTER TABLE `llx_holiday_events` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_holiday_events` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_holiday_logs` +-- + +DROP TABLE IF EXISTS `llx_holiday_logs`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_holiday_logs` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `date_action` datetime NOT NULL, + `fk_user_action` int(11) NOT NULL, + `fk_user_update` int(11) NOT NULL, + `type_action` varchar(255) NOT NULL, + `prev_solde` varchar(255) NOT NULL, + `new_solde` varchar(255) NOT NULL, + `fk_type` int(11) NOT NULL DEFAULT '1', + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB AUTO_INCREMENT=195 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_holiday_logs` +-- + +LOCK TABLES `llx_holiday_logs` WRITE; +/*!40000 ALTER TABLE `llx_holiday_logs` DISABLE KEYS */; +INSERT INTO `llx_holiday_logs` VALUES (1,'2013-01-17 21:03:15',1,1,'Event : Mise à jour mensuelle','0.00','2.08',1),(2,'2013-01-17 21:03:15',1,2,'Event : Mise à jour mensuelle','0.00','2.08',1),(3,'2013-01-17 21:03:15',1,3,'Event : Mise à jour mensuelle','0.00','2.08',1),(4,'2013-02-01 09:53:26',1,1,'Event : Mise à jour mensuelle','2.08','4.16',1),(5,'2013-02-01 09:53:26',1,2,'Event : Mise à jour mensuelle','2.08','4.16',1),(6,'2013-02-01 09:53:26',1,3,'Event : Mise à jour mensuelle','2.08','4.16',1),(7,'2013-02-01 09:53:26',1,1,'Event : Mise à jour mensuelle','4.17','6.25',1),(8,'2013-02-01 09:53:26',1,2,'Event : Mise à jour mensuelle','4.17','6.25',1),(9,'2013-02-01 09:53:26',1,3,'Event : Mise à jour mensuelle','4.17','6.25',1),(10,'2013-02-01 09:53:26',1,4,'Event : Mise à jour mensuelle','0.00','2.08',1),(11,'2013-02-01 09:53:31',1,1,'Event : Mise à jour mensuelle','6.25','8.33',1),(12,'2013-02-01 09:53:31',1,2,'Event : Mise à jour mensuelle','6.25','8.33',1),(13,'2013-02-01 09:53:31',1,3,'Event : Mise à jour mensuelle','6.25','8.33',1),(14,'2013-02-01 09:53:31',1,4,'Event : Mise à jour mensuelle','2.08','4.16',1),(15,'2013-02-01 09:53:31',1,1,'Event : Mise à jour mensuelle','8.33','10.41',1),(16,'2013-02-01 09:53:31',1,2,'Event : Mise à jour mensuelle','8.33','10.41',1),(17,'2013-02-01 09:53:31',1,3,'Event : Mise à jour mensuelle','8.33','10.41',1),(18,'2013-02-01 09:53:31',1,4,'Event : Mise à jour mensuelle','4.17','6.25',1),(19,'2013-02-01 09:53:33',1,1,'Event : Mise à jour mensuelle','10.42','12.50',1),(20,'2013-02-01 09:53:33',1,2,'Event : Mise à jour mensuelle','10.42','12.50',1),(21,'2013-02-01 09:53:33',1,3,'Event : Mise à jour mensuelle','10.42','12.50',1),(22,'2013-02-01 09:53:33',1,4,'Event : Mise à jour mensuelle','6.25','8.33',1),(23,'2013-02-01 09:53:34',1,1,'Event : Mise à jour mensuelle','12.50','14.58',1),(24,'2013-02-01 09:53:34',1,2,'Event : Mise à jour mensuelle','12.50','14.58',1),(25,'2013-02-01 09:53:34',1,3,'Event : Mise à jour mensuelle','12.50','14.58',1),(26,'2013-02-01 09:53:34',1,4,'Event : Mise à jour mensuelle','8.33','10.41',1),(27,'2013-02-01 09:53:34',1,1,'Event : Mise à jour mensuelle','14.58','16.66',1),(28,'2013-02-01 09:53:34',1,2,'Event : Mise à jour mensuelle','14.58','16.66',1),(29,'2013-02-01 09:53:34',1,3,'Event : Mise à jour mensuelle','14.58','16.66',1),(30,'2013-02-01 09:53:34',1,4,'Event : Mise à jour mensuelle','10.42','12.50',1),(31,'2013-02-01 09:53:36',1,1,'Event : Mise à jour mensuelle','16.67','18.75',1),(32,'2013-02-01 09:53:36',1,2,'Event : Mise à jour mensuelle','16.67','18.75',1),(33,'2013-02-01 09:53:36',1,3,'Event : Mise à jour mensuelle','16.67','18.75',1),(34,'2013-02-01 09:53:36',1,4,'Event : Mise à jour mensuelle','12.50','14.58',1),(35,'2013-02-01 09:53:36',1,1,'Event : Mise à jour mensuelle','18.75','20.83',1),(36,'2013-02-01 09:53:36',1,2,'Event : Mise à jour mensuelle','18.75','20.83',1),(37,'2013-02-01 09:53:36',1,3,'Event : Mise à jour mensuelle','18.75','20.83',1),(38,'2013-02-01 09:53:36',1,4,'Event : Mise à jour mensuelle','14.58','16.66',1),(39,'2013-02-01 09:53:37',1,1,'Event : Mise à jour mensuelle','20.83','22.91',1),(40,'2013-02-01 09:53:37',1,2,'Event : Mise à jour mensuelle','20.83','22.91',1),(41,'2013-02-01 09:53:37',1,3,'Event : Mise à jour mensuelle','20.83','22.91',1),(42,'2013-02-01 09:53:37',1,4,'Event : Mise à jour mensuelle','16.67','18.75',1),(43,'2013-02-01 09:53:37',1,1,'Event : Mise à jour mensuelle','22.92','25.00',1),(44,'2013-02-01 09:53:37',1,2,'Event : Mise à jour mensuelle','22.92','25.00',1),(45,'2013-02-01 09:53:37',1,3,'Event : Mise à jour mensuelle','22.92','25.00',1),(46,'2013-02-01 09:53:37',1,4,'Event : Mise à jour mensuelle','18.75','20.83',1),(47,'2013-02-01 09:53:44',1,1,'Event : Mise à jour mensuelle','25.00','27.08',1),(48,'2013-02-01 09:53:44',1,2,'Event : Mise à jour mensuelle','25.00','27.08',1),(49,'2013-02-01 09:53:44',1,3,'Event : Mise à jour mensuelle','25.00','27.08',1),(50,'2013-02-01 09:53:44',1,4,'Event : Mise à jour mensuelle','20.83','22.91',1),(51,'2013-02-01 09:53:47',1,1,'Event : Mise à jour mensuelle','27.08','29.16',1),(52,'2013-02-01 09:53:47',1,2,'Event : Mise à jour mensuelle','27.08','29.16',1),(53,'2013-02-01 09:53:47',1,3,'Event : Mise à jour mensuelle','27.08','29.16',1),(54,'2013-02-01 09:53:47',1,4,'Event : Mise à jour mensuelle','22.92','25.00',1),(55,'2013-02-01 09:53:47',1,1,'Event : Mise à jour mensuelle','29.17','31.25',1),(56,'2013-02-01 09:53:47',1,2,'Event : Mise à jour mensuelle','29.17','31.25',1),(57,'2013-02-01 09:53:47',1,3,'Event : Mise à jour mensuelle','29.17','31.25',1),(58,'2013-02-01 09:53:47',1,4,'Event : Mise à jour mensuelle','25.00','27.08',1),(59,'2013-02-01 09:53:49',1,1,'Event : Mise à jour mensuelle','31.25','33.33',1),(60,'2013-02-01 09:53:49',1,2,'Event : Mise à jour mensuelle','31.25','33.33',1),(61,'2013-02-01 09:53:49',1,3,'Event : Mise à jour mensuelle','31.25','33.33',1),(62,'2013-02-01 09:53:49',1,4,'Event : Mise à jour mensuelle','27.08','29.16',1),(63,'2013-02-01 09:53:52',1,1,'Event : Mise à jour mensuelle','33.33','35.41',1),(64,'2013-02-01 09:53:52',1,2,'Event : Mise à jour mensuelle','33.33','35.41',1),(65,'2013-02-01 09:53:52',1,3,'Event : Mise à jour mensuelle','33.33','35.41',1),(66,'2013-02-01 09:53:52',1,4,'Event : Mise à jour mensuelle','29.17','31.25',1),(67,'2013-02-01 09:53:52',1,1,'Event : Mise à jour mensuelle','35.42','37.50',1),(68,'2013-02-01 09:53:52',1,2,'Event : Mise à jour mensuelle','35.42','37.50',1),(69,'2013-02-01 09:53:52',1,3,'Event : Mise à jour mensuelle','35.42','37.50',1),(70,'2013-02-01 09:53:52',1,4,'Event : Mise à jour mensuelle','31.25','33.33',1),(71,'2013-02-01 09:53:53',1,1,'Event : Mise à jour mensuelle','37.50','39.58',1),(72,'2013-02-01 09:53:53',1,2,'Event : Mise à jour mensuelle','37.50','39.58',1),(73,'2013-02-01 09:53:53',1,3,'Event : Mise à jour mensuelle','37.50','39.58',1),(74,'2013-02-01 09:53:53',1,4,'Event : Mise à jour mensuelle','33.33','35.41',1),(75,'2013-02-01 09:53:54',1,1,'Event : Mise à jour mensuelle','39.58','41.66',1),(76,'2013-02-01 09:53:54',1,2,'Event : Mise à jour mensuelle','39.58','41.66',1),(77,'2013-02-01 09:53:54',1,3,'Event : Mise à jour mensuelle','39.58','41.66',1),(78,'2013-02-01 09:53:54',1,4,'Event : Mise à jour mensuelle','35.42','37.50',1),(79,'2013-02-01 09:53:54',1,1,'Event : Mise à jour mensuelle','41.67','43.75',1),(80,'2013-02-01 09:53:54',1,2,'Event : Mise à jour mensuelle','41.67','43.75',1),(81,'2013-02-01 09:53:54',1,3,'Event : Mise à jour mensuelle','41.67','43.75',1),(82,'2013-02-01 09:53:54',1,4,'Event : Mise à jour mensuelle','37.50','39.58',1),(83,'2013-02-01 09:55:49',1,1,'Event : Mise à jour mensuelle','43.75','45.83',1),(84,'2013-02-01 09:55:49',1,2,'Event : Mise à jour mensuelle','43.75','45.83',1),(85,'2013-02-01 09:55:49',1,3,'Event : Mise à jour mensuelle','43.75','45.83',1),(86,'2013-02-01 09:55:49',1,4,'Event : Mise à jour mensuelle','39.58','41.66',1),(87,'2013-02-01 09:55:56',1,1,'Event : Mise à jour mensuelle','45.83','47.91',1),(88,'2013-02-01 09:55:56',1,2,'Event : Mise à jour mensuelle','45.83','47.91',1),(89,'2013-02-01 09:55:56',1,3,'Event : Mise à jour mensuelle','45.83','47.91',1),(90,'2013-02-01 09:55:56',1,4,'Event : Mise à jour mensuelle','41.67','43.75',1),(91,'2013-02-01 09:56:01',1,1,'Event : Mise à jour mensuelle','47.92','50.00',1),(92,'2013-02-01 09:56:01',1,2,'Event : Mise à jour mensuelle','47.92','50.00',1),(93,'2013-02-01 09:56:01',1,3,'Event : Mise à jour mensuelle','47.92','50.00',1),(94,'2013-02-01 09:56:01',1,4,'Event : Mise à jour mensuelle','43.75','45.83',1),(95,'2013-02-01 09:56:01',1,1,'Event : Mise à jour mensuelle','50.00','52.08',1),(96,'2013-02-01 09:56:01',1,2,'Event : Mise à jour mensuelle','50.00','52.08',1),(97,'2013-02-01 09:56:01',1,3,'Event : Mise à jour mensuelle','50.00','52.08',1),(98,'2013-02-01 09:56:01',1,4,'Event : Mise à jour mensuelle','45.83','47.91',1),(99,'2013-02-01 09:56:03',1,1,'Event : Mise à jour mensuelle','52.08','54.16',1),(100,'2013-02-01 09:56:03',1,2,'Event : Mise à jour mensuelle','52.08','54.16',1),(101,'2013-02-01 09:56:03',1,3,'Event : Mise à jour mensuelle','52.08','54.16',1),(102,'2013-02-01 09:56:03',1,4,'Event : Mise à jour mensuelle','47.92','50.00',1),(103,'2013-02-01 09:56:03',1,1,'Event : Mise à jour mensuelle','54.17','56.25',1),(104,'2013-02-01 09:56:03',1,2,'Event : Mise à jour mensuelle','54.17','56.25',1),(105,'2013-02-01 09:56:03',1,3,'Event : Mise à jour mensuelle','54.17','56.25',1),(106,'2013-02-01 09:56:03',1,4,'Event : Mise à jour mensuelle','50.00','52.08',1),(107,'2013-02-01 09:56:05',1,1,'Event : Mise à jour mensuelle','56.25','58.33',1),(108,'2013-02-01 09:56:05',1,2,'Event : Mise à jour mensuelle','56.25','58.33',1),(109,'2013-02-01 09:56:05',1,3,'Event : Mise à jour mensuelle','56.25','58.33',1),(110,'2013-02-01 09:56:05',1,4,'Event : Mise à jour mensuelle','52.08','54.16',1),(111,'2013-02-01 09:56:06',1,1,'Event : Mise à jour mensuelle','58.33','60.41',1),(112,'2013-02-01 09:56:06',1,2,'Event : Mise à jour mensuelle','58.33','60.41',1),(113,'2013-02-01 09:56:06',1,3,'Event : Mise à jour mensuelle','58.33','60.41',1),(114,'2013-02-01 09:56:06',1,4,'Event : Mise à jour mensuelle','54.17','56.25',1),(115,'2013-02-01 09:56:06',1,1,'Event : Mise à jour mensuelle','60.42','62.50',1),(116,'2013-02-01 09:56:06',1,2,'Event : Mise à jour mensuelle','60.42','62.50',1),(117,'2013-02-01 09:56:06',1,3,'Event : Mise à jour mensuelle','60.42','62.50',1),(118,'2013-02-01 09:56:06',1,4,'Event : Mise à jour mensuelle','56.25','58.33',1),(119,'2013-02-01 09:56:07',1,1,'Event : Mise à jour mensuelle','62.50','64.58',1),(120,'2013-02-01 09:56:07',1,2,'Event : Mise à jour mensuelle','62.50','64.58',1),(121,'2013-02-01 09:56:07',1,3,'Event : Mise à jour mensuelle','62.50','64.58',1),(122,'2013-02-01 09:56:07',1,4,'Event : Mise à jour mensuelle','58.33','60.41',1),(123,'2013-02-01 09:56:07',1,1,'Event : Mise à jour mensuelle','64.58','66.66',1),(124,'2013-02-01 09:56:07',1,2,'Event : Mise à jour mensuelle','64.58','66.66',1),(125,'2013-02-01 09:56:07',1,3,'Event : Mise à jour mensuelle','64.58','66.66',1),(126,'2013-02-01 09:56:07',1,4,'Event : Mise à jour mensuelle','60.42','62.50',1),(127,'2013-02-01 09:56:50',1,1,'Event : Mise à jour mensuelle','66.67','68.75',1),(128,'2013-02-01 09:56:50',1,2,'Event : Mise à jour mensuelle','66.67','68.75',1),(129,'2013-02-01 09:56:50',1,3,'Event : Mise à jour mensuelle','66.67','68.75',1),(130,'2013-02-01 09:56:50',1,4,'Event : Mise à jour mensuelle','62.50','64.58',1),(131,'2013-02-01 09:56:50',1,1,'Event : Mise à jour mensuelle','68.75','70.83',1),(132,'2013-02-01 09:56:50',1,2,'Event : Mise à jour mensuelle','68.75','70.83',1),(133,'2013-02-01 09:56:50',1,3,'Event : Mise à jour mensuelle','68.75','70.83',1),(134,'2013-02-01 09:56:50',1,4,'Event : Mise à jour mensuelle','64.58','66.66',1),(135,'2013-02-17 18:49:21',1,1,'Event : Mise à jour mensuelle','70.83','72.91',1),(136,'2013-02-17 18:49:21',1,2,'Event : Mise à jour mensuelle','70.83','72.91',1),(137,'2013-02-17 18:49:21',1,3,'Event : Mise à jour mensuelle','70.83','72.91',1),(138,'2013-02-17 18:49:21',1,4,'Event : Mise à jour mensuelle','66.67','68.75',1),(139,'2013-02-17 19:06:57',1,1,'Event : Holiday','72.92','71.92',1),(140,'2013-03-01 23:12:31',1,1,'Event : Mise à jour mensuelle','71.92','74.00',1),(141,'2013-03-01 23:12:31',1,2,'Event : Mise à jour mensuelle','72.92','75.00',1),(142,'2013-03-01 23:12:31',1,3,'Event : Mise à jour mensuelle','72.92','75.00',1),(143,'2013-03-01 23:12:31',1,4,'Event : Mise à jour mensuelle','68.75','70.83',1),(145,'2015-07-19 15:44:57',1,1,'Monthly update','0','2.08334',4),(146,'2015-07-19 15:44:57',1,2,'Monthly update','0','2.08334',4),(147,'2015-07-19 15:44:57',1,3,'Monthly update','0','2.08334',4),(148,'2015-07-19 15:44:57',1,4,'Monthly update','0','2.08334',4),(151,'2015-07-19 15:44:57',1,1,'Monthly update','0','2.08334',5),(152,'2015-07-19 15:44:57',1,2,'Monthly update','0','2.08334',5),(153,'2015-07-19 15:44:57',1,3,'Monthly update','0','2.08334',5),(154,'2015-07-19 15:44:57',1,4,'Monthly update','0','2.08334',5),(157,'2015-07-19 15:44:57',1,1,'Monthly update','0','2.08334',9),(158,'2015-07-19 15:44:57',1,2,'Monthly update','0','2.08334',9),(159,'2015-07-19 15:44:57',1,3,'Monthly update','0','2.08334',9),(160,'2015-07-19 15:44:57',1,4,'Monthly update','0','2.08334',9),(163,'2016-01-22 18:59:06',12,1,'Monthly update','0','2.08334',4),(164,'2016-01-22 18:59:06',12,2,'Monthly update','0','2.08334',4),(165,'2016-01-22 18:59:06',12,3,'Monthly update','0','2.08334',4),(166,'2016-01-22 18:59:06',12,4,'Monthly update','0','2.08334',4),(168,'2016-01-22 18:59:06',12,1,'Monthly update','0','2.08334',5),(169,'2016-01-22 18:59:06',12,2,'Monthly update','0','2.08334',5),(170,'2016-01-22 18:59:06',12,3,'Monthly update','0','2.08334',5),(171,'2016-01-22 18:59:06',12,4,'Monthly update','0','2.08334',5),(173,'2016-01-22 18:59:06',12,1,'Monthly update','0','2.08334',9),(174,'2016-01-22 18:59:06',12,2,'Monthly update','0','2.08334',9),(175,'2016-01-22 18:59:06',12,3,'Monthly update','0','2.08334',9),(176,'2016-01-22 18:59:06',12,4,'Monthly update','0','2.08334',9),(178,'2016-01-22 18:59:38',12,18,'Manual update','0','10',5),(179,'2016-01-22 18:59:42',12,16,'Manual update','0','10',5),(180,'2016-01-22 18:59:45',12,12,'Manual update','0','10',5),(181,'2016-01-22 18:59:49',12,1,'Manual update','0','10',5),(182,'2016-01-22 18:59:52',12,2,'Manual update','0','10',5),(183,'2016-01-22 18:59:55',12,3,'Manual update','0','5',5),(184,'2016-07-30 19:45:49',12,1,'Manual update','0','25',3),(185,'2016-07-30 19:45:52',12,2,'Manual update','0','23',3),(186,'2016-07-30 19:45:54',12,3,'Manual update','0','10',3),(187,'2016-07-30 19:45:57',12,4,'Manual update','0','-4',3),(188,'2016-07-30 19:46:02',12,10,'Manual update','0','20',3),(189,'2016-07-30 19:46:04',12,11,'Manual update','0','30',3),(190,'2016-07-30 19:46:07',12,12,'Manual update','0','15',3),(191,'2016-07-30 19:46:09',12,13,'Manual update','0','11',3),(192,'2016-07-30 19:46:12',12,14,'Manual update','0','4',3),(193,'2016-07-30 19:46:14',12,16,'Manual update','0','5',3),(194,'2016-07-30 19:46:16',12,18,'Manual update','0','22',3); +/*!40000 ALTER TABLE `llx_holiday_logs` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_holiday_users` +-- + +DROP TABLE IF EXISTS `llx_holiday_users`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_holiday_users` ( + `fk_user` int(11) NOT NULL, + `nb_holiday` double NOT NULL DEFAULT '0', + `fk_type` int(11) NOT NULL DEFAULT '1' +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_holiday_users` +-- + +LOCK TABLES `llx_holiday_users` WRITE; +/*!40000 ALTER TABLE `llx_holiday_users` DISABLE KEYS */; +INSERT INTO `llx_holiday_users` VALUES (0,0,1),(1,74.00334000000001,1),(2,75.00024000000003,1),(3,75.00024000000003,1),(4,70.83356000000002,1),(5,2.08334,1),(6,0,1),(18,10,5),(16,10,5),(12,10,5),(1,10,5),(2,10,5),(3,5,5),(1,25,3),(2,23,3),(3,10,3),(4,-4,3),(10,20,3),(11,30,3),(12,15,3),(13,11,3),(14,4,3),(16,5,3),(18,22,3); +/*!40000 ALTER TABLE `llx_holiday_users` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_import_model` +-- + +DROP TABLE IF EXISTS `llx_import_model`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_import_model` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `fk_user` int(11) NOT NULL DEFAULT '0', + `label` varchar(50) NOT NULL, + `type` varchar(50) DEFAULT NULL, + `field` text NOT NULL, + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_import_model` (`label`,`type`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_import_model` +-- + +LOCK TABLES `llx_import_model` WRITE; +/*!40000 ALTER TABLE `llx_import_model` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_import_model` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_links` +-- + +DROP TABLE IF EXISTS `llx_links`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_links` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `entity` int(11) NOT NULL DEFAULT '1', + `datea` datetime NOT NULL, + `url` varchar(255) NOT NULL, + `label` varchar(255) NOT NULL, + `objecttype` varchar(255) NOT NULL, + `objectid` int(11) NOT NULL, + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_links` +-- + +LOCK TABLES `llx_links` WRITE; +/*!40000 ALTER TABLE `llx_links` DISABLE KEYS */; +INSERT INTO `llx_links` VALUES (1,1,'2016-01-16 16:45:35','http://www.dolicloud.com','The DoliCoud service','societe',10),(2,1,'2016-01-16 17:14:35','https://www.dolistore.com/en/tools-documentation/12-SVG-file-for-85cm-x-200cm-rollup.html','Link to rollup file on dolistore.com','product',11),(3,1,'2016-01-22 17:40:23','http://www.nltechno.com','NLtechno portal','societe',10),(4,1,'2016-01-22 18:32:31','https://play.google.com/store/apps/details?id=com.nltechno.dolidroidpro','Link on Google Play','product',5); +/*!40000 ALTER TABLE `llx_links` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_livraison` +-- + +DROP TABLE IF EXISTS `llx_livraison`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_livraison` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `ref` varchar(30) NOT NULL, + `entity` int(11) NOT NULL DEFAULT '1', + `ref_customer` varchar(30) DEFAULT NULL, + `fk_soc` int(11) NOT NULL, + `ref_ext` varchar(30) DEFAULT NULL, + `ref_int` varchar(30) DEFAULT NULL, + `date_creation` datetime DEFAULT NULL, + `fk_user_author` int(11) DEFAULT NULL, + `date_valid` datetime DEFAULT NULL, + `fk_user_valid` int(11) DEFAULT NULL, + `date_delivery` datetime DEFAULT NULL, + `fk_address` int(11) DEFAULT NULL, + `fk_statut` smallint(6) DEFAULT '0', + `total_ht` double(24,8) DEFAULT '0.00000000', + `note_private` text, + `note_public` text, + `model_pdf` varchar(255) DEFAULT NULL, + `fk_incoterms` int(11) DEFAULT NULL, + `location_incoterms` varchar(255) DEFAULT NULL, + PRIMARY KEY (`rowid`), + UNIQUE KEY `idx_livraison_uk_ref` (`ref`,`entity`), + KEY `idx_livraison_fk_soc` (`fk_soc`), + KEY `idx_livraison_fk_user_author` (`fk_user_author`), + KEY `idx_livraison_fk_user_valid` (`fk_user_valid`), + CONSTRAINT `fk_livraison_fk_soc` FOREIGN KEY (`fk_soc`) REFERENCES `llx_societe` (`rowid`), + CONSTRAINT `fk_livraison_fk_user_author` FOREIGN KEY (`fk_user_author`) REFERENCES `llx_user` (`rowid`), + CONSTRAINT `fk_livraison_fk_user_valid` FOREIGN KEY (`fk_user_valid`) REFERENCES `llx_user` (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_livraison` +-- + +LOCK TABLES `llx_livraison` WRITE; +/*!40000 ALTER TABLE `llx_livraison` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_livraison` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_livraison_extrafields` +-- + +DROP TABLE IF EXISTS `llx_livraison_extrafields`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_livraison_extrafields` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `fk_object` int(11) NOT NULL, + `import_key` varchar(14) DEFAULT NULL, + PRIMARY KEY (`rowid`), + KEY `idx_livraison_extrafields` (`fk_object`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_livraison_extrafields` +-- + +LOCK TABLES `llx_livraison_extrafields` WRITE; +/*!40000 ALTER TABLE `llx_livraison_extrafields` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_livraison_extrafields` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_livraisondet` +-- + +DROP TABLE IF EXISTS `llx_livraisondet`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_livraisondet` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `fk_livraison` int(11) DEFAULT NULL, + `fk_origin_line` int(11) DEFAULT NULL, + `fk_product` int(11) DEFAULT NULL, + `description` text, + `qty` double DEFAULT NULL, + `subprice` double(24,8) DEFAULT '0.00000000', + `total_ht` double(24,8) DEFAULT '0.00000000', + `rang` int(11) DEFAULT '0', + PRIMARY KEY (`rowid`), + KEY `idx_livraisondet_fk_expedition` (`fk_livraison`), + CONSTRAINT `fk_livraisondet_fk_livraison` FOREIGN KEY (`fk_livraison`) REFERENCES `llx_livraison` (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_livraisondet` +-- + +LOCK TABLES `llx_livraisondet` WRITE; +/*!40000 ALTER TABLE `llx_livraisondet` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_livraisondet` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_livraisondet_extrafields` +-- + +DROP TABLE IF EXISTS `llx_livraisondet_extrafields`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_livraisondet_extrafields` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `fk_object` int(11) NOT NULL, + `import_key` varchar(14) DEFAULT NULL, + PRIMARY KEY (`rowid`), + KEY `idx_livraisondet_extrafields` (`fk_object`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_livraisondet_extrafields` +-- + +LOCK TABLES `llx_livraisondet_extrafields` WRITE; +/*!40000 ALTER TABLE `llx_livraisondet_extrafields` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_livraisondet_extrafields` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_loan` +-- + +DROP TABLE IF EXISTS `llx_loan`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_loan` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `entity` int(11) NOT NULL DEFAULT '1', + `datec` datetime DEFAULT NULL, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `label` varchar(80) NOT NULL, + `fk_bank` int(11) DEFAULT NULL, + `capital` double NOT NULL DEFAULT '0', + `datestart` date DEFAULT NULL, + `dateend` date DEFAULT NULL, + `nbterm` double DEFAULT NULL, + `rate` double NOT NULL, + `note_private` text, + `note_public` text, + `capital_position` double DEFAULT '0', + `date_position` date DEFAULT NULL, + `paid` smallint(6) NOT NULL DEFAULT '0', + `accountancy_account_capital` varchar(32) DEFAULT NULL, + `accountancy_account_insurance` varchar(32) DEFAULT NULL, + `accountancy_account_interest` varchar(32) DEFAULT NULL, + `fk_user_author` int(11) DEFAULT NULL, + `fk_user_modif` int(11) DEFAULT NULL, + `active` tinyint(4) NOT NULL DEFAULT '1', + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_loan` +-- + +LOCK TABLES `llx_loan` WRITE; +/*!40000 ALTER TABLE `llx_loan` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_loan` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_localtax` +-- + +DROP TABLE IF EXISTS `llx_localtax`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_localtax` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `entity` int(11) NOT NULL DEFAULT '1', + `localtaxtype` tinyint(4) DEFAULT NULL, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `datep` date DEFAULT NULL, + `datev` date DEFAULT NULL, + `amount` double NOT NULL DEFAULT '0', + `label` varchar(255) DEFAULT NULL, + `note` text, + `fk_bank` int(11) DEFAULT NULL, + `fk_user_creat` int(11) DEFAULT NULL, + `fk_user_modif` int(11) DEFAULT NULL, + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_localtax` +-- + +LOCK TABLES `llx_localtax` WRITE; +/*!40000 ALTER TABLE `llx_localtax` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_localtax` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_mailing` +-- + +DROP TABLE IF EXISTS `llx_mailing`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_mailing` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `statut` smallint(6) DEFAULT '0', + `titre` varchar(60) DEFAULT NULL, + `entity` int(11) NOT NULL DEFAULT '1', + `sujet` varchar(60) DEFAULT NULL, + `body` mediumtext, + `bgcolor` varchar(8) DEFAULT NULL, + `bgimage` varchar(255) DEFAULT NULL, + `cible` varchar(60) DEFAULT NULL, + `nbemail` int(11) DEFAULT NULL, + `email_from` varchar(160) DEFAULT NULL, + `email_replyto` varchar(160) DEFAULT NULL, + `email_errorsto` varchar(160) DEFAULT NULL, + `tag` varchar(128) DEFAULT NULL, + `date_creat` datetime DEFAULT NULL, + `date_valid` datetime DEFAULT NULL, + `date_appro` datetime DEFAULT NULL, + `date_envoi` datetime DEFAULT NULL, + `fk_user_creat` int(11) DEFAULT NULL, + `fk_user_valid` int(11) DEFAULT NULL, + `fk_user_appro` int(11) DEFAULT NULL, + `joined_file1` varchar(255) DEFAULT NULL, + `joined_file2` varchar(255) DEFAULT NULL, + `joined_file3` varchar(255) DEFAULT NULL, + `joined_file4` varchar(255) DEFAULT NULL, + `extraparams` varchar(255) DEFAULT NULL, + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_mailing` +-- + +LOCK TABLES `llx_mailing` WRITE; +/*!40000 ALTER TABLE `llx_mailing` DISABLE KEYS */; +INSERT INTO `llx_mailing` VALUES (3,1,'My commercial emailing',1,'Buy my product','
\"\"
\r\n\"Seguici\"Seguici\"Seguici\"Seguici
\r\n\r\n\r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n

DoliCloud is the service to provide you a web hosting solution of Dolibarr ERP CRM in one click. Just enter your email to create your instance and you are ready to work. Backup and full access is to data (SFTP, Mysql) are provided.

\r\n
\r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n
Test Dolibarr ERP CRM on Dolicloud →
\r\n
\r\n
\r\n
\r\n
\r\n\r\n\r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n
DoliCloud team
\r\n Unsubscribe   |   View on web browser
\r\n
\r\n
','','',NULL,2,'dolibarr@domain.com','','',NULL,'2010-07-11 13:15:59','2010-07-11 13:46:20',NULL,NULL,1,1,NULL,NULL,NULL,NULL,NULL,NULL),(4,0,'Copy of My commercial emailing',1,'Buy my product','This is a new éEéé"Mailing content
\r\n
\r\n\r\nYou can adit it with the WYSIWYG editor.
\r\nIt is\r\n
    \r\n
  • \r\n Fast
  • \r\n
  • \r\n Easy to use
  • \r\n
  • \r\n Pretty
  • \r\n
','','',NULL,NULL,'dolibarr@domain.com','','',NULL,'2011-07-18 20:44:33',NULL,NULL,NULL,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL); +/*!40000 ALTER TABLE `llx_mailing` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_mailing_cibles` +-- + +DROP TABLE IF EXISTS `llx_mailing_cibles`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_mailing_cibles` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `fk_mailing` int(11) NOT NULL, + `fk_contact` int(11) NOT NULL, + `lastname` varchar(50) DEFAULT NULL, + `firstname` varchar(50) DEFAULT NULL, + `email` varchar(160) NOT NULL, + `other` varchar(255) DEFAULT NULL, + `tag` varchar(128) DEFAULT NULL, + `statut` smallint(6) NOT NULL DEFAULT '0', + `source_url` varchar(160) DEFAULT NULL, + `source_id` int(11) DEFAULT NULL, + `source_type` varchar(16) DEFAULT NULL, + `date_envoi` datetime DEFAULT NULL, + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_mailing_cibles` (`fk_mailing`,`email`), + KEY `idx_mailing_cibles_email` (`email`) +) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_mailing_cibles` +-- + +LOCK TABLES `llx_mailing_cibles` WRITE; +/*!40000 ALTER TABLE `llx_mailing_cibles` DISABLE KEYS */; +INSERT INTO `llx_mailing_cibles` VALUES (1,1,0,'Dupont','Alain','toto@aa.com','Date fin=10/07/2011',NULL,0,'0',NULL,NULL,NULL),(2,2,0,'Swiss customer supplier','','abademail@aa.com','',NULL,0,'0',NULL,NULL,NULL),(3,2,0,'Smith Vick','','vsmith@email.com','',NULL,0,'0',NULL,NULL,NULL),(4,3,0,'Swiss customer supplier','','abademail@aa.com','',NULL,0,'0',NULL,NULL,NULL),(5,3,0,'Smith Vick','','vsmith@email.com','',NULL,0,'0',NULL,NULL,NULL); +/*!40000 ALTER TABLE `llx_mailing_cibles` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_menu` +-- + +DROP TABLE IF EXISTS `llx_menu`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_menu` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `menu_handler` varchar(16) NOT NULL, + `entity` int(11) NOT NULL DEFAULT '1', + `module` varchar(64) DEFAULT NULL, + `type` varchar(4) NOT NULL, + `mainmenu` varchar(100) NOT NULL, + `fk_menu` int(11) NOT NULL, + `fk_leftmenu` varchar(24) DEFAULT NULL, + `fk_mainmenu` varchar(24) DEFAULT NULL, + `position` int(11) NOT NULL, + `url` varchar(255) NOT NULL, + `target` varchar(100) DEFAULT NULL, + `titre` varchar(255) NOT NULL, + `langs` varchar(100) DEFAULT NULL, + `level` smallint(6) DEFAULT NULL, + `leftmenu` varchar(100) DEFAULT NULL, + `perms` varchar(255) DEFAULT NULL, + `enabled` varchar(255) DEFAULT '1', + `usertype` int(11) NOT NULL DEFAULT '0', + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + PRIMARY KEY (`rowid`), + UNIQUE KEY `idx_menu_uk_menu` (`menu_handler`,`fk_menu`,`position`,`url`,`entity`), + KEY `idx_menu_menuhandler_type` (`menu_handler`,`type`) +) ENGINE=InnoDB AUTO_INCREMENT=145121 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_menu` +-- + +LOCK TABLES `llx_menu` WRITE; +/*!40000 ALTER TABLE `llx_menu` DISABLE KEYS */; +INSERT INTO `llx_menu` VALUES (103094,'all',2,'agenda','top','agenda',0,NULL,NULL,100,'/comm/action/index.php','','Agenda','agenda',NULL,NULL,'$user->rights->agenda->myactions->read','$conf->agenda->enabled',2,'2013-03-13 15:29:19'),(103095,'all',2,'agenda','left','agenda',103094,NULL,NULL,100,'/comm/action/index.php?mainmenu=agenda&leftmenu=agenda','','Actions','agenda',NULL,NULL,'$user->rights->agenda->myactions->read','$conf->agenda->enabled',2,'2013-03-13 15:29:19'),(103096,'all',2,'agenda','left','agenda',103095,NULL,NULL,101,'/comm/action/card.php?mainmenu=agenda&leftmenu=agenda&action=create','','NewAction','commercial',NULL,NULL,'($user->rights->agenda->myactions->create||$user->rights->agenda->allactions->create)','$conf->agenda->enabled',2,'2013-03-13 15:29:19'),(103097,'all',2,'agenda','left','agenda',103095,NULL,NULL,102,'/comm/action/index.php?mainmenu=agenda&leftmenu=agenda','','Calendar','agenda',NULL,NULL,'$user->rights->agenda->myactions->read','$conf->agenda->enabled',2,'2013-03-13 15:29:19'),(103098,'all',2,'agenda','left','agenda',103097,NULL,NULL,103,'/comm/action/index.php?mainmenu=agenda&leftmenu=agenda&status=todo&filter=mine','','MenuToDoMyActions','agenda',NULL,NULL,'$user->rights->agenda->myactions->read','$conf->agenda->enabled',2,'2013-03-13 15:29:19'),(103099,'all',2,'agenda','left','agenda',103097,NULL,NULL,104,'/comm/action/index.php?mainmenu=agenda&leftmenu=agenda&status=done&filter=mine','','MenuDoneMyActions','agenda',NULL,NULL,'$user->rights->agenda->myactions->read','$conf->agenda->enabled',2,'2013-03-13 15:29:19'),(103100,'all',2,'agenda','left','agenda',103097,NULL,NULL,105,'/comm/action/index.php?mainmenu=agenda&leftmenu=agenda&status=todo','','MenuToDoActions','agenda',NULL,NULL,'$user->rights->agenda->allactions->read','$user->rights->agenda->allactions->read',2,'2013-03-13 15:29:19'),(103101,'all',2,'agenda','left','agenda',103097,NULL,NULL,106,'/comm/action/index.php?mainmenu=agenda&leftmenu=agenda&status=done','','MenuDoneActions','agenda',NULL,NULL,'$user->rights->agenda->allactions->read','$user->rights->agenda->allactions->read',2,'2013-03-13 15:29:19'),(103102,'all',2,'agenda','left','agenda',103095,NULL,NULL,112,'/comm/action/listactions.php?mainmenu=agenda&leftmenu=agenda','','List','agenda',NULL,NULL,'$user->rights->agenda->myactions->read','$conf->agenda->enabled',2,'2013-03-13 15:29:19'),(103103,'all',2,'agenda','left','agenda',103102,NULL,NULL,113,'/comm/action/listactions.php?mainmenu=agenda&leftmenu=agenda&status=todo&filter=mine','','MenuToDoMyActions','agenda',NULL,NULL,'$user->rights->agenda->myactions->read','$conf->agenda->enabled',2,'2013-03-13 15:29:19'),(103104,'all',2,'agenda','left','agenda',103102,NULL,NULL,114,'/comm/action/listactions.php?mainmenu=agenda&leftmenu=agenda&status=done&filter=mine','','MenuDoneMyActions','agenda',NULL,NULL,'$user->rights->agenda->myactions->read','$conf->agenda->enabled',2,'2013-03-13 15:29:19'),(103105,'all',2,'agenda','left','agenda',103102,NULL,NULL,115,'/comm/action/listactions.php?mainmenu=agenda&leftmenu=agenda&status=todo','','MenuToDoActions','agenda',NULL,NULL,'$user->rights->agenda->allactions->read','$user->rights->agenda->allactions->read',2,'2013-03-13 15:29:19'),(103106,'all',2,'agenda','left','agenda',103102,NULL,NULL,116,'/comm/action/listactions.php?mainmenu=agenda&leftmenu=agenda&status=done','','MenuDoneActions','agenda',NULL,NULL,'$user->rights->agenda->allactions->read','$user->rights->agenda->allactions->read',2,'2013-03-13 15:29:19'),(103107,'all',2,'agenda','left','agenda',103095,NULL,NULL,120,'/comm/action/rapport/index.php?mainmenu=agenda&leftmenu=agenda','','Reportings','agenda',NULL,NULL,'$user->rights->agenda->allactions->read','$conf->agenda->enabled',2,'2013-03-13 15:29:19'),(103108,'all',2,'pos','top','pos',0,NULL,NULL,100,'/pos/backend/listefac.php','','POS','pos@pos',NULL,'1','1','1',2,'2013-03-13 20:33:09'),(103109,'all',2,'pos','left','pos',103108,NULL,NULL,100,'/pos/backend/list.php','','Tickets','pos@pos',NULL,NULL,'$user->rights->pos->backend','$conf->global->POS_USE_TICKETS',0,'2013-03-13 20:33:09'),(103110,'all',2,'pos','left','pos',103109,NULL,NULL,100,'/pos/backend/list.php','','List','main',NULL,NULL,'$user->rights->pos->backend','$conf->global->POS_USE_TICKETS',0,'2013-03-13 20:33:09'),(103111,'all',2,'pos','left','pos',103110,NULL,NULL,100,'/pos/backend/list.php?viewstatut=0','','StatusTicketDraft','pos@pos',NULL,NULL,'$user->rights->pos->backend','$conf->global->POS_USE_TICKETS',0,'2013-03-13 20:33:09'),(103112,'all',2,'pos','left','@pos',103110,NULL,NULL,100,'/pos/backend/list.php?viewstatut=1','','StatusTicketClosed','main',NULL,NULL,'$user->rights->pos->backend','$conf->global->POS_USE_TICKETS',0,'2013-03-13 20:33:09'),(103113,'all',2,'pos','left','@pos',103110,NULL,NULL,100,'/pos/backend/list.php?viewstatut=2','','StatusTicketProcessed','main',NULL,NULL,'$user->rights->pos->backend','$conf->global->POS_USE_TICKETS',0,'2013-03-13 20:33:09'),(103114,'all',2,'pos','left','@pos',103110,NULL,NULL,100,'/pos/backend/list.php?viewtype=1','','StatusTicketReturned','main',NULL,NULL,'$user->rights->pos->backend','$conf->global->POS_USE_TICKETS',0,'2013-03-13 20:33:09'),(103115,'all',2,'pos','left','pos',103108,NULL,NULL,100,'/pos/backend/listefac.php','','Factures','pos@pos',NULL,NULL,'$user->rights->pos->backend','1',0,'2013-03-13 20:33:09'),(103116,'all',2,'pos','left','pos',103115,NULL,NULL,100,'/pos/backend/listefac.php','','List','main',NULL,NULL,'$user->rights->pos->backend','1',0,'2013-03-13 20:33:09'),(103117,'all',2,'pos','left','pos',103116,NULL,NULL,100,'/pos/backend/listefac.php?viewstatut=0','','BillStatusDraft','bills',NULL,NULL,'$user->rights->pos->backend','1',0,'2013-03-13 20:33:09'),(103118,'all',2,'pos','left','@pos',103116,NULL,NULL,100,'/pos/backend/listefac.php?viewstatut=1','','BillStatusValidated','bills',NULL,NULL,'$user->rights->pos->backend','1',0,'2013-03-13 20:33:09'),(103119,'all',2,'pos','left','@pos',103116,NULL,NULL,100,'/pos/backend/listefac.php?viewstatut=2&viewtype=0','','BillStatusPaid','bills',NULL,NULL,'$user->rights->pos->backend','1',0,'2013-03-13 20:33:09'),(103120,'all',2,'pos','left','@pos',103116,NULL,NULL,100,'/pos/backend/listefac.php?viewtype=2','','BillStatusReturned','main',NULL,NULL,'$user->rights->pos->backend','1',0,'2013-03-13 20:33:09'),(103121,'all',2,'pos','left','@pos',103108,NULL,NULL,100,'/pos/frontend/index.php','','POS','main',NULL,NULL,'$user->rights->pos->frontend','1',0,'2013-03-13 20:33:09'),(103122,'all',2,'pos','left','@pos',103121,NULL,NULL,100,'/pos/frontend/index.php','','NewTicket','main',NULL,NULL,'$user->rights->pos->frontend','1',0,'2013-03-13 20:33:09'),(103123,'all',2,'pos','left','@pos',103121,NULL,NULL,101,'/pos/backend/closes.php','','CloseandArching','main',NULL,NULL,'$user->rights->pos->backend','1',0,'2013-03-13 20:33:09'),(103124,'all',2,'pos','left','@pos',103108,NULL,NULL,100,'/pos/backend/terminal/cash.php','','Terminal','main',NULL,NULL,'$user->rights->pos->backend','1',0,'2013-03-13 20:33:09'),(103125,'all',2,'pos','left','@pos',103124,NULL,NULL,100,'/pos/backend/terminal/card.php?action=create','','NewCash','main',NULL,NULL,'$user->rights->pos->backend','1',0,'2013-03-13 20:33:09'),(103126,'all',2,'pos','left','@pos',103124,NULL,NULL,101,'/pos/backend/terminal/cash.php','','List','main',NULL,NULL,'$user->rights->pos->backend','1',0,'2013-03-13 20:33:09'),(103127,'all',2,'pos','left','@pos',103123,NULL,NULL,101,'/pos/backend/closes.php?viewstatut=0','','Arqueo','main',NULL,NULL,'$user->rights->pos->backend','1',0,'2013-03-13 20:33:09'),(103128,'all',2,'pos','left','@pos',103123,NULL,NULL,102,'/pos/backend/closes.php?viewstatut=1','','Closes','main',NULL,NULL,'$user->rights->pos->backend','1',0,'2013-03-13 20:33:09'),(103129,'all',2,'pos','left','@pos',103108,NULL,NULL,102,'/pos/backend/transfers.php','','Transfer','main',NULL,NULL,'$user->rights->pos->transfer','1',0,'2013-03-13 20:33:09'),(103130,'all',2,'pos','left','@pos',103108,NULL,NULL,102,'/pos/backend/resultat/index.php','','Rapport','main',NULL,NULL,'$user->rights->pos->stats','1',0,'2013-03-13 20:33:09'),(103131,'all',2,'pos','left','@pos',103130,NULL,NULL,102,'/pos/backend/resultat/casoc.php','','ReportsCustomer','main',NULL,NULL,'$user->rights->pos->stats','1',0,'2013-03-13 20:33:09'),(103132,'all',2,'pos','left','@pos',103130,NULL,NULL,102,'/pos/backend/resultat/causer.php','','ReportsUser','main',NULL,NULL,'$user->rights->pos->stats','1',0,'2013-03-13 20:33:09'),(103133,'all',2,'pos','left','@pos',103130,NULL,NULL,102,'/pos/backend/resultat/sellsjournal.php','','ReportsSells','main',NULL,NULL,'$user->rights->pos->stats','1',0,'2013-03-13 20:33:09'),(103134,'all',2,'opensurvey','top','opensurvey',0,NULL,NULL,200,'/opensurvey/index.php','','Surveys','opensurvey',NULL,NULL,'$user->rights->opensurvey->survey->read','$conf->opensurvey->enabled',0,'2013-03-13 20:33:42'),(103135,'all',2,'opensurvey','left','opensurvey',-1,NULL,'opensurvey',200,'/opensurvey/index.php?mainmenu=opensurvey&leftmenu=opensurvey','','Survey','opensurvey@opensurvey',NULL,'opensurvey','','$conf->opensurvey->enabled',0,'2013-03-13 20:33:42'),(103136,'all',2,'opensurvey','left','opensurvey',-1,'opensurvey','opensurvey',210,'/opensurvey/public/index.php','_blank','NewSurvey','opensurvey@opensurvey',NULL,'opensurvey_new','','$conf->opensurvey->enabled',0,'2013-03-13 20:33:42'),(103137,'all',2,'opensurvey','left','opensurvey',-1,'opensurvey','opensurvey',220,'/opensurvey/list.php','','List','opensurvey@opensurvey',NULL,'opensurvey_list','','$conf->opensurvey->enabled',0,'2013-03-13 20:33:42'),(124179,'all',1,'cashdesk','top','cashdesk',0,NULL,NULL,100,'/cashdesk/index.php?user=__LOGIN__','pointofsale','CashDeskMenu','cashdesk',NULL,NULL,'$user->rights->cashdesk->use','$conf->cashdesk->enabled',0,'2015-11-15 22:38:33'),(124210,'all',1,'margins','left','accountancy',-1,NULL,'accountancy',100,'/margin/index.php','','Margins','margins',NULL,'margins','$user->rights->margins->liretous','$conf->margin->enabled',2,'2015-11-15 22:41:47'),(134675,'all',1,'ecm','top','ecm',0,NULL,NULL,100,'/ecm/index.php','','MenuECM','ecm',NULL,NULL,'$user->rights->ecm->read || $user->rights->ecm->upload || $user->rights->ecm->setup','$conf->ecm->enabled',2,'2016-01-22 17:26:43'),(134676,'all',1,'ecm','left','ecm',-1,NULL,'ecm',101,'/ecm/index.php?mainmenu=ecm&leftmenu=ecm','','ECMArea','ecm',NULL,'ecm','$user->rights->ecm->read || $user->rights->ecm->upload','$user->rights->ecm->read || $user->rights->ecm->upload',2,'2016-01-22 17:26:43'),(134677,'all',1,'ecm','left','ecm',-1,'ecm','ecm',102,'/ecm/index.php?action=file_manager&mainmenu=ecm&leftmenu=ecm','','ECMSectionsManual','ecm',NULL,'ecm_manual','$user->rights->ecm->read || $user->rights->ecm->upload','$user->rights->ecm->read || $user->rights->ecm->upload',2,'2016-01-22 17:26:43'),(134678,'all',1,'ecm','left','ecm',-1,'ecm','ecm',103,'/ecm/index_auto.php?action=file_manager&mainmenu=ecm&leftmenu=ecm','','ECMSectionsAuto','ecm',NULL,NULL,'$user->rights->ecm->read || $user->rights->ecm->upload','$user->rights->ecm->read || $user->rights->ecm->upload',2,'2016-01-22 17:26:43'),(139883,'all',1,'barcode','left','tools',-1,NULL,'tools',200,'/barcode/printsheet.php?mainmenu=tools&leftmenu=barcodeprint','','BarCodePrintsheet','products',NULL,'barcodeprint','($conf->global->MAIN_USE_ADVANCED_PERMS && $user->rights->barcode->lire_advance) || (! $conf->global->MAIN_USE_ADVANCED_PERMS)','$conf->barcode->enabled',2,'2016-07-30 11:12:59'),(139884,'all',1,'barcode','left','home',-1,'admintools','home',300,'/barcode/codeinit.php?mainmenu=home&leftmenu=admintools','','MassBarcodeInit','products',NULL,NULL,'($conf->global->MAIN_USE_ADVANCED_PERMS && $user->rights->barcode->creer_advance) || (! $conf->global->MAIN_USE_ADVANCED_PERMS)','$conf->barcode->enabled && $leftmenu==\"admintools\"',0,'2016-07-30 11:12:59'),(139885,'auguria',1,'','top','home',0,NULL,NULL,10,'/index.php?mainmenu=home&leftmenu=','','Home','',-1,'','','1',2,'2016-07-30 11:13:00'),(139886,'auguria',1,'societe|fournisseur','top','companies',0,NULL,NULL,20,'/societe/index.php?mainmenu=companies&leftmenu=','','ThirdParties','companies',-1,'','$user->rights->societe->lire || $user->rights->societe->contact->lire','( ! empty($conf->societe->enabled) && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))) || ! empty($conf->fournisseur->enabled)',2,'2016-07-30 11:13:00'),(139887,'auguria',1,'product|service','top','products',0,NULL,NULL,30,'/product/index.php?mainmenu=products&leftmenu=','','Products/Services','products',-1,'','$user->rights->produit->lire||$user->rights->service->lire','$conf->product->enabled || $conf->service->enabled',0,'2016-07-30 11:13:00'),(139889,'auguria',1,'propal|commande|fournisseur|contrat|ficheinter','top','commercial',0,NULL,NULL,40,'/comm/index.php?mainmenu=commercial&leftmenu=','','Commercial','commercial',-1,'','$user->rights->societe->lire || $user->rights->societe->contact->lire','$conf->propal->enabled || $conf->commande->enabled || $conf->supplier_order->enabled || $conf->contrat->enabled || $conf->ficheinter->enabled',2,'2016-07-30 11:13:00'),(139890,'auguria',1,'comptabilite|accounting|facture|don|tax|salaries|loan','top','accountancy',0,NULL,NULL,50,'/compta/index.php?mainmenu=accountancy&leftmenu=','','MenuFinancial','compta',-1,'','$user->rights->compta->resultat->lire || $user->rights->accounting->plancompte->lire || $user->rights->facture->lire|| $user->rights->don->lire || $user->rights->tax->charges->lire || $user->rights->salaries->read || $user->rights->loan->read','$conf->comptabilite->enabled || $conf->accounting->enabled || $conf->facture->enabled || $conf->don->enabled || $conf->tax->enabled || $conf->salaries->enabled || $conf->supplier_invoice->enabled || $conf->loan->enabled',2,'2016-07-30 11:13:00'),(139891,'auguria',1,'projet','top','project',0,NULL,NULL,70,'/projet/index.php?mainmenu=project&leftmenu=','','Projects','projects',-1,'','$user->rights->projet->lire','$conf->projet->enabled',2,'2016-07-30 11:13:00'),(139892,'auguria',1,'mailing|export|import|opensurvey|resource','top','tools',0,NULL,NULL,90,'/core/tools.php?mainmenu=tools&leftmenu=','','Tools','other',-1,'','$user->rights->mailing->lire || $user->rights->export->lire || $user->rights->import->run || $user->rights->opensurvey->read || $user->rights->resource->read','$conf->mailing->enabled || $conf->export->enabled || $conf->import->enabled || $conf->opensurvey->enabled || $conf->resource->enabled',2,'2016-07-30 11:13:00'),(139897,'auguria',1,'adherent','top','members',0,NULL,NULL,110,'/adherents/index.php?mainmenu=members&leftmenu=','','Members','members',-1,'','$user->rights->adherent->lire','$conf->adherent->enabled',2,'2016-07-30 11:13:00'),(139898,'auguria',1,'banque|prelevement','top','bank',0,NULL,NULL,60,'/compta/bank/index.php?mainmenu=bank&leftmenu=bank','','MenuBankCash','banks',-1,'','$user->rights->banque->lire || $user->rights->prelevement->bons->lire','$conf->banque->enabled || $conf->prelevement->enabled',0,'2016-07-30 11:13:00'),(139899,'auguria',1,'hrm|holiday|deplacement|expensereport','top','hrm',0,NULL,NULL,80,'/hrm/hrm.php?mainmenu=hrm&leftmenu=','','HRM','holiday',-1,'','$user->rights->hrm->employee->read || $user->rights->holiday->write || $user->rights->deplacement->lire || $user->rights->expensereport->lire','$conf->hrm->enabled || $conf->holiday->enabled || $conf->deplacement->enabled || $conf->expensereport->enabled',0,'2016-07-30 11:13:00'),(139974,'auguria',1,'','left','home',139885,NULL,NULL,0,'/index.php','','Dashboard','',0,'','','1',2,'2016-07-30 11:13:00'),(139984,'auguria',1,'','left','home',139885,NULL,NULL,1,'/admin/index.php?leftmenu=setup','','Setup','admin',0,'setup','','$user->admin',2,'2016-07-30 11:13:00'),(139985,'auguria',1,'','left','home',139984,NULL,NULL,1,'/admin/company.php?leftmenu=setup','','MenuCompanySetup','admin',1,'','','$leftmenu==\"setup\"',2,'2016-07-30 11:13:00'),(139986,'auguria',1,'','left','home',139984,NULL,NULL,4,'/admin/ihm.php?leftmenu=setup','','GUISetup','admin',1,'','','$leftmenu==\"setup\"',2,'2016-07-30 11:13:00'),(139987,'auguria',1,'','left','home',139984,NULL,NULL,2,'/admin/modules.php?leftmenu=setup','','Modules','admin',1,'','','$leftmenu==\"setup\"',2,'2016-07-30 11:13:00'),(139988,'auguria',1,'','left','home',139984,NULL,NULL,6,'/admin/boxes.php?leftmenu=setup','','Boxes','admin',1,'','','$leftmenu==\"setup\"',2,'2016-07-30 11:13:00'),(139989,'auguria',1,'','left','home',139984,NULL,NULL,3,'/admin/menus.php?leftmenu=setup','','Menus','admin',1,'','','$leftmenu==\"setup\"',2,'2016-07-30 11:13:00'),(139990,'auguria',1,'','left','home',139984,NULL,NULL,7,'/admin/delais.php?leftmenu=setup','','Alerts','admin',1,'','','$leftmenu==\"setup\"',2,'2016-07-30 11:13:00'),(139991,'auguria',1,'','left','home',139984,NULL,NULL,10,'/admin/pdf.php?leftmenu=setup','','PDF','admin',1,'','','$leftmenu==\"setup\"',2,'2016-07-30 11:13:00'),(139992,'auguria',1,'','left','home',139984,NULL,NULL,8,'/admin/security_other.php?leftmenu=setup','','Security','admin',1,'','','$leftmenu==\"setup\"',2,'2016-07-30 11:13:00'),(139993,'auguria',1,'','left','home',139984,NULL,NULL,11,'/admin/mails.php?leftmenu=setup','','Emails','admin',1,'','','$leftmenu==\"setup\"',2,'2016-07-30 11:13:00'),(139994,'auguria',1,'','left','home',139984,NULL,NULL,9,'/admin/limits.php?leftmenu=setup','','MenuLimits','admin',1,'','','$leftmenu==\"setup\"',2,'2016-07-30 11:13:00'),(139995,'auguria',1,'','left','home',139984,NULL,NULL,13,'/admin/dict.php?leftmenu=setup','','Dictionary','admin',1,'','','$leftmenu==\"setup\"',2,'2016-07-30 11:13:00'),(139996,'auguria',1,'','left','home',139984,NULL,NULL,14,'/admin/const.php?leftmenu=setup','','OtherSetup','admin',1,'','','$leftmenu==\"setup\"',2,'2016-07-30 11:13:00'),(139997,'auguria',1,'','left','home',139984,NULL,NULL,12,'/admin/sms.php?leftmenu=setup','','SMS','admin',1,'','','$leftmenu==\"setup\"',2,'2016-07-30 11:13:00'),(139998,'auguria',1,'','left','home',139984,NULL,NULL,4,'/admin/translation.php?leftmenu=setup','','Translation','admin',1,'','','$leftmenu==\"setup\"',2,'2016-07-30 11:13:00'),(139999,'auguria',1,'','left','home',139984,NULL,NULL,4,'/accountancy/admin/fiscalyear.php?mainmenu=setup','','Fiscalyear','admin',1,'','','$leftmenu==\"setup\" && $conf->accounting->enabled',2,'2016-07-30 11:13:00'),(140085,'auguria',1,'','left','home',140184,NULL,NULL,0,'/admin/system/dolibarr.php?leftmenu=admintools','','InfoDolibarr','admin',1,'','','$leftmenu==\"admintools\"',2,'2016-07-30 11:13:00'),(140086,'auguria',1,'','left','home',140085,NULL,NULL,2,'/admin/system/modules.php?leftmenu=admintools','','Modules','admin',2,'','','$leftmenu==\"admintools\"',2,'2016-07-30 11:13:00'),(140087,'auguria',1,'','left','home',140085,NULL,NULL,3,'/admin/triggers.php?leftmenu=admintools','','Triggers','admin',2,'','','$leftmenu==\"admintools\"',2,'2016-07-30 11:13:00'),(140089,'auguria',1,'','left','home',140184,NULL,NULL,1,'/admin/system/browser.php?leftmenu=admintools','','InfoBrowser','admin',1,'','','$leftmenu==\"admintools\"',2,'2016-07-30 11:13:00'),(140090,'auguria',1,'','left','home',140184,NULL,NULL,2,'/admin/system/os.php?leftmenu=admintools','','InfoOS','admin',1,'','','$leftmenu==\"admintools\"',2,'2016-07-30 11:13:00'),(140091,'auguria',1,'','left','home',140184,NULL,NULL,3,'/admin/system/web.php?leftmenu=admintools','','InfoWebServer','admin',1,'','','$leftmenu==\"admintools\"',2,'2016-07-30 11:13:00'),(140092,'auguria',1,'','left','home',140184,NULL,NULL,4,'/admin/system/phpinfo.php?leftmenu=admintools','','InfoPHP','admin',1,'','','$leftmenu==\"admintools\"',2,'2016-07-30 11:13:00'),(140094,'auguria',1,'','left','home',140184,NULL,NULL,5,'/admin/system/database.php?leftmenu=admintools','','InfoDatabase','admin',1,'','','$leftmenu==\"admintools\"',2,'2016-07-30 11:13:00'),(140184,'auguria',1,'','left','home',139885,NULL,NULL,2,'/admin/tools/index.php?leftmenu=admintools','','AdminTools','admin',0,'admintools','','$user->admin',2,'2016-07-30 11:13:00'),(140185,'auguria',1,'','left','home',140184,NULL,NULL,6,'/admin/tools/dolibarr_export.php?leftmenu=admintools','','Backup','admin',1,'','','$leftmenu==\"admintools\"',2,'2016-07-30 11:13:00'),(140186,'auguria',1,'','left','home',140184,NULL,NULL,7,'/admin/tools/dolibarr_import.php?leftmenu=admintools','','Restore','admin',1,'','','$leftmenu==\"admintools\"',2,'2016-07-30 11:13:00'),(140189,'auguria',1,'','left','home',140184,NULL,NULL,8,'/admin/tools/update.php?leftmenu=admintools','','MenuUpgrade','admin',1,'','','$leftmenu==\"admintools\"',2,'2016-07-30 11:13:00'),(140190,'auguria',1,'','left','home',140184,NULL,NULL,9,'/admin/tools/eaccelerator.php?leftmenu=admintools','','EAccelerator','admin',1,'','','$leftmenu==\"admintools\" && function_exists(\"eaccelerator_info\")',2,'2016-07-30 11:13:00'),(140191,'auguria',1,'','left','home',140184,NULL,NULL,10,'/admin/tools/listevents.php?leftmenu=admintools','','Audit','admin',1,'','','$leftmenu==\"admintools\"',2,'2016-07-30 11:13:00'),(140192,'auguria',1,'','left','home',140184,NULL,NULL,11,'/admin/tools/listsessions.php?leftmenu=admintools','','Sessions','admin',1,'','','$leftmenu==\"admintools\"',2,'2016-07-30 11:13:00'),(140193,'auguria',1,'','left','home',140184,NULL,NULL,12,'/admin/tools/purge.php?leftmenu=admintools','','Purge','admin',1,'','','$leftmenu==\"admintools\"',2,'2016-07-30 11:13:00'),(140194,'auguria',1,'','left','home',140184,NULL,NULL,13,'/support/index.php?leftmenu=admintools','_blank','HelpCenter','help',1,'','','$leftmenu==\"admintools\"',2,'2016-07-30 11:13:00'),(140195,'auguria',1,'','left','home',140184,NULL,NULL,14,'/admin/system/about.php?leftmenu=admintools','','About','admin',1,'','','$leftmenu==\"admintools\"',2,'2016-07-30 11:13:00'),(140204,'auguria',1,'','left','home',140184,NULL,NULL,0,'/product/admin/product_tools.php?mainmenu=home&leftmenu=admintools','','ProductVatMassChange','products',1,'','','$leftmenu==\"admintools\"',2,'2016-07-30 11:13:00'),(140205,'auguria',1,'','left','home',140184,NULL,NULL,0,'/accountancy/admin/productaccount.php?mainmenu=home&leftmenu=admintools','','InitAccountancy','accountancy',1,'','','$leftmenu==\"admintools\" && $conf->accounting->enabled',2,'2016-07-30 11:13:00'),(140284,'auguria',1,'','left','home',139885,NULL,NULL,4,'/user/home.php?leftmenu=users','','MenuUsersAndGroups','users',0,'users','','1',2,'2016-07-30 11:13:00'),(140285,'auguria',1,'','left','home',140284,NULL,NULL,0,'/user/index.php?leftmenu=users','','Users','users',1,'','$user->rights->user->user->lire || $user->admin','$leftmenu==\"users\"',2,'2016-07-30 11:13:00'),(140286,'auguria',1,'','left','home',140285,NULL,NULL,0,'/user/card.php?leftmenu=users&action=create','','NewUser','users',2,'','$user->rights->user->user->creer || $user->admin','$leftmenu==\"users\"',2,'2016-07-30 11:13:00'),(140287,'auguria',1,'','left','home',140284,NULL,NULL,1,'/user/group/index.php?leftmenu=users','','Groups','users',1,'','($conf->global->MAIN_USE_ADVANCED_PERMS?$user->rights->user->group_advance->read:$user->rights->user->user->lire) || $user->admin','$leftmenu==\"users\"',2,'2016-07-30 11:13:00'),(140288,'auguria',1,'','left','home',140287,NULL,NULL,0,'/user/group/card.php?leftmenu=users&action=create','','NewGroup','users',2,'','($conf->global->MAIN_USE_ADVANCED_PERMS?$user->rights->user->group_advance->write:$user->rights->user->user->creer) || $user->admin','$leftmenu==\"users\"',2,'2016-07-30 11:13:00'),(140384,'auguria',1,'','left','companies',139886,NULL,NULL,0,'/societe/index.php?leftmenu=thirdparties','','ThirdParty','companies',0,'thirdparties','$user->rights->societe->lire','$conf->societe->enabled',2,'2016-07-30 11:13:00'),(140385,'auguria',1,'','left','companies',140384,NULL,NULL,0,'/societe/soc.php?action=create','','MenuNewThirdParty','companies',1,'','$user->rights->societe->lire','$conf->societe->enabled',2,'2016-07-30 11:13:00'),(140386,'auguria',1,'','left','companies',140384,NULL,NULL,0,'/societe/list.php?action=create','','List','companies',1,'','$user->rights->societe->lire','$conf->societe->enabled',2,'2016-07-30 11:13:00'),(140387,'auguria',1,'','left','companies',140384,NULL,NULL,5,'/societe/list.php?type=f&leftmenu=suppliers','','ListSuppliersShort','suppliers',1,'','$user->rights->societe->lire && $user->rights->fournisseur->lire','$conf->societe->enabled && $conf->fournisseur->enabled',2,'2016-07-30 11:13:00'),(140388,'auguria',1,'','left','companies',140387,NULL,NULL,0,'/societe/soc.php?leftmenu=supplier&action=create&type=f','','NewSupplier','suppliers',2,'','$user->rights->societe->creer','$conf->societe->enabled && $conf->fournisseur->enabled',2,'2016-07-30 11:13:00'),(140390,'auguria',1,'','left','companies',140384,NULL,NULL,3,'/societe/list.php?type=p&leftmenu=prospects','','ListProspectsShort','companies',1,'','$user->rights->societe->lire','$conf->societe->enabled',2,'2016-07-30 11:13:00'),(140391,'auguria',1,'','left','companies',140390,NULL,NULL,0,'/societe/soc.php?leftmenu=prospects&action=create&type=p','','MenuNewProspect','companies',2,'','$user->rights->societe->creer','$conf->societe->enabled',2,'2016-07-30 11:13:00'),(140393,'auguria',1,'','left','companies',140384,NULL,NULL,4,'/societe/list.php?type=c&leftmenu=customers','','ListCustomersShort','companies',1,'','$user->rights->societe->lire','$conf->societe->enabled',2,'2016-07-30 11:13:00'),(140394,'auguria',1,'','left','companies',140393,NULL,NULL,0,'/societe/soc.php?leftmenu=customers&action=create&type=c','','MenuNewCustomer','companies',2,'','$user->rights->societe->creer','$conf->societe->enabled',2,'2016-07-30 11:13:00'),(140484,'auguria',1,'','left','companies',139886,NULL,NULL,1,'/contact/list.php?leftmenu=contacts','','ContactsAddresses','companies',0,'contacts','$user->rights->societe->lire','$conf->societe->enabled',2,'2016-07-30 11:13:00'),(140485,'auguria',1,'','left','companies',140484,NULL,NULL,0,'/contact/card.php?leftmenu=contacts&action=create','','NewContactAddress','companies',1,'','$user->rights->societe->creer','$conf->societe->enabled',2,'2016-07-30 11:13:00'),(140486,'auguria',1,'','left','companies',140484,NULL,NULL,1,'/contact/list.php?leftmenu=contacts','','List','companies',1,'','$user->rights->societe->lire','$conf->societe->enabled',2,'2016-07-30 11:13:00'),(140488,'auguria',1,'','left','companies',140486,NULL,NULL,1,'/contact/list.php?leftmenu=contacts&type=p','','ThirdPartyProspects','companies',2,'','$user->rights->societe->contact->lire','$conf->societe->enabled',2,'2016-07-30 11:13:00'),(140489,'auguria',1,'','left','companies',140486,NULL,NULL,2,'/contact/list.php?leftmenu=contacts&type=c','','ThirdPartyCustomers','companies',2,'','$user->rights->societe->contact->lire','$conf->societe->enabled',2,'2016-07-30 11:13:00'),(140490,'auguria',1,'','left','companies',140486,NULL,NULL,3,'/contact/list.php?leftmenu=contacts&type=f','','ThirdPartySuppliers','companies',2,'','$user->rights->societe->contact->lire','$conf->societe->enabled && $conf->fournisseur->enabled',2,'2016-07-30 11:13:00'),(140491,'auguria',1,'','left','companies',140486,NULL,NULL,4,'/contact/list.php?leftmenu=contacts&type=o','','Others','companies',2,'','$user->rights->societe->contact->lire','$conf->societe->enabled',2,'2016-07-30 11:13:00'),(140534,'auguria',1,'','left','companies',139886,NULL,NULL,3,'/categories/index.php?leftmenu=cat&type=1','','SuppliersCategoriesShort','categories',0,'cat','$user->rights->categorie->lire','$conf->societe->enabled && $conf->categorie->enabled',2,'2016-07-30 11:13:00'),(140535,'auguria',1,'','left','companies',140534,NULL,NULL,0,'/categories/card.php?action=create&type=1','','NewCategory','categories',1,'','$user->rights->categorie->creer','$conf->societe->enabled && $conf->categorie->enabled',2,'2016-07-30 11:13:00'),(140544,'auguria',1,'','left','companies',139886,NULL,NULL,4,'/categories/index.php?leftmenu=cat&type=2','','CustomersProspectsCategoriesShort','categories',0,'cat','$user->rights->categorie->lire','$conf->fournisseur->enabled && $conf->categorie->enabled',2,'2016-07-30 11:13:00'),(140545,'auguria',1,'','left','companies',140544,NULL,NULL,0,'/categories/card.php?action=create&type=2','','NewCategory','categories',1,'','$user->rights->categorie->creer','$conf->fournisseur->enabled && $conf->categorie->enabled',2,'2016-07-30 11:13:00'),(140554,'auguria',1,'','left','companies',139886,NULL,NULL,3,'/categories/index.php?leftmenu=cat&type=4','','ContactCategoriesShort','categories',0,'cat','$user->rights->categorie->lire','$conf->societe->enabled && $conf->categorie->enabled',2,'2016-07-30 11:13:00'),(140555,'auguria',1,'','left','companies',140554,NULL,NULL,0,'/categories/card.php?action=create&type=4','','NewCategory','categories',1,'','$user->rights->categorie->creer','$conf->societe->enabled && $conf->categorie->enabled',2,'2016-07-30 11:13:00'),(140984,'auguria',1,'','left','commercial',139889,NULL,NULL,4,'/comm/propal/index.php?leftmenu=propals','','Prop','propal',0,'propals','$user->rights->propale->lire','$conf->propal->enabled',2,'2016-07-30 11:13:00'),(140985,'auguria',1,'','left','commercial',140984,NULL,NULL,0,'/comm/propal/card.php?action=create&leftmenu=propals','','NewPropal','propal',1,'','$user->rights->propale->creer','$conf->propal->enabled',2,'2016-07-30 11:13:00'),(140986,'auguria',1,'','left','commercial',140984,NULL,NULL,1,'/comm/propal/list.php?leftmenu=propals','','List','propal',1,'','$user->rights->propale->lire','$conf->propal->enabled',2,'2016-07-30 11:13:00'),(140987,'auguria',1,'','left','commercial',140986,NULL,NULL,2,'/comm/propal/list.php?leftmenu=propals&viewstatut=0','','PropalsDraft','propal',1,'','$user->rights->propale->lire','$conf->propal->enabled && $leftmenu==\"propals\"',2,'2016-07-30 11:13:00'),(140988,'auguria',1,'','left','commercial',140986,NULL,NULL,3,'/comm/propal/list.php?leftmenu=propals&viewstatut=1','','PropalsOpened','propal',1,'','$user->rights->propale->lire','$conf->propal->enabled && $leftmenu==\"propals\"',2,'2016-07-30 11:13:00'),(140989,'auguria',1,'','left','commercial',140986,NULL,NULL,4,'/comm/propal/list.php?leftmenu=propals&viewstatut=2','','PropalStatusSigned','propal',1,'','$user->rights->propale->lire','$conf->propal->enabled && $leftmenu==\"propals\"',2,'2016-07-30 11:13:00'),(140990,'auguria',1,'','left','commercial',140986,NULL,NULL,5,'/comm/propal/list.php?leftmenu=propals&viewstatut=3','','PropalStatusNotSigned','propal',1,'','$user->rights->propale->lire','$conf->propal->enabled && $leftmenu==\"propals\"',2,'2016-07-30 11:13:00'),(140991,'auguria',1,'','left','commercial',140986,NULL,NULL,6,'/comm/propal/list.php?leftmenu=propals&viewstatut=4','','PropalStatusBilled','propal',1,'','$user->rights->propale->lire','$conf->propal->enabled && $leftmenu==\"propals\"',2,'2016-07-30 11:13:00'),(140994,'auguria',1,'','left','commercial',140984,NULL,NULL,4,'/comm/propal/stats/index.php?leftmenu=propals','','Statistics','propal',1,'','$user->rights->propale->lire','$conf->propal->enabled',2,'2016-07-30 11:13:00'),(141084,'auguria',1,'','left','commercial',139889,NULL,NULL,5,'/commande/index.php?leftmenu=orders','','CustomersOrders','orders',0,'orders','$user->rights->commande->lire','$conf->commande->enabled',2,'2016-07-30 11:13:00'),(141085,'auguria',1,'','left','commercial',141084,NULL,NULL,0,'/commande/card.php?action=create&leftmenu=orders','','NewOrder','orders',1,'','$user->rights->commande->creer','$conf->commande->enabled',2,'2016-07-30 11:13:00'),(141086,'auguria',1,'','left','commercial',141084,NULL,NULL,1,'/commande/list.php?leftmenu=orders','','List','orders',1,'','$user->rights->commande->lire','$conf->commande->enabled',2,'2016-07-30 11:13:00'),(141087,'auguria',1,'','left','commercial',141086,NULL,NULL,2,'/commande/list.php?leftmenu=orders&viewstatut=0','','StatusOrderDraftShort','orders',1,'','$user->rights->commande->lire','$conf->commande->enabled && $leftmenu==\"orders\"',2,'2016-07-30 11:13:00'),(141088,'auguria',1,'','left','commercial',141086,NULL,NULL,3,'/commande/list.php?leftmenu=orders&viewstatut=1','','StatusOrderValidated','orders',1,'','$user->rights->commande->lire','$conf->commande->enabled && $leftmenu==\"orders\"',2,'2016-07-30 11:13:00'),(141089,'auguria',1,'','left','commercial',141086,NULL,NULL,4,'/commande/list.php?leftmenu=orders&viewstatut=2','','StatusOrderOnProcessShort','orders',1,'','$user->rights->commande->lire','$conf->commande->enabled && $leftmenu==\"orders\"',2,'2016-07-30 11:13:00'),(141090,'auguria',1,'','left','commercial',141086,NULL,NULL,5,'/commande/list.php?leftmenu=orders&viewstatut=3','','StatusOrderToBill','orders',1,'','$user->rights->commande->lire','$conf->commande->enabled && $leftmenu==\"orders\"',2,'2016-07-30 11:13:00'),(141091,'auguria',1,'','left','commercial',141086,NULL,NULL,6,'/commande/list.php?leftmenu=orders&viewstatut=4','','StatusOrderProcessed','orders',1,'','$user->rights->commande->lire','$conf->commande->enabled && $leftmenu==\"orders\"',2,'2016-07-30 11:13:00'),(141092,'auguria',1,'','left','commercial',141086,NULL,NULL,7,'/commande/list.php?leftmenu=orders&viewstatut=-1','','StatusOrderCanceledShort','orders',1,'','$user->rights->commande->lire','$conf->commande->enabled && $leftmenu==\"orders\"',2,'2016-07-30 11:13:00'),(141093,'auguria',1,'','left','commercial',141084,NULL,NULL,4,'/commande/stats/index.php?leftmenu=orders','','Statistics','orders',1,'','$user->rights->commande->lire','$conf->commande->enabled',2,'2016-07-30 11:13:00'),(141184,'auguria',1,'','left','commercial',139887,NULL,NULL,6,'/expedition/index.php?leftmenu=sendings','','Shipments','sendings',0,'sendings','$user->rights->expedition->lire','$conf->expedition->enabled',2,'2016-07-30 11:13:00'),(141185,'auguria',1,'','left','commercial',141184,NULL,NULL,0,'/expedition/card.php?action=create2&leftmenu=sendings','','NewSending','sendings',1,'','$user->rights->expedition->creer','$conf->expedition->enabled && $leftmenu==\"sendings\"',2,'2016-07-30 11:13:00'),(141186,'auguria',1,'','left','commercial',141184,NULL,NULL,1,'/expedition/list.php?leftmenu=sendings','','List','sendings',1,'','$user->rights->expedition->lire','$conf->expedition->enabled && $leftmenu==\"sendings\"',2,'2016-07-30 11:13:00'),(141187,'auguria',1,'','left','commercial',141184,NULL,NULL,2,'/expedition/stats/index.php?leftmenu=sendings','','Statistics','sendings',1,'','$user->rights->expedition->lire','$conf->expedition->enabled && $leftmenu==\"sendings\"',2,'2016-07-30 11:13:00'),(141284,'auguria',1,'','left','commercial',139889,NULL,NULL,7,'/contrat/index.php?leftmenu=contracts','','Contracts','contracts',0,'contracts','$user->rights->contrat->lire','$conf->contrat->enabled',2,'2016-07-30 11:13:00'),(141285,'auguria',1,'','left','commercial',141284,NULL,NULL,0,'/contrat/card.php?&action=create&leftmenu=contracts','','NewContract','contracts',1,'','$user->rights->contrat->creer','$conf->contrat->enabled',2,'2016-07-30 11:13:00'),(141286,'auguria',1,'','left','commercial',141284,NULL,NULL,1,'/contrat/list.php?leftmenu=contracts','','List','contracts',1,'','$user->rights->contrat->lire','$conf->contrat->enabled',2,'2016-07-30 11:13:00'),(141287,'auguria',1,'','left','commercial',141284,NULL,NULL,2,'/contrat/services.php?leftmenu=contracts','','MenuServices','contracts',1,'','$user->rights->contrat->lire','$conf->contrat->enabled',2,'2016-07-30 11:13:00'),(141288,'auguria',1,'','left','commercial',141287,NULL,NULL,0,'/contrat/services.php?leftmenu=contracts&mode=0','','MenuInactiveServices','contracts',2,'','$user->rights->contrat->lire','$conf->contrat->enabled&&$leftmenu==\"contracts\"',2,'2016-07-30 11:13:00'),(141289,'auguria',1,'','left','commercial',141287,NULL,NULL,1,'/contrat/services.php?leftmenu=contracts&mode=4','','MenuRunningServices','contracts',2,'','$user->rights->contrat->lire','$conf->contrat->enabled&&$leftmenu==\"contracts\"',2,'2016-07-30 11:13:00'),(141290,'auguria',1,'','left','commercial',141287,NULL,NULL,2,'/contrat/services.php?leftmenu=contracts&mode=4&filter=expired','','MenuExpiredServices','contracts',2,'','$user->rights->contrat->lire','$conf->contrat->enabled&&$leftmenu==\"contracts\"',2,'2016-07-30 11:13:00'),(141291,'auguria',1,'','left','commercial',141287,NULL,NULL,3,'/contrat/services.php?leftmenu=contracts&mode=5','','MenuClosedServices','contracts',2,'','$user->rights->contrat->lire','$conf->contrat->enabled&&$leftmenu==\"contracts\"',2,'2016-07-30 11:13:00'),(141384,'auguria',1,'','left','commercial',139889,NULL,NULL,8,'/fichinter/list.php?leftmenu=ficheinter','','Interventions','interventions',0,'ficheinter','$user->rights->ficheinter->lire','$conf->ficheinter->enabled',2,'2016-07-30 11:13:00'),(141385,'auguria',1,'','left','commercial',141384,NULL,NULL,0,'/fichinter/card.php?action=create&leftmenu=ficheinter','','NewIntervention','interventions',1,'','$user->rights->ficheinter->creer','$conf->ficheinter->enabled',2,'2016-07-30 11:13:00'),(141386,'auguria',1,'','left','commercial',141384,NULL,NULL,1,'/fichinter/list.php?leftmenu=ficheinter','','List','interventions',1,'','$user->rights->ficheinter->lire','$conf->ficheinter->enabled',2,'2016-07-30 11:13:00'),(141387,'auguria',1,'','left','commercial',141384,NULL,NULL,2,'/fichinter/stats/index.php?leftmenu=ficheinter','','Statistics','interventions',1,'','$user->rights->ficheinter->lire','$conf->ficheinter->enabled',2,'2016-07-30 11:13:00'),(141484,'auguria',1,'','left','accountancy',139890,NULL,NULL,3,'/fourn/facture/list.php?leftmenu=suppliers_bills','','BillsSuppliers','bills',0,'supplier_bills','$user->rights->fournisseur->facture->lire','$conf->supplier_invoice->enabled',2,'2016-07-30 11:13:00'),(141485,'auguria',1,'','left','accountancy',141484,NULL,NULL,0,'/fourn/facture/card.php?action=create&leftmenu=suppliers_bills','','NewBill','bills',1,'','$user->rights->fournisseur->facture->creer','$conf->supplier_invoice->enabled',2,'2016-07-30 11:13:00'),(141486,'auguria',1,'','left','accountancy',141484,NULL,NULL,1,'/fourn/facture/impayees.php?leftmenu=suppliers_bills','','Unpaid','bills',1,'','$user->rights->fournisseur->facture->lire','$conf->supplier_invoice->enabled',2,'2016-07-30 11:13:00'),(141487,'auguria',1,'','left','accountancy',141484,NULL,NULL,2,'/fourn/facture/paiement.php?leftmenu=suppliers_bills','','Payments','bills',1,'','$user->rights->fournisseur->facture->lire','$conf->supplier_invoice->enabled',2,'2016-07-30 11:13:00'),(141488,'auguria',1,'','left','accountancy',141484,NULL,NULL,8,'/compta/facture/stats/index.php?leftmenu=customers_bills&mode=supplier','','Statistics','bills',1,'','$user->rights->fournisseur->facture->lire','$conf->supplier_invoice->enabled',2,'2016-07-30 11:13:00'),(141584,'auguria',1,'','left','accountancy',139890,NULL,NULL,3,'/compta/facture/list.php?leftmenu=customers_bills','','BillsCustomers','bills',0,'customer_bills','$user->rights->facture->lire','$conf->facture->enabled',2,'2016-07-30 11:13:00'),(141585,'auguria',1,'','left','accountancy',141584,NULL,NULL,3,'/compta/facture.php?action=create&leftmenu=customers_bills','','NewBill','bills',1,'','$user->rights->facture->creer','$conf->facture->enabled',2,'2016-07-30 11:13:00'),(141586,'auguria',1,'','left','accountancy',141584,NULL,NULL,5,'/compta/facture/fiche-rec.php?leftmenu=customers_bills','','ListOfTemplates','bills',1,'','$user->rights->facture->lire','$conf->facture->enabled',2,'2016-07-30 11:13:00'),(141588,'auguria',1,'','left','accountancy',141584,NULL,NULL,6,'/compta/paiement/list.php?leftmenu=customers_bills','','Payments','bills',1,'','$user->rights->facture->lire','$conf->facture->enabled',2,'2016-07-30 11:13:00'),(141589,'auguria',1,'','left','accountancy',141584,NULL,NULL,4,'/compta/facture/list.php?leftmenu=customers_bills','','List','bills',1,'','$user->rights->facture->lire','$conf->facture->enabled',2,'2016-07-30 11:13:00'),(141594,'auguria',1,'','left','accountancy',141588,NULL,NULL,1,'/compta/paiement/rapport.php?leftmenu=customers_bills','','Reportings','bills',2,'','$user->rights->facture->lire','$conf->facture->enabled',2,'2016-07-30 11:13:00'),(141595,'auguria',1,'','left','accountancy',139898,NULL,NULL,9,'/compta/paiement/cheque/index.php?leftmenu=checks&mainmenu=bank','','MenuChequeDeposits','bills',0,'checks','$user->rights->banque->lire','empty($conf->global->BANK_DISABLE_CHECK_DEPOSIT) && ! empty($conf->banque->enabled) && (! empty($conf->facture->enabled) || ! empty($conf->global->MAIN_MENU_CHEQUE_DEPOSIT_ON))',2,'2016-07-30 11:13:00'),(141596,'auguria',1,'','left','accountancy',141595,NULL,NULL,0,'/compta/paiement/cheque/card.php?leftmenu=checks&action=new','','NewCheckDeposit','compta',1,'','$user->rights->banque->lire','empty($conf->global->BANK_DISABLE_CHECK_DEPOSIT) && ! empty($conf->banque->enabled) && (! empty($conf->facture->enabled) || ! empty($conf->global->MAIN_MENU_CHEQUE_DEPOSIT_ON))',2,'2016-07-30 11:13:00'),(141597,'auguria',1,'','left','accountancy',141595,NULL,NULL,1,'/compta/paiement/cheque/list.php?leftmenu=checks','','List','bills',1,'','$user->rights->banque->lire','empty($conf->global->BANK_DISABLE_CHECK_DEPOSIT) && ! empty($conf->banque->enabled) && (! empty($conf->facture->enabled) || ! empty($conf->global->MAIN_MENU_CHEQUE_DEPOSIT_ON))',2,'2016-07-30 11:13:00'),(141598,'auguria',1,'','left','accountancy',141584,NULL,NULL,8,'/compta/facture/stats/index.php?leftmenu=customers_bills','','Statistics','bills',1,'','$user->rights->facture->lire','$conf->facture->enabled',2,'2016-07-30 11:13:00'),(141604,'auguria',1,'','left','accountancy',141589,NULL,NULL,1,'/compta/facture/list.php?leftmenu=customers_bills&search_status=0','','BillShortStatusDraft','bills',2,'','$user->rights->facture->lire','$conf->facture->enabled',2,'2016-07-30 11:13:00'),(141605,'auguria',1,'','left','accountancy',141589,NULL,NULL,2,'/compta/facture/list.php?leftmenu=customers_bills&search_status=1','','BillShortStatusNotPaid','bills',2,'','$user->rights->facture->lire','$conf->facture->enabled',2,'2016-07-30 11:13:00'),(141606,'auguria',1,'','left','accountancy',141589,NULL,NULL,3,'/compta/facture/list.php?leftmenu=customers_bills&search_status=2','','BillShortStatusPaid','bills',2,'','$user->rights->facture->lire','$conf->facture->enabled',2,'2016-07-30 11:13:00'),(141607,'auguria',1,'','left','accountancy',141589,NULL,NULL,4,'/compta/facture/list.php?leftmenu=customers_bills&search_status=3','','BillShortStatusCanceled','bills',2,'','$user->rights->facture->lire','$conf->facture->enabled',2,'2016-07-30 11:13:00'),(141784,'auguria',1,'','left','accountancy',139890,NULL,NULL,3,'/commande/list.php?leftmenu=orders&viewstatut=3','','MenuOrdersToBill','orders',0,'orders','$user->rights->commande->lire','$conf->commande->enabled',0,'2016-07-30 11:13:00'),(141884,'auguria',1,'','left','accountancy',139890,NULL,NULL,4,'/don/index.php?leftmenu=donations&mainmenu=accountancy','','Donations','donations',0,'donations','$user->rights->don->lire','$conf->don->enabled',2,'2016-07-30 11:13:00'),(141885,'auguria',1,'','left','accountancy',141884,NULL,NULL,0,'/don/card.php?leftmenu=donations&mainmenu=accountancy&action=create','','NewDonation','donations',1,'','$user->rights->don->creer','$conf->don->enabled && $leftmenu==\"donations\"',2,'2016-07-30 11:13:00'),(141886,'auguria',1,'','left','accountancy',141884,NULL,NULL,1,'/don/list.php?leftmenu=donations&mainmenu=accountancy','','List','donations',1,'','$user->rights->don->lire','$conf->don->enabled && $leftmenu==\"donations\"',2,'2016-07-30 11:13:00'),(141984,'auguria',1,'','left','accountancy',139899,NULL,NULL,5,'/compta/deplacement/index.php?leftmenu=tripsandexpenses','','TripsAndExpenses','trips',0,'tripsandexpenses','$user->rights->deplacement->lire','$conf->deplacement->enabled',0,'2016-07-30 11:13:00'),(141985,'auguria',1,'','left','accountancy',141984,NULL,NULL,1,'/compta/deplacement/card.php?action=create&leftmenu=tripsandexpenses','','New','trips',1,'','$user->rights->deplacement->creer','$conf->deplacement->enabled',0,'2016-07-30 11:13:00'),(141986,'auguria',1,'','left','accountancy',141984,NULL,NULL,2,'/compta/deplacement/list.php?leftmenu=tripsandexpenses','','List','trips',1,'','$user->rights->deplacement->lire','$conf->deplacement->enabled',0,'2016-07-30 11:13:00'),(141987,'auguria',1,'','left','accountancy',141984,NULL,NULL,2,'/compta/deplacement/stats/index.php?leftmenu=tripsandexpenses','','Statistics','trips',1,'','$user->rights->deplacement->lire','$conf->deplacement->enabled',0,'2016-07-30 11:13:00'),(142084,'auguria',1,'','left','accountancy',139890,NULL,NULL,6,'/compta/charges/index.php?leftmenu=tax&mainmenu=accountancy','','MenuSpecialExpenses','compta',0,'tax','(! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) || (! empty($conf->salaries->enabled) && $user->rights->salaries->read)','$conf->tax->enabled || $conf->salaries->enabled',0,'2016-07-30 11:13:00'),(142094,'auguria',1,'','left','accountancy',142084,NULL,NULL,1,'/compta/salaries/index.php?leftmenu=tax_salary&mainmenu=accountancy','','Salaries','salaries',1,'tax_sal','$user->rights->salaries->read','$conf->salaries->enabled',0,'2016-07-30 11:13:00'),(142095,'auguria',1,'','left','accountancy',142094,NULL,NULL,2,'/compta/salaries/card.php?leftmenu=tax_salary&action=create','','NewPayment','companies',2,'','$user->rights->salaries->write','$conf->salaries->enabled && $leftmenu==\"tax_salary\"',0,'2016-07-30 11:13:00'),(142096,'auguria',1,'','left','accountancy',142094,NULL,NULL,3,'/compta/salaries/index.php?leftmenu=tax_salary','','Payments','companies',2,'','$user->rights->salaries->read','$conf->salaries->enabled && $leftmenu==\"tax_salary\"',0,'2016-07-30 11:13:00'),(142104,'auguria',1,'','left','accountancy',142084,NULL,NULL,1,'/loan/index.php?leftmenu=tax_loan&mainmenu=accountancy','','Loans','loan',1,'tax_loan','$user->rights->loan->read','$conf->loan->enabled',0,'2016-07-30 11:13:00'),(142105,'auguria',1,'','left','accountancy',142104,NULL,NULL,2,'/loan/card.php?leftmenu=tax_loan&action=create','','NewLoan','loan',2,'','$user->rights->loan->write','$conf->loan->enabled && $leftmenu==\"tax_loan\"',0,'2016-07-30 11:13:00'),(142107,'auguria',1,'','left','accountancy',142104,NULL,NULL,4,'/loan/calc.php?leftmenu=tax_loan','','Calculator','companies',2,'','$user->rights->loan->calc','$conf->loan->enabled && $leftmenu==\"tax_loan\" && ! empty($conf->global->LOAN_SHOW_CALCULATOR)',0,'2016-07-30 11:13:00'),(142134,'auguria',1,'','left','accountancy',142084,NULL,NULL,1,'/compta/sociales/index.php?leftmenu=tax_social','','SocialContributions','',1,'tax_social','$user->rights->tax->charges->lire','$conf->tax->enabled',0,'2016-07-30 11:13:00'),(142135,'auguria',1,'','left','accountancy',142134,NULL,NULL,2,'/compta/sociales/charges.php?leftmenu=tax_social&action=create','','MenuNewSocialContribution','',2,'','$user->rights->tax->charges->creer','$conf->tax->enabled && $leftmenu==\"tax_social\"',0,'2016-07-30 11:13:00'),(142136,'auguria',1,'','left','accountancy',142134,NULL,NULL,3,'/compta/charges/index.php?leftmenu=tax_social&mainmenu=accountancy&mode=sconly','','Payments','',2,'','$user->rights->tax->charges->lire','$conf->tax->enabled && $leftmenu==\"tax_social\"',0,'2016-07-30 11:13:00'),(142184,'auguria',1,'','left','accountancy',142084,NULL,NULL,7,'/compta/tva/index.php?leftmenu=tax_vat&mainmenu=accountancy','','VAT','companies',1,'tax_vat','$user->rights->tax->charges->lire','$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS)',0,'2016-07-30 11:13:00'),(142185,'auguria',1,'','left','accountancy',142184,NULL,NULL,0,'/compta/tva/card.php?leftmenu=tax_vat&action=create','','New','companies',2,'','$user->rights->tax->charges->creer','$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS) && $leftmenu==\"tax_vat\"',0,'2016-07-30 11:13:00'),(142186,'auguria',1,'','left','accountancy',142184,NULL,NULL,1,'/compta/tva/reglement.php?leftmenu=tax_vat','','List','companies',2,'','$user->rights->tax->charges->lire','$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS) && $leftmenu==\"tax_vat\"',0,'2016-07-30 11:13:00'),(142187,'auguria',1,'','left','accountancy',142184,NULL,NULL,2,'/compta/tva/clients.php?leftmenu=tax_vat','','ReportByCustomers','companies',2,'','$user->rights->tax->charges->lire','$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS) && $leftmenu==\"tax_vat\"',0,'2016-07-30 11:13:00'),(142188,'auguria',1,'','left','accountancy',142184,NULL,NULL,3,'/compta/tva/quadri_detail.php?leftmenu=tax_vat','','ReportByQuarter','companies',2,'','$user->rights->tax->charges->lire','$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS) && $leftmenu==\"tax_vat\"',0,'2016-07-30 11:13:00'),(142284,'auguria',1,'','left','accountancy',139890,NULL,NULL,7,'/accountancy/customer/index.php?leftmenu=accounting','','MenuAccountancy','accountancy',0,'accounting','! empty($conf->accounting->enabled) || $user->rights->accounting->ventilation->read || $user->rights->accounting->ventilation->dispatch || $user->rights->compta->resultat->lire','$conf->accounting->enabled',0,'2016-07-30 11:13:00'),(142285,'auguria',1,'','left','accountancy',142284,NULL,NULL,1,'/accountancy/customer/index.php?leftmenu=dispatch_customer','','CustomersVentilation','accountancy',1,'dispatch_customer','$user->rights->accounting->ventilation->read','$conf->accounting->enabled',0,'2016-07-30 11:13:00'),(142286,'auguria',1,'','left','accountancy',142285,NULL,NULL,2,'/accountancy/customer/list.php','','ToDispatch','accountancy',2,'','$user->rights->accounting->ventilation->dispatch','$conf->accounting->enabled && $leftmenu==\"dispatch_customer\"',0,'2016-07-30 11:13:00'),(142287,'auguria',1,'','left','accountancy',142285,NULL,NULL,3,'/accountancy/customer/lines.php','','Dispatched','accountancy',2,'','$user->rights->accounting->ventilation->read','$conf->accounting->enabled && $leftmenu==\"dispatch_customer\"',0,'2016-07-30 11:13:00'),(142294,'auguria',1,'','left','accountancy',142284,NULL,NULL,4,'/accountancy/supplier/index.php?leftmenu=dispatch_supplier','','SuppliersVentilation','accountancy',1,'ventil_supplier','$user->rights->accounting->ventilation->read','$conf->accounting->enabled && $conf->fournisseur->enabled',0,'2016-07-30 11:13:00'),(142295,'auguria',1,'','left','accountancy',142294,NULL,NULL,5,'/accountancy/supplier/list.php','','ToDispatch','accountancy',2,'','$user->rights->accounting->ventilation->dispatch','$conf->accounting->enabled && $conf->fournisseur->enabled && $leftmenu==\"dispatch_supplier\"',0,'2016-07-30 11:13:00'),(142296,'auguria',1,'','left','accountancy',142294,NULL,NULL,6,'/accountancy/supplier/lines.php','','Dispatched','accountancy',2,'','$user->rights->accounting->ventilation->read','$conf->accounting->enabled && $conf->fournisseur->enabled && $leftmenu==\"dispatch_supplier\"',0,'2016-07-30 11:13:00'),(142314,'auguria',1,'','left','accountancy',142284,NULL,NULL,15,'/accountancy/bookkeeping/list.php','','Bookkeeping','accountancy',1,'bookkeeping','$user->rights->accounting->mouvements->lire','$conf->accounting->enabled',0,'2016-07-30 11:13:00'),(142319,'auguria',1,'','left','accountancy',142284,NULL,NULL,16,'/accountancy/bookkeeping/balance.php','','AccountBalance','accountancy',1,'balance','$user->rights->accounting->mouvements->lire','$conf->accounting->enabled',0,'2016-07-30 11:13:00'),(142324,'auguria',1,'','left','accountancy',142284,NULL,NULL,17,'/accountancy/report/result.php?leftmenu=ca&mainmenu=accountancy','','Reportings','main',1,'report','$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire','$conf->accounting->enabled',0,'2016-07-30 11:13:00'),(142325,'auguria',1,'','left','accountancy',142324,NULL,NULL,18,'/accountancy/report/result.php?leftmenu=ca','','ReportInOut','main',2,'','$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire','$conf->accounting->enabled && $leftmenu==\"ca\"',0,'2016-07-30 11:13:00'),(142326,'auguria',1,'','left','accountancy',142324,NULL,NULL,19,'/compta/resultat/index.php?leftmenu=ca','','ByExpenseIncome','main',3,'','$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire','$conf->accounting->enabled && $leftmenu==\"ca\"',0,'2016-07-30 11:13:00'),(142327,'auguria',1,'','left','accountancy',142324,NULL,NULL,20,'/compta/resultat/clientfourn.php?leftmenu=ca','','ByCompanies','main',3,'','$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire','$conf->accounting->enabled && $leftmenu==\"ca\"',0,'2016-07-30 11:13:00'),(142328,'auguria',1,'','left','accountancy',142324,NULL,NULL,21,'/compta/stats/index.php?leftmenu=ca','','ReportTurnover','main',2,'','$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire','$conf->accounting->enabled && $leftmenu==\"ca\"',0,'2016-07-30 11:13:00'),(142329,'auguria',1,'','left','accountancy',142324,NULL,NULL,22,'/compta/stats/casoc.php?leftmenu=ca','','ByCompanies','main',3,'','$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire','$conf->accounting->enabled && $leftmenu==\"ca\"',0,'2016-07-30 11:13:00'),(142330,'auguria',1,'','left','accountancy',142324,NULL,NULL,23,'/compta/stats/cabyuser.php?leftmenu=ca','','ByUsers','main',3,'','$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire','$conf->accounting->enabled && $leftmenu==\"ca\"',0,'2016-07-30 11:13:00'),(142331,'auguria',1,'','left','accountancy',142324,NULL,NULL,24,'/compta/stats/cabyprodserv.php?leftmenu=ca','','ByProductsAndServices','main',3,'','$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire','$conf->accounting->enabled && $leftmenu==\"ca\"',0,'2016-07-30 11:13:00'),(142335,'auguria',1,'','left','home',142284,NULL,NULL,25,'/accountancy/admin/account.php?mainmenu=accountancy','','Chartofaccounts','admin',1,'','$user->rights->accounting->chartofaccount','$conf->accounting->enabled',0,'2016-07-30 11:13:00'),(142384,'auguria',1,'','left','accountancy',139898,NULL,NULL,9,'/compta/prelevement/index.php?leftmenu=withdraw&mainmenu=bank','','StandingOrders','withdrawals',0,'withdraw','$user->rights->prelevement->bons->lire','$conf->prelevement->enabled',2,'2016-07-30 11:13:00'),(142386,'auguria',1,'','left','accountancy',142384,NULL,NULL,0,'/compta/prelevement/create.php?leftmenu=withdraw','','NewStandingOrder','withdrawals',1,'','$user->rights->prelevement->bons->lire','$conf->prelevement->enabled && $leftmenu==\"withdraw\"',2,'2016-07-30 11:13:00'),(142387,'auguria',1,'','left','accountancy',142384,NULL,NULL,2,'/compta/prelevement/bons.php?leftmenu=withdraw','','WithdrawalsReceipts','withdrawals',1,'','$user->rights->prelevement->bons->lire','$conf->prelevement->enabled && $leftmenu==\"withdraw\"',2,'2016-07-30 11:13:00'),(142388,'auguria',1,'','left','accountancy',142384,NULL,NULL,3,'/compta/prelevement/list.php?leftmenu=withdraw','','WithdrawalsLines','withdrawals',1,'','$user->rights->prelevement->bons->lire','$conf->prelevement->enabled && $leftmenu==\"withdraw\"',2,'2016-07-30 11:13:00'),(142390,'auguria',1,'','left','accountancy',142384,NULL,NULL,5,'/compta/prelevement/rejets.php?leftmenu=withdraw','','Rejects','withdrawals',1,'','$user->rights->prelevement->bons->lire','$conf->prelevement->enabled && $leftmenu==\"withdraw\"',2,'2016-07-30 11:13:00'),(142391,'auguria',1,'','left','accountancy',142384,NULL,NULL,6,'/compta/prelevement/stats.php?leftmenu=withdraw','','Statistics','withdrawals',1,'','$user->rights->prelevement->bons->lire','$conf->prelevement->enabled && $leftmenu==\"withdraw\"',2,'2016-07-30 11:13:00'),(142484,'auguria',1,'','left','accountancy',139898,NULL,NULL,1,'/compta/bank/index.php?leftmenu=bank&mainmenu=bank','','MenuBankCash','banks',0,'bank','$user->rights->banque->lire','$conf->banque->enabled',0,'2016-07-30 11:13:00'),(142485,'auguria',1,'','left','accountancy',142484,NULL,NULL,0,'/compta/bank/card.php?action=create&leftmenu=bank','','MenuNewFinancialAccount','banks',1,'','$user->rights->banque->configurer','$conf->banque->enabled && ($leftmenu==\"bank\" || $leftmenu==\"checks\" || $leftmenu==\"withdraw\")',0,'2016-07-30 11:13:00'),(142487,'auguria',1,'','left','accountancy',142484,NULL,NULL,2,'/compta/bank/search.php?leftmenu=bank','','ListTransactions','banks',1,'','$user->rights->banque->lire','$conf->banque->enabled && ($leftmenu==\"bank\" || $leftmenu==\"checks\" || $leftmenu==\"withdraw\")',0,'2016-07-30 11:13:00'),(142488,'auguria',1,'','left','accountancy',142484,NULL,NULL,3,'/compta/bank/budget.php?leftmenu=bank','','ListTransactionsByCategory','banks',1,'','$user->rights->banque->lire','$conf->banque->enabled && ($leftmenu==\"bank\" || $leftmenu==\"checks\" || $leftmenu==\"withdraw\")',0,'2016-07-30 11:13:00'),(142490,'auguria',1,'','left','accountancy',142484,NULL,NULL,5,'/compta/bank/virement.php?leftmenu=bank','','BankTransfers','banks',1,'','$user->rights->banque->transfer','$conf->banque->enabled && ($leftmenu==\"bank\" || $leftmenu==\"checks\" || $leftmenu==\"withdraw\")',0,'2016-07-30 11:13:00'),(142534,'auguria',1,'','left','accountancy',139898,NULL,NULL,4,'/categories/index.php?leftmenu=cat&type=5','','Categories','categories',0,'cat','$user->rights->categorie->lire','$conf->categorie->enabled',2,'2016-07-30 11:13:00'),(142535,'auguria',1,'','left','accountancy',142534,NULL,NULL,0,'/categories/card.php?action=create&type=5','','NewCategory','categories',1,'','$user->rights->categorie->creer','$conf->categorie->enabled',2,'2016-07-30 11:13:00'),(142584,'auguria',1,'','left','accountancy',139890,NULL,NULL,11,'/compta/resultat/index.php?leftmenu=ca&mainmenu=accountancy','','Reportings','main',0,'ca','$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire','$conf->comptabilite->enabled',0,'2016-07-30 11:13:00'),(142585,'auguria',1,'','left','accountancy',142584,NULL,NULL,0,'/compta/resultat/index.php?leftmenu=ca','','ReportInOut','main',1,'','$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire','$conf->comptabilite->enabled && $leftmenu==\"ca\"',0,'2016-07-30 11:13:00'),(142586,'auguria',1,'','left','accountancy',142585,NULL,NULL,0,'/compta/resultat/clientfourn.php?leftmenu=ca','','ByCompanies','main',2,'','$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire','$conf->comptabilite->enabled && $leftmenu==\"ca\"',0,'2016-07-30 11:13:00'),(142587,'auguria',1,'','left','accountancy',142584,NULL,NULL,1,'/compta/stats/index.php?leftmenu=ca','','ReportTurnover','main',1,'','$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire','$conf->comptabilite->enabled && $leftmenu==\"ca\"',0,'2016-07-30 11:13:00'),(142588,'auguria',1,'','left','accountancy',142587,NULL,NULL,0,'/compta/stats/casoc.php?leftmenu=ca','','ByCompanies','main',2,'','$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire','$conf->comptabilite->enabled && $leftmenu==\"ca\"',0,'2016-07-30 11:13:00'),(142589,'auguria',1,'','left','accountancy',142587,NULL,NULL,1,'/compta/stats/cabyuser.php?leftmenu=ca','','ByUsers','main',2,'','$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire','$conf->comptabilite->enabled && $leftmenu==\"ca\"',0,'2016-07-30 11:13:00'),(142590,'auguria',1,'','left','accountancy',142584,NULL,NULL,1,'/compta/journal/sellsjournal.php?leftmenu=ca','','SellsJournal','main',1,'','$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire','$conf->comptabilite->enabled && $leftmenu==\"ca\"',0,'2016-07-30 11:13:00'),(142591,'auguria',1,'','left','accountancy',142584,NULL,NULL,1,'/compta/journal/purchasesjournal.php?leftmenu=ca','','PurchasesJournal','main',1,'','$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire','$conf->comptabilite->enabled && $leftmenu==\"ca\"',0,'2016-07-30 11:13:00'),(142592,'auguria',1,'','left','accountancy',142587,NULL,NULL,1,'/compta/stats/cabyprodserv.php?leftmenu=ca','','ByProductsAndServices','main',2,'','$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire','$conf->comptabilite->enabled && $leftmenu==\"ca\"',0,'2016-07-30 11:13:00'),(142684,'auguria',1,'','left','products',139887,NULL,NULL,0,'/product/index.php?leftmenu=product&type=0','','Products','products',0,'product','$user->rights->produit->lire','$conf->product->enabled',2,'2016-07-30 11:13:00'),(142685,'auguria',1,'','left','products',142684,NULL,NULL,0,'/product/card.php?leftmenu=product&action=create&type=0','','NewProduct','products',1,'','$user->rights->produit->creer','$conf->product->enabled',2,'2016-07-30 11:13:00'),(142686,'auguria',1,'','left','products',142684,NULL,NULL,1,'/product/list.php?leftmenu=product&type=0','','List','products',1,'','$user->rights->produit->lire','$conf->product->enabled',2,'2016-07-30 11:13:00'),(142687,'auguria',1,'','left','products',142684,NULL,NULL,4,'/product/reassort.php?type=0','','Stocks','products',1,'','$user->rights->produit->lire && $user->rights->stock->lire','$conf->product->enabled',2,'2016-07-30 11:13:00'),(142688,'auguria',1,'','left','products',142684,NULL,NULL,6,'/product/stats/card.php?id=all&leftmenu=stats&type=0','','Statistics','main',1,'','$user->rights->produit->lire','$conf->propal->enabled',2,'2016-07-30 11:13:00'),(142689,'auguria',1,'','left','products',142684,NULL,NULL,5,'/product/reassortlot.php?type=0','','StocksByLotSerial','products',1,'','$user->rights->produit->lire && $user->rights->stock->lire','$conf->productbatch->enabled',2,'2016-07-30 11:13:00'),(142784,'auguria',1,'','left','products',139887,NULL,NULL,1,'/product/index.php?leftmenu=service&type=1','','Services','products',0,'service','$user->rights->service->lire','$conf->service->enabled',2,'2016-07-30 11:13:00'),(142785,'auguria',1,'','left','products',142784,NULL,NULL,0,'/product/card.php?leftmenu=service&action=create&type=1','','NewService','products',1,'','$user->rights->service->creer','$conf->service->enabled',2,'2016-07-30 11:13:00'),(142786,'auguria',1,'','left','products',142784,NULL,NULL,1,'/product/list.php?leftmenu=service&type=1','','List','products',1,'','$user->rights->service->lire','$conf->service->enabled',2,'2016-07-30 11:13:00'),(142787,'auguria',1,'','left','products',142784,NULL,NULL,5,'/product/stats/card.php?id=all&leftmenu=stats&type=1','','Statistics','main',1,'','$user->rights->service->lire','$conf->propal->enabled',2,'2016-07-30 11:13:00'),(142984,'auguria',1,'','left','products',139887,NULL,NULL,3,'/product/stock/index.php?leftmenu=stock','','Stock','stocks',0,'stock','$user->rights->stock->lire','$conf->stock->enabled',2,'2016-07-30 11:13:00'),(142985,'auguria',1,'','left','products',142984,NULL,NULL,0,'/product/stock/card.php?action=create','','MenuNewWarehouse','stocks',1,'','$user->rights->stock->creer','$conf->stock->enabled',2,'2016-07-30 11:13:00'),(142986,'auguria',1,'','left','products',142984,NULL,NULL,1,'/product/stock/list.php','','List','stocks',1,'','$user->rights->stock->lire','$conf->stock->enabled',2,'2016-07-30 11:13:00'),(142988,'auguria',1,'','left','products',142984,NULL,NULL,3,'/product/stock/mouvement.php','','Movements','stocks',1,'','$user->rights->stock->mouvement->lire','$conf->stock->enabled',2,'2016-07-30 11:13:00'),(142989,'auguria',1,'','left','products',142984,NULL,NULL,4,'/product/stock/replenish.php','','Replenishments','stocks',1,'','$user->rights->stock->mouvement->creer && $user->rights->fournisseur->lire','$conf->stock->enabled && $conf->supplier_order->enabled',2,'2016-07-30 11:13:00'),(142990,'auguria',1,'','left','products',142984,NULL,NULL,5,'/product/stock/massstockmove.php','','MassStockTransferShort','stocks',1,'','$user->rights->stock->mouvement->creer','$conf->stock->enabled',2,'2016-07-30 11:13:00'),(143084,'auguria',1,'','left','products',139887,NULL,NULL,4,'/categories/index.php?leftmenu=cat&type=0','','Categories','categories',0,'cat','$user->rights->categorie->lire','$conf->categorie->enabled',2,'2016-07-30 11:13:00'),(143085,'auguria',1,'','left','products',143084,NULL,NULL,0,'/categories/card.php?action=create&type=0','','NewCategory','categories',1,'','$user->rights->categorie->creer','$conf->categorie->enabled',2,'2016-07-30 11:13:00'),(143484,'auguria',1,'','left','project',139891,NULL,NULL,0,'/projet/index.php?leftmenu=projects','','Projects','projects',0,'projects','$user->rights->projet->lire','$conf->projet->enabled',2,'2016-07-30 11:13:00'),(143485,'auguria',1,'','left','project',143484,NULL,NULL,1,'/projet/card.php?leftmenu=projects&action=create','','NewProject','projects',1,'','$user->rights->projet->creer','$conf->projet->enabled',2,'2016-07-30 11:13:00'),(143486,'auguria',1,'','left','project',143484,NULL,NULL,2,'/projet/list.php?leftmenu=projects','','List','projects',1,'','$user->rights->projet->lire','$conf->projet->enabled',2,'2016-07-30 11:13:00'),(143494,'auguria',1,'','left','project',139891,NULL,NULL,0,'/projet/index.php?leftmenu=projects&mode=mine','','MyProjects','projects',0,'myprojects','$user->rights->projet->lire','$conf->projet->enabled',2,'2016-07-30 11:13:00'),(143495,'auguria',1,'','left','project',143494,NULL,NULL,1,'/projet/card.php?leftmenu=projects&action=create&mode=mine','','NewProject','projects',1,'','$user->rights->projet->creer','$conf->projet->enabled',2,'2016-07-30 11:13:00'),(143496,'auguria',1,'','left','project',143494,NULL,NULL,2,'/projet/list.php?leftmenu=projects&mode=mine','','List','projects',1,'','$user->rights->projet->lire','$conf->projet->enabled',2,'2016-07-30 11:13:00'),(143584,'auguria',1,'','left','project',139891,NULL,NULL,0,'/projet/activity/index.php?leftmenu=projects','','Activities','projects',0,'','$user->rights->projet->lire','$conf->projet->enabled',2,'2016-07-30 11:13:00'),(143585,'auguria',1,'','left','project',143584,NULL,NULL,1,'/projet/tasks.php?leftmenu=projects&action=create','','NewTask','projects',1,'','$user->rights->projet->creer','$conf->projet->enabled',2,'2016-07-30 11:13:00'),(143586,'auguria',1,'','left','project',143584,NULL,NULL,2,'/projet/tasks/list.php?leftmenu=projects','','List','projects',1,'','$user->rights->projet->lire','$conf->projet->enabled',2,'2016-07-30 11:13:00'),(143587,'auguria',1,'','left','project',143584,NULL,NULL,3,'/projet/activity/perweek.php?leftmenu=projects','','NewTimeSpent','projects',1,'','$user->rights->projet->lire','$conf->projet->enabled',2,'2016-07-30 11:13:00'),(143684,'auguria',1,'','left','project',139891,NULL,NULL,0,'/projet/activity/index.php?leftmenu=projects&mode=mine','','MyActivities','projects',0,'','$user->rights->projet->lire','$conf->projet->enabled',2,'2016-07-30 11:13:00'),(143685,'auguria',1,'','left','project',143684,NULL,NULL,1,'/projet/tasks.php?leftmenu=projects&action=create','','NewTask','projects',1,'','$user->rights->projet->creer','$conf->projet->enabled',2,'2016-07-30 11:13:00'),(143686,'auguria',1,'','left','project',143684,NULL,NULL,2,'/projet/tasks/list.php?leftmenu=projects&mode=mine','','List','projects',1,'','$user->rights->projet->lire','$conf->projet->enabled',2,'2016-07-30 11:13:00'),(143687,'auguria',1,'','left','project',143684,NULL,NULL,3,'/projet/activity/perweek.php?leftmenu=projects&mode=mine','','NewTimeSpent','projects',1,'','$user->rights->projet->lire','$conf->projet->enabled',2,'2016-07-30 11:13:00'),(143784,'auguria',1,'','left','tools',139892,NULL,NULL,0,'/comm/mailing/index.php?leftmenu=mailing','','EMailings','mails',0,'mailing','$user->rights->mailing->lire','$conf->mailing->enabled',0,'2016-07-30 11:13:00'),(143785,'auguria',1,'','left','tools',143784,NULL,NULL,0,'/comm/mailing/card.php?leftmenu=mailing&action=create','','NewMailing','mails',1,'','$user->rights->mailing->creer','$conf->mailing->enabled',0,'2016-07-30 11:13:00'),(143786,'auguria',1,'','left','tools',143784,NULL,NULL,1,'/comm/mailing/list.php?leftmenu=mailing','','List','mails',1,'','$user->rights->mailing->lire','$conf->mailing->enabled',0,'2016-07-30 11:13:00'),(143984,'auguria',1,'','left','tools',139892,NULL,NULL,2,'/exports/index.php?leftmenu=export','','FormatedExport','exports',0,'export','$user->rights->export->lire','$conf->export->enabled',2,'2016-07-30 11:13:00'),(143985,'auguria',1,'','left','tools',143984,NULL,NULL,0,'/exports/export.php?leftmenu=export','','NewExport','exports',1,'','$user->rights->export->creer','$conf->export->enabled',2,'2016-07-30 11:13:00'),(144014,'auguria',1,'','left','tools',139892,NULL,NULL,2,'/imports/index.php?leftmenu=import','','FormatedImport','exports',0,'import','$user->rights->import->run','$conf->import->enabled',2,'2016-07-30 11:13:00'),(144015,'auguria',1,'','left','tools',144014,NULL,NULL,0,'/imports/import.php?leftmenu=import','','NewImport','exports',1,'','$user->rights->import->run','$conf->import->enabled',2,'2016-07-30 11:13:00'),(144084,'auguria',1,'','left','members',139897,NULL,NULL,0,'/adherents/index.php?leftmenu=members&mainmenu=members','','Members','members',0,'members','$user->rights->adherent->lire','$conf->adherent->enabled',2,'2016-07-30 11:13:00'),(144085,'auguria',1,'','left','members',144084,NULL,NULL,0,'/adherents/card.php?leftmenu=members&action=create','','NewMember','members',1,'','$user->rights->adherent->creer','$conf->adherent->enabled',2,'2016-07-30 11:13:00'),(144086,'auguria',1,'','left','members',144084,NULL,NULL,1,'/adherents/list.php','','List','members',1,'','$user->rights->adherent->lire','$conf->adherent->enabled',2,'2016-07-30 11:13:00'),(144087,'auguria',1,'','left','members',144086,NULL,NULL,2,'/adherents/list.php?leftmenu=members&statut=-1','','MenuMembersToValidate','members',2,'','$user->rights->adherent->lire','$conf->adherent->enabled',2,'2016-07-30 11:13:00'),(144088,'auguria',1,'','left','members',144086,NULL,NULL,3,'/adherents/list.php?leftmenu=members&statut=1','','MenuMembersValidated','members',2,'','$user->rights->adherent->lire','$conf->adherent->enabled',2,'2016-07-30 11:13:00'),(144089,'auguria',1,'','left','members',144086,NULL,NULL,4,'/adherents/list.php?leftmenu=members&statut=1&filter=outofdate','','MenuMembersNotUpToDate','members',2,'','$user->rights->adherent->lire','$conf->adherent->enabled',2,'2016-07-30 11:13:00'),(144090,'auguria',1,'','left','members',144086,NULL,NULL,5,'/adherents/list.php?leftmenu=members&statut=1&filter=uptodate','','MenuMembersUpToDate','members',2,'','$user->rights->adherent->lire','$conf->adherent->enabled',2,'2016-07-30 11:13:00'),(144091,'auguria',1,'','left','members',144086,NULL,NULL,6,'/adherents/list.php?leftmenu=members&statut=0','','MenuMembersResiliated','members',2,'','$user->rights->adherent->lire','$conf->adherent->enabled',2,'2016-07-30 11:13:00'),(144092,'auguria',1,'','left','members',144084,NULL,NULL,7,'/adherents/stats/geo.php?leftmenu=members&mode=memberbycountry','','MenuMembersStats','members',1,'','$user->rights->adherent->lire','$conf->adherent->enabled',2,'2016-07-30 11:13:00'),(144184,'auguria',1,'','left','members',139897,NULL,NULL,1,'/adherents/index.php?leftmenu=members&mainmenu=members','','Subscriptions','compta',0,'','$user->rights->adherent->cotisation->lire','$conf->adherent->enabled',2,'2016-07-30 11:13:00'),(144185,'auguria',1,'','left','members',144184,NULL,NULL,0,'/adherents/list.php?statut=-1&leftmenu=accountancy&mainmenu=members','','NewSubscription','compta',1,'','$user->rights->adherent->cotisation->creer','$conf->adherent->enabled',2,'2016-07-30 11:13:00'),(144186,'auguria',1,'','left','members',144184,NULL,NULL,1,'/adherents/cotisations.php?leftmenu=members','','List','compta',1,'','$user->rights->adherent->cotisation->lire','$conf->adherent->enabled',2,'2016-07-30 11:13:00'),(144187,'auguria',1,'','left','members',144184,NULL,NULL,7,'/adherents/stats/index.php?leftmenu=members','','MenuMembersStats','members',1,'','$user->rights->adherent->lire','$conf->adherent->enabled',2,'2016-07-30 11:13:00'),(144384,'auguria',1,'','left','members',139897,NULL,NULL,3,'/adherents/index.php?leftmenu=export&mainmenu=members','','Exports','members',0,'export','$user->rights->adherent->export','$conf->adherent->enabled',2,'2016-07-30 11:13:00'),(144385,'auguria',1,'','left','members',144384,NULL,NULL,0,'/exports/index.php?leftmenu=export','','Datas','members',1,'','$user->rights->adherent->export','$conf->adherent->enabled && $conf->export->enabled',2,'2016-07-30 11:13:00'),(144386,'auguria',1,'','left','members',144384,NULL,NULL,1,'/adherents/htpasswd.php?leftmenu=export','','Filehtpasswd','members',1,'','$user->rights->adherent->export','$conf->adherent->enabled',2,'2016-07-30 11:13:00'),(144387,'auguria',1,'','left','members',144384,NULL,NULL,2,'/adherents/cartes/carte.php?leftmenu=export','','MembersCards','members',1,'','$user->rights->adherent->export','$conf->adherent->enabled',2,'2016-07-30 11:13:00'),(144484,'auguria',1,'','left','hrm',139899,NULL,NULL,1,'/user/index.php?&leftmenu=hrm&mode=employee','','Employees','hrm',0,'hrm','$user->rights->hrm->employee->read','$conf->hrm->enabled',0,'2016-07-30 11:13:00'),(144485,'auguria',1,'','left','hrm',144484,NULL,NULL,1,'/user/card.php?&action=create','','NewEmployee','hrm',1,'','$user->rights->hrm->employee->write','$conf->hrm->enabled',0,'2016-07-30 11:13:00'),(144486,'auguria',1,'','left','hrm',144484,NULL,NULL,2,'/user/index.php?$leftmenu=hrm&mode=employee','','List','hrm',1,'','$user->rights->hrm->employee->read','$conf->hrm->enabled',0,'2016-07-30 11:13:00'),(144584,'auguria',1,'','left','members',139897,NULL,NULL,5,'/adherents/type.php?leftmenu=setup&mainmenu=members','','MembersTypes','members',0,'setup','$user->rights->adherent->configurer','$conf->adherent->enabled',2,'2016-07-30 11:13:00'),(144585,'auguria',1,'','left','members',144584,NULL,NULL,0,'/adherents/type.php?leftmenu=setup&mainmenu=members&action=create','','New','members',1,'','$user->rights->adherent->configurer','$conf->adherent->enabled',2,'2016-07-30 11:13:00'),(144586,'auguria',1,'','left','members',144584,NULL,NULL,1,'/adherents/type.php?leftmenu=setup&mainmenu=members','','List','members',1,'','$user->rights->adherent->configurer','$conf->adherent->enabled',2,'2016-07-30 11:13:00'),(144884,'auguria',1,'','left','hrm',139899,NULL,NULL,1,'/holiday/list.php?&leftmenu=hrm','','CPTitreMenu','holiday',0,'hrm','$user->rights->holiday->read','$conf->holiday->enabled',0,'2016-07-30 11:13:00'),(144885,'auguria',1,'','left','hrm',144884,NULL,NULL,1,'/holiday/card.php?&action=request','','MenuAddCP','holiday',1,'','$user->rights->holiday->write','$conf->holiday->enabled',0,'2016-07-30 11:13:00'),(144886,'auguria',1,'','left','hrm',144884,NULL,NULL,1,'/holiday/list.php?&leftmenu=hrm','','List','holiday',1,'','$user->rights->holiday->read','$conf->holiday->enabled',0,'2016-07-30 11:13:00'),(144887,'auguria',1,'','left','hrm',144886,NULL,NULL,1,'/holiday/list.php?select_statut=2&leftmenu=hrm','','ListToApprove','trips',2,'','$user->rights->holiday->read','$conf->holiday->enabled',0,'2016-07-30 11:13:00'),(144888,'auguria',1,'','left','hrm',144884,NULL,NULL,2,'/holiday/define_holiday.php?&action=request','','MenuConfCP','holiday',1,'','$user->rights->holiday->define_holiday','$conf->holiday->enabled',0,'2016-07-30 11:13:00'),(144889,'auguria',1,'','left','hrm',144884,NULL,NULL,3,'/holiday/view_log.php?&action=request','','MenuLogCP','holiday',1,'','$user->rights->holiday->define_holiday','$conf->holiday->enabled',0,'2016-07-30 11:13:00'),(144984,'auguria',1,'','left','commercial',139889,NULL,NULL,6,'/fourn/commande/index.php?leftmenu=orders_suppliers','','SuppliersOrders','orders',0,'orders_suppliers','$user->rights->fournisseur->commande->lire','$conf->supplier_order->enabled',2,'2016-07-30 11:13:00'),(144985,'auguria',1,'','left','commercial',144984,NULL,NULL,0,'/fourn/commande/card.php?action=create&leftmenu=orders_suppliers','','NewOrder','orders',1,'','$user->rights->fournisseur->commande->creer','$conf->supplier_order->enabled',2,'2016-07-30 11:13:00'),(144986,'auguria',1,'','left','commercial',144984,NULL,NULL,1,'/fourn/commande/list.php?leftmenu=orders_suppliers&viewstatut=0','','List','orders',1,'','$user->rights->fournisseur->commande->lire','$conf->supplier_order->enabled',2,'2016-07-30 11:13:00'),(144992,'auguria',1,'','left','commercial',144984,NULL,NULL,7,'/commande/stats/index.php?leftmenu=orders_suppliers&mode=supplier','','Statistics','orders',1,'','$user->rights->fournisseur->commande->lire','$conf->supplier_order->enabled',2,'2016-07-30 11:13:00'),(145084,'auguria',1,'','left','members',139897,NULL,NULL,3,'/categories/index.php?leftmenu=cat&type=3','','MembersCategoriesShort','categories',0,'cat','$user->rights->categorie->lire','$conf->adherent->enabled && $conf->categorie->enabled',2,'2016-07-30 11:13:00'),(145085,'auguria',1,'','left','members',145084,NULL,NULL,0,'/categories/card.php?action=create&type=3','','NewCategory','categories',1,'','$user->rights->categorie->creer','$conf->adherent->enabled && $conf->categorie->enabled',2,'2016-07-30 11:13:00'),(145086,'all',1,'supplier_proposal','left','commercial',-1,NULL,'commercial',300,'/supplier_proposal/index.php','','SupplierProposalsShort','supplier_proposal',NULL,'supplier_proposalsubmenu','$user->rights->supplier_proposal->lire','$conf->supplier_proposal->enabled',2,'2016-07-30 11:13:20'),(145087,'all',1,'supplier_proposal','left','commercial',-1,'supplier_proposalsubmenu','commercial',301,'/supplier_proposal/card.php?action=create&leftmenu=supplier_proposals','','SupplierProposalNew','supplier_proposal',NULL,NULL,'$user->rights->supplier_proposal->creer','$conf->supplier_proposal->enabled',2,'2016-07-30 11:13:20'),(145088,'all',1,'supplier_proposal','left','commercial',-1,'supplier_proposalsubmenu','commercial',302,'/supplier_proposal/list.php?leftmenu=supplier_proposals','','List','supplier_proposal',NULL,NULL,'$user->rights->supplier_proposal->lire','$conf->supplier_proposal->enabled',2,'2016-07-30 11:13:20'),(145089,'all',1,'supplier_proposal','left','commercial',-1,'supplier_proposalsubmenu','commercial',303,'/comm/propal/stats/index.php?leftmenu=supplier_proposals&mode=supplier','','Statistics','supplier_proposal',NULL,NULL,'$user->rights->supplier_proposal->lire','$conf->supplier_proposal->enabled',2,'2016-07-30 11:13:20'),(145090,'all',1,'resource','left','tools',-1,NULL,'tools',100,'/resource/list.php','','MenuResourceIndex','resource',NULL,'resource','$user->rights->resource->read','1',0,'2016-07-30 11:13:32'),(145091,'all',1,'resource','left','tools',-1,'resource','tools',101,'/resource/add.php','','MenuResourceAdd','resource',NULL,NULL,'$user->rights->resource->read','1',0,'2016-07-30 11:13:32'),(145092,'all',1,'resource','left','tools',-1,'resource','tools',102,'/resource/list.php','','List','resource',NULL,NULL,'$user->rights->resource->read','1',0,'2016-07-30 11:13:32'),(145093,'all',1,'cron','left','home',-1,'admintools','home',200,'/cron/list.php?status=-2&leftmenu=admintools','','CronList','cron',NULL,NULL,'$user->rights->cron->read','$leftmenu==\'admintools\'',2,'2016-07-30 11:14:25'),(145094,'all',1,'agenda','top','agenda',0,NULL,NULL,100,'/comm/action/index.php','','Agenda','agenda',NULL,NULL,'$user->rights->agenda->myactions->read','$conf->agenda->enabled',2,'2016-07-30 15:42:32'),(145095,'all',1,'agenda','left','agenda',145094,NULL,NULL,100,'/comm/action/index.php?mainmenu=agenda&leftmenu=agenda','','Actions','agenda',NULL,NULL,'$user->rights->agenda->myactions->read','$conf->agenda->enabled',2,'2016-07-30 15:42:32'),(145096,'all',1,'agenda','left','agenda',145095,NULL,NULL,101,'/comm/action/card.php?mainmenu=agenda&leftmenu=agenda&action=create','','NewAction','commercial',NULL,NULL,'($user->rights->agenda->myactions->create||$user->rights->agenda->allactions->create)','$conf->agenda->enabled',2,'2016-07-30 15:42:32'),(145097,'all',1,'agenda','left','agenda',145095,NULL,NULL,102,'/comm/action/index.php?mainmenu=agenda&leftmenu=agenda','','Agenda','agenda',NULL,NULL,'$user->rights->agenda->myactions->read','$conf->agenda->enabled',2,'2016-07-30 15:42:32'),(145098,'all',1,'agenda','left','agenda',145097,NULL,NULL,103,'/comm/action/index.php?mainmenu=agenda&leftmenu=agenda&status=todo&filter=mine','','MenuToDoMyActions','agenda',NULL,NULL,'$user->rights->agenda->myactions->read','$conf->agenda->enabled',2,'2016-07-30 15:42:32'),(145099,'all',1,'agenda','left','agenda',145097,NULL,NULL,104,'/comm/action/index.php?mainmenu=agenda&leftmenu=agenda&status=done&filter=mine','','MenuDoneMyActions','agenda',NULL,NULL,'$user->rights->agenda->myactions->read','$conf->agenda->enabled',2,'2016-07-30 15:42:32'),(145100,'all',1,'agenda','left','agenda',145097,NULL,NULL,105,'/comm/action/index.php?mainmenu=agenda&leftmenu=agenda&status=todo&filtert=-1','','MenuToDoActions','agenda',NULL,NULL,'$user->rights->agenda->allactions->read','$user->rights->agenda->allactions->read',2,'2016-07-30 15:42:32'),(145101,'all',1,'agenda','left','agenda',145097,NULL,NULL,106,'/comm/action/index.php?mainmenu=agenda&leftmenu=agenda&status=done&filtert=-1','','MenuDoneActions','agenda',NULL,NULL,'$user->rights->agenda->allactions->read','$user->rights->agenda->allactions->read',2,'2016-07-30 15:42:32'),(145102,'all',1,'agenda','left','agenda',145095,NULL,NULL,112,'/comm/action/listactions.php?mainmenu=agenda&leftmenu=agenda','','List','agenda',NULL,NULL,'$user->rights->agenda->myactions->read','$conf->agenda->enabled',2,'2016-07-30 15:42:32'),(145103,'all',1,'agenda','left','agenda',145102,NULL,NULL,113,'/comm/action/listactions.php?mainmenu=agenda&leftmenu=agenda&status=todo&filter=mine','','MenuToDoMyActions','agenda',NULL,NULL,'$user->rights->agenda->myactions->read','$conf->agenda->enabled',2,'2016-07-30 15:42:32'),(145104,'all',1,'agenda','left','agenda',145102,NULL,NULL,114,'/comm/action/listactions.php?mainmenu=agenda&leftmenu=agenda&status=done&filter=mine','','MenuDoneMyActions','agenda',NULL,NULL,'$user->rights->agenda->myactions->read','$conf->agenda->enabled',2,'2016-07-30 15:42:32'),(145105,'all',1,'agenda','left','agenda',145102,NULL,NULL,115,'/comm/action/listactions.php?mainmenu=agenda&leftmenu=agenda&status=todo&filtert=-1','','MenuToDoActions','agenda',NULL,NULL,'$user->rights->agenda->allactions->read','$user->rights->agenda->allactions->read',2,'2016-07-30 15:42:32'),(145106,'all',1,'agenda','left','agenda',145102,NULL,NULL,116,'/comm/action/listactions.php?mainmenu=agenda&leftmenu=agenda&status=done&filtert=-1','','MenuDoneActions','agenda',NULL,NULL,'$user->rights->agenda->allactions->read','$user->rights->agenda->allactions->read',2,'2016-07-30 15:42:32'),(145107,'all',1,'agenda','left','agenda',145095,NULL,NULL,120,'/comm/action/rapport/index.php?mainmenu=agenda&leftmenu=agenda','','Reportings','agenda',NULL,NULL,'$user->rights->agenda->allactions->read','$conf->agenda->enabled',2,'2016-07-30 15:42:32'),(145111,'all',1,'opensurvey','left','tools',-1,NULL,'tools',200,'/opensurvey/index.php?mainmenu=tools&leftmenu=opensurvey','','Survey','opensurvey',NULL,'opensurvey','$user->rights->opensurvey->read','$conf->opensurvey->enabled',0,'2016-07-30 19:04:07'),(145112,'all',1,'opensurvey','left','tools',-1,'opensurvey','tools',210,'/opensurvey/wizard/index.php','','NewSurvey','opensurvey',NULL,'opensurvey_new','$user->rights->opensurvey->write','$conf->opensurvey->enabled',0,'2016-07-30 19:04:07'),(145113,'all',1,'opensurvey','left','tools',-1,'opensurvey','tools',220,'/opensurvey/list.php','','List','opensurvey',NULL,'opensurvey_list','$user->rights->opensurvey->read','$conf->opensurvey->enabled',0,'2016-07-30 19:04:07'),(145114,'all',1,'expensereport','left','hrm',-1,NULL,'hrm',100,'/expensereport/index.php','','TripsAndExpenses','trips',NULL,'expensereport','$user->rights->expensereport->lire','$conf->expensereport->enabled',2,'2016-07-31 21:14:33'),(145115,'all',1,'expensereport','left','hrm',-1,'expensereport','hrm',100,'/expensereport/card.php?action=create','','New','trips',NULL,'expensereport_detailnew','$user->rights->expensereport->creer','$conf->expensereport->enabled',2,'2016-07-31 21:14:33'),(145116,'all',1,'expensereport','left','hrm',-1,'expensereport','hrm',100,'/expensereport/list.php','','List','trips',NULL,'expensereport_detaillist','$user->rights->expensereport->lire','$conf->expensereport->enabled',2,'2016-07-31 21:14:33'),(145117,'all',1,'expensereport','left','hrm',-1,'expensereport_detaillist','hrm',100,'/expensereport/list.php?search_status=2','','ListToApprove','trips',NULL,'expensereport_detaillist_approve','$user->rights->expensereport->approve','$conf->expensereport->enabled',2,'2016-07-31 21:14:33'),(145118,'all',1,'expensereport','left','hrm',-1,'expensereport','hrm',100,'/expensereport/stats/index.php','','Statistics','trips',NULL,'expensereport_detail','$user->rights->expensereport->lire','$conf->expensereport->enabled',2,'2016-07-31 21:14:33'),(145119,'all',1,'expensereport','left','hrm',-1,'expensereport','hrm',100,'/expensereport/export_csv.php','','ExportTripCSV','expensereport',NULL,'expensereport_detail','$user->rights->expensereport->lire','$conf->global->DEPLACEMENT_TO_CLEAN',2,'2016-07-31 21:14:33'),(145120,'all',1,'expensereport','left','hrm',-1,'expensereport','hrm',100,'/expensereport/synchro_compta.php','','Synchro_Compta','expensereport',NULL,'expensereport_detail','$user->rights->expensereport->lire','$conf->global->DEPLACEMENT_TO_CLEAN',2,'2016-07-31 21:14:33'); +/*!40000 ALTER TABLE `llx_menu` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_multicurrency` +-- + +DROP TABLE IF EXISTS `llx_multicurrency`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_multicurrency` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `date_create` datetime DEFAULT NULL, + `code` varchar(255) DEFAULT NULL, + `name` varchar(255) DEFAULT NULL, + `entity` int(11) DEFAULT '1', + `fk_user` int(11) DEFAULT NULL, + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_multicurrency` +-- + +LOCK TABLES `llx_multicurrency` WRITE; +/*!40000 ALTER TABLE `llx_multicurrency` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_multicurrency` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_multicurrency_rate` +-- + +DROP TABLE IF EXISTS `llx_multicurrency_rate`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_multicurrency_rate` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `date_sync` datetime DEFAULT NULL, + `rate` double NOT NULL DEFAULT '0', + `fk_multicurrency` int(11) NOT NULL, + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_multicurrency_rate` +-- + +LOCK TABLES `llx_multicurrency_rate` WRITE; +/*!40000 ALTER TABLE `llx_multicurrency_rate` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_multicurrency_rate` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_notify` +-- + +DROP TABLE IF EXISTS `llx_notify`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_notify` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `daten` datetime DEFAULT NULL, + `fk_action` int(11) NOT NULL, + `fk_soc` int(11) DEFAULT NULL, + `fk_contact` int(11) DEFAULT NULL, + `fk_user` int(11) DEFAULT NULL, + `objet_type` varchar(24) NOT NULL, + `objet_id` int(11) NOT NULL, + `email` varchar(255) DEFAULT NULL, + `type` varchar(16) DEFAULT 'email', + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_notify` +-- + +LOCK TABLES `llx_notify` WRITE; +/*!40000 ALTER TABLE `llx_notify` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_notify` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_notify_def` +-- + +DROP TABLE IF EXISTS `llx_notify_def`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_notify_def` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `datec` date DEFAULT NULL, + `fk_action` int(11) NOT NULL, + `fk_soc` int(11) NOT NULL, + `fk_contact` int(11) DEFAULT NULL, + `fk_user` int(11) DEFAULT NULL, + `type` varchar(16) DEFAULT 'email', + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_notify_def` +-- + +LOCK TABLES `llx_notify_def` WRITE; +/*!40000 ALTER TABLE `llx_notify_def` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_notify_def` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_oauth_state` +-- + +DROP TABLE IF EXISTS `llx_oauth_state`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_oauth_state` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `service` varchar(36) DEFAULT NULL, + `state` varchar(128) DEFAULT NULL, + `fk_user` int(11) DEFAULT NULL, + `fk_adherent` int(11) DEFAULT NULL, + `entity` int(11) DEFAULT NULL, + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_oauth_state` +-- + +LOCK TABLES `llx_oauth_state` WRITE; +/*!40000 ALTER TABLE `llx_oauth_state` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_oauth_state` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_oauth_token` +-- + +DROP TABLE IF EXISTS `llx_oauth_token`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_oauth_token` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `service` varchar(36) DEFAULT NULL, + `token` text, + `fk_user` int(11) DEFAULT NULL, + `fk_adherent` int(11) DEFAULT NULL, + `entity` int(11) DEFAULT NULL, + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_oauth_token` +-- + +LOCK TABLES `llx_oauth_token` WRITE; +/*!40000 ALTER TABLE `llx_oauth_token` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_oauth_token` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_opensurvey_comments` +-- + +DROP TABLE IF EXISTS `llx_opensurvey_comments`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_opensurvey_comments` ( + `id_comment` int(10) unsigned NOT NULL AUTO_INCREMENT, + `id_sondage` char(16) NOT NULL, + `comment` text NOT NULL, + `usercomment` text, + PRIMARY KEY (`id_comment`), + KEY `idx_id_comment` (`id_comment`), + KEY `idx_id_sondage` (`id_sondage`) +) ENGINE=InnoDB AUTO_INCREMENT=32 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_opensurvey_comments` +-- + +LOCK TABLES `llx_opensurvey_comments` WRITE; +/*!40000 ALTER TABLE `llx_opensurvey_comments` DISABLE KEYS */; +INSERT INTO `llx_opensurvey_comments` VALUES (2,'434dio8rxfljs3p1','aaa','aaa'),(5,'434dio8rxfljs3p1','aaa','aaa'),(6,'434dio8rxfljs3p1','gfh','jj'),(11,'434dio8rxfljs3p1','fsdf','fdsf'),(12,'3imby4hf7joiilsu','fsdf','aa'),(16,'3imby4hf7joiilsu','gdfg','gfdg'),(17,'3imby4hf7joiilsu','gfdgd','gdfgd'),(18,'om4e7azfiurnjtqe','fds','fdsf'),(26,'qgsfrgb922rqzocy','gfdg','gfdg'),(27,'qgsfrgb922rqzocy','gfdg','gfd'),(28,'m4467s2mtk6khmxc','hgf','hgfh'),(29,'m4467s2mtk6khmxc','fgh','hgf'),(30,'ckanvbe7kt3rdb3h','hfgh','fdfds'),(31,'m4467s2mtk6khmxc','hgfh','hgf'); +/*!40000 ALTER TABLE `llx_opensurvey_comments` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_opensurvey_formquestions` +-- + +DROP TABLE IF EXISTS `llx_opensurvey_formquestions`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_opensurvey_formquestions` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `id_sondage` varchar(16) DEFAULT NULL, + `question` text, + `available_answers` text, + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_opensurvey_formquestions` +-- + +LOCK TABLES `llx_opensurvey_formquestions` WRITE; +/*!40000 ALTER TABLE `llx_opensurvey_formquestions` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_opensurvey_formquestions` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_opensurvey_sondage` +-- + +DROP TABLE IF EXISTS `llx_opensurvey_sondage`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_opensurvey_sondage` ( + `id_sondage` varchar(16) NOT NULL, + `commentaires` text, + `mail_admin` varchar(128) DEFAULT NULL, + `nom_admin` varchar(64) DEFAULT NULL, + `fk_user_creat` int(11) NOT NULL, + `titre` text NOT NULL, + `date_fin` datetime NOT NULL, + `status` int(11) DEFAULT '1', + `format` varchar(2) NOT NULL, + `mailsonde` tinyint(4) NOT NULL DEFAULT '0', + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `entity` int(11) NOT NULL DEFAULT '1', + `allow_comments` tinyint(4) NOT NULL DEFAULT '1', + `allow_spy` tinyint(4) NOT NULL DEFAULT '1', + `sujet` text, + PRIMARY KEY (`id_sondage`), + KEY `idx_date_fin` (`date_fin`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_opensurvey_sondage` +-- + +LOCK TABLES `llx_opensurvey_sondage` WRITE; +/*!40000 ALTER TABLE `llx_opensurvey_sondage` DISABLE KEYS */; +INSERT INTO `llx_opensurvey_sondage` VALUES ('m4467s2mtk6khmxc','fdffdshfghfj jhgjgh','aaa@aaa.com','fdfds',0,'fdffds','2013-03-07 00:00:00',1,'D',1,'2016-07-30 15:51:16',1,1,1,NULL); +/*!40000 ALTER TABLE `llx_opensurvey_sondage` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_opensurvey_user_formanswers` +-- + +DROP TABLE IF EXISTS `llx_opensurvey_user_formanswers`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_opensurvey_user_formanswers` ( + `fk_user_survey` int(11) NOT NULL, + `fk_question` int(11) NOT NULL, + `reponses` text +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_opensurvey_user_formanswers` +-- + +LOCK TABLES `llx_opensurvey_user_formanswers` WRITE; +/*!40000 ALTER TABLE `llx_opensurvey_user_formanswers` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_opensurvey_user_formanswers` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_opensurvey_user_studs` +-- + +DROP TABLE IF EXISTS `llx_opensurvey_user_studs`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_opensurvey_user_studs` ( + `id_users` int(11) NOT NULL AUTO_INCREMENT, + `nom` varchar(64) NOT NULL, + `id_sondage` varchar(16) NOT NULL, + `reponses` varchar(100) NOT NULL, + PRIMARY KEY (`id_users`), + KEY `idx_id_users` (`id_users`), + KEY `idx_nom` (`nom`), + KEY `idx_id_sondage` (`id_sondage`), + KEY `idx_opensurvey_user_studs_id_users` (`id_users`), + KEY `idx_opensurvey_user_studs_nom` (`nom`), + KEY `idx_opensurvey_user_studs_id_sondage` (`id_sondage`) +) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_opensurvey_user_studs` +-- + +LOCK TABLES `llx_opensurvey_user_studs` WRITE; +/*!40000 ALTER TABLE `llx_opensurvey_user_studs` DISABLE KEYS */; +INSERT INTO `llx_opensurvey_user_studs` VALUES (1,'gfdgdf','om4e7azfiurnjtqe','01'),(2,'aa','3imby4hf7joiilsu','210'),(3,'fsdf','z2qcqjh5pm1q4p99','0110'),(5,'hfghf','z2qcqjh5pm1q4p99','1110'),(6,'qqqq','ah9xvaqu1ajjrqse','000111'),(7,'hjgh','ah9xvaqu1ajjrqse','000010'),(8,'bcvb','qgsfrgb922rqzocy','011000'),(9,'gdfg','ah9xvaqu1ajjrqse','001000'),(10,'ggg','ah9xvaqu1ajjrqse','000100'),(11,'gfdgd','ah9xvaqu1ajjrqse','001000'),(12,'hhhh','ah9xvaqu1ajjrqse','010000'),(13,'iii','ah9xvaqu1ajjrqse','000100'),(14,'kkk','ah9xvaqu1ajjrqse','001000'),(15,'lllll','ah9xvaqu1ajjrqse','000001'),(16,'kk','ah9xvaqu1ajjrqse','000001'),(17,'gggg','ah9xvaqu1ajjrqse','001000'),(18,'mmmm','ah9xvaqu1ajjrqse','000000'),(19,'jkjkj','ah9xvaqu1ajjrqse','000001'),(20,'azerty','8mcdnf2hgcntfibe','012'),(21,'hfghfg','8mcdnf2hgcntfibe','012'),(22,'fd','ckanvbe7kt3rdb3h','10'),(23,'gfdgdf','m4467s2mtk6khmxc','00011'),(24,'hgfh','m4467s2mtk6khmxc','000111'); +/*!40000 ALTER TABLE `llx_opensurvey_user_studs` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_overwrite_trans` +-- + +DROP TABLE IF EXISTS `llx_overwrite_trans`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_overwrite_trans` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `lang` varchar(5) DEFAULT NULL, + `transkey` varchar(128) DEFAULT NULL, + `transvalue` text, + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_overwrite_trans` (`lang`,`transkey`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_overwrite_trans` +-- + +LOCK TABLES `llx_overwrite_trans` WRITE; +/*!40000 ALTER TABLE `llx_overwrite_trans` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_overwrite_trans` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_paiement` +-- + +DROP TABLE IF EXISTS `llx_paiement`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_paiement` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `ref` varchar(30) NOT NULL DEFAULT '', + `entity` int(11) NOT NULL DEFAULT '1', + `datec` datetime DEFAULT NULL, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `datep` datetime DEFAULT NULL, + `amount` double(24,8) DEFAULT NULL, + `fk_paiement` int(11) NOT NULL, + `num_paiement` varchar(50) DEFAULT NULL, + `note` text, + `fk_bank` int(11) NOT NULL DEFAULT '0', + `fk_user_creat` int(11) DEFAULT NULL, + `fk_user_modif` int(11) DEFAULT NULL, + `statut` smallint(6) NOT NULL DEFAULT '0', + `fk_export_compta` int(11) NOT NULL DEFAULT '0', + `multicurrency_amount` double(24,8) DEFAULT '0.00000000', + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB AUTO_INCREMENT=34 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_paiement` +-- + +LOCK TABLES `llx_paiement` WRITE; +/*!40000 ALTER TABLE `llx_paiement` DISABLE KEYS */; +INSERT INTO `llx_paiement` VALUES (2,'',1,'2011-07-18 20:50:24','2016-07-30 15:13:20','2016-07-08 12:00:00',20.00000000,6,'','',5,1,NULL,0,0,0.00000000),(3,'',1,'2011-07-18 20:50:47','2016-07-30 15:13:20','2016-07-08 12:00:00',10.00000000,4,'','',6,1,NULL,0,0,0.00000000),(5,'',1,'2011-08-01 03:34:11','2016-07-30 15:12:32','2015-08-01 03:34:11',5.63000000,6,'','Payment Invoice FA1108-0003',8,1,NULL,0,0,0.00000000),(6,'',1,'2011-08-06 20:33:54','2016-07-30 15:12:32','2015-08-06 20:33:53',5.98000000,4,'','Payment Invoice FA1108-0004',13,1,NULL,0,0,0.00000000),(8,'',1,'2011-08-08 02:53:40','2016-07-30 15:12:32','2015-08-08 12:00:00',26.10000000,4,'','',14,1,NULL,0,0,0.00000000),(9,'',1,'2011-08-08 02:55:58','2016-07-30 15:12:32','2015-08-08 12:00:00',26.96000000,1,'','',15,1,NULL,0,0,0.00000000),(17,'',1,'2012-12-09 15:28:44','2016-07-30 15:12:32','2015-12-09 12:00:00',2.00000000,4,'','',16,1,NULL,0,0,0.00000000),(18,'',1,'2012-12-09 15:28:53','2016-07-30 15:12:32','2015-12-09 12:00:00',-2.00000000,4,'','',17,1,NULL,0,0,0.00000000),(19,'',1,'2012-12-09 17:35:55','2016-07-30 15:12:32','2015-12-09 12:00:00',-2.00000000,4,'','',18,1,NULL,0,0,0.00000000),(20,'',1,'2012-12-09 17:37:02','2016-07-30 15:12:32','2015-12-09 12:00:00',2.00000000,4,'','',19,1,NULL,0,0,0.00000000),(21,'',1,'2012-12-09 18:35:07','2016-07-30 15:12:32','2015-12-09 12:00:00',-2.00000000,4,'','',20,1,NULL,0,0,0.00000000),(23,'',1,'2012-12-12 18:54:33','2016-07-30 15:12:32','2015-12-12 12:00:00',1.00000000,1,'','',21,1,NULL,0,0,0.00000000),(24,'',1,'2013-03-06 16:48:16','2016-07-30 15:13:20','2016-03-06 00:00:00',20.00000000,4,'','Adhésion/cotisation 2016',22,1,NULL,0,0,0.00000000),(25,'',1,'2013-03-20 14:30:11','2016-07-30 15:13:20','2016-03-20 00:00:00',10.00000000,2,'','Adhésion/cotisation 2011',23,1,NULL,0,0,0.00000000),(26,'',1,'2014-03-02 19:57:58','2016-07-30 15:13:20','2016-07-09 12:00:00',605.00000000,2,'','',24,1,NULL,0,0,0.00000000),(29,'',1,'2014-03-02 20:01:39','2016-07-30 15:13:20','2016-03-19 12:00:00',500.00000000,4,'','',26,1,NULL,0,0,0.00000000),(30,'',1,'2014-03-02 20:02:06','2016-07-30 15:13:20','2016-03-21 12:00:00',400.00000000,2,'','',27,1,NULL,0,0,0.00000000),(32,'',1,'2014-03-03 19:22:32','2016-07-30 15:12:32','2015-10-03 12:00:00',-400.00000000,4,'','',28,1,NULL,0,0,0.00000000),(33,'',1,'2014-03-03 19:23:16','2016-07-30 15:13:20','2016-03-10 12:00:00',-300.00000000,4,'','',29,1,NULL,0,0,0.00000000); +/*!40000 ALTER TABLE `llx_paiement` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_paiement_facture` +-- + +DROP TABLE IF EXISTS `llx_paiement_facture`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_paiement_facture` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `fk_paiement` int(11) DEFAULT NULL, + `fk_facture` int(11) DEFAULT NULL, + `amount` double(24,8) DEFAULT NULL, + `multicurrency_amount` double(24,8) DEFAULT '0.00000000', + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_paiement_facture` (`fk_paiement`,`fk_facture`), + KEY `idx_paiement_facture_fk_facture` (`fk_facture`), + KEY `idx_paiement_facture_fk_paiement` (`fk_paiement`), + CONSTRAINT `fk_paiement_facture_fk_facture` FOREIGN KEY (`fk_facture`) REFERENCES `llx_facture` (`rowid`), + CONSTRAINT `fk_paiement_facture_fk_paiement` FOREIGN KEY (`fk_paiement`) REFERENCES `llx_paiement` (`rowid`) +) ENGINE=InnoDB AUTO_INCREMENT=38 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_paiement_facture` +-- + +LOCK TABLES `llx_paiement_facture` WRITE; +/*!40000 ALTER TABLE `llx_paiement_facture` DISABLE KEYS */; +INSERT INTO `llx_paiement_facture` VALUES (2,2,2,20.00000000,0.00000000),(3,3,2,10.00000000,0.00000000),(5,5,5,5.63000000,0.00000000),(6,6,6,5.98000000,0.00000000),(9,8,2,16.10000000,0.00000000),(10,8,8,10.00000000,0.00000000),(11,9,3,15.00000000,0.00000000),(12,9,9,11.96000000,0.00000000),(24,20,9,1.00000000,0.00000000),(31,26,32,600.00000000,0.00000000),(36,29,32,500.00000000,0.00000000),(37,30,32,400.00000000,0.00000000); +/*!40000 ALTER TABLE `llx_paiement_facture` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_paiementcharge` +-- + +DROP TABLE IF EXISTS `llx_paiementcharge`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_paiementcharge` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `fk_charge` int(11) DEFAULT NULL, + `datec` datetime DEFAULT NULL, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `datep` datetime DEFAULT NULL, + `amount` double DEFAULT '0', + `fk_typepaiement` int(11) NOT NULL, + `num_paiement` varchar(50) DEFAULT NULL, + `note` text, + `fk_bank` int(11) NOT NULL, + `fk_user_creat` int(11) DEFAULT NULL, + `fk_user_modif` int(11) DEFAULT NULL, + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_paiementcharge` +-- + +LOCK TABLES `llx_paiementcharge` WRITE; +/*!40000 ALTER TABLE `llx_paiementcharge` DISABLE KEYS */; +INSERT INTO `llx_paiementcharge` VALUES (4,4,'2011-08-05 23:11:37','2011-08-05 21:11:37','2011-08-05 12:00:00',10,2,'','',12,1,NULL); +/*!40000 ALTER TABLE `llx_paiementcharge` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_paiementfourn` +-- + +DROP TABLE IF EXISTS `llx_paiementfourn`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_paiementfourn` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `ref` varchar(30) DEFAULT NULL, + `entity` int(11) DEFAULT NULL, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `datec` datetime DEFAULT NULL, + `datep` datetime DEFAULT NULL, + `amount` double DEFAULT '0', + `fk_user_author` int(11) DEFAULT NULL, + `fk_paiement` int(11) NOT NULL, + `num_paiement` varchar(50) DEFAULT NULL, + `note` text, + `fk_bank` int(11) NOT NULL, + `statut` smallint(6) NOT NULL DEFAULT '0', + `multicurrency_amount` double(24,8) DEFAULT '0.00000000', + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_paiementfourn` +-- + +LOCK TABLES `llx_paiementfourn` WRITE; +/*!40000 ALTER TABLE `llx_paiementfourn` DISABLE KEYS */; +INSERT INTO `llx_paiementfourn` VALUES (1,NULL,NULL,'2016-01-22 17:56:34','2016-01-22 18:56:34','2016-01-22 12:00:00',900,12,4,'','',30,0,0.00000000); +/*!40000 ALTER TABLE `llx_paiementfourn` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_paiementfourn_facturefourn` +-- + +DROP TABLE IF EXISTS `llx_paiementfourn_facturefourn`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_paiementfourn_facturefourn` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `fk_paiementfourn` int(11) DEFAULT NULL, + `fk_facturefourn` int(11) DEFAULT NULL, + `amount` double DEFAULT '0', + `multicurrency_amount` double(24,8) DEFAULT '0.00000000', + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_paiementfourn_facturefourn` (`fk_paiementfourn`,`fk_facturefourn`), + KEY `idx_paiementfourn_facturefourn_fk_facture` (`fk_facturefourn`), + KEY `idx_paiementfourn_facturefourn_fk_paiement` (`fk_paiementfourn`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_paiementfourn_facturefourn` +-- + +LOCK TABLES `llx_paiementfourn_facturefourn` WRITE; +/*!40000 ALTER TABLE `llx_paiementfourn_facturefourn` DISABLE KEYS */; +INSERT INTO `llx_paiementfourn_facturefourn` VALUES (1,1,16,900,0.00000000); +/*!40000 ALTER TABLE `llx_paiementfourn_facturefourn` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_payment_donation` +-- + +DROP TABLE IF EXISTS `llx_payment_donation`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_payment_donation` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `fk_donation` int(11) DEFAULT NULL, + `datec` datetime DEFAULT NULL, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `datep` datetime DEFAULT NULL, + `amount` double DEFAULT '0', + `fk_typepayment` int(11) NOT NULL, + `num_payment` varchar(50) DEFAULT NULL, + `note` text, + `fk_bank` int(11) NOT NULL, + `fk_user_creat` int(11) DEFAULT NULL, + `fk_user_modif` int(11) DEFAULT NULL, + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_payment_donation` +-- + +LOCK TABLES `llx_payment_donation` WRITE; +/*!40000 ALTER TABLE `llx_payment_donation` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_payment_donation` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_payment_expensereport` +-- + +DROP TABLE IF EXISTS `llx_payment_expensereport`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_payment_expensereport` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `fk_expensereport` int(11) DEFAULT NULL, + `datec` datetime DEFAULT NULL, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `datep` datetime DEFAULT NULL, + `amount` double DEFAULT '0', + `fk_typepayment` int(11) NOT NULL, + `num_payment` varchar(50) DEFAULT NULL, + `note` text, + `fk_bank` int(11) NOT NULL, + `fk_user_creat` int(11) DEFAULT NULL, + `fk_user_modif` int(11) DEFAULT NULL, + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_payment_expensereport` +-- + +LOCK TABLES `llx_payment_expensereport` WRITE; +/*!40000 ALTER TABLE `llx_payment_expensereport` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_payment_expensereport` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_payment_loan` +-- + +DROP TABLE IF EXISTS `llx_payment_loan`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_payment_loan` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `fk_loan` int(11) DEFAULT NULL, + `datec` datetime DEFAULT NULL, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `datep` datetime DEFAULT NULL, + `amount_capital` double DEFAULT '0', + `amount_insurance` double DEFAULT '0', + `amount_interest` double DEFAULT '0', + `fk_typepayment` int(11) NOT NULL, + `num_payment` varchar(50) DEFAULT NULL, + `note_private` text, + `note_public` text, + `fk_bank` int(11) NOT NULL, + `fk_user_creat` int(11) DEFAULT NULL, + `fk_user_modif` int(11) DEFAULT NULL, + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_payment_loan` +-- + +LOCK TABLES `llx_payment_loan` WRITE; +/*!40000 ALTER TABLE `llx_payment_loan` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_payment_loan` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_payment_salary` +-- + +DROP TABLE IF EXISTS `llx_payment_salary`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_payment_salary` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `datec` datetime DEFAULT NULL, + `fk_user` int(11) NOT NULL, + `datep` date DEFAULT NULL, + `datev` date DEFAULT NULL, + `salary` double DEFAULT NULL, + `amount` double NOT NULL DEFAULT '0', + `fk_typepayment` int(11) NOT NULL, + `num_payment` varchar(50) DEFAULT NULL, + `label` varchar(255) DEFAULT NULL, + `datesp` date DEFAULT NULL, + `dateep` date DEFAULT NULL, + `entity` int(11) NOT NULL DEFAULT '1', + `note` text, + `fk_bank` int(11) DEFAULT NULL, + `fk_user_author` int(11) DEFAULT NULL, + `fk_user_modif` int(11) DEFAULT NULL, + PRIMARY KEY (`rowid`), + KEY `idx_payment_salary_ref` (`num_payment`), + KEY `idx_payment_salary_user` (`fk_user`,`entity`), + KEY `idx_payment_salary_datep` (`datep`), + KEY `idx_payment_salary_datesp` (`datesp`), + KEY `idx_payment_salary_dateep` (`dateep`), + CONSTRAINT `fk_payment_salary_user` FOREIGN KEY (`fk_user`) REFERENCES `llx_user` (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_payment_salary` +-- + +LOCK TABLES `llx_payment_salary` WRITE; +/*!40000 ALTER TABLE `llx_payment_salary` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_payment_salary` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_prelevement_bons` +-- + +DROP TABLE IF EXISTS `llx_prelevement_bons`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_prelevement_bons` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `ref` varchar(12) DEFAULT NULL, + `entity` int(11) NOT NULL DEFAULT '1', + `datec` datetime DEFAULT NULL, + `amount` double DEFAULT '0', + `statut` smallint(6) DEFAULT '0', + `credite` smallint(6) DEFAULT '0', + `note` text, + `date_trans` datetime DEFAULT NULL, + `method_trans` smallint(6) DEFAULT NULL, + `fk_user_trans` int(11) DEFAULT NULL, + `date_credit` datetime DEFAULT NULL, + `fk_user_credit` int(11) DEFAULT NULL, + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_prelevement_bons_ref` (`ref`,`entity`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_prelevement_bons` +-- + +LOCK TABLES `llx_prelevement_bons` WRITE; +/*!40000 ALTER TABLE `llx_prelevement_bons` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_prelevement_bons` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_prelevement_facture` +-- + +DROP TABLE IF EXISTS `llx_prelevement_facture`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_prelevement_facture` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `fk_facture` int(11) NOT NULL, + `fk_prelevement_lignes` int(11) NOT NULL, + PRIMARY KEY (`rowid`), + KEY `idx_prelevement_facture_fk_prelevement_lignes` (`fk_prelevement_lignes`), + CONSTRAINT `fk_prelevement_facture_fk_prelevement_lignes` FOREIGN KEY (`fk_prelevement_lignes`) REFERENCES `llx_prelevement_lignes` (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_prelevement_facture` +-- + +LOCK TABLES `llx_prelevement_facture` WRITE; +/*!40000 ALTER TABLE `llx_prelevement_facture` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_prelevement_facture` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_prelevement_facture_demande` +-- + +DROP TABLE IF EXISTS `llx_prelevement_facture_demande`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_prelevement_facture_demande` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `fk_facture` int(11) NOT NULL, + `amount` double NOT NULL, + `date_demande` datetime NOT NULL, + `traite` smallint(6) DEFAULT '0', + `date_traite` datetime DEFAULT NULL, + `fk_prelevement_bons` int(11) DEFAULT NULL, + `fk_user_demande` int(11) NOT NULL, + `code_banque` varchar(128) DEFAULT NULL, + `code_guichet` varchar(6) DEFAULT NULL, + `number` varchar(255) DEFAULT NULL, + `cle_rib` varchar(5) DEFAULT NULL, + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_prelevement_facture_demande` +-- + +LOCK TABLES `llx_prelevement_facture_demande` WRITE; +/*!40000 ALTER TABLE `llx_prelevement_facture_demande` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_prelevement_facture_demande` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_prelevement_lignes` +-- + +DROP TABLE IF EXISTS `llx_prelevement_lignes`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_prelevement_lignes` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `fk_prelevement_bons` int(11) DEFAULT NULL, + `fk_soc` int(11) NOT NULL, + `statut` smallint(6) DEFAULT '0', + `client_nom` varchar(255) DEFAULT NULL, + `amount` double DEFAULT '0', + `code_banque` varchar(128) DEFAULT NULL, + `code_guichet` varchar(6) DEFAULT NULL, + `number` varchar(255) DEFAULT NULL, + `cle_rib` varchar(5) DEFAULT NULL, + `note` text, + PRIMARY KEY (`rowid`), + KEY `idx_prelevement_lignes_fk_prelevement_bons` (`fk_prelevement_bons`), + CONSTRAINT `fk_prelevement_lignes_fk_prelevement_bons` FOREIGN KEY (`fk_prelevement_bons`) REFERENCES `llx_prelevement_bons` (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_prelevement_lignes` +-- + +LOCK TABLES `llx_prelevement_lignes` WRITE; +/*!40000 ALTER TABLE `llx_prelevement_lignes` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_prelevement_lignes` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_prelevement_rejet` +-- + +DROP TABLE IF EXISTS `llx_prelevement_rejet`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_prelevement_rejet` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `fk_prelevement_lignes` int(11) DEFAULT NULL, + `date_rejet` datetime DEFAULT NULL, + `motif` int(11) DEFAULT NULL, + `date_creation` datetime DEFAULT NULL, + `fk_user_creation` int(11) DEFAULT NULL, + `note` text, + `afacturer` tinyint(4) DEFAULT '0', + `fk_facture` int(11) DEFAULT NULL, + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_prelevement_rejet` +-- + +LOCK TABLES `llx_prelevement_rejet` WRITE; +/*!40000 ALTER TABLE `llx_prelevement_rejet` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_prelevement_rejet` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_printing` +-- + +DROP TABLE IF EXISTS `llx_printing`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_printing` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `datec` datetime DEFAULT NULL, + `printer_name` text NOT NULL, + `printer_location` text NOT NULL, + `printer_id` varchar(255) NOT NULL, + `copy` int(11) NOT NULL DEFAULT '1', + `module` varchar(16) NOT NULL, + `driver` varchar(16) NOT NULL, + `userid` int(11) DEFAULT NULL, + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_printing` +-- + +LOCK TABLES `llx_printing` WRITE; +/*!40000 ALTER TABLE `llx_printing` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_printing` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_product` +-- + +DROP TABLE IF EXISTS `llx_product`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_product` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `datec` datetime DEFAULT NULL, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `virtual` tinyint(4) NOT NULL DEFAULT '0', + `fk_parent` int(11) DEFAULT '0', + `ref` varchar(128) NOT NULL, + `entity` int(11) NOT NULL DEFAULT '1', + `ref_ext` varchar(128) DEFAULT NULL, + `label` varchar(255) NOT NULL, + `description` text, + `note` text, + `customcode` varchar(32) DEFAULT NULL, + `fk_country` int(11) DEFAULT NULL, + `price` double(24,8) DEFAULT '0.00000000', + `price_ttc` double(24,8) DEFAULT '0.00000000', + `price_min` double(24,8) DEFAULT '0.00000000', + `price_min_ttc` double(24,8) DEFAULT '0.00000000', + `price_base_type` varchar(3) DEFAULT 'HT', + `tva_tx` double(6,3) DEFAULT NULL, + `recuperableonly` int(11) NOT NULL DEFAULT '0', + `localtax1_tx` double(6,3) DEFAULT '0.000', + `localtax1_type` varchar(10) NOT NULL DEFAULT '0', + `localtax2_tx` double(6,3) DEFAULT '0.000', + `localtax2_type` varchar(10) NOT NULL DEFAULT '0', + `fk_user_author` int(11) DEFAULT NULL, + `fk_user_modif` int(11) DEFAULT NULL, + `tosell` tinyint(4) DEFAULT '1', + `tobuy` tinyint(4) DEFAULT '1', + `onportal` smallint(6) DEFAULT '0', + `tobatch` tinyint(4) NOT NULL DEFAULT '0', + `fk_product_type` int(11) DEFAULT '0', + `duration` varchar(6) DEFAULT NULL, + `seuil_stock_alerte` int(11) DEFAULT '0', + `url` varchar(255) DEFAULT NULL, + `barcode` varchar(255) DEFAULT NULL, + `fk_barcode_type` int(11) DEFAULT NULL, + `accountancy_code_sell` varchar(32) DEFAULT NULL, + `accountancy_code_buy` varchar(32) DEFAULT NULL, + `partnumber` varchar(32) DEFAULT NULL, + `weight` float DEFAULT NULL, + `weight_units` tinyint(4) DEFAULT NULL, + `length` float DEFAULT NULL, + `length_units` tinyint(4) DEFAULT NULL, + `surface` float DEFAULT NULL, + `surface_units` tinyint(4) DEFAULT NULL, + `volume` float DEFAULT NULL, + `volume_units` tinyint(4) DEFAULT NULL, + `stock` double DEFAULT NULL, + `pmp` double(24,8) NOT NULL DEFAULT '0.00000000', + `fifo` double(24,8) DEFAULT NULL, + `lifo` double(24,8) DEFAULT NULL, + `canvas` varchar(32) DEFAULT 'default@product', + `finished` tinyint(4) DEFAULT NULL, + `hidden` tinyint(4) DEFAULT '0', + `import_key` varchar(14) DEFAULT NULL, + `desiredstock` int(11) DEFAULT '0', + `fk_price_expression` int(11) DEFAULT NULL, + `fk_unit` int(11) DEFAULT NULL, + `cost_price` double(24,8) DEFAULT NULL, + `default_vat_code` varchar(10) DEFAULT NULL, + `price_autogen` smallint(6) DEFAULT '0', + `note_public` text, + `model_pdf` varchar(255) DEFAULT '', + `width` float DEFAULT NULL, + `width_units` tinyint(4) DEFAULT NULL, + `height` float DEFAULT NULL, + `height_units` tinyint(4) DEFAULT NULL, + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_product_ref` (`ref`,`entity`), + UNIQUE KEY `uk_product_barcode` (`barcode`,`fk_barcode_type`,`entity`), + KEY `idx_product_label` (`label`), + KEY `idx_product_barcode` (`barcode`), + KEY `idx_product_import_key` (`import_key`), + KEY `idx_product_fk_country` (`fk_country`), + KEY `idx_product_fk_user_author` (`fk_user_author`), + KEY `idx_product_fk_barcode_type` (`fk_barcode_type`), + KEY `fk_product_fk_unit` (`fk_unit`), + KEY `idx_product_seuil_stock_alerte` (`seuil_stock_alerte`), + CONSTRAINT `fk_product_barcode_type` FOREIGN KEY (`fk_barcode_type`) REFERENCES `llx_c_barcode_type` (`rowid`), + CONSTRAINT `fk_product_fk_country` FOREIGN KEY (`fk_country`) REFERENCES `llx_c_country` (`rowid`), + CONSTRAINT `fk_product_fk_unit` FOREIGN KEY (`fk_unit`) REFERENCES `llx_c_units` (`rowid`) +) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_product` +-- + +LOCK TABLES `llx_product` WRITE; +/*!40000 ALTER TABLE `llx_product` DISABLE KEYS */; +INSERT INTO `llx_product` VALUES (1,'2010-07-08 14:33:17','2016-01-16 16:30:35',0,0,'PINKDRESS',1,NULL,'Pink dress','A beatifull pink dress','','',NULL,100.00000000,112.50000000,90.00000000,101.25000000,'HT',12.500,0,0.000,'0',0.000,'0',1,NULL,1,1,0,0,0,'',NULL,NULL,'123456789066',2,'701PINKDRESS','601PINKDRESS',NULL,670,-3,NULL,0,NULL,0,NULL,0,2,0.00000000,NULL,NULL,NULL,1,0,NULL,NULL,NULL,NULL,NULL,NULL,0,NULL,'',NULL,NULL,NULL,NULL),(2,'2010-07-09 00:30:01','2016-01-16 16:37:14',0,0,'PEARPIE',1,NULL,'Pear Pie','','','',NULL,0.00000000,0.00000000,0.00000000,0.00000000,'HT',12.500,0,0.000,'0',0.000,'0',1,NULL,1,1,0,0,0,'',NULL,NULL,'123456789077',2,'','',NULL,NULL,0,NULL,0,NULL,0,NULL,0,998,0.00000000,NULL,NULL,NULL,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,0,NULL,'',NULL,NULL,NULL,NULL),(3,'2010-07-09 00:30:25','2016-01-16 16:40:03',0,0,'CAKECONTRIB',1,NULL,'Cake making contribution','','','',NULL,0.00000000,0.00000000,0.00000000,0.00000000,'HT',12.500,0,0.000,'0',0.000,'0',1,NULL,1,1,0,0,1,'1m',NULL,NULL,'123456789088',2,'701CAKEM','601CAKEM',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0.00000000,NULL,NULL,NULL,0,0,NULL,NULL,NULL,NULL,NULL,NULL,0,NULL,'',NULL,NULL,NULL,NULL),(4,'2010-07-10 14:44:06','2016-01-16 15:58:20',0,0,'APPLEPIE',1,NULL,'Apple Pie','Nice Bio Apple Pie.
\r\n ','','',NULL,5.00000000,5.62500000,0.00000000,0.00000000,'HT',12.500,0,0.000,'0',0.000,'0',1,NULL,1,1,0,0,0,'',NULL,NULL,'123456789034',2,'701','601',NULL,500,-3,NULL,0,NULL,0,NULL,0,1001,10.00000000,NULL,NULL,NULL,1,0,NULL,NULL,NULL,NULL,NULL,NULL,0,NULL,'',NULL,NULL,NULL,NULL),(5,'2011-07-20 23:11:38','2016-01-16 16:18:24',0,0,'DOLIDROID',1,NULL,'DoliDroid, Android app for Dolibarr','DoliDroid is the Android front-end client for Dolibarr ERP & CRM web software.
\r\nThis application is not a standalone program. It is a front end to use a online hosted Dolibarr ERP & CRM software (an Open-source web software to manage your business).
\r\n

The advantage of DoliDroid are :
\r\n- DoliDroid is not a duplicate code of Dolibarr, but a front-end of a Dolibarr web installation, so all your online existing features are supported by this application. This is also true for external modules features.
\r\n- Upgrading Dolibarr will not break DoliDroid.
\r\n- DoliDroid use embedded image resources to reduce bandwidth usage.
\r\n- DoliDroid use internal cache for pages that should not change (like menu page)
\r\n- Connections parameters are saved. No need to enter them each time you use DoliDroid.
\r\n- Integration with your phone or other applications (Clicking on PDF open PDF reader, clicking onto email or phone launch your email application or launch Android dialer, ...)

\r\n\r\n

WARNING ! 

\r\n\r\n

This application need Android 4.0+ and a hosted Dolibarr ERP & CRM version 3.5 or newer accessible by internet
\r\n(For example, when hosted on any SaaS solution like DoliCloud - http://www.dolicloud.com).

','','',NULL,10.00000000,11.96000000,0.00000000,0.00000000,'HT',19.600,0,0.000,'0',0.000,'0',1,NULL,1,1,0,0,0,'',NULL,'https://play.google.com/store/apps/details?id=com.nltechno.dolidroidpro','123456789023',2,'701','601',NULL,NULL,0,NULL,0,NULL,0,NULL,0,NULL,0.00000000,NULL,NULL,'',NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,0,NULL,'',NULL,NULL,NULL,NULL),(10,'2008-12-31 00:00:00','2016-07-30 13:41:16',0,0,'COMP-XP4523',1,NULL,'Computer XP4523','A powerfull computer XP4523 ','This product is imported.
\r\nWarning: Delay to get it are not reliable.','USXP765',11,100.00000000,110.00000000,0.00000000,0.00000000,'HT',10.000,0,0.000,'0',0.000,'0',NULL,12,1,1,0,1,0,'',150,NULL,'123456789055',2,'701OLDC','601OLDC',NULL,1.7,0,NULL,0,NULL,0,NULL,0,110,0.00000000,NULL,NULL,NULL,NULL,0,'20110729232310',200,NULL,NULL,NULL,NULL,0,NULL,'',NULL,NULL,NULL,NULL),(11,'2013-01-13 20:24:42','2016-07-30 13:42:31',0,0,'ROLLUPABC',1,NULL,'Rollup Dolibarr','A nice rollup','','',NULL,0.00000000,0.00000000,0.00000000,0.00000000,'HT',0.000,0,0.000,'0',0.000,'0',1,12,0,0,0,0,0,'',NULL,NULL,'123456789044',2,'','',NULL,2.5,0,NULL,0,2.34,0,NULL,0,-1,0.00000000,NULL,NULL,'',1,0,NULL,NULL,NULL,NULL,NULL,NULL,0,NULL,'',NULL,NULL,NULL,NULL),(12,'2016-07-30 17:31:29','2016-07-30 13:35:02',0,0,'DOLICLOUD',1,NULL,'SaaS service of Dolibarr ERP CRM','Cloud hosting of Dolibarr ERP and CRM software','','',NULL,9.00000000,9.00000000,9.00000000,9.00000000,'HT',0.000,0,0.000,'0',0.000,'0',12,12,1,1,0,0,1,'',NULL,'http://www.dolicloud.com','123456789013',2,'','',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0.00000000,NULL,NULL,'',0,0,NULL,NULL,NULL,NULL,8.50000000,NULL,0,NULL,'',NULL,NULL,NULL,NULL); +/*!40000 ALTER TABLE `llx_product` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_product_association` +-- + +DROP TABLE IF EXISTS `llx_product_association`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_product_association` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `fk_product_pere` int(11) NOT NULL DEFAULT '0', + `fk_product_fils` int(11) NOT NULL DEFAULT '0', + `qty` double DEFAULT NULL, + `incdec` int(11) DEFAULT '1', + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_product_association` (`fk_product_pere`,`fk_product_fils`), + KEY `idx_product_association` (`fk_product_fils`), + KEY `idx_product_association_fils` (`fk_product_fils`) +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_product_association` +-- + +LOCK TABLES `llx_product_association` WRITE; +/*!40000 ALTER TABLE `llx_product_association` DISABLE KEYS */; +INSERT INTO `llx_product_association` VALUES (1,4,1,2,1),(2,5,1,1,1); +/*!40000 ALTER TABLE `llx_product_association` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_product_batch` +-- + +DROP TABLE IF EXISTS `llx_product_batch`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_product_batch` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `fk_product_stock` int(11) NOT NULL, + `eatby` datetime DEFAULT NULL, + `sellby` datetime DEFAULT NULL, + `batch` varchar(30) NOT NULL, + `qty` double NOT NULL DEFAULT '0', + `import_key` varchar(14) DEFAULT NULL, + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_product_batch` (`fk_product_stock`,`batch`), + KEY `idx_fk_product_stock` (`fk_product_stock`), + KEY `ix_fk_product_stock` (`fk_product_stock`), + KEY `idx_batch` (`batch`), + CONSTRAINT `fk_product_batch_fk_product_stock` FOREIGN KEY (`fk_product_stock`) REFERENCES `llx_product_stock` (`rowid`) +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_product_batch` +-- + +LOCK TABLES `llx_product_batch` WRITE; +/*!40000 ALTER TABLE `llx_product_batch` DISABLE KEYS */; +INSERT INTO `llx_product_batch` VALUES (1,'2016-07-30 13:40:39',8,NULL,NULL,'5599887766452',15,NULL),(2,'2016-07-30 13:40:12',8,NULL,NULL,'4494487766452',60,NULL),(3,'2016-07-30 13:40:39',9,NULL,NULL,'5599887766452',35,NULL); +/*!40000 ALTER TABLE `llx_product_batch` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_product_customer_price` +-- + +DROP TABLE IF EXISTS `llx_product_customer_price`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_product_customer_price` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `entity` int(11) NOT NULL DEFAULT '1', + `datec` datetime DEFAULT NULL, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `fk_product` int(11) NOT NULL, + `fk_soc` int(11) NOT NULL, + `price` double(24,8) DEFAULT '0.00000000', + `price_ttc` double(24,8) DEFAULT '0.00000000', + `price_min` double(24,8) DEFAULT '0.00000000', + `price_min_ttc` double(24,8) DEFAULT '0.00000000', + `price_base_type` varchar(3) DEFAULT 'HT', + `tva_tx` double(6,3) DEFAULT NULL, + `recuperableonly` int(11) NOT NULL DEFAULT '0', + `localtax1_tx` double(6,3) DEFAULT '0.000', + `localtax1_type` varchar(10) NOT NULL DEFAULT '0', + `localtax2_tx` double(6,3) DEFAULT '0.000', + `localtax2_type` varchar(10) NOT NULL DEFAULT '0', + `fk_user` int(11) DEFAULT NULL, + `import_key` varchar(14) DEFAULT NULL, + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_customer_price_fk_product_fk_soc` (`fk_product`,`fk_soc`), + KEY `idx_product_customer_price_fk_user` (`fk_user`), + KEY `fk_customer_price_fk_soc` (`fk_soc`), + KEY `idx_product_customer_price_fk_soc` (`fk_soc`), + CONSTRAINT `fk_customer_price_fk_product` FOREIGN KEY (`fk_product`) REFERENCES `llx_product` (`rowid`) ON DELETE CASCADE, + CONSTRAINT `fk_customer_price_fk_soc` FOREIGN KEY (`fk_soc`) REFERENCES `llx_societe` (`rowid`) ON DELETE CASCADE, + CONSTRAINT `fk_product_customer_price_fk_product` FOREIGN KEY (`fk_product`) REFERENCES `llx_product` (`rowid`), + CONSTRAINT `fk_product_customer_price_fk_soc` FOREIGN KEY (`fk_soc`) REFERENCES `llx_societe` (`rowid`), + CONSTRAINT `fk_product_customer_price_fk_user` FOREIGN KEY (`fk_user`) REFERENCES `llx_user` (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_product_customer_price` +-- + +LOCK TABLES `llx_product_customer_price` WRITE; +/*!40000 ALTER TABLE `llx_product_customer_price` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_product_customer_price` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_product_customer_price_log` +-- + +DROP TABLE IF EXISTS `llx_product_customer_price_log`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_product_customer_price_log` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `entity` int(11) NOT NULL DEFAULT '1', + `datec` datetime DEFAULT NULL, + `fk_product` int(11) NOT NULL, + `fk_soc` int(11) NOT NULL, + `price` double(24,8) DEFAULT '0.00000000', + `price_ttc` double(24,8) DEFAULT '0.00000000', + `price_min` double(24,8) DEFAULT '0.00000000', + `price_min_ttc` double(24,8) DEFAULT '0.00000000', + `price_base_type` varchar(3) DEFAULT 'HT', + `tva_tx` double(6,3) DEFAULT NULL, + `recuperableonly` int(11) NOT NULL DEFAULT '0', + `localtax1_tx` double(6,3) DEFAULT '0.000', + `localtax1_type` varchar(10) NOT NULL DEFAULT '0', + `localtax2_tx` double(6,3) DEFAULT '0.000', + `localtax2_type` varchar(10) NOT NULL DEFAULT '0', + `fk_user` int(11) DEFAULT NULL, + `import_key` varchar(14) DEFAULT NULL, + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_product_customer_price_log` +-- + +LOCK TABLES `llx_product_customer_price_log` WRITE; +/*!40000 ALTER TABLE `llx_product_customer_price_log` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_product_customer_price_log` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_product_extrafields` +-- + +DROP TABLE IF EXISTS `llx_product_extrafields`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_product_extrafields` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `fk_object` int(11) NOT NULL, + `import_key` varchar(14) DEFAULT NULL, + PRIMARY KEY (`rowid`), + KEY `idx_product_extrafields` (`fk_object`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_product_extrafields` +-- + +LOCK TABLES `llx_product_extrafields` WRITE; +/*!40000 ALTER TABLE `llx_product_extrafields` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_product_extrafields` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_product_fournisseur_price` +-- + +DROP TABLE IF EXISTS `llx_product_fournisseur_price`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_product_fournisseur_price` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `datec` datetime DEFAULT NULL, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `fk_product` int(11) DEFAULT NULL, + `fk_soc` int(11) DEFAULT NULL, + `ref_fourn` varchar(30) DEFAULT NULL, + `fk_availability` int(11) DEFAULT NULL, + `price` double(24,8) DEFAULT '0.00000000', + `quantity` double DEFAULT NULL, + `remise_percent` double NOT NULL DEFAULT '0', + `remise` double NOT NULL DEFAULT '0', + `unitprice` double(24,8) DEFAULT '0.00000000', + `charges` double(24,8) DEFAULT '0.00000000', + `unitcharges` double(24,8) DEFAULT '0.00000000', + `tva_tx` double(6,3) NOT NULL DEFAULT '0.000', + `info_bits` int(11) NOT NULL DEFAULT '0', + `fk_user` int(11) DEFAULT NULL, + `import_key` varchar(14) DEFAULT NULL, + `entity` int(11) NOT NULL DEFAULT '1', + `fk_supplier_price_expression` int(11) DEFAULT NULL, + `fk_price_expression` int(11) DEFAULT NULL, + `delivery_time_days` int(11) DEFAULT NULL, + `supplier_reputation` varchar(10) DEFAULT NULL, + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_product_fournisseur_price_ref` (`ref_fourn`,`fk_soc`,`quantity`,`entity`), + KEY `idx_product_fournisseur_price_fk_user` (`fk_user`), + KEY `idx_product_fourn_price_fk_product` (`fk_product`,`entity`), + KEY `idx_product_fourn_price_fk_soc` (`fk_soc`,`entity`), + CONSTRAINT `fk_product_fournisseur_price_fk_product` FOREIGN KEY (`fk_product`) REFERENCES `llx_product` (`rowid`), + CONSTRAINT `fk_product_fournisseur_price_fk_user` FOREIGN KEY (`fk_user`) REFERENCES `llx_user` (`rowid`) +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_product_fournisseur_price` +-- + +LOCK TABLES `llx_product_fournisseur_price` WRITE; +/*!40000 ALTER TABLE `llx_product_fournisseur_price` DISABLE KEYS */; +INSERT INTO `llx_product_fournisseur_price` VALUES (1,'2010-07-11 18:45:42','2012-12-08 13:11:08',4,1,'ABCD',NULL,10.00000000,1,0,0,10.00000000,0.00000000,0.00000000,0.000,0,1,NULL,1,NULL,NULL,NULL,NULL),(2,'2016-07-30 17:34:38','2016-07-30 13:34:38',12,10,'BASIC',0,9.00000000,1,0,0,9.00000000,0.00000000,0.00000000,0.000,0,12,NULL,1,NULL,NULL,NULL,'FAVORITE'); +/*!40000 ALTER TABLE `llx_product_fournisseur_price` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_product_fournisseur_price_log` +-- + +DROP TABLE IF EXISTS `llx_product_fournisseur_price_log`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_product_fournisseur_price_log` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `datec` datetime DEFAULT NULL, + `fk_product_fournisseur` int(11) NOT NULL, + `price` double(24,8) DEFAULT '0.00000000', + `quantity` double DEFAULT NULL, + `fk_user` int(11) DEFAULT NULL, + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_product_fournisseur_price_log` +-- + +LOCK TABLES `llx_product_fournisseur_price_log` WRITE; +/*!40000 ALTER TABLE `llx_product_fournisseur_price_log` DISABLE KEYS */; +INSERT INTO `llx_product_fournisseur_price_log` VALUES (1,'2010-07-11 18:45:42',1,10.00000000,1,1); +/*!40000 ALTER TABLE `llx_product_fournisseur_price_log` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_product_lang` +-- + +DROP TABLE IF EXISTS `llx_product_lang`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_product_lang` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `fk_product` int(11) NOT NULL DEFAULT '0', + `lang` varchar(5) NOT NULL DEFAULT '0', + `label` varchar(255) NOT NULL, + `description` text, + `note` text, + `import_key` varchar(14) DEFAULT NULL, + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_product_lang` (`fk_product`,`lang`), + CONSTRAINT `fk_product_lang_fk_product` FOREIGN KEY (`fk_product`) REFERENCES `llx_product` (`rowid`) +) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_product_lang` +-- + +LOCK TABLES `llx_product_lang` WRITE; +/*!40000 ALTER TABLE `llx_product_lang` DISABLE KEYS */; +INSERT INTO `llx_product_lang` VALUES (1,1,'en_US','Pink dress','A beatifull pink dress','',NULL),(2,2,'en_US','Pear Pie','','',NULL),(3,3,'en_US','Cake making contribution','','',NULL),(4,4,'fr_FR','Decapsuleur','','',NULL),(5,5,'en_US','DoliDroid, Android app for Dolibarr','DoliDroid is the Android front-end client for Dolibarr ERP & CRM web software.
\r\nThis application is not a standalone program. It is a front end to use a online hosted Dolibarr ERP & CRM software (an Open-source web software to manage your business).
\r\n

The advantage of DoliDroid are :
\r\n- DoliDroid is not a duplicate code of Dolibarr, but a front-end of a Dolibarr web installation, so all your online existing features are supported by this application. This is also true for external modules features.
\r\n- Upgrading Dolibarr will not break DoliDroid.
\r\n- DoliDroid use embedded image resources to reduce bandwidth usage.
\r\n- DoliDroid use internal cache for pages that should not change (like menu page)
\r\n- Connections parameters are saved. No need to enter them each time you use DoliDroid.
\r\n- Integration with your phone or other applications (Clicking on PDF open PDF reader, clicking onto email or phone launch your email application or launch Android dialer, ...)

\r\n\r\n

WARNING ! 

\r\n\r\n

This application need Android 4.0+ and a hosted Dolibarr ERP & CRM version 3.5 or newer accessible by internet
\r\n(For example, when hosted on any SaaS solution like DoliCloud - http://www.dolicloud.com).

','',NULL),(9,11,'fr_FR','hfghf','','',NULL),(10,2,'fr_FR','Product P1','','',NULL),(11,4,'en_US','Apple Pie','Nice Bio Apple Pie.
\r\n ','',NULL),(12,11,'en_US','Rollup Dolibarr','A nice rollup','',NULL),(13,10,'en_US','Computer XP4523','A powerfull computer XP4523 ','This product is imported.
\r\nWarning: Delay to get it are not reliable.',NULL),(14,12,'en_US','SaaS hosting of Dolibarr ERP CRM','Cloud hosting of Dolibarr ERP and CRM software','',NULL),(15,12,'fr_FR','Service SaaS Hébergement Dolibarr ERP CRM','Service SaaS d'hébergement de la solution Dolibarr ERP CRM','',NULL); +/*!40000 ALTER TABLE `llx_product_lang` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_product_lot` +-- + +DROP TABLE IF EXISTS `llx_product_lot`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_product_lot` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `entity` int(11) DEFAULT NULL, + `fk_product` int(11) NOT NULL, + `batch` varchar(30) DEFAULT NULL, + `eatby` date DEFAULT NULL, + `sellby` date DEFAULT NULL, + `datec` datetime DEFAULT NULL, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `fk_user_creat` int(11) DEFAULT NULL, + `fk_user_modif` int(11) DEFAULT NULL, + `import_key` int(11) DEFAULT NULL, + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_product_lot` (`fk_product`,`batch`) +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_product_lot` +-- + +LOCK TABLES `llx_product_lot` WRITE; +/*!40000 ALTER TABLE `llx_product_lot` DISABLE KEYS */; +INSERT INTO `llx_product_lot` VALUES (1,NULL,2,'123456','2016-07-07',NULL,'2016-07-21 20:55:19','2016-07-21 16:55:19',NULL,NULL,NULL),(2,NULL,2,'2222','2016-07-08','2016-07-07','2016-07-21 21:00:42','2016-07-21 17:00:42',NULL,NULL,NULL),(3,NULL,10,'5599887766452',NULL,NULL,'2016-07-30 17:39:31','2016-07-30 13:39:31',NULL,NULL,NULL),(4,NULL,10,'4494487766452',NULL,NULL,'2016-07-30 17:40:12','2016-07-30 13:40:12',NULL,NULL,NULL); +/*!40000 ALTER TABLE `llx_product_lot` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_product_price` +-- + +DROP TABLE IF EXISTS `llx_product_price`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_product_price` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `entity` int(11) NOT NULL DEFAULT '1', + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `fk_product` int(11) NOT NULL, + `date_price` datetime NOT NULL, + `price_level` smallint(6) DEFAULT '1', + `price` double(24,8) DEFAULT NULL, + `price_ttc` double(24,8) DEFAULT NULL, + `price_min` double(24,8) DEFAULT NULL, + `price_min_ttc` double(24,8) DEFAULT NULL, + `price_base_type` varchar(3) DEFAULT 'HT', + `tva_tx` double(6,3) NOT NULL, + `recuperableonly` int(11) NOT NULL DEFAULT '0', + `localtax1_tx` double(6,3) DEFAULT '0.000', + `localtax1_type` varchar(10) NOT NULL DEFAULT '0', + `localtax2_tx` double(6,3) DEFAULT '0.000', + `localtax2_type` varchar(10) NOT NULL DEFAULT '0', + `fk_user_author` int(11) DEFAULT NULL, + `tosell` tinyint(4) DEFAULT '1', + `price_by_qty` int(11) NOT NULL DEFAULT '0', + `import_key` varchar(14) DEFAULT NULL, + `fk_price_expression` int(11) DEFAULT NULL, + `fk_multicurrency` int(11) DEFAULT NULL, + `multicurrency_code` varchar(255) DEFAULT NULL, + `multicurrency_price` double(24,8) DEFAULT '0.00000000', + PRIMARY KEY (`rowid`), + KEY `idx_product_price_fk_user_author` (`fk_user_author`), + KEY `idx_product_price_fk_product` (`fk_product`), + CONSTRAINT `fk_product_price_product` FOREIGN KEY (`fk_product`) REFERENCES `llx_product` (`rowid`), + CONSTRAINT `fk_product_price_user_author` FOREIGN KEY (`fk_user_author`) REFERENCES `llx_user` (`rowid`) +) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_product_price` +-- + +LOCK TABLES `llx_product_price` WRITE; +/*!40000 ALTER TABLE `llx_product_price` DISABLE KEYS */; +INSERT INTO `llx_product_price` VALUES (1,1,'2010-07-08 12:33:17',1,'2010-07-08 14:33:17',1,0.00000000,0.00000000,0.00000000,0.00000000,'HT',12.500,0,0.000,'0',0.000,'0',1,1,0,NULL,NULL,NULL,NULL,0.00000000),(2,1,'2010-07-08 22:30:01',2,'2010-07-09 00:30:01',1,0.00000000,0.00000000,0.00000000,0.00000000,'HT',12.500,0,0.000,'0',0.000,'0',1,1,0,NULL,NULL,NULL,NULL,0.00000000),(3,1,'2010-07-08 22:30:25',3,'2010-07-09 00:30:25',1,0.00000000,0.00000000,0.00000000,0.00000000,'HT',12.500,0,0.000,'0',0.000,'0',1,1,0,NULL,NULL,NULL,NULL,0.00000000),(4,1,'2010-07-10 12:44:06',4,'2010-07-10 14:44:06',1,0.00000000,0.00000000,0.00000000,0.00000000,'HT',12.500,0,0.000,'0',0.000,'0',1,1,0,NULL,NULL,NULL,NULL,0.00000000),(5,1,'2011-07-20 21:11:38',5,'2011-07-20 23:11:38',1,0.00000000,0.00000000,0.00000000,0.00000000,'HT',19.600,0,0.000,'0',0.000,'0',1,1,0,NULL,NULL,NULL,NULL,0.00000000),(6,1,'2011-07-27 17:02:59',5,'2011-07-27 19:02:59',1,10.00000000,11.96000000,0.00000000,0.00000000,'HT',19.600,0,0.000,'0',0.000,'0',1,1,0,NULL,NULL,NULL,NULL,0.00000000),(10,1,'2011-07-31 22:34:27',4,'2011-08-01 00:34:27',1,5.00000000,5.62500000,0.00000000,0.00000000,'HT',12.500,0,0.000,'0',0.000,'0',1,1,0,NULL,NULL,NULL,NULL,0.00000000),(12,1,'2013-01-13 19:24:59',11,'2013-01-13 20:24:59',1,0.00000000,0.00000000,0.00000000,0.00000000,'HT',0.000,0,0.000,'0',0.000,'0',1,1,0,NULL,NULL,NULL,NULL,0.00000000),(13,1,'2013-03-12 09:30:24',1,'2013-03-12 10:30:24',1,100.00000000,112.50000000,90.00000000,101.25000000,'HT',12.500,0,0.000,'0',0.000,'0',1,1,0,NULL,NULL,NULL,NULL,0.00000000),(14,1,'2016-07-30 13:31:29',12,'2016-07-30 17:31:29',1,9.00000000,9.00000000,9.00000000,9.00000000,'HT',0.000,0,0.000,'0',0.000,'0',12,1,0,NULL,NULL,NULL,NULL,0.00000000); +/*!40000 ALTER TABLE `llx_product_price` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_product_price_by_qty` +-- + +DROP TABLE IF EXISTS `llx_product_price_by_qty`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_product_price_by_qty` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `fk_product_price` int(11) NOT NULL, + `date_price` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `price` double(24,8) DEFAULT '0.00000000', + `price_ttc` double(24,8) DEFAULT '0.00000000', + `remise_percent` double NOT NULL DEFAULT '0', + `remise` double NOT NULL DEFAULT '0', + `qty_min` double DEFAULT '0', + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_product_price_by_qty_level` (`fk_product_price`,`qty_min`), + KEY `idx_product_price_by_qty_fk_product_price` (`fk_product_price`), + CONSTRAINT `fk_product_price_by_qty_fk_product_price` FOREIGN KEY (`fk_product_price`) REFERENCES `llx_product_price` (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_product_price_by_qty` +-- + +LOCK TABLES `llx_product_price_by_qty` WRITE; +/*!40000 ALTER TABLE `llx_product_price_by_qty` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_product_price_by_qty` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_product_pricerules` +-- + +DROP TABLE IF EXISTS `llx_product_pricerules`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_product_pricerules` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `level` int(11) NOT NULL, + `fk_level` int(11) NOT NULL, + `var_percent` float NOT NULL, + `var_min_percent` float NOT NULL, + PRIMARY KEY (`rowid`), + UNIQUE KEY `unique_level` (`level`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_product_pricerules` +-- + +LOCK TABLES `llx_product_pricerules` WRITE; +/*!40000 ALTER TABLE `llx_product_pricerules` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_product_pricerules` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_product_stock` +-- + +DROP TABLE IF EXISTS `llx_product_stock`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_product_stock` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `fk_product` int(11) NOT NULL, + `fk_entrepot` int(11) NOT NULL, + `reel` double DEFAULT NULL, + `import_key` varchar(14) DEFAULT NULL, + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_product_stock` (`fk_product`,`fk_entrepot`), + KEY `idx_product_stock_fk_product` (`fk_product`), + KEY `idx_product_stock_fk_entrepot` (`fk_entrepot`) +) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_product_stock` +-- + +LOCK TABLES `llx_product_stock` WRITE; +/*!40000 ALTER TABLE `llx_product_stock` DISABLE KEYS */; +INSERT INTO `llx_product_stock` VALUES (1,'2010-07-08 22:43:51',2,2,1000,NULL),(3,'2010-07-10 23:02:20',4,2,1000,NULL),(4,'2013-01-19 17:22:48',4,1,1,NULL),(5,'2013-01-19 17:22:48',1,1,2,NULL),(6,'2013-01-19 17:22:48',11,1,-1,NULL),(7,'2013-01-19 17:31:58',2,1,-2,NULL),(8,'2016-07-30 13:40:39',10,2,75,NULL),(9,'2016-07-30 13:40:39',10,1,35,NULL); +/*!40000 ALTER TABLE `llx_product_stock` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_product_subproduct` +-- + +DROP TABLE IF EXISTS `llx_product_subproduct`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_product_subproduct` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `fk_product` int(11) NOT NULL, + `fk_product_subproduct` int(11) NOT NULL, + PRIMARY KEY (`rowid`), + UNIQUE KEY `fk_product` (`fk_product`,`fk_product_subproduct`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_product_subproduct` +-- + +LOCK TABLES `llx_product_subproduct` WRITE; +/*!40000 ALTER TABLE `llx_product_subproduct` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_product_subproduct` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_projet` +-- + +DROP TABLE IF EXISTS `llx_projet`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_projet` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `fk_soc` int(11) DEFAULT NULL, + `datec` date DEFAULT NULL, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `dateo` date DEFAULT NULL, + `datee` date DEFAULT NULL, + `ref` varchar(50) DEFAULT NULL, + `entity` int(11) NOT NULL DEFAULT '1', + `title` varchar(255) NOT NULL, + `description` text, + `fk_user_creat` int(11) NOT NULL, + `public` int(11) DEFAULT NULL, + `fk_statut` smallint(6) NOT NULL DEFAULT '0', + `fk_opp_status` int(11) DEFAULT NULL, + `opp_percent` double(5,2) DEFAULT NULL, + `note_private` text, + `note_public` text, + `model_pdf` varchar(255) DEFAULT NULL, + `budget_amount` double(24,8) DEFAULT NULL, + `date_close` datetime DEFAULT NULL, + `fk_user_close` int(11) DEFAULT NULL, + `opp_amount` double(24,8) DEFAULT NULL, + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_projet_ref` (`ref`,`entity`), + KEY `idx_projet_fk_soc` (`fk_soc`), + CONSTRAINT `fk_projet_fk_soc` FOREIGN KEY (`fk_soc`) REFERENCES `llx_societe` (`rowid`) +) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_projet` +-- + +LOCK TABLES `llx_projet` WRITE; +/*!40000 ALTER TABLE `llx_projet` DISABLE KEYS */; +INSERT INTO `llx_projet` VALUES (1,11,'2010-07-09','2015-10-05 20:51:28','2010-07-09',NULL,'PROJ1',1,'Project One','',1,0,1,NULL,NULL,NULL,'gdfgdfg','baleine',NULL,NULL,NULL,NULL),(2,13,'2010-07-09','2015-10-05 20:51:51','2010-07-09',NULL,'PROJ2',1,'Project Two','',1,0,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(3,1,'2010-07-09','2016-01-16 15:09:29','2010-07-09',NULL,'PROJINDIAN',1,'Project for Indian company move','',1,0,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(4,NULL,'2010-07-09','2010-07-08 22:50:49','2010-07-09',NULL,'PROJSHARED',1,'The Global project','',1,1,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(5,NULL,'2010-07-11','2010-07-11 14:22:49','2010-07-11','2011-07-14','RMLL',1,'Projet gestion RMLL 2011','',1,1,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(6,10,'2016-07-30','2016-07-30 15:53:07','2016-07-30',NULL,'PJ1607-0001',1,'PROJALICE1','The Alice project number 1',12,0,1,2,20.00,NULL,NULL,NULL,5000.00000000,NULL,NULL,8000.00000000),(7,10,'2016-07-30','2016-07-30 15:53:14','2016-07-30',NULL,'PJ1607-0002',1,'PROJALICE2','The Alice project number 2',12,0,1,4,60.00,NULL,NULL,NULL,NULL,NULL,NULL,7000.00000000),(8,10,'2016-07-30','2016-07-30 15:53:23','2016-07-30',NULL,'PJ1607-0003',1,'PROJALICE2','The Alice project number 3',12,0,1,6,100.00,NULL,NULL,NULL,NULL,NULL,NULL,3550.00000000),(9,4,'2016-07-31','2016-07-31 14:27:26','2016-07-31',NULL,'PJ1607-0004',1,'Project Top X','',12,0,1,2,27.00,NULL,NULL,NULL,NULL,NULL,NULL,4000.00000000); +/*!40000 ALTER TABLE `llx_projet` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_projet_extrafields` +-- + +DROP TABLE IF EXISTS `llx_projet_extrafields`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_projet_extrafields` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `fk_object` int(11) NOT NULL, + `import_key` varchar(14) DEFAULT NULL, + `priority` text, + PRIMARY KEY (`rowid`), + KEY `idx_projet_extrafields` (`fk_object`) +) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_projet_extrafields` +-- + +LOCK TABLES `llx_projet_extrafields` WRITE; +/*!40000 ALTER TABLE `llx_projet_extrafields` DISABLE KEYS */; +INSERT INTO `llx_projet_extrafields` VALUES (5,'2016-07-30 15:53:07',6,NULL,'3'),(6,'2016-07-30 15:53:14',7,NULL,'1'),(7,'2016-07-30 15:53:23',8,NULL,'5'),(9,'2016-07-31 14:27:24',9,NULL,'0'); +/*!40000 ALTER TABLE `llx_projet_extrafields` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_projet_task` +-- + +DROP TABLE IF EXISTS `llx_projet_task`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_projet_task` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `ref` varchar(50) DEFAULT NULL, + `entity` int(11) NOT NULL DEFAULT '1', + `fk_projet` int(11) NOT NULL, + `fk_task_parent` int(11) NOT NULL DEFAULT '0', + `datec` datetime DEFAULT NULL, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `dateo` datetime DEFAULT NULL, + `datee` datetime DEFAULT NULL, + `datev` datetime DEFAULT NULL, + `label` varchar(255) NOT NULL, + `description` text, + `duration_effective` double DEFAULT '0', + `planned_workload` double DEFAULT '0', + `progress` int(11) DEFAULT '0', + `priority` int(11) DEFAULT '0', + `fk_user_creat` int(11) DEFAULT NULL, + `fk_user_valid` int(11) DEFAULT NULL, + `fk_statut` smallint(6) NOT NULL DEFAULT '0', + `note_private` text, + `note_public` text, + `rang` int(11) DEFAULT '0', + `model_pdf` varchar(255) DEFAULT NULL, + PRIMARY KEY (`rowid`), + KEY `idx_projet_task_fk_projet` (`fk_projet`), + KEY `idx_projet_task_fk_user_creat` (`fk_user_creat`), + KEY `idx_projet_task_fk_user_valid` (`fk_user_valid`), + CONSTRAINT `fk_projet_task_fk_projet` FOREIGN KEY (`fk_projet`) REFERENCES `llx_projet` (`rowid`), + CONSTRAINT `fk_projet_task_fk_user_creat` FOREIGN KEY (`fk_user_creat`) REFERENCES `llx_user` (`rowid`), + CONSTRAINT `fk_projet_task_fk_user_valid` FOREIGN KEY (`fk_user_valid`) REFERENCES `llx_user` (`rowid`) +) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_projet_task` +-- + +LOCK TABLES `llx_projet_task` WRITE; +/*!40000 ALTER TABLE `llx_projet_task` DISABLE KEYS */; +INSERT INTO `llx_projet_task` VALUES (2,'2',1,5,0,'2010-07-11 16:23:53','2013-09-08 23:06:14','2010-07-11 12:00:00','2011-07-14 12:00:00',NULL,'Heberger site RMLL','',0,0,0,0,1,NULL,0,NULL,NULL,0,NULL),(3,'TK1007-0001',1,1,0,'2014-12-21 13:52:41','2016-07-30 11:35:40','2014-12-21 16:52:00',NULL,NULL,'Analyze','',9000,36000,0,0,1,NULL,0,NULL,'gdfgdfgdf',0,NULL),(4,'TK1007-0002',1,1,0,'2014-12-21 13:55:39','2016-07-30 11:35:51','2014-12-21 16:55:00',NULL,NULL,'Specification','',7200,18000,25,0,1,NULL,0,NULL,NULL,0,NULL),(5,'TK1007-0003',1,1,0,'2014-12-21 14:16:58','2016-07-30 11:35:59','2014-12-21 17:16:00',NULL,NULL,'Development','',0,0,0,0,1,NULL,0,NULL,NULL,0,NULL),(6,'TK1607-0004',1,6,0,'2016-07-30 15:33:27','2016-07-30 11:34:47','2016-07-30 02:00:00',NULL,NULL,'Project preparation phase A','',75600,720000,10,0,12,NULL,0,NULL,NULL,0,NULL),(7,'TK1607-0005',1,6,0,'2016-07-30 15:33:39','2016-07-30 11:34:47','2016-07-30 02:00:00',NULL,NULL,'Project preparation phase B','',39600,1080000,5,0,12,NULL,0,NULL,NULL,0,NULL),(8,'TK1607-0006',1,6,0,'2016-07-30 15:33:53','2016-07-30 11:33:53','2016-07-30 02:00:00',NULL,NULL,'Project execution phase A','',0,162000,0,0,12,NULL,0,NULL,NULL,0,NULL),(9,'TK1607-0007',1,6,0,'2016-07-30 15:34:09','2016-07-30 11:34:09','2016-10-27 02:00:00',NULL,NULL,'Project execution phase B','',0,2160000,0,0,12,NULL,0,NULL,NULL,0,NULL),(10,'TK1007-0008',1,1,0,'2016-07-30 15:36:31','2016-07-30 11:36:31','2016-07-30 02:00:00',NULL,NULL,'Tests','',0,316800,0,0,12,NULL,0,NULL,NULL,0,NULL); +/*!40000 ALTER TABLE `llx_projet_task` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_projet_task_extrafields` +-- + +DROP TABLE IF EXISTS `llx_projet_task_extrafields`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_projet_task_extrafields` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `fk_object` int(11) NOT NULL, + `import_key` varchar(14) DEFAULT NULL, + PRIMARY KEY (`rowid`), + KEY `idx_projet_task_extrafields` (`fk_object`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_projet_task_extrafields` +-- + +LOCK TABLES `llx_projet_task_extrafields` WRITE; +/*!40000 ALTER TABLE `llx_projet_task_extrafields` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_projet_task_extrafields` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_projet_task_time` +-- + +DROP TABLE IF EXISTS `llx_projet_task_time`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_projet_task_time` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `fk_task` int(11) NOT NULL, + `task_date` date DEFAULT NULL, + `task_datehour` datetime DEFAULT NULL, + `task_date_withhour` int(11) DEFAULT '0', + `task_duration` double DEFAULT NULL, + `fk_user` int(11) DEFAULT NULL, + `thm` double(24,8) DEFAULT NULL, + `note` text, + `invoice_id` int(11) DEFAULT NULL, + `invoice_line_id` int(11) DEFAULT NULL, + PRIMARY KEY (`rowid`), + KEY `idx_projet_task_time_task` (`fk_task`), + KEY `idx_projet_task_time_date` (`task_date`), + KEY `idx_projet_task_time_datehour` (`task_datehour`) +) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_projet_task_time` +-- + +LOCK TABLES `llx_projet_task_time` WRITE; +/*!40000 ALTER TABLE `llx_projet_task_time` DISABLE KEYS */; +INSERT INTO `llx_projet_task_time` VALUES (2,4,'2014-12-21','2014-12-21 12:00:00',0,3600,1,NULL,'',NULL,NULL),(3,4,'2014-12-18','2014-12-18 12:00:00',0,3600,1,NULL,NULL,NULL,NULL),(4,3,'2014-12-21','2014-12-21 12:00:00',0,3600,1,NULL,NULL,NULL,NULL),(5,3,'2014-12-21','2014-12-21 12:00:00',0,1800,1,NULL,NULL,NULL,NULL),(6,3,'2014-12-21','2014-12-21 12:00:00',0,3600,1,NULL,NULL,NULL,NULL),(7,6,'2016-07-25','2016-07-25 00:00:00',0,18000,12,NULL,NULL,NULL,NULL),(8,6,'2016-07-26','2016-07-25 00:00:00',0,14400,12,NULL,NULL,NULL,NULL),(9,6,'2016-07-27','2016-07-25 00:00:00',0,14400,12,NULL,NULL,NULL,NULL),(10,6,'2016-07-29','2016-07-25 00:00:00',0,14400,12,NULL,NULL,NULL,NULL),(11,6,'2016-07-31','2016-07-25 00:00:00',0,14400,12,NULL,NULL,NULL,NULL),(12,7,'2016-07-25','2016-07-25 00:00:00',0,10800,12,NULL,NULL,NULL,NULL),(13,7,'2016-07-26','2016-07-25 00:00:00',0,14400,12,NULL,NULL,NULL,NULL),(14,7,'2016-07-27','2016-07-25 00:00:00',0,14400,12,NULL,NULL,NULL,NULL); +/*!40000 ALTER TABLE `llx_projet_task_time` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_propal` +-- + +DROP TABLE IF EXISTS `llx_propal`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_propal` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `fk_soc` int(11) DEFAULT NULL, + `fk_projet` int(11) DEFAULT NULL, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `ref` varchar(30) NOT NULL, + `entity` int(11) NOT NULL DEFAULT '1', + `ref_ext` varchar(255) DEFAULT NULL, + `ref_int` varchar(255) DEFAULT NULL, + `ref_client` varchar(255) DEFAULT NULL, + `datec` datetime DEFAULT NULL, + `datep` date DEFAULT NULL, + `fin_validite` datetime DEFAULT NULL, + `date_valid` datetime DEFAULT NULL, + `date_cloture` datetime DEFAULT NULL, + `fk_user_author` int(11) DEFAULT NULL, + `fk_user_modif` int(11) DEFAULT NULL, + `fk_user_valid` int(11) DEFAULT NULL, + `fk_user_cloture` int(11) DEFAULT NULL, + `fk_statut` smallint(6) NOT NULL DEFAULT '0', + `price` double DEFAULT '0', + `remise_percent` double DEFAULT '0', + `remise_absolue` double DEFAULT '0', + `remise` double DEFAULT '0', + `total_ht` double(24,8) DEFAULT '0.00000000', + `tva` double(24,8) DEFAULT '0.00000000', + `localtax1` double(24,8) DEFAULT '0.00000000', + `localtax2` double(24,8) DEFAULT '0.00000000', + `total` double(24,8) DEFAULT '0.00000000', + `fk_account` int(11) DEFAULT NULL, + `fk_currency` varchar(3) DEFAULT NULL, + `fk_cond_reglement` int(11) DEFAULT NULL, + `fk_mode_reglement` int(11) DEFAULT NULL, + `note_private` text, + `note_public` text, + `model_pdf` varchar(255) DEFAULT NULL, + `date_livraison` date DEFAULT NULL, + `fk_shipping_method` int(11) DEFAULT NULL, + `fk_availability` int(11) DEFAULT NULL, + `fk_delivery_address` int(11) DEFAULT NULL, + `fk_input_reason` int(11) DEFAULT NULL, + `import_key` varchar(14) DEFAULT NULL, + `extraparams` varchar(255) DEFAULT NULL, + `fk_incoterms` int(11) DEFAULT NULL, + `location_incoterms` varchar(255) DEFAULT NULL, + `fk_multicurrency` int(11) DEFAULT NULL, + `multicurrency_code` varchar(255) DEFAULT NULL, + `multicurrency_tx` double(24,8) DEFAULT '1.00000000', + `multicurrency_total_ht` double(24,8) DEFAULT '0.00000000', + `multicurrency_total_tva` double(24,8) DEFAULT '0.00000000', + `multicurrency_total_ttc` double(24,8) DEFAULT '0.00000000', + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_propal_ref` (`ref`,`entity`), + KEY `idx_propal_fk_soc` (`fk_soc`), + KEY `idx_propal_fk_user_author` (`fk_user_author`), + KEY `idx_propal_fk_user_valid` (`fk_user_valid`), + KEY `idx_propal_fk_user_cloture` (`fk_user_cloture`), + KEY `idx_propal_fk_projet` (`fk_projet`), + KEY `idx_propal_fk_account` (`fk_account`), + KEY `idx_propal_fk_currency` (`fk_currency`), + CONSTRAINT `fk_propal_fk_projet` FOREIGN KEY (`fk_projet`) REFERENCES `llx_projet` (`rowid`), + CONSTRAINT `fk_propal_fk_soc` FOREIGN KEY (`fk_soc`) REFERENCES `llx_societe` (`rowid`), + CONSTRAINT `fk_propal_fk_user_author` FOREIGN KEY (`fk_user_author`) REFERENCES `llx_user` (`rowid`), + CONSTRAINT `fk_propal_fk_user_cloture` FOREIGN KEY (`fk_user_cloture`) REFERENCES `llx_user` (`rowid`), + CONSTRAINT `fk_propal_fk_user_valid` FOREIGN KEY (`fk_user_valid`) REFERENCES `llx_user` (`rowid`) +) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_propal` +-- + +LOCK TABLES `llx_propal` WRITE; +/*!40000 ALTER TABLE `llx_propal` DISABLE KEYS */; +INSERT INTO `llx_propal` VALUES (1,2,NULL,'2016-07-30 15:56:45','PR1007-0001',1,NULL,NULL,'','2010-07-09 01:33:49','2016-07-09','2016-07-24 12:00:00','2017-08-08 14:24:18',NULL,1,NULL,1,NULL,1,0,NULL,NULL,0,30.00000000,3.84000000,0.00000000,0.00000000,33.84000000,NULL,NULL,1,0,'','','azur',NULL,NULL,NULL,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,1.00000000,0.00000000,0.00000000,0.00000000),(2,1,NULL,'2016-07-30 15:56:54','PR1007-0002',1,NULL,NULL,'','2010-07-10 02:11:44','2016-07-10','2016-07-25 12:00:00','2016-07-10 02:12:55','2017-07-20 15:23:12',1,NULL,1,1,2,0,NULL,NULL,0,10.00000000,0.00000000,0.00000000,0.00000000,10.00000000,NULL,NULL,1,1,'','','azur',NULL,NULL,NULL,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,1.00000000,0.00000000,0.00000000,0.00000000),(3,4,NULL,'2016-07-30 15:56:54','PR1007-0003',1,NULL,NULL,'','2010-07-18 11:35:11','2016-07-18','2016-08-02 12:00:00','2016-07-18 11:36:18','2017-07-20 15:21:15',1,NULL,1,1,2,0,NULL,NULL,0,10.00000000,0.00000000,0.00000000,0.00000000,10.00000000,NULL,NULL,1,0,'','','azur',NULL,NULL,NULL,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,1.00000000,0.00000000,0.00000000,0.00000000),(5,19,NULL,'2016-07-30 15:56:54','PR1302-0005',1,NULL,NULL,'','2013-02-17 15:39:56','2016-02-17','2016-03-04 12:00:00','2018-11-15 23:27:10',NULL,1,NULL,12,NULL,1,0,NULL,NULL,0,10.00000000,2.00000000,0.00000000,0.00000000,12.00000000,NULL,NULL,1,0,'','','azur',NULL,NULL,0,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,1.00000000,0.00000000,0.00000000,0.00000000),(6,19,NULL,'2016-07-30 15:56:54','PR1302-0006',1,NULL,NULL,'','2013-02-17 15:40:12','2016-02-17','2016-03-04 12:00:00',NULL,NULL,1,NULL,NULL,NULL,0,0,NULL,NULL,0,0.00000000,0.00000000,0.00000000,0.00000000,0.00000000,NULL,NULL,1,0,'','','azur',NULL,NULL,0,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,1.00000000,0.00000000,0.00000000,0.00000000),(7,19,NULL,'2016-07-30 15:13:20','PR1302-0007',1,NULL,NULL,'','2013-02-17 15:41:15','2016-02-17','2016-03-04 12:00:00',NULL,NULL,1,NULL,NULL,NULL,0,0,NULL,NULL,0,0.00000000,0.00000000,0.00000000,0.00000000,0.00000000,NULL,NULL,1,0,'','','azur',NULL,NULL,0,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,1.00000000,0.00000000,0.00000000,0.00000000),(8,19,NULL,'2016-07-30 15:56:39','PR1302-0008',1,NULL,NULL,'','2013-02-17 15:43:39','2016-02-17','2016-03-04 12:00:00',NULL,NULL,1,NULL,NULL,NULL,0,0,NULL,NULL,0,0.00000000,0.00000000,0.00000000,0.00000000,0.00000000,NULL,NULL,1,0,'','','azur',NULL,NULL,0,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,1.00000000,0.00000000,0.00000000,0.00000000),(10,7,NULL,'2016-07-30 15:57:25','(PROV10)',1,NULL,NULL,'','2015-11-15 23:37:08','2015-11-15','2016-11-30 12:00:00',NULL,NULL,12,NULL,NULL,NULL,0,0,NULL,NULL,0,0.00000000,0.00000000,0.00000000,0.00000000,0.00000000,NULL,NULL,1,3,'','','azur',NULL,NULL,0,NULL,0,NULL,NULL,0,'',NULL,NULL,1.00000000,0.00000000,0.00000000,0.00000000); +/*!40000 ALTER TABLE `llx_propal` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_propal_extrafields` +-- + +DROP TABLE IF EXISTS `llx_propal_extrafields`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_propal_extrafields` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `fk_object` int(11) NOT NULL, + `import_key` varchar(14) DEFAULT NULL, + PRIMARY KEY (`rowid`), + KEY `idx_propal_extrafields` (`fk_object`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_propal_extrafields` +-- + +LOCK TABLES `llx_propal_extrafields` WRITE; +/*!40000 ALTER TABLE `llx_propal_extrafields` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_propal_extrafields` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_propal_merge_pdf_product` +-- + +DROP TABLE IF EXISTS `llx_propal_merge_pdf_product`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_propal_merge_pdf_product` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `fk_product` int(11) NOT NULL, + `file_name` varchar(200) NOT NULL, + `lang` varchar(5) DEFAULT NULL, + `fk_user_author` int(11) DEFAULT NULL, + `fk_user_mod` int(11) NOT NULL, + `datec` datetime NOT NULL, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `import_key` varchar(14) DEFAULT NULL, + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_propal_merge_pdf_product` +-- + +LOCK TABLES `llx_propal_merge_pdf_product` WRITE; +/*!40000 ALTER TABLE `llx_propal_merge_pdf_product` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_propal_merge_pdf_product` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_propaldet` +-- + +DROP TABLE IF EXISTS `llx_propaldet`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_propaldet` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `fk_propal` int(11) DEFAULT NULL, + `fk_parent_line` int(11) DEFAULT NULL, + `fk_product` int(11) DEFAULT NULL, + `label` varchar(255) DEFAULT NULL, + `description` text, + `fk_remise_except` int(11) DEFAULT NULL, + `tva_tx` double(6,3) DEFAULT '0.000', + `localtax1_tx` double(6,3) DEFAULT '0.000', + `localtax1_type` varchar(10) NOT NULL DEFAULT '0', + `localtax2_tx` double(6,3) DEFAULT '0.000', + `localtax2_type` varchar(10) NOT NULL DEFAULT '0', + `qty` double DEFAULT NULL, + `remise_percent` double DEFAULT '0', + `remise` double DEFAULT '0', + `price` double DEFAULT NULL, + `subprice` double(24,8) DEFAULT '0.00000000', + `total_ht` double(24,8) DEFAULT '0.00000000', + `total_tva` double(24,8) DEFAULT '0.00000000', + `total_localtax1` double(24,8) DEFAULT '0.00000000', + `total_localtax2` double(24,8) DEFAULT '0.00000000', + `total_ttc` double(24,8) DEFAULT '0.00000000', + `product_type` int(11) DEFAULT '0', + `date_start` datetime DEFAULT NULL, + `date_end` datetime DEFAULT NULL, + `info_bits` int(11) DEFAULT '0', + `fk_product_fournisseur_price` int(11) DEFAULT NULL, + `buy_price_ht` double(24,8) DEFAULT '0.00000000', + `special_code` int(10) unsigned DEFAULT '0', + `rang` int(11) DEFAULT '0', + `fk_unit` int(11) DEFAULT NULL, + `fk_multicurrency` int(11) DEFAULT NULL, + `multicurrency_code` varchar(255) DEFAULT NULL, + `multicurrency_subprice` double(24,8) DEFAULT '0.00000000', + `multicurrency_total_ht` double(24,8) DEFAULT '0.00000000', + `multicurrency_total_tva` double(24,8) DEFAULT '0.00000000', + `multicurrency_total_ttc` double(24,8) DEFAULT '0.00000000', + PRIMARY KEY (`rowid`), + KEY `idx_propaldet_fk_propal` (`fk_propal`), + KEY `idx_propaldet_fk_product` (`fk_product`), + KEY `fk_propaldet_fk_unit` (`fk_unit`), + CONSTRAINT `fk_propaldet_fk_propal` FOREIGN KEY (`fk_propal`) REFERENCES `llx_propal` (`rowid`), + CONSTRAINT `fk_propaldet_fk_unit` FOREIGN KEY (`fk_unit`) REFERENCES `llx_c_units` (`rowid`) +) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_propaldet` +-- + +LOCK TABLES `llx_propaldet` WRITE; +/*!40000 ALTER TABLE `llx_propaldet` DISABLE KEYS */; +INSERT INTO `llx_propaldet` VALUES (1,1,NULL,NULL,NULL,'Une machine à café',NULL,12.500,0.000,'',0.000,'',1,0,0,NULL,10.00000000,10.00000000,1.25000000,0.00000000,0.00000000,11.25000000,0,NULL,NULL,0,NULL,0.00000000,0,1,NULL,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000),(2,2,NULL,NULL,NULL,'Product 1',NULL,0.000,0.000,'',0.000,'',1,0,0,NULL,10.00000000,10.00000000,0.00000000,0.00000000,0.00000000,10.00000000,0,NULL,NULL,0,NULL,0.00000000,0,1,NULL,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000),(3,2,NULL,2,NULL,'',NULL,0.000,0.000,'',0.000,'',1,0,0,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000,0.00000000,0,NULL,NULL,0,NULL,0.00000000,0,2,NULL,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000),(4,3,NULL,NULL,NULL,'A new marvelous product',NULL,0.000,0.000,'',0.000,'',1,0,0,NULL,10.00000000,10.00000000,0.00000000,0.00000000,0.00000000,10.00000000,0,NULL,NULL,0,NULL,0.00000000,0,1,NULL,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000),(5,1,NULL,5,NULL,'cccc',NULL,19.600,0.000,'',0.000,'',1,0,0,NULL,10.00000000,10.00000000,1.96000000,0.00000000,0.00000000,11.96000000,0,NULL,NULL,0,NULL,0.00000000,0,2,NULL,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000),(11,1,NULL,4,NULL,'',NULL,0.000,0.000,'',0.000,'',1,0,0,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000,0.00000000,0,NULL,NULL,0,NULL,0.00000000,0,3,NULL,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000),(12,1,NULL,4,NULL,'',NULL,0.000,0.000,'',0.000,'',1,0,0,NULL,5.00000000,5.00000000,0.00000000,0.00000000,0.00000000,5.00000000,0,NULL,NULL,0,NULL,0.00000000,0,4,NULL,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000),(13,1,NULL,4,NULL,'',NULL,12.500,0.000,'',0.000,'',1,0,0,NULL,5.00000000,5.00000000,0.63000000,0.00000000,0.00000000,5.63000000,0,NULL,NULL,0,NULL,0.00000000,0,5,NULL,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000),(24,5,NULL,NULL,NULL,'On demand Apple pie',NULL,20.000,0.000,'0',0.000,'0',1,0,0,NULL,10.00000000,10.00000000,2.00000000,0.00000000,0.00000000,12.00000000,0,NULL,NULL,0,NULL,0.00000000,0,1,NULL,NULL,NULL,0.00000000,0.00000000,0.00000000,0.00000000); +/*!40000 ALTER TABLE `llx_propaldet` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_propaldet_extrafields` +-- + +DROP TABLE IF EXISTS `llx_propaldet_extrafields`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_propaldet_extrafields` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `fk_object` int(11) NOT NULL, + `import_key` varchar(14) DEFAULT NULL, + PRIMARY KEY (`rowid`), + KEY `idx_propaldet_extrafields` (`fk_object`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_propaldet_extrafields` +-- + +LOCK TABLES `llx_propaldet_extrafields` WRITE; +/*!40000 ALTER TABLE `llx_propaldet_extrafields` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_propaldet_extrafields` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_resource` +-- + +DROP TABLE IF EXISTS `llx_resource`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_resource` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `entity` int(11) NOT NULL DEFAULT '1', + `ref` varchar(255) DEFAULT NULL, + `asset_number` varchar(255) DEFAULT NULL, + `description` text, + `fk_code_type_resource` varchar(32) DEFAULT NULL, + `note_public` text, + `note_private` text, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `datec` datetime DEFAULT NULL, + `date_valid` datetime DEFAULT NULL, + `fk_user_author` int(11) DEFAULT NULL, + `fk_user_modif` int(11) DEFAULT NULL, + `fk_user_valid` int(11) DEFAULT NULL, + `fk_statut` smallint(6) NOT NULL DEFAULT '0', + `import_key` varchar(14) DEFAULT NULL, + `extraparams` varchar(255) DEFAULT NULL, + PRIMARY KEY (`rowid`), + KEY `fk_code_type_resource_idx` (`fk_code_type_resource`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_resource` +-- + +LOCK TABLES `llx_resource` WRITE; +/*!40000 ALTER TABLE `llx_resource` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_resource` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_rights_def` +-- + +DROP TABLE IF EXISTS `llx_rights_def`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_rights_def` ( + `id` int(11) NOT NULL DEFAULT '0', + `libelle` varchar(255) DEFAULT NULL, + `module` varchar(64) DEFAULT NULL, + `entity` int(11) NOT NULL DEFAULT '1', + `perms` varchar(50) DEFAULT NULL, + `subperms` varchar(50) DEFAULT NULL, + `type` varchar(1) DEFAULT NULL, + `bydefault` tinyint(4) DEFAULT '0', + PRIMARY KEY (`id`,`entity`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_rights_def` +-- + +LOCK TABLES `llx_rights_def` WRITE; +/*!40000 ALTER TABLE `llx_rights_def` DISABLE KEYS */; +INSERT INTO `llx_rights_def` VALUES (11,'Lire les factures','facture',1,'lire',NULL,'a',1),(11,'Lire les factures','facture',2,'lire',NULL,'a',1),(12,'Creer/modifier les factures','facture',1,'creer',NULL,'a',0),(12,'Creer/modifier les factures','facture',2,'creer',NULL,'a',0),(13,'Dévalider les factures','facture',1,'invoice_advance','unvalidate','a',0),(13,'Dévalider les factures','facture',2,'invoice_advance','unvalidate','a',0),(14,'Valider les factures','facture',1,'invoice_advance','validate','a',0),(14,'Valider les factures','facture',2,'valider',NULL,'a',0),(15,'Envoyer les factures par mail','facture',1,'invoice_advance','send','a',0),(15,'Envoyer les factures par mail','facture',2,'invoice_advance','send','a',0),(16,'Emettre des paiements sur les factures','facture',1,'paiement',NULL,'a',0),(16,'Emettre des paiements sur les factures','facture',2,'paiement',NULL,'a',0),(19,'Supprimer les factures','facture',1,'supprimer',NULL,'a',0),(19,'Supprimer les factures','facture',2,'supprimer',NULL,'a',0),(21,'Lire les propositions commerciales','propale',1,'lire',NULL,'r',1),(21,'Lire les propositions commerciales','propale',2,'lire',NULL,'r',1),(22,'Creer/modifier les propositions commerciales','propale',1,'creer',NULL,'w',0),(22,'Creer/modifier les propositions commerciales','propale',2,'creer',NULL,'w',0),(24,'Valider les propositions commerciales','propale',1,'propal_advance','validate','d',0),(24,'Valider les propositions commerciales','propale',2,'valider',NULL,'d',0),(25,'Envoyer les propositions commerciales aux clients','propale',1,'propal_advance','send','d',0),(25,'Envoyer les propositions commerciales aux clients','propale',2,'propal_advance','send','d',0),(26,'Cloturer les propositions commerciales','propale',1,'cloturer',NULL,'d',0),(26,'Cloturer les propositions commerciales','propale',2,'cloturer',NULL,'d',0),(27,'Supprimer les propositions commerciales','propale',1,'supprimer',NULL,'d',0),(27,'Supprimer les propositions commerciales','propale',2,'supprimer',NULL,'d',0),(28,'Exporter les propositions commerciales et attributs','propale',1,'export',NULL,'r',0),(28,'Exporter les propositions commerciales et attributs','propale',2,'export',NULL,'r',0),(31,'Lire les produits','produit',1,'lire',NULL,'r',1),(31,'Lire les produits','produit',2,'lire',NULL,'r',1),(32,'Creer/modifier les produits','produit',1,'creer',NULL,'w',0),(32,'Creer/modifier les produits','produit',2,'creer',NULL,'w',0),(34,'Supprimer les produits','produit',1,'supprimer',NULL,'d',0),(34,'Supprimer les produits','produit',2,'supprimer',NULL,'d',0),(38,'Exporter les produits','produit',1,'export',NULL,'r',0),(38,'Exporter les produits','produit',2,'export',NULL,'r',0),(41,'Read projects and tasks (shared projects or projects I am contact for). Can also enter time consumed on assigned tasks (timesheet)','projet',1,'lire',NULL,'r',1),(42,'Create/modify projects and tasks (shared projects or projects I am contact for)','projet',1,'creer',NULL,'w',0),(44,'Delete project and tasks (shared projects or projects I am contact for)','projet',1,'supprimer',NULL,'d',0),(45,'Export projects','projet',1,'export',NULL,'d',0),(61,'Lire les fiches d\'intervention','ficheinter',1,'lire',NULL,'r',1),(62,'Creer/modifier les fiches d\'intervention','ficheinter',1,'creer',NULL,'w',0),(64,'Supprimer les fiches d\'intervention','ficheinter',1,'supprimer',NULL,'d',0),(67,'Exporter les fiches interventions','ficheinter',1,'export',NULL,'r',0),(68,'Envoyer les fiches d\'intervention par courriel','ficheinter',1,'ficheinter_advance','send','r',0),(69,'Valider les fiches d\'intervention ','ficheinter',1,'ficheinter_advance','validate','a',0),(70,'Dévalider les fiches d\'intervention','ficheinter',1,'ficheinter_advance','unvalidate','a',0),(71,'Read members\' card','adherent',1,'lire',NULL,'r',1),(72,'Create/modify members (need also user module permissions if member linked to a user)','adherent',1,'creer',NULL,'w',0),(74,'Remove members','adherent',1,'supprimer',NULL,'d',0),(75,'Setup types of membership','adherent',1,'configurer',NULL,'w',0),(76,'Export members','adherent',1,'export',NULL,'r',0),(78,'Read subscriptions','adherent',1,'cotisation','lire','r',1),(79,'Create/modify/remove subscriptions','adherent',1,'cotisation','creer','w',0),(81,'Lire les commandes clients','commande',1,'lire',NULL,'r',1),(82,'Creer/modifier les commandes clients','commande',1,'creer',NULL,'w',0),(84,'Valider les commandes clients','commande',1,'order_advance','validate','d',0),(86,'Envoyer les commandes clients','commande',1,'order_advance','send','d',0),(87,'Cloturer les commandes clients','commande',1,'cloturer',NULL,'d',0),(88,'Annuler les commandes clients','commande',1,'order_advance','annuler','d',0),(89,'Supprimer les commandes clients','commande',1,'supprimer',NULL,'d',0),(91,'Lire les charges','tax',1,'charges','lire','r',1),(91,'Lire les charges','tax',2,'charges','lire','r',1),(92,'Creer/modifier les charges','tax',1,'charges','creer','w',0),(92,'Creer/modifier les charges','tax',2,'charges','creer','w',0),(93,'Supprimer les charges','tax',1,'charges','supprimer','d',0),(93,'Supprimer les charges','tax',2,'charges','supprimer','d',0),(94,'Exporter les charges','tax',1,'charges','export','r',0),(94,'Exporter les charges','tax',2,'charges','export','r',0),(95,'Lire CA, bilans, resultats','compta',1,'resultat','lire','r',1),(101,'Lire les expeditions','expedition',1,'lire',NULL,'r',1),(102,'Creer modifier les expeditions','expedition',1,'creer',NULL,'w',0),(104,'Valider les expeditions','expedition',1,'shipping_advance','validate','d',0),(105,'Envoyer les expeditions aux clients','expedition',1,'shipping_advance','send','d',0),(106,'Exporter les expeditions','expedition',1,'shipment','export','r',0),(109,'Supprimer les expeditions','expedition',1,'supprimer',NULL,'d',0),(111,'Lire les comptes bancaires','banque',1,'lire',NULL,'r',1),(111,'Lire les comptes bancaires','banque',2,'lire',NULL,'r',1),(112,'Creer/modifier montant/supprimer ecriture bancaire','banque',1,'modifier',NULL,'w',0),(112,'Creer/modifier montant/supprimer ecriture bancaire','banque',2,'modifier',NULL,'w',0),(113,'Configurer les comptes bancaires (creer, gerer categories)','banque',1,'configurer',NULL,'a',0),(113,'Configurer les comptes bancaires (creer, gerer categories)','banque',2,'configurer',NULL,'a',0),(114,'Rapprocher les ecritures bancaires','banque',1,'consolidate',NULL,'w',0),(114,'Rapprocher les ecritures bancaires','banque',2,'consolidate',NULL,'w',0),(115,'Exporter transactions et releves','banque',1,'export',NULL,'r',0),(115,'Exporter transactions et releves','banque',2,'export',NULL,'r',0),(116,'Virements entre comptes','banque',1,'transfer',NULL,'w',0),(116,'Virements entre comptes','banque',2,'transfer',NULL,'w',0),(117,'Gerer les envois de cheques','banque',1,'cheque',NULL,'w',0),(117,'Gerer les envois de cheques','banque',2,'cheque',NULL,'w',0),(121,'Lire les societes','societe',1,'lire',NULL,'r',1),(121,'Lire les societes','societe',2,'lire',NULL,'r',1),(122,'Creer modifier les societes','societe',1,'creer',NULL,'w',0),(122,'Creer modifier les societes','societe',2,'creer',NULL,'w',0),(125,'Supprimer les societes','societe',1,'supprimer',NULL,'d',0),(125,'Supprimer les societes','societe',2,'supprimer',NULL,'d',0),(126,'Exporter les societes','societe',1,'export',NULL,'r',0),(126,'Exporter les societes','societe',2,'export',NULL,'r',0),(141,'Read all projects and tasks (also private projects I am not contact for)','projet',1,'all','lire','r',0),(142,'Create/modify all projects and tasks (also private projects I am not contact for)','projet',1,'all','creer','w',0),(144,'Delete all projects and tasks (also private projects I am not contact for)','projet',1,'all','supprimer','d',0),(151,'Read withdrawals','prelevement',1,'bons','lire','r',1),(152,'Create/modify a withdrawals','prelevement',1,'bons','creer','w',0),(153,'Send withdrawals to bank','prelevement',1,'bons','send','a',0),(154,'credit/refuse withdrawals','prelevement',1,'bons','credit','a',0),(161,'Lire les contrats','contrat',1,'lire',NULL,'r',1),(162,'Creer / modifier les contrats','contrat',1,'creer',NULL,'w',0),(163,'Activer un service d\'un contrat','contrat',1,'activer',NULL,'w',0),(164,'Desactiver un service d\'un contrat','contrat',1,'desactiver',NULL,'w',0),(165,'Supprimer un contrat','contrat',1,'supprimer',NULL,'d',0),(167,'Export contracts','contrat',1,'export',NULL,'r',0),(221,'Consulter les mailings','mailing',1,'lire',NULL,'r',1),(221,'Consulter les mailings','mailing',2,'lire',NULL,'r',1),(222,'Creer/modifier les mailings (sujet, destinataires...)','mailing',1,'creer',NULL,'w',0),(222,'Creer/modifier les mailings (sujet, destinataires...)','mailing',2,'creer',NULL,'w',0),(223,'Valider les mailings (permet leur envoi)','mailing',1,'valider',NULL,'w',0),(223,'Valider les mailings (permet leur envoi)','mailing',2,'valider',NULL,'w',0),(229,'Supprimer les mailings','mailing',1,'supprimer',NULL,'d',0),(229,'Supprimer les mailings','mailing',2,'supprimer',NULL,'d',0),(237,'View recipients and info','mailing',1,'mailing_advance','recipient','r',0),(237,'View recipients and info','mailing',2,'mailing_advance','recipient','r',0),(238,'Manually send mailings','mailing',1,'mailing_advance','send','w',0),(238,'Manually send mailings','mailing',2,'mailing_advance','send','w',0),(239,'Delete mailings after validation and/or sent','mailing',1,'mailing_advance','delete','d',0),(239,'Delete mailings after validation and/or sent','mailing',2,'mailing_advance','delete','d',0),(241,'Lire les categories','categorie',1,'lire',NULL,'r',1),(242,'Creer/modifier les categories','categorie',1,'creer',NULL,'w',0),(243,'Supprimer les categories','categorie',1,'supprimer',NULL,'d',0),(251,'Consulter les autres utilisateurs','user',1,'user','lire','r',0),(252,'Consulter les permissions des autres utilisateurs','user',1,'user_advance','readperms','r',0),(253,'Creer/modifier utilisateurs internes et externes','user',1,'user','creer','w',0),(254,'Creer/modifier utilisateurs externes seulement','user',1,'user_advance','write','w',0),(255,'Modifier le mot de passe des autres utilisateurs','user',1,'user','password','w',0),(256,'Supprimer ou desactiver les autres utilisateurs','user',1,'user','supprimer','d',0),(262,'Consulter tous les tiers par utilisateurs internes (sinon uniquement si contact commercial). Non effectif pour utilisateurs externes (tjs limités à eux-meme).','societe',1,'client','voir','r',1),(262,'Consulter tous les tiers par utilisateurs internes (sinon uniquement si contact commercial). Non effectif pour utilisateurs externes (tjs limités à eux-meme).','societe',2,'client','voir','r',1),(281,'Lire les contacts','societe',1,'contact','lire','r',1),(281,'Lire les contacts','societe',2,'contact','lire','r',1),(282,'Creer modifier les contacts','societe',1,'contact','creer','w',0),(282,'Creer modifier les contacts','societe',2,'contact','creer','w',0),(283,'Supprimer les contacts','societe',1,'contact','supprimer','d',0),(283,'Supprimer les contacts','societe',2,'contact','supprimer','d',0),(286,'Exporter les contacts','societe',1,'contact','export','d',0),(286,'Exporter les contacts','societe',2,'contact','export','d',0),(300,'Read barcodes','barcode',1,'lire_advance',NULL,'r',1),(301,'Create/modify barcodes','barcode',1,'creer_advance',NULL,'w',0),(331,'Lire les bookmarks','bookmark',1,'lire',NULL,'r',1),(332,'Creer/modifier les bookmarks','bookmark',1,'creer',NULL,'r',1),(333,'Supprimer les bookmarks','bookmark',1,'supprimer',NULL,'r',1),(341,'Consulter ses propres permissions','user',1,'self_advance','readperms','r',1),(342,'Creer/modifier ses propres infos utilisateur','user',1,'self','creer','w',1),(343,'Modifier son propre mot de passe','user',1,'self','password','w',1),(344,'Modifier ses propres permissions','user',1,'self_advance','writeperms','w',1),(351,'Consulter les groupes','user',1,'group_advance','read','r',0),(352,'Consulter les permissions des groupes','user',1,'group_advance','readperms','r',0),(353,'Creer/modifier les groupes et leurs permissions','user',1,'group_advance','write','w',0),(354,'Supprimer ou desactiver les groupes','user',1,'group_advance','delete','d',0),(358,'Exporter les utilisateurs','user',1,'user','export','r',0),(510,'Read salaries','salaries',1,'read',NULL,'r',0),(512,'Create/modify salaries','salaries',1,'write',NULL,'w',0),(514,'Delete salaries','salaries',1,'delete',NULL,'d',0),(517,'Export salaries','salaries',1,'export',NULL,'r',0),(531,'Lire les services','service',1,'lire',NULL,'r',1),(532,'Creer/modifier les services','service',1,'creer',NULL,'w',0),(534,'Supprimer les services','service',1,'supprimer',NULL,'d',0),(538,'Exporter les services','service',1,'export',NULL,'r',0),(701,'Lire les dons','don',1,'lire',NULL,'r',1),(701,'Lire les dons','don',2,'lire',NULL,'r',1),(702,'Creer/modifier les dons','don',1,'creer',NULL,'w',0),(702,'Creer/modifier les dons','don',2,'creer',NULL,'w',0),(703,'Supprimer les dons','don',1,'supprimer',NULL,'d',0),(703,'Supprimer les dons','don',2,'supprimer',NULL,'d',0),(771,'Read expense reports (yours and your subordinates)','expensereport',1,'lire',NULL,'r',1),(772,'Create/modify expense reports','expensereport',1,'creer',NULL,'w',0),(773,'Delete expense reports','expensereport',1,'supprimer',NULL,'d',0),(774,'Read all expense reports','expensereport',1,'readall',NULL,'r',1),(775,'Approve expense reports','expensereport',1,'approve',NULL,'w',0),(776,'Pay expense reports','expensereport',1,'to_paid',NULL,'w',0),(779,'Export expense reports','expensereport',1,'export',NULL,'r',0),(1001,'Lire les stocks','stock',1,'lire',NULL,'r',1),(1002,'Creer/Modifier les stocks','stock',1,'creer',NULL,'w',0),(1003,'Supprimer les stocks','stock',1,'supprimer',NULL,'d',0),(1004,'Lire mouvements de stocks','stock',1,'mouvement','lire','r',1),(1005,'Creer/modifier mouvements de stocks','stock',1,'mouvement','creer','w',0),(1101,'Lire les bons de livraison','expedition',1,'livraison','lire','r',1),(1102,'Creer modifier les bons de livraison','expedition',1,'livraison','creer','w',0),(1104,'Valider les bons de livraison','expedition',1,'livraison_advance','validate','d',0),(1109,'Supprimer les bons de livraison','expedition',1,'livraison','supprimer','d',0),(1121,'Read supplier proposals','supplier_proposal',1,'lire',NULL,'w',1),(1122,'Create/modify supplier proposals','supplier_proposal',1,'creer',NULL,'w',1),(1123,'Validate supplier proposals','supplier_proposal',1,'validate_advance',NULL,'w',0),(1124,'Envoyer les demandes fournisseurs','supplier_proposal',1,'send_advance',NULL,'w',0),(1125,'Delete supplier proposals','supplier_proposal',1,'supprimer',NULL,'w',0),(1126,'Close supplier price requests','supplier_proposal',1,'cloturer',NULL,'w',0),(1181,'Consulter les fournisseurs','fournisseur',1,'lire',NULL,'r',1),(1182,'Consulter les commandes fournisseur','fournisseur',1,'commande','lire','r',1),(1183,'Creer une commande fournisseur','fournisseur',1,'commande','creer','w',0),(1184,'Valider une commande fournisseur','fournisseur',1,'supplier_order_advance','validate','w',0),(1185,'Approuver une commande fournisseur','fournisseur',1,'commande','approuver','w',0),(1186,'Commander une commande fournisseur','fournisseur',1,'commande','commander','w',0),(1187,'Receptionner une commande fournisseur','fournisseur',1,'commande','receptionner','d',0),(1188,'Supprimer une commande fournisseur','fournisseur',1,'commande','supprimer','d',0),(1189,'Check/Uncheck a supplier order reception','fournisseur',1,'commande_advance','check','w',0),(1201,'Lire les exports','export',1,'lire',NULL,'r',1),(1202,'Creer/modifier un export','export',1,'creer',NULL,'w',0),(1231,'Consulter les factures fournisseur','fournisseur',1,'facture','lire','r',1),(1232,'Creer une facture fournisseur','fournisseur',1,'facture','creer','w',0),(1233,'Valider une facture fournisseur','fournisseur',1,'supplier_invoice_advance','validate','w',0),(1234,'Supprimer une facture fournisseur','fournisseur',1,'facture','supprimer','d',0),(1235,'Envoyer les factures par mail','fournisseur',1,'supplier_invoice_advance','send','a',0),(1236,'Exporter les factures fournisseurs, attributs et reglements','fournisseur',1,'facture','export','r',0),(1237,'Exporter les commande fournisseurs, attributs','fournisseur',1,'commande','export','r',0),(1251,'Run mass imports of external data (data load)','import',1,'run',NULL,'r',0),(1321,'Exporter les factures clients, attributs et reglements','facture',1,'facture','export','r',0),(1321,'Exporter les factures clients, attributs et reglements','facture',2,'facture','export','r',0),(1421,'Exporter les commandes clients et attributs','commande',1,'commande','export','r',0),(2401,'Read actions/tasks linked to his account','agenda',1,'myactions','read','r',1),(2401,'Read actions/tasks linked to his account','agenda',2,'myactions','read','r',1),(2402,'Create/modify actions/tasks linked to his account','agenda',1,'myactions','create','w',0),(2402,'Create/modify actions/tasks linked to his account','agenda',2,'myactions','create','w',0),(2403,'Delete actions/tasks linked to his account','agenda',1,'myactions','delete','w',0),(2403,'Delete actions/tasks linked to his account','agenda',2,'myactions','delete','w',0),(2411,'Read actions/tasks of others','agenda',1,'allactions','read','r',0),(2411,'Read actions/tasks of others','agenda',2,'allactions','read','r',0),(2412,'Create/modify actions/tasks of others','agenda',1,'allactions','create','w',0),(2412,'Create/modify actions/tasks of others','agenda',2,'allactions','create','w',0),(2413,'Delete actions/tasks of others','agenda',1,'allactions','delete','w',0),(2413,'Delete actions/tasks of others','agenda',2,'allactions','delete','w',0),(2414,'Export actions/tasks of others','agenda',1,'export',NULL,'w',0),(2501,'Consulter/Télécharger les documents','ecm',1,'read',NULL,'r',1),(2503,'Soumettre ou supprimer des documents','ecm',1,'upload',NULL,'w',1),(2515,'Administrer les rubriques de documents','ecm',1,'setup',NULL,'w',1),(20001,'Read your own holidays','holiday',1,'read',NULL,'w',1),(20001,'Créer / Modifier / Lire ses demandes de congés payés','holiday',2,'write',NULL,'w',1),(20002,'Create/modify your own holidays','holiday',1,'write',NULL,'w',1),(20002,'Lire / Modifier toutes les demandes de congés payés','holiday',2,'lire_tous',NULL,'w',0),(20003,'Delete holidays','holiday',1,'delete',NULL,'w',0),(20003,'Supprimer des demandes de congés payés','holiday',2,'delete',NULL,'w',0),(20004,'Read holidays for everybody','holiday',1,'read_all',NULL,'w',0),(20004,'Définir les congés payés des utilisateurs','holiday',2,'define_holiday',NULL,'w',0),(20005,'Create/modify holidays for everybody','holiday',1,'write_all',NULL,'w',0),(20005,'Voir les logs de modification des congés payés','holiday',2,'view_log',NULL,'w',0),(20006,'Setup holidays of users (setup and update balance)','holiday',1,'define_holiday',NULL,'w',0),(20006,'Accéder au rapport mensuel des congés payés','holiday',2,'month_report',NULL,'w',0),(23001,'Read cron jobs','cron',1,'read',NULL,'w',1),(23002,'Create cron Jobs','cron',1,'create',NULL,'w',0),(23003,'Delete cron Jobs','cron',1,'delete',NULL,'w',0),(23004,'Execute cron Jobs','cron',1,'execute',NULL,'w',0),(50101,'Use point of sale','cashdesk',1,'use',NULL,'a',1),(55001,'Read surveys','opensurvey',1,'read',NULL,'r',0),(55002,'Create/modify surveys','opensurvey',1,'write',NULL,'w',0),(59001,'Visualiser les marges','margins',1,'liretous',NULL,'r',1),(59002,'Définir les marges','margins',1,'creer',NULL,'w',0),(59003,'Read every user margin','margins',1,'read','all','r',0),(63001,'Read resources','resource',1,'read',NULL,'w',0),(63002,'Create/Modify resources','resource',1,'write',NULL,'w',0),(63003,'Delete resources','resource',1,'delete',NULL,'w',0),(63004,'Link resources','resource',1,'link',NULL,'w',0),(101250,'Read surveys','opensurvey',2,'survey','read','r',0),(101251,'Create/modify surveys','opensurvey',2,'survey','write','w',0),(400051,'Use POS','pos',2,'frontend',NULL,'a',1),(400052,'Use Backend','pos',2,'backend',NULL,'a',1),(400053,'Make Transfers','pos',2,'transfer',NULL,'a',1),(400055,'Stats','pos',2,'stats',NULL,'a',1); +/*!40000 ALTER TABLE `llx_rights_def` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_societe` +-- + +DROP TABLE IF EXISTS `llx_societe`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_societe` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `statut` tinyint(4) DEFAULT '0', + `parent` int(11) DEFAULT NULL, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `datec` datetime DEFAULT NULL, + `nom` varchar(128) DEFAULT NULL, + `entity` int(11) NOT NULL DEFAULT '1', + `ref_ext` varchar(128) DEFAULT NULL, + `ref_int` varchar(60) DEFAULT NULL, + `code_client` varchar(24) DEFAULT NULL, + `code_fournisseur` varchar(24) DEFAULT NULL, + `code_compta` varchar(24) DEFAULT NULL, + `code_compta_fournisseur` varchar(24) DEFAULT NULL, + `address` varchar(255) DEFAULT NULL, + `zip` varchar(25) DEFAULT NULL, + `town` varchar(50) DEFAULT NULL, + `fk_departement` int(11) DEFAULT '0', + `fk_pays` int(11) DEFAULT '0', + `phone` varchar(20) DEFAULT NULL, + `fax` varchar(20) DEFAULT NULL, + `url` varchar(255) DEFAULT NULL, + `email` varchar(128) DEFAULT NULL, + `skype` varchar(255) DEFAULT NULL, + `fk_effectif` int(11) DEFAULT '0', + `fk_typent` int(11) DEFAULT '0', + `fk_forme_juridique` int(11) DEFAULT '0', + `fk_currency` varchar(3) DEFAULT NULL, + `siren` varchar(128) DEFAULT NULL, + `siret` varchar(128) DEFAULT NULL, + `ape` varchar(128) DEFAULT NULL, + `idprof4` varchar(128) DEFAULT NULL, + `tva_intra` varchar(20) DEFAULT NULL, + `capital` double DEFAULT NULL, + `fk_stcomm` int(11) NOT NULL, + `note_private` text, + `note_public` text, + `prefix_comm` varchar(5) DEFAULT NULL, + `client` tinyint(4) DEFAULT '0', + `fournisseur` tinyint(4) DEFAULT '0', + `supplier_account` varchar(32) DEFAULT NULL, + `fk_prospectlevel` varchar(12) DEFAULT NULL, + `customer_bad` tinyint(4) DEFAULT '0', + `customer_rate` double DEFAULT '0', + `supplier_rate` double DEFAULT '0', + `fk_user_creat` int(11) DEFAULT NULL, + `fk_user_modif` int(11) DEFAULT NULL, + `remise_client` double DEFAULT '0', + `mode_reglement` tinyint(4) DEFAULT NULL, + `cond_reglement` tinyint(4) DEFAULT NULL, + `mode_reglement_supplier` int(11) DEFAULT NULL, + `outstanding_limit` double(24,8) DEFAULT NULL, + `cond_reglement_supplier` int(11) DEFAULT NULL, + `fk_shipping_method` int(11) DEFAULT NULL, + `tva_assuj` tinyint(4) DEFAULT '1', + `localtax1_assuj` tinyint(4) DEFAULT '0', + `localtax1_value` double(6,3) DEFAULT NULL, + `localtax2_assuj` tinyint(4) DEFAULT '0', + `localtax2_value` double(6,3) DEFAULT NULL, + `barcode` varchar(255) DEFAULT NULL, + `price_level` int(11) DEFAULT NULL, + `default_lang` varchar(6) DEFAULT NULL, + `canvas` varchar(32) DEFAULT NULL, + `import_key` varchar(14) DEFAULT NULL, + `status` tinyint(4) DEFAULT '1', + `logo` varchar(255) DEFAULT NULL, + `idprof5` varchar(128) DEFAULT NULL, + `idprof6` varchar(128) DEFAULT NULL, + `fk_barcode_type` int(11) DEFAULT '0', + `webservices_url` varchar(255) DEFAULT NULL, + `webservices_key` varchar(128) DEFAULT NULL, + `name_alias` varchar(128) DEFAULT NULL, + `fk_incoterms` int(11) DEFAULT NULL, + `location_incoterms` varchar(255) DEFAULT NULL, + `model_pdf` varchar(255) DEFAULT NULL, + `fk_multicurrency` int(11) DEFAULT NULL, + `multicurrency_code` varchar(255) DEFAULT NULL, + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_societe_prefix_comm` (`prefix_comm`,`entity`), + UNIQUE KEY `uk_societe_code_client` (`code_client`,`entity`), + UNIQUE KEY `uk_societe_barcode` (`barcode`,`fk_barcode_type`,`entity`), + UNIQUE KEY `uk_societe_code_fournisseur` (`code_fournisseur`,`entity`), + KEY `idx_societe_user_creat` (`fk_user_creat`), + KEY `idx_societe_user_modif` (`fk_user_modif`), + KEY `idx_societe_barcode` (`barcode`) +) ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_societe` +-- + +LOCK TABLES `llx_societe` WRITE; +/*!40000 ALTER TABLE `llx_societe` DISABLE KEYS */; +INSERT INTO `llx_societe` VALUES (1,0,NULL,'2016-01-16 15:21:09','2010-07-08 14:21:44','Indian SAS',1,NULL,NULL,'CU1212-0007','SU1212-0005','7050','6050','1 alalah road',NULL,'Delhi',0,117,NULL,NULL,NULL,NULL,NULL,NULL,4,NULL,'0','','','','','',5000,1,NULL,NULL,NULL,1,1,NULL,NULL,0,0,0,1,12,0,NULL,NULL,NULL,NULL,NULL,NULL,1,NULL,0.000,NULL,0.000,NULL,NULL,'en_IN',NULL,NULL,1,'indiancompany.png','','',0,NULL,NULL,'',0,NULL,NULL,NULL,NULL),(2,0,NULL,'2016-07-30 11:45:49','2010-07-08 14:23:48','Teclib',1,NULL,NULL,'CU1108-0001','SU1108-0001','411CU11080001','401SU11080001','',NULL,'Paris',0,1,NULL,NULL,'www.teclib.com',NULL,NULL,4,3,57,'0','123456789','','ACE14','','',400000,0,NULL,NULL,NULL,3,1,NULL,'',0,0,0,1,12,0,NULL,NULL,NULL,NULL,NULL,NULL,1,0,0.000,NULL,0.000,NULL,NULL,'fr_FR',NULL,NULL,1,'teclibcompany.png','','',0,NULL,NULL,'',0,NULL,NULL,0,''),(3,0,NULL,'2016-01-16 15:28:17','2010-07-08 22:42:12','Spanish Comp',1,NULL,NULL,'SPANISHCOMP','SU1601-0009',NULL,NULL,'1 via mallere',NULL,'Madrid',123,4,NULL,NULL,NULL,NULL,NULL,3,4,408,'0','','','','','',10000,0,NULL,NULL,NULL,3,1,NULL,NULL,0,0,0,1,12,0,NULL,NULL,NULL,NULL,NULL,NULL,1,NULL,0.000,NULL,0.000,NULL,NULL,'es_AR',NULL,NULL,1,'spanishcompany.png','','',0,NULL,NULL,'',0,NULL,NULL,NULL,NULL),(4,0,NULL,'2016-01-22 17:24:53','2010-07-08 22:48:18','Prospector Vaalen',1,NULL,NULL,'CU1303-0014',NULL,NULL,NULL,'',NULL,'Bruxelles',103,2,NULL,NULL,NULL,NULL,NULL,3,4,201,'0','12345678','','','','',0,0,NULL,NULL,NULL,3,0,NULL,'PL_LOW',0,0,0,1,12,0,NULL,NULL,NULL,NULL,NULL,NULL,1,NULL,0.000,NULL,0.000,NULL,NULL,NULL,NULL,NULL,1,'valeencompany.png','','',0,NULL,NULL,'',0,NULL,NULL,NULL,NULL),(5,0,NULL,'2016-01-16 15:31:29','2010-07-08 23:22:57','NoCountry',1,NULL,NULL,NULL,NULL,NULL,NULL,'',NULL,NULL,0,0,NULL,NULL,NULL,NULL,NULL,NULL,0,NULL,'0','','','','','',0,0,NULL,NULL,NULL,0,0,NULL,NULL,0,0,0,1,12,0,NULL,NULL,NULL,NULL,NULL,NULL,1,NULL,0.000,NULL,0.000,NULL,NULL,NULL,NULL,NULL,1,'nocountrycomp.png','','',0,NULL,NULL,'',0,NULL,NULL,NULL,NULL),(6,0,NULL,'2016-01-16 15:35:56','2010-07-09 00:15:09','Swiss Touch',1,NULL,NULL,'CU1601-0018','SU1601-0010',NULL,NULL,'',NULL,'Genevia',0,6,NULL,NULL,NULL,'swisstouch@example.ch',NULL,2,2,601,'0','','','','','',56000,0,NULL,NULL,NULL,3,1,NULL,NULL,0,0,0,1,12,0,NULL,NULL,NULL,NULL,NULL,NULL,1,NULL,0.000,NULL,0.000,NULL,NULL,NULL,NULL,NULL,1,'swisstouch.png','','',0,NULL,NULL,'',0,NULL,NULL,NULL,NULL),(7,0,NULL,'2016-01-16 15:38:32','2010-07-09 01:24:26','Generic customer',1,NULL,NULL,'CU1302-0011',NULL,NULL,NULL,'',NULL,NULL,0,7,NULL,NULL,NULL,'ttt@ttt.com',NULL,NULL,8,NULL,'0','','','','','',0,0,'Generic customer to use for Point Of Sale module.
',NULL,NULL,1,0,NULL,NULL,0,0,0,1,12,0,NULL,NULL,NULL,NULL,NULL,NULL,1,NULL,0.000,NULL,0.000,NULL,NULL,NULL,NULL,NULL,1,'genericcustomer.png','','',0,NULL,NULL,'',0,NULL,NULL,NULL,NULL),(10,0,NULL,'2016-01-16 15:44:20','2010-07-10 15:13:08','NLTechno',1,NULL,NULL,'CU1212-0005','SU1601-0011',NULL,NULL,'',NULL,NULL,0,1,NULL,NULL,NULL,'notanemail@nltechno.com',NULL,1,4,54,'0','493861496','49386149600039','6209Z','22-01-2007','FR123456789',10000,0,NULL,NULL,NULL,1,1,NULL,NULL,0,0,0,1,12,0,NULL,NULL,NULL,NULL,NULL,NULL,1,NULL,0.000,NULL,0.000,'123456789012',NULL,'fr_FR',NULL,NULL,1,'logo_nltechno_94x100.png','','',0,NULL,NULL,'The OpenSource company',0,NULL,NULL,NULL,NULL),(11,0,NULL,'2016-01-22 17:11:20','2010-07-10 18:35:57','Company Corp 1',1,NULL,NULL,'CU1510-0017',NULL,'7051',NULL,'',NULL,NULL,0,1,NULL,NULL,NULL,NULL,NULL,NULL,0,NULL,'0','','','','','',0,0,NULL,NULL,NULL,3,0,NULL,'PL_LOW',0,0,0,1,12,0,NULL,NULL,NULL,NULL,NULL,NULL,1,NULL,0.000,NULL,0.000,NULL,NULL,NULL,NULL,NULL,1,'comapnycorp1company.png','','',0,NULL,NULL,'',0,NULL,NULL,NULL,NULL),(12,0,NULL,'2016-01-22 16:41:56','2010-07-11 16:18:08','Dupont Alain',1,NULL,NULL,'CU1601-0019',NULL,NULL,NULL,'',NULL,NULL,0,1,NULL,NULL,NULL,'dalain@example.com',NULL,NULL,0,NULL,'0','','','','','',0,0,NULL,NULL,NULL,1,0,NULL,NULL,0,0,0,1,12,0,NULL,NULL,NULL,NULL,NULL,NULL,1,NULL,0.000,NULL,0.000,NULL,NULL,NULL,NULL,NULL,1,'pierrecurie.jpg','','',0,NULL,NULL,'',0,NULL,NULL,NULL,NULL),(13,0,NULL,'2016-01-22 17:13:16','2010-07-11 17:13:20','Company Corp 2',1,NULL,NULL,NULL,'SU1510-0008',NULL,NULL,'',NULL,NULL,0,1,NULL,NULL,NULL,NULL,NULL,NULL,0,NULL,'0','','','','','',0,0,NULL,NULL,NULL,0,1,NULL,NULL,0,0,0,1,12,0,NULL,NULL,NULL,NULL,NULL,NULL,1,NULL,0.000,NULL,0.000,NULL,NULL,NULL,NULL,NULL,1,'companycorp2company.png','','',0,NULL,NULL,'',0,NULL,NULL,NULL,NULL),(17,0,NULL,'2016-01-22 17:13:46','2011-08-01 02:41:26','Book Keeping Company',1,NULL,NULL,'CU1108-0004','SU1108-0004',NULL,NULL,'The French Company',NULL,NULL,0,1,NULL,NULL,NULL,NULL,NULL,1,3,NULL,'0','','','','','',0,0,NULL,NULL,NULL,3,1,NULL,NULL,0,0,0,1,12,0,NULL,NULL,NULL,NULL,NULL,NULL,1,NULL,0.000,NULL,0.000,NULL,NULL,NULL,NULL,NULL,1,'bookkeepercompany.png','','',0,NULL,NULL,'',0,NULL,NULL,NULL,NULL),(19,0,NULL,'2016-01-22 17:18:08','2013-01-12 12:23:05','Magic Food Store',1,NULL,NULL,'CU1301-0008',NULL,NULL,NULL,'65 holdywood boulevard','123456','BigTown',0,4,NULL,'0101',NULL,'myemail@domain.com',NULL,NULL,0,NULL,'0','','','10/10/2010','','',0,0,NULL,NULL,NULL,1,0,NULL,NULL,0,0,0,1,12,0,NULL,NULL,NULL,NULL,NULL,NULL,0,NULL,0.000,NULL,0.000,NULL,NULL,'en_US','patient@cabinetmed',NULL,1,'magicfoodstore.png','','',0,NULL,NULL,'',0,NULL,NULL,NULL,NULL),(25,0,NULL,'2016-01-22 17:21:17','2013-03-10 15:47:37','Print Company',1,NULL,NULL,'CU1303-0016','SU1303-0007',NULL,NULL,'21 Gutenberg street','45600','Berlin',0,5,NULL,NULL,NULL,'printcompany@example.com',NULL,NULL,0,NULL,'0','','','','','',0,0,NULL,NULL,NULL,0,1,NULL,NULL,0,0,0,1,12,0,NULL,NULL,NULL,NULL,NULL,NULL,1,NULL,0.000,NULL,0.000,NULL,NULL,'de_DE',NULL,NULL,1,'printcompany.png','','',0,NULL,NULL,'',0,NULL,NULL,NULL,NULL); +/*!40000 ALTER TABLE `llx_societe` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_societe_address` +-- + +DROP TABLE IF EXISTS `llx_societe_address`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_societe_address` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `datec` datetime DEFAULT NULL, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `label` varchar(30) DEFAULT NULL, + `fk_soc` int(11) DEFAULT '0', + `name` varchar(60) DEFAULT NULL, + `address` varchar(255) DEFAULT NULL, + `zip` varchar(10) DEFAULT NULL, + `town` varchar(50) DEFAULT NULL, + `fk_pays` int(11) DEFAULT '0', + `phone` varchar(20) DEFAULT NULL, + `fax` varchar(20) DEFAULT NULL, + `note` text, + `fk_user_creat` int(11) DEFAULT NULL, + `fk_user_modif` int(11) DEFAULT NULL, + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_societe_address` +-- + +LOCK TABLES `llx_societe_address` WRITE; +/*!40000 ALTER TABLE `llx_societe_address` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_societe_address` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_societe_commerciaux` +-- + +DROP TABLE IF EXISTS `llx_societe_commerciaux`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_societe_commerciaux` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `fk_soc` int(11) DEFAULT NULL, + `fk_user` int(11) DEFAULT NULL, + `import_key` varchar(14) DEFAULT NULL, + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_societe_commerciaux` (`fk_soc`,`fk_user`) +) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_societe_commerciaux` +-- + +LOCK TABLES `llx_societe_commerciaux` WRITE; +/*!40000 ALTER TABLE `llx_societe_commerciaux` DISABLE KEYS */; +INSERT INTO `llx_societe_commerciaux` VALUES (1,2,2,NULL),(2,3,2,NULL),(5,17,1,NULL),(6,19,1,NULL),(8,19,3,NULL),(9,11,16,NULL),(10,13,17,NULL); +/*!40000 ALTER TABLE `llx_societe_commerciaux` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_societe_extrafields` +-- + +DROP TABLE IF EXISTS `llx_societe_extrafields`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_societe_extrafields` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `fk_object` int(11) NOT NULL, + `import_key` varchar(14) DEFAULT NULL, + `anotheraddedfield` varchar(15) DEFAULT NULL, + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_societe_extrafields` (`fk_object`) +) ENGINE=InnoDB AUTO_INCREMENT=93 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_societe_extrafields` +-- + +LOCK TABLES `llx_societe_extrafields` WRITE; +/*!40000 ALTER TABLE `llx_societe_extrafields` DISABLE KEYS */; +INSERT INTO `llx_societe_extrafields` VALUES (75,'2016-01-22 16:40:03',10,NULL,NULL),(77,'2016-01-22 16:41:56',12,NULL,NULL),(78,'2016-01-22 17:11:20',11,NULL,NULL),(79,'2016-01-22 17:13:16',13,NULL,NULL),(80,'2016-01-22 17:13:46',17,NULL,NULL),(81,'2016-01-22 17:18:08',19,NULL,NULL),(82,'2016-01-22 17:21:17',25,NULL,NULL),(83,'2016-01-22 17:21:51',1,NULL,NULL),(85,'2016-01-22 17:22:32',3,NULL,NULL),(86,'2016-01-22 17:24:53',4,NULL,NULL),(87,'2016-01-22 17:25:11',5,NULL,NULL),(88,'2016-01-22 17:25:26',6,NULL,NULL),(89,'2016-01-22 17:25:41',7,NULL,NULL),(92,'2016-07-30 11:45:49',2,NULL,NULL); +/*!40000 ALTER TABLE `llx_societe_extrafields` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_societe_log` +-- + +DROP TABLE IF EXISTS `llx_societe_log`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_societe_log` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `datel` datetime DEFAULT NULL, + `fk_soc` int(11) DEFAULT NULL, + `fk_statut` int(11) DEFAULT NULL, + `fk_user` int(11) DEFAULT NULL, + `author` varchar(30) DEFAULT NULL, + `label` varchar(128) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_societe_log` +-- + +LOCK TABLES `llx_societe_log` WRITE; +/*!40000 ALTER TABLE `llx_societe_log` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_societe_log` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_societe_prices` +-- + +DROP TABLE IF EXISTS `llx_societe_prices`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_societe_prices` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `fk_soc` int(11) DEFAULT '0', + `tms` timestamp NULL DEFAULT NULL, + `datec` datetime DEFAULT NULL, + `fk_user_author` int(11) DEFAULT NULL, + `price_level` tinyint(4) DEFAULT '1', + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_societe_prices` +-- + +LOCK TABLES `llx_societe_prices` WRITE; +/*!40000 ALTER TABLE `llx_societe_prices` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_societe_prices` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_societe_remise` +-- + +DROP TABLE IF EXISTS `llx_societe_remise`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_societe_remise` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `fk_soc` int(11) NOT NULL, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `datec` datetime DEFAULT NULL, + `fk_user_author` int(11) DEFAULT NULL, + `remise_client` double(6,3) NOT NULL DEFAULT '0.000', + `note` text, + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_societe_remise` +-- + +LOCK TABLES `llx_societe_remise` WRITE; +/*!40000 ALTER TABLE `llx_societe_remise` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_societe_remise` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_societe_remise_except` +-- + +DROP TABLE IF EXISTS `llx_societe_remise_except`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_societe_remise_except` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `fk_soc` int(11) NOT NULL, + `datec` datetime DEFAULT NULL, + `amount_ht` double(24,8) NOT NULL, + `amount_tva` double(24,8) NOT NULL DEFAULT '0.00000000', + `amount_ttc` double(24,8) NOT NULL DEFAULT '0.00000000', + `tva_tx` double(6,3) NOT NULL DEFAULT '0.000', + `fk_user` int(11) NOT NULL, + `fk_facture_line` int(11) DEFAULT NULL, + `fk_facture` int(11) DEFAULT NULL, + `fk_facture_source` int(11) DEFAULT NULL, + `description` text NOT NULL, + `multicurrency_amount_ht` double(24,8) NOT NULL DEFAULT '0.00000000', + `multicurrency_amount_tva` double(24,8) NOT NULL DEFAULT '0.00000000', + `multicurrency_amount_ttc` double(24,8) NOT NULL DEFAULT '0.00000000', + PRIMARY KEY (`rowid`), + KEY `idx_societe_remise_except_fk_user` (`fk_user`), + KEY `idx_societe_remise_except_fk_soc` (`fk_soc`), + KEY `idx_societe_remise_except_fk_facture_line` (`fk_facture_line`), + KEY `idx_societe_remise_except_fk_facture` (`fk_facture`), + KEY `idx_societe_remise_except_fk_facture_source` (`fk_facture_source`), + CONSTRAINT `fk_societe_remise_fk_facture` FOREIGN KEY (`fk_facture`) REFERENCES `llx_facture` (`rowid`), + CONSTRAINT `fk_societe_remise_fk_facture_line` FOREIGN KEY (`fk_facture_line`) REFERENCES `llx_facturedet` (`rowid`), + CONSTRAINT `fk_societe_remise_fk_facture_source` FOREIGN KEY (`fk_facture_source`) REFERENCES `llx_facture` (`rowid`), + CONSTRAINT `fk_societe_remise_fk_soc` FOREIGN KEY (`fk_soc`) REFERENCES `llx_societe` (`rowid`), + CONSTRAINT `fk_societe_remise_fk_user` FOREIGN KEY (`fk_user`) REFERENCES `llx_user` (`rowid`), + CONSTRAINT `fk_soc_remise_fk_facture_line` FOREIGN KEY (`fk_facture_line`) REFERENCES `llx_facturedet` (`rowid`), + CONSTRAINT `fk_soc_remise_fk_soc` FOREIGN KEY (`fk_soc`) REFERENCES `llx_societe` (`rowid`) +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_societe_remise_except` +-- + +LOCK TABLES `llx_societe_remise_except` WRITE; +/*!40000 ALTER TABLE `llx_societe_remise_except` DISABLE KEYS */; +INSERT INTO `llx_societe_remise_except` VALUES (2,19,'2013-03-19 09:36:15',10.00000000,1.25000000,11.25000000,12.500,1,NULL,NULL,NULL,'hfghgf',0.00000000,0.00000000,0.00000000); +/*!40000 ALTER TABLE `llx_societe_remise_except` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_societe_rib` +-- + +DROP TABLE IF EXISTS `llx_societe_rib`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_societe_rib` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `fk_soc` int(11) NOT NULL, + `datec` datetime DEFAULT NULL, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `label` varchar(30) DEFAULT NULL, + `bank` varchar(255) DEFAULT NULL, + `code_banque` varchar(128) DEFAULT NULL, + `code_guichet` varchar(6) DEFAULT NULL, + `number` varchar(255) DEFAULT NULL, + `cle_rib` varchar(5) DEFAULT NULL, + `bic` varchar(20) DEFAULT NULL, + `iban_prefix` varchar(34) DEFAULT NULL, + `domiciliation` varchar(255) DEFAULT NULL, + `proprio` varchar(60) DEFAULT NULL, + `owner_address` text, + `default_rib` tinyint(4) NOT NULL DEFAULT '0', + `rum` varchar(32) DEFAULT NULL, + `date_rum` date DEFAULT NULL, + `frstrecur` varchar(16) DEFAULT 'FRST', + `import_key` varchar(14) DEFAULT NULL, + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_societe_rib` +-- + +LOCK TABLES `llx_societe_rib` WRITE; +/*!40000 ALTER TABLE `llx_societe_rib` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_societe_rib` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_socpeople` +-- + +DROP TABLE IF EXISTS `llx_socpeople`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_socpeople` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `datec` datetime DEFAULT NULL, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `fk_soc` int(11) DEFAULT NULL, + `entity` int(11) NOT NULL DEFAULT '1', + `ref_ext` varchar(128) DEFAULT NULL, + `civility` varchar(6) DEFAULT NULL, + `lastname` varchar(50) DEFAULT NULL, + `firstname` varchar(50) DEFAULT NULL, + `address` varchar(255) DEFAULT NULL, + `zip` varchar(10) DEFAULT NULL, + `town` text, + `fk_departement` int(11) DEFAULT NULL, + `fk_pays` int(11) DEFAULT '0', + `birthday` date DEFAULT NULL, + `poste` varchar(80) DEFAULT NULL, + `phone` varchar(30) DEFAULT NULL, + `phone_perso` varchar(30) DEFAULT NULL, + `phone_mobile` varchar(30) DEFAULT NULL, + `fax` varchar(30) DEFAULT NULL, + `email` varchar(255) DEFAULT NULL, + `jabberid` varchar(255) DEFAULT NULL, + `skype` varchar(255) DEFAULT NULL, + `photo` varchar(255) DEFAULT NULL, + `priv` smallint(6) NOT NULL DEFAULT '0', + `no_email` smallint(6) NOT NULL DEFAULT '0', + `fk_user_creat` int(11) DEFAULT '0', + `fk_user_modif` int(11) DEFAULT NULL, + `note_private` text, + `note_public` text, + `default_lang` varchar(6) DEFAULT NULL, + `canvas` varchar(32) DEFAULT NULL, + `import_key` varchar(14) DEFAULT NULL, + `statut` tinyint(4) NOT NULL DEFAULT '1', + PRIMARY KEY (`rowid`), + KEY `idx_socpeople_fk_soc` (`fk_soc`), + KEY `idx_socpeople_fk_user_creat` (`fk_user_creat`), + CONSTRAINT `fk_socpeople_fk_soc` FOREIGN KEY (`fk_soc`) REFERENCES `llx_societe` (`rowid`), + CONSTRAINT `fk_socpeople_user_creat_user_rowid` FOREIGN KEY (`fk_user_creat`) REFERENCES `llx_user` (`rowid`) +) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_socpeople` +-- + +LOCK TABLES `llx_socpeople` WRITE; +/*!40000 ALTER TABLE `llx_socpeople` DISABLE KEYS */; +INSERT INTO `llx_socpeople` VALUES (1,'2010-07-08 14:26:14','2016-01-16 15:07:51',1,1,NULL,'MR','Indra','Mahala','','','',297,117,'2010-07-08','Project leader','','','','','','','',NULL,0,0,1,12,'Met during a congress at Dubai','',NULL,NULL,NULL,1),(2,'2010-07-08 22:44:50','2010-07-08 20:59:57',NULL,1,NULL,'MR','Freeman','Public','','','',200,11,NULL,'','','','','','','',NULL,NULL,0,0,1,1,'A friend that is a free contact not linked to any company',NULL,NULL,NULL,NULL,1),(3,'2010-07-08 22:59:02','2016-01-22 17:30:07',NULL,1,NULL,'MR','Mywife','Nicy','','','',NULL,11,'1980-10-03','','','','','','','','',NULL,1,0,1,12,'This is a private contact','',NULL,NULL,NULL,1),(4,'2010-07-09 00:16:58','2010-07-08 22:16:58',6,1,NULL,'MR','Rotchield','Evan','','','',NULL,6,NULL,'Bank director','','','','','','',NULL,NULL,0,0,1,1,'The bank director',NULL,NULL,NULL,NULL,1),(6,'2011-08-01 02:41:26','2016-01-22 17:29:53',17,1,NULL,'','Bookkeeper','Bob','99 account street','123456','BigTown',NULL,4,NULL,'book keeper','','','','','','','',NULL,0,0,1,12,'','',NULL,NULL,NULL,1),(7,'2016-07-30 16:11:06','2016-07-30 12:16:07',NULL,1,'','MR','Dad','','','','',NULL,14,'1967-09-04','','','','','','','','','',1,0,12,12,'','',NULL,NULL,NULL,1),(8,'2016-07-30 16:13:03','2016-07-30 12:15:58',NULL,1,'','MLE','Mom','','','','',NULL,14,NULL,'','','','','','','','','',1,0,12,12,'','',NULL,NULL,NULL,1),(9,'2016-07-30 16:14:41','2016-07-30 12:15:51',NULL,1,'','MR','Francky','','','89455','Virigia',NULL,205,'1980-07-09','Baker','555-98989898','','','','francky@example.com','','','',0,0,12,12,'','',NULL,NULL,NULL,1),(10,'2016-07-30 16:26:22','2016-07-30 12:52:38',10,1,'','MR','Eldy','','','33600','Pessac',NULL,1,'1972-10-10','Dolibarr project leader','','','','','eldy@example.com','','','ldestailleur_200x200.jpg',0,0,NULL,12,'','',NULL,NULL,NULL,1); +/*!40000 ALTER TABLE `llx_socpeople` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_socpeople_extrafields` +-- + +DROP TABLE IF EXISTS `llx_socpeople_extrafields`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_socpeople_extrafields` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `fk_object` int(11) NOT NULL, + `import_key` varchar(14) DEFAULT NULL, + PRIMARY KEY (`rowid`), + KEY `idx_socpeople_extrafields` (`fk_object`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_socpeople_extrafields` +-- + +LOCK TABLES `llx_socpeople_extrafields` WRITE; +/*!40000 ALTER TABLE `llx_socpeople_extrafields` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_socpeople_extrafields` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_stock_mouvement` +-- + +DROP TABLE IF EXISTS `llx_stock_mouvement`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_stock_mouvement` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `datem` datetime DEFAULT NULL, + `fk_product` int(11) NOT NULL, + `fk_entrepot` int(11) NOT NULL, + `value` double DEFAULT NULL, + `price` double(24,8) DEFAULT '0.00000000', + `type_mouvement` smallint(6) DEFAULT NULL, + `fk_user_author` int(11) DEFAULT NULL, + `label` varchar(255) DEFAULT NULL, + `fk_origin` int(11) DEFAULT NULL, + `origintype` varchar(32) DEFAULT NULL, + `inventorycode` varchar(128) DEFAULT NULL, + `batch` varchar(30) DEFAULT NULL, + `eatby` date DEFAULT NULL, + `sellby` date DEFAULT NULL, + PRIMARY KEY (`rowid`), + KEY `idx_stock_mouvement_fk_product` (`fk_product`), + KEY `idx_stock_mouvement_fk_entrepot` (`fk_entrepot`) +) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_stock_mouvement` +-- + +LOCK TABLES `llx_stock_mouvement` WRITE; +/*!40000 ALTER TABLE `llx_stock_mouvement` DISABLE KEYS */; +INSERT INTO `llx_stock_mouvement` VALUES (1,'2010-07-08 22:43:51','2010-07-09 00:43:51',2,2,1000,0.00000000,0,1,'Correct stock',NULL,NULL,NULL,NULL,NULL,NULL),(3,'2010-07-10 22:56:18','2010-07-11 00:56:18',4,2,500,0.00000000,0,1,'Init',NULL,NULL,NULL,NULL,NULL,NULL),(4,'2010-07-10 23:02:20','2010-07-11 01:02:20',4,2,500,0.00000000,0,1,'',NULL,NULL,NULL,NULL,NULL,NULL),(5,'2010-07-11 16:49:44','2010-07-11 18:49:44',4,1,2,10.00000000,3,1,'',NULL,NULL,NULL,NULL,NULL,NULL),(6,'2010-07-11 16:49:44','2010-07-11 18:49:44',1,1,4,0.00000000,3,1,'',NULL,NULL,NULL,NULL,NULL,NULL),(7,'2013-01-19 17:22:48','2013-01-19 18:22:48',11,1,-1,0.00000000,2,1,'Facture créée dans DoliPOS',NULL,NULL,NULL,NULL,NULL,NULL),(8,'2013-01-19 17:22:48','2013-01-19 18:22:48',4,1,-1,5.00000000,2,1,'Facture créée dans DoliPOS',NULL,NULL,NULL,NULL,NULL,NULL),(9,'2013-01-19 17:22:48','2013-01-19 18:22:48',1,1,-2,0.00000000,2,1,'Facture créée dans DoliPOS',NULL,NULL,NULL,NULL,NULL,NULL),(10,'2013-01-19 17:31:10','2013-01-19 18:31:10',2,1,-1,0.00000000,2,1,'Facture créée dans DoliPOS',NULL,NULL,NULL,NULL,NULL,NULL),(11,'2013-01-19 17:31:58','2013-01-19 18:31:58',2,1,-1,0.00000000,2,1,'Facture créée dans DoliPOS',NULL,NULL,NULL,NULL,NULL,NULL),(12,'2016-07-30 13:39:31','2016-07-30 17:39:31',10,2,50,0.00000000,0,12,'Stock correction for product COMP-XP4523',0,'',NULL,'5599887766452',NULL,NULL),(13,'2016-07-30 13:40:12','2016-07-30 17:40:12',10,2,60,0.00000000,0,12,'Stock correction for product COMP-XP4523',0,'',NULL,'4494487766452',NULL,NULL),(14,'2016-07-30 13:40:39','2016-07-30 17:40:39',10,2,-35,0.00000000,1,12,'Stock transfer of product COMP-XP4523 into another warehouse',0,'','160730174015','5599887766452',NULL,NULL),(15,'2016-07-30 13:40:39','2016-07-30 17:40:39',10,1,35,0.00000000,0,12,'Stock transfer of product COMP-XP4523 into another warehouse',0,'','160730174015','5599887766452',NULL,NULL); +/*!40000 ALTER TABLE `llx_stock_mouvement` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_supplier_proposal` +-- + +DROP TABLE IF EXISTS `llx_supplier_proposal`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_supplier_proposal` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `ref` varchar(30) NOT NULL, + `entity` int(11) NOT NULL DEFAULT '1', + `ref_ext` varchar(255) DEFAULT NULL, + `ref_int` varchar(255) DEFAULT NULL, + `fk_soc` int(11) DEFAULT NULL, + `fk_projet` int(11) DEFAULT NULL, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `datec` datetime DEFAULT NULL, + `date_valid` datetime DEFAULT NULL, + `date_cloture` datetime DEFAULT NULL, + `fk_user_author` int(11) DEFAULT NULL, + `fk_user_modif` int(11) DEFAULT NULL, + `fk_user_valid` int(11) DEFAULT NULL, + `fk_user_cloture` int(11) DEFAULT NULL, + `fk_statut` smallint(6) NOT NULL DEFAULT '0', + `price` double DEFAULT '0', + `remise_percent` double DEFAULT '0', + `remise_absolue` double DEFAULT '0', + `remise` double DEFAULT '0', + `total_ht` double(24,8) DEFAULT '0.00000000', + `tva` double(24,8) DEFAULT '0.00000000', + `localtax1` double(24,8) DEFAULT '0.00000000', + `localtax2` double(24,8) DEFAULT '0.00000000', + `total` double(24,8) DEFAULT '0.00000000', + `fk_account` int(11) DEFAULT NULL, + `fk_currency` varchar(3) DEFAULT NULL, + `fk_cond_reglement` int(11) DEFAULT NULL, + `fk_mode_reglement` int(11) DEFAULT NULL, + `note_private` text, + `note_public` text, + `model_pdf` varchar(255) DEFAULT NULL, + `date_livraison` date DEFAULT NULL, + `fk_shipping_method` int(11) DEFAULT NULL, + `import_key` varchar(14) DEFAULT NULL, + `extraparams` varchar(255) DEFAULT NULL, + `fk_multicurrency` int(11) DEFAULT NULL, + `multicurrency_code` varchar(255) DEFAULT NULL, + `multicurrency_tx` double(24,8) DEFAULT '1.00000000', + `multicurrency_total_ht` double(24,8) DEFAULT '0.00000000', + `multicurrency_total_tva` double(24,8) DEFAULT '0.00000000', + `multicurrency_total_ttc` double(24,8) DEFAULT '0.00000000', + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_supplier_proposal` +-- + +LOCK TABLES `llx_supplier_proposal` WRITE; +/*!40000 ALTER TABLE `llx_supplier_proposal` DISABLE KEYS */; +INSERT INTO `llx_supplier_proposal` VALUES (1,'RQ1607-0001',1,NULL,NULL,3,NULL,'2016-07-30 14:35:13','2016-07-30 18:34:33','2016-07-30 18:35:13',NULL,12,NULL,12,NULL,1,0,NULL,NULL,0,0.00000000,0.00000000,0.00000000,0.00000000,0.00000000,NULL,NULL,0,0,'','','aurore',NULL,NULL,NULL,NULL,0,'EUR',1.00000000,0.00000000,0.00000000,0.00000000); +/*!40000 ALTER TABLE `llx_supplier_proposal` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_supplier_proposal_extrafields` +-- + +DROP TABLE IF EXISTS `llx_supplier_proposal_extrafields`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_supplier_proposal_extrafields` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `fk_object` int(11) NOT NULL, + `import_key` varchar(14) DEFAULT NULL, + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_supplier_proposal_extrafields` +-- + +LOCK TABLES `llx_supplier_proposal_extrafields` WRITE; +/*!40000 ALTER TABLE `llx_supplier_proposal_extrafields` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_supplier_proposal_extrafields` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_supplier_proposaldet` +-- + +DROP TABLE IF EXISTS `llx_supplier_proposaldet`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_supplier_proposaldet` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `fk_supplier_proposal` int(11) NOT NULL, + `fk_parent_line` int(11) DEFAULT NULL, + `fk_product` int(11) DEFAULT NULL, + `label` varchar(255) DEFAULT NULL, + `description` text, + `fk_remise_except` int(11) DEFAULT NULL, + `tva_tx` double(6,3) DEFAULT '0.000', + `localtax1_tx` double(6,3) DEFAULT '0.000', + `localtax1_type` varchar(10) DEFAULT NULL, + `localtax2_tx` double(6,3) DEFAULT '0.000', + `localtax2_type` varchar(10) DEFAULT NULL, + `qty` double DEFAULT NULL, + `remise_percent` double DEFAULT '0', + `remise` double DEFAULT '0', + `price` double DEFAULT NULL, + `subprice` double(24,8) DEFAULT '0.00000000', + `total_ht` double(24,8) DEFAULT '0.00000000', + `total_tva` double(24,8) DEFAULT '0.00000000', + `total_localtax1` double(24,8) DEFAULT '0.00000000', + `total_localtax2` double(24,8) DEFAULT '0.00000000', + `total_ttc` double(24,8) DEFAULT '0.00000000', + `product_type` int(11) DEFAULT '0', + `info_bits` int(11) DEFAULT '0', + `buy_price_ht` double(24,8) DEFAULT '0.00000000', + `fk_product_fournisseur_price` int(11) DEFAULT NULL, + `special_code` int(11) DEFAULT '0', + `rang` int(11) DEFAULT '0', + `ref_fourn` varchar(30) DEFAULT NULL, + `fk_multicurrency` int(11) DEFAULT NULL, + `multicurrency_code` varchar(255) DEFAULT NULL, + `multicurrency_subprice` double(24,8) DEFAULT '0.00000000', + `multicurrency_total_ht` double(24,8) DEFAULT '0.00000000', + `multicurrency_total_tva` double(24,8) DEFAULT '0.00000000', + `multicurrency_total_ttc` double(24,8) DEFAULT '0.00000000', + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_supplier_proposaldet` +-- + +LOCK TABLES `llx_supplier_proposaldet` WRITE; +/*!40000 ALTER TABLE `llx_supplier_proposaldet` DISABLE KEYS */; +INSERT INTO `llx_supplier_proposaldet` VALUES (1,1,NULL,10,NULL,'A powerfull computer XP4523 
\r\n(Customs code: USXP765 - Origin country: United States)',NULL,0.000,0.000,'0',0.000,'0',10,0,0,0,0.00000000,0.00000000,0.00000000,0.00000000,0.00000000,0.00000000,0,0,0.00000000,NULL,0,1,NULL,NULL,'EUR',0.00000000,0.00000000,0.00000000,0.00000000); +/*!40000 ALTER TABLE `llx_supplier_proposaldet` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_supplier_proposaldet_extrafields` +-- + +DROP TABLE IF EXISTS `llx_supplier_proposaldet_extrafields`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_supplier_proposaldet_extrafields` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `fk_object` int(11) NOT NULL, + `import_key` varchar(14) DEFAULT NULL, + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_supplier_proposaldet_extrafields` +-- + +LOCK TABLES `llx_supplier_proposaldet_extrafields` WRITE; +/*!40000 ALTER TABLE `llx_supplier_proposaldet_extrafields` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_supplier_proposaldet_extrafields` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_tva` +-- + +DROP TABLE IF EXISTS `llx_tva`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_tva` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `datep` date DEFAULT NULL, + `datev` date DEFAULT NULL, + `amount` double NOT NULL DEFAULT '0', + `label` varchar(255) DEFAULT NULL, + `entity` int(11) NOT NULL DEFAULT '1', + `note` text, + `fk_bank` int(11) DEFAULT NULL, + `fk_user_creat` int(11) DEFAULT NULL, + `fk_user_modif` int(11) DEFAULT NULL, + `fk_typepayment` int(11) DEFAULT NULL, + `num_payment` varchar(50) DEFAULT NULL, + `import_key` varchar(14) DEFAULT NULL, + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_tva` +-- + +LOCK TABLES `llx_tva` WRITE; +/*!40000 ALTER TABLE `llx_tva` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_tva` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_user` +-- + +DROP TABLE IF EXISTS `llx_user`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_user` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `datec` datetime DEFAULT NULL, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `fk_user_creat` int(11) DEFAULT NULL, + `fk_user_modif` int(11) DEFAULT NULL, + `login` varchar(24) NOT NULL, + `entity` int(11) NOT NULL DEFAULT '1', + `civility` varchar(6) DEFAULT NULL, + `ref_ext` varchar(50) DEFAULT NULL, + `ref_int` varchar(50) DEFAULT NULL, + `employee` smallint(6) DEFAULT '1', + `fk_establishment` int(11) DEFAULT '0', + `pass` varchar(128) DEFAULT NULL, + `pass_crypted` varchar(128) DEFAULT NULL, + `pass_temp` varchar(128) DEFAULT NULL, + `api_key` varchar(128) DEFAULT NULL, + `lastname` varchar(50) DEFAULT NULL, + `firstname` varchar(50) DEFAULT NULL, + `job` varchar(128) DEFAULT NULL, + `skype` varchar(255) DEFAULT NULL, + `office_phone` varchar(20) DEFAULT NULL, + `office_fax` varchar(20) DEFAULT NULL, + `user_mobile` varchar(20) DEFAULT NULL, + `email` varchar(255) DEFAULT NULL, + `signature` text, + `admin` smallint(6) DEFAULT '0', + `webcal_login` varchar(25) DEFAULT NULL, + `phenix_login` varchar(25) DEFAULT NULL, + `phenix_pass` varchar(128) DEFAULT NULL, + `module_comm` smallint(6) DEFAULT '1', + `module_compta` smallint(6) DEFAULT '1', + `fk_soc` int(11) DEFAULT NULL, + `fk_socpeople` int(11) DEFAULT NULL, + `fk_member` int(11) DEFAULT NULL, + `note` text, + `datelastlogin` datetime DEFAULT NULL, + `datepreviouslogin` datetime DEFAULT NULL, + `egroupware_id` int(11) DEFAULT NULL, + `ldap_sid` varchar(255) DEFAULT NULL, + `statut` tinyint(4) DEFAULT '1', + `photo` varchar(255) DEFAULT NULL, + `lang` varchar(6) DEFAULT NULL, + `openid` varchar(255) DEFAULT NULL, + `fk_user` int(11) DEFAULT NULL, + `thm` double(24,8) DEFAULT NULL, + `address` varchar(255) DEFAULT NULL, + `zip` varchar(25) DEFAULT NULL, + `town` varchar(50) DEFAULT NULL, + `fk_state` int(11) DEFAULT '0', + `fk_country` int(11) DEFAULT '0', + `color` varchar(6) DEFAULT NULL, + `accountancy_code` varchar(32) DEFAULT NULL, + `barcode` varchar(255) DEFAULT NULL, + `fk_barcode_type` int(11) DEFAULT '0', + `nb_holiday` int(11) DEFAULT '0', + `salary` double(24,8) DEFAULT NULL, + `tjm` double(24,8) DEFAULT NULL, + `salaryextra` double(24,8) DEFAULT NULL, + `weeklyhours` double(16,8) DEFAULT NULL, + `gender` varchar(10) DEFAULT NULL, + `note_public` text, + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_user_login` (`login`,`entity`), + UNIQUE KEY `uk_user_fk_socpeople` (`fk_socpeople`), + UNIQUE KEY `uk_user_fk_member` (`fk_member`), + UNIQUE KEY `uk_user_api_key` (`api_key`), + KEY `idx_user_api_key` (`api_key`), + KEY `idx_user_fk_societe` (`fk_soc`) +) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_user` +-- + +LOCK TABLES `llx_user` WRITE; +/*!40000 ALTER TABLE `llx_user` DISABLE KEYS */; +INSERT INTO `llx_user` VALUES (1,'2010-07-08 13:20:11','2015-10-05 20:07:36',NULL,NULL,'aeinstein',0,NULL,NULL,NULL,1,0,'aeinstein','11c9c772d6471aa24c27274bdd8a223b',NULL,NULL,'Einstein','Albert','','','123456789','','','aeinstein@example.com','',0,'','','',1,1,NULL,NULL,NULL,'','2015-10-05 08:32:44','2015-10-03 11:43:50',NULL,'',1,'alberteinstein.jpg',NULL,NULL,14,NULL,'','','',NULL,NULL,'aaaaff','',NULL,0,0,NULL,NULL,NULL,NULL,'man',NULL),(2,'2010-07-08 13:54:48','2015-10-05 19:47:22',NULL,NULL,'demo',1,NULL,NULL,NULL,1,0,'demo','fe01ce2a7fbac8fafaed7c982a04e229',NULL,NULL,'Doe','David','','','09123123','','','daviddoe@mycompany.com','',0,'','','',1,1,NULL,NULL,NULL,'','2016-07-30 23:10:54','2016-07-30 23:04:17',NULL,'',1,'johndoe.png',NULL,NULL,11,NULL,'','','',NULL,NULL,'','',NULL,0,0,NULL,NULL,NULL,NULL,'man',NULL),(3,'2010-07-11 16:18:59','2015-10-05 19:57:57',NULL,NULL,'pcurie',1,NULL,NULL,NULL,1,0,'pcuriedolibarr','ab335b4eb4c3c99334f656e5db9584c9',NULL,NULL,'Curie','Pierre','','','','','','pcurie@example.com','',0,'','','',1,1,NULL,NULL,2,'','2012-12-21 17:38:55',NULL,NULL,'',1,'pierrecurie.jpg',NULL,NULL,14,NULL,'','','',NULL,NULL,'','',NULL,0,0,NULL,NULL,NULL,NULL,NULL,NULL),(4,'2013-01-23 17:52:27','2015-10-05 20:08:34',NULL,NULL,'bbookkeeper',1,NULL,NULL,NULL,1,0,'bbookkeeper','a7d30b58d647fcf59b7163f9592b1dbb',NULL,NULL,'Bookkeeper','Bob','Bookkeeper','','','','','','',0,'','','',1,1,17,6,NULL,'','2013-02-25 10:18:41','2013-01-23 17:53:20',NULL,'',1,NULL,NULL,NULL,11,NULL,'','','',NULL,NULL,'','',NULL,0,0,NULL,NULL,NULL,NULL,'man',NULL),(10,'2015-10-03 11:47:41','2015-10-05 20:07:18',NULL,NULL,'mcurie',1,NULL,NULL,NULL,1,0,'mcurie','11c9c772d6471aa24c27274bdd8a223b',NULL,'t3mnkbhs','Curie','Marie','','','','','','','',0,NULL,NULL,NULL,1,1,NULL,NULL,NULL,'',NULL,NULL,NULL,'',1,'mariecurie.jpg',NULL,NULL,14,NULL,'','','',NULL,NULL,'ffaaff','',NULL,0,0,NULL,NULL,NULL,NULL,'woman',NULL),(11,'2015-10-05 09:07:52','2015-10-05 19:57:02',NULL,NULL,'zzeceo',1,NULL,NULL,NULL,1,0,'zzeceo','92af989c4c3a5140fb5d73eb77a52454',NULL,'cq78nf9m','Zeceo','Zack','President','','','','','','',0,NULL,NULL,NULL,1,1,NULL,NULL,NULL,'','2015-10-05 22:48:08','2015-10-05 21:18:46',NULL,'',1,NULL,NULL,NULL,NULL,NULL,'','','',NULL,NULL,'','',NULL,0,0,NULL,NULL,NULL,NULL,NULL,NULL),(12,'2015-10-05 09:09:46','2016-01-22 13:13:42',NULL,NULL,'admin',0,NULL,NULL,NULL,1,0,'admin','21232f297a57a5a743894a0e4a801fc3',NULL,'nd6hgbcr','Adminson','Alice','Admin Technical','','','','','','',1,NULL,NULL,NULL,1,1,NULL,NULL,NULL,'','2016-08-01 01:14:13','2016-07-31 20:04:34',NULL,'',1,'mariecurie.jpg',NULL,NULL,11,NULL,'','','',NULL,NULL,'','',NULL,0,0,NULL,NULL,NULL,NULL,'woman',NULL),(13,'2015-10-05 21:29:35','2016-01-22 13:51:46',NULL,NULL,'ccommercy',1,NULL,NULL,NULL,1,0,'ccomercy','11c9c772d6471aa24c27274bdd8a223b',NULL,'y451ksdv','Commercy','Charle','Commercial leader','','','','','','',0,NULL,NULL,NULL,1,1,NULL,NULL,NULL,'',NULL,NULL,NULL,'',1,NULL,NULL,NULL,11,NULL,'','','',NULL,NULL,'','',NULL,0,0,NULL,NULL,NULL,NULL,'man',NULL),(14,'2015-10-05 21:33:33','2015-10-05 19:52:05',NULL,NULL,'sscientol',1,NULL,NULL,NULL,1,0,'sscientol','39bee07ac42f31c98e79cdcd5e5fe4c5',NULL,'s2hp8bxd','Scientol','Sam','Scientist leader','','','','','','',0,NULL,NULL,NULL,1,1,NULL,NULL,NULL,'',NULL,NULL,NULL,'',1,NULL,NULL,NULL,11,NULL,'','','',NULL,NULL,'','',NULL,0,0,NULL,NULL,NULL,NULL,NULL,NULL),(16,'2015-10-05 22:47:52','2015-11-15 22:25:17',NULL,NULL,'cc1',1,NULL,NULL,NULL,1,0,'cc1','d68005ccf362b82d084551b6291792a3',NULL,'cx9y1dk0','Charle1','Commerson','Sale representative','','','','','','',0,NULL,NULL,NULL,1,1,NULL,NULL,NULL,'','2015-10-05 23:46:24','2015-10-05 23:37:31',NULL,'',1,NULL,NULL,NULL,13,NULL,'','','',NULL,NULL,'','',NULL,0,0,NULL,NULL,NULL,NULL,NULL,NULL),(17,'2015-10-05 22:48:39','2016-01-22 16:30:01',NULL,NULL,'cc2',1,NULL,NULL,NULL,1,0,'cc2','a964065211872fb76f876c6c3e952ea3',NULL,'gw8cb7xj','Charle2','Commerson','Sale representative','','','','','','',0,NULL,NULL,NULL,1,1,NULL,NULL,NULL,'','2015-10-05 23:16:06',NULL,NULL,'',0,NULL,NULL,NULL,13,NULL,'','','',NULL,NULL,'','',NULL,0,0,NULL,NULL,NULL,NULL,'man',NULL),(18,'2016-01-22 17:27:02','2016-07-30 12:51:23',NULL,NULL,'ldestailleur',1,NULL,NULL,NULL,1,0,'laurentd2013','1bb7805145a7a5066df9e6d585b8b645',NULL,'87g06wbx','Destailleur','Laurent','Project leader of Dolibarr ERP CRM','','','','','ldestailleur@example.com','
Laurent DESTAILLEUR
\r\n\r\n
\r\n
Project Director
\r\nldestailleur@example.com
\r\n\r\n
 
\r\n\r\n\r\n
',0,NULL,NULL,NULL,1,1,10,10,NULL,'More information on http://www.destailleur.fr','2016-07-30 22:26:58',NULL,NULL,'',1,'ldestailleur_200x200.jpg',NULL,NULL,NULL,NULL,'','','',NULL,NULL,'007f7f','',NULL,0,0,NULL,NULL,NULL,NULL,'man',NULL); +/*!40000 ALTER TABLE `llx_user` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_user_alert` +-- + +DROP TABLE IF EXISTS `llx_user_alert`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_user_alert` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `type` int(11) DEFAULT NULL, + `fk_contact` int(11) DEFAULT NULL, + `fk_user` int(11) DEFAULT NULL, + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_user_alert` +-- + +LOCK TABLES `llx_user_alert` WRITE; +/*!40000 ALTER TABLE `llx_user_alert` DISABLE KEYS */; +INSERT INTO `llx_user_alert` VALUES (1,1,1,1),(2,1,10,12); +/*!40000 ALTER TABLE `llx_user_alert` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_user_clicktodial` +-- + +DROP TABLE IF EXISTS `llx_user_clicktodial`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_user_clicktodial` ( + `fk_user` int(11) NOT NULL, + `url` varchar(255) DEFAULT NULL, + `login` varchar(32) DEFAULT NULL, + `pass` varchar(64) DEFAULT NULL, + `poste` varchar(20) DEFAULT NULL, + PRIMARY KEY (`fk_user`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_user_clicktodial` +-- + +LOCK TABLES `llx_user_clicktodial` WRITE; +/*!40000 ALTER TABLE `llx_user_clicktodial` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_user_clicktodial` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_user_extrafields` +-- + +DROP TABLE IF EXISTS `llx_user_extrafields`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_user_extrafields` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `fk_object` int(11) NOT NULL, + `import_key` varchar(14) DEFAULT NULL, + PRIMARY KEY (`rowid`), + KEY `idx_user_extrafields` (`fk_object`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_user_extrafields` +-- + +LOCK TABLES `llx_user_extrafields` WRITE; +/*!40000 ALTER TABLE `llx_user_extrafields` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_user_extrafields` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_user_param` +-- + +DROP TABLE IF EXISTS `llx_user_param`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_user_param` ( + `fk_user` int(11) NOT NULL, + `entity` int(11) NOT NULL DEFAULT '1', + `param` varchar(255) NOT NULL, + `value` text NOT NULL, + UNIQUE KEY `uk_user_param` (`fk_user`,`param`,`entity`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_user_param` +-- + +LOCK TABLES `llx_user_param` WRITE; +/*!40000 ALTER TABLE `llx_user_param` DISABLE KEYS */; +INSERT INTO `llx_user_param` VALUES (1,1,'MAIN_BOXES_0','1'),(1,1,'MAIN_THEME','eldy'),(1,3,'THEME_ELDY_ENABLE_PERSONALIZED','1'),(1,1,'THEME_ELDY_RGB','ded0ed'),(1,3,'THEME_ELDY_RGB','d0ddc3'),(2,1,'MAIN_BOXES_0','1'),(11,1,'MAIN_BOXES_0','1'),(12,1,'MAIN_BOXES_0','1'),(12,1,'MAIN_SELECTEDFIELDS_/dolibarr_4.0/htdocs/adherents/list.php','d.zip,d.ref,d.lastname,d.firstname,d.company,d.login,d.morphy,t.libelle,d.email,d.datefin,d.statut,'),(12,1,'MAIN_SELECTEDFIELDS_projectlist','ef.priority,p.ref,p.title,s.nom,commercial,p.dateo,p.datee,p.public,p.opp_amount,p.fk_opp_status,p.opp_percent,p.fk_statut,'); +/*!40000 ALTER TABLE `llx_user_param` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_user_rib` +-- + +DROP TABLE IF EXISTS `llx_user_rib`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_user_rib` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `fk_user` int(11) NOT NULL, + `entity` int(11) NOT NULL DEFAULT '1', + `datec` datetime DEFAULT NULL, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `label` varchar(30) DEFAULT NULL, + `bank` varchar(255) DEFAULT NULL, + `code_banque` varchar(128) DEFAULT NULL, + `code_guichet` varchar(6) DEFAULT NULL, + `number` varchar(255) DEFAULT NULL, + `cle_rib` varchar(5) DEFAULT NULL, + `bic` varchar(11) DEFAULT NULL, + `iban_prefix` varchar(34) DEFAULT NULL, + `domiciliation` varchar(255) DEFAULT NULL, + `proprio` varchar(60) DEFAULT NULL, + `owner_address` varchar(255) DEFAULT NULL, + PRIMARY KEY (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_user_rib` +-- + +LOCK TABLES `llx_user_rib` WRITE; +/*!40000 ALTER TABLE `llx_user_rib` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_user_rib` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_user_rights` +-- + +DROP TABLE IF EXISTS `llx_user_rights`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_user_rights` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `fk_user` int(11) NOT NULL, + `fk_id` int(11) NOT NULL, + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_user_rights` (`fk_user`,`fk_id`), + CONSTRAINT `fk_user_rights_fk_user_user` FOREIGN KEY (`fk_user`) REFERENCES `llx_user` (`rowid`) +) ENGINE=InnoDB AUTO_INCREMENT=15092 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_user_rights` +-- + +LOCK TABLES `llx_user_rights` WRITE; +/*!40000 ALTER TABLE `llx_user_rights` DISABLE KEYS */; +INSERT INTO `llx_user_rights` VALUES (12402,1,11),(12380,1,12),(12385,1,13),(12389,1,14),(12393,1,15),(12398,1,16),(12404,1,19),(9726,1,21),(9700,1,22),(9706,1,24),(9711,1,25),(9716,1,26),(9722,1,27),(9728,1,28),(9978,1,31),(9968,1,32),(9974,1,34),(1910,1,36),(9980,1,38),(11573,1,41),(11574,1,42),(11575,1,44),(11576,1,45),(7184,1,61),(7181,1,62),(7183,1,64),(7185,1,67),(7186,1,68),(1678,1,71),(1673,1,72),(1675,1,74),(1679,1,75),(1677,1,76),(1681,1,78),(1682,1,79),(12322,1,81),(12309,1,82),(12312,1,84),(12314,1,86),(12317,1,87),(12320,1,88),(12323,1,89),(11580,1,91),(11581,1,92),(11582,1,93),(11583,1,94),(10097,1,95),(10099,1,96),(10103,1,97),(10104,1,98),(7139,1,101),(7134,1,102),(7136,1,104),(7137,1,105),(7138,1,106),(7140,1,109),(10229,1,111),(10201,1,112),(10207,1,113),(10213,1,114),(10219,1,115),(10225,1,116),(10231,1,117),(12518,1,121),(12508,1,122),(12514,1,125),(12520,1,126),(11577,1,141),(11578,1,142),(11579,1,144),(2307,1,151),(2304,1,152),(2306,1,153),(2308,1,154),(10092,1,161),(10093,1,162),(10094,1,163),(10095,1,164),(10096,1,165),(1585,1,170),(12342,1,171),(12331,1,172),(12335,1,173),(12339,1,174),(12343,1,178),(10000,1,221),(9990,1,222),(9996,1,223),(10002,1,229),(10007,1,237),(10011,1,238),(10015,1,239),(1686,1,241),(1685,1,242),(1687,1,243),(12604,1,251),(12566,1,252),(12569,1,253),(12572,1,254),(12575,1,255),(12579,1,256),(1617,1,258),(12525,1,262),(12544,1,281),(12534,1,282),(12540,1,283),(12546,1,286),(12288,1,300),(12290,1,301),(11591,1,302),(1763,1,331),(1762,1,332),(1764,1,333),(12582,1,341),(12584,1,342),(12586,1,343),(12588,1,344),(12600,1,351),(12593,1,352),(12597,1,353),(12601,1,354),(12605,1,358),(12560,1,531),(12553,1,532),(12557,1,534),(1625,1,536),(12561,1,538),(12358,1,700),(12348,1,701),(12354,1,702),(12360,1,703),(1755,1,1001),(1754,1,1002),(1756,1,1003),(1758,1,1004),(1759,1,1005),(7146,1,1101),(7143,1,1102),(7145,1,1104),(7147,1,1109),(12412,1,1181),(12458,1,1182),(12417,1,1183),(12420,1,1184),(12423,1,1185),(12427,1,1186),(12431,1,1187),(12437,1,1188),(12434,1,1189),(1578,1,1201),(1579,1,1202),(12454,1,1231),(12443,1,1232),(12446,1,1233),(12449,1,1234),(12452,1,1235),(12455,1,1236),(12459,1,1237),(1736,1,1251),(12409,1,1321),(12326,1,1421),(8190,1,1791),(8187,1,1792),(8191,1,1793),(12264,1,2401),(12260,1,2402),(12266,1,2403),(12280,1,2411),(12276,1,2412),(12282,1,2413),(12286,1,2414),(1618,1,2500),(12370,1,2501),(12367,1,2503),(12371,1,2515),(9610,1,5001),(9611,1,5002),(12490,1,20001),(12468,1,20002),(12474,1,20003),(12480,1,20004),(12486,1,20005),(12492,1,20006),(12302,1,23001),(12295,1,23002),(12299,1,23003),(12303,1,23004),(7701,1,50101),(4984,1,50401),(4983,1,50402),(4985,1,50403),(4987,1,50411),(4988,1,50412),(4989,1,50415),(12498,1,55001),(12499,1,55002),(3564,1,100700),(3565,1,100701),(9596,1,101051),(9598,1,101052),(9600,1,101053),(9604,1,101060),(9605,1,101061),(7177,1,101201),(7178,1,101202),(10353,1,101250),(10355,1,101251),(8980,1,101261),(8981,1,101262),(7616,1,101331),(10030,1,101701),(10031,1,101702),(3582,1,102000),(3583,1,102001),(9819,1,400051),(9823,1,400052),(9827,1,400053),(9831,1,400055),(132,2,11),(133,2,12),(134,2,13),(135,2,14),(136,2,16),(137,2,19),(138,2,21),(139,2,22),(140,2,24),(141,2,25),(142,2,26),(143,2,27),(10359,2,31),(145,2,32),(10361,2,34),(146,2,36),(147,2,41),(148,2,42),(149,2,44),(150,2,61),(151,2,62),(152,2,64),(153,2,71),(154,2,72),(155,2,74),(156,2,75),(157,2,78),(158,2,79),(159,2,81),(160,2,82),(161,2,84),(162,2,86),(163,2,87),(164,2,88),(165,2,89),(166,2,91),(167,2,92),(168,2,93),(2475,2,95),(2476,2,96),(2477,2,97),(2478,2,98),(169,2,101),(170,2,102),(171,2,104),(172,2,109),(173,2,111),(174,2,112),(175,2,113),(176,2,114),(177,2,116),(178,2,117),(179,2,121),(180,2,122),(181,2,125),(182,2,141),(183,2,142),(184,2,144),(2479,2,151),(2480,2,152),(2481,2,153),(2482,2,154),(185,2,161),(186,2,162),(187,2,163),(188,2,164),(189,2,165),(190,2,170),(2471,2,171),(192,2,172),(2472,2,173),(193,2,221),(194,2,222),(195,2,229),(196,2,241),(197,2,242),(198,2,243),(199,2,251),(201,2,262),(202,2,281),(203,2,282),(204,2,283),(205,2,331),(15072,2,510),(2483,2,531),(207,2,532),(2484,2,534),(208,2,536),(2473,2,700),(210,2,701),(211,2,702),(2474,2,703),(15064,2,771),(15057,2,772),(15059,2,773),(15061,2,774),(15063,2,775),(15065,2,776),(212,2,1001),(213,2,1002),(214,2,1003),(215,2,1004),(216,2,1005),(217,2,1101),(218,2,1102),(219,2,1104),(220,2,1109),(15073,2,1121),(15074,2,1122),(15075,2,1123),(15076,2,1124),(15077,2,1125),(15078,2,1126),(221,2,1181),(222,2,1182),(223,2,1183),(224,2,1184),(225,2,1185),(226,2,1186),(227,2,1187),(228,2,1188),(229,2,1201),(230,2,1202),(231,2,1231),(232,2,1232),(233,2,1233),(234,2,1234),(235,2,1421),(236,2,2401),(237,2,2402),(238,2,2403),(239,2,2411),(240,2,2412),(241,2,2413),(242,2,2500),(2470,2,2501),(243,2,2515),(10363,2,20001),(10364,2,20002),(10365,2,20003),(10366,2,20004),(10367,2,20005),(10368,2,20006),(15054,2,23001),(10362,2,50101),(15067,2,55001),(15066,2,59001),(15068,2,63001),(15069,2,63002),(15070,2,63003),(15071,2,63004),(10372,2,101250),(1807,3,11),(1808,3,31),(1809,3,36),(1810,3,41),(1811,3,61),(1812,3,71),(1813,3,72),(1814,3,74),(1815,3,75),(1816,3,78),(1817,3,79),(1818,3,91),(1819,3,95),(1820,3,97),(1821,3,111),(1822,3,121),(1823,3,122),(1824,3,125),(1825,3,161),(1826,3,170),(1827,3,171),(1828,3,172),(1829,3,221),(1830,3,222),(1831,3,229),(1832,3,241),(1833,3,242),(1834,3,243),(1835,3,251),(1836,3,255),(1837,3,256),(1838,3,262),(1839,3,281),(1840,3,282),(1841,3,283),(1842,3,331),(1843,3,531),(1844,3,536),(1845,3,700),(1846,3,1001),(1847,3,1002),(1848,3,1003),(1849,3,1004),(1850,3,1005),(1851,3,1181),(1852,3,1182),(1853,3,1201),(1854,3,1202),(1855,3,1231),(1856,3,2401),(1857,3,2402),(1858,3,2403),(1859,3,2411),(1860,3,2412),(1861,3,2413),(1862,3,2500),(1863,3,2515),(8026,4,11),(8027,4,21),(8028,4,31),(8029,4,41),(8030,4,61),(8031,4,71),(8032,4,72),(8033,4,74),(8034,4,75),(8035,4,78),(8036,4,79),(8037,4,81),(8038,4,91),(8039,4,95),(8040,4,97),(8041,4,101),(8042,4,111),(8043,4,121),(8044,4,151),(8045,4,161),(8046,4,171),(8047,4,221),(8048,4,222),(8049,4,229),(8050,4,241),(8051,4,242),(8052,4,243),(8146,4,251),(8147,4,253),(8053,4,262),(8054,4,281),(8055,4,331),(8056,4,341),(8057,4,342),(8058,4,343),(8059,4,344),(8060,4,531),(8061,4,700),(8062,4,1001),(8063,4,1002),(8064,4,1003),(8065,4,1004),(8066,4,1005),(8067,4,1101),(8068,4,1181),(8069,4,1182),(8070,4,1201),(8071,4,1202),(8072,4,1231),(8073,4,2401),(8074,4,2501),(8075,4,2503),(8076,4,2515),(8077,4,20001),(8078,4,50101),(8079,4,101201),(8080,4,101261),(8081,4,102000),(8082,4,400051),(8083,4,400052),(8084,4,400053),(8085,4,400055),(12608,10,11),(12609,10,21),(12610,10,31),(12611,10,41),(12612,10,61),(12613,10,71),(12614,10,72),(12615,10,74),(12616,10,75),(12617,10,78),(12618,10,79),(12619,10,81),(12620,10,91),(12621,10,95),(12622,10,97),(12623,10,101),(12624,10,111),(12625,10,121),(12626,10,151),(12627,10,161),(12628,10,171),(12629,10,221),(12630,10,222),(12631,10,229),(12632,10,241),(12633,10,242),(12634,10,243),(12635,10,262),(12636,10,281),(12637,10,300),(12638,10,331),(12639,10,341),(12640,10,342),(12641,10,343),(12642,10,344),(12643,10,531),(12644,10,700),(12645,10,1001),(12646,10,1002),(12647,10,1003),(12648,10,1004),(12649,10,1005),(12650,10,1101),(12651,10,1181),(12652,10,1182),(12653,10,1201),(12654,10,1202),(12655,10,1231),(12656,10,2401),(12657,10,2501),(12658,10,2503),(12659,10,2515),(12660,10,20001),(12661,10,20002),(12662,10,23001),(12663,10,50101),(12664,11,11),(12665,11,21),(12666,11,31),(12667,11,41),(12668,11,61),(12669,11,71),(12670,11,72),(12671,11,74),(12672,11,75),(12673,11,78),(12674,11,79),(12675,11,81),(12676,11,91),(12677,11,95),(12678,11,97),(12679,11,101),(12680,11,111),(12681,11,121),(12682,11,151),(12683,11,161),(12684,11,171),(12685,11,221),(12686,11,222),(12687,11,229),(12688,11,241),(12689,11,242),(12690,11,243),(12691,11,262),(12692,11,281),(12693,11,300),(12694,11,331),(12695,11,341),(12696,11,342),(12697,11,343),(12698,11,344),(12699,11,531),(12700,11,700),(12701,11,1001),(12702,11,1002),(12703,11,1003),(12704,11,1004),(12705,11,1005),(12706,11,1101),(12707,11,1181),(12708,11,1182),(12709,11,1201),(12710,11,1202),(12711,11,1231),(12712,11,2401),(12713,11,2501),(12714,11,2503),(12715,11,2515),(12716,11,20001),(12717,11,20002),(12718,11,23001),(12719,11,50101),(14748,12,11),(14738,12,12),(14740,12,13),(14742,12,14),(14744,12,15),(14747,12,16),(14750,12,19),(14146,12,21),(14135,12,22),(14137,12,24),(14139,12,25),(14142,12,26),(14145,12,27),(14148,12,28),(14930,12,31),(14926,12,32),(14929,12,34),(14932,12,38),(13816,12,41),(13813,12,42),(13815,12,44),(13817,12,45),(14094,12,61),(14091,12,62),(14093,12,64),(14095,12,67),(14096,12,68),(13891,12,71),(13886,12,72),(13888,12,74),(13892,12,75),(13890,12,76),(13894,12,78),(13895,12,79),(14955,12,81),(14949,12,82),(14950,12,84),(14951,12,86),(14953,12,87),(14954,12,88),(14956,12,89),(13904,12,91),(13900,12,92),(13903,12,93),(13906,12,94),(13990,12,95),(12734,12,97),(14939,12,101),(14935,12,102),(14936,12,104),(14937,12,105),(14938,12,106),(14940,12,109),(14051,12,111),(14038,12,112),(14041,12,113),(14044,12,114),(14047,12,115),(14050,12,116),(14053,12,117),(15015,12,121),(15011,12,122),(15014,12,125),(15017,12,126),(13821,12,141),(13820,12,142),(13822,12,144),(13912,12,151),(13909,12,152),(13911,12,153),(13913,12,154),(14063,12,161),(14056,12,162),(14058,12,163),(14060,12,164),(14062,12,165),(14064,12,167),(13350,12,171),(13345,12,172),(13347,12,173),(13349,12,174),(13351,12,178),(13838,12,221),(13834,12,222),(13837,12,223),(13840,12,229),(13842,12,237),(13844,12,238),(13846,12,239),(13516,12,241),(13515,12,242),(13517,12,243),(14730,12,251),(14711,12,252),(14713,12,253),(14714,12,254),(14716,12,255),(14718,12,256),(15019,12,262),(15028,12,281),(15024,12,282),(15027,12,283),(15030,12,286),(14732,12,300),(14733,12,301),(14126,12,331),(14125,12,332),(14127,12,333),(14719,12,341),(14720,12,342),(14721,12,343),(14722,12,344),(14728,12,351),(14725,12,352),(14727,12,353),(14729,12,354),(14731,12,358),(13865,12,510),(13862,12,512),(13864,12,514),(13866,12,517),(14686,12,531),(14683,12,532),(14685,12,534),(14687,12,538),(13358,12,700),(14832,12,701),(14831,12,702),(14834,12,703),(15090,12,771),(15081,12,772),(15083,12,773),(15085,12,774),(15087,12,775),(15089,12,776),(15091,12,779),(14917,12,1001),(14916,12,1002),(14918,12,1003),(14920,12,1004),(14921,12,1005),(14945,12,1101),(14943,12,1102),(14944,12,1104),(14946,12,1109),(14762,12,1121),(14755,12,1122),(14757,12,1123),(14759,12,1124),(14761,12,1125),(14763,12,1126),(14982,12,1181),(15005,12,1182),(14985,12,1183),(14986,12,1184),(14988,12,1185),(14990,12,1186),(14992,12,1187),(14995,12,1188),(14993,12,1189),(13827,12,1201),(13828,12,1202),(15003,12,1231),(14998,12,1232),(14999,12,1233),(15001,12,1234),(15002,12,1235),(15004,12,1236),(15006,12,1237),(13829,12,1251),(14752,12,1321),(14957,12,1421),(15036,12,2401),(15035,12,2402),(15038,12,2403),(15044,12,2411),(15043,12,2412),(15046,12,2413),(15047,12,2414),(14591,12,2501),(14590,12,2503),(14592,12,2515),(14651,12,20001),(14641,12,20002),(14644,12,20003),(14647,12,20004),(14650,12,20005),(14653,12,20006),(14825,12,23001),(14822,12,23002),(14824,12,23003),(14826,12,23004),(13712,12,50101),(15052,12,55001),(15053,12,55002),(14128,12,59001),(14129,12,59002),(14130,12,59003),(14818,12,63001),(14815,12,63002),(14817,12,63003),(14819,12,63004),(12776,13,11),(12777,13,21),(12778,13,31),(12779,13,41),(12780,13,61),(12781,13,71),(12782,13,72),(12783,13,74),(12784,13,75),(12785,13,78),(12786,13,79),(12787,13,81),(12788,13,91),(12789,13,95),(12790,13,97),(12791,13,101),(12792,13,111),(12793,13,121),(12794,13,151),(12795,13,161),(12796,13,171),(12797,13,221),(12798,13,222),(12799,13,229),(12800,13,241),(12801,13,242),(12802,13,243),(12803,13,262),(12804,13,281),(12805,13,300),(12806,13,331),(12807,13,341),(12808,13,342),(12809,13,343),(12810,13,344),(12811,13,531),(12812,13,700),(12813,13,1001),(12814,13,1002),(12815,13,1003),(12816,13,1004),(12817,13,1005),(12818,13,1101),(12819,13,1181),(12820,13,1182),(12821,13,1201),(12822,13,1202),(12823,13,1231),(12824,13,2401),(12825,13,2501),(12826,13,2503),(12827,13,2515),(12828,13,20001),(12829,13,20002),(12830,13,23001),(12831,13,50101),(12832,14,11),(12833,14,21),(12834,14,31),(12835,14,41),(12836,14,61),(12837,14,71),(12838,14,72),(12839,14,74),(12840,14,75),(12841,14,78),(12842,14,79),(12843,14,81),(12844,14,91),(12845,14,95),(12846,14,97),(12847,14,101),(12848,14,111),(12849,14,121),(12850,14,151),(12851,14,161),(12852,14,171),(12853,14,221),(12854,14,222),(12855,14,229),(12856,14,241),(12857,14,242),(12858,14,243),(12859,14,262),(12860,14,281),(12861,14,300),(12862,14,331),(12863,14,341),(12864,14,342),(12865,14,343),(12866,14,344),(12867,14,531),(12868,14,700),(12869,14,1001),(12870,14,1002),(12871,14,1003),(12872,14,1004),(12873,14,1005),(12874,14,1101),(12875,14,1181),(12876,14,1182),(12877,14,1201),(12878,14,1202),(12879,14,1231),(12880,14,2401),(12881,14,2501),(12882,14,2503),(12883,14,2515),(12884,14,20001),(12885,14,20002),(12886,14,23001),(12887,14,50101),(12944,16,11),(12945,16,21),(12946,16,31),(13056,16,41),(13057,16,42),(13058,16,44),(13059,16,45),(12948,16,61),(12949,16,71),(12950,16,72),(12951,16,74),(12952,16,75),(12953,16,78),(12954,16,79),(12955,16,81),(12956,16,91),(12957,16,95),(12958,16,97),(12959,16,101),(12960,16,111),(12961,16,121),(13060,16,141),(13061,16,142),(13062,16,144),(12962,16,151),(12963,16,161),(12964,16,171),(12965,16,221),(12966,16,222),(12967,16,229),(12968,16,241),(12969,16,242),(12970,16,243),(13128,16,251),(13064,16,262),(12972,16,281),(12973,16,300),(12974,16,331),(12975,16,341),(12976,16,342),(12977,16,343),(12978,16,344),(12979,16,531),(12980,16,700),(12981,16,1001),(12982,16,1002),(12983,16,1003),(12984,16,1004),(12985,16,1005),(12986,16,1101),(12987,16,1181),(12988,16,1182),(12989,16,1201),(12990,16,1202),(12991,16,1231),(12992,16,2401),(12993,16,2501),(12994,16,2503),(12995,16,2515),(12996,16,20001),(12997,16,20002),(12998,16,23001),(12999,16,50101),(13000,17,11),(13001,17,21),(13002,17,31),(13065,17,41),(13066,17,42),(13067,17,44),(13068,17,45),(13004,17,61),(13005,17,71),(13006,17,72),(13007,17,74),(13008,17,75),(13009,17,78),(13010,17,79),(13011,17,81),(13012,17,91),(13013,17,95),(13014,17,97),(13015,17,101),(13016,17,111),(13017,17,121),(13069,17,141),(13070,17,142),(13071,17,144),(13018,17,151),(13019,17,161),(13020,17,171),(13021,17,221),(13022,17,222),(13023,17,229),(13024,17,241),(13025,17,242),(13026,17,243),(13028,17,281),(13029,17,300),(13030,17,331),(13031,17,341),(13032,17,342),(13033,17,343),(13034,17,344),(13035,17,531),(13036,17,700),(13037,17,1001),(13038,17,1002),(13039,17,1003),(13040,17,1004),(13041,17,1005),(13042,17,1101),(13043,17,1181),(13044,17,1182),(13045,17,1201),(13046,17,1202),(13047,17,1231),(13048,17,2401),(13049,17,2501),(13050,17,2503),(13051,17,2515),(13052,17,20001),(13053,17,20002),(13054,17,23001),(13055,17,50101),(14504,18,11),(14505,18,21),(14506,18,31),(14507,18,41),(14508,18,61),(14509,18,71),(14510,18,78),(14511,18,81),(14512,18,91),(14513,18,95),(14514,18,101),(14515,18,111),(14516,18,121),(14517,18,151),(14518,18,161),(14519,18,221),(14520,18,241),(14521,18,262),(14522,18,281),(14523,18,300),(14524,18,331),(14525,18,332),(14526,18,333),(14527,18,341),(14528,18,342),(14529,18,343),(14530,18,344),(14531,18,531),(14532,18,701),(14533,18,771),(14534,18,774),(14535,18,1001),(14536,18,1004),(14537,18,1101),(14538,18,1181),(14539,18,1182),(14540,18,1201),(14541,18,1231),(14542,18,2401),(14543,18,2501),(14544,18,2503),(14545,18,2515),(14546,18,20001),(14547,18,20002),(14548,18,50101),(14549,18,59001); +/*!40000 ALTER TABLE `llx_user_rights` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_usergroup` +-- + +DROP TABLE IF EXISTS `llx_usergroup`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_usergroup` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `nom` varchar(255) NOT NULL, + `entity` int(11) NOT NULL DEFAULT '1', + `datec` datetime DEFAULT NULL, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `note` text, + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_usergroup_name` (`nom`,`entity`) +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_usergroup` +-- + +LOCK TABLES `llx_usergroup` WRITE; +/*!40000 ALTER TABLE `llx_usergroup` DISABLE KEYS */; +INSERT INTO `llx_usergroup` VALUES (1,'Sale representatives',1,'2013-01-16 20:48:08','2015-10-03 09:44:44','All sales representative users'),(2,'Management',1,'2015-10-03 11:46:25','2015-10-03 09:46:25',''),(3,'Scientists',1,'2015-10-03 11:46:46','2015-10-03 09:46:46',''),(4,'Commercial',1,'2015-10-05 21:30:13','2015-10-05 19:30:13',''); +/*!40000 ALTER TABLE `llx_usergroup` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_usergroup_extrafields` +-- + +DROP TABLE IF EXISTS `llx_usergroup_extrafields`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_usergroup_extrafields` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `fk_object` int(11) NOT NULL, + `import_key` varchar(14) DEFAULT NULL, + PRIMARY KEY (`rowid`), + KEY `idx_usergroup_extrafields` (`fk_object`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_usergroup_extrafields` +-- + +LOCK TABLES `llx_usergroup_extrafields` WRITE; +/*!40000 ALTER TABLE `llx_usergroup_extrafields` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_usergroup_extrafields` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_usergroup_rights` +-- + +DROP TABLE IF EXISTS `llx_usergroup_rights`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_usergroup_rights` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `fk_usergroup` int(11) NOT NULL, + `fk_id` int(11) NOT NULL, + PRIMARY KEY (`rowid`), + UNIQUE KEY `fk_usergroup` (`fk_usergroup`,`fk_id`), + CONSTRAINT `fk_usergroup_rights_fk_usergroup` FOREIGN KEY (`fk_usergroup`) REFERENCES `llx_usergroup` (`rowid`) +) ENGINE=InnoDB AUTO_INCREMENT=200 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_usergroup_rights` +-- + +LOCK TABLES `llx_usergroup_rights` WRITE; +/*!40000 ALTER TABLE `llx_usergroup_rights` DISABLE KEYS */; +INSERT INTO `llx_usergroup_rights` VALUES (1,1,2401),(2,1,2402),(3,1,2403),(4,1,2411),(5,1,2412),(6,1,2413),(78,2,11),(79,2,12),(80,2,13),(81,2,14),(82,2,15),(83,2,16),(84,2,19),(144,2,21),(145,2,22),(146,2,24),(147,2,25),(148,2,26),(149,2,27),(150,2,28),(133,2,31),(134,2,32),(135,2,34),(136,2,38),(137,2,41),(138,2,42),(139,2,44),(140,2,45),(86,2,61),(87,2,62),(88,2,64),(89,2,67),(90,2,68),(7,2,71),(8,2,72),(9,2,74),(10,2,75),(11,2,76),(12,2,78),(13,2,79),(32,2,81),(33,2,82),(34,2,84),(35,2,86),(36,2,87),(37,2,88),(38,2,89),(173,2,91),(174,2,92),(175,2,93),(176,2,94),(40,2,95),(41,2,96),(42,2,97),(43,2,98),(66,2,101),(67,2,102),(68,2,104),(69,2,105),(70,2,106),(71,2,109),(21,2,111),(22,2,112),(23,2,113),(24,2,114),(25,2,115),(26,2,116),(27,2,117),(164,2,121),(165,2,122),(166,2,125),(167,2,126),(141,2,141),(142,2,142),(143,2,144),(129,2,151),(130,2,152),(131,2,153),(132,2,154),(44,2,161),(45,2,162),(46,2,163),(47,2,164),(48,2,165),(49,2,167),(54,2,171),(55,2,172),(56,2,173),(57,2,174),(58,2,178),(120,2,221),(121,2,222),(122,2,223),(123,2,229),(124,2,237),(125,2,238),(126,2,239),(29,2,241),(30,2,242),(31,2,243),(182,2,251),(183,2,252),(184,2,253),(185,2,254),(186,2,255),(187,2,256),(168,2,262),(169,2,281),(170,2,282),(171,2,283),(172,2,286),(197,2,331),(198,2,332),(199,2,333),(188,2,341),(189,2,342),(190,2,343),(191,2,344),(192,2,351),(193,2,352),(194,2,353),(195,2,354),(196,2,358),(151,2,531),(152,2,532),(153,2,534),(154,2,538),(59,2,700),(60,2,701),(61,2,702),(62,2,703),(177,2,1001),(178,2,1002),(179,2,1003),(180,2,1004),(181,2,1005),(72,2,1101),(73,2,1102),(74,2,1104),(75,2,1109),(91,2,1181),(92,2,1182),(93,2,1183),(94,2,1184),(95,2,1185),(96,2,1186),(97,2,1187),(98,2,1188),(99,2,1189),(76,2,1201),(77,2,1202),(100,2,1231),(101,2,1232),(102,2,1233),(103,2,1234),(104,2,1235),(105,2,1236),(106,2,1237),(113,2,1251),(85,2,1321),(39,2,1421),(14,2,2401),(15,2,2402),(16,2,2403),(17,2,2411),(18,2,2412),(19,2,2413),(20,2,2414),(63,2,2501),(64,2,2503),(65,2,2515),(114,2,20001),(115,2,20002),(116,2,20003),(117,2,20004),(118,2,20005),(119,2,20006),(50,2,23001),(51,2,23002),(52,2,23003),(53,2,23004),(28,2,50101),(127,2,55001),(128,2,55002); +/*!40000 ALTER TABLE `llx_usergroup_rights` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_usergroup_user` +-- + +DROP TABLE IF EXISTS `llx_usergroup_user`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_usergroup_user` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `entity` int(11) NOT NULL DEFAULT '1', + `fk_user` int(11) NOT NULL, + `fk_usergroup` int(11) NOT NULL, + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_usergroup_user` (`entity`,`fk_user`,`fk_usergroup`), + KEY `fk_usergroup_user_fk_user` (`fk_user`), + KEY `fk_usergroup_user_fk_usergroup` (`fk_usergroup`), + CONSTRAINT `fk_usergroup_user_fk_user` FOREIGN KEY (`fk_user`) REFERENCES `llx_user` (`rowid`), + CONSTRAINT `fk_usergroup_user_fk_usergroup` FOREIGN KEY (`fk_usergroup`) REFERENCES `llx_usergroup` (`rowid`) +) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_usergroup_user` +-- + +LOCK TABLES `llx_usergroup_user` WRITE; +/*!40000 ALTER TABLE `llx_usergroup_user` DISABLE KEYS */; +INSERT INTO `llx_usergroup_user` VALUES (2,1,1,3),(12,1,2,4),(3,1,3,3),(4,1,11,2),(5,1,13,4),(6,1,16,1),(7,1,17,1),(11,1,18,1),(8,1,18,2),(9,1,18,3),(10,1,18,4); +/*!40000 ALTER TABLE `llx_usergroup_user` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_website` +-- + +DROP TABLE IF EXISTS `llx_website`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_website` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `entity` int(11) DEFAULT '1', + `ref` varchar(24) NOT NULL, + `description` varchar(255) DEFAULT NULL, + `status` int(11) DEFAULT NULL, + `fk_default_home` int(11) DEFAULT NULL, + `date_creation` datetime DEFAULT NULL, + `date_modification` datetime DEFAULT NULL, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_website_ref` (`ref`,`entity`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_website` +-- + +LOCK TABLES `llx_website` WRITE; +/*!40000 ALTER TABLE `llx_website` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_website` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `llx_website_page` +-- + +DROP TABLE IF EXISTS `llx_website_page`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `llx_website_page` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `fk_website` int(11) NOT NULL, + `pageurl` varchar(16) NOT NULL, + `title` varchar(255) DEFAULT NULL, + `description` varchar(255) DEFAULT NULL, + `keywords` varchar(255) DEFAULT NULL, + `content` text, + `status` int(11) DEFAULT NULL, + `date_creation` datetime DEFAULT NULL, + `date_modification` datetime DEFAULT NULL, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + PRIMARY KEY (`rowid`), + UNIQUE KEY `uk_website_page_url` (`fk_website`,`pageurl`), + CONSTRAINT `fk_website_page_website` FOREIGN KEY (`fk_website`) REFERENCES `llx_website` (`rowid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `llx_website_page` +-- + +LOCK TABLES `llx_website_page` WRITE; +/*!40000 ALTER TABLE `llx_website_page` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_website_page` ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +-- Dump completed on 2016-07-31 23:17:43 diff --git a/dev/initdemo/removedemo.sh b/dev/initdemo/removeconfdemo.sh similarity index 100% rename from dev/initdemo/removedemo.sh rename to dev/initdemo/removeconfdemo.sh diff --git a/dev/initdemo/savedemo.sh b/dev/initdemo/savedemo.sh index d4d6750d715..fe9cba72c43 100755 --- a/dev/initdemo/savedemo.sh +++ b/dev/initdemo/savedemo.sh @@ -187,7 +187,6 @@ export list=" --ignore-table=$base.llx_bt_webseedfiles --ignore-table=$base.llx_c_civilite --ignore-table=$base.llx_c_dolicloud_plans - --ignore-table=$base.llx_c_lead_status --ignore-table=$base.llx_c_source --ignore-table=$base.llx_cabinetmed_c_banques --ignore-table=$base.llx_cabinetmed_c_ccam diff --git a/dev/initdemo/updatedemo.php b/dev/initdemo/updatedemo.php new file mode 100755 index 00000000000..9c453096904 --- /dev/null +++ b/dev/initdemo/updatedemo.php @@ -0,0 +1,126 @@ +#!/usr/bin/env php + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * or see http://www.gnu.org/ + * + * Get a distant dump file and load it into a mysql database + */ + +$sapi_type = php_sapi_name(); +$script_file = basename(__FILE__); +$path=dirname(__FILE__).'/'; + +// Test if batch mode +if (substr($sapi_type, 0, 3) == 'cgi') { + echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n"; + exit; +} + +// Global variables +$error=0; + +$confirm=isset($argv[1])?$argv[1]:''; + +// Include Dolibarr environment +$res=0; +if (! $res && file_exists($path."../../master.inc.php")) $res=@include($path."../../master.inc.php"); +if (! $res && file_exists($path."../../htdocs/master.inc.php")) $res=@include($path."../../htdocs/master.inc.php"); +if (! $res && file_exists("../master.inc.php")) $res=@include("../master.inc.php"); +if (! $res && file_exists("../../master.inc.php")) $res=@include("../../master.inc.php"); +if (! $res && file_exists("../../../master.inc.php")) $res=@include("../../../master.inc.php"); +if (! $res && preg_match('/\/nltechno([^\/]*)\//',$_SERVER["PHP_SELF"],$reg)) $res=@include($path."../../../dolibarr".$reg[1]."/htdocs/master.inc.php"); // Used on dev env only +if (! $res && preg_match('/\/nltechno([^\/]*)\//',$_SERVER["PHP_SELF"],$reg)) $res=@include("../../../dolibarr".$reg[1]."/htdocs/master.inc.php"); // Used on dev env only +if (! $res) die ("Failed to include master.inc.php file\n"); +include_once(DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'); + + +/* + * Main + */ + +if (empty($confirm)) +{ + print "Usage: $script_file confirm\n"; + print "Return code: 0 if success, <>0 if error\n"; + exit(-1); +} + + +$tmp=dol_getdate(dol_now()); + + +$tables=array( + 'propal'=>array(0=>'datep', 1=>'fin_validite', 2=>'date_valid', 3=>'date_cloture'), + 'commande'=>array(0=>'date_commande', 1=>'date_valid', 2=>'date_cloture'), + 'facture'=>array(0=>'datef', 1=>'date_valid', 2=>'date_lim_reglement'), + 'paiement'=>array(0=>'datep'), + 'bank'=>array(0=>'datev', 1=>'dateo'), + 'commande_fournisseur'=>array(0=>'date_commande', 1=>'date_valid', 3=>'date_creation', 4=>'date_approve', 5=>'date_approve2', 6=>'date_livraison'), + 'supplier_proposal'=>array(0=>'datec', 1=>'date_valid', 2=>'date_cloture') +); + +$year=2010; +$currentyear=$tmp['year']; +while ($year <= $currentyear) +{ + //$year=2021; + $delta=($currentyear - $year); + //$delta=-1; + + if ($delta) + { + foreach($tables as $tablekey => $tableval) + { + print "\nCorrect ".$tablekey." for year ".$year." and move them to current year ".$currentyear." "; + $sql="select rowid from ".MAIN_DB_PREFIX.$tablekey." where ".$tableval[0]." between '".$year."-01-01' and '".$year."-12-31' and ".$tableval[0]." < DATE_ADD(NOW(), INTERVAL -1 YEAR)"; + //$sql="select rowid from ".MAIN_DB_PREFIX.$tablekey." where ".$tableval[0]." between '".$year."-01-01' and '".$year."-12-31' and ".$tableval[0]." > NOW()"; + $resql = $db->query($sql); + if ($resql) + { + $num = $db->num_rows($resql); + $i=0; + while ($i < $num) + { + $obj=$db->fetch_object($resql); + if ($obj) + { + print "."; + $sql2="UPDATE ".MAIN_DB_PREFIX.$tablekey." set "; + $j=0; + foreach($tableval as $field) + { + if ($j) $sql2.=", "; + $sql2.= $field." = DATE_ADD(".$field.", INTERVAL ".$delta." YEAR)"; + $j++; + } + $sql2.=" WHERE rowid = ".$obj->rowid; + //print $sql2."\n"; + $resql2 = $db->query($sql2); + if (! $resql2) dol_print_error($db); + } + $i++; + } + } + else dol_print_error($db); + } + } + + $year++; +} + +print "\n"; + +exit(0); diff --git a/dev/cliparts/commons.svg b/dev/resources/cliparts/commons.svg similarity index 100% rename from dev/cliparts/commons.svg rename to dev/resources/cliparts/commons.svg diff --git a/dev/dbmodel/dolibarr.uml b/dev/resources/dbmodel/dolibarr.uml similarity index 100% rename from dev/dbmodel/dolibarr.uml rename to dev/resources/dbmodel/dolibarr.uml diff --git a/dev/dbmodel/dolibarr.umldi b/dev/resources/dbmodel/dolibarr.umldi similarity index 100% rename from dev/dbmodel/dolibarr.umldi rename to dev/resources/dbmodel/dolibarr.umldi diff --git a/dev/dbmodel/dolibarr_schema.mwb b/dev/resources/dbmodel/dolibarr_schema.mwb similarity index 100% rename from dev/dbmodel/dolibarr_schema.mwb rename to dev/resources/dbmodel/dolibarr_schema.mwb diff --git a/dev/iso-normes/GURULABS-RPM-GUIDE-v1.0.PDF b/dev/resources/iso-normes/GURULABS-RPM-GUIDE-v1.0.PDF similarity index 100% rename from dev/iso-normes/GURULABS-RPM-GUIDE-v1.0.PDF rename to dev/resources/iso-normes/GURULABS-RPM-GUIDE-v1.0.PDF diff --git a/dev/iso-normes/address_format.txt b/dev/resources/iso-normes/address_format.txt similarity index 100% rename from dev/iso-normes/address_format.txt rename to dev/resources/iso-normes/address_format.txt diff --git a/dev/iso-normes/banknumber_format.txt b/dev/resources/iso-normes/banknumber_format.txt similarity index 100% rename from dev/iso-normes/banknumber_format.txt rename to dev/resources/iso-normes/banknumber_format.txt diff --git a/dev/iso-normes/barcode_EAN13.txt b/dev/resources/iso-normes/barcode_EAN13.txt similarity index 100% rename from dev/iso-normes/barcode_EAN13.txt rename to dev/resources/iso-normes/barcode_EAN13.txt diff --git a/dev/iso-normes/countries_iso-3166_en.txt b/dev/resources/iso-normes/countries_iso-3166_en.txt similarity index 100% rename from dev/iso-normes/countries_iso-3166_en.txt rename to dev/resources/iso-normes/countries_iso-3166_en.txt diff --git a/dev/iso-normes/countries_iso-3166_fr.txt b/dev/resources/iso-normes/countries_iso-3166_fr.txt similarity index 100% rename from dev/iso-normes/countries_iso-3166_fr.txt rename to dev/resources/iso-normes/countries_iso-3166_fr.txt diff --git a/dev/iso-normes/currencies_iso-4217.txt b/dev/resources/iso-normes/currencies_iso-4217.txt similarity index 100% rename from dev/iso-normes/currencies_iso-4217.txt rename to dev/resources/iso-normes/currencies_iso-4217.txt diff --git a/dev/iso-normes/fichier_norme_AFB-CFONB.pdf b/dev/resources/iso-normes/fichier_norme_AFB-CFONB.pdf similarity index 100% rename from dev/iso-normes/fichier_norme_AFB-CFONB.pdf rename to dev/resources/iso-normes/fichier_norme_AFB-CFONB.pdf diff --git a/dev/iso-normes/format_FEC-Lien_outil_de_test_agréé.pdf b/dev/resources/iso-normes/format_FEC-Lien_outil_de_test_agréé.pdf similarity index 100% rename from dev/iso-normes/format_FEC-Lien_outil_de_test_agréé.pdf rename to dev/resources/iso-normes/format_FEC-Lien_outil_de_test_agréé.pdf diff --git a/dev/iso-normes/format_FEC.pdf b/dev/resources/iso-normes/format_FEC.pdf similarity index 100% rename from dev/iso-normes/format_FEC.pdf rename to dev/resources/iso-normes/format_FEC.pdf diff --git a/dev/iso-normes/iban_iso-13616.txt b/dev/resources/iso-normes/iban_iso-13616.txt similarity index 100% rename from dev/iso-normes/iban_iso-13616.txt rename to dev/resources/iso-normes/iban_iso-13616.txt diff --git a/dev/iso-normes/languages_iso-639.txt b/dev/resources/iso-normes/languages_iso-639.txt similarity index 100% rename from dev/iso-normes/languages_iso-639.txt rename to dev/resources/iso-normes/languages_iso-639.txt diff --git a/dev/iso-normes/locales.txt b/dev/resources/iso-normes/locales.txt similarity index 100% rename from dev/iso-normes/locales.txt rename to dev/resources/iso-normes/locales.txt diff --git a/dev/iso-normes/vat_number_names.txt b/dev/resources/iso-normes/vat_number_names.txt similarity index 100% rename from dev/iso-normes/vat_number_names.txt rename to dev/resources/iso-normes/vat_number_names.txt diff --git a/dev/iso-normes/world_tax_rates.txt b/dev/resources/iso-normes/world_tax_rates.txt similarity index 100% rename from dev/iso-normes/world_tax_rates.txt rename to dev/resources/iso-normes/world_tax_rates.txt diff --git a/dev/iso-normes/xmlexport.txt b/dev/resources/iso-normes/xmlexport.txt similarity index 100% rename from dev/iso-normes/xmlexport.txt rename to dev/resources/iso-normes/xmlexport.txt diff --git a/dev/licence/Links on GPL.txt b/dev/resources/licence/Links on GPL.txt similarity index 100% rename from dev/licence/Links on GPL.txt rename to dev/resources/licence/Links on GPL.txt diff --git a/dev/licence/quick-guide-gplv3-compatibility.png b/dev/resources/licence/quick-guide-gplv3-compatibility.png similarity index 100% rename from dev/licence/quick-guide-gplv3-compatibility.png rename to dev/resources/licence/quick-guide-gplv3-compatibility.png diff --git a/dev/security/htaccess.txt b/dev/security/htaccess.txt deleted file mode 100644 index 7d3aaf1a903..00000000000 --- a/dev/security/htaccess.txt +++ /dev/null @@ -1,2 +0,0 @@ -Order allow,deny -Deny from all \ No newline at end of file diff --git a/dev/codesniffer/README b/dev/setup/codesniffer/README similarity index 100% rename from dev/codesniffer/README rename to dev/setup/codesniffer/README diff --git a/dev/codesniffer/php.ini b/dev/setup/codesniffer/php.ini similarity index 100% rename from dev/codesniffer/php.ini rename to dev/setup/codesniffer/php.ini diff --git a/dev/codesniffer/ruleset.dtd b/dev/setup/codesniffer/ruleset.dtd similarity index 100% rename from dev/codesniffer/ruleset.dtd rename to dev/setup/codesniffer/ruleset.dtd diff --git a/dev/codesniffer/ruleset.xml b/dev/setup/codesniffer/ruleset.xml similarity index 99% rename from dev/codesniffer/ruleset.xml rename to dev/setup/codesniffer/ruleset.xml index 7b887113d90..2a58094717f 100644 --- a/dev/codesniffer/ruleset.xml +++ b/dev/setup/codesniffer/ruleset.xml @@ -187,7 +187,9 @@ 0 - + + 0 + 0 diff --git a/dev/codetemplates/README b/dev/setup/codetemplates/README similarity index 100% rename from dev/codetemplates/README rename to dev/setup/codetemplates/README diff --git a/dev/codetemplates/codetemplates.dtd b/dev/setup/codetemplates/codetemplates.dtd similarity index 100% rename from dev/codetemplates/codetemplates.dtd rename to dev/setup/codetemplates/codetemplates.dtd diff --git a/dev/codetemplates/codetemplates.xml b/dev/setup/codetemplates/codetemplates.xml similarity index 100% rename from dev/codetemplates/codetemplates.xml rename to dev/setup/codetemplates/codetemplates.xml diff --git a/dev/multitail/.multitailrc b/dev/setup/multitail/.multitailrc similarity index 100% rename from dev/multitail/.multitailrc rename to dev/setup/multitail/.multitailrc diff --git a/dev/phpunit/README b/dev/setup/phpunit/README similarity index 100% rename from dev/phpunit/README rename to dev/setup/phpunit/README diff --git a/dev/phpunit/eclipse_setup_for_pti_phpunit.png b/dev/setup/phpunit/eclipse_setup_for_pti_phpunit.png similarity index 100% rename from dev/phpunit/eclipse_setup_for_pti_phpunit.png rename to dev/setup/phpunit/eclipse_setup_for_pti_phpunit.png diff --git a/dev/security/README b/dev/setup/security/README similarity index 100% rename from dev/security/README rename to dev/setup/security/README diff --git a/dev/setup/security/htaccess.txt b/dev/setup/security/htaccess.txt new file mode 100644 index 00000000000..a8364c85a0f --- /dev/null +++ b/dev/setup/security/htaccess.txt @@ -0,0 +1 @@ +Require all granted diff --git a/dev/xdebug/README b/dev/setup/xdebug/README similarity index 100% rename from dev/xdebug/README rename to dev/setup/xdebug/README diff --git a/dev/xdebug/eclipse_setup_for_xdebug.jpg b/dev/setup/xdebug/eclipse_setup_for_xdebug.jpg similarity index 100% rename from dev/xdebug/eclipse_setup_for_xdebug.jpg rename to dev/setup/xdebug/eclipse_setup_for_xdebug.jpg diff --git a/dev/skeletons/README b/dev/skeletons/README index 02a760a53dc..5b5b992d91e 100644 --- a/dev/skeletons/README +++ b/dev/skeletons/README @@ -2,24 +2,32 @@ README (English) -------------------------------- This directory contains PHP script samples that can be used to start a development on Dolibarr. -build_class_from_table.php: + +*** build_class_from_table.php: + This is the script to use to generate PHP code of a PHP POJO class object, a PHP script that use this POJO. This script use the files skeleton_*.php to build its generated code. -modMyModule.class.php: +*** modMyModule.class.php: + Is a sample of module descriptor that you can use if you want to build a new module/plugin for Dolibarr. -skeleton_script.php: +*** skeleton_script.php: + Is a sample you can use as an example if you need to build a script to run on command line -skeleton_page.php: + +*** skeleton_page.php: + Is a sample you can use as an example if you need to build an HTML page to include in Dolibarr GUI. -skeleton_class.class.php: + +*** skeleton_class.class.php: + Is a sample you can use as an example if you need to build a class file to access a new table required by a Dolibarr development. However it is better to run the build_class_from_table.php script that accepts a table name as a parameter and will uses the description table within database and the skeleton_class.class.php file to generate full code for your class file. After running this script, the class to access your table (insert a record, update, delete and select) is directly finished and can be used by your module's code. diff --git a/dev/skeletons/build_class_from_table.php b/dev/skeletons/build_class_from_table.php index ecdbbd09dc4..62ad1188759 100755 --- a/dev/skeletons/build_class_from_table.php +++ b/dev/skeletons/build_class_from_table.php @@ -587,11 +587,10 @@ foreach ($skeletonfiles as $skeletonfile => $outfile) { if ($prop['field'] != 'rowid' && $prop['field'] != 'id' && ! $prop['istime']) { - $varprop.="if (! empty(\$arrayfields['t.".$prop['field']."']['checked'])) print_liste_field_titre(\$arrayfields['t.".$prop['field']."']['label'],\$_SERVER['PHP_SELF'],'t.".$prop['field']."','',\$param,'',\$sortfield,\$sortorder);\n"; + $varprop.="if (! empty(\$arrayfields['t.".$prop['field']."']['checked'])) print_liste_field_titre(\$arrayfields['t.".$prop['field']."']['label'],\$_SERVER['PHP_SELF'],'t.".$prop['field']."','',\$params,'',\$sortfield,\$sortorder);\n"; } } - $targetcontent=preg_replace('/'.preg_quote("if (! empty(\$arrayfields['t.field1']['checked'])) print_liste_field_titre(\$langs->trans('field1'),\$_SERVER['PHP_SELF'],'t.field1','',\$param,'',\$sortfield,\$sortorder);",'/').'/', $varprop, $targetcontent); - $targetcontent=preg_replace('/'.preg_quote("if (! empty(\$arrayfields['t.field2']['checked'])) print_liste_field_titre(\$langs->trans('field2'),\$_SERVER['PHP_SELF'],'t.field2','',\$param,'',\$sortfield,\$sortorder);",'/').'/', '', $targetcontent); + $targetcontent=preg_replace('/LIST_OF_TD_TITLE_FIELDS/', $varprop, $targetcontent); // Substitute fields title search $varprop="\n"; @@ -603,8 +602,7 @@ foreach ($skeletonfiles as $skeletonfile => $outfile) $varprop.="if (! empty(\$arrayfields['t.".$prop['field']."']['checked'])) print '';\n"; } } - $targetcontent=preg_replace('/'.preg_quote("if (! empty(\$arrayfields['t.field1']['checked'])) print '';",'/').'/', $varprop, $targetcontent); - $targetcontent=preg_replace('/'.preg_quote("if (! empty(\$arrayfields['t.field2']['checked'])) print '';",'/').'/', '', $targetcontent); + $targetcontent=preg_replace('/LIST_OF_TD_TITLE_SEARCH/', $varprop, $targetcontent); // Substitute where for .fieldx. $varprop="\n"; @@ -656,6 +654,10 @@ foreach ($skeletonfiles as $skeletonfile => $outfile) $targetcontent=preg_replace('/LIST_OF_TD_LABEL_FIELDS_VIEW/', $varprop, $targetcontent); + // LIST_OF_TD_FIELDS_LIST + + + // Build file $fp=fopen($outfile,"w"); if ($fp) diff --git a/dev/skeletons/modMyModule.class.php b/dev/skeletons/modMyModule.class.php index 7fa7aae9756..64890b9d9cf 100644 --- a/dev/skeletons/modMyModule.class.php +++ b/dev/skeletons/modMyModule.class.php @@ -62,7 +62,7 @@ class modMyModule extends DolibarrModules $this->name = preg_replace('/^mod/i','',get_class($this)); // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module) $this->description = "Description of module MyModule"; - $this->descriptionlong = "A very lon description. Can be a full HTML content"; + $this->descriptionlong = "A very long description. Can be a full HTML content"; $this->editor_name = 'Editor name'; $this->editor_url = 'http://www.dolibarr.org'; @@ -90,7 +90,7 @@ class modMyModule extends DolibarrModules // 'models' => 0, // Set this to 1 if module has its own models directory (core/modules/xxx) // 'css' => array('/mymodule/css/mymodule.css.php'), // Set this to relative path of css file if module has its own css file // 'js' => array('/mymodule/js/mymodule.js'), // Set this to relative path of js file if module must load a js on all pages - // 'hooks' => array('hookcontext1','hookcontext2') // Set here all hooks context managed by module + // 'hooks' => array('hookcontext1','hookcontext2',...) // Set here all hooks context managed by module. You can also set hook context 'all' // 'dir' => array('output' => 'othermodulename'), // To force the default directories names // 'workflow' => array('WORKFLOW_MODULE1_YOURACTIONTYPE_MODULE2'=>array('enabled'=>'! empty($conf->module1->enabled) && ! empty($conf->module2->enabled)', 'picto'=>'yourpicto@mymodule')) // Set here all workflow context managed by module // ); @@ -105,9 +105,9 @@ class modMyModule extends DolibarrModules // Dependencies $this->hidden = false; // A condition to hide module - $this->depends = array(); // List of modules id that must be enabled if this module is enabled - $this->requiredby = array(); // List of modules id to disable if this one is disabled - $this->conflictwith = array(); // List of modules id this module is in conflict with + $this->depends = array(); // List of module class names as string that must be enabled if this module is enabled + $this->requiredby = array(); // List of module ids to disable if this one is disabled + $this->conflictwith = array(); // List of module class names as string this module is in conflict with $this->phpmin = array(5,0); // Minimum version of PHP required by module $this->need_dolibarr_version = array(3,0); // Minimum version of Dolibarr required by module $this->langfiles = array("mylangfile@mymodule"); @@ -180,8 +180,8 @@ class modMyModule extends DolibarrModules // Cronjobs $this->cronjobs = array(); // List of cron jobs entries to add - // Example: $this->cronjobs=array(0=>array('label'=>'My label', 'jobtype'=>'method', 'class'=>'/dir/class/file.class.php', 'objectname'=>'MyClass', 'method'=>'myMethod', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>2, 'unitfrequency'=>3600), - // 1=>array('label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>1, 'unitfrequency'=>3600*24) + // Example: $this->cronjobs=array(0=>array('label'=>'My label', 'jobtype'=>'method', 'class'=>'/dir/class/file.class.php', 'objectname'=>'MyClass', 'method'=>'myMethod', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>2, 'unitfrequency'=>3600, 'test'=>true), + // 1=>array('label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>1, 'unitfrequency'=>3600*24, 'test'=>true) // ); // Permissions @@ -241,7 +241,7 @@ class modMyModule extends DolibarrModules // $this->export_code[$r]=$this->rights_class.'_'.$r; // $this->export_label[$r]='MyModule'; // Translation key (used only if key ExportDataset_xxx_z not found) // $this->export_enabled[$r]='1'; // Condition to show export in list (ie: '$user->id==3'). Set to 1 to always show when module is enabled. - // $this->export_icon[$r]='generic:MyModule'; + // $this->export_icon[$r]='generic:MyModule'; // Put here code of icon then string for translation key of module name // $this->export_permission[$r]=array(array("mymodule","level1","level2")); // $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','s.fk_pays'=>'Country','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode','f.rowid'=>"InvoiceId",'f.facnumber'=>"InvoiceRef",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.total'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note'=>"InvoiceNote",'fd.rowid'=>'LineId','fd.description'=>"LineDescription",'fd.price'=>"LineUnitPrice",'fd.tva_tx'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.total_ht'=>"LineTotalHT",'fd.total_tva'=>"LineTotalTVA",'fd.total_ttc'=>"LineTotalTTC",'fd.date_start'=>"DateStart",'fd.date_end'=>"DateEnd",'fd.fk_product'=>'ProductId','p.ref'=>'ProductRef'); // $this->export_TypeFields_array[$r]=array('t.date'=>'Date', 't.qte'=>'Numeric', 't.poids'=>'Numeric', 't.fad'=>'Numeric', 't.paq'=>'Numeric', 't.stockage'=>'Numeric', 't.fadparliv'=>'Numeric', 't.livau100'=>'Numeric', 't.forfait'=>'Numeric', 's.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','s.tva_intra'=>'Text','f.facnumber'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.date_lim_reglement'=>"Date",'f.total'=>"Numeric",'f.total_ttc'=>"Numeric",'f.tva'=>"Numeric",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_private'=>"Text",'f.note_public'=>"Text",'fd.description'=>"Text",'fd.subprice'=>"Numeric",'fd.tva_tx'=>"Numeric",'fd.qty'=>"Numeric",'fd.total_ht'=>"Numeric",'fd.total_tva'=>"Numeric",'fd.total_ttc'=>"Numeric",'fd.date_start'=>"Date",'fd.date_end'=>"Date",'fd.special_code'=>'Numeric','fd.product_type'=>"Numeric",'fd.fk_product'=>'List:product:label','p.ref'=>'Text','p.label'=>'Text','p.accountancy_code_sell'=>'Text'); diff --git a/dev/skeletons/skeleton_api_class.class.php b/dev/skeletons/skeleton_api_class.class.php index 9cc8de2bc5e..a40b00af72c 100644 --- a/dev/skeletons/skeleton_api_class.class.php +++ b/dev/skeletons/skeleton_api_class.class.php @@ -93,12 +93,12 @@ class SkeletonApi extends DolibarrApi * @param string $sortorder Sort order * @param int $limit Limit for list * @param int $page Page number - * + * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101') or (t.import_key:=:'20160101')" * @return array Array of skeleton objects * * @url GET /skeletons/ */ - function getList($mode, $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0) { + function index($mode, $sortfield = "t.rowid", $sortorder = 'ASC', $limit = 0, $page = 0, $sqlfilters = '') { global $db, $conf; $obj_ret = array(); @@ -124,18 +124,19 @@ class SkeletonApi extends DolibarrApi if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= " AND s.fk_soc = sc.fk_soc"; if ($socid) $sql.= " AND s.fk_soc = ".$socid; if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc"; // Join for the needed table to filter by sale - // Insert sale filter if ($search_sale > 0) { $sql .= " AND sc.fk_user = ".$search_sale; } - - $nbtotalofrecords = 0; - if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) + if ($sqlfilters) { - $result = $db->query($sql); - $nbtotalofrecords = $db->num_rows($result); + if (! DolibarrApi::_checkFilters($sqlfilters)) + { + throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); + } + $regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; } $sql.= $db->order($sortfield, $sortorder); diff --git a/dev/skeletons/skeleton_card.php b/dev/skeletons/skeleton_card.php index 03f70955527..9adcdba87de 100644 --- a/dev/skeletons/skeleton_card.php +++ b/dev/skeletons/skeleton_card.php @@ -59,25 +59,27 @@ $myparam = GETPOST('myparam','alpha'); $search_field1=GETPOST("search_field1"); $search_field2=GETPOST("search_field2"); +if (empty($action) && empty($id) && empty($ref)) $action='view'; + // Protection if external user if ($user->societe_id > 0) { //accessforbidden(); } +//$result = restrictedArea($user, 'mymodule', $id); -if (empty($action) && empty($id) && empty($ref)) $action='list'; -// Load object if id or ref is provided as parameter -$object=new Skeleton_Class($db); -if (($id > 0 || ! empty($ref)) && $action != 'add') -{ - $result=$object->fetch($id,$ref); - if ($result < 0) dol_print_error($db); -} +$object = new Skeleton_Class($db); +$extrafields = new ExtraFields($db); + +// fetch optionals attributes and labels +$extralabels = $extrafields->fetch_name_optionals_label($object->table_element); + +// Load object +include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals // Initialize technical object to manage hooks of modules. Note that conf->hooks_modules contains array array $hookmanager->initHooks(array('skeleton')); -$extrafields = new ExtraFields($db); @@ -281,8 +283,13 @@ if (($id || $ref) && $action == 'edit') // Part to show record -if ($id && (empty($action) || $action == 'view' || $action == 'delete')) +if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'))) { + $res = $object->fetch_optionals($object->id, $extralabels); + + $head = commande_prepare_head($object); + dol_fiche_head($head, 'order', $langs->trans("CustomerOrder"), 0, 'order'); + print load_fiche_titre($langs->trans("MyModule")); dol_fiche_head(); @@ -293,7 +300,7 @@ if ($id && (empty($action) || $action == 'view' || $action == 'delete')) } print ''."\n"; - // print ''; + // print ''; // LIST_OF_TD_LABEL_FIELDS_VIEW print '
'.$langs->trans("Label").'
'.$langs->trans("Label").''.$object->label.'
'; @@ -322,9 +329,9 @@ if ($id && (empty($action) || $action == 'view' || $action == 'delete')) // Example 2 : Adding links to objects - //$somethingshown=$form->showLinkedObjectBlock($object); - //$linktoelem = $form->showLinkToObjectBlock($object); - //if ($linktoelem) print '
'.$linktoelem; + // Show links to link elements + //$linktoelem = $form->showLinkToObjectBlock($object, null, array('skeleton')); + //$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem); } diff --git a/dev/skeletons/skeleton_class.class.php b/dev/skeletons/skeleton_class.class.php index 2858e791ce8..4f725fa2dbe 100644 --- a/dev/skeletons/skeleton_class.class.php +++ b/dev/skeletons/skeleton_class.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2014 Juanjo Menent + * Copyright (C) 2014-2016 Juanjo Menent * Copyright (C) 2015 Florian Henry * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) ---Put here your own copyright and developer email--- @@ -35,6 +35,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/commonobject.class.php'; * Class Skeleton_Class * * Put here description of your class + * * @see CommonObject */ class Skeleton_Class extends CommonObject @@ -116,7 +117,7 @@ class Skeleton_Class extends CommonObject if (!$resql) { $error ++; $this->errors[] = 'Error ' . $this->db->lasterror(); - dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR); + dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR); } if (!$error) { @@ -163,10 +164,14 @@ class Skeleton_Class extends CommonObject $sql .= ' t.field2'; //... $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t'; + $sql.= ' WHERE 1 = 1'; + if (! empty($conf->multicompany->enabled)) { + $sql .= " AND entity IN (" . getEntity("skeleton", 1) . ")"; + } if (null !== $ref) { - $sql .= ' WHERE t.ref = ' . '\'' . $ref . '\''; + $sql .= ' AND t.ref = ' . '\'' . $ref . '\''; } else { - $sql .= ' WHERE t.rowid = ' . $id; + $sql .= ' AND t.rowid = ' . $id; } $resql = $this->db->query($sql); @@ -180,6 +185,16 @@ class Skeleton_Class extends CommonObject $this->prop2 = $obj->field2; //... } + + // Retrieve all extrafields for invoice + // fetch optionals attributes and labels + require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; + $extrafields=new ExtraFields($this->db); + $extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true); + $this->fetch_optionals($this->id,$extralabels); + + // $this->fetch_lines(); + $this->db->free($resql); if ($numrows) { @@ -189,7 +204,7 @@ class Skeleton_Class extends CommonObject } } else { $this->errors[] = 'Error ' . $this->db->lasterror(); - dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR); + dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR); return - 1; } @@ -225,16 +240,20 @@ class Skeleton_Class extends CommonObject $sqlwhere [] = $key . ' LIKE \'%' . $this->db->escape($value) . '%\''; } } - if (count($sqlwhere) > 0) { - $sql .= ' WHERE ' . implode(' '.$filtermode.' ', $sqlwhere); + $sql.= ' WHERE 1 = 1'; + if (! empty($conf->multicompany->enabled)) { + $sql .= " AND entity IN (" . getEntity("skeleton", 1) . ")"; + } + if (count($sqlwhere) > 0) { + $sql .= ' AND ' . implode(' '.$filtermode.' ', $sqlwhere); } - if (!empty($sortfield)) { $sql .= $this->db->order($sortfield,$sortorder); } if (!empty($limit)) { $sql .= ' ' . $this->db->plimit($limit + 1, $offset); } + $this->lines = array(); $resql = $this->db->query($sql); @@ -256,7 +275,7 @@ class Skeleton_Class extends CommonObject return $num; } else { $this->errors[] = 'Error ' . $this->db->lasterror(); - dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR); + dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR); return - 1; } @@ -301,7 +320,7 @@ class Skeleton_Class extends CommonObject if (!$resql) { $error ++; $this->errors[] = 'Error ' . $this->db->lasterror(); - dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR); + dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR); } if (!$error && !$notrigger) { @@ -354,6 +373,8 @@ class Skeleton_Class extends CommonObject } } + // If you need to delete child tables to, you can insert them here + if (!$error) { $sql = 'DELETE FROM ' . MAIN_DB_PREFIX . $this->table_element; $sql .= ' WHERE rowid=' . $this->id; @@ -362,7 +383,7 @@ class Skeleton_Class extends CommonObject if (!$resql) { $error ++; $this->errors[] = 'Error ' . $this->db->lasterror(); - dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR); + dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR); } } @@ -410,7 +431,7 @@ class Skeleton_Class extends CommonObject if ($result < 0) { $error ++; $this->errors = $object->errors; - dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR); + dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR); } // End @@ -426,44 +447,58 @@ class Skeleton_Class extends CommonObject } /** - * Return a link to the user card (with optionaly the picto) - * Use this->id,this->lastname, this->firstname + * Return a link to the object card (with optionaly the picto) * * @param int $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto) * @param string $option On what the link point to - * @param integer $notooltip 1=Disable tooltip + * @param int $notooltip 1=Disable tooltip * @param int $maxlen Max length of visible user name * @param string $morecss Add more css on link * @return string String with URL */ function getNomUrl($withpicto=0, $option='', $notooltip=0, $maxlen=24, $morecss='') { - global $langs, $conf, $db; + global $db, $conf, $langs; global $dolibarr_main_authentication, $dolibarr_main_demo; global $menumanager; - + if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips + $result = ''; $companylink = ''; $label = '' . $langs->trans("MyModule") . ''; - $label.= '
'; + $label.= '
'; $label.= '' . $langs->trans('Ref') . ': ' . $this->ref; - $link = 'table_name.'_card.php?id='.$this->id; + + $linkclose=''; + if (empty($notooltip)) + { + if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) + { + $label=$langs->trans("ShowProject"); + $linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"'; + } + $linkclose.=' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose.=' class="classfortooltip'.($morecss?' '.$morecss:'').'"'; + } + else $linkclose = ($morecss?' class="'.$morecss.'"':''); + + $linkstart = ''; $linkend=''; if ($withpicto) { - $result.=($link.img_object(($notooltip?'':$label), 'label', ($notooltip?'':'class="classfortooltip"')).$linkend); + $result.=($linkstart.img_object(($notooltip?'':$label), 'label', ($notooltip?'':'class="classfortooltip"')).$linkend); if ($withpicto != 2) $result.=' '; } - $result.= $link . $this->ref . $linkend; + $result.= $linkstart . $this->ref . $linkend; return $result; } - + /** * Retourne le libelle du status d'un user (actif, inactif) * @@ -476,13 +511,13 @@ class Skeleton_Class extends CommonObject } /** - * Renvoi le libelle d'un status donne + * Return the status * * @param int $status Id status - * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto + * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 5=Long label + Picto * @return string Label of status */ - function LibStatut($status,$mode=0) + static function LibStatut($status,$mode=0) { global $langs; @@ -517,9 +552,14 @@ class Skeleton_Class extends CommonObject if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4'); if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5'); } + if ($mode == 6) + { + if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4'); + if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5'); + } } - - + + /** * Initialise object with example values * Id must be 0 if object instance is a specimen diff --git a/dev/skeletons/skeleton_list.php b/dev/skeletons/skeleton_list.php index f1413bb3712..7715b17b4d8 100644 --- a/dev/skeletons/skeleton_list.php +++ b/dev/skeletons/skeleton_list.php @@ -1,6 +1,6 @@ - * Copyright (C) ---Put here your own copyright and developer email--- + * Copyright (C) 2014-2016 Juanjo Menent * * 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 @@ -91,30 +91,38 @@ $extrafields = new ExtraFields($db); $extralabels = $extrafields->fetch_name_optionals_label('mymodule'); $search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_'); -// Load object if id or ref is provided as parameter -$object=new Skeleton_Class($db); -if (($id > 0 || ! empty($ref)) && $action != 'add') -{ - $result=$object->fetch($id,$ref); - if ($result < 0) dol_print_error($db); -} +// List of fields to search into when doing a "search in all" +$fieldstosearchall = array( + 't.ref'=>'Ref', + 't.note_public'=>'NotePublic', +); +if (empty($user->socid)) $fieldstosearchall["t.note_private"]="NotePrivate"; // Definition of fields for list $arrayfields=array( 't.field1'=>array('label'=>$langs->trans("Field1"), 'checked'=>1), 't.field2'=>array('label'=>$langs->trans("Field2"), 'checked'=>1), //'t.entity'=>array('label'=>$langs->trans("Entity"), 'checked'=>1, 'enabled'=>(! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode))), - 't.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), + 't.datec'=>array('label'=>$langs->trans("DateCreationShort"), 'checked'=>0, 'position'=>500), 't.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500), //'t.statut'=>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]); - } + 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]); + } +} + + +// Load object if id or ref is provided as parameter +$object=new Skeleton_Class($db); +if (($id > 0 || ! empty($ref)) && $action != 'add') +{ + $result=$object->fetch($id,$ref); + if ($result < 0) dol_print_error($db); } @@ -127,7 +135,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab ********************************************************************/ if (GETPOST('cancel')) { $action='list'; $massaction=''; } -if (! GETPOST('confirmmassaction')) { $massaction=''; } +if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; } $parameters=array(); $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks @@ -135,65 +143,46 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e 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 { $search_field1=''; $search_field2=''; $search_date_creation=''; $search_date_update=''; - $search_array_options=array(); + $toselect=''; + $search_array_options=array(); } if (empty($reshook)) { - // Mass actions. Controls on number of lines checked - $maxformassaction=1000; - if (! empty($massaction) && count($toselect) < 1) - { - $error++; - setEventMessages($langs->trans("NoLineChecked"), null, "warnings"); - } - if (! $error && count($toselect) > $maxformassaction) - { - setEventMessages($langs->trans('TooManyRecordForMassAction',$maxformassaction), null, 'errors'); - $error++; - } - - // Action to delete - if ($action == 'confirm_delete') - { - $result=$object->delete($user); - if ($result > 0) - { - // Delete OK - setEventMessages("RecordDeleted", null, 'mesgs'); - header("Location: ".dol_buildpath('/mymodule/list.php',1)); - exit; - } - else - { - if (! empty($object->errors)) setEventMessages(null,$object->errors,'errors'); - else setEventMessages($object->error,null,'errors'); - } - } + $objectclass='Skeleton'; + $objectlabel='Skeleton'; + $permtoread = $user->rights->skeleton->read; + $permtodelete = $user->rights->skeleton->delete; + $uploaddir = $conf->skeleton->dir_output; + include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; } - /*************************************************** * VIEW * * Put here all code to build page ****************************************************/ -llxHeader('','MyPageName',''); +$now=dol_now(); $form=new Form($db); -// Put here content of your page +//$help_url="EN:Module_Customers_Orders|FR:Module_Commandes_Clients|ES:Módulo_Pedidos_de_clientes"; +$help_url=''; $title = $langs->trans('MyModuleListTitle'); +llxHeader('', $title, $help_url); + +// Put here content of your page // Example : Adding jquery code print ''; - -$sql = "SELECT p.rowid, p.ref , p.label, p.description , p.accountancy_code_sell, p.accountancy_code_buy, p.tms, p.fk_product_type as product_type"; -$sql .= " FROM " . MAIN_DB_PREFIX . "product as p"; -$sql .= " WHERE ("; +llxHeader('', $langs->trans("ProductsBinding")); $pcgver = $conf->global->CHARTOFACCOUNTS; +$sql = "SELECT p.rowid, p.ref, p.label, p.description , p.accountancy_code_sell, p.accountancy_code_buy, p.tms, p.fk_product_type as product_type"; +$sql .= " FROM " . MAIN_DB_PREFIX . "product as p"; +$sql .= " WHERE ("; if ($accounting_product_mode == 'ACCOUNTANCY_BUY' ? ' checked' : '') { $sql .= " p.accountancy_code_buy ='' OR p.accountancy_code_buy IS NULL"; $sql .= " OR (p.accountancy_code_buy IS NOT NULL AND p.accountancy_code_buy != '' AND p.accountancy_code_buy NOT IN @@ -218,64 +203,88 @@ if ($accounting_product_mode == 'ACCOUNTANCY_BUY' ? ' checked' : '') { $sql .= " OR (p.accountancy_code_sell IS NOT NULL AND p.accountancy_code_sell != '' AND p.accountancy_code_sell NOT IN (SELECT aa.account_number FROM " . MAIN_DB_PREFIX . "accounting_account as aa , " . MAIN_DB_PREFIX . "accounting_system as asy WHERE fk_pcg_version = asy.pcg_version AND asy.rowid = " . $pcgver . "))"; } - $sql .= ")"; - +if (! empty($conf->multicompany->enabled)) { + $sql.= ' AND p.entity IN ('.getEntity('product', 1).')'; +} // Add search filter like if (strlen(trim($search_ref))) { - $sql .= " AND (p.ref like '" . $search_ref . "%')"; + $sql .= natural_search("p.ref",$search_ref); } if (strlen(trim($search_label))) { - $sql .= " AND (p.label like '" . $search_label . "%')"; + $sql .= natural_search("p.label",$search_label); } if (strlen(trim($search_desc))) { - $sql .= " AND (p.description like '%" . $search_desc . "%')"; + $sql .= natural_search("p.description",$search_desc); } $sql .= $db->order($sortfield, $sortorder); - +$nbtotalofrecords = 0; +if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) +{ + $result = $db->query($sql); + $nbtotalofrecords = $db->num_rows($result); +} $sql .= $db->plimit($limit + 1, $offset); dol_syslog("/accountancy/admin/productaccount.php:: sql=" . $sql, LOG_DEBUG); $result = $db->query($sql); -if ($result) { - $num_lines = $db->num_rows($result); +if ($result) +{ + $num = $db->num_rows($result); $i = 0; - print_barre_liste($langs->trans("ModulesSystemTools"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, '', $num_lines); + $param=''; + if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; + if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; + if ($search_ref > 0) $param.="&search_desc=".urlencode($search_ref); + if ($search_label > 0) $param.="&search_desc=".urlencode($search_label); + if ($search_desc > 0) $param.="&search_desc=".urlencode($search_desc); + + print '
'; + if ($optioncss != '') print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + + print load_fiche_titre($langs->trans("ProductsBinding"), '', 'title_accountancy'); print '
'; print $langs->trans("InitAccountancyDesc") . '
'; print '
'; - print ''; - print ''; - print ''; - + // Select mode print ''; print ''; print ''; print "\n"; - print ''; + print ''; print '\n"; - print ''; + print ''; print '\n"; print "
' . $langs->trans('Options') . '' . $langs->trans('Description') . '
' . $langs->trans('OptionModeProductSell') . '
' . $langs->trans('OptionModeProductSell') . '' . nl2br($langs->trans('OptionModeProductSellDesc')); print "
' . $langs->trans('OptionModeProductBuy') . '
' . $langs->trans('OptionModeProductBuy') . '' . nl2br($langs->trans('OptionModeProductBuyDesc')) . "
\n"; print '
'; - print "

\n"; + print "
\n"; + - if (! empty($msg)) { - print $msg; - } + // Filter on categories + $moreforfilter=''; + $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; + $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields - print ''; + $texte=$langs->trans("ListOfProductsWithoutAccountingAccount"); + print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, '', 0, '', '', $limit); + + print '
'; print ''; print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder); + if (! empty($conf->global->ACCOUNTANCY_SHOW_PROD_DESC)) print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "p.description", "", $param, '', $sortfield, $sortorder); /* if ($accounting_product_mode == 'ACCOUNTANCY_BUY') { print_liste_field_titre($langs->trans("Accountancy_code_buy")); @@ -284,25 +293,25 @@ if ($result) { } */ print_liste_field_titre($langs->trans("AccountAccounting")); - print_liste_field_titre($langs->trans("Modify") . '
/ ', '', '', '', '', 'align="center"'); + //print_liste_field_titre($langs->trans("Modify") . '
/ ', '', '', '', '', 'align="center"'); + print_liste_field_titre('', '', '', '', '', 'align="center"'); print ''; print ''; - print ''; - print ''; - print ''; - - print ''; - print ''; + print ''; + print ''; + if (! empty($conf->global->ACCOUNTANCY_SHOW_PROD_DESC)) print ''; + print ''; print ''; $var = true; - while ( $i < min($num_lines, 250) ) { + while ($i < min($num,$limit)) + { $obj = $db->fetch_object($result); $var = ! $var; @@ -331,23 +340,33 @@ if ($result) { print ''; print ""; - print ''; + + print ''; + // Ref produit as link $product_static->ref = $obj->ref; $product_static->id = $obj->rowid; $product_static->type = $obj->type; + $product_static->label = $obj->label; + $product_static->description = $obj->description; + print ''; - print ''; - // TODO ADJUST DESCRIPTION SIZE - // print ''; - // TODO: we shoul set a user defined value to adjust user square / wide screen size - $trunclengh = defined('ACCOUNTING_LENGTH_DESCRIPTION') ? ACCOUNTING_LENGTH_DESCRIPTION : 64; - print ''; + + print ''; + + if (! empty($conf->global->ACCOUNTANCY_SHOW_PROD_DESC)) + { + // TODO ADJUST DESCRIPTION SIZE + // print ''; + // TODO: we shoul set a user defined value to adjust user square / wide screen size + $trunclengh = defined('ACCOUNTING_LENGTH_DESCRIPTION') ? ACCOUNTING_LENGTH_DESCRIPTION : 64; + print ''; + } // Accounting account buy if ($accounting_product_mode == 'ACCOUNTANCY_BUY') { @@ -371,14 +390,15 @@ if ($result) { } // Checkbox select - print ''; - + print ''; print ""; $i ++; } print '
 '; - print ''; - print ' '; - print ''; + print ' '; + $searchpitco=$form->showFilterAndCheckAddButtons(1, 'checkforselect', 1); + print $searchpitco; print '
'; if ($product_static->id) print $product_static->getNomUrl(1); else print '- '; print '' . dol_trunc($obj->label, 24) . '' . $obj->description . '' . nl2br(dol_trunc($obj->description, $trunclengh)) . ''.$obj->label.'' . $obj->description . '' . nl2br(dol_trunc($obj->description, $trunclengh)) . ''; - print ''; + print '
'; - print '
'; + + print '
'; + print '
'; $db->free($result); diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php index 736aec48644..79d642ffcef 100644 --- a/htdocs/accountancy/bookkeeping/balance.php +++ b/htdocs/accountancy/bookkeeping/balance.php @@ -23,6 +23,7 @@ * \ingroup Advanced accountancy * \brief Balance of book keeping */ + require '../../main.inc.php'; // Class @@ -64,7 +65,7 @@ $formventilation = new FormVentilation($db); $formother = new FormOther($db); $form = new Form($db); -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_accountancy_code_start = ''; $search_accountancy_code_end = ''; @@ -152,7 +153,7 @@ else { setEventMessages($object->error, $object->errors, 'errors'); } - print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $options, $sortfield, $sortorder, '', $result); + print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $options, $sortfield, $sortorder, '', $result, 0, 'title_accountancy'); print '
'; print '
' . "\n"; @@ -180,12 +181,12 @@ else { print ''; print ''; - print_liste_field_titre($langs->trans("AccountAccountingShort"), $_SERVER['PHP_SELF'], "t.numero_compte", "", $options, "", $sortfield, $sortorder); + print_liste_field_titre($langs->trans("AccountAccounting"), $_SERVER['PHP_SELF'], "t.numero_compte", "", $options, "", $sortfield, $sortorder); print_liste_field_titre($langs->trans("Labelcompte"), $_SERVER['PHP_SELF'], "t.label_compte", "", $options, "", $sortfield, $sortorder); print_liste_field_titre($langs->trans("Debit"), $_SERVER['PHP_SELF'], "t.debit", "", $options, 'align="right"', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Credit"), $_SERVER['PHP_SELF'], "t.credit", "", $options, 'align="right"', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Solde"), $_SERVER["PHP_SELF"], "", $options, "", 'width="60" align="center"', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Action"), $_SERVER["PHP_SELF"], "", $options, "", 'width="60" align="center"', $sortfield, $sortorder); + print_liste_field_titre($langs->trans("Solde"), $_SERVER["PHP_SELF"], "", $options, "", 'align="right"', $sortfield, $sortorder); + print_liste_field_titre('', $_SERVER["PHP_SELF"], "", $options, "", 'width="60" align="center"', $sortfield, $sortorder); print "\n"; print ''; @@ -213,6 +214,9 @@ else { $total_debit = 0; $total_credit = 0; + $sous_total_debit = 0; + $sous_total_credit = 0; + $displayed_account = ""; foreach ( $object->lines as $line ) { $var = ! $var; @@ -220,33 +224,59 @@ else { $total_debit += $line->debit; $total_credit += $line->credit; $description = $object->get_compte_desc($line->numero_compte); // Search description of the account + $root_account_description = $object->get_compte_racine($line->numero_compte); if(empty($description)){ $link = '' . img_edit_add() .''; } print ''; + + // Permet d'afficher le compte comptable + if ($root_account_description != $displayed_account) { + + // Affiche un Sous-Total par compte comptable + if ($displayed_account != "") { + print ''; + print "\n"; + print ''; + } + + // Affiche le compte comptable en d�but de ligne + print ""; + print ''; + print ''; + + $displayed_account = $root_account_description; + $sous_total_debit = 0; + $sous_total_credit = 0; + } + + // $object->get_compte_racine($line->numero_compte); + + print ''; print ''; print ''; - print ''; - print ''; + print ''; + print ''; print ''; print "\n"; + + // Comptabilise le sous-total + $sous_total_debit += $line->debit; + $sous_total_credit += $line->credit; + } - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print "\n"; + print ''; + + print ''; + print "\n"; + print ''; + print "
'.$langs->trans("SubTotal") . ':'.price($sous_total_debit).''.price($sous_total_credit).''.price($sous_total_credit-$sous_total_debit).' 
'. $root_account_description .'
' . length_accountg($line->numero_compte) . '' . $description . '' . number_format($line->debit, 2, ',', ' ') . '' . number_format($line->credit, 2, ',', ' ') . '' . number_format($line->credit - $line->debit, 2, ',', ' ') . '' . number_format($line->credit, 2, ',', ' ') . '' . number_format($line->credit - $line->debit, 2, ',', ' ') . '' . $link; print '
'; - print price($total_debit); - print ''; - print price($total_credit); - print '' . price($total_credit - $total_debit) . '
'.$langs->trans("SubTotal") . ':'.price($sous_total_debit).''.price($sous_total_credit).''.price($sous_total_credit-$sous_total_debit).' 
'.$langs->trans("AccountBalance") . ':'.price($total_debit).''.price($total_credit).''.price($total_credit-$total_debit).' 
"; print ''; diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index 7293797ecc6..9d054dc3c2c 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -18,9 +18,9 @@ */ /** - * \file htdocs/accountancy/bookkeeping/card.php - * \ingroup Advanced accountancy - * \brief Page to show book-entry + * \file htdocs/accountancy/bookkeeping/card.php + * \ingroup Advanced accountancy + * \brief Page to show book-entry */ require '../../main.inc.php'; @@ -62,17 +62,17 @@ if (! empty($update)) { } if ($action == "confirm_update") { - + $error = 0; - + if ((floatval($debit) != 0.0) && (floatval($credit) != 0.0)) { setEventMessages($langs->trans('ErrorDebitCredit'), null, 'errors'); $error ++; } - + if (empty($error)) { $book = new BookKeeping($db); - + $result = $book->fetch($id); if ($result < 0) { setEventMessages($book->error, $book->errors, 'errors'); @@ -82,7 +82,7 @@ if ($action == "confirm_update") { $book->label_compte = $label_compte; $book->debit = $debit; $book->credit = $credit; - + if (floatval($debit) != 0.0) { $book->montant = $debit; $book->sens = 'D'; @@ -91,7 +91,7 @@ if ($action == "confirm_update") { $book->montant = $credit; $book->sens = 'C'; } - + $result = $book->update($user); if ($result < 0) { setEventMessages($book->error, $book->errors, 'errors'); @@ -101,19 +101,19 @@ if ($action == "confirm_update") { } } } -} +} else if ($action == "add") { $error = 0; - + if ((floatval($debit) != 0.0) && (floatval($credit) != 0.0)) { setEventMessages($langs->trans('ErrorDebitCredit'), null, 'errors'); $error ++; } - + if (empty($error)) { $book = new BookKeeping($db); - + $book->numero_compte = $account_number; $book->code_tiers = $code_tiers; $book->label_compte = $label_compte; @@ -126,17 +126,17 @@ else if ($action == "add") { $book->code_journal = GETPOST('code_journal'); $book->fk_doc = GETPOST('fk_doc'); $book->fk_docdet = GETPOST('fk_docdet'); - + if (floatval($debit) != 0.0) { $book->montant = $debit; $book->sens = 'D'; } - + if (floatval($credit) != 0.0) { $book->montant = $credit; $book->sens = 'C'; } - + $result = $book->createStd($user); if ($result < 0) { setEventMessages($book->error, $book->errors, 'errors'); @@ -145,15 +145,15 @@ else if ($action == "add") { $action = ''; } } -} +} else if ($action == "confirm_delete") { $book = new BookKeeping($db); - + $result = $book->fetch($id); - + $piece_num = $book->piece_num; - + if ($result < 0) { setEventMessages($book->error, $book->errors, 'errors'); } else { @@ -163,31 +163,42 @@ else if ($action == "confirm_delete") { } } $action = ''; -} +} else if ($action == "confirm_create") { - $book = new BookKeeping($db); + $error = 0; + + $book = new BookKeeping($db); + + if (! GETPOST('next_num_mvt')) + { + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("NumPiece")), null, 'errors'); + $error++; + } - $book->label_compte = ''; - $book->debit = 0; - $book->credit = 0; - $book->doc_date = $date_start = dol_mktime(0, 0, 0, GETPOST('doc_datemonth'), GETPOST('doc_dateday'), GETPOST('doc_dateyear')); - $book->doc_type = GETPOST('doc_type'); - $book->piece_num = GETPOST('next_num_mvt'); - $book->doc_ref = GETPOST('doc_ref'); - $book->code_journal = GETPOST('code_journal'); - $book->fk_doc = 0; - $book->fk_docdet = 0; - - $book->montant = 0; - - $result = $book->createStd($user); - if ($result < 0) { - setEventMessages($book->error, $book->errors, 'errors'); - } else { - setEventMessages($langs->trans('Saved'), null, 'mesgs'); - $action = ''; - $piece_num = $book->piece_num; + if (! $error) + { + $book->label_compte = ''; + $book->debit = 0; + $book->credit = 0; + $book->doc_date = $date_start = dol_mktime(0, 0, 0, GETPOST('doc_datemonth'), GETPOST('doc_dateday'), GETPOST('doc_dateyear')); + $book->doc_type = GETPOST('doc_type'); + $book->piece_num = GETPOST('next_num_mvt'); + $book->doc_ref = GETPOST('doc_ref'); + $book->code_journal = GETPOST('code_journal'); + $book->fk_doc = 0; + $book->fk_docdet = 0; + + $book->montant = 0; + + $result = $book->createStd($user); + if ($result < 0) { + setEventMessages($book->error, $book->errors, 'errors'); + } else { + setEventMessages($langs->trans('Saved'), null, 'mesgs'); + $action = ''; + $piece_num = $book->piece_num; + } } } @@ -209,15 +220,15 @@ if ($action == 'delete') { if ($action == 'create') { print load_fiche_titre($langs->trans("CreateMvts")); - + $code_journal_array = array ( $conf->global->ACCOUNTING_SELL_JOURNAL => $conf->global->ACCOUNTING_SELL_JOURNAL, $conf->global->ACCOUNTING_PURCHASE_JOURNAL => $conf->global->ACCOUNTING_PURCHASE_JOURNAL, $conf->global->ACCOUNTING_SOCIAL_JOURNAL => $conf->global->ACCOUNTING_SOCIAL_JOURNAL, $conf->global->ACCOUNTING_MISCELLANEOUS_JOURNAL => $conf->global->ACCOUNTING_MISCELLANEOUS_JOURNAL, - $conf->global->ACCOUNTING_EXPENSEREPORT_JOURNAL => $conf->global->ACCOUNTING_EXPENSEREPORT_JOURNAL + $conf->global->ACCOUNTING_EXPENSEREPORT_JOURNAL => $conf->global->ACCOUNTING_EXPENSEREPORT_JOURNAL ); - + $sql = 'SELECT DISTINCT accountancy_journal FROM ' . MAIN_DB_PREFIX . 'bank_account WHERE clos=0'; $resql = $db->query($sql); if (! $resql) { @@ -229,52 +240,56 @@ if ($action == 'create') { } } } - + $book = new BookKeeping($db); $next_num_mvt = $book->getNextNumMvt(); - + if (empty($next_num_mvt)) + { + dol_print_error('', 'Failed to get next piece number'); + } + print '
'; print '' . "\n"; print '' . "\n"; - + dol_fiche_head(); - + print ''; print ''; - print ''; + print ''; print ''; print ''; - + print ''; - print ''; + print ''; print ''; print ''; - + print ''; - print ''; + print ''; print ''; print ''; - + print ''; print ''; print ''; print ''; - + print ''; print ''; print ''; print ''; - + print '
' . $langs->trans("NumMvts") . '' . $langs->trans("NumPiece") . '' . $next_num_mvt . '
' . $langs->trans("Docdate") . '' . $langs->trans("Docdate") . ''; print $html->select_date('', 'doc_date', '', '', '', "create_mvt", 1, 1); print '
' . $langs->trans("Codejournal") . '' . $langs->trans("Codejournal") . '' . $html->selectarray('code_journal', $code_journal_array) . '
' . $langs->trans("Docref") . '
' . $langs->trans("Doctype") . '
'; - + dol_fiche_end(); - + print '
'; print '     '; print '
'; - + print '
'; } else { $book = new BookKeeping($db); @@ -283,12 +298,14 @@ if ($action == 'create') { setEventMessages($book->error, $book->errors, 'errors'); } if (! empty($book->piece_num)) { - + print load_fiche_titre($langs->trans("UpdateMvts"), '' . $langs->trans('BackToList') . ''); + + dol_fiche_head(); print ''; print ''; - print ''; + print ''; print ''; print ''; print ''; @@ -308,15 +325,18 @@ if ($action == 'create') { print ''; print ''; print '
' . $langs->trans("NumMvts") . '' . $langs->trans("NumMvts") . '' . $book->piece_num . '
' . $book->doc_type . '
'; - print '
'; + + dol_fiche_end(); + + print '
'; $result = $book->fetch_all_per_mvt($piece_num); if ($result < 0) { setEventMessages($book->error, $book->errors, 'errors'); } else { - - print load_fiche_titre($langs->trans("ListeMvts")); - + + print load_fiche_titre($langs->trans("ListeMvts"), '', ''); + print '
'; print '' . "\n"; print '' . "\n"; @@ -324,15 +344,15 @@ if ($action == 'create') { print '' . "\n"; print '' . "\n"; print '' . "\n"; - + print ""; if (count($book->linesmvt) > 0) { - + $total_debit = 0; $total_credit = 0; - + print ''; - + print_liste_field_titre($langs->trans("AccountAccountingShort")); print_liste_field_titre($langs->trans("Code_tiers")); print_liste_field_titre($langs->trans("Labelcompte")); @@ -341,18 +361,18 @@ if ($action == 'create') { print_liste_field_titre($langs->trans("Amount"), "", "", "", "", 'align="center"'); print_liste_field_titre($langs->trans("Sens"), "", "", "", "", 'align="center"'); print_liste_field_titre($langs->trans("Action"), "", "", "", "", 'width="60" align="center"'); - + print "\n"; - + foreach ( $book->linesmvt as $line ) { $var = ! $var; - print ''; - + print ''; + $total_debit += $line->debit; $total_credit += $line->credit; - + if ($action == 'update' && $line->id == $id) { - + print ''; @@ -376,7 +396,7 @@ if ($action == 'create') { print ''; print ''; print ''; - + print ''; } print "\n"; } - - if ($total_debit != $total_credit) { - setEventMessages(null, array ( - 'MvtNotCorrectlyBalanced', - $total_credit, - $total_debit - ), 'errors'); + + if ($total_debit != $total_credit) + { + setEventMessages(null, array($langs->trans('MvtNotCorrectlyBalanced', $total_credit, $total_debit)), 'warnings'); } - + if ($action == "" || $action == 'add') { $var = ! $var; - print ''; + print ''; print ''; @@ -412,7 +429,7 @@ if ($action == 'create') { print ''; print ''; print ''; - print ''; + print ''; print ''; } print '
'; print $formventilation->select_account($line->numero_compte, 'account_number', 0, array (), 1, 1, ''); print '' . price($line->credit) . '' . price($line->montant) . '' . $line->sens . ''; print ''; print img_edit(); @@ -384,23 +404,20 @@ if ($action == 'create') { print ''; print img_delete(); print ''; - + print '
'; print $formventilation->select_account($account_number, 'account_number', 0, array (), 1, 1, ''); print '
'; diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index cb5d7caf006..f925bf4e4eb 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -1,7 +1,8 @@ - * Copyright (C) 2013-2016 Florian Henry - * Copyright (C) 2013-2016 Alexandre Spangaro +/* Copyright (C) 2013-2016 Olivier Geffroy + * Copyright (C) 2013-2016 Florian Henry + * Copyright (C) 2013-2016 Alexandre Spangaro + * Copyright (C) 2016 Laurent Destailleur * * 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 @@ -19,8 +20,8 @@ */ /** - * \file htdocs/accountancy/bookkeeping/list.php - * \ingroup Advanced accountancy + * \file htdocs/accountancy/bookkeeping/list.php + * \ingroup Advanced accountancy * \brief List operation of book keeping */ require '../../main.inc.php'; @@ -77,9 +78,18 @@ $search_mvt_label = GETPOST('search_mvt_label', 'alpha'); $search_direction = GETPOST('search_direction', 'alpha'); $search_ledger_code = GETPOST('search_ledger_code', 'alpha'); -$limit = GETPOST('limit') ? GETPOST('limit', 'int') : $conf->liste_limit; - +// Load variable for pagination +$limit = GETPOST('limit') ? GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)?$conf->liste_limit:$conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION); +$sortfield = GETPOST('sortfield', 'alpha'); +$sortorder = GETPOST('sortorder', 'alpha'); +$page = GETPOST('page','int'); +if ($page < 0) { $page = 0; } $offset = $limit * $page; +$pageprev = $page - 1; +$pagenext = $page + 1; +if ($sortorder == "") $sortorder = "ASC"; +if ($sortfield == "") $sortfield = "t.rowid"; + $object = new BookKeeping($db); @@ -88,86 +98,22 @@ $formother = new FormOther($db); $form = new Form($db); +if ($action != 'export_csv' && ! isset($_POST['begin']) && ! isset($_GET['begin']) && ! isset($_POST['formfilteraction'])) { + $search_date_start = dol_mktime(0, 0, 0, 1, 1, dol_print_date(dol_now(), '%Y')); + $search_date_end = dol_mktime(0, 0, 0, 12, 31, dol_print_date(dol_now(), '%Y')); +} -if (empty($search_date_start)) { - $search_date_start = dol_mktime(0, 0, 0, 1, 1, dol_print_date(dol_now(), '%Y')); - $search_date_end = dol_mktime(0, 0, 0, 12, 31, dol_print_date(dol_now(), '%Y')); -} -if ($sortorder == "") - $sortorder = "ASC"; -if ($sortfield == "") - $sortfield = "t.rowid"; - -$options = ''; -$filter = array (); -if (! empty($search_date_start)) { - $filter['t.doc_date>='] = $search_date_start; - $options .= '&date_startmonth=' . GETPOST('date_startmonth', 'int') . '&date_startday=' . GETPOST('date_startday', 'int') . '&date_startyear=' . GETPOST('date_startyear', 'int'); -} -if (! empty($search_date_end)) { - $filter['t.doc_date<='] = $search_date_end; - $options .= '&date_endmonth=' . GETPOST('date_endmonth', 'int') . '&date_endday=' . GETPOST('date_endday', 'int') . '&date_endyear=' . GETPOST('date_endyear', 'int'); -} -if (! empty($search_doc_type)) { - $filter['t.doc_type'] = $search_doc_type; - $options .= '&search_doc_type=' . $search_doc_type; -} -if (! empty($search_doc_date)) { - $filter['t.doc_date'] = $search_doc_date; - $options .= '&doc_datemonth=' . GETPOST('doc_datemonth', 'int') . '&doc_dateday=' . GETPOST('doc_dateday', 'int') . '&doc_dateyear=' . GETPOST('doc_dateyear', 'int'); -} -if (! empty($search_doc_ref)) { - $filter['t.doc_ref'] = $search_doc_ref; - $options .= '&search_doc_ref=' . $search_doc_ref; -} -if (! empty($search_accountancy_code)) { - $filter['t.numero_compte'] = $search_accountancy_code; - $options .= '&search_accountancy_code=' . $search_accountancy_code; -} -if (! empty($search_accountancy_code_start)) { - $filter['t.numero_compte>='] = $search_accountancy_code_start; - $options .= '&search_accountancy_code_start=' . $search_accountancy_code_start; -} -if (! empty($search_accountancy_code_end)) { - $filter['t.numero_compte<='] = $search_accountancy_code_end; - $options .= '&search_accountancy_code_end=' . $search_accountancy_code_end; -} -if (! empty($search_accountancy_aux_code)) { - $filter['t.code_tiers'] = $search_accountancy_aux_code; - $options .= '&search_accountancy_aux_code=' . $search_accountancy_aux_code; -} -if (! empty($search_accountancy_aux_code_start)) { - $filter['t.code_tiers>='] = $search_accountancy_aux_code_start; - $options .= '&search_accountancy_aux_code_start=' . $search_accountancy_aux_code_start; -} -if (! empty($search_accountancy_aux_code_end)) { - $filter['t.code_tiers<='] = $search_accountancy_aux_code_end; - $options .= '&search_accountancy_aux_code_end=' . $search_accountancy_aux_code_end; -} -if (! empty($search_mvt_label)) { - $filter['t.label_compte'] = $search_mvt_label; - $options .= '&search_mvt_label=' . $search_mvt_label; -} -if (! empty($search_direction)) { - $filter['t.sens'] = $search_direction; - $options .= '&search_direction=' . $search_direction; -} -if (! empty($search_ledger_code)) { - $filter['t.code_journal'] = $search_ledger_code; - $options .= '&search_ledger_code=' . $search_ledger_code; -} -if (! empty($search_mvt_num)) { - $filter['t.piece_num'] = $search_mvt_num; - $options .= '&search_mvt_num=' . $search_mvt_num; -} /* * Action */ -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers +if (GETPOST('cancel')) { $action='list'; $massaction=''; } +if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; } + +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers { $search_mvt_num = ''; $search_doc_type = ''; @@ -202,14 +148,32 @@ if ($action == 'delbookkeeping') { if ($action == 'delbookkeepingyearconfirm') { $delyear = GETPOST('delyear', 'int'); + if ($delyear==-1) { + $delyear=0; + } + $deljournal = GETPOST('deljournal','alpha'); + if ($deljournal==-1) { + $deljournal=0; + } - if (! empty($delyear)) { - $result = $object->deleteByYear($delyear); + if (! empty($delyear) || ! empty($deljournal)) + { + $result = $object->deleteByYearAndJournal($delyear,$deljournal); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } + else + { + setEventMessages("RecordDeleted", null, 'mesgs'); + } Header("Location: list.php"); - exit(); + exit; + } + else + { + setEventMessages("NoRecordDeleted", null, 'warnings'); + Header("Location: list.php"); + exit; } } if ($action == 'delmouvconfirm') { @@ -219,38 +183,112 @@ if ($action == 'delmouvconfirm') { if (! empty($mvt_num)) { $result = $object->deleteMvtNum($mvt_num); if ($result < 0) { - setEventMessages($object->error, $object->errors, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); + } + else + { + setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs'); } Header("Location: list.php"); - exit(); - } -} -if ($action == 'export_csv') { - - include DOL_DOCUMENT_ROOT . '/accountancy/class/accountancyexport.class.php'; - - $result = $object->fetchAll($sortorder, $sortfield, 0, 0, $filter); - if ($result < 0) - { - setEventMessages($object->error, $object->errors, 'errors'); - } - else - { - $accountancyexport = new AccountancyExport($db); - $accountancyexport->export($object->lines); - if (!empty($accountancyexport->errors)) { - setEventMessages('', $accountancyexport->errors, 'errors'); - } exit; } } + + /* * View */ -$title_page = $langs->trans("Bookkeeping") . ' ' . dol_print_date($search_date_start) . '-' . dol_print_date($search_date_end); +$param = ''; +$filter = array (); +if (! empty($search_date_start)) { + $filter['t.doc_date>='] = $search_date_start; + $tmp=dol_getdate($search_date_start); + $param .= '&date_startmonth=' . $tmp['mon'] . '&date_startday=' . $tmp['mday'] . '&date_startyear=' . $tmp['year']; +} +if (! empty($search_date_end)) { + $filter['t.doc_date<='] = $search_date_end; + $tmp=dol_getdate($search_date_end); + $param .= '&date_endmonth=' . $tmp['mon'] . '&date_endday=' . $tmp['mday'] . '&date_endyear=' . $tmp['year']; +} +if (! empty($search_doc_date)) { + $filter['t.doc_date'] = $search_doc_date; + $tmp=dol_getdate($search_doc_date); + $param .= '&doc_datemonth=' . $tmp['mon'] . '&doc_dateday=' . $tmp['mday'] . '&doc_dateyear=' . $tmp['year']; +} +if (! empty($search_doc_type)) { + $filter['t.doc_type'] = $search_doc_type; + $param .= '&search_doc_type=' . $search_doc_type; +} +if (! empty($search_doc_ref)) { + $filter['t.doc_ref'] = $search_doc_ref; + $param .= '&search_doc_ref=' . $search_doc_ref; +} +if (! empty($search_accountancy_code)) { + $filter['t.numero_compte'] = $search_accountancy_code; + $param .= '&search_accountancy_code=' . $search_accountancy_code; +} +if (! empty($search_accountancy_code_start)) { + $filter['t.numero_compte>='] = $search_accountancy_code_start; + $param .= '&search_accountancy_code_start=' . $search_accountancy_code_start; +} +if (! empty($search_accountancy_code_end)) { + $filter['t.numero_compte<='] = $search_accountancy_code_end; + $param .= '&search_accountancy_code_end=' . $search_accountancy_code_end; +} +if (! empty($search_accountancy_aux_code)) { + $filter['t.code_tiers'] = $search_accountancy_aux_code; + $param .= '&search_accountancy_aux_code=' . $search_accountancy_aux_code; +} +if (! empty($search_accountancy_aux_code_start)) { + $filter['t.code_tiers>='] = $search_accountancy_aux_code_start; + $param .= '&search_accountancy_aux_code_start=' . $search_accountancy_aux_code_start; +} +if (! empty($search_accountancy_aux_code_end)) { + $filter['t.code_tiers<='] = $search_accountancy_aux_code_end; + $param .= '&search_accountancy_aux_code_end=' . $search_accountancy_aux_code_end; +} +if (! empty($search_mvt_label)) { + $filter['t.label_compte'] = $search_mvt_label; + $param .= '&search_mvt_label=' . $search_mvt_label; +} +if (! empty($search_direction)) { + $filter['t.sens'] = $search_direction; + $param .= '&search_direction=' . $search_direction; +} +if (! empty($search_ledger_code)) { + $filter['t.code_journal'] = $search_ledger_code; + $param .= '&search_ledger_code=' . $search_ledger_code; +} +if (! empty($search_mvt_num)) { + $filter['t.piece_num'] = $search_mvt_num; + $param .= '&search_mvt_num=' . $search_mvt_num; +} +if ($action == 'export_csv') { + + include DOL_DOCUMENT_ROOT . '/accountancy/class/accountancyexport.class.php'; + + $result = $object->fetchAll($sortorder, $sortfield, 0, 0, $filter); + + if ($result < 0) + { + setEventMessages($object->error, $object->errors, 'errors'); + } + else + { + $accountancyexport = new AccountancyExport($db); + $accountancyexport->export($object->lines); + if (!empty($accountancyexport->errors)) { + setEventMessages('', $accountancyexport->errors, 'errors'); + } + exit; + } +} + +$title_page = $langs->trans("Bookkeeping"); +if ($search_date_start || $search_date_end) $title_page .= ' ' . dol_print_date($search_date_start, 'day') . ' - ' . dol_print_date($search_date_end, 'day'); llxHeader('', $title_page); // List @@ -263,24 +301,27 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { } } +// TODO Do not use this $result = $object->fetchAll($sortorder, $sortfield, $limit, $offset, $filter); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } if ($action == 'delmouv') { - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?mvt_num=' . GETPOST('mvt_num'), $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'delmouvconfirm', '', 0, 1); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?mvt_num=' . GETPOST('mvt_num'), $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvtPartial'), 'delmouvconfirm', '', 0, 1); print $formconfirm; } if ($action == 'delbookkeepingyear') { $form_question = array (); $delyear = GETPOST('delyear'); + $deljournal = GETPOST('deljournal'); if (empty($delyear)) { $delyear = dol_print_date(dol_now(), '%Y'); } $year_array = $formventilation->selectyear_accountancy_bookkepping($delyear, 'delyear', 0, 'array'); + $journal_array = $formventilation->selectjournal_accountancy_bookkepping($deljournal, 'deljournal', 0, 'array'); $form_question['delyear'] = array ( 'name' => 'delyear', @@ -289,39 +330,61 @@ if ($action == 'delbookkeepingyear') { 'values' => $year_array, 'default' => $delyear ); + $form_question['deljournal'] = array ( + 'name' => 'deljournal', + 'type' => 'select', + 'label' => $langs->trans('DelJournal'), + 'values' => $journal_array, + 'default' => $deljournal + ); - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'delbookkeepingyearconfirm', $form_question, 0, 1); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'delbookkeepingyearconfirm', $form_question, 0, 1, 250); print $formconfirm; } -print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $options, $sortfield, $sortorder, '', $result, $nbtotalofrecords); +//$param=''; param started before +if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; +if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; + +print ''; +print ''; +if ($optioncss != '') print ''; +print ''; +print ''; +print ''; +print ''; + +print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $result, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit); -print ''; print ''; +print ' ' . $langs->trans("GroupByAccountAccounting") . '

'; + print ''; print ''; -print_liste_field_titre($langs->trans("NumPiece"), $_SERVER['PHP_SELF'], "t.piece_num", "", $options, "", $sortfield, $sortorder); -print_liste_field_titre($langs->trans("Docdate"), $_SERVER['PHP_SELF'], "t.doc_date", "", $options, "", $sortfield, $sortorder); -print_liste_field_titre($langs->trans("Docref"), $_SERVER['PHP_SELF'], "t.doc_ref", "", $options, "", $sortfield, $sortorder); -print_liste_field_titre($langs->trans("AccountAccountingShort"), $_SERVER['PHP_SELF'], "t.numero_compte", "", $options, "", $sortfield, $sortorder); -print_liste_field_titre($langs->trans("Code_tiers"), $_SERVER['PHP_SELF'], "t.code_tiers", "", $options, "", $sortfield, $sortorder); -print_liste_field_titre($langs->trans("Labelcompte"), $_SERVER['PHP_SELF'], "bk_label_compte", "", $options, "", $sortfield, $sortorder); -print_liste_field_titre($langs->trans("Debit"), $_SERVER['PHP_SELF'], "t.debit", "", $options, 'align="right"', $sortfield, $sortorder); -print_liste_field_titre($langs->trans("Credit"), $_SERVER['PHP_SELF'], "t.credit", "", $options, 'align="right"', $sortfield, $sortorder); -print_liste_field_titre($langs->trans("Codejournal"), $_SERVER['PHP_SELF'], "t.code_journal", "", $options, 'align="center"', $sortfield, $sortorder); -print_liste_field_titre($langs->trans("Action"), $_SERVER["PHP_SELF"], "", $options, "", 'width="60" align="center"', $sortfield, $sortorder); +print_liste_field_titre($langs->trans("TransactionNumShort"), $_SERVER['PHP_SELF'], "t.piece_num", "", $param, "", $sortfield, $sortorder); +print_liste_field_titre($langs->trans("Docdate"), $_SERVER['PHP_SELF'], "t.doc_date", "", $param, 'align="center"', $sortfield, $sortorder); +print_liste_field_titre($langs->trans("Docref"), $_SERVER['PHP_SELF'], "t.doc_ref", "", $param, "", $sortfield, $sortorder); +print_liste_field_titre($langs->trans("AccountAccountingShort"), $_SERVER['PHP_SELF'], "t.numero_compte", "", $param, "", $sortfield, $sortorder); +print_liste_field_titre($langs->trans("Code_tiers"), $_SERVER['PHP_SELF'], "t.code_tiers", "", $param, "", $sortfield, $sortorder); +print_liste_field_titre($langs->trans("Labelcompte"), $_SERVER['PHP_SELF'], "t.label_compte", "", $param, "", $sortfield, $sortorder); +print_liste_field_titre($langs->trans("Debit"), $_SERVER['PHP_SELF'], "t.debit", "", $param, 'align="right"', $sortfield, $sortorder); +print_liste_field_titre($langs->trans("Credit"), $_SERVER['PHP_SELF'], "t.credit", "", $param, 'align="right"', $sortfield, $sortorder); +print_liste_field_titre($langs->trans("Codejournal"), $_SERVER['PHP_SELF'], "t.code_journal", "", $param, 'align="right"', $sortfield, $sortorder); +print_liste_field_titre('', $_SERVER["PHP_SELF"], "", $param, "", 'width="60" align="center"', $sortfield, $sortorder); print "\n"; print ''; -print ''; print ''; -print ''; - print ''; print ''; print ''; print ''; -print ''; - print ''; $var = True; @@ -362,13 +423,13 @@ $var = True; $total_debit = 0; $total_credit = 0; -foreach ( $object->lines as $line ) { +foreach ($object->lines as $line ) { $var = ! $var; $total_debit += $line->debit; $total_credit += $line->credit; - print ''; + print ''; print ''; print ''; @@ -381,7 +442,7 @@ foreach ( $object->lines as $line ) { print ''; print ''; print "\n"; } @@ -394,13 +455,13 @@ print ''; print ''; -print ''; +print ''; print ''; print "
'; +print ''; print $langs->trans('From') . ': '; print $form->select_date($search_date_start, 'date_start', 0, 0, 1); print '
'; @@ -343,18 +406,16 @@ print '
'; print $langs->trans('to'); print $formventilation->select_auxaccount($search_accountancy_aux_code_end, 'search_accountancy_aux_code_end', 1); print '
'; print ''; print '  '; +print ''; $searchpitco=$form->showFilterAndCheckAddButtons(0); print $searchpitco; print '
' . $line->piece_num . '' . dol_print_date($line->doc_date, 'day') . '' . $line->code_journal . ''; print '' . img_edit() . ' '; - print '' . img_delete() . ''; + print '' . img_delete() . ''; print '
'; print price($total_credit); print '
"; + print ''; llxFooter(); - -$db->close(); \ No newline at end of file +$db->close(); diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php new file mode 100644 index 00000000000..3a6a428abed --- /dev/null +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -0,0 +1,361 @@ + + * largely based on the great work of : + * - Copyright (C) 2013-2016 Olivier Geffroy + * - Copyright (C) 2013-2016 Florian Henry + * - Copyright (C) 2013-2016 Alexandre Spangaro + * + * 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 . + * + */ + +/** + * \file htdocs/accountancy/bookkeeping/listbyaccount.php + * \ingroup Advanced accountancy + * \brief List operation of book keeping ordered by account number + */ + +require '../../main.inc.php'; + +// Class +require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php'; +require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php'; +require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php'; + +// Langs +$langs->load("accountancy"); + +$page = GETPOST("page"); +$sortorder = GETPOST("sortorder"); +$sortfield = GETPOST("sortfield"); +$action = GETPOST('action', 'alpha'); +$search_date_start = dol_mktime(0, 0, 0, GETPOST('date_startmonth', 'int'), GETPOST('date_startday', 'int'), GETPOST('date_startyear', 'int')); +$search_date_end = dol_mktime(0, 0, 0, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', 'int')); +$search_doc_date = dol_mktime(0, 0, 0, GETPOST('doc_datemonth', 'int'), GETPOST('doc_dateday', 'int'), GETPOST('doc_dateyear', 'int')); + + + +$search_accountancy_code = GETPOST("search_accountancy_code"); + +$search_accountancy_code_start = GETPOST('search_accountancy_code_start', 'alpha'); +if ($search_accountancy_code_start == - 1) { + $search_accountancy_code_start = ''; +} +$search_label_account = GETPOST('search_label_account', 'alpha'); + +$search_mvt_label = GETPOST('search_mvt_label', 'alpha'); +$search_direction = GETPOST('search_direction', 'alpha'); +$search_ledger_code = GETPOST('search_ledger_code', 'alpha'); + +// Load variable for pagination +$limit = GETPOST('limit') ? GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)?$conf->liste_limit:$conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION); +$sortfield = GETPOST('sortfield', 'alpha'); +$sortorder = GETPOST('sortorder', 'alpha'); +$page = GETPOST('page','int'); +if ($page < 0) { $page = 0; } +$offset = $limit * $page; +$pageprev = $page - 1; +$pagenext = $page + 1; +if ($sortorder == "") $sortorder = "ASC"; +if ($sortfield == "") $sortfield = "t.rowid"; + +if (empty($search_date_start)) { + $search_date_start = dol_mktime(0, 0, 0, 1, 1, dol_print_date(dol_now(), '%Y')); + $search_date_end = dol_mktime(0, 0, 0, 12, 31, dol_print_date(dol_now(), '%Y')); +} + + +$object = new BookKeeping($db); + +$formventilation = new FormVentilation($db); +$formother = new FormOther($db); +$form = new Form($db); + + +$options = ''; +$filter = array (); + +if (! empty($search_date_start)) { + $filter['t.doc_date>='] = $search_date_start; + $options .= '&date_startmonth=' . GETPOST('date_startmonth', 'int') . '&date_startday=' . GETPOST('date_startday', 'int') . '&date_startyear=' . GETPOST('date_startyear', 'int'); +} +if (! empty($search_date_end)) { + $filter['t.doc_date<='] = $search_date_end; + $options .= '&date_endmonth=' . GETPOST('date_endmonth', 'int') . '&date_endday=' . GETPOST('date_endday', 'int') . '&date_endyear=' . GETPOST('date_endyear', 'int'); +} +if (! empty($search_doc_date)) { + $filter['t.doc_date'] = $search_doc_date; + $options .= '&doc_datemonth=' . GETPOST('doc_datemonth', 'int') . '&doc_dateday=' . GETPOST('doc_dateday', 'int') . '&doc_dateyear=' . GETPOST('doc_dateyear', 'int'); +} + + +if (!GETPOST("button_removefilter_x") && !GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers +{ + if (! empty($search_accountancy_code_start)) { + $filter['t.numero_compte'] = $search_accountancy_code_start; + $options .= '&search_accountancy_code_start=' . $search_accountancy_code_start; + } + if (! empty($search_label_account)) { + $filter['t.label_compte'] = $search_label_account; + $options .= '&search_label_account=' . $search_label_account; + } + if (! empty($search_mvt_label)) { + $filter['t.label_compte'] = $search_mvt_label; + $options .= '&search_mvt_label=' . $search_mvt_label; + } + if (! empty($search_direction)) { + $filter['t.sens'] = $search_direction; + $options .= '&search_direction=' . $search_direction; + } + if (! empty($search_ledger_code)) { + $filter['t.code_journal'] = $search_ledger_code; + $options .= '&search_ledger_code=' . $search_ledger_code; + } +} + +/* + * Action + */ + +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers +{ + $search_doc_date = ''; + $search_accountancy_code = ''; + $search_accountancy_code_start = ''; + $search_label_account = ''; + $search_mvt_label = ''; + $search_direction = ''; + $search_ledger_code = ''; +} + +if ($action == 'delmouvconfirm') { + + $mvt_num = GETPOST('mvt_num', 'int'); + + if (! empty($mvt_num)) { + $result = $object->deleteMvtNum($mvt_num); + if ($result < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + } + Header("Location: listbyaccount.php"); + exit(); + } +} + + +/* + * View + */ + +$title_page = $langs->trans("Bookkeeping") . ' ' . strtolower($langs->trans("By")) . ' ' . $langs->trans("AccountAccounting") . ' ' . dol_print_date($search_date_start) . '-' . dol_print_date($search_date_end); + +llxHeader('', $title_page); + +// List + +$nbtotalofrecords = 0; +if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { + $nbtotalofrecords = $object->fetchAllByAccount($sortorder, $sortfield, 0, 0, $filter); + if ($nbtotalofrecords < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + } +} + +$result = $object->fetchAllByAccount($sortorder, $sortfield, $limit, $offset, $filter); +if ($result < 0) { + setEventMessages($object->error, $object->errors, 'errors'); +} +$nbtotalofrecords = $result; + +if ($action == 'delmouv') { + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?mvt_num=' . GETPOST('mvt_num'), $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'delmouvconfirm', '', 0, 1); + print $formconfirm; +} +if ($action == 'delbookkeepingyear') { + + $form_question = array (); + $delyear = GETPOST('delyear'); + + if (empty($delyear)) { + $delyear = dol_print_date(dol_now(), '%Y'); + } + $year_array = $formventilation->selectyear_accountancy_bookkepping($delyear, 'delyear', 0, 'array'); + + $form_question['delyear'] = array ( + 'name' => 'delyear', + 'type' => 'select', + 'label' => $langs->trans('DelYear'), + 'values' => $year_array, + 'default' => $delyear + ); + + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'delbookkeepingyearconfirm', $form_question, 0, 1, 250); + print $formconfirm; +} + + + + +print '
'; + +print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $options, $sortfield, $sortorder, '', $result, $nbtotalofrecords,'title_accountancy',0,'','',$limit); + +// Reverse sort order +if ( preg_match('/^asc/i', $sortorder) ) + $sortorder = "asc"; +else + $sortorder = "desc"; + +print '
' . "\n"; +print ''; +print '
'; + +print ' ' . $langs->trans("ViewFlatList") . '

'; + +print ''; +print ''; +print ''; +print_liste_field_titre($langs->trans("TransactionNumShort"), $_SERVER['PHP_SELF'], "t.piece_num", "", $options, 'align="right"', $sortfield, $sortorder); +print_liste_field_titre($langs->trans("Docdate"), $_SERVER['PHP_SELF'], "t.doc_date", "", $options, 'align="center"', $sortfield, $sortorder); +print_liste_field_titre($langs->trans("Docref"), $_SERVER['PHP_SELF'], "t.doc_ref", "", $options, "", $sortfield, $sortorder); +print_liste_field_titre($langs->trans("SuppliersInvoices") . ' / ' . $langs->trans("CustomersInvoices")); +print_liste_field_titre($langs->trans("Debit"), $_SERVER['PHP_SELF'], "t.debit", "", $options, 'align="right"', $sortfield, $sortorder); +print_liste_field_titre($langs->trans("Credit"), $_SERVER['PHP_SELF'], "t.credit", "", $options, 'align="right"', $sortfield, $sortorder); +print_liste_field_titre($langs->trans("Codejournal"), $_SERVER['PHP_SELF'], "t.code_journal", "", $options, 'align="right"', $sortfield, $sortorder); +print_liste_field_titre('', $_SERVER["PHP_SELF"], "", $options, "", 'width="60" align="center"', $sortfield, $sortorder); +print "\n"; + +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; + +print ''; + +$var = True; + +$total_debit = 0; +$total_credit = 0; +$sous_total_debit = 0; +$sous_total_credit = 0; +$displayed_account_number = null; // Start with undefined to be able to distinguish with empty + +foreach ( $object->lines as $line ) { + $var = ! $var; + + $total_debit += $line->debit; + $total_credit += $line->credit; + + $accountg = length_accountg($line->numero_compte); + //if (empty($accountg)) $accountg = '-'; + + // Is it a break ? + if ($accountg != $displayed_account_number || ! isset($displayed_account_number)) { + + // Affiche un Sous-Total par compte comptable + if (isset($displayed_account_number)) { + print ''; + print "\n"; + print ''; + } + + // Show the break account + $colspan = 9; + print ""; + print ''; + print ''; + + $displayed_account_number = $accountg; + //if (empty($displayed_account_number)) $displayed_account_number='-'; + $sous_total_debit = 0; + $sous_total_credit = 0; + } + + print ''; + print ''; + print ''; + print ''; + print ''; + + // Affiche un lien vers la facture client/fournisseur + $doc_ref = preg_replace('/\(.*\)/', '', $line->doc_ref); + if ($line->doc_type == 'supplier_invoice') + print strlen(length_accounta($line->code_tiers)) == 0 ? '' : ''; + elseif ($line->doc_type == 'customer_invoice') + print strlen(length_accounta($line->code_tiers)) == 0 ? '' : ''; + else + print strlen(length_accounta($line->code_tiers)) == 0 ? '' : ''; + + + print ''; + print ''; + print ''; + print ''; + print "\n"; + + // Comptabilise le sous-total + $sous_total_debit += $line->debit; + $sous_total_credit += $line->credit; + +} + +// Affiche un Sous-Total du dernier compte comptable affiché +print ''; +print "\n"; +print ''; + + +// Affiche le Total +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; + +print "
' . $langs->trans("AccountAccounting") . '
' . $object->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array (), 1, 1, '') . ''; +print $langs->trans('From') . ': '; +print $form->select_date($search_date_start, 'date_start', 0, 0, 1); +print '
'; +print $langs->trans('to') . ': '; +print $form->select_date($search_date_end, 'date_end', 0, 0, 1); +print '
  '; +$searchpitco=$form->showFilterAndCheckAddButtons(0); +print $searchpitco; +print '
'.$langs->trans("SubTotal").':'.price($sous_total_debit).''.price($sous_total_credit).' 
'; + if (! empty($line->numero_compte) && $line->numero_compte != '-1') print length_accountg($line->numero_compte) . ' : ' . $object->get_compte_desc($line->numero_compte); + else print ''.$langs->trans("Unknown").''; + print '
 '.$line->piece_num.'' . dol_print_date($line->doc_date, 'day') . '' . $line->doc_ref . '' . $line->label_compte . '' . $line->label_compte . '
(' . length_accounta($line->code_tiers) . ')
' . $line->label_compte . '' . $line->label_compte . '
(' . length_accounta($line->code_tiers) . ')
' . $line->label_compte . '' . $line->label_compte . '
(' . length_accounta($line->code_tiers) . ')
' . price($line->debit) . '' . price($line->credit) . '' . $line->code_journal . ''; + print '' . img_edit() . ' '; + print '' . img_delete() . ''; + print '
'.$langs->trans("SubTotal").':'.price($sous_total_debit).''.price($sous_total_credit).' 
'.$langs->trans("Total").':'; +print price($total_debit); +print ''; +print price($total_credit); +print '
"; +print '
'; + +llxFooter(); + + +$db->close(); diff --git a/htdocs/accountancy/bookkeeping/listbyyear.php b/htdocs/accountancy/bookkeeping/listbyyear.php index 23eeb79621a..d8df8eb5007 100644 --- a/htdocs/accountancy/bookkeeping/listbyyear.php +++ b/htdocs/accountancy/bookkeeping/listbyyear.php @@ -171,7 +171,7 @@ if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } -print_barre_liste($langs->trans("Bookkeeping") . ' ' . dol_print_date($search_date_start) . '-' . dol_print_date($search_date_end), $page, $_SERVER['PHP_SELF'], $options, $sortfield, $sortorder, '', $result, $nbtotalofrecords); +print_barre_liste($langs->trans("Bookkeeping") . ' ' . dol_print_date($search_date_start) . '-' . dol_print_date($search_date_end), $page, $_SERVER['PHP_SELF'], $options, $sortfield, $sortorder, '', $result, $nbtotalofrecords, 'title_accountancy'); print '
'; print '
'; @@ -197,7 +197,7 @@ print ""; print ''; print_liste_field_titre($langs->trans("NumPiece"), $_SERVER['PHP_SELF'], "t.piece_num", "", $options, "", $sortfield, $sortorder); print_liste_field_titre($langs->trans("Doctype"), $_SERVER['PHP_SELF'], "t.doc_type", "", $options, "", $sortfield, $sortorder); -print_liste_field_titre($langs->trans("Date"), $_SERVER['PHP_SELF'], "t.doc_date", "", $options, "", $sortfield, $sortorder); +print_liste_field_titre($langs->trans("Date"), $_SERVER['PHP_SELF'], "t.doc_date", "", $options, 'align="center"', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Docref"), $_SERVER['PHP_SELF'], "t.doc_ref", "", $options, "", $sortfield, $sortorder); print_liste_field_titre($langs->trans("AccountAccounting"), $_SERVER['PHP_SELF'], "t.numero_compte", "", $options, "", $sortfield, $sortorder); print_liste_field_titre($langs->trans("ThirdPartyAccount"), $_SERVER['PHP_SELF'], "t.code_tiers", "", $options, "", $sortfield, $sortorder); @@ -269,10 +269,10 @@ $var = True; foreach ( $object->lines as $line ) { $var = ! $var; - print ''; + print ''; print '' . "\n"; print '' . "\n"; - print ''; + print ''; print ''; print ''; print ''; @@ -289,4 +289,4 @@ print "
' . $line->piece_num . '' . $line->doc_type . '' . dol_print_date($line->doc_date) . '' . dol_print_date($line->doc_date) . '' . $line->doc_ref . '' . length_accountg($line->numero_compte) . '' . length_accounta($line->code_tiers) . '
"; print ''; llxFooter(); -$db->close(); \ No newline at end of file +$db->close(); diff --git a/htdocs/accountancy/class/accountancycategory.class.php b/htdocs/accountancy/class/accountancycategory.class.php index ef880aa8113..40290bd845b 100644 --- a/htdocs/accountancy/class/accountancycategory.class.php +++ b/htdocs/accountancy/class/accountancycategory.class.php @@ -17,9 +17,9 @@ */ /** - * \file htdocs/accountancy/class/accountancycategory.class.php - * \ingroup Advanced accountancy - * \brief File of class to manage categories of an accounting category_type + * \file htdocs/accountancy/class/accountancycategory.class.php + * \ingroup Advanced accountancy + * \brief File of class to manage categories of an accounting category_type */ // Class @@ -32,142 +32,156 @@ class AccountancyCategory { private $db; public $error; - public $errors = array(); - //public $element='accounting_category'; - //public $table_element='c_accounting_category'; + public $errors = array (); + public $element = 'accounting_category'; + public $table_element = 'c_accounting_category'; public $id; + public $lines_cptbk; + public $lines_display; + public $sdc; /** - * Constructor + * Constructor * - * @param DoliDB $db Database handler + * @param DoliDB $db Database handler */ - public function __construct($db) - { + public function __construct($db) { $this->db = $db; - - return 1; } /** * Function to select all accounting accounts from an accounting category * - * @param int $id Id + * @param int $id Id * * @return int <0 if KO, 0 if not found, >0 if OK - */ - public function display($id) - { + */ + public function display($id) { $sql = "SELECT t.rowid, t.account_number, t.label"; - $sql.= " FROM " . MAIN_DB_PREFIX . "accounting_account as t"; - $sql.= " WHERE t.fk_accounting_category = " . $id; + $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as t"; + $sql .= " WHERE t.fk_accounting_category = " . $id; + + $this->lines_display = array (); dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { - $i = 0; - $obj = ''; $num = $this->db->num_rows($resql); if ($num) { - while ( $i < $num ) { - $obj[$i] = $this->db->fetch_object($resql); - $i ++; + while ( $obj = $this->db->fetch_object($resql) ) { + $this->lines_display[] = $obj; } } - return $obj; + return $num; } else { $this->error = "Error " . $this->db->lasterror(); - dol_syslog(__METHOD__ . " " . $this->error, LOG_ERR); + $this->errors[] = $this->error; + dol_syslog(__METHOD__ . " " . implode(',' . $this->errors), LOG_ERR); - return -1; + return - 1; } } /** * Function to select accountiing category of an accounting account present in chart of accounts * - * @param int $id Id category + * @param int $id Id category * * @return int <0 if KO, 0 if not found, >0 if OK */ - public function getCptBK($id) - { + public function getCptBK($id) { global $conf; $sql = "SELECT t.numero_compte, t.label_compte, t.doc_ref"; - $sql.= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as t"; - $sql.= " WHERE t.numero_compte NOT IN ("; - $sql.= " SELECT t.account_number"; - $sql.= " FROM " . MAIN_DB_PREFIX . "accounting_account as t"; - $sql.= " WHERE t.fk_accounting_category = " . $id .")"; - $sql.= " AND t.numero_compte IN ("; - $sql.= " SELECT DISTINCT aa.account_number"; - $sql.= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa"; - $sql.= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version"; - $sql.= " AND asy.rowid = " . $conf->global->CHARTOFACCOUNTS; - $sql.= " AND aa.active = 1)"; - $sql.= " GROUP BY t.numero_compte"; + $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as t"; + $sql .= " WHERE t.numero_compte NOT IN ("; + $sql .= " SELECT t.account_number"; + $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as t"; + $sql .= " WHERE t.fk_accounting_category = " . $id . ")"; + $sql .= " AND t.numero_compte IN ("; + $sql .= " SELECT DISTINCT aa.account_number"; + $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa"; + $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version"; + $sql .= " AND asy.rowid = " . $conf->global->CHARTOFACCOUNTS; + $sql .= " AND aa.active = 1)"; + $sql .= " GROUP BY t.numero_compte, t.label_compte, t.doc_ref"; + $sql .= " ORDER BY t.numero_compte"; - dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG); + $this->lines_CptBk = array (); + + dol_syslog(__METHOD__, LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { - $i = 0; - $obj = ''; $num = $this->db->num_rows($resql); if ($num) { - while ( $i < $num ) { - $obj[$i] = $this->db->fetch_object($resql); - $i ++; + while ( $obj = $this->db->fetch_object($resql) ) { + $this->lines_cptbk[] = $obj; } } - return $obj; + return $num; } else { $this->error = "Error " . $this->db->lasterror(); - dol_syslog(__METHOD__ . " " . $this->error, LOG_ERR); + $this->errors[] = $this->error; + dol_syslog(__METHOD__ . " " . implode(',' . $this->errors), LOG_ERR); - return -1; + return - 1; } } - + /** * Function to add an accounting account in an accounting category * - * @param int $id_cat Id category - * @param array $cpts list of accounts array + * @param int $id_cat Id category + * @param array $cpts list of accounts array * * @return int <0 if KO, >0 if OK */ - public function updateAccAcc($id_cat, $cpts = array()) - { + public function updateAccAcc($id_cat, $cpts = array()) { global $conf; $error = 0; - $sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_account as aa"; - $sql.= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version"; - $sql.= " AND asy.rowid = " . $conf->global->CHARTOFACCOUNTS; - $sql.= " AND aa.active = 1"; - $sql.= " SET fk_accounting_category=" . $id_cat; - $sql.= " WHERE aa.account_number IN (" . join(',',$cpts) .")"; - $this->db->begin(); + require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; - dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG); + $sql = "SELECT aa.rowid,aa.account_number "; + $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa"; + $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version"; + $sql .= " AND asy.rowid = " . $conf->global->CHARTOFACCOUNTS; + $sql .= " AND aa.active = 1"; + + dol_syslog(__METHOD__, LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $error ++; $this->errors[] = "Error " . $this->db->lasterror(); + return -1; + } + + $this->db->begin(); + while ( $obj = $this->db->fetch_object($resql)) { + if (array_key_exists(length_accountg($obj->account_number), $cpts)) { + $sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_account"; + $sql .= " SET fk_accounting_category=" . $id_cat; + $sql .= " WHERE rowid=".$obj->rowid; + dol_syslog(__METHOD__, LOG_DEBUG); + $resql = $this->db->query($sql); + if (! $resql) { + $error ++; + $this->errors[] = "Error " . $this->db->lasterror(); + } + } } // Commit or rollback if ($error) { - foreach ($this->errors as $errmsg) { + foreach ( $this->errors as $errmsg ) { dol_syslog(__METHOD__ . " " . $errmsg, LOG_ERR); - $this->error.=($this->error ? ', ' . $errmsg : $errmsg); + $this->error .= ($this->error ? ', ' . $errmsg : $errmsg); } $this->db->rollback(); - return -1 * $error; + return - 1 * $error; } else { $this->db->commit(); @@ -178,17 +192,16 @@ class AccountancyCategory /** * Function to delete an accounting account from an accounting category * - * @param int $cpt_id Id of accounting account + * @param int $cpt_id Id of accounting account * * @return int <0 if KO, >0 if OK */ - public function deleteCptCat($cpt_id) - { + public function deleteCptCat($cpt_id) { $error = 0; $sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_account as aa"; - $sql.= " SET fk_accounting_category= 0"; - $sql.= " WHERE aa.rowid= " . $cpt_id; + $sql .= " SET fk_accounting_category= 0"; + $sql .= " WHERE aa.rowid= " . $cpt_id; $this->db->begin(); dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG); @@ -200,13 +213,13 @@ class AccountancyCategory // Commit or rollback if ($error) { - foreach ($this->errors as $errmsg) { + foreach ( $this->errors as $errmsg ) { dol_syslog(__METHOD__ . " " . $errmsg, LOG_ERR); - $this->error.=($this->error ? ', ' . $errmsg : $errmsg); + $this->error .= ($this->error ? ', ' . $errmsg : $errmsg); } $this->db->rollback(); - return -1 * $error; + return - 1 * $error; } else { $this->db->commit(); @@ -217,57 +230,51 @@ class AccountancyCategory /** * Function to know all category from accounting account * - * @return array Result in table + * @return array Result in table */ - public function getCatsCpts() - { + public function getCatsCpts() { global $mysoc; $sql = ""; - if (empty($mysoc->country_id) && empty($mysoc->country_code)) - { - dol_print_error('','Call to select_accounting_account with mysoc country not yet defined'); - exit; - } + if (empty($mysoc->country_id) && empty($mysoc->country_code)) { + dol_print_error('', 'Call to select_accounting_account with mysoc country not yet defined'); + exit(); + } - if (! empty($mysoc->country_id)) - { - $sql = "SELECT t.rowid, t.account_number, t.label as name_cpt, cat.code, cat.position, cat.label as name_cat, cat.sens "; - $sql.= " FROM " . MAIN_DB_PREFIX . "accounting_account as t, ".MAIN_DB_PREFIX."c_accounting_category as cat"; - $sql.= " WHERE t.fk_accounting_category IN ( SELECT c.rowid "; - $sql.= " FROM ".MAIN_DB_PREFIX."c_accounting_category as c"; - $sql.= " WHERE c.active = 1"; - $sql.= " AND c.fk_country = ".$mysoc->country_id.")"; - $sql.= " AND cat.rowid = t.fk_accounting_category"; - $sql.= " ORDER BY cat.position ASC"; - } - else - { - $sql = "SELECT c.rowid, c.code, c.label, c.category_type "; - $sql.= " FROM ".MAIN_DB_PREFIX."c_accounting_category as c, ".MAIN_DB_PREFIX."c_country as co"; - $sql.= " WHERE c.active = 1 AND c.fk_country = co.rowid"; - $sql.= " AND co.code = '".$mysoc->country_code."'"; - $sql.= " ORDER BY c.position ASC"; - } - - $resql = $this->db->query($sql); + if (! empty($mysoc->country_id)) { + $sql = "SELECT t.rowid, t.account_number, t.label as name_cpt, cat.code, cat.position, cat.label as name_cat, cat.sens "; + $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as t, " . MAIN_DB_PREFIX . "c_accounting_category as cat"; + $sql .= " WHERE t.fk_accounting_category IN ( SELECT c.rowid "; + $sql .= " FROM " . MAIN_DB_PREFIX . "c_accounting_category as c"; + $sql .= " WHERE c.active = 1"; + $sql .= " AND c.fk_country = " . $mysoc->country_id . ")"; + $sql .= " AND cat.rowid = t.fk_accounting_category"; + $sql .= " ORDER BY cat.position ASC"; + } else { + $sql = "SELECT c.rowid, c.code, c.label, c.category_type "; + $sql .= " FROM " . MAIN_DB_PREFIX . "c_accounting_category as c, " . MAIN_DB_PREFIX . "c_country as co"; + $sql .= " WHERE c.active = 1 AND c.fk_country = co.rowid"; + $sql .= " AND co.code = '" . $mysoc->country_code . "'"; + $sql .= " ORDER BY c.position ASC"; + } + + $resql = $this->db->query($sql); if ($resql) { $i = 0; $obj = ''; $num = $this->db->num_rows($resql); - $data = array(); + $data = array (); if ($num) { - while ( $i < $num ) { - $obj = $this->db->fetch_object($resql); + while ( $obj = $this->db->fetch_object($resql) ) { $name_cat = $obj->name_cat; - $data[$name_cat][$i] = array( - 'id' => $obj->rowid, - 'code' => $obj->code, - 'position' => $obj->position, - 'account_number' => $obj->account_number, - 'name_cpt' => $obj->name_cpt, - 'sens' => $obj->sens, - ); + $data[$name_cat][$i] = array ( + 'id' => $obj->rowid, + 'code' => $obj->code, + 'position' => $obj->position, + 'account_number' => $obj->account_number, + 'name_cpt' => $obj->name_cpt, + 'sens' => $obj->sens + ); $i ++; } } @@ -278,27 +285,26 @@ class AccountancyCategory return -1; } - } + } /** * Function to show result of an accounting account from the general ledger with a sens and a period - * - * @param int $cpt Id accounting account - * @param string $month Specifig month - Can be empty - * @param string $year Specific year - * @param int $sens Sens of the account 0: credit - debit 1: debit - credit * - * @return array Result in table + * @param int $cpt Id accounting account + * @param string $month Specifig month - Can be empty + * @param string $year Specific year + * @param int $sens Sens of the account 0: credit - debit 1: debit - credit + * + * @return integer Result in table */ - public function getResult($cpt, $month, $year, $sens) - { - $sql = "SELECT SUM(t.debit) as debit, SUM(t.credit) as credit"; - $sql.= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as t"; - $sql.= " WHERE t.numero_compte = " . $cpt; - $sql.= " AND YEAR(t.doc_date) = " . $year; + public function getResult($cpt, $month, $year, $sens) { + $sql = "SELECT SUM(t.debit) as debit, SUM(t.credit) as credit"; + $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as t"; + $sql .= " WHERE t.numero_compte = '" . $cpt."'"; + $sql .= " AND YEAR(t.doc_date) = " . $year; - if(! empty($month)){ - $sql.= " AND MONTH(t.doc_date) = " . $month; + if (! empty($month)) { + $sql .= " AND MONTH(t.doc_date) = " . $month; } dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG); @@ -306,81 +312,77 @@ class AccountancyCategory if ($resql) { $num = $this->db->num_rows($resql); - $sdc = 0; + $this->sdc = 0; if ($num) { $obj = $this->db->fetch_object($resql); - if($sens == 1){ - $sdc = $obj->debit - $obj->credit; - }else{ - $sdc = $obj->credit - $obj->debit; + if ($sens == 1) { + $this->sdc = $obj->debit - $obj->credit; + } else { + $this->sdc = $obj->credit - $obj->debit; } } - return $sdc; + return $num; } else { $this->error = "Error " . $this->db->lasterror(); dol_syslog(__METHOD__ . " " . $this->error, LOG_ERR); - return -1; + return - 1; } } /** * Function to call category from a specific country * - * @return array Result in table + * @return array Result in table */ - public function getCatsCal() - { - global $db,$langs,$user,$mysoc; + public function getCatsCal() { + global $db, $langs, $user, $mysoc; - if (empty($mysoc->country_id) && empty($mysoc->country_code)) - { - dol_print_error('','Call to select_accounting_account with mysoc country not yet defined'); - exit; - } + if (empty($mysoc->country_id) && empty($mysoc->country_code)) { + dol_print_error('', 'Call to select_accounting_account with mysoc country not yet defined'); + exit(); + } - if (! empty($mysoc->country_id)) - { - $sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position"; - $sql.= " FROM ".MAIN_DB_PREFIX."c_accounting_category as c"; - $sql.= " WHERE c.active = 1 AND c.category_type = 1 "; - $sql.= " AND c.fk_country = ".$mysoc->country_id; - $sql.= " ORDER BY c.position ASC"; - } - else - { - $sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position"; - $sql.= " FROM ".MAIN_DB_PREFIX."c_accounting_category as c, ".MAIN_DB_PREFIX."c_country as co"; - $sql.= " WHERE c.active = 1 AND c.category_type = 1 AND c.fk_country = co.rowid"; - $sql.= " AND co.code = '".$mysoc->country_code."'"; - $sql.= " ORDER BY c.position ASC"; - } + if (! empty($mysoc->country_id)) { + $sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position"; + $sql .= " FROM " . MAIN_DB_PREFIX . "c_accounting_category as c"; + $sql .= " WHERE c.active = 1 AND c.category_type = 1 "; + $sql .= " AND c.fk_country = " . $mysoc->country_id; + $sql .= " ORDER BY c.position ASC"; + } else { + $sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position"; + $sql .= " FROM " . MAIN_DB_PREFIX . "c_accounting_category as c, " . MAIN_DB_PREFIX . "c_country as co"; + $sql .= " WHERE c.active = 1 AND c.category_type = 1 AND c.fk_country = co.rowid"; + $sql .= " AND co.code = '" . $mysoc->country_code . "'"; + $sql .= " ORDER BY c.position ASC"; + } - dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG); + dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { $i = 0; $obj = ''; $num = $this->db->num_rows($resql); - $data = array(); + $data = array (); if ($num) { while ( $i < $num ) { $obj = $this->db->fetch_object($resql); $position = $obj->position; - $data[$position] = array( - 'code' => $obj->code, - 'label' => $obj->label, - 'formula' => $obj->formula - ); + $data[$position] = array ( + 'code' => $obj->code, + 'label' => $obj->label, + 'formula' => $obj->formula + ); $i ++; } } return $data; } else { $this->error = "Error " . $this->db->lasterror(); - dol_syslog(__METHOD__ . " " . $this->error, LOG_ERR); + $this->errors[] = $this->error; + dol_syslog(__METHOD__ . " " . implode(',', $this->errors), LOG_ERR); - return -1; + return - 1; } } } diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index c7920577adc..d40d8147ef0 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -1,10 +1,11 @@ - * Copyright (C) 2014 Juanjo Menent - * Copyright (C) 2015 Florian Henry - * Copyright (C) 2015 Raphaël Doursenaud - * Copyright (C) 2016 Pierre-Henry Favre + * Copyright (C) 2007-2012 Laurent Destailleur + * Copyright (C) 2014 Juanjo Menent + * Copyright (C) 2015 Florian Henry + * Copyright (C) 2015 Raphaël Doursenaud + * Copyright (C) 2016 Pierre-Henry Favre + * Copyright (C) 2016 Alexandre Spangaro * * 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 @@ -21,7 +22,9 @@ */ /** - * \file htdocs/accountancy/class/accountancyexport.class.php + * \file htdocs/accountancy/class/accountancyexport.class.php + * \ingroup Advanced accountancy + * \brief Class accountancy export */ /** @@ -43,6 +46,7 @@ class AccountancyExport public static $EXPORT_TYPE_CIEL = 5; public static $EXPORT_TYPE_QUADRATUS = 6; public static $EXPORT_TYPE_EBP = 7; + public static $EXPORT_TYPE_COGILOG = 8; /** * @@ -91,6 +95,7 @@ class AccountancyExport self::$EXPORT_TYPE_CIEL => $langs->trans('Modelcsv_ciel'), self::$EXPORT_TYPE_QUADRATUS => $langs->trans('Modelcsv_quadratus'), self::$EXPORT_TYPE_EBP => $langs->trans('Modelcsv_ebp'), + self::$EXPORT_TYPE_COGILOG => $langs->trans('Modelcsv_cogilog'), ); } @@ -137,7 +142,10 @@ class AccountancyExport case self::$EXPORT_TYPE_EBP : $this->exportEbp($TData); break; - default : + case self::$EXPORT_TYPE_COGILOG : + $this->exportCogilog($TData); + break; + default: $this->errors[] = $langs->trans('accountancy_error_modelnotfound'); break; } @@ -151,6 +159,8 @@ class AccountancyExport * @return void */ public function exportNormal($objectLines) { + global $conf; + foreach ( $objectLines as $line ) { // Std export $date = dol_print_date($line->doc_date, $conf->global->ACCOUNTING_EXPORT_DATE); @@ -173,17 +183,49 @@ class AccountancyExport * @return void */ public function exportCegid($objectLines) { + foreach ( $objectLines as $line ) { + $date = dol_print_date($line->doc_date, '%d%m%Y'); + $separator = ";"; + + print $date . $separator; + print $line->code_journal . $separator; + print length_accountg($line->numero_compte) . $separator; + print length_accounta($line->code_tiers) . $separator; + print $line->sens . $separator; + print price($line->montant) . $separator; + print $line->label_compte . $separator; + print $line->doc_ref; + print $this->end_line; + } + } + + /** + * Export format : COGILOG + * + * @param array $objectLines data + * + * @return void + */ + public function exportCogilog($objectLines) { foreach ( $objectLines as $line ) { $date = dol_print_date($line->doc_date, '%d%m%Y'); - print $date . $this->separator; print $line->code_journal . $this->separator; + print $date . $this->separator; + print $line->piece_num . $this->separator; print length_accountg($line->numero_compte) . $this->separator; - print ' ' . $this->separator; - print $line->sens . $this->separator; - print price($line->montant) . $this->separator; - print dol_trunc($line->label_compte, 32) . $this->separator; + print '' . $this->separator; + print $line->label_compte . $this->separator; + print $date . $this->separator; + if ($line->sens=='D') { + print price($line->montant) . $this->separator; + print '' . $this->separator; + }elseif ($line->sens=='C') { + print '' . $this->separator; + print price($line->montant) . $this->separator; + } print $line->doc_ref . $this->separator; + print $line->label_compte . $this->separator; print $this->end_line; } } @@ -257,6 +299,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 ) { @@ -295,6 +339,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; diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php index 690f3785df1..b63d7ce2fda 100644 --- a/htdocs/accountancy/class/accountingaccount.class.php +++ b/htdocs/accountancy/class/accountingaccount.class.php @@ -45,7 +45,8 @@ class AccountingAccount extends CommonObject var $label; var $fk_user_author; var $fk_user_modif; - var $active; + var $active; // duplicate with status + var $status; /** * Constructor @@ -103,6 +104,7 @@ class AccountingAccount extends CommonObject $this->fk_user_author = $obj->fk_user_author; $this->fk_user_modif = $obj->fk_user_modif; $this->active = $obj->active; + $this->status = $obj->active; return $this->id; } else { @@ -170,16 +172,15 @@ class AccountingAccount extends CommonObject $sql .= " '" . $this->db->idate($now) . "'"; $sql .= ", " . $conf->entity; - $sql .= ", " . (! isset($this->fk_pcg_version) ? 'NULL' : "'" . $this->db->escape($this->fk_pcg_version) . "'"); - $sql .= ", " . (! isset($this->pcg_type) ? 'NULL' : "'" . $this->db->escape($this->pcg_type) . "'"); - $sql .= ", " . (! isset($this->pcg_subtype) ? 'NULL' : "'" . $this->pcg_subtype . "'"); - $sql .= ", " . (! isset($this->account_number) ? 'NULL' : "'" . $this->account_number . "'"); - $sql .= ", " . (! isset($this->account_parent) ? 'NULL' : "'" . $this->db->escape($this->account_parent) . "'"); - $sql .= ", " . (! isset($this->label) ? 'NULL' : "'" . $this->db->escape($this->label) . "'"); - $sql .= ", " . (! isset($this->account_category) ? 'NULL' : "'" . $this->db->escape($this->account_category) . "'"); + $sql .= ", " . (empty($this->fk_pcg_version) ? 'NULL' : "'" . $this->db->escape($this->fk_pcg_version) . "'"); + $sql .= ", " . (empty($this->pcg_type) ? 'NULL' : "'" . $this->db->escape($this->pcg_type) . "'"); + $sql .= ", " . (empty($this->pcg_subtype) ? 'NULL' : "'" . $this->pcg_subtype . "'"); + $sql .= ", " . (empty($this->account_number) ? 'NULL' : "'" . $this->account_number . "'"); + $sql .= ", " . (empty($this->account_parent) ? 'NULL' : "'" . $this->db->escape($this->account_parent) . "'"); + $sql .= ", " . (empty($this->label) ? 'NULL' : "'" . $this->db->escape($this->label) . "'"); + $sql .= ", " . (empty($this->account_category) ? 'NULL' : "'" . $this->db->escape($this->account_category) . "'"); $sql .= ", " . $user->id; - $sql .= ", " . (! isset($this->active) ? 'NULL' : "'" . $this->db->escape($this->active) . "'"); - + $sql .= ", " . (! isset($this->active) ? 'NULL' : $this->db->escape($this->active)); $sql .= ")"; $this->db->begin(); @@ -465,4 +466,61 @@ class AccountingAccount extends CommonObject return - 1; } } + + + /** + * Retourne le libelle du statut d'un user (actif, inactif) + * + * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto + * @return string Label of status + */ + function getLibStatut($mode=0) + { + return $this->LibStatut($this->status,$mode); + } + + /** + * Renvoi le libelle d'un statut donne + * + * @param int $statut Id statut + * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto + * @return string Label of status + */ + function LibStatut($statut,$mode=0) + { + global $langs; + $langs->load('users'); + + if ($mode == 0) + { + $prefix=''; + if ($statut == 1) return $langs->trans('Enabled'); + if ($statut == 0) return $langs->trans('Disabled'); + } + if ($mode == 1) + { + if ($statut == 1) return $langs->trans('Enabled'); + if ($statut == 0) return $langs->trans('Disabled'); + } + if ($mode == 2) + { + if ($statut == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); + if ($statut == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); + } + if ($mode == 3) + { + if ($statut == 1) return img_picto($langs->trans('Enabled'),'statut4'); + if ($statut == 0) return img_picto($langs->trans('Disabled'),'statut5'); + } + if ($mode == 4) + { + if ($statut == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); + if ($statut == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); + } + if ($mode == 5) + { + if ($statut == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4'); + if ($statut == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5'); + } + } } diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 6f4698413dc..a6f487c1211 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -53,7 +53,11 @@ class BookKeeping extends CommonObject * * @var string Name of table without prefix where object is stored */ - public $table_element = 'accounting_bookkeeping'; + public $table_element = 'accounting_bookkeeping'; + + + public $entity = 1; + /** * @@ -61,6 +65,7 @@ class BookKeeping extends CommonObject */ public $lines = array (); + /** * * @var int ID @@ -95,24 +100,23 @@ class BookKeeping extends CommonObject */ public function __construct(DoliDB $db) { $this->db = $db; - return 1; } /** * Create object into database * - * @param User $user User that creates - * @param bool $notrigger false=launch triggers after, true=disable triggers - * - * @return int <0 if KO, Id of created object if OK + * @param User $user User that creates + * @param bool $notrigger false=launch triggers after, true=disable triggers + * @return int <0 if KO, Id of created object if OK */ public function create(User $user, $notrigger = false) { + global $conf, $langs; + dol_syslog(__METHOD__, LOG_DEBUG); $error = 0; // Clean parameters - if (isset($this->doc_type)) { $this->doc_type = trim($this->doc_type); } @@ -158,6 +162,17 @@ class BookKeeping extends CommonObject if (isset($this->piece_num)) { $this->piece_num = trim($this->piece_num); } + if (empty($this->debit)) $this->debit = 0; + if (empty($this->credit)) $this->credit = 0; + + // Check parameters + if (empty($this->numero_compte) || $this->numero_compte == '-1') + { + $langs->load("errors"); + $this->errors[]=$langs->trans('ErrorFieldAccountNotDefinedForBankLine', $this->fk_docdet); + return -1; + } + $this->db->begin(); @@ -169,8 +184,10 @@ class BookKeeping extends CommonObject $sql .= " WHERE doc_type = '" . $this->doc_type . "'"; $sql .= " AND fk_docdet = " . $this->fk_docdet; $sql .= " AND numero_compte = '" . $this->numero_compte . "'"; + if (! empty($conf->multicompany->enabled)) { + $sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")"; + } - dol_syslog(get_class($this) . ":: create sql=" . $sql, LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -183,6 +200,9 @@ class BookKeeping extends CommonObject $sqlnum .= " WHERE doc_type = '" . $this->doc_type . "'"; $sqlnum .= " AND fk_docdet = '" . $this->fk_docdet . "'"; $sqlnum .= " AND doc_ref = '" . $this->doc_ref . "'"; + if (! empty($conf->multicompany->enabled)) { + $sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")"; + } dol_syslog(get_class($this) . ":: create sqlnum=" . $sqlnum, LOG_DEBUG); $resqlnum = $this->db->query($sqlnum); @@ -194,7 +214,10 @@ class BookKeeping extends CommonObject if (empty($this->piece_num)) { $sqlnum = "SELECT MAX(piece_num)+1 as maxpiecenum"; $sqlnum .= " FROM " . MAIN_DB_PREFIX . $this->table_element; - + if (! empty($conf->multicompany->enabled)) { + $sql .= " WHERE entity IN (" . getEntity("accountancy", 1) . ")"; + } + dol_syslog(get_class($this) . ":: create sqlnum=" . $sqlnum, LOG_DEBUG); $resqlnum = $this->db->query($sqlnum); if ($resqlnum) { @@ -213,7 +236,6 @@ class BookKeeping extends CommonObject } $sql = "INSERT INTO " . MAIN_DB_PREFIX . $this->table_element . " ("; - $sql .= "doc_date"; $sql .= ", doc_type"; $sql .= ", doc_ref"; @@ -230,10 +252,9 @@ class BookKeeping extends CommonObject $sql .= ", import_key"; $sql .= ", code_journal"; $sql .= ", piece_num"; - + $sql .= ', entity'; $sql .= ") VALUES ("; - - $sql .= "'" . $this->doc_date . "'"; + $sql .= "'" . $this->db->idate($this->doc_date) . "'"; $sql .= ",'" . $this->doc_type . "'"; $sql .= ",'" . $this->doc_ref . "'"; $sql .= "," . $this->fk_doc; @@ -246,10 +267,10 @@ class BookKeeping extends CommonObject $sql .= "," . $this->montant; $sql .= ",'" . $this->sens . "'"; $sql .= ",'" . $this->fk_user_author . "'"; - $sql .= ",'" . $this->date_create . "'"; + $sql .= ",'" . $this->db->idate($this->date_create). "'"; $sql .= ",'" . $this->code_journal . "'"; $sql .= "," . $this->piece_num; - + $sql .= ", " . (! isset($this->entity) ? '1' : $this->entity); $sql .= ")"; dol_syslog(get_class($this) . ":: create sql=" . $sql, LOG_DEBUG); @@ -272,11 +293,11 @@ class BookKeeping extends CommonObject $this->errors[] = 'Error ' . $this->db->lasterror(); dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR); } - } else { - $result = - 3; - $error ++; - $this->errors[] = 'Error ' . $this->db->lasterror(); - dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR); + } else { // Already exists + $result = -3; + $error++; + $this->errors[] = 'Error Transaction for ('.$this->doc_type.', '.$this->doc_ref.', '.$this->fk_docdet.') were already recorded'; + dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_WARNING); } } else { $result = - 5; @@ -313,10 +334,9 @@ class BookKeeping extends CommonObject /** * Create object into database * - * @param User $user User that creates - * @param bool $notrigger false=launch triggers after, true=disable triggers - * - * @return int <0 if KO, Id of created object if OK + * @param User $user User that creates + * @param bool $notrigger false=launch triggers after, true=disable triggers + * @return int <0 if KO, Id of created object if OK */ public function createStd(User $user, $notrigger = false) { dol_syslog(__METHOD__, LOG_DEBUG); @@ -370,13 +390,14 @@ class BookKeeping extends CommonObject if (isset($this->piece_num)) { $this->piece_num = trim($this->piece_num); } + if (empty($this->debit)) $this->debit = 0; + if (empty($this->credit)) $this->credit = 0; // Check parameters // Put here code to add control on parameters values // Insert request $sql = 'INSERT INTO ' . MAIN_DB_PREFIX . $this->table_element . '('; - $sql .= 'doc_date,'; $sql .= 'doc_type,'; $sql .= 'doc_ref,'; @@ -392,27 +413,26 @@ class BookKeeping extends CommonObject $sql .= 'fk_user_author,'; $sql .= 'import_key,'; $sql .= 'code_journal,'; - $sql .= 'piece_num'; - + $sql .= 'piece_num,'; + $sql .= 'entity'; $sql .= ') VALUES ('; - $sql .= ' ' . (! isset($this->doc_date) || dol_strlen($this->doc_date) == 0 ? 'NULL' : "'" . $this->db->idate($this->doc_date) . "'") . ','; $sql .= ' ' . (! isset($this->doc_type) ? 'NULL' : "'" . $this->db->escape($this->doc_type) . "'") . ','; $sql .= ' ' . (! isset($this->doc_ref) ? 'NULL' : "'" . $this->db->escape($this->doc_ref) . "'") . ','; $sql .= ' ' . (empty($this->fk_doc) ? '0' : $this->fk_doc) . ','; $sql .= ' ' . (empty($this->fk_docdet) ? '0' : $this->fk_docdet) . ','; $sql .= ' ' . (! isset($this->code_tiers) ? 'NULL' : "'" . $this->db->escape($this->code_tiers) . "'") . ','; - $sql .= ' ' . (! isset($this->numero_compte) ? 'NULL' : "'" . $this->db->escape($this->numero_compte) . "'") . ','; + $sql .= ' ' . (! isset($this->numero_compte) ? "'NotDefined'" : "'" . $this->db->escape($this->numero_compte) . "'") . ','; $sql .= ' ' . (! isset($this->label_compte) ? 'NULL' : "'" . $this->db->escape($this->label_compte) . "'") . ','; - $sql .= ' ' . (! isset($this->debit) ? 'NULL' : "'" . $this->debit . "'") . ','; - $sql .= ' ' . (! isset($this->credit) ? 'NULL' : "'" . $this->credit . "'") . ','; - $sql .= ' ' . (! isset($this->montant) ? 'NULL' : "'" . $this->montant . "'") . ','; + $sql .= ' ' . (! isset($this->debit) ? 'NULL' : $this->debit ). ','; + $sql .= ' ' . (! isset($this->credit) ? 'NULL' : $this->credit ). ','; + $sql .= ' ' . (! isset($this->montant) ? 'NULL' : $this->montant ). ','; $sql .= ' ' . (! isset($this->sens) ? 'NULL' : "'" . $this->db->escape($this->sens) . "'") . ','; $sql .= ' ' . $user->id . ','; $sql .= ' ' . (! isset($this->import_key) ? 'NULL' : "'" . $this->db->escape($this->import_key) . "'") . ','; - $sql .= ' ' . (! isset($this->code_journal) ? 'NULL' : "'" . $this->db->escape($this->code_journal) . "'") . ','; - $sql .= ' ' . (! isset($this->piece_num) ? 'NULL' : $this->piece_num); - + $sql .= ' ' . (empty($this->code_journal) ? 'NULL' : "'" . $this->db->escape($this->code_journal) . "'") . ','; + $sql .= ' ' . (empty($this->piece_num) ? 'NULL' : $this->piece_num).','; + $sql .= ' ' . (! isset($this->entity) ? '1' : $this->entity); $sql .= ')'; $this->db->begin(); @@ -459,11 +479,12 @@ class BookKeeping extends CommonObject * @return int <0 if KO, 0 if not found, >0 if OK */ public function fetch($id, $ref = null) { - dol_syslog(__METHOD__, LOG_DEBUG); + global $conf; + + dol_syslog(__METHOD__, LOG_DEBUG); $sql = 'SELECT'; $sql .= ' t.rowid,'; - $sql .= " t.doc_date,"; $sql .= " t.doc_type,"; $sql .= " t.doc_ref,"; @@ -480,12 +501,15 @@ class BookKeeping extends CommonObject $sql .= " t.import_key,"; $sql .= " t.code_journal,"; $sql .= " t.piece_num"; - $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t'; + $sql .= ' WHERE 1 = 1'; + if (! empty($conf->multicompany->enabled)) { + $sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")"; + } if (null !== $ref) { - $sql .= ' WHERE t.ref = ' . '\'' . $ref . '\''; + $sql .= ' AND t.ref = ' . '\'' . $ref . '\''; } else { - $sql .= ' WHERE t.rowid = ' . $id; + $sql .= ' AND t.rowid = ' . $id; } $resql = $this->db->query($sql); @@ -527,8 +551,8 @@ class BookKeeping extends CommonObject return - 1; } } - - /** + + /** * Load object in memory from the database * * @param string $sortorder Sort Order @@ -540,12 +564,13 @@ class BookKeeping extends CommonObject * * @return int <0 if KO, >0 if OK */ - public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND') { - dol_syslog(__METHOD__, LOG_DEBUG); + public function fetchAllByAccount($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND') { + global $conf; + + dol_syslog(__METHOD__, LOG_DEBUG); $sql = 'SELECT'; $sql .= ' t.rowid,'; - $sql .= " t.doc_date,"; $sql .= " t.doc_type,"; $sql .= " t.doc_ref,"; @@ -562,9 +587,120 @@ class BookKeeping extends CommonObject $sql .= " t.import_key,"; $sql .= " t.code_journal,"; $sql .= " t.piece_num"; + // Manage filter + $sqlwhere = array (); + if (count($filter) > 0) { + foreach ( $filter as $key => $value ) { + if ($key == 't.doc_date') { + $sqlwhere[] = $key . '=\'' . $this->db->idate($value) . '\''; + } elseif ($key == 't.doc_date>=' || $key == 't.doc_date<=') { + $sqlwhere[] = $key . '\'' . $this->db->idate($value) . '\''; + } elseif ($key == 't.numero_compte>=' || $key == 't.numero_compte<=' || $key == 't.code_tiers>=' || $key == 't.code_tiers<=') { + $sqlwhere[] = $key . '\'' . $this->db->escape($value) . '\''; + } elseif ($key == 't.fk_doc' || $key == 't.fk_docdet' || $key == 't.piece_num') { + $sqlwhere[] = $key . '=' . $value; + } elseif ($key == 't.code_tiers' || $key == 't.numero_compte') { + $sqlwhere[] = $key . ' LIKE \'' . $this->db->escape($value) . '%\''; + } elseif ($key == 't.label_compte') { + $sqlwhere[] = $key . ' LIKE \'' . $this->db->escape($value) . '%\''; + }else { + $sqlwhere[] = $key . ' LIKE \'%' . $this->db->escape($value) . '%\''; + } + } + } + $sql.= ' WHERE 1 = 1'; + if (! empty($conf->multicompany->enabled)) { + $sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")"; + } + if (count($sqlwhere) > 0) { + $sql .= ' AND ' . implode(' ' . $filtermode . ' ', $sqlwhere); + } + // Affichage par compte comptable + $sql .= ' ORDER BY t.numero_compte ASC'; + if (! empty($sortfield)) { + $sql .= ', ' . $sortfield . ' ' .$sortorder; + } + if (! empty($limit)) { + $sql .= ' ' . $this->db->plimit($limit + 1, $offset); + } + $this->lines = array (); + $resql = $this->db->query($sql); + if ($resql) { + $num = $this->db->num_rows($resql); + + while ( $obj = $this->db->fetch_object($resql) ) { + $line = new BookKeepingLine(); + + $line->id = $obj->rowid; + + $line->doc_date = $this->db->jdate($obj->doc_date); + $line->doc_type = $obj->doc_type; + $line->doc_ref = $obj->doc_ref; + $line->fk_doc = $obj->fk_doc; + $line->fk_docdet = $obj->fk_docdet; + $line->code_tiers = $obj->code_tiers; + $line->numero_compte = $obj->numero_compte; + $line->label_compte = $obj->label_compte; + $line->debit = $obj->debit; + $line->credit = $obj->credit; + $line->montant = $obj->montant; + $line->sens = $obj->sens; + $line->fk_user_author = $obj->fk_user_author; + $line->import_key = $obj->import_key; + $line->code_journal = $obj->code_journal; + $line->piece_num = $obj->piece_num; + + $this->lines[] = $line; + } + $this->db->free($resql); + + return $num; + } else { + $this->errors[] = 'Error ' . $this->db->lasterror(); + dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR); + + return - 1; + } + } + + + /** + * Load object in memory from the database + * + * @param string $sortorder Sort Order + * @param string $sortfield Sort field + * @param int $limit offset limit + * @param int $offset offset limit + * @param array $filter filter array + * @param string $filtermode filter mode (AND or OR) + * + * @return int <0 if KO, >0 if OK + */ + public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND') { + global $conf; + + dol_syslog(__METHOD__, LOG_DEBUG); + + $sql = 'SELECT'; + $sql .= ' t.rowid,'; + $sql .= " t.doc_date,"; + $sql .= " t.doc_type,"; + $sql .= " t.doc_ref,"; + $sql .= " t.fk_doc,"; + $sql .= " t.fk_docdet,"; + $sql .= " t.code_tiers,"; + $sql .= " t.numero_compte,"; + $sql .= " t.label_compte,"; + $sql .= " t.debit,"; + $sql .= " t.credit,"; + $sql .= " t.montant,"; + $sql .= " t.sens,"; + $sql .= " t.fk_user_author,"; + $sql .= " t.import_key,"; + $sql .= " t.code_journal,"; + $sql .= " t.piece_num"; $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t'; - // Manage filter $sqlwhere = array (); if (count($filter) > 0) { @@ -584,9 +720,12 @@ class BookKeeping extends CommonObject } } } - + $sql.= ' WHERE 1 = 1'; + if (! empty($conf->multicompany->enabled)) { + $sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")"; + } if (count($sqlwhere) > 0) { - $sql .= ' WHERE ' . implode(' ' . $filtermode . ' ', $sqlwhere); + $sql .= ' AND ' . implode(' ' . $filtermode . ' ', $sqlwhere); } if (! empty($sortfield)) { @@ -649,16 +788,15 @@ class BookKeeping extends CommonObject * @return int <0 if KO, >0 if OK */ public function fetchAllBalance($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND') { - dol_syslog(__METHOD__, LOG_DEBUG); + global $conf; + + dol_syslog(__METHOD__, LOG_DEBUG); $sql = 'SELECT'; $sql .= " t.numero_compte,"; $sql .= " SUM(t.debit) as debit,"; $sql .= " SUM(t.credit) as credit"; - - $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t'; - // Manage filter $sqlwhere = array (); if (count($filter) > 0) { @@ -678,15 +816,18 @@ class BookKeeping extends CommonObject } } } - - if (count($sqlwhere) > 0) { - $sql .= ' WHERE ' . implode(' ' . $filtermode . ' ', $sqlwhere); + $sql.= ' WHERE 1 = 1'; + if (! empty($conf->multicompany->enabled)) { + $sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")"; } - + if (count($sqlwhere) > 0) { + $sql .= ' AND ' . implode(' ' . $filtermode . ' ', $sqlwhere); + } + $sql .= ' GROUP BY t.numero_compte'; if (! empty($sortfield)) { - $sql .= $this->db->order($sortfield, $sortorder); + $sql .= $this->db->order($sortfield, $sortorder); } if (! empty($limit)) { $sql .= ' ' . $this->db->plimit($limit + 1, $offset); @@ -782,7 +923,6 @@ class BookKeeping extends CommonObject // Update request $sql = 'UPDATE ' . MAIN_DB_PREFIX . $this->table_element . ' SET'; - $sql .= ' doc_date = ' . (! isset($this->doc_date) || dol_strlen($this->doc_date) != 0 ? "'" . $this->db->idate($this->doc_date) . "'" : 'null') . ','; $sql .= ' doc_type = ' . (isset($this->doc_type) ? "'" . $this->db->escape($this->doc_type) . "'" : "null") . ','; $sql .= ' doc_ref = ' . (isset($this->doc_ref) ? "'" . $this->db->escape($this->doc_ref) . "'" : "null") . ','; @@ -799,7 +939,6 @@ class BookKeeping extends CommonObject $sql .= ' import_key = ' . (isset($this->import_key) ? "'" . $this->db->escape($this->import_key) . "'" : "null") . ','; $sql .= ' code_journal = ' . (isset($this->code_journal) ? "'" . $this->db->escape($this->code_journal) . "'" : "null") . ','; $sql .= ' piece_num = ' . (isset($this->piece_num) ? $this->piece_num : "null"); - $sql .= ' WHERE rowid=' . $this->id; $this->db->begin(); @@ -887,7 +1026,7 @@ class BookKeeping extends CommonObject /** * Delete bookkepping by importkey * - * @param string $importkey Import key + * @param string $importkey Import key * @return int Result */ function deleteByImportkey($importkey) { @@ -902,10 +1041,7 @@ class BookKeeping extends CommonObject if (! $resql) { $this->errors[] = "Error " . $this->db->lasterror(); - foreach ( $this->errors as $errmsg ) { - dol_syslog(get_class($this) . "::delete " . $errmsg, LOG_ERR); - $this->error .= ($this->error ? ', ' . $errmsg : $errmsg); - } + dol_syslog(get_class($this)."::delete Error " . $this->db->lasterror(), LOG_ERR); $this->db->rollback(); return - 1; } @@ -917,17 +1053,29 @@ class BookKeeping extends CommonObject /** * Delete bookkepping by year * - * @param string $delyear year to delete - * @return int Result + * @param string $delyear Year to delete + * @param string $journal Journal to delete + * @return int <0 if KO, >0 if OK */ - function deleteByYear($delyear) { + function deleteByYearAndJournal($delyear='', $journal='') { + global $conf; + + if (empty($delyear) && empty($journal)) + { + return -1; + } + $this->db->begin(); // first check if line not yet in bookkeeping $sql = "DELETE"; - $sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element; - $sql .= " WHERE YEAR(doc_date) = " . $delyear; - + $sql.= " FROM " . MAIN_DB_PREFIX . $this->table_element; + $sql.= " WHERE 1 = 1"; + if (! empty($delyear)) $sql.= " AND YEAR(doc_date) = " . $delyear; // FIXME Must use between + if (! empty($journal)) $sql.= " AND code_journal = '".$journal."'"; + if (! empty($conf->multicompany->enabled)) { + $sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")"; + } $resql = $this->db->query($sql); if (! $resql) { @@ -937,7 +1085,7 @@ class BookKeeping extends CommonObject $this->error .= ($this->error ? ', ' . $errmsg : $errmsg); } $this->db->rollback(); - return - 1; + return -1; } $this->db->commit(); @@ -951,12 +1099,17 @@ class BookKeeping extends CommonObject * @return int Result */ function deleteMvtNum($piecenum) { + global $conf; + $this->db->begin(); // first check if line not yet in bookkeeping $sql = "DELETE"; $sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element; $sql .= " WHERE piece_num = " . $piecenum; + if (! empty($conf->multicompany->enabled)) { + $sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")"; + } $resql = $this->db->query($sql); @@ -1054,9 +1207,14 @@ class BookKeeping extends CommonObject * @return int <0 if KO, >0 if OK */ public function fetchPerMvt($piecenum) { - $sql = "SELECT piece_num,doc_date,code_journal,doc_ref,doc_type"; + global $conf; + + $sql = "SELECT piece_num,doc_date,code_journal,doc_ref,doc_type"; $sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element; $sql .= " WHERE piece_num = " . $piecenum; + if (! empty($conf->multicompany->enabled)) { + $sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")"; + } dol_syslog(get_class($this) . "::" . __METHOD__, LOG_DEBUG); $result = $this->db->query($sql); @@ -1080,18 +1238,25 @@ class BookKeeping extends CommonObject /** * Return next number movement * - * @return string Last number + * @return string Next numero to use */ - public function getNextNumMvt() { + public function getNextNumMvt() + { + global $conf; + $sql = "SELECT MAX(piece_num)+1 as max FROM " . MAIN_DB_PREFIX . $this->table_element; + if (! empty($conf->multicompany->enabled)) { + $sql .= " WHERE entity IN (" . getEntity("accountancy", 1) . ")"; + } dol_syslog(get_class($this) . "getNextNumMvt sql=" . $sql, LOG_DEBUG); $result = $this->db->query($sql); - + if ($result) { $obj = $this->db->fetch_object($result); - - return $obj->max; + if ($obj) $result = $obj->max; + if (empty($result)) $result = 1; + return $result; } else { $this->error = "Error " . $this->db->lasterror(); dol_syslog(get_class($this) . "::getNextNumMvt " . $this->error, LOG_ERR); @@ -1106,12 +1271,17 @@ class BookKeeping extends CommonObject * @return int <0 if KO, >0 if OK */ function fetch_all_per_mvt($piecenum) { + global $conf; + $sql = "SELECT rowid, doc_date, doc_type,"; $sql .= " doc_ref, fk_doc, fk_docdet, code_tiers,"; $sql .= " numero_compte, label_compte, debit, credit,"; $sql .= " montant, sens, fk_user_author, import_key, code_journal, piece_num"; $sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element; $sql .= " WHERE piece_num = " . $piecenum; + if (! empty($conf->multicompany->enabled)) { + $sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")"; + } dol_syslog(get_class($this) . "::" . __METHOD__, LOG_DEBUG); $result = $this->db->query($sql); @@ -1156,11 +1326,16 @@ class BookKeeping extends CommonObject * @return int Result */ function export_bookkeping($model = 'ebp') { + global $conf; + $sql = "SELECT rowid, doc_date, doc_type,"; $sql .= " doc_ref, fk_doc, fk_docdet, code_tiers,"; $sql .= " numero_compte, label_compte, debit, credit,"; $sql .= " montant, sens, fk_user_author, import_key, code_journal, piece_num"; $sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element; + if (! empty($conf->multicompany->enabled)) { + $sql .= " WHERE entity IN (" . getEntity("accountancy", 1) . ")"; + } dol_syslog(get_class($this) . "::export_bookkeping", LOG_DEBUG); @@ -1201,18 +1376,136 @@ class BookKeeping extends CommonObject return - 1; } } + + + + /** + * Return list of accounts with label by chart of accounts + * + * @param string $selectid Preselected chart of accounts + * @param string $htmlname Name of field in html form + * @param int $showempty Add an empty field + * @param array $event Event options + * @param int $select_in Value is a aa.rowid (0 default) or aa.account_number (1) + * @param int $select_out Set value returned by select 0=rowid (default), 1=account_number + * @param int $aabase Set accounting_account base class to display empty=all or from 1 to 8 will display only account beginning by this number + * @return string String with HTML select + */ + function select_account($selectid, $htmlname = 'account', $showempty = 0, $event = array(), $select_in = 0, $select_out = 0, $aabase = '') { + global $conf; + + require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; + + $pcgver = $conf->global->CHARTOFACCOUNTS; + + $sql = "SELECT DISTINCT ab.numero_compte as account_number, aa.label as label, aa.rowid as rowid, aa.fk_pcg_version"; + $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab"; + $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.account_number = ab.numero_compte"; + $sql .= " AND aa.active = 1"; + $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version"; + $sql .= " AND asy.rowid = " . $pcgver; + if (! empty($conf->multicompany->enabled)) { + $sql .= " AND ab.entity IN (" . getEntity("accountancy", 1) . ")"; + } + $sql .= " ORDER BY account_number ASC"; + + dol_syslog(get_class($this) . "::select_account", LOG_DEBUG); + $resql = $this->db->query($sql); + + if (! $resql) { + $this->error = "Error " . $this->db->lasterror(); + dol_syslog(get_class($this) . "::select_account " . $this->error, LOG_ERR); + return - 1; + } + + $out = ajax_combobox($htmlname, $event); + + $options = array(); + $selected = null; + + while ($obj = $this->db->fetch_object($resql)) { + $label = length_accountg($obj->account_number) . ' - ' . $obj->label; + + $select_value_in = $obj->rowid; + $select_value_out = $obj->rowid; + + if ($select_in == 1) { + $select_value_in = $obj->account_number; + } + if ($select_out == 1) { + $select_value_out = $obj->account_number; + } + + // Remember guy's we store in database llx_facturedet the rowid of accounting_account and not the account_number + // Because same account_number can be share between different accounting_system and do have the same meaning + if (($selectid != '') && $selectid == $select_value_in) { + $selected = $select_value_out; + } + + $options[$select_value_out] = $label; + } + + $out .= Form::selectarray($htmlname, $options, $selected, $showempty, 0, 0, '', 0, 0, 0, '', 'maxwidth300'); + $this->db->free($resql); + return $out; + } + + /** + * Description of a root accounting account + * + * @param string $account Accounting account + * @return string Root account + */ + function get_compte_racine($account = null) + { + global $conf; + $pcgver = $conf->global->CHARTOFACCOUNTS; + + $sql = "SELECT root.account_number, root.label as label"; + $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa"; + $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version"; + $sql .= " AND asy.rowid = " . $pcgver; + $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as parent ON aa.account_parent = parent.rowid"; + $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as root ON parent.account_parent = root.rowid"; + $sql .= " WHERE aa.account_number = '" . $account . "'"; + $sql .= " AND parent.active = 1"; + $sql .= " AND root.active = 1"; + if (! empty($conf->multicompany->enabled)) { + $sql .= " AND aa.entity IN (" . getEntity("accountancy", 1) . ")"; + } + + dol_syslog(get_class($this) . "::select_account sql=" . $sql, LOG_DEBUG); + $resql = $this->db->query($sql); + if ($resql) { + $obj = ''; + if ($this->db->num_rows($resql)) { + $obj = $this->db->fetch_object($resql); + } + + return $obj->label; + + } else { + $this->error = "Error " . $this->db->lasterror(); + dol_syslog(__METHOD__ . " " . $this->error, LOG_ERR); + + return -1; + } + } + + + /** * Description of accounting account * * @param string $account Accounting account - * @return string + * @return string Account desc */ function get_compte_desc($account = null) { global $conf; + $pcgver = $conf->global->CHARTOFACCOUNTS; - $sql = "SELECT aa.account_number, aa.label, aa.rowid, aa.fk_pcg_version, cat.label as category"; $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa "; $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version"; @@ -1220,7 +1513,10 @@ class BookKeeping extends CommonObject $sql .= " AND asy.rowid = " . $pcgver; $sql .= " AND aa.active = 1"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_accounting_category as cat ON aa.fk_accounting_category = cat.rowid"; - + if (! empty($conf->multicompany->enabled)) { + $sql .= " WHERE aa.entity IN (" . getEntity("accountancy", 1) . ")"; + } + dol_syslog(get_class($this) . "::select_account sql=" . $sql, LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -1238,13 +1534,13 @@ class BookKeeping extends CommonObject } else { $this->error = "Error " . $this->db->lasterror(); dol_syslog(__METHOD__ . " " . $this->error, LOG_ERR); - return -1; } } } + /** * Class BookKeepingLine */ diff --git a/htdocs/accountancy/class/html.formventilation.class.php b/htdocs/accountancy/class/html.formventilation.class.php index e3ae592a47f..ac72df44e21 100644 --- a/htdocs/accountancy/class/html.formventilation.class.php +++ b/htdocs/accountancy/class/html.formventilation.class.php @@ -41,6 +41,9 @@ class FormVentilation extends Form $options = array(); $sql = 'SELECT DISTINCT import_key from ' . MAIN_DB_PREFIX . 'accounting_bookkeeping'; + if (! empty($conf->multicompany->enabled)) { + $sql .= " WHERE entity IN (" . getEntity("accountancy", 1) . ")"; + } $sql .= ' ORDER BY import_key DESC'; dol_syslog(get_class($this) . "::select_bookkeeping_importkey", LOG_DEBUG); @@ -58,34 +61,33 @@ class FormVentilation extends Form return Form::selectarray($htmlname, $options, $selectedkey); } - + /** * Return list of accounts with label by chart of accounts * - * @param string $selectid Preselected chart of accounts - * @param string $htmlname Name of field in html form - * @param int $showempty Add an empty field - * @param array $event Event options - * @param int $select_in $selectid value is a aa.rowid (0 default) or aa.account_number (1) - * @param int $select_out set value returned by select 0=rowid (default), 1=account_number - * @param int $aabase set accounting_account base class to display empty=all or from 1 to 8 will display only account beginning by this number - * + * @param string $selectid Preselected chart of accounts + * @param string $htmlname Name of field in html form + * @param int $showempty Add an empty field + * @param array $event Event options + * @param int $select_in selectid value is a aa.rowid (0 default) or aa.account_number (1) + * @param int $select_out set value returned by select 0=rowid (default), 1=account_number + * @param string $morecss More css non HTML object * @return string String with HTML select */ - function select_account($selectid, $htmlname = 'account', $showempty = 0, $event = array(), $select_in = 0, $select_out = 0, $aabase = '') { + function select_account($selectid, $htmlname = 'account', $showempty = 0, $event = array(), $select_in = 0, $select_out = 0, $morecss='maxwidth300 maxwidthonsmartphone') { global $conf; - + require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; $trunclength = defined('ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT') ? $conf->global->ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT : 50; - + $sql = "SELECT DISTINCT aa.account_number, aa.label, aa.rowid, aa.fk_pcg_version"; $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa"; $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version"; $sql .= " AND asy.rowid = " . $conf->global->CHARTOFACCOUNTS; $sql .= " AND aa.active = 1"; $sql .= " ORDER BY aa.account_number"; - + dol_syslog(get_class($this) . "::select_account", LOG_DEBUG); $resql = $this->db->query($sql); @@ -123,11 +125,11 @@ class FormVentilation extends Form $options[$select_value_out] = $label; } - $out .= Form::selectarray($htmlname, $options, $selected, $showempty, 0, 0, '', 0, 0, 0, '', 'maxwidth300'); + $out .= Form::selectarray($htmlname, $options, $selected, $showempty, 0, 0, '', 0, 0, 0, '', $morecss, 1); $this->db->free($resql); return $out; } - + /** * Return list of accounts with label by class of accounts * @@ -135,18 +137,18 @@ class FormVentilation extends Form * @param string $htmlname Name of field in html form * @param int $showempty Add an empty field * @param array $event Event options - * + * * @return string String with HTML select */ function select_pcgtype($selectid, $htmlname = 'pcg_type', $showempty = 0, $event = array()) { global $conf; - + $sql = "SELECT DISTINCT pcg_type "; $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa"; $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version"; $sql .= " AND asy.rowid = " . $conf->global->CHARTOFACCOUNTS; $sql .= " ORDER BY pcg_type"; - + dol_syslog(get_class($this) . "::select_pcgtype", LOG_DEBUG); $resql = $this->db->query($sql); @@ -168,7 +170,7 @@ class FormVentilation extends Form $this->db->free($resql); return $out; } - + /** * Return list of accounts with label by sub_class of accounts * @@ -176,18 +178,18 @@ class FormVentilation extends Form * @param string $htmlname Name of field in html form * @param int $showempty Add an empty field * @param array $event Event options - * + * * @return string String with HTML select */ function select_pcgsubtype($selectid, $htmlname = 'pcg_subtype', $showempty = 0, $event = array()) { global $conf; - + $sql = "SELECT DISTINCT pcg_subtype "; $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa"; $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version"; $sql .= " AND asy.rowid = " . $conf->global->CHARTOFACCOUNTS; $sql .= " ORDER BY pcg_subtype"; - + dol_syslog(get_class($this) . "::select_pcgsubtype", LOG_DEBUG); $resql = $this->db->query($sql); @@ -209,7 +211,7 @@ class FormVentilation extends Form $this->db->free($resql); return $out; } - + /** * Return list of auxilary thirdparty accounts * @@ -217,7 +219,7 @@ class FormVentilation extends Form * @param string $htmlname Name of field in html form * @param int $showempty Add an empty field * @param array $event Event options - * + * * @return string String with HTML select */ function select_auxaccount($selectid, $htmlname = 'account_num_aux', $showempty = 0, $event = array()) { @@ -227,6 +229,9 @@ class FormVentilation extends Form // Auxiliary customer account $sql = "SELECT DISTINCT code_compta, nom "; $sql .= " FROM ".MAIN_DB_PREFIX."societe"; + if (! empty($conf->multicompany->enabled)) { + $sql .= " WHERE entity IN (" . getEntity("societe", 1) . ")"; + } $sql .= " ORDER BY code_compta"; dol_syslog(get_class($this)."::select_auxaccount", LOG_DEBUG); $resql = $this->db->query($sql); @@ -246,7 +251,10 @@ class FormVentilation extends Form // Auxiliary supplier account $sql = "SELECT DISTINCT code_compta_fournisseur, nom "; $sql .= " FROM ".MAIN_DB_PREFIX."societe"; - $sql .= " ORDER BY code_compta"; + if (! empty($conf->multicompany->enabled)) { + $sql .= " WHERE entity IN (" . getEntity("societe", 1) . ")"; + } + $sql .= " ORDER BY code_compta_fournisseur"; dol_syslog(get_class($this)."::select_auxaccount", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -268,7 +276,7 @@ class FormVentilation extends Form return $out; } - + /** * Return HTML combo list of years existing into book keepping * @@ -280,11 +288,16 @@ class FormVentilation extends Form */ function selectyear_accountancy_bookkepping($selected = '', $htmlname = 'yearid', $useempty = 0, $output_format = 'html') { + global $conf; + $out_array = array(); $sql = "SELECT DISTINCT date_format(doc_date,'%Y') as dtyear"; $sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping"; - $sql .= " ORDER BY doc_date"; + if (! empty($conf->multicompany->enabled)) { + $sql .= " WHERE entity IN (" . getEntity("accountancy", 1) . ")"; + } + $sql .= " ORDER BY date_format(doc_date,'%Y')"; dol_syslog(get_class($this)."::".__METHOD__, LOG_DEBUG); $resql = $this->db->query($sql); @@ -304,4 +317,45 @@ class FormVentilation extends Form return $out_array; } } + + /** + * Return HTML combo list of years existing into book keepping + * + * @param string $selected Preselected value + * @param string $htmlname Name of HTML select object + * @param int $useempty Affiche valeur vide dans liste + * @param string $output_format Html/option (for option html only)/array (to return options arrays + * @return string/array + */ + function selectjournal_accountancy_bookkepping($selected = '', $htmlname = 'journalid', $useempty = 0, $output_format = 'html') + { + global $conf,$langs; + + $out_array = array(); + + $sql = "SELECT DISTINCT code_journal"; + $sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping"; + if (! empty($conf->multicompany->enabled)) { + $sql .= " WHERE entity IN (" . getEntity("accountancy", 1) . ")"; + } + $sql .= " ORDER BY code_journal"; + dol_syslog(get_class($this)."::".__METHOD__, LOG_DEBUG); + $resql = $this->db->query($sql); + + if (!$resql) { + $this->error = "Error ".$this->db->lasterror(); + dol_syslog(get_class($this)."::".__METHOD__.$this->error, LOG_ERR); + return -1; + } + while ($obj = $this->db->fetch_object($resql)) { + $out_array[$obj->code_journal] = $obj->code_journal?$obj->code_journal:$langs->trans("NotDefined"); // TODO Not defined is accepted ? We should avoid this, shouldn't we ? + } + $this->db->free($resql); + + if ($output_format == 'html') { + return Form::selectarray($htmlname, $out_array, $selected, $useempty, 0, 0, 'placeholder="aa"'); + } else { + return $out_array; + } + } } diff --git a/htdocs/accountancy/customer/card.php b/htdocs/accountancy/customer/card.php index c49dd7ce78a..ba6173d8ebf 100644 --- a/htdocs/accountancy/customer/card.php +++ b/htdocs/accountancy/customer/card.php @@ -40,26 +40,35 @@ $id = GETPOST('id'); if ($user->societe_id > 0) accessforbidden(); - /* + + +/* * Actions */ -if ($action == 'ventil' && $user->rights->accounting->ventilation->dispatch) { + +if ($action == 'ventil' && $user->rights->accounting->bind->write) { if (! GETPOST('cancel', 'alpha')) { + if ($codeventil < 0) $codeventil = 0; + $sql = " UPDATE " . MAIN_DB_PREFIX . "facturedet"; $sql .= " SET fk_code_ventilation = " . $codeventil; $sql .= " WHERE rowid = " . $id; - dol_syslog("/accounting/customer/card.php sql=" . $sql, LOG_DEBUG); $resql = $db->query($sql); if (! $resql) { setEventMessages($db->lasterror(), null, 'errors'); } + else + { + setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs'); + } } else { header("Location: ./lines.php"); exit(); } } + /* * View */ @@ -86,9 +95,7 @@ if (! empty($id)) { $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON l.fk_code_ventilation = aa.rowid"; $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = l.fk_facture"; $sql .= " WHERE f.fk_statut > 0 AND l.rowid = " . $id; - if (! empty($conf->multicompany->enabled)) { - $sql .= " AND f.entity IN (" . getEntity("facture", 1) . ")"; - } + $sql .= " AND f.entity IN (" . getEntity("facture", 0) . ")"; // We don't share object for accountancy dol_syslog("/accounting/customer/card.php sql=" . $sql, LOG_DEBUG); $result = $db->query($sql); diff --git a/htdocs/accountancy/customer/index.php b/htdocs/accountancy/customer/index.php index d5f913ae0dd..08677974a6d 100644 --- a/htdocs/accountancy/customer/index.php +++ b/htdocs/accountancy/customer/index.php @@ -21,13 +21,12 @@ */ /** - * \file htdocs/accountancy/customer/index.php - * \ingroup Advanced accountancy - * \brief Home customer ventilation + * \file htdocs/accountancy/customer/index.php + * \ingroup Advanced accountancy + * \brief Home customer ventilation */ -require '../../main.inc.php'; -// Class +require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; @@ -39,11 +38,14 @@ $langs->load("main"); $langs->load("accountancy"); // Security check +if (empty($conf->accounting->enabled)) { + accessforbidden(); +} if ($user->societe_id > 0) accessforbidden(); -if (! $user->rights->accounting->ventilation->read) +if (! $user->rights->accounting->bind->write) accessforbidden(); - + // Filter $year = $_GET["year"]; if ($year == 0) { @@ -56,18 +58,36 @@ if ($year == 0) { // Validate History $action = GETPOST('action'); + + + +/* + * Actions + */ + if ($action == 'validatehistory') { - + $error = 0; $db->begin(); - + + // First clean corrupted data + $sqlclean = "UPDATE " . MAIN_DB_PREFIX . "facturedet as fd"; + $sqlclean .= " SET fd.fk_code_ventilation = 0"; + $sqlclean .= ' WHERE fd.fk_code_ventilation NOT IN '; + $sqlclean .= ' (SELECT accnt.rowid '; + $sqlclean .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as accnt'; + $sqlclean .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'accounting_system as syst'; + $sqlclean .= ' ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=' . $conf->global->CHARTOFACCOUNTS . ')'; + $resql = $db->query($sqlclean); + + // Now make the binding 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 +95,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 ++; @@ -85,12 +105,12 @@ if ($action == 'validatehistory') { setEventMessages($db->lasterror(), null, 'errors'); } else { $db->commit(); - setEventMessages($langs->trans('Dispatched'), null, 'mesgs'); + setEventMessages($langs->trans('AutomaticBindingDone'), null, 'mesgs'); } } 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 +118,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 ++; @@ -114,14 +134,15 @@ if ($action == 'validatehistory') { $error = 0; $db->begin(); + // Now clean $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)) . "')"; - + $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 ++; @@ -133,21 +154,26 @@ if ($action == 'validatehistory') { } } + /* * View */ + llxHeader('', $langs->trans("CustomersVentilation")); $textprevyear = '' . img_previous() . ''; $textnextyear = ' ' . img_next() . ''; -print load_fiche_titre($langs->trans("CustomersVentilation") . " " . $textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear); +print load_fiche_titre($langs->trans("CustomersVentilation") . " " . $textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear, '', 'title_accountancy'); -print '' . $langs->trans("DescVentilCustomer") . ''; +print $langs->trans("DescVentilCustomer") . '
'; +print $langs->trans("DescVentilMore", $langs->transnoentitiesnoconv("ValidateHistory"), $langs->transnoentitiesnoconv("ToBind")) . '
'; +print '
'; print '
'; print '' . $langs->trans("ValidateHistory") . ''; -print '' . $langs->trans("CleanFixHistory", $year_current) . ''; -print '' . $langs->trans("CleanHistory", $year_current) . ''; +print '' . $langs->trans("CleanHistory", $year_current) . ''; +// TODO Remove this. Should be done into the repair.php script +if ($conf->global->MAIN_FEATURES_LEVEL > 0) print '' . $langs->trans("CleanFixHistory", $year_current) . ''; print '
'; $sql = "SELECT count(*) FROM " . MAIN_DB_PREFIX . "facturedet as fd"; @@ -170,75 +196,42 @@ $var = true; print ''; print ''; print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; +for($i = 1; $i <= 12; $i ++) { + print ''; +} +print ''; - -//TODO : Cannot work with PGSQL !, Change that with php treatment rather than big SQL query -$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(f.datef)=1,fd.total_ht,0)),2) AS 'Janvier',"; -$sql .= " ROUND(SUM(IF(MONTH(f.datef)=2,fd.total_ht,0)),2) AS 'Fevrier',"; -$sql .= " ROUND(SUM(IF(MONTH(f.datef)=3,fd.total_ht,0)),2) AS 'Mars',"; -$sql .= " ROUND(SUM(IF(MONTH(f.datef)=4,fd.total_ht,0)),2) AS 'Avril',"; -$sql .= " ROUND(SUM(IF(MONTH(f.datef)=5,fd.total_ht,0)),2) AS 'Mai',"; -$sql .= " ROUND(SUM(IF(MONTH(f.datef)=6,fd.total_ht,0)),2) AS 'Juin',"; -$sql .= " ROUND(SUM(IF(MONTH(f.datef)=7,fd.total_ht,0)),2) AS 'Juillet',"; -$sql .= " ROUND(SUM(IF(MONTH(f.datef)=8,fd.total_ht,0)),2) AS 'Aout',"; -$sql .= " ROUND(SUM(IF(MONTH(f.datef)=9,fd.total_ht,0)),2) AS 'Septembre',"; -$sql .= " ROUND(SUM(IF(MONTH(f.datef)=10,fd.total_ht,0)),2) AS 'Octobre',"; -$sql .= " ROUND(SUM(IF(MONTH(f.datef)=11,fd.total_ht,0)),2) AS 'Novembre',"; -$sql .= " ROUND(SUM(IF(MONTH(f.datef)=12,fd.total_ht,0)),2) AS 'Decembre',"; -$sql .= " ROUND(SUM(fd.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(f.datef)=' . $i, 'fd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ","; +} +$sql .= " SUM(fd.total_ht) as total"; $sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as fd"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = fd.fk_code_ventilation"; $sql .= " WHERE f.datef >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'"; $sql .= " AND f.datef <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'"; +$sql .= " AND f.entity IN (" . getEntity("facture", 0) . ")"; // We don't share object for accountancy -if (! empty($conf->multicompany->enabled)) { - $sql .= " AND f.entity IN (" . getEntity("facture", 1) . ")"; -} - -$sql .= " GROUP BY fd.fk_code_ventilation"; +$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 ''; print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + for($i = 2; $i <= 12; $i ++) { + print ''; + } print ''; print ''; print ''; - $i ++; } $db->free($resql); } else { @@ -249,65 +242,33 @@ print "
' . $langs->trans("Account") . '' . $langs->trans("Label") . '' . $langs->trans("JanuaryMin") . '' . $langs->trans("FebruaryMin") . '' . $langs->trans("MarchMin") . '' . $langs->trans("AprilMin") . '' . $langs->trans("MayMin") . '' . $langs->trans("JuneMin") . '' . $langs->trans("JulyMin") . '' . $langs->trans("AugustMin") . '' . $langs->trans("SeptemberMin") . '' . $langs->trans("OctoberMin") . '' . $langs->trans("NovemberMin") . '' . $langs->trans("DecemberMin") . '' . $langs->trans("Total") . '
' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '' . $langs->trans("Total") . '
' . length_accountg($row[0]) . '' . $row[1] . '' . price($row[2]) . '' . price($row[3]) . '' . price($row[4]) . '' . price($row[5]) . '' . price($row[6]) . '' . price($row[7]) . '' . price($row[8]) . '' . price($row[9]) . '' . price($row[10]) . '' . price($row[11]) . '' . price($row[12]) . '' . price($row[$i]) . '' . price($row[13]) . '' . price($row[14]) . '
\n"; print "
\n"; print ''; print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; +for($i = 1; $i <= 12; $i ++) { + print ''; +} +print ''; -$sql = "SELECT '" . $langs->trans("TotalVente") . "' AS 'Total',"; -$sql .= " ROUND(SUM(IF(MONTH(f.datef)=1,fd.total_ht,0)),2) AS 'Janvier',"; -$sql .= " ROUND(SUM(IF(MONTH(f.datef)=2,fd.total_ht,0)),2) AS 'Fevrier',"; -$sql .= " ROUND(SUM(IF(MONTH(f.datef)=3,fd.total_ht,0)),2) AS 'Mars',"; -$sql .= " ROUND(SUM(IF(MONTH(f.datef)=4,fd.total_ht,0)),2) AS 'Avril',"; -$sql .= " ROUND(SUM(IF(MONTH(f.datef)=5,fd.total_ht,0)),2) AS 'Mai',"; -$sql .= " ROUND(SUM(IF(MONTH(f.datef)=6,fd.total_ht,0)),2) AS 'Juin',"; -$sql .= " ROUND(SUM(IF(MONTH(f.datef)=7,fd.total_ht,0)),2) AS 'Juillet',"; -$sql .= " ROUND(SUM(IF(MONTH(f.datef)=8,fd.total_ht,0)),2) AS 'Aout',"; -$sql .= " ROUND(SUM(IF(MONTH(f.datef)=9,fd.total_ht,0)),2) AS 'Septembre',"; -$sql .= " ROUND(SUM(IF(MONTH(f.datef)=10,fd.total_ht,0)),2) AS 'Octobre',"; -$sql .= " ROUND(SUM(IF(MONTH(f.datef)=11,fd.total_ht,0)),2) AS 'Novembre',"; -$sql .= " ROUND(SUM(IF(MONTH(f.datef)=12,fd.total_ht,0)),2) AS 'Decembre',"; -$sql .= " ROUND(SUM(fd.total_ht),2) as 'Total'"; +$sql = "SELECT '" . $langs->trans("TotalVente") . "' AS total,"; +for($i = 1; $i <= 12; $i ++) { + $sql .= " SUM(" . $db->ifsql('MONTH(f.datef)=' . $i, 'fd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ","; +} +$sql .= " SUM(fd.total_ht) as total"; $sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as fd"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture"; $sql .= " WHERE f.datef >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'"; $sql .= " AND f.datef <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'"; +$sql .= " AND f.entity IN (" . getEntity("facture", 0) . ")"; // We don't share object for accountancy -if (! empty($conf->multicompany->enabled)) { - $sql .= " AND f.entity IN (" . getEntity("facture", 1) . ")"; -} - -dol_syslog('htdocs/accountancy/customer/index.php:: $sql=' . $sql); +dol_syslog('htdocs/accountancy/customer/index.php'); $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 ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + for($i = 1; $i <= 12; $i ++) { + print ''; + } print ''; print ''; $i ++; @@ -322,68 +283,35 @@ if (! empty($conf->margin->enabled)) { print "
\n"; print '
' . $langs->trans("TotalVente") . '' . $langs->trans("JanuaryMin") . '' . $langs->trans("FebruaryMin") . '' . $langs->trans("MarchMin") . '' . $langs->trans("AprilMin") . '' . $langs->trans("MayMin") . '' . $langs->trans("JuneMin") . '' . $langs->trans("JulyMin") . '' . $langs->trans("AugustMin") . '' . $langs->trans("SeptemberMin") . '' . $langs->trans("OctoberMin") . '' . $langs->trans("NovemberMin") . '' . $langs->trans("DecemberMin") . '' . $langs->trans("Total") . '
' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '' . $langs->trans("Total") . '
' . $row[0] . '' . price($row[1]) . '' . price($row[2]) . '' . price($row[3]) . '' . price($row[4]) . '' . price($row[5]) . '' . price($row[6]) . '' . price($row[7]) . '' . price($row[8]) . '' . price($row[9]) . '' . price($row[10]) . '' . price($row[11]) . '' . price($row[12]) . '' . price($row[$i]) . '' . price($row[13]) . '
'; print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - $sql = "SELECT '" . $langs->trans("Vide") . "' AS 'Marge',"; - $sql .= " ROUND(SUM(IF(MONTH(f.datef)=1,(fd.total_ht-(fd.qty * fd.buy_price_ht)),0)),2) AS 'Janvier',"; - $sql .= " ROUND(SUM(IF(MONTH(f.datef)=2,(fd.total_ht-(fd.qty * fd.buy_price_ht)),0)),2) AS 'Fevrier',"; - $sql .= " ROUND(SUM(IF(MONTH(f.datef)=3,(fd.total_ht-(fd.qty * fd.buy_price_ht)),0)),2) AS 'Mars',"; - $sql .= " ROUND(SUM(IF(MONTH(f.datef)=4,(fd.total_ht-(fd.qty * fd.buy_price_ht)),0)),2) AS 'Avril',"; - $sql .= " ROUND(SUM(IF(MONTH(f.datef)=5,(fd.total_ht-(fd.qty * fd.buy_price_ht)),0)),2) AS 'Mai',"; - $sql .= " ROUND(SUM(IF(MONTH(f.datef)=6,(fd.total_ht-(fd.qty * fd.buy_price_ht)),0)),2) AS 'Juin',"; - $sql .= " ROUND(SUM(IF(MONTH(f.datef)=7,(fd.total_ht-(fd.qty * fd.buy_price_ht)),0)),2) AS 'Juillet',"; - $sql .= " ROUND(SUM(IF(MONTH(f.datef)=8,(fd.total_ht-(fd.qty * fd.buy_price_ht)),0)),2) AS 'Aout',"; - $sql .= " ROUND(SUM(IF(MONTH(f.datef)=9,(fd.total_ht-(fd.qty * fd.buy_price_ht)),0)),2) AS 'Septembre',"; - $sql .= " ROUND(SUM(IF(MONTH(f.datef)=10,(fd.total_ht-(fd.qty * fd.buy_price_ht)),0)),2) AS 'Octobre',"; - $sql .= " ROUND(SUM(IF(MONTH(f.datef)=11,(fd.total_ht-(fd.qty * fd.buy_price_ht)),0)),2) AS 'Novembre',"; - $sql .= " ROUND(SUM(IF(MONTH(f.datef)=12,(fd.total_ht-(fd.qty * fd.buy_price_ht)),0)),2) AS 'Decembre',"; - $sql .= " ROUND(SUM((fd.total_ht-(fd.qty * fd.buy_price_ht))),2) as 'Total'"; + for($i = 1; $i <= 12; $i ++) { + print ''; + } + print ''; + + $sql = "SELECT '" . $langs->trans("Vide") . "' AS marge,"; + for($i = 1; $i <= 12; $i ++) { + $sql .= " SUM(" . $db->ifsql('MONTH(f.datef)=' . $i, '(fd.total_ht-(fd.qty * fd.buy_price_ht))', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ","; + } + $sql .= " SUM((fd.total_ht-(fd.qty * fd.buy_price_ht))) as total"; $sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as fd"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture"; $sql .= " WHERE f.datef >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'"; $sql .= " AND f.datef <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'"; - - if (! empty($conf->multicompany->enabled)) { - $sql .= " AND f.entity IN (" . getEntity("facture", 1) . ")"; - } - + $sql .= " AND f.entity IN (" . getEntity("facture", 0) . ")"; // We don't share object for accountancy + 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 ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + for($i = 1; $i <= 12; $i ++) { + print ''; + } + print ''; print ''; - $i ++; } $db->free($resql); } else { @@ -395,4 +323,4 @@ print "
' . $langs->trans("TotalMarge") . '' . $langs->trans("JanuaryMin") . '' . $langs->trans("FebruaryMin") . '' . $langs->trans("MarchMin") . '' . $langs->trans("AprilMin") . '' . $langs->trans("MayMin") . '' . $langs->trans("JuneMin") . '' . $langs->trans("JulyMin") . '' . $langs->trans("AugustMin") . '' . $langs->trans("SeptemberMin") . '' . $langs->trans("OctoberMin") . '' . $langs->trans("NovemberMin") . '' . $langs->trans("DecemberMin") . '' . $langs->trans("Total") . '
' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '' . $langs->trans("Total") . '
' . $row[0] . '' . price($row[1]) . '' . price($row[2]) . '' . price($row[3]) . '' . price($row[4]) . '' . price($row[5]) . '' . price($row[6]) . '' . price($row[7]) . '' . price($row[8]) . '' . price($row[9]) . '' . price($row[10]) . '' . price($row[11]) . '' . price($row[12]) . '' . price($row[13]) . '' . price(price2num($row[$i])) . '' . price(price2num($row[13])) . '
\n"; print ''; llxFooter(); -$db->close(); \ No newline at end of file +$db->close(); diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index 3549651cbd6..d33fc82f3bc 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -3,7 +3,7 @@ * Copyright (C) 2013-2016 Alexandre Spangaro * Copyright (C) 2014-2015 Ari Elbaz (elarifr) * Copyright (C) 2014-2016 Florian Henry - * Copyright (C) 2014 Juanjo Menent + * Copyright (C) 2014 Juanjo Menent * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -52,41 +52,36 @@ $search_vat = GETPOST('search_vat', 'alpha'); $search_country = GETPOST('search_country', 'alpha'); $search_tvaintra = GETPOST('search_tvaintra', 'alpha'); -// Getpost Order and column and limit page +// Load variable for pagination +$limit = GETPOST('limit') ? GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)?$conf->liste_limit:$conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION); $sortfield = GETPOST('sortfield', 'alpha'); $sortorder = GETPOST('sortorder', 'alpha'); $page = GETPOST('page', 'int'); -if ($page < 0) - $page = 0; - +if ($page < 0) $page = 0; $pageprev = $page - 1; $pagenext = $page + 1; -if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)) { - $limit = $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION; -} else if ($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION <= 0) { - $limit = GETPOST('limit') ? GETPOST('limit', 'int') : $conf->liste_limit; -} else { - $limit = GETPOST('limit') ? GETPOST('limit', 'int') : $conf->liste_limit; -} $offset = $limit * $page; - if (! $sortfield) $sortfield = "f.datef, f.facnumber, fd.rowid"; - if (! $sortorder) { if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE > 0) { - $sortorder = " DESC "; + $sortorder = "DESC"; } } // Security check if ($user->societe_id > 0) accessforbidden(); -if (! $user->rights->accounting->ventilation->dispatch) +if (! $user->rights->accounting->bind->write) accessforbidden(); $formventilation = new FormVentilation($db); + +/* + * Actions + */ + // Purge search criteria if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers { @@ -103,13 +98,13 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both if (is_array($changeaccount) && count($changeaccount) > 0) { $error = 0; - + $db->begin(); - + $sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet as l"; $sql1 .= " SET l.fk_code_ventilation=" . $account_parent; $sql1 .= ' WHERE l.rowid IN (' . implode(',', $changeaccount) . ')'; - + dol_syslog('accountancy/customer/lines.php::changeaccount sql= ' . $sql1); $resql1 = $db->query($sql1); if (! $resql1) { @@ -123,6 +118,8 @@ if (is_array($changeaccount) && count($changeaccount) > 0) { $db->rollback(); setEventMessages($db->lasterror(), null, 'errors'); } + + $account_parent = ''; // Protection to avoid to mass apply it a second time } /* @@ -148,10 +145,6 @@ print ''; -/* - * Action - */ - /* * Customer Invoice lines */ @@ -167,9 +160,7 @@ $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_factu $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid = f.fk_soc"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as co ON co.rowid = s.fk_pays "; $sql .= " WHERE fd.fk_code_ventilation > 0 "; -if (! empty($conf->multicompany->enabled)) { - $sql .= " AND f.entity IN (" . getEntity("facture", 1) . ")"; -} +$sql .= " AND f.entity IN (" . getEntity("facture", 0) . ")"; // We don't share object for accountancy $sql .= " AND f.fk_statut > 0"; if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { $sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")"; @@ -203,28 +194,28 @@ if (strlen(trim($search_country))) { if (strlen(trim($search_tvaintra))) { $sql .= " AND (s.tva_intra like'" . $search_tvaintra . "%')"; } -if (! empty($conf->multicompany->enabled)) { - $sql .= " AND f.entity IN (" . getEntity("facture", 1) . ")"; -} -// Count total nb of records with no order and no limits -$nbtotalofrecords = 0; -if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { - $resql = $db->query($sql); - if ($resql) - $nbtotalofrecords = $db->num_rows($resql); - else - dol_print_error($db); -} +$sql .= " AND f.entity IN (" . getEntity("facture", 0) . ")"; // We don't share object for accountancy $sql .= $db->order($sortfield, $sortorder); + +// Count total nb of records +$nbtotalofrecords = 0; +if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) +{ + $result = $db->query($sql); + $nbtotalofrecords = $db->num_rows($result); +} + $sql .= $db->plimit($limit + 1, $offset); -dol_syslog("/accountancy/customer/lines.php sql=" . $sql, LOG_DEBUG); +dol_syslog("/accountancy/customer/lines.php", LOG_DEBUG); $result = $db->query($sql); if ($result) { $num_lines = $db->num_rows($result); $i = 0; - - $param = ""; + + $param=''; + if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; + if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; if ($search_invoice) $param .= "&search_invoice=" . $search_invoice; if ($search_ref) @@ -243,69 +234,82 @@ if ($result) { $param .= "&search_tvaintra=" . $search_tvaintra; - print_barre_liste($langs->trans("InvoiceLinesDone"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num_lines, $nbtotalofrecords); - print '' . $langs->trans("DescVentilDoneCustomer") . ''; - - print '
'; - print ''; + print '' . "\n"; + print ''; + if ($optioncss != '') print ''; + print ''; + print ''; + print ''; + print ''; + print_barre_liste($langs->trans("InvoiceLinesDone"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit); + print $langs->trans("DescVentilDoneCustomer") . '
'; + print '
' . $langs->trans("ChangeAccount") . '
'; print $formventilation->select_account($account_parent, 'account_parent', 1); - print '
'; + print ''; + + $moreforfilter = ''; + + print '
'."\n"; print ''; print_liste_field_titre($langs->trans("Invoice"), $_SERVER["PHP_SELF"], "f.facnumber", "", $param, '', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "fd.description", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"], "fd.total_ht", "", $param, 'align="center"', $sortfield, $sortorder); + print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"], "fd.total_ht", "", $param, 'align="right"', $sortfield, $sortorder); print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "fd.tva_tx", "", $param, 'align="center"', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Account"), $_SERVER["PHP_SELF"], "aa.account_number", "", $param, 'align="center"', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Country"), $_SERVER["PHP_SELF"], "co.label", "", $param, 'align="center"', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("IntracommunityVATNumber"), $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, 'align="center"', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Ventilate") . '
/', '', '', '', '', 'align="center"'); + print_liste_field_titre($langs->trans("Country"), $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder); + print_liste_field_titre($langs->trans("VATIntra"), $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder); + print_liste_field_titre($langs->trans("LineId"), $_SERVER["PHP_SELF"], "fd.rowid", "", $param, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre('', '', '', '', '', 'align="center"'); print "\n"; - + print ''; print ''; print ''; print ''; print ''; - print ''; - print ''; + print ''; + print ''; print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print '\n"; - + $facture_static = new Facture($db); $product_static = new Product($db); - + $var = True; while ( $objp = $db->fetch_object($result) ) { $var = ! $var; $codecompta = length_accountg($objp->account_number) . ' - ' . $objp->label_compte; - - print ''; - + + print ''; + // Ref Invoice $facture_static->ref = $objp->facnumber; - $facture_static->id = $objp->facid; + $facture_static->id = $objp->rowid; print ''; - + // Ref Product $product_static->ref = $objp->product_ref; $product_static->id = $objp->product_id; - $product_static->type = $objp->type; + $product_static->type = $objp->product_type; + $product_static->label = $objp->product_label; print ''; - + print ''; print ''; print ''; @@ -313,10 +317,11 @@ if ($result) { print ''; - print ''; - print ''; - print ''; - + print ''; + print ''; + print ''; + print ''; + print ""; $i ++; } @@ -324,11 +329,14 @@ if ($result) { print $db->error(); } -print "
%'; - print ''; + print ''; + $searchpitco=$form->showFilterAndCheckAddButtons(1); + print $searchpitco; print "
' . $facture_static->getNomUrl(1) . ''; if ($product_static->id) print $product_static->getNomUrl(1); else print ' '; print '' . dol_trunc($objp->product_label, 24) . '' . nl2br(dol_trunc($objp->description, 32)) . '' . price($objp->total_ht) . '' . $codecompta . ''; print img_edit(); print '' . $objp->country .'' . $objp->tva_intra . '' . $objp->country .'' . $objp->tva_intra . '' . $objp->rowid . '
"; +print ""; -if ($num_lines > $conf->liste_limit) { - print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num_lines, $nbtotalofrecords, ''); +if ($nbtotalofrecords > $limit) { + print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num_lines, $nbtotalofrecords, '', 0, '', '', $limit, 1); } +print ''; + + llxFooter(); $db->close(); diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index 167f558d830..7c718c54bfb 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -4,6 +4,7 @@ * Copyright (C) 2014-2015 Ari Elbaz (elarifr) * Copyright (C) 2013-2014 Florian Henry * Copyright (C) 2014 Juanjo Menent + * Copyright (C) 2016 Laurent Destailleur * * 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 @@ -43,7 +44,6 @@ $langs->load("accountancy"); $action = GETPOST('action'); // Select Box -$codeventil = GETPOST('codeventil', 'array'); $mesCasesCochees = GETPOST('mesCasesCochees', 'array'); // Search Getpost @@ -56,35 +56,27 @@ $search_account = GETPOST('search_account', 'alpha'); $search_vat = GETPOST('search_vat', 'alpha'); $btn_ventil = GETPOST('ventil', 'alpha'); -// Getpost Order and column and limit page +// Load variable for pagination +$limit = GETPOST('limit') ? GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)?$conf->liste_limit:$conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION); $sortfield = GETPOST('sortfield', 'alpha'); $sortorder = GETPOST('sortorder', 'alpha'); -$page = GETPOST('page', 'int'); -if ($page < 0) - $page = 0; - -if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)) { - $limit = $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION; -} else if ($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION <= 0) { - $limit = GETPOST('limit') ? GETPOST('limit', 'int') : $conf->liste_limit; -} else { - $limit = GETPOST('limit') ? GETPOST('limit', 'int') : $conf->liste_limit; -} +$page = GETPOST('page','int'); +if ($page < 0) { $page = 0; } $offset = $limit * $page; - +$pageprev = $page - 1; +$pagenext = $page + 1; if (! $sortfield) $sortfield = "f.datef, f.facnumber, l.rowid"; - if (! $sortorder) { if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO > 0) { - $sortorder = " DESC "; + $sortorder = "DESC"; } } // Security check if ($user->societe_id > 0) accessforbidden(); -if (! $user->rights->accounting->ventilation->dispatch) +if (! $user->rights->accounting->bind->write) accessforbidden(); $formventilation = new FormVentilation($db); @@ -92,8 +84,14 @@ $accounting = new AccountingAccount($db); $aarowid_s = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT, 1); $aarowid_p = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT, 1); + +/* + * Action + */ + // Purge search criteria -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) { +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_invoice = ''; $search_label = ''; @@ -103,79 +101,63 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) { $search_vat = ''; } +if ($action == 'ventil' && ! empty($btn_ventil)) { + $msg=''; + //print '
' . $langs->trans("Processing") . '...
'; + if (! empty($mesCasesCochees)) { + $msg = '
' . $langs->trans("SelectedLines") . ': '.count($_POST["mesCasesCochees"]).'
'; + $msg.='
'; + $cpt = 0; + $ok=0; + $ko=0; + + foreach ($mesCasesCochees as $maLigneCochee) { + $maLigneCourante = explode("_", $maLigneCochee); + $monId = $maLigneCourante[0]; + $monCompte = GETPOST('codeventil'.$monId); + + if ($monCompte <= 0) + { + $msg.= '
' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' - ' . $langs->trans("NoAccountSelected") . '
'; + $ko++; + } + else + { + $sql = " UPDATE " . MAIN_DB_PREFIX . "facturedet"; + $sql .= " SET fk_code_ventilation = " . $monCompte; + $sql .= " WHERE rowid = " . $monId; + + $accountventilated = new AccountingAccount($db); + $accountventilated->fetch($monCompte, ''); + + dol_syslog("/accountancy/customer/list.php sql=" . $sql, LOG_DEBUG); + if ($db->query($sql)) { + $msg.= '
' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' - ' . $langs->trans("VentilatedinAccount") . ' : ' . length_accountg($accountventilated->account_number) . '
'; + $ok++; + } else { + $msg.= '
' . $langs->trans("ErrorDB") . ' : ' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' - ' . $langs->trans("NotVentilatedinAccount") . ' : ' . length_accountg($accountventilated->account_number) . '
' . $sql . '
'; + $ko++; + } + } + + $cpt++; + } + $msg.='
'; + } else { + setEventMessages($langs->trans("NoRecordSelected"), null, 'warnings'); + } + $msg.= '
' . $langs->trans("EndProcessing") . '
'; +} + + + /* * View */ + llxHeader('', $langs->trans("Ventilation")); -print ''; - -/* - * Action - */ -if ($action == 'ventil' && ! empty($btn_ventil)) { - print '
' . $langs->trans("Processing") . '...
'; - if (! empty($codeventil) && ! empty($mesCasesCochees)) { - print '
' . count($mesCasesCochees) . ' ' . $langs->trans("SelectedLines") . '
'; - $mesCodesVentilChoisis = $codeventil; - $cpt = 0; - - foreach ( $mesCasesCochees as $maLigneCochee ) { - $maLigneCourante = explode("_", $maLigneCochee); - $monId = $maLigneCourante[0]; - $monNumLigne = $maLigneCourante[1]; - $monCompte = $mesCodesVentilChoisis[$monNumLigne]; - - $sql = " UPDATE " . MAIN_DB_PREFIX . "facturedet"; - $sql .= " SET fk_code_ventilation = " . $monCompte; - $sql .= " WHERE rowid = " . $monId; - - $accountventilated = new AccountingAccount($db); - $accountventilated->fetch($monCompte, ''); - - dol_syslog("/accountancy/customer/list.php sql=" . $sql, LOG_DEBUG); - if ($db->query($sql)) { - print '
' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' - ' . $langs->trans("VentilatedinAccount") . ' : ' . length_accountg($accountventilated->account_number) . '
'; - } else { - print '
' . $langs->trans("ErrorDB") . ' : ' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' - ' . $langs->trans("NotVentilatedinAccount") . ' : ' . length_accountg($accountventilated->account_number) . '
' . $sql . '
'; - } - - $cpt ++; - } - } else { - print '
' . $langs->trans("AnyLineVentilate") . '
'; - } - print '
' . $langs->trans("EndProcessing") . '
'; -} - -/* - * Customer Invoice lines - */ -if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)) { - $limit = $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION; -} else if ($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION <= 0) { - $limit = GETPOST('limit') ? GETPOST('limit', 'int') : $conf->liste_limit; -} else { - $limit = GETPOST('limit') ? GETPOST('limit', 'int') : $conf->liste_limit; -} - -$offset = $limit * $page; - +// Customer Invoice lines $sql = "SELECT f.facnumber, f.rowid as facid, f.datef, f.type as ftype, l.fk_product, l.description, l.total_ht, l.rowid, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line,"; $sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_sell as code_sell, p.tva_tx as tva_tx_prod,"; $sql .= " aa.rowid as aarowid"; @@ -184,11 +166,9 @@ $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "facturedet as l ON f.rowid = l.fk_fac $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 .= " WHERE f.fk_statut > 0 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 ='')"; - // Add search filter like if (strlen(trim($search_invoice))) { $sql .= " AND (f.facnumber like '%" . $search_invoice . "%')"; @@ -211,53 +191,78 @@ if (strlen(trim($search_account))) { if (strlen(trim($search_vat))) { $sql .= " AND (l.tva_tx like '" . $search_vat . "%')"; } - -if (! empty($conf->multicompany->enabled)) { - $sql .= " AND f.entity IN (" . getEntity("facture", 1) . ")"; -} +$sql .= " AND f.entity IN (" . getEntity("facture", 0) . ")"; // We don't share object for accountancy $sql .= $db->order($sortfield, $sortorder); +// Count total nb of records +$nbtotalofrecords = 0; +if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) +{ + $result = $db->query($sql); + $nbtotalofrecords = $db->num_rows($result); +} + $sql .= $db->plimit($limit + 1, $offset); -dol_syslog("/accountancy/customer/list.php sql=" . $sql, LOG_DEBUG); +dol_syslog("/accountancy/customer/list.php", LOG_DEBUG); $result = $db->query($sql); if ($result) { $num_lines = $db->num_rows($result); $i = 0; - print_barre_liste($langs->trans("InvoiceLines"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, '', $num_lines); - print '
' . $langs->trans("DescVentilTodoCustomer") . '
'; + $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; print '
' . "\n"; print ''; + if ($optioncss != '') print ''; + print ''; + print ''; + print ''; + print ''; + + $center='
'; + + print_barre_liste($langs->trans("InvoiceLines"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit); - print ''; + print $langs->trans("DescVentilTodoCustomer") . '

'; + + if ($msg) print $msg.'
'; + + $moreforfilter = ''; + + print '
'."\n"; print ''; print_liste_field_titre($langs->trans("Invoice"), $_SERVER["PHP_SELF"], "f.facnumber", "", $param, '', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"], "l.total_ht", "", $param, 'align="center"', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, 'align="center"', $sortfield, $sortorder); + print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"], "l.total_ht", "", $param, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, 'align="right"', $sortfield, $sortorder); print_liste_field_titre($langs->trans("AccountAccountingSuggest"), '', '', '', '', 'align="center"'); print_liste_field_titre($langs->trans("IntoAccount"), '', '', '', '', 'align="center"'); - print_liste_field_titre(''); - print_liste_field_titre($langs->trans("Ventilate") . '
/', '', '', '', '', 'align="center"'); + print_liste_field_titre($langs->trans("LineId"), $_SERVER["PHP_SELF"], "l.rowid", "", $param, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre('', '', '', '', '', 'align="center"'); print ''; // We add search filter print ''; print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; print ''; @@ -302,11 +307,12 @@ if ($result) { if ($objp->code_sell_l != $objp->code_sell_p) $code_sell_p_l_differ = 'color:red'; - print ''; + print ''; // Ref Invoice $facture_static->ref = $objp->facnumber; $facture_static->id = $objp->facid; + $facture_static->type = $objp->ftype; print ''; // Ref Product $product_static->ref = $objp->product_ref; @@ -324,35 +330,45 @@ if ($result) { print ''; $trunclength = defined('ACCOUNTING_LENGTH_DESCRIPTION') ? ACCOUNTING_LENGTH_DESCRIPTION : 32; print ''; + print ''; + + // Vat rate if ($objp->vat_tx_l != $objp->vat_tx_p) $code_vat_differ = 'font-weight:bold; text-decoration:blink; color:red'; - print ''; + + // Accounting account suggested print ''; print ''; + + // Line id print ''; - print ''; print ''; $i ++; } print '
%'; - print ''; - print ' '; - print ''; + print '%'; + $searchpitco=$form->showFilterAndCheckAddButtons(1); + print $searchpitco; print '
' . $facture_static->getNomUrl(1) . '' . dol_trunc($objp->product_label, 24) . '' . nl2br(dol_trunc($objp->description, $trunclength)) . ''; print price($objp->total_ht); print ''; + print ''; print price($objp->tva_tx_line); print ''; - if ($objp->code_sell_l == $objp->code_sell_p) { - print $objp->code_sell_l; + if ($objp->code_sell_l == $objp->code_sell_p) { // Test if there is a difference between code by default and code on product + if ($objp->code_sell_l > 0) print $objp->code_sell_l; + else print $langs->trans("Unknown"); } else { - print $langs->trans("Buy") . ' = ' . $objp->code_sell_l . '
' . $langs->trans("Sell") . ' = ' . $objp->code_sell_p; + print $langs->trans("Default") . ' = ' . ($objp->code_sell_l > 0 ? $objp->code_sell_l : $langs->trans("Unknown")); + print '
'; + print $langs->trans("Product") . ' = ' . ($objp->code_sell_p > 0 ? $objp->code_sell_p : $langs->trans("Unknown")); } print '
'; - print $formventilation->select_account($objp->aarowid_suggest, 'codeventil[]', 1); + print $formventilation->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1); print '' . $objp->rowid . ''; - print 'aarowid ? "checked" : "") . '/>'; + + print ''; + print 'aarowid ? "checked" : "") . '/>'; print '
'; - print '
'; print '
'; } else { print $db->error(); diff --git a/htdocs/accountancy/index.php b/htdocs/accountancy/index.php new file mode 100644 index 00000000000..26edab6f859 --- /dev/null +++ b/htdocs/accountancy/index.php @@ -0,0 +1,164 @@ + + * + * 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 . + */ + +/** + * \file htdocs/accountancy/index.php + * \ingroup Advanced accountancy + * \brief Home accounting module + */ + +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; + +// Langs +$langs->load("compta"); +$langs->load("bills"); +$langs->load("other"); +$langs->load("main"); +$langs->load("accountancy"); + +// Security check +if ($user->societe_id > 0) + accessforbidden(); + +// Validate History +$action = GETPOST('action'); + +$langs->load("admin"); +$langs->load("dict"); +$langs->load("bills"); +$langs->load("accountancy"); +$langs->load("compta"); +$langs->load("banks"); +$langs->load("loans"); + +/* + * Actions + */ + + +/* + * View + */ + +llxHeader('', $langs->trans("AccountancyArea")); + +print load_fiche_titre($langs->trans("AccountancyArea"), '', 'title_accountancy'); + +$step = 0; + +print "
\n"; + +print $langs->trans("AccountancyAreaDescIntro")."
\n"; +print "
\n";print "
\n"; + +print_fiche_titre($langs->trans("AccountancyAreaDescActionOnce"), '', 'object_calendar')."
\n"; +print '
'; +print "
\n"; + +// STEPS +$step++; +print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChartModel", $step, ''.$langs->transnoentitiesnoconv("Financial").'-'.$langs->transnoentitiesnoconv("Accountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("Pcg_version").''); +print "
\n"; +print "
\n"; +$step++; +print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChart", $step, ''.$langs->transnoentitiesnoconv("Financial").'-'.$langs->transnoentitiesnoconv("Accountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("Chartofaccounts").''); +print "
\n"; +print "
\n"; + +print $langs->trans("AccountancyAreaDescActionOnceBis"); +print "
\n"; +print "
\n"; + +$step++; +print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescMisc", $step, ''.$langs->transnoentitiesnoconv("Financial").'-'.$langs->transnoentitiesnoconv("Accountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'')."
\n"; +print "
\n"; +$step++; +$textlink = ''.$langs->transnoentitiesnoconv("Financial").'-'.$langs->transnoentitiesnoconv("Accountancy").'-'.$langs->transnoentitiesnoconv("Setup").'-'.$langs->transnoentitiesnoconv("MenuVatAccounts").''; +print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescVat", $step, $textlink); +print "
\n"; +print "
\n"; +if (! empty($conf->tax->enabled)) +{ + $textlink = ''.$langs->transnoentitiesnoconv("Financial").'-'.$langs->transnoentitiesnoconv("Accountancy").'-'.$langs->transnoentitiesnoconv("Setup").'-'.$langs->transnoentitiesnoconv("MenuTaxAccounts").''; + $step++; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescContrib", $step, $textlink); + print "
\n"; + print "
\n"; +} +/*if (! empty($conf->salaries->enabled)) +{ + $step++; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescSal", $step, ''.$langs->transnoentitiesnoconv("Financial").'-'.$langs->transnoentitiesnoconv("Accountancy")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").''); + // htdocs/admin/salaries.php + print "
\n"; + print "
\n"; +}*/ +if (! empty($conf->expensereport->enabled)) // TODO Move this in the default account page because this is only one accounting account per purpose, not several. +{ + $step++; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescExpenseReport", $step, ''.$langs->transnoentitiesnoconv("Financial").'-'.$langs->transnoentitiesnoconv("Accountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuExpenseReportAccounts").''); + print "
\n"; + print "
\n"; +} +if (! empty($conf->loan->enabled)) // TODO Move this in the default account page because this is only one accounting account per purpose, not several. +{ + $step++; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescLoan", $step, ''.$langs->transnoentitiesnoconv("Financial").'-'.$langs->transnoentitiesnoconv("Accountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuLoanAccounts").''); + print "
\n"; + print "
\n"; +} +/* +if (! empty($conf->don->enabled)) +{ + $step++; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDonation", $step, ''.$langs->transnoentitiesnoconv("Financial").'-'.$langs->transnoentitiesnoconv("Accountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDonationAccounts").''); + print "
\n"; + print "
\n"; +}*/ +$step++; +$textlink=''.$langs->transnoentitiesnoconv("Home").'-'.$langs->transnoentitiesnoconv("MenuBankCash").''; +print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBank", $step, $textlink); +print "
\n"; +print "
\n"; + +$step++; +print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescProd", $step, ''.$langs->transnoentitiesnoconv("Financial").'-'.$langs->transnoentitiesnoconv("Accountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("ProductsBinding").'')."
\n"; +print "
\n"; + +print "
\n"; +print_fiche_titre($langs->trans("AccountancyAreaDescActionFreq"), '', 'object_calendarweek'); +print '
'; +print "
\n"; +$step = 0; + +$step++; +print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescCustomer", $step, ''.$langs->transnoentitiesnoconv("Financial").'-'.$langs->transnoentitiesnoconv("Accountancy")."-".$langs->transnoentitiesnoconv("CustomersVentilation").'')."
\n"; +print "
\n"; +$step++; +print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescSupplier", $step, ''.$langs->transnoentitiesnoconv("Financial").'-'.$langs->transnoentitiesnoconv("Accountancy")."-".$langs->transnoentitiesnoconv("SuppliersVentilation").'')."
\n"; +print "
\n"; +$step++; +print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescWriteRecords", $step, ''.$langs->transnoentitiesnoconv("Financial").'-'.$langs->transnoentitiesnoconv("Accountancy")."-".$langs->transnoentitiesnoconv("SuppliersVentilation").'')."
\n"; +print "
\n"; +$step++; +print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescAnalyze", $step)."
\n"; +print "
\n"; + +llxFooter(); +$db->close(); diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index c990465bacf..bd18388aacb 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -4,9 +4,9 @@ * Copyright (C) 2011 Juanjo Menent * Copyright (C) 2012 Regis Houssin * Copyright (C) 2013 Christophe Battarel - * Copyright (C) 2013-2016 Alexandre Spangaro - * Copyright (C) 2013-2014 Florian Henry - * Copyright (C) 2013-2014 Olivier Geffroy + * Copyright (C) 2013-2016 Alexandre Spangaro + * Copyright (C) 2013-2014 Florian Henry + * Copyright (C) 2013-2014 Olivier Geffroy * * 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 @@ -42,6 +42,7 @@ require_once DOL_DOCUMENT_ROOT . '/compta/paiement/class/paiement.class.php'; require_once DOL_DOCUMENT_ROOT . '/don/class/paymentdonation.class.php'; require_once DOL_DOCUMENT_ROOT . '/compta/tva/class/tva.class.php'; require_once DOL_DOCUMENT_ROOT . '/compta/salaries/class/paymentsalary.class.php'; +require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT . '/fourn/class/paiementfourn.class.php'; require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php'; require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.class.php'; @@ -73,9 +74,13 @@ $now = dol_now(); if ($user->societe_id > 0 && empty($id_bank_account)) accessforbidden(); + /* - * View + * Actions */ + +$error = 0; + $year_current = strftime("%Y", dol_now()); $pastmonth = strftime("%m", dol_now()) - 1; $pastmonthyear = $year_current; @@ -96,16 +101,15 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end $p = explode(":", $conf->global->MAIN_INFO_SOCIETE_COUNTRY); $idpays = $p[0]; -$sql = "SELECT b.rowid , b.dateo as do, b.datev as dv, b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type, soc.code_compta, ba.courant,"; -$sql .= " soc.code_compta_fournisseur, soc.rowid as socid, soc.nom as name, ba.account_number, bu1.type as typeop"; +$sql = "SELECT b.rowid , b.dateo as do, b.datev as dv, b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type,"; +$sql .= " ba.courant, ba.ref as baref, ba.account_number,"; +$sql .= " soc.code_compta, soc.code_compta_fournisseur, soc.rowid as socid, soc.nom as name, bu1.type as typeop"; $sql .= " FROM " . MAIN_DB_PREFIX . "bank as b"; $sql .= " JOIN " . MAIN_DB_PREFIX . "bank_account as ba on b.fk_account=ba.rowid"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url as bu1 ON bu1.fk_bank = b.rowid AND bu1.type='company'"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as soc on bu1.url_id=soc.rowid"; $sql .= " WHERE ba.rowid=" . $id_bank_account; -if (! empty($conf->multicompany->enabled)) { - $sql .= " AND ba.entity = " . $conf->entity; -} +$sql .= ' AND ba.entity IN ('.getEntity('banque', 0).')'; // We don't share object for accountancy if ($date_start && $date_end) $sql .= " AND b.dateo >= '" . $db->idate($date_start) . "' AND b.dateo <= '" . $db->idate($date_end) . "'"; $sql .= " ORDER BY b.datev"; @@ -138,28 +142,33 @@ if ($result) { $account_pay_donation = (! empty($conf->global->DONATION_ACCOUNTINGACCOUNT) ? $conf->global->DONATION_ACCOUNTINGACCOUNT : $langs->trans("CodeNotDef")); $account_transfer = (! empty($conf->global->ACCOUNTING_ACCOUNT_TRANSFER_CASH) ? $conf->global->ACCOUNTING_ACCOUNT_TRANSFER_CASH : $langs->trans("CodeNotDef")); + $tabcompany = array(); $tabpay = array (); $tabbq = array (); $tabtp = array (); $tabtype = array (); + // Loop on each line into bank account. For each line, we should get: + // on line tabpay = line into bank + // one line for bank jounral = tabbq + // one line for thirdparty journal = tabtp $i = 0; while ( $i < $num ) { $obj = $db->fetch_object($result); - $tabcompany[$obj->rowid] = array ( - 'id' => $obj->socid, - 'name' => $obj->name, - 'code_client' => $obj->code_compta - ); - - // Controls + // Set accountancy code (for bank and thirdparty) $compta_bank = $obj->account_number; if ($obj->label == '(SupplierInvoicePayment)') $compta_soc = (! empty($obj->code_compta_fournisseur) ? $obj->code_compta_fournisseur : $account_supplier); if ($obj->label == '(CustomerInvoicePayment)') $compta_soc = (! empty($obj->code_compta) ? $obj->code_compta : $account_customer); + $tabcompany[$obj->rowid] = array ( + 'id' => $obj->socid, + 'name' => $obj->name, + 'code_compta' => $compta_soc, + ); + // Variable bookkeeping $tabpay[$obj->rowid]["date"] = $obj->do; $tabpay[$obj->rowid]["type_payment"] = $obj->fk_type; @@ -174,16 +183,24 @@ if ($result) { // get_url may return -1 which is not traversable if (is_array($links)) { + // Now loop on each link of record in bank. foreach ( $links as $key => $val ) { - $tabtype[$obj->rowid] = $links[$key]['type']; + + if (in_array($links[$key]['type'], array('sc', 'payment_sc', 'payment', 'payment_supplier', 'payment_vat'))) // So we excluded 'company' here + { + // We save tabtype for a future use, to remember what kind of payment it is + $tabtype[$obj->rowid] = $links[$key]['type']; + } if ($links[$key]['type'] == 'payment') { $paymentstatic->id = $links[$key]['url_id']; $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentstatic->getNomUrl(2); + $tabpay[$obj->rowid]["paymentid"] = $paymentstatic->id; } else if ($links[$key]['type'] == 'payment_supplier') { $paymentsupplierstatic->id = $links[$key]['url_id']; $paymentsupplierstatic->ref = $links[$key]['url_id']; $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentsupplierstatic->getNomUrl(2); + $tabpay[$obj->rowid]["paymentsupplierid"] = $paymentsupplierstatic->id; } else if ($links[$key]['type'] == 'company') { $societestatic->id = $links[$key]['url_id']; $societestatic->name = $links[$key]['label']; @@ -248,6 +265,26 @@ if ($result) { $tabbq[$obj->rowid][$compta_bank] += $obj->amount; + + // Check account number is ok + /*if ($action == 'writebookkeeping') // Make test now in such a case + { + reset($tabbq[$obj->rowid]); + $first_key_tabbq = key($tabbq[$obj->rowid]); + if (empty($first_key_tabbq)) + { + $error++; + setEventMessages($langs->trans('ErrorAccountancyCodeOnBankAccountNotDefined', $obj->baref), null, 'errors'); + } + reset($tabtp[$obj->rowid]); + $first_key_tabtp = key($tabtp[$obj->rowid]); + if (empty($first_key_tabtp)) + { + $error++; + setEventMessages($langs->trans('ErrorAccountancyCodeOnThirdPartyNotDefined'), null, 'errors'); + } + }*/ + // if($obj->socid)$tabtp[$obj->rowid][$compta_soc] += $obj->amount; $i ++; @@ -257,151 +294,185 @@ if ($result) { } /* - * Actions - */ +var_dump($tabpay); +var_dump($tabbq); +var_dump($tabtp); +*/ // Write bookkeeping -if ($action == 'writebookkeeping') { +if (! $error && $action == 'writebookkeeping') { $now = dol_now(); $error = 0; - foreach ( $tabpay as $key => $val ) { + foreach ( $tabpay as $key => $val ) { // $key is rowid into llx_bank + + $errorforline = 0; + + $db->begin(); + // Bank - foreach ( $tabbq[$key] as $k => $mt ) { - $bookkeeping = new BookKeeping($db); - $bookkeeping->doc_date = $val["date"]; - $bookkeeping->doc_ref = $val["ref"]; - $bookkeeping->doc_type = 'bank'; - $bookkeeping->fk_doc = $key; - $bookkeeping->fk_docdet = $val["fk_bank"]; - $bookkeeping->code_tiers = $tabcompany[$key]['code_client']; - $bookkeeping->numero_compte = $k; - $bookkeeping->label_compte = $compte->label; - $bookkeeping->montant = ($mt < 0 ? - $mt : $mt); - $bookkeeping->sens = ($mt >= 0) ? 'D' : 'C'; - $bookkeeping->debit = ($mt >= 0 ? $mt : 0); - $bookkeeping->credit = ($mt < 0 ? - $mt : 0); - $bookkeeping->code_journal = $journal; - $bookkeeping->fk_user_author = $user->id; - $bookkeeping->date_create = $now; - - if ($tabtype[$key] == 'payment') { - - $sqlmid = 'SELECT fac.facnumber'; - $sqlmid .= " FROM " . MAIN_DB_PREFIX . "facture fac "; - $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiement_facture as payfac ON payfac.fk_facture=fac.rowid"; - $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiement as pay ON payfac.fk_paiement=pay.rowid"; - $sqlmid .= " WHERE pay.fk_bank=" . $key; - dol_syslog("accountancy/journal/bankjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG); - $resultmid = $db->query($sqlmid); - if ($resultmid) { - $objmid = $db->fetch_object($resultmid); - $bookkeeping->doc_ref = $objmid->facnumber; - } - } else if ($tabtype[$key] == 'payment_supplier') { - - $sqlmid = 'SELECT facf.ref_supplier,facf.ref'; - $sqlmid .= " FROM " . MAIN_DB_PREFIX . "facture_fourn facf "; - $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementfourn_facturefourn as payfacf ON payfacf.fk_facturefourn=facf.rowid"; - $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementfourn as payf ON payfacf.fk_paiementfourn=payf.rowid"; - $sqlmid .= " WHERE payf.fk_bank=" . $key; - dol_syslog("accountancy/journal/bankjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG); - $resultmid = $db->query($sqlmid); - if ($resultmid) { - $objmid = $db->fetch_object($resultmid); - $bookkeeping->doc_ref = $objmid->ref_supplier . ' (' . $objmid->ref . ')'; - } - } - - $result = $bookkeeping->create($user); - if ($result < 0) { - $error ++; - setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors'); - } + if (! $errorforline) + { + // Line into bank account + foreach ( $tabbq[$key] as $k => $mt ) { + $bookkeeping = new BookKeeping($db); + $bookkeeping->doc_date = $val["date"]; + $bookkeeping->doc_ref = $val["ref"]; + $bookkeeping->doc_type = 'bank'; + $bookkeeping->fk_doc = $key; + $bookkeeping->fk_docdet = $val["fk_bank"]; + $bookkeeping->numero_compte = $k; + $bookkeeping->label_compte = $compte->label; + $bookkeeping->montant = ($mt < 0 ? - $mt : $mt); + $bookkeeping->sens = ($mt >= 0) ? 'D' : 'C'; + $bookkeeping->debit = ($mt >= 0 ? $mt : 0); + $bookkeeping->credit = ($mt < 0 ? - $mt : 0); + $bookkeeping->code_journal = $journal; + $bookkeeping->fk_user_author = $user->id; + $bookkeeping->date_create = $now; + + if ($tabtype[$key] == 'payment') { + $bookkeeping->code_tiers = $tabcompany[$key]['code_compta']; + + $sqlmid = 'SELECT fac.facnumber'; + $sqlmid .= " FROM " . MAIN_DB_PREFIX . "facture fac "; + $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiement_facture as payfac ON payfac.fk_facture=fac.rowid"; + $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiement as pay ON payfac.fk_paiement=pay.rowid"; + $sqlmid .= " WHERE pay.fk_bank=" . $key; + dol_syslog("accountancy/journal/bankjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG); + $resultmid = $db->query($sqlmid); + if ($resultmid) { + $objmid = $db->fetch_object($resultmid); + $bookkeeping->doc_ref = $objmid->facnumber; // Ref of invoice + } + } else if ($tabtype[$key] == 'payment_supplier') { + $bookkeeping->code_tiers = $tabcompany[$key]['code_compta']; + + $sqlmid = 'SELECT facf.ref_supplier, facf.ref'; + $sqlmid .= " FROM " . MAIN_DB_PREFIX . "facture_fourn facf "; + $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementfourn_facturefourn as payfacf ON payfacf.fk_facturefourn=facf.rowid"; + $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementfourn as payf ON payfacf.fk_paiementfourn=payf.rowid"; + $sqlmid .= " WHERE payf.fk_bank=" . $key; + dol_syslog("accountancy/journal/bankjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG); + $resultmid = $db->query($sqlmid); + if ($resultmid) { + $objmid = $db->fetch_object($resultmid); + $bookkeeping->doc_ref = $objmid->ref_supplier . ' (' . $objmid->ref . ')'; // Ref on invoice + } + } + + $result = $bookkeeping->create($user); + if ($result < 0) { + $error++; + $errorforline++; + setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors'); + } + } } + // Third party - foreach ( $tabtp[$key] as $k => $mt ) { - $bookkeeping = new BookKeeping($db); - $bookkeeping->doc_date = $val["date"]; - $bookkeeping->doc_ref = $val["ref"]; - $bookkeeping->doc_type = 'bank'; - $bookkeeping->fk_doc = $key; - $bookkeeping->fk_docdet = $val["fk_bank"]; - $bookkeeping->label_compte = $tabcompany[$key]['name']; - $bookkeeping->montant = ($mt < 0 ? - $mt : $mt); - $bookkeeping->sens = ($mt < 0) ? 'D' : 'C'; - $bookkeeping->debit = ($mt < 0 ? - $mt : 0); - $bookkeeping->credit = ($mt >= 0) ? $mt : 0; - $bookkeeping->code_journal = $journal; - $bookkeeping->fk_user_author = $user->id; - $bookkeeping->date_create = $now; - - if ($tabtype[$key] == 'sc') { - $bookkeeping->code_tiers = ''; - $bookkeeping->numero_compte = $k; - } else if ($tabtype[$key] == 'payment') { - - $sqlmid = 'SELECT fac.facnumber'; - $sqlmid .= " FROM " . MAIN_DB_PREFIX . "facture fac "; - $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiement_facture as payfac ON payfac.fk_facture=fac.rowid"; - $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiement as pay ON payfac.fk_paiement=pay.rowid"; - $sqlmid .= " WHERE pay.fk_bank=" . $key; - dol_syslog("accountancy/journal/bankjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG); - $resultmid = $db->query($sqlmid); - if ($resultmid) { - $objmid = $db->fetch_object($resultmid); - $bookkeeping->doc_ref = $objmid->facnumber; - } - $bookkeeping->code_tiers = $k; - $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER; - } else if ($tabtype[$key] == 'payment_supplier') { - - $sqlmid = 'SELECT facf.ref_supplier,facf.ref'; - $sqlmid .= " FROM " . MAIN_DB_PREFIX . "facture_fourn facf "; - $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementfourn_facturefourn as payfacf ON payfacf.fk_facturefourn=facf.rowid"; - $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementfourn as payf ON payfacf.fk_paiementfourn=payf.rowid"; - $sqlmid .= " WHERE payf.fk_bank=" . $key; - dol_syslog("accountancy/journal/bankjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG); - $resultmid = $db->query($sqlmid); - if ($resultmid) { - $objmid = $db->fetch_object($resultmid); - $bookkeeping->doc_ref = $objmid->ref_supplier . ' (' . $objmid->ref . ')'; - } - $bookkeeping->code_tiers = $k; - $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER; - } else if ($tabtype[$key] == 'company') { - - $sqlmid = 'SELECT fac.facnumber'; - $sqlmid .= " FROM " . MAIN_DB_PREFIX . "facture fac "; - $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiement_facture as payfac ON payfac.fk_facture=fac.rowid"; - $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiement as pay ON payfac.fk_paiement=pay.rowid"; - $sqlmid .= " WHERE pay.fk_bank=" . $key; - dol_syslog("accountancy/journal/bankjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG); - $resultmid = $db->query($sqlmid); - if ($resultmid) { - $objmid = $db->fetch_object($resultmid); - $bookkeeping->doc_ref = $objmid->facnumber; - } - $bookkeeping->code_tiers = $k; - $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER; - } else { - - $bookkeeping->doc_ref = $k; - $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER; - } - - $result = $bookkeeping->create($user); - if ($result < 0) { - $error ++; - setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors'); - } + if (! $errorforline) + { + // Line into thirdparty account + foreach ( $tabtp[$key] as $k => $mt ) { + $bookkeeping = new BookKeeping($db); + $bookkeeping->doc_date = $val["date"]; + $bookkeeping->doc_ref = $val["ref"]; + $bookkeeping->doc_type = 'bank'; + $bookkeeping->fk_doc = $key; + $bookkeeping->fk_docdet = $val["fk_bank"]; + $bookkeeping->label_compte = $tabcompany[$key]['name']; + $bookkeeping->montant = ($mt < 0 ? - $mt : $mt); + $bookkeeping->sens = ($mt < 0) ? 'D' : 'C'; + $bookkeeping->debit = ($mt < 0 ? - $mt : 0); + $bookkeeping->credit = ($mt >= 0) ? $mt : 0; + $bookkeeping->code_journal = $journal; + $bookkeeping->fk_user_author = $user->id; + $bookkeeping->date_create = $now; + + if (in_array($tabtype[$key], array('sc', 'payment_sc'))) { // If payment is payment of social contribution + $bookkeeping->code_tiers = ''; + $bookkeeping->numero_compte = $k; + } else if ($tabtype[$key] == 'payment') { // If payment is payment of customer invoice, we get ref of invoice + $sqlmid = 'SELECT fac.facnumber'; + $sqlmid .= " FROM " . MAIN_DB_PREFIX . "facture fac "; + $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiement_facture as payfac ON payfac.fk_facture=fac.rowid"; + $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiement as pay ON payfac.fk_paiement=pay.rowid"; + $sqlmid .= " WHERE pay.fk_bank=" . $key; + dol_syslog("accountancy/journal/bankjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG); + $resultmid = $db->query($sqlmid); + if ($resultmid) { + $objmid = $db->fetch_object($resultmid); + $bookkeeping->doc_ref = $objmid->facnumber; + } + $bookkeeping->code_tiers = $tabcompany[$key]['code_compta']; + $bookkeeping->numero_compte = $k; + } else if ($tabtype[$key] == 'payment_supplier') { // If payment is payment of supplier invoice, we get ref of invoice + + $sqlmid = 'SELECT facf.ref_supplier,facf.ref'; + $sqlmid .= " FROM " . MAIN_DB_PREFIX . "facture_fourn facf "; + $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementfourn_facturefourn as payfacf ON payfacf.fk_facturefourn=facf.rowid"; + $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementfourn as payf ON payfacf.fk_paiementfourn=payf.rowid"; + $sqlmid .= " WHERE payf.fk_bank=" . $key; + dol_syslog("accountancy/journal/bankjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG); + $resultmid = $db->query($sqlmid); + if ($resultmid) { + $objmid = $db->fetch_object($resultmid); + $bookkeeping->doc_ref = $objmid->ref_supplier . ' (' . $objmid->ref . ')'; + } + $bookkeeping->code_tiers = $tabcompany[$key]['code_compta']; + $bookkeeping->numero_compte = $k; + } else { + // FIXME Should be a temporary account ??? + $bookkeeping->doc_ref = $k; + //$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER; + $bookkeeping->numero_compte = 'CodeNotDef'; + } + + $result = $bookkeeping->create($user); + if ($result < 0) { + $error++; + $errorforline++; + setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors'); + } + } + } + + if (! $errorforline) + { + $db->commit(); + } + else + { + $db->rollback(); } } if (empty($error)) { - setEventMessages($langs->trans("GeneralLedgerIsWritten"), null, 'mesgs'); + setEventMessages($langs->trans("GeneralLedgerIsWritten"), null, 'mesgs'); } + elseif (count($tabpay) == $error) + { + setEventMessages($langs->trans("NoNewRecordSaved"), null, 'warnings'); + } + else + { + setEventMessages($langs->trans("GeneralLedgerSomeRecordWasNotRecorded"), null, 'warnings'); + } + + $action = ''; } + + + + +/* + * View + */ + +$form = new Form($db); + + // Export if ($action == 'export_csv') { $sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV; @@ -424,7 +495,7 @@ if ($action == 'export_csv') { } if ($reflabel == '(CustomerInvoicePayment)') { $reflabel = $langs->trans('Customer'); - } + } if ($reflabel == '(SocialContributionPayment)') { $reflabel = $langs->trans('SocialContribution'); } @@ -437,7 +508,6 @@ if ($action == 'export_csv') { $companystatic->id = $tabcompany[$key]['id']; $companystatic->name = $tabcompany[$key]['name']; - $companystatic->client = $tabcompany[$key]['code_client']; // Bank foreach ( $tabbq[$key] as $k => $mt ) { @@ -562,14 +632,17 @@ if ($action == 'export_csv') { } } } -else { - $form = new Form($db); +if (empty($action) || $action == 'view') { + $invoicestatic = new Facture($db); + $invoicesupplierstatic = new FactureFournisseur($db); + llxHeader('', $langs->trans("FinanceJournal")); $nom = $langs->trans("FinanceJournal") . ' - ' . $bank_code_journal->getNomUrl(1); $builddate = time(); - $description = $langs->trans("DescFinanceJournal") . '
'; + //$description = $langs->trans("DescFinanceJournal") . '
'; + $description.= $langs->trans("DescJournalOnlyBindedVisible").'
'; $period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1); $varlink = 'id_account=' . $id_bank_account; @@ -577,18 +650,25 @@ else { 'action' => '' ), '', $varlink); - print ''; + if ($conf->global->ACCOUNTING_EXPORT_MODELCSV != 1 && $conf->global->ACCOUNTING_EXPORT_MODELCSV != 2) { + print ''; + } else { + print ''; + } - print ''; + print ''; + // TODO Avoid using js. We can use a direct link with $param print ' '; - -/* - * Action - */ -if ($action == 'ventil' && ! empty($btn_ventil)) { - print '
' . $langs->trans("Processing") . '...
'; - if ($_POST['codeventil'] && $_POST["mesCasesCochees"]) { - print '
' . count($_POST["mesCasesCochees"]) . ' ' . $langs->trans("SelectedLines") . '
'; - $mesCodesVentilChoisis = $codeventil; - $cpt = 0; - - foreach ( $mesCasesCochees as $maLigneCochee ) { - // print '
id selectionnee : '.$monChoix."
"; - $maLigneCourante = explode("_", $maLigneCochee); - $monId = $maLigneCourante[0]; - $monNumLigne = $maLigneCourante[1]; - $monCompte = $mesCodesVentilChoisis[$monNumLigne]; - - $sql = " UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det"; - $sql .= " SET fk_code_ventilation = " . $monCompte; - $sql .= " WHERE rowid = " . $monId; - - $accountventilated = new AccountingAccount($db); - $accountventilated->fetch($monCompte, ''); - - dol_syslog('accountancy/supplier/list.php:: sql=' . $sql, LOG_DEBUG); - if ($db->query($sql)) { - print '
' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' - ' . $langs->trans("VentilatedinAccount") . ' : ' . length_accountg($accountventilated->account_number) . '
'; - } else { - print '
' . $langs->trans("ErrorDB") . ' : ' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' - ' . $langs->trans("NotVentilatedinAccount") . ' : ' . length_accountg($accountventilated->account_number) . '
' . $sql . '
'; - } - - $cpt ++; - } - } else { - print '
' . $langs->trans("AnyLineVentilate") . '
'; - } - print '
' . $langs->trans("EndProcessing") . '
'; -} - -/* - * Supplier Invoice Lines - */ -if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)) { - $limit = $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION; -} else if ($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION <= 0) { - $limit = GETPOST('limit') ? GETPOST('limit', 'int') : $conf->liste_limit; -} else { - $limit = GETPOST('limit') ? GETPOST('limit', 'int') : $conf->liste_limit; -} - -$offset = $limit * $page; - +// Supplier Invoice Lines $sql = "SELECT f.ref, f.rowid as facid, f.ref_supplier, f.datef, l.fk_product, l.description, l.total_ht as price, l.rowid, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, "; $sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_buy as code_buy, p.tva_tx as tva_tx_prod"; $sql .= " , aa.rowid as aarowid"; @@ -191,9 +172,9 @@ $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "facture_fourn_det as l ON f.rowid = l $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON p.accountancy_code_buy = 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 AND fk_code_ventilation <= 0"; +$sql .= " WHERE f.fk_statut > 0 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_buy ='')"; +$sql .= " AND (accsys.rowid='" . $conf->global->CHARTOFACCOUNTS . "' OR p.accountancy_code_buy IS NULL OR p.accountancy_code_buy ='')"; // Add search filter like if (strlen(trim($search_invoice))) { $sql .= " AND (f.ref like '%" . $search_invoice . "%')"; @@ -216,55 +197,77 @@ if (strlen(trim($search_account))) { if (strlen(trim($search_vat))) { $sql .= " AND (l.tva_tx like '" . $search_vat . "%')"; } -if (! empty($conf->multicompany->enabled)) { - $sql .= " AND f.entity IN (" . getEntity("facture_fourn", 1) . ")"; -} +$sql .= " AND f.entity IN (" . getEntity("facture_fourn", 0) . ")"; // We don't share object for accountancy $sql .= $db->order($sortfield, $sortorder); +// Count total nb of records +$nbtotalofrecords = 0; +if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) +{ + $result = $db->query($sql); + $nbtotalofrecords = $db->num_rows($result); +} + $sql .= $db->plimit($limit + 1, $offset); -dol_syslog('accountancy/supplier/list.php:: $sql=' . $sql); +dol_syslog('accountancy/supplier/list.php'); $result = $db->query($sql); if ($result) { $num_lines = $db->num_rows($result); $i = 0; - // TODO : print_barre_liste always use $conf->liste_limit and do not care about custom limit in list... - print_barre_liste($langs->trans("InvoiceLines"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, '', $num_lines); - - print '
' . $langs->trans("DescVentilTodoCustomer") . '
'; - + $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; + print '
' . "\n"; print ''; + if ($optioncss != '') print ''; + print ''; + print ''; + print ''; + print ''; + + $center='
'; + + print_barre_liste($langs->trans("InvoiceLines"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num_lines, 0, 'title_accountancy', 0, '', '', $limit); - print ''; + if ($msg) print $msg.'
'; + + print $langs->trans("DescVentilTodoCustomer") . '

'; + + $moreforfilter = ''; + + print '
'."\n"; print ''; print_liste_field_titre($langs->trans("Invoice"), $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"], "l.total_ht", "", $param, 'align="center"', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, 'align="center"', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("AccountAccounting"), '', '', '', '', 'align="center"'); + print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"], "l.total_ht", "", $param, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre($langs->trans("AccountAccountingSuggest"), '', '', '', '', 'align="center"'); print_liste_field_titre($langs->trans("IntoAccount"), '', '', '', '', 'align="center"'); - print_liste_field_titre(''); - print_liste_field_titre($langs->trans("Ventilate") . '
/', '', '', '', '', 'align="center"'); + print_liste_field_titre($langs->trans("LineId"), $_SERVER["PHP_SELF"], "l.rowid", "", $param, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre('', '', '', '', '', 'align="center"'); print "\n"; print ''; print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; print ''; @@ -314,7 +317,7 @@ if ($result) { if ($objp->code_buy_l != $objp->code_buy_p) $code_buy_p_l_differ = 'color:red'; - print ''; + print ''; // Ref Invoice $facturefourn_static->ref = $objp->ref; @@ -342,29 +345,36 @@ if ($result) { print price($objp->price); print ''; + // Vat rate if ($objp->vat_tx_l != $objp->vat_tx_p) $code_vat_differ = 'font-weight:bold; text-decoration:blink; color:red'; - print ''; + // Accounting account suggested print ''; // Colonne choix du compte print ''; + + // Line id print ''; + // Colonne choix ligne a ventiler - print ''; print ""; @@ -372,7 +382,6 @@ if ($result) { } print '
%%  '; - print ''; - print ' '; - print ''; + print ''; + $searchpitco=$form->showFilterAndCheckAddButtons(1); + print $searchpitco; print '
'; + print ''; print price($objp->tva_tx_line); print ''; - // if not same kind of product_type stored in product & facturedt we display both account and let user choose - if ($objp->code_buy_l == $objp->code_buy_p) { - print $objp->code_buy_l; + if ($objp->code_buy_l == $objp->code_buy_p) { // Test if there is a difference between code by default and code on product + if ($objp->code_buy_l > 0) print $objp->code_buy_l; + else print $langs->trans("Unknown"); } else { - print 'lines=' . $objp->code_buy_l . '
product=' . $objp->code_buy_p; + print $langs->trans("Default") . ' = ' . ($objp->code_buy_l > 0 ? $objp->code_buy_l : $langs->trans("Unknown")); + print '
'; + print $langs->trans("Product") . ' = ' . ($objp->code_buy_p > 0 ? $objp->code_buy_p : $langs->trans("Unknown")); } print '
'; - print $formventilation->select_account($objp->aarowid_suggest, 'codeventil[]', 1); + print $formventilation->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1); print '' . $objp->rowid . ''; - print 'aarowid ? "checked" : "") . '/>'; + print ''; + print 'aarowid ? "checked" : "") . '/>'; print '
'; - print '
'; print '
'; } else { print $db->error(); diff --git a/htdocs/accountancy/tpl/export_journal.tpl.php b/htdocs/accountancy/tpl/export_journal.tpl.php index e9b7c8c005c..f69b47a8017 100644 --- a/htdocs/accountancy/tpl/export_journal.tpl.php +++ b/htdocs/accountancy/tpl/export_journal.tpl.php @@ -1,5 +1,6 @@ + * Copyright (C) 2016 Charlie Benke * * 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 @@ -16,12 +17,12 @@ */ $prefix = $conf->global->ACCOUNTING_EXPORT_PREFIX_SPEC; $format = $conf->global->ACCOUNTING_EXPORT_FORMAT; +$nodateexport = $conf->global->ACCOUNTING_EXPORT_NO_DATE_IN_FILENAME; $date_export = dol_print_date($now, '%Y%m%d%H%M%S'); header('Content-Type: text/csv'); -if ($prefix) - $filename = $prefix . "_" . "journal_" . $journal . $date_export . "." . $format; -else - $filename = "journal_" . $journal . $date_export . "." . $format; -header('Content-Disposition: attachment;filename=' . $filename); \ No newline at end of file + +$filename = ($prefix?$prefix . "_":""). "journal_" . $journal . ($nodateexport?"":$date_export) . "." . $format; + +header('Content-Disposition: attachment;filename=' . $filename); diff --git a/htdocs/adherents/admin/index.html b/htdocs/adherents/admin/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/adherents/agenda.php b/htdocs/adherents/agenda.php index 77fa8022968..1aa1dc6bee7 100644 --- a/htdocs/adherents/agenda.php +++ b/htdocs/adherents/agenda.php @@ -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); @@ -118,6 +120,13 @@ if ($object->id > 0) print ''; + + print '
'; + + $object->info($id); + print dol_print_object_info($object, 1); + + print '
'; dol_fiche_end(); diff --git a/htdocs/adherents/canvas/default/index.html b/htdocs/adherents/canvas/default/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 49048cfaf1f..ddbc7123d70 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -5,7 +5,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2012 Marcos García * Copyright (C) 2012-2016 Philippe Grand - * Copyright (C) 2015 Alexandre Spangaro + * Copyright (C) 2015-2016 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -34,11 +34,12 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php'; -require_once DOL_DOCUMENT_ROOT.'/adherents/class/cotisation.class.php'; +require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; $langs->load("companies"); $langs->load("bills"); @@ -47,10 +48,11 @@ $langs->load("users"); $langs->load('other'); $action=GETPOST('action','alpha'); -$cancel=GETPOST('cancel'); +$cancel=GETPOST('cancel','alpha'); $backtopage=GETPOST('backtopage','alpha'); $confirm=GETPOST('confirm','alpha'); $rowid=GETPOST('rowid','int'); +$id=GETPOST('id')?GETPOST('id','int'):$rowid; $typeid=GETPOST('typeid','int'); $userid=GETPOST('userid','int'); $socid=GETPOST('socid','int'); @@ -71,7 +73,7 @@ $extrafields = new ExtraFields($db); $extralabels=$extrafields->fetch_name_optionals_label($object->table_element); // Get object canvas (By default, this is not defined, so standard usage of dolibarr) -$object->getCanvas($rowid); +$object->getCanvas($id); $canvas = $object->canvas?$object->canvas:GETPOST("canvas"); $objcanvas=null; if (! empty($canvas)) @@ -82,12 +84,12 @@ if (! empty($canvas)) } // Security check -$result=restrictedArea($user, 'adherent', $rowid, '', '', 'fk_soc', 'rowid', $objcanvas); +$result=restrictedArea($user, 'adherent', $id, '', '', 'fk_soc', 'rowid', $objcanvas); -if ($rowid > 0) +if ($id > 0) { // Load member - $result = $object->fetch($rowid); + $result = $object->fetch($id); // Define variables to know what current user can do on users $canadduser=($user->admin || $user->rights->user->user->creer); @@ -105,7 +107,7 @@ if ($rowid > 0) // Define variables to determine what the current user can do on the members $canaddmember=$user->rights->adherent->creer; // Define variables to determine what the current user can do on the properties of a member -if ($rowid) +if ($id) { $caneditfieldmember=$user->rights->adherent->creer; } @@ -114,12 +116,14 @@ if ($rowid) $hookmanager->initHooks(array('membercard','globalcard')); + /* * Actions */ + if ($cancel) $action=''; -$parameters=array('rowid'=>$rowid, 'objcanvas'=>$objcanvas); +$parameters=array('id'=>$id, 'rowid'=>$id, 'objcanvas'=>$objcanvas); $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); @@ -253,6 +257,7 @@ if (empty($reshook)) } $lastname=$_POST["lastname"]; $firstname=$_POST["firstname"]; + $societe=$_POST["societe"]; $morphy=$_POST["morphy"]; $login=$_POST["login"]; if ($morphy != 'mor' && empty($lastname)) { @@ -343,15 +348,15 @@ if (empty($reshook)) $object->setCategories($categories); // Logo/Photo save - $dir= $conf->adherent->dir_output . '/' . get_exdir($object->id,2,0,1,$object,'member').'/photos'; + $dir= $conf->adherent->dir_output . '/' . get_exdir(0,0,0,1,$object,'member').'/photos'; $file_OK = is_uploaded_file($_FILES['photo']['tmp_name']); if ($file_OK) { if (GETPOST('deletephoto')) { require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; - $fileimg=$conf->adherent->dir_output.'/'.get_exdir($object->id,2,0,1,$object,'member').'/photos/'.$object->photo; - $dirthumbs=$conf->adherent->dir_output.'/'.get_exdir($object->id,2,0,1,$object,'member').'/photos/thumbs'; + $fileimg=$conf->adherent->dir_output.'/'.get_exdir(0,0,0,1,$object,'member').'/photos/'.$object->photo; + $dirthumbs=$conf->adherent->dir_output.'/'.get_exdir(0,0,0,1,$object,'member').'/photos/thumbs'; dol_delete_file($fileimg); dol_delete_dir_recursive($dirthumbs); } @@ -394,6 +399,7 @@ if (empty($reshook)) } $rowid=$object->id; + $id=$object->id; $action=''; if (! empty($backtopage)) @@ -404,11 +410,7 @@ if (empty($reshook)) } else { - if ($object->error) { - setEventMessages($object->error, $object->errors, 'errors'); - } else { - setEventMessages($object->error, $object->errors, 'errors'); - } + setEventMessages($object->error, $object->errors, 'errors'); $action=''; } } @@ -428,10 +430,10 @@ if (empty($reshook)) { $birthdate=dol_mktime(12, 0, 0, $_POST["birthmonth"], $_POST["birthday"], $_POST["birthyear"]); } - $datecotisation=''; + $datesubscription=''; if (isset($_POST["reday"]) && isset($_POST["remonth"]) && isset($_POST["reyear"])) { - $datecotisation=dol_mktime(12, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]); + $datesubscription=dol_mktime(12, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]); } $typeid=$_POST["typeid"]; @@ -455,7 +457,7 @@ if (empty($reshook)) $photo=$_POST["photo"]; //$comment=$_POST["comment"]; $morphy=$_POST["morphy"]; - $cotisation=$_POST["cotisation"]; + $subscription=$_POST["subscription"]; $public=$_POST["public"]; $userid=$_POST["userid"]; @@ -560,6 +562,7 @@ if (empty($reshook)) $db->commit(); $rowid=$object->id; + $id=$object->id; $action=''; } else @@ -582,7 +585,7 @@ if (empty($reshook)) if ($user->rights->adherent->supprimer && $action == 'confirm_delete' && $confirm == 'yes') { - $result=$object->delete($rowid); + $result=$object->delete($id); if ($result > 0) { if (! empty($backtopage)) @@ -711,6 +714,11 @@ if (empty($reshook)) } } } + + // Actions to build doc + $upload_dir = $conf->adherent->dir_output; + $permissioncreate=$user->rights->adherent->creer; + include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; } @@ -719,10 +727,12 @@ if (empty($reshook)) */ $form = new Form($db); +$formfile = new FormFile($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").')'; @@ -731,10 +741,10 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) // ----------------------------------------- // When used with CANVAS // ----------------------------------------- - if (empty($object->error) && $rowid) + if (empty($object->error) && $id) { $object = new Adherent($db); - $result=$object->fetch($rowid); + $result=$object->fetch($id); if ($result <= 0) dol_print_error('',$object->error); } $objcanvas->assign_values($action, $object->id, $object->ref); // Set value for templates @@ -974,7 +984,7 @@ else * ********************************************/ - $res=$object->fetch($rowid); + $res=$object->fetch($id); if ($res < 0) { dol_print_error($db,$object->error); exit; } @@ -1039,14 +1049,10 @@ else print ''."\n"; } - $rowspan=15; - if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) $rowspan++; - if (! empty($conf->societe->enabled)) $rowspan++; - print '
'; print ''; print ''; - print ''; + print ''; print ''; if ($backtopage) print ''; @@ -1055,7 +1061,7 @@ else print ''; // Ref - print ''; + print ''; // Login if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) @@ -1068,21 +1074,7 @@ else $morphys["mor"] = $langs->trans("Morale"); print '"; - - // Photo - print ''; + print ""; // Type print ''; print ''; + // Photo + print ''; + print ''; + // EMail print ''; @@ -1238,7 +1245,7 @@ else } - if ($rowid && $action != 'edit') + if ($id > 0 && $action != 'edit') { /* ************************************************************************** */ /* */ @@ -1246,7 +1253,7 @@ else /* */ /* ************************************************************************** */ - $res=$object->fetch($rowid); + $res=$object->fetch($id); if ($res < 0) { dol_print_error($db,$object->error); exit; } @@ -1346,13 +1353,13 @@ else if (! empty($conf->mailman->enabled) && ! empty($conf->global->ADHERENT_USE_SPIP)) { $formquestion[]=array('type'=>'other','label'=>$langs->transnoentitiesnoconv("SynchroSpipEnabled"),'value'=>''); } - print $form->formconfirm("card.php?rowid=".$rowid,$langs->trans("ValidateMember"),$langs->trans("ConfirmValidateMember"),"confirm_valid",$formquestion,1,1); + print $form->formconfirm("card.php?rowid=".$id,$langs->trans("ValidateMember"),$langs->trans("ConfirmValidateMember"),"confirm_valid",$formquestion,1,1); } // Confirm send card by mail if ($action == 'sendinfo') { - print $form->formconfirm("card.php?rowid=".$rowid,$langs->trans("SendCardByMail"),$langs->trans("ConfirmSendCardByMail",$object->email),"confirm_sendinfo",'',0,1); + print $form->formconfirm("card.php?rowid=".$id,$langs->trans("SendCardByMail"),$langs->trans("ConfirmSendCardByMail",$object->email),"confirm_sendinfo",'',0,1); } // Confirm terminate @@ -1383,7 +1390,7 @@ else $formquestion=array(); if ($object->email) $formquestion[]=array('type' => 'checkbox', 'name' => 'send_mail', 'label' => $label, 'value' => (! empty($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL)?'true':'false')); if ($backtopage) $formquestion[]=array('type' => 'hidden', 'name' => 'backtopage', 'value' => ($backtopage != '1' ? $backtopage : $_SERVER["HTTP_REFERER"])); - print $form->formconfirm("card.php?rowid=".$rowid,$langs->trans("ResiliateMember"),$langs->trans("ConfirmResiliateMember"),"confirm_resign",$formquestion,'no',1); + print $form->formconfirm("card.php?rowid=".$id,$langs->trans("ResiliateMember"),$langs->trans("ConfirmResiliateMember"),"confirm_resign",$formquestion,'no',1); } // Confirm remove member @@ -1391,18 +1398,18 @@ else { $formquestion=array(); if ($backtopage) $formquestion[]=array('type' => 'hidden', 'name' => 'backtopage', 'value' => ($backtopage != '1' ? $backtopage : $_SERVER["HTTP_REFERER"])); - print $form->formconfirm("card.php?rowid=".$rowid,$langs->trans("DeleteMember"),$langs->trans("ConfirmDeleteMember"),"confirm_delete",$formquestion,0,1); + print $form->formconfirm("card.php?rowid=".$id,$langs->trans("DeleteMember"),$langs->trans("ConfirmDeleteMember"),"confirm_delete",$formquestion,0,1); } // Confirm add in spip if ($action == 'add_spip') { - print $form->formconfirm("card.php?rowid=".$rowid, $langs->trans('AddIntoSpip'), $langs->trans('AddIntoSpipConfirmation'), 'confirm_add_spip'); + print $form->formconfirm("card.php?rowid=".$id, $langs->trans('AddIntoSpip'), $langs->trans('AddIntoSpipConfirmation'), 'confirm_add_spip'); } // Confirm removed from spip if ($action == 'del_spip') { - print $form->formconfirm("card.php?rowid=$rowid", $langs->trans('DeleteIntoSpip'), $langs->trans('DeleteIntoSpipConfirmation'), 'confirm_del_spip'); + print $form->formconfirm("card.php?rowid=$id", $langs->trans('DeleteIntoSpip'), $langs->trans('DeleteIntoSpipConfirmation'), 'confirm_del_spip'); } $rowspan=17; @@ -1422,11 +1429,11 @@ else // Login if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) { - print ''; + print ''; } // Type - print '\n"; + print '\n"; // Morphy print ''; @@ -1443,6 +1450,12 @@ else if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) { print ''; } - + print '
'.$langs->trans("Ref").''.$object->id.'
'.$langs->trans("Ref").''.$object->id.'
'.$langs->trans("Nature").''; print $form->selectarray("morphy", $morphys, isset($_POST["morphy"])?$_POST["morphy"]:$object->morphy); - print "'; - print $form->showphoto('memberphoto',$object)."\n"; - if ($caneditfieldmember) - { - if ($object->photo) print "
\n"; - print ''; - if ($object->photo) print ''; - print ''; - print ''; - print '
'.$langs->trans("Delete").'

'.$langs->trans("PhotoFile").'
'; - } - print '
'.$langs->trans("Type").''; @@ -1114,6 +1106,21 @@ else print '
'.$langs->trans("Firstname").'firstname).'">
'.$langs->trans("Photo").''; + print $form->showphoto('memberphoto',$object)."\n"; + if ($caneditfieldmember) + { + if ($object->photo) print "
\n"; + print ''; + if ($object->photo) print ''; + print ''; + print ''; + print '
'.$langs->trans("Delete").'

'.$langs->trans("PhotoFile").'
'; + } + print '
'.($conf->global->ADHERENT_MAIL_REQUIRED?'':'').$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED?'':'').'email).'">
'.$langs->trans("Login").' / '.$langs->trans("Id").''.$object->login.' 
'.$langs->trans("Login").' / '.$langs->trans("Id").''.$object->login.' 
'.$langs->trans("Type").''.$adht->getNomUrl(1)."
'.$langs->trans("Type").''.$adht->getNomUrl(1)."
'.$langs->trans("Nature").''.$object->getmorphylib().'
'.$langs->trans("Password").''.preg_replace('/./i','*',$object->pass); + if ($object->pass) print preg_replace('/./i','*',$object->pass); + else + { + if ($user->admin) print $langs->trans("Crypted").': '.$object->pass_indatabase_crypted; + else print $langs->trans("Hidden"); + } if ((! empty($object->pass) || ! empty($object->pass_crypted)) && empty($object->user_id)) { $langs->load("errors"); @@ -1451,7 +1464,7 @@ else } print '
'; print '
'; @@ -1461,7 +1474,7 @@ else print ''; // Birthday - print ''; + print ''; // Public print ''; @@ -1483,6 +1496,30 @@ else print $object->showOptionals($extrafields, 'view', $parameters); } + // Date end subscription + print ''; + // Third party Dolibarr if (! empty($conf->societe->enabled)) { @@ -1553,30 +1590,6 @@ else } print ''; - // Date end subscription - print ''; - print "
'.$langs->trans("Birthday").''.dol_print_date($object->birth,'day').'
'.$langs->trans("Birthday").''.dol_print_date($object->birth,'day').'
'.$langs->trans("Public").''.yn($object->public).'
'.$langs->trans("SubscriptionEndDate").''; + if ($object->datefin) + { + print dol_print_date($object->datefin,'day'); + if ($object->hasDelay()) { + print " ".img_warning($langs->trans("Late")); + } + } + else + { + if (! $adht->subscription) + { + print $langs->trans("SubscriptionNotRecorded"); + if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // displays delay Pictogram only if not a draft and not terminated + } + else + { + print $langs->trans("SubscriptionNotReceived"); + if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // displays delay Pictogram only if not a draft and not terminated + } + } + print '
'.$langs->trans("SubscriptionEndDate").''; - if ($object->datefin) - { - print dol_print_date($object->datefin,'day'); - if ($object->hasDelay()) { - print " ".img_warning($langs->trans("Late")); - } - } - else - { - if (! $adht->cotisation) - { - print $langs->trans("SubscriptionNotRecorded"); - if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // displays delay Pictogram only if not a draft and not terminated - } - else - { - print $langs->trans("SubscriptionNotReceived"); - if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // displays delay Pictogram only if not a draft and not terminated - } - } - print '
\n"; print "
\n"; @@ -1598,7 +1611,7 @@ else // Modify if ($user->rights->adherent->creer) { - print '"; + print '"; } else { @@ -1610,7 +1623,7 @@ else { if ($user->rights->adherent->creer) { - print '\n"; + print '\n"; } else { @@ -1623,7 +1636,7 @@ else { if ($user->rights->adherent->creer) { - print '\n"; + print '\n"; } else { @@ -1654,7 +1667,7 @@ else { if ($user->rights->adherent->supprimer) { - print '\n"; + print '\n"; } else { @@ -1723,8 +1736,49 @@ else { print '

'.$langs->trans('SPIPConnectionFailed').': '.$mailmanspip->error.''; } - print "
\n"; + + + print '
'; + print ''; // ancre + + // Documents generes + $filename = dol_sanitizeFileName($object->ref); + //$filename = 'tmp_cards.php'; + //$filedir = $conf->adherent->dir_output . '/' . get_exdir($object->id, 2, 0, 0, $object, 'member') . dol_sanitizeFileName($object->ref); + $filedir = $conf->adherent->dir_output . '/' . get_exdir(0, 0, 0, 0, $object, 'member'); + $urlsource = $_SERVER['PHP_SELF'] . '?id=' . $object->id; + $genallowed = $user->rights->adherent->creer; + $delallowed = $user->rights->adherent->supprimer; + + print $formfile->showdocuments('member', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $object->default_lang, '', $object); + $somethingshown = $formfile->numoffiles; + + // Show links to link elements + //$linktoelem = $form->showLinkToObjectBlock($object, null, array('subscription')); + //$somethingshown = $form->showLinkedObjectBlock($object, ''); + + // Show links to link elements + /*$linktoelem = $form->showLinkToObjectBlock($object,array('order')); + if ($linktoelem) print ($somethingshown?'':'
').$linktoelem; + + // Link for paypal payment + /* + if (! empty($conf->paypal->enabled) && $object->statut != 0) { + include_once DOL_DOCUMENT_ROOT . '/paypal/lib/paypal.lib.php'; + print showPaypalPaymentUrl('invoice', $object->ref); + } + */ + print '
'; + + // List of actions on element + /* Already in tab Agenda/Events + include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php'; + $formactions = new FormActions($db); + $somethingshown = $formactions->showactions($object, 'member', $socid); + */ + print '
'; + } } diff --git a/htdocs/adherents/cartes/carte.php b/htdocs/adherents/cartes/carte.php index b5e4efaec16..db4c631c0c9 100644 --- a/htdocs/adherents/cartes/carte.php +++ b/htdocs/adherents/cartes/carte.php @@ -60,7 +60,7 @@ if ((! empty($foruserid) || ! empty($foruserlogin) || ! empty($mode)) && ! $mesg { $arrayofmembers=array(); - // requete en prenant que les adherents a jour de cotisation + // request taking into account member with up to date subscriptions $sql = "SELECT d.rowid, d.firstname, d.lastname, d.login, d.societe as company, d.datefin,"; $sql.= " d.address, d.zip, d.town, d.country, d.birth, d.email, d.photo,"; $sql.= " t.libelle as type,"; @@ -89,25 +89,25 @@ if ((! empty($foruserid) || ! empty($foruserlogin) || ! empty($mode)) && ! $mesg // List of values to scan for a replacement $substitutionarray = array ( - '%ID%'=>$objp->rowid, - '%LOGIN%'=>$objp->login, - '%FIRSTNAME%'=>$objp->firstname, - '%LASTNAME%'=>$objp->lastname, - '%FULLNAME%'=>$adherentstatic->getFullName($langs), - '%COMPANY%'=>$objp->company, - '%ADDRESS%'=>$objp->address, - '%ZIP%'=>$objp->zip, - '%TOWN%'=>$objp->town, - '%COUNTRY%'=>$objp->country, - '%COUNTRY_CODE%'=>$objp->country_code, - '%EMAIL%'=>$objp->email, - '%BIRTH%'=>dol_print_date($objp->birth,'day'), - '%TYPE%'=>$objp->type, - '%YEAR%'=>$year, - '%MONTH%'=>$month, - '%DAY%'=>$day, - '%DOL_MAIN_URL_ROOT%'=>DOL_MAIN_URL_ROOT, - '%SERVER%'=>"http://".$_SERVER["SERVER_NAME"]."/" + '%ID%'=>$objp->rowid, + '%LOGIN%'=>$objp->login, + '%FIRSTNAME%'=>$objp->firstname, + '%LASTNAME%'=>$objp->lastname, + '%FULLNAME%'=>$adherentstatic->getFullName($langs), + '%COMPANY%'=>$objp->company, + '%ADDRESS%'=>$objp->address, + '%ZIP%'=>$objp->zip, + '%TOWN%'=>$objp->town, + '%COUNTRY%'=>$objp->country, + '%COUNTRY_CODE%'=>$objp->country_code, + '%EMAIL%'=>$objp->email, + '%BIRTH%'=>dol_print_date($objp->birth,'day'), + '%TYPE%'=>$objp->type, + '%YEAR%'=>$year, + '%MONTH%'=>$month, + '%DAY%'=>$day, + '%DOL_MAIN_URL_ROOT%'=>DOL_MAIN_URL_ROOT, + '%SERVER%'=>"http://".$_SERVER["SERVER_NAME"]."/" ); complete_substitutions_array($substitutionarray, $langs); @@ -121,7 +121,10 @@ if ((! empty($foruserid) || ! empty($foruserlogin) || ! empty($mode)) && ! $mesg if (is_numeric($foruserid) || $foruserlogin) { - for($j=0;$j<100;$j++) + $nb = $_Avery_Labels[$model]['NX'] * $_Avery_Labels[$model]['NY']; + if ($nb <= 0) $nb=1; // Protection to avoid empty page + + for($j=0;$j<$nb;$j++) { $arrayofmembers[]=array( 'textleft'=>$textleft, diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 87ceb66f9d1..191b23bea32 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -5,10 +5,11 @@ * Copyright (C) 2004 Sebastien Di Cintio * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2009-2012 Regis Houssin - * Copyright (C) 2014-2015 Alexandre Spangaro - * Copyright (C) 2015 Marcos García - * Copyright (C) 2015 Frederic France - * Copyright (C) 2015 Raphaël Doursenaud + * Copyright (C) 2014-2016 Alexandre Spangaro + * Copyright (C) 2015 Marcos García + * Copyright (C) 2015 Frederic France + * Copyright (C) 2015 Raphaël Doursenaud + * Copyright (C) 2016 Juanjo Menent * * 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 @@ -47,8 +48,15 @@ class Adherent extends CommonObject var $mesgs; var $login; - var $pass; - var $societe; + + //! Clear password in memory + var $pass; + //! Clear password in database (defined if DATABASE_PWD_ENCRYPTED=0) + var $pass_indatabase; + //! Encrypted password in database (always defined) + var $pass_indatabase_crypted; + + var $societe; var $company; var $address; var $zip; @@ -309,7 +317,7 @@ class Adherent extends CommonObject if ($id > 0) { $this->id=$id; - $this->ref=$id; + $this->ref=(string) $id; // Update minor fields $result=$this->update($user,1,1,0,0,'add'); // nosync is 1 to avoid update data of user @@ -346,7 +354,7 @@ class Adherent extends CommonObject if (count($this->errors)) { - dol_syslog(get_class($this)."::create ".join(',',$this->errors), LOG_ERR); + dol_syslog(get_class($this)."::create ".implode(',',$this->errors), LOG_ERR); $this->db->rollback(); return -3; } @@ -439,8 +447,8 @@ class Adherent extends CommonObject $sql.= ", fk_adherent_type=".$this->typeid; $sql.= ", morphy='".$this->morphy."'"; $sql.= ", birth=" .($this->birth?"'".$this->db->idate($this->birth)."'":"null"); - if ($this->datefin) $sql.= ", datefin='".$this->db->idate($this->datefin)."'"; // Ne doit etre modifie que par effacement cotisation - if ($this->datevalid) $sql.= ", datevalid='".$this->db->idate($this->datevalid)."'"; // Ne doit etre modifie que par validation adherent + if ($this->datefin) $sql.= ", datefin='".$this->db->idate($this->datefin)."'"; // Must be modified only when deleting a subscription + if ($this->datevalid) $sql.= ", datevalid='".$this->db->idate($this->datevalid)."'"; // Must be modified only when validating a member $sql.= ", fk_user_mod=".($user->id>0?$user->id:'null'); // Can be null because member can be create by a guest $sql.= " WHERE rowid = ".$this->id; @@ -482,8 +490,10 @@ class Adherent extends CommonObject dol_syslog(get_class($this)."::update update password"); if ($this->pass != $this->pass_indatabase && $this->pass != $this->pass_indatabase_crypted) { - // Si mot de passe saisi et different de celui en base - $result=$this->setPassword($user,$this->pass,0,$notrigger,$nosyncuserpass); + $isencrypted = empty($conf->global->DATABASE_PWD_ENCRYPTED)?0:1; + + // If password to set differs from the one found into database + $result=$this->setPassword($user,$this->pass,$isencrypted,$notrigger,$nosyncuserpass); if (! $nbrowsaffected) $nbrowsaffected++; } } @@ -509,7 +519,7 @@ class Adherent extends CommonObject if (! $error && $nbrowsaffected) // If something has change in main data { // Update information on linked user if it is an update - if ($this->user_id > 0 && ! $nosyncuser) + if (! $error && $this->user_id > 0 && ! $nosyncuser) { require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; @@ -552,7 +562,7 @@ class Adherent extends CommonObject } // Update information on linked thirdparty if it is an update - if ($this->fk_soc > 0 && ! $nosyncthirdparty) + if (! $error && $this->fk_soc > 0 && ! $nosyncthirdparty) { require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; @@ -633,7 +643,7 @@ class Adherent extends CommonObject // Search for last subscription id and end date $sql = "SELECT rowid, datec as dateop, dateadh as datedeb, datef as datefin"; - $sql.= " FROM ".MAIN_DB_PREFIX."cotisation"; + $sql.= " FROM ".MAIN_DB_PREFIX."subscription"; $sql.= " WHERE fk_adherent='".$this->id."'"; $sql.= " ORDER by dateadh DESC"; // Sort by start subscription date @@ -707,10 +717,10 @@ class Adherent extends CommonObject } - // Remove cotisation + // Remove subscription if (! $error) { - $sql = "DELETE FROM ".MAIN_DB_PREFIX."cotisation WHERE fk_adherent = ".$rowid; + $sql = "DELETE FROM ".MAIN_DB_PREFIX."subscription WHERE fk_adherent = ".$rowid; dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) @@ -810,13 +820,11 @@ class Adherent extends CommonObject $password=getRandomPassword(false); } - // Cryptage mot de passe - if ($isencrypted) - { - // Encryption - $password_indatabase = dol_hash($password); - } - else + // Crypt password + $password_crypted = dol_hash($password); + + $password_indatabase = ''; + if (! $isencrypted) { $password_indatabase = $password; } @@ -824,7 +832,17 @@ class Adherent extends CommonObject $this->db->begin(); // Mise a jour - $sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET pass = '".$this->db->escape($password_indatabase)."'"; + $sql = "UPDATE ".MAIN_DB_PREFIX."adherent"; + $sql.= " SET pass_crypted = '".$this->db->escape($password_crypted)."'"; + //if (! empty($conf->global->DATABASE_PWD_ENCRYPTED)) + if ($isencrypted) + { + $sql.= ", pass = null"; + } + else + { + $sql.= ", pass = '".$this->db->escape($password_indatabase)."'"; + } $sql.= " WHERE rowid = ".$this->id; //dol_syslog("Adherent::Password sql=hidden"); @@ -838,7 +856,8 @@ class Adherent extends CommonObject { $this->pass=$password; $this->pass_indatabase=$password_indatabase; - + $this->pass_indatabase_crypted=$password_crypted; + if ($this->user_id && ! $nosyncuser) { require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; @@ -1042,7 +1061,7 @@ class Adherent extends CommonObject $sql = "SELECT d.rowid, d.ref_ext, d.civility as civility_id, d.firstname, d.lastname, d.societe as company, d.fk_soc, d.statut, d.public, d.address, d.zip, d.town, d.note_private,"; $sql.= " d.note_public,"; - $sql.= " d.email, d.skype, d.phone, d.phone_perso, d.phone_mobile, d.login, d.pass,"; + $sql.= " d.email, d.skype, d.phone, d.phone_perso, d.phone_mobile, d.login, d.pass, d.pass_crypted,"; $sql.= " d.photo, d.fk_adherent_type, d.morphy, d.entity,"; $sql.= " d.datec as datec,"; $sql.= " d.tms as datem,"; @@ -1051,9 +1070,10 @@ class Adherent extends CommonObject $sql.= " d.datevalid as datev,"; $sql.= " d.country,"; $sql.= " d.state_id,"; + $sql.= " d.model_pdf,"; $sql.= " c.rowid as country_id, c.code as country_code, c.label as country,"; $sql.= " dep.nom as state, dep.code_departement as state_code,"; - $sql.= " t.libelle as type, t.cotisation as cotisation,"; + $sql.= " t.libelle as type, t.subscription as subscription,"; $sql.= " u.rowid as user_id, u.login as user_login"; $sql.= " FROM ".MAIN_DB_PREFIX."adherent_type as t, ".MAIN_DB_PREFIX."adherent as d"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON d.country = c.rowid"; @@ -1087,7 +1107,6 @@ class Adherent extends CommonObject $this->firstname = $obj->firstname; $this->lastname = $obj->lastname; $this->login = $obj->login; - $this->pass = $obj->pass; $this->societe = $obj->company; $this->company = $obj->company; $this->fk_soc = $obj->fk_soc; @@ -1095,6 +1114,10 @@ class Adherent extends CommonObject $this->zip = $obj->zip; $this->town = $obj->town; + $this->pass = $obj->pass; + $this->pass_indatabase = $obj->pass; + $this->pass_indatabase_crypted = $obj->pass_crypted; + $this->state_id = $obj->state_id; $this->state_code = $obj->state_id?$obj->state_code:''; $this->state = $obj->state_id?$obj->state:''; @@ -1128,10 +1151,12 @@ class Adherent extends CommonObject $this->typeid = $obj->fk_adherent_type; $this->type = $obj->type; - $this->need_subscription = ($obj->cotisation=='yes'?1:0); + $this->need_subscription = ($obj->subscription=='yes'?1:0); $this->user_id = $obj->user_id; $this->user_login = $obj->user_login; + + $this->model_pdf = $obj->model_pdf; // Retreive all extrafield for thirdparty // fetch optionals attributes and labels @@ -1171,14 +1196,14 @@ class Adherent extends CommonObject { global $langs; - require_once DOL_DOCUMENT_ROOT.'/adherents/class/cotisation.class.php'; + require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php'; - $sql = "SELECT c.rowid, c.fk_adherent, c.cotisation, c.note, c.fk_bank,"; + $sql = "SELECT c.rowid, c.fk_adherent, c.subscription, c.note, c.fk_bank,"; $sql.= " c.tms as datem,"; $sql.= " c.datec as datec,"; $sql.= " c.dateadh as dateh,"; $sql.= " c.datef as datef"; - $sql.= " FROM ".MAIN_DB_PREFIX."cotisation as c"; + $sql.= " FROM ".MAIN_DB_PREFIX."subscription as c"; $sql.= " WHERE c.fk_adherent = ".$this->id; $sql.= " ORDER BY c.dateadh"; dol_syslog(get_class($this)."::fetch_subscriptions", LOG_DEBUG); @@ -1194,15 +1219,15 @@ class Adherent extends CommonObject if ($i==0) { $this->first_subscription_date=$obj->dateh; - $this->first_subscription_amount=$obj->cotisation; + $this->first_subscription_amount=$obj->subscription; } $this->last_subscription_date=$obj->dateh; - $this->last_subscription_amount=$obj->cotisation; + $this->last_subscription_amount=$obj->subscription; - $subscription=new Cotisation($this->db); + $subscription=new Subscription($this->db); $subscription->id=$obj->rowid; $subscription->fk_adherent=$obj->fk_adherent; - $subscription->amount=$obj->cotisation; + $subscription->amount=$obj->subscription; $subscription->note=$obj->note; $subscription->fk_bank=$obj->fk_bank; $subscription->datem=$this->db->jdate($obj->datem); @@ -1238,11 +1263,11 @@ class Adherent extends CommonObject * @param int $datesubend Date end subscription * @return int rowid of record added, <0 if KO */ - function cotisation($date, $montant, $accountid=0, $operation='', $label='', $num_chq='', $emetteur_nom='', $emetteur_banque='', $datesubend=0) + function subscription($date, $montant, $accountid=0, $operation='', $label='', $num_chq='', $emetteur_nom='', $emetteur_banque='', $datesubend=0) { global $conf,$langs,$user; - require_once DOL_DOCUMENT_ROOT.'/adherents/class/cotisation.class.php'; + require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php'; $error=0; @@ -1263,14 +1288,14 @@ class Adherent extends CommonObject } // Create subscription - $cotisation=new Cotisation($this->db); - $cotisation->fk_adherent=$this->id; - $cotisation->dateh=$date; // Date of new subscription - $cotisation->datef=$datefin; // End data of new subscription - $cotisation->amount=$montant; - $cotisation->note=$label; + $subscription=new Subscription($this->db); + $subscription->fk_adherent=$this->id; + $subscription->dateh=$date; // Date of new subscription + $subscription->datef=$datefin; // End data of new subscription + $subscription->amount=$montant; + $subscription->note=$label; - $rowid=$cotisation->create($user); + $rowid=$subscription->create($user); if ($rowid > 0) { // Update denormalized subscription end date (read database subscription to find values) @@ -1303,7 +1328,7 @@ class Adherent extends CommonObject } else { - $this->error=$cotisation->error; + $this->error=$subscription->error; $this->db->rollback(); return -1; } @@ -1423,9 +1448,10 @@ class Adherent extends CommonObject $err=0; // mailman - if (! empty($conf->global->ADHERENT_USE_MAILMAN)) + if (! empty($conf->global->ADHERENT_USE_MAILMAN) && ! empty($conf->mailmanspip->enabled)) { $result=$mailmanspip->add_to_mailman($this); + if ($result < 0) { if (! empty($mailmanspip->error)) $this->errors[]=$mailmanspip->error; @@ -1444,7 +1470,7 @@ class Adherent extends CommonObject } // spip - if ($conf->global->ADHERENT_USE_SPIP && ! empty($conf->mailmanspip->enabled)) + if (! empty($conf->global->ADHERENT_USE_SPIP) && ! empty($conf->mailmanspip->enabled)) { $result=$mailmanspip->add_to_spip($this); if ($result < 0) @@ -1458,7 +1484,7 @@ class Adherent extends CommonObject return -$err; } else - { + { return 1; } } @@ -1556,20 +1582,15 @@ class Adherent extends CommonObject $label.= '
' . $langs->trans('Name') . ': ' . $this->getFullName($langs); $linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; - if ($option == 'card') + $link=''; $linkend=''; + if ($option == 'card' || $option == 'category') { $link = ''; - } - if ($option == 'category') - { - $type = Categorie::TYPE_MEMBER; - $link = ''; } @@ -1596,7 +1617,7 @@ class Adherent extends CommonObject * Renvoi le libelle d'un statut donne * * @param int $statut Id statut - * @param int $need_subscription 1 si type adherent avec cotisation, 0 sinon + * @param int $need_subscription 1 if member type need subscription, 0 otherwise * @param int $date_end_subscription Date fin adhesion * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Label @@ -1735,7 +1756,7 @@ class Adherent extends CommonObject $langs->load("members"); $response = new WorkboardResponse(); - $response->warning_delay=$conf->adherent->cotisation->warning_delay/60/60/24; + $response->warning_delay=$conf->adherent->subscription->warning_delay/60/60/24; $response->label=$langs->trans("MembersWithSubscriptionToReceive"); $response->url=DOL_URL_ROOT.'/adherents/list.php?mainmenu=members&statut=1&filter=outofdate'; $response->img=img_object($langs->trans("Members"),"user"); @@ -1765,6 +1786,41 @@ class Adherent extends CommonObject } + /** + * Create a document onto disk according to template module. + * + * @param string $modele Force template to use ('' to not force) + * @param Translate $outputlangs objet lang a utiliser pour traduction + * @param int $hidedetails Hide details of lines + * @param int $hidedesc Hide description + * @param int $hideref Hide ref + * @return int 0 if KO, 1 if OK + */ + public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) + { + global $conf,$langs; + + $langs->load("orders"); + + // Positionne le modele sur le nom du modele a utiliser + if (! dol_strlen($modele)) + { + if (! empty($conf->global->ADHERENT_ADDON_PDF)) + { + $modele = $conf->global->ADHERENT_ADDON_PDF; + } + else + { + $modele = 'standard'; + } + } + + $modelpath = "core/modules/member/doc/"; + + return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref); + } + + /** * Initialise an instance with random values. * Used to build previews or test instances. @@ -2021,7 +2077,7 @@ class Adherent extends CommonObject $now = dol_now(); - return $this->datefin < ($now - $conf->adherent->cotisation->warning_delay); + return $this->datefin < ($now - $conf->adherent->subscription->warning_delay); } } diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index 71f41d84e00..7520bdbf6a5 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -2,7 +2,7 @@ /* Copyright (C) 2002 Rodolphe Quiedeville * Copyright (C) 2004-2008 Laurent Destailleur * Copyright (C) 2009 Regis Houssin - * Copyright (C) 2016 Charlie Benke + * Copyright (C) 2016 Charlie Benke * * 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 @@ -33,17 +33,28 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; */ class AdherentType extends CommonObject { - public $table_element = 'adherent_type'; - public $element = 'adherent_type'; + public $table_element = 'adherent_type'; + public $element = 'adherent_type'; - var $id; - var $ref; - var $libelle; - var $cotisation; // Soumis a la cotisation - var $note; - var $vote; // droit de vote - var $mail_valid; //mail envoye lors de la validation - var $statut; + /** @var string Label */ + public $libelle; + /** + * @var bool + * @deprecated Use subscription + * @see subscription + */ + public $cotisation; + /** + * @var bool Subsription required + * @since 5.0 + */ + public $subscription; + /** @var string Public note */ + public $note; + /** @var bool Can vote*/ + public $vote; + /** @var bool Email sent during validation */ + public $mail_valid; /** @@ -111,7 +122,7 @@ class AdherentType extends CommonObject $sql.= "SET "; $sql.= "statut = ".$this->statut.","; $sql.= "libelle = '".$this->db->escape($this->libelle) ."',"; - $sql.= "cotisation = '".$this->cotisation."',"; + $sql.= "subscription = '".$this->subscription."',"; $sql.= "note = '".$this->db->escape($this->note)."',"; $sql.= "vote = '".$this->vote."',"; $sql.= "mail_valid = '".$this->db->escape($this->mail_valid)."'"; @@ -188,7 +199,7 @@ class AdherentType extends CommonObject */ function fetch($rowid) { - $sql = "SELECT d.rowid, d.libelle, d.statut, d.cotisation, d.mail_valid, d.note, d.vote"; + $sql = "SELECT d.rowid, d.libelle, d.statut, d.subscription, d.mail_valid, d.note, d.vote"; $sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as d"; $sql .= " WHERE d.rowid = ".$rowid; @@ -205,7 +216,7 @@ class AdherentType extends CommonObject $this->ref = $obj->rowid; $this->libelle = $obj->libelle; $this->statut = $obj->statut; - $this->cotisation = $obj->cotisation; + $this->subscription = $obj->subscription; $this->mail_valid = $obj->mail_valid; $this->note = $obj->note; $this->vote = $obj->vote; diff --git a/htdocs/adherents/class/adherentstats.class.php b/htdocs/adherents/class/adherentstats.class.php index d3f72d2ea5d..97a4c8201a7 100644 --- a/htdocs/adherents/class/adherentstats.class.php +++ b/htdocs/adherents/class/adherentstats.class.php @@ -24,7 +24,7 @@ */ include_once DOL_DOCUMENT_ROOT . '/core/class/stats.class.php'; -include_once DOL_DOCUMENT_ROOT . '/adherents/class/cotisation.class.php'; +include_once DOL_DOCUMENT_ROOT . '/adherents/class/subscription.class.php'; /** @@ -57,12 +57,12 @@ class AdherentStats extends Stats $this->socid = $socid; $this->userid = $userid; - $object=new Cotisation($this->db); + $object=new Subscription($this->db); $this->from = MAIN_DB_PREFIX.$object->table_element." as p"; $this->from.= ", ".MAIN_DB_PREFIX."adherent as m"; - $this->field='cotisation'; + $this->field='subscription'; $this->where.= " m.statut != 0"; $this->where.= " AND p.fk_adherent = m.rowid AND m.entity IN (".getEntity('adherent', 1).")"; @@ -76,7 +76,7 @@ class AdherentStats extends Stats /** - * Renvoie le nombre de proposition par mois pour une annee donnee + * Return the number of proposition by month for a given year * * @param int $year Year * @return array Array of nb each month @@ -97,7 +97,7 @@ class AdherentStats extends Stats } /** - * Renvoie le nombre de cotisation par annee + * Return the number of subscriptions by year * * @return array Array of nb each year */ @@ -116,7 +116,7 @@ class AdherentStats extends Stats } /** - * Renvoie le nombre de cotisation par mois pour une annee donnee + * Return the number of subscriptions by month for a given year * * @param int $year Year * @return array Array of amount each month diff --git a/htdocs/adherents/class/api_members.class.php b/htdocs/adherents/class/api_members.class.php new file mode 100644 index 00000000000..548b5728b1a --- /dev/null +++ b/htdocs/adherents/class/api_members.class.php @@ -0,0 +1,365 @@ + + * + * 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 . + */ + +use Luracast\Restler\RestException; + +require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; +require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php'; + +/** + * API class for members + * + * @access protected + * @class DolibarrApiAccess {@requires user,external} + */ +class Members extends DolibarrApi +{ + /** + * @var array $FIELDS Mandatory fields, checked when create and update object + */ + static $FIELDS = array( + 'morphy', + 'typeid' + ); + + /** + * Constructor + */ + function __construct() + { + global $db, $conf; + $this->db = $db; + } + + /** + * Get properties of a member object + * + * Return an array with member informations + * + * @param int $id ID of member + * @return array|mixed data without useless information + * + * @throws RestException + */ + function get($id) + { + if(! DolibarrApiAccess::$user->rights->adherent->lire) { + throw new RestException(401); + } + + $member = new Adherent($this->db); + $result = $member->fetch($id); + if( ! $result ) { + throw new RestException(404, 'member not found'); + } + + if( ! DolibarrApi::_checkAccessToResource('adherent',$member->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + + return $this->_cleanObjectDatas($member); + } + + /** + * List members + * + * Get a list of members + * + * @param string $sortfield Sort field + * @param string $sortorder Sort order + * @param int $limit Limit for list + * @param int $page Page number + * @param string $typeid ID of the type of member + * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" + * @return array Array of member objects + * + * @throws RestException + */ + function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 0, $page = 0, $typeid = '', $sqlfilters = '') { + global $db, $conf; + + $obj_ret = array(); + + if(! DolibarrApiAccess::$user->rights->adherent->lire) { + throw new RestException(401); + } + + $sql = "SELECT t.rowid"; + $sql.= " FROM ".MAIN_DB_PREFIX."adherent as t"; + $sql.= ' WHERE t.entity IN ('.getEntity('adherent', 1).')'; + if (!empty($typeid)) + { + $sql.= ' AND t.fk_adherent_type='.$typeid; + } + // Add sql filters + if ($sqlfilters) + { + if (! DolibarrApi::_checkFilters($sqlfilters)) + { + throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); + } + $regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; + } + + $sql.= $db->order($sortfield, $sortorder); + if ($limit) { + if ($page < 0) + { + $page = 0; + } + $offset = $limit * $page; + + $sql.= $db->plimit($limit + 1, $offset); + } + + $result = $db->query($sql); + if ($result) + { + $i=0; + $num = $db->num_rows($result); + while ($i < min($limit, $num)) + { + $obj = $db->fetch_object($result); + $member = new Adherent($this->db); + if($member->fetch($obj->rowid)) { + $obj_ret[] = $this->_cleanObjectDatas($member); + } + $i++; + } + } + else { + throw new RestException(503, 'Error when retrieve member list : '.$member->error); + } + if( ! count($obj_ret)) { + throw new RestException(404, 'No member found'); + } + + return $obj_ret; + } + + /** + * Create member object + * + * @param array $request_data Request data + * @return int ID of member + */ + function post($request_data = null) + { + if(! DolibarrApiAccess::$user->rights->adherent->creer) { + throw new RestException(401); + } + // Check mandatory fields + $result = $this->_validate($request_data); + + $member = new Adherent($this->db); + foreach($request_data as $field => $value) { + $member->$field = $value; + } + if($member->create(DolibarrApiAccess::$user) < 0) { + throw new RestException(503, 'Error when create member : '.$member->error); + } + return $member->id; + } + + /** + * Update member + * + * @param int $id ID of member to update + * @param array $request_data Datas + * @return int + */ + function put($id, $request_data = null) + { + if(! DolibarrApiAccess::$user->rights->adherent->creer) { + throw new RestException(401); + } + + $member = new Adherent($this->db); + $result = $member->fetch($id); + if( ! $result ) { + throw new RestException(404, 'member not found'); + } + + if( ! DolibarrApi::_checkAccessToResource('member',$member->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + + foreach($request_data as $field => $value) { + // Process the status separately because it must be updated using + // the validate() and resiliate() methods of the class Adherent. + if ($field == 'statut') { + if ($value == '0') { + $result = $member->resiliate(DolibarrApiAccess::$user); + if ($result < 0) { + throw new RestException(500, 'Error when resiliating member: '.$member->error); + } + } else if ($value == '1') { + $result = $member->validate(DolibarrApiAccess::$user); + if ($result < 0) { + throw new RestException(500, 'Error when validating member: '.$member->error); + } + } + } else { + $member->$field = $value; + } + } + + // If there is no error, update() returns the number of affected rows + // so if the update is a no op, the return value is zero. + if($member->update(DolibarrApiAccess::$user) >= 0) + return $this->get($id); + + return false; + } + + /** + * Delete member + * + * @param int $id member ID + * @return array + */ + function delete($id) + { + if(! DolibarrApiAccess::$user->rights->adherent->supprimer) { + throw new RestException(401); + } + $member = new Adherent($this->db); + $result = $member->fetch($id); + if( ! $result ) { + throw new RestException(404, 'member not found'); + } + + if( ! DolibarrApi::_checkAccessToResource('member',$member->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + + // The Adherent::delete() method uses the global variable $user. + global $user; + $user = DolibarrApiAccess::$user; + + if (! $member->delete($member->id)) { + throw new RestException(401,'error when deleting member'); + } + + return array( + 'success' => array( + 'code' => 200, + 'message' => 'member deleted' + ) + ); + } + + /** + * Validate fields before creating an object + * + * @param array|null $data Data to validate + * @return array + * + * @throws RestException + */ + function _validate($data) + { + $member = array(); + foreach (Members::$FIELDS as $field) { + if (!isset($data[$field])) + throw new RestException(400, "$field field missing"); + $member[$field] = $data[$field]; + } + return $member; + } + + /** + * Clean sensible object datas + * + * @param object $object Object to clean + * @return array Array of cleaned object properties + * + * @todo use an array for properties to clean + * + */ + function _cleanObjectDatas($object) { + + $object = parent::_cleanObjectDatas($object); + + // Remove the subscriptions because they are handled as a subresource. + unset($object->subscriptions); + + return $object; + } + + /** + * List subscriptions of a member + * + * Get a list of subscriptions + * + * @param int $id ID of member + * @return array Array of subscription objects + * + * @throws RestException + * + * @url GET {id}/subscriptions + */ + function getSubscriptions($id) + { + $obj_ret = array(); + + if(! DolibarrApiAccess::$user->rights->adherent->cotisation->lire) { + throw new RestException(401); + } + + $member = new Adherent($this->db); + $result = $member->fetch($id); + if( ! $result ) { + throw new RestException(404, 'member not found'); + } + + $obj_ret = array(); + foreach ($member->subscriptions as $subscription) { + $obj_ret[] = $this->_cleanObjectDatas($subscription); + } + return $obj_ret; + } + + /** + * Add a subscription for a member + * + * @param int $id ID of member + * @param int $start_date Start date {@from body} {@type timestamp} + * @param int $end_date End date {@from body} {@type timestamp} + * @param float $amount Amount (may be 0) {@from body} + * @param string $label Label {@from body} + * @return int ID of subscription + * + * @url POST {id}/subscriptions + */ + function createSubscription($id, $start_date, $end_date, $amount, $label='') + { + if(! DolibarrApiAccess::$user->rights->adherent->cotisation->creer) { + throw new RestException(401); + } + + $member = new Adherent($this->db); + $result = $member->fetch($id); + if( ! $result ) { + throw new RestException(404, 'member not found'); + } + + return $member->subscription($start_date, $amount, 0, '', $label, '', '', '', $end_date); + } + +} diff --git a/htdocs/adherents/class/api_subscriptions.class.php b/htdocs/adherents/class/api_subscriptions.class.php new file mode 100644 index 00000000000..2dd2a609e63 --- /dev/null +++ b/htdocs/adherents/class/api_subscriptions.class.php @@ -0,0 +1,248 @@ + + * + * 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 . + */ + +use Luracast\Restler\RestException; + +require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php'; + +/** + * API class for subscriptions + * + * @access protected + * @class DolibarrApiAccess {@requires user,external} + */ +class Subscriptions extends DolibarrApi +{ + /** + * @var array $FIELDS Mandatory fields, checked when create and update object + */ + static $FIELDS = array( + 'fk_adherent', + 'dateh', + 'datef', + 'amount' + ); + + /** + * Constructor + */ + function __construct() + { + global $db, $conf; + $this->db = $db; + } + + /** + * Get properties of a subscription object + * + * Return an array with subscription informations + * + * @param int $id ID of subscription + * @return array|mixed data without useless information + * + * @throws RestException + */ + function get($id) + { + if(! DolibarrApiAccess::$user->rights->adherent->cotisation->lire) { + throw new RestException(401); + } + + $subscription = new Subscription($this->db); + $result = $subscription->fetch($id); + if( ! $result ) { + throw new RestException(404, 'Subscription not found'); + } + + return $this->_cleanObjectDatas($subscription); + } + + /** + * List subscriptions + * + * Get a list of subscriptions + * + * @param string $sortfield Sort field + * @param string $sortorder Sort order + * @param int $limit Limit for list + * @param int $page Page number + * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.import_key:<:'20160101')" + * @return array Array of subscription objects + * + * @throws RestException + */ + function index($sortfield = "dateadh", $sortorder = 'ASC', $limit = 0, $page = 0, $sqlfilters = '') { + global $db, $conf; + + $obj_ret = array(); + + if(! DolibarrApiAccess::$user->rights->adherent->cotisation->lire) { + throw new RestException(401); + } + + $sql = "SELECT rowid"; + $sql.= " FROM ".MAIN_DB_PREFIX."subscription as t"; + $sql.= ' WHERE 1 = 1'; + // Add sql filters + if ($sqlfilters) + { + if (! DolibarrApi::_checkFilters($sqlfilters)) + { + throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); + } + $regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; + } + + $sql.= $db->order($sortfield, $sortorder); + if ($limit) { + if ($page < 0) + { + $page = 0; + } + $offset = $limit * $page; + + $sql.= $db->plimit($limit + 1, $offset); + } + + $result = $db->query($sql); + if ($result) + { + $i=0; + $num = $db->num_rows($result); + while ($i < min($limit, $num)) + { + $obj = $db->fetch_object($result); + $subscription = new Subscription($this->db); + if($subscription->fetch($obj->rowid)) { + $obj_ret[] = $this->_cleanObjectDatas($subscription); + } + $i++; + } + } + else { + throw new RestException(503, 'Error when retrieve subscription list : '.$subscription->error); + } + if( ! count($obj_ret)) { + throw new RestException(404, 'No Subscription found'); + } + + return $obj_ret; + } + + /** + * Create subscription object + * + * @param array $request_data Request data + * @return int ID of subscription + */ + function post($request_data = null) + { + if(! DolibarrApiAccess::$user->rights->adherent->cotisation->creer) { + throw new RestException(401); + } + // Check mandatory fields + $result = $this->_validate($request_data); + + $subscription = new Subscription($this->db); + foreach($request_data as $field => $value) { + $subscription->$field = $value; + } + if($subscription->create(DolibarrApiAccess::$user) < 0) { + throw new RestException(503, 'Error when create subscription : '.$subscription->error); + } + return $subscription->id; + } + + /** + * Update subscription + * + * @param int $id ID of subscription to update + * @param array $request_data Datas + * @return int + */ + function put($id, $request_data = null) + { + if(! DolibarrApiAccess::$user->rights->adherent->creer) { + throw new RestException(401); + } + + $subscription = new Subscription($this->db); + $result = $subscription->fetch($id); + if( ! $result ) { + throw new RestException(404, 'Subscription not found'); + } + + foreach($request_data as $field => $value) { + $subscription->$field = $value; + } + + if ($subscription->update(DolibarrApiAccess::$user) > 0) + return $this->get($id); + + return false; + } + + /** + * Delete subscription + * + * @param int $id ID of subscription to delete + * @return array + */ + function delete($id) + { + // The right to delete a subscription comes with the right to create one. + if(! DolibarrApiAccess::$user->rights->adherent->cotisation->creer) { + throw new RestException(401); + } + $subscription = new Subscription($this->db); + $result = $subscription->fetch($id); + if( ! $result ) { + throw new RestException(404, 'Subscription not found'); + } + + if (! $subscription->delete(DolibarrApiAccess::$user)) { + throw new RestException(401,'error when deleting subscription'); + } + + return array( + 'success' => array( + 'code' => 200, + 'message' => 'subscription deleted' + ) + ); + } + + /** + * Validate fields before creating an object + * + * @param array|null $data Data to validate + * @return array + * + * @throws RestException + */ + function _validate($data) + { + $subscription = array(); + foreach (Subscriptions::$FIELDS as $field) { + if (!isset($data[$field])) + throw new RestException(400, "$field field missing"); + $subscription[$field] = $data[$field]; + } + return $subscription; + } +} diff --git a/htdocs/adherents/class/cotisation.class.php b/htdocs/adherents/class/subscription.class.php similarity index 81% rename from htdocs/adherents/class/cotisation.class.php rename to htdocs/adherents/class/subscription.class.php index 40527e6e22e..bc2234e9d5c 100644 --- a/htdocs/adherents/class/cotisation.class.php +++ b/htdocs/adherents/class/subscription.class.php @@ -17,9 +17,9 @@ */ /** - * \file htdocs/adherents/class/cotisation.class.php - * \ingroup member - * \brief File of class to manage subscriptions of foundation members + * \file htdocs/adherents/class/subscription.class.php + * \ingroup member + * \brief File of class to manage subscriptions of foundation members */ require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; @@ -28,10 +28,10 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; /** * Class to manage subscriptions of foundation members */ -class Cotisation extends CommonObject +class Subscription extends CommonObject { public $element='subscription'; - public $table_element='cotisation'; + public $table_element='subscription'; var $datec; // Date creation var $datem; // Date modification @@ -54,7 +54,7 @@ class Cotisation extends CommonObject /** - * Fonction qui permet de creer la cotisation + * Function who permitted cretaion of the subscription * * @param int $userid userid de celui qui insere * @return int <0 if KO, Id subscription created if OK @@ -72,17 +72,19 @@ class Cotisation extends CommonObject return -1; } - $sql = "INSERT INTO ".MAIN_DB_PREFIX."cotisation (fk_adherent, datec, dateadh, datef, cotisation, note)"; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."subscription (fk_adherent, datec, dateadh, datef, subscription, note)"; $sql.= " VALUES (".$this->fk_adherent.", '".$this->db->idate($now)."',"; $sql.= " '".$this->db->idate($this->dateh)."',"; $sql.= " '".$this->db->idate($this->datef)."',"; - $sql.= " ".$this->amount.",'".$this->db->escape($this->note)."')"; + $sql.= " ".$this->amount.","; + $sql.= " '".$this->db->escape($this->note)."')"; dol_syslog(get_class($this)."::create", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { - return $this->db->last_insert_id(MAIN_DB_PREFIX."cotisation"); + $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."subscription"); + return $this->id; } else { @@ -104,8 +106,8 @@ class Cotisation extends CommonObject $sql.=" tms,"; $sql.=" dateadh as dateh,"; $sql.=" datef,"; - $sql.=" cotisation, note, fk_bank"; - $sql.=" FROM ".MAIN_DB_PREFIX."cotisation"; + $sql.=" subscription, note, fk_bank"; + $sql.=" FROM ".MAIN_DB_PREFIX."subscription"; $sql.=" WHERE rowid=".$rowid; dol_syslog(get_class($this)."::fetch", LOG_DEBUG); @@ -124,7 +126,7 @@ class Cotisation extends CommonObject $this->datem = $this->db->jdate($obj->tms); $this->dateh = $this->db->jdate($obj->dateh); $this->datef = $this->db->jdate($obj->datef); - $this->amount = $obj->cotisation; + $this->amount = $obj->subscription; $this->note = $obj->note; $this->fk_bank = $obj->fk_bank; return 1; @@ -143,20 +145,20 @@ class Cotisation extends CommonObject /** - * Met a jour en base la cotisation + * Update subscription * - * @param User $user Objet user qui met a jour - * @param int $notrigger 0=Desactive les triggers + * @param User $user User who updated + * @param int $notrigger 0=Disable triggers * @return int <0 if KO, >0 if OK */ function update($user,$notrigger=0) { $this->db->begin(); - $sql = "UPDATE ".MAIN_DB_PREFIX."cotisation SET "; + $sql = "UPDATE ".MAIN_DB_PREFIX."subscription SET "; $sql .= " fk_adherent = ".$this->fk_adherent.","; $sql .= " note=".($this->note ? "'".$this->db->escape($this->note)."'" : 'null').","; - $sql .= " cotisation = '".price2num($this->amount)."',"; + $sql .= " subscription = '".price2num($this->amount)."',"; $sql .= " dateadh='".$this->db->idate($this->dateh)."',"; $sql .= " datef='".$this->db->idate($this->datef)."',"; $sql .= " datec='".$this->db->idate($this->datec)."',"; @@ -190,17 +192,18 @@ class Cotisation extends CommonObject */ function delete($user) { + $accountline=new AccountLine($this->db); + // It subscription is linked to a bank transaction, we get it - if ($this->fk_bank) + if ($this->fk_bank > 0) { require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; - $accountline=new AccountLine($this->db); $result=$accountline->fetch($this->fk_bank); } $this->db->begin(); - $sql = "DELETE FROM ".MAIN_DB_PREFIX."cotisation WHERE rowid = ".$this->id; + $sql = "DELETE FROM ".MAIN_DB_PREFIX."subscription WHERE rowid = ".$this->id; dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) @@ -213,7 +216,7 @@ class Cotisation extends CommonObject $result=$member->fetch($this->fk_adherent); $result=$member->update_end_date($user); - if ($accountline->id > 0) // If we found bank account line (this means this->fk_bank defined) + if (is_object($accountline) && $accountline->id > 0) // If we found bank account line (this means this->fk_bank defined) { $result=$accountline->delete($user); // Return false if refused because line is conciliated if ($result > 0) @@ -262,7 +265,7 @@ class Cotisation extends CommonObject $result=''; $label=$langs->trans("ShowSubscription").': '.$this->ref; - $link = ''; + $link = ''; $linkend=''; $picto='payment'; @@ -275,7 +278,7 @@ class Cotisation extends CommonObject /** - * Charge les informations d'ordre info dans l'objet cotisation + * Load information of the subscription object * * @param int $id Id subscription * @return void @@ -284,7 +287,7 @@ class Cotisation extends CommonObject { $sql = 'SELECT c.rowid, c.datec,'; $sql.= ' c.tms as datem'; - $sql.= ' FROM '.MAIN_DB_PREFIX.'cotisation as c'; + $sql.= ' FROM '.MAIN_DB_PREFIX.'subscription as c'; $sql.= ' WHERE c.rowid = '.$id; $result=$this->db->query($sql); diff --git a/htdocs/adherents/document.php b/htdocs/adherents/document.php index 0e19cd6331c..47fbebbf976 100644 --- a/htdocs/adherents/document.php +++ b/htdocs/adherents/document.php @@ -69,7 +69,7 @@ if ($result < 0) dol_print_error($db); exit; } -$upload_dir = $conf->adherent->dir_output . "/" . get_exdir($object->id,2,0,1,$object,'member') . '/' . dol_sanitizeFileName($object->ref); +$upload_dir = $conf->adherent->dir_output . "/" . get_exdir(0, 0, 0, 1, $object, 'member'); /* @@ -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) { @@ -156,6 +158,7 @@ if ($id > 0) $modulepart = 'member'; $permission = $user->rights->adherent->creer; + $permtoedit = $user->rights->adherent->creer; $param = '&id=' . $object->id; include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php'; print "

"; diff --git a/htdocs/adherents/htpasswd.php b/htdocs/adherents/htpasswd.php index ffa1a92124b..5814ed3bf70 100644 --- a/htdocs/adherents/htpasswd.php +++ b/htdocs/adherents/htpasswd.php @@ -48,7 +48,7 @@ if (! isset($statut)) if (! isset($cotis)) { - // par defaut les adherents doivent etre a jour de cotisation + // by default, members must be up to date of subscription $cotis=1; } diff --git a/htdocs/adherents/index.php b/htdocs/adherents/index.php index 8515dc1d2c8..af259296c37 100644 --- a/htdocs/adherents/index.php +++ b/htdocs/adherents/index.php @@ -27,7 +27,7 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php'; -require_once DOL_DOCUMENT_ROOT.'/adherents/class/cotisation.class.php'; +require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php'; $langs->load("companies"); $langs->load("members"); @@ -44,7 +44,7 @@ llxHeader('',$langs->trans("Members"),'EN:Module_Foundations|FR:Module_Adh&eacut $staticmember=new Adherent($db); $statictype=new AdherentType($db); -$subscriptionstatic=new Cotisation($db); +$subscriptionstatic=new Subscription($db); print load_fiche_titre($langs->trans("MembersArea")); @@ -59,14 +59,14 @@ $AdherentsResilies=array(); $AdherentType=array(); // Liste les adherents -$sql = "SELECT t.rowid, t.libelle, t.cotisation,"; +$sql = "SELECT t.rowid, t.libelle, t.subscription,"; $sql.= " d.statut, count(d.rowid) as somme"; $sql.= " FROM ".MAIN_DB_PREFIX."adherent_type as t"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."adherent as d"; $sql.= " ON t.rowid = d.fk_adherent_type"; $sql.= " AND d.entity IN (".getEntity().")"; $sql.= " WHERE t.entity IN (".getEntity().")"; -$sql.= " GROUP BY t.rowid, t.libelle, t.cotisation, d.statut"; +$sql.= " GROUP BY t.rowid, t.libelle, t.subscription, d.statut"; dol_syslog("index.php::select nb of members by type", LOG_DEBUG); $result = $db->query($sql); @@ -80,7 +80,7 @@ if ($result) $adhtype=new AdherentType($db); $adhtype->id=$objp->rowid; - $adhtype->cotisation=$objp->cotisation; + $adhtype->subscription=$objp->subscription; $adhtype->libelle=$objp->libelle; $AdherentType[$objp->rowid]=$adhtype; @@ -101,7 +101,7 @@ $now=dol_now(); $sql = "SELECT count(*) as somme , d.fk_adherent_type"; $sql.= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."adherent_type as t"; $sql.= " WHERE d.entity IN (".getEntity().")"; -//$sql.= " AND d.statut = 1 AND ((t.cotisation = 0 AND d.datefin IS NULL) OR d.datefin >= '".$db->idate($now)."')"; +//$sql.= " AND d.statut = 1 AND ((t.subscription = 0 AND d.datefin IS NULL) OR d.datefin >= '".$db->idate($now)."')"; $sql.= " AND d.statut = 1 AND d.datefin >= '".$db->idate($now)."'"; $sql.= " AND t.rowid = d.fk_adherent_type"; $sql.= " GROUP BY d.fk_adherent_type"; @@ -212,7 +212,7 @@ $max=5; $sql = "SELECT a.rowid, a.statut, a.lastname, a.firstname, a.societe as company, a.fk_soc,"; $sql.= " a.tms as datem, datefin as date_end_subscription,"; -$sql.= " ta.rowid as typeid, ta.libelle, ta.cotisation"; +$sql.= " ta.rowid as typeid, ta.libelle, ta.subscription"; $sql.= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."adherent_type as ta"; $sql.= " WHERE a.entity IN (".getEntity().")"; $sql.= " AND a.fk_adherent_type = ta.rowid"; @@ -255,7 +255,7 @@ if ($resql) print ''.$staticmember->getNomUrl(1,32).''; print ''.$statictype->getNomUrl(1,32).''; print ''.dol_print_date($db->jdate($obj->datem),'dayhour').''; - print ''.$staticmember->LibStatut($obj->statut,($obj->cotisation=='yes'?1:0),$db->jdate($obj->date_end_subscription),5).''; + print ''.$staticmember->LibStatut($obj->statut,($obj->subscription=='yes'?1:0),$db->jdate($obj->date_end_subscription),5).''; print ''; $i++; } @@ -275,8 +275,8 @@ $max=5; $sql = "SELECT a.rowid, a.statut, a.lastname, a.firstname, a.societe as company, a.fk_soc,"; $sql.= " datefin as date_end_subscription,"; -$sql.= " c.rowid as cid, c.tms as datem, c.datec as datec, c.dateadh as date_start, c.datef as date_end, c.cotisation"; -$sql.= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."cotisation as c"; +$sql.= " c.rowid as cid, c.tms as datem, c.datec as datec, c.dateadh as date_start, c.datef as date_end, c.subscription"; +$sql.= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."subscription as c"; $sql.= " WHERE a.entity IN (".getEntity().")"; $sql.= " AND c.fk_adherent = a.rowid"; $sql.= $db->order("c.tms","DESC"); @@ -315,8 +315,8 @@ if ($resql) print ''.$subscriptionstatic->getNomUrl(1).''; print ''.$staticmember->getNomUrl(1,32,'subscription').''; print ''.get_date_range($db->jdate($obj->date_start),$db->jdate($obj->date_end)).''; - print ''.price($obj->cotisation).''; - //print ''.$staticmember->LibStatut($obj->statut,($obj->cotisation=='yes'?1:0),$db->jdate($obj->date_end_subscription),5).''; + print ''.price($obj->subscription).''; + //print ''.$staticmember->LibStatut($obj->statut,($obj->subscription=='yes'?1:0),$db->jdate($obj->date_end_subscription),5).''; print ''.dol_print_date($db->jdate($obj->datem?$obj->datem:$obj->datec),'dayhour').''; print ''; $i++; @@ -345,18 +345,18 @@ foreach ($AdherentType as $key => $adhtype) $var=!$var; print ""; print ''.$adhtype->getNomUrl(1, dol_size(32)).''; - print ''.(isset($MemberToValidate[$key]) && $MemberToValidate[$key] > 0?$MemberToValidate[$key]:'').' '.$staticmember->LibStatut(-1,$adhtype->cotisation,0,3).''; - print ''.(isset($MembersValidated[$key]) && ($MembersValidated[$key]-(isset($MemberUpToDate[$key])?$MemberUpToDate[$key]:0) > 0) ? $MembersValidated[$key]-(isset($MemberUpToDate[$key])?$MemberUpToDate[$key]:0):'').' '.$staticmember->LibStatut(1,$adhtype->cotisation,0,3).''; - print ''.(isset($MemberUpToDate[$key]) && $MemberUpToDate[$key] > 0 ? $MemberUpToDate[$key]:'').' '.$staticmember->LibStatut(1,$adhtype->cotisation,$now,3).''; - print ''.(isset($MembersResiliated[$key]) && $MembersResiliated[$key]> 0 ?$MembersResiliated[$key]:'').' '.$staticmember->LibStatut(0,$adhtype->cotisation,0,3).''; + print ''.(isset($MemberToValidate[$key]) && $MemberToValidate[$key] > 0?$MemberToValidate[$key]:'').' '.$staticmember->LibStatut(-1,$adhtype->subscription,0,3).''; + print ''.(isset($MembersValidated[$key]) && ($MembersValidated[$key]-(isset($MemberUpToDate[$key])?$MemberUpToDate[$key]:0) > 0) ? $MembersValidated[$key]-(isset($MemberUpToDate[$key])?$MemberUpToDate[$key]:0):'').' '.$staticmember->LibStatut(1,$adhtype->subscription,0,3).''; + print ''.(isset($MemberUpToDate[$key]) && $MemberUpToDate[$key] > 0 ? $MemberUpToDate[$key]:'').' '.$staticmember->LibStatut(1,$adhtype->subscription,$now,3).''; + print ''.(isset($MembersResiliated[$key]) && $MembersResiliated[$key]> 0 ?$MembersResiliated[$key]:'').' '.$staticmember->LibStatut(0,$adhtype->subscription,0,3).''; print "\n"; } print ''; print ''.$langs->trans("Total").''; -print ''.$SommeA.' '.$staticmember->LibStatut(-1,$adhtype->cotisation,0,3).''; -print ''.$SommeB.' '.$staticmember->LibStatut(1,$adhtype->cotisation,0,3).''; -print ''.$SommeC.' '.$staticmember->LibStatut(1,$adhtype->cotisation,$now,3).''; -print ''.$SommeD.' '.$staticmember->LibStatut(0,$adhtype->cotisation,0,3).''; +print ''.$SommeA.' '.$staticmember->LibStatut(-1,$adhtype->subscription,0,3).''; +print ''.$SommeB.' '.$staticmember->LibStatut(1,$adhtype->subscription,0,3).''; +print ''.$SommeC.' '.$staticmember->LibStatut(1,$adhtype->subscription,$now,3).''; +print ''.$SommeD.' '.$staticmember->LibStatut(0,$adhtype->subscription,0,3).''; print ''; print "\n"; @@ -369,8 +369,8 @@ $Number=array(); $tot=0; $numb=0; -$sql = "SELECT c.cotisation, c.dateadh as dateh"; -$sql.= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."cotisation as c"; +$sql = "SELECT c.subscription, c.dateadh as dateh"; +$sql.= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."subscription as c"; $sql.= " WHERE d.entity IN (".getEntity().")"; $sql.= " AND d.rowid = c.fk_adherent"; if(isset($date_select) && $date_select != '') @@ -386,9 +386,9 @@ if ($result) { $objp = $db->fetch_object($result); $year=dol_print_date($db->jdate($objp->dateh),"%Y"); - $Total[$year]=(isset($Total[$year])?$Total[$year]:0)+$objp->cotisation; + $Total[$year]=(isset($Total[$year])?$Total[$year]:0)+$objp->subscription; $Number[$year]=(isset($Number[$year])?$Number[$year]:0)+1; - $tot+=$objp->cotisation; + $tot+=$objp->subscription; $numb+=1; $i++; } @@ -408,7 +408,7 @@ foreach ($Total as $key=>$value) { $var=!$var; print ""; - print "$key"; + print "$key"; print "".$Number[$key].""; print "".price($value).""; print "".price(price2num($value/$Number[$key],'MT')).""; diff --git a/htdocs/adherents/info.php b/htdocs/adherents/info.php deleted file mode 100644 index 36ed504dd73..00000000000 --- a/htdocs/adherents/info.php +++ /dev/null @@ -1,75 +0,0 @@ - - * Copyright (C) 2005-2012 Regis Houssin - * - * 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 . - */ - -/** - * \file htdocs/adherents/info.php - * \ingroup member - * \brief Page des informations d'un adherent - */ - -require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php'; - -$langs->load("companies"); -$langs->load("bills"); -$langs->load("members"); -$langs->load("users"); - -$id=(GETPOST('id','int') ? GETPOST('id','int') : GETPOST('rowid','int')); - -// Security check -$result=restrictedArea($user,'adherent',$id); - - -/* - * View - */ - -$form = new Form($db); - -llxHeader('',$langs->trans("Member"),'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros'); - -$object = new Adherent($db); -$object->fetch($id); -$object->info($id); - -$head = member_prepare_head($object); - -dol_fiche_head($head, 'info', $langs->trans("Member"), 0, 'user'); - - -$linkback = ''.$langs->trans("BackToList").''; - -dol_banner_tab($object, 'rowid', $linkback); - -print '
'; - -print '
'; - -print '
'; -dol_print_object_info($object); - -print '
'; - -dol_fiche_end(); - - -llxFooter(); -$db->close(); diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index 5878aac2755..d3e7e96a793 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -3,6 +3,7 @@ * Copyright (C) 2002-2003 Jean-Louis Bergamo * Copyright (C) 2004-2016 Laurent Destailleur * Copyright (C) 2013-2015 Raphaël Doursenaud + * Copyright (C) 2014-2016 Juanjo Menent * * 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 @@ -83,7 +84,7 @@ $search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search // List of fields to search into when doing a "search in all" $fieldstosearchall = array( 'd.rowid'=>'Ref', - //'d.ref'=>'Ref', + 'd.login'=>'Login', 'd.lastname'=>'Lastname', 'd.firstname'=>'Firstname', 'd.login'=>'Login', @@ -186,7 +187,7 @@ $sql = "SELECT d.rowid, d.login, d.lastname, d.firstname, d.societe as company, $sql.= " d.datefin, d.address, d.zip, d.town, d.state_id, d.country,"; $sql.= " d.email, d.phone, d.phone_perso, d.phone_mobile, d.skype, d.birth, d.public, d.photo,"; $sql.= " d.fk_adherent_type as type_id, d.morphy, d.statut, d.datec as date_creation, d.tms as date_update,"; -$sql.= " t.libelle as type, t.cotisation,"; +$sql.= " t.libelle as type, t.subscription,"; $sql.= " state.code_departement as state_code, state.nom as state_name"; // Add fields for extrafields foreach ($extrafields->attribute_list as $key => $val) $sql.=",ef.".$key.' as options_'.$key; @@ -214,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); @@ -328,7 +330,7 @@ if ($resql) if ($sall) { foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); - print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); + print $langs->trans("FilterOnInto", $sall) . implode(', ',$fieldstosearchall); } // Filter on categories @@ -420,7 +422,7 @@ if ($resql) if (! empty($arrayfields['d.firstname']['checked'])) { print ''; - print ''; + print ''; } if (! empty($arrayfields['d.lastname']['checked'])) @@ -610,6 +612,13 @@ if ($resql) print ""; print $memberstatic->getNomUrl(1); print "\n"; + } + // Firstname + if (! empty($arrayfields['d.firstname']['checked'])) + { + print ""; + print $obj->firstname; + print "\n"; } // Lastname if (! empty($arrayfields['d.lastname']['checked'])) @@ -617,13 +626,6 @@ if ($resql) print ""; print $obj->lastname; print "\n"; - } - // Firstname - if (! empty($arrayfields['d.firstname']['checked'])) - { - print ""; - print $obj->firstname; - print "\n"; } // Company if (! empty($arrayfields['d.company']['checked'])) @@ -734,7 +736,7 @@ if ($resql) else { print ''; - if ($obj->cotisation == 'yes') + if ($obj->subscription == 'yes') { print $langs->trans("SubscriptionNotReceived"); if ($obj->statut > 0) print " ".img_warning(); @@ -788,7 +790,7 @@ if ($resql) if (! empty($arrayfields['d.statut']['checked'])) { print ''; - print $memberstatic->LibStatut($obj->statut,$obj->cotisation,$datefin,2); + print $memberstatic->LibStatut($obj->statut,$obj->subscription,$datefin,2); print ''; if (! $i) $totalarray['nbfield']++; } diff --git a/htdocs/adherents/note.php b/htdocs/adherents/note.php index a895d6cfef8..9e6a20f6cb3 100644 --- a/htdocs/adherents/note.php +++ b/htdocs/adherents/note.php @@ -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); diff --git a/htdocs/adherents/stats/byproperties.php b/htdocs/adherents/stats/byproperties.php index 35ee0c6f6db..6b7c1c003a9 100644 --- a/htdocs/adherents/stats/byproperties.php +++ b/htdocs/adherents/stats/byproperties.php @@ -54,7 +54,7 @@ $langs->load("companies"); $memberstatic=new Adherent($db); -llxHeader('',$langs->trans("MembersStatisticsByProperties"),'','',0,0,array('http://www.google.com/jsapi')); +llxHeader('',$langs->trans("MembersStatisticsByProperties"),'','',0,0,array('https://www.google.com/jsapi')); $title=$langs->trans("MembersStatisticsByProperties"); diff --git a/htdocs/adherents/stats/geo.php b/htdocs/adherents/stats/geo.php index 85157dc824d..ae128d940e8 100644 --- a/htdocs/adherents/stats/geo.php +++ b/htdocs/adherents/stats/geo.php @@ -53,7 +53,7 @@ $langs->load("companies"); * View */ -$arrayjs=array('http://www.google.com/jsapi'); +$arrayjs=array('https://www.google.com/jsapi'); if (! empty($conf->dol_use_jmobile)) $arrayjs=array(); $title=$langs->trans("Statistics"); diff --git a/htdocs/adherents/stats/index.html b/htdocs/adherents/stats/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/adherents/card_subscriptions.php b/htdocs/adherents/subscription.php similarity index 90% rename from htdocs/adherents/card_subscriptions.php rename to htdocs/adherents/subscription.php index 784f6d4dea7..e70f737d126 100644 --- a/htdocs/adherents/card_subscriptions.php +++ b/htdocs/adherents/subscription.php @@ -3,7 +3,7 @@ * Copyright (C) 2002-2003 Jean-Louis Bergamo * Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2012 Regis Houssin - * Copyright (C) 2015-2016 Alexandre Spangaro + * Copyright (C) 2015-2016 Alexandre Spangaro * * 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 @@ -20,7 +20,7 @@ */ /** - * \file htdocs/adherents/card_subscriptions.php + * \file htdocs/adherents/subscription.php * \ingroup member * \brief Onglet d'ajout, edition, suppression des adhesions d'un adherent */ @@ -30,7 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php'; -require_once DOL_DOCUMENT_ROOT.'/adherents/class/cotisation.class.php'; +require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; @@ -53,6 +53,10 @@ $result=restrictedArea($user,'adherent',$rowid,'','cotisation'); $object = new Adherent($db); $extrafields = new ExtraFields($db); $adht = new AdherentType($db); + +// fetch optionals attributes and labels +$extralabels=$extrafields->fetch_name_optionals_label($object->table_element); + $errmsg=''; $errmsgs=array(); @@ -182,7 +186,7 @@ if ($action == 'setsocid') } } -if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $_POST["cancel"]) +if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && ! $_POST["cancel"]) { $error=0; @@ -192,12 +196,12 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $ $result=$adht->fetch($object->typeid); // Subscription informations - $datecotisation=0; + $datesubscription=0; $datesubend=0; $paymentdate=0; if ($_POST["reyear"] && $_POST["remonth"] && $_POST["reday"]) { - $datecotisation=dol_mktime(0, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]); + $datesubscription=dol_mktime(0, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]); } if ($_POST["endyear"] && $_POST["endmonth"] && $_POST["endday"]) { @@ -207,7 +211,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $ { $paymentdate=dol_mktime(0, 0, 0, $_POST["paymentmonth"], $_POST["paymentday"], $_POST["paymentyear"]); } - $cotisation=$_POST["cotisation"]; // Amount of subscription + $subscription=$_POST["subscription"]; // Amount of subscription $label=$_POST["label"]; // Payment informations @@ -220,7 +224,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $ if (empty($option)) $option='none'; // Check parameters - if (! $datecotisation) + if (! $datesubscription) { $error++; $langs->load("errors"); @@ -236,7 +240,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $ } if (! $datesubend) { - $datesubend=dol_time_plus_duree(dol_time_plus_duree($datecotisation,$defaultdelay,$defaultdelayunit),-1,'d'); + $datesubend=dol_time_plus_duree(dol_time_plus_duree($datesubscription,$defaultdelay,$defaultdelayunit),-1,'d'); } if (($option == 'bankviainvoice' || $option == 'bankdirect') && ! $paymentdate) { @@ -246,9 +250,9 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $ } // Check if a payment is mandatory or not - if (! $error && $adht->cotisation) // Type adherent soumis a cotisation + if (! $error && $adht->subscription) // Member type need subscriptions { - if (! is_numeric($_POST["cotisation"])) + if (! is_numeric($_POST["subscription"])) { // If field is '' or not a numeric value $errmsg=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Amount")); @@ -259,7 +263,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $ { if (! empty($conf->banque->enabled) && $_POST["paymentsave"] != 'none') { - if ($_POST["cotisation"]) + if ($_POST["subscription"]) { if (! $_POST["label"]) $errmsg=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Label")); if ($_POST["paymentsave"] != 'invoiceonly' && ! $_POST["operation"]) $errmsg=$langs->trans("ErrorFieldRequired",$langs->transnoentities("PaymentMode")); @@ -274,12 +278,12 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $ } } - if (! $error && $action=='cotisation') + if (! $error && $action=='subscription') { $db->begin(); // Create subscription - $crowid=$object->cotisation($datecotisation, $cotisation, $accountid, $operation, $label, $num_chq, $emetteur_nom, $emetteur_banque, $datesubend); + $crowid=$object->subscription($datesubscription, $subscription, $accountid, $operation, $label, $num_chq, $emetteur_nom, $emetteur_banque, $datesubend); if ($crowid <= 0) { $error++; @@ -289,7 +293,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $ if (! $error) { - // Insert into bank account directlty (if option choosed for) + link to llx_cotisation if option is 'bankdirect' + // Insert into bank account directlty (if option choosed for) + link to llx_subscription if option is 'bankdirect' if ($option == 'bankdirect' && $accountid) { require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; @@ -299,17 +303,17 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $ $dateop=$paymentdate; - $insertid=$acct->addline($dateop, $operation, $label, $cotisation, $num_chq, '', $user, $emetteur_nom, $emetteur_banque); + $insertid=$acct->addline($dateop, $operation, $label, $subscription, $num_chq, '', $user, $emetteur_nom, $emetteur_banque); if ($insertid > 0) { $inserturlid=$acct->add_url_line($insertid, $object->id, DOL_URL_ROOT.'/adherents/card.php?rowid=', $object->getFullname($langs), 'member'); if ($inserturlid > 0) { - // Met a jour la table cotisation - $sql ="UPDATE ".MAIN_DB_PREFIX."cotisation SET fk_bank=".$insertid; + // Update table subscription + $sql ="UPDATE ".MAIN_DB_PREFIX."subscription SET fk_bank=".$insertid; $sql.=" WHERE rowid=".$crowid; - dol_syslog("card_subscriptions::cotisation", LOG_DEBUG); + dol_syslog("subscription::subscription", LOG_DEBUG); $resql = $db->query($sql); if (! $resql) { @@ -377,8 +381,15 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $ } } $invoice->socid=$object->fk_soc; - $invoice->date=$datecotisation; + $invoice->date=$datesubscription; + // Possibility to add external linked objects with hooks + $invoice->linked_objects['subscription'] = $crowid; + if (! empty($_POST['other_linked_objects']) && is_array($_POST['other_linked_objects'])) + { + $invoice->linked_objects = array_merge($invoice->linked_objects, $_POST['other_linked_objects']); + } + $result=$invoice->create($user); if ($result <= 0) { @@ -400,7 +411,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $ $vattouse=get_default_tva($mysoc, $mysoc, $idprodsubscription); } //print xx".$vattouse." - ".$mysoc." - ".$customer;exit; - $result=$invoice->addline($label,0,1,$vattouse,0,0,$idprodsubscription,0,$datecotisation,$datesubend,0,0,'','TTC',$cotisation,1); + $result=$invoice->addline($label,0,1,$vattouse,0,0,$idprodsubscription,0,$datesubscription,$datesubend,0,0,'','TTC',$subscription,1); if ($result <= 0) { $errmsg=$invoice->error; @@ -427,7 +438,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php'; - $amounts[$invoice->id] = price2num($cotisation); + $amounts[$invoice->id] = price2num($subscription); $paiement = new Paiement($db); $paiement->datepaye = $paymentdate; $paiement->amounts = $amounts; @@ -463,7 +474,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $ if (! $error) { // Update fk_bank into subscription table - $sql = 'UPDATE '.MAIN_DB_PREFIX.'cotisation SET fk_bank='.$bank_line_id; + $sql = 'UPDATE '.MAIN_DB_PREFIX.'subscription SET fk_bank='.$bank_line_id; $sql.= ' WHERE rowid='.$crowid; $result = $db->query($sql); @@ -527,7 +538,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $ } } - $_POST["cotisation"]=''; + $_POST["subscription"]=''; $_POST["accountid"]=''; $_POST["operation"]=''; $_POST["label"]=''; @@ -546,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) { @@ -580,11 +593,11 @@ if ($rowid > 0) // Login if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) { - print ''.$langs->trans("Login").' / '.$langs->trans("Id").''.$object->login.' '; + print ''.$langs->trans("Login").' / '.$langs->trans("Id").''.$object->login.' '; } // Type - print ''.$langs->trans("Type").''.$adht->getNomUrl(1)."\n"; + print ''.$langs->trans("Type").''.$adht->getNomUrl(1)."\n"; // Morphy print ''.$langs->trans("Nature").''.$object->getmorphylib().''; @@ -619,7 +632,7 @@ if ($rowid > 0) print ''; // Birthday - print ''; + print ''; // Public print ''; @@ -641,6 +654,30 @@ if ($rowid > 0) print $object->showOptionals($extrafields, 'view', $parameters); } + // Date end subscription + print ''; + // Third party Dolibarr if (! empty($conf->societe->enabled)) { @@ -711,30 +748,6 @@ if ($rowid > 0) } print ''; - // Date end subscription - print ''; - print "
'.$langs->trans("Birthday").''.dol_print_date($object->birth,'day').'
'.$langs->trans("Birthday").''.dol_print_date($object->birth,'day').'
'.$langs->trans("Public").''.yn($object->public).'
'.$langs->trans("SubscriptionEndDate").''; + if ($object->datefin) + { + print dol_print_date($object->datefin,'day'); + if ($object->hasDelay()) { + print " ".img_warning($langs->trans("Late")); + } + } + else + { + if (! $adht->subscription) + { + print $langs->trans("SubscriptionNotRecorded"); + if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // Affiche picto retard uniquement si non brouillon et non resilie + } + else + { + print $langs->trans("SubscriptionNotReceived"); + if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // Affiche picto retard uniquement si non brouillon et non resilie + } + } + print '
'.$langs->trans("SubscriptionEndDate").''; - if ($object->datefin) - { - print dol_print_date($object->datefin,'day'); - if ($object->hasDelay()) { - print " ".img_warning($langs->trans("Late")); - } - } - else - { - if (! $adht->cotisation) - { - print $langs->trans("SubscriptionNotRecorded"); - if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // Affiche picto retard uniquement si non brouillon et non resilie - } - else - { - print $langs->trans("SubscriptionNotReceived"); - if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // Affiche picto retard uniquement si non brouillon et non resilie - } - } - print '
\n"; print "\n"; @@ -749,7 +762,7 @@ if ($rowid > 0) * Hotbar */ - // Lien nouvelle cotisation si non brouillon et non resilie + // Button to create a new subscription if member no draft neither resiliated if ($user->rights->adherent->cotisation->creer) { if ($action != 'addsubscription' && $action != 'create_thirdparty') @@ -773,14 +786,14 @@ if ($rowid > 0) if ($action != 'addsubscription' && $action != 'create_thirdparty') { $sql = "SELECT d.rowid, d.firstname, d.lastname, d.societe,"; - $sql.= " c.rowid as crowid, c.cotisation,"; + $sql.= " c.rowid as crowid, c.subscription,"; $sql.= " c.datec,"; $sql.= " c.dateadh as dateh,"; $sql.= " c.datef,"; $sql.= " c.fk_bank,"; $sql.= " b.rowid as bid,"; $sql.= " ba.rowid as baid, ba.label, ba.bank"; - $sql.= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."cotisation as c"; + $sql.= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."subscription as c"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON c.fk_bank = b.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid"; $sql.= " WHERE d.rowid = c.fk_adherent AND d.rowid=".$rowid; @@ -788,7 +801,7 @@ if ($rowid > 0) $result = $db->query($sql); if ($result) { - $cotisationstatic=new Cotisation($db); + $subscriptionstatic=new Subscription($db); $accountstatic=new Account($db); $num = $db->num_rows($result); @@ -814,13 +827,13 @@ if ($rowid > 0) $objp = $db->fetch_object($result); $var=!$var; print ""; - $cotisationstatic->ref=$objp->crowid; - $cotisationstatic->id=$objp->crowid; - print ''.$cotisationstatic->getNomUrl(1).''; + $subscriptionstatic->ref=$objp->crowid; + $subscriptionstatic->id=$objp->crowid; + print ''.$subscriptionstatic->getNomUrl(1).''; print ''.dol_print_date($db->jdate($objp->datec),'dayhour')."\n"; print ''.dol_print_date($db->jdate($objp->dateh),'day')."\n"; print ''.dol_print_date($db->jdate($objp->datef),'day')."\n"; - print ''.price($objp->cotisation).''; + print ''.price($objp->subscription).''; if (! empty($conf->banque->enabled)) { print ''; @@ -941,9 +954,9 @@ if ($rowid > 0) } - print ''; + print ''; print ''; - print ''; + print ''; print ''; print ''; print ''; @@ -982,7 +995,7 @@ if ($rowid > 0) $datefrom=$object->datevalid; } } - print $form->select_date($datefrom,'','','','',"cotisation",1,1,1); + print $form->select_date($datefrom,'','','','',"subscription",1,1,1); print ""; // Date end subscription @@ -995,13 +1008,13 @@ if ($rowid > 0) $dateto=-1; // By default, no date is suggested } print ''.$langs->trans("DateEndSubscription").''; - print $form->select_date($dateto,'end','','','',"cotisation",1,0,1); + print $form->select_date($dateto,'end','','','',"subscription",1,0,1); print ""; - if ($adht->cotisation) + if ($adht->subscription) { // Amount - print ''.$langs->trans("Amount").' '.$langs->trans("Currency".$conf->currency).''; + print ''.$langs->trans("Amount").' '.$langs->trans("Currency".$conf->currency).''; // Label print ''.$langs->trans("Label").''; @@ -1096,7 +1109,7 @@ if ($rowid > 0) // Date of payment print ''.$langs->trans("DatePayment").''; - print $form->select_date(isset($paymentdate)?$paymentdate:-1,'payment',0,0,1,'cotisation',1,1,1); + print $form->select_date(isset($paymentdate)?$paymentdate:-1,'payment',0,0,1,'subscription',1,1,1); print "\n"; print ''.$langs->trans('Numero'); diff --git a/htdocs/adherents/fiche_subscription.php b/htdocs/adherents/subscription/card.php similarity index 57% rename from htdocs/adherents/fiche_subscription.php rename to htdocs/adherents/subscription/card.php index 6b980a4df1c..ce3baee712b 100644 --- a/htdocs/adherents/fiche_subscription.php +++ b/htdocs/adherents/subscription/card.php @@ -16,15 +16,15 @@ */ /** - * \file htdocs/adherents/fiche_subscription.php + * \file htdocs/adherents/subscription/card.php * \ingroup member * \brief Page to add/edit/remove a member subscription */ -require '../main.inc.php'; +require '../../main.inc.php'; 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/cotisation.class.php'; +require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; $langs->load("companies"); @@ -33,35 +33,49 @@ $langs->load("members"); $langs->load("users"); $adh = new Adherent($db); -$subscription = new Cotisation($db); +$object = new Subscription($db); $errmsg=''; -$action=isset($_GET["action"])?$_GET["action"]:$_POST["action"]; -$rowid=isset($_GET["rowid"])?$_GET["rowid"]:$_POST["rowid"]; -$typeid=isset($_GET["typeid"])?$_GET["typeid"]:$_POST["typeid"]; +$action=GETPOST("action",'alpha'); +$rowid=GETPOST("rowid","int")?GETPOST("rowid","int"):GETPOST("id","int"); +$typeid=GETPOST("typeid","int"); +$cancel=GETPOST('cancel'); if (! $user->rights->adherent->cotisation->lire) accessforbidden(); +$permissionnote = $user->rights->adherent->cotisation->creer; // Used by the include of actions_setnotes.inc.php +$permissiondellink=$user->rights->adherent->cotisation->creer; // Used by the include of actions_dellink.inc.php +$permissiontoedit = $user->rights->adherent->cotisation->creer; // Used by the include of actions_lineupdonw.inc.php + /* * Actions */ +if ($cancel) $action=''; + +//include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once + +include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once + +//include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; // Must be include, not include_once + + if ($user->rights->adherent->cotisation->creer && $_REQUEST["action"] == 'update' && ! $_POST["cancel"]) { // Charge objet actuel - $result=$subscription->fetch($_POST["rowid"]); + $result=$object->fetch($_POST["rowid"]); if ($result > 0) { $db->begin(); $errmsg=''; - if ($subscription->fk_bank) + if ($object->fk_bank) { $accountline=new AccountLine($db); - $result=$accountline->fetch($subscription->fk_bank); + $result=$accountline->fetch($object->fk_bank); // If transaction consolidated if ($accountline->rappro) @@ -84,31 +98,31 @@ if ($user->rights->adherent->cotisation->creer && $_REQUEST["action"] == 'update if (! $errmsg) { // Modifie valeures - $subscription->dateh=dol_mktime($_POST['datesubhour'], $_POST['datesubmin'], 0, $_POST['datesubmonth'], $_POST['datesubday'], $_POST['datesubyear']); - $subscription->datef=dol_mktime($_POST['datesubendhour'], $_POST['datesubendmin'], 0, $_POST['datesubendmonth'], $_POST['datesubendday'], $_POST['datesubendyear']); - $subscription->note=$_POST["note"]; - $subscription->amount=$_POST["amount"]; - //print 'datef='.$subscription->datef.' '.$_POST['datesubendday']; + $object->dateh=dol_mktime($_POST['datesubhour'], $_POST['datesubmin'], 0, $_POST['datesubmonth'], $_POST['datesubday'], $_POST['datesubyear']); + $object->datef=dol_mktime($_POST['datesubendhour'], $_POST['datesubendmin'], 0, $_POST['datesubendmonth'], $_POST['datesubendday'], $_POST['datesubendyear']); + $object->note=$_POST["note"]; + $object->amount=$_POST["amount"]; + //print 'datef='.$object->datef.' '.$_POST['datesubendday']; - $result=$subscription->update($user); - if ($result >= 0 && ! count($subscription->errors)) + $result=$object->update($user); + if ($result >= 0 && ! count($object->errors)) { $db->commit(); - header("Location: fiche_subscription.php?rowid=".$subscription->id); + header("Location: card.php?rowid=".$object->id); exit; } else { $db->rollback(); - if ($subscription->error) + if ($object->error) { - $errmsg=$subscription->error; + $errmsg=$object->error; } else { - foreach($subscription->errors as $error) + foreach($object->errors as $error) { if ($errmsg) $errmsg.='
'; $errmsg.=$error; @@ -126,11 +140,11 @@ if ($user->rights->adherent->cotisation->creer && $_REQUEST["action"] == 'update if ($_REQUEST["action"] == 'confirm_delete' && $_REQUEST["confirm"] == 'yes' && $user->rights->adherent->cotisation->creer) { - $result=$subscription->fetch($rowid); - $result=$subscription->delete($user); + $result=$object->fetch($rowid); + $result=$object->delete($user); if ($result > 0) { - header("Location: card_subscriptions.php?rowid=".$subscription->fk_adherent); + header("Location: card_subscriptions.php?rowid=".$object->fk_adherent); exit; } else @@ -145,11 +159,12 @@ if ($_REQUEST["action"] == 'confirm_delete' && $_REQUEST["confirm"] == 'yes' && * View */ -llxHeader('',$langs->trans("SubscriptionCard"),'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros'); - $form = new Form($db); +llxHeader('',$langs->trans("SubscriptionCard"),'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros'); + + dol_htmloutput_errors($errmsg); @@ -157,46 +172,32 @@ if ($user->rights->adherent->cotisation->creer && $action == 'edit') { /******************************************** * - * Fiche en mode edition + * Subscription card in edit mode * ********************************************/ - $subscription->fetch($rowid); - $result=$adh->fetch($subscription->fk_adherent); + $object->fetch($rowid); + $result=$adh->fetch($object->fk_adherent); - /* - * Affichage onglets - */ - $h = 0; - $head = array(); - - $head[$h][0] = DOL_URL_ROOT.'/adherents/fiche_subscription.php?rowid='.$subscription->id; - $head[$h][1] = $langs->trans("SubscriptionCard"); - $head[$h][2] = 'general'; - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/adherents/info_subscription.php?rowid='.$subscription->id; - $head[$h][1] = $langs->trans("Info"); - $head[$h][2] = 'info'; - $h++; + $head = subscription_prepare_head($object); print ''; print ''; print ""; print ""; - print "fk_bank."\">"; + print "fk_bank."\">"; dol_fiche_head($head, 'general', $langs->trans("Subscription"), 0, 'payment'); print "\n"; print ''; - $linkback = ''.$langs->trans("BackToList").''; + $linkback = ''.$langs->trans("BackToList").''; // Ref - print ''; + print ''; print ''; // Member @@ -207,34 +208,34 @@ if ($user->rights->adherent->cotisation->creer && $action == 'edit') // Date start subscription print ''; print ''; // Date end subscription print ''; print ''; // Amount print ''; + print ''; // Label print ''; + print ''; // Bank line if (! empty($conf->banque->enabled)) { - if ($conf->global->ADHERENT_BANK_USE || $subscription->fk_bank) + if ($conf->global->ADHERENT_BANK_USE || $object->fk_bank) { print ''; - // Errors To + // Default from type + $var=!$var; + print ''; + print ''; + + // Separator + $var=!$var; + print ''; + + // Errors To $var=!$var; print ''; print ''; + print '
'.$langs->trans("Ref").'
'.$langs->trans("Ref").''; - print $form->showrefnav($subscription, 'rowid', $linkback, 1); + print $form->showrefnav($object, 'rowid', $linkback, 1); print '
'.$langs->trans("DateSubscription").''; - $form->select_date($subscription->dateh,'datesub',1,1,0,'update',1); + $form->select_date($object->dateh,'datesub',1,1,0,'update',1); print '
'.$langs->trans("DateEndSubscription").''; - $form->select_date($subscription->datef,'datesubend',0,0,0,'update',1); + $form->select_date($object->datef,'datesubend',0,0,0,'update',1); print '
'.$langs->trans("Amount").''; - print '
'.$langs->trans("Label").''; - print '
'.$langs->trans("BankTransactionLine").''; - if ($subscription->fk_bank) + if ($object->fk_bank) { $bankline=new AccountLine($db); - $result=$bankline->fetch($subscription->fk_bank); + $result=$bankline->fetch($object->fk_bank); print $bankline->getNomUrl(1,0,'showall'); } else @@ -261,30 +262,16 @@ if ($user->rights->adherent->cotisation->creer && $action == 'edit') if ($rowid && $action != 'edit') { - /* ************************************************************************** */ - /* */ - /* Mode affichage */ - /* */ - /* ************************************************************************** */ + /******************************************** + * + * Subscription card in view mode + * + ********************************************/ - $result=$subscription->fetch($rowid); - $result=$adh->fetch($subscription->fk_adherent); + $result=$object->fetch($rowid); + $result=$adh->fetch($object->fk_adherent); - /* - * Affichage onglets - */ - $h = 0; - $head = array(); - - $head[$h][0] = DOL_URL_ROOT.'/adherents/fiche_subscription.php?rowid='.$subscription->id; - $head[$h][1] = $langs->trans("SubscriptionCard"); - $head[$h][2] = 'general'; - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/adherents/info_subscription.php?rowid='.$subscription->id; - $head[$h][1] = $langs->trans("Info"); - $head[$h][2] = 'info'; - $h++; + $head = subscription_prepare_head($object); dol_fiche_head($head, 'general', $langs->trans("Subscription"), '', 'payment'); @@ -295,19 +282,19 @@ if ($rowid && $action != 'edit') //$formquestion['text']=''.$langs->trans("ThisWillAlsoDeleteBankRecord").''; $text=$langs->trans("ConfirmDeleteSubscription"); if (! empty($conf->banque->enabled) && ! empty($conf->global->ADHERENT_BANK_USE)) $text.='
'.img_warning().' '.$langs->trans("ThisWillAlsoDeleteBankRecord"); - print $form->formconfirm($_SERVER["PHP_SELF"]."?rowid=".$subscription->id,$langs->trans("DeleteSubscription"),$text,"confirm_delete",$formquestion,0,1); + print $form->formconfirm($_SERVER["PHP_SELF"]."?rowid=".$object->id,$langs->trans("DeleteSubscription"),$text,"confirm_delete",$formquestion,0,1); } print ''; print ''; print ''; - $linkback = ''.$langs->trans("BackToList").''; + $linkback = ''.$langs->trans("BackToList").''; // Ref - print ''; + print ''; print ''; // Member @@ -318,35 +305,35 @@ if ($rowid && $action != 'edit') // Date record /*print ''; - print ''; + print ''; print '';*/ // Date subscription print ''; - print ''; + print ''; print ''; // Date end subscription print ''; - print ''; + print ''; print ''; // Amount - print ''; + print ''; // Amount - print ''; + print ''; // Bank line if (! empty($conf->banque->enabled)) { - if ($conf->global->ADHERENT_BANK_USE || $subscription->fk_bank) + if ($conf->global->ADHERENT_BANK_USE || $object->fk_bank) { print '\n"; @@ -211,7 +212,7 @@ if ($result) // Static objects - $cotisation=new Cotisation($db); + $subscription=new Subscription($db); $adherent=new Adherent($db); $accountstatic=new Account($db); @@ -220,10 +221,10 @@ if ($result) while ($i < min($num, $limit)) { $objp = $db->fetch_object($result); - $total+=$objp->cotisation; + $total+=$objp->subscription; - $cotisation->ref=$objp->crowid; - $cotisation->id=$objp->crowid; + $subscription->ref=$objp->crowid; + $subscription->id=$objp->crowid; $adherent->lastname=$objp->lastname; $adherent->firstname=$objp->firstname; @@ -236,7 +237,7 @@ if ($result) print ""; // Ref - print ''; + print ''; // Lastname print ''; @@ -273,7 +274,7 @@ if ($result) print '\n"; // Price - print ''; + print ''; print ''; diff --git a/htdocs/adherents/tpl/index.html b/htdocs/adherents/tpl/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/adherents/tpl/linkedobjectblock.tpl.php b/htdocs/adherents/tpl/linkedobjectblock.tpl.php new file mode 100644 index 00000000000..f593e72faa9 --- /dev/null +++ b/htdocs/adherents/tpl/linkedobjectblock.tpl.php @@ -0,0 +1,55 @@ + + * Copyright (C) 2013 Juanjo Menent + * Copyright (C) 2014 Marcos García + * + * 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 . + * + */ +?> + + + +load("members"); + +$var=true; +$total=0; +foreach($linkedObjectBlock as $key => $objectlink) +{ + $var=!$var; +?> + > + + + + + + + + + + + \ No newline at end of file diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index dbc700a6778..ccb180a3288 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -3,7 +3,7 @@ * Copyright (C) 2003 Jean-Louis Bergamo * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2013 Florian Henry + * Copyright (C) 2013 Florian Henry * Copyright (C) 2015 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify @@ -23,7 +23,7 @@ /** * \file htdocs/adherents/type.php * \ingroup member - * \brief Member's type setup + * \brief Member's type setup */ require '../main.inc.php'; @@ -55,7 +55,7 @@ if (! $sortorder) { $sortorder="DESC"; } if (! $sortfield) { $sortfield="d.lastname"; } $label=GETPOST("libelle","alpha"); -$cotisation=GETPOST("cotisation","int"); +$subscription=GETPOST("subscription","int"); $vote=GETPOST("vote","int"); $comment=GETPOST("comment"); $mail_valid=GETPOST("mail_valid"); @@ -90,11 +90,11 @@ if ($action == 'add' && $user->rights->adherent->configurer) { $object = new AdherentType($db); - $object->libelle = trim($label); - $object->cotisation = trim($cotisation); - $object->note = trim($comment); - $object->mail_valid = trim($mail_valid); - $object->vote = trim($vote); + $object->libelle = trim($label); + $object->subscription = trim($subscription); + $object->note = trim($comment); + $object->mail_valid = trim($mail_valid); + $object->vote = trim($vote); // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost($extralabels,$object); @@ -127,12 +127,12 @@ if ($action == 'update' && $user->rights->adherent->configurer) if (! $cancel) { $object = new AdherentType($db); - $object->id = $rowid; - $object->libelle = trim($label); - $object->cotisation = trim($cotisation); - $object->note = trim($comment); - $object->mail_valid = trim($mail_valid); - $object->vote = trim($vote); + $object->id = $rowid; + $object->libelle = trim($label); + $object->subscription = trim($subscription); + $object->note = trim($comment); + $object->mail_valid = trim($mail_valid); + $object->vote = trim($vote); // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost($extralabels,$object); @@ -171,7 +171,7 @@ if (! $rowid && $action != 'create' && $action != 'edit') //dol_fiche_head(''); - $sql = "SELECT d.rowid, d.libelle, d.cotisation, d.vote"; + $sql = "SELECT d.rowid, d.libelle, d.subscription, d.vote"; $sql.= " FROM ".MAIN_DB_PREFIX."adherent_type as d"; $sql.= " WHERE d.entity IN (".getEntity().")"; @@ -199,7 +199,7 @@ if (! $rowid && $action != 'create' && $action != 'edit') print ""; print ''; print ''; - print ''; + print ''; print ''; if ($user->rights->adherent->configurer) print ''; @@ -240,7 +240,7 @@ if ($action == 'create') print ''; print ''; print ''; print ''; print '"; - // Date fin cotisation + // Date end subscription if ($datefin) { print ''; print ''; print '
'.$langs->trans("Ref").'
'.$langs->trans("Ref").''; - print $form->showrefnav($subscription, 'rowid', $linkback, 1); + print $form->showrefnav($object, 'rowid', $linkback, 1); print '
'.$langs->trans("DateSubscription").''.dol_print_date($subscription->datec,'dayhour').''.$langs->trans("DateSubscription").''.dol_print_date($object->datec,'dayhour').'
'.$langs->trans("DateSubscription").''.dol_print_date($subscription->dateh,'day').''.$langs->trans("DateSubscription").''.dol_print_date($object->dateh,'day').'
'.$langs->trans("DateEndSubscription").''.dol_print_date($subscription->datef,'day').''.$langs->trans("DateEndSubscription").''.dol_print_date($object->datef,'day').'
'.$langs->trans("Amount").''.price($subscription->amount).'
'.$langs->trans("Amount").''.price($object->amount).'
'.$langs->trans("Label").''.$subscription->note.'
'.$langs->trans("Label").''.$object->note.'
'.$langs->trans("BankTransactionLine").''; - if ($subscription->fk_bank) + if ($object->fk_bank) { $bankline=new AccountLine($db); - $result=$bankline->fetch($subscription->fk_bank); + $result=$bankline->fetch($object->fk_bank); print $bankline->getNomUrl(1,0,'showall'); } else @@ -373,7 +360,7 @@ if ($rowid && $action != 'edit') { if (! $bankline->rappro) { - print '"; + print '"; } else { @@ -384,12 +371,51 @@ if ($rowid && $action != 'edit') // Supprimer if ($user->rights->adherent->cotisation->creer) { - print '\n"; + print '\n"; } print ''; - print "
\n"; - + + + print '
'; + print ''; // ancre + + // Documents generes + /* + $filename = dol_sanitizeFileName($object->ref); + $filedir = $conf->facture->dir_output . '/' . dol_sanitizeFileName($object->ref); + $urlsource = $_SERVER['PHP_SELF'] . '?facid=' . $object->id; + $genallowed = $user->rights->facture->creer; + $delallowed = $user->rights->facture->supprimer; + + print $formfile->showdocuments('facture', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang); + $somethingshown = $formfile->numoffiles; + */ + // Show links to link elements + //$linktoelem = $form->showLinkToObjectBlock($object, null, array('subscription')); + $somethingshown = $form->showLinkedObjectBlock($object, ''); + + // Show links to link elements + /*$linktoelem = $form->showLinkToObjectBlock($object,array('order')); + if ($linktoelem) print ($somethingshown?'':'
').$linktoelem; + + // Link for paypal payment + /* + if (! empty($conf->paypal->enabled) && $object->statut != 0) { + include_once DOL_DOCUMENT_ROOT . '/paypal/lib/paypal.lib.php'; + print showPaypalPaymentUrl('invoice', $object->ref); + } + */ + print '
'; + + // List of actions on element + /* + include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php'; + $formactions = new FormActions($db); + $somethingshown = $formactions->showactions($object, 'invoice', $socid); + */ + + print '
'; } diff --git a/htdocs/adherents/subscription/index.html b/htdocs/adherents/subscription/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/adherents/info_subscription.php b/htdocs/adherents/subscription/info.php similarity index 66% rename from htdocs/adherents/info_subscription.php rename to htdocs/adherents/subscription/info.php index f9dc5ff17af..5c5799ec2a5 100644 --- a/htdocs/adherents/info_subscription.php +++ b/htdocs/adherents/subscription/info.php @@ -17,16 +17,16 @@ */ /** - * \file htdocs/adherents/info_subscription.php + * \file htdocs/adherents/subscription/info.php * \ingroup member - * \brief Page with information of subscriptions of a member + * \brief Page with information of subscriptions of a member */ -require '../main.inc.php'; +require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/adherents/class/cotisation.class.php'; +require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php'; $langs->load("companies"); $langs->load("bills"); @@ -41,37 +41,24 @@ $rowid=isset($_GET["rowid"])?$_GET["rowid"]:$_POST["rowid"]; /* - * Visualisation de la fiche - * + * View */ llxHeader(); $form = new Form($db); -$subscription = new Cotisation($db); -$result=$subscription->fetch($rowid); - -$h = 0; -$head = array(); - -$head[$h][0] = DOL_URL_ROOT.'/adherents/fiche_subscription.php?rowid='.$subscription->id; -$head[$h][1] = $langs->trans("SubscriptionCard"); -$head[$h][2] = 'general'; -$h++; - -$head[$h][0] = DOL_URL_ROOT.'/adherents/info_subscription.php?rowid='.$subscription->id; -$head[$h][1] = $langs->trans("Info"); -$head[$h][2] = 'info'; -$h++; +$object = new Subscription($db); +$result = $object->fetch($rowid); +$head = subscription_prepare_head($object); dol_fiche_head($head, 'info', $langs->trans("Subscription"), '', 'payment'); -$subscription->info($rowid); +$object->info($rowid); print '
'; -dol_print_object_info($subscription); +dol_print_object_info($object); print '
'; print ''; diff --git a/htdocs/adherents/cotisations.php b/htdocs/adherents/subscription/list.php similarity index 92% rename from htdocs/adherents/cotisations.php rename to htdocs/adherents/subscription/list.php index 2e4f4b1994f..6062bb12567 100644 --- a/htdocs/adherents/cotisations.php +++ b/htdocs/adherents/subscription/list.php @@ -18,14 +18,14 @@ */ /** - * \file htdocs/adherents/cotisations.php + * \file htdocs/adherents/subscription/list.php * \ingroup member - * \brief Page de consultation et insertion d'une cotisation + * \brief list of subscription */ -require '../main.inc.php'; +require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; -require_once DOL_DOCUMENT_ROOT.'/adherents/class/cotisation.class.php'; +require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; $langs->load("members"); @@ -85,14 +85,15 @@ llxHeader('',$langs->trans("ListOfSubscriptions"),'EN:Module_Foundations|FR:Modu // List of subscriptions $sql = "SELECT d.rowid, d.login, d.firstname, d.lastname, d.societe,"; -$sql.= " c.rowid as crowid, c.cotisation,"; +$sql.= " c.rowid as crowid, c.subscription,"; $sql.= " c.dateadh,"; $sql.= " c.datef,"; $sql.= " c.fk_bank as bank, c.note,"; $sql.= " b.fk_account"; -$sql.= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."cotisation as c"; +$sql.= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."subscription as c"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON c.fk_bank=b.rowid"; $sql.= " WHERE d.rowid = c.fk_adherent"; +$sql.= " AND d.entity IN (".getEntity('adherent', 1).")"; if (isset($date_select) && $date_select != '') { $sql.= " AND c.dateadh LIKE '".$date_select."%'"; @@ -103,10 +104,10 @@ if ($search_ref) else $sql.=" AND 1 = 2"; // Always wrong } if ($search_lastname) $sql.= natural_search(array('d.firstname','d.lastname','d.societe'), $search_lastname); -if ($search_login) $sql.= natural_search('c.cotisation', $search_login); +if ($search_login) $sql.= natural_search('c.subscription', $search_login); if ($search_note) $sql.= natural_search('c.note', $search_note); if ($search_account > 0) $sql.= " AND b.fk_account = ".$search_account; -if ($search_amount) $sql.= natural_search('c.cotisation', $search_amount, 1); +if ($search_amount) $sql.= natural_search('c.subscription', $search_amount, 1); $sql.= $db->order($sortfield,$sortorder); $nbtotalofrecords = 0; @@ -166,7 +167,7 @@ if ($result) } print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"c.dateadh",$param,"",'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("DateEnd"),$_SERVER["PHP_SELF"],"c.datef",$param,"",'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"c.cotisation",$param,"",'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"c.subscription",$param,"",'align="right"',$sortfield,$sortorder); print_liste_field_titre(''); print "
'.$cotisation->getNomUrl(1).''.$subscription->getNomUrl(1).''.$adherent->getNomUrl(1).''.dol_print_date($db->jdate($objp->datef),'day')."'.price($objp->cotisation).''.price($objp->subscription).'
trans("Subscription"); ?>getNomUrl(1); ?>dateh,'day'); ?>rights->adherent->lire) { + $total = $total + $objectlink->amount; + echo price($objectlink->amount); + } ?>">transnoentitiesnoconv("RemoveLink")); ?>
'.img_object($langs->trans("ShowType"),'group').' '.$objp->rowid.''.dol_escape_htmltag($objp->libelle).''.yn($objp->cotisation).''.yn($objp->subscription).''.yn($objp->vote).'rowid.'">'.img_edit().'
'.$langs->trans("Label").'
'.$langs->trans("SubscriptionRequired").''; - print $form->selectyesno("cotisation",1,1); + print $form->selectyesno("subscription",1,1); print '
'.$langs->trans("VoteAllowed").''; @@ -308,7 +308,7 @@ if ($rowid > 0) print '
'.$langs->trans("Label").''.dol_escape_htmltag($object->libelle).'
'.$langs->trans("SubscriptionRequired").''; - print yn($object->cotisation); + print yn($object->subscription); print '
'.$langs->trans("VoteAllowed").''; @@ -367,7 +367,7 @@ if ($rowid > 0) $sql = "SELECT d.rowid, d.login, d.firstname, d.lastname, d.societe, "; $sql.= " d.datefin,"; $sql.= " d.email, d.fk_adherent_type as type_id, d.morphy, d.statut,"; - $sql.= " t.libelle as type, t.cotisation"; + $sql.= " t.libelle as type, t.subscription"; $sql.= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."adherent_type as t"; $sql.= " WHERE d.fk_adherent_type = t.rowid "; $sql.= " AND d.entity IN (".getEntity().")"; @@ -546,10 +546,10 @@ if ($rowid > 0) // Statut print ''; - print $adh->LibStatut($objp->statut,$objp->cotisation,$datefin,2); + print $adh->LibStatut($objp->statut,$objp->subscription,$datefin,2); print "'; @@ -566,7 +566,7 @@ if ($rowid > 0) else { print ''; - if ($objp->cotisation == 'yes') + if ($objp->subscription == 'yes') { print $langs->trans("SubscriptionNotReceived"); if ($objp->statut > 0) print " ".img_warning(); @@ -638,7 +638,7 @@ if ($rowid > 0) print '
'.$langs->trans("Label").'
'.$langs->trans("SubscriptionRequired").''; - print $form->selectyesno("cotisation",$object->cotisation,1); + print $form->selectyesno("subscription",$object->subscription,1); print '
'.$langs->trans("VoteAllowed").''; diff --git a/htdocs/admin/agenda_other.php b/htdocs/admin/agenda_other.php index b9051f6f33a..9ea048c27fd 100644 --- a/htdocs/admin/agenda_other.php +++ b/htdocs/admin/agenda_other.php @@ -1,8 +1,9 @@ - * Copyright (C) 2011 Regis Houssin - * Copyright (C) 2011-2013 Juanjo Menent - * Copyright (C) 2015 Jean-François Ferry +/* Copyright (C) 2008-2015 Laurent Destailleur + * Copyright (C) 2011 Regis Houssin + * Copyright (C) 2011-2013 Juanjo Menent + * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2016 Charlie Benke * * 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 @@ -36,7 +37,11 @@ $langs->load("admin"); $langs->load("other"); $action = GETPOST('action','alpha'); +$value = GETPOST('value','alpha'); +$param = GETPOST('param','alpha'); $cancel = GETPOST('cancel','alpha'); +$scandir = GETPOST('scandir','alpha'); +$type = 'action'; /* @@ -71,7 +76,21 @@ if (preg_match('/del_(.*)/',$action,$reg)) dol_print_error($db); } } +// Define constants for submodules that contains parameters (forms with param1, param2, ... and value1, value2, ...) +if ($action == 'setModuleOptions') +{ + if ($param) $res = dolibarr_set_const($db,$param,$value,'chaine',0,'',$conf->entity); + if (! $res > 0) $error++; + if (! $error) + { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } + else + { + setEventMessages($langs->trans("Error"), null, 'errors'); + } +} if ($action == 'set') { dolibarr_set_const($db, 'AGENDA_USE_EVENT_TYPE_DEFAULT', GETPOST('AGENDA_USE_EVENT_TYPE_DEFAULT'), 'chaine', 0, '', $conf->entity); @@ -79,6 +98,85 @@ if ($action == 'set') dolibarr_set_const($db, 'AGENDA_DEFAULT_FILTER_STATUS', GETPOST('AGENDA_DEFAULT_FILTER_STATUS'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, 'AGENDA_DEFAULT_VIEW', GETPOST('AGENDA_DEFAULT_VIEW'), 'chaine', 0, '', $conf->entity); } +else if ($action == 'specimen') // For orders +{ + $modele=GETPOST('module','alpha'); + + $commande = new CommandeFournisseur($db); + $commande->initAsSpecimen(); + $commande->thirdparty=$specimenthirdparty; + + // Search template files + $file=''; $classname=''; $filefound=0; + $dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']); + foreach($dirmodels as $reldir) + { + $file=dol_buildpath($reldir."core/modules/action/doc/pdf_".$modele.".modules.php",0); + if (file_exists($file)) + { + $filefound=1; + $classname = "pdf_".$modele; + break; + } + } + + if ($filefound) + { + require_once $file; + + $module = new $classname($db,$commande); + + if ($module->write_file($commande,$langs) > 0) + { + header("Location: ".DOL_URL_ROOT."/document.php?modulepart=action&file=SPECIMEN.pdf"); + return; + } + else + { + setEventMessages($module->error, $module->errors, 'errors'); + dol_syslog($module->error, LOG_ERR); + } + } + else + { + setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); + dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); + } +} + +// Activate a model +else if ($action == 'setmodel') +{ + //print "sssd".$value; + $ret = addDocumentModel($value, $type, $label, $scandir); +} + +else if ($action == 'del') +{ + $ret = delDocumentModel($value, $type); + if ($ret > 0) + { + if ($conf->global->ACTION_EVENT_ADDON_PDF == "$value") dolibarr_del_const($db, 'ACTION_EVENT_ADDON_PDF',$conf->entity); + } +} + +// Set default model +else if ($action == 'setdoc') +{ + if (dolibarr_set_const($db, "ACTION_EVENT_ADDON_PDF",$value,'chaine',0,'',$conf->entity)) + { + // La constante qui a ete lue en avant du nouveau set + // on passe donc par une variable pour avoir un affichage coherent + $conf->global->ACTION_EVENT_ADDON_PDF = $value; + } + + // On active le modele + $ret = delDocumentModel($value, $type); + if ($ret > 0) + { + $ret = addDocumentModel($value, $type, $label, $scandir); + } +} /** @@ -86,7 +184,7 @@ if ($action == 'set') */ $formactions=new FormActions($db); - +$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']); llxHeader(); $linkback=''.$langs->trans("BackToModuleList").''; @@ -95,15 +193,156 @@ print "
\n"; -print ''; -print ''; $head=agenda_prepare_head(); dol_fiche_head($head, 'other', $langs->trans("Agenda"), 0, 'action'); + +/* + * Documents models for supplier orders + */ + + +// Define array def of models +$def = array(); + +$sql = "SELECT nom"; +$sql.= " FROM ".MAIN_DB_PREFIX."document_model"; +$sql.= " WHERE type = 'action'"; +$sql.= " AND entity = ".$conf->entity; + +$resql=$db->query($sql); +if ($resql) +{ + $i = 0; + $num_rows=$db->num_rows($resql); + while ($i < $num_rows) + { + $array = $db->fetch_array($resql); + array_push($def, $array[0]); + $i++; + } +} +else +{ + dol_print_error($db); +} + +if ($conf->global->MAIN_FEATURES_LEVEL >= 2) +{ + print load_fiche_titre($langs->trans("AgendaModelModule"),'',''); + + print ''."\n"; + print ''."\n"; + print ''."\n"; + print ''."\n"; + print ''."\n"; + print ''."\n"; + print ''; + print ''; + print ''."\n"; + + clearstatcache(); + + $var=true; + foreach ($dirmodels as $reldir) + { + $dir = dol_buildpath($reldir."core/modules/action/doc/"); + + if (is_dir($dir)) + { + $handle=opendir($dir); + if (is_resource($handle)) + { + while (($file = readdir($handle))!==false) + { + if (preg_match('/\.modules\.php$/i',$file) && preg_match('/^(pdf_|doc_)/',$file)) + { + $name = substr($file, 4, dol_strlen($file) -16); + $classname = substr($file, 0, dol_strlen($file) -12); + + require_once $dir.'/'.$file; + $module = new $classname($db, new ActionComm($db)); + + $var=!$var; + print "\n"; + print "\n"; + print "\n"; + + // Active + if (in_array($name, $def)) + { + + print '"; + } + else + { + print '"; + } + + // Default + print ''; + + // Info + $htmltooltip = ''.$langs->trans("Name").': '.$module->name; + $htmltooltip.='
'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); + $htmltooltip.='
'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur; + $htmltooltip.='

'.$langs->trans("FeaturesSupported").':'; + $htmltooltip.='
'.$langs->trans("Logo").': '.yn($module->option_logo,1,1); + print ''; + print ''; + + print "\n"; + } + } + closedir($handle); + } + } + } + print '
'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Status").''.$langs->trans("Default").''.$langs->trans("ShortInfo").''.$langs->trans("Preview").'
"; + print (empty($module->name)?$name:$module->name); + print "\n"; + require_once $dir.$file; + $module = new $classname($db,$specimenthirdparty); + if (method_exists($module,'info')) + print $module->info($langs); + else + print $module->description; + print "'."\n"; + if ($conf->global->ACTION_EVENT_ADDON_PDF != "$name") + { + print 'scandir.'&label='.urlencode($module->name).'&type=action">'; + print img_picto($langs->trans("Enabled"),'switch_on'); + print ''; + } + else + { + print img_picto($langs->trans("Enabled"),'switch_on'); + } + print "'."\n"; + print 'scandir.'&label='.urlencode($module->name).'&type=action">'.img_picto($langs->trans("Disabled"),'switch_off').''; + print "'; + if ($conf->global->ACTION_EVENT_ADDON_PDF == "$name") + { + print img_picto($langs->trans("Default"),'on'); + } + else + { + print 'scandir.'&label='.urlencode($module->name).'&type=action"" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').''; + } + print ''; + print $form->textwithpicto('',$htmltooltip,1,0); + print ''; + print ''.img_object($langs->trans("Preview"),'order').''; + print '

'; +} + $var=true; +print ''; +print ''; + print ''."\n"; print ''."\n"; print ''."\n"; diff --git a/htdocs/admin/bank.php b/htdocs/admin/bank.php index 8a5c60c8483..58d97842017 100644 --- a/htdocs/admin/bank.php +++ b/htdocs/admin/bank.php @@ -28,7 +28,8 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; +require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php'; $langs->load("admin"); $langs->load("companies"); @@ -40,6 +41,10 @@ if (!$user->admin) accessforbidden(); $action = GETPOST('action','alpha'); +$value = GETPOST('value','alpha'); +$label = GETPOST('label','alpha'); +$scandir = GETPOST('scandir','alpha'); +$type = 'bankaccount'; /* @@ -60,14 +65,103 @@ if ($action == 'setbankorder') } } + +if ($action == 'specimen') +{ + $modele=GETPOST('module','alpha'); + + if ($modele == 'sepamandate') + { + $object = new CompanyBankAccount($db); + } + else + { + $object = new Account($db); + } + $object->initAsSpecimen(); + + // Search template files + $file=''; $classname=''; $filefound=0; + $dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']); + foreach($dirmodels as $reldir) + { + $file=dol_buildpath($reldir."core/modules/bank/doc/pdf_".$modele.".modules.php",0); + if (file_exists($file)) + { + $filefound=1; + $classname = "pdf_".$modele; + break; + } + } + + if ($filefound) + { + require_once $file; + + $module = new $classname($db); + + if ($module->write_file($object,$langs) > 0) + { + header("Location: ".DOL_URL_ROOT."/document.php?modulepart=bank&file=SPECIMEN.pdf"); + return; + } + else + { + setEventMessages($module->error, null, 'errors'); + dol_syslog($module->error, LOG_ERR); + } + } + else + { + setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); + dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); + } +} + +// Activate a model +if ($action == 'set') +{ + $ret = addDocumentModel($value, $type, $label, $scandir); +} + +else if ($action == 'del') +{ + $ret = delDocumentModel($value, $type); + if ($ret > 0) + { + if ($conf->global->BANKADDON_PDF == "$value") dolibarr_del_const($db, 'BANKADDON_PDF',$conf->entity); + } +} +// Set default model +else if ($action == 'setdoc') +{ + if (dolibarr_set_const($db, "BANKADDON_PDF",$value,'chaine',0,'',$conf->entity)) + { + // The constant that was read before the new set + // We therefore requires a variable to have a coherent view + $conf->global->BANKADDON_PDF = $value; + } + + // On active le modele + $ret = delDocumentModel($value, $type); + if ($ret > 0) + { + $ret = addDocumentModel($value, $type, $label, $scandir); + } +} + + + /* * view */ -llxHeader("",$langs->trans("BankSetupModule")); - $form=new Form($db); +$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']); + +llxHeader("",$langs->trans("BankSetupModule")); + $linkback=''.$langs->trans("BackToModuleList").''; print load_fiche_titre($langs->trans("BankSetupModule"),$linkback,'title_setup'); @@ -79,7 +173,7 @@ $var=true; $var=! $var; //Show bank account order -print load_fiche_titre($langs->trans("BankOrderShow")); +print load_fiche_titre($langs->trans("BankOrderShow"), '', ''); print '
'.$langs->trans("Parameters").'
'; print ''; @@ -137,6 +231,152 @@ while ($i < $nbofbank) print '
'."\n"; + +print '

'; + + +/* + * Document templates generators + */ +//if (! empty($conf->global->MAIN_FEATURES_LEVEL)) +//{ +print load_fiche_titre($langs->trans("BankAccountModelModule"), '', ''); + +// Load array def with activated templates +$def = array(); +$sql = "SELECT nom"; +$sql .= " FROM " . MAIN_DB_PREFIX . "document_model"; +$sql .= " WHERE type = '" . $type . "'"; +$sql .= " AND entity = " . $conf->entity; +$resql = $db->query($sql); +if ($resql) { + $i = 0; + $num_rows = $db->num_rows($resql); + while ($i < $num_rows) { + $array = $db->fetch_array($resql); + array_push($def, $array[0]); + $i ++; + } +} else { + dol_print_error($db); +} + +print "\n"; +print "\n"; +print ''; +print ''; +print '\n"; +print '\n"; +print ''; +print ''; +print "\n"; + +clearstatcache(); + +$var = true; +foreach ($dirmodels as $reldir) +{ + foreach (array('', '/doc') as $valdir) { + $dir = dol_buildpath($reldir . "core/modules/bank" . $valdir); + + if (is_dir($dir)) { + $handle = opendir($dir); + if (is_resource($handle)) { + while (($file = readdir($handle)) !== false) { + $filelist[] = $file; + } + closedir($handle); + arsort($filelist); + + foreach ($filelist as $file) { + if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) { + + if (file_exists($dir . '/' . $file)) { + $name = substr($file, 4, dol_strlen($file) - 16); + $classname = substr($file, 0, dol_strlen($file) - 12); + + require_once $dir . '/' . $file; + $module = new $classname($db); + + $modulequalified = 1; + if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) + $modulequalified = 0; + if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) + $modulequalified = 0; + + if ($modulequalified) { + $var = ! $var; + print ''; + + // Active + if (in_array($name, $def)) { + print ''; + } else { + print '"; + } + + // Default + print ''; + + // Info + $htmltooltip = '' . $langs->trans("Name") . ': ' . $module->name; + $htmltooltip .= '
' . $langs->trans("Type") . ': ' . ($module->type ? $module->type : $langs->trans("Unknown")); + if ($module->type == 'pdf') { + $htmltooltip .= '
' . $langs->trans("Width") . '/' . $langs->trans("Height") . ': ' . $module->page_largeur . '/' . $module->page_hauteur; + } + $htmltooltip .= '

' . $langs->trans("FeaturesSupported") . ':'; + $htmltooltip .= '
' . $langs->trans("Logo") . ': ' . yn($module->option_logo, 1, 1); + //$htmltooltip .= '
' . $langs->trans("PaymentMode") . ': ' . yn($module->option_modereg, 1, 1); + //$htmltooltip .= '
' . $langs->trans("PaymentConditions") . ': ' . yn($module->option_condreg, 1, 1); + $htmltooltip .= '
' . $langs->trans("MultiLanguage") . ': ' . yn($module->option_multilang, 1, 1); + // $htmltooltip.='
'.$langs->trans("Discounts").': '.yn($module->option_escompte,1,1); + // $htmltooltip.='
'.$langs->trans("CreditNote").': '.yn($module->option_credit_note,1,1); + //$htmltooltip .= '
' . $langs->trans("WatermarkOnDraftOrders") . ': ' . yn($module->option_draft_watermark, 1, 1); + + print ''; + + // Preview + print ''; + + print "\n"; + } + } + } + } + } + } + } +} +//} + + dol_fiche_end(); llxFooter(); diff --git a/htdocs/admin/commande.php b/htdocs/admin/commande.php index c91c2fb8c75..c2f8cf2d4d6 100644 --- a/htdocs/admin/commande.php +++ b/htdocs/admin/commande.php @@ -7,7 +7,7 @@ * Copyright (C) 2005-2014 Regis Houssin * Copyright (C) 2008 Raphael Bertrand (Resultic) * Copyright (C) 2011-2013 Juanjo Menent - * Copyright (C) 2011-2015 Philippe Grand + * Copyright (C) 2011-2016 Philippe Grand * Copyright (C) 2013 Florian Henry * * This program is free software; you can redistribute it and/or modify @@ -273,12 +273,12 @@ else if ($action == 'set_WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER') * View */ +$form=new Form($db); + $dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']); llxHeader("",$langs->trans("OrdersSetup")); -$form=new Form($db); - $linkback=''.$langs->trans("BackToModuleList").''; print load_fiche_titre($langs->trans("OrdersSetup"),$linkback,'title_setup'); @@ -494,7 +494,7 @@ foreach ($dirmodels as $reldir) print ""; } - // Defaut + // Default print '\n"; print ''; // Shippable Icon in List +/* Kept as hidden feature for the moment, result seems bugged. +Whet is definition of "shippable" according to all different STOCK_CALCULATE_... options ? $var=!$var; print ""; print ''; @@ -617,6 +618,8 @@ if (!empty($conf->global->SHIPPABLE_ORDER_ICON_IN_LIST)) { print ''; print ''; +/* Seems to be not so used. So kept hidden for the moment to avoid dangerous options inflation. +/* // Ask for payment bank during order if ($conf->banque->enabled) { @@ -676,6 +679,7 @@ else print ''; } +*/ print '
' . $langs->trans("Name") . '' . $langs->trans("Description") . '' . $langs->trans("Status") . "' . $langs->trans("Default") . "' . $langs->trans("ShortInfo") . '' . $langs->trans("Preview") . '
'; + print(empty($module->name) ? $name : $module->name); + print "\n"; + if (method_exists($module, 'info')) + print $module->info($langs); + else + print $module->description; + print '' . "\n"; + print ''; + print img_picto($langs->trans("Enabled"), 'switch_on'); + print ''; + print '' . "\n"; + print '' . img_picto($langs->trans("Disabled"), 'switch_off') . ''; + print "'; + if ($conf->global->BANKADDON_PDF == $name) { + print img_picto($langs->trans("Default"), 'on'); + } else { + print '' . img_picto($langs->trans("Disabled"), 'off') . ''; + } + print ''; + print $form->textwithpicto('', $htmltooltip, 1, 0); + print ''; + if ($module->type == 'pdf') { + print '' . img_object($langs->trans("Preview"), 'bill') . ''; + } else { + print img_object($langs->trans("PreviewNotAvailable"), 'generic'); + } + print '
'; if ($conf->global->COMMANDE_ADDON_PDF == $name) { @@ -554,7 +554,6 @@ print "
"; /* * Other options - * */ print load_fiche_titre($langs->trans("OtherOptions"),'',''); @@ -602,6 +601,8 @@ print "
'.$langs->trans("ShippableOrderIconInList").'
'; print $langs->trans("WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER").' '.$langs->trans('NotAvailable').'
'; print '
'; diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index cb79e6ff401..4ebbd2096f9 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2013 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2010-2014 Juanjo Menent - * Copyright (C) 2011-2015 Philippe Grand + * Copyright (C) 2011-2016 Philippe Grand * Copyright (C) 2015 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify @@ -308,10 +308,12 @@ if ($action == 'edit' || $action == 'updateedit') print ''; print ''."\n"; + // Name $var=!$var; print ''."\n"; + // Addresse $var=!$var; print ''."\n"; @@ -392,14 +394,14 @@ if ($action == 'edit' || $action == 'updateedit') // Note $var=!$var; print ''; + print ''; print ''; print '
'.$langs->trans("CompanyInfo").''.$langs->trans("Value").'
'; print '
'; print '
'; - print '
'; print '
'; - // Identifiants de la societe (country-specific) + // IDs of the company (country-specific) print ''; print ''; $var=true; @@ -416,7 +418,7 @@ if ($action == 'edit' || $action == 'updateedit') print ''; - // Forme juridique + // Juridical Status $var=!$var; print ''; + print ''; print ''; print '
'.$langs->trans("CompanyIds").''.$langs->trans("Value").'
'; print '
'; if ($mysoc->country_code) { @@ -531,7 +533,7 @@ if ($action == 'edit' || $action == 'updateedit') // Object of the company $var=!$var; print '
'; - print '
'; @@ -764,7 +766,7 @@ else print $mysoc->logo; print '
'; - // On propose la generation de la vignette si elle n'existe pas + // It offers the generation of the thumbnail if it does not exist if (!is_file($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini) && preg_match('/(\.jpg|\.jpeg|\.png)$/i',$mysoc->logo)) { print 'logo).'">'.img_picto($langs->trans('GenerateThumb'),'refresh').'  '; @@ -790,7 +792,7 @@ else print '
'; - // Identifiants de la societe (country-specific) + // IDs of the company (country-specific) print '
'; print ''; print ''; @@ -807,7 +809,7 @@ else print ''; - // Forme juridique + // Juridical Status $var=!$var; print ''; } - // TVA + // VAT $var=!$var; print ''; print '\n"; print ''; -// Add js auto fill amount on paiement form -$var=! $var; -print ''; -print ''; -print ''; -print '\n"; -print ''; - $var=! $var; print ''; print ''; diff --git a/htdocs/admin/fckeditor.php b/htdocs/admin/fckeditor.php index e244941ff58..3cb111c4d53 100644 --- a/htdocs/admin/fckeditor.php +++ b/htdocs/admin/fckeditor.php @@ -56,7 +56,7 @@ $conditions = array( 'SOCIETE' => 1, 'PRODUCTDESC' => (! empty($conf->product->enabled) || ! empty($conf->service->enabled)), 'MAILING' => ! empty($conf->mailing->enabled), -'DETAILS' => (! empty($conf->facture->enabled) || ! empty($conf->propal->enabled) || ! empty($conf->commande->enabled)), +'DETAILS' => (! empty($conf->facture->enabled) || ! empty($conf->propal->enabled) || ! empty($conf->commande->enabled) || ! empty($conf->supplier_proposal->enabled) || ! empty($conf->fournisseur->enabled)), 'USERSIGN' => 1, 'MAIL' => (! empty($conf->facture->enabled) || ! empty($conf->propal->enabled) || ! empty($conf->commande->enabled)) ); diff --git a/htdocs/admin/fichinter.php b/htdocs/admin/fichinter.php index fd34d01f620..a67407b818c 100644 --- a/htdocs/admin/fichinter.php +++ b/htdocs/admin/fichinter.php @@ -232,6 +232,20 @@ elseif ($action == 'set_FICHINTER_PRINT_PRODUCTS') { setEventMessages($langs->trans("Error"), null, 'errors'); } +} elseif ($action == 'set_FICHINTER_USE_SERVICE_DURATION') { + $val = GETPOST('FICHINTER_USE_SERVICE_DURATION', 'alpha'); + $res = dolibarr_set_const($db, "FICHINTER_USE_SERVICE_DURATION", ($val == 'on' ? 1 : 0), 'bool', 0, '', + $conf->entity); + + if (!$res > 0) { + $error++; + } + + if (!$error) { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } else { + setEventMessages($langs->trans("Error"), null, 'errors'); + } } @@ -568,7 +582,22 @@ print '/>'; print '\n"; - +// Use services duration +$var = !$var; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; print ''; diff --git a/htdocs/admin/ihm.php b/htdocs/admin/ihm.php index 51d0a6174c8..42b5fc4056a 100644 --- a/htdocs/admin/ihm.php +++ b/htdocs/admin/ihm.php @@ -2,6 +2,7 @@ /* Copyright (C) 2001-2005 Rodolphe Quiedeville * Copyright (C) 2004-2015 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2016 Juanjo Menent * * 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 @@ -75,31 +76,35 @@ if ($action == 'update') dolibarr_set_const($db, "MAIN_THEME", $_POST["main_theme"],'chaine',0,'',$conf->entity); - $val=(join(',',(colorStringToArray(GETPOST('THEME_ELDY_BACKBODY'),array())))); + $val=(implode(',',(colorStringToArray(GETPOST('THEME_ELDY_BACKBODY'),array())))); if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_BACKBODY', $conf->entity); - else dolibarr_set_const($db, 'THEME_ELDY_BACKBODY', join(',',colorStringToArray(GETPOST('THEME_ELDY_BACKBODY'),array())),'chaine',0,'',$conf->entity); + else dolibarr_set_const($db, 'THEME_ELDY_BACKBODY', implode(',',colorStringToArray(GETPOST('THEME_ELDY_BACKBODY'),array())),'chaine',0,'',$conf->entity); - $val=(join(',',(colorStringToArray(GETPOST('THEME_ELDY_TOPMENU_BACK1'),array())))); + $val=GETPOST('THEME_TOPMENU_DISABLE_IMAGE'); + if (! $val) dolibarr_del_const($db, 'THEME_TOPMENU_DISABLE_IMAGE', $conf->entity); + else dolibarr_set_const($db, 'THEME_TOPMENU_DISABLE_IMAGE', GETPOST('THEME_TOPMENU_DISABLE_IMAGE'),'chaine',0,'',$conf->entity); + + $val=(implode(',',(colorStringToArray(GETPOST('THEME_ELDY_TOPMENU_BACK1'),array())))); if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_TOPMENU_BACK1', $conf->entity); - else dolibarr_set_const($db, 'THEME_ELDY_TOPMENU_BACK1', join(',',colorStringToArray(GETPOST('THEME_ELDY_TOPMENU_BACK1'),array())),'chaine',0,'',$conf->entity); + else dolibarr_set_const($db, 'THEME_ELDY_TOPMENU_BACK1', implode(',',colorStringToArray(GETPOST('THEME_ELDY_TOPMENU_BACK1'),array())),'chaine',0,'',$conf->entity); - $val=(join(',',(colorStringToArray(GETPOST('THEME_ELDY_BACKTITLE1'),array())))); + $val=(implode(',',(colorStringToArray(GETPOST('THEME_ELDY_BACKTITLE1'),array())))); if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_BACKTITLE1', $conf->entity); - else dolibarr_set_const($db, 'THEME_ELDY_BACKTITLE1', join(',',colorStringToArray(GETPOST('THEME_ELDY_BACKTITLE1'),array())),'chaine',0,'',$conf->entity); + else dolibarr_set_const($db, 'THEME_ELDY_BACKTITLE1', implode(',',colorStringToArray(GETPOST('THEME_ELDY_BACKTITLE1'),array())),'chaine',0,'',$conf->entity); - $val=(join(',',(colorStringToArray(GETPOST('THEME_ELDY_TEXTTITLENOTAB'),array())))); + $val=(implode(',',(colorStringToArray(GETPOST('THEME_ELDY_TEXTTITLENOTAB'),array())))); if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_TEXTTITLENOTAB', $conf->entity); - else dolibarr_set_const($db, 'THEME_ELDY_TEXTTITLENOTAB', join(',',colorStringToArray(GETPOST('THEME_ELDY_TEXTTITLENOTAB'),array())),'chaine',0,'',$conf->entity); + else dolibarr_set_const($db, 'THEME_ELDY_TEXTTITLENOTAB', implode(',',colorStringToArray(GETPOST('THEME_ELDY_TEXTTITLENOTAB'),array())),'chaine',0,'',$conf->entity); if (GETPOST('THEME_ELDY_USE_HOVER') == '') dolibarr_del_const($db, "THEME_ELDY_USE_HOVER", $conf->entity); else dolibarr_set_const($db, "THEME_ELDY_USE_HOVER", $_POST["THEME_ELDY_USE_HOVER"], 'chaine', 0, '', $conf->entity); - $val=(join(',',(colorStringToArray(GETPOST('THEME_ELDY_TEXTLINK'),array())))); + $val=(implode(',',(colorStringToArray(GETPOST('THEME_ELDY_TEXTLINK'),array())))); if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_TEXTLINK', $conf->entity); - else dolibarr_set_const($db, 'THEME_ELDY_TEXTLINK', join(',',colorStringToArray(GETPOST('THEME_ELDY_TEXTLINK'),array())),'chaine',0,'',$conf->entity); + else dolibarr_set_const($db, 'THEME_ELDY_TEXTLINK', implode(',',colorStringToArray(GETPOST('THEME_ELDY_TEXTLINK'),array())),'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_SIZE_LISTE_LIMIT", $_POST["main_size_liste_limit"],'chaine',0,'',$conf->entity); - dolibarr_set_const($db, "MAIN_SIZE_SHORTLISTE_LIMIT", $_POST["main_size_shortliste_limit"],'chaine',0,'',$conf->entity); + dolibarr_set_const($db, "MAIN_SIZE_SHORTLIST_LIMIT", $_POST["main_size_shortliste_limit"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_DISABLE_JAVASCRIPT", $_POST["main_disable_javascript"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_BUTTON_HIDE_UNAUTHORIZED", $_POST["MAIN_BUTTON_HIDE_UNAUTHORIZED"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_START_WEEK", $_POST["MAIN_START_WEEK"],'chaine',0,'',$conf->entity); @@ -167,7 +172,7 @@ if ($action == 'edit') // Edit print ''; print ''; - // Multilangual GUI + // Multilingual GUI $var=!$var; print ''; - + // From $var=!$var; print ''; print ''; + // Default from type + $var=!$var; + $liste = array(); + $liste['user'] = $langs->trans('UserEmail'); + $liste['company'] = $langs->trans('CompanyEmail'); + + print ''; + + // Separator + $var=!$var; + print ''; + // From $var=!$var; print ''; @@ -539,13 +425,14 @@ if ($action == 'edit') print ''; print ''; - print '
'.$langs->trans("Capital").''; print $conf->global->MAIN_INFO_CAPITAL . '
'.$langs->trans("JuridicalStatus").''; print getFormeJuridiqueLabel($conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE); @@ -821,7 +823,8 @@ else if (! empty($conf->global->MAIN_INFO_SIREN)) { print $conf->global->MAIN_INFO_SIREN; - if ($mysoc->country_code == 'FR') print '   '.$langs->trans("Check").''; + $s = $mysoc->id_prof_url(1,$mysoc); + if ($s) print ' - '.$s; } else { print ' '; } @@ -836,6 +839,8 @@ else if (! empty($conf->global->MAIN_INFO_SIRET)) { print $conf->global->MAIN_INFO_SIRET; + $s = $mysoc->id_prof_url(2,$mysoc); + if ($s) print ' - '.$s; } else { print ' '; } @@ -850,6 +855,8 @@ else if (! empty($conf->global->MAIN_INFO_APE)) { print $conf->global->MAIN_INFO_APE; + $s = $mysoc->id_prof_url(3,$mysoc); + if ($s) print ' - '.$s; } else { print ' '; } @@ -864,6 +871,8 @@ else if (! empty($conf->global->MAIN_INFO_RCS)) { print $conf->global->MAIN_INFO_RCS; + $s = $mysoc->id_prof_url(4,$mysoc); + if ($s) print ' - '.$s; } else { print ' '; } @@ -878,6 +887,8 @@ else if (! empty($conf->global->MAIN_INFO_PROFID5)) { print $conf->global->MAIN_INFO_PROFID5; + $s = $mysoc->id_prof_url(5,$mysoc); + if ($s) print ' - '.$s; } else { print ' '; } @@ -892,13 +903,15 @@ else if (! empty($conf->global->MAIN_INFO_PROFID6)) { print $conf->global->MAIN_INFO_PROFID6; + $s = $mysoc->id_prof_url(6,$mysoc); + if ($s) print ' - '.$s; } else { print ' '; } print '
'.$langs->trans("VATIntra").''; @@ -907,9 +920,9 @@ else $s=''; $s.=$conf->global->MAIN_INFO_TVAINTRA; $s.=''; - if (empty($conf->global->MAIN_DISABLEVATCHECK)) + if (empty($conf->global->MAIN_DISABLEVATCHECK) && $mysoc->isInEEC()) { - $s.='   '; + $s.=' - '; if (! empty($conf->use_javascript_ajax)) { print "\n"; @@ -943,7 +956,7 @@ else print ''; /* - * Debut d'annee fiscale + * fiscal year beginning */ print '
'; print ''; @@ -960,7 +973,7 @@ else print "
"; /* - * Options fiscale + * tax options */ print '
'; print ''; diff --git a/htdocs/admin/compta.php b/htdocs/admin/compta.php index ab6a0052341..abe5663084b 100644 --- a/htdocs/admin/compta.php +++ b/htdocs/admin/compta.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2008 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2011-2013 Juanjo Menent - * Copyright (C) 2013-2015 Philippe Grand + * Copyright (C) 2013-2016 Philippe Grand * Copyright (C) 2014 Marcos García * * This program is free software; you can redistribute it and/or modify @@ -114,7 +114,7 @@ print ''; print '
'; -// Cas du parametre ACCOUNTING_MODE +// case of the parameter ACCOUNTING_MODE print ''; print ''; diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 353389c98a8..1b03c0a6d3e 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2015 Laurent Destailleur * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2010-2013 Juanjo Menent + * Copyright (C) 2010-2016 Juanjo Menent * Copyright (C) 2011-2015 Philippe Grand * Copyright (C) 2011 Remy Younes * Copyright (C) 2012-2015 Marcos García @@ -43,6 +43,7 @@ if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/acco $langs->load("errors"); $langs->load("admin"); +$langs->load("main"); $langs->load("companies"); $langs->load("resource"); $langs->load("holiday"); @@ -54,7 +55,10 @@ $confirm=GETPOST('confirm','alpha'); $id=GETPOST('id','int'); $rowid=GETPOST('rowid','alpha'); -if (!$user->admin) accessforbidden(); +$allowed=$user->admin; +if ($id == 7 && ! empty($user->rights->accounting->chartofaccount)) $allowed=1; // Tax page allowed to manager of chart account +if ($id == 10 && ! empty($user->rights->accounting->chartofaccount)) $allowed=1; // Vat page allowed to manager of chart account +if (! $allowed) accessforbidden(); $acts[0] = "activate"; $acts[1] = "disable"; @@ -73,6 +77,8 @@ $offset = $listlimit * $page ; $pageprev = $page - 1; $pagenext = $page + 1; +$search_country_id = GETPOST('search_country_id','int'); + // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array $hookmanager->initHooks(array('admin')); @@ -80,7 +86,7 @@ $hookmanager->initHooks(array('admin')); // Put here declaration of dictionaries properties // Sort order to show dictionary (0 is space). All other dictionaries (added by modules) will be at end of this. -$taborder=array(9,0,4,3,2,0,1,8,19,16,27,0,5,11,33,34,0,6,0,29,0,7,17,24,28,0,10,23,12,13,0,14,0,22,20,18,21,0,15,30,0,25,0,26,0,31,32,0); +$taborder=array(9,0,4,3,2,0,1,8,19,16,27,0,5,11,0,33,34,0,6,0,29,0,7,17,24,28,0,10,23,12,13,0,14,0,22,20,18,21,0,15,30,0,25,0,26,0,31,32,0); // Name of SQL tables of dictionaries $tabname=array(); @@ -114,7 +120,7 @@ $tabname[27]= MAIN_DB_PREFIX."c_stcomm"; $tabname[28]= MAIN_DB_PREFIX."c_holiday_types"; $tabname[29]= MAIN_DB_PREFIX."c_lead_status"; $tabname[30]= MAIN_DB_PREFIX."c_format_cards"; -$tabname[31]= MAIN_DB_PREFIX."accounting_system"; +//$tabname[31]= MAIN_DB_PREFIX."accounting_system"; $tabname[32]= MAIN_DB_PREFIX."c_accounting_category"; $tabname[33]= MAIN_DB_PREFIX."c_hrm_department"; $tabname[34]= MAIN_DB_PREFIX."c_hrm_function"; @@ -151,7 +157,7 @@ $tablib[27]= "DictionaryProspectStatus"; $tablib[28]= "DictionaryHolidayTypes"; $tablib[29]= "DictionaryOpportunityStatus"; $tablib[30]= "DictionaryFormatCards"; -$tablib[31]= "DictionaryAccountancysystem"; +//$tablib[31]= "DictionaryAccountancysystem"; $tablib[32]= "DictionaryAccountancyCategory"; $tablib[33]= "DictionaryDepartment"; $tablib[34]= "DictionaryFunction"; @@ -169,7 +175,7 @@ $tabsql[8] = "SELECT t.id as rowid, t.code as code, t.libelle, t.fk_country as $tabsql[9] = "SELECT c.code_iso as code, c.label, c.unicode, c.active FROM ".MAIN_DB_PREFIX."c_currencies AS c"; $tabsql[10]= "SELECT t.rowid, t.code, t.taux, t.localtax1_type, t.localtax1, t.localtax2_type, t.localtax2, c.label as country, c.code as country_code, t.fk_pays as country_id, t.recuperableonly, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c WHERE t.fk_pays=c.rowid"; $tabsql[11]= "SELECT t.rowid as rowid, t.element, t.source, t.code, t.libelle, t.position, t.active FROM ".MAIN_DB_PREFIX."c_type_contact AS t"; -$tabsql[12]= "SELECT c.rowid as rowid, c.code, c.libelle, c.libelle_facture, c.nbjour, c.fdm, c.decalage, c.active, c.sortorder FROM ".MAIN_DB_PREFIX.'c_payment_term AS c'; +$tabsql[12]= "SELECT c.rowid as rowid, c.code, c.libelle, c.libelle_facture, c.nbjour, c.type_cdr, c.decalage, c.active, c.sortorder FROM ".MAIN_DB_PREFIX.'c_payment_term AS c'; $tabsql[13]= "SELECT c.id as rowid, c.code, c.libelle, c.type, c.active, c.accountancy_code FROM ".MAIN_DB_PREFIX."c_paiement AS c"; $tabsql[14]= "SELECT e.rowid as rowid, e.code as code, e.libelle, e.price, e.organization, e.fk_pays as country_id, c.code as country_code, c.label as country, e.active FROM ".MAIN_DB_PREFIX."c_ecotaxe AS e, ".MAIN_DB_PREFIX."c_country as c WHERE e.fk_pays=c.rowid and c.active=1"; $tabsql[15]= "SELECT rowid as rowid, code, label as libelle, width, height, unit, active FROM ".MAIN_DB_PREFIX."c_paper_format"; @@ -188,7 +194,7 @@ $tabsql[27]= "SELECT id as rowid, code, libelle, active FROM ".MAIN_DB_PREF $tabsql[28]= "SELECT h.rowid as rowid, h.code, h.label, h.affect, h.delay, h.newbymonth, h.fk_country as country_id, c.code as country_code, c.label as country, h.active FROM ".MAIN_DB_PREFIX."c_holiday_types as h LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON h.fk_country=c.rowid"; $tabsql[29]= "SELECT rowid as rowid, code, label, percent, position, active FROM ".MAIN_DB_PREFIX."c_lead_status"; $tabsql[30]= "SELECT rowid, code, name, paper_size, orientation, metric, leftmargin, topmargin, nx, ny, spacex, spacey, width, height, font_size, custom_x, custom_y, active FROM ".MAIN_DB_PREFIX."c_format_cards"; -$tabsql[31]= "SELECT s.rowid as rowid, pcg_version, s.label, s.active FROM ".MAIN_DB_PREFIX."accounting_system as s"; +//$tabsql[31]= "SELECT s.rowid as rowid, pcg_version, s.label, s.active FROM ".MAIN_DB_PREFIX."accounting_system as s"; $tabsql[32]= "SELECT a.rowid as rowid, a.code as code, a.label, a.range_account, a.sens, a.category_type, a.formula, a.position as position, a.fk_country as country_id, c.code as country_code, c.label as country, a.active FROM ".MAIN_DB_PREFIX."c_accounting_category as a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_country=c.rowid and c.active=1"; $tabsql[33]= "SELECT rowid, pos, code, label, active FROM ".MAIN_DB_PREFIX."c_hrm_department"; $tabsql[34]= "SELECT rowid, pos, code, label, c_level, active FROM ".MAIN_DB_PREFIX."c_hrm_function"; @@ -225,7 +231,7 @@ $tabsqlsort[27]="code ASC"; $tabsqlsort[28]="country ASC, code ASC"; $tabsqlsort[29]="position ASC"; $tabsqlsort[30]="code ASC"; -$tabsqlsort[31]="pcg_version ASC"; +//$tabsqlsort[31]="pcg_version ASC"; $tabsqlsort[32]="position ASC"; $tabsqlsort[33]="code ASC"; $tabsqlsort[34]="code ASC"; @@ -243,7 +249,7 @@ $tabfield[8] = "code,libelle,country_id,country".(! empty($conf->global->SOCIETE $tabfield[9] = "code,label,unicode"; $tabfield[10]= "country_id,country,code,taux,recuperableonly,localtax1_type,localtax1,localtax2_type,localtax2,accountancy_code_sell,accountancy_code_buy,note"; $tabfield[11]= "element,source,code,libelle,position"; -$tabfield[12]= "code,libelle,libelle_facture,nbjour,fdm,decalage,sortorder"; +$tabfield[12]= "code,libelle,libelle_facture,nbjour,type_cdr,decalage,sortorder"; $tabfield[13]= "code,libelle,type,accountancy_code"; $tabfield[14]= "code,libelle,price,organization,country_id,country"; $tabfield[15]= "code,libelle,width,height,unit"; @@ -262,7 +268,7 @@ $tabfield[27]= "code,libelle"; $tabfield[28]= "code,label,affect,delay,newbymonth,country_id,country"; $tabfield[29]= "code,label,percent,position"; $tabfield[30]= "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y"; -$tabfield[31]= "pcg_version,label"; +//$tabfield[31]= "pcg_version,label"; $tabfield[32]= "code,label,range_account,sens,category_type,formula,position,country_id,country"; $tabfield[33]= "code,label"; $tabfield[34]= "code,label"; @@ -280,7 +286,7 @@ $tabfieldvalue[8] = "code,libelle,country".(! empty($conf->global->SOCIETE_SORT_ $tabfieldvalue[9] = "code,label,unicode"; $tabfieldvalue[10]= "country,code,taux,recuperableonly,localtax1_type,localtax1,localtax2_type,localtax2,accountancy_code_sell,accountancy_code_buy,note"; $tabfieldvalue[11]= "element,source,code,libelle,position"; -$tabfieldvalue[12]= "code,libelle,libelle_facture,nbjour,fdm,decalage,sortorder"; +$tabfieldvalue[12]= "code,libelle,libelle_facture,nbjour,type_cdr,decalage,sortorder"; $tabfieldvalue[13]= "code,libelle,type,accountancy_code"; $tabfieldvalue[14]= "code,libelle,price,organization,country"; $tabfieldvalue[15]= "code,libelle,width,height,unit"; @@ -299,7 +305,7 @@ $tabfieldvalue[27]= "code,libelle"; $tabfieldvalue[28]= "code,label,affect,delay,newbymonth,country"; $tabfieldvalue[29]= "code,label,percent,position"; $tabfieldvalue[30]= "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y"; -$tabfieldvalue[31]= "pcg_version,label"; +//$tabfieldvalue[31]= "pcg_version,label"; $tabfieldvalue[32]= "code,label,range_account,sens,category_type,formula,position,country"; $tabfieldvalue[33]= "code,label"; $tabfieldvalue[34]= "code,label"; @@ -317,7 +323,7 @@ $tabfieldinsert[8] = "code,libelle,fk_country".(! empty($conf->global->SOCIETE_S $tabfieldinsert[9] = "code_iso,label,unicode"; $tabfieldinsert[10]= "fk_pays,code,taux,recuperableonly,localtax1_type,localtax1,localtax2_type,localtax2,accountancy_code_sell,accountancy_code_buy,note"; $tabfieldinsert[11]= "element,source,code,libelle,position"; -$tabfieldinsert[12]= "code,libelle,libelle_facture,nbjour,fdm,decalage,sortorder"; +$tabfieldinsert[12]= "code,libelle,libelle_facture,nbjour,type_cdr,decalage,sortorder"; $tabfieldinsert[13]= "code,libelle,type,accountancy_code"; $tabfieldinsert[14]= "code,libelle,price,organization,fk_pays"; $tabfieldinsert[15]= "code,label,width,height,unit"; @@ -336,7 +342,7 @@ $tabfieldinsert[27]= "code,libelle"; $tabfieldinsert[28]= "code,label,affect,delay,newbymonth,fk_country"; $tabfieldinsert[29]= "code,label,percent,position"; $tabfieldinsert[30]= "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y"; -$tabfieldinsert[31]= "pcg_version,label"; +//$tabfieldinsert[31]= "pcg_version,label"; $tabfieldinsert[32]= "code,label,range_account,sens,category_type,formula,position,fk_country"; $tabfieldinsert[33]= "code,label"; $tabfieldinsert[34]= "code,label"; @@ -375,7 +381,7 @@ $tabrowid[27]= "id"; $tabrowid[28]= ""; $tabrowid[29]= ""; $tabrowid[30]= ""; -$tabrowid[31]= ""; +//$tabrowid[31]= ""; $tabrowid[32]= ""; $tabrowid[33]= "rowid"; $tabrowid[34]= "rowid"; @@ -412,7 +418,7 @@ $tabcond[27]= ! empty($conf->societe->enabled); $tabcond[28]= ! empty($conf->holiday->enabled); $tabcond[29]= ! empty($conf->projet->enabled); $tabcond[30]= ! empty($conf->label->enabled); -$tabcond[31]= ! empty($conf->accounting->enabled); +//$tabcond[31]= ! empty($conf->accounting->enabled); $tabcond[32]= ! empty($conf->accounting->enabled); $tabcond[33]= ! empty($conf->hrm->enabled); $tabcond[34]= ! empty($conf->hrm->enabled); @@ -430,7 +436,7 @@ $tabhelp[8] = array('code'=>$langs->trans("EnterAnyCode"), 'position'=>$langs-> $tabhelp[9] = array('code'=>$langs->trans("EnterAnyCode"), 'unicode'=>$langs->trans("UnicodeCurrency")); $tabhelp[10] = array('code'=>$langs->trans("EnterAnyCode"), 'taux'=>$langs->trans("SellTaxRate"), 'recuperableonly'=>$langs->trans("RecuperableOnly"), 'localtax1_type'=>$langs->trans("LocalTaxDesc"), 'localtax2_type'=>$langs->trans("LocalTaxDesc")); $tabhelp[11] = array('code'=>$langs->trans("EnterAnyCode"), 'position'=>$langs->trans("PositionIntoComboList")); -$tabhelp[12] = array('code'=>$langs->trans("EnterAnyCode")); +$tabhelp[12] = array('code'=>$langs->trans("EnterAnyCode"), 'type_cdr'=>$langs->trans("TypeCdr")); $tabhelp[13] = array('code'=>$langs->trans("EnterAnyCode")); $tabhelp[14] = array('code'=>$langs->trans("EnterAnyCode")); $tabhelp[15] = array('code'=>$langs->trans("EnterAnyCode")); @@ -449,7 +455,7 @@ $tabhelp[27] = array('code'=>$langs->trans("EnterAnyCode")); $tabhelp[28] = array('affect'=>$langs->trans("FollowedByACounter"),'delay'=>$langs->trans("MinimumNoticePeriod"), 'newbymonth'=>$langs->trans("NbAddedAutomatically")); $tabhelp[29] = array('code'=>$langs->trans("EnterAnyCode"), 'percent'=>$langs->trans("OpportunityPercent"), 'position'=>$langs->trans("PositionIntoComboList")); $tabhelp[30] = array('code'=>$langs->trans("EnterAnyCode"), 'name'=>$langs->trans("LabelName"), 'paper_size'=>$langs->trans("LabelPaperSize")); -$tabhelp[31] = array('pcg_version'=>$langs->trans("EnterAnyCode")); +//$tabhelp[31] = array('pcg_version'=>$langs->trans("EnterAnyCode")); $tabhelp[32] = array('code'=>$langs->trans("EnterAnyCode")); $tabhelp[33] = array('code'=>$langs->trans("EnterAnyCode")); $tabhelp[34] = array('code'=>$langs->trans("EnterAnyCode")); @@ -486,7 +492,7 @@ $tabfieldcheck[27] = array(); $tabfieldcheck[28] = array(); $tabfieldcheck[29] = array(); $tabfieldcheck[30] = array(); -$tabfieldcheck[31] = array(); +//$tabfieldcheck[31] = array(); $tabfieldcheck[32] = array(); $tabfieldcheck[33] = array(); $tabfieldcheck[34] = array(); @@ -577,10 +583,20 @@ if ($id == 10) } + +/* + * Actions + */ + +if (GETPOST('button_removefilter') || GETPOST('button_removefilter.x') || GETPOST('button_removefilter_x')) +{ + $search_country_id = ''; +} + // Actions add or modify an entry into a dictionary if (GETPOST('actionadd') || GETPOST('actionmodify')) { - $listfield=explode(',',$tabfield[$id]); + $listfield=explode(',', str_replace(' ', '',$tabfield[$id])); $listfieldinsert=explode(',',$tabfieldinsert[$id]); $listfieldmodify=explode(',',$tabfieldinsert[$id]); $listfieldvalue=explode(',',$tabfieldvalue[$id]); @@ -596,7 +612,9 @@ if (GETPOST('actionadd') || GETPOST('actionmodify')) if ($value == 'color' && empty($_POST['color'])) continue; if ($value == 'formula' && empty($_POST['formula'])) continue; if ((! isset($_POST[$value]) || $_POST[$value]=='') - && (! in_array($listfield[$f], array('decalage','module','accountancy_code','accountancy_code_sell','accountancy_code_buy'))) // Fields that are not mandatory + && (! in_array($listfield[$f], array('decalage','module','accountancy_code','accountancy_code_sell','accountancy_code_buy')) // Fields that are not mandatory + && (! ($id == 10 && $listfield[$f] == 'code')) // Code is mandatory fir table 10 + ) ) { $ok=0; @@ -657,8 +675,8 @@ if (GETPOST('actionadd') || GETPOST('actionmodify')) } // Clean some parameters - if (isset($_POST["localtax1"]) && empty($_POST["localtax1"])) $_POST["localtax1"]='0'; // If empty, we force to 0 - if (isset($_POST["localtax2"]) && empty($_POST["localtax2"])) $_POST["localtax2"]='0'; // If empty, we force to 0 + if (! empty($_POST["localtax1_type"]) && empty($_POST["localtax1"])) $_POST["localtax1"]='0'; // If empty, we force to 0 + if (! empty($_POST["localtax2_type"]) && empty($_POST["localtax2"])) $_POST["localtax2"]='0'; // If empty, we force to 0 if ($_POST["accountancy_code"] <= 0) $_POST["accountancy_code"]=''; // If empty, we force to null if ($_POST["accountancy_code_sell"] <= 0) $_POST["accountancy_code_sell"]=''; // If empty, we force to null if ($_POST["accountancy_code_buy"] <= 0) $_POST["accountancy_code_buy"]=''; // If empty, we force to null @@ -697,14 +715,14 @@ if (GETPOST('actionadd') || GETPOST('actionmodify')) $i=0; foreach ($listfieldinsert as $f => $value) { - if ($value == 'price' || preg_match('/^amount/i',$value) || preg_match('/^localtax/i',$value) || $value == 'taux') { + if ($value == 'price' || preg_match('/^amount/i',$value) || $value == 'taux') { $_POST[$listfieldvalue[$i]] = price2num($_POST[$listfieldvalue[$i]],'MU'); } else if ($value == 'entity') { $_POST[$listfieldvalue[$i]] = $conf->entity; } if ($i) $sql.=","; - if ($_POST[$listfieldvalue[$i]] == '') $sql.="null"; + if ($_POST[$listfieldvalue[$i]] == '' && ! ($listfieldvalue[$i] == 'code' && $id == 10)) $sql.="null"; // For vat, we want/accept code = '' else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'"; $i++; } @@ -745,7 +763,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify')) $i = 0; foreach ($listfieldmodify as $field) { - if ($field == 'price' || preg_match('/^amount/i',$field) || preg_match('/^localtax/i',$field) || $field == 'taux') { + if ($field == 'price' || preg_match('/^amount/i',$field) || $field == 'taux') { $_POST[$listfieldvalue[$i]] = price2num($_POST[$listfieldvalue[$i]],'MU'); } else if ($field == 'entity') { @@ -753,7 +771,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify')) } if ($i) $sql.=","; $sql.= $field."="; - if ($_POST[$listfieldvalue[$i]] == '') $sql.="null"; + if ($_POST[$listfieldvalue[$i]] == '' && ! ($listfieldvalue[$i] == 'code' && $id == 10)) $sql.="null"; // For vat, we want/accept code = '' else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'"; $i++; } @@ -894,7 +912,19 @@ if ($id) $titre.=' - '.$langs->trans($tablib[$id]); $linkback=''.$langs->trans("BackToDictionaryList").''; } -print load_fiche_titre($titre,$linkback,'title_setup'); +$titlepicto='title_setup'; +if ($id == 10 && GETPOST('from') == 'accountancy') +{ + $titre=$langs->trans("MenuVatAccounts"); + $titlepicto='title_accountancy'; +} +if ($id == 7 && GETPOST('from') == 'accountancy') +{ + $titre=$langs->trans("MenuTaxAccounts"); + $titlepicto='title_accountancy'; +} + +print load_fiche_titre($titre,$linkback,$titlepicto); if (empty($id)) { @@ -919,6 +949,13 @@ if ($id) // Complete requete recherche valeurs avec critere de tri $sql=$tabsql[$id]; + if ($search_country_id > 0) + { + if (preg_match('/ WHERE /',$sql)) $sql.= " AND "; + else $sql.=" WHERE "; + $sql.= " c.rowid = ".$search_country_id; + } + if ($sortfield) { // If sort order is "country", we use country_code instead @@ -944,6 +981,8 @@ if ($id) print '
'; print ''; + print ''; + print '
'.$langs->trans('OptionMode').''.$langs->trans('Description').'
'; // Form to add a new line @@ -968,12 +1007,12 @@ if ($id) if ($fieldlist[$field]=='taux') { if ($tabname[$id] != MAIN_DB_PREFIX."c_revenuestamp") $valuetoshow=$langs->trans("Rate"); else $valuetoshow=$langs->trans("Amount"); - $align='right'; + $align='center'; } if ($fieldlist[$field]=='localtax1_type') { $valuetoshow=$langs->trans("UseLocalTax")." 2"; $align="center"; $sortable=0; } - if ($fieldlist[$field]=='localtax1') { $valuetoshow=$langs->trans("Rate")." 2";} + if ($fieldlist[$field]=='localtax1') { $valuetoshow=$langs->trans("Rate")." 2"; $align="center"; } if ($fieldlist[$field]=='localtax2_type') { $valuetoshow=$langs->trans("UseLocalTax")." 3"; $align="center"; $sortable=0; } - if ($fieldlist[$field]=='localtax2') { $valuetoshow=$langs->trans("Rate")." 3";} + if ($fieldlist[$field]=='localtax2') { $valuetoshow=$langs->trans("Rate")." 3"; $align="center"; } if ($fieldlist[$field]=='organization') { $valuetoshow=$langs->trans("Organization"); } if ($fieldlist[$field]=='lang') { $valuetoshow=$langs->trans("Language"); } if ($fieldlist[$field]=='type') { @@ -993,7 +1032,7 @@ if ($id) } if ($fieldlist[$field]=='recuperableonly') { $valuetoshow=$langs->trans("NPR"); $align="center"; } if ($fieldlist[$field]=='nbjour') { $valuetoshow=$langs->trans("NbOfDays"); } - if ($fieldlist[$field]=='fdm') { $valuetoshow=$langs->trans("AtEndOfMonth"); } + if ($fieldlist[$field]=='type_cdr') { $valuetoshow=$langs->trans("AtEndOfMonth"); $align="center"; } if ($fieldlist[$field]=='decalage') { $valuetoshow=$langs->trans("Offset"); } if ($fieldlist[$field]=='width') { $valuetoshow=$langs->trans("Width"); } if ($fieldlist[$field]=='height') { $valuetoshow=$langs->trans("Height"); } @@ -1032,9 +1071,11 @@ if ($id) } if ($id == 4) print ''; - print ''; + print ''; + print ''; print ''; // Line to enter new values @@ -1046,7 +1087,7 @@ if ($id) { foreach ($fieldlist as $key=>$val) { - if (GETPOST($val)) + if (GETPOST($val) != '') $obj->$val=GETPOST($val); } } @@ -1056,7 +1097,7 @@ if ($id) $reshook=$hookmanager->executeHooks('createDictionaryFieldlist',$parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks $error=$hookmanager->error; $errors=$hookmanager->errors; - if ($id == 3) unset($fieldlist[2]); + if ($id == 3) unset($fieldlist[2]); // Remove field ??? if ??? if (empty($reshook)) { @@ -1085,7 +1126,7 @@ if ($id) require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; $formmail=new FormMail($db); $tmp=$formmail->getAvailableSubstitKey('form'); - print join(', ', $tmp); + print implode(', ', $tmp); print ''; } @@ -1099,11 +1140,9 @@ if ($id) print ''; // Keep   to have a line with enough height } - print ''; - - // List of available values in database + // List of available record in database dol_syslog("htdocs/admin/dict", LOG_DEBUG); $resql=$db->query($sql); if ($resql) @@ -1111,94 +1150,132 @@ if ($id) $num = $db->num_rows($resql); $i = 0; $var=true; + + $param = '&id='.$id; + if ($search_country_id > 0) $param.= '&search_country_id='.$search_country_id; + $paramwithsearch = $param; + if ($sortorder) $paramwithsearch.= '&sortorder='.$sortorder; + if ($sortfield) $paramwithsearch.= '&sortfield='.$sortfield; + if (GETPOST('from')) $paramwithsearch.= '&from='.GETPOST('from','alpha'); + + // There is several pages + if ($num > $listlimit) + { + print ''; + } + + // Title of lines + print ''; + foreach ($fieldlist as $field => $value) + { + // Determine le nom du champ par rapport aux noms possibles + // dans les dictionnaires de donnees + $showfield=1; // By defaut + $align="left"; + $sortable=1; + $valuetoshow=''; + /* + $tmparray=getLabelOfField($fieldlist[$field]); + $showfield=$tmp['showfield']; + $valuetoshow=$tmp['valuetoshow']; + $align=$tmp['align']; + $sortable=$tmp['sortable']; + */ + $valuetoshow=ucfirst($fieldlist[$field]); // By defaut + $valuetoshow=$langs->trans($valuetoshow); // try to translate + if ($fieldlist[$field]=='source') { $valuetoshow=$langs->trans("Contact"); } + if ($fieldlist[$field]=='price') { $valuetoshow=$langs->trans("PriceUHT"); } + if ($fieldlist[$field]=='taux') { + if ($tabname[$id] != MAIN_DB_PREFIX."c_revenuestamp") $valuetoshow=$langs->trans("Rate"); + else $valuetoshow=$langs->trans("Amount"); + $align='center'; + } + if ($fieldlist[$field]=='localtax1_type') { $valuetoshow=$langs->trans("UseLocalTax")." 2"; $align="center"; $sortable=0; } + if ($fieldlist[$field]=='localtax1') { $valuetoshow=$langs->trans("Rate")." 2"; $align="center"; $sortable=0; } + if ($fieldlist[$field]=='localtax2_type') { $valuetoshow=$langs->trans("UseLocalTax")." 3"; $align="center"; $sortable=0; } + if ($fieldlist[$field]=='localtax2') { $valuetoshow=$langs->trans("Rate")." 3"; $align="center"; $sortable=0; } + if ($fieldlist[$field]=='organization') { $valuetoshow=$langs->trans("Organization"); } + if ($fieldlist[$field]=='lang') { $valuetoshow=$langs->trans("Language"); } + if ($fieldlist[$field]=='type') { $valuetoshow=$langs->trans("Type"); } + if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); } + if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') + { + $valuetoshow=$langs->trans("Label"); + if ($id != 25) $valuetoshow.="*"; + } + if ($fieldlist[$field]=='libelle_facture') { $valuetoshow=$langs->trans("LabelOnDocuments")."*"; } + if ($fieldlist[$field]=='country') { $valuetoshow=$langs->trans("Country"); } + if ($fieldlist[$field]=='recuperableonly') { $valuetoshow=$langs->trans("NPR"); $align="center"; } + if ($fieldlist[$field]=='nbjour') { $valuetoshow=$langs->trans("NbOfDays"); } + if ($fieldlist[$field]=='type_cdr') { $valuetoshow=$langs->trans("AtEndOfMonth"); $align="center"; } + if ($fieldlist[$field]=='decalage') { $valuetoshow=$langs->trans("Offset"); } + if ($fieldlist[$field]=='width') { $valuetoshow=$langs->trans("Width"); } + if ($fieldlist[$field]=='height') { $valuetoshow=$langs->trans("Height"); } + if ($fieldlist[$field]=='unit') { $valuetoshow=$langs->trans("MeasuringUnit"); } + if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') { $showfield=0; } + if ($fieldlist[$field]=='accountancy_code'){ $valuetoshow=$langs->trans("AccountancyCode"); } + if ($fieldlist[$field]=='accountancy_code_sell'){ $valuetoshow=$langs->trans("AccountancyCodeSell"); $sortable=0; } + if ($fieldlist[$field]=='accountancy_code_buy'){ $valuetoshow=$langs->trans("AccountancyCodeBuy"); $sortable=0; } + if ($fieldlist[$field]=='fk_pcg_version') { $valuetoshow=$langs->trans("Pcg_version"); } + if ($fieldlist[$field]=='account_parent') { $valuetoshow=$langs->trans("Accountsparent"); } + if ($fieldlist[$field]=='pcg_type') { $valuetoshow=$langs->trans("Pcg_type"); } + if ($fieldlist[$field]=='pcg_subtype') { $valuetoshow=$langs->trans("Pcg_subtype"); } + if ($fieldlist[$field]=='sortorder') { $valuetoshow=$langs->trans("SortOrder"); } + if ($fieldlist[$field]=='short_label') { $valuetoshow=$langs->trans("ShortLabel"); } + if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); } + if ($fieldlist[$field]=='range_account') { $valuetoshow=$langs->trans("Range"); } + if ($fieldlist[$field]=='sens') { $valuetoshow=$langs->trans("Sens"); } + if ($fieldlist[$field]=='category_type') { $valuetoshow=$langs->trans("Calculated"); } + if ($fieldlist[$field]=='formula') { $valuetoshow=$langs->trans("Formula"); } + + // Affiche nom du champ + if ($showfield) + { + print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable?$fieldlist[$field]:''), ($page?'page='.$page.'&':''), $param, "align=".$align, $sortfield, $sortorder); + } + } + // Favorite - Only activated on country dictionary + if ($id == 4) print getTitleFieldOfList($langs->trans("Favorite"), 0, $_SERVER["PHP_SELF"], "favorite", ($page?'page='.$page.'&':''), $param, 'align="center"', $sortfield, $sortorder); + + print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page?'page='.$page.'&':''), $param, 'align="center"', $sortfield, $sortorder); + print getTitleFieldOfList(''); + print getTitleFieldOfList(''); + print ''; + + // Title line with search boxes + print ''; + foreach ($fieldlist as $field => $value) + { + $showfield=1; // By defaut + + if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') { $showfield=0; } + + if ($showfield) + { + if ($value == 'country') + { + print ''; + } + else + { + print ''; + } + } + } + if ($id == 4) print ''; + print ''; + print ''; + print ''; + if ($num) { - // There is several pages - if ($num > $listlimit) - { - print ''; - } - - // Title of lines - print ''; - foreach ($fieldlist as $field => $value) - { - // Determine le nom du champ par rapport aux noms possibles - // dans les dictionnaires de donnees - $showfield=1; // Par defaut - $align="left"; - $sortable=1; - $valuetoshow=''; - /* - $tmparray=getLabelOfField($fieldlist[$field]); - $showfield=$tmp['showfield']; - $valuetoshow=$tmp['valuetoshow']; - $align=$tmp['align']; - $sortable=$tmp['sortable']; - */ - $valuetoshow=ucfirst($fieldlist[$field]); // Par defaut - $valuetoshow=$langs->trans($valuetoshow); // try to translate - if ($fieldlist[$field]=='source') { $valuetoshow=$langs->trans("Contact"); } - if ($fieldlist[$field]=='price') { $valuetoshow=$langs->trans("PriceUHT"); } - if ($fieldlist[$field]=='taux') { - if ($tabname[$id] != MAIN_DB_PREFIX."c_revenuestamp") $valuetoshow=$langs->trans("Rate"); - else $valuetoshow=$langs->trans("Amount"); - $align='right'; - } - if ($fieldlist[$field]=='localtax1_type') { $valuetoshow=$langs->trans("UseLocalTax")." 2"; $align="center"; $sortable=0; } - if ($fieldlist[$field]=='localtax1') { $valuetoshow=$langs->trans("Rate")." 2"; $sortable=0; } - if ($fieldlist[$field]=='localtax2_type') { $valuetoshow=$langs->trans("UseLocalTax")." 3"; $align="center"; $sortable=0; } - if ($fieldlist[$field]=='localtax2') { $valuetoshow=$langs->trans("Rate")." 3"; $sortable=0; } - if ($fieldlist[$field]=='organization') { $valuetoshow=$langs->trans("Organization"); } - if ($fieldlist[$field]=='lang') { $valuetoshow=$langs->trans("Language"); } - if ($fieldlist[$field]=='type') { $valuetoshow=$langs->trans("Type"); } - if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); } - if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') - { - $valuetoshow=$langs->trans("Label"); - if ($id != 25) $valuetoshow.="*"; - } - if ($fieldlist[$field]=='libelle_facture') { $valuetoshow=$langs->trans("LabelOnDocuments")."*"; } - if ($fieldlist[$field]=='country') { $valuetoshow=$langs->trans("Country"); } - if ($fieldlist[$field]=='recuperableonly') { $valuetoshow=$langs->trans("NPR"); $align="center"; } - if ($fieldlist[$field]=='nbjour') { $valuetoshow=$langs->trans("NbOfDays"); } - if ($fieldlist[$field]=='fdm') { $valuetoshow=$langs->trans("AtEndOfMonth"); } - if ($fieldlist[$field]=='decalage') { $valuetoshow=$langs->trans("Offset"); } - if ($fieldlist[$field]=='width') { $valuetoshow=$langs->trans("Width"); } - if ($fieldlist[$field]=='height') { $valuetoshow=$langs->trans("Height"); } - if ($fieldlist[$field]=='unit') { $valuetoshow=$langs->trans("MeasuringUnit"); } - if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') { $showfield=0; } - if ($fieldlist[$field]=='accountancy_code'){ $valuetoshow=$langs->trans("AccountancyCode"); } - if ($fieldlist[$field]=='accountancy_code_sell'){ $valuetoshow=$langs->trans("AccountancyCodeSell"); $sortable=0; } - if ($fieldlist[$field]=='accountancy_code_buy'){ $valuetoshow=$langs->trans("AccountancyCodeBuy"); $sortable=0; } - if ($fieldlist[$field]=='fk_pcg_version') { $valuetoshow=$langs->trans("Pcg_version"); } - if ($fieldlist[$field]=='account_parent') { $valuetoshow=$langs->trans("Accountsparent"); } - if ($fieldlist[$field]=='pcg_type') { $valuetoshow=$langs->trans("Pcg_type"); } - if ($fieldlist[$field]=='pcg_subtype') { $valuetoshow=$langs->trans("Pcg_subtype"); } - if ($fieldlist[$field]=='sortorder') { $valuetoshow=$langs->trans("SortOrder"); } - if ($fieldlist[$field]=='short_label') { $valuetoshow=$langs->trans("ShortLabel"); } - if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); } - if ($fieldlist[$field]=='range_account') { $valuetoshow=$langs->trans("Range"); } - if ($fieldlist[$field]=='sens') { $valuetoshow=$langs->trans("Sens"); } - if ($fieldlist[$field]=='category_type') { $valuetoshow=$langs->trans("Calculated"); } - if ($fieldlist[$field]=='formula') { $valuetoshow=$langs->trans("Formula"); } - - // Affiche nom du champ - if ($showfield) - { - print getTitleFieldOfList($valuetoshow,0,$_SERVER["PHP_SELF"],($sortable?$fieldlist[$field]:''),($page?'page='.$page.'&':'').'&id='.$id,"","align=".$align,$sortfield,$sortorder); - } - } - // Favorite - Only activated on country dictionary - if ($id == 4) print getTitleFieldOfList($langs->trans("Favorite"),0,$_SERVER["PHP_SELF"],"favorite",($page?'page='.$page.'&':'').'&id='.$id,"",'align="center"',$sortfield,$sortorder); - - print getTitleFieldOfList($langs->trans("Status"),0,$_SERVER["PHP_SELF"],"active",($page?'page='.$page.'&':'').'&id='.$id,"",'align="center"',$sortfield,$sortorder); - print getTitleFieldOfList(''); - print getTitleFieldOfList(''); - print ''; - // Lines with values while ($i < $num) { @@ -1221,8 +1298,11 @@ if ($id) if (empty($reshook)) fieldList($fieldlist,$obj,$tabname[$id],'edit'); - print ''; + print ''; } else { @@ -1236,6 +1316,7 @@ if ($id) { foreach ($fieldlist as $field => $value) { + $showfield=1; $align="left"; $valuetoshow=$obj->{$fieldlist[$field]}; @@ -1265,10 +1346,16 @@ if ($id) $valuetoshow=($key != "Country".strtoupper($obj->country_code)?$obj->country_code." - ".$key:$obj->country); } } - else if ($fieldlist[$field]=='recuperableonly' || $fieldlist[$field]=='fdm' || $fieldlist[$field] == 'deductible' || $fieldlist[$field] == 'category_type') { + else if ($fieldlist[$field]=='recuperableonly' || $fieldlist[$field] == 'deductible' || $fieldlist[$field] == 'category_type') { $valuetoshow=yn($valuetoshow); $align="center"; } + else if ($fieldlist[$field]=='type_cdr') { + if(empty($valuetoshow)) $valuetoshow = $langs->trans('None'); + elseif($valuetoshow == 1) $valuetoshow = $langs->trans('AtEndOfMonth'); + elseif($valuetoshow == 2) $valuetoshow = $langs->trans('CurrentNext'); + $align="center"; + } else if ($fieldlist[$field]=='price' || preg_match('/^amount/i',$fieldlist[$field])) { $valuetoshow=price($valuetoshow); } @@ -1366,9 +1453,11 @@ if ($id) $key = $langs->trans('SizeUnit'.strtolower($obj->unit)); $valuetoshow = ($obj->code && $key != 'SizeUnit'.strtolower($obj->unit) ? $key : $obj->{$fieldlist[$field]}); } - + else if ($fieldlist[$field]=='localtax1' || $fieldlist[$field]=='localtax2') { + $align="center"; + } else if ($fieldlist[$field]=='localtax1_type') { - if ($obj->localtax1 != 0) + if ($obj->localtax1 != 0) $valuetoshow=$localtax_typeList[$valuetoshow]; else $valuetoshow = ''; @@ -1381,22 +1470,9 @@ if ($id) $valuetoshow = ''; $align="center"; } - else if ($fieldlist[$field]=='localtax1') { + else if ($fieldlist[$field]=='taux') { $valuetoshow = price($valuetoshow, 0, $langs, 0, 0); - if ($obj->localtax1 == 0) - $valuetoshow = ''; - $align="right"; - } - else if ($fieldlist[$field]=='localtax2') { - $valuetoshow = price($valuetoshow, 0, $langs, 0, 0); - if ($obj->localtax2 == 0) - $valuetoshow = ''; - $align="right"; - } - else if (in_array($fieldlist[$field],array('taux','localtax1','localtax2'))) - { - $valuetoshow = price($valuetoshow, 0, $langs, 0, 0); - $align="right"; + $align="center"; } else if (in_array($fieldlist[$field],array('recuperableonly'))) { @@ -1427,7 +1503,9 @@ if ($id) $canbemodified=$iserasable; if ($obj->code == 'RECEP') $canbemodified=1; - $url = $_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(! empty($obj->rowid)?$obj->rowid:(! empty($obj->code)?$obj->code:'')).'&code='.(! empty($obj->code)?urlencode($obj->code):'').'&id='.$id.'&'; + $url = $_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(! empty($obj->rowid)?$obj->rowid:(! empty($obj->code)?$obj->code:'')).'&code='.(! empty($obj->code)?urlencode($obj->code):''); + if ($param) $url .= '&'.$param; + $url.='&'; // Favorite // Only activated on country dictionary @@ -1456,7 +1534,13 @@ if ($id) else print ''; // Delete link - if ($iserasable) print ''; + if ($iserasable) + { + print ''; + } else print ''; print "\n"; @@ -1576,7 +1660,7 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='') } // For state page, we do not show the country input (we link to region, not country) print ''; } elseif ($fieldlist[$field] == 'country_id') @@ -1635,16 +1719,21 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='') print 'user'; print ''; } - elseif ($fieldlist[$field] == 'recuperableonly' || $fieldlist[$field] == 'fdm' || $fieldlist[$field] == 'deductible' || $fieldlist[$field] == 'category_type') { - print ''; } elseif (in_array($fieldlist[$field],array('nbjour','decalage','taux','localtax1','localtax2'))) { $align="left"; - if (in_array($fieldlist[$field],array('taux','localtax1','localtax2'))) $align="right"; // Fields aligned on right + if (in_array($fieldlist[$field],array('taux','localtax1','localtax2'))) $align="center"; // Fields aligned on right print ''; } elseif (in_array($fieldlist[$field], array('libelle_facture'))) { @@ -1698,7 +1787,7 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='') if (! empty($conf->accounting->enabled)) { $accountancy_account = (! empty($obj->$fieldlist[$field]) ? $obj->$fieldlist[$field] : 0); - print $formaccountancy->select_account($accountancy_account, $fieldlist[$field], 1, '', 1, 1); + print $formaccountancy->select_account($accountancy_account, $fieldlist[$field], 1, '', 1, 1, 'maxwidth200 maxwidthonsmartphone'); } else { @@ -1712,10 +1801,10 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='') $size=''; $class=''; if ($fieldlist[$field]=='code') $size='size="8" '; if ($fieldlist[$field]=='position') $size='size="4" '; - if ($fieldlist[$field]=='libelle') $size='centpercent'; - if ($fieldlist[$field]=='tracking') $class='centpercent'; + if ($fieldlist[$field]=='libelle') $class='quatrevingtpercent'; + if ($fieldlist[$field]=='tracking') $class='quatrevingtpercent'; if ($fieldlist[$field]=='sortorder' || $fieldlist[$field]=='sens' || $fieldlist[$field]=='category_type') $size='size="2" '; - print ''; + print ''; print ''; } } diff --git a/htdocs/admin/expensereport.php b/htdocs/admin/expensereport.php index 5c8fa9732e4..a26a21fbede 100644 --- a/htdocs/admin/expensereport.php +++ b/htdocs/admin/expensereport.php @@ -74,7 +74,9 @@ else if ($action == 'specimen') // For fiche inter $inter = new ExpenseReport($db); $inter->initAsSpecimen(); - + $inter->status = 0; // Force statut draft to show watermark + $inter->fk_statut = 0; // Force statut draft to show watermark + // Search template files $file=''; $classname=''; $filefound=0; $dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']); @@ -187,43 +189,31 @@ else if ($action == 'setmod') dolibarr_set_const($db, "EXPENSEREPORT_ADDON",$value,'chaine',0,'',$conf->entity); } -else if ($action == 'set_EXPENSEREPORT_FREE_TEXT') +else if ($action == 'setoptions') { + $db->begin(); + $freetext= GETPOST('EXPENSEREPORT_FREE_TEXT'); // No alpha here, we want exact string - $res = dolibarr_set_const($db, "EXPENSEREPORT_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity); - - if (! $res > 0) $error++; - - if (! $error) - { - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } - else - { - setEventMessages($langs->trans("Error"), null, 'errors'); - } -} - -else if ($action == 'set_EXPENSEREPORT_DRAFT_WATERMARK') -{ + $res1 = dolibarr_set_const($db, "EXPENSEREPORT_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity); + $draft= GETPOST('EXPENSEREPORT_DRAFT_WATERMARK','alpha'); - - $res = dolibarr_set_const($db, "EXPENSEREPORT_DRAFT_WATERMARK",trim($draft),'chaine',0,'',$conf->entity); - - if (! $res > 0) $error++; + $res2 = dolibarr_set_const($db, "EXPENSEREPORT_DRAFT_WATERMARK",trim($draft),'chaine',0,'',$conf->entity); + + if (! $res1 > 0 || ! $res2 > 0) $error++; if (! $error) { + $db->commit(); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { + $db->rollback(); setEventMessages($langs->trans("Error"), null, 'errors'); } } - /* * View */ @@ -346,7 +336,7 @@ print '
'; + print ''; print ''; print '
 
'; + print_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num > $listlimit), ''); + print '
'; + print $form->select_country($search_country_id, 'search_country_id', '', 28, 'maxwidth200 maxwidthonsmartphone'); + print ''; + $searchpitco=$form->showFilterAndCheckAddButtons(0); + print $searchpitco; + print '
'; - print_fleche_navigation($page, $_SERVER["PHP_SELF"], '&id='.$id, ($num > $listlimit), ''); - print '
 '; - print ' '; + print ''; + print '
'; + print ''; + print '
 '.img_delete().''; + if ($user->admin) print ''.img_delete().''; + //else print ''.img_delete().''; // Some dictionnary can be edited by other profile than admin + print ' 
'; $fieldname='country'; - print $form->select_country((! empty($obj->country_code)?$obj->country_code:(! empty($obj->country)?$obj->country:'')), $fieldname, '', 28, 'maxwidth300'); + print $form->select_country((! empty($obj->country_code)?$obj->country_code:(! empty($obj->country)?$obj->country:'')), $fieldname, '', 28, 'maxwidth200 maxwidthonsmartphone'); print ''; - print $form->selectyesno($fieldlist[$field],(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''),1); + elseif ($fieldlist[$field] == 'recuperableonly' || $fieldlist[$field] == 'type_cdr' || $fieldlist[$field] == 'deductible' || $fieldlist[$field] == 'category_type') { + if ($fieldlist[$field] == 'type_cdr') print ''; + else print ''; + if ($fieldlist[$field] == 'type_cdr') { + print $form->selectarray($fieldlist[$field], array(0=>$langs->trans('None'), 1=>$langs->trans('AtEndOfMonth'), 2=>$langs->trans('CurrentNext')), (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'')); + } else { + print $form->selectyesno($fieldlist[$field],(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''),1); + } print ''; - print ''; + print ''; print '

'; * Documents models for Interventions */ -print load_fiche_titre($langs->trans("TemplatePDFExpenseReports")); +print load_fiche_titre($langs->trans("TemplatePDFExpenseReports"), '', ''); // Defini tableau def des modeles $type='expensereport'; @@ -372,7 +362,6 @@ else dol_print_error($db); } - print ''; print ''; print ''; @@ -495,6 +484,58 @@ foreach ($dirmodels as $reldir) print '
'.$langs->trans("Name").'
'; + +print '
'; + + + +/* + * Other options + */ + +print '
'; +print ''; +print ''; + +print load_fiche_titre($langs->trans("OtherOptions"), '', ''); +print ''; +print ''; +print ''; +print ''; +print "\n"; +$var=true; + +$var=! $var; +print ''."\n"; + +//Use draft Watermark +$var=!$var; +print ''."\n"; + +print '
'.$langs->trans("Parameter").'
'; +print $langs->trans("FreeLegalTextOnExpenseReports").' ('.$langs->trans("AddCRIfTooLong").')
'; +$variablename='EXPENSEREPORT_FREE_TEXT'; +if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) +{ + print ''; +} +else +{ + include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; + $doleditor=new DolEditor($variablename, $conf->global->$variablename,'',80,'dolibarr_details'); + print $doleditor->Create(); +} +print '
'; +print $langs->trans("WatermarkOnDraftOrders").'
'; +print ''; +print '
'; + +print '
'; +print ''; +print '
'; + +print '
'; + dol_fiche_end(); diff --git a/htdocs/admin/expensereport_extrafields.php b/htdocs/admin/expensereport_extrafields.php new file mode 100644 index 00000000000..65e1592eff8 --- /dev/null +++ b/htdocs/admin/expensereport_extrafields.php @@ -0,0 +1,122 @@ + + * Copyright (C) 2003 Jean-Louis Bergamo + * Copyright (C) 2004-2013 Laurent Destailleur + * Copyright (C) 2012 Regis Houssin + * Copyright (C) 2012 Florian Henry + * Copyright (C) 2013 Philippe Grand + * + * 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 . + */ + +/** + * \file htdocs/admin/expensereport_extrafields.php + * \ingroup expensereport + * \brief Page to setup extra fields of expensereport + */ + +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/expensereport.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; + +if (!$user->admin) + accessforbidden(); + +$langs->load("admin"); +$langs->load("errors"); +$langs->load("trips"); +$langs->load('other'); + +$extrafields = new ExtraFields($db); +$form = new Form($db); + +// List of supported format +$tmptype2label=ExtraFields::$type2label; +$type2label=array(''); +foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val); + +$action=GETPOST('action', 'alpha'); +$attrname=GETPOST('attrname', 'alpha'); +$elementtype='expensereport'; //Must be the $table_element of the class that manage extrafield + +if (!$user->admin) accessforbidden(); + + +/* + * Actions + */ + +require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; + + + +/* + * View + */ + +$textobject=$langs->transnoentitiesnoconv("expensereports"); + +llxHeader('',$langs->trans("expensereportsSetup")); + +$linkback=''.$langs->trans("BackToModuleList").''; +print load_fiche_titre($langs->trans("ExpenseReportsSetup"),$linkback,'title_setup'); + +$head = expensereport_admin_prepare_head(); + +dol_fiche_head($head, 'attributes', $langs->trans("ExpenseReports"), 0, 'trip'); + +require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; + +dol_fiche_end(); + + +// Buttons +if ($action != 'create' && $action != 'edit') +{ + print '
'; + print "".$langs->trans("NewAttribute").""; + print "
"; +} + + +/* ************************************************************************** */ +/* */ +/* Creation of an optional field */ +/* */ +/* ************************************************************************** */ + +if ($action == 'create') +{ + print "
"; + print load_fiche_titre($langs->trans('NewAttribute')); + + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; +} + +/* ************************************************************************** */ +/* */ +/* Edition of an optional field */ +/* */ +/* ************************************************************************** */ +if ($action == 'edit' && ! empty($attrname)) +{ + print "
"; + print load_fiche_titre($langs->trans("FieldEdition", $attrname)); + + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; +} + +llxFooter(); + +$db->close(); diff --git a/htdocs/admin/facture.php b/htdocs/admin/facture.php index 3b7facc9dc8..b9c994fba28 100644 --- a/htdocs/admin/facture.php +++ b/htdocs/admin/facture.php @@ -262,23 +262,6 @@ if ($action == 'setforcedate') } } -if ($action == 'set_INVOICE_AUTO_FILLJS') -{ - $freetext = GETPOST('INVOICE_AUTO_FILLJS'); // No alpha here, we want exact string - - $res = dolibarr_set_const($db, "INVOICE_AUTO_FILLJS",$freetext,'chaine',0,'',$conf->entity); - - if (! $res > 0) $error++; - - if (! $error) - { - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } - else - { - setEventMessages($langs->trans("Error"), null, 'errors'); - } -} /* @@ -750,20 +733,6 @@ print '
'; -print $langs->trans("JSOnPaimentBill"); -print ''; -print $form->selectyesno("INVOICE_AUTO_FILLJS",$conf->global->INVOICE_AUTO_FILLJS,1); -print ''; -print ''; -print "
'; print ''; print "
'; +print $langs->trans("UseServicesDurationOnFichinter"); +print ''; +print 'global->FICHINTER_USE_SERVICE_DURATION?' checked':'') . '>'; +print ''; +print ''; +print '
 
'.$langs->trans("EnableMultilangInterface").''; print $form->selectyesno('main_multilangs',$conf->global->MAIN_MULTILANGS,1); @@ -181,7 +186,7 @@ if ($action == 'edit') // Edit show_theme(null,1); print '
'; - // Liste des zone de recherche permanantes supportees + // List of permanent supported search box if (! empty($searchform)) { print ''; @@ -220,7 +225,7 @@ if ($action == 'edit') // Edit // Max size of short lists on customer card $var=!$var; - print ''; + print ''; print ''; print ''; @@ -403,7 +408,7 @@ else // Show print ""; $var=!$var; - print ''; + print ''; print ''; print ""; diff --git a/htdocs/admin/ldap.php b/htdocs/admin/ldap.php index 92c4d20670b..5c1b0fcad11 100644 --- a/htdocs/admin/ldap.php +++ b/htdocs/admin/ldap.php @@ -237,7 +237,7 @@ else { print ''; } -print ''; +print ''; print '
'.$langs->trans("DefaultMaxSizeShortList").'
'.$langs->trans("DefaultMaxSizeShortList").' 
'.$langs->trans("DefaultMaxSizeShortList").'' . $conf->global->MAIN_SIZE_SHORTLISTE_LIMIT . '
'.$langs->trans("DefaultMaxSizeShortList").'' . $conf->global->MAIN_SIZE_SHORTLIST_LIMIT . ' 
secret
'.$langs->trans('Password').' (ex: secret)
'; diff --git a/htdocs/admin/ldap_users.php b/htdocs/admin/ldap_users.php index dbed44ca5d0..45043b8a52b 100644 --- a/htdocs/admin/ldap_users.php +++ b/htdocs/admin/ldap_users.php @@ -4,7 +4,7 @@ * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2005 Regis Houssin * Copyright (C) 2006-2011 Laurent Destailleur - * Copyright (C) 2011-2013 Juanjo Menent + * Copyright (C) 2011-2016 Juanjo Menent * * 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 @@ -437,7 +437,7 @@ if (function_exists("ldap_connect")) print "search: *
\n"; print "userDN: ".$conf->global->LDAP_USER_DN."
\n"; print "useridentifier: ".$conf->global->LDAP_KEY_USERS."
\n"; - print "required_fields: ".join(',',$required_fields)."
\n"; + print "required_fields: ".implode(',',$required_fields)."
\n"; print "=> ".count($liste)." records
\n"; print "\n
"; } diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index b507ac89a50..01f2736d718 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -77,153 +77,25 @@ if ($action == 'update' && empty($_POST["cancel"])) dolibarr_set_const($db, "MAIN_MAIL_EMAIL_FROM", GETPOST("MAIN_MAIL_EMAIL_FROM"), 'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_MAIL_ERRORS_TO", GETPOST("MAIN_MAIL_ERRORS_TO"), 'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_MAIL_AUTOCOPY_TO", GETPOST("MAIN_MAIL_AUTOCOPY_TO"),'chaine',0,'',$conf->entity); + dolibarr_set_const($db, 'MAIN_MAIL_DEFAULT_FROMTYPE',GETPOST('MAIN_MAIL_DEFAULT_FROMTYPE'),'chaine',0,'',$conf->entity); header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup"); exit; } -/* - * Add file in email form - */ -if (GETPOST('addfile') || GETPOST('addfilehtml')) -{ - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; +// Actions to send emails +$id=0; +$actiontypecode=''; +$trigger_name=''; +$paramname='id'; +$mode='emailfortest'; +$trackid=(($action == 'testhtml')?"testhtml":"test"); +include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; - // Set tmp user directory - $vardir=$conf->user->dir_output."/".$user->id; - $upload_dir = $vardir.'/temp'; - dol_add_file_process($upload_dir,0,0); +if ($action == 'presend' && GETPOST('trackid') == 'test') $action='test'; +if ($action == 'presend' && GETPOST('trackid') == 'testhtml') $action='testhtml'; - if ($_POST['addfile']) $action='test'; - if ($_POST['addfilehtml']) $action='testhtml'; -} - -/* - * Remove file in email form - */ -if (! empty($_POST['removedfile']) || ! empty($_POST['removedfilehtml'])) -{ - // Set tmp user directory - $vardir=$conf->user->dir_output."/".$user->id; - $upload_dir = $vardir.'/temp'; - - $keytodelete=isset($_POST['removedfile'])?$_POST['removedfile']:$_POST['removedfilehtml']; - $keytodelete--; - - $listofpaths=array(); - $listofnames=array(); - $listofmimes=array(); - if (! empty($_SESSION["listofpaths"])) $listofpaths=explode(';',$_SESSION["listofpaths"]); - if (! empty($_SESSION["listofnames"])) $listofnames=explode(';',$_SESSION["listofnames"]); - if (! empty($_SESSION["listofmimes"])) $listofmimes=explode(';',$_SESSION["listofmimes"]); - - if ($keytodelete >= 0) - { - $pathtodelete=$listofpaths[$keytodelete]; - $filetodelete=$listofnames[$keytodelete]; - $result = dol_delete_file($pathtodelete,1); - if ($result) - { - setEventMessages(array($langs->trans("FileWasRemoved"), $filetodelete), null, 'mesgs'); - - include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; - $formmail = new FormMail($db); - $formmail->remove_attached_files($keytodelete); - } - } - if ($_POST['removedfile'] || $action='send') $action='test'; - if ($_POST['removedfilehtml'] || $action='sendhtml') $action='testhtml'; -} - -/* - * Send mail - */ -if (($action == 'send' || $action == 'sendhtml') && ! GETPOST('addfile') && ! GETPOST('addfilehtml') && ! GETPOST('removedfile') && ! GETPOST('cancel')) -{ - $error=0; - - $email_from=''; - if (! empty($_POST["fromname"])) $email_from=$_POST["fromname"].' '; - if (! empty($_POST["frommail"])) $email_from.='<'.$_POST["frommail"].'>'; - - $errors_to = $_POST["errorstomail"]; - $sendto = $_POST["sendto"]; - $sendtocc = $_POST["sendtocc"]; - $sendtoccc = $_POST["sendtoccc"]; - $subject = $_POST['subject']; - $body = $_POST['message']; - $deliveryreceipt= $_POST["deliveryreceipt"]; - $trackid = GETPOST('trackid'); - - //Check if we have to decode HTML - if (!empty($conf->global->FCKEDITOR_ENABLE_MAILING) && dol_textishtml(dol_html_entity_decode($body, ENT_COMPAT | ENT_HTML401))) { - $body=dol_html_entity_decode($body, ENT_COMPAT | ENT_HTML401); - } - - // Create form object - include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; - $formmail = new FormMail($db); - - $attachedfiles=$formmail->get_attached_files(); - $filepath = $attachedfiles['paths']; - $filename = $attachedfiles['names']; - $mimetype = $attachedfiles['mimes']; - - if (empty($_POST["frommail"])) - { - setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("MailFrom")), null, 'errors'); - $action='test'; - $error++; - } - if (empty($sendto)) - { - setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("MailTo")), null, 'errors'); - $action='test'; - $error++; - } - if (! $error) - { - // Is the message in HTML? - $msgishtml=0; // Message is not HTML - if ($action == 'sendhtml') $msgishtml=1; // Force message to HTML - - // Pratique les substitutions sur le sujet et message - $subject=make_substitutions($subject,$substitutionarrayfortest); - $body=make_substitutions($body,$substitutionarrayfortest); - - require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; - $mailfile = new CMailFile( - $subject, - $sendto, - $email_from, - $body, - $filepath, - $mimetype, - $filename, - $sendtocc, - $sendtoccc, - $deliveryreceipt, - $msgishtml, - $errors_to, - '', - $trackid - ); - - $result=$mailfile->sendfile(); - - if ($result) - { - setEventMessages($langs->trans("MailSuccessfulySent",$mailfile->getValidAddress($email_from,2),$mailfile->getValidAddress($sendto,2)), null, 'mesgs'); - } - else - { - setEventMessages($langs->trans("ResultKo").'
'.$mailfile->error.' '.$result, null, 'errors'); - } - - $action=''; - } -} @@ -521,13 +393,27 @@ if ($action == 'edit') // Separator $var=!$var; print '
 
'.$langs->trans("MAIN_MAIL_EMAIL_FROM",ini_get('sendmail_from')?ini_get('sendmail_from'):$langs->transnoentities("Undefined")).'
'.$langs->trans('MAIN_MAIL_DEFAULT_FROMTYPE').''; + print $form->selectarray('MAIN_MAIL_DEFAULT_FROMTYPE',$liste,$conf->global->MAIN_MAIL_DEFAULT_FROMTYPE,0); + print '
 
'.$langs->trans("MAIN_MAIL_ERRORS_TO").'
'.$langs->trans("MAIN_MAIL_AUTOCOPY_TO").'
'; - print '
'; - print ''; - print '     '; - print ''; - print '
'; + print '
'; + + print '
'; + print ''; + print '     '; + print ''; + print '
'; print ''; } @@ -647,7 +534,22 @@ else if (! empty($conf->global->MAIN_MAIL_EMAIL_FROM) && ! isValidEmail($conf->global->MAIN_MAIL_EMAIL_FROM)) print img_warning($langs->trans("ErrorBadEMail")); print '
'.$langs->trans('MAIN_MAIL_DEFAULT_FROMTYPE').''; + if($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE === 'user'){ + print $langs->trans('UserEmail'); + } else { + print $langs->trans('CompanyEmail'); + } + print '
 
'.$langs->trans("MAIN_MAIL_ERRORS_TO").''.$conf->global->MAIN_MAIL_ERRORS_TO; @@ -669,6 +571,7 @@ else } print '
'; if ($conf->global->MAIN_MAIL_SENDMODE == 'mail' && empty($conf->global->MAIN_FIX_FOR_BUGGED_MTA)) @@ -688,6 +591,7 @@ else print info_admin($langs->trans("SendmailOptionMayHurtBuggedMTA")); } + // Boutons actions print '
'; @@ -747,7 +651,7 @@ else $formmail = new FormMail($db); $formmail->fromname = (isset($_POST['fromname'])?$_POST['fromname']:$conf->global->MAIN_MAIL_EMAIL_FROM); $formmail->frommail = (isset($_POST['frommail'])?$_POST['frommail']:$conf->global->MAIN_MAIL_EMAIL_FROM); - $formmail->trackid='test'; + $formmail->trackid=(($action == 'testhtml')?"testhtml":"test"); $formmail->withfromreadonly=0; $formmail->withsubstit=0; $formmail->withfrom=1; @@ -767,7 +671,7 @@ else // Tableau des substitutions $formmail->substit=$substitutionarrayfortest; // Tableau des parametres complementaires du post - $formmail->param["action"]=($action == 'testhtml'?"sendhtml":"send"); + $formmail->param["action"]="send"; $formmail->param["models"]="body"; $formmail->param["mailid"]=0; $formmail->param["returnurl"]=$_SERVER["PHP_SELF"]; @@ -778,7 +682,7 @@ else $formmail->clear_attached_files(); } - print $formmail->get_form(($action == 'testhtml'?'addfilehtml':'addfile'),($action == 'testhtml'?'removefilehtml':'removefile')); + print $formmail->get_form('addfile','removefile'); print '
'; } diff --git a/htdocs/admin/menus/edit.php b/htdocs/admin/menus/edit.php index 9209542a9c0..0a2669e960d 100644 --- a/htdocs/admin/menus/edit.php +++ b/htdocs/admin/menus/edit.php @@ -2,6 +2,7 @@ /* Copyright (C) 2007 Patrick Raguin * Copyright (C) 2007-2012 Laurent Destailleur * Copyright (C) 2009-2011 Regis Houssin + * Copyright (C) 2016 Meziane Sof * * 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 @@ -33,10 +34,14 @@ $langs->load('other'); if (! $user->admin) accessforbidden(); -$dirstandard = "/core/menus/standard"; -$dirsmartphone = "/core/menus/smartphone"; - -$dirmenu = array($dirstandard,$dirsmartphone); +$dirstandard = array(); +$dirsmartphone = array(); +$dirmenus=array_merge(array("/core/menus/"),(array) $conf->modules_parts['menus']); +foreach($dirmenus as $dirmenu) +{ + $dirstandard[]=$dirmenu.'standard'; + $dirsmartphone[]=$dirmenu.'smartphone'; +} $action=GETPOST('action'); @@ -62,6 +67,23 @@ if ($action == 'update') { if (! $_POST['cancel']) { + $leftmenu=''; $mainmenu=''; + if (! empty($_POST['menuIdParent']) && ! is_numeric($_POST['menuIdParent'])) + { + $tmp=explode('&',$_POST['menuIdParent']); + foreach($tmp as $s) + { + if (preg_match('/fk_mainmenu=/',$s)) + { + $mainmenu=preg_replace('/fk_mainmenu=/','',$s); + } + if (preg_match('/fk_leftmenu=/',$s)) + { + $leftmenu=preg_replace('/fk_leftmenu=/','',$s); + } + } + } + $menu = new Menubase($db); $result=$menu->fetch($_POST['menuId']); if ($result > 0) @@ -75,7 +97,18 @@ if ($action == 'update') $menu->perms=$_POST['perms']; $menu->target=$_POST['target']; $menu->user=$_POST['user']; - $menu->fk_menu=$_POST['fk_menu']; + if (is_numeric($_POST['menuIdParent'])) + { + $menu->fk_menu=$_POST['menuIdParent']; + } + else + { + if ($_POST['type'] == 'top') $menu->fk_menu=0; + else $menu->fk_menu=-1; + $menu->fk_mainmenu=$mainmenu; + $menu->fk_leftmenu=$leftmenu; + } + $result=$menu->update($user); if ($result > 0) { @@ -215,8 +248,8 @@ if ($action == 'confirm_delete' && $_POST["confirm"] == 'yes') { $this->db->begin(); - $sql = "DELETE FROM ".MAIN_DB_PREFIX."menu WHERE rowid = ".$_GET['menuId']; - $db->query($sql); + $sql = "DELETE FROM ".MAIN_DB_PREFIX."menu WHERE rowid = ".GETPOST('menuId', 'int'); + $result=$db->query($sql); if ($result == 0) { @@ -284,7 +317,7 @@ if ($action == 'create') $parent_rowid = $_GET['menuId']; if ($_GET['menuId']) { - $sql = "SELECT m.rowid, m.mainmenu, m.leftmenu, m.level, m.langs FROM ".MAIN_DB_PREFIX."menu as m WHERE m.rowid = ".$_GET['menuId']; + $sql = "SELECT m.rowid, m.mainmenu, m.leftmenu, m.level, m.langs FROM ".MAIN_DB_PREFIX."menu as m WHERE m.rowid = ".GETPOST('menuId', 'int'); $res = $db->query($sql); if ($res) { @@ -303,7 +336,7 @@ if ($action == 'create') // Handler print ''.$langs->trans('MenuHandler').''; print ''; - $formadmin->select_menu_families($menu_handler,'menu_handler',$dirmenu); + $formadmin->select_menu_families($menu_handler.(preg_match('/_menu/',$menu_handler)?'':'_menu'),'menu_handler',array_merge($dirstandard,$dirsmartphone)); print ''; print ''.$langs->trans('DetailMenuHandler').''; @@ -342,7 +375,7 @@ if ($action == 'create') } else { - print ''; + print ''; } print ''.$langs->trans('DetailMenuIdParent'); print ', '.$langs->trans("Example").': fk_mainmenu=abc&fk_leftmenu=def'; @@ -425,12 +458,15 @@ elseif ($action == 'edit') print ''.$langs->trans('Type').''.$langs->trans(ucfirst($menu->type)).''.$langs->trans('DetailType').''; // MenuId Parent - print ''.$langs->trans('MenuIdParent').''; + print ''.$langs->trans('MenuIdParent'); + print ''; $valtouse=$menu->fk_menu; if ($menu->fk_mainmenu) $valtouse='fk_mainmenu='.$menu->fk_mainmenu; if ($menu->fk_leftmenu) $valtouse.='&fk_leftmenu='.$menu->fk_leftmenu; - print ''; - print ''.$langs->trans('DetailMenuIdParent').''; + print ''; + print ''.$langs->trans('DetailMenuIdParent'); + print ', '.$langs->trans("Example").': fk_mainmenu=abc&fk_leftmenu=def'; + print ''; // Niveau //print ''.$langs->trans('Level').''.$menu->level.''.$langs->trans('DetailLevel').''; @@ -439,7 +475,7 @@ elseif ($action == 'edit') print ''.$langs->trans('Title').''.$langs->trans('DetailTitre').''; // Url - print ''.$langs->trans('URL').''.$langs->trans('DetailUrl').''; + print ''.$langs->trans('URL').''.$langs->trans('DetailUrl').''; // Langs print ''.$langs->trans('LangFile').''.$langs->trans('DetailLangs').''; diff --git a/htdocs/admin/menus/index.php b/htdocs/admin/menus/index.php index cba8d45c8f3..c8b7b469bd2 100644 --- a/htdocs/admin/menus/index.php +++ b/htdocs/admin/menus/index.php @@ -361,7 +361,7 @@ if ($conf->use_javascript_ajax) if (count($remainingdata)) { - print ''; + print '
'; print ''; print ''; diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 1151ef4abb9..5c1255a1c20 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -75,10 +75,28 @@ if ($search_version) $param.='&search_version='.urlencode($search_version); * Actions */ + +if (GETPOST('buttonreset')) +{ + $search_keyword=''; + $search_status=''; + $search_nature=''; + $search_version=''; +} + if ($action == 'set' && $user->admin) { - $result=activateModule($value); - if ($result) setEventMessages($result, null, 'errors'); + $resarray = activateModule($value); + if (! empty($resarray['errors'])) setEventMessages('', $resarray['errors'], 'errors'); + else + { + //var_dump($resarray);exit; + if ($resarray['nbperms'] > 0) + { + $msg = $langs->trans('ModuleEnabledAdminMustCheckRights'); + setEventMessages($msg, null, 'warnings'); + } + } header("Location: modules.php?mode=".$mode.$param.($page_y?'&page_y='.$page_y:'')); exit; } @@ -91,14 +109,6 @@ if ($action == 'reset' && $user->admin) exit; } -if (GETPOST('buttonreset')) -{ - $search_keyword=''; - $search_status=''; - $search_nature=''; - $search_version=''; -} - /* @@ -304,7 +314,7 @@ $h++; print "
\n"; -dol_fiche_head($head, $mode, $langs->trans("Modules")); +dol_fiche_head($head, $mode, ''); $var=true; @@ -353,7 +363,7 @@ if ($mode != 'marketplace') //print ''; } - print '


'; + print '



'; // Show list of modules @@ -443,11 +453,11 @@ if ($mode != 'marketplace') if ($familykey!=$oldfamily) { print ''."\n"; - print '\n"; - print ''."\n"; + print ''."\n"; print "\n"; $atleastoneforfamily=0; //print ""; @@ -494,8 +504,8 @@ if ($mode != 'marketplace') // Help print ''; // Version print '\n"; // Activate/Disable and Setup (2 columns) diff --git a/htdocs/admin/multicurrency.php b/htdocs/admin/multicurrency.php index 530f3bff5b7..2c9eba444b7 100644 --- a/htdocs/admin/multicurrency.php +++ b/htdocs/admin/multicurrency.php @@ -319,7 +319,7 @@ print ''; print ''; print ''; print ''; diff --git a/htdocs/admin/notification.php b/htdocs/admin/notification.php index e8ac153bea7..a3b3eb50df6 100644 --- a/htdocs/admin/notification.php +++ b/htdocs/admin/notification.php @@ -118,7 +118,11 @@ llxHeader('',$langs->trans("NotificationSetup")); $linkback=''.$langs->trans("BackToModuleList").''; print load_fiche_titre($langs->trans("NotificationSetup"),$linkback,'title_setup'); -print $langs->trans("NotificationsDesc").'

'; +print $langs->trans("NotificationsDesc").'
'; +print $langs->trans("NotificationsDescUser").'
'; +if (! empty($conf->societe->enabled)) print $langs->trans("NotificationsDescContact").'
'; +print $langs->trans("NotificationsDescGlobal").'
'; +print '
'; print ''; print ''; @@ -141,52 +145,53 @@ print ''; print ''; print '
'.$langs->trans("NotTopTreeMenuPersonalized").'
'; + print ''; $familytext=empty($familyinfo[$familykey]['label'])?$familykey:$familyinfo[$familykey]['label']; print $familytext; print "'.$langs->trans("SetupShort").''.$langs->trans("SetupShort").'
yy".$oldfamily."-".$familykey."-".$atleastoneforfamily."
'; $text=''; - if ($objMod->getDescLong()) $text.=$objMod->getDesc().'
'.$objMod->getDescLong().'
'; - else $text.=$objMod->getDesc().'
'; + if ($objMod->getDescLong()) $text.='
'.$objMod->getDesc().'

'.$objMod->getDescLong().'
'; + else $text.='
'.$objMod->getDesc().'

'; $textexternal=''; if ($objMod->isCoreOrExternalModule() == 'external') @@ -510,6 +520,11 @@ if ($mode != 'marketplace') { $text.='
'.$langs->trans("Origin").': '.$langs->trans("Core").'
'; } + $text.='
'.$langs->trans("LastActivationDate").': '; + if (! empty($conf->global->$const_name)) $text.=dol_print_date($objMod->getLastActivationDate(), 'dayhour'); + else $text.=$langs->trans("Disabled"); + $text.='
'; + $text.='
'.$langs->trans("AddRemoveTabs").': '; if (isset($objMod->tabs) && is_array($objMod->tabs) && count($objMod->tabs)) { @@ -605,7 +620,7 @@ if ($mode != 'marketplace') else $text.=$langs->trans("No"); $text.='
'.$langs->trans("AddMenus").': '; - if (isset($objMod->menu) && is_array($objMod->menu) && ! empty($objMod->menu)) + if (isset($objMod->menu) && ! empty($objMod->menu)) // objMod can be an array or just an int 1 { $text.=$langs->trans("Yes"); } @@ -640,22 +655,23 @@ if ($mode != 'marketplace') print $form->textwithpicto('', $text, 1, 'help', 'minheight20'); - // Picto warning - $version=$objMod->getVersion(0); - $versiontrans=$objMod->getVersion(1); - if (preg_match('/development/i', $version)) print img_warning($langs->trans("Development"), 'style="float: right"'); - if (preg_match('/experimental/i', $version)) print img_warning($langs->trans("Experimental"), 'style="float: right"'); - if (preg_match('/deprecated/i', $version)) print img_warning($langs->trans("Deprecated"), 'style="float: right"'); - - // Picto external - if ($textexternal) print img_picto($langs->trans("ExternalModule",$dirofmodule), 'external', 'style="float: right"'); - - print '
'; + + // Picto warning + $version=$objMod->getVersion(0); + $versiontrans=$objMod->getVersion(1); + if (preg_match('/development/i', $version)) print img_warning($langs->trans("Development"), 'style="float: left"'); + if (preg_match('/experimental/i', $version)) print img_warning($langs->trans("Experimental"), 'style="float: left"'); + if (preg_match('/deprecated/i', $version)) print img_warning($langs->trans("Deprecated"), 'style="float: left"'); + + // Picto external + if ($textexternal) print img_picto($langs->trans("ExternalModule",$dirofmodule), 'external', 'style="float: left"'); + print $versiontrans; + print "'.$form->selectCurrency('', 'code').' '; -print ' '; +print ' '; print ''; print '
'; -print '
'; +print '

'; -if ($conf->societe->enabled) +// Notification per contacts +$title=$langs->trans("ListOfNotificationsPerUser"); +if (! empty($conf->societe->enabled)) $title=$langs->trans("ListOfNotificationsPerUserOrContact"); +print load_fiche_titre($title,'',''); + +print ''; +print ''; +print ''; +/*print ''; + print '';*/ +//print ''; +print "\n"; + +// Load array of available notifications +$notificationtrigger=new InterfaceNotification($db); +$listofnotifiedevents=$notificationtrigger->getListOfManagedEvents(); + +print ''; +print ''; + +print '
'.$langs->trans("Label").''.$langs->trans("Code").''.$langs->trans("Label").''.$langs->trans("NbOfTargetedContacts").'
'; + +$var=true; +$i=0; +foreach($listofnotifiedevents as $notifiedevent) { - print load_fiche_titre($langs->trans("ListOfNotificationsPerContact"),'',''); + $var=!$var; + $label=$langs->trans("Notify_".$notifiedevent['code']); //!=$langs->trans("Notify_".$notifiedevent['code'])?$langs->trans("Notify_".$notifiedevent['code']):$notifiedevent['label']; - print ''; - print ''; - print ''; - print ''; - print ''; - //print ''; - print "\n"; + if ($notifiedevent['elementtype'] == 'order_supplier') $elementLabel = $langs->trans('SupplierOrder'); + elseif ($notifiedevent['elementtype'] == 'propal') $elementLabel = $langs->trans('Proposal'); + elseif ($notifiedevent['elementtype'] == 'facture') $elementLabel = $langs->trans('Bill'); + elseif ($notifiedevent['elementtype'] == 'commande') $elementLabel = $langs->trans('Order'); + elseif ($notifiedevent['elementtype'] == 'ficheinter') $elementLabel = $langs->trans('Intervention'); - // Load array of available notifications - $notificationtrigger=new InterfaceNotification($db); - $listofnotifiedevents=$notificationtrigger->getListOfManagedEvents(); - - $var=true; - foreach($listofnotifiedevents as $notifiedevent) - { - $var=!$var; - $label=$langs->trans("Notify_".$notifiedevent['code']); //!=$langs->trans("Notify_".$notifiedevent['code'])?$langs->trans("Notify_".$notifiedevent['code']):$notifiedevent['label']; - - if ($notifiedevent['elementtype'] == 'order_supplier') $elementLabel = $langs->trans('SupplierOrder'); - elseif ($notifiedevent['elementtype'] == 'propal') $elementLabel = $langs->trans('Proposal'); - elseif ($notifiedevent['elementtype'] == 'facture') $elementLabel = $langs->trans('Bill'); - elseif ($notifiedevent['elementtype'] == 'commande') $elementLabel = $langs->trans('Order'); - elseif ($notifiedevent['elementtype'] == 'ficheinter') $elementLabel = $langs->trans('Intervention'); - - print ''; - print ''; - print ''; - print ''; - /*print '';*/ - print ''; - } - - print '
'.$langs->trans("Module").''.$langs->trans("Code").''.$langs->trans("Label").''.$langs->trans("NbOfTargetedContacts").'
'.$elementLabel.''.$notifiedevent['code'].''.$label.''; - $tmparray = $notify->getNotificationsArray($notifiedevent['code'], 0); - print count($tmparray); - print '
'; - print '* '.$langs->trans("GoOntoContactCardToAddMore").'
'; - print '
'; + if ($i) print ', '; + print $label; + + $i++; } +print '
'; +print '* '.$langs->trans("GoOntoUserCardToAddMore").'
'; +if (! empty($conf->societe->enabled)) print '** '.$langs->trans("GoOntoContactCardToAddMore").'
'; +print '

'; print load_fiche_titre($langs->trans("ListOfFixedNotifications"),'',''); diff --git a/htdocs/admin/oauth.php b/htdocs/admin/oauth.php index 02a5ffc50e8..34aa49ea237 100644 --- a/htdocs/admin/oauth.php +++ b/htdocs/admin/oauth.php @@ -24,9 +24,8 @@ */ require '../main.inc.php'; - -// required Class require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/oauth.lib.php'; // Define $urlwithroot @@ -44,224 +43,6 @@ if (!$user->admin) $action = GETPOST('action', 'alpha'); -// Supported OAUTH (a provider is supported when a file xxx_oauthcallback.php is available into htdocs/core/modules/oauth) -$supportedoauth2array=array('OAUTH_GOOGLE_NAME'=>'google'); - -// API access parameters OAUTH -$list = array ( - array( - 'OAUTH_AMAZON_NAME', - 'OAUTH_AMAZON_ID', - 'OAUTH_AMAZON_SECRET', - ), - array( - 'OAUTH_BITBUCKET_NAME', - 'OAUTH_BITBUCKET_ID', - 'OAUTH_BITBUCKET_SECRET', - ), - array( - 'OAUTH_BITLY_NAME', - 'OAUTH_BITLY_ID', - 'OAUTH_BITLY_SECRET', - ), - array( - 'OAUTH_BITRIX24_NAME', - 'OAUTH_BITRIX24_ID', - 'OAUTH_BITRIX24_SECRET', - ), - array( - 'OAUTH_BOX_NAME', - 'OAUTH_BOX_ID', - 'OAUTH_BOX_SECRET', - ), - array( - 'OAUTH_BUFFER_NAME', - 'OAUTH_BUFFER_ID', - 'OAUTH_BUFFER_SECRET', - ), - array( - 'OAUTH_DAILYMOTION_NAME', - 'OAUTH_DAILYMOTION_ID', - 'OAUTH_DAILYMOTION_SECRET', - ), - array( - 'OAUTH_DEVIANTART_NAME', - 'OAUTH_DEVIANTART_ID', - 'OAUTH_DEVIANTART_SECRET', - ), - array( - 'OAUTH_DROPBOX_NAME', - 'OAUTH_DROPBOX_ID', - 'OAUTH_DROPBOX_SECRET', - ), - array( - 'OAUTH_ETSY_NAME', - 'OAUTH_ETSY_ID', - 'OAUTH_ETSY_SECRET', - ), - array( - 'OAUTH_EVEONLINE_NAME', - 'OAUTH_EVEONLINE_ID', - 'OAUTH_EVEONLINE_SECRET', - ), - array( - 'OAUTH_FACEBOOK_NAME', - 'OAUTH_FACEBOOK_ID', - 'OAUTH_FACEBOOK_SECRET', - ), - array( - 'OAUTH_FITBIT_NAME', - 'OAUTH_FITBIT_ID', - 'OAUTH_FITBIT_SECRET', - ), - array( - 'OAUTH_FIVEHUNDREDPX_NAME', - 'OAUTH_FIVEHUNDREDPX_ID', - 'OAUTH_FIVEHUNDREDPX_SECRET', - ), - array( - 'OAUTH_FLICKR_NAME', - 'OAUTH_FLICKR_ID', - 'OAUTH_FLICKR_SECRET', - ), - array( - 'OAUTH_FOURSQUARE_NAME', - 'OAUTH_FOURSQUARE_ID', - 'OAUTH_FOURSQUARE_SECRET', - ), - array( - 'OAUTH_GITHUB_NAME', - 'OAUTH_GITHUB_ID', - 'OAUTH_GITHUB_SECRET', - ), - array( - 'OAUTH_GOOGLE_NAME', - 'OAUTH_GOOGLE_ID', - 'OAUTH_GOOGLE_SECRET', - 'OAUTH_GOOGLE_DESC', - ), - array( - 'OAUTH_HUBIC_NAME', - 'OAUTH_HUBIC_ID', - 'OAUTH_HUBIC_SECRET', - ), - array( - 'OAUTH_INSTAGRAM_NAME', - 'OAUTH_INSTAGRAM_ID', - 'OAUTH_INSTAGRAM_SECRET', - ), - array( - 'OAUTH_LINKEDIN_NAME', - 'OAUTH_LINKEDIN_ID', - 'OAUTH_LINKEDIN_SECRET', - ), - array( - 'OAUTH_MAILCHIMP_NAME', - 'OAUTH_MAILCHIMP_ID', - 'OAUTH_MAILCHIMP_SECRET', - ), - array( - 'OAUTH_MICROSOFT_NAME', - 'OAUTH_MICROSOFT_ID', - 'OAUTH_MICROSOFT_SECRET', - ), - array( - 'OAUTH_NEST_NAME', - 'OAUTH_NEST_ID', - 'OAUTH_NEST_SECRET', - ), - array( - 'OAUTH_NETATMO_NAME', - 'OAUTH_NETATMO_ID', - 'OAUTH_NETATMO_SECRET', - ), - array( - 'OAUTH_PARROTFLOWERPOWER_NAME', - 'OAUTH_PARROTFLOWERPOWER_ID', - 'OAUTH_PARROTFLOWERPOWER_SECRET', - ), - array( - 'OAUTH_PAYPAL_NAME', - 'OAUTH_PAYPAL_ID', - 'OAUTH_PAYPAL_SECRET', - ), - array( - 'OAUTH_POCKET_NAME', - 'OAUTH_POCKET_ID', - 'OAUTH_POCKET_SECRET', - ), - array( - 'OAUTH_QUICKBOOKS_NAME', - 'OAUTH_QUICKBOOKS_ID', - 'OAUTH_QUICKBOOKS_SECRET', - ), - array( - 'OAUTH_REDDIT_NAME', - 'OAUTH_REDDIT_ID', - 'OAUTH_REDDIT_SECRET', - ), - array( - 'OAUTH_REDMINE_NAME', - 'OAUTH_REDMINE_ID', - 'OAUTH_REDMINE_SECRET', - ), - array( - 'OAUTH_RUNKEEPER_NAME', - 'OAUTH_RUNKEEPER_ID', - 'OAUTH_RUNKEEPER_SECRET', - ), - array( - 'OAUTH_SCOOPIT_NAME', - 'OAUTH_SCOOPIT_ID', - 'OAUTH_SCOOPIT_SECRET', - ), - array( - 'OAUTH_SOUNDCLOUD_NAME', - 'OAUTH_SOUNDCLOUD_ID', - 'OAUTH_SOUNDCLOUD_SECRET', - ), - array( - 'OAUTH_SPOTIFY_NAME', - 'OAUTH_SPOTIFY_ID', - 'OAUTH_SPOTIFY_SECRET', - ), - array( - 'OAUTH_STRAVA_NAME', - 'OAUTH_STRAVA_ID', - 'OAUTH_STRAVA_SECRET', - ), - array( - 'OAUTH_TUMBLR_NAME', - 'OAUTH_TUMBLR_ID', - 'OAUTH_TUMBLR_SECRET', - ), - array( - 'OAUTH_TWITTER_NAME', - 'OAUTH_TWITTER_ID', - 'OAUTH_TWITTER_SECRET', - ), - array( - 'OAUTH_USTREAM_NAME', - 'OAUTH_USTREAM_ID', - 'OAUTH_USTREAM_SECRET', - ), - array( - 'OAUTH_VIMEO_NAME', - 'OAUTH_VIMEO_ID', - 'OAUTH_VIMEO_SECRET', - ), - array( - 'OAUTH_YAHOO_NAME', - 'OAUTH_YAHOO_ID', - 'OAUTH_YAHOO_SECRET', - ), - array( - 'OAUTH_YAMMER_NAME', - 'OAUTH_YAMMER_ID', - 'OAUTH_YAMMER_SECRET', - ), -); - /* * Actions @@ -303,10 +84,9 @@ print ''; print ''; print ''; -/* - * Parameters - */ -dol_fiche_head(array(), '', '', 0, 'technic'); +$head = oauthadmin_prepare_head(); + +dol_fiche_head($head, 'services', '', 0, 'technic'); print $langs->trans("ListOfSupportedOauthProviders").'

'; @@ -314,14 +94,17 @@ print $langs->trans("ListOfSupportedOauthProviders").'

'; print ''; $var = true; +$i=0; foreach ($list as $key) { $supported=0; if (in_array($key[0], array_keys($supportedoauth2array))) $supported=1; if (! $supported) continue; // show only supported - - print ''; + + $i++; + + print ''; // Api Name $label = $langs->trans($key[0]); print ''; diff --git a/htdocs/admin/oauthlogintokens.php b/htdocs/admin/oauthlogintokens.php new file mode 100644 index 00000000000..b41ae78d4c7 --- /dev/null +++ b/htdocs/admin/oauthlogintokens.php @@ -0,0 +1,275 @@ + + * Copyright (C) 2014-2015 Frederic France + * + * 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 . + */ + +/** + * \file htdocs/admin/oauthlogintoken.php + * \ingroup oauth + * \brief Setup page to configure oauth access to login information + */ + +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/oauth.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; +use OAuth\Common\Storage\DoliStorage; + +$langs->load("admin"); +$langs->load("printing"); +$langs->load("oauth"); + +if (! $user->admin) accessforbidden(); + +$action = GETPOST('action','alpha'); +$mode = GETPOST('mode','alpha'); +$value = GETPOST('value','alpha'); +$varname = GETPOST('varname', 'alpha'); +$driver = GETPOST('driver', 'alpha'); + +if (! empty($driver)) $langs->load($driver); + +if (!$mode) $mode='setup'; + + +/* + * Action + */ + +/*if (($mode == 'test' || $mode == 'setup') && empty($driver)) +{ + setEventMessages($langs->trans('PleaseSelectaDriverfromList'), null); + header("Location: ".$_SERVER['PHP_SELF'].'?mode=config'); + exit; +}*/ + +if ($action == 'setconst' && $user->admin) +{ + $error=0; + $db->begin(); + foreach ($_POST['setupdriver'] as $setupconst) { + //print '
'.print_r($setupconst, true).'
'; + $result=dolibarr_set_const($db, $setupconst['varname'],$setupconst['value'],'chaine',0,'',$conf->entity); + if (! $result > 0) $error++; + } + + if (! $error) + { + $db->commit(); + setEventMessages($langs->trans("SetupSaved"), null); + } + else + { + $db->rollback(); + dol_print_error($db); + } + $action=''; +} + +if ($action == 'setvalue' && $user->admin) +{ + $db->begin(); + + $result=dolibarr_set_const($db, $varname, $value,'chaine',0,'',$conf->entity); + if (! $result > 0) $error++; + + if (! $error) + { + $db->commit(); + setEventMessages($langs->trans("SetupSaved"), null); + } + else + { + $db->rollback(); + dol_print_error($db); + } + $action = ''; +} + + +/* + * View + */ + +$form = new Form($db); + +llxHeader('',$langs->trans("PrintingSetup")); + +$linkback=''.$langs->trans("BackToModuleList").''; +print load_fiche_titre($langs->trans('ConfigOAuth'),$linkback,'title_setup'); + +$head=oauthadmin_prepare_head($mode); + +dol_fiche_head($head, 'tokengeneration', '', 0, 'technic'); + + +if ($mode == 'setup' && $user->admin) +{ + + print $langs->trans("OAuthSetupForLogin")."

\n"; + + foreach($list as $key) + { + $supported=0; + if (in_array($key[0], array_keys($supportedoauth2array))) $supported=1; + if (! $supported) continue; // show only supported + + print ''; + print ''; + print ''; + + + print '
'.$label.'
'."\n"; + $var=true; + print ''; + print ''; + print ''; + print ''; + print "\n"; + $submit_enabled=0; + + print ''; + print ''.$langs->trans($key['varname']).''; + print ''; + print ''; + print ''."\n"; + + // Show value of token + if ($key['varname'] == 'PRINTGCP_TOKEN_ACCESS') + { + // Token + print ''; + print ''; + print ''; + print ''; + print ''."\n"; + } + + print '
'.$langs->trans("Parameters").''.$langs->trans("Value").' 
'.$langs->trans($key['info']).''; + if ($key['varname'] == 'PRINTGCP_TOKEN_ACCESS') + { + // Delete remote tokens + if (! empty($key['delete'])) print ''.$langs->trans('DeleteAccess').'

'; + // Request remote token + print ''.$langs->trans('RequestAccess').'

'; + // Check remote access + print $langs->trans("ToCheckDeleteTokenOnProvider", $OAUTH_SERVICENAME_GOOGLE).': https://security.google.com/settings/security/permissions'; + } + print '
'.$langs->trans("Token").''; + // Dolibarr storage + $storage = new DoliStorage($db, $conf); + try + { + $tokenobj = $storage->retrieveAccessToken($OAUTH_SERVICENAME_GOOGLE); + } + catch(Exception $e) + { + // Return an error if token not found + } + if (is_object($tokenobj)) + { + //var_dump($tokenobj); + print $tokenobj->getAccessToken().'
'; + //print 'Refresh: '.$tokenobj->getRefreshToken().'
'; + //print 'EndOfLife: '.$tokenobj->getEndOfLife().'
'; + //var_dump($tokenobj->getExtraParams()); + /*print '
Extra:
';*/ + } + print '
'; + print '
'; + + if (! empty($driver)) + { + if ($submit_enabled) { + print '
'; + } + } + + print ''; + } + +} + +if ($mode == 'test' && $user->admin) +{ + print $langs->trans('PrintTestDesc'.$driver)."

\n"; + + print ''; + if (! empty($driver)) + { + require_once DOL_DOCUMENT_ROOT.'/core/modules/printing/'.$driver.'.modules.php'; + $classname = 'printing_'.$driver; + $langs->load($driver); + $printer = new $classname($db); + //print '
'.print_r($printer, true).'
'; + if (count($printer->getlist_available_printers())) { + if ($printer->listAvailablePrinters()==0) { + print $printer->resprint; + } else { + setEventMessages($printer->error, $printer->errors, 'errors'); + } + } + else { + print $langs->trans('PleaseConfigureDriverfromList'); + } + + } + + print '
'; + +} + +if ($mode == 'userconf' && $user->admin) +{ + print $langs->trans('PrintUserConfDesc'.$driver)."

\n"; + + print ''; + $var=true; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print "\n"; + $sql = 'SELECT p.rowid, p.printer_name, p.printer_location, p.printer_id, p.copy, p.module, p.driver, p.userid, u.login FROM '.MAIN_DB_PREFIX.'printing as p, '.MAIN_DB_PREFIX.'user as u WHERE p.userid=u.rowid'; + $resql = $db->query($sql); + while ($row=$db->fetch_array($resql)) { + $var=!$var; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print "\n"; + } + print '
'.$langs->trans("User").''.$langs->trans("PrintModule").''.$langs->trans("PrintDriver").''.$langs->trans("Printer").''.$langs->trans("PrinterLocation").''.$langs->trans("PrinterId").''.$langs->trans("NumberOfCopy").''.$langs->trans("Delete").'
'.$row['login'].''.$row['module'].''.$row['driver'].''.$row['printer_name'].''.$row['printer_location'].''.$row['printer_id'].''.$row['copy'].''.img_picto($langs->trans("Delete"), 'delete').'
'; +} + +dol_fiche_end(); + +llxFooter(); + +$db->close(); diff --git a/htdocs/admin/payment.php b/htdocs/admin/payment.php index fa99e2c202b..93f7c301519 100644 --- a/htdocs/admin/payment.php +++ b/htdocs/admin/payment.php @@ -69,6 +69,37 @@ if ($action == 'setmod') dolibarr_set_const($db, "PAYMENT_ADDON",$value,'chaine',0,'',$conf->entity); } +if ($action == 'setparams') +{ + $freetext = GETPOST('FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS'); // No alpha here, we want exact string + + $res = dolibarr_set_const($db, "FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS",$freetext,'chaine',0,'',$conf->entity); + + if (! $res > 0) $error++; + + if ($error) + { + setEventMessages($langs->trans("Error"), null, 'errors'); + } + + /* + $freetext = GETPOST('INVOICE_AUTO_FILLJS'); // No alpha here, we want exact string + + $res = dolibarr_set_const($db, "INVOICE_AUTO_FILLJS",$freetext,'chaine',0,'',$conf->entity); + + if (! $res > 0) $error++; + + if ($error) + { + setEventMessages($langs->trans("Error"), null, 'errors'); + }*/ + + if (! $error) + { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } + +} /* @@ -215,6 +246,49 @@ foreach ($dirmodels as $reldir) print ''; +print "
"; + +print load_fiche_titre($langs->trans("OtherOptions"),'',''); + +print '
'; +print ''; +print ''; + +print ''; +print ''; +print ''; +print ''; +print ''; +print "\n"; + +// Allow payments on different thirdparties bills but same parent company +$var=! $var; +print '\n"; + +// Add js auto fill amount on paiement form +/* always on now +$var=! $var; +print '\n"; +*/ + +print '
'.$langs->trans("Parameter").''.$langs->trans("Value").' 
'; +print $langs->trans("PaymentOnDifferentThirdBills"); +print ''; +print $form->selectyesno("FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS",$conf->global->FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS,1); +print ''; +print "
'; +print $langs->trans("JSOnPaimentBill"); +print ''; +print $form->selectyesno("INVOICE_AUTO_FILLJS",$conf->global->INVOICE_AUTO_FILLJS,1); +print ''; +print "
'; + +print '
'; +print ''; +print '
'; + +print '
'; + dol_fiche_end(); diff --git a/htdocs/admin/perms.php b/htdocs/admin/perms.php index 2e0ba0873bf..8ce7e046186 100644 --- a/htdocs/admin/perms.php +++ b/htdocs/admin/perms.php @@ -200,13 +200,13 @@ if ($result) { print img_picto($langs->trans("Active"),'tick'); print ''; - print ''.img_edit_remove().''; + print ''.img_edit_remove().''; } else { print ' '; print ''; - print ''.img_edit_add().''; + print ''.img_edit_add().''; } print ''; diff --git a/htdocs/admin/prelevement.php b/htdocs/admin/prelevement.php index 410851b640b..6d5c915dae2 100644 --- a/htdocs/admin/prelevement.php +++ b/htdocs/admin/prelevement.php @@ -36,6 +36,7 @@ $langs->load("withdrawals"); if (!$user->admin) accessforbidden(); $action = GETPOST('action','alpha'); +$type = 'paymentorder'; /* @@ -45,22 +46,14 @@ $action = GETPOST('action','alpha'); if ($action == "set") { $db->begin(); - for ($i = 0 ; $i < 2 ; $i++) - { - $res = dolibarr_set_const($db, GETPOST("nom$i",'alpha'), GETPOST("value$i",'alpha'),'chaine',0,'',$conf->entity); - if (! $res > 0) $error++; - } - - $res = dolibarr_set_const($db, "PRELEVEMENT_ICS", GETPOST("PRELEVEMENT_ICS"),'chaine',0,'',$conf->entity); - if (! $res > 0) $error++; $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); @@ -75,9 +68,19 @@ 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++; + $res = dolibarr_set_const($db, "PRELEVEMENT_ICS", GETPOST("PRELEVEMENT_ICS"),'chaine',0,'',$conf->entity); + if (! $res > 0) $error++; + + if (GETPOST("PRELEVEMENT_USER") > 0) + { + $res = dolibarr_set_const($db, "PRELEVEMENT_USER", GETPOST("PRELEVEMENT_USER"),'chaine',0,'',$conf->entity); + if (! $res > 0) $error++; + } + if (! $error) { $db->commit(); @@ -108,6 +111,71 @@ if ($action == "deletenotif") exit; } +/* +if ($action == 'specimen') +{ + $modele=GETPOST('module','alpha'); + + $commande = new Commande($db); + $commande->initAsSpecimen(); + + // Search template files + $file=''; $classname=''; $filefound=0; + $dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']); + foreach($dirmodels as $reldir) + { + $file=dol_buildpath($reldir."core/modules/paymentorders/doc/pdf_".$modele.".modules.php",0); + if (file_exists($file)) + { + $filefound=1; + $classname = "pdf_".$modele; + break; + } + } + + if ($filefound) + { + require_once $file; + + $module = new $classname($db); + + if ($module->write_file($commande,$langs) > 0) + { + header("Location: ".DOL_URL_ROOT."/document.php?modulepart=paymentorders&file=SPECIMEN.pdf"); + return; + } + else + { + setEventMessages($module->error, null, 'errors'); + dol_syslog($module->error, LOG_ERR); + } + } + else + { + setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); + dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); + } +} + +// Set default model +else if ($action == 'setdoc') +{ + if (dolibarr_set_const($db, "PAYMENTORDER_ADDON_PDF",$value,'chaine',0,'',$conf->entity)) + { + // The constant that was read before the new set + // We therefore requires a variable to have a coherent view + $conf->global->PAYMENTORDER_ADDON_PDF = $value; + } + + // On active le modele + $ret = delDocumentModel($value, $type); + if ($ret > 0) + { + $ret = addDocumentModel($value, $type, $label, $scandir); + } +} +*/ + /* * View @@ -115,6 +183,8 @@ if ($action == "deletenotif") $form=new Form($db); +$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']); + llxHeader('',$langs->trans("WithdrawalsSetup")); $linkback=''.$langs->trans("BackToModuleList").''; @@ -126,38 +196,31 @@ print '
'; print ''; print ''; + print ''; print ''; print ''; print ""; -//User -print ''; -print ''; -print ''; - -//Profid1 of Transmitter -print ''; -print ''; -print ''; - // Bank account (from Banks module) -print ''; +print ''; print ''; // ICS -print ''; +print ''; print ''; +print ''; print ''; +//User +print ''; +print ''; +print ''; + print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("ResponsibleUser").''; -print ''; -print $form->select_dolusers($conf->global->PRELEVEMENT_USER, 'value0', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300'); -print '
'.$langs->trans("NumeroNationalEmetter").' - '.$langs->transcountry('ProfId1',$mysoc->country_code).''; -print ''; -print '
'.$langs->trans("BankToReceiveWithdraw").'
'.$langs->trans("BankToReceiveWithdraw").''; $form->select_comptes($conf->global->PRELEVEMENT_ID_BANKACCOUNT,'PRELEVEMENT_ID_BANKACCOUNT',0,"courant=1",1); print '
'.$langs->trans("ICS").'
'.$langs->trans("ICS").''; -print '
'.$langs->trans("ResponsibleUser").''; +print $form->select_dolusers($conf->global->PRELEVEMENT_USER, 'PRELEVEMENT_USER', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300'); +print '
'; print '
'; @@ -165,6 +228,172 @@ print '
entity; +$resql=$db->query($sql); +if ($resql) +{ + $i = 0; + $num_rows=$db->num_rows($resql); + while ($i < $num_rows) + { + $array = $db->fetch_array($resql); + array_push($def, $array[0]); + $i++; + } +} +else +{ + dol_print_error($db); +} + + +print "\n"; +print "\n"; +print ''; +print ''; +print '\n"; +print '\n"; +print ''; +print ''; +print "\n"; + +clearstatcache(); + +$var=true; +foreach ($dirmodels as $reldir) +{ + foreach (array('','/doc') as $valdir) + { + $dir = dol_buildpath($reldir."core/modules/paymentorders".$valdir); + + if (is_dir($dir)) + { + $handle=opendir($dir); + if (is_resource($handle)) + { + while (($file = readdir($handle))!==false) + { + $filelist[]=$file; + } + closedir($handle); + arsort($filelist); + + foreach($filelist as $file) + { + if (preg_match('/\.modules\.php$/i',$file) && preg_match('/^(pdf_|doc_)/',$file)) + { + + if (file_exists($dir.'/'.$file)) + { + $name = substr($file, 4, dol_strlen($file) -16); + $classname = substr($file, 0, dol_strlen($file) -12); + + require_once $dir.'/'.$file; + $module = new $classname($db); + + $modulequalified=1; + if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0; + if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified=0; + + if ($modulequalified) + { + $var = !$var; + print ''; + + // Active + if (in_array($name, $def)) + { + print ''; + } + else + { + print '"; + } + + // Default + print ''; + + // Info + $htmltooltip = ''.$langs->trans("Name").': '.$module->name; + $htmltooltip.='
'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); + if ($module->type == 'pdf') + { + $htmltooltip.='
'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur; + } + $htmltooltip.='

'.$langs->trans("FeaturesSupported").':'; + $htmltooltip.='
'.$langs->trans("Logo").': '.yn($module->option_logo,1,1); + $htmltooltip.='
'.$langs->trans("PaymentMode").': '.yn($module->option_modereg,1,1); + $htmltooltip.='
'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg,1,1); + $htmltooltip.='
'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang,1,1); + //$htmltooltip.='
'.$langs->trans("Discounts").': '.yn($module->option_escompte,1,1); + //$htmltooltip.='
'.$langs->trans("CreditNote").': '.yn($module->option_credit_note,1,1); + $htmltooltip.='
'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark,1,1); + + + print ''; + + // Preview + print ''; + + print "\n"; + } + } + } + } + } + } + } +} + +*/ + + dol_fiche_end(); print '
'; diff --git a/htdocs/admin/propal.php b/htdocs/admin/propal.php index b4f1fe67e0b..57c5560a185 100644 --- a/htdocs/admin/propal.php +++ b/htdocs/admin/propal.php @@ -606,6 +606,7 @@ print '' print "\n"; print ''; +/* Seems to be not so used. So kept hidden for the moment to avoid dangerous options inflation. if ($conf->banque->enabled) { $var=!$var; @@ -634,6 +635,7 @@ else print ''; } +*/ print '
'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Status")."'.$langs->trans("Default")."'.$langs->trans("ShortInfo").''.$langs->trans("Preview").'
'; + print (empty($module->name)?$name:$module->name); + print "\n"; + if (method_exists($module,'info')) print $module->info($langs); + else print $module->description; + print ''."\n"; + print ''; + print img_picto($langs->trans("Enabled"),'switch_on'); + print ''; + print ''."\n"; + print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').''; + print "'; + if ($conf->global->PAYMENTORDER_ADDON_PDF == $name) + { + print img_picto($langs->trans("Default"),'on'); + } + else + { + print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').''; + } + print ''; + print $form->textwithpicto('',$htmltooltip,1,0); + print ''; + if ($module->type == 'pdf') + { + print ''.img_object($langs->trans("Preview"),'bill').''; + } + else + { + print img_object($langs->trans("PreviewNotAvailable"),'generic'); + } + print '
'; print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL").' '.$langs->trans('NotAvailable').'
'; diff --git a/htdocs/admin/resource.php b/htdocs/admin/resource.php new file mode 100644 index 00000000000..d8fdddd2bb5 --- /dev/null +++ b/htdocs/admin/resource.php @@ -0,0 +1,144 @@ + + * + * 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 . + * + */ + +/** + * \file htdocs/admin/resource.php + * \ingroup resource + * \brief Setup page to configure resource module + */ + +require '../main.inc.php'; + +// Class +require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/resource.lib.php'; +if (! empty($conf->resouce->enabled)) require_once DOL_DOCUMENT_ROOT . '/resource/class/html.formresource.class.php'; + +$langs->load("admin"); +$langs->load("resource"); + +// Security check +if (!$user->admin) + accessforbidden(); + +$action = GETPOST('action', 'alpha'); + + +/* + * Actions + */ + +if ($action == 'updateoptions') +{ + if (GETPOST('activate_RESOURCE_USE_SEARCH_TO_SELECT')) + { + if (dolibarr_set_const($db, "RESOURCE_USE_SEARCH_TO_SELECT", GETPOST('activate_RESOURCE_USE_SEARCH_TO_SELECT'), 'chaine', 0, '', $conf->entity)) + { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } else { + setEventMessages($langs->trans("Error"), null, 'errors'); + } + } +} + +/* + * View + */ + +llxHeader('',$langs->trans('ResourceSetup')); + +$form = new Form($db); + +$linkback=''.$langs->trans("BackToModuleList").''; +print load_fiche_titre($langs->trans('ResourceSetup'),$linkback,'title_setup'); + +$head=resource_admin_prepare_head(); + +dol_fiche_head($head, 'general', $langs->trans("ResourceSingular"), 0, 'action'); + +print '
'; +print ''; +print ''; + +$var=true; +print ''; +print ''; +print ''."\n"; +print ''."\n"; +print ''; + + +// Utilisation formulaire Ajax sur choix produit +$var=!$var; +print ''; +print ''; +if (empty($conf->use_javascript_ajax)) +{ + print ''; +} +else +{ + print ''; + print ''; +} +print ''; + +$var=!$var; +print ''; +print ''; +print ''; +print ''; +print ''; + +$var=!$var; +print ''; +print ''; +print ''; +print ''; +print ''; + +print '
'.$langs->trans("Parameters").''.$langs->trans("Value").'
'.$langs->trans("UseSearchToSelectResource").''; + print $langs->trans("NotAvailableWhenAjaxDisabled"); + print ''; + $arrval=array( + '0'=>$langs->trans("No"), + '1'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch",1).')', + '2'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch",2).')', + '3'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch",3).')', + ); + print $form->selectarray("activate_RESOURCE_USE_SEARCH_TO_SELECT",$arrval,$conf->global->RESOURCE_USE_SEARCH_TO_SELECT); + print ''; + print ''; + print '
'.$langs->trans('DisabledResourceLinkUser').''; +echo ajax_constantonoff('RESOURCE_HIDE_ADD_CONTACT_USER'); +print '
'.$langs->trans('DisabledResourceLinkContact').''; +echo ajax_constantonoff('RESOURCE_HIDE_ADD_CONTACT_THIPARTY'); +print '
'; + +print '
'; + + +//RESOURCE_HIDE_ADD_CONTACT_USER +//RESOURCE_HIDE_ADD_CONTACT_THIPARTY + +dol_fiche_end(); + + +llxFooter(); +$db->close(); diff --git a/htdocs/admin/resource_extrafields.php b/htdocs/admin/resource_extrafields.php new file mode 100644 index 00000000000..c3d90fac3e5 --- /dev/null +++ b/htdocs/admin/resource_extrafields.php @@ -0,0 +1,122 @@ + + * Copyright (C) 2003 Jean-Louis Bergamo + * Copyright (C) 2004-2013 Laurent Destailleur + * Copyright (C) 2012 Regis Houssin + * Copyright (C) 2016 Florian Henry + * + * 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 . + */ + +/** + * \file htdocs/admin/resource_extrafields.php + * \ingroup agenda + * \brief Page to setup extra fields of resource + */ + +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/resource.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; + + +if (!$user->admin) + accessforbidden(); + +$langs->load("admin"); +$langs->load("other"); +$langs->load("resource"); + +$extrafields = new ExtraFields($db); +$form = new Form($db); + +// List of supported format +$tmptype2label=ExtraFields::$type2label; +$type2label=array(''); +foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val); + +$action=GETPOST('action', 'alpha'); +$attrname=GETPOST('attrname', 'alpha'); +$elementtype='resource'; //Must be the $table_element of the class that manage extrafield + +if (!$user->admin) accessforbidden(); + + +/* + * Actions + */ + +require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; + + + +/* + * View + */ + +$textobject=$langs->transnoentitiesnoconv("ResourceSingular"); + +llxHeader('',$langs->trans("ResourceSetup")); + +$linkback=''.$langs->trans("BackToModuleList").''; +print load_fiche_titre($langs->trans("ResourceSetup"),$linkback,'title_setup'); +print "
\n"; + +$head=resource_admin_prepare_head(); + +dol_fiche_head($head, 'attributes', $langs->trans("ResourceSingular"), 0, 'action'); + +require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; + +dol_fiche_end(); + + +// Buttons +if ($action != 'create' && $action != 'edit') +{ + print '
'; + print "".$langs->trans("NewAttribute").""; + print "
"; +} + + +/* ************************************************************************** */ +/* */ +/* Creation of an optional field */ +/* */ +/* ************************************************************************** */ + +if ($action == 'create') +{ + print "
"; + print load_fiche_titre($langs->trans('NewAttribute')); + + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; +} + +/* ************************************************************************** */ +/* */ +/* Edition of an optional field */ +/* */ +/* ************************************************************************** */ +if ($action == 'edit' && ! empty($attrname)) +{ + print "
"; + print load_fiche_titre($langs->trans("FieldEdition", $attrname)); + + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; +} + +llxFooter(); + +$db->close(); diff --git a/htdocs/admin/security_file.php b/htdocs/admin/security_file.php index d3c421e31ec..f7a776c7249 100644 --- a/htdocs/admin/security_file.php +++ b/htdocs/admin/security_file.php @@ -176,7 +176,7 @@ if (ini_get('safe_mode') && ! empty($conf->global->MAIN_ANTIVIRUS_COMMAND)) dol_syslog("safe_mode is on, basedir is ".$basedir.", safe_mode_exec_dir is ".ini_get('safe_mode_exec_dir'), LOG_WARNING); } } -print ''; +print ''; print ""; print ''; @@ -187,7 +187,7 @@ print ''.$langs->trans("AntiVirusParam").'
'; print $langs->trans("AntiVirusParamExample"); print ''; print ''; -print ''; +print ''; print ""; print ''; diff --git a/htdocs/admin/stock.php b/htdocs/admin/stock.php index b78bf1ce0bd..4f556f417be 100644 --- a/htdocs/admin/stock.php +++ b/htdocs/admin/stock.php @@ -49,6 +49,13 @@ if($action) { $res = dolibarr_set_const($db, "STOCK_USERSTOCK_AUTOCREATE", GETPOST('STOCK_USERSTOCK_AUTOCREATE','alpha'),'chaine',0,'',$conf->entity); } + if ($action == 'STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE') { + $res = dolibarr_set_const($db, "STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE", GETPOST('STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE','alpha'),'chaine',0,'',$conf->entity); + } + if ($action == 'STOCK_ALLOW_NEGATIVE_TRANSFER') + { + $res = dolibarr_set_const($db, "STOCK_ALLOW_NEGATIVE_TRANSFER", GETPOST('STOCK_ALLOW_NEGATIVE_TRANSFER','alpha'),'chaine',0,'',$conf->entity); + } // Mode of stock decrease if ($action == 'STOCK_CALCULATE_ON_BILL' || $action == 'STOCK_CALCULATE_ON_VALIDATE_ORDER' @@ -69,12 +76,22 @@ if($action) || $action == 'STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER' || $action == 'STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER') { + //Use variable cause empty(GETPOST()) do not work with php version < 5.4 + $valdispatch=GETPOST('STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER','alpha'); + $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_BILL", '','chaine',0,'',$conf->entity); $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER", '','chaine',0,'',$conf->entity); $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER", '','chaine',0,'',$conf->entity); if ($action == 'STOCK_CALCULATE_ON_SUPPLIER_BILL') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_BILL", GETPOST('STOCK_CALCULATE_ON_SUPPLIER_BILL','alpha'),'chaine',0,'',$conf->entity); if ($action == 'STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER", GETPOST('STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER','alpha'),'chaine',0,'',$conf->entity); - if ($action == 'STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER", GETPOST('STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER','alpha'),'chaine',0,'',$conf->entity); + if ($action == 'STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER", $valdispatch,'chaine',0,'',$conf->entity); + if (empty($valdispatch)) { + $res=dolibarr_set_const($db, "SUPPLIER_ORDER_USE_DISPATCH_STATUS", '','chaine',0,'',$conf->entity); + } + } + + if($action == 'SUPPLIER_ORDER_USE_DISPATCH_STATUS') { + $res = dolibarr_set_const($db, "SUPPLIER_ORDER_USE_DISPATCH_STATUS", GETPOST('SUPPLIER_ORDER_USE_DISPATCH_STATUS','alpha'),'chaine',0,'',$conf->entity); } if($action == 'STOCK_USE_VIRTUAL_STOCK') { @@ -159,7 +176,7 @@ if (! empty($conf->facture->enabled)) } else { - print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module30Name")); + print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module30Name")); } print "\n\n"; $found++; @@ -179,7 +196,7 @@ if (! empty($conf->commande->enabled)) } else { - print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module25Name")); + print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module25Name")); } print "\n\n"; $found++; @@ -201,7 +218,7 @@ if (! empty($conf->expedition->enabled)) } else { - print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module80Name")); + print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module80Name")); } print "\n\n"; $found++; @@ -221,7 +238,7 @@ if (! empty($conf->expedition->enabled)) } else { - print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module80Name")); + print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module80Name")); } print "\n\n"; $found++; @@ -263,7 +280,7 @@ if (! empty($conf->fournisseur->enabled)) } else { - print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module40Name")); + print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module40Name")); } print "\n\n"; $found++; @@ -284,7 +301,7 @@ if (! empty($conf->fournisseur->enabled)) } else { - print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module40Name")); + print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module40Name")); } print "\n\n"; $found++; @@ -304,9 +321,30 @@ if (! empty($conf->fournisseur->enabled)) } else { - print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module40Name")); + print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module40Name")); } print "\n\n"; + +if (!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER)) { + $var=!$var; + print ""; + print ''.$langs->trans("UseDispatchStatus").''; + print ''; + if (! empty($conf->fournisseur->enabled)) + { + print "
"; + print ''; + print ""; + print $form->selectyesno("SUPPLIER_ORDER_USE_DISPATCH_STATUS",$conf->global->SUPPLIER_ORDER_USE_DISPATCH_STATUS,1,$disabled); + print ''; + print "
\n"; + } + else + { + print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module40Name")); + } + print "\n\n"; +} $found++; /*if (! $found) @@ -319,63 +357,73 @@ $found++; print ''; +print '
'; +print ''; +print ''; +print " \n"; +print " \n"; +print ''."\n"; + +$var=!$var; +print ""; +print ''; +print '\n"; +print "\n"; + // Option to force stock to be enough before adding a line into document -if ($conf->invoice->enabled || $conf->order->enabled || $conf->expedition->enabled) -{ - print '
'; - print '
".$langs->trans("RuleForStockAvailability")." 
'.$langs->trans("WarehouseAllowNegativeTransfer").''; +print "
"; +print ''; +print ""; +print $form->selectyesno("STOCK_ALLOW_NEGATIVE_TRANSFER",$conf->global->STOCK_ALLOW_NEGATIVE_TRANSFER,1); +print ''; +print '
'; +print "
'; - print ''; - print " \n"; - print " \n"; - print ''."\n"; - - if($conf->invoice->enabled) { - $var = !$var; - print ""; - print ''; - print '\n"; - print "\n"; - } - - if($conf->order->enabled) { - $var = !$var; - print ""; - print ''; - print '\n"; - print "\n"; - } - - if($conf->expedition->enabled) { - $var = !$var; - print ""; - print ''; - print '\n"; - print "\n"; - } - print '
".$langs->trans("RuleForStockAvailability")." 
'.$langs->trans("StockMustBeEnoughForInvoice").''; - print "
"; - print ''; - print ""; - print $form->selectyesno("STOCK_MUST_BE_ENOUGH_FOR_INVOICE",$conf->global->STOCK_MUST_BE_ENOUGH_FOR_INVOICE,1); - print ''; - print '
'; - print "
'.$langs->trans("StockMustBeEnoughForOrder").''; - print "
"; - print ''; - print ""; - print $form->selectyesno("STOCK_MUST_BE_ENOUGH_FOR_ORDER",$conf->global->STOCK_MUST_BE_ENOUGH_FOR_ORDER,1); - print ''; - print '
'; - print "
'.$langs->trans("StockMustBeEnoughForShipment").''; - print "
"; - print ''; - print ""; - print $form->selectyesno("STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT",$conf->global->STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT,1); - print ''; - print '
'; - print "
'; +if($conf->invoice->enabled) { + $var = !$var; + print ""; + print ''.$langs->trans("StockMustBeEnoughForInvoice").''; + print ''; + print "
"; + print ''; + print ""; + print $form->selectyesno("STOCK_MUST_BE_ENOUGH_FOR_INVOICE",$conf->global->STOCK_MUST_BE_ENOUGH_FOR_INVOICE,1); + print ''; + print '
'; + print "\n"; + print "\n"; } +if($conf->order->enabled) { + $var = !$var; + print ""; + print ''.$langs->trans("StockMustBeEnoughForOrder").''; + print ''; + print "
"; + print ''; + print ""; + print $form->selectyesno("STOCK_MUST_BE_ENOUGH_FOR_ORDER",$conf->global->STOCK_MUST_BE_ENOUGH_FOR_ORDER,1); + print ''; + print '
'; + print "\n"; + print "\n"; +} + +if($conf->expedition->enabled) { + $var = !$var; + print ""; + print ''.$langs->trans("StockMustBeEnoughForShipment").''; + print ''; + print "
"; + print ''; + print ""; + print $form->selectyesno("STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT",$conf->global->STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT,1); + print ''; + print '
'; + print "\n"; + print "\n"; +} +print ''; + $virtualdiffersfromphysical=0; if (! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT) || ! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER) @@ -427,17 +475,33 @@ print '' print ''; print "\n"; print "\n"; + +$var=!$var; + +print ""; +print ''.$langs->trans("AllowAddLimitStockByWarehouse").''; + +print ''; +print "
"; +print ''; +print ""; +print $form->selectyesno("STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE",$conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE,1); +print ''; +print '
'; +print "\n"; +print "\n"; + print '
'; /* I keep the option/feature, but hidden to end users for the moment. If feature is used by module, no need to have users see it. If not used by a module, I still need to understand in which case user may need this now we can set rule on product page. -if ($conf->global->PRODUIT_SOUSPRODUITS) +if ($conf->global->PRODUIT_SOUSPRODUITS) { $var=!$var; - + print ""; print ''.$langs->trans("IndependantSubProductStock").''; - + print ''; print "
"; print ''; diff --git a/htdocs/admin/supplier_invoice.php b/htdocs/admin/supplier_invoice.php index 6fa692f47fc..540cd4a4b98 100644 --- a/htdocs/admin/supplier_invoice.php +++ b/htdocs/admin/supplier_invoice.php @@ -136,19 +136,23 @@ else if ($action == 'del') // Set default model else if ($action == 'setdoc') { - if (dolibarr_set_const($db, "INVOICE_SUPPLIER_ADDON_PDF",$value,'chaine',0,'',$conf->entity)) - { - // La constante qui a ete lue en avant du nouveau set - // on passe donc par une variable pour avoir un affichage coherent - $conf->global->INVOICE_SUPPLIER_ADDON_PDF = $value; - } + if (dolibarr_set_const($db, "INVOICE_SUPPLIER_ADDON_PDF",$value,'chaine',0,'',$conf->entity)) + { + // La constante qui a ete lue en avant du nouveau set + // on passe donc par une variable pour avoir un affichage coherent + $conf->global->INVOICE_SUPPLIER_ADDON_PDF = $value; + } - // On active le modele - $ret = delDocumentModel($value, $type); - if ($ret > 0) - { - $ret = addDocumentModel($value, $type, $label, $scandir); - } + // On active le modele + $ret = delDocumentModel($value, $type); + if ($ret > 0) + { + $ret = addDocumentModel($value, $type, $label, $scandir); + } +} +else if ($action == 'unsetdoc') +{ + dolibarr_del_const($db, "INVOICE_SUPPLIER_ADDON_PDF", $conf->entity); } if ($action == 'setmod') @@ -366,7 +370,7 @@ foreach ($dirmodels as $reldir) { while (($file = readdir($handle))!==false) { - if (preg_match('/\.modules\.php$/i',$file) && preg_match('/^(pdf_|doc_)/',$file)) + if (preg_match('/\.modules\.php$/i',$file) && preg_match('/^(pdf_|doc_)/',$file)) { $name = substr($file, 4, dol_strlen($file) -16); $classname = substr($file, 0, dol_strlen($file) -12); @@ -383,7 +387,7 @@ foreach ($dirmodels as $reldir) require_once $dir.$file; $module = new $classname($db,$specimenthirdparty); if (method_exists($module,'info')) print $module->info($langs); - else print $module->description; + else print $module->description; print "\n"; @@ -391,16 +395,17 @@ foreach ($dirmodels as $reldir) if (in_array($name, $def)) { print ''."\n"; - if ($conf->global->INVOICE_SUPPLIER_ADDON_PDF != "$name") - { + //if ($conf->global->INVOICE_SUPPLIER_ADDON_PDF != "$name") + //{ + // Even if choice is the default value, we allow to disable it: For supplier invoice, we accept to have no doc generation at all print 'scandir.'&label='.urlencode($module->name).'&type=invoice_supplier">'; print img_picto($langs->trans("Enabled"),'switch_on'); print ''; - } + /*} else { print img_picto($langs->trans("Enabled"),'switch_on'); - } + }*/ print ""; } else @@ -414,7 +419,9 @@ foreach ($dirmodels as $reldir) print ''; if ($conf->global->INVOICE_SUPPLIER_ADDON_PDF == "$name") { - print img_picto($langs->trans("Default"),'on'); + //print img_picto($langs->trans("Default"),'on'); + // Even if choice is the default value, we allow to disable it: For supplier invoice, we accept to have no doc generation at all + print 'scandir.'&label='.urlencode($module->name).'&type=invoice_supplier"" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"),'on').''; } else { diff --git a/htdocs/admin/supplier_order.php b/htdocs/admin/supplier_order.php index 50eb9c9a322..5d0cf665d7c 100644 --- a/htdocs/admin/supplier_order.php +++ b/htdocs/admin/supplier_order.php @@ -169,11 +169,11 @@ else if ($action == 'addcat') else if ($action == 'set_SUPPLIER_ORDER_OTHER') { $freetext = GETPOST('SUPPLIER_ORDER_FREE_TEXT'); // No alpha here, we want exact string - $doubleapproval = GETPOST('SUPPLIER_ORDER_DOUBLE_APPROVAL','alpha'); + $doubleapproval = GETPOST('SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED','alpha'); $doubleapproval = price2num($doubleapproval ); $res1 = dolibarr_set_const($db, "SUPPLIER_ORDER_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity); - $res2 = dolibarr_set_const($db, "SUPPLIER_ORDER_DOUBLE_APPROVAL",$doubleapproval,'chaine',0,'',$conf->entity); + $res2 = dolibarr_set_const($db, "SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED",$doubleapproval,'chaine',0,'',$conf->entity); // TODO We add/delete permission here until permission can have a condition on a global var include_once DOL_DOCUMENT_ROOT.'/core/modules/modFournisseur.class.php'; @@ -189,7 +189,7 @@ else if ($action == 'set_SUPPLIER_ORDER_OTHER') $newmodule->rights[$r][4] = 'commande'; $newmodule->rights[$r][5] = 'approve2'; - if ($conf->global->SUPPLIER_ORDER_DOUBLE_APPROVAL) + if ($conf->global->SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED) { $newmodule->insert_permissions(1); } @@ -199,6 +199,23 @@ else if ($action == 'set_SUPPLIER_ORDER_OTHER') } } +// Activate ask for payment bank +else if ($action == 'set_BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_ORDER') +{ + $res = dolibarr_set_const($db, "BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_ORDER",$value,'chaine',0,'',$conf->entity); + + if (! $res > 0) $error++; + + if (! $error) + { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } + else + { + setEventMessages($langs->trans("Error"), null, 'errors'); + } +} + /* * View @@ -474,18 +491,50 @@ print ''.$langs->trans("Value").''; print ' '; print "\n"; $var=false; -if ($conf->global->MAIN_FEATURES_LEVEL > 0) -{ +//if ($conf->global->MAIN_FEATURES_LEVEL > 0) +//{ print ''; - print $langs->trans("UseDoubleApproval").'
'; + print $form->textwithpicto($langs->trans("UseDoubleApproval"), $langs->trans("Use3StepsApproval"), 1, 'help').'
'; print $langs->trans("IfSetToYesDontForgetPermission"); print ''; - print ''; + print ''; print ''; print ''; print "\n"; $var=!$var; +//} + +// Ask for payment bank during supplier order +/* Kept as hidden for the moment +if ($conf->banque->enabled) +{ + $var=!$var; + print ''; + print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_ORDER").' '; + if (! empty($conf->use_javascript_ajax)) + { + print ajax_constantonoff('BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_ORDER'); + } + else + { + if (empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_ORDER)) + { + print ''.img_picto($langs->trans("Disabled"),'switch_off').''; + } + else + { + print ''.img_picto($langs->trans("Enabled"),'switch_on').''; + } + } + print ''; } +else +{ + $var=!$var; + print ''; + print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_ORDER").' '.$langs->trans('NotAvailable').''; +} +*/ print ''; print $langs->trans("FreeLegalTextOnOrders").' ('.$langs->trans("AddCRIfTooLong").')
'; diff --git a/htdocs/admin/supplier_payment.php b/htdocs/admin/supplier_payment.php index bc960c7bd2c..b5732d1f1c9 100644 --- a/htdocs/admin/supplier_payment.php +++ b/htdocs/admin/supplier_payment.php @@ -94,7 +94,7 @@ dol_fiche_head($head, 'supplierpayment', $langs->trans("Suppliers"), 0, 'company if (empty($conf->global->SUPPLIER_PAYMENT_ADDON)) $conf->global->SUPPLIER_PAYMENT_ADDON = 'mod_supplier_payment_bronan'; -print load_fiche_titre($langs->trans("PaymentsNumberingModule")); +print load_fiche_titre($langs->trans("PaymentsNumberingModule"), '', ''); print ''; print ''; diff --git a/htdocs/admin/syslog.php b/htdocs/admin/syslog.php index f3cfcff9807..ae32c073349 100644 --- a/htdocs/admin/syslog.php +++ b/htdocs/admin/syslog.php @@ -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); } } diff --git a/htdocs/admin/system/about.php b/htdocs/admin/system/about.php index 3b2492fad65..a558a473957 100644 --- a/htdocs/admin/system/about.php +++ b/htdocs/admin/system/about.php @@ -100,8 +100,8 @@ print ''; print $langs->trans("Developpers").':'; print ''; //print "
\n"; @@ -110,7 +110,7 @@ print $langs->trans("OtherInformations").':'; print ''; print $langs->trans("Demo").':'; print ''; print $langs->trans("ModulesMarketPlaces").':'; print ''; @@ -178,14 +178,14 @@ print ''; print $langs->trans("Foundation").':'; print '
    '; -$url='http://wiki.dolibarr.org/index.php/Subscribe'; -if (preg_match('/^fr_/i',$langs->getDefaultLang())) $url='http://wiki.dolibarr.org/index.php/Adh%C3%A9rer'; -if (preg_match('/^es_/i',$langs->getDefaultLang())) $url='http://wiki.dolibarr.org/index.php/Subscribirse'; +$url='https://wiki.dolibarr.org/index.php/Subscribe'; +if (preg_match('/^fr_/i',$langs->getDefaultLang())) $url='https://wiki.dolibarr.org/index.php/Adh%C3%A9rer'; +if (preg_match('/^es_/i',$langs->getDefaultLang())) $url='https://wiki.dolibarr.org/index.php/Subscribirse'; print '
  • '.$langs->trans("SubscribeToFoundation").'
  • '; -print '
  • FaceBook
  • '; -print '
  • Twitter
  • '; -print '
  • Google Plus page
  • '; +print '
  • FaceBook
  • '; +print '
  • Twitter
  • '; +print '
  • Google Plus page
  • '; print '
'; @@ -193,13 +193,13 @@ print ''; print $langs->trans("OtherResources").':'; print '
    '; -$url='http://saas.dolibarr.org'; $title=$langs->trans("OfficialWebHostingService"); -if (preg_match('/^fr_/i',$langs->getDefaultLang())) $url='http://wiki.dolibarr.org/index.php/Solutions_de_Cloud'; -if (preg_match('/^es_/i',$langs->getDefaultLang())) $url='http://wiki.dolibarr.org/index.php/Soluciones_en_la_Nube'; +$url='https://saas.dolibarr.org'; $title=$langs->trans("OfficialWebHostingService"); +if (preg_match('/^fr_/i',$langs->getDefaultLang())) $url='https://wiki.dolibarr.org/index.php/Solutions_de_Cloud'; +if (preg_match('/^es_/i',$langs->getDefaultLang())) $url='https://wiki.dolibarr.org/index.php/Soluciones_en_la_Nube'; print '
  • '; print ''.$title.''; print '
  • '; -$url='http://partners.dolibarr.org'; $title=$langs->trans("ReferencedPreferredPartners"); +$url='https://partners.dolibarr.org'; $title=$langs->trans("ReferencedPreferredPartners"); print '
  • '; print ''.$title.''; print '
  • '; diff --git a/htdocs/admin/system/filecheck.php b/htdocs/admin/system/filecheck.php index 48eddfec155..5bea1b521ac 100644 --- a/htdocs/admin/system/filecheck.php +++ b/htdocs/admin/system/filecheck.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2005-2016 Laurent Destailleur * Copyright (C) 2007 Rodolphe Quiedeville * Copyright (C) 2007-2012 Regis Houssin * Copyright (C) 2015 Frederic France @@ -25,6 +25,7 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php'; $langs->load("admin"); @@ -42,6 +43,8 @@ llxHeader(); print load_fiche_titre($langs->trans("FileCheckDolibarr"),'','title_setup'); +print $langs->trans("FileCheckDesc").'

    '; + // Version $var = true; print '
'; @@ -72,91 +75,142 @@ $file_list = array('missing' => array(), 'updated' => array()); // File to analyze //$xmlfile = DOL_DOCUMENT_ROOT.'/install/filelist-'.DOL_VERSION.'.xml'; -$xmlfile = DOL_DOCUMENT_ROOT.'/install/filelist.xml'; +$xmlshortfile = '/install/filelist-'.DOL_VERSION.'.xml'; +$xmlfile = DOL_DOCUMENT_ROOT.$xmlshortfile; +$xmlremote = 'https://www.dolibarr.org/files/stable/signatures/filelist-'.DOL_VERSION.'.xml'; -if (file_exists($xmlfile)) + +// Test if remote test is ok +$enableremotecheck = True; +if (preg_match('/beta|alpha/i', DOL_VERSION)) $enableremotecheck=False; + + +print ''; +print $langs->trans("MakeIntegrityAnalysisFrom").':
'; +if (dol_is_file($xmlfile)) { - $xml = simplexml_load_file($xmlfile); - if ($xml) - { - if (is_object($xml->dolibarr_htdocs_dir[0])) - { - $file_list = array(); - $ret = getFilesUpdated($file_list, $xml->dolibarr_htdocs_dir[0]); // Fill array $file_list - - print '
'; - print ''; - print ''; - print ''; - print ''."\n"; - $var = true; - $tmpfilelist = dol_sort_array($file_list['missing'], 'filename'); - if (is_array($tmpfilelist) && count($tmpfilelist)) - { - foreach ($tmpfilelist as $file) - { - $var = !$var; - print ''; - print '' . "\n"; - print '' . "\n"; - print "\n"; - } - } - else - { - print ''; - } - print '
' . $langs->trans("FilesMissing") . '' . $langs->trans("ExpectedChecksum") . '
'.$file['filename'].''.$file['expectedmd5'].'
'.$langs->trans("None").'
'; - - print '
'; - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''."\n"; - $var = true; - $tmpfilelist = dol_sort_array($file_list['updated'], 'filename'); - if (is_array($tmpfilelist) && count($tmpfilelist)) - { - foreach ($tmpfilelist as $file) - { - $var = !$var; - print ''; - print '' . "\n"; - print '' . "\n"; - print '' . "\n"; - print '' . "\n"; - print '' . "\n"; - print "\n"; - } - } - else - { - print ''; - } - print '
' . $langs->trans("FilesUpdated") . '' . $langs->trans("ExpectedChecksum") . '' . $langs->trans("CurrentChecksum") . '' . $langs->trans("Size") . '' . $langs->trans("DateModification") . '
'.$file['filename'].''.$file['expectedmd5'].''.$file['md5'].''.dol_print_size(dol_filesize(DOL_DOCUMENT_ROOT.'/'.$file['filename'])).''.dol_print_date(dol_filemtime(DOL_DOCUMENT_ROOT.'/'.$file['filename']),'dayhour').'
'.$langs->trans("None").'
'; - } - else - { - print 'Error: Failed to found dolibarr_htdocs_dir into XML file '.$xmlfile; - $error++; - } - } - else - { - print 'Error: Failed to parse XML for input file '.$xmlfile; - $error++; - } + print ' '.$langs->trans("LocalSignature").' = '.$xmlshortfile.'
'; } else { - print $langs->trans('XmlNotFound') . ': ' . $xmlfile; - $error++; + print ' '.$langs->trans("LocalSignature").' = '.$xmlshortfile.' ('.$langs->trans("AvailableOnlyOnPackagedVersions").')
'; } +if ($enableremotecheck) +{ + print ' '.$langs->trans("RemoteSignature").' = '.$xmlremote.'
'; +} +else +{ + print ' '.$langs->trans("RemoteSignature").' = '.$xmlremote.' ('.$langs->trans("FeatureAvailableOnlyOnStable").')
'; +} +print '
'; +print '
'; +print '
'; +print '
'; + +if (GETPOST('target') == 'local') +{ + if (dol_is_file($xmlfile)) + { + $xml = simplexml_load_file($xmlfile); + } + else + { + print $langs->trans('XmlNotFound') . ': ' . $xmlfile; + $error++; + } +} +if (GETPOST('target') == 'remote') +{ + $xmlarray = getURLContent($xmlremote); + + // Return array('content'=>response,'curl_error_no'=>errno,'curl_error_msg'=>errmsg...) + if (! $xmlarray['curl_error_no'] && $xmlarray['http_code'] != '404') + { + $xmlfile = $xmlarray['content']; + $xml = simplexml_load_file($xmlfile); + } + else + { + $errormsg=$langs->trans('XmlNotFound') . ': ' . $xmlremote.' - '.$xmlarray['http_code'].' '.$xmlarray['curl_error_no'].' '.$xmlarray['curl_error_msg']; + setEventMessages($errormsg, null, 'errors'); + $error++; + } +} + + +if ($xml) +{ + if (is_object($xml->dolibarr_htdocs_dir[0])) + { + $file_list = array(); + $ret = getFilesUpdated($file_list, $xml->dolibarr_htdocs_dir[0]); // Fill array $file_list + + print ''; + print ''; + print ''; + print ''; + print ''."\n"; + $var = true; + $tmpfilelist = dol_sort_array($file_list['missing'], 'filename'); + if (is_array($tmpfilelist) && count($tmpfilelist)) + { + foreach ($tmpfilelist as $file) + { + $var = !$var; + print ''; + print '' . "\n"; + print '' . "\n"; + print "\n"; + } + } + else + { + print ''; + } + print '
' . $langs->trans("FilesMissing") . '' . $langs->trans("ExpectedChecksum") . '
'.$file['filename'].''.$file['expectedmd5'].'
'.$langs->trans("None").'
'; + + print '
'; + + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''."\n"; + $var = true; + $tmpfilelist = dol_sort_array($file_list['updated'], 'filename'); + if (is_array($tmpfilelist) && count($tmpfilelist)) + { + foreach ($tmpfilelist as $file) + { + $var = !$var; + print ''; + print '' . "\n"; + print '' . "\n"; + print '' . "\n"; + print '' . "\n"; + print '' . "\n"; + print "\n"; + } + } + else + { + print ''; + } + print '
' . $langs->trans("FilesUpdated") . '' . $langs->trans("ExpectedChecksum") . '' . $langs->trans("CurrentChecksum") . '' . $langs->trans("Size") . '' . $langs->trans("DateModification") . '
'.$file['filename'].''.$file['expectedmd5'].''.$file['md5'].''.dol_print_size(dol_filesize(DOL_DOCUMENT_ROOT.'/'.$file['filename'])).''.dol_print_date(dol_filemtime(DOL_DOCUMENT_ROOT.'/'.$file['filename']),'dayhour').'
'.$langs->trans("None").'
'; + } + else + { + print 'Error: Failed to found dolibarr_htdocs_dir into XML file '.$xmlfile; + $error++; + } +} + + + llxFooter(); diff --git a/htdocs/admin/system/phpinfo.php b/htdocs/admin/system/phpinfo.php index dfb897ba27c..ffba92fd4fa 100644 --- a/htdocs/admin/system/phpinfo.php +++ b/htdocs/admin/system/phpinfo.php @@ -2,6 +2,7 @@ /* Copyright (C) 2001-2002 Rodolphe Quiedeville * Copyright (C) 2004-2012 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2016 Juanjo Menent * * 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 @@ -87,9 +88,9 @@ foreach($phparray as $key => $value) $valtoshow=$keyvalue; if ($keyparam == 'X-ChromePhp-Data') $valtoshow=dol_trunc($keyvalue,80); print ''; - if ($keyparam == 'Path') $valtoshow=join('; ',explode(';',trim($valtoshow))); - if ($keyparam == 'PATH') $valtoshow=join('; ',explode(';',trim($valtoshow))); - if ($keyparam == '_SERVER["PATH"]') $valtoshow=join('; ',explode(';',trim($valtoshow))); + if ($keyparam == 'Path') $valtoshow=implode('; ',explode(';',trim($valtoshow))); + if ($keyparam == 'PATH') $valtoshow=implode('; ',explode(';',trim($valtoshow))); + if ($keyparam == '_SERVER["PATH"]') $valtoshow=implode('; ',explode(';',trim($valtoshow))); print $valtoshow; print ''; print ''; @@ -104,7 +105,7 @@ foreach($phparray as $key => $value) { print ''; $valtoshow=$keyvalue2; - if ($keyparam == 'disable_functions') $valtoshow=join(', ',explode(',',trim($valtoshow))); + if ($keyparam == 'disable_functions') $valtoshow=implode(', ',explode(',',trim($valtoshow))); //print $keyparam; print $valtoshow; $i++; diff --git a/htdocs/admin/tools/export.php b/htdocs/admin/tools/export.php index 175aaa65665..12b41110ac2 100644 --- a/htdocs/admin/tools/export.php +++ b/htdocs/admin/tools/export.php @@ -53,6 +53,8 @@ if ($file && ! $what) exit; } +$errormsg=''; + /* * Actions @@ -119,17 +121,40 @@ $utils = new Utils($db); if ($what == 'mysql') { - $cmddump=GETPOST("mysqldump"); // Do not sanitize here with 'alpha', will be sanitize later by escapeshellarg - if ($cmddump) + $cmddump=GETPOST("mysqldump"); // Do not sanitize here with 'alpha', will be sanitize later by dol_sanitizePathName and escapeshellarg + $cmddump=dol_sanitizePathName($cmddump); + + if (! empty($dolibarr_main_restrict_os_commands)) + { + $arrayofallowedcommand=explode(',', $dolibarr_main_restrict_os_commands); + $ok=0; + dol_syslog("Command are restricted to ".$dolibarr_main_restrict_os_commands.". We check that on of this command is inside ".$cmddump); + foreach($arrayofallowedcommand as $allowedcommand) + { + if (preg_match('/'.preg_quote($allowedcommand,'/').'/', $cmddump)) + { + $ok=1; + break; + } + } + if (! $ok) + { + $errormsg=$langs->trans('CommandIsNotInsideAllowedCommands'); + } + } + + if (! $errormsg && $cmddump) { dolibarr_set_const($db, 'SYSTEMTOOLS_MYSQLDUMP', $cmddump,'chaine',0,'',$conf->entity); } - $utils->dumpDatabase(GETPOST('compression','alpha'), $what, 0, $file); - - $errormsg=$utils->error; - $_SESSION["commandbackuplastdone"]=$utils->result['commandbackuplastdone']; - $_SESSION["commandbackuptorun"]=$utils->result['commandbackuptorun']; + if (! $errormsg) + { + $utils->dumpDatabase(GETPOST('compression','alpha'), $what, 0, $file); + $errormsg=$utils->error; + $_SESSION["commandbackuplastdone"]=$utils->result['commandbackuplastdone']; + $_SESSION["commandbackuptorun"]=$utils->result['commandbackuptorun']; + } } // MYSQL NO BIN @@ -145,17 +170,21 @@ if ($what == 'mysqlnobin') // POSTGRESQL if ($what == 'postgresql') { - $cmddump=GETPOST("postgresqldump"); // Do not sanitize here with 'alpha', will be sanitize later by escapeshellarg - if ($cmddump) + $cmddump=GETPOST("postgresqldump"); // Do not sanitize here with 'alpha', will be sanitize later by dol_sanitizePathName and escapeshellarg + $cmddump=dol_sanitizePathName($cmddump); + + if (! $errormsg && $cmddump) { dolibarr_set_const($db, 'SYSTEMTOOLS_POSTGRESQLDUMP', $cmddump,'chaine',0,'',$conf->entity); } - $utils->dumpDatabase(GETPOST('compression','alpha'), $what, 0, $file); - - $errormsg=$utils->error; - $_SESSION["commandbackuplastdone"]=$utils->result['commandbackuplastdone']; - $_SESSION["commandbackuptorun"]=$utils->result['commandbackuptorun']; + if (! $errormsg) + { + $utils->dumpDatabase(GETPOST('compression','alpha'), $what, 0, $file); + $errormsg=$utils->error; + $_SESSION["commandbackuplastdone"]=$utils->result['commandbackuplastdone']; + $_SESSION["commandbackuptorun"]=$utils->result['commandbackuptorun']; + } $what=''; // Clear to show message to run command } diff --git a/htdocs/admin/tools/update.php b/htdocs/admin/tools/update.php index 45b20588121..e306862b67a 100644 --- a/htdocs/admin/tools/update.php +++ b/htdocs/admin/tools/update.php @@ -168,36 +168,39 @@ print load_fiche_titre($langs->trans("Upgrade"),'','title_setup'); print $langs->trans("CurrentVersion").' : '.DOL_VERSION.'
'; -$result = getURLContent('http://sourceforge.net/projects/dolibarr/rss'); -//var_dump($result['content']); -$sfurl = simplexml_load_string($result['content']); -if ($sfurl) +if (function_exists('curl_init')) { - $i=0; - $version='0.0'; - while (! empty($sfurl->channel[0]->item[$i]->title) && $i < 10000) + $result = getURLContent('http://sourceforge.net/projects/dolibarr/rss'); + //var_dump($result['content']); + $sfurl = simplexml_load_string($result['content']); + if ($sfurl) { - $title=$sfurl->channel[0]->item[$i]->title; - if (preg_match('/([0-9]+\.([0-9\.]+))/', $title, $reg)) + $i=0; + $version='0.0'; + while (! empty($sfurl->channel[0]->item[$i]->title) && $i < 10000) { - $newversion=$reg[1]; - $newversionarray=explode('.',$newversion); - $versionarray=explode('.',$version); - //var_dump($newversionarray);var_dump($versionarray); - if (versioncompare($newversionarray, $versionarray) > 0) $version=$newversion; + $title=$sfurl->channel[0]->item[$i]->title; + if (preg_match('/([0-9]+\.([0-9\.]+))/', $title, $reg)) + { + $newversion=$reg[1]; + $newversionarray=explode('.',$newversion); + $versionarray=explode('.',$version); + //var_dump($newversionarray);var_dump($versionarray); + if (versioncompare($newversionarray, $versionarray) > 0) $version=$newversion; + } + $i++; } - $i++; + + // Show version + print $langs->trans("LastStableVersion").' : '. (($version != '0.0')?$version:$langs->trans("Unknown")) .'
'; + } + else + { + print $langs->trans("LastStableVersion").' : ' .$langs->trans("UpdateServerOffline").'
'; } - - // Show version - print $langs->trans("LastStableVersion").' : '. (($version != '0.0')?$version:$langs->trans("Unknown")) .'
'; } -else -{ - print $langs->trans("LastStableVersion").' : ' .$langs->trans("UpdateServerOffline").'
'; -} -print '
'; +print '
'; // Upgrade print $langs->trans("Upgrade").'
'; diff --git a/htdocs/admin/translation.php b/htdocs/admin/translation.php index f5c5970e9b3..bf313be16c2 100644 --- a/htdocs/admin/translation.php +++ b/htdocs/admin/translation.php @@ -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")."
\n"; print "
\n"; -print $langs->trans("CurrentUserLanguage").': '.$langs->defaultlang.'
'; -print '
'; - -print img_info().' '.$langs->trans("SomeTranslationAreUncomplete").'
'; -$urlwikitranslatordoc='http://wiki.dolibarr.org/index.php/Translator_documentation'; -print $langs->trans("SeeAlso").': '.$urlwikitranslatordoc.'
'; +$current_language_code=$langs->defaultlang; +$s=picto_from_langcode($current_language_code); +print $langs->trans("CurrentUserLanguage").': '.$s.' '.$current_language_code.'
'; print '
'; -print $langs->trans("TranslationOverwriteDesc",$langs->transnoentitiesnoconv("Language"),$langs->transnoentitiesnoconv("Key"),$langs->transnoentitiesnoconv("Value"))."
\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 '
'; print '
entity) && $debug)?'?debug=1':'').'" method="POST">'; +if ($optioncss != '') print ''; print ''; -print ''; +print ''; +print ''; +print ''; +print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -if (! empty($conf->multicompany->enabled) && !$user->entity) print ''; -print ''; -print "\n"; +$head=translation_prepare_head(); +dol_fiche_head($head, $mode, '', 0, ''); -// Line to add new record -$var=false; -print "\n"; - -print ''."\n"; -print ''; -// Limit to superadmin -if (! empty($conf->multicompany->enabled) && !$user->entity) +if ($mode == 'overwrite') { - print ''; - print '\n"; -print ''; + //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").': '.$urlwikitranslatordoc.')
'; + print $langs->trans("TranslationOverwriteDesc",$langs->transnoentitiesnoconv("Language"),$langs->transnoentitiesnoconv("Key"),$langs->transnoentitiesnoconv("NewTranslationStringToShow"))."\n"; + print ' ('.$langs->trans("TranslationOverwriteDesc2").').'."
\n"; + print '
'; + + + print ''; + print ''; + print ''; + + print '
'.$langs->trans("Language").' (en_US, es_MX, ...)'.$langs->trans("Key").''.$langs->trans("Value").''.$langs->trans("Entity").'
'; -print $formadmin->select_language(GETPOST('langcode'),'langcode',0,null,1,0,0,'',1); -//print ''; -print ''; -print ''; -print ''; -print ''; -print ''; - print ''; - print ''; -} -else -{ - print ''; - print ''; -} -print ''; -print "
'; + print ''; + 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 ''; + print "\n"; + + + // Line to add new record + $var=false; + print "\n"; + + print ''."\n"; + print ''; + // Limit to superadmin + if (! empty($conf->multicompany->enabled) && !$user->entity) + { + print ''; + print '\n"; + print ''; + + + // 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 ''; + + print ''."\n"; + print ''."\n"; + + // Value + print ''; + + print ''; + + print "\n"; + print "\n"; + $i++; + } + } + + + print '
'; + print $formadmin->select_language(GETPOST('langcode'), 'langcode', 0, null, 1, 0, 0, 'maxwidthonsmartphone', 1); + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + } + else + { + print ''; + print ''; + } + print ''; + print "
'.$obj->lang.''.$obj->transkey.''; + /*print ''; + print ''; + print ''; + print ''; + */ + print $obj->transvalue; + print ''; + print ''.img_delete().''; + print '
'; -// 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 ''; - - print ''.$obj->lang.''."\n"; - print ''.$obj->transkey.''."\n"; - - // Value - print ''; - /*print ''; - print ''; - print ''; - print ''; - */ - print $obj->transvalue; - print ''; - - print ''; - print ''.img_delete().''; - print ''; - - print "\n"; - print "\n"; - $i++; - } } +if ($mode == 'searchkey') +{ + $langcode=GETPOST('langcode')?GETPOST('langcode'):$langs->defaultlang; + + $newlang=new Translate('',$conf); + $newlang->setDefaultLang($langcode); -print ''; + $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
'."\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 '
'; + $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 ''; + print ''; + print ''; + + print ''; + print ''; + 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("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 ''; + print "\n"; + + // Line to search new record + $var=false; + print "\n"; + + print ''."\n"; + print ''; + // Action column + print ''; + print ''; + + 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 ''."\n"; + } + + print '
'; + //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 ''; + print ''; + print ''; + print ''; + // Limit to superadmin + if (! empty($conf->multicompany->enabled) && !$user->entity) + { + print ''; + print ''; + } + else + { + print ''; + } + print ''; + $searchpitco=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1); + print $searchpitco; + print '
'.$langcode.''.$key.''; + print dol_escape_htmltag($val); + print ''; + if ($val != $newlangfileonly->tab_translate[$key]) + { + $htmltext = $langs->trans("OriginalValueWas", $newlangfileonly->tab_translate[$key]); + print $form->textwithpicto('', $htmltext, 1, 'warning'); + } + print '
'; + print '
'; +} + +dol_fiche_end(); print "\n"; diff --git a/htdocs/admin/workflow.php b/htdocs/admin/workflow.php index 28feb8ab23e..75b0ce6d808 100644 --- a/htdocs/admin/workflow.php +++ b/htdocs/admin/workflow.php @@ -76,9 +76,11 @@ $workflowcodes=array( 'WORKFLOW_PROPAL_AUTOCREATE_ORDER'=>array('family'=>'create', 'position'=>10, 'enabled'=>'! empty($conf->propal->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'order'), 'WORKFLOW_ORDER_AUTOCREATE_INVOICE'=>array('family'=>'create', 'position'=>20, 'enabled'=>'! empty($conf->commande->enabled) && ! empty($conf->facture->enabled)', 'picto'=>'bill'), 'WORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL'=>array('family'=>'classify', 'position'=>30, 'enabled'=>'! empty($conf->propal->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'order','warning'=>'WarningCloseAlways'), + 'WORKFLOW_INVOICE_CLASSIFY_BILLED_PROPAL'=>array('family'=>'classify', 'position'=>30, 'enabled'=>'! empty($conf->propal->enabled) && ! empty($conf->facture->enabled)', 'picto'=>'order','warning'=>'WarningCloseAlways'), // For the following 2 options, if module invoice is disabled, they does not exists, so "Classify billed" for order must be done manually from order card. 'WORKFLOW_INVOICE_CLASSIFY_BILLED_ORDER'=>array('family'=>'classify', 'position'=>40, 'enabled'=>'! empty($conf->facture->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'bill','warning'=>'WarningCloseAlways'), 'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER'=>array('family'=>'classify', 'position'=>50, 'enabled'=>'! empty($conf->facture->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'bill','warning'=>'WarningCloseAlways'), + 'WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING'=>array('family'=>'classify', 'position'=>30, 'enabled'=>'! empty($conf->expedition->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'order'), ); if (! empty($conf->modules_parts['workflow']) && is_array($conf->modules_parts['workflow'])) @@ -110,8 +112,8 @@ foreach($workflowcodes as $key => $params) print ' '.$langs->trans("Status").''; print "\n"; $oldfamily = $family; - } - + } + $var = !$var; print "\n"; print "".img_object('', $picto).$langs->trans('desc'.$key); diff --git a/htdocs/api/admin/explorer.php b/htdocs/api/admin/explorer.php index 53ff102e89b..c83d759dcd6 100644 --- a/htdocs/api/admin/explorer.php +++ b/htdocs/api/admin/explorer.php @@ -28,6 +28,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/api/class/api.class.php'; require_once DOL_DOCUMENT_ROOT.'/api/class/api_access.class.php'; +$langs->load("admin"); + /* * View @@ -36,7 +38,6 @@ require_once DOL_DOCUMENT_ROOT.'/api/class/api_access.class.php'; // Enable and test if module Api is enabled if (empty($conf->global->MAIN_MODULE_API)) { - $langs->load("admin"); dol_syslog("Call Dolibarr API interfaces with module REST disabled"); print $langs->trans("WarningModuleNotActive",'Api').'.

'; print $langs->trans("ToActivateModule"); @@ -58,7 +59,7 @@ foreach ($modulesdir as $dir) /* * Search available module */ - dol_syslog("Scan directory ".$dir." for API modules"); + //dol_syslog("Scan directory ".$dir." for API modules"); $handle=@opendir(dol_osencode($dir)); if (is_resource($handle)) @@ -103,17 +104,43 @@ foreach ($modulesdir as $dir) { while (($file_searched = readdir($handle_part))!==false) { + // Support of the deprecated API. + if (is_readable($dir_part.$file_searched) && preg_match("/^api_deprecated_(.*)\.class\.php$/i",$file_searched,$reg)) + { + $classname = ucwords($reg[1]).'Api'; + require_once $dir_part.$file_searched; + if (class_exists($classname)) + { + dol_syslog("Found deprecated API classname=".$classname." into ".$dir); + $api->r->addAPIClass($classname, ''); + } + } + elseif (is_readable($dir_part.$file_searched) && preg_match("/^api_(.*)\.class\.php$/i",$file_searched,$reg)) + { + $classname = ucwords($reg[1]); + require_once $dir_part.$file_searched; + if (class_exists($classname)) + { + dol_syslog("Found API classname=".$classname." into ".$dir); + $listofapis[] = $classname; + } + } + + /* if (is_readable($dir_part.$file_searched) && preg_match("/^(api_.*)\.class\.php$/i",$file_searched,$reg)) { $classname=$reg[1]; $classname = str_replace('Api_','',ucwords($reg[1])).'Api'; + //$classname = str_replace('Api_','',ucwords($reg[1])); $classname = ucfirst($classname); require_once $dir_part.$file_searched; + if (class_exists($classname)) { dol_syslog("Found API classname=".$classname); $api->r->addAPIClass($classname,''); + /* require_once DOL_DOCUMENT_ROOT.'/includes/restler/framework/Luracast/Restler/Routes.php'; $tmpclass = new ReflectionClass($classname); @@ -124,8 +151,9 @@ foreach ($modulesdir as $dir) }*/ //$listofapis[]=array('classname'=>$classname, 'fullpath'=>$file_searched); - } - } + /* } + + }*/ } } } @@ -134,8 +162,8 @@ foreach ($modulesdir as $dir) } } - -$listofapis=Routes::toArray(); +//var_dump($listofapis); +$listofapis=Routes::toArray(); // TODO api for "status" is lost here //var_dump($listofapis); @@ -165,6 +193,7 @@ print $langs->trans("ListOfAvailableAPIs").':
'; foreach($listofapis['v1'] as $key => $val) { if ($key == 'login') continue; + if ($key == 'index') continue; if ($key) { diff --git a/htdocs/api/admin/index.php b/htdocs/api/admin/index.php index 3a69dadaaba..8142b564c1e 100644 --- a/htdocs/api/admin/index.php +++ b/htdocs/api/admin/index.php @@ -1,6 +1,6 @@ - * Copyright (C) 2005-2010 Laurent Destailleur + * Copyright (C) 2005-2016 Laurent Destailleur * Copyright (C) 2011 Juanjo Menent * Copyright (C) 2012 Regis Houssin * Copyright (C) 2015 Jean-François Ferry @@ -27,6 +27,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'; $langs->load("admin"); @@ -42,8 +43,16 @@ if ($action == 'setproductionmode') if (dolibarr_set_const($db, 'API_PRODUCTION_MODE', $status, 'chaine', 0, '', $conf->entity) > 0) { - header("Location: ".$_SERVER["PHP_SELF"]); - exit; + $result = dol_mkdir($conf->api->dir_temp); + if ($result < 0) + { + setEventMessages($langs->trans("ErrorFaildToCreateDir", $conf->api->dir_temp), null, 'errors'); + } + else + { + header("Location: ".$_SERVER["PHP_SELF"]); + exit; + } } else { @@ -70,7 +79,7 @@ print ''; print ''; print ""; -print ""; +print '"; print ""; print ""; @@ -95,11 +104,31 @@ print ''; print '
".$langs->trans("Parameter")."".$langs->trans("Value")."'.$langs->trans("Value")." 
'; print '

'; +// Define $urlwithroot +$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root)); +$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file +//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current + +// Show message +$message=''; +$url=''.$urlwithroot.'/api/index.php/login?login='.urlencode($user->login).'&password=yourpassword[&reset=1]'; +$message.=$langs->trans("UrlToGetKeyToUseAPIs").':
'; +$message.=img_picto('','object_globe.png').' '.$url; +print $message; +print '
'; +print '
'; + // Explorer print ''.$langs->trans("ApiExporerIs").':
'; -$url=DOL_MAIN_URL_ROOT.'/api/admin/explorer.php'; -print img_picto('','object_globe.png').' '.$url."
\n"; - +if (dol_is_dir(DOL_DOCUMENT_ROOT.'/includes/restler/framework/Luracast/Restler/explorer')) +{ + $url=DOL_MAIN_URL_ROOT.'/api/index.php/explorer'; + print img_picto('','object_globe.png').' '.$url."
\n"; +} +else +{ + print $langs->trans("NotAvailableWithThisDistribution"); +} llxFooter(); $db->close(); diff --git a/htdocs/api/class/api.class.php b/htdocs/api/class/api.class.php index b3a2cdaf9d0..45f2be3e4da 100644 --- a/htdocs/api/class/api.class.php +++ b/htdocs/api/class/api.class.php @@ -1,5 +1,6 @@ + * Copyright (C) 2016 Laurent Destailleur * * 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 @@ -86,7 +87,27 @@ class DolibarrApi function _cleanObjectDatas($object) { // Remove $db object property for object - unset($object->db); + unset($object->db); + + // Remove linkedObjects. We should already have linkedObjectIds that avoid huge responses + unset($object->linkedObjects); + + unset($object->lignes); // should be lines + + unset($object->statuts); + unset($object->statuts_short); + unset($object->statuts_logo); + + // Remove the $oldcopy property because it is not supported by the JSON + // encoder. The following error is generated when trying to serialize + // it: "Error encoding/decoding JSON: Type is not supported" + // Note: Event if this property was correctly handled by the JSON + // encoder, it should be ignored because keeping it would let the API + // have a very strange behavior: calling PUT and then GET on the same + // resource would give different results: + // PUT /objects/{id} -> returns object with oldcopy = previous version of the object + // GET /objects/{id} -> returns object with oldcopy empty + unset($object->oldcopy); // If object has lines, remove $db property if(isset($object->lines) && count($object->lines) > 0) { @@ -98,13 +119,15 @@ class DolibarrApi } // If object has linked objects, remove $db property + /* if(isset($object->linkedObjects) && count($object->linkedObjects) > 0) { foreach($object->linkedObjects as $type_object => $linked_object) { foreach($linked_object as $object2clean) { $this->_cleanObjectDatas($object2clean); } } - } + }*/ + return $object; } @@ -139,4 +162,60 @@ class DolibarrApi return checkUserAccessToObject(DolibarrApiAccess::$user, $featuresarray,$resource_id,$dbtablename,$feature2,$dbt_keyfield,$dbt_select); } + + /** + * Return if a $sqlfilters parameter is valid + * + * @param string $sqlfilters sqlfilter string + * @return boolean True if valid, False if not valid + */ + function _checkFilters($sqlfilters) + { + //$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + //$tmp=preg_replace_all('/'.$regexstring.'/', '', $sqlfilters); + $tmp=$sqlfilters; + $ok=0; + $i=0; $nb=count($tmp); + $counter=0; + while ($i < $nb) + { + if ($tmp[$i]=='(') $counter++; + if ($tmp[$i]==')') $counter--; + if ($counter < 0) + { + $error="Bad sqlfilters=".$sqlfilters; + dol_syslog($error, LOG_WARNING); + return false; + } + $i++; + } + return true; + } + + /** + * Function to forge a SQL criteria + * + * @param array $matches Array of found string by regex search + * @return string Forged criteria. Example: "t.field like 'abc%'" + */ + static function _forge_criteria_callback($matches) + { + global $db; + + //dol_syslog("Convert matches ".$matches[1]); + if (empty($matches[1])) return ''; + $tmp=explode(':',$matches[1]); + if (count($tmp) < 3) return ''; + + $tmpescaped=$tmp[2]; + if (preg_match('/^\'(.*)\'$/', $tmpescaped, $regbis)) + { + $tmpescaped = "'".$db->escape($regbis[1])."'"; + } + else + { + $tmpescaped = $db->escape($tmpescaped); + } + return $db->escape($tmp[0]).' '.strtoupper($db->escape($tmp[1]))." ".$tmpescaped; + } } diff --git a/htdocs/api/class/api_access.class.php b/htdocs/api/class/api_access.class.php index bebf9a6667b..68ec526ec7e 100644 --- a/htdocs/api/class/api_access.class.php +++ b/htdocs/api/class/api_access.class.php @@ -1,5 +1,6 @@ + * Copyright (C) 2016 Laurent Destailleur * * 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 diff --git a/htdocs/api/class/api_dictionnarycountries.class.php b/htdocs/api/class/api_dictionnarycountries.class.php new file mode 100644 index 00000000000..9b7b409ef19 --- /dev/null +++ b/htdocs/api/class/api_dictionnarycountries.class.php @@ -0,0 +1,183 @@ + + * Copyright (C) 2016 Laurent Destailleur + * + * 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 . + */ + +use Luracast\Restler\RestException; + +require_once DOL_DOCUMENT_ROOT.'/main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/ccountry.class.php'; + +/** + * API class for countries + * + * @access protected + * @class DolibarrApiAccess {@requires user,external} + */ +class DictionnaryCountries extends DolibarrApi +{ + private $translations = null; + + /** + * Constructor + */ + function __construct() + { + global $db; + $this->db = $db; + } + + /** + * Get the list of countries. + * + * The names of the countries will be translated to the given language if + * the $lang parameter is provided. The value of $lang must be a language + * code supported by Dolibarr, for example 'en_US' or 'fr_FR'. + * The returned list is sorted by country ID. + * + * @param string $sortfield Sort field + * @param string $sortorder Sort order + * @param int $limit Number of items per page + * @param int $page Page number (starting from zero) + * @param string $filter To filter the countries by name + * @param string $lang Code of the language the label of the countries must be translated to + * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" + * @return List of countries + * + * @throws RestException + */ + function index($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $filter = '', $lang = '', $sqlfilters = '') + { + $list = array(); + + // Note: The filter is not applied in the SQL request because it must + // be applied to the translated names, not to the names in database. + $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."c_country as t"; + $sql.=" WHERE 1 = 1"; + // Add sql filters + if ($sqlfilters) + { + if (! DolibarrApi::_checkFilters($sqlfilters)) + { + throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); + } + $regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; + } + + $sql.= $this->db->order($sortfield, $sortorder); + + if ($limit) { + if ($page < 0) { + $page = 0; + } + $offset = $limit * $page; + + $sql .= $this->db->plimit($limit, $offset); + } + + $result = $this->db->query($sql); + + if ($result) { + $num = $this->db->num_rows($result); + for ($i = 0; $i < min($num, ($limit <= 0 ? $num : $limit)); $i++) { + $obj = $this->db->fetch_object($result); + $country = new Ccountry($this->db); + if ($country->fetch($obj->rowid) > 0) { + // Translate the name of the country if needed + // and then apply the filter if there is one. + $this->translateLabel($country, $lang); + + if (empty($filter) || stripos($country->label, $filter) !== FALSE) { + $list[] = $this->_cleanObjectDatas($country); + } + } + } + } else { + throw new RestException(503, 'Error when retrieving list of countries : '.$country->error); + } + + return $list; + } + + /** + * Get country by ID. + * + * @param int $id ID of country + * @param string $lang Code of the language the name of the + * country must be translated to + * + * @throws RestException + */ + function get($id, $lang = '') + { + $country = new Ccountry($this->db); + + if ($country->fetch($id) < 0) { + throw new RestException(503, 'Error when retrieving country : '.$country->error); + } + else if ($country->fetch($id) == 0) { + throw new RestException(404, 'country not found'); + } + + $this->translateLabel($country, $lang); + + return $this->_cleanObjectDatas($country); + } + + /** + * Clean sensible object datas + * + * @param object $object Object to clean + * @return array Array of cleaned object properties + */ + function _cleanObjectDatas($object) + { + $object = parent::_cleanObjectDatas($object); + + unset($object->error); + unset($object->errors); + + return $object; + } + + /** + * Translate the name of the country to the given language. + * + * @param Ccountry $country Country + * @param string $lang Code of the language the name of the + * country must be translated to + */ + private function translateLabel($country, $lang) + { + if (!empty($lang)) { + // Load the translations if this is a new language. + if ($this->translations == null || $this->translations->getDefaultLang() !== $lang) { + global $conf; + $this->translations = new Translate('', $conf); + $this->translations->setDefaultLang($lang); + $this->translations->load('dict'); + } + if ($country->code) { + $key = 'Country'.$country->code; + $translation = $this->translations->trans($key); + if ($translation != $key) { + $country->label = html_entity_decode($translation); + } + } + } + } +} diff --git a/htdocs/api/class/api_dictionnarytowns.class.php b/htdocs/api/class/api_dictionnarytowns.class.php new file mode 100644 index 00000000000..b5813d07792 --- /dev/null +++ b/htdocs/api/class/api_dictionnarytowns.class.php @@ -0,0 +1,101 @@ + + * Copyright (C) 2016 Laurent Destailleur + * + * 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 . + */ + +use Luracast\Restler\RestException; + +require_once DOL_DOCUMENT_ROOT.'/main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/ccountry.class.php'; + +/** + * API class for towns (content of the ziptown dictionary) + * + * @access protected + * @class DolibarrApiAccess {@requires user,external} + */ +class DictionnaryTowns extends DolibarrApi +{ + /** + * Constructor + */ + function __construct() + { + global $db; + $this->db = $db; + } + + /** + * Get the list of towns. + * + * @param string $sortfield Sort field + * @param string $sortorder Sort order + * @param int $limit Number of items per page + * @param int $page Page number (starting from zero) + * @param string $zipcode To filter on zipcode + * @param string $town To filter on city name + * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" + * @return List of towns + * + * @throws RestException + */ + function index($sortfield = "zip,town", $sortorder = 'ASC', $limit = 100, $page = 0, $zipcode = '', $town = '', $sqlfilters = '') + { + $list = array(); + + $sql = "SELECT rowid AS id, zip, town, fk_county, fk_pays AS fk_country"; + $sql.= " FROM ".MAIN_DB_PREFIX."c_ziptown as t"; + $sql.= " WHERE t.active = 1"; + if ($zipcode) $sql.=" AND t.zip LIKE '%" . $this->db->escape($zipcode) . "%'"; + if ($town) $sql.=" AND t.town LIKE '%" . $this->db->escape($town) . "%'"; + // Add sql filters + if ($sqlfilters) + { + if (! DolibarrApi::_checkFilters($sqlfilters)) + { + throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); + } + $regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; + } + + + $sql.= $this->db->order($sortfield, $sortorder); + + if ($limit) { + if ($page < 0) { + $page = 0; + } + $offset = $limit * $page; + + $sql .= $this->db->plimit($limit, $offset); + } + + $result = $this->db->query($sql); + + if ($result) { + $num = $this->db->num_rows($result); + for ($i = 0; $i < min($num, ($limit <= 0 ? $num : $limit)); $i++) { + $list[] = $this->db->fetch_object($result); + } + } else { + throw new RestException(503, 'Error when retrieving list of towns : '.$this->db->lasterror()); + } + + return $list; + } + +} diff --git a/htdocs/api/class/api_generic.class.php b/htdocs/api/class/api_login.class.php similarity index 83% rename from htdocs/api/class/api_generic.class.php rename to htdocs/api/class/api_login.class.php index 9a630a9da47..3617eb899b1 100644 --- a/htdocs/api/class/api_generic.class.php +++ b/htdocs/api/class/api_login.class.php @@ -1,5 +1,6 @@ + * Copyright (C) 2016 Laurent Destailleur * * 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 @@ -18,14 +19,11 @@ use Luracast\Restler\RestException; require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; -require_once DOL_DOCUMENT_ROOT.'/api/class/api.class.php'; - /** - * API generic (login, status, ...) - * + * API that allows to log in with an user account. */ -class GenericApi extends DolibarrApi +class Login { function __construct() { @@ -46,7 +44,7 @@ class GenericApi extends DolibarrApi * * @throws RestException */ - public function login($login, $password, $entity=0, $reset=0) { + public function index($login, $password, $entity=0, $reset=0) { global $conf, $dolibarr_main_authentication, $dolibarr_auto_user; @@ -99,24 +97,8 @@ class GenericApi extends DolibarrApi 'success' => array( 'code' => 200, 'token' => $token, - 'message' => 'Welcome ' . $login.($reset?' - Token is new':' - Token was generated by a previous call') + 'message' => 'Welcome ' . $login.($reset?' - Token is new':' - This is your token (generated by a previous call)') ) ); } - - /** - * Get status (Dolibarr version) - * - * @access protected - * @class DolibarrApiAccess {@requires admin} - */ - function status() { - require_once DOL_DOCUMENT_ROOT . '/core/lib/functions.lib.php'; - return array( - 'success' => array( - 'code' => 200, - 'dolibarr_version' => DOL_VERSION - ) - ); - } } diff --git a/htdocs/api/class/api_status.class.php b/htdocs/api/class/api_status.class.php new file mode 100644 index 00000000000..2ac8da018d6 --- /dev/null +++ b/htdocs/api/class/api_status.class.php @@ -0,0 +1,40 @@ + + * + * 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 . + */ + +require_once DOL_DOCUMENT_ROOT . '/core/lib/functions.lib.php'; + + +/** + * API that gives the status of the Dolibarr instance. + * + * @access protected + * @class DolibarrApiAccess {@requires user,external} + */ +class Status +{ + /** + * Get status (Dolibarr version) + */ + function index() { + return array( + 'success' => array( + 'code' => 200, + 'dolibarr_version' => DOL_VERSION + ) + ); + } +} diff --git a/htdocs/api/index.php b/htdocs/api/index.php index 660c90d3476..80cfb5485df 100644 --- a/htdocs/api/index.php +++ b/htdocs/api/index.php @@ -1,5 +1,6 @@ + * Copyright (C) 2016 Laurent Destailleur * * 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 @@ -22,10 +23,10 @@ * \file htdocs/api/indexphp * * @todo User authentication with api_key - * - * */ + if (! defined("NOLOGIN")) define("NOLOGIN",'1'); +if (! defined("NOCSRFCHECK")) define("NOCSRFCHECK",'1'); $res=0; if (! $res && file_exists("../main.inc.php")) $res=include '../main.inc.php'; @@ -58,7 +59,10 @@ if (empty($conf->global->MAIN_MODULE_API)) $api = new DolibarrApi($db); -$api->r->addAPIClass('Luracast\\Restler\\Resources'); //this creates resources.json at API Root +// Enable the Restler API Explorer. +// See https://github.com/Luracast/Restler-API-Explorer for more info. +$api->r->addAPIClass('Luracast\\Restler\\Explorer'); + $api->r->setSupportedFormats('JsonFormat', 'XmlFormat'); $api->r->addAuthenticationClass('DolibarrApiAccess',''); @@ -70,33 +74,42 @@ foreach ($modulesdir as $dir) /* * Search available module */ - dol_syslog("Scan directory ".$dir." for API modules"); + //dol_syslog("Scan directory ".$dir." for API modules"); $handle=@opendir(dol_osencode($dir)); if (is_resource($handle)) { while (($file = readdir($handle))!==false) { - if (is_readable($dir.$file) && preg_match("/^(mod.*)\.class\.php$/i",$file,$reg)) + if (is_readable($dir.$file) && preg_match("/^mod(.*)\.class\.php$/i",$file,$reg)) { - $modulename=$reg[1]; + $module = strtolower($reg[1]); + $moduledirforclass = $module; + $moduleforperm = $module; + + if ($module == 'propale') { + $moduledirforclass = 'comm/propal'; + $moduleforperm='propal'; + } + elseif ($module == 'agenda') { + $moduledirforclass = 'comm/action'; + } + elseif ($module == 'adherent') { + $moduledirforclass = 'adherents'; + } + elseif ($module == 'banque') { + $moduledirforclass = 'compta/bank'; + } + elseif ($module == 'categorie') { + $moduledirforclass = 'categories'; + } + elseif ($module == 'facture') { + $moduledirforclass = 'compta/facture'; + } // Defined if module is enabled $enabled=true; - $module=$part=$obj=strtolower(preg_replace('/^mod/i','',$modulename)); - //if ($part == 'propale') $part='propal'; - if ($module == 'societe') { - $obj = 'thirdparty'; - } - if ($module == 'categorie') { - $part = 'categories'; - $obj = 'category'; - } - if ($module == 'facture') { - $part = 'compta/facture'; - $obj = 'facture'; - } - if (empty($conf->$module->enabled)) $enabled=false; + if (empty($conf->$moduleforperm->enabled)) $enabled=false; if ($enabled) { @@ -108,24 +121,32 @@ foreach ($modulesdir as $dir) * @todo : take care of externals module! * @todo : use getElementProperties() function ? */ - $dir_part = DOL_DOCUMENT_ROOT.'/'.$part.'/class/'; + $dir_part = DOL_DOCUMENT_ROOT.'/'.$moduledirforclass.'/class/'; $handle_part=@opendir(dol_osencode($dir_part)); if (is_resource($handle_part)) { while (($file_searched = readdir($handle_part))!==false) { - if (is_readable($dir_part.$file_searched) && preg_match("/^(api_.*)\.class\.php$/i",$file_searched,$reg)) + // Support of the deprecated API. + if (is_readable($dir_part.$file_searched) && preg_match("/^api_deprecated_(.*)\.class\.php$/i",$file_searched,$reg)) { - $classname=$reg[1]; - $classname = str_replace('Api_','',ucwords($reg[1])).'Api'; - $classname = ucfirst($classname); + $classname = ucwords($reg[1]).'Api'; require_once $dir_part.$file_searched; - if (class_exists($classname)) + if (class_exists($classname)) { - dol_syslog("Found API classname=".$classname); - $api->r->addAPIClass($classname,''); - $listofapis[]=array('classname'=>$classname, 'fullpath'=>$file_searched); + dol_syslog("Found deprecated API classname=".$classname." into ".$dir); + $api->r->addAPIClass($classname, '/'); + } + } + elseif (is_readable($dir_part.$file_searched) && preg_match("/^api_(.*)\.class\.php$/i",$file_searched,$reg)) + { + $classname = ucwords($reg[1]); + require_once $dir_part.$file_searched; + if (class_exists($classname)) + { + dol_syslog("Found API classname=".$classname." into ".$dir); + $listofapis[] = $classname; } } } @@ -136,6 +157,14 @@ foreach ($modulesdir as $dir) } } +// Sort the classes before adding them to Restler. The Restler API Explorer +// shows the classes in the order they are added and it's a mess if they are +// not sorted. +sort($listofapis); +foreach ($listofapis as $classname) +{ + $api->r->addAPIClass($classname); +} // TODO If not found, redirect to explorer diff --git a/htdocs/barcode/codeinit.php b/htdocs/barcode/codeinit.php index d47e5aaecd3..ebe121301b7 100644 --- a/htdocs/barcode/codeinit.php +++ b/htdocs/barcode/codeinit.php @@ -143,7 +143,7 @@ if ($action == 'initbarcodeproducts') $nextvalue=$modBarCodeProduct->getNextValue($productstatic,''); //print 'Set value '.$nextvalue.' to product '.$productstatic->id." ".$productstatic->ref." ".$productstatic->type."
\n"; - $result=$productstatic->setValueFrom('barcode', $nextvalue); + $result=$productstatic->setValueFrom('barcode', $nextvalue, '', '', 'date', '', $user, 'PRODUCT_MODIFY'); $nbtry++; if ($result > 0) $nbok++; diff --git a/htdocs/bookmarks/bookmarks.lib.php b/htdocs/bookmarks/bookmarks.lib.php index 4af1815c767..3cee534e797 100644 --- a/htdocs/bookmarks/bookmarks.lib.php +++ b/htdocs/bookmarks/bookmarks.lib.php @@ -72,7 +72,7 @@ function printBookmarksList($aDb, $aLangs) while ($i < $conf->global->BOOKMARKS_SHOW_IN_MENU && $obj = $db->fetch_object($resql)) { $ret.=''; $i++; } diff --git a/htdocs/cashdesk/include/environnement.php b/htdocs/cashdesk/include/environnement.php index 3e6a88f252a..4490d4cf405 100644 --- a/htdocs/cashdesk/include/environnement.php +++ b/htdocs/cashdesk/include/environnement.php @@ -44,7 +44,7 @@ $conf_fkaccount_cb = (! empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CB"]))?$_SESSIO // View parameters -$conf_taille_listes = (empty($conf->global->PRODUIT_LIMIT_SIZE)?500:$conf->global->PRODUIT_LIMIT_SIZE); // Nombre max de lignes a afficher dans les listes +$conf_taille_listes = (empty($conf->global->PRODUIT_LIMIT_SIZE)?1000:$conf->global->PRODUIT_LIMIT_SIZE); // Nombre max de lignes a afficher dans les listes $conf_nbr_car_listes = 60; // Nombre max de caracteres par ligne dans les listes // Add hidden option to force decrease of stock whatever is user setup diff --git a/htdocs/cashdesk/tpl/facturation1.tpl.php b/htdocs/cashdesk/tpl/facturation1.tpl.php index 8ddd7e48a85..d20eb4c3299 100644 --- a/htdocs/cashdesk/tpl/facturation1.tpl.php +++ b/htdocs/cashdesk/tpl/facturation1.tpl.php @@ -48,7 +48,7 @@ $langs->load("cashdesk"); onfocus="javascript: this.select(); verifResultat('resultats_dhtml', this.value, global->BARCODE_USE_SEARCH_TO_SELECT) ? (int) $conf->global->BARCODE_USE_SEARCH_TO_SELECT : 1) ?>);" onBlur="javascript: document.getElementById('resultats_dhtml').innerHTML = '';"/> - + load("cashdesk"); */ ?> - '.$top_liste_produits.''."\n"; @@ -80,7 +80,7 @@ $langs->load("cashdesk"); $label = $tab_designations[$i]['label']; - print ''."\n"; diff --git a/htdocs/cashdesk/tpl/menu.tpl.php b/htdocs/cashdesk/tpl/menu.tpl.php index 745ea723b49..75347427bda 100644 --- a/htdocs/cashdesk/tpl/menu.tpl.php +++ b/htdocs/cashdesk/tpl/menu.tpl.php @@ -62,9 +62,9 @@ $langs->load("main"); print '\n"; diff --git a/htdocs/categories/traduction.php b/htdocs/categories/traduction.php index 25fb000a594..38ff45d043d 100644 --- a/htdocs/categories/traduction.php +++ b/htdocs/categories/traduction.php @@ -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 ''; - + print ''; print ''; } diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index 09fda82223b..4411061e0c0 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -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 ""; @@ -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 ""; @@ -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 ""; @@ -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 ""; @@ -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 ""; @@ -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 ""; @@ -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 "
"; + print "\n"; + print '\n"; + + if (count($projects) > 0) + { + $var=true; + foreach ($projects as $key => $project) + { + $var=!$var; + print "\t\n"; + print '\n"; + print '\n"; + print '\n"; + // Link to delete from category + print '\n"; + } + } + else + { + print ''; + } + print "
'.$langs->trans("Project")."
'; + print $project->getNomUrl(1,0); + print "'.$project->ref."'.$project->title."'; + $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 ""; + print img_delete($langs->trans("DeleteFromCat")).' '; + print $langs->trans("DeleteFromCat").""; + } + print "
'.$langs->trans("ThisCategoryHasNoProject").'
\n"; + } +} + llxFooter(); $db->close(); diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 4df296d19da..d52edaa14d9 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -61,8 +61,14 @@ $originid=GETPOST('originid','int'); $confirm = GETPOST('confirm', 'alpha'); $fulldayevent=GETPOST('fullday'); -$datep=dol_mktime($fulldayevent?'00':GETPOST("aphour"), $fulldayevent?'00':GETPOST("apmin"), 0, GETPOST("apmonth"), GETPOST("apday"), GETPOST("apyear")); -$datef=dol_mktime($fulldayevent?'23':GETPOST("p2hour"), $fulldayevent?'59':GETPOST("p2min"), $fulldayevent?'59':'0', GETPOST("p2month"), GETPOST("p2day"), GETPOST("p2year")); + +$aphour = GETPOST('aphour'); +$apmin = GETPOST('apmin'); +$p2hour = GETPOST('p2hour'); +$p2min = GETPOST('p2min'); + +$datep=dol_mktime($fulldayevent?'00':$aphour, $fulldayevent?'00':$apmin, 0, GETPOST("apmonth"), GETPOST("apday"), GETPOST("apyear")); +$datef=dol_mktime($fulldayevent?'23':$p2hour, $fulldayevent?'59':$p2min, $fulldayevent?'59':'0', GETPOST("p2month"), GETPOST("p2day"), GETPOST("p2year")); // Security check $socid = GETPOST('socid','int'); @@ -96,6 +102,7 @@ $hookmanager->initHooks(array('actioncard','globalcard')); /* * Actions */ + $listUserAssignedUpdated = false; // Remove user to assigned list if (GETPOST('removedassigned') || GETPOST('removedassigned') == '0') @@ -639,8 +646,8 @@ if ($action == 'create') if ($backtopage) print ''; if (empty($conf->global->AGENDA_USE_EVENT_TYPE)) print ''; - if (GETPOST("actioncode") == 'AC_RDV') print load_fiche_titre($langs->trans("AddActionRendezVous")); - else print load_fiche_titre($langs->trans("AddAnAction")); + if (GETPOST("actioncode") == 'AC_RDV') print load_fiche_titre($langs->trans("AddActionRendezVous"), '', 'title_agenda'); + else print load_fiche_titre($langs->trans("AddAnAction"), '', 'title_agenda'); dol_fiche_head(); @@ -758,9 +765,9 @@ if ($action == 'create') $events[]=array('method' => 'getContacts', 'url' => dol_buildpath('/core/ajax/contacts.php?showempty=1',1), 'htmlname' => 'contactid', 'params' => array('add-customer-contact' => 'disabled')); //For external user force the company to user company if (!empty($user->societe_id)) { - print $form->select_thirdparty_list($user->societe_id,'socid','',1,1,0,$events); + print $form->select_thirdparty_list($user->societe_id, 'socid', '', 1, 1, 0, $events); } else { - print $form->select_thirdparty_list('','socid','',1,1,0,$events); + print $form->select_thirdparty_list('', 'socid', '', 'SelectThirdParty', 1, 0, $events); } } @@ -781,7 +788,7 @@ if ($action == 'create') print ''.$langs->trans("Project").''; - $numproject=$formproject->select_projects((! empty($societe->id)?$societe->id:0),GETPOST("projectid")?GETPOST("projectid"):'','projectid'); + $numproject=$formproject->select_projects((! empty($societe->id)?$societe->id:-1),GETPOST("projectid")?GETPOST("projectid"):'','projectid'); if ($numproject==0) { print '  
'.$langs->trans("AddProject").''; @@ -845,12 +852,13 @@ if ($id > 0) { $result1=$object->fetch($id); $result2=$object->fetch_thirdparty(); + $result2=$object->fetch_projet(); $result3=$object->fetch_contact(); $result4=$object->fetch_userassigned(); $result5=$object->fetch_optionals($id,$extralabels); + + if ($listUserAssignedUpdated || $donotclearsession) { - if($listUserAssignedUpdated || $donotclearsession) { - $datep=dol_mktime($fulldayevent?'00':$aphour, $fulldayevent?'00':$apmin, 0, $_POST["apmonth"], $_POST["apday"], $_POST["apyear"]); $datef=dol_mktime($fulldayevent?'23':$p2hour, $fulldayevent?'59':$p2min, $fulldayevent?'59':'0', $_POST["p2month"], $_POST["p2day"], $_POST["p2year"]); @@ -1093,8 +1101,10 @@ if ($id > 0) print ''.$langs->trans("ActionOnCompany").''; print ''; print '
'; - $events=array(); + $events=array(); // 'method'=parameter action of url, 'url'=url to call that return new list of contacts $events[]=array('method' => 'getContacts', 'url' => dol_buildpath('/core/ajax/contacts.php?showempty=1',1), 'htmlname' => 'contactid', 'params' => array('add-customer-contact' => 'disabled')); + // TODO Refresh also list of project if $conf->global->PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY not defined with list linked to socid ? + // FIXME If we change company, we may get a project that does not match print $form->select_company($object->socid, 'socid', '', 'SelectThirdParty', 1, 0, $events, 0); print '
'; print ''; @@ -1115,8 +1125,8 @@ if ($id > 0) $langs->load("projects"); - print ''.$langs->trans("Project").''; - $numprojet=$formproject->select_projects($object->socid, $object->fk_project, 'projectid'); + print ''.$langs->trans("Project").''; + $numprojet=$formproject->select_projects(($object->socid > 0 ? $object->socid : -1), $object->fk_project, 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 0); if ($numprojet==0) { print '   '.$langs->trans("AddProject").''; @@ -1125,7 +1135,7 @@ if ($id > 0) } // Priority - print ''.$langs->trans("Priority").''; + print ''.$langs->trans("Priority").''; print ''; print ''; @@ -1134,11 +1144,11 @@ if ($id > 0) { include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; print ''.$langs->trans("LinkedObject").''; - print ''.dolGetElementUrl($object->fk_element,$object->elementtype,1).''; + print ''.dolGetElementUrl($object->fk_element,$object->elementtype,1).''; } // Description - print ''.$langs->trans("Description").''; + print ''.$langs->trans("Description").''; // Editeur wysiwyg require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $doleditor=new DolEditor('note',$object->note,'',200,'dolibarr_notes','In',true,true,$conf->fckeditor->enabled,ROWS_5,90); @@ -1146,7 +1156,7 @@ if ($id > 0) print ''; // Other attributes - $parameters=array('colspan'=>' colspan="3"', 'colspanvalue'=>'3', 'id'=>$object->id); + $parameters=array('id'=>$object->id); $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)) { @@ -1178,33 +1188,51 @@ if ($id > 0) print $formconfirm; } + $linkback =img_picto($langs->trans("BackToList"),'object_list','class="hideonsmartphone pictoactionview"'); + $linkback.= ''.$langs->trans("BackToList").''; + + // Link to other agenda views + $out=''; + $out.=img_picto($langs->trans("ViewPerUser"),'object_calendarperuser','class="hideonsmartphone pictoactionview"'); + $out.=''.$langs->trans("ViewPerUser").''; + $out.='
'; + $out.=img_picto($langs->trans("ViewCal"),'object_calendar','class="hideonsmartphone pictoactionview"'); + $out.=''.$langs->trans("ViewCal").''; + $out.=img_picto($langs->trans("ViewWeek"),'object_calendarweek','class="hideonsmartphone pictoactionview"'); + $out.=''.$langs->trans("ViewWeek").''; + $out.=img_picto($langs->trans("ViewDay"),'object_calendarday','class="hideonsmartphone pictoactionview"'); + $out.=''.$langs->trans("ViewDay").''; + $linkback.=$out; + + dol_banner_tab($object, 'id', $linkback, ($user->societe_id?0:1), 'id', 'ref', ''); + + print '
'; + // Affichage fiche action en mode visu print ''; - $linkback = ''.$langs->trans("BackToList").''; - // Ref - print ''; + print '';*/ // Type if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) { - print ''; + print ''; } // Title - print ''; + //print ''; // Full day event - print ''; + print ''; $rowspan=4; if (empty($conf->global->AGENDA_DISABLE_LOCATION)) $rowspan++; // Date start - print ''; // Status - print ''; + print '';*/ // Location if (empty($conf->global->AGENDA_DISABLE_LOCATION)) @@ -1230,7 +1258,7 @@ if ($id > 0) } // Assigned to - print ''; @@ -1427,46 +1455,6 @@ if ($id > 0) if ($action != 'edit') { - // Link to agenda views - print '
'; - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - //print ''; - print img_picto($langs->trans("ViewCal"),'object_calendar','class="hideonsmartphone pictoactionview"').' '; - print ''."\n"; - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - //print ''; - print img_picto($langs->trans("ViewWeek"),'object_calendarweek','class="hideonsmartphone pictoactionview"').' '; - print ''."\n"; - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - //print ''; - print img_picto($langs->trans("ViewDay"),'object_calendarday','class="hideonsmartphone pictoactionview"').' '; - print ''."\n"; - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - //print ''; - print img_picto($langs->trans("ViewPerUser"),'object_calendarperuser','class="hideonsmartphone pictoactionview"').' '; - print ''."\n"; - print '
'; - if (empty($conf->global->AGENDA_DISABLE_BUILDDOC)) { print '
 

'; @@ -1484,7 +1472,7 @@ if ($id > 0) $var=true; - $somethingshown=$formfile->show_documents('agenda',$object->id,$filedir,$urlsource,$genallowed,$delallowed,'',0,0,0,0,0,'','','',$object->default_lang); + print $formfile->showdocuments('agenda',$object->id,$filedir,$urlsource,$genallowed,$delallowed,'',0,0,0,0,0,'','','',$object->default_lang); print '
'; diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 6b77e2414da..721e5db7f83 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -37,7 +37,8 @@ class ActionComm extends CommonObject public $table_element = 'actioncomm'; public $table_rowid = 'id'; protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe - + public $picto='action'; + /** * Id of the event * @var int @@ -406,7 +407,7 @@ class ActionComm extends CommonObject */ public function add(User $user, $notrigger = 0) { - $this->create($user, $notrigger); + return $this->create($user, $notrigger); } /** @@ -513,7 +514,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 +542,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; @@ -996,7 +998,7 @@ class ActionComm extends CommonObject } $this->date_creation = $this->db->jdate($obj->datec); - $this->date_modification = $this->db->jdate($obj->datem); + if (! empty($obj->fk_user_mod)) $this->date_modification = $this->db->jdate($obj->datem); } $this->db->free($result); } @@ -1023,7 +1025,7 @@ class ActionComm extends CommonObject * Return label of action status * * @param int $percent Percent - * @param int $mode 0=Long label, 1=Short label, 2=Picto+Short label, 3=Picto, 4=Picto+Short label, 5=Short label+Picto, 6=Very short label+Picto + * @param int $mode 0=Long label, 1=Short label, 2=Picto+Short label, 3=Picto, 4=Picto+Short label, 5=Short label+Picto, 6=Picto+Long label, 7=Very short label+Picto * @param int $hidenastatus 1=Show nothing if status is "Not applicable" * @return string Label */ @@ -1075,11 +1077,19 @@ class ActionComm extends CommonObject } else if ($mode == 6) { - if ($percent==-1 && ! $hidenastatus) return img_picto($langs->trans('StatusNotApplicable'),'statut9'); - else if ($percent==0) return '0% '.img_picto($langs->trans('StatusActionToDo'),'statut1'); - else if ($percent > 0 && $percent < 100) return $percent.'% '.img_picto($langs->trans('StatusActionInProcess').' - '.$percent.'%','statut3'); - else if ($percent >= 100) return img_picto($langs->trans('StatusActionDone'),'statut6'); + if ($percent==-1 && ! $hidenastatus) return $langs->trans('StatusNotApplicable').' '.img_picto($langs->trans('StatusNotApplicable'),'statut9'); + else if ($percent==0) return $langs->trans('StatusActionToDo').' (0%) '.img_picto($langs->trans('StatusActionToDo'),'statut1'); + else if ($percent > 0 && $percent < 100) return $langs->trans('StatusActionInProcess').' ('.$percent.'%) '.img_picto($langs->trans('StatusActionInProcess').' - '.$percent.'%','statut3'); + else if ($percent >= 100) return $langs->trans('StatusActionDone').' (100%) '.img_picto($langs->trans('StatusActionDone'),'statut6'); } + else if ($mode == 7) + { + if ($percent==-1 && ! $hidenastatus) return img_picto($langs->trans('StatusNotApplicable'),'statut9'); + else if ($percent==0) return '0% '.img_picto($langs->trans('StatusActionToDo'),'statut1'); + else if ($percent > 0 && $percent < 100) return $percent.'% '.img_picto($langs->trans('StatusActionInProcess').' - '.$percent.'%','statut3'); + else if ($percent >= 100) return img_picto($langs->trans('StatusActionDone'),'statut6'); + } + return ''; } @@ -1092,25 +1102,64 @@ class ActionComm extends CommonObject * @param string $classname Force style class on a link * @param string $option ''=Link to action, 'birthday'=Link to contact * @param int $overwritepicto 1=Overwrite picto + * @param int $notooltip 1=Disable tooltip * @return string Chaine avec URL */ - function getNomUrl($withpicto=0,$maxlength=0,$classname='',$option='',$overwritepicto=0) + function getNomUrl($withpicto=0,$maxlength=0,$classname='',$option='',$overwritepicto=0, $notooltip=0) { - global $conf,$langs; + global $conf, $langs, $user, $hookmanager; - $result=''; - $tooltip = '' . $langs->trans('ShowAction'.$objp->code) . ''; - if (! empty($this->ref)) - $tooltip .= '
' . $langs->trans('Ref') . ': ' . $this->ref; - if (! empty($this->label)) - $tooltip .= '
' . $langs->trans('Title') . ': ' . $this->label; - $label = $this->label; - if (empty($label)) $label=$this->libelle; // For backward compatibility - $linkclose = '" title="'.dol_escape_htmltag($tooltip, 1).'">'; - if ($option=='birthday') $link = 'type_color.'"'; + + if (empty($notooltip) && $user->rights->propal->lire) + { + if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) + { + $label=$langs->trans("ShowSupplierProposal"); + $linkclose.=' alt="'.dol_escape_htmltag($tooltip, 1).'"'; + } + $linkclose.=' title="'.dol_escape_htmltag($tooltip, 1).'"'; + $linkclose.=' class="'.$classname.' classfortooltip"'; + + if (! is_object($hookmanager)) + { + include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; + $hookmanager=new HookManager($this->db); + } + $hookmanager->initHooks(array('actiondao')); + $parameters=array('id'=>$this->id); + $reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks + $linkclose = ($hookmanager->resPrint ? $hookmanager->resPrint : $linkclose); + } + else $linkclose.=' class="'.$classname.'"'; + + $url=''; + if ($option=='birthday') + $url = DOL_URL_ROOT.'/contact/perso.php?id='.$this->id; + else + $url = DOL_URL_ROOT.'/comm/action/card.php?id='.$this->id; + + $linkstart = ''; + $linkend=''; + + //print 'rrr'.$this->libelle.'-'.$withpicto; if ($withpicto == 2) { @@ -1132,10 +1181,10 @@ class ActionComm extends CommonObject { $libelle.=(($this->type_code && $libelle!=$langs->transnoentities("Action".$this->type_code) && $langs->transnoentities("Action".$this->type_code)!="Action".$this->type_code)?' ('.$langs->transnoentities("Action".$this->type_code).')':''); } - $result.=$link.img_object($langs->trans("ShowAction").': '.$libelle, ($overwritepicto?$overwritepicto:'action'), 'class="classfortooltip"').$linkend; + $result.=$linkstart.img_object(($notooltip?'':$langs->trans("ShowAction").': '.$libelle), ($overwritepicto?$overwritepicto:'action'), ($notooltip?'':'class="classfortooltip"')).$linkend; } if ($withpicto==1) $result.=' '; - $result.=$link.$libelleshort.$linkend; + $result.=$linkstart.$libelleshort.$linkend; return $result; } diff --git a/htdocs/comm/action/class/api_agendaevents.class.php b/htdocs/comm/action/class/api_agendaevents.class.php new file mode 100644 index 00000000000..db828656966 --- /dev/null +++ b/htdocs/comm/action/class/api_agendaevents.class.php @@ -0,0 +1,294 @@ + + * Copyright (C) 2016 Laurent Destailleur + * + * 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 . + */ + + use Luracast\Restler\RestException; + + require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; + +/** + * API class for Agenda Events + * + * @access protected + * @class DolibarrApiAccess {@requires user,external} + */ +class AgendaEvents extends DolibarrApi +{ + + /** + * @var array $FIELDS Mandatory fields, checked when create and update object + */ + static $FIELDS = array( + ); + + /** + * @var Event $actioncomm {@type ActionComm} + */ + public $actioncomm; + + + /** + * Constructor + */ + function __construct() + { + global $db, $conf; + $this->db = $db; + $this->actioncomm = new ActionComm($this->db); + } + + /** + * Get properties of a Agenda Events object + * + * Return an array with Agenda Events informations + * + * @param int $id ID of Agenda Events + * @return array|mixed Data without useless information + * + * @throws RestException + */ + function get($id) + { + if(! DolibarrApiAccess::$user->rights->agenda->myactions->read) { + throw new RestException(401, "Insuffisant rights to read an event"); + } + + $result = $this->actioncomm->fetch($id); + if( ! $result ) { + throw new RestException(404, 'Agenda Events not found'); + } + + if(! DolibarrApiAccess::$user->rights->agenda->allactions->read && $this->actioncomm->ownerid != DolibarrApiAccess::$user->id) { + throw new RestException(401, "Insuffisant rights to read event for owner id ".$request_data['userownerid'].' Your id is '.DolibarrApiAccess::$user->id); + } + + if( ! DolibarrApi::_checkAccessToResource('agenda',$this->actioncomm->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + + $this->actioncomm->fetchObjectLinked(); + return $this->_cleanObjectDatas($this->actioncomm); + } + + /** + * List Agenda Events + * + * Get a list of Agenda Events + * + * @param string $sortfield Sort field + * @param string $sortorder Sort order + * @param int $limit Limit for list + * @param int $page Page number + * @param string $user_ids User ids filter field (owners of event). Example: '1' or '1,2,3' {@pattern /^[0-9,]*$/i} + * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" + * @return array Array of Agenda Events objects + */ + function index($sortfield = "t.id", $sortorder = 'ASC', $limit = 0, $page = 0, $user_ids = 0, $sqlfilters = '') { + global $db, $conf; + + $obj_ret = array(); + + // case of external user, $societe param is ignored and replaced by user's socid + //$socid = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : $societe; + + $sql = "SELECT t.id as rowid"; + $sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as t"; + $sql.= ' WHERE t.entity IN ('.getEntity('actioncomm', 1).')'; + if ($user_ids) $sql.=" AND t.fk_user_action IN (".$user_ids.")"; + // Insert sale filter + if ($search_sale > 0) + { + $sql .= " AND sc.fk_user = ".$search_sale; + } + // Add sql filters + if ($sqlfilters) + { + if (! DolibarrApi::_checkFilters($sqlfilters)) + { + throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); + } + $regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; + } + + $sql.= $db->order($sortfield, $sortorder); + if ($limit) { + if ($page < 0) + { + $page = 0; + } + $offset = $limit * $page; + + $sql.= $db->plimit($limit + 1, $offset); + } + + $result = $db->query($sql); + + if ($result) + { + $num = $db->num_rows($result); + while ($i < min($num, ($limit <= 0 ? $num : $limit))) + { + $obj = $db->fetch_object($result); + $actioncomm_static = new ActionComm($db); + if($actioncomm_static->fetch($obj->rowid)) { + $obj_ret[] = parent::_cleanObjectDatas($actioncomm_static); + } + $i++; + } + } + else { + throw new RestException(503, 'Error when retrieve Agenda Event list'); + } + if( ! count($obj_ret)) { + throw new RestException(404, 'No Agenda Event found'); + } + return $obj_ret; + } + + /** + * Create Agenda Event object + * + * @param array $request_data Request data + * @return int ID of Agenda Event + */ + function post($request_data = NULL) + { + if(! DolibarrApiAccess::$user->rights->agenda->myactions->create) { + throw new RestException(401, "Insuffisant rights to create your Agenda Event"); + } + if(! DolibarrApiAccess::$user->rights->agenda->allactions->create && DolibarrApiAccess::$user->id != $request_data['userownerid']) { + throw new RestException(401, "Insuffisant rights to create an Agenda Event for owner id ".$request_data['userownerid'].' Your id is '.DolibarrApiAccess::$user->id); + } + + // Check mandatory fields + $result = $this->_validate($request_data); + + foreach($request_data as $field => $value) { + $this->actioncomm->$field = $value; + } + /*if (isset($request_data["lines"])) { + $lines = array(); + foreach ($request_data["lines"] as $line) { + array_push($lines, (object) $line); + } + $this->expensereport->lines = $lines; + }*/ + if ($this->actioncomm->create(DolibarrApiAccess::$user) <= 0) { + $errormsg = $this->actioncomm->error; + throw new RestException(500, $errormsg ? $errormsg : "Error while creating actioncomm"); + } + + return $this->actioncomm->id; + } + + + /** + * Update Agenda Event general fields (won't touch lines of expensereport) + * + * @param int $id Id of Agenda Event to update + * @param array $request_data Datas + * + * @return int + */ + /* + function put($id, $request_data = NULL) { + if(! DolibarrApiAccess::$user->rights->agenda->myactions->create) { + throw new RestException(401, "Insuffisant rights to create your Agenda Event"); + } + if(! DolibarrApiAccess::$user->rights->agenda->allactions->create && DolibarrApiAccess::$user->id != $request_data['userownerid']) { + throw new RestException(401, "Insuffisant rights to create an Agenda Event for owner id ".$request_data['userownerid'].' Your id is '.DolibarrApiAccess::$user->id); + } + + $result = $this->expensereport->fetch($id); + if( ! $result ) { + throw new RestException(404, 'expensereport not found'); + } + + if( ! DolibarrApi::_checkAccessToResource('expensereport',$this->expensereport->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + foreach($request_data as $field => $value) { + $this->expensereport->$field = $value; + } + + if($this->expensereport->update($id, DolibarrApiAccess::$user,1,'','','update')) + return $this->get($id); + + return false; + } + */ + + /** + * Delete Agenda Event + * + * @param int $id Agenda Event ID + * + * @return array + */ + function delete($id) + { + if(! DolibarrApiAccess::$user->rights->agenda->myactions->delete) { + throw new RestException(401, "Insuffisant rights to delete your Agenda Event"); + } + + $result = $this->actioncomm->fetch($id); + + if(! DolibarrApiAccess::$user->rights->agenda->allactions->delete && DolibarrApiAccess::$user->id != $this->actioncomm->userownerid) { + throw new RestException(401, "Insuffisant rights to delete an Agenda Event of owner id ".$request_data['userownerid'].' Your id is '.DolibarrApiAccess::$user->id); + } + + if( ! $result ) { + throw new RestException(404, 'Agenda Event not found'); + } + + if( ! DolibarrApi::_checkAccessToResource('actioncomm',$this->actioncomm->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + + if( ! $this->actioncomm->delete(DolibarrApiAccess::$user)) { + throw new RestException(500, 'Error when delete Agenda Event : '.$this->actioncomm->error); + } + + return array( + 'success' => array( + 'code' => 200, + 'message' => 'Agenda Event deleted' + ) + ); + + } + + /** + * Validate fields before create or update object + * + * @param array $data Array with data to verify + * @return array + * @throws RestException + */ + function _validate($data) + { + $event = array(); + foreach (Events::$FIELDS as $field) { + if (!isset($data[$field])) + throw new RestException(400, "$field field missing"); + $event[$field] = $data[$field]; + + } + return $event; + } +} diff --git a/htdocs/comm/action/class/ical.class.php b/htdocs/comm/action/class/ical.class.php index 54f97fa2117..8254a5de1ba 100644 --- a/htdocs/comm/action/class/ical.class.php +++ b/htdocs/comm/action/class/ical.class.php @@ -208,7 +208,7 @@ class ICal //print 'type='.$type.' key='.$key.' value='.$value.'
'."\n"; - if ($key == false) + if (empty($key)) { $key = $this->last_key; switch ($type) diff --git a/htdocs/comm/action/document.php b/htdocs/comm/action/document.php index e8e5c388eb4..4691673a831 100644 --- a/htdocs/comm/action/document.php +++ b/htdocs/comm/action/document.php @@ -123,30 +123,49 @@ if ($object->id > 0) dol_fiche_head($head, 'documents', $langs->trans("Action"),0,'action'); + $linkback = img_picto($langs->trans("BackToList"),'object_list','class="hideonsmartphone pictoactionview"'); + $linkback.= ''.$langs->trans("BackToList").''; + + // Link to other agenda views + $out=''; + $out.=img_picto($langs->trans("ViewPerUser"),'object_calendarperuser','class="hideonsmartphone pictoactionview"'); + $out.=''.$langs->trans("ViewPerUser").''; + $out.='
'; + $out.=img_picto($langs->trans("ViewCal"),'object_calendar','class="hideonsmartphone pictoactionview"'); + $out.=''.$langs->trans("ViewCal").''; + $out.=img_picto($langs->trans("ViewWeek"),'object_calendarweek','class="hideonsmartphone pictoactionview"'); + $out.=''.$langs->trans("ViewWeek").''; + $out.=img_picto($langs->trans("ViewDay"),'object_calendarday','class="hideonsmartphone pictoactionview"'); + $out.=''.$langs->trans("ViewDay").''; + + $linkback.=$out; + + dol_banner_tab($object, 'id', $linkback, ($user->societe_id?0:1), 'id', 'ref', ''); + + print '
'; + // Affichage fiche action en mode visu print '
'.$langs->trans("Ref").''; + /*print '
'.$langs->trans("Ref").''; print $form->showrefnav($object, 'id', $linkback, ($user->societe_id?0:1), 'id', 'ref', ''); - print '
'.$langs->trans("Type").''.$object->type.'
'.$langs->trans("Type").''.$object->type.'
'.$langs->trans("Title").''.dol_htmlentities($object->label).'
'.$langs->trans("Title").''.dol_htmlentities($object->label).'
'.$langs->trans("EventOnFullDay").''.yn($object->fulldayevent, 3).'
'.$langs->trans("EventOnFullDay").''.yn($object->fulldayevent, 3).'
'.$langs->trans("DateActionStart").''; + print '
'.$langs->trans("DateActionStart").''; if (! $object->fulldayevent) print dol_print_date($object->datep,'dayhour'); else print dol_print_date($object->datep,'day'); if ($object->percentage == 0 && $object->datep && $object->datep < ($now - $delay_warning)) print img_warning($langs->trans("Late")); @@ -1219,9 +1247,9 @@ if ($id > 0) print '
'.$langs->trans("Status").' / '.$langs->trans("Percentage").''; + /*print '
'.$langs->trans("Status").' / '.$langs->trans("Percentage").''; print $object->getLibStatut(4); - print '
'.$langs->trans("ActionAssignedTo").''; + print '
'.$langs->trans("ActionAssignedTo").''; $listofuserid=array(); if (empty($donotclearsession)) { @@ -1286,7 +1314,7 @@ if ($id > 0) // Third party - Contact if ($conf->societe->enabled) { - print '
'.$langs->trans("ActionOnCompany").''.($object->thirdparty->id?$object->thirdparty->getNomUrl(1):$langs->trans("None")); + print '
'.$langs->trans("ActionOnCompany").''.($object->thirdparty->id?$object->thirdparty->getNomUrl(1):$langs->trans("None")); if (is_object($object->thirdparty) && $object->thirdparty->id > 0 && $object->type_code == 'AC_TEL') { if ($object->thirdparty->fetch($object->thirdparty->id)) @@ -1318,7 +1346,7 @@ if ($id > 0) // Project if (! empty($conf->projet->enabled)) { - print '
'.$langs->trans("Project").''; + print '
'.$langs->trans("Project").''; if ($object->fk_project) { $project=new Project($db); @@ -1329,7 +1357,7 @@ if ($id > 0) } // Priority - print '
'.$langs->trans("Priority").''; + print '
'.$langs->trans("Priority").''; print ($object->priority?$object->priority:''); print '
'; - $linkback = ''.$langs->trans("BackToList").''; - // Ref - print ''; + print '';*/ // Type if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) { - print ''; + print ''; } // Title - print ''; + //print ''; // Full day event - print ''; + print ''; // Date start - print ''; // Status - print ''; + print '';*/ // Location if (empty($conf->global->AGENDA_DISABLE_LOCATION)) @@ -172,7 +191,7 @@ if ($object->id > 0) } // Assigned to - print ''; - print '
'.$langs->trans("Ref").''; + /*print '
'.$langs->trans("Ref").''; print $form->showrefnav($object, 'id', $linkback, ($user->societe_id?0:1), 'id', 'ref', ''); - print '
'.$langs->trans("Type").''.$object->type.'
'.$langs->trans("Type").''.$object->type.'
'.$langs->trans("Title").''.$object->label.'
'.$langs->trans("Title").''.$object->label.'
'.$langs->trans("EventOnFullDay").''.yn($object->fulldayevent, 3).'
'.$langs->trans("EventOnFullDay").''.yn($object->fulldayevent, 3).'
'.$langs->trans("DateActionStart").''; + print '
'.$langs->trans("DateActionStart").''; if (! $object->fulldayevent) print dol_print_date($object->datep,'dayhour'); else print dol_print_date($object->datep,'day'); if ($object->percentage == 0 && $object->datep && $object->datep < ($now - $delay_warning)) print img_warning($langs->trans("Late")); @@ -161,9 +180,9 @@ if ($object->id > 0) print '
'.$langs->trans("Status").' / '.$langs->trans("Percentage").''; + /*print '
'.$langs->trans("Status").' / '.$langs->trans("Percentage").''; print $object->getLibStatut(4); - print '
'.$langs->trans("ActionAffectedTo").''; + print '
'.$langs->trans("ActionAffectedTo").''; $listofuserid=array(); if (empty($donotclearsession)) { @@ -206,11 +225,15 @@ if ($object->id > 0) } print '


'; + print '
'; + + print '

'; + + print ''; // Third party - Contact - print ''; + print ''; print ''; print '
'.$langs->trans("ActionOnCompany").''.($object->thirdparty->id?$object->thirdparty->getNomUrl(1):$langs->trans("None")); + print '
'.$langs->trans("ActionOnCompany").''.($object->thirdparty->id?$object->thirdparty->getNomUrl(1):$langs->trans("None")); if (is_object($object->thirdparty) && $object->thirdparty->id > 0 && $object->type_code == 'AC_TEL') { if ($object->thirdparty->fetch($object->thirdparty->id)) @@ -281,7 +304,7 @@ if ($object->id > 0) } - print '
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'.$langs->trans("TotalSizeOfAttachedFiles").''.$totalsize.' '.$langs->trans("bytes").'
'; @@ -289,54 +312,6 @@ if ($object->id > 0) dol_fiche_end(); - - if ($action != 'edit') - { - // Link to agenda views - print '
'; - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - //print ''; - print img_picto($langs->trans("ViewCal"),'object_calendar','class="hideonsmartphone pictoactionview"').' '; - print '
'."\n"; - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - //print ''; - print img_picto($langs->trans("ViewCal"),'object_calendarweek','class="hideonsmartphone pictoactionview"').' '; - print '
'."\n"; - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - //print ''; - print img_picto($langs->trans("ViewCal"),'object_calendarday','class="hideonsmartphone pictoactionview"').' '; - print '
'."\n"; - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - //print ''; - print img_picto($langs->trans("ViewCal"),'object_calendarperuser','class="hideonsmartphone pictoactionview"').' '; - print '
'."\n"; - print '
'; - - print '
'; - print "

"; - } - - $modulepart = 'actions'; $permission = $user->rights->agenda->myactions->create||$user->rights->agenda->allactions->create; $param = '&id=' . $object->id; diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 5306300e7b1..f70b8d171a1 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.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 diff --git a/htdocs/comm/action/info.php b/htdocs/comm/action/info.php index 7c2001d925d..d1338142173 100644 --- a/htdocs/comm/action/info.php +++ b/htdocs/comm/action/info.php @@ -50,19 +50,41 @@ $result = restrictedArea($user, 'agenda', $id, 'actioncomm&societe', 'myactions| $help_url='EN:Module_Agenda_En|FR:Module_Agenda|ES:M&omodulodulo_Agenda'; llxHeader('',$langs->trans("Agenda"),$help_url); -$act = new ActionComm($db); -$act->fetch($id); -$act->info($act->id); +$object = new ActionComm($db); +$object->fetch($id); +$object->info($object->id); -$head=actions_prepare_head($act); +$head=actions_prepare_head($object); dol_fiche_head($head, 'info', $langs->trans("Action"),0,'action'); +$linkback = img_picto($langs->trans("BackToList"),'object_list','class="hideonsmartphone pictoactionview"'); +$linkback.= ''.$langs->trans("BackToList").''; + +// Link to other agenda views +$out=''; +$out.=img_picto($langs->trans("ViewPerUser"),'object_calendarperuser','class="hideonsmartphone pictoactionview"'); +$out.=''.$langs->trans("ViewPerUser").''; +$out.='
'; +$out.=img_picto($langs->trans("ViewCal"),'object_calendar','class="hideonsmartphone pictoactionview"'); +$out.=''.$langs->trans("ViewCal").''; +$out.=img_picto($langs->trans("ViewWeek"),'object_calendarweek','class="hideonsmartphone pictoactionview"'); +$out.=''.$langs->trans("ViewWeek").''; +$out.=img_picto($langs->trans("ViewDay"),'object_calendarday','class="hideonsmartphone pictoactionview"'); +$out.=''.$langs->trans("ViewDay").''; + +$linkback.=$out; + +dol_banner_tab($object, 'id', $linkback, ($user->societe_id?0:1), 'id', 'ref', ''); + +print '
'; + +print '
'; print '
'; -dol_print_object_info($act); +dol_print_object_info($object); print '
'; -print '
'; +dol_fiche_end(); llxFooter(); $db->close(); diff --git a/htdocs/comm/action/listactions.php b/htdocs/comm/action/listactions.php index b927244821e..63a28c9f480 100644 --- a/htdocs/comm/action/listactions.php +++ b/htdocs/comm/action/listactions.php @@ -55,6 +55,7 @@ else $actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE)); } if ($actioncode == '' && empty($actioncodearray)) $actioncode=(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE); +$search_title=GETPOST('search_title','alpha'); $dateselect=dol_mktime(0, 0, 0, GETPOST('dateselectmonth'), GETPOST('dateselectday'), GETPOST('dateselectyear')); $datestart=dol_mktime(0, 0, 0, GETPOST('datestartmonth'), GETPOST('datestartday'), GETPOST('datestartyear')); @@ -106,13 +107,6 @@ if (! $user->rights->agenda->allactions->read || $filter=='mine') // If no permi $filtert=$user->id; } -// Purge search criteria -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers -{ - $datestart=''; - $dateend=''; -} - // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array $hookmanager->initHooks(array('agendalist')); @@ -133,6 +127,18 @@ if (GETPOST("viewcal") || GETPOST("viewweek") || GETPOST("viewday")) exit; } +$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'); + +// 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 +{ + $actioncode=''; + $search_title=''; + $datestart=''; + $dateend=''; +} /* @@ -201,6 +207,7 @@ if ($status == '-1') { $sql.= " AND a.percent = -1"; } // Not applicable if ($status == '50') { $sql.= " AND (a.percent > 0 AND a.percent < 100)"; } // Running already started if ($status == 'done' || $status == '100') { $sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep2 <= '".$db->idate($now)."'))"; } if ($status == 'todo') { $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep2 > '".$db->idate($now)."'))"; } +if ($search_title) $sql.=natural_search("a.label", $search_title); // We must filter on assignement table if ($filtert > 0 || $usergroup > 0) { @@ -309,7 +316,8 @@ if ($resql) $i = 0; print ''; print ''; - print_liste_field_titre($langs->trans("Action"),$_SERVER["PHP_SELF"],"a.label",$param,"","",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"a.id",$param,"","",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Title"),$_SERVER["PHP_SELF"],"a.label",$param,"","",$sortfield,$sortorder); if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"c.libelle",$param,"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("DateStart"),$_SERVER["PHP_SELF"],"a.datep",$param,'','align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("DateEnd"),$_SERVER["PHP_SELF"],"a.datep2",$param,'','align="center"',$sortfield,$sortorder); @@ -322,6 +330,7 @@ if ($resql) print ''; print ''; + print ''; if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) { print ''; @@ -367,15 +376,22 @@ if ($resql) $var=!$var; + $actionstatic->id=$obj->id; + $actionstatic->ref=$obj->id; + $actionstatic->type_code=$obj->type_code; + $actionstatic->type_label=$obj->type_label; + $actionstatic->label=$obj->label; + print ""; // Action (type) print ''; + + // Action (type) + print ''; if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) @@ -433,13 +449,13 @@ if ($resql) if ($obj->fk_user_action > 0) { $userstatic->fetch($obj->fk_user_action); - print $userstatic->getLoginUrl(1); + print $userstatic->getNomUrl(1); } else print ' '; print ''; // Status/Percent - print ''; + print ''; print ''; diff --git a/htdocs/comm/action/pertype.php b/htdocs/comm/action/pertype.php index 6138e79cafd..ae11f06cedd 100644 --- a/htdocs/comm/action/pertype.php +++ b/htdocs/comm/action/pertype.php @@ -86,12 +86,12 @@ $status=GETPOST("status"); $type=GETPOST("type"); $maxprint=(isset($_GET["maxprint"])?GETPOST("maxprint"):$conf->global->AGENDA_MAX_EVENTS_DAY_VIEW); // Set actioncode (this code must be same for setting actioncode into peruser, listacton and index) -if (GETPOST('actioncode','array')) +if (GETPOST('actioncode','array')) { $actioncode=GETPOST('actioncode','array',3); if (! count($actioncode)) $actioncode='0'; } -else +else { $actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE)); } @@ -186,7 +186,7 @@ $week = $prev['week']; $day = (int) $day; $next = dol_get_next_day($day, $month, $year); -$next_year = year + 1; +$next_year = $year + 1; $next_month = $month; $next_day = $day; diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 256a31fd947..cebe1b60c80 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -46,6 +46,8 @@ if (! empty($conf->adherent->enabled)) require_once DOL_DOCUMENT_ROOT.'/adherent if (! empty($conf->ficheinter->enabled)) require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; $langs->load("companies"); +$langs->load('banks'); + if (! empty($conf->contrat->enabled)) $langs->load("contracts"); if (! empty($conf->commande->enabled)) $langs->load("orders"); if (! empty($conf->expedition->enabled)) $langs->load("sendings"); @@ -61,7 +63,6 @@ $result = restrictedArea($user,'societe',$id,'&societe'); $action = GETPOST('action'); $mode = GETPOST("mode"); -$modesearch = GETPOST("mode_search"); $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); @@ -124,7 +125,15 @@ if (empty($reshook)) if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); } - // customer preferred shipping method + // Bank account + if ($action == 'setbankaccount' && $user->rights->societe->creer) + { + $object->fetch($id); + $result=$object->setBankAccount(GETPOST('fk_account','int')); + if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); + } + + // customer preferred shipping method if ($action == 'setshippingmethod' && $user->rights->societe->creer) { $object->fetch($id); @@ -192,41 +201,15 @@ $help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; llxHeader('',$title,$help_url); -/* -if ($mode == 'search') -{ - if ($modesearch == 'soc') - { - // TODO move to DAO class - $sql = "SELECT s.rowid"; - if (!$user->rights->societe->client->voir && !$id) $sql .= ", sc.fk_soc, sc.fk_user "; - $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; - if (!$user->rights->societe->client->voir && !$id) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql .= " WHERE lower(s.nom) like '%".strtolower($socname)."%'"; - if (!$user->rights->societe->client->voir && !$id) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; - } - - $resql=$db->query($sql); - if ($resql) - { - if ( $db->num_rows($resql) == 1) - { - $obj = $db->fetch_object($resql); - $id = $obj->rowid; - } - $db->free($resql); - } -} -*/ - if ($id > 0) { $head = societe_prepare_head($object); dol_fiche_head($head, 'customer', $langs->trans("ThirdParty"),0,'company'); - - dol_banner_tab($object, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom'); + $linkback = ''.$langs->trans("BackToList").''; + + dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom'); print '
'; @@ -234,14 +217,14 @@ if ($id > 0) print '
'; - $actionstatic->id=$obj->id; - $actionstatic->type_code=$obj->type_code; - $actionstatic->type_label=$obj->type_label; - $actionstatic->label=$obj->label; - print $actionstatic->getNomUrl(1,36); + print $actionstatic->getNomUrl(1,-1); + print ''; + print $actionstatic->label; print ''.$actionstatic->LibStatut($obj->percent,6).''.$actionstatic->LibStatut($obj->percent,3).'
'; // Prospect/Customer - print ''; // Prefix if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field { - print ''; } @@ -251,7 +234,7 @@ if ($id > 0) $langs->load("compta"); print ''; @@ -259,7 +242,7 @@ if ($id > 0) print ''; print ''; print ''; @@ -268,12 +251,12 @@ if ($id > 0) // Skype if (! empty($conf->skype->enabled)) { - print ''; + print ''; } // Assujeti a TVA ou pas print ''; - print ''; print ''; @@ -281,20 +264,20 @@ if ($id > 0) // Local Taxes if ($mysoc->useLocalTax(1)) { - print ''; } if ($mysoc->useLocalTax(2)) { - print ''; } // TVA Intra - print ''; @@ -306,7 +289,7 @@ if ($id > 0) print ''; print '
'.$langs->trans('ProspectCustomer').''; + print '
'.$langs->trans('ProspectCustomer').''; print $object->getLibCustProspStatut(); print '
'.$langs->trans("Prefix").''; + print '
'.$langs->trans("Prefix").''; print ($object->prefix_comm?$object->prefix_comm:' '); print '
'; - print $langs->trans('CustomerCode').''; + print $langs->trans('CustomerCode').''; print $object->code_client; if ($object->check_codeclient() <> 0) print ' ('.$langs->trans("WrongCustomerCode").')'; print '
'; print $form->editfieldkey("CustomerAccountancyCode",'customeraccountancycode',$object->code_compta,$object,$user->rights->societe->creer); - print ''; + print ''; print $form->editfieldval("CustomerAccountancyCode",'customeraccountancycode',$object->code_compta,$object,$user->rights->societe->creer); print '
'.$langs->trans('Skype').''.dol_print_skype($object->skype,0,$object->id,'AC_SKYPE').'
'.$langs->trans('Skype').''.dol_print_skype($object->skype,0,$object->id,'AC_SKYPE').'
'.$langs->trans('VATIsUsed').''; + print ''.$langs->trans('VATIsUsed').''; print yn($object->tva_assuj); print '
'.$langs->trans("LocalTax1IsUsedES").''; + print '
'.$langs->transcountry("LocalTax1IsUsed", $mysoc->country_code).''; print yn($object->localtax1_assuj); print '
'.$langs->trans("LocalTax2IsUsedES").''; + print '
'.$langs->transcountry("LocalTax2IsUsed", $mysoc->country_code).''; print yn($object->localtax2_assuj); print '
'.$langs->trans('VATIntra').''; + print '
'.$langs->trans('VATIntra').''; print $object->tva_intra; print '
'; if (($action != 'editconditions') && $user->rights->societe->creer) print 'id.'">'.img_edit($langs->trans('SetConditions'),1).'
'; - print ''; + print ''; if ($action == 'editconditions') { $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->cond_reglement_id, 'cond_reglement_id',1); @@ -325,7 +308,7 @@ if ($id > 0) print ''; if (($action != 'editmode') && $user->rights->societe->creer) print 'id.'">'.img_edit($langs->trans('SetMode'),1).''; print ''; - print ''; + print ''; if ($action == 'editmode') { $form->form_modes_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->mode_reglement_id,'mode_reglement_id'); @@ -337,6 +320,26 @@ if ($id > 0) print ""; print ''; + // Compte bancaire par défaut + print ''; + print ''; + print '
'; + print $langs->trans('PaymentBankAccount'); + print ''; + if (($action != 'editbankaccount') && $user->rights->societe->creer) print 'id.'">'.img_edit($langs->trans('SetBankAccount'),1).'
'; + print ''; + if ($action == 'editbankaccount') + { + $form->formSelectAccount($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->fk_account,'fk_account',1); + } + else + { + $form->formSelectAccount($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->fk_account,'none'); + } + print ""; + print ''; + + // Relative discounts (Discounts-Drawbacks-Rebates) print ''; print '
'; @@ -347,7 +350,7 @@ if ($id > 0) print ''.img_edit($langs->trans("Modify")).''; } print '
'; - print ''.($object->remise_percent?''.$object->remise_percent.'%':$langs->trans("DiscountNone")).''; + print ''.($object->remise_percent?''.$object->remise_percent.'%':'').''; print ''; // Absolute discounts (Discounts-Drawbacks-Rebates) @@ -362,28 +365,14 @@ if ($id > 0) } print ''; print ''; - print ''; + print ''; $amount_discount=$object->getAvailableDiscounts(); if ($amount_discount < 0) dol_print_error($db,$object->error); if ($amount_discount > 0) print ''.price($amount_discount,1,$langs,1,-1,-1,$conf->currency).''; - else print $langs->trans("DiscountNone"); + //else print $langs->trans("DiscountNone"); print ''; print ''; - if ($object->client) - { - print ''; - print ''; - print $form->editfieldkey("OutstandingBill",'outstanding_limit',$object->outstanding_limit,$object,$user->rights->societe->creer); - print ''; - $limit_field_type = (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE)) ? 'numeric' : 'amount'; - print $form->editfieldval("OutstandingBill",'outstanding_limit',$object->outstanding_limit,$object,$user->rights->societe->creer,$limit_field_type,($object->outstanding_limit != '' ? price($object->outstanding_limit) : '')); - if (empty($object->outstanding_limit)) print $langs->trans("NoLimit"); - - print ''; - print ''; - } - // Multiprice level if (! empty($conf->global->PRODUIT_MULTIPRICES)) { @@ -396,7 +385,7 @@ if ($id > 0) print ''.img_edit($langs->trans("Modify")).''; } print ''; - print ''; + print ''; print $object->price_level; $keyforlabel='PRODUIT_MULTIPRICES_LABEL'.$object->price_level; if (! empty($conf->global->$keyforlabel)) print ' - '.$langs->trans($conf->global->$keyforlabel); @@ -404,36 +393,6 @@ if ($id > 0) print ''; } - if ($object->client == 2 || $object->client == 3) - { - // Level of prospect - print ''; - print ''; - print '
'; - print $langs->trans('ProspectLevel'); - print ''; - if ($action != 'editlevel' && $user->rights->societe->creer) print 'id.'">'.img_edit($langs->trans('Modify'),1).'
'; - print ''; - if ($action == 'editlevel') - $formcompany->form_prospect_level($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->fk_prospectlevel,'prospect_level_id',1); - else - print $object->getLibProspLevel(); - print ""; - print ''; - - // Status - $object->loadCacheOfProspStatus(); - print ''.$langs->trans("StatusProsp").''.$object->getLibProspCommStatut(4, $object->cacheprospectstatus[$object->stcomm_id]['label']); - print '    
'; - foreach($object->cacheprospectstatus as $key => $val) - { - $titlealt='default'; - if (! empty($val['code']) && ! in_array($val['code'], array('ST_NO', 'ST_NEVER', 'ST_TODO', 'ST_PEND', 'ST_DONE'))) $titlealt=$val['label']; - if ($object->stcomm_id != $val['id']) print ''.img_action($titlealt,$val['code']).''; - } - print '
'; - } - // Preferred shipping Method if (! empty($conf->global->SOCIETE_ASK_FOR_SHIPPING_METHOD)) { print ''; @@ -442,7 +401,7 @@ if ($id > 0) print ''; if (($action != 'editshipping') && $user->rights->societe->creer) print 'id.'">'.img_edit($langs->trans('SetMode'),1).''; print ''; - print ''; + print ''; if ($action == 'editshipping') { $form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->shipping_method_id,'shipping_method_id'); @@ -459,7 +418,7 @@ if ($id > 0) if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) { $langs->load("categories"); print '' . $langs->trans("CustomersCategoriesShort") . ''; - print ''; + print ''; print $form->showCategories( $object->id, 'customer', 1 ); print ""; } @@ -481,8 +440,8 @@ if ($id > 0) { $langs->load("members"); $langs->load("users"); - print ''.$langs->trans("LinkedToDolibarrMember").''; - print ''; + print ''.$langs->trans("LinkedToDolibarrMember").''; + print ''; $adh=new Adherent($db); $result=$adh->fetch('','',$object->id); if ($result > 0) @@ -500,12 +459,47 @@ if ($id > 0) print ""; + print '
'; + print '
'; + print ''; + + if ($object->client == 2 || $object->client == 3) + { + // Level of prospect + print '"; + print ''; + + // Status + $object->loadCacheOfProspStatus(); + print ''; + } + print "
'; + print ''; + print '
'; + print $langs->trans('ProspectLevel'); + print ''; + if ($action != 'editlevel' && $user->rights->societe->creer) print 'id.'">'.img_edit($langs->trans('Modify'),1).'
'; + print '
'; + if ($action == 'editlevel') + $formcompany->form_prospect_level($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->fk_prospectlevel,'prospect_level_id',1); + else + print $object->getLibProspLevel(); + print "
'.$langs->trans("StatusProsp").''.$object->getLibProspCommStatut(4, $object->cacheprospectstatus[$object->stcomm_id]['label']); + print '    
'; + foreach($object->cacheprospectstatus as $key => $val) + { + $titlealt='default'; + if (! empty($val['code']) && ! in_array($val['code'], array('ST_NO', 'ST_NEVER', 'ST_TODO', 'ST_PEND', 'ST_DONE'))) $titlealt=$val['label']; + if ($object->stcomm_id != $val['id']) print ''.img_action($titlealt,$val['code']).''; + } + print '
"; + print '
'; // Nbre max d'elements des petites listes - $MAXLIST=$conf->global->MAIN_SIZE_SHORTLISTE_LIMIT; + $MAXLIST=$conf->global->MAIN_SIZE_SHORTLIST_LIMIT; // Lien recap $outstandingBills = $object->get_OutstandingBill(); @@ -516,14 +510,33 @@ if ($id > 0) } print ''; + print ''; print ''; - print ''; + print ''; print ''; - print ''; + + // Max outstanding bill + if ($object->client) + { + print ''; + print ''; + print ''; + } + + // Outstanding bill + print ''; print ''; - print ''; + print ''; print ''; + print '
'.$langs->trans("Summary").''.$langs->trans("ShowCustomerPreview").''.$langs->trans("ShowCustomerPreview").'
'; + print $form->editfieldkey("OutstandingBill",'outstanding_limit',$object->outstanding_limit,$object,$user->rights->societe->creer); + print ''; + $limit_field_type = (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE)) ? 'numeric' : 'amount'; + print $form->editfieldval("OutstandingBill",'outstanding_limit',$object->outstanding_limit,$object,$user->rights->societe->creer,$limit_field_type,($object->outstanding_limit != '' ? price($object->outstanding_limit) : '')); + //if (empty($object->outstanding_limit)) print $langs->trans("NoLimit"); + + print '
'.$langs->trans("CurrentOutstandingBill").''.price($outstandingBills).$warn.''.price($outstandingBills).$warn.'
'; print '
'; @@ -558,7 +571,7 @@ if ($id > 0) print ''; print ''; - print ''; print ''."\n"; @@ -828,7 +828,7 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire) $companystatic->code_client = $obj->code_client; $companystatic->code_fournisseur = $obj->code_fournisseur; $companystatic->canvas=$obj->canvas; - print $companystatic->getNomUrl(1, 'company', 44); + print $companystatic->getNomUrl(1, 'customer', 44); print ''; print ''."\n"; diff --git a/htdocs/comm/mailing/advtargetemailing.php b/htdocs/comm/mailing/advtargetemailing.php index be8a63225fe..9cd40a55b8b 100644 --- a/htdocs/comm/mailing/advtargetemailing.php +++ b/htdocs/comm/mailing/advtargetemailing.php @@ -221,7 +221,7 @@ if ($action == 'add') { if ((count($advTarget->thirdparty_lines) > 0) || (count($advTarget->contact_lines) > 0)) { // Add targets into database $obj = new mailing_advthirdparties($db); - $result = $obj->add_to_target($id, $advTarget->thirdparty_lines, $array_query['type_of_target'], $advTarget->contact_lines); + $result = $obj->add_to_target_spec($id, $advTarget->thirdparty_lines, $array_query['type_of_target'], $advTarget->contact_lines); } else { $result = 0; } @@ -967,11 +967,11 @@ if ($object->fetch($id) >= 0) { print ''; print '
'; } - - if (empty($conf->mailchimp->enabled) || (! empty($conf->mailchimp->enabled) && $object->statut != 3)) + + if (empty($conf->mailchimp->enabled) || (! empty($conf->mailchimp->enabled) && $object->statut != 3)) { - // List of recipients (TODO Move code of page cibles.php into a .tpl.php file and make an include here to avoid duplicate content) + // List of recipients (TODO Move code of page cibles.php into a .tpl.php file and make an include here to avoid duplicate content) } } diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index 1a54340e7ce..92dc2726030 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -259,7 +259,8 @@ if (empty($reshook)) } // Fabrication du mail - $mail = new CMailFile($newsubject, $sendto, $from, $newmessage, $arr_file, $arr_mime, $arr_name, '', '', 0, $msgishtml, $errorsto, $arr_css); + $trackid=''; // TODO Define a trackid for mass emailing too. We can use source type for this. + $mail = new CMailFile($newsubject, $sendto, $from, $newmessage, $arr_file, $arr_mime, $arr_name, '', '', 0, $msgishtml, $errorsto, $arr_css, $trackid); if ($mail->error) { @@ -672,9 +673,9 @@ if ($action == 'create') dol_fiche_head(); print '
'; + print ''; print ''; @@ -640,7 +653,7 @@ if ($id > 0) print '
'.$langs->trans("LastPropals",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllPropals").' '.$num.''; print ''; print '
'.$langs->trans("LastPropals",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllPropals").' '.$num.''.img_picto($langs->trans("Statistics"),'stats').'
'; print ''; - print ''; print ''; $i++; @@ -438,7 +438,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande else { $var=!$var; - print ''; + print ''; } print "
'; + print ''; + print ''; } print "
'.$langs->trans("LastCustomerOrders",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllOrders").' '.$num.''; print ''; //if($num2 > 0) print ''; //else print ''; @@ -709,7 +722,7 @@ if ($id > 0) print '
'.$langs->trans("LastCustomerOrders",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllOrders").' '.$num.''.img_picto($langs->trans("Statistics"),'stats').''.img_picto($langs->trans("CreateInvoiceForThisCustomer"),'object_bill').''.img_picto($langs->trans("NoOrdersToInvoice"),'object_bill').'
'; print ''; - print ''; print ''; } $i = 0; @@ -829,7 +842,7 @@ if ($id > 0) print '
'; + print ''; print ''; @@ -768,7 +781,7 @@ if ($id > 0) print ''; print ''; + print '
'.$langs->trans("LastSendings",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllSendings").' '.$num.''; print ''; print '
'.$langs->trans("LastSendings",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllSendings").' '.$num.''.img_picto($langs->trans("Statistics"),'stats').'
'; - print '
'.$langs->trans("LastContracts",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllContracts").' '.$num.'
'.$langs->trans("AllContracts").' '.$num.'
'; print ''; - print ''; + print ''; print ''; $var=!$var; } @@ -894,7 +907,7 @@ if ($id > 0) print '
'.$langs->trans("LastInterventions",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllInterventions").' '.$num.'
'.$langs->trans("LastInterventions",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllInterventions").' '.$num.'
'; print ''; - print ''; + print ''; } print "
'; + print ''; print ''; diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index 6a06aad080f..548cd3bb7e4 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -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 ''; print ''; - print ''; + print ''; if ($i == 0) print ''; print ''; $i++; @@ -197,7 +197,7 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire) else { $var=!$var; - print ''; + print ''; } print "
'.$langs->trans("LastCustomersBills",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllBills").' '.$num.''; print ''; print '
'.$langs->trans("LastCustomersBills",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllBills").' '.$num.''.img_picto($langs->trans("Statistics"),'stats').'
'.$langs->trans("Search").'
:
'.$langs->trans("NoProposal").'
'.$langs->trans("NoProposal").'

"; @@ -277,7 +277,7 @@ if (! empty($conf->supplier_proposal->enabled) && $user->rights->supplier_propos else { $var=!$var; - print '
'.$langs->trans("NoProposal").'
'.$langs->trans("NoProposal").'

"; @@ -357,7 +357,7 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire) else { $var=!$var; - print '
'.$langs->trans("NoOrder").'
'.$langs->trans("NoOrder").'

"; @@ -423,7 +423,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande $companystatic->code_client = $obj->code_client; $companystatic->code_fournisseur = $obj->code_fournisseur; $companystatic->canvas=$obj->canvas; - print $companystatic->getNomUrl(1,'customer',16); + print $companystatic->getNomUrl(1,'supplier',16); print '
'.price($obj->total_ttc).'
'.$langs->trans("NoSupplierOrder").'
'.$langs->trans("NoSupplierOrder").'

"; @@ -729,7 +729,7 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire) $companystatic->code_client = $obj->code_client; $companystatic->code_fournisseur = $obj->code_fournisseur; $companystatic->canvas=$obj->canvas; - print $companystatic->getNomUrl(1, 'company', 44); + print $companystatic->getNomUrl(1, 'customer', 44); print '
'; print dol_print_date($db->jdate($obj->dp),'day').''; print dol_print_date($db->jdate($obj->dp),'day').'
'; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; // Other attributes $parameters=array(); @@ -688,11 +689,11 @@ if ($action == 'create') print '

'; print '
'.$langs->trans("MailTitle").'
'.$langs->trans("MailFrom").'
'.$langs->trans("MailErrorsTo").'
'.$langs->trans("MailTitle").'
'.$langs->trans("MailFrom").'
'.$langs->trans("MailErrorsTo").'
'; - print ''; - print ''; + print ''; - print ''; + print ''; print ''; @@ -875,7 +876,7 @@ else { print "\n\n
\n"; - if (($object->statut == 0) && $user->rights->mailing->creer) + if (($object->statut == 0 || $object->statut == 1) && $user->rights->mailing->creer) { print ''.$langs->trans("EditMailing").''; } @@ -994,7 +995,7 @@ else print '
'.$langs->trans("MailTopic").'
'.$langs->trans("BackgroundColorByDefault").''; + print '
'.$langs->trans("MailTopic").'
'.$langs->trans("BackgroundColorByDefault").''; print $htmlother->selectColor($_POST['bgcolor'],'bgcolor','new_mailing',0); print '
'.$langs->trans("MailMessage").'
'; + print '
'.$langs->trans("MailMessage").'
'; print '
'.$langs->trans("CommonSubstitutions").':
'; foreach($object->substitutionarray as $key => $val) { @@ -791,7 +792,7 @@ else $linkback = ''.$langs->trans("BackToList").''; - print '
'.$langs->trans("Ref").'
'.$langs->trans("Ref").''; print $form->showrefnav($object,'id', $linkback); print '
'; // Subject - print ''; + print ''; // Joined files print '';*/ // Message - print ''; + print ''; print ''; @@ -1113,9 +1114,10 @@ else print '
'.$langs->trans("MailTopic").''.$object->sujet.'
'.$langs->trans("MailTopic").''.$object->sujet.'
'.$langs->trans("MailFile").''; @@ -1020,7 +1021,7 @@ else print '
'.$langs->trans("MailMessage").'
'; + print '
'.$langs->trans("MailMessage").'
'; print '
'.$langs->trans("CommonSubstitutions").':
'; foreach($object->substitutionarray as $key => $val) { @@ -1054,7 +1055,7 @@ else $linkback = ''.$langs->trans("BackToList").''; - print '
'.$langs->trans("Ref").'
'.$langs->trans("Ref").''; print $form->showrefnav($object,'id', $linkback); print '
'; // Subject - print ''; + print ''; - dol_init_file_process($upload_dir); + $trackid=''; // TODO To avoid conflicts with 2 mass emailing, we should set a trackid here, even if we use another one into email header. + dol_init_file_process($upload_dir, $trackid); // Joined files $addfileaction='addfile'; @@ -1154,12 +1156,12 @@ else print ''; // Background color - print ''; // Message - print ''; + print ''; print ''; - print ''; + print ''; - print ''; + print ''; // Errors to - print ''; // Status - print ''; // Nb of distinct emails - print '\n"; print ''; @@ -120,8 +134,11 @@ if ($result) print ''; if (! $filteremail) print ''; print ''; - print '"; + print ''; + print ''; print "\n"; $var=True; @@ -172,6 +189,7 @@ if ($result) print $email->LibStatut($obj->statut,5); } print ''; + print ''; print "\n"; $i++; } diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index f3ebd32fe95..887290b1247 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -5,7 +5,7 @@ * Copyright (C) 2005 Marc Barilley / Ocebo * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2006 Andre Cianfarani - * Copyright (C) 2010-2014 Juanjo Menent + * Copyright (C) 2010-2016 Juanjo Menent * Copyright (C) 2010-2015 Philippe Grand * Copyright (C) 2012-2013 Christophe Battarel * Copyright (C) 2012 Cedric Salvador @@ -26,11 +26,13 @@ * along with this program. If not, see . */ + /** * \file htdocs/comm/propal/card.php * \ingroup propale * \brief Page of commercial proposals card and list */ + require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php'; @@ -136,6 +138,35 @@ if (empty($reshook)) else { if ($object->id > 0) { + if (!empty($conf->global->PROPAL_CLONE_DATE_DELIVERY)) { + //Get difference between old and new delivery date and change lines according to difference + $date_delivery = dol_mktime(12, 0, 0, + GETPOST('date_deliverymonth', 'int'), + GETPOST('date_deliveryday', 'int'), + GETPOST('date_deliveryyear', 'int') + ); + if (!empty($object->date_livraison) && !empty($date_delivery)) + { + //Attempt to get the date without possible hour rounding errors + $old_date_delivery = dol_mktime(12, 0, 0, + dol_print_date($object->date_livraison, '%m'), + dol_print_date($object->date_livraison, '%d'), + dol_print_date($object->date_livraison, '%Y') + ); + //Calculate the difference and apply if necessary + $difference = $date_delivery - $old_date_delivery; + if ($difference != 0) + { + $object->date_livraison = $date_delivery; + foreach ($object->lines as $line) + { + if (isset($line->date_start)) $line->date_start = $line->date_start + $difference; + if (isset($line->date_end)) $line->date_end = $line->date_end + $difference; + } + } + } + } + $result = $object->createFromClone($socid); if ($result > 0) { header("Location: " . $_SERVER['PHP_SELF'] . '?id=' . $result); @@ -245,9 +276,13 @@ if (empty($reshook)) } // Positionne ref client - else if ($action == 'set_ref_client' && $user->rights->propal->creer) + else if ($action == 'setref_client' && $user->rights->propal->creer) { - $object->set_ref_client($user, $_POST['ref_client']); + $result = $object->set_ref_client($user, GETPOST('ref_client')); + if ($result < 0) + { + setEventMessages($object->error, $object->errors, 'errors'); + } } // Set incoterm @@ -279,7 +314,7 @@ if (empty($reshook)) if ($socid < 1) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Customer")), null, 'errors'); - + $action = 'create'; $error ++; } @@ -345,23 +380,13 @@ if (empty($reshook)) $object->origin = GETPOST('origin'); $object->origin_id = GETPOST('originid'); - + // Multicurrency if (!empty($conf->multicurrency->enabled)) { $object->multicurrency_code = GETPOST('multicurrency_code', 'alpha'); } - for($i = 1; $i <= $conf->global->PRODUCT_SHOW_WHEN_CREATE; $i ++) - { - if ($_POST['idprod' . $i]) { - $xid = 'idprod' . $i; - $xqty = 'qty' . $i; - $xremise = 'remise' . $i; - $object->add_product($_POST[$xid], $_POST[$xqty], $_POST[$xremise]); - } - } - // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost($extralabels, $object); if ($ret < 0) { @@ -615,6 +640,7 @@ if (empty($reshook)) $trigger_name='PROPAL_SENTBYMAIL'; $paramname='id'; $mode='emailfromproposal'; + $trackid='pro'.$object->id; include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; @@ -718,7 +744,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 +958,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 +1108,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 +1193,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 +1292,8 @@ if ($action == 'create') if ($origin != 'project' && $originid) { print ''; print ''; + } elseif ($origin == 'project' && !empty($projectid)) { + print ''; } dol_fiche_head(); @@ -1356,7 +1384,7 @@ if ($action == 'create') print ''; // Bank Account - if (! empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL) && $conf->banque->enabled) { + if (! empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL) && ! empty($conf->banque->enabled)) { print ''; @@ -1403,7 +1431,7 @@ if ($action == 'create') print ''; print ''; print ''; } @@ -1432,11 +1460,11 @@ if ($action == 'create') print ''; print ''; print ''; } - + // Public note print ''; print ''; @@ -1521,9 +1549,10 @@ if ($action == 'create') if (empty($conf->global->PROPAL_CLONE_ON_CREATE_PAGE)) print ''; - if (! empty($conf->global->PROPAL_CLONE_ON_CREATE_PAGE) || ! empty($conf->global->PRODUCT_SHOW_WHEN_CREATE)) print '
'.$langs->trans("MailTopic").'
'.$langs->trans("MailTopic").'
'.$langs->trans("BackgroundColorByDefault").''; + print '
'.$langs->trans("BackgroundColorByDefault").''; print $htmlother->selectColor($object->bgcolor,'bgcolor','edit_mailing',0); print '
'.$langs->trans("MailMessage").'
'; + print '
'.$langs->trans("MailMessage").'
'; print '
'.$langs->trans("CommonSubstitutions").':
'; foreach($object->substitutionarray as $key => $val) { diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index d09be0897c3..cc5b16f1935 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -183,30 +183,30 @@ if ($object->fetch($id) >= 0) $linkback = ''.$langs->trans("BackToList").''; - print '
'.$langs->trans("Ref").'
'.$langs->trans("Ref").''; print $form->showrefnav($object,'id', $linkback); print '
'.$langs->trans("MailTitle").''.$object->titre.'
'.$langs->trans("MailTitle").''.$object->titre.'
'.$langs->trans("MailFrom").''.dol_print_email($object->email_from,0,0,0,0,1).'
'.$langs->trans("MailFrom").''.dol_print_email($object->email_from,0,0,0,0,1).'
'.$langs->trans("MailErrorsTo").''.dol_print_email($object->email_errorsto,0,0,0,0,1); + print '
'.$langs->trans("MailErrorsTo").''.dol_print_email($object->email_errorsto,0,0,0,0,1); print '
'.$langs->trans("Status").''.$object->getLibStatut(4); + print '
'.$langs->trans("Status").''.$object->getLibStatut(4); if ($object->statut == 2) print ' ('.$object->countNbOfTargets('alreadysent').'/'.$object->nbemail.')'; print '
'; + print '
'; print $langs->trans("TotalNbOfDistinctRecipients"); print ''; $nbemail = ($object->nbemail?$object->nbemail:'0'); - if (!empty($conf->global->MAILING_LIMIT_SENDBYWEB) && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail) + if (!empty($conf->global->MAILING_LIMIT_SENDBYWEB) && ($conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail) && ($object->statut == 1 || $object->statut == 2)) { $text=$langs->trans('LimitSendingEmailing',$conf->global->MAILING_LIMIT_SENDBYWEB); print $form->textwithpicto($nbemail,$text,1,'warning'); diff --git a/htdocs/comm/mailing/class/mailing.class.php b/htdocs/comm/mailing/class/mailing.class.php index d9cc6f31d23..6a7ae2cefbe 100644 --- a/htdocs/comm/mailing/class/mailing.class.php +++ b/htdocs/comm/mailing/class/mailing.class.php @@ -41,6 +41,8 @@ class Mailing extends CommonObject var $bgcolor; var $bgimage; + var $statut; // Status 0=Draft, 1=Validated, 2=Sent partially, 3=Sent completely + var $email_from; var $email_replyto; var $email_errorsto; @@ -77,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'; diff --git a/htdocs/comm/mailing/list.php b/htdocs/comm/mailing/list.php index 66474afea8e..7542782f6e7 100644 --- a/htdocs/comm/mailing/list.php +++ b/htdocs/comm/mailing/list.php @@ -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 "
   '; - print " '; + $searchpitco=$form->showFilterAndCheckAddButtons(0); + print $searchpitco; + print '
' . $langs->trans('BankAccount') . ''; $form->select_comptes($fk_account, 'fk_account', 0, '', 1); print '
' . $langs->trans("Project") . ''; $numprojet = $formproject->select_projects($soc->id, $projectid, 'projectid', 0); - print '   id).'">' . $langs->trans("AddProject") . ''; + print '   id).'">' . $langs->trans("AddProject") . ''; print '
'.fieldLabel('Currency','multicurrency_code').''; - $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 '
' . $langs->trans('NotePublic') . '
'; if (! empty($conf->global->PROPAL_CLONE_ON_CREATE_PAGE)) { + print '
'; + // For backward compatibility print ''; print ''; @@ -1556,42 +1585,11 @@ if ($action == 'create') } print ''; - if (! empty($conf->global->PRODUCT_SHOW_WHEN_CREATE)) - print ''; - print ''; print ''; } - if (! empty($conf->global->PRODUCT_SHOW_WHEN_CREATE)) - { - print ''; - } - if (! empty($conf->global->PROPAL_CLONE_ON_CREATE_PAGE) || ! empty($conf->global->PRODUCT_SHOW_WHEN_CREATE)) print '
 
' . $langs->trans("CreateEmptyPropal") . '
'; - if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) { - $lib = $langs->trans("ProductsAndServices"); - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - for($i = 1; $i <= $conf->global->PRODUCT_SHOW_WHEN_CREATE; $i ++) { - print ''; - print ''; - print ''; - print ''; - } - print "
' . $lib . '' . $langs->trans("Qty") . '' . $langs->trans("ReductionShort") . '
'; - // multiprix - if ($conf->global->PRODUIT_MULTIPRICES && $soc->price_level) - $form->select_produits('', "idprod" . $i, '', $conf->product->limit_size, $soc->price_level); - else - $form->select_produits('', "idprod" . $i, '', $conf->product->limit_size); - print '%
"; - } - print '
'; + if (! empty($conf->global->PROPAL_CLONE_ON_CREATE_PAGE)) print ''; dol_fiche_end(); @@ -1641,6 +1639,9 @@ if ($action == 'create') // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => // 1), array('type' => 'other','name' => 'socid','label' => $langs->trans("SelectThirdParty"),'value' => $form->select_company(GETPOST('socid', 'int'), 'socid', '(s.client=1 OR s.client=2 OR s.client=3)'))); + if (!empty($conf->global->PROPAL_CLONE_DATE_DELIVERY) && !empty($object->date_livraison)) { + $formquestion[] = array('type' => 'date','name' => 'date_delivery','label' => $langs->trans("DeliveryDate"),'value' => $object->date_livraison); + } // Paiement incomplet. On demande si motif = escompte ou autre $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('ClonePropal'), $langs->trans('ConfirmClonePropal', $object->ref), 'confirm_clone', $formquestion, 'yes', 1); } @@ -1698,26 +1699,80 @@ if ($action == 'create') // Print form confirm print $formconfirm; - print ''; + // Proposal card + $linkback = '' . $langs->trans("BackToList") . ''; - // Ref + + $morehtmlref='
'; + // Ref customer + $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->propal->creer, 'string', '', 0, 1); + $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->propal->creer, 'string', '', null, null, '', 1); + // Thirdparty + $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $soc->getNomUrl(1); + // Project + if (! empty($conf->projet->enabled)) + { + $langs->load("projects"); + $morehtmlref.='
'.$langs->trans('Project') . ' '; + if ($user->rights->propal->creer) + { + if ($action != 'classify') + $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.='
'; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.=''; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (! empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref.=''; + $morehtmlref.=$proj->ref; + $morehtmlref.=''; + } else { + $morehtmlref.=''; + } + } + } + $morehtmlref.='
'; + + + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + + + print '
'; + print '
'; + print '
'; + + print '
'; + + // Ref + /* print ''; + */ // Ref customer + /* print '
' . $langs->trans('Ref') . ''; print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', ''); print '
'; print ''; if ($action != 'refclient' && ! empty($object->brouillon)) print ''; - print ''; - print '
'; print $langs->trans('RefCustomer') . '' . img_edit($langs->trans('Modify')) . '
'; + print '
'; print ''; if ($user->rights->propal->creer && $action == 'refclient') { - print '
'; + print ''; print ''; print ''; print ''; @@ -1728,13 +1783,15 @@ if ($action == 'create') } print ''; print ''; - + */ + // Company + /* print '' . $langs->trans('Company') . '' . $soc->getNomUrl(1) . ''; - print ''; + print '';*/ // Lin for thirdparty discounts - print '' . $langs->trans('Discounts') . ''; + print '' . $langs->trans('Discounts') . ''; if ($soc->remise_percent) print $langs->trans("CompanyHasRelativeDiscount", $soc->remise_percent); else @@ -1770,7 +1827,7 @@ if ($action == 'create') if ($action != 'editdate' && ! empty($object->brouillon)) print 'id . '">' . img_edit($langs->trans('SetDate'), 1) . ''; print ''; - print ''; + print ''; if (! empty($object->brouillon) && $action == 'editdate') { print ''; print ''; @@ -1796,7 +1853,7 @@ if ($action == 'create') if ($action != 'editecheance' && ! empty($object->brouillon)) print 'id . '">' . img_edit($langs->trans('SetConditions'), 1) . ''; print ''; - print ''; + print ''; if (! empty($object->brouillon) && $action == 'editecheance') { print ''; print ''; @@ -1824,7 +1881,7 @@ if ($action == 'create') if ($action != 'editconditions' && ! empty($object->brouillon)) print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetConditions'), 1) . ''; print ''; - print ''; + print ''; if ($action == 'editconditions') { $form->form_conditions_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->cond_reglement_id, 'cond_reglement_id'); } else { @@ -1836,9 +1893,9 @@ if ($action == 'create') // Delivery date $langs->load('deliveries'); print ''; - print $form->editfieldkey($langs->trans('DeliveryDate'), 'date_livraison', $object->date_livraison, $object, $user->rights->propal->creer); - print ''; - print $form->editfieldval($langs->trans('DeliveryDate'), 'date_livraison', $object->date_livraison, $object, $user->rights->propal->creer, 'day'); + print $form->editfieldkey($langs->trans('DeliveryDate'), 'date_livraison', $object->date_livraison, $object, $user->rights->propal->creer, 'datepicker'); + print ''; + print $form->editfieldval($langs->trans('DeliveryDate'), 'date_livraison', $object->date_livraison, $object, $user->rights->propal->creer, 'datepicker'); print ''; print ''; @@ -1852,7 +1909,7 @@ if ($action == 'create') if ($action != 'editavailability' && ! empty($object->brouillon)) print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetAvailability'), 1) . ''; print ''; - print ''; + print ''; if ($action == 'editavailability') { $form->form_availability($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->availability_id, 'availability_id', 1); } else { @@ -1871,7 +1928,7 @@ if ($action == 'create') if ($action != 'editshippingmethod' && $user->rights->propal->creer) print 'id.'">'.img_edit($langs->trans('SetShippingMode'),1).''; print ''; - print ''; + print ''; if ($action == 'editshippingmethod') { $form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$object->id, $object->shipping_method_id, 'shipping_method_id', 1); } else { @@ -1889,7 +1946,7 @@ if ($action == 'create') if ($action != 'editdemandreason' && ! empty($object->brouillon)) print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetDemandReason'), 1) . ''; print ''; - print ''; + print ''; if ($action == 'editdemandreason') { $form->formInputReason($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->demand_reason_id, 'demand_reason_id', 1); } else { @@ -1900,14 +1957,14 @@ if ($action == 'create') // Payment mode print ''; - print ''; + print ''; print ''; if ($action != 'editmode' && ! empty($object->brouillon)) print ''; print '
'; print $langs->trans('PaymentMode'); print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMode'), 1) . '
'; - print ''; + print ''; if ($action == 'editmode') { $form->form_modes_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->mode_reglement_id, 'mode_reglement_id'); } else { @@ -1920,31 +1977,31 @@ if ($action == 'create') { // Multicurrency code print ''; - print ''; + print ''; print ''; if ($action != 'editmulticurrencycode' && ! empty($object->brouillon)) print ''; print '
'; print fieldLabel('Currency','multicurrency_code'); print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '
'; - print ''; + print ''; if ($action == 'editmulticurrencycode') { $form->form_multicurrency_code($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_code, 'multicurrency_code'); } else { $form->form_multicurrency_code($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_code, 'none'); } print ''; - + // Multicurrency rate print ''; - print ''; + print ''; print ''; if ($action != 'editmulticurrencyrate' && ! empty($object->brouillon)) print ''; print '
'; - print fieldLabel('Rate','multicurrency_tx'); + print fieldLabel('CurrencyRate','multicurrency_tx'); print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '
'; - print ''; + print ''; if ($action == 'editmulticurrencyrate') { $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code); } else { @@ -1954,6 +2011,7 @@ if ($action == 'create') } // Project + /* if (! empty($conf->projet->enabled)) { $langs->load("projects"); @@ -1987,21 +2045,21 @@ if ($action == 'create') } } print ''; - } + }*/ if ($soc->outstanding_limit) { // Outstanding Bill print ''; print $langs->trans('OutstandingBill'); - print ''; + print ''; print price($soc->get_OutstandingBill()) . ' / '; print price($soc->outstanding_limit, 0, $langs, 1, - 1, - 1, $conf->currency); print ''; print ''; } - if (! empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL) && $conf->banque->enabled) + if (! empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL) && ! empty($conf->banque->enabled)) { // Bank Account print ''; @@ -2011,7 +2069,7 @@ if ($action == 'create') if ($action != 'editbankaccount' && $user->rights->propal->creer) print 'id.'">'.img_edit($langs->trans('SetBankAccount'),1).''; print ''; - print ''; + print ''; if ($action == 'editbankaccount') { $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1); } else { @@ -2032,7 +2090,7 @@ if ($action == 'create') else print ' '; print ''; print ''; - print ''; + print ''; if ($action != 'editincoterm') { print $form->textwithpicto($object->display_incoterms(), $object->libelle_incoterms, 1); @@ -2045,71 +2103,81 @@ if ($action == 'create') } // Other attributes - $cols = 5; + $cols = 2; include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; + print ''; + + print '
'; + print '
'; + print '
'; + print '
'; + + print ''; + + if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency)) + { + // Multicurrency Amount HT + print ''; + print ''; + print ''; + + // Multicurrency Amount VAT + print ''; + print ''; + print ''; + + // Multicurrency Amount TTC + print ''; + print ''; + print ''; + } + // Amount HT - print ''; - print ''; - - // Margin Infos - if (! empty($conf->margin->enabled)) - { - $rowspan=4; - if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) $rowspan++; - if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) $rowspan++; - print ''; - } + print ''; + print ''; print ''; - + // Amount VAT - print ''; - print ''; + print ''; + print ''; print ''; - + // Amount Local Taxes if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) // Localtax1 { - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; } if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) // Localtax2 { - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; } - + // Amount TTC - print ''; - print ''; + print ''; + print ''; print ''; - if (!empty($conf->multicurrency->enabled)) + // Statut + //print ''; + + print '
' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . '' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . '' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . '' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . $langs->trans('AmountHT') . '' . price($object->total_ht, '', $langs, 0, - 1, - 1, $conf->currency) . ''; - $formmargin->displayMarginInfos($object); - print '
' . $langs->trans('AmountHT') . '' . price($object->total_ht, '', $langs, 0, - 1, - 1, $conf->currency) . '
' . $langs->trans('AmountVAT') . '' . price($object->total_tva, '', $langs, 0, - 1, - 1, $conf->currency) . '
' . $langs->trans('AmountVAT') . '' . price($object->total_tva, '', $langs, 0, - 1, - 1, $conf->currency) . '
' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '' . price($object->total_localtax1, '', $langs, 0, - 1, - 1, $conf->currency) . '
' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '' . price($object->total_localtax1, '', $langs, 0, - 1, - 1, $conf->currency) . '
' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '' . price($object->total_localtax2, '', $langs, 0, - 1, - 1, $conf->currency) . '
' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '' . price($object->total_localtax2, '', $langs, 0, - 1, - 1, $conf->currency) . '
' . $langs->trans('AmountTTC') . '' . price($object->total_ttc, '', $langs, 0, - 1, - 1, $conf->currency) . '
' . $langs->trans('AmountTTC') . '' . price($object->total_ttc, '', $langs, 0, - 1, - 1, $conf->currency) . '
' . $langs->trans('Status') . '' . $object->getLibStatut(4) . '
'; + + // Margin Infos + if (! empty($conf->margin->enabled)) { - // Multicurrency Amount HT - print '' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . ''; - print '' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . ''; - print ''; - - // Multicurrency Amount VAT - print '' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . ''; - print '' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . ''; - print ''; - - // Multicurrency Amount TTC - print '' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . ''; - print '' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . ''; - print ''; + $formmargin->displayMarginInfos($object); } - // Statut - print '' . $langs->trans('Status') . '' . $object->getLibStatut(4) . ''; - - print '
'; + print '
'; + print '
'; + print '
'; + + print '

'; if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) { $blocname = 'contacts'; @@ -2304,8 +2372,6 @@ if ($action == 'create') if ($action != 'presend') { print '
'; - // print '
'; - // print ''; // ancre /* * Documents generes @@ -2318,25 +2384,20 @@ if ($action == 'create') $var = true; - $somethingshown = $formfile->show_documents('propal', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', 0, '', $soc->default_lang); - - // Linked object block - $somethingshown = $form->showLinkedObjectBlock($object); + print $formfile->showdocuments('propal', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', 0, '', $soc->default_lang); // Show links to link elements - $linktoelem = $form->showLinkToObjectBlock($object); - if ($linktoelem) print '
'.$linktoelem; - + $linktoelem = $form->showLinkToObjectBlock($object, null, array('propal')); + $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem); + print '
'; - // print '
'; // List of actions on element include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php'; $formactions = new FormActions($db); $somethingshown = $formactions->showactions($object, 'propal', $socid); - // print '
'; print '
'; } @@ -2388,16 +2449,18 @@ if ($action == 'create') include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; $formmail = new FormMail($db); $formmail->param['langsmodels']=(empty($newlang)?$langs->defaultlang:$newlang); - $formmail->fromtype = 'user'; - $formmail->fromid = $user->id; - $formmail->fromname = $user->getFullName($langs); - $formmail->frommail = $user->email; + $formmail->fromtype = (GETPOST('fromtype')?GETPOST('fromtype'):(!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE)?$conf->global->MAIN_MAIL_DEFAULT_FROMTYPE:'user')); + + if($formmail->fromtype === 'user'){ + $formmail->fromid = $user->id; + + } $formmail->trackid='pro'.$object->id; if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set { 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) @@ -2417,7 +2480,7 @@ if ($action == 'create') // Tableau des substitutions $formmail->setSubstitFromObject($object); - $formmail->substit['__PROPREF__'] = $object->ref; + $formmail->substit['__PROPREF__'] = $object->ref; // For backward compatibility // Find the good contact adress $custcontact = ''; diff --git a/htdocs/comm/propal/class/api_proposals.class.php b/htdocs/comm/propal/class/api_proposals.class.php new file mode 100644 index 00000000000..84a7a1a1a1c --- /dev/null +++ b/htdocs/comm/propal/class/api_proposals.class.php @@ -0,0 +1,506 @@ + + * Copyright (C) 2016 Laurent Destailleur + * + * 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 . + */ + + use Luracast\Restler\RestException; + + require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; + +/** + * API class for orders + * + * @access protected + * @class DolibarrApiAccess {@requires user,external} + */ +class Proposals extends DolibarrApi +{ + + /** + * @var array $FIELDS Mandatory fields, checked when create and update object + */ + static $FIELDS = array( + 'socid' + ); + + /** + * @var propal $propal {@type propal} + */ + public $propal; + + /** + * Constructor + */ + function __construct() + { + global $db, $conf; + $this->db = $db; + $this->propal = new Propal($this->db); + } + + /** + * Get properties of a commercial proposal object + * + * Return an array with commercial proposal informations + * + * @param int $id ID of commercial proposal + * @return array|mixed data without useless information + * + * @throws RestException + */ + function get($id) + { + if(! DolibarrApiAccess::$user->rights->propal->lire) { + throw new RestException(401); + } + + $result = $this->propal->fetch($id); + if( ! $result ) { + throw new RestException(404, 'Commercial Proposal not found'); + } + + if( ! DolibarrApi::_checkAccessToResource('propal',$this->propal->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + + $this->propal->fetchObjectLinked(); + return $this->_cleanObjectDatas($this->propal); + } + + /** + * List commercial proposals + * + * Get a list of commercial proposals + * + * @param string $sortfield Sort field + * @param string $sortorder Sort order + * @param int $limit Limit for list + * @param int $page Page number + * @param string $thirdparty_ids Thirdparty ids to filter commercial proposal of. Example: '1' or '1,2,3' {@pattern /^[0-9,]*$/i} + * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" + * @return array Array of order objects + */ + function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 0, $page = 0, $thirdparty_ids = '', $sqlfilters = '') { + global $db, $conf; + + $obj_ret = array(); + // case of external user, $thirdpartyid param is ignored and replaced by user's socid + $socids = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : $thirdparty_ids; + + // If the internal user must only see his customers, force searching by him + if (! DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) $search_sale = DolibarrApiAccess::$user->id; + + $sql = "SELECT t.rowid"; + if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects) + $sql.= " FROM ".MAIN_DB_PREFIX."propal as t"; + + if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale + + $sql.= ' WHERE t.entity IN ('.getEntity('propal', 1).')'; + if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql.= " AND t.fk_soc = sc.fk_soc"; + if ($socids) $sql.= " AND t.fk_soc IN (".$socids.")"; + if ($search_sale > 0) $sql.= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale + // Insert sale filter + if ($search_sale > 0) + { + $sql .= " AND sc.fk_user = ".$search_sale; + } + // Add sql filters + if ($sqlfilters) + { + if (! DolibarrApi::_checkFilters($sqlfilters)) + { + throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); + } + $regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; + } + + $sql.= $db->order($sortfield, $sortorder); + if ($limit) { + if ($page < 0) + { + $page = 0; + } + $offset = $limit * $page; + + $sql.= $db->plimit($limit + 1, $offset); + } + + $result = $db->query($sql); + + if ($result) + { + $num = $db->num_rows($result); + while ($i < min($num, ($limit <= 0 ? $num : $limit))) + { + $obj = $db->fetch_object($result); + $propal_static = new Propal($db); + if($propal_static->fetch($obj->rowid)) { + $obj_ret[] = parent::_cleanObjectDatas($propal_static); + } + $i++; + } + } + else { + throw new RestException(503, 'Error when retrieve propal list'); + } + if( ! count($obj_ret)) { + throw new RestException(404, 'No order found'); + } + return $obj_ret; + } + + /** + * Create commercial proposal object + * + * @param array $request_data Request data + * @return int ID of propal + */ + function post($request_data = NULL) + { + if(! DolibarrApiAccess::$user->rights->propal->creer) { + throw new RestException(401, "Insuffisant rights"); + } + // Check mandatory fields + $result = $this->_validate($request_data); + + foreach($request_data as $field => $value) { + $this->propal->$field = $value; + } + /*if (isset($request_data["lines"])) { + $lines = array(); + foreach ($request_data["lines"] as $line) { + array_push($lines, (object) $line); + } + $this->propal->lines = $lines; + }*/ + if ($this->propal->create(DolibarrApiAccess::$user) <= 0) { + $errormsg = $this->propal->error; + throw new RestException(500, $errormsg ? $errormsg : "Error while creating order"); + } + + return $this->propal->id; + } + + /** + * Get lines of a commercial proposal + * + * @param int $id Id of commercial proposal + * + * @url GET {id}/lines + * + * @return int + */ + function getLines($id) { + if(! DolibarrApiAccess::$user->rights->propal->lire) { + throw new RestException(401); + } + + $result = $this->propal->fetch($id); + if( ! $result ) { + throw new RestException(404, 'Commercial Proposal not found'); + } + + if( ! DolibarrApi::_checkAccessToResource('propal',$this->propal->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + $this->propal->getLinesArray(); + $result = array(); + foreach ($this->propal->lines as $line) { + array_push($result,$this->_cleanObjectDatas($line)); + } + return $result; + } + + /** + * Add a line to given commercial proposal + * + * @param int $id Id of commercial proposal to update + * @param array $request_data Commercial proposal line data + * + * @url POST {id}/lines + * + * @return int + */ + function postLine($id, $request_data = NULL) { + if(! DolibarrApiAccess::$user->rights->propal->creer) { + throw new RestException(401); + } + + $result = $this->propal->fetch($id); + if( ! $result ) { + throw new RestException(404, 'Commercial Proposal not found'); + } + + if( ! DolibarrApi::_checkAccessToResource('propal',$this->propal->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + $request_data = (object) $request_data; + $updateRes = $this->propal->addline( + $request_data->desc, + $request_data->subprice, + $request_data->qty, + $request_data->tva_tx, + $request_data->localtax1_tx, + $request_data->localtax2_tx, + $request_data->fk_product, + $request_data->remise_percent, + $request_data->info_bits, + $request_data->fk_remise_except, + 'HT', + 0, + $request_data->date_start, + $request_data->date_end, + $request_data->product_type, + $request_data->rang, + $request_data->special_code, + $fk_parent_line, + $request_data->fk_fournprice, + $request_data->pa_ht, + $request_data->label, + $request_data->array_options, + $request_data->fk_unit, + $this->element, + $request_data->id + ); + + if ($updateRes > 0) { + return $this->get($id)->line->rowid; + + } + return false; + } + + /** + * Update a line of given commercial proposal + * + * @param int $id Id of commercial proposal to update + * @param int $lineid Id of line to update + * @param array $request_data Commercial proposal line data + * + * @url PUT {id}/lines/{lineid} + * + * @return object + */ + function putLine($id, $lineid, $request_data = NULL) { + if(! DolibarrApiAccess::$user->rights->propal->creer) { + throw new RestException(401); + } + + $result = $this->propal->fetch($id); + if( ! $result ) { + throw new RestException(404, 'Proposal not found'); + } + + if( ! DolibarrApi::_checkAccessToResource('propal',$this->propal->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + $request_data = (object) $request_data; + $updateRes = $this->propal->updateline( + $lineid, + $request_data->desc, + $request_data->subprice, + $request_data->qty, + $request_data->remise_percent, + $request_data->tva_tx, + $request_data->localtax1_tx, + $request_data->localtax2_tx, + 'HT', + $request_data->info_bits, + $request_data->date_start, + $request_data->date_end, + $request_data->product_type, + $request_data->fk_parent_line, + 0, + $request_data->fk_fournprice, + $request_data->pa_ht, + $request_data->label, + $request_data->special_code, + $request_data->array_options, + $request_data->fk_unit + ); + + if ($updateRes > 0) { + $result = $this->get($id); + unset($result->line); + return $this->_cleanObjectDatas($result); + } + return false; + } + + /** + * Delete a line of given commercial proposal + * + * + * @param int $id Id of commercial proposal to update + * @param int $lineid Id of line to delete + * + * @url DELETE {id}/lines/{lineid} + * + * @return int + */ + function delLine($id, $lineid) { + if(! DolibarrApiAccess::$user->rights->propal->creer) { + throw new RestException(401); + } + + $result = $this->propal->fetch($id); + if( ! $result ) { + throw new RestException(404, 'Proposal not found'); + } + + if( ! DolibarrApi::_checkAccessToResource('propal',$this->propal->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + $request_data = (object) $request_data; + $updateRes = $this->propal->deleteline($lineid); + if ($updateRes == 1) { + return $this->get($id); + } + return false; + } + + /** + * Update commercial proposal general fields (won't touch lines of commercial proposal) + * + * @param int $id Id of commercial proposal to update + * @param array $request_data Datas + * + * @return int + */ + function put($id, $request_data = NULL) { + if(! DolibarrApiAccess::$user->rights->propal->creer) { + throw new RestException(401); + } + + $result = $this->propal->fetch($id); + if( ! $result ) { + throw new RestException(404, 'Proposal not found'); + } + + if( ! DolibarrApi::_checkAccessToResource('propal',$this->propal->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + foreach($request_data as $field => $value) { + $this->propal->$field = $value; + } + + if($this->propal->update($id, DolibarrApiAccess::$user,1,'','','update')) + return $this->get($id); + + return false; + } + + /** + * Delete commercial proposal + * + * @param int $id Commercial proposal ID + * + * @return array + */ + function delete($id) + { + if(! DolibarrApiAccess::$user->rights->propal->supprimer) { + throw new RestException(401); + } + $result = $this->propal->fetch($id); + if( ! $result ) { + throw new RestException(404, 'Commercial Proposal not found'); + } + + if( ! DolibarrApi::_checkAccessToResource('propal',$this->propal->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + + if( ! $this->propal->delete(DolibarrApiAccess::$user)) { + throw new RestException(500, 'Error when delete Commercial Proposal : '.$this->propal->error); + } + + return array( + 'success' => array( + 'code' => 200, + 'message' => 'Commercial Proposal deleted' + ) + ); + + } + + /** + * Validate a commercial proposal + * + * @param int $id Commercial proposal ID + * @param int $notrigger Use {} + * + * @url POST {id}/validate + * + * @return array + * FIXME An error 403 is returned if the request has an empty body. + * Error message: "Forbidden: Content type `text/plain` is not supported." + * Workaround: send this in the body + * { + * "notrigger": 0 + * } + */ + function validate($id, $notrigger=0) + { + if(! DolibarrApiAccess::$user->rights->propal->creer) { + throw new RestException(401); + } + $result = $this->propal->fetch($id); + if( ! $result ) { + throw new RestException(404, 'Commercial Proposal not found'); + } + + if( ! DolibarrApi::_checkAccessToResource('propal',$this->propal->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + + $result = $this->propal->valid(DolibarrApiAccess::$user, $notrigger); + if ($result == 0) { + throw new RestException(500, 'Error nothing done. May be object is already validated'); + } + if ($result < 0) { + throw new RestException(500, 'Error when validating Commercial Proposal: '.$this->propal->error); + } + + return array( + 'success' => array( + 'code' => 200, + 'message' => 'Commercial Proposal validated' + ) + ); + } + + /** + * Validate fields before create or update object + * + * @param array $data Array with data to verify + * @return array + * @throws RestException + */ + function _validate($data) + { + $propal = array(); + foreach (Orders::$FIELDS as $field) { + if (!isset($data[$field])) + throw new RestException(400, "$field field missing"); + $propal[$field] = $data[$field]; + + } + return $propal; + } +} diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 1ff75f2b661..df2c1cef9fc 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -7,7 +7,7 @@ * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2008 Raphael Bertrand * Copyright (C) 2010-2014 Juanjo Menent - * Copyright (C) 2010-2011 Philippe Grand + * Copyright (C) 2010-2016 Philippe Grand * Copyright (C) 2012-2014 Christophe Battarel * Copyright (C) 2012 Cedric Salvador * Copyright (C) 2013 Florian Henry @@ -49,7 +49,8 @@ class Propal extends CommonObject public $table_element_line='propaldet'; public $fk_element='fk_propal'; protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe - + public $picto='propal'; + /** * {@inheritdoc} */ @@ -59,24 +60,24 @@ class Propal extends CommonObject * ID of the client * @var int */ - var $socid; + public $socid; - var $contactid; - var $author; - var $ref_client; + public $contactid; + public $author; + public $ref_client; /** * Status of the quote * @var int * @see Propal::STATUS_DRAFT, Propal::STATUS_VALIDATED, Propal::STATUS_SIGNED, Propal::STATUS_NOTSIGNED, Propal::STATUS_BILLED */ - var $statut; + public $statut; /** * @deprecated * @see date_creation */ - var $datec; + public $datec; /** * Creation date @@ -88,7 +89,7 @@ class Propal extends CommonObject * @deprecated * @see date_validation */ - var $datev; + public $datev; /** * Validation date @@ -100,71 +101,73 @@ class Propal extends CommonObject * Date of the quote * @var */ - var $date; + public $date; /** * @deprecated * @see date */ - var $datep; - var $date_livraison; - var $fin_validite; + public $datep; + public $date_livraison; + public $fin_validite; - var $user_author_id; - var $user_valid_id; - var $user_close_id; + public $user_author_id; + public $user_valid_id; + public $user_close_id; /** * @deprecated * @see total_ht */ - var $price; + public $price; /** * @deprecated * @see total_tva */ - var $tva; + public $tva; /** * @deprecated * @see total_ttc */ - var $total; + public $total; - var $cond_reglement_code; - var $mode_reglement_code; - var $remise; - var $remise_percent; - var $remise_absolue; - var $fk_address; - var $address_type; - var $address; - var $availability_id; - var $availability_code; - var $demand_reason_id; - var $demand_reason_code; + public $cond_reglement_code; + public $mode_reglement_code; + public $remise; + public $remise_percent; + public $remise_absolue; + public $fk_address; + public $address_type; + public $address; + public $availability_id; + public $availability_code; + public $demand_reason_id; + public $demand_reason_code; - var $products=array(); - var $extraparams=array(); + public $products=array(); + public $extraparams=array(); /** * @var PropaleLigne[] */ - var $lines = array(); - var $line; + public $lines = array(); + public $line; - var $labelstatut=array(); - var $labelstatut_short=array(); + public $labelstatut=array(); + public $labelstatut_short=array(); - var $specimen; + public $specimen; // Multicurrency - var $fk_multicurrency; - var $multicurrency_code; - var $multicurrency_tx; - var $multicurrency_total_ht; - var $multicurrency_total_tva; - var $multicurrency_total_ttc; - + public $fk_multicurrency; + public $multicurrency_code; + public $multicurrency_tx; + public $multicurrency_total_ht; + public $multicurrency_total_tva; + public $multicurrency_total_ttc; + + public $oldcopy; + /** * Draft status */ @@ -223,15 +226,15 @@ class Propal extends CommonObject /** * Add line into array products - * $this->client doit etre charge + * $this->thirdparty should be loaded * * @param int $idproduct Product Id to add * @param int $qty Quantity * @param int $remise_percent Discount effected on Product * @return int <0 if KO, >0 if OK * - * TODO Remplacer les appels a cette fonction par generation objet Ligne - * insere dans tableau $this->products + * TODO Replace calls to this function by generation objet Ligne + * inserted into table $this->products */ function add_product($idproduct, $qty, $remise_percent=0) { @@ -253,7 +256,7 @@ class Propal extends CommonObject $localtax1_tx = get_localtax($tva_tx,1,$mysoc,$this->thirdparty,$tva_npr); $localtax2_tx = get_localtax($tva_tx,2,$mysoc,$this->thirdparty,$tva_npr); - // multiprix + // multiprices if($conf->global->PRODUIT_MULTIPRICES && $this->thirdparty->price_level) { $price = $prod->multiprices[$this->thirdparty->price_level]; @@ -273,7 +276,7 @@ class Propal extends CommonObject $line->tva_tx=$tva_tx; $line->fk_unit=$prod->fk_unit; if ($tva_npr) $line->info_bits = 1; - + $this->lines[]=$line; } } @@ -314,7 +317,7 @@ class Propal extends CommonObject $line->desc=$remise->description; // Description ligne $line->tva_tx=$remise->tva_tx; $line->subprice=-$remise->amount_ht; - $line->fk_product=0; // Id produit predefini + $line->fk_product=0; // Id produit predefined $line->qty=1; $line->remise=0; $line->remise_percent=0; @@ -359,10 +362,10 @@ class Propal extends CommonObject /** * Add a proposal line into database (linked to product/service or not) - * Les parametres sont deja cense etre juste et avec valeurs finales a l'appel - * de cette methode. Aussi, pour le taux tva, il doit deja avoir ete defini - * par l'appelant par la methode get_default_tva(societe_vendeuse,societe_acheteuse,'',produit) - * et le desc doit deja avoir la bonne valeur (a l'appelant de gerer le multilangue) + * The parameters are already supposed to be appropriate and with final values to the call + * of this method. Also, for the VAT rate, it must have already been defined + * by whose calling the method get_default_tva (societe_vendeuse, societe_acheteuse, '' product) + * and desc must already have the right value (it's up to the caller to manage multilanguage) * * @param string $desc Description de la ligne * @param float $pu_ht Prix unitaire @@ -438,12 +441,13 @@ class Propal extends CommonObject $product_type=$product->type; if (! empty($conf->global->STOCK_MUST_BE_ENOUGH_FOR_PROPOSAL) && $product_type == 0 && $product->stock_reel < $qty) { - $this->error=$langs->trans('ErrorStockIsNotEnough'); + $langs->load("errors"); + $this->error=$langs->trans('ErrorStockIsNotEnoughToAddProductOnProposal', $product->ref); $this->db->rollback(); return -3; } } - + // Calcul du total TTC et de la TVA pour la ligne a partir de // qty, pu, remise_percent et txtva // TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker @@ -451,7 +455,7 @@ class Propal extends CommonObject $localtaxes_type=getLocalTaxesFromRate($txtva,0,$this->thirdparty,$mysoc); $txtva = preg_replace('/\s*\(.*\)/','',$txtva); // Remove code into vatrate. - + $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $product_type, $mysoc, $localtaxes_type, 100, $this->multicurrency_tx); $total_ht = $tabprice[0]; @@ -528,7 +532,7 @@ class Propal extends CommonObject $this->line->multicurrency_total_ht = $multicurrency_total_ht; $this->line->multicurrency_total_tva = $multicurrency_total_tva; $this->line->multicurrency_total_ttc = $multicurrency_total_ttc; - + // Mise en option de la ligne if (empty($qty) && empty($special_code)) $this->line->special_code=3; @@ -626,7 +630,7 @@ class Propal extends CommonObject $localtaxes_type=getLocalTaxesFromRate($txtva,0,$this->thirdparty,$mysoc); $txtva = preg_replace('/\s*\(.*\)/','',$txtva); // Remove code into vatrate. - + $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $mysoc, $localtaxes_type, 100, $this->multicurrency_tx); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; @@ -638,7 +642,7 @@ class Propal extends CommonObject $multicurrency_total_ht = $tabprice[16]; $multicurrency_total_tva = $tabprice[17]; $multicurrency_total_ttc = $tabprice[18]; - + // Anciens indicateurs: $price, $remise (a ne plus utiliser) $price = $pu; if ($remise_percent > 0) @@ -775,7 +779,7 @@ class Propal extends CommonObject * this->ref can be set or empty. If empty, we will use "(PROVid)" * * @param User $user User that create - * @param int $notrigger 1=Does not execute triggers, 0= execuete triggers + * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >=0 if OK */ function create($user, $notrigger=0) @@ -799,7 +803,7 @@ class Propal extends CommonObject $this->fk_multicurrency = 0; $this->multicurrency_tx = 1; } - + dol_syslog(get_class($this)."::create"); // Check parameters @@ -925,7 +929,7 @@ class Propal extends CommonObject for ($i=0;$i<$num;$i++) { - // Reset fk_parent_line for no child products and special product + // Reset fk_parent_line for line that are not child lines or special product if (($this->lines[$i]->product_type != 9 && empty($this->lines[$i]->fk_parent_line)) || $this->lines[$i]->product_type == 9) { $fk_parent_line = 0; } @@ -941,7 +945,7 @@ class Propal extends CommonObject $this->lines[$i]->remise_percent, 'HT', 0, - 0, + $this->lines[$i]->info_bits, $this->lines[$i]->product_type, $this->lines[$i]->rang, $this->lines[$i]->special_code, @@ -1109,7 +1113,7 @@ class Propal extends CommonObject $clonedObj->cond_reglement_id = (! empty($objsoc->cond_reglement_id) ? $objsoc->cond_reglement_id : 0); $clonedObj->mode_reglement_id = (! empty($objsoc->mode_reglement_id) ? $objsoc->mode_reglement_id : 0); $clonedObj->fk_delivery_address = ''; - + /*if (!empty($conf->projet->enabled)) { $project = new Project($db); @@ -1157,6 +1161,7 @@ class Propal extends CommonObject $clonedObj->ref = $modPropale->getNextValue($objsoc,$clonedObj); // Create clone + $result=$clonedObj->create($user); if ($result < 0) $error++; else @@ -1500,8 +1505,8 @@ class Propal extends CommonObject * Set status to validated * * @param User $user Object user that validate - * @param int $notrigger 1=Does not execute triggers, 0= execuete triggers - * @return int <0 if KO, >=0 if OK + * @param int $notrigger 1=Does not execute triggers, 0=execute triggers + * @return int <0 if KO, 0=Nothing done, >=0 if OK */ function valid($user, $notrigger=0) { @@ -1510,98 +1515,110 @@ class Propal extends CommonObject global $conf; $error=0; - $now=dol_now(); - if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->propal->creer)) - || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->propal->propal_advance->validate))) + // Protection + if ($this->statut == self::STATUS_VALIDATED) { - $this->db->begin(); + dol_syslog(get_class($this)."::valid action abandonned: already validated", LOG_WARNING); + return 0; + } + + if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->propal->creer)) + || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->propal->propal_advance->validate)))) + { + $this->error='ErrorPermissionDenied'; + dol_syslog(get_class($this)."::valid ".$this->error, LOG_ERR); + return -1; + } - // Numbering module definition - $soc = new Societe($this->db); - $soc->fetch($this->socid); + $now=dol_now(); + + $this->db->begin(); - // Define new ref - if (! $error && (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref))) // empty should not happened, but when it occurs, the test save life - { - $num = $this->getNextNumRef($soc); - } - else - { - $num = $this->ref; - } - $this->newref = $num; + // Numbering module definition + $soc = new Societe($this->db); + $soc->fetch($this->socid); - $sql = "UPDATE ".MAIN_DB_PREFIX."propal"; - $sql.= " SET ref = '".$num."',"; - $sql.= " fk_statut = ".self::STATUS_VALIDATED.", date_valid='".$this->db->idate($now)."', fk_user_valid=".$user->id; - $sql.= " WHERE rowid = ".$this->id." AND fk_statut = ".self::STATUS_DRAFT; + // Define new ref + if (! $error && (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref))) // empty should not happened, but when it occurs, the test save life + { + $num = $this->getNextNumRef($soc); + } + else + { + $num = $this->ref; + } + $this->newref = $num; - dol_syslog(get_class($this)."::valid", LOG_DEBUG); - $resql=$this->db->query($sql); - if (! $resql) - { - dol_print_error($this->db); - $error++; - } + $sql = "UPDATE ".MAIN_DB_PREFIX."propal"; + $sql.= " SET ref = '".$num."',"; + $sql.= " fk_statut = ".self::STATUS_VALIDATED.", date_valid='".$this->db->idate($now)."', fk_user_valid=".$user->id; + $sql.= " WHERE rowid = ".$this->id." AND fk_statut = ".self::STATUS_DRAFT; - // Trigger calls - if (! $error && ! $notrigger) - { - // Call trigger - $result=$this->call_trigger('PROPAL_VALIDATE',$user); - if ($result < 0) { $error++; } - // End call triggers - } + dol_syslog(get_class($this)."::valid", LOG_DEBUG); + $resql=$this->db->query($sql); + if (! $resql) + { + dol_print_error($this->db); + $error++; + } - if (! $error) - { - $this->oldref = $this->ref; + // Trigger calls + if (! $error && ! $notrigger) + { + // Call trigger + $result=$this->call_trigger('PROPAL_VALIDATE',$user); + if ($result < 0) { $error++; } + // End call triggers + } - // Rename directory if dir was a temporary ref - if (preg_match('/^[\(]?PROV/i', $this->ref)) - { - // Rename of propal directory ($this->ref = old ref, $num = new ref) - // to not lose the linked files - $oldref = dol_sanitizeFileName($this->ref); - $newref = dol_sanitizeFileName($num); - $dirsource = $conf->propal->dir_output.'/'.$oldref; - $dirdest = $conf->propal->dir_output.'/'.$newref; + if (! $error) + { + $this->oldref = $this->ref; - if (file_exists($dirsource)) - { - dol_syslog(get_class($this)."::validate rename dir ".$dirsource." into ".$dirdest); - if (@rename($dirsource, $dirdest)) - { - dol_syslog("Rename ok"); - // Rename docs starting with $oldref with $newref - $listoffiles=dol_dir_list($conf->propal->dir_output.'/'.$newref, 'files', 1, '^'.preg_quote($oldref,'/')); - foreach($listoffiles as $fileentry) - { - $dirsource=$fileentry['name']; - $dirdest=preg_replace('/^'.preg_quote($oldref,'/').'/',$newref, $dirsource); - $dirsource=$fileentry['path'].'/'.$dirsource; - $dirdest=$fileentry['path'].'/'.$dirdest; - @rename($dirsource, $dirdest); - } - } - } - } + // Rename directory if dir was a temporary ref + if (preg_match('/^[\(]?PROV/i', $this->ref)) + { + // Rename of propal directory ($this->ref = old ref, $num = new ref) + // to not lose the linked files + $oldref = dol_sanitizeFileName($this->ref); + $newref = dol_sanitizeFileName($num); + $dirsource = $conf->propal->dir_output.'/'.$oldref; + $dirdest = $conf->propal->dir_output.'/'.$newref; - $this->ref=$num; - $this->brouillon=0; - $this->statut = self::STATUS_VALIDATED; - $this->user_valid_id=$user->id; - $this->datev=$now; + if (file_exists($dirsource)) + { + dol_syslog(get_class($this)."::validate rename dir ".$dirsource." into ".$dirdest); + if (@rename($dirsource, $dirdest)) + { + dol_syslog("Rename ok"); + // Rename docs starting with $oldref with $newref + $listoffiles=dol_dir_list($conf->propal->dir_output.'/'.$newref, 'files', 1, '^'.preg_quote($oldref,'/')); + foreach($listoffiles as $fileentry) + { + $dirsource=$fileentry['name']; + $dirdest=preg_replace('/^'.preg_quote($oldref,'/').'/',$newref, $dirsource); + $dirsource=$fileentry['path'].'/'.$dirsource; + $dirdest=$fileentry['path'].'/'.$dirdest; + @rename($dirsource, $dirdest); + } + } + } + } - $this->db->commit(); - return 1; - } - else - { - $this->db->rollback(); - return -1; - } + $this->ref=$num; + $this->brouillon=0; + $this->statut = self::STATUS_VALIDATED; + $this->user_valid_id=$user->id; + $this->datev=$now; + + $this->db->commit(); + return 1; + } + else + { + $this->db->rollback(); + return -1; } } @@ -1609,11 +1626,12 @@ class Propal extends CommonObject /** * Define proposal date * - * @param User $user Object user that modify - * @param int $date Date - * @return int <0 if KO, >0 if OK + * @param User $user Object user that modify + * @param int $date Date + * @param int $notrigger 1=Does not execute triggers, 0= execute triggers + * @return int <0 if KO, >0 if OK */ - function set_date($user, $date) + function set_date($user, $date, $notrigger=0) { if (empty($date)) { @@ -1624,20 +1642,50 @@ class Propal extends CommonObject if (! empty($user->rights->propal->creer)) { + $error=0; + + $this->db->begin(); + $sql = "UPDATE ".MAIN_DB_PREFIX."propal SET datep = '".$this->db->idate($date)."'"; $sql.= " WHERE rowid = ".$this->id." AND fk_statut = ".self::STATUS_DRAFT; - dol_syslog(get_class($this)."::set_date", LOG_DEBUG); - if ($this->db->query($sql) ) + dol_syslog(__METHOD__, LOG_DEBUG); + $resql=$this->db->query($sql); + if (!$resql) { - $this->date = $date; - $this->datep = $date; // deprecated - return 1; + $this->errors[]=$this->db->error(); + $error++; + } + + if (! $error) + { + $this->oldcopy= clone $this; + $this->date = $date; + $this->datep = $date; // deprecated + } + + if (! $notrigger && empty($error)) + { + // Call trigger + $result=$this->call_trigger('PROPAL_MODIFY',$user); + if ($result < 0) $error++; + // End call triggers + } + + if (! $error) + { + $this->db->commit(); + return 1; } else { - $this->error=$this->db->lasterror(); - return -1; + foreach($this->errors as $errmsg) + { + dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); + $this->error.=($this->error?', '.$errmsg:$errmsg); + } + $this->db->rollback(); + return -1*$error; } } } @@ -1645,25 +1693,59 @@ class Propal extends CommonObject /** * Define end validity date * - * @param User $user Object user that modify - * @param int $date_fin_validite End of validity date - * @return int <0 if KO, >0 if OK + * @param User $user Object user that modify + * @param int $date_fin_validite End of validity date + * @param int $notrigger 1=Does not execute triggers, 0= execute triggers + * @return int <0 if KO, >0 if OK */ - function set_echeance($user, $date_fin_validite) + function set_echeance($user, $date_fin_validite, $notrigger=0) { if (! empty($user->rights->propal->creer)) { + $error=0; + + $this->db->begin(); + $sql = "UPDATE ".MAIN_DB_PREFIX."propal SET fin_validite = ".($date_fin_validite!=''?"'".$this->db->idate($date_fin_validite)."'":'null'); $sql.= " WHERE rowid = ".$this->id." AND fk_statut = ".self::STATUS_DRAFT; - if ($this->db->query($sql) ) + + dol_syslog(__METHOD__, LOG_DEBUG); + $resql=$this->db->query($sql); + if (!$resql) { - $this->fin_validite = $date_fin_validite; - return 1; + $this->errors[]=$this->db->error(); + $error++; + } + + + if (! $error) + { + $this->oldcopy= clone $this; + $this->fin_validite = $date_fin_validite; + } + + if (! $notrigger && empty($error)) + { + // Call trigger + $result=$this->call_trigger('PROPAL_MODIFY',$user); + if ($result < 0) $error++; + // End call triggers + } + + if (! $error) + { + $this->db->commit(); + return 1; } else { - $this->error=$this->db->error(); - return -1; + foreach($this->errors as $errmsg) + { + dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); + $this->error.=($this->error?', '.$errmsg:$errmsg); + } + $this->db->rollback(); + return -1*$error; } } } @@ -1671,28 +1753,59 @@ class Propal extends CommonObject /** * Set delivery date * - * @param User $user Object user that modify - * @param int $date_livraison Delivery date - * @return int <0 if ko, >0 if ok + * @param User $user Object user that modify + * @param int $date_livraison Delivery date + * @param int $notrigger 1=Does not execute triggers, 0= execute triggers + * @return int <0 if ko, >0 if ok */ - function set_date_livraison($user, $date_livraison) + function set_date_livraison($user, $date_livraison, $notrigger=0) { if (! empty($user->rights->propal->creer)) { + $error=0; + + $this->db->begin(); + $sql = "UPDATE ".MAIN_DB_PREFIX."propal "; $sql.= " SET date_livraison = ".($date_livraison!=''?"'".$this->db->idate($date_livraison)."'":'null'); $sql.= " WHERE rowid = ".$this->id; - if ($this->db->query($sql)) + dol_syslog(__METHOD__, LOG_DEBUG); + $resql=$this->db->query($sql); + if (!$resql) { - $this->date_livraison = $date_livraison; - return 1; + $this->errors[]=$this->db->error(); + $error++; + } + + if (! $error) + { + $this->oldcopy= clone $this; + $this->date_livraison = $date_livraison; + } + + if (! $notrigger && empty($error)) + { + // Call trigger + $result=$this->call_trigger('PROPAL_MODIFY',$user); + if ($result < 0) $error++; + // End call triggers + } + + if (! $error) + { + $this->db->commit(); + return 1; } else { - $this->error=$this->db->error(); - dol_syslog(get_class($this)."::set_date_livraison Erreur SQL"); - return -1; + foreach($this->errors as $errmsg) + { + dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); + $this->error.=($this->error?', '.$errmsg:$errmsg); + } + $this->db->rollback(); + return -1*$error; } } } @@ -1702,26 +1815,57 @@ class Propal extends CommonObject * * @param User $user Object user that modify * @param int $id Availability id + * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ - function set_availability($user, $id) + function set_availability($user, $id, $notrigger=0) { if (! empty($user->rights->propal->creer)) { + $error=0; + + $this->db->begin(); + $sql = "UPDATE ".MAIN_DB_PREFIX."propal "; $sql.= " SET fk_availability = '".$id."'"; $sql.= " WHERE rowid = ".$this->id; - if ($this->db->query($sql)) + dol_syslog(__METHOD__, LOG_DEBUG); + $resql=$this->db->query($sql); + if (!$resql) { - $this->fk_availability = $id; - return 1; + $this->errors[]=$this->db->error(); + $error++; + } + + if (! $error) + { + $this->oldcopy= clone $this; + $this->fk_availability = $id; + } + + if (! $notrigger && empty($error)) + { + // Call trigger + $result=$this->call_trigger('PROPAL_MODIFY',$user); + if ($result < 0) $error++; + // End call triggers + } + + if (! $error) + { + $this->db->commit(); + return 1; } else { - $this->error=$this->db->error(); - dol_syslog(get_class($this)."::set_availability Erreur SQL"); - return -1; + foreach($this->errors as $errmsg) + { + dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); + $this->error.=($this->error?', '.$errmsg:$errmsg); + } + $this->db->rollback(); + return -1*$error; } } } @@ -1731,26 +1875,59 @@ class Propal extends CommonObject * * @param User $user Object user that modify * @param int $id Input reason id + * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ - function set_demand_reason($user, $id) + function set_demand_reason($user, $id, $notrigger=0) { if (! empty($user->rights->propal->creer)) { + $error=0; + + $this->db->begin(); + $sql = "UPDATE ".MAIN_DB_PREFIX."propal "; $sql.= " SET fk_input_reason = '".$id."'"; $sql.= " WHERE rowid = ".$this->id; - if ($this->db->query($sql)) + dol_syslog(__METHOD__, LOG_DEBUG); + $resql=$this->db->query($sql); + if (!$resql) { - $this->fk_input_reason = $id; - return 1; + $this->errors[]=$this->db->error(); + $error++; + } + + + if (! $error) + { + $this->oldcopy= clone $this; + $this->fk_input_reason = $id; + } + + + if (! $notrigger && empty($error)) + { + // Call trigger + $result=$this->call_trigger('PROPAL_MODIFY',$user); + if ($result < 0) $error++; + // End call triggers + } + + if (! $error) + { + $this->db->commit(); + return 1; } else { - $this->error=$this->db->error(); - dol_syslog(get_class($this)."::set_demand_reason Erreur SQL"); - return -1; + foreach($this->errors as $errmsg) + { + dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); + $this->error.=($this->error?', '.$errmsg:$errmsg); + } + $this->db->rollback(); + return -1*$error; } } } @@ -1760,26 +1937,56 @@ class Propal extends CommonObject * * @param User $user Object user that modify * @param string $ref_client Customer reference + * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if ko, >0 if ok */ - function set_ref_client($user, $ref_client) + function set_ref_client($user, $ref_client, $notrigger=0) { if (! empty($user->rights->propal->creer)) { - dol_syslog('Propale::set_ref_client this->id='.$this->id.', ref_client='.$ref_client); + $error=0; + + $this->db->begin(); $sql = 'UPDATE '.MAIN_DB_PREFIX.'propal SET ref_client = '.(empty($ref_client) ? 'NULL' : '\''.$this->db->escape($ref_client).'\''); $sql.= ' WHERE rowid = '.$this->id; - if ($this->db->query($sql) ) + + dol_syslog(__METHOD__.' $this->id='.$this->id.', ref_client='.$ref_client, LOG_DEBUG); + $resql=$this->db->query($sql); + if (!$resql) { - $this->ref_client = $ref_client; - return 1; + $this->errors[]=$this->db->error(); + $error++; + } + + if (! $error) + { + $this->oldcopy= clone $this; + $this->ref_client = $ref_client; + } + + if (! $notrigger && empty($error)) + { + // Call trigger + $result=$this->call_trigger('PROPAL_MODIFY',$user); + if ($result < 0) $error++; + // End call triggers + } + + if (! $error) + { + $this->db->commit(); + return 1; } else { - $this->error=$this->db->error(); - dol_syslog('Propale::set_ref_client Erreur '.$this->error.' - '.$sql); - return -2; + foreach($this->errors as $errmsg) + { + dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); + $this->error.=($this->error?', '.$errmsg:$errmsg); + } + $this->db->rollback(); + return -1*$error; } } else @@ -1792,10 +1999,11 @@ class Propal extends CommonObject * Set an overall discount on the proposal * * @param User $user Object user that modify - * @param double $remise Amount discount + * @param double $remise Amount discount + * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if ko, >0 if ok */ - function set_remise_percent($user, $remise) + function set_remise_percent($user, $remise, $notrigger=0) { $remise=trim($remise)?trim($remise):0; @@ -1803,19 +2011,50 @@ class Propal extends CommonObject { $remise = price2num($remise); + $error=0; + + $this->db->begin(); + $sql = "UPDATE ".MAIN_DB_PREFIX."propal SET remise_percent = ".$remise; $sql.= " WHERE rowid = ".$this->id." AND fk_statut = ".self::STATUS_DRAFT; - if ($this->db->query($sql) ) + dol_syslog(__METHOD__, LOG_DEBUG); + $resql=$this->db->query($sql); + if (!$resql) { - $this->remise_percent = $remise; - $this->update_price(1); - return 1; + $this->errors[]=$this->db->error(); + $error++; + } + + if (! $error) + { + $this->oldcopy= clone $this; + $this->remise_percent = $remise; + $this->update_price(1); + } + + if (! $notrigger && empty($error)) + { + // Call trigger + $result=$this->call_trigger('PROPAL_MODIFY',$user); + if ($result < 0) $error++; + // End call triggers + } + + if (! $error) + { + $this->db->commit(); + return 1; } else { - $this->error=$this->db->error(); - return -1; + foreach($this->errors as $errmsg) + { + dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); + $this->error.=($this->error?', '.$errmsg:$errmsg); + } + $this->db->rollback(); + return -1*$error; } } } @@ -1824,11 +2063,12 @@ class Propal extends CommonObject /** * Set an absolute overall discount on the proposal * - * @param User $user Object user that modify - * @param double $remise Amount discount + * @param User $user Object user that modify + * @param double $remise Amount discount + * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if ko, >0 if ok */ - function set_remise_absolue($user, $remise) + function set_remise_absolue($user, $remise, $notrigger=0) { $remise=trim($remise)?trim($remise):0; @@ -1836,20 +2076,51 @@ class Propal extends CommonObject { $remise = price2num($remise); + $error=0; + + $this->db->begin(); + $sql = "UPDATE ".MAIN_DB_PREFIX."propal "; $sql.= " SET remise_absolue = ".$remise; $sql.= " WHERE rowid = ".$this->id." AND fk_statut = ".self::STATUS_DRAFT; - if ($this->db->query($sql) ) + dol_syslog(__METHOD__, LOG_DEBUG); + $resql=$this->db->query($sql); + if (!$resql) { - $this->remise_absolue = $remise; - $this->update_price(1); - return 1; + $this->errors[]=$this->db->error(); + $error++; + } + + if (! $error) + { + $this->oldcopy= clone $this; + $this->remise_absolue = $remise; + $this->update_price(1); + } + + if (! $notrigger && empty($error)) + { + // Call trigger + $result=$this->call_trigger('PROPAL_MODIFY',$user); + if ($result < 0) $error++; + // End call triggers + } + + if (! $error) + { + $this->db->commit(); + return 1; } else { - $this->error=$this->db->error(); - return -1; + foreach($this->errors as $errmsg) + { + dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); + $this->error.=($this->error?', '.$errmsg:$errmsg); + } + $this->db->rollback(); + return -1*$error; } } } @@ -1862,7 +2133,7 @@ class Propal extends CommonObject * @param User $user Object user that close * @param int $statut Statut * @param string $note Comment - * @param int $notrigger 1=Does not execute triggers, 0= execuete triggers + * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ function reopen($user, $statut, $note='', $notrigger=0) @@ -1923,9 +2194,10 @@ class Propal extends CommonObject * @param User $user Object user that close * @param int $statut Statut * @param string $note Comment + * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ - function cloture($user, $statut, $note) + function cloture($user, $statut, $note, $notrigger=0) { global $langs,$conf; @@ -1980,15 +2252,24 @@ class Propal extends CommonObject $this->generateDocument($modelpdf, $outputlangs); } - // Call trigger - $result=$this->call_trigger($trigger_name,$user); - if ($result < 0) { $error++; } - // End call triggers + if (! $error) + { + $this->oldcopy= clone $this; + $this->statut = $statut; + $this->date_cloture = $now; + $this->note_private = $note; + } + + if (! $notrigger && empty($error)) + { + // Call trigger + $result=$this->call_trigger($trigger_name,$user); + if ($result < 0) { $error++; } + // End call triggers + } if ( ! $error ) { - $this->statut = $statut; - $this->db->commit(); return 1; } @@ -2009,20 +2290,55 @@ class Propal extends CommonObject /** * Class invoiced the Propal * - * @return int <0 si ko, >0 si ok + * @param User $user Object user + * @param int $notrigger 1=Does not execute triggers, 0= execute triggers + * @return int <0 si ko, >0 si ok */ - function classifyBilled() + function classifyBilled(User $user, $notrigger=0) { + $error=0; + + $this->db->begin(); + $sql = 'UPDATE '.MAIN_DB_PREFIX.'propal SET fk_statut = '.self::STATUS_BILLED; $sql .= ' WHERE rowid = '.$this->id.' AND fk_statut > '.self::STATUS_DRAFT.' ;'; - if ($this->db->query($sql) ) + + dol_syslog(__METHOD__, LOG_DEBUG); + $resql=$this->db->query($sql); + if (!$resql) { + $this->errors[]=$this->db->error(); + $error++; + } + + if (! $error) + { + $this->oldcopy= clone $this; $this->statut=self::STATUS_BILLED; - return 1; + } + + if (! $notrigger && empty($error)) + { + // Call trigger + $result=$this->call_trigger('PROPAL_MODIFY',$user); + if ($result < 0) $error++; + // End call triggers + } + + if (! $error) + { + $this->db->commit(); + return 1; } else { - dol_print_error($this->db); + foreach($this->errors as $errmsg) + { + dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); + $this->error.=($this->error?', '.$errmsg:$errmsg); + } + $this->db->rollback(); + return -1*$error; } } @@ -2031,7 +2347,7 @@ class Propal extends CommonObject * * @return int <0 si ko, >0 si ok * @deprecated - * @see classifyBilled() + * @see classifyBilled() */ function classer_facturee() { @@ -2045,22 +2361,55 @@ class Propal extends CommonObject * Set draft status * * @param User $user Object user that modify + * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ - function set_draft($user) + function set_draft($user, $notrigger=0) { + $error=0; + + $this->db->begin(); + $sql = "UPDATE ".MAIN_DB_PREFIX."propal SET fk_statut = ".self::STATUS_DRAFT; $sql.= " WHERE rowid = ".$this->id; - if ($this->db->query($sql)) + dol_syslog(__METHOD__, LOG_DEBUG); + $resql=$this->db->query($sql); + if (!$resql) { - $this->statut = self::STATUS_DRAFT; + $this->errors[]=$this->db->error(); + $error++; + } + + if (! $error) + { + $this->oldcopy= clone $this; + $this->statut = self::STATUS_DRAFT; $this->brouillon = 1; - return 1; + } + + if (! $notrigger && empty($error)) + { + // Call trigger + $result=$this->call_trigger('PROPAL_MODIFY',$user); + if ($result < 0) $error++; + // End call triggers + } + + if (! $error) + { + $this->db->commit(); + return 1; } else { - return -1; + foreach($this->errors as $errmsg) + { + dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); + $this->error.=($this->error?', '.$errmsg:$errmsg); + } + $this->db->rollback(); + return -1*$error; } } @@ -2240,7 +2589,7 @@ class Propal extends CommonObject * Delete proposal * * @param User $user Object user that delete - * @param int $notrigger 1=Does not execute triggers, 0= execuete triggers + * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int 1 if ok, otherwise if error */ function delete($user, $notrigger=0) @@ -2363,32 +2712,65 @@ class Propal extends CommonObject * Change the delivery time * * @param int $availability_id Id of new delivery time + * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int >0 if OK, <0 if KO */ - function availability($availability_id) + function availability($availability_id, $notrigger=0) { - dol_syslog('Propale::availability('.$availability_id.')'); if ($this->statut >= self::STATUS_DRAFT) { + $error=0; + + $this->db->begin(); + $sql = 'UPDATE '.MAIN_DB_PREFIX.'propal'; $sql .= ' SET fk_availability = '.$availability_id; $sql .= ' WHERE rowid='.$this->id; - if ( $this->db->query($sql) ) + + dol_syslog(__METHOD__.' availability('.$availability_id.')', LOG_DEBUG); + $resql=$this->db->query($sql); + if (!$resql) { - $this->availability_id = $availability_id; - return 1; + $this->errors[]=$this->db->error(); + $error++; + } + + if (! $error) + { + $this->oldcopy= clone $this; + $this->availability_id = $availability_id; + } + + if (! $notrigger && empty($error)) + { + // Call trigger + $result=$this->call_trigger('PROPAL_MODIFY',$user); + if ($result < 0) $error++; + // End call triggers + } + + if (! $error) + { + $this->db->commit(); + return 1; } else { - dol_syslog('Propale::availability Erreur '.$sql.' - '.$this->db->error()); - $this->error=$this->db->error(); - return -1; + foreach($this->errors as $errmsg) + { + dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); + $this->error.=($this->error?', '.$errmsg:$errmsg); + } + $this->db->rollback(); + return -1*$error; } } else { - dol_syslog('Propale::availability, etat propale incompatible'); - $this->error='Etat propale incompatible '.$this->statut; + $error_str='Propal status do not meet requirement '.$this->statut; + dol_syslog(__METHOD__.$error_str, LOG_ERR); + $this->error=$error_str; + $this->errors[]= $this->error; return -2; } } @@ -2397,32 +2779,65 @@ class Propal extends CommonObject * Change source demand * * @param int $demand_reason_id Id of new source demand + * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int >0 si ok, <0 si ko */ - function demand_reason($demand_reason_id) + function demand_reason($demand_reason_id, $notrigger=0) { - dol_syslog('Propale::demand_reason('.$demand_reason_id.')'); if ($this->statut >= self::STATUS_DRAFT) { + $error=0; + + $this->db->begin(); + $sql = 'UPDATE '.MAIN_DB_PREFIX.'propal'; $sql .= ' SET fk_input_reason = '.$demand_reason_id; $sql .= ' WHERE rowid='.$this->id; - if ( $this->db->query($sql) ) + + dol_syslog(__METHOD__.' demand_reason('.$demand_reason_id.')', LOG_DEBUG); + $resql=$this->db->query($sql); + if (!$resql) { - $this->demand_reason_id = $demand_reason_id; - return 1; + $this->errors[]=$this->db->error(); + $error++; + } + + if (! $error) + { + $this->oldcopy= clone $this; + $this->demand_reason_id = $demand_reason_id; + } + + if (! $notrigger && empty($error)) + { + // Call trigger + $result=$this->call_trigger('PROPAL_MODIFY',$user); + if ($result < 0) $error++; + // End call triggers + } + + if (! $error) + { + $this->db->commit(); + return 1; } else { - dol_syslog('Propale::demand_reason Erreur '.$sql.' - '.$this->db->error()); - $this->error=$this->db->error(); - return -1; + foreach($this->errors as $errmsg) + { + dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); + $this->error.=($this->error?', '.$errmsg:$errmsg); + } + $this->db->rollback(); + return -1*$error; } } else { - dol_syslog('Propale::demand_reason, etat propale incompatible'); - $this->error='Etat propale incompatible '.$this->statut; + $error_str='Propal status do not meet requirement '.$this->statut; + dol_syslog(__METHOD__.$error_str, LOG_ERR); + $this->error=$error_str; + $this->errors[]= $this->error; return -2; } } @@ -2489,39 +2904,40 @@ class Propal extends CommonObject /** * Return label of status of proposal (draft, validated, ...) * - * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto + * @param int $mode 0=Long label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Long label, 5=Short label + Picto * @return string Label */ function getLibStatut($mode=0) { - return $this->LibStatut($this->statut,$mode); + return $this->LibStatut($this->statut, $mode); } /** * Return label of a status (draft, validated, ...) * * @param int $statut id statut - * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto + * @param int $mode 0=Long label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Long label, 5=Short label + Picto, 6=Long label + Picto * @return string Label */ function LibStatut($statut,$mode=1) { - global $langs; - $langs->load("propal"); + global $langs; + $langs->load("propal"); - if ($statut==self::STATUS_DRAFT) $statuttrans='statut0'; - if ($statut==self::STATUS_VALIDATED) $statuttrans='statut1'; - if ($statut==self::STATUS_SIGNED) $statuttrans='statut3'; - if ($statut==self::STATUS_NOTSIGNED) $statuttrans='statut5'; - if ($statut==self::STATUS_BILLED) $statuttrans='statut6'; + if ($statut==self::STATUS_DRAFT) $statuttrans='statut0'; + if ($statut==self::STATUS_VALIDATED) $statuttrans='statut1'; + if ($statut==self::STATUS_SIGNED) $statuttrans='statut3'; + if ($statut==self::STATUS_NOTSIGNED) $statuttrans='statut5'; + if ($statut==self::STATUS_BILLED) $statuttrans='statut6'; - if ($mode == 0) return $this->labelstatut[$statut]; - if ($mode == 1) return $this->labelstatut_short[$statut]; - if ($mode == 2) return img_picto($this->labelstatut_short[$statut], $statuttrans).' '.$this->labelstatut_short[$statut]; - if ($mode == 3) return img_picto($this->labelstatut[$statut], $statuttrans); - if ($mode == 4) return img_picto($this->labelstatut[$statut],$statuttrans).' '.$this->labelstatut[$statut]; - if ($mode == 5) return ''.$this->labelstatut_short[$statut].' '.img_picto($this->labelstatut_short[$statut],$statuttrans); - } + if ($mode == 0) return $this->labelstatut[$statut]; + if ($mode == 1) return $this->labelstatut_short[$statut]; + if ($mode == 2) return img_picto($this->labelstatut_short[$statut], $statuttrans).' '.$this->labelstatut_short[$statut]; + if ($mode == 3) return img_picto($this->labelstatut[$statut], $statuttrans); + if ($mode == 4) return img_picto($this->labelstatut[$statut],$statuttrans).' '.$this->labelstatut[$statut]; + if ($mode == 5) return ''.$this->labelstatut_short[$statut].' '.img_picto($this->labelstatut[$statut],$statuttrans); + if ($mode == 6) return ''.$this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut],$statuttrans); + } /** @@ -2610,7 +3026,8 @@ class Propal extends CommonObject { global $langs; - // Charge tableau des produits prodids + // Load array of products prodids + $num_prods = 0; $prodids = array(); $sql = "SELECT rowid"; $sql.= " FROM ".MAIN_DB_PREFIX."product"; @@ -2679,7 +3096,7 @@ class Propal extends CommonObject $prodid = mt_rand(1, $num_prods); $line->fk_product=$prodids[$prodid]; } - + $this->lines[$xnbp]=$line; $this->total_ht += $line->total_ht; @@ -2797,47 +3214,67 @@ class Propal extends CommonObject * @param int $withpicto Add picto into link * @param string $option Where point the link ('expedition', 'document', ...) * @param string $get_params Parametres added to url + * @param int $notooltip 1=Disable tooltip * @return string String with URL */ - function getNomUrl($withpicto=0,$option='', $get_params='') + function getNomUrl($withpicto=0,$option='', $get_params='', $notooltip=0) { - global $langs, $conf; + global $langs, $conf, $user; + if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips + $result=''; - $label = '' . $langs->trans("ShowPropal") . ''; - if (! empty($this->ref)) - $label.= '
'.$langs->trans('Ref').': '.$this->ref; - if (! empty($this->ref_client)) - $label.= '
'.$langs->trans('RefCustomer').': '.$this->ref_client; - if (! empty($this->total_ht)) - $label.= '
' . $langs->trans('AmountHT') . ': ' . price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency); - if (! empty($this->total_tva)) - $label.= '
' . $langs->trans('VAT') . ': ' . price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency); - if (! empty($this->total_ttc)) - $label.= '
' . $langs->trans('AmountTTC') . ': ' . price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); - $linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; - if ($option == '') { - $link = ''; + if (! empty($this->ref)) + $label.= '
'.$langs->trans('Ref').': '.$this->ref; + if (! empty($this->ref_client)) + $label.= '
'.$langs->trans('RefCustomer').': '.$this->ref_client; + if (! empty($this->total_ht)) + $label.= '
' . $langs->trans('AmountHT') . ': ' . price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency); + if (! empty($this->total_tva)) + $label.= '
' . $langs->trans('VAT') . ': ' . price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency); + if (! empty($this->total_ttc)) + $label.= '
' . $langs->trans('AmountTTC') . ': ' . price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); + if ($option == '') { + $url = DOL_URL_ROOT.'/comm/propal/card.php?id='.$this->id. $get_params; + } + if ($option == 'compta') { // deprecated + $url = DOL_URL_ROOT.'/comm/propal/card.php?id='.$this->id. $get_params; + } + if ($option == 'expedition') { + $url = DOL_URL_ROOT.'/expedition/propal.php?id='.$this->id. $get_params; + } + if ($option == 'document') { + $url = DOL_URL_ROOT.'/comm/propal/document.php?id='.$this->id. $get_params; + } } - if ($option == 'compta') { // deprecated - $link = '
rights->propal->lire) + { + if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) + { + $label=$langs->trans("ShowPropal"); + $linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"'; + } + $linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose.=' class="classfortooltip"'; } + + $linkstart = ''; $linkend=''; - $picto='propal'; - - if ($withpicto) - $result.=($link.img_object($label, $picto, 'class="classfortooltip"').$linkend); + $result.=($linkstart.img_object(($notooltip?'':$label), $this->picto, ($notooltip?'':'class="classfortooltip"')).$linkend); if ($withpicto && $withpicto != 2) $result.=' '; - $result.=$link.$this->ref.$linkend; + $result.=$linkstart.$this->ref.$linkend; return $result; } @@ -2849,7 +3286,7 @@ class Propal extends CommonObject function getLinesArray() { // For other object, here we call fetch_lines. But fetch_lines does not exists on proposal - + $sql = 'SELECT pt.rowid, pt.label as custom_label, pt.description, pt.fk_product, pt.fk_remise_except,'; $sql.= ' pt.qty, pt.tva_tx, pt.remise_percent, pt.subprice, pt.info_bits,'; $sql.= ' pt.total_ht, pt.total_tva, pt.total_ttc, pt.fk_product_fournisseur_price as fk_fournprice, pt.buy_price_ht as pa_ht, pt.special_code, pt.localtax1_tx, pt.localtax2_tx,'; @@ -2909,7 +3346,7 @@ class Propal extends CommonObject $this->lines[$i]->date_start = $this->db->jdate($obj->date_start); $this->lines[$i]->date_end = $this->db->jdate($obj->date_end); $this->lines[$i]->fk_unit = $obj->fk_unit; - + // Multicurrency $this->lines[$i]->fk_multicurrency = $obj->fk_multicurrency; $this->lines[$i]->multicurrency_code = $obj->multicurrency_code; @@ -3094,7 +3531,7 @@ class PropaleLigne extends CommonObjectLine var $multicurrency_total_ht; var $multicurrency_total_tva; var $multicurrency_total_ttc; - + /** * Class line Contructor * @@ -3178,7 +3615,7 @@ class PropaleLigne extends CommonObjectLine $this->multicurrency_total_ht = $objp->multicurrency_total_ht; $this->multicurrency_total_tva = $objp->multicurrency_total_tva; $this->multicurrency_total_ttc = $objp->multicurrency_total_ttc; - + $this->db->free($result); return 1; @@ -3192,7 +3629,7 @@ class PropaleLigne extends CommonObjectLine /** * Insert object line propal in database * - * @param int $notrigger 1=Does not execute triggers, 0= execuete triggers + * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ function insert($notrigger=0) @@ -3204,7 +3641,7 @@ class PropaleLigne extends CommonObjectLine dol_syslog(get_class($this)."::insert rang=".$this->rang); $pa_ht_isemptystring = (empty($this->pa_ht) && $this->pa_ht == ''); // If true, we can use a default value. If this->pa_ht = '0', we must use '0'. - + // Clean parameters if (empty($this->tva_tx)) $this->tva_tx=0; if (empty($this->localtax1_tx)) $this->localtax1_tx=0; @@ -3222,9 +3659,13 @@ class PropaleLigne extends CommonObjectLine if (empty($this->fk_fournprice)) $this->fk_fournprice=0; if (! is_numeric($this->qty)) $this->qty = 0; if (empty($this->pa_ht)) $this->pa_ht=0; - + if (empty($this->multicurrency_subprice)) $this->multicurrency_subprice=0; + if (empty($this->multicurrency_total_ht)) $this->multicurrency_total_ht=0; + if (empty($this->multicurrency_total_vat)) $this->multicurrency_total_vat=0; + if (empty($this->multicurrency_total_ttc)) $this->multicurrency_total_ttc=0; + // if buy price not defined, define buyprice as configured in margin admin - if ($this->pa_ht == 0 && $pa_ht_isemptystring) + if ($this->pa_ht == 0 && $pa_ht_isemptystring) { if (($result = $this->defineBuyPrice($this->subprice, $this->remise_percent, $this->fk_product)) < 0) { @@ -3329,9 +3770,10 @@ class PropaleLigne extends CommonObjectLine /** * Delete line in database * + * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if ko, >0 if ok */ - function delete() + function delete($notrigger=0) { global $conf,$user; @@ -3355,13 +3797,16 @@ class PropaleLigne extends CommonObjectLine } } - // Call trigger - $result=$this->call_trigger('LINEPROPAL_DELETE',$user); - if ($result < 0) - { - $this->db->rollback(); - return -1; - } + if (! $error && ! $notrigger) + { + // Call trigger + $result=$this->call_trigger('LINEPROPAL_DELETE',$user); + if ($result < 0) + { + $this->db->rollback(); + return -1; + } + } // End call triggers $this->db->commit(); @@ -3389,7 +3834,7 @@ class PropaleLigne extends CommonObjectLine $error=0; $pa_ht_isemptystring = (empty($this->pa_ht) && $this->pa_ht == ''); // If true, we can use a default value. If this->pa_ht = '0', we must use '0'. - + // Clean parameters if (empty($this->tva_tx)) $this->tva_tx=0; if (empty($this->localtax1_tx)) $this->localtax1_tx=0; @@ -3411,7 +3856,7 @@ class PropaleLigne extends CommonObjectLine if (empty($this->pa_ht)) $this->pa_ht=0; // if buy price not defined, define buyprice as configured in margin admin - if ($this->pa_ht == 0 && $pa_ht_isemptystring) + if ($this->pa_ht == 0 && $pa_ht_isemptystring) { if (($result = $this->defineBuyPrice($this->subprice, $this->remise_percent, $this->fk_product)) < 0) { @@ -3457,13 +3902,13 @@ class PropaleLigne extends CommonObjectLine $sql.= " , date_start=".(! empty($this->date_start)?"'".$this->db->idate($this->date_start)."'":"null"); $sql.= " , date_end=".(! empty($this->date_end)?"'".$this->db->idate($this->date_end)."'":"null"); $sql.= " , fk_unit=".(!$this->fk_unit ? 'NULL' : $this->fk_unit); - + // Multicurrency $sql.= " , multicurrency_subprice=".price2num($this->multicurrency_subprice).""; $sql.= " , multicurrency_total_ht=".price2num($this->multicurrency_total_ht).""; $sql.= " , multicurrency_total_tva=".price2num($this->multicurrency_total_tva).""; $sql.= " , multicurrency_total_ttc=".price2num($this->multicurrency_total_ttc).""; - + $sql.= " WHERE rowid = ".$this->rowid; dol_syslog(get_class($this)."::update", LOG_DEBUG); diff --git a/htdocs/comm/propal/document.php b/htdocs/comm/propal/document.php index 668b093e7db..289ba272b8c 100644 --- a/htdocs/comm/propal/document.php +++ b/htdocs/comm/propal/document.php @@ -133,6 +133,7 @@ if ($object->id > 0) $modulepart = 'propal'; $permission = $user->rights->propal->creer; + $permtoedit = $user->rights->propal->creer; $param = '&id=' . $object->id; include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php'; } diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index af73bf3e45f..88f8f8fa3df 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -10,6 +10,7 @@ * Copyright (C) 2012 Christophe Battarel * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2016 Ferran Marcet * * 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 @@ -51,6 +52,12 @@ $langs->load('products'); $socid=GETPOST('socid','int'); +$action=GETPOST('action','alpha'); +$massaction=GETPOST('massaction','alpha'); +$show_files=GETPOST('show_files','int'); +$confirm=GETPOST('confirm','alpha'); +$toselect = GETPOST('toselect', 'array'); + $search_user=GETPOST('search_user','int'); $search_sale=GETPOST('search_sale','int'); $search_ref=GETPOST('sf_ref')?GETPOST('sf_ref','alpha'):GETPOST('search_ref','alpha'); @@ -72,9 +79,10 @@ $object_statut=GETPOST('propal_statut'); $sall=GETPOST("sall"); $mesg=(GETPOST("msg") ? GETPOST("msg") : GETPOST("mesg")); + $day=GETPOST("day","int"); -$year=GETPOST("year","int"); $month=GETPOST("month","int"); +$year=GETPOST("year","int"); $limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit; $sortfield = GETPOST("sortfield",'alpha'); @@ -159,7 +167,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab */ if (GETPOST('cancel')) { $action='list'; $massaction=''; } -if (! GETPOST('confirmmassaction')) { $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 @@ -192,28 +200,19 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP $day=''; $viewstatut=''; $object_statut=''; + $toselect=''; $search_array_options=array(); } if ($object_statut != '') $viewstatut=$object_statut; if (empty($reshook)) { - // Mass actions. Controls on number of lines checked - $maxformassaction=1000; - if (! empty($massaction) && count($toselect) < 1) - { - $error++; - setEventMessages($langs->trans("NoLineChecked"), null, "warnings"); - } - if (! $error && count($toselect) > $maxformassaction) - { - setEventMessages($langs->trans('TooManyRecordForMassAction',$maxformassaction), null, 'errors'); - $error++; - } - - - - + $objectclass='Propal'; + $objectlabel='Proposals'; + $permtoread = $user->rights->propal->lire; + $permtodelete = $user->rights->propal->supprimer; + $uploaddir = $conf->propal->dir_output; + include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; } @@ -222,7 +221,7 @@ if (empty($reshook)) * View */ -llxHeader('',$langs->trans('Proposal'),'EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos'); +$now=dol_now(); $form = new Form($db); $formother = new FormOther($db); @@ -231,14 +230,15 @@ $formpropal = new FormPropal($db); $companystatic=new Societe($db); $formcompany=new FormCompany($db); -$now=dol_now(); +$help_url='EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos'; +llxHeader('',$langs->trans('Proposal'),$help_url); $sql = 'SELECT'; if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT'; -$sql.= ' s.rowid, s.nom as name, s.town, s.zip, s.fk_pays, s.client, s.code_client, '; +$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.= ' p.rowid as propalid, p.note_private, p.total_ht, p.tva as total_vat, p.total as total_ttc, p.localtax1, p.localtax2, p.ref, p.ref_client, p.fk_statut, p.fk_user_author, p.datep as dp, p.fin_validite as dfv,'; +$sql.= ' p.rowid, p.note_private, p.total_ht, p.tva as total_vat, p.total as total_ttc, p.localtax1, p.localtax2, p.ref, p.ref_client, p.fk_statut, p.fk_user_author, p.datep as dp, p.fin_validite as dfv,'; $sql.= ' p.datec as date_creation, p.tms as date_update,'; if (! $user->rights->societe->client->voir && ! $socid) $sql .= " sc.fk_soc, sc.fk_user,"; $sql.= ' u.login'; @@ -340,22 +340,31 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) $sql.= $db->plimit($limit+1, $offset); -$result=$db->query($sql); -if ($result) +$resql=$db->query($sql); +if ($resql) { $objectstatic=new Propal($db); $userstatic=new User($db); - $num = $db->num_rows($result); - if ($socid) + if ($socid > 0) { $soc = new Societe($db); - $soc->fetch($socid); + $soc->fetch($socid); + $title = $langs->trans('ListOfProposals') . ' - '.$soc->name; } + else + { + $title = $langs->trans('ListOfProposals'); + } + $num = $db->num_rows($resql); + + $arrayofselected=is_array($toselect)?$toselect:array(); + $param='&socid='.$socid.'&viewstatut='.$viewstatut; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; + if ($sall) $param.='&sall='.$sall; if ($month) $param.='&month='.$month; if ($year) $param.='&year='.$year; if ($search_ref) $param.='&search_ref=' .$search_ref; @@ -375,10 +384,17 @@ if ($result) if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val); } - //$massactionbutton=$form->selectMassAction('', $massaction == 'presend' ? array() : array('presend'=>$langs->trans("SendByMail"), 'builddoc'=>$langs->trans("PDFMerge"))); + // List of mass actions available + $arrayofmassactions = array( + 'presend'=>$langs->trans("SendByMail"), + 'builddoc'=>$langs->trans("PDFMerge"), + ); + if ($user->rights->propal->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete"); + if ($massaction == 'presend') $arrayofmassactions=array(); + $massactionbutton=$form->selectMassAction('', $arrayofmassactions); // Lignes des champs de filtre - print ''; + print ''; if ($optioncss != '') print ''; print ''; print ''; @@ -386,12 +402,109 @@ if ($result) print ''; print ''; - print_barre_liste($langs->trans('ListOfProposals').' '.($socid?'- '.$soc->name:''), $page, $_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords,'title_commercial.png', 0, '', '', $limit); + print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_commercial.png', 0, '', '', $limit); + + if ($massaction == 'presend') + { + $langs->load("mails"); + + if (! GETPOST('cancel')) + { + $objecttmp=new Propal($db); + $listofselectedid=array(); + $listofselectedthirdparties=array(); + $listofselectedref=array(); + foreach($arrayofselected as $toselectid) + { + $result=$objecttmp->fetch($toselectid); + if ($result > 0) + { + $listofselectedid[$toselectid]=$toselectid; + $thirdpartyid=$objecttmp->fk_soc?$objecttmp->fk_soc:$objecttmp->socid; + $listofselectedthirdparties[$thirdpartyid]=$thirdpartyid; + $listofselectedref[$thirdpartyid][$toselectid]=$objecttmp->ref; + } + } + } + + print ''; + + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; + $formmail = new FormMail($db); + + dol_fiche_head(null, '', ''); + + $topicmail="SendProposalRef"; + $modelmail="propal_send"; + + // Cree l'objet formulaire mail + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; + $formmail = new FormMail($db); + $formmail->withform=-1; + $formmail->fromtype = (GETPOST('fromtype')?GETPOST('fromtype'):(!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE)?$conf->global->MAIN_MAIL_DEFAULT_FROMTYPE:'user')); + + if($formmail->fromtype === 'user'){ + $formmail->fromid = $user->id; + + } + if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 1)) // If bit 1 is set + { + $formmail->trackid='ord'.$object->id; + } + if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set + { + include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; + $formmail->frommail=dolAddEmailTrackId($formmail->frommail, 'ord'.$object->id); + } + $formmail->withfrom=1; + $liste=$langs->trans("AllRecipientSelected"); + if (count($listofselectedthirdparties) == 1) + { + $liste=array(); + $thirdpartyid=array_shift($listofselectedthirdparties); + $soc=new Societe($db); + $soc->fetch($thirdpartyid); + foreach ($soc->thirdparty_and_contact_email_array(1) as $key=>$value) + { + $liste[$key]=$value; + } + $formmail->withtoreadonly=0; + } + else + { + $formmail->withtoreadonly=1; + } + $formmail->withto=$liste; + $formmail->withtofree=0; + $formmail->withtocc=1; + $formmail->withtoccc=$conf->global->MAIN_EMAIL_USECCC; + $formmail->withtopic=$langs->transnoentities($topicmail, '__REF__', '__REFCLIENT__'); + $formmail->withfile=$langs->trans("OnlyPDFattachmentSupported"); + $formmail->withbody=1; + $formmail->withdeliveryreceipt=1; + $formmail->withcancel=1; + // Tableau des substitutions + $formmail->substit['__REF__']='__REF__'; // We want to keep the tag + $formmail->substit['__SIGNATURE__']=$user->signature; + $formmail->substit['__REFCLIENT__']='__REFCLIENT__'; // We want to keep the tag + $formmail->substit['__PERSONALIZED__']=''; + $formmail->substit['__CONTACTCIVNAME__']=''; + + // Tableau des parametres complementaires du post + $formmail->param['action']=$action; + $formmail->param['models']=$modelmail; + $formmail->param['models_id']=GETPOST('modelmailselected','int'); + $formmail->param['id']=join(',',$arrayofselected); + //$formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id; + + print $formmail->get_form(); + + dol_fiche_end(); + } if ($sall) { foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); - //sort($fieldstosearchall); print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); } @@ -426,6 +539,11 @@ if ($result) $moreforfilter.=$form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, '', 1); $moreforfilter.=''; } + $parameters=array(); + $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 '
'; @@ -438,6 +556,7 @@ if ($result) print ''."\n"; + // Fields title print ''; if (! empty($arrayfields['p.ref']['checked'])) print_liste_field_titre($arrayfields['p.ref']['label'],$_SERVER["PHP_SELF"],'p.ref','',$param,'',$sortfield,$sortorder); if (! empty($arrayfields['p.ref_client']['checked'])) print_liste_field_titre($arrayfields['p.ref_client']['label'],$_SERVER["PHP_SELF"],'p.ref_client','',$param,'',$sortfield,$sortorder); @@ -473,8 +592,8 @@ if ($result) if (! empty($arrayfields['p.tms']['checked'])) print_liste_field_titre($arrayfields['p.tms']['label'],$_SERVER["PHP_SELF"],"p.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); if (! empty($arrayfields['p.fk_statut']['checked'])) print_liste_field_titre($arrayfields['p.fk_statut']['label'],$_SERVER["PHP_SELF"],"p.fk_statut","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch '); - print "\n"; - + print ''."\n"; + print ''; if (! empty($arrayfields['p.ref']['checked'])) { @@ -491,11 +610,11 @@ if ($result) if (! empty($arrayfields['s.nom']['checked'])) { print ''; } if (! empty($arrayfields['s.town']['checked'])) print ''; - if (! empty($arrayfields['s.zip']['checked'])) print ''; + if (! empty($arrayfields['s.zip']['checked'])) print ''; // State if (! empty($arrayfields['state.nom']['checked'])) { @@ -610,7 +729,7 @@ if ($result) } // Action column print ''; @@ -622,37 +741,44 @@ if ($result) $totalarray=array(); while ($i < min($num,$limit)) { - $obj = $db->fetch_object($result); + $obj = $db->fetch_object($resql); $var=!$var; + + $objectstatic->id=$obj->rowid; + $objectstatic->ref=$obj->ref; + print ''; if (! empty($arrayfields['p.ref']['checked'])) { print ''; + print ''; if (! $i) $totalarray['nbfield']++; print "\n"; @@ -863,15 +994,39 @@ if ($result) } - $db->free($result); + $db->free($resql); $parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql); $reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - print '
'; - print ''; + print ''; print ''; - $searchpitco=$form->showFilterAndCheckAddButtons(0); + $searchpitco=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1); print $searchpitco; print '
'; - $objectstatic->id=$obj->propalid; - $objectstatic->ref=$obj->ref; - print ''; + // Picto + Ref print ''; - - print ''; - - // Ref + if ($warnornote) + { + print ''; + } + // Other picto tool print '
'; print $objectstatic->getNomUrl(1); print ''; - if ($obj->fk_statut == 1 && $db->jdate($obj->dfv) < ($now - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late")); + // Warning + $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 ' '; - print ''.img_picto($langs->trans("ViewPrivateNote"),'object_generic').''; - print ''; + $warnornote.=($warnornote?' ':''); + $warnornote.= ''; + $warnornote.= ''.img_picto($langs->trans("ViewPrivateNote"),'object_generic').''; + $warnornote.= ''; } - print ''; + print $warnornote; + print ''; $filename=dol_sanitizeFileName($obj->ref); $filedir=$conf->propal->dir_output . '/' . dol_sanitizeFileName($obj->ref); - $urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->propalid; + $urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid; print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir); print '
'; @@ -669,9 +795,7 @@ if ($result) if (! $i) $totalarray['nbfield']++; } - $url = DOL_URL_ROOT.'/comm/card.php?socid='.$obj->rowid; - - $companystatic->id=$obj->rowid; + $companystatic->id=$obj->socid; $companystatic->name=$obj->name; $companystatic->client=$obj->client; $companystatic->code_client=$obj->code_client; @@ -833,7 +957,14 @@ if ($result) if (! $i) $totalarray['nbfield']++; } // Action column - print '
'; + 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 ''; + } + print '
'; + print ''."\n"; - print ''; + print ''."\n"; + + if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) + { + /* + * Show list of available documents + */ + $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder; + $urlsource.=str_replace('&','&',$param); + + $filedir=$diroutputmassaction; + $genallowed=$user->rights->propal->lire; + $delallowed=$user->rights->propal->lire; + + print '
'; + $paramwithoutshowfiles=preg_replace('/show_files=1&?/','',$param); + $title=$langs->trans("MassFilesArea").' ('.$langs->trans("Hide").')'; + + print $formfile->showdocuments('massfilesarea_proposals','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,''); + } + else + { + print '
'.$langs->trans("ShowTempMassFilesArea").''; + } + } else { diff --git a/htdocs/comm/propal/note.php b/htdocs/comm/propal/note.php index 91972673201..89f31256717 100644 --- a/htdocs/comm/propal/note.php +++ b/htdocs/comm/propal/note.php @@ -75,15 +75,19 @@ if ($id > 0 || ! empty($ref)) $societe = new Societe($db); if ( $societe->fetch($object->socid) ) { - $head = propal_prepare_head($object); + $head = propal_prepare_head($object); dol_fiche_head($head, 'note', $langs->trans('Proposal'), 0, 'propal'); + $cssclass='titlefield'; + //if ($action == 'editnote_public') $cssclass='titlefieldcreate'; + //if ($action == 'editnote_private') $cssclass='titlefieldcreate'; + print ''; $linkback = ''.$langs->trans('BackToList').''; // Ref - print ''; @@ -138,7 +142,7 @@ if ($id > 0 || ! empty($ref)) print "
'.$langs->trans('Ref').''; + print '
'.$langs->trans('Ref').''; print $form->showrefnav($object,'ref',$linkback,1,'ref','ref',''); print '
"; - print '
'; + //print '
'; include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; diff --git a/htdocs/comm/remise.php b/htdocs/comm/remise.php index a5c0a89f29d..4ea377a4487 100644 --- a/htdocs/comm/remise.php +++ b/htdocs/comm/remise.php @@ -100,8 +100,8 @@ if ($socid > 0) $head = societe_prepare_head($object); - - + + print '
'; print ''; print ''; @@ -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 '
'; - + print '
'; print ''; @@ -138,9 +138,9 @@ if ($socid > 0) print "
"; print '
'; - + dol_fiche_end(); - + print '
'; print ''; 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"; diff --git a/htdocs/comm/remx.php b/htdocs/comm/remx.php index a4aff6d71c1..23a4cd67d37 100644 --- a/htdocs/comm/remx.php +++ b/htdocs/comm/remx.php @@ -32,6 +32,8 @@ $langs->load("orders"); $langs->load("bills"); $langs->load("companies"); +$id=GETPOST('id','int'); + $action=GETPOST('action','alpha'); $backtopage=GETPOST('backtopage','alpha'); @@ -58,6 +60,9 @@ if ($action == 'confirm_split' && GETPOST("confirm") == 'yes') //if ($user->rights->societe->creer) //if ($user->rights->facture->creer) + $amount_ttc_1=GETPOST('amount_ttc_1'); + $amount_ttc_2=GETPOST('amount_ttc_2'); + $error=0; $remid=GETPOST("remid")?GETPOST("remid"):0; $discount=new DiscountAbsolute($db); @@ -67,7 +72,7 @@ if ($action == 'confirm_split' && GETPOST("confirm") == 'yes') $error++; setEventMessages($langs->trans("ErrorFailedToLoadDiscount"), null, 'errors'); } - if (! $error && price2num($_POST["amount_ttc_1"]+$_POST["amount_ttc_2"]) != $discount->amount_ttc) + if (! $error && price2num($amount_ttc_1+$amount_ttc_2) != $discount->amount_ttc) { $error++; setEventMessages($langs->trans("TotalOfTwoDiscountMustEqualsOriginal"), null, 'errors'); @@ -120,7 +125,7 @@ if ($action == 'confirm_split' && GETPOST("confirm") == 'yes') if ($res > 0 && $newid1 > 0 && $newid2 > 0) { $db->commit(); - header("Location: ".$_SERVER["PHP_SELF"].'?id='.$_REQUEST['id']); // To avoid pb whith back + header("Location: ".$_SERVER["PHP_SELF"].'?id='.$id); // To avoid pb whith back exit; } else @@ -130,15 +135,19 @@ if ($action == 'confirm_split' && GETPOST("confirm") == 'yes') } } -if ($action == 'setremise') +if ($action == 'setremise' && $user->rights->societe->creer) { //if ($user->rights->societe->creer) //if ($user->rights->facture->creer) - if (price2num($_POST["amount_ht"]) > 0) + $amount_ht=GETPOST('amount_ht'); + $desc=GETPOST('desc','alpha'); + $tva_tx=GETPOST('tva_tx','alpha'); + + if (price2num($amount_ht) > 0) { $error=0; - if (empty($_POST["desc"])) + if (empty($desc)) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("ReasonDiscount")), null, 'errors'); $error++; @@ -147,8 +156,8 @@ if ($action == 'setremise') if (! $error) { $soc = new Societe($db); - $soc->fetch($_GET["id"]); - $discountid=$soc->set_remise_except($_POST["amount_ht"],$user,$_POST["desc"],$_POST["tva_tx"]); + $soc->fetch($id); + $discountid=$soc->set_remise_except($amount_ht,$user,$desc,$tva_tx); if ($discountid > 0) { @@ -159,7 +168,7 @@ if ($action == 'setremise') } else { - header("Location: remx.php?id=".$_GET["id"]); + header("Location: remx.php?id=".$id); exit; } } @@ -189,7 +198,7 @@ if (GETPOST("action") == 'confirm_remove' && GETPOST("confirm")=='yes') if ($result > 0) { $db->commit(); - header("Location: ".$_SERVER["PHP_SELF"].'?id='.GETPOST('id','int')); // To avoid pb whith back + header("Location: ".$_SERVER["PHP_SELF"].'?id='.$id); // To avoid pb whith back exit; } else @@ -227,11 +236,11 @@ if ($socid > 0) print ''; dol_fiche_head($head, 'absolutediscount', $langs->trans("ThirdParty"),0,'company'); - + dol_banner_tab($object, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom'); - + print '
'; - + print '
'; print ''; @@ -239,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); @@ -257,46 +267,55 @@ if ($socid > 0) print ''; print ''; - print ''; - print ''; + if (! empty($user->fk_soc)) // No need to show this for external users + { + print ''; + print ''; + } print '
'.$langs->trans("CustomerAbsoluteDiscountAllUsers").''.$remise_all.' '.$langs->trans("Currency".$conf->currency).' '.$langs->trans("HT").'
'.$langs->trans("CustomerAbsoluteDiscountMy").''.$remise_user.' '.$langs->trans("Currency".$conf->currency).' '.$langs->trans("HT").'
'.$langs->trans("CustomerAbsoluteDiscountMy").''.$remise_user.' '.$langs->trans("Currency".$conf->currency).' '.$langs->trans("HT").'
'; - print '
'; - - print load_fiche_titre($langs->trans("NewGlobalDiscount"),'',''); - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - print "
'.$langs->trans("AmountHT").''; - print ' '.$langs->trans("Currency".$conf->currency).'
'.$langs->trans("VAT").''; - print $form->load_tva('tva_tx',GETPOST('tva_tx'),$mysoc,$object); - print '
'.$langs->trans("NoteReason").'
"; + if ($user->rights->societe->creer) + { + print '
'; + + print load_fiche_titre($langs->trans("NewGlobalDiscount"),'',''); + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + + print "
'.$langs->trans("AmountHT").''; + print ' '.$langs->trans("Currency".$conf->currency).'
'.$langs->trans("VAT").''; + print $form->load_tva('tva_tx',GETPOST('tva_tx'),$mysoc,$object); + print '
'.$langs->trans("NoteReason").'
"; + } print '
'; - + dol_fiche_end(); - - print '
'; - print ''; - if (! empty($backtopage)) - { - print '     '; - print ''; - } - print '
'; - print ''; + if ($user->rights->societe->creer) + { + print '
'; + print ''; + if (! empty($backtopage)) + { + print '     '; + print ''; + } + print '
'; + } + + print ''; print '
'; if ($_GET['action'] == 'remove') { - print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&remid='.$_GET["remid"], $langs->trans('RemoveDiscount'), $langs->trans('ConfirmRemoveDiscount'), 'confirm_remove', '', 0, 1); + print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&remid='.GETPOST('remid'), $langs->trans('RemoveDiscount'), $langs->trans('ConfirmRemoveDiscount'), 'confirm_remove', '', 0, 1); } /* @@ -309,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"; @@ -383,7 +403,7 @@ if ($socid > 0) else print ' '; print ''; - if ($_GET["action"]=='split' && $_GET['remid'] == $obj->rowid) + if ($_GET["action"]=='split' && GETPOST('remid') == $obj->rowid) { $showconfirminfo['rowid']=$obj->rowid; $showconfirminfo['amount_ttc']=$obj->amount_ttc; @@ -414,7 +434,7 @@ if ($socid > 0) print '
'; /* - * Liste ristournes appliquees (=liees a une ligne de facture ou facture) + * List discount consumed (=liees a une ligne de facture ou facture) */ // Remises liees a lignes de factures diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index e67b18a5989..313fef16e2c 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -60,13 +60,13 @@ $langs->load('deliveries'); $langs->load('sendings'); $langs->load('products'); if (!empty($conf->incoterm->enabled)) $langs->load('incoterm'); -if (! empty($conf->margin->enabled)) - $langs->load('margins'); +if (! empty($conf->margin->enabled)) $langs->load('margins'); $id = (GETPOST('id', 'int') ? GETPOST('id', 'int') : GETPOST('orderid', 'int')); $ref = GETPOST('ref', 'alpha'); $socid = GETPOST('socid', 'int'); $action = GETPOST('action', 'alpha'); +$cancel = GETPOST('cancel', 'alpha'); $confirm = GETPOST('confirm', 'alpha'); $lineid = GETPOST('lineid', 'int'); $origin = GETPOST('origin', 'alpha'); @@ -183,7 +183,7 @@ if (empty($reshook)) // Remove a product line else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->commande->creer) { - $result = $object->deleteline($lineid); + $result = $object->deleteline($user, $lineid); if ($result > 0) { // Define output language @@ -262,14 +262,13 @@ 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)) { @@ -388,7 +387,7 @@ if (empty($reshook)) } $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) { @@ -400,14 +399,14 @@ if (empty($reshook)) } 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++; @@ -475,19 +474,26 @@ 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')); + else if ($action == 'setref_client' && $user->rights->commande->creer) { + $result = $object->set_ref_client($user, GETPOST('ref_client')); + if ($result < 0) + { + setEventMessages($object->error, $object->errors, 'errors'); + } } else if ($action == 'setremise' && $user->rights->commande->creer) { - $object->set_remise($user, GETPOST('remise')); + $result = $object->set_remise($user, GETPOST('remise')); + if ($result < 0) + { + setEventMessages($object->error, $object->errors, 'errors'); + } } else if ($action == 'setabsolutediscount' && $user->rights->commande->creer) { @@ -523,9 +529,9 @@ if (empty($reshook)) else if ($action == 'setmode' && $user->rights->commande->creer) { $result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int')); if ($result < 0) - dol_print_error($db, $object->error); + setEventMessages($object->error, $object->errors, 'errors'); } - + // Multicurrency Code else if ($action == 'setmulticurrencycode' && $user->rights->commande->creer) { $result = $object->setMulticurrencyCode(GETPOST('multicurrency_code', 'alpha')); @@ -533,19 +539,19 @@ 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) - dol_print_error($db, $object->error); + setEventMessages($object->error, $object->errors, 'errors'); } else if ($action == 'setdemandreason' && $user->rights->commande->creer) { $result = $object->demand_reason(GETPOST('demand_reason_id')); if ($result < 0) - dol_print_error($db, $object->error); + setEventMessages($object->error, $object->errors, 'errors'); } else if ($action == 'setconditions' && $user->rights->commande->creer) { @@ -1195,9 +1201,9 @@ if (empty($reshook)) $file = $upload_dir . '/' . GETPOST('file'); $ret = dol_delete_file($file, 0, 0, 0, $object); if ($ret) - setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs'); + setEventMessages($langs->trans("FileWasRemoved", GETPOST('file')), null, 'mesgs'); else - setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors'); + setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('file')), null, 'errors'); $action = ''; } } @@ -1212,7 +1218,6 @@ if (empty($reshook)) if (! $error) { // Actions on extra fields (by external module or standard code) - // TODO le hook fait double emploi avec le trigger !! $hookmanager->initHooks(array('orderdao')); $parameters = array('id' => $object->id); $reshook = $hookmanager->executeHooks('insertExtraFields', $parameters, $object, $action); // Note that $action and $object may have been modified by @@ -1233,7 +1238,7 @@ if (empty($reshook)) if ($action == 'set_thirdparty' && $user->rights->commande->creer) { $object->fetch($id); - $object->setValueFrom('fk_soc', $socid); + $object->setValueFrom('fk_soc', $socid, '', '', 'date', '', $user, 'ORDER_MODIFY'); header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $id); exit(); @@ -1251,6 +1256,7 @@ if (empty($reshook)) $trigger_name='ORDER_SENTBYMAIL'; $paramname='id'; $mode='emailfromorder'; + $trackid='ord'.$object->id; include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; @@ -1334,7 +1340,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; @@ -1405,7 +1411,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)); @@ -1428,7 +1434,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'); @@ -1436,7 +1442,6 @@ if ($action == 'create' && $user->rights->commande->creer) } $absolute_discount=$soc->getAvailableDiscounts(); - $nbrow = 10; print '
'; print ''; @@ -1472,7 +1477,7 @@ if ($action == 'create' && $user->rights->commande->creer) print ''; } else { print ''; - print $form->select_company('', 'socid', 's.client = 1 OR s.client = 3', 1); + print $form->select_company('', 'socid', 's.client = 1 OR s.client = 3', 'SelectThirdParty'); // reload page to retrieve customer informations if (!empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE)) { @@ -1595,7 +1600,14 @@ if ($action == 'create' && $user->rights->commande->creer) print ''; print ''; print ''; - print $form->select_incoterms((!empty($objectsrc->fk_incoterms) ? $objectsrc->fk_incoterms : ''), (!empty($objectsrc->location_incoterms)?$objectsrc->location_incoterms:'')); + $incoterm_id = GETPOST('incoterm_id'); + $incoterm_location = GETPOST('location_incoterms'); + if (empty($incoterm_id)) + { + $incoterm_id = (!empty($objectsrc->fk_incoterms) ? $objectsrc->fk_incoterms : $soc->fk_incoterms); + $incoterm_location = (!empty($objectsrc->location_incoterms) ? $objectsrc->location_incoterms : $soc->location_incoterms); + } + print $form->select_incoterms($incoterm_id, $incoterm_location); print ''; } @@ -1696,44 +1708,12 @@ if ($action == 'create' && $user->rights->commande->creer) } print '' . $langs->trans('TotalTTC') . '' . price($objectsrc->total_ttc) . ""; - + if (!empty($conf->multicurrency->enabled)) { print '' . $langs->trans('MulticurrencyTotalHT') . '' . price($objectsrc->multicurrency_total_ht) . ''; print '' . $langs->trans('MulticurrencyTotalVAT') . '' . price($objectsrc->multicurrency_total_tva) . ""; - print '' . $langs->trans('MulticurrencyTotalTTC') . '' . price($objectsrc->multicurrency_total_ttc) . ""; - } - } - else - { - if (! empty($conf->global->PRODUCT_SHOW_WHEN_CREATE)) - { - /* - * Services/produits predefinis - */ - $NBLINES = 8; - - print ''; - - print ''; - print ''; - print ''; - print ''; - print ''; - for($i = 1; $i <= $NBLINES; $i ++) { - print ''; - print ''; - print ''; - } - - print '
' . $langs->trans('ProductsAndServices') . '' . $langs->trans('Qty') . '' . $langs->trans('ReductionShort') . '
'; - // multiprix - if (! empty($conf->global->PRODUIT_MULTIPRICES)) - print $form->select_produits('', 'idprod' . $i, '', $conf->product->limit_size, $soc->price_level); - else - print $form->select_produits('', 'idprod' . $i, '', $conf->product->limit_size); - print '%
'; - print ''; + print '' . $langs->trans('MulticurrencyTotalTTC') . '' . price($objectsrc->multicurrency_total_ttc) . ""; } } @@ -1747,7 +1727,7 @@ if ($action == 'create' && $user->rights->commande->creer) print '     '; print ''; print '
'; - + print ''; // Show origin lines @@ -1785,16 +1765,12 @@ if ($action == 'create' && $user->rights->commande->creer) $formconfirm = ''; - /* - * Confirmation de la suppression de la commande - */ + // Confirmation to delete if ($action == 'delete') { $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteOrder'), $langs->trans('ConfirmDeleteOrder'), 'confirm_delete', '', 0, 1); } - /* - * Confirmation de la validation - */ + // Confirmation of validation if ($action == 'validate') { // on verifie si l'objet est en numerotation provisoire @@ -1945,80 +1921,74 @@ if ($action == 'create' && $user->rights->commande->creer) // Print form confirm print $formconfirm; - /* - * Commande - */ - $nbrow = 9; - if (! empty($conf->projet->enabled)) - $nbrow ++; - // Local taxes - if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) - $nbrow++; - if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0 ) - $nbrow++; - - print ''; + // Order card $linkback = '' . $langs->trans("BackToList") . ''; - // Ref - print ''; - print ''; - print ''; - // Ref commande client - print ''; - print ''; + $morehtmlref='
'; + // Ref customer + $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->commande->creer, 'string', '', 0, 1); + $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->commande->creer, 'string', '', null, null, '', 1); + // Thirdparty + $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $soc->getNomUrl(1); + // Project + if (! empty($conf->projet->enabled)) + { + $langs->load("projects"); + $morehtmlref.='
'.$langs->trans('Project') . ' '; + if ($user->rights->commande->creer) + { + if ($action != 'classify') + $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.='
'; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.=''; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (! empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref.=''; + $morehtmlref.=$proj->ref; + $morehtmlref.=''; + } else { + $morehtmlref.=''; + } + } + } + $morehtmlref.='
'; - // Third party - print ''; + + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + + + print '
'; + print '
'; + print '
'; + + print '
' . $langs->trans('Ref') . ''; - print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref'); - print '
'; - print ''; - if ($action != 'refcustomer' && $object->brouillon) - print ''; - print '
'; - print $langs->trans('RefCustomer') . ''; - print '' . img_edit($langs->trans('Modify')) . '
'; - print '
'; - if ($user->rights->commande->creer && $action == 'refcustomer') { - print '
'; - print ''; - print ''; - print ''; - print ' '; - print '
'; - } else { - print $object->ref_client; - } - print '
'; - print ''; - print ''; - print ''; - print '
' . $langs->trans('Company') . ''; - if (! empty($conf->global->COMMANDE_CHANGE_THIRDPARTY) && $action != 'editthirdparty' && $object->brouillon && $user->rights->commande->creer) - print 'id . '">' . img_edit($langs->trans('SetLinkToThirdParty'), 1) . '
'; - print '
'; - if ($action == 'editthirdparty') { - $form->form_thirdparty($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, 'socid','client>0'); - } else { - print $soc->getNomUrl(1, 'compta'); - } - print '
'; if ($soc->outstanding_limit) { // Outstanding Bill - print ''; print ''; } - + // 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 @@ -2033,7 +2003,7 @@ if ($action == 'create' && $user->rights->commande->creer) $addabsolutediscount = '' . $langs->trans("EditGlobalDiscounts") . ''; $addcreditnote = '' . $langs->trans("AddCreditNote") . ''; - print ''; print '
'; + print '
'; print $langs->trans('OutstandingBill'); - print ''; + print ''; print price($soc->get_OutstandingBill()) . ' / '; print price($soc->outstanding_limit, 0, '', 1, - 1, - 1, $conf->currency); print '
' . $langs->trans('Discounts') . ''; + print '
' . $langs->trans('Discounts') . ''; if ($soc->remise_percent) print $langs->trans("CompanyHasRelativeDiscount", $soc->remise_percent); else @@ -2068,7 +2038,7 @@ if ($action == 'create' && $user->rights->commande->creer) if ($action != 'editdate' && $object->brouillon) print 'id . '">' . img_edit($langs->trans('SetDate'), 1) . '
'; - print ''; + print ''; if ($action == 'editdate') { print '
'; print ''; @@ -2086,14 +2056,14 @@ if ($action == 'create' && $user->rights->commande->creer) print ''; // Delivery date planed - print ''; + print ''; print ''; if ($action != 'editdate_livraison') print ''; print '
'; print $langs->trans('DateDeliveryPlanned'); print 'id . '">' . img_edit($langs->trans('SetDeliveryDate'), 1) . '
'; - print ''; + print ''; if ($action == 'editdate_livraison') { print ''; print ''; @@ -2119,7 +2089,7 @@ if ($action == 'create' && $user->rights->commande->creer) if ($action != 'editshippingmethod' && $user->rights->commande->creer) print 'id.'">'.img_edit($langs->trans('SetShippingMode'),1).''; print ''; - print ''; + print ''; if ($action == 'editshippingmethod') { $form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$object->id, $object->shipping_method_id, 'shipping_method_id', 1); } else { @@ -2140,7 +2110,7 @@ if ($action == 'create' && $user->rights->commande->creer) if ($action != 'editwarehouse' && $user->rights->commande->creer) print 'id.'">'.img_edit($langs->trans('SetWarehouse'),1).''; print ''; - print ''; + print ''; if ($action == 'editwarehouse') { $formproduct->formSelectWarehouses($_SERVER['PHP_SELF'].'?id='.$object->id, $object->warehouse_id, 'warehouse_id', 1); } else { @@ -2151,14 +2121,14 @@ if ($action == 'create' && $user->rights->commande->creer) } // Terms of payment - print ''; + print ''; print ''; if ($action != 'editconditions') print ''; print '
'; print $langs->trans('PaymentConditionsShort'); print 'id . '">' . img_edit($langs->trans('SetConditions'), 1) . '
'; - print ''; + print ''; if ($action == 'editconditions') { $form->form_conditions_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->cond_reglement_id, 'cond_reglement_id', 1); } else { @@ -2169,14 +2139,14 @@ if ($action == 'create' && $user->rights->commande->creer) print ''; // Mode of payment - print ''; + print ''; print ''; if ($action != 'editmode') print ''; print '
'; print $langs->trans('PaymentMode'); print 'id . '">' . img_edit($langs->trans('SetMode'), 1) . '
'; - print ''; + print ''; if ($action == 'editmode') { $form->form_modes_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->mode_reglement_id, 'mode_reglement_id'); } else { @@ -2189,31 +2159,31 @@ if ($action == 'create' && $user->rights->commande->creer) { // Multicurrency code print ''; - print ''; + print ''; print ''; if ($action != 'editmulticurrencycode' && ! empty($object->brouillon)) print ''; print '
'; print fieldLabel('Currency','multicurrency_code'); print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '
'; - print ''; + print ''; if ($action == 'editmulticurrencycode') { $form->form_multicurrency_code($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_code, 'multicurrency_code'); } else { $form->form_multicurrency_code($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_code, 'none'); } print ''; - + // Multicurrency rate print ''; - print ''; + print ''; print ''; if ($action != 'editmulticurrencyrate' && ! empty($object->brouillon)) print ''; print '
'; - print fieldLabel('Rate','multicurrency_tx'); + print fieldLabel('CurrencyRate','multicurrency_tx'); print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '
'; - print ''; + print ''; if ($action == 'editmulticurrencyrate') { $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code); } else { @@ -2230,7 +2200,7 @@ if ($action == 'create' && $user->rights->commande->creer) if ($action != 'editavailability') print 'id . '">' . img_edit($langs->trans('SetAvailability'), 1) . ''; print ''; - print ''; + print ''; if ($action == 'editavailability') { $form->form_availability($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->availability_id, 'availability_id', 1); } else { @@ -2246,7 +2216,7 @@ if ($action == 'create' && $user->rights->commande->creer) if ($action != 'editdemandreason') print 'id . '">' . img_edit($langs->trans('SetDemandReason'), 1) . ''; print ''; - print ''; + print ''; if ($action == 'editdemandreason') { $form->formInputReason($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->demand_reason_id, 'demand_reason_id', 1); } else { @@ -2263,37 +2233,18 @@ if ($action == 'create' && $user->rights->commande->creer) $totalVolume=$tmparray['volume']; if ($totalWeight || $totalVolume) { - print ''.$langs->trans("CalculatedWeight").' / '.$langs->trans("CalculatedVolume").''; - print ''; + print ''.$langs->trans("CalculatedWeight").''; + print ''; print showDimensionInBestUnit($totalWeight, 0, "weight", $langs, isset($conf->global->MAIN_WEIGHT_DEFAULT_ROUND)?$conf->global->MAIN_WEIGHT_DEFAULT_ROUND:-1, isset($conf->global->MAIN_WEIGHT_DEFAULT_UNIT)?$conf->global->MAIN_WEIGHT_DEFAULT_UNIT:'no'); - print ' / '; + print ''; + print ''.$langs->trans("CalculatedVolume").''; + 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 ''; - } - - // TODO How record was recorded OrderMode (llx_c_input_method) - - // Project - if (! empty($conf->projet->enabled)) - { - $langs->load('projects'); - print ''; - print ''; - if ($action != 'classify') - print ''; - print '
'; - print $langs->trans('Project'); - print '' . img_edit($langs->trans('SetProject')) . '
'; - print ''; - // print "$object->id, $object->socid, $object->fk_project"; - if ($action == 'classify') { - $form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1); - } else { - $form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0); - } - print ''; } + // TODO How record was recorded OrderMode (llx_c_input_method) + // Incoterms if (!empty($conf->incoterm->enabled)) { @@ -2317,16 +2268,6 @@ if ($action == 'create' && $user->rights->commande->creer) print ''; } - // Other attributes - $cols = 3; - include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; - - $rowspan = 4; - if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) - $rowspan ++; - if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) - $rowspan ++; - // Bank Account if (! empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_ORDER) && ! empty($conf->banque->enabled)) { @@ -2347,20 +2288,41 @@ if ($action == 'create' && $user->rights->commande->creer) print ''; } + // Other attributes + $cols = 2; + include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; + + print ''; + + print '
'; + print '
'; + print '
'; + print '
'; + + print ''; + + if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency)) + { + // Multicurrency Amount HT + print ''; + print ''; + print ''; + + // Multicurrency Amount VAT + print ''; + print ''; + print ''; + + // Multicurrency Amount TTC + print ''; + print ''; + print ''; + } + // Total HT - print ''; + print ''; print ''; - // Margin Infos - if (! empty($conf->margin->enabled)) { - print ''; - } else - print ''; - - print ''; - // Total VAT print ''; @@ -2379,29 +2341,22 @@ if ($action == 'create' && $user->rights->commande->creer) // Total TTC print ''; - if (!empty($conf->multicurrency->enabled)) - { - // Multicurrency Amount HT - print ''; - print ''; - print ''; - - // Multicurrency Amount VAT - print ''; - print ''; - print ''; - - // Multicurrency Amount TTC - print ''; - print ''; - print ''; + // Statut + //print ''; + + print '
' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . '' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . '' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . '' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . $langs->trans('AmountHT') . '
' . $langs->trans('AmountHT') . '' . price($object->total_ht, 1, '', 1, - 1, - 1, $conf->currency) . ''; - $formmargin->displayMarginInfos($object); - print '
' . $langs->trans('AmountVAT') . '' . price($object->total_tva, 1, '', 1, - 1, - 1, $conf->currency) . '
' . $langs->trans('AmountTTC') . '' . price($object->total_ttc, 1, '', 1, - 1, - 1, $conf->currency) . '
' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . '' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . '' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . '' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . $langs->trans('Status') . '' . $object->getLibStatut(4) . '
'; + + // Margin Infos + if (! empty($conf->margin->enabled)) { + $formmargin->displayMarginInfos($object); } - // Statut - print '' . $langs->trans('Status') . '' . $object->getLibStatut(4) . ''; - print '
'; - print "\n"; + print '
'; + print '
'; + print ''; + + print '

'; if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) { $blocname = 'contacts'; @@ -2513,7 +2468,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) { @@ -2608,14 +2563,12 @@ if ($action == 'create' && $user->rights->commande->creer) $urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id; $genallowed = $user->rights->commande->creer; $delallowed = $user->rights->commande->supprimer; - $somethingshown = $formfile->show_documents('commande', $comref, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang); + print $formfile->showdocuments('commande', $comref, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang); - // Linked object block - $somethingshown = $form->showLinkedObjectBlock($object); // Show links to link elements - //$linktoelem = $form->showLinkToObjectBlock($object); - //if ($linktoelem) print '
'.$linktoelem; + $linktoelem = $form->showLinkToObjectBlock($object, null, array('order')); + $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem); print '
'; @@ -2676,10 +2629,12 @@ if ($action == 'create' && $user->rights->commande->creer) include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; $formmail = new FormMail($db); $formmail->param['langsmodels']=(empty($newlang)?$langs->defaultlang:$newlang); - $formmail->fromtype = 'user'; - $formmail->fromid = $user->id; - $formmail->fromname = $user->getFullName($langs); - $formmail->frommail = $user->email; + $formmail->fromtype = (GETPOST('fromtype')?GETPOST('fromtype'):(!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE)?$conf->global->MAIN_MAIL_DEFAULT_FROMTYPE:'user')); + + if($formmail->fromtype === 'user'){ + $formmail->fromid = $user->id; + + } $formmail->trackid='ord'.$object->id; if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set { diff --git a/htdocs/commande/class/api_commande.class.php b/htdocs/commande/class/api_deprecated_commande.class.php similarity index 90% rename from htdocs/commande/class/api_commande.class.php rename to htdocs/commande/class/api_deprecated_commande.class.php index d6a2a3d0f82..06da6fa874a 100644 --- a/htdocs/commande/class/api_commande.class.php +++ b/htdocs/commande/class/api_deprecated_commande.class.php @@ -23,19 +23,19 @@ * API class for commande object * * @smart-auto-routing false - * @access protected + * @access protected * @class DolibarrApiAccess {@requires user,external} - * + * * @category Api * @package Api - * * + * @deprecated Use Orders instead (defined in api_orders.class.php) */ class CommandeApi extends DolibarrApi { /** - * @var array $FIELDS Mandatory fields, checked when create and update object + * @var array $FIELDS Mandatory fields, checked when create and update object */ static $FIELDS = array( 'socid' @@ -47,10 +47,10 @@ class CommandeApi extends DolibarrApi public $commande; /** - * Constructor + * Constructor Warning: Deprecated * * @url GET order/ - * + * */ function __construct() { @@ -60,69 +60,69 @@ class CommandeApi extends DolibarrApi } /** - * Get properties of a commande object + * Get properties of a commande object Warning: Deprecated * * Return an array with commande informations - * + * * @param int $id ID of order * @param string $ref Ref of object * @param string $ref_ext External reference of object * @param string $ref_int Internal reference of other object * @return array|mixed data without useless information * - * @url GET order/{id} + * @url GET order/{id} * @throws RestException */ function get($id='',$ref='', $ref_ext='', $ref_int='') - { + { if(! DolibarrApiAccess::$user->rights->commande->lire) { throw new RestException(401); } - + $result = $this->commande->fetch($id); if( ! $result ) { throw new RestException(404, 'Order not found'); } - + if( ! DolibarrApi::_checkAccessToResource('commande',$this->commande->id)) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } - + $this->commande->fetchObjectLinked(); return $this->_cleanObjectDatas($this->commande); } /** - * List orders - * + * List orders Warning: Deprecated + * * Get a list of orders - * - * @param int $mode Use this param to filter list + * * @param string $sortfield Sort field * @param string $sortorder Sort order * @param int $limit Limit for list * @param int $page Page number - * @param string $societe Societe filter field + * @param int $mode Use this param to filter list + * @param string $societe Thirdparty filter field * * @url GET /order/list * @return array Array of order objects */ - function getList($mode=0, $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0, $societe = 0) { + function getList($sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0, $mode=0, $societe = 0) { global $db, $conf; - + $obj_ret = array(); // case of external user, $societe param is ignored and replaced by user's socid $socid = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : $societe; - + // If the internal user must only see his customers, force searching by him if (! DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) $search_sale = DolibarrApiAccess::$user->id; $sql = "SELECT s.rowid"; if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects) $sql.= " FROM ".MAIN_DB_PREFIX."commande as s"; - + if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale - + // Example of use $mode //if ($mode == 1) $sql.= " AND s.client IN (1, 3)"; //if ($mode == 2) $sql.= " AND s.client IN (2, 3)"; @@ -131,13 +131,13 @@ class CommandeApi extends DolibarrApi if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= " AND s.fk_soc = sc.fk_soc"; if ($socid) $sql.= " AND s.fk_soc = ".$socid; if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc"; // Join for the needed table to filter by sale - + // Insert sale filter if ($search_sale > 0) { $sql .= " AND sc.fk_user = ".$search_sale; } - + $nbtotalofrecords = 0; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { @@ -157,11 +157,12 @@ class CommandeApi extends DolibarrApi } $result = $db->query($sql); - + if ($result) { + $i=0; $num = $db->num_rows($result); - while ($i < $num) + while ($i < min($num, ($limit <= 0 ? $num : $limit))) { $obj = $db->fetch_object($result); $commande_static = new Commande($db); @@ -181,10 +182,10 @@ class CommandeApi extends DolibarrApi } /** - * List orders for specific thirdparty - * + * List orders for specific thirdparty Warning: Deprecated + * * Get a list of orders - * + * * @param int $socid Id of customer * * @url GET /customer/{socid}/order/list @@ -195,14 +196,14 @@ class CommandeApi extends DolibarrApi return getList(0,"s.rowid","ASC",0,0,$socid); } - + /** - * Create order object + * Create order object Warning: Deprecated * * @param array $request_data Request datas - * + * * @url POST order/ - * + * * @return int ID of commande */ function post($request_data = NULL) @@ -226,29 +227,29 @@ class CommandeApi extends DolibarrApi if(! $this->commande->create(DolibarrApiAccess::$user) ) { throw new RestException(500, "Error while creating order"); } - + return $this->commande->id; } /** - * Get lines of an order + * Get lines of an order Warning: Deprecated * * * @param int $id Id of order - * + * * @url GET order/{id}/line/list - * - * @return int + * + * @return int */ function getLines($id) { if(! DolibarrApiAccess::$user->rights->commande->lire) { throw new RestException(401); } - + $result = $this->commande->fetch($id); if( ! $result ) { throw new RestException(404, 'Commande not found'); } - + if( ! DolibarrApi::_checkAccessToResource('commande',$this->commande->id)) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } @@ -260,26 +261,26 @@ class CommandeApi extends DolibarrApi return $result; } /** - * Add a line to given order + * Add a line to given order Warning: Deprecated * * * @param int $id Id of commande to update - * @param array $request_data Orderline data - * + * @param array $request_data Orderline data + * * @url POST order/{id}/line - * - * @return int + * + * @return int */ function postLine($id, $request_data = NULL) { if(! DolibarrApiAccess::$user->rights->commande->creer) { throw new RestException(401); } - + $result = $this->commande->fetch($id); if( ! $result ) { throw new RestException(404, 'Commande not found'); } - + if( ! DolibarrApi::_checkAccessToResource('commande',$this->commande->id)) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } @@ -319,27 +320,27 @@ class CommandeApi extends DolibarrApi return false; } /** - * Update a line to given order + * Update a line to given order Warning: Deprecated * * * @param int $id Id of commande to update * @param int $lineid Id of line to update - * @param array $request_data Orderline data - * + * @param array $request_data Orderline data + * * @url PUT order/{id}/line/{lineid} - * - * @return object + * + * @return object */ function putLine($id, $lineid, $request_data = NULL) { if(! DolibarrApiAccess::$user->rights->commande->creer) { throw new RestException(401); } - + $result = $this->commande->fetch($id); if( ! $result ) { throw new RestException(404, 'Commande not found'); } - + if( ! DolibarrApi::_checkAccessToResource('commande',$this->commande->id)) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } @@ -376,31 +377,31 @@ class CommandeApi extends DolibarrApi return false; } /** - * Delete a line to given order + * Delete a line to given order Warning: Deprecated * * * @param int $id Id of commande to update * @param int $lineid Id of line to delete - * + * * @url DELETE order/{id}/line/{lineid} - * - * @return int + * + * @return int */ function delLine($id, $lineid) { if(! DolibarrApiAccess::$user->rights->commande->creer) { throw new RestException(401); } - + $result = $this->commande->fetch($id); if( ! $result ) { throw new RestException(404, 'Commande not found'); } - + if( ! DolibarrApi::_checkAccessToResource('commande',$this->commande->id)) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } $request_data = (object) $request_data; - $updateRes = $this->commande->deleteline($lineid); + $updateRes = $this->commande->deleteline(DolibarrApiAccess::$user,$lineid); if ($updateRes == 1) { return $this->get($id); } @@ -408,45 +409,45 @@ class CommandeApi extends DolibarrApi } /** - * Update order general fields (won't touch lines of order) + * Update order general fields (won't touch lines of order) Warning: Deprecated * * @param int $id Id of commande to update - * @param array $request_data Datas - * + * @param array $request_data Datas + * * @url PUT order/{id} - * - * @return int + * + * @return int */ function put($id, $request_data = NULL) { if(! DolibarrApiAccess::$user->rights->commande->creer) { throw new RestException(401); } - + $result = $this->commande->fetch($id); if( ! $result ) { throw new RestException(404, 'Commande not found'); } - + if( ! DolibarrApi::_checkAccessToResource('commande',$this->commande->id)) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } foreach($request_data as $field => $value) { $this->commande->$field = $value; } - + if($this->commande->update($id, DolibarrApiAccess::$user,1,'','','update')) return $this->get($id); - + return false; } - + /** - * Delete order + * Delete order Warning: Deprecated * * @param int $id Order ID - * + * * @url DELETE order/{id} - * + * * @return array */ function delete($id) @@ -458,35 +459,35 @@ class CommandeApi extends DolibarrApi if( ! $result ) { throw new RestException(404, 'Order not found'); } - + if( ! DolibarrApi::_checkAccessToResource('commande',$this->commande->id)) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } - + if( ! $this->commande->delete(DolibarrApiAccess::$user)) { throw new RestException(500, 'Error when delete order : '.$this->commande->error); } - + return array( 'success' => array( 'code' => 200, 'message' => 'Order deleted' ) ); - + } - + /** - * Validate an order - * + * Validate an order Warning: Deprecated + * * @param int $id Order ID * @param int $idwarehouse Warehouse ID - * + * * @url GET order/{id}/validate * @url POST order/{id}/validate - * + * * @return array - * + * */ function validOrder($id, $idwarehouse=0) { @@ -497,15 +498,15 @@ class CommandeApi extends DolibarrApi if( ! $result ) { throw new RestException(404, 'Order not found'); } - + if( ! DolibarrApi::_checkAccessToResource('commande',$this->commande->id)) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } - + if( ! $this->commande->valid(DolibarrApiAccess::$user, $idwarehouse)) { throw new RestException(500, 'Error when validate order'); } - + return array( 'success' => array( 'code' => 200, @@ -513,12 +514,12 @@ class CommandeApi extends DolibarrApi ) ); } - + /** * Validate fields before create or update object - * + * * @param array $data Array with data to verify - * @return array + * @return array * @throws RestException */ function _validate($data) @@ -528,7 +529,7 @@ class CommandeApi extends DolibarrApi if (!isset($data[$field])) throw new RestException(400, "$field field missing"); $commande[$field] = $data[$field]; - + } return $commande; } diff --git a/htdocs/commande/class/api_orders.class.php b/htdocs/commande/class/api_orders.class.php new file mode 100644 index 00000000000..f000e4ce201 --- /dev/null +++ b/htdocs/commande/class/api_orders.class.php @@ -0,0 +1,511 @@ + + * Copyright (C) 2016 Laurent Destailleur + * + * 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 . + */ + + use Luracast\Restler\RestException; + + require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; + +/** + * API class for orders + * + * @access protected + * @class DolibarrApiAccess {@requires user,external} + */ +class Orders extends DolibarrApi +{ + + /** + * @var array $FIELDS Mandatory fields, checked when create and update object + */ + static $FIELDS = array( + 'socid' + ); + + /** + * @var Commande $commande {@type Commande} + */ + public $commande; + + /** + * Constructor + */ + function __construct() + { + global $db, $conf; + $this->db = $db; + $this->commande = new Commande($this->db); + } + + /** + * Get properties of a commande object + * + * Return an array with commande informations + * + * @param int $id ID of order + * @return array|mixed data without useless information + * + * @throws RestException + */ + function get($id) + { + if(! DolibarrApiAccess::$user->rights->commande->lire) { + throw new RestException(401); + } + + $result = $this->commande->fetch($id); + if( ! $result ) { + throw new RestException(404, 'Order not found'); + } + + if( ! DolibarrApi::_checkAccessToResource('commande',$this->commande->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + + $this->commande->fetchObjectLinked(); + return $this->_cleanObjectDatas($this->commande); + } + + + + /** + * List orders + * + * Get a list of orders + * + * @param string $sortfield Sort field + * @param string $sortorder Sort order + * @param int $limit Limit for list + * @param int $page Page number + * @param string $thirdparty_ids Thirdparty ids to filter orders of. {@example '1' or '1,2,3'} {@pattern /^[0-9,]*$/i} + * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" + * @return array Array of order objects + */ + function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '') { + global $db, $conf; + + $obj_ret = array(); + // case of external user, $thirdpartyid param is ignored and replaced by user's socid + $socids = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : $thirdparty_ids; + + // If the internal user must only see his customers, force searching by him + if (! DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) $search_sale = DolibarrApiAccess::$user->id; + + $sql = "SELECT t.rowid"; + if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects) + $sql.= " FROM ".MAIN_DB_PREFIX."commande as t"; + + if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale + + $sql.= ' WHERE t.entity IN ('.getEntity('commande', 1).')'; + if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql.= " AND t.fk_soc = sc.fk_soc"; + if ($socids) $sql.= " AND t.fk_soc IN (".$socids.")"; + if ($search_sale > 0) $sql.= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale + // Insert sale filter + if ($search_sale > 0) + { + $sql .= " AND sc.fk_user = ".$search_sale; + } + // Add sql filters + if ($sqlfilters) + { + if (! DolibarrApi::_checkFilters($sqlfilters)) + { + throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); + } + $regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; + } + + $sql.= $db->order($sortfield, $sortorder); + if ($limit) { + if ($page < 0) + { + $page = 0; + } + $offset = $limit * $page; + + $sql.= $db->plimit($limit + 1, $offset); + } + + dol_syslog("API Rest request"); + $result = $db->query($sql); + + if ($result) + { + $num = $db->num_rows($result); + while ($i < min($num, ($limit <= 0 ? $num : $limit))) + { + $obj = $db->fetch_object($result); + $commande_static = new Commande($db); + if($commande_static->fetch($obj->rowid)) { + $obj_ret[] = parent::_cleanObjectDatas($commande_static); + } + $i++; + } + } + else { + throw new RestException(503, 'Error when retrieve commande list'); + } + if( ! count($obj_ret)) { + throw new RestException(404, 'No order found'); + } + return $obj_ret; + } + + /** + * Create order object + * + * @param array $request_data Request data + * @return int ID of commande + */ + function post($request_data = NULL) + { + if(! DolibarrApiAccess::$user->rights->commande->creer) { + throw new RestException(401, "Insuffisant rights"); + } + // Check mandatory fields + $result = $this->_validate($request_data); + + foreach($request_data as $field => $value) { + $this->commande->$field = $value; + } + /*if (isset($request_data["lines"])) { + $lines = array(); + foreach ($request_data["lines"] as $line) { + array_push($lines, (object) $line); + } + $this->commande->lines = $lines; + }*/ + if ($this->commande->create(DolibarrApiAccess::$user) <= 0) { + $errormsg = $this->commande->error; + throw new RestException(500, $errormsg ? $errormsg : "Error while creating order"); + } + + return $this->commande->id; + } + + /** + * Get lines of an order + * + * @param int $id Id of order + * + * @url GET {id}/lines + * + * @return int + */ + function getLines($id) { + if(! DolibarrApiAccess::$user->rights->commande->lire) { + throw new RestException(401); + } + + $result = $this->commande->fetch($id); + if( ! $result ) { + throw new RestException(404, 'Order not found'); + } + + if( ! DolibarrApi::_checkAccessToResource('commande',$this->commande->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + $this->commande->getLinesArray(); + $result = array(); + foreach ($this->commande->lines as $line) { + array_push($result,$this->_cleanObjectDatas($line)); + } + return $result; + } + + /** + * Add a line to given order + * + * @param int $id Id of commande to update + * @param array $request_data Orderline data + * + * @url POST {id}/lines + * + * @return int + */ + function postLine($id, $request_data = NULL) { + if(! DolibarrApiAccess::$user->rights->commande->creer) { + throw new RestException(401); + } + + $result = $this->commande->fetch($id); + if( ! $result ) { + throw new RestException(404, 'Order not found'); + } + + if( ! DolibarrApi::_checkAccessToResource('commande',$this->commande->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + $request_data = (object) $request_data; + $updateRes = $this->commande->addline( + $request_data->desc, + $request_data->subprice, + $request_data->qty, + $request_data->tva_tx, + $request_data->localtax1_tx, + $request_data->localtax2_tx, + $request_data->fk_product, + $request_data->remise_percent, + $request_data->info_bits, + $request_data->fk_remise_except, + 'HT', + 0, + $request_data->date_start, + $request_data->date_end, + $request_data->product_type, + $request_data->rang, + $request_data->special_code, + $fk_parent_line, + $request_data->fk_fournprice, + $request_data->pa_ht, + $request_data->label, + $request_data->array_options, + $request_data->fk_unit, + $this->element, + $request_data->id + ); + + if ($updateRes > 0) { + return $this->get($id)->line->rowid; + + } + return false; + } + + /** + * Update a line to given order + * + * @param int $id Id of commande to update + * @param int $lineid Id of line to update + * @param array $request_data Orderline data + * + * @url PUT {id}/lines/{lineid} + * + * @return object + */ + function putLine($id, $lineid, $request_data = NULL) { + if(! DolibarrApiAccess::$user->rights->commande->creer) { + throw new RestException(401); + } + + $result = $this->commande->fetch($id); + if( ! $result ) { + throw new RestException(404, 'Commande not found'); + } + + if( ! DolibarrApi::_checkAccessToResource('commande',$this->commande->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + $request_data = (object) $request_data; + $updateRes = $this->commande->updateline( + $lineid, + $request_data->desc, + $request_data->subprice, + $request_data->qty, + $request_data->remise_percent, + $request_data->tva_tx, + $request_data->localtax1_tx, + $request_data->localtax2_tx, + 'HT', + $request_data->info_bits, + $request_data->date_start, + $request_data->date_end, + $request_data->product_type, + $request_data->fk_parent_line, + 0, + $request_data->fk_fournprice, + $request_data->pa_ht, + $request_data->label, + $request_data->special_code, + $request_data->array_options, + $request_data->fk_unit + ); + + if ($updateRes > 0) { + $result = $this->get($id); + unset($result->line); + return $this->_cleanObjectDatas($result); + } + return false; + } + + /** + * Delete a line to given order + * + * + * @param int $id Id of commande to update + * @param int $lineid Id of line to delete + * + * @url DELETE {id}/lines/{lineid} + * + * @return int + */ + function delLine($id, $lineid) { + if(! DolibarrApiAccess::$user->rights->commande->creer) { + throw new RestException(401); + } + + $result = $this->commande->fetch($id); + if( ! $result ) { + throw new RestException(404, 'Commande not found'); + } + + if( ! DolibarrApi::_checkAccessToResource('commande',$this->commande->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + $request_data = (object) $request_data; + $updateRes = $this->commande->deleteline(DolibarrApiAccess::$user,$lineid); + if ($updateRes == 1) { + return $this->get($id); + } + return false; + } + + /** + * Update order general fields (won't touch lines of order) + * + * @param int $id Id of commande to update + * @param array $request_data Datas + * + * @return int + */ + function put($id, $request_data = NULL) { + if(! DolibarrApiAccess::$user->rights->commande->creer) { + throw new RestException(401); + } + + $result = $this->commande->fetch($id); + if( ! $result ) { + throw new RestException(404, 'Commande not found'); + } + + if( ! DolibarrApi::_checkAccessToResource('commande',$this->commande->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + foreach($request_data as $field => $value) { + $this->commande->$field = $value; + } + + if($this->commande->update($id, DolibarrApiAccess::$user, 1, '', '', 'update')) + return $this->get($id); + + return false; + } + + /** + * Delete order + * + * @param int $id Order ID + * + * @return array + */ + function delete($id) + { + if(! DolibarrApiAccess::$user->rights->commande->supprimer) { + throw new RestException(401); + } + $result = $this->commande->fetch($id); + if( ! $result ) { + throw new RestException(404, 'Order not found'); + } + + if( ! DolibarrApi::_checkAccessToResource('commande',$this->commande->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + + if( ! $this->commande->delete(DolibarrApiAccess::$user)) { + throw new RestException(500, 'Error when delete order : '.$this->commande->error); + } + + return array( + 'success' => array( + 'code' => 200, + 'message' => 'Order deleted' + ) + ); + + } + + /** + * Validate an order + * + * @param int $id Order ID + * @param int $idwarehouse Warehouse ID + * @param int $notrigger 1=Does not execute triggers, 0= execute triggers + * + * @url POST {id}/validate + * + * @return array + * FIXME An error 403 is returned if the request has an empty body. + * Error message: "Forbidden: Content type `text/plain` is not supported." + * Workaround: send this in the body + * { + * "idwarehouse": 0, + * "notrigger": 0 + * } + */ + function validate($id, $idwarehouse=0, $notrigger=0) + { + if(! DolibarrApiAccess::$user->rights->commande->creer) { + throw new RestException(401); + } + $result = $this->commande->fetch($id); + if( ! $result ) { + throw new RestException(404, 'Order not found'); + } + + if( ! DolibarrApi::_checkAccessToResource('commande',$this->commande->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + + $result = $this->commande->valid(DolibarrApiAccess::$user, $idwarehouse, $notrigger); + if ($result == 0) { + throw new RestException(500, 'Error nothing done. May be object is already validated'); + } + if ($result < 0) { + throw new RestException(500, 'Error when validating Order: '.$this->commande->error); + } + + return array( + 'success' => array( + 'code' => 200, + 'message' => 'Order validated' + ) + ); + } + + /** + * Validate fields before create or update object + * + * @param array $data Array with data to verify + * @return array + * @throws RestException + */ + function _validate($data) + { + $commande = array(); + foreach (Orders::$FIELDS as $field) { + if (!isset($data[$field])) + throw new RestException(400, "$field field missing"); + $commande[$field] = $data[$field]; + + } + return $commande; + } +} diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 3ecbe763d0b..1d46b62d8d0 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -47,6 +47,7 @@ class Commande extends CommonOrder public $class_element_line = 'OrderLine'; public $fk_element = 'fk_commande'; protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe + public $picto = 'order'; /** * {@inheritdoc} @@ -57,98 +58,100 @@ class Commande extends CommonOrder * Client ID * @var int */ - var $socid; + public $socid; - var $ref_client; - var $ref_int; - var $contactid; + public $ref_client; + public $ref_int; + public $contactid; /** * Status of the order. Check the following constants: * @var int * @see Commande::STATUS_CANCELED, Commande::STATUS_DRAFT, Commande::STATUS_ACCEPTED, Commande::STATUS_CLOSED */ - var $statut; + public $statut; /** * @deprecated * @see billed */ - var $facturee; - var $billed; // billed or not + public $facturee; + public $billed; // billed or not - var $brouillon; - var $cond_reglement_code; + public $brouillon; + public $cond_reglement_code; - var $fk_account; + public $fk_account; /** * It holds the label of the payment mode. Use it in case translation cannot be found. * @var string */ - var $mode_reglement; + public $mode_reglement; /** * Payment mode id * @var int */ - var $mode_reglement_id; + public $mode_reglement_id; /** * Payment mode code * @var string */ - var $mode_reglement_code; + public $mode_reglement_code; /** * Availability delivery time id * @var int */ - var $availability_id; + public $availability_id; /** * Availability delivery time code * @var string */ - var $availability_code; + public $availability_code; /** * Label of availability delivery time. Use it in case translation cannot be found. * @var string */ - var $availability; + public $availability; - var $demand_reason_id; - var $demand_reason_code; - var $address; - var $date; // Date commande + public $demand_reason_id; + public $demand_reason_code; + public $address; + public $date; // Date commande /** * @deprecated * @see date */ - var $date_commande; - var $date_livraison; // Date livraison souhaitee - var $fk_remise_except; - var $remise_percent; - var $remise_absolue; - var $info_bits; - var $rang; - var $special_code; - var $source; // Origin of order - var $extraparams=array(); + public $date_commande; + public $date_livraison; // Date livraison souhaitee + public $fk_remise_except; + public $remise_percent; + public $remise_absolue; + public $info_bits; + public $rang; + public $special_code; + public $source; // Origin of order + public $extraparams=array(); - var $linked_objects=array(); + public $linked_objects=array(); - var $user_author_id; + public $user_author_id; /** * @var OrderLine[] */ - var $lines = array(); + public $lines = array(); // Multicurrency - var $fk_multicurrency; - var $multicurrency_code; - var $multicurrency_tx; - var $multicurrency_total_ht; - var $multicurrency_total_tva; - var $multicurrency_total_ttc; - + public $fk_multicurrency; + public $multicurrency_code; + public $multicurrency_tx; + public $multicurrency_total_ht; + public $multicurrency_total_tva; + public $multicurrency_total_ttc; + + public $oldcopy; + /** * ERR Not enough stock */ @@ -256,8 +259,8 @@ class Commande extends CommonOrder * * @param User $user User making status change * @param int $idwarehouse Id of warehouse to use for stock decrease - * @param int $notrigger 1=Does not execute triggers, 0= execuete triggers - * @return int <=0 if OK, >0 if KO + * @param int $notrigger 1=Does not execute triggers, 0= execute triggers + * @return int <=0 if OK, 0=Nothing done, >0 if KO */ function valid($user, $idwarehouse=0, $notrigger=0) { @@ -269,14 +272,14 @@ class Commande extends CommonOrder // Protection if ($this->statut == self::STATUS_VALIDATED) { - dol_syslog(get_class($this)."::valid action abandonned: no draft status", LOG_WARNING); + dol_syslog(get_class($this)."::valid action abandonned: already validated", LOG_WARNING); return 0; } if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->creer)) || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->order_advance->validate)))) { - $this->error='ErrorPermissionDenied'; + $this->error='NotEnoughPermissions'; dol_syslog(get_class($this)."::valid ".$this->error, LOG_ERR); return -1; } @@ -449,6 +452,8 @@ class Commande extends CommonOrder // If stock is decremented on validate order, we must reincrement it if (! empty($conf->stock->enabled) && $conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER == 1) { + $result = 0; + require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php'; $langs->load("agenda"); @@ -460,30 +465,17 @@ class Commande extends CommonOrder $mouvP = new MouvementStock($this->db); // We increment stock of product (and sub-products) $result=$mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, 0, $langs->trans("OrderBackToDraftInDolibarr",$this->ref)); - if ($result < 0) { $error++; } + if ($result < 0) { $error++; $this->error=$mouvP->error; break; } } } - - if (!$error) - { - $this->statut=self::STATUS_DRAFT; - $this->db->commit(); - return $result; - } - else - { - $this->error=$mouvP->error; - $this->db->rollback(); - return $result; - } } if (!$error) { // Call trigger - $result=$this->call_trigger('ORDER_SETDRAFT',$user); + $result=$this->call_trigger('ORDER_UNVALIDATE',$user); if ($result < 0) $error++; } - + if (!$error) { $this->statut=self::STATUS_DRAFT; $this->db->commit(); @@ -702,8 +694,8 @@ class Commande extends CommonOrder * Note that this->ref can be set or empty. If empty, we will use "(PROV)" * * @param User $user Objet user that make creation - * @param int $notrigger Disable all triggers - * @return int <0 if KO, >0 if OK + * @param int $notrigger Disable all triggers + * @return int <0 if KO, >0 if OK */ function create($user, $notrigger=0) { @@ -712,7 +704,7 @@ class Commande extends CommonOrder // Clean parameters $this->brouillon = 1; // set command as draft - + // Multicurrency (test on $this->multicurrency_tx because we sould take the default rate only if not using origin rate) if (!empty($this->multicurrency_code) && empty($this->multicurrency_tx)) list($this->fk_multicurrency,$this->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code); else $this->fk_multicurrency = MultiCurrency::getIdFromCode($this->db, $this->multicurrency_code); @@ -722,7 +714,7 @@ class Commande extends CommonOrder $this->fk_multicurrency = 0; $this->multicurrency_tx = 1; } - + dol_syslog(get_class($this)."::create user=".$user->id); // Check parameters @@ -817,37 +809,43 @@ class Commande extends CommonOrder */ for ($i=0;$i<$num;$i++) { + $line = $this->lines[$i]; + + // Test and convert into object this->lines[$i]. When coming from REST API, we may still have an array + //if (! is_object($line)) $line=json_decode(json_encode($line), FALSE); // convert recursively array into object. + if (! is_object($line)) $line = (object) $line; + // Reset fk_parent_line for no child products and special product - if (($this->lines[$i]->product_type != 9 && empty($this->lines[$i]->fk_parent_line)) || $this->lines[$i]->product_type == 9) { + if (($line->product_type != 9 && empty($line->fk_parent_line)) || $line->product_type == 9) { $fk_parent_line = 0; } $result = $this->addline( - $this->lines[$i]->desc, - $this->lines[$i]->subprice, - $this->lines[$i]->qty, - $this->lines[$i]->tva_tx, - $this->lines[$i]->localtax1_tx, - $this->lines[$i]->localtax2_tx, - $this->lines[$i]->fk_product, - $this->lines[$i]->remise_percent, - $this->lines[$i]->info_bits, - $this->lines[$i]->fk_remise_except, + $line->desc, + $line->subprice, + $line->qty, + $line->tva_tx, + $line->localtax1_tx, + $line->localtax2_tx, + $line->fk_product, + $line->remise_percent, + $line->info_bits, + $line->fk_remise_except, 'HT', 0, - $this->lines[$i]->date_start, - $this->lines[$i]->date_end, - $this->lines[$i]->product_type, - $this->lines[$i]->rang, - $this->lines[$i]->special_code, + $line->date_start, + $line->date_end, + $line->product_type, + $line->rang, + $line->special_code, $fk_parent_line, - $this->lines[$i]->fk_fournprice, - $this->lines[$i]->pa_ht, - $this->lines[$i]->label, - $this->lines[$i]->array_options, - $this->lines[$i]->fk_unit, + $line->fk_fournprice, + $line->pa_ht, + $line->label, + $line->array_options, + $line->fk_unit, $this->element, - $this->lines[$i]->id + $line->id ); if ($result < 0) { @@ -860,7 +858,7 @@ class Commande extends CommonOrder return -1; } // Defined the new fk_parent_line - if ($result > 0 && $this->lines[$i]->product_type == 9) { + if ($result > 0 && $line->product_type == 9) { $fk_parent_line = $result; } } @@ -888,30 +886,40 @@ class Commande extends CommonOrder $error++; } - // TODO mutualiser - if ($origin == 'propal' && $origin_id) + if (! empty($conf->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN)) { - // On recupere les differents contact interne et externe - $prop = new Propal($this->db); - $prop->fetch($origin_id); + $originforcontact = $origin; + $originidforcontact = $origin_id; + if ($originforcontact == 'shipping') // shipment and order share the same contacts. If creating from shipment we take data of order + { + require_once DOL_DOCUMENT_ROOT . '/expedition/class/expedition.class.php'; + $exp = new Expedition($db); + $exp->fetch($origin_id); + $exp->fetchObjectLinked(); + if (count($exp->linkedObjectsIds['commande']) > 0) + { + foreach ($exp->linkedObjectsIds['commande'] as $key => $value) + { + $originforcontact = 'commande'; + $originidforcontact = $value->id; + break; // We take first one + } + } + } - // We get ids of sales representatives of proposal - $this->userid = $prop->getIdcontact('internal', 'SALESREPFOLL'); + $sqlcontact = "SELECT ctc.code, ctc.source, ec.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."'"; - if ($this->userid) - { - //On passe le commercial suivi propale en commercial suivi commande - $this->add_contact($this->userid[0], 'SALESREPFOLL', 'internal'); - } - - // We get ids of customer follower of proposal - $this->contactid = $prop->getIdcontact('external', 'CUSTOMER'); - - if ($this->contactid) - { - //On passe le contact client suivi propale en contact client suivi commande - $this->add_contact($this->contactid[0], 'CUSTOMER', 'external'); - } + $resqlcontact = $this->db->query($sqlcontact); + if ($resqlcontact) + { + while($objcontact = $this->db->fetch_object($resqlcontact)) + { + //print $objcontact->code.'-'.$objcontact->source.'-'.$objcontact->fk_socpeople."\n"; + $this->add_contact($objcontact->fk_socpeople, $objcontact->code, $objcontact->source); // May failed because of duplicate key or because code of contact type does not exists for new object + } + } + else dol_print_error($resqlcontact); } } } @@ -919,22 +927,8 @@ class Commande extends CommonOrder if (! $error) { - //$action='create'; - - // Actions on extra fields (by external module or standard code) - // TODO le hook fait double emploi avec le trigger !! - /*$hookmanager->initHooks(array('orderdao')); - $parameters=array('socid'=>$this->id); - $reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks - if (empty($reshook)) - { - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used - {*/ - $result=$this->insertExtraFields(); - if ($result < 0) $error++; - /* } - } - else if ($reshook < 0) $error++;*/ + $result=$this->insertExtraFields(); + if ($result < 0) $error++; } if (! $error && ! $notrigger) @@ -1226,7 +1220,7 @@ class Commande extends CommonOrder */ function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $info_bits=0, $fk_remise_except=0, $price_base_type='HT', $pu_ttc=0, $date_start='', $date_end='', $type=0, $rang=-1, $special_code=0, $fk_parent_line=0, $fk_fournprice=null, $pa_ht=0, $label='',$array_options=0, $fk_unit=null, $origin='', $origin_id=0) { - global $mysoc, $conf, $langs; + global $mysoc, $conf, $langs, $user; dol_syslog(get_class($this)."::addline commandeid=$this->id, desc=$desc, pu_ht=$pu_ht, qty=$qty, txtva=$txtva, fk_product=$fk_product, remise_percent=$remise_percent, info_bits=$info_bits, fk_remise_except=$fk_remise_except, price_base_type=$price_base_type, pu_ttc=$pu_ttc, date_start=$date_start, date_end=$date_end, type=$type special_code=$special_code, fk_unit=$fk_unit", LOG_DEBUG); @@ -1242,7 +1236,7 @@ class Commande extends CommonOrder if (empty($txlocaltax2)) $txlocaltax2=0; if (empty($fk_parent_line) || $fk_parent_line < 0) $fk_parent_line=0; if (empty($this->fk_multicurrency)) $this->fk_multicurrency=0; - + $remise_percent=price2num($remise_percent); $qty=price2num($qty); $pu_ht=price2num($pu_ht); @@ -1278,7 +1272,8 @@ class Commande extends CommonOrder if (! empty($conf->global->STOCK_MUST_BE_ENOUGH_FOR_ORDER) && $product_type == 0 && $product->stock_reel < $qty) { - $this->error=$langs->trans('ErrorStockIsNotEnough'); + $langs->load("errors"); + $this->error=$langs->trans('ErrorStockIsNotEnoughToAddProductOnOrder', $product->ref); dol_syslog(get_class($this)."::addline error=Product ".$product->ref.": ".$this->error, LOG_ERR); $this->db->rollback(); return self::STOCK_NOT_ENOUGH_FOR_ORDER; @@ -1291,7 +1286,7 @@ class Commande extends CommonOrder $localtaxes_type=getLocalTaxesFromRate($txtva,0,$this->thirdparty,$mysoc); $txtva = preg_replace('/\s*\(.*\)/','',$txtva); // Remove code into vatrate. - + $tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $product_type, $mysoc, $localtaxes_type, 100, $this->multicurrency_tx); $total_ht = $tabprice[0]; @@ -1304,7 +1299,7 @@ class Commande extends CommonOrder $multicurrency_total_ht = $tabprice[16]; $multicurrency_total_tva = $tabprice[17]; $multicurrency_total_ttc = $tabprice[18]; - + // Rang to use $rangtouse = $rang; if ($rangtouse == -1) @@ -1378,7 +1373,7 @@ class Commande extends CommonOrder $this->line->array_options=$array_options; } - $result=$this->line->insert(); + $result=$this->line->insert($user); if ($result > 0) { // Reorder if child line @@ -1606,7 +1601,7 @@ class Commande extends CommonOrder $this->multicurrency_total_ht = $obj->multicurrency_total_ht; $this->multicurrency_total_tva = $obj->multicurrency_total_tva; $this->multicurrency_total_ttc = $obj->multicurrency_total_ttc; - + $this->extraparams = (array) json_decode($obj->extraparams, true); $this->lines = array(); @@ -1797,7 +1792,7 @@ class Commande extends CommonOrder $line->product_desc = $objp->product_desc; $line->fk_product_type = $objp->fk_product_type; // Produit ou service $line->fk_unit = $objp->fk_unit; - + $line->weight = $objp->weight; $line->weight_units = $objp->weight_units; $line->volume = $objp->volume; @@ -1813,7 +1808,7 @@ class Commande extends CommonOrder $line->multicurrency_total_ht = $objp->multicurrency_total_ht; $line->multicurrency_total_tva = $objp->multicurrency_total_tva; $line->multicurrency_total_ttc = $objp->multicurrency_total_ttc; - + $this->lines[$i] = $line; $i++; @@ -1864,7 +1859,7 @@ class Commande extends CommonOrder /** * Load array this->expeditions of lines of shipments with nb of products sent for each order line * Note: For a dedicated shipment, the fetch_lines can be used to load the qty_asked and qty_shipped. This function is use to return qty_shipped cumulated for the order - * + * * @param int $filtre_statut Filter on shipment status * @return int <0 if KO, Nb of lines found if OK */ @@ -1977,10 +1972,11 @@ class Commande extends CommonOrder /** * Delete an order line * + * @param User $user User object * @param int $lineid Id of line to delete * @return int >0 if OK, 0 if nothing to do, <0 if KO */ - function deleteline($lineid) + function deleteline($user=null, $lineid=0) { if ($this->statut == self::STATUS_DRAFT) @@ -2007,7 +2003,7 @@ class Commande extends CommonOrder // For triggers $line->fetch($lineid); - if ($line->delete() > 0) + if ($line->delete($user) > 0) { $result=$this->update_price(1); @@ -2054,30 +2050,62 @@ class Commande extends CommonOrder * * @param User $user User qui positionne la remise * @param float $remise Discount (percent) + * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ - function set_remise($user, $remise) + function set_remise($user, $remise, $notrigger=0) { $remise=trim($remise)?trim($remise):0; if ($user->rights->commande->creer) { + $error=0; + + $this->db->begin(); + $remise=price2num($remise); $sql = 'UPDATE '.MAIN_DB_PREFIX.'commande'; $sql.= ' SET remise_percent = '.$remise; $sql.= ' WHERE rowid = '.$this->id.' AND fk_statut = '.self::STATUS_DRAFT.' ;'; - if ($this->db->query($sql)) + dol_syslog(__METHOD__, LOG_DEBUG); + $resql=$this->db->query($sql); + if (!$resql) { - $this->remise_percent = $remise; - $this->update_price(1); - return 1; + $this->errors[]=$this->db->error(); + $error++; + } + + if (! $error) + { + $this->oldcopy= clone $this; + $this->remise_percent = $remise; + $this->update_price(1); + } + + if (! $notrigger && empty($error)) + { + // Call trigger + $result=$this->call_trigger('ORDER_MODIFY',$user); + if ($result < 0) $error++; + // End call triggers + } + + if (! $error) + { + $this->db->commit(); + return 1; } else { - $this->error=$this->db->error(); - return -1; + foreach($this->errors as $errmsg) + { + dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); + $this->error.=($this->error?', '.$errmsg:$errmsg); + } + $this->db->rollback(); + return -1*$error; } } } @@ -2088,32 +2116,62 @@ class Commande extends CommonOrder * * @param User $user User qui positionne la remise * @param float $remise Discount + * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ - function set_remise_absolue($user, $remise) + function set_remise_absolue($user, $remise, $notrigger=0) { $remise=trim($remise)?trim($remise):0; if ($user->rights->commande->creer) { + $error=0; + + $this->db->begin(); + $remise=price2num($remise); $sql = 'UPDATE '.MAIN_DB_PREFIX.'commande'; $sql.= ' SET remise_absolue = '.$remise; $sql.= ' WHERE rowid = '.$this->id.' AND fk_statut = '.self::STATUS_DRAFT.' ;'; - dol_syslog(get_class($this)."::set_remise_absolue", LOG_DEBUG); - - if ($this->db->query($sql)) + dol_syslog(__METHOD__, LOG_DEBUG); + $resql=$this->db->query($sql); + if (!$resql) { - $this->remise_absolue = $remise; - $this->update_price(1); - return 1; + $this->errors[]=$this->db->error(); + $error++; + } + + if (! $error) + { + $this->oldcopy= clone $this; + $this->remise_absolue = $remise; + $this->update_price(1); + } + + if (! $notrigger && empty($error)) + { + // Call trigger + $result=$this->call_trigger('ORDER_MODIFY',$user); + if ($result < 0) $error++; + // End call triggers + } + + if (! $error) + { + $this->db->commit(); + return 1; } else { - $this->error=$this->db->error(); - return -1; + foreach($this->errors as $errmsg) + { + dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); + $this->error.=($this->error?', '.$errmsg:$errmsg); + } + $this->db->rollback(); + return -1*$error; } } } @@ -2122,29 +2180,59 @@ class Commande extends CommonOrder /** * Set the order date * - * @param User $user Object user making change - * @param int $date Date - * @return int <0 if KO, >0 if OK + * @param User $user Object user making change + * @param int $date Date + * @param int $notrigger 1=Does not execute triggers, 0= execute triggers + * @return int <0 if KO, >0 if OK */ - function set_date($user, $date) + function set_date($user, $date, $notrigger=0) { if ($user->rights->commande->creer) { + $error=0; + + $this->db->begin(); + $sql = "UPDATE ".MAIN_DB_PREFIX."commande"; $sql.= " SET date_commande = ".($date ? $this->db->idate($date) : 'null'); $sql.= " WHERE rowid = ".$this->id." AND fk_statut = ".self::STATUS_DRAFT; - dol_syslog(get_class($this)."::set_date",LOG_DEBUG); + dol_syslog(__METHOD__, LOG_DEBUG); $resql=$this->db->query($sql); - if ($resql) + if (!$resql) { - $this->date = $date; - return 1; + $this->errors[]=$this->db->error(); + $error++; + } + + if (! $error) + { + $this->oldcopy= clone $this; + $this->date = $date; + } + + if (! $notrigger && empty($error)) + { + // Call trigger + $result=$this->call_trigger('ORDER_MODIFY',$user); + if ($result < 0) $error++; + // End call triggers + } + + if (! $error) + { + $this->db->commit(); + return 1; } else { - $this->error=$this->db->error(); - return -1; + foreach($this->errors as $errmsg) + { + dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); + $this->error.=($this->error?', '.$errmsg:$errmsg); + } + $this->db->rollback(); + return -1*$error; } } else @@ -2156,29 +2244,59 @@ class Commande extends CommonOrder /** * Set the planned delivery date * - * @param User $user Objet utilisateur qui modifie + * @param User $user Objet utilisateur qui modifie * @param int $date_livraison Date de livraison - * @return int <0 si ko, >0 si ok + * @param int $notrigger 1=Does not execute triggers, 0= execute triggers + * @return int <0 si ko, >0 si ok */ - function set_date_livraison($user, $date_livraison) + function set_date_livraison($user, $date_livraison, $notrigger=0) { if ($user->rights->commande->creer) { + $error=0; + + $this->db->begin(); + $sql = "UPDATE ".MAIN_DB_PREFIX."commande"; $sql.= " SET date_livraison = ".($date_livraison ? "'".$this->db->idate($date_livraison)."'" : 'null'); $sql.= " WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::set_date_livraison", LOG_DEBUG); + dol_syslog(__METHOD__, LOG_DEBUG); $resql=$this->db->query($sql); - if ($resql) + if (!$resql) { - $this->date_livraison = $date_livraison; - return 1; + $this->errors[]=$this->db->error(); + $error++; + } + + if (! $error) + { + $this->oldcopy= clone $this; + $this->date_livraison = $date_livraison; + } + + if (! $notrigger && empty($error)) + { + // Call trigger + $result=$this->call_trigger('ORDER_MODIFY',$user); + if ($result < 0) $error++; + // End call triggers + } + + if (! $error) + { + $this->db->commit(); + return 1; } else { - $this->error=$this->db->error(); - return -1; + foreach($this->errors as $errmsg) + { + dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); + $this->error.=($this->error?', '.$errmsg:$errmsg); + } + $this->db->rollback(); + return -1*$error; } } else @@ -2187,64 +2305,6 @@ class Commande extends CommonOrder } } - /** - * Set availability - * - * @param User $user Object user making change - * @param int $id If of availability delay - * @return int <0 if KO, >0 if OK - */ - function set_availability($user, $id) - { - if ($user->rights->commande->creer) - { - $sql = "UPDATE ".MAIN_DB_PREFIX."commande "; - $sql.= " SET fk_availability = '".$id."'"; - $sql.= " WHERE rowid = ".$this->id; - - if ($this->db->query($sql)) - { - $this->fk_availability = $id; - return 1; - } - else - { - $this->error=$this->db->error(); - dol_syslog(get_class($this)."::set_availability Erreur SQL"); - return -1; - } - } - } - - /** - * Set source of demand - * - * @param User $user Object user making change - * @param int $id Id of source - * @return int <0 if KO, >0 if OK - */ - function set_demand_reason($user, $id) - { - if ($user->rights->commande->creer) - { - $sql = "UPDATE ".MAIN_DB_PREFIX."commande "; - $sql.= " SET fk_input_reason = '".$id."'"; - $sql.= " WHERE rowid = ".$this->id; - - if ($this->db->query($sql)) - { - $this->fk_input_reason = $id; - return 1; - } - else - { - $this->error=$this->db->error(); - dol_syslog(get_class($this)."::set_demand_reason Erreur SQL"); - return -1; - } - } - } - /** * Return list of orders (eventuelly filtered on a user) into an array * @@ -2319,69 +2379,141 @@ class Commande extends CommonOrder } /** - * Change le delai de livraison + * Update delivery delay * * @param int $availability_id Id du nouveau mode + * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int >0 if OK, <0 if KO */ - function availability($availability_id) + function availability($availability_id, $notrigger=0) { + global $user; + dol_syslog('Commande::availability('.$availability_id.')'); if ($this->statut >= self::STATUS_DRAFT) { + $error=0; + + $this->db->begin(); + $sql = 'UPDATE '.MAIN_DB_PREFIX.'commande'; $sql .= ' SET fk_availability = '.$availability_id; $sql .= ' WHERE rowid='.$this->id; - if ( $this->db->query($sql) ) + + dol_syslog(__METHOD__, LOG_DEBUG); + $resql=$this->db->query($sql); + if (!$resql) { - $this->availability_id = $availability_id; - return 1; + $this->errors[]=$this->db->error(); + $error++; + } + + if (! $error) + { + $this->oldcopy= clone $this; + $this->availability_id = $availability_id; + } + + if (! $notrigger && empty($error)) + { + // Call trigger + $result=$this->call_trigger('ORDER_MODIFY',$user); + if ($result < 0) $error++; + // End call triggers + } + + if (! $error) + { + $this->db->commit(); + return 1; } else { - dol_syslog('Commande::availability Erreur '.$sql.' - '.$this->db->error(), LOG_ERR); - $this->error=$this->db->lasterror(); - return -1; + foreach($this->errors as $errmsg) + { + dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); + $this->error.=($this->error?', '.$errmsg:$errmsg); + } + $this->db->rollback(); + return -1*$error; } } else { - dol_syslog('Commande::availability, etat facture incompatible', LOG_ERR); - $this->error='Etat commande incompatible '.$this->statut; + $error_str='Command status do not meet requirement '.$this->statut; + dol_syslog(__METHOD__.$error_str, LOG_ERR); + $this->error=$error_str; + $this->errors[]= $this->error; return -2; } } /** - * Change la source de la demande + * Update order demand_reason * * @param int $demand_reason_id Id of new demand + * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int >0 if ok, <0 if ko */ - function demand_reason($demand_reason_id) + function demand_reason($demand_reason_id, $notrigger=0) { + global $user; + dol_syslog('Commande::demand_reason('.$demand_reason_id.')'); if ($this->statut >= self::STATUS_DRAFT) { + $error=0; + + $this->db->begin(); + $sql = 'UPDATE '.MAIN_DB_PREFIX.'commande'; $sql .= ' SET fk_input_reason = '.$demand_reason_id; $sql .= ' WHERE rowid='.$this->id; - if ( $this->db->query($sql) ) + + dol_syslog(__METHOD__, LOG_DEBUG); + $resql=$this->db->query($sql); + if (!$resql) { - $this->demand_reason_id = $demand_reason_id; - return 1; + $this->errors[]=$this->db->error(); + $error++; + } + + if (! $error) + { + $this->oldcopy= clone $this; + $this->demand_reason_id = $demand_reason_id; + } + + if (! $notrigger && empty($error)) + { + // Call trigger + $result=$this->call_trigger('ORDER_MODIFY',$user); + if ($result < 0) $error++; + // End call triggers + } + + if (! $error) + { + $this->db->commit(); + return 1; } else { - dol_syslog('Commande::demand_reason Erreur '.$sql.' - '.$this->db->error(), LOG_ERR); - $this->error=$this->db->lasterror(); - return -1; + foreach($this->errors as $errmsg) + { + dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); + $this->error.=($this->error?', '.$errmsg:$errmsg); + } + $this->db->rollback(); + return -1*$error; } } else { - dol_syslog('Commande::demand_reason, etat facture incompatible', LOG_ERR); - $this->error='Etat commande incompatible '.$this->statut; + $error_str='order status do not meet requirement '.$this->statut; + dol_syslog(__METHOD__.$error_str, LOG_ERR); + $this->error=$error_str; + $this->errors[]= $this->error; return -2; } } @@ -2391,27 +2523,56 @@ class Commande extends CommonOrder * * @param User $user User that make change * @param string $ref_client Customer ref + * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ - function set_ref_client($user, $ref_client) + function set_ref_client($user, $ref_client, $notrigger=0) { if ($user->rights->commande->creer) { - dol_syslog(get_class($this).'::set_ref_client this->id='.$this->id.', ref_client='.$ref_client); + $error=0; + + $this->db->begin(); $sql = 'UPDATE '.MAIN_DB_PREFIX.'commande SET'; $sql.= ' ref_client = '.(empty($ref_client) ? 'NULL' : '\''.$this->db->escape($ref_client).'\''); $sql.= ' WHERE rowid = '.$this->id; - if ($this->db->query($sql) ) + dol_syslog(__METHOD__.' this->id='.$this->id.', ref_client='.$ref_client, LOG_DEBUG); + $resql=$this->db->query($sql); + if (!$resql) { - $this->ref_client = $ref_client; - return 1; + $this->errors[]=$this->db->error(); + $error++; + } + + if (! $error) + { + $this->oldcopy= clone $this; + $this->ref_client = $ref_client; + } + + if (! $notrigger && empty($error)) + { + // Call trigger + $result=$this->call_trigger('ORDER_MODIFY',$user); + if ($result < 0) $error++; + // End call triggers + } + if (! $error) + { + $this->db->commit(); + return 1; } else { - $this->error=$this->db->lasterror(); - return -2; + foreach($this->errors as $errmsg) + { + dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); + $this->error.=($this->error?', '.$errmsg:$errmsg); + } + $this->db->rollback(); + return -1*$error; } } else @@ -2423,12 +2584,12 @@ class Commande extends CommonOrder /** * Classify the order as invoiced * - * @param User $user Object user making the change - * @return int <0 if KO, >0 if OK + * @param User $user Object user making the change + * @param int $notrigger 1=Does not execute triggers, 0= execute triggers + * @return int <0 if KO, >0 if OK */ - function classifyBilled(User $user) + function classifyBilled(User $user, $notrigger=0) { - global $user; $error = 0; $this->db->begin(); @@ -2439,16 +2600,24 @@ class Commande extends CommonOrder dol_syslog(get_class($this)."::classifyBilled", LOG_DEBUG); if ($this->db->query($sql)) { - // Call trigger - $result=$this->call_trigger('ORDER_CLASSIFY_BILLED',$user); - if ($result < 0) $error++; - // End call triggers if (! $error) { + $this->oldcopy= clone $this; $this->facturee=1; // deprecated $this->billed=1; + } + if (! $notrigger && empty($error)) + { + // Call trigger + $result=$this->call_trigger('ORDER_CLASSIFY_BILLED',$user); + if ($result < 0) $error++; + // End call triggers + } + + if (! $error) + { $this->db->commit(); return 1; } @@ -2495,25 +2664,32 @@ class Commande extends CommonOrder { global $conf, $user, $langs; $error = 0; - + $this->db->begin(); - + $sql = 'UPDATE '.MAIN_DB_PREFIX.'commande SET facture = 0'; $sql.= ' WHERE rowid = '.$this->id.' AND fk_statut > '.self::STATUS_DRAFT; - + dol_syslog(get_class($this)."::classifyUnBilled", LOG_DEBUG); if ($this->db->query($sql)) { + if (! $error) + { + $this->oldcopy= clone $this; + $this->facturee=1; // deprecated + $this->billed=1; + } + // Call trigger $result=$this->call_trigger('ORDER_CLASSIFY_UNBILLED',$user); if ($result < 0) $error++; // End call triggers - + if (! $error) { $this->facturee=0; // deprecated $this->billed=0; - + $this->db->commit(); return 1; } @@ -2535,8 +2711,8 @@ class Commande extends CommonOrder return -1; } } - - + + /** * Update a line in database * @@ -2565,7 +2741,7 @@ class Commande extends CommonOrder */ function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0.0,$txlocaltax2=0.0, $price_base_type='HT', $info_bits=0, $date_start='', $date_end='', $type=0, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=null, $pa_ht=0, $label='', $special_code=0, $array_options=0, $fk_unit=null) { - global $conf, $mysoc, $langs; + global $conf, $mysoc, $langs, $user; dol_syslog(get_class($this)."::updateline id=$rowid, desc=$desc, pu=$pu, qty=$qty, remise_percent=$remise_percent, txtva=$txtva, txlocaltax1=$txlocaltax1, txlocaltax2=$txlocaltax2, price_base_type=$price_base_type, info_bits=$info_bits, date_start=$date_start, date_end=$date_end, type=$type, fk_parent_line=$fk_parent_line, pa_ht=$pa_ht, special_code=$special_code"); include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; @@ -2599,7 +2775,7 @@ class Commande extends CommonOrder $localtaxes_type=getLocalTaxesFromRate($txtva,0,$this->thirdparty, $mysoc); $txtva = preg_replace('/\s*\(.*\)/','',$txtva); // Remove code into vatrate. - + $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $mysoc, $localtaxes_type, 100, $this->multicurrency_tx); $total_ht = $tabprice[0]; @@ -2612,14 +2788,14 @@ class Commande extends CommonOrder $multicurrency_total_ht = $tabprice[16]; $multicurrency_total_tva = $tabprice[17]; $multicurrency_total_ttc = $tabprice[18]; - + // Anciens indicateurs: $price, $subprice, $remise (a ne plus utiliser) $price = $pu; - if ($price_base_type == 'TTC') + if ($price_base_type == 'TTC') { $subprice = $tabprice[5]; - } - else + } + else { $subprice = $pu; } @@ -2642,7 +2818,8 @@ class Commande extends CommonOrder if (! empty($conf->global->STOCK_MUST_BE_ENOUGH_FOR_ORDER) && $product_type == 0 && $product->stock_reel < $qty) { - $this->error=$langs->trans('ErrorStockIsNotEnough'); + $langs->load("errors"); + $this->error=$langs->trans('ErrorStockIsNotEnoughToAddProductOnOrder', $product->ref); dol_syslog(get_class($this)."::addline error=Product ".$product->ref.": ".$this->error, LOG_ERR); $this->db->rollback(); unset($_POST['productid']); @@ -2700,7 +2877,7 @@ class Commande extends CommonOrder $this->line->multicurrency_total_ht = $multicurrency_total_ht; $this->line->multicurrency_total_tva = $multicurrency_total_tva; $this->line->multicurrency_total_ttc = $multicurrency_total_ttc; - + // TODO deprecated $this->line->price=$price; $this->line->remise=$remise; @@ -2709,7 +2886,7 @@ class Commande extends CommonOrder $this->line->array_options=$array_options; } - $result=$this->line->update(); + $result=$this->line->update($user); if ($result > 0) { // Reorder if child line @@ -2869,7 +3046,7 @@ class Commande extends CommonOrder * Delete the customer order * * @param User $user User object - * @param int $notrigger 1=Does not execute triggers, 0= execuete triggers + * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <=0 if KO, >0 if OK */ function delete($user, $notrigger=0) @@ -3105,7 +3282,7 @@ class Commande extends CommonOrder if ($statut==self::STATUS_DRAFT) return img_picto($langs->trans('StatusOrderDraft'),'statut0').' '.$langs->trans('StatusOrderDraftShort'); if ($statut==self::STATUS_VALIDATED) return img_picto($langs->trans('StatusOrderValidated'),'statut1').' '.$langs->trans('StatusOrderValidatedShort').$billedtext; if ($statut==self::STATUS_ACCEPTED) return img_picto($langs->trans('StatusOrderSent'),'statut3').' '.$langs->trans('StatusOrderSentShort').$billedtext; - if ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderToBill'),'statut7').' '.$langs->trans('StatusOrderToBillShort'); + if ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderToBill'),'statut4').' '.$langs->trans('StatusOrderToBillShort'); if ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderProcessed').$billedtext,'statut6').' '.$langs->trans('StatusOrderProcessed').$billedtext; if ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderDelivered'),'statut6').' '.$langs->trans('StatusOrderDeliveredShort'); } @@ -3115,7 +3292,7 @@ class Commande extends CommonOrder if ($statut==self::STATUS_DRAFT) return img_picto($langs->trans('StatusOrderDraft'),'statut0'); if ($statut==self::STATUS_VALIDATED) return img_picto($langs->trans('StatusOrderValidated').$billedtext,'statut1'); if ($statut==self::STATUS_ACCEPTED) return img_picto($langs->trans('StatusOrderSentShort').$billedtext,'statut3'); - if ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderToBill'),'statut7'); + if ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderToBill'),'statut4'); if ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderProcessed').$billedtext,'statut6'); if ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderDelivered'),'statut6'); } @@ -3125,7 +3302,7 @@ class Commande extends CommonOrder if ($statut==self::STATUS_DRAFT) return img_picto($langs->trans('StatusOrderDraft'),'statut0').' '.$langs->trans('StatusOrderDraft'); if ($statut==self::STATUS_VALIDATED) return img_picto($langs->trans('StatusOrderValidated').$billedtext,'statut1').' '.$langs->trans('StatusOrderValidated').$billedtext; if ($statut==self::STATUS_ACCEPTED) return img_picto($langs->trans('StatusOrderSentShort').$billedtext,'statut3').' '.$langs->trans('StatusOrderSent').$billedtext; - if ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderToBill'),'statut7').' '.$langs->trans('StatusOrderToBill'); + if ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderToBill'),'statut4').' '.$langs->trans('StatusOrderToBill'); if ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderProcessedShort').$billedtext,'statut6').' '.$langs->trans('StatusOrderProcessed').$billedtext; if ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderDelivered'),'statut6').' '.$langs->trans('StatusOrderDelivered'); } @@ -3135,7 +3312,7 @@ class Commande extends CommonOrder if ($statut==self::STATUS_DRAFT) return ''.$langs->trans('StatusOrderDraftShort').' '.img_picto($langs->trans('StatusOrderDraft'),'statut0'); if ($statut==self::STATUS_VALIDATED) return ''.$langs->trans('StatusOrderValidatedShort').$billedtext.' '.img_picto($langs->trans('StatusOrderValidated').$billedtext,'statut1'); if ($statut==self::STATUS_ACCEPTED) return ''.$langs->trans('StatusOrderSentShort').$billedtext.' '.img_picto($langs->trans('StatusOrderSent').$billedtext,'statut3'); - if ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return ''.$langs->trans('StatusOrderToBillShort').' '.img_picto($langs->trans('StatusOrderToBill'),'statut7'); + if ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return ''.$langs->trans('StatusOrderToBillShort').' '.img_picto($langs->trans('StatusOrderToBill'),'statut4'); if ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return ''.$langs->trans('StatusOrderProcessedShort').$billedtext.' '.img_picto($langs->trans('StatusOrderProcessed').$billedtext,'statut6'); if ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return ''.$langs->trans('StatusOrderDeliveredShort').' '.img_picto($langs->trans('StatusOrderDelivered'),'statut6'); } @@ -3149,12 +3326,15 @@ class Commande extends CommonOrder * @param int $option Where point the link (0=> main card, 1,2 => shipment) * @param int $max Max length to show * @param int $short Use short labels + * @param int $notooltip 1=Disable tooltip * @return string String with URL */ - function getNomUrl($withpicto=0,$option=0,$max=0,$short=0) + function getNomUrl($withpicto=0,$option=0,$max=0,$short=0,$notooltip=0) { - global $conf, $langs; + global $conf, $langs, $user; + if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips + $result=''; if (! empty($conf->expedition->enabled) && ($option == 1 || $option == 2)) $url = DOL_URL_ROOT.'/expedition/shipment.php?id='.$this->id; @@ -3163,22 +3343,44 @@ class Commande extends CommonOrder if ($short) return $url; $picto = 'order'; - $label = '' . $langs->trans("ShowOrder") . ''; - if (! empty($this->ref)) - $label .= '
' . $langs->trans('Ref') . ': ' . $this->ref; - if (! empty($this->ref_client)) - $label.= '
' . $langs->trans('RefCustomer') . ': ' . $this->ref_client; - if (! empty($this->total_ht)) - $label.= '
' . $langs->trans('AmountHT') . ': ' . price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency); - if (! empty($this->total_tva)) - $label.= '
' . $langs->trans('VAT') . ': ' . price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency); - if (! empty($this->total_ttc)) - $label.= '
' . $langs->trans('AmountTTC') . ': ' . price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); + $label = ''; - $linkstart = ''; + if ($user->rights->commande->lire) { + $label = ''.$langs->trans("ShowOrder").''; + if (!empty($this->ref)) { + $label .= '
'.$langs->trans('Ref').': '.$this->ref; + } + if (!empty($this->ref_client)) { + $label .= '
'.$langs->trans('RefCustomer').': '.$this->ref_client; + } + if (!empty($this->total_ht)) { + $label .= '
'.$langs->trans('AmountHT').': '.price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency); + } + if (!empty($this->total_tva)) { + $label .= '
'.$langs->trans('VAT').': '.price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency); + } + if (!empty($this->total_ttc)) { + $label .= '
'.$langs->trans('AmountTTC').': '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); + } + } + + $linkclose=''; + if (empty($notooltip) && $user->rights->commande->lire) + { + if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) + { + $label=$langs->trans("ShowOrder"); + $linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"'; + } + $linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose.=' class="classfortooltip"'; + } + + $linkstart = '
'; $linkend=''; - if ($withpicto) $result.=($linkstart.img_object($label, $picto, 'class="classfortooltip"').$linkend); + if ($withpicto) $result.=($linkstart.img_object(($notooltip?'':$label), $picto, ($notooltip?'':'class="classfortooltip"')).$linkend); if ($withpicto && $withpicto != 2) $result.=' '; $result.=$linkstart.$this->ref.$linkend; return $result; @@ -3256,7 +3458,8 @@ class Commande extends CommonOrder dol_syslog(get_class($this)."::initAsSpecimen"); - // Charge tableau des produits prodids + // Load array of products prodids + $num_prods = 0; $prodids = array(); $sql = "SELECT rowid"; $sql.= " FROM ".MAIN_DB_PREFIX."product"; @@ -3318,7 +3521,7 @@ class Commande extends CommonOrder $prodid = mt_rand(1, $num_prods); $line->fk_product=$prodids[$prodid]; } - + $this->lines[$xnbp]=$line; $this->total_ht += $line->total_ht; @@ -3382,9 +3585,9 @@ class Commande extends CommonOrder } /** - * Create a document onto disk accordign to template module. + * Create a document onto disk according to template module. * - * @param string $modele Force le mnodele a utiliser ('' to not force) + * @param string $modele Force template to use ('' to not force) * @param Translate $outputlangs objet lang a utiliser pour traduction * @param int $hidedetails Hide details of lines * @param int $hidedesc Hide description @@ -3450,7 +3653,7 @@ class Commande extends CommonOrder return max($this->date_commande, $this->date_livraison) < ($now - $conf->commande->client->warning_delay); } - + /** * Show the customer delayed info * @@ -3459,11 +3662,11 @@ class Commande extends CommonOrder public function showDelay() { global $conf, $langs; - + if (empty($this->date_livraison)) $text=$langs->trans("OrderDate").' '.dol_print_date($this->date_commande, 'day'); else $text=$text=$langs->trans("DeliveryDate").' '.dol_print_date($this->date_livraison, 'day'); $text.=' '.($conf->commande->client->warning_delay>0?'+':'-').' '.round(abs($conf->commande->client->warning_delay)/3600/24,1).' '.$langs->trans("days").' < '.$langs->trans("Today"); - + return $text; } } @@ -3616,9 +3819,11 @@ class OrderLine extends CommonOrderLine /** * Delete line in database * + * @param User $user User that modify + * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 si ko, >0 si ok */ - function delete() + function delete($user=null, $notrigger=0) { global $conf, $user, $langs; @@ -3644,10 +3849,13 @@ class OrderLine extends CommonOrderLine } } - // Call trigger - $result=$this->call_trigger('LINEORDER_DELETE',$user); - if ($result < 0) $error++; - // End call triggers + if (! $error && ! $notrigger) + { + // Call trigger + $result=$this->call_trigger('LINEORDER_DELETE',$user); + if ($result < 0) $error++; + // End call triggers + } if (!$error) { $this->db->commit(); @@ -3672,12 +3880,13 @@ class OrderLine extends CommonOrderLine /** * Insert line into database * + * @param User $user User that modify * @param int $notrigger 1 = disable triggers * @return int <0 if KO, >0 if OK */ - function insert($notrigger=0) + function insert($user=null, $notrigger=0) { - global $langs, $conf, $user; + global $langs, $conf; $error=0; @@ -3815,12 +4024,13 @@ class OrderLine extends CommonOrderLine /** * Update the line object into db * + * @param User $user User that modify * @param int $notrigger 1 = disable triggers * @return int <0 si ko, >0 si ok */ - function update($notrigger=0) + function update($user=null, $notrigger=0) { - global $conf,$langs,$user; + global $conf,$langs; $error=0; @@ -3892,13 +4102,13 @@ class OrderLine extends CommonOrderLine $sql.= " , fk_parent_line=".(! empty($this->fk_parent_line)?$this->fk_parent_line:"null"); if (! empty($this->rang)) $sql.= ", rang=".$this->rang; $sql.= " , fk_unit=".(!$this->fk_unit ? 'NULL' : $this->fk_unit); - + // Multicurrency $sql.= " , multicurrency_subprice=".price2num($this->multicurrency_subprice).""; $sql.= " , multicurrency_total_ht=".price2num($this->multicurrency_total_ht).""; $sql.= " , multicurrency_total_tva=".price2num($this->multicurrency_total_tva).""; $sql.= " , multicurrency_total_ttc=".price2num($this->multicurrency_total_ttc).""; - + $sql.= " WHERE rowid = ".$this->rowid; dol_syslog(get_class($this)."::update", LOG_DEBUG); diff --git a/htdocs/commande/document.php b/htdocs/commande/document.php index 6b96940df98..a05a6e0061d 100644 --- a/htdocs/commande/document.php +++ b/htdocs/commande/document.php @@ -121,6 +121,7 @@ if ($id > 0 || ! empty($ref)) $modulepart = 'commande'; $permission = $user->rights->commande->creer; + $permtoedit = $user->rights->commande->creer; $param = '&id=' . $object->id; include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php'; } diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index f19a431ec10..758f13ccd5a 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -35,10 +35,12 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; $langs->load('orders'); @@ -48,6 +50,12 @@ $langs->load('companies'); $langs->load('compta'); $langs->load('bills'); +$action=GETPOST('action','alpha'); +$massaction=GETPOST('massaction','alpha'); +$show_files=GETPOST('show_files','int'); +$confirm=GETPOST('confirm','alpha'); +$toselect = GETPOST('toselect', 'array'); + $orderyear=GETPOST("orderyear","int"); $ordermonth=GETPOST("ordermonth","int"); $orderday=GETPOST("orderday","int"); @@ -70,6 +78,7 @@ $search_sale=GETPOST('search_sale','int'); $search_total_ht=GETPOST('search_total_ht','alpha'); $optioncss = GETPOST('optioncss','alpha'); $billed = GETPOST('billed','int'); +$viewstatut=GETPOST('viewstatut'); // Security check $id = (GETPOST('orderid')?GETPOST('orderid','int'):GETPOST('id','int')); @@ -89,13 +98,11 @@ $pagenext = $page + 1; if (! $sortfield) $sortfield='c.ref'; if (! $sortorder) $sortorder='DESC'; -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage context to save list fields $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')); +$hookmanager->initHooks(array($contextpage)); $extrafields = new ExtraFields($db); // fetch optionals attributes and labels @@ -148,7 +155,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab */ if (GETPOST('cancel')) { $action='list'; $massaction=''; } -if (! GETPOST('confirmmassaction')) { $massaction=''; } +if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend' && $massaction != 'confirm_createbills') { $massaction=''; } $parameters=array('socid'=>$socid); $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks @@ -157,7 +164,7 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; // Purge search criteria -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers { $search_categ=''; $search_user=''; @@ -183,27 +190,240 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP $deliveryyear=''; $viewstatut=''; $billed=''; + $toselect=''; $search_array_options=array(); } if (empty($reshook)) { - // Mass actions. Controls on number of lines checked - $maxformassaction=1000; - if (! empty($massaction) && count($toselect) < 1) - { - $error++; - setEventMessages($langs->trans("NoLineChecked"), null, "warnings"); - } - if (! $error && count($toselect) > $maxformassaction) - { - setEventMessages($langs->trans('TooManyRecordForMassAction',$maxformassaction), null, 'errors'); - $error++; - } - + $objectclass='Commande'; + $objectlabel='Orders'; + $permtoread = $user->rights->commande->lire; + $permtodelete = $user->rights->commande->supprimer; + $uploaddir = $conf->commande->dir_output; + include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; } +if($massaction == 'confirm_createbills') { + + $orders = GETPOST('toselect'); + $createbills_onebythird = GETPOST('createbills_onebythird', 'int'); + $validate_invoices = GETPOST('valdate_invoices', 'int'); + + $TFact = array(); + $TFactThird = array(); + + $nb_bills_created = 0; + + $db->begin(); + + foreach($orders as $id_order) { + + $cmd = new Commande($db); + if($cmd->fetch($id_order) <= 0) continue; + + $object = new Facture($db); + if(!empty($createbills_onebythird) && !empty($TFactThird[$cmd->socid])) $object = $TFactThird[$cmd->socid]; // To use only one bill for a third + else { + + $object->socid = $cmd->socid; + $object->type = Facture::TYPE_STANDARD; + $object->cond_reglement_id = $cmd->cond_reglement_id; + $object->mode_reglement_id = $cmd->mode_reglement_id; + $object->fk_project = $cmd->fk_project; + + $datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); + if (empty($datefacture)) + { + $datefacture = dol_mktime(date("h"), date("M"), 0, date("m"), date("d"), date("Y")); + } + + $object->date = $datefacture; + $object->origin = 'commande'; + $object->origin_id = $id_order; + + $res = $object->create($user); + + if($res > 0) $nb_bills_created++; + + } + + if($object->id > 0) { + + $db->begin(); + $sql = "INSERT INTO ".MAIN_DB_PREFIX."element_element ("; + $sql.= "fk_source"; + $sql.= ", sourcetype"; + $sql.= ", fk_target"; + $sql.= ", targettype"; + $sql.= ") VALUES ("; + $sql.= $id_order; + $sql.= ", '".$object->origin."'"; + $sql.= ", ".$object->id; + $sql.= ", '".$object->element."'"; + $sql.= ")"; + + if ($db->query($sql)) + { + $db->commit(); + } + else + { + $db->rollback(); + } + + $lines = $cmd->lines; + if (empty($lines) && method_exists($cmd, 'fetch_lines')) + { + $cmd->fetch_lines(); + $lines = $cmd->lines; + } + + $fk_parent_line=0; + $num=count($lines); + + for ($i=0;$i<$num;$i++) + { + $desc=($lines[$i]->desc?$lines[$i]->desc:$lines[$i]->libelle); + if ($lines[$i]->subprice < 0) + { + // Negative line, we create a discount line + $discount = new DiscountAbsolute($db); + $discount->fk_soc=$object->socid; + $discount->amount_ht=abs($lines[$i]->total_ht); + $discount->amount_tva=abs($lines[$i]->total_tva); + $discount->amount_ttc=abs($lines[$i]->total_ttc); + $discount->tva_tx=$lines[$i]->tva_tx; + $discount->fk_user=$user->id; + $discount->description=$desc; + $discountid=$discount->create($user); + if ($discountid > 0) + { + $result=$object->insert_discount($discountid); + //$result=$discount->link_to_invoice($lineid,$id); + } + else + { + setEventMessages($discount->error, $discount->errors, 'errors'); + $error++; + break; + } + } + else + { + // Positive line + $product_type=($lines[$i]->product_type?$lines[$i]->product_type:0); + // Date start + $date_start=false; + if ($lines[$i]->date_debut_prevue) $date_start=$lines[$i]->date_debut_prevue; + if ($lines[$i]->date_debut_reel) $date_start=$lines[$i]->date_debut_reel; + if ($lines[$i]->date_start) $date_start=$lines[$i]->date_start; + //Date end + $date_end=false; + if ($lines[$i]->date_fin_prevue) $date_end=$lines[$i]->date_fin_prevue; + if ($lines[$i]->date_fin_reel) $date_end=$lines[$i]->date_fin_reel; + if ($lines[$i]->date_end) $date_end=$lines[$i]->date_end; + // Reset fk_parent_line for no child products and special product + if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9) + { + $fk_parent_line = 0; + } + $result = $object->addline( + $desc, + $lines[$i]->subprice, + $lines[$i]->qty, + $lines[$i]->tva_tx, + $lines[$i]->localtax1_tx, + $lines[$i]->localtax2_tx, + $lines[$i]->fk_product, + $lines[$i]->remise_percent, + $date_start, + $date_end, + 0, + $lines[$i]->info_bits, + $lines[$i]->fk_remise_except, + 'HT', + 0, + $product_type, + $ii, + $lines[$i]->special_code, + $object->origin, + $lines[$i]->rowid, + $fk_parent_line, + $lines[$i]->fk_fournprice, + $lines[$i]->pa_ht, + $lines[$i]->label + ); + if ($result > 0) + { + $lineid=$result; + } + else + { + $lineid=0; + $error++; + break; + } + // Defined the new fk_parent_line + if ($result > 0 && $lines[$i]->product_type == 9) + { + $fk_parent_line = $result; + } + } + } + + } + + $cmd->classifyBilled($user); + + if(!empty($createbills_onebythird) && empty($TFactThird[$cmd->socid])) $TFactThird[$cmd->socid] = $object; + else $TFact[$object->id] = $object; + } + + // Build doc with all invoices + $TAllFact = empty($createbills_onebythird) ? $TFact : $TFactThird; + $toselect = array(); + + if(!empty($validate_invoices)) { + + $massaction = $action = 'builddoc'; + + foreach($TAllFact as &$object) { + $object->validate($user); + $toselect[] = $object->id; // For builddoc action + + // Fac builddoc + $upload_dir = $conf->facture->dir_output; + $permissioncreate=$user->rights->facture->creer; + include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; + } + + $objectclass='Facture'; + $objectlabel='Invoice'; + $permtoread = $user->rights->facture->lire; + $permtodelete = $user->rights->facture->supprimer; + $uploaddir = $conf->facture->dir_output; + include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; + + } + + if (! $error) + { + $db->commit(); + setEventMessage($langs->trans('BillCreated', $nb_bills_created)); + } + else + { + $db->rollback(); + $action='create'; + $_GET["origin"]=$_POST["origin"]; + $_GET["originid"]=$_POST["originid"]; + setEventMessages($object->error, $object->errors, 'errors'); + $error++; + } + +} /* @@ -317,7 +537,6 @@ if ($search_company) $sql .= natural_search('s.nom', $search_company); if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$search_sale; if ($search_user > 0) $sql.= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='commande' AND tc.source='internal' AND ec.element_id = c.rowid AND ec.fk_socpeople = ".$search_user; if ($search_total_ht != '') $sql.= natural_search('c.total_ht', $search_total_ht, 1); - // Add where from extra fields foreach ($search_array_options as $key => $val) { @@ -338,6 +557,7 @@ $sql.=$hookmanager->resPrint; $sql.= $db->order($sortfield,$sortorder); +// Count total nb of records $nbtotalofrecords = 0; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { @@ -380,9 +600,12 @@ if ($resql) $num = $db->num_rows($resql); + $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; + if ($sall) $param.='&sall='.$sall; if ($socid > 0) $param.='&socid='.$socid; if ($viewstatut != '') $param.='&viewstatut='.$viewstatut; if ($orderday) $param.='&orderday='.$orderday; @@ -399,7 +622,9 @@ if ($resql) if ($search_total_ht != '') $param.='&search_total_ht='.$search_total_ht; if ($search_total_vat != '') $param.='&search_total_vat='.$search_total_vat; if ($search_total_ttc != '') $param.='&search_total_ttc='.$search_total_ttc; - if ($optioncss != '') $param.='&optioncss='.$optioncss; + if ($show_files) $param.='&show_files=' .$show_files; + if ($optioncss != '') $param.='&optioncss='.$optioncss; + if ($billed != '') $param.='&billed='.$billed; // Add $param from extra fields foreach ($search_array_options as $key => $val) { @@ -408,10 +633,18 @@ if ($resql) if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val); } - //$massactionbutton=$form->selectMassAction('', $massaction == 'presend' ? array() : array('presend'=>$langs->trans("SendByMail"), 'builddoc'=>$langs->trans("PDFMerge"))); - - // Lignes des champs de filtre - print ''; + // List of mass actions available + $arrayofmassactions = array( + 'presend'=>$langs->trans("SendByMail"), + 'builddoc'=>$langs->trans("PDFMerge"), + ); + if($user->rights->facture->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer"); + if ($user->rights->commande->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete"); + if ($massaction == 'presend' || $massaction == 'createbills') $arrayofmassactions=array(); + $massactionbutton=$form->selectMassAction('', $arrayofmassactions); + + // Lines of title fields + print ''; if ($optioncss != '') print ''; print ''; print ''; @@ -420,7 +653,145 @@ if ($resql) print ''; print ''; - print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_commercial.png', 0, '', '', $limit); + print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_commercial.png', 0, '', '', $limit); + + if ($massaction == 'presend') + { + $langs->load("mails"); + + if (! GETPOST('cancel')) + { + $objecttmp=new Commande($db); + $listofselectedid=array(); + $listofselectedthirdparties=array(); + $listofselectedref=array(); + foreach($arrayofselected as $toselectid) + { + $result=$objecttmp->fetch($toselectid); + if ($result > 0) + { + $listofselectedid[$toselectid]=$toselectid; + $thirdpartyid=$objecttmp->fk_soc?$objecttmp->fk_soc:$objecttmp->socid; + $listofselectedthirdparties[$thirdpartyid]=$thirdpartyid; + $listofselectedref[$thirdpartyid][$toselectid]=$objecttmp->ref; + } + } + } + + print ''; + + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; + $formmail = new FormMail($db); + + dol_fiche_head(null, '', ''); + + $topicmail="SendOrderRef"; + $modelmail="order_send"; + + // Cree l'objet formulaire mail + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; + $formmail = new FormMail($db); + $formmail->withform=-1; + $formmail->fromtype = (GETPOST('fromtype')?GETPOST('fromtype'):(!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE)?$conf->global->MAIN_MAIL_DEFAULT_FROMTYPE:'user')); + + if($formmail->fromtype === 'user'){ + $formmail->fromid = $user->id; + + } + if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 1)) // If bit 1 is set + { + $formmail->trackid='ord'.$object->id; + } + if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set + { + include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; + $formmail->frommail=dolAddEmailTrackId($formmail->frommail, 'ord'.$object->id); + } + $formmail->withfrom=1; + $liste=$langs->trans("AllRecipientSelected"); + if (count($listofselectedthirdparties) == 1) + { + $liste=array(); + $thirdpartyid=array_shift($listofselectedthirdparties); + $soc=new Societe($db); + $soc->fetch($thirdpartyid); + foreach ($soc->thirdparty_and_contact_email_array(1) as $key=>$value) + { + $liste[$key]=$value; + } + $formmail->withtoreadonly=0; + } + else + { + $formmail->withtoreadonly=1; + } + $formmail->withto=$liste; + $formmail->withtofree=0; + $formmail->withtocc=1; + $formmail->withtoccc=$conf->global->MAIN_EMAIL_USECCC; + $formmail->withtopic=$langs->transnoentities($topicmail, '__REF__', '__REFCLIENT__'); + $formmail->withfile=$langs->trans("OnlyPDFattachmentSupported"); + $formmail->withbody=1; + $formmail->withdeliveryreceipt=1; + $formmail->withcancel=1; + // Tableau des substitutions + $formmail->substit['__REF__']='__REF__'; // We want to keep the tag + $formmail->substit['__SIGNATURE__']=$user->signature; + $formmail->substit['__REFCLIENT__']='__REFCLIENT__'; // We want to keep the tag + $formmail->substit['__PERSONALIZED__']=''; + $formmail->substit['__CONTACTCIVNAME__']=''; + + // Tableau des parametres complementaires du post + $formmail->param['action']=$action; + $formmail->param['models']=$modelmail; + $formmail->param['models_id']=GETPOST('modelmailselected','int'); + $formmail->param['id']=join(',',$arrayofselected); + //$formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id; + + print $formmail->get_form(); + + dol_fiche_end(); + } + elseif ($massaction == 'createbills') + { + //var_dump($_REQUEST); + print ''; + + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print '
'; + print $langs->trans('DateInvoice'); + print ''; + print $form->select_date('', '', '', '', '', '', 1, 1); + print '
'; + print $langs->trans('CreateOneBillByThird'); + print ''; + print $form->selectyesno('createbills_onebythird', '', 1); + print '
'; + print $langs->trans('ValidateInvoices'); + print ''; + print $form->selectyesno('valdate_invoices', 1, 1); + print '
'; + + print '
'; + print '
'; + print ' '; + print ''; + print '
'; + print '
'; + + } if ($sall) { @@ -457,10 +828,11 @@ if ($resql) $moreforfilter.=$form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, '', 1); $moreforfilter.='
'; } - $parameters=array(); - $reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook + $parameters=array(); + $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 '
'; @@ -473,6 +845,7 @@ if ($resql) print ''."\n"; + // Fields title print ''; 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_client']['checked'])) print_liste_field_titre($arrayfields['c.ref_client']['label'],$_SERVER["PHP_SELF"],'c.ref_client','',$param,'',$sortfield,$sortorder); @@ -485,7 +858,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)) @@ -508,7 +881,7 @@ if ($resql) if (! empty($arrayfields['c.fk_statut']['checked'])) print_liste_field_titre($arrayfields['c.fk_statut']['label'],$_SERVER["PHP_SELF"],"c.fk_statut","",$param,'align="right"',$sortfield,$sortorder); if (! empty($arrayfields['c.facture']['checked'])) print_liste_field_titre($arrayfields['c.facture']['label'],$_SERVER["PHP_SELF"],'c.facture','',$param,'align="center"',$sortfield,$sortorder,''); print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch '); - print ''; + print ''."\n"; print ''; // Ref @@ -657,7 +1030,7 @@ if ($resql) } // Action column print ''; @@ -1001,11 +1374,18 @@ if ($resql) } // Action column - print ''; + print ''; if (! $i) $totalarray['nbfield']++; - print ''; - + print "\n"; + $total+=$obj->total_ht; $subtotal+=$obj->total_ht; $i++; @@ -1030,7 +1410,6 @@ if ($resql) else print ''; } print ''; - } $db->free($resql); @@ -1039,17 +1418,43 @@ if ($resql) $reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - print '
'; - $searchpitco=$form->showFilterAndCheckAddButtons(0); + $searchpitco=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1); print $searchpitco; print ''; + 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 ''; + } + print '
'; + print ''."\n"; + + print '
'; print ''."\n"; - print '
'.img_help(1,'').' '.$langs->trans("ToBillSeveralOrderSelectCustomer", $langs->transnoentitiesnoconv("CreateInvoiceForThisCustomer")).'
'; + //print '
'.img_help(1,'').' '.$langs->trans("ToBillSeveralOrderSelectCustomer", $langs->transnoentitiesnoconv("CreateInvoiceForThisCustomer")).'
'; + + if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) + { + /* + * Show list of available documents + */ + $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder; + $urlsource.=str_replace('&','&',$param); + + $filedir=$diroutputmassaction; + $genallowed=$user->rights->commande->lire; + $delallowed=$user->rights->commande->lire; + + print '
'; + $paramwithoutshowfiles=preg_replace('/show_files=1&?/','',$param); + $title=$langs->trans("MassFilesArea").' ('.$langs->trans("Hide").')'; + + print $formfile->showdocuments('massfilesarea_orders','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,''); + } + else + { + print '
'.$langs->trans("ShowTempMassFilesArea").''; + } + } else { dol_print_error($db); } +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/commande/orderstoinvoice.php b/htdocs/commande/orderstoinvoice.php index bcbe3ea408e..f9767c74695 100644 --- a/htdocs/commande/orderstoinvoice.php +++ b/htdocs/commande/orderstoinvoice.php @@ -70,9 +70,14 @@ $date_end = dol_mktime(23,59,59,$_REQUEST["date_endmonth"],$_REQUEST["date_endda $date_starty = dol_mktime(0,0,0,$_REQUEST["date_start_delymonth"],$_REQUEST["date_start_delyday"],$_REQUEST["date_start_delyyear"]); // Date for local PHP server $date_endy = dol_mktime(23,59,59,$_REQUEST["date_end_delymonth"],$_REQUEST["date_end_delyday"],$_REQUEST["date_end_delyyear"]); +$extrafields = new ExtraFields($db); + +// fetch optionals attributes and labels +$extralabels=$extrafields->fetch_name_optionals_label('facture'); + if ($action == 'create') { - if (is_array($selected) == false) + if (! is_array($selected)) { $error++; setEventMessages($langs->trans('Error_OrderNotChecked'), null, 'errors'); @@ -174,6 +179,9 @@ if (($action == 'create' || $action == 'add') && !$error) $object->remise_absolue = $_POST['remise_absolue']; $object->remise_percent = $_POST['remise_percent']; + $ret = $extrafields->setOptionalsFromPost($extralabels,$object); + if ($ret < 0) $error++; + if ($_POST['origin'] && $_POST['originid']) { $object->origin = $_POST['origin']; @@ -464,6 +472,12 @@ if ($action == 'create' && !$error) $parameters=array('objectsrc' => $objectsrc, 'idsrc' => $listoforders, '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)) + { + $object=new Facture($db); + print $object->showOptionals($extrafields,'edit'); + } + // Modele PDF print ''.$langs->trans('Model').''; print ''; @@ -651,7 +665,7 @@ if (($action != 'create' && $action != 'add') || ($action == 'create' && $error) print ''; print ''; print '
'; - print $generic_commande->getNomUrl(1,$objp->fk_statut); + print $generic_commande->getNomUrl(1,0); print ''; diff --git a/htdocs/compta/bank/account.php b/htdocs/compta/bank/account.php deleted file mode 100644 index 67af1a773a0..00000000000 --- a/htdocs/compta/bank/account.php +++ /dev/null @@ -1,974 +0,0 @@ - - * Copyright (C) 2003 Jean-Louis Bergamo - * Copyright (C) 2004-2011 Laurent Destailleur - * Copyright (C) 2004 Christophe Combelles - * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2010-2011 Juanjo Menent - * Copyright (C) 2012-2016 Marcos García - * Copyright (C) 2011-2015 Alexandre Spangaro - * Copyright (C) 2015 Florian Henry - * - * 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 . - */ - -/** - * \file htdocs/compta/bank/account.php - * \ingroup banque - * \brief List of details of bank transactions for an account - */ - -require('../../main.inc.php'); -require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; -require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; -require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/salaries/class/paymentsalary.class.php'; -require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php'; -require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; -require_once DOL_DOCUMENT_ROOT.'/loan/class/loan.class.php'; -require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; - -$langs->load("banks"); -$langs->load("categories"); -$langs->load("bills"); -$langs->load("companies"); -$langs->load("salaries"); -$langs->load("loan"); -$langs->load("donations"); -$langs->load("trips"); - -$id = (GETPOST('id','int') ? GETPOST('id','int') : GETPOST('account','int')); -$ref = GETPOST('ref','alpha'); -$action=GETPOST('action','alpha'); -$confirm=GETPOST('confirm','alpha'); - -// Security check -$fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref :'')); -$fieldtype = (! empty($ref) ? 'ref' :'rowid'); -if ($user->societe_id) $socid=$user->societe_id; -$result=restrictedArea($user,'banque',$fieldvalue,'bank_account&bank_account','','',$fieldtype); - -$paiementtype=GETPOST('paiementtype','alpha',3); -$req_nb=GETPOST("req_nb",'',3); -$thirdparty=GETPOST("thirdparty",'',3); -$req_desc=GETPOST("req_desc",'',3); -$req_debit=GETPOST("req_debit",'',3); -$req_credit=GETPOST("req_credit",'',3); - -$req_stdtmonth=GETPOST('req_stdtmonth', 'int'); -$req_stdtday=GETPOST('req_stdtday', 'int'); -$req_stdtyear=GETPOST('req_stdtyear', 'int'); -$req_stdt = dol_mktime(0, 0, 0, $req_stdtmonth, $req_stdtday, $req_stdtyear); -$req_enddtmonth=GETPOST('req_enddtmonth', 'int'); -$req_enddtday=GETPOST('req_enddtday', 'int'); -$req_enddtyear=GETPOST('req_enddtyear', 'int'); -$req_enddt = dol_mktime(23, 59, 59, $req_enddtmonth, $req_enddtday, $req_enddtyear); - -$vline=GETPOST("vline"); -$page=GETPOST('page','int'); -$negpage=GETPOST('negpage','int'); -if ($negpage) -{ - $page=GETPOST("nbpage") - $negpage; - if ($page > GETPOST("nbpage")) $page = GETPOST("nbpage"); -} - -$object = new Account($db); - -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers -{ - $paiementtype=""; - $req_nb=""; - $thirdparty=""; - $req_desc=""; - $req_debit=""; - $req_credit=""; - $req_stdtmonth=""; - $req_stdtday=""; - $req_stdtyear=""; - $req_stdt = ""; - $req_enddtmonth=""; - $req_enddtday=""; - $req_enddtyear=""; - $req_enddt = ""; -} - -/* - * Action - */ -$dateop=-1; - -if ($action == 'add' && $id && ! isset($_POST["cancel"]) && $user->rights->banque->modifier) -{ - $error = 0; - - if (price2num($_POST["credit"]) > 0) - { - $amount = price2num($_POST["credit"]); - } - else - { - $amount = - price2num($_POST["debit"]); - } - - $dateop = dol_mktime(12,0,0,$_POST["opmonth"],$_POST["opday"],$_POST["opyear"]); - $operation=$_POST["operation"]; - $num_chq=$_POST["num_chq"]; - $label=$_POST["label"]; - $cat1=$_POST["cat1"]; - - if (! $dateop) { - $error++; - setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Date")), null, 'errors'); - } - if (! $operation) { - $error++; - setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Type")), null, 'errors'); - } - if (! $amount) { - $error++; - setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Amount")), null, 'errors'); - } - - if (! $error) - { - $object->fetch($id); - $insertid = $object->addline($dateop, $operation, $label, $amount, $num_chq, $cat1, $user); - if ($insertid > 0) - { - setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); - header("Location: ".$_SERVER['PHP_SELF']."?id=".$id."&action=addline"); - exit; - } - else - { - setEventMessages($object->error, $object->errors, 'errors'); - } - } - else - { - $action='addline'; - } -} -if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->banque->modifier) -{ - $accline=new AccountLine($db); - $result=$accline->fetch(GETPOST("rowid")); - $result=$accline->delete(); -} - - -/* - * View - */ - -llxHeader('',$langs->trans("FinancialAccount").'-'.$langs->trans("Transactions")); - -$societestatic=new Societe($db); -$userstatic=new User($db); -$chargestatic=new ChargeSociales($db); -$loanstatic=new Loan($db); -$memberstatic=new Adherent($db); -$paymentstatic=new Paiement($db); -$paymentsupplierstatic=new PaiementFourn($db); -$paymentvatstatic=new TVA($db); -$paymentsalstatic=new PaymentSalary($db); -$donstatic=new Don($db); -$expensereportstatic=new ExpenseReport($db); -$bankstatic=new Account($db); -$banklinestatic=new AccountLine($db); - -$form = new Form($db); - -if ($id > 0 || ! empty($ref)) -{ - if ($vline) - { - $viewline = $vline; - } - else - { - $viewline = empty($conf->global->MAIN_SIZE_LISTE_LIMIT)?20:$conf->global->MAIN_SIZE_LISTE_LIMIT; - } - - $result=$object->fetch($id, $ref); - - // Load bank groups - require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/bankcateg.class.php'; - $bankcateg = new BankCateg($db); - $options = array(); - - foreach ($bankcateg->fetchAll() as $bankcategory) { - $options[$bankcategory->id] = $bankcategory->label; - } - - // Definition de sql_rech et param - $param=''; - $sql_rech=''; - $mode_search = 0; - if ($req_nb) - { - $sql_rech.= " AND b.num_chq LIKE '%".$db->escape($req_nb)."%'"; - $param.='&req_nb='.urlencode($req_nb); - $mode_search = 1; - } - if ($req_desc) - { - $sql_rech.= " AND b.label LIKE '%".$db->escape($req_desc)."%'"; - $param.='&req_desc='.urlencode($req_desc); - $mode_search = 1; - } - if ($req_debit != '') - { - $sql_rech.=" AND b.amount = -".price2num($req_debit); - $param.='&req_debit='.urlencode($req_debit); - $mode_search = 1; - } - if ($req_credit != '') - { - $sql_rech.=" AND b.amount = ".price2num($req_credit); - $param.='&req_credit='.urlencode($req_credit); - $mode_search = 1; - } - if ($thirdparty) - { - $sql_rech.=" AND s.nom LIKE '%".$db->escape($thirdparty)."%'"; - $param.='&thirdparty='.urlencode($thirdparty); - $mode_search = 1; - } - if ($paiementtype) - { - $sql_rech.=" AND b.fk_type = '".$db->escape($paiementtype)."'"; - $param.='&paiementtype='.urlencode($paiementtype); - $mode_search = 1; - } - - if ($req_stdt && $req_enddt) - { - $sql_rech.=" AND (b.datev BETWEEN '".$db->escape($db->idate($req_stdt))."' AND '".$db->escape($db->idate($req_enddt))."')"; - $param.='&req_stdtmonth='.$req_stdtmonth.'&req_stdtyear='.$req_stdtyear.'&req_stdtday='.$req_stdtday; - $param.='&req_enddtmonth='.$req_enddtmonth.'&req_enddtday='.$req_enddtday.'&req_enddtyear='.$req_enddtyear; - $mode_search = 1; - } - elseif ($req_stdt) - { - $sql_rech.=" AND b.datev >= '".$db->escape($db->idate($req_stdt))."'"; - $param.='&req_stdtmonth='.$req_stdtmonth.'&req_stdtyear='.$req_stdtyear.'&req_stdtday='.$req_stdtday; - $mode_search = 1; - } - elseif ($req_enddt) - { - $sql_rech.=" AND b.datev <= '".$db->escape($db->idate($req_enddt))."'"; - $param.='&req_enddtmonth='.$req_enddtmonth.'&req_enddtday='.$req_enddtday.'&req_enddtyear='.$req_enddtyear; - $mode_search = 1; - } - - - $sql = "SELECT count(*) as total"; - $sql.= " FROM ".MAIN_DB_PREFIX."bank_account as ba"; - $sql.= ", ".MAIN_DB_PREFIX."bank as b"; - if ($mode_search) - { - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_url as bu ON bu.fk_bank = b.rowid AND bu.type='company'"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON bu.url_id = s.rowid"; - } - $sql.= " WHERE b.fk_account = ".$object->id; - $sql.= " AND b.fk_account = ba.rowid"; - $sql.= " AND ba.entity IN (".getEntity('bank_account', 1).")"; - $sql.= $sql_rech; - - dol_syslog("account.php count transactions -", LOG_DEBUG); - $result=$db->query($sql); - if ($result) - { - $obj = $db->fetch_object($result); - $nbline = $obj->total; - $total_lines = $nbline; - - $db->free($result); - } - else - { - dol_print_error($db); - } - - //Total pages - $totalPages = ceil($total_lines/$viewline); - - if ($totalPages == 0) { - $page = 0; - } else { - - if ($page > 0) { - $limitsql = ($totalPages - $page) * $viewline; - if ($limitsql < $viewline) { - $limitsql = $viewline; - } - $nbline = $limitsql; - } else { - $page = 0; - $limitsql = $nbline; - } - } - - //print $limitsql.'-'.$page.'-'.$viewline; - - // Onglets - $head=bank_prepare_head($object); - dol_fiche_head($head,'journal',$langs->trans("FinancialAccount"),0,'account'); - - - print ''; - - $linkback = ''.$langs->trans("BackToList").''; - - // Ref - print ''; - print ''; - - // Label - print ''; - print ''; - - print '
'.$langs->trans("Ref").''; - print $form->showrefnav($object, 'ref', $linkback, 1, 'ref'); - print '
'.$langs->trans("Label").''.$object->label.'
'; - - dol_fiche_end(); - - - - /* - * Buttons actions - */ - - if ($action != 'delete') - { - print '
'; - - if ($action != 'addline') - { - if (empty($conf->global->BANK_DISABLE_DIRECT_INPUT)) - { - if (empty($conf->accounting->enabled)) - { - if ($user->rights->banque->modifier) { - print 'id.'&page='.$page.($vline?'&vline='.$vline:'').'">'.$langs->trans("AddBankRecord").''; - } else { - print ''.$langs->trans("AddBankRecord").''; - } - } else { - print ''.$langs->trans("AddBankRecord").''; - } - } else { - print ''.$langs->trans("AddBankRecord").''; - } - } - - if ($object->canBeConciliated() > 0) { - // If not cash account and can be reconciliate - if ($user->rights->banque->consolidate) { - print ''.$langs->trans("Conciliate").''; - } else { - print ''.$langs->trans("Conciliate").''; - } - } - - print '
'; - } - - print '
'; - - /** - * Search form - */ - $param.='&account='.$object->id.'&vline='.$vline; - - // Confirmation delete - if ($action == 'delete') - { - $text=$langs->trans('ConfirmDeleteTransaction'); - print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id.'&rowid='.GETPOST("rowid"),$langs->trans('DeleteTransaction'),$text,'confirm_delete'); - - } - - // Define transaction list navigation string - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - $navig ='
'; - if ($limitsql > $viewline) $navig.=''.img_previous().''; - $navig.= ' "; // ' Page '; - $navig.=''; - $navig.='/'.$totalPages.' '; - if ($total_lines > $limitsql ) - { - $navig.= ''.img_next().''; - } - $navig.='
'; - - - //var_dump($navig); - - if ($action != 'addline' && $action != 'delete') - { - print '
'.$navig.'
'; - } - - // Form to add a transaction with no invoice - if ($user->rights->banque->modifier && $action == 'addline') - { - print load_fiche_titre($langs->trans("AddBankRecordLong"),'',''); - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print '
'.$langs->trans("Date").' '.$langs->trans("Type").''.$langs->trans("Numero").''.$langs->trans("Description").''.$langs->trans("Debit").''.$langs->trans("Credit").' 
'; - $form->select_date($dateop,'op',0,0,0,'transaction'); - print ''; - $form->select_types_paiements((GETPOST('operation')?GETPOST('operation'):($object->courant == Account::TYPE_CASH ? 'LIQ' : '')),'operation','1,2',2,1); - print ''; - print ''; - print ''; - if ($options) { - print '
'.$langs->trans("Rubrique").': '; - print Form::selectarray('cat1', $options, GETPOST('cat1'), 1); - } - print '
'; - print '
'; - print ''; - print '
'; - print '
'; - print '
'; - } - - - /* - * Show list of bank transactions - */ - - print ''; - - // Ligne de titre tableau des ecritures - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - print ''; - print ''; - print ''; - print ''; - - $period_filter .= $langs->trans('From').' '.$form->select_date($req_stdt,'req_stdt',0,0,1,null,1,0,1); - $period_filter .= ' '; - $period_filter .= $langs->trans('to').' '.$form->select_date($req_enddt,'req_enddt',0,0,1,null,1,0,1); - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print "\n"; - - - /* - * Another solution - * create temporary table solde type=heap select amount from llx_bank limit 100 ; - * select sum(amount) from solde ; - */ - - $sql = "SELECT b.rowid, b.dateo as do, b.datev as dv,"; - $sql.= " b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type, b.fk_bordereau,"; - $sql.= " ba.rowid as bankid, ba.ref as bankref, ba.label as banklabel"; - if ($mode_search) - { - $sql.= ", s.rowid as socid, s.nom as thirdparty"; - } - /* - if ($mode_search && ! empty($conf->adherent->enabled)) - { - - } - if ($mode_search && ! empty($conf->tax->enabled)) - { - - } - */ - $sql.= " FROM ".MAIN_DB_PREFIX."bank_account as ba"; - $sql.= ", ".MAIN_DB_PREFIX."bank as b"; - if ($mode_search) - { - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_url as bu1 ON bu1.fk_bank = b.rowid AND bu1.type='company'"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON bu1.url_id = s.rowid"; - } - if ($mode_search && ! empty($conf->tax->enabled)) - { - // VAT - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_url as bu2 ON bu2.fk_bank = b.rowid AND bu2.type='payment_vat'"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."tva as t ON bu2.url_id = t.rowid"; - - // Salary payment - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_url as bu3 ON bu3.fk_bank = b.rowid AND bu3.type='payment_salary'"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."payment_salary as sal ON bu3.url_id = sal.rowid"; - } - if ($mode_search && ! empty($conf->adherent->enabled)) - { - // TODO Mettre jointure sur adherent pour recherche sur un adherent - //$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_url as bu3 ON bu3.fk_bank = b.rowid AND bu3.type='company'"; - //$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON bu3.url_id = s.rowid"; - } - $sql.= " WHERE b.fk_account=".$object->id; - $sql.= " AND b.fk_account = ba.rowid"; - $sql.= " AND ba.entity IN (".getEntity('bank_account', 1).")"; - $sql.= $sql_rech; - $sql.= $db->order("b.datev, b.datec", "ASC"); // We add date of creation to have correct order when everything is done the same day - $sql.= $db->plimit($limitsql, 0); - - dol_syslog("account.php get transactions -", LOG_DEBUG); - $result = $db->query($sql); - if ($result) - { - $now=dol_now(); - $nows=dol_print_date($now,'%Y%m%d'); - - //$form->load_cache_types_paiements(); - //$form->cache_types_paiements - - $var=true; - - $num = $db->num_rows($result); - $i = 0; $total = 0; $sep = -1; $total_deb=0; $total_cred=0; - - while ($i < $num) - { - $objp = $db->fetch_object($result); - $total = price2num($total + $objp->amount,'MT'); - if ($i >= ($viewline * (($totalPages-$page)-1))) - { - $var=!$var; - - // Is it a transaction in future ? - $dos=dol_print_date($db->jdate($objp->do),'%Y%m%d'); - //print "dos=".$dos." nows=".$nows; - if ($dos < $nows) $sep=0; // 0 means there was at least one line before current date - if ($dos > $nows && ! $sep) // We have found a line in future and we already found on line before current date - { - $sep = 1 ; - print ''; - print ''; - print ""; - print ''; - } - - print ''; - - print '\n"; - - print '\n"; - - // Payment type - print '\n"; - - // Num - print '\n"; - - // Description - print ''; - - // Add third party column - print ''; - - // Amount - if ($objp->amount < 0) - { - print ''."\n"; - $total_deb +=$objp->amount; - } - else - { - print ''."\n"; - $total_cred +=$objp->amount; - } - - // Balance - if (! $mode_search) - { - if ($total >= 0) - { - print ''; - } - else - { - print ''; - } - } - else - { - print ''; - } - - // Transaction reconciliated or edit link - if ($objp->rappro && $object->canBeConciliated() > 0) // If line not conciliated and account can be conciliated - { - print '"; - } - else - { - print ''; - } - - print ""; - } - - $i++; - } - - // Show total - if ($page == 0 && ! $mode_search) - { - //Real account situation - print ''; - print ''; - print ''; - print ''; - } else { - // Only total according row displays - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - } - $db->free($result); - } - else - { - dol_print_error($db); - } - - print "
'.$langs->trans("Date").''.$langs->trans("Value").''.$langs->trans("Type").''.$langs->trans("Numero").''.$langs->trans("Description").''.$langs->trans("ThirdParty").''.$langs->trans("Debit").''.$langs->trans("Credit").''.$langs->trans("BankBalance").''; - if ($object->canBeConciliated() > 0) { - print $langs->trans("AccountStatementShort"); - } else { - print ' '; - } - print '
'.$period_filter.''; - //$filtertype=array('TIP'=>'TIP','PRE'=>'PRE',...) - $filtertype=''; - $form->select_types_paiements($paiementtype,'paiementtype',$filtertype,2,1,1,8); - print ' '; - $searchpitco=$form->showFilterAndCheckAddButtons(0); - print $searchpitco; - print '
'; - print $langs->trans("CurrentBalance"); - print ''.price($total - $objp->amount).' 
'.dol_print_date($db->jdate($objp->do),"day")."'.dol_print_date($db->jdate($objp->dv),"day"); - print "'; - $label=($langs->trans("PaymentTypeShort".$objp->fk_type)!="PaymentTypeShort".$objp->fk_type)?$langs->trans("PaymentTypeShort".$objp->fk_type):$objp->fk_type; - - if ($objp->fk_type == 'SOLD') $label=' '; - if ($objp->fk_type == 'CHQ' && $objp->fk_bordereau > 0) - { - dol_include_once('/compta/paiement/cheque/class/remisecheque.class.php'); - $bordereaustatic = new RemiseCheque($db); - $bordereaustatic->id = $objp->fk_bordereau; - $label .= ' '.$bordereaustatic->getNomUrl(2); - } - print $label; - print "'.($objp->num_chq?$objp->num_chq:"")."'; - // Show generic description - if (preg_match('/^\((.*)\)$/i',$objp->label,$reg)) - { - // Generic description because between (). We show it after translating. - print $langs->trans($reg[1]); - } - else - { - print dol_trunc($objp->label,60); - } - - // Add links after description - $links = $object->get_url($objp->rowid); - foreach($links as $key=>$val) - { - if ($links[$key]['type']=='payment') - { - $paymentstatic->id=$links[$key]['url_id']; - $paymentstatic->ref=$links[$key]['url_id']; - print ' '.$paymentstatic->getNomUrl(2); - } - elseif ($links[$key]['type']=='payment_supplier') - { - $paymentsupplierstatic->id=$links[$key]['url_id']; - $paymentsupplierstatic->ref=$links[$key]['url_id']; - print ' '.$paymentsupplierstatic->getNomUrl(2); - } - elseif ($links[$key]['type']=='payment_sc') - { - print ''; - print ' '.img_object($langs->trans('ShowPayment'),'payment').' '; - //print $langs->trans("SocialContributionPayment"); - print ''; - } - elseif ($links[$key]['type']=='payment_vat') - { - $paymentvatstatic->id=$links[$key]['url_id']; - $paymentvatstatic->ref=$links[$key]['url_id']; - print ' '.$paymentvatstatic->getNomUrl(2); - } - elseif ($links[$key]['type']=='payment_salary') - { - $paymentsalstatic->id=$links[$key]['url_id']; - $paymentsalstatic->ref=$links[$key]['url_id']; - print ' '.$paymentsalstatic->getNomUrl(2); - } - elseif ($links[$key]['type']=='payment_loan') - { - print ''; - print ' '.img_object($langs->trans('ShowPayment'),'payment').' '; - print ''; - } - elseif ($links[$key]['type']=='payment_donation') - { - print ''; - print ' '.img_object($langs->trans('ShowPayment'),'payment').' '; - print ''; - } - elseif ($links[$key]['type']=='payment_expensereport') - { - print ''; - print ' '.img_object($langs->trans('ShowPayment'),'payment').' '; - print ''; - } - elseif ($links[$key]['type']=='banktransfert') - { - // Do not show link to transfer since there is no transfer card (avoid confusion). Can already be accessed from transaction detail. - if ($objp->amount > 0) - { - $banklinestatic->fetch($links[$key]['url_id']); - $bankstatic->id=$banklinestatic->fk_account; - $bankstatic->label=$banklinestatic->bank_account_label; - print ' ('.$langs->trans("TransferFrom").' '; - print $bankstatic->getNomUrl(1,'transactions'); - print ' '.$langs->trans("toward").' '; - $bankstatic->id=$objp->bankid; - $bankstatic->label=$objp->bankref; - print $bankstatic->getNomUrl(1,''); - print ')'; - } - else - { - $bankstatic->id=$objp->bankid; - $bankstatic->label=$objp->bankref; - print ' ('.$langs->trans("TransferFrom").' '; - print $bankstatic->getNomUrl(1,''); - print ' '.$langs->trans("toward").' '; - $banklinestatic->fetch($links[$key]['url_id']); - $bankstatic->id=$banklinestatic->fk_account; - $bankstatic->label=$banklinestatic->bank_account_label; - print $bankstatic->getNomUrl(1,'transactions'); - print ')'; - } - //var_dump($links); - } - elseif ($links[$key]['type']=='company') - { - - } - elseif ($links[$key]['type']=='user') - { - - } - elseif ($links[$key]['type']=='member') - { - - } - elseif ($links[$key]['type']=='sc') - { - - } - else - { - // Show link with label $links[$key]['label'] - if (! empty($objp->label) && ! empty($links[$key]['label'])) print ' - '; - print ''; - if (preg_match('/^\((.*)\)$/i',$links[$key]['label'],$reg)) - { - // Label generique car entre parentheses. On l'affiche en le traduisant - if ($reg[1]=='paiement') $reg[1]='Payment'; - print ' '.$langs->trans($reg[1]); - } - else - { - print ' '.$links[$key]['label']; - } - print ''; - } - } - print ''; - foreach($links as $key=>$val) - { - if ($links[$key]['type']=='company') - { - $societestatic->id=$links[$key]['url_id']; - $societestatic->name=$links[$key]['label']; - print $societestatic->getNomUrl(1,'',16); - } - else if ($links[$key]['type']=='user') - { - $userstatic->id=$links[$key]['url_id']; - $userstatic->lastname=$links[$key]['label']; - print $userstatic->getNomUrl(1,''); - } - else if ($links[$key]['type']=='sc') - { - // sc=old value - $chargestatic->id=$links[$key]['url_id']; - if (preg_match('/^\((.*)\)$/i',$links[$key]['label'],$reg)) - { - if ($reg[1]=='socialcontribution') $reg[1]='SocialContribution'; - $chargestatic->lib=$langs->trans($reg[1]); - } - else - { - $chargestatic->lib=$links[$key]['label']; - } - $chargestatic->ref=$chargestatic->lib; - print $chargestatic->getNomUrl(1,16); - } - else if ($links[$key]['type']=='loan') - { - $loanstatic->id=$links[$key]['url_id']; - if (preg_match('/^\((.*)\)$/i',$links[$key]['label'],$reg)) - { - if ($reg[1]=='loan') $reg[1]='Loan'; - $loanstatic->label=$langs->trans($reg[1]); - } - else - { - $loanstatic->label=$links[$key]['label']; - } - $loanstatic->ref=$loanstatic->label; - print $loanstatic->getLinkUrl(1,16); - } - else if ($links[$key]['type']=='member') - { - $memberstatic->id=$links[$key]['url_id']; - $memberstatic->ref=$links[$key]['label']; - print $memberstatic->getNomUrl(1,16,'card'); - } - } - print ''.price($objp->amount * -1).'   '.price($objp->amount).' '.price($total).' '.price($total).'-'; - print ''; - print img_edit(); - print ''; - print "  "; - print ''.$objp->num_releve.''; - print "'; - if ($user->rights->banque->modifier || $user->rights->banque->consolidate) - { - print ''; - print img_edit(); - print ''; - } - else - { - print ''; - print img_view(); - print ''; - } - if ($object->canBeConciliated() > 0 && empty($objp->rappro)) - { - if ($db->jdate($objp->dv) < ($now - $conf->bank->rappro->warning_delay)) - { - print ' '.img_warning($langs->trans("Late")); - } - } - print ' '; - if ($user->rights->banque->modifier) - { - print 'rowid.'&id='.$object->id.'&page='.$page.'">'; - print img_delete(); - print ''; - } - print '
'; - if ($sep > 0) print ' '; // If we had at least one line in future - else print $langs->trans("CurrentBalance"); - print ' '.$object->currency_code.''.price($total).' 
'; - if ($sep > 0) print ' '; // If we had at least one line in future - else print $langs->trans("Total"); - print ' '.$object->currency_code.''.price($total_deb*-1).''.price($total_cred).''.price($total_cred-($total_deb*-1)).' 
"; - - print "\n"; - - print '
'; -} -else -{ - print $langs->trans("ErrorBankAccountNotFound"); -} - -llxFooter(); - -$db->close(); diff --git a/htdocs/compta/bank/annuel.php b/htdocs/compta/bank/annuel.php index 7b53d775cb6..9acf83db399 100644 --- a/htdocs/compta/bank/annuel.php +++ b/htdocs/compta/bank/annuel.php @@ -32,14 +32,14 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php'; $langs->load("banks"); $langs->load("categories"); -$id=GETPOST('account'); +$id=GETPOST('account')?GETPOST('account','alpha'):GETPOST('id'); $ref=GETPOST('ref'); // Security check -$fieldid = (! empty($ref)?$ref:$id); -$fieldname = isset($ref)?'ref':'rowid'; +$fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref :'')); +$fieldtype = (! empty($ref) ? 'ref' :'rowid'); if ($user->societe_id) $socid=$user->societe_id; -$result=restrictedArea($user,'banque',$fieldid,'bank_account','','',$fieldname); +$result=restrictedArea($user,'banque',$fieldvalue,'bank_account&bank_account','','',$fieldtype); $year_start=GETPOST('year_start'); $year_current = strftime("%Y",time()); @@ -53,22 +53,23 @@ else $year_end=$year_start+2; } - -llxHeader(); +$title = $langs->trans("FinancialAccount").' - '.$langs->trans("IOMonthlyReporting"); +$helpurl = ""; +llxHeader('',$title,$helpurl); $form = new Form($db); // Get account informations -$acct = new Account($db); +$object = new Account($db); if ($id > 0 && ! preg_match('/,/', $id)) // if for a particular account and not a list { - $result=$acct->fetch($id); - $id=$acct->id; + $result=$object->fetch($id); + $id=$object->id; } if (! empty($ref)) { - $result=$acct->fetch(0, $ref); - $id=$acct->id; + $result=$object->fetch(0, $ref); + $id=$object->id; } @@ -133,58 +134,38 @@ else // Onglets -$head=bank_prepare_head($acct); +$head=bank_prepare_head($object); dol_fiche_head($head,'annual',$langs->trans("FinancialAccount"),0,'account'); -$title=$langs->trans("FinancialAccount")." : ".$acct->label; -$link=($year_start?"".img_previous()." ".$langs->trans("Year")." ".img_next()."":""); - -print ''; +$title=$langs->trans("FinancialAccount")." : ".$object->label; +$link=($year_start?"".img_previous()." ".$langs->trans("Year")." ".img_next()."":""); $linkback = ''.$langs->trans("BackToList").''; -// Ref -print ''; -print ''; -// Label -print ''; -print ''; - -print '
'.$langs->trans("Ref").''; -if ($_GET["account"]) -{ - if (! preg_match('/,/', $id)) - { - print $form->showrefnav($acct, 'ref', $linkback, 1, 'ref'); - } - else - { - $bankaccount=new Account($db); - $listid=explode(',', $id); - foreach($listid as $key => $aId) - { - $bankaccount->fetch($aId); - $bankaccount->label=$bankaccount->ref; - print $bankaccount->getNomUrl(1); - if ($key < (count($listid)-1)) print ', '; - } - } -} -else -{ - print $langs->trans("ALL"); -} -print '
'.$langs->trans("Label").''; -if (! empty($id)) +if (!empty($id)) { - print $acct->label; + if (! preg_match('/,/', $id)) + { + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '', 1); + } + else + { + $bankaccount=new Account($db); + $listid=explode(',', $id); + foreach($listid as $key => $aId) + { + $bankaccount->fetch($aId); + $bankaccount->label=$bankaccount->ref; + print $bankaccount->getNomUrl(1); + if ($key < (count($listid)-1)) print ', '; + } + } } else { print $langs->trans("AllAccounts"); } -print '
'; dol_fiche_end(); @@ -286,7 +267,7 @@ print "
"; $year = $year_end; -$result=dol_mkdir($conf->banque->dir_temp); +$result=dol_mkdir($conf->bank->dir_temp); if ($result < 0) { $langs->load("errors"); @@ -377,7 +358,7 @@ else } // Fabrication tableau 4b - $file= $conf->banque->dir_temp."/credmovement".$id."-".$year.".png"; + $file= $conf->bank->dir_temp."/credmovement".$id."-".$year.".png"; $fileurl=DOL_URL_ROOT.'/viewimage.php?modulepart=banque_temp&file='."/credmovement".$id."-".$year.".png"; $title=$langs->transnoentities("Credit").' - '.$langs->transnoentities("Year").': '.($year-2).' - '.($year-1)." - ".$year; $graph_datas=array(); @@ -464,7 +445,7 @@ else $datamin[$i] = 0; } - $file= $conf->banque->dir_temp."/debmovement".$id."-".$year.".png"; + $file= $conf->bank->dir_temp."/debmovement".$id."-".$year.".png"; $fileurl= DOL_URL_ROOT.'/viewimage.php?modulepart=banque_temp&file='."/debmovement".$id."-".$year.".png"; $title=$langs->transnoentities("Debit").' - '.$langs->transnoentities("Year").': '.($year-2).' - '.($year-1)." - ".$year; $graph_datas=array(); diff --git a/htdocs/compta/bank/bankentries.php b/htdocs/compta/bank/bankentries.php new file mode 100644 index 00000000000..b07e919849a --- /dev/null +++ b/htdocs/compta/bank/bankentries.php @@ -0,0 +1,1299 @@ + + * Copyright (C) 2004-2016 Laurent Destailleur + * Copyright (C) 2005-2010 Regis Houssin + * Copyright (C) 2012 Vinícius Nogueira + * Copyright (C) 2014 Florian Henry + * Copyright (C) 2015 Jean-François Ferry + * + * 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 . + */ + +/** + * \file htdocs/compta/bank/bankentries.php + * \ingroup banque + * \brief List of bank transactions + */ + +require('../../main.inc.php'); +require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; +require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/bankcateg.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; + +require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/salaries/class/paymentsalary.class.php'; +require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php'; +require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; +require_once DOL_DOCUMENT_ROOT.'/loan/class/loan.class.php'; +require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php'; + +$langs->load("banks"); +$langs->load("bills"); +$langs->load("categories"); +$langs->load("companies"); +$langs->load("margins"); +$langs->load("salaries"); +$langs->load("loan"); +$langs->load("donations"); +$langs->load("trips"); +$langs->load("members"); + +$id = GETPOST('id','int'); +$ref = GETPOST('ref','alpha'); +$action=GETPOST('action','alpha'); +$cancel=GETPOST('cancel','alpha'); +$confirm=GETPOST('confirm','alpha'); + +// Security check +$fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref :'')); +$fieldtype = (! empty($ref) ? 'ref' :'rowid'); +if ($fielvalue) +{ + if ($user->societe_id) $socid=$user->societe_id; + $result=restrictedArea($user,'banque',$fieldvalue,'bank_account&bank_account','','',$fieldtype); +} +else +{ + if ($user->societe_id) $socid=$user->societe_id; + $result=restrictedArea($user,'banque'); +} + +$search_ref=GETPOST('search_ref','alpha'); +$description=GETPOST("description",'alpha'); +$debit=GETPOST("debit",'alpha'); +$credit=GETPOST("credit",'alpha'); +$type=GETPOST("type",'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')); +$search_dv_start = dol_mktime(0, 0, 0, GETPOST('search_start_dvmonth', 'int'), GETPOST('search_start_dvday', 'int'), GETPOST('search_start_dvyear', 'int')); +$search_dv_end = dol_mktime(0, 0, 0, GETPOST('search_end_dvmonth', 'int'), GETPOST('search_end_dvday', 'int'), GETPOST('search_end_dvyear', 'int')); +$search_thirdparty=GETPOST("thirdparty",'alpha'); +$search_req_nb=GETPOST("req_nb",'alpha'); +$search_num_releve=GETPOST("search_num_releve",'alpha'); +$num_releve=GETPOST("num_releve"); +$cat=GETPOST("cat"); + + +$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; +$sortfield = GETPOST("sortfield",'alpha'); +$sortorder = GETPOST("sortorder",'alpha'); +$page = GETPOST("page",'int'); +$pageplusone = GETPOST("pageplusone",'int'); +if ($pageplusone) $page = $pageplusone - 1; +if ($page == -1) { $page = 0; } +$offset = $limit * $page; +$pageprev = $page - 1; +$pagenext = $page + 1; +if (! $sortorder) $sortorder='ASC'; +if (! $sortfield) $sortfield='b.datev'; + +$mode_balance_ok=false; +//if (($sortfield == 'b.datev' || $sortfield == 'b.datev, b.dateo, b.rowid')) // TODO Manage balance when account not selected +if (($sortfield == 'b.datev' || $sortfield == 'b.datev, b.dateo, b.rowid') && ($id > 0 || ! empty($ref))) +{ + $sortfield = 'b.datev, b.dateo, b.rowid'; + $mode_balance_ok = true; +} +if (strtolower($sortorder) == 'desc') $mode_balance_ok = false; + + +$object = new Account($db); +if ($id > 0 || ! empty($ref)) +{ + $result=$object->fetch($id, $ref); + $account = $object->id; // Force the search field on id of account +} + + +// Initialize technical object to manage context to save list fields +$contextpage='banktransactionlist'.(empty($object->ref)?'':'-'.$object->id); +//var_dump($contextpage); + +// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +$hookmanager->initHooks(array('banktransactionlist', $contextpage)); +$extrafields = new ExtraFields($db); + +// fetch optionals attributes and labels +$extralabels = $extrafields->fetch_name_optionals_label('banktransaction'); +$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_'); + +$arrayfields=array( + 'b.rowid'=>array('label'=>$langs->trans("Ref"), 'checked'=>1), + 'description'=>array('label'=>$langs->trans("Description"), 'checked'=>1), + 'b.dateo'=>array('label'=>$langs->trans("DateOperationShort"), 'checked'=>1), + 'b.datev'=>array('label'=>$langs->trans("DateValueShort"), 'checked'=>1), + 'type'=>array('label'=>$langs->trans("Type"), 'checked'=>1), + 'b.num_chq'=>array('label'=>$langs->trans("Numero"), 'checked'=>1), + 'bu.label'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1, 'position'=>500), + 'ba.ref'=>array('label'=>$langs->trans("BankAccount"), 'checked'=>(($id > 0 || ! empty($ref))?0:1), 'position'=>1000), + 'b.debit'=>array('label'=>$langs->trans("Debit"), 'checked'=>1, 'position'=>600), + 'b.credit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1, 'position'=>605), + 'balance'=>array('label'=>$langs->trans("Balance"), 'checked'=>1, 'position'=>1000), + 'b.num_releve'=>array('label'=>$langs->trans("AccountStatement"), 'checked'=>1, 'position'=>1010), +); +// 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]); + } +} + + + +/* + * Actions + */ + +if (GETPOST('cancel')) { $action='list'; $massaction=''; } +if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; } + +$parameters=array(); +$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + +include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; + +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers +{ + $search_dt_start=''; + $search_dt_end=''; + $search_dv_start=''; + $search_dv_end=''; + $description=""; + $type=""; + $debit=""; + $credit=""; + $bid=""; + $search_ref=""; + $search_req_nb=''; + $search_thirdparty=''; + $search_num_releve=''; + $thirdparty=''; + + $account=""; + if ($id > 0 || ! empty($ref)) $account=$object->id; +} + +if (empty($reshook)) +{ + $objectclass='Account'; + $objectlabel='BankTransaction'; + $permtoread = $user->rights->banque->lire; + $permtodelete = $user->rights->banque->supprimer; + $uploaddir = $conf->bank->dir_output; + include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; +} + +// Conciliation +if (GETPOST('confirm_reconcile') && $user->rights->banque->consolidate) +{ + $error=0; + + // Definition, nettoyage parametres + $num_releve=trim(GETPOST("num_releve")); + + if ($num_releve) + { + $bankline=new AccountLine($db); + if (isset($_POST['rowid']) && is_array($_POST['rowid'])) + { + foreach($_POST['rowid'] as $row) + { + if ($row > 0) + { + $result=$bankline->fetch($row); + $bankline->num_releve=$num_releve; //$_POST["num_releve"]; + $result=$bankline->update_conciliation($user, GETPOST("cat")); + if ($result < 0) + { + setEventMessages($bankline->error, $bankline->errors, 'errors'); + $error++; + break; + } + } + } + } + else + { + $error++; + $langs->load("errors"); + setEventMessages($langs->trans("NoRecordSelected"), null, 'errors'); + } + } + else + { + $error++; + $langs->load("errors"); + setEventMessages($langs->trans("ErrorPleaseTypeBankTransactionReportName"), null, 'errors'); + } + + if (! $error) + { + header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id); // To avoid to submit twice and allow back + exit; + } +} + + +$dateop=-1; + +if (GETPOST('save') && $id && ! $cancel && $user->rights->banque->modifier) +{ + $error = 0; + + if (price2num($_POST["addcredit"]) > 0) + { + $amount = price2num($_POST["addcredit"]); + } + else + { + $amount = - price2num($_POST["adddebit"]); + } + + $dateop = dol_mktime(12,0,0,$_POST["opmonth"],$_POST["opday"],$_POST["opyear"]); + $operation=$_POST["operation"]; + $num_chq=$_POST["num_chq"]; + $label=$_POST["label"]; + $cat1=$_POST["cat1"]; + + if (! $dateop) { + $error++; + setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Date")), null, 'errors'); + } + if (! $operation) { + $error++; + setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Type")), null, 'errors'); + } + if (! $amount) { + $error++; + setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Amount")), null, 'errors'); + } + + if (! $error) + { + $object->fetch($id); + $insertid = $object->addline($dateop, $operation, $label, $amount, $num_chq, $cat1, $user); + if ($insertid > 0) + { + setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); + header("Location: ".$_SERVER['PHP_SELF']."?id=".$id); + exit; + } + else + { + setEventMessages($object->error, $object->errors, 'errors'); + } + } + else + { + $action='addline'; + } +} + +if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->banque->modifier) +{ + $accline=new AccountLine($db); + $result=$accline->fetch(GETPOST("rowid")); + $result=$accline->delete($user); +} + + + +/* + * View + */ + +$form = new Form($db); +$formother = new FormOther($db); + +$companystatic=new Societe($db); +$bankaccountstatic=new Account($db); + +$societestatic=new Societe($db); +$userstatic=new User($db); +$chargestatic=new ChargeSociales($db); +$loanstatic=new Loan($db); +$memberstatic=new Adherent($db); +$paymentstatic=new Paiement($db); +$paymentsupplierstatic=new PaiementFourn($db); +$paymentvatstatic=new TVA($db); +$paymentsalstatic=new PaymentSalary($db); +$donstatic=new Don($db); +$expensereportstatic=new ExpenseReport($db); +$bankstatic=new Account($db); +$banklinestatic=new AccountLine($db); + +$now = dol_now(); + + +// Must be before button action +$param=''; +if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; +if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; +if ($id > 0) $param.='&id='.urlencode($id); +if (!empty($ref)) $param.='&ref='.urlencode($ref); +if (!empty($search_ref)) $param.='&search_ref='.urlencode($search_ref); +if (!empty($description)) $param.='&description='.urlencode($description); +if (!empty($type)) $param.='&type='.urlencode($type); +if (!empty($debit)) $param.='&debit='.$debit; +if (!empty($credit)) $param.='&credit='.$credit; +if (!empty($account)) $param.='&account='.$account; +if (!empty($search_num_releve)) $param.='&search_num_releve='.urlencode($search_num_releve); +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 (dol_strlen($search_dv_start) > 0) $param .= '&search_start_dvmonth=' . GETPOST('search_start_dvmonth', 'int') . '&search_start_dvday=' . GETPOST('search_start_dvday', 'int') . '&search_start_dvyear=' . GETPOST('search_start_dvyear', 'int'); +if (dol_strlen($search_dv_end) > 0) $param .= '&search_end_dvmonth=' . GETPOST('search_end_dvmonth', 'int') . '&search_end_dvday=' . GETPOST('search_end_dvday', 'int') . '&search_end_dvyear=' . GETPOST('search_end_dvyear', 'int'); +if ($search_req_nb) $param.='&req_nb='.urlencode($search_req_nb); +if (GETPOST("thirdparty")) $param.='&thirdparty='.urlencode(GETPOST("thirdparty")); +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); +} + + + +if ($id > 0 || ! empty($ref)) +{ + $title = $langs->trans("FinancialAccount").' - '.$langs->trans("Transactions"); + $helpurl = ""; + llxHeader('',$title,$helpurl); + + // Load bank groups + require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/bankcateg.class.php'; + $bankcateg = new BankCateg($db); + $options = array(); + + foreach ($bankcateg->fetchAll() as $bankcategory) { + $options[$bankcategory->id] = $bankcategory->label; + } + + // Bank card + + $head=bank_prepare_head($object); + dol_fiche_head($head,'journal',$langs->trans("FinancialAccount"),0,'account'); + + $linkback = ''.$langs->trans("BackToList").''; + + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '', 1); + + dol_fiche_end(); + + + + /* + * Buttons actions + */ + if ($action != 'addline' && $action != 'reconcile') + { + print '
'; + + if ($action != 'addline') + { + if (empty($conf->global->BANK_DISABLE_DIRECT_INPUT)) + { + if ($user->rights->banque->modifier) { + print ''.$langs->trans("AddBankRecord").''; + } else { + print ''.$langs->trans("AddBankRecord").''; + } + } else { + print ''.$langs->trans("AddBankRecord").''; + } + } + if ($object->canBeConciliated() > 0) { + // If not cash account and can be reconciliate + if ($user->rights->banque->consolidate) { + print ''.$langs->trans("Conciliate").''; + } else { + print ''.$langs->trans("Conciliate").''; + } + } + + print '
'; + } +} +else +{ + llxHeader('', $langs->trans("BankTransactions"), '', '', 0, 0, array(), array(), $param); +} + +$sql = "SELECT b.rowid, b.dateo as do, b.datev as dv, b.amount, b.label, b.rappro, b.num_releve, b.num_chq,"; +$sql.= " b.fk_account, b.fk_type,"; +$sql.= " ba.rowid as bankid, ba.ref as bankref,"; +$sql.= " bu.url_id,"; +$sql.= " s.nom, s.name_alias, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur"; +// 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 "; +if ($bid) $sql.= MAIN_DB_PREFIX."bank_class as l,"; +$sql.= " ".MAIN_DB_PREFIX."bank_account as ba,"; +$sql.= " ".MAIN_DB_PREFIX."bank as b"; +if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_extrafields as ef on (b.rowid = ef.fk_object)"; +$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_url as bu ON bu.fk_bank = b.rowid AND type = 'company'"; +$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 ($account > 0) $sql.=" AND b.fk_account = ".$account; +// 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) . "'"; +// Search period criteria +if (dol_strlen($search_dv_start)>0) $sql .= " AND b.datev >= '" . $db->idate($search_dv_start) . "'"; +if (dol_strlen($search_dv_end)>0) $sql .= " AND b.datev <= '" . $db->idate($search_dv_end) . "'"; +if ($search_ref) $sql.=natural_search("b.rowid", $search_ref); +if ($search_req_nb) $sql.= natural_search("b.num_chq", $search_req_nb); +if ($search_num_releve) $sql.= natural_search("b.num_releve", $search_num_releve); +if ($search_thirdparty) $sql.= natural_search("s.nom", $search_thirdparty); +if ($description) $sql.= natural_search("b.label", $description); // Warning some text are just translation keys, not translated strings +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 criteria amount +$debit = price2num(str_replace('-','',$debit)); +$credit = price2num(str_replace('-','',$credit)); +if ($debit) $sql.= natural_search('- b.amount', $debit, 1); +if ($credit) $sql.= natural_search('b.amount', $credit, 1); +// 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.= $db->order($sortfield,$sortorder); + +$nbtotalofrecords = 0; +$nbtotalofpages = 0; +if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) +{ + $result = $db->query($sql); + $nbtotalofrecords = $db->num_rows($result); + $nbtotalofpages = ceil($nbtotalofrecords/$limit); +} + +if (($id > 0 || ! empty($ref)) && GETPOST("page",'int') === '') +{ + // We open a list of transaction of a dedicated account and no page was set by defaut + // We force on last page. + $page = ($nbtotalofpages - 1); + $offset = $limit * $page; + if ($page < 0) $page = 0; +} + +if (! empty($search_ref)) $mode_balance_ok=false; +if (! empty($req_nb)) $mode_balance_ok=false; +if (! empty($type)) $mode_balance_ok=false; +if (! empty($debit)) $mode_balance_ok=false; +if (! empty($credit)) $mode_balance_ok=false; +if (! empty($thirdparty)) $mode_balance_ok=false; + +$sql.= $db->plimit($limit+1,$offset); + +dol_syslog('compta/bank/bankentries.php', LOG_DEBUG); +$resql = $db->query($sql); +if ($resql) +{ + $var=True; + $num = $db->num_rows($resql); + + $arrayofselected=is_array($toselect)?$toselect:array(); + + // List of mass actions available + $arrayofmassactions = array( + //'presend'=>$langs->trans("SendByMail"), + //'builddoc'=>$langs->trans("PDFMerge"), + ); + //if ($user->rights->bank->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete"); + if ($massaction == 'presend') $arrayofmassactions=array(); + $massactionbutton=$form->selectMassAction('', $arrayofmassactions); + + + // Confirmation delete + if ($action == 'delete') + { + $text=$langs->trans('ConfirmDeleteTransaction'); + print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id.'&rowid='.GETPOST("rowid"), $langs->trans('DeleteTransaction'), $text, 'confirm_delete', null, '', 1); + } + + + // Lines of title fields + print '
'."\n"; + if ($optioncss != '') print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + if (! empty($_REQUEST['bid'])) print ''; + + // Form to reconcile + if ($user->rights->banque->consolidate && $action == 'reconcile') + { +// print ''; +// print ''; +// print '
'; + print '
'; + print ''.$langs->trans("InputReceiptNumber").': '; + print ''; // The only default value is value we just entered + print '
'; + if ($options) { + print $langs->trans("EventualyAddCategory").': '; + print Form::selectarray('cat', $options, GETPOST('cat'), 1); + } + print '
'.$langs->trans("ThenCheckLinesAndConciliate").' '; + print ''; + print ' '.$langs->trans("or").' '; + print ''; + + // Show last bank statements + $nbmax=15; // We accept to show last 15 receipts (so we can have more than one year) + $liste=""; + $sql = "SELECT DISTINCT num_releve FROM ".MAIN_DB_PREFIX."bank"; + $sql.= " WHERE fk_account=".$id." AND num_releve IS NOT NULL"; + $sql.= $db->order("num_releve","DESC"); + $sql.= $db->plimit($nbmax+1); + print '

'; + print $langs->trans("LastAccountStatements").' : '; + $resqlr=$db->query($sql); + if ($resqlr) + { + $numr=$db->num_rows($resqlr); + $i=0; + $last_ok=0; + while (($i < $numr) && ($i < $nbmax)) + { + $objr = $db->fetch_object($resqlr); + if (! $last_ok) { + $last_releve = $objr->num_releve; + $last_ok=1; + } + $i++; + $liste=''.$objr->num_releve.'   '.$liste; + } + if ($numr >= $nbmax) $liste="...   ".$liste; + print $liste; + if ($numr <= 0) print ''.$langs->trans("None").''; + } + else + { + dol_print_error($db); + } + print '

'; +// print '
'; + } + + // Form to add a transaction with no invoice + if ($user->rights->banque->modifier && $action == 'addline') + { + print load_fiche_titre($langs->trans("AddBankRecordLong"),'',''); + + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print '
'.$langs->trans("Date").' '.$langs->trans("Type").''.$langs->trans("Numero").''.$langs->trans("Description").''.$langs->trans("Debit").''.$langs->trans("Credit").' 
'; + $form->select_date(empty($dateop)?-1:$dateop,'op',0,0,0,'transaction'); + print ''; + $form->select_types_paiements((GETPOST('operation')?GETPOST('operation'):($object->courant == Account::TYPE_CASH ? 'LIQ' : '')),'operation','1,2',2,1); + print ''; + print ''; + print ''; + if ($options) { + print '
'.$langs->trans("Rubrique").': '; + print Form::selectarray('cat1', $options, GETPOST('cat1'), 1); + } + print '
'; + print '
'; + print ''; + print '
'; + print '
'; + } + + + /// ajax adjust value date + print ' + + + '; + + $i = 0; + + // Title + $bankcateg=new BankCateg($db); + $morehtml='
'; + $morehtml.= ' "; // ' Page '; + $morehtml.=''; + $morehtml.='/'.$nbtotalofpages.' '; + $morehtml.='
'; + + $picto='title_bank'; + if ($id > 0 || ! empty($ref)) $picto=''; + if (GETPOST("bid")) + { + $result=$bankcateg->fetch(GETPOST("bid")); + print_barre_liste($langs->trans("BankTransactionForCategory",$bankcateg->label).' '.($socid?' '.$soc->name:''), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $picto, 0, $morehtml, '', $limit); + } + else + { + print_barre_liste($langs->trans("BankTransactions"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $picto, 0, $morehtml, '', $limit); + } + + // We can add page now to param + if ($page != '') $param.='&page='.urlencode($page); + + + $moreforfilter = ''; + + $moreforfilter.='
'; + $moreforfilter .= $langs->trans('DateOperationShort').' : '; + $moreforfilter .= '
'.$langs->trans('From') . ' '; + $moreforfilter .= $form->select_date($search_dt_start, 'search_start_dt', 0, 0, 1, "search_form", 1, 0, 1).'
'; + $moreforfilter .= ' - '; + $moreforfilter .= '
'.$langs->trans('to') . ' ' . $form->select_date($search_dt_end, 'search_end_dt', 0, 0, 1, "search_form", 1, 0, 1).'
'; + $moreforfilter .= '
'; + + $moreforfilter.='
'; + $moreforfilter .= $langs->trans('DateValueShort').' : '; + $moreforfilter .= '
'.$langs->trans('From') . ' '; + $moreforfilter .= $form->select_date($search_dv_start, 'search_start_dv', 0, 0, 1, "search_form", 1, 0, 1).'
'; + $moreforfilter .= ' - '; + $moreforfilter .= '
'.$langs->trans('to') . ' ' . $form->select_date($search_dv_end, 'search_end_dv', 0, 0, 1, "search_form", 1, 0, 1).'
'; + $moreforfilter .= '
'; + + $parameters=array(); + $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 ($moreforfilter) + { + print '
'; + print $moreforfilter; + print '
'."\n"; + } + + $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; + $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields + + print ''."\n"; + + // Fields title + print ''; + if (! empty($arrayfields['b.rowid']['checked'])) print_liste_field_titre($arrayfields['b.rowid']['label'],$_SERVER['PHP_SELF'],'b.rowid','',$param,'',$sortfield,$sortorder); + if (! empty($arrayfields['description']['checked'])) print_liste_field_titre($arrayfields['description']['label'],$_SERVER['PHP_SELF'],'','',$param,'',$sortfield,$sortorder); + if (! empty($arrayfields['b.dateo']['checked'])) print_liste_field_titre($arrayfields['b.dateo']['label'],$_SERVER['PHP_SELF'],'b.dateo','',$param,'align="center"',$sortfield,$sortorder); + if (! empty($arrayfields['b.datev']['checked'])) print_liste_field_titre($arrayfields['b.datev']['label'],$_SERVER['PHP_SELF'],'b.datev, b.dateo, b.rowid','',$param,'align="center"',$sortfield,$sortorder); + if (! empty($arrayfields['type']['checked'])) print_liste_field_titre($arrayfields['type']['label'],$_SERVER['PHP_SELF'],'','',$param,'align="center"',$sortfield,$sortorder); + if (! empty($arrayfields['b.num_chq']['checked'])) print_liste_field_titre($arrayfields['b.num_chq']['label'],$_SERVER['PHP_SELF'],'b.num_chq','',$param,'align="center"',$sortfield,$sortorder); + if (! empty($arrayfields['bu.label']['checked'])) print_liste_field_titre($arrayfields['bu.label']['label'],$_SERVER['PHP_SELF'],'bu.label','',$param,'',$sortfield,$sortorder); + if (! empty($arrayfields['ba.ref']['checked'])) print_liste_field_titre($arrayfields['ba.ref']['label'],$_SERVER['PHP_SELF'],'ba.ref','',$param,'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['b.debit']['checked'])) print_liste_field_titre($arrayfields['b.debit']['label'],$_SERVER['PHP_SELF'],'b.amount','',$param,'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['b.credit']['checked'])) print_liste_field_titre($arrayfields['b.credit']['label'],$_SERVER['PHP_SELF'],'b.amount','',$param,'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['balance']['checked'])) print_liste_field_titre($arrayfields['balance']['label'],$_SERVER['PHP_SELF'],'balance','',$param,'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['b.num_releve']['checked'])) print_liste_field_titre($arrayfields['b.num_releve']['label'],$_SERVER['PHP_SELF'],'b.num_releve','',$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; + print_liste_field_titre('', $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch '); + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch '); + print "\n"; + + print ''; + if (! empty($arrayfields['b.rowid']['checked'])) + { + print ''; + } + if (! empty($arrayfields['description']['checked'])) + { + print ''; + } + if (! empty($arrayfields['b.dateo']['checked'])) + { + print ''; + } + if (! empty($arrayfields['b.datev']['checked'])) + { + print ''; + } + if (! empty($arrayfields['type']['checked'])) + { + print ''; + } + if (! empty($arrayfields['b.num_chq']['checked'])) + { + // Numero + print ''; + } + if (! empty($arrayfields['bu.label']['checked'])) + { + print ''; + } + if (! empty($arrayfields['ba.ref']['checked'])) + { + print ''; + } + if (! empty($arrayfields['b.debit']['checked'])) + { + print ''; + } + if (! empty($arrayfields['b.credit']['checked'])) + { + print ''; + } + if (! empty($arrayfields['balance']['checked'])) + { + print ''; + } + if (! empty($arrayfields['b.num_releve']['checked'])) + { + // Numero statement + print ''; + } + print ''; + print ''; + print "\n"; + + $balance = 0; // For balance + $balancecalculated = false; + + // Loop on each record + $sign = 1; + + $totalarray=array(); + while ($i < min($num,$limit)) + { + $objp = $db->fetch_object($resql); + + // If we are in a situation where we need/can show balance, we calculate the start of balance + if (! $balancecalculated && ! empty($arrayfields['balance']['checked']) && $mode_balance_ok) + { + //Loop on each record + $sign = 1; + $i = 0; + $sqlforbalance='SELECT SUM(b.amount) as balance'; + $sqlforbalance.= " FROM "; + $sqlforbalance.= " ".MAIN_DB_PREFIX."bank_account as ba,"; + $sqlforbalance.= " ".MAIN_DB_PREFIX."bank as b"; + $sqlforbalance.= " WHERE b.fk_account = ba.rowid"; + $sqlforbalance.= " AND ba.entity IN (".getEntity('bank_account', 1).")"; + $sqlforbalance.= " AND b.fk_account = ".$account; + $sqlforbalance.= " AND b.datev < '" . $db->idate($db->jdate($objp->dv)) . "'"; + $resqlforbalance = $db->query($sqlforbalance); + //print $sqlforbalance; + if ($resqlforbalance) + { + $objforbalance = $db->fetch_object($resqlforbalance); + if ($objforbalance) + { + $balance = $objforbalance->balance; + } + } + else dol_print_error($db); + + $balancecalculated=true; + } + + $balance = price2num($balance + ($sign * $objp->amount),'MT'); + + if (empty($cachebankaccount[$objp->bankid])) + { + $bankaccounttmp = new Account($db); + $bankaccounttmp->fetch($objp->bankid); + $cachebankaccount[$objp->bankid]=$bankaccounttmp; + $bankaccount = $bankaccounttmp; + } + else + { + $bankaccount = $cachebankaccount[$objp->bankid]; + } + + $var=!$var; + + print ""; + + // Ref + if (! empty($arrayfields['b.rowid']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + + // Description + if (! empty($arrayfields['description']['checked'])) + { + print "'; + if (! $i) $totalarray['nbfield']++; + } + + // Date ope + if (! empty($arrayfields['b.dateo']['checked'])) + { + print '\n"; + if (! $i) $totalarray['nbfield']++; + } + + // Date value + if (! empty($arrayfields['b.datev']['checked'])) + { + print '\n"; + if (! $i) $totalarray['nbfield']++; + } + + // Payment type + if (! empty($arrayfields['type']['checked'])) + { + print '\n"; + if (! $i) $totalarray['nbfield']++; + } + + // Num cheque + if (! empty($arrayfields['b.num_chq']['checked'])) + { + print '\n"; + if (! $i) $totalarray['nbfield']++; + } + + // Third party + if (! empty($arrayfields['bu.label']['checked'])) + { + print "'; + if (! $i) $totalarray['nbfield']++; + } + + // Bank account + if (! empty($arrayfields['ba.ref']['checked'])) + { + print '\n"; + if (! $i) $totalarray['nbfield']++; + } + + // Debit + if (! empty($arrayfields['b.debit']['checked'])) + { + print '\n"; + if (! $i) $totalarray['nbfield']++; + if (! $i) $totalarray['totaldebfield']=$totalarray['nbfield']; + } + // Credit + if (! empty($arrayfields['b.credit']['checked'])) + { + print '\n"; + if (! $i) $totalarray['nbfield']++; + if (! $i) $totalarray['totalcredfield']=$totalarray['nbfield']; + } + + // Balance + if (! empty($arrayfields['balance']['checked'])) + { + if ($mode_balance_ok) + { + if ($balance >= 0) + { + print ''; + } + else + { + print ''; + } + } + else + { + print ''; + } + } + + if (! empty($arrayfields['b.num_releve']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + + // Action edit/delete + print ''; + if (! $i) $totalarray['nbfield']++; + + // Action column + print ''; + if (! $i) $totalarray['nbfield']++; + + print ""; + + $i++; + } + + // Show total line + if (isset($totalarray['totaldebfield']) || isset($totalarray['totalcredfield'])) + { + print ''; + $i=0; + while ($i < $totalarray['nbfield']) + { + $i++; + if ($i == 1) + { + if ($num < $limit) print ''; + else print ''; + } + elseif ($totalarray['totaldebfield'] == $i) print ''; + elseif ($totalarray['totalcredfield'] == $i) print ''; + else print ''; + } + print ''; + } + + print "
'; + print ''; + print ''; + //print ''; + print '  '; + $form->select_types_paiements(empty($type)?'':$type, 'type', '', 2, 0, 1, 0, 1, 'maxwidth100'); + print ''; + $form->select_comptes($account,'account',0,'',1, ($id > 0 || ! empty($ref)?' disabled="disabled"':'')); + print ''; + print ''; + print ''; + print ''; + print ''; + $htmltext=$langs->trans("BalanceVisibilityDependsOnSortAndFilters", $langs->transnoentitiesnoconv("DateValue")); + print $form->textwithpicto('', $htmltext, 1); + print ''; + print ''; + $searchpitco=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1); + print $searchpitco; + print '
'; + print "rowid.'">'.img_object($langs->trans("ShowPayment").': '.$objp->rowid, 'account', 'class="classfortooltip"').' '.$objp->rowid."   "; + print '"; + + //print "rowid."&account=".$objp->fk_account."\">"; + $reg=array(); + preg_match('/\((.+)\)/i',$objp->label,$reg); // Si texte entoure de parenthee on tente recherche de traduction + if ($reg[1] && $langs->trans($reg[1])!=$reg[1]) print $langs->trans($reg[1]); + else print dol_trunc($objp->label,40); + //print " "; + + // Add links after description + $links = $bankaccountstatic->get_url($objp->rowid); + $cachebankaccount=array(); + foreach($links as $key=>$val) + { + if ($links[$key]['type']=='payment') + { + $paymentstatic->id=$links[$key]['url_id']; + $paymentstatic->ref=$links[$key]['url_id']; + print ' '.$paymentstatic->getNomUrl(2); + } + elseif ($links[$key]['type']=='payment_supplier') + { + $paymentsupplierstatic->id=$links[$key]['url_id']; + $paymentsupplierstatic->ref=$links[$key]['url_id']; + print ' '.$paymentsupplierstatic->getNomUrl(2); + } + elseif ($links[$key]['type']=='payment_sc') + { + print ''; + print ' '.img_object($langs->trans('ShowPayment'),'payment').' '; + //print $langs->trans("SocialContributionPayment"); + print ''; + } + elseif ($links[$key]['type']=='payment_vat') + { + $paymentvatstatic->id=$links[$key]['url_id']; + $paymentvatstatic->ref=$links[$key]['url_id']; + print ' '.$paymentvatstatic->getNomUrl(2); + } + elseif ($links[$key]['type']=='payment_salary') + { + $paymentsalstatic->id=$links[$key]['url_id']; + $paymentsalstatic->ref=$links[$key]['url_id']; + print ' '.$paymentsalstatic->getNomUrl(2); + } + elseif ($links[$key]['type']=='payment_loan') + { + print ''; + print ' '.img_object($langs->trans('ShowPayment'),'payment').' '; + print ''; + } + elseif ($links[$key]['type']=='payment_donation') + { + print ''; + print ' '.img_object($langs->trans('ShowPayment'),'payment').' '; + print ''; + } + elseif ($links[$key]['type']=='payment_expensereport') + { + print ''; + print ' '.img_object($langs->trans('ShowPayment'),'payment').' '; + print ''; + } + elseif ($links[$key]['type']=='banktransfert') + { + // Do not show link to transfer since there is no transfer card (avoid confusion). Can already be accessed from transaction detail. + if ($objp->amount > 0) + { + $banklinestatic->fetch($links[$key]['url_id']); + $bankstatic->id=$banklinestatic->fk_account; + $bankstatic->label=$banklinestatic->bank_account_ref; + print ' ('.$langs->trans("TransferFrom").' '; + print $bankstatic->getNomUrl(1,'transactions'); + print ' '.$langs->trans("toward").' '; + $bankstatic->id=$objp->bankid; + $bankstatic->label=$objp->bankref; + print $bankstatic->getNomUrl(1,''); + print ')'; + } + else + { + $bankstatic->id=$objp->bankid; + $bankstatic->label=$objp->bankref; + print ' ('.$langs->trans("TransferFrom").' '; + print $bankstatic->getNomUrl(1,''); + print ' '.$langs->trans("toward").' '; + $banklinestatic->fetch($links[$key]['url_id']); + $bankstatic->id=$banklinestatic->fk_account; + $bankstatic->label=$banklinestatic->bank_account_ref; + print $bankstatic->getNomUrl(1,'transactions'); + print ')'; + } + //var_dump($links); + } + elseif ($links[$key]['type']=='company') + { + + } + elseif ($links[$key]['type']=='user') + { + + } + elseif ($links[$key]['type']=='member') + { + + } + elseif ($links[$key]['type']=='sc') + { + + } + else + { + // Show link with label $links[$key]['label'] + if (! empty($objp->label) && ! empty($links[$key]['label'])) print ' - '; + print ''; + if (preg_match('/^\((.*)\)$/i',$links[$key]['label'],$reg)) + { + // Label generique car entre parentheses. On l'affiche en le traduisant + if ($reg[1]=='paiement') $reg[1]='Payment'; + print ' '.$langs->trans($reg[1]); + } + else + { + print ' '.$links[$key]['label']; + } + print ''; + } + } + + print ''.dol_print_date($db->jdate($objp->do),"day")."'; + print ''.dol_print_date($db->jdate($objp->dv),"day").""; + print ' '; + print ''; + print ''; + print img_edit_remove() . " "; + print ''; + print img_edit_add() .""; + print ''; + print "'; + $labeltype=($langs->trans("PaymentTypeShort".$objp->fk_type)!="PaymentTypeShort".$objp->fk_type)?$langs->trans("PaymentTypeShort".$objp->fk_type):$langs->getLabelFromKey($db,$objp->fk_type,'c_paiement','code','libelle'); + if ($labeltype == 'SOLD') print ' '; //$langs->trans("InitialBankBalance"); + else print $labeltype; + print "'.($objp->num_chq?$objp->num_chq:"").""; + if ($objp->url_id) + { + $companystatic->id=$objp->url_id; + $companystatic->name=$objp->nom; + $companystatic->name_alias=$objp->name_alias; + $companystatic->client=$objp->client; + $companystatic->fournisseur=$objp->fournisseur; + $companystatic->code_client=$objp->code_client; + $companystatic->code_fournisseur=$objp->code_fournisseur; + $companystatic->code_compta=$objp->code_compta; + $companystatic->code_compta_fournisseur=$objp->code_compta_fournisseur; + print $companystatic->getNomUrl(1); + } + else + { + print ' '; + } + print ''; + print $bankaccount->getNomUrl(1); + print "'; + if ($objp->amount < 0) + { + print price($objp->amount * -1); + $totalarray['totaldeb'] += $objp->amount; + } + print "'; + if ($objp->amount > 0) + { + print price($objp->amount); + $totalarray['totalcred'] += $objp->amount; + } + print " '.price($balance).' '.price($balance).'-'; + // Transaction reconciliated or edit link + if ($bankaccount->canBeConciliated() > 0) + { + if ($objp->rappro) // If line not conciliated and account can be conciliated + { + print ''.$objp->num_releve.''; + } + else if ($action == 'reconcile') + { + print 'rowid])?' checked':'').'>'; + } + } + print ''; + // Transaction reconciliated or edit link + if ($objp->rappro && $bankaccount->canBeConciliated() > 0) // If line not conciliated and account can be conciliated + { + print ''; + print img_edit(); + print ''; + } + else + { + if ($user->rights->banque->modifier || $user->rights->banque->consolidate) + { + print ''; + print img_edit(); + print ''; + } + else + { + print ''; + print img_view(); + print ''; + } + if ($bankaccount->canBeConciliated() > 0 && empty($objp->rappro)) + { + if ($db->jdate($objp->dv) < ($now - $conf->bank->rappro->warning_delay)) + { + print ' '.img_warning($langs->trans("ReconciliationLate")); + } + } + print ' '; + if ($user->rights->banque->modifier) + { + print 'rowid.'&id='.$object->id.'&page='.$page.'">'; + print img_delete(); + print ''; + } + } + print ''; + 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 ''; + } + print '
'.$langs->trans("Total").''.$langs->trans("Totalforthispage").''.price(-1 * $totalarray['totaldeb']).''.price($totalarray['totalcred']).'
"; + print '
'; + $db->free($resql); +} +else +{ + dol_print_error($db); +} + +// If no data to display after a search +if ($_POST["action"] == "search" && ! $num) +{ + print '
'.$langs->trans("NoRecordFound").'
'; +} + +llxFooter(); + +$db->close(); diff --git a/htdocs/compta/bank/budget.php b/htdocs/compta/bank/budget.php index 666ad0085e1..cd6d2adb796 100644 --- a/htdocs/compta/bank/budget.php +++ b/htdocs/compta/bank/budget.php @@ -76,7 +76,7 @@ if ($result) $objp = $db->fetch_object($result); $var=!$var; print ""; - print "rowid\">$objp->label"; + print "rowid\">$objp->label"; print ''.$objp->nombre.''; print ''.price(abs($objp->somme)).""; print ''.price(abs(price2num($objp->somme / $objp->nombre,'MT'))).""; diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index e6043167b22..a608a71bf7d 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -45,6 +45,7 @@ $langs->load("companies"); $langs->load("compta"); $action=GETPOST("action"); +$cancel = GETPOST('cancel', 'alpha'); // Security check if (isset($_GET["id"]) || isset($_GET["ref"])) @@ -55,69 +56,77 @@ $fieldid = isset($_GET["ref"])?'ref':'rowid'; if ($user->societe_id) $socid=$user->societe_id; $result=restrictedArea($user,'banque',$id,'bank_account&bank_account','','',$fieldid); -$account = new Account($db); +$object = new Account($db); $extrafields = new ExtraFields($db); // fetch optionals attributes and labels -$extralabels=$extrafields->fetch_name_optionals_label($account->table_element); +$extralabels=$extrafields->fetch_name_optionals_label($object->table_element); + /* * Actions */ -if ($_POST["action"] == 'add') + +if ($cancel) $action=''; + +if ($action == 'add') { $error=0; + $db->begin(); + // Create account - $account = new Account($db); + $object = new Account($db); - $account->ref = dol_sanitizeFileName(trim($_POST["ref"])); - $account->label = trim($_POST["label"]); - $account->courant = $_POST["type"]; - $account->clos = $_POST["clos"]; - $account->rappro = (isset($_POST["norappro"]) && $_POST["norappro"])?0:1; - $account->url = $_POST["url"]; + $object->ref = dol_sanitizeFileName(trim($_POST["ref"])); + $object->label = trim($_POST["label"]); + $object->courant = $_POST["type"]; + $object->clos = $_POST["clos"]; + $object->rappro = (isset($_POST["norappro"]) && $_POST["norappro"])?0:1; + $object->url = $_POST["url"]; - $account->bank = trim($_POST["bank"]); - $account->code_banque = trim($_POST["code_banque"]); - $account->code_guichet = trim($_POST["code_guichet"]); - $account->number = trim($_POST["number"]); - $account->cle_rib = trim($_POST["cle_rib"]); - $account->bic = trim($_POST["bic"]); - $account->iban = trim($_POST["iban"]); - $account->domiciliation = trim($_POST["domiciliation"]); + $object->bank = trim($_POST["bank"]); + $object->code_banque = trim($_POST["code_banque"]); + $object->code_guichet = trim($_POST["code_guichet"]); + $object->number = trim($_POST["number"]); + $object->cle_rib = trim($_POST["cle_rib"]); + $object->bic = trim($_POST["bic"]); + $object->iban = trim($_POST["iban"]); + $object->domiciliation = trim($_POST["domiciliation"]); - $account->proprio = trim($_POST["proprio"]); - $account->owner_address = trim($_POST["owner_address"]); + $object->proprio = trim($_POST["proprio"]); + $object->owner_address = trim($_POST["owner_address"]); - if (GETPOST('account_number') <= 0) { $accountancy_code_number = ''; } else { $accountancy_code_number = GETPOST('account_number'); } - $account->account_number = $accountancy_code_number; - $account->accountancy_journal = trim($_POST["accountancy_journal"]); + $account_number = GETPOST('account_number','alpha'); + if ($account_number <= 0) { $object->account_number = ''; } else { $object->account_number = $account_number; } + $object->accountancy_journal = trim($_POST["accountancy_journal"]); - $account->solde = $_POST["solde"]; - $account->date_solde = dol_mktime(12,0,0,$_POST["remonth"],$_POST["reday"],$_POST["reyear"]); + $object->solde = $_POST["solde"]; + $object->date_solde = dol_mktime(12,0,0,$_POST["remonth"],$_POST["reday"],$_POST["reyear"]); - $account->currency_code = trim($_POST["account_currency_code"]); + $object->currency_code = trim($_POST["account_currency_code"]); - $account->state_id = $_POST["account_state_id"]; - $account->country_id = $_POST["account_country_id"]; + $object->state_id = $_POST["account_state_id"]; + $object->country_id = $_POST["account_country_id"]; - $account->min_allowed = GETPOST("account_min_allowed",'int'); - $account->min_desired = GETPOST("account_min_desired",'int'); - $account->comment = trim($_POST["account_comment"]); + $object->min_allowed = GETPOST("account_min_allowed",'int'); + $object->min_desired = GETPOST("account_min_desired",'int'); + $object->comment = trim($_POST["account_comment"]); - if ($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED && empty($account->account_number)) + $object->fk_user_author = $user->id; + + if ($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED && empty($object->account_number)) { setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("AccountancyCode")), null, 'error'); $action='create'; // Force chargement page en mode creation $error++; } - if (empty($account->ref)) + if (empty($object->ref)) { setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("Ref")), null, 'errors'); $action='create'; // Force chargement page en mode creation $error++; } - if (empty($account->label)) + if (empty($object->label)) { setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("LabelBankCashAccount")), null, 'errors'); $action='create'; // Force chargement page en mode creation @@ -125,79 +134,91 @@ if ($_POST["action"] == 'add') } // Fill array 'array_options' with data from add form - $ret = $extrafields->setOptionalsFromPost($extralabels,$account); + $ret = $extrafields->setOptionalsFromPost($extralabels,$object); if (! $error) { - $id = $account->create($user); + $id = $object->create($user); if ($id > 0) { // Category association $categories = GETPOST('categories'); - $account->setCategories($categories); + $object->setCategories($categories); $_GET["id"]=$id; // Force chargement page en mode visu + + $action=''; } else { - setEventMessages($account->error, $account->errors, 'errors'); + $error++; + setEventMessages($object->error, $object->errors, 'errors'); $action='create'; // Force chargement page en mode creation } } + + if (! $error) + { + $db->commit(); + } + else + { + $db->rollback(); + } } -if ($_POST["action"] == 'update' && ! $_POST["cancel"]) +if ($action == 'update') { $error=0; // Update account - $account = new Account($db); - $account->fetch($_POST["id"]); + $object = new Account($db); + $object->fetch($_POST["id"]); - $account->ref = dol_string_nospecial(trim($_POST["ref"])); - $account->label = trim($_POST["label"]); - $account->courant = $_POST["type"]; - $account->clos = $_POST["clos"]; - $account->rappro = (isset($_POST["norappro"]) && $_POST["norappro"])?0:1; - $account->url = trim($_POST["url"]); + $object->ref = dol_string_nospecial(trim($_POST["ref"])); + $object->label = trim($_POST["label"]); + $object->courant = $_POST["type"]; + $object->clos = $_POST["clos"]; + $object->rappro = (isset($_POST["norappro"]) && $_POST["norappro"])?0:1; + $object->url = trim($_POST["url"]); - $account->bank = trim($_POST["bank"]); - $account->code_banque = trim($_POST["code_banque"]); - $account->code_guichet = trim($_POST["code_guichet"]); - $account->number = trim($_POST["number"]); - $account->cle_rib = trim($_POST["cle_rib"]); - $account->bic = trim($_POST["bic"]); - $account->iban = trim($_POST["iban"]); - $account->domiciliation = trim($_POST["domiciliation"]); + $object->bank = trim($_POST["bank"]); + $object->code_banque = trim($_POST["code_banque"]); + $object->code_guichet = trim($_POST["code_guichet"]); + $object->number = trim($_POST["number"]); + $object->cle_rib = trim($_POST["cle_rib"]); + $object->bic = trim($_POST["bic"]); + $object->iban = trim($_POST["iban"]); + $object->domiciliation = trim($_POST["domiciliation"]); - $account->proprio = trim($_POST["proprio"]); - $account->owner_address = trim($_POST["owner_address"]); + $object->proprio = trim($_POST["proprio"]); + $object->owner_address = trim($_POST["owner_address"]); - if (GETPOST('account_number') <= 0) { $accountancy_code_number = ''; } else { $accountancy_code_number = GETPOST('account_number'); } - $account->account_number = $accountancy_code_number; - $account->accountancy_journal = trim($_POST["accountancy_journal"]); + $account_number = GETPOST('account_number', 'int'); + if ($account_number <= 0) { $object->account_number = ''; } else { $object->account_number = $account_number; } + $object->accountancy_journal = trim($_POST["accountancy_journal"]); - $account->currency_code = trim($_POST["account_currency_code"]); + $object->currency_code = trim($_POST["account_currency_code"]); - $account->state_id = $_POST["account_state_id"]; - $account->country_id = $_POST["account_country_id"]; + $object->state_id = $_POST["account_state_id"]; + $object->country_id = $_POST["account_country_id"]; - $account->min_allowed = GETPOST("account_min_allowed",'int'); - $account->min_desired = GETPOST("account_min_desired",'int'); - $account->comment = trim($_POST["account_comment"]); + $object->min_allowed = GETPOST("account_min_allowed",'int'); + $object->min_desired = GETPOST("account_min_desired",'int'); + $object->comment = trim($_POST["account_comment"]); - if ($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED && empty($account->account_number)) + if ($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED && empty($object->account_number)) { setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("AccountancyCode")), null, 'error'); $action='edit'; // Force chargement page en mode creation $error++; } - if (empty($account->ref)) + if (empty($object->ref)) { setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("Ref")), null, 'errors'); $action='edit'; // Force chargement page en mode creation $error++; } - if (empty($account->label)) + if (empty($object->label)) { setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("LabelBankCashAccount")), null, 'errors'); $action='edit'; // Force chargement page en mode creation @@ -205,22 +226,22 @@ if ($_POST["action"] == 'update' && ! $_POST["cancel"]) } // Fill array 'array_options' with data from add form - $ret = $extrafields->setOptionalsFromPost($extralabels,$account); + $ret = $extrafields->setOptionalsFromPost($extralabels,$object); if (! $error) { - $result = $account->update($user); + $result = $object->update($user); if ($result >= 0) { // Category association $categories = GETPOST('categories'); - $account->setCategories($categories); + $object->setCategories($categories); $_GET["id"]=$_POST["id"]; // Force chargement page en mode visu } else { - setEventMessages($account->error, $account->errors, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); $action='edit'; // Force chargement page edition } } @@ -229,9 +250,9 @@ if ($_POST["action"] == 'update' && ! $_POST["cancel"]) if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == "yes" && $user->rights->banque->configurer) { // Delete - $account = new Account($db); - $account->fetch($_GET["id"]); - $account->delete(); + $object = new Account($db); + $object->fetch($_GET["id"]); + $object->delete(); header("Location: ".DOL_URL_ROOT."/compta/bank/index.php"); exit; @@ -249,14 +270,16 @@ 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 if ($action == 'create') { - $account=new Account($db); + $object=new Account($db); print load_fiche_titre($langs->trans("NewFinancialAccount"), '', 'title_bank.png'); @@ -287,7 +310,7 @@ if ($action == 'create') // Ref print ''.$langs->trans("Ref").''; - print 'ref).'" maxlength="12">'; + print 'ref).'" maxlength="12">'; // Label print ''.$langs->trans("LabelBankCashAccount").''; @@ -302,7 +325,7 @@ if ($action == 'create') // Currency print ''.$langs->trans("Currency").''; print ''; - $selectedcode=$account->currency_code; + $selectedcode=$object->currency_code; if (! $selectedcode) $selectedcode=$conf->currency; print $form->selectCurrency((isset($_POST["account_currency_code"])?$_POST["account_currency_code"]:$selectedcode), 'account_currency_code'); //print $langs->trans("Currency".$conf->currency); @@ -312,17 +335,17 @@ if ($action == 'create') // Status print ''.$langs->trans("Status").''; print ''; - print $form->selectarray("clos", $account->status,(isset($_POST["clos"])?$_POST["clos"]:$account->clos)); + print $form->selectarray("clos", $object->status,(isset($_POST["clos"])?$_POST["clos"]:$object->clos)); print ''; // Country $selectedcode=''; if (isset($_POST["account_country_id"])) { - $selectedcode=$_POST["account_country_id"]?$_POST["account_country_id"]:$account->country_code; + $selectedcode=$_POST["account_country_id"]?$_POST["account_country_id"]:$object->country_code; } else if (empty($selectedcode)) $selectedcode=$mysoc->country_code; - $account->country_code = getCountry($selectedcode, 2); // Force country code on account to have following field on bank fields matching country rules + $object->country_code = getCountry($selectedcode, 2); // Force country code on account to have following field on bank fields matching country rules print ''.$langs->trans("BankAccountCountry").''; print ''; @@ -352,7 +375,7 @@ if ($action == 'create') print ''.$langs->trans("Categories").''; $cate_arbo = $form->select_all_categories(Categorie::TYPE_ACCOUNT, '', 'parent', 64, 0, 1); $c = new Categorie($db); - $cats = $c->containing($account->id,Categorie::TYPE_ACCOUNT); + $cats = $c->containing($object->id,Categorie::TYPE_ACCOUNT); foreach($cats as $cat) { $arrayselected[] = $cat->id; } @@ -365,16 +388,16 @@ if ($action == 'create') print ''; // Editor wysiwyg require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor=new DolEditor('account_comment',(GETPOST("account_comment")?GETPOST("account_comment"):$account->comment),'',90,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_SOCIETE,4,70); + $doleditor=new DolEditor('account_comment',(GETPOST("account_comment")?GETPOST("account_comment"):$object->comment),'',90,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_SOCIETE,4,70); $doleditor->Create(); print ''; // Other attributes $parameters=array('colspan' => 3); - $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$account,$action); // Note that $action and $object may have been modified by hook + $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 $account->showOptionals($extrafields,'edit',$parameters); + print $object->showOptionals($extrafields,'edit',$parameters); } print ''; @@ -385,7 +408,7 @@ if ($action == 'create') // Sold print ''.$langs->trans("InitialBankBalance").''; - print 'solde)).'">'; + print 'solde)).'">'; print ''.$langs->trans("Date").''; print ''; @@ -393,10 +416,10 @@ if ($action == 'create') print ''; print ''.$langs->trans("BalanceMinimalAllowed").''; - print 'min_allowed).'">'; + print 'min_allowed).'">'; print ''.$langs->trans("BalanceMinimalDesired").''; - print 'min_desired).'">'; + print 'min_desired).'">'; print ''; print '
'; @@ -407,56 +430,56 @@ if ($action == 'create') // If bank account print ''.$langs->trans("BankName").''; - print ''; + print ''; print ''; // Show fields of bank account - foreach ($account->getFieldsToShow() as $val) { + foreach ($object->getFieldsToShow() as $val) { if ($val == 'BankCode') { $name = 'code_banque'; $size = 8; - $content = $account->code_banque; + $content = $object->code_banque; } elseif ($val == 'DeskCode') { $name = 'code_guichet'; $size = 8; - $content = $account->code_guichet; + $content = $object->code_guichet; } elseif ($val == 'BankAccountNumber') { $name = 'number'; $size = 18; - $content = $account->number; + $content = $object->number; } elseif ($val == 'BankAccountNumberKey') { $name = 'cle_rib'; $size = 3; - $content = $account->cle_rib; + $content = $object->cle_rib; } print ''.$langs->trans($val).''; - print ''; + print ''; print ''; } - $ibankey = FormBank::getIBANLabel($account); + $ibankey = FormBank::getIBANLabel($object); $bickey="BICNumber"; - if ($account->getCountryCode() == 'IN') $bickey="SWIFT"; + if ($object->getCountryCode() == 'IN') $bickey="SWIFT"; // IBAN print ''.$langs->trans($ibankey).''; - print ''; + print ''; print ''.$langs->trans($bickey).''; - print ''; + print ''; print ''.$langs->trans("BankAccountDomiciliation").''; print ""; print ''.$langs->trans("BankAccountOwner").''; - print ''; + print ''; print ''; print ''.$langs->trans("BankAccountOwnerAddress").''; print ""; print ''; @@ -471,13 +494,13 @@ if ($action == 'create') { print ''.$langs->trans("AccountancyCode").''; print ''; - print $formaccountancy->select_account($account->account_number, 'account_number', 1, '', 1, 1); + print $formaccountancy->select_account($object->account_number, 'account_number', 1, '', 1, 1); print ''; } else { print ''.$langs->trans("AccountancyCode").''; - print 'account_number).'">'; + print 'account_number).'">'; } } else @@ -486,13 +509,13 @@ if ($action == 'create') { print ''.$langs->trans("AccountancyCode").''; print ''; - print $formaccountancy->select_account($account->account_number, 'account_number', 1, '', 1, 1); + print $formaccountancy->select_account($object->account_number, 'account_number', 1, '', 1, 1); print ''; } else { print ''.$langs->trans("AccountancyCode").''; - print 'account_number).'">'; + print 'account_number).'">'; } } @@ -500,14 +523,18 @@ if ($action == 'create') if (! empty($conf->accounting->enabled)) { print ''.$langs->trans("AccountancyJournal").''; - print 'accountancy_journal).'">'; + print 'accountancy_journal).'">'; } print ''; dol_fiche_end(); - print '
'; + print '
'; + print ''; + print '     '; + print ''; + print '
'; print ''; } @@ -520,15 +547,15 @@ else { if (($_GET["id"] || $_GET["ref"]) && $action != 'edit') { - $account = new Account($db); + $object = new Account($db); if ($_GET["id"]) { - $account->fetch($_GET["id"]); + $object->fetch($_GET["id"]); } if ($_GET["ref"]) { - $account->fetch(0,$_GET["ref"]); - $_GET["id"]=$account->id; + $object->fetch(0,$_GET["ref"]); + $_GET["id"]=$object->id; } /* @@ -536,123 +563,158 @@ else */ // Onglets - $head=bank_prepare_head($account); + $head=bank_prepare_head($object); dol_fiche_head($head, 'bankname', $langs->trans("FinancialAccount"),0,'account'); - /* - * Confirmation to delete - */ + $formconfirm = ''; + + // Confirmation to delete if ($action == 'delete') { - print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$account->id,$langs->trans("DeleteAccount"),$langs->trans("ConfirmDeleteAccount"),"confirm_delete"); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id,$langs->trans("DeleteAccount"),$langs->trans("ConfirmDeleteAccount"),"confirm_delete"); } + // Print form confirm + print $formconfirm; + + $linkback = ''.$langs->trans("BackToList").''; + + $morehtmlref=''; + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + + + print '
'; + print '
'; + print '
'; + print ''; - $linkback = ''.$langs->trans("BackToList").''; // Ref + /* print ''; print ''; + print $form->showrefnav($object, 'ref', $linkback, 1, 'ref'); + print '';*/ // Label - print ''; - print ''; + /*print ''; + print '';*/ // Type print ''; - print ''; + print ''; // Currency print ''; - print ''; // Status - print ''; - print ''; + /*print ''; + print '';*/ // Country + /* print ''; // State print ''; + if ($object->state_id > 0) print getState($object->state_id); + print '';*/ // Conciliate print ''; - print ''; print ''; - print ''; + print ''; print ''; - print ''; + print ''; - print '\n"; + // Accountancy code + print ''; + print ''; + } else { + print $object->account_number; + } + print ''; + + // Accountancy journal + if (! empty($conf->accounting->enabled)) + { + print ''; + print ''; + } + + // Other attributes + $cols = 2; + include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; + + print '
'.$langs->trans("Ref").''; - print $form->showrefnav($account, 'ref', $linkback, 1, 'ref'); - print '
'.$langs->trans("Label").''.$account->label.'
'.$langs->trans("Label").''.$object->label.'
'.$langs->trans("AccountType").''.$account->type_lib[$account->type].'
'.$object->type_lib[$object->type].'
'.$langs->trans("Currency").''; - $selectedcode=$account->currency_code; + print ''; + $selectedcode=$object->currency_code; if (! $selectedcode) $selectedcode=$conf->currency; print $langs->trans("Currency".$selectedcode); print '
'.$langs->trans("Status").''.$account->getLibStatut(4).'
'.$langs->trans("Status").''.$object->getLibStatut(4).'
'.$langs->trans("BankAccountCountry").''; - if ($account->country_id > 0) + if ($object->country_id > 0) { - $img=picto_from_langcode($account->country_code); + $img=picto_from_langcode($object->country_code); print $img?$img.' ':''; - print getCountry($account->getCountryCode(),0,$db); + print getCountry($object->getCountryCode(),0,$db); } print '
'.$langs->trans('State').''; - if ($account->state_id > 0) print getState($account->state_id); - print '
'.$langs->trans("Conciliable").''; - $conciliate=$account->canBeConciliated(); + print ''; + $conciliate=$object->canBeConciliated(); if ($conciliate == -2) print $langs->trans("No").' ('.$langs->trans("CashAccount").')'; else if ($conciliate == -3) print $langs->trans("No").' ('.$langs->trans("Closed").')'; - else print ($account->rappro==1 ? $langs->trans("Yes") : ($langs->trans("No").' ('.$langs->trans("ConciliationDisabled").')')); + else print ($object->rappro==1 ? $langs->trans("Yes") : ($langs->trans("No").' ('.$langs->trans("ConciliationDisabled").')')); print '
'.$langs->trans("BalanceMinimalAllowed").''.$account->min_allowed.'
'.$object->min_allowed.'
'.$langs->trans("BalanceMinimalDesired").''.$account->min_desired.'
'.$object->min_desired.'
'.$langs->trans("Web").''; - if ($account->url) print ''; - print $account->url; - if ($account->url) print ''; - print "
'.$langs->trans("AccountancyCode").''; + if (! empty($conf->accounting->enabled)) { + print length_accountg($object->account_number).'
'.$langs->trans("AccountancyJournal").''.$object->accountancy_journal.'
'; + + print '
'; + print '
'; + print '
'; + print '
'; + + + print ''; + // Categories - if($conf->categorie->enabled) { - print '"; } print ''; - print ''; - - // Other attributes - $parameters=array('colspan' => 3); - $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$account,$action); // Note that $action and $object may have been modified by hook - if (empty($reshook) && ! empty($extrafields->attribute_label)) - { - print $account->showOptionals($extrafields); - } + print ''; print '
'.$langs->trans("Categories").''; - print $form->showCategories($account->id,'account',1); + if ($conf->categorie->enabled) { + print '
'.$langs->trans("Categories").''; + print $form->showCategories($object->id,'account',1); print "
'.$langs->trans("Comment").''.dol_htmlentitiesbr($account->comment).'
'.dol_htmlentitiesbr($object->comment).'
'; - - print '
'; - - if ($account->type == Account::TYPE_SAVINGS || $account->type == Account::TYPE_CURRENT) + + + if ($object->type == Account::TYPE_SAVINGS || $object->type == Account::TYPE_CURRENT) { - print ''; + print '
'; + + print '
'; + + print '
'; - print ''; - print ''; + print ''; + print ''; // Show fields of bank account - foreach ($account->getFieldsToShow() as $val) { + foreach ($object->getFieldsToShow() as $val) { if ($val == 'BankCode') { - $content = $account->code_banque; + $content = $object->code_banque; } elseif ($val == 'DeskCode') { - $content = $account->code_guichet; + $content = $object->code_guichet; } elseif ($val == 'BankAccountNumber') { - $content = $account->number; + $content = $object->number; } elseif ($val == 'BankAccountNumberKey') { - $content = $account->cle_rib; + $content = $object->cle_rib; } print ''; @@ -660,14 +722,14 @@ else print ''; } - $ibankey = FormBank::getIBANLabel($account); + $ibankey = FormBank::getIBANLabel($object); $bickey="BICNumber"; - if ($account->getCountryCode() == 'IN') $bickey="SWIFT"; + if ($object->getCountryCode() == 'IN') $bickey="SWIFT"; print ''; - print ''; print ''; - print ''; - print '\n"; - print '\n"; - print '\n"; print '
'.$langs->trans("BankName").''.$account->bank.'
'.$langs->trans("BankName").''.$object->bank.'
'.$langs->trans($val).'
'.$langs->trans($ibankey).''.$account->iban.' '; - if (! empty($account->iban)) { - if (! checkIbanForAccount($account)) { + print ''.$object->iban.' '; + if (! empty($object->iban)) { + if (! checkIbanForAccount($object)) { print img_picto($langs->trans("IbanNotValid"),'warning'); } else { print img_picto($langs->trans("IbanValid"),'info'); @@ -676,9 +738,9 @@ else print '
'.$langs->trans($bickey).''.$account->bic.' '; - if (! empty($account->bic)) { - if (! checkSwiftForAccount($account)) { + print ''.$object->bic.' '; + if (! empty($object->bic)) { + if (! checkSwiftForAccount($object)) { print img_picto($langs->trans("SwiftNotValid"),'warning'); } else { print img_picto($langs->trans("SwiftValid"),'info'); @@ -686,44 +748,28 @@ else } print '
'.$langs->trans("BankAccountDomiciliation").''; - print nl2br($account->domiciliation); + print '
'.$langs->trans("BankAccountDomiciliation").''; + print nl2br($object->domiciliation); print "
'.$langs->trans("BankAccountOwner").''; - print $account->proprio; + print '
'.$langs->trans("BankAccountOwner").''; + print $object->proprio; print "
'.$langs->trans("BankAccountOwnerAddress").''; - print nl2br($account->owner_address); + print '
'.$langs->trans("BankAccountOwnerAddress").''; + print nl2br($object->owner_address); print "
'; - print '
'; } - print ''; - // Accountancy code - print ''; - print ''; - } else { - print $account->account_number; - } - print ''; - - // Accountancy journal - if (! empty($conf->accounting->enabled)) - { - print ''; - print ''; - } - - print '
'.$langs->trans("AccountancyCode").''; - if (! empty($conf->accounting->enabled)) { - print length_accountg($account->account_number).'
'.$langs->trans("AccountancyJournal").''.$account->accountancy_journal.'
'; - + print '
'; + print '
'; print '
'; + print '
'; + + dol_fiche_end(); /* * Barre d'actions @@ -732,13 +778,13 @@ else if ($user->rights->banque->configurer) { - print 'id.'">'.$langs->trans("Modify").''; + print 'id.'">'.$langs->trans("Modify").''; } - $canbedeleted=$account->can_be_deleted(); // Renvoi vrai si compte sans mouvements + $canbedeleted=$object->can_be_deleted(); // Renvoi vrai si compte sans mouvements if ($user->rights->banque->configurer && $canbedeleted) { - print 'id.'">'.$langs->trans("Delete").''; + print 'id.'">'.$langs->trans("Delete").''; } print '
'; @@ -753,8 +799,8 @@ else if (GETPOST('id','int') && $action == 'edit' && $user->rights->banque->configurer) { - $account = new Account($db); - $account->fetch(GETPOST('id','int')); + $object = new Account($db); + $object->fetch(GETPOST('id','int')); print load_fiche_titre($langs->trans("EditFinancialAccount"), '', 'title_bank.png'); @@ -777,35 +823,37 @@ else print ''."\n"; } - print '
'; + print ''; print ''; print ''; print ''."\n\n"; dol_fiche_head(''); + print '
'; + print ''; // Ref print ''; - print ''; + print ''; // Label print ''; - print ''; + print ''; // Type print ''; - print ''; // Currency print ''; - print ''; - print ''; // Country - $account->country_id=$account->country_id?$account->country_id:$mysoc->country_id; - $selectedcode=$account->country_code; + $object->country_id=$object->country_id?$object->country_id:$mysoc->country_id; + $selectedcode=$object->country_code; if (isset($_POST["account_country_id"])) $selectedcode=$_POST["account_country_id"]; else if (empty($selectedcode)) $selectedcode=$mysoc->country_code; - $account->country_code = getCountry($selectedcode, 2); // Force country code on account to have following field on bank fields matching country rules + $object->country_code = getCountry($selectedcode, 2); // Force country code on account to have following field on bank fields matching country rules print ''; - print ''; // State - print ''; - print ''; - print ''; + print ''; print ''; - print ''; + print ''; // Web print ''; - print ''; // Tags-Categories if ($conf->categorie->enabled) { - print ''; - print ''; // Other attributes $parameters=array('colspan' => 3); - $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$account,$action); // Note that $action and $object may have been modified by hook + $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 $account->showOptionals($extrafields,'edit'); + print $object->showOptionals($extrafields,'edit'); } print '
'.$langs->trans("Ref").'ref).'">
ref).'">
'.$langs->trans("Label").'label).'">
label).'">
'.$langs->trans("AccountType").''; - $formbank->selectTypeOfBankAccount((isset($_POST["type"])?$_POST["type"]:$account->type),"type"); + print ''; + $formbank->selectTypeOfBankAccount((isset($_POST["type"])?$_POST["type"]:$object->type),"type"); print '
'.$langs->trans("Currency"); - print ''; + print ''; print ''; - $selectedcode=$account->currency_code; + print ''; + $selectedcode=$object->currency_code; if (! $selectedcode) $selectedcode=$conf->currency; print $form->selectCurrency((isset($_POST["account_currency_code"])?$_POST["account_currency_code"]:$selectedcode), 'account_currency_code'); //print $langs->trans("Currency".$conf->currency); @@ -814,28 +862,28 @@ else // Status print '
'.$langs->trans("Status").''; - print $form->selectarray("clos", $account->status,(isset($_POST["clos"])?$_POST["clos"]:$account->clos)); + print ''; + print $form->selectarray("clos", $object->status,(isset($_POST["clos"])?$_POST["clos"]:$object->clos)); print '
'.$langs->trans("Country").''; + print ''; print $form->select_country($selectedcode,'account_country_id'); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); print '
'.$langs->trans('State').''; + print '
'.$langs->trans('State').''; if ($selectedcode) { - print $formcompany->select_state(isset($_POST["account_state_id"])?$_POST["account_state_id"]:$account->state_id,$selectedcode,'account_state_id'); + print $formcompany->select_state(isset($_POST["account_state_id"])?$_POST["account_state_id"]:$object->state_id,$selectedcode,'account_state_id'); } else { @@ -845,8 +893,8 @@ else // Conciliable print '
'.$langs->trans("Conciliable").''; - $conciliate=$account->canBeConciliated(); + print ''; + $conciliate=$object->canBeConciliated(); if ($conciliate == -2) print $langs->trans("No").' ('.$langs->trans("CashAccount").')'; else if ($conciliate == -3) print $langs->trans("No").' ('.$langs->trans("Closed").')'; else print ' 0)?'':' checked="checked"').'"> '.$langs->trans("DisableConciliation"); @@ -854,20 +902,20 @@ else // Balance print '
'.$langs->trans("BalanceMinimalAllowed").'min_allowed).'">
min_allowed).'">
'.$langs->trans("BalanceMinimalDesired").'min_desired).'">
min_desired).'">
'.$langs->trans("Web").'url).'">'; + print 'url).'">'; print '
'.$langs->trans("Categories").''; + print '
'.$langs->trans("Categories").''; $cate_arbo = $form->select_all_categories(Categorie::TYPE_ACCOUNT, '', 'parent', 64, 0, 1); $c = new Categorie($db); $cats = $c->containing($object->id,Categorie::TYPE_ACCOUNT); @@ -880,50 +928,85 @@ else // Comment print '
'.$langs->trans("Comment").''; + print ''; // Editor wysiwyg require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor=new DolEditor('account_comment',(GETPOST("account_comment")?GETPOST("account_comment"):$account->comment),'',90,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_SOCIETE,4,70); + $doleditor=new DolEditor('account_comment',(GETPOST("account_comment")?GETPOST("account_comment"):$object->comment),'',90,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_SOCIETE,4,70); $doleditor->Create(); print '
'; print '
'; + + print '
'; + + print ''; + + // Accountancy code + $tdextra = ' class="titlefieldcreate"'; + + if (!empty($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED)) { + $tdextra = ' class="fieldrequired titlefieldcreate"'; + } + + print ''.$langs->trans("AccountancyCode").''; + print ''; + + // Accountancy journal + if (! empty($conf->accounting->enabled)) + { + print ''; + print ''; + } + + print '
'; + if (!empty($conf->accounting->enabled)) { + print $formaccountancy->select_account($object->account_number, 'account_number', 1, '', 1, 1); + } else { + print 'account_number).'">'; + } + print '
'.$langs->trans("AccountancyJournal").'accountancy_journal).'">
'; + + if ($_POST["type"] == Account::TYPE_SAVINGS || $_POST["type"] == Account::TYPE_CURRENT) { + print '
'; + + print '
'; + print ''; // If bank account - print ''; - print ''; + print ''; + print ''; print ''; // Show fields of bank account - foreach ($account->getFieldsToShow() as $val) { + foreach ($object->getFieldsToShow() as $val) { if ($val == 'BankCode') { $name = 'code_banque'; $size = 8; - $content = $account->code_banque; + $content = $object->code_banque; } elseif ($val == 'DeskCode') { $name = 'code_guichet'; $size = 8; - $content = $account->code_guichet; + $content = $object->code_guichet; } elseif ($val == 'BankAccountNumber') { $name = 'number'; $size = 18; - $content = $account->number; + $content = $object->number; } elseif ($val == 'BankAccountNumberKey') { $name = 'cle_rib'; $size = 3; - $content = $account->cle_rib; + $content = $object->cle_rib; } print ''; @@ -931,62 +1014,34 @@ else print ''; } - $ibankey = FormBank::getIBANLabel($account); + $ibankey = FormBank::getIBANLabel($object); $bickey="BICNumber"; - if ($account->getCountryCode() == 'IN') $bickey="SWIFT"; + if ($object->getCountryCode() == 'IN') $bickey="SWIFT"; // IBAN print ''; - print ''; + print ''; print ''; - print ''; + print ''; - print '"; print ''; - print ''; + print ''; + print ''; - print '"; print '
'.$langs->trans("BankName").'
'.$langs->trans("BankName").'
'.$langs->trans($val).'
'.$langs->trans($ibankey).'
'.$langs->trans($bickey).'
'.$langs->trans("BankAccountDomiciliation").''; + print '
'.$langs->trans("BankAccountDomiciliation").''; print "
'.$langs->trans("BankAccountOwner").''; - print '
'.$langs->trans("BankAccountOwnerAddress").''; + print '
'.$langs->trans("BankAccountOwnerAddress").''; print "
'; - print '
'; } - print ''; - - // Accountancy code - $tdextra = ' class="titlefieldcreate"'; - - if (!empty($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED)) { - $tdextra = ' class="fieldrequired titlefieldcreate"'; - } - - print ''.$langs->trans("AccountancyCode").''; - print ''; - - // Accountancy journal - if (! empty($conf->accounting->enabled)) - { - print ''; - print ''; - } - - print '
'; - if (!empty($conf->accounting->enabled)) { - print $formaccountancy->select_account($account->account_number, 'account_number', 1, '', 1, 1); - } else { - print 'account_number).'">'; - } - print '
'.$langs->trans("AccountancyJournal").'accountancy_journal).'">
'; - dol_fiche_end(); print '
'; diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index f072a066ec0..f786158ccbe 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -38,7 +38,8 @@ class Account extends CommonObject { public $element = 'bank_account'; public $table_element = 'bank_account'; - + public $picto = 'account'; + /** * @var int Use id instead of rowid * @deprecated @@ -258,6 +259,10 @@ class Account extends CommonObject $string .= $this->code_guichet.' '; } elseif ($val == 'BankAccountNumberKey') { $string .= $this->cle_rib.' '; + }elseif ($val == 'BIC') { + $string .= $this->bic.' '; + }elseif ($val == 'IBAN') { + $string .= $this->iban.' '; } } @@ -496,9 +501,10 @@ class Account extends CommonObject * Create bank account into database * * @param User $user Object user making creation + * @param int $notrigger 1=Disable triggers * @return int < 0 if KO, > 0 if OK */ - function create(User $user = null) + function create(User $user = null, $notrigger=0) { global $langs,$conf, $hookmanager; @@ -533,6 +539,8 @@ class Account extends CommonObject $now=dol_now(); + $this->db->begin(); + $sql = "INSERT INTO ".MAIN_DB_PREFIX."bank_account ("; $sql.= "datec"; $sql.= ", ref"; @@ -589,7 +597,7 @@ class Account extends CommonObject { $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."bank_account"); - $result=$this->update($user); + $result=$this->update($user, 1); if ($result > 0) { $accline = new AccountLine($this->db); @@ -602,52 +610,68 @@ class Account extends CommonObject $accline->fk_type = 'SOLD'; if ($accline->insert() < 0) { - return -3; + $error++; } - // Actions on extra fields (by external module or standard code) - $hookmanager->initHooks(array('bankdao')); - $parameters=array('id'=>$this->id); - $reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks - if (empty($reshook)) + if (! $error) + { + $result=$this->insertExtraFields(); + if ($result < 0) $error++; + } + + if (! $error && ! $notrigger) { - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used - { - $result=$this->insertExtraFields(); - if ($result < 0) - { - return -4; - } - } - } - else if ($reshook < 0) return -5; + // Call trigger + $result=$this->call_trigger('BANKACCOUNT_CREATE',$user); + if ($result < 0) $error++; + // End call triggers + } + } + else + { + $error++; } - return $this->id; } else { if ($this->db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $this->error=$langs->trans("ErrorBankLabelAlreadyExists"); - return -1; + $error++; } else { $this->error=$this->db->error()." sql=".$sql; - return -2; + $error++; } } + + if (! $error) + { + $this->db->commit(); + return $this->id; + } + else + { + $this->db->rollback(); + return -1*$error; + } } /** * Update bank account card * * @param User $user Object user making action + * @param int $notrigger 1=Disable triggers * @return int <0 si ko, >0 si ok */ - function update(User $user = null) + function update(User $user = null, $notrigger = 0) { global $langs,$conf, $hookmanager; + $error=0; + + $this->db->begin(); + // Clean parameters $this->state_id = ($this->state_id?$this->state_id:$this->state_id); $this->country_id = ($this->country_id?$this->country_id:$this->country_id); @@ -706,33 +730,41 @@ class Account extends CommonObject $result = $this->db->query($sql); if ($result) { - // Actions on extra fields (by external module or standard code) - $hookmanager->initHooks(array('bankdao')); - $parameters=array('id'=>$this->id); - $reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks - if (empty($reshook)) - { - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used - { - $result=$this->insertExtraFields(); - if ($result < 0) - { - return -1; - } - } - } - else if ($reshook < 0) return -1; - - - return 1; + if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + { + if (! $error) + { + $result=$this->insertExtraFields(); + if ($result < 0) $error++; + } + } + + if (! $error && ! $notrigger) + { + // Call trigger + $result=$this->call_trigger('BANKACCOUNT_UPDATE',$user); + if ($result < 0) $error++; + // End call triggers + } } else { + $error++; $this->error=$this->db->lasterror(); dol_print_error($this->db); - return -1; } + + if (! $error) + { + $this->db->commit(); + return $this->id; + } + else + { + $this->db->rollback(); + return -1*$error; + } } @@ -976,10 +1008,10 @@ class Account extends CommonObject /** - * Retourne le libelle du statut d'une facture (brouillon, validee, abandonnee, payee) + * Return label of object status * - * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long - * @return string Libelle + * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=Long label + picto + * @return string Label */ function getLibStatut($mode=0) { @@ -987,11 +1019,11 @@ class Account extends CommonObject } /** - * Renvoi le libelle d'un statut donne + * Return label of given object status * - * @param int $statut Id statut - * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto - * @return string Libelle du statut + * @param int $statut Id statut + * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=Long label + picto + * @return string Label */ function LibStatut($statut, $mode = 0) { @@ -1014,6 +1046,8 @@ class Account extends CommonObject return $picto.' '.$label; } elseif ($mode == 5) { return $label.' '.$picto; + } elseif ($mode == 6) { + return $label.' '.$picto; } //There is no short mode for this label @@ -1151,9 +1185,9 @@ class Account extends CommonObject if ($user->societe_id) { return 0; } - + $nb=0; - + $sql = "SELECT COUNT(ba.rowid) as nb"; $sql.= " FROM ".MAIN_DB_PREFIX."bank_account as ba"; $sql.= " WHERE ba.rappro > 0 and ba.clos = 0"; @@ -1169,7 +1203,7 @@ class Account extends CommonObject return $nb; } - + /** * Return clicable name (with picto eventually) * @@ -1179,14 +1213,18 @@ class Account extends CommonObject */ function getNomUrl($withpicto=0, $mode='') { - global $langs; + global $conf, $langs; $result=''; $label = '' . $langs->trans("ShowAccount") . ''; - if (! empty($this->label)) - $label .= '
' . $langs->trans('Account') . ': ' . $this->label; - if (! empty($this->number)) - $label .= '
' . $langs->trans('AccountNumber') . ': ' . $this->number; + $label .= '
' . $langs->trans('BankAccount') . ': ' . $this->label; + $label .= '
' . $langs->trans('AccountNumber') . ': ' . $this->number; + if (! empty($conf->accounting->enabled)) + { + $langs->load("accountancy"); + $label .= '
' . $langs->trans('AccountAccounting') . ': ' . $this->account_number; + $label .= '
' . $langs->trans('AccountancyJournal') . ': ' . $this->accountancy_journal; + } $linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; if (empty($mode)) @@ -1196,7 +1234,7 @@ class Account extends CommonObject } else if ($mode == 'transactions') { - $link = ''; } else if ($mode == 'receipts') @@ -1204,7 +1242,7 @@ class Account extends CommonObject $link = 'label.$linkend; return $result; @@ -1255,8 +1293,6 @@ class Account extends CommonObject // For backward compatibility, we try to guess country from other information if (! empty($this->iban)) { - if ($mysoc->country_code === 'IN') return $mysoc->country_code; // Test to know if we can trust IBAN - // If IBAN defined, we can know country of account from it if (preg_match("/^([a-zA-Z][a-zA-Z])/i",$this->iban,$reg)) return $reg[1]; } @@ -1293,6 +1329,55 @@ class Account extends CommonObject return 0; } + /** + * Return 1 if IBAN / BIC is mandatory (otherwise option) + * + * @return int 1 = mandatory / 0 = Not mandatory + */ + function needIBAN() + { + $country_code=$this->getCountryCode(); + + $country_code_in_EEC=array( + 'AT', // Austria + 'BE', // Belgium + 'BG', // Bulgaria + 'CY', // Cyprus + 'CZ', // Czech republic + 'DE', // Germany + 'DK', // Danemark + 'EE', // Estonia + 'ES', // Spain + 'FI', // Finland + 'FR', // France + 'GB', // United Kingdom + 'GR', // Greece + 'HR', // Croatia + 'NL', // Holland + 'HU', // Hungary + 'IE', // Ireland + 'IM', // Isle of Man - Included in UK + 'IT', // Italy + 'LT', // Lithuania + 'LU', // Luxembourg + 'LV', // Latvia + 'MC', // Monaco - Included in France + 'MT', // Malta + //'NO', // Norway + 'PL', // Poland + 'PT', // Portugal + 'RO', // Romania + 'SE', // Sweden + 'SK', // Slovakia + 'SI', // Slovenia + 'UK', // United Kingdom + //'CH', // Switzerland - No. Swizerland in not in EEC + ); + + if (in_array($country_code,$country_code_in_EEC)) return 1; // France, Spain, ... + return 0; + } + /** * Load miscellaneous information for tab "Info" * @@ -1313,28 +1398,40 @@ class Account extends CommonObject * - DeskCode * * Some countries show less or more bank account properties to the user - * + * + * @param int $includeibanbic 1=Return also key for IBAN and BIC * @return array * @see useDetailedBBAN */ - public function getFieldsToShow() + public function getFieldsToShow($includeibanbic=0) { //Get the required properties depending on the country $detailedBBAN = $this->useDetailedBBAN(); if ($detailedBBAN == 0) { - return array( - 'BankAccountNumber' + $fieldarray= array( + 'BankAccountNumber' ); } elseif ($detailedBBAN == 2) { - return array( - 'BankCode', - 'BankAccountNumber' + $fieldarray= array( + 'BankCode', + 'BankAccountNumber' ); + } else { + $fieldarray=self::getAccountNumberOrder(); } + //if ($this->needIBAN()) { // return always IBAN and BIC (this was old behaviour) + if ($includeibanbic) + { + $fieldarray[]='IBAN'; + $fieldarray[]='BIC'; + } + //} + //Get the order the properties are shown - return self::getAccountNumberOrder(); + return $fieldarray; + } /** @@ -1352,10 +1449,10 @@ class Account extends CommonObject global $conf; $fieldlists = array( - 'BankCode', - 'DeskCode', - 'BankAccountNumber', - 'BankAccountNumberKey' + 'BankCode', + 'DeskCode', + 'BankAccountNumber', + 'BankAccountNumberKey' ); if (!empty($conf->global->BANK_SHOW_ORDER_OPTION)) { @@ -1391,8 +1488,9 @@ class Account extends CommonObject */ function initAsSpecimen() { + $this->specimen = 1; $this->ref = 'MBA'; - $this->label = 'My Bank account'; + $this->label = 'My Big Company Bank account'; $this->bank = 'MyBank'; $this->courant = Account::TYPE_CURRENT; $this->clos = Account::STATUS_OPEN; @@ -1402,7 +1500,7 @@ class Account extends CommonObject $this->cle_rib = 50; $this->bic = 'AA12'; $this->iban = 'FR999999999'; - $this->domiciliation = 'The bank addresse'; + $this->domiciliation = 'My bank address'; $this->proprio = 'Owner'; $this->owner_address = 'Owner address'; $this->country_id = 1; @@ -1437,7 +1535,7 @@ class AccountLine extends CommonObject var $fk_user_rappro; var $fk_type; var $rappro; // Is it conciliated - var $num_releve; // If conciliated, what is bank receipt + var $num_releve; // If conciliated, what is bank statement var $num_chq; // Num of cheque var $bank_chq; // Bank of cheque var $fk_bordereau; // Id of cheque receipt @@ -1557,7 +1655,7 @@ class AccountLine extends CommonObject $sql .= ", '".$this->db->idate($this->datev)."'"; $sql .= ", '".$this->db->escape($this->label)."'"; $sql .= ", ".price2num($this->amount); - $sql .= ", '".$this->fk_user_author."'"; + $sql .= ", ".($this->fk_user_author > 0 ? "'".$this->fk_user_author."'":"null"); $sql .= ", ".($this->num_chq ? "'".$this->num_chq."'" : "null"); $sql .= ", '".$this->fk_account."'"; $sql .= ", '".$this->db->escape($this->fk_type)."'"; @@ -1707,8 +1805,20 @@ class AccountLine extends CommonObject */ function update_conciliation(User $user, $cat) { + global $conf; + $this->db->begin(); + // Check statement field + if (! empty($conf->global->BANK_STATEMENT_REGEX_RULE)) + { + if (! preg_match('/'.$conf->global->BANK_STATEMENT_REGEX_RULE.'/', $this->num_releve)) + { + $this->errors[]=$langs->trans("ErrorBankStatementNameMustFollowRegex", $conf->global->BANK_STATEMENT_REGEX_RULE); + return -1; + } + } + $sql = "UPDATE ".MAIN_DB_PREFIX."bank SET"; $sql.= " rappro = 1"; $sql.= ", num_releve = '".$this->num_releve."'"; diff --git a/htdocs/compta/bank/class/api_bankaccounts.class.php b/htdocs/compta/bank/class/api_bankaccounts.class.php new file mode 100644 index 00000000000..7de67119d2b --- /dev/null +++ b/htdocs/compta/bank/class/api_bankaccounts.class.php @@ -0,0 +1,379 @@ + + * + * 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 . + */ + +use Luracast\Restler\RestException; + +require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; + +/** + * API class for accounts + * + * @access protected + * @class DolibarrApiAccess {@requires user,external} + */ +class BankAccounts extends DolibarrApi +{ + + /** + * array $FIELDS Mandatory fields, checked when creating an object + */ + static $FIELDS = array( + 'ref', + 'label', + 'type', + 'currency_code', + 'country_id' + ); + + /** + * Constructor + */ + function __construct() + { + global $db; + $this->db = $db; + } + + /** + * Get the list of accounts. + * + * @param string $sortfield Sort field + * @param string $sortorder Sort order + * @param int $limit Limit for list + * @param int $page Page number + * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.import_key:<:'20160101')" + * @return array List of account objects + * + * @throws RestException + */ + function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 0, $page = 0, $sqlfilters = '') + { + $list = array(); + + if(! DolibarrApiAccess::$user->rights->banque->lire) { + throw new RestException(401); + } + + $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."bank_account as t"; + $sql.= ' WHERE t.entity IN ('.getEntity('banque', 1).')'; + // Add sql filters + if ($sqlfilters) + { + if (! DolibarrApi::_checkFilters($sqlfilters)) + { + throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); + } + $regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; + } + + $sql.= $this->db->order($sortfield, $sortorder); + if ($limit) { + if ($page < 0) + { + $page = 0; + } + $offset = $limit * $page; + + $sql.= $this->db->plimit($limit + 1, $offset); + } + + dol_syslog("API Rest request"); + $result = $this->db->query($sql); + + if ($result) { + $num = $this->db->num_rows($result); + for ($i = 0; $i < min($num, ($limit <= 0 ? $num : $limit)); $i++) { + $obj = $this->db->fetch_object($result); + $account = new Account($this->db); + if ($account->fetch($obj->rowid) > 0) { + $list[] = $this->_cleanObjectDatas($account); + } + } + } else { + throw new RestException(503, 'Error when retrieving list of accounts: ' . $this->db->lasterror()); + } + + return $list; + } + + /** + * Get account by ID. + * + * @param int $id ID of account + * @return array Account object + * + * @throws RestException + */ + function get($id) + { + if (! DolibarrApiAccess::$user->rights->banque->lire) { + throw new RestException(401); + } + + $account = new Account($this->db); + $result = $account->fetch($id); + if (! $result) { + throw new RestException(404, 'account not found'); + } + + return $this->_cleanObjectDatas($account); + } + + /** + * Create account object + * + * @param array $request_data Request data + * @return int ID of account + */ + function post($request_data = null) + { + if (! DolibarrApiAccess::$user->rights->banque->configurer) { + throw new RestException(401); + } + // Check mandatory fields + $result = $this->_validate($request_data); + + $account = new Account($this->db); + foreach ($request_data as $field => $value) { + $account->$field = $value; + } + // Date of the initial balance (required to create an account). + $account->date_solde = time(); + // courant and type are the same thing but the one used when + // creating an account is courant + $account->courant = $account->type; + + if ($account->create(DolibarrApiAccess::$user) < 0) { + throw new RestException(503, 'Error when creating account: ' . $account->error); + } + return $account->id; + } + + /** + * Update account + * + * @param int $id ID of account + * @param array $request_data data + * @return int + */ + function put($id, $request_data = null) + { + if (! DolibarrApiAccess::$user->rights->banque->configurer) { + throw new RestException(401); + } + + $account = new Account($this->db); + $result = $account->fetch($id); + if (! $result) { + throw new RestException(404, 'account not found'); + } + + foreach ($request_data as $field => $value) { + $account->$field = $value; + } + + if ($account->update(DolibarrApiAccess::$user) > 0) + return $this->get($id); + + return false; + } + + /** + * Delete account + * + * @param int $id ID of account + * @return array + */ + function delete($id) + { + if (! DolibarrApiAccess::$user->rights->banque->configurer) { + throw new RestException(401); + } + $account = new Account($this->db); + $result = $account->fetch($id); + if (! $result) { + throw new RestException(404, 'account not found'); + } + + if ($account->delete(DolibarrApiAccess::$user) < 0) { + throw new RestException(401, 'error when deleting account'); + } + + return array( + 'success' => array( + 'code' => 200, + 'message' => 'account deleted' + ) + ); + } + + /** + * Validate fields before creating an object + * + * @param array|null $data Data to validate + * @return array + * + * @throws RestException + */ + function _validate($data) + { + $account = array(); + foreach (Accounts::$FIELDS as $field) { + if (! isset($data[$field])) + throw new RestException(400, "$field field missing"); + $account[$field] = $data[$field]; + } + return $account; + } + + /** + * Clean sensible object datas + * + * @param object $object Object to clean + * @return array Array of cleaned object properties + */ + function _cleanObjectDatas($object) + { + $object = parent::_cleanObjectDatas($object); + + unset($object->rowid); + + return $object; + } + + /** + * Get the list of lines of the account. + * + * @param int $id ID of account + * @return array Array of AccountLine objects + * + * @throws RestException + * + * @url GET {id}/lines + */ + function getLines($id) + { + $list = array(); + + if (! DolibarrApiAccess::$user->rights->banque->lire) { + throw new RestException(401); + } + + $account = new Account($this->db); + $result = $account->fetch($id); + if (! $result) { + throw new RestException(404, 'account not found'); + } + + $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."bank "; + $sql .= " WHERE fk_account = ".$id; + $sql .= " ORDER BY rowid"; + + $result = $this->db->query($sql); + + if ($result) { + $num = $this->db->num_rows($result); + for ($i = 0; $i < $num; $i++) { + $obj = $this->db->fetch_object($result); + $accountLine = new AccountLine($this->db); + if ($accountLine->fetch($obj->rowid) > 0) { + $list[] = $this->_cleanObjectDatas($accountLine); + } + } + } else { + throw new RestException(503, 'Error when retrieving list of account lines: ' . $accountLine->error); + } + + return $list; + } + + /** + * Add a line to an account + * + * @param int $id ID of account + * @param int $date Payment date (timestamp) {@from body} {@type timestamp} + * @param string $type Payment mode (TYP,VIR,PRE,LIQ,VAD,CB,CHQ...) {@from body} + * @param string $label Label {@from body} + * @param float $amount Amount (may be 0) {@from body} + * @param int $category Category + * @param string $cheque_number Cheque numberl {@from body} + * @param string $cheque_writer Name of cheque writer {@from body} + * @param string $cheque_bank Bank of cheque writer {@from body} + * @return int ID of line + * + * @url POST {id}/lines + */ + function addLine($id, $date, $type, $label, $amount, $category=0, $cheque_number='', $cheque_writer='', $cheque_bank='') + { + if (! DolibarrApiAccess::$user->rights->banque->modifier) { + throw new RestException(401); + } + + $account = new Account($this->db); + $result = $account->fetch($id); + if (! $result) { + throw new RestException(404, 'account not found'); + } + + $result = $account->addline($date, $type, $label, $amount, $cheque_number, $category, + DolibarrApiAccess::$user, $cheque_writer, $cheque_bank); + if ($result < 0) { + throw new RestException(503, 'Error when adding line to account: ' . $account->error); + } + return $result; + } + + /** + * Add a link to an account line + * + * @param int $account_id ID of account + * @param int $line_id ID of account line + * @param int $url_id ID to set in the URL {@from body} + * @param string $url URL of the link {@from body} + * @param string $label Label {@from body} + * @param string $type Type of link ('payment', 'company', 'member', ...) {@from body} + * @return int ID of link + * + * @url POST {account_id}/lines/{line_id}/links + */ + function addLink($account_id, $line_id, $url_id, $url, $label, $type) + { + if (! DolibarrApiAccess::$user->rights->banque->modifier) { + throw new RestException(401); + } + + $account = new Account($this->db); + $result = $account->fetch($account_id); + if (! $result) { + throw new RestException(404, 'account not found'); + } + + $accountLine = new AccountLine($this->db); + $result = $accountLine->fetch($line_id); + if (! $result) { + throw new RestException(404, 'account line not found'); + } + + $result = $account->add_url_line($line_id, $url_id, $url, $label, $type); + if ($result < 0) { + throw new RestException(503, 'Error when adding link to account line: ' . $account->error); + } + return $result; + } +} diff --git a/htdocs/compta/bank/document.php b/htdocs/compta/bank/document.php index 7320ce85f91..0878474dcb5 100644 --- a/htdocs/compta/bank/document.php +++ b/htdocs/compta/bank/document.php @@ -140,7 +140,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); @@ -151,8 +153,7 @@ if ($id > 0 || !empty($ref)) { // Onglets $head = bank_prepare_head($object); - dol_fiche_head($head, 'document', $langs->trans("FinancialAccount"), 0, - 'account'); + dol_fiche_head($head, 'document', $langs->trans("FinancialAccount"), 0, 'account'); // Construit liste des fichiers @@ -165,29 +166,25 @@ if ($id > 0 || !empty($ref)) { } $linkback = ''.$langs->trans("BackToList").''; + + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); - print ''; - - // Ref - print ''; - print ''; - - // Label - print ''; - print ''; - - // Status - print ''; - print ''; - print ''; + + print '
'; + print '
'; + + print '
' . $langs->trans("Ref") . ''; - print $form->showrefnav($object, 'ref', $linkback, 1, 'ref'); - print '
' . $langs->trans("Label") . '' . $object->label . '
' . $langs->trans("Status") . '' . $object->getLibStatut(4) . '
' . $langs->trans("NbOfAttachedFiles") . '' . count($filearray) . '
'; + print ''; print ''; print "
' . $langs->trans("NbOfAttachedFiles") . '' . count($filearray) . '
' . $langs->trans("TotalSizeOfAttachedFiles") . '' . $totalsize . ' ' . $langs->trans("bytes") . '
\n"; - print "
\n"; + + print '
'; + + dol_fiche_end(); dol_htmloutput_mesg($mesg, $mesgs); + /* * Confirmation suppression fichier */ @@ -216,6 +213,7 @@ if ($id > 0 || !empty($ref)) { } else { Header('Location: index.php'); + exit; } diff --git a/htdocs/compta/bank/graph.php b/htdocs/compta/bank/graph.php index 0764c87f5ab..bf69fe98a3b 100644 --- a/htdocs/compta/bank/graph.php +++ b/htdocs/compta/bank/graph.php @@ -53,7 +53,9 @@ $error=0; * View */ -llxHeader(); +$title = $langs->trans("FinancialAccount").' - '.$langs->trans("Graph"); +$helpurl = ""; +llxHeader('',$title,$helpurl); $form = new Form($db); @@ -65,18 +67,18 @@ if (! empty($_GET["year"])) $year=sprintf("%04d",$_GET["year"]); if (! empty($_GET["month"])) $month=sprintf("%02d",$_GET["month"]); -$acct = new Account($db); +$object = new Account($db); if ($_GET["account"] && ! preg_match('/,/',$_GET["account"])) // if for a particular account and not a list { - $result=$acct->fetch($_GET["account"]); + $result=$object->fetch($_GET["account"]); } if ($_GET["ref"]) { - $result=$acct->fetch(0,$_GET["ref"]); - $account=$acct->id; + $result=$object->fetch(0,$_GET["ref"]); + $account=$object->id; } -$result=dol_mkdir($conf->banque->dir_temp); +$result=dol_mkdir($conf->bank->dir_temp); if ($result < 0) { $langs->load("errors"); @@ -105,6 +107,8 @@ else { dol_print_error($db); } + if (empty($min)) $min = dol_now - 3600 * 24; + $log="graph.php: min=".$min." max=".$max; dol_syslog($log); @@ -200,8 +204,8 @@ else { $datas[$i] = $solde + $subtotal; } - $datamin[$i] = $acct->min_desired; - $dataall[$i] = $acct->min_allowed; + $datamin[$i] = $object->min_desired; + $dataall[$i] = $object->min_allowed; //$labels[$i] = strftime("%d",$day); $labels[$i] = $xday; @@ -221,22 +225,22 @@ else //exit; // Fabrication tableau 1 - $file= $conf->banque->dir_temp."/balance".$account."-".$year.$month.".png"; + $file= $conf->bank->dir_temp."/balance".$account."-".$year.$month.".png"; $fileurl=DOL_URL_ROOT.'/viewimage.php?modulepart=banque_temp&file='."/balance".$account."-".$year.$month.".png"; $title=$langs->transnoentities("Balance").' - '.$langs->transnoentities("Month").': '.$month.' '.$langs->transnoentities("Year").': '.$year; $graph_datas=array(); foreach($datas as $i => $val) { $graph_datas[$i]=array(isset($labels[$i])?$labels[$i]:'',$datas[$i]); - if ($acct->min_desired) array_push($graph_datas[$i],$datamin[$i]); - if ($acct->min_allowed) array_push($graph_datas[$i],$dataall[$i]); + if ($object->min_desired) array_push($graph_datas[$i],$datamin[$i]); + if ($object->min_allowed) array_push($graph_datas[$i],$dataall[$i]); } $px1 = new DolGraph(); $px1->SetData($graph_datas); $arraylegends=array($langs->transnoentities("Balance")); - if ($acct->min_desired) array_push($arraylegends,$langs->transnoentities("BalanceMinimalDesired")); - if ($acct->min_allowed) array_push($arraylegends,$langs->transnoentities("BalanceMinimalAllowed")); + if ($object->min_desired) array_push($arraylegends,$langs->transnoentities("BalanceMinimalDesired")); + if ($object->min_allowed) array_push($arraylegends,$langs->transnoentities("BalanceMinimalAllowed")); $px1->SetLegend($arraylegends); $px1->SetLegendWidthMin(180); $px1->SetMaxValue($px1->GetCeilMaxValue()<0?0:$px1->GetCeilMaxValue()); @@ -344,8 +348,8 @@ else { $datas[$i] = $solde + $subtotal; } - $datamin[$i] = $acct->min_desired; - $dataall[$i] = $acct->min_allowed; + $datamin[$i] = $object->min_desired; + $dataall[$i] = $object->min_allowed; if ($xday == '15') { $labels[$i] = dol_print_date($day,"%b"); @@ -358,21 +362,21 @@ else } // Fabrication tableau 2 - $file= $conf->banque->dir_temp."/balance".$account."-".$year.".png"; + $file= $conf->bank->dir_temp."/balance".$account."-".$year.".png"; $fileurl=DOL_URL_ROOT.'/viewimage.php?modulepart=banque_temp&file='."/balance".$account."-".$year.".png"; $title=$langs->transnoentities("Balance").' - '.$langs->transnoentities("Year").': '.$year; $graph_datas=array(); foreach($datas as $i => $val) { $graph_datas[$i]=array(isset($labels[$i])?$labels[$i]:'',$datas[$i]); - if ($acct->min_desired) array_push($graph_datas[$i],$datamin[$i]); - if ($acct->min_allowed) array_push($graph_datas[$i],$dataall[$i]); + if ($object->min_desired) array_push($graph_datas[$i],$datamin[$i]); + if ($object->min_allowed) array_push($graph_datas[$i],$dataall[$i]); } $px2 = new DolGraph(); $px2->SetData($graph_datas); $arraylegends=array($langs->transnoentities("Balance")); - if ($acct->min_desired) array_push($arraylegends,$langs->transnoentities("BalanceMinimalDesired")); - if ($acct->min_allowed) array_push($arraylegends,$langs->transnoentities("BalanceMinimalAllowed")); + if ($object->min_desired) array_push($arraylegends,$langs->transnoentities("BalanceMinimalDesired")); + if ($object->min_allowed) array_push($arraylegends,$langs->transnoentities("BalanceMinimalAllowed")); $px2->SetLegend($arraylegends); $px2->SetLegendWidthMin(180); $px2->SetMaxValue($px2->GetCeilMaxValue()<0?0:$px2->GetCeilMaxValue()); @@ -460,8 +464,8 @@ else { $datas[$i] = '' + $solde + $subtotal; } - $datamin[$i] = $acct->min_desired; - $dataall[$i] = $acct->min_allowed; + $datamin[$i] = $object->min_desired; + $dataall[$i] = $object->min_allowed; if (substr($textdate,6,2) == '01' || $i == 0) { $labels[$i] = substr($textdate,4,2); @@ -473,22 +477,22 @@ else } // Fabrication tableau 3 - $file= $conf->banque->dir_temp."/balance".$account.".png"; + $file= $conf->bank->dir_temp."/balance".$account.".png"; $fileurl=DOL_URL_ROOT.'/viewimage.php?modulepart=banque_temp&file='."/balance".$account.".png"; $title=$langs->transnoentities("Balance")." - ".$langs->transnoentities("AllTime"); $graph_datas=array(); foreach($datas as $i => $val) { $graph_datas[$i]=array(isset($labels[$i])?$labels[$i]:'',$datas[$i]); - if ($acct->min_desired) array_push($graph_datas[$i],$datamin[$i]); - if ($acct->min_allowed) array_push($graph_datas[$i],$dataall[$i]); + if ($object->min_desired) array_push($graph_datas[$i],$datamin[$i]); + if ($object->min_allowed) array_push($graph_datas[$i],$dataall[$i]); } $px3 = new DolGraph(); $px3->SetData($graph_datas); $arraylegends=array($langs->transnoentities("Balance")); - if ($acct->min_desired) array_push($arraylegends,$langs->transnoentities("BalanceMinimalDesired")); - if ($acct->min_allowed) array_push($arraylegends,$langs->transnoentities("BalanceMinimalAllowed")); + if ($object->min_desired) array_push($arraylegends,$langs->transnoentities("BalanceMinimalDesired")); + if ($object->min_allowed) array_push($arraylegends,$langs->transnoentities("BalanceMinimalAllowed")); $px3->SetLegend($arraylegends); $px3->SetLegendWidthMin(180); $px3->SetMaxValue($px3->GetCeilMaxValue()<0?0:$px3->GetCeilMaxValue()); @@ -603,11 +607,11 @@ else $data_credit[$i] = isset($credits[substr("0".($i+1),-2)]) ? $credits[substr("0".($i+1),-2)] : 0; $data_debit[$i] = isset($debits[substr("0".($i+1),-2)]) ? $debits[substr("0".($i+1),-2)] : 0; $labels[$i] = sprintf("%02d",$i+1); - $datamin[$i] = $acct->min_desired; + $datamin[$i] = $object->min_desired; } // Fabrication tableau 4a - $file= $conf->banque->dir_temp."/movement".$account."-".$year.$month.".png"; + $file= $conf->bank->dir_temp."/movement".$account."-".$year.$month.".png"; $fileurl=DOL_URL_ROOT.'/viewimage.php?modulepart=banque_temp&file='."/movement".$account."-".$year.$month.".png"; $title=$langs->transnoentities("BankMovements").' - '.$langs->transnoentities("Month").': '.$month.' '.$langs->transnoentities("Year").': '.$year; $graph_datas=array(); @@ -712,11 +716,11 @@ else $data_credit[$i] = isset($credits[substr("0".($i+1),-2)]) ? $credits[substr("0".($i+1),-2)] : 0; $data_debit[$i] = isset($debits[substr("0".($i+1),-2)]) ? $debits[substr("0".($i+1),-2)] : 0; $labels[$i] = dol_print_date(dol_mktime(12,0,0,$i+1,1,2000),"%b"); - $datamin[$i] = $acct->min_desired; + $datamin[$i] = $object->min_desired; } // Fabrication tableau 4b - $file= $conf->banque->dir_temp."/movement".$account."-".$year.".png"; + $file= $conf->bank->dir_temp."/movement".$account."-".$year.".png"; $fileurl=DOL_URL_ROOT.'/viewimage.php?modulepart=banque_temp&file='."/movement".$account."-".$year.".png"; $title=$langs->transnoentities("BankMovements").' - '.$langs->transnoentities("Year").': '.$year; $graph_datas=array(); @@ -752,36 +756,33 @@ else // Onglets -$head=bank_prepare_head($acct); +$head=bank_prepare_head($object); dol_fiche_head($head,'graph',$langs->trans("FinancialAccount"),0,'account'); -print ''; $linkback = ''.$langs->trans("BackToList").''; -// Ref -print ''; -print ''; - -// Label -print ''; -print ''; - -print '
'.$langs->trans("Ref").''; if ($account) { if (! preg_match('/,/',$account)) { $moreparam='&month='.$month.'&year='.$year.($mode=='showalltime'?'&mode=showalltime':''); + if ($_GET["option"]!='all') { $morehtml=''.$langs->trans("ShowAllAccounts").''; - print $form->showrefnav($acct, 'ref', $linkback, 1, 'ref', 'ref', '', $moreparam); + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', '', $moreparam, 0, '', '', 1); } else { $morehtml=''.$langs->trans("BackToAccount").''; - print $langs->trans("All"); + print $langs->trans("AllAccounts"); //print $morehtml; } } else { - $bankaccount=new Account($db); + $bankaccount=new Account($db); $listid=explode(',',$account); foreach($listid as $key => $id) { @@ -793,25 +794,9 @@ if ($account) } } else -{ - print $langs->trans("All"); -} -print '
'.$langs->trans("Label").''; -if ($account && $_GET["option"]!='all') -{ - print $acct->label; -} -else { print $langs->trans("AllAccounts"); } -print '
'; dol_fiche_end(); diff --git a/htdocs/compta/bank/index.php b/htdocs/compta/bank/index.php index 34cec22fb54..7d3073d7129 100644 --- a/htdocs/compta/bank/index.php +++ b/htdocs/compta/bank/index.php @@ -33,69 +33,366 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; $langs->load("banks"); $langs->load("categories"); +$action=GETPOST('action','alpha'); +$massaction=GETPOST('massaction','alpha'); +$show_files=GETPOST('show_files','int'); +$confirm=GETPOST('confirm','alpha'); +$toselect = GETPOST('toselect', 'array'); + +$statut=GETPOST('statut')?GETPOST('statut', 'alpha'):'opened'; // 'all' or ''='opened' +$optioncss = GETPOST('optioncss','alpha'); + // Security check if ($user->societe_id) $socid=$user->societe_id; $result=restrictedArea($user,'banque'); -$statut=GETPOST('statut'); +$diroutputmassaction=$conf->bank->dir_output . '/temp/massgeneration/'.$user->id; +$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='b.label'; +if (! $sortorder) $sortorder='ASC'; +// Initialize technical object to manage context to save list fields +$contextpage='bankaccountlist'; -/* - * View - */ +// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +$hookmanager->initHooks(array($contextpage)); +$extrafields = new ExtraFields($db); -$help_url='EN:Module_Banks_and_Cash|FR:Module_Banques_et_Caisses|ES:Módulo_Bancos_y_Cajas'; -llxHeader('',$langs->trans('AccountsArea'),$help_url); +// fetch optionals attributes and labels +$extralabels = $extrafields->fetch_name_optionals_label('bankaccount'); +$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_'); -$link=''; -if ($statut == '') $link=''.$langs->trans("IncludeClosedAccount").''; -if ($statut == 'all') $link=''.$langs->trans("OnlyOpenedAccount").''; -print load_fiche_titre($langs->trans("AccountsArea"),$link, 'title_bank.png'); +// List of fields to search into when doing a "search in all" +$fieldstosearchall = array( + 'b.ref'=>'Ref', + 'b.label'=>'Label', +); - -// On charge tableau des comptes financiers (ouverts par defaut) -$accounts = array(); - -$sql = "SELECT rowid, courant, rappro"; -$sql.= " FROM ".MAIN_DB_PREFIX."bank_account"; -$sql.= " WHERE entity IN (".getEntity('bank_account', 1).")"; -if ($statut != 'all') $sql.= " AND clos = 0"; -$sql.= $db->order('label', 'ASC'); - -$resql = $db->query($sql); -if ($resql) +$checkedtypetiers=0; +$arrayfields=array( + 'b.ref'=>array('label'=>$langs->trans("BankAccounts"), 'checked'=>1), + 'accountype'=>array('label'=>$langs->trans("AccountType"), 'checked'=>1), + 'b.label'=>array('label'=>$langs->trans("Label"), 'checked'=>1), + 'b.number'=>array('label'=>$langs->trans("AccountIdShort"), 'checked'=>1), + 'toreconcile'=>array('label'=>$langs->trans("TransactionsToConciliate"), 'checked'=>1), + 'b.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), + 'b.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500), + 'b.clos'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000), + 'balance'=>array('label'=>$langs->trans("Balance"), 'checked'=>1, 'position'=>1010), +); +// Extra fields +if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { - $num = $db->num_rows($resql); - $i = 0; - while ($i < $num) - { - $objp = $db->fetch_object($resql); - $accounts[$objp->rowid] = $objp->courant; - $i++; - } - $db->free($resql); + 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]); + } } /* - * Comptes courants (courant = 1) + * Actions */ -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; + +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 +{ + $statut = 'all'; + +} + + + +/* + * View + */ + +$title=$langs->trans('BankAccounts'); + +// Load array of financial accounts (opened by default) +$accounts = array(); + +$sql = "SELECT rowid, label, courant, rappro"; +// 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."bank_account as b"; +if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bankcacount_extrafields as ef on (c.rowid = ef.fk_object)"; +$sql.= " WHERE entity IN (".getEntity('bank_account', 1).")"; +if ($statut == 'opened') $sql.= " AND clos = 0"; +if ($statut == 'closed') $sql.= " AND clos = 1"; + +// 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.= $db->order($sortfield,$sortorder); + +// Count total nb of records +$nbtotalofrecords = 0; +if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) +{ + $result = $db->query($sql); + $nbtotalofrecords = $db->num_rows($result); +} + +$sql.= $db->plimit($limit + 1,$offset); + +$resql = $db->query($sql); +if ($resql) +{ + $num = $db->num_rows($resql); + $i = 0; + while ($i < $num) + { + $objp = $db->fetch_object($resql); + $accounts[$objp->rowid] = $objp->courant; + $i++; + } + $db->free($resql); +} +else dol_print_error($db); + + + +$help_url='EN:Module_Banks_and_Cash|FR:Module_Banques_et_Caisses|ES:Módulo_Bancos_y_Cajas'; +llxHeader('',$title,$help_url); + +$link=''; + + +$num_rows = count($accounts); + +$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; +if ($statut != '') $param.='&statut='.$statut; +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->banque->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete"); +if ($massaction == 'presend') $arrayofmassactions=array(); +$massactionbutton=$form->selectMassAction('', $arrayofmassactions); + + +// Lines of title fields +print ''; +if ($optioncss != '') print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; + +print_barre_liste($title,$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords,'title_bank.png',0,'','',$limit, 1); + + +if ($sall) +{ + foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); + print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); +} + +$moreforfilter=''; + + +// Bank accounts +$parameters=array(); +$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 '
'; + print $moreforfilter; + print '
'; +} + +$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; +//$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields + +print '
'.$langs->trans("CurrentAccounts").''.$langs->trans("Bank").''.$langs->trans("AccountIdShort").''.$langs->trans("TransactionsToConciliate").''.$langs->trans("Status").''.$langs->trans("BankBalance").'
'."\n"; + +// Fields title +print ''; +if (! empty($arrayfields['b.ref']['checked'])) print_liste_field_titre($arrayfields['b.ref']['label'],$_SERVER["PHP_SELF"],'b.ref','',$param,'',$sortfield,$sortorder); +if (! empty($arrayfields['accountype']['checked'])) print_liste_field_titre($arrayfields['accountype']['label'],$_SERVER["PHP_SELF"],'','',$param,'',$sortfield,$sortorder); +if (! empty($arrayfields['b.label']['checked'])) print_liste_field_titre($arrayfields['b.label']['label'],$_SERVER["PHP_SELF"],'b.label','',$param,'',$sortfield,$sortorder); +if (! empty($arrayfields['b.number']['checked'])) print_liste_field_titre($arrayfields['b.number']['label'],$_SERVER["PHP_SELF"],'b.number','',$param,'',$sortfield,$sortorder); +if (! empty($arrayfields['toreconcile']['checked'])) print_liste_field_titre($arrayfields['toreconcile']['label'],$_SERVER["PHP_SELF"],'','',$param,'align="center"',$sortfield,$sortorder); +if (! empty($arrayfields['b.clos']['checked'])) print_liste_field_titre($arrayfields['b.clos']['label'],$_SERVER["PHP_SELF"],'b.clos','',$param,'align="center"',$sortfield,$sortorder); +if (! empty($arrayfields['balance']['checked'])) print_liste_field_titre($arrayfields['balance']['label'],$_SERVER["PHP_SELF"],'','',$param,'align="right"',$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; +print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch '); print "\n"; + +print ''; +// Ref +if (! empty($arrayfields['b.ref']['checked'])) +{ + print ''; +} +// Account type +if (! empty($arrayfields['accountype']['checked'])) +{ + print ''; +} +// Ref +if (! empty($arrayfields['b.label']['checked'])) +{ + print ''; +} +// Number +if (! empty($arrayfields['b.number']['checked'])) +{ + print ''; +} +// Transactions to reconcile +if (! empty($arrayfields['toreconcile']['checked'])) +{ + print ''; +} +// 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 ''; + } + } +} +// 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['b.datec']['checked'])) +{ + print ''; +} +// Date modification +if (! empty($arrayfields['b.tms']['checked'])) +{ + print ''; +} +// Statut +if (! empty($arrayfields['b.clos']['checked'])) +{ + print ''; +} +// Balance +print ''; +// Action column +print ''; +print ''; + + + $total = array(); $found = 0; $var=true; foreach ($accounts as $key=>$type) { - if ($type == 1) - { + //if ($type == 1) + //{ $found++; $acc = new Account($db); @@ -106,6 +403,9 @@ foreach ($accounts as $key=>$type) print ''; print ''; + print ''; print ''; print ''; print ''; print ''; print ''; - print ''; - - $total[$acc->currency_code] += $solde; - } -} -if (! $found) print ''; -// Total -foreach ($total as $key=>$solde) -{ - print ''; -} - -print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + 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 ''; + } + print ''; + print ''; + print ''; + $array=array( + 'opened'=>$langs->trans("Opened"), + 'closed'=>$langs->trans("Closed") + ); + print $form->selectarray("statut", $array, $statut, 1); + print ''; +$searchpitco=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1); +print $searchpitco; +print '
'.$acc->getNomUrl(1).''; + print $acc->type_lib[$acc->type]; + print ''.$acc->bank.''.$acc->number.''; @@ -123,145 +423,37 @@ foreach ($accounts as $key=>$type) print ''.$acc->getLibStatut(2).''; - print ''.price($solde, 0, $langs, 0, 0, -1, $acc->currency_code).''; + print ''.price($solde, 0, $langs, 0, 0, -1, $acc->currency_code).''; print '
'.$langs->trans("None").'
'.$langs->trans("Total").' '.$key.''.price($solde, 0, $langs, 0, 0, -1, $key).'
'; -print '
'; - -/* - * Comptes caisse/liquide (courant = 2) - */ -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print "\n"; - -$total = array(); $found = 0; -$var=true; -foreach ($accounts as $key=>$type) -{ - if ($type == 2) - { - $found++; - - $acc = new Account($db); - $acc->fetch($key); - - $var = !$var; - $solde = $acc->solde(1); - - print ""; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - $total[$acc->currency_code] += $solde; - } -} -if (! $found) -{ - $var = !$var; - print ''; -} -// Total -foreach ($total as $key=>$solde) -{ - print ''; -} - -print '
'.$langs->trans("CashAccounts").'   '.$langs->trans("Status").''.$langs->trans("BankBalance").'
'.$acc->getNomUrl(1).''.$acc->bank.'  '.$acc->getLibStatut(2).''; - print ''.price($solde, 0, $langs, 0, 0, -1, $acc->currency_code).''; - print '
'.$langs->trans("None").'
'.$langs->trans("Total").' '.$key.''.price($solde, 0, $langs, 0, 0, -1, $key).'
'; -print '
'; - -/* - * Comptes placements (courant = 0) - */ -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print "\n"; - -$total = array(); $found = 0; -$var=true; -foreach ($accounts as $key=>$type) -{ - if ($type == 0) - { - $found++; - - $acc = new Account($db); - $acc->fetch($key); - - $var = !$var; - $solde = $acc->solde(1); - - print ""; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + if (! $i) $totalarray['nbfield']++; + print ''; $total[$acc->currency_code] += $solde; - } -} -if (! $found) -{ - $var = !$var; - print ''; + //} } +if (! $found) print ''; // Total foreach ($total as $key=>$solde) { - print ''; + print ''; } -print "
'.$langs->trans("SavingAccounts").''.$langs->trans("Bank").''.$langs->trans("Numero").''.$langs->trans("TransactionsToConciliate").''.$langs->trans("Status").''.$langs->trans("BankBalance").'
'.$acc->getNomUrl(1).''.$acc->bank.''.$acc->number.''; - if ($acc->rappro) + + // Action column + print ''; + if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined { - $result=$acc->load_board($user,$acc->id); - if ($result<0) { - setEventMessages($acc->error, $acc->errors, 'errors'); - } else { - print $result->nbtodo; - if ($result->nbtodolate) print ' ('.$result->nbtodolate.img_warning($langs->trans("Late")).')'; - } + $selected=0; + if (in_array($obj->rowid, $arrayofselected)) $selected=1; + print ''; } - else print $langs->trans("FeatureDisabled"); - print ''.$acc->getLibStatut(2).''; - print ''.price($solde, 0, $langs, 0, 0, -1, $acc->currency_code).''; print '
'.$langs->trans("None").'
'.$langs->trans("None").'
'.$langs->trans("Total").' '.$key.''.price($solde, 0, $langs, 0, 0, -1, $key).'
'.$langs->trans("Total").' '.$key.''.price($solde, 0, $langs, 0, 0, -1, $key).'
"; +print ''; /* - * Boutons d'actions + * Buttons actions */ print '
'."\n"; diff --git a/htdocs/compta/bank/ligne.php b/htdocs/compta/bank/ligne.php index 873d71de81b..f02b4326a31 100644 --- a/htdocs/compta/bank/ligne.php +++ b/htdocs/compta/bank/ligne.php @@ -83,13 +83,13 @@ if ($action == 'confirm_delete_categ' && $confirm == "yes" && $user->rights->ban if ($user->rights->banque->modifier && $action == 'class') { - $sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_class WHERE lineid = ".$rowid." AND fk_categ = ".$_POST["cat1"]; + $sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_class WHERE lineid = ".$rowid." AND fk_categ = ".GETPOST('cat1', 'int'); if (! $db->query($sql)) { dol_print_error($db); } - $sql = "INSERT INTO ".MAIN_DB_PREFIX."bank_class (lineid, fk_categ) VALUES (".$rowid.", ".$_POST["cat1"].")"; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."bank_class (lineid, fk_categ) VALUES (".$rowid.", ".GETPOST('cat1', 'int').")"; if (! $db->query($sql)) { dol_print_error($db); @@ -271,7 +271,7 @@ if ($result) print ''; - $linkback = ''.$langs->trans("BackToList").''; + $linkback = ''.$langs->trans("BackToList").''; // Ref print '"; @@ -320,7 +320,7 @@ if ($result) print ''; } else if ($links[$key]['type']=='sc') { - print ''; + print ''; print img_object($langs->trans('ShowSocialContribution'),'bill').' '; print $langs->trans("SocialContribution").($links[$key]['label']?' - '.$links[$key]['label']:''); print ''; diff --git a/htdocs/compta/bank/rappro.php b/htdocs/compta/bank/rappro.php deleted file mode 100644 index 8f6cd29afdb..00000000000 --- a/htdocs/compta/bank/rappro.php +++ /dev/null @@ -1,468 +0,0 @@ - - * Copyright (C) 2004-2015 Laurent Destailleur - * Copyright (C) 2010 Juanjo Menent - * Copyright (C) 2015 Jean-François Ferry - * Copyright (C) 2016 Marcos García - * - * 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 . - */ - -/** - * \file htdocs/compta/bank/rappro.php - * \ingroup banque - * \brief Page to reconciliate bank transactions - */ - -require('../../main.inc.php'); -require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; -require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php'; -require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/paiement/cheque/class/remisecheque.class.php'; - -$langs->load("banks"); -$langs->load("categories"); -$langs->load("bills"); - -if (! $user->rights->banque->consolidate) accessforbidden(); - -$action=GETPOST('action', 'alpha'); -$id=GETPOST('account', 'int'); - -$sortfield = GETPOST("sortfield",'alpha'); -$sortorder = GETPOST("sortorder",'alpha'); -if (! $sortorder) $sortorder="ASC"; -if (! $sortfield) $sortfield="dateo"; - - -/* - * Actions - */ - -// Conciliation -if ($action == 'rappro' && $user->rights->banque->consolidate) -{ - $error=0; - - // Definition, nettoyage parametres - $num_releve=trim($_POST["num_releve"]); - - if ($num_releve) - { - $bankline=new AccountLine($db); - - if (isset($_POST['rowid']) && is_array($_POST['rowid'])) - { - foreach($_POST['rowid'] as $row) - { - if($row > 0) - { - $result=$bankline->fetch($row); - $bankline->num_releve=$num_releve; //$_POST["num_releve"]; - $result=$bankline->update_conciliation($user,$_POST["cat"]); - if ($result < 0) - { - setEventMessages($bankline->error, $bankline->errors, 'errors'); - $error++; - break; - } - } - } - } - } - else - { - $error++; - $langs->load("errors"); - setEventMessages($langs->trans("ErrorPleaseTypeBankTransactionReportName"), null, 'errors'); - } - - if (! $error) - { - header('Location: '.DOL_URL_ROOT.'/compta/bank/rappro.php?account='.$id); // To avoid to submit twice and allow back - exit; - } -} - -/* - * Action suppression ecriture - */ -if ($action == 'del') -{ - $bankline=new AccountLine($db); - - if ($bankline->fetch($_GET["rowid"]) > 0) { - $result = $bankline->delete($user); - if ($result < 0) { - dol_print_error($db, $bankline->error); - } - } else { - setEventMessage($langs->trans('ErrorRecordNotFound'), 'errors'); - } -} - -require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/bankcateg.class.php'; -$bankcateg = new BankCateg($db); -$options = array(); - -foreach ($bankcateg->fetchAll() as $bankcategory) { - $options[$bankcategory->id] = $bankcategory->label; -} - -/* - * View - */ - -$form=new Form($db); - -llxHeader(); - -$societestatic=new Societe($db); -$chargestatic=new ChargeSociales($db); -$memberstatic=new Adherent($db); -$paymentstatic=new Paiement($db); -$paymentsupplierstatic=new PaiementFourn($db); -$paymentvatstatic=new TVA($db); -$remisestatic = new RemiseCheque($db); - -$acct = new Account($db); -$acct->fetch($id); - -$now=dol_now(); - -$sql = "SELECT b.rowid, b.dateo as do, b.datev as dv, b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type as type"; -$sql.= ", b.fk_bordereau"; -$sql.= ", bc.ref"; -$sql.= " FROM ".MAIN_DB_PREFIX."bank as b"; -$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bordereau_cheque as bc ON bc.rowid=b.fk_bordereau'; -$sql.= " WHERE rappro=0 AND fk_account=".$acct->id; -$sql.= " ORDER BY $sortfield $sortorder"; -$sql.= " LIMIT 1000"; // Limit to avoid page overload - -/// ajax adjust value date -print ' - - -'; - -$resql = $db->query($sql); -if ($resql) -{ - $var=True; - $num = $db->num_rows($resql); - - print load_fiche_titre($langs->trans("Reconciliation").': '.$acct->label.'', '', 'title_bank.png'); - print '
'; - - // Show last bank receipts - $nbmax=15; // We accept to show last 15 receipts (so we can have more than one year) - $liste=""; - $sql = "SELECT DISTINCT num_releve FROM ".MAIN_DB_PREFIX."bank"; - $sql.= " WHERE fk_account=".$acct->id." AND num_releve IS NOT NULL"; - $sql.= $db->order("num_releve","DESC"); - $sql.= $db->plimit($nbmax+1); - print $langs->trans("LastAccountStatements").' : '; - $resqlr=$db->query($sql); - if ($resqlr) - { - $numr=$db->num_rows($resqlr); - $i=0; - $last_ok=0; - while (($i < $numr) && ($i < $nbmax)) - { - $objr = $db->fetch_object($resqlr); - if (! $last_ok) { - $last_releve = $objr->num_releve; - $last_ok=1; - } - $i++; - $liste=''.$objr->num_releve.'   '.$liste; - } - if ($numr >= $nbmax) $liste="...   ".$liste; - print $liste; - if ($numr > 0) print '

'; - else print ''.$langs->trans("None").'

'; - } - else - { - dol_print_error($db); - } - - - print ''; - print ''; - print ''; - print ''; - - print ''.$langs->trans("InputReceiptNumber").': '; - print ''; // The only default value is value we just entered - print '
'; - if ($options) { - print $langs->trans("EventualyAddCategory").': '; - print Form::selectarray('cat', $options, GETPOST('cat'), 1); - print '
'; - } - print '
'.$langs->trans("ThenCheckLinesAndConciliate").' "'.$langs->trans("Conciliate").'"
'; - - print '
'; - - $paramlist=''; - $paramlist.="&account=".$acct->id; - - print '
'.$langs->trans("Ref")."
'; - print ''."\n"; - print_liste_field_titre($langs->trans("DateOperationShort"),$_SERVER["PHP_SELF"],"b.dateo","",$paramlist,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("DateValueShort"),$_SERVER["PHP_SELF"],"b.datev","",$paramlist,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"b.fk_type","",$paramlist,'align="left"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Description"),$_SERVER["PHP_SELF"],"b.label","",$paramlist,'align="left"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Debit"),$_SERVER["PHP_SELF"],"b.amount","",$paramlist,' width="60 align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Credit"),$_SERVER["PHP_SELF"],"b.amount","",$paramlist,' width="60 align="right"',$sortfield,$sortorder); - print_liste_field_titre('',$_SERVER["PHP_SELF"],"","",$paramlist,' width="80 align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("ToConciliate"),$_SERVER["PHP_SELF"],"","",$paramlist,' align="center" width="80" ',$sortfield,$sortorder); - print "\n"; - - - $i = 0; - while ($i < $num) - { - $objp = $db->fetch_object($resql); - - $var=!$var; - print "\n"; -// print ''; -// print ''; - -// print "rowid."\">"; - - // Date op - print ''; - - // Date value - if (! $objp->rappro && ($user->rights->banque->modifier || $user->rights->banque->consolidate)) - { - print ''; - } - else - { - print ''; - } - - // Type + Number - $label=($langs->trans("PaymentType".$objp->type)!="PaymentType".$objp->type)?$langs->trans("PaymentType".$objp->type):$objp->type; // $objp->type is a code - if ($label=='SOLD') $label=''; - $link=''; - if ($objp->fk_bordereau>0) { - $remisestatic->id = $objp->fk_bordereau; - $remisestatic->ref = $objp->number; - $link = ' '.$remisestatic->getNomUrl(1); - } - print ''; - - // Description - print ''; - - if ($objp->amount < 0) - { - print "\n"; - } - else - { - print "\n"; - } - - if ($objp->rappro) - { - // If line already reconciliated, we show receipt - print ""; - } - else - { - // If not already reconciliated - if ($user->rights->banque->modifier) - { - print '"; - } - else - { - print ""; - } - } - - - // Show checkbox for conciliation - if ($db->jdate($objp->do) <= $now) - { - - print '"; - } - else - { - print ''; - } - - print "\n"; - - $i++; - } - $db->free($resql); - - print "
'.dol_print_date($db->jdate($objp->do),"day").''."\n"; - print ''.dol_print_date($db->jdate($objp->dv),"day").""; - print ' '; - print ''; - print ''; - print img_edit_remove() . " "; - print ''; - print img_edit_add() .""; - print ''; - print ''; - print dol_print_date($db->jdate($objp->dv),"day"); - print ''.$label.($objp->num_chq?' '.$objp->num_chq:'').$link.''; - $reg=array(); - preg_match('/\((.+)\)/i',$objp->label,$reg); // Si texte entoure de parentheses on tente recherche de traduction - if ($reg[1] && $langs->trans($reg[1])!=$reg[1]) print $langs->trans($reg[1]); - else print $objp->label; - print ''; - - /* - * Ajout les liens (societe, company...) - */ - $newline=1; - $links = $acct->get_url($objp->rowid); - foreach($links as $key=>$val) - { - if ($newline == 0) print ' - '; - else if ($newline == 1) print '
'; - if ($links[$key]['type']=='payment') { - $paymentstatic->id=$links[$key]['url_id']; - print ' '.$paymentstatic->getNomUrl(2); - $newline=0; - } - elseif ($links[$key]['type']=='payment_supplier') { - $paymentsupplierstatic->id=$links[$key]['url_id']; - $paymentsupplierstatic->ref=$links[$key]['label']; - print ' '.$paymentsupplierstatic->getNomUrl(1); - $newline=0; - } - elseif ($links[$key]['type']=='company') { - $societestatic->id=$links[$key]['url_id']; - $societestatic->name=$links[$key]['label']; - print $societestatic->getNomUrl(1,'',24); - $newline=0; - } - else if ($links[$key]['type']=='sc') { - $chargestatic->id=$links[$key]['url_id']; - $chargestatic->ref=$links[$key]['url_id']; - $chargestatic->lib=$langs->trans("SocialContribution"); - print ' '.$chargestatic->getNomUrl(1); - } - else if ($links[$key]['type']=='payment_sc') - { - // We don't show anything because there is 1 payment for 1 social contribution and we already show link to social contribution - /*print ''; - print img_object($langs->trans('ShowPayment'),'payment').' '; - print $langs->trans("SocialContributionPayment"); - print '';*/ - $newline=2; - } - else if ($links[$key]['type']=='payment_vat') - { - $paymentvatstatic->id=$links[$key]['url_id']; - $paymentvatstatic->ref=$links[$key]['url_id']; - $paymentvatstatic->ref=$langs->trans("VATPayment"); - print ' '.$paymentvatstatic->getNomUrl(1); - } - else if ($links[$key]['type']=='banktransfert') { - print ''; - print img_object($langs->trans('ShowTransaction'),'payment').' '; - print $langs->trans("TransactionOnTheOtherAccount"); - print ''; - } - else if ($links[$key]['type']=='member') { - print ''; - print img_object($langs->trans('ShowMember'),'user').' '; - print $links[$key]['label']; - print ''; - } - else { - //print ' - '; - print ''; - if (preg_match('/^\((.*)\)$/i',$links[$key]['label'],$reg)) - { - // Label generique car entre parentheses. On l'affiche en le traduisant - if ($reg[1]=='paiement') $reg[1]='Payment'; - print $langs->trans($reg[1]); - } - else - { - print $links[$key]['label']; - } - print ''; - $newline=0; - } - } - print '
".price($objp->amount * -1)."  ".price($objp->amount)."num_releve&account=$acct->id\">$objp->num_releve'; - - print ''; - print img_edit(); - print '  '; - - $now=dol_now(); - if ($db->jdate($objp->do) <= $now) { - print ''; - print img_delete(); - print ''; - } - else { - print " "; // We prevents the deletion because reconciliation can not be achieved until the date has elapsed and that writing appears well on the account. - } - print " '; - print 'rowid])?' checked':'').'>'; - print "'; - print $langs->trans("FutureTransaction"); - print '

\n"; - - print '

'; - - print "\n"; - -} -else -{ - dol_print_error($db); -} - - -llxFooter(); - -$db->close(); diff --git a/htdocs/compta/bank/releve.php b/htdocs/compta/bank/releve.php index 7a7941da64d..8c694a949a3 100644 --- a/htdocs/compta/bank/releve.php +++ b/htdocs/compta/bank/releve.php @@ -21,7 +21,7 @@ /** * \file htdocs/compta/bank/releve.php * \ingroup banque - * \brief Page to show a bank receipt report + * \brief Page to show a bank statement report */ require('../../main.inc.php'); @@ -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); @@ -124,30 +126,19 @@ if (empty($num)) $head=bank_prepare_head($object); dol_fiche_head($head,'statement',$langs->trans("FinancialAccount"),0,'account'); - print ''; - $linkback = ''.$langs->trans("BackToList").''; - - // Ref - print ''; - print ''; - - // Label - print ''; - print ''; - - print '
'.$langs->trans("Ref").''; - print $form->showrefnav($object, 'ref', $linkback, 1, 'ref'); - print '
'.$langs->trans("Label").''.$object->label.'
'; - + + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '', 1); + dol_fiche_end(); + print '
'; if ($object->canBeConciliated() > 0) { // If not cash account and can be reconciliate if ($user->rights->banque->consolidate) { - print ''.$langs->trans("Conciliate").''; + print ''.$langs->trans("Conciliate").''; } else { print ''.$langs->trans("Conciliate").''; } @@ -284,7 +275,7 @@ else $mesprevnext.=''; @@ -295,7 +286,7 @@ else print ''; print ""; - print ''; + print '
'; print ''; print ''; print ''; @@ -339,12 +330,12 @@ else $result = $db->query($sql); if ($result) { - $var=True; + $var=False; $numrows = $db->num_rows($result); $i = 0; // Ligne Solde debut releve - print ""; + print ""; print "\n"; while ($i < $numrows) @@ -360,13 +351,14 @@ else // Date de valeur print '\n"; - + print ''; + // Type and num if ($objp->fk_type == 'SOLD') { $type_label=' '; @@ -469,7 +461,7 @@ else $newline=0; } elseif ($links[$key]['type']=='sc') { - print ''; + print ''; print img_object($langs->trans('ShowBill'),'bill').' '; print $langs->trans("SocialContribution"); print ''; diff --git a/htdocs/compta/bank/search.php b/htdocs/compta/bank/search.php deleted file mode 100644 index 8860fa7c4ab..00000000000 --- a/htdocs/compta/bank/search.php +++ /dev/null @@ -1,386 +0,0 @@ - - * Copyright (C) 2004-2015 Laurent Destailleur - * Copyright (C) 2005-2010 Regis Houssin - * Copyright (C) 2012 Vinícius Nogueira - * Copyright (C) 2014 Florian Henry - * Copyright (C) 2015 Jean-François Ferry - * - * 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 . - */ - -/** - * \file htdocs/compta/bank/search.php - * \ingroup banque - * \brief List of bank transactions - */ - -require('../../main.inc.php'); -require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/bankcateg.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; - -$langs->load("banks"); -$langs->load("categories"); -$langs->load("companies"); -$langs->load("margins"); - -// Security check -if ($user->societe_id) $socid=$user->societe_id; -$result=restrictedArea($user,'banque'); - -$description=GETPOST("description",'alpha'); -$debit=GETPOST("debit",'alpha'); -$credit=GETPOST("credit",'alpha'); -$type=GETPOST("type",'alpha'); -$account=GETPOST("account",'alpha'); -$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')); -$search_thirdparty=GETPOST("thirdparty",'alpha'); -$search_req_nb=GETPOST("req_nb",'alpha'); - -$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 (! $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 -{ - $description=""; - $type=""; - $debit=""; - $credit=""; - $account=""; - $bid=""; - $search_req_nb=''; - $search_thirdparty=''; - $thirdparty=''; -} - - -/* - * View - */ - -$companystatic=new Societe($db); -$bankaccountstatic=new Account($db); - -llxHeader('', $langs->trans("BankTransactions"), '', '', 0, 0, array(), array(), $param); - -$form = new Form($db); -$formother = new FormOther($db); - -if ($vline) $viewline = $vline; -else $viewline = 50; - -$sql = "SELECT b.rowid, b.dateo as do, b.datev as dv, b.amount, b.label, b.rappro, b.num_releve, b.num_chq,"; -$sql.= " b.fk_account, b.fk_type,"; -$sql.= " ba.rowid as bankid, ba.ref as bankref,"; -$sql.= " bu.url_id,"; -$sql.= " s.nom, s.name_alias, s.client, s.fournisseur, s.code_client, s.code_fournisseur"; -$sql.= " FROM "; -if ($bid) $sql.= MAIN_DB_PREFIX."bank_class as l,"; -$sql.= " ".MAIN_DB_PREFIX."bank_account as ba,"; -$sql.= " ".MAIN_DB_PREFIX."bank as b"; -$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_url as bu ON bu.fk_bank = b.rowid AND type = 'company'"; -$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)."' "; -} -// 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) . "'"; -} -// Search criteria amount -$debit = price2num(str_replace('-','',$debit)); -$credit = price2num(str_replace('-','',$credit)); -if ($debit) $sql.= natural_search('- b.amount', $debit, 1); -if ($credit) $sql.= natural_search('b.amount', $credit, 1); -$sql.= $db->order($sortfield,$sortorder); - -$nbtotalofrecords = 0; -if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) -{ - $result = $db->query($sql); - $nbtotalofrecords = $db->num_rows($result); -} - -$sql.= $db->plimit($limit+1,$offset); - -dol_syslog('compta/bank/search.php::', LOG_DEBUG); -$resql = $db->query($sql); -if ($resql) -{ - $var=True; - $num = $db->num_rows($resql); - $i = 0; - - print '
'."\n"; - if ($optioncss != '') print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - print ''; - if (! empty($_REQUEST['bid'])) print ''; - - // Title - $bankcateg=new BankCateg($db); - if (GETPOST("bid")) - { - $result=$bankcateg->fetch(GETPOST("bid")); - print_barre_liste($langs->trans("BankTransactionForCategory",$bankcateg->label).' '.($socid?' '.$soc->name:''), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_bank.png', 0, '', '', $limit); - } - else - { - print_barre_liste($langs->trans("BankTransactions"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_bank.png', 0, '', '', $limit); - } - - $moreforfilter = ''; - $moreforfilter.='
'; - $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 .= ' - '; - $moreforfilter .= $langs->trans('DateEnd') . ' ' . $form->select_date($search_dt_end, 'search_end_dt', 0, 0, 1, "search_form", 1, 0, 1); - $moreforfilter .= '
'; - - if ($moreforfilter) - { - print '
'; - print $moreforfilter; - print '
'."\n"; - } - - print '
'.$langs->trans("DateOperationShort").''.$langs->trans("DateValueShort").'
id."\"> 
id."\"> ".$langs->trans("InitialBankBalance")." :".price($total)." 
'; - print ''; - print img_previous().' '; print dol_print_date($db->jdate($objp->dv),"day") .' '; + print ''; + print img_edit_remove() . " "; print ''; - print img_next().''; + print img_edit_add() .""; print "
'."\n"; - print ''; - print_liste_field_titre($langs->trans('Ref'),$_SERVER['PHP_SELF'],'b.rowid','',$param,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('DateOperationShort'),$_SERVER['PHP_SELF'],'b.dateo','',$param,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('Value'),$_SERVER['PHP_SELF'],'b.datev','',$param,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Type"),$_SERVER['PHP_SELF'],'','',$param,'align="center"',$sortfield,$sortorder); - 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(''); - print "\n"; - - print ''; - print ''; - print ''; - print ''; - print ''; - // Numero - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print "\n"; - - // Loop on each record - $total_debit=0; - $total_credit=0; - while ($i < min($num,$limit)) { - $objp = $db->fetch_object($resql); - $printline=false; - //Search Description - if ($description) { - preg_match('/\((.+)\)/i',$objp->label,$reg); // Si texte entoure de parenthese on tente recherche de traduction - if ($reg[1]) { - if ($langs->transnoentities($reg[1])==$description) { - $printline=true; - } - } elseif ($objp->label==$description) { - $printline=true; - } - } else { - $printline=true; - } - - if ($printline) { - $var=!$var; - - print ""; - - // Ref - print ''; - - // Date ope - print '\n"; - - // Date value - print '\n"; - - // Payment type - print '\n"; - - // Num - print '\n"; - - // Description - print "'; - - // Third party - print "'; - - // Debit/Credit - if ($objp->amount < 0) - { - print '\n"; - $total_debit+=$objp->amount; - } - else - { - print "\n"; - $total_credit+=$objp->amount; - } - - // Bank account - print '\n"; - - print ''; - - print ""; - } - $i++; - } - if ($num>0) { - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - } - - print "
   '; - $form->select_types_paiements(empty($type)?'':$type, 'type', '', 2, 0, 1); - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - $searchpitco=$form->showFilterAndCheckAddButtons(0); - print $searchpitco; - print '
'; - print "rowid.'">'.img_object($langs->trans("ShowPayment").': '.$objp->rowid, 'payment', 'class="classfortooltip"').' '.$objp->rowid."   "; - print ''.dol_print_date($db->jdate($objp->do),"day")."'.dol_print_date($db->jdate($objp->dv),"day")."'; - $labeltype=($langs->trans("PaymentTypeShort".$objp->fk_type)!="PaymentTypeShort".$objp->fk_type)?$langs->trans("PaymentTypeShort".$objp->fk_type):$langs->getLabelFromKey($db,$objp->fk_type,'c_paiement','code','libelle'); - if ($labeltype == 'SOLD') print ' '; //$langs->trans("InitialBankBalance"); - else print $labeltype; - print "'.($objp->num_chq?$objp->num_chq:"").""; - - print "rowid."&account=".$objp->fk_account."\">"; - $reg=array(); - preg_match('/\((.+)\)/i',$objp->label,$reg); // Si texte entoure de parenthee on tente recherche de traduction - if ($reg[1] && $langs->trans($reg[1])!=$reg[1]) print $langs->trans($reg[1]); - else print dol_trunc($objp->label,40); - print " "; - - print '"; - if ($objp->url_id) - { - $companystatic->id=$objp->url_id; - $companystatic->name=$objp->nom; - $companystatic->name_alias=$objp->name_alias; - $companystatic->client=$objp->client; - $companystatic->fournisseur=$objp->fournisseur; - $companystatic->code_client=$objp->code_client; - $companystatic->code_fournisseur=$objp->code_fournisseur; - print $companystatic->getNomUrl(1); - } - else - { - print ' '; - } - print ''.price($objp->amount * -1)."  ".price($objp->amount)."'; - $bankaccountstatic->id=$objp->bankid; - $bankaccountstatic->label=$objp->bankref; - print $bankaccountstatic->getNomUrl(1); - print "
' . $langs->trans('Total') . '' . price($total_debit * - 1) . '' . price($total_credit) . '
"; - print ''; - $db->free($resql); -} -else -{ - dol_print_error($db); -} - -// If no data to display after a search -if ($_POST["action"] == "search" && ! $num) -{ - print '
'.$langs->trans("NoRecordFound").'
'; -} - -llxFooter(); - -$db->close(); diff --git a/htdocs/compta/bank/virement.php b/htdocs/compta/bank/transfer.php similarity index 88% rename from htdocs/compta/bank/virement.php rename to htdocs/compta/bank/transfer.php index 146ed4759c4..9e26d532348 100644 --- a/htdocs/compta/bank/virement.php +++ b/htdocs/compta/bank/transfer.php @@ -21,7 +21,7 @@ */ /** - * \file htdocs/compta/bank/virement.php + * \file htdocs/compta/bank/transfer.php * \ingroup banque * \brief Page de saisie d'un virement */ @@ -91,11 +91,11 @@ if ($action == 'add') $result=0; // By default, electronic transfert from bank to bank - $typefrom='PRE'; + $typefrom='VIR'; $typeto='VIR'; if ($accountto->courant == Account::TYPE_CASH || $accountfrom->courant == Account::TYPE_CASH) { - // This is transfert of change + // This is transfer of change $typefrom='LIQ'; $typeto='LIQ'; } @@ -112,7 +112,7 @@ if ($action == 'add') if (! $error) { - $mesgs = $langs->trans("TransferFromToDone","id."\">".$accountfrom->label."","id."\">".$accountto->label."",$amount,$langs->transnoentities("Currency".$conf->currency)); + $mesgs = $langs->trans("TransferFromToDone","id."\">".$accountfrom->label."","id."\">".$accountto->label."",$amount,$langs->transnoentities("Currency".$conf->currency)); setEventMessages($mesgs, null, 'mesgs'); $db->commit(); } @@ -152,12 +152,12 @@ if($error) $amount = GETPOST('amount','int'); } -print load_fiche_titre($langs->trans("BankTransfer"), '', 'title_bank.png'); +print load_fiche_titre($langs->trans("MenuBankInternalTransfer"), '', 'title_bank.png'); print $langs->trans("TransferDesc"); print "

"; -print "
"; +print ''; print ''; print ''; @@ -179,8 +179,8 @@ print "\n"; print ""; $form->select_date((! empty($dateo)?$dateo:''),'','','','','add'); print "\n"; -print ''; -print ''; +print ''; +print ''; print ""; diff --git a/htdocs/compta/bank/treso.php b/htdocs/compta/bank/treso.php index 26be80caa68..3de977f29cf 100644 --- a/htdocs/compta/bank/treso.php +++ b/htdocs/compta/bank/treso.php @@ -3,6 +3,7 @@ * Copyright (C) 2008-2009 Laurent Destailleur (Eldy) * Copyright (C) 2008 Raphael Bertrand (Resultic) * Copyright (C) 2015 Marcos García * * 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 @@ -21,7 +22,7 @@ /** * \file htdocs/compta/bank/treso.php * \ingroup banque - * \brief Page de detail du budget de tresorerie + * \brief Page to estimate future balance */ require '../../main.inc.php'; @@ -54,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); @@ -74,42 +77,32 @@ if ($_REQUEST["account"] || $_REQUEST["ref"]) $viewline = 20; } - $acct = new Account($db); + $object = new Account($db); if ($_GET["account"]) { - $result=$acct->fetch($_GET["account"]); + $result=$object->fetch($_GET["account"]); } if ($_GET["ref"]) { - $result=$acct->fetch(0,$_GET["ref"]); - $_GET["account"]=$acct->id; + $result=$object->fetch(0,$_GET["ref"]); + $_GET["account"]=$object->id; } // Onglets - $head=bank_prepare_head($acct); + $head=bank_prepare_head($object); dol_fiche_head($head,'cash',$langs->trans("FinancialAccount"),0,'account'); print ''; $linkback = ''.$langs->trans("BackToList").''; - // Ref - print ''; - print ''; - - // Label - print ''; - print ''; - - print '
'.$langs->trans("Ref").''; - print $form->showrefnav($acct, 'ref', $linkback, 1, 'ref'); - print '
'.$langs->trans("Label").''.$acct->label.'
'; + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); dol_fiche_end(); - $solde = $acct->solde(0); + $solde = $object->solde(0); /* * Affiche tableau des echeances a venir @@ -151,7 +144,7 @@ if ($_REQUEST["account"] || $_REQUEST["ref"]) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON f.fk_soc = s.rowid"; $sql.= " WHERE f.entity = ".$conf->entity; $sql.= " AND f.paye = 0 AND f.fk_statut = 1"; // Not paid - $sql.= " AND (f.fk_account IN (0, ".$acct->id.") OR f.fk_account IS NULL)"; // Id bank account of invoice + $sql.= " AND (f.fk_account IN (0, ".$object->id.") OR f.fk_account IS NULL)"; // Id bank account of invoice $sql.= " ORDER BY dlr ASC"; // Supplier invoices @@ -161,15 +154,17 @@ if ($_REQUEST["account"] || $_REQUEST["ref"]) $sql2.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON ff.fk_soc = s.rowid"; $sql2.= " WHERE ff.entity = ".$conf->entity; $sql2.= " AND ff.paye = 0 AND fk_statut = 1"; // Not paid - $sql2.= " AND (ff.fk_account IN (0, ".$acct->id.") OR ff.fk_account IS NULL)"; // Id bank account of supplier invoice + $sql2.= " AND (ff.fk_account IN (0, ".$object->id.") OR ff.fk_account IS NULL)"; // Id bank account of supplier invoice $sql2.= " ORDER BY dlr ASC"; // Social contributions $sql3= " SELECT 'social_contribution' as family, cs.rowid as objid, cs.libelle as ref, (-1*cs.amount) as total_ttc, ccs.libelle as type, cs.date_ech as dlr"; + $sql3.= ", cs.fk_account"; $sql3.= " FROM ".MAIN_DB_PREFIX."chargesociales as cs"; $sql3.= " LEFT JOIN ".MAIN_DB_PREFIX."c_chargesociales as ccs ON cs.fk_type = ccs.id"; $sql3.= " WHERE cs.entity = ".$conf->entity; $sql3.= " AND cs.paye = 0"; // Not paid + $sql3.= " AND (cs.fk_account IN (0, ".$object->id.") OR cs.fk_account IS NULL)"; // Id bank account of social contribution $sql3.= " ORDER BY dlr ASC"; $error=0; @@ -327,8 +322,8 @@ if ($_REQUEST["account"] || $_REQUEST["ref"]) // Solde actuel $var=!$var; print ''; - print ''.$langs->trans("FutureBalance").' ('.$acct->currency_code.')'; - print ''.price($solde, 0, $langs, 0, 0, -1, $acct->currency_code).''; + print ''.$langs->trans("FutureBalance").' ('.$object->currency_code.')'; + print ''.price($solde, 0, $langs, 0, 0, -1, $object->currency_code).''; print ''; print ""; diff --git a/htdocs/compta/charges/index.php b/htdocs/compta/charges/index.php index 3f794491566..3b74833f23a 100644 --- a/htdocs/compta/charges/index.php +++ b/htdocs/compta/charges/index.php @@ -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 "\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 ''; if ($obj->payment_code) print $langs->trans("PaymentTypeShort".$obj->payment_code).' '; print $obj->num_payment.''; + // Account + if (! empty($conf->banque->enabled)) + { + print ''; + 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 ''; + } // Paid print ''; if ($obj->totalpaye) print price($obj->totalpaye); @@ -205,6 +227,7 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) print ' '; print ' '; print ' '; + if (! empty($conf->banque->enabled)) print ''; print ''.price($totalpaye).""; print ""; } @@ -280,8 +303,7 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) } print ''.$langs->trans("Total").''; print ''.price($total).''; - print ' '; - print ' '; + print ' '; print ''.price($total).""; print ""; @@ -349,7 +371,6 @@ while($j<$numlt) print ''; 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 "".$obj->label."\n"; - print ''.price($obj->amount).""; - // Ref payment $tva_static->id=$obj->rowid; $tva_static->ref=$obj->rowid; @@ -380,10 +399,7 @@ while($j<$numlt) $i++; } - print ''.$langs->trans("Total").''; - print ''.price($total).""; - print ' '; - print ' '; + print ''.$langs->trans("Total").''; print ''.price($total).""; print ""; @@ -431,7 +447,6 @@ if (! empty($conf->salaries->enabled) && $user->rights->salaries->read) print ''; 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 "".$obj->label."\n"; - print ''.($obj->salary?price($obj->salary):'').""; - // 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 ''.$langs->trans("Total").''; - print ''; // A total here has no sense - print ' '; - print ' '; + print ''.$langs->trans("Total").''; print ''.price($total).""; print ""; diff --git a/htdocs/compta/clients.php b/htdocs/compta/clients.php index 6c2d9023902..db9d4e623ca 100644 --- a/htdocs/compta/clients.php +++ b/htdocs/compta/clients.php @@ -43,7 +43,6 @@ accessforbidden(); $langs->load("companies"); $mode=GETPOST("mode"); -$modesearch=GETPOST("mode_search"); $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); @@ -70,20 +69,15 @@ if ($action == 'note') $result = $db->query($sql); } -if ($mode == 'search') { - if ($modesearch == 'soc') { - $sql = "SELECT s.rowid FROM ".MAIN_DB_PREFIX."societe as s "; - $sql.= " WHERE s.nom LIKE '%".$db->escape(strtolower($socname))."%'"; - $sql.= " AND s.entity IN (".getEntity('societe', 1).")"; - } - +if ($mode == 'search') +{ $resql=$db->query($sql); if ($resql) { if ( $db->num_rows($resql) == 1) { $obj = $db->fetch_object($resql); $socid = $obj->rowid; } - $db->free(); + $db->free($resql); } } diff --git a/htdocs/compta/deplacement/card.php b/htdocs/compta/deplacement/card.php index 934c970accf..bf3e311c313 100644 --- a/htdocs/compta/deplacement/card.php +++ b/htdocs/compta/deplacement/card.php @@ -213,13 +213,13 @@ else if ($action == 'setdated' && $user->rights->deplacement->creer) { $dated=dol_mktime(GETPOST('datedhour','int'), GETPOST('datedmin','int'), GETPOST('datedsec','int'), GETPOST('datedmonth','int'), GETPOST('datedday','int'), GETPOST('datedyear','int')); $object->fetch($id); - $result=$object->setValueFrom('dated',$dated,'','','date'); + $result=$object->setValueFrom('dated', $dated, '', '', 'date', '', $user, 'DEPLACEMENT_MODIFY'); if ($result < 0) dol_print_error($db, $object->error); } else if ($action == 'setkm' && $user->rights->deplacement->creer) { $object->fetch($id); - $result=$object->setValueFrom('km',GETPOST('km','int')); + $result=$object->setValueFrom('km', GETPOST('km','int'), '', null, 'text', '', $user, 'DEPLACEMENT_MODIFY'); if ($result < 0) dol_print_error($db, $object->error); } diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 375288ce754..2f4f887f652 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -66,7 +66,6 @@ if (!empty($conf->incoterm->enabled)) $langs->load('incoterm'); if (! empty($conf->margin->enabled)) $langs->load('margins'); -$sall = trim(GETPOST('sall')); $projectid = (GETPOST('projectid') ? GETPOST('projectid', 'int') : 0); $id = (GETPOST('id', 'int') ? GETPOST('id', 'int') : GETPOST('facid', 'int')); // For backward compatibility @@ -134,14 +133,6 @@ if (empty($reshook)) include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; // Must be include, not include_once - // Link invoice to order - if (GETPOST('linkedOrder') && empty($cancel) && $id > 0) - { - $object->fetch($id); - $object->fetch_thirdparty(); - $result = $object->add_object_linked('commande', GETPOST('linkedOrder')); - } - // Action clone object if ($action == 'confirm_clone' && $confirm == 'yes' && $user->rights->facture->creer) { // if (1 == 0 && empty($_REQUEST["clone_content"]) && empty($_REQUEST["clone_receivers"])) { @@ -163,7 +154,7 @@ if (empty($reshook)) // Change status of invoice else if ($action == 'reopen' && $user->rights->facture->creer) { $result = $object->fetch($id); - if ($object->statut == 2 || ($object->statut == 3 && $object->close_code != 'replaced')) { + if ($object->statut == 2 || ($object->statut == 3 && $object->close_code != 'replaced') || ($object->statut == 1 && $object->paye == 1)) { // ($object->statut == 1 && $object->paye == 1) should not happened but can be found when data are corrupted $result = $object->set_unpaid($user); if ($result > 0) { header('Location: ' . $_SERVER["PHP_SELF"] . '?facid=' . $id); @@ -188,7 +179,7 @@ if (empty($reshook)) $qualified_for_stock_change = $object->hasProductsOrServices(1); } - $result = $object->delete(0, 0, $idwarehouse); + $result = $object->delete($user, 0, $idwarehouse); if ($result > 0) { header('Location: ' . DOL_URL_ROOT . '/compta/facture/list.php'); exit(); @@ -263,7 +254,7 @@ if (empty($reshook)) else if ($action == 'set_thirdparty' && $user->rights->facture->creer) { $object->fetch($id); - $object->setValueFrom('fk_soc', $socid); + $object->setValueFrom('fk_soc', $socid, '', null, 'int', '', $user, 'BILL_MODIFY'); header('Location: ' . $_SERVER["PHP_SELF"] . '?facid=' . $id); exit(); @@ -290,9 +281,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); @@ -320,7 +311,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); @@ -404,10 +395,10 @@ if (empty($reshook)) } } - else if ($action == 'set_ref_client' && $user->rights->facture->creer) + else if ($action == 'setref_client' && $user->rights->facture->creer) { $object->fetch($id); - $object->set_ref_client($_POST['ref_client']); + $object->set_ref_client(GETPOST('ref_client')); } // Classify to validated @@ -438,7 +429,7 @@ if (empty($reshook)) } } } - + $qualified_for_stock_change = 0; if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) { $qualified_for_stock_change = $object->hasProductsOrServices(2); @@ -713,7 +704,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']); @@ -766,7 +757,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'); @@ -788,7 +779,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; @@ -864,7 +855,7 @@ if (empty($reshook)) } } - // Standard invoice or Deposit invoice created from a Predefined template invoice + // Standard invoice or Deposit invoice, created from a Predefined template invoice if (($_POST['type'] == Facture::TYPE_STANDARD || $_POST['type'] == Facture::TYPE_DEPOSIT) && GETPOST('fac_rec') > 0) { $dateinvoice = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); @@ -875,7 +866,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'); @@ -899,11 +890,11 @@ 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'); - $id = $object->create($user); + $id = $object->create($user); // This include recopy of links from recurring invoice } } @@ -924,7 +915,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 @@ -1011,8 +1002,8 @@ if (empty($reshook)) $object->linked_objects = array_merge($object->linked_objects, $_POST['other_linked_objects']); } - $id = $object->create($user); - + $id = $object->create($user); // This include class to add_object_linked() and add add_contact() + if ($id > 0) { dol_include_once('/' . $element . '/class/' . $subelement . '.class.php'); @@ -1022,7 +1013,7 @@ if (empty($reshook)) dol_syslog("Try to find source object origin=" . $object->origin . " originid=" . $object->origin_id . " to add lines or deposit lines"); $result = $srcobject->fetch($object->origin_id); - + // If deposit invoice if ($_POST['type'] == Facture::TYPE_DEPOSIT) { @@ -1063,9 +1054,10 @@ if (empty($reshook)) $langs->trans('Deposit'), $amountdeposit, // subprice 1, // quantity - $lines[$i]->tva_tx, 0, // localtax1_tx + $lines[$i]->tva_tx, // vat rate + 0, // localtax1_tx 0, // localtax2_tx - 0, // fk_product + (empty($conf->global->INVOICE_PRODUCTID_DEPOSIT)?0:$conf->global->INVOICE_PRODUCTID_DEPOSIT), // fk_product 0, // remise_percent 0, // date_start 0, // date_end @@ -1183,7 +1175,7 @@ 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)) { @@ -1196,32 +1188,35 @@ if (empty($reshook)) } $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"; + //print $objcontact->code.'-'.$objcontact->fk_socpeople."\n"; $object->add_contact($objcontact->fk_socpeople, $objcontact->code); } } - else dol_print_error($resqlcontact); + 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) + { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); $error++; - + } + } else { setEventMessages($object->error, $object->errors, 'errors'); $error++; } - } - else + } + else { // If some invoice's lines coming from page $id = $object->create($user); @@ -1247,7 +1242,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 = '
' . $langs->trans("ErrorFieldRequired", $langs->trans("InvoiceSituation")) . '
'; @@ -1262,8 +1257,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; @@ -1393,7 +1388,7 @@ if (empty($reshook)) // Ecrase $txtva par celui du produit // Ecrase $base_price_type par celui du produit // Replaces $fk_unit with the product's - if (! empty($idprod)) + if (! empty($idprod)) { $prod = new Product($db); $prod->fetch($idprod); @@ -1404,7 +1399,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; @@ -1451,13 +1446,13 @@ if (empty($reshook)) } // On reevalue prix selon taux tva car taux tva transaction peut etre different // de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur). - elseif ($tva_tx != $prod->tva_tx) + elseif ($tva_tx != $prod->tva_tx) { - if ($price_base_type != 'HT') + if ($price_base_type != 'HT') { $pu_ht = price2num($pu_ttc / (1 + ($tva_tx / 100)), 'MU'); } - else + else { $pu_ttc = price2num($pu_ht * (1 + ($tva_tx / 100)), 'MU'); } @@ -1519,7 +1514,7 @@ if (empty($reshook)) // Local Taxes $localtax1_tx = get_localtax($tva_tx, 1, $object->thirdparty, $mysoc, $tva_npr); $localtax2_tx = get_localtax($tva_tx, 2, $object->thirdparty, $mysoc, $tva_npr); - + $info_bits = 0; if ($tva_npr) $info_bits |= 0x01; @@ -1609,7 +1604,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)) @@ -1623,7 +1618,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 - + // Extrafields $extrafieldsline = new ExtraFields($db); $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); @@ -1787,60 +1782,17 @@ if (empty($reshook)) $trigger_name='BILL_SENTBYMAIL'; $paramname='id'; $mode='emailfrominvoice'; + $trackid='inv'.$object->id; include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; - /* - * Generate document - */ - if ($action == 'builddoc') // En get ou en post - { - $object->fetch($id); - $object->fetch_thirdparty(); + // Actions to build doc + $upload_dir = $conf->facture->dir_output; + $permissioncreate=$user->rights->facture->creer; + include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; - // Save last template used to generate document - if (GETPOST('model')) - $object->setDocModel($user, GETPOST('model', 'alpha')); - if (GETPOST('fk_bank')) { // this field may come from an external module - $object->fk_bank = GETPOST('fk_bank'); - } else { - $object->fk_bank = $object->fk_account; - } - // Define output language - $outputlangs = $langs; - $newlang = ''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id'); - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; - if (! empty($newlang)) - { - $outputlangs = new Translate("", $conf); - $outputlangs->setDefaultLang($newlang); - } - $result = $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); - if ($result <= 0) - { - setEventMessages($object->error, $object->errors, 'errors'); - $action=''; - } - } - - // Remove file in doc form - else if ($action == 'remove_file') { - if ($object->fetch($id)) { - require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; - - $object->fetch_thirdparty(); - - $langs->load("other"); - $upload_dir = $conf->facture->dir_output; - $file = $upload_dir . '/' . GETPOST('file'); - $ret = dol_delete_file($file, 0, 0, 0, $object); - if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs'); - else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors'); - $action = ''; - } - } elseif ($action == 'update_extras') { + if ($action == 'update_extras') { // Fill array 'array_options' with data from add form $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); $ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute')); @@ -1928,7 +1880,9 @@ if (! empty($conf->projet->enabled)) { $formproject = new FormProjets($db); } $now = dol_now(); -llxHeader('', $langs->trans('Bill'), '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 @@ -1945,7 +1899,7 @@ if ($action == 'create') $res = $soc->fetch($socid); $currency_code = $conf->currency; - + // Load objectsrc $remise_absolue = 0; @@ -2007,7 +1961,7 @@ if ($action == 'create') if (empty($socid)) $soc = $objectsrc->thirdparty; - $cond_reglement_id = (! empty($objectsrc->cond_reglement_id)?$objectsrc->cond_reglement_id:(! empty($soc->cond_reglement_id)?$soc->cond_reglement_id:1)); + $cond_reglement_id = (! empty($objectsrc->cond_reglement_id)?$objectsrc->cond_reglement_id:(! empty($soc->cond_reglement_id)?$soc->cond_reglement_id:0)); $mode_reglement_id = (! empty($objectsrc->mode_reglement_id)?$objectsrc->mode_reglement_id:(! empty($soc->mode_reglement_id)?$soc->mode_reglement_id:0)); $fk_account = (! empty($objectsrc->fk_account)?$objectsrc->fk_account:(! empty($soc->fk_account)?$soc->fk_account:0)); $remise_percent = (! empty($objectsrc->remise_percent)?$objectsrc->remise_percent:(! empty($soc->remise_percent)?$soc->remise_percent:0)); @@ -2017,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; @@ -2033,12 +1987,14 @@ 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; } - - if(!empty($soc->id)) $absolute_discount = $soc->getAvailableDiscounts(); - + + if (!empty($soc->id)) $absolute_discount = $soc->getAvailableDiscounts(); + $note_public = $object->getDefaultCreateValueFor('note_public', (is_object($objectsrc)?$objectsrc->note_public:null)); + $note_private = $object->getDefaultCreateValueFor('note_private', ((! empty($origin) && ! empty($originid) && is_object($objectsrc))?$objectsrc->note_private:null)); + if (! empty($conf->use_javascript_ajax)) { require_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; @@ -2059,7 +2015,7 @@ if ($action == 'create') } print info_admin($text, 0, 0, 0).'
'; } - + print ''; print ''; print ''; @@ -2070,7 +2026,7 @@ if ($action == 'create') print ''; print ''; if (!empty($currency_tx)) print ''; - + dol_fiche_head(''); print ''; @@ -2119,14 +2075,20 @@ if ($action == 'create') } print '' . "\n"; - // Predefined invoices + // Overwrite value if creation of invoice is from a predefined invoice if (empty($origin) && empty($originid) && GETPOST('fac_rec','int') > 0) { $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 - + if (empty($projectid)) $projectid = $invoice_predefined->fk_project; + $cond_reglement_id = $invoice_predefined->cond_reglement_id; + $mode_reglement_id = $invoice_predefined->mode_reglement_id; + $fk_account = $invoice_predefined->fk_account; + $note_public = $invoice_predefined->note_public; + $note_private = $invoice_predefined->note_private; + $sql = 'SELECT r.rowid, r.titre, r.total_ttc'; $sql .= ' FROM ' . MAIN_DB_PREFIX . 'facture_rec as r'; $sql .= ' WHERE r.fk_soc = ' . $invoice_predefined->socid; @@ -2231,31 +2193,34 @@ if ($action == 'create') if ((empty($origin)) || ((($origin == 'propal') || ($origin == 'commande')) && (! empty($originid)))) { // Deposit - print '
'; - $tmp=' '; - print ''; - - $desc = $form->textwithpicto($tmp.$langs->trans("InvoiceDeposit"), $langs->transnoentities("InvoiceDepositDesc"), 1, 'help', '', 0, 3); - print '
'; - if (($origin == 'propal') || ($origin == 'commande')) - { - print ''; - print '
'; - print $desc; - print ''; - $arraylist = array('amount' => 'FixAmount','variable' => 'VarAmount'); - print $form->selectarray('typedeposit', $arraylist, GETPOST('typedeposit'), 0, 0, 0, '', 1); - print '' . $langs->trans('Value') . ':'; - } - print '
'; - - print '
'; + if (empty($conf->global->INVOICE_DISABLE_DEPOSIT)) + { + print '
'; + $tmp=' '; + print ''; + + $desc = $form->textwithpicto($tmp.$langs->trans("InvoiceDeposit"), $langs->transnoentities("InvoiceDepositDesc"), 1, 'help', '', 0, 3); + print ''; + if (($origin == 'propal') || ($origin == 'commande')) + { + print ''; + print '
'; + print $desc; + print ''; + $arraylist = array('amount' => 'FixAmount','variable' => 'VarAmount'); + print $form->selectarray('typedeposit', $arraylist, GETPOST('typedeposit'), 0, 0, 0, '', 1); + print '' . $langs->trans('Value') . ':'; + } + print '
'; + + print '
'; + } } if ($socid > 0) @@ -2285,32 +2250,36 @@ if ($action == 'create') } // Replacement - print '
'; - $tmp=' - jQuery(document).ready(function() { - jQuery("#fac_replacement").change(function() { - jQuery("#radio_replacement").prop("checked", true); - }); - }); - '; - $text = $tmp.$langs->trans("InvoiceReplacementAsk") . ' '; - $text .= ' + jQuery(document).ready(function() { + jQuery("#fac_replacement").change(function() { + jQuery("#radio_replacement").prop("checked", true); + }); + }); + '; + $text = $tmp.$langs->trans("InvoiceReplacementAsk") . ' '; + $text .= ''; + $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceReplacementDesc"), 1, 'help', '', 0, 3); + print $desc; + print '
'; } - $text .= ''; - $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceReplacementDesc"), 1, 'help', '', 0, 3); - print $desc; - print ''; } else { @@ -2327,48 +2296,51 @@ if ($action == 'create') { if ($socid > 0) { - // Credit note - print '
'; - $tmp=' - 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(); - }); - }); - '; - $text = $tmp.$langs->transnoentities("InvoiceAvoirAsk") . ' '; - // $text.=''; - $text .= ''; - $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceAvoirDesc"), 1, 'help', '', 0, 3); - print $desc; - - print '
'; - print '    0 ? 'checked':'').' /> "; - print '
    0 ? 'checked':'').' /> "; - print '
'; - - print '
'; + // Credit note + if (empty($conf->global->INVOICE_DISABLE_CREDIT_NOTE)) + { + print '
'; + $tmp=' + 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(); + }); + }); + '; + $text = $tmp.$langs->transnoentities("InvoiceAvoirAsk") . ' '; + // $text.=''; + $text .= ''; + $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceAvoirDesc"), 1, 'help', '', 0, 3); + print $desc; + + print '
'; + print '    0 ? 'checked':'').' /> "; + print '
    0 ? 'checked':'').' /> "; + print '
'; + + print '
'; + } } else { @@ -2381,7 +2353,7 @@ if ($action == 'create') print '' . "\n"; } } - + // Template invoice print '
'; $tmp=' '; @@ -2390,7 +2362,7 @@ if ($action == 'create') $desc = $form->textwithpicto($text, $langs->transnoentities("YouMustCreateStandardInvoiceFirstDesc"), 1, 'help', '', 0, 3); print $desc; print '
'; - + print ''; print ''; @@ -2416,7 +2388,7 @@ if ($action == 'create') } // Date invoice - print '' . $langs->trans('Date') . ''; + print '' . $langs->trans('DateInvoice') . ''; $datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); print $form->select_date($datefacture?$datefacture:$dateinvoice, '', '', '', '', "add", 1, 1, 1); print ''; @@ -2429,9 +2401,9 @@ if ($action == 'create') print $form->select_date($date_pointoftax?$date_pointoftax:-1, 'date_pointoftax', '', '', '', "add", 1, 1, 1); print ''; } - + // Payment term - print '' . $langs->trans('PaymentConditionsShort') . ''; + print '' . $langs->trans('PaymentConditionsShort') . ''; $form->select_conditions_paiements(isset($_POST['cond_reglement_id']) ? $_POST['cond_reglement_id'] : $cond_reglement_id, 'cond_reglement_id'); print ''; @@ -2465,7 +2437,14 @@ if ($action == 'create') print ''; print ''; print ''; - print $form->select_incoterms((!empty($objectsrc->fk_incoterms) ? $objectsrc->fk_incoterms : ''), (!empty($objectsrc->location_incoterms)?$objectsrc->location_incoterms:'')); + $incoterm_id = GETPOST('incoterm_id'); + $incoterm_location = GETPOST('location_incoterms'); + if (empty($incoterm_id)) + { + $incoterm_id = (!empty($objectsrc->fk_incoterms) ? $objectsrc->fk_incoterms : $soc->fk_incoterms); + $incoterm_location = (!empty($objectsrc->location_incoterms) ? $objectsrc->location_incoterms : $soc->location_incoterms); + } + print $form->select_incoterms($incoterm_id, $incoterm_location); print ''; } @@ -2494,12 +2473,11 @@ if ($action == 'create') print $form->selectMultiCurrency($currency_code, 'multicurrency_code'); print ''; } - + // Public note print ''; print '' . $langs->trans('NotePublic') . ''; print ''; - $note_public = $object->getDefaultCreateValueFor('note_public', (is_object($objectsrc)?$objectsrc->note_public:null)); $doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%'); print $doleditor->Create(1); @@ -2509,7 +2487,6 @@ if ($action == 'create') print ''; print '' . $langs->trans('NotePrivate') . ''; print ''; - $note_private = $object->getDefaultCreateValueFor('note_private', ((! empty($origin) && ! empty($originid) && is_object($objectsrc))?$objectsrc->note_private:null)); $doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%'); print $doleditor->Create(1); // print ' @@ -2577,7 +2554,7 @@ if ($action == 'create') print '' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '' . price($objectsrc->total_localtax2) . ""; } print '' . $langs->trans('TotalTTC') . '' . price($objectsrc->total_ttc) . ""; - + if (!empty($conf->multicurrency->enabled)) { print '' . $langs->trans('MulticurrencyTotalHT') . '' . price($objectsrc->multicurrency_total_ht) . ''; @@ -2585,58 +2562,6 @@ if ($action == 'create') print '' . $langs->trans('MulticurrencyTotalTTC') . '' . price($objectsrc->multicurrency_total_ttc) . ""; } } - else - { - // Show deprecated optional form to add product line here - if (! empty($conf->global->PRODUCT_SHOW_WHEN_CREATE)) { - print ''; - - // Zone de choix des produits predefinis a la creation - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - if (! empty($conf->service->enabled)) { - print ''; - } - print ''; - for($i = 1; $i <= $NBLINES; $i ++) { - print ''; - print ''; - print ''; - print ''; - print ''; - // Si le module service est actif, on propose des dates de debut et fin a la ligne - if (! empty($conf->service->enabled)) { - print ''; - } - print "\n"; - } - - print '
' . $langs->trans('ProductsAndServices') . '' . $langs->trans('Qty') . '' . $langs->trans('ReductionShort') . '     ' . $langs->trans('ServiceLimitedDuration') . '
'; - // multiprix - if (! empty($conf->global->PRODUIT_MULTIPRICES)) - $form->select_produits('', 'idprod' . $i, '', $conf->product->limit_size, $soc->price_level); - else - $form->select_produits('', 'idprod' . $i, '', $conf->product->limit_size); - print '% '; - print ''; - print ''; - print '
'; - print $langs->trans('From') . ' '; - print ''; - print $form->select_date('', 'date_start' . $i, $usehm, $usehm, 1, "add", 1, 0, 1); - print '
'; - print $langs->trans('to') . ' '; - print ''; - print $form->select_date('', 'date_end' . $i, $usehm, $usehm, 1, "add", 1, 0, 1); - print '
'; - print '
'; - print ''; - } - } print "\n"; @@ -2967,78 +2892,60 @@ else if ($id > 0 || ! empty($ref)) // Invoice content - print ''; - $linkback = '' . $langs->trans("BackToList") . ''; - // Ref - print ''; - print ''; - + $morehtmlref='
'; // Ref customer - print '
'; - print ''; - - // Third party - print ''; - + $morehtmlref.=''; + + $object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status + + dol_banner_tab($object, 'ref', $linkback, 1, 'facnumber', 'ref', $morehtmlref, '', 0, '', $morehtmlright); + + print '
'; + print '
'; + print '
'; + + print '
' . $langs->trans('Ref') . ''; - $morehtmlref = ''; - $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, 'facnumber', 'ref', $morehtmlref); - print '
'; - print ''; - if ($action != 'refclient' && ! empty($object->brouillon)) - print ''; - print '
'; - print $langs->trans('RefCustomer'); - print '' . img_edit($langs->trans('Modify')) . '
'; - print '
'; - if ($user->rights->facture->creer && $action == 'refclient') { - print ''; - print ''; - print ''; - print ''; - print ' '; - print ''; - } else { - print $object->ref_client; + $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->facture->creer, 'string', '', 0, 1); + $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->facture->creer, 'string', '', null, null, '', 1); + // Thirdparty + $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); + // Project + if (! empty($conf->projet->enabled)) + { + $langs->load("projects"); + $morehtmlref.='
'.$langs->trans('Project') . ' '; + if ($user->rights->facture->creer) + { + if ($action != 'classify') + $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.='
'; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.='
'; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (! empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref.=''; + $morehtmlref.=$proj->ref; + $morehtmlref.=''; + } else { + $morehtmlref.=''; + } + } } - print '
'; - print ''; - print ''; - print ''; - print '
' . $langs->trans('Company') . ''; - if (! empty($conf->global->FACTURE_CHANGE_THIRDPARTY) && $action != 'editthirdparty' && $object->brouillon && $user->rights->facture->creer) - print 'id . '">' . img_edit($langs->trans('SetLinkToAnotherThirdParty'), 1) . '
'; - print '
'; - if ($action == 'editthirdparty') { - $form->form_thirdparty($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->socid, 'socid','client>0'); - } else { - print '  ' . $soc->getNomUrl(1, 'compta'); - print '   '; - print '(' . $langs->trans('OtherBills') . ''; - // Outstanding Bill - $outstandingBills = $soc->get_OutstandingBill(); - print ' - ' . $langs->trans('CurrentOutstandingBill') . ': '; - print price($outstandingBills, '', $langs, 0, 0, - 1, $conf->currency); - if ($soc->outstanding_limit != '') - { - if ($outstandingBills > $soc->outstanding_limit) - print img_warning($langs->trans("OutstandingBillReached")); - print ' / ' . price($soc->outstanding_limit); - } - print ')'; - } - print '
'; + // Type - print ''; - // List of payments - - $sign = 1; - if ($object->type == Facture::TYPE_CREDIT_NOTE) - $sign = - 1; - - $nbrows = 8; - $nbcols = 3; - if (! empty($conf->projet->enabled)) - $nbrows ++; - if (! empty($conf->banque->enabled)) { - $nbrows ++; $nbcols++; - } - if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) - $nbrows ++; - if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) - $nbrows ++; - if ($selleruserevenustamp) - $nbrows ++; - if (! empty($conf->multicurrency->enabled)) $nbrows+=5; - if (! empty($conf->incoterm->enabled)) $nbrows+=1; - - print ''; - if (! empty($conf->global->INVOICE_POINTOFTAX_DATE)) { // Date invoice @@ -3503,16 +3091,16 @@ else if ($id > 0 || ! empty($ref)) print ''; print ''; print '
' . $langs->trans('Type') . ''; + print '
' . $langs->trans('Type') . ''; print $object->getLibType(); if ($object->type == Facture::TYPE_REPLACEMENT) { $facreplaced = new Facture($db); @@ -3079,7 +2986,7 @@ else if ($id > 0 || ! empty($ref)) $addcreditnote = '' . $langs->trans("AddCreditNote") . ''; print '
' . $langs->trans('Discounts'); - print ''; + print ''; if ($soc->remise_percent) print $langs->trans("CompanyHasRelativeDiscount", $soc->remise_percent); else @@ -3103,7 +3010,7 @@ else if ($id > 0 || ! empty($ref)) } } } else { - // Remise dispo de type remise fixe (not credit note) + // Discount available of type fixed amount (not credit note) print '
'; $form->form_remise_dispo($_SERVER["PHP_SELF"] . '?facid=' . $object->id, GETPOST('discountid'), 'remise_id', $soc->id, $absolute_discount, $filterabsolutediscount, $resteapayer, ' (' . $addabsolutediscount . ')'); } @@ -3131,7 +3038,7 @@ else if ($id > 0 || ! empty($ref)) // Remise dispo de type avoir if (! $absolute_discount) print '
'; - // $form->form_remise_dispo($_SERVER["PHP_SELF"].'?facid='.$object->id, 0, 'remise_id_for_payment', $soc->id, $absolute_creditnote, $filtercreditnote, $resteapayer + // $form->form_remise_dispo($_SERVER["PHP_SELF"].'?facid='.$object->id, 0, 'remise_id_for_payment', $soc->id, $absolute_creditnote, $filtercreditnote, $resteapayer $more=' ('.$addcreditnote.')'; $form->form_remise_dispo($_SERVER["PHP_SELF"] . '?facid=' . $object->id, 0, 'remise_id_for_payment', $soc->id, $absolute_creditnote, $filtercreditnote, 0, $more); // We allow credit note even if amount is higher } @@ -3155,345 +3062,26 @@ else if ($id > 0 || ! empty($ref)) // Date invoice print '
'; print ''; if ($object->type != Facture::TYPE_CREDIT_NOTE && $action != 'editinvoicedate' && ! empty($object->brouillon) && $user->rights->facture->creer && empty($conf->global->FAC_FORCE_DATE_VALIDATION)) print ''; print '
'; - print $langs->trans('Date'); + print $langs->trans('DateInvoice'); print 'id . '">' . img_edit($langs->trans('SetDate'), 1) . '
'; - print '
'; + print ''; if ($object->type != Facture::TYPE_CREDIT_NOTE) { if ($action == 'editinvoicedate') { $form->form_date($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->date, 'invoicedate'); } else { - print dol_print_date($object->date, 'daytext'); + print dol_print_date($object->date, 'day'); } } else { - print dol_print_date($object->date, 'daytext'); + print dol_print_date($object->date, 'day'); } print ''; - - 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 ''; - - if (count($object->tab_previous_situation_invoice) > 0) - { - //List of previous invoices - print ''; - print ''; - print ''; - if (! empty($conf->banque->enabled)) - print ''; - print ''; - print ''; - print ''; - print ''; - - $total_prev_ht = $total_prev_ttc = 0; - $var = true; - foreach ($object->tab_previous_situation_invoice as $prev_invoice) - { - $totalpaye = $prev_invoice->getSommePaiement(); - $total_prev_ht += $prev_invoice->total_ht; - $total_prev_ttc += $prev_invoice->total_ttc; - print ''; - print ''; - print ''; - if (! empty($conf->banque->enabled)) - print ''; - print ''; - print ''; - print ''; - print ''; - - $var = !$var; - } - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - } - - if (count($object->tab_next_situation_invoice) > 0) - { - //List of next invoices - print ''; - print ''; - print ''; - if (! empty($conf->banque->enabled)) - print ''; - print ''; - print ''; - print ''; - print ''; - - $total_next_ht = $total_next_ttc = 0; - - $var = true; - foreach ($object->tab_next_situation_invoice as $next_invoice) - { - $totalpaye = $next_invoice->getSommePaiement(); - $total_next_ht += $next_invoice->total_ht; - $total_next_ttc += $next_invoice->total_ttc; - print ''; - print ''; - print ''; - if (! empty($conf->banque->enabled)) - print ''; - print ''; - print ''; - print ''; - print ''; - - $var = !$var; - } - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - } - - if (count($object->tab_previous_situation_invoice) > 0 || count($object->tab_next_situation_invoice) > 0) print '
' . $langs->trans('ListOfPreviousSituationInvoices') . '' . $langs->trans('AmountHT') . '' . $langs->trans('AmountTTC') . ' 
'.$prev_invoice->getNomUrl(1).'' . price($prev_invoice->total_ht) . '' . price($prev_invoice->total_ttc) . ''.$prev_invoice->getLibStatut(3, $totalpaye).'
' . price($total_prev_ht) . '' . price($total_prev_ttc) . ' 
' . $langs->trans('ListOfNextSituationInvoices') . '' . $langs->trans('AmountHT') . '' . $langs->trans('AmountTTC') . ' 
'.$next_invoice->getNomUrl(1).'' . price($next_invoice->total_ht) . '' . price($next_invoice->total_ttc) . ''.$next_invoice->getLibStatut(3, $totalpaye).'
' . price($total_next_ht) . '' . price($total_next_ttc) . ' 
'; - } - - print ''; - - // List of payments already done - print ''; - print ''; - print ''; - print ''; - if (! empty($conf->banque->enabled)) - print ''; - print ''; - print ''; print ''; - $var = true; - - // Payments already done (from payment on this invoice) - $sql = 'SELECT p.datep as dp, p.ref, p.num_paiement, p.rowid, p.fk_bank,'; - $sql .= ' c.code as payment_code, c.libelle as payment_label,'; - $sql .= ' pf.amount,'; - $sql .= ' ba.rowid as baid, ba.ref as baref, ba.label'; - $sql .= ' FROM ' . MAIN_DB_PREFIX . 'c_paiement as c, ' . MAIN_DB_PREFIX . 'paiement_facture as pf, ' . MAIN_DB_PREFIX . 'paiement as p'; - $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'bank as b ON p.fk_bank = b.rowid'; - $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'bank_account as ba ON b.fk_account = ba.rowid'; - $sql .= ' WHERE pf.fk_facture = ' . $object->id . ' AND p.fk_paiement = c.id AND pf.fk_paiement = p.rowid'; - $sql .= ' ORDER BY p.datep, p.tms'; - - $result = $db->query($sql); - if ($result) - { - $num = $db->num_rows($result); - $i = 0; - - // if ($object->type != 2) - // { - if ($num > 0) - { - while ($i < $num) - { - $objp = $db->fetch_object($result); - $var = ! $var; - print ''; - print ''; - $label = ($langs->trans("PaymentType" . $objp->payment_code) != ("PaymentType" . $objp->payment_code)) ? $langs->trans("PaymentType" . $objp->payment_code) : $objp->payment_label; - print ''; - if (! empty($conf->banque->enabled)) - { - $bankaccountstatic->id = $objp->baid; - $bankaccountstatic->ref = $objp->baref; - $bankaccountstatic->label = $objp->baref; - print ''; - } - print ''; - print ''; - print ''; - $i ++; - } - } else { - print ''; - } - // } - $db->free($result); - } else { - dol_print_error($db); - } - - if ($object->type != Facture::TYPE_CREDIT_NOTE) - { - // Total already paid - print ''; - - $resteapayeraffiche = $resteapayer; - - // Loop on each credit note or deposit amount applied - $creditnoteamount = 0; - $depositamount = 0; - $sql = "SELECT re.rowid, re.amount_ht, re.amount_tva, re.amount_ttc,"; - $sql .= " re.description, re.fk_facture_source"; - $sql .= " FROM " . MAIN_DB_PREFIX . "societe_remise_except as re"; - $sql .= " WHERE fk_facture = " . $object->id; - $resql = $db->query($sql); - if ($resql) - { - $num = $db->num_rows($resql); - $i = 0; - $invoice = new Facture($db); - while ($i < $num) - { - $obj = $db->fetch_object($resql); - $invoice->fetch($obj->fk_facture_source); - print ''; - print ''; - print ''; - $i ++; - if ($invoice->type == Facture::TYPE_CREDIT_NOTE) - $creditnoteamount += $obj->amount_ttc; - if ($invoice->type == Facture::TYPE_DEPOSIT) - $depositamount += $obj->amount_ttc; - } - } else { - dol_print_error($db); - } - - // Paye partiellement 'escompte' - if (($object->statut == 2 || $object->statut == 3) && $object->close_code == 'discount_vat') { - print ''; - $resteapayeraffiche = 0; - } - // Paye partiellement ou Abandon 'badcustomer' - if (($object->statut == 2 || $object->statut == 3) && $object->close_code == 'badcustomer') { - print ''; - // $resteapayeraffiche=0; - } - // Paye partiellement ou Abandon 'product_returned' - if (($object->statut == 2 || $object->statut == 3) && $object->close_code == 'product_returned') { - print ''; - $resteapayeraffiche = 0; - } - // Paye partiellement ou Abandon 'abandon' - if (($object->statut == 2 || $object->statut == 3) && $object->close_code == 'abandon') { - print ''; - $resteapayeraffiche = 0; - } - - // Billed - print ''; - - // Remainder to pay - print ''; - print ''; - print ''; - } - else // Credit note - { - // Total already paid back - print ''; - - // Billed - print ''; - - // Remainder to pay back - print ''; - print ''; - print ''; - - // Sold credit note - // print ''; - // print ''; - } - - print '
' . ($object->type == Facture::TYPE_CREDIT_NOTE ? $langs->trans("PaymentsBack") : $langs->trans('Payments')) . '' . $langs->trans('Date') . '' . $langs->trans('Type') . '' . $langs->trans('BankAccount') . '' . $langs->trans('Amount') . ' 
'; - $paymentstatic->id=$objp->rowid; - $paymentstatic->datepaye=$db->jdate($objp->dp); - $paymentstatic->ref=$objp->ref; - $paymentstatic->num_paiement=$objp->num_paiement; - $paymentstatic->payment_code=$objp->payment_code; - print $paymentstatic->getNomUrl(1); - print ''.dol_print_date($db->jdate($objp->dp), 'day') . '' . $label . ' ' . $objp->num_paiement . ''; - if ($bankaccountstatic->id) - print $bankaccountstatic->getNomUrl(1, 'transactions'); - print '' . price($sign * $objp->amount) . ' 
' . $langs->trans("None") . '
'; - if ($object->type != Facture::TYPE_DEPOSIT) - print $langs->trans('AlreadyPaidNoCreditNotesNoDeposits'); - else - print $langs->trans('AlreadyPaid'); - print ' :' . price($totalpaye) . ' 
'; - if ($invoice->type == Facture::TYPE_CREDIT_NOTE) - print $langs->trans("CreditNote") . ' '; - if ($invoice->type == Facture::TYPE_DEPOSIT) - print $langs->trans("Deposit") . ' '; - print $invoice->getNomUrl(0); - print ' :' . price($obj->amount_ttc) . ''; - print 'rowid . '">' . img_delete() . ''; - print '
'; - print $form->textwithpicto($langs->trans("Discount") . ':', $langs->trans("HelpEscompte"), - 1); - print '' . price($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye) . ' 
'; - print $form->textwithpicto($langs->trans("Abandoned") . ':', $langs->trans("HelpAbandonBadCustomer"), - 1); - print '' . price($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye) . ' 
'; - print $form->textwithpicto($langs->trans("ProductReturned") . ':', $langs->trans("HelpAbandonProductReturned"), - 1); - print '' . price($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye) . ' 
'; - $text = $langs->trans("HelpAbandonOther"); - if ($object->close_note) - $text .= '

' . $langs->trans("Reason") . ':' . $object->close_note; - print $form->textwithpicto($langs->trans("Abandoned") . ':', $text, - 1); - print '
' . price($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye) . ' 
' . $langs->trans("Billed") . ' :' . price($object->total_ttc) . ' 
'; - if ($resteapayeraffiche >= 0) - print $langs->trans('RemainderToPay'); - else - print $langs->trans('ExcessReceived'); - print ' :' . price($resteapayeraffiche) . ' 
'; - print $langs->trans('AlreadyPaidBack'); - print ' :' . price($sign * $totalpaye) . ' 
' . $langs->trans("Billed") . ' :' . price($sign * $object->total_ttc) . ' 
'; - if ($resteapayeraffiche <= 0) - print $langs->trans('RemainderToPayBack'); - else - print $langs->trans('ExcessPaydBack'); - print ' :' . price($sign * $resteapayeraffiche) . ' 
'.$langs->trans('TotalTTC').' :'.price($sign * - // $object->total_ttc).' 
'; - - // Margin Infos - if (! empty($conf->margin->enabled)) - { - print '
'; - $formmargin->displayMarginInfos($object, $object->statut > 0); - } - - print '
id . '">' . img_edit($langs->trans('SetDate'), 1) . '
'; - print ''; + print ''; if ($action == 'editdate_pointoftax') { $form->form_date($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->date_pointoftax, 'date_pointoftax'); } else { - print dol_print_date($object->date_pointoftax, 'daytext'); + print dol_print_date($object->date_pointoftax, 'day'); } print ''; - } + } - // Conditions de reglement + // Payment term print ''; print ''; print '
'; print $langs->trans('PaymentConditionsShort'); @@ -3520,7 +3108,7 @@ else if ($id > 0 || ! empty($ref)) if ($object->type != Facture::TYPE_CREDIT_NOTE && $action != 'editconditions' && ! empty($object->brouillon) && $user->rights->facture->creer) print 'id . '">' . img_edit($langs->trans('SetConditions'), 1) . '
'; - print ''; + print ''; if ($object->type != Facture::TYPE_CREDIT_NOTE) { if ($action == 'editconditions') { @@ -3541,13 +3129,13 @@ else if ($id > 0 || ! empty($ref)) if ($object->type != Facture::TYPE_CREDIT_NOTE && $action != 'editpaymentterm' && ! empty($object->brouillon) && $user->rights->facture->creer) print 'id . '">' . img_edit($langs->trans('SetDate'), 1) . ''; print ''; - print ''; + print ''; if ($object->type != Facture::TYPE_CREDIT_NOTE) { if ($action == 'editpaymentterm') { $form->form_date($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->date_lim_reglement, 'paymentterm'); } else { - print dol_print_date($object->date_lim_reglement, 'daytext'); + print dol_print_date($object->date_lim_reglement, 'day'); if ($object->hasDelay()) { print img_warning($langs->trans('Late')); } @@ -3565,7 +3153,7 @@ else if ($id > 0 || ! empty($ref)) if ($action != 'editmode' && ! empty($object->brouillon) && $user->rights->facture->creer) print 'id . '">' . img_edit($langs->trans('SetMode'), 1) . ''; print ''; - print ''; + print ''; if ($action == 'editmode') { $form->form_modes_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->mode_reglement_id, 'mode_reglement_id', 'CRDT'); @@ -3588,30 +3176,33 @@ else if ($id > 0 || ! empty($ref)) if ($action != 'editmulticurrencycode' && ! empty($object->brouillon)) print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . ''; print ''; - print ''; + print ''; if ($action == 'editmulticurrencycode') { $form->form_multicurrency_code($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_code, 'multicurrency_code'); } else { $form->form_multicurrency_code($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_code, 'none'); } print ''; - + // Multicurrency rate - print ''; - print ''; - print ''; - if ($action != 'editmulticurrencyrate' && ! empty($object->brouillon)) - print ''; - print '
'; - print fieldLabel('Rate','multicurrency_tx'); - print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '
'; - print ''; - if ($action == 'editmulticurrencyrate') { - $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code); - } else { - $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code); - } - print ''; + //if ($object->multicurrency_code != $conf->currency) + //{ + print ''; + print ''; + print ''; + if ($action != 'editmulticurrencyrate' && ! empty($object->brouillon)) + print ''; + print '
'; + print fieldLabel('CurrencyRate','multicurrency_tx'); + print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '
'; + print ''; + if ($action == 'editmulticurrencyrate') { + $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code); + } else { + $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code); + } + print ''; + //} } // Bank Account @@ -3622,7 +3213,7 @@ else if ($id > 0 || ! empty($ref)) if (($action != 'editbankaccount') && $user->rights->facture->creer && ! empty($object->brouillon)) print 'id.'">'.img_edit($langs->trans('SetBankAccount'),1).''; print ''; - print ''; + print ''; if ($action == 'editbankaccount') { $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1); @@ -3635,7 +3226,7 @@ else if ($id > 0 || ! empty($ref)) print ''; // Situations - if (! empty($conf->global->INVOICE_US_SITUATION)) + if (! empty($conf->global->INVOICE_USE_SITUATION)) { if ($object->type == 5 && ($object->situation_counter > 1)) { @@ -3655,7 +3246,7 @@ else if ($id > 0 || ! empty($ref)) print $object->situation_counter; print ''; - print ''; + print ''; $prevsits_total_amount = 0; foreach ($prevsits as $situation) { @@ -3676,7 +3267,7 @@ else if ($id > 0 || ! empty($ref)) print $prevsits[$i]->situation_counter; print ''; - print ''; + print ''; print '- ' . price($prevsits[$i]->total_ht); print ''; print '' . $langs->trans('Currency' . $conf->currency) . ''; @@ -3684,100 +3275,6 @@ else if ($id > 0 || ! empty($ref)) } } - // Amount - print '' . $langs->trans('AmountHT') . ''; - print '' . price($object->total_ht, 1, '', 1, - 1, - 1, $conf->currency) . ''; - print '' . $langs->trans('AmountVAT') . '' . price($object->total_tva, 1, '', 1, - 1, - 1, $conf->currency) . ''; - print ''; - - // Amount Local Taxes - if (($mysoc->localtax1_assuj == "1" && $mysoc->useLocalTax(1)) || $object->total_localtax1 != 0) // Localtax1 - { - print '' . $langs->transcountry("AmountLT1", $mysoc->country_code) . ''; - print '' . price($object->total_localtax1, 1, '', 1, - 1, - 1, $conf->currency) . ''; - } - if (($mysoc->localtax2_assuj == "1" && $mysoc->useLocalTax(2)) || $object->total_localtax2 != 0) // Localtax2 - { - print '' . $langs->transcountry("AmountLT2", $mysoc->country_code) . ''; - print '' . price($object->total_localtax2, 1, '', 1, - 1, - 1, $conf->currency) . ''; - } - - // Revenue stamp - if ($selleruserevenustamp) // Test company use revenue stamp - { - print ''; - print ''; - if ($action != 'editrevenuestamp' && ! empty($object->brouillon) && $user->rights->facture->creer) - print ''; - print '
'; - print $langs->trans('RevenueStamp'); - print 'id . '">' . img_edit($langs->trans('SetRevenuStamp'), 1) . '
'; - print ''; - if ($action == 'editrevenuestamp') { - print '
'; - print ''; - print ''; - print $formother->select_revenue_stamp(GETPOST('revenuestamp'), 'revenuestamp', $mysoc->country_code); - // print ''; - print ' '; - print '
'; - } else { - print price($object->revenuestamp, 1, '', 1, - 1, - 1, $conf->currency); - } - print ''; - } - - // Total with tax - print '' . $langs->trans('AmountTTC') . '' . price($object->total_ttc, 1, '', 1, - 1, - 1, $conf->currency) . ''; - - if (!empty($conf->multicurrency->enabled)) - { - // Multicurrency Amount HT - print '' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . ''; - print '' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . ''; - print ''; - - // Multicurrency Amount VAT - print '' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . ''; - print '' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . ''; - print ''; - - // Multicurrency Amount TTC - print '' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . ''; - print '' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . ''; - print ''; - } - - // Statut - print '' . $langs->trans('Status') . ''; - print '' . ($object->getLibStatut(4, $totalpaye)) . ''; - - // Project - if (! empty($conf->projet->enabled)) { - $langs->load('projects'); - print ''; - print ''; - - print ''; - if ($action != 'classify') { - print ''; - } - print '
'; - print $langs->trans('Project'); - print 'id . '">'; - print img_edit($langs->trans('SetProject'), 1); - print '
'; - - print ''; - if ($action == 'classify') { - $form->form_project($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1); - } else { - $form->form_project($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0); - } - print ''; - print ''; - } - // Incoterms if (!empty($conf->incoterm->enabled)) { @@ -3789,7 +3286,7 @@ else if ($id > 0 || ! empty($ref)) else print ' '; print ''; print ''; - print ''; + print ''; if ($action != 'editincoterm') { print $form->textwithpicto($object->display_incoterms(), $object->libelle_incoterms, 1); @@ -3802,11 +3299,408 @@ else if ($id > 0 || ! empty($ref)) } // Other attributes - $cols = 5; + $cols = 2; include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; - print '
'; + print ''; + + print ''; + print '
'; + print '
'; + print '
'; + + print ''; + + if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency)) + { + // Multicurrency Amount HT + print ''; + print ''; + print ''; + + // Multicurrency Amount VAT + print ''; + print ''; + print ''; + + // Multicurrency Amount TTC + print ''; + print ''; + print ''; + } + + // Amount + print ''; + print ''; + + // Vat + print ''; + print ''; + + // Amount Local Taxes + if (($mysoc->localtax1_assuj == "1" && $mysoc->useLocalTax(1)) || $object->total_localtax1 != 0) // Localtax1 + { + print ''; + print ''; + } + if (($mysoc->localtax2_assuj == "1" && $mysoc->useLocalTax(2)) || $object->total_localtax2 != 0) // Localtax2 + { + print ''; + print ''; + } + + // Revenue stamp + if ($selleruserevenustamp) // Test company use revenue stamp + { + print ''; + } + + // Total with tax + print ''; + + print '
' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . '' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . '' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . '' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . $langs->trans('AmountHT') . '' . price($object->total_ht, 1, '', 1, - 1, - 1, $conf->currency) . '
' . $langs->trans('AmountVAT') . '' . price($object->total_tva, 1, '', 1, - 1, - 1, $conf->currency) . '
' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '' . price($object->total_localtax1, 1, '', 1, - 1, - 1, $conf->currency) . '
' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '' . price($object->total_localtax2, 1, '', 1, - 1, - 1, $conf->currency) . '
'; + print ''; + if ($action != 'editrevenuestamp' && ! empty($object->brouillon) && $user->rights->facture->creer) + { + print ''; + } + print '
'; + print $langs->trans('RevenueStamp'); + print 'id . '">' . img_edit($langs->trans('SetRevenuStamp'), 1) . '
'; + print '
'; + if ($action == 'editrevenuestamp') { + print '
'; + print ''; + print ''; + print $formother->select_revenue_stamp(GETPOST('revenuestamp'), 'revenuestamp', $mysoc->country_code); + // print ''; + print ' '; + print '
'; + } else { + print price($object->revenuestamp, 1, '', 1, - 1, - 1, $conf->currency); + } + print '
' . $langs->trans('AmountTTC') . '' . price($object->total_ttc, 1, '', 1, - 1, - 1, $conf->currency) . '
'; + + // List of payments + + $sign = 1; + if ($object->type == Facture::TYPE_CREDIT_NOTE) $sign = - 1; + $nbrows = 8; + $nbcols = 3; + if (! empty($conf->projet->enabled)) + $nbrows ++; + if (! empty($conf->banque->enabled)) { + $nbrows ++; + $nbcols ++; + } + if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) + $nbrows ++; + if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) + $nbrows ++; + if ($selleruserevenustamp) + $nbrows ++; + if (! empty($conf->multicurrency->enabled)) + $nbrows += 5; + if (! empty($conf->incoterm->enabled)) + $nbrows += 1; + + 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 ''; + + if (count($object->tab_previous_situation_invoice) > 0) { + // List of previous invoices + print ''; + print ''; + print ''; + if (! empty($conf->banque->enabled)) + print ''; + print ''; + print ''; + print ''; + print ''; + + $total_prev_ht = $total_prev_ttc = 0; + $var = true; + foreach ($object->tab_previous_situation_invoice as $prev_invoice) { + $totalpaye = $prev_invoice->getSommePaiement(); + $total_prev_ht += $prev_invoice->total_ht; + $total_prev_ttc += $prev_invoice->total_ttc; + print ''; + print ''; + print ''; + if (! empty($conf->banque->enabled)) + print ''; + print ''; + print ''; + print ''; + print ''; + + $var = ! $var; + } + + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + } + + if (count($object->tab_next_situation_invoice) > 0) { + // List of next invoices + print ''; + print ''; + print ''; + if (! empty($conf->banque->enabled)) + print ''; + print ''; + print ''; + print ''; + print ''; + + $total_next_ht = $total_next_ttc = 0; + + $var = true; + foreach ($object->tab_next_situation_invoice as $next_invoice) { + $totalpaye = $next_invoice->getSommePaiement(); + $total_next_ht += $next_invoice->total_ht; + $total_next_ttc += $next_invoice->total_ttc; + print ''; + print ''; + print ''; + if (! empty($conf->banque->enabled)) + print ''; + print ''; + print ''; + print ''; + print ''; + + $var = ! $var; + } + + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + } + + if (count($object->tab_previous_situation_invoice) > 0 || count($object->tab_next_situation_invoice) > 0) + print '
' . $langs->trans('ListOfPreviousSituationInvoices') . '' . $langs->trans('AmountHT') . '' . $langs->trans('AmountTTC') . ' 
' . $prev_invoice->getNomUrl(1) . '' . price($prev_invoice->total_ht) . '' . price($prev_invoice->total_ttc) . '' . $prev_invoice->getLibStatut(3, $totalpaye) . '
' . price($total_prev_ht) . '' . price($total_prev_ttc) . ' 
' . $langs->trans('ListOfNextSituationInvoices') . '' . $langs->trans('AmountHT') . '' . $langs->trans('AmountTTC') . ' 
' . $next_invoice->getNomUrl(1) . '' . price($next_invoice->total_ht) . '' . price($next_invoice->total_ttc) . '' . $next_invoice->getLibStatut(3, $totalpaye) . '
' . price($total_next_ht) . '' . price($total_next_ttc) . ' 
'; + } + + print ''; + + // List of payments already done + print ''; + print ''; + print ''; + print ''; + if (! empty($conf->banque->enabled)) { + print ''; + } + print ''; + print ''; + print ''; + + $var = true; + + // Payments already done (from payment on this invoice) + $sql = 'SELECT p.datep as dp, p.ref, p.num_paiement, p.rowid, p.fk_bank,'; + $sql .= ' c.code as payment_code, c.libelle as payment_label,'; + $sql .= ' pf.amount,'; + $sql .= ' ba.rowid as baid, ba.ref as baref, ba.label'; + $sql .= ' FROM ' . MAIN_DB_PREFIX . 'c_paiement as c, ' . MAIN_DB_PREFIX . 'paiement_facture as pf, ' . MAIN_DB_PREFIX . 'paiement as p'; + $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'bank as b ON p.fk_bank = b.rowid'; + $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'bank_account as ba ON b.fk_account = ba.rowid'; + $sql .= ' WHERE pf.fk_facture = ' . $object->id . ' AND p.fk_paiement = c.id AND pf.fk_paiement = p.rowid'; + $sql .= ' ORDER BY p.datep, p.tms'; + + $result = $db->query($sql); + if ($result) { + $num = $db->num_rows($result); + $i = 0; + + // if ($object->type != 2) + // { + if ($num > 0) { + while ($i < $num) { + $objp = $db->fetch_object($result); + $var = ! $var; + print ''; + print ''; + $label = ($langs->trans("PaymentType" . $objp->payment_code) != ("PaymentType" . $objp->payment_code)) ? $langs->trans("PaymentType" . $objp->payment_code) : $objp->payment_label; + print ''; + if (! empty($conf->banque->enabled)) { + $bankaccountstatic->id = $objp->baid; + $bankaccountstatic->ref = $objp->baref; + $bankaccountstatic->label = $objp->baref; + print ''; + } + print ''; + print ''; + print ''; + $i ++; + } + } else { + print ''; + } + // } + $db->free($result); + } else { + dol_print_error($db); + } + + if ($object->type != Facture::TYPE_CREDIT_NOTE) { + // Total already paid + print ''; + + $resteapayeraffiche = $resteapayer; + $cssforamountpaymentcomplete = 'amountpaymentcomplete'; + + // Loop on each credit note or deposit amount applied + $creditnoteamount = 0; + $depositamount = 0; + $sql = "SELECT re.rowid, re.amount_ht, re.amount_tva, re.amount_ttc,"; + $sql .= " re.description, re.fk_facture_source"; + $sql .= " FROM " . MAIN_DB_PREFIX . "societe_remise_except as re"; + $sql .= " WHERE fk_facture = " . $object->id; + $resql = $db->query($sql); + if ($resql) { + $num = $db->num_rows($resql); + $i = 0; + $invoice = new Facture($db); + while ($i < $num) { + $obj = $db->fetch_object($resql); + $invoice->fetch($obj->fk_facture_source); + print ''; + print ''; + print ''; + $i ++; + if ($invoice->type == Facture::TYPE_CREDIT_NOTE) + $creditnoteamount += $obj->amount_ttc; + if ($invoice->type == Facture::TYPE_DEPOSIT) + $depositamount += $obj->amount_ttc; + } + } else { + dol_print_error($db); + } + + // Paye partiellement 'escompte' + if (($object->statut == Facture::STATUS_CLOSED || $object->statut == Facture::STATUS_ABANDONED) && $object->close_code == 'discount_vat') { + print ''; + $resteapayeraffiche = 0; + $cssforamountpaymentcomplete = ''; + } + // Paye partiellement ou Abandon 'badcustomer' + if (($object->statut == Facture::STATUS_CLOSED || $object->statut == Facture::STATUS_ABANDONED) && $object->close_code == 'badcustomer') { + print ''; + // $resteapayeraffiche=0; + $cssforamountpaymentcomplete = ''; + } + // Paye partiellement ou Abandon 'product_returned' + if (($object->statut == Facture::STATUS_CLOSED || $object->statut == Facture::STATUS_ABANDONED) && $object->close_code == 'product_returned') { + print ''; + $resteapayeraffiche = 0; + $cssforamountpaymentcomplete = ''; + } + // Paye partiellement ou Abandon 'abandon' + if (($object->statut == Facture::STATUS_CLOSED || $object->statut == Facture::STATUS_ABANDONED) && $object->close_code == 'abandon') { + print ''; + $resteapayeraffiche = 0; + $cssforamountpaymentcomplete = ''; + } + + // Billed + print ''; + + // Remainder to pay + print ''; + print ''; + print ''; + } + else // Credit note + { + // Total already paid back + print ''; + + // Billed + print ''; + + // Remainder to pay back + print ''; + print ''; + print ''; + + // Sold credit note + // print ''; + // print ''; + } + + print '
' . ($object->type == Facture::TYPE_CREDIT_NOTE ? $langs->trans("PaymentsBack") : $langs->trans('Payments')) . '' . $langs->trans('Date') . '' . $langs->trans('Type') . '' . $langs->trans('BankAccount') . '' . $langs->trans('Amount') . ' 
'; + $paymentstatic->id = $objp->rowid; + $paymentstatic->datepaye = $db->jdate($objp->dp); + $paymentstatic->ref = $objp->ref; + $paymentstatic->num_paiement = $objp->num_paiement; + $paymentstatic->payment_code = $objp->payment_code; + print $paymentstatic->getNomUrl(1); + print '' . dol_print_date($db->jdate($objp->dp), 'day') . '' . $label . ' ' . $objp->num_paiement . ''; + if ($bankaccountstatic->id) + print $bankaccountstatic->getNomUrl(1, 'transactions'); + print '' . price($sign * $objp->amount) . ' 
' . $langs->trans("None") . '
'; + if ($object->type != Facture::TYPE_DEPOSIT) + print $langs->trans('AlreadyPaidNoCreditNotesNoDeposits'); + else + print $langs->trans('AlreadyPaid'); + print ' : 0)?' class="amountalreadypaid"':'').'>' . price($totalpaye) . ' 
'; + if ($invoice->type == Facture::TYPE_CREDIT_NOTE) + print $langs->trans("CreditNote") . ' '; + if ($invoice->type == Facture::TYPE_DEPOSIT) + print $langs->trans("Deposit") . ' '; + print $invoice->getNomUrl(0); + print ' :' . price($obj->amount_ttc) . ''; + print 'rowid . '">' . img_delete() . ''; + print '
'; + print $form->textwithpicto($langs->trans("Discount") . ':', $langs->trans("HelpEscompte"), - 1); + print '' . price($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye) . ' 
'; + print $form->textwithpicto($langs->trans("Abandoned") . ':', $langs->trans("HelpAbandonBadCustomer"), - 1); + print '' . price($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye) . ' 
'; + print $form->textwithpicto($langs->trans("ProductReturned") . ':', $langs->trans("HelpAbandonProductReturned"), - 1); + print '' . price($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye) . ' 
'; + $text = $langs->trans("HelpAbandonOther"); + if ($object->close_note) + $text .= '

' . $langs->trans("Reason") . ':' . $object->close_note; + print $form->textwithpicto($langs->trans("Abandoned") . ':', $text, - 1); + print '
' . price($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye) . ' 
' . $langs->trans("Billed") . ' :' . price($object->total_ttc) . ' 
'; + if ($resteapayeraffiche >= 0) + print $langs->trans('RemainderToPay'); + else + print $langs->trans('ExcessReceived'); + print ' :' . price($resteapayeraffiche) . ' 
'; + print $langs->trans('AlreadyPaidBack'); + print ' :' . price($sign * $totalpaye) . ' 
' . $langs->trans("Billed") . ' :' . price($sign * $object->total_ttc) . ' 
'; + if ($resteapayeraffiche <= 0) + print $langs->trans('RemainderToPayBack'); + else + print $langs->trans('ExcessPaydBack'); + print ' :' . price($sign * $resteapayeraffiche) . ' 
'.$langs->trans('TotalTTC').' :'.price($sign * + // $object->total_ttc).' 
'; + + // Margin Infos + if (! empty($conf->margin->enabled)) { + $formmargin->displayMarginInfos($object); + } + + print '
'; + print '
'; + print ''; + + print '

'; + if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) { $blocname = 'contacts'; $title = $langs->trans('ContactsAddresses'); @@ -3836,7 +3730,7 @@ else if ($id > 0 || ! empty($ref)) print ''; // Show global modifiers - if (! empty($conf->global->INVOICE_US_SITUATION)) + if (! empty($conf->global->INVOICE_USE_SITUATION)) { if ($object->situation_cycle_ref && $object->statut == 0) { print ''; @@ -3949,8 +3843,8 @@ else if ($id > 0 || ! empty($ref)) if ((($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT) || ($object->type == Facture::TYPE_CREDIT_NOTE && empty($discount->id)) || ($object->type == Facture::TYPE_DEPOSIT && empty($discount->id))) - && ($object->statut == 2 || $object->statut == 3) - && $user->rights->facture->creer) // A paid invoice (partially or completely) + && ($object->statut == 2 || $object->statut == 3 || ($object->statut == 1 && $object->paye == 1)) // Condition ($object->statut == 1 && $object->paye == 1) should not happened but can be found due to corrupted data + && ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->facture->creer) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->facture->invoice_advance->reopen))) // A paid invoice (partially or completely) { if (! $objectidnext && $object->close_code != 'replaced') // Not replaced by another invoice { @@ -4044,7 +3938,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) @@ -4056,11 +3950,11 @@ else if ($id > 0 || ! empty($ref)) { if ( empty($conf->global->INVOICE_CAN_NEVER_BE_CANCELED)) { - if ($objectidnext) + if ($objectidnext) { print '
' . $langs->trans('ClassifyCanceled') . '
'; } - else + else { print ''; } @@ -4082,13 +3976,13 @@ else if ($id > 0 || ! empty($ref)) print ''; } } - + // Create a credit note if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA) && $object->statut > 0 && $user->rights->facture->creer) { if (! $objectidnext) { - print ''; + print ''; } } @@ -4143,13 +4037,10 @@ else if ($id > 0 || ! empty($ref)) print $formfile->showdocuments('facture', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang); $somethingshown = $formfile->numoffiles; - // Linked object block - $somethingshown = $form->showLinkedObjectBlock($object); - // Show links to link elements - $linktoelem = $form->showLinkToObjectBlock($object,array('order')); - if ($linktoelem) print '
'.$linktoelem; - + $linktoelem = $form->showLinkToObjectBlock($object, null, array('invoice')); + $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem); + // Link for paypal payment if (! empty($conf->paypal->enabled) && $object->statut != 0) { include_once DOL_DOCUMENT_ROOT . '/paypal/lib/paypal.lib.php'; @@ -4228,16 +4119,18 @@ else if ($id > 0 || ! empty($ref)) include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; $formmail = new FormMail($db); $formmail->param['langsmodels']=(empty($newlang)?$langs->defaultlang:$newlang); - $formmail->fromtype = 'user'; - $formmail->fromid = $user->id; - $formmail->fromname = $user->getFullName($langs); - $formmail->frommail = $user->email; + $formmail->fromtype = (GETPOST('fromtype')?GETPOST('fromtype'):(!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE)?$conf->global->MAIN_MAIL_DEFAULT_FROMTYPE:'user')); + + if($formmail->fromtype === 'user'){ + $formmail->fromid = $user->id; + + } $formmail->trackid='inv'.$object->id; if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set { include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; $formmail->frommail=dolAddEmailTrackId($formmail->frommail, 'inv'.$object->id); - } + } $formmail->withfrom = 1; $liste = array(); foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key => $value) { @@ -4257,7 +4150,7 @@ else if ($id > 0 || ! empty($ref)) $formmail->withdeliveryreceipt = 1; $formmail->withcancel = 1; // Tableau des substitutions - $formmail->setSubstitFromObject($object); + $formmail->setSubstitFromObject($object, $outputlangs); $formmail->substit['__INVREF__'] = $object->ref; // Find the good contact adress diff --git a/htdocs/compta/facture/apercu.php b/htdocs/compta/facture/apercu.php index 1172769e95a..8300545cb22 100644 --- a/htdocs/compta/facture/apercu.php +++ b/htdocs/compta/facture/apercu.php @@ -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 = '' . $langs->trans("BackToList") . ''; // Ref - print ''; // Dates - print ''; + print ''; print ''; // Right part with $rowspan lines diff --git a/htdocs/compta/facture/class/api_invoice.class.php b/htdocs/compta/facture/class/api_deprecated_invoice.class.php similarity index 92% rename from htdocs/compta/facture/class/api_invoice.class.php rename to htdocs/compta/facture/class/api_deprecated_invoice.class.php index 60098a38b9f..51e047e4412 100644 --- a/htdocs/compta/facture/class/api_invoice.class.php +++ b/htdocs/compta/facture/class/api_deprecated_invoice.class.php @@ -25,7 +25,7 @@ * @smart-auto-routing false * @access protected * @class DolibarrApiAccess {@requires user,external} - * + * @deprecated Use Invoices instead (defined in api_invoices.class.php) */ class InvoiceApi extends DolibarrApi { @@ -43,7 +43,7 @@ class InvoiceApi extends DolibarrApi public $invoice; /** - * Constructor + * Constructor Warning: Deprecated * * @url GET invoice/ * @@ -56,7 +56,7 @@ class InvoiceApi extends DolibarrApi } /** - * Get properties of a invoice object + * Get properties of a invoice object Warning: Deprecated * * Return an array with invoice informations * @@ -85,16 +85,16 @@ class InvoiceApi extends DolibarrApi } /** - * List invoices + * List invoices Warning: Deprecated * * Get a list of invoices * - * @param int $socid Filter list with thirdparty ID - * @param string $mode Filter by invoice status : draft | unpaid | paid | cancelled * @param string $sortfield Sort field * @param string $sortorder Sort order * @param int $limit Limit for list * @param int $page Page number + * @param int $socid Filter list with thirdparty ID + * @param string $mode Filter by invoice status : draft | unpaid | paid | cancelled * * @return array Array of invoice objects * @@ -103,12 +103,12 @@ class InvoiceApi extends DolibarrApi * @url GET thirdparty/{socid}/invoice/list * @url GET thirdparty/{socid}/invoice/list/{mode} */ - function getList($socid=0, $mode='', $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0) { + function getList($sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0, $socid=0, $mode='') { global $db, $conf; $obj_ret = array(); - $socid = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : ''; + $socid = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : $socid; // If the internal user must only see his customers, force searching by him if (! DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) $search_sale = DolibarrApiAccess::$user->id; @@ -158,8 +158,9 @@ class InvoiceApi extends DolibarrApi $result = $db->query($sql); if ($result) { + $i=0; $num = $db->num_rows($result); - while ($i < $num) + while ($i < min($num, ($limit <= 0 ? $num : $limit))) { $obj = $db->fetch_object($result); $invoice_static = new Facture($db); @@ -179,7 +180,7 @@ class InvoiceApi extends DolibarrApi } /** - * Create invoice object + * Create invoice object Warning: Deprecated * * @param array $request_data Request datas * @return int ID of invoice @@ -207,7 +208,7 @@ class InvoiceApi extends DolibarrApi } /** - * Update invoice + * Update invoice Warning: Deprecated * * @param int $id Id of invoice to update * @param array $request_data Datas @@ -241,7 +242,7 @@ class InvoiceApi extends DolibarrApi } /** - * Delete invoice + * Delete invoice Warning: Deprecated * * @param int $id Invoice ID * @return type @@ -262,7 +263,7 @@ class InvoiceApi extends DolibarrApi throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } - if( !$this->invoice->delete($id)) + if( !$this->invoice->delete(DolibarrApiAccess::$user)) { throw new RestException(500); } diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php new file mode 100644 index 00000000000..0b2b7f58781 --- /dev/null +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -0,0 +1,292 @@ + + * + * 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 . + */ + + use Luracast\Restler\RestException; + + require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; + +/** + * API class for invoices + * + * @access protected + * @class DolibarrApiAccess {@requires user,external} + */ +class Invoices extends DolibarrApi +{ + /** + * + * @var array $FIELDS Mandatory fields, checked when create and update object + */ + static $FIELDS = array( + 'socid' + ); + + /** + * @var Facture $invoice {@type Facture} + */ + public $invoice; + + /** + * Constructor + */ + function __construct() + { + global $db, $conf; + $this->db = $db; + $this->invoice = new Facture($this->db); + } + + /** + * Get properties of a invoice object + * + * Return an array with invoice informations + * + * @param int $id ID of invoice + * @return array|mixed data without useless information + * + * @throws RestException + */ + function get($id) + { + if(! DolibarrApiAccess::$user->rights->facture->lire) { + throw new RestException(401); + } + + $result = $this->invoice->fetch($id); + if( ! $result ) { + throw new RestException(404, 'Invoice not found'); + } + + if( ! DolibarrApi::_checkAccessToResource('facture',$this->invoice->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + + return $this->_cleanObjectDatas($this->invoice); + } + + /** + * List invoices + * + * Get a list of invoices + * + * @param string $sortfield Sort field + * @param string $sortorder Sort order + * @param int $limit Limit for list + * @param int $page Page number + * @param int $socid Filter list with thirdparty ID + * @param string $status Filter by invoice status : draft | unpaid | paid | cancelled + * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" + * @return array Array of invoice objects + * + * @throws RestException + */ + function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 0, $page = 0, $socid=0, $status='', $sqlfilters = '') { + global $db, $conf; + + $obj_ret = array(); + + $socid = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : $socid; + + // If the internal user must only see his customers, force searching by him + if (! DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) $search_sale = DolibarrApiAccess::$user->id; + + $sql = "SELECT t.rowid"; + if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects) + $sql.= " FROM ".MAIN_DB_PREFIX."facture as t"; + + if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale + + $sql.= ' WHERE t.entity IN ('.getEntity('facture', 1).')'; + if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= " AND t.fk_soc = sc.fk_soc"; + if ($socid) $sql.= " AND t.fk_soc = ".$socid; + if ($search_sale > 0) $sql.= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale + + // Filter by status + if ($status == 'draft') $sql.= " AND t.fk_statut IN (0)"; + if ($status == 'unpaid') $sql.= " AND t.fk_statut IN (1)"; + if ($status == 'paid') $sql.= " AND t.fk_statut IN (2)"; + if ($status == 'cancelled') $sql.= " AND t.fk_statut IN (3)"; + // Insert sale filter + if ($search_sale > 0) + { + $sql .= " AND sc.fk_user = ".$search_sale; + } + // Add sql filters + if ($sqlfilters) + { + if (! DolibarrApi::_checkFilters($sqlfilters)) + { + throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); + } + $regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; + } + + $sql.= $db->order($sortfield, $sortorder); + if ($limit) { + if ($page < 0) + { + $page = 0; + } + $offset = $limit * $page; + + $sql.= $db->plimit($limit + 1, $offset); + } + + $result = $db->query($sql); + if ($result) + { + $num = $db->num_rows($result); + while ($i < min($num, ($limit <= 0 ? $num : $limit))) + { + $obj = $db->fetch_object($result); + $invoice_static = new Facture($db); + if($invoice_static->fetch($obj->rowid)) { + $obj_ret[] = parent::_cleanObjectDatas($invoice_static); + } + $i++; + } + } + else { + throw new RestException(503, 'Error when retrieve invoice list'); + } + if( ! count($obj_ret)) { + throw new RestException(404, 'No invoice found'); + } + return $obj_ret; + } + + /** + * Create invoice object + * + * @param array $request_data Request datas + * @return int ID of invoice + */ + function post($request_data = NULL) + { + if(! DolibarrApiAccess::$user->rights->facture->creer) { + throw new RestException(401, "Insuffisant rights"); + } + // Check mandatory fields + $result = $this->_validate($request_data); + + foreach($request_data as $field => $value) { + $this->invoice->$field = $value; + } + if(! array_keys($request_data,'date')) { + $this->invoice->date = dol_now(); + } + /* We keep lines as an array + if (isset($request_data["lines"])) { + $lines = array(); + foreach ($request_data["lines"] as $line) { + array_push($lines, (object) $line); + } + $this->invoice->lines = $lines; + }*/ + + if ($this->invoice->create(DolibarrApiAccess::$user) <= 0) { + $errormsg = $this->invoice->error; + throw new RestException(500, $errormsg ? $errormsg : "Error while creating order"); + } + return $this->invoice->id; + } + + /** + * Update invoice + * + * @param int $id Id of invoice to update + * @param array $request_data Datas + * @return int + */ + function put($id, $request_data = NULL) + { + if(! DolibarrApiAccess::$user->rights->facture->creer) { + throw new RestException(401); + } + + $result = $this->invoice->fetch($id); + if( ! $result ) { + throw new RestException(404, 'Invoice not found'); + } + + if( ! DolibarrApi::_checkAccessToResource('facture',$this->invoice->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + + foreach($request_data as $field => $value) { + $this->invoice->$field = $value; + } + + if($this->invoice->update($id, DolibarrApiAccess::$user)) + return $this->get ($id); + + return false; + } + + /** + * Delete invoice + * + * @param int $id Invoice ID + * @return type + */ + function delete($id) + { + if(! DolibarrApiAccess::$user->rights->facture->supprimer) { + throw new RestException(401); + } + $result = $this->invoice->fetch($id); + if( ! $result ) { + throw new RestException(404, 'Invoice not found'); + } + + if( ! DolibarrApi::_checkAccessToResource('facture',$this->facture->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + + if( $this->invoice->delete($id) < 0) + { + throw new RestException(500); + } + + return array( + 'success' => array( + 'code' => 200, + 'message' => 'Facture deleted' + ) + ); + } + + /** + * Validate fields before create or update object + * + * @param array $data Datas to validate + * @return array + * + * @throws RestException + */ + function _validate($data) + { + $invoice = array(); + foreach (Invoices::$FIELDS as $field) { + if (!isset($data[$field])) + throw new RestException(400, "$field field missing"); + $invoice[$field] = $data[$field]; + } + return $invoice; + } +} diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 2bcd227827e..41c1171ccef 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -42,7 +42,9 @@ class FactureRec extends CommonInvoice public $table_element='facture_rec'; public $table_element_line='facturedet_rec'; public $fk_element='fk_facture'; - + public $picto='bill'; + + var $entity; var $number; var $date; var $amount; @@ -241,7 +243,7 @@ class FactureRec extends CommonInvoice */ function fetch($rowid, $ref='', $ref_ext='', $ref_int='') { - $sql = 'SELECT f.rowid, f.titre, f.fk_soc, f.amount, f.tva, f.total, f.total_ttc, f.remise_percent, f.remise_absolue, f.remise'; + $sql = 'SELECT f.rowid, f.entity, f.titre, f.fk_soc, f.amount, f.tva, f.total, f.total_ttc, f.remise_percent, f.remise_absolue, f.remise'; $sql.= ', f.date_lim_reglement as dlr'; $sql.= ', f.note_private, f.note_public, f.fk_user_author'; $sql.= ', f.fk_mode_reglement, f.fk_cond_reglement, f.fk_projet'; @@ -269,6 +271,7 @@ class FactureRec extends CommonInvoice $obj = $this->db->fetch_object($result); $this->id = $obj->rowid; + $this->entity = $obj->entity; $this->titre = $obj->titre; $this->ref = $obj->titre; $this->ref_client = $obj->ref_client; @@ -438,14 +441,14 @@ class FactureRec extends CommonInvoice /** * Delete template invoice * - * @param int $rowid Id of invoice to delete. If empty, we delete current instance of invoice + * @param User $user User that delete. * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @param int $idwarehouse Id warehouse to use for stock change. * @return int <0 if KO, >0 if OK */ - function delete($rowid=0, $notrigger=0, $idwarehouse=-1) + function delete($user, $notrigger=0, $idwarehouse=-1) { - if (empty($rowid)) $rowid=$this->id; + $rowid=$this->id; dol_syslog(get_class($this)."::delete rowid=".$rowid, LOG_DEBUG); @@ -509,7 +512,7 @@ class FactureRec extends CommonInvoice $facid=$this->id; - dol_syslog("FactureRec::addline facid=$facid,desc=$desc,pu_ht=$pu_ht,qty=$qty,txtva=$txtva,fk_product=$fk_product,remise_percent=$remise_percent,date_start=$date_start,date_end=$date_end,ventil=$ventil,info_bits=$info_bits,fk_remise_except=$fk_remise_except,price_base_type=$price_base_type,pu_ttc=$pu_ttc,type=$type,fk_unit=$fk_unit", LOG_DEBUG); + dol_syslog(get_class($this)."::addline facid=$facid,desc=$desc,pu_ht=$pu_ht,qty=$qty,txtva=$txtva,fk_product=$fk_product,remise_percent=$remise_percent,info_bits=$info_bits,fk_remise_except=$fk_remise_except,price_base_type=$price_base_type,pu_ttc=$pu_ttc,type=$type,fk_unit=$fk_unit", LOG_DEBUG); include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; // Check parameters @@ -519,6 +522,7 @@ class FactureRec extends CommonInvoice { // Clean parameters $remise_percent=price2num($remise_percent); + if (empty($remise_percent)) $remise_percent=0; $qty=price2num($qty); if (! $qty) $qty=1; if (! $info_bits) $info_bits=0; @@ -579,12 +583,12 @@ class FactureRec extends CommonInvoice $sql.= ", ".price2num($txtva); $sql.= ", ".(! empty($fk_product)?"'".$fk_product."'":"null"); $sql.= ", ".$product_type; - $sql.= ", '".price2num($remise_percent)."'"; - $sql.= ", '".price2num($pu_ht)."'"; + $sql.= ", ".price2num($remise_percent); + $sql.= ", ".price2num($pu_ht); $sql.= ", null"; - $sql.= ", '".price2num($total_ht)."'"; - $sql.= ", '".price2num($total_tva)."'"; - $sql.= ", '".price2num($total_ttc)."'"; + $sql.= ", ".price2num($total_ht); + $sql.= ", ".price2num($total_tva); + $sql.= ", ".price2num($total_ttc); $sql.= ", ".$rang; $sql.= ", ".$special_code; $sql.= ", ".($fk_unit?"'".$this->db->escape($fk_unit)."'":"null").")"; @@ -604,6 +608,111 @@ class FactureRec extends CommonInvoice } } + /** + * Update a line to invoice + * + * @param int $rowid Id of line to update + * @param string $desc Description de la ligne + * @param double $pu_ht Prix unitaire HT (> 0 even for credit note) + * @param double $qty Quantite + * @param double $txtva Taux de tva force, sinon -1 + * @param int $fk_product Id du produit/service predefini + * @param double $remise_percent Pourcentage de remise de la ligne + * @param string $price_base_type HT or TTC + * @param int $info_bits Bits de type de lignes + * @param int $fk_remise_except Id remise + * @param double $pu_ttc Prix unitaire TTC (> 0 even for credit note) + * @param int $type Type of line (0=product, 1=service) + * @param int $rang Position of line + * @param int $special_code Special code + * @param string $label Label of the line + * @param string $fk_unit Unit + * @return int <0 if KO, Id of line if OK + */ + function updateline($rowid, $desc, $pu_ht, $qty, $txtva, $fk_product=0, $remise_percent=0, $price_base_type='HT', $info_bits=0, $fk_remise_except='', $pu_ttc=0, $type=0, $rang=-1, $special_code=0, $label='', $fk_unit=null) + { + global $mysoc; + + $facid=$this->id; + + dol_syslog(get_class($this)."::updateline facid=".$facid." rowid=$rowid,desc=$desc,pu_ht=$pu_ht,qty=$qty,txtva=$txtva,fk_product=$fk_product,remise_percent=$remise_percent,info_bits=$info_bits,fk_remise_except=$fk_remise_except,price_base_type=$price_base_type,pu_ttc=$pu_ttc,type=$type,fk_unit=$fk_unit", LOG_DEBUG); + include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; + + // Check parameters + if ($type < 0) return -1; + + if ($this->brouillon) + { + // Clean parameters + $remise_percent=price2num($remise_percent); + $qty=price2num($qty); + if (! $qty) $qty=1; + if (! $info_bits) $info_bits=0; + $pu_ht=price2num($pu_ht); + $pu_ttc=price2num($pu_ttc); + $txtva=price2num($txtva); + + if ($price_base_type=='HT') + { + $pu=$pu_ht; + } + else + { + $pu=$pu_ttc; + } + + // Calcul du total TTC et de la TVA pour la ligne a partir de + // qty, pu, remise_percent et txtva + // TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker + // la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva. + $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, 0, 0, 0, $price_base_type, $info_bits, $type, $mysoc); + $total_ht = $tabprice[0]; + $total_tva = $tabprice[1]; + $total_ttc = $tabprice[2]; + + $product_type=$type; + if ($fk_product) + { + $product=new Product($this->db); + $result=$product->fetch($fk_product); + $product_type=$product->type; + } + + $sql = "UPDATE ".MAIN_DB_PREFIX."facturedet_rec SET "; + $sql.= "fk_facture = '".$facid."'"; + $sql.= ", label=".(! empty($label)?"'".$this->db->escape($label)."'":"null"); + $sql.= ", description='".$this->db->escape($desc)."'"; + $sql.= ", price=".price2num($pu_ht); + $sql.= ", qty=".price2num($qty); + $sql.= ", tva_tx=".price2num($txtva); + $sql.= ", fk_product=".(! empty($fk_product)?"'".$fk_product."'":"null"); + $sql.= ", product_type=".$product_type; + $sql.= ", remise_percent='".price2num($remise_percent)."'"; + $sql.= ", subprice='".price2num($pu_ht)."'"; + $sql.= ", total_ht='".price2num($total_ht)."'"; + $sql.= ", total_tva='".price2num($total_tva)."'"; + $sql.= ", total_ttc='".price2num($total_ttc)."'"; + $sql.= ", rang=".$rang; + $sql.= ", special_code=".$special_code; + $sql.= ", fk_unit=".($fk_unit?"'".$this->db->escape($fk_unit)."'":"null"); + $sql.= " WHERE rowid = ".$rowid; + + dol_syslog(get_class($this)."::updateline", LOG_DEBUG); + if ($this->db->query($sql)) + { + $this->id=$facid; + $this->update_price(); + return 1; + } + else + { + $this->error=$this->db->lasterror(); + return -1; + } + } + } + + /** * Return the next date of * @@ -616,14 +725,16 @@ class FactureRec extends CommonInvoice } /** - * Create all recurrents invoices. - * A result may also be provided into this->output + * Create all recurrents invoices (for all entities if multicompany is used). + * A result may also be provided into this->output. + * + * WARNING: This method change context $conf->entity to be in correct context for each recurring invoice found. * * @return int 0 if OK, < 0 if KO (this function is used also by cron so only 0 is OK) */ function createRecurringInvoices() { - global $langs, $db, $user; + global $conf, $langs, $db, $user; $langs->load("bills"); @@ -638,6 +749,7 @@ class FactureRec extends CommonInvoice $sql.= ' WHERE frequency > 0'; // A recurring invoice is an invoice with a frequency $sql.= " AND (date_when IS NULL OR date_when <= '".$db->idate($today)."')"; $sql.= ' AND (nb_gen_done < nb_gen_max OR nb_gen_max = 0)'; + $sql.= $db->order('entity', 'ASC'); //print $sql;exit; $resql = $db->query($sql); @@ -649,7 +761,9 @@ class FactureRec extends CommonInvoice if ($num) $this->output.=$langs->trans("FoundXQualifiedRecurringInvoiceTemplate", $num)."\n"; else $this->output.=$langs->trans("NoQualifiedRecurringInvoiceTemplateFound"); - while ($i < $num) + $saventity = $conf->entity; + + while ($i < $num) // Loop on each template invoice { $line = $db->fetch_object($resql); @@ -658,7 +772,10 @@ class FactureRec extends CommonInvoice $facturerec = new FactureRec($db); $facturerec->fetch($line->rowid); - dol_syslog("createRecurringInvoices Process invoice template id=".$facturerec->id.", ref=".$facturerec->ref); + // Set entity context + $conf->entity = $facturerec->entity; + + dol_syslog("createRecurringInvoices Process invoice template id=".$facturerec->id.", ref=".$facturerec->ref.", entity=".$facturerec->entity); $error=0; @@ -669,7 +786,7 @@ class FactureRec extends CommonInvoice $facture->date = $facturerec->date_when; // We could also use dol_now here but we prefer date_when so invoice has real date when we would like even if we generate later. $facture->socid = $facturerec->socid; - $invoiceidgenerated = $facture->create($user); // This will also update fields of recurring invoice + $invoiceidgenerated = $facture->create($user); if ($invoiceidgenerated <= 0) { $this->errors = $facture->errors; @@ -689,18 +806,20 @@ class FactureRec extends CommonInvoice if (! $error && $invoiceidgenerated >= 0) { - $db->commit(); + $db->commit("createRecurringInvoices Process invoice template id=".$facturerec->id.", ref=".$facturerec->ref); dol_syslog("createRecurringInvoices Process invoice template ".$facturerec->ref." is finished with a success generation"); $nb_create++; $this->output.=$langs->trans("InvoiceGeneratedFromTemplate", $facture->ref, $facturerec->ref)."\n"; } else { - $db->rollback(); + $db->rollback("createRecurringInvoices Process invoice template id=".$facturerec->id.", ref=".$facturerec->ref); } $i++; } + + $conf->entity = $saventity; // Restore entity context } else dol_print_error($db); @@ -760,8 +879,9 @@ class FactureRec extends CommonInvoice $arraynow=dol_getdate($now); $nownotime=dol_mktime(0, 0, 0, $arraynow['mon'], $arraynow['mday'], $arraynow['year']); - $prodids = array(); + // Load array of products prodids $num_prods = 0; + $prodids = array(); $sql = "SELECT rowid"; $sql.= " FROM ".MAIN_DB_PREFIX."product"; @@ -921,7 +1041,7 @@ class FactureRec extends CommonInvoice $sql.= ' SET frequency = '.($frequency?$this->db->escape($frequency):'null'); if (!empty($unit)) { - $sql.= ', unit_frequency = "'.$this->db->escape($unit).'"'; + $sql.= ', unit_frequency = \''.$this->db->escape($unit).'\''; } $sql.= ' WHERE rowid = '.$this->id; @@ -954,7 +1074,7 @@ class FactureRec extends CommonInvoice return -1; } $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element; - $sql.= ' SET date_when = "'.$this->db->idate($date).'"'; + $sql.= " SET date_when = ".($date ? "'".$this->db->idate($date)."'" : "null"); if ($increment_nb_gen_done>0) $sql.= ', nb_gen_done = nb_gen_done + 1'; $sql.= ' WHERE rowid = '.$this->id; @@ -1084,4 +1204,4 @@ class FactureLigneRec extends CommonInvoiceLine } } -} \ No newline at end of file +} diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index b0e0c431502..7171e06c7ee 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -53,69 +53,70 @@ class Facture extends CommonInvoice public $table_element_line = 'facturedet'; public $fk_element = 'fk_facture'; protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe - + public $picto='bill'; + /** * {@inheritdoc} */ protected $table_ref_field = 'facnumber'; - var $socid; + public $socid; - var $author; - var $fk_user_author; - var $fk_user_valid; - var $date; // Date invoice - var $date_creation; // Creation date - var $date_validation; // Validation date - var $datem; - var $ref_client; - var $ref_int; + public $author; + public $fk_user_author; + public $fk_user_valid; + public $date; // Date invoice + public $date_creation; // Creation date + public $date_validation; // Validation date + public $datem; + public $ref_client; + public $ref_int; //Check constants for types - var $type = self::TYPE_STANDARD; + public $type = self::TYPE_STANDARD; //var $amount; - var $remise_absolue; - var $remise_percent; - var $total_ht=0; - var $total_tva=0; - var $total_ttc=0; - var $revenuestamp; + public $remise_absolue; + public $remise_percent; + public $total_ht=0; + public $total_tva=0; + public $total_ttc=0; + public $revenuestamp; //! Fermeture apres paiement partiel: discount_vat, badcustomer, abandon //! Fermeture alors que aucun paiement: replaced (si remplace), abandon - var $close_code; + public $close_code; //! Commentaire si mis a paye sans paiement complet - var $close_note; + public $close_note; //! 1 if invoice paid COMPLETELY, 0 otherwise (do not use it anymore, use statut and close_code) - var $paye; + public $paye; //! id of source invoice if replacement invoice or credit note - var $fk_facture_source; - var $linked_objects=array(); - var $date_lim_reglement; - var $cond_reglement_code; // Code in llx_c_paiement - var $mode_reglement_code; // Code in llx_c_paiement - var $fk_bank; // Field to store bank id to use when payment mode is withdraw + public $fk_facture_source; + public $linked_objects=array(); + public $date_lim_reglement; + public $cond_reglement_code; // Code in llx_c_paiement + public $mode_reglement_code; // Code in llx_c_paiement + public $fk_bank; // Field to store bank id to use when payment mode is withdraw /** * @deprecated */ - var $products=array(); + public $products=array(); /** * @var FactureLigne[] */ - var $lines=array(); - var $line; - var $extraparams=array(); - var $specimen; + public $lines=array(); + public $line; + public $extraparams=array(); + public $specimen; + + public $fac_rec; - var $fac_rec; - // Multicurrency - var $fk_multicurrency; - var $multicurrency_code; - var $multicurrency_tx; - var $multicurrency_total_ht; - var $multicurrency_total_tva; - var $multicurrency_total_ttc; + public $fk_multicurrency; + public $multicurrency_code; + public $multicurrency_tx; + public $multicurrency_total_ht; + public $multicurrency_total_tva; + public $multicurrency_total_ttc; /** * @var int Situation cycle reference number @@ -136,12 +137,14 @@ class Facture extends CommonInvoice * @var array Table of previous situations */ public $tab_previous_situation_invoice=array(); - + /** * @var array Table of next situations */ public $tab_next_situation_invoice=array(); + public $oldcopy; + /** * Standard invoice */ @@ -216,9 +219,9 @@ class Facture extends CommonInvoice } /** - * Create invoice in database - * Note: this->ref can be set or empty. If empty, we will use "(PROV)" - * Note: this->fac_rec must be set to create from recurring invoice + * Create invoice in database. + * Note: this->ref can be set or empty. If empty, we will use "(PROV999)" + * Note: this->fac_rec must be set to create invoice from a recurring invoice * * @param User $user Object user that create * @param int $notrigger 1=Does not execute triggers, 0 otherwise @@ -239,7 +242,8 @@ class Facture extends CommonInvoice if (! $this->cond_reglement_id) $this->cond_reglement_id = 0; if (! $this->mode_reglement_id) $this->mode_reglement_id = 0; $this->brouillon = 1; - + if (empty($this->entity)) $this->entity = $conf->entity; + // Multicurrency (test on $this->multicurrency_tx because we sould take the default rate only if not using origin rate) if (!empty($this->multicurrency_code) && empty($this->multicurrency_tx)) list($this->fk_multicurrency,$this->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code); else $this->fk_multicurrency = MultiCurrency::getIdFromCode($this->db, $this->multicurrency_code); @@ -249,7 +253,7 @@ class Facture extends CommonInvoice $this->fk_multicurrency = 0; $this->multicurrency_tx = 1; } - + dol_syslog(get_class($this)."::create user=".$user->id); // Check parameters @@ -278,8 +282,10 @@ class Facture extends CommonInvoice require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture-rec.class.php'; $_facrec = new FactureRec($this->db); $result=$_facrec->fetch($this->fac_rec); + $result=$_facrec->fetchObjectLinked(); // This load $_facrec->linkedObjectsIds - $this->socid = $_facrec->socid; + $this->socid = $_facrec->socid; // Invoice created on same thirdparty than template + $this->entity = $_facrec->entity; // Invoice created in same entity than template // Fields coming from GUI (priority on template). TODO Value of template should be used as default value on GUI so we can use here always value from GUI $this->fk_project = GETPOST('projectid','int') > 0 ? GETPOST('projectid','int') : $_facrec->fk_project; @@ -289,7 +295,7 @@ class Facture extends CommonInvoice $this->cond_reglement_id = GETPOST('cond_reglement_id') > 0 ? GETPOST('cond_reglement_id') : $_facrec->cond_reglement_id; $this->mode_reglement_id = GETPOST('mode_reglement_id') > 0 ? GETPOST('mode_reglement_id') : $_facrec->mode_reglement_id; $this->fk_account = GETPOST('fk_account') > 0 ? GETPOST('fk_account') : $_facrec->fk_account; - + // Fields always coming from template $this->remise_absolue = $_facrec->remise_absolue; $this->remise_percent = $_facrec->remise_percent; @@ -302,20 +308,24 @@ class Facture extends CommonInvoice $this->note_public=trim($this->note_public); $this->note_private=trim($this->note_private); $this->note_private=dol_concatdesc($this->note_private, $langs->trans("GeneratedFromRecurringInvoice", $_facrec->ref)); - + //if (! $this->remise) $this->remise = 0; if (! $this->mode_reglement_id) $this->mode_reglement_id = 0; $this->brouillon = 1; - + + $this->linked_objects = $_facrec->linkedObjectsIds; + $forceduedate = $this->calculate_date_lim_reglement(); - - // For recurrn invoices, update date and number of last generation of recurring template invoice, before inserting new invoice + + // For recurring invoices, update date and number of last generation of recurring template invoice, before inserting new invoice if ($_facrec->frequency > 0) { + dol_syslog("This is a recurring invoice so we set date_last_gen and next date_when"); + if (empty($_facrec->date_when)) $_facrec->date_when = $now; $next_date = $_facrec->getNextDate(); // Calculate next date - $_facrec->setValueFrom('date_last_gen', $now, '', null, 'date'); + $result = $_facrec->setValueFrom('date_last_gen', $now, '', null, 'date', '', $user, ''); //$_facrec->setValueFrom('nb_gen_done', $_facrec->nb_gen_done + 1); // Not required, +1 already included into setNextDate when second param is 1. - $_facrec->setNextDate($next_date,1); + $result = $_facrec->setNextDate($next_date,1); } } @@ -350,7 +360,7 @@ class Facture extends CommonInvoice $sql.= ")"; $sql.= " VALUES ("; $sql.= "'(PROV)'"; - $sql.= ", ".$conf->entity; + $sql.= ", ".$this->entity; $sql.= ", ".($this->ref_ext?"'".$this->db->escape($this->ref_ext)."'":"null"); $sql.= ", '".$this->db->escape($this->type)."'"; $sql.= ", '".$socid."'"; @@ -397,39 +407,65 @@ class Facture extends CommonInvoice // Add object linked if (! $error && $this->id && is_array($this->linked_objects) && ! empty($this->linked_objects)) { - foreach($this->linked_objects as $origin => $origin_id) + foreach($this->linked_objects as $origin => $tmp_origin_id) { - $ret = $this->add_object_linked($origin, $origin_id); - if (! $ret) + if (is_array($tmp_origin_id)) // New baheviour, if linked_object can have several links per type, so is something like array('contract'=>array(id1, id2, ...)) + { + foreach($tmp_origin_id as $origin_id) + { + $ret = $this->add_object_linked($origin, $origin_id); + if (! $ret) + { + dol_print_error($this->db); + $error++; + } + } + } + else // Old behaviour, if linked_object has only one link per type, so is something like array('contract'=>id1)) + { + $origin_id = $tmp_origin_id; + $ret = $this->add_object_linked($origin, $origin_id); + if (! $ret) + { + dol_print_error($this->db); + $error++; + } + } + + if (! empty($conf->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN)) { - dol_print_error($this->db); - $error++; - } - - // TODO mutualiser - if ($origin == 'commande') - { - // On recupere les differents contact interne et externe - $order = new Commande($this->db); - $order->id = $origin_id; - - // On recupere le commercial suivi propale - $this->userid = $order->getIdcontact('internal', 'SALESREPFOLL'); - - if ($this->userid) - { - //On passe le commercial suivi commande en commercial suivi paiement - $this->add_contact($this->userid[0], 'SALESREPFOLL', 'internal'); - } - - // On recupere le contact client facturation commande - $this->contactid = $order->getIdcontact('external', 'BILLING'); - - if ($this->contactid) - { - //On passe le contact client facturation commande en contact client facturation - $this->add_contact($this->contactid[0], 'BILLING', 'external'); - } + $originforcontact = $origin; + $originidforcontact = $origin_id; + if ($originforcontact == 'shipping') // shipment and order share the same contacts. If creating from shipment we take data of order + { + require_once DOL_DOCUMENT_ROOT . '/expedition/class/expedition.class.php'; + $exp = new Expedition($this->db); + $exp->fetch($origin_id); + $exp->fetchObjectLinked(); + if (count($exp->linkedObjectsIds['commande']) > 0) + { + foreach ($exp->linkedObjectsIds['commande'] as $key => $value) + { + $originforcontact = 'commande'; + $originidforcontact = $value->id; + break; // We take first one + } + } + } + + $sqlcontact = "SELECT ctc.code, ctc.source, ec.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 = $this->db->query($sqlcontact); + if ($resqlcontact) + { + while($objcontact = $this->db->fetch_object($resqlcontact)) + { + //print $objcontact->code.'-'.$objcontact->source.'-'.$objcontact->fk_socpeople."\n"; + $this->add_contact($objcontact->fk_socpeople, $objcontact->code, $objcontact->source); // May failed because of duplicate key or because code of contact type does not exists for new object + } + } + else dol_print_error($resqlcontact); } } } @@ -437,7 +473,7 @@ class Facture extends CommonInvoice /* * Insert lines of invoices into database */ - if (count($this->lines) && is_object($this->lines[0])) // If this->lines is array on InvoiceLines (preferred mode) + if (count($this->lines) && is_object($this->lines[0])) // If this->lines is array of InvoiceLines (preferred mode) { $fk_parent_line = 0; @@ -446,8 +482,8 @@ class Facture extends CommonInvoice { $newinvoiceline=$this->lines[$i]; $newinvoiceline->fk_facture=$this->id; - $newinvoiceline->origin = $this->element; - $newinvoiceline->origin_id = $this->lines[$i]->id; + $newinvoiceline->origin = $this->element; // TODO This seems not used. Here we but origin 'facture' but after + $newinvoiceline->origin_id = $this->lines[$i]->id; // we put an id of object ! if ($result >= 0 && ($newinvoiceline->info_bits & 0x01) == 0) // We keep only lines with first bit = 0 { // Reset fk_parent_line for no child products and special product @@ -471,49 +507,56 @@ class Facture extends CommonInvoice } } } - else // If this->lines is not object of invoice lines + else // If this->lines is an array of invoice line arrays { $fk_parent_line = 0; dol_syslog("There is ".count($this->lines)." lines that are array lines"); + foreach ($this->lines as $i => $val) { - if (($this->lines[$i]->info_bits & 0x01) == 0) // We keep only lines with first bit = 0 + $line = $this->lines[$i]; + + // Test and convert into object this->lines[$i]. When coming from REST API, we may still have an array + //if (! is_object($line)) $line=json_decode(json_encode($line), FALSE); // convert recursively array into object. + if (! is_object($line)) $line = (object) $line; + + if (($line->info_bits & 0x01) == 0) // We keep only lines with first bit = 0 { // Reset fk_parent_line for no child products and special product - if (($this->lines[$i]->product_type != 9 && empty($this->lines[$i]->fk_parent_line)) || $this->lines[$i]->product_type == 9) { + if (($line->product_type != 9 && empty($line->fk_parent_line)) || $line->product_type == 9) { $fk_parent_line = 0; } $result = $this->addline( - $this->lines[$i]->desc, - $this->lines[$i]->subprice, - $this->lines[$i]->qty, - $this->lines[$i]->tva_tx, - $this->lines[$i]->localtax1_tx, - $this->lines[$i]->localtax2_tx, - $this->lines[$i]->fk_product, - $this->lines[$i]->remise_percent, - $this->lines[$i]->date_start, - $this->lines[$i]->date_end, - $this->lines[$i]->fk_code_ventilation, - $this->lines[$i]->info_bits, - $this->lines[$i]->fk_remise_except, + $line->desc, + $line->subprice, + $line->qty, + $line->tva_tx, + $line->localtax1_tx, + $line->localtax2_tx, + $line->fk_product, + $line->remise_percent, + $line->date_start, + $line->date_end, + $line->fk_code_ventilation, + $line->info_bits, + $line->fk_remise_except, 'HT', 0, - $this->lines[$i]->product_type, - $this->lines[$i]->rang, - $this->lines[$i]->special_code, + $line->product_type, + $line->rang, + $line->special_code, $this->element, - $this->lines[$i]->id, + $line->id, $fk_parent_line, - $this->lines[$i]->fk_fournprice, - $this->lines[$i]->pa_ht, - $this->lines[$i]->label, - $this->lines[$i]->array_options, - $this->lines[$i]->situation_percent, - $this->lines[$i]->fk_prev_id, - $this->lines[$i]->fk_unit + $line->fk_fournprice, + $line->pa_ht, + $line->label, + $line->array_options, + $line->situation_percent, + $line->fk_prev_id, + $line->fk_unit ); if ($result < 0) { @@ -524,7 +567,7 @@ class Facture extends CommonInvoice } // Defined the new fk_parent_line - if ($result > 0 && $this->lines[$i]->product_type == 9) { + if ($result > 0 && $line->product_type == 9) { $fk_parent_line = $result; } } @@ -593,21 +636,22 @@ class Facture extends CommonInvoice // Actions on extra fields (by external module or standard code) // TODO le hook fait double emploi avec le trigger !! + /* $hookmanager->initHooks(array('invoicedao')); $parameters=array('invoiceid'=>$this->id); $reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks if (empty($reshook)) { if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used - { - $result=$this->insertExtraFields(); - if ($result < 0) - { - $error++; - } - } + {*/ + if (! $error) + { + $result=$this->insertExtraFields(); + if ($result < 0) $error++; } - else if ($reshook < 0) $error++; + /*} + } + else if ($reshook < 0) $error++;*/ // Call trigger $result=$this->call_trigger('BILL_CREATE',$user); @@ -658,7 +702,7 @@ class Facture extends CommonInvoice function createFromCurrent($user,$invertdetail=0) { global $conf; - + // Charge facture source $facture=new Facture($this->db); @@ -712,15 +756,15 @@ class Facture extends CommonInvoice elseif ($this->type == self::TYPE_SITUATION && !empty($conf->global->INVOICE_USE_SITUATION)) { $this->fetchObjectLinked('', '', $object->id, 'facture'); - - foreach ($this->linkedObjectsIds as $typeObject => $Tfk_object) + + foreach ($this->linkedObjectsIds as $typeObject => $Tfk_object) { - foreach ($Tfk_object as $fk_object) + foreach ($Tfk_object as $fk_object) { $facture->add_object_linked($typeObject, $fk_object); } } - + $facture->add_object_linked('facture', $this->fk_facture_source); } @@ -954,12 +998,15 @@ class Facture extends CommonInvoice * @param int $max Maxlength of ref * @param int $short 1=Return just URL * @param string $moretitle Add more text to title tooltip + * @param int $notooltip 1=Disable tooltip * @return string String with URL */ - function getNomUrl($withpicto=0,$option='',$max=0,$short=0,$moretitle='') + function getNomUrl($withpicto=0,$option='',$max=0,$short=0,$moretitle='',$notooltip=0) { global $langs, $conf; + if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips + $result=''; if ($option == 'withdraw') $url = DOL_URL_ROOT.'/compta/facture/prelevement.php?facid='.$this->id; @@ -971,28 +1018,44 @@ class Facture extends CommonInvoice if ($this->type == self::TYPE_REPLACEMENT) $picto.='r'; // Replacement invoice if ($this->type == self::TYPE_CREDIT_NOTE) $picto.='a'; // Credit note if ($this->type == self::TYPE_DEPOSIT) $picto.='d'; // Deposit invoice - - $label = '' . $langs->trans("ShowInvoice") . ''; - if (! empty($this->ref)) - $label .= '
'.$langs->trans('Ref') . ': ' . $this->ref; - if (! empty($this->ref_client)) - $label .= '
' . $langs->trans('RefCustomer') . ': ' . $this->ref_client; - if (! empty($this->total_ht)) - $label.= '
' . $langs->trans('AmountHT') . ': ' . price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency); - if (! empty($this->total_tva)) - $label.= '
' . $langs->trans('VAT') . ': ' . price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency); - if (! empty($this->total_ttc)) - $label.= '
' . $langs->trans('AmountTTC') . ': ' . price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); - if ($this->type == self::TYPE_REPLACEMENT) $label=$langs->transnoentitiesnoconv("ShowInvoiceReplace").': '.$this->ref; - if ($this->type == self::TYPE_CREDIT_NOTE) $label=$langs->transnoentitiesnoconv("ShowInvoiceAvoir").': '.$this->ref; - if ($this->type == self::TYPE_DEPOSIT) $label=$langs->transnoentitiesnoconv("ShowInvoiceDeposit").': '.$this->ref; - if ($this->type == self::TYPE_SITUATION) $label=$langs->transnoentitiesnoconv("ShowInvoiceSituation").': '.$this->ref; - if ($moretitle) $label.=' - '.$moretitle; - - $linkstart=''; + $label=''; + + if ($user->rights->facture->lire) { + $label = '' . $langs->trans("ShowInvoice") . ''; + if (! empty($this->ref)) + $label .= '
'.$langs->trans('Ref') . ': ' . $this->ref; + if (! empty($this->ref_client)) + $label .= '
' . $langs->trans('RefCustomer') . ': ' . $this->ref_client; + if (! empty($this->total_ht)) + $label.= '
' . $langs->trans('AmountHT') . ': ' . price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency); + if (! empty($this->total_tva)) + $label.= '
' . $langs->trans('VAT') . ': ' . price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency); + if (! empty($this->total_ttc)) + $label.= '
' . $langs->trans('AmountTTC') . ': ' . price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); + if ($this->type == self::TYPE_REPLACEMENT) $label=$langs->transnoentitiesnoconv("ShowInvoiceReplace").': '.$this->ref; + if ($this->type == self::TYPE_CREDIT_NOTE) $label=$langs->transnoentitiesnoconv("ShowInvoiceAvoir").': '.$this->ref; + if ($this->type == self::TYPE_DEPOSIT) $label=$langs->transnoentitiesnoconv("ShowInvoiceDeposit").': '.$this->ref; + if ($this->type == self::TYPE_SITUATION) $label=$langs->transnoentitiesnoconv("ShowInvoiceSituation").': '.$this->ref; + if ($moretitle) $label.=' - '.$moretitle; + } + + $linkclose=''; + if (empty($notooltip) && $user->rights->facture->lire) + { + if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) + { + $label=$langs->trans("ShowInvoice"); + $linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"'; + } + $linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose.=' class="classfortooltip"'; + } + + $linkstart='
'; $linkend=''; - if ($withpicto) $result.=($linkstart.img_object(($max?dol_trunc($label,$max):$label), $picto, 'class="classfortooltip"').$linkend); + if ($withpicto) $result.=($linkstart.img_object(($notooltip?'':$label), $picto, ($notooltip?'':'class="classfortooltip"')).$linkend); if ($withpicto && $withpicto != 2) $result.=' '; if ($withpicto != 2) $result.=$linkstart.($max?dol_trunc($this->ref,$max):$this->ref).$linkend; return $result; @@ -1014,7 +1077,8 @@ class Facture extends CommonInvoice if (empty($rowid) && empty($ref) && empty($ref_ext) && empty($ref_int)) return -1; - $sql = 'SELECT f.rowid,f.facnumber,f.ref_client,f.ref_ext,f.ref_int,f.type,f.fk_soc,f.amount,f.tva, f.localtax1, f.localtax2, f.total, f.total_ttc, f.revenuestamp'; + $sql = 'SELECT f.rowid,f.facnumber,f.ref_client,f.ref_ext,f.ref_int,f.type,f.fk_soc,f.amount'; + $sql.= ', f.tva, f.localtax1, f.localtax2, f.total, f.total_ttc, f.revenuestamp'; $sql.= ', f.remise_percent, f.remise_absolue, f.remise'; $sql.= ', f.datef as df, f.date_pointoftax'; $sql.= ', f.date_lim_reglement as dlr'; @@ -1107,7 +1171,7 @@ class Facture extends CommonInvoice $this->multicurrency_total_ht = $obj->multicurrency_total_ht; $this->multicurrency_total_tva = $obj->multicurrency_total_tva; $this->multicurrency_total_ttc = $obj->multicurrency_total_ttc; - + if ($this->type == self::TYPE_SITUATION && $fetch_situation) { $this->fetchPreviousNextSituationInvoice(); @@ -1160,7 +1224,7 @@ class Facture extends CommonInvoice { $this->lines=array(); - $sql = 'SELECT l.rowid, l.fk_product, l.fk_parent_line, l.label as custom_label, l.description, l.product_type, l.price, l.qty, l.tva_tx, '; + $sql = 'SELECT l.rowid, l.fk_product, l.fk_parent_line, l.label as custom_label, l.description, l.product_type, l.price, l.qty, l.vat_src_code, l.tva_tx,'; $sql.= ' l.situation_percent, l.fk_prev_id,'; $sql.= ' l.localtax1_tx, l.localtax2_tx, l.localtax1_type, l.localtax2_type, l.remise_percent, l.fk_remise_except, l.subprice,'; $sql.= ' l.rang, l.special_code,'; @@ -1199,6 +1263,8 @@ class Facture extends CommonInvoice $line->fk_product_type = $objp->fk_product_type; // Type of product $line->qty = $objp->qty; $line->subprice = $objp->subprice; + + $line->vat_src_code = $objp->vat_src_code; $line->tva_tx = $objp->tva_tx; $line->localtax1_tx = $objp->localtax1_tx; $line->localtax2_tx = $objp->localtax2_tx; @@ -1229,7 +1295,7 @@ class Facture extends CommonInvoice $line->situation_percent= $objp->situation_percent; $line->fk_prev_id = $objp->fk_prev_id; $line->fk_unit = $objp->fk_unit; - + // Multicurrency $line->fk_multicurrency = $objp->fk_multicurrency; $line->multicurrency_code = $objp->multicurrency_code; @@ -1237,7 +1303,7 @@ class Facture extends CommonInvoice $line->multicurrency_total_ht = $objp->multicurrency_total_ht; $line->multicurrency_total_tva = $objp->multicurrency_total_tva; $line->multicurrency_total_ttc = $objp->multicurrency_total_ttc; - + $this->lines[$i] = $line; $i++; @@ -1255,17 +1321,17 @@ class Facture extends CommonInvoice /** * Fetch previous and next situations invoices * - * @return void + * @return void */ function fetchPreviousNextSituationInvoice() { global $conf; - + $this->tab_previous_situation_invoice = array(); $this->tab_next_situation_invoice = array(); - + $sql = 'SELECT rowid, situation_counter FROM '.MAIN_DB_PREFIX.'facture WHERE rowid <> '.$this->id.' AND entity = '.$conf->entity.' AND situation_cycle_ref = '.(int) $this->situation_cycle_ref.' ORDER BY situation_counter ASC'; - + dol_syslog(get_class($this).'::fetchPreviousNextSituationInvoice ', LOG_DEBUG); $result = $this->db->query($sql); if ($result && $this->db->num_rows($result) > 0) @@ -1274,13 +1340,13 @@ class Facture extends CommonInvoice { $invoice = new Facture($this->db); if ($invoice->fetch($objp->rowid) > 0) - { + { if ($objp->situation_counter < $this->situation_counter) $this->tab_previous_situation_invoice[] = $invoice; else $this->tab_next_situation_invoice[] = $invoice; } } } - + } /** @@ -1486,39 +1552,76 @@ class Facture extends CommonInvoice * Set customer ref * * @param string $ref_client Customer ref + * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ - function set_ref_client($ref_client) + function set_ref_client($ref_client, $notrigger=0) { + global $user; + + $error=0; + + $this->db->begin(); + $sql = 'UPDATE '.MAIN_DB_PREFIX.'facture'; if (empty($ref_client)) $sql .= ' SET ref_client = NULL'; else $sql .= ' SET ref_client = \''.$this->db->escape($ref_client).'\''; $sql .= ' WHERE rowid = '.$this->id; - if ($this->db->query($sql)) + + dol_syslog(__METHOD__.' this->id='.$this->id.', ref_client='.$ref_client, LOG_DEBUG); + $resql=$this->db->query($sql); + if (!$resql) + { + $this->errors[]=$this->db->error(); + $error++; + } + + if (! $error) { $this->ref_client = $ref_client; + } + + if (! $notrigger && empty($error)) + { + // Call trigger + $result=$this->call_trigger('BILL_MODIFY',$user); + if ($result < 0) $error++; + // End call triggers + } + + if (! $error) + { + + $this->ref_client = $ref_client; + + $this->db->commit(); return 1; } else { - dol_print_error($this->db); - return -1; + foreach($this->errors as $errmsg) + { + dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); + $this->error.=($this->error?', '.$errmsg:$errmsg); + } + $this->db->rollback(); + return -1*$error; } } /** * Delete invoice * - * @param int $rowid Id of invoice to delete. If empty, we delete current instance of invoice + * @param User $user User to delete. * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @param int $idwarehouse Id warehouse to use for stock change. * @return int <0 if KO, >0 if OK */ - function delete($rowid=0, $notrigger=0, $idwarehouse=-1) + function delete($user, $notrigger=0, $idwarehouse=-1) { - global $user,$langs,$conf; + global $langs,$conf; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; if (empty($rowid)) $rowid=$this->id; @@ -1683,7 +1786,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; @@ -1848,7 +1951,7 @@ class Facture extends CommonInvoice * @param User $user Object user that validate * @param string $force_number Reference to force on invoice * @param int $idwarehouse Id of warehouse to use for stock decrease if option to decreasenon stock is on (0=no decrease) - * @param int $notrigger 1=Does not execute triggers, 0= execuete triggers + * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ function validate($user, $force_number='', $idwarehouse=0, $notrigger=0) @@ -2061,16 +2164,17 @@ class Facture extends CommonInvoice $this->brouillon=0; $this->date_validation=$now; $i = 0; - + if (!empty($conf->global->INVOICE_USE_SITUATION)) { $final = True; - while ($i < count($this->lines) && $final == True) { + $nboflines = count($this->lines); + while (($i < $nboflines) && $final) { $final = ($this->lines[$i]->situation_percent == 100); $i++; } if ($final) { - $this->setFinal(); + $this->setFinal($user); } } } @@ -2094,7 +2198,7 @@ class Facture extends CommonInvoice /** * Update price of next invoice - * + * * @param Translate $langs Translate object * @return bool false if KO, true if OK */ @@ -2103,13 +2207,13 @@ class Facture extends CommonInvoice foreach ($this->tab_next_situation_invoice as $next_invoice) { $is_last = $next_invoice->is_last_in_cycle(); - - if ($next_invoice->brouillon && $is_last != 1) + + if ($next_invoice->brouillon && $is_last != 1) { $this->error = $langs->trans('updatePriceNextInvoiceErrorUpdateline', $next_invoice->ref); return false; } - + $next_invoice->brouillon = 1; foreach ($next_invoice->lines as $line) { @@ -2117,17 +2221,17 @@ class Facture extends CommonInvoice $line->date_start, $line->date_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit); - - if ($result < 0) + + if ($result < 0) { $this->error = $langs->trans('updatePriceNextInvoiceErrorUpdateline', $next_invoice->ref); return false; } } - + break; // Only the next invoice and not each next invoice } - + return true; } @@ -2229,7 +2333,7 @@ class Facture extends CommonInvoice * @param string $desc Description of line * @param double $pu_ht Unit price without tax (> 0 even for credit note) * @param double $qty Quantity - * @param double $txtva Force vat rate, -1 for auto + * @param double $txtva Force Vat rate, -1 for auto * @param double $txlocaltax1 Local tax 1 rate (deprecated) * @param double $txlocaltax2 Local tax 2 rate (deprecated) * @param int $fk_product Id of predefined product/service @@ -2280,7 +2384,17 @@ class Facture extends CommonInvoice if (empty($fk_parent_line) || $fk_parent_line < 0) $fk_parent_line=0; if (empty($fk_prev_id)) $fk_prev_id = 'null'; if (! isset($situation_percent) || $situation_percent > 100 || (string) $situation_percent == '') $situation_percent = 100; - + + $localtaxes_type=getLocalTaxesFromRate($txtva, 0, $this->thirdparty, $mysoc); + + // Clean vat code + $vat_src_code=''; + if (preg_match('/\((.*)\)/', $txtva, $reg)) + { + $vat_src_code = $reg[1]; + $txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate. + } + $remise_percent=price2num($remise_percent); $qty=price2num($qty); $pu_ht=price2num($pu_ht); @@ -2314,7 +2428,8 @@ class Facture extends CommonInvoice $product_type=$product->type; if (! empty($conf->global->STOCK_MUST_BE_ENOUGH_FOR_INVOICE) && $product_type == 0 && $product->stock_reel < $qty) { - $this->error=$langs->trans('ErrorStockIsNotEnough'); + $langs->load("errors"); + $this->error=$langs->trans('ErrorStockIsNotEnoughToAddProductOnInvoice', $product->ref); $this->db->rollback(); return -3; } @@ -2325,9 +2440,6 @@ class Facture extends CommonInvoice // TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker // la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva. - $localtaxes_type=getLocalTaxesFromRate($txtva,0,$this->thirdparty, $mysoc); - $txtva = preg_replace('/\s*\(.*\)/','',$txtva); // Remove code into vatrate. - $tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $product_type, $mysoc, $localtaxes_type, $situation_percent, $this->multicurrency_tx); $total_ht = $tabprice[0]; @@ -2341,7 +2453,7 @@ class Facture extends CommonInvoice $multicurrency_total_ht = $tabprice[16]; $multicurrency_total_tva = $tabprice[17]; $multicurrency_total_ttc = $tabprice[18]; - + // Rank to use $rangtouse = $rang; if ($rangtouse == -1) @@ -2354,31 +2466,37 @@ class Facture extends CommonInvoice $this->line=new FactureLigne($this->db); $this->line->context = $this->context; - + $this->line->fk_facture=$this->id; $this->line->label=$label; // deprecated $this->line->desc=$desc; - $this->line->qty= ($this->type==self::TYPE_CREDIT_NOTE?abs($qty):$qty); // For credit note, quantity is always positive and unit price negative + + $this->line->qty= ($this->type==self::TYPE_CREDIT_NOTE?abs($qty):$qty); // For credit note, quantity is always positive and unit price negative + $this->line->subprice= ($this->type==self::TYPE_CREDIT_NOTE?-abs($pu_ht):$pu_ht); // For credit note, unit price always negative, always positive otherwise + + $this->line->vat_src_code=$vat_src_code; $this->line->tva_tx=$txtva; $this->line->localtax1_tx=$txlocaltax1; $this->line->localtax2_tx=$txlocaltax2; + $this->line->localtax1_type = $localtaxes_type[0]; + $this->line->localtax2_type = $localtaxes_type[2]; + + $this->line->total_ht= (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_ht):$total_ht); // For credit note and if qty is negative, total is negative + $this->line->total_ttc= (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_ttc):$total_ttc); // For credit note and if qty is negative, total is negative + $this->line->total_tva= (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_tva):$total_tva); // For credit note and if qty is negative, total is negative + $this->line->total_localtax1=(($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_localtax1):$total_localtax1); // For credit note and if qty is negative, total is negative + $this->line->total_localtax2=(($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_localtax2):$total_localtax2); // For credit note and if qty is negative, total is negative + $this->line->fk_product=$fk_product; $this->line->product_type=$product_type; $this->line->remise_percent=$remise_percent; - $this->line->subprice= ($this->type==self::TYPE_CREDIT_NOTE?-abs($pu_ht):$pu_ht); // For credit note, unit price always negative, always positive otherwise $this->line->date_start=$date_start; $this->line->date_end=$date_end; $this->line->ventil=$ventil; $this->line->rang=$rangtouse; $this->line->info_bits=$info_bits; $this->line->fk_remise_except=$fk_remise_except; - $this->line->total_ht= (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_ht):$total_ht); // For credit note and if qty is negative, total is negative - $this->line->total_tva= $total_tva; - $this->line->total_localtax1=$total_localtax1; - $this->line->total_localtax2=$total_localtax2; - $this->line->localtax1_type = $localtaxes_type[0]; - $this->line->localtax2_type = $localtaxes_type[2]; - $this->line->total_ttc= (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_ttc):$total_ttc); + $this->line->special_code=$special_code; $this->line->fk_parent_line=$fk_parent_line; $this->line->origin=$origin; @@ -2390,7 +2508,7 @@ class Facture extends CommonInvoice // infos marge $this->line->fk_fournprice = $fk_fournprice; $this->line->pa_ht = $pa_ht; - + // Multicurrency $this->line->fk_multicurrency = $this->fk_multicurrency; $this->line->multicurrency_code = $this->multicurrency_code; @@ -2398,7 +2516,7 @@ class Facture extends CommonInvoice $this->line->multicurrency_total_ht = $multicurrency_total_ht; $this->line->multicurrency_total_tva = $multicurrency_total_tva; $this->line->multicurrency_total_ttc = $multicurrency_total_ttc; - + if (is_array($array_options) && count($array_options)>0) { $this->line->array_options=$array_options; } @@ -2483,7 +2601,7 @@ class Facture extends CommonInvoice return -3; } } - + $this->db->begin(); // Clean parameters @@ -2509,7 +2627,7 @@ class Facture extends CommonInvoice $localtaxes_type=getLocalTaxesFromRate($txtva,0,$this->thirdparty, $mysoc); $txtva = preg_replace('/\s*\(.*\)/','',$txtva); // Remove code into vatrate. - + $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $mysoc, $localtaxes_type, $situation_percent, $this->multicurrency_tx); $total_ht = $tabprice[0]; @@ -2525,7 +2643,7 @@ class Facture extends CommonInvoice $multicurrency_total_ht = $tabprice[16]; $multicurrency_total_tva = $tabprice[17]; $multicurrency_total_ttc = $tabprice[18]; - + // Old properties: $price, $remise (deprecated) $price = $pu; $remise = 0; @@ -2547,7 +2665,8 @@ class Facture extends CommonInvoice $product_type=$product->type; if (! empty($conf->global->STOCK_MUST_BE_ENOUGH_FOR_INVOICE) && $product_type == 0 && $product->stock_reel < $qty) { - $this->error=$langs->trans('ErrorStockIsNotEnough'); + $langs->load("errors"); + $this->error=$langs->trans('ErrorStockIsNotEnoughToAddProductOnInvoice', $product->ref); $this->db->rollback(); return -3; } @@ -2570,11 +2689,14 @@ class Facture extends CommonInvoice $this->line->label = $label; $this->line->desc = $desc; $this->line->qty = ($this->type==self::TYPE_CREDIT_NOTE?abs($qty):$qty); // For credit note, quantity is always positive and unit price negative + + $this->line->vat_src_code=$vat_src_code; $this->line->tva_tx = $txtva; $this->line->localtax1_tx = $txlocaltax1; $this->line->localtax2_tx = $txlocaltax2; $this->line->localtax1_type = $localtaxes_type[0]; $this->line->localtax2_type = $localtaxes_type[2]; + $this->line->remise_percent = $remise_percent; $this->line->subprice = ($this->type==2?-abs($pu_ht):$pu_ht); // For credit note, unit price always negative, always positive otherwise $this->line->date_start = $date_start; @@ -2600,7 +2722,7 @@ class Facture extends CommonInvoice $this->line->multicurrency_total_ht = $multicurrency_total_ht; $this->line->multicurrency_total_tva = $multicurrency_total_tva; $this->line->multicurrency_total_ttc = $multicurrency_total_ttc; - + if (is_array($array_options) && count($array_options)>0) { $this->line->array_options=$array_options; } @@ -2631,28 +2753,28 @@ class Facture extends CommonInvoice } /** - * Check if the percent edited is lower of next invoice line - * + * Check if the percent edited is lower of next invoice line + * * @param int $idline id of line to check * @param float $situation_percent progress percentage need to be test * @return false if KO, true if OK */ function checkProgressLine($idline, $situation_percent) { - $sql = 'SELECT fd.situation_percent FROM '.MAIN_DB_PREFIX.'facturedet fd - INNER JOIN '.MAIN_DB_PREFIX.'facture f ON (fd.fk_facture = f.rowid) - WHERE fd.fk_prev_id = '.$idline.' + $sql = 'SELECT fd.situation_percent FROM '.MAIN_DB_PREFIX.'facturedet fd + INNER JOIN '.MAIN_DB_PREFIX.'facture f ON (fd.fk_facture = f.rowid) + WHERE fd.fk_prev_id = '.$idline.' AND f.fk_statut <> 0'; - + $result = $this->db->query($sql); if (! $result) { $this->error=$this->db->error(); return false; } - + $obj = $this->db->fetch_object($result); - + if ($obj === null) return true; else return $situation_percent < $obj->situation_percent; } @@ -2667,7 +2789,7 @@ class Facture extends CommonInvoice function update_percent($line, $percent) { global $mysoc,$user; - + include_once(DOL_DOCUMENT_ROOT . '/core/lib/price.lib.php'); // Cap percentages to 100 @@ -2753,9 +2875,10 @@ class Facture extends CommonInvoice * * @param User $user User that set discount * @param double $remise Discount + * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if ko, >0 if ok */ - function set_remise($user, $remise) + function set_remise($user, $remise, $notrigger=0) { // Clean parameters if (empty($remise)) $remise=0; @@ -2764,21 +2887,48 @@ class Facture extends CommonInvoice { $remise=price2num($remise); + $error=0; + + $this->db->begin(); + $sql = 'UPDATE '.MAIN_DB_PREFIX.'facture'; $sql.= ' SET remise_percent = '.$remise; $sql.= ' WHERE rowid = '.$this->id; $sql.= ' AND fk_statut = '.self::STATUS_DRAFT; - if ($this->db->query($sql)) + dol_syslog(__METHOD__, LOG_DEBUG); + $resql=$this->db->query($sql); + if (!$resql) + { + $this->errors[]=$this->db->error(); + $error++; + } + + if (! $notrigger && empty($error)) + { + // Call trigger + $result=$this->call_trigger('BILL_MODIFY',$user); + if ($result < 0) $error++; + // End call triggers + } + + if (! $error) { $this->remise_percent = $remise; $this->update_price(1); + + $this->db->commit(); return 1; } else { - $this->error=$this->db->error(); - return -1; + foreach($this->errors as $errmsg) + { + dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); + $this->error.=($this->error?', '.$errmsg:$errmsg); + } + $this->db->rollback(); + return -1*$error; } } } @@ -2789,14 +2939,19 @@ class Facture extends CommonInvoice * * @param User $user User that set discount * @param double $remise Discount + * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ - function set_remise_absolue($user, $remise) + function set_remise_absolue($user, $remise, $notrigger=0) { if (empty($remise)) $remise=0; if ($user->rights->facture->creer) { + $error=0; + + $this->db->begin(); + $remise=price2num($remise); $sql = 'UPDATE '.MAIN_DB_PREFIX.'facture'; @@ -2804,18 +2959,43 @@ class Facture extends CommonInvoice $sql.= ' WHERE rowid = '.$this->id; $sql.= ' AND fk_statut = '.self::STATUS_DRAFT; - dol_syslog(get_class($this)."::set_remise_absolue", LOG_DEBUG); - - if ($this->db->query($sql)) + dol_syslog(__METHOD__, LOG_DEBUG); + $resql=$this->db->query($sql); + if (!$resql) { + $this->errors[]=$this->db->error(); + $error++; + } + + if (! $error) + { + $this->oldcopy= clone $this; $this->remise_absolue = $remise; $this->update_price(1); + } + + if (! $notrigger && empty($error)) + { + // Call trigger + $result=$this->call_trigger('BILL_MODIFY',$user); + if ($result < 0) $error++; + // End call triggers + } + + if (! $error) + { + $this->db->commit(); return 1; } else { - $this->error=$this->db->error(); - return -1; + foreach($this->errors as $errmsg) + { + dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); + $this->error.=($this->error?', '.$errmsg:$errmsg); + } + $this->db->rollback(); + return -1*$error; } } } @@ -2842,9 +3022,10 @@ class Facture extends CommonInvoice $field2='fk_paiementfourn'; } - $sql = 'SELECT pf.amount, pf.multicurrency_amount, p.fk_paiement, p.datep, t.code'; + $sql = 'SELECT pf.amount, pf.multicurrency_amount, p.fk_paiement, p.datep, p.num_paiement as num, t.code'; $sql.= ' FROM '.MAIN_DB_PREFIX.$table.' as pf, '.MAIN_DB_PREFIX.$table2.' as p, '.MAIN_DB_PREFIX.'c_paiement as t'; $sql.= ' WHERE pf.'.$field.' = '.$this->id; + //$sql.= ' WHERE pf.'.$field.' = 1'; $sql.= ' AND pf.'.$field2.' = p.rowid'; $sql.= ' AND p.fk_paiement = t.id'; if ($filtertype) $sql.=" AND t.code='PRE'"; @@ -2858,7 +3039,7 @@ class Facture extends CommonInvoice while ($i < $num) { $obj = $this->db->fetch_object($resql); - $retarray[]=array('amount'=>$obj->amount,'type'=>$obj->code, 'date'=>$obj->datep); + $retarray[]=array('amount'=>$obj->amount,'type'=>$obj->code, 'date'=>$obj->datep, 'num'=>$obj->num); $i++; } $this->db->free($resql); @@ -3442,7 +3623,7 @@ class Facture extends CommonInvoice $clause = " WHERE"; - $sql = "SELECT f.rowid, f.date_lim_reglement as datefin"; + $sql = "SELECT f.rowid, f.date_lim_reglement as datefin,f.fk_statut"; $sql.= " FROM ".MAIN_DB_PREFIX."facture as f"; if (!$user->rights->societe->client->voir && !$user->societe_id) { @@ -3472,6 +3653,7 @@ class Facture extends CommonInvoice while ($obj=$this->db->fetch_object($resql)) { $generic_facture->date_lim_reglement = $this->db->jdate($obj->datefin); + $generic_facture->statut = $obj->fk_statut; $response->nbtodo++; @@ -3530,6 +3712,8 @@ class Facture extends CommonInvoice $arraynow=dol_getdate($now); $nownotime=dol_mktime(0, 0, 0, $arraynow['mon'], $arraynow['mday'], $arraynow['year']); + // Load array of products prodids + $num_prods = 0; $prodids = array(); $sql = "SELECT rowid"; $sql.= " FROM ".MAIN_DB_PREFIX."product"; @@ -3546,6 +3730,10 @@ class Facture extends CommonInvoice $prodids[$i] = $row[0]; } } + //Avoid php warning Warning: mt_rand(): max(0) is smaller than min(1) when no product exists + if (empty($num_prods)) { + $num_prods=1; + } // Initialize parameters $this->id=0; @@ -3779,7 +3967,7 @@ class Facture extends CommonInvoice function get_prev_sits() { global $conf; - + $sql = 'SELECT rowid FROM ' . MAIN_DB_PREFIX . 'facture'; $sql .= ' where situation_cycle_ref = ' . $this->situation_cycle_ref; $sql .= ' and situation_counter < ' . $this->situation_counter; @@ -3805,25 +3993,49 @@ class Facture extends CommonInvoice /** * Sets the invoice as a final situation * - * @return int 1 if ok, -1 if error + * @param User $user Object user + * @param int $notrigger 1=Does not execute triggers, 0= execute triggers + * @return int <0 if KO, >0 if OK */ - function setFinal() + function setFinal(User $user, $notrigger=0) { - - $this->db->begin(); - + $error=0; + + $this->db->begin(); + $this->situation_final = 1; - $sql = 'update ' . MAIN_DB_PREFIX . 'facture set situation_final = ' . $this->situation_final . ' where rowid = ' . $this->id; - $resql = $this->db->query($sql); - if ($resql) { - // FIXME: call triggers MODIFY because we modify invoice + $sql = 'UPDATE ' . MAIN_DB_PREFIX . 'facture SET situation_final = ' . $this->situation_final . ' where rowid = ' . $this->id; + + dol_syslog(__METHOD__, LOG_DEBUG); + $resql=$this->db->query($sql); + if (!$resql) + { + $this->errors[]=$this->db->error(); + $error++; + } + + if (! $notrigger && empty($error)) + { + // Call trigger + $result=$this->call_trigger('BILL_MODIFY',$user); + if ($result < 0) $error++; + // End call triggers + } + + if (! $error) + { $this->db->commit(); return 1; - } else { - $this->error = $this->db->lasterror(); - dol_syslog(get_class($this) . "::update Error setFinal " . $sql, LOG_ERR); + } + else + { + foreach($this->errors as $errmsg) + { + dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); + $this->error.=($this->error?', '.$errmsg:$errmsg); + } $this->db->rollback(); - return -1; + return -1*$error; } } @@ -3836,12 +4048,12 @@ class Facture extends CommonInvoice function is_last_in_cycle() { global $conf; - + if (!empty($this->situation_cycle_ref)) { // No point in testing anything if we're not inside a cycle $sql = 'SELECT max(situation_counter) FROM ' . MAIN_DB_PREFIX . 'facture WHERE situation_cycle_ref = ' . $this->situation_cycle_ref . ' AND entity = ' . ($this->entity > 0 ? $this->entity : $conf->entity); $resql = $this->db->query($sql); - + if ($resql && $resql->num_rows > 0) { $res = $this->db->fetch_array($resql); $last = $res['max(situation_counter)']; @@ -3886,7 +4098,7 @@ class Facture extends CommonInvoice // Paid invoices have status STATUS_CLOSED if ($this->statut != Facture::STATUS_VALIDATED) return false; - + return $this->date_lim_reglement < ($now - $conf->facture->client->warning_delay); } } @@ -3975,7 +4187,7 @@ class FactureLigne extends CommonInvoiceLine var $multicurrency_total_ht; var $multicurrency_total_tva; var $multicurrency_total_ttc; - + /** * Load invoice line from database * @@ -3992,6 +4204,10 @@ class FactureLigne extends CommonInvoiceLine $sql.= ' fd.fk_unit,'; $sql.= ' fd.situation_percent, fd.fk_prev_id,'; $sql.= ' p.ref as product_ref, p.label as product_libelle, p.description as product_desc'; + $sql.= ' , fd.multicurrency_subprice'; + $sql.= ' , fd.multicurrency_total_ht'; + $sql.= ' , fd.multicurrency_total_tva'; + $sql.= ' , fd.multicurrency_total_ttc'; $sql.= ' FROM '.MAIN_DB_PREFIX.'facturedet as fd'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON fd.fk_product = p.rowid'; $sql.= ' WHERE fd.rowid = '.$rowid; @@ -4042,6 +4258,11 @@ class FactureLigne extends CommonInvoiceLine $this->situation_percent = $objp->situation_percent; $this->fk_prev_id = $objp->fk_prev_id; + $this->multicurrency_subprice = $objp->multicurrency_subprice; + $this->multicurrency_total_ht = $objp->multicurrency_total_ht; + $this->multicurrency_total_tva= $objp->multicurrency_total_tva; + $this->multicurrency_total_ttc= $objp->multicurrency_total_ttc; + $this->db->free($result); return 1; @@ -4065,7 +4286,7 @@ class FactureLigne extends CommonInvoiceLine $error=0; $pa_ht_isemptystring = (empty($this->pa_ht) && $this->pa_ht == ''); // If true, we can use a default value. If this->pa_ht = '0', we must use '0'. - + dol_syslog(get_class($this)."::insert rang=".$this->rang, LOG_DEBUG); // Clean parameters @@ -4091,9 +4312,9 @@ class FactureLigne extends CommonInvoiceLine if (empty($this->multicurrency_total_ht)) $this->multicurrency_total_ht=0; if (empty($this->multicurrency_total_tva)) $this->multicurrency_total_tva=0; if (empty($this->multicurrency_total_ttc)) $this->multicurrency_total_ttc=0; - + // if buy price not defined, define buyprice as configured in margin admin - if ($this->pa_ht == 0 && $pa_ht_isemptystring) + if ($this->pa_ht == 0 && $pa_ht_isemptystring) { if (($result = $this->defineBuyPrice($this->subprice, $this->remise_percent, $this->fk_product)) < 0) { @@ -4127,7 +4348,7 @@ class FactureLigne extends CommonInvoiceLine // Insertion dans base de la ligne $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'facturedet'; $sql.= ' (fk_facture, fk_parent_line, label, description, qty,'; - $sql.= ' tva_tx, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type,'; + $sql.= ' vat_src_code, tva_tx, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type,'; $sql.= ' fk_product, product_type, remise_percent, subprice, fk_remise_except,'; $sql.= ' date_start, date_end, fk_code_ventilation, '; $sql.= ' rang, special_code, fk_product_fournisseur_price, buy_price_ht,'; @@ -4141,6 +4362,7 @@ class FactureLigne extends CommonInvoiceLine $sql.= " ".(! empty($this->label)?"'".$this->db->escape($this->label)."'":"null").","; $sql.= " '".$this->db->escape($this->desc)."',"; $sql.= " ".price2num($this->qty).","; + $sql.= " ".(empty($this->vat_src_code)?"''":"'".$this->vat_src_code."'").","; $sql.= " ".price2num($this->tva_tx).","; $sql.= " ".price2num($this->localtax1_tx).","; $sql.= " ".price2num($this->localtax2_tx).","; @@ -4277,7 +4499,7 @@ class FactureLigne extends CommonInvoiceLine $error=0; $pa_ht_isemptystring = (empty($this->pa_ht) && $this->pa_ht == ''); // If true, we can use a default value. If this->pa_ht = '0', we must use '0'. - + // Clean parameters $this->desc=trim($this->desc); if (empty($this->tva_tx)) $this->tva_tx=0; @@ -4295,11 +4517,16 @@ class FactureLigne extends CommonInvoiceLine if (! isset($this->situation_percent) || $this->situation_percent > 100 || (string) $this->situation_percent == '') $this->situation_percent = 100; if (empty($this->pa_ht)) $this->pa_ht=0; + if (empty($this->multicurrency_subprice)) $this->multicurrency_subprice=0; + if (empty($this->multicurrency_total_ht)) $this->multicurrency_total_ht=0; + if (empty($this->multicurrency_total_tva)) $this->multicurrency_total_tva=0; + if (empty($this->multicurrency_total_ttc)) $this->multicurrency_total_ttc=0; + // Check parameters if ($this->product_type < 0) return -1; // if buy price not defined, define buyprice as configured in margin admin - if ($this->pa_ht == 0 && $pa_ht_isemptystring) + if ($this->pa_ht == 0 && $pa_ht_isemptystring) { if (($result = $this->defineBuyPrice($this->subprice, $this->remise_percent, $this->fk_product)) < 0) { @@ -4321,6 +4548,7 @@ class FactureLigne extends CommonInvoiceLine $sql.= ",remise_percent=".price2num($this->remise_percent).""; if ($this->fk_remise_except) $sql.= ",fk_remise_except=".$this->fk_remise_except; else $sql.= ",fk_remise_except=null"; + $sql.= ",vat_src_code = '".(empty($this->vat_src_code)?'':$this->vat_src_code)."'"; $sql.= ",tva_tx=".price2num($this->tva_tx).""; $sql.= ",localtax1_tx=".price2num($this->localtax1_tx).""; $sql.= ",localtax2_tx=".price2num($this->localtax2_tx).""; @@ -4346,13 +4574,13 @@ class FactureLigne extends CommonInvoiceLine if (! empty($this->rang)) $sql.= ", rang=".$this->rang; $sql .= ", situation_percent=" . $this->situation_percent; $sql .= ", fk_unit=".(!$this->fk_unit ? 'NULL' : $this->fk_unit); - + // Multicurrency $sql.= " , multicurrency_subprice=".price2num($this->multicurrency_subprice).""; $sql.= " , multicurrency_total_ht=".price2num($this->multicurrency_total_ht).""; $sql.= " , multicurrency_total_tva=".price2num($this->multicurrency_total_tva).""; $sql.= " , multicurrency_total_ttc=".price2num($this->multicurrency_total_ttc).""; - + $sql.= " WHERE rowid = ".$this->rowid; dol_syslog(get_class($this)."::update", LOG_DEBUG); @@ -4468,7 +4696,7 @@ class FactureLigne extends CommonInvoiceLine /** * Returns situation_percent of the previous line. - * Warning: If invoice is a replacement invoice, this->fk_prev_id is id of the replaced line. + * Warning: If invoice is a replacement invoice, this->fk_prev_id is id of the replaced line. * * @param int $invoiceid Invoice id * @return int >= 0 diff --git a/htdocs/compta/facture/class/paymentterm.class.php b/htdocs/compta/facture/class/paymentterm.class.php index d524c501698..2899e3fae56 100644 --- a/htdocs/compta/facture/class/paymentterm.class.php +++ b/htdocs/compta/facture/class/paymentterm.class.php @@ -42,7 +42,7 @@ class PaymentTerm // extends CommonObject var $active; var $libelle; var $libelle_facture; - var $fdm; + var $type_cdr; var $nbjour; var $decalage; @@ -80,7 +80,7 @@ class PaymentTerm // extends CommonObject if (isset($this->active)) $this->active=trim($this->active); if (isset($this->libelle)) $this->libelle=trim($this->libelle); if (isset($this->libelle_facture)) $this->libelle_facture=trim($this->libelle_facture); - if (isset($this->fdm)) $this->fdm=trim($this->fdm); + if (isset($this->type_cdr)) $this->type_cdr=trim($this->type_cdr); if (isset($this->nbjour)) $this->nbjour=trim($this->nbjour); if (isset($this->decalage)) $this->decalage=trim($this->decalage); @@ -98,7 +98,7 @@ class PaymentTerm // extends CommonObject $sql.= "active,"; $sql.= "libelle,"; $sql.= "libelle_facture,"; - $sql.= "fdm,"; + $sql.= "type_cdr,"; $sql.= "nbjour,"; $sql.= "decalage"; @@ -111,7 +111,7 @@ class PaymentTerm // extends CommonObject $sql.= " ".(! isset($this->active)?'NULL':"'".$this->active."'").","; $sql.= " ".(! isset($this->libelle)?'NULL':"'".$this->db->escape($this->libelle)."'").","; $sql.= " ".(! isset($this->libelle_facture)?'NULL':"'".$this->db->escape($this->libelle_facture)."'").","; - $sql.= " ".(! isset($this->fdm)?'NULL':"'".$this->fdm."'").","; + $sql.= " ".(! isset($this->type_cdr)?'NULL':"'".$this->type_cdr."'").","; $sql.= " ".(! isset($this->nbjour)?'NULL':"'".$this->nbjour."'").","; $sql.= " ".(! isset($this->decalage)?'NULL':"'".$this->decalage."'").""; @@ -178,7 +178,7 @@ class PaymentTerm // extends CommonObject $sql.= " t.active,"; $sql.= " t.libelle,"; $sql.= " t.libelle_facture,"; - $sql.= " t.fdm,"; + $sql.= " t.type_cdr,"; $sql.= " t.nbjour,"; $sql.= " t.decalage"; @@ -201,7 +201,7 @@ class PaymentTerm // extends CommonObject $this->active = $obj->active; $this->libelle = $obj->libelle; $this->libelle_facture = $obj->libelle_facture; - $this->fdm = $obj->fdm; + $this->type_cdr = $obj->type_cdr; $this->nbjour = $obj->nbjour; $this->decalage = $obj->decalage; @@ -274,7 +274,7 @@ class PaymentTerm // extends CommonObject if (isset($this->active)) $this->active=trim($this->active); if (isset($this->libelle)) $this->libelle=trim($this->libelle); if (isset($this->libelle_facture)) $this->libelle_facture=trim($this->libelle_facture); - if (isset($this->fdm)) $this->fdm=trim($this->fdm); + if (isset($this->type_cdr)) $this->type_cdr=trim($this->type_cdr); if (isset($this->nbjour)) $this->nbjour=trim($this->nbjour); if (isset($this->decalage)) $this->decalage=trim($this->decalage); @@ -291,7 +291,7 @@ class PaymentTerm // extends CommonObject $sql.= " active=".(isset($this->active)?$this->active:"null").","; $sql.= " libelle=".(isset($this->libelle)?"'".$this->db->escape($this->libelle)."'":"null").","; $sql.= " libelle_facture=".(isset($this->libelle_facture)?"'".$this->db->escape($this->libelle_facture)."'":"null").","; - $sql.= " fdm=".(isset($this->fdm)?$this->fdm:"null").","; + $sql.= " type_cdr=".(isset($this->type_cdr)?$this->type_cdr:"null").","; $sql.= " nbjour=".(isset($this->nbjour)?$this->nbjour:"null").","; $sql.= " decalage=".(isset($this->decalage)?$this->decalage:"null").""; @@ -471,7 +471,7 @@ class PaymentTerm // extends CommonObject $this->active=''; $this->libelle=''; $this->libelle_facture=''; - $this->fdm=''; + $this->type_cdr=''; $this->nbjour=''; $this->decalage=''; } diff --git a/htdocs/compta/facture/contact.php b/htdocs/compta/facture/contact.php index c5a7cfcdab2..ebc90fca6c5 100644 --- a/htdocs/compta/facture/contact.php +++ b/htdocs/compta/facture/contact.php @@ -114,7 +114,9 @@ else if ($action == 'deletecontact' && $user->rights->facture->creer) * View */ -llxHeader('', $langs->trans("Bill"), "Facture"); +$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); @@ -146,7 +148,7 @@ if ($id > 0 || ! empty($ref)) $linkback = ''.$langs->trans("BackToList").''; // Ref - print '
'; + print ''; print ''; // Ref customer - print ''; - print ''; diff --git a/htdocs/compta/facture/document.php b/htdocs/compta/facture/document.php index 9a2bf3fe433..246e5595779 100644 --- a/htdocs/compta/facture/document.php +++ b/htdocs/compta/facture/document.php @@ -82,7 +82,9 @@ include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php'; * View */ -llxHeader(); +$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); @@ -113,7 +115,7 @@ if ($id > 0 || ! empty($ref)) $linkback = ''.$langs->trans("BackToList").''; // Ref - print ''; + print ''; print ''; // Ref customer - print ''; - print ''; @@ -150,6 +149,7 @@ if ($id > 0 || ! empty($ref)) $modulepart = 'facture'; $permission = $user->rights->facture->creer; + $permtoedit = $user->rights->facture->creer; $param = '&id=' . $object->id; include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php'; diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php index 7b2d7076aca..33da64e3221 100644 --- a/htdocs/compta/facture/fiche-rec.php +++ b/htdocs/compta/facture/fiche-rec.php @@ -1,12 +1,13 @@ - * Copyright (C) 2004-2015 Laurent Destailleur + * Copyright (C) 2004-2016 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2013 Florian Henry * Copyright (C) 2013 Juanjo Menent * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2012 Cedric Salvador * Copyright (C) 2015 Alexandre Spangaro + * Copyright (C) 2016 Meziane Sof * * 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 @@ -30,10 +31,12 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture-rec.class.php'; -require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; +if (! empty($conf->projet->enabled)) { + require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; + require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php'; +} $langs->load('bills'); $langs->load('compta'); @@ -86,11 +89,11 @@ if (($id > 0 || $ref) && $action != 'create' && $action != 'add') } // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array -$hookmanager->initHooks(array('invoicecard','globalcard')); +$hookmanager->initHooks(array('invoicereccard','globalcard')); $extrafields = new ExtraFields($db); // fetch optionals attributes and labels -$extralabels = $extrafields->fetch_name_optionals_label('facturerec'); +$extralabels = $extrafields->fetch_name_optionals_label('facture'); $search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_'); $permissionnote = $user->rights->facture->creer; // Used by the include of actions_setnotes.inc.php @@ -123,517 +126,738 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab * Actions */ -// Set note -include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once +$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_lineupdown.inc.php'; // Must be include, not include_once - -// Create predefined invoice -if ($action == 'add') +if (empty($reshook)) { - if (! GETPOST('titre')) - { - setEventMessages($langs->transnoentities("ErrorFieldRequired",$langs->trans("Title")), null, 'errors'); - $action = "create"; - $error++; - } - - $frequency=GETPOST('frequency', 'int'); - $reyear=GETPOST('reyear'); - $remonth=GETPOST('remonth'); - $reday=GETPOST('reday'); - $rehour=GETPOST('rehour'); - $remin=GETPOST('remin'); - $nb_gen_max=GETPOST('nb_gen_max', 'int'); - //if (empty($nb_gen_max)) $nb_gen_max =0; - - if (GETPOST('frequency')) - { - if (empty($reyear) || empty($remonth) || empty($reday)) - { - setEventMessages($langs->transnoentities("ErrorFieldRequired",$langs->trans("Date")), null, 'errors'); - $action = "create"; - $error++; - } - if ($nb_gen_max === '') - { - setEventMessages($langs->transnoentities("ErrorFieldRequired",$langs->trans("MaxPeriodNumber")), null, 'errors'); - $action = "create"; - $error++; - } - } - - if (! $error) - { - $object->titre = GETPOST('titre', 'alpha'); - $object->note_private = GETPOST('note_private'); - $object->note_public = GETPOST('note_public'); - $object->usenewprice = GETPOST('usenewprice'); - - $object->frequency = $frequency; - $object->unit_frequency = GETPOST('unit_frequency', 'alpha'); - $object->nb_gen_max = $nb_gen_max; - $object->auto_validate = GETPOST('auto_validate', 'int'); - - $object->fk_project = $projectid; - - $date_next_execution = dol_mktime($rehour, $remin, 0, $remonth, $reday, $reyear); - $object->date_when = $date_next_execution; - - // Get first contract linked to invoice used to generate template - if ($id > 0) - { - $srcObject = new Facture($db); - $srcObject->fetch(GETPOST('facid','int')); - - $srcObject->fetchObjectLinked(); - - if (! empty($srcObject->linkedObjectsIds['contrat'])) - { - $contractidid = reset($srcObject->linkedObjectsIds['contrat']); - - $object->origin = 'contrat'; - $object->origin_id = $contractidid; - $object->linked_objects[$object->origin] = $object->origin_id; - } - } - - $db->begin(); - - $oldinvoice = new Facture($db); - $oldinvoice->fetch($id); - - $result = $object->create($user, $oldinvoice->id); - if ($result > 0) - { - $result=$oldinvoice->delete(0, 1); - if ($result < 0) - { - $error++; - setEventMessages($oldinvoice->error, $oldinvoice->errors, 'errors'); - $action = "create"; - } - } - else - { - $error++; - setEventMessages($object->error, $object->errors, 'errors'); - $action = "create"; - } - - if (! $error) - { - $db->commit(); - - header("Location: " . $_SERVER['PHP_SELF'] . '?facid=' . $object->id); - exit; - } - else - { - $db->rollback(); - - $error++; - setEventMessages($object->error, $object->errors, 'errors'); - $action = "create"; - } - } -} - -// Delete -if ($action == 'delete' && $user->rights->facture->supprimer) -{ - $object->delete(); - header("Location: " . $_SERVER['PHP_SELF'] ); - exit; -} - - -// Update field -// Set condition -if ($action == 'setconditions' && $user->rights->facture->creer) -{ - $result=$object->setPaymentTerms(GETPOST('cond_reglement_id', 'int')); - -} -// Set mode -elseif ($action == 'setmode' && $user->rights->facture->creer) -{ - $result=$object->setPaymentMethods(GETPOST('mode_reglement_id', 'int')); -} -// Set project -elseif ($action == 'classin' && $user->rights->facture->creer) -{ - $object->setProject(GETPOST('projectid', 'int')); -} -// Set bank account -elseif ($action == 'setbankaccount' && $user->rights->facture->creer) -{ - $result=$object->setBankAccount(GETPOST('fk_account', 'int')); -} -// Set frequency and unit frequency -elseif ($action == 'setfrequency' && $user->rights->facture->creer) -{ - $object->setFrequencyAndUnit(GETPOST('frequency', 'int'), GETPOST('unit_frequency', 'alpha')); -} -// Set next date of execution -elseif ($action == 'setdate_when' && $user->rights->facture->creer) -{ - $date = dol_mktime(GETPOST('date_whenhour'), GETPOST('date_whenmin'), 0, GETPOST('date_whenmonth'), GETPOST('date_whenday'), GETPOST('date_whenyear')); - if (!empty($date)) $object->setNextDate($date); -} -// Set max period -elseif ($action == 'setnb_gen_max' && $user->rights->facture->creer) -{ - $object->setMaxPeriod(GETPOST('nb_gen_max', 'int')); -} -// Set auto validate -elseif ($action == 'setauto_validate' && $user->rights->facture->creer) -{ - $object->setAutoValidate(GETPOST('auto_validate', 'int')); -} - -// Delete line -if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->facture->creer) -{ - $object->fetch($id); - $object->fetch_thirdparty(); - - $db->begin(); + if (GETPOST('cancel')) $action=''; - $line=new FactureLigneRec($db); + // Set note + include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once - // For triggers - $line->id = $lineid; + include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once - if ($line->delete() > 0) + include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; // Must be include, not include_once + + // Do we click on 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 { - $result=$object->update_price(1); + $search_ref=''; + $search_societe=''; + $search_montant_ht=''; + $search_montant_vat=''; + $search_montant_ttc=''; + $day=''; + $year=''; + $month=''; + $day_date_when=''; + $year_date_when=''; + $month_date_when=''; + $search_frequency=''; + $search_array_options=array(); + } + // Create predefined invoice + if ($action == 'add') + { + if (! GETPOST('titre')) + { + setEventMessages($langs->transnoentities("ErrorFieldRequired",$langs->trans("Title")), null, 'errors'); + $action = "create"; + $error++; + } + + $frequency=GETPOST('frequency', 'int'); + $reyear=GETPOST('reyear'); + $remonth=GETPOST('remonth'); + $reday=GETPOST('reday'); + $rehour=GETPOST('rehour'); + $remin=GETPOST('remin'); + $nb_gen_max=GETPOST('nb_gen_max', 'int'); + //if (empty($nb_gen_max)) $nb_gen_max =0; + + if (GETPOST('frequency')) + { + if (empty($reyear) || empty($remonth) || empty($reday)) + { + setEventMessages($langs->transnoentities("ErrorFieldRequired",$langs->trans("Date")), null, 'errors'); + $action = "create"; + $error++; + } + if ($nb_gen_max === '') + { + setEventMessages($langs->transnoentities("ErrorFieldRequired",$langs->trans("MaxPeriodNumber")), null, 'errors'); + $action = "create"; + $error++; + } + } + + if (! $error) + { + $object->titre = GETPOST('titre', 'alpha'); + $object->note_private = GETPOST('note_private'); + $object->note_public = GETPOST('note_public'); + $object->usenewprice = GETPOST('usenewprice'); + + $object->frequency = $frequency; + $object->unit_frequency = GETPOST('unit_frequency', 'alpha'); + $object->nb_gen_max = $nb_gen_max; + $object->auto_validate = GETPOST('auto_validate', 'int'); + + $object->fk_project = $projectid; + + $date_next_execution = dol_mktime($rehour, $remin, 0, $remonth, $reday, $reyear); + $object->date_when = $date_next_execution; + + // Get first contract linked to invoice used to generate template + if ($id > 0) + { + $srcObject = new Facture($db); + $srcObject->fetch(GETPOST('facid','int')); + + $srcObject->fetchObjectLinked(); + + if (! empty($srcObject->linkedObjectsIds['contrat'])) + { + $contractidid = reset($srcObject->linkedObjectsIds['contrat']); + + $object->origin = 'contrat'; + $object->origin_id = $contractidid; + $object->linked_objects[$object->origin] = $object->origin_id; + } + } + + $db->begin(); + + $oldinvoice = new Facture($db); + $oldinvoice->fetch($id); + + $result = $object->create($user, $oldinvoice->id); + if ($result > 0) + { + $result=$oldinvoice->delete($user, 1); + if ($result < 0) + { + $error++; + setEventMessages($oldinvoice->error, $oldinvoice->errors, 'errors'); + $action = "create"; + } + } + else + { + $error++; + setEventMessages($object->error, $object->errors, 'errors'); + $action = "create"; + } + + if (! $error) + { + $db->commit(); + + header("Location: " . $_SERVER['PHP_SELF'] . '?facid=' . $object->id); + exit; + } + else + { + $db->rollback(); + + $error++; + setEventMessages($object->error, $object->errors, 'errors'); + $action = "create"; + } + } + } + + // Delete + if ($action == 'confirm_deleteinvoice' && $confirm == 'yes' && $user->rights->facture->supprimer) + { + $object->delete(); + header("Location: " . $_SERVER['PHP_SELF'] ); + exit; + } + + + // Update field + // Set condition + if ($action == 'setconditions' && $user->rights->facture->creer) + { + $result=$object->setPaymentTerms(GETPOST('cond_reglement_id', 'int')); + + } + // Set mode + elseif ($action == 'setmode' && $user->rights->facture->creer) + { + $result=$object->setPaymentMethods(GETPOST('mode_reglement_id', 'int')); + } + // Set project + elseif ($action == 'classin' && $user->rights->facture->creer) + { + $object->setProject(GETPOST('projectid', 'int')); + } + // Set bank account + elseif ($action == 'setref' && $user->rights->facture->creer) + { + //var_dump(GETPOST('ref', 'alpha'));exit; + $result=$object->setValueFrom('titre', GETPOST('ref', 'alpha'), '', null, 'text', '', $user, 'BILLREC_MODIFY'); if ($result > 0) { - $db->commit(); - $object->fetch($object->id); // Reload lines - } - else - { - $db->rollback(); - setEventMessages($db->lasterror(), null, 'errors'); + $object->titre = GETPOST('ref', 'alpha'); + $object->ref = $object->titre; } + else dol_print_error($db, $object->error, $object->errors); } - else + // Set bank account + elseif ($action == 'setbankaccount' && $user->rights->facture->creer) { - $db->rollback(); - setEventMessages($line->error, $line->errors, 'errors'); + $result=$object->setBankAccount(GETPOST('fk_account', 'int')); } -} - -// Add a new line -if ($action == 'addline' && $user->rights->facture->creer) -{ - $langs->load('errors'); - $error = 0; - - // Set if we used free entry or predefined product - $predef=''; - $product_desc=(GETPOST('dp_desc')?GETPOST('dp_desc'):''); - $price_ht = GETPOST('price_ht'); - if (GETPOST('prod_entry_mode') == 'free') + // Set frequency and unit frequency + elseif ($action == 'setfrequency' && $user->rights->facture->creer) { - $idprod=0; - $tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0); + $object->setFrequencyAndUnit(GETPOST('frequency', 'int'), GETPOST('unit_frequency', 'alpha')); } - else + // Set next date of execution + elseif ($action == 'setdate_when' && $user->rights->facture->creer) { - $idprod=GETPOST('idprod', 'int'); - $tva_tx = ''; + $date = dol_mktime(GETPOST('date_whenhour'), GETPOST('date_whenmin'), 0, GETPOST('date_whenmonth'), GETPOST('date_whenday'), GETPOST('date_whenyear')); + if (!empty($date)) $object->setNextDate($date); } - - $qty = GETPOST('qty' . $predef); - $remise_percent = GETPOST('remise_percent' . $predef); - - // Extrafields - $extrafieldsline = new ExtraFields($db); - $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); - $array_options = $extrafieldsline->getOptionalsFromPost($extralabelsline, $predef); - // Unset extrafield - if (is_array($extralabelsline)) { - // Get extra fields - foreach ($extralabelsline as $key => $value) { - unset($_POST["options_" . $key . $predef]); - } - } - - if (empty($idprod) && ($price_ht < 0) && ($qty < 0)) { - setEventMessages($langs->trans('ErrorBothFieldCantBeNegative', $langs->transnoentitiesnoconv('UnitPriceHT'), $langs->transnoentitiesnoconv('Qty')), null, 'errors'); - $error ++; - } - if (GETPOST('prod_entry_mode') == 'free' && empty($idprod) && GETPOST('type') < 0) { - setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), null, 'errors'); - $error ++; - } - if (GETPOST('prod_entry_mode') == 'free' && empty($idprod) && (! ($price_ht >= 0) || $price_ht == '')) // Unit price can be 0 but not '' + // Set max period + elseif ($action == 'setnb_gen_max' && $user->rights->facture->creer) { - setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("UnitPriceHT")), null, 'errors'); - $error ++; + $object->setMaxPeriod(GETPOST('nb_gen_max', 'int')); } - if ($qty == '') { - setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Qty')), null, 'errors'); - $error ++; - } - if (GETPOST('prod_entry_mode') == 'free' && empty($idprod) && empty($product_desc)) { - setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Description')), null, 'errors'); - $error ++; - } - if ($qty < 0) { - $langs->load("errors"); - setEventMessages($langs->trans('ErrorQtyForCustomerInvoiceCantBeNegative'), null, 'errors'); - $error ++; + // Set auto validate + elseif ($action == 'setauto_validate' && $user->rights->facture->creer) + { + $object->setAutoValidate(GETPOST('auto_validate', 'int')); } - if (! $error && ($qty >= 0) && (! empty($product_desc) || ! empty($idprod))) { - $ret = $object->fetch($id); - if ($ret < 0) { - dol_print_error($db, $object->error); - exit(); - } - $ret = $object->fetch_thirdparty(); - - // Clean parameters - $date_start = dol_mktime(GETPOST('date_start' . $predef . 'hour'), GETPOST('date_start' . $predef . 'min'), GETPOST('date_start' . $predef . 'sec'), GETPOST('date_start' . $predef . 'month'), GETPOST('date_start' . $predef . 'day'), GETPOST('date_start' . $predef . 'year')); - $date_end = dol_mktime(GETPOST('date_end' . $predef . 'hour'), GETPOST('date_end' . $predef . 'min'), GETPOST('date_end' . $predef . 'sec'), GETPOST('date_end' . $predef . 'month'), GETPOST('date_end' . $predef . 'day'), GETPOST('date_end' . $predef . 'year')); - $price_base_type = (GETPOST('price_base_type', 'alpha') ? GETPOST('price_base_type', 'alpha') : 'HT'); - - // Define special_code for special lines - $special_code = 0; - // if (empty($_POST['qty'])) $special_code=3; // Options should not exists on invoices - - // Ecrase $pu par celui du produit - // Ecrase $desc par celui du produit - // Ecrase $txtva par celui du produit - // Ecrase $base_price_type par celui du produit - // Replaces $fk_unit with the product's - if (! empty($idprod)) - { - $prod = new Product($db); - $prod->fetch($idprod); - - $label = ((GETPOST('product_label') && GETPOST('product_label') != $prod->label) ? GETPOST('product_label') : ''); - - // Update if prices fields are defined - $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; - $price_base_type = $prod->price_base_type; - - // We define price for product - if (! empty($conf->global->PRODUIT_MULTIPRICES) && ! empty($object->thirdparty->price_level)) - { - $pu_ht = $prod->multiprices[$object->thirdparty->price_level]; - $pu_ttc = $prod->multiprices_ttc[$object->thirdparty->price_level]; - $price_min = $prod->multiprices_min[$object->thirdparty->price_level]; - $price_base_type = $prod->multiprices_base_type[$object->thirdparty->price_level]; - if (! empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) // using this option is a bug. kept for backward compatibility - { - if (isset($prod->multiprices_tva_tx[$object->thirdparty->price_level])) $tva_tx=$prod->multiprices_tva_tx[$object->thirdparty->price_level]; - if (isset($prod->multiprices_recuperableonly[$object->thirdparty->price_level])) $tva_npr=$prod->multiprices_recuperableonly[$object->thirdparty->price_level]; - if (empty($tva_tx)) $tva_npr=0; - } - } - elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) - { - require_once DOL_DOCUMENT_ROOT . '/product/class/productcustomerprice.class.php'; - - $prodcustprice = new Productcustomerprice($db); - - $filter = array('t.fk_product' => $prod->id,'t.fk_soc' => $object->thirdparty->id); - - $result = $prodcustprice->fetch_all('', '', 0, 0, $filter); - if ($result) { - if (count($prodcustprice->lines) > 0) { - $pu_ht = price($prodcustprice->lines[0]->price); - $pu_ttc = price($prodcustprice->lines[0]->price_ttc); - $price_base_type = $prodcustprice->lines[0]->price_base_type; - $prod->tva_tx = $prodcustprice->lines[0]->tva_tx; - } - } - } - - // if price ht was forced (ie: from gui when calculated by margin rate and cost price) - if (! empty($price_ht)) - { - $pu_ht = price2num($price_ht, 'MU'); - $pu_ttc = price2num($pu_ht * (1 + ($tva_tx / 100)), 'MU'); - } - // On reevalue prix selon taux tva car taux tva transaction peut etre different - // de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur). - elseif ($tva_tx != $prod->tva_tx) - { - if ($price_base_type != 'HT') - { - $pu_ht = price2num($pu_ttc / (1 + ($tva_tx / 100)), 'MU'); - } - else - { - $pu_ttc = price2num($pu_ht * (1 + ($tva_tx / 100)), 'MU'); - } - } - - $desc = ''; - - // Define output language - if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) { - $outputlangs = $langs; - $newlang = ''; - if (empty($newlang) && GETPOST('lang_id')) - $newlang = GETPOST('lang_id'); - if (empty($newlang)) - $newlang = $object->thirdparty->default_lang; - if (! empty($newlang)) { - $outputlangs = new Translate("", $conf); - $outputlangs->setDefaultLang($newlang); - } - - $desc = (! empty($prod->multilangs [$outputlangs->defaultlang] ["description"])) ? $prod->multilangs [$outputlangs->defaultlang] ["description"] : $prod->description; - } else { - $desc = $prod->description; - } - - $desc = dol_concatdesc($desc, $product_desc); - - // Add custom code and origin country into description - if (empty($conf->global->MAIN_PRODUCT_DISABLE_CUSTOMCOUNTRYCODE) && (! empty($prod->customcode) || ! empty($prod->country_code))) { - $tmptxt = '('; - if (! empty($prod->customcode)) - $tmptxt .= $langs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode; - if (! empty($prod->customcode) && ! empty($prod->country_code)) - $tmptxt .= ' - '; - if (! empty($prod->country_code)) - $tmptxt .= $langs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, 0, $db, $langs, 0); - $tmptxt .= ')'; - $desc = dol_concatdesc($desc, $tmptxt); - } - - $type = $prod->type; - $fk_unit = $prod->fk_unit; - } else { - $pu_ht = price2num($price_ht, 'MU'); - $pu_ttc = price2num(GETPOST('price_ttc'), 'MU'); - $tva_npr = (preg_match('/\*/', $tva_tx) ? 1 : 0); - $tva_tx = str_replace('*', '', $tva_tx); - if (empty($tva_tx)) $tva_npr=0; - $label = (GETPOST('product_label') ? GETPOST('product_label') : ''); - $desc = $product_desc; - $type = GETPOST('type'); - $fk_unit= GETPOST('units', 'alpha'); - } + // Delete line + if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->facture->creer) + { + $object->fetch($id); + $object->fetch_thirdparty(); + + $db->begin(); + + $line=new FactureLigneRec($db); + + // For triggers + $line->id = $lineid; + + if ($line->delete() > 0) + { + $result=$object->update_price(1); + + if ($result > 0) + { + $db->commit(); + $object->fetch($object->id); // Reload lines + } + else + { + $db->rollback(); + setEventMessages($db->lasterror(), null, 'errors'); + } + } + else + { + $db->rollback(); + setEventMessages($line->error, $line->errors, 'errors'); + } + } + + // Add a new line + if ($action == 'addline' && $user->rights->facture->creer) + { + $langs->load('errors'); + $error = 0; + + // Set if we used free entry or predefined product + $predef=''; + $product_desc=(GETPOST('dp_desc')?GETPOST('dp_desc'):''); + $price_ht = GETPOST('price_ht'); + if (GETPOST('prod_entry_mode') == 'free') + { + $idprod=0; + $tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0); + } + else + { + $idprod=GETPOST('idprod', 'int'); + $tva_tx = ''; + } + + $qty = GETPOST('qty' . $predef); + $remise_percent = GETPOST('remise_percent' . $predef); + + // Extrafields + $extrafieldsline = new ExtraFields($db); + $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); + $array_options = $extrafieldsline->getOptionalsFromPost($extralabelsline, $predef); + // Unset extrafield + if (is_array($extralabelsline)) + { + // Get extra fields + foreach ($extralabelsline as $key => $value) { + unset($_POST["options_" . $key . $predef]); + } + } + + if (empty($idprod) && ($price_ht < 0) && ($qty < 0)) { + setEventMessages($langs->trans('ErrorBothFieldCantBeNegative', $langs->transnoentitiesnoconv('UnitPriceHT'), $langs->transnoentitiesnoconv('Qty')), null, 'errors'); + $error ++; + } + if (GETPOST('prod_entry_mode') == 'free' && empty($idprod) && GETPOST('type') < 0) { + setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), null, 'errors'); + $error ++; + } + if (GETPOST('prod_entry_mode') == 'free' && empty($idprod) && (! ($price_ht >= 0) || $price_ht == '')) // Unit price can be 0 but not '' + { + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("UnitPriceHT")), null, 'errors'); + $error ++; + } + if ($qty == '') { + setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Qty')), null, 'errors'); + $error ++; + } + if (GETPOST('prod_entry_mode') == 'free' && empty($idprod) && empty($product_desc)) { + setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Description')), null, 'errors'); + $error ++; + } + if ($qty < 0) { + $langs->load("errors"); + setEventMessages($langs->trans('ErrorQtyForCustomerInvoiceCantBeNegative'), null, 'errors'); + $error ++; + } - // Margin - $fournprice = price2num(GETPOST('fournprice' . $predef) ? GETPOST('fournprice' . $predef) : ''); - $buyingprice = price2num(GETPOST('buying_price' . $predef) != '' ? GETPOST('buying_price' . $predef) : ''); // If buying_price is '0', we must keep this value - - // Local Taxes - $localtax1_tx = get_localtax($tva_tx, 1, $object->thirdparty, $mysoc, $tva_npr); - $localtax2_tx = get_localtax($tva_tx, 2, $object->thirdparty, $mysoc, $tva_npr); - - $info_bits = 0; - if ($tva_npr) - $info_bits |= 0x01; - - if (! empty($price_min) && (price2num($pu_ht) * (1 - price2num($remise_percent) / 100) < price2num($price_min))) { - $mesg = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)); - setEventMessages($mesg, null, 'errors'); - } else { - // Insert line - $result = $object->addline($desc, $pu_ht, $qty, $tva_tx, $idprod, $remise_percent, $price_base_type, $info_bits, '', $pu_ttc, $type, - 1, $special_code, $label, $fk_unit); - - if ($result > 0) + if (! $error && ($qty >= 0) && (! empty($product_desc) || ! empty($idprod))) + { + $ret = $object->fetch($id); + if ($ret < 0) { + dol_print_error($db, $object->error); + exit(); + } + $ret = $object->fetch_thirdparty(); + + // Clean parameters + $date_start = dol_mktime(GETPOST('date_start' . $predef . 'hour'), GETPOST('date_start' . $predef . 'min'), GETPOST('date_start' . $predef . 'sec'), GETPOST('date_start' . $predef . 'month'), GETPOST('date_start' . $predef . 'day'), GETPOST('date_start' . $predef . 'year')); + $date_end = dol_mktime(GETPOST('date_end' . $predef . 'hour'), GETPOST('date_end' . $predef . 'min'), GETPOST('date_end' . $predef . 'sec'), GETPOST('date_end' . $predef . 'month'), GETPOST('date_end' . $predef . 'day'), GETPOST('date_end' . $predef . 'year')); + $price_base_type = (GETPOST('price_base_type', 'alpha') ? GETPOST('price_base_type', 'alpha') : 'HT'); + + // Define special_code for special lines + $special_code = 0; + // if (empty($_POST['qty'])) $special_code=3; // Options should not exists on invoices + + // Ecrase $pu par celui du produit + // Ecrase $desc par celui du produit + // Ecrase $txtva par celui du produit + // Ecrase $base_price_type par celui du produit + // Replaces $fk_unit with the product's + if (! empty($idprod)) { - // Define output language - /*if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) - { - $outputlangs = $langs; - $newlang = ''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha'); - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; - if (! empty($newlang)) { - $outputlangs = new Translate("", $conf); - $outputlangs->setDefaultLang($newlang); - } - $model=$object->modelpdf; - $ret = $object->fetch($id); // Reload to get new records - - $result = $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); - if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); - }*/ - $object->fetch($object->id); // Reload lines - - unset($_POST['prod_entry_mode']); - - unset($_POST['qty']); - unset($_POST['type']); - unset($_POST['remise_percent']); - unset($_POST['price_ht']); - unset($_POST['multicurrency_price_ht']); - unset($_POST['price_ttc']); - unset($_POST['tva_tx']); - unset($_POST['product_ref']); - unset($_POST['product_label']); - unset($_POST['product_desc']); - unset($_POST['fournprice']); - unset($_POST['buying_price']); - unset($_POST['np_marginRate']); - unset($_POST['np_markRate']); - unset($_POST['dp_desc']); - unset($_POST['idprod']); - unset($_POST['units']); - - unset($_POST['date_starthour']); - unset($_POST['date_startmin']); - unset($_POST['date_startsec']); - unset($_POST['date_startday']); - unset($_POST['date_startmonth']); - unset($_POST['date_startyear']); - unset($_POST['date_endhour']); - unset($_POST['date_endmin']); - unset($_POST['date_endsec']); - unset($_POST['date_endday']); - unset($_POST['date_endmonth']); - unset($_POST['date_endyear']); - - unset($_POST['situations']); - unset($_POST['progress']); - } else { - setEventMessages($object->error, $object->errors, 'errors'); - } - - $action = ''; + $prod = new Product($db); + $prod->fetch($idprod); + + $label = ((GETPOST('product_label') && GETPOST('product_label') != $prod->label) ? GETPOST('product_label') : ''); + + // Update if prices fields are defined + $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; + $price_base_type = $prod->price_base_type; + + // We define price for product + if (! empty($conf->global->PRODUIT_MULTIPRICES) && ! empty($object->thirdparty->price_level)) + { + $pu_ht = $prod->multiprices[$object->thirdparty->price_level]; + $pu_ttc = $prod->multiprices_ttc[$object->thirdparty->price_level]; + $price_min = $prod->multiprices_min[$object->thirdparty->price_level]; + $price_base_type = $prod->multiprices_base_type[$object->thirdparty->price_level]; + if (! empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) // using this option is a bug. kept for backward compatibility + { + if (isset($prod->multiprices_tva_tx[$object->thirdparty->price_level])) $tva_tx=$prod->multiprices_tva_tx[$object->thirdparty->price_level]; + if (isset($prod->multiprices_recuperableonly[$object->thirdparty->price_level])) $tva_npr=$prod->multiprices_recuperableonly[$object->thirdparty->price_level]; + if (empty($tva_tx)) $tva_npr=0; + } + } + elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) + { + require_once DOL_DOCUMENT_ROOT . '/product/class/productcustomerprice.class.php'; + + $prodcustprice = new Productcustomerprice($db); + + $filter = array('t.fk_product' => $prod->id,'t.fk_soc' => $object->thirdparty->id); + + $result = $prodcustprice->fetch_all('', '', 0, 0, $filter); + if ($result) + { + if (count($prodcustprice->lines) > 0) + { + $pu_ht = price($prodcustprice->lines[0]->price); + $pu_ttc = price($prodcustprice->lines[0]->price_ttc); + $price_base_type = $prodcustprice->lines[0]->price_base_type; + $prod->tva_tx = $prodcustprice->lines[0]->tva_tx; + } + } + } + + // if price ht was forced (ie: from gui when calculated by margin rate and cost price) + if (! empty($price_ht)) + { + $pu_ht = price2num($price_ht, 'MU'); + $pu_ttc = price2num($pu_ht * (1 + ($tva_tx / 100)), 'MU'); + } + // On reevalue prix selon taux tva car taux tva transaction peut etre different + // de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur). + elseif ($tva_tx != $prod->tva_tx) + { + if ($price_base_type != 'HT') + { + $pu_ht = price2num($pu_ttc / (1 + ($tva_tx / 100)), 'MU'); + } + else + { + $pu_ttc = price2num($pu_ht * (1 + ($tva_tx / 100)), 'MU'); + } + } + + $desc = ''; + + // Define output language + if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) + { + $outputlangs = $langs; + $newlang = ''; + if (empty($newlang) && GETPOST('lang_id')) + $newlang = GETPOST('lang_id'); + if (empty($newlang)) + $newlang = $object->thirdparty->default_lang; + if (! empty($newlang)) + { + $outputlangs = new Translate("", $conf); + $outputlangs->setDefaultLang($newlang); + } + + $desc = (! empty($prod->multilangs [$outputlangs->defaultlang] ["description"])) ? $prod->multilangs [$outputlangs->defaultlang] ["description"] : $prod->description; + } + else + { + $desc = $prod->description; + } + + $desc = dol_concatdesc($desc, $product_desc); + + // Add custom code and origin country into description + if (empty($conf->global->MAIN_PRODUCT_DISABLE_CUSTOMCOUNTRYCODE) && (! empty($prod->customcode) || ! empty($prod->country_code))) + { + $tmptxt = '('; + if (! empty($prod->customcode)) + $tmptxt .= $langs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode; + if (! empty($prod->customcode) && ! empty($prod->country_code)) + $tmptxt .= ' - '; + if (! empty($prod->country_code)) + $tmptxt .= $langs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, 0, $db, $langs, 0); + $tmptxt .= ')'; + $desc = dol_concatdesc($desc, $tmptxt); + + } + + $type = $prod->type; + $fk_unit = $prod->fk_unit; + + } + else + { + $pu_ht = price2num($price_ht, 'MU'); + $pu_ttc = price2num(GETPOST('price_ttc'), 'MU'); + $tva_npr = (preg_match('/\*/', $tva_tx) ? 1 : 0); + $tva_tx = str_replace('*', '', $tva_tx); + if (empty($tva_tx)) $tva_npr=0; + $label = (GETPOST('product_label') ? GETPOST('product_label') : ''); + $desc = $product_desc; + $type = GETPOST('type'); + $fk_unit= GETPOST('units', 'alpha'); + } + + // Margin + $fournprice = price2num(GETPOST('fournprice' . $predef) ? GETPOST('fournprice' . $predef) : ''); + $buyingprice = price2num(GETPOST('buying_price' . $predef) != '' ? GETPOST('buying_price' . $predef) : ''); // If buying_price is '0', we must keep this value + + // Local Taxes + $localtax1_tx = get_localtax($tva_tx, 1, $object->thirdparty, $mysoc, $tva_npr); + $localtax2_tx = get_localtax($tva_tx, 2, $object->thirdparty, $mysoc, $tva_npr); + + $info_bits = 0; + if ($tva_npr) + $info_bits |= 0x01; + + if (! empty($price_min) && (price2num($pu_ht) * (1 - price2num($remise_percent) / 100) < price2num($price_min))) + { + $mesg = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)); + setEventMessages($mesg, null, 'errors'); + } + else + { + // Insert line + $result = $object->addline($desc, $pu_ht, $qty, $tva_tx, $idprod, $remise_percent, $price_base_type, $info_bits, '', $pu_ttc, $type, - 1, $special_code, $label, $fk_unit); + + if ($result > 0) + { + /*if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) + { + // Define output language + $outputlangs = $langs; + $newlang = ''; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha'); + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; + if (! empty($newlang)) { + $outputlangs = new Translate("", $conf); + $outputlangs->setDefaultLang($newlang); + } + $model=$object->modelpdf; + $ret = $object->fetch($id); // Reload to get new records + + $result = $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); + if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); + }*/ + $object->fetch($object->id); // Reload lines + + unset($_POST['prod_entry_mode']); + + unset($_POST['qty']); + unset($_POST['type']); + unset($_POST['remise_percent']); + unset($_POST['price_ht']); + unset($_POST['multicurrency_price_ht']); + unset($_POST['price_ttc']); + unset($_POST['tva_tx']); + unset($_POST['product_ref']); + unset($_POST['product_label']); + unset($_POST['product_desc']); + unset($_POST['fournprice']); + unset($_POST['buying_price']); + unset($_POST['np_marginRate']); + unset($_POST['np_markRate']); + unset($_POST['dp_desc']); + unset($_POST['idprod']); + unset($_POST['units']); + + unset($_POST['date_starthour']); + unset($_POST['date_startmin']); + unset($_POST['date_startsec']); + unset($_POST['date_startday']); + unset($_POST['date_startmonth']); + unset($_POST['date_startyear']); + unset($_POST['date_endhour']); + unset($_POST['date_endmin']); + unset($_POST['date_endsec']); + unset($_POST['date_endday']); + unset($_POST['date_endmonth']); + unset($_POST['date_endyear']); + + unset($_POST['situations']); + unset($_POST['progress']); + } + else + { + setEventMessages($object->error, $object->errors, 'errors'); + } + + $action = ''; + } } } + + elseif ($action == 'updateligne' && $user->rights->facture->creer && ! GETPOST('cancel')) + { + if (! $object->fetch($id) > 0) dol_print_error($db); + $object->fetch_thirdparty(); + + // Clean parameters + $date_start = ''; + $date_end = ''; + //$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')); + $description = dol_htmlcleanlastbr(GETPOST('product_desc') ? GETPOST('product_desc') : GETPOST('desc')); + $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)) + $info_bits |= 0x01; + + // Define vat_rate + $vat_rate = str_replace('*', '', $vat_rate); + $localtax1_rate = get_localtax($vat_rate, 1, $object->thirdparty); + $localtax2_rate = get_localtax($vat_rate, 2, $object->thirdparty); + + // 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 + + // Extrafields + $extrafieldsline = new ExtraFields($db); + $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); + $array_options = $extrafieldsline->getOptionalsFromPost($extralabelsline); + // Unset extrafield + if (is_array($extralabelsline)) + { + // Get extra fields + foreach ($extralabelsline as $key => $value) + { + unset($_POST["options_" . $key]); + } + } + + // Define special_code for special lines + $special_code=GETPOST('special_code'); + if (! GETPOST('qty')) $special_code=3; + + /*$line = new FactureLigne($db); + $line->fetch(GETPOST('lineid')); + $percent = $line->get_prev_progress($object->id); + + if (GETPOST('progress') < $percent) + { + $mesg = '
' . $langs->trans("CantBeLessThanMinPercent") . '
'; + setEventMessages($mesg, null, 'warnings'); + $error++; + $result = -1; + }*/ + + // Check minimum price + $productid = GETPOST('productid', 'int'); + if (! empty($productid)) + { + $product = new Product($db); + $product->fetch($productid); + + $type = $product->type; + + $price_min = $product->price_min; + if (! empty($conf->global->PRODUIT_MULTIPRICES) && ! empty($object->thirdparty->price_level)) + $price_min = $product->multiprices_min [$object->thirdparty->price_level]; + + $label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label') : ''); + + // Check price is not lower than minimum (check is done only for standard or replacement invoices) + if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT) && $price_min && (price2num($pu_ht) * (1 - price2num(GETPOST('remise_percent')) / 100) < price2num($price_min))) { + setEventMessages($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)), null, 'errors'); + $error ++; + } + } else { + $type = GETPOST('type'); + $label = (GETPOST('product_label') ? GETPOST('product_label') : ''); + + // Check parameters + if (GETPOST('type') < 0) { + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors'); + $error ++; + } + } + if ($qty < 0) { + $langs->load("errors"); + setEventMessages($langs->trans('ErrorQtyForCustomerInvoiceCantBeNegative'), null, 'errors'); + $error ++; + } + + // Update line + if (! $error) + { + $result = $object->updateline( + GETPOST('lineid'), + $description, + $pu_ht, + $qty, + $vat_rate, + GETPOST('productid'), + GETPOST('remise_percent'), + 'HT', + $info_bits, + 0, + 0, + $type, + 0, + $special_code, + $label, + GETPOST('units') + ); + + if ($result >= 0) + { + /*if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { + // Define output language + $outputlangs = $langs; + $newlang = ''; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) + $newlang = GETPOST('lang_id'); + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) + $newlang = $object->thirdparty->default_lang; + if (! empty($newlang)) { + $outputlangs = new Translate("", $conf); + $outputlangs->setDefaultLang($newlang); + } + + $ret = $object->fetch($id); // Reload to get new records + $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); + }*/ + + $object->fetch($object->id); // Reload lines + + unset($_POST['qty']); + unset($_POST['type']); + unset($_POST['productid']); + unset($_POST['remise_percent']); + unset($_POST['price_ht']); + unset($_POST['multicurrency_price_ht']); + unset($_POST['price_ttc']); + unset($_POST['tva_tx']); + unset($_POST['product_ref']); + unset($_POST['product_label']); + unset($_POST['product_desc']); + unset($_POST['fournprice']); + unset($_POST['buying_price']); + unset($_POST['np_marginRate']); + unset($_POST['np_markRate']); + + unset($_POST['dp_desc']); + unset($_POST['idprod']); + unset($_POST['units']); + + unset($_POST['date_starthour']); + unset($_POST['date_startmin']); + unset($_POST['date_startsec']); + unset($_POST['date_startday']); + unset($_POST['date_startmonth']); + unset($_POST['date_startyear']); + unset($_POST['date_endhour']); + unset($_POST['date_endmin']); + unset($_POST['date_endsec']); + unset($_POST['date_endday']); + unset($_POST['date_endmonth']); + unset($_POST['date_endyear']); + + unset($_POST['situations']); + unset($_POST['progress']); + } + else + { + setEventMessages($object->error, $object->errors, 'errors'); + } + } + } } -// Do we click on purge search criteria ? -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers -{ - $search_ref=''; - $search_societe=''; - $search_montant_ht=''; - $search_montant_vat=''; - $search_montant_ttc=''; - $day=''; - $year=''; - $month=''; - $day_date_when=''; - $year_date_when=''; - $month_date_when=''; - $search_frequency=''; - $search_array_options=array(); -} - - /* * View @@ -643,6 +867,7 @@ llxHeader('',$langs->trans("RepeatableInvoices"),'ch-facture.html#s-fac-facture- $form = new Form($db); $formother = new FormOther($db); +if (! empty($conf->projet->enabled)) { $formproject = new FormProjets($db); } $companystatic = new Societe($db); $now = dol_now(); @@ -665,7 +890,7 @@ if ($action == 'create') { $result = $object->getLinesArray(); - print '
'; + print ''; print ''; print ''; print ''; @@ -680,15 +905,15 @@ if ($action == 'create') $object->fetch_thirdparty(); + // Title + print '
'; + // Third party print ''; print ''; - // Title - print ''; - // Note public print '"; // Project - if (! empty($conf->projet->enabled) && is_object($object->thirdparty) && $object->thirdparty->id > 0) - { - $projectid = $object->fk_project; - $langs->load('projects'); - print ''; - } + if (! empty($conf->projet->enabled) && is_object($object->thirdparty) && $object->thirdparty->id > 0) + { + $projectid = $object->fk_project; + $langs->load('projects'); + print ''; + } // Bank account if ($object->fk_account > 0) @@ -760,8 +985,8 @@ if ($action == 'create') // Auto validate the invoice print ""; print "
' . $langs->trans('Ref') . ''; + print '
' . $langs->trans('Ref') . ''; $morehtmlref = ''; $discount = new DiscountAbsolute($db); $result = $discount->fetch(0, $object->id); @@ -238,7 +240,7 @@ if ($id > 0 || ! empty($ref)) print '
'.$langs->trans("Date").'
'.$langs->trans("DateInvoice").''.dol_print_date($object->date,"daytext").'
'.$langs->trans('Ref').'
'.$langs->trans('Ref').''; $morehtmlref=''; $discount=new DiscountAbsolute($db); @@ -163,13 +165,10 @@ if ($id > 0 || ! empty($ref)) print '
'; - print ''; - print '
'; + print '
'; print $langs->trans('RefCustomer'); print '
'; - print '
'; + print ''; print $object->ref_client; print '
'.$langs->trans('Ref').'
'.$langs->trans('Ref').''; $morehtmlref=''; $discount=new DiscountAbsolute($db); @@ -130,13 +132,10 @@ if ($id > 0 || ! empty($ref)) print '
'; - print ''; - print '
'; + print '
'; print $langs->trans('RefCustomer'); print '
'; - print '
'; + print ''; print $object->ref_client; print '
'.$langs->trans("Title").''; + print ''; + print '
'.$langs->trans("Customer").''.$object->thirdparty->getNomUrl(1,'customer').'
'.$langs->trans("Title").''; - print ''; - print '
'.$langs->trans("NotePublic").''; print ''; @@ -713,15 +938,15 @@ if ($action == 'create') print "
' . $langs->trans('Project') . ''; - $numprojet = $formproject->select_projects($socid, $projectid, 'projectid', 0); - print '   id).'">' . $langs->trans("AddProject") . ''; - print '
' . $langs->trans('Project') . ''; + $numprojet = $formproject->select_projects($socid, $projectid, 'projectid', 0); + print '   id).'">' . $langs->trans("AddProject") . ''; + print '
".$langs->trans("StatusOfGeneratedInvoices").""; - $select = array('0'=>$langs->trans('BillStatusDraft'),'1'=>$langs->trans('BillStatusValidated')); - print $form->selectarray('auto_validate', $select, GETPOST('auto_validate')); + $select = array('0'=>$langs->trans('BillStatusDraft'),'1'=>$langs->trans('BillStatusValidated')); + print $form->selectarray('auto_validate', $select, GETPOST('auto_validate')); print "
"; @@ -790,176 +1015,7 @@ if ($action == 'create') } print "\n"; - - /* - print ''; - print ''; if ($flag_price_may_change) @@ -996,11 +1052,16 @@ else $object->fetch_thirdparty(); // Confirmation de la suppression d'une ligne produit - 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; + 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); + } + + // Confirm delete of repeatable invoice + if ($action == 'ask_deleteinvoice') { + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteRepeatableInvoice'), $langs->trans('ConfirmDeleteRepeatableInvoice'), 'confirm_deleteinvoice', '', 'no', 1); + } + + print $formconfirm; $author = new User($db); $author->fetch($object->user_author); @@ -1013,32 +1074,78 @@ else dol_fiche_head($head, 'card', $langs->trans("RepeatableInvoice"),0,'bill'); // Add a div - print '
'; - - $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 ''; - if ($num) - { - print ''; - print ''; - print ''; - print ''; - if ($conf->global->PRODUCT_USE_UNITS) { - print ''; - } - print ''; - print ''; - print ''; - print ''; - print ''; - if (empty($conf->global->PRODUIT_MULTIPRICES)) print ''; - print "\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 ""; - - // 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 ''; - } - else - { - print '\n"; - } - - // Vat rate - print ''; - - // Qty - print ''; - - if ($conf->global->PRODUCT_USE_UNITS) { - print ''; - } - - // Percent - if ($objp->remise_percent > 0) - { - print '\n"; - } - else - { - print ''; - } - - // Total HT - print '\n"; - - // Total VAT - print '\n"; - - // Total TTC - print '\n"; - - // Total Unit price - print '\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 '\n"; - } - else - { - print ''; - } - } - - print ""; - - $i++; - } - - $db->free($result); - - } - else - { - print $db->error(); - } - print "
'.$langs->trans("Description").''.$langs->trans("VAT").''.$langs->trans("Qty").''.$langs->trans("Unit").''.$langs->trans("ReductionShort").''.$langs->trans("TotalHT").''.$langs->trans("TotalVAT").''.$langs->trans("TotalTTC").''.$langs->trans("PriceUHT").''.$langs->trans("CurrentProductPrice").'
'; - - print ''; // 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)?'
'.dol_htmlentitiesbr($objp->description):''; - - print '
'; - print ''; // 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.= ' '.$objp->custom_label.''; - 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 "'.vatrate($objp->tva_tx).'%'.$objp->qty.''.$product_static->getLabelOfUnit().''.$objp->remise_percent." % '.price($objp->total_ht)."'.price($objp->total_vat)."'.price($objp->total_ttc)."'.price($objp->subprice)."'.price($prodprice)." 
"; - */ - + print '
'; - + // Recurring invoice content + $linkback = '' . $langs->trans("BackToList") . ''; + + $morehtmlref=''; + if ($action != 'editref') $morehtmlref.=$form->editfieldkey($object->ref, 'ref', $object->ref, $object, $user->rights->facture->creer, '', '', 0, 2); + else $morehtmlref.= $form->editfieldval('', 'ref', $object->ref, $object, $user->rights->facture->creer, 'string'); + + $morehtmlref.='
'; + // Ref customer + //$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->facture->creer, 'string', '', 0, 1); + //$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->facture->creer, 'string', '', null, null, '', 1); + // Thirdparty + $morehtmlref.=$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); + // Project + if (! empty($conf->projet->enabled)) + { + $langs->load("projects"); + $morehtmlref.='
'.$langs->trans('Project') . ' '; + if ($user->rights->facture->creer) + { + if ($action != 'classify') + $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.=''; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (! empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref.=''; + $morehtmlref.=$proj->ref; + $morehtmlref.=''; + } else { + $morehtmlref.=''; + } + } + } + $morehtmlref.='
'; + + dol_banner_tab($object, 'ref', $linkback, 1, 'titre', 'none', $morehtmlref, '', 0, '', $morehtmlright); + + print '
'; + print '
'; + print '
'; + + print '
'; // Ref - print ''; - print ''; + print ''; - print ''; print ''; - - print ""; + */ + + print '"; print ''; print ''; @@ -1060,9 +1167,12 @@ else print ''; // Project - if (! empty($conf->projet->enabled)) { + /* + if (! empty($conf->projet->enabled)) + { $langs->load('projects'); print ''; print ''; print ''; - } + }*/ // Bank Account print '"; print ''; - print "
' . $langs->trans('Ref') . ''; - $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 '
'; + //print $langs->trans('Ref'); + print $form->editfieldkey($langs->trans("Ref"), 'ref', $object->ref, $object, $user->rights->facture->creer); + print ''; + $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 '
'.$langs->trans("Customer").''.$object->thirdparty->getNomUrl(1,'customer').'
".$langs->trans("Author").''.$author->getFullName($langs)."
'.$langs->trans("Author").''.$author->getFullName($langs)."
'.$langs->trans("AmountHT").''.price($object->total_ht,'',$langs,1,-1,-1,$conf->currency).''; if ($object->type != Facture::TYPE_CREDIT_NOTE) { - if ($action == 'editconditions') { + if ($action == 'editconditions') + { $form->form_conditions_reglement($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->cond_reglement_id, 'cond_reglement_id'); - } else { + } + else + { $form->form_conditions_reglement($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->cond_reglement_id, 'none'); } } else { @@ -1106,7 +1216,9 @@ else print '
'; @@ -1129,7 +1241,7 @@ else } print '
'; @@ -1151,10 +1263,15 @@ else print "
"; - - print '
'; - + print ''; + + print ''; + print '
'; + print '
'; + print '
'; + + print ''; + /* * Recurrence */ @@ -1164,36 +1281,36 @@ else print '
'; // if "frequency" is empty or = 0, the reccurence is disabled - print ''; @@ -1207,7 +1324,7 @@ else { print $langs->trans("NextDateToExecution"); } - print '
'; + print '
'; print ''; if ($action != 'editfrequency' && ! empty($object->brouillon) && $user->rights->facture->creer) print ''; print '
'; print $langs->trans('Frequency'); print 'id . '">' . img_edit($langs->trans('Edit'), 1) . '
'; - print '
'; + print ''; if ($action == 'editfrequency') { print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - print '
'; - print " ".$form->selectarray('unit_frequency', array('d'=>$langs->trans('Day'), 'm'=>$langs->trans('Month'), 'y'=>$langs->trans('Year')), ($object->unit_frequency?$object->unit_frequency:'m')); - print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + print '
'; + print " ".$form->selectarray('unit_frequency', array('d'=>$langs->trans('Day'), 'm'=>$langs->trans('Month'), 'y'=>$langs->trans('Year')), ($object->unit_frequency?$object->unit_frequency:'m')); + print '
'; } else { - if ($object->frequency > 0) - { - print $langs->trans('FrequencyPer_'.$object->unit_frequency, $object->frequency); - } - else - { - print $langs->trans("NotARecurringInvoiceTemplate"); - } + if ($object->frequency > 0) + { + print $langs->trans('FrequencyPer_'.$object->unit_frequency, $object->frequency); + } + else + { + print $langs->trans("NotARecurringInvoiceTemplate"); + } } print '
'; + print ''; if ($action == 'date_when' || $object->frequency > 0) { print $form->editfieldval($langs->trans("NextDateToExecution"), 'date_when', $object->date_when, $object, $user->rights->facture->creer, 'day'); @@ -1225,7 +1342,7 @@ else { print $langs->trans("MaxPeriodNumber"); } - print ''; + print ''; if ($action == 'nb_gen_max' || $object->frequency > 0) { print $form->editfieldval($langs->trans("MaxPeriodNumber"), 'nb_gen_max', $object->nb_gen_max?$object->nb_gen_max:'', $object, $user->rights->facture->creer); @@ -1243,8 +1360,8 @@ else print $form->editfieldkey($langs->trans("StatusOfGeneratedInvoices"), 'auto_validate', $object->auto_validate, $object, $user->rights->facture->creer); else print $langs->trans("StatusOfGeneratedInvoices"); - print ''; - $select = 'select;0:'.$langs->trans('BillStatusDraft').',1:'.$langs->trans('BillStatusValidated'); + print ''; + $select = 'select;0:'.$langs->trans('BillStatusDraft').',1:'.$langs->trans('BillStatusValidated'); if ($action == 'auto_validate' || $object->frequency > 0) { print $form->editfieldval($langs->trans("StatusOfGeneratedInvoices"), 'auto_validate', $object->auto_validate, $object, $user->rights->facture->creer, $select); @@ -1254,20 +1371,21 @@ else print '
'; - print '
'; - // Frequencry/Recurring section - if ($object->frequency > 0) - { - if (empty($conf->cron->enabled)) + if ($object->frequency > 0) + { + print '
'; + + if (empty($conf->cron->enabled)) { print info_admin($langs->trans("EnableAndSetupModuleCron", $langs->transnoentitiesnoconv("Module2300Name"))); } - print ''; + print '
'; + print '
'; // Nb of generation already done - print ''; + print ''; print ''; @@ -1276,7 +1394,7 @@ else // Date last print ''; print ''; @@ -1286,6 +1404,13 @@ else print '
'; } + print ''; + print ''; + print ''; + + print '

'; + + // Lines print ' @@ -1302,7 +1427,7 @@ else // Show object lines if (! empty($object->lines)) { - $disableedit=1; + //$disableedit=1; //$disablemove=1; $ret = $object->printObjectLines($action, $mysoc, $soc, $lineid, 0); // No date selector for template invoice } @@ -1336,34 +1461,34 @@ else //if ($object->statut == Facture::STATUS_DRAFT) // there is no draft status on templates. //{ - if ($user->rights->facture->creer) - { - if (! empty($object->frequency) && $object->nb_gen_max > 0 && ($object->nb_gen_done >= $object->nb_gen_max)) - { - print ''; - } - else - { - if (empty($object->frequency) || $object->date_when <= $today) - { - print ''; - } - else - { - print ''; - } - } - } - else - { - print ''; - } + if ($user->rights->facture->creer) + { + if (! empty($object->frequency) && $object->nb_gen_max > 0 && ($object->nb_gen_done >= $object->nb_gen_max)) + { + print ''; + } + else + { + if (empty($object->frequency) || $object->date_when <= $today) + { + print ''; + } + else + { + print ''; + } + } + } + else + { + print ''; + } //} //if ($object->statut == Facture::STATUS_DRAFT && $user->rights->facture->supprimer) if ($user->rights->facture->supprimer) { - print ''; + print ''; } print ''; @@ -1373,8 +1498,12 @@ else print '
'; print ''; // ancre - // Linked object block - $somethingshown = $form->showLinkedObjectBlock($object); + + // Show links to link elements + $linktoelem = $form->showLinkToObjectBlock($object, null, array('invoice')); + + $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem); + print '
'; @@ -1395,6 +1524,9 @@ else if ($search_montant_ht != '') $sql.= natural_search('f.total', $search_montant_ht, 1); if ($search_montant_vat != '') $sql.= natural_search('f.tva', $search_montant_vat, 1); if ($search_montant_ttc != '') $sql.= natural_search('f.total_ttc', $search_montant_ttc, 1); + if ($search_frequency == '1') $sql.= ' AND f.frequency > 0'; + if ($search_frequency == '0') $sql.= ' AND (f.frequency IS NULL or f.frequency = 0)'; + if ($month > 0) { if ($year > 0 && empty($day)) @@ -1414,8 +1546,8 @@ else $sql.= " AND f.date_when BETWEEN '".$db->idate(dol_get_first_day($year_date_when,$month_date_when,false))."' AND '".$db->idate(dol_get_last_day($year_date_when,$month_date_when,false))."'"; else if ($year_date_when > 0 && ! empty($day_date_when)) $sql.= " AND f.date_date_when_reglement BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month_date_when, $day_date_when, $year_date_when))."' AND '".$db->idate(dol_mktime(23, 59, 59, $month_date_when, $day_date_when, $year_date_when))."'"; - else - $sql.= " AND date_format(f.date_when, '%m') = '".$month_date_when."'"; + else + $sql.= " AND date_format(f.date_when, '%m') = '".$month_date_when."'"; } else if ($year_date_when > 0) { @@ -1423,14 +1555,14 @@ else } $nbtotalofrecords = 0; - if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) - { - $result = $db->query($sql); - $nbtotalofrecords = $db->num_rows($result); - } + if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) + { + $result = $db->query($sql); + $nbtotalofrecords = $db->num_rows($result); + } - $sql.= $db->order($sortfield, $sortorder); - $sql.= $db->plimit($limit+1,$offset); + $sql.= $db->order($sortfield, $sortorder); + $sql.= $db->plimit($limit+1,$offset); $resql = $db->query($sql); if ($resql) @@ -1438,7 +1570,7 @@ else $num = $db->num_rows($resql); $param='&socid='.$socid; - if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; + if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; if ($day) $param.='&day='.$day; if ($month) $param.='&month='.$month; @@ -1529,8 +1661,8 @@ else if (! empty($arrayfields['f.frequency']['checked'])) { // Amount - print ''; } // Date invoice @@ -1644,7 +1776,7 @@ else $i++; } } - else print ''; + else print ''; print "
'.$langs->trans("NbOfGenerationDone").'
'.$langs->trans("NbOfGenerationDone").''; print $object->nb_gen_done?$object->nb_gen_done:'0'; print '
'; print $langs->trans("DateLastGeneration"); - print ''; + print ''; print dol_print_date($object->date_last_gen, 'dayhour'); print '
'; - //print ''; + print ''; + print $form->selectyesno('search_frequency', $search_frequency, 1, false, 1); print '
'.$langs->trans("NoneF").'
'.$langs->trans("NoneF").'
"; $db->free($resql); diff --git a/htdocs/compta/facture/info.php b/htdocs/compta/facture/info.php index 24164b5709a..419cacf4cff 100644 --- a/htdocs/compta/facture/info.php +++ b/htdocs/compta/facture/info.php @@ -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(); +$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"]); diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 5fa90b6f14d..36873d15963 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -58,15 +58,19 @@ $projectid=(GETPOST('projectid')?GETPOST('projectid','int'):0); $id=(GETPOST('id','int')?GETPOST('id','int'):GETPOST('facid','int')); // For backward compatibility $ref=GETPOST('ref','alpha'); $socid=GETPOST('socid','int'); + $action=GETPOST('action','alpha'); $massaction=GETPOST('massaction','alpha'); $show_files=GETPOST('show_files','int'); $confirm=GETPOST('confirm','alpha'); +$toselect = GETPOST('toselect', 'array'); + $lineid=GETPOST('lineid','int'); $userid=GETPOST('userid','int'); $search_product_category=GETPOST('search_product_category','int'); $search_ref=GETPOST('sf_ref')?GETPOST('sf_ref','alpha'):GETPOST('search_ref','alpha'); $search_refcustomer=GETPOST('search_refcustomer','alpha'); +$search_type=GETPOST('search_type','int'); $search_societe=GETPOST('search_societe','alpha'); $search_montant_ht=GETPOST('search_montant_ht','alpha'); $search_montant_vat=GETPOST('search_montant_vat','alpha'); @@ -86,7 +90,6 @@ $year = GETPOST('year','int'); $day_lim = GETPOST('day_lim','int'); $month_lim = GETPOST('month_lim','int'); $year_lim = GETPOST('year_lim','int'); -$toselect = GETPOST('toselect', 'array'); $option = GETPOST('option'); if ($option == 'late') $filter = 'paye:0'; @@ -140,6 +143,7 @@ $checkedtypetiers=0; $arrayfields=array( 'f.facnumber'=>array('label'=>$langs->trans("Ref"), 'checked'=>1), 'f.ref_client'=>array('label'=>$langs->trans("RefCustomer"), 'checked'=>1), + 'f.type'=>array('label'=>$langs->trans("Type"), 'checked'=>0), 'f.date'=>array('label'=>$langs->trans("DateInvoice"), 'checked'=>1), 'f.date_lim_reglement'=>array('label'=>$langs->trans("DateDue"), 'checked'=>1), 's.nom'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1), @@ -173,7 +177,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab */ if (GETPOST('cancel')) { $action='list'; $massaction=''; } -if (! GETPOST('confirmmassaction')) { $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 @@ -189,6 +193,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter") || GETPOS $search_product_category=''; $search_ref=''; $search_refcustomer=''; + $search_type=''; $search_project=''; $search_societe=''; $search_montant_ht=''; @@ -205,418 +210,23 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter") || GETPOS $day=''; $year=''; $month=''; - $toselect=''; $option=''; $filter=''; $day_lim=''; $year_lim=''; $month_lim=''; + $toselect=''; $search_array_options=array(); } if (empty($reshook)) { - // Mass actions. Controls on number of lines checked - $maxformassaction=1000; - if (! empty($massaction) && count($toselect) < 1) - { - $error++; - setEventMessages($langs->trans("NoLineChecked"), null, "warnings"); - } - if (! $error && count($toselect) > $maxformassaction) - { - setEventMessages($langs->trans('TooManyRecordForMassAction',$maxformassaction), null, 'errors'); - $error++; - } - - if (! $error && $massaction == 'confirm_presend') - { - $resaction = ''; - $nbsent = 0; - $nbignored = 0; - $langs->load("mails"); - include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - - if (!$error && !isset($user->email)) - { - $error++; - setEventMessages($langs->trans("NoSenderEmailDefined"), null, 'warnings'); - } - - if (! $error) - { - $thirdparty=new Societe($db); - $objecttmp=new Facture($db); - $listofobjectid=array(); - $listofobjectthirdparties=array(); - $listofobjectref=array(); - foreach($toselect as $toselectid) - { - $objecttmp=new Facture($db); // must create new instance because instance is saved into $listofobjectref array for future use - $result=$objecttmp->fetch($toselectid); - if ($result > 0) - { - $listoinvoicesid[$toselectid]=$toselectid; - $thirdpartyid=$objecttmp->fk_soc?$objecttmp->fk_soc:$objecttmp->socid; - $listofobjectthirdparties[$thirdpartyid]=$thirdpartyid; - $listofobjectref[$thirdpartyid][$toselectid]=$objecttmp; - } - } - //var_dump($listofobjectthirdparties);exit; - - foreach ($listofobjectthirdparties as $thirdpartyid) - { - $result = $thirdparty->fetch($thirdpartyid); - if ($result < 0) - { - dol_print_error($db); - exit; - } - - // Define recipient $sendto and $sendtocc - if (trim($_POST['sendto'])) - { - // Recipient is provided into free text - $sendto = trim($_POST['sendto']); - $sendtoid = 0; - } - elseif ($_POST['receiver'] != '-1') - { - // Recipient was provided from combo list - if ($_POST['receiver'] == 'thirdparty') // Id of third party - { - $sendto = $thirdparty->email; - $sendtoid = 0; - } - else // Id du contact - { - $sendto = $thirdparty->contact_get_property((int) $_POST['receiver'],'email'); - $sendtoid = $_POST['receiver']; - } - } - if (trim($_POST['sendtocc'])) - { - $sendtocc = trim($_POST['sendtocc']); - } - elseif ($_POST['receivercc'] != '-1') - { - // Recipient was provided from combo list - if ($_POST['receivercc'] == 'thirdparty') // Id of third party - { - $sendtocc = $thirdparty->email; - } - else // Id du contact - { - $sendtocc = $thirdparty->contact_get_property((int) $_POST['receivercc'],'email'); - } - } - - //var_dump($listofobjectref[$thirdpartyid]); // Array of invoice for this thirdparty - - $attachedfiles=array('paths'=>array(), 'names'=>array(), 'mimes'=>array()); - $listofqualifiedinvoice=array(); - $listofqualifiedref=array(); - foreach($listofobjectref[$thirdpartyid] as $objectid => $object) - { - //var_dump($object); - //var_dump($thirdpartyid.' - '.$objectid.' - '.$object->statut); - - if ($object->statut != Facture::STATUS_VALIDATED) - { - $nbignored++; - continue; // Payment done or started or canceled - } - - // Read document - // TODO Use future field $object->fullpathdoc to know where is stored default file - // TODO If not defined, use $object->modelpdf (or defaut invoice config) to know what is template to use to regenerate doc. - $filename=dol_sanitizeFileName($object->ref).'.pdf'; - $filedir=$conf->facture->dir_output . '/' . dol_sanitizeFileName($object->ref); - $file = $filedir . '/' . $filename; - $mime = dol_mimetype($file); - - if (dol_is_file($file)) - { - if (empty($sendto)) // For the case, no recipient were set (multi thirdparties send) - { - $object->fetch_thirdparty(); - $sendto = $object->thirdparty->email; - } - - if (empty($sendto)) - { - //print "No recipient for thirdparty ".$object->thirdparty->name; - $nbignored++; - continue; - } - - if (dol_strlen($sendto)) - { - // Create form object - $attachedfiles=array( - 'paths'=>array_merge($attachedfiles['paths'],array($file)), - 'names'=>array_merge($attachedfiles['names'],array($filename)), - 'mimes'=>array_merge($attachedfiles['mimes'],array($mime)) - ); - } - - $listofqualifiedinvoice[$objectid]=$object; - $listofqualifiedref[$objectid]=$object->ref; - } - else - { - $nbignored++; - $langs->load("other"); - $resaction.='
'.$langs->trans('ErrorCantReadFile',$file).'
'; - dol_syslog('Failed to read file: '.$file, LOG_WARNING); - continue; - } - - //var_dump($listofqualifiedref); - } - - if (count($listofqualifiedinvoice) > 0) - { - $langs->load("commercial"); - $from = $user->getFullName($langs) . ' <' . $user->email .'>'; - $replyto = $from; - $subject = GETPOST('subject'); - $message = GETPOST('message'); - $sendtocc = GETPOST('sentocc'); - $sendtobcc = (empty($conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO)?'':$conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO); - - $substitutionarray=array( - '__ID__' => join(', ',array_keys($listofqualifiedinvoice)), - '__EMAIL__' => $thirdparty->email, - '__CHECK_READ__' => '', - //'__LASTNAME__' => $obj2->lastname, - //'__FIRSTNAME__' => $obj2->firstname, - '__FACREF__' => join(', ',$listofqualifiedref), // For backward compatibility - '__REF__' => join(', ',$listofqualifiedref), - '__REFCLIENT__' => $thirdparty->name - ); - - $subject=make_substitutions($subject, $substitutionarray); - $message=make_substitutions($message, $substitutionarray); - - $filepath = $attachedfiles['paths']; - $filename = $attachedfiles['names']; - $mimetype = $attachedfiles['mimes']; - - //var_dump($filepath); - - // Send mail - require_once(DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'); - $mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,$sendtobcc,$deliveryreceipt,-1); - if ($mailfile->error) - { - $resaction.='
'.$mailfile->error.'
'; - } - else - { - $result=$mailfile->sendfile(); - if ($result) - { - $resaction.=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2)).'
'; // Must not contain " - - $error=0; - - // Insert logs into agenda - foreach($listofqualifiedinvoice as $invid => $object) - { - $actiontypecode='AC_FAC'; - $actionmsg=$langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto; - if ($message) - { - if ($sendtocc) $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc); - $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject); - $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":"); - $actionmsg = dol_concatdesc($actionmsg, $message); - } - - // Initialisation donnees - $object->sendtoid = 0; - $object->actiontypecode = $actiontypecode; - $object->actionmsg = $actionmsg; // Long text - $object->actionmsg2 = $actionmsg2; // Short text - $object->fk_element = $invid; - $object->elementtype = $object->element; - - // Appel des triggers - include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php"); - $interface=new Interfaces($db); - $result=$interface->run_triggers('BILL_SENTBYMAIL',$object,$user,$langs,$conf); - if ($result < 0) { $error++; $errors=$interface->errors; } - // Fin appel triggers - - if ($error) - { - setEventMessages($db->lasterror(), $errors, 'errors'); - dol_syslog("Error in trigger BILL_SENTBYMAIL ".$db->lasterror(), LOG_ERR); - } - $nbsent++; - } - } - else - { - $langs->load("other"); - if ($mailfile->error) - { - $resaction.=$langs->trans('ErrorFailedToSendMail',$from,$sendto); - $resaction.='
'.$mailfile->error.'
'; - } - else - { - $resaction.='
No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS
'; - } - } - } - } - } - - $resaction.=($resaction?'
':$resaction); - $resaction.=''.$langs->trans("ResultOfMailSending").':
'."\n"; - $resaction.=$langs->trans("NbSelected").': '.count($toselect)."\n
"; - $resaction.=$langs->trans("NbIgnored").': '.($nbignored?$nbignored:0)."\n
"; - $resaction.=$langs->trans("NbSent").': '.($nbsent?$nbsent:0)."\n
"; - - if ($nbsent) - { - $action=''; // Do not show form post if there was at least one successfull sent - setEventMessages($langs->trans("EMailSentToNRecipients", $nbsent.'/'.count($toselect)), null, 'mesgs'); - setEventMessages($resaction, null, 'mesgs'); - } - else - { - //setEventMessages($langs->trans("EMailSentToNRecipients", 0), null, 'warnings'); // May be object has no generated PDF file - setEventMessages($resaction, null, 'warnings'); - } - } - - $action='list'; - $massaction=''; - } - - if (! $error && $massaction == "builddoc" && $user->rights->facture->lire && ! GETPOST('button_search')) - { - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; - require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; - - $objecttmp=new Facture($db); - $listofobjectid=array(); - $listofobjectthirdparties=array(); - $listofobjectref=array(); - foreach($toselect as $toselectid) - { - $objecttmp=new Facture($db); // must create new instance because instance is saved into $listofobjectref array for future use - $result=$objecttmp->fetch($toselectid); - if ($result > 0) - { - $listoinvoicesid[$toselectid]=$toselectid; - $thirdpartyid=$objecttmp->fk_soc?$objecttmp->fk_soc:$objecttmp->socid; - $listofobjectthirdparties[$thirdpartyid]=$thirdpartyid; - $listofobjectref[$toselectid]=$objecttmp->ref; - } - } - - $arrayofinclusion=array(); - foreach($listofobjectref as $tmppdf) $arrayofinclusion[]=preg_quote($tmppdf.'.pdf','/'); - $factures = dol_dir_list($conf->facture->dir_output,'all',1,implode('|',$arrayofinclusion),'\.meta$|\.png','date',SORT_DESC,0,true); - - // liste les fichiers - $files = array(); - foreach($listofobjectref as $basename) - { - foreach($factures as $facture) - { - if (strstr($facture["name"],$basename)) - { - $files[] = $conf->facture->dir_output.'/'.$basename.'/'.$facture["name"]; - break; - } - } - } - - // Define output language (Here it is not used because we do only merging existing PDF) - $outputlangs = $langs; - $newlang=''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id'); - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->thirdparty->default_lang; - if (! empty($newlang)) - { - $outputlangs = new Translate("",$conf); - $outputlangs->setDefaultLang($newlang); - } - - // Create empty PDF - $pdf=pdf_getInstance(); - if (class_exists('TCPDF')) - { - $pdf->setPrintHeader(false); - $pdf->setPrintFooter(false); - } - $pdf->SetFont(pdf_getPDFFont($outputlangs)); - - if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); - - // Add all others - foreach($files as $file) - { - // Charge un document PDF depuis un fichier. - $pagecount = $pdf->setSourceFile($file); - for ($i = 1; $i <= $pagecount; $i++) - { - $tplidx = $pdf->importPage($i); - $s = $pdf->getTemplatesize($tplidx); - $pdf->AddPage($s['h'] > $s['w'] ? 'P' : 'L'); - $pdf->useTemplate($tplidx); - } - } - - // Create output dir if not exists - dol_mkdir($diroutputmassaction); - - // Save merged file - $filename=strtolower(dol_sanitizeFileName($langs->transnoentities("Invoices"))); - if ($filter=='paye:0') - { - if ($option=='late') $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid"))).'_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Late"))); - else $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid"))); - } - if ($year) $filename.='_'.$year; - if ($month) $filename.='_'.$month; - if ($pagecount) - { - $now=dol_now(); - $file=$diroutputmassaction.'/'.$filename.'_'.dol_print_date($now,'dayhourlog').'.pdf'; - $pdf->Output($file,'F'); - if (! empty($conf->global->MAIN_UMASK)) - @chmod($file, octdec($conf->global->MAIN_UMASK)); - - $langs->load("exports"); - setEventMessages($langs->trans('FileSuccessfullyBuilt',$filename.'_'.dol_print_date($now,'dayhourlog')), null, 'mesgs'); - } - else - { - setEventMessages($langs->trans('NoPDFAvailableForDocGenAmongChecked'), null, 'errors'); - } - } - - // Remove file - if ($action == 'remove_file') - { - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - - $langs->load("other"); - $upload_dir = $diroutputmassaction; - $file = $upload_dir . '/' . GETPOST('file'); - $ret=dol_delete_file($file); - if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('file')), null, 'mesgs'); - else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('file')), null, 'errors'); - $action=''; - } - + $objectclass='Facture'; + $objectlabel='Invoices'; + $permtoread = $user->rights->facture->lire; + $permtodelete = $user->rights->facture->supprimer; + $uploaddir = $conf->facture->dir_output; + include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; } @@ -668,7 +278,7 @@ if ($search_user > 0) $sql.=", ".MAIN_DB_PREFIX."c_type_contact as tc"; } $sql.= ' WHERE f.fk_soc = s.rowid'; -$sql.= " AND f.entity = ".$conf->entity; +$sql.= ' AND f.entity IN ('.getEntity('facture', 1).')'; if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if ($search_product_category > 0) $sql.=" AND cp.fk_categorie = ".$search_product_category; if ($socid > 0) $sql.= ' AND s.rowid = '.$socid; @@ -688,6 +298,15 @@ if ($filtre) } if ($search_ref) $sql .= natural_search('f.facnumber', $search_ref); if ($search_refcustomer) $sql .= natural_search('f.ref_client', $search_refcustomer); +if ($search_type != '' && $search_type >= 0) +{ + if ($search_type == '0') $sql.=" AND f.type = 0"; // standard + if ($search_type == '1') $sql.=" AND f.type = 1"; // replacement + if ($search_type == '2') $sql.=" AND f.type = 2"; // credit note + if ($search_type == '3') $sql.=" AND f.type = 3"; // deposit + if ($search_type == '4') $sql.=" AND f.type = 4"; // proforma + if ($search_type == '5') $sql.=" AND f.type = 5"; // situation +} if ($search_project) $sql .= natural_search('p.ref', $search_project); if ($search_societe) $sql .= natural_search('s.nom', $search_societe); if ($search_town) $sql.= natural_search('s.town', $search_town); @@ -699,7 +318,13 @@ if ($search_company) $sql .= natural_search('s.nom', $search_company); if ($search_montant_ht != '') $sql.= natural_search('f.total', $search_montant_ht, 1); if ($search_montant_vat != '') $sql.= natural_search('f.total_vat', $search_montant_vat, 1); if ($search_montant_ttc != '') $sql.= natural_search('f.total_ttc', $search_montant_ttc, 1); -if ($search_status != '' && $search_status >= 0) $sql.= " AND f.fk_statut = ".$db->escape($search_status); +if ($search_status != '' && $search_status >= 0) +{ + if ($search_status == '0') $sql.=" AND f.fk_statut = 0"; // draft + if ($search_status == '1') $sql.=" AND f.fk_statut = 1"; // unpayed + if ($search_status == '2') $sql.=" AND f.fk_statut = 2"; // payed Not that some corrupted data may contains f.fk_statut = 1 AND f.paye = 1 (it means payed too but should not happend. If yes, reopen and reclassify billed) + if ($search_status == '3') $sql.=" AND f.fk_statut = 3"; // abandonned +} if ($search_paymentmode > 0) $sql .= " AND f.fk_mode_reglement = ".$search_paymentmode.""; if ($month > 0) { @@ -754,12 +379,17 @@ $sql.=$hookmanager->resPrint; if (! $sall) { - $sql.= ' GROUP BY f.rowid, f.facnumber, ref_client, f.type, f.note_private, f.note_public, f.increment, f.total, f.tva, f.total_ttc,'; + $sql.= ' GROUP BY f.rowid, f.facnumber, ref_client, f.type, f.note_private, f.note_public, f.increment, f.fk_mode_reglement, f.total, f.tva, f.total_ttc,'; $sql.= ' f.datef, f.date_lim_reglement,'; $sql.= ' f.paye, f.fk_statut,'; $sql.= ' f.datec, f.tms,'; - $sql.= ' s.rowid, s.nom, s.town, s.zip, s.fk_pays, s.code_client, s.client, typent.code'; - $sql.= ' ,state.code_departement, state.nom'; + $sql.= ' s.rowid, s.nom, s.town, s.zip, s.fk_pays, s.code_client, s.client, typent.code,'; + $sql.= ' state.code_departement, state.nom'; + + foreach ($extrafields->attribute_label as $key => $val) //prevent error with sql_mode=only_full_group_by + { + $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key : ''); + } } else { @@ -787,7 +417,7 @@ if ($resql) $num = $db->num_rows($resql); $arrayofselected=is_array($toselect)?$toselect:array(); - + if ($socid) { $soc = new Societe($db); @@ -797,6 +427,7 @@ if ($resql) $param='&socid='.$socid; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; + if ($sall) $param.='&sall='.$sall; if ($day) $param.='&day='.urlencode($day); if ($month) $param.='&month='.urlencode($month); if ($year) $param.='&year=' .urlencode($year); @@ -805,6 +436,7 @@ if ($resql) if ($year_lim) $param.='&year_lim=' .urlencode($year_lim); if ($search_ref) $param.='&search_ref=' .urlencode($search_ref); if ($search_refcustomer) $param.='&search_refcustomer=' .urlencode($search_refcustomer); + if ($search_type != '') $param.='&search_type='.urlencode($search_type); if ($search_societe) $param.='&search_societe=' .urlencode($search_societe); if ($search_sale > 0) $param.='&search_sale=' .urlencode($search_sale); if ($search_user > 0) $param.='&search_user=' .urlencode($search_user); @@ -824,9 +456,26 @@ if ($resql) $tmpkey=preg_replace('/search_options_/','',$key); if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val); } - - $massactionbutton=$form->selectMassAction('', $massaction == 'presend' ? array() : array('presend'=>$langs->trans("SendByMail"), 'builddoc'=>$langs->trans("PDFMerge"))); - + + $arrayofmassactions=array( + 'presend'=>$langs->trans("SendByMail"), + 'builddoc'=>$langs->trans("PDFMerge") + ); + if ($user->rights->facture->supprimer) + { + //if (! empty($conf->global->STOCK_CALCULATE_ON_BILL) || empty($conf->global->INVOICE_CAN_ALWAYS_BE_REMOVED)) + if (empty($conf->global->INVOICE_CAN_ALWAYS_BE_REMOVED)) + { + // mass deletion never possible on invoices on such situation + } + else + { + $arrayofmassactions['delete']=$langs->trans("Delete"); + } + } + if ($massaction == 'presend') $arrayofmassactions=array(); + $massactionbutton=$form->selectMassAction('', $arrayofmassactions); + $i = 0; print ''."\n"; if ($optioncss != '') print ''; @@ -836,8 +485,8 @@ if ($resql) print ''; print ''; print ''; - - print_barre_liste($langs->trans('BillsCustomers').' '.($socid?' '.$soc->name:''),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,$massactionbutton,$num,$nbtotalofrecords,'title_accountancy.png',0,'','',$limit); + + print_barre_liste($langs->trans('BillsCustomers').' '.($socid?' '.$soc->name:''), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_accountancy.png', 0, '', '', $limit); if ($massaction == 'presend') { @@ -865,7 +514,7 @@ if ($resql) print ''; include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; - $formmail = new FormMail($db); + $formmail = new FormMail($db); dol_fiche_head(null, '', ''); @@ -876,10 +525,12 @@ if ($resql) include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; $formmail = new FormMail($db); $formmail->withform=-1; - $formmail->fromtype = 'user'; - $formmail->fromid = $user->id; - $formmail->fromname = $user->getFullName($langs); - $formmail->frommail = $user->email; + $formmail->fromtype = (GETPOST('fromtype')?GETPOST('fromtype'):(!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE)?$conf->global->MAIN_MAIL_DEFAULT_FROMTYPE:'user')); + + if($formmail->fromtype === 'user'){ + $formmail->fromid = $user->id; + + } if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 1)) // If bit 1 is set { $formmail->trackid='inv'.$object->id; @@ -928,6 +579,7 @@ if ($resql) $formmail->param['models']=$modelmail; $formmail->param['models_id']=GETPOST('modelmailselected','int'); $formmail->param['facid']=join(',',$arrayofselected); + // TODO We should use $formmail->param['id']=join(',',$arrayofselected); //$formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id; print $formmail->get_form(); @@ -983,12 +635,13 @@ if ($resql) $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields - + print ''."\n"; - + print ''; if (! empty($arrayfields['f.facnumber']['checked'])) print_liste_field_titre($arrayfields['f.facnumber']['label'],$_SERVER['PHP_SELF'],'f.facnumber','',$param,'',$sortfield,$sortorder); if (! empty($arrayfields['f.ref_client']['checked'])) print_liste_field_titre($arrayfields['f.ref_client']['label'],$_SERVER["PHP_SELF"],'f.ref_client','',$param,'',$sortfield,$sortorder); + if (! empty($arrayfields['f.type']['checked'])) print_liste_field_titre($arrayfields['f.type']['label'],$_SERVER["PHP_SELF"],'f.type','',$param,'',$sortfield,$sortorder); if (! empty($arrayfields['f.date']['checked'])) print_liste_field_titre($arrayfields['f.date']['label'],$_SERVER['PHP_SELF'],'f.datef','',$param,'align="center"',$sortfield,$sortorder); if (! empty($arrayfields['f.date_lim_reglement']['checked'])) print_liste_field_titre($arrayfields['f.date_lim_reglement']['label'],$_SERVER['PHP_SELF'],"f.date_lim_reglement",'',$param,'align="center"',$sortfield,$sortorder); if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'],$_SERVER['PHP_SELF'],'s.nom','',$param,'',$sortfield,$sortorder); @@ -1041,6 +694,20 @@ if ($resql) print ''; print ''; } + // Type + if (! empty($arrayfields['f.type']['checked'])) + { + print ''; + } // Date invoice if (! empty($arrayfields['f.date']['checked'])) { @@ -1087,7 +754,7 @@ if ($resql) if (! empty($arrayfields['typent.code']['checked'])) { print ''; } // Payment mode @@ -1177,7 +844,7 @@ if ($resql) } // Action column print ''; print "\n"; @@ -1198,6 +865,7 @@ if ($resql) $facturestatic->type=$obj->type; $facturestatic->statut=$obj->fk_statut; $facturestatic->date_lim_reglement=$db->jdate($obj->datelimite); + $facturestatic->type=$obj->type; print ''; if (! empty($arrayfields['f.facnumber']['checked'])) @@ -1233,7 +901,7 @@ if ($resql) print "\n"; if (! $i) $totalarray['nbfield']++; } - + // Customer ref if (! empty($arrayfields['f.ref_client']['checked'])) { @@ -1242,7 +910,16 @@ if ($resql) print ''; if (! $i) $totalarray['nbfield']++; } - + + // Type + if (! empty($arrayfields['f.type']['checked'])) + { + print '"; + if (! $i) $totalarray['nbfield']++; + } + // Date if (! empty($arrayfields['f.date']['checked'])) { @@ -1251,7 +928,7 @@ if ($resql) print ''; if (! $i) $totalarray['nbfield']++; } - + // Date limit if (! empty($arrayfields['f.date_lim_reglement']['checked'])) { @@ -1263,7 +940,7 @@ if ($resql) print ''; if (! $i) $totalarray['nbfield']++; } - + // Third party if (! empty($arrayfields['s.nom']['checked'])) { @@ -1317,7 +994,7 @@ if ($resql) print ''; if (! $i) $totalarray['nbfield']++; } - + // Payment mode if (! empty($arrayfields['f.fk_mode_reglement']['checked'])) { @@ -1326,7 +1003,7 @@ if ($resql) print ''; if (! $i) $totalarray['nbfield']++; } - + // Amount HT if (! empty($arrayfields['f.total_ht']['checked'])) { @@ -1367,7 +1044,7 @@ if ($resql) if (! $i) $totalarray['totalrtpfield']=$totalarray['nbfield']; $totalarray['totalrtp'] += $remaintopay; } - + // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { @@ -1417,9 +1094,12 @@ if ($resql) // Action column print '' ; if (! $i) $totalarray['nbfield']++; @@ -1479,7 +1159,7 @@ if ($resql) $paramwithoutshowfiles=preg_replace('/show_files=1&?/','',$param); $title=$langs->trans("MassFilesArea").' ('.$langs->trans("Hide").')'; - print $formfile->showdocuments('massfilesarea','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,''); + print $formfile->showdocuments('massfilesarea_invoices','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,''); } else { diff --git a/htdocs/compta/facture/note.php b/htdocs/compta/facture/note.php index 3562a235963..4b4b68a7cf4 100644 --- a/htdocs/compta/facture/note.php +++ b/htdocs/compta/facture/note.php @@ -60,7 +60,9 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, * View */ -llxHeader(); +$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); @@ -81,7 +83,7 @@ if ($id > 0 || ! empty($ref)) $linkback = ''.$langs->trans("BackToList").''; // Ref - print ''; + print ''; print ''; // Ref customer - print ''; - print ''; diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php index 00254b7440f..87a27166ae8 100644 --- a/htdocs/compta/facture/prelevement.php +++ b/htdocs/compta/facture/prelevement.php @@ -1,7 +1,7 @@ * Copyright (C) 2004 Eric Seigne - * Copyright (C) 2004-2015 Laurent Destailleur + * Copyright (C) 2004-2016 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2010-2014 Juanjo Menent * @@ -106,7 +106,9 @@ if ($action == "delete") $now=dol_now(); -llxHeader('', $langs->trans("Bill")); +$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); @@ -155,7 +157,7 @@ if ($object->id > 0) $linkback = ''.$langs->trans("BackToList").''; // Ref - print '"; // Ref customer - print ''; - print ''; // Third party print ''; - print ''; print ''; // Type - print ''; // Discounts - print ''; print ''; - print ''; @@ -483,26 +485,33 @@ if ($object->id > 0) // Add a withdraw request if ($object->statut > Facture::STATUS_DRAFT && $object->paye == 0 && $num == 0) { - if ($user->rights->prelevement->bons->creer) - { - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - } - else - { - print ''.$langs->trans("MakeWithdrawRequest").''; - } + if ($resteapayer > 0) + { + if ($user->rights->prelevement->bons->creer) + { + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + } + else + { + print ''.$langs->trans("MakeWithdrawRequest").''; + } + } + else + { + print ''.$langs->trans("MakeWithdrawRequest").''; + } } else { if ($num == 0) { - if ($object->statut > Facture::STATUS_DRAFT) print ''.$langs->trans("MakeWithdrawRequest").''; + if ($object->statut > Facture::STATUS_DRAFT) print ''.$langs->trans("MakeWithdrawRequest").''; else print ''.$langs->trans("MakeWithdrawRequest").''; } else print ''.$langs->trans("MakeWithdrawRequest").''; diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index ffb3b3631f1..1dd1c46299a 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -117,7 +117,7 @@ if (count($listofsearchfields)) { if ($i == 0) print ''; print ''; - print ''; + print ''; if ($i == 0) print ''; print ''; $i++; @@ -199,7 +199,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire) } else { - print ''; + print ''; } print "
'; + $listtype=array( + Facture::TYPE_STANDARD=>$langs->trans("InvoiceStandard"), + Facture::TYPE_REPLACEMENT=>$langs->trans("InvoiceReplacement"), + Facture::TYPE_CREDIT_NOTE=>$langs->trans("InvoiceAvoir"), + Facture::TYPE_DEPOSIT=>$langs->trans("InvoiceDeposit"), + ); + //$listtype[Facture::TYPE_PROFORMA]=$langs->trans("InvoiceProForma"); // A proformat invoice is not an invoice but must be an order. + print $form->selectarray('search_type', $listtype, $search_type, 1, 0, 0, '', 0, 0, 0, 'ASC', 'maxwidth100'); + print ''; - 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 $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), 'maxwidth100'); print ''; - $searchpitco=$form->showFilterAndCheckAddButtons(1, 'checkforselect', 1); + $searchpitco=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1); print $searchpitco; print '
'; + print $facturestatic->getLibType(); + print "'; - $selected=0; - if (in_array($obj->facid, $arrayofselected)) $selected=1; - print ''; + 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->facid, $arrayofselected)) $selected=1; + print ''; + } print '
'.$langs->trans('Ref').'
'.$langs->trans('Ref').''; $morehtmlref=''; $discount=new DiscountAbsolute($db); @@ -98,13 +100,10 @@ if ($id > 0 || ! empty($ref)) print '
'; - print ''; - print '
'; + print '
'; print $langs->trans('RefCustomer'); print '
'; - print '
'; + print ''; print $object->ref_client; print '
'.$langs->trans("Ref").''; + print '
'.$langs->trans("Ref").''; $morehtmlref=''; $discount=new DiscountAbsolute($db); $result=$discount->fetch(0,$object->id); @@ -171,24 +173,24 @@ if ($object->id > 0) print "
'; + print '
'; print ''; print '
'; print $langs->trans('RefCustomer'); print '
'; print '
'; + print ''; print $object->ref_client; print '
'.$langs->trans('Company').''.$object->thirdparty->getNomUrl(1,'compta'); + print ''.$object->thirdparty->getNomUrl(1,'compta'); print '   ('.$langs->trans('OtherBills').')
'.$langs->trans('Type').''; + print '
'.$langs->trans('Type').''; print $object->getLibType(); if ($object->type == Facture::TYPE_REPLACEMENT) { @@ -229,7 +231,7 @@ if ($object->id > 0) print '
'.$langs->trans('Discounts').''; + print '
'.$langs->trans('Discounts').''; if ($object->thirdparty->remise_percent) print $langs->trans("CompanyHasRelativeDiscount",$object->thirdparty->remise_percent); else print $langs->trans("CompanyHasNoRelativeDiscount"); print '. '; @@ -290,7 +292,7 @@ if ($object->id > 0) // Date invoice print '
'; print ''; if ($object->type != Facture::TYPE_CREDIT_NOTE && $action != 'editinvoicedate' && ! empty($object->brouillon) && $user->rights->facture->creer) print ''; print '
'; - print $langs->trans('Date'); + print $langs->trans('DateInvoice'); print 'id.'">'.img_edit($langs->trans('SetDate'),1).'
'; @@ -443,7 +445,7 @@ if ($object->id > 0) print '
'.$langs->trans('Status').''.($object->getLibStatut(4,$totalpaye)).'
'.$langs->trans("RIB").''; + print '
'.$langs->trans("RIB").''; print $object->thirdparty->display_rib(); print '
'.$langs->trans("Search").'
:
'.$langs->trans("NoInvoice").'
'.$langs->trans("NoInvoice").'

"; $db->free($resql); @@ -275,7 +275,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture- } else { - print ''.$langs->trans("NoInvoice").''; + print ''.$langs->trans("NoInvoice").''; } print "
"; $db->free($resql); @@ -387,7 +387,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire) { $colspan=5; if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) $colspan++; - print ''.$langs->trans("NoInvoice").''; + print ''.$langs->trans("NoInvoice").''; } print '
'; $db->free($resql); @@ -474,7 +474,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture- { $colspan=5; if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) $colspan++; - print ''.$langs->trans("NoInvoice").''; + print ''.$langs->trans("NoInvoice").''; } print '
'; } @@ -824,7 +824,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire) print ''; $total_ttc += $obj->total_ttc; - $total += $obj->total; + $total += $obj->total_ht; $totalam += $obj->am; $var=!$var; $i++; @@ -842,7 +842,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire) { $colspan=6; if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) $colspan++; - print ''.$langs->trans("NoInvoice").''; + print ''.$langs->trans("NoInvoice").''; } print '
'; $db->free($resql); @@ -942,7 +942,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture- { $colspan=6; if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) $colspan++; - print ''.$langs->trans("NoInvoice").''; + print ''.$langs->trans("NoInvoice").''; } print '
'; } diff --git a/htdocs/compta/journal/purchasesjournal.php b/htdocs/compta/journal/purchasesjournal.php index b8a5779c708..f0b520bb11e 100644 --- a/htdocs/compta/journal/purchasesjournal.php +++ b/htdocs/compta/journal/purchasesjournal.php @@ -230,7 +230,7 @@ foreach ($tabfac as $key => $val) if (isset($line['nomtcheck']) || $mt) { print ""; - print "".dol_print_date($val["date"]).""; + print "".dol_print_date($db->jdate($val["date"])).""; print "".$invoicestatic->getNomUrl(1).""; print "".$k."".$line['label'].""; diff --git a/htdocs/compta/journal/sellsjournal.php b/htdocs/compta/journal/sellsjournal.php index 0cbd5068077..670d89fd2cb 100644 --- a/htdocs/compta/journal/sellsjournal.php +++ b/htdocs/compta/journal/sellsjournal.php @@ -263,7 +263,7 @@ foreach ($tabfac as $key => $val) if (isset($line['nomtcheck']) || $mt) { print ""; - print "".dol_print_date($val["date"]).""; + print "".dol_print_date($db->jdate($val["date"])).""; print "".$invoicestatic->getNomUrl(1).""; print "".$k."".$line['label'].""; diff --git a/htdocs/compta/localtax/index.php b/htdocs/compta/localtax/index.php index d7b6b897ec3..642c37b9d65 100644 --- a/htdocs/compta/localtax/index.php +++ b/htdocs/compta/localtax/index.php @@ -277,7 +277,8 @@ $sql.= " WHERE f.entity = ".$conf->entity; $sql.= " AND f.datev >= '".$db->idate(dol_get_first_day($y,1,false))."'"; $sql.= " AND f.datev <= '".$db->idate(dol_get_last_day($y,12,false))."'"; $sql.= " AND localtaxtype=".$localTaxType; -$sql.= " GROUP BY dm ASC ORDER BY dm ASC"; +$sql.= " GROUP BY dm"; +$sql.= " ORDER BY dm ASC"; pt($db, $sql,$langs->trans("Year")." $y"); diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php index fa1341dcbc6..a1f50959aa4 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2014 Laurent Destailleur + * Copyright (C) 2004-2016 Laurent Destailleur * Copyright (C) 2005 Marc Barilley / Ocebo * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2007 Franky Van Liedekerke @@ -33,10 +33,12 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.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'; $langs->load('companies'); $langs->load('bills'); $langs->load('banks'); +$langs->load('multicurrency'); $action = GETPOST('action','alpha'); $confirm = GETPOST('confirm'); @@ -361,7 +363,10 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie if (code == \'CHQ\' || code == \'VIR\') { - $(\'.fieldrequireddyn\').addClass(\'fieldrequired\'); + if (code == \'CHQ\') + { + $(\'.fieldrequireddyn\').addClass(\'fieldrequired\'); + } if ($(\'#fieldchqemetteur\').val() == \'\') { var emetteur = ('.$facture->type.' == 2) ? \''.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_NOM).'\' : jQuery(\'#thirdpartylabel\').val(); @@ -393,7 +398,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie json["invoice_type"] = $("#invoice_type").val(); json["amountPayment"] = $("#amountpayment").attr("value"); json["amounts"] = _elemToJson(form.find("input.amount")); - json["remains"] = _elemToJson(form.find("input.remain]")); + json["remains"] = _elemToJson(form.find("input.remain")); if (imgId != null) { json["imgClicked"] = imgId; @@ -432,7 +437,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie '; print ' });'."\n"; - if(!empty($conf->global->INVOICE_AUTO_FILLJS)){ + if (!empty($conf->use_javascript_ajax)){ //Add js for AutoFill print ' $(document).ready(function () {'; print ' $(".AutoFillAmout").on(\'click touchstart\', function(){ @@ -456,24 +461,19 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie print ''; // Third party - print '\n"; + print '\n"; // Date payment print ''; - print ''; - - $rowspan=5; + print ''; // Payment mode print '\n"; - print ''; print ''; // Bank account @@ -488,7 +488,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie } else { - print ''; + print ''; } print "\n"; @@ -510,19 +510,36 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie print ''; print ''; + // Comments + print ''; + print ''; + print '
'.$langs->trans('Company').''.$facture->thirdparty->getNomUrl(4)."
'.$langs->trans('Company').''.$facture->thirdparty->getNomUrl(4)."
'.$langs->trans('Date').''; $datepayment = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); $datepayment= ($datepayment == '' ? (empty($conf->global->MAIN_AUTOFILL_DATE)?-1:'') : $datepayment); $form->select_date($datepayment,'','','',0,"add_paiement",1,1,0,0,'','',$facture->date); - print ''.$langs->trans('Comments').'
'.$langs->trans('PaymentMode').''; $form->select_types_paiements((GETPOST('paiementcode')?GETPOST('paiementcode'):$facture->mode_reglement_code),'paiementcode','',2); print "'; - print '
  
'.$langs->trans('Comments').''; + print '
'; dol_fiche_end(); + /* * List of unpaid invoices */ - $sql = 'SELECT f.rowid as facid, f.facnumber, f.total_ttc, f.multicurrency_total_ttc, f.type, '; - $sql.= ' f.datef as df'; + + $sql = 'SELECT f.rowid as facid, f.facnumber, f.total_ttc, f.multicurrency_code, f.multicurrency_total_ttc, f.type, '; + $sql.= ' f.datef as df, f.fk_soc as socid'; $sql.= ' FROM '.MAIN_DB_PREFIX.'facture as f'; - $sql.= ' WHERE f.entity = '.$conf->entity; - $sql.= ' AND f.fk_soc = '.$facture->socid; - $sql.= ' AND f.paye = 0'; + + if(!empty($conf->global->FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS)) { + $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON (f.fk_soc = s.rowid)'; + } + + $sql.= ' WHERE f.entity = '.$conf->entity; + $sql.= ' AND (f.fk_soc = '.$facture->socid; + + if(!empty($conf->global->FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS) && !empty($facture->thirdparty->parent)) { + $sql.= ' OR f.fk_soc IN (SELECT rowid FROM '.MAIN_DB_PREFIX.'societe WHERE parent = '.$facture->thirdparty->parent.')'; + } + + $sql.= ') AND f.paye = 0'; $sql.= ' AND f.fk_statut = 1'; // Statut=0 => not validated, Statut=2 => canceled if ($facture->type != 2) { @@ -561,12 +578,13 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie print ''; print ''.$arraytitle.''; print ''.$langs->trans('Date').''; - print ''.$langs->trans('AmountTTC').''; + if (!empty($conf->multicurrency->enabled)) print ''.$langs->trans('Currency').''; if (!empty($conf->multicurrency->enabled)) print ''.$langs->trans('MulticurrencyAmountTTC').''; - print ''.$alreadypayedlabel.''; if (!empty($conf->multicurrency->enabled)) print ''.$multicurrencyalreadypayedlabel.''; - print ''.$remaindertopay.''; if (!empty($conf->multicurrency->enabled)) print ''.$multicurrencyremaindertopay.''; + print ''.$langs->trans('AmountTTC').''; + print ''.$alreadypayedlabel.''; + print ''.$remaindertopay.''; print ''.$langs->trans('PaymentAmount').''; if (!empty($conf->multicurrency->enabled)) print ''.$langs->trans('MulticurrencyPaymentAmount').''; print ' '; @@ -583,6 +601,9 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie $objp = $db->fetch_object($resql); $var=!$var; + $soc = new Societe($db); + $soc->fetch($objp->socid); + $invoice=new Facture($db); $invoice->fetch($objp->facid); $paiement = $invoice->getSommePaiement(); @@ -605,16 +626,40 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie print ''; print $invoice->getNomUrl(1,''); + if($objp->socid != $facture->thirdparty->id) print ' - '.$soc->getNomUrl(1).' '; print "\n"; // Date print ''.dol_print_date($db->jdate($objp->df),'day')."\n"; - - // Price - print ''.price($sign * $objp->total_ttc).''; - + + // Currency + if (!empty($conf->multicurrency->enabled)) print ''.$objp->multicurrency_code."\n"; + // Multicurrency Price - if (!empty($conf->multicurrency->enabled)) print ''.price($sign * $objp->multicurrency_total_ttc).''; + if (!empty($conf->multicurrency->enabled)) + { + print ''; + if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency) print price($sign * $objp->multicurrency_total_ttc); + print ''; + + // Multicurrency Price + print ''; + if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency) + { + print price($sign * $multicurrency_payment); + if ($multicurrency_creditnotes) print '+'.price($multicurrency_creditnotes); + if ($multicurrency_deposits) print '+'.price($multicurrency_deposits); + } + print ''; + + // Multicurrency Price + print ''; + if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency) print price($sign * $multicurrency_remaintopay); + print ''; + } + + // Price + print ''.price($sign * $objp->total_ttc).''; // Received or paid back print ''.price($sign * $paiement); @@ -622,25 +667,10 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie if ($deposits) print '+'.price($deposits); print ''; - // Multicurrency Price - if (!empty($conf->multicurrency->enabled)) - { - print ''.price($sign * $multicurrency_payment); - if ($multicurrency_creditnotes) print '+'.price($multicurrency_creditnotes); - if ($multicurrency_deposits) print '+'.price($multicurrency_deposits); - print ''; - } - // Remain to take or to pay back print ''.price($sign * $remaintopay).''; //$test= price(price2num($objp->total_ttc - $paiement - $creditnotes - $deposits)); - // Multicurrency Price - if (!empty($conf->multicurrency->enabled)) - { - print ''.price($sign * $multicurrency_remaintopay).''; - } - // Amount print ''; @@ -650,7 +680,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie if ($action != 'add_paiement') { - if(!empty($conf->global->INVOICE_AUTO_FILLJS)) + if (!empty($conf->use_javascript_ajax)) print img_picto("Auto fill",'rightarrow', "class='AutoFillAmout' data-rowname='".$namef."' data-value='".($sign * $remaintopay)."'"); print ''; print ''; @@ -663,7 +693,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie print ""; // Multicurrency Price - if (!empty($conf->multicurrency->enabled)) + if (! empty($conf->multicurrency->enabled)) { print ''; @@ -671,17 +701,20 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie $namef = 'multicurrency_amount_'.$objp->facid; $nameRemain = 'multicurrency_remain_'.$objp->facid; - if ($action != 'add_paiement') + if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency) { - if(!empty($conf->global->INVOICE_AUTO_FILLJS)) - print img_picto("Auto fill",'rightarrow', "class='AutoFillAmout' data-rowname='".$namef."' data-value='".($sign * $multicurrency_remaintopay)."'"); - print ''; - print ''; - } - else - { - print ''; - print ''; + if ($action != 'add_paiement') + { + if (!empty($conf->use_javascript_ajax)) + print img_picto("Auto fill",'rightarrow', "class='AutoFillAmout' data-rowname='".$namef."' data-value='".($sign * $multicurrency_remaintopay)."'"); + print ''; + print ''; + } + else + { + print ''; + print ''; + } } print ""; } @@ -712,16 +745,16 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie { // Print total print ''; - print ''.$langs->trans('TotalTTC').''; - print ''.price($sign * $total_ttc).''; + print ''.$langs->trans('TotalTTC').''; if (!empty($conf->multicurrency->enabled)) print ''; + if (!empty($conf->multicurrency->enabled)) print ''; + if (!empty($conf->multicurrency->enabled)) print ''; + print ''.price($sign * $total_ttc).''; print ''.price($sign * $totalrecu); if ($totalrecucreditnote) print '+'.price($totalrecucreditnote); if ($totalrecudeposits) print '+'.price($totalrecudeposits); print ''; - if (!empty($conf->multicurrency->enabled)) print ''; print ''.price($sign * price2num($total_ttc - $totalrecu - $totalrecucreditnote - $totalrecudeposits,'MT')).''; - if (!empty($conf->multicurrency->enabled)) print ''; print ''; if (!empty($conf->multicurrency->enabled)) print ''; print ' '; diff --git a/htdocs/compta/paiement/cheque/card.php b/htdocs/compta/paiement/cheque/card.php index 0ffaf49b955..94686162687 100644 --- a/htdocs/compta/paiement/cheque/card.php +++ b/htdocs/compta/paiement/cheque/card.php @@ -3,8 +3,8 @@ * Copyright (C) 2007-2011 Laurent Destailleur * Copyright (C) 2009-2012 Regis Houssin * Copyright (C) 2011-2016 Juanjo Menent - * Copyright (C) 2013 Philippe Grand - * Copyright (C) 2015 Alexandre Spangaro + * Copyright (C) 2013 Philippe Grand + * Copyright (C) 2015-2016 Alexandre Spangaro * * 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 @@ -21,9 +21,9 @@ */ /** - * \file htdocs/compta/paiement/cheque/card.php - * \ingroup bank, invoice - * \brief Page for cheque deposits + * \file htdocs/compta/paiement/cheque/card.php + * \ingroup bank, invoice + * \brief Page for cheque deposits */ require '../../../main.inc.php'; @@ -57,7 +57,7 @@ if ($page < 0) { $page = 0 ; } $limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; $offset = $limit * $page ; -$dir=$conf->banque->dir_output.'/bordereau/'; +$dir=$conf->bank->dir_output.'/checkdeposits/'; $filterdate=dol_mktime(0, 0, 0, GETPOST('fdmonth'), GETPOST('fdday'), GETPOST('fdyear')); $filteraccountid=GETPOST('accountid'); @@ -95,7 +95,7 @@ if ($action == 'setrefext' && $user->rights->banque->cheque) { $ref_ext = GETPOST('ref_ext'); - $result=$object->setValueFrom('ref_ext', $ref_ext); + $result=$object->setValueFrom('ref_ext', $ref_ext, '', null, 'text', '', $user, 'CHECKDEPOSIT_MODIFY'); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); @@ -298,7 +298,9 @@ if (GETPOST('removefilter')) $filteraccountid=0; } -llxHeader(); +$title=$langs->trans("Cheques") . " - " . $langs->trans("Card"); +$helpurl=""; +llxHeader("",$title,$helpurl); $form = new Form($db); $formfile = new FormFile($db); @@ -386,7 +388,7 @@ if ($action == 'new') print ''; //print ''; // Filter - print ''; print '\n"; print '\n"; print ''; - + // Link to payment print ''; - + print '' ; @@ -563,7 +565,7 @@ else $accountstatic->label=$object->account_label; print '
'.$langs->trans('Date').''.dol_print_date($now,'day').'
'.$langs->trans("DateChequeReceived").''; + print '
'.$langs->trans("DateChequeReceived").''; print $form->select_date($filterdate,'fd',0,0,1,'',1,1,1); print '
'.$langs->trans("BankAccount").''; @@ -502,7 +504,7 @@ if ($action == 'new') print ''.$value["emetteur"]."'.$value["banque"]."'.price($value["amount"], 0, $langs, 1, -1, -1, $conf->currency).''; $paymentstatic->id=$value["paymentid"]; @@ -528,7 +530,7 @@ if ($action == 'new') print ' '; } print ''; print ''; print '
'; - print '
'; + print '
'; print ''; diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index e230d91e6ae..17882e76a6a 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -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 ''; - print ''; + if (! empty($conf->banque->enabled)) + { + print ''; + } print ''; @@ -309,16 +315,21 @@ if ($resql) // Payment number print ''; - - print ''; + + // Account + if (! empty($conf->banque->enabled)) + { + print ''; + } + // Amount print ''; if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION)) diff --git a/htdocs/compta/paiement_charge.php b/htdocs/compta/paiement_charge.php index a68f3445305..3822f9f91f5 100644 --- a/htdocs/compta/paiement_charge.php +++ b/htdocs/compta/paiement_charge.php @@ -1,5 +1,6 @@ + * Copyright (C) 2016 Frédéric France * * 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 @@ -28,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 @@ -44,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; } @@ -108,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; @@ -129,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; } @@ -154,11 +155,13 @@ $form=new Form($db); // Formulaire de creation d'un paiement de charge -if ($_GET["action"] == 'create') +if ($action == 'create') { $charge = new ChargeSociales($db); $charge->fetch($chid); + $charge->accountid=$charge->fk_account?$charge->fk_account:$charge->accountid; + $charge->paiementtype=$charge->mode_reglement_id?$charge->mode_reglement_id:$charge->paiementtype; $total = $charge->amount; @@ -178,16 +181,16 @@ if ($_GET["action"] == 'create') dol_fiche_head('', ''); - print '
'; print $langs->trans('Ref'); @@ -760,7 +762,7 @@ else dol_print_error($db); } - dol_fiche_end(); + dol_fiche_end(); } @@ -799,7 +801,7 @@ if ($action != 'new') $filedir=$dir.get_exdir($object->ref,0,1,0,$object,'cheque') . dol_sanitizeFileName($object->ref); $urlsource=$_SERVER["PHP_SELF"]."?id=".$object->id; - $formfile->show_documents('remisecheque', $filename, $filedir, $urlsource, 1, 1); + print $formfile->showdocuments('remisecheque', $filename, $filedir, $urlsource, 1, 1); print '
'; } diff --git a/htdocs/compta/paiement/cheque/class/remisecheque.class.php b/htdocs/compta/paiement/cheque/class/remisecheque.class.php index 6ab43a277c0..998fd1db7c3 100644 --- a/htdocs/compta/paiement/cheque/class/remisecheque.class.php +++ b/htdocs/compta/paiement/cheque/class/remisecheque.class.php @@ -597,7 +597,7 @@ class RemiseCheque extends CommonObject // We save charset_output to restore it because write_file can change it if needed for // output format that does not support UTF8. $sav_charseSupprimert_output=$outputlangs->charset_output; - $result=$docmodel->write_file($this, $conf->banque->dir_output.'/bordereau', $this->ref, $outputlangs); + $result=$docmodel->write_file($this, $conf->bank->dir_output.'/checkdeposits', $this->ref, $outputlangs); if ($result > 0) { //$outputlangs->charset_output=$sav_charset_output; diff --git a/htdocs/compta/paiement/cheque/list.php b/htdocs/compta/paiement/cheque/list.php index ebfd598ee0b..df02264badc 100644 --- a/htdocs/compta/paiement/cheque/list.php +++ b/htdocs/compta/paiement/cheque/list.php @@ -191,7 +191,7 @@ if ($resql) // Bank print '
'; - if ($objp->bid) print ''.img_object($langs->trans("ShowAccount"),'account').' '.$objp->label.''; + if ($objp->bid) print ''.img_object($langs->trans("ShowAccount"),'account').' '.$objp->label.''; else print ' '; print ''; print ''; print ''; - $form->select_comptes($search_account,'search_account',0,'',1); - print ''; + $form->select_comptes($search_account,'search_account',0,'',1); + print ''; print ''; print ''.$objp->num_paiement.''; - if ($objp->bid) - { - $accountstatic->id=$objp->bid; - $accountstatic->label=$objp->label; - print $accountstatic->getNomUrl(1); - } - else print ' '; - print ''; + if ($objp->bid) + { + $accountstatic->id=$objp->bid; + $accountstatic->label=$objp->label; + print $accountstatic->getNomUrl(1); + } + else print ' '; + print ''.price($objp->amount).'
'; + print '
'; - print ""; + print ""; - print ''; - print '\n"; - print '\n"; - print '\n"; - print '\n"; - print ''; + print ''; + print '\n"; + print '\n"; + print '\n"; + print '\n"; + print ''; $sql = "SELECT sum(p.amount) as total"; $sql.= " FROM ".MAIN_DB_PREFIX."paiementcharge as p"; @@ -199,28 +202,28 @@ if ($_GET["action"] == 'create') $sumpaid = $obj->total; $db->free(); } - print ''; - print ''; + print ''; + print ''; print ''; - print "'; + print "'; print ''; - print '"; print ''; - print '\n"; print ''; print ''; print ''; - print ''; @@ -228,11 +231,11 @@ if ($_GET["action"] == 'create') print ''; - print ''."\n"; + print ''."\n"; print ''; print ''; - print ''; + print ''; print ''; print '
".$langs->trans("SocialContribution")."
".$langs->trans("SocialContribution")."
'.$langs->trans("Ref").''.$chid.'
'.$langs->trans("Type")."".$charge->type_libelle."
'.$langs->trans("Period")."".dol_print_date($charge->periode,'day')."
'.$langs->trans("Label").''.$charge->lib."
'.$langs->trans("DateDue")."".dol_print_date($charge->date_ech,'day')."
'.$langs->trans("Amount")."".price($charge->amount,0,$outputlangs,1,-1,-1,$conf->currency).'
'.$langs->trans("Ref").''.$chid.'
'.$langs->trans("Type")."".$charge->type_libelle."
'.$langs->trans("Period")."".dol_print_date($charge->periode,'day')."
'.$langs->trans("Label").''.$charge->lib."
'.$langs->trans("DateDue")."".dol_print_date($charge->date_ech,'day')."
'.$langs->trans("Amount")."".price($charge->amount,0,$outputlangs,1,-1,-1,$conf->currency).'
'.$langs->trans("AlreadyPaid").''.price($sumpaid,0,$outputlangs,1,-1,-1,$conf->currency).'
'.$langs->trans("RemainderToPay").''.price($total-$sumpaid,0,$outputlangs,1,-1,-1,$conf->currency).'
'.$langs->trans("AlreadyPaid").''.price($sumpaid,0,$outputlangs,1,-1,-1,$conf->currency).'
'.$langs->trans("RemainderToPay").''.price($total-$sumpaid,0,$outputlangs,1,-1,-1,$conf->currency).'
".$langs->trans("Payment").'".$langs->trans("Payment").'
'.$langs->trans("Date").''; + print '
'.$langs->trans("Date").''; $datepaye = dol_mktime(12, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]); $datepayment=empty($conf->global->MAIN_AUTOFILL_DATE)?(empty($_POST["remonth"])?-1:$datepaye):0; $form->select_date($datepayment,'','','','',"add_payment",1,1); print "
'.$langs->trans("PaymentMode").''; + print '
'.$langs->trans("PaymentMode").''; $form->select_types_paiements(isset($_POST["paiementtype"])?$_POST["paiementtype"]:$charge->paiementtype, "paiementtype"); print "
'.$langs->trans('AccountToDebit').''; + print ''; $form->select_comptes(isset($_POST["accountid"])?$_POST["accountid"]:$charge->accountid, "accountid", 0, '',1); // Show opend bank account list print '
'.$langs->trans('Numero'); print ' ('.$langs->trans("ChequeOrTransferNumber").')'; print '
'.$langs->trans("Comments").'
'; @@ -314,8 +317,9 @@ if ($_GET["action"] == 'create') print "
"; - print '
'; - print ''; + // Bouton Save payment + print '
'.$langs->trans("ClosePaidContributionsAutomatically"); + print '
'; print '     '; print ''; print '
'; diff --git a/htdocs/compta/payment_sc/card.php b/htdocs/compta/payment_sc/card.php index ad59687b43c..0ea48d9075c 100644 --- a/htdocs/compta/payment_sc/card.php +++ b/htdocs/compta/payment_sc/card.php @@ -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 ''; // Ref -print ''; +print ''; print ''; // Date -print ''; +print ''; // Mode -print ''; +print ''; // Numero -print ''; +print ''; // Montant -print ''; +print ''; // Note -print ''; +print ''; // Bank account if (! empty($conf->banque->enabled)) @@ -278,7 +278,7 @@ else dol_print_error($db); } -print ''; +dol_fiche_end(); /* diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 31d9e4d67c1..5bc09419666 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -3,7 +3,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2010-2015 Juanjo Menent * Copyright (C) 2010-2014 Laurent Destailleur - * Copyright (C) 2014 Ferran Marcet + * Copyright (C) 2014-2016 Ferran Marcet * * 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 @@ -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'; @@ -87,8 +88,6 @@ class BonPrelevement extends CommonObject $this->factures = array(); - $this->numero_national_emetteur = ""; - $this->methodes_trans = array(); $this->methodes_trans[0] = "Internet"; @@ -105,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 @@ -167,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 @@ -183,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"; @@ -206,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"; @@ -377,7 +376,7 @@ class BonPrelevement extends CommonObject } /* - * Fin de la procedure + * End of procedure */ if ($error == 0) { @@ -479,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"; @@ -606,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)"; @@ -919,7 +918,10 @@ class BonPrelevement extends CommonObject $row = $this->db->fetch_row($resql); $ref = "T".$ref.str_pad(dol_substr("00".intval($row[0])+1,0,2),2,"0",STR_PAD_LEFT); - $this->filename = $conf->prelevement->dir_output.'/receipts/'.$ref.'.xml'; + $dir=$conf->prelevement->dir_output.'/receipts'; + if (! is_dir($dir)) dol_mkdir($dir); + + $this->filename = $dir.'/'.$ref.'.xml'; // Create withdraw receipt in database $sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement_bons ("; @@ -935,10 +937,6 @@ class BonPrelevement extends CommonObject { $prev_id = $this->db->last_insert_id(MAIN_DB_PREFIX."prelevement_bons"); $this->id = $prev_id; - - $dir=$conf->prelevement->dir_output.'/receipts'; - $file=$filebonprev; - if (! is_dir($dir)) dol_mkdir($dir); } else { @@ -1018,23 +1016,28 @@ class BonPrelevement extends CommonObject $this->date_echeance = $datetimeprev; $this->reference_remise = $ref; - $this->numero_national_emetteur = $conf->global->PRELEVEMENT_NUMERO_NATIONAL_EMETTEUR; - $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; // TODO Add this into setup of admin/prelevement.php. 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; // Generation of SEPA file $this->generate(); } - dol_syslog(__METHOD__."::End withdraw receipt, file ".$filebonprev, LOG_DEBUG); + dol_syslog(__METHOD__."::End withdraw receipt, file ".$this->filename, LOG_DEBUG); } /* @@ -1462,7 +1465,7 @@ class BonPrelevement extends CommonObject fputs($this->file, " "); // Zone Reservee B2 - fputs($this->file, $this->numero_national_emetteur); // Numero National d'emmetteur B3 + fputs($this->file, $this->emetteur_ics); // ICS // Date d'echeance C1 @@ -1522,7 +1525,8 @@ class BonPrelevement extends CommonObject */ static function buildRumNumber($row_code_client, $row_datec, $row_drum) { - $pre = ($row_datec > 1359673200) ? 'RUM-' : '++R'; + global $langs; + $pre = ($row_datec > 1359673200) ? $langs->trans('RUM').'-' : '++R'; return $pre.$row_code_client.'-'.$row_drum.'-'.date('U', $row_datec); } @@ -1562,7 +1566,7 @@ class BonPrelevement extends CommonObject $XML_DEBITOR =''; $XML_DEBITOR .=' '.$CrLf; $XML_DEBITOR .=' '.$CrLf; - $XML_DEBITOR .=' '.('AS-'.$row_facnumber.'-'.$Rowing).''.$CrLf; + $XML_DEBITOR .=' '.('AS-'.dol_trunc($row_facnumber,20).'-'.$Rowing).''.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters $XML_DEBITOR .=' '.$CrLf; $XML_DEBITOR .=' '.round($row_somme, 2).''.$CrLf; $XML_DEBITOR .=' '.$CrLf; @@ -1611,7 +1615,7 @@ class BonPrelevement extends CommonObject fputs($this->file, " "); // Zone Reservee B2 - fputs($this->file, $this->numero_national_emetteur); // Numero National d'emmetteur B3 + fputs($this->file, $this->emetteur_ics); // ICS // Date d'echeance C1 @@ -1677,13 +1681,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"; @@ -1718,7 +1740,7 @@ class BonPrelevement extends CommonObject $XML_SEPA_INFO .= ' '.$CrLf; $XML_SEPA_INFO .= ' '.$dateTime_ETAD.''.$CrLf; $XML_SEPA_INFO .= ' '.$CrLf; - $XML_SEPA_INFO .= ' '.strtoupper(dol_string_unaccent($configuration->global->PRELEVEMENT_RAISON_SOCIALE)).''.$CrLf; + $XML_SEPA_INFO .= ' '.strtoupper(dol_string_unaccent($this->raison_sociale)).''.$CrLf; $XML_SEPA_INFO .= ' '.$CrLf; $XML_SEPA_INFO .= ' '.$country[1].''.$CrLf; $XML_SEPA_INFO .= ' '.strtoupper(dol_string_unaccent($configuration->global->MAIN_INFO_SOCIETE_ADDRESS)).''.$CrLf; @@ -1727,16 +1749,16 @@ class BonPrelevement extends CommonObject $XML_SEPA_INFO .= ' '.$CrLf; $XML_SEPA_INFO .= ' '.$CrLf; $XML_SEPA_INFO .= ' '.$CrLf; - $XML_SEPA_INFO .= ' '.preg_replace('/\s/', '', $configuration->global->PRELEVEMENT_IBAN).''.$CrLf; + $XML_SEPA_INFO .= ' '.preg_replace('/\s/', '', $this->emetteur_iban).''.$CrLf; $XML_SEPA_INFO .= ' '.$CrLf; $XML_SEPA_INFO .= ' '.$CrLf; $XML_SEPA_INFO .= ' '.$CrLf; $XML_SEPA_INFO .= ' '.$CrLf; - $XML_SEPA_INFO .= ' '.$configuration->global->PRELEVEMENT_BIC.''.$CrLf; + $XML_SEPA_INFO .= ' '.$this->emetteur_bic.''.$CrLf; $XML_SEPA_INFO .= ' '.$CrLf; $XML_SEPA_INFO .= ' '.$CrLf; /* $XML_SEPA_INFO .= ' '.$CrLf; - $XML_SEPA_INFO .= ' '.$configuration->global->PRELEVEMENT_RAISON_SOCIALE.''.$CrLf; + $XML_SEPA_INFO .= ' '.$this->raison_sociale.''.$CrLf; $XML_SEPA_INFO .= ' '.$CrLf; $XML_SEPA_INFO .= ' '.$country[1].''.$CrLf; $XML_SEPA_INFO .= ' '.$conf->global->MAIN_INFO_SOCIETE_ADDRESS.''.$CrLf; @@ -1748,7 +1770,7 @@ class BonPrelevement extends CommonObject $XML_SEPA_INFO .= ' '.$CrLf; $XML_SEPA_INFO .= ' '.$CrLf; $XML_SEPA_INFO .= ' '.$CrLf; - $XML_SEPA_INFO .= ' '.$configuration->global->PRELEVEMENT_ICS.''.$CrLf; + $XML_SEPA_INFO .= ' '.$this->emetteur_ics.''.$CrLf; $XML_SEPA_INFO .= ' '.$CrLf; $XML_SEPA_INFO .= ' SEPA'.$CrLf; $XML_SEPA_INFO .= ' '.$CrLf; @@ -1778,7 +1800,7 @@ class BonPrelevement extends CommonObject fputs($this->file, " "); // Zone Reservee B2 - fputs($this->file, $this->numero_national_emetteur); // Numero National d'emmetteur B3 + fputs($this->file, $this->emetteur_ics); // ICS // Reserve C1 diff --git a/htdocs/compta/prelevement/create.php b/htdocs/compta/prelevement/create.php index 3350f5c34a3..8be897990ed 100644 --- a/htdocs/compta/prelevement/create.php +++ b/htdocs/compta/prelevement/create.php @@ -122,7 +122,7 @@ if ($nb < 0 || $nb1 < 0 || $nb11 < 0) } print '
'.$langs->trans('Ref').'
'.$langs->trans('Ref').''; print $form->showrefnav($paiement,'id','',1,'rowid','id'); print '
'.$langs->trans('Date').''.dol_print_date($paiement->datep,'day').'
'.$langs->trans('Date').''.dol_print_date($paiement->datep,'day').'
'.$langs->trans('Mode').''.$langs->trans("PaymentType".$paiement->type_code).'
'.$langs->trans('Mode').''.$langs->trans("PaymentType".$paiement->type_code).'
'.$langs->trans('Numero').''.$paiement->num_paiement.'
'.$langs->trans('Numero').''.$paiement->num_paiement.'
'.$langs->trans('Amount').''.price($paiement->amount, 0, $outputlangs, 1, -1, -1, $conf->currency).'
'.$langs->trans('Amount').''.price($paiement->amount, 0, $outputlangs, 1, -1, -1, $conf->currency).'
'.$langs->trans('Note').''.nl2br($paiement->note).'
'.$langs->trans('Note').''.nl2br($paiement->note).'
'; -print ''; +print ''; print ''; diff --git a/htdocs/compta/prelevement/factures.php b/htdocs/compta/prelevement/factures.php index a7df114ae6f..1727bc16224 100644 --- a/htdocs/compta/prelevement/factures.php +++ b/htdocs/compta/prelevement/factures.php @@ -94,7 +94,7 @@ if ($prev_id) print '
'.$langs->trans("NbOfInvoiceToWithdraw").'
'.$langs->trans("NbOfInvoiceToWithdraw").''; print $nb; print '
'; print $langs->trans("WithdrawalFile").''; - $relativepath = 'receipts/'.$bon->ref; + $relativepath = 'receipts/'.$bon->ref.'.xml'; print ''.$relativepath.''; print '
'; diff --git a/htdocs/compta/prelevement/fiche-rejet.php b/htdocs/compta/prelevement/fiche-rejet.php index d520abccbcf..de6d368afd7 100644 --- a/htdocs/compta/prelevement/fiche-rejet.php +++ b/htdocs/compta/prelevement/fiche-rejet.php @@ -93,7 +93,7 @@ if ($prev_id) print '
'; print $langs->trans("WithdrawalFile").''; - $relativepath = 'receipts/'.$bon->ref; + $relativepath = 'receipts/'.$bon->ref.'.xml'; print ''.$relativepath.''; print '
'; diff --git a/htdocs/compta/prelevement/fiche-stat.php b/htdocs/compta/prelevement/fiche-stat.php index c2316578130..5fc3966fdf9 100644 --- a/htdocs/compta/prelevement/fiche-stat.php +++ b/htdocs/compta/prelevement/fiche-stat.php @@ -91,7 +91,7 @@ if ($prev_id) print '
'; print $langs->trans("WithdrawalFile").''; - $relativepath = 'receipts/'.$bon->ref; + $relativepath = 'receipts/'.$bon->ref.'.xml'; print ''.$relativepath.''; print '
'; @@ -141,7 +141,7 @@ if ($prev_id) print price($row[0]); print ''; - print round($row[0]/$bon->amount*100,2)." %"; + if ($bon->amount) print round($row[0]/$bon->amount*100,2)." %"; print ''; print "\n"; diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index 95ea2bfe46c..63d4b9930ed 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -149,6 +149,11 @@ $hselected = 'report'; report_header($name,$nomlink,$period,$periodlink,$description,$builddate,$exportlink,array('modecompta'=>$modecompta),$calcmode); +if (! empty($conf->accounting->enabled)) +{ + print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1); +} + // Show report array print ''; print ''; @@ -710,13 +715,22 @@ if (! empty($conf->expensereport->enabled)) if (! empty($conf->don->enabled)) { print ''; - $sql = "SELECT p.societe as name, p.firstname, p.lastname, date_format(p.datedon,'%Y-%m') as dm, sum(p.amount) as amount"; - $sql.= " FROM ".MAIN_DB_PREFIX."don as p"; - $sql.= " WHERE p.entity = ".$conf->entity; if ($modecompta == 'CREANCES-DETTES') - $sql.= " AND fk_statut in (1,2)"; + { + $sql = "SELECT p.societe as name, p.firstname, p.lastname, date_format(p.datedon,'%Y-%m') as dm, sum(p.amount) as amount"; + $sql.= " FROM ".MAIN_DB_PREFIX."don as p"; + $sql.= " WHERE p.entity = ".$conf->entity; + $sql.= " AND fk_statut in (1,2)"; + } else - $sql.= " AND fk_statut=2"; + { + $sql = "SELECT p.societe as nom, p.firstname, p.lastname, date_format(p.datedon,'%Y-%m') as dm, sum(p.amount) as amount"; + $sql.= " FROM ".MAIN_DB_PREFIX."don as p"; + $sql.= " INNER JOIN ".MAIN_DB_PREFIX."payment_donation as pe ON pe.fk_donation = p.rowid"; + $sql.= " INNER JOIN ".MAIN_DB_PREFIX."c_paiement as c ON pe.fk_typepayment = c.id"; + $sql.= " WHERE p.entity = ".getEntity('donation',1); + $sql.= " AND fk_statut >= 2"; + } if (! empty($date_start) && ! empty($date_end)) $sql.= " AND p.datedon >= '".$db->idate($date_start)."' AND p.datedon <= '".$db->idate($date_end)."'"; $sql.= " GROUP BY p.societe, p.firstname, p.lastname, dm"; diff --git a/htdocs/compta/resultat/index.php b/htdocs/compta/resultat/index.php index 861b44edd6c..62ef55fb711 100644 --- a/htdocs/compta/resultat/index.php +++ b/htdocs/compta/resultat/index.php @@ -93,6 +93,12 @@ $hselected='report'; report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink,array('modecompta'=>$modecompta),$calcmode); +if (! empty($conf->accounting->enabled)) +{ + print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1); +} + + /* * Factures clients @@ -474,9 +480,11 @@ $parameters["mode"] = $modecompta; $hookmanager->initHooks(array('externalbalance')); $reshook=$hookmanager->executeHooks('addReportInfo',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks + /* * Salaries */ + if (! empty($conf->salaries->enabled)) { if ($modecompta == 'CREANCES-DETTES') { @@ -580,15 +588,23 @@ if (! empty($conf->don->enabled)) { $subtotal_ht = 0; $subtotal_ttc = 0; - $sql = "SELECT p.societe as nom, p.firstname, p.lastname, date_format(p.datedon,'%Y-%m') as dm, sum(p.amount) as amount"; - $sql.= " FROM ".MAIN_DB_PREFIX."don as p"; - $sql.= " WHERE p.entity = ".$conf->entity; - if ($modecompta == 'CREANCES-DETTES') - $sql.= " AND fk_statut in (1,2)"; - else - $sql.= " AND fk_statut=2"; - $sql.= " GROUP BY p.societe, p.firstname, p.lastname, dm"; + if ($modecompta == 'CREANCES-DETTES') { + $sql = "SELECT p.societe as nom, p.firstname, p.lastname, date_format(p.datedon,'%Y-%m') as dm, sum(p.amount) as amount"; + $sql.= " FROM ".MAIN_DB_PREFIX."don as p"; + $sql.= " WHERE p.entity = ".$conf->entity; + $sql.= " AND fk_statut in (1,2)"; + } + else { + $sql = "SELECT p.societe as nom, p.firstname, p.lastname, date_format(p.datedon,'%Y-%m') as dm, sum(p.amount) as amount"; + $sql.= " FROM ".MAIN_DB_PREFIX."don as p"; + $sql.= " INNER JOIN ".MAIN_DB_PREFIX."payment_donation as pe ON pe.fk_donation = p.rowid"; + $sql.= " INNER JOIN ".MAIN_DB_PREFIX."c_paiement as c ON pe.fk_typepayment = c.id"; + $sql.= " WHERE p.entity = ".getEntity('donation',1); + $sql.= " AND fk_statut >= 2"; + } + $sql.= " GROUP BY p.societe, p.firstname, p.lastname, dm"; + dol_syslog("get donation payments"); $result=$db->query($sql); if ($result) diff --git a/htdocs/compta/salaries/card.php b/htdocs/compta/salaries/card.php index 4a8dc21ca1b..a7921e53859 100644 --- a/htdocs/compta/salaries/card.php +++ b/htdocs/compta/salaries/card.php @@ -1,8 +1,8 @@ +/* Copyright (C) 2011-2016 Alexandre Spangaro * Copyright (C) 2014 Laurent Destailleur * Copyright (C) 2015 Jean-François Ferry - * Copyright (C) 2015 Charlie BENKE + * Copyright (C) 2015 Charlie BENKE * * 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 @@ -73,8 +73,8 @@ if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel")) $dateep=dol_mktime(12,0,0, $_POST["dateepmonth"], $_POST["dateepday"], $_POST["dateepyear"]); if (empty($datev)) $datev=$datep; - $object->accountid=GETPOST("accountid","int"); - $object->fk_user=GETPOST("fk_user","int"); + $object->accountid=GETPOST("accountid") > 0 ? GETPOST("accountid","int") : 0; + $object->fk_user=GETPOST("fk_user") > 0 ? GETPOST("fk_user","int") : 0; $object->datev=$datev; $object->datep=$datep; $object->amount=price2num(GETPOST("amount")); @@ -82,7 +82,7 @@ if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel")) $object->datesp=$datesp; $object->dateep=$dateep; $object->note=GETPOST("note"); - $object->type_payment=GETPOST("paymenttype"); + $object->type_payment=GETPOST("paymenttype") > 0 ? GETPOST("paymenttype", "int") : 0; $object->num_payment=GETPOST("num_payment"); $object->fk_user_author=$user->id; @@ -113,7 +113,7 @@ if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel")) } if (! empty($conf->banque->enabled) && ! $object->accountid > 0) { - setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Account")), null, 'errors'); + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BankAccount")), null, 'errors'); $error++; } @@ -187,7 +187,7 @@ if ($action == 'delete') * View */ -llxHeader(); +llxHeader("",$langs->trans("SalaryPayment")); $form = new Form($db); @@ -282,7 +282,7 @@ if ($action == 'create') if (! empty($conf->banque->enabled)) { print ''; } @@ -339,7 +339,7 @@ if ($id) $linkback = ''.$langs->trans("BackToList").''; print ""; - print ''; @@ -415,7 +415,7 @@ if ($id) } else { - print ''.$langs->trans("Delete").''; + print ''.$langs->trans("Delete").''; } print ""; } diff --git a/htdocs/compta/salaries/document.php b/htdocs/compta/salaries/document.php index 7f0bf49dc6d..9e48533846a 100644 --- a/htdocs/compta/salaries/document.php +++ b/htdocs/compta/salaries/document.php @@ -6,7 +6,7 @@ * Copyright (C) 2005 Simon TOSSER * Copyright (C) 2011-2012 Juanjo Menent * Copyright (C) 2013 Cédric Salvador - * Copyright (C) 2015 Alexandre Spangaro + * Copyright (C) 2015-2016 Alexandre Spangaro * * 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 @@ -81,7 +81,7 @@ include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php'; $form = new Form($db); -llxHeader("","",$langs->trans("SalaryPayment")); +llxHeader("",$langs->trans("SalaryPayment")); if ($object->id) @@ -107,7 +107,7 @@ if ($object->id) $linkback = ''.$langs->trans("BackToList").''; // Ref - print ''; diff --git a/htdocs/compta/salaries/index.php b/htdocs/compta/salaries/index.php index 98278ad374c..4de0e829538 100644 --- a/htdocs/compta/salaries/index.php +++ b/htdocs/compta/salaries/index.php @@ -1,7 +1,7 @@ - * Copyright (C) 2015-2016 Laurent Destailleur - * Copyright (C) 2015 Jean-François Ferry +/* Copyright (C) 2011-2016 Alexandre Spangaro + * Copyright (C) 2015-2016 Laurent Destailleur + * Copyright (C) 2015 Jean-François Ferry * * 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 '
'.$langs->trans("Donation").'
'; - print fieldLabel('Account','selectaccountid',1).''; + print fieldLabel('BankAccount','selectaccountid',1).''; $form->select_comptes($_POST["accountid"],"accountid",0,'',1); // Affiche liste des comptes courant print '
'.$langs->trans("Ref").''; + print ''.$langs->trans("Ref").''; print $form->showrefnav($object, 'id', $linkback, 1, 'rowid', 'ref', ''); print '
'.$langs->trans("Ref").''; + print '
'.$langs->trans("Ref").''; print $form->showrefnav($object, 'id', $linkback, 1, 'rowid', 'ref', ''); print '
'; print ''; 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("BankAccount"),$_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 "\n"; @@ -159,12 +168,10 @@ if ($result) print ''; - // People + // Employee print ''; - // Current salary - print ''; // Label print ''; // Date @@ -173,6 +180,13 @@ if ($result) print ''; + // Account + if (! empty($conf->banque->enabled)) + { + print ''; + } // Amount print ''; @@ -200,17 +214,29 @@ if ($result) $salstatic->ref=$obj->rowid; // Ref print "\n"; - // User name + // Employee print "\n"; - // Current salary - print "\n"; // Label payment print "\n"; // Date payment print '\n"; // Type print ''; - // Amount + // Account + if (! empty($conf->banque->enabled)) + { + print ''; + } + // Amount print ""; print ""; print "\n"; @@ -219,9 +245,11 @@ if ($result) $i++; } - - print ''; - print '"; + + $colspan=5; + if (! empty($conf->banque->enabled)) $colspan++; + print ''; + print '"; print ""; print "
'; print ''; print ''; print ''; print ' '; $form->select_types_paiements($typeid,'typeid','',0,0,1,16); print ''; + $form->select_comptes($search_account,'search_account',0,'',1); + print '".$salstatic->getNomUrl(1)."".$userstatic->getNomUrl(1)."".($obj->salary?price($obj->salary):'')."".dol_trunc($obj->label,40)."'.dol_print_date($db->jdate($obj->datep),'day')."'.$langs->trans("PaymentTypeShort".$obj->payment_code).' '.$obj->num_payment.''; + 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 '".price($obj->amount)."
'.$langs->trans("Total").''.price($total,0,$outputlangs,1,-1,-1,$conf->currency)."
'.$langs->trans("Total").''.price($total)."
"; diff --git a/htdocs/compta/salaries/info.php b/htdocs/compta/salaries/info.php index cbc0c1742ff..429efc27a33 100644 --- a/htdocs/compta/salaries/info.php +++ b/htdocs/compta/salaries/info.php @@ -44,9 +44,7 @@ $result = restrictedArea($user, 'salaries', '', '', ''); * View */ -$help_url='EN:Module_Salaries|FR:Module Fiche de paie|ES:Módulo Salarios'; -llxHeader("",$langs->trans("Salaries"),$help_url); - +llxHeader("",$langs->trans("SalaryPayment")); $salpayment = new PaymentSalary($db); $result = $salpayment->fetch($id); diff --git a/htdocs/compta/sociales/charges.php b/htdocs/compta/sociales/card.php similarity index 79% rename from htdocs/compta/sociales/charges.php rename to htdocs/compta/sociales/card.php index 6e7c9ad93c2..8c21bf32ceb 100644 --- a/htdocs/compta/sociales/charges.php +++ b/htdocs/compta/sociales/card.php @@ -1,6 +1,7 @@ * Copyright (C) 2005-2013 Regis Houssin + * Copyright (C) 2016 Frédéric France * * 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 @@ -17,7 +18,7 @@ */ /** - * \file htdocs/compta/sociales/charges.php + * \file htdocs/compta/sociales/card.php * \ingroup tax * \brief Social contribution card page */ @@ -71,6 +72,23 @@ if ($action == 'reopen' && $user->rights->tax->charges->creer) { } } +// payment mode +if ($action == 'setmode' && $user->rights->tax->charges->creer) { + $object->fetch($id); + $result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int')); + if ($result < 0) + setEventMessages($object->error, $object->errors, 'errors'); +} + +// bank account +if ($action == 'setbankaccount' && $user->rights->tax->charges->creer) { + $object->fetch($id); + $result=$object->setBankAccount(GETPOST('fk_account', 'int')); + if ($result < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + } +} + // Delete social contribution if ($action == 'confirm_delete' && $confirm == 'yes') { @@ -127,6 +145,8 @@ if ($action == 'add' && $user->rights->tax->charges->creer) $object->date_ech=$dateech; $object->periode=$dateperiod; $object->amount=$amount; + $object->mode_reglement_id = GETPOST('mode_reglement_id'); + $object->fk_account = GETPOST('fk_account', 'int'); $id=$object->create($user); if ($id <= 0) @@ -290,6 +310,17 @@ if ($action == 'create') print ''; print ''; print ''; + // Payment Mode + print '' . $langs->trans('PaymentMode') . ''; + $form->select_types_paiements($mode_reglement_id, 'mode_reglement_id'); + print ''; + // Bank Account + if (! empty($conf->banque->enabled)) + { + print '' . $langs->trans('BankAccount') . ''; + $form->select_comptes($fk_account, 'fk_account', 0, '', 1); + print ''; + } // Date due print ''; print ''; @@ -313,7 +344,7 @@ if ($action == 'create') /* *************************************************************************** */ /* */ -/* Mode fiche */ +/* Card Mode */ /* */ /* *************************************************************************** */ if ($id > 0) @@ -351,7 +382,7 @@ if ($id > 0) if ($action == 'edit') { - print "
id&action=update\" method=\"post\">"; + print "id&action=update\" method=\"post\">"; print ''; } @@ -382,7 +413,8 @@ if ($id > 0) // Type print "".$langs->trans("Type")."".$object->type_libelle.""; - $rowspan=5; + $rowspan=6; + if (! empty($conf->banque->enabled)) $rowspan++; print ''; /* @@ -422,8 +454,8 @@ if ($id > 0) print ""; print ''.img_object($langs->trans("Payment"),"payment").' '.$objp->rowid.''; print ''.dol_print_date($db->jdate($objp->dp),'day')."\n"; - $labeltype=$langs->trans("PaymentType".$objp->type_code)!=("PaymentType".$objp->type_code)?$langs->trans("PaymentType".$objp->type_code):$objp->paiement_type; - print "".$labeltype.' '.$objp->num_paiement."\n"; + $labeltype=$langs->trans("PaymentType".$objp->type_code)!=("PaymentType".$objp->type_code)?$langs->trans("PaymentType".$objp->type_code):$objp->paiement_type; + print "".$labeltype.' '.$objp->num_paiement."\n"; print ''.price($objp->amount)." ".$langs->trans("Currency".$conf->currency)."\n"; print ""; $totalpaye += $objp->amount; @@ -432,12 +464,12 @@ if ($id > 0) if ($object->paye == 0) { - print "".$langs->trans("AlreadyPaid")." :".price($totalpaye)." ".$langs->trans("Currency".$conf->currency)."\n"; - print "".$langs->trans("AmountExpected")." :".price($object->amount)." ".$langs->trans("Currency".$conf->currency)."\n"; + print "".$langs->trans("AlreadyPaid")." :".price($totalpaye)." ".$langs->trans("Currency".$conf->currency)."\n"; + print "".$langs->trans("AmountExpected")." :".price($object->amount)." ".$langs->trans("Currency".$conf->currency)."\n"; $resteapayer = $object->amount - $totalpaye; - print "".$langs->trans("RemainderToPay")." :"; + print "".$langs->trans("RemainderToPay")." :"; print "".price($resteapayer)." ".$langs->trans("Currency".$conf->currency)."\n"; } print ""; @@ -486,6 +518,42 @@ if ($id > 0) print ''.$langs->trans("AmountTTC").''.price($object->amount,0,$outputlangs,1,-1,-1,$conf->currency).''; } + // Mode of payment + print ''; + print ''; + if ($action != 'editmode') + print ''; + print '
'; + print $langs->trans('PaymentMode'); + print 'id . '">' . img_edit($langs->trans('SetMode'), 1) . '
'; + print ''; + if ($action == 'editmode') { + $form->form_modes_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->mode_reglement_id, 'mode_reglement_id'); + } else { + $form->form_modes_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->mode_reglement_id, 'none'); + } + print ''; + + // Bank Account + if (! empty($conf->banque->enabled)) + { + print ''; + print ''; + print '
'; + print $langs->trans('BankAccount'); + print ''; + if ($action != 'editbankaccount' && $user->rights->tax->charges->creer) + print 'id.'">'.img_edit($langs->trans('SetBankAccount'),1).'
'; + print ''; + if ($action == 'editbankaccount') { + $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1); + } else { + $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none'); + } + print ''; + print ''; + } + // Status print ''.$langs->trans("Status").''.$object->getLibStatut(4, $totalpaye).''; @@ -500,7 +568,7 @@ if ($id > 0) print ''; print '   '; print ''; - print ''; } if ($action == 'edit') print "
\n"; @@ -517,13 +585,13 @@ if ($id > 0) // Reopen if ($object->paye && $user->rights->tax->charges->creer) { - print "id&action=reopen\">".$langs->trans("ReOpen").""; + print "id&action=reopen\">".$langs->trans("ReOpen").""; } // Edit if ($object->paye == 0 && $user->rights->tax->charges->creer) { - print "id&action=edit\">".$langs->trans("Modify").""; + print "id&action=edit\">".$langs->trans("Modify").""; } // Emit payment @@ -535,19 +603,19 @@ if ($id > 0) // Classify 'paid' if ($object->paye == 0 && round($resteapayer) <=0 && $user->rights->tax->charges->creer) { - print "id&action=paid\">".$langs->trans("ClassifyPaid").""; + print "id&action=paid\">".$langs->trans("ClassifyPaid").""; } // Clone if ($user->rights->tax->charges->creer) { - print "id&action=clone\">".$langs->trans("ToClone").""; + print "id&action=clone\">".$langs->trans("ToClone").""; } // Delete if ($user->rights->tax->charges->supprimer) { - print "id&action=delete\">".$langs->trans("Delete").""; + print "id&action=delete\">".$langs->trans("Delete").""; } print "
"; diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php index e5653ba2ee3..ca9af965758 100644 --- a/htdocs/compta/sociales/class/chargesociales.class.php +++ b/htdocs/compta/sociales/class/chargesociales.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2004-2007 Laurent Destailleur + * Copyright (C) 2016 Frédéric France * * 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 @@ -49,6 +50,7 @@ class ChargeSociales extends CommonObject var $date_creation; var $date_modification; var $date_validation; + var $fk_account; /** @@ -71,13 +73,16 @@ class ChargeSociales extends CommonObject */ function fetch($id, $ref='') { - $sql = "SELECT cs.rowid, cs.date_ech,"; - $sql.= " cs.libelle as lib, cs.fk_type, cs.amount, cs.paye, cs.periode, cs.import_key,"; - $sql.= " c.libelle"; - $sql.= " FROM ".MAIN_DB_PREFIX."chargesociales as cs, ".MAIN_DB_PREFIX."c_chargesociales as c"; - $sql.= " WHERE cs.fk_type = c.id"; - if ($ref) $sql.= " AND cs.rowid = ".$ref; - else $sql.= " AND cs.rowid = ".$id; + $sql = "SELECT cs.rowid, cs.date_ech"; + $sql.= ", cs.libelle as lib, cs.fk_type, cs.amount, cs.paye, cs.periode, cs.import_key"; + $sql.= ", cs.fk_account, cs.fk_mode_reglement"; + $sql.= ", c.libelle"; + $sql.= ', p.code as mode_reglement_code, p.libelle as mode_reglement_libelle'; + $sql.= " FROM ".MAIN_DB_PREFIX."chargesociales as cs"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_chargesociales as c ON cs.fk_type = c.id"; + $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON cs.fk_mode_reglement = p.id'; + if ($ref) $sql.= " WHERE cs.rowid = ".$ref; + else $sql.= " WHERE cs.rowid = ".$id; dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql=$this->db->query($sql); @@ -93,6 +98,10 @@ class ChargeSociales extends CommonObject $this->lib = $obj->lib; $this->type = $obj->fk_type; $this->type_libelle = $obj->libelle; + $this->fk_account = $obj->fk_account; + $this->mode_reglement_id = $obj->fk_mode_reglement; + $this->mode_reglement_code = $obj->mode_reglement_code; + $this->mode_reglement = $obj->mode_reglement_libelle; $this->amount = $obj->amount; $this->paye = $obj->paye; $this->periode = $this->db->jdate($obj->periode); @@ -155,8 +164,11 @@ class ChargeSociales extends CommonObject $this->db->begin(); - $sql = "INSERT INTO ".MAIN_DB_PREFIX."chargesociales (fk_type, libelle, date_ech, periode, amount, entity)"; - $sql.= " VALUES (".$this->type.",'".$this->db->escape($this->lib)."',"; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."chargesociales (fk_type, fk_account, fk_mode_reglement, libelle, date_ech, periode, amount, entity)"; + $sql.= " VALUES (".$this->type; + $sql.= ", ".($this->fk_account>0?$this->fk_account:'NULL'); + $sql.= ", ".($this->mode_reglement_id>0?"'".$this->mode_reglement_id."'":"NULL"); + $sql.= ", '".$this->db->escape($this->lib)."',"; $sql.= " '".$this->db->idate($this->date_ech)."','".$this->db->idate($this->periode)."',"; $sql.= " '".price2num($newamount)."',"; $sql.= " ".$conf->entity; @@ -216,7 +228,7 @@ class ChargeSociales extends CommonObject // Delete payments if (! $error) { - $sql = "DELETE FROM ".MAIN_DB_PREFIX."paiementcharge where fk_charge='".$this->id."'"; + $sql = "DELETE FROM ".MAIN_DB_PREFIX."paiementcharge WHERE fk_charge='".$this->id."'"; dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) @@ -228,7 +240,7 @@ class ChargeSociales extends CommonObject if (! $error) { - $sql = "DELETE FROM ".MAIN_DB_PREFIX."chargesociales where rowid='".$this->id."'"; + $sql = "DELETE FROM ".MAIN_DB_PREFIX."chargesociales WHERE rowid='".$this->id."'"; dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) @@ -437,7 +449,7 @@ class ChargeSociales extends CommonObject if (empty($this->ref)) $this->ref=$this->lib; $label = $langs->trans("ShowSocialContribution").': '.$this->ref; - $link = ''; + $link = ''; $linkend=''; if ($withpicto) $result.=($link.img_object($label, 'bill', 'class="classfortooltip"').$linkend.' '); diff --git a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php index e3bf17b3418..1d553831f99 100644 --- a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php +++ b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php @@ -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 { diff --git a/htdocs/compta/sociales/index.php b/htdocs/compta/sociales/index.php index b673a5064ed..fc106de2ad1 100644 --- a/htdocs/compta/sociales/index.php +++ b/htdocs/compta/sociales/index.php @@ -1,7 +1,8 @@ - * Copyright (C) 2004-2014 Laurent Destailleur + * Copyright (C) 2004-2016 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2016 Frédéric France * * 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 @@ -232,7 +233,7 @@ if ($resql) print ''.dol_trunc($obj->libelle,42).''; // Type - print ''.dol_trunc($obj->type_lib,16).''; + print ''.$obj->type_lib.''; // Date end period print ''; @@ -255,7 +256,7 @@ if ($resql) // Due date print ''.dol_print_date($db->jdate($obj->date_ech), 'day').''; - print ''.$chargesociale_static->LibStatut($obj->paye,5,$obj->alreadypayed).''; + print ''.$chargesociale_static->LibStatut($obj->paye,5,$obj->alreadypayed).''; print ''; diff --git a/htdocs/compta/sociales/payments.php b/htdocs/compta/sociales/payments.php new file mode 100644 index 00000000000..017bcb7686e --- /dev/null +++ b/htdocs/compta/sociales/payments.php @@ -0,0 +1,490 @@ + + * Copyright (C) 2004-2014 Laurent Destailleur + * Copyright (C) 2005-2010 Regis Houssin + * Copyright (C) 2011-2016 Alexandre Spangaro + * Copyright (C) 2011-2014 Juanjo Menent + * Copyright (C) 2015 Jean-François Ferry + * + * 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 . + */ + +/** + * \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 '
'; +if ($optioncss != '') print ''; +print ''; +print ''; +print ''; +print ''; +print ''; + +if ($mode != 'sconly') +{ + $center=($year?''.img_previous($langs->trans("Previous"), 'class="valignbottom"')." ".$langs->trans("Year").' '.$year.' '.img_next($langs->trans("Next"), 'class="valignbottom"')."":""); + 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").'
'; + print "
"; +} + +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 ''; + print ''; + 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 "\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 ""; + // Ref payment + $payment_sc_static->id=$obj->pid; + $payment_sc_static->ref=$obj->pid; + print '\n"; + // Date payment + print ''; + // Type payment + print ''; + // Label + print ''; + // Type + print ''; + // Date + $date=$obj->periode; + if (empty($date)) $date=$obj->date_ech; + print ''; + // Expected to pay + print ''; + // Paid + print ''; + print ''; + + $total = $total + $obj->total; + $totalnb = $totalnb + $obj->nb; + $totalpaye = $totalpaye + $obj->totalpaye; + $i++; + } + print ''; + print ''; // A total here has no sense + print ''; + print ''; + print ''; + print '"; + print ""; + } + else + { + dol_print_error($db); + } + print '
'.$payment_sc_static->getNomUrl(1)."'.dol_print_date($db->jdate($obj->datep),'day').''; + if ($obj->payment_code) print $langs->trans("PaymentTypeShort".$obj->payment_code).' '; + print $obj->num_payment.''; + $socialcontrib->id=$obj->rowid; + $socialcontrib->ref=$obj->libelle; + $socialcontrib->lib=$obj->libelle; + print $socialcontrib->getNomUrl(1,'20'); + print ''.$obj->lib.''.dol_print_date($date,'day').''.price($obj->total).''; + if ($obj->totalpaye) print price($obj->totalpaye); + print '
'.$langs->trans("Total").'   '.price($totalpaye)."
'; +} + +// VAT +if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) +{ + if (! $mode || $mode != 'sconly') + { + print "
"; + + $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 ''; + print ''; + 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 "\n"; + $var=1; + while ($i < $num) + { + $obj = $db->fetch_object($result); + + $total = $total + $obj->amount; + + $var=!$var; + print ""; + print ''."\n"; + + print "\n"; + + print '"; + + // Ref payment + $tva_static->id=$obj->rowid; + $tva_static->ref=$obj->rowid; + print '\n"; + + print '\n"; + print '"; + print "\n"; + + $i++; + } + print ''; + print ''; + print ''; + print ''; + print '"; + print ""; + + print "
'.dol_print_date($db->jdate($obj->dm),'day').'".$obj->label."'.price($obj->amount)."'.$tva_static->getNomUrl(1)."'.dol_print_date($db->jdate($obj->dm),'day')."'.price($obj->amount)."
'.$langs->trans("Total").''.price($total).'  '.price($total)."
"; + $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 "
"; + + $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 ''; + print ''; + 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 "\n"; + $var=1; + while ($i < $num) + { + $obj = $db->fetch_object($result); + + $total = $total + $obj->amount; + + $var=!$var; + print ""; + print ''."\n"; + + print "\n"; + + print '"; + + // Ref payment + $tva_static->id=$obj->rowid; + $tva_static->ref=$obj->rowid; + print '\n"; + + print '\n"; + print '"; + print "\n"; + + $i++; + } + print ''; + print '"; + print ''; + print ''; + print '"; + print ""; + + print "
'.dol_print_date($db->jdate($obj->dm),'day').'".$obj->label."'.price($obj->amount)."'.$tva_static->getNomUrl(1)."'.dol_print_date($db->jdate($obj->dp),'day')."'.price($obj->amount)."
'.$langs->trans("Total").''.price($total)."  '.price($total)."
"; + $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 "
"; + + 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 ''; + print ''; + 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 "\n"; + $var=1; + while ($i < $num) + { + $obj = $db->fetch_object($result); + + $total = $total + $obj->amount; + + $var=!$var; + print ""; + + print ''."\n"; + + print "\n"; + + print '"; + + // Ref payment + $sal_static->id=$obj->rowid; + $sal_static->ref=$obj->rowid; + print '\n"; + + print '\n"; + print '"; + print "\n"; + + $i++; + } + print ''; + print ''; // A total here has no sense + print ''; + print ''; + print '"; + print ""; + + print "
'.dol_print_date($db->jdate($obj->dateep),'day').'".$obj->label."'.($obj->salary?price($obj->salary):'')."'.$sal_static->getNomUrl(1)."'.dol_print_date($db->jdate($obj->datep),'day')."'.price($obj->amount)."
'.$langs->trans("Total").'  '.price($total)."
"; + $db->free($result); + + print "
"; + } + else + { + dol_print_error($db); + } + } +} + +print '
'; + + +llxFooter(); + +$db->close(); diff --git a/htdocs/compta/stats/cabyprodserv.php b/htdocs/compta/stats/cabyprodserv.php index 8e4aabd9339..befc9d5c208 100644 --- a/htdocs/compta/stats/cabyprodserv.php +++ b/htdocs/compta/stats/cabyprodserv.php @@ -178,6 +178,11 @@ if ($modecompta=="CREANCES-DETTES") { report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink,$tableparams,$calcmode); +if (! empty($conf->accounting->enabled)) +{ + print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1); +} + // SQL request $catotal=0; diff --git a/htdocs/compta/stats/cabyuser.php b/htdocs/compta/stats/cabyuser.php index cb8151cf33c..e5a4bc37f78 100644 --- a/htdocs/compta/stats/cabyuser.php +++ b/htdocs/compta/stats/cabyuser.php @@ -162,6 +162,11 @@ if (! empty($modecompta)) $moreparam['modecompta']=$modecompta; report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink,$moreparam,$calcmode); +if (! empty($conf->accounting->enabled)) +{ + print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1); +} + // Show array print '
'; diff --git a/htdocs/compta/stats/casoc.php b/htdocs/compta/stats/casoc.php index dade07fd0e3..e2e092b032f 100644 --- a/htdocs/compta/stats/casoc.php +++ b/htdocs/compta/stats/casoc.php @@ -27,13 +27,17 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; 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; @@ -61,6 +65,10 @@ if (! empty($conf->accounting->enabled)) $result=restrictedArea($user,'accountin // Date range $year=GETPOST("year"); $month=GETPOST("month"); +$search_societe = GETPOST("search_societe"); +$search_zip = GETPOST("search_zip"); +$search_town = GETPOST("search_town"); +$search_country = GETPOST("search_country"); $date_startyear = GETPOST("date_startyear"); $date_startmonth = GETPOST("date_startmonth"); $date_startday = GETPOST("date_startday"); @@ -128,6 +136,10 @@ $headerparams['q'] = $q; $tableparams = array(); $tableparams['search_categ'] = $selected_cat; +$tableparams['search_societe'] = $search_societe; +$tableparams['search_zip'] = $search_zip; +$tableparams['search_town'] = $search_town; +$tableparams['search_country'] = $search_country; $tableparams['subcat'] = ($subcat === true)?'yes':''; // Adding common parameters @@ -176,11 +188,16 @@ if ($modecompta=="CREANCES-DETTES") report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink,$tableparams,$calcmode); +if (! empty($conf->accounting->enabled)) +{ + print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1); +} + // Show Array $catotal=0; if ($modecompta == 'CREANCES-DETTES') { - $sql = "SELECT DISTINCT s.rowid as socid, s.nom as name,"; + $sql = "SELECT DISTINCT s.rowid as socid, s.nom as name, s.zip, s.town, s.fk_pays,"; $sql.= " sum(f.total) as amount, sum(f.total_ttc) as amount_ttc"; $sql.= " FROM ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."societe as s"; if ($selected_cat === -2) // Without any category @@ -216,7 +233,7 @@ if ($modecompta == 'CREANCES-DETTES') { * Liste des paiements (les anciens paiements ne sont pas vus par cette requete car, sur les * vieilles versions, ils n'etaient pas lies via paiement_facture. On les ajoute plus loin) */ - $sql = "SELECT s.rowid as socid, s.nom as name, sum(pf.amount) as amount_ttc"; + $sql = "SELECT s.rowid as socid, s.nom as name, s.zip, s.town, s.fk_pays, sum(pf.amount) as amount_ttc"; $sql.= " FROM ".MAIN_DB_PREFIX."facture as f"; $sql.= ", ".MAIN_DB_PREFIX."paiement_facture as pf"; $sql.= ", ".MAIN_DB_PREFIX."paiement as p"; @@ -246,9 +263,13 @@ if ($modecompta == 'CREANCES-DETTES') { $sql.= " AND cs.fk_categorie = c.rowid AND cs.fk_soc = s.rowid"; } } +if(!empty($search_societe)) $sql.= ' AND s.nom LIKE "%'.$search_societe.'%"'; +if(!empty($search_zip)) $sql.= ' AND s.zip LIKE "%'.$search_zip.'%"'; +if(!empty($search_town)) $sql.= ' AND s.town LIKE "%'.$search_town.'%"'; +if($search_country > 0) $sql.= ' AND s.fk_pays = '.$search_country.''; $sql.= " AND f.entity = ".$conf->entity; if ($socid) $sql.= " AND f.fk_soc = ".$socid; -$sql.= " GROUP BY s.rowid, s.nom"; +$sql.= " GROUP BY s.rowid, s.nom, s.zip, s.town, s.fk_pays"; $sql.= " ORDER BY s.rowid"; //echo $sql; @@ -262,6 +283,9 @@ if ($result) { $amount_ht[$obj->socid] = $obj->amount; $amount[$obj->socid] = $obj->amount_ttc; $name[$obj->socid] = $obj->name.' '.$obj->firstname; + $address_zip[$obj->socid] = $obj->zip; + $address_town[$obj->socid] = $obj->town; + $address_pays[$obj->socid] = getCountry($obj->fk_pays); $catotal_ht+=$obj->amount; $catotal+=$obj->amount_ttc; $i++; @@ -294,6 +318,9 @@ if ($modecompta != 'CREANCES-DETTES') { $obj = $db->fetch_object($result); $amount[$obj->rowid] += $obj->amount_ttc; $name[$obj->rowid] = $obj->name; + $address_zip[$obj->rowid] = $obj->zip; + $address_town[$obj->rowid] = $obj->town; + $address_pays[$obj->rowid] = getCountry($obj->fk_pays); $catotal+=$obj->amount_ttc; $i++; } @@ -323,7 +350,7 @@ if ($subcat) { print ' checked'; } print'>'; -print ''; +print ''; print ''; print ''; print ''; @@ -338,6 +365,33 @@ print_liste_field_titre( "", $sortfield,$sortorder ); +print_liste_field_titre( + $langs->trans("Zip"), + $_SERVER["PHP_SELF"], + "zip", + "", + $paramslink, + "", + $sortfield,$sortorder + ); +print_liste_field_titre( + $langs->trans("Town"), + $_SERVER["PHP_SELF"], + "town", + "", + $paramslink, + "", + $sortfield,$sortorder + ); +print_liste_field_titre( + $langs->trans("Country"), + $_SERVER["PHP_SELF"], + "country", + "", + $paramslink, + "", + $sortfield,$sortorder + ); if ($modecompta == 'CREANCES-DETTES') { print_liste_field_titre( $langs->trans('AmountHT'), @@ -381,6 +435,27 @@ print_liste_field_titre( 'align="center" width="20%"' ); print "\n"; + +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print $form->select_country($search_country, 'search_country'); +//print ''; +print ''; +print ' '; +print ' '; +print ' '; +print ' '; +print ''; + $var=true; if (count($amount)) { @@ -410,6 +485,30 @@ if (count($amount)) { arsort($amount); $arrayforsort=$amount; } + if ($sortfield == 'zip' && $sortorder == 'asc') { + asort($address_zip); + $arrayforsort=$address_zip; + } + if ($sortfield == 'zip' && $sortorder == 'desc') { + arsort($address_zip); + $arrayforsort=$address_zip; + } + if ($sortfield == 'town' && $sortorder == 'asc') { + asort($address_town); + $arrayforsort=$address_town; + } + if ($sortfield == 'town' && $sortorder == 'desc') { + arsort($address_town); + $arrayforsort=$address_town; + } + if ($sortfield == 'country' && $sortorder == 'asc') { + asort($address_pays); + $arrayforsort=$address_town; + } + if ($sortfield == 'country' && $sortorder == 'desc') { + arsort($address_pays); + $arrayforsort=$address_town; + } foreach($arrayforsort as $key=>$value) { $var=!$var; @@ -427,6 +526,18 @@ if (count($amount)) { } print "".$linkname."\n"; + print ''; + print $address_zip[$key]; + print ''; + + print ''; + print $address_town[$key]; + print ''; + + print ''; + print $address_pays[$key]; + print ''; + // Amount w/o VAT print ''; if ($modecompta != 'CREANCES-DETTES') { @@ -486,6 +597,9 @@ if (count($amount)) { // Total print ''; print ''.$langs->trans("Total").''; + print ' '; + print ' '; + print ' '; if ($modecompta != 'CREANCES-DETTES') { print ''; } else { diff --git a/htdocs/compta/stats/index.php b/htdocs/compta/stats/index.php index eb9a425c2af..1a343cbcb0b 100644 --- a/htdocs/compta/stats/index.php +++ b/htdocs/compta/stats/index.php @@ -85,6 +85,11 @@ $moreparam=array(); if (! empty($modecompta)) $moreparam['modecompta']=$modecompta; report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink,$moreparam,$calcmode); +if (! empty($conf->accounting->enabled)) +{ + print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1); +} + if ($modecompta == 'CREANCES-DETTES') { @@ -135,7 +140,7 @@ else { dol_print_error($db); } -// On ajoute les paiements anciennes version, non lies par paiement_facture +// On ajoute les paiements anciennes version, non lies par paiement_facture (very old versions) if ($modecompta != 'CREANCES-DETTES') { $sql = "SELECT date_format(p.datep,'%Y-%m') as dm, sum(p.amount) as amount_ttc"; diff --git a/htdocs/compta/tva/card.php b/htdocs/compta/tva/card.php index eb887054151..17bcd80757c 100644 --- a/htdocs/compta/tva/card.php +++ b/htdocs/compta/tva/card.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2013 Laurent Destailleur + * Copyright (C) 2004-2016 Laurent Destailleur * Copyright (C) 2005-2013 Regis Houssin * Copyright (C) 2015 Alexandre Spangaro * @@ -266,19 +266,19 @@ if ($action == 'create') print ''.$langs->trans("Account").''; $form->select_comptes($_POST["accountid"],"accountid",0,"courant=1",1); // Affiche liste des comptes courant print ''; + } - // Type payment - print ''.$langs->trans("PaymentMode").''; - $form->select_types_paiements(GETPOST("type_payment"), "type_payment"); - print "\n"; - print ""; - - // Number - print ''.$langs->trans('Numero'); - print ' ('.$langs->trans("ChequeOrTransferNumber").')'; - print ''."\n"; - } - + // Type payment + print ''.$langs->trans("PaymentMode").''; + $form->select_types_paiements(GETPOST("type_payment"), "type_payment"); + print "\n"; + print ""; + + // Number + print ''.$langs->trans('Numero'); + print ' ('.$langs->trans("ChequeOrTransferNumber").')'; + print ''."\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 "
\n"; if ($object->rappro == 0) { @@ -381,7 +381,7 @@ if ($id) } else { - print ''.$langs->trans("Delete").''; + print ''.$langs->trans("Delete").''; } print "
"; } diff --git a/htdocs/compta/tva/index.php b/htdocs/compta/tva/index.php index f6308a3790d..30d9655acc8 100644 --- a/htdocs/compta/tva/index.php +++ b/htdocs/compta/tva/index.php @@ -123,17 +123,9 @@ print $langs->trans("VATReportBuildWithOptionDefinedInModule").'
'; print '('.$langs->trans("TaxModuleSetupToModifyRules",DOL_URL_ROOT.'/admin/taxes.php').')
'; print '
'; -print ''; -print ''; +print '
'; -print '
'; -print '
'; -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",'','').')'; -print ''; -print load_fiche_titre($langs->trans("VATPaid"), '', ''); -print '
'; +print load_fiche_titre($langs->trans("VATSummary"), '', ''); print ''; print ''; @@ -223,18 +215,12 @@ print '\n"; print ''; -/*} - else - { - print ''; - print ''; - }*/ - print '
'.$langs->trans("To print " 
'.$langs->trans("FeatureNotYetAvailable").'
'.$langs->trans("FeatureIsSupportedInInOutModeOnly").'
'; -print '
'; +print '
'; + +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 "
"; - -print ''; -print ''; +print '
'; llxFooter(); $db->close(); diff --git a/htdocs/compta/tva/reglement.php b/htdocs/compta/tva/reglement.php index 5484be65a32..d5bcbeeb06a 100644 --- a/htdocs/compta/tva/reglement.php +++ b/htdocs/compta/tva/reglement.php @@ -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 "\n"; print ''; @@ -172,8 +182,14 @@ if ($result) print ''; $form->select_types_paiements($typeid,'typeid','',0,0,1,16); print ''; + // Account + if (! empty($conf->banque->enabled)) + { + print ''; + $form->select_comptes($search_account,'search_account',0,'',1); + print ''; + } print ''; - print ''; $searchpitco=$form->showFilterAndCheckAddButtons(0); print $searchpitco; @@ -204,15 +220,32 @@ if ($result) print ''.dol_print_date($db->jdate($obj->dp),'day')."\n"; // Type print $type; + // Account + if (! empty($conf->banque->enabled)) + { + print ''; + 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 ''; + } // Amount $total = $total + $obj->amount; print "".price($obj->amount).""; - print " "; + print " "; print "\n"; $i++; } - print ''.$langs->trans("Total").''; + + $colspan=5; + if (! empty($conf->banque->enabled)) $colspan++; + print ''.$langs->trans("Total").''; print "".price($total).""; print " "; diff --git a/htdocs/compta/ventilation/card.php b/htdocs/compta/ventilation/card.php deleted file mode 100644 index 59ed7fe9cde..00000000000 --- a/htdocs/compta/ventilation/card.php +++ /dev/null @@ -1,164 +0,0 @@ - - * Copyright (C) 2005-2006 Laurent Destailleur - * - * 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 . - * - */ - -/** - * \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�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 ''."\n"; - print ''; - print ''; - } - - - print load_fiche_titre("Ventilation"); - - print ''; - - // Ref facture - print ''; - $facture_static->ref=$objp->facnumber; - $facture_static->id=$objp->facid; - print ''; - print ''; - - print ''; - print ''; - print ''; - - if($objp->fk_code_ventilation == 0) - { - print ''; - } - print '
'.$langs->trans("Invoice").''.$facture_static->getNomUrl(1).'
Ligne'.nl2br($objp->description).'
Ventiler dans le compte :'; - - if($objp->fk_code_ventilation == 0) - { - print $form->selectarray("codeventil",$cgs, $objp->fk_code_ventilation); - } - else - { - print $cgs[$objp->fk_code_ventilation]; - } - - print '
 
'; - print ''; - } - else - { - print "Error"; - } - } - else - { - print "Error"; - } -} -else -{ - print "Error ID incorrect"; -} - -llxFooter(); -$db->close(); diff --git a/htdocs/compta/ventilation/fournisseur/card.php b/htdocs/compta/ventilation/fournisseur/card.php deleted file mode 100644 index dc376de7c06..00000000000 --- a/htdocs/compta/ventilation/fournisseur/card.php +++ /dev/null @@ -1,148 +0,0 @@ - - * Copyright (C) 2005 Simon TOSSER - * - * 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 . - * - */ - -/** - * \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 '
'."\n"; - print ''; - print ''; - } - - - print load_fiche_titre("Ventilation"); - - print ''; - print ''; - print ''; - - print ''; - print ''; - print ''; - - if($objp->fk_code_ventilation == 0) - { - print ''; - } - print '
Facture'.$objp->facnumber.'
Ligne'.stripslashes(nl2br($objp->description)).'
Ventiler dans le compte :'; - - if($objp->fk_code_ventilation == 0) - { - print $form->selectarray("codeventil",$cgs, $objp->fk_code_ventilation); - } - else - { - print $cgs[$objp->fk_code_ventilation]; - } - - print '
 
'; - print '
'; - } - else - { - print "Error"; - } - } - else - { - print "Error"; - } -} -else -{ - print "Error ID incorrect"; -} - -llxFooter(); -$db->close(); diff --git a/htdocs/compta/ventilation/fournisseur/list.php b/htdocs/compta/ventilation/fournisseur/list.php deleted file mode 100644 index 20ca396aa30..00000000000 --- a/htdocs/compta/ventilation/fournisseur/list.php +++ /dev/null @@ -1,105 +0,0 @@ - - * Copyright (C) 2004 Eric Seigne - * Copyright (C) 2004 Laurent Destailleur - * - * 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 . - * - */ - - -/** - * \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 ''; - print ''; - print ''; - print ''; - print ''; - print "\n"; - - $var=True; - while ($i < min($num_lignes, $limit)) - { - $objp = $db->fetch_object($result); - $var=!$var; - print ""; - - print ''; - print ''; - - print ''; - - print ''; - - print ""; - $i++; - } - -print "
Facture'.$langs->trans("Description").'  
'.$objp->facnumber.''.stripslashes(nl2br($objp->description)).''; - print price($objp->price); - print ''; - print img_edit(); - print '
"; - - - -} -else -{ - print $db->error(); -} - -llxFooter(); -$db->close(); diff --git a/htdocs/compta/ventilation/list.php b/htdocs/compta/ventilation/list.php deleted file mode 100644 index fc022cade0d..00000000000 --- a/htdocs/compta/ventilation/list.php +++ /dev/null @@ -1,129 +0,0 @@ - - * Copyright (C) 2004 Eric Seigne - * Copyright (C) 2004-2006 Laurent Destailleur - * - * 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 . - * - */ - - -/** - * \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 ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print "\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 ""; - - // Ref facture - $facture_static->ref=$objp->facnumber; - $facture_static->id=$objp->facid; - print ''; - - // Ref produit - $product_static->ref=$objp->product_ref; - $product_static->id=$objp->product_id; - $product_static->type=$objp->type; - print ''; - - print ''; - print ''; - - print ''; - - print ''; - - print ""; - $i++; - } - print "
'.$langs->trans("Invoice").''.$langs->trans("Ref").''.$langs->trans("Label").''.$langs->trans("Description").''.$langs->trans("Montant").' 
'.$facture_static->getNomUrl(1).''; - if ($product_static->id) print $product_static->getNomUrl(1); - else print ' '; - print ''.dol_trunc($objp->product_label,24).''.nl2br(dol_trunc($objp->description,32)).''; - print price($objp->price); - print ''; - print img_edit(); - print '
"; -} -else -{ - print $db->error(); -} - -llxFooter(); -$db->close(); diff --git a/htdocs/conf/conf.php.example b/htdocs/conf/conf.php.example index 3d6db94d801..aab5290a663 100644 --- a/htdocs/conf/conf.php.example +++ b/htdocs/conf/conf.php.example @@ -125,9 +125,8 @@ $dolibarr_main_db_pass=''; // This parameter contains the name of the driver used to access your // Dolibarr database. // Default value: none -// Possible values: mysql, mysqli, pgsql +// Possible values: mysqli, pgsql // Examples: -// $dolibarr_main_db_type='mysql'; // $dolibarr_main_db_type='mysqli'; // $dolibarr_main_db_type='pgsql'; // @@ -220,6 +219,25 @@ $dolibarr_main_authentication='dolibarr'; // $dolibarr_main_force_https='0'; +// dolibarr_main_prod +// When this parameter is defined, all errors messages are not reported. +// This feature exists for production usage to avoid to give any information to hackers. +// Default value: 0 +// Possible values: 0 or 1 +// Examples: +// $dolibarr_main_prod='0'; +// +$dolibarr_main_prod='0'; + +// $dolibarr_main_restrict_os_commands +// To restrict commands you can execute by the backup feature, enter allowed command here. +// Note: If you can, defining permission on OS linux (using SELinux for example) may be a better choice. +// Default value: 'mysqldump, mysql, pg_dump, pgrestore' +// Examples: +// $dolibarr_main_restrict_os_commands='mysqldump, /usr/local/bin/otherdumptool'; +// +$dolibarr_main_restrict_os_commands='mysqldump, mysql, pg_dump, pgrestore'; + // dolibarr_nocsrfcheck // This parameter can be used to disable CSRF protection. // This might be required if you access Dolibarr behind a proxy that make @@ -231,15 +249,11 @@ $dolibarr_main_force_https='0'; // $dolibarr_nocsrfcheck='0'; -// dolibarr_main_prod -// When this parameter is defined, all errors messages are not reported. -// This feature exists for production usage to avoid to give any information to hackers. -// Default value: 0 -// Possible values: 0 or 1 +// dolibarr_mailing_limit_sendbyweb +// Can set a limit for mailing send by web. Can be used for a restricted mode. +// Default value: 0 (use database value if exist) // Examples: -// $dolibarr_main_prod='0'; -// -$dolibarr_main_prod='0'; +// $dolibarr_mailing_limit_sendbyweb='0'; @@ -251,8 +265,6 @@ $dolibarr_main_prod='0'; // This parameter contains prefix of Dolibarr database. 'llx_' if not defined. // Examples: // $dolibarr_main_db_prefix='llx_'; -// -$dolibarr_main_db_prefix=''; // dolibarr_main_limit_users // Can set a limit on the number of users it will be possible to create @@ -261,12 +273,6 @@ $dolibarr_main_db_prefix=''; // Examples: // $dolibarr_main_limit_users='0'; -// dolibarr_mailing_limit_sendbyweb -// Can set a limit for mailing send by web. Can be used for a restricted mode. -// Default value: 0 (use database value if exist) -// Examples: -// $dolibarr_mailing_limit_sendbyweb='0'; - // dolibarr_strict_mode // Set this to 1 to enable the PHP strict mode. For dev environment only. // Default value: 0 (use database value if exist) diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index a2232358a99..23242559f1f 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -5,7 +5,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2007 Franky Van Liedekerke * Copyright (C) 2013 Florian Henry - * Copyright (C) 2013-2015 Alexandre Spangaro + * Copyright (C) 2013-2016 Alexandre Spangaro * Copyright (C) 2014 Juanjo Menent * Copyright (C) 2015 Jean-François Ferry * @@ -54,7 +54,6 @@ $confirm = GETPOST('confirm','alpha'); $backtopage = GETPOST('backtopage','alpha'); $id = GETPOST('id','int'); $socid = GETPOST('socid','int'); -if ($user->societe_id) $socid=$user->societe_id; $object = new Contact($db); $extrafields = new ExtraFields($db); @@ -74,6 +73,7 @@ if (! empty($canvas)) } // Security check +if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'contact', $id, 'socpeople&societe', '', '', 'rowid', $objcanvas); // If we create a contact with no company (shared contacts), no check on write permission // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array @@ -529,10 +529,10 @@ else // Name - print ''; - print 'lastname).'" autofocus="autofocus">'; - print ''; - print 'firstname).'">'; + print ''; + print 'lastname).'" autofocus="autofocus">'; + print ''; + print 'firstname).'">'; // Company if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) @@ -548,13 +548,13 @@ else } else { print ''; - print $form->select_company($socid,'socid','',1); + print $form->select_company($socid,'socid','','SelectThirdParty'); print ''; } } // Civility - print ''; + print ''; print $formcompany->select_civility(GETPOST("civility_id",'alpha')?GETPOST("civility_id",'alpha'):$object->civility_id); print ''; @@ -783,10 +783,10 @@ else } // Lastname - print ''; - print 'lastname).'" autofocus="autofocus">'; - print ''; - print 'firstname).'">'; + print ''; + print 'lastname).'" autofocus="autofocus">'; + print ''; + print 'firstname).'">'; // Company if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) @@ -890,7 +890,7 @@ else print $form->selectarray('priv',$selectarray,$object->priv,0); print ''; - // Note Public + // Note Public print ''; $doleditor = new DolEditor('note_public', $object->note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70); print $doleditor->Create(1); @@ -902,9 +902,9 @@ else print $doleditor->Create(1); print ''; - // Statut + // Status print ''.$langs->trans("Status").''; - print ''; + print ''; print $object->getLibStatut(4); print ''; @@ -1058,7 +1058,7 @@ else // Company if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) { - print ''.$langs->trans("ThirdParty").''; + print ''.$langs->trans("ThirdParty").''; if ($object->socid > 0) { $objsoc->fetch($object->socid); @@ -1074,7 +1074,7 @@ else print ''; // Civility - print ''.$langs->trans("UserTitle").''; + print ''.$langs->trans("UserTitle").''; print $object->getCivilityLabel(); print ''; @@ -1122,7 +1122,7 @@ else // Categories if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire)) { - print '' . $langs->trans( "Categories" ) . ''; + print '' . $langs->trans("Categories") . ''; print ''; print $form->showCategories( $object->id, 'contact', 1 ); print ''; @@ -1141,7 +1141,7 @@ else if (! empty($conf->propal->enabled)) { - print ''.$langs->trans("ContactForProposals").''; + print ''.$langs->trans("ContactForProposals").''; print $object->ref_propal?$object->ref_propal:$langs->trans("NoContactForAnyProposal"); print ''; } diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 259918c5aa9..4e045ccd449 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -41,7 +41,8 @@ class Contact extends CommonObject public $table_element='socpeople'; protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe - var $civility_id; // In fact we store civility_code + var $civility_id; // In fact we store civility_code + var $civility_code; var $address; var $zip; var $town; @@ -216,9 +217,9 @@ class Contact extends CommonObject } } - if (! $error) + if (! $error) { - $result=$this->update_perso($this->id, $user); + $result=$this->update_perso($this->id, $user, 1); // TODO Remove function update_perso, should be same than update if ($result < 0) { $error++; @@ -226,7 +227,7 @@ class Contact extends CommonObject } } - if (! $error) + if (! $error) { // Call trigger $result=$this->call_trigger('CONTACT_CREATE',$user); @@ -474,13 +475,16 @@ class Contact extends CommonObject * * @param int $id Id of contact * @param User $user User asking to change alert or birthday + * @param int $notrigger 0=no, 1=yes * @return int <0 if KO, >=0 if OK */ - function update_perso($id, $user=null) + function update_perso($id, $user=null, $notrigger=0) { $error=0; $result=false; + $this->db->begin(); + // Mis a jour contact $sql = "UPDATE ".MAIN_DB_PREFIX."socpeople SET"; $sql.= " birthday=".($this->birthday ? "'".$this->db->idate($this->birthday)."'" : "null"); @@ -531,7 +535,25 @@ class Contact extends CommonObject } } - return $result; + if (! $error && ! $notrigger) + { + // Call trigger + $result=$this->call_trigger('CONTACT_MODIFY',$user); + if ($result < 0) { $error++; } + // End call triggers + } + + if (! $error) + { + $this->db->commit(); + return 1; + } + else + { + dol_syslog(get_class($this)."::update Error ".$this->error,LOG_ERR); + $this->db->rollback(); + return -$error; + } } @@ -589,6 +611,7 @@ class Contact extends CommonObject $this->ref = $obj->rowid; $this->ref_ext = $obj->ref_ext; $this->civility_id = $obj->civility_id; + $this->civility_code = $obj->civility_id; $this->lastname = $obj->lastname; $this->firstname = $obj->firstname; $this->address = $obj->address; @@ -636,11 +659,7 @@ class Contact extends CommonObject $this->import_key = $obj->import_key; // Define gender according to civility - if(in_array($this->civility_id, array('MR'))) { - $this->gender = 'man'; - } else if(in_array($this->civility_id, array('MME','MLE'))) { - $this->gender = 'woman'; - } + $this->setGenderFromCivility(); // Search Dolibarr user linked to this contact $sql = "SELECT u.rowid "; @@ -712,6 +731,21 @@ class Contact extends CommonObject } + /** + * Set property ->gender from property ->civility_id + * + * @return void + */ + function setGenderFromCivility() + { + unset($this->gender); + if (in_array($this->civility_id, array('MR'))) { + $this->gender = 'man'; + } else if(in_array($this->civility_id, array('MME','MLE'))) { + $this->gender = 'woman'; + } + } + /** * Load number of elements the contact is used as a link for * ref_facturation @@ -957,39 +991,53 @@ class Contact extends CommonObject */ function getNomUrl($withpicto=0,$option='',$maxlen=0,$moreparam='') { - global $conf, $langs; + global $conf, $langs, $hookmanager; $result=''; - $label = '' . $langs->trans("ShowContact") . ''; - $label.= '
' . $langs->trans("Name") . ': '.$this->getFullName($langs); - //if ($this->civility_id) $label.= '
' . $langs->trans("Civility") . ': '.$this->civility_id; // TODO Translate cibilty_id code - if (! empty($this->poste)) $label.= '
' . $langs->trans("Poste") . ': '.$this->poste; - $label.= '
' . $langs->trans("EMail") . ': '.$this->email; - $phonelist=array(); - if ($this->phone_pro) $phonelist[]=$this->phone_pro; - if ($this->phone_mobile) $phonelist[]=$this->phone_mobile; - if ($this->phone_perso) $phonelist[]=$this->phone_perso; - $label.= '
' . $langs->trans("Phone") . ': '.join(', ',$phonelist); - $label.= '
' . $langs->trans("Address") . ': '.dol_format_address($this, 1, ' ', $langs); + $label = '' . $langs->trans("ShowContact") . ''; + $label.= '
' . $langs->trans("Name") . ': '.$this->getFullName($langs); + //if ($this->civility_id) $label.= '
' . $langs->trans("Civility") . ': '.$this->civility_id; // TODO Translate cibilty_id code + if (! empty($this->poste)) $label.= '
' . $langs->trans("Poste") . ': '.$this->poste; + $label.= '
' . $langs->trans("EMail") . ': '.$this->email; + $phonelist=array(); + if ($this->phone_pro) $phonelist[]=$this->phone_pro; + if ($this->phone_mobile) $phonelist[]=$this->phone_mobile; + if ($this->phone_perso) $phonelist[]=$this->phone_perso; + $label.= '
' . $langs->trans("Phone") . ': '.join(', ',$phonelist); + $label.= '
' . $langs->trans("Address") . ': '.dol_format_address($this, 1, ' ', $langs); + + $link = 'global->MAIN_OPTIMIZEFORTEXTBROWSER)) + { + $label=$langs->trans("ShowContact"); + $linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"'; + } + $linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose.= ' class="classfortooltip">'; - $link = 'global->MAIN_OPTIMIZEFORTEXTBROWSER)) - { - $label=$langs->trans("ShowContact"); - $link.=' alt="'.dol_escape_htmltag($label, 1).'"'; - } - $link.= ' title="'.dol_escape_htmltag($label, 1).'"'; - $link.= ' class="classfortooltip">'; + if (! is_object($hookmanager)) + { + include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; + $hookmanager=new HookManager($this->db); + } + $hookmanager->initHooks(array('contactdao')); + $parameters=array('id'=>$this->id); + $reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks + if ($reshook > 0) $linkclose = $hookmanager->resPrint; + + $link.=$linkclose; + $linkend=''; - + if ($option == 'xxx') { $link = ''; $linkend=''; } - - if ($withpicto) $result.=($link.img_object($label, 'contact', 'class="classfortooltip"').$linkend.' '); - $result.=$link.($maxlen?dol_trunc($this->getFullName($langs),$maxlen):$this->getFullName($langs)).$linkend; + + if ($withpicto) $result.=($link.img_object($label, 'contact', 'class="classfortooltip"').$linkend.' '); + $result.=$link.($maxlen?dol_trunc($this->getFullName($langs),$maxlen):$this->getFullName($langs)).$linkend; return $result; } @@ -1042,24 +1090,24 @@ class Contact extends CommonObject } elseif ($mode == 2) { - if ($statut==0 || $statut==5) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); - elseif ($statut==1 || $statut==4) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); + if ($statut==0 || $statut==5) return img_picto($langs->trans('Disabled'),'statut5', 'class="pictostatus"').' '.$langs->trans('Disabled'); + elseif ($statut==1 || $statut==4) return img_picto($langs->trans('Enabled'),'statut4', 'class="pictostatus"').' '.$langs->trans('Enabled'); } elseif ($mode == 3) { - if ($statut==0 || $statut==5) return img_picto($langs->trans('Disabled'),'statut5'); - elseif ($statut==1 || $statut==4) return img_picto($langs->trans('Enabled'),'statut4'); + if ($statut==0 || $statut==5) return img_picto($langs->trans('Disabled'),'statut5', 'class="pictostatus"'); + elseif ($statut==1 || $statut==4) return img_picto($langs->trans('Enabled'),'statut4', 'class="pictostatus"'); } elseif ($mode == 4) { - if ($statut==0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); - elseif ($statut==1 || $statut==4) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); + if ($statut==0) return img_picto($langs->trans('Disabled'),'statut5', 'class="pictostatus"').' '.$langs->trans('Disabled'); + elseif ($statut==1 || $statut==4) return img_picto($langs->trans('Enabled'),'statut4', 'class="pictostatus"').' '.$langs->trans('Enabled'); } elseif ($mode == 5) { - if ($statut==0 || $statut==5) return ''.$langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5'); - elseif ($statut==1 || $statut==4) return ''.$langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4'); + if ($statut==0 || $statut==5) return ''.$langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5', 'class="pictostatus"'); + elseif ($statut==1 || $statut==4) return ''.$langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4', 'class="pictostatus"'); } } diff --git a/htdocs/contact/document.php b/htdocs/contact/document.php index 988dfc28dad..825c1e8dab5 100644 --- a/htdocs/contact/document.php +++ b/htdocs/contact/document.php @@ -37,9 +37,22 @@ $id = GETPOST('id','int'); $action = GETPOST("action"); $confirm = GETPOST('confirm', 'alpha'); +$object = new Contact($db); + +// Get object canvas (By default, this is not defined, so standard usage of dolibarr) +$object->getCanvas($id); +$objcanvas=null; +$canvas = (! empty($object->canvas)?$object->canvas:GETPOST("canvas")); +if (! empty($canvas)) +{ + require_once DOL_DOCUMENT_ROOT.'/core/class/canvas.class.php'; + $objcanvas = new Canvas($db, $action); + $objcanvas->getCanvas('contact', 'contactcard', $canvas); +} + // Security check if ($user->societe_id) $socid=$user->societe_id; -$result = restrictedArea($user, 'contact', $id, '',''); +$result = restrictedArea($user, 'contact', $id, 'socpeople&societe', '', '', 'rowid', $objcanvas); // If we create a contact with no company (shared contacts), no check on write permission // Get parameters $sortfield = GETPOST("sortfield",'alpha'); @@ -54,7 +67,6 @@ $pagenext = $page + 1; if (! $sortorder) $sortorder="ASC"; if (! $sortfield) $sortfield="name"; -$object = new Contact($db); if ($id > 0) $object->fetch($id); $upload_dir = $conf->societe->dir_output.'/contact/'.dol_sanitizeFileName($object->ref); @@ -138,6 +150,7 @@ if ($object->id) $modulepart = 'contact'; $permission = $user->rights->societe->contact->creer; + $permtoedit = $user->rights->societe->contact->creer; $param = '&id=' . $object->id; include DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php'; } else { diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index a66c1dab946..b8c96884e96 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -57,6 +57,8 @@ $search_email=GETPOST("search_email"); $search_skype=GETPOST("search_skype"); $search_priv=GETPOST("search_priv"); $search_categ=GETPOST("search_categ",'int'); +$search_categ_thirdparty=GETPOST("search_categ_thirdparty",'int'); +$search_categ_supplier=GETPOST("search_categ_supplier",'int'); $search_status=GETPOST("search_status",'int'); $search_type=GETPOST('search_type','alpha'); if ($search_status=='') $search_status=1; // always display activ customer first @@ -127,18 +129,18 @@ $fieldstosearchall = array( $arrayfields=array( 'p.lastname'=>array('label'=>$langs->trans("Lastname"), 'checked'=>1), 'p.firstname'=>array('label'=>$langs->trans("Firstname"), 'checked'=>1), - 'p.poste'=>array('label'=>$langs->trans("Post"), 'checked'=>1), + 'p.poste'=>array('label'=>$langs->trans("PostOrFunction"), 'checked'=>1), 'p.town'=>array('label'=>$langs->trans("Town"), 'checked'=>0), 'p.zip'=>array('label'=>$langs->trans("Zip"), 'checked'=>0), - 'p.phone'=>array('label'=>$langs->trans("PhonePro"), 'checked'=>1), + 'p.phone'=>array('label'=>$langs->trans("Phone"), 'checked'=>1), 'p.phone_perso'=>array('label'=>$langs->trans("PhonePerso"), 'checked'=>0), 'p.phone_mobile'=>array('label'=>$langs->trans("PhoneMobile"), 'checked'=>1), 'p.fax'=>array('label'=>$langs->trans("Fax"), 'checked'=>1), - 'p.email'=>array('label'=>$langs->trans("Email"), 'checked'=>1), + 'p.email'=>array('label'=>$langs->trans("EMail"), 'checked'=>1), 'p.skype'=>array('label'=>$langs->trans("Skype"), 'checked'=>1, 'enabled'=>(! empty($conf->skype->enabled))), 'p.thirdparty'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1, 'enabled'=>empty($conf->global->SOCIETE_DISABLE_CONTACTS)), 'p.priv'=>array('label'=>$langs->trans("ContactVisibility"), 'checked'=>1, 'position'=>200), - 'p.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), + 'p.datec'=>array('label'=>$langs->trans("DateCreationShort"), 'checked'=>0, 'position'=>500), 'p.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500), 'p.statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000), ); @@ -191,6 +193,10 @@ if (GETPOST('button_removefilter_x') || GETPOST('button_removefilter.x') || GETP $search_skype=""; $search_priv=""; $search_status=-1; + $search_categ=''; + $search_categ_thirdparty=''; + $search_categ_supplier=''; + $search_array_options=array(); } if ($search_priv < 0) $search_priv=''; @@ -220,7 +226,9 @@ $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as p"; if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople_extrafields as ef on (p.rowid = ef.fk_object)"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON co.rowid = p.fk_pays"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = p.fk_soc"; -if (! empty($search_categ)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_contact as cs ON p.rowid = cs.fk_socpeople"; // We need this table joined to the select in order to filter by categ +if (! empty($search_categ)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_contact as cc ON p.rowid = cc.fk_socpeople"; // We need this table joined to the select in order to filter by categ +if (! empty($search_categ_thirdparty)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cs ON s.rowid = cs.fk_soc"; // We need this table joined to the select in order to filter by categ +if (! empty($search_categ_supplier)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_fournisseur as cs2 ON s.rowid = cs2.fk_soc"; // We need this table joined to the select in order to filter by categ if (!$user->rights->societe->client->voir && !$socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc"; $sql.= ' WHERE p.entity IN ('.getEntity('societe', 1).')'; if (!$user->rights->societe->client->voir && !$socid) //restriction @@ -243,8 +251,12 @@ else if ($search_priv == '1') $sql .= " AND (p.priv='1' AND p.fk_user_creat=".$user->id.")"; } -if ($search_categ > 0) $sql.= " AND cs.fk_categorie = ".$db->escape($search_categ); -if ($search_categ == -2) $sql.= " AND cs.fk_categorie IS NULL"; +if ($search_categ > 0) $sql.= " AND cc.fk_categorie = ".$db->escape($search_categ); +if ($search_categ == -2) $sql.= " AND cc.fk_categorie IS NULL"; +if ($search_categ_thirdparty > 0) $sql.= " AND cs.fk_categorie = ".$db->escape($search_categ_thirdparty); +if ($search_categ_thirdparty == -2) $sql.= " AND cs.fk_categorie IS NULL"; +if ($search_categ_supplier > 0) $sql.= " AND cs2.fk_categorie = ".$db->escape($search_categ_supplier); +if ($search_categ_supplier == -2) $sql.= " AND cs2.fk_categorie IS NULL"; if ($search_firstlast_only) { $sql .= natural_search(array('p.lastname','p.firstname'), $search_firstlast_only); @@ -333,7 +345,7 @@ $reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // No $sql.=$hookmanager->resPrint; // Add order -if($view == "recent") +if ($view == "recent") { $sql.= $db->order("p.datec","DESC"); } @@ -350,15 +362,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) $nbtotalofrecords = $db->num_rows($result); } -// Add limit -if($view == "recent") -{ - $sql.= $db->plimit($limit+1, $offset); -} -else -{ - $sql.= $db->plimit($limit+1, $offset); -} +$sql.= $db->plimit($limit+1, $offset); //print $sql; dol_syslog("contact/list.php", LOG_DEBUG); @@ -374,6 +378,9 @@ if ($result) $param.='&begin='.urlencode($begin).'&view='.urlencode($view).'&userid='.urlencode($userid).'&contactname='.urlencode($sall); $param.='&type='.urlencode($type).'&view='.urlencode($view); if (!empty($search_categ)) $param.='&search_categ='.urlencode($search_categ); + if (!empty($search_categ_thirdparty)) $param.='&search_categ_thirdparty='.urlencode($search_categ_thirdparty); + if (!empty($search_categ_supplier)) $param.='&search_categ_supplier='.urlencode($search_categ_supplier); + if ($sall != '') $param.='&sall='.urlencode($sall); if ($search_lastname != '') $param.='&search_lastname='.urlencode($search_lastname); if ($search_firstname != '') $param.='&search_firstname='.urlencode($search_firstname); if ($search_societe != '') $param.='&search_societe='.urlencode($search_societe); @@ -423,6 +430,22 @@ if ($result) $moreforfilter.=$langs->trans('Categories'). ': '; $moreforfilter.=$formother->select_categories(Categorie::TYPE_CONTACT,$search_categ,'search_categ',1); $moreforfilter.=''; + if (empty($type) || $type == 'c' || $type == 'p') + { + $moreforfilter.='
'; + if ($type == 'c') $moreforfilter.=$langs->trans('CustomersCategoriesShort'). ': '; + else if ($type == 'p') $moreforfilter.=$langs->trans('ProspectsCategoriesShort'). ': '; + else $moreforfilter.=$langs->trans('CustomersProspectsCategoriesShort'). ': '; + $moreforfilter.=$formother->select_categories(Categorie::TYPE_CUSTOMER,$search_categ_thirdparty,'search_categ_thirdparty',1); + $moreforfilter.='
'; + } + if (empty($type) || $type == 'f') + { + $moreforfilter.='
'; + $moreforfilter.=$langs->trans('SuppliersCategoriesShort'). ': '; + $moreforfilter.=$formother->select_categories(Categorie::TYPE_SUPPLIER,$search_categ_supplier,'search_categ_supplier',1); + $moreforfilter.='
'; + } } if ($moreforfilter) { @@ -680,13 +703,12 @@ if ($result) print ''; if ($obj->socid) { - print ''; - print img_object($langs->trans("ShowCompany"),"company").' '.dol_trunc($obj->name,20).''; + $objsoc = new Societe($db); + $objsoc->fetch($obj->socid); + print $objsoc->getNomUrl(1); } else - { print ' '; - } print ''; } diff --git a/htdocs/contact/note.php b/htdocs/contact/note.php index 761efcfa840..17c718cfb42 100644 --- a/htdocs/contact/note.php +++ b/htdocs/contact/note.php @@ -83,6 +83,10 @@ if ($id > 0) $linkback = ''.$langs->trans("BackToList").''; dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', ''); + $cssclass='titlefield'; + //if ($action == 'editnote_public') $cssclass='titlefieldcreate'; + //if ($action == 'editnote_private') $cssclass='titlefieldcreate'; + print '
'; print '
'; @@ -98,19 +102,19 @@ if ($id > 0) $objsoc = new Societe($db); $objsoc->fetch($object->socid); - print ''.$langs->trans("ThirdParty").''.$objsoc->getNomUrl(1).''; + print ''.$langs->trans("ThirdParty").''.$objsoc->getNomUrl(1).''; } else { - print ''.$langs->trans("ThirdParty").''; + print ''.$langs->trans("ThirdParty").''; print $langs->trans("ContactNotLinkedToCompany"); print ''; } } // Civility - print ''.$langs->trans("UserTitle").''; + print ''.$langs->trans("UserTitle").''; print $object->getCivilityLabel(); print ''; @@ -120,7 +124,7 @@ if ($id > 0) { include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; - print ''.$langs->trans("DateToBirth").''.dol_print_date($object->birthday,"day"); + print ''.$langs->trans("DateToBirth").''.dol_print_date($object->birthday,"day"); print '   '; //var_dump($birthdatearray); @@ -138,17 +142,16 @@ if ($id > 0) } else { - print ''.$langs->trans("DateToBirth").''.$langs->trans("Unknown").""; + print ''.$langs->trans("DateToBirth").''.$langs->trans("Unknown").""; } print ""; print ""; - print '
'; + //print '
'; - print '
'; + //print '
'; - $cssclass='titlefield'; include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; diff --git a/htdocs/contact/perso.php b/htdocs/contact/perso.php index da70bc3e007..03e62523922 100644 --- a/htdocs/contact/perso.php +++ b/htdocs/contact/perso.php @@ -135,11 +135,9 @@ $object->fetch($id, $user); $head = contact_prepare_head($object); -dol_fiche_head($head, 'perso', $title, 0, 'contact'); - if ($action == 'edit') { - /* + /* * Fiche en mode edition */ @@ -148,15 +146,17 @@ if ($action == 'edit') print ''; print ''; + dol_fiche_head($head, 'perso', $title, 0, 'contact'); + print ''; // Ref - print ''; // Photo - print ''; // Name - print ''; - print ''; + print ''; + print ''; // Company if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) @@ -213,8 +213,10 @@ if ($action == 'edit') } print ''; - print "
'.$langs->trans("Ref").''; + print '
'.$langs->trans("Ref").''; print $object->id; print ''; + print ''; print $form->showphoto('contact',$object)."\n"; if ($object->photo) print "
\n"; @@ -170,8 +170,8 @@ if ($action == 'edit') print '
'.$langs->trans("Lastname").' / '.$langs->trans("Label").''.$object->lastname.''.$langs->trans("Firstname").''.$object->firstname.'
'.$langs->trans("Lastname").' / '.$langs->trans("Label").''.$object->lastname.'
'.$langs->trans("Firstname").''.$object->firstname.'

"; + print ""; + dol_fiche_end(); + print '
'; print ''; print '     '; @@ -227,6 +229,8 @@ else { // View mode + dol_fiche_head($head, 'perso', $title, 0, 'contact'); + $linkback = ''.$langs->trans("BackToList").''; dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', ''); @@ -285,16 +289,17 @@ else } else { - print ''.$langs->trans("DateToBirth").''.$langs->trans("Unknown").""; + print ''.$langs->trans("DateToBirth").''; } print ""; print ""; print '
'; + + dol_fiche_end(); } -dol_fiche_end(); if ($action != 'edit') { diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 5a87d3b3d51..86e45ade086 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -214,7 +214,7 @@ if (empty($reshook)) if ($socid<1) { - setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Customer")), null, 'errors'); + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ThirdParty")), null, 'errors'); $action='create'; $error++; } @@ -368,31 +368,6 @@ 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 @@ -680,8 +655,8 @@ if (empty($reshook)) $objectline->qty=GETPOST('elqty'); $objectline->remise_percent=GETPOST('elremise_percent'); $objectline->tva_tx=GETPOST('eltva_tx')?GETPOST('eltva_tx'):0; // Field may be disabled, so we use vat rate 0 - $objectline->localtax1_tx=$localtax1_tx; - $objectline->localtax2_tx=$localtax2_tx; + $objectline->localtax1_tx=is_numeric($localtax1_tx)?$localtax1_tx:0; + $objectline->localtax2_tx=is_numeric($localtax2_tx)?$localtax2_tx:0; $objectline->date_ouverture_prevue=$date_start_update; $objectline->date_ouverture=$date_start_real_update; $objectline->date_fin_validite=$date_end_update; @@ -821,7 +796,7 @@ if (empty($reshook)) setEventMessages($object->error, $object->errors, 'errors'); } - $result = $object->setValueFrom('ref_supplier',GETPOST('ref_supplier','alpha')); + $result = $object->setValueFrom('ref_supplier', GETPOST('ref_supplier','alpha'), '', null, 'text', '', $user, 'CONTRACT_MODIFY'); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); $action = 'editref_supplier'; @@ -846,7 +821,7 @@ if (empty($reshook)) setEventMessages($object->error, $object->errors, 'errors'); } - $result = $object->setValueFrom('ref_customer',GETPOST('ref_customer','alpha')); + $result = $object->setValueFrom('ref_customer', GETPOST('ref_customer','alpha'), '', null, 'text', '', $user, 'CONTRACT_MODIFY'); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); $action = 'editref_customer'; @@ -870,7 +845,7 @@ if (empty($reshook)) setEventMessages($object->error, $object->errors, 'errors'); } - $result = $object->setValueFrom('ref',GETPOST('ref','alpha')); + $result = $object->setValueFrom('ref', GETPOST('ref','alpha'), '', null, 'text', '', $user, 'CONTRACT_MODIFY'); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); $action = 'editref'; @@ -894,7 +869,7 @@ if (empty($reshook)) setEventMessages($object->error, $object->errors, 'errors'); } $datacontrat=dol_mktime(GETPOST('date_contrathour'), GETPOST('date_contratmin'), 0, GETPOST('date_contratmonth'), GETPOST('date_contratday'), GETPOST('date_contratyear')); - $result = $object->setValueFrom('date_contrat',$datacontrat,'',null,'date'); + $result = $object->setValueFrom('date_contrat', $datacontrat, '', null, 'date', '', $user, 'CONTRACT_MODIFY'); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); $action = 'editdate_contrat'; @@ -992,13 +967,35 @@ if (empty($reshook)) } } } + + // Action clone object + if ($action == 'confirm_clone' && $confirm == 'yes') + { + if (! GETPOST('socid', 3)) + { + setEventMessages($langs->trans("NoCloneOptionsSpecified"), null, 'errors'); + } + else + { + if ($object->id > 0) { + $result = $object->createFromClone($socid); + if ($result > 0) { + header("Location: " . $_SERVER['PHP_SELF'] . '?id=' . $result); + exit(); + } else { + if (count($object->errors) > 0) setEventMessages($object->error, $object->errors, 'errors'); + $action = ''; + } + } + } + } } /* * View */ -llxHeader('',$langs->trans("ContractCard"),"Contrat"); +llxHeader('',$langs->trans("Contract"),""); $form = new Form($db); $formfile = new FormFile($db); @@ -1094,7 +1091,7 @@ if ($action == 'create') } else { $tmpcode=''; } - print ''.$langs->trans('Ref').''.$tmpcode.''; + print ''.$langs->trans('Ref').''.$tmpcode.''; // Ref customer print ''.$langs->trans('RefCustomer').''; @@ -1117,7 +1114,7 @@ if ($action == 'create') else { print ''; - print $form->select_company('','socid','',1,1); + print $form->select_company('','socid','','SelectThirdParty',1); print ''; } print ''."\n"; @@ -1137,12 +1134,12 @@ if ($action == 'create') } // Commercial suivi - print ''.$langs->trans("TypeContact_contrat_internal_SALESREPFOLL").''; + print ''.$langs->trans("TypeContact_contrat_internal_SALESREPFOLL").''; print $form->select_dolusers(GETPOST("commercial_suivi_id")?GETPOST("commercial_suivi_id"):$user->id,'commercial_suivi_id',1,''); print ''; // Commercial signature - print ''.$langs->trans("TypeContact_contrat_internal_SALESREPSIGN").''; + print ''.$langs->trans("TypeContact_contrat_internal_SALESREPSIGN").''; print $form->select_dolusers(GETPOST("commercial_signature_id")?GETPOST("commercial_signature_id"):$user->id,'commercial_signature_id',1,''); print ''; @@ -1188,7 +1185,7 @@ if ($action == 'create') dol_fiche_end(); - print '
'; + print '
'; print ''; print '     '; print ''; @@ -1290,18 +1287,24 @@ else print ''; } + // Clone confirmation + if ($action == 'clone') { + $formquestion = array(array('type' => 'other','name' => 'socid','label' => $langs->trans("SelectThirdParty"),'value' => $form->select_company(GETPOST('socid', 'int'), 'socid', '(s.client=1 OR s.client=2 OR s.client=3)'))); + print $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('CloneContract'), $langs->trans('ConfirmCloneContract', $object->ref), 'confirm_clone', $formquestion, 'yes', 1); + } + print ''; $linkback = ''.$langs->trans("BackToList").''; // Ref du contrat - if (!empty($modCodeContract->code_auto)) { - print '"; } else { print ''; - print ''; - print ''; print ''; - print ''; - print ''; + print ''; print ''; print ''; print ''; @@ -1513,7 +1516,7 @@ else // Remise if ($objp->remise_percent > 0) { - print '\n"; + print '\n"; } else { @@ -1567,7 +1570,11 @@ else { print dol_print_date($db->jdate($objp->date_debut)); // Warning si date prevu passee et pas en service - if ($objp->statut == 0 && $db->jdate($objp->date_debut) < ($now - $conf->contrat->services->inactifs->warning_delay)) { print " ".img_warning($langs->trans("Late")); } + if ($objp->statut == 0 && $db->jdate($objp->date_debut) < ($now - $conf->contrat->services->inactifs->warning_delay)) { + $warning_delay=$conf->contrat->services->inactifs->warning_delay / 3600 / 24; + $textlate = $langs->trans("Late").' = '.$langs->trans("DateReference").' > '.$langs->trans("DateToday").' '.(ceil($warning_delay) >= 0 ? '+' : '').ceil($warning_delay).' '.$langs->trans("days"); + print " ".img_warning($textlate); + } } else print $langs->trans("Unknown"); print '  -  '; @@ -1575,7 +1582,11 @@ else if ($objp->date_fin) { print dol_print_date($db->jdate($objp->date_fin)); - if ($objp->statut == 4 && $db->jdate($objp->date_fin) < ($now - $conf->contrat->services->expires->warning_delay)) { print " ".img_warning($langs->trans("Late")); } + if ($objp->statut == 4 && $db->jdate($objp->date_fin) < ($now - $conf->contrat->services->expires->warning_delay)) { + $warning_delay=$conf->contrat->services->expires->warning_delay / 3600 / 24; + $textlate = $langs->trans("Late").' = '.$langs->trans("DateReference").' > '.$langs->trans("DateToday").' '.(ceil($warning_delay) >= 0 ? '+' : '').ceil($warning_delay).' '.$langs->trans("days"); + print " ".img_warning($textlate); + } } else print $langs->trans("Unknown"); @@ -1584,7 +1595,7 @@ else } - //Display lines extrafields + // Display lines extrafields if (is_array($extralabelslines) && count($extralabelslines)>0) { print ''; $line = new ContratLigne($db); @@ -1975,6 +1986,18 @@ else else print ''; } + if (! empty($conf->commande->enabled) && $object->statut > 0 && $object->nbofservicesclosed < $nbofservices) + { + $langs->load("bills"); + if ($user->rights->facture->creer) print ''; + else print ''; + } + + // Clone + if ($user->rights->contrat->creer) { + print ''; + } + if ($object->nbofservicesclosed < $nbofservices) { //if (! $numactive) @@ -2015,14 +2038,12 @@ else $var = true; - $somethingshown = $formfile->show_documents('contract', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', 0, '', $soc->default_lang); - - // Linked object block - $somethingshown = $form->showLinkedObjectBlock($object); + print $formfile->showdocuments('contract', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', 0, '', $soc->default_lang); + // Show links to link elements - $linktoelem = $form->showLinkToObjectBlock($object); - if ($linktoelem) print '
'.$linktoelem; + $linktoelem = $form->showLinkToObjectBlock($object, null, array('contrat')); + $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem); print '
'; diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 47cde8e3f40..6b0dc8d7fdb 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -4,7 +4,7 @@ * Copyright (C) 2005-2014 Regis Houssin * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2008 Raphael Bertrand - * Copyright (C) 2010-2015 Juanjo Menent + * Copyright (C) 2010-2016 Juanjo Menent * Copyright (C) 2013 Christophe Battarel * Copyright (C) 2013 Florian Henry * Copyright (C) 2014-2015 Marcos García @@ -56,7 +56,7 @@ class Contrat extends CommonObject * @var string */ var $ref_customer; - + /** * Supplier reference of the contract * @var string @@ -354,7 +354,7 @@ class Contrat extends CommonObject * * @param User $user Objet User * @param string $force_number Reference to force on contract (not implemented yet) - * @param int $notrigger 1=Does not execute triggers, 0= execuete triggers + * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ function validate($user, $force_number='', $notrigger=0) @@ -536,7 +536,7 @@ class Contrat extends CommonObject return -1; } } - + /** * Load a contract from database * @@ -904,6 +904,7 @@ class Contrat extends CommonObject } if (! $paramsok) return -1; + $this->db->begin(); $now=dol_now(); @@ -957,25 +958,85 @@ class Contrat extends CommonObject } } + if (! $error) + { + if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + { + $result=$this->insertExtraFields(); + if ($result < 0) + { + $error++; + } + } + } + // Insert contacts commerciaux ('SALESREPSIGN','contrat') - $result=$this->add_contact($this->commercial_signature_id,'SALESREPSIGN','internal'); - if ($result < 0) $error++; + if (! $error) + { + $result=$this->add_contact($this->commercial_signature_id,'SALESREPSIGN','internal'); + if ($result < 0) $error++; + } // Insert contacts commerciaux ('SALESREPFOLL','contrat') - $result=$this->add_contact($this->commercial_suivi_id,'SALESREPFOLL','internal'); - if ($result < 0) $error++; - + if (! $error) + { + $result=$this->add_contact($this->commercial_suivi_id,'SALESREPFOLL','internal'); + if ($result < 0) $error++; + } if (! $error) { - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used - { - $result=$this->insertExtraFields(); - if ($result < 0) - { - $error++; - } - } + // Add object linked + if (is_array($this->linked_objects) && ! empty($this->linked_objects)) + { + foreach($this->linked_objects as $origin => $origin_id) + { + $ret = $this->add_object_linked($origin, $origin_id); + if (! $ret) + { + dol_print_error($this->db); + $error++; + } + + if (! empty($conf->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN)) + { + $originforcontact = $origin; + $originidforcontact = $origin_id; + if ($originforcontact == 'shipping') // shipment and order share the same contacts. If creating from shipment we take data of order + { + require_once DOL_DOCUMENT_ROOT . '/expedition/class/expedition.class.php'; + $exp = new Expedition($db); + $exp->fetch($origin_id); + $exp->fetchObjectLinked(); + if (count($exp->linkedObjectsIds['commande']) > 0) + { + foreach ($exp->linkedObjectsIds['commande'] as $key => $value) + { + $originforcontact = 'commande'; + $originidforcontact = $value->id; + break; // We take first one + } + } + } + + $sqlcontact = "SELECT ctc.code, ctc.source, ec.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 = $this->db->query($sqlcontact); + if ($resqlcontact) + { + while($objcontact = $this->db->fetch_object($resqlcontact)) + { + if ($objcontact->source == 'internal' && in_array($objcontact->code, array('SALESREPSIGN', 'SALESREPFOLL'))) continue; // ignore this, already forced previously + + //print $objcontact->code.'-'.$objcontact->source.'-'.$objcontact->fk_socpeople."\n"; + $this->add_contact($objcontact->fk_socpeople, $objcontact->code, $objcontact->source); // May failed because of duplicate key or because code of contact type does not exists for new object + } + } + else dol_print_error($resqlcontact); + } + } + } } if (! $error) @@ -987,19 +1048,12 @@ class Contrat extends CommonObject if (! $error) { - // Add linked object - if (! $error && $this->origin && $this->origin_id) - { - $ret = $this->add_object_linked(); - if (! $ret) dol_print_error($this->db); - } $this->db->commit(); return $this->id; } else { dol_syslog(get_class($this)."::create - 30 - ".$this->error, LOG_ERR); - $this->db->rollback(); return -3; } @@ -1008,7 +1062,6 @@ class Contrat extends CommonObject { $this->error="Failed to add contact"; dol_syslog(get_class($this)."::create - 20 - ".$this->error, LOG_ERR); - $this->db->rollback(); return -2; } @@ -1179,7 +1232,6 @@ class Contrat extends CommonObject $error=0; // Clean parameters - if (isset($this->ref)) $this->ref=trim($this->ref); if (isset($this->ref_customer)) $this->ref_customer=trim($this->ref_customer); if (isset($this->ref_supplier)) $this->ref_supplier=trim($this->ref_supplier); @@ -1197,14 +1249,11 @@ class Contrat extends CommonObject if (isset($this->import_key)) $this->import_key=trim($this->import_key); //if (isset($this->extraparams)) $this->extraparams=trim($this->extraparams); - - // Check parameters // Put here code to add a control on parameters values // Update request - $sql = "UPDATE ".MAIN_DB_PREFIX."contrat SET"; - + $sql = "UPDATE ".MAIN_DB_PREFIX."contrat SET"; $sql.= " ref=".(isset($this->ref)?"'".$this->db->escape($this->ref)."'":"null").","; $sql.= " ref_customer=".(isset($this->ref_customer)?"'".$this->db->escape($this->ref_customer)."'":"null").","; $sql.= " ref_supplier=".(isset($this->ref_supplier)?"'".$this->db->escape($this->ref_supplier)."'":"null").","; @@ -1225,8 +1274,6 @@ class Contrat extends CommonObject $sql.= " note_public=".(isset($this->note_public)?"'".$this->db->escape($this->note_public)."'":"null").","; $sql.= " import_key=".(isset($this->import_key)?"'".$this->db->escape($this->import_key)."'":"null").""; //$sql.= " extraparams=".(isset($this->extraparams)?"'".$this->db->escape($this->extraparams)."'":"null").""; - - $sql.= " WHERE rowid=".$this->id; $this->db->begin(); @@ -1300,19 +1347,20 @@ class Contrat extends CommonObject $this->db->begin(); // Clean parameters - $remise_percent=price2num($remise_percent); - $qty=price2num($qty); - if (! $qty) $qty=1; - if (! $info_bits) $info_bits=0; - if (! $pu_ht) $pu_ht=0; - if (! $pu_ttc) $pu_ttc=0; - $pu_ht=price2num($pu_ht); $pu_ttc=price2num($pu_ttc); $pa_ht=price2num($pa_ht); $txtva=price2num($txtva); $txlocaltax1=price2num($txlocaltax1); $txlocaltax2=price2num($txlocaltax2); + $remise_percent=price2num($remise_percent); + $qty=price2num($qty); + if (empty($qty)) $qty=1; + if (empty($info_bits)) $info_bits=0; + if (empty($pu_ht) || ! is_numeric($pu_ht)) $pu_ht=0; + if (empty($pu_ttc)) $pu_ttc=0; + if (empty($txlocaltax1) || ! is_numeric($txlocaltax1)) $txlocaltax1=0; + if (empty($txlocaltax2) || ! is_numeric($txlocaltax2)) $txlocaltax2=0; if ($price_base_type=='HT') { @@ -1333,7 +1381,7 @@ class Contrat extends CommonObject $localtaxes_type=getLocalTaxesFromRate($txtva, 0, $this->societe, $mysoc); $txtva = preg_replace('/\s*\(.*\)/','',$txtva); // Remove code into vatrate. - + $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, 1,$mysoc, $localtaxes_type); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; @@ -1356,9 +1404,9 @@ class Contrat extends CommonObject if (empty($pa_ht)) $pa_ht=0; - + // if buy price not defined, define buyprice as configured in margin admin - if ($this->pa_ht == 0) + if ($this->pa_ht == 0) { if (($result = $this->defineBuyPrice($pu_ht, $remise_percent, $fk_product)) < 0) { @@ -1380,15 +1428,17 @@ class Contrat extends CommonObject if ($date_start > 0) { $sql.= ",date_ouverture_prevue"; } if ($date_end > 0) { $sql.= ",date_fin_validite"; } $sql.= ", fk_unit"; - $sql.= ") VALUES ($this->id, '', '" . $this->db->escape($desc) . "',"; + $sql.= ") VALUES ("; + $sql.= $this->id.", '', '" . $this->db->escape($desc) . "',"; $sql.= ($fk_product>0 ? $fk_product : "null").","; - $sql.= " '".$qty."',"; - $sql.= " '".$txtva."',"; - $sql.= " '".$txlocaltax1."',"; - $sql.= " '".$txlocaltax2."',"; + $sql.= " ".$qty.","; + $sql.= " ".$txtva.","; + $sql.= " ".$txlocaltax1.","; + $sql.= " ".$txlocaltax2.","; $sql.= " '".$localtax1_type."',"; $sql.= " '".$localtax2_type."',"; - $sql.= " ".price2num($remise_percent).",".price2num($pu_ht).","; + $sql.= " ".price2num($remise_percent).","; + $sql.= " ".price2num($pu_ht).","; $sql.= " ".price2num($total_ht).",".price2num($total_tva).",".price2num($total_localtax1).",".price2num($total_localtax2).",".price2num($total_ttc).","; $sql.= " '".$info_bits."',"; $sql.= " ".price2num($price).",".price2num($remise).","; @@ -1515,7 +1565,7 @@ class Contrat extends CommonObject $localtaxes_type=getLocalTaxesFromRate($tvatx, 0, $this->societe, $mysoc); $tvatx = preg_replace('/\s*\(.*\)/','',$tvatx); // Remove code into vatrate. - + $tabprice=calcul_price_total($qty, $pu, $remise_percent, $tvatx, $localtax1tx, $localtax2tx, 0, $price_base_type, $info_bits, 1, $mysoc, $localtaxes_type); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; @@ -1539,7 +1589,7 @@ class Contrat extends CommonObject if (empty($pa_ht)) $pa_ht=0; // if buy price not defined, define buyprice as configured in margin admin - if ($this->pa_ht == 0) + if ($this->pa_ht == 0) { if (($result = $this->defineBuyPrice($pu_ht, $remise_percent)) < 0) { @@ -2098,6 +2148,8 @@ class Contrat extends CommonObject { global $user,$langs,$conf; + // Load array of products prodids + $num_prods = 0; $prodids = array(); $sql = "SELECT rowid"; $sql.= " FROM ".MAIN_DB_PREFIX."product"; @@ -2116,8 +2168,6 @@ class Contrat extends CommonObject } } - - // Initialise parametres $this->id=0; $this->specimen=1; @@ -2127,6 +2177,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; @@ -2212,6 +2263,120 @@ class Contrat extends CommonObject return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables); } + + /** + * Load an object from its id and create a new one in database + * + * @param int $socid Id of thirdparty + * @param int $notrigger 1=Does not execute triggers, 0= execute triggers + * @return int New id of clone + */ + function createFromClone($socid = 0, $notrigger=0) { + global $db, $user, $langs, $conf, $hookmanager; + + dol_include_once('/projet/class/project.class.php'); + + $this->context['createfromclone'] = 'createfromclone'; + + $error = 0; + $now = dol_now(); + + $this->fetch($this->id); + // Load dest object + $clonedObj = clone $this; + + $this->db->begin(); + + $objsoc = new Societe($this->db); + + $objsoc->fetch($clonedObj->socid); + + // $clonedObj->id=0; + $clonedObj->statut = 0; + + if (empty($conf->global->CONTRACT_ADDON) || ! is_readable(DOL_DOCUMENT_ROOT . "/core/modules/contract/" . $conf->global->CONTRACT_ADDON . ".php")) { + $this->error = 'ErrorSetupNotComplete'; + dol_syslog($this->error); + return - 1; + } + + // Set ref + require_once DOL_DOCUMENT_ROOT . "/core/modules/contract/" . $conf->global->CONTRACT_ADDON . '.php'; + $obj = $conf->global->CONTRACT_ADDON; + $modContract = new $obj(); + $clonedObj->ref = $modContract->getNextValue($objsoc, $clonedObj); + + // get extrafields so they will be clone + foreach ( $this->lines as $line ) { + $line->fetch_optionals($line->rowid); + } + + // Create clone + $result = $clonedObj->create($user); + if ($result < 0) { + $error ++; + $this->error = $clonedObj->error; + $this->errors[] = $clonedObj->error; + } else { + // copy internal contacts + if ($clonedObj->copy_linked_contact($this, 'internal') < 0) + $error ++; + + // copy external contacts if same company + elseif ($this->socid == $clonedObj->socid) { + if ($clonedObj->copy_linked_contact($this, 'external') < 0) + $error ++; + } + } + + if (! $error) { + foreach ( $this->lines as $line ) { + $result = $clonedObj->addline($line->desc, $line->subprice, $line->qty, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, $line->fk_product, $line->remise_percent, $line->date_ouverture, $line->date_cloture, 'HT', 0, $line->info_bits, $line->fk_fournprice, $line->pa_ht, $line->array_options, $line->fk_unit); + if ($result < 0) { + $error ++; + $this->error = $clonedObj->error; + $this->errors[] = $clonedObj->error; + } + } + } + + if (! $error) { + // Hook of thirdparty module + if (is_object($hookmanager)) { + $parameters = array ( + 'objFrom' => $this, + 'clonedObj' => $clonedObj + ); + $action = ''; + $reshook = $hookmanager->executeHooks('createFrom', $parameters, $clonedObj, $action); // Note that $action and $object may have been modified by some hooks + if ($reshook < 0) + $error ++; + } + + } + + if (! $notrigger && empty($error)) + { + // Call trigger + $clonedObj->old_copy=$this; + $result = $clonedObj->call_trigger('CONTRACT_CLONE', $user); + if ($result < 0) { + $error ++; + } + // End call triggers + } + + unset($this->context['createfromclone']); + + // End + if (! $error) { + $this->db->commit(); + return $clonedObj->id; + } else { + $this->db->rollback(); + return - 1; + } + } } @@ -2222,7 +2387,7 @@ class ContratLigne extends CommonObjectLine { public $element='contratdet'; public $table_element='contratdet'; - + var $id; var $ref; var $tms; @@ -2240,10 +2405,10 @@ class ContratLigne extends CommonObjectLine public $libelle; var $description; - + var $product_ref; var $product_label; - + var $date_commande; var $date_ouverture_prevue; // date start planned var $date_ouverture; // date start real @@ -2384,7 +2549,7 @@ class ContratLigne extends CommonObjectLine $result=''; $label=$langs->trans("ShowContractOfService").': '.$this->label; if (empty($label)) $label=$this->description; - + $link = ''; $linkend=''; @@ -2406,7 +2571,6 @@ class ContratLigne extends CommonObjectLine */ function fetch($id, $ref='') { - global $langs,$user; // Check parameters if (empty($id) && empty($ref)) return -1; @@ -2422,7 +2586,7 @@ class ContratLigne extends CommonObjectLine $sql.= " p.ref as product_ref,"; $sql.= " p.label as product_label,"; $sql.= " p.description as product_desc,"; - $sql.= " p.type as product_type,"; + $sql.= " p.fk_product_type as product_type,"; $sql.= " t.description,"; $sql.= " t.date_commande,"; $sql.= " t.date_ouverture_prevue as date_ouverture_prevue,"; @@ -2581,7 +2745,7 @@ class ContratLigne extends CommonObjectLine if (empty($this->pa_ht)) $this->pa_ht=0; // if buy price not defined, define buyprice as configured in margin admin - if ($this->pa_ht == 0) + if ($this->pa_ht == 0) { if (($result = $this->defineBuyPrice($this->subprice, $this->remise_percent, $this->fk_product)) < 0) { diff --git a/htdocs/contrat/contact.php b/htdocs/contrat/contact.php index cd070f6078d..7ec43fc2a56 100644 --- a/htdocs/contrat/contact.php +++ b/htdocs/contrat/contact.php @@ -109,7 +109,7 @@ if ($action == 'deletecontact' && $user->rights->contrat->creer) * View */ -llxHeader('', $langs->trans("ContractCard"), "Contrat"); +llxHeader('',$langs->trans("Contract"),""); $form = new Form($db); $formcompany= new FormCompany($db); @@ -142,7 +142,7 @@ if ($id > 0 || ! empty($ref)) $linkback = ''.$langs->trans("BackToList").''; // Reference du contrat - print '
"; @@ -156,7 +156,7 @@ if ($id > 0 || ! empty($ref)) else print $langs->trans("CompanyHasNoRelativeDiscount"); $absolute_discount=$object->thirdparty->getAvailableDiscounts(); print '. '; - if ($absolute_discount) print $langs->trans("CompanyHasAbsoluteDiscount",$absolute_discount,$langs->trans("Currency".$conf->currency)); + if ($absolute_discount) print $langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->trans("Currency".$conf->currency)); else print $langs->trans("CompanyHasNoAbsoluteDiscount"); print '.'; print ''; diff --git a/htdocs/contrat/document.php b/htdocs/contrat/document.php index 95da343e3af..ef7e73ad4c8 100644 --- a/htdocs/contrat/document.php +++ b/htdocs/contrat/document.php @@ -86,7 +86,7 @@ include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php'; $form = new Form($db); -llxHeader(); +llxHeader('',$langs->trans("Contract"),""); if ($object->id) @@ -110,7 +110,7 @@ if ($object->id) $linkback = ''.$langs->trans("BackToList").''; // Reference - print ''; + print ''; // Societe print ''; @@ -124,6 +124,7 @@ if ($object->id) $modulepart = 'contract'; $permission = $user->rights->contrat->creer; + $permtoedit = $user->rights->contrat->creer; $param = '&id=' . $object->id; include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php'; diff --git a/htdocs/contrat/index.php b/htdocs/contrat/index.php index 250f1c98199..2a2d2d35891 100644 --- a/htdocs/contrat/index.php +++ b/htdocs/contrat/index.php @@ -273,7 +273,7 @@ if (! empty($conf->contrat->enabled) && $user->rights->contrat->lire) } else { - print ''; + print ''; } print "
'.$langs->trans("Ref").''; + if (! empty($modCodeContract->code_auto)) { + print '
'.$langs->trans("Ref").''; print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', ''); print "
'; + print ''; print $form->editfieldkey("Ref",'ref',$object->ref,$object,$user->rights->contrat->creer); print ''; print $form->editfieldval("Ref",'ref',$object->ref,$object,$user->rights->contrat->creer); @@ -1310,7 +1313,7 @@ else } print '
'; + print ''; print $form->editfieldkey("RefCustomer",'ref_customer',$object->ref_customer,$object,$user->rights->contrat->creer); print ''; print $form->editfieldval("RefCustomer",'ref_customer',$object->ref_customer,$object,$user->rights->contrat->creer); @@ -1318,7 +1321,7 @@ else print '
'; + print ''; print $form->editfieldkey("RefSupplier",'ref_supplier',$object->ref_supplier,$object,$user->rights->contrat->creer); print ''; print $form->editfieldval("RefSupplier",'ref_supplier',$object->ref_supplier,$object,$user->rights->contrat->creer); @@ -1348,7 +1351,7 @@ else // Date print '
'; + print ''; print $form->editfieldkey("Date",'date_contrat',$object->date_contrat,$object,$user->rights->contrat->creer); print ''; print $form->editfieldval("Date",'date_contrat',$object->date_contrat,$object,$user->rights->contrat->creer,'datehourpicker'); @@ -1452,7 +1455,7 @@ else { $total = 0; - print '
'.$langs->trans("ServiceNb",$cursorline).''.$langs->trans("VAT").''.$langs->trans("PriceUHT").''.$objp->remise_percent."%'.$objp->remise_percent."%
'.$langs->trans("Ref").''; + print '
'.$langs->trans("Ref").''; print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', ''); print "
'.$langs->trans('Ref').''.$form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', '').'
'.$langs->trans('Ref').''.$form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', '').'
'.$langs->trans("Customer").'
'.$langs->trans("NoContracts").'
'.$langs->trans("NoContracts").'

"; $db->free($resql); @@ -344,7 +344,7 @@ if ($result) $staticcompany->name=$obj->name; print $staticcompany->getNomUrl(1,'',20); print ''; - print ''.dol_print_date($obj->tms,'dayhour').''; + print ''.dol_print_date($db->jdate($obj->tms),'dayhour').''; //print ''.$staticcontrat->LibStatut($obj->statut,2).''; print ''.($obj->nb_initial>0 ? $obj->nb_initial.$staticcontratligne->LibStatut(0,3):'').''; print ''.($obj->nb_running>0 ? $obj->nb_running.$staticcontratligne->LibStatut(4,3,0):'').''; diff --git a/htdocs/contrat/info.php b/htdocs/contrat/info.php index 2067247dbf6..f993a940e14 100644 --- a/htdocs/contrat/info.php +++ b/htdocs/contrat/info.php @@ -38,7 +38,7 @@ $result = restrictedArea($user, 'contrat',$contratid,''); * View */ -llxHeader(); +llxHeader('',$langs->trans("Contract"),""); $contrat = new Contrat($db); $contrat->fetch($contratid); diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index 350a0435d38..c003b638748 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -6,6 +6,7 @@ * Copyright (C) 2014 Juanjo Menent * Copyright (C) 2015 Claudio Aschieri * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2016 Ferran Marcet * * 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 @@ -30,13 +31,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 +59,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'); @@ -67,20 +84,18 @@ $result = restrictedArea($user, 'contrat', $id); $staticcontrat=new Contrat($db); $staticcontratligne=new ContratLigne($db); -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers -{ - $search_name=""; - $search_contract=""; - $search_ref_supplier=""; - $search_user=''; - $search_sale=''; - $search_product_category=''; - $sall=""; - $search_status=""; -} - 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 +$hookmanager->initHooks(array($contextpage)); +$extrafields = new ExtraFields($db); + +// fetch optionals attributes and labels +$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', @@ -92,6 +107,77 @@ $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 + */ + +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 +{ + $day=''; + $month=''; + $year=''; + $search_name=""; + $search_town=''; + $search_zip=""; + $search_state=""; + $search_type=''; + $search_country=''; + $search_contract=""; + $search_ref_supplier=""; + $search_user=''; + $search_sale=''; + $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 @@ -105,16 +191,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) @@ -127,32 +225,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_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)) @@ -169,23 +303,44 @@ 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 ($sall != '') $param.='&sall='.$sall; + 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 '
'; if ($optioncss != '') print ''; print ''; + print ''; print ''; print ''; print ''; - 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) { @@ -193,8 +348,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"); @@ -226,6 +382,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 '
'; @@ -233,43 +390,164 @@ if ($resql) print '
'; } - print ''; + $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; + $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields + + print '
'."\n"; print ''; - - 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 "\n"; print ''; print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + } + if (! empty($arrayfields['c.ref_customer']['checked'])) + { + print ''; + } + if (! empty($arrayfields['c.ref_supplier']['checked'])) + { + print ''; + } + if (! empty($arrayfields['s.nom']['checked'])) + { + print ''; + } + // Town + if (! empty($arrayfields['s.town']['checked'])) print ''; + // Zip + if (! empty($arrayfields['s.zip']['checked'])) print ''; + // State + if (! empty($arrayfields['state.nom']['checked'])) + { + print ''; + } + // Country + if (! empty($arrayfields['country.code_iso']['checked'])) + { + print ''; + } + // Company type + if (! empty($arrayfields['typent.code']['checked'])) + { + print ''; + } + if (! empty($arrayfields['sale_representative']['checked'])) + { + print ''; + } + if (! empty($arrayfields['c.date_contrat']['checked'])) + { + // Date contract + print ''; + } + // 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 ''; + } + } + } + // 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 ''; + } + // Date modification + if (! empty($arrayfields['c.tms']['checked'])) + { + print ''; + } + // Status + if (! empty($arrayfields['status']['checked'])) + { + print ''; + } + print ''; print "\n"; @@ -279,65 +557,166 @@ if ($resql) $obj = $db->fetch_object($resql); $var=!$var; print ''; - print ''; - print ''; - print ''; - print ''; - //print ''; - - // Sales Rapresentatives - print ''; } - else + if (! empty($arrayfields['c.ref_customer']['checked'])) { - print ' '; + print ''; + } + if (! empty($arrayfields['c.ref_supplier']['checked'])) + { + print ''; + } + if (! empty($arrayfields['s.nom']['checked'])) + { + print ''; + } + // Town + if (! empty($arrayfields['s.town']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Zip + if (! empty($arrayfields['s.zip']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + // State + if (! empty($arrayfields['state.nom']['checked'])) + { + print "\n"; + if (! $i) $totalarray['nbfield']++; + } + // Country + if (! empty($arrayfields['country.code_iso']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Type ent + if (! empty($arrayfields['typent.code']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + if (! empty($arrayfields['sale_representative']['checked'])) + { + // Sales representatives + print ''; + } + // Date + if (! empty($arrayfields['c.date_contrat']['checked'])) + { + print ''; + } + // 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 'getAlignFlag($key); + if ($align) print ' align="'.$align.'"'; + print '>'; + $tmpkey='options_'.$key; + print $extrafields->showOutputField($key, $obj->$tmpkey, '', 1); + print ''; + 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 ''; + if (! $i) $totalarray['nbfield']++; + } + // Date modification + if (! empty($arrayfields['c.tms']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Status + if (! empty($arrayfields['status']['checked'])) + { + print ''; + print ''; + print ''; + print ''; + } + // Action column + print ''; - - - print ''; - //print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + if (! $i) $totalarray['nbfield']++; + print "\n"; $i++; } diff --git a/htdocs/contrat/note.php b/htdocs/contrat/note.php index 502b354ee69..806434176fd 100644 --- a/htdocs/contrat/note.php +++ b/htdocs/contrat/note.php @@ -58,7 +58,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, * View */ -llxHeader(); +llxHeader('',$langs->trans("Contract"),""); $form = new Form($db); @@ -78,7 +78,7 @@ if ($id > 0 || ! empty($ref)) $linkback = ''.$langs->trans("BackToList").''; // Reference - print ''; + print ''; // Societe print ''; diff --git a/htdocs/contrat/services.php b/htdocs/contrat/services.php index d0962ad757e..8e37e392603 100644 --- a/htdocs/contrat/services.php +++ b/htdocs/contrat/services.php @@ -52,15 +52,26 @@ $search_status=GETPOST("search_status","alpha"); $statut=GETPOST('statut')?GETPOST('statut'):1; $socid=GETPOST('socid','int'); +$opouvertureprevuemonth=GETPOST('opouvertureprevuemonth'); +$opouvertureprevueday=GETPOST('opouvertureprevueday'); +$opouvertureprevueyear=GETPOST('opouvertureprevueyear'); +$filter_opouvertureprevue=GETPOST('filter_opouvertureprevue'); + $op1month=GETPOST('op1month'); $op1day=GETPOST('op1day'); $op1year=GETPOST('op1year'); $filter_op1=GETPOST('filter_op1'); + $op2month=GETPOST('op2month'); $op2day=GETPOST('op2day'); $op2year=GETPOST('op2year'); $filter_op2=GETPOST('filter_op2'); +$opcloturemonth=GETPOST('opcloturemonth'); +$opclotureday=GETPOST('opclotureday'); +$opclotureyear=GETPOST('opclotureyear'); +$filter_opcloture=GETPOST('filter_opcloture'); + // Security check $contratid = GETPOST('id','int'); if (! empty($user->societe_id)) $socid=$user->societe_id; @@ -88,12 +99,20 @@ $staticcontrat=new Contrat($db); $staticcontratligne=new ContratLigne($db); $companystatic=new Societe($db); -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers +/* + * Actions + */ + +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers { $search_name=""; $search_contract=""; $search_service=""; $search_status=-1; + $opouvertureprevuemonth=""; + $opouvertureprevueday=""; + $opouvertureprevueyear=""; + $filter_opouvertureprevue=""; $op1month=""; $op1day=""; $op1year=""; @@ -102,6 +121,10 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both $op2day=""; $op2year=""; $filter_op2=""; + $opcloturemonth=""; + $opclotureday=""; + $opclotureyear=""; + $filter_opcloture=""; $mode=''; $filter=''; } @@ -143,10 +166,14 @@ if ($search_name) $sql.= " AND s.nom LIKE '%".$db->escape($search_name)."%'" if ($search_contract) $sql.= " AND c.rowid = '".$db->escape($search_contract)."'"; if ($search_service) $sql.= " AND (p.ref LIKE '%".$db->escape($search_service)."%' OR p.description LIKE '%".$db->escape($search_service)."%' OR cd.description LIKE '%".$db->escape($search_service)."%')"; if ($socid > 0) $sql.= " AND s.rowid = ".$socid; +$filter_dateouvertureprevue=dol_mktime(0,0,0,$opouvertureprevuemonth,$opouvertureprevueday,$opouvertureprevueyear); $filter_date1=dol_mktime(0,0,0,$op1month,$op1day,$op1year); $filter_date2=dol_mktime(0,0,0,$op2month,$op2day,$op2year); -if (! empty($filter_op1) && $filter_op1 != -1 && $filter_date1 != '') $sql.= " AND date_ouverture_prevue ".$filter_op1." '".$db->idate($filter_date1)."'"; -if (! empty($filter_op2) && $filter_op2 != -1 && $filter_date2 != '') $sql.= " AND date_fin_validite ".$filter_op2." '".$db->idate($filter_date2)."'"; +$filter_datecloture=dol_mktime(0,0,0,$opcloturemonth,$opclotureday,$opclotureyear); +if (! empty($filter_opouvertureprevue) && $filter_opouvertureprevue != -1 && $filter_dateouvertureprevue != '') $sql.= " AND cd.date_ouverture_prevue ".$filter_opouvertureprevue." '".$db->idate($filter_dateouvertureprevue)."'"; +if (! empty($filter_op1) && $filter_op1 != -1 && $filter_date1 != '') $sql.= " AND cd.date_ouverture ".$filter_op1." '".$db->idate($filter_date1)."'"; +if (! empty($filter_op2) && $filter_op2 != -1 && $filter_date2 != '') $sql.= " AND cd.date_fin_validite ".$filter_op2." '".$db->idate($filter_date2)."'"; +if (! empty($filter_opcloture) && $filter_opcloture != -1 && $filter_datecloture != '') $sql.= " AND cd.date_cloture ".$filter_opcloture." '".$db->idate($filter_datecloture)."'"; $totalnboflines=0; $result=$db->query($sql); if ($result) @@ -170,11 +197,15 @@ if ($resql) if ($search_service) $param.='&search_service='.urlencode($search_service); if ($mode) $param.='&mode='.$mode; if ($filter) $param.='&filter='.$filter; + if (! empty($filter_opouvertureprevue) && $filter_opouvertureprevue != -1) $param.='&filter_opouvertureprevue='.urlencode($filter_opouvertureprevue); if (! empty($filter_op1) && $filter_op1 != -1) $param.='&filter_op1='.urlencode($filter_op1); if (! empty($filter_op2) && $filter_op2 != -1) $param.='&filter_op2='.urlencode($filter_op2); + if (! empty($filter_opcloture) && $filter_opcloture != -1) $param.='&filter_opcloture='.urlencode($filter_opcloture); + if ($filter_dateouvertureprevue != '') $param.='&opouvertureprevueday='.$opouvertureprevueday.'&opouvertureprevuemonth='.$opouvertureprevuemonth.'&opouvertureprevueyear='.$opouvertureprevueyear; if ($filter_date1 != '') $param.='&op1day='.$op1day.'&op1month='.$op1month.'&op1year='.$op1year; if ($filter_date2 != '') $param.='&op2day='.$op2day.'&op2month='.$op2month.'&op2year='.$op2year; - + if ($filter_datecloture != '') $param.='&opclotureday='.$op2day.'&opcloturemonth='.$op2month.'&opclotureyear='.$op2year; + $title=$langs->trans("ListOfServices"); if ($mode == "0") $title=$langs->trans("ListOfInactiveServices"); // Must use == "0" if ($mode == "4" && $filter != "expired") $title=$langs->trans("ListOfRunningServices"); @@ -191,11 +222,11 @@ if ($resql) print_liste_field_titre($langs->trans("Service"),$_SERVER["PHP_SELF"], "p.description",$param,"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"], "s.nom",$param,"","",$sortfield,$sortorder); // Date debut - if ($mode == "0") print_liste_field_titre($langs->trans("DateStartPlannedShort"),$_SERVER["PHP_SELF"], "cd.date_ouverture_prevue",$param,'',' align="center"',$sortfield,$sortorder); - if ($mode == "" || $mode > 0) print_liste_field_titre($langs->trans("DateStartRealShort"),$_SERVER["PHP_SELF"], "cd.date_ouverture",$param,'',' align="center"',$sortfield,$sortorder); + if (($mode == "" || $mode == -1) || $mode == "0") print_liste_field_titre($langs->trans("DateStartPlannedShort"),$_SERVER["PHP_SELF"], "cd.date_ouverture_prevue",$param,'',' align="center"',$sortfield,$sortorder); + if (($mode == "" || $mode == -1) || $mode > 0) print_liste_field_titre($langs->trans("DateStartRealShort"),$_SERVER["PHP_SELF"], "cd.date_ouverture",$param,'',' align="center"',$sortfield,$sortorder); // Date fin - if ($mode == "" || $mode < 5) print_liste_field_titre($langs->trans("DateEndPlannedShort"),$_SERVER["PHP_SELF"], "cd.date_fin_validite",$param,'',' align="center"',$sortfield,$sortorder); - else print_liste_field_titre($langs->trans("DateEndRealShort"),$_SERVER["PHP_SELF"], "cd.date_cloture",$param,'',' align="center"',$sortfield,$sortorder); + if (($mode == "" || $mode == -1) || $mode < 5) print_liste_field_titre($langs->trans("DateEndPlannedShort"),$_SERVER["PHP_SELF"], "cd.date_fin_validite",$param,'',' align="center"',$sortfield,$sortorder); + if (($mode == "" || $mode == -1) || $mode >= 5) print_liste_field_titre($langs->trans("DateEndRealShort"),$_SERVER["PHP_SELF"], "cd.date_cloture",$param,'',' align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"], "cd.statut,c.statut",$param,"","align=\"right\"",$sortfield,$sortorder); print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch '); print "\n"; @@ -214,20 +245,46 @@ if ($resql) print ''; - print ''; - print ''; + if (($mode == "" || $mode == -1) || $mode == "0") + { + print ''; + } + if (($mode == "" || $mode == -1) || $mode > 0) + { + print ''; + } + if (($mode == "" || $mode == -1) || $mode < 5) + { + print ''; + } + if (($mode == "" || $mode == -1) || $mode >= 5) + { + print ''; + } print ''; // Start date - if ($mode == "0") { + if (($mode == "" || $mode == -1) || $mode == "0") + { print ''; } - if ($mode == "" || $mode > 0) print ''; + if (($mode == "" || $mode == -1) || $mode > 0) + { + print ''; + } // Date fin - if ($mode == "" || $mode < 5) print ''; print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ' '; - $searchpitco=$form->showFilterAndCheckAddButtons(0); - print $searchpitco; + if (! empty($arrayfields['c.ref']['checked'])) + { + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print $form->select_country($search_country,'search_country','',0,'maxwidth100'); + print ''; + 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 ''; + //print $langs->trans('Month').': '; + if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; + print ''; + //print ' '.$langs->trans('Year').': '; + $syear = $year; + $formother->select_year($syear,'year',1, 20, 5); + print ''; + 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 ''; + } + print ''; + print ''; + print ''; + $searchpitco=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1); + print $searchpitco; print '
'; - print img_object($langs->trans("ShowContract"),"contract").' '.(isset($obj->ref) ? $obj->ref : $obj->cid) .''; - if ($obj->nb_late) print img_warning($langs->trans("Late")); - print ''.$obj->ref_customer.''.$obj->ref_supplier.''.img_object($langs->trans("ShowCompany"),"company").' '.$obj->name.''.dol_print_date($obj->datec).''; - 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 ''; - print $nbofsalesrepresentative; - print ''; - } - 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 '
'.$userstatic->getNomUrl(1); - $j++; - if ($j < $nbofsalesrepresentative) print ', '; - print '
'; - } - } - //else print $langs->trans("NoSalesRepresentativeAffected"); + print '
'; + print img_object($langs->trans("ShowContract"),"contract").' '.(isset($obj->ref) ? $obj->ref : $obj->rowid) .''; + if ($obj->nb_late) print img_warning($langs->trans("Late")); + print ''.$obj->ref_customer.''.$obj->ref_supplier.''.img_object($langs->trans("ShowCompany"),"company").' '.$obj->name.''; + print $obj->town; + print ''; + print $obj->zip; + print '".$obj->state_name."'; + $tmparray=getCountry($obj->fk_pays,'all'); + print $tmparray['label']; + print ''; + if (count($typenArray)==0) $typenArray = $formcompany->typent_array(1); + print $typenArray[$obj->typent_code]; + print ''; + 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 ''; + print $nbofsalesrepresentative; + print ''; + } + 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 '
'.$userstatic->getNomUrl(1); + $j++; + if ($j < $nbofsalesrepresentative) print ', '; + print '
'; + } + } + //else print $langs->trans("NoSalesRepresentativeAffected"); + } + else + { + print ' '; + } + print '
'.dol_print_date($db->jdate($obj->date_contrat), 'day').''; + print dol_print_date($db->jdate($obj->date_creation), 'dayhour'); + print ''; + print dol_print_date($db->jdate($obj->date_update), 'dayhour'); + print ''.($obj->nb_initial>0?$obj->nb_initial:'').''.($obj->nb_running>0?$obj->nb_running:'').''.($obj->nb_expired>0?$obj->nb_expired:'').''.($obj->nb_closed>0 ?$obj->nb_closed:'').''; + 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 ''; } print ''.dol_print_date($db->jdate($obj->date_contrat)).''.$staticcontrat->LibStatut($obj->statut,3).''.($obj->nb_initial>0?$obj->nb_initial:'').''.($obj->nb_running>0?$obj->nb_running:'').''.($obj->nb_expired>0?$obj->nb_expired:'').''.($obj->nb_closed>0 ?$obj->nb_closed:'').'
'.$langs->trans('Ref').''.$form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', '').'
'.$langs->trans('Ref').''.$form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', '').'
'.$langs->trans("Customer").'
'; print ''; print ''; - $arrayofoperators=array('<'=>'<','>'=>'>'); - print $form->selectarray('filter_op1',$arrayofoperators,$filter_op1,1); - print ' '; - $filter_date1=dol_mktime(0,0,0,$op1month,$op1day,$op1year); - print $form->select_date($filter_date1,'op1',0,0,1,'',1,0,1); - print ''; - $arrayofoperators=array('<'=>'<','>'=>'>'); - print $form->selectarray('filter_op2',$arrayofoperators,$filter_op2,1); - print ' '; - $filter_date2=dol_mktime(0,0,0,$op2month,$op2day,$op2year); - print $form->select_date($filter_date2,'op2',0,0,1,'',1,0,1); - print ''; + $arrayofoperators=array('<'=>'<','>'=>'>'); + print $form->selectarray('filter_opouvertureprevue',$arrayofoperators,$filter_opouvertureprevue,1); + print ' '; + $filter_dateouvertureprevue=dol_mktime(0,0,0,$opouvertureprevuemonth,$opouvertureprevueday,$opouvertureprevueyear); + print $form->select_date($filter_dateouvertureprevue,'opouvertureprevue',0,0,1,'',1,0,1); + print ''; + $arrayofoperators=array('<'=>'<','>'=>'>'); + print $form->selectarray('filter_op1',$arrayofoperators,$filter_op1,1); + print ' '; + $filter_date1=dol_mktime(0,0,0,$op1month,$op1day,$op1year); + print $form->select_date($filter_date1,'op1',0,0,1,'',1,0,1); + print ''; + $arrayofoperators=array('<'=>'<','>'=>'>'); + print $form->selectarray('filter_op2',$arrayofoperators,$filter_op2,1); + print ' '; + $filter_date2=dol_mktime(0,0,0,$op2month,$op2day,$op2year); + print $form->select_date($filter_date2,'op2',0,0,1,'',1,0,1); + print ''; + $arrayofoperators=array('<'=>'<','>'=>'>'); + print $form->selectarray('filter_opcloture',$arrayofoperators,$filter_opcloture,1); + print ' '; + $filter_date_cloture=dol_mktime(0,0,0,$opcloturemonth,$opclotureday,$opclotureyear); + print $form->select_date($filter_date_cloture,'opcloture',0,0,1,'',1,0,1); + print ''; $arrayofstatus=array( '0'=>$langs->trans("ServiceStatusInitial"), @@ -287,7 +344,8 @@ if ($resql) print ''; print ($obj->date_ouverture_prevue?dol_print_date($db->jdate($obj->date_ouverture_prevue)):' '); if ($db->jdate($obj->date_ouverture_prevue) && ($db->jdate($obj->date_ouverture_prevue) < ($now - $conf->contrat->services->inactifs->warning_delay))) @@ -295,13 +353,24 @@ if ($resql) else print '    '; print ''.($obj->date_ouverture?dol_print_date($db->jdate($obj->date_ouverture)):' ').''.($obj->date_ouverture?dol_print_date($db->jdate($obj->date_ouverture)):' ').''.($obj->date_fin_validite?dol_print_date($db->jdate($obj->date_fin_validite)):' '); - else print ''.dol_print_date($db->jdate($obj->date_cloture)); + if (($mode == "" || $mode == -1) || $mode < 5) + { + print ''.($obj->date_fin_validite?dol_print_date($db->jdate($obj->date_fin_validite)):' '); + if ($obj->date_fin_validite && $db->jdate($obj->date_fin_validite) < ($now - $conf->contrat->services->expires->warning_delay) && $obj->statut < 5) + { + $warning_delay=$conf->contrat->services->expires->warning_delay / 3600 / 24; + $textlate = $langs->trans("Late").' = '.$langs->trans("DateReference").' > '.$langs->trans("DateToday").' '.(ceil($warning_delay) >= 0 ? '+' : '').ceil($warning_delay).' '.$langs->trans("days"); + print img_warning($textlate); + } + else print '    '; + } + if (($mode == "" || $mode == -1) || $mode >= 5) print ''.dol_print_date($db->jdate($obj->date_cloture)); // Icone warning - if ($obj->date_fin_validite && $db->jdate($obj->date_fin_validite) < ($now - $conf->contrat->services->expires->warning_delay) && $obj->statut < 5) print img_warning($langs->trans("Late")); - else print '    '; print ''; if ($obj->cstatut == 0) // If contract is draft, we say line is also draft diff --git a/htdocs/core/actions_builddoc.inc.php b/htdocs/core/actions_builddoc.inc.php index 9502d723013..5984283b996 100644 --- a/htdocs/core/actions_builddoc.inc.php +++ b/htdocs/core/actions_builddoc.inc.php @@ -24,10 +24,10 @@ // $action must be defined // $id must be defined -// $object must be defined and must have a method generateDocument. +// $object must be defined and must have a method generateDocument(). // $permissioncreate must be defined // $upload_dir must be defined (example $conf->projet->dir_output . "/";) -// $hidedetails, $hidedesc and $hideref may have been set or not. +// $hidedetails, $hidedesc, $hideref and $moreparams may have been set or not. // Build doc @@ -49,20 +49,24 @@ if ($action == 'builddoc' && $permissioncreate) }*/ // Save last template used to generate document - if (GETPOST('model')) $object->setDocModel($user, GETPOST('model','alpha')); + if (GETPOST('model')) + { + $object->setDocModel($user, GETPOST('model','alpha')); + } - // Special case for invoices - if (property_exists($object, 'fk_bank')) - { + // Special case to force bank account + //if (property_exists($object, 'fk_bank')) + //{ if (GETPOST('fk_bank')) { // this field may come from an external module $object->fk_bank = GETPOST('fk_bank'); - } else { + } else if (! empty($object->fk_account)) { $object->fk_bank = $object->fk_account; } - } + //} $outputlangs = $langs; $newlang=''; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id'); if ($conf->global->MAIN_MULTILANGS && empty($newlang) && isset($object->thirdparty->default_lang)) $newlang=$object->thirdparty->default_lang; // for proposal, order, invoice, ... if ($conf->global->MAIN_MULTILANGS && empty($newlang) && isset($object->default_lang)) $newlang=$object->default_lang; // for thirdparty @@ -76,13 +80,18 @@ if ($action == 'builddoc' && $permissioncreate) if (empty($hidedetails)) $hidedetails=0; if (empty($hidedesc)) $hidedesc=0; if (empty($hideref)) $hideref=0; + if (empty($moreparams)) $moreparams=null; - $result= $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); + $result= $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams); if ($result <= 0) { setEventMessages($object->error, $object->errors, 'errors'); $action=''; } + else + { + setEventMessages($langs->trans("FileGenerated"), null); + } } } diff --git a/htdocs/core/actions_dellink.inc.php b/htdocs/core/actions_dellink.inc.php index 45fb8c5f9ec..63218dde739 100644 --- a/htdocs/core/actions_dellink.inc.php +++ b/htdocs/core/actions_dellink.inc.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2015-2016 Laurent Destailleur * * 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 @@ -18,22 +18,29 @@ /** * \file htdocs/core/actions_dellink.inc.php - * \brief Code for actions on deleting link between elements + * \brief Code for actions on linking and deleting link between elements */ // $action must be defined // $object must be defined // $permissiondellink must be defined -// $uploaddir (example $conf->projet->dir_output . "/";) $dellinkid = GETPOST('dellinkid','int'); +$addlinkid = GETPOST('idtolinkto','int'); -// Set public note +// Link invoice to order +if ($action == 'addlink' && ! empty($permissiondellink) && ! GETPOST('cancel') && $id > 0 && $addlinkid > 0) +{ + $object->fetch($id); + $object->fetch_thirdparty(); + $result = $object->add_object_linked(GETPOST('addlink'), $addlinkid); +} + +// Delete link if ($action == 'dellink' && ! empty($permissiondellink) && ! GETPOST('cancel') && $dellinkid > 0) { $result=$object->deleteObjectLinked(0, '', 0, '', $dellinkid); if ($result < 0) setEventMessages($object->error,$object->errors,'errors'); } - diff --git a/htdocs/core/actions_extrafields.inc.php b/htdocs/core/actions_extrafields.inc.php index 6a162123ce0..afcf929589b 100644 --- a/htdocs/core/actions_extrafields.inc.php +++ b/htdocs/core/actions_extrafields.inc.php @@ -313,6 +313,7 @@ if ($action == 'update') $params['options'][$key] = $value; } } + $result=$extrafields->update( GETPOST('attrname'), GETPOST('label'), diff --git a/htdocs/core/actions_linkedfiles.inc.php b/htdocs/core/actions_linkedfiles.inc.php index 22ff9155fd1..672da011a79 100644 --- a/htdocs/core/actions_linkedfiles.inc.php +++ b/htdocs/core/actions_linkedfiles.inc.php @@ -22,7 +22,7 @@ // Variable $upload_dir must be defined when entering here // Variable $upload_dirold may also exists. -// Send file/link +// Submit file/link if (GETPOST('sendit') && ! empty($conf->global->MAIN_UPLOAD_DOC)) { if ($object->id) @@ -40,7 +40,7 @@ elseif (GETPOST('linkit') && ! empty($conf->global->MAIN_UPLOAD_DOC)) $link = GETPOST('link', 'alpha'); if ($link) { - if (substr($link, 0, 7) != 'http://' && substr($link, 0, 8) != 'https://') { + if (substr($link, 0, 7) != 'http://' && substr($link, 0, 8) != 'https://' && substr($link, 0, 7) != 'file://') { $link = 'http://' . $link; } dol_add_file_process($upload_dir, 0, 1, 'userfile', null, $link); @@ -124,7 +124,7 @@ elseif ($action == 'confirm_updateline' && GETPOST('save') && GETPOST('link', 'a if ($f) { $link->url = GETPOST('link', 'alpha'); - if (substr($link->url, 0, 7) != 'http://' && substr($link->url, 0, 8) != 'https://') + if (substr($link->url, 0, 7) != 'http://' && substr($link->url, 0, 8) != 'https://' && substr($link->url, 0, 7) != 'file://') { $link->url = 'http://' . $link->url; } @@ -140,4 +140,33 @@ elseif ($action == 'confirm_updateline' && GETPOST('save') && GETPOST('link', 'a //error fetching } } - +elseif ($action == 'renamefile' && GETPOST('renamefilesave')) +{ + if ($object->id) + { + // For documents pages, upload_dir contains already path to file from module dir, so we clean path into urlfile. + //var_dump($upload_dir);exit; + if (! empty($upload_dir)) + { + $filenamefrom=dol_sanitizeFileName(GETPOST('renamefilefrom')); + $filenameto=dol_sanitizeFileName(GETPOST('renamefileto')); + if ($filenamefrom && $filenameto) + { + $srcpath = $upload_dir.'/'.$filenamefrom; + $destpath = $upload_dir.'/'.$filenameto; + + $result = dol_move($srcpath, $destpath); + if ($result) + { + $object->addThumbs($destpath); + + // TODO Add revert function of addThumbs + //$object->delThumbs($srcpath); + + setEventMessages($langs->trans("FileRenamed"), null); + } + else setEventMessages($langs->trans("ErrorFailToRenameFile", $filenamefrom, $filenameto), null, 'errors'); + } + } + } +} diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php new file mode 100644 index 00000000000..085f98b0218 --- /dev/null +++ b/htdocs/core/actions_massactions.inc.php @@ -0,0 +1,499 @@ + + * + * 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 . + * or see http://www.gnu.org/ + */ + +/** + * \file htdocs/core/actions_massactions.inc.php + * \brief Code for actions done with massaction button (send by email, merge pdf, delete, ...) + */ + + +// $massaction must be defined +// $objectclass and $$objectlabel must be defined +// $uploaddir (example $conf->projet->dir_output . "/";) +// $toselect may be defined + + +// Protection +if (empty($objectclass) || empty($uploaddir)) +{ + dol_print_error(null, 'include of actions_massactions.inc.php is done but var $massaction or $objectclass or $uploaddir was not defined'); + exit; +} + + +// Mass actions. Controls on number of lines checked +$maxformassaction=1000; +if (! empty($massaction) && count($toselect) < 1) +{ + $error++; + setEventMessages($langs->trans("NoLineChecked"), null, "warnings"); +} +if (! $error && count($toselect) > $maxformassaction) +{ + setEventMessages($langs->trans('TooManyRecordForMassAction',$maxformassaction), null, 'errors'); + $error++; +} + + +if (! $error && $massaction == 'confirm_presend') +{ + $resaction = ''; + $nbsent = 0; + $nbignored = 0; + $langs->load("mails"); + include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + + if (!$error && !isset($user->email)) + { + $error++; + setEventMessages($langs->trans("NoSenderEmailDefined"), null, 'warnings'); + } + + if (! $error) + { + $thirdparty=new Societe($db); + $objecttmp=new $objectclass($db); + $listofobjectid=array(); + $listofobjectthirdparties=array(); + $listofobjectref=array(); + foreach($toselect as $toselectid) + { + $objecttmp=new $objectclass($db); // must create new instance because instance is saved into $listofobjectref array for future use + $result=$objecttmp->fetch($toselectid); + if ($result > 0) + { + $listoinvoicesid[$toselectid]=$toselectid; + $thirdpartyid=$objecttmp->fk_soc?$objecttmp->fk_soc:$objecttmp->socid; + $listofobjectthirdparties[$thirdpartyid]=$thirdpartyid; + $listofobjectref[$thirdpartyid][$toselectid]=$objecttmp; + } + } + //var_dump($listofobjectthirdparties);exit; + + foreach ($listofobjectthirdparties as $thirdpartyid) + { + $result = $thirdparty->fetch($thirdpartyid); + if ($result < 0) + { + dol_print_error($db); + exit; + } + + // Define recipient $sendto and $sendtocc + if (trim($_POST['sendto'])) + { + // Recipient is provided into free text + $sendto = trim($_POST['sendto']); + $sendtoid = 0; + } + elseif ($_POST['receiver'] != '-1') + { + // Recipient was provided from combo list + if ($_POST['receiver'] == 'thirdparty') // Id of third party + { + $sendto = $thirdparty->email; + $sendtoid = 0; + } + else // Id du contact + { + $sendto = $thirdparty->contact_get_property((int) $_POST['receiver'],'email'); + $sendtoid = $_POST['receiver']; + } + } + if (trim($_POST['sendtocc'])) + { + $sendtocc = trim($_POST['sendtocc']); + } + elseif ($_POST['receivercc'] != '-1') + { + // Recipient was provided from combo list + if ($_POST['receivercc'] == 'thirdparty') // Id of third party + { + $sendtocc = $thirdparty->email; + } + else // Id du contact + { + $sendtocc = $thirdparty->contact_get_property((int) $_POST['receivercc'],'email'); + } + } + + //var_dump($listofobjectref[$thirdpartyid]); // Array of invoice for this thirdparty + + $attachedfiles=array('paths'=>array(), 'names'=>array(), 'mimes'=>array()); + $listofqualifiedinvoice=array(); + $listofqualifiedref=array(); + foreach($listofobjectref[$thirdpartyid] as $objectid => $object) + { + //var_dump($object); + //var_dump($thirdpartyid.' - '.$objectid.' - '.$object->statut); + + if ($objectclass == 'Facture' && $object->statut != Facture::STATUS_VALIDATED) + { + $nbignored++; + $resaction.='
'.$langs->trans('ErrorOnlyInvoiceValidatedCanBeSentInMassAction',$object->ref).'

'; + continue; // Payment done or started or canceled + } + if ($objectclass == 'Commande' && $object->statut == Commande::STATUS_DRAFT) + { + $nbignored++; + $resaction.='
'.$langs->trans('ErrorOnlyOrderNotDraftCanBeSentInMassAction',$object->ref).'

'; + continue; + } + + // Read document + // TODO Use future field $object->fullpathdoc to know where is stored default file + // TODO If not defined, use $object->modelpdf (or defaut invoice config) to know what is template to use to regenerate doc. + $filename=dol_sanitizeFileName($object->ref).'.pdf'; + $filedir=$uploaddir . '/' . dol_sanitizeFileName($object->ref); + $file = $filedir . '/' . $filename; + $mime = dol_mimetype($file); + + if (dol_is_file($file)) + { + if (empty($sendto)) // For the case, no recipient were set (multi thirdparties send) + { + $object->fetch_thirdparty(); + $sendto = $object->thirdparty->email; + } + + if (empty($sendto)) + { + //print "No recipient for thirdparty ".$object->thirdparty->name; + $nbignored++; + continue; + } + + if (dol_strlen($sendto)) + { + // Create form object + $attachedfiles=array( + 'paths'=>array_merge($attachedfiles['paths'],array($file)), + 'names'=>array_merge($attachedfiles['names'],array($filename)), + 'mimes'=>array_merge($attachedfiles['mimes'],array($mime)) + ); + } + + $listofqualifiedinvoice[$objectid]=$object; + $listofqualifiedref[$objectid]=$object->ref; + } + else + { + $nbignored++; + $langs->load("errors"); + $resaction.='
'.$langs->trans('ErrorCantReadFile',$file).'

'; + dol_syslog('Failed to read file: '.$file, LOG_WARNING); + continue; + } + + //var_dump($listofqualifiedref); + } + + if (count($listofqualifiedinvoice) > 0) + { + $langs->load("commercial"); + $from = $user->getFullName($langs) . ' <' . $user->email .'>'; + $replyto = $from; + $subject = GETPOST('subject'); + $message = GETPOST('message'); + $sendtocc = GETPOST('sentocc'); + $sendtobcc = (empty($conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO)?'':$conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO); + + $substitutionarray=array( + '__ID__' => join(', ',array_keys($listofqualifiedinvoice)), + '__EMAIL__' => $thirdparty->email, + '__CHECK_READ__' => '', + '__FACREF__' => join(', ',$listofqualifiedref), // For backward compatibility + '__ORDERREF__' => join(', ',$listofqualifiedref), // For backward compatibility + '__PROPREF__' => join(', ',$listofqualifiedref), // For backward compatibility + '__REF__' => join(', ',$listofqualifiedref), + '__REFCLIENT__' => $thirdparty->name + ); + + $subject=make_substitutions($subject, $substitutionarray); + $message=make_substitutions($message, $substitutionarray); + + $filepath = $attachedfiles['paths']; + $filename = $attachedfiles['names']; + $mimetype = $attachedfiles['mimes']; + + //var_dump($filepath); + + // Send mail + require_once(DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'); + $mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,$sendtobcc,$deliveryreceipt,-1); + if ($mailfile->error) + { + $resaction.='
'.$mailfile->error.'
'; + } + else + { + $result=$mailfile->sendfile(); + if ($result) + { + $resaction.=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2)).'
'; // Must not contain " + + $error=0; + + // Insert logs into agenda + foreach($listofqualifiedinvoice as $invid => $object) + { + if ($objectclass == 'Propale') $actiontypecode='AC_PROP'; + if ($objectclass == 'Commande') $actiontypecode='AC_COM'; + if ($objectclass == 'Facture') $actiontypecode='AC_FAC'; + if ($objectclass == 'Supplier_Proposal') $actiontypecode='AC_SUP_PRO'; + if ($objectclass == 'CommandeFournisseur') $actiontypecode='AC_SUP_ORD'; + if ($objectclass == 'FactureFournisseur') $actiontypecode='AC_SUP_INV'; + + $actionmsg=$langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto; + if ($message) + { + if ($sendtocc) $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc); + $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject); + $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":"); + $actionmsg = dol_concatdesc($actionmsg, $message); + } + + // Initialisation donnees + $object->sendtoid = 0; + $object->actiontypecode = $actiontypecode; + $object->actionmsg = $actionmsg; // Long text + $object->actionmsg2 = $actionmsg2; // Short text + $object->fk_element = $invid; + $object->elementtype = $object->element; + + // Appel des triggers + include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php"); + $interface=new Interfaces($db); + $result=$interface->run_triggers('BILL_SENTBYMAIL',$object,$user,$langs,$conf); + if ($result < 0) { $error++; $errors=$interface->errors; } + // Fin appel triggers + + if ($error) + { + setEventMessages($db->lasterror(), $errors, 'errors'); + dol_syslog("Error in trigger BILL_SENTBYMAIL ".$db->lasterror(), LOG_ERR); + } + $nbsent++; + } + } + else + { + $langs->load("other"); + if ($mailfile->error) + { + $resaction.=$langs->trans('ErrorFailedToSendMail',$from,$sendto); + $resaction.='
'.$mailfile->error.'
'; + } + else + { + $resaction.='
No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS
'; + } + } + } + } + } + + $resaction.=($resaction?'
':$resaction); + $resaction.=''.$langs->trans("ResultOfMailSending").':
'."\n"; + $resaction.=$langs->trans("NbSelected").': '.count($toselect)."\n
"; + $resaction.=$langs->trans("NbIgnored").': '.($nbignored?$nbignored:0)."\n
"; + $resaction.=$langs->trans("NbSent").': '.($nbsent?$nbsent:0)."\n
"; + + if ($nbsent) + { + $action=''; // Do not show form post if there was at least one successfull sent + //setEventMessages($langs->trans("EMailSentToNRecipients", $nbsent.'/'.count($toselect)), null, 'mesgs'); + setEventMessages($langs->trans("EMailSentForNElements", $nbsent.'/'.count($toselect)), null, 'mesgs'); + setEventMessages($resaction, null, 'mesgs'); + } + else + { + //setEventMessages($langs->trans("EMailSentToNRecipients", 0), null, 'warnings'); // May be object has no generated PDF file + setEventMessages($resaction, null, 'warnings'); + } + } + + $action='list'; + $massaction=''; +} + +if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_search')) +{ + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; + require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; + + $objecttmp=new $objectclass($db); + $listofobjectid=array(); + $listofobjectthirdparties=array(); + $listofobjectref=array(); + foreach($toselect as $toselectid) + { + $objecttmp=new $objectclass($db); // must create new instance because instance is saved into $listofobjectref array for future use + $result=$objecttmp->fetch($toselectid); + if ($result > 0) + { + $listoinvoicesid[$toselectid]=$toselectid; + $thirdpartyid=$objecttmp->fk_soc?$objecttmp->fk_soc:$objecttmp->socid; + $listofobjectthirdparties[$thirdpartyid]=$thirdpartyid; + $listofobjectref[$toselectid]=$objecttmp->ref; + } + } + + $arrayofinclusion=array(); + foreach($listofobjectref as $tmppdf) $arrayofinclusion[]=preg_quote($tmppdf.'.pdf','/'); + $listoffiles = dol_dir_list($uploaddir,'all',1,implode('|',$arrayofinclusion),'\.meta$|\.png','date',SORT_DESC,0,true); + + // build list of files with full path + $files = array(); + foreach($listofobjectref as $basename) + { + foreach($listoffiles as $filefound) + { + if (strstr($filefound["name"],$basename)) + { + $files[] = $uploaddir.'/'.$basename.'/'.$filefound["name"]; + break; + } + } + } + + // Define output language (Here it is not used because we do only merging existing PDF) + $outputlangs = $langs; + $newlang=''; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id'); + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->thirdparty->default_lang; + if (! empty($newlang)) + { + $outputlangs = new Translate("",$conf); + $outputlangs->setDefaultLang($newlang); + } + + // Create empty PDF + $pdf=pdf_getInstance(); + if (class_exists('TCPDF')) + { + $pdf->setPrintHeader(false); + $pdf->setPrintFooter(false); + } + $pdf->SetFont(pdf_getPDFFont($outputlangs)); + + if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); + + // Add all others + foreach($files as $file) + { + // Charge un document PDF depuis un fichier. + $pagecount = $pdf->setSourceFile($file); + for ($i = 1; $i <= $pagecount; $i++) + { + $tplidx = $pdf->importPage($i); + $s = $pdf->getTemplatesize($tplidx); + $pdf->AddPage($s['h'] > $s['w'] ? 'P' : 'L'); + $pdf->useTemplate($tplidx); + } + } + + // Create output dir if not exists + dol_mkdir($diroutputmassaction); + + // Save merged file + $filename=strtolower(dol_sanitizeFileName($langs->transnoentities($objectlabel))); + if ($filter=='paye:0') + { + if ($option=='late') $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid"))).'_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Late"))); + else $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid"))); + } + if ($year) $filename.='_'.$year; + if ($month) $filename.='_'.$month; + if ($pagecount) + { + $now=dol_now(); + $file=$diroutputmassaction.'/'.$filename.'_'.dol_print_date($now,'dayhourlog').'.pdf'; + $pdf->Output($file,'F'); + if (! empty($conf->global->MAIN_UMASK)) + @chmod($file, octdec($conf->global->MAIN_UMASK)); + + $langs->load("exports"); + setEventMessages($langs->trans('FileSuccessfullyBuilt',$filename.'_'.dol_print_date($now,'dayhourlog')), null, 'mesgs'); + } + else + { + setEventMessages($langs->trans('NoPDFAvailableForDocGenAmongChecked'), null, 'errors'); + } +} + +// Remove a file from massaction area +if ($action == 'remove_file') +{ + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + + $langs->load("other"); + $upload_dir = $diroutputmassaction; + $file = $upload_dir . '/' . GETPOST('file'); + $ret=dol_delete_file($file); + if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('file')), null, 'mesgs'); + else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('file')), null, 'errors'); + $action=''; +} + +// Delete records +if (! $error && $massaction == 'delete' && $permtodelete) +{ + $db->begin(); + + $objecttmp=new $objectclass($db); + $nbok = 0; + foreach($toselect as $toselectid) + { + $result=$objecttmp->fetch($toselectid); + if ($result > 0) + { + $result = $objecttmp->delete($user); + if ($result <= 0) + { + setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); + $error++; + break; + } + else $nbok++; + } + else + { + setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); + $error++; + break; + } + } + + if (! $error) + { + if ($nbok > 1) setEventMessages($langs->trans("RecordsDeleted", $nbok), null, 'mesgs'); + else setEventMessages($langs->trans("RecordDeleted", $nbok), null, 'mesgs'); + $db->commit(); + } + else + { + $db->rollback(); + } + //var_dump($listofobjectthirdparties);exit; +} + + + + diff --git a/htdocs/core/actions_printing.inc.php b/htdocs/core/actions_printing.inc.php index 5f04e42cc9b..061b98d1e9c 100644 --- a/htdocs/core/actions_printing.inc.php +++ b/htdocs/core/actions_printing.inc.php @@ -1,6 +1,6 @@ - * Copyright (C) 2014 Frederic France +/* Copyright (C) 2014-2016 Laurent Destailleur + * Copyright (C) 2014 Frederic France * * 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 @@ -44,7 +44,8 @@ if ($action == 'print_file' and $user->rights->printing->read) $printer = new $classname($db); //print '
'.print_r($printer, true).'
'; - if (! empty($conf->global->{$printer->active})) { + if (! empty($conf->global->{$printer->active})) + { $subdir=(GETPOST('printer', 'alpha')=='expedition'?'sending':''); $module = GETPOST('printer', 'alpha'); if ($module =='commande_fournisseur') { @@ -56,10 +57,11 @@ if ($action == 'print_file' and $user->rights->printing->read) //print '
'.print_r($printer->errors, true).'
'; setEventMessages($printer->error, $printer->errors, 'errors'); } - if ($ret==0) { + if ($ret==0) + { //print '
'.print_r($printer->errors, true).'
'; setEventMessages($printer->error, $printer->errors); - setEventMessages($langs->trans("FileWasSentToPrinter", basename(GETPOST('file'))).' '.$langs->trans("ViaModule").' '.$printer->name, null); + setEventMessages($langs->trans("FileWasSentToPrinter", basename(GETPOST('file'))).' '.$langs->transnoentitiesnoconv("ViaModule").' '.$printer->name, null); $printed++; } } diff --git a/htdocs/core/actions_sendmails.inc.php b/htdocs/core/actions_sendmails.inc.php index 58c48d5b254..9ec3bfcb3b7 100644 --- a/htdocs/core/actions_sendmails.inc.php +++ b/htdocs/core/actions_sendmails.inc.php @@ -21,26 +21,28 @@ * \brief Code for actions on sending mails from object page */ - -// TODO Include this include file into all element pages allowing email sending - +// $mysoc must be defined // $id must be defined // $actiontypecode must be defined // $paramname must be defined // $mode must be defined +// $object and $uobject may be defined. + /* * Add file in email form */ if (GETPOST('addfile')) { - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + $trackid = GETPOST('trackid','aZ09'); + + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; // Set tmp user directory $vardir=$conf->user->dir_output."/".$user->id; - $upload_dir_tmp = $vardir.'/temp'; + $upload_dir_tmp = $vardir.'/temp'; // TODO Add $keytoavoidconflict in upload_dir path - dol_add_file_process($upload_dir_tmp,0,0); + dol_add_file_process($upload_dir_tmp, 0, 0, 'addedfile', '', null, $trackid); $action='presend'; } @@ -49,42 +51,48 @@ if (GETPOST('addfile')) */ if (! empty($_POST['removedfile']) && empty($_POST['removAll'])) { + $trackid = GETPOST('trackid','aZ09'); + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; // Set tmp user directory $vardir=$conf->user->dir_output."/".$user->id; - $upload_dir_tmp = $vardir.'/temp'; + $upload_dir_tmp = $vardir.'/temp'; // TODO Add $keytoavoidconflict in upload_dir path - // TODO Delete only files that was uploaded from email form - dol_remove_file_process(GETPOST('removedfile','alpha'),0); + // TODO Delete only files that was uploaded from email form. This can be addressed by adding the trackid into the temp path then changing donotdeletefile to 2 instead of 1 to say "delete only if into temp dir" + // GETPOST('removedfile','alpha') is position of file into $_SESSION["listofpaths"...] array. + dol_remove_file_process(GETPOST('removedfile','alpha'), 0, 1, $trackid); // We do not delete because if file is the official PDF of doc, we don't want to remove it physically $action='presend'; } /* * Remove all files in email form */ - -if(! empty($_POST['removAll'])) +if (GETPOST('removAll')) { - $listofpaths=array(); + $trackid = GETPOST('trackid','aZ09'); + + $listofpaths=array(); $listofnames=array(); $listofmimes=array(); - if (! empty($_SESSION["listofpaths"])) $listofpaths=explode(';',$_SESSION["listofpaths"]); - if (! empty($_SESSION["listofnames"])) $listofnames=explode(';',$_SESSION["listofnames"]); - if (! empty($_SESSION["listofmimes"])) $listofmimes=explode(';',$_SESSION["listofmimes"]); + $keytoavoidconflict = empty($trackid)?'':'-'.$trackid; + if (! empty($_SESSION["listofpaths".$keytoavoidconflict])) $listofpaths=explode(';',$_SESSION["listofpaths".$keytoavoidconflict]); + if (! empty($_SESSION["listofnames".$keytoavoidconflict])) $listofnames=explode(';',$_SESSION["listofnames".$keytoavoidconflict]); + if (! empty($_SESSION["listofmimes".$keytoavoidconflict])) $listofmimes=explode(';',$_SESSION["listofmimes".$keytoavoidconflict]); include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; $formmail = new FormMail($db); - + $formmail->trackid = $trackid; + foreach($listofpaths as $key => $value) { $pathtodelete = $value; $filetodelete = $listofnames[$key]; - $result = dol_delete_file($pathtodelete,1); // Delete uploded Files - + $result = dol_delete_file($pathtodelete,1); // Delete uploded Files + $langs->load("other"); setEventMessages($langs->trans("FileWasRemoved",$filetodelete), null, 'mesgs'); - + $formmail->remove_attached_files($key); // Update Session } } @@ -94,56 +102,61 @@ if(! empty($_POST['removAll'])) */ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_POST['removAll'] && ! $_POST['removedfile'] && ! $_POST['cancel'] && !$_POST['modelselected']) { - if($conf->dolimail->enabled) $langs->load("dolimail@dolimail"); + $trackid = GETPOST('trackid','aZ09'); + $subject='';$actionmsg='';$actionmsg2=''; + + if (! empty($conf->dolimail->enabled)) $langs->load("dolimail@dolimail"); $langs->load('mails'); - $subject='';$actionmsg='';$actionmsg2=''; - - $result=$object->fetch($id); - - $sendtosocid=0; - if (method_exists($object,"fetch_thirdparty") && $object->element != 'societe') + if (is_object($object)) { - $result=$object->fetch_thirdparty(); - $thirdparty=$object->thirdparty; - $sendtosocid=$thirdparty->id; + $result=$object->fetch($id); + + $sendtosocid=0; + if (method_exists($object,"fetch_thirdparty") && $object->element != 'societe') + { + $result=$object->fetch_thirdparty(); + $thirdparty=$object->thirdparty; + $sendtosocid=$thirdparty->id; + } + else if ($object->element == 'societe') + { + $thirdparty=$object; + if ($thirdparty->id > 0) $sendtosocid=$thirdparty->id; + elseif($conf->dolimail->enabled) + { + $dolimail = new Dolimail($db); + $possibleaccounts=$dolimail->get_societe_by_email($_POST['sendto'],"1"); + $possibleuser=$dolimail->get_from_user_by_mail($_POST['sendto'],"1"); // suche in llx_societe and socpeople + if (!$possibleaccounts && !$possibleuser) + { + setEventMessages($langs->trans('ErrorFailedToFindSocieteRecord',$_POST['sendto']), null, 'errors'); + } + elseif (count($possibleaccounts)>1) + { + $sendtosocid=$possibleaccounts[1]['id']; + $result=$object->fetch($sendtosocid); + + setEventMessages($langs->trans('ErrorFoundMoreThanOneRecordWithEmail',$_POST['sendto'],$object->name), null, 'mesgs'); + } + else + { + if($possibleaccounts){ + $sendtosocid=$possibleaccounts[1]['id']; + $result=$object->fetch($sendtosocid); + }elseif($possibleuser){ + $sendtosocid=$possibleuser[0]['id']; + + $result=$uobject->fetch($sendtosocid); + $object=$uobject; + } + + } + } + } + else dol_print_error('','Use actions_sendmails.in.php for a type that is not supported'); } - else if ($object->element == 'societe') - { - $thirdparty=$object; - if ($thirdparty->id > 0) $sendtosocid=$thirdparty->id; - elseif($conf->dolimail->enabled) - { - $dolimail = new Dolimail($db); - $possibleaccounts=$dolimail->get_societe_by_email($_POST['sendto'],"1"); - $possibleuser=$dolimail->get_from_user_by_mail($_POST['sendto'],"1"); // suche in llx_societe and socpeople - if (!$possibleaccounts && !$possibleuser) - { - setEventMessages($langs->trans('ErrorFailedToFindSocieteRecord',$_POST['sendto']), null, 'errors'); - } - elseif (count($possibleaccounts)>1) - { - $sendtosocid=$possibleaccounts[1]['id']; - $result=$object->fetch($sendtosocid); - - setEventMessages($langs->trans('ErrorFoundMoreThanOneRecordWithEmail',$_POST['sendto'],$object->name), null, 'mesgs'); - } - else - { - if($possibleaccounts){ - $sendtosocid=$possibleaccounts[1]['id']; - $result=$object->fetch($sendtosocid); - }elseif($possibleuser){ - $sendtosocid=$possibleuser[0]['id']; - - $result=$uobject->fetch($sendtosocid); - $object=$uobject; - } - - } - } - } - else dol_print_error('','Use actions_sendmails.in.php for a type that is not supported'); + else $thirdparty = $mysoc; if ($result > 0) { @@ -158,7 +171,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO // Recipient was provided from combo list if ($_POST['receiver'] == 'thirdparty') // Id of third party { - $sendto = $thirdparty->email; + $sendto = $thirdparty->name.' <'.$thirdparty->email.'>'; $sendtoid = 0; } else // Id du contact @@ -176,7 +189,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO // Recipient was provided from combo list if ($_POST['receivercc'] == 'thirdparty') // Id of third party { - $sendtocc = $thirdparty->email; + $sendtocc = $thirdparty->name.' <'.$thirdparty->email.'>'; } else // Id du contact { @@ -186,26 +199,50 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO if (dol_strlen($sendto)) { + require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; + $langs->load("commercial"); - $from = $_POST['fromname'] . ' <' . $_POST['frommail'] .'>'; - $replyto = $_POST['replytoname']. ' <' . $_POST['replytomail'].'>'; + $fromtype = GETPOST('fromtype'); + if ($fromtype === 'user') { + $from = $user->getFullName($langs) .' <'.$user->email.'>'; + } + elseif ($fromtype === 'company') { + $from = $conf->global->MAIN_INFO_SOCIETE_NOM .' <'.$conf->global->MAIN_INFO_SOCIETE_MAIL.'>'; + } + elseif (preg_match('/user_aliases_(\d+)/', $fromtype, $reg)) { + $tmp=explode(',', $user->email_aliases); + $from = trim($tmp[($reg[1] - 1)]); + } + elseif (preg_match('/global_aliases_(\d+)/', $fromtype, $reg)) { + $tmp=explode(',', $conf->global->MAIN_INFO_SOCIETE_MAIL_ALIASES); + $from = trim($tmp[($reg[1] - 1)]); + } + else { + $from = $_POST['fromname'] . ' <' . $_POST['frommail'] .'>'; + } + + $replyto = $_POST['replytoname']. ' <' . $_POST['replytomail'].'>'; $message = $_POST['message']; $sendtobcc= GETPOST('sendtoccc'); if ($mode == 'emailfromproposal') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO)); if ($mode == 'emailfromorder') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_ORDER_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_ORDER_TO)); if ($mode == 'emailfrominvoice') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO)); - + if ($mode == 'emailfromsupplierproposal') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_PROPOSAL_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_PROPOSAL_TO)); + if ($mode == 'emailfromsupplierorder') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_ORDER_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_ORDER_TO)); + if ($mode == 'emailfromsupplierinvoice') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO)); + $deliveryreceipt = $_POST['deliveryreceipt']; if ($action == 'send' || $action == 'relance') { if (dol_strlen($_POST['subject'])) $subject = $_POST['subject']; - $actionmsg2=$langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto; + $actionmsg2=$langs->transnoentities('MailSentBy').' '.CMailFile::getValidAddress($from,4,0,1).' '.$langs->transnoentities('To').' '.CMailFile::getValidAddress($sendto,4,0,1); if ($message) { - $actionmsg=$langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto; - if ($sendtocc) $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc); + $actionmsg=$langs->transnoentities('MailFrom').': '.dol_escape_htmltag($from); + $actionmsg=dol_concatdesc($actionmsg, $langs->transnoentities('MailTo').': '.dol_escape_htmltag($sendto)); + if ($sendtocc) $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . dol_escape_htmltag($sendtocc)); $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject); $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":"); $actionmsg = dol_concatdesc($actionmsg, $message); @@ -215,13 +252,13 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO // Create form object include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; $formmail = new FormMail($db); - + $formmail->trackid = $trackid; // $trackid must be defined + $attachedfiles=$formmail->get_attached_files(); $filepath = $attachedfiles['paths']; $filename = $attachedfiles['names']; $mimetype = $attachedfiles['mimes']; - $trackid = GETPOST('trackid','aZ09'); // Feature to push mail sent into Sent folder if (! empty($conf->dolimail->enabled)) @@ -236,41 +273,41 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO $mailboxconfig = new IMAP($db); $mailboxconfig->fetch($mbid); if ($mailboxconfig->mailbox_imap_host) $ref=$mailboxconfig->get_ref(); - + $mailboxconfig->folder_id=$mailboxconfig->mailbox_imap_outbox; $mailboxconfig->userfolder_fetch(); - + if ($mailboxconfig->mailbox_save_sent_mails == 1) { - + $folder=str_replace($ref, '', $mailboxconfig->folder_cache_key); if (!$folder) $folder = "Sent"; // Default Sent folder - + $mailboxconfig->mbox = imap_open($mailboxconfig->get_connector_url().$folder, $mailboxconfig->mailbox_imap_login, $mailboxconfig->mailbox_imap_password); - if (FALSE === $mailboxconfig->mbox) + if (FALSE === $mailboxconfig->mbox) { $info = FALSE; $err = $langs->trans('Error3_Imap_Connection_Error'); setEventMessages($err,$mailboxconfig->element, null, 'errors'); - } - else + } + else { $mailboxconfig->mailboxid=$_POST['frommail']; $mailboxconfig->foldername=$folder; $from = $mailfromid[0] . $mailfromid[2]; $imap=1; } - - } + + } } } - + // Send mail - require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; $mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,$sendtobcc,$deliveryreceipt,-1,'','',$trackid); if ($mailfile->error) { - $mesgs[]='
'.$mailfile->error.'
'; + setEventMessage($mailfile->error, 'errors'); + $action='presend'; } else { @@ -278,7 +315,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO if ($result) { $error=0; - + // FIXME This must be moved into a trigger for action $trigger_name if (! empty($conf->dolimail->enabled)) { @@ -289,13 +326,13 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO $dolimail=new DoliMail($db); $dolimail->id = $mid; $res=$dolimail->set_prop($user, 'answered',1); - } + } if ($imap==1) { // write mail to IMAP Server - $movemail = $mailboxconfig->putMail($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,$folder,$deliveryreceipt,$mailfile); + $movemail = $mailboxconfig->putMail($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,$folder,$deliveryreceipt,$mailfile); if ($movemail) setEventMessages($langs->trans("MailMovedToImapFolder",$folder), null, 'mesgs'); - else setEventMessages($langs->trans("MailMovedToImapFolder_Warning",$folder), null, 'warnings'); + else setEventMessages($langs->trans("MailMovedToImapFolder_Warning",$folder), null, 'warnings'); } } @@ -305,6 +342,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO $object->actiontypecode = $actiontypecode; $object->actionmsg = $actionmsg; // Long text $object->actionmsg2 = $actionmsg2; // Short text + $object->trackid = $trackid; $object->fk_element = $object->id; $object->elementtype = $object->element; @@ -313,7 +351,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO $interface=new Interfaces($db); $result=$interface->run_triggers($trigger_name,$object,$user,$langs,$conf); if ($result < 0) { - $error++; $this->errors=$interface->errors; + $error++; $errors=$interface->errors; } // End call of triggers @@ -327,8 +365,8 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO // This avoid sending mail twice if going out and then back to page $mesg=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2)); setEventMessages($mesg, null, 'mesgs'); - if($conf->dolimail->enabled) header('Location: '.$_SERVER["PHP_SELF"].'?'.($paramname?$paramname:'id').'='.$object->id.'&'.($paramname2?$paramname2:'mid').'='.$parm2val); - else header('Location: '.$_SERVER["PHP_SELF"].'?'.($paramname?$paramname:'id').'='.$object->id); + if ($conf->dolimail->enabled) header('Location: '.$_SERVER["PHP_SELF"].'?'.($paramname?$paramname:'id').'='.$object->id.'&'.($paramname2?$paramname2:'mid').'='.$parm2val); + else header('Location: '.$_SERVER["PHP_SELF"].'?'.($paramname?$paramname:'id').'='.$object->id); exit; } } @@ -351,13 +389,6 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO $action = 'presend'; } } - /* } - else - { - $langs->load("other"); - $mesgs[]='
'.$langs->trans('ErrorMailRecipientIsEmpty').'
'; - dol_syslog('Recipient email is empty'); - }*/ } else { diff --git a/htdocs/core/ajax/ajaxdirpreview.php b/htdocs/core/ajax/ajaxdirpreview.php index f1352f8e933..4ff36a1e88b 100644 --- a/htdocs/core/ajax/ajaxdirpreview.php +++ b/htdocs/core/ajax/ajaxdirpreview.php @@ -82,6 +82,7 @@ else // For no ajax call $relativepath=$ecmdir->getRelativePath(); $upload_dir = $conf->ecm->dir_output.'/'.$relativepath; } +if (empty($url)) $url=DOL_URL_ROOT.'/ecm/index.php'; // Load traductions files $langs->load("ecm"); @@ -138,10 +139,10 @@ if (! dol_is_dir($upload_dir)) } print ''."\n"; -print ''."\n"; +print ''."\n"; $param=($sortfield?'&sortfield='.$sortfield:'').($sortorder?'&sortorder='.$sortorder:''); -$url=DOL_URL_ROOT.'/ecm/index.php'; + // Dir scan if ($type == 'directory') @@ -153,7 +154,7 @@ if ($type == 'directory') $sorting = (strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC); // Right area. If module is defined, we are in automatic ecm. - $automodules = array('company', 'invoice', 'invoice_supplier', 'propal', 'order', 'order_supplier', 'contract', 'product', 'tax', 'project', 'fichinter', 'user'); + $automodules = array('company', 'invoice', 'invoice_supplier', 'propal', 'order', 'order_supplier', 'contract', 'product', 'tax', 'project', 'fichinter', 'user', 'expensereport'); // TODO change for multicompany sharing // Auto area for suppliers invoices @@ -188,6 +189,8 @@ if ($type == 'directory') else if ($module == 'fichinter') $upload_dir = $conf->ficheinter->dir_output; // Auto area for users else if ($module == 'user') $upload_dir = $conf->user->dir_output; + // Auto area for expense report + else if ($module == 'expensereport') $upload_dir = $conf->expensereport->dir_output; if (in_array($module, $automodules)) { diff --git a/htdocs/core/ajax/saveinplace.php b/htdocs/core/ajax/saveinplace.php index 4d0ab65a941..48797dd0432 100644 --- a/htdocs/core/ajax/saveinplace.php +++ b/htdocs/core/ajax/saveinplace.php @@ -35,6 +35,19 @@ $element = GETPOST('element','alpha',2); $table_element = GETPOST('table_element','alpha',2); $fk_element = GETPOST('fk_element','alpha',2); +/* Example: +field:editval_ref_customer (8 first chars will removed to know name of property) +element:contrat +table_element:contrat +fk_element:4 +type:string +value:aaa +loadmethod: +savemethod: +savemethodname: +*/ + + /* * View */ @@ -81,7 +94,7 @@ if (! empty($field) && ! empty($element) && ! empty($table_element) && ! empty($ } else $newelement = $element; - if (! empty($user->rights->$newelement->creer) || ! empty($user->rights->$newelement->write) + if (! empty($user->rights->$newelement->creer) || ! empty($user->rights->$newelement->create) || ! empty($user->rights->$newelement->write) || (isset($subelement) && (! empty($user->rights->$newelement->$subelement->creer) || ! empty($user->rights->$newelement->$subelement->write))) || ($element == 'payment' && $user->rights->facture->paiement) || ($element == 'payment_supplier' && $user->rights->fournisseur->facture->creer)) diff --git a/htdocs/core/ajax/selectsearchbox.php b/htdocs/core/ajax/selectsearchbox.php index 416975acfdb..2e837fcbaae 100644 --- a/htdocs/core/ajax/selectsearchbox.php +++ b/htdocs/core/ajax/selectsearchbox.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2015-2016 Laurent Destailleur * * 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 @@ -22,16 +22,19 @@ */ -// This script is called with a POST method. -// Directory to scan (full path) is inside POST['dir']. +// This script is called with a POST method or as an include. -if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1); // Disables token renewal -//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); -if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); -if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); -if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); +if (! isset($usedbyinclude) || empty($usedbyinclude)) +{ + if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1); // Disables token renewal + //if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); + if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); + if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); + if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); + + $res=@include '../../main.inc.php'; +} -$res=@include '../../main.inc.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php'; //global $hookmanager; @@ -44,81 +47,85 @@ $arrayresult=array(); // Define $searchform if ((( ! empty($conf->societe->enabled) && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))) || ! empty($conf->fournisseur->enabled)) && empty($conf->global->MAIN_SEARCHFORM_SOCIETE_DISABLED) && $user->rights->societe->lire) { - $arrayresult['searchintothirdparty']=array('text'=>img_picto('','object_company').' '.$langs->trans("SearchIntoThirdparties", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/societe/list.php?sall='.urlencode($search_boxvalue)); + $arrayresult['searchintothirdparty']=array('img'=>'object_company', 'label'=>$langs->trans("SearchIntoThirdparties", $search_boxvalue), 'text'=>img_picto('','object_company').' '.$langs->trans("SearchIntoThirdparties", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/societe/list.php?sall='.urlencode($search_boxvalue)); } if (! empty($conf->societe->enabled) && empty($conf->global->MAIN_SEARCHFORM_CONTACT_DISABLED) && $user->rights->societe->lire) { - $arrayresult['searchintocontact']=array('text'=>img_picto('','object_contact').' '.$langs->trans("SearchIntoContacts", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/contact/list.php?sall='.urlencode($search_boxvalue)); + $arrayresult['searchintocontact']=array('img'=>'object_contact', 'label'=>$langs->trans("SearchIntoContacts", $search_boxvalue), 'text'=>img_picto('','object_contact').' '.$langs->trans("SearchIntoContacts", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/contact/list.php?sall='.urlencode($search_boxvalue)); } if (((! empty($conf->product->enabled) && $user->rights->produit->lire) || (! empty($conf->service->enabled) && $user->rights->service->lire)) && empty($conf->global->MAIN_SEARCHFORM_PRODUITSERVICE_DISABLED)) { - $arrayresult['searchintoproduct']=array('text'=>img_picto('','object_product').' '.$langs->trans("SearchIntoProductsOrServices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/product/list.php?sall='.urlencode($search_boxvalue)); + $arrayresult['searchintoproduct']=array('img'=>'object_product', 'label'=>$langs->trans("SearchIntoProductsOrServices", $search_boxvalue),'text'=>img_picto('','object_product').' '.$langs->trans("SearchIntoProductsOrServices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/product/list.php?sall='.urlencode($search_boxvalue)); } if (! empty($conf->projet->enabled) && empty($conf->global->MAIN_SEARCHFORM_PROJECT_DISABLED) && $user->rights->projet->lire) { - $arrayresult['searchintoprojects']=array('text'=>img_picto('','object_projectpub').' '.$langs->trans("SearchIntoProjects", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/projet/list.php?search_all='.urlencode($search_boxvalue)); + $arrayresult['searchintoprojects']=array('img'=>'object_projectpub', 'label'=>$langs->trans("SearchIntoProjects", $search_boxvalue), 'text'=>img_picto('','object_projectpub').' '.$langs->trans("SearchIntoProjects", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/projet/list.php?search_all='.urlencode($search_boxvalue)); +} +if (! empty($conf->projet->enabled) && empty($conf->global->MAIN_SEARCHFORM_TASK_DISABLED) && $user->rights->projet->lire) +{ + $arrayresult['searchintotasks']=array('img'=>'object_task', 'label'=>$langs->trans("SearchIntoTasks", $search_boxvalue), 'text'=>img_picto('','object_task').' '.$langs->trans("SearchIntoTasks", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/projet/tasks/list.php?search_all='.urlencode($search_boxvalue)); } if (! empty($conf->adherent->enabled) && empty($conf->global->MAIN_SEARCHFORM_ADHERENT_DISABLED) && $user->rights->adherent->lire) { - $arrayresult['searchintomember']=array('text'=>img_picto('','object_user').' '.$langs->trans("SearchIntoMembers", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/adherents/list.php?sall='.urlencode($search_boxvalue)); + $arrayresult['searchintomember']=array('img'=>'object_user', 'label'=>$langs->trans("SearchIntoMembers", $search_boxvalue), 'text'=>img_picto('','object_user').' '.$langs->trans("SearchIntoMembers", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/adherents/list.php?sall='.urlencode($search_boxvalue)); } -if (! empty($conf->user->enabled) && empty($conf->global->MAIN_SEARCHFORM_PROJECT_DISABLED) && $user->rights->user->user->lire) +if (! empty($conf->user->enabled) && empty($conf->global->MAIN_SEARCHFORM_USER_DISABLED) && $user->rights->user->user->lire) { - $arrayresult['searchintouser']=array('text'=>img_picto('','object_user').' '.$langs->trans("SearchIntoUsers", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/user/index.php?sall='.urlencode($search_boxvalue)); + $arrayresult['searchintouser']=array('img'=>'object_user', 'label'=>$langs->trans("SearchIntoUsers", $search_boxvalue), 'text'=>img_picto('','object_user').' '.$langs->trans("SearchIntoUsers", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/user/index.php?sall='.urlencode($search_boxvalue)); } if (! empty($conf->propal->enabled) && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_PROPAL_DISABLED) && $user->rights->propal->lire) { - $arrayresult['searchintopropal']=array('text'=>img_picto('','object_propal').' '.$langs->trans("SearchIntoCustomerProposals", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/comm/propal/list.php?sall='.urlencode($search_boxvalue)); + $arrayresult['searchintopropal']=array('img'=>'object_propal', 'label'=>$langs->trans("SearchIntoCustomerProposals", $search_boxvalue), 'text'=>img_picto('','object_propal').' '.$langs->trans("SearchIntoCustomerProposals", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/comm/propal/list.php?sall='.urlencode($search_boxvalue)); } if (! empty($conf->commande->enabled) && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_ORDER_DISABLED) && $user->rights->commande->lire) { - $arrayresult['searchintoorder']=array('text'=>img_picto('','object_order').' '.$langs->trans("SearchIntoCustomerOrders", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/commande/list.php?sall='.urlencode($search_boxvalue)); + $arrayresult['searchintoorder']=array('img'=>'object_order', 'label'=>$langs->trans("SearchIntoCustomerOrders", $search_boxvalue), 'text'=>img_picto('','object_order').' '.$langs->trans("SearchIntoCustomerOrders", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/commande/list.php?sall='.urlencode($search_boxvalue)); } if (! empty($conf->facture->enabled) && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_INVOICE_DISABLED) && $user->rights->facture->lire) { - $arrayresult['searchintoinvoice']=array('text'=>img_picto('','object_bill').' '.$langs->trans("SearchIntoCustomerInvoices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/compta/facture/list.php?sall='.urlencode($search_boxvalue)); + $arrayresult['searchintoinvoice']=array('img'=>'object_bill', 'label'=>$langs->trans("SearchIntoCustomerInvoices", $search_boxvalue), 'text'=>img_picto('','object_bill').' '.$langs->trans("SearchIntoCustomerInvoices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/compta/facture/list.php?sall='.urlencode($search_boxvalue)); } if (! empty($conf->expedition->enabled) && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_SHIPMENT_DISABLED) && $user->rights->expedition->lire) { - $arrayresult['searchintoshipment']=array('text'=>img_picto('','object_sending').' '.$langs->trans("SearchIntoCustomerShipments", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/expedition/list.php?sall='.urlencode($search_boxvalue)); + $arrayresult['searchintoshipment']=array('img'=>'object_sending', 'label'=>$langs->trans("SearchIntoCustomerShipments", $search_boxvalue), 'text'=>img_picto('','object_sending').' '.$langs->trans("SearchIntoCustomerShipments", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/expedition/list.php?sall='.urlencode($search_boxvalue)); } if (! empty($conf->supplier_proposal->enabled) && empty($conf->global->MAIN_SEARCHFORM_SUPPLIER_PROPAL_DISABLED) && $user->rights->supplier_proposal->lire) { - $arrayresult['searchintosupplierpropal']=array('text'=>img_picto('','object_propal').' '.$langs->trans("SearchIntoSupplierProposals", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/supplier_proposal/list.php?sall='.urlencode($search_boxvalue)); + $arrayresult['searchintosupplierpropal']=array('img'=>'object_propal', 'label'=>$langs->trans("SearchIntoSupplierProposals", $search_boxvalue), 'text'=>img_picto('','object_propal').' '.$langs->trans("SearchIntoSupplierProposals", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/supplier_proposal/list.php?sall='.urlencode($search_boxvalue)); } if (! empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_SEARCHFORM_SUPPLIER_ORDER_DISABLED) && $user->rights->fournisseur->commande->lire) { - $arrayresult['searchintosupplierorder']=array('text'=>img_picto('','object_order').' '.$langs->trans("SearchIntoSupplierOrders", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fourn/commande/list.php?search_all='.urlencode($search_boxvalue)); + $arrayresult['searchintosupplierorder']=array('img'=>'object_order', 'label'=>$langs->trans("SearchIntoSupplierOrders", $search_boxvalue), 'text'=>img_picto('','object_order').' '.$langs->trans("SearchIntoSupplierOrders", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fourn/commande/list.php?search_all='.urlencode($search_boxvalue)); } if (! empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_SEARCHFORM_SUPPLIER_INVOICE_DISABLED) && $user->rights->fournisseur->facture->lire) { - $arrayresult['searchintosupplierinvoice']=array('text'=>img_picto('','object_bill').' '.$langs->trans("SearchIntoSupplierInvoices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fourn/facture/list.php?sall='.urlencode($search_boxvalue)); + $arrayresult['searchintosupplierinvoice']=array('img'=>'object_bill', 'label'=>$langs->trans("SearchIntoSupplierInvoices", $search_boxvalue), 'text'=>img_picto('','object_bill').' '.$langs->trans("SearchIntoSupplierInvoices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fourn/facture/list.php?sall='.urlencode($search_boxvalue)); } if (! empty($conf->contrat->enabled) && empty($conf->global->MAIN_SEARCHFORM_CONTRACT_DISABLED) && $user->rights->contrat->lire) { - $arrayresult['searchintocontract']=array('text'=>img_picto('','object_contract').' '.$langs->trans("SearchIntoContracts", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/contrat/list.php?sall='.urlencode($search_boxvalue)); + $arrayresult['searchintocontract']=array('img'=>'object_contract', 'label'=>$langs->trans("SearchIntoContracts", $search_boxvalue), 'text'=>img_picto('','object_contract').' '.$langs->trans("SearchIntoContracts", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/contrat/list.php?sall='.urlencode($search_boxvalue)); } if (! empty($conf->ficheinter->enabled) && empty($conf->global->MAIN_SEARCHFORM_FICHINTER_DISABLED) && $user->rights->ficheinter->lire) { - $arrayresult['searchintointervention']=array('text'=>img_picto('','object_intervention').' '.$langs->trans("SearchIntoInterventions", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fichinter/list.php?sall='.urlencode($search_boxvalue)); + $arrayresult['searchintointervention']=array('img'=>'object_intervention', 'label'=>$langs->trans("SearchIntoInterventions", $search_boxvalue), 'text'=>img_picto('','object_intervention').' '.$langs->trans("SearchIntoInterventions", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fichinter/list.php?sall='.urlencode($search_boxvalue)); } // HR if (! empty($conf->expensereport->enabled) && empty($conf->global->MAIN_SEARCHFORM_EXPENSEREPORT_DISABLED) && $user->rights->expensereport->lire) { - $arrayresult['searchintoexpensereport']=array('text'=>img_picto('','object_trip').' '.$langs->trans("SearchIntoExpenseReports", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/expensereport/list.php?sall='.urlencode($search_boxvalue)); + $arrayresult['searchintoexpensereport']=array('img'=>'object_trip', 'label'=>$langs->trans("SearchIntoExpenseReports", $search_boxvalue), 'text'=>img_picto('','object_trip').' '.$langs->trans("SearchIntoExpenseReports", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/expensereport/list.php?mainmenu=hrm&sall='.urlencode($search_boxvalue)); } if (! empty($conf->holiday->enabled) && empty($conf->global->MAIN_SEARCHFORM_HOLIDAY_DISABLED) && $user->rights->holiday->read) { - $arrayresult['searchintoleaves']=array('text'=>img_picto('','object_holiday').' '.$langs->trans("SearchIntoLeaves", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/holiday/list.php?sall='.urlencode($search_boxvalue)); + $arrayresult['searchintoleaves']=array('img'=>'object_holiday', 'label'=>$langs->trans("SearchIntoLeaves", $search_boxvalue), 'text'=>img_picto('','object_holiday').' '.$langs->trans("SearchIntoLeaves", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/holiday/list.php?mainmenu=hrm&sall='.urlencode($search_boxvalue)); } @@ -140,6 +147,10 @@ if (empty($reshook)) else $arrayresult=$hookmanager->resArray; -print json_encode($arrayresult); +// Print output if called by ajax or do nothing (var $arrayresult will be used) if called by an include +if (! isset($usedbyinclude) || empty($usedbyinclude)) +{ + print json_encode($arrayresult); + if (is_object($db)) $db->close(); +} -if (is_object($db)) $db->close(); diff --git a/htdocs/core/boxes/box_actions.php b/htdocs/core/boxes/box_actions.php index 1f5e8493d7b..973738fec11 100644 --- a/htdocs/core/boxes/box_actions.php +++ b/htdocs/core/boxes/box_actions.php @@ -167,13 +167,15 @@ class box_actions extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines - * @return void + * @param int $nooutput No print, only return string + * @return string */ - function showBox($head = null, $contents = null) - { + function showBox($head = null, $contents = null, $nooutput=0) + { global $langs, $conf; parent::showBox($this->info_box_head, $this->info_box_contents); - if (! empty($conf->global->SHOW_DIALOG_HOMEPAGE)) + $out=''; + if (! empty($conf->global->SHOW_DIALOG_HOMEPAGE)) { $actioncejour=false; $contents=$this->info_box_contents; @@ -183,8 +185,8 @@ class box_actions extends ModeleBoxes $bcx[1] = 'class="box_impair"'; if ($contents[0][0]['text'] != $langs->trans("NoActionsToDo")) { - print '
trans("ActionsToDo").'">'; - print ''; + $out.= '
trans("ActionsToDo").'">'; + $out.= '
'; for ($line=0, $n=$nblines; $line < $n; $line++) { if (isset($contents[$line])) @@ -202,40 +204,45 @@ class box_actions extends ModeleBoxes $urlsoc=$contents[$line][3]['url']; $dateligne=$contents[$line][4]['text']; $percentage=$contents[$line][5]['text']; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + $out.= ''; + $out.= ''; + $out.= ''; + $out.= ''; + $out.= ''; + $out.= ''; + $out.= ''; } } - print '
'; - print img_object("",$logo); - print ''.$label.''.img_object("",$logosoc)." ".$nomsoc.''.$dateligne.''.$percentage.'
'; + $out.= img_object("",$logo); + $out.= ''.$label.''.img_object("",$logosoc)." ".$nomsoc.''.$dateligne.''.$percentage.'
'; + $out.= '
'; } - print '
'; + $out.= '
'; if ($actioncejour) { - print ''; + $out.= ''; } else { - print ''; + $out.= ''; } } + + if ($nooutput) return $out; + else print $out; + + return ''; } } diff --git a/htdocs/core/boxes/box_activity.php b/htdocs/core/boxes/box_activity.php index f7e09d33583..34666507488 100644 --- a/htdocs/core/boxes/box_activity.php +++ b/htdocs/core/boxes/box_activity.php @@ -455,10 +455,11 @@ class box_activity extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string * @return void */ - function showBox($head = null, $contents = null) - { - parent::showBox($this->info_box_head, $this->info_box_contents); + function showBox($head = null, $contents = null, $nooutput=0) + { + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_bookmarks.php b/htdocs/core/boxes/box_bookmarks.php index 88adb744ceb..e99a0b30387 100644 --- a/htdocs/core/boxes/box_bookmarks.php +++ b/htdocs/core/boxes/box_bookmarks.php @@ -135,11 +135,12 @@ class box_bookmarks extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string * @return void */ - function showBox($head = null, $contents = null) - { - parent::showBox($this->info_box_head, $this->info_box_contents); + function showBox($head = null, $contents = null, $nooutput=0) + { + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_clients.php b/htdocs/core/boxes/box_clients.php index 24c940fb9ea..307dcc7cbfd 100644 --- a/htdocs/core/boxes/box_clients.php +++ b/htdocs/core/boxes/box_clients.php @@ -157,11 +157,12 @@ class box_clients extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string * @return void */ - function showBox($head = null, $contents = null) - { - parent::showBox($this->info_box_head, $this->info_box_contents); + function showBox($head = null, $contents = null, $nooutput=0) + { + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_commandes.php b/htdocs/core/boxes/box_commandes.php index 6eb5006182c..7653206333d 100644 --- a/htdocs/core/boxes/box_commandes.php +++ b/htdocs/core/boxes/box_commandes.php @@ -176,11 +176,12 @@ class box_commandes extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string * @return void */ - function showBox($head = null, $contents = null) + function showBox($head = null, $contents = null, $nooutput=0) { - parent::showBox($this->info_box_head, $this->info_box_contents); + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_comptes.php b/htdocs/core/boxes/box_comptes.php index 178851466be..a6b8e2744a6 100644 --- a/htdocs/core/boxes/box_comptes.php +++ b/htdocs/core/boxes/box_comptes.php @@ -169,11 +169,12 @@ class box_comptes extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string * @return void */ - function showBox($head = null, $contents = null) - { - parent::showBox($this->info_box_head, $this->info_box_contents); + function showBox($head = null, $contents = null, $nooutput=0) + { + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_contacts.php b/htdocs/core/boxes/box_contacts.php index a1fc2768ba1..45963af9bb1 100644 --- a/htdocs/core/boxes/box_contacts.php +++ b/htdocs/core/boxes/box_contacts.php @@ -83,7 +83,7 @@ class box_contacts extends ModeleBoxes $societestatic=new Societe($db); $line = 0; - while ($line < $num) + while ($line < $num) { $objp = $db->fetch_object($result); $datec=$db->jdate($objp->datec); @@ -100,7 +100,7 @@ class box_contacts extends ModeleBoxes $contactstatic->address = $objp->address; $contactstatic->zip = $objp->zip; $contactstatic->town = $objp->town; - + $societestatic->id = $objp->fk_soc; $societestatic->name = $objp->socname; $societestatic->name_alias = $objp->name_alias; @@ -108,7 +108,7 @@ class box_contacts extends ModeleBoxes $societestatic->code_fournisseur = $objp->code_fournisseur; $societestatic->client = $objp->client; $societestatic->fournisseur = $objp->fournisseur; - + $this->info_box_contents[$line][] = array( 'td' => 'align="left"', 'text' => $contactstatic->getNomUrl(1), @@ -131,7 +131,7 @@ class box_contacts extends ModeleBoxes 'text' => $contactstatic->getLibStatut(3), 'asis'=>1, ); - + $line++; } @@ -163,11 +163,12 @@ class box_contacts extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string * @return void */ - function showBox($head = null, $contents = null) - { - parent::showBox($this->info_box_head, $this->info_box_contents); + function showBox($head = null, $contents = null, $nooutput=0) + { + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_contracts.php b/htdocs/core/boxes/box_contracts.php index 665bff4c6da..fe864e1df16 100644 --- a/htdocs/core/boxes/box_contracts.php +++ b/htdocs/core/boxes/box_contracts.php @@ -1,6 +1,7 @@ - * Copyright (C) 2015 Frederic France +/* Copyright (C) 2010 Regis Houssin + * Copyright (C) 2015 Frederic France + * Copyright (C) 2016 Laurent Destailleur * * 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 @@ -55,14 +56,14 @@ class box_contracts extends ModeleBoxes $this->max=$max; include_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; - + $this->info_box_head = array('text' => $langs->trans("BoxTitleLastContracts",$max)); if ($user->rights->contrat->lire) { $contractstatic=new Contrat($db); $thirdpartytmp=new Societe($db); - + $sql = "SELECT s.nom as name, s.rowid as socid,"; $sql.= " c.rowid, c.ref, c.statut as fk_statut, c.date_contrat, c.datec, c.fin_validite, c.date_cloture"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as c"; @@ -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); @@ -83,8 +85,8 @@ class box_contracts extends ModeleBoxes $line = 0; $langs->load("contracts"); - - while ($line < $num) + + while ($line < $num) { $objp = $db->fetch_object($resql); $datec=$db->jdate($objp->datec); @@ -99,7 +101,7 @@ class box_contracts extends ModeleBoxes $thirdpartytmp->name = $objp->name; $thirdpartytmp->id = $objp->socid; - + // fin_validite is no more on contract but on services // if ($objp->fk_statut == 1 && $dateterm < ($now - $conf->contrat->cloture->warning_delay)) { $late = img_warning($langs->trans("Late")); } @@ -157,11 +159,12 @@ class box_contracts extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string * @return void */ - function showBox($head = null, $contents = null) + function showBox($head = null, $contents = null, $nooutput=0) { - parent::showBox($this->info_box_head, $this->info_box_contents); + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_external_rss.php b/htdocs/core/boxes/box_external_rss.php index f1db35e1614..dbe71a6ca41 100644 --- a/htdocs/core/boxes/box_external_rss.php +++ b/htdocs/core/boxes/box_external_rss.php @@ -184,11 +184,12 @@ class box_external_rss extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string * @return void */ - function showBox($head = null, $contents = null) + function showBox($head = null, $contents = null, $nooutput=0) { - parent::showBox($this->info_box_head, $this->info_box_contents); + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_factures.php b/htdocs/core/boxes/box_factures.php index 7b5a01d6bca..22a90929a0b 100644 --- a/htdocs/core/boxes/box_factures.php +++ b/htdocs/core/boxes/box_factures.php @@ -180,11 +180,12 @@ class box_factures extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines - * @return void + * @param int $nooutput No print, only return string + * @return void */ - function showBox($head = null, $contents = null) - { - parent::showBox($this->info_box_head, $this->info_box_contents); + function showBox($head = null, $contents = null, $nooutput=0) + { + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_factures_fourn.php b/htdocs/core/boxes/box_factures_fourn.php index 88b64947f05..b43d9cfc47b 100644 --- a/htdocs/core/boxes/box_factures_fourn.php +++ b/htdocs/core/boxes/box_factures_fourn.php @@ -189,11 +189,12 @@ class box_factures_fourn extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string * @return void */ - function showBox($head = null, $contents = null) - { - parent::showBox($this->info_box_head, $this->info_box_contents); + function showBox($head = null, $contents = null, $nooutput=0) + { + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_factures_fourn_imp.php b/htdocs/core/boxes/box_factures_fourn_imp.php index 27441f22ea5..0d6bc28f077 100644 --- a/htdocs/core/boxes/box_factures_fourn_imp.php +++ b/htdocs/core/boxes/box_factures_fourn_imp.php @@ -117,18 +117,12 @@ class box_factures_fourn_imp extends ModeleBoxes } $tooltip = $langs->trans('SupplierInvoice') . ': ' . ($objp->ref?$objp->ref:$objp->facid) . '
' . $langs->trans('RefSupplier') . ': ' . $objp->ref_supplier; - $this->info_box_contents[$line][] = array( - 'td' => 'align="left" width="16"', - 'logo' => $this->boximg, - 'tooltip' => $tooltip, - 'url' => DOL_URL_ROOT."/fourn/facture/card.php?facid=".$objp->facid, - ); $this->info_box_contents[$line][] = array( 'td' => 'align="left"', 'text' => $facturestatic->getNomUrl(1), 'text2'=> $late, - 'asisi' => 1 + 'asis' => 1 ); $this->info_box_contents[$line][] = array( @@ -186,11 +180,12 @@ class box_factures_fourn_imp extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string * @return void */ - function showBox($head = null, $contents = null) - { - parent::showBox($this->info_box_head, $this->info_box_contents); + function showBox($head = null, $contents = null, $nooutput=0) + { + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_factures_imp.php b/htdocs/core/boxes/box_factures_imp.php index bcc26f60e4c..67c4d4dbfcc 100644 --- a/htdocs/core/boxes/box_factures_imp.php +++ b/htdocs/core/boxes/box_factures_imp.php @@ -182,11 +182,12 @@ class box_factures_imp extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string * @return void */ - function showBox($head = null, $contents = null) - { - parent::showBox($this->info_box_head, $this->info_box_contents); + function showBox($head = null, $contents = null, $nooutput=0) + { + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_ficheinter.php b/htdocs/core/boxes/box_ficheinter.php index decf5e564f0..d57a2a991df 100644 --- a/htdocs/core/boxes/box_ficheinter.php +++ b/htdocs/core/boxes/box_ficheinter.php @@ -144,11 +144,12 @@ class box_ficheinter extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string * @return void */ - function showBox($head = null, $contents = null) - { - parent::showBox($this->info_box_head, $this->info_box_contents); + function showBox($head = null, $contents = null, $nooutput=0) + { + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_fournisseurs.php b/htdocs/core/boxes/box_fournisseurs.php index e3e6061d803..ed3680af455 100644 --- a/htdocs/core/boxes/box_fournisseurs.php +++ b/htdocs/core/boxes/box_fournisseurs.php @@ -139,11 +139,12 @@ class box_fournisseurs extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string * @return void */ - function showBox($head = null, $contents = null) + function showBox($head = null, $contents = null, $nooutput=0) { - parent::showBox($this->info_box_head, $this->info_box_contents); + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_goodcustomers.php b/htdocs/core/boxes/box_goodcustomers.php index 579df4762a0..552ed92b8a3 100644 --- a/htdocs/core/boxes/box_goodcustomers.php +++ b/htdocs/core/boxes/box_goodcustomers.php @@ -20,9 +20,9 @@ */ /** - * \file htdocs/core/boxes/box_clients.php + * \file htdocs/core/boxes/box_goodcustomers.php * \ingroup societes - * \brief Module de generation de l'affichage de la box clients + * \brief Module to generated widget of best customers (the most invoiced) */ include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php'; @@ -59,6 +59,7 @@ class box_goodcustomers extends ModeleBoxes // disable box for such cases if (! empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) $this->enabled=0; // disabled by this option + if (empty($conf->global->MAIN_BOX_ENABLE_BEST_CUSTOMERS)) $this->enabled=0; // not enabled by default. Very slow on large database } /** @@ -81,7 +82,7 @@ class box_goodcustomers extends ModeleBoxes if ($user->rights->societe->lire) { - + $sql = "SELECT s.rowid, s.nom as name, s.logo, s.code_client, s.code_fournisseur, s.client, s.fournisseur, s.tms as datem, s.status as status,"; $sql.= " count(*) as nbfact, sum(". $db->ifsql('f.paye=1','1','0').") as nbfactpaye"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture as f"; @@ -127,7 +128,7 @@ class box_goodcustomers extends ModeleBoxes 'td' => 'align="right"', 'text' => $nbfact.( $nbimpaye != 0 ? ' ('.$nbimpaye.')':'') ); - + $this->info_box_contents[$line][] = array( 'td' => 'align="right" width="18"', 'text' => $thirdpartystatic->LibStatut($objp->status,3) @@ -158,11 +159,12 @@ class box_goodcustomers extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string * @return void */ - function showBox($head = null, $contents = null) - { - parent::showBox($this->info_box_head, $this->info_box_contents); + function showBox($head = null, $contents = null, $nooutput=0) + { + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_graph_invoices_permonth.php b/htdocs/core/boxes/box_graph_invoices_permonth.php index 3848960e5e9..e4639070203 100644 --- a/htdocs/core/boxes/box_graph_invoices_permonth.php +++ b/htdocs/core/boxes/box_graph_invoices_permonth.php @@ -77,7 +77,7 @@ class box_graph_invoices_permonth extends ModeleBoxes 'sublink'=>'', 'subtext'=>$langs->trans("Filter"), 'subpicto'=>'filter.png', - 'subclass'=>'linkobject', + 'subclass'=>'linkobject boxfilter', 'target'=>'none' // Set '' to get target="_blank" ); @@ -132,7 +132,9 @@ class box_graph_invoices_permonth extends ModeleBoxes $mesg = $px1->isGraphKo(); if (! $mesg) { - $px1->SetData($data1); + $langs->load("bills"); + + $px1->SetData($data1); unset($data1); $px1->SetPrecisionY(0); $i=$startyear;$legend=array(); @@ -171,7 +173,7 @@ class box_graph_invoices_permonth extends ModeleBoxes if (! $mesg) { $langs->load("bills"); - + $px2->SetData($data2); unset($data2); $px2->SetPrecisionY(0); @@ -263,11 +265,12 @@ class box_graph_invoices_permonth extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string * @return void */ - function showBox($head = null, $contents = null) - { - parent::showBox($this->info_box_head, $this->info_box_contents); + function showBox($head = null, $contents = null, $nooutput=0) + { + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php b/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php index 0931d2d05df..254195b42f1 100644 --- a/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php +++ b/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php @@ -76,7 +76,7 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes 'sublink'=>'', 'subtext'=>$langs->trans("Filter"), 'subpicto'=>'filter.png', - 'subclass'=>'linkobject', + 'subclass'=>'linkobject boxfilter', 'target'=>'none' // Set '' to get target="_blank" ); @@ -170,7 +170,7 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes if (! $mesg) { $langs->load("bills"); - + $px2->SetData($data2); unset($data2); $px2->SetPrecisionY(0); @@ -262,11 +262,12 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string * @return void */ - function showBox($head = null, $contents = null) - { - parent::showBox($this->info_box_head, $this->info_box_contents); + function showBox($head = null, $contents = null, $nooutput=0) + { + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_graph_orders_permonth.php b/htdocs/core/boxes/box_graph_orders_permonth.php index 4f86dcd0b8b..6b023b9c157 100644 --- a/htdocs/core/boxes/box_graph_orders_permonth.php +++ b/htdocs/core/boxes/box_graph_orders_permonth.php @@ -77,7 +77,7 @@ class box_graph_orders_permonth extends ModeleBoxes 'sublink'=>'', 'subtext'=>$langs->trans("Filter"), 'subpicto'=>'filter.png', - 'subclass'=>'linkobject', + 'subclass'=>'linkobject boxfilter', 'target'=>'none' // Set '' to get target="_blank" ); @@ -90,7 +90,7 @@ class box_graph_orders_permonth extends ModeleBoxes if ($user->rights->commande->lire) { $langs->load("orders"); - + $param_year='DOLUSERCOOKIE_box_'.$this->boxcode.'_year'; $param_shownb='DOLUSERCOOKIE_box_'.$this->boxcode.'_shownb'; $param_showtot='DOLUSERCOOKIE_box_'.$this->boxcode.'_showtot'; @@ -263,11 +263,12 @@ class box_graph_orders_permonth extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string * @return void */ - function showBox($head = null, $contents = null) - { - parent::showBox($this->info_box_head, $this->info_box_contents); + function showBox($head = null, $contents = null, $nooutput=0) + { + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_graph_orders_supplier_permonth.php b/htdocs/core/boxes/box_graph_orders_supplier_permonth.php index 6df7d81766c..646f28e949c 100644 --- a/htdocs/core/boxes/box_graph_orders_supplier_permonth.php +++ b/htdocs/core/boxes/box_graph_orders_supplier_permonth.php @@ -76,7 +76,7 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes 'sublink'=>'', 'subtext'=>$langs->trans("Filter"), 'subpicto'=>'filter.png', - 'subclass'=>'linkobject', + 'subclass'=>'linkobject boxfilter', 'target'=>'none' // Set '' to get target="_blank" ); @@ -89,7 +89,7 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes if ($user->rights->fournisseur->commande->lire) { $langs->load("orders"); - + $param_year='DOLUSERCOOKIE_box_'.$this->boxcode.'_year'; $param_shownb='DOLUSERCOOKIE_box_'.$this->boxcode.'_shownb'; $param_showtot='DOLUSERCOOKIE_box_'.$this->boxcode.'_showtot'; @@ -262,11 +262,12 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string * @return void */ - function showBox($head = null, $contents = null) - { - parent::showBox($this->info_box_head, $this->info_box_contents); + function showBox($head = null, $contents = null, $nooutput=0) + { + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_graph_product_distribution.php b/htdocs/core/boxes/box_graph_product_distribution.php index 46ddccc2a1d..a709a7aef3a 100644 --- a/htdocs/core/boxes/box_graph_product_distribution.php +++ b/htdocs/core/boxes/box_graph_product_distribution.php @@ -108,7 +108,7 @@ class box_graph_product_distribution extends ModeleBoxes 'sublink'=>'', 'subtext'=>$langs->trans("Filter"), 'subpicto'=>'filter.png', - 'subclass'=>'linkobject', + 'subclass'=>'linkobject boxfilter', 'target'=>'none' // Set '' to get target="_blank" ); @@ -390,11 +390,12 @@ class box_graph_product_distribution extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string * @return void */ - function showBox($head = null, $contents = null) - { - parent::showBox($this->info_box_head, $this->info_box_contents); + function showBox($head = null, $contents = null, $nooutput=0) + { + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_graph_propales_permonth.php b/htdocs/core/boxes/box_graph_propales_permonth.php index 8ef7b25969f..39fe12ed7a3 100644 --- a/htdocs/core/boxes/box_graph_propales_permonth.php +++ b/htdocs/core/boxes/box_graph_propales_permonth.php @@ -77,7 +77,7 @@ class box_graph_propales_permonth extends ModeleBoxes 'sublink'=>'', 'subtext'=>$langs->trans("Filter"), 'subpicto'=>'filter.png', - 'subclass'=>'linkobject', + 'subclass'=>'linkobject boxfilter', 'target'=>'none' // Set '' to get target="_blank" ); @@ -264,11 +264,12 @@ class box_graph_propales_permonth extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string * @return void */ - function showBox($head = null, $contents = null) - { - parent::showBox($this->info_box_head, $this->info_box_contents); + function showBox($head = null, $contents = null, $nooutput=0) + { + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_members.php b/htdocs/core/boxes/box_members.php index 9c166aac866..afcbe8e68a6 100644 --- a/htdocs/core/boxes/box_members.php +++ b/htdocs/core/boxes/box_members.php @@ -84,7 +84,7 @@ class box_members extends ModeleBoxes { $sql = "SELECT a.rowid, a.lastname, a.firstname, a.societe as company, a.fk_soc,"; $sql.= " a.datec, a.tms, a.statut as status, a.datefin as date_end_subscription,"; - $sql.= " t.cotisation"; + $sql.= " t.subscription"; $sql.= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."adherent_type as t"; $sql.= " WHERE a.entity = ".$conf->entity; $sql.= " AND a.fk_adherent_type = t.rowid"; @@ -135,7 +135,7 @@ class box_members extends ModeleBoxes $this->info_box_contents[$line][] = array( 'td' => 'align="right" width="18"', - 'text' => $memberstatic->LibStatut($objp->status,$objp->cotisation,$db->jdate($objp->date_end_subscription),3), + 'text' => $memberstatic->LibStatut($objp->status,$objp->subscription,$db->jdate($objp->date_end_subscription),3), ); $line++; @@ -169,11 +169,12 @@ class box_members extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string * @return void */ - function showBox($head = null, $contents = null) - { - parent::showBox($this->info_box_head, $this->info_box_contents); + function showBox($head = null, $contents = null, $nooutput=0) + { + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_produits.php b/htdocs/core/boxes/box_produits.php index c8ef1b5f558..5cce3254bfb 100644 --- a/htdocs/core/boxes/box_produits.php +++ b/htdocs/core/boxes/box_produits.php @@ -192,11 +192,12 @@ class box_produits extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string * @return void */ - function showBox($head = null, $contents = null) - { - parent::showBox($this->info_box_head, $this->info_box_contents); + function showBox($head = null, $contents = null, $nooutput=0) + { + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_produits_alerte_stock.php b/htdocs/core/boxes/box_produits_alerte_stock.php index 5a718b79696..3ec0fc7070c 100644 --- a/htdocs/core/boxes/box_produits_alerte_stock.php +++ b/htdocs/core/boxes/box_produits_alerte_stock.php @@ -66,7 +66,7 @@ class box_produits_alerte_stock extends ModeleBoxes if ($user->rights->produit->lire || $user->rights->service->lire) { - $sql = "SELECT p.rowid, p.label, p.price, p.ref, p.price_base_type, p.price_ttc, p.fk_product_type, p.tms, p.tosell, p.tobuy, p.seuil_stock_alerte,p.entity,"; + $sql = "SELECT p.rowid, p.label, p.price, p.ref, p.price_base_type, p.price_ttc, p.fk_product_type, p.tms, p.tosell, p.tobuy, p.seuil_stock_alerte, p.entity,"; $sql.= " SUM(".$db->ifsql("s.reel IS NULL","0","s.reel").") as total_stock"; $sql.= " FROM ".MAIN_DB_PREFIX."product as p"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as s on p.rowid = s.fk_product"; @@ -74,7 +74,7 @@ class box_produits_alerte_stock extends ModeleBoxes $sql.= " AND p.tosell = 1 AND p.seuil_stock_alerte > 0"; if (empty($user->rights->produit->lire)) $sql.=' AND p.fk_product_type != 0'; if (empty($user->rights->service->lire)) $sql.=' AND p.fk_product_type != 1'; - $sql.= " GROUP BY p.rowid, p.ref, p.label, p.price, p.price_base_type, p.price_ttc, p.fk_product_type, p.tms, p.tosell, p.tobuy, p.seuil_stock_alerte"; + $sql.= " GROUP BY p.rowid, p.ref, p.label, p.price, p.price_base_type, p.price_ttc, p.fk_product_type, p.tms, p.tosell, p.tobuy, p.seuil_stock_alerte, p.entity"; $sql.= " HAVING SUM(".$db->ifsql("s.reel IS NULL","0","s.reel").") < p.seuil_stock_alerte"; $sql.= $db->order('p.seuil_stock_alerte', 'DESC'); $sql.= $db->plimit($max, 0); @@ -199,11 +199,12 @@ class box_produits_alerte_stock extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string * @return void */ - function showBox($head = null, $contents = null) - { - parent::showBox($this->info_box_head, $this->info_box_contents); + function showBox($head = null, $contents = null, $nooutput=0) + { + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_project.php b/htdocs/core/boxes/box_project.php index 7d819ec0d2b..4c0689cd282 100644 --- a/htdocs/core/boxes/box_project.php +++ b/htdocs/core/boxes/box_project.php @@ -2,6 +2,7 @@ /* Copyright (C) 2012-2014 Charles-François BENKE * Copyright (C) 2014 Marcos García * Copyright (C) 2015 Frederic France + * Copyright (C) 2016 Juan José Menent * * 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 @@ -79,8 +80,10 @@ class box_project extends ModeleBoxes $sql = "SELECT p.rowid, p.ref, p.title, p.fk_statut "; $sql.= " FROM ".MAIN_DB_PREFIX."projet as p"; + if($user->socid) $sql.= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid=p.fk_soc"; $sql.= " WHERE p.entity = ".$conf->entity; - $sql.= " AND p.fk_statut = 1"; // Seulement les projets ouverts + if($user->socid) $sql.= " AND s.rowid = ".$user->socid; + $sql.= " AND p.fk_statut = 1"; // Seulement les projets ouverts $sql.= " ORDER BY p.datec DESC"; $sql.= $db->plimit($max, 0); @@ -173,11 +176,12 @@ class box_project extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string * @return void */ - function showBox($head = null, $contents = null) - { - parent::showBox($this->info_box_head, $this->info_box_contents); + function showBox($head = null, $contents = null, $nooutput=0) + { + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_propales.php b/htdocs/core/boxes/box_propales.php index c14cf07a51c..b0a1e4a3798 100644 --- a/htdocs/core/boxes/box_propales.php +++ b/htdocs/core/boxes/box_propales.php @@ -166,11 +166,12 @@ class box_propales extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string * @return void */ - function showBox($head = null, $contents = null) + function showBox($head = null, $contents = null, $nooutput=0) { - parent::showBox($this->info_box_head, $this->info_box_contents); + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_prospect.php b/htdocs/core/boxes/box_prospect.php index 3895a27a9f1..40adb98b405 100644 --- a/htdocs/core/boxes/box_prospect.php +++ b/htdocs/core/boxes/box_prospect.php @@ -167,11 +167,12 @@ class box_prospect extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string * @return void */ - function showBox($head = null, $contents = null) - { - parent::showBox($this->info_box_head, $this->info_box_contents); + function showBox($head = null, $contents = null, $nooutput=0) + { + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_services_contracts.php b/htdocs/core/boxes/box_services_contracts.php index c38b99263ba..9f71a98e77f 100644 --- a/htdocs/core/boxes/box_services_contracts.php +++ b/htdocs/core/boxes/box_services_contracts.php @@ -64,7 +64,7 @@ class box_services_contracts extends ModeleBoxes $contractstatic=new Contrat($db); $contratlignestatic=new ContratLigne($db); $thirdpartytmp = new Societe($db); - + $sql = "SELECT s.nom as name, s.rowid as socid,"; $sql.= " c.rowid, c.ref, c.statut as contract_status,"; $sql.= " cd.rowid as cdid, cd.tms as datem, cd.statut, cd.label, cd.description, cd.product_type as type,"; @@ -103,14 +103,14 @@ class box_services_contracts extends ModeleBoxes $contratlignestatic->type=$objp->type; $contratlignestatic->product_id=$objp->product_id; $contratlignestatic->product_ref=$objp->product_ref; - + $contractstatic->statut=$objp->contract_status; $contractstatic->id=$objp->rowid; $contractstatic->ref=$objp->ref; - + $thirdpartytmp->name = $objp->name; $thirdpartytmp->id = $objp->socid; - + // Multilangs if (! empty($conf->global->MAIN_MULTILANGS)) // si l'option est active { @@ -128,22 +128,22 @@ class box_services_contracts extends ModeleBoxes } } - $this->info_box_contents[$i][] = array('td' => 'align="left"', + $this->info_box_contents[$i][] = array('td' => 'class="tdoverflowmax100 maxwidth100onsmartphone"', 'text' => $contratlignestatic->getNomUrl(1), 'asis' => 1 ); - - $this->info_box_contents[$i][] = array('td' => 'align="left"', + + $this->info_box_contents[$i][] = array('td' => '', 'text' => $contractstatic->getNomUrl(1), 'asis' => 1 ); - $this->info_box_contents[$i][] = array('td' => 'align="left"', + $this->info_box_contents[$i][] = array('td' => '', 'text' => $thirdpartytmp->getNomUrl(1), 'asis' => 1 ); - $this->info_box_contents[$i][] = array('td' => 'align="right"', + $this->info_box_contents[$i][] = array('td' => '', 'text' => dol_print_date($datem,'day')); $this->info_box_contents[$i][] = array('td' => 'align="right" width="18"', @@ -175,11 +175,12 @@ class box_services_contracts extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string * @return void */ - function showBox($head = null, $contents = null) - { - parent::showBox($this->info_box_head, $this->info_box_contents); + function showBox($head = null, $contents = null, $nooutput=0) + { + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_services_expired.php b/htdocs/core/boxes/box_services_expired.php index 578d83e0b66..f2bc86cdac5 100644 --- a/htdocs/core/boxes/box_services_expired.php +++ b/htdocs/core/boxes/box_services_expired.php @@ -68,6 +68,7 @@ class box_services_expired extends ModeleBoxes $sql.= " FROM ".MAIN_DB_PREFIX."contrat as c, ".MAIN_DB_PREFIX."societe s, ".MAIN_DB_PREFIX."contratdet as cd"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE cd.statut = 4 AND cd.date_fin_validite <= '".$db->idate($now)."'"; + $sql.= " AND c.entity = ".$conf->entity; $sql.= " AND c.fk_soc=s.rowid AND cd.fk_contrat=c.rowid AND c.statut > 0"; if ($user->societe_id) $sql.=' AND c.fk_soc = '.$user->societe_id; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; @@ -103,8 +104,8 @@ class box_services_expired extends ModeleBoxes 'logo' => 'company', 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid); - $this->info_box_contents[$i][3] = array('td' => 'align="left"', - 'text' => dol_trunc($objp->name,40), + $this->info_box_contents[$i][3] = array('td' => 'class="tdoverflow maxwidth100onsmartphone" align="left"', + 'text' => $objp->name, 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid); $this->info_box_contents[$i][4] = array('td' => 'align="center"', @@ -118,7 +119,7 @@ class box_services_expired extends ModeleBoxes $i++; } - if ($num==0) + if ($num==0) { $langs->load("contracts"); $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoExpiredServices")); @@ -147,11 +148,12 @@ class box_services_expired extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string * @return void */ - function showBox($head = null, $contents = null) + function showBox($head = null, $contents = null, $nooutput=0) { - parent::showBox($this->info_box_head, $this->info_box_contents); + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_supplier_orders.php b/htdocs/core/boxes/box_supplier_orders.php index 84521bf4ee0..1f0e1ece2ef 100644 --- a/htdocs/core/boxes/box_supplier_orders.php +++ b/htdocs/core/boxes/box_supplier_orders.php @@ -171,11 +171,12 @@ class box_supplier_orders extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines - * @return void - */ - function showBox($head = null, $contents = null) + * @param int $nooutput No print, only return string + * @return void + */ + function showBox($head = null, $contents = null, $nooutput=0) { - parent::showBox($this->info_box_head, $this->info_box_contents); + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_task.php b/htdocs/core/boxes/box_task.php index d314af73cd1..29dd9390597 100644 --- a/htdocs/core/boxes/box_task.php +++ b/htdocs/core/boxes/box_task.php @@ -91,11 +91,11 @@ class box_task extends ModeleBoxes $sql.= $db->plimit($max, 0); $result = $db->query($sql); - if ($result) + if ($result) { $num = $db->num_rows($result); $i = 0; - while ($i < $num) + while ($i < $num) { $objp = $db->fetch_object($result); $this->info_box_contents[$i][] = array( @@ -137,10 +137,11 @@ class box_task extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string * @return void */ - function showBox($head = null, $contents = null) + function showBox($head = null, $contents = null, $nooutput=0) { - parent::showBox($this->info_box_head, $this->info_box_contents); + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/modules_boxes.php b/htdocs/core/boxes/modules_boxes.php index d9b1f42132a..0f754682925 100644 --- a/htdocs/core/boxes/modules_boxes.php +++ b/htdocs/core/boxes/modules_boxes.php @@ -182,6 +182,7 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty" global $langs, $user, $conf; // Trick to get result into a var from a function that makes print instead of return + // TODO Replace ob_start with param nooutput=1 into showBox ob_start(); $result = $this->showBox($head, $contents); $output = ob_get_contents(); @@ -191,14 +192,14 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty" } /** - *Standard method to show a box (usage by boxes not mandatory, a box can still use its own showBox function) + * Standard method to show a box (usage by boxes not mandatory, a box can still use its own showBox function) * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines - * - * @return void + * @param int $nooutput No print, only return string + * @return string */ - function showBox($head = null, $contents = null) + function showBox($head = null, $contents = null, $nooutput=0) { global $langs, $user, $conf; @@ -242,7 +243,7 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty" $out.= '>'; if ($conf->use_javascript_ajax) { - $out.= ''; - $formconfirm.= ''; + $formconfirm.= ''; $formconfirm.= ''."\n"; $formconfirm.= '
'; + $out.= ''; - + if ($inputalsopricewithtax) print ''; // Qty @@ -3429,7 +3466,7 @@ abstract class CommonObject $text.= ' - '.(! empty($line->label)?$line->label:$label); $description.=(! empty($conf->global->PRODUIT_DESC_IN_FORM)?'':dol_htmlentitiesbr($line->description)); // Description is what to show on popup. We shown nothing if already into desc. } - + $line->pu_ttc = price2num($line->subprice * (1 + ($line->tva_tx/100)), 'MU'); // Output template part (modules that overwrite templates must declare this into descriptor) @@ -3716,30 +3753,30 @@ abstract class CommonObject { global $user; - $this->db->begin(); $sql = "DELETE FROM ".MAIN_DB_PREFIX."element_resources"; $sql.= " WHERE rowid=".$rowid; dol_syslog(get_class($this)."::delete_resource", LOG_DEBUG); - $resql=$this->db->query($sql); - if (! $resql) + + $resql=$this->db->query($sql); + if (! $resql) + { + $this->error=$this->db->lasterror(); + $this->db->rollback(); + return -1; + } + else + { + if (! $notrigger) { - $this->error=$this->db->lasterror(); - $this->db->rollback(); - return -1; - } - else - { - if (! $notrigger) - { - $result=$this->call_trigger(strtoupper($element).'_DELETE_RESOURCE', $user); - if ($result < 0) { $this->db->rollback(); return -1; } - } - $this->db->commit(); - return 1; + $result=$this->call_trigger(strtoupper($element).'_DELETE_RESOURCE', $user); + if ($result < 0) { $this->db->rollback(); return -1; } } + $this->db->commit(); + return 1; + } } @@ -3770,9 +3807,10 @@ abstract class CommonObject * @param int $hidedetails 1 to hide details. 0 by default * @param int $hidedesc 1 to hide product description. 0 by default * @param int $hideref 1 to hide product reference. 0 by default + * @param null|array $moreparams Array to provide more information * @return int >0 if OK, <0 if KO */ - protected function commonGenerateDocument($modelspath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref) + protected function commonGenerateDocument($modelspath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams=null) { global $conf, $langs; @@ -3800,7 +3838,8 @@ abstract class CommonObject { foreach(array('doc','pdf') as $prefix) { - $file = $prefix."_".$modele.".modules.php"; + if (in_array(get_class($this), array('Adherent'))) $file = $prefix."_".$modele.".class.php"; // Member module use prefix_module.class.php + else $file = $prefix."_".$modele.".modules.php"; // On verifie l'emplacement du modele $file=dol_buildpath($reldir.$modelspath.$file,0); @@ -3817,6 +3856,8 @@ abstract class CommonObject // If generator was found if ($filefound) { + global $db; // Required to solve a conception default in commonstickergenerator.class.php making an include of code using $db + require_once $file; $obj = new $classname($this->db); @@ -3870,11 +3911,19 @@ abstract class CommonObject return -1; } } - + // We save charset_output to restore it because write_file can change it if needed for // output format that does not support UTF8. $sav_charset_output=$outputlangs->charset_output; - if ($obj->write_file($this, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref) > 0) + + if (in_array(get_class($this), array('Adherent'))) + { + $arrayofrecords = array(); // The write_file of templates of adherent class need this + $resultwritefile = $obj->write_file($this, $outputlangs, $srctemplatepath, 'member', 1, $moreparams); + } + else $resultwritefile = $obj->write_file($this, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref, $moreparams); + + if ($resultwritefile > 0) { $outputlangs->charset_output=$sav_charset_output; @@ -3934,13 +3983,13 @@ abstract class CommonObject /* For default values */ /** - * Return the default value to use for a field when showing the create form of object. + * Return the default value to use for a field when showing the create form of object. * Return values in this order: * 1) If parameter is available into POST, we return it first. * 2) If not but an alternate value was provided as parameter of function, we return it. - * 3) If not but a constant $conf->global->OBJECTELEMENT_FIELDNAME is set, we return it (It is better to use the dedicated table). + * 3) If not but a constant $conf->global->OBJECTELEMENT_FIELDNAME is set, we return it (It is better to use the dedicated table). * 4) Return value found into database (TODO No yet implemented) - * + * * @param string $fieldname Name of field * @param string $alternatevalue Alternate value to use * @return string|string[] Default value (can be an array if the GETPOST return an array) @@ -3951,27 +4000,27 @@ abstract class CommonObject // If param here has been posted, we use this value first. if (isset($_POST[$fieldname])) return GETPOST($fieldname, 2); - + if (isset($alternatevalue)) return $alternatevalue; - + $newelement=$this->element; if ($newelement == 'facture') $newelement='invoice'; if ($newelement == 'commande') $newelement='order'; - if (empty($newelement)) + if (empty($newelement)) { dol_syslog("Ask a default value using common method getDefaultCreateValueForField on an object with no property ->element defined. Return empty string.", LOG_WARNING); return ''; } - + $keyforfieldname=strtoupper($newelement.'_DEFAULT_'.$fieldname); //var_dump($keyforfieldname); if (isset($conf->global->$keyforfieldname)) return $conf->global->$keyforfieldname; - - // TODO Ad here a scan into table llx_overwrite_default with a filter on $this->element and $fieldname - + + // TODO Ad here a scan into table llx_overwrite_default with a filter on $this->element and $fieldname + } - - + + /* For triggers */ @@ -3988,7 +4037,7 @@ abstract class CommonObject function call_trigger($trigger_name, $user) { global $langs,$conf; - + include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; $interface=new Interfaces($this->db); $result=$interface->run_triggers($trigger_name,$this,$user,$langs,$conf); @@ -3997,14 +4046,13 @@ abstract class CommonObject { if (!empty($this->errors)) { - $this->errors=array_merge($this->errors,$interface->errors); + $this->errors=array_unique(array_merge($this->errors,$interface->errors)); // We use array_unique because when a trigger call another trigger on same object, this->errors is added twice. } else { $this->errors=$interface->errors; } } - return $result; } @@ -4128,9 +4176,16 @@ abstract class CommonObject $langs->load('admin'); require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; $extrafields = new ExtraFields($this->db); - $extrafields->fetch_name_optionals_label($this->table_element); + $target_extrafields=$extrafields->fetch_name_optionals_label($this->table_element); + + //Eliminate copied source object extra_fields that do not exist in target object + $new_array_options=array(); + foreach ($this->array_options as $key => $value) { + if (in_array(substr($key,8), array_keys($target_extrafields))) + $new_array_options[$key] = $value; + } - foreach($this->array_options as $key => $value) + foreach($new_array_options as $key => $value) { $attributeKey = substr($key,8); // Remove 'options_' prefix $attributeType = $extrafields->attribute_type[$attributeKey]; @@ -4169,9 +4224,11 @@ abstract class CommonObject $object = new $InfoFieldList[0]($this->db); if ($value) { - $res=$object->fetch(0,$value); + if (is_numeric($value)) $res=$object->fetch($value); + else $res=$object->fetch('',$value); + if ($res > 0) $this->array_options[$key]=$object->id; - else + else { $this->error="Ref '".$value."' for object '".$object->element."' not found"; $this->db->rollback(); @@ -4193,7 +4250,7 @@ abstract class CommonObject $this->db->query($sql_del); $sql = "INSERT INTO ".MAIN_DB_PREFIX.$this->table_element."_extrafields (fk_object"; - foreach($this->array_options as $key => $value) + foreach($new_array_options as $key => $value) { $attributeKey = substr($key,8); // Remove 'options_' prefix // Add field of attribut @@ -4201,7 +4258,7 @@ abstract class CommonObject $sql.=",".$attributeKey; } $sql .= ") VALUES (".$this->id; - foreach($this->array_options as $key => $value) + foreach($new_array_options as $key => $value) { $attributeKey = substr($key,8); // Remove 'options_' prefix // Add field o fattribut @@ -4235,7 +4292,7 @@ abstract class CommonObject } else return 0; } - + /** * Update an exta field value for the current object. * Data to describe values to insert/update are stored into $this->array_options=array('options_codeforfield1'=>'valueforfield1', 'options_codeforfield2'=>'valueforfield2', ...) @@ -4300,7 +4357,7 @@ abstract class CommonObject } break; } - + $this->db->begin(); $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element."_extrafields SET ".$key."='".$this->db->escape($this->array_options["options_".$key])."'"; $sql .= " WHERE fk_object = ".$this->id; @@ -4478,7 +4535,7 @@ abstract class CommonObject * @param int $origin_id Old thirdparty id (the thirdparty to delete) * @param int $dest_id New thirdparty id (the thirdparty that will received element of the other) * @param string[] $tables Tables that need to be changed - * @param int $ignoreerrors Ignore errors. Return true even if errors. We need this when replacement can fails like for categories (categorie of old thirdparty may already exists on new one) + * @param int $ignoreerrors Ignore errors. Return true even if errors. We need this when replacement can fails like for categories (categorie of old thirdparty may already exists on new one) * @return bool */ public static function commonReplaceThirdparty(DoliDB $db, $origin_id, $dest_id, array $tables, $ignoreerrors=0) @@ -4487,9 +4544,9 @@ abstract class CommonObject { $sql = 'UPDATE '.MAIN_DB_PREFIX.$table.' SET fk_soc = '.$dest_id.' WHERE fk_soc = '.$origin_id; - if (! $db->query($sql)) + if (! $db->query($sql)) { - if ($ignoreerrors) return true; + if ($ignoreerrors) return true; // TODO Not enough. If there is A-B on kept thirdarty and B-C on old one, we must get A-B-C after merge. Not A-B. //$this->errors = $db->lasterror(); return false; } @@ -4497,26 +4554,26 @@ abstract class CommonObject return true; } - + /** * Get buy price to use for margin calculation. This function is called when buy price is unknown. * set buy price = sell price if ForceBuyingPriceIfNull configured, * else if calculation MARGIN_TYPE = 'costprice' and costprice is defined, use costprice as buyprice * else if calculation MARGIN_TYPE = 'pmp' and pmp is calculated, use pmp as buyprice * else set min buy price as buy price - * + * * @param float $unitPrice product unit price * @param float $discountPercent line discount percent * @param int $fk_product product id * * @return float <0 if ko, buyprice if ok */ - public function defineBuyPrice($unitPrice = 0, $discountPercent = 0, $fk_product = 0) + public function defineBuyPrice($unitPrice = 0, $discountPercent = 0, $fk_product = 0) { global $conf; - + $buyPrice = 0; - + if (($unitPrice > 0) && (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1)) // In most cases, test here is false { $buyPrice = $unitPrice * (1 - $discountPercent / 100); @@ -4560,7 +4617,7 @@ abstract class CommonObject $buyPrice = $product->pmp; } } - + if (empty($buyPrice) && isset($conf->global->MARGIN_TYPE) && in_array($conf->global->MARGIN_TYPE, array('1','pmp','costprice'))) { require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php'; diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 35b0d4024ec..abe672dee68 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -1,7 +1,7 @@ * Copyright (C) 2003 Xavier Dutoit - * Copyright (C) 2004-2012 Laurent Destailleur + * Copyright (C) 2004-2016 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2006 Jean Heimburger * @@ -51,7 +51,7 @@ class Conf public $standard_menu; public $modules = array(); // List of activated modules - public $modules_parts = array('css'=>array(),'js'=>array(),'tabs'=>array(),'triggers'=>array(),'login'=>array(),'substitutions'=>array(),'menus'=>array(),'theme'=>array(),'sms'=>array(),'tpl'=>array(),'barcode'=>array(),'models'=>array(),'societe'=>array(),'hooks'=>array(),'dir'=>array()); + public $modules_parts = array('css'=>array(),'js'=>array(),'tabs'=>array(),'triggers'=>array(),'login'=>array(),'substitutions'=>array(),'menus'=>array(),'theme'=>array(),'sms'=>array(),'tpl'=>array(),'barcode'=>array(),'models'=>array(),'societe'=>array(),'hooks'=>array(),'dir'=>array(), 'syslog' =>array()); var $logbuffer = array(); @@ -123,6 +123,8 @@ class Conf */ function setValues($db) { + global $conf; + dol_syslog(get_class($this)."::setValues"); /* @@ -203,7 +205,7 @@ class Conf $db->free($resql); } - + // Include other local consts.php files and fetch their values to the corresponding database constants if (! empty($this->global->LOCAL_CONSTS_FILES)) { $filesList = explode(":", $this->global->LOCAL_CONSTS_FILES); @@ -342,7 +344,7 @@ class Conf $this->fournisseur->facture=new stdClass(); $this->fournisseur->facture->dir_output =$rootfordata."/fournisseur/facture"; $this->fournisseur->facture->dir_temp =$rootfordata."/fournisseur/facture/temp"; - + // To prepare split of module fournisseur into fournisseur + supplier_order + supplier_invoice if (! empty($this->fournisseur->enabled) && empty($this->global->MAIN_USE_NEW_SUPPLIERMOD)) // By default, if module supplier is on, we set new properties { @@ -379,11 +381,13 @@ class Conf // Set some default values $this->global->MAIN_ACTIVATE_HTML5=1; - + // societe if (empty($this->global->SOCIETE_CODECLIENT_ADDON)) $this->global->SOCIETE_CODECLIENT_ADDON="mod_codeclient_leopard"; if (empty($this->global->SOCIETE_CODECOMPTA_ADDON)) $this->global->SOCIETE_CODECOMPTA_ADDON="mod_codecompta_panicum"; + if (empty($this->global->CHEQUERECEIPTS_ADDON)) $this->global->CHEQUERECEIPTS_ADDON='mod_chequereceipt_mint'; + // Security if (empty($this->global->USER_PASSWORD_GENERATED)) $this->global->USER_PASSWORD_GENERATED='standard'; // Default password generator if (empty($this->global->MAIN_UMASK)) $this->global->MAIN_UMASK='0664'; // Default mask @@ -429,7 +433,7 @@ class Conf $this->liste_limit=$this->global->MAIN_SIZE_LISTE_LIMIT; // conf->product->limit_size = constante de taille maximale des select de produit - if (! isset($this->global->PRODUIT_LIMIT_SIZE)) $this->global->PRODUIT_LIMIT_SIZE=100; + if (! isset($this->global->PRODUIT_LIMIT_SIZE)) $this->global->PRODUIT_LIMIT_SIZE=1000; $this->product->limit_size=$this->global->PRODUIT_LIMIT_SIZE; // conf->theme et $this->css @@ -481,8 +485,14 @@ class Conf // Default max file size for upload $this->maxfilesize = (empty($this->global->MAIN_UPLOAD_DOC) ? 0 : $this->global->MAIN_UPLOAD_DOC * 1024); - // Define list of limited modules - if (! isset($this->global->MAIN_MODULES_FOR_EXTERNAL)) $this->global->MAIN_MODULES_FOR_EXTERNAL='user,supplier_proposal,facture,categorie,commande,fournisseur,contact,propal,projet,contrat,societe,ficheinter,expedition,agenda,adherent'; // '' means 'all'. Note that contact is added here as it should be a module later. + // By default, we propagate contacts + if (! isset($this->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN)) $this->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN='*'; // Can be also '*' or '^(BILLING|SHIPPING|CUSTOMER|.*)$' (regex not yet implemented) + + // By default, we use the zip town autofill + if (! isset($this->global->MAIN_USE_ZIPTOWN_DICTIONNARY)) $this->global->MAIN_USE_ZIPTOWN_DICTIONNARY=1; + + // Define list of limited modules (value must be key found for "name" property of module, so for example 'supplierproposal' for Module "Supplier Proposal" + if (! isset($this->global->MAIN_MODULES_FOR_EXTERNAL)) $this->global->MAIN_MODULES_FOR_EXTERNAL='user,societe,propal,commande,facture,categorie,supplierproposal,fournisseur,contact,projet,contrat,ficheinter,expedition,agenda,resource,adherent'; // '' means 'all'. Note that contact is added here as it should be a module later. // Enable select2 if (empty($this->global->MAIN_USE_JQUERY_MULTISELECT) || $this->global->MAIN_USE_JQUERY_MULTISELECT == '1') $this->global->MAIN_USE_JQUERY_MULTISELECT='select2'; @@ -500,17 +510,17 @@ class Conf // Delay before warnings // Avoid strict errors. TODO: Replace xxx->warning_delay with a property ->warning_delay_xxx if (isset($this->agenda)) { - $this->adherent->cotisation = new stdClass(); - $this->adherent->cotisation->warning_delay=(isset($this->global->MAIN_DELAY_MEMBERS)?$this->global->MAIN_DELAY_MEMBERS:0)*24*60*60; + $this->adherent->subscription = new stdClass(); + $this->adherent->subscription->warning_delay=(isset($this->global->MAIN_DELAY_MEMBERS)?$this->global->MAIN_DELAY_MEMBERS:0)*24*60*60; } if (isset($this->agenda)) $this->agenda->warning_delay=(isset($this->global->MAIN_DELAY_ACTIONS_TODO)?$this->global->MAIN_DELAY_ACTIONS_TODO:7)*24*60*60; - if (isset($this->projet)) + if (isset($this->projet)) { $this->projet->warning_delay=(isset($this->global->MAIN_DELAY_PROJECT_TO_CLOSE)?$this->global->MAIN_DELAY_PROJECT_TO_CLOSE:7)*24*60*60; $this->projet->task = new StdClass(); $this->projet->task->warning_delay=(isset($this->global->MAIN_DELAY_TASKS_TODO)?$this->global->MAIN_DELAY_TASKS_TODO:7)*24*60*60; } - + if (isset($this->commande)) { $this->commande->client = new stdClass(); $this->commande->fournisseur = new stdClass(); @@ -564,26 +574,40 @@ class Conf if (is_object($mc)) $mc->setValues($this); } - // We init log handlers - if (defined('SYSLOG_HANDLERS')) $handlers = json_decode(constant('SYSLOG_HANDLERS')); - else $handlers = array(); - foreach ($handlers as $handler) - { - $file = DOL_DOCUMENT_ROOT.'/core/modules/syslog/'.$handler.'.php'; - if (!file_exists($file)) - { - throw new Exception('Missing log handler file '.$handler.'.php'); - } + // We init log handlers + if (defined('SYSLOG_HANDLERS')) { + $handlers = json_decode(constant('SYSLOG_HANDLERS')); + } else { + $handlers = array(); + } + foreach ($handlers as $handler) { + $handler_files = array(); + $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)) { + $file = $newdir . $handler . '.php'; + if (file_exists($file)) { + $handler_files[] = $file; + } + } + } - require_once $file; - $loghandlerinstance = new $handler(); - if (!$loghandlerinstance instanceof LogHandlerInterface) - { - throw new Exception('Log handler does not extend LogHandlerInterface'); - } + if (empty($handler_files)) { + throw new Exception('Missing log handler file ' . $handler . '.php'); + } - if (empty($this->loghandlers[$handler])) $this->loghandlers[$handler]=$loghandlerinstance; - } + require_once $handler_files[0]; + $loghandlerinstance = new $handler(); + if (!$loghandlerinstance instanceof LogHandlerInterface) { + throw new Exception('Log handler does not extend LogHandlerInterface'); + } + + if (empty($this->loghandlers[$handler])) { + $this->loghandlers[$handler] = $loghandlerinstance; + } + } } } diff --git a/htdocs/core/class/discount.class.php b/htdocs/core/class/discount.class.php index e256dbfb649..9a59801f720 100644 --- a/htdocs/core/class/discount.class.php +++ b/htdocs/core/class/discount.class.php @@ -66,6 +66,8 @@ class DiscountAbsolute */ function fetch($rowid,$fk_facture_source=0) { + global $conf; + // Check parameters if (! $rowid && ! $fk_facture_source) { @@ -81,9 +83,9 @@ class DiscountAbsolute $sql.= " f.facnumber as ref_facture_source"; $sql.= " FROM ".MAIN_DB_PREFIX."societe_remise_except as sr"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as f ON sr.fk_facture_source = f.rowid"; - $sql.= " WHERE"; - if ($rowid) $sql.= " sr.rowid=".$rowid; - if ($fk_facture_source) $sql.= " sr.fk_facture_source=".$fk_facture_source; + $sql.= " WHERE sr.entity = " . $conf->entity; + if ($rowid) $sql.= " AND sr.rowid=".$rowid; + if ($fk_facture_source) $sql.= " AND sr.fk_facture_source=".$fk_facture_source; dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql = $this->db->query($sql); @@ -150,11 +152,11 @@ class DiscountAbsolute // Insert request $sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_remise_except"; - $sql.= " (datec, fk_soc, fk_user, description,"; + $sql.= " (entity, datec, fk_soc, fk_user, description,"; $sql.= " amount_ht, amount_tva, amount_ttc, tva_tx,"; $sql.= " fk_facture_source"; $sql.= ")"; - $sql.= " VALUES ('".$this->db->idate($this->datec!=''?$this->datec:dol_now())."', ".$this->fk_soc.", ".$user->id.", '".$this->db->escape($this->description)."',"; + $sql.= " VALUES (".$conf->entity.", '".$this->db->idate($this->datec!=''?$this->datec:dol_now())."', ".$this->fk_soc.", ".$user->id.", '".$this->db->escape($this->description)."',"; $sql.= " ".$this->amount_ht.", ".$this->amount_tva.", ".$this->amount_ttc.", ".$this->tva_tx.","; $sql.= " ".($this->fk_facture_source?"'".$this->fk_facture_source."'":"null"); $sql.= ")"; @@ -343,10 +345,13 @@ class DiscountAbsolute */ function getAvailableDiscounts($company='', $user='',$filter='', $maxvalue=0) { + global $conf; + $sql = "SELECT SUM(rc.amount_ttc) as amount"; // $sql = "SELECT rc.amount_ttc as amount"; $sql.= " FROM ".MAIN_DB_PREFIX."societe_remise_except as rc"; - $sql.= " WHERE (rc.fk_facture IS NULL AND rc.fk_facture_line IS NULL)"; // Available + $sql.= " WHERE rc.entity = " . $conf->entity; + $sql.= " AND (rc.fk_facture IS NULL AND rc.fk_facture_line IS NULL)"; // Available if (is_object($company)) $sql.= " AND rc.fk_soc = ".$company->id; if (is_object($user)) $sql.= " AND rc.fk_user = ".$user->id; if ($filter) $sql.=' AND ('.$filter.')'; diff --git a/htdocs/core/class/doleditor.class.php b/htdocs/core/class/doleditor.class.php index ff31823976e..ef750e70253 100644 --- a/htdocs/core/class/doleditor.class.php +++ b/htdocs/core/class/doleditor.class.php @@ -81,7 +81,7 @@ class DolEditor // Check if extended editor is ok. If not we force textarea if (empty($conf->fckeditor->enabled) || ! $okforextendededitor) $this->tool = 'textarea'; - //if ($conf->browser->phone) $this->tool = 'textarea'; + if ($conf->dol_use_jmobile) $this->tool = 'textarea'; // TODO ckeditor ko with jmobile // Define content and some properties if ($this->tool == 'ckeditor') @@ -99,7 +99,7 @@ class DolEditor $this->editor->Value = $content; $this->editor->Height = $height; if (! empty($width)) $this->editor->Width = $width; - $this->editor->ToolbarSet = $shorttoolbarname; + $this->editor->ToolbarSet = $shorttoolbarname; // Profile of this toolbar set is deinfed into theme/mytheme/ckeditor/config.js $this->editor->Config['AutoDetectLanguage'] = 'true'; $this->editor->Config['ToolbarLocation'] = $toolbarlocation ? $toolbarlocation : 'In'; $this->editor->Config['ToolbarStartExpanded'] = $toolbarstartexpanded; @@ -140,21 +140,25 @@ class DolEditor * Output edit area inside the HTML stream. * Output depends on this->tool (fckeditor, ckeditor, textarea, ...) * - * @param int $noprint 1=Return HTML string instead of printing it to output - * @param string $morejs Add more js. For example: ".on( \'saveSnapshot\', function(e) { alert(\'ee\'); });" + * @param int $noprint 1=Return HTML string instead of printing it to output + * @param string $morejs Add more js. For example: ".on( \'saveSnapshot\', function(e) { alert(\'ee\'); });" + * @param boolean $disallowAnyContent Disallow to use any content. true=restrict to a predefined list of allowed elements. * @return void|string */ - function Create($noprint=0,$morejs='') + function Create($noprint=0,$morejs='',$disallowAnyContent=true) { global $conf,$langs; $fullpage=False; - $disallowAnyContent=empty($conf->global->FCKEDITOR_ALLOW_ANY_CONTENT); // Only predefined list of html tags are allowed - + if (isset($conf->global->FCKEDITOR_ALLOW_ANY_CONTENT)) + { + $disallowAnyContent=empty($conf->global->FCKEDITOR_ALLOW_ANY_CONTENT); // Only predefined list of html tags are allowed + } + $found=0; $out=''; - if ($this->tool == 'fckeditor') + if ($this->tool == 'fckeditor') // not used anymore { $found=1; $this->editor->Create(); @@ -179,6 +183,7 @@ class DolEditor $htmlencode_force=preg_match('/_encoded$/',$this->toolbarname)?'true':'false'; + $out.= ''."\n"; $out.= ' '; - + return $ret; } - + /** * Return combo list of activated countries, into language of user * @@ -591,7 +599,7 @@ class Form $resql=$this->db->query($sql); if ($resql) { - $out.= ''; $num = $this->db->num_rows($resql); $i = 0; if ($num) @@ -730,7 +738,7 @@ class Form if (!empty($page)) { - $out .= ''; + $out .= ''; } } else @@ -1029,9 +1037,9 @@ class Form $textifempty=''; // Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'. //if (! empty($conf->use_javascript_ajax) || $forcecombo) $textifempty=''; - if (! empty($conf->global->COMPANY_USE_SEARCH_TO_SELECT)) + if (! empty($conf->global->COMPANY_USE_SEARCH_TO_SELECT)) { - if ($showempty && ! is_numeric($showempty)) $textifempty=$langs->trans($showempty); + if ($showempty && ! is_numeric($showempty)) $textifempty=$langs->trans($showempty); else $textifempty.=$langs->trans("All"); } if ($showempty) $out.= ''."\n"; @@ -1117,7 +1125,8 @@ class Form $sql = "SELECT re.rowid, re.amount_ht, re.amount_tva, re.amount_ttc,"; $sql.= " re.description, re.fk_facture_source"; $sql.= " FROM ".MAIN_DB_PREFIX ."societe_remise_except as re"; - $sql.= " WHERE fk_soc = ".(int) $socid; + $sql.= " WHERE re.fk_soc = ".(int) $socid; + $sql.= " AND re.entity = " . $conf->entity; if ($filter) $sql.= " AND ".$filter; $sql.= " ORDER BY re.description ASC"; @@ -1125,7 +1134,7 @@ class Form $resql=$this->db->query($sql); if ($resql) { - print ''; $num = $this->db->num_rows($resql); $qualifiedlines=$num; @@ -1350,7 +1359,7 @@ class Form * @param integer $show_every 0=default list, 1=add also a value "Everybody" at beginning of list * @param string $enableonlytext If option $enableonly is set, we use this text to explain into label why record is disabled. Not used if enableonly is empty. * @param string $morecss More css - * @param int $noactive Show only active users (this will also happened whatever is this option if USER_HIDE_INACTIVE_IN_COMBOBOX is on). + * @param int $noactive Show only active users (this will also happened whatever is this option if USER_HIDE_INACTIVE_IN_COMBOBOX is on). * @return string HTML select string * @see select_dolgroups */ @@ -1436,7 +1445,7 @@ class Form $nodatarole=($comboenhancement?' data-role="none"':''); } - $out.= ''; if ($show_empty) $out.= ''."\n"; if ($show_every) $out.= ''."\n"; @@ -1562,7 +1571,7 @@ class Form $out.=''; $out.=''; $out.=$this->select_dolusers('', $htmlname, $show_empty, $exclude, $disabled, $include, $enableonly, $force_entity, $maxlength, $showstatus, $morefilter); - $out.=' '; + $out.=' '; } $assignedtouser=array(); if (!empty($_SESSION['assignedtouser'])) @@ -1572,6 +1581,7 @@ class Form $nbassignetouser=count($assignedtouser); if ($nbassignetouser && $action != 'view') $out.='
'; + if ($nbassignetouser) $out.='
'; $i=0; $ownerid=0; foreach($assignedtouser as $key => $value) { @@ -1585,7 +1595,8 @@ class Form $out.='
'; $i++; } - + if ($nbassignetouser) $out.='
'; + //$out.=''; return $out; } @@ -1605,9 +1616,11 @@ class Form * @param int $hidelabel Hide label (0=no, 1=yes, 2=show search icon (before) and placeholder, 3 search icon after) * @param array $ajaxoptions Options for ajax_autocompleter * @param int $socid Thirdparty Id (to get also price dedicated to this customer) + * @param string $showempty '' to not show empty line. Translation key to show an empty line. '1' show empty line with no text. + * @param int $forcecombo Force to use combo box * @return void */ - function select_produits($selected='', $htmlname='productid', $filtertype='', $limit=20, $price_level=0, $status=1, $finished=2, $selected_input_value='', $hidelabel=0, $ajaxoptions=array(), $socid=0) + function select_produits($selected='', $htmlname='productid', $filtertype='', $limit=20, $price_level=0, $status=1, $finished=2, $selected_input_value='', $hidelabel=0, $ajaxoptions=array(), $socid=0, $showempty='1', $forcecombo=0) { global $langs,$conf; @@ -1640,14 +1653,14 @@ class Form print img_picto($langs->trans("Search"), 'search'); } } - print 'global->PRODUCT_SEARCH_AUTOFOCUS) ? 'autofocus' : '').' />'; + print 'global->PRODUCT_SEARCH_AUTOFOCUS) ? 'autofocus' : '').' />'; if ($hidelabel == 3) { print img_picto($langs->trans("Search"), 'search'); } } else { - print $this->select_produits_list($selected,$htmlname,$filtertype,$limit,$price_level,'',$status,$finished,0,$socid); + print $this->select_produits_list($selected,$htmlname,$filtertype,$limit,$price_level,'',$status,$finished,0,$socid,$showempty,$forcecombo); } } @@ -1664,9 +1677,11 @@ class Form * @param int $finished Filter on finished field: 2=No filter * @param int $outputmode 0=HTML select string, 1=Array * @param int $socid Thirdparty Id (to get also price dedicated to this customer) + * @param string $showempty '' to not show empty line. Translation key to show an empty line. '1' show empty line with no text. + * @param int $forcecombo Force to use combo box * @return array Array of keys for json */ - function select_produits_list($selected='',$htmlname='productid',$filtertype='',$limit=20,$price_level=0,$filterkey='',$status=1,$finished=2,$outputmode=0,$socid=0) + function select_produits_list($selected='',$htmlname='productid',$filtertype='',$limit=20,$price_level=0,$filterkey='',$status=1,$finished=2,$outputmode=0,$socid=0,$showempty='1',$forcecombo=0) { global $langs,$conf,$user,$db; @@ -1757,8 +1772,27 @@ class Form require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php'; $num = $this->db->num_rows($result); - $out.=''; + + $textifempty=''; + // Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'. + //if (! empty($conf->use_javascript_ajax) || $forcecombo) $textifempty=''; + if (! empty($conf->global->PRODUIT_USE_SEARCH_TO_SELECT)) + { + if ($showempty && ! is_numeric($showempty)) $textifempty=$langs->trans($showempty); + else $textifempty.=$langs->trans("All"); + } + if ($showempty) $out.=''; $i = 0; while ($num && $i < $num) @@ -1767,7 +1801,7 @@ class Form $optJson = array(); $objp = $this->db->fetch_object($result); - if (!empty($objp->price_by_qty) && $objp->price_by_qty == 1 && !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY)) + if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY) && !empty($objp->price_by_qty) && $objp->price_by_qty == 1) { // Price by quantity will return many prices for the same product $sql = "SELECT rowid, quantity, price, unitprice, remise_percent, remise"; $sql.= " FROM ".MAIN_DB_PREFIX."product_price_by_qty"; @@ -1881,7 +1915,7 @@ class Form $outlabel=$objp->label; $outdesc=$objp->description; $outbarcode=$objp->barcode; - + $outtype=$objp->fk_product_type; $outdurationvalue=$outtype == Product::TYPE_SERVICE?substr($objp->duration,0,dol_strlen($objp->duration)-1):''; $outdurationunit=$outtype == Product::TYPE_SERVICE?substr($objp->duration,-1):''; @@ -1898,13 +1932,13 @@ class Form $opt.= $objp->ref; if ($outbarcode) $opt.=' ('.$outbarcode.')'; $opt.=' - '.dol_trunc($label,$maxlengtharticle).' - '; - + $objRef = $objp->ref; if (! empty($filterkey) && $filterkey != '') $objRef=preg_replace('/('.preg_quote($filterkey).')/i','$1',$objRef,1); $outval.=$objRef; if ($outbarcode) $outval.=' ('.$outbarcode.')'; $outval.=' - '.dol_trunc($label,$maxlengtharticle).' - '; - + $found=0; // Multiprice @@ -1915,8 +1949,8 @@ class Form $sql.= " WHERE fk_product='".$objp->rowid."'"; $sql.= " AND entity IN (".getEntity('productprice', 1).")"; $sql.= " AND price_level=".$price_level; - $sql.= " ORDER BY date_price, rowid"; - $sql.= " DESC LIMIT 1"; + $sql.= " ORDER BY date_price DESC, rowid DESC"; // Warning DESC must be both on date_price and rowid. + $sql.= " LIMIT 1"; dol_syslog(get_class($this).'::constructProductListOption search price for level '.$price_level.'', LOG_DEBUG); $result2 = $this->db->query($sql); @@ -1986,9 +2020,9 @@ class Form } // Price by customer - if (empty($hidepriceinlabel) && !empty($conf->global->PRODUIT_CUSTOMER_PRICES)) + if (empty($hidepriceinlabel) && !empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { - if (!empty($objp->idprodcustprice)) + if (!empty($objp->idprodcustprice)) { $found = 1; @@ -2032,7 +2066,12 @@ class Form if (! empty($conf->stock->enabled) && isset($objp->stock) && $objp->fk_product_type == 0) { $opt.= ' - '.$langs->trans("Stock").':'.$objp->stock; - $outval.=' - '.$langs->transnoentities("Stock").':'.$objp->stock; + + if ($objp->stock > 0) { + $outval.= ' - '.$langs->transnoentities("Stock").':'.$objp->stock.''; + }elseif ($objp->stock <= 0) { + $outval.= ' - '.$langs->transnoentities("Stock").':'.$objp->stock.''; + } } if ($outdurationvalue && $outdurationunit) @@ -2060,13 +2099,14 @@ class Form * @param string $filtre For a SQL filter * @param array $ajaxoptions Options for ajax_autocompleter * @param int $hidelabel Hide label (0=no, 1=yes) + * @param int $alsoproductwithnosupplierprice 1=Add also product without supplier prices * @return void */ - function select_produits_fournisseurs($socid, $selected='', $htmlname='productid', $filtertype='', $filtre='', $ajaxoptions=array(), $hidelabel=0) + function select_produits_fournisseurs($socid, $selected='', $htmlname='productid', $filtertype='', $filtre='', $ajaxoptions=array(), $hidelabel=0, $alsoproductwithnosupplierprice=0) { global $langs,$conf; global $price_level, $status, $finished; - + $selected_input_value=''; if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->PRODUIT_USE_SEARCH_TO_SELECT)) { @@ -2084,7 +2124,7 @@ class Form print ''; } // mode=2 means suppliers products - $urloption=($socid > 0?'socid='.$socid.'&':'').'htmlname='.$htmlname.'&outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=2&status='.$status.'&finished='.$finished; + $urloption=($socid > 0?'socid='.$socid.'&':'').'htmlname='.$htmlname.'&outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=2&status='.$status.'&finished='.$finished.'&alsoproductwithnosupplierprice='.$alsoproductwithnosupplierprice; print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 0, $ajaxoptions); print ($hidelabel?'':$langs->trans("RefOrLabel").' : ').''; } @@ -2095,7 +2135,7 @@ class Form print ''; print ''; } - print $this->select_produits_fournisseurs_list($socid,$selected,$htmlname,$filtertype,$filtre,'',-1,0); + print $this->select_produits_fournisseurs_list($socid,$selected,$htmlname,$filtertype,$filtre,'',-1,0,0,$alsoproductwithnosupplierprice); } } @@ -2111,9 +2151,10 @@ class Form * @param int $statut -1=Return all products, 0=Products not on sell, 1=Products on sell (not used here, a filter on tobuy is already hard coded in request) * @param int $outputmode 0=HTML select string, 1=Array * @param int $limit Limit of line number + * @param int $alsoproductwithnosupplierprice 1=Add also product without supplier prices * @return array Array of keys for json */ - function select_produits_fournisseurs_list($socid,$selected='',$htmlname='productid',$filtertype='',$filtre='',$filterkey='',$statut=-1,$outputmode=0,$limit=100) + function select_produits_fournisseurs_list($socid,$selected='',$htmlname='productid',$filtertype='',$filtre='',$filterkey='',$statut=-1,$outputmode=0,$limit=100,$alsoproductwithnosupplierprice=0) { global $langs,$conf,$db; @@ -2167,7 +2208,7 @@ class Form $num = $this->db->num_rows($result); //$out.=''; + $out.=''; if ($addempty) print ''; foreach($this->cache_conditions_paiements as $id => $arrayconditions) @@ -2784,9 +2838,10 @@ class Form * @param int $noadmininfo 0=Add admin info, 1=Disable admin info * @param int $maxlength Max length of label * @param int $active Active or not, -1 = all + * @param string $morecss Add more css * @return void */ - function select_types_paiements($selected='', $htmlname='paiementtype', $filtertype='', $format=0, $empty=0, $noadmininfo=0, $maxlength=0, $active=1) + function select_types_paiements($selected='', $htmlname='paiementtype', $filtertype='', $format=0, $empty=0, $noadmininfo=0, $maxlength=0, $active=1, $morecss='') { global $langs,$user; @@ -2799,13 +2854,13 @@ class Form $this->load_cache_types_paiements(); - print ''; if ($empty) print ''; foreach($this->cache_types_paiements as $id => $arraytypes) { // If not good status if ($active >= 0 && $arraytypes['active'] != $active) continue; - + // On passe si on a demande de filtrer sur des modes de paiments particuliers if (count($filterarray) && ! in_array($arraytypes['type'],$filterarray)) continue; @@ -2940,12 +2995,9 @@ class Form print '
'; print ''; print ''; - print '
'; } if (! empty($head['text'])) { @@ -250,12 +251,15 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty" $out.= $s; } $out.= ' '; - if (! empty($head['sublink'])) $out.= ''; - if (! empty($head['subpicto'])) $out.= img_picto($head['subtext'], $head['subpicto'], 'class="'.(empty($head['subclass'])?'':$head['subclass']).'" id="idsubimg'.$this->boxcode.'"'); - if (! empty($head['sublink'])) ''; + + $sublink=''; + if (! empty($head['sublink'])) $sublink.= ''; + if (! empty($head['subpicto'])) $sublink.= img_picto($head['subtext'], $head['subpicto'], 'class="'.(empty($head['subclass'])?'':$head['subclass']).'" id="idsubimg'.$this->boxcode.'"'); + if (! empty($head['sublink'])) $sublink.= ''; if (! empty($conf->use_javascript_ajax)) { $out.= ''; + $out.=$sublink; // The image must have the class 'boxhandle' beause it's value used in DOM draggable objects to define the area used to catch the full object $out.= img_picto($langs->trans("MoveBox",$this->box_id),'grip_title','class="boxhandle hideonsmartphone" style="cursor:move;"'); $out.= img_picto($langs->trans("CloseBox",$this->box_id),'close_title','class="boxclose" rel="x:y" style="cursor:pointer;" id="imgclose'.$this->box_id.'"'); @@ -358,13 +362,16 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty" } } else { dol_syslog(get_class($this).'::showBoxCached'); - $out = dol_readcachefile($cachedir, $filename); - print ""; - + $out = ""; + $out.= dol_readcachefile($cachedir, $filename); } - print $out; - } - + + if ($nooutput) return $out; + else print $out; + + return ''; + } + } diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 1db31697bb8..317b84e0b29 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -134,6 +134,13 @@ class CMailFile dol_syslog("CMailFile::CMailfile: MAIN_MAIL_SENDMODE=".$conf->global->MAIN_MAIL_SENDMODE." charset=".$conf->file->character_set_client." from=$from, to=$to, addr_cc=$addr_cc, addr_bcc=$addr_bcc, errors_to=$errors_to, trackid=$trackid", LOG_DEBUG); dol_syslog("CMailFile::CMailfile: subject=$subject, deliveryreceipt=$deliveryreceipt, msgishtml=$msgishtml", LOG_DEBUG); + if (empty($subject)) + { + dol_syslog("CMailFile::CMailfile: Try to send an email with empty subject"); + $this->error='ErrorSubjectIsRequired'; + return; + } + // Detect if message is HTML (use fast method) if ($msgishtml == -1) { @@ -436,8 +443,7 @@ class CMailFile { // Send mail method not correctly defined // -------------------------------------- - - return 'Bad value for MAIN_MAIL_SENDMODE constant'; + $this->error = 'Bad value for MAIN_MAIL_SENDMODE constant'; } } @@ -684,7 +690,7 @@ class CMailFile * @param string $stringtoencode String to encode * @return string string encoded */ - function encodetorfc2822($stringtoencode) + static function encodetorfc2822($stringtoencode) { global $conf; return '=?'.$conf->file->character_set_client.'?B?'.base64_encode($stringtoencode).'?='; @@ -1099,12 +1105,12 @@ class CMailFile $_retVal = true; // Indicates if Object was created or not $server_response = ''; - while ( substr($server_response,3,1) != ' ' ) + while (substr($server_response,3,1) != ' ') { - if( !( $server_response = fgets($socket, 256) ) ) + if (! ($server_response = fgets($socket, 256)) ) { $this->error="Couldn't get mail server response codes"; - $_retVal = false; + return false; } } @@ -1214,15 +1220,17 @@ class CMailFile /** * Return a formatted address string for SMTP protocol * - * @param string $address Example: 'John Doe , Alan Smith ' or 'john@doe.com, alan@smith.com' - * @param int $format 0=auto, 1=emails with <>, 2=emails without <>, 3=auto + label between " - * @param int $encode 1=Encode name to RFC2822 - * @return string If format 0: '' or 'John Doe ' or '=?UTF-8?B?Sm9obiBEb2U=?= ' - * If format 1: '' - * If format 2: 'john@doe.com' - * If format 3: '' or '"John Doe" ' or '"=?UTF-8?B?Sm9obiBEb2U=?=" ' + * @param string $address Example: 'John Doe , Alan Smith ' or 'john@doe.com, alan@smith.com' + * @param int $format 0=auto, 1=emails with <>, 2=emails without <>, 3=auto + label between " + * @param int $encode 0=No encode name, 1=Encode name to RFC2822 + * @param int $maxnumberofemail 0=No limit. Otherwise, maximum number of emails returned ($address may contains several email separated with ','). Add '...' if there is more. + * @return string If format 0: '' or 'John Doe ' or '=?UTF-8?B?Sm9obiBEb2U=?= ' + * If format 1: '' + * If format 2: 'john@doe.com' + * If format 3: '' or '"John Doe" ' or '"=?UTF-8?B?Sm9obiBEb2U=?=" ' + * If format 4: 'John Doe' or 'john@doe.com' if no label exists */ - function getValidAddress($address,$format,$encode='') + static function getValidAddress($address,$format,$encode=0,$maxnumberofemail=0) { global $conf; @@ -1231,6 +1239,7 @@ class CMailFile $arrayaddress=explode(',',$address); // Boucle sur chaque composant de l'adresse + $i=0; foreach($arrayaddress as $val) { if (preg_match('/^(.*)<(.*)>$/i',trim($val),$regs)) @@ -1246,7 +1255,13 @@ class CMailFile if ($email) { + $i++; + $newemail=''; + if ($format == 4) + { + $newemail = $name?$name:$email; + } if ($format == 2) { $newemail=$email; @@ -1259,10 +1274,17 @@ class CMailFile { if (! empty($conf->global->MAIN_MAIL_NO_FULL_EMAIL)) $newemail='<'.$email.'>'; elseif (! $name) $newemail='<'.$email.'>'; - else $newemail=($format==3?'"':'').($encode?$this->encodetorfc2822($name):$name).($format==3?'"':'').' <'.$email.'>'; + else $newemail=($format==3?'"':'').($encode?self::encodetorfc2822($name):$name).($format==3?'"':'').' <'.$email.'>'; } $ret=($ret ? $ret.',' : '').$newemail; + + // Stop if we have too much records + if ($maxnumberofemail && $i >= $maxnumberofemail) + { + if (count($arrayaddress) > $maxnumberofemail) $ret.='...'; + break; + } } } diff --git a/htdocs/core/class/ccountry.class.php b/htdocs/core/class/ccountry.class.php index 59980cea7a9..d0e6dfe190a 100644 --- a/htdocs/core/class/ccountry.class.php +++ b/htdocs/core/class/ccountry.class.php @@ -143,7 +143,7 @@ class Ccountry // extends CommonObject * * @param int $id Id object * @param string $code Code - * @return int <0 if KO, >0 if OK + * @return int >0 if OK, 0 if not found, <0 if KO */ function fetch($id,$code='') { @@ -171,10 +171,13 @@ class Ccountry // extends CommonObject $this->code_iso = $obj->code_iso; $this->label = $obj->label; $this->active = $obj->active; - } - $this->db->free($resql); - return 1; + $this->db->free($resql); + return 1; + } + else { + return 0; + } } else { diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index b8aa683097f..df65e73f679 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -35,8 +35,8 @@ abstract class CommonDocGenerator { var $error=''; protected $db; - - + + /** * Constructor * @@ -209,7 +209,7 @@ abstract class CommonDocGenerator { $object->array_options['options_'.$key] = price($object->array_options['options_'.$key],0,$outputlangs,0,0,-1,$conf->currency); } - else if($extrafields->attribute_type[$key] == 'select') + else if($extrafields->attribute_type[$key] == 'select' || $extrafields->attribute_type[$key] == 'checkbox') { $object->array_options['options_'.$key] = $extrafields->attribute_param[$key]['options'][$object->array_options['options_'.$key]]; } @@ -280,7 +280,7 @@ abstract class CommonDocGenerator { $object->array_options['options_' . $key] = price($object->array_options ['options_' . $key], 0, $outputlangs, 0, 0, - 1, $conf->currency); } - elseif($extrafields->attribute_type[$key] == 'select') + elseif($extrafields->attribute_type[$key] == 'select' || $extrafields->attribute_type[$key] == 'checkbox') { $object->array_options['options_' . $key] = $extrafields->attribute_param[$key]['options'][$object->array_options['options_' . $key]]; } @@ -322,7 +322,7 @@ abstract class CommonDocGenerator * * @param Object $object Main object to use as data source * @param Translate $outputlangs Lang object to use for output - * @param array_key $array_key Name of the key for return array + * @param string $array_key Name of the key for return array * @return array Array of substitution */ function get_substitutionarray_object($object,$outputlangs,$array_key='object') @@ -389,7 +389,7 @@ abstract class CommonDocGenerator // Add vat by rates foreach ($object->lines as $line) { - // $line->tva_tx format depends on database field accuraty, no reliable. This is kept for backward comaptibility + // $line->tva_tx format depends on database field accuraty, no reliable. This is kept for backward comaptibility if (empty($resarray[$array_key.'_total_vat_'.$line->tva_tx])) $resarray[$array_key.'_total_vat_'.$line->tva_tx]=0; $resarray[$array_key.'_total_vat_'.$line->tva_tx]+=$line->total_tva; $resarray[$array_key.'_total_vat_locale_'.$line->tva_tx]=price($resarray[$array_key.'_total_vat_'.$line->tva_tx]); @@ -429,7 +429,7 @@ abstract class CommonDocGenerator 'line_fulldesc'=>doc_getlinedesc($line,$outputlangs), 'line_product_ref'=>$line->product_ref, 'line_product_label'=>$line->product_label, - 'line_product_type'=>$line->product_type, + 'line_product_type'=>$line->product_type, 'line_desc'=>$line->desc, 'line_vatrate'=>vatrate($line->tva_tx,true,$line->info_bits), 'line_up'=>price2num($line->subprice), @@ -443,9 +443,9 @@ abstract class CommonDocGenerator 'line_price_ttc_locale'=>price($line->total_ttc, 0, $outputlangs), 'line_price_vat_locale'=>price($line->total_tva, 0, $outputlangs), 'line_date_start'=>$line->date_start, - 'line_date_start_rfc'=>dol_print_date($line->date_start,'rfc'), + 'line_date_start_rfc'=>dol_print_date($line->date_start,'dayrfc'), 'line_date_end'=>$line->date_end, - 'line_date_end_rfc'=>dol_print_date($line->date_end,'rfc') + 'line_date_end_rfc'=>dol_print_date($line->date_end,'dayrfc') ); // Retrieve extrafields @@ -576,12 +576,12 @@ abstract class CommonDocGenerator //Add value to store price with currency $array_to_fill=array_merge($array_to_fill,array($array_key.'_options_'.$key.'_currency' => $object->array_options['options_'.$key.'_currency'])); } - else if($extrafields->attribute_type[$key] == 'select') + else if($extrafields->attribute_type[$key] == 'select' || $extrafields->attribute_type[$key] == 'checkbox') { $object->array_options['options_'.$key] = $extrafields->attribute_param[$key]['options'][$object->array_options['options_'.$key]]; } else if($extrafields->attribute_type[$key] == 'date') - { + { if (strlen($object->array_options['options_'.$key])>0) { $object->array_options['options_'.$key] = dol_print_date($object->array_options['options_'.$key],'day'); // using company output language diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index 7c68a5ff978..b3b0cc4042b 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -198,9 +198,9 @@ abstract class CommonInvoice extends CommonObject } /** - * Retourne le libelle du type de facture + * Return label of type of invoice * - * @return string Libelle + * @return string Label of type of invoice */ function getLibType() { @@ -209,7 +209,7 @@ abstract class CommonInvoice extends CommonObject if ($this->type == CommonInvoice::TYPE_REPLACEMENT) return $langs->trans("InvoiceReplacement"); if ($this->type == CommonInvoice::TYPE_CREDIT_NOTE) return $langs->trans("InvoiceAvoir"); if ($this->type == CommonInvoice::TYPE_DEPOSIT) return $langs->trans("InvoiceDeposit"); - if ($this->type == CommonInvoice::TYPE_PROFORMA) return $langs->trans("InvoiceProForma"); + if ($this->type == CommonInvoice::TYPE_PROFORMA) return $langs->trans("InvoiceProForma"); // Not used. if ($this->type == CommonInvoice::TYPE_SITUATION) return $langs->trans("InvoiceSituation"); return $langs->trans("Unknown"); } @@ -217,7 +217,7 @@ abstract class CommonInvoice extends CommonObject /** * Return label of object status * - * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto + * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=Long label + picto * @param integer $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise) * @return string Label */ @@ -364,9 +364,9 @@ abstract class CommonInvoice extends CommonObject if (! $cond_reglement) $cond_reglement=$this->cond_reglement_code; if (! $cond_reglement) $cond_reglement=$this->cond_reglement_id; - $cdr_nbjour=0; $cdr_fdm=0; $cdr_decalage=0; + $cdr_nbjour=0; $cdr_type=0; $cdr_decalage=0; - $sqltemp = 'SELECT c.fdm,c.nbjour,c.decalage'; + $sqltemp = 'SELECT c.type_cdr,c.nbjour,c.decalage'; $sqltemp.= ' FROM '.MAIN_DB_PREFIX.'c_payment_term as c'; if (is_numeric($cond_reglement)) $sqltemp.= " WHERE c.rowid=".$cond_reglement; else $sqltemp.= " WHERE c.code='".$this->db->escape($cond_reglement)."'"; @@ -379,7 +379,7 @@ abstract class CommonInvoice extends CommonObject { $obj = $this->db->fetch_object($resqltemp); $cdr_nbjour = $obj->nbjour; - $cdr_fdm = $obj->fdm; + $cdr_type = $obj->type_cdr; $cdr_decalage = $obj->decalage; } } @@ -396,7 +396,7 @@ abstract class CommonInvoice extends CommonObject $datelim = $this->date + ($cdr_nbjour * 3600 * 24); // 2 : application de la regle "fin de mois" - if ($cdr_fdm) + if ($cdr_type == 1) { $mois=date('m', $datelim); $annee=date('Y', $datelim); @@ -413,6 +413,19 @@ abstract class CommonInvoice extends CommonObject $datelim=dol_mktime(12,0,0,$mois,1,$annee); $datelim -= (3600 * 24); } + elseif($cdr_type == 2 && !empty($cdr_nbjour)) // Application de la règle, le N du mois courant ou suivant + { + + $date_piece = dol_mktime(0,0,0,date('m', $this->date),date('d', $this->date),date('Y', $this->date)); // Sans les heures minutes et secondes + $date_lim_current = dol_mktime(0,0,0,date('m', $this->date),$cdr_nbjour,date('Y', $this->date)); // Sans les heures minutes et secondes + $date_lim_next = strtotime(date('Y-m-d', $date_lim_current).' +1month'); + + $diff = $date_piece - $date_lim_current; + + if($diff < 0) $datelim = $date_lim_current; + else $datelim = $date_lim_next; + + } // 3 : application du decalage $datelim += ($cdr_decalage * 3600 * 24); diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 15272a19d6c..e2c6d67074a 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -433,7 +433,7 @@ abstract class CommonObject /** - * Return full address of contact + * Return full address for banner * * @param string $htmlkey HTML id to make banner content unique * @param Object $object Object (thirdparty, thirdparty of contact for contact, null for a member) @@ -444,7 +444,7 @@ abstract class CommonObject global $conf, $langs; $countriesusingstate=array('AU','US','IN','GB','ES','UK','TR'); // See also option MAIN_FORCE_STATE_INTO_ADDRESS - + $contactid=0; $thirdpartyid=0; if ($this->element == 'societe') @@ -461,12 +461,12 @@ abstract class CommonObject $contactid=$this->contact_id; $thirdpartyid=$object->fk_soc; } - + $out=''; - + $outdone=0; $coords = $this->getFullAddress(1,', '); - if ($coords) + if ($coords) { if (! empty($conf->use_javascript_ajax)) { @@ -476,12 +476,12 @@ abstract class CommonObject $out.=img_picto($langs->trans("Address"), 'object_address.png'); $out.=' '; } - $out.=dol_print_address($coords, 'address_'.$htmlkey.'_'.$this->id, $this->element, $this->id, 1); $outdone++; + $out.=dol_print_address($coords, 'address_'.$htmlkey.'_'.$this->id, $this->element, $this->id, 1, ', '); $outdone++; $outdone++; } if (! in_array($this->country_code,$countriesusingstate) && empty($conf->global->MAIN_FORCE_STATE_INTO_ADDRESS) // If MAIN_FORCE_STATE_INTO_ADDRESS is on, state is already returned previously with getFullAddress - && empty($conf->global->SOCIETE_DISABLE_STATE) && $this->state) + && empty($conf->global->SOCIETE_DISABLE_STATE) && $this->state) { $out.=($outdone?' - ':'').$this->state; $outdone++; @@ -512,17 +512,17 @@ abstract class CommonObject if (! empty($this->office_fax)) { $out.=dol_print_phone($this->fax,$this->country_code,$contactid,$thirdpartyid,'AC_FAX',' ','fax',$langs->trans("Fax")); $outdone++; } - + $out.='
'; $outdone=0; - if (! empty($this->email)) + if (! empty($this->email)) { $out.=dol_print_email($this->email,$this->id,$object->id,'AC_EMAIL',0,0,1); $outdone++; } - if (! empty($this->url)) + if (! empty($this->url)) { - $out.=dol_print_url($this->url,'',0,1); + $out.=dol_print_url($this->url,'_goout',0,1); $outdone++; } if (! empty($conf->skype->enabled)) @@ -531,17 +531,17 @@ abstract class CommonObject if ($this->skype) $out.=dol_print_skype($this->skype,$this->id,$object->id,'AC_SKYPE'); $outdone++; } - + $out.=''; - + return $out; } - + /** * Add a link between element $this->element and a contact * * @param int $fk_socpeople Id of thirdparty contact (if source = 'external') or id of user (if souce = 'internal') to link - * @param int $type_contact Type of contact (code or id). Must be if or code found into table llx_c_type_contact. For example: SALESREPFOLL + * @param int $type_contact Type of contact (code or id). Must be id or code found into table llx_c_type_contact. For example: SALESREPFOLL * @param string $source external=Contact extern (llx_socpeople), internal=Contact intern (llx_user) * @param int $notrigger Disable all triggers * @return int <0 if KO, >0 if OK @@ -551,7 +551,7 @@ abstract class CommonObject global $user,$langs; - dol_syslog(get_class($this)."::add_contact $fk_socpeople, $type_contact, $source"); + dol_syslog(get_class($this)."::add_contact $fk_socpeople, $type_contact, $source, $notrigger"); // Check parameters if ($fk_socpeople <= 0) @@ -587,22 +587,28 @@ abstract class CommonObject if ($resql) { $obj = $this->db->fetch_object($resql); - $id_type_contact=$obj->rowid; + if ($obj) $id_type_contact=$obj->rowid; } } + if ($id_type_contact == 0) + { + $this->error='CODE_NOT_VALID_FOR_THIS_ELEMENT'; + dol_syslog("CODE_NOT_VALID_FOR_THIS_ELEMENT"); + return -3; + } + $datecreate = dol_now(); - - $this->db->begin(); + $this->db->begin(); + // Insertion dans la base $sql = "INSERT INTO ".MAIN_DB_PREFIX."element_contact"; $sql.= " (element_id, fk_socpeople, datecreate, statut, fk_c_type_contact) "; $sql.= " VALUES (".$this->id.", ".$fk_socpeople." , " ; $sql.= "'".$this->db->idate($datecreate)."'"; - $sql.= ", 4, '". $id_type_contact . "' "; + $sql.= ", 4, ". $id_type_contact; $sql.= ")"; - dol_syslog(get_class($this)."::add_contact", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) @@ -610,9 +616,9 @@ abstract class CommonObject if (! $notrigger) { $result=$this->call_trigger(strtoupper($this->element).'_ADD_CONTACT', $user); - if ($result < 0) - { - $this->db->rollback(); + if ($result < 0) + { + $this->db->rollback(); return -1; } } @@ -883,9 +889,9 @@ abstract class CommonObject if (empty($order)) $order='position'; if ($order == 'position') $order.=',code'; - + $tab = array(); - $sql = "SELECT DISTINCT tc.rowid, tc.code, tc.libelle"; + $sql = "SELECT DISTINCT tc.rowid, tc.code, tc.libelle, tc.position"; $sql.= " FROM ".MAIN_DB_PREFIX."c_type_contact as tc"; $sql.= " WHERE tc.element='".$this->element."'"; if ($activeonly == 1) $sql.= " AND tc.active=1"; // only the active types @@ -1196,7 +1202,7 @@ abstract class CommonObject if (!empty($id) && !empty($field) && !empty($table)) { $sql = "SELECT ".$field." FROM ".MAIN_DB_PREFIX.$table; $sql.= " WHERE rowid = ".$id; - + dol_syslog(get_class($this).'::getValueFrom', LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) @@ -1209,29 +1215,39 @@ abstract class CommonObject } /** - * Setter generic. Update a specific field into database + * Setter generic. Update a specific field into database. + * Warning: Trigger is run only if param trigkey is provided. * * @param string $field Field to update * @param mixed $value New value * @param string $table To force other table element or element line (should not be used) * @param int $id To force other object id (should not be used) * @param string $format Data format ('text', 'date'). 'text' is used if not defined - * @param string $id_field To force rowid field name. 'rowid' is used it not defined + * @param string $id_field To force rowid field name. 'rowid' is used if not defined * @param User|string $user Update last update fields also if user object provided + * @param string $trigkey Trigger key to run (in most cases something like 'XXX_MODIFY') * @return int <0 if KO, >0 if OK */ - function setValueFrom($field, $value, $table='', $id=null, $format='', $id_field='', $user='') + function setValueFrom($field, $value, $table='', $id=null, $format='', $id_field='', $user='', $trigkey='') { - if (empty($table)) $table=$this->table_element; - if (empty($id)) $id=$this->id; - if (empty($format)) $format='text'; - if (empty($id_field)) $id_field='rowid'; + global $user,$langs,$conf; + + if (empty($table)) $table=$this->table_element; + if (empty($id)) $id=$this->id; + if (empty($format)) $format='text'; + if (empty($id_field)) $id_field='rowid'; + $error=0; + $this->db->begin(); + // Special case + if ($table == 'product' && $field == 'note_private') $field='note'; + $sql = "UPDATE ".MAIN_DB_PREFIX.$table." SET "; if ($format == 'text') $sql.= $field." = '".$this->db->escape($value)."'"; - else if ($format == 'date') $sql.= $field." = '".$this->db->idate($value)."'"; + else if ($format == 'int') $sql.= $field." = ".$this->db->escape($value); + else if ($format == 'date') $sql.= $field." = ".($value ? "'".$this->db->idate($value)."'" : "null"); if (is_object($user)) $sql.=", fk_user_modif = ".$user->id; $sql.= " WHERE ".$id_field." = ".$id; @@ -1239,8 +1255,23 @@ abstract class CommonObject $resql = $this->db->query($sql); if ($resql) { - $this->db->commit(); - return 1; + if ($trigkey) + { + $result=$this->call_trigger($trigkey, $user); // This may set this->errors + if ($result < 0) $error++; + } + + if (! $error) + { + if (property_exists($this, $field)) $this->$field = $value; + $this->db->commit(); + return 1; + } + else + { + $this->db->rollback(); + return -2; + } } else { @@ -1258,7 +1289,7 @@ abstract class CommonObject * @param int $nodbprefix Do not include DB prefix to forge table name * @return int <0 if KO, >0 if OK */ - function load_previous_next_ref($filter,$fieldid,$nodbprefix=0) + function load_previous_next_ref($filter, $fieldid, $nodbprefix=0) { global $user; @@ -1428,7 +1459,7 @@ abstract class CommonObject if ($this->statut >= 0 || $this->element == 'societe') { $fieldname = 'multicurrency_code'; - + $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element; $sql .= ' SET '.$fieldname.' = "'.$this->db->escape($code).'"'; $sql .= ' WHERE rowid='.$this->id; @@ -1436,10 +1467,10 @@ abstract class CommonObject if ($this->db->query($sql)) { $this->multicurrency_code = $code; - + list($fk_multicurrency, $rate) = MultiCurrency::getIdAndTxFromCode($this->db, $code); if ($rate) $this->setMulticurrencyRate($rate); - + return 1; } else @@ -1456,7 +1487,7 @@ abstract class CommonObject return -2; } } - + /** * Change the multicurrency rate * @@ -1469,7 +1500,7 @@ abstract class CommonObject if ($this->statut >= 0 || $this->element == 'societe') { $fieldname = 'multicurrency_tx'; - + $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element; $sql .= ' SET '.$fieldname.' = '.$rate; $sql .= ' WHERE rowid='.$this->id; @@ -1477,11 +1508,11 @@ abstract class CommonObject if ($this->db->query($sql)) { $this->multicurrency_tx = $rate; - + // Update line price if (!empty($this->lines)) { - foreach ($this->lines as &$line) + foreach ($this->lines as &$line) { switch ($this->element) { case 'propal': @@ -1503,10 +1534,10 @@ abstract class CommonObject dol_syslog(get_class($this).'::setMulticurrencyRate no updateline defined', LOG_DEBUG); break; } - + } } - + return 1; } else @@ -2112,7 +2143,10 @@ abstract class CommonObject dol_syslog(get_class($this)."::update_note Parameter suffix must be empty, '_private' or '_public'", LOG_ERR); return -2; } - + // Special cas + //var_dump($this->table_element);exit; + if ($this->table_element == 'product') $suffix=''; + $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element; $sql.= " SET note".$suffix." = ".(!empty($note)?("'".$this->db->escape($note)."'"):"NULL"); $sql.= " WHERE rowid =". $this->id; @@ -2122,7 +2156,11 @@ abstract class CommonObject { if ($suffix == '_public') $this->note_public = $note; else if ($suffix == '_private') $this->note_private = $note; - else $this->note = $note; + else + { + $this->note = $note; // deprecated + $this->note_private = $note; + } return 1; } else @@ -2244,7 +2282,7 @@ abstract class CommonObject $this->total_localtax1 += $obj->total_localtax1; $this->total_localtax2 += $obj->total_localtax2; $this->total_ttc += $obj->total_ttc; - + if (! isset($total_ht_by_vats[$obj->vatrate])) $total_ht_by_vats[$obj->vatrate]=0; if (! isset($total_tva_by_vats[$obj->vatrate])) $total_tva_by_vats[$obj->vatrate]=0; if (! isset($total_ttc_by_vats[$obj->vatrate])) $total_ttc_by_vats[$obj->vatrate]=0; @@ -2290,12 +2328,12 @@ abstract class CommonObject $this->total_ttc -= $sit->total_ttc; } } - + // Multicurrency $this->multicurrency_total_ht += $this->total_ht * $multicurrency_tx; $this->multicurrency_total_tva += $this->total_tva * $multicurrency_tx; $this->multicurrency_total_ttc += $this->total_ttc * $multicurrency_tx; - + $this->db->free($resql); // Now update global field total_ht, total_ttc and tva @@ -2364,6 +2402,10 @@ abstract class CommonObject $origin = (! empty($origin) ? $origin : $this->origin); $origin_id = (! empty($origin_id) ? $origin_id : $this->origin_id); + // Special case + if ($origin == 'order') $origin='commande'; + if ($origin == 'invoice') $origin='facture'; + $this->db->begin(); $sql = "INSERT INTO ".MAIN_DB_PREFIX."element_element ("; @@ -2398,8 +2440,8 @@ abstract class CommonObject * - all parameters empty -> we look all link to current object (current object can be source or target) * - one couple id+type is provided -> this will set $justsource or $justtarget * - one couple id+type is provided and other type is provided -> this will set $justsource or $justtarget + criteria on other type - * - * + * + * * @param int $sourceid Object source id (if not defined, id of object) * @param string $sourcetype Object source type (if not defined, element name of object) * @param int $targetid Object target id (if not defined, id of object) @@ -2451,19 +2493,19 @@ abstract class CommonObject { if ($justsource) { - $sql.= "fk_source = '".$sourceid."' AND sourcetype = '".$sourcetype."'"; + $sql.= "fk_source = ".$sourceid." AND sourcetype = '".$sourcetype."'"; if ($withtargettype) $sql.= " AND targettype = '".$targettype."'"; } else if ($justtarget) { - $sql.= "fk_target = '".$targetid."' AND targettype = '".$targettype."'"; + $sql.= "fk_target = ".$targetid." AND targettype = '".$targettype."'"; if ($withsourcetype) $sql.= " AND sourcetype = '".$sourcetype."'"; } } else { - $sql.= "(fk_source = '".$sourceid."' AND sourcetype = '".$sourcetype."')"; - $sql.= " ".$clause." (fk_target = '".$targetid."' AND targettype = '".$targettype."')"; + $sql.= "(fk_source = ".$sourceid." AND sourcetype = '".$sourcetype."')"; + $sql.= " ".$clause." (fk_target = ".$targetid." AND targettype = '".$targettype."')"; } $sql .= ' ORDER BY sourcetype'; //print $sql; @@ -2508,7 +2550,7 @@ abstract class CommonObject { // Parse element/subelement (ex: project_task) $module = $element = $subelement = $objecttype; - if ($objecttype != 'supplier_proposal' && $objecttype != 'order_supplier' && $objecttype != 'invoice_supplier' + if ($objecttype != 'supplier_proposal' && $objecttype != 'order_supplier' && $objecttype != 'invoice_supplier' && preg_match('/^([^_]+)_([^_]+)/i',$objecttype,$regs)) { $module = $element = $regs[1]; @@ -2541,16 +2583,17 @@ abstract class CommonObject else if ($objecttype == 'fichinter') { $classpath = 'fichinter/class'; $subelement = 'fichinter'; $module = 'ficheinter'; } - - // TODO ajout temporaire - MAXIME MANGIN - else if ($objecttype == 'contratabonnement') { - $classpath = 'contrat/class'; $subelement = 'contrat'; $module = 'contratabonnement'; + else if ($objecttype == 'subscription') { + $classpath = 'adherents/class'; $module = 'adherent'; } // Set classfile $classfile = strtolower($subelement); $classname = ucfirst($subelement); - - if ($objecttype == 'invoice_supplier') { + + if ($objecttype == 'order') { + $classfile = 'commande'; $classname = 'Commande'; + } + else if ($objecttype == 'invoice_supplier') { $classfile = 'fournisseur.facture'; $classname = 'FactureFournisseur'; } else if ($objecttype == 'order_supplier') { @@ -2562,20 +2605,26 @@ abstract class CommonObject else if ($objecttype == 'facturerec') { $classfile = 'facture-rec'; $classname = 'FactureRec'; } - + else if ($objecttype == 'subscription') { + $classfile = 'subscription'; $classname = 'Subscription'; + } + // Here $module, $classfile and $classname are set if ($conf->$module->enabled && (($element != $this->element) || $alsosametype)) { dol_include_once('/'.$classpath.'/'.$classfile.'.class.php'); - - foreach($objectids as $i => $objectid) // $i is rowid into llx_element_element + //print '/'.$classpath.'/'.$classfile.'.class.php'; + if (class_exists($classname)) { - $object = new $classname($this->db); - $ret = $object->fetch($objectid); - if ($ret >= 0) - { - $this->linkedObjects[$objecttype][$i] = $object; - } + foreach($objectids as $i => $objectid) // $i is rowid into llx_element_element + { + $object = new $classname($this->db); + $ret = $object->fetch($objectid); + if ($ret >= 0) + { + $this->linkedObjects[$objecttype][$i] = $object; + } + } } } } @@ -2731,6 +2780,7 @@ abstract class CommonObject $trigkey=''; if ($this->element == 'supplier_proposal' && $status == 2) $trigkey='SUPPLIER_PROPOSAL_CLOSE'; + if ($this->element == 'fichinter' && $status == 3) $trigkey='FICHINTER_CLASSIFY_DONE'; if ($this->element == 'fichinter' && $status == 2) $trigkey='FICHINTER_CLASSIFY_BILLED'; if ($this->element == 'fichinter' && $status == 1) $trigkey='FICHINTER_CLASSIFY_UNBILLED'; @@ -2935,7 +2985,7 @@ abstract class CommonObject return price2num($total_discount); } - + /** * Return into unit=0, the calculated total of weight and volume of all lines * qty * Calculate by adding weight and volume of each product line, so properties ->volume/volume_units/weight/weight_units must be loaded on line. @@ -2950,13 +3000,13 @@ abstract class CommonObject $totalVolume = ''; $totalOrdered = ''; // defined for shipment only $totalToShip = ''; // defined for shipment only - + foreach ($this->lines as $line) { - + $totalOrdered+=$line->qty_asked; // defined for shipment only $totalToShip+=$line->qty_shipped; // defined for shipment only - + // Define qty, weight, volume, weight_units, volume_units if ($this->element == 'shipping') $qty=$line->qty_shipped; // for shipments else $qty=$line->qty; @@ -2964,12 +3014,12 @@ abstract class CommonObject $volume=$line->volume; $weight_units=$line->weight_units; $volume_units=$line->volume_units; - + $weightUnit=0; $volumeUnit=0; if (! empty($weight_units)) $weightUnit = $weight_units; if (! empty($volume_units)) $volumeUnit = $volume_units; - + //var_dump($line->volume_units); if ($weight_units < 50) // >50 means a standard unit (power of 10 of official unit) > 50 means an exotic unit (like inch) { @@ -2992,11 +3042,11 @@ abstract class CommonObject $totalVolume += $volume * $qty; // This may be wrong if we mix different units } } - + return array('weight'=>$totalWeight, 'volume'=>$totalVolume, 'ordered'=>$totalOrdered, 'toship'=>$totalToShip); - } - - + } + + /** * Set extra parameters * @@ -3030,6 +3080,7 @@ abstract class CommonObject /** * Return incoterms informations + * TODO Use a cache for label get * * @return string incoterms info */ @@ -3048,7 +3099,7 @@ abstract class CommonObject } } - $out .= ' - '.$this->location_incoterms; + $out .= (($res->code && $this->location_incoterms)?' - ':'').$this->location_incoterms; return $out; } @@ -3169,20 +3220,6 @@ abstract class CommonObject // TODO: All functions here must be redesigned and moved as they are not business functions but output functions // -------------------- - /** - * Show linked object block. - * - * @return int <0 if KO, >0 if OK - * @deprecated 3.8 Use instead $form->showLinkedObjectBlock($object) - * @see Form::showLinkedObjectBlock - */ - function showLinkedObjectBlock() - { - global $form; - return $form->showLinkedObjectBlock($this); - } - - /* This is to show add lines */ /** @@ -3266,7 +3303,7 @@ abstract class CommonObject // Multicurrency if (!empty($conf->multicurrency->enabled)) print '
'.$langs->trans('PriceUHTCurrency').''.$langs->trans('PriceUTTC').'
'; - print ''; - print ''; - print '
'; $this->selectShippingMethod($selected, $htmlname, '', $addempty); - print '
'; + print ''; + print ''; } else { if ($selected) { $code=$langs->getLabelFromKey($db, $selected, 'c_shipment_mode', 'rowid', 'code'); @@ -3132,12 +3184,9 @@ class Form print '
'; print ''; print ''; - print ''; - print ''; - print ''; - print '
'; $this->select_comptes($selected, $htmlname, 0, '', $addempty); - print '
'; + print ''; + print ''; } else { if ($selected) { require_once DOL_DOCUMENT_ROOT .'/compta/bank/class/account.class.php'; @@ -3168,13 +3217,13 @@ class Form $langs->load("categories"); include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; - + // For backward compatibility if (is_numeric($type)) { dol_syslog(__METHOD__ . ': using numeric value for parameter type is deprecated. Use string code instead.', LOG_WARNING); } - + $cat = new Categorie($this->db); $cate_arbo = $cat->get_full_arbo($type,$excludeafterid); @@ -3249,10 +3298,10 @@ class Form * @param string $selectedchoice "" or "no" or "yes" * @param int $useajax 0=No, 1=Yes, 2=Yes but submit page with &confirm=no if choice is No, 'xxx'=Yes and preoutput confirm box with div id=dialog-confirm-xxx * @param int $height Force height of box - * @param int $width Force width of bow + * @param int $width Force width of box ('999' or '90%'). Ignored and forced to 90% on smartphones. * @return string HTML ajax code if a confirm ajax popup is required, Pure HTML code if it's an html form */ - function formconfirm($page, $title, $question, $action, $formquestion='', $selectedchoice="", $useajax=0, $height=170, $width=500) + function formconfirm($page, $title, $question, $action, $formquestion='', $selectedchoice="", $useajax=0, $height=200, $width=500) { global $langs,$conf; global $useglobalvars; @@ -3264,7 +3313,8 @@ class Form // Clean parameters $newselectedchoice=empty($selectedchoice)?"no":$selectedchoice; - + if ($conf->browser->layout == 'phone') $width='95%'; + if (is_array($formquestion) && ! empty($formquestion)) { // First add hidden fields and value @@ -3494,7 +3544,7 @@ class Form $formconfirm.= '
'; $formconfirm.= $this->selectyesno("confirm",$newselectedchoice); $formconfirm.= '
'."\n"; @@ -3519,30 +3569,30 @@ class Form * @param int $discard_closed Discard closed projects (0=Keep,1=hide completely except $selected,2=Disable) * @param int $maxlength Max length * @param int $forcefocus Force focus on field (works with javascript only) - * @return void + * @param int $nooutput No print is done. String is returned. + * @return string Return html content */ - function form_project($page, $socid, $selected='', $htmlname='projectid', $discard_closed=0, $maxlength=20, $forcefocus=0) + function form_project($page, $socid, $selected='', $htmlname='projectid', $discard_closed=0, $maxlength=20, $forcefocus=0, $nooutput=0) { global $langs; require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; + $out=''; + $formproject=new FormProjets($this->db); $langs->load("project"); if ($htmlname != "none") { - print "\n"; - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - print '
'; - $formproject->select_projects($socid, $selected, $htmlname, $maxlength, 0, 1, $discard_closed, $forcefocus); - print '
'; + $out.="\n"; + $out.='
'; + $out.=''; + $out.=''; + $out.=$formproject->select_projects($socid, $selected, $htmlname, $maxlength, 0, 1, $discard_closed, $forcefocus, 0, 0, '', 1); + $out.=''; + $out.='
'; } else { @@ -3551,13 +3601,20 @@ class Form $projet = new Project($this->db); $projet->fetch($selected); //print ''.$projet->title.''; - print $projet->getNomUrl(0,'',1); + $out.=$projet->getNomUrl(0,'',1); } else { - print " "; + $out.=" "; } } + + if (empty($nooutput)) + { + print $out; + return ''; + } + return $out; } /** @@ -3577,12 +3634,9 @@ class Form print '
'; print ''; print ''; - print ''; - print ''; - print ''; - print '
'; $this->select_conditions_paiements($selected,$htmlname,-1,$addempty); - print '
'; + print ''; + print ''; } else { @@ -3613,12 +3667,9 @@ class Form print '
'; print ''; print ''; - print ''; - print ''; - print ''; - print '
'; $this->selectAvailabilityDelay($selected,$htmlname,-1,$addempty); - print '
'; + print ''; + print ''; } else { @@ -3650,12 +3701,9 @@ class Form print '
'; print ''; print ''; - print ''; - print ''; - print ''; - print '
'; $this->selectInputReason($selected,$htmlname,-1,$addempty); - print '
'; + print ''; + print ''; } else { @@ -3736,12 +3784,9 @@ class Form print '
'; print ''; print ''; - print ''; - print ''; - print ''; - print '
'; print $this->select_dolusers($selected,$htmlname,1,$exclude,0,$include); - print '
'; + print ''; + print ''; } else { @@ -3776,12 +3821,9 @@ class Form print '
'; print ''; print ''; - print ''; - print ''; - print ''; - print '
'; $this->select_types_paiements($selected,$htmlname,$filtertype,0,0,0,0,$active); - print '
'; + print ''; + print ''; } else { @@ -3794,7 +3836,7 @@ class Form } } } - + /** * Show form with multicurrency code * @@ -3811,12 +3853,9 @@ class Form print '
'; print ''; print ''; - print ''; - print ''; - print ''; - print '
'; print $this->selectMultiCurrency($selected, $htmlname, 0); - print '
'; + print ''; + print ''; } else { @@ -3824,7 +3863,7 @@ class Form print !empty($selected) ? currency_name($selected,1) : ' '; } } - + /** * Show form with multicurrency rate * @@ -3837,18 +3876,15 @@ class Form function form_multicurrency_rate($page, $rate='', $htmlname='multicurrency_tx', $currency='') { global $langs, $mysoc, $conf; - + if ($htmlname != "none") { print '
'; print ''; print ''; - print ''; - print ''; - print ''; - print '
'; print ''; - print '
'; + print ''; + print ''; } else { @@ -3886,8 +3922,7 @@ class Form print '
'; print ''; print ''; - print ''; - print ''; - print ''; - print '
'; + print '
'; if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { if (! $filter || $filter=="fk_facture_source IS NULL") print $langs->trans("CompanyHasAbsoluteDiscount",price($amount,0,$langs,0,0,-1,$conf->currency)).': '; // If we want deposit to be substracted to payments only and not to total of final invoice @@ -3898,20 +3933,24 @@ class Form if (! $filter || $filter=="fk_facture_source IS NULL OR (fk_facture_source IS NOT NULL AND description LIKE '(DEPOSIT)%')") print $langs->trans("CompanyHasAbsoluteDiscount",price($amount,0,$langs,0,0,-1,$conf->currency)).': '; else print $langs->trans("CompanyHasCreditNote",price($amount,0,$langs,0,0,-1,$conf->currency)).': '; } + print '
'; $newfilter='fk_facture IS NULL AND fk_facture_line IS NULL'; // Remises disponibles if ($filter) $newfilter.=' AND ('.$filter.')'; $nbqualifiedlines=$this->select_remises($selected,$htmlname,$newfilter,$socid,$maxvalue); - print '
'; if ($nbqualifiedlines > 0) { print '   '; } - if ($more) print $more; - print '
'; + print '
'; + if ($more) + { + print '
'; + print $more; + print '
'; + } + print ''; } else { @@ -3951,7 +3990,6 @@ class Form if ($num==0) { $addcontact = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("AddContact") : $langs->trans("AddContactAddress")); - print 'Cette societe n\'a pas de contact, veuillez en cr�er un avant de faire votre proposition commerciale
'; print ''.$addcontact.''; } print ''; @@ -3994,12 +4032,9 @@ class Form print '
'; print ''; print ''; - print ''; - print ''; - print ''; - print '
'; print $this->select_company($selected, $htmlname, $filter, $showempty, $showtype, $forcecombo, $events); - print '
'; + print ''; + print ''; } else { @@ -4068,7 +4103,7 @@ class Form /** * Return array of currencies in user language - * + * * @param string $selected preselected currency code * @param string $htmlname name of HTML select list * @param integer $useempty 1=Add empty line @@ -4081,7 +4116,7 @@ class Form $langs->loadCacheCurrencies(''); // Load ->cache_currencies $TCurrency = array(); - + $sql = 'SELECT code FROM '.MAIN_DB_PREFIX.'multicurrency'; $sql.= " WHERE entity IN ('".getEntity('mutlicurrency')."')"; $resql = $db->query($sql); @@ -4089,10 +4124,15 @@ class Form { while ($obj = $db->fetch_object($resql)) $TCurrency[$obj->code] = $obj->code; } - + $out=''; $out.= ''; return $out; } - + /** * Load into the cache vat rates of a country * @@ -4204,7 +4244,7 @@ class Form $defaulttx=preg_replace('/\s*\(.*\)/','',$defaulttx); } //var_dump($selectedrate.'-'.$defaulttx.'-'.$defaultnpr.'-'.$defaultcode); - + // Check parameters if (is_object($societe_vendeuse) && ! $societe_vendeuse->country_code) { @@ -4262,7 +4302,8 @@ class Form } // Now we get list - $num = $this->load_cache_vatrates($code_country); + $num = $this->load_cache_vatrates($code_country); // If no vat defined, return -1 with message into this->error + if ($num > 0) { // Definition du taux a pre-selectionner (si defaulttx non force et donc vaut -1 ou '') @@ -4303,7 +4344,7 @@ class Form $return.= '"'; if ($defaultcode) // If defaultcode is defined, we used it in priority to select combo option instead of using rate+npr flag { - if ($defaultcode == $rate['code']) $return.= ' selected'; + if ($defaultcode == $rate['code']) $return.= ' selected'; } elseif ($rate['txtva'] == $defaulttx && $rate['nprtva'] == $defaultnpr) { @@ -4312,7 +4353,7 @@ class Form $return.= '>'.vatrate($rate['libtva']); //$return.=($rate['code']?' '.$rate['code']:''); $return.= (empty($rate['code']) && $rate['nprtva']) ? ' *': ''; // We show the * (old behaviour only if new vat code is not used) - + $return.= ''; } @@ -4501,7 +4542,7 @@ class Form } } - if ($d && $h) $retstring.=' '; + if ($d && $h) $retstring.=($h==2?'
':' '); if ($h) { @@ -4616,7 +4657,7 @@ class Form { $tmparray=dol_getdate($adddateof); $retstring.=' -
'; + print '
'; + + print '
'; + + + dol_fiche_end(); + $remaintopay = $object->amount - $totalpaid; - /** - * Actions buttons - */ + // Actions buttons + print '
'; print ''; @@ -716,7 +761,7 @@ if (! empty($id) && $action != 'edit') print ''; } - if (($object->statut == 0 || $object->statut == 1) && $remaintopay == 0 && $object->paye == 0) + if (($object->statut == 0 || $object->statut == 1) && $remaintopay == 0 && $object->paid == 0) { print '"; } @@ -743,9 +788,9 @@ if (! empty($id) && $action != 'edit') // Delete if ($user->rights->don->supprimer) { - if ($don->statut == -1 || $don->statut == 0) + if ($object->statut == -1 || $object->statut == 0) { - print '"; + print '"; } else { @@ -760,7 +805,7 @@ if (! empty($id) && $action != 'edit') print "
"; - print ''; - - print '
'; + print '
'; /* * Documents generes @@ -773,14 +818,12 @@ if (! empty($id) && $action != 'edit') $var=true; - print '
'; - $formfile->show_documents('donation',$filename,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf); - - print '
 
'; + print $formfile->showdocuments('donation',$filename,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf); + print '
'; + + print '
'; } llxFooter(); -$db->close(); \ No newline at end of file +$db->close(); diff --git a/htdocs/don/class/don.class.php b/htdocs/don/class/don.class.php index 72ccc7a0147..820c2f9d1b4 100644 --- a/htdocs/don/class/don.class.php +++ b/htdocs/don/class/don.class.php @@ -4,6 +4,7 @@ * Copyright (C) 2009 Regis Houssin * Copyright (C) 2014 Florian Henry * Copyright (C) 2015 Alexandre Spangaro + * Copyright (C) 2016 Juanjo Menent * * 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 @@ -29,8 +30,7 @@ require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php'; /** - * \class Don - * \brief Class to manage donations + * Class to manage donations */ class Don extends CommonObject { @@ -38,7 +38,8 @@ class Don extends CommonObject public $table_element='don'; // Name of table without prefix where object is stored public $fk_element = 'fk_donation'; protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe - + var $picto = 'generic'; + var $date; var $amount; var $societe; @@ -47,9 +48,10 @@ class Don extends CommonObject var $town; var $email; var $public; - var $fk_projet; + var $fk_project; var $fk_typepayment; var $num_payment; + var $date_valid; /** * @deprecated @@ -120,7 +122,6 @@ class Don extends CommonObject } if ($mode == 3) { - $prefix='Short'; if ($statut == -1) return img_picto($this->labelstatut[$statut],'statut5'); if ($statut == 0) return img_picto($this->labelstatut[$statut],'statut0'); if ($statut == 1) return img_picto($this->labelstatut[$statut],'statut1'); @@ -133,14 +134,20 @@ class Don extends CommonObject if ($statut == 1) return img_picto($this->labelstatut[$statut],'statut1').' '.$this->labelstatut[$statut]; if ($statut == 2) return img_picto($this->labelstatut[$statut],'statut6').' '.$this->labelstatut[$statut]; } - if ($mode == 5) + if ($mode == 5) { - $prefix='Short'; if ($statut == -1) return $this->labelstatutshort[$statut].' '.img_picto($this->labelstatut[$statut],'statut5'); if ($statut == 0) return $this->labelstatutshort[$statut].' '.img_picto($this->labelstatut[$statut],'statut0'); if ($statut == 1) return $this->labelstatutshort[$statut].' '.img_picto($this->labelstatut[$statut],'statut1'); if ($statut == 2) return $this->labelstatutshort[$statut].' '.img_picto($this->labelstatut[$statut],'statut6'); } + if ($mode == 6) + { + if ($statut == -1) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut],'statut5'); + if ($statut == 0) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut],'statut0'); + if ($statut == 1) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut],'statut1'); + if ($statut == 2) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut],'statut6'); + } } @@ -155,6 +162,8 @@ class Don extends CommonObject { global $conf, $user,$langs; + $now = dol_now(); + // Charge tableau des id de societe socids $socids = array(); @@ -185,7 +194,8 @@ class Don extends CommonObject $this->lastname = 'Doe'; $this->firstname = 'John'; $this->socid = 1; - $this->date = dol_now(); + $this->date = $now; + $this->date_valid = $now; $this->amount = 100; $this->public = 1; $this->societe = 'The Company'; @@ -453,6 +463,7 @@ class Don extends CommonObject $sql .= ",note_private=".(!empty($this->note_private)?("'".$this->db->escape($this->note_private)."'"):"NULL"); $sql .= ",note_public=".(!empty($this->note_public)?("'".$this->db->escape($this->note_public)."'"):"NULL"); $sql .= ",datedon='".$this->db->idate($this->date)."'"; + $sql .= ",date_valid=".($this->date_valid?"'".$this->db->idate($this->date)."'":"null"); $sql .= ",email='".$this->email."'"; $sql .= ",phone='".$this->phone."'"; $sql .= ",phone_mobile='".$this->phone_mobile."'"; @@ -592,10 +603,10 @@ class Don extends CommonObject { global $conf; - $sql = "SELECT d.rowid, d.datec, d.tms as datem, d.datedon,"; + $sql = "SELECT d.rowid, d.datec, d.date_valid, d.tms as datem, d.datedon,"; $sql.= " d.firstname, d.lastname, d.societe, d.amount, d.fk_statut, d.address, d.zip, d.town, "; $sql.= " d.fk_country, d.country as country_olddata, d.public, d.amount, d.fk_payment, d.paid, d.note_private, d.note_public, cp.libelle, d.email, d.phone, "; - $sql.= " d.phone_mobile, d.fk_projet, d.model_pdf,"; + $sql.= " d.phone_mobile, d.fk_projet as fk_project, d.model_pdf,"; $sql.= " p.ref as project_ref,"; $sql.= " c.code as country_code, c.label as country"; $sql.= " FROM ".MAIN_DB_PREFIX."don as d"; @@ -623,6 +634,7 @@ class Don extends CommonObject $this->id = $obj->rowid; $this->ref = $obj->rowid; $this->datec = $this->db->jdate($obj->datec); + $this->date_valid = $this->db->jdate($obj->date_valid); $this->datem = $this->db->jdate($obj->datem); $this->date = $this->db->jdate($obj->datedon); $this->firstname = $obj->firstname; @@ -633,7 +645,7 @@ class Don extends CommonObject $this->town = $obj->town; $this->zip = $obj->zip; $this->town = $obj->town; - $this->country_id = $obj->country_id; + $this->country_id = $obj->fk_country; $this->country_code = $obj->country_code; $this->country = $obj->country; $this->country_olddata= $obj->country_olddata; // deprecated @@ -641,7 +653,8 @@ class Don extends CommonObject $this->phone = $obj->phone; $this->phone_mobile = $obj->phone_mobile; $this->project = $obj->project_ref; - $this->fk_projet = $obj->fk_projet; + $this->fk_projet = $obj->fk_project; // deprecated + $this->fk_project = $obj->fk_project; $this->public = $obj->public; $this->modepaymentid = $obj->fk_payment; $this->modepayment = $obj->libelle; diff --git a/htdocs/don/document.php b/htdocs/don/document.php index 706eb4b70f7..35df6bb338a 100644 --- a/htdocs/don/document.php +++ b/htdocs/don/document.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2015 Laurent Destailleur + * Copyright (C) 2004-2016 Laurent Destailleur * Copyright (C) 2005 Marc Barilley / Ocebo * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2005 Simon TOSSER @@ -34,6 +34,11 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/donation.lib.php'; require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php'; +if (! empty($conf->projet->enabled)) +{ + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; + require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; +} $langs->load("other"); $langs->load("donations"); @@ -64,7 +69,7 @@ if (! $sortfield) $sortfield="name"; $object = new Don($db); $object->fetch($id, $ref); -$upload_dir = $conf->don->dir_output . '/' . get_exdir($filename,2,0,1,$object,'donation'). '/'. dol_sanitizeFileName($object->ref); +$upload_dir = $conf->don->dir_output . '/' . get_exdir($filename,0,0,0,$object,'donation'). '/'. dol_sanitizeFileName($object->ref); $modulepart='don'; @@ -80,8 +85,9 @@ include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php'; */ $form = new Form($db); +if (! empty($conf->projet->enabled)) { $formproject = new FormProjets($db); } -llxHeader("","",$langs->trans("Donations")); +llxHeader("",$langs->trans("Donation")); if ($object->id) @@ -102,26 +108,75 @@ if ($object->id) } + $linkback = ''.$langs->trans("BackToList").''; + + $morehtmlref='
'; + // Project + if (! empty($conf->projet->enabled)) + { + $langs->load("projects"); + $morehtmlref.=$langs->trans('Project') . ' '; + if ($user->rights->don->creer) + { + if ($action != 'classify') + $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.='
'; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.='
'; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (! empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref.=''; + $morehtmlref.=$proj->ref; + $morehtmlref.=''; + } else { + $morehtmlref.=''; + } + } + } + $morehtmlref.='
'; + + + dol_banner_tab($object, 'rowid', $linkback, 1, 'rowid', 'ref', $morehtmlref); + + print '
'; + print '
'; + print ''; - $linkback = ''.$langs->trans("BackToList").''; // Ref - print ''; - + */ + // Societe //print ""; - print ''; + print ''; print ''; print '
'.$langs->trans("Ref").''; + /* + print '
'.$langs->trans("Ref").''; print $form->showrefnav($object, 'id', $linkback, 1, 'rowid', 'ref', ''); print '
".$langs->trans("Company")."".$object->client->getNomUrl(1)."
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'.$langs->trans("TotalSizeOfAttachedFiles").''.$totalsize.' '.$langs->trans("bytes").'
'; print '
'; + + print '
'; + + dol_fiche_end(); $modulepart = 'don'; $permission = $user->rights->don->lire; + $permtoedit = $user->rights->don->creer; $param = '&id=' . $object->id; include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php'; diff --git a/htdocs/don/index.php b/htdocs/don/index.php index 73c9e56d29c..9894de3a2b5 100644 --- a/htdocs/don/index.php +++ b/htdocs/don/index.php @@ -79,11 +79,32 @@ if ($result) print load_fiche_titre($langs->trans("DonationsArea")); -print ''; +print '
'; -// Left area -print '
'; +if (! empty($conf->don->enabled) && $user->rights->don->lire) +{ + $listofsearchfields['search_donation']=array('text'=>'Donation'); +} +if (count($listofsearchfields)) +{ + print '
'; + print ''; + print ''; + $i=0; + foreach($listofsearchfields as $key => $value) + { + if ($i == 0) print ''; + print ''; + print ''; + if ($i == 0) print ''; + print ''; + $i++; + } + print '
'.$langs->trans("Search").'
'; + print '
'; + print '
'; +} print ''; print ''; @@ -136,8 +157,7 @@ print ''; print "
"; -// Right area -print '
'; +print '
'; $max=10; @@ -203,7 +223,7 @@ if ($resql) else dol_print_error($db); -print '
'; +print ''; llxFooter(); diff --git a/htdocs/don/info.php b/htdocs/don/info.php index 1c51a1fa9f8..6e7bce98b4c 100644 --- a/htdocs/don/info.php +++ b/htdocs/don/info.php @@ -38,7 +38,7 @@ $result = restrictedArea($user, 'don', $id, ''); * View */ -llxHeader(); +llxHeader("",$langs->trans("Donation")); if ($id) { diff --git a/htdocs/don/list.php b/htdocs/don/list.php index 8c7f5b987be..f5ce8b0350b 100644 --- a/htdocs/don/list.php +++ b/htdocs/don/list.php @@ -72,9 +72,7 @@ $fieldstosearchall = array( 'd.lastname'=>'Lastname', 'd.firstname'=>'Firstname', ); - - - + /* * View */ @@ -115,6 +113,12 @@ if (trim($search_name) != '') if ($search_amount) $sql.= natural_search(array('d.amount'), price2num(trim($search_amount)), 1); $sql.= $db->order($sortfield,$sortorder); +$nbtotalofrecords = 0; +if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) +{ + $result = $db->query($sql); + $nbtotalofrecords = $db->num_rows($result); +} $sql.= $db->plimit($limit+1, $offset); $resql = $db->query($sql); @@ -124,18 +128,18 @@ if ($resql) $i = 0; $param = '&statut='.$statut; - if ($page > 0) $param.= '&page='.$page; + //if ($page > 0) $param.= '&page='.$page; if ($optioncss != '') $param.='&optioncss='.$optioncss; if ($statut >= 0) { $donationstatic->statut=$statut; $label=$donationstatic->getLibStatut(0); - print_barre_liste($label, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num); + print_barre_liste($langs->trans("Donations"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num,$nbtotalofrecords); } else { - print_barre_liste($langs->trans("Donations"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num); + print_barre_liste($langs->trans("Donations"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num,$nbtotalofrecords); } @@ -200,7 +204,7 @@ if ($resql) $var=True; while ($i < min($num,$limit)) { - $objp = $db->fetch_object($result); + $objp = $db->fetch_object($resql); $var=!$var; print ""; $donationstatic->id=$objp->rowid; diff --git a/htdocs/ecm/class/ecmdirectory.class.php b/htdocs/ecm/class/ecmdirectory.class.php index 99b1441e658..c16cfe62e7c 100644 --- a/htdocs/ecm/class/ecmdirectory.class.php +++ b/htdocs/ecm/class/ecmdirectory.class.php @@ -239,14 +239,15 @@ class EcmDirectory // extends CommonObject /** * Update cache of nb of documents into database * - * @param string $sign '+' or '-' + * @param string $value '+' or '-' or new number * @return int <0 if KO, >0 if OK */ - function changeNbOfFiles($sign) + function changeNbOfFiles($value) { // Update request $sql = "UPDATE ".MAIN_DB_PREFIX."ecm_directories SET"; - $sql.= " cachenbofdoc = cachenbofdoc ".$sign." 1"; + if (preg_match('/[0-9]+/', $value)) $sql.= " cachenbofdoc = ".(int) $value; + else $sql.= " cachenbofdoc = cachenbofdoc ".$value." 1"; $sql.= " WHERE rowid = ".$this->id; dol_syslog(get_class($this)."::changeNbOfFiles", LOG_DEBUG); @@ -256,6 +257,12 @@ class EcmDirectory // extends CommonObject $this->error="Error ".$this->db->lasterror(); return -1; } + else + { + if (preg_match('/[0-9]+/', $value)) $this->cachenbofdoc = (int) $value; + else if ($value == '+') $this->cachenbofdoc++; + else if ($value == '-') $this->cachenbofdoc--; + } return 1; } diff --git a/htdocs/ecm/docdir.php b/htdocs/ecm/docdir.php index 7cd3a235c6b..26372b7994d 100644 --- a/htdocs/ecm/docdir.php +++ b/htdocs/ecm/docdir.php @@ -1,7 +1,7 @@ * Copyright (C) 2008-2012 Regis Houssin - * Copyright (C) 2015 Alexandre Spangaro + * Copyright (C) 2015-2016 Alexandre Spangaro * * 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 @@ -18,9 +18,9 @@ */ /** - * \file htdocs/ecm/docdir.php - * \ingroup ecm - * \brief Main page for ECM section area + * \file htdocs/ecm/docdir.php + * \ingroup ecm + * \brief Main page for ECM section area */ require '../main.inc.php'; @@ -160,7 +160,7 @@ if ($action == 'create') print ''; // Label - print ''."\n"; + print ''."\n"; print ''."\n"; print '
'.$langs->trans("Label").'
'.$langs->trans("Label").'
'.$langs->trans("AddIn").''; print $formecm->select_all_sections(! empty($_GET["catParent"])?$_GET["catParent"]:$ecmdir->fk_parent,'catParent'); @@ -176,7 +176,7 @@ if ($action == 'create') print '

'; - + dol_fiche_end(); print '
'; diff --git a/htdocs/ecm/docmine.php b/htdocs/ecm/docmine.php index ae4e6c6b08c..17e1a1a4308 100644 --- a/htdocs/ecm/docmine.php +++ b/htdocs/ecm/docmine.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2008-2016 Laurent Destailleur * * 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 @@ -272,7 +272,13 @@ print ''.$langs->trans("ECMDirectoryForFiles").''; print '/ecm/'.$relativepath; print ''; print ''.$langs->trans("ECMNbOfDocs").''; -print count($filearray); +$nbofiles=count($filearray); +print $nbofiles; +// Test if nb is same than in cache +if ($nbofiles != $ecmdir->cachenbofdoc) +{ + $ecmdir->changeNbOfFiles((string) $nbofiles); +} print ''; print ''.$langs->trans("TotalSizeOfAttachedFiles").''; print dol_print_size($totalsize); diff --git a/htdocs/ecm/index.php b/htdocs/ecm/index.php index 896db6f0b85..928b151618a 100644 --- a/htdocs/ecm/index.php +++ b/htdocs/ecm/index.php @@ -100,7 +100,13 @@ if (GETPOST("sendit") && ! empty($conf->global->MAIN_UPLOAD_DOC)) if (empty($_FILES['userfile']['tmp_name'])) { $error++; - setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("File")), null, 'errors'); + if($_FILES['userfile']['error'] == 1 || $_FILES['userfile']['error'] == 2){ + setEventMessages($langs->trans('ErrorFileSizeTooLarge'),null, 'errors'); + } + else { + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("File")), null, 'errors'); + } + } if (! $error) @@ -201,8 +207,11 @@ if ($action == 'confirm_deletesection' && GETPOST('confirm') == 'yes') } // Refresh directory view +// This refresh list of dirs, not list of files (for preformance reason). List of files is refresh only if dir was not synchronized. +// To refresh content of dir with cache, just open the dir in edit mode. if ($action == 'refreshmanual') { + $ecmdirtmp = new EcmDirectory($db); // This part of code is same than into file ecm/ajax/ecmdatabase.php TODO Remove duplicate @@ -344,7 +353,7 @@ if ($action == 'refreshmanual') // Define height of file area (depends on $_SESSION["dol_screenheight"]) //print $_SESSION["dol_screenheight"]; -$maxheightwin=(isset($_SESSION["dol_screenheight"]) && $_SESSION["dol_screenheight"] > 466)?($_SESSION["dol_screenheight"]-186):660; // Also into index_auto.php file +$maxheightwin=(isset($_SESSION["dol_screenheight"]) && $_SESSION["dol_screenheight"] > 466)?($_SESSION["dol_screenheight"]-136):660; // Also into index_auto.php file $morejs=array(); if (empty($conf->global->MAIN_ECM_DISABLE_JS)) $morejs=array("/includes/jquery/plugins/jqueryFileTree/jqueryFileTree.js"); @@ -413,7 +422,7 @@ if (! empty($conf->global->ECM_AUTO_TREE_ENABLED)) if (! empty($conf->projet->enabled)) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'project', 'test'=>$conf->projet->enabled, 'label'=>$langs->trans("Projects"), 'desc'=>$langs->trans("ECMDocsByProjects")); } } -print load_fiche_titre($langs->trans("ECMArea").' - '.$langs->trans("ECMFileManager")); +//print load_fiche_titre($langs->trans("ECMArea").' - '.$langs->trans("ECMFileManager")); /* print '
'; @@ -434,11 +443,8 @@ if (! empty($conf->use_javascript_ajax)) $classviewhide='hidden'; else $classviewhide='visible'; -if (empty($conf->dol_use_jmobile)) -{ $head = ecm_prepare_dasboard_head(''); -dol_fiche_head($head, 'index', '', 1, ''); -} +dol_fiche_head($head, 'index', $langs->trans("ECMArea").' - '.$langs->trans("ECMFileManager"), 1, ''); // Start container of all panels ?> @@ -462,8 +468,8 @@ else print ''; print ''; } -$url=((! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS))?'#':($_SERVER["PHP_SELF"].'?action=refreshmanual'.($module?'&module='.$module:'').($section?'&section='.$section:''))); -print ''; +$relativeurl=((! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS))?'#':($_SERVER["PHP_SELF"].'?action=refreshmanual'.($module?'&module='.$module:'').($section?'&section='.$section:''))); +print ''; print ''; print ''; @@ -756,7 +762,7 @@ else print ' '; // End of page -//dol_fiche_end(); +dol_fiche_end(); if (! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS)) { diff --git a/htdocs/ecm/index_auto.php b/htdocs/ecm/index_auto.php index c6944065b3a..6a9e80e32ad 100644 --- a/htdocs/ecm/index_auto.php +++ b/htdocs/ecm/index_auto.php @@ -1,6 +1,7 @@ * Copyright (C) 2008-2010 Regis Houssin + * Copyright (C) 2016 Alexandre Spangaro * * 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 @@ -20,7 +21,6 @@ * \file htdocs/ecm/index_auto.php * \ingroup ecm * \brief Main page for ECM section area - * \author Laurent Destailleur */ if (! defined('REQUIRE_JQUERY_LAYOUT')) define('REQUIRE_JQUERY_LAYOUT','1'); @@ -346,7 +346,7 @@ if ($action == 'refreshmanual') // Define height of file area (depends on $_SESSION["dol_screenheight"]) //print $_SESSION["dol_screenheight"]; -$maxheightwin=(isset($_SESSION["dol_screenheight"]) && $_SESSION["dol_screenheight"] > 466)?($_SESSION["dol_screenheight"]-186):660; // Also into index.php file +$maxheightwin=(isset($_SESSION["dol_screenheight"]) && $_SESSION["dol_screenheight"] > 466)?($_SESSION["dol_screenheight"]-136):660; // Also into index.php file $morejs=array(); if (empty($conf->global->MAIN_ECM_DISABLE_JS)) $morejs=array("/includes/jquery/plugins/jqueryFileTree/jqueryFileTree.js"); @@ -399,22 +399,22 @@ $rowspan=0; $sectionauto=array(); if (! empty($conf->global->ECM_AUTO_TREE_ENABLED)) { - if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) { $langs->load("products"); $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'product', 'test'=>(! empty($conf->product->enabled) || ! empty($conf->service->enabled)), 'label'=>$langs->trans("ProductsAndServices"), 'desc'=>$langs->trans("ECMDocsByProducts")); } - if (! empty($conf->societe->enabled)) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'company', 'test'=>$conf->societe->enabled, 'label'=>$langs->trans("ThirdParties"), 'desc'=>$langs->trans("ECMDocsByThirdParties")); } - if (! empty($conf->propal->enabled)) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'propal', 'test'=>$conf->propal->enabled, 'label'=>$langs->trans("Prop"), 'desc'=>$langs->trans("ECMDocsByProposals")); } - if (! empty($conf->contrat->enabled)) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'contract','test'=>$conf->contrat->enabled, 'label'=>$langs->trans("Contracts"), 'desc'=>$langs->trans("ECMDocsByContracts")); } - if (! empty($conf->commande->enabled)) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'order', 'test'=>$conf->commande->enabled,'label'=>$langs->trans("CustomersOrders"), 'desc'=>$langs->trans("ECMDocsByOrders")); } - if (! empty($conf->facture->enabled)) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'invoice', 'test'=>$conf->facture->enabled, 'label'=>$langs->trans("CustomersInvoices"), 'desc'=>$langs->trans("ECMDocsByInvoices")); } - if (! empty($conf->fournisseur->enabled)) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'order_supplier', 'test'=>$conf->fournisseur->enabled, 'label'=>$langs->trans("SuppliersOrders"), 'desc'=>$langs->trans("ECMDocsByOrders")); } - if (! empty($conf->fournisseur->enabled)) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'invoice_supplier', 'test'=>$conf->fournisseur->enabled, 'label'=>$langs->trans("SuppliersInvoices"), 'desc'=>$langs->trans("ECMDocsByInvoices")); } - if (! empty($conf->tax->enabled)) { $langs->load("compta"); $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'tax', 'test'=>$conf->tax->enabled, 'label'=>$langs->trans("SocialContributions"), 'desc'=>$langs->trans("ECMDocsBySocialContributions")); } - if (! empty($conf->projet->enabled)) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'project', 'test'=>$conf->projet->enabled, 'label'=>$langs->trans("Projects"), 'desc'=>$langs->trans("ECMDocsByProjects")); } - if (! empty($conf->ficheinter->enabled)) { $langs->load("interventions"); $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'fichinter', 'test'=>$conf->ficheinter->enabled, 'label'=>$langs->trans("Interventions"), 'desc'=>$langs->trans("ECMDocsByInterventions")); } - $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'user', 'test'=>1, 'label'=>$langs->trans("Users"), 'desc'=>$langs->trans("ECMDocsByUsers")); - + if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) { $langs->load("products"); $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'product', 'test'=>(! empty($conf->product->enabled) || ! empty($conf->service->enabled)), 'label'=>$langs->trans("ProductsAndServices"), 'desc'=>$langs->trans("ECMDocsByProducts")); } + if (! empty($conf->societe->enabled)) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'company', 'test'=>$conf->societe->enabled, 'label'=>$langs->trans("ThirdParties"), 'desc'=>$langs->trans("ECMDocsByThirdParties")); } + if (! empty($conf->propal->enabled)) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'propal', 'test'=>$conf->propal->enabled, 'label'=>$langs->trans("Prop"), 'desc'=>$langs->trans("ECMDocsByProposals")); } + if (! empty($conf->contrat->enabled)) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'contract','test'=>$conf->contrat->enabled, 'label'=>$langs->trans("Contracts"), 'desc'=>$langs->trans("ECMDocsByContracts")); } + if (! empty($conf->commande->enabled)) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'order', 'test'=>$conf->commande->enabled, 'label'=>$langs->trans("CustomersOrders"), 'desc'=>$langs->trans("ECMDocsByOrders")); } + if (! empty($conf->facture->enabled)) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'invoice', 'test'=>$conf->facture->enabled, 'label'=>$langs->trans("CustomersInvoices"), 'desc'=>$langs->trans("ECMDocsByInvoices")); } + if (! empty($conf->fournisseur->enabled)) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'order_supplier', 'test'=>$conf->fournisseur->enabled, 'label'=>$langs->trans("SuppliersOrders"), 'desc'=>$langs->trans("ECMDocsByOrders")); } + if (! empty($conf->fournisseur->enabled)) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'invoice_supplier', 'test'=>$conf->fournisseur->enabled, 'label'=>$langs->trans("SuppliersInvoices"), 'desc'=>$langs->trans("ECMDocsByInvoices")); } + if (! empty($conf->tax->enabled)) { $langs->load("compta"); $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'tax', 'test'=>$conf->tax->enabled, 'label'=>$langs->trans("SocialContributions"), 'desc'=>$langs->trans("ECMDocsBySocialContributions")); } + if (! empty($conf->projet->enabled)) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'project', 'test'=>$conf->projet->enabled, 'label'=>$langs->trans("Projects"), 'desc'=>$langs->trans("ECMDocsByProjects")); } + if (! empty($conf->ficheinter->enabled)) { $langs->load("interventions"); $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'fichinter', 'test'=>$conf->ficheinter->enabled, 'label'=>$langs->trans("Interventions"), 'desc'=>$langs->trans("ECMDocsByInterventions")); } + if (! empty($conf->expensereport->enabled)) { $langs->load("trips"); $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'expensereport', 'test'=>$conf->expensereport->enabled, 'label'=>$langs->trans("ExpenseReports"), 'desc'=>$langs->trans("ECMDocsByExpenseReports")); } + $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'user', 'test'=>1, 'label'=>$langs->trans("Users"), 'desc'=>$langs->trans("ECMDocsByUsers")); } -print load_fiche_titre($langs->trans("ECMArea").' - '.$langs->trans("ECMFileManager")); +//print load_fiche_titre($langs->trans("ECMArea").' - '.$langs->trans("ECMFileManager")); $helptext1=''; $helptext2=''; $helptext1.=$langs->trans("ECMAreaDesc"); @@ -441,11 +441,9 @@ if (! empty($conf->use_javascript_ajax)) $classviewhide='hidden'; else $classviewhide='visible'; -if (empty($conf->dol_use_jmobile)) -{ $head = ecm_prepare_dasboard_head(''); -dol_fiche_head($head, 'index_auto', '', 1, ''); -} +dol_fiche_head($head, 'index_auto', $langs->trans("ECMArea").' - '.$langs->trans("ECMFileManager"), 1, ''); + // Start container of all panels ?> @@ -574,6 +572,7 @@ if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i',$acti $mode='noajax'; +$url=DOL_URL_ROOT.'/ecm/index_auto.php'; include_once DOL_DOCUMENT_ROOT.'/core/ajax/ajaxdirpreview.php'; @@ -588,7 +587,7 @@ include_once DOL_DOCUMENT_ROOT.'/core/ajax/ajaxdirpreview.php'; // End of page -//dol_fiche_end(); +dol_fiche_end(); if (! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS)) { diff --git a/htdocs/ecm/tpl/enablefiletreeajax.tpl.php b/htdocs/ecm/tpl/enablefiletreeajax.tpl.php index 7b2145d0f93..bbcbb7090a4 100644 --- a/htdocs/ecm/tpl/enablefiletreeajax.tpl.php +++ b/htdocs/ecm/tpl/enablefiletreeajax.tpl.php @@ -50,6 +50,7 @@ $(document).ready(function() { ); $('#refreshbutton').click( function() { + console.log("Click on refreshbutton"); $.pleaseBePatient("trans('PleaseBePatient'); ?>"); $.get( "", { action: "build", diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index b4b82be7726..fb45993f567 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -1,6 +1,6 @@ - * Copyright (C) 2005-2013 Laurent Destailleur + * Copyright (C) 2005-2016 Laurent Destailleur * Copyright (C) 2005 Simon TOSSER * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2011-2012 Juanjo Menent @@ -39,12 +39,16 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/sendings.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/modules/expedition/modules_expedition.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; -require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; if (! empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; if (! empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; if (! empty($conf->stock->enabled)) require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; if (! empty($conf->productbatch->enabled)) require_once DOL_DOCUMENT_ROOT.'/product/class/productbatch.class.php'; +if (! empty($conf->projet->enabled)) { + require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; +} $langs->load("sendings"); $langs->load("companies"); @@ -547,6 +551,7 @@ if (empty($reshook)) $trigger_name='SHIPPING_SENTBYMAIL'; $paramname='id'; $mode='emailfromshipment'; + $trackid='shi'.$object->id; include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; } @@ -562,6 +567,7 @@ $form = new Form($db); $formfile = new FormFile($db); $formproduct = new FormProduct($db); $product_static = new Product($db); +if (! empty($conf->projet->enabled)) { $formproject = new FormProjets($db); } if ($action == 'create2') { @@ -1224,18 +1230,19 @@ else if ($id || $ref) $head=shipping_prepare_head($object); dol_fiche_head($head, 'shipping', $langs->trans("Shipment"), 0, 'sending'); + $formconfirm=''; + /* * Confirmation de la suppression */ if ($action == 'delete') { - print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id,$langs->trans('DeleteSending'),$langs->trans("ConfirmDeleteSending",$object->ref),'confirm_delete','',0,1); - + $formconfirm=$form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id,$langs->trans('DeleteSending'),$langs->trans("ConfirmDeleteSending",$object->ref),'confirm_delete','',0,1); } /* * Confirmation de la validation - */ + */ if ($action == 'valid') { $objectref = substr($object->ref, 1, 4); @@ -1258,7 +1265,7 @@ else if ($id || $ref) $text.=$notify->confirmMessage('SHIPPING_VALIDATE',$object->socid, $object); } - print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id,$langs->trans('ValidateSending'),$text,'confirm_valid','',0,1); + $formconfirm=$form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id,$langs->trans('ValidateSending'),$text,'confirm_valid','',0,1); } /* @@ -1266,10 +1273,20 @@ else if ($id || $ref) */ if ($action == 'annuler') { - print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id,$langs->trans('CancelSending'),$langs->trans("ConfirmCancelSending",$object->ref),'confirm_cancel','',0,1); + $formconfirm=$form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id,$langs->trans('CancelSending'),$langs->trans("ConfirmCancelSending",$object->ref),'confirm_cancel','',0,1); } + if (! $formconfirm) { + $parameters = array(); + $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + if (empty($reshook)) $formconfirm.=$hookmanager->resPrint; + elseif ($reshook > 0) $formconfirm=$hookmanager->resPrint; + } + + // Print form confirm + print $formconfirm; + // Calculate totalWeight and totalVolume for all products // by adding weight and volume of each product line. @@ -1277,20 +1294,59 @@ else if ($id || $ref) $totalWeight=$tmparray['weight']; $totalVolume=$tmparray['volume']; - print ''; - + + // Shipment card $linkback = ''.$langs->trans("BackToList").''; - - // Ref - print ''; - print ''; - - // Customer - print ''; - print ''; - print ""; + + $morehtmlref='
'; + // Ref customer shipment + $morehtmlref.=$form->editfieldkey("RefCustomer", '', $object->ref_customer, $object, $user->rights->expedition->creer, 'string', '', 0, 1); + $morehtmlref.=$form->editfieldval("RefCustomer", '', $object->ref_customer, $object, $user->rights->expedition->creer, 'string', '', null, null, '', 1); + // Thirdparty + $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); + // Project + /* + if (! empty($conf->projet->enabled)) { + $langs->load("projects"); + $morehtmlref .= '
' . $langs->trans('Project') . ' '; + if ($user->rights->supplier_proposal->creer) { + if ($action != 'classify') { + $morehtmlref .= '' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + } + if ($action == 'classify') { + // $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref .= '
'; + $morehtmlref .= ''; + $morehtmlref .= ''; + $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref .= ''; + $morehtmlref .= ''; + } else { + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (! empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref .= ''; + $morehtmlref .= $proj->ref; + $morehtmlref .= ''; + } else { + $morehtmlref .= ''; + } + } + }*/ + $morehtmlref.='
'; + + + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + + + print '
'; + print '
'; + print '
'; + + print '
'.$langs->trans("Ref").''; - print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref'); - print '
'.$langs->trans("Customer").''.$soc->getNomUrl(1).'
'; // Linked documents if ($typeobject == 'commande' && $object->$typeobject->id && ! empty($conf->commande->enabled)) @@ -1316,13 +1372,8 @@ else if ($id || $ref) print ''; } - // Ref customer - print ''; - print '\n"; - print ''; - // Date creation - print ''; + print ''; print '\n"; print ''; @@ -1455,9 +1506,22 @@ else if ($id || $ref) print ''; // Status - print ''; + /*print ''; print '\n"; - print ''; + print '';*/ + + // Other attributes + $cols = 2; + include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; + + print '
'.$langs->trans("RefCustomer").''.$object->ref_customer."
'.$langs->trans("DateCreation").'
'.$langs->trans("DateCreation").''.dol_print_date($object->date_creation,"day")."
'.$langs->trans("Status").'
'.$langs->trans("Status").''.$object->getLibStatut(4)."
'; + + print '
'; + print '
'; + print '
'; + print '
'; + + print ''; // Sending method print ''; print ''; - + // Tracking Number - print ''; @@ -1519,11 +1583,14 @@ else if ($id || $ref) print ''; } - // Other attributes - $cols = 3; - include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; + print "
'; @@ -1490,9 +1554,9 @@ else if ($id || $ref) } print '
'.$form->editfieldkey("TrackingNumber",'trackingnumber',$object->tracking_number,$object,$user->rights->expedition->creer).''; + print '
'.$form->editfieldkey("TrackingNumber",'trackingnumber',$object->tracking_number,$object,$user->rights->expedition->creer).''; print $form->editfieldval("TrackingNumber",'trackingnumber',$object->tracking_url,$object,$user->rights->expedition->creer,'string',$object->tracking_number); print '
"; - print "\n"; + print '
'; + print '
'; + print '
'; + + print '
'; + /* * Lines of products @@ -1676,7 +1743,7 @@ else if ($id || $ref) $detail.= $langs->trans("DetailWarehouseFormat",$entrepot->libelle,$detail_entrepot->qty_shipped).'
'; } } - print $form->textwithtooltip($langs->trans("DetailWarehouseNumber"),$detail); + print $form->textwithtooltip(img_picto('', 'object_stock').' '.$langs->trans("DetailWarehouseNumber"),$detail); } print ''; } @@ -1694,7 +1761,7 @@ else if ($id || $ref) { $detail.= $langs->trans("DetailBatchFormat",$dbatch->batch,dol_print_date($dbatch->eatby,"day"),dol_print_date($dbatch->sellby,"day"),$dbatch->dluo_qty).'
'; } - print $form->textwithtooltip($langs->trans("DetailBatchNumber"),$detail); + print $form->textwithtooltip(img_picto('', 'object_barcode').' '.$langs->trans("DetailBatchNumber"),$detail); } else { @@ -1719,11 +1786,12 @@ else if ($id || $ref) $var=!$var; } + + print "\n"; } - print "\n"; - print "\n\n"; + dol_fiche_end(); $object->fetchObjectLinked($object->id,$object->element); @@ -1829,15 +1897,14 @@ else if ($id || $ref) $genallowed=$user->rights->expedition->lire; $delallowed=$user->rights->expedition->supprimer; - $somethingshown=$formfile->show_documents('expedition',$objectref,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf,1,0,0,28,0,'','','',$soc->default_lang); - - // Linked object block - $somethingshown = $form->showLinkedObjectBlock($object); + print $formfile->showdocuments('expedition',$objectref,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf,1,0,0,28,0,'','','',$soc->default_lang); + // Show links to link elements - //$linktoelem = $form->showLinkToObjectBlock($object); - //if ($linktoelem) print '
'.$linktoelem; + //$linktoelem = $form->showLinkToObjectBlock($object, null, array('order')); + $somethingshown = $form->showLinkedObjectBlock($object, ''); + print '
'; // List of actions on element @@ -1900,10 +1967,12 @@ else if ($id || $ref) include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; $formmail = new FormMail($db); $formmail->param['langsmodels']=(empty($newlang)?$langs->defaultlang:$newlang); - $formmail->fromtype = 'user'; - $formmail->fromid = $user->id; - $formmail->fromname = $user->getFullName($langs); - $formmail->frommail = $user->email; + $formmail->fromtype = (GETPOST('fromtype')?GETPOST('fromtype'):(!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE)?$conf->global->MAIN_MAIL_DEFAULT_FROMTYPE:'user')); + + if($formmail->fromtype === 'user'){ + $formmail->fromid = $user->id; + + } $formmail->trackid='shi'.$object->id; if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set { @@ -1924,8 +1993,9 @@ else if ($id || $ref) // Tableau des substitutions $formmail->setSubstitFromObject($object); $formmail->substit['__SHIPPINGREF__']=$object->ref; + $formmail->substit['__SHIPPINGTRACKNUM__']=$object->tracking_number; + $formmail->substit['__SHIPPINGTRACKNUMURL__']=$object->tracking_url; - //Find the good contact adress //Find the good contact adress if ($typeobject == 'commande' && $object->$typeobject->id && ! empty($conf->commande->enabled)) { $objectsrc=new Commande($db); @@ -1937,8 +2007,11 @@ else if ($id || $ref) } $custcontact=''; $contactarr=array(); - $contactarr=$objectsrc->liste_contact(-1,'external'); - + if (is_object($objectsrc)) // For the case the shipment was created without orders + { + $contactarr=$objectsrc->liste_contact(-1,'external'); + } + if (is_array($contactarr) && count($contactarr)>0) { foreach($contactarr as $contact) { diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index a7375c451a8..4a6a50c7926 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -37,7 +37,7 @@ if (! empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propa if (! empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; if (! empty($conf->productbatch->enabled)) require_once DOL_DOCUMENT_ROOT.'/expedition/class/expeditionbatch.class.php'; - + /** * Class to manage shipments */ @@ -48,7 +48,8 @@ class Expedition extends CommonObject public $table_element="expedition"; public $table_element_line="expeditiondet"; protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe - + public $picto = 'sending'; + var $socid; var $ref_customer; var $ref_int; @@ -93,13 +94,13 @@ class Expedition extends CommonObject var $meths; var $listmeths; // List of carriers - + const STATUS_DRAFT = 0; const STATUS_VALIDATED = 1; const STATUS_CLOSED = 2; - - - + + + /** * Constructor * @@ -179,7 +180,7 @@ class Expedition extends CommonObject * Create expedition en base * * @param User $user Objet du user qui cree - * @param int $notrigger 1=Does not execute triggers, 0= execuete triggers + * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 si erreur, id expedition creee si ok */ function create($user, $notrigger=0) @@ -290,7 +291,7 @@ class Expedition extends CommonObject $error++; } } - + // Actions on extra fields (by external module or standard code) // TODO le hook fait double emploi avec le trigger !! $hookmanager->initHooks(array('expeditiondao')); @@ -364,13 +365,14 @@ class Expedition extends CommonObject * @param int $entrepot_id Id of warehouse * @param int $origin_line_id Id of source line * @param int $qty Quantity - * @param array $array_options extrafields array - * @return int <0 if KO, >0 if OK + * @param array $array_options extrafields array + * @return int <0 if KO, line_id if OK */ function create_line($entrepot_id, $origin_line_id, $qty,$array_options=0) { global $conf; $error = 0; + $line_id = 0; $sql = "INSERT INTO ".MAIN_DB_PREFIX."expeditiondet ("; $sql.= "fk_expedition"; @@ -385,12 +387,17 @@ class Expedition extends CommonObject $sql.= ")"; dol_syslog(get_class($this)."::create_line", LOG_DEBUG); - if (! $this->db->query($sql)) + $resql = $this->db->query($sql); + if ($resql) + { + $line_id = $this->db->last_insert_id(MAIN_DB_PREFIX."expeditiondet"); + } + else { $error++; } - if (!$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($array_options) && count($array_options)>0) // For avoid conflicts if trigger used + if (! $error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($array_options) && count($array_options)>0) // For avoid conflicts if trigger used { $expeditionline = new ExpeditionLigne($this->db); $expeditionline->array_options=$array_options; @@ -403,7 +410,7 @@ class Expedition extends CommonObject } } - if (! $error) return 1; + if (! $error) return $line_id; else return -1; } @@ -419,7 +426,7 @@ class Expedition extends CommonObject { $error = 0; $stockLocationQty = array(); // associated array with batch qty in stock location - + $tab=$line_ext->detail_batch; // create stockLocation Qty array foreach ($tab as $detbatch) @@ -432,14 +439,13 @@ class Expedition extends CommonObject // create shipment lines foreach ($stockLocationQty as $stockLocation => $qty) { - if ($this->create_line($stockLocation,$line_ext->origin_line_id,$qty,$array_options) < 0) + if (($line_id = $this->create_line($stockLocation,$line_ext->origin_line_id,$qty,$array_options)) < 0) { $error++; } else { // create shipment batch lines for stockLocation - $line_id= $this->db->last_insert_id(MAIN_DB_PREFIX."expeditiondet"); foreach ($tab as $detbatch) { if ($detbatch->entrepot_id == $stockLocation){ @@ -447,7 +453,7 @@ class Expedition extends CommonObject { $error++; } - } + } } } } @@ -554,7 +560,7 @@ class Expedition extends CommonObject * Thirparty */ $result=$this->fetch_thirdparty(); - + // Retrieve all extrafields for expedition // fetch optionals attributes and labels require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; @@ -591,7 +597,7 @@ class Expedition extends CommonObject * Validate object and update stock if option enabled * * @param User $user Object user that validate - * @param int $notrigger 1=Does not execute triggers, 0= execuete triggers + * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if OK, >0 if KO */ function valid($user, $notrigger=0) @@ -697,29 +703,29 @@ class Expedition extends CommonObject //var_dump($this->lines[$i]); $mouvS = new MouvementStock($this->db); $mouvS->origin = &$this; - + if (empty($obj->edbrowid)) { // line without batch detail - + // We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record. $result=$mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ShipmentValidatedInDolibarr",$numref)); if ($result < 0) { - $error++; - $this->errors[]=$mouvS->error; + $error++; + $this->errors[]=$mouvS->error; break; } } else { // line with batch detail - + // We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record. // Note: ->fk_origin_stock = id into table llx_product_batch (may be rename into llx_product_stock_batch in another version) - $result=$mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ShipmentValidatedInDolibarr",$numref), '', $obj->eatby, $obj->sellby, $obj->batch, $obj->fk_origin_stock); + $result=$mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ShipmentValidatedInDolibarr",$numref), '', $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch, $obj->fk_origin_stock); if ($result < 0) { - $error++; - $this->errors[]=$mouvS->error; + $error++; + $this->errors[]=$mouvS->error; break; } } @@ -731,9 +737,7 @@ class Expedition extends CommonObject $this->error=$this->db->error(); return -2; } - - // FIXME Set status of order to "delivered" if check box "set order as delivered if remain to ship is 0" is on and if sum of all validated shipment = products or order to ship (because we are in case of stock movement on shipment validation) - + } // Change status of order to "shipment in process" @@ -742,7 +746,7 @@ class Expedition extends CommonObject { $error++; } - + if (! $error && ! $notrigger) { // Call trigger @@ -896,17 +900,18 @@ class Expedition extends CommonObject $product_type=$product->type; if ($product_type == 0 && $product_stock < $qty) { - $this->error=$langs->trans('ErrorStockIsNotEnough'); + $langs->load("errors"); + $this->error=$langs->trans('ErrorStockIsNotEnoughToAddProductOnShipment', $product->ref); $this->db->rollback(); return -3; } } } - + // extrafields if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($array_options) && count($array_options)>0) // For avoid conflicts if trigger used $line->array_options = $array_options; - + $this->lines[$num] = $line; } @@ -952,13 +957,14 @@ class Expedition extends CommonObject if ($prod_batch->qty < $linebatch->dluo_qty) { - $this->errors[] = $langs->trans('ErrorStockIsNotEnough'); + $langs->load("errors"); + $this->errors[]=$langs->trans('ErrorStockIsNotEnoughToAddProductOnShipment', $prod_batch->fk_product); dol_syslog(get_class($this)."::addline_batch error=Product ".$prod_batch->batch.": ".$this->errorsToString(), LOG_ERR); $this->db->rollback(); return -1; } } - + //var_dump($linebatch); } } @@ -970,7 +976,7 @@ class Expedition extends CommonObject // extrafields if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($array_options) && count($array_options)>0) // For avoid conflicts if trigger used $line->array_options = $array_options; - + //var_dump($line); $this->lines[$num] = $line; return 1; @@ -1130,13 +1136,13 @@ class Expedition extends CommonObject { dol_syslog(get_class($this)."::delete movement index ".$i); $obj = $this->db->fetch_object($resql); - + $mouvS = new MouvementStock($this->db); // we do not log origin because it will be deleted $mouvS->origin = null; // get lot/serial $lotArray = null; - if ($conf->productbatch->enabled) + if ($conf->productbatch->enabled) { $lotArray = ExpeditionLineBatch::fetchAll($this->db,$obj->expeditiondet_id); if (! is_array($lotArray)) @@ -1155,7 +1161,7 @@ class Expedition extends CommonObject break; } } - else + else { // We increment stock of batches // We use warehouse selected for each line @@ -1169,7 +1175,7 @@ class Expedition extends CommonObject } } if ($error) break; // break for loop incase of error - } + } } } else @@ -1177,7 +1183,7 @@ class Expedition extends CommonObject $error++;$this->errors[]="Error ".$this->db->lasterror(); } } - + // delete batch expedition line if (! $error && $conf->productbatch->enabled) { @@ -1186,7 +1192,7 @@ class Expedition extends CommonObject $error++;$this->errors[]="Error ".$this->db->lasterror(); } } - + if (! $error) { $sql = "DELETE FROM ".MAIN_DB_PREFIX."expeditiondet"; @@ -1225,7 +1231,7 @@ class Expedition extends CommonObject } } } - + if (! $error) { $this->db->commit(); @@ -1302,7 +1308,7 @@ class Expedition extends CommonObject $sql = "SELECT cd.rowid, cd.fk_product, cd.label as custom_label, cd.description, cd.qty as qty_asked, cd.product_type"; $sql.= ", cd.total_ht, cd.total_localtax1, cd.total_localtax2, cd.total_ttc, cd.total_tva"; - $sql.= ", cd.tva_tx, cd.localtax1_tx, cd.localtax2_tx, cd.price, cd.subprice, cd.remise_percent"; + $sql.= ", cd.tva_tx, cd.localtax1_tx, cd.localtax2_tx, cd.price, cd.subprice, cd.remise_percent,cd.buy_price_ht as pa_ht"; $sql.= ", ed.rowid as line_id, ed.qty as qty_shipped, ed.fk_origin_line, ed.fk_entrepot"; $sql.= ", p.ref as product_ref, p.label as product_label, p.fk_product_type"; $sql.= ", p.weight, p.weight_units, p.length, p.length_units, p.surface, p.surface_units, p.volume, p.volume_units, p.tobatch as product_tobatch"; @@ -1373,6 +1379,8 @@ class Expedition extends CommonObject $line->volume = $obj->volume; $line->volume_units = $obj->volume_units; + $line->pa_ht = $obj->pa_ht; + // For invoicing $tabprice = calcul_price_total($obj->qty_shipped, $obj->subprice, $obj->remise_percent, $obj->tva_tx, $obj->localtax1_tx, $obj->localtax2_tx, 0, 'HT', $obj->info_bits, $obj->fk_product_type, $mysoc); // We force type to 0 $line->desc = $obj->description; // We need ->desc because some code into CommonObject use desc (property defined for other elements) @@ -1394,8 +1402,8 @@ class Expedition extends CommonObject $this->total_ttc+= $tabprice[2]; $this->total_localtax1+= $tabprice[9]; $this->total_localtax2+= $tabprice[10]; - - if ($originline != $obj->fk_origin_line) + + if ($originline != $obj->fk_origin_line) { $line->detail_batch = array(); } @@ -1547,7 +1555,8 @@ class Expedition extends CommonObject dol_syslog(get_class($this)."::initAsSpecimen"); - // Charge tableau des produits prodids + // Load array of products prodids + $num_prods = 0; $prodids = array(); $sql = "SELECT rowid"; $sql.= " FROM ".MAIN_DB_PREFIX."product"; @@ -1765,7 +1774,7 @@ class Expedition extends CommonObject } - + /** * Forge an set tracking url * @@ -1811,9 +1820,9 @@ class Expedition extends CommonObject global $conf,$langs,$user; $error=0; - + $this->db->begin(); - + $sql = 'UPDATE '.MAIN_DB_PREFIX.'expedition SET fk_statut='.self::STATUS_CLOSED; $sql .= ' WHERE rowid = '.$this->id.' AND fk_statut > 0'; @@ -1825,9 +1834,9 @@ class Expedition extends CommonObject { $order = new Commande($this->db); $order->fetch($this->origin_id); - + $order->loadExpeditions(self::STATUS_CLOSED); // Fill $order->expeditions = array(orderlineid => qty) - + $shipments_match_order = 1; foreach($order->lines as $line) { @@ -1843,21 +1852,21 @@ class Expedition extends CommonObject } if ($shipments_match_order) { - dol_syslog("Qty for the ".count($order->lines)." lines of order have same value for shipments with status Expedition::STATUS_CLOSED=".self::STATUS_CLOSED.', so we close order'); + dol_syslog("Qty for the ".count($order->lines)." lines of order have same value for shipments with status Expedition::STATUS_CLOSED=".self::STATUS_CLOSED.', so we close order'); $order->cloture($user); } } - + $this->statut=self::STATUS_CLOSED; - + // If stock increment is done on closing if (! $error && ! empty($conf->stock->enabled) && ! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE)) { require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php'; - + $langs->load("agenda"); - + // Loop on each product line to add a stock movement // TODO possibilite d'expedier a partir d'une propale ou autre origine ? $sql = "SELECT cd.fk_product, cd.subprice,"; @@ -1868,7 +1877,7 @@ class Expedition extends CommonObject $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."expeditiondet_batch as edb on edb.fk_expeditiondet = ed.rowid"; $sql.= " WHERE ed.fk_expedition = ".$this->id; $sql.= " AND cd.rowid = ed.fk_origin_line"; - + dol_syslog(get_class($this)."::valid select details", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) @@ -1887,14 +1896,14 @@ class Expedition extends CommonObject } if ($qty <= 0) continue; dol_syslog(get_class($this)."::valid movement index ".$i." ed.rowid=".$obj->rowid." edb.rowid=".$obj->edbrowid); - + $mouvS = new MouvementStock($this->db); $mouvS->origin = &$this; - + if (empty($obj->edbrowid)) { // line without batch detail - + // We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record $result=$mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ShipmentClassifyClosedInDolibarr",$numref)); if ($result < 0) { @@ -1906,9 +1915,9 @@ class Expedition extends CommonObject else { // line with batch detail - + // We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record - $result=$mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ShipmentClassifyClosedInDolibarr",$numref), '', $obj->eatby, $obj->sellby, $obj->batch, $obj->fk_origin_stock); + $result=$mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ShipmentClassifyClosedInDolibarr",$numref), '', $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch, $obj->fk_origin_stock); if ($result < 0) { $this->error = $mouvS->error; $this->errors = $mouvS->errors; @@ -1923,7 +1932,7 @@ class Expedition extends CommonObject $error++; } } - + // Call trigger if (! $error) { @@ -1936,9 +1945,9 @@ class Expedition extends CommonObject else { dol_print_error($this->db); - $error++; + $error++; } - + if (! $error) { $this->db->commit(); @@ -1958,8 +1967,9 @@ class Expedition extends CommonObject */ function set_billed() { + global $user; $error=0; - + $this->db->begin(); $sql = 'UPDATE '.MAIN_DB_PREFIX.'expedition SET fk_statut=2, billed=1'; // TODO Update only billed @@ -1970,18 +1980,18 @@ class Expedition extends CommonObject { $this->statut=2; $this->billed=1; - + // Call trigger $result=$this->call_trigger('SHIPPING_BILLED',$user); - if ($result < 0) { + if ($result < 0) { $error++; } - + } else { $error++; $this->errors[]=$this->db->lasterror; } - + if (empty($error)) { $this->db->commit(); return 1; @@ -2003,9 +2013,9 @@ class Expedition extends CommonObject global $conf,$langs,$user; $error=0; - + $this->db->begin(); - + $sql = 'UPDATE '.MAIN_DB_PREFIX.'expedition SET fk_statut=1'; $sql .= ' WHERE rowid = '.$this->id.' AND fk_statut > 0'; @@ -2014,14 +2024,14 @@ class Expedition extends CommonObject { $this->statut=1; $this->billed=0; - + // If stock increment is done on closing if (! $error && ! empty($conf->stock->enabled) && ! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE)) { require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php'; - + $langs->load("agenda"); - + // Loop on each product line to add a stock movement // TODO possibilite d'expedier a partir d'une propale ou autre origine $sql = "SELECT cd.fk_product, cd.subprice,"; @@ -2032,7 +2042,7 @@ class Expedition extends CommonObject $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."expeditiondet_batch as edb on edb.fk_expeditiondet = ed.rowid"; $sql.= " WHERE ed.fk_expedition = ".$this->id; $sql.= " AND cd.rowid = ed.fk_origin_line"; - + dol_syslog(get_class($this)."::valid select details", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) @@ -2051,15 +2061,15 @@ class Expedition extends CommonObject } if ($qty <= 0) continue; dol_syslog(get_class($this)."::reopen expedition movement index ".$i." ed.rowid=".$obj->rowid." edb.rowid=".$obj->edbrowid); - + //var_dump($this->lines[$i]); $mouvS = new MouvementStock($this->db); $mouvS->origin = &$this; - + if (empty($obj->edbrowid)) { // line without batch detail - + // We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record $result=$mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, -$qty, $obj->subprice, $langs->trans("ShipmentUnClassifyCloseddInDolibarr",$numref)); if ($result < 0) { @@ -2071,9 +2081,9 @@ class Expedition extends CommonObject else { // line with batch detail - + // We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record - $result=$mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, -$qty, $obj->subprice, $langs->trans("ShipmentUnClassifyCloseddInDolibarr",$numref), '', $obj->eatby, $obj->sellby, $obj->batch, $obj->fk_origin_stock); + $result=$mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, -$qty, $obj->subprice, $langs->trans("ShipmentUnClassifyCloseddInDolibarr",$numref), '', $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch, $obj->fk_origin_stock); if ($result < 0) { $this->error = $mouvS->error; $this->errors = $mouvS->errors; @@ -2088,7 +2098,7 @@ class Expedition extends CommonObject $error++; } } - + if (! $error) { // Call trigger @@ -2097,13 +2107,13 @@ class Expedition extends CommonObject $error++; } } - + } else { $error++; $this->errors[]=$this->db->lasterror(); } - - if (! $error) + + if (! $error) { $this->db->commit(); return 1; @@ -2114,7 +2124,7 @@ class Expedition extends CommonObject return -1; } } - + /** * Create a document onto disk according to template module. * @@ -2200,7 +2210,7 @@ class ExpeditionLigne extends CommonObjectLine public $element='expeditiondet'; public $table_element='expeditiondet'; - + public $fk_origin_line; // Deprecated diff --git a/htdocs/expedition/contact.php b/htdocs/expedition/contact.php index 039af2cd0ec..65a44cb64f9 100644 --- a/htdocs/expedition/contact.php +++ b/htdocs/expedition/contact.php @@ -155,83 +155,99 @@ if ($id > 0 || ! empty($ref)) dol_fiche_head($head, 'contact', $langs->trans("Shipment"), 0, 'sending'); - /* - * Facture synthese pour rappel - */ - print ''; - + // Shipment card $linkback = ''.$langs->trans("BackToList").''; + + $morehtmlref='
'; + // Ref customer shipment + $morehtmlref.=$form->editfieldkey("RefCustomer", '', $object->ref_customer, $object, $user->rights->expedition->creer, 'string', '', 0, 1); + $morehtmlref.=$form->editfieldval("RefCustomer", '', $object->ref_customer, $object, $user->rights->expedition->creer, 'string', '', null, null, '', 1); + // Thirdparty + $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); + // Project + /* + if (! empty($conf->projet->enabled)) { + $langs->load("projects"); + $morehtmlref .= '
' . $langs->trans('Project') . ' '; + if ($user->rights->supplier_proposal->creer) { + if ($action != 'classify') { + $morehtmlref .= '' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + } + if ($action == 'classify') { + // $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref .= '
'; + $morehtmlref .= ''; + $morehtmlref .= ''; + $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref .= ''; + $morehtmlref .= ''; + } else { + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (! empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref .= ''; + $morehtmlref .= $proj->ref; + $morehtmlref .= ''; + } else { + $morehtmlref .= ''; + } + } + }*/ + $morehtmlref.='
'; + + + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + + + print '
'; + //print '
'; + print '
'; - // Ref - print '
"; + print '
'.$langs->trans("Ref").''; - print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref'); - print "
'; - // Customer - print ''; - print ''; - print ""; - - // Linked documents + // Linked documents if ($typeobject == 'commande' && $object->$typeobject->id && ! empty($conf->commande->enabled)) { - print ''; - print '\n"; - print ''; + print ''; + print '\n"; + print ''; } if ($typeobject == 'propal' && $object->$typeobject->id && ! empty($conf->propal->enabled)) { - print ''; - print '\n"; - print ''; + print ''; + print '\n"; + print ''; } - - // Ref expedition client - print ''; - print ''; - - // Delivery address - if (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT)) - { - print ''; - } - + print "
'.$langs->trans("Customer").''.$object->thirdparty->getNomUrl(1).'
'; - $objectsrc=new Commande($db); - $objectsrc->fetch($object->$typeobject->id); - print $langs->trans("RefOrder").''; - print $objectsrc->getNomUrl(1,'commande'); - print "
'; + $objectsrc=new Commande($db); + $objectsrc->fetch($object->$typeobject->id); + print $langs->trans("RefOrder").''; + print $objectsrc->getNomUrl(1,'commande'); + print "
'; - $objectsrc=new Propal($db); - $objectsrc->fetch($object->$typeobject->id); - print $langs->trans("RefProposal").''; - print $objectsrc->getNomUrl(1,'expedition'); - print "
'; + $objectsrc=new Propal($db); + $objectsrc->fetch($object->$typeobject->id); + print $langs->trans("RefProposal").''; + print $objectsrc->getNomUrl(1,'expedition'); + print "
'; - print ''; - print '
'; - print $langs->trans('RefCustomer').''; - print '
'; - print '
'; - print $objectsrc->ref_client; - print '
'; - print ''; - - if ($action != 'editdelivery_address' && $object->brouillon) print ''; - print '
'; - print $langs->trans('DeliveryAddress'); - print 'socid.'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetDeliveryAddress'),1).'
'; - print '
'; - - if ($action == 'editdelivery_address') - { - $formother->form_address($_SERVER['PHP_SELF'].'?id='.$object->id,$object->fk_delivery_address,$object->socid,'fk_address','shipping',$object->id); - } - else - { - $formother->form_address($_SERVER['PHP_SELF'].'?id='.$object->id,$object->fk_delivery_address,$object->socid,'none','shipping',$object->id); - } - print '
"; + + //print '
'; + //print '
'; + //print '
'; + //print '
'; + + + //print '
'; + //print '
'; + print '
'; + + print '
'; + + dol_fiche_end(); // Lignes de contacts diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index 40e9c516ea8..38e4babc87d 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -2,6 +2,7 @@ /* Copyright (C) 2001-2005 Rodolphe Quiedeville * Copyright (C) 2004-2015 Laurent Destailleur * Copyright (C) 2005-2010 Regis Houssin + * Copyright (C) 2016 Ferran Marcet * * 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 @@ -82,7 +83,7 @@ $fieldstosearchall = array( 's.nom'=>"ThirdParty", 'e.note_public'=>'NotePublic', ); -if (empty($user->socid)) $fieldstosearchall["c.note_private"]="NotePrivate"; +if (empty($user->socid)) $fieldstosearchall["e.note_private"]="NotePrivate"; $checkedtypetiers=0; $arrayfields=array( @@ -258,6 +259,7 @@ if ($resql) $param=''; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; + if ($sall) $param.= "&sall=".$sall; if ($search_ref_exp) $param.= "&search_ref_exp=".$search_ref_exp; if ($search_ref_liv) $param.= "&search_ref_liv=".$search_ref_liv; if ($search_company) $param.= "&search_company=".$search_company; diff --git a/htdocs/expedition/note.php b/htdocs/expedition/note.php index 652b09453f7..849ec6e66bc 100644 --- a/htdocs/expedition/note.php +++ b/htdocs/expedition/note.php @@ -20,9 +20,9 @@ /** * \file htdocs/expedition/note.php -* \ingroup expedition -* \brief Note card expedition -*/ + * \ingroup expedition + * \brief Note card expedition + */ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php'; @@ -99,65 +99,57 @@ if ($id > 0 || ! empty($ref)) $head=shipping_prepare_head($object); dol_fiche_head($head, 'note', $langs->trans("Shipment"), 0, 'sending'); - print ''; - - $linkback = ''.$langs->trans("BackToList").''; - - // Ref - print ''; - print ''; - - // Customer - print ''; - print ''; - print ""; - - // Linked documents - if ($typeobject == 'commande' && $object->$typeobject->id && ! empty($conf->commande->enabled)) - { - print ''; - print '\n"; - print ''; - } - if ($typeobject == 'propal' && $object->$typeobject->id && ! empty($conf->propal->enabled)) - { - print ''; - print '\n"; - print ''; - } - - // Ref customer - print ''; - print '\n"; - print ''; - - // Date creation - print ''; - print '\n"; - print ''; - - // Delivery date planed - print ''; - print '\n"; - print ''; - - print '
'.$langs->trans("Ref").''; - print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref'); - print '
'.$langs->trans("Customer").''.$soc->getNomUrl(1).'
'; - $objectsrc=new Commande($db); - $objectsrc->fetch($object->$typeobject->id); - print $langs->trans("RefOrder").''; - print $objectsrc->getNomUrl(1,'commande'); - print "
'; - $objectsrc=new Propal($db); - $objectsrc->fetch($object->$typeobject->id); - print $langs->trans("RefProposal").''; - print $objectsrc->getNomUrl(1,'expedition'); - print "
'.$langs->trans("RefCustomer").''.$object->ref_customer."
'.$langs->trans("DateCreation").''.dol_print_date($object->date_creation,"day")."
'.$langs->trans("DateDeliveryPlanned").''.dol_print_date($object->date_delivery,"dayhourtext")."
'; - - print '
'; - - $colwidth=20; + + // Shipment card + $linkback = ''.$langs->trans("BackToList").''; + + $morehtmlref='
'; + // Ref customer shipment + $morehtmlref.=$form->editfieldkey("RefCustomer", '', $object->ref_customer, $object, $user->rights->expedition->creer, 'string', '', 0, 1); + $morehtmlref.=$form->editfieldval("RefCustomer", '', $object->ref_customer, $object, $user->rights->expedition->creer, 'string', '', null, null, '', 1); + // Thirdparty + $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); + // Project + /* + if (! empty($conf->projet->enabled)) { + $langs->load("projects"); + $morehtmlref .= '
' . $langs->trans('Project') . ' '; + if ($user->rights->supplier_proposal->creer) { + if ($action != 'classify') { + $morehtmlref .= '' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + } + if ($action == 'classify') { + // $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref .= '
'; + $morehtmlref .= ''; + $morehtmlref .= ''; + $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref .= ''; + $morehtmlref .= '
'; + } else { + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (! empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref .= ''; + $morehtmlref .= $proj->ref; + $morehtmlref .= ''; + } else { + $morehtmlref .= ''; + } + } + }*/ + $morehtmlref.='
'; + + + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + + + print '
'; + + $cssclass='titlefield'; include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; dol_fiche_end(); diff --git a/htdocs/expedition/stats/index.php b/htdocs/expedition/stats/index.php index cc5e770d02a..a8a19582b43 100644 --- a/htdocs/expedition/stats/index.php +++ b/htdocs/expedition/stats/index.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2013 Laurent Destailleur + * Copyright (C) 2004-2016 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * * This program is free software; you can redistribute it and/or modify @@ -234,7 +234,8 @@ print '
'; // Show filter box print '
'; print ''; - print ''; + + print '
'; print ''; // Company print ''; @@ -1252,7 +1368,7 @@ else print ''; } @@ -1261,7 +1377,7 @@ else print ''; if ($object->fk_statut==6) { @@ -1270,15 +1386,19 @@ else print ''; } + // Other attributes + //$cols = 3; + //include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_edit.tpl.php'; + // Public note print ''; print ''; - print ''; print ''; - print ''; } - print ''; + // print ''; + print ''; print ''; print ''; print ''; @@ -1692,17 +1880,19 @@ else } // Ajout des boutons de modification/suppression - print ''; } - print ''; print ''; } @@ -1782,24 +1972,21 @@ else if (($object->fk_statut==0 || $object->fk_statut==99) && $action != 'editline' && $user->rights->expensereport->creer) { print ''; - print ''; - //print ''; + print ''; if (! empty($conf->projet->enabled)) print ''; print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; print ''; print ''; print ''; - print ''; - // Select date - print ''; @@ -1817,36 +2004,34 @@ else print ''; // Add comments - print ''; // Select VAT - print ''; // Unit price - print ''; // Quantity - print ''; if ($action != 'editline') { - print ''; - print ''; + print ''; + print ''; } - print ''; + print ''; print ''; } // Fin si c'est payé/validé @@ -1899,18 +2084,12 @@ if ($action != 'create' && $action != 'edit') if ($object->fk_user_author == $user->id) { // Modify - print 'id.'">'.$langs->trans('Modify').''; + print ''; // Validate if (count($object->lines) > 0 || count($object->lignes) > 0) { - print 'id.'">'.$langs->trans('ValidateAndSubmit').''; - } - - if ($user->rights->expensereport->supprimer) - { - // Delete - print 'id.'">'.$langs->trans('Delete').''; + print ''; } } } @@ -1925,18 +2104,12 @@ if ($action != 'create' && $action != 'edit') if ($user->id == $object->fk_user_author || $user->id == $object->fk_user_valid) { // Modify - print 'id.'">'.$langs->trans('Modify').''; + print ''; // Brouillonner (le statut refusée est identique à brouillon) //print ''.$langs->trans('BROUILLONNER').''; // Enregistrer depuis le statut "Refusée" - print 'id.'">'.$langs->trans('ValidateAndSubmit').''; - - if ($user->rights->expensereport->supprimer) - { - // Delete - print 'id.'">'.$langs->trans('Delete').''; - } + print ''; } } @@ -1945,7 +2118,7 @@ if ($action != 'create' && $action != 'edit') if ($user->id == $object->fk_user_author || $user->id == $object->fk_user_valid) { // Brouillonner - print 'id.'">'.$langs->trans('SetToDraft').''; + print ''; } } @@ -1959,7 +2132,7 @@ if ($action != 'create' && $action != 'edit') if ($object->fk_user_author == $user->id) { // Brouillonner - print 'id.'">'.$langs->trans('SetToDraft').''; + print ''; } } @@ -1968,28 +2141,28 @@ if ($action != 'create' && $action != 'edit') //if($object->fk_user_validator==$user->id) //{ // Validate - print 'id.'">'.$langs->trans('Approve').''; + print ''; // Deny - print 'id.'">'.$langs->trans('Deny').''; + print ''; //} if ($user->id == $object->fk_user_author || $user->id == $object->fk_user_valid) { // Cancel - print 'id.'">'.$langs->trans('Cancel').''; - } - - if($user->rights->expensereport->supprimer) - { - // Delete - print 'id.'">'.$langs->trans('Delete').''; + print ''; } } - /* Si l'état est "A payer" - * ET user à droit de "to_paid" - * Afficher : "Annuler" / "Payer" / "Supprimer" - */ + + // If status is Appoved + // -------------------- + + if ($user->rights->expensereport->approve && $object->fk_statut == 5) + { + print ''; + } + + // If bank module is used if ($user->rights->expensereport->to_paid && ! empty($conf->banque->enabled) && $object->fk_statut == 5) { // Pay @@ -2003,59 +2176,41 @@ if ($action != 'create' && $action != 'edit') } } + // If bank module is not used if (($user->rights->expensereport->to_paid || empty($conf->banque->enabled)) && $object->fk_statut == 5) { if ((round($remaintopay) == 0 || empty($conf->banque->enabled)) && $object->paid == 0) { print '"; } - - // Cancel - if ($user->id == $object->fk_user_author || $user->id == $object->fk_user_valid) - { - print 'id.'">'.$langs->trans('Cancel').''; - } - - // Delete - if($user->rights->expensereport->supprimer) - { - print 'id.'">'.$langs->trans('Delete').''; - } } - - /* Si l'état est "Payée" - * ET user à droit "approve" - * ET user à droit "to_paid" - * Afficher : "Annuler" - */ - if ($user->rights->expensereport->approve && $user->rights->expensereport->to_paid && $object->fk_statut==6) + + if ($user->rights->expensereport->creer && ($user->id == $object->fk_user_author || $user->id == $object->fk_user_valid) && $object->fk_statut == 5) { - // Cancel - print 'id.'">'.$langs->trans('Cancel').''; - if($user->rights->expensereport->supprimer) - { - // Delete - print 'id.'">'.$langs->trans('Delete').''; - } + // Cancel + print ''; } - - /* Si l'état est "Annulée" - * ET user à droit "supprimer" - * Afficher : "Supprimer" - */ - if ($user->rights->expensereport->supprimer && $object->fk_statut==4) + + // TODO Replace this. It should be SetUnpaid and should go back to status unpaid not canceled. + if (($user->rights->expensereport->approve || $user->rights->expensereport->to_paid) && $object->fk_statut == 6) { - - if ($user->id == $object->fk_user_author || $user->id == $object->fk_user_valid) - { - // Brouillonner - print 'id.'">'.$langs->trans('ReOpen').''; - } - - // Delete - print 'id.'">'.$langs->trans('Delete').''; - + // Cancel + print ''; } + + + /* If draft, validated, cancel, and user can create, he can always delete its card before it is approved */ + if ($user->rights->expensereport->creer && $user->id == $object->fk_user_author && $object->fk_statut <= 4) + { + // Delete + print ''; + } + else if($user->rights->expensereport->supprimer && $object->fk_statut != 6) + { + // Delete + print ''; + } + } print ''; @@ -2069,7 +2224,8 @@ print '
'; /* * Generate documents */ -if($user->rights->expensereport->export && $object->fk_statut>0 && $action != 'edit') + +if($user->rights->expensereport->export && $action != 'edit') { $filename = dol_sanitizeFileName($object->ref); $filedir = $conf->expensereport->dir_output . "/" . dol_sanitizeFileName($object->ref); @@ -2094,17 +2250,17 @@ if ($action != 'create' && $action != 'edit' && ($id || $ref)) $object->fetch_thirdparty(); $result = $object->add_object_linked('fichinter', GETPOST('LinkedFichinter')); } - // Linked object block - $somethingshown = $form->showLinkedObjectBlock($object); - + // Show links to link elements $linktoelements=array(); - if($conf->global->EXPENSES_LINK_TO_INTERVENTION) $linktoelements[]='fichinter'; - $linktoelem=''; - $linktoelem = $form->showLinkToObjectBlock($object,$linktoelements); - if ($linktoelem) print '
'.$linktoelem; - + if (! empty($conf->global->EXPENSES_LINK_TO_INTERVENTION)) + { + $linktoelements[]='fichinter'; + $linktoelem = $form->showLinkToObjectBlock($object, $linktoelements, array('expensereport')); + $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem); + } } + llxFooter(); $db->close(); diff --git a/htdocs/expensereport/class/api_expensereports.class.php b/htdocs/expensereport/class/api_expensereports.class.php new file mode 100644 index 00000000000..1e4a3d50008 --- /dev/null +++ b/htdocs/expensereport/class/api_expensereports.class.php @@ -0,0 +1,505 @@ + + * Copyright (C) 2016 Laurent Destailleur + * + * 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 . + */ + + use Luracast\Restler\RestException; + + require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; + +/** + * API class for Expense Reports + * + * @access protected + * @class DolibarrApiAccess {@requires user,external} + */ +class ExpenseReports extends DolibarrApi +{ + + /** + * @var array $FIELDS Mandatory fields, checked when create and update object + */ + static $FIELDS = array( + 'socid' + ); + + /** + * @var ExpenseReport $expensereport {@type ExpenseReport} + */ + public $expensereport; + + + /** + * Constructor + */ + function __construct() + { + global $db, $conf; + $this->db = $db; + $this->expensereport = new ExpenseReport($this->db); + } + + /** + * Get properties of a Expense Report object + * + * Return an array with Expense Report informations + * + * @param int $id ID of Expense Report + * @return array|mixed Data without useless information + * + * @throws RestException + */ + function get($id) + { + if(! DolibarrApiAccess::$user->rights->expensereport->lire) { + throw new RestException(401); + } + + $result = $this->expensereport->fetch($id); + if( ! $result ) { + throw new RestException(404, 'Expense report not found'); + } + + if( ! DolibarrApi::_checkAccessToResource('expensereport',$this->expensereport->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + + $this->expensereport->fetchObjectLinked(); + return $this->_cleanObjectDatas($this->expensereport); + } + + /** + * List Expense Reports + * + * Get a list of Expense Reports + * + * @param string $sortfield Sort field + * @param string $sortorder Sort order + * @param int $limit Limit for list + * @param int $page Page number + * @param string $user_ids User ids filter field. Example: '1' or '1,2,3' {@pattern /^[0-9,]*$/i} + * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" + * @return array Array of Expense Report objects + */ + function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 0, $page = 0, $user_ids = 0, $sqlfilters = '') { + global $db, $conf; + + $obj_ret = array(); + + // case of external user, $societe param is ignored and replaced by user's socid + //$socid = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : $societe; + + $sql = "SELECT t.rowid"; + $sql.= " FROM ".MAIN_DB_PREFIX."expensereport as t"; + $sql.= ' WHERE t.entity IN ('.getEntity('expensereport', 1).')'; + if ($user_ids) $sql.=" AND t.fk_user_author IN (".$user_ids.")"; + + // Insert sale filter + if ($search_sale > 0) + { + $sql .= " AND sc.fk_user = ".$search_sale; + } + // Add sql filters + if ($sqlfilters) + { + if (! DolibarrApi::_checkFilters($sqlfilters)) + { + throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); + } + $regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; + } + + $sql.= $db->order($sortfield, $sortorder); + if ($limit) { + if ($page < 0) + { + $page = 0; + } + $offset = $limit * $page; + + $sql.= $db->plimit($limit + 1, $offset); + } + + $result = $db->query($sql); + + if ($result) + { + $num = $db->num_rows($result); + while ($i < min($num, ($limit <= 0 ? $num : $limit))) + { + $obj = $db->fetch_object($result); + $expensereport_static = new ExpenseReport($db); + if($expensereport_static->fetch($obj->rowid)) { + $obj_ret[] = parent::_cleanObjectDatas($expensereport_static); + } + $i++; + } + } + else { + throw new RestException(503, 'Error when retrieve Expense Report list'); + } + if( ! count($obj_ret)) { + throw new RestException(404, 'No Expense Report found'); + } + return $obj_ret; + } + + /** + * Create Expense Report object + * + * @param array $request_data Request data + * @return int ID of Expense Report + */ + function post($request_data = NULL) + { + if(! DolibarrApiAccess::$user->rights->expensereport->creer) { + throw new RestException(401, "Insuffisant rights"); + } + // Check mandatory fields + $result = $this->_validate($request_data); + + foreach($request_data as $field => $value) { + $this->expensereport->$field = $value; + } + /*if (isset($request_data["lines"])) { + $lines = array(); + foreach ($request_data["lines"] as $line) { + array_push($lines, (object) $line); + } + $this->expensereport->lines = $lines; + }*/ + if ($this->expensereport->create(DolibarrApiAccess::$user) <= 0) { + $errormsg = $this->expensereport->error; + throw new RestException(500, $errormsg ? $errormsg : "Error while creating expensereport"); + } + + return $this->expensereport->id; + } + + /** + * Get lines of an Expense Report + * + * @param int $id Id of Expense Report + * + * @url GET {id}/lines + * + * @return int + */ +/* + function getLines($id) { + if(! DolibarrApiAccess::$user->rights->expensereport->lire) { + throw new RestException(401); + } + + $result = $this->expensereport->fetch($id); + if( ! $result ) { + throw new RestException(404, 'expensereport not found'); + } + + if( ! DolibarrApi::_checkAccessToResource('expensereport',$this->expensereport->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + $this->expensereport->getLinesArray(); + $result = array(); + foreach ($this->expensereport->lines as $line) { + array_push($result,$this->_cleanObjectDatas($line)); + } + return $result; + } +*/ + + /** + * Add a line to given Expense Report + * + * @param int $id Id of Expense Report to update + * @param array $request_data Expense Report data + * + * @url POST {id}/lines + * + * @return int + */ +/* + function postLine($id, $request_data = NULL) { + if(! DolibarrApiAccess::$user->rights->expensereport->creer) { + throw new RestException(401); + } + + $result = $this->expensereport->fetch($id); + if( ! $result ) { + throw new RestException(404, 'expensereport not found'); + } + + if( ! DolibarrApi::_checkAccessToResource('expensereport',$this->expensereport->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + $request_data = (object) $request_data; + $updateRes = $this->expensereport->addline( + $request_data->desc, + $request_data->subprice, + $request_data->qty, + $request_data->tva_tx, + $request_data->localtax1_tx, + $request_data->localtax2_tx, + $request_data->fk_product, + $request_data->remise_percent, + $request_data->info_bits, + $request_data->fk_remise_except, + 'HT', + 0, + $request_data->date_start, + $request_data->date_end, + $request_data->product_type, + $request_data->rang, + $request_data->special_code, + $fk_parent_line, + $request_data->fk_fournprice, + $request_data->pa_ht, + $request_data->label, + $request_data->array_options, + $request_data->fk_unit, + $this->element, + $request_data->id + ); + + if ($updateRes > 0) { + return $this->get($id)->line->rowid; + + } + return false; + } +*/ + + /** + * Update a line to given Expense Report + * + * @param int $id Id of Expense Report to update + * @param int $lineid Id of line to update + * @param array $request_data Expense Report data + * + * @url PUT {id}/lines/{lineid} + * + * @return object + */ + /* + function putLine($id, $lineid, $request_data = NULL) { + if(! DolibarrApiAccess::$user->rights->expensereport->creer) { + throw new RestException(401); + } + + $result = $this->expensereport->fetch($id); + if( ! $result ) { + throw new RestException(404, 'expensereport not found'); + } + + if( ! DolibarrApi::_checkAccessToResource('expensereport',$this->expensereport->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + $request_data = (object) $request_data; + $updateRes = $this->expensereport->updateline( + $lineid, + $request_data->desc, + $request_data->subprice, + $request_data->qty, + $request_data->remise_percent, + $request_data->tva_tx, + $request_data->localtax1_tx, + $request_data->localtax2_tx, + 'HT', + $request_data->info_bits, + $request_data->date_start, + $request_data->date_end, + $request_data->product_type, + $request_data->fk_parent_line, + 0, + $request_data->fk_fournprice, + $request_data->pa_ht, + $request_data->label, + $request_data->special_code, + $request_data->array_options, + $request_data->fk_unit + ); + + if ($updateRes > 0) { + $result = $this->get($id); + unset($result->line); + return $this->_cleanObjectDatas($result); + } + return false; + } + */ + + /** + * Delete a line of given Expense Report + * + * @param int $id Id of Expense Report to update + * @param int $lineid Id of line to delete + * + * @url DELETE {id}/lines/{lineid} + * + * @return int + */ + /* + function delLine($id, $lineid) { + if(! DolibarrApiAccess::$user->rights->expensereport->creer) { + throw new RestException(401); + } + + $result = $this->expensereport->fetch($id); + if( ! $result ) { + throw new RestException(404, 'expensereport not found'); + } + + if( ! DolibarrApi::_checkAccessToResource('expensereport',$this->expensereport->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + $request_data = (object) $request_data; + $updateRes = $this->expensereport->deleteline($lineid); + if ($updateRes == 1) { + return $this->get($id); + } + return false; + } + */ + + /** + * Update Expense Report general fields (won't touch lines of expensereport) + * + * @param int $id Id of Expense Report to update + * @param array $request_data Datas + * + * @return int + */ + /* + function put($id, $request_data = NULL) { + if(! DolibarrApiAccess::$user->rights->expensereport->creer) { + throw new RestException(401); + } + + $result = $this->expensereport->fetch($id); + if( ! $result ) { + throw new RestException(404, 'expensereport not found'); + } + + if( ! DolibarrApi::_checkAccessToResource('expensereport',$this->expensereport->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + foreach($request_data as $field => $value) { + $this->expensereport->$field = $value; + } + + if($this->expensereport->update($id, DolibarrApiAccess::$user,1,'','','update')) + return $this->get($id); + + return false; + } + */ + + /** + * Delete Expense Report + * + * @param int $id Expense Report ID + * + * @return array + */ + function delete($id) + { + if(! DolibarrApiAccess::$user->rights->expensereport->supprimer) { + throw new RestException(401); + } + $result = $this->expensereport->fetch($id); + if( ! $result ) { + throw new RestException(404, 'Expense Report not found'); + } + + if( ! DolibarrApi::_checkAccessToResource('expensereport',$this->expensereport->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + + if( ! $this->expensereport->delete(DolibarrApiAccess::$user)) { + throw new RestException(500, 'Error when delete Expense Report : '.$this->expensereport->error); + } + + return array( + 'success' => array( + 'code' => 200, + 'message' => 'Expense Report deleted' + ) + ); + + } + + /** + * Validate an Expense Report + * + * @param int $id Expense Report ID + * + * @url POST {id}/validate + * + * @return array + * FIXME An error 403 is returned if the request has an empty body. + * Error message: "Forbidden: Content type `text/plain` is not supported." + * Workaround: send this in the body + * { + * "idwarehouse": 0 + * } + */ + /* + function validate($id, $idwarehouse=0) + { + if(! DolibarrApiAccess::$user->rights->expensereport->creer) { + throw new RestException(401); + } + $result = $this->expensereport->fetch($id); + if( ! $result ) { + throw new RestException(404, 'expensereport not found'); + } + + if( ! DolibarrApi::_checkAccessToResource('expensereport',$this->expensereport->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + + if( ! $this->expensereport->valid(DolibarrApiAccess::$user, $idwarehouse)) { + throw new RestException(500, 'Error when validate expensereport'); + } + + return array( + 'success' => array( + 'code' => 200, + 'message' => 'expensereport validated' + ) + ); + }*/ + + /** + * Validate fields before create or update object + * + * @param array $data Array with data to verify + * @return array + * @throws RestException + */ + function _validate($data) + { + $expensereport = array(); + foreach (ExpenseReports::$FIELDS as $field) { + if (!isset($data[$field])) + throw new RestException(400, "$field field missing"); + $expensereport[$field] = $data[$field]; + + } + return $expensereport; + } +} diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index f0467648af8..8a49983eccf 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -34,14 +34,17 @@ class ExpenseReport extends CommonObject var $table_element='expensereport'; var $table_element_line = 'expensereport_det'; var $fk_element = 'fk_expensereport'; + var $picto = 'trip'; var $lignes=array(); - var $date_debut; - var $date_fin; + + public $date_debut; + + public $date_fin; var $fk_user_validator; var $status; - var $fk_statut; // -- 1=draft, 2=validated (attente approb), 4=canceled, 5=approved, 6=payed, 99=denied + var $fk_statut; // -- 0=draft, 2=validated (attente approb), 4=canceled, 5=approved, 6=payed, 99=denied var $fk_c_paiement; var $paid; @@ -262,8 +265,8 @@ class ExpenseReport extends CommonObject /** * Load an object from database * - * @param int $id Id - * @param string $ref Ref + * @param int $id Id {@min 1} + * @param string $ref Ref {@name ref} * @return int <0 if KO, >0 if OK */ function fetch($id, $ref='') @@ -806,11 +809,10 @@ class ExpenseReport extends CommonObject /** * delete * - * @param int $rowid Id to delete (optional) * @param User $fuser User that delete * @return int <0 if KO, >0 if OK */ - function delete($rowid=0, User $fuser=null) + function delete(User $fuser=null) { global $user,$langs,$conf; @@ -1810,6 +1812,7 @@ class ExpenseReportLine // Clean parameters $this->comments=trim($this->comments); $this->vatrate = price2num($this->vatrate); + $this->value_unit = price2num($this->value_unit); $this->db->begin(); diff --git a/htdocs/expensereport/document.php b/htdocs/expensereport/document.php index 249a85f4ef2..9ff90982c3e 100644 --- a/htdocs/expensereport/document.php +++ b/htdocs/expensereport/document.php @@ -81,8 +81,9 @@ include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php'; $form = new Form($db); -llxHeader("","",$langs->trans("TripCard")); - +$title=$langs->trans("ExpenseReport") . " - " . $langs->trans("Documents"); +$helpurl="EN:Module_Expense_Reports"; +llxHeader("",$title,$helpurl); if ($object->id) { @@ -90,7 +91,7 @@ if ($object->id) $head=expensereport_prepare_head($object); - dol_fiche_head($head, 'documents', $langs->trans("TripCard"), 0, 'trip'); + dol_fiche_head($head, 'documents', $langs->trans("ExpenseReport"), 0, 'trip'); // Construit liste des fichiers @@ -107,7 +108,7 @@ if ($object->id) $linkback = ''.$langs->trans("BackToList").''; // Ref - print '
'; @@ -122,6 +123,7 @@ if ($object->id) $modulepart = 'expensereport'; $permission = $user->rights->expensereport->creer; + $permtoedit = $user->rights->expensereport->creer; $param = '&id=' . $object->id; include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php'; diff --git a/htdocs/expensereport/index.php b/htdocs/expensereport/index.php index 117ecc5e3c4..8d19a8e9f6d 100644 --- a/htdocs/expensereport/index.php +++ b/htdocs/expensereport/index.php @@ -142,7 +142,7 @@ $max=10; $langs->load("boxes"); -$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, d.rowid, d.ref, d.date_debut as dated, d.date_fin as datef, d.date_create as dm, d.total_ht, d.total_ttc, d.fk_statut as fk_status"; +$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.statut, u.photo, d.rowid, d.ref, d.date_debut as dated, d.date_fin as datef, d.date_create as dm, d.total_ht, d.total_ttc, d.fk_statut as fk_status"; $sql.= " FROM ".MAIN_DB_PREFIX."expensereport as d, ".MAIN_DB_PREFIX."user as u"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE u.rowid = d.fk_user_author"; @@ -183,9 +183,12 @@ if ($result) $userstatic->id=$obj->uid; $userstatic->lastname=$obj->lastname; $userstatic->firstname=$obj->firstname; + $userstatic->login=$obj->login; + $userstatic->statut=$obj->statut; + $userstatic->photo=$obj->photo; print ''; print ''; - print ''; + print ''; print ''; print ''; print ''; diff --git a/htdocs/expensereport/info.php b/htdocs/expensereport/info.php index b4302631c78..b3ebbc153ef 100644 --- a/htdocs/expensereport/info.php +++ b/htdocs/expensereport/info.php @@ -39,8 +39,9 @@ $result = restrictedArea($user, 'expensereport', $id, ''); /* * View */ - -llxHeader(); +$title=$langs->trans("ExpenseReport") . " - " . $langs->trans("Info"); +$helpurl="EN:Module_Expense_Reports"; +llxHeader("",$title,$helpurl); if ($id) { @@ -50,7 +51,7 @@ if ($id) $head = expensereport_prepare_head($object); - dol_fiche_head($head, 'info', $langs->trans("TripCard"), 0, 'trip'); + dol_fiche_head($head, 'info', $langs->trans("ExpenseReport"), 0, 'trip'); print '
'.$langs->trans("Filter").'
'.$langs->trans("ThirdParty").''; @@ -259,8 +260,8 @@ print '
'; print '

'; //} -print ''; -print ''; +print '
'; +print ''; print ''; print ''; /*print ''; @@ -268,13 +269,16 @@ print '';*/ print ''; $oldyear=0; +$var=true; foreach ($data as $val) { $year = $val['year']; while (! empty($year) && $oldyear > $year+1) { // If we have empty year $oldyear--; - print ''; + + $var=!$var; + print ''; print ''; print ''; @@ -283,7 +287,8 @@ foreach ($data as $val) print ''; } - print ''; + $var=!$var; + print ''; print ''; print ''; /*print ''; diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index f046b4ea61f..1994eded0da 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -2,7 +2,7 @@ /* Copyright (C) 2003 Rodolphe Quiedeville * Copyright (C) 2004-2015 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin - * Copyright (C) 2015 Alexandre Spangaro + * Copyright (C) 2015-2016 Alexandre Spangaro * * 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 @@ -38,6 +38,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/modules/expensereport/modules_expenserep require_once DOL_DOCUMENT_ROOT . '/expensereport/class/expensereport.class.php'; require_once DOL_DOCUMENT_ROOT . '/compta/paiement/class/paiement.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; +require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php'; $langs->load("trips"); $langs->load("bills"); @@ -89,981 +90,1085 @@ $hidedesc = (GETPOST('hidedesc', 'int') ? GETPOST('hidedesc', 'int') : (! empty( $hideref = (GETPOST('hideref', 'int') ? GETPOST('hideref', 'int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0)); +$object=new ExpenseReport($db); +$extrafields = new ExtraFields($db); + +// fetch optionals attributes and labels +$extralabels = $extrafields->fetch_name_optionals_label($object->table_element); + +// Load object +include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once + +// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +$hookmanager->initHooks(array('expensereportcard','globalcard')); + +$permissionnote = $user->rights->expensereport->creer; // Used by the include of actions_setnotes.inc.php +$permissiondellink = $user->rights->expensereport->creer; // Used by the include of actions_dellink.inc.php +$permissionedit = $user->rights->expensereport->creer; // Used by the include of actions_lineupdown.inc.php + + + /* * Actions */ -if ($cancel) +$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'); + +if (empty($reshook)) { - $action=''; - $fk_projet=''; - $date_start=''; - $date_end=''; - $date=''; - $comments=''; - $vatrate=''; - $value_unit=''; - $qty=1; - $fk_c_type_fees=-1; -} - -if ($action == 'confirm_delete' && GETPOST("confirm") == "yes" && $id > 0 && $user->rights->expensereport->supprimer) -{ - $object = new ExpenseReport($db); - $result=$object->delete($id, $user); - if ($result >= 0) - { - header("Location: index.php"); - exit; - } - else - { - setEventMessages($object->error, $object->errors, 'errors'); - } -} - -if ($action == 'add' && $user->rights->expensereport->creer) -{ - $object = new ExpenseReport($db); - - $object->date_debut = $date_start; - $object->date_fin = $date_end; - - $object->fk_statut = 1; - $object->fk_c_paiement = GETPOST('fk_c_paiement','int'); - $object->fk_user_validator = GETPOST('fk_user_validator','int'); - $object->note_public = GETPOST('note_public'); - $object->note_private = GETPOST('note_private'); - - if ($object->periode_existe($user,$object->date_debut,$object->date_fin)) - { - $error++; - setEventMessages($langs->trans("ErrorDoubleDeclaration"), null, 'errors'); - $action='create'; - } - - if (! $error) - { - $db->begin(); - - $id = $object->create($user); - - if ($id > 0) - { - $db->commit(); - Header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); - exit; - } - else - { - setEventMessages($object->error, $object->errors, 'errors'); - $db->rollback(); - $action='create'; - } - } -} - -if ($action == 'update' && $user->rights->expensereport->creer) -{ - $object = new ExpenseReport($db); - $object->fetch($id); - - $object->date_debut = $date_start; - $object->date_fin = $date_end; - - if($object->fk_statut < 3) - { - $object->fk_user_validator = GETPOST('fk_user_validator','int'); - } - - $object->fk_c_paiement = GETPOST('fk_c_paiement','int'); - $object->note_public = GETPOST('note_public'); - $object->note_private = GETPOST('note_private'); - $object->fk_user_modif = $user->id; - - $result = $object->update($user); - if ($result > 0) - { - header("Location: ".$_SERVER["PHP_SELF"]."?id=".$_POST['id']); - exit; - } - else - { - setEventMessages($object->error, $object->errors, 'errors'); - } -} - -if ($action == "confirm_validate" && GETPOST("confirm") == "yes" && $id > 0 && $user->rights->expensereport->creer) -{ - $object = new ExpenseReport($db); - $object->fetch($id); - $result = $object->setValidate($user); - - if ($result > 0) - { - // Define output language - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) - { - $outputlangs = $langs; - $newlang = ''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha'); - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; - if (! empty($newlang)) { - $outputlangs = new Translate("", $conf); - $outputlangs->setDefaultLang($newlang); - } - $model=$object->modelpdf; - $ret = $object->fetch($id); // Reload to get new records - - $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); - } - } - - if ($result > 0 && $object->fk_user_validator > 0) - { - $langs->load("mails"); - - // TO - $destinataire = new User($db); - $destinataire->fetch($object->fk_user_validator); - $emailTo = $destinataire->email; - - // FROM - $expediteur = new User($db); - $expediteur->fetch($object->fk_user_author); - $emailFrom = $expediteur->email; - - if ($emailTo && $emailFrom) - { - $filename=array(); $filedir=array(); $mimetype=array(); - - // SUBJECT - $subject = $langs->trans("ExpenseReportWaitingForApproval"); - - // CONTENT - $link = $urlwithroot.'/expensereport/card.php?id='.$object->id; - $message = $langs->trans("ExpenseReportWaitingForApprovalMessage", $expediteur->getFullName($langs), get_date_range($object->date_debut,$object->date_fin,'',$langs), $link); - - // Rebuild pdf - /* - $object->setDocModel($user,""); - $resultPDF = expensereport_pdf_create($db,$id,'',"",$langs); - - if($resultPDF): - // ATTACHMENT - array_push($filename,dol_sanitizeFileName($object->ref).".pdf"); - array_push($filedir,$conf->expensereport->dir_output . "/" . dol_sanitizeFileName($object->ref) . "/" . dol_sanitizeFileName($object->ref).".pdf"); - array_push($mimetype,"application/pdf"); - */ - - // PREPARE SEND - $mailfile = new CMailFile($subject,$emailTo,$emailFrom,$message,$filedir,$mimetype,$filename); - - if ($mailfile) - { - // SEND - $result=$mailfile->sendfile(); - if ($result) - { - $mesg=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($emailFrom,2),$mailfile->getValidAddress($emailTo,2)); - setEventMessages($mesg, null, 'mesgs'); - header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); - exit; - } - else - { - $langs->load("other"); - if ($mailfile->error) - { - $mesg=''; - $mesg.=$langs->trans('ErrorFailedToSendMail', $emailFrom, $emailTo); - $mesg.='
'.$mailfile->error; - setEventMessages($mesg, null, 'errors'); - } - else - { - setEventMessages('No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS', null, 'warnings'); - } - } - } - else - { - setEventMessages($mailfile->error,$mailfile->errors,'errors'); - $action=''; - } - } - else - { - setEventMessages($langs->trans("NoEmailSentBadSenderOrRecipientEmail"), null, 'warnings'); - $action=''; - } - } - else - { - setEventMessages($object->error, $object->errors, 'errors'); - } -} - -if ($action == "confirm_save_from_refuse" && GETPOST("confirm") == "yes" && $id > 0 && $user->rights->expensereport->creer) -{ - $object = new ExpenseReport($db); - $object->fetch($id); - $result = $object->set_save_from_refuse($user); - - if ($result > 0) - { - // Define output language - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) - { - $outputlangs = $langs; - $newlang = ''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha'); - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; - if (! empty($newlang)) { - $outputlangs = new Translate("", $conf); - $outputlangs->setDefaultLang($newlang); - } - $model=$object->modelpdf; - $ret = $object->fetch($id); // Reload to get new records - - $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); - } - } - - if ($result > 0) - { - if (! empty($conf->global->DEPLACEMENT_TO_CLEAN)) // TODO Translate this so we can remove condition - { - // Send mail - - // TO - $destinataire = new User($db); - $destinataire->fetch($object->fk_user_validator); - $emailTo = $destinataire->email; - - if ($emailTo) - { - // FROM - $expediteur = new User($db); - $expediteur->fetch($object->fk_user_author); - $emailFrom = $expediteur->email; - - // SUBJECT - $subject = "' ERP - Note de frais à re-approuver"; - - // CONTENT - $dateRefusEx = explode(" ",$object->date_refuse); - - $message = "Bonjour {$destinataire->firstname},\n\n"; - $message.= "Le {$dateRefusEx[0]} à {$dateRefusEx[1]} vous avez refusé d'approuver la note de frais \"{$object->ref}\". Vous aviez émis le motif suivant : {$object->detail_refuse}\n\n"; - $message.= "L'auteur vient de modifier la note de frais, veuillez trouver la nouvelle version en pièce jointe.\n"; - $message.= "- Déclarant : {$expediteur->firstname} {$expediteur->lastname}\n"; - $message.= "- Période : du {$object->date_debut} au {$object->date_fin}\n"; - $message.= "- Lien : {$dolibarr_main_url_root}/expensereport/card.php?id={$object->id}\n\n"; - $message.= "Bien cordialement,\n' SI"; - - // Génération du pdf avant attachement - $object->setDocModel($user,""); - $resultPDF = expensereport_pdf_create($db,$object,'',"",$langs); - - if($resultPDF) - { - // ATTACHMENT - $filename=array(); $filedir=array(); $mimetype=array(); - array_push($filename,dol_sanitizeFileName($object->ref).".pdf"); - array_push($filedir,$conf->expensereport->dir_output . "/" . dol_sanitizeFileName($object->ref) . "/" . dol_sanitizeFileName($object->ref_number).".pdf"); - array_push($mimetype,"application/pdf"); - - // PREPARE SEND - $mailfile = new CMailFile($subject,$emailTo,$emailFrom,$message,$filedir,$mimetype,$filename); - - if (! $mailfile->error) - { - // SEND - $result=$mailfile->sendfile(); - if ($result) - { - Header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); - exit; - } - else - { - $mesg=$mailfile->error; - setEventMessages($mesg, null, 'errors'); - } - // END - Send mail - } - else - { - dol_print_error($db,$resultPDF); - exit; - } - } - } - } - } - else - { - setEventMessages($object->error, $object->errors, 'errors'); - } -} - -// Approve -if ($action == "confirm_approve" && GETPOST("confirm") == "yes" && $id > 0 && $user->rights->expensereport->approve) -{ - $object = new ExpenseReport($db); - $object->fetch($id); - - $result = $object->setApproved($user); - - if ($result > 0) - { - // Define output language - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) - { - $outputlangs = $langs; - $newlang = ''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha'); - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; - if (! empty($newlang)) { - $outputlangs = new Translate("", $conf); - $outputlangs->setDefaultLang($newlang); - } - $model=$object->modelpdf; - $ret = $object->fetch($id); // Reload to get new records - - $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); - } - } - - if ($result > 0) - { - if (! empty($conf->global->DEPLACEMENT_TO_CLEAN)) // TODO Translate this so we can remove condition - { - // Send mail - - // TO - $destinataire = new User($db); - $destinataire->fetch($object->fk_user_author); - $emailTo = $destinataire->email; - - // CC - $emailCC = $conf->global->NDF_CC_EMAILS; - - // FROM - $expediteur = new User($db); - $expediteur->fetch($object->fk_user_valid); - $emailFrom = $expediteur->email; - - // SUBJECT - $subject = "' ERP - Note de frais validée"; - - // CONTENT - $message = "Bonjour {$destinataire->firstname},\n\n"; - $message.= "Votre note de frais \"{$object->ref}\" vient d'être approuvé!\n"; - $message.= "- Approbateur : {$expediteur->firstname} {$expediteur->lastname}\n"; - $message.= "- Lien : {$dolibarr_main_url_root}/expensereport/card.php?id={$object->id}\n\n"; - $message.= "Bien cordialement,\n' SI"; - - // Génération du pdf avant attachement - $object->setDocModel($user,""); - $resultPDF = expensereport_pdf_create($db,$object,'',"",$langs); - - if($resultPDF): - // ATTACHMENT - $filename=array(); $filedir=array(); $mimetype=array(); - array_push($filename,dol_sanitizeFileName($object->ref).".pdf"); - array_push($filedir, $conf->expensereport->dir_output. - "/". - dol_sanitizeFileName($object->ref) . - "/". - dol_sanitizeFileName($object->ref). - ".pdf" - ); - array_push($mimetype,"application/pdf"); - - // PREPARE SEND - $mailfile = new CMailFile($subject,$emailTo,$emailFrom,$message,$filedir,$mimetype,$filename,$emailCC); - - if(!$mailfile->error): - - // SEND - $result=$mailfile->sendfile(); - if ($result): - setEventMessages($langs->trans("MailSuccessfulySent",$emailFrom,$emailTo), null, 'mesgs'); - Header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); - exit; - else: - setEventMessages($langs->trans("ErrorFailedToSendMail",$emailFrom,$emailTo), null, 'errors'); - endif; - - else: - setEventMessages($langs->trans("ErrorFailedToSendMail",$emailFrom,$emailTo), null, 'errors'); - endif; - // END - Send mail - else : // if ($resultPDF) - dol_print_error($db,$resultPDF); - exit; - endif; - } - } - else - { - setEventMessages($object->error, $object->errors, 'errors'); - } -} - -if ($action == "confirm_refuse" && GETPOST('confirm')=="yes" && $id > 0 && $user->rights->expensereport->approve) -{ - $object = new ExpenseReport($db); - $object->fetch($id); - - $result = $object->setDeny($user,GETPOST('detail_refuse')); - - if ($result > 0) - { - // Define output language - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) - { - $outputlangs = $langs; - $newlang = ''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha'); - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; - if (! empty($newlang)) { - $outputlangs = new Translate("", $conf); - $outputlangs->setDefaultLang($newlang); - } - $model=$object->modelpdf; - $ret = $object->fetch($id); // Reload to get new records - - $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); - } - } - - if ($result > 0) - { - if (! empty($conf->global->DEPLACEMENT_TO_CLEAN)) // TODO Translate this so we can remove condition - { - // Send mail - - // TO - $destinataire = new User($db); - $destinataire->fetch($object->fk_user_author); - $emailTo = $destinataire->email; - - // FROM - $expediteur = new User($db); - $expediteur->fetch($object->fk_user_refuse); - $emailFrom = $expediteur->email; - - // SUBJECT - $subject = "' ERP - Note de frais refusée"; - - // CONTENT - $message = "Bonjour {$destinataire->firstname},\n\n"; - $message.= "Votre note de frais \"{$object->ref}\" vient d'être refusée.\n"; - $message.= "- Refuseur : {$expediteur->firstname} {$expediteur->lastname}\n"; - $message.= "- Motif de refus : {$_POST['detail_refuse']}\n"; - $message.= "- Lien : {$dolibarr_main_url_root}/expensereport/card.php?id={$object->id}\n\n"; - $message.= "Bien cordialement,\n' SI"; - - // PREPARE SEND - $mailfile = new CMailFile($subject,$emailTo,$emailFrom,$message); - - if(!$mailfile->error) - { - // SEND - $result=$mailfile->sendfile(); - if ($result) - { - setEventMessages($langs->trans("MailSuccessfulySent",$emailFrom,$emailTo), null, 'mesgs'); - Header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); - exit; - } - else - { - setEventMessages($langs->trans("ErrorFailedToSendMail",$emailFrom,$emailTo), null, 'errors'); - } - // END - Send mail - } - } - } - else - { - setEventMessages($object->error, $object->errors, 'errors'); - } -} - -//var_dump($user->id == $object->fk_user_validator);exit; -if ($action == "confirm_cancel" && GETPOST('confirm')=="yes" && GETPOST('detail_cancel') && $id > 0 && $user->rights->expensereport->creer) -{ - $object = new ExpenseReport($db); - $object->fetch($id); - - if ($user->id == $object->fk_user_valid || $user->id == $object->fk_user_author) - { - $result = $object->set_cancel($user,GETPOST('detail_cancel')); - - if ($result > 0) - { - // Define output language - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) - { - $outputlangs = $langs; - $newlang = ''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha'); - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; - if (! empty($newlang)) { - $outputlangs = new Translate("", $conf); - $outputlangs->setDefaultLang($newlang); - } - $model=$object->modelpdf; - $ret = $object->fetch($id); // Reload to get new records - - $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); - } - } - - if ($result > 0) - { - if (! empty($conf->global->DEPLACEMENT_TO_CLEAN)) // TODO Translate this so we can remove condition - { - // Send mail - - // TO - $destinataire = new User($db); - $destinataire->fetch($object->fk_user_author); - $emailTo = $destinataire->email; - - // FROM - $expediteur = new User($db); - $expediteur->fetch($object->fk_user_cancel); - $emailFrom = $expediteur->email; - - // SUBJECT - $subject = "' ERP - Note de frais annulée"; - - // CONTENT - $message = "Bonjour {$destinataire->firstname},\n\n"; - $message.= "Votre note de frais \"{$object->ref}\" vient d'être annulée.\n"; - $message.= "- Annuleur : {$expediteur->firstname} {$expediteur->lastname}\n"; - $message.= "- Motif d'annulation : {$_POST['detail_cancel']}\n"; - $message.= "- Lien : {$dolibarr_main_url_root}/expensereport/card.php?id={$object->id}\n\n"; - $message.= "Bien cordialement,\n' SI"; - - // PREPARE SEND - $mailfile = new CMailFile($subject,$emailTo,$emailFrom,$message); - - if(!$mailfile->error) - { - // SEND - $result=$mailfile->sendfile(); - if ($result) - { - header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); - exit; - } - else - { - $mesg="Impossible d'envoyer l'email."; - setEventMessages($mesg, null, 'errors'); - } - // END - Send mail - } - else - { - setEventMessages($mail->error, $mail->errors, 'errors'); - } - } - } - else - { - setEventMessages($object->error, $object->errors, 'errors'); - } - } -} - -if ($action == "confirm_brouillonner" && GETPOST('confirm')=="yes" && $id > 0 && $user->rights->expensereport->creer) -{ - $object = new ExpenseReport($db); - $object->fetch($id); - if ($user->id == $object->fk_user_author || $user->id == $object->fk_user_valid) - { - $result = $object->setStatut(0); - - if ($result > 0) - { - // Define output language - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) - { - $outputlangs = $langs; - $newlang = ''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha'); - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; - if (! empty($newlang)) { - $outputlangs = new Translate("", $conf); - $outputlangs->setDefaultLang($newlang); - } - $model=$object->modelpdf; - $ret = $object->fetch($id); // Reload to get new records - - $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); - } - } - - if ($result > 0) - { - header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); - exit; - } - else - { - setEventMessages($object->error, $object->errors, 'errors'); - } - } - else - { - setEventMessages("NOT_AUTHOR", '', 'errors'); - } -} - -if ($action == 'set_paid' && $id > 0 && $user->rights->expensereport->to_paid) -{ - $object = new ExpenseReport($db); - $object->fetch($id); - - $result = $object->set_paid($id, $user); - - if ($result > 0) - { - // Define output language - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) - { - $outputlangs = $langs; - $newlang = ''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha'); - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; - if (! empty($newlang)) { - $outputlangs = new Translate("", $conf); - $outputlangs->setDefaultLang($newlang); - } - $model=$object->modelpdf; - $ret = $object->fetch($id); // Reload to get new records - - $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); - } - } - - if ($result > 0) - { - if (! empty($conf->global->DEPLACEMENT_TO_CLEAN)) // TODO Translate this so we can remove condition - { - // Send mail - - // TO - $destinataire = new User($db); - $destinataire->fetch($object->fk_user_author); - $emailTo = $destinataire->email; - - // FROM - $expediteur = new User($db); - $expediteur->fetch($user->id); - $emailFrom = $expediteur->email; - - // SUBJECT - $subject = "'ERP - Note de frais payée"; - - // CONTENT - $message = "Bonjour {$destinataire->firstname},\n\n"; - $message.= "Votre note de frais \"{$object->ref}\" vient d'être payée.\n"; - $message.= "- Payeur : {$expediteur->firstname} {$expediteur->lastname}\n"; - $message.= "- Lien : {$dolibarr_main_url_root}/expensereport/card.php?id={$object->id}\n\n"; - $message.= "Bien cordialement,\n' SI"; - - // Generate pdf before attachment - $object->setDocModel($user,""); - $resultPDF = expensereport_pdf_create($db,$object,'',"",$langs); - - // PREPARE SEND - $mailfile = new CMailFile($subject,$emailTo,$emailFrom,$message); - - if(!$mailfile->error): - - // SEND - $result=$mailfile->sendfile(); - if ($result): - - // Retour - if($result): - Header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); - exit; - else: - dol_print_error($db); - endif; - - else: - dol_print_error($db,$acct->error); - endif; - - else: - $mesg="Impossible d'envoyer l'email."; - setEventMessages($mesg, null, 'errors'); - endif; - // END - Send mail - } - } - else - { - setEventMessages($object->error, $object->errors, 'errors'); - } -} - -if ($action == "addline" && $user->rights->expensereport->creer) -{ - $error = 0; - - $db->begin(); - - $object_ligne = new ExpenseReportLine($db); - - $object_ligne->comments = GETPOST('comments'); - $qty = GETPOST('qty','int'); - if (empty($qty)) $qty=1; - $object_ligne->qty = $qty; - - $up=price2num(GETPOST('value_unit'),'MU'); - $object_ligne->value_unit = $up; - - $object_ligne->date = $date; - - $object_ligne->fk_c_type_fees = GETPOST('fk_c_type_fees'); - - $object_ligne->fk_c_tva = GETPOST('fk_c_tva'); - $object_ligne->vatrate = price2num($vatrate); - - $object_ligne->fk_projet = $fk_projet; - - if (! GETPOST('fk_c_type_fees') > 0) - { - $error++; - setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors'); - $action=''; - } - if (GETPOST('vatrate') < 0 || GETPOST('vatrate') == '') - { - $error++; - setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Vat")), null, 'errors'); - $action=''; - } - - /* Projects are never required. To force them, check module forceproject - if ($conf->projet->enabled) - { - if (empty($object_ligne->fk_projet) || $object_ligne->fk_projet==-1) - { - $error++; - setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Project")), null, 'errors'); - } - }*/ - - // Si aucune date n'est rentrée - if (empty($object_ligne->date) || $object_ligne->date=="--") - { - $error++; - setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors'); - } - // Si aucun prix n'est rentré - if($object_ligne->value_unit==0) - { - $error++; - setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("PriceUTTC")), null, 'errors'); - } - - // S'il y'a eu au moins une erreur - if (! $error) - { - $object_ligne->fk_expensereport = $_POST['fk_expensereport']; - - $type = 0; // TODO What if service ? - $seller = ''; // seller is unknown - $tmp = calcul_price_total($qty, $up, 0, $vatrate, 0, 0, 0, 'TTC', 0, $type, $seller); - - $object_ligne->vatrate = price2num($vatrate); - $object_ligne->total_ttc = $tmp[2]; - $object_ligne->total_ht = $tmp[0]; - $object_ligne->total_tva = $tmp[1]; - - $result = $object_ligne->insert(); - if ($result > 0) - { - $db->commit(); - header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); - exit; - } - else - { - dol_print_error($db,$object->error); - $db->rollback(); - } - } - - $action=''; -} - -if ($action == 'confirm_delete_line' && GETPOST("confirm") == "yes" && $user->rights->expensereport->creer) -{ - $object = new ExpenseReport($db); - $object->fetch($id); - - $object_ligne = new ExpenseReportLine($db); - $object_ligne->fetch(GETPOST("rowid")); - $total_ht = $object_ligne->total_ht; - $total_tva = $object_ligne->total_tva; - - $result=$object->deleteline(GETPOST("rowid"), $user); - if ($result >= 0) - { - if ($result > 0) - { - // Define output language - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) - { - $outputlangs = $langs; - $newlang = ''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha'); - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; - if (! empty($newlang)) { - $outputlangs = new Translate("", $conf); - $outputlangs->setDefaultLang($newlang); - } - $model=$object->modelpdf; - $ret = $object->fetch($id); // Reload to get new records - - $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); - } - } - - $object->update_totaux_del($object_ligne->total_ht,$object_ligne->total_tva); - header("Location: ".$_SERVER["PHP_SELF"]."?id=".$_GET['id']); - exit; - } - else - { - setEventMessages($object->error, $object->errors, 'errors'); - } -} - -if ($action == "updateligne" && $user->rights->expensereport->creer) -{ - $object = new ExpenseReport($db); - $object->fetch($id); - - $rowid = $_POST['rowid']; - $type_fees_id = GETPOST('fk_c_type_fees'); - $projet_id = $fk_projet; - $comments = GETPOST('comments'); - $qty = GETPOST('qty'); - $value_unit = GETPOST('value_unit'); - $vatrate = GETPOST('vatrate'); - - if (! GETPOST('fk_c_type_fees') > 0) - { - $error++; - setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors'); - $action=''; - } - if (GETPOST('vatrate') < 0 || GETPOST('vatrate') == '') - { - $error++; - setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Vat")), null, 'errors'); - $action=''; - } - - if (! $error) - { - // TODO Use update method of ExpenseReportLine - $result = $object->updateline($rowid, $type_fees_id, $projet_id, $vatrate, $comments, $qty, $value_unit, $date, $id); - if ($result >= 0) - { - if ($result > 0) - { - // Define output language - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) - { - $outputlangs = $langs; - $newlang = ''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha'); - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; - if (! empty($newlang)) { - $outputlangs = new Translate("", $conf); - $outputlangs->setDefaultLang($newlang); - } - $model=$object->modelpdf; - $ret = $object->fetch($id); // Reload to get new records - - $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); - } - } - - $result = $object->recalculer($id); - - header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); - exit; - } - else - { - setEventMessages($object->error, $object->errors, 'errors'); - } - } -} - - -/* - * Generate or regenerate the PDF document - */ -if ($action == 'builddoc') // GET or POST -{ - $depl = new ExpenseReport($db, 0, $_GET['id']); - $depl->fetch($id); - - if ($_REQUEST['model']) - { - $depl->setDocModel($user, $_REQUEST['model']); - } - - $outputlangs = $langs; - if (! empty($_REQUEST['lang_id'])) - { - $outputlangs = new Translate("",$conf); - $outputlangs->setDefaultLang($_REQUEST['lang_id']); - } - $result=expensereport_pdf_create($db, $depl, '', $depl->modelpdf, $outputlangs); - if ($result <= 0) - { - setEventMessages($object->error, $object->errors, 'errors'); + if ($cancel) + { $action=''; - } -} + $fk_projet=''; + $date_start=''; + $date_end=''; + $date=''; + $comments=''; + $vatrate=''; + $value_unit=''; + $qty=1; + $fk_c_type_fees=-1; + } -// Remove file in doc form -else if ($action == 'remove_file') -{ - $object = new ExpenseReport($db, 0, $_GET['id']); - if ($object->fetch($id)) - { - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once - $object->fetch_thirdparty(); + include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once - $langs->load("other"); - $upload_dir = $conf->expensereport->dir_output; - $file = $upload_dir . '/' . GETPOST('file'); - $ret=dol_delete_file($file,0,0,0,$object); - if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs'); - else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors'); - $action=''; - } + include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; // Must be include, not include_once + + // Action clone object + if ($action == 'confirm_clone' && $confirm == 'yes' && $user->rights->expensereport->creer) + { + if (1==0 && ! GETPOST('clone_content') && ! GETPOST('clone_receivers')) + { + setEventMessages($langs->trans("NoCloneOptionsSpecified"), null, 'errors'); + } + else + { + if ($object->id > 0) + { + // Because createFromClone modifies the object, we must clone it so that we can restore it later + $orig = clone $object; + + $result=$object->createFromClone($socid); + if ($result > 0) + { + header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result); + exit; + } + else + { + setEventMessages($object->error, $object->errors, 'errors'); + $object = $orig; + $action=''; + } + } + } + } + + if ($action == 'confirm_delete' && GETPOST("confirm") == "yes" && $id > 0 && $user->rights->expensereport->supprimer) + { + $object = new ExpenseReport($db); + $result = $object->fetch($id); + $result = $object->delete($user); + if ($result >= 0) + { + header("Location: index.php"); + exit; + } + else + { + setEventMessages($object->error, $object->errors, 'errors'); + } + } + + if ($action == 'add' && $user->rights->expensereport->creer) + { + $object = new ExpenseReport($db); + + $object->date_debut = $date_start; + $object->date_fin = $date_end; + + $object->fk_statut = 1; + $object->fk_c_paiement = GETPOST('fk_c_paiement','int'); + $object->fk_user_validator = GETPOST('fk_user_validator','int'); + $object->note_public = GETPOST('note_public'); + $object->note_private = GETPOST('note_private'); + // Fill array 'array_options' with data from add form + if (! $error) + { + $ret = $extrafields->setOptionalsFromPost($extralabels, $object); + if ($ret < 0) $error++; + } + + if ($object->periode_existe($user,$object->date_debut,$object->date_fin)) + { + $error++; + setEventMessages($langs->trans("ErrorDoubleDeclaration"), null, 'errors'); + $action='create'; + } + + if (! $error) + { + $db->begin(); + + $id = $object->create($user); + + if ($id > 0) + { + $db->commit(); + Header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); + exit; + } + else + { + setEventMessages($object->error, $object->errors, 'errors'); + $db->rollback(); + $action='create'; + } + } + } + + if ($action == 'update' && $user->rights->expensereport->creer) + { + $object = new ExpenseReport($db); + $object->fetch($id); + + $object->date_debut = $date_start; + $object->date_fin = $date_end; + + if($object->fk_statut < 3) + { + $object->fk_user_validator = GETPOST('fk_user_validator','int'); + } + + $object->fk_c_paiement = GETPOST('fk_c_paiement','int'); + $object->note_public = GETPOST('note_public'); + $object->note_private = GETPOST('note_private'); + $object->fk_user_modif = $user->id; + + $result = $object->update($user); + if ($result > 0) + { + header("Location: ".$_SERVER["PHP_SELF"]."?id=".$_POST['id']); + exit; + } + else + { + setEventMessages($object->error, $object->errors, 'errors'); + } + } + + if ($action == 'update_extras') + { + // Fill array 'array_options' with data from update form + $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); + $ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute')); + if ($ret < 0) $error++; + + if (! $error) + { + // Actions on extra fields (by external module or standard code) + $hookmanager->initHooks(array('expensereportdao')); + $parameters = array('id' => $object->id); + $reshook = $hookmanager->executeHooks('insertExtraFields', $parameters, $object, $action); // Note that $action and $object may have been modified by + // some hooks + if (empty($reshook)) { + $result = $object->insertExtraFields(); + if ($result < 0) { + $error++; + } + } else if ($reshook < 0) + $error++; + } + + if ($error) + $action = 'edit_extras'; + } + + if ($action == "confirm_validate" && GETPOST("confirm") == "yes" && $id > 0 && $user->rights->expensereport->creer) + { + $object = new ExpenseReport($db); + $object->fetch($id); + $result = $object->setValidate($user); + + if ($result > 0) + { + // Define output language + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) + { + $outputlangs = $langs; + $newlang = ''; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha'); + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; + if (! empty($newlang)) { + $outputlangs = new Translate("", $conf); + $outputlangs->setDefaultLang($newlang); + } + $model=$object->modelpdf; + $ret = $object->fetch($id); // Reload to get new records + + $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); + } + } + + if ($result > 0 && $object->fk_user_validator > 0) + { + $langs->load("mails"); + + // TO + $destinataire = new User($db); + $destinataire->fetch($object->fk_user_validator); + $emailTo = $destinataire->email; + + // FROM + $expediteur = new User($db); + $expediteur->fetch($object->fk_user_author); + $emailFrom = $expediteur->email; + + if ($emailTo && $emailFrom) + { + $filename=array(); $filedir=array(); $mimetype=array(); + + // SUBJECT + $subject = $langs->trans("ExpenseReportWaitingForApproval"); + + // CONTENT + $link = $urlwithroot.'/expensereport/card.php?id='.$object->id; + $message = $langs->trans("ExpenseReportWaitingForApprovalMessage", $expediteur->getFullName($langs), get_date_range($object->date_debut,$object->date_fin,'',$langs), $link); + + // Rebuild pdf + /* + $object->setDocModel($user,""); + $resultPDF = expensereport_pdf_create($db,$id,'',"",$langs); + + if($resultPDF): + // ATTACHMENT + array_push($filename,dol_sanitizeFileName($object->ref).".pdf"); + array_push($filedir,$conf->expensereport->dir_output . "/" . dol_sanitizeFileName($object->ref) . "/" . dol_sanitizeFileName($object->ref).".pdf"); + array_push($mimetype,"application/pdf"); + */ + + // PREPARE SEND + $mailfile = new CMailFile($subject,$emailTo,$emailFrom,$message,$filedir,$mimetype,$filename); + + if ($mailfile) + { + // SEND + $result=$mailfile->sendfile(); + if ($result) + { + $mesg=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($emailFrom,2),$mailfile->getValidAddress($emailTo,2)); + setEventMessages($mesg, null, 'mesgs'); + header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); + exit; + } + else + { + $langs->load("other"); + if ($mailfile->error) + { + $mesg=''; + $mesg.=$langs->trans('ErrorFailedToSendMail', $emailFrom, $emailTo); + $mesg.='
'.$mailfile->error; + setEventMessages($mesg, null, 'errors'); + } + else + { + setEventMessages('No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS', null, 'warnings'); + } + } + } + else + { + setEventMessages($mailfile->error,$mailfile->errors,'errors'); + $action=''; + } + } + else + { + setEventMessages($langs->trans("NoEmailSentBadSenderOrRecipientEmail"), null, 'warnings'); + $action=''; + } + } + else + { + setEventMessages($object->error, $object->errors, 'errors'); + } + } + + if ($action == "confirm_save_from_refuse" && GETPOST("confirm") == "yes" && $id > 0 && $user->rights->expensereport->creer) + { + $object = new ExpenseReport($db); + $object->fetch($id); + $result = $object->set_save_from_refuse($user); + + if ($result > 0) + { + // Define output language + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) + { + $outputlangs = $langs; + $newlang = ''; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha'); + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; + if (! empty($newlang)) { + $outputlangs = new Translate("", $conf); + $outputlangs->setDefaultLang($newlang); + } + $model=$object->modelpdf; + $ret = $object->fetch($id); // Reload to get new records + + $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); + } + } + + if ($result > 0) + { + if (! empty($conf->global->DEPLACEMENT_TO_CLEAN)) // TODO Translate this so we can remove condition + { + // Send mail + + // TO + $destinataire = new User($db); + $destinataire->fetch($object->fk_user_validator); + $emailTo = $destinataire->email; + + if ($emailTo) + { + // FROM + $expediteur = new User($db); + $expediteur->fetch($object->fk_user_author); + $emailFrom = $expediteur->email; + + // SUBJECT + $subject = "' ERP - Note de frais à re-approuver"; + + // CONTENT + $dateRefusEx = explode(" ",$object->date_refuse); + + $message = "Bonjour {$destinataire->firstname},\n\n"; + $message.= "Le {$dateRefusEx[0]} à {$dateRefusEx[1]} vous avez refusé d'approuver la note de frais \"{$object->ref}\". Vous aviez émis le motif suivant : {$object->detail_refuse}\n\n"; + $message.= "L'auteur vient de modifier la note de frais, veuillez trouver la nouvelle version en pièce jointe.\n"; + $message.= "- Déclarant : {$expediteur->firstname} {$expediteur->lastname}\n"; + $message.= "- Période : du {$object->date_debut} au {$object->date_fin}\n"; + $message.= "- Lien : {$dolibarr_main_url_root}/expensereport/card.php?id={$object->id}\n\n"; + $message.= "Bien cordialement,\n' SI"; + + // Génération du pdf avant attachement + $object->setDocModel($user,""); + $resultPDF = expensereport_pdf_create($db,$object,'',"",$langs); + + if($resultPDF) + { + // ATTACHMENT + $filename=array(); $filedir=array(); $mimetype=array(); + array_push($filename,dol_sanitizeFileName($object->ref).".pdf"); + array_push($filedir,$conf->expensereport->dir_output . "/" . dol_sanitizeFileName($object->ref) . "/" . dol_sanitizeFileName($object->ref_number).".pdf"); + array_push($mimetype,"application/pdf"); + + // PREPARE SEND + $mailfile = new CMailFile($subject,$emailTo,$emailFrom,$message,$filedir,$mimetype,$filename); + + if (! $mailfile->error) + { + // SEND + $result=$mailfile->sendfile(); + if ($result) + { + Header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); + exit; + } + else + { + $mesg=$mailfile->error; + setEventMessages($mesg, null, 'errors'); + } + // END - Send mail + } + else + { + dol_print_error($db,$resultPDF); + exit; + } + } + } + } + } + else + { + setEventMessages($object->error, $object->errors, 'errors'); + } + } + + // Approve + if ($action == "confirm_approve" && GETPOST("confirm") == "yes" && $id > 0 && $user->rights->expensereport->approve) + { + $object = new ExpenseReport($db); + $object->fetch($id); + + $result = $object->setApproved($user); + + if ($result > 0) + { + // Define output language + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) + { + $outputlangs = $langs; + $newlang = ''; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha'); + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; + if (! empty($newlang)) { + $outputlangs = new Translate("", $conf); + $outputlangs->setDefaultLang($newlang); + } + $model=$object->modelpdf; + $ret = $object->fetch($id); // Reload to get new records + + $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); + } + } + + if ($result > 0) + { + if (! empty($conf->global->DEPLACEMENT_TO_CLEAN)) // TODO Translate this so we can remove condition + { + // Send mail + + // TO + $destinataire = new User($db); + $destinataire->fetch($object->fk_user_author); + $emailTo = $destinataire->email; + + // CC + $emailCC = $conf->global->NDF_CC_EMAILS; + + // FROM + $expediteur = new User($db); + $expediteur->fetch($object->fk_user_valid); + $emailFrom = $expediteur->email; + + // SUBJECT + $subject = "' ERP - Note de frais validée"; + + // CONTENT + $message = "Bonjour {$destinataire->firstname},\n\n"; + $message.= "Votre note de frais \"{$object->ref}\" vient d'être approuvé!\n"; + $message.= "- Approbateur : {$expediteur->firstname} {$expediteur->lastname}\n"; + $message.= "- Lien : {$dolibarr_main_url_root}/expensereport/card.php?id={$object->id}\n\n"; + $message.= "Bien cordialement,\n' SI"; + + // Génération du pdf avant attachement + $object->setDocModel($user,""); + $resultPDF = expensereport_pdf_create($db,$object,'',"",$langs); + + if($resultPDF): + // ATTACHMENT + $filename=array(); $filedir=array(); $mimetype=array(); + array_push($filename,dol_sanitizeFileName($object->ref).".pdf"); + array_push($filedir, $conf->expensereport->dir_output. + "/". + dol_sanitizeFileName($object->ref) . + "/". + dol_sanitizeFileName($object->ref). + ".pdf" + ); + array_push($mimetype,"application/pdf"); + + // PREPARE SEND + $mailfile = new CMailFile($subject,$emailTo,$emailFrom,$message,$filedir,$mimetype,$filename,$emailCC); + + if(!$mailfile->error): + + // SEND + $result=$mailfile->sendfile(); + if ($result): + setEventMessages($langs->trans("MailSuccessfulySent",$emailFrom,$emailTo), null, 'mesgs'); + Header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); + exit; + else: + setEventMessages($langs->trans("ErrorFailedToSendMail",$emailFrom,$emailTo), null, 'errors'); + endif; + + else: + setEventMessages($langs->trans("ErrorFailedToSendMail",$emailFrom,$emailTo), null, 'errors'); + endif; + // END - Send mail + else : // if ($resultPDF) + dol_print_error($db,$resultPDF); + exit; + endif; + } + } + else + { + setEventMessages($object->error, $object->errors, 'errors'); + } + } + + if ($action == "confirm_refuse" && GETPOST('confirm')=="yes" && $id > 0 && $user->rights->expensereport->approve) + { + $object = new ExpenseReport($db); + $object->fetch($id); + + $result = $object->setDeny($user,GETPOST('detail_refuse')); + + if ($result > 0) + { + // Define output language + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) + { + $outputlangs = $langs; + $newlang = ''; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha'); + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; + if (! empty($newlang)) { + $outputlangs = new Translate("", $conf); + $outputlangs->setDefaultLang($newlang); + } + $model=$object->modelpdf; + $ret = $object->fetch($id); // Reload to get new records + + $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); + } + } + + if ($result > 0) + { + if (! empty($conf->global->DEPLACEMENT_TO_CLEAN)) // TODO Translate this so we can remove condition + { + // Send mail + + // TO + $destinataire = new User($db); + $destinataire->fetch($object->fk_user_author); + $emailTo = $destinataire->email; + + // FROM + $expediteur = new User($db); + $expediteur->fetch($object->fk_user_refuse); + $emailFrom = $expediteur->email; + + // SUBJECT + $subject = "' ERP - Note de frais refusée"; + + // CONTENT + $message = "Bonjour {$destinataire->firstname},\n\n"; + $message.= "Votre note de frais \"{$object->ref}\" vient d'être refusée.\n"; + $message.= "- Refuseur : {$expediteur->firstname} {$expediteur->lastname}\n"; + $message.= "- Motif de refus : {$_POST['detail_refuse']}\n"; + $message.= "- Lien : {$dolibarr_main_url_root}/expensereport/card.php?id={$object->id}\n\n"; + $message.= "Bien cordialement,\n' SI"; + + // PREPARE SEND + $mailfile = new CMailFile($subject,$emailTo,$emailFrom,$message); + + if(!$mailfile->error) + { + // SEND + $result=$mailfile->sendfile(); + if ($result) + { + setEventMessages($langs->trans("MailSuccessfulySent",$emailFrom,$emailTo), null, 'mesgs'); + Header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); + exit; + } + else + { + setEventMessages($langs->trans("ErrorFailedToSendMail",$emailFrom,$emailTo), null, 'errors'); + } + // END - Send mail + } + } + } + else + { + setEventMessages($object->error, $object->errors, 'errors'); + } + } + + //var_dump($user->id == $object->fk_user_validator);exit; + if ($action == "confirm_cancel" && GETPOST('confirm')=="yes" && GETPOST('detail_cancel') && $id > 0 && $user->rights->expensereport->creer) + { + $object = new ExpenseReport($db); + $object->fetch($id); + + if ($user->id == $object->fk_user_valid || $user->id == $object->fk_user_author) + { + $result = $object->set_cancel($user,GETPOST('detail_cancel')); + + if ($result > 0) + { + // Define output language + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) + { + $outputlangs = $langs; + $newlang = ''; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha'); + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; + if (! empty($newlang)) { + $outputlangs = new Translate("", $conf); + $outputlangs->setDefaultLang($newlang); + } + $model=$object->modelpdf; + $ret = $object->fetch($id); // Reload to get new records + + $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); + } + } + + if ($result > 0) + { + if (! empty($conf->global->DEPLACEMENT_TO_CLEAN)) // TODO Translate this so we can remove condition + { + // Send mail + + // TO + $destinataire = new User($db); + $destinataire->fetch($object->fk_user_author); + $emailTo = $destinataire->email; + + // FROM + $expediteur = new User($db); + $expediteur->fetch($object->fk_user_cancel); + $emailFrom = $expediteur->email; + + // SUBJECT + $subject = "' ERP - Note de frais annulée"; + + // CONTENT + $message = "Bonjour {$destinataire->firstname},\n\n"; + $message.= "Votre note de frais \"{$object->ref}\" vient d'être annulée.\n"; + $message.= "- Annuleur : {$expediteur->firstname} {$expediteur->lastname}\n"; + $message.= "- Motif d'annulation : {$_POST['detail_cancel']}\n"; + $message.= "- Lien : {$dolibarr_main_url_root}/expensereport/card.php?id={$object->id}\n\n"; + $message.= "Bien cordialement,\n' SI"; + + // PREPARE SEND + $mailfile = new CMailFile($subject,$emailTo,$emailFrom,$message); + + if(!$mailfile->error) + { + // SEND + $result=$mailfile->sendfile(); + if ($result) + { + header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); + exit; + } + else + { + $mesg="Impossible d'envoyer l'email."; + setEventMessages($mesg, null, 'errors'); + } + // END - Send mail + } + else + { + setEventMessages($mail->error, $mail->errors, 'errors'); + } + } + } + else + { + setEventMessages($object->error, $object->errors, 'errors'); + } + } + else + { + setEventMessages($langs->transnoentitiesnoconv("OnlyOwnerCanCancel"), '', 'errors'); // Should not happened + } + } + + if ($action == "confirm_brouillonner" && GETPOST('confirm')=="yes" && $id > 0 && $user->rights->expensereport->creer) + { + $object = new ExpenseReport($db); + $object->fetch($id); + if ($user->id == $object->fk_user_author || $user->id == $object->fk_user_valid) + { + $result = $object->setStatut(0); + + if ($result > 0) + { + // Define output language + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) + { + $outputlangs = $langs; + $newlang = ''; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha'); + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; + if (! empty($newlang)) { + $outputlangs = new Translate("", $conf); + $outputlangs->setDefaultLang($newlang); + } + $model=$object->modelpdf; + $ret = $object->fetch($id); // Reload to get new records + + $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); + } + } + + if ($result > 0) + { + header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); + exit; + } + else + { + setEventMessages($object->error, $object->errors, 'errors'); + } + } + else + { + setEventMessages("NOT_AUTHOR", '', 'errors'); + } + } + + if ($action == 'set_paid' && $id > 0 && $user->rights->expensereport->to_paid) + { + $object = new ExpenseReport($db); + $object->fetch($id); + + $result = $object->set_paid($id, $user); + + if ($result > 0) + { + // Define output language + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) + { + $outputlangs = $langs; + $newlang = ''; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha'); + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; + if (! empty($newlang)) { + $outputlangs = new Translate("", $conf); + $outputlangs->setDefaultLang($newlang); + } + $model=$object->modelpdf; + $ret = $object->fetch($id); // Reload to get new records + + $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); + } + } + + if ($result > 0) + { + if (! empty($conf->global->DEPLACEMENT_TO_CLEAN)) // TODO Translate this so we can remove condition + { + // Send mail + + // TO + $destinataire = new User($db); + $destinataire->fetch($object->fk_user_author); + $emailTo = $destinataire->email; + + // FROM + $expediteur = new User($db); + $expediteur->fetch($user->id); + $emailFrom = $expediteur->email; + + // SUBJECT + $subject = "'ERP - Note de frais payée"; + + // CONTENT + $message = "Bonjour {$destinataire->firstname},\n\n"; + $message.= "Votre note de frais \"{$object->ref}\" vient d'être payée.\n"; + $message.= "- Payeur : {$expediteur->firstname} {$expediteur->lastname}\n"; + $message.= "- Lien : {$dolibarr_main_url_root}/expensereport/card.php?id={$object->id}\n\n"; + $message.= "Bien cordialement,\n' SI"; + + // Generate pdf before attachment + $object->setDocModel($user,""); + $resultPDF = expensereport_pdf_create($db,$object,'',"",$langs); + + // PREPARE SEND + $mailfile = new CMailFile($subject,$emailTo,$emailFrom,$message); + + if(!$mailfile->error): + + // SEND + $result=$mailfile->sendfile(); + if ($result): + + // Retour + if($result): + Header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); + exit; + else: + dol_print_error($db); + endif; + + else: + dol_print_error($db,$acct->error); + endif; + + else: + $mesg="Impossible d'envoyer l'email."; + setEventMessages($mesg, null, 'errors'); + endif; + // END - Send mail + } + } + else + { + setEventMessages($object->error, $object->errors, 'errors'); + } + } + + if ($action == "addline" && $user->rights->expensereport->creer) + { + $error = 0; + + $db->begin(); + + $object_ligne = new ExpenseReportLine($db); + + $vatrate = GETPOST('vatrate'); + $object_ligne->comments = GETPOST('comments'); + $qty = GETPOST('qty','int'); + if (empty($qty)) $qty=1; + $object_ligne->qty = $qty; + + $up=price2num(GETPOST('value_unit'),'MU'); + $object_ligne->value_unit = $up; + + $object_ligne->date = $date; + + $object_ligne->fk_c_type_fees = GETPOST('fk_c_type_fees'); + + // if VAT is not used in Dolibarr, set VAT rate to 0 because VAT rate is necessary. + if (empty($vatrate)) $vatrate = "0.000"; + + $object_ligne->vatrate = price2num($vatrate); + + $object_ligne->fk_projet = $fk_projet; + + + if (! GETPOST('fk_c_type_fees') > 0) + { + $error++; + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors'); + $action=''; + } + + if ($vatrate < 0 || $vatrate == '') + { + $error++; + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("VAT")), null, 'errors'); + $action=''; + } + + /* Projects are never required. To force them, check module forceproject + if ($conf->projet->enabled) + { + if (empty($object_ligne->fk_projet) || $object_ligne->fk_projet==-1) + { + $error++; + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Project")), null, 'errors'); + } + }*/ + + // Si aucune date n'est rentrée + if (empty($object_ligne->date) || $object_ligne->date=="--") + { + $error++; + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors'); + } + // Si aucun prix n'est rentré + if($object_ligne->value_unit==0) + { + $error++; + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("PriceUTTC")), null, 'errors'); + } + + // S'il y'a eu au moins une erreur + if (! $error) + { + $object_ligne->fk_expensereport = $_POST['fk_expensereport']; + + $type = 0; // TODO What if service ? + $seller = ''; // seller is unknown + $tmp = calcul_price_total($qty, $up, 0, $vatrate, 0, 0, 0, 'TTC', 0, $type, $seller); + + $object_ligne->vatrate = price2num($vatrate); + $object_ligne->total_ttc = $tmp[2]; + $object_ligne->total_ht = $tmp[0]; + $object_ligne->total_tva = $tmp[1]; + + $result = $object_ligne->insert(); + if ($result > 0) + { + $db->commit(); + header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); + exit; + } + else + { + dol_print_error($db,$object->error); + $db->rollback(); + } + } + + $action=''; + } + + if ($action == 'confirm_delete_line' && GETPOST("confirm") == "yes" && $user->rights->expensereport->creer) + { + $object = new ExpenseReport($db); + $object->fetch($id); + + $object_ligne = new ExpenseReportLine($db); + $object_ligne->fetch(GETPOST("rowid")); + $total_ht = $object_ligne->total_ht; + $total_tva = $object_ligne->total_tva; + + $result=$object->deleteline(GETPOST("rowid"), $user); + if ($result >= 0) + { + if ($result > 0) + { + // Define output language + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) + { + $outputlangs = $langs; + $newlang = ''; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha'); + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; + if (! empty($newlang)) { + $outputlangs = new Translate("", $conf); + $outputlangs->setDefaultLang($newlang); + } + $model=$object->modelpdf; + $ret = $object->fetch($id); // Reload to get new records + + $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); + } + } + + $object->update_totaux_del($object_ligne->total_ht,$object_ligne->total_tva); + header("Location: ".$_SERVER["PHP_SELF"]."?id=".$_GET['id']); + exit; + } + else + { + setEventMessages($object->error, $object->errors, 'errors'); + } + } + + if ($action == "updateligne" && $user->rights->expensereport->creer) + { + $object = new ExpenseReport($db); + $object->fetch($id); + + $rowid = $_POST['rowid']; + $type_fees_id = GETPOST('fk_c_type_fees'); + $projet_id = $fk_projet; + $comments = GETPOST('comments'); + $qty = GETPOST('qty'); + $value_unit = GETPOST('value_unit'); + $vatrate = GETPOST('vatrate'); + + if (! GETPOST('fk_c_type_fees') > 0) + { + $error++; + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors'); + $action=''; + } + if (GETPOST('vatrate') < 0 || GETPOST('vatrate') == '') + { + $error++; + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Vat")), null, 'errors'); + $action=''; + } + + if (! $error) + { + // TODO Use update method of ExpenseReportLine + $result = $object->updateline($rowid, $type_fees_id, $projet_id, $vatrate, $comments, $qty, $value_unit, $date, $id); + if ($result >= 0) + { + if ($result > 0) + { + // Define output language + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) + { + $outputlangs = $langs; + $newlang = ''; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha'); + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; + if (! empty($newlang)) { + $outputlangs = new Translate("", $conf); + $outputlangs->setDefaultLang($newlang); + } + $model=$object->modelpdf; + $ret = $object->fetch($id); // Reload to get new records + + $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); + } + } + + $result = $object->recalculer($id); + + header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); + exit; + } + else + { + setEventMessages($object->error, $object->errors, 'errors'); + } + } + } + + + /* + * Generate or regenerate the PDF document + */ + if ($action == 'builddoc') // GET or POST + { + $depl = new ExpenseReport($db, 0, $_GET['id']); + $depl->fetch($id); + + if ($_REQUEST['model']) + { + $depl->setDocModel($user, $_REQUEST['model']); + } + + $outputlangs = $langs; + if (! empty($_REQUEST['lang_id'])) + { + $outputlangs = new Translate("",$conf); + $outputlangs->setDefaultLang($_REQUEST['lang_id']); + } + $result=expensereport_pdf_create($db, $depl, '', $depl->modelpdf, $outputlangs); + if ($result <= 0) + { + setEventMessages($object->error, $object->errors, 'errors'); + $action=''; + } + } + + // Remove file in doc form + else if ($action == 'remove_file') + { + $object = new ExpenseReport($db, 0, $_GET['id']); + if ($object->fetch($id)) + { + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + + $object->fetch_thirdparty(); + + $langs->load("other"); + $upload_dir = $conf->expensereport->dir_output; + $file = $upload_dir . '/' . GETPOST('file'); + $ret=dol_delete_file($file,0,0,0,$object); + if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs'); + else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors'); + $action=''; + } + } } @@ -1071,7 +1176,9 @@ else if ($action == 'remove_file') * View */ -llxHeader('', $langs->trans("ExpenseReport")); +$title=$langs->trans("ExpenseReport") . " - " . $langs->trans("Card"); +$helpurl="EN:Module_Expense_Reports"; +llxHeader("",$title,$helpurl); $form = new Form($db); $formfile = new FormFile($db); @@ -1092,7 +1199,7 @@ if ($action == 'create') print '
'.$langs->trans("Year").''.$langs->trans("NbOfSendings").''.$langs->trans("AmountTotal").''.$langs->trans("AmountAverage").'
'.$oldyear.'0
'.$year.''.$val['nb'].''.price(price2num($val['total'],'MT'),1).'
'; print ''; print ''; - print ''; + print ''; print ''; @@ -1128,7 +1235,7 @@ if ($action == 'create') // Public note print ''; print ''; - print ''; print ''; - print ''; } + // Other attributes + $parameters = array('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, 'edit'); + } + print ''; print '
'.$langs->trans("DateStart").''.$langs->trans("DateStart").''; $form->select_date($date_start?$date_start:-1,'date_debut',0,0,0,'',1,1); print '
' . $langs->trans('NotePublic') . ''; + print ''; $doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%'); print $doleditor->Create(1); @@ -1138,19 +1245,27 @@ if ($action == 'create') if (empty($user->societe_id)) { print '
' . $langs->trans('NotePrivate') . ''; + print ''; $doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%'); print $doleditor->Create(1); print '
'; dol_fiche_end(); - print '
'; + print '
'; print ''; print '     '; print '
'; @@ -1161,9 +1276,10 @@ else { if($id > 0 || $ref) { - $object = new ExpenseReport($db); $result = $object->fetch($id, $ref); + $res = $object->fetch_optionals($object->id, $extralabels); + if ($result > 0) { if ($object->fk_user_author != $user->id) @@ -1191,7 +1307,7 @@ else print ''; print ''; - dol_fiche_head($head, 'card', $langs->trans("TripCard"), 0, 'trip'); + dol_fiche_head($head, 'card', $langs->trans("ExpenseReport"), 0, 'trip'); if($object->fk_statut==99) { @@ -1207,7 +1323,7 @@ else $linkback = ''.$langs->trans("BackToList").''; // Ref - print '
'.$langs->trans("Ref").''; + print '
'.$langs->trans("Ref").''; print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', ''); print '
'; $userfee=new User($db); $userfee->fetch($object->fk_user_valid); - print $userfee->getNomUrl(1); + print $userfee->getNomUrl(-1); print '
'; $userfee=new User($db); $userfee->fetch($object->fk_user_author); - print $userfee->getNomUrl(1); + print $userfee->getNomUrl(-1); print '
'; $userfee=new User($db); $userfee->fetch($user->id); - print $userfee->getNomUrl(1); + print $userfee->getNomUrl(-1); print '
' . $langs->trans('NotePublic') . ''; + print ''; $doleditor = new DolEditor('note_public', $object->note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%'); print $doleditor->Create(1); @@ -1288,7 +1408,7 @@ else if (empty($user->societe_id)) { print '
' . $langs->trans('NotePrivate') . ''; + print ''; $doleditor = new DolEditor('note_private', $object->note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%'); print $doleditor->Create(1); @@ -1308,75 +1428,124 @@ else } else { - dol_fiche_head($head, 'card', $langs->trans("TripCard"), 0, 'trip'); + dol_fiche_head($head, 'card', $langs->trans("ExpenseReport"), 0, 'trip'); if ($action == 'save') { - $ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("SaveTrip"),$langs->trans("ConfirmSaveTrip"),"confirm_validate","","",1); - if ($ret == 'html') print '
'; + $formconfirm=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("SaveTrip"),$langs->trans("ConfirmSaveTrip"),"confirm_validate","","",1); } if ($action == 'save_from_refuse') { - $ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("SaveTrip"),$langs->trans("ConfirmSaveTrip"),"confirm_save_from_refuse","","",1); - if ($ret == 'html') print '
'; + $formconfirm=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("SaveTrip"),$langs->trans("ConfirmSaveTrip"),"confirm_save_from_refuse","","",1); } if ($action == 'delete') { - $ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("DeleteTrip"),$langs->trans("ConfirmDeleteTrip"),"confirm_delete","","",1); - if ($ret == 'html') print '
'; + $formconfirm=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("DeleteTrip"),$langs->trans("ConfirmDeleteTrip"),"confirm_delete","","",1); } if ($action == 'validate') { - $ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("ValideTrip"),$langs->trans("ConfirmValideTrip"),"confirm_approve","","",1); - if ($ret == 'html') print '
'; + $formconfirm=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("ValideTrip"),$langs->trans("ConfirmValideTrip"),"confirm_approve","","",1); } if ($action == 'paid') { - $ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("PaidTrip"),$langs->trans("ConfirmPaidTrip"),"confirm_paid","","",1); - if ($ret == 'html') print '
'; + $formconfirm=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("PaidTrip"),$langs->trans("ConfirmPaidTrip"),"confirm_paid","","",1); } if ($action == 'cancel') { $array_input = array('text'=>$langs->trans("ConfirmCancelTrip"), array('type'=>"text",'label'=>$langs->trans("Comment"),'name'=>"detail_cancel",'size'=>"50",'value'=>"")); - $ret=$form->form_confirm($_SEVER["PHP_SELF"]."?id=".$id,$langs->trans("Cancel"),"","confirm_cancel",$array_input,"",1); - if ($ret == 'html') print '
'; + $formconfirm=$form->form_confirm($_SEVER["PHP_SELF"]."?id=".$id,$langs->trans("Cancel"),"","confirm_cancel",$array_input,"",1); } - if ($action == 'brouillonner'): - $ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("BrouillonnerTrip"),$langs->trans("ConfirmBrouillonnerTrip"),"confirm_brouillonner","","",1); - if ($ret == 'html') print '
'; - endif; + if ($action == 'brouillonner') + { + $formconfirm=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("BrouillonnerTrip"),$langs->trans("ConfirmBrouillonnerTrip"),"confirm_brouillonner","","",1); + } if ($action == 'refuse') // Deny { $array_input = array('text'=>$langs->trans("ConfirmRefuseTrip"), array('type'=>"text",'label'=>$langs->trans("Comment"),'name'=>"detail_refuse",'size'=>"50",'value'=>"")); - $ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("Deny"),'',"confirm_refuse",$array_input,"yes",1); - if ($ret == 'html') print '
'; + $formconfirm=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("Deny"),'',"confirm_refuse",$array_input,"yes",1); } if ($action == 'delete_line') { - $ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$id."&rowid=".GETPOST('rowid'),$langs->trans("DeleteLine"),$langs->trans("ConfirmDeleteLine"),"confirm_delete_line",'','yes',1); - if ($ret == 'html') print '
'; + $formconfirm=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$id."&rowid=".GETPOST('rowid'),$langs->trans("DeleteLine"),$langs->trans("ConfirmDeleteLine"),"confirm_delete_line",'','yes',1); } + // Print form confirm + print $formconfirm; + + + // Expense report card + + $linkback = ''.$langs->trans("BackToList").''; + + + $morehtmlref='
'; + /* + // Ref customer + $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->commande->creer, 'string', '', 0, 1); + $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->commande->creer, 'string', '', null, null, '', 1); + // Thirdparty + $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $soc->getNomUrl(1); + // Project + if (! empty($conf->projet->enabled)) + { + $langs->load("projects"); + $morehtmlref.='
'.$langs->trans('Project') . ' '; + if ($user->rights->commande->creer) + { + if ($action != 'classify') + $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.=''; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (! empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref.=''; + $morehtmlref.=$proj->ref; + $morehtmlref.=''; + } else { + $morehtmlref.=''; + } + } + }*/ + $morehtmlref.='
'; + + + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + + + print '
'; + print '
'; + print '
'; + print ''; - $linkback = ''.$langs->trans("BackToList").''; - // Ref - print ''; + print '';*/ print ''; - print ''; - print ''; + print ''; print ''; @@ -1384,22 +1553,24 @@ else { print ''; print ''; - print ''; + print ''; print ''; } // Status + /* print ''; print ''; print ''; print ''; + */ print ''; print ''; - print ''; + print ''; print ''; print ''; print ''; - print ''; + print ''; print ''; // Amount print ''; @@ -1411,76 +1582,14 @@ else else $rowspan+=2; if ($object->fk_statut==99 || !empty($object->detail_refuse)) $rowspan+=2; if($object->fk_statut==6) $rowspan+=2; - - print '"; - print ''; + print ''; print ''; print ''; print ''; + print ''; print ''; print ''; @@ -1495,7 +1604,7 @@ else $userauthor=new User($db); $result=$userauthor->fetch($object->fk_user_author); if ($result < 0) dol_print_error('',$userauthor->error); - print $userauthor->getNomUrl(1); + print $userauthor->getNomUrl(-1); } print ''; @@ -1518,7 +1627,7 @@ else { $userfee=new User($db); $userfee->fetch($object->fk_user_validator); - print $userfee->getNomUrl(1); + print $userfee->getNomUrl(-1); if (empty($userfee->email) || ! isValidEmail($userfee->email)) { $langs->load("errors"); @@ -1536,9 +1645,10 @@ else { $userfee=new User($db); $userfee->fetch($object->fk_user_cancel); - print $userfee->getNomUrl(1); + print $userfee->getNomUrl(-1); } print ''; + print ''; print ''; print ''; @@ -1557,9 +1667,10 @@ else { $userapp=new User($db); $userapp->fetch($object->fk_user_approve); - print $userapp->getNomUrl(1); + print $userapp->getNomUrl(-1); } print ''; + print ''; print ''; print ''; @@ -1573,8 +1684,9 @@ else print ''; + print ''; print ''; print ''; print ''; print ''; @@ -1600,8 +1712,83 @@ else */ } + // Other attributes + $cols = 3; + include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; + print '
'.$langs->trans("Ref").''; + /* + print '
'.$langs->trans("Ref").''; print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', ''); - print '
'.$langs->trans("Period").''; + print ''.$langs->trans("Period").''; print get_date_range($object->date_debut,$object->date_fin,'',$langs,0); print '
'.$langs->trans("ModePaiement").''.$object->libelle_paiement.''.$object->libelle_paiement.'
'.$langs->trans("Statut").''.$object->getLibStatut(4).'
'.$langs->trans("NotePublic").''.$object->note_public.''.$object->note_public.'
'.$langs->trans("NotePrivate").''.$object->note_private.''.$object->note_private.'
'; - - // List of payments - $sql = "SELECT p.rowid, p.num_payment, p.datep as dp, p.amount,"; - $sql.= "c.code as type_code,c.libelle as payment_type"; - $sql.= " FROM ".MAIN_DB_PREFIX."payment_expensereport as p"; - $sql.= ", ".MAIN_DB_PREFIX."c_paiement as c "; - $sql.= ", ".MAIN_DB_PREFIX."expensereport as e"; - $sql.= " WHERE e.rowid = '".$id."'"; - $sql.= " AND p.fk_expensereport = e.rowid"; - $sql.= " AND e.entity = ".$conf->entity; - $sql.= " AND p.fk_typepayment = c.id"; - $sql.= " ORDER BY dp"; - - //print $sql; - $resql = $db->query($sql); - if ($resql) - { - $num = $db->num_rows($resql); - $i = 0; $total = 0; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - $var=True; - while ($i < $num) - { - $objp = $db->fetch_object($resql); - $var=!$var; - print "'; - print '\n"; - $labeltype=$langs->trans("PaymentType".$objp->type_code)!=("PaymentType".$objp->type_code)?$langs->trans("PaymentType".$objp->type_code):$objp->fk_typepayment; - print "\n"; - print '\n"; - print ""; - $totalpaid += $objp->amount; - $i++; - } - - if ($object->paid == 0) - { - print "\n"; - print "\n"; - - $remaintopay = $object->total_ttc - $totalpaid; - - print ""; - print "\n"; - } - print "
'.$langs->trans("RefPayment").''.$langs->trans("Date").''.$langs->trans("Type").''.$langs->trans("Amount").' 
"; - print ''.img_object($langs->trans("Payment"),"payment").' '.$objp->rowid.''.dol_print_date($db->jdate($objp->dp),'day')."".$labeltype.' '.$objp->num_payment."'.price($objp->amount)." ".$langs->trans("Currency".$conf->currency)."
".$langs->trans("AlreadyPaid")." :".price($totalpaid)." ".$langs->trans("Currency".$conf->currency)."
".$langs->trans("AmountExpected")." :".price($object->total_ttc)." ".$langs->trans("Currency".$conf->currency)."
".$langs->trans("RemainderToPay")." :".price($remaintopay)." ".$langs->trans("Currency".$conf->currency)."
"; - $db->free($resql); - } - else - { - dol_print_error($db); - } print "
'.$langs->trans("AmountVAT").''.price($object->total_tva).'
'.$langs->trans("AmountTTC").''.price($object->total_ttc).'
'.$langs->trans("MOTIF_CANCEL").''.$object->detail_cancel.'
'.$langs->trans("DateApprove").''.dol_print_date($object->date_approve,'dayhour').'
'; $userfee=new User($db); $userfee->fetch($object->fk_user_refuse); - print $userfee->getNomUrl(1); + print $userfee->getNomUrl(-1); print '
'.$langs->trans("DATE_REFUS").''.dol_print_date($object->date_refuse,'dayhour'); @@ -1591,7 +1703,7 @@ else print ''; $userfee=new User($db); $userfee->fetch($object->fk_user_paid); - print $userfee->getNomUrl(1); + print $userfee->getNomUrl(-1); print '
'.$langs->trans("DATE_PAIEMENT").'
'; + print '
'; + print '
'; + print '
'; + //print '
'; + + // List of payments + $sql = "SELECT p.rowid, p.num_payment, p.datep as dp, p.amount,"; + $sql.= "c.code as type_code,c.libelle as payment_type"; + $sql.= " FROM ".MAIN_DB_PREFIX."payment_expensereport as p"; + $sql.= ", ".MAIN_DB_PREFIX."c_paiement as c "; + $sql.= ", ".MAIN_DB_PREFIX."expensereport as e"; + $sql.= " WHERE e.rowid = '".$id."'"; + $sql.= " AND p.fk_expensereport = e.rowid"; + $sql.= " AND e.entity = ".$conf->entity; + $sql.= " AND p.fk_typepayment = c.id"; + $sql.= " ORDER BY dp"; + + $resql = $db->query($sql); + if ($resql) + { + $num = $db->num_rows($resql); + $i = 0; $total = 0; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + + $var=True; + while ($i < $num) + { + $objp = $db->fetch_object($resql); + $var=!$var; + print "'; + print '\n"; + $labeltype=$langs->trans("PaymentType".$objp->type_code)!=("PaymentType".$objp->type_code)?$langs->trans("PaymentType".$objp->type_code):$objp->fk_typepayment; + print "\n"; + print '\n"; + print ""; + $totalpaid += $objp->amount; + $i++; + } + + if ($object->paid == 0) + { + print "\n"; + print "\n"; + + $remaintopay = $object->total_ttc - $totalpaid; + + print ""; + print '\n"; + } + print "
'.$langs->trans("RefPayment").''.$langs->trans("Date").''.$langs->trans("Type").''.$langs->trans("Amount").' 
"; + print ''.img_object($langs->trans("Payment"),"payment").' '.$objp->rowid.''.dol_print_date($db->jdate($objp->dp),'day')."".$labeltype.' '.$objp->num_payment."'.price($objp->amount)." ".$langs->trans("Currency".$conf->currency)."
".$langs->trans("AlreadyPaid")." :".price($totalpaid)."
".$langs->trans("AmountExpected")." :".price($object->total_ttc)."
".$langs->trans("RemainderToPay")." :'.price($remaintopay)."
"; + $db->free($resql); + } + else + { + dol_print_error($db); + } + + print '
'; + print '
'; + print '
'; + + print '

'; + print '
'; // Fetch Lines of current expense report @@ -1679,7 +1866,8 @@ else } print '
'.$langs->trans("TF_".strtoupper(empty($objp->type_fees_libelle)?'OTHER':$objp->type_fees_libelle)).''.$langs->trans("TF_".strtoupper(empty($objp->type_fees_libelle)?'OTHER':$objp->type_fees_libelle)).''.($langs->trans(($objp->type_fees_code)) == $objp->type_fees_code ? $objp->type_fees_libelle : $langs->trans(($objp->type_fees_code))).''.$objp->comments.''.vatrate($objp->vatrate,true).''.price($objp->value_unit).''; if (($object->fk_statut < 2 || $object->fk_statut == 99) && $user->rights->expensereport->creer) { + print ''; + print 'rowid.'#'.$objp->rowid.'">'; print img_edit(); print '   '; print 'rowid.'">'; print img_delete(); print ''; + + print '
'.$langs->trans('Date').''.$langs->trans('Date').''.$langs->trans('Project').''.$langs->trans('Type').''.$langs->trans('Description').''.$langs->trans('VAT').''.$langs->trans('PriceUTTC').''.$langs->trans('Qty').''.$langs->trans('Description').''.$langs->trans('VAT').''.$langs->trans('PriceUTTC').''.$langs->trans('Qty').'
'; + print ''; $form->select_date($date?$date:-1,'date'); print ''; + print ''; print ''; print ''; + print ''; $defaultvat=-1; if (! empty($conf->global->EXPENSEREPORT_NO_DEFAULT_VAT)) $conf->global->MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS = 'none'; - print ''; + print $form->load_tva('vatrate', ($vatrate!=''?$vatrate:$defaultvat), $mysoc, '', 0, 0, '', false); print ''; + print ''; print ''; print ''; + print ''; print ''; print '
'.$langs->trans("Ref").''; + print '
'.$langs->trans("Ref").''; print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', ''); print '
'.$expensereportstatic->getNomUrl(1).''.$userstatic->getNomUrl(1).''.$userstatic->getNomUrl(-1).''.price($obj->total_ht).''.price($obj->total_ttc).''.dol_print_date($db->jdate($obj->dm),'day').'
'; + $i=0; + while ($i < $totalarray['nbfield']) + { + $i++; + if ($i == 1) + { + if ($num < $limit) print ''; + else print ''; + } + elseif ($totalarray['totalhtfield'] == $i) print ''; + elseif ($totalarray['totalvatfield'] == $i) print ''; + elseif ($totalarray['totalttcfield'] == $i) print ''; + else print ''; + } + print ''; + } $db->free($resql); + + $parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql); + $reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + + print '
'; dol_print_object_info($object); diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index d269757af7e..722fb05767d 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2015 Laurent Destailleur + * Copyright (C) 2004-2016 Laurent Destailleur * Copyright (C) 2004 Eric Seigne * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2015 Alexandre Spangaro @@ -20,29 +20,51 @@ */ /** - * \file htdocs/expensereport/index.php + * \file htdocs/expensereport/list.php * \ingroup expensereport * \brief list of expense reports */ require "../main.inc.php"; -require_once DOL_DOCUMENT_ROOT . '/expensereport/class/expensereport.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/date.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; $langs->load("companies"); $langs->load("users"); $langs->load("trips"); +$action=GETPOST('action','alpha'); +$massaction=GETPOST('massaction','alpha'); +$show_files=GETPOST('show_files','int'); +$confirm=GETPOST('confirm','alpha'); +$toselect = GETPOST('toselect', 'array'); + // Security check $socid = $_GET["socid"]?$_GET["socid"]:''; if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'expensereport','',''); +$diroutputmassaction=$conf->expensereport->dir_output . '/temp/massgeneration/'.$user->id; + +$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='c.ref'; +if (! $sortorder) $sortorder='DESC'; + $sall = GETPOST('sall'); $search_ref = GETPOST('search_ref'); $search_user = GETPOST('search_user','int'); $search_amount_ht = GETPOST('search_amount_ht','alpha'); +$search_amount_vat = GETPOST('search_amount_vat','alpha'); $search_amount_ttc = GETPOST('search_amount_ttc','alpha'); $search_status = (GETPOST('search_status','alpha')!=''?GETPOST('search_status','alpha'):GETPOST('statut','alpha')); $month_start = GETPOST("month_start","int"); @@ -51,28 +73,94 @@ $month_end = GETPOST("month_end","int"); $year_end = GETPOST("year_end","int"); $optioncss = GETPOST('optioncss','alpha'); -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test must be present to be compatible with all browsers -{ - $search_ref=""; - $search_user=""; - $search_amount_ht=""; - $search_amount_ttc=""; - $search_status=""; - $month_start=""; - $year_start=""; - $month_end=""; - $year_end=""; -} - if ($search_status == '') $search_status=-1; if ($search_user == '') $search_user=-1; +// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +$contextpage='expensereportlist'; + +// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +$hookmanager->initHooks(array('expensereportlist')); +$extrafields = new ExtraFields($db); + +// fetch optionals attributes and labels +$extralabels = $extrafields->fetch_name_optionals_label('expensereport'); +$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_'); + + // List of fields to search into when doing a "search in all" $fieldstosearchall = array( 'd.ref'=>'Ref', + 'd.note_public'=>"NotePublic", 'u.lastname'=>'Lastname', 'u.firstname'=>"Firstname", + 'u.login'=>"Login", ); +if (empty($user->socid)) $fieldstosearchall["d.note_private"]="NotePrivate"; + +$arrayfields=array( + 'd.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1), + 'user'=>array('label'=>$langs->trans("Person"), 'checked'=>1), + 'd.date_debut'=>array('label'=>$langs->trans("DateStart"), 'checked'=>1), + 'd.date_fin'=>array('label'=>$langs->trans("DateEnd"), 'checked'=>1), + 'd.total_ht'=>array('label'=>$langs->trans("AmountHT"), 'checked'=>1), + 'd.total_vat'=>array('label'=>$langs->trans("AmountVAT"), 'checked'=>1), + 'd.total_ttc'=>array('label'=>$langs->trans("AmountTTC"), 'checked'=>1), + 'd.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), + 'd.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500), + 'd.fk_statut'=>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]); + } +} + + + +/* + * 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")) // Both test must be present to be compatible with all browsers +{ + $search_ref=""; + $search_user=""; + $search_amount_ht=""; + $search_amount_vat=""; + $search_amount_ttc=""; + $search_status=""; + $month_start=""; + $year_start=""; + $month_end=""; + $year_end=""; + $toselect=''; + $search_array_options=array(); +} + +if (empty($reshook)) +{ + $objectclass='ExpenseReport'; + $objectlabel='ExpenseReport'; + $permtoread = $user->rights->expensereport->lire; + $permtodelete = $user->rights->expensereport->supprimer; + $uploaddir = $conf->expensereport->dir_output; + include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; +} + /* @@ -81,6 +169,7 @@ $fieldstosearchall = array( $form = new Form($db); $formother = new FormOther($db); +$formfile = new FormFile($db); llxHeader('', $langs->trans("ListOfTrips")); @@ -104,20 +193,21 @@ $pagenext = $page + 1; $sql = "SELECT d.rowid, d.ref, d.fk_user_author, d.total_ht, d.total_tva, d.total_ttc, d.fk_statut as status,"; $sql.= " d.date_debut, d.date_fin, d.date_valid,"; -$sql.= " u.rowid as id_user, u.firstname, u.lastname"; +$sql.= " u.rowid as id_user, u.firstname, u.lastname, u.login, u.statut, u.photo"; +// 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."expensereport as d"; -$sql.= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON d.fk_user_author = u.rowid"; -$sql.= " WHERE d.entity = ".$conf->entity; - +if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."expensereport_extrafields as ef on (d.rowid = ef.fk_object)"; +$sql.= ", ".MAIN_DB_PREFIX."user as u"; +$sql.= " WHERE d.fk_user_author = u.rowid AND d.entity = ".$conf->entity; // Search all -if (!empty($sall)) -{ - $sql.= natural_search(array_keys($fieldstosearchall), $sall); -} +if (!empty($sall)) $sql.= natural_search(array_keys($fieldstosearchall), $sall); // Ref -if(!empty($search_ref)){ - $sql.= " AND d.ref LIKE '%".$db->escape($search_ref)."%'"; -} +if (!empty($search_ref)) $sql.= natural_search('d.ref', $search_ref); // Date Start if ($month_start > 0) { @@ -147,26 +237,16 @@ else if ($year_end > 0) $sql.= " AND d.date_fin BETWEEN '".$db->idate(dol_get_first_day($year_end,1,false))."' AND '".$db->idate(dol_get_last_day($year_end,12,false))."'"; } // Amount -if ($search_amount_ht != '') -{ - $sql.= natural_search('d.total_ht', $search_amount_ht, 1); -} -if ($search_amount_ttc != '') -{ - $sql.= natural_search('d.total_ttc', $search_amount_ttc, 1); -} +if ($search_amount_ht != '') $sql.= natural_search('d.total_ht', $search_amount_ht, 1); +if ($search_amount_ttc != '') $sql.= natural_search('d.total_ttc', $search_amount_ttc, 1); // User -if ($search_user != '' && $search_user >= 0) -{ - $sql.= " AND u.rowid = '".$db->escape($search_user)."'"; -} +if ($search_user != '' && $search_user >= 0) $sql.= " AND u.rowid = '".$db->escape($search_user)."'"; // Status if ($search_status != '' && $search_status >= 0) { if (strstr($search_status, ',')) $sql.=" AND d.fk_statut IN (".$db->escape($search_status).")"; else $sql.=" AND d.fk_statut = ".$search_status; } - // RESTRICT RIGHTS if (empty($user->rights->expensereport->readall) && empty($user->rights->expensereport->lire_tous)) { @@ -174,8 +254,26 @@ if (empty($user->rights->expensereport->readall) && empty($user->rights->expense $childids[]=$user->id; $sql.= " AND d.fk_user_author IN (".join(',',$childids).")\n"; } +// 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.= $db->order($sortfield,$sortorder); + $nbtotalofrecords = 0; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { @@ -189,87 +287,203 @@ $resql=$db->query($sql); 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; + if ($sall) $param.="&sall=".$sall; if ($search_ref) $param.="&search_ref=".$search_ref; if ($search_user) $param.="&search_user=".$search_user; if ($search_amount_ht) $param.="&search_amount_ht=".$search_amount_ht; if ($search_amount_ttc) $param.="&search_amount_ttc=".$search_amount_ttc; if ($search_status >= 0) $param.="&search_status=".$search_status; - if ($optioncss != '') $param.='&optioncss='.$optioncss; - - print_barre_liste($langs->trans("ListTripsAndExpenses"), $page, $_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords); + 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->expensereport->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete"); + if ($massaction == 'presend') $arrayofmassactions=array(); + $massactionbutton=$form->selectMassAction('', $arrayofmassactions); + print '
'."\n"; if ($optioncss != '') print ''; print ''; + print ''; print ''; print ''; print ''; - if ($sall) + $title = $langs->trans("ListTripsAndExpenses"); + print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_generic.png', 0, '', '', $limit); + + if ($sall) { foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); + print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); } - - print ''; + + $moreforfilter=''; + + $parameters=array(); + $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 '
'; + print $moreforfilter; + print '
'; + } + + $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; + $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields + + print '
'."\n"; print ""; - print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"d.rowid","",$param,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("DateStart"),$_SERVER["PHP_SELF"],"d.date_debut","",$param,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("DateEnd"),$_SERVER["PHP_SELF"],"d.date_fin","",$param,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Person"),$_SERVER["PHP_SELF"],"u.lastname","",$param,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("TotalHT"),$_SERVER["PHP_SELF"],"d.total_ht","",$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("TotalVAT"),$_SERVER["PHP_SELF"],"d.total_tva","",$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("TotalTTC"),$_SERVER["PHP_SELF"],"d.total_ttc","",$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"","",$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch '); + if (! empty($arrayfields['d.ref']['checked'])) print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"d.ref","",$param,'',$sortfield,$sortorder); + if (! empty($arrayfields['user']['checked'])) print_liste_field_titre($langs->trans("Person"),$_SERVER["PHP_SELF"],"u.lastname","",$param,'',$sortfield,$sortorder); + if (! empty($arrayfields['d.date_debut']['checked'])) print_liste_field_titre($langs->trans("DateStart"),$_SERVER["PHP_SELF"],"d.date_debut","",$param,'align="center"',$sortfield,$sortorder); + if (! empty($arrayfields['d.date_fin']['checked'])) print_liste_field_titre($langs->trans("DateEnd"),$_SERVER["PHP_SELF"],"d.date_fin","",$param,'align="center"',$sortfield,$sortorder); + if (! empty($arrayfields['d.total_ht']['checked'])) print_liste_field_titre($langs->trans("TotalHT"),$_SERVER["PHP_SELF"],"d.total_ht","",$param,'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['d.total_vat']['checked'])) print_liste_field_titre($langs->trans("TotalVAT"),$_SERVER["PHP_SELF"],"d.total_tva","",$param,'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['d.total_ttc']['checked'])) print_liste_field_titre($langs->trans("TotalTTC"),$_SERVER["PHP_SELF"],"d.total_ttc","",$param,'align="right"',$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['d.datec']['checked'])) print_liste_field_titre($arrayfields['d.datec']['label'],$_SERVER["PHP_SELF"],"d.date_creation","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); + if (! empty($arrayfields['d.tms']['checked'])) print_liste_field_titre($arrayfields['d.tms']['label'],$_SERVER["PHP_SELF"],"d.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); + if (! empty($arrayfields['d.fk_statut']['checked'])) print_liste_field_titre($arrayfields['d.fk_statut']['label'],$_SERVER["PHP_SELF"],"d.fk_statut","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch '); print "\n"; // Filters print ''; - print ''; - - // Date end - print ''; - - // User - if ($user->rights->expensereport->readall || $user->rights->expensereport->lire_tous) + if (! empty($arrayfields['d.ref']['checked'])) { - print ''; - } else { - print ''; + print ''; } - + // User + if (! empty($arrayfields['user']['checked'])) + { + if ($user->rights->expensereport->readall || $user->rights->expensereport->lire_tous) + { + print ''; + } else { + print ''; + } + } + // Date start + if (! empty($arrayfields['d.date_debut']['checked'])) + { + print ''; + } + // Date end + if (! empty($arrayfields['d.date_fin']['checked'])) + { + print ''; + } // Amount with no tax - print ''; - - print ''; - + if (! empty($arrayfields['d.total_ht']['checked'])) + { + print ''; + } + if (! empty($arrayfields['d.total_vat']['checked'])) + { + print ''; + } // Amount with all taxes - print ''; - + if (! empty($arrayfields['d.total_ttc']['checked'])) + { + print ''; + } + // 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 ''; + } + } + } + // 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['d.datec']['checked'])) + { + print ''; + } + // Date modification + if (! empty($arrayfields['d.tms']['checked'])) + { + print ''; + } // Status - print ''; + } + // Action column + print ''; - print ''; - print "\n"; $var=true; @@ -279,74 +493,201 @@ if ($resql) $total_total_tva = 0; $expensereportstatic=new ExpenseReport($db); - + $usertmp = new User($db); + if ($num > 0) { - while ($i < min($num,$limit)) + $i=0; + $var=true; + $totalarray=array(); + while ($i < min($num,$limit)) { - $objp = $db->fetch_object($resql); - - $expensereportstatic->id=$objp->rowid; - $expensereportstatic->ref=$objp->ref; - $expensereportstatic->status=$objp->status; - $expensereportstatic->valid=$objp->date_valid; - $expensereportstatic->date_debut=$objp->date_debut; - $expensereportstatic->date_fin=$objp->date_fin; + $obj = $db->fetch_object($resql); + + $expensereportstatic->id=$obj->rowid; + $expensereportstatic->ref=$obj->ref; + $expensereportstatic->status=$obj->status; + $expensereportstatic->valid=$obj->date_valid; + $expensereportstatic->date_debut=$obj->date_debut; + $expensereportstatic->date_fin=$obj->date_fin; $var=!$var; print ""; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - print ''; + if (! empty($arrayfields['d.ref']['checked'])) { + print ''; + if (! $i) $totalarray['nbfield']++; + } + if (! empty($arrayfields['user']['checked'])) { + print ''; + if (! $i) $totalarray['nbfield']++; + } + if (! empty($arrayfields['d.date_debut']['checked'])) { + print ''; + if (! $i) $totalarray['nbfield']++; + } + if (! empty($arrayfields['d.date_fin']['checked'])) { + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Amount HT + if (! empty($arrayfields['d.total_ht']['checked'])) + { + print '\n"; + if (! $i) $totalarray['nbfield']++; + if (! $i) $totalarray['totalhtfield']=$totalarray['nbfield']; + $totalarray['totalht'] += $obj->total_ht; + } + // Amount VAT + if (! empty($arrayfields['d.total_vat']['checked'])) + { + print '\n"; + if (! $i) $totalarray['nbfield']++; + if (! $i) $totalarray['totalvatfield']=$totalarray['nbfield']; + $totalarray['totalvat'] += $obj->total_tva; + } + // Amount TTC + if (! empty($arrayfields['d.total_ttc']['checked'])) + { + print '\n"; + if (! $i) $totalarray['nbfield']++; + if (! $i) $totalarray['totalttcfield']=$totalarray['nbfield']; + $totalarray['totalttc'] += $obj->total_ttc; + } + + // 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 'getAlignFlag($key); + if ($align) print ' align="'.$align.'"'; + print '>'; + $tmpkey='options_'.$key; + print $extrafields->showOutputField($key, $obj->$tmpkey, '', 1); + print ''; + 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['d.datec']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Date modification + if (! empty($arrayfields['d.tms']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Status + if (! empty($arrayfields['d.fk_statut']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Action column + print ''; + if (! $i) $totalarray['nbfield']++; print "\n"; - $total_total_ht = $total_total_ht + $objp->total_ht; - $total_total_tva = $total_total_tva + $objp->total_tva; - $total_total_ttc = $total_total_ttc + $objp->total_ttc; + $total_total_ht = $total_total_ht + $obj->total_ht; + $total_total_tva = $total_total_tva + $obj->total_tva; + $total_total_ttc = $total_total_ttc + $obj->total_ttc; $i++; } - - print ''; - print ''; - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - } + } else { print ''.''; } - print "
'; - print ''; - - // Date start - print ''; - print ''; - $formother->select_year($year_start,'year_start',1, $min_year, $max_year); - print ''; - print ''; - $formother->select_year($year_end,'year_end',1, $min_year, $max_year); - print ''; - print $form->select_dolusers($search_user, 'search_user', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300'); - print ' '; + print ''; + print ''; + print $form->select_dolusers($search_user, 'search_user', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300'); + print ' '; + print ''; + $formother->select_year($year_start,'year_start',1, $min_year, $max_year); + print ''; + print ''; + $formother->select_year($year_end,'year_end',1, $min_year, $max_year); + print ' '; + 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 ''; + } + print ''; + print ''; + print ''; - select_expensereport_statut($search_status,'search_status',1,1); + if (! empty($arrayfields['d.fk_statut']['checked'])) + { + print ''; + select_expensereport_statut($search_status,'search_status',1,1); + print ''; + $searchpitco=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1); + print $searchpitco; print ''; - $searchpitco=$form->showFilterAndCheckAddButtons(0); - print $searchpitco; - print '
'; - print $expensereportstatic->getNomUrl(1); - if ($expensereportstatic->status == 2 && $expensereportstatic->hasDelay('toappove')) print img_warning($langs->trans("Late")); - if ($expensereportstatic->status == 5 && $expensereportstatic->hasDelay('topay')) print img_warning($langs->trans("Late")); - print ''.($objp->date_debut > 0 ? dol_print_date($objp->date_debut, 'day') : '').''.($objp->date_fin > 0 ? dol_print_date($objp->date_fin, 'day') : '').''.img_object($langs->trans("ShowUser"),"user").' '.dolGetFirstLastname($objp->firstname, $objp->lastname).''.price($objp->total_ht).''.price($objp->total_tva).''.price($objp->total_ttc).''; - print $expensereportstatic->getLibStatut(5); - print ''; + print $expensereportstatic->getNomUrl(1); + if ($expensereportstatic->status == 2 && $expensereportstatic->hasDelay('toappove')) print img_warning($langs->trans("Late")); + if ($expensereportstatic->status == 5 && $expensereportstatic->hasDelay('topay')) print img_warning($langs->trans("Late")); + print ''; + $usertmp->id=$obj->id_user; + $usertmp->lastname=$obj->lastname; + $usertmp->firstname=$obj->firstname; + $usertmp->login=$obj->login; + $usertmp->statut=$obj->statut; + $usertmp->photo=$obj->photo; + print $usertmp->getNomUrl(-1); + print ''.($obj->date_debut > 0 ? dol_print_date($obj->date_debut, 'day') : '').''.($obj->date_fin > 0 ? dol_print_date($obj->date_fin, 'day') : '').''.price($obj->total_ht)."'.price($obj->total_tva)."'.price($obj->total_ttc)."'; + print dol_print_date($db->jdate($obj->date_creation), 'dayhour'); + print ''; + print dol_print_date($db->jdate($obj->date_update), 'dayhour'); + print ''.$expensereportstatic->getLibStatut(5).''; + 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 ''; + } + print '
'.$langs->trans("Total").''.price($total_total_ht).''.price($total_total_tva).''.price($total_total_ttc).'
'.$langs->trans("NoRecordFound").'
"; - print "
"; - - /* - print '
'; - print ''.$langs->trans("NewTrip").''; - print '
'; - */ + // Show total line + if (isset($totalarray['totalhtfield'])) + { + print '
'.$langs->trans("Total").''.$langs->trans("Totalforthispage").''.price($totalarray['totalht']).''.price($totalarray['totalvat']).''.price($totalarray['totalttc']).'
'."\n"; + + print ''."\n"; + + /* + if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) + { + // Show list of available documents + $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder; + $urlsource.=str_replace('&','&',$param); + + $filedir=$diroutputmassaction; + $genallowed=$user->rights->expensereport->lire; + $delallowed=$user->rights->expensereport->lire; + + print '
'; + $paramwithoutshowfiles=preg_replace('/show_files=1&?/','',$param); + $title=$langs->trans("MassFilesArea").' ('.$langs->trans("Hide").')'; + + print $formfile->showdocuments('massfilesarea_orders','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,''); + } + else + { + print '
'.$langs->trans("ShowTempMassFilesArea").''; + } + */ } else { diff --git a/htdocs/expensereport/payment/payment.php b/htdocs/expensereport/payment/payment.php index b7d40b2e65b..c4351e4d038 100644 --- a/htdocs/expensereport/payment/payment.php +++ b/htdocs/expensereport/payment/payment.php @@ -57,6 +57,9 @@ if ($action == 'add_payment') exit; } + $expensereport = new ExpenseReport($db); + $expensereport->fetch($chid); + $datepaid = dol_mktime(12, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]); if (! $_POST["fk_typepayment"] > 0) @@ -85,8 +88,7 @@ if ($action == 'add_payment') { if (substr($key,0,7) == 'amount_') { - $other_chid = substr($key,7); - $amounts[$other_chid] = price2num($_POST[$key]); + $amounts[$expensereport->fk_user_author] = price2num($_POST[$key]); $total += price2num($_POST[$key]); } } diff --git a/htdocs/exports/class/export.class.php b/htdocs/exports/class/export.class.php index 6632f050550..48c34acd128 100644 --- a/htdocs/exports/class/export.class.php +++ b/htdocs/exports/class/export.class.php @@ -234,19 +234,32 @@ class Export } $sql.=$this->array_export_sql_end[$indice]; - // Add the filtering into sql if a filtering array is provided + // Add the WHERE part. Filtering into sql if a filtering array is provided if (is_array($array_filterValue) && !empty($array_filterValue)) { $sqlWhere=''; // Loop on each condition to add foreach ($array_filterValue as $key => $value) { + if (preg_match('/GROUP_CONCAT/i', $key)) continue; if ($value != '') $sqlWhere.=" and ".$this->build_filterQuery($this->array_export_TypeFields[$indice][$key], $key, $array_filterValue[$key]); } $sql.=$sqlWhere; } + + // Add the order $sql.=$this->array_export_sql_order[$indice]; + // Add the HAVING part. + if (is_array($array_filterValue) && !empty($array_filterValue)) + { + // Loop on each condition to add + foreach ($array_filterValue as $key => $value) + { + if (preg_match('/GROUP_CONCAT/i', $key) and $value != '') $sql.=" HAVING ".$this->build_filterQuery($this->array_export_TypeFields[$indice][$key], $key, $array_filterValue[$key]); + } + } + return $sql; } @@ -513,7 +526,7 @@ class Export return -1; } - // Creation de la classe d'export du model ExportXXX + // Creation of class to export using model ExportXXX $dir = DOL_DOCUMENT_ROOT . "/core/modules/export/"; $file = "export_".$model.".modules.php"; $classname = "Export".$model; diff --git a/htdocs/exports/export.php b/htdocs/exports/export.php index 50ca1e09a91..7b51aa02f15 100644 --- a/htdocs/exports/export.php +++ b/htdocs/exports/export.php @@ -33,6 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/export/modules_export.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; $langs->load("exports"); +$langs->load("other"); $langs->load("users"); $langs->load("companies"); $langs->load("projects"); @@ -561,6 +562,8 @@ if ($step == 2 && $datatoexport) print ''; // If value of entityicon=entitylang='icon:Label' + //print $code.'-'.$label.'-'.$entity; + $tmparray=explode(':',$entityicon); if (count($tmparray) >=2) { @@ -636,7 +639,14 @@ if ($step == 2 && $datatoexport) if ($step == 3 && $datatoexport) { - llxHeader('',$langs->trans("NewExport"),'EN:Module_Exports_En|FR:Module_Exports|ES:Módulo_Exportaciones'); + if (count($array_selected) < 1) // This occurs when going back to page after sessecion expired + { + // Switch to step 2 + header("Location: ".DOL_URL_ROOT.'/exports/export.php?step=2&datatoexport='.$datatoexport); + exit; + } + + llxHeader('',$langs->trans("NewExport"),'EN:Module_Exports_En|FR:Module_Exports|ES:Módulo_Exportaciones'); /* * Affichage onglets @@ -790,6 +800,13 @@ if ($step == 3 && $datatoexport) if ($step == 4 && $datatoexport) { + if (count($array_selected) < 1) // This occurs when going back to page after sessecion expired + { + // Switch to step 2 + header("Location: ".DOL_URL_ROOT.'/exports/export.php?step=2&datatoexport='.$datatoexport); + exit; + } + asort($array_selected); llxHeader('',$langs->trans("NewExport"),'EN:Module_Exports_En|FR:Module_Exports|ES:Módulo_Exportaciones'); @@ -1015,6 +1032,13 @@ if ($step == 4 && $datatoexport) if ($step == 5 && $datatoexport) { + if (count($array_selected) < 1) // This occurs when going back to page after sessecion expired + { + // Switch to step 2 + header("Location: ".DOL_URL_ROOT.'/exports/export.php?step=2&datatoexport='.$datatoexport); + exit; + } + asort($array_selected); llxHeader('',$langs->trans("NewExport"),'EN:Module_Exports_En|FR:Module_Exports|ES:Módulo_Exportaciones'); @@ -1146,6 +1170,7 @@ if ($step == 5 && $datatoexport) print '
'; + print ''; if ($sqlusedforexport && $user->admin) @@ -1156,17 +1181,18 @@ if ($step == 5 && $datatoexport) } print '
'; - print ''; - print '
'; + + print '
'; if (! is_dir($conf->export->dir_temp)) dol_mkdir($conf->export->dir_temp); // Affiche liste des documents // NB: La fonction show_documents rescanne les modules qd genallowed=1, sinon prend $liste - $formfile->show_documents('export','',$upload_dir,$_SERVER["PHP_SELF"].'?step=5&datatoexport='.$datatoexport,$liste,1,(! empty($_POST['model'])?$_POST['model']:'csv'),1,1); - - print '
 
'; + print $formfile->showdocuments('export','',$upload_dir,$_SERVER["PHP_SELF"].'?step=5&datatoexport='.$datatoexport,$liste,1,(! empty($_POST['model'])?$_POST['model']:'csv'),1,1); + print '
'; + + print '
'; } print '
'; @@ -1187,15 +1213,16 @@ exit; // don't know why but apache hangs with php 5.3.10-1ubuntu3.12 and apache */ function getablenamefromfield($code,$sqlmaxforexport) { + $alias=preg_replace('/\.(.*)$/i','',$code); // Keep only 'Alias' and remove '.Fieldname' + $regexstring='/([a-zA-Z_]+) as '.preg_quote($alias).'[, \)]/i'; + $newsql=$sqlmaxforexport; - $newsql=preg_replace('/^(.*) FROM /i','',$newsql); - $newsql=preg_replace('/WHERE (.*)$/i','',$newsql); // We must keep the ' ' before WHERE - $alias=preg_replace('/\.(.*)$/i','',$code); - //print $newsql.' '.$alias; - $regexstring='/([a-zA-Z_]+) as '.$alias.'[, \)]/i'; + $newsql=preg_replace('/^(.*) FROM /i','',$newsql); // Remove part before the FROM + $newsql=preg_replace('/WHERE (.*)$/i','',$newsql); // Remove part after the WHERE so we have now only list of table aliases in a string. We must keep the ' ' before WHERE + if (preg_match($regexstring,$newsql,$reg)) { - return $reg[1]; + return $reg[1]; // The tablename } else return ''; } diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index a54a983f514..849e873b96e 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -34,13 +34,11 @@ require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/modules/fichinter/modules_fichinter.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/fichinter.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; - if (! empty($conf->projet->enabled)) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; } - if ($conf->contrat->enabled) { require_once DOL_DOCUMENT_ROOT."/core/class/html.formcontract.class.php"; @@ -111,6 +109,36 @@ if (empty($reshook)) include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once + // Action clone object + if ($action == 'confirm_clone' && $confirm == 'yes' && $user->rights->ficheinter->creer) + { + if (1==0 && ! GETPOST('clone_content') && ! GETPOST('clone_receivers')) + { + setEventMessages($langs->trans("NoCloneOptionsSpecified"), null, 'errors'); + } + else + { + if ($object->id > 0) + { + // Because createFromClone modifies the object, we must clone it so that we can restore it later + $orig = clone $object; + + $result=$object->createFromClone($socid); + if ($result > 0) + { + header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result); + exit; + } + else + { + setEventMessages($object->error, $object->errors, 'errors'); + $object = $orig; + $action=''; + } + } + } + } + if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->ficheinter->creer) { $result = $object->setValid($user); @@ -250,68 +278,82 @@ if (empty($reshook)) for ($i=0;$i<$num;$i++) { - $product_type=($lines[$i]->product_type?$lines[$i]->product_type:0); + $product_type=($lines[$i]->product_type?$lines[$i]->product_type:Product::TYPE_PRODUCT); - if ($product_type == 1 || !empty($conf->global->FICHINTER_PRINT_PRODUCTS)) { //only services except if config includes products - // service prédéfini + if ($product_type == Product::TYPE_SERVICE || !empty($conf->global->FICHINTER_PRINT_PRODUCTS)) { //only services except if config includes products + $duration = 3600; // Default to one hour + + // Predefined products & services if ($lines[$i]->fk_product > 0) { + $prod = new Product($db); + $prod->id = $lines[$i]->fk_product; + // Define output language - if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) - { - $prod = new Product($db); - $prod->id=$lines[$i]->fk_product; + if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) { $prod->getMultiLangs(); // We show if duration is present on service (so we get it) $prod->fetch($lines[$i]->fk_product); - if ($prod->duration_value && $prod->duration_unit == 'h' && $conf->global->FICHINTER_USE_SERVICE_DURATION) - { - $durationproduct=$prod->duration_value * 3600 * $lines[$i]->qty; - } - else - $durationproduct=3600; $outputlangs = $langs; $newlang=''; if (empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id'); if (empty($newlang)) $newlang=$srcobject->client->default_lang; - if (! empty($newlang)) - { + if (! empty($newlang)) { $outputlangs = new Translate("",$conf); $outputlangs->setDefaultLang($newlang); } - $label = (! empty($prod->multilangs[$outputlangs->defaultlang]["libelle"])) ? $prod->multilangs[$outputlangs->defaultlang]["libelle"] : $lines[$i]->product_label; - } - else - { - $label = $lines[$i]->product_label; + } else { + $prod->fetch($lines[$i]->fk_product); + $label .= $lines[$i]->product_label; } - $desc = $label; - $desc .= ' ('.$langs->trans('Quantity').': '.$lines[$i]->qty.')'; - } - else { - $desc = dol_htmlentitiesbr($lines[$i]->desc); - $desc .= ' ('.$langs->trans('Quantity').': '.$lines[$i]->qty.')'; + if ($prod->duration_value && $conf->global->FICHINTER_USE_SERVICE_DURATION) { + switch ($prod->duration_unit) { + default: + case 'h': + $mult = 3600; + break; + case 'd': + $mult = 3600 * 24; + break; + case 'w': + $mult = 3600 * 24 * 7; + break; + case 'm': + $mult = (int) 3600 * 24 * (365 / 12); // Average month duration + break; + case 'y': + $mult = 3600 * 24 * 365; + break; + } + $duration = $prod->duration_value * $mult * $lines[$i]->qty; + } + + $desc = $lines[$i]->product_ref; + $desc .= ' - '; + $desc .= $label; + $desc .= '
'; } + // Common part (predefined or free line) + $desc .= dol_htmlentitiesbr($lines[$i]->desc); + $desc .= '
'; + $desc .= ' (' . $langs->trans('Quantity') . ': ' . $lines[$i]->qty . ')'; + $timearray=dol_getdate(mktime()); $date_intervention=dol_mktime(0,0,0,$timearray['mon'],$timearray['mday'],$timearray['year']); - if ($product_type == 1) - { //service - $duration = $durationproduct; - } - else - { //product + + if ($product_type == Product::TYPE_PRODUCT) { $duration = 0; } $predef = ''; + // Extrafields $extrafieldsline = new ExtraFields($db); $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); $array_options = $extrafieldsline->getOptionalsFromPost($extralabelsline, $predef); - $result = $object->addline( $user, $id, @@ -447,7 +489,7 @@ if (empty($reshook)) } // Set into a contract - else if ($action == 'setcontrat' && $user->rights->contrat->creer) + else if ($action == 'setcontract' && $user->rights->contrat->creer) { $result=$object->set_contrat($user,GETPOST('contratid','int')); if ($result < 0) dol_print_error($db,$object->error); @@ -568,6 +610,21 @@ if (empty($reshook)) } } + // Classify Billed + else if ($action == 'classifydone' && $user->rights->ficheinter->creer) + { + $result=$object->setStatut(3); + if ($result > 0) + { + header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); + exit; + } + else + { + setEventMessages($object->error, $object->errors, 'errors'); + } + } + /* * Mise a jour d'une ligne d'intervention */ @@ -700,174 +757,20 @@ if (empty($reshook)) exit; } - - /* - * Add file in email form - */ - if (GETPOST('addfile','alpha')) - { - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - - // Set tmp user directory TODO Use a dedicated directory for temp mails files - $vardir=$conf->user->dir_output."/".$user->id; - $upload_dir_tmp = $vardir.'/temp'; - - dol_add_file_process($upload_dir_tmp,0,0); - $action='presend'; - } - - /* - * Remove file in email form - */ - if (GETPOST('removedfile','alpha')) - { - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - - // Set tmp user directory - $vardir=$conf->user->dir_output."/".$user->id; - $upload_dir_tmp = $vardir.'/temp'; - - // TODO Delete only files that was uploaded from email form - dol_remove_file_process(GETPOST('removedfile','alpha'),0); - $action='presend'; - } - /* * Send mail - */ - if ($action == 'send' && ! GETPOST('cancel','alpha') && (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->ficheinter->ficheinter_advance->send)) - { - $langs->load('mails'); + */ - if (GETPOST('sendto','alpha')) - { - // Le destinataire a ete fourni via le champ libre - $sendto = GETPOST('sendto','alpha'); - $sendtoid = 0; - } - elseif (GETPOST('receiver','alpha') != '-1') - { - // Recipient was provided from combo list - if (GETPOST('receiver','alpha') == 'thirdparty') // Id of third party - { - $sendto = $object->thirdparty->email; - $sendtoid = 0; - } - else // Id du contact - { - $sendto = $object->thirdparty->contact_get_property(GETPOST('receiver'),'email'); - $sendtoid = GETPOST('receiver','alpha'); - } - } + // Actions to send emails + $actiontypecode='AC_OTH_AUTO'; + $trigger_name='FICHINTER_SENTBYMAIL'; + $paramname='id'; + $mode='emailfromintervention'; + $trackid='int'.$object->id; + include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; - if (dol_strlen($sendto)) - { - $langs->load("commercial"); - $from = GETPOST('fromname','alpha') . ' <' . GETPOST('frommail','alpha') .'>'; - $replyto = GETPOST('replytoname','alpha'). ' <' . GETPOST('replytomail','alpha').'>'; - $message = GETPOST('message'); - $sendtocc = GETPOST('sendtocc','alpha'); - $deliveryreceipt = GETPOST('deliveryreceipt','alpha'); - - if ($action == 'send') - { - if (strlen(GETPOST('subject','alphs'))) $subject = GETPOST('subject','alpha'); - else $subject = $langs->transnoentities('Intervention').' '.$object->ref; - $actiontypecode='AC_OTH_AUTO'; - $actionmsg = $langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto; - if ($message) - { - if ($sendtocc) $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc); - $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject); - $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":"); - $actionmsg = dol_concatdesc($actionmsg, $message); - } - $actionmsg2=$langs->transnoentities("InterventionSentByEMail",$object->ref); - } - - // Create form object - include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; - $formmail = new FormMail($db); - - $attachedfiles=$formmail->get_attached_files(); - $filepath = $attachedfiles['paths']; - $filename = $attachedfiles['names']; - $mimetype = $attachedfiles['mimes']; - - // Send by email - require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; - $mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,'',$deliveryreceipt,-1); - if ($mailfile->error) - { - $mesg='
'.$mailfile->error.'
'; - } - else - { - $result=$mailfile->sendfile(); - if ($result) - { - $mesg=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2)); - setEventMessages($mesg, null, 'mesgs'); - $error=0; - - // Initialisation donnees - $object->sendtoid = $sendtoid; - $object->actiontypecode = $actiontypecode; - $object->actionmsg = $actionmsg; - $object->actionmsg2 = $actionmsg2; - $object->fk_element = $object->id; - $object->elementtype = $object->element; - - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($db); - $result=$interface->run_triggers('FICHINTER_SENTBYMAIL',$object,$user,$langs,$conf); - if ($result < 0) { - $error++; $object->errors=$interface->errors; - } - // Fin appel triggers - - if ($error) - { - dol_print_error($db); - } - else - { - // Redirect here - // This avoid sending mail twice if going out and then back to page - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); - exit; - } - } - else - { - $langs->load("other"); - $mesg='
'; - if ($mailfile->error) - { - $mesg.=$langs->trans('ErrorFailedToSendMail',$from,$sendto); - $mesg.='
'.$mailfile->error; - } - else - { - $mesg.='No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS'; - } - $mesg.='
'; - } - } - } - else - { - $langs->load("other"); - $mesg='
'.$langs->trans('ErrorMailRecipientIsEmpty').' !
'; - dol_syslog('Recipient email is empty'); - } - - $action='presend'; - } - - else if ($action == 'update_extras') + if ($action == 'update_extras') { // Fill array 'array_options' with data from update form $extralabels=$extrafields->fetch_name_optionals_label($object->table_element); @@ -953,8 +856,8 @@ if (empty($reshook)) $form = new Form($db); $formfile = new FormFile($db); -if ($conf->contrat->enabled) - $formcontract = new FormContract($db); +if ($conf->contrat->enabled) $formcontract = new FormContract($db); +if (! empty($conf->projet->enabled)) { $formproject = new FormProjets($db); } llxHeader('',$langs->trans("Intervention")); @@ -1043,6 +946,7 @@ if ($action == 'create') if ($socid > 0) { + $soc=new Societe($db); $soc->fetch($socid); print '
'; @@ -1080,7 +984,7 @@ if ($action == 'create') else $numprojet=select_projects($societe->id,$_POST["projectid"],'projectid'); */ - $numprojet=$formproject->select_projects($soc->id,GETPOST('projectid','int'),'projectid'); + $numprojet=$formproject->select_projects($soc->id,$projectid,'projectid'); if ($numprojet==0) { print '   '.$langs->trans("AddProject").''; @@ -1152,6 +1056,8 @@ if ($action == 'create') { print ''; print ''; + } elseif ($origin == 'project' && !empty($projectid)) { + print ''; } dol_fiche_end(); @@ -1169,9 +1075,16 @@ if ($action == 'create') dol_fiche_head(''); print ''; + if (is_object($objectsrc)) + { + print ''; + print ''; + } elseif ($origin == 'project' && !empty($projectid)) { + print ''; + } print ''; print ''; print '
'.$langs->trans("ThirdParty").''; - print $form->select_company('','socid','',1,1); + print $form->select_company('','socid','','SelectThirdParty',1); print '
'; @@ -1192,7 +1105,7 @@ else if ($id > 0 || ! empty($ref)) { /* * Affichage en mode visu - */ + */ $object->fetch($id, $ref); $object->fetch_thirdparty(); @@ -1249,6 +1162,20 @@ else if ($id > 0 || ! empty($ref)) $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&line_id='.$lineid, $langs->trans('DeleteInterventionLine'), $langs->trans('ConfirmDeleteInterventionLine'), 'confirm_deleteline','',0,1); } + // Clone confirmation + if ($action == 'clone') { + // Create an array for form + $formquestion = array( + // 'text' => $langs->trans("ConfirmClone"), + // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => + // 1), + // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' + // => 1), + array('type' => 'other','name' => 'socid','label' => $langs->trans("SelectThirdParty"),'value' => $form->select_company(GETPOST('socid', 'int'), 'socid', '', '', 0, 0, null, 0, 'minwidth200'))); + // Paiement incomplet. On demande si motif = escompte ou autre + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('CloneIntervention'), $langs->trans('ConfirmCloneIntervention', $object->ref), 'confirm_clone', $formquestion, 'yes', 1); + } + if (!$formconfirm) { $parameters=array('lineid'=>$lineid); @@ -1260,59 +1187,104 @@ else if ($id > 0 || ! empty($ref)) // Print form confirm print $formconfirm; - print ''; - + + // Intervention card $linkback = ''.$langs->trans("BackToList").''; - + + + $morehtmlref='
'; + // Ref customer + //$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->commande->creer, 'string', '', 0, 1); + //$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->commande->creer, 'string', '', null, null, '', 1); + // Thirdparty + $morehtmlref.=$langs->trans('ThirdParty') . ' : ' . $soc->getNomUrl(1); + // Project + if (! empty($conf->projet->enabled)) + { + $langs->load("projects"); + $morehtmlref.='
'.$langs->trans('Project') . ' '; + if ($user->rights->commande->creer) + { + if ($action != 'classify') + $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.=''; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (! empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref.=''; + $morehtmlref.=$proj->ref; + $morehtmlref.=''; + } else { + $morehtmlref.=''; + } + } + } + $morehtmlref.='
'; + + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + + + print '
'; + print '
'; + print '
'; + + print '
'; + // Ref - print ''; // Third party print ""; - - if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) - { - // Duration - print ''; - print ''; - print ''; - } - + */ + if (! empty($conf->global->FICHINTER_USE_PLANNED_AND_DONE_DATES)) { // Date Start - print ''; - print ''; + print ''; print ''; - + // Date End print ''; - print ''; print ''; - + // Date Terminate/close print ''; - print ''; print ''; } // Description (must be a textarea and not html must be allowed (used in list view) - print ''; print ''; // Project + /* if (! empty($conf->projet->enabled)) { $langs->load('projects'); @@ -1340,7 +1312,7 @@ else if ($id > 0 || ! empty($ref)) } print ''; print ''; - } + }*/ // Contrat if ($conf->contrat->enabled) @@ -1359,18 +1331,11 @@ else if ($id > 0 || ! empty($ref)) print ''; } print '
'.$langs->trans("Ref").''; + /* + print '
'.$langs->trans("Ref").''; print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref'); print '
".$langs->trans("Company").''.$object->thirdparty->getNomUrl(1)."
'.$langs->trans("TotalDuration").''.convertSecondToTime($object->duration, 'all', $conf->global->MAIN_DURATION_OF_WORKDAY).'
'.$langs->trans("Dateo").''; + print '
'.$langs->trans("Dateo").''; print $object->dateo ? dol_print_date($object->dateo, 'daytext') : ' '; print '
'.$langs->trans("Datee").''; + print ''; print $object->datee ? dol_print_date($object->datee, 'daytext') : ' '; print '
'.$langs->trans("Datet").''; + print ''; print $object->datet ? dol_print_date($object->datet, 'daytext') : ' '; print '
'; + print '
'; print $form->editfieldkey("Description",'description',$object->description,$object,$user->rights->ficheinter->creer,'textarea'); - print ''; + print ''; print $form->editfieldval("Description",'description',$object->description,$object,$user->rights->ficheinter->creer,'textarea:8:80'); print '
'; - print ''; + print ''; if ($action == 'contrat') { - print ''; - print ''; - print ''; - print '
'; - $htmlcontract= new Formcontract($db); - //print "$socid,$selected,$htmlname"; - $htmlcontract->select_contract($object->socid,$object->fk_contrat,'contratid'); - - print '
'; + $formcontract= new Formcontract($db); + $formcontract->formSelectContract($_SERVER["PHP_SELF"].'?id='.$object->id, $object->socid, $object->fk_contrat, 'contratid', 0, 1); } else { @@ -1391,13 +1356,37 @@ else if ($id > 0 || ! empty($ref)) } // Statut - print ''.$langs->trans("Status").''.$object->getLibStatut(4).''; + //print ''.$langs->trans("Status").''.$object->getLibStatut(4).''; // Other attributes - $cols = 3; + $cols = 2; include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; + print ''; + + print ''; + print '
'; + print '
'; + print '
'; + + print ''; + + if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) + { + // Duration + print ''; + print ''; + print ''; + } + print "
'.$langs->trans("TotalDuration").''.convertSecondToTime($object->duration, 'all', $conf->global->MAIN_DURATION_OF_WORKDAY).'
"; + + print '
'; + print '
'; + print ''; + + print '

'; + if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) { @@ -1546,7 +1535,7 @@ else if ($id > 0 || ! empty($ref)) print ''; $form->select_date($db->jdate($objp->date_intervention),'di',1,1,0,"date_intervention"); print ''; - + // Duration print ''; if (empty($conf->global->FICHINTER_WITHOUT_DURATION)) { @@ -1730,7 +1719,7 @@ else if ($id > 0 || ! empty($ref)) else print ''; } - if (! empty($conf->global->FICHINTER_CLASSIFY_BILLED)) + if (! empty($conf->global->FICHINTER_CLASSIFY_BILLED)) // Option deprecated. In a future, billed must be managed with a dedicated field to 0 or 1 { if ($object->statut != 2) { @@ -1743,6 +1732,17 @@ else if ($id > 0 || ! empty($ref)) } } + // Done + if (empty($conf->global->FICHINTER_CLASSIFY_BILLED) && $object->statut > 0 && $object->statut < 3) + { + print ''; + } + + // Clone + if ($user->rights->ficheinter->creer) { + print ''; + } + // Delete if (($object->statut == 0 && $user->rights->ficheinter->creer) || $user->rights->ficheinter->supprimer) { @@ -1755,7 +1755,6 @@ else if ($id > 0 || ! empty($ref)) } print ''; - print '
'; if ($action != 'presend') { @@ -1775,15 +1774,13 @@ else if ($id > 0 || ! empty($ref)) $var=true; //print "
\n"; - $somethingshown=$formfile->show_documents('ficheinter',$filename,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf,1,0,0,28,0,'','','',$soc->default_lang); + print $somethingshown=$formfile->showdocuments('ficheinter',$filename,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf,1,0,0,28,0,'','','',$soc->default_lang); - // Linked object block - $somethingshown = $form->showLinkedObjectBlock($object); // Show links to link elements - //$linktoelem = $form->showLinkToObjectBlock($object); - //if ($linktoelem) print '
'.$linktoelem; - + $linktoelem = $form->showLinkToObjectBlock($object, null, array('fichinter')); + $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem); + print '
'; @@ -1847,16 +1844,18 @@ else if ($id > 0 || ! empty($ref)) include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; $formmail = new FormMail($db); $formmail->param['langsmodels']=(empty($newlang)?$langs->defaultlang:$newlang); - $formmail->fromtype = 'user'; - $formmail->fromid = $user->id; - $formmail->fromname = $user->getFullName($langs); - $formmail->frommail = $user->email; + $formmail->fromtype = (GETPOST('fromtype')?GETPOST('fromtype'):(!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE)?$conf->global->MAIN_MAIL_DEFAULT_FROMTYPE:'user')); + + if($formmail->fromtype === 'user'){ + $formmail->fromid = $user->id; + + } $formmail->trackid='int'.$object->id; if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set { include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; $formmail->frommail=dolAddEmailTrackId($formmail->frommail, 'int'.$object->id); - } + } $formmail->withfrom=1; $liste=array(); foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key=>$value) $liste[$key]=$value; diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 66fb1031d6e..f1ae7af5309 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -38,7 +38,8 @@ class Fichinter extends CommonObject public $table_element='fichinter'; public $fk_element='fk_fichinter'; public $table_element_line='fichinterdet'; - + public $picto = 'intervention'; + /** * {@inheritdoc} */ @@ -78,15 +79,15 @@ class Fichinter extends CommonObject $this->statuts[0]='Draft'; $this->statuts[1]='Validated'; $this->statuts[2]='StatusInterInvoiced'; - $this->statuts[3]='Close'; + $this->statuts[3]='Done'; $this->statuts_short[0]='Draft'; $this->statuts_short[1]='Validated'; $this->statuts_short[2]='StatusInterInvoiced'; - $this->statuts_short[3]='Close'; + $this->statuts_short[3]='Done'; $this->statuts_logo[0]='statut0'; $this->statuts_logo[1]='statut1'; $this->statuts_logo[2]='statut6'; - $this->statuts_logo[3]='statut4'; + $this->statuts_logo[3]='statut6'; } /** @@ -220,7 +221,6 @@ class Fichinter extends CommonObject if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used { - $result=$this->insertExtraFields(); if ($result < 0) { @@ -427,7 +427,7 @@ class Fichinter extends CommonObject * Validate a intervention * * @param User $user User that validate - * @param int $notrigger 1=Does not execute triggers, 0= execuete triggers + * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ function setValid($user, $notrigger=0) @@ -553,7 +553,7 @@ class Fichinter extends CommonObject * Returns the label of a statut * * @param int $statut id statut - * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto + * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto * @return string Label */ function LibStatut($statut,$mode=0) @@ -562,22 +562,20 @@ class Fichinter extends CommonObject if ($mode == 0) return $langs->trans($this->statuts[$statut]); - if ($mode == 1) return $langs->trans($this->statuts_short[$statut]); - if ($mode == 2) return img_picto($langs->trans($this->statuts_short[$statut]), $this->statuts_logo[$statut]).' '.$langs->trans($this->statuts_short[$statut]); - if ($mode == 3) return img_picto($langs->trans($this->statuts_short[$statut]), $this->statuts_logo[$statut]); - if ($mode == 4) return img_picto($langs->trans($this->statuts_short[$statut]),$this->statuts_logo[$statut]).' '.$langs->trans($this->statuts[$statut]); - if ($mode == 5) - return ''.$langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),$this->statuts_logo[$statut]); - + return ''.$langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]),$this->statuts_logo[$statut]); + if ($mode == 6) + return ''.$langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]),$this->statuts_logo[$statut]); + + return ''; } /** @@ -926,6 +924,102 @@ class Fichinter extends CommonObject return -2; } + + + /** + * Load an object from its id and create a new one in database + * + * @param int $socid Id of thirdparty + * @return int New id of clone + */ + function createFromClone($socid=0) + { + global $user,$hookmanager; + + $error=0; + + $this->context['createfromclone'] = 'createfromclone'; + + $this->db->begin(); + + // get extrafields so they will be clone + foreach($this->lines as $line) + $line->fetch_optionals($line->rowid); + + // Load source object + $objFrom = clone $this; + + // Change socid if needed + if (! empty($socid) && $socid != $this->socid) + { + $objsoc = new Societe($this->db); + + if ($objsoc->fetch($socid)>0) + { + $this->socid = $objsoc->id; + //$this->cond_reglement_id = (! empty($objsoc->cond_reglement_id) ? $objsoc->cond_reglement_id : 0); + //$this->mode_reglement_id = (! empty($objsoc->mode_reglement_id) ? $objsoc->mode_reglement_id : 0); + $this->fk_project = ''; + $this->fk_delivery_address = ''; + } + + // TODO Change product price if multi-prices + } + + $this->id=0; + $this->ref = ''; + $this->statut=0; + + // Clear fields + $this->user_author_id = $user->id; + $this->user_valid = ''; + $this->date_creation = ''; + $this->date_validation = ''; + $this->ref_client = ''; + + // Create clone + $result=$this->create($user); + if ($result < 0) $error++; + + if (! $error) + { + // Add lines because it is not included into create function + foreach ($this->lines as $line) + { + $this->addline($user, $this->id, $line->desc, $line->datei, $line->duration); + } + + // Hook of thirdparty module + if (is_object($hookmanager)) + { + $parameters=array('objFrom'=>$objFrom); + $action=''; + $reshook=$hookmanager->executeHooks('createFrom',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks + if ($reshook < 0) $error++; + } + + // Call trigger + $result=$this->call_trigger('INTERVENTION_CLONE',$user); + if ($result < 0) $error++; + // End call triggers + } + + unset($this->context['createfromclone']); + + // End + if (! $error) + { + $this->db->commit(); + return $this->id; + } + else + { + $this->db->rollback(); + return -1; + } + } + + /** * Adding a line of intervention into data base * @@ -1036,9 +1130,11 @@ class Fichinter extends CommonObject $line = new FichinterLigne($this->db); $line->id = $objp->rowid; $line->desc = $objp->description; + $line->duration = $objp->duree; //For invoicing we calculing hours $line->qty = round($objp->duree/3600,2); $line->date = $this->db->jdate($objp->date); + $line->datei = $this->db->jdate($objp->date); $line->rang = $objp->rang; $line->product_type = 1; diff --git a/htdocs/fichinter/contact.php b/htdocs/fichinter/contact.php index b64a16f91ba..473445049f7 100644 --- a/htdocs/fichinter/contact.php +++ b/htdocs/fichinter/contact.php @@ -128,7 +128,7 @@ if ($id > 0 || ! empty($ref)) $linkback = ''.$langs->trans("BackToList").''; // Ref - print ''.$langs->trans("Ref").''; + print ''.$langs->trans("Ref").''; print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref'); print ""; diff --git a/htdocs/fichinter/document.php b/htdocs/fichinter/document.php index aca31d4e7c2..a0bc97a17af 100644 --- a/htdocs/fichinter/document.php +++ b/htdocs/fichinter/document.php @@ -106,7 +106,7 @@ if ($object->id) $linkback = ''.$langs->trans("BackToList").''; // Ref - print ''.$langs->trans("Ref").''; + print ''.$langs->trans("Ref").''; print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref'); print ''; @@ -121,6 +121,7 @@ if ($object->id) $modulepart = 'ficheinter'; $permission = $user->rights->ficheinter->creer; + $permtoedit = $user->rights->ficheinter->creer; $param = '&id=' . $object->id; include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php'; diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index 81121f3b4bf..e350250a638 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -4,7 +4,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2011-2012 Juanjo Menent * Copyright (C) 2013 Cédric Salvador - * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2015 Jean-François Ferry * * 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 @@ -27,6 +27,7 @@ */ require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; @@ -64,13 +65,13 @@ $search_status=GETPOST('search_status'); $sall=GETPOST('sall'); $optioncss = GETPOST('optioncss','alpha'); -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_company=""; - $search_desc=""; - $search_status=""; -} +// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +$hookmanager->initHooks(array('interventionlist')); +$extrafields = new ExtraFields($db); + +// fetch optionals attributes and labels +$extralabels = $extrafields->fetch_name_optionals_label('fichinter'); +$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_'); // List of fields to search into when doing a "search in all" $fieldstosearchall = array( @@ -82,25 +83,79 @@ $fieldstosearchall = array( if (empty($user->socid)) $fieldstosearchall["f.note_private"]="NotePrivate"; if (! empty($conf->global->FICHINTER_DISABLE_DETAILS)) unset($fieldstosearchall['f.description']); +// Definition of fields for list +$arrayfields=array( + 'f.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1), + 's.nom'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1), + 'f.fk_project'=>array('label'=>$langs->trans("Project"), 'checked'=>1), + 'f.fk_contrat'=>array('label'=>$langs->trans("Contract"), 'checked'=>1), + 'f.description'=>array('label'=>$langs->trans("Description"), 'checked'=>1), + 'fd.description'=>array('label'=>"xx", 'checked'=>1, 'enabled'=>empty($conf->global->FICHINTER_DISABLE_DETAILS)?1:0), + 'fd.date'=>array('label'=>$langs->trans("Date"), 'checked'=>1, 'enabled'=>empty($conf->global->FICHINTER_DISABLE_DETAILS)?1:0), + 'fd.duree'=>array('label'=>$langs->trans("Duration"), 'checked'=>1, 'enabled'=>empty($conf->global->FICHINTER_DISABLE_DETAILS)?1:0), + 'f.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), + 'f.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500), + 'f.fk_statut'=>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]); + } +} + + +/* + * Acions + */ + +$parameters=array(); +$reshook=$hookmanager->executeHooks('doActions',$parameters); // 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 (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers +{ + $search_ref=""; + $search_company=""; + $search_project=""; + $search_contract=""; + $search_desc=""; + $search_status=""; + $search_array_options=array(); +} + + /* * View */ $form = new Form($db); -$interventionstatic=new Fichinter($db); +$formfile = new FormFile($db); +$objectstatic=new Fichinter($db); llxHeader('', $langs->trans("Intervention")); $sql = "SELECT"; -$sql.= " f.ref, f.rowid as fichid, f.fk_statut, f.description,"; +$sql.= " f.ref, f.rowid, f.fk_statut, f.description, f.datec as date_creation, f.tms as date_update, f.note_private,"; if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) $sql.= " fd.description as descriptiondetail, fd.date as dp, fd.duree,"; $sql.= " s.nom as name, s.rowid as socid, s.client"; -$sql.= " FROM (".MAIN_DB_PREFIX."societe as s"; -if (! $user->rights->societe->client->voir && empty($socid)) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; -$sql.= ", ".MAIN_DB_PREFIX."fichinter as f)"; +// 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."fichinter as f"; +if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."fichinter_extrafields as ef on (f.rowid = ef.fk_object)"; if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."fichinterdet as fd ON fd.fk_fichinter = f.rowid"; +if (! $user->rights->societe->client->voir && empty($socid)) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; +$sql.= ", ".MAIN_DB_PREFIX."societe as s"; $sql.= " WHERE f.fk_soc = s.rowid "; $sql.= " AND f.entity = ".$conf->entity; if ($search_ref) { @@ -123,6 +178,23 @@ if ($socid) if ($sall) { $sql .= natural_search(array_keys($fieldstosearchall), $sall); } +// 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.= $db->order($sortfield,$sortorder); $totalnboflines=0; @@ -143,13 +215,21 @@ if ($result) $param=''; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; + if ($sall) $urlparam.="&sall=".$sall; if ($socid) $param.="&socid=".$socid; if ($search_ref) $param.="&search_ref=".urlencode($search_ref); if ($search_company) $param.="&search_company=".urlencode($search_company); if ($search_desc) $param.="&search_desc=".urlencode($search_desc); if ($search_status != '' && $search_status > -1) $param.="&search_status=".urlencode($search_status); 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); + } + print '
'."\n"; if ($optioncss != '') print ''; print ''; @@ -165,42 +245,121 @@ if ($result) foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); } - - print ''; + $moreforfilter=''; + + $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; + $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields + + print '
'; print ''; - print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"f.ref","",$param,'width="15%"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom","",$param,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Description"),$_SERVER["PHP_SELF"],"f.description","",$param,'',$sortfield,$sortorder); - if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) + if (! empty($arrayfields['f.ref']['checked'])) print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"f.ref","",$param,'width="15%"',$sortfield,$sortorder); + if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom","",$param,'',$sortfield,$sortorder); + if (! empty($arrayfields['f.description']['checked'])) print_liste_field_titre($langs->trans("Description"),$_SERVER["PHP_SELF"],"f.description","",$param,'',$sortfield,$sortorder); + if (! empty($arrayfields['fd.description']['checked'])) print_liste_field_titre('',$_SERVER["PHP_SELF"],''); + if (! empty($arrayfields['fd.date']['checked'])) print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"fd.date","",$param,'align="center"',$sortfield,$sortorder); + if (! empty($arrayfields['fd.duree']['checked'])) print_liste_field_titre($langs->trans("Duration"),$_SERVER["PHP_SELF"],"fd.duree","",$param,'align="right"',$sortfield,$sortorder); + // Extra fields + if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { - print_liste_field_titre('',$_SERVER["PHP_SELF"],''); - print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"fd.date","",$param,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Duration"),$_SERVER["PHP_SELF"],"fd.duree","",$param,'align="right"',$sortfield,$sortorder); + 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); + } + } } - print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"f.fk_statut","",$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch '); + // 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['f.datec']['checked'])) print_liste_field_titre($langs->trans("DateCreationShort"),$_SERVER["PHP_SELF"],"f.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); + if (! empty($arrayfields['f.tms']['checked'])) print_liste_field_titre($langs->trans("DateModificationShort"),$_SERVER["PHP_SELF"],"f.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); + if (! empty($arrayfields['f.fk_statut']['checked'])) print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"f.fk_statut","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch '); print "\n"; print ''; - print ''; - if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) - { - // Desc of line - print ''; - print ''; + if (! empty($arrayfields['f.ref']['checked'])) + { + print ''; + } + if (! empty($arrayfields['s.nom']['checked'])) + { + print ''; + } + if (! empty($arrayfields['f.description']['checked'])) + { + print ''; + } + if (! empty($arrayfields['fd.description']['checked'])) + { + // Desc of line print ''; + } + if (! empty($arrayfields['fd.date']['checked'])) + { + print ''; + } + if (! empty($arrayfields['fd.duree']['checked'])) + { + print ''; } - print ''; + // 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 ''; + } + } + } + // 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; + if (! empty($arrayfields['f.datec']['checked'])) + { + // Date creation + print ''; + } + if (! empty($arrayfields['f.tms']['checked'])) + { + // Date modification + print ''; + } + if (! empty($arrayfields['f.fk_statut']['checked'])) + { + print ''; + } print '"; - print "\n"; - print ''; - print ''; - if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) + if (! empty($arrayfields['f.ref']['checked'])) { - //print ''; - print ''; - print '\n"; - print ''; + print "\n"; + if (! $i) $totalarray['nbfield']++; + } + if (! empty($arrayfields['s.nom']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + if (! empty($arrayfields['f.description']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + if (! empty($arrayfields['fd.description']['checked'])) + { + //print ''; + print ''; + if (! $i) $totalarray['nbfield']++; + } + if (! empty($arrayfields['fd.date']['checked'])) + { + print '\n"; + if (! $i) $totalarray['nbfield']++; + } + if (! empty($arrayfields['fd.duree']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + if (! $i) $totalarray['totaldurationfield']=$totalarray['nbfield']; + $totalarray['totalduration']+=$obj->duree; } - print ''; - print ''; + // 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 'getAlignFlag($key); + if ($align) print ' align="'.$align.'"'; + print '>'; + $tmpkey='options_'.$key; + print $extrafields->showOutputField($key, $obj->$tmpkey, '', 1); + print ''; + 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['f.datec']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Date modification + if (! empty($arrayfields['f.tms']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Status + if (! empty($arrayfields['f.fk_statut']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Action column + print ''; + if (! $i) $totalarray['nbfield']++; + print "\n"; - $total += $objp->duree; + $total += $obj->duree; $i++; } - $rowspan=3; - if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) + + // Show total line + if (isset($totalarray['totalduration'])) { - print ''; - print ''; - print ''; + print ''; + $i=0; + while ($i < $totalarray['nbfield']) + { + $i++; + if ($i == 1) + { + if ($num < $limit) print ''; + else print ''; + } + elseif ($totalarray['totaldurationfield'] == $i) print ''; + else print ''; + } + print ''; } print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - print '  '; + print ''; + print ''; + print ''; + print ''; + print ''; + print '   '; - $liststatus=$interventionstatic->statuts_short; - print $form->selectarray('search_status', $liststatus, $search_status, 1, 0, 0, '', 1); - print ''; + 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 ''; + } + print ''; + print ''; + print ''; + $liststatus=$objectstatic->statuts_short; + if (empty($conf->global->FICHINTER_CLASSIFY_BILLED)) unset($liststatus[2]); // Option deprecated. In a future, billed must be managed with a dedicated field to 0 or 1 + print $form->selectarray('search_status', $liststatus, $search_status, 1, 0, 0, '', 1); + print ''; $searchpitco=$form->showFilterAndCheckAddButtons(0); print $searchpitco; @@ -212,44 +371,158 @@ if ($result) $var=True; $total = 0; $i = 0; + $totalarray=array(); while ($i < min($num, $limit)) { - $objp = $db->fetch_object($result); + $obj = $db->fetch_object($result); + + $objectstatic->id=$obj->rowid; + $objectstatic->ref=$obj->ref; + $objectstatic->statut=$obj->fk_statut; + $var=!$var; print "
"; - $interventionstatic->id=$objp->fichid; - $interventionstatic->ref=$objp->ref; - print $interventionstatic->getNomUrl(1); - print "'; - $companystatic->name=$objp->name; - $companystatic->id=$objp->socid; - $companystatic->client=$objp->client; - print $companystatic->getNomUrl(1,'',44); - print ''.dol_trunc(dolGetFirstLineOfText($objp->description),48).''.dol_trunc(dol_escape_htmltag(dolGetFirstLineOfText($objp->descriptiondetail)),48).''.dolGetFirstLineOfText($objp->descriptiondetail).''.dol_print_date($db->jdate($objp->dp),'dayhour')."'.convertSecondToTime($objp->duree).'"; + + print ''; + // Picto + Ref + print ''; + // Warning + $warnornote=''; + //if ($obj->fk_statut == 1 && $db->jdate($obj->dfv) < ($now - $conf->fichinter->warning_delay)) $warnornote.=img_warning($langs->trans("Late")); + if (! empty($obj->note_private)) + { + $warnornote.=($warnornote?' ':''); + $warnornote.= ''; + $warnornote.= ''.img_picto($langs->trans("ViewPrivateNote"),'object_generic').''; + $warnornote.= ''; + } + if ($warnornote) + { + print ''; + } + // Other picto tool + print '
'; + print $objectstatic->getNomUrl(1); + print ''; + print $warnornote; + print ''; + $filename=dol_sanitizeFileName($obj->ref); + $filedir=$conf->fichinter->dir_output . '/' . dol_sanitizeFileName($obj->ref); + $urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid; + print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir); + print '
'; + + print "
'; + $companystatic->name=$obj->name; + $companystatic->id=$obj->socid; + $companystatic->client=$obj->client; + print $companystatic->getNomUrl(1,'',44); + print ''.dol_trunc(dolGetFirstLineOfText($obj->description),48).''.dol_trunc(dol_escape_htmltag(dolGetFirstLineOfText($obj->descriptiondetail)),48).''.dolGetFirstLineOfText($obj->descriptiondetail).''.dol_print_date($db->jdate($obj->dp),'dayhour')."'.convertSecondToTime($obj->duree, 'allhourmin').''.$interventionstatic->LibStatut($objp->fk_statut,5).' '; + print dol_print_date($db->jdate($obj->date_creation), 'dayhour'); + print ''; + print dol_print_date($db->jdate($obj->date_update), 'dayhour'); + print ''.$objectstatic->LibStatut($obj->fk_statut,5).'
'.$langs->trans("Total").''.convertSecondToTime($total).'  
'.$langs->trans("Total").''.$langs->trans("Totalforthispage").''.convertSecondToTime($totalarray['totalduration'], 'allhourmin').'
'; @@ -264,4 +537,4 @@ else llxFooter(); -$db->close(); \ No newline at end of file +$db->close(); diff --git a/htdocs/fichinter/note.php b/htdocs/fichinter/note.php index 3c5fce7caa2..c672d48cb71 100644 --- a/htdocs/fichinter/note.php +++ b/htdocs/fichinter/note.php @@ -54,7 +54,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, * View */ -llxHeader(); +llxHeader('',$langs->trans("Intervention")); $form = new Form($db); @@ -70,12 +70,12 @@ if ($id > 0 || ! empty($ref)) $linkback = ''.$langs->trans("BackToList").''; - print ''.$langs->trans('Ref').''; + print ''.$langs->trans('Ref').''; print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref'); print ''; // Company - print ''.$langs->trans('Company').''.$societe->getNomUrl(1).''; + print ''.$langs->trans('Company').''.$societe->getNomUrl(1).''; print ""; diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index 92a41209ba4..e7f407acfd2 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -31,7 +31,7 @@ */ if (! defined('DOL_APPLICATION_TITLE')) define('DOL_APPLICATION_TITLE','Dolibarr'); -if (! defined('DOL_VERSION')) define('DOL_VERSION','4.0.0-beta'); +if (! defined('DOL_VERSION')) define('DOL_VERSION','5.0.0-alpha'); if (! defined('EURO')) define('EURO',chr(128)); @@ -87,19 +87,37 @@ $result=@include_once $conffile; // Keep @ because with some error reporting thi if (! $result && ! empty($_SERVER["GATEWAY_INTERFACE"])) // If install not done and we are in a web session { - // Note: If calling page was not into htdocs (index.php, ...), then this redirect will fails. - // There is no real solution, because the only way to know the apache url relative path is to have into conf file. - $TDir = explode('/', $_SERVER['PHP_SELF']); - $path = ''; - $i = count($TDir); - while ($i--) - { - if (empty($TDir[$i]) || $TDir[$i] == 'htdocs') break; - if (substr($TDir[$i], -4, 4) == '.php') continue; - - $path .= '../'; - } - + if (! empty($_SERVER["CONTEXT_PREFIX"])) // CONTEXT_PREFIX and CONTEXT_DOCUMENT_ROOT are not defined on all apache versions + { + $path=$_SERVER["CONTEXT_PREFIX"]; // example '/dolibarr/' when using an apache alias. + if (! preg_match('/\/$/', $path)) $path.='/'; + } + else if (preg_match('/index\.php/', $_SERVER['PHP_SELF'])) + { + // When we ask index.php, we MUST BE SURE that $path is '' at the end. This is required to make install process + // when using apache alias like '/dolibarr/' that point to htdocs. + // Note: If calling page was an index.php not into htdocs (ie comm/index.php, ...), then this redirect will fails, + // but we don't want to change this because when URL is correct, we must be sure the redirect to install/index.php will be correct. + $path=''; + } + else + { + // If what we look is not index.php, we can try to guess location of root. May not work all the time. + // There is no real solution, because the only way to know the apache url relative path is to have it into conf file. + // If it fails to find correct $path, then only solution is to ask user to enter the correct URL to index.php or install/index.php + $TDir = explode('/', $_SERVER['PHP_SELF']); + $path = ''; + $i = count($TDir); + while ($i--) + { + if (empty($TDir[$i]) || $TDir[$i] == 'htdocs') break; + if ($TDir[$i] == 'dolibarr') break; + if (substr($TDir[$i], -4, 4) == '.php') continue; + + $path .= '../'; + } + } + header("Location: ".$path."install/index.php"); exit; } @@ -125,10 +143,13 @@ $dolibarr_main_document_root=trim($dolibarr_main_document_root); $dolibarr_main_document_root_alt=(empty($dolibarr_main_document_root_alt)?'':trim($dolibarr_main_document_root_alt)); if (empty($dolibarr_main_db_port)) $dolibarr_main_db_port=0; // Pour compatibilite avec anciennes configs, si non defini, on prend 'mysql' -if (empty($dolibarr_main_db_type)) $dolibarr_main_db_type='mysql'; // Pour compatibilite avec anciennes configs, si non defini, on prend 'mysql' +if (empty($dolibarr_main_db_type)) $dolibarr_main_db_type='mysqli'; // Pour compatibilite avec anciennes configs, si non defini, on prend 'mysql' + +// Mysql driver support has been removed in favor of mysqli +if ($dolibarr_main_db_type == 'mysql') $dolibarr_main_db_type = 'mysqli'; if (empty($dolibarr_main_db_prefix)) $dolibarr_main_db_prefix='llx_'; -if (empty($dolibarr_main_db_character_set)) $dolibarr_main_db_character_set=($dolibarr_main_db_type=='mysql'?'utf8':''); // Old installation -if (empty($dolibarr_main_db_collation)) $dolibarr_main_db_collation=($dolibarr_main_db_type=='mysql'?'utf8_general_ci':''); // Old installation +if (empty($dolibarr_main_db_character_set)) $dolibarr_main_db_character_set=($dolibarr_main_db_type=='mysqli'?'utf8':''); // Old installation +if (empty($dolibarr_main_db_collation)) $dolibarr_main_db_collation=($dolibarr_main_db_type=='mysqli'?'utf8_general_ci':''); // Old installation if (empty($dolibarr_main_db_encryption)) $dolibarr_main_db_encryption=0; if (empty($dolibarr_main_db_cryptkey)) $dolibarr_main_db_cryptkey=''; if (empty($dolibarr_main_limit_users)) $dolibarr_main_limit_users=0; @@ -141,9 +162,12 @@ if (empty($multicompany_force_entity)) $multicompany_force_entity=0; // To force // Security: CSRF protection // This test check if referrer ($_SERVER['HTTP_REFERER']) is same web site than Dolibarr ($_SERVER['HTTP_HOST']) // when we post forms (we allow GET to allow direct link to access a particular page). -if (! defined('NOCSRFCHECK') && empty($dolibarr_nocsrfcheck) && ! empty($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] != 'GET' && ! empty($_SERVER['HTTP_HOST']) && ! empty($_SERVER['HTTP_REFERER']) && ! preg_match('/'.preg_quote($_SERVER['HTTP_HOST'],'/').'/i', $_SERVER['HTTP_REFERER'])) +// Note about $_SERVER[HTTP_HOST/SERVER_NAME]: http://shiflett.org/blog/2006/mar/server-name-versus-http-host +if (! defined('NOCSRFCHECK') && empty($dolibarr_nocsrfcheck) + && ! empty($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] != 'GET' && ! empty($_SERVER['HTTP_HOST']) + && (empty($_SERVER['HTTP_REFERER']) || ! preg_match('/'.preg_quote($_SERVER['HTTP_HOST'],'/').'/i', $_SERVER['HTTP_REFERER']))) { - //print 'HTTP_POST='.$_SERVER['HTTP_HOST'].' HTTP_REFERER='.$_SERVER['HTTP_REFERER']; + //print 'NOCSRFCHECK='.defined('NOCSRFCHECK').' REQUEST_METHOD='.$_SERVER['REQUEST_METHOD'].' HTTP_POST='.$_SERVER['HTTP_HOST'].' HTTP_REFERER='.$_SERVER['HTTP_REFERER']; print "Access refused by CSRF protection in main.inc.php.\n"; print "If you access your server behind a proxy using url rewriting, you might add the line \$dolibarr_nocsrfcheck=1 into your conf.php file.\n"; die; @@ -160,7 +184,6 @@ if (empty($dolibarr_main_url_root)) print 'You must add this parameter with your full Dolibarr root Url (Example: http://myvirtualdomain/ or http://mydomain/mydolibarrurl/)'."\n"; die; } -if (empty($dolibarr_main_db_type)) $dolibarr_main_db_type='mysql'; // Pour compatibilite avec anciennes configs, si non defini, on prend 'mysql' if (empty($dolibarr_main_data_root)) { // Si repertoire documents non defini, on utilise celui par defaut diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php index 8729834ec3e..5faf915f329 100644 --- a/htdocs/fourn/card.php +++ b/htdocs/fourn/card.php @@ -1,7 +1,7 @@ * Copyright (C) 2003 Eric Seigne - * Copyright (C) 2004-2014 Laurent Destailleur + * Copyright (C) 2004-2016 Laurent Destailleur * Copyright (C) 2005-2010 Regis Houssin * Copyright (C) 2010-2015 Juanjo Menent * Copyright (C) 2014 Jean Heimburger @@ -120,8 +120,8 @@ if ($id > 0 && empty($object->id)) if ($object->id > 0) { - $title=$langs->trans("ThirdParty")." - ".$langs->trans('SupplierCard'); - if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name." - ".$langs->trans('SupplierCard'); + $title=$langs->trans("ThirdParty")." - ".$langs->trans('Supplier'); + if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name." - ".$langs->trans('Supplier'); $help_url=''; llxHeader('',$title, $help_url); @@ -132,7 +132,9 @@ if ($object->id > 0) dol_fiche_head($head, 'supplier', $langs->trans("ThirdParty"),0,'company'); - dol_banner_tab($object, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom'); + $linkback = ''.$langs->trans("BackToList").''; + + dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom'); print '
'; @@ -147,7 +149,7 @@ if ($object->id > 0) if ($object->fournisseur) { print ''; - print ''.$langs->trans("SupplierCode"). ''; + print ''.$langs->trans("SupplierCode"). ''; print $object->code_fournisseur; if ($object->check_codefournisseur() <> 0) print ' ('.$langs->trans("WrongSupplierCode").')'; print ''; @@ -157,7 +159,7 @@ if ($object->id > 0) print ''; print ''; print $form->editfieldkey("SupplierAccountancyCode",'supplieraccountancycode',$object->code_compta_fournisseur,$object,$user->rights->societe->creer); - print ''; + print ''; print $form->editfieldval("SupplierAccountancyCode",'supplieraccountancycode',$object->code_compta_fournisseur,$object,$user->rights->societe->creer); print ''; print ''; @@ -165,7 +167,7 @@ if ($object->id > 0) // Assujetti a TVA ou pas print ''; - print ''.$langs->trans('VATIsUsed').''; + print ''.$langs->trans('VATIsUsed').''; print yn($object->tva_assuj); print ''; print ''; @@ -173,19 +175,19 @@ if ($object->id > 0) // Local Taxes if ($mysoc->useLocalTax(1)) { - print ''.$langs->transcountry("LocalTax1IsUsed", $mysoc->country_code).''; + print ''.$langs->transcountry("LocalTax1IsUsed", $mysoc->country_code).''; print yn($object->localtax1_assuj); print ''; } if ($mysoc->useLocalTax(2)) { - print ''.$langs->transcountry("LocalTax2IsUsed", $mysoc->country_code).''; + print ''.$langs->transcountry("LocalTax2IsUsed", $mysoc->country_code).''; print yn($object->localtax2_assuj); print ''; } // TVA Intra - print ''.$langs->trans('VATIntra').''; + print ''.$langs->trans('VATIntra').''; print $object->tva_intra; print ''; @@ -198,7 +200,7 @@ if ($object->id > 0) print ''; if (($action != 'editconditions') && $user->rights->societe->creer) print 'id.'">'.img_edit($langs->trans('SetConditions'),1).''; print ''; - print ''; + print ''; if ($action == 'editconditions') { $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->cond_reglement_supplier_id,'cond_reglement_supplier_id',-1,1); @@ -217,7 +219,7 @@ if ($object->id > 0) print ''; if (($action != 'editmode') && $user->rights->societe->creer) print 'id.'">'.img_edit($langs->trans('SetMode'),1).''; print ''; - print ''; + print ''; if ($action == 'editmode') { $form->form_modes_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->mode_reglement_supplier_id,'mode_reglement_supplier_id'); @@ -234,7 +236,7 @@ if ($object->id > 0) { $langs->load("categories"); print '' . $langs->trans("SuppliersCategoriesShort") . ''; - print ''; + print ''; print $form->showCategories($object->id, 'supplier', 1); print ""; } @@ -253,8 +255,8 @@ if ($object->id > 0) { $langs->load("members"); $langs->load("users"); - print ''.$langs->trans("LinkedToDolibarrMember").''; - print ''; + print ''.$langs->trans("LinkedToDolibarrMember").''; + print ''; $adh=new Adherent($db); $result=$adh->fetch('','',$object->id); if ($result > 0) @@ -278,13 +280,13 @@ if ($object->id > 0) $var=true; - $MAXLIST=5; + $MAXLIST=$conf->global->MAIN_SIZE_SHORTLIST_LIMIT; // Lien recap print ''; print ''; print ''; + print '
'; - print '
'.$langs->trans("Summary").''.$langs->trans("ShowSupplierPreview").'
'.$langs->trans("ShowSupplierPreview").'
'; print ''; print ''; print '
'; @@ -298,22 +300,23 @@ if ($object->id > 0) $langs->load("products"); print ''; print ''; - print ''; //Query from product/liste.php - $sql = 'SELECT p.rowid, p.ref, p.label, pfp.tms,'; - $sql.= ' p.fk_product_type, p.entity'; + $sql = 'SELECT p.rowid, p.ref, p.label, p.fk_product_type, p.entity,'; + $sql.= ' pfp.tms, pfp.ref_fourn as supplier_ref, pfp.price, pfp.quantity, pfp.unitprice'; $sql.= ' FROM '.MAIN_DB_PREFIX.'product_fournisseur_price as pfp'; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = pfp.fk_product"; $sql.= ' WHERE p.entity IN ('.getEntity('product', 1).')'; $sql.= ' AND pfp.fk_soc = '.$object->id; $sql .= $db->order('pfp.tms', 'desc'); $sql.= $db->plimit($MAXLIST); - + $query = $db->query($sql); - + if (! $query) dol_print_error($db); + $return = array(); if ($db->num_rows($query)) { @@ -334,10 +337,25 @@ if ($object->id > 0) print ''; - print ''; + print ''; - print ''; + //print ''; + print ''; print ''; } } @@ -373,7 +391,7 @@ if ($object->id > 0) print ''; print ''; @@ -448,6 +466,17 @@ if ($object->id > 0) } // TODO move to DAO class + $sql = "SELECT count(p.rowid) as total"; + $sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as p "; + $sql.= " WHERE p.fk_soc =".$object->id; + $sql.= " AND p.entity =".$conf->entity; + $resql=$db->query($sql); + if ($resql) + { + $object_count = $db->fetch_object($resql); + $num = $object_count->total; + } + $sql = "SELECT p.rowid,p.ref, p.date_commande as dc, p.fk_statut, p.total_ht, p.tva as total_tva, p.total_ttc"; $sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as p "; $sql.= " WHERE p.fk_soc =".$object->id; @@ -458,7 +487,6 @@ if ($object->id > 0) if ($resql) { $i = 0 ; - $num = $db->num_rows($resql); if ($num > 0) { @@ -467,14 +495,14 @@ if ($object->id > 0) print ''; print ''; } $var = True; - while ($i < $num && $i <= $MAXLIST) + while ($i < $num && $i < $MAXLIST) { $obj = $db->fetch_object($resql); $var=!$var; @@ -541,7 +569,7 @@ if ($object->id > 0) print ''; print ''; diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 8143871918d..da4910a1db0 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -44,95 +44,97 @@ class CommandeFournisseur extends CommonOrder public $table_element_line = 'commande_fournisseurdet'; public $fk_element = 'fk_commande'; protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe - + public $picto='order'; + /** * {@inheritdoc} */ protected $table_ref_field = 'ref'; - var $id; + public $id; /** * Supplier order reference * @var string */ - var $ref; - var $ref_supplier; - var $brouillon; - var $statut; // 0=Draft -> 1=Validated -> 2=Approved -> 3=Process runing -> 4=Received partially -> 5=Received totally -> (reopen) 4=Received partially + public $ref; + public $ref_supplier; + public $brouillon; + public $statut; // 0=Draft -> 1=Validated -> 2=Approved -> 3=Process runing -> 4=Received partially -> 5=Received totally -> (reopen) 4=Received partially // -> 7=Canceled/Never received -> (reopen) 3=Process runing // -> 6=Canceled -> (reopen) 2=Approved // -> 9=Refused -> (reopen) 1=Validated // Note: billed or not is on another field "billed" - var $statuts; // List of status - - var $socid; - var $fourn_id; - var $date; - var $date_valid; - var $date_approve; - var $date_approve2; // Used when SUPPLIER_ORDER_DOUBLE_APPROVAL is set - var $date_commande; + public $statuts; // List of status + + public $socid; + public $fourn_id; + public $date; + public $date_valid; + public $date_approve; + public $date_approve2; // Used when SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED is set + public $date_commande; /** * Delivery date */ - var $date_livraison; - var $total_ht; - var $total_tva; - var $total_localtax1; // Total Local tax 1 - var $total_localtax2; // Total Local tax 2 - var $total_ttc; - var $source; + public $date_livraison; + public $total_ht; + public $total_tva; + public $total_localtax1; // Total Local tax 1 + public $total_localtax2; // Total Local tax 2 + public $total_ttc; + public $source; /** * @deprecated * @see note_private, note_public */ - var $note; + public $note; public $note_private; public $note_public; - var $model_pdf; - var $fk_project; - var $cond_reglement_id; - var $cond_reglement_code; - var $fk_account; - var $mode_reglement_id; - var $mode_reglement_code; - var $user_author_id; - var $user_valid_id; - var $user_approve_id; - var $user_approve_id2; // Used when SUPPLIER_ORDER_DOUBLE_APPROVAL is set + public $model_pdf; + public $fk_project; + public $cond_reglement_id; + public $cond_reglement_code; + public $fk_account; + public $mode_reglement_id; + public $mode_reglement_code; + public $user_author_id; + public $user_valid_id; + public $user_approve_id; + public $user_approve_id2; // Used when SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED is set //Incoterms - var $fk_incoterms; - var $location_incoterms; - var $libelle_incoterms; //Used into tooltip + public $fk_incoterms; + public $location_incoterms; + public $libelle_incoterms; //Used into tooltip - var $extraparams=array(); + public $extraparams=array(); /** * @var CommandeFournisseurLigne[] */ public $lines = array(); //Add for supplier_proposal - var $origin; - var $origin_id; - var $linked_objects=array(); + public $origin; + public $origin_id; + public $linked_objects=array(); // Multicurrency - var $fk_multicurrency; - var $multicurrency_code; - var $multicurrency_tx; - var $multicurrency_total_ht; - var $multicurrency_total_tva; - var $multicurrency_total_ttc; - + public $fk_multicurrency; + public $multicurrency_code; + public $multicurrency_tx; + public $multicurrency_total_ht; + public $multicurrency_total_tva; + public $multicurrency_total_ttc; + + /** * Constructor * * @param DoliDB $db Database handler */ - function __construct($db) + public function __construct($db) { global $conf; @@ -161,7 +163,7 @@ class CommandeFournisseur extends CommonOrder * @param string $ref Ref of object * @return int >0 if OK, <0 if KO, 0 if not found */ - function fetch($id,$ref='') + public function fetch($id,$ref='') { global $conf; @@ -255,7 +257,7 @@ class CommandeFournisseur extends CommonOrder $this->multicurrency_total_ht = $obj->multicurrency_total_ht; $this->multicurrency_total_tva = $obj->multicurrency_total_tva; $this->multicurrency_total_ttc = $obj->multicurrency_total_ttc; - + $this->extraparams = (array) json_decode($obj->extraparams, true); $this->db->free($resql); @@ -271,6 +273,8 @@ class CommandeFournisseur extends CommonOrder $this->fetchObjectLinked(); + $this->lines=array(); + $sql = "SELECT l.rowid, l.ref as ref_supplier, l.fk_product, l.product_type, l.label, l.description,"; $sql.= " l.qty,"; $sql.= " l.tva_tx, l.remise_percent, l.subprice,"; @@ -330,7 +334,7 @@ class CommandeFournisseur extends CommonOrder $line->date_start = $this->db->jdate($objp->date_start); $line->date_end = $this->db->jdate($objp->date_end); $line->fk_unit = $objp->fk_unit; - + // Multicurrency $line->fk_multicurrency = $objp->fk_multicurrency; $line->multicurrency_code = $objp->multicurrency_code; @@ -338,8 +342,8 @@ class CommandeFournisseur extends CommonOrder $line->multicurrency_total_ht = $objp->multicurrency_total_ht; $line->multicurrency_total_tva = $objp->multicurrency_total_tva; $line->multicurrency_total_ttc = $objp->multicurrency_total_ttc; - - $this->special_line = $objp->special_line; + + $this->special_code = $objp->special_code; $this->fk_parent_line = $objp->fk_parent_line; $this->rang = $objp->rang; @@ -370,10 +374,10 @@ class CommandeFournisseur extends CommonOrder * * @param User $user Validator User * @param int $idwarehouse Id of warehouse to use for stock decrease - * @param int $notrigger 1=Does not execute triggers, 0= execuete triggers + * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ - function valid($user,$idwarehouse=0,$notrigger=0) + public function valid($user,$idwarehouse=0,$notrigger=0) { global $langs,$conf; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; @@ -492,7 +496,7 @@ class CommandeFournisseur extends CommonOrder * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto * @return string Label */ - function getLibStatut($mode=0) + public function getLibStatut($mode=0) { return $this->LibStatut($this->statut,$mode,$this->billed); } @@ -513,7 +517,7 @@ class CommandeFournisseur extends CommonOrder $billedtext=''; //if ($statut==5 && $this->billed == 1) $statut = 8; if ($billed == 1) $billedtext=$langs->trans("Billed"); - + // List of language codes for status $statutshort[0] = 'StatusOrderDraftShort'; $statutshort[1] = 'StatusOrderValidatedShort'; @@ -584,7 +588,7 @@ class CommandeFournisseur extends CommonOrder * @param string $option On what the link points * @return string Chain with URL */ - function getNomUrl($withpicto=0,$option='') + public function getNomUrl($withpicto=0,$option='') { global $langs, $conf; @@ -617,10 +621,10 @@ class CommandeFournisseur extends CommonOrder * Returns the following order reference not used depending on the numbering model activated * defined within COMMANDE_SUPPLIER_ADDON_NUMBER * - * @param Societe $soc company object + * @param Company $soc company object * @return string free reference for the invoice */ - function getNextNumRef($soc) + public function getNextNumRef($soc) { global $db, $langs, $conf; $langs->load("orders"); @@ -674,10 +678,11 @@ class CommandeFournisseur extends CommonOrder * @param User $user Object user making the change * @return int <0 if KO, >0 if KO */ - function classifyBilled(User $user) + public function classifyBilled(User $user) { + $error=0; $this->db->begin(); - + $sql = 'UPDATE '.MAIN_DB_PREFIX.'commande_fournisseur SET billed = 1'; $sql .= ' WHERE rowid = '.$this->id.' AND fk_statut > 0 '; if ($this->db->query($sql)) @@ -689,11 +694,11 @@ class CommandeFournisseur extends CommonOrder if ($result < 0) $error++; // End call triggers } - + if (! $error) { $this->billed=1; - + $this->db->commit(); return 1; } @@ -706,7 +711,7 @@ class CommandeFournisseur extends CommonOrder else { dol_print_error($this->db); - + $this->db->rollback(); return -1; } @@ -717,10 +722,10 @@ class CommandeFournisseur extends CommonOrder * * @param User $user Object user * @param int $idwarehouse Id of warhouse for stock change - * @param int $secondlevel 0=Standard approval, 1=Second level approval (used when option SUPPLIER_ORDER_DOUBLE_APPROVAL is set) + * @param int $secondlevel 0=Standard approval, 1=Second level approval (used when option SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED is set) * @return int <0 if KO, >0 if OK */ - function approve($user, $idwarehouse=0, $secondlevel=0) + public function approve($user, $idwarehouse=0, $secondlevel=0) { global $langs,$conf; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; @@ -753,16 +758,16 @@ class CommandeFournisseur extends CommonOrder // Do we have to change status now ? (If double approval is required and first approval, we keep status to 1 = validated) $movetoapprovestatus=true; $comment=''; - + $sql = "UPDATE ".MAIN_DB_PREFIX."commande_fournisseur"; $sql.= " SET ref='".$this->db->escape($num)."',"; if (empty($secondlevel)) // standard or first level approval { $sql.= " date_approve='".$this->db->idate($now)."',"; $sql.= " fk_user_approve = ".$user->id; - if (! empty($conf->global->SUPPLIER_ORDER_DOUBLE_APPROVAL) && $conf->global->MAIN_FEATURES_LEVEL > 0 && $this->total_ht >= $conf->global->SUPPLIER_ORDER_DOUBLE_APPROVAL) + if (! empty($conf->global->SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED) && $conf->global->MAIN_FEATURES_LEVEL > 0 && $this->total_ht >= $conf->global->SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED) { - if (empty($this->user_approve_id2)) + if (empty($this->user_approve_id2)) { $movetoapprovestatus=false; // second level approval not done $comment=' (first level)'; @@ -805,6 +810,7 @@ class CommandeFournisseur extends CommonOrder // Product with reference if ($this->lines[$i]->fk_product > 0) { + $this->line = $this->lines[$i]; $mouvP = new MouvementStock($this->db); $mouvP->origin = &$this; // We decrement stock of product (and sub-products) @@ -812,6 +818,7 @@ class CommandeFournisseur extends CommonOrder if (! empty($this->lines[$i]->remise_percent) && empty($conf->global->STOCK_EXCLUDE_DISCOUNT_FOR_PMP)) $up_ht_disc=price2num($up_ht_disc * (100 - $this->lines[$i]->remise_percent) / 100, 'MU'); $result=$mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $up_ht_disc, $langs->trans("OrderApprovedInDolibarr",$this->ref)); if ($result < 0) { $error++; } + unset($this->line); } } } @@ -827,7 +834,7 @@ class CommandeFournisseur extends CommonOrder if (! $error) { $this->ref = $this->newref; - + if ($movetoapprovestatus) $this->statut = 2; else $this->statut = 1; if (empty($secondlevel)) // standard or first level approval @@ -870,7 +877,7 @@ class CommandeFournisseur extends CommonOrder * @param User $user User making action * @return int 0 if Ok, <0 if Ko */ - function refuse($user) + public function refuse($user) { global $conf, $langs; @@ -988,7 +995,7 @@ class CommandeFournisseur extends CommonOrder * @param string $comment Comment * @return int <0 if KO, >0 if OK */ - function commande($user, $date, $methode, $comment='') + public function commande($user, $date, $methode, $comment='') { global $langs; dol_syslog(get_class($this)."::commande"); @@ -1006,7 +1013,7 @@ class CommandeFournisseur extends CommonOrder $this->statut = 3; $this->methode_commande_id = $methode; $this->date_commande = $this->db->idate($date); - + // Call trigger $result=$this->call_trigger('ORDER_SUPPLIER_SUBMIT',$user); if ($result < 0) $error++; @@ -1018,7 +1025,7 @@ class CommandeFournisseur extends CommonOrder $this->error = $this->db->lasterror(); $this->errors[] = $this->db->lasterror(); } - + if (! $error) { $this->db->commit(); @@ -1046,7 +1053,7 @@ class CommandeFournisseur extends CommonOrder * @param int $notrigger Disable all triggers * @return int <0 if KO, Id of supplier order if OK */ - function create($user, $notrigger=0) + public function create($user, $notrigger=0) { global $langs,$conf,$hookmanager; @@ -1067,7 +1074,7 @@ class CommandeFournisseur extends CommonOrder $this->fk_multicurrency = 0; $this->multicurrency_tx = 1; } - + // We set order into draft status $this->brouillon = 1; @@ -1078,6 +1085,7 @@ class CommandeFournisseur extends CommonOrder $sql.= ", note_public"; $sql.= ", entity"; $sql.= ", fk_soc"; + $sql.= ", fk_projet"; $sql.= ", date_creation"; $sql.= ", date_livraison"; $sql.= ", fk_user_author"; @@ -1099,6 +1107,7 @@ class CommandeFournisseur extends CommonOrder $sql.= ", '".$this->db->escape($this->note_public)."'"; $sql.= ", ".$conf->entity; $sql.= ", ".$this->socid; + $sql.= ", ".($this->fk_project > 0 ? $this->fk_project : "null"); $sql.= ", '".$this->db->idate($now)."'"; $sql.= ", ".($this->date_livraison?"'".$this->db->idate($this->date_livraison)."'":"null"); $sql.= ", ".$user->id; @@ -1139,7 +1148,13 @@ class CommandeFournisseur extends CommonOrder $this->lines[$i]->remise_percent, 'HT', 0, - $this->lines[$i]->info_bits + $this->lines[$i]->product_type, + $this->lines[$i]->info_bits, + false, + $this->lines[$i]->date_start, + $this->lines[$i]->date_end, + 0, + $this->lines[$i]->fk_unit ); if ($result < 0) { @@ -1217,7 +1232,7 @@ class CommandeFournisseur extends CommonOrder * * @return int New id of clone */ - function createFromClone() + public function createFromClone() { global $conf,$user,$langs,$hookmanager; @@ -1289,7 +1304,7 @@ class CommandeFournisseur extends CommonOrder * @param float $txtva Taux tva * @param float $txlocaltax1 Localtax1 tax * @param float $txlocaltax2 Localtax2 tax - * @param int $fk_product Id produit + * @param int $fk_product Id product * @param int $fk_prod_fourn_price Id supplier price * @param string $fourn_ref Supplier reference * @param float $remise_percent Remise @@ -1304,7 +1319,7 @@ class CommandeFournisseur extends CommonOrder * @param string $fk_unit Code of the unit to use. Null to use the default one * @return int <=0 if KO, >0 if OK */ - function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0.0, $txlocaltax2=0.0, $fk_product=0, $fk_prod_fourn_price=0, $fourn_ref='', $remise_percent=0.0, $price_base_type='HT', $pu_ttc=0.0, $type=0, $info_bits=0, $notrigger=false, $date_start=null, $date_end=null, $array_options=0, $fk_unit=null) + public function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0.0, $txlocaltax2=0.0, $fk_product=0, $fk_prod_fourn_price=0, $fourn_ref='', $remise_percent=0.0, $price_base_type='HT', $pu_ttc=0.0, $type=0, $info_bits=0, $notrigger=false, $date_start=null, $date_end=null, $array_options=0, $fk_unit=null) { global $langs,$mysoc,$conf; @@ -1364,7 +1379,7 @@ class CommandeFournisseur extends CommonOrder { $label = $prod->libelle; $pu = $prod->fourn_pu; - $ref = $prod->ref_fourn; + $ref_supplier = $prod->ref_supplier; $product_type = $prod->type; } if ($result == 0 || $result == -1) @@ -1402,7 +1417,7 @@ class CommandeFournisseur extends CommonOrder $localtaxes_type=getLocalTaxesFromRate($txtva,0,$mysoc,$this->thirdparty); $txtva = preg_replace('/\s*\(.*\)/','',$txtva); // Remove code into vatrate. - + $tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $product_type, $this->thirdparty, $localtaxes_type, 100, $this->multicurrency_tx); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; @@ -1414,83 +1429,88 @@ class CommandeFournisseur extends CommonOrder $multicurrency_total_ht = $tabprice[16]; $multicurrency_total_tva = $tabprice[17]; $multicurrency_total_ttc = $tabprice[18]; - + $localtax1_type=$localtaxes_type[0]; $localtax2_type=$localtaxes_type[2]; $subprice = price2num($pu,'MU'); - // TODO We should use here $this->line=new CommandeFournisseurLigne($this->db); and $this->line->insert(); to work loke other object (proposal, order, invoice) - $sql = "INSERT INTO ".MAIN_DB_PREFIX."commande_fournisseurdet"; - $sql.= " (fk_commande, label, description, date_start, date_end,"; - $sql.= " fk_product, product_type,"; - $sql.= " qty, tva_tx, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type, remise_percent, subprice, ref,"; - $sql.= " total_ht, total_tva, total_localtax1, total_localtax2, total_ttc, fk_unit,"; - $sql.= " fk_multicurrency, multicurrency_code, multicurrency_subprice, multicurrency_total_ht, multicurrency_total_tva, multicurrency_total_ttc"; - $sql.= ")"; - $sql.= " VALUES (".$this->id.", '" . $this->db->escape($label) . "','" . $this->db->escape($desc) . "',"; - $sql.= " ".($date_start?"'".$this->db->idate($date_start)."'":"null").","; - $sql.= " ".($date_end?"'".$this->db->idate($date_end)."'":"null").","; - if ($fk_product) { $sql.= $fk_product.","; } - else { $sql.= "null,"; } - $sql.= "'".$product_type."',"; - $sql.= "'".$qty."', ".$txtva.", ".$txlocaltax1.", ".$txlocaltax2; + // Insert line + $this->line=new CommandeFournisseurLigne($this->db); - $sql.= ", '".$localtax1_type."',"; - $sql.= " '".$localtax2_type."'"; + $this->line->context = $this->context; - $sql.= ", ".$remise_percent.",'".price2num($subprice,'MU')."','".$ref."',"; - $sql.= "'".price2num($total_ht)."',"; - $sql.= "'".price2num($total_tva)."',"; - $sql.= "'".price2num($total_localtax1)."',"; - $sql.= "'".price2num($total_localtax2)."',"; - $sql.= "'".price2num($total_ttc)."',"; - $sql.= ($fk_unit ? "'".$this->db->escape($fk_unit)."'":"null"); - $sql.= ", ".$this->fk_multicurrency; - $sql.= ", '".$this->db->escape($this->multicurrency_code)."'"; - $sql.= ", ".price2num($pu_ht * $this->multicurrency_tx); - $sql.= ", ".$multicurrency_total_ht; - $sql.= ", ".$multicurrency_total_tva; - $sql.= ", ".$multicurrency_total_ttc; - $sql.= ")"; + $this->line->fk_commande=$this->id; + $this->line->label=$label; + $this->line->ref_fourn = $ref_supplier; + $this->line->ref_supplier = $ref_supplier; + $this->line->desc=$desc; + $this->line->qty=$qty; + $this->line->tva_tx=$txtva; + $this->line->localtax1_tx=$txlocaltax1; + $this->line->localtax2_tx=$txlocaltax2; + $this->line->localtax1_type = $localtaxes_type[0]; + $this->line->localtax2_type = $localtaxes_type[2]; + $this->line->fk_product=$fk_product; + $this->line->product_type=$product_type; + $this->line->remise_percent=$remise_percent; + $this->line->subprice=$pu_ht; + $this->line->rang=$this->rang; + $this->line->info_bits=$info_bits; + $this->line->total_ht=$total_ht; + $this->line->total_tva=$total_tva; + $this->line->total_localtax1=$total_localtax1; + $this->line->total_localtax2=$total_localtax2; + $this->line->total_ttc=$total_ttc; + $this->line->product_type=$type; + $this->line->special_code=$this->special_code; + $this->line->origin=$this->origin; + $this->line->fk_unit=$fk_unit; - $resql=$this->db->query($sql); - //print $sql; - if ($resql) + $this->line->date_start=$date_start; + $this->line->date_end=$date_end; + + // Multicurrency + $this->line->fk_multicurrency = $this->fk_multicurrency; + $this->line->multicurrency_code = $this->multicurrency_code; + $this->line->multicurrency_subprice = price2num($pu_ht * $this->multicurrency_tx); + $this->line->multicurrency_total_ht = $multicurrency_total_ht; + $this->line->multicurrency_total_tva = $multicurrency_total_tva; + $this->line->multicurrency_total_ttc = $multicurrency_total_ttc; + + $this->line->subprice=$pu; + $this->line->price=$this->line->subprice; + + $this->line->remise_percent=$remise_percent; + + if (is_array($array_options) && count($array_options)>0) { + $this->line->array_options=$array_options; + } + + $result=$this->line->insert($notrigger); + if ($result > 0) { - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used - { - $linetmp = new CommandeFournisseurLigne($this->db); - $linetmp->id=$this->db->last_insert_id(MAIN_DB_PREFIX.'commande_fournisseurdet'); - $linetmp->array_options = $array_options; - $result=$linetmp->insertExtraFields(); - if ($result < 0) - { - $error++; - } - } + // Reorder if child line + if (! empty($fk_parent_line)) $this->line_order(true,'DESC'); - if (! $error && ! $notrigger) + // Mise a jour informations denormalisees au niveau de la commande meme + $result=$this->update_price(1,'auto'); // This method is designed to add line from user input so total calculation must be done using 'auto' mode. + if ($result > 0) { - global $conf, $langs, $user; - // Call trigger - $result=$this->call_trigger('LINEORDER_SUPPLIER_CREATE',$user); - if ($result < 0) - { - $this->db->rollback(); - return -1; - } - // End call triggers + $this->db->commit(); + return $this->line->id; + } + else + { + $this->db->rollback(); + return -1; } - - $this->update_price('','auto'); - - $this->db->commit(); - return 1; } else { - $this->error=$this->db->error(); + $this->error=$this->line->error; + $this->errors=$this->line->errors; + dol_syslog(get_class($this)."::addline error=".$this->error, LOG_ERR); $this->db->rollback(); return -1; } @@ -1514,7 +1534,7 @@ class CommandeFournisseur extends CommonOrder * @param int $notrigger 1 = notrigger * @return int <0 if KO, >0 if OK */ - function dispatchProduct($user, $product, $qty, $entrepot, $price=0, $comment='', $eatby='', $sellby='', $batch='', $fk_commandefourndet=0, $notrigger=0) + public function dispatchProduct($user, $product, $qty, $entrepot, $price=0, $comment='', $eatby='', $sellby='', $batch='', $fk_commandefourndet=0, $notrigger=0) { global $conf, $langs; @@ -1614,54 +1634,34 @@ class CommandeFournisseur extends CommonOrder * * @param int $idline Id of line to delete * @param int $notrigger 1=Disable call to triggers - * @return <0 if KO, >0 if OK + * @return int <0 if KO, >0 if OK */ - function deleteline($idline, $notrigger=0) + public function deleteline($idline, $notrigger=0) { - global $user,$langs,$conf; - - if ($this->statut != 0) + if ($this->statut == 0) { - return -1; - } + $line = new CommandeFournisseurLigne($this->db); - $this->db->begin(); + if ($line->fetch($idline) <= 0) + { + return 0; + } - if (! $notrigger) - { - // Call trigger - $result=$this->call_trigger('LINEORDER_SUPPLIER_DELETE',$user); - if ($result < 0) $error++; - // End call triggers - } - - if (! $error) - { - $sql = "DELETE FROM ".MAIN_DB_PREFIX."commande_fournisseurdet WHERE rowid = ".$idline; - $resql=$this->db->query($sql); - - dol_syslog(get_class($this)."::deleteline sql=".$sql); - if (! $resql) - { - $this->error=$this->db->lasterror(); - $error++; - } - } - - if (! $error) - { - $result=$this->update_price(); - } - - if (! $error) - { - $this->db->commit(); - return 1; + if ($line->delete($notrigger) > 0) + { + $this->update_price(); + return 1; + } + else + { + $this->error = $line->error; + $this->errors = $line->errors; + return -1; + } } else - { - $this->db->rollback(); - return -1; + { + return -2; } } @@ -1671,7 +1671,7 @@ class CommandeFournisseur extends CommonOrder * @param User $user Object user * @return int <0 if KO, >0 if OK */ - function delete($user='') + public function delete($user='') { global $langs,$conf; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; @@ -1822,7 +1822,7 @@ class CommandeFournisseur extends CommonOrder * @param int $status Filter on stats (-1 = no filter, 0 = lines draft to be approved, 1 = approved lines) * @return array Array of lines */ - function getDispachedLines($status=-1) + public function getDispachedLines($status=-1) { $ret = array(); @@ -1912,7 +1912,7 @@ class CommandeFournisseur extends CommonOrder } } - // TODO LDR01 Add option to accept only if ALL predefined products are received (same qty). + // TODO LDR01 Add a control test to accept only if ALL predefined products are received (same qty). if (! $error && ! ($statut == 4 or $statut == 5 or $statut == 7)) @@ -1942,7 +1942,7 @@ class CommandeFournisseur extends CommonOrder $result=$this->call_trigger('ORDER_SUPPLIER_RECEIVE',$user); if ($result < 0) $error++; // End call triggers - + if (! $error) { $this->db->commit(); @@ -1977,28 +1977,58 @@ class CommandeFournisseur extends CommonOrder * * @param User $user Objet user making change * @param timestamp $date_livraison Planned delivery date + * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ - function set_date_livraison($user, $date_livraison) + function set_date_livraison($user, $date_livraison, $notrigger=0) { if ($user->rights->fournisseur->commande->creer) { - $sql = "UPDATE ".MAIN_DB_PREFIX."commande_fournisseur"; + $error=0; + + $this->db->begin(); + + $sql = "UPDATE ".MAIN_DB_PREFIX."commande_fournisseur"; $sql.= " SET date_livraison = ".($date_livraison ? "'".$this->db->idate($date_livraison)."'" : 'null'); $sql.= " WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::set_date_livraison", LOG_DEBUG); - $resql=$this->db->query($sql); - if ($resql) - { - $this->date_livraison = $date_livraison; - return 1; - } - else - { - $this->error=$this->db->error(); - return -1; - } + dol_syslog(__METHOD__, LOG_DEBUG); + $resql=$this->db->query($sql); + if (!$resql) + { + $this->errors[]=$this->db->error(); + $error++; + } + + if (! $error) + { + $this->oldcopy= clone $this; + $this->date_livraison = $date_livraison; + } + + if (! $notrigger && empty($error)) + { + // Call trigger + $result=$this->call_trigger('ORDER_SUPPLIER_MODIFY',$user); + if ($result < 0) $error++; + // End call triggers + } + + if (! $error) + { + $this->db->commit(); + return 1; + } + else + { + foreach($this->errors as $errmsg) + { + dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); + $this->error.=($this->error?', '.$errmsg:$errmsg); + } + $this->db->rollback(); + return -1*$error; + } } else { @@ -2011,27 +2041,57 @@ class CommandeFournisseur extends CommonOrder * * @param User $user Objet utilisateur qui modifie * @param int $id_projet Date de livraison + * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 si ko, >0 si ok */ - function set_id_projet($user, $id_projet) + function set_id_projet($user, $id_projet, $notrigger=0) { if ($user->rights->fournisseur->commande->creer) { + $error=0; + + $this->db->begin(); + $sql = "UPDATE ".MAIN_DB_PREFIX."commande_fournisseur"; $sql.= " SET fk_projet = ".($id_projet > 0 ? (int) $id_projet : 'null'); $sql.= " WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::set_id_projet", LOG_DEBUG); + dol_syslog(__METHOD__, LOG_DEBUG); $resql=$this->db->query($sql); - if ($resql) + if (!$resql) { - $this->fk_projet = $id_projet; - return 1; + $this->errors[]=$this->db->error(); + $error++; + } + + if (! $error) + { + $this->oldcopy= clone $this; + $this->fk_projet = $id_projet; + } + + if (! $notrigger && empty($error)) + { + // Call trigger + $result=$this->call_trigger('ORDER_SUPPLIER_MODIFY',$user); + if ($result < 0) $error++; + // End call triggers + } + + if (! $error) + { + $this->db->commit(); + return 1; } else { - $this->error=$this->db->error(); - return -1; + foreach($this->errors as $errmsg) + { + dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); + $this->error.=($this->error?', '.$errmsg:$errmsg); + } + $this->db->rollback(); + return -1*$error; } } else @@ -2048,7 +2108,7 @@ class CommandeFournisseur extends CommonOrder * @param int $comclientid Id of customer order to use as template * @return int <0 if KO, >0 if OK */ - function updateFromCommandeClient($user, $idc, $comclientid) + public function updateFromCommandeClient($user, $idc, $comclientid) { $comclient = new Commande($this->db); $comclient->fetch($comclientid); @@ -2089,7 +2149,7 @@ class CommandeFournisseur extends CommonOrder * @param int $status New status * @return int <0 if KO, >0 if OK */ - function setStatus($user,$status) + public function setStatus($user,$status) { global $conf,$langs; $error=0; @@ -2104,7 +2164,22 @@ class CommandeFournisseur extends CommonOrder $resql = $this->db->query($sql); if ($resql) { - //TODO: Add trigger for status modification + // Trigger names for each status + $trigger_name[0] = 'DRAFT'; + $trigger_name[1] = 'VALIDATED'; + $trigger_name[2] = 'APPROVED'; + $trigger_name[3] = 'ONPROCESS'; + $trigger_name[4] = 'RECEIVED_PARTIALLY'; + $trigger_name[5] = 'RECEIVED_ALL'; + $trigger_name[6] = 'CANCELED'; + $trigger_name[7] = 'CANCELED'; + $trigger_name[8] = 'BILLED'; + $trigger_name[9] = 'REFUSED'; + + // Call trigger + $result=$this->call_trigger("ORDER_SUPPLIER_STATUS_".$trigger_name[$status],$user); + if ($result < 0) { $error++; } + // End call triggers } else { @@ -2147,12 +2222,14 @@ class CommandeFournisseur extends CommonOrder * @param string $fk_unit Code of the unit to use. Null to use the default one * @return int < 0 if error, > 0 if ok */ - function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0, $txlocaltax2=0, $price_base_type='HT', $info_bits=0, $type=0, $notrigger=false, $date_start='', $date_end='', $array_options=0, $fk_unit=null) + public function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0, $txlocaltax2=0, $price_base_type='HT', $info_bits=0, $type=0, $notrigger=false, $date_start='', $date_end='', $array_options=0, $fk_unit=null) { - global $mysoc; + global $mysoc, $conf; dol_syslog(get_class($this)."::updateline $rowid, $desc, $pu, $qty, $remise_percent, $txtva, $price_base_type, $info_bits, $type, $fk_unit"); include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; + $error = 0; + if ($this->brouillon) { $this->db->begin(); @@ -2184,7 +2261,7 @@ class CommandeFournisseur extends CommonOrder $localtaxes_type=getLocalTaxesFromRate($txtva,0,$mysoc, $this->thirdparty); $txtva = preg_replace('/\s*\(.*\)/','',$txtva); // Remove code into vatrate. - + $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $this->thirdparty, $localtaxes_type, 100, $this->multicurrency_tx); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; @@ -2196,89 +2273,68 @@ class CommandeFournisseur extends CommonOrder $multicurrency_total_ht = $tabprice[16]; $multicurrency_total_tva = $tabprice[17]; $multicurrency_total_ttc = $tabprice[18]; - + $localtax1_type=$localtaxes_type[0]; $localtax2_type=$localtaxes_type[2]; $subprice = price2num($pu,'MU'); - // Mise a jour ligne en base - $sql = "UPDATE ".MAIN_DB_PREFIX."commande_fournisseurdet SET"; - $sql.= " description='".$this->db->escape($desc)."'"; - $sql.= ",subprice='".price2num($subprice)."'"; - //$sql.= ",remise='".price2num($remise)."'"; - $sql.= ",remise_percent='".price2num($remise_percent)."'"; - $sql.= ",tva_tx='".price2num($txtva)."'"; - $sql.= ",localtax1_tx='".price2num($txlocaltax1)."'"; - $sql.= ",localtax2_tx='".price2num($txlocaltax2)."'"; - $sql.= ",localtax1_type='".$localtax1_type."'"; - $sql.= ",localtax2_type='".$localtax2_type."'"; - $sql.= ",qty='".price2num($qty)."'"; - $sql.= ",date_start=".(! empty($date_start)?"'".$this->db->idate($date_start)."'":"null"); - $sql.= ",date_end=".(! empty($date_end)?"'".$this->db->idate($date_end)."'":"null"); - $sql.= ",info_bits='".$info_bits."'"; - $sql.= ",total_ht='".price2num($total_ht)."'"; - $sql.= ",total_tva='".price2num($total_tva)."'"; - $sql.= ",total_localtax1='".price2num($total_localtax1)."'"; - $sql.= ",total_localtax2='".price2num($total_localtax2)."'"; - $sql.= ",total_ttc='".price2num($total_ttc)."'"; - $sql.= ",product_type=".$type; - $sql.= ($fk_unit ? ",fk_unit='".$this->db->escape($fk_unit)."'":", fk_unit=null"); - - // Multicurrency - $sql.= " , multicurrency_subprice=".price2num($subprice * $this->multicurrency_tx).""; - $sql.= " , multicurrency_total_ht=".price2num($multicurrency_total_ht).""; - $sql.= " , multicurrency_total_tva=".price2num($multicurrency_total_tva).""; - $sql.= " , multicurrency_total_ttc=".price2num($multicurrency_total_ttc).""; - - $sql.= " WHERE rowid = ".$rowid; + $this->line=new CommandeFournisseurLigne($this->db); + $this->line->fetch($rowid); - dol_syslog(get_class($this)."::updateline", LOG_DEBUG); - $result = $this->db->query($sql); - if ($result > 0) + $this->line->context = $this->context; + + $this->line->fk_commande=$this->id; + //$this->line->label=$label; + $this->line->desc=$desc; + $this->line->qty=$qty; + $this->line->tva_tx=$txtva; + $this->line->localtax1_tx=$txlocaltax1; + $this->line->localtax2_tx=$txlocaltax2; + $this->line->localtax1_type = $localtaxes_type[0]; + $this->line->localtax2_type = $localtaxes_type[2]; + $this->line->remise_percent=$remise_percent; + $this->line->subprice=$pu; + $this->line->rang=$this->rang; + $this->line->info_bits=$info_bits; + $this->line->total_ht=$total_ht; + $this->line->total_tva=$total_tva; + $this->line->total_localtax1=$total_localtax1; + $this->line->total_localtax2=$total_localtax2; + $this->line->total_ttc=$total_ttc; + $this->line->product_type=$type; + $this->line->special_code=$this->special_code; + $this->line->origin=$this->origin; + $this->line->fk_unit=$fk_unit; + + $this->line->date_start=$date_start; + $this->line->date_end=$date_end; + + + // Multicurrency + $this->line->fk_multicurrency = $this->fk_multicurrency; + $this->line->multicurrency_code = $this->multicurrency_code; + $this->line->multicurrency_subprice = price2num($pu_ht * $this->multicurrency_tx); + $this->line->multicurrency_total_ht = $multicurrency_total_ht; + $this->line->multicurrency_total_tva = $multicurrency_total_tva; + $this->line->multicurrency_total_ttc = $multicurrency_total_ttc; + + $this->line->subprice=$pu; + $this->line->price=$this->line->subprice; + + $this->line->remise_percent=$remise_percent; + + if (is_array($array_options) && count($array_options)>0) { + $this->line->array_options=$array_options; + } + + $result=$this->line->update($notrigger); + + + // Mise a jour info denormalisees au niveau facture + if (! $error) { - $this->rowid = $rowid; - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used - { - $tmpline = new CommandeFournisseurLigne($this->db); - $tmpline->id=$this->rowid; - $tmpline->array_options = $array_options; - $result=$tmpline->insertExtraFields(); - if ($result < 0) - { - $error++; - } - } - - if (! $error && ! $notrigger) - { - global $conf, $langs, $user; - // Call trigger - $result=$this->call_trigger('LINEORDER_SUPPLIER_UPDATE',$user); - if ($result < 0) - { - $this->db->rollback(); - return -1; - } - // End call triggers - } - - // Mise a jour info denormalisees au niveau facture - if (! $error) - { - $this->update_price('','auto'); - } - - if (! $error) - { - $this->db->commit(); - return $result; - } - else - { - $this->db->rollback(); - return -1; - } + $this->update_price('','auto'); } else { @@ -2303,7 +2359,7 @@ class CommandeFournisseur extends CommonOrder * * @return void */ - function initAsSpecimen() + public function initAsSpecimen() { global $user,$langs,$conf; @@ -2385,7 +2441,7 @@ class CommandeFournisseur extends CommonOrder * @param int $id Id de la facture a charger * @return void */ - function info($id) + public function info($id) { $sql = 'SELECT c.rowid, date_creation as datec, tms as datem, date_valid as date_validation, date_approve as datea, date_approve2 as datea2,'; $sql.= ' fk_user_author, fk_user_modif, fk_user_valid, fk_user_approve, fk_user_approve2'; @@ -2399,7 +2455,7 @@ class CommandeFournisseur extends CommonOrder { $obj = $this->db->fetch_object($result); $this->id = $obj->rowid; - if ($obj->fk_user_author) $this->user_creation_id = $obj->fk_user_author; + if ($obj->fk_user_author) $this->user_creation_id = $obj->fk_user_author; if ($obj->fk_user_valid) $this->user_validation_id = $obj->fk_user_valid; if ($obj->fk_user_modif) $this->user_modification_id =$obj->fk_user_modif; if ($obj->fk_user_approve) $this->user_approve_id = $obj->fk_user_approve; @@ -2418,7 +2474,7 @@ class CommandeFournisseur extends CommonOrder dol_print_error($this->db); } } - + /** * Charge indicateurs this->nb de tableau de bord * @@ -2523,7 +2579,7 @@ class CommandeFournisseur extends CommonOrder * * @return string */ - function getInputMethod() + public function getInputMethod() { global $db, $langs; @@ -2593,7 +2649,7 @@ class CommandeFournisseur extends CommonOrder * @param Translate $langs Language object * @return Translated string */ - function getMaxDeliveryTimeDay($langs) + public function getMaxDeliveryTimeDay($langs) { if (empty($this->lines)) return ''; @@ -2654,15 +2710,15 @@ class CommandeFournisseur extends CommonOrder public function hasDelay() { global $conf; - + if (empty($this->date_delivery) && ! empty($this->date_livraison)) $this->date_delivery = $this->date_livraison; // For backward compatibility - + $now = dol_now(); $date_to_test = empty($this->date_delivery) ? $this->date_commande : $this->date_delivery; - + return ($this->statut > 0 && $this->statut < 4) && $date_to_test && $date_to_test < ($now - $conf->commande->fournisseur->warning_delay); } - + /** * Show the customer delayed info * @@ -2671,15 +2727,95 @@ class CommandeFournisseur extends CommonOrder public function showDelay() { global $conf, $langs; - + if (empty($this->date_delivery) && ! empty($this->date_livraison)) $this->date_delivery = $this->date_livraison; // For backward compatibility - + if (empty($this->date_delivery)) $text=$langs->trans("OrderDate").' '.dol_print_date($this->date_commande, 'day'); else $text=$text=$langs->trans("DeliveryDate").' '.dol_print_date($this->date_delivery, 'day'); $text.=' '.($conf->commande->fournisseur->warning_delay>0?'+':'-').' '.round(abs($conf->commande->fournisseur->warning_delay)/3600/24,1).' '.$langs->trans("days").' < '.$langs->trans("Today"); - + return $text; - } + } + + + /** + * Calc status regarding dispatch stock + * + * @param User $user User action + * @param int $closeopenorder Close if received + * @return int <0 if KO, 0 if not applicable, >0 if OK + */ + public function calcAndSetStatusDispatch(User $user, $closeopenorder=1) + { + global $conf; + + if (! empty($conf->commande->enabled) && ! empty($conf->fournisseur->enabled)) + { + require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.dispatch.class.php'; + + $qtydelivered=array(); + $qtywished=array(); + + $supplierorderdispatch = new CommandeFournisseurDispatch($this->db); + $filter=array('t.fk_commande'=>$this->id); + if (! empty($conf->global->SUPPLIER_ORDER_USE_DISPATCH_STATUS)) { + $filter['t.status']=1; + } + $ret=$supplierorderdispatch->fetchAll('','',0,0,$filter); + if ($ret<0) + { + $this->error=$supplierorderdispatch->error; $this->errors=$supplierorderdispatch->errors; + return $ret; + } + else + { + if (is_array($supplierorderdispatch->lines) && count($supplierorderdispatch->lines)>0) + { + //Build array with quantity deliverd by product + foreach($supplierorderdispatch->lines as $line) { + $qtydelivered[$line->fk_product]+=$line->qty; + } + foreach($this->lines as $line) { + $qtywished[$line->fk_product]+=$line->qty; + } + //Compare array + $diff_array=array_diff_assoc($qtydelivered,$qtywished); + if (count($diff_array)==0) + { + //No diff => mean everythings is received + if ($closeopenorder) + { + $ret=$this->setStatus($user,5); + if ($ret<0) { + return -1; + } + return 5; + } + else + { + //Diff => received partially + $ret=$this->setStatus($user,4); + if ($ret<0) { + return -1; + } + return 4; + } + } + else + { + //Diff => received partially + $ret=$this->setStatus($user,4); + if ($ret<0) { + return -1; + } + return 4; + } + } + return 1; + } + } + return 0; + } } @@ -2689,17 +2825,31 @@ class CommandeFournisseur extends CommonOrder */ class CommandeFournisseurLigne extends CommonOrderLine { - public $element='commande_fournisseurdet'; + public $element='commande_fournisseurdet'; public $table_element='commande_fournisseurdet'; + public $oldline; + + /** + * Id of parent order + * @var int + */ + public $fk_commande; + + // From llx_commande_fournisseurdet + public $fk_parent_line; + public $fk_facture; + public $label; + public $rang = 0; + /** * Unit price without taxes * @var float */ public $pu_ht; - var $date_start; - var $date_end; + public $date_start; + public $date_end; // From llx_product_fournisseur_price @@ -2715,7 +2865,9 @@ class CommandeFournisseurLigne extends CommonOrderLine * Supplier reference * @var string */ - public $ref_supplier; + public $ref_supplier; + public $remise; + public $product_libelle; /** @@ -2723,7 +2875,7 @@ class CommandeFournisseurLigne extends CommonOrderLine * * @param DoliDB $db Database handler */ - function __construct($db) + public function __construct($db) { $this->db= $db; } @@ -2734,10 +2886,10 @@ class CommandeFournisseurLigne extends CommonOrderLine * @param int $rowid Id line order * @return int <0 if KO, >0 if OK */ - function fetch($rowid) + public function fetch($rowid) { $sql = 'SELECT cd.rowid, cd.fk_commande, cd.fk_product, cd.product_type, cd.description, cd.qty, cd.tva_tx,'; - $sql.= ' cd.localtax1_tx, cd.localtax2_tx,'; + $sql.= ' cd.localtax1_tx, cd.localtax2_tx, cd.ref,'; $sql.= ' cd.remise, cd.remise_percent, cd.subprice,'; $sql.= ' cd.info_bits, cd.total_ht, cd.total_tva, cd.total_ttc,'; $sql.= ' cd.total_localtax1, cd.total_localtax2,'; @@ -2751,9 +2903,12 @@ class CommandeFournisseurLigne extends CommonOrderLine { $objp = $this->db->fetch_object($result); $this->rowid = $objp->rowid; + $this->id = $objp->rowid; $this->fk_commande = $objp->fk_commande; $this->desc = $objp->description; $this->qty = $objp->qty; + $this->ref_fourn = $objp->ref; + $this->ref_supplier = $objp->ref; $this->subprice = $objp->subprice; $this->tva_tx = $objp->tva_tx; $this->localtax1_tx = $objp->localtax1_tx; @@ -2770,6 +2925,7 @@ class CommandeFournisseurLigne extends CommonOrderLine $this->product_type = $objp->product_type; $this->ref = $objp->product_ref; + $this->product_ref = $objp->product_ref; $this->product_libelle = $objp->product_libelle; $this->product_desc = $objp->product_desc; @@ -2792,7 +2948,7 @@ class CommandeFournisseurLigne extends CommonOrderLine * * @return int <0 si ko, >0 si ok */ - function update_total() + public function updateTotal() { $this->db->begin(); @@ -2805,7 +2961,7 @@ class CommandeFournisseurLigne extends CommonOrderLine $sql.= ",total_ttc='".price2num($this->total_ttc)."'"; $sql.= " WHERE rowid = ".$this->rowid; - dol_syslog("CommandeFournisseurLigne.class.php::update_total", LOG_DEBUG); + dol_syslog(get_class($this)."::updateTotal", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) @@ -2820,5 +2976,267 @@ class CommandeFournisseurLigne extends CommonOrderLine return -2; } } + + /** + * Insert line into database + * + * @param int $notrigger 1 = disable triggers + * @return int <0 if KO, >0 if OK + */ + public function insert($notrigger=0) + { + global $conf, $user; + + $error=0; + + dol_syslog(get_class($this)."::insert rang=".$this->rang); + + // Clean parameters + if (empty($this->tva_tx)) $this->tva_tx=0; + if (empty($this->localtax1_tx)) $this->localtax1_tx=0; + if (empty($this->localtax2_tx)) $this->localtax2_tx=0; + if (empty($this->localtax1_type)) $this->localtax1_type=0; + if (empty($this->localtax2_type)) $this->localtax2_type=0; + if (empty($this->total_localtax1)) $this->total_localtax1=0; + if (empty($this->total_localtax2)) $this->total_localtax2=0; + if (empty($this->rang)) $this->rang=0; + if (empty($this->remise)) $this->remise=0; + if (empty($this->remise_percent)) $this->remise_percent=0; + if (empty($this->info_bits)) $this->info_bits=0; + if (empty($this->special_code)) $this->special_code=0; + if (empty($this->fk_parent_line)) $this->fk_parent_line=0; + if (empty($this->pa_ht)) $this->pa_ht=0; + + // Multicurrency + if (!empty($this->multicurrency_code)) list($this->fk_multicurrency,$this->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code); + if (empty($this->fk_multicurrency)) + { + $this->multicurrency_code = $conf->currency; + $this->fk_multicurrency = 0; + $this->multicurrency_tx = 1; + } + + // Check parameters + if ($this->product_type < 0) return -1; + + $this->db->begin(); + + // Insertion dans base de la ligne + $sql = 'INSERT INTO '.MAIN_DB_PREFIX.$this->table_element; + $sql.= " (fk_commande, label, description, date_start, date_end,"; + $sql.= " fk_product, product_type,"; + $sql.= " qty, tva_tx, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type, remise_percent, subprice, ref,"; + $sql.= " total_ht, total_tva, total_localtax1, total_localtax2, total_ttc, fk_unit,"; + $sql.= " fk_multicurrency, multicurrency_code, multicurrency_subprice, multicurrency_total_ht, multicurrency_total_tva, multicurrency_total_ttc"; + $sql.= ")"; + $sql.= " VALUES (".$this->fk_commande.", '" . $this->db->escape($this->product_label) . "','" . $this->db->escape($this->desc) . "',"; + $sql.= " ".($this->date_start?"'".$this->db->idate($this->date_start)."'":"null").","; + $sql.= " ".($this->date_end?"'".$this->db->idate($this->date_end)."'":"null").","; + if ($this->fk_product) { $sql.= $this->fk_product.","; } + else { $sql.= "null,"; } + $sql.= "'".$this->product_type."',"; + $sql.= "'".$this->qty."', ".$this->tva_tx.", ".$this->localtax1_tx.", ".$this->localtax2_tx; + + $sql.= ", '".$this->localtax1_type."',"; + $sql.= " '".$this->localtax2_type."'"; + + $sql.= ", ".$this->remise_percent.",'".price2num($this->subprice,'MU')."','".$this->ref_supplier."',"; + $sql.= "'".price2num($this->total_ht)."',"; + $sql.= "'".price2num($this->total_tva)."',"; + $sql.= "'".price2num($this->total_localtax1)."',"; + $sql.= "'".price2num($this->total_localtax2)."',"; + $sql.= "'".price2num($this->total_ttc)."',"; + $sql.= ($this->fk_unit ? "'".$this->db->escape($this->fk_unit)."'":"null"); + $sql.= ", ".($this->fk_multicurrency ? $this->fk_multicurrency : "null"); + $sql.= ", '".$this->db->escape($this->multicurrency_code)."'"; + $sql.= ", ".price2num($this->pu_ht * $this->multicurrency_tx); + $sql.= ", ".$this->multicurrency_total_ht; + $sql.= ", ".$this->multicurrency_total_tva; + $sql.= ", ".$this->multicurrency_total_ttc; + $sql.= ")"; + + dol_syslog(get_class($this)."::insert", LOG_DEBUG); + $resql=$this->db->query($sql); + if ($resql) + { + $this->id=$this->db->last_insert_id(MAIN_DB_PREFIX.$this->table_element); + $this->rowid =$this->id; + + if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + { + + $result=$this->insertExtraFields(); + if ($result < 0) + { + $error++; + } + } + + if (! $error && ! $notrigger) + { + // Call trigger + $result=$this->call_trigger('LINEORDER_SUPPLIER_CREATE',$user); + if ($result < 0) $error++; + // End call triggers + } + + if (!$error) { + $this->db->commit(); + return 1; + } + + foreach($this->errors as $errmsg) + { + dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR); + $this->errors[]=($this->errors?', '.$errmsg:$errmsg); + } + $this->db->rollback(); + return -1*$error; + } + else + { + $this->errors[]=$this->db->error(); + $this->db->rollback(); + return -2; + } + } + /** + * Update the line object into db + * + * @param int $notrigger 1 = disable triggers + * @return int <0 si ko, >0 si ok + */ + public function update($notrigger=0) + { + global $conf,$user; + + $error=0; + + // Mise a jour ligne en base + $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET"; + $sql.= " description='".$this->db->escape($this->desc)."'"; + $sql.= ",subprice='".price2num($this->subprice)."'"; + //$sql.= ",remise='".price2num($remise)."'"; + $sql.= ",remise_percent='".price2num($this->remise_percent)."'"; + $sql.= ",tva_tx='".price2num($this->tva_tx)."'"; + $sql.= ",localtax1_tx='".price2num($this->total_localtax1)."'"; + $sql.= ",localtax2_tx='".price2num($this->total_localtax2)."'"; + $sql.= ",localtax1_type='".$this->localtax1_type."'"; + $sql.= ",localtax2_type='".$this->localtax2_type."'"; + $sql.= ",qty='".price2num($this->qty)."'"; + $sql.= ",date_start=".(! empty($this->date_start)?"'".$this->db->idate($this->date_start)."'":"null"); + $sql.= ",date_end=".(! empty($this->date_end)?"'".$this->db->idate($this->date_end)."'":"null"); + $sql.= ",info_bits='".$this->info_bits."'"; + $sql.= ",total_ht='".price2num($this->total_ht)."'"; + $sql.= ",total_tva='".price2num($this->total_tva)."'"; + $sql.= ",total_localtax1='".price2num($this->total_localtax1)."'"; + $sql.= ",total_localtax2='".price2num($this->total_localtax2)."'"; + $sql.= ",total_ttc='".price2num($this->total_ttc)."'"; + $sql.= ",product_type=".$this->product_type; + $sql.= ($this->fk_unit ? ",fk_unit='".$this->db->escape($this->fk_unit)."'":", fk_unit=null"); + + // Multicurrency + $sql.= " , multicurrency_subprice=".price2num($this->subprice * $this->multicurrency_tx).""; + $sql.= " , multicurrency_total_ht=".price2num($this->multicurrency_total_ht).""; + $sql.= " , multicurrency_total_tva=".price2num($this->multicurrency_total_tva).""; + $sql.= " , multicurrency_total_ttc=".price2num($this->multicurrency_total_ttc).""; + + $sql.= " WHERE rowid = ".$this->id; + + dol_syslog(get_class($this)."::updateline", LOG_DEBUG); + $result = $this->db->query($sql); + if ($result > 0) + { + if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + { + + $result=$this->insertExtraFields(); + if ($result < 0) + { + $error++; + } + } + + if (! $error && ! $notrigger) + { + global $user; + // Call trigger + $result=$this->call_trigger('LINEORDER_SUPPLIER_UPDATE',$user); + if ($result < 0) + { + $this->db->rollback(); + return -1; + } + // End call triggers + } + + if (! $error) + { + $this->db->commit(); + return $result; + } + else + { + $this->db->rollback(); + return -1; + } + } + else + { + $this->error=$this->db->lasterror(); + $this->db->rollback(); + return -1; + } + } + + /** + * Delete line in database + * + * @param int $notrigger 1=Disable call to triggers + * @return int <0 if KO, >0 if OK + */ + function delete($notrigger) + { + global $user; + + $error=0; + + $this->db->begin(); + + $sql = 'DELETE FROM '.MAIN_DB_PREFIX."commande_fournisseurdet WHERE rowid='".$this->rowid."';"; + + dol_syslog(__METHOD__, LOG_DEBUG); + $resql=$this->db->query($sql); + if ($resql) + { + + if (!$notrigger) + { + // Call trigger + $result=$this->call_trigger('LINEORDER_SUPPLIER_DELETE',$user); + if ($result < 0) $error++; + // End call triggers + } + + if (!$error) + { + $this->db->commit(); + return 1; + } + + foreach($this->errors as $errmsg) + { + dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR); + $this->error.=($this->error?', '.$errmsg:$errmsg); + } + $this->db->rollback(); + return -1*$error; + } + else + { + $this->error=$this->db->lasterror(); + return -1; + } + } } diff --git a/htdocs/fourn/class/fournisseur.commande.dispatch.class.php b/htdocs/fourn/class/fournisseur.commande.dispatch.class.php index 4d6f75444b8..0464a9fb51f 100644 --- a/htdocs/fourn/class/fournisseur.commande.dispatch.class.php +++ b/htdocs/fourn/class/fournisseur.commande.dispatch.class.php @@ -34,27 +34,28 @@ require_once(DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php"); */ class CommandeFournisseurDispatch extends CommonObject { - var $db; //!< To store db handler - var $error; //!< To return error code (or message) - var $errors=array(); //!< To return several error codes (or messages) - var $element='commandefournisseurdispatch'; //!< Id that identify managed objects - var $table_element='commande_fournisseur_dispatch'; //!< Name of table without prefix where object is stored + public $db; //!< To store db handler + public $error; //!< To return error code (or message) + public $errors=array(); //!< To return several error codes (or messages) + public $element='commandefournisseurdispatch'; //!< Id that identify managed objects + public $table_element='commande_fournisseur_dispatch'; //!< Name of table without prefix where object is stored + public $lines=array(); - var $id; + public $id; - var $fk_commande; - var $fk_product; - var $fk_commandefourndet; - var $qty; - var $fk_entrepot; - var $fk_user; - var $datec=''; - var $comment; - var $status; - var $tms=''; - var $batch; - var $eatby=''; - var $sellby=''; + public $fk_commande; + public $fk_product; + public $fk_commandefourndet; + public $qty; + public $fk_entrepot; + public $fk_user; + public $datec=''; + public $comment; + public $status; + public $tms=''; + public $batch; + public $eatby=''; + public $sellby=''; @@ -539,4 +540,100 @@ class CommandeFournisseurDispatch extends CommonObject } + /** + * Load object in memory from the database + * + * @param string $sortorder Sort Order + * @param string $sortfield Sort field + * @param int $limit offset limit + * @param int $offset offset limit + * @param array $filter filter array + * @param string $filtermode filter mode (AND or OR) + * + * @return int <0 if KO, >0 if OK + */ + public function fetchAll($sortorder='', $sortfield='', $limit=0, $offset=0, array $filter = array(), $filtermode='AND') + { + dol_syslog(__METHOD__, LOG_DEBUG); + + $sql = "SELECT"; + $sql.= " t.rowid,"; + + $sql.= " t.fk_commande,"; + $sql.= " t.fk_product,"; + $sql.= " t.fk_commandefourndet,"; + $sql.= " t.qty,"; + $sql.= " t.fk_entrepot,"; + $sql.= " t.fk_user,"; + $sql.= " t.datec,"; + $sql.= " t.comment,"; + $sql.= " t.status,"; + $sql.= " t.tms,"; + $sql.= " t.batch,"; + $sql.= " t.eatby,"; + $sql.= " t.sellby"; + + $sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element." as t"; + + // Manage filter + $sqlwhere = array(); + if (count($filter) > 0) { + foreach ($filter as $key => $value) { + if ($key=='t.comment') { + $sqlwhere [] = $key . ' LIKE \'%' . $this->db->escape($value) . '%\''; + } elseif ($key=='t.datec' || $key=='t.tms' || $key=='t.eatby' || $key=='t.sellby' || $key=='t.batch') { + $sqlwhere [] = $key . ' = \'' . $this->db->escape($value) . '\''; + } else { + $sqlwhere [] = $key . ' = ' . $this->db->escape($value); + } + } + } + if (count($sqlwhere) > 0) { + $sql .= ' WHERE ' . implode(' '.$filtermode.' ', $sqlwhere); + } + + if (!empty($sortfield)) { + $sql .= $this->db->order($sortfield,$sortorder); + } + if (!empty($limit)) { + $sql .= ' ' . $this->db->plimit($limit + 1, $offset); + } + $this->lines = array(); + + $resql = $this->db->query($sql); + if ($resql) { + $num = $this->db->num_rows($resql); + + while ($obj = $this->db->fetch_object($resql)) { + $line = new self($this->db); + + $line->id = $obj->rowid; + + $line->fk_commande = $obj->fk_commande; + $line->fk_product = $obj->fk_product; + $line->fk_commandefourndet = $obj->fk_commandefourndet; + $line->qty = $obj->qty; + $line->fk_entrepot = $obj->fk_entrepot; + $line->fk_user = $obj->fk_user; + $line->datec = $this->db->jdate($obj->datec); + $line->comment = $obj->comment; + $line->status = $obj->status; + $line->tms = $this->db->jdate($obj->tms); + $line->batch = $obj->batch; + $line->eatby = $this->db->jdate($obj->eatby); + $line->sellby = $this->db->jdate($obj->sellby); + + $this->lines[$line->id] = $line; + } + $this->db->free($resql); + + return $num; + } else { + $this->errors[] = 'Error ' . $this->db->lasterror(); + dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR); + + return - 1; + } + } + } diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 69932f0c232..9b3de478cc9 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -4,12 +4,13 @@ * Copyright (C) 2004 Christophe Combelles * Copyright (C) 2005 Marc Barilley * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2010-2015 Juanjo Menent + * Copyright (C) 2010-2016 Juanjo Menent * Copyright (C) 2013 Philippe Grand - * Copyright (C) 2013 Florian Henry - * Copyright (C) 2014-2016 Marcos García - * Copyright (C) 2015 Bahfir Abbes - * Copyright (C) 2015 Ferran Marcet + * Copyright (C) 2013 Florian Henry + * Copyright (C) 2014-2016 Marcos García + * Copyright (C) 2015 Bahfir Abbes + * Copyright (C) 2015 Ferran Marcet + * Copyright (C) 2016 Alexandre Spangaro * * 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 @@ -44,63 +45,64 @@ class FactureFournisseur extends CommonInvoice public $table_element_line='facture_fourn_det'; public $fk_element='fk_facture_fourn'; protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe - + public $picto='bill'; + /** * {@inheritdoc} */ protected $table_ref_field = 'ref'; - var $rowid; - var $ref; - var $product_ref; - var $ref_supplier; - var $socid; + public $rowid; + public $ref; + public $product_ref; + public $ref_supplier; + public $socid; //Check constants for types - var $type = self::TYPE_STANDARD; + public $type = self::TYPE_STANDARD; /** * Supplier invoice status * @var int * @see FactureFournisseur::STATUS_DRAFT, FactureFournisseur::STATUS_VALIDATED, FactureFournisseur::STATUS_PAID, FactureFournisseur::STATUS_ABANDONED */ - var $statut; + public $statut; /** * Set to 1 if the invoice is completely paid, otherwise is 0 * @var int * @deprecated Use statuses stored in self::statut */ - var $paye; + public $paye; - var $author; - var $libelle; - var $datec; // Creation date - var $tms; // Last update date - var $date; // Invoice date - var $date_echeance; // Max payment date - var $amount; - var $remise; - var $tva; - var $localtax1; - var $localtax2; - var $total_ht; - var $total_tva; - var $total_localtax1; - var $total_localtax2; - var $total_ttc; + public $author; + public $libelle; + public $datec; // Creation date + public $tms; // Last update date + public $date; // Invoice date + public $date_echeance; // Max payment date + public $amount; + public $remise; + public $tva; + public $localtax1; + public $localtax2; + public $total_ht; + public $total_tva; + public $total_localtax1; + public $total_localtax2; + public $total_ttc; /** * @deprecated * @see note_private, note_public */ - var $note; - var $note_private; - var $note_public; - var $propalid; - var $cond_reglement_id; - var $cond_reglement_code; - var $fk_account; - var $mode_reglement_id; - var $mode_reglement_code; + public $note; + public $note_private; + public $note_public; + public $propalid; + public $cond_reglement_id; + public $cond_reglement_code; + public $fk_account; + public $mode_reglement_id; + public $mode_reglement_code; /** * Invoice lines @@ -110,29 +112,82 @@ class FactureFournisseur extends CommonInvoice /** * @deprecated */ - var $fournisseur; + public $fournisseur; //Incorterms - var $fk_incoterms; - var $location_incoterms; - var $libelle_incoterms; //Used into tooltip + public $fk_incoterms; + public $location_incoterms; + public $libelle_incoterms; //Used into tooltip - var $extraparams=array(); + public $extraparams=array(); // Multicurrency - var $fk_multicurrency; - var $multicurrency_code; - var $multicurrency_tx; - var $multicurrency_total_ht; - var $multicurrency_total_tva; - var $multicurrency_total_ttc; - + public $fk_multicurrency; + public $multicurrency_code; + public $multicurrency_tx; + public $multicurrency_total_ht; + public $multicurrency_total_tva; + public $multicurrency_total_ttc; + + /** + * Standard invoice + */ + const TYPE_STANDARD = 0; + + /** + * Replacement invoice + */ + const TYPE_REPLACEMENT = 1; + + /** + * Credit note invoice + */ + const TYPE_CREDIT_NOTE = 2; + + /** + * Deposit invoice + */ + const TYPE_DEPOSIT = 3; + + /** + * Draft + */ + const STATUS_DRAFT = 0; + + /** + * Validated (need to be paid) + */ + const STATUS_VALIDATED = 1; + + /** + * Classified paid. + * If paid partially, $this->close_code can be: + * - CLOSECODE_DISCOUNTVAT + * - CLOSECODE_BADDEBT + * If paid completelly, this->close_code will be null + */ + const STATUS_CLOSED = 2; + + /** + * Classified abandoned and no payment done. + * $this->close_code can be: + * - CLOSECODE_BADDEBT + * - CLOSECODE_ABANDONED + * - CLOSECODE_REPLACED + */ + const STATUS_ABANDONED = 3; + + const CLOSECODE_DISCOUNTVAT = 'discount_vat'; + const CLOSECODE_BADCREDIT = 'badsupplier'; + const CLOSECODE_ABANDONED = 'abandon'; + const CLOSECODE_REPLACED = 'replaced'; + /** * Constructor * * @param DoliDB $db Database handler */ - function __construct($db) + public function __construct($db) { $this->db = $db; @@ -155,7 +210,7 @@ class FactureFournisseur extends CommonInvoice * @param User $user object utilisateur qui cree * @return int id facture si ok, < 0 si erreur */ - function create($user) + public function create($user) { global $langs,$conf,$hookmanager; @@ -164,6 +219,7 @@ class FactureFournisseur extends CommonInvoice // Clean parameters if (isset($this->ref_supplier)) $this->ref_supplier=trim($this->ref_supplier); + if (empty($this->type)) $this->type = self::TYPE_STANDARD; if (empty($this->date)) $this->date=$now; $socid = $this->socid; @@ -190,6 +246,7 @@ class FactureFournisseur extends CommonInvoice $sql.= "ref"; $sql.= ", ref_supplier"; $sql.= ", entity"; + $sql.= ", type"; $sql.= ", libelle"; $sql.= ", fk_soc"; $sql.= ", datec"; @@ -211,6 +268,7 @@ class FactureFournisseur extends CommonInvoice $sql.= "'(PROV)'"; $sql.= ", '".$this->db->escape($this->ref_supplier)."'"; $sql.= ", ".$conf->entity; + $sql.= ", '".$this->db->escape($this->type)."'"; $sql.= ", '".$this->db->escape($this->libelle)."'"; $sql.= ", ".$this->socid; $sql.= ", '".$this->db->idate($now)."'"; @@ -355,7 +413,7 @@ class FactureFournisseur extends CommonInvoice * @param string $ref Ref supplier invoice * @return int <0 if KO, >0 if OK, 0 if not found */ - function fetch($id='',$ref='') + public function fetch($id='',$ref='') { global $langs; @@ -378,7 +436,7 @@ class FactureFournisseur extends CommonInvoice $sql.= " t.tva,"; $sql.= " t.localtax1,"; $sql.= " t.localtax2,"; - $sql.= " t.total,"; + //$sql.= " t.total,"; $sql.= " t.total_ht,"; $sql.= " t.total_tva,"; $sql.= " t.total_ttc,"; @@ -439,7 +497,7 @@ class FactureFournisseur extends CommonInvoice $this->tva = $obj->tva; $this->total_localtax1 = $obj->localtax1; $this->total_localtax2 = $obj->localtax2; - $this->total = $obj->total; + //$this->total = $obj->total; $this->total_ht = $obj->total_ht; $this->total_tva = $obj->total_tva; $this->total_ttc = $obj->total_ttc; @@ -526,7 +584,7 @@ class FactureFournisseur extends CommonInvoice */ function fetch_lines() { - $sql = 'SELECT f.rowid, f.ref as ref_supplier, f.description, f.pu_ht, f.pu_ttc, f.qty, f.remise_percent, f.tva_tx'; + $sql = 'SELECT f.rowid, f.ref as ref_supplier, f.description, f.pu_ht, f.pu_ttc, f.qty, f.remise_percent, f.vat_src_code, f.tva_tx'; $sql.= ', f.localtax1_tx, f.localtax2_tx, f.total_localtax1, f.total_localtax2 '; $sql.= ', f.total_ht, f.tva as total_tva, f.total_ttc, f.fk_product, f.product_type, f.info_bits, f.rang, f.special_code, f.fk_parent_line, f.fk_unit'; $sql.= ', p.rowid as product_id, p.ref as product_ref, p.label as label, p.description as product_desc'; @@ -551,7 +609,7 @@ class FactureFournisseur extends CommonInvoice $line = new SupplierInvoiceLine($this->db); $line->id = $obj->rowid; - $line->rowid = $obj->rowid; + $line->rowid = $obj->rowid; $line->description = $obj->description; $line->product_ref = $obj->product_ref; $line->ref = $obj->product_ref; @@ -560,27 +618,29 @@ class FactureFournisseur extends CommonInvoice $line->label = $obj->label; $line->product_desc = $obj->product_desc; $line->subprice = $obj->pu_ht; - $line->pu_ht = $obj->pu_ht; + $line->pu_ht = $obj->pu_ht; $line->pu_ttc = $obj->pu_ttc; + + $line->vat_src_code = $obj->vat_src_code; $line->tva_tx = $obj->tva_tx; $line->localtax1_tx = $obj->localtax1_tx; $line->localtax2_tx = $obj->localtax2_tx; $line->qty = $obj->qty; - $line->remise_percent = $obj->remise_percent; + $line->remise_percent = $obj->remise_percent; $line->tva = $obj->total_tva; $line->total_ht = $obj->total_ht; - $line->total_tva = $obj->total_tva; + $line->total_tva = $obj->total_tva; $line->total_localtax1 = $obj->total_localtax1; $line->total_localtax2 = $obj->total_localtax2; - $line->total_ttc = $obj->total_ttc; + $line->total_ttc = $obj->total_ttc; $line->fk_product = $obj->fk_product; $line->product_type = $obj->product_type; - $line->product_label = $obj->label; - $line->info_bits = $obj->info_bits; - $line->fk_parent_line = $obj->fk_parent_line; + $line->product_label = $obj->label; + $line->info_bits = $obj->info_bits; + $line->fk_parent_line = $obj->fk_parent_line; $line->special_code = $obj->special_code; $line->rang = $obj->rang; - $line->fk_unit = $obj->fk_unit; + $line->fk_unit = $obj->fk_unit; // Multicurrency $line->fk_multicurrency = $obj->fk_multicurrency; @@ -613,12 +673,13 @@ class FactureFournisseur extends CommonInvoice * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, >0 if OK */ - function update($user=null, $notrigger=0) + public function update($user=null, $notrigger=0) { global $conf, $langs; $error=0; // Clean parameters + if (empty($this->type)) $this->type= self::TYPE_STANDARD; if (isset($this->ref)) $this->ref=trim($this->ref); if (isset($this->ref_supplier)) $this->ref_supplier=trim($this->ref_supplier); if (isset($this->entity)) $this->entity=trim($this->entity); @@ -741,7 +802,7 @@ class FactureFournisseur extends CommonInvoice * @param int $rowid Id of invoice to delete * @return int <0 if KO, >0 if OK */ - function delete($rowid) + public function delete($rowid) { global $user,$langs,$conf; @@ -856,10 +917,12 @@ class FactureFournisseur extends CommonInvoice /** * Tag invoice as a payed invoice * - * @param User $user Object user - * @return int <0 si ko, >0 si ok + * @param User $user Object user + * @param string $close_code Code renseigne si on classe a payee completement alors que paiement incomplet. Not implementd yet. + * @param string $close_note Commentaire renseigne si on classe a payee alors que paiement incomplet. Not implementd yet. + * @return int <0 si ko, >0 si ok */ - function set_paid($user) + function set_paid($user, $close_code='', $close_note='') { global $conf,$langs; $error=0; @@ -952,10 +1015,10 @@ class FactureFournisseur extends CommonInvoice * @param User $user Object user that validate * @param string $force_number Reference to force on invoice * @param int $idwarehouse Id of warehouse for stock change - * @param int $notrigger 1=Does not execute triggers, 0= execuete triggers + * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, =0 if nothing to do, >0 if OK */ - function validate($user, $force_number='', $idwarehouse=0, $notrigger=0) + public function validate($user, $force_number='', $idwarehouse=0, $notrigger=0) { global $conf,$langs; @@ -971,7 +1034,7 @@ class FactureFournisseur extends CommonInvoice // Check parameters if (preg_match('/^'.preg_quote($langs->trans("CopyOf").' ').'/', $this->ref_supplier)) { - $this->error=$langs->trans("ErrorFieldFormat",$langs->transnoentities("RefSupplier")); + $this->error=$langs->trans("ErrorFieldFormat",$langs->transnoentities("RefSupplier")).'. '.$langs->trans('RemoveString',$langs->transnoentitiesnoconv("CopyOf")); return -1; } @@ -1011,6 +1074,7 @@ class FactureFournisseur extends CommonInvoice { if ($this->lines[$i]->fk_product > 0) { + $this->line = $this->lines[$i]; $mouvP = new MouvementStock($this->db); $mouvP->origin = &$this; // We increase stock for product @@ -1018,6 +1082,7 @@ class FactureFournisseur extends CommonInvoice if (! empty($this->lines[$i]->remise_percent) && empty($conf->global->STOCK_EXCLUDE_DISCOUNT_FOR_PMP)) $up_ht_disc=price2num($up_ht_disc * (100 - $this->lines[$i]->remise_percent) / 100, 'MU'); $result=$mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $up_ht_disc, $langs->trans("InvoiceValidatedInDolibarr",$num)); if ($result < 0) { $error++; } + unset($this->line); } } } @@ -1178,7 +1243,7 @@ class FactureFournisseur extends CommonInvoice * * @param string $desc Description de la ligne * @param double $pu Prix unitaire (HT ou TTC selon price_base_type, > 0 even for credit note) - * @param double $txtva Taux de tva force, sinon -1 + * @param double $txtva Force Vat rate to use, -1 for auto. * @param double $txlocaltax1 LocalTax1 Rate * @param double $txlocaltax2 LocalTax2 Rate * @param double $qty Quantite @@ -1194,14 +1259,16 @@ class FactureFournisseur extends CommonInvoice * @param int $notrigger Disable triggers * @param array $array_options extrafields array * @param string $fk_unit Code of the unit to use. Null to use the default one + * @param int $origin_id id origin document * @return int >0 if OK, <0 if KO * * FIXME Add field ref (that should be named ref_supplier) and label into update. For example can be filled when product line created from order. */ - function addline($desc, $pu, $txtva, $txlocaltax1, $txlocaltax2, $qty, $fk_product=0, $remise_percent=0, $date_start='', $date_end='', $ventil=0, $info_bits='', $price_base_type='HT', $type=0, $rang=-1, $notrigger=false, $array_options=0, $fk_unit=null) + public function addline($desc, $pu, $txtva, $txlocaltax1, $txlocaltax2, $qty, $fk_product=0, $remise_percent=0, $date_start='', $date_end='', $ventil=0, $info_bits='', $price_base_type='HT', $type=0, $rang=-1, $notrigger=false, $array_options=0, $fk_unit=null, $origin_id=0) { dol_syslog(get_class($this)."::addline $desc,$pu,$qty,$txtva,$fk_product,$remise_percent,$date_start,$date_end,$ventil,$info_bits,$price_base_type,$type,$fk_unit", LOG_DEBUG); include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; + global $mysoc; // Clean parameters if (empty($remise_percent)) $remise_percent=0; @@ -1212,6 +1279,16 @@ class FactureFournisseur extends CommonInvoice if (empty($txtva)) $txtva=0; if (empty($txlocaltax1)) $txlocaltax1=0; if (empty($txlocaltax2)) $txlocaltax2=0; + + $localtaxes_type=getLocalTaxesFromRate($txtva, 0, $mysoc, $this->thirdparty); + + // Clean vat code + $vat_src_code=''; + if (preg_match('/\((.*)\)/', $txtva, $reg)) + { + $vat_src_code = $reg[1]; + $txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate. + } $remise_percent=price2num($remise_percent); $qty=price2num($qty); @@ -1220,52 +1297,92 @@ class FactureFournisseur extends CommonInvoice $txlocaltax1=price2num($txlocaltax1); $txlocaltax2=price2num($txlocaltax2); + $tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $this->thirdparty, $localtaxes_type, 100, $this->multicurrency_tx); + $total_ht = $tabprice[0]; + $total_tva = $tabprice[1]; + $total_ttc = $tabprice[2]; + $total_localtax1 = $tabprice[9]; + $total_localtax2 = $tabprice[10]; + + // MultiCurrency + $multicurrency_total_ht = $tabprice[16]; + $multicurrency_total_tva = $tabprice[17]; + $multicurrency_total_ttc = $tabprice[18]; + // Check parameters if ($type < 0) return -1; + // Insert line + $this->line=new SupplierInvoiceLine($this->db); - $this->db->begin(); + $this->line->context = $this->context; - $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'facture_fourn_det (fk_facture_fourn)'; - $sql.= ' VALUES ('.$this->id.')'; - dol_syslog(get_class($this)."::addline", LOG_DEBUG); + $this->line->fk_facture_fourn=$this->id; + //$this->line->label=$label; // deprecated + $this->line->desc=$desc; + $this->line->qty= ($this->type==self::TYPE_CREDIT_NOTE?abs($qty):$qty); // For credit note, quantity is always positive and unit price negative + + $this->line->vat_src_code=$vat_src_code; + $this->line->tva_tx=$txtva; + $this->line->localtax1_tx=$txlocaltax1; + $this->line->localtax2_tx=$txlocaltax2; + $this->line->fk_product=$fk_product; + $this->line->product_type=$type; + $this->line->remise_percent=$remise_percent; + $this->line->subprice= ($this->type==self::TYPE_CREDIT_NOTE?-abs($pu):$pu); // For credit note, unit price always negative, always positive otherwise + $this->line->date_start=$date_start; + $this->line->date_end=$date_end; + $this->line->ventil=$ventil; + $this->line->rang=$rang; + $this->line->info_bits=$info_bits; + $this->line->total_ht= (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_ht):$total_ht); // For credit note and if qty is negative, total is negative + $this->line->total_tva= $total_tva; + $this->line->total_localtax1=$total_localtax1; + $this->line->total_localtax2=$total_localtax2; + $this->line->localtax1_type = $localtaxes_type[0]; + $this->line->localtax2_type = $localtaxes_type[2]; + $this->line->total_ttc= (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_ttc):$total_ttc); + $this->line->special_code=$this->special_code; + $this->line->fk_parent_line=$this->fk_parent_line; + $this->line->origin=$this->origin; + $this->line->origin_id=$origin_id; + $this->line->fk_unit=$fk_unit; - $resql = $this->db->query($sql); - if ($resql) + // Multicurrency + $this->line->fk_multicurrency = $this->fk_multicurrency; + $this->line->multicurrency_code = $this->multicurrency_code; + $this->line->multicurrency_subprice = price2num($this->line->subprice * $this->multicurrency_tx); + $this->line->multicurrency_total_ht = $multicurrency_total_ht; + $this->line->multicurrency_total_tva = $multicurrency_total_tva; + $this->line->multicurrency_total_ttc = $multicurrency_total_ttc; + + if (is_array($array_options) && count($array_options)>0) { + $this->line->array_options=$array_options; + } + + $result=$this->line->insert($notrigger); + if ($result > 0) { - $idligne = $this->db->last_insert_id(MAIN_DB_PREFIX.'facture_fourn_det'); + // Reorder if child line + if (! empty($fk_parent_line)) $this->line_order(true,'DESC'); - $result=$this->updateline($idligne, $desc, $pu, $txtva, $txlocaltax1, $txlocaltax2, $qty, $fk_product, $price_base_type, $info_bits, $type, $remise_percent, true, '', '', $array_options, $fk_unit); + // Mise a jour informations denormalisees au niveau de la facture meme + $result=$this->update_price(1,'auto',0,$mysoc); // The addline method is designed to add line from user input so total calculation with update_price must be done using 'auto' mode. if ($result > 0) { - $this->rowid = $idligne; - - if (! $notrigger) - { - global $conf, $langs, $user; - // Call trigger - $result=$this->call_trigger('LINEBILL_SUPPLIER_CREATE',$user); - if ($result < 0) - { - $this->db->rollback(); - return -1; - } - // End call triggers - } - $this->db->commit(); - return 1; + return $this->line->id; } else { - dol_syslog("Error after updateline error=".$this->error, LOG_ERR); + $this->error=$this->db->error(); $this->db->rollback(); return -1; } } else { - $this->error=$this->db->lasterror(); + $this->error=$this->line->error; $this->db->rollback(); return -2; } @@ -1293,7 +1410,7 @@ class FactureFournisseur extends CommonInvoice * @param string $fk_unit Code of the unit to use. Null to use the default one * @return int <0 if KO, >0 if OK */ - function updateline($id, $desc, $pu, $vatrate, $txlocaltax1=0, $txlocaltax2=0, $qty=1, $idproduct=0, $price_base_type='HT', $info_bits=0, $type=0, $remise_percent=0, $notrigger=false, $date_start='', $date_end='', $array_options=0, $fk_unit = null) + public function updateline($id, $desc, $pu, $vatrate, $txlocaltax1=0, $txlocaltax2=0, $qty=1, $idproduct=0, $price_base_type='HT', $info_bits=0, $type=0, $remise_percent=0, $notrigger=false, $date_start='', $date_end='', $array_options=0, $fk_unit = null) { global $mysoc; dol_syslog(get_class($this)."::updateline $id,$desc,$pu,$vatrate,$qty,$idproduct,$price_base_type,$info_bits,$type,$remise_percent,$fk_unit", LOG_DEBUG); @@ -1315,13 +1432,22 @@ class FactureFournisseur extends CommonInvoice $txlocaltax1=price2num($txlocaltax1); $txlocaltax2=price2num($txlocaltax2); + $localtaxes_type = array($txlocaltax1,$txlocaltax2); + // Calcul du total TTC et de la TVA pour la ligne a partir de // qty, pu, remise_percent et txtva // TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker // la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva. $localtaxes_type=getLocalTaxesFromRate($vatrate,0,$mysoc, $this->thirdparty); - $vatrate = preg_replace('/\s*\(.*\)/','',$vatrate); // Remove code into vatrate. + + // Clean vat code + $vat_src_code=''; + if (preg_match('/\((.*)\)/', $vatrate, $reg)) + { + $vat_src_code = $reg[1]; + $vatrate = preg_replace('/\s*\(.*\)/', '', $vatrate); // Remove code into vatrate. + } $tabprice = calcul_price_total($qty, $pu, $remise_percent, $vatrate, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $this->thirdparty, $localtaxes_type, 100, $this->multicurrency_tx); $total_ht = $tabprice[0]; @@ -1363,6 +1489,8 @@ class FactureFournisseur extends CommonInvoice $line->pu_ttc = $pu_ttc; $line->qty = $qty; $line->remise_percent = $remise_percent; + + $line->vat_src_code=$vat_src_code; $line->tva_tx = $vatrate; $line->localtax1_tx = $txlocaltax1; $line->localtax2_tx = $txlocaltax2; @@ -1404,7 +1532,7 @@ class FactureFournisseur extends CommonInvoice * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ - function deleteline($rowid, $notrigger=0) + public function deleteline($rowid, $notrigger=0) { if (!$rowid) { $rowid = $this->id; @@ -1434,7 +1562,7 @@ class FactureFournisseur extends CommonInvoice * @param int $id Id de la facture a charger * @return void */ - function info($id) + public function info($id) { $sql = 'SELECT c.rowid, datec, tms as datem, '; $sql.= ' fk_user_author, fk_user_modif, fk_user_valid'; @@ -1478,6 +1606,101 @@ class FactureFournisseur extends CommonInvoice } } + /** + * Renvoi liste des factures remplacables + * Statut validee ou abandonnee pour raison autre + non payee + aucun paiement + pas deja remplacee + * + * @param int $socid Id societe + * @return array Tableau des factures ('id'=>id, 'ref'=>ref, 'status'=>status, 'paymentornot'=>0/1) + */ + function list_replacable_supplier_invoices($socid=0) + { + global $conf; + + $return = array(); + + $sql = "SELECT f.rowid as rowid, f.ref, f.fk_statut,"; + $sql.= " ff.rowid as rowidnext"; + $sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn as f"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiementfourn_facturefourn as pf ON f.rowid = pf.fk_facturefourn"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture_fourn as ff ON f.rowid = ff.fk_facture_source"; + $sql.= " WHERE (f.fk_statut = ".self::STATUS_VALIDATED." OR (f.fk_statut = ".self::STATUS_ABANDONED." AND f.close_code = '".self::CLOSECODE_ABANDONED."'))"; + $sql.= " AND f.entity = ".$conf->entity; + $sql.= " AND f.paye = 0"; // Pas classee payee completement + $sql.= " AND pf.fk_paiementfourn IS NULL"; // Aucun paiement deja fait + $sql.= " AND ff.fk_statut IS NULL"; // Renvoi vrai si pas facture de remplacement + if ($socid > 0) $sql.=" AND f.fk_soc = ".$socid; + $sql.= " ORDER BY f.ref"; + + dol_syslog(get_class($this)."::list_replacable_supplier_invoices", LOG_DEBUG); + $resql=$this->db->query($sql); + if ($resql) + { + while ($obj=$this->db->fetch_object($resql)) + { + $return[$obj->rowid]=array( 'id' => $obj->rowid, + 'ref' => $obj->ref, + 'status' => $obj->fk_statut); + } + //print_r($return); + return $return; + } + else + { + $this->error=$this->db->error(); + return -1; + } + } + + /** + * Renvoi liste des factures qualifiables pour correction par avoir + * Les factures qui respectent les regles suivantes sont retournees: + * (validee + paiement en cours) ou classee (payee completement ou payee partiellement) + pas deja remplacee + pas deja avoir + * + * @param int $socid Id societe + * @return array Tableau des factures ($id => array('ref'=>,'paymentornot'=>,'status'=>,'paye'=>) + */ + function list_qualified_avoir_supplier_invoices($socid=0) + { + global $conf; + + $return = array(); + + $sql = "SELECT f.rowid as rowid, f.ref, f.fk_statut, f.type, f.paye, pf.fk_paiementfourn"; + $sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn as f"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiementfourn_facturefourn as pf ON f.rowid = pf.fk_facturefourn"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture_fourn as ff ON (f.rowid = ff.fk_facture_source AND ff.type=".self::TYPE_REPLACEMENT.")"; + $sql.= " WHERE f.entity = ".$conf->entity; + $sql.= " AND f.fk_statut in (".self::STATUS_VALIDATED.",".self::STATUS_CLOSED.")"; + $sql.= " AND ff.type IS NULL"; // Renvoi vrai si pas facture de remplacement + $sql.= " AND f.type != ".self::TYPE_CREDIT_NOTE; // Type non 2 si facture non avoir + if ($socid > 0) $sql.=" AND f.fk_soc = ".$socid; + $sql.= " ORDER BY f.ref"; + + dol_syslog(get_class($this)."::list_qualified_avoir_supplier_invoices", LOG_DEBUG); + $resql=$this->db->query($sql); + if ($resql) + { + while ($obj=$this->db->fetch_object($resql)) + { + $qualified=0; + if ($obj->fk_statut == self::STATUS_VALIDATED) $qualified=1; + if ($obj->fk_statut == self::STATUS_CLOSED) $qualified=1; + if ($qualified) + { + $paymentornot=($obj->fk_paiementfourn?1:0); + $return[$obj->rowid]=array('ref'=>$obj->ref,'status'=>$obj->fk_statut,'type'=>$obj->type,'paye'=>$obj->paye,'paymentornot'=>$paymentornot); + } + } + + return $return; + } + else + { + $this->error=$this->db->error(); + return -1; + } + } /** * Load indicators for dashboard (this->nbtodo and this->nbtodolate) @@ -1539,15 +1762,28 @@ class FactureFournisseur extends CommonInvoice * Return clicable name (with picto eventually) * * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto - * @param string $option Sur quoi pointe le lien - * @param int $max Max length of shown ref - * @return string Chaine avec URL + * @param string $option Where point the link + * @param int $max Max length of shown ref + * @param int $short 1=Return just URL + * @param string $moretitle Add more text to title tooltip + * @return string String with URL */ - function getNomUrl($withpicto=0,$option='',$max=0) + public function getNomUrl($withpicto=0,$option='',$max=0,$short=0,$moretitle='') { - global $langs; + global $langs, $conf; $result=''; + + if ($option == 'document') $url = DOL_URL_ROOT.'/fourn/facture/document.php?facid='.$this->id; + else $url = DOL_URL_ROOT.'/fourn/facture/card.php?facid='.$this->id; + + if ($short) return $url; + + $picto='bill'; + if ($this->type == self::TYPE_REPLACEMENT) $picto.='r'; // Replacement invoice + if ($this->type == self::TYPE_CREDIT_NOTE) $picto.='a'; // Credit note + if ($this->type == self::TYPE_DEPOSIT) $picto.='d'; // Deposit invoice + $label = '' . $langs->trans("ShowSupplierInvoice") . ''; if (! empty($this->ref)) $label .= '
' . $langs->trans('Ref') . ': ' . $this->ref; @@ -1559,23 +1795,19 @@ class FactureFournisseur extends CommonInvoice $label.= '
' . $langs->trans('VAT') . ': ' . price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency); if (! empty($this->total_ttc)) $label.= '
' . $langs->trans('AmountTTC') . ': ' . price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); - - if ($option == 'document') - { - $link = ''; - $linkend=''; - } - else - { - $link = ''; - $linkend=''; - } + if ($this->type == self::TYPE_REPLACEMENT) $label=$langs->transnoentitiesnoconv("ShowInvoiceReplace").': '.$this->ref; + if ($this->type == self::TYPE_CREDIT_NOTE) $label=$langs->transnoentitiesnoconv("ShowInvoiceAvoir").': '.$this->ref; + if ($this->type == self::TYPE_DEPOSIT) $label=$langs->transnoentitiesnoconv("ShowInvoiceDeposit").': '.$this->ref; + if ($moretitle) $label.=' - '.$moretitle; $ref=$this->ref; if (empty($ref)) $ref=$this->id; - if ($withpicto) $result.=($link.img_object($label, 'bill', 'class="classfortooltip"').$linkend.' '); - $result.=$link.($max?dol_trunc($ref,$max):$ref).$linkend; + $linkstart=''; + $linkend=''; + + if ($withpicto) $result.=($linkstart.img_object($label, $picto, 'class="classfortooltip"').$linkend.' '); + $result.=$linkstart.($max?dol_trunc($ref,$max):$ref).$linkend; return $result; } @@ -1587,7 +1819,7 @@ class FactureFournisseur extends CommonInvoice * @param string $mode 'next' for next value or 'last' for last value * @return string free ref or last ref */ - function getNextNumRef($soc,$mode='next') + public function getNextNumRef($soc,$mode='next') { global $db, $langs, $conf; $langs->load("orders"); @@ -1640,14 +1872,15 @@ class FactureFournisseur extends CommonInvoice * * @return void */ - function initAsSpecimen() + public function initAsSpecimen() { global $langs,$conf; include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; $now = dol_now(); - // Charge tableau des produits prodids + // Load array of products prodids + $num_prods = 0; $prodids = array(); $sql = "SELECT rowid"; @@ -1779,7 +2012,7 @@ class FactureFournisseur extends CommonInvoice * @param int $invertdetail Reverse sign of amounts for lines * @return int New id of clone */ - function createFromClone($fromid,$invertdetail=0) + public function createFromClone($fromid,$invertdetail=0) { global $user,$langs; @@ -1858,7 +2091,7 @@ class FactureFournisseur extends CommonInvoice * @param int $hidedetails Hide details of lines * @param int $hidedesc Hide description * @param int $hideref Hide ref - * @return int 0 if KO, 1 if OK + * @return int <0 if KO, 0 if nothing done, >0 if OK */ public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) { @@ -1867,7 +2100,7 @@ class FactureFournisseur extends CommonInvoice $langs->load("suppliers"); // Set the model on the model name to use - if (! dol_strlen($modele)) + if (empty($modele)) { if (! empty($conf->global->INVOICE_SUPPLIER_ADDON_PDF)) { @@ -1875,13 +2108,20 @@ class FactureFournisseur extends CommonInvoice } else { - $modele = 'canelle'; + $modele = ''; // No default value. For supplier invoice, we allow to disable all PDF generation } } + + if (empty($modele)) + { + return 0; + } + else + { + $modelpath = "core/modules/supplier_invoice/pdf/"; - $modelpath = "core/modules/supplier_invoice/pdf/"; - - return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref); + return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref); + } } /** @@ -1941,7 +2181,7 @@ class SupplierInvoiceLine extends CommonObjectLine public $element='facture_fourn_det'; public $table_element='facture_fourn_det'; - var $oldline; + public $oldline; /** * @deprecated @@ -1998,22 +2238,22 @@ class SupplierInvoiceLine extends CommonObjectLine * Id of the corresponding supplier invoice * @var int */ - var $fk_facture_fourn; + public $fk_facture_fourn; /** * Product label * This field may contains label of product (when invoice create from order) * @var string */ - var $label; + public $label; /** * Description of the line * @var string */ - var $description; + public $description; - var $skip_update_total; // Skip update price total for special lines + public $skip_update_total; // Skip update price total for special lines /** * @var int Situation advance percentage @@ -2045,19 +2285,19 @@ class SupplierInvoiceLine extends CommonObjectLine public $localtax2_type; // Multicurrency - var $fk_multicurrency; - var $multicurrency_code; - var $multicurrency_subprice; - var $multicurrency_total_ht; - var $multicurrency_total_tva; - var $multicurrency_total_ttc; + public $fk_multicurrency; + public $multicurrency_code; + public $multicurrency_subprice; + public $multicurrency_total_ht; + public $multicurrency_total_tva; + public $multicurrency_total_ttc; /** * Constructor * * @param DoliDB $db Database handler */ - function __construct($db) + public function __construct($db) { $this->db= $db; } @@ -2229,6 +2469,7 @@ class SupplierInvoiceLine extends CommonObjectLine $sql.= ", pu_ttc = ".price2num($this->pu_ttc); $sql.= ", qty = ".price2num($this->qty); $sql.= ", remise_percent = ".price2num($this->remise_percent); + $sql.= ", vat_src_code = '".(empty($this->vat_src_code)?'':$this->vat_src_code)."'"; $sql.= ", tva_tx = ".price2num($this->tva_tx); $sql.= ", localtax1_tx = ".price2num($this->localtax1_tx); $sql.= ", localtax2_tx = ".price2num($this->localtax2_tx); @@ -2291,5 +2532,179 @@ class SupplierInvoiceLine extends CommonObjectLine $this->db->commit(); return 1; } -} + /** + * Insert line into database + * + * @param int $notrigger 1 no triggers + * @return int <0 if KO, >0 if OK + */ + public function insert($notrigger=0) + { + global $user,$conf; + + $error=0; + + dol_syslog(get_class($this)."::insert rang=".$this->rang, LOG_DEBUG); + + // Clean parameters + $this->desc=trim($this->desc); + if (empty($this->tva_tx)) $this->tva_tx=0; + if (empty($this->localtax1_tx)) $this->localtax1_tx=0; + if (empty($this->localtax2_tx)) $this->localtax2_tx=0; + if (empty($this->localtax1_type)) $this->localtax1_type=0; + if (empty($this->localtax2_type)) $this->localtax2_type=0; + if (empty($this->total_localtax1)) $this->total_localtax1=0; + if (empty($this->total_localtax2)) $this->total_localtax2=0; + if (empty($this->rang)) $this->rang=0; + if (empty($this->remise_percent)) $this->remise_percent=0; + if (empty($this->info_bits)) $this->info_bits=0; + if (empty($this->subprice)) $this->subprice=0; + if (empty($this->special_code)) $this->special_code=0; + if (empty($this->fk_parent_line)) $this->fk_parent_line=0; + if (! isset($this->situation_percent) || $this->situation_percent > 100 || (string) $this->situation_percent == '') $this->situation_percent = 100; + + if (empty($this->pa_ht)) $this->pa_ht=0; + if (empty($this->multicurrency_subprice)) $this->multicurrency_subprice=0; + if (empty($this->multicurrency_total_ht)) $this->multicurrency_total_ht=0; + if (empty($this->multicurrency_total_tva)) $this->multicurrency_total_tva=0; + if (empty($this->multicurrency_total_ttc)) $this->multicurrency_total_ttc=0; + + + // Check parameters + if ($this->product_type < 0) + { + $this->error='ErrorProductTypeMustBe0orMore'; + return -1; + } + if (! empty($this->fk_product)) + { + // Check product exists + $result=Product::isExistingObject('product', $this->fk_product); + if ($result <= 0) + { + $this->error='ErrorProductIdDoesNotExists'; + return -1; + } + } + + $this->db->begin(); + + // Insertion dans base de la ligne + $sql = 'INSERT INTO '.MAIN_DB_PREFIX.$this->table_element; + $sql.= ' (fk_facture_fourn, fk_parent_line, label, description, qty,'; + $sql.= ' vat_src_code, tva_tx, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type,'; + $sql.= ' fk_product, product_type, remise_percent, pu_ht, pu_ttc,'; + $sql.= ' date_start, date_end, fk_code_ventilation, rang, special_code,'; + $sql.= ' info_bits, total_ht, tva, total_ttc, total_localtax1, total_localtax2, fk_unit'; + $sql.= ', fk_multicurrency, multicurrency_code, multicurrency_subprice, multicurrency_total_ht, multicurrency_total_tva, multicurrency_total_ttc'; + $sql.= ')'; + $sql.= " VALUES (".$this->fk_facture_fourn.","; + $sql.= " ".($this->fk_parent_line>0?"'".$this->fk_parent_line."'":"null").","; + $sql.= " ".(! empty($this->label)?"'".$this->db->escape($this->label)."'":"null").","; + $sql.= " '".$this->db->escape($this->desc)."',"; + $sql.= " ".price2num($this->qty).","; + $sql.= " ".(empty($this->vat_src_code)?"''":"'".$this->vat_src_code."'").","; + $sql.= " ".price2num($this->tva_tx).","; + $sql.= " ".price2num($this->localtax1_tx).","; + $sql.= " ".price2num($this->localtax2_tx).","; + $sql.= " '".$this->localtax1_type."',"; + $sql.= " '".$this->localtax2_type."',"; + $sql.= ' '.(! empty($this->fk_product)?$this->fk_product:"null").','; + $sql.= " ".$this->product_type.","; + $sql.= " ".price2num($this->remise_percent).","; + $sql.= " ".price2num($this->subprice).","; + $sql.= " ".price2num($this->total_ttc/$this->qty).","; + $sql.= " ".(! empty($this->date_start)?"'".$this->db->idate($this->date_start)."'":"null").","; + $sql.= " ".(! empty($this->date_end)?"'".$this->db->idate($this->date_end)."'":"null").","; + $sql.= ' '.(!empty($this->fk_code_ventilation)?$this->fk_code_ventilation:0).','; + $sql.= ' '.$this->rang.','; + $sql.= ' '.$this->special_code.','; + $sql.= " '".$this->info_bits."',"; + $sql.= " ".price2num($this->total_ht).","; + $sql.= " ".price2num($this->total_tva).","; + $sql.= " ".price2num($this->total_ttc).","; + $sql.= " ".price2num($this->total_localtax1).","; + $sql.= " ".price2num($this->total_localtax2); + $sql .= ", ".(!$this->fk_unit ? 'NULL' : $this->fk_unit); + $sql.= ", ".(int) $this->fk_multicurrency; + $sql.= ", '".$this->db->escape($this->multicurrency_code)."'"; + $sql.= ", ".price2num($this->multicurrency_subprice); + $sql.= ", ".price2num($this->multicurrency_total_ht); + $sql.= ", ".price2num($this->multicurrency_total_tva); + $sql.= ", ".price2num($this->multicurrency_total_ttc); + $sql.= ')'; + + dol_syslog(get_class($this)."::insert", LOG_DEBUG); + $resql=$this->db->query($sql); + if ($resql) + { + $this->id=$this->db->last_insert_id(MAIN_DB_PREFIX.$this->table_element); + $this->rowid=$this->id; + + if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + { + $result=$this->insertExtraFields(); + if ($result < 0) + { + $error++; + } + } + + if (! $notrigger) + { + // Call trigger + $result=$this->call_trigger('LINEBILL_SUPPLIER_CREATE',$user); + if ($result < 0) + { + $this->db->rollback(); + return -2; + } + // End call triggers + } + + $this->db->commit(); + return $this->id; + + } + else + { + $this->error=$this->db->error(); + $this->db->rollback(); + return -2; + } + } + /** + * Mise a jour de l'objet ligne de commande en base + * + * @return int <0 si ko, >0 si ok + */ + function update_total() + { + $this->db->begin(); + + // Mise a jour ligne en base + $sql = "UPDATE ".MAIN_DB_PREFIX."facture_fourn_det SET"; + $sql.= " total_ht='".price2num($this->total_ht)."'"; + $sql.= ", tva='".price2num($this->total_tva)."'"; + $sql.= ", total_localtax1='".price2num($this->total_localtax1)."'"; + $sql.= ", total_localtax2='".price2num($this->total_localtax2)."'"; + $sql.= ", total_ttc='".price2num($this->total_ttc)."'"; + $sql.= " WHERE rowid = ".$this->rowid; + + dol_syslog("FactureFournisseurLigne.class.php::update_total", LOG_DEBUG); + + $resql=$this->db->query($sql); + if ($resql) + { + $this->db->commit(); + return 1; + } + else + { + $this->error=$this->db->error(); + $this->db->rollback(); + return -2; + } + } + } diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index e9a67a0e98e..e59144abc2e 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -6,8 +6,6 @@ * Copyright (C) 2012 Christophe Battarel * Copyright (C) 2015 Marcos García * Copyright (C) 2016 Charlie Benke - - status * * 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 @@ -523,9 +521,10 @@ class ProductFournisseur extends Product * * @param int $prodid Product id * @param int $qty Minimum quantity + * @param int $socid get min price for specific supplier * @return int <0 if KO, 0=Not found of no product id provided, >0 if OK */ - function find_min_price_product_fournisseur($prodid, $qty=0) + function find_min_price_product_fournisseur($prodid, $qty=0, $socid=0) { global $conf; @@ -558,6 +557,7 @@ class ProductFournisseur extends Product $sql.= " AND pfp.fk_soc = s.rowid"; $sql.= " AND s.status = 1"; // only enabled society if ($qty > 0) $sql.= " AND pfp.quantity <= ".$qty; + if ($socid > 0) $sql.= ' AND pfp.fk_soc = '.$socid; dol_syslog(get_class($this)."::find_min_price_product_fournisseur", LOG_DEBUG); diff --git a/htdocs/fourn/class/paiementfourn.class.php b/htdocs/fourn/class/paiementfourn.class.php index 78bdab0f6c5..738c0eb716f 100644 --- a/htdocs/fourn/class/paiementfourn.class.php +++ b/htdocs/fourn/class/paiementfourn.class.php @@ -130,7 +130,7 @@ class PaiementFourn extends Paiement * @param int $closepaidinvoices 1=Also close payed invoices to paid, 0=Do nothing more * @return int id of created payment, < 0 if error */ - function create($user,$closepaidinvoices=0) + function create($user, $closepaidinvoices=0) { global $langs,$conf; @@ -141,6 +141,8 @@ class PaiementFourn extends Paiement $totalamount = 0; $totalamount_converted = 0; + dol_syslog(get_class($this)."::create", LOG_DEBUG); + if ($way == 'dolibarr') { $amounts = &$this->amounts; @@ -188,7 +190,6 @@ class PaiementFourn extends Paiement $sql.= " VALUES ('".$this->db->escape($ref)."', ".$conf->entity.", '".$this->db->idate($now)."',"; $sql.= " '".$this->db->idate($this->datepaye)."', '".$total."', '".$mtotal."', ".$this->paiementid.", '".$this->num_paiement."', '".$this->db->escape($this->note)."', ".$user->id.", 0)"; - dol_syslog("PaiementFourn::create", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -220,7 +221,7 @@ class PaiementFourn extends Paiement $remaintopay=price2num($invoice->total_ttc - $paiement - $creditnotes - $deposits,'MT'); if ($remaintopay == 0) { - $result=$invoice->set_paid($user,'',''); + $result=$invoice->set_paid($user, '', ''); } else dol_syslog("Remain to pay for invoice ".$facid." not null. We do nothing."); } diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index c940486d73b..828809d43d3 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -100,8 +100,8 @@ $extralabels=$extrafields->fetch_name_optionals_label($object->table_element); // Load object if ($id > 0 || ! empty($ref)) { - $ret = $object->fetch($id, $ref); - if ($ret < 0) dol_print_error($db,$object->error); + $ret = $object->fetch($id, $ref); + if ($ret < 0) dol_print_error($db,$object->error); $ret = $object->fetch_thirdparty(); if ($ret < 0) dol_print_error($db,$object->error); } @@ -140,9 +140,8 @@ if (empty($reshook)) if ($action == 'setref_supplier' && $user->rights->fournisseur->commande->creer) { - $result=$object->setValueFrom('ref_supplier',GETPOST('ref_supplier','alpha')); + $result=$object->setValueFrom('ref_supplier', GETPOST('ref_supplier','alpha'), '', null, 'text', '', $user, 'ORDER_SUPPLIER_MODIFY'); if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); - else $object->ref_supplier = GETPOST('ref_supplier','alpha'); // The setValueFrom does not set new property of object } // Set incoterm @@ -165,7 +164,7 @@ if (empty($reshook)) $result = $object->setPaymentMethods(GETPOST('mode_reglement_id','int')); if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); } - + // Multicurrency Code else if ($action == 'setmulticurrencycode' && $user->rights->fournisseur->commande->creer) { $result = $object->setMulticurrencyCode(GETPOST('multicurrency_code', 'alpha')); @@ -173,7 +172,7 @@ if (empty($reshook)) // Multicurrency rate else if ($action == 'setmulticurrencyrate' && $user->rights->fournisseur->commande->creer) { - $result = $object->setMulticurrencyRate(GETPOST('multicurrency_tx', 'int')); + $result = $object->setMulticurrencyRate(price2num(GETPOST('multicurrency_tx'))); } // bank account @@ -218,13 +217,13 @@ if (empty($reshook)) //$newstatus=3; // Submited // TODO If there is at least one reception, we can set to Received->Received partially $newstatus=4; // Received partially - + } else if ($object->statut == 6) $newstatus=2; // Canceled->Approved else if ($object->statut == 7) $newstatus=3; // Canceled->Process running else if ($object->statut == 9) $newstatus=1; // Refused->Validated else $newstatus = 2; - + //print "old status = ".$object->statut.' new status = '.$newstatus; $db->begin(); @@ -237,7 +236,7 @@ if (empty($reshook)) $sql.= ' WHERE rowid = '.$object->id; $resql=$db->query($sql); - + if ($newstatus == 0) { $sql = 'UPDATE '.MAIN_DB_PREFIX.'commande_fournisseur'; @@ -272,11 +271,11 @@ if (empty($reshook)) } } - /* - * Add a line into product - */ + // Add a product line if ($action == 'addline' && $user->rights->fournisseur->commande->creer) { + $db->begin(); + $langs->load('errors'); $error = 0; @@ -351,7 +350,7 @@ if (empty($reshook)) $idprod=0; if (GETPOST('idprodfournprice') == -1 || GETPOST('idprodfournprice') == '') $idprod=-99; // Same behaviour than with combolist. When not select idprodfournprice is now -99 (to avoid conflict with next action that may return -1, -2, ...) } - + if (GETPOST('idprodfournprice') > 0) { $idprod=$productsupplier->get_buyprice(GETPOST('idprodfournprice'), $qty); // Just to see if a price exists for the quantity. Not used to found vat. @@ -367,7 +366,7 @@ if (empty($reshook)) if (trim($product_desc) != trim($desc)) $desc = dol_concatdesc($desc, $product_desc); $type = $productsupplier->type; - + $tva_tx = get_default_tva($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice')); $tva_npr = get_default_npr($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice')); if (empty($tva_tx)) $tva_npr=0; @@ -411,7 +410,7 @@ if (empty($reshook)) setEventMessages($langs->trans("ErrorQtyTooLowForThisSupplier"), null, 'errors'); } } - else if((GETPOST('price_ht')!=='' || GETPOST('price_ttc')!=='') && empty($error)) + else if ((GETPOST('price_ht')!=='' || GETPOST('price_ttc')!=='') && empty($error)) { $pu_ht = price2num($price_ht, 'MU'); $pu_ttc = price2num(GETPOST('price_ttc'), 'MU'); @@ -426,8 +425,8 @@ if (empty($reshook)) $tva_tx = price2num($tva_tx); // When vat is text input field // Local Taxes - $localtax1_tx= get_localtax($tva_tx, 1,$mysoc,$object->thirdparty); - $localtax2_tx= get_localtax($tva_tx, 2,$mysoc,$object->thirdparty); + $localtax1_tx= get_localtax($tva_tx, 1, $mysoc, $object->thirdparty); + $localtax2_tx= get_localtax($tva_tx, 2, $mysoc, $object->thirdparty); if (GETPOST('price_ht')!=='') { @@ -448,6 +447,8 @@ if (empty($reshook)) //print "xx".$tva_tx; exit; if (! $error && $result > 0) { + $db->commit(); + $ret=$object->fetch($object->id); // Reload to get new records // Define output language @@ -501,8 +502,11 @@ if (empty($reshook)) } else { + $db->rollback(); setEventMessages($object->error, $object->errors, 'errors'); } + + $action = ''; } /* @@ -763,7 +767,7 @@ if (empty($reshook)) $result = $object->commande($user, $_REQUEST["datecommande"], $_REQUEST["methode"], $_REQUEST['comment']); if ($result > 0) { - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { $outputlangs = $langs; $newlang = ''; @@ -831,7 +835,7 @@ if (empty($reshook)) { $date_liv = dol_mktime(GETPOST('rehour'),GETPOST('remin'),GETPOST('resec'),GETPOST("remonth"),GETPOST("reday"),GETPOST("reyear")); - $result = $object->Livraison($user, $date_liv, GETPOST("type"), GETPOST("comment")); + $result = $object->Livraison($user, $date_liv, GETPOST("type"), GETPOST("comment")); // GETPOST("type") is 'tot', 'par', 'nev', 'can' if ($result > 0) { $langs->load("deliveries"); @@ -871,8 +875,8 @@ if (empty($reshook)) { // Build document - // Save last template used to generate document - if (GETPOST('model')) $object->setDocModel($user, GETPOST('model','alpha')); + // Save last template used to generate document + if (GETPOST('model')) $object->setDocModel($user, GETPOST('model','alpha')); $outputlangs = $langs; if (GETPOST('lang_id')) @@ -883,7 +887,7 @@ if (empty($reshook)) $result= $object->generateDocument($object->modelpdf,$outputlangs, $hidedetails, $hidedesc, $hideref); if ($result <= 0) { - setEventMessages($object->error, $object->errors, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); $action=''; } } @@ -971,6 +975,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'); + $object->fk_project = GETPOST('projectid'); // Fill array 'array_options' with data from add form if (! $error) @@ -993,7 +998,7 @@ if (empty($reshook)) $element = 'supplier_proposal'; $subelement = 'supplier_proposal'; } - + $object->origin = $origin; $object->origin_id = $originid; @@ -1030,7 +1035,7 @@ if (empty($reshook)) $num = count($lines); $productsupplier = new ProductFournisseur($db); - + for($i = 0; $i < $num; $i ++) { @@ -1040,12 +1045,12 @@ if (empty($reshook)) $label = (! empty($lines[$i]->label) ? $lines[$i]->label : ''); $desc = (! empty($lines[$i]->desc) ? $lines[$i]->desc : $lines[$i]->libelle); $product_type = (! empty($lines[$i]->product_type) ? $lines[$i]->product_type : 0); - + // Reset fk_parent_line for no child products and special product if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9) { $fk_parent_line = 0; } - + // Extrafields if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) // For avoid conflicts if // trigger used @@ -1054,18 +1059,18 @@ if (empty($reshook)) $array_option = $lines[$i]->array_options; } - $result = $productsupplier->find_min_price_product_fournisseur($lines[$i]->fk_product, $lines[$i]->qty); - if ($result>=0) + $result = $productsupplier->find_min_price_product_fournisseur($lines[$i]->fk_product, $lines[$i]->qty, $srcobject->socid); + if ($result>=0) { $tva_tx = $lines[$i]->tva_tx; - + if ($origin=="commande") { $soc=new societe($db); $soc->fetch($socid); $tva_tx=get_default_tva($soc, $mysoc, $lines[$i]->fk_product, $productsupplier->product_fourn_price_id); } - + $result = $object->addline( $desc, $lines[$i]->subprice, @@ -1088,7 +1093,7 @@ if (empty($reshook)) $lines[$i]->fk_unit ); } - + if ($result < 0) { $error++; break; @@ -1101,8 +1106,8 @@ if (empty($reshook)) } // Add link between elements - - + + // Hooks $parameters = array('objFrom' => $srcobject); $reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action); // Note that $action and $object may have been @@ -1145,190 +1150,18 @@ if (empty($reshook)) } } - /* - * Add file in email form - */ - if (GETPOST('addfile')) - { - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - - // Set tmp user directory TODO Use a dedicated directory for temp mails files - $vardir=$conf->user->dir_output."/".$user->id; - $upload_dir_tmp = $vardir.'/temp'; - - dol_add_file_process($upload_dir_tmp,0,0); - $action='presend'; - } - - /* - * Remove file in email form - */ - if (GETPOST('removedfile')) - { - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - - // Set tmp user directory - $vardir=$conf->user->dir_output."/".$user->id; - $upload_dir_tmp = $vardir.'/temp'; - - // TODO Delete only files that was uploaded from email form - dol_remove_file_process(GETPOST('removedfile','alpha'),0); - $action='presend'; - } - /* * Send mail */ - if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! GETPOST('cancel')) - { - $langs->load('mails'); - if ($object->id > 0) - { - // $ref = dol_sanitizeFileName($object->ref); - // $file = $conf->fournisseur->commande->dir_output . '/' . $ref . '/' . $ref . '.pdf'; + // Actions to send emails + $actiontypecode='AC_SUP_ORD'; + $trigger_name='ORDER_SUPPLIER_SENTBYMAIL'; + $paramname='id'; + $mode='emailfromsupplierorder'; + $trackid='sor'.$object->id; + include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; - // if (is_readable($file)) - // { - if (GETPOST('sendto','alpha')) - { - // Le destinataire a ete fourni via le champ libre - $sendto = GETPOST('sendto','alpha'); - $sendtoid = 0; - } - elseif (GETPOST('receiver','alpha') != '-1') - { - // Recipient was provided from combo list - if (GETPOST('receiver','alpha') == 'thirdparty') // Id of third party - { - $sendto = $object->thirdparty->email; - $sendtoid = 0; - } - else // Id du contact - { - $sendto = $object->thirdparty->contact_get_property(GETPOST('receiver','alpha'),'email'); - $sendtoid = GETPOST('receiver','alpha'); - } - } - - if (dol_strlen($sendto)) - { - $langs->load("commercial"); - - $from = GETPOST('fromname','alpha') . ' <' . GETPOST('frommail','alpha') .'>'; - $replyto = GETPOST('replytoname','alpha'). ' <' . GETPOST('replytomail','alpha').'>'; - $message = GETPOST('message'); - $sendtocc = GETPOST('sendtocc','alpha'); - $deliveryreceipt = GETPOST('deliveryreceipt','alpha'); - - if ($action == 'send') - { - if (dol_strlen(GETPOST('subject'))) $subject=GETPOST('subject'); - else $subject = $langs->transnoentities('CustomerOrder').' '.$object->ref; - $actiontypecode='AC_SUP_ORD'; - $actionmsg = $langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto; - if ($message) - { - if ($sendtocc) $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc); - $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject); - $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":"); - $actionmsg = dol_concatdesc($actionmsg, $message); - } - $actionmsg2=$langs->transnoentities('Action'.$actiontypecode); - } - - // Create form object - include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; - $formmail = new FormMail($db); - - $attachedfiles=$formmail->get_attached_files(); - $filepath = $attachedfiles['paths']; - $filename = $attachedfiles['names']; - $mimetype = $attachedfiles['mimes']; - - // Send mail - require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; - $mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,'',$deliveryreceipt,-1); - if ($mailfile->error) - { - setEventMessages($mailfile->error, $mailfile->errors, 'errors'); - } - else - { - $result=$mailfile->sendfile(); - if ($result) - { - $mesg=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2)); // Must not contain " - setEventMessages($mesg, null, 'mesgs'); - - $error=0; - - // Initialisation donnees - $object->sendtoid = $sendtoid; - $object->actiontypecode = $actiontypecode; - $object->actionmsg = $actionmsg; - $object->actionmsg2 = $actionmsg2; - $object->fk_element = $object->id; - $object->elementtype = $object->element; - - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($db); - $result=$interface->run_triggers('ORDER_SUPPLIER_SENTBYMAIL',$object,$user,$langs,$conf); - if ($result < 0) { $error++; $errors=$interface->errors; } - // Fin appel triggers - - if ($error) - { - setEventMessages($object->error, $object->errors, 'errors'); - } - else - { - // Redirect here - // This avoid sending mail twice if going out and then back to page - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); - exit; - } - } - else - { - $langs->load("other"); - if ($mailfile->error) - { - $mesg = $langs->trans('ErrorFailedToSendMail',$from,$sendto); - $mesg.= '
'.$mailfile->error; - } - else - { - $mesg = 'No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS'; - } - - setEventMessages($mesg, null, 'errors'); - } - } - /* } - else - { - $langs->load("other"); - $mesg='
'.$langs->trans('ErrorMailRecipientIsEmpty').' !
'; - $action='presend'; - dol_syslog('Recipient email is empty'); - }*/ - } - else - { - $langs->load("errors"); - setEventMessages($langs->trans('ErrorCantReadFile',$file), null, 'errors'); - dol_syslog('Failed to read file: '.$file); - } - } - else - { - $langs->load("other"); - setEventMessages($langs->trans('ErrorFailedToReadEntity',$langs->trans("Invoice")), null, 'errors'); - dol_syslog('Impossible de lire les donnees de la facture. Le fichier facture n\'a peut-etre pas ete genere.'); - } - } if ($action == 'webservice' && GETPOST('mode', 'alpha') == "send" && ! GETPOST('cancel')) { @@ -1480,13 +1313,14 @@ if (empty($reshook)) * View */ -llxHeader('',$langs->trans("OrderCard"),"CommandeFournisseur"); - $form = new Form($db); $formfile = new FormFile($db); $formorder = new FormOrder($db); $productstatic = new Product($db); +if (! empty($conf->projet->enabled)) { $formproject = new FormProjets($db); } +$help_url='EN:Module_Suppliers_Orders|FR:CommandeFournisseur|ES:Módulo_Pedidos_a_proveedores'; +llxHeader('',$langs->trans("Order"),$help_url); /* *************************************************************************** */ /* */ @@ -1552,9 +1386,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; } - + $note_private = $object->getDefaultCreateValueFor('note_private', (! empty($objectsrc->note_private) ? $objectsrc->note_private : null)); $note_public = $object->getDefaultCreateValueFor('note_public', (! empty($objectsrc->note_public) ? $objectsrc->note_public : null)); @@ -1566,9 +1400,9 @@ if ($action=='create') { $cond_reglement_id = $societe->cond_reglement_supplier_id; $mode_reglement_id = $societe->mode_reglement_supplier_id; - + if (!empty($conf->multicurrency->enabled) && !empty($soc->multicurrency_code)) $currency_code = $soc->multicurrency_code; - + $note_private = $object->getDefaultCreateValueFor('note_private'); $note_public = $object->getDefaultCreateValueFor('note_public'); } @@ -1581,7 +1415,7 @@ if ($action=='create') print ''; print ''; if (!empty($currency_tx)) print ''; - + dol_fiche_head(''); print '
'.$langs->trans("ProductsAndServices").''; - print ''.$langs->trans("All").' '.$object->nbOfProductRefs().''; + print ''.$langs->trans("ProductsAndServices").''; + print ''.$langs->trans("All").' '.$object->nbOfProductRefs().''; print '
'; print $productstatic->getNomUrl(1); print ''; + print ''; + print $objp->supplier_ref; + print ''; print dol_trunc(dol_htmlentities($objp->label), 30); print ''.dol_print_date($objp->tms).''.dol_print_date($objp->tms, 'day').''; + //print (isset($objp->unitprice) ? price($objp->unitprice) : ''); + if (isset($objp->price)) + { + print price($objp->price); + if ($objp->quantity > 1) + { + print ' / '; + print $objp->quantity; + } + } + print '
'; print ''; - print ''; + print ''; print ''; print '
'.$langs->trans("LastSupplierProposals",($num<$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllPriceRequests").' '.$num.''.$langs->trans("AllPriceRequests").' '.$num.''.img_picto($langs->trans("Statistics"),'stats').'
'; print '
'; print ''; - print ''; + print ''; print ''; print '
'.$langs->trans("LastSupplierOrders",($num<$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllOrders").' '.$num.''.$langs->trans("AllOrders").' '.$num.''.img_picto($langs->trans("Statistics"),'stats').'
'; print '
'; - print ''; + print '
'.$langs->trans('LastSuppliersBills',($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans('AllBills').' '.$num.'
'; print ''; print '
'.$langs->trans('LastSuppliersBills',($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans('AllBills').' '.$num.''.img_picto($langs->trans("Statistics"),'stats').'
'; print '
'; @@ -1669,7 +1503,7 @@ if ($action=='create') print $form->selectMultiCurrency($currency_code, 'multicurrency_code'); print ''; } - + print ''; print '"; - + if (!empty($conf->multicurrency->enabled)) { print ''; print ''; - print ''; + print ''; } } @@ -1743,7 +1577,7 @@ if ($action=='create') print "\n"; // Show origin lines - if (! empty($origin) && ! empty($originid) && is_object($objectsrc)) + if (! empty($origin) && ! empty($originid) && is_object($objectsrc)) { $title = $langs->trans('ProductsAndServices'); print load_fiche_titre($title); @@ -1766,6 +1600,7 @@ elseif (! empty($object->id)) $res=$object->fetch_optionals($object->id,$extralabels); + $head = ordersupplier_prepare_head($object); $title=$langs->trans("SupplierOrder"); @@ -1774,9 +1609,7 @@ elseif (! empty($object->id)) $formconfirm=''; - /* - * Confirmation de la suppression de la commande - */ + // Confirmation de la suppression de la commande if ($action == 'delete') { $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteOrder'), $langs->trans('ConfirmDeleteOrder'), 'confirm_delete', '', 0, 2); @@ -1795,15 +1628,13 @@ elseif (! empty($object->id)) } - /* - * Confirmation de la validation - */ + // Confirmation de la validation if ($action == 'valid') { $object->date_commande=dol_now(); // We check if number is temporary number - if (preg_match('/^[\(]?PROV/i',$object->ref) || empty($object->ref)) // empty should not happened, but when it occurs, the test save life + if (preg_match('/^[\(]?PROV/i',$object->ref) || empty($object->ref)) // empty should not happened, but when it occurs, the test save life { $newref = $object->getNextNumRef($object->thirdparty); } @@ -1829,9 +1660,7 @@ elseif (! empty($object->id)) } } - /* - * Confirm approval - */ + // Confirm approval if ($action == 'approve' || $action == 'approve2') { $qualified_for_stock_change=0; @@ -1869,27 +1698,21 @@ elseif (! empty($object->id)) $formconfirm = $form->formconfirm($_SERVER['PHP_SELF']."?id=".$object->id, $langs->trans("ApproveThisOrder"), $text, "confirm_".$action, $formquestion, 1, 1, 240); } - /* - * Confirmation de la desapprobation - */ + // Confirmation de la desapprobation if ($action == 'refuse') { $formconfirm = $form->formconfirm($_SERVER['PHP_SELF']."?id=$object->id",$langs->trans("DenyingThisOrder"),$langs->trans("ConfirmDenyingThisOrder",$object->ref),"confirm_refuse", '', 0, 1); } - /* - * Confirmation de l'annulation - */ + // Confirmation de l'annulation if ($action == 'cancel') { $formconfirm = $form->formconfirm($_SERVER['PHP_SELF']."?id=$object->id",$langs->trans("Cancel"),$langs->trans("ConfirmCancelThisOrder",$object->ref),"confirm_cancel", '', 0, 1); } - /* - * Confirmation de l'envoi de la commande - */ + // Confirmation de l'envoi de la commande if ($action == 'commande') { $date_com = dol_mktime(GETPOST('rehour'),GETPOST('remin'),GETPOST('resec'),GETPOST("remonth"),GETPOST("reday"),GETPOST("reyear")); @@ -1914,50 +1737,65 @@ elseif (! empty($object->id)) // Print form confirm print $formconfirm; - /* - * Commande - */ - $nbrow=8; - if (! empty($conf->projet->enabled)) $nbrow++; - - //Local taxes - if($mysoc->localtax1_assuj=="1") $nbrow++; - if($mysoc->localtax2_assuj=="1") $nbrow++; - - print '
'.$langs->trans('NotePublic').''; $doleditor = new DolEditor('note_public', isset($note_public) ? $note_public : GETPOST('note_public'), '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70); @@ -1711,12 +1545,12 @@ if ($action=='create') } print '
' . $langs->trans('TotalTTC') . '' . price($objectsrc->total_ttc) . "
' . $langs->trans('MulticurrencyTotalHT') . '' . price($objectsrc->multicurrency_total_ht) . '
' . $langs->trans('MulticurrencyTotalVAT') . '' . price($objectsrc->multicurrency_total_tva) . '
' . $langs->trans('MulticurrencyTotalTTC') . '' . price($objectsrc->multicurrency_total_ttc) . '
' . $langs->trans('MulticurrencyTotalTTC') . '' . price($objectsrc->multicurrency_total_ttc) . '
'; + + // Supplier order card $linkback = ''.$langs->trans("BackToList").''; - - // Ref - print ''; - print ''; - print ''; - + + $morehtmlref='
'; // Ref supplier - print '
'; + $morehtmlref.=$form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->fournisseur->commande->creer, 'string', '', 0, 1); + $morehtmlref.=$form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->fournisseur->commande->creer, 'string', '', null, null, '', 1); + // Thirdparty + $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); + // Project + if (! empty($conf->projet->enabled)) + { + $langs->load("projects"); + $morehtmlref.='
'.$langs->trans('Project') . ' '; + if ($user->rights->fournisseur->commande->creer) + { + if ($action != 'classify') + $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.=''; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (! empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref.=''; + $morehtmlref.=$proj->ref; + $morehtmlref.=''; + } else { + $morehtmlref.=''; + } + } + } + $morehtmlref.=''; + + + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + - // Fournisseur - print '"; - print ''; - print ''; - - // Statut - print ''; - print ''; - print '"; + print '
'; + print '
'; + print '
'; + + print '
'.$langs->trans("Ref").''; - print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref'); - print '
'; - print $form->editfieldkey("RefSupplier",'ref_supplier',$object->ref_supplier,$object,$user->rights->fournisseur->commande->creer); - print ''; - print $form->editfieldval("RefSupplier",'ref_supplier',$object->ref_supplier,$object,$user->rights->fournisseur->commande->creer); - print '
'.$langs->trans("Supplier")."'.$object->thirdparty->getNomUrl(1,'supplier').'
'.$langs->trans("Status").''; - print $object->getLibStatut(4); - print "
'; // Date if ($object->methode_commande_id > 0) { - print ''; + print ''; } } // Author - print ''; - print ''; + print ''; + print ''; print ''; // Conditions de reglement par defaut @@ -1983,7 +1821,7 @@ elseif (! empty($object->id)) print ''; print '
'.$langs->trans("Date").''; + print '
'.$langs->trans("Date").''; if ($object->date_commande) { print dol_print_date($object->date_commande,"dayhourtext")."\n"; @@ -1966,13 +1804,13 @@ elseif (! empty($object->id)) if ($object->methode_commande) { - print '
'.$langs->trans("Method").''.$object->getInputMethod().'
'.$langs->trans("Method").''.$object->getInputMethod().'
'.$langs->trans("AuthorRequest").''.$author->getNomUrl(1).'
'.$langs->trans("AuthorRequest").''.$author->getNomUrl(1).'
'; if ($action != 'editconditions') print 'id.'">'.img_edit($langs->trans('SetConditions'),1).'
'; - print ''; + print ''; if ($action == 'editconditions') { $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->cond_reglement_id,'cond_reglement_id'); @@ -2003,7 +1841,7 @@ elseif (! empty($object->id)) print ''; if ($action != 'editmode') print 'id.'">'.img_edit($langs->trans('SetMode'),1).''; print ''; - print ''; + print ''; if ($action == 'editmode') { $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->mode_reglement_id,'mode_reglement_id'); @@ -2013,37 +1851,37 @@ elseif (! empty($object->id)) $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->mode_reglement_id,'none'); } print ''; - + // Multicurrency if (! empty($conf->multicurrency->enabled)) { // Multicurrency code print ''; - print ''; + print ''; print ''; if ($action != 'editmulticurrencycode' && ! empty($object->brouillon)) print ''; print '
'; print fieldLabel('Currency','multicurrency_code'); print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '
'; - print ''; + print ''; if ($action == 'editmulticurrencycode') { $form->form_multicurrency_code($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_code, 'multicurrency_code'); } else { $form->form_multicurrency_code($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_code, 'none'); } print ''; - + // Multicurrency rate print ''; - print ''; + print ''; print ''; if ($action != 'editmulticurrencyrate' && ! empty($object->brouillon)) print ''; print '
'; - print fieldLabel('Rate','multicurrency_tx'); + print fieldLabel('CurrencyRate','multicurrency_tx'); print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '
'; - print ''; + print ''; if ($action == 'editmulticurrencyrate') { $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code); } else { @@ -2062,7 +1900,7 @@ elseif (! empty($object->id)) if ($action != 'editbankaccount' && $user->rights->fournisseur->commande->creer) print 'id.'">'.img_edit($langs->trans('SetBankAccount'),1).''; print ''; - print ''; + print ''; if ($action == 'editbankaccount') { $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1); } else { @@ -2079,7 +1917,7 @@ elseif (! empty($object->id)) print ''; if ($action != 'editdate_livraison') print 'id.'">'.img_edit($langs->trans('SetDeliveryDate'),1).''; print ''; - print ''; + print ''; if ($action == 'editdate_livraison') { print '
'; @@ -2102,37 +1940,12 @@ elseif (! empty($object->id)) } print ''; - // Delivery delay (in days) print ''; print ''.$langs->trans('NbDaysToDelivery').' '.img_picto($langs->trans('DescNbDaysToDelivery'), 'info', 'style="cursor:help"').''; print ''.$object->getMaxDeliveryTimeDay($langs).''; print ''; - // Project - if (! empty($conf->projet->enabled)) - { - $langs->load('projects'); - print ''; - print ''; - if ($action != 'classify') print ''; - print '
'; - print $langs->trans('Project'); - print ''.img_edit($langs->trans('SetProject')).'
'; - print ''; - //print "$object->id, $object->socid, $object->fk_project"; - if ($action == 'classify') - { - $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, (empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS)?$object->socid:-1), $object->fk_project, 'projectid', 0, 0, 1); - } - else - { - $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0); - } - print ''; - print ''; - } - // Incoterms if (!empty($conf->incoterm->enabled)) { @@ -2144,7 +1957,7 @@ elseif (! empty($object->id)) else print ' '; print ''; print ''; - print ''; + print ''; if ($action != 'editincoterm') { print $form->textwithpicto($object->display_incoterms(), $object->libelle_incoterms, 1); @@ -2157,56 +1970,77 @@ elseif (! empty($object->id)) } // Other attributes - $cols = 3; + $cols = 2; include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; + print ''; + + print '
'; + print '
'; + print '
'; + print '
'; + + print ''; + // Total - print ''; - print ''; + print ''; + print ''; print ''; // Total VAT - print ''; + print ''; print ''; // Amount Local Taxes if ($mysoc->localtax1_assuj=="1" || $object->total_localtax1 != 0) //Localtax1 { print ''; - print ''; + print ''; print ''; } if ($mysoc->localtax2_assuj=="1" || $object->total_localtax2 != 0) //Localtax2 { print ''; - print ''; + print ''; print ''; } // Total TTC - print ''; + print ''; print ''; if (!empty($conf->multicurrency->enabled)) { // Multicurrency Amount HT - print ''; - print ''; + print ''; + print ''; print ''; - + // Multicurrency Amount VAT - print ''; - print ''; + print ''; + print ''; print ''; - + // Multicurrency Amount TTC - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; } - print "
'.$langs->trans("AmountHT").''.price($object->total_ht,'',$langs,1,-1,-1,$conf->currency).'
'.$langs->trans("AmountHT").''.price($object->total_ht,'',$langs,1,-1,-1,$conf->currency).'
'.$langs->trans("AmountVAT").''.price($object->total_tva,'',$langs,1,-1,-1,$conf->currency).'
'.$langs->trans("AmountVAT").''.price($object->total_tva,'',$langs,1,-1,-1,$conf->currency).'
'.$langs->transcountry("AmountLT1",$mysoc->country_code).''.price($object->total_localtax1,'',$langs,1,-1,-1,$conf->currency).''.price($object->total_localtax1,'',$langs,1,-1,-1,$conf->currency).'
'.$langs->transcountry("AmountLT2",$mysoc->country_code).''.price($object->total_localtax2,'',$langs,1,-1,-1,$conf->currency).''.price($object->total_localtax2,'',$langs,1,-1,-1,$conf->currency).'
'.$langs->trans("AmountTTC").''.price($object->total_ttc,'',$langs,1,-1,-1,$conf->currency).'
'.$langs->trans("AmountTTC").''.price($object->total_ttc,'',$langs,1,-1,-1,$conf->currency).'
' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . '' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . '' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . '' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . '' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . '' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . '' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '

"; - + print ''; + + // Margin Infos + /*if (! empty($conf->margin->enabled)) { + $formmargin->displayMarginInfos($object); + }*/ + + + print '
'; + print '
'; + print '
'; + + print '

'; + if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) { $blocname = 'contacts'; @@ -2252,184 +2086,6 @@ elseif (! empty($object->id)) $num = count($object->lines); -/* - $i = 0; $total = 0; - if ($num) - { - print ''; - print ''.$langs->trans('Label').''; - print ''.$langs->trans('VAT').''; - print ''.$langs->trans('PriceUHT').''; - print ''.$langs->trans('Qty').''; - print ''.$langs->trans('ReductionShort').''; - print ''.$langs->trans('TotalHTShort').''; - print ' '; - print "\n"; - } - $var=true; - while ($i < $num) - { - $line = $object->lines[$i]; - $var=!$var; - - // Show product and description - $type=(! empty($line->product_type)?$line->product_type:(! empty($line->fk_product_type)?$line->fk_product_type:0)); - // Try to enhance type detection using date_start and date_end for free lines where type - // was not saved. - $date_start=''; - $date_end=''; - if (! empty($line->date_start)) - { - $date_start=$line->date_start; - $type=1; - } - if (! empty($line->date_end)) - { - $date_end=$line->date_end; - $type=1; - } - - // Edit line - if ($action != 'editline' || $_GET['rowid'] != $line->id) - { - print ''; - - // Show product and description - print ''; - if ($line->fk_product > 0) - { - print ''; // ancre pour retourner sur la ligne - - $product_static=new ProductFournisseur($db); - $product_static->fetch($line->fk_product); - $text=$product_static->getNomUrl(1,'supplier'); - $text.= ' - '.$product_static->libelle; - $description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($line->description)); - print $form->textwithtooltip($text,$description,3,'','',$i); - - // Show range - print_date_range($date_start,$date_end); - - // Add description in form - if (! empty($conf->global->PRODUIT_DESC_IN_FORM)) print ($line->description && $line->description!=$product_static->libelle)?'
'.dol_htmlentitiesbr($line->description):''; - } - - // Description - Editor wysiwyg - if (! $line->fk_product) - { - if ($type==1) $text = img_object($langs->trans('Service'),'service'); - else $text = img_object($langs->trans('Product'),'product'); - print $text.' '.nl2br($line->description); - - // Show range - print_date_range($date_start,$date_end); - } - - print ''; - - print ''.vatrate($line->tva_tx).'%'; - - print ''.price($line->subprice)."\n"; - - print ''.$line->qty.''; - - if ($line->remise_percent > 0) - { - print ''.dol_print_reduction($line->remise_percent,$langs)."\n"; - } - else - { - print ' '; - } - - print ''.price($line->total_ht).''; - - if (is_object($hookmanager)) - { - $parameters=array('line'=>$line,'num'=>$num,'i'=>$i); - $reshook=$hookmanager->executeHooks('printObjectLine',$parameters,$object,$action); - } - - if ($object->statut == 0 && $user->rights->fournisseur->commande->creer) - { - print 'id.'#'.$line->id.'">'; - print img_edit(); - print ''; - - $actiondelete='delete_product_line'; - print ''; - print img_delete(); - print ''; - } - else - { - print '  '; - } - print ""; - } - - // Edit line - if ($action == 'editline' && $user->rights->fournisseur->commande->creer && ($_GET["rowid"] == $line->id)) - { - print "\n"; - print ''; - print ''; - - print ''; - - print ''; // ancre pour retourner sur la ligne - if ((! empty($conf->product->enabled) || ! empty($conf->service->enabled)) && $line->fk_product > 0) - { - $product_static=new ProductFournisseur($db); - $product_static->fetch($line->fk_product); - $text=$product_static->getNomUrl(1,'supplier'); - $text.= ' - '.$product_static->libelle; - $description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($line->description)); - print $form->textwithtooltip($text,$description,3,'','',$i); - - // Show range - print_date_range($date_start,$date_end); - print '
'; - } - else - { - $forceall=1; // For suppliers, we always show all types - print $form->select_type_of_lines($line->product_type,'type',1,0,$forceall); - if ($forceall || (! empty($conf->product->enabled) && ! empty($conf->service->enabled)) - || (empty($conf->product->enabled) && empty($conf->service->enabled))) print '
'; - } - - if (is_object($hookmanager)) - { - $parameters=array('fk_parent_line'=>$line->fk_parent_line, 'line'=>$line,'var'=>$var,'num'=>$num,'i'=>$i); - $reshook=$hookmanager->executeHooks('formEditProductOptions',$parameters,$object,$action); - } - - $nbrows=ROWS_2; - if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT; - $doleditor=new DolEditor('eldesc',$line->description,'',200,'dolibarr_details','',false,true,$conf->global->FCKEDITOR_ENABLE_DETAILS,$nbrows,70); - $doleditor->Create(); - - print '
'; - print $langs->trans('ServiceLimitedDuration').' '.$langs->trans('From').' '; - print $form->select_date($date_start,'date_start'.$date_pf,$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE,$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE,1,'',1,0,1); - print ' '.$langs->trans('to').' '; - print $form->select_date($date_end,'date_end'.$date_pf,$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE,$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE,1,'',1,0,1); - - print ''; - print ''; - print $form->load_tva('tva_tx',$line->tva_tx,$object->thirdparty,$mysoc); - print ''; - print ''; - print ''; - print '%'; - print ''; - print '
'; - print '' . "\n"; - } - $i++; - } -*/ // Form to add new line if ($object->statut == 0 && $user->rights->fournisseur->commande->creer) { @@ -2502,16 +2158,18 @@ elseif (! empty($object->id)) include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; $formmail = new FormMail($db); $formmail->param['langsmodels']=(empty($newlang)?$langs->defaultlang:$newlang); - $formmail->fromtype = 'user'; - $formmail->fromid = $user->id; - $formmail->fromname = $user->getFullName($langs); - $formmail->frommail = $user->email; + $formmail->fromtype = (GETPOST('fromtype')?GETPOST('fromtype'):(!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE)?$conf->global->MAIN_MAIL_DEFAULT_FROMTYPE:'user')); + + if($formmail->fromtype === 'user'){ + $formmail->fromid = $user->id; + + } $formmail->trackid='sor'.$object->id; if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set { include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; $formmail->frommail=dolAddEmailTrackId($formmail->frommail, 'sor'.$object->id); - } + } $formmail->withfrom=1; $liste=array(); foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key=>$value) $liste[$key]=$value; @@ -2787,7 +2445,7 @@ elseif (! empty($object->id)) /** * Boutons actions */ - + if ($user->societe_id == 0 && $action != 'editline' && $action != 'delete') { print '
'; @@ -2797,7 +2455,7 @@ elseif (! empty($object->id)) // modified by hook if (empty($reshook)) { - + // Validate if ($object->statut == 0 && $num > 0) { @@ -2832,7 +2490,7 @@ elseif (! empty($object->id)) { if ($user->rights->fournisseur->commande->approuver) { - if (! empty($conf->global->SUPPLIER_ORDER_DOUBLE_APPROVAL) && $conf->global->MAIN_FEATURES_LEVEL > 0 && $object->total_ht >= $conf->global->SUPPLIER_ORDER_DOUBLE_APPROVAL && ! empty($object->user_approve_id)) + if (! empty($conf->global->SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED) && $conf->global->MAIN_FEATURES_LEVEL > 0 && $object->total_ht >= $conf->global->SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED && ! empty($object->user_approve_id)) { print ''.$langs->trans("ApproveOrder").''; } @@ -2847,8 +2505,8 @@ elseif (! empty($object->id)) } } - // Second approval (if option SUPPLIER_ORDER_DOUBLE_APPROVAL is set) - if (! empty($conf->global->SUPPLIER_ORDER_DOUBLE_APPROVAL) && $conf->global->MAIN_FEATURES_LEVEL > 0 && $object->total_ht >= $conf->global->SUPPLIER_ORDER_DOUBLE_APPROVAL) + // Second approval (if option SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED is set) + if (! empty($conf->global->SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED) && $conf->global->MAIN_FEATURES_LEVEL > 0 && $object->total_ht >= $conf->global->SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED) { if ($object->statut == 1) { @@ -2905,7 +2563,7 @@ elseif (! empty($object->id)) $buttonshown++; } } - if (! $buttonshown && $user->rights->fournisseur->commande->approve2 && ! empty($conf->global->SUPPLIER_ORDER_DOUBLE_APPROVAL)) + if (! $buttonshown && $user->rights->fournisseur->commande->approve2 && ! empty($conf->global->SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED)) { if (empty($conf->global->SUPPLIER_ORDER_REOPEN_BY_APPROVER2_ONLY) || (! empty($conf->global->SUPPLIER_ORDER_REOPEN_BY_APPROVER2_ONLY) && $user->id == $object->user_approve_id2)) @@ -2943,7 +2601,7 @@ elseif (! empty($object->id)) { print ''.$langs->trans("CreateBill").''; } - + if ($user->rights->fournisseur->commande->creer && $object->statut >= 2 && !empty($object->linkedObjectsIds['invoice_supplier'])) { print ''.$langs->trans("ClassifyBilled").''; @@ -2980,12 +2638,10 @@ elseif (! empty($object->id)) } } - + print "
"; } - print "
"; - print '
'; @@ -3003,13 +2659,9 @@ elseif (! empty($object->id)) print $formfile->showdocuments('commande_fournisseur',$comfournref,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf,1,0,0,0,0,'','','',$object->thirdparty->default_lang); $somethingshown=$formfile->numoffiles; - // Linked object block - $somethingshown = $form->showLinkedObjectBlock($object); - // Show links to link elements - //$linktoelem = $form->showLinkToObjectBlock($object); - //if ($linktoelem) print '
'.$linktoelem; - + $linktoelem = $form->showLinkToObjectBlock($object, null, array('supplier_order','order_supplier')); + $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem); print '
'; @@ -3061,7 +2713,7 @@ elseif (! empty($object->id)) print "".$langs->trans("Delivery")."\n"; $liv = array(); $liv[''] = ' '; - $liv['tot'] = $langs->trans("TotalWoman"); + $liv['tot'] = $langs->trans("CompleteOrNoMoreReceptionExpected"); $liv['par'] = $langs->trans("PartialWoman"); $liv['nev'] = $langs->trans("NeverReceived"); $liv['can'] = $langs->trans("Canceled"); diff --git a/htdocs/fourn/commande/contact.php b/htdocs/fourn/commande/contact.php index 8ced1e9844c..446b96687b5 100644 --- a/htdocs/fourn/commande/contact.php +++ b/htdocs/fourn/commande/contact.php @@ -112,8 +112,8 @@ else if ($action == 'deletecontact' && $user->rights->fournisseur->commande->cre /* * View */ - -llxHeader('', $langs->trans("Order"), "Commande"); +$help_url='EN:Module_Suppliers_Orders|FR:CommandeFournisseur|ES:Módulo_Pedidos_a_proveedores'; +llxHeader('',$langs->trans("Order"),$help_url); $form = new Form($db); $formcompany = new FormCompany($db); @@ -149,7 +149,7 @@ if ($id > 0 || ! empty($ref)) $linkback = ''.$langs->trans("BackToList").''; // Ref - print ''.$langs->trans("Ref").''; + print ''.$langs->trans("Ref").''; print ''; print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref'); print ''; diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index f4685469711..5d3e0ebc47f 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -5,6 +5,7 @@ * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2010 Juanjo Menent * Copyright (C) 2014 Cedric Gross + * Copyright (C) 2016 Florian Henry * * 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 @@ -22,19 +23,19 @@ */ /** - * \file htdocs/fourn/commande/dispatch.php - * \ingroup commande - * \brief Page to dispatch receiving + * \file htdocs/fourn/commande/dispatch.php + * \ingroup commande + * \brief Page to dispatch receiving */ - require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/modules/supplier_order/modules_commandefournisseur.php'; -require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/fourn.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; -require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.dispatch.class.php'; -require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; -if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; +require_once DOL_DOCUMENT_ROOT . '/core/modules/supplier_order/modules_commandefournisseur.php'; +require_once DOL_DOCUMENT_ROOT . '/product/stock/class/entrepot.class.php'; +require_once DOL_DOCUMENT_ROOT . '/core/lib/fourn.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.commande.class.php'; +require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.commande.dispatch.class.php'; +require_once DOL_DOCUMENT_ROOT . '/product/class/html.formproduct.class.php'; +if (! empty($conf->projet->enabled)) + require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; $langs->load('orders'); $langs->load('sendings'); @@ -43,704 +44,660 @@ $langs->load('bills'); $langs->load('deliveries'); $langs->load('products'); $langs->load('stocks'); -if (! empty($conf->productbatch->enabled)) $langs->load('productbatch'); +if (! empty($conf->productbatch->enabled)) + $langs->load('productbatch'); -// Security check -$id = GETPOST("id",'int'); + // Security check +$id = GETPOST("id", 'int'); +$ref = GETPOST('ref'); $lineid = GETPOST('lineid', 'int'); $action = GETPOST('action'); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->societe_id) + $socid = $user->societe_id; $result = restrictedArea($user, 'fournisseur', $id, '', 'commande'); -if (empty($conf->stock->enabled)) -{ +if (empty($conf->stock->enabled)) { accessforbidden(); } -// Recuperation de l'id de projet -$projectid = 0; -if ($_GET["projectid"]) $projectid = GETPOST("projectid",'int'); +// Recuperation de l'id de projet +$projectid = 0; +if ($_GET["projectid"]) + $projectid = GETPOST("projectid", 'int'); -$mesg=''; +$commande = new CommandeFournisseur($db); + +if ($id > 0 || ! empty($ref)) { + $result = $commande->fetch($id, $ref); + if ($result < 0) { + setEventMessages($commande->error, $commande->errors, 'errors'); + } + $result = $commande->fetch_thirdparty(); + if ($result < 0) { + setEventMessages($commande->error, $commande->errors, 'errors'); + } +} /* * Actions */ -if ($action == 'checkdispatchline' && - ! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->fournisseur->commande->receptionner)) - || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->fournisseur->commande_advance->check))) -) -{ +if ($action == 'checkdispatchline' && ! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->fournisseur->commande->receptionner)) || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->fournisseur->commande_advance->check)))) { $supplierorderdispatch = new CommandeFournisseurDispatch($db); - $result=$supplierorderdispatch->fetch($lineid); - if (! $result) dol_print_error($db); - $result=$supplierorderdispatch->setStatut(1); - if ($result < 0) - { + $result = $supplierorderdispatch->fetch($lineid); + if (! $result) + dol_print_error($db); + $result = $supplierorderdispatch->setStatut(1); + if ($result < 0) { setEventMessages($supplierorderdispatch->error, $supplierorderdispatch->errors, 'errors'); - $error++; - $action=''; + $error ++; + $action = ''; + } else { + $result = $commande->calcAndSetStatusDispatch($user); + if ($result < 0) { + setEventMessages($commande->error, $commande->errors, 'errors'); + $error ++; + $action = ''; + } } } -if ($action == 'uncheckdispatchline' && - ! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->fournisseur->commande->receptionner)) - || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->fournisseur->commande_advance->check))) -) -{ +if ($action == 'uncheckdispatchline' && ! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->fournisseur->commande->receptionner)) || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->fournisseur->commande_advance->check)))) { $supplierorderdispatch = new CommandeFournisseurDispatch($db); - $result=$supplierorderdispatch->fetch($lineid); - if (! $result) dol_print_error($db); - $result=$supplierorderdispatch->setStatut(0); - if ($result < 0) - { + $result = $supplierorderdispatch->fetch($lineid); + if (! $result) + dol_print_error($db); + $result = $supplierorderdispatch->setStatut(0); + if ($result < 0) { setEventMessages($supplierorderdispatch->error, $supplierorderdispatch->errors, 'errors'); - $error++; - $action=''; + $error ++; + $action = ''; + } else { + $result = $commande->calcAndSetStatusDispatch($user); + if ($result < 0) { + setEventMessages($commande->error, $commande->errors, 'errors'); + $error ++; + $action = ''; + } } } -if ($action == 'denydispatchline' && - ! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->fournisseur->commande->receptionner)) - || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->fournisseur->commande_advance->check))) -) -{ +if ($action == 'denydispatchline' && ! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->fournisseur->commande->receptionner)) || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->fournisseur->commande_advance->check)))) { $supplierorderdispatch = new CommandeFournisseurDispatch($db); - $result=$supplierorderdispatch->fetch($lineid); - if (! $result) dol_print_error($db); - $result=$supplierorderdispatch->setStatut(2); - if ($result < 0) - { + $result = $supplierorderdispatch->fetch($lineid); + if (! $result) + dol_print_error($db); + $result = $supplierorderdispatch->setStatut(2); + if ($result < 0) { setEventMessages($supplierorderdispatch->error, $supplierorderdispatch->errors, 'errors'); - $error++; - $action=''; + $error ++; + $action = ''; + } else { + $result = $commande->calcAndSetStatusDispatch($user); + if ($result < 0) { + setEventMessages($commande->error, $commande->errors, 'errors'); + $error ++; + $action = ''; + } } } -if ($action == 'dispatch' && $user->rights->fournisseur->commande->receptionner) -{ - $commande = new CommandeFournisseur($db); - $commande->fetch($id); - - $error=0; +if ($action == 'dispatch' && $user->rights->fournisseur->commande->receptionner) { + $error = 0; $db->begin(); - $pos=0; - foreach($_POST as $key => $value) + $pos = 0; + foreach ($_POST as $key => $value) { - if (preg_match('/^product_([0-9]+)_([0-9]+)$/i', $key, $reg)) // without batch module enabled + // without batch module enabled + if (preg_match('/^product_([0-9]+)_([0-9]+)$/i', $key, $reg)) { - $pos++; + $pos ++; - //$numline=$reg[2] + 1; // line of product - $numline=$pos; - $prod = "product_".$reg[1].'_'.$reg[2]; - $qty = "qty_".$reg[1].'_'.$reg[2]; - $ent = "entrepot_".$reg[1].'_'.$reg[2]; - $pu = "pu_".$reg[1].'_'.$reg[2]; // This is unit price including discount - $fk_commandefourndet = "fk_commandefourndet_".$reg[1].'_'.$reg[2]; + // $numline=$reg[2] + 1; // line of product + $numline = $pos; + $prod = "product_" . $reg[1] . '_' . $reg[2]; + $qty = "qty_" . $reg[1] . '_' . $reg[2]; + $ent = "entrepot_" . $reg[1] . '_' . $reg[2]; + $pu = "pu_" . $reg[1] . '_' . $reg[2]; // This is unit price including discount + $fk_commandefourndet = "fk_commandefourndet_" . $reg[1] . '_' . $reg[2]; - if (GETPOST($qty) > 0) // We ask to move a qty - { - if (! (GETPOST($ent,'int') > 0)) - { - dol_syslog('No dispatch for line '.$key.' as no warehouse choosed'); - $text = $langs->transnoentities('Warehouse').', '.$langs->transnoentities('Line').' ' .($numline); - setEventMessages($langs->trans('ErrorFieldRequired',$text), null, 'errors'); - $error++; + // We ask to move a qty + if (GETPOST($qty) > 0) { + if (! (GETPOST($ent, 'int') > 0)) { + dol_syslog('No dispatch for line ' . $key . ' as no warehouse choosed'); + $text = $langs->transnoentities('Warehouse') . ', ' . $langs->transnoentities('Line') . ' ' . ($numline); + setEventMessages($langs->trans('ErrorFieldRequired', $text), null, 'errors'); + $error ++; } - if (! $error) - { - $result = $commande->DispatchProduct($user, GETPOST($prod,'int'), GETPOST($qty), GETPOST($ent,'int'), GETPOST($pu), GETPOST('comment'), '', '', '', GETPOST($fk_commandefourndet, 'int'), $notrigger); - if ($result < 0) - { + if (! $error) { + $result = $commande->dispatchProduct($user, GETPOST($prod, 'int'), GETPOST($qty), GETPOST($ent, 'int'), GETPOST($pu), GETPOST('comment'), '', '', '', GETPOST($fk_commandefourndet, 'int'), $notrigger); + if ($result < 0) { setEventMessages($commande->error, $commande->errors, 'errors'); - $error++; + $error ++; } } } } - if (preg_match('/^product_batch_([0-9]+)_([0-9]+)$/i', $key, $reg)) // with batch module enabled + // with batch module enabled + if (preg_match('/^product_batch_([0-9]+)_([0-9]+)$/i', $key, $reg)) { - $pos++; + $pos ++; - //eat-by date dispatch - //$numline=$reg[2] + 1; // line of product - $numline=$pos; - $prod = 'product_batch_'.$reg[1].'_'.$reg[2]; - $qty = 'qty_'.$reg[1].'_'.$reg[2]; - $ent = 'entrepot_'.$reg[1].'_'.$reg[2]; - $pu = 'pu_'.$reg[1].'_'.$reg[2]; - $fk_commandefourndet = 'fk_commandefourndet_'.$reg[1].'_'.$reg[2]; - $lot = 'lot_number_'.$reg[1].'_'.$reg[2]; - $dDLUO = dol_mktime(12, 0, 0, $_POST['dluo_'.$reg[1].'_'.$reg[2].'month'], $_POST['dluo_'.$reg[1].'_'.$reg[2].'day'], $_POST['dluo_'.$reg[1].'_'.$reg[2].'year']); - $dDLC = dol_mktime(12, 0, 0, $_POST['dlc_'.$reg[1].'_'.$reg[2].'month'], $_POST['dlc_'.$reg[1].'_'.$reg[2].'day'], $_POST['dlc_'.$reg[1].'_'.$reg[2].'year']); + // eat-by date dispatch + // $numline=$reg[2] + 1; // line of product + $numline = $pos; + $prod = 'product_batch_' . $reg[1] . '_' . $reg[2]; + $qty = 'qty_' . $reg[1] . '_' . $reg[2]; + $ent = 'entrepot_' . $reg[1] . '_' . $reg[2]; + $pu = 'pu_' . $reg[1] . '_' . $reg[2]; + $fk_commandefourndet = 'fk_commandefourndet_' . $reg[1] . '_' . $reg[2]; + $lot = 'lot_number_' . $reg[1] . '_' . $reg[2]; + $dDLUO = dol_mktime(12, 0, 0, $_POST['dluo_' . $reg[1] . '_' . $reg[2] . 'month'], $_POST['dluo_' . $reg[1] . '_' . $reg[2] . 'day'], $_POST['dluo_' . $reg[1] . '_' . $reg[2] . 'year']); + $dDLC = dol_mktime(12, 0, 0, $_POST['dlc_' . $reg[1] . '_' . $reg[2] . 'month'], $_POST['dlc_' . $reg[1] . '_' . $reg[2] . 'day'], $_POST['dlc_' . $reg[1] . '_' . $reg[2] . 'year']); - $fk_commandefourndet = 'fk_commandefourndet_'.$reg[1].'_'.$reg[2]; - - if (GETPOST($qty) > 0) // We ask to move a qty - { - if (! (GETPOST($ent,'int') > 0)) - { - dol_syslog('No dispatch for line '.$key.' as no warehouse choosed'); - $text = $langs->transnoentities('Warehouse').', '.$langs->transnoentities('Line').' ' .($numline).'-'.($reg[1]+1); - setEventMessages($langs->trans('ErrorFieldRequired',$text), null, 'errors'); - $error++; + $fk_commandefourndet = 'fk_commandefourndet_' . $reg[1] . '_' . $reg[2]; + + // We ask to move a qty + if (GETPOST($qty) > 0) { + if (! (GETPOST($ent, 'int') > 0)) { + dol_syslog('No dispatch for line ' . $key . ' as no warehouse choosed'); + $text = $langs->transnoentities('Warehouse') . ', ' . $langs->transnoentities('Line') . ' ' . ($numline) . '-' . ($reg[1] + 1); + setEventMessages($langs->trans('ErrorFieldRequired', $text), null, 'errors'); + $error ++; } - if (! (GETPOST($lot, 'alpha') || $dDLUO || $dDLC)) - { - dol_syslog('No dispatch for line '.$key.' as serial/eat-by/sellby date are not set'); - $text = $langs->transnoentities('atleast1batchfield').', '.$langs->transnoentities('Line').' ' .($numline).'-'.($reg[1]+1); - setEventMessages($langs->trans('ErrorFieldRequired',$text), null, 'errors'); - $error++; + if (! (GETPOST($lot, 'alpha') || $dDLUO || $dDLC)) { + dol_syslog('No dispatch for line ' . $key . ' as serial/eat-by/sellby date are not set'); + $text = $langs->transnoentities('atleast1batchfield') . ', ' . $langs->transnoentities('Line') . ' ' . ($numline) . '-' . ($reg[1] + 1); + setEventMessages($langs->trans('ErrorFieldRequired', $text), null, 'errors'); + $error ++; } - if (! $error) - { - $result = $commande->dispatchProduct($user, GETPOST($prod,'int'), GETPOST($qty), GETPOST($ent,'int'), GETPOST($pu), GETPOST('comment'), $dDLC, $dDLUO, GETPOST($lot, 'alpha'), GETPOST($fk_commandefourndet, 'int'), $notrigger); - if ($result < 0) - { + if (! $error) { + $result = $commande->dispatchProduct($user, GETPOST($prod, 'int'), GETPOST($qty), GETPOST($ent, 'int'), GETPOST($pu), GETPOST('comment'), $dDLC, $dDLUO, GETPOST($lot, 'alpha'), GETPOST($fk_commandefourndet, 'int'), $notrigger); + if ($result < 0) { setEventMessages($commande->error, $commande->errors, 'errors'); - $error++; + $error ++; } } } } } - if (! $notrigger && ! $error) - { - global $conf, $langs, $user; - // Call trigger - $result = $commande->call_trigger('ORDER_SUPPLIER_DISPATCH', $user); - // End call triggers - - if ($result < 0) - { + if (! $error) { + $result = $commande->calcAndSetStatusDispatch($user, GETPOST('closeopenorder')?1:0); + if ($result < 0) { setEventMessages($commande->error, $commande->errors, 'errors'); - $error++; + $error ++; } } - if ($result >= 0 && ! $error) - { + if (! $notrigger && ! $error) { + global $conf, $langs, $user; + // Call trigger + + $result = $commande->call_trigger('ORDER_SUPPLIER_DISPATCH', $user); + // End call triggers + + if ($result < 0) { + setEventMessages($commande->error, $commande->errors, 'errors'); + $error ++; + } + } + + if ($result >= 0 && ! $error) { $db->commit(); - header("Location: dispatch.php?id=".$id); - exit; - } - else - { + header("Location: dispatch.php?id=" . $id); + exit(); + } else { $db->rollback(); } } - /* * View */ -$form = new Form($db); +$now = dol_now(); + +$form = new Form($db); $formproduct = new FormProduct($db); $warehouse_static = new Entrepot($db); $supplierorderdispatch = new CommandeFournisseurDispatch($db); +$help_url='EN:Module_Suppliers_Orders|FR:CommandeFournisseur|ES:Módulo_Pedidos_a_proveedores'; +llxHeader('', $langs->trans("Order"), $help_url, '', 0, 0, array('/fourn/js/lib_dispatch.js')); -$help_url='EN:CommandeFournisseur'; -llxHeader('',$langs->trans("OrderCard"),$help_url,'',0,0,array('/fourn/js/lib_dispatch.js')); +if ($id > 0 || ! empty($ref)) { + $soc = new Societe($db); + $soc->fetch($commande->socid); -$now=dol_now(); + $author = new User($db); + $author->fetch($commande->user_author_id); -$id = GETPOST('id','int'); -$ref= GETPOST('ref'); -if ($id > 0 || ! empty($ref)) -{ - //if ($mesg) print $mesg.'
'; + $head = ordersupplier_prepare_head($commande); - $commande = new CommandeFournisseur($db); + $title = $langs->trans("SupplierOrder"); + dol_fiche_head($head, 'dispatch', $title, 0, 'order'); - $result=$commande->fetch($id,$ref); - if ($result >= 0) - { - $soc = new Societe($db); - $soc->fetch($commande->socid); + /* + * Commande + */ + print ''; - $author = new User($db); - $author->fetch($commande->user_author_id); + // Ref + print ''; + print ''; + print ''; - $head = ordersupplier_prepare_head($commande); + // Fournisseur + print '"; + print ''; + print ''; - $title=$langs->trans("SupplierOrder"); - dol_fiche_head($head, 'dispatch', $title, 0, 'order'); + // Statut + print ''; + print ''; + print '"; - /* - * Commande - */ - print '
' . $langs->trans("Ref") . ''; + print $form->showrefnav($commande, 'ref', '', 1, 'ref', 'ref'); + print '
' . $langs->trans("Supplier") . "' . $soc->getNomUrl(1, 'supplier') . '
' . $langs->trans("Status") . ''; + print $commande->getLibStatut(4); + print "
'; - - // Ref - print ''; - print ''; - print ''; - - // Fournisseur - print '"; - print ''; - print ''; - - // Statut - print ''; - print ''; - print '"; - // Date - if ($commande->methode_commande_id > 0) - { - print '"; - - if ($commande->methode_commande) - { - print ''; - } + if ($commande->methode_commande) { + print ''; } + } - // Auteur - print ''; - print ''; - print ''; + // Auteur + print ''; + print ''; + print ''; - print "
'.$langs->trans("Ref").''; - print $form->showrefnav($commande,'ref','',1,'ref','ref'); - print '
'.$langs->trans("Supplier")."'.$soc->getNomUrl(1,'supplier').'
'.$langs->trans("Status").''; - print $commande->getLibStatut(4); + // Date + if ($commande->methode_commande_id > 0) { + print '
' . $langs->trans("Date") . ''; + if ($commande->date_commande) { + print dol_print_date($commande->date_commande, "dayhourtext") . "\n"; + } print "
'.$langs->trans("Date").''; - if ($commande->date_commande) - { - print dol_print_date($commande->date_commande,"dayhourtext")."\n"; - } - print "
'.$langs->trans("Method").''.$commande->methode_commande.'
' . $langs->trans("Method") . '' . $commande->methode_commande . '
'.$langs->trans("AuthorRequest").''.$author->getNomUrl(1).'
' . $langs->trans("AuthorRequest") . '' . $author->getNomUrl(1) . '
"; + print ""; - //if ($mesg) print $mesg; - print '
'; + // if ($mesg) print $mesg; + print '
'; - - $disabled=1; - if (! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER)) $disabled=0; + $disabled = 1; + if (! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER)) + $disabled = 0; /* - * Lignes de commandes - */ - if ($commande->statut <= 2 || $commande->statut >= 6) - { - print $langs->trans("OrderStatusNotReadyToDispatch"); - } + * Lignes de commandes + */ + if ($commande->statut <= 2 || $commande->statut >= 6) { + print $langs->trans("OrderStatusNotReadyToDispatch"); + } - if ($commande->statut == 3 || $commande->statut == 4 || $commande->statut == 5) - { - $entrepot = new Entrepot($db); - $listwarehouses=$entrepot->list_array(1); + if ($commande->statut == 3 || $commande->statut == 4 || $commande->statut == 5) { + $entrepot = new Entrepot($db); + $listwarehouses = $entrepot->list_array(1); - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print '
'; - // Set $products_dispatched with qty dispatched for each product id - $products_dispatched = array(); - $sql = "SELECT l.rowid, cfd.fk_product, sum(cfd.qty) as qty"; - $sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur_dispatch as cfd"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."commande_fournisseurdet as l on l.rowid = cfd.fk_commandefourndet"; - $sql.= " WHERE cfd.fk_commande = ".$commande->id; - $sql.= " GROUP BY l.rowid, cfd.fk_product"; - - $resql = $db->query($sql); - if ($resql) - { - $num = $db->num_rows($resql); - $i = 0; - - if ($num) - { - while ($i < $num) - { - $objd = $db->fetch_object($resql); - $products_dispatched[$objd->rowid] = price2num($objd->qty, 5); - $i++; - } - } - $db->free($resql); - } - - $sql = "SELECT l.rowid, l.fk_product, l.subprice, l.remise_percent, SUM(l.qty) as qty,"; - $sql.= " p.ref, p.label, p.tobatch"; - $sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as l"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON l.fk_product=p.rowid"; - $sql.= " WHERE l.fk_commande = ".$commande->id; - if(empty($conf->global->STOCK_SUPPORTS_SERVICES)) $sql.= " AND l.product_type = 0"; - $sql.= " GROUP BY p.ref, p.label, p.tobatch, l.rowid, l.fk_product, l.subprice, l.remise_percent"; // Calculation of amount dispatched is done per fk_product so we must group by fk_product - $sql.= " ORDER BY p.ref, p.label"; - - $resql = $db->query($sql); - if ($resql) - { - $num = $db->num_rows($resql); - $i = 0; - - if ($num) - { - print ''; - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print "\n"; - - if (! empty($conf->productbatch->enabled)) - { - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print "\n"; - } - - } - - $nbfreeproduct=0; - $nbproduct=0; - - $var=false; - while ($i < $num) - { - $objp = $db->fetch_object($resql); - - // On n'affiche pas les produits personnalises - if (! $objp->fk_product > 0) - { - $nbfreeproduct++; - } - else - { - $remaintodispatch=price2num($objp->qty - ((float) $products_dispatched[$objp->rowid]), 5); // Calculation of dispatched - if ($remaintodispatch < 0) $remaintodispatch=0; - - if ($remaintodispatch || empty($conf->global->SUPPLIER_ORDER_DISABLE_STOCK_DISPATCH_WHEN_TOTAL_REACHED)) - { - $nbproduct++; - - $var=!$var; - - // To show detail cref and description value, we must make calculation by cref - //print ($objp->cref?' ('.$objp->cref.')':''); - //if ($objp->description) print '
'.nl2br($objp->description); - $suffix='_0_'.$i; - - print "\n"; - print ''."\n"; - print ""; - - $linktoprod=''.img_object($langs->trans("ShowProduct"),'product').' '.$objp->ref.''; - $linktoprod.=' - '.$objp->label."\n"; - - if (! empty($conf->productbatch->enabled)) - { - if ($objp->tobatch) - { - print '"; - } - else - { - print '"; - print ''; - } - } - else - { - print '"; - } - - $var=!$var; - $up_ht_disc=$objp->subprice; - if (! empty($objp->remise_percent) && empty($conf->global->STOCK_EXCLUDE_DISCOUNT_FOR_PMP)) $up_ht_disc=price2num($up_ht_disc * (100 - $objp->remise_percent) / 100, 'MU'); - - // Qty ordered - print ''; - - // Already dispatched - print ''; - - if (! empty($conf->productbatch->enabled) && $objp->tobatch==1) - { - $type = 'batch'; - print ''; // Dispatch column - print ''; // Warehouse column - print ''; - - print ''; - print ''; - - print ''; - print ''; - print ''; - print ''; // Qty ordered + qty already dispatached - } - else - { - $type = 'dispatch'; - print ''; // Dispatch column - print ''; - print ''; - print ''; - print ''; - } - // Dispatch - print ''; - - // Warehouse - print '\n"; - - print "\n"; - } - } - $i++; - } - $db->free($resql); - } - else - { - dol_print_error($db); - } - - print "
'.$langs->trans("Description").''.$langs->trans("QtyOrdered").''.$langs->trans("QtyDispatchedShort").''.$langs->trans("QtyToDispatchShort").''.$langs->trans("Warehouse").'
'.$langs->trans("batch_number").''.$langs->trans("l_eatby").''.$langs->trans("l_sellby").' 
'; - print $linktoprod; - print "'; - print $linktoprod; - print "'; - print $langs->trans("ProductDoesNotUseBatchSerial"); - print ''; - print $linktoprod; - print "'.$objp->qty.''.$products_dispatched[$objp->rowid].''.img_picto($langs->trans('AddDispatchBatchLine'),'split.png','onClick="addDispatchLine('.$i.',\''.$type.'\')"').'
'; - print ''; - print ''; - print ''; - // hidden fields for js function - print ''; - print ''; - print ''; - print ''; - print ''; - $dlcdatesuffix=dol_mktime(0, 0, 0, GETPOST('dlc'.$suffix.'month'), GETPOST('dlc'.$suffix.'day'), GETPOST('dlc'.$suffix.'year')); - $form->select_date($dlcdatesuffix,'dlc'.$suffix,'','',1,""); - print ''; - $dluodatesuffix=dol_mktime(0, 0, 0, GETPOST('dluo'.$suffix.'month'), GETPOST('dluo'.$suffix.'day'), GETPOST('dluo'.$suffix.'year')); - $form->select_date($dluodatesuffix,'dluo'.$suffix,'','',1,""); - print ' '.img_picto($langs->trans('AddStockLocationLine'),'split.png','onClick="addDispatchLine('.$i.',\''.$type.'\')"').'
'; - print ''; - print ''; - print ''; - // hidden fields for js function - print ''; - print ''; - print ''; - print ''; - print ''; - if (count($listwarehouses)>1) - { - print $formproduct->selectWarehouses(GETPOST("entrepot".$suffix), "entrepot".$suffix,'',1,0,$objp->fk_product); - } - elseif (count($listwarehouses)==1) - { - print $formproduct->selectWarehouses(GETPOST("entrepot".$suffix), "entrepot".$suffix,'',0,0,$objp->fk_product); - } - else - { - print $langs->trans("NoWarehouseDefined"); - } - print "
\n"; - print "
\n"; - - if ($nbproduct) - { - print $langs->trans("Comment").' : '; - print 'trans("DispatchSupplierOrder",$commande->ref); - // print ' / '.$commande->ref_supplier; // Not yet available - print '" class="flat">   '; - - //print '
'; - print ''; - //print '
'; - } - if (! $nbproduct && $nbfreeproduct) - { - print $langs->trans("NoPredefinedProductToDispatch"); - } - - print ''; - } - - dol_fiche_end(); - - - // List of lines already dispatched - $sql = "SELECT p.ref, p.label,"; - $sql.= " e.rowid as warehouse_id, e.label as entrepot,"; - $sql.= " cfd.rowid as dispatchlineid, cfd.fk_product, cfd.qty, cfd.eatby, cfd.sellby, cfd.batch, cfd.comment, cfd.status"; - $sql.= " FROM ".MAIN_DB_PREFIX."product as p,"; - $sql.= " ".MAIN_DB_PREFIX."commande_fournisseur_dispatch as cfd"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."entrepot as e ON cfd.fk_entrepot = e.rowid"; - $sql.= " WHERE cfd.fk_commande = ".$commande->id; - $sql.= " AND cfd.fk_product = p.rowid"; - $sql.= " ORDER BY cfd.rowid ASC"; + // Set $products_dispatched with qty dispatched for each product id + $products_dispatched = array(); + $sql = "SELECT l.rowid, cfd.fk_product, sum(cfd.qty) as qty"; + $sql .= " FROM " . MAIN_DB_PREFIX . "commande_fournisseur_dispatch as cfd"; + $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "commande_fournisseurdet as l on l.rowid = cfd.fk_commandefourndet"; + $sql .= " WHERE cfd.fk_commande = " . $commande->id; + $sql .= " GROUP BY l.rowid, cfd.fk_product"; $resql = $db->query($sql); - if ($resql) - { + if ($resql) { $num = $db->num_rows($resql); $i = 0; - if ($num > 0) - { - print "
\n"; - - print load_fiche_titre($langs->trans("ReceivingForSameOrder")); - - print ''; - - print ''; - print ''; - if (! empty($conf->productbatch->enabled)) - { - print ''; - print ''; - print ''; + if ($num) { + while ( $i < $num ) { + $objd = $db->fetch_object($resql); + $products_dispatched[$objd->rowid] = price2num($objd->qty, 5); + $i ++; } - print ''; + } + $db->free($resql); + } + + $sql = "SELECT l.rowid, l.fk_product, l.subprice, l.remise_percent, SUM(l.qty) as qty,"; + $sql .= " p.ref, p.label, p.tobatch"; + $sql .= " FROM " . MAIN_DB_PREFIX . "commande_fournisseurdet as l"; + $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON l.fk_product=p.rowid"; + $sql .= " WHERE l.fk_commande = " . $commande->id; + if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) + $sql .= " AND l.product_type = 0"; + $sql .= " GROUP BY p.ref, p.label, p.tobatch, l.rowid, l.fk_product, l.subprice, l.remise_percent"; // Calculation of amount dispatched is done per fk_product so we must group by fk_product + $sql .= " ORDER BY p.ref, p.label"; + + $resql = $db->query($sql); + if ($resql) { + $num = $db->num_rows($resql); + $i = 0; + + if ($num) { + print ''; + + print ''; print ''; - print ''; - print ''; - if (! empty($conf->global->SUPPLIER_ORDER_USE_DISPATCH_STATUS)) print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; print "\n"; - $var=false; - - while ($i < $num) - { - $objp = $db->fetch_object($resql); - - print ""; - print '\n"; - - if (! empty($conf->productbatch->enabled)) - { - print ''; - print ''; - print ''; - } - - // Qty - print ''; - print ''; - - // Warehouse - print ''; - - // Comment - print ''; - - // Status - if (! empty($conf->global->SUPPLIER_ORDER_USE_DISPATCH_STATUS)) - { - print ''; - - // Add button to check/uncheck disaptching - print ''; - } - + if (! empty($conf->productbatch->enabled)) { + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; print "\n"; - - $i++; - $var=!$var; } - $db->free($resql); - - print "
'.$langs->trans("Description").''.$langs->trans("batch_number").''.$langs->trans("l_eatby").''.$langs->trans("l_sellby").''.$langs->trans("QtyDispatched").'
' . $langs->trans("Description") . ''.$langs->trans("Warehouse").''.$langs->trans("Comment").''.$langs->trans("Status").'' . $langs->trans("QtyOrdered") . '' . $langs->trans("QtyDispatchedShort") . '' . $langs->trans("QtyToDispatchShort") . '' . $langs->trans("Warehouse") . '
'; - print ''.img_object($langs->trans("ShowProduct"),'product').' '.$objp->ref.''; - print ' - '.$objp->label; - print "'.$objp->batch.''.dol_print_date($db->jdate($objp->eatby),'day').''.dol_print_date($db->jdate($objp->sellby),'day').''.$objp->qty.' '; - $warehouse_static->id=$objp->warehouse_id; - $warehouse_static->libelle=$objp->entrepot; - print $warehouse_static->getNomUrl(1); - print ''.dol_trunc($objp->comment).''; - $supplierorderdispatch->status = (empty($objp->status)?0:$objp->status); - //print $supplierorderdispatch->status; - print $supplierorderdispatch->getLibStatut(5); - print ''; - if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->fournisseur->commande->receptionner)) - || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->fournisseur->commande_advance->check)) - ) - { - if (empty($objp->status)) - { - print ''.$langs->trans("Approve").''; - print ''.$langs->trans("Deny").''; - } - else - { - print ''.$langs->trans("Disapprove").''; - print ''.$langs->trans("Deny").''; - } - } - else - { - $disabled=''; - if ($commande->statut == 5) $disabled=1; - if (empty($objp->status)) - { - print 'dispatchlineid.'">'.$langs->trans("Approve").''; - print 'dispatchlineid.'">'.$langs->trans("Deny").''; - } - if ($objp->status == 1) - { - print 'dispatchlineid.'">'.$langs->trans("Reinit").''; - print 'dispatchlineid.'">'.$langs->trans("Deny").''; - } - if ($objp->status == 2) - { - print 'dispatchlineid.'">'.$langs->trans("Reinit").''; - print 'dispatchlineid.'">'.$langs->trans("Approve").''; - } - } - print '
' . $langs->trans("batch_number") . '' . $langs->trans("EatByDate") . '' . $langs->trans("SellByDate") . ' 
\n"; } - } - else - { + + $nbfreeproduct = 0; + $nbproduct = 0; + + $var = false; + while ( $i < $num ) { + $objp = $db->fetch_object($resql); + + // On n'affiche pas les produits personnalises + if (! $objp->fk_product > 0) { + $nbfreeproduct ++; + } else { + $remaintodispatch = price2num($objp->qty - (( float ) $products_dispatched[$objp->rowid]), 5); // Calculation of dispatched + if ($remaintodispatch < 0) + $remaintodispatch = 0; + + if ($remaintodispatch || empty($conf->global->SUPPLIER_ORDER_DISABLE_STOCK_DISPATCH_WHEN_TOTAL_REACHED)) { + $nbproduct ++; + + $var = ! $var; + + // To show detail cref and description value, we must make calculation by cref + // print ($objp->cref?' ('.$objp->cref.')':''); + // if ($objp->description) print '
'.nl2br($objp->description); + $suffix = '_0_' . $i; + + print "\n"; + print '' . "\n"; + print ""; + + $linktoprod = '' . img_object($langs->trans("ShowProduct"), 'product') . ' ' . $objp->ref . ''; + $linktoprod .= ' - ' . $objp->label . "\n"; + + if (! empty($conf->productbatch->enabled)) { + if ($objp->tobatch) { + print ''; + print $linktoprod; + print ""; + } else { + print ''; + print $linktoprod; + print ""; + print ''; + print $langs->trans("ProductDoesNotUseBatchSerial"); + print ''; + } + } else { + print ''; + print $linktoprod; + print ""; + } + + $var = ! $var; + $up_ht_disc = $objp->subprice; + if (! empty($objp->remise_percent) && empty($conf->global->STOCK_EXCLUDE_DISCOUNT_FOR_PMP)) + $up_ht_disc = price2num($up_ht_disc * (100 - $objp->remise_percent) / 100, 'MU'); + + // Qty ordered + print '' . $objp->qty . ''; + + // Already dispatched + print '' . $products_dispatched[$objp->rowid] . ''; + + if (! empty($conf->productbatch->enabled) && $objp->tobatch == 1) { + $type = 'batch'; + print '' . img_picto($langs->trans('AddDispatchBatchLine'), 'split.png', 'onClick="addDispatchLine(' . $i . ',\'' . $type . '\')"') . ''; // Dispatch column + print ''; // Warehouse column + print ''; + + print ''; + print ''; + print ''; + print ''; + print ''; + // hidden fields for js function + print ''; + print ''; + print ''; + + print ''; + print ''; + print ''; + print ''; + $dlcdatesuffix = dol_mktime(0, 0, 0, GETPOST('dlc' . $suffix . 'month'), GETPOST('dlc' . $suffix . 'day'), GETPOST('dlc' . $suffix . 'year')); + $form->select_date($dlcdatesuffix, 'dlc' . $suffix, '', '', 1, ""); + print ''; + print ''; + $dluodatesuffix = dol_mktime(0, 0, 0, GETPOST('dluo' . $suffix . 'month'), GETPOST('dluo' . $suffix . 'day'), GETPOST('dluo' . $suffix . 'year')); + $form->select_date($dluodatesuffix, 'dluo' . $suffix, '', '', 1, ""); + print ''; + print ' '; // Qty ordered + qty already dispatached + } else { + $type = 'dispatch'; + print '' . img_picto($langs->trans('AddStockLocationLine'), 'split.png', 'onClick="addDispatchLine(' . $i . ',\'' . $type . '\')"') . ''; // Dispatch column + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + // hidden fields for js function + print ''; + print ''; + print ''; + } + // Dispatch + print ''; + print ''; + print ''; + + // Warehouse + print ''; + if (count($listwarehouses) > 1) { + print $formproduct->selectWarehouses(GETPOST("entrepot" . $suffix), "entrepot" . $suffix, '', 1, 0, $objp->fk_product); + } elseif (count($listwarehouses) == 1) { + print $formproduct->selectWarehouses(GETPOST("entrepot" . $suffix), "entrepot" . $suffix, '', 0, 0, $objp->fk_product); + } else { + print $langs->trans("NoWarehouseDefined"); + } + print "\n"; + + print "\n"; + } + } + $i ++; + } + $db->free($resql); + } else { dol_print_error($db); } + + print "\n"; + print "
\n"; + + if ($nbproduct) + { + $checkboxlabel=$langs->trans("CloseReceivedSupplierOrdersAutomatically", $langs->transnoentitiesnoconv($commande->statuts[5])); + + print '
'; + print $langs->trans("Comment") . ' : '; + print 'trans("DispatchSupplierOrder", $commande->ref); + // print ' / '.$commande->ref_supplier; // Not yet available + print '" class="flat">
'; + + print ' '.$checkboxlabel; + + // print '
'; + print '
'; + // print '
'; + } + if (! $nbproduct && $nbfreeproduct) { + print $langs->trans("NoPredefinedProductToDispatch"); + } + + print ''; } - else - { - // Commande non trouvee + + dol_fiche_end(); + + // List of lines already dispatched + $sql = "SELECT p.ref, p.label,"; + $sql .= " e.rowid as warehouse_id, e.label as entrepot,"; + $sql .= " cfd.rowid as dispatchlineid, cfd.fk_product, cfd.qty, cfd.eatby, cfd.sellby, cfd.batch, cfd.comment, cfd.status"; + $sql .= " FROM " . MAIN_DB_PREFIX . "product as p,"; + $sql .= " " . MAIN_DB_PREFIX . "commande_fournisseur_dispatch as cfd"; + $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "entrepot as e ON cfd.fk_entrepot = e.rowid"; + $sql .= " WHERE cfd.fk_commande = " . $commande->id; + $sql .= " AND cfd.fk_product = p.rowid"; + $sql .= " ORDER BY cfd.rowid ASC"; + + $resql = $db->query($sql); + if ($resql) { + $num = $db->num_rows($resql); + $i = 0; + + if ($num > 0) { + print "
\n"; + + print load_fiche_titre($langs->trans("ReceivingForSameOrder")); + + print ''; + + print ''; + print ''; + if (! empty($conf->productbatch->enabled)) { + print ''; + print ''; + print ''; + } + print ''; + print ''; + print ''; + print ''; + if (! empty($conf->global->SUPPLIER_ORDER_USE_DISPATCH_STATUS)) + print ''; + print "\n"; + + $var = false; + + while ( $i < $num ) { + $objp = $db->fetch_object($resql); + + print ""; + print '\n"; + + if (! empty($conf->productbatch->enabled)) { + print ''; + print ''; + print ''; + } + + // Qty + print ''; + print ''; + + // Warehouse + print ''; + + // Comment + print ''; + + // Status + if (! empty($conf->global->SUPPLIER_ORDER_USE_DISPATCH_STATUS)) { + print ''; + + // Add button to check/uncheck disaptching + print ''; + } + + print "\n"; + + $i ++; + $var = ! $var; + } + $db->free($resql); + + print "
' . $langs->trans("Description") . '' . $langs->trans("batch_number") . '' . $langs->trans("EatByDate") . '' . $langs->trans("SellByDate") . '' . $langs->trans("QtyDispatched") . '' . $langs->trans("Warehouse") . '' . $langs->trans("Comment") . '' . $langs->trans("Status") . '
'; + print '' . img_object($langs->trans("ShowProduct"), 'product') . ' ' . $objp->ref . ''; + print ' - ' . $objp->label; + print "' . $objp->batch . '' . dol_print_date($db->jdate($objp->eatby), 'day') . '' . dol_print_date($db->jdate($objp->sellby), 'day') . '' . $objp->qty . ' '; + $warehouse_static->id = $objp->warehouse_id; + $warehouse_static->libelle = $objp->entrepot; + print $warehouse_static->getNomUrl(1); + print '' . dol_trunc($objp->comment) . ''; + $supplierorderdispatch->status = (empty($objp->status) ? 0 : $objp->status); + // print $supplierorderdispatch->status; + print $supplierorderdispatch->getLibStatut(5); + print ''; + if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->fournisseur->commande->receptionner)) || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->fournisseur->commande_advance->check))) { + if (empty($objp->status)) { + print '' . $langs->trans("Approve") . ''; + print '' . $langs->trans("Deny") . ''; + } else { + print '' . $langs->trans("Disapprove") . ''; + print '' . $langs->trans("Deny") . ''; + } + } else { + $disabled = ''; + if ($commande->statut == 5) + $disabled = 1; + if (empty($objp->status)) { + print 'dispatchlineid . '">' . $langs->trans("Approve") . ''; + print 'dispatchlineid . '">' . $langs->trans("Deny") . ''; + } + if ($objp->status == 1) { + print 'dispatchlineid . '">' . $langs->trans("Reinit") . ''; + print 'dispatchlineid . '">' . $langs->trans("Deny") . ''; + } + if ($objp->status == 2) { + print 'dispatchlineid . '">' . $langs->trans("Reinit") . ''; + print 'dispatchlineid . '">' . $langs->trans("Approve") . ''; + } + } + print '
\n"; + } + } else { dol_print_error($db); } } - llxFooter(); $db->close(); diff --git a/htdocs/fourn/commande/document.php b/htdocs/fourn/commande/document.php index e78320c0043..35594d0f012 100644 --- a/htdocs/fourn/commande/document.php +++ b/htdocs/fourn/commande/document.php @@ -89,7 +89,8 @@ $form = new Form($db); if ($object->id > 0) { - llxHeader(); + $help_url='EN:Module_Suppliers_Orders|FR:CommandeFournisseur|ES:Módulo_Pedidos_a_proveedores'; + llxHeader('',$langs->trans("Order"),$help_url); $author = new User($db); $author->fetch($object->user_author_id); @@ -113,7 +114,7 @@ if ($object->id > 0) $linkback = ''.$langs->trans("BackToList").''; // Ref - print ''.$langs->trans("Ref").''; + print ''.$langs->trans("Ref").''; print ''; print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref'); print ''; @@ -160,6 +161,7 @@ if ($object->id > 0) $modulepart = 'commande_fournisseur'; $permission = $user->rights->fournisseur->commande->creer; + $permtoedit = $user->rights->fournisseur->commande->creer; $param = '&id=' . $object->id; include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php'; diff --git a/htdocs/fourn/commande/index.php b/htdocs/fourn/commande/index.php index a797bc19fdc..fe702b5838b 100644 --- a/htdocs/fourn/commande/index.php +++ b/htdocs/fourn/commande/index.php @@ -19,9 +19,9 @@ */ /** - * \file htdocs/fourn/commande/index.php - * \ingroup commande fournisseur - * \brief Home page of supplier's orders area + * \file htdocs/fourn/commande/index.php + * \ingroup commande fournisseur + * \brief Home page of supplier's orders area */ require '../../main.inc.php'; @@ -50,8 +50,7 @@ $formfile = new FormFile($db); print load_fiche_titre($langs->trans("SuppliersOrdersArea")); -print ''; -print '
'; +print '
'; /* @@ -84,72 +83,72 @@ $sql.= " GROUP BY cf.fk_statut"; $resql = $db->query($sql); if ($resql) { - $num = $db->num_rows($resql); - $i = 0; + $num = $db->num_rows($resql); + $i = 0; - $var=True; + $var=True; - $total=0; - $totalinprocess=0; - $dataseries=array(); - $vals=array(); - // 0=Draft -> 1=Validated -> 2=Approved -> 3=Process runing -> 4=Received partially -> 5=Received totally -> (reopen) 4=Received partially - // -> 7=Canceled/Never received -> (reopen) 3=Process runing - // -> 6=Canceled -> (reopen) 2=Approved - while ($i < $num) - { - $row = $db->fetch_row($resql); - if ($row) - { - if ($row[1]!=7 && $row[1]!=6 && $row[1]!=5) - { - $vals[$row[1]]=$row[0]; - $totalinprocess+=$row[0]; - } - $total+=$row[0]; - } - $i++; - } - $db->free($resql); + $total=0; + $totalinprocess=0; + $dataseries=array(); + $vals=array(); + // 0=Draft -> 1=Validated -> 2=Approved -> 3=Process runing -> 4=Received partially -> 5=Received totally -> (reopen) 4=Received partially + // -> 7=Canceled/Never received -> (reopen) 3=Process runing + // -> 6=Canceled -> (reopen) 2=Approved + while ($i < $num) + { + $row = $db->fetch_row($resql); + if ($row) + { + if ($row[1]!=7 && $row[1]!=6 && $row[1]!=5) + { + $vals[$row[1]]=$row[0]; + $totalinprocess+=$row[0]; + } + $total+=$row[0]; + } + $i++; + } + $db->free($resql); - print ''; - print ''; - print "\n"; - foreach (array(0,1,2,3,4,5,6) as $statut) - { - $dataseries[]=array('label'=>$commandestatic->LibStatut($statut,1),'data'=>(isset($vals[$statut])?(int) $vals[$statut]:0)); - if (! $conf->use_javascript_ajax) - { - $var=!$var; - print ""; - print ''; - print ''; - print "\n"; - } - } - if ($conf->use_javascript_ajax) - { - print ''; - } - //if ($totalinprocess != $total) - //print ''; - print ''; + print '
'.$langs->trans("Statistics").' - '.$langs->trans("SuppliersOrders").'
'.$commandestatic->LibStatut($statut,0).''.(isset($vals[$statut])?$vals[$statut]:0).'
'; - $data=array('series'=>$dataseries); - dol_print_graph('stats',300,180,$data,1,'pie',1,'',0); - print '
'.$langs->trans("Total").' ('.$langs->trans("SuppliersOrdersRunning").')'.$totalinprocess.'
'.$langs->trans("Total").''.$total.'
'; + print ''; + print "\n"; + foreach (array(0,1,2,3,4,5,6) as $statut) + { + $dataseries[]=array('label'=>$commandestatic->LibStatut($statut,1),'data'=>(isset($vals[$statut])?(int) $vals[$statut]:0)); + if (! $conf->use_javascript_ajax) + { + $var=!$var; + print ""; + print ''; + print ''; + print "\n"; + } + } + if ($conf->use_javascript_ajax) + { + print ''; + } + //if ($totalinprocess != $total) + //print ''; + print ''; - print "
'.$langs->trans("Statistics").' - '.$langs->trans("SuppliersOrders").'
'.$commandestatic->LibStatut($statut,0).''.(isset($vals[$statut])?$vals[$statut]:0).'
'; + $data=array('series'=>$dataseries); + dol_print_graph('stats',300,180,$data,1,'pie',1,'',0); + print '
'.$langs->trans("Total").' ('.$langs->trans("SuppliersOrdersRunning").')'.$totalinprocess.'
'.$langs->trans("Total").''.$total.'

"; + print "

"; } else { - dol_print_error($db); + dol_print_error($db); } /* * Legends / Status * - * Motivo: Mostrar todos os Status e dar a possibilidade de filtrar apenas um deles - * Reason: Show all Status and give the possibility to filter only one + * Motivo: Mostrar todos os Status e dar a possibilidade de filtrar apenas um deles + * Reason: Show all Status and give the possibility to filter only one */ $sql = "SELECT count(cf.rowid), fk_statut"; @@ -165,34 +164,34 @@ $sql.= " GROUP BY cf.fk_statut"; $resql = $db->query($sql); if ($resql) { - $num = $db->num_rows($resql); - $i = 0; + $num = $db->num_rows($resql); + $i = 0; - print ''; + print '
'; - print ''; - print ''; - print "\n"; - $var=True; + print ''; + print ''; + print "\n"; + $var=True; - while ($i < $num) - { - $row = $db->fetch_row($resql); - $var=!$var; + while ($i < $num) + { + $row = $db->fetch_row($resql); + $var=!$var; - print ""; - print ''; - print ''; + print ""; + print ''; + print ''; - print "\n"; - $i++; - } - print "
'.$langs->trans("Status").''.$langs->trans("Nb").'
'.$langs->trans("Status").''.$langs->trans("Nb").'
'.$langs->trans($commandestatic->statuts[$row[1]]).''.$row[0].' '.$commandestatic->LibStatut($row[1],3).'
'.$langs->trans($commandestatic->statuts[$row[1]]).''.$row[0].' '.$commandestatic->LibStatut($row[1],3).'

"; - $db->free($resql); + print "\n"; + $i++; + } + print "
"; + $db->free($resql); } else { - dol_print_error($db); + dol_print_error($db); } @@ -202,41 +201,41 @@ else if (! empty($conf->fournisseur->enabled)) { - $sql = "SELECT c.rowid, c.ref, s.nom as name, s.rowid as socid"; - $sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as c"; - $sql.= ", ".MAIN_DB_PREFIX."societe as s"; - if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql.= " WHERE c.fk_soc = s.rowid"; - $sql.= " AND c.entity = ".$conf->entity; - $sql.= " AND c.fk_statut = 0"; - if (! empty($socid)) $sql.= " AND c.fk_soc = ".$socid; - if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; + $sql = "SELECT c.rowid, c.ref, s.nom as name, s.rowid as socid"; + $sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as c"; + $sql.= ", ".MAIN_DB_PREFIX."societe as s"; + if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + $sql.= " WHERE c.fk_soc = s.rowid"; + $sql.= " AND c.entity = ".$conf->entity; + $sql.= " AND c.fk_statut = 0"; + if (! empty($socid)) $sql.= " AND c.fk_soc = ".$socid; + if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; - $resql=$db->query($sql); - if ($resql) - { - print ''; - print ''; - print ''; - $langs->load("orders"); - $num = $db->num_rows($resql); - if ($num) - { - $i = 0; - $var = True; - while ($i < $num) - { - $var=!$var; - $obj = $db->fetch_object($resql); - print ""; - print '"; - print ''; - $i++; - } - } - print "
'.$langs->trans("DraftOrders").'
'; - print "rowid."\">".img_object($langs->trans("ShowOrder"),"order").' '.$obj->ref."'.img_object($langs->trans("ShowCompany"),"company").' '.dol_trunc($obj->name,24).'

"; - } + $resql=$db->query($sql); + if ($resql) + { + print ''; + print ''; + print ''; + $langs->load("orders"); + $num = $db->num_rows($resql); + if ($num) + { + $i = 0; + $var = True; + while ($i < $num) + { + $var=!$var; + $obj = $db->fetch_object($resql); + print ""; + print '"; + print ''; + $i++; + } + } + print "
'.$langs->trans("DraftOrders").'
'; + print "rowid."\">".img_object($langs->trans("ShowOrder"),"order").' '.$obj->ref."'.img_object($langs->trans("ShowCompany"),"company").' '.dol_trunc($obj->name,24).'

"; + } } @@ -258,40 +257,40 @@ $sql.= " AND subperms = 'approuver'"; $resql = $db->query($sql); if ($resql) { - $num = $db->num_rows($resql); - $i = 0; + $num = $db->num_rows($resql); + $i = 0; - print ''; - print ''; - print "\n"; - $var=True; + print '
'.$langs->trans("UserWithApproveOrderGrant").'
'; + print ''; + print "\n"; + $var=True; - while ($i < $num) - { - $obj = $db->fetch_object($resql); - $var=!$var; + while ($i < $num) + { + $obj = $db->fetch_object($resql); + $var=!$var; - print ""; - print ''; - print "\n"; - $i++; - } - print "
'.$langs->trans("UserWithApproveOrderGrant").'
'; - $userstatic->id=$obj->rowid; - $userstatic->lastname=$obj->lastname; - $userstatic->firstname=$obj->firstname; - $userstatic->email=$obj->email; - print $userstatic->getNomUrl(1); - print '

"; - $db->free($resql); + print ""; + print ''; + $userstatic->id=$obj->rowid; + $userstatic->lastname=$obj->lastname; + $userstatic->firstname=$obj->firstname; + $userstatic->email=$obj->email; + print $userstatic->getNomUrl(1); + print ''; + print "\n"; + $i++; + } + print "
"; + $db->free($resql); } else { - dol_print_error($db); + dol_print_error($db); } -print ''; +print '
'; /* @@ -314,52 +313,52 @@ $sql.= $db->plimit($max, 0); $resql=$db->query($sql); if ($resql) { - print ''; - print ''; - print ''; + print '
'.$langs->trans("LastModifiedOrders",$max).'
'; + print ''; + print ''; - $num = $db->num_rows($resql); - if ($num) - { - $i = 0; - $var = True; - while ($i < $num) - { - $var=!$var; - $obj = $db->fetch_object($resql); + $num = $db->num_rows($resql); + if ($num) + { + $i = 0; + $var = True; + while ($i < $num) + { + $var=!$var; + $obj = $db->fetch_object($resql); - print ""; - print '"; + print '
'.$langs->trans("LastModifiedOrders",$max).'
'; + print "
'; - $commandestatic->id=$obj->rowid; - $commandestatic->ref=$obj->ref; + $commandestatic->id=$obj->rowid; + $commandestatic->ref=$obj->ref; - print ''; - print ''; + print '
'; - print $commandestatic->getNomUrl(1); - print '
'; + print ''; - print ''; + print ''; - print '
'; + print $commandestatic->getNomUrl(1); + print ''; - print ' '; - print ''; + print ' '; + print ''; - $filename=dol_sanitizeFileName($obj->ref); - $filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($obj->ref); - $urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid; - print $formfile->getDocumentsLink($commandestatic->element, $filename, $filedir); - print '
'; + print '
'; + $filename=dol_sanitizeFileName($obj->ref); + $filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($obj->ref); + $urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid; + print $formfile->getDocumentsLink($commandestatic->element, $filename, $filedir); + print '
'; - print ''; + print ''; - print ''.img_object($langs->trans("ShowCompany"),"company").' '.$obj->name.''; - print ''.dol_print_date($db->jdate($obj->tms),'day').''; - print ''.$commandestatic->LibStatut($obj->fk_statut,5).''; - print ''; - $i++; - } - } - print "
"; + print ''.img_object($langs->trans("ShowCompany"),"company").' '.$obj->name.''; + print ''.dol_print_date($db->jdate($obj->tms),'day').''; + print ''.$commandestatic->LibStatut($obj->fk_statut,5).''; + print ''; + $i++; + } + } + print "
"; } else dol_print_error($db); @@ -433,7 +432,7 @@ print "
"; } */ -print ''; +print '
'; llxFooter(); diff --git a/htdocs/fourn/commande/info.php b/htdocs/fourn/commande/info.php index c8ed0e73660..5cd8510d854 100644 --- a/htdocs/fourn/commande/info.php +++ b/htdocs/fourn/commande/info.php @@ -62,7 +62,8 @@ if ($id > 0 || ! empty($ref)) $soc->fetch($object->socid); - llxHeader('',$langs->trans("History"),"CommandeFournisseur"); + $help_url='EN:Module_Suppliers_Orders|FR:CommandeFournisseur|ES:Módulo_Pedidos_a_proveedores'; + llxHeader('',$langs->trans("Order"),$help_url); $head = ordersupplier_prepare_head($object); diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 3f2f77c62e8..d184845cb76 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -5,6 +5,7 @@ * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2014 Marcos García * Copyright (C) 2014 Juanjo Menent + * Copyright (C) 2016 Ferran Marcet * * 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 @@ -129,8 +130,8 @@ if (empty($user->socid)) $fieldstosearchall["cf.note_private"]="NotePrivate"; $checkedtypetiers=0; $arrayfields=array( 'cf.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1), - 'cf.ref_supplier'=>array('label'=>$langs->trans("RefOrderSupplier"), 'checked'=>1, 'enabled'=>$conf->global->SUPPLIER_ORDER_HIDE_REF_SUPPLIER), - 'p.project_ref'=>array('label'=>$langs->trans("ProjectRef"), 'enabled'=>$conf->global->PROJECT_SHOW_REF_INTO_LISTS), + 'cf.ref_supplier'=>array('label'=>$langs->trans("RefOrderSupplier"), 'checked'=>1, 'enabled'=>1), + 'p.project_ref'=>array('label'=>$langs->trans("ProjectRef"), 'checked'=>0, 'enabled'=>1), 'u.login'=>array('label'=>$langs->trans("AuthorRequest"), 'checked'=>1), 's.nom'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1), 's.town'=>array('label'=>$langs->trans("Town"), 'checked'=>1), @@ -399,6 +400,7 @@ if ($resql) if ($socid > 0) $param.='&socid='.$socid; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; + if ($sall) $param.="&search_all=".$sall; if ($orderday) $param.='&orderday='.$orderday; if ($ordermonth) $param.='&ordermonth='.$ordermonth; if ($orderyear) $param.='&orderyear='.$orderyear; @@ -502,7 +504,7 @@ if ($resql) 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['cf.fk_author']['checked'])) print_liste_field_titre($arrayfields['cf.fk_author']['label'],$_SERVER["PHP_SELF"],"u.login","",$param,'',$sortfield,$sortorder); if (! empty($arrayfields['cf.date_commande']['checked'])) print_liste_field_titre($arrayfields['cf.date_commande']['label'],$_SERVER["PHP_SELF"],"cf.date_commande","",$param,'align="center"',$sortfield,$sortorder); - if (! empty($arrayfields['cf.date_delivery']['checked'])) print_liste_field_titre($arrayfields['cf.date_delivery']['label'],$_SERVER["PHP_SELF"],'cf.date_livraison','',$param, 'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['cf.date_delivery']['checked'])) print_liste_field_titre($arrayfields['cf.date_delivery']['label'],$_SERVER["PHP_SELF"],'cf.date_livraison','',$param, 'align="center"',$sortfield,$sortorder); if (! empty($arrayfields['cf.total_ht']['checked'])) print_liste_field_titre($arrayfields['cf.total_ht']['label'],$_SERVER["PHP_SELF"],"cf.total_ht","",$param,'align="right"',$sortfield,$sortorder); if (! empty($arrayfields['cf.total_vat']['checked'])) print_liste_field_titre($arrayfields['cf.total_vat']['label'],$_SERVER["PHP_SELF"],"cf.tva","",$param,'align="right"',$sortfield,$sortorder); if (! empty($arrayfields['cf.total_ttc']['checked'])) print_liste_field_titre($arrayfields['cf.total_ttc']['label'],$_SERVER["PHP_SELF"],"cf.total_ttc","",$param,'align="right"',$sortfield,$sortorder); @@ -712,11 +714,23 @@ if ($resql) // Ref if (! empty($arrayfields['cf.ref']['checked'])) { - print ''; + print ''; + + print ''; + // Picto + Ref + print ''; + // Warning + //print ''; + // Other picto tool + print '
'; print $objectstatic->getNomUrl(1); + print ''; + //print ''; $filename=dol_sanitizeFileName($obj->ref); $filedir=$conf->fournisseur->dir_output.'/commande' . '/' . dol_sanitizeFileName($obj->ref); print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir); + print '
'; + print ''."\n"; if (! $i) $totalarray['nbfield']++; } diff --git a/htdocs/fourn/commande/note.php b/htdocs/fourn/commande/note.php index 6a1c6cfe80e..1e2ae3e4c7b 100644 --- a/htdocs/fourn/commande/note.php +++ b/htdocs/fourn/commande/note.php @@ -57,8 +57,8 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, /* * View */ - -llxHeader('',$langs->trans("OrderCard"),"CommandeFournisseur"); +$help_url='EN:Module_Suppliers_Orders|FR:CommandeFournisseur|ES:Módulo_Pedidos_a_proveedores'; +llxHeader('',$langs->trans("Order"),$help_url); $form = new Form($db); @@ -94,7 +94,7 @@ if ($id > 0 || ! empty($ref)) $linkback = ''.$langs->trans("BackToList").''; // Ref - print ''.$langs->trans("Ref").''; + print ''.$langs->trans("Ref").''; print ''; print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref'); print ''; diff --git a/htdocs/fourn/commande/orderstoinvoice.php b/htdocs/fourn/commande/orderstoinvoice.php index 64f6aa4dff0..89f0a942172 100644 --- a/htdocs/fourn/commande/orderstoinvoice.php +++ b/htdocs/fourn/commande/orderstoinvoice.php @@ -71,11 +71,17 @@ $date_end = dol_mktime(23, 59, 59, $_REQUEST["date_endmonth"], $_REQUEST["date_e $date_starty = dol_mktime(0, 0, 0, $_REQUEST["date_start_delymonth"], $_REQUEST["date_start_delyday"], $_REQUEST["date_start_delyyear"]); // Date for local PHP server $date_endy = dol_mktime(23, 59, 59, $_REQUEST["date_end_delymonth"], $_REQUEST["date_end_delyday"], $_REQUEST["date_end_delyyear"]); -if ($action == 'create') { - if (is_array($selected) == false) { - $mesgs = array ( - '
' . $langs->trans('Error_OrderNotChecked') . '
' - ); +$extrafields = new ExtraFields($db); + +// fetch optionals attributes and labels +$extralabels=$extrafields->fetch_name_optionals_label('facture_fourn'); + +if ($action == 'create') +{ + if (! is_array($selected)) + { + $error++; + setEventMessages($langs->trans('Error_OrderNotChecked'), null, 'errors'); } else { $origin = GETPOST('origin'); $originid = GETPOST('originid'); @@ -87,11 +93,12 @@ include_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php'; $hookmanager = new HookManager($db); $hookmanager->initHooks(array('orderstoinvoicesupplier')); + /* * Actions */ -if (($action == 'create' || $action == 'add') && empty($mesgs)) { +if (($action == 'create' || $action == 'add') && ! $error) { require_once DOL_DOCUMENT_ROOT . '/core/lib/fourn.lib.php'; if (! empty($conf->projet->enabled)) @@ -160,6 +167,9 @@ if (($action == 'create' || $action == 'add') && empty($mesgs)) { if (empty($object->date_echeance)) $object->date_echeance = $object->calculate_date_lim_reglement(); + $ret = $extrafields->setOptionalsFromPost($extralabels,$object); + if ($ret < 0) $error++; + if ($_POST['origin'] && $_POST['originid']) { $object->linked_objects = $orders_id; $id = $object->create($user); @@ -360,6 +370,12 @@ if ($action == 'create' && !$error) { ); $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)) + { + $object=new FactureFournisseur($db); + print $object->showOptionals($extrafields,'edit'); + } + // Modele PDF print '' . $langs->trans('Model') . ''; print ''; diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index f078c714416..bd7d1317957 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -6,8 +6,9 @@ * Copyright (C) 2005-2013 Regis Houssin * Copyright (C) 2010-2014 Juanjo Menent * Copyright (C) 2013-2015 Philippe Grand - * Copyright (C) 2013 Florian Henry - * Copyright (C) 2014 Marcos García + * Copyright (C) 2013 Florian Henry + * Copyright (C) 2014 Marcos García + * Copyright (C) 2016 Alexandre Spangaro * * 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 @@ -55,12 +56,15 @@ $langs->load('banks'); if (!empty($conf->incoterm->enabled)) $langs->load('incoterm'); $id = (GETPOST('facid','int') ? GETPOST('facid','int') : GETPOST('id','int')); +$socid = GETPOST('socid', 'int'); $action = GETPOST("action"); $confirm = GETPOST("confirm"); $ref = GETPOST('ref','alpha'); -$cancel = GETPOST('cancel','alpha'); -$lineid = GETPOST('lineid', 'int'); -$projectid = GETPOST('projectid','int'); +$cancel = GETPOST('cancel','alpha'); +$lineid = GETPOST('lineid', 'int'); +$projectid = GETPOST('projectid','int'); +$origin = GETPOST('origin', 'alpha'); +$originid = GETPOST('origin', 'int'); //PDF $hidedetails = (GETPOST('hidedetails','int') ? GETPOST('hidedetails','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0)); @@ -85,7 +89,9 @@ $extralabels=$extrafields->fetch_name_optionals_label($object->table_element); if ($id > 0 || ! empty($ref)) { $ret=$object->fetch($id, $ref); - $object->fetch_thirdparty(); + if ($ret < 0) dol_print_error($db,$object->error); + $ret=$object->fetch_thirdparty(); + if ($ret < 0) dol_print_error($db,$object->error); } $permissionnote=$user->rights->fournisseur->facture->creer; // Used by the include of actions_setnotes.inc.php @@ -118,7 +124,7 @@ if (empty($reshook)) $object->fetch_thirdparty(); $result = $object->add_object_linked('order_supplier', GETPOST('linkedOrder')); } - + // Action clone object if ($action == 'confirm_clone' && $confirm == 'yes') { @@ -208,7 +214,7 @@ if (empty($reshook)) if ($result > 0) { // Define output language - $outputlangs = $langs; + /*$outputlangs = $langs; $newlang = ''; if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id'); @@ -221,7 +227,7 @@ if (empty($reshook)) if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { $ret = $object->fetch($object->id); // Reload to get new records $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); - } + }*/ header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); exit; @@ -248,10 +254,28 @@ if (empty($reshook)) if ($action == 'setref_supplier' && $user->rights->fournisseur->commande->creer) { $object->ref_supplier = GETPOST('ref_supplier', 'alpha'); - + if ($object->update($user) < 0) { setEventMessages($object->error, $object->errors, 'errors'); } + else + { + // Define output language + $outputlangs = $langs; + $newlang = ''; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) + $newlang = GETPOST('lang_id'); + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) + $newlang = $object->thirdparty->default_lang; + if (! empty($newlang)) { + $outputlangs = new Translate("", $conf); + $outputlangs->setDefaultLang($newlang); + } + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { + $ret = $object->fetch($object->id); // Reload to get new records + $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); + } + } } // payments conditions @@ -265,7 +289,7 @@ if (empty($reshook)) { $result = $object->setPaymentMethods(GETPOST('mode_reglement_id','int')); } - + // Multicurrency Code else if ($action == 'setmulticurrencycode' && $user->rights->facture->creer) { $result = $object->setMulticurrencyCode(GETPOST('multicurrency_code', 'alpha')); @@ -273,7 +297,7 @@ 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'))); } // bank account @@ -311,14 +335,17 @@ if (empty($reshook)) } // Delete payment - elseif ($action == 'deletepaiement' && $user->rights->fournisseur->facture->creer) + elseif ($action == 'confirm_delete_paiement' && $confirm == 'yes' && $user->rights->fournisseur->facture->creer) { - $object->fetch($id); + $object->fetch($id); if ($object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0) { $paiementfourn = new PaiementFourn($db); $result=$paiementfourn->fetch(GETPOST('paiement_id')); - if ($result > 0) $result=$paiementfourn->delete(); // If fetch ok and found + if ($result > 0) { + $result=$paiementfourn->delete(); // If fetch ok and found + header("Location: ".$_SERVER['PHP_SELF']."?id=".$id); + } if ($result < 0) { setEventMessages($paiementfourn->error, $paiementfourn->errors, 'errors'); } @@ -328,242 +355,425 @@ if (empty($reshook)) // Create elseif ($action == 'add' && $user->rights->fournisseur->facture->creer) { - $error=0; + if ($socid > 0) $object->socid = GETPOST('socid', 'int'); - $datefacture=dol_mktime(12,0,0,$_POST['remonth'],$_POST['reday'],$_POST['reyear']); - $datedue=dol_mktime(12,0,0,$_POST['echmonth'],$_POST['echday'],$_POST['echyear']); + $db->begin(); - if (GETPOST('socid','int')<1) - { - setEventMessages($langs->trans('ErrorFieldRequired',$langs->transnoentities('Supplier')), null, 'errors'); - $action='create'; - $error++; - } + $error = 0; - if ($datefacture == '') - { - setEventMessages($langs->trans('ErrorFieldRequired',$langs->transnoentities('DateInvoice')), null, 'errors'); - $action='create'; - $_GET['socid']=$_POST['socid']; - $error++; - } - if (! GETPOST('ref_supplier')) - { - setEventMessages($langs->trans('ErrorFieldRequired',$langs->transnoentities('RefSupplier')), null, 'errors'); - $action='create'; - $_GET['socid']=$_POST['socid']; - $error++; - } + // Fill array 'array_options' with data from add form + $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); + $ret = $extrafields->setOptionalsFromPost($extralabels, $object); + if ($ret < 0) $error++; - // Fill array 'array_options' with data from add form + $datefacture=dol_mktime(12,0,0,$_POST['remonth'],$_POST['reday'],$_POST['reyear']); + $datedue=dol_mktime(12,0,0,$_POST['echmonth'],$_POST['echday'],$_POST['echyear']); - if (! $error) - { - $db->begin(); + // Replacement invoice + if ($_POST['type'] == FactureFournisseur::TYPE_REPLACEMENT) + { + if ($datefacture == '') + { + setEventMessages($langs->trans('ErrorFieldRequired',$langs->transnoentities('DateInvoice')), null, 'errors'); + $action='create'; + $_GET['socid']=$_POST['socid']; + $error++; + } + if (! ($_POST['fac_replacement'] > 0)) { + $error ++; + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ReplaceInvoice")), null, 'errors'); + } - $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); - $ret = $extrafields->setOptionalsFromPost($extralabels, $object); - if ($ret < 0) $error++; + if (! $error) { + // This is a replacement invoice + $result = $object->fetch($_POST['fac_replacement']); + $object->fetch_thirdparty(); - $tmpproject = GETPOST('projectid', 'int'); + $object->ref = $_POST['ref']; + $object->ref_supplier = $_POST['ref_supplier']; + $object->socid = $_POST['socid']; + $object->libelle = $_POST['label']; + $object->date = $datefacture; + $object->date_echeance = $datedue; + $object->note_public = GETPOST('note_public'); + $object->note_private = GETPOST('note_private'); + $object->cond_reglement_id = GETPOST('cond_reglement_id'); + $object->mode_reglement_id = GETPOST('mode_reglement_id'); + $object->fk_account = GETPOST('fk_account', 'int'); + $object->fk_project = ($tmpproject > 0) ? $tmpproject : null; + $object->fk_incoterms = GETPOST('incoterm_id', 'int'); + $object->location_incoterms = GETPOST('location_incoterms', 'alpha'); + $object->multicurrency_code = GETPOST('multicurrency_code', 'alpha'); + $object->multicurrency_tx = GETPOST('originmulticurrency_tx', 'int'); - // Creation facture - $object->ref = $_POST['ref']; - $object->ref_supplier = $_POST['ref_supplier']; - $object->socid = $_POST['socid']; - $object->libelle = $_POST['libelle']; - $object->date = $datefacture; - $object->date_echeance = $datedue; - $object->note_public = GETPOST('note_public'); - $object->note_private = GETPOST('note_private'); - $object->cond_reglement_id = GETPOST('cond_reglement_id'); - $object->mode_reglement_id = GETPOST('mode_reglement_id'); - $object->fk_account = GETPOST('fk_account', 'int'); - $object->fk_project = ($tmpproject > 0) ? $tmpproject : null; - $object->fk_incoterms = GETPOST('incoterm_id', 'int'); - $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 de remplacement + $object->fk_facture_source = $_POST['fac_replacement']; + $object->type = FactureFournisseur::TYPE_REPLACEMENT; - // Auto calculation of date due if not filled by user - if(empty($object->date_echeance)) $object->date_echeance = $object->calculate_date_lim_reglement(); + $id = $object->createFromCurrent($user); + if ($id <= 0) { + setEventMessages($object->error, $object->errors, 'errors'); + } + } + } - // If creation from another object of another module - if (! $error && $_POST['origin'] && $_POST['originid']) - { - // Parse element/subelement (ex: project_task) - $element = $subelement = $_POST['origin']; - /*if (preg_match('/^([^_]+)_([^_]+)/i',$_POST['origin'],$regs)) - { - $element = $regs[1]; - $subelement = $regs[2]; - }*/ + // Credit note invoice + if ($_POST['type'] == FactureFournisseur::TYPE_CREDIT_NOTE) + { + $sourceinvoice = GETPOST('fac_avoir'); + if (! ($sourceinvoice > 0) && empty($conf->global->INVOICE_CREDIT_NOTE_STANDALONE)) + { + $error ++; + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CorrectInvoice")), null, 'errors'); + } + if (GETPOST('socid','int')<1) + { + setEventMessages($langs->trans('ErrorFieldRequired',$langs->transnoentities('Supplier')), null, 'errors'); + $action='create'; + $error++; + } + if ($datefacture == '') + { + setEventMessages($langs->trans('ErrorFieldRequired',$langs->transnoentities('DateInvoice')), null, 'errors'); + $action='create'; + $_GET['socid']=$_POST['socid']; + $error++; + } + if (! GETPOST('ref_supplier')) + { + setEventMessages($langs->trans('ErrorFieldRequired',$langs->transnoentities('RefSupplier')), null, 'errors'); + $action='create'; + $_GET['socid']=$_POST['socid']; + $error++; + } - // For compatibility - if ($element == 'order') { - $element = $subelement = 'commande'; - } - if ($element == 'propal') { - $element = 'comm/propal'; $subelement = 'propal'; - } - if ($element == 'contract') { - $element = $subelement = 'contrat'; - } - if ($element == 'order_supplier') { - $element = 'fourn'; $subelement = 'fournisseur.commande'; - } - if ($element == 'project') - { - $element = 'projet'; - } - $object->origin = $_POST['origin']; - $object->origin_id = $_POST['originid']; + if (! $error) + { + $tmpproject = GETPOST('projectid', 'int'); - $id = $object->create($user); + // Creation facture + $object->ref = $_POST['ref']; + $object->ref_supplier = $_POST['ref_supplier']; + $object->socid = $_POST['socid']; + $object->libelle = $_POST['label']; + $object->date = $datefacture; + $object->date_echeance = $datedue; + $object->note_public = GETPOST('note_public'); + $object->note_private = GETPOST('note_private'); + $object->cond_reglement_id = GETPOST('cond_reglement_id'); + $object->mode_reglement_id = GETPOST('mode_reglement_id'); + $object->fk_account = GETPOST('fk_account', 'int'); + $object->fk_project = ($tmpproject > 0) ? $tmpproject : null; + $object->fk_incoterms = GETPOST('incoterm_id', 'int'); + $object->location_incoterms = GETPOST('location_incoterms', 'alpha'); + $object->multicurrency_code = GETPOST('multicurrency_code', 'alpha'); + $object->multicurrency_tx = GETPOST('originmulticurrency_tx', 'int'); - // Add lines - if ($id > 0) - { - require_once DOL_DOCUMENT_ROOT.'/'.$element.'/class/'.$subelement.'.class.php'; - $classname = ucfirst($subelement); - if ($classname == 'Fournisseur.commande') $classname='CommandeFournisseur'; - $srcobject = new $classname($db); + // Proprietes particulieres a facture avoir + $object->fk_facture_source = $sourceinvoice > 0 ? $sourceinvoice : ''; + $object->type = FactureFournisseur::TYPE_CREDIT_NOTE; - $result=$srcobject->fetch($_POST['originid']); - if ($result > 0) - { - $lines = $srcobject->lines; - if (empty($lines) && method_exists($srcobject,'fetch_lines')) - { - $srcobject->fetch_lines(); - $lines = $srcobject->lines; - } + $id = $object->create($user); - $num=count($lines); - for ($i = 0; $i < $num; $i++) - { - $desc=($lines[$i]->desc?$lines[$i]->desc:$lines[$i]->libelle); - $product_type=($lines[$i]->product_type?$lines[$i]->product_type:0); + if (GETPOST('invoiceAvoirWithLines', 'int')==1 && $id>0) + { + $facture_source = new FactureFournisseur($db); // fetch origin object + if ($facture_source->fetch($object->fk_facture_source)>0) + { + $fk_parent_line = 0; - // Dates - // TODO mutualiser - $date_start=$lines[$i]->date_debut_prevue; - if ($lines[$i]->date_debut_reel) $date_start=$lines[$i]->date_debut_reel; - if ($lines[$i]->date_start) $date_start=$lines[$i]->date_start; - $date_end=$lines[$i]->date_fin_prevue; - if ($lines[$i]->date_fin_reel) $date_end=$lines[$i]->date_fin_reel; - if ($lines[$i]->date_end) $date_end=$lines[$i]->date_end; + foreach($facture_source->lines as $line) + { + // Reset fk_parent_line for no child products and special product + if (($line->product_type != 9 && empty($line->fk_parent_line)) || $line->product_type == 9) { + $fk_parent_line = 0; + } - // FIXME Missing $lines[$i]->ref_supplier and $lines[$i]->label into addline and updateline methods. They are filled when coming from order for example. - $result = $object->addline( - $desc, - $lines[$i]->subprice, - $lines[$i]->tva_tx, - $lines[$i]->localtax1_tx, - $lines[$i]->localtax2_tx, - $lines[$i]->qty, - $lines[$i]->fk_product, - $lines[$i]->remise_percent, - $date_start, - $date_end, - 0, - $lines[$i]->info_bits, - 'HT', - $product_type, - $lines[$i]->rang, - 0, - $lines[$i]->array_options, - $lines[$i]->fk_unit - ); + $line->fk_facture = $object->id; + $line->fk_parent_line = $fk_parent_line; - if ($result < 0) - { - $error++; - break; - } - } - - // Now reload line - $object->fetch_lines(); - } - else - { - $error++; - } - } - else - { - $error++; - } - } - else if (! $error) - { - $id = $object->create($user); - if ($id < 0) - { - $error++; - } - - if (! $error) - { - // If some invoice's lines already known - for ($i = 1 ; $i < 9 ; $i++) - { - $label = $_POST['label'.$i]; - $amountht = price2num($_POST['amount'.$i]); - $amountttc = price2num($_POST['amountttc'.$i]); - $tauxtva = price2num($_POST['tauxtva'.$i]); - $qty = $_POST['qty'.$i]; - $fk_product = $_POST['fk_product'.$i]; - if ($label) - { - if ($amountht) - { - $price_base='HT'; $amount=$amountht; - } - else - { - $price_base='TTC'; $amount=$amountttc; - } - $atleastoneline=1; + $line->subprice =-$line->subprice; // invert price for object + $line->pa_ht = -$line->pa_ht; + $line->total_ht=-$line->total_ht; + $line->total_tva=-$line->total_tva; + $line->total_ttc=-$line->total_ttc; + $line->total_localtax1=-$line->total_localtax1; + $line->total_localtax2=-$line->total_localtax2; - $product=new Product($db); - $product->fetch($_POST['idprod'.$i]); + $result = $line->insert(); - $ret=$object->addline($label, $amount, $tauxtva, $product->localtax1_tx, $product->localtax2_tx, $qty, $fk_product, $remise_percent, '', '', '', 0, $price_base, $_POST['rang'.$i], 1); - if ($ret < 0) $error++; - } - } - } - } + $object->lines[] = $line; // insert new line in current object - if ($error) - { - $langs->load("errors"); - $db->rollback(); - - setEventMessages($object->error, $object->errors, 'errors'); - $action='create'; - $_GET['socid']=$_POST['socid']; - } - else - { - $db->commit(); + // Defined the new fk_parent_line + if ($result > 0 && $line->product_type == 9) { + $fk_parent_line = $result; + } + } - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { - $outputlangs = $langs; - $result = $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); - if ($result <= 0) - { - dol_print_error($db,$object->error,$object->errors); - exit; - } - } + $object->update_price(1); + } - header("Location: ".$_SERVER['PHP_SELF']."?id=".$id); - exit; - } - } + } + + if(GETPOST('invoiceAvoirWithPaymentRestAmount', 'int')==1 && $id>0) + { + $facture_source = new FactureFournisseur($db); // fetch origin object if not previously defined + if ($facture_source->fetch($object->fk_facture_source)>0) + { + $totalpaye = $facture_source->getSommePaiement(); + $totalcreditnotes = $facture_source->getSumCreditNotesUsed(); + $totaldeposits = $facture_source->getSumDepositsUsed(); + $remain_to_pay = abs($facture_source->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits); + + $object->addline($langs->trans('invoiceAvoirLineWithPaymentRestAmount'),$remain_to_pay,1,0,0,0,0,0,'','','TTC'); + } + } + + // Add predefined lines + /* + TODO delete + for($i = 1; $i <= $NBLINES; $i ++) { + if ($_POST['idprod' . $i]) { + $product = new Product($db); + $product->fetch($_POST['idprod' . $i]); + $startday = dol_mktime(12, 0, 0, $_POST['date_start' . $i . 'month'], $_POST['date_start' . $i . 'day'], $_POST['date_start' . $i . 'year']); + $endday = dol_mktime(12, 0, 0, $_POST['date_end' . $i . 'month'], $_POST['date_end' . $i . 'day'], $_POST['date_end' . $i . 'year']); + $result = $object->addline($product->description, $product->price, $_POST['qty' . $i], $product->tva_tx, $product->localtax1_tx, $product->localtax2_tx, $_POST['idprod' . $i], $_POST['remise_percent' . $i], $startday, $endday, 0, 0, '', $product->price_base_type, $product->price_ttc, $product->type); + } + }*/ + } + } + + // Standard or deposit + if ($_POST['type'] == FactureFournisseur::TYPE_STANDARD || $_POST['type'] == FactureFournisseur::TYPE_DEPOSIT) + { + if (GETPOST('socid','int')<1) + { + setEventMessages($langs->trans('ErrorFieldRequired',$langs->transnoentities('Supplier')), null, 'errors'); + $action='create'; + $error++; + } + + if ($datefacture == '') + { + setEventMessages($langs->trans('ErrorFieldRequired',$langs->transnoentities('DateInvoice')), null, 'errors'); + $action='create'; + $_GET['socid']=$_POST['socid']; + $error++; + } + if (! GETPOST('ref_supplier')) + { + setEventMessages($langs->trans('ErrorFieldRequired',$langs->transnoentities('RefSupplier')), null, 'errors'); + $action='create'; + $_GET['socid']=$_POST['socid']; + $error++; + } + + if (! $error) + { + $db->begin(); + + $tmpproject = GETPOST('projectid', 'int'); + + // Creation facture + $object->ref = $_POST['ref']; + $object->ref_supplier = $_POST['ref_supplier']; + $object->socid = $_POST['socid']; + $object->libelle = $_POST['label']; + $object->date = $datefacture; + $object->date_echeance = $datedue; + $object->note_public = GETPOST('note_public'); + $object->note_private = GETPOST('note_private'); + $object->cond_reglement_id = GETPOST('cond_reglement_id'); + $object->mode_reglement_id = GETPOST('mode_reglement_id'); + $object->fk_account = GETPOST('fk_account', 'int'); + $object->fk_project = ($tmpproject > 0) ? $tmpproject : null; + $object->fk_incoterms = GETPOST('incoterm_id', 'int'); + $object->location_incoterms = GETPOST('location_incoterms', 'alpha'); + $object->multicurrency_code = GETPOST('multicurrency_code', 'alpha'); + $object->multicurrency_tx = GETPOST('originmulticurrency_tx', 'int'); + + // Auto calculation of date due if not filled by user + if(empty($object->date_echeance)) $object->date_echeance = $object->calculate_date_lim_reglement(); + + // If creation from another object of another module + if (! $error && $_POST['origin'] && $_POST['originid']) + { + // Parse element/subelement (ex: project_task) + $element = $subelement = $_POST['origin']; + /*if (preg_match('/^([^_]+)_([^_]+)/i',$_POST['origin'],$regs)) + { + $element = $regs[1]; + $subelement = $regs[2]; + }*/ + + // For compatibility + if ($element == 'order') { + $element = $subelement = 'commande'; + } + if ($element == 'propal') { + $element = 'comm/propal'; $subelement = 'propal'; + } + if ($element == 'contract') { + $element = $subelement = 'contrat'; + } + if ($element == 'order_supplier') { + $element = 'fourn'; $subelement = 'fournisseur.commande'; + } + if ($element == 'project') + { + $element = 'projet'; + } + $object->origin = $_POST['origin']; + $object->origin_id = $_POST['originid']; + + $id = $object->create($user); + + // Add lines + if ($id > 0) + { + require_once DOL_DOCUMENT_ROOT.'/'.$element.'/class/'.$subelement.'.class.php'; + $classname = ucfirst($subelement); + if ($classname == 'Fournisseur.commande') $classname='CommandeFournisseur'; + $srcobject = new $classname($db); + + $result=$srcobject->fetch($_POST['originid']); + if ($result > 0) + { + $lines = $srcobject->lines; + if (empty($lines) && method_exists($srcobject,'fetch_lines')) + { + $srcobject->fetch_lines(); + $lines = $srcobject->lines; + } + + $num=count($lines); + for ($i = 0; $i < $num; $i++) + { + $desc=($lines[$i]->desc?$lines[$i]->desc:$lines[$i]->libelle); + $product_type=($lines[$i]->product_type?$lines[$i]->product_type:0); + + // Dates + // TODO mutualiser + $date_start=$lines[$i]->date_debut_prevue; + if ($lines[$i]->date_debut_reel) $date_start=$lines[$i]->date_debut_reel; + if ($lines[$i]->date_start) $date_start=$lines[$i]->date_start; + $date_end=$lines[$i]->date_fin_prevue; + if ($lines[$i]->date_fin_reel) $date_end=$lines[$i]->date_fin_reel; + if ($lines[$i]->date_end) $date_end=$lines[$i]->date_end; + + // FIXME Missing $lines[$i]->ref_supplier and $lines[$i]->label into addline and updateline methods. They are filled when coming from order for example. + $result = $object->addline( + $desc, + $lines[$i]->subprice, + $lines[$i]->tva_tx, + $lines[$i]->localtax1_tx, + $lines[$i]->localtax2_tx, + $lines[$i]->qty, + $lines[$i]->fk_product, + $lines[$i]->remise_percent, + $date_start, + $date_end, + 0, + $lines[$i]->info_bits, + 'HT', + $product_type, + $lines[$i]->rang, + 0, + $lines[$i]->array_options, + $lines[$i]->fk_unit, + $lines[$i]->id + ); + + if ($result < 0) + { + $error++; + break; + } + } + + // Now reload line + $object->fetch_lines(); + } + else + { + $error++; + } + } + else + { + $error++; + } + } + else if (! $error) + { + $id = $object->create($user); + if ($id < 0) + { + $error++; + } + + if (! $error) + { + // If some invoice's lines already known + for ($i = 1 ; $i < 9 ; $i++) + { + $label = $_POST['label'.$i]; + $amountht = price2num($_POST['amount'.$i]); + $amountttc = price2num($_POST['amountttc'.$i]); + $tauxtva = price2num($_POST['tauxtva'.$i]); + $qty = $_POST['qty'.$i]; + $fk_product = $_POST['fk_product'.$i]; + if ($label) + { + if ($amountht) + { + $price_base='HT'; $amount=$amountht; + } + else + { + $price_base='TTC'; $amount=$amountttc; + } + $atleastoneline=1; + + $product=new Product($db); + $product->fetch($_POST['idprod'.$i]); + + $ret=$object->addline($label, $amount, $tauxtva, $product->localtax1_tx, $product->localtax2_tx, $qty, $fk_product, $remise_percent, '', '', '', 0, $price_base, $_POST['rang'.$i], 1); + if ($ret < 0) $error++; + } + } + } + } + + if ($error) + { + $langs->load("errors"); + $db->rollback(); + + setEventMessages($object->error, $object->errors, 'errors'); + $action='create'; + $_GET['socid']=$_POST['socid']; + } + else + { + $db->commit(); + + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { + $outputlangs = $langs; + $result = $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); + if ($result < 0) + { + dol_print_error($db,$object->error,$object->errors); + exit; + } + } + + header("Location: ".$_SERVER['PHP_SELF']."?id=".$id); + exit; + } + } + } } // Edit line @@ -770,10 +980,8 @@ if (empty($reshook)) setEventMessages($langs->trans("ErrorQtyTooLowForThisSupplier"), null, 'errors'); } } - else if( GETPOST('price_ht')!=='' || GETPOST('price_ttc')!=='' ) + else if ($price_ht !== '' || GETPOST('price_ttc') !== '') // $price_ht is already set { - $pu_ht = price2num($price_ht, 'MU'); - $pu_ttc = price2num(GETPOST('price_ttc'), 'MU'); $tva_npr = (preg_match('/\*/', $tva_tx) ? 1 : 0); $tva_tx = str_replace('*', '', $tva_tx); $label = (GETPOST('product_label') ? GETPOST('product_label') : ''); @@ -788,19 +996,18 @@ if (empty($reshook)) $localtax1_tx= get_localtax($tva_tx, 1,$mysoc,$object->thirdparty); $localtax2_tx= get_localtax($tva_tx, 2,$mysoc,$object->thirdparty); - if (!empty($_POST['price_ht'])) - { - $ht = price2num($_POST['price_ht']); - $price_base_type = 'HT'; - } - else + if ($price_ht !== '') { - $ttc = price2num($_POST['price_ttc']); - $ht = $ttc / (1 + ($tva_tx / 100)); - $price_base_type = 'HT'; - } - - $result=$object->addline($product_desc, $ht, $tva_tx, $localtax1_tx, $localtax2_tx, $qty, 0, $remise_percent, $date_start, $date_end, 0, $tva_npr, $price_base_type, $type, -1, 0, $array_options, $fk_unit); + $pu_ht = price2num($price_ht, 'MU'); // $pu_ht must be rounded according to settings + } + else + { + $pu_ttc = price2num(GETPOST('price_ttc'), 'MU'); + $pu_ht = price2num($pu_ttc / (1 + ($tva_tx / 100)), 'MU'); // $pu_ht must be rounded according to settings + } + $price_base_type = 'HT'; + + $result=$object->addline($product_desc, $pu_ht, $tva_tx, $localtax1_tx, $localtax2_tx, $qty, 0, $remise_percent, $date_start, $date_end, 0, $tva_npr, $price_base_type, $type, -1, 0, $array_options, $fk_unit); } //print "xx".$tva_tx; exit; @@ -932,184 +1139,18 @@ if (empty($reshook)) } } - // Add file in email form - if (GETPOST('addfile')) - { - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + /* + * Send mail + */ - // Set tmp user directory TODO Use a dedicated directory for temp mails files - $vardir=$conf->user->dir_output."/".$user->id; - $upload_dir_tmp = $vardir.'/temp'; + // Actions to send emails + $actiontypecode='AC_SUP_INV'; + $trigger_name='BILL_SUPPLIER_SENTBYMAIL'; + $paramname='id'; + $mode='emailfromsupplierinvoice'; + $trackid='sin'.$object->id; + include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; - dol_add_file_process($upload_dir_tmp,0,0); - $action='presend'; - } - - // Remove file in email form - if (! empty($_POST['removedfile'])) - { - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - - // Set tmp user directory - $vardir=$conf->user->dir_output."/".$user->id; - $upload_dir_tmp = $vardir.'/temp'; - - // TODO Delete only files that was uploaded from email form - dol_remove_file_process(GETPOST('removedfile','alpha'),0); - $action='presend'; - } - - // Send mail - if ($action == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile'] && ! $_POST['cancel']) - { - $langs->load('mails'); - - $object->fetch($id); - $result=$object->fetch_thirdparty(); - if ($result > 0) - { - if ($_POST['sendto']) - { - // Le destinataire a ete fourni via le champ libre - $sendto = $_POST['sendto']; - $sendtoid = 0; - } - elseif ($_POST['receiver'] != '-1') - { - // Recipient was provided from combo list - if ($_POST['receiver'] == 'thirdparty') // Id of third party - { - $sendto = $object->thirdparty->email; - $sendtoid = 0; - } - else // Id du contact - { - $sendto = $object->thirdparty->contact_get_property($_POST['receiver'],'email'); - $sendtoid = $_POST['receiver']; - } - } - - if (dol_strlen($sendto)) - { - $langs->load("commercial"); - - $from = $_POST['fromname'] . ' <' . $_POST['frommail'] .'>'; - $replyto = $_POST['replytoname']. ' <' . $_POST['replytomail'].'>'; - $message = $_POST['message']; - $sendtocc = $_POST['sendtocc']; - $deliveryreceipt = $_POST['deliveryreceipt']; - - if ($action == 'send') - { - if (dol_strlen($_POST['subject'])) $subject=$_POST['subject']; - else $subject = $langs->transnoentities('CustomerOrder').' '.$object->ref; - $actiontypecode='AC_SUP_INV'; - $actionmsg = $langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto; - if ($message) - { - if ($sendtocc) $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc); - $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject); - $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":"); - $actionmsg = dol_concatdesc($actionmsg, $message); - } - $actionmsg2=$langs->transnoentities('Action'.$actiontypecode); - } - - // Create form object - include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; - $formmail = new FormMail($db); - - $attachedfiles=$formmail->get_attached_files(); - $filepath = $attachedfiles['paths']; - $filename = $attachedfiles['names']; - $mimetype = $attachedfiles['mimes']; - - // Send mail - require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; - $mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,'',$deliveryreceipt,-1); - if ($mailfile->error) - { - setEventMessages($mailfile->error, $mailfile->errors, 'errors'); - } - else - { - $result=$mailfile->sendfile(); - if ($result) - { - $mesg=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2)); // Must not contain " - setEventMessages($mesg, null, 'mesgs'); - - $error=0; - - // Init data for trigger - $object->sendtoid = $sendtoid; - $object->actiontypecode = $actiontypecode; - $object->actionmsg = $actionmsg; - $object->actionmsg2 = $actionmsg2; - $object->fk_element = $object->id; - $object->elementtype = $object->element; - - $object->email_subject = $subject; - $object->email_to = $sendto; - $object->email_tocc = $sendtocc; - $object->email_tobcc = $sendtobcc; - $object->email_from = $from; - $object->email_content = $_POST['message']; - - // Call triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($db); - $result=$interface->run_triggers('BILL_SUPPLIER_SENTBYMAIL',$object,$user,$langs,$conf); - if ($result < 0) { - $error++; $object->errors=$interface->errors; - } - // End call triggers - - if ($error) - { - dol_print_error($db); - } - else - { - // Redirect here - // This avoid sending mail twice if going out and then back to page - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); - exit; - } - } - else - { - $langs->load("other"); - if ($mailfile->error) - { - $mesg.=$langs->trans('ErrorFailedToSendMail',$from,$sendto); - $mesg.='
'.$mailfile->error; - } - else - { - $mesg.='No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS'; - } - setEventMessages($mesg, null, 'errors'); - } - } - } - - else - { - $langs->load("other"); - setEventMessages($langs->trans('ErrorMailRecipientIsEmpty'), null, 'errors'); - dol_syslog('Recipient email is empty'); - } - } - else - { - $langs->load("other"); - setEventMessages($langs->trans('ErrorFailedToReadEntity',$langs->trans("Invoice")), null, 'errors'); - dol_syslog('Unable to read data from the invoice. The invoice file has perhaps not been generated.'); - } - - //$action = 'presend'; - } // Build document if ($action == 'builddoc') @@ -1130,7 +1171,7 @@ if (empty($reshook)) $outputlangs->setDefaultLang($newlang); } $result = $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); - if ($result <= 0) + if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); $action=''; @@ -1275,8 +1316,13 @@ $form = new Form($db); $formfile = new FormFile($db); $bankaccountstatic=new Account($db); $paymentstatic=new PaiementFourn($db); +if (! empty($conf->projet->enabled)) { $formproject = new FormProjets($db); } -llxHeader('',$langs->trans('SupplierInvoice'),''); +$now = dol_now(); + +$title = $langs->trans('SupplierInvoice') . " - " . $langs->trans('Card'); +$helpurl = "EN:Module_Suppliers_Invoices|FR:Module_Fournisseurs_Factures|ES:Módulo_Facturas_de_proveedores"; +llxHeader('', $title, $helpurl); // Mode creation if ($action == 'create') @@ -1289,23 +1335,23 @@ if ($action == 'create') dol_htmloutput_events(); $currency_code = $conf->currency; - - $societe=''; - if (GETPOST('socid') > 0) - { - $societe=new Societe($db); - $societe->fetch(GETPOST('socid','int')); + + $societe=''; + if (GETPOST('socid') > 0) + { + $societe=new Societe($db); + $societe->fetch(GETPOST('socid','int')); if (!empty($conf->multicurrency->enabled) && !empty($societe->multicurrency_code)) $currency_code = $societe->multicurrency_code; - } - - if (GETPOST('origin') && GETPOST('originid')) + } + + if (! empty($origin) && ! empty($originid)) { // Parse element/subelement (ex: project_task) - $element = $subelement = GETPOST('origin'); + $element = $subelement = $origin; if ($element == 'project') { - $projectid=GETPOST('originid'); + $projectid = $originid; $element = 'projet'; } else if (in_array($element,array('order_supplier'))) @@ -1328,7 +1374,7 @@ if ($action == 'create') $classname = ucfirst($subelement); if ($classname == 'Fournisseur.commande') $classname='CommandeFournisseur'; $objectsrc = new $classname($db); - $objectsrc->fetch(GETPOST('originid')); + $objectsrc->fetch($originid); $objectsrc->fetch_thirdparty(); $projectid = (!empty($objectsrc->fk_project)?$objectsrc->fk_project:''); @@ -1345,9 +1391,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; } - + $datetmp=dol_mktime(12,0,0,$_POST['remonth'],$_POST['reday'],$_POST['reyear']); $dateinvoice=($datetmp==''?(empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''):$datetmp); $datetmp=dol_mktime(12,0,0,$_POST['echmonth'],$_POST['echday'],$_POST['echyear']); @@ -1363,20 +1409,20 @@ if ($action == 'create') $dateinvoice=($datetmp==''?(empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''):$datetmp); $datetmp=dol_mktime(12,0,0,$_POST['echmonth'],$_POST['echday'],$_POST['echyear']); $datedue=($datetmp==''?-1:$datetmp); - + if (!empty($conf->multicurrency->enabled) && !empty($soc->multicurrency_code)) $currency_code = $soc->multicurrency_code; } - print '
'; print ''; print ''; - print ''; - print ''; + if ($societe->id > 0) print '' . "\n"; + print ''; + print ''; if (!empty($currency_tx)) print ''; - + dol_fiche_head(); - + print ''; // Ref @@ -1386,14 +1432,14 @@ if ($action == 'create') print ''; print ''; @@ -1401,91 +1447,233 @@ if ($action == 'create') print ''; print ''; - print '
'.$langs->trans('Supplier').''; - if (GETPOST('socid') > 0) + if ($societe->id > 0) { print $societe->getNomUrl(1); - print ''; + print ''; } else { - print $form->select_company(GETPOST('socid','int'), 'socid', 's.fournisseur = 1', 'SelectThirdParty'); + print $form->select_company($societe->id, 'socid', 's.fournisseur = 1', 'SelectThirdParty'); } print '
'.$langs->trans('RefSupplier').'
'.$langs->trans('Type').''; - print ''."\n"; + // Type invoice + $facids = $facturestatic->list_replacable_supplier_invoices($societe->id); + if ($facids < 0) { + dol_print_error($db, $facturestatic); + exit(); + } + $options = ""; + foreach ($facids as $facparam) + { + $options .= ''; + } - // Standard invoice - print ''."\n"; + // Show link for credit note + $facids=$facturestatic->list_qualified_avoir_supplier_invoices($societe->id); + if ($facids < 0) + { + dol_print_error($db,$facturestatic); + exit; + } + $optionsav = ""; + $newinvoice_static = new FactureFournisseur($db); + foreach ($facids as $key => $valarray) + { + $newinvoice_static->id = $key; + $newinvoice_static->ref = $valarray ['ref']; + $newinvoice_static->statut = $valarray ['status']; + $newinvoice_static->type = $valarray ['type']; + $newinvoice_static->paye = $valarray ['paye']; - /* - // Deposit - print ''."\n"; + $optionsav .= ''; + } - // Proforma - if (! empty($conf->global->FACTURE_USE_PROFORMAT)) - { - print ''."\n"; - } + print ''; + print '
' . "\n"; - // Credit note - print '
'."\n"; + // Standard invoice + print '
'; + $tmp=' '; + $desc = $form->textwithpicto($tmp.$langs->trans("InvoiceStandardAsk"), $langs->transnoentities("InvoiceStandardDesc"), 1, 'help', '', 0, 3); + print $desc; + print '
'; + + /* Not yet supported + if ((empty($origin)) || ((($origin == 'propal') || ($origin == 'commande')) && (! empty($originid)))) + { + // Deposit + if (empty($conf->global->INVOICE_DISABLE_DEPOSIT)) + { + print '
'; + $tmp=' '; + print ''; + + $desc = $form->textwithpicto($tmp.$langs->trans("InvoiceDeposit"), $langs->transnoentities("InvoiceDepositDesc"), 1, 'help', '', 0, 3); + print '
'; - print ''; - print ''; - $desc=$form->textwithpicto($langs->trans("InvoiceStandardAsk"),$langs->transnoentities("InvoiceStandardDesc"),1); - print $desc; - print '
'; - print ''; - print ''; - $desc=$form->textwithpicto($langs->trans("InvoiceDeposit"),$langs->transnoentities("InvoiceDepositDesc"),1); - print $desc; - print '
'; - print ''; - print ''; - $desc=$form->textwithpicto($langs->trans("InvoiceProForma"),$langs->transnoentities("InvoiceProFormaDesc"),1); - print $desc; - print '
'.$langs->trans('Type').''; - // Replacement - print '
'; - print ''; - print ''; - $text=$langs->trans("InvoiceReplacementAsk").' '; - $text.=''; - $desc=$form->textwithpicto($text,$langs->transnoentities("InvoiceReplacementDesc"),1); - print $desc; - print '
'; - print ''; - print ''; - $text=$langs->transnoentities("InvoiceAvoirAsk").' '; - // $text.=''; - $text.=''; - $desc=$form->textwithpicto($text,$langs->transnoentities("InvoiceAvoirDesc"),1); - print $desc; - print '
'; + if (($origin == 'propal') || ($origin == 'commande')) + { + print ''; + print '
'; + print $desc; + print ''; + $arraylist = array('amount' => 'FixAmount','variable' => 'VarAmount'); + print $form->selectarray('typedeposit', $arraylist, GETPOST('typedeposit'), 0, 0, 0, '', 1); + print '' . $langs->trans('Value') . ':'; + } + print '
'; + + print ''; + } + } */ - print '
'; - print ''; + + /* Not yet supporter for supplier + if ($societe->id > 0) + { + // Replacement + if (empty($conf->global->INVOICE_DISABLE_REPLACEMENT)) + { + print ''; + print '
'; + $tmp=' + jQuery(document).ready(function() { + jQuery("#fac_replacement").change(function() { + jQuery("#radio_replacement").prop("checked", true); + }); + }); + '; + $text = $tmp.$langs->trans("InvoiceReplacementAsk") . ' '; + $text .= ''; + $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceReplacementDesc"), 1, 'help', '', 0, 3); + print $desc; + print '
'; + } + } + else + { + print '
'; + $tmp=' '; + $text = $tmp.$langs->trans("InvoiceReplacement") . ' '; + $text.= '('.$langs->trans("YouMustCreateInvoiceFromSupplierThird").') '; + $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceReplacementDesc"), 1, 'help', '', 0, 3); + print $desc; + print '
'; + } + */ + + if (empty($origin)) + { + if ($conf->global->MAIN_FEATURES_LEVEL > 0) // Need to fix reports of standard accounting module to manage supplier credit note + { + if ($societe->id > 0) + { + // Credit note + if (empty($conf->global->INVOICE_DISABLE_CREDIT_NOTE)) + { + print '
'; + $tmp=' + 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(); + }); + }); + '; + $text = $tmp.$langs->transnoentities("InvoiceAvoirAsk") . ' '; + // $text.=''; + $text .= ''; + $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceAvoirDesc"), 1, 'help', '', 0, 3); + print $desc; + + print '
'; + print '    0 ? 'checked':'').' /> "; + print '
    0 ? 'checked':'').' /> "; + print '
'; + + print '
'; + } + } + else + { + print '
'; + $tmp=' '; + $text = $tmp.$langs->trans("InvoiceAvoir") . ' '; + $text.= '('.$langs->trans("YouMustCreateInvoiceFromSupplierThird").') '; + $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceAvoirDesc"), 1, 'help', '', 0, 3); + print $desc; + print '
' . "\n"; + } + } + } + + print '
'; + + print ''; + + if ($socid > 0) + { + // Discounts for third party + print '' . $langs->trans('Discounts') . ''; + if ($soc->remise_percent) + print $langs->trans("CompanyHasRelativeDiscount", '' . $soc->remise_percent . ''); + else + print $langs->trans("CompanyHasNoRelativeDiscount"); + print ' (' . $langs->trans("EditRelativeDiscount") . ')'; + print '. '; + print '
'; + if ($absolute_discount) + print $langs->trans("CompanyHasAbsoluteDiscount", '' . price($absolute_discount) . '', $langs->trans("Currency" . $conf->currency)); + else + print $langs->trans("CompanyHasNoAbsoluteDiscount"); + print ' (' . $langs->trans("EditGlobalDiscounts") . ')'; + print '.'; + print ''; + } // Label - print ''.$langs->trans('Label').''; + print ''.$langs->trans('Label').''; // Date invoice print ''.$langs->trans('DateInvoice').''; @@ -1608,43 +1796,14 @@ if ($action == 'create') } } print ''.$langs->trans('TotalTTC').''.price($objectsrc->total_ttc).""; - + if (!empty($conf->multicurrency->enabled)) { print '' . $langs->trans('MulticurrencyTotalHT') . '' . price($objectsrc->multicurrency_total_ht) . ''; print '' . $langs->trans('MulticurrencyTotalVAT') . '' . price($objectsrc->multicurrency_total_tva) . ""; - print '' . $langs->trans('MulticurrencyTotalTTC') . '' . price($objectsrc->multicurrency_total_ttc) . ""; + print '' . $langs->trans('MulticurrencyTotalTTC') . '' . price($objectsrc->multicurrency_total_ttc) . ""; } } - else - { - // TODO more bugs - if (1==2 && ! empty($conf->global->PRODUCT_SHOW_WHEN_CREATE)) - { - print ''; - print ' '; - print ''.$langs->trans('Label').''; - print ''.$langs->trans('PriceUHT').''; - print ''.$langs->trans('VAT').''; - print ''.$langs->trans('Qty').''; - print ''.$langs->trans('PriceUTTC').''; - print ''; - - for ($i = 1 ; $i < 9 ; $i++) - { - $value_qty = '1'; - $value_tauxtva = ''; - print ''.$i.''; - print ''; - print ''; - print ''; - print $form->load_tva('tauxtva'.$i,$value_tauxtva,$societe,$mysoc); - print ''; - print ''; - print ''; - } - } - } // Other options $parameters=array('colspan' => ' colspan="6"'); @@ -1704,6 +1863,8 @@ else // fetch optionals attributes and labels $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); + $alreadypaid=$object->getSommePaiement(); + /* * View card */ @@ -1787,6 +1948,12 @@ else { $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteBill'), $langs->trans('ConfirmDeleteBill'), 'confirm_delete', '', 0, 1); + } + if ($action == 'deletepaiement') + { + $payment_id = GETPOST('paiement_id'); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&paiement_id='.$payment_id, $langs->trans('DeletePayment'), $langs->trans('ConfirmDeletePayment'), 'confirm_delete_paiement', '', 0, 1); + } // Confirmation to delete line @@ -1795,7 +1962,8 @@ else $formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline', '', 0, 1); } - if (!$formconfirm) { + if (!$formconfirm) + { $parameters=array('lineid'=>$lineid); $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook if (empty($reshook)) $formconfirm.=$hookmanager->resPrint; @@ -1806,31 +1974,61 @@ else print $formconfirm; - /** - * Invoice - */ - print ''; - + // Supplier invoice card $linkback = ''.$langs->trans("BackToList").''; - // Ref - print ''; - print "\n"; + $morehtmlref='
'; + // Ref supplier + $morehtmlref.=$form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->fournisseur->commande->creer, 'string', '', 0, 1); + $morehtmlref.=$form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->fournisseur->commande->creer, 'string', '', null, null, '', 1); + // Thirdparty + $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); + // Project + if (! empty($conf->projet->enabled)) + { + $langs->load("projects"); + $morehtmlref.='
'.$langs->trans('Project') . ' '; + if ($user->rights->fournisseur->commande->creer) + { + if ($action != 'classify') + $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.=''; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (! empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref.=''; + $morehtmlref.=$proj->ref; + $morehtmlref.=''; + } else { + $morehtmlref.=''; + } + } + } + $morehtmlref.='
'; - // Ref supplier - print ''; + $object->totalpaye = $alreadypaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status - // Third party - print ''; - print ''; + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + + print '
'; + print '
'; + print '
'; + + print '
'.$langs->trans("Ref").''; - print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref'); - print '
'.$form->editfieldkey("RefSupplier",'ref_supplier',$object->ref_supplier,$object,($object->statutrights->fournisseur->facture->creer)).''; - print $form->editfieldval("RefSupplier",'ref_supplier',$object->ref_supplier,$object,($object->statutrights->fournisseur->facture->creer)); - print '
'.$langs->trans('Supplier').''.$societe->getNomUrl(1,'supplier'); - print '   ('.$langs->trans('OtherBills').')
'; // Type - print ''; // Label - print ''; - print ''; - - /* - * List of payments - */ - $nbrows=9; $nbcols=3; - if (! empty($conf->projet->enabled)) $nbrows++; - if (! empty($conf->banque->enabled)) { $nbrows++; $nbcols++; } - if (! empty($conf->incoterm->enabled)) $nbrows++; - - // Local taxes - if ($societe->localtax1_assuj=="1") $nbrows++; - if ($societe->localtax2_assuj=="1") $nbrows++; - - print ''; - + print ''; + print ''; print ''; $form_permission = $object->statutrights->fournisseur->facture->creer && $object->getSommePaiement() <= 0; // Date - print ''; @@ -2054,12 +2144,12 @@ else $form->form_multicurrency_code($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_code, 'none'); } print ''; - + // Multicurrency rate print ''; print '
'.$langs->trans('Type').''; + print '
'.$langs->trans('Type').''; print $object->getLibType(); if ($object->type == FactureFournisseur::TYPE_REPLACEMENT) { @@ -1869,122 +2067,14 @@ else print '
'.$form->editfieldkey("Label",'libelle',$object->label,$object,($user->rights->fournisseur->facture->creer)).''.$form->editfieldval("Label",'libelle',$object->label,$object,($user->rights->fournisseur->facture->creer)).''; - - $sql = 'SELECT p.datep as dp, p.ref, p.num_paiement, p.rowid, p.fk_bank,'; - $sql.= ' c.id as paiement_type,'; - $sql.= ' pf.amount,'; - $sql.= ' ba.rowid as baid, ba.ref as baref, ba.label'; - $sql.= ' FROM '.MAIN_DB_PREFIX.'paiementfourn as p'; - $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON p.fk_bank = b.rowid'; - $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank_account as ba ON b.fk_account = ba.rowid'; - $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as c ON p.fk_paiement = c.id'; - $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiementfourn_facturefourn as pf ON pf.fk_paiementfourn = p.rowid'; - $sql.= ' WHERE pf.fk_facturefourn = '.$object->id; - $sql.= ' ORDER BY p.datep, p.tms'; - - $result = $db->query($sql); - if ($result) - { - $num = $db->num_rows($result); - $i = 0; $totalpaye = 0; - print ''; - print ''; - print ''; - print ''; - print ''; - if (! empty($conf->banque->enabled)) print ''; - print ''; - print ''; - print ''; - - $var=true; - if ($num > 0) - { - while ($i < $num) - { - $objp = $db->fetch_object($result); - $var=!$var; - print ''; - print ''; - print ''; - if (! empty($conf->banque->enabled)) - { - $bankaccountstatic->id=$objp->baid; - $bankaccountstatic->ref=$objp->baref; - $bankaccountstatic->label=$objp->baref; - print ''; - } - print ''; - print ''; - print ''; - $totalpaye += $objp->amount; - $i++; - } - } - else - { - print ''; - } - - if ($object->paye == 0) - { - print ''; - print ''; - - $resteapayer = $object->total_ttc - $totalpaye; - - print ''; - print ''; - } - print '
'.$langs->trans('Payments').''.$langs->trans('Date').''.$langs->trans('Type').''.$langs->trans('BankAccount').''.$langs->trans('Amount').' 
'; - $paymentstatic->id=$objp->rowid; - $paymentstatic->datepaye=$db->jdate($objp->dp); - $paymentstatic->ref=$objp->ref; - $paymentstatic->num_paiement=$objp->num_paiement; - $paymentstatic->payment_code=$objp->payment_code; - print $paymentstatic->getNomUrl(1); - print ''.dol_print_date($db->jdate($objp->dp), 'day') . ''; - print $form->form_modes_reglement(null, $objp->paiement_type,'none').' '.$objp->num_paiement; - print ''; - if ($objp->baid > 0) print $bankaccountstatic->getNomUrl(1,'transactions'); - print ''.price($objp->amount).''; - if ($object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0 && $user->societe_id == 0) - { - print 'rowid.'">'; - print img_delete(); - print ''; - } - print '
'.$langs->trans("None").'
'.$langs->trans('AlreadyPaid').' :'.price($totalpaye).'
'.$langs->trans("Billed").' :'.price($object->total_ttc).'
'.$langs->trans('RemainderToPay').' :'.price($resteapayer).'
'; - $db->free($result); - } - else - { - dol_print_error($db); - } - print '
'.$form->editfieldkey("Label",'label',$object->label,$object,($user->rights->fournisseur->facture->creer)).''.$form->editfieldval("Label",'label',$object->label,$object,($user->rights->fournisseur->facture->creer)).'
'.$form->editfieldkey("Date",'datef',$object->datep,$object,$form_permission,'datepicker').''; + print '
'.$form->editfieldkey("DateInvoice",'datef',$object->datep,$object,$form_permission,'datepicker').''; print $form->editfieldval("Date",'datef',$object->datep,$object,$form_permission,'datepicker'); print '
'; print ''; if ($action != 'editmulticurrencyrate' && ! empty($object->brouillon)) print ''; @@ -2091,58 +2181,10 @@ else print ''; // Status - $alreadypaid=$object->getSommePaiement(); - print ''; - - // Amount - print ''; - print ''; - - // Amount Local Taxes - //TODO: Place into a function to control showing by country or study better option - if ($societe->localtax1_assuj=="1") //Localtax1 - { - print ''; - print ''; - print ''; - } - if ($societe->localtax2_assuj=="1") //Localtax2 - { - print ''; - print ''; - print ''; - } - print ''; - - if (!empty($conf->multicurrency->enabled)) - { - // Multicurrency Amount HT - print ''; - print ''; - print ''; - - // Multicurrency Amount VAT - print ''; - print ''; - print ''; - - // Multicurrency Amount TTC - print ''; - print ''; - print ''; - } + //print ''; // Project + /* if (! empty($conf->projet->enabled)) { $langs->load('projects'); @@ -2172,7 +2214,8 @@ else print ''; print ''; } - + */ + // Incoterms if (!empty($conf->incoterm->enabled)) { @@ -2196,12 +2239,180 @@ else print ''; } - // Other attributes - $cols = 4; - include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; - - print '
'; - print fieldLabel('Rate','multicurrency_tx'); + print fieldLabel('CurrencyRate','multicurrency_tx'); print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '
'.$langs->trans('Status').''.$object->getLibStatut(4,$alreadypaid).'
'.$langs->trans('AmountHT').''.price($object->total_ht,1,$langs,0,-1,-1,$conf->currency).'
'.$langs->trans('AmountVAT').''.price($object->total_tva,1,$langs,0,-1,-1,$conf->currency).''; - if (GETPOST('calculationrule')) $calculationrule=GETPOST('calculationrule','alpha'); - else $calculationrule=(empty($conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND)?'totalofround':'roundoftotal'); - if ($calculationrule == 'totalofround') $calculationrulenum=1; - else $calculationrulenum=2; - $s=$langs->trans("ReCalculate").' '; - $s.=''.$langs->trans("Mode1").''; - $s.=' / '; - $s.=''.$langs->trans("Mode2").''; - print $form->textwithtooltip($s, $langs->trans("CalculationRuleDesc",$calculationrulenum).'
'.$langs->trans("CalculationRuleDescSupplier"), 2, 1, img_picto('','help')); - print '
'.$langs->transcountry("AmountLT1",$societe->country_code).''.price($object->total_localtax1,1,$langs,0,-1,-1,$conf->currency).'
'.$langs->transcountry("AmountLT2",$societe->country_code).''.price($object->total_localtax2,1,$langs,0,-1,-1,$conf->currency).'
'.$langs->trans('AmountTTC').''.price($object->total_ttc,1,$langs,0,-1,-1,$conf->currency).'
' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . '' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . '' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . '' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
'.$langs->trans('Status').''.$object->getLibStatut(4,$alreadypaid).'

'; + // Other attributes + $cols = 2; + include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; + + print '
'; + + print '
'; + print '
'; + print '
'; + print '
'; + + print ''; + + // Amount + print ''; + print ''; + + // Amount Local Taxes + //TODO: Place into a function to control showing by country or study better option + if ($societe->localtax1_assuj=="1") //Localtax1 + { + print ''; + print ''; + print ''; + } + if ($societe->localtax2_assuj=="1") //Localtax2 + { + print ''; + print ''; + print ''; + } + print ''; + + if (!empty($conf->multicurrency->enabled)) + { + // Multicurrency Amount HT + print ''; + print ''; + print ''; + + // Multicurrency Amount VAT + print ''; + print ''; + print ''; + + // Multicurrency Amount TTC + print ''; + print ''; + print ''; + } + + print '
'.$langs->trans('AmountHT').''.price($object->total_ht,1,$langs,0,-1,-1,$conf->currency).'
'.$langs->trans('AmountVAT').''.price($object->total_tva,1,$langs,0,-1,-1,$conf->currency).'
        '; + if (GETPOST('calculationrule')) $calculationrule=GETPOST('calculationrule','alpha'); + else $calculationrule=(empty($conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND)?'totalofround':'roundoftotal'); + if ($calculationrule == 'totalofround') $calculationrulenum=1; + else $calculationrulenum=2; + $s=$langs->trans("ReCalculate").' '; + $s.=''.$langs->trans("Mode1").''; + $s.=' / '; + $s.=''.$langs->trans("Mode2").''; + print $form->textwithtooltip($s, $langs->trans("CalculationRuleDesc",$calculationrulenum).'
'.$langs->trans("CalculationRuleDescSupplier"), 2, 1, img_picto('','help')); + print '
'.$langs->transcountry("AmountLT1",$societe->country_code).''.price($object->total_localtax1,1,$langs,0,-1,-1,$conf->currency).'
'.$langs->transcountry("AmountLT2",$societe->country_code).''.price($object->total_localtax2,1,$langs,0,-1,-1,$conf->currency).'
'.$langs->trans('AmountTTC').''.price($object->total_ttc,1,$langs,0,-1,-1,$conf->currency).'
' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . '' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . '' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . '' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
'; + + /* + * List of payments + */ + $nbrows=9; $nbcols=3; + if (! empty($conf->projet->enabled)) $nbrows++; + if (! empty($conf->banque->enabled)) { $nbrows++; $nbcols++; } + if (! empty($conf->incoterm->enabled)) $nbrows++; + + // Local taxes + if ($societe->localtax1_assuj=="1") $nbrows++; + if ($societe->localtax2_assuj=="1") $nbrows++; + + $sql = 'SELECT p.datep as dp, p.ref, p.num_paiement, p.rowid, p.fk_bank,'; + $sql.= ' c.id as paiement_type,'; + $sql.= ' pf.amount,'; + $sql.= ' ba.rowid as baid, ba.ref as baref, ba.label'; + $sql.= ' FROM '.MAIN_DB_PREFIX.'paiementfourn as p'; + $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON p.fk_bank = b.rowid'; + $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank_account as ba ON b.fk_account = ba.rowid'; + $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as c ON p.fk_paiement = c.id'; + $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiementfourn_facturefourn as pf ON pf.fk_paiementfourn = p.rowid'; + $sql.= ' WHERE pf.fk_facturefourn = '.$object->id; + $sql.= ' ORDER BY p.datep, p.tms'; + + $result = $db->query($sql); + if ($result) + { + $num = $db->num_rows($result); + $i = 0; $totalpaye = 0; + print ''; + print ''; + print ''; + print ''; + print ''; + if (! empty($conf->banque->enabled)) print ''; + print ''; + print ''; + print ''; + + $var=false; + if ($num > 0) + { + while ($i < $num) + { + $objp = $db->fetch_object($result); + $var=!$var; + print ''; + print ''; + print ''; + if (! empty($conf->banque->enabled)) + { + $bankaccountstatic->id=$objp->baid; + $bankaccountstatic->ref=$objp->baref; + $bankaccountstatic->label=$objp->baref; + print ''; + } + print ''; + print ''; + print ''; + $totalpaye += $objp->amount; + $i++; + } + } + else + { + print ''; + } + + if ($object->paye == 0) + { + print ''; + print ''; + + $resteapayer = $object->total_ttc - $totalpaye; + + print ''; + print ''; + } + print '
'.$langs->trans('Payments').''.$langs->trans('Date').''.$langs->trans('Type').''.$langs->trans('BankAccount').''.$langs->trans('Amount').' 
'; + $paymentstatic->id=$objp->rowid; + $paymentstatic->datepaye=$db->jdate($objp->dp); + $paymentstatic->ref=$objp->ref; + $paymentstatic->num_paiement=$objp->num_paiement; + $paymentstatic->payment_code=$objp->payment_code; + print $paymentstatic->getNomUrl(1); + print ''.dol_print_date($db->jdate($objp->dp), 'day') . ''; + print $form->form_modes_reglement(null, $objp->paiement_type,'none').' '.$objp->num_paiement; + print ''; + if ($objp->baid > 0) print $bankaccountstatic->getNomUrl(1,'transactions'); + print ''.price($objp->amount).''; + if ($object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0 && $user->societe_id == 0) + { + print 'rowid.'">'; + print img_delete(); + print ''; + } + print '
'.$langs->trans("None").'
'.$langs->trans('AlreadyPaid').' :'.price($totalpaye).'
'.$langs->trans("Billed").' :'.price($object->total_ttc).'
'.$langs->trans('RemainderToPay').' :'.price($resteapayer).'
'; + $db->free($result); + } + else + { + dol_print_error($db); + } + + print '
'; + print '
'; + print '
'; + + print '

'; + if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) { $blocname = 'contacts'; @@ -2240,7 +2451,7 @@ else global $forceall, $senderissupplier, $dateSelector, $inputalsopricewithtax; $forceall=1; $senderissupplier=1; $dateSelector=0; $inputalsopricewithtax=1; - + // Show object lines if (! empty($object->lines)) $ret = $object->printObjectLines($action, $societe, $mysoc, $lineid, 1); @@ -2281,15 +2492,15 @@ else $parameters = array(); $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been // modified by hook - if (empty($reshook)) + if (empty($reshook)) { - + // Modify a validated invoice with no payments if ($object->statut == FactureFournisseur::STATUS_VALIDATED && $action != 'edit' && $object->getSommePaiement() == 0 && $user->rights->fournisseur->facture->creer) { print ''.$langs->trans('Modify').''; } - + // Reopen a standard paid invoice if (($object->type == FactureFournisseur::TYPE_STANDARD || $object->type == FactureFournisseur::TYPE_REPLACEMENT) && ($object->statut == 2 || $object->statut == 3)) // A paid invoice (partially or completely) { @@ -2302,7 +2513,7 @@ else print ''.$langs->trans('ReOpen').''; } } - + // Send by mail if (($object->statut == FactureFournisseur::STATUS_VALIDATED || $object->statut == FactureFournisseur::STATUS_CLOSED)) { @@ -2312,23 +2523,23 @@ else } else print ''.$langs->trans('SendByMail').''; } - - + + // Make payments if ($action != 'edit' && $object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0 && $user->societe_id == 0) { - print ''.$langs->trans('DoPayment').''; // must use facid because id is for payment id not invoice + print ''.$langs->trans('DoPayment').''; // must use facid because id is for payment id not invoice } - + // Classify paid if ($action != 'edit' && $object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0 && $user->societe_id == 0) { print ''.$langs->trans('ClassifyPaid').''; - + //print ''.$langs->trans('ClassifyPaid').''; } - + // Validate if ($action != 'edit' && $object->statut == FactureFournisseur::STATUS_DRAFT) { @@ -2347,19 +2558,28 @@ else } } } - + // Create event if ($conf->agenda->enabled && ! empty($conf->global->MAIN_ADD_EVENT_ON_ELEMENT_CARD)) // Add hidden condition because this is not a "workflow" action so should appears somewhere else on page. { print ''; } - + // Clone if ($action != 'edit' && $user->rights->fournisseur->facture->creer) { print 'socid.'">'.$langs->trans('ToClone').''; } - + + // Create a credit note + if (($object->type == FactureFournisseur::TYPE_STANDARD || $object->type == FactureFournisseur::TYPE_DEPOSIT) && $object->statut > 0 && $user->rights->fournisseur->facture->creer) + { + if (! $objectidnext) + { + print ''; + } + } + // Delete if ($action != 'edit' && $user->rights->fournisseur->facture->supprimer) { @@ -2371,17 +2591,14 @@ else } print '
'; print '
'; - + if ($action != 'edit') { print '
'; - //print '
'; - //print ''; // ancre - - /* + + /* * Documents generes - */ - + */ $ref=dol_sanitizeFileName($object->ref); $subdir = get_exdir($object->id,2,0,0,$object,'invoice_supplier').$ref; $filedir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($object->id,2,0,0,$object,'invoice_supplier').$ref; @@ -2389,27 +2606,23 @@ else $genallowed=$user->rights->fournisseur->facture->creer; $delallowed=$user->rights->fournisseur->facture->supprimer; $modelpdf=(! empty($object->modelpdf)?$object->modelpdf:(empty($conf->global->INVOICE_SUPPLIER_ADDON_PDF)?'':$conf->global->INVOICE_SUPPLIER_ADDON_PDF)); - + print $formfile->showdocuments('facture_fournisseur',$subdir,$filedir,$urlsource,$genallowed,$delallowed,$modelpdf,1,0,0,40,0,'','','',$societe->default_lang); $somethingshown=$formfile->numoffiles; - - // Linked object block - $somethingshown = $form->showLinkedObjectBlock($object); - - // Show links to link elements - $linktoelem = $form->showLinkToObjectBlock($object,array('supplier_order')); - if ($linktoelem) print '
'.$linktoelem; - - - print '
'; + + // Show links to link elements + $linktoelem = $form->showLinkToObjectBlock($object, null, array('invoice_supplier')); + $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem); + + print '
'; //print '
'; //print '
'; - + // List of actions on element include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; $formactions=new FormActions($db); $somethingshown=$formactions->showactions($object,'invoice_supplier',$socid,0,'listaction'.($genallowed?'largetitle':'')); - + print ''; //print '
'; } @@ -2448,7 +2661,7 @@ else if (! $file || ! is_readable($file)) { $result = $object->generateDocument(GETPOST('model')?GETPOST('model'):$object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); - if ($result <= 0) + if ($result < 0) { dol_print_error($db,$object->error,$object->errors); exit; @@ -2467,16 +2680,18 @@ else include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; $formmail = new FormMail($db); $formmail->param['langsmodels']=(empty($newlang)?$langs->defaultlang:$newlang); - $formmail->fromtype = 'user'; - $formmail->fromid = $user->id; - $formmail->fromname = $user->getFullName($langs); - $formmail->frommail = $user->email; + $formmail->fromtype = (GETPOST('fromtype')?GETPOST('fromtype'):(!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE)?$conf->global->MAIN_MAIL_DEFAULT_FROMTYPE:'user')); + + if($formmail->fromtype === 'user'){ + $formmail->fromid = $user->id; + + } $formmail->trackid='sin'.$object->id; if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set { include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; $formmail->frommail=dolAddEmailTrackId($formmail->frommail, 'sin'.$object->id); - } + } $formmail->withfrom=1; $liste=array(); foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key=>$value) $liste[$key]=$value; diff --git a/htdocs/fourn/facture/contact.php b/htdocs/fourn/facture/contact.php index 664101848a6..1da6e0699fc 100644 --- a/htdocs/fourn/facture/contact.php +++ b/htdocs/fourn/facture/contact.php @@ -112,7 +112,9 @@ else if ($action == 'deletecontact' && $user->rights->fournisseur->facture->cree * View */ -llxHeader('', $langs->trans("Bill"), "Facture"); +$title = $langs->trans('SupplierInvoice') . " - " . $langs->trans('ContactsAddresses'); +$helpurl = "EN:Module_Suppliers_Invoices|FR:Module_Fournisseurs_Factures|ES:Módulo_Facturas_de_proveedores"; +llxHeader('', $title, $helpurl); $form = new Form($db); $formcompany = new FormCompany($db); @@ -144,7 +146,7 @@ if ($id > 0 || ! empty($ref)) $linkback = ''.$langs->trans("BackToList").''; // Reference du facture - print ''.$langs->trans("Ref").''; + print ''.$langs->trans("Ref").''; print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); print ""; diff --git a/htdocs/fourn/facture/document.php b/htdocs/fourn/facture/document.php index 673d679b4b5..c9a40f9b590 100644 --- a/htdocs/fourn/facture/document.php +++ b/htdocs/fourn/facture/document.php @@ -81,7 +81,9 @@ include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php'; $form = new Form($db); -llxHeader(); +$title = $langs->trans('SupplierInvoice') . " - " . $langs->trans('Documents'); +$helpurl = "EN:Module_Suppliers_Invoices|FR:Module_Fournisseurs_Factures|ES:Módulo_Facturas_de_proveedores"; +llxHeader('', $title, $helpurl); if ($object->id > 0) { @@ -110,7 +112,7 @@ if ($object->id > 0) $linkback = ''.$langs->trans("BackToList").''; // Ref - print ''.$langs->trans("Ref").''; + print ''.$langs->trans("Ref").''; print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref'); print ''; print "\n"; @@ -197,7 +199,7 @@ if ($object->id > 0) print ''; // Nb of files - print ''; + print ''; print ''; @@ -206,6 +208,7 @@ if ($object->id > 0) $modulepart = 'facture_fournisseur'; $permission = $user->rights->fournisseur->facture->creer; + $permtoedit = $user->rights->fournisseur->facture->creer; $param = '&facid=' . $object->id; include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php'; } diff --git a/htdocs/fourn/facture/info.php b/htdocs/fourn/facture/info.php index 7033d555c0e..590d5ea75bd 100644 --- a/htdocs/fourn/facture/info.php +++ b/htdocs/fourn/facture/info.php @@ -43,7 +43,9 @@ $result = restrictedArea($user, 'fournisseur', $id, 'facture_fourn', 'facture'); * View */ -llxHeader(); +$title = $langs->trans('SupplierInvoice') . " - " . $langs->trans('Info'); +$helpurl = "EN:Module_Suppliers_Invoices|FR:Module_Fournisseurs_Factures|ES:Módulo_Facturas_de_proveedores"; +llxHeader('', $title, $helpurl); $object = new FactureFournisseur($db); $object->fetch($id); diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 88f01c1e837..ebe65f62122 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -58,7 +58,6 @@ if ($user->societe_id > 0) } $mode=GETPOST("mode"); -$modesearch=GETPOST("mode_search"); $search_product_category=GETPOST('search_product_category','int'); $search_ref=GETPOST('sf_ref')?GETPOST('sf_ref','alpha'):GETPOST('search_ref','alpha'); @@ -215,27 +214,6 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter") || GETPOS $option=''; } -if ($mode == 'search') -{ - if ($modesearch == 'soc') - { - $sql = "SELECT s.rowid FROM ".MAIN_DB_PREFIX."societe as s "; - $sql.= " WHERE s.nom LIKE '%".$db->escape($socname)."%'"; - $sql.= " AND s.entity IN (".getEntity('societe', 1).")"; - } - - $resql=$db->query($sql); - if ($resql) - { - if ( $db->num_rows($resql) == 1) - { - $obj = $db->fetch_object($resql); - $socid = $obj->rowid; - } - $db->free($resql); - } -} - if (empty($reshook)) { // Mass actions. Controls on number of lines checked @@ -270,7 +248,7 @@ llxHeader('',$langs->trans("SuppliersInvoices"),'EN:Suppliers_Invoices|FR:Factur $sql = "SELECT"; if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT'; $sql.= " f.rowid as facid, f.ref, f.ref_supplier, f.datef, f.date_lim_reglement as datelimite,"; -$sql.= " f.total_ht, f.total_ttc, f.paye as paye, f.fk_statut as fk_statut, f.libelle as label,"; +$sql.= " f.total_ht, f.total_ttc, f.total_tva as total_vat, f.paye as paye, f.fk_statut as fk_statut, f.libelle as label,"; $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,"; @@ -288,7 +266,6 @@ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)"; $sql.= ', '.MAIN_DB_PREFIX.'facture_fourn as f'; if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture_fourn_extrafields as ef on (f.rowid = ef.fk_object)"; -else $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'facture_fourn_det as fd ON fd.fk_facture_fourn = f.rowid'; if ($sall || $search_product_category > 0) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'facture_fourn_det as pd ON f.rowid=pd.fk_facture_fourn'; if ($search_product_category > 0) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product=pd.fk_product'; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = f.fk_projet"; @@ -314,7 +291,7 @@ if ($search_ref) else $sql .= natural_search('f.ref', $search_ref); } if ($search_ref) $sql .= natural_search('f.ref', $search_ref); -if ($search_ref_supplier) $sql .= natural_search('f.ref_supplier', $search_ref_supplier); +if ($search_refsupplier) $sql .= natural_search('f.ref_supplier', $search_refsupplier); if ($search_project) $sql .= natural_search('p.ref', $search_project); if ($search_societe) $sql .= natural_search('s.nom', $search_societe); if ($search_town) $sql.= natural_search('s.town', $search_town); @@ -323,7 +300,7 @@ if ($search_state) $sql.= natural_search("state.nom",$search_state); if ($search_country) $sql .= " AND s.fk_pays IN (".$search_country.')'; if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$search_type_thirdparty.')'; if ($search_company) $sql .= natural_search('s.nom', $search_company); -if ($search_montant_ht != '') $sql.= natural_search('f.total', $search_montant_ht, 1); +if ($search_montant_ht != '') $sql.= natural_search('f.total_ht', $search_montant_ht, 1); if ($search_montant_vat != '') $sql.= natural_search('f.total_tva', $search_montant_vat, 1); if ($search_montant_ttc != '') $sql.= natural_search('f.total_ttc', $search_montant_ttc, 1); if ($search_status != '' && $search_status >= 0) $sql.= " AND f.fk_statut = ".$db->escape($search_status); @@ -428,7 +405,7 @@ if ($resql) if ($month_lim) $param.='&month_lim='.urlencode($month_lim); if ($year_lim) $param.='&year_lim=' .urlencode($year_lim); if ($search_ref) $param.='&search_ref='.urlencode($search_ref); - if ($search_refsupplier) $param.='&search_refsupplier'.urlencode($search_refsupplier); + if ($search_refsupplier) $param.='&search_refsupplier='.urlencode($search_refsupplier); if ($search_label) $param.='&search_label='.urlencode($search_label); if ($search_company) $param.='&search_company='.urlencode($search_company); if ($search_montant_ht != '') $param.='&search_montant_ht='.urlencode($search_montant_ht); @@ -458,7 +435,7 @@ if ($resql) print ''; print ''; - print_barre_liste($langs->trans("BillsSuppliers").($socid?" $soc->name.":""),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords,'title_accountancy',0,'','',$limit); + print_barre_liste($langs->trans("BillsSuppliers").($socid?" - $soc->name":""),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords,'title_accountancy',0,'','',$limit); if ($search_all) { @@ -514,7 +491,7 @@ if ($resql) if (! empty($arrayfields['f.ref']['checked'])) print_liste_field_titre($arrayfields['f.ref']['label'],$_SERVER['PHP_SELF'],'f.ref,f.rowid','',$param,'',$sortfield,$sortorder); if (! empty($arrayfields['f.ref_supplier']['checked'])) print_liste_field_titre($arrayfields['f.ref_supplier']['label'],$_SERVER["PHP_SELF"],'f.ref_supplier','',$param,'',$sortfield,$sortorder); if (! empty($arrayfields['f.label']['checked'])) print_liste_field_titre($arrayfields['f.label']['label'],$_SERVER['PHP_SELF'],"f.libelle,f.rowid",'',$param,'',$sortfield,$sortorder); - if (! empty($arrayfields['f.datef']['checked'])) print_liste_field_titre($arrayfields['f.datef']['label'],$_SERVER['PHP_SELF'],'f.datef','',$param,'align="center"',$sortfield,$sortorder); + if (! empty($arrayfields['f.datef']['checked'])) print_liste_field_titre($arrayfields['f.datef']['label'],$_SERVER['PHP_SELF'],'f.datef,f.rowid','',$param,'align="center"',$sortfield,$sortorder); if (! empty($arrayfields['f.date_lim_reglement']['checked'])) print_liste_field_titre($arrayfields['f.date_lim_reglement']['label'],$_SERVER['PHP_SELF'],"f.date_lim_reglement",'',$param,'align="center"',$sortfield,$sortorder); if (! empty($arrayfields['p.ref']['checked'])) print_liste_field_titre($arrayfields['p.ref']['label'],$_SERVER['PHP_SELF'],"p.ref",'',$param,'align="center"',$sortfield,$sortorder); if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'],$_SERVER['PHP_SELF'],'s.nom','',$param,'',$sortfield,$sortorder); @@ -547,19 +524,7 @@ if ($resql) if (! empty($arrayfields['f.tms']['checked'])) print_liste_field_titre($arrayfields['f.tms']['label'],$_SERVER["PHP_SELF"],"f.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); if (! empty($arrayfields['f.fk_statut']['checked'])) print_liste_field_titre($arrayfields['f.fk_statut']['label'],$_SERVER["PHP_SELF"],"fk_statut,paye","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch '); -/* - print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"f.ref,f.rowid","",$param,"",$sortfield,$sortorder); - if (empty($conf->global->SUPPLIER_INVOICE_HIDE_REF_SUPPLIER)) print_liste_field_titre($langs->trans("RefSupplier"),$_SERVER["PHP_SELF"],"ref_supplier","",$param,"",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"f.datef,f.rowid","",$param,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("DateDue"),$_SERVER["PHP_SELF"],"f.date_lim_reglement","",$param,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"f.libelle","",$param,"",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom","",$param,"",$sortfield,$sortorder); - if (! empty($conf->global->PROJECT_SHOW_REF_INTO_LISTS)) print_liste_field_titre($langs->trans("Project"),$_SERVER["PHP_SELF"],"p.ref","",$param,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("AmountHT"),$_SERVER["PHP_SELF"],"f.total_ht","",$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("AmountTTC"),$_SERVER["PHP_SELF"],"f.total_ttc","",$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"fk_statut,paye","",$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch '); -*/ print "\n"; + print "\n"; // Line for filters @@ -743,19 +708,30 @@ if ($resql) $facturestatic->ref_supplier=$obj->ref_supplier; $facturestatic->date_echeance = $db->jdate($obj->datelimite); $facturestatic->statut = $obj->fk_statut; - + print ''; if (! empty($arrayfields['f.ref']['checked'])) { print '\n"; - - if (! $i) $totalarray['nbfield']++; + if (! $i) $totalarray['nbfield']++; } // Customer ref diff --git a/htdocs/fourn/facture/note.php b/htdocs/fourn/facture/note.php index 3a4528d827e..eeb9d37f2fd 100644 --- a/htdocs/fourn/facture/note.php +++ b/htdocs/fourn/facture/note.php @@ -67,7 +67,9 @@ if ($action == 'setlabel' && $user->rights->fournisseur->facture->creer) $form = new Form($db); -llxHeader(); +$title = $langs->trans('SupplierInvoice') . " - " . $langs->trans('Notes'); +$helpurl = "EN:Module_Suppliers_Invoices|FR:Module_Fournisseurs_Factures|ES:Módulo_Facturas_de_proveedores"; +llxHeader('', $title, $helpurl); if ($object->id > 0) { @@ -83,7 +85,7 @@ if ($object->id > 0) $linkback = ''.$langs->trans("BackToList").''; // Ref - print ''; print "\n"; @@ -167,7 +169,6 @@ if ($object->id > 0) print '
'; - $colwidth=20; include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; dol_fiche_end(); diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php index ad1ba8555a2..764a875019d 100644 --- a/htdocs/fourn/facture/paiement.php +++ b/htdocs/fourn/facture/paiement.php @@ -319,7 +319,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie $dateinvoice=($datefacture==''?(empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''):$datefacture); $sql = 'SELECT s.nom as name, s.rowid as socid,'; - $sql.= ' f.rowid, f.ref, f.ref_supplier, f.amount, f.total_ttc as total, fk_mode_reglement, fk_account'; + $sql.= ' f.rowid, f.ref, f.ref_supplier, f.amount, f.total_ttc as total, f.fk_mode_reglement, f.fk_account'; if (!$user->rights->societe->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user "; $sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s, '.MAIN_DB_PREFIX.'facture_fourn as f'; if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -334,7 +334,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie { $obj = $db->fetch_object($resql); $total = $obj->total; - + print load_fiche_titre($langs->trans('DoPayment')); print ''; @@ -349,21 +349,17 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie print '
'.$langs->trans('NbOfAttachedFiles').''.count($filearray).'
'.$langs->trans('NbOfAttachedFiles').''.count($filearray).'
'.$langs->trans('TotalSizeOfAttachedFiles').''.$totalsize.' '.$langs->trans('bytes').'
'; - + + print ''; + // Picto + Ref + print ''; + // Warning + //print ''; + // Other picto tool + print '
'; print $facturestatic->getNomUrl(1); + print ''; + //print ''; $filename=dol_sanitizeFileName($obj->ref); $filedir=$conf->fournisseur->facture->dir_output.'/'.get_exdir($obj->facid,2,0,0,$facturestatic,'invoice_supplier').dol_sanitizeFileName($obj->ref); - print $formfile->getDocumentsLink('facture_fournisseur', $filename, $filedir); + $subdir = get_exdir($obj->facid,2,0,0,$facturestatic,'invoice_supplier').dol_sanitizeFileName($obj->ref); + print $formfile->getDocumentsLink('facture_fournisseur', $subdir, $filedir); + print '
'; + print "
'.$langs->trans("Ref").''; + print '
'.$langs->trans("Ref").''; print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); print '
'; - print ''; print ''; - print ''; + print ''; print ''; - print ''; - print ''; if (! empty($conf->banque->enabled)) { print ''; + print ''; } + print ''; + print ''; + print ''; print '
'.$langs->trans('Company').''; + print '
'.$langs->trans('Company').''; $supplierstatic->id=$obj->socid; $supplierstatic->name=$obj->name; print $supplierstatic->getNomUrl(1,'supplier'); print '
'.$langs->trans('Date').''; $form->select_date($dateinvoice,'','','','',"addpaiement",1,1,0,0,'','',$object->date); - print ''.$langs->trans('Comments').'
'.$langs->trans('PaymentMode').''; $form->select_types_paiements(empty($_POST['paiementid'])?$obj->fk_mode_reglement:$_POST['paiementid'],'paiementid'); print ''; - print '
'.$langs->trans('Numero').'
'.$langs->trans('Account').''; @@ -372,8 +368,12 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie } else { - print '
 
 
'.$langs->trans('Numero').'
'.$langs->trans('Comments').''; + print '
'; dol_fiche_end(); @@ -386,15 +386,15 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie /* * Autres factures impayees */ - $sql = 'SELECT f.rowid as facid, f.ref, f.ref_supplier, f.total_ht, f.total_ttc, f.multicurrency_total_ttc, f.datef as df'; - $sql.= ', SUM(pf.amount) as am, SUM(pf.multicurrency_amount) as multicurrency_am'; + $sql = 'SELECT f.rowid as facid, f.ref, f.ref_supplier, f.total_ht, f.total_ttc, f.multicurrency_total_ttc, f.datef as df,'; + $sql.= ' SUM(pf.amount) as am, SUM(pf.multicurrency_amount) as multicurrency_am'; $sql.= ' FROM '.MAIN_DB_PREFIX.'facture_fourn as f'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiementfourn_facturefourn as pf ON pf.fk_facturefourn = f.rowid'; $sql.= " WHERE f.entity = ".$conf->entity; $sql.= ' AND f.fk_soc = '.$object->socid; $sql.= ' AND f.paye = 0'; $sql.= ' AND f.fk_statut = 1'; // Statut=0 => non validee, Statut=2 => annulee - $sql.= ' GROUP BY f.rowid, f.ref, f.ref_supplier, f.total_ht, f.total_ttc, f.datef'; + $sql.= ' GROUP BY f.rowid, f.ref, f.ref_supplier, f.total_ht, f.total_ttc, f.multicurrency_total_ttc, f.datef'; $resql = $db->query($sql); if ($resql) { @@ -404,7 +404,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie $i = 0; print '
'; - if(!empty($conf->global->INVOICE_AUTO_FILLJS)){ + if (!empty($conf->use_javascript_ajax)){ //Add js for AutoFill print "\n".''."\n"; - } + }*/ if (! empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) || defined('REQUIRE_JQUERY_MULTISELECT')) // jQuery plugin "mutiselect", "multiple-select", "select2"... { $tmpplugin=empty($conf->global->MAIN_USE_JQUERY_MULTISELECT)?constant('REQUIRE_JQUERY_MULTISELECT'):$conf->global->MAIN_USE_JQUERY_MULTISELECT; @@ -1065,7 +1068,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs print ''."\n"; } // jQuery jMobile - if (! empty($conf->global->MAIN_USE_JQUERY_JMOBILE) || defined('REQUIRE_JQUERY_JMOBILE') || ! empty($conf->dol_use_jmobile)) + if (! $disablejmobile && (! empty($conf->global->MAIN_USE_JQUERY_JMOBILE) || defined('REQUIRE_JQUERY_JMOBILE') || ! empty($conf->dol_use_jmobile))) { print ''."\n"; } @@ -1211,6 +1214,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs print ''."\n"; }*/ // jQuery DataTables + /* Removed a old hidden problematic feature never used in Dolibarr. If an external module need datatable, the module must provide all lib it needs and manage version problems with other dolibarr components if (! empty($conf->global->MAIN_USE_JQUERY_DATATABLES) || (defined('REQUIRE_JQUERY_DATATABLES') && constant('REQUIRE_JQUERY_DATATABLES'))) { print ''."\n"; @@ -1221,9 +1225,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs print ''."\n"; print ''."\n"; print ''."\n"; - print ''."\n"; - print ''."\n"; - } + }*/ // jQuery Timepicker if (! empty($conf->global->MAIN_USE_JQUERY_TIMEPICKER) || defined('REQUIRE_JQUERY_TIMEPICKER')) { @@ -1237,7 +1239,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs print ''."\n"; } // jQuery jMobile - if (! empty($conf->global->MAIN_USE_JQUERY_JMOBILE) || defined('REQUIRE_JQUERY_JMOBILE') || (! empty($conf->dol_use_jmobile) && $conf->dol_use_jmobile > 0)) + if (! $disablejmobile && (! empty($conf->global->MAIN_USE_JQUERY_JMOBILE) || defined('REQUIRE_JQUERY_JMOBILE') || (! empty($conf->dol_use_jmobile) && $conf->dol_use_jmobile > 0))) { // We must force not using ajax because cache of jquery does not load js of other pages. // This also increase seriously speed onto mobile device where complex js code is very slow and memory very low. @@ -1285,23 +1287,13 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs } print ''."\n"; print ''."\n"; } - // Raven.js for client-side Sentry logging support - if (array_key_exists('mod_syslog_sentry', $conf->loghandlers)) { - print '' . "\n"; - print '' . "\n"; - print '' . "\n"; - if (! defined('DISABLE_JQUERY')) { - print '' . "\n"; - } - } - // Global js function print ''."\n"; print ''."\n"; @@ -1376,7 +1368,7 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a $searchform=''; $bookmarks=''; - + // Instantiate hooks of thirdparty module $hookmanager->initHooks(array('toprightmenu')); @@ -1387,23 +1379,6 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a print '' . "\n"; - if ($conf->use_javascript_ajax) - { - // Raven.js for client-side Sentry logging support - if (array_key_exists('mod_syslog_sentry', $conf->loghandlers) && ! empty($conf->global->SYSLOG_SENTRY_DSN)) - { - // Filter out secret key - $dsn = parse_url($conf->global->SYSLOG_SENTRY_DSN); - $public_dsn = $dsn['scheme'] . '://' . $dsn['user'] .'@' . $dsn['host'] . $dsn['path']; - - print '\n"; - } - } - /* * Top menu */ @@ -1437,19 +1412,22 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a if (! empty($conf->global->MAIN_FEATURES_LEVEL)) $appli.="
".$langs->trans("LevelOfFeature").': '.$conf->global->MAIN_FEATURES_LEVEL; $logouttext=''; - $logouthtmltext=$appli.'
'; - if ($_SESSION["dol_authmode"] != 'forceuser' && $_SESSION["dol_authmode"] != 'http') + if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { - $logouthtmltext.=$langs->trans("Logout").'
'; + $logouthtmltext=$appli.'
'; + if ($_SESSION["dol_authmode"] != 'forceuser' && $_SESSION["dol_authmode"] != 'http') + { + $logouthtmltext.=$langs->trans("Logout").'
'; - $logouttext .=''; - $logouttext .= img_picto($langs->trans('Logout').":".$langs->trans('Logout'), 'logout_top.png', 'class="login"', 0, 0, 1); - $logouttext .=''; - } - else - { - $logouthtmltext.=$langs->trans("NoLogoutProcessWithAuthMode",$_SESSION["dol_authmode"]); - $logouttext .= img_picto($langs->trans('Logout').":".$langs->trans('Logout'), 'logout_top.png', 'class="login"', 0, 0, 1); + $logouttext .=''; + $logouttext .= img_picto($langs->trans('Logout').":".$langs->trans('Logout'), 'logout_top.png', 'class="login"', 0, 0, 1); + $logouttext .=''; + } + else + { + $logouthtmltext.=$langs->trans("NoLogoutProcessWithAuthMode",$_SESSION["dol_authmode"]); + $logouttext .= img_picto($langs->trans('Logout').":".$langs->trans('Logout'), 'logout_top.png', 'class="login"', 0, 0, 1); + } } print '
'; print '
'; diff --git a/htdocs/product/class/api_product.class.php b/htdocs/product/class/api_deprecated_product.class.php similarity index 89% rename from htdocs/product/class/api_product.class.php rename to htdocs/product/class/api_deprecated_product.class.php index 1e485fd6733..d4ad8335f54 100644 --- a/htdocs/product/class/api_product.class.php +++ b/htdocs/product/class/api_deprecated_product.class.php @@ -26,7 +26,7 @@ * @smart-auto-routing false * @access protected * @class DolibarrApiAccess {@requires user,external} - * + * @deprecated Use Products instead (defined in api_products.class.php) */ class ProductApi extends DolibarrApi { @@ -44,7 +44,7 @@ class ProductApi extends DolibarrApi public $product; /** - * Constructor + * Constructor Warning: Deprecated * * @url product/ * @@ -57,7 +57,7 @@ class ProductApi extends DolibarrApi } /** - * Get properties of a product object + * Get properties of a product object Warning: Deprecated * * Return an array with product informations * @@ -90,23 +90,23 @@ class ProductApi extends DolibarrApi } /** - * List products + * List products Warning: Deprecated * * Get a list of products * - * @param int $mode Use this param to filter list (0 for all, 1 for only product, 2 for only service) - * @param mixed $to_sell Filter products to sell (1) or not to sell (0) - * @param mixed $to_buy Filter products to nuy (1) or not to buy (0) * @param string $sortfield Sort field * @param string $sortorder Sort order * @param int $limit Limit for list * @param int $page Page number + * @param int $mode Use this param to filter list (0 for all, 1 for only product, 2 for only service) + * @param mixed $to_sell Filter products to sell (1) or not to sell (0) + * @param mixed $to_buy Filter products to buy (1) or not to buy (0) * * @return array Array of product objects * * @url GET /product/list */ - function getList($mode=0, $to_sell='', $to_buy='', $sortfield = "p.ref", $sortorder = 'ASC', $limit = 0, $page = 0) { + function getList($sortfield = "p.ref", $sortorder = 'ASC', $limit = 0, $page = 0, $mode=0, $to_sell='', $to_buy='') { global $db, $conf; $obj_ret = array(); @@ -124,7 +124,7 @@ class ProductApi extends DolibarrApi // Show product on sell if ($to_sell) $sql.= " AND p.to_sell = ".$db->escape($to_sell); // Show product on buy - if ($to_buy) $sql.= " AND p.to_nuy = ".$db->escape($to_nuy); + if ($to_buy) $sql.= " AND p.to_buy = ".$db->escape($to_buy); $nbtotalofrecords = 0; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) @@ -147,8 +147,9 @@ class ProductApi extends DolibarrApi $result = $db->query($sql); if ($result) { + $i=0; $num = $db->num_rows($result); - while ($i < $num) + while ($i < min($num, ($limit <= 0 ? $num : $limit))) { $obj = $db->fetch_object($result); $product_static = new Product($db); @@ -169,24 +170,24 @@ class ProductApi extends DolibarrApi /** - * List products in a category + * List products in a category Warning: Deprecated * * Get a list of products * - * @param int $mode Use this param to filter list (0 for all, 1 for only product, 2 for only service) - * @param int $category Use this param to filter list by category - * @param mixed $to_sell Filter products to sell (1) or not to sell (0) - * @param mixed $to_buy Filter products to nuy (1) or not to buy (0) * @param string $sortfield Sort field * @param string $sortorder Sort order * @param int $limit Limit for list * @param int $page Page number + * @param int $mode Use this param to filter list (0 for all, 1 for only product, 2 for only service) + * @param int $category Use this param to filter list by category + * @param mixed $to_sell Filter products to sell (1) or not to sell (0) + * @param mixed $to_buy Filter products to buy (1) or not to buy (0) * * @return array Array of product objects * * @url GET /product/list/category/{category} */ - function getByCategory($mode=0, $category=0, $to_sell='', $to_buy='', $sortfield = "p.ref", $sortorder = 'ASC', $limit = 0, $page = 0) { + function getByCategory($sortfield = "p.ref", $sortorder = 'ASC', $limit = 0, $page = 0, $mode=0, $category=0, $to_sell='', $to_buy='') { global $db, $conf; $obj_ret = array(); @@ -209,7 +210,7 @@ class ProductApi extends DolibarrApi // Show product on sell if ($to_sell) $sql.= " AND p.to_sell = ".$db->escape($to_sell); // Show product on buy - if ($to_buy) $sql.= " AND p.to_nuy = ".$db->escape($to_nuy); + if ($to_buy) $sql.= " AND p.to_buy = ".$db->escape($to_buy); $nbtotalofrecords = 0; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) @@ -232,8 +233,9 @@ class ProductApi extends DolibarrApi $result = $db->query($sql); if ($result) { + $i=0; $num = $db->num_rows($result); - while ($i < $num) + while ($i < min($num, ($limit <= 0 ? $num : $limit))) { $obj = $db->fetch_object($result); $product_static = new Product($db); @@ -253,7 +255,7 @@ class ProductApi extends DolibarrApi } /** - * Create product object + * Create product object Warning: Deprecated * * @param array $request_data Request data * @return int ID of product @@ -281,7 +283,7 @@ class ProductApi extends DolibarrApi } /** - * Update product + * Update product Warning: Deprecated * * @param int $id Id of product to update * @param array $request_data Datas @@ -315,7 +317,7 @@ class ProductApi extends DolibarrApi } /** - * Delete product + * Delete product Warning: Deprecated * * @param int $id Product ID * @return array diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php new file mode 100644 index 00000000000..290d011d09c --- /dev/null +++ b/htdocs/product/class/api_products.class.php @@ -0,0 +1,287 @@ + + * + * 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 . + */ + + use Luracast\Restler\RestException; + + require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; + +/** + * API class for products + * + * @access protected + * @class DolibarrApiAccess {@requires user,external} + */ +class Products extends DolibarrApi +{ + /** + * @var array $FIELDS Mandatory fields, checked when create and update object + */ + static $FIELDS = array( + 'ref', + 'label' + ); + + /** + * @var Product $product {@type Product} + */ + public $product; + + /** + * Constructor + */ + function __construct() + { + global $db, $conf; + $this->db = $db; + $this->product = new Product($this->db); + } + + /** + * Get properties of a product object + * + * Return an array with product informations + * + * @param int $id ID of product + * @return array|mixed data without useless information + * + * @throws RestException + * TODO implement getting a product by ref or by $ref_ext + */ + function get($id) + { + if(! DolibarrApiAccess::$user->rights->produit->lire) { + throw new RestException(401); + } + + $result = $this->product->fetch($id); + if( ! $result ) { + throw new RestException(404, 'Product not found'); + } + + if( ! DolibarrApi::_checkAccessToResource('product',$this->product->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + + $this->product->load_stock(); + + return $this->_cleanObjectDatas($this->product); + } + + /** + * List products + * + * Get a list of products + * + * @param string $sortfield Sort field + * @param string $sortorder Sort order + * @param int $limit Limit for list + * @param int $page Page number + * @param int $mode Use this param to filter list (0 for all, 1 for only product, 2 for only service) + * @param int $category Use this param to filter list by category + * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.tobuy:=:0) and (t.tosell:=:1)" + * @return array Array of product objects + */ + function index($sortfield = "t.ref", $sortorder = 'ASC', $limit = 0, $page = 0, $mode=0, $category=0, $sqlfilters = '') { + global $db, $conf; + + $obj_ret = array(); + + $socid = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : ''; + + $sql = "SELECT t.rowid, t.ref, t.ref_ext"; + $sql.= " FROM ".MAIN_DB_PREFIX."product as t"; + if ($category > 0) + { + $sql.= ", ".MAIN_DB_PREFIX."categorie_product as c"; + } + $sql.= ' WHERE t.entity IN ('.getEntity('product', 1).')'; + // Select products of given category + if ($category > 0) + { + $sql.= " AND c.fk_categorie = ".$db->escape($category); + $sql.= " AND c.fk_product = t.rowid "; + } + // Show products + if ($mode == 1) $sql.= " AND t.fk_product_type = 0"; + // Show services + if ($mode == 2) $sql.= " AND t.fk_product_type = 1"; + // Add sql filters + if ($sqlfilters) + { + if (! DolibarrApi::_checkFilters($sqlfilters)) + { + throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); + } + $regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; + } + + $sql.= $db->order($sortfield, $sortorder); + if ($limit) { + if ($page < 0) + { + $page = 0; + } + $offset = $limit * $page; + + $sql.= $db->plimit($limit + 1, $offset); + } + + $result = $db->query($sql); + if ($result) + { + $num = $db->num_rows($result); + while ($i < min($num, ($limit <= 0 ? $num : $limit))) + { + $obj = $db->fetch_object($result); + $product_static = new Product($db); + if($product_static->fetch($obj->rowid)) { + $obj_ret[] = parent::_cleanObjectDatas($product_static); + } + $i++; + } + } + else { + throw new RestException(503, 'Error when retrieve product list'); + } + if( ! count($obj_ret)) { + throw new RestException(404, 'No product found'); + } + return $obj_ret; + } + + /** + * Create product object + * + * @param array $request_data Request data + * @return int ID of product + */ + function post($request_data = NULL) + { + if(! DolibarrApiAccess::$user->rights->produit->creer) { + throw new RestException(401); + } + // Check mandatory fields + $result = $this->_validate($request_data); + + foreach($request_data as $field => $value) { + $this->product->$field = $value; + } + $result = $this->product->create(DolibarrApiAccess::$user); + if($result < 0) { + throw new RestException(503,'Error when creating product : '.$this->product->error); + } + + return $this->product->id; + } + + /** + * Update product + * + * @param int $id Id of product to update + * @param array $request_data Datas + * @return int + */ + function put($id, $request_data = NULL) + { + if(! DolibarrApiAccess::$user->rights->produit->creer) { + throw new RestException(401); + } + + $result = $this->product->fetch($id); + if( ! $result ) { + throw new RestException(404, 'Product not found'); + } + + if( ! DolibarrApi::_checkAccessToResource('product',$this->product->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + + foreach($request_data as $field => $value) { + $this->product->$field = $value; + } + + if($this->product->update($id, DolibarrApiAccess::$user,1,'update')) + return $this->get ($id); + + return false; + } + + /** + * Delete product + * + * @param int $id Product ID + * @return array + */ + function delete($id) + { + if(! DolibarrApiAccess::$user->rights->produit->supprimer) { + throw new RestException(401); + } + $result = $this->product->fetch($id); + if( ! $result ) { + throw new RestException(404, 'Product not found'); + } + + if( ! DolibarrApi::_checkAccessToResource('product',$this->product->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + + // The Product::delete() method uses the global variable $user. + global $user; + $user = DolibarrApiAccess::$user; + + return $this->product->delete($id); + } + + /** + * Get categories for a product + * + * @param int $id ID of product + * @param string $sortfield Sort field + * @param string $sortorder Sort order + * @param int $limit Limit for list + * @param int $page Page number + * + * @return mixed + * + * @url GET {id}/categories + */ + function getCategories($id, $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0) { + $categories = new Categories(); + return $categories->getListForItem('product', $sortfield, $sortorder, $limit, $page, $id); + } + + /** + * Validate fields before create or update object + * + * @param array $data Datas to validate + * @return array + * @throws RestException + */ + function _validate($data) + { + $product = array(); + foreach (Products::$FIELDS as $field) { + if (!isset($data[$field])) + throw new RestException(400, "$field field missing"); + $product[$field] = $data[$field]; + } + return $product; + } +} diff --git a/htdocs/product/class/html.formproduct.class.php b/htdocs/product/class/html.formproduct.class.php index a69880f7fa5..8ae04e61c91 100644 --- a/htdocs/product/class/html.formproduct.class.php +++ b/htdocs/product/class/html.formproduct.class.php @@ -56,15 +56,18 @@ class FormProduct * @param string $batch Add quantity of batch stock in label for product with batch name batch, batch name precedes batch_id. Nothing if ''. * @param int $status additional filter on status other then 1 * @param boolean $sumStock sum total stock of a warehouse, default true + * @param array $exclude warehouses ids to exclude * @return int Nb of loaded lines, 0 if already loaded, <0 if KO */ - function loadWarehouses($fk_product=0, $batch = '', $status=null, $sumStock = true) + function loadWarehouses($fk_product=0, $batch = '', $status=null, $sumStock = true, $exclude='') { global $conf, $langs; if (empty($fk_product) && count($this->cache_warehouses)) return 0; // Cache already loaded and we do not want a list with information specific to a product - - $sql = "SELECT e.rowid, e.label, e.description"; + + if (is_array($exclude)) $excludeGroups = implode("','",$exclude); + + $sql = "SELECT e.rowid, e.label, e.description, e.fk_parent"; if (!empty($fk_product)) { if (!empty($batch)) @@ -100,7 +103,9 @@ class FormProduct $sql.= " AND e.statut = 1"; } - if ($sumStock && empty($fk_product)) $sql.= " GROUP BY e.rowid, e.label, e.description"; + if(!empty($exclude)) $sql.= ' AND e.rowid NOT IN('.implode(',', $exclude).')'; + + if ($sumStock && empty($fk_product)) $sql.= " GROUP BY e.rowid, e.label, e.description, e.fk_parent"; $sql.= " ORDER BY e.label"; dol_syslog(get_class($this).'::loadWarehouses', LOG_DEBUG); @@ -115,10 +120,17 @@ class FormProduct if ($sumStock) $obj->stock = price2num($obj->stock,5); $this->cache_warehouses[$obj->rowid]['id'] =$obj->rowid; $this->cache_warehouses[$obj->rowid]['label']=$obj->label; + $this->cache_warehouses[$obj->rowid]['parent_id']=$obj->fk_parent; $this->cache_warehouses[$obj->rowid]['description'] = $obj->description; $this->cache_warehouses[$obj->rowid]['stock'] = $obj->stock; $i++; } + + // Full label init + foreach($this->cache_warehouses as $obj_rowid=>$tab) { + $this->cache_warehouses[$obj_rowid]['full_label'] = $this->get_parent_path($tab); + } + return $num; } else @@ -127,6 +139,29 @@ class FormProduct return -1; } } + + /** + * Return full path to current warehouse in $tab (recursive function) + * + * @param array $tab warehouse data in $this->cache_warehouses line + * @param String $final_label full label with all parents, separated by ' >> ' (completed on each call) + * @return String full label with all parents, separated by ' >> ' + */ + private function get_parent_path($tab, $final_label='') { + + if(empty($final_label)) $final_label = $tab['label']; + + if(empty($tab['parent_id'])) return $final_label; + else { + if(!empty($this->cache_warehouses[$tab['parent_id']])) { + $final_label = $this->cache_warehouses[$tab['parent_id']]['label'].' >> '.$final_label; + return $this->get_parent_path($this->cache_warehouses[$tab['parent_id']], $final_label); + } + } + + return $final_label; + + } /** * Return list of warehouses @@ -142,9 +177,10 @@ class FormProduct * @param int $forcecombo force combo iso ajax select2 * @param array $events events to add to select2 * @param string $morecss Add more css classes + * @param array $exclude warehouses ids to exclude * @return string HTML select */ - function selectWarehouses($selected='',$htmlname='idwarehouse',$filtertype='',$empty=0,$disabled=0,$fk_product=0,$empty_label='', $showstock=0, $forcecombo=0, $events=array(), $morecss='') + function selectWarehouses($selected='',$htmlname='idwarehouse',$filtertype='',$empty=0,$disabled=0,$fk_product=0,$empty_label='', $showstock=0, $forcecombo=0, $events=array(), $morecss='minwidth200', $exclude='') { global $conf,$langs,$user; @@ -152,7 +188,7 @@ class FormProduct $out=''; - $this->loadWarehouses($fk_product, '', + $filtertype); // filter on numeric status + $this->loadWarehouses($fk_product, '', + $filtertype, true, $exclude); // filter on numeric status $nbofwarehouses=count($this->cache_warehouses); if ($conf->use_javascript_ajax && ! $forcecombo) @@ -170,7 +206,7 @@ class FormProduct $out.=''; } diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 982b109da99..eb5c2a2d75d 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -195,6 +195,8 @@ class Product extends CommonObject var $buyprice; public $fourn_pu; + public $fourn_price_base_type; + /** * @deprecated * @see ref_supplier @@ -926,7 +928,7 @@ class Product extends CommonObject // Delete all child tables if (! $error) { - $elements = array('product_fournisseur_price','product_price','product_lang','categorie_product','product_stock','product_customer_price'); + $elements = array('product_fournisseur_price','product_price','product_lang','categorie_product','product_stock','product_customer_price','product_lot','product_warehouse_properties'); foreach($elements as $table) { if (! $error) @@ -1014,13 +1016,12 @@ class Product extends CommonObject /** * Update or add a translation for a product * - * @param User $user Object user making update - * - * @return int <0 if KO, >0 if OK + * @param User $user Object user making update + * @return int <0 if KO, >0 if OK */ function setMultiLangs($user) { - global $langs; + global $conf, $langs; $langs_available = $langs->get_available_languages(DOL_DOCUMENT_ROOT, 0, 2); $current_lang = $langs->getDefaultLang(); @@ -1039,17 +1040,21 @@ class Product extends CommonObject if ($this->db->num_rows($result)) // if there is already a description line for this language { $sql2 = "UPDATE ".MAIN_DB_PREFIX."product_lang"; - $sql2.= " SET label='".$this->db->escape($this->label)."',"; - $sql2.= " description='".$this->db->escape($this->description)."',"; - $sql2.= " note='".$this->db->escape($this->note)."'"; + $sql2.= " SET "; + $sql2.= " label='".$this->db->escape($this->label)."',"; + $sql2.= " description='".$this->db->escape($this->description)."'"; + if (! empty($conf->global->PRODUCT_USE_OTHER_FIELD_IN_TRANSLATION)) $sql2.= ", note='".$this->db->escape($this->note)."'"; $sql2.= " WHERE fk_product=".$this->id." AND lang='".$key."'"; } else { - $sql2 = "INSERT INTO ".MAIN_DB_PREFIX."product_lang (fk_product, lang, label, description, note)"; - $sql2.= " VALUES(".$this->id.",'".$key."','". $this->db->escape($this->label); - $sql2.= "','".$this->db->escape($this->description); - $sql2.= "','".$this->db->escape($this->note)."')"; + $sql2 = "INSERT INTO ".MAIN_DB_PREFIX."product_lang (fk_product, lang, label, description"; + if (! empty($conf->global->PRODUCT_USE_OTHER_FIELD_IN_TRANSLATION)) $sql2.=", note"; + $sql2.= ")"; + $sql2.= " VALUES(".$this->id.",'".$key."','". $this->db->escape($this->label)."',"; + $sql2.= " '".$this->db->escape($this->description)."'"; + if (! empty($conf->global->PRODUCT_USE_OTHER_FIELD_IN_TRANSLATION)) $sql2.= ", '".$this->db->escape($this->note)."'"; + $sql2.= ")"; } dol_syslog(get_class($this).'::setMultiLangs key = current_lang = '.$key); if (! $this->db->query($sql2)) @@ -1070,26 +1075,31 @@ class Product extends CommonObject if ($this->db->num_rows($result)) // if there is already a description line for this language { $sql2 = "UPDATE ".MAIN_DB_PREFIX."product_lang"; - $sql2.= " SET label='".$this->db->escape($this->multilangs["$key"]["label"])."',"; - $sql2.= " description='".$this->db->escape($this->multilangs["$key"]["description"])."',"; - $sql2.= " note='".$this->db->escape($this->multilangs["$key"]["note"])."'"; + $sql2.= " SET "; + $sql2.= " label='".$this->db->escape($this->multilangs["$key"]["label"])."',"; + $sql2.= " description='".$this->db->escape($this->multilangs["$key"]["description"])."'"; + if (! empty($conf->global->PRODUCT_USE_OTHER_FIELD_IN_TRANSLATION)) $sql2.= ", note='".$this->db->escape($this->multilangs["$key"]["note"])."'"; $sql2.= " WHERE fk_product=".$this->id." AND lang='".$key."'"; } else { - $sql2 = "INSERT INTO ".MAIN_DB_PREFIX."product_lang (fk_product, lang, label, description, note)"; - $sql2.= " VALUES(".$this->id.",'".$key."','". $this->db->escape($this->multilangs["$key"]["label"]); - $sql2.= "','".$this->db->escape($this->multilangs["$key"]["description"]); - $sql2.= "','".$this->db->escape($this->multilangs["$key"]["note"])."')"; + $sql2 = "INSERT INTO ".MAIN_DB_PREFIX."product_lang (fk_product, lang, label, description"; + if (! empty($conf->global->PRODUCT_USE_OTHER_FIELD_IN_TRANSLATION)) $sql2.=", note"; + $sql2.= ")"; + $sql2.= " VALUES(".$this->id.",'".$key."','". $this->db->escape($this->multilangs["$key"]["label"])."',"; + $sql2.= " '".$this->db->escape($this->multilangs["$key"]["description"])."'"; + if (! empty($conf->global->PRODUCT_USE_OTHER_FIELD_IN_TRANSLATION)) $sql2.= ", '".$this->db->escape($this->note)."'"; + $sql2.= ")"; } - // on ne sauvegarde pas des champs vides - if ( $this->multilangs["$key"]["label"] || $this->multilangs["$key"]["description"] || $this->multilangs["$key"]["note"] ) - dol_syslog(get_class($this).'::setMultiLangs key = '.$key); - if (! $this->db->query($sql2)) + // We do not save if main fields are empty + if ($this->multilangs["$key"]["label"] || $this->multilangs["$key"]["description"]) { - $this->error=$this->db->lasterror(); - return -1; + if (! $this->db->query($sql2)) + { + $this->error=$this->db->lasterror(); + return -1; + } } } else @@ -1211,7 +1221,7 @@ class Product extends CommonObject $current_lang = $langs->getDefaultLang(); - $sql = "SELECT lang, label, description, note"; + $sql = "SELECT lang, label, description, note as other"; $sql.= " FROM ".MAIN_DB_PREFIX."product_lang"; $sql.= " WHERE fk_product=".$this->id; @@ -1225,12 +1235,11 @@ class Product extends CommonObject { $this->label = $obj->label; $this->description = $obj->description; - $this->note = $obj->note; - + $this->other = $obj->other; } $this->multilangs["$obj->lang"]["label"] = $obj->label; $this->multilangs["$obj->lang"]["description"] = $obj->description; - $this->multilangs["$obj->lang"]["note"] = $obj->note; + $this->multilangs["$obj->lang"]["other"] = $obj->other; } return 1; } @@ -1309,16 +1318,17 @@ class Product extends CommonObject /** - * Read price used by a provider - * We enter as input couple prodfournprice/qty or triplet qty/product_id/fourn_ref + * Read price used by a provider. + * We enter as input couple prodfournprice/qty or triplet qty/product_id/fourn_ref. + * This also set some properties on product like ->buyprice, ->fourn_pu, ... * * @param int $prodfournprice Id du tarif = rowid table product_fournisseur_price - * @param double $qty Quantity asked + * @param double $qty Quantity asked or -1 to get first entry found * @param int $product_id Filter on a particular product id - * @param string $fourn_ref Filter on a supplier ref + * @param string $fourn_ref Filter on a supplier ref. 'none' to exclude ref in search. * @return int <-1 if KO, -1 if qty not enough, 0 if OK but nothing found, id_product if OK and found. May also initialize some properties like (->ref_supplier, buyprice, fourn_pu, vatrate_supplier...) */ - function get_buyprice($prodfournprice,$qty,$product_id=0,$fourn_ref=0) + function get_buyprice($prodfournprice, $qty, $product_id=0, $fourn_ref='') { global $conf; $result = 0; @@ -1328,14 +1338,15 @@ class Product extends CommonObject $sql.= " pfp.fk_product, pfp.ref_fourn, pfp.fk_soc, pfp.tva_tx, pfp.fk_supplier_price_expression"; $sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp"; $sql.= " WHERE pfp.rowid = ".$prodfournprice; - if ($qty) $sql.= " AND pfp.quantity <= ".$qty; - + if ($qty > 0) $sql.= " AND pfp.quantity <= ".$qty; + $sql.= " ORDER BY pfp.quantity DESC"; + dol_syslog(get_class($this)."::get_buyprice first search by prodfournprice/qty", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { $obj = $this->db->fetch_object($resql); - if ($obj && $obj->quantity > 0) // If found + if ($obj && $obj->quantity > 0) // If we found a supplier prices from the id of supplier price { if (!empty($conf->dynamicprices->enabled) && !empty($obj->fk_supplier_price_expression)) { @@ -1353,7 +1364,8 @@ class Product extends CommonObject } } $this->buyprice = $obj->price; // deprecated - $this->fourn_pu = $obj->price / $obj->quantity; // Prix unitaire du produit pour le fournisseur $fourn_id + $this->fourn_pu = $obj->price / $obj->quantity; // Unit price of product of supplier + $this->fourn_price_base_type = 'HT'; // Price base type $this->ref_fourn = $obj->ref_fourn; // deprecated $this->ref_supplier = $obj->ref_fourn; // Ref supplier $this->vatrate_supplier = $obj->tva_tx; // Vat ref supplier @@ -1362,13 +1374,13 @@ class Product extends CommonObject } else // If not found { - // We do a second search by doing a select again but searching with qty, ref and id product + // We do a second search by doing a select again but searching with qty and id product $sql = "SELECT pfp.rowid, pfp.price as price, pfp.quantity as quantity, pfp.fk_soc,"; $sql.= " pfp.fk_product, pfp.ref_fourn as ref_supplier, pfp.tva_tx, pfp.fk_supplier_price_expression"; $sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp"; - $sql.= " WHERE pfp.ref_fourn = '".$fourn_ref."'"; - $sql.= " AND pfp.fk_product = ".$product_id; - $sql.= " AND pfp.quantity <= ".$qty; + $sql.= " WHERE pfp.fk_product = ".$product_id; + if ($fourn_ref != 'none') $sql.= " AND pfp.ref_fourn = '".$fourn_ref."'"; + if ($qty > 0) $sql.= " AND pfp.quantity <= ".$qty; $sql.= " ORDER BY pfp.quantity DESC"; $sql.= " LIMIT 1"; @@ -1395,8 +1407,9 @@ class Product extends CommonObject } } $this->buyprice = $obj->price; // deprecated - $this->fourn_qty = $obj->quantity; // min quantity for price - $this->fourn_pu = $obj->price / $obj->quantity; // Prix unitaire du produit pour le fournisseur $fourn_id + $this->fourn_qty = $obj->quantity; // min quantity for price for a virtual supplier + $this->fourn_pu = $obj->price / $obj->quantity; // Unit price of product for a virtual supplier + $this->fourn_price_base_type = 'HT'; // Price base type for a virtual supplier $this->ref_fourn = $obj->ref_supplier; // deprecated $this->ref_supplier = $obj->ref_supplier; // Ref supplier $this->vatrate_supplier = $obj->tva_tx; // Vat ref supplier @@ -1405,7 +1418,7 @@ class Product extends CommonObject } else { - return -1; // Ce produit n'existe pas avec cette ref fournisseur ou existe mais qte insuffisante + return -1; // Ce produit n'existe pas avec cet id tarif fournisseur ou existe mais qte insuffisante, ni pour le couple produit/ref fournisseur dans la quantité. } } else @@ -1640,7 +1653,7 @@ class Product extends CommonObject return -1; } - $sql = "SELECT rowid, ref, ref_ext, label, description, url, note, customcode, fk_country, price, price_ttc,"; + $sql = "SELECT rowid, ref, ref_ext, label, description, url, note as note_private, customcode, fk_country, price, price_ttc,"; $sql.= " price_min, price_min_ttc, price_base_type, cost_price, default_vat_code, tva_tx, recuperableonly as tva_npr, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type, tosell,"; $sql.= " tobuy, fk_product_type, duration, seuil_stock_alerte, canvas,"; $sql.= " weight, weight_units, length, length_units, surface, surface_units, volume, volume_units, barcode, fk_barcode_type, finished,"; @@ -1669,8 +1682,9 @@ class Product extends CommonObject $this->label = $obj->label; $this->description = $obj->description; $this->url = $obj->url; - $this->note = $obj->note; - + $this->note_private = $obj->note_private; + $this->note = $obj->note_private; // deprecated + $this->type = $obj->fk_product_type; $this->status = $obj->tosell; $this->status_buy = $obj->tobuy; @@ -1739,7 +1753,6 @@ class Product extends CommonObject $extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true); $this->fetch_optionals($this->id,$extralabels); - // multilangs if (! empty($conf->global->MAIN_MULTILANGS)) $this->getMultiLangs(); @@ -3132,7 +3145,7 @@ class Product extends CommonObject */ function getNomUrl($withpicto=0,$option='',$maxlength=0) { - global $conf, $langs; + global $conf, $langs, $hookmanager; include_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; $result=''; @@ -3146,10 +3159,10 @@ class Product extends CommonObject $label .= '
' . $langs->trans('ProductLabel') . ': ' . $this->label; $tmptext=''; - if ($this->weight) $tmptext.="
".$langs->trans("Weight").': '.$this->weight.' '.measuring_units_string($this->weight_units,"weight"); - if ($this->length) $tmptext.="
".$langs->trans("Length").': '.$this->length.' '.measuring_units_string($this->length_units,'length'); + if ($this->weight) $tmptext.="
".$langs->trans("Weight").': '.$this->weight.' '.measuring_units_string($this->weight_units,"weight"); + if ($this->length) $tmptext.="
".$langs->trans("Length").': '.$this->length.' '.measuring_units_string($this->length_units,'length'); if ($this->surface) $tmptext.="
".$langs->trans("Surface").': '.$this->surface.' '.measuring_units_string($this->surface_units,'surface'); - if ($this->volume) $tmptext.="
".$langs->trans("Volume").': '.$this->volume.' '.measuring_units_string($this->volume_units,'volume'); + if ($this->volume) $tmptext.="
".$langs->trans("Volume").': '.$this->volume.' '.measuring_units_string($this->volume_units,'volume'); if ($tmptext) $label .= $tmptext; if (! empty($this->entity)) @@ -3157,7 +3170,18 @@ class Product extends CommonObject $linkclose = '" title="'.str_replace('\n', '', dol_escape_htmltag($label, 1)).'" class="classfortooltip">'; - if ($option == 'supplier') { + if (! is_object($hookmanager)) + { + include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; + $hookmanager=new HookManager($this->db); + } + $hookmanager->initHooks(array('productdao')); + $parameters=array('id'=>$this->id); + $reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks + if ($reshook > 0) $linkclose = $hookmanager->resPrint; + + + if ($option == 'supplier' || $option == 'category') { $link = ''; - } else if ($option == 'category') { - $link = ''; } if ($withpicto) { - if ($this->type == Product::TYPE_PRODUCT) $result.=($link.img_object($langs->trans("ShowProduct").' '.$this->label, 'product', 'class="classfortooltip"').$linkend.' '); - if ($this->type == Product::TYPE_SERVICE) $result.=($link.img_object($langs->trans("ShowService").' '.$this->label, 'service', 'class="classfortooltip"').$linkend.' '); + if ($this->type == Product::TYPE_PRODUCT) $result.=($link.img_object('', 'product', '').$linkend.' '); + if ($this->type == Product::TYPE_SERVICE) $result.=($link.img_object('', 'service', '').$linkend.' '); } $result.=$link.$newref.$linkend; return $result; @@ -3258,23 +3280,23 @@ class Product extends CommonObject } if ($mode == 2) { - if ($status == 0) return img_picto($langs->trans('ProductStatusNotOnSell'),'statut5').' '.($type==0 ? $langs->trans('ProductStatusNotOnSellShort'):$langs->trans('ProductStatusNotOnBuyShort')); - if ($status == 1) return img_picto($langs->trans('ProductStatusOnSell'),'statut4').' '.($type==0 ? $langs->trans('ProductStatusOnSellShort'):$langs->trans('ProductStatusOnBuyShort')); + if ($status == 0) return img_picto($langs->trans('ProductStatusNotOnSell'),'statut5', 'class="pictostatus"').' '.($type==0 ? $langs->trans('ProductStatusNotOnSellShort'):$langs->trans('ProductStatusNotOnBuyShort')); + if ($status == 1) return img_picto($langs->trans('ProductStatusOnSell'),'statut4', 'class="pictostatus"').' '.($type==0 ? $langs->trans('ProductStatusOnSellShort'):$langs->trans('ProductStatusOnBuyShort')); } if ($mode == 3) { - if ($status == 0) return img_picto(($type==0 ? $langs->trans('ProductStatusNotOnSell') : $langs->trans('ProductStatusNotOnBuy')),'statut5'); - if ($status == 1) return img_picto(($type==0 ? $langs->trans('ProductStatusOnSell') : $langs->trans('ProductStatusOnBuy')),'statut4'); + if ($status == 0) return img_picto(($type==0 ? $langs->trans('ProductStatusNotOnSell') : $langs->trans('ProductStatusNotOnBuy')),'statut5', 'class="pictostatus"'); + if ($status == 1) return img_picto(($type==0 ? $langs->trans('ProductStatusOnSell') : $langs->trans('ProductStatusOnBuy')),'statut4', 'class="pictostatus"'); } if ($mode == 4) { - if ($status == 0) return img_picto($langs->trans('ProductStatusNotOnSell'),'statut5').' '.($type==0 ? $langs->trans('ProductStatusNotOnSell'):$langs->trans('ProductStatusNotOnBuy')); - if ($status == 1) return img_picto($langs->trans('ProductStatusOnSell'),'statut4').' '.($type==0 ? $langs->trans('ProductStatusOnSell'):$langs->trans('ProductStatusOnBuy')); + if ($status == 0) return img_picto($langs->trans('ProductStatusNotOnSell'),'statut5', 'class="pictostatus"').' '.($type==0 ? $langs->trans('ProductStatusNotOnSell'):$langs->trans('ProductStatusNotOnBuy')); + if ($status == 1) return img_picto($langs->trans('ProductStatusOnSell'),'statut4', 'class="pictostatus"').' '.($type==0 ? $langs->trans('ProductStatusOnSell'):$langs->trans('ProductStatusOnBuy')); } if ($mode == 5) { - if ($status == 0) return ($type==0 ? $langs->trans('ProductStatusNotOnSellShort'):$langs->trans('ProductStatusNotOnBuyShort')).' '.img_picto(($type==0 ? $langs->trans('ProductStatusNotOnSell'):$langs->trans('ProductStatusNotOnBuy')),'statut5'); - if ($status == 1) return ($type==0 ? $langs->trans('ProductStatusOnSellShort'):$langs->trans('ProductStatusOnBuyShort')).' '.img_picto(($type==0 ? $langs->trans('ProductStatusOnSell'):$langs->trans('ProductStatusOnBuy')),'statut4'); + if ($status == 0) return ($type==0 ? $langs->trans('ProductStatusNotOnSellShort'):$langs->trans('ProductStatusNotOnBuyShort')).' '.img_picto(($type==0 ? $langs->trans('ProductStatusNotOnSell'):$langs->trans('ProductStatusNotOnBuy')), 'statut5', 'class="pictostatus"'); + if ($status == 1) return ($type==0 ? $langs->trans('ProductStatusOnSellShort'):$langs->trans('ProductStatusOnBuyShort')).' '.img_picto(($type==0 ? $langs->trans('ProductStatusOnSell'):$langs->trans('ProductStatusOnBuy')),'statut4', 'class="pictostatus"'); } return $langs->trans('Unknown'); } @@ -3676,7 +3698,7 @@ class Product extends CommonObject if ($size == 1 || $size == 'small') { // Format vignette // Find name of thumb file - $photo_vignette=basename(getImageFileNameForSize($dir.$file, '_small', '.png')); + $photo_vignette=basename(getImageFileNameForSize($dir.$file, '_small')); if (! dol_is_file($dirthumb.$photo_vignette)) $photo_vignette=''; // Get filesize of original file @@ -3692,21 +3714,28 @@ class Product extends CommonObject else if ($nbbyrow < 0) $return .= '
'; $return.= "\n"; - if (empty($nolink)) $return.= ''; + + $relativefile=preg_replace('/^\//', '', $pdir.$photo); + if (empty($nolink)) + { + $urladvanced=getAdvancedPreviewUrl('product', $relativefile); + if ($urladvanced) $return.=''; + else $return.= ''; + } // Show image (width height=$maxHeight) // Si fichier vignette disponible et image source trop grande, on utilise la vignette, sinon on utilise photo origine - $alt=$langs->transnoentitiesnoconv('File').': '.$pdir.$photo; + $alt=$langs->transnoentitiesnoconv('File').': '.$relativefile; $alt.=' - '.$langs->transnoentitiesnoconv('Size').': '.$imgarray['width'].'x'.$imgarray['height']; if (empty($maxHeight) || $photo_vignette && $imgarray['height'] > $maxHeight) { $return.= ''; - $return.= 'dol_use_jmobile?'max-height':'height').'="'.$maxHeight.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&entity='.$this->entity.'&file='.urlencode($pdirthumb.$photo_vignette).'" title="'.dol_escape_htmltag($alt).'">'; + $return.= ''; } else { $return.= ''; - $return.= 'dol_use_jmobile?'max-height':'height').'="'.$maxHeight.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&entity='.$this->entity.'&file='.urlencode($pdir.$photo).'" title="'.dol_escape_htmltag($alt).'">'; + $return.= ''; } if (empty($nolink)) $return.= ''; diff --git a/htdocs/product/class/productbatch.class.php b/htdocs/product/class/productbatch.class.php index ed03c3e729e..5ab70506693 100644 --- a/htdocs/product/class/productbatch.class.php +++ b/htdocs/product/class/productbatch.class.php @@ -494,11 +494,13 @@ class Productbatch extends CommonObject if ($fk_product > 0) { $sql.= ", pl.eatby as eatby, pl.sellby as sellby"; + // TODO May add extrafields to ? } $sql.= " FROM ".MAIN_DB_PREFIX."product_batch as t"; if ($fk_product > 0) { $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_lot as pl ON pl.fk_product = ".$fk_product." AND pl.batch = t.batch"; + // TODO May add extrafields to ? } $sql.= " WHERE fk_product_stock=".$fk_product_stock; if ($with_qty) $sql.= " AND t.qty <> 0"; @@ -523,7 +525,7 @@ class Productbatch extends CommonObject $tmp->qty = $obj->qty; $tmp->import_key = $obj->import_key; - array_push($ret,$tmp); + $ret[$tmp->batch] = $tmp; // $ret is for a $fk_product_stock and unique key is on $fk_product_stock+batch $i++; } $db->free($resql); diff --git a/htdocs/product/composition/card.php b/htdocs/product/composition/card.php index 15e44f8602d..230a3dbee23 100644 --- a/htdocs/product/composition/card.php +++ b/htdocs/product/composition/card.php @@ -173,10 +173,22 @@ if ($action == 'search') $resql = $db->query($sql); } -//print $sql; +$title = $langs->trans('ProductServiceCard'); +$helpurl = ''; +$shortlabel = dol_trunc($object->label,16); +if (GETPOST("type") == '0' || ($object->type == Product::TYPE_PRODUCT)) +{ + $title = $langs->trans('Product')." ". $shortlabel ." - ".$langs->trans('AssociatedProducts'); + $helpurl='EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos'; +} +if (GETPOST("type") == '1' || ($object->type == Product::TYPE_SERVICE)) +{ + $title = $langs->trans('Service')." ". $shortlabel ." - ".$langs->trans('AssociatedProducts'); + $helpurl='EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios'; +} -llxHeader("","",$langs->trans("CardProduct".$object->type)); +llxHeader('', $title, $helpurl); $head=product_prepare_head($object); $titre=$langs->trans("CardProduct".$object->type); @@ -193,14 +205,18 @@ if ($id > 0 || ! empty($ref)) { $linkback = ''.$langs->trans("BackToList").''; - dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref'); + dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref', '', '', '', 0, '', '', 1); - print ''; - + if ($object->type!=Product::TYPE_SERVICE || empty($conf->global->PRODUIT_MULTIPRICES)) + { + print '
'; + print '
'; + } + // Nature - if($object->type!=Product::TYPE_SERVICE) + if ($object->type!=Product::TYPE_SERVICE) { - print ''; } @@ -232,11 +248,15 @@ if ($id > 0 || ! empty($ref)) print ''; } - print '
'.$langs->trans("Nature").''; + print '
'.$langs->trans("Nature").''; print $object->getLibFinished(); print '
'; + if ($object->type!=Product::TYPE_SERVICE || empty($conf->global->PRODUIT_MULTIPRICES)) + { + print ''; + } dol_fiche_end(); - + print '
'; + $prodsfather = $object->getFather(); // Parent Products $object->get_sousproduits_arbo(); // Load $object->sousprods $prods_arbo=$object->get_arbo_each_prod(); diff --git a/htdocs/product/document.php b/htdocs/product/document.php index 97925bff99c..2e241d9c156 100644 --- a/htdocs/product/document.php +++ b/htdocs/product/document.php @@ -110,7 +110,7 @@ if (empty($reshook)) } } - // Action sending file + // Action submit/delete file/link include_once DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php'; } @@ -166,7 +166,21 @@ if ($action=='filemerge') $form = new Form($db); -llxHeader("","",$langs->trans("CardProduct".$object->type)); +$title = $langs->trans('ProductServiceCard'); +$helpurl = ''; +$shortlabel = dol_trunc($object->label,16); +if (GETPOST("type") == '0' || ($object->type == Product::TYPE_PRODUCT)) +{ + $title = $langs->trans('Product')." ". $shortlabel ." - ".$langs->trans('Documents'); + $helpurl='EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos'; +} +if (GETPOST("type") == '1' || ($object->type == Product::TYPE_SERVICE)) +{ + $title = $langs->trans('Service')." ". $shortlabel ." - ".$langs->trans('Documents'); + $helpurl='EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios'; +} + +llxHeader('', $title, $helpurl); if ($object->id) @@ -217,6 +231,7 @@ if ($object->id) $param = '&id=' . $object->id; include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php'; + // Merge propal PDF document PDF files if (!empty($conf->global->PRODUIT_PDF_MERGE_PROPAL)) { diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index c51bf7fae01..05d70e7eb26 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -274,15 +274,26 @@ if (empty($reshook)) * view */ +$title = $langs->trans('ProductServiceCard'); +$helpurl = ''; +$shortlabel = dol_trunc($object->label,16); +if (GETPOST("type") == '0' || ($object->type == Product::TYPE_PRODUCT)) +{ + $title = $langs->trans('Product')." ". $shortlabel ." - ".$langs->trans('BuyingPrices'); + $helpurl='EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos'; +} +if (GETPOST("type") == '1' || ($object->type == Product::TYPE_SERVICE)) +{ + $title = $langs->trans('Service')." ". $shortlabel ." - ".$langs->trans('BuyingPrices'); + $helpurl='EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios'; +} + +llxHeader('', $title, $helpurl); + $form = new Form($db); if ($id > 0 || $ref) { - if ($action <> 're-edit') - { - llxHeader("","",$langs->trans("CardProduct".$object->type)); - } - if ($result) { if ($action == 'ask_remove_pf') { @@ -361,7 +372,7 @@ if ($id > 0 || $ref) print ''; // Supplier - print ''; print ''; - print ''; + print ''; if ($i == 0) print ''; print ''; $i++; @@ -347,7 +349,7 @@ else // TODO Move this into a page that should be available into menu "accountancy - report - turnover - per quarter" // Also method used for counting must provide the 2 possible methods like done by all other reports into menu "accountancy - report - turnover": // "commitment engagment" method and "cash accounting" method -if ($conf->global->MAIN_FEATURES_LEVEL) +if (! empty($conf->global->MAIN_SHOW_PRODUCT_ACTIVITY_TRIM)) { if (! empty($conf->product->enabled)) activitytrim(0); if (! empty($conf->service->enabled)) activitytrim(1); @@ -377,14 +379,13 @@ function activitytrim($product_type) // breakdown by quarter $sql = "SELECT DATE_FORMAT(p.datep,'%Y') as annee, DATE_FORMAT(p.datep,'%m') as mois, SUM(fd.total_ht) as Mnttot"; - $sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."facturedet as fd"; + $sql.= " FROM ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."facturedet as fd"; $sql.= " , ".MAIN_DB_PREFIX."paiement as p,".MAIN_DB_PREFIX."paiement_facture as pf"; - $sql.= " WHERE f.fk_soc = s.rowid"; + $sql.= " WHERE f.entity = " . $conf->entity; $sql.= " AND f.rowid = fd.fk_facture"; $sql.= " AND pf.fk_facture = f.rowid"; $sql.= " AND pf.fk_paiement= p.rowid"; $sql.= " AND fd.product_type=".$product_type; - $sql.= " AND s.entity IN (".getEntity('societe', 1).")"; $sql.= " AND p.datep >= '".$db->idate(dol_get_first_day($yearofbegindate),1)."'"; $sql.= " GROUP BY annee, mois "; $sql.= " ORDER BY annee, mois "; diff --git a/htdocs/product/info.php b/htdocs/product/info.php index 51510b518a6..e29d1a168cb 100644 --- a/htdocs/product/info.php +++ b/htdocs/product/info.php @@ -56,13 +56,23 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e * View */ -$form=new Form($b); +$title = $langs->trans('ProductServiceCard'); +$helpurl = ''; +$shortlabel = dol_trunc($object->label,16); +if (GETPOST("type") == '0' || ($object->type == Product::TYPE_PRODUCT)) +{ + $title = $langs->trans('Product')." ". $shortlabel ." - ".$langs->trans('Info'); + $helpurl='EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos'; +} +if (GETPOST("type") == '1' || ($object->type == Product::TYPE_SERVICE)) +{ + $title = $langs->trans('Service')." ". $shortlabel ." - ".$langs->trans('Info'); + $helpurl='EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios'; +} -$title=$langs->trans("Product"); -$helpurl=''; -if (GETPOST("type") == '0' || ($object->type == Product::TYPE_PRODUCT)) $helpurl='EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos'; -if (GETPOST("type") == '1' || ($object->type == Product::TYPE_SERVICE)) $helpurl='EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios'; -llxHeader('',$title,$help_url); +llxHeader('', $title, $helpurl); + +$form=new Form($b); if ($id > 0 || $ref) { diff --git a/htdocs/product/list.php b/htdocs/product/list.php index c95156b4393..fa0f18f538c 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -177,7 +177,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers { $sall=""; $sref=""; @@ -335,23 +335,23 @@ else } $param=''; - if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; - if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; - if ($search_categ > 0) $param.="&search_categ=".$search_categ; - if ($sref) $param="&sref=".$sref; - if ($search_ref_supplier) $param="&search_ref_supplier=".$search_ref_supplier; - if ($sbarcode) $param.=($sbarcode?"&sbarcode=".$sbarcode:""); - if ($snom) $param.="&snom=".$snom; - if ($sall) $param.="&sall=".$sall; - if ($tosell != '') $param.="&tosell=".$tosell; - if ($tobuy != '') $param.="&tobuy=".$tobuy; - if ($fourn_id) $param.=($fourn_id?"&fourn_id=".$fourn_id:""); - if ($seach_categ) $param.=($search_categ?"&search_categ=".$search_categ:""); + if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); + if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); + if ($search_categ > 0) $param.="&search_categ=".urlencode($search_categ); + if ($sref) $param="&sref=".urlencode($sref); + if ($search_ref_supplier) $param="&search_ref_supplier=".urlencode($search_ref_supplier); + if ($sbarcode) $param.=($sbarcode?"&sbarcode=".urlencode($sbarcode):""); + if ($snom) $param.="&snom=".urlencode($snom); + if ($sall) $param.="&sall=".urlencode($sall); + if ($tosell != '') $param.="&tosell=".urlencode($tosell); + if ($tobuy != '') $param.="&tobuy=".urlencode($tobuy); + if ($fourn_id > 0) $param.=($fourn_id?"&fourn_id=".$fourn_id:""); + if ($seach_categ) $param.=($search_categ?"&search_categ=".urlencode($search_categ):""); if ($type != '') $param.='&type='.urlencode($type); - if ($optioncss != '') $param.='&optioncss='.$optioncss; - if ($search_tobatch) $param="&search_ref_supplier=".$search_ref_supplier; - if ($search_accountancy_code_sell) $param="&search_accountancy_code_sell=".$search_accountancy_code_sell; - if ($search_accountancy_code_buy) $param="&search_accountancy_code_buy=".$search_accountancy_code_buy; + if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); + if ($search_tobatch) $param="&search_ref_supplier=".urlencode($search_ref_supplier); + if ($search_accountancy_code_sell) $param="&search_accountancy_code_sell=".urlencode($search_accountancy_code_sell); + if ($search_accountancy_code_buy) $param="&search_accountancy_code_buy=".urlencode($search_accountancy_code_buy); // Add $param from extra fields foreach ($search_array_options as $key => $val) { diff --git a/htdocs/product/note.php b/htdocs/product/note.php new file mode 100644 index 00000000000..9a914527a83 --- /dev/null +++ b/htdocs/product/note.php @@ -0,0 +1,115 @@ + + * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2010 Juanjo Menent + * Copyright (C) 2013 Florian Henry + * Copyright (C) 2015 Marcos García + * + * 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 . + */ + +/** + * \file htdocs/product/note.php + * \brief Tab for notes on products + * \ingroup societe + */ + +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; + +$langs->load("companies"); + +$id = GETPOST('id', 'int'); +$ref = GETPOST('ref', 'alpha'); +$action = GETPOST('action'); + +// Security check +$fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref : '')); +$fieldtype = (! empty($ref) ? 'ref' : 'rowid'); +if ($user->societe_id) $socid=$user->societe_id; +$result=restrictedArea($user,'produit|service',$fieldvalue,'product&product','','',$fieldtype); + +$object = new Product($db); +if ($id > 0 || ! empty($ref)) $object->fetch($id, $ref); + +$permissionnote=$user->rights->produit->creer; // Used by the include of actions_setnotes.inc.php + + +/* + * Actions + */ + +include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not includ_once + + +/* + * View + */ + +$form = new Form($db); + +$helpurl=''; +if (GETPOST("type") == '0' || ($object->type == Product::TYPE_PRODUCT)) $helpurl='EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos'; +if (GETPOST("type") == '1' || ($object->type == Product::TYPE_SERVICE)) $helpurl='EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios'; + +$title = $langs->trans('ProductServiceCard'); +$shortlabel = dol_trunc($object->label,16); +if (GETPOST("type") == '0' || ($object->type == Product::TYPE_PRODUCT)) +{ + $title = $langs->trans('Product')." ". $shortlabel ." - ".$langs->trans('Notes'); + $helpurl='EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos'; +} +if (GETPOST("type") == '1' || ($object->type == Product::TYPE_SERVICE)) +{ + $title = $langs->trans('Service')." ". $shortlabel ." - ".$langs->trans('Notes'); + $helpurl='EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios'; +} + +llxHeader('', $title, $help_url); + +if ($id > 0 || ! empty($ref)) +{ + /* + * Affichage onglets + */ + if (! empty($conf->notification->enabled)) $langs->load("mails"); + + $head = product_prepare_head($object); + $titre=$langs->trans("CardProduct".$object->type); + $picto=($object->type==Product::TYPE_SERVICE?'service':'product'); + + dol_fiche_head($head, 'note', $titre, 0, $picto); + + $linkback = ''.$langs->trans("BackToList").''; + + dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref'); + + $cssclass='titlefield'; + //if ($action == 'editnote_public') $cssclass='titlefieldcreate'; + //if ($action == 'editnote_private') $cssclass='titlefieldcreate'; + + //print '
'; + + print '
'; + + include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; + + dol_fiche_end(); +} + +llxFooter(); +$db->close(); + diff --git a/htdocs/product/popuprop.php b/htdocs/product/popuprop.php index ee04299cd4c..52ed6c9c969 100644 --- a/htdocs/product/popuprop.php +++ b/htdocs/product/popuprop.php @@ -61,23 +61,19 @@ $helpurl=''; if ($type == '0') { $helpurl='EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos'; - //$title=$langs->trans("StatisticsOfProducts"); - $title=$langs->trans("Statistics"); } else if ($type == '1') { $helpurl='EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios'; - //$title=$langs->trans("StatisticsOfServices"); - $title=$langs->trans("Statistics"); } else { $helpurl='EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios'; - //$title=$langs->trans("StatisticsOfProductsOrServices"); - $title=$langs->trans("Statistics"); } +$title=$langs->trans("Statistics"); -llxHeader('','',$helpurl); + +llxHeader('', $title, $helpurl); print load_fiche_titre($title, $mesg,'title_products.png'); diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 694297b5b2f..4e04a4c626a 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -10,6 +10,7 @@ * Copyright (C) 2014 Ion agorria * Copyright (C) 2015 Alexandre Spangaro * Copyright (C) 2015 Marcos García + * Copyright (C) 2016 Ferran Marcet * * 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 @@ -92,10 +93,18 @@ if (empty($reshook)) $search_soc = ''; } + if ($action == 'setlabelsellingprice' && $user->admin) + { + require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php'; + $keyforlabel = 'PRODUIT_MULTIPRICES_LABEL'.GETPOST('pricelevel'); + dolibarr_set_const($db, $keyforlabel, GETPOST('labelsellingprice','alpha'), 'chaine', 0, '', $conf->entity); + $action = ''; + } + if (($action == 'update_vat') && !$cancel && ($user->rights->produit->creer || $user->rights->service->creer)) { $tva_tx_txt = GETPOST('tva_tx', 'alpha'); // tva_tx can be '8.5' or '8.5*' or '8.5 (XXX)' or '8.5* (XXX)' - + // We must define tva_tx, npr and local taxes $vatratecode = ''; $tva_tx = preg_replace('/[^0-9\.].*$/', '', $tva_tx_txt); // keep remove all after the numbers and dot @@ -618,7 +627,22 @@ if (! empty($id) || ! empty($ref)) // fetch updated prices $object->fetch($id, $ref); } -llxHeader("", "", $langs->trans("CardProduct" . $object->type)); + +$title = $langs->trans('ProductServiceCard'); +$helpurl = ''; +$shortlabel = dol_trunc($object->label,16); +if (GETPOST("type") == '0' || ($object->type == Product::TYPE_PRODUCT)) +{ + $title = $langs->trans('Product')." ". $shortlabel ." - ".$langs->trans('SellingPrices'); + $helpurl='EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos'; +} +if (GETPOST("type") == '1' || ($object->type == Product::TYPE_SERVICE)) +{ + $title = $langs->trans('Service')." ". $shortlabel ." - ".$langs->trans('SellingPrices'); + $helpurl='EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios'; +} + +llxHeader('', $title, $helpurl); $head = product_prepare_head($object); $titre = $langs->trans("CardProduct" . $object->type); @@ -646,7 +670,9 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES)) $soc->fetch($socid); // Selling price - print '
'; + print ''; print ''; + print ''; + print ''; + print ''; } else { @@ -706,17 +734,46 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES)) else print vatrate($object->tva_tx . ($object->tva_npr ? '*' : ''), true); print ''; } - - print ''; + print '
'.$langs->trans("Supplier").''; + print '
'.$langs->trans("Supplier").''; if ($rowid) { $supplier=new Fournisseur($db); diff --git a/htdocs/product/index.php b/htdocs/product/index.php index 2f15b98b562..74a974804ff 100644 --- a/htdocs/product/index.php +++ b/htdocs/product/index.php @@ -2,7 +2,7 @@ /* Copyright (C) 2001-2006 Rodolphe Quiedeville * Copyright (C) 2004-2015 Laurent Destailleur * Copyright (C) 2005-2014 Regis Houssin - * Copyright (C) 2014 Charles-Fr BENKE + * Copyright (C) 2014-2016 Charlie BENKE * Copyright (C) 2015 Jean-François Ferry * * This program is free software; you can redistribute it and/or modify @@ -40,6 +40,7 @@ else if ($type=='1') $result=restrictedArea($user,'service'); else $result=restrictedArea($user,'produit|service'); $langs->load("products"); +$langs->load("stocks"); $product_static = new Product($db); @@ -49,6 +50,7 @@ $product_static = new Product($db); */ $transAreaType = $langs->trans("ProductsAndServicesArea"); + $helpurl=''; if (! isset($_GET["type"])) { @@ -66,7 +68,7 @@ if ((isset($_GET["type"]) && $_GET["type"] == 1) || empty($conf->product->enable $helpurl='EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios'; } -llxHeader("",$langs->trans("ProductsAndServices"),$helpurl); +llxHeader("", $langs->trans("ProductsAndServices"), $helpurl); $linkback=""; print load_fiche_titre($transAreaType,$linkback,'title_products.png'); @@ -95,7 +97,7 @@ if (count($listofsearchfields)) { if ($i == 0) print '
'.$langs->trans("Search").'
:
' . $langs->trans("SellingPrice") . '
'; + print $langs->trans("SellingPrice"); + print ''; if ($object->multiprices_base_type[$soc->price_level] == 'TTC') { print price($object->multiprices_ttc[$soc->price_level]); @@ -693,7 +719,9 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES)) if (! empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) // using this option is a bug. kept for backward compatibility { // We show only vat for level 1 - print '
' . $langs->trans("VATRate") . '' . vatrate($object->multiprices_tva_tx[1], true) . '
' . $langs->trans("VATRate") . '' . vatrate($object->multiprices_tva_tx[1], true) . '
'.$langs->trans("PriceLevel").''.$langs->trans("SellingPrice").''.$langs->trans("MinPrice").'
'; + + print '
'; + + print ''; + print ''; + print ''; + print ''; + print ''; + $var=True; + for($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i++) { - print ''; + $var = ! $var; + + print ''; // Label of price - print ''; if ($object->multiprices_base_type [$i] == 'TTC') { @@ -745,7 +802,7 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES)) print ''; // Price by quantity - if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY)) + if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY)) // TODO Fix the form included into a tr instead of a td { print ''; print ''; print ''; - foreach ($object->prices_by_qty_list[$i] as $ii => $prices) { + foreach ($object->prices_by_qty_list[$i] as $ii => $prices) + { if ($action == 'edit_price_by_qty' && $rowid == $prices['rowid'] && ($user->rights->produit->creer || $user->rights->service->creer)) { print ''; print ''; @@ -848,7 +906,7 @@ else print ''; // Price by quantity - if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY)) + if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY)) // TODO Fix the form inside tr instead of td { print ''; print ''; + + $var = false; for ($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i ++) { $var = !$var; @@ -1242,7 +1302,9 @@ if ($action == 'edit_price' && $object->getRights()->creer) } } + // List of price changes -log historic (ordered by descending date) + if ((empty($conf->global->PRODUIT_CUSTOMER_PRICES) || $action=='showlog_default_price') && ! in_array($action, array('edit_price','edit_vat'))) { $sql = "SELECT p.rowid, p.price, p.price_ttc, p.price_base_type, p.tva_tx, p.recuperableonly,"; @@ -1276,9 +1338,12 @@ if ((empty($conf->global->PRODUIT_CUSTOMER_PRICES) || $action=='showlog_default_ if ($num > 0) { + // Default prices or + // Log of previous customer prices $backbutton='' . $langs->trans("Back") . ''; if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) print_barre_liste($langs->trans("DefaultPrice"),'','','','','',$backbutton, 0, 0, 'title_accountancy.png'); + else print_barre_liste($langs->trans("PriceByCustomerLog"),'','','','','','', 0, 0, 'title_accountancy.png'); print '
'; + print $langs->trans("PriceLevel"); + if ($user->admin) print ' id.'">'.img_edit($langs->trans('EditSellingPriceLabel'),0).''; + print ''.$langs->trans("SellingPrice").''.$langs->trans("MinPrice").'
' . $langs->trans("SellingPrice") . ' ' . $i; + print ''; $keyforlabel='PRODUIT_MULTIPRICES_LABEL'.$i; - if (! empty($conf->global->$keyforlabel)) print ' - '.$langs->trans($conf->global->$keyforlabel); + if (preg_match('/editlabelsellingprice/', $action)) + { + print '
'; + print ''; + print ''; + print ''; + print $langs->trans("SellingPrice") . ' ' . $i.' - '; + print ''; + print ' '; + print '
'; + } + else + { + print $langs->trans("SellingPrice") . ' ' . $i; + if (! empty($conf->global->$keyforlabel)) print ' - '.$langs->trans($conf->global->$keyforlabel); + } print '
' . $langs->trans("PriceByQuantity") . ' ' . $i; print ''; @@ -760,7 +817,8 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES)) print '' . $langs->trans("Discount") . ' 
' . $langs->trans("PriceByQuantity"); if ($object->prices_by_qty [0] == 0) { @@ -1175,6 +1233,8 @@ if ($action == 'edit_price' && $object->getRights()->creer) print '
'; @@ -1315,7 +1380,7 @@ if ((empty($conf->global->PRODUIT_CUSTOMER_PRICES) || $action=='showlog_default_ { $objp = $db->fetch_object($result); $var = ! $var; - print ''; + print ''; // Date print ""; @@ -1380,8 +1445,9 @@ if ((empty($conf->global->PRODUIT_CUSTOMER_PRICES) || $action=='showlog_default_ } print "\n"; - $i ++; + $i++; } + $db->free($result); print "
" . dol_print_date($db->jdate($objp->dp), "dayhour") . "
"; print "
"; @@ -1752,6 +1818,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) if (count($prodcustprice->lines) > 0) { + $var = false; foreach ($prodcustprice->lines as $line) { $var = ! $var; diff --git a/htdocs/product/reassort.php b/htdocs/product/reassort.php index 56dcc876d3e..b193e553b61 100644 --- a/htdocs/product/reassort.php +++ b/htdocs/product/reassort.php @@ -73,18 +73,6 @@ if (! empty($canvas)) $objcanvas->getCanvas('product','list',$canvas); } -if (! empty($_POST["button_removefilter_x"])) -{ - $sref=""; - $snom=""; - $sall=""; - $search_sale=""; - $search_categ=""; - $type=""; - $catid=''; - $toolowstock=''; -} - // Define virtualdiffersfromphysical $virtualdiffersfromphysical=0; if (! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT) || ! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER)) @@ -98,19 +86,32 @@ if (! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT) || ! empty($conf->global * Actions */ -// None +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers +{ + $sref=""; + $snom=""; + $sall=""; + $search_sale=""; + $search_categ=""; + $type=""; + $catid=''; + $toolowstock=''; +} + /* * View */ +$helpurl='EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks'; + $form=new Form($db); $htmlother=new FormOther($db); $title=$langs->trans("ProductsAndServices"); -$sql = 'SELECT p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type,p.entity,'; +$sql = 'SELECT p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type, p.entity,'; $sql.= ' p.fk_product_type, p.tms as datem,'; $sql.= ' p.duration, p.tosell as statut, p.tobuy, p.seuil_stock_alerte, p.desiredstock,'; $sql.= ' SUM(s.reel) as stock_physique'; @@ -164,7 +165,7 @@ if ($search_categ) { $sql .= " AND cp.fk_categorie = ".$db->escape($search_categ); } -$sql.= " GROUP BY p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type,"; +$sql.= " GROUP BY p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type, p.entity,"; $sql.= " p.fk_product_type, p.tms, p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock"; if ($toolowstock) $sql.= " HAVING SUM(".$db->ifsql('s.reel IS NULL', '0', 's.reel').") < p.seuil_stock_alerte"; // Not used yet $sql.= $db->order($sortfield,$sortorder); @@ -177,16 +178,13 @@ if ($resql) $i = 0; - if ($num == 1 && ($sall or $snom or $sref)) + if ($num == 1 && GETPOST('autojumpifoneonly') && ($sall || $snom || $sref)) { $objp = $db->fetch_object($resql); header("Location: card.php?id=$objp->rowid"); exit; } - $helpurl=''; - $helpurl='EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks'; - if (isset($type)) { if ($type==1) { $texte = $langs->trans("Services"); } @@ -197,7 +195,7 @@ if ($resql) $texte.=' ('.$langs->trans("Stocks").')'; - llxHeader("",$texte,$helpurl); + llxHeader("", $texte, $helpurl); if ($sref || $snom || $sall || GETPOST('search')) { @@ -248,8 +246,13 @@ if ($resql) print '
'; } - - $param="&tosell=$tosell&tobuy=$tobuy".(isset($type)?"&type=$type":"")."&fourn_id=$fourn_id&snom=$snom&sref=$sref"; + $param=''; + if ($tosell) $param.="&tosell=".$tosell; + if ($tobuy) $param.="&tobuy=".$tobuy; + if ($type) $param.="&type=".$type; + if ($fourn_id) $param.="&fourn_id=".$fourn_id; + if ($snom) $param.="&snom=".$snom; + if ($sref) $param.="&sref=".$sref; $formProduct = new FormProduct($db); $formProduct->loadWarehouses(); @@ -278,7 +281,7 @@ if ($resql) } } - if ($virtualdiffersfromphysical) print_liste_field_titre($langs->trans("VirtualStock"),$_SERVER["PHP_SELF"], "stock_theorique",$param,"",'align="right"',$sortfield,$sortorder); + if ($virtualdiffersfromphysical) print_liste_field_titre($langs->trans("VirtualStock"),$_SERVER["PHP_SELF"], "",$param,"",'align="right"',$sortfield,$sortorder); print_liste_field_titre(''); print_liste_field_titre($langs->trans("Status").' ('.$langs->trans("Sell").')',$_SERVER["PHP_SELF"], "p.tosell",$param,"",'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Status").' ('.$langs->trans("Buy").')',$_SERVER["PHP_SELF"], "p.tobuy",$param,"",'align="right"',$sortfield,$sortorder); diff --git a/htdocs/product/reassortlot.php b/htdocs/product/reassortlot.php index f7d5e60ca72..43f956b5eea 100644 --- a/htdocs/product/reassortlot.php +++ b/htdocs/product/reassortlot.php @@ -4,6 +4,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2015 Raphaël Doursenaud + * Copyright (C) 2016 Ferran Marcet * * 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 @@ -45,8 +46,9 @@ $sref=GETPOST("sref"); $snom=GETPOST("snom"); $sall=GETPOST("sall"); $type=GETPOST("type","int"); -$sbarcode=GETPOST("sbarcode"); -$search_batch=GETPOST('search_batch'); +$sbarcode=GETPOST("sbarcode",'alpha'); +$search_warehouse=GETPOST('search_warehouse','alpha'); +$search_batch=GETPOST('search_batch','alpha'); $catid=GETPOST('catid','int'); $toolowstock=GETPOST('toolowstock'); $tosell = GETPOST("tosell"); @@ -75,7 +77,13 @@ if (! empty($canvas)) $objcanvas->getCanvas('product','list',$canvas); } -if (! empty($_POST["button_removefilter_x"])) + + +/* + * Actions + */ + +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers { $sref=""; $snom=""; @@ -85,21 +93,17 @@ if (! empty($_POST["button_removefilter_x"])) $type=""; $catid=''; $toolowstock=''; + $search_batch=''; + $search_warehouse=''; } - -/* - * Actions - */ - -// None - - /* * View */ +$helpurl='EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks'; + $form=new Form($db); $htmlother=new FormOther($db); @@ -108,14 +112,16 @@ $title=$langs->trans("ProductsAndServices"); $sql = 'SELECT p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type, p.entity,'; $sql.= ' p.fk_product_type, p.tms as datem,'; $sql.= ' p.duration, p.tosell as statut, p.tobuy, p.seuil_stock_alerte, p.desiredstock, p.stock, p.tobatch,'; -$sql.= ' s.fk_entrepot,'; +$sql.= ' ps.fk_entrepot,'; +$sql.= ' e.label as warehouse_label,'; $sql.= ' pb.batch, pb.eatby as oldeatby, pb.sellby as oldsellby,'; $sql.= ' pl.eatby, pl.sellby,'; $sql.= ' SUM(pb.qty) as stock_physique, COUNT(pb.rowid) as nbinbatchtable'; $sql.= ' FROM '.MAIN_DB_PREFIX.'product as p'; -$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_stock as s on p.rowid = s.fk_product'; -$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_batch as pb on pb.fk_product_stock = s.rowid'; -$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_lot as pl on pl.fk_product = p.rowid AND pl.batch = pb.batch'; +$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_stock as ps on p.rowid = ps.fk_product'; // Detail for each warehouse +$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'entrepot as e on ps.fk_entrepot = e.rowid'; // Link on unique key +$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_batch as pb on pb.fk_product_stock = ps.rowid'; // Detail for each lot on each warehouse +$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_lot as pl on pl.fk_product = p.rowid AND pl.batch = pb.batch'; // Link on unique key // We'll need this table joined to the select in order to filter by categ if ($search_categ) $sql.= ", ".MAIN_DB_PREFIX."categorie_product as cp"; $sql.= " WHERE p.entity IN (".getEntity('product', 1).")"; @@ -136,45 +142,26 @@ if (dol_strlen($type)) $sql.= " AND p.fk_product_type <> '1'"; } } -if ($sref) $sql.= " AND p.ref LIKE '%".$sref."%'"; -if ($sbarcode) $sql.= " AND p.barcode LIKE '%".$sbarcode."%'"; -if ($snom) $sql.= " AND p.label LIKE '%".$db->escape($snom)."%'"; -if (! empty($tosell)) -{ - $sql.= " AND p.tosell = ".$tosell; -} -if (! empty($tobuy)) -{ - $sql.= " AND p.tobuy = ".$tobuy; -} -if (! empty($canvas)) -{ - $sql.= " AND p.canvas = '".$db->escape($canvas)."'"; -} -if($catid) -{ - $sql.= " AND cp.fk_categorie = ".$catid; -} -if ($fourn_id > 0) -{ - $sql.= " AND p.rowid = pf.fk_product AND pf.fk_soc = ".$fourn_id; -} +if ($sref) $sql.= natural_search("p.ref", $sref); +if ($sbarcode) $sql.= natural_search("p.barcode", $sbarcode); +if ($snom) $sql.= natural_search("p.label", $snom); +if (! empty($tosell)) $sql.= " AND p.tosell = ".$tosell; +if (! empty($tobuy)) $sql.= " AND p.tobuy = ".$tobuy; +if (! empty($canvas)) $sql.= " AND p.canvas = '".$db->escape($canvas)."'"; +if($catid) $sql.= " AND cp.fk_categorie = ".$catid; +if ($fourn_id > 0) $sql.= " AND p.rowid = pf.fk_product AND pf.fk_soc = ".$fourn_id; // Insert categ filter -if ($search_categ) -{ - $sql .= " AND cp.fk_categorie = ".$db->escape($search_categ); -} -if ($search_batch) -{ - $sql .= " AND pb.batch LIKE '%".$db->escape($search_batch)."%'"; -} +if ($search_categ) $sql .= " AND cp.fk_categorie = ".$db->escape($search_categ); +if ($search_warehouse) $sql .= natural_search("e.label", $search_warehouse); +if ($search_batch) $sql .= natural_search("pb.batch", $search_batch); $sql.= " GROUP BY p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type, p.entity,"; $sql.= " p.fk_product_type, p.tms,"; $sql.= " p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock, p.stock, p.tobatch,"; -$sql.= " s.fk_entrepot,"; +$sql.= " ps.fk_entrepot,"; +$sql.= " e.label,"; $sql.= " pb.batch, pb.eatby, pb.sellby,"; $sql.= " pl.eatby, pl.sellby"; -if ($toolowstock) $sql.= " HAVING SUM(".$db->ifsql('s.reel IS NULL', '0', 's.reel').") < p.seuil_stock_alerte"; // Not used yet +if ($toolowstock) $sql.= " HAVING SUM(".$db->ifsql('ps.reel IS NULL', '0', 'ps.reel').") < p.seuil_stock_alerte"; // Not used yet $sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($limit + 1, $offset); $resql = $db->query($sql); @@ -185,16 +172,13 @@ if ($resql) $i = 0; - if ($num == 1 && ($sall or $snom or $sref)) + if ($num == 1 && GETPOST('autojumpifoneonly') && ($sall or $snom or $sref)) { $objp = $db->fetch_object($resql); header("Location: card.php?id=$objp->rowid"); exit; } - $helpurl=''; - $helpurl='EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks'; - if (isset($type)) { if ($type==1) { $texte = $langs->trans("Services"); } @@ -252,9 +236,18 @@ if ($resql) print $hookmanager->resPrint; print '
'; } - - $param="&tosell=$tosell&tobuy=$tobuy".(isset($type)?"&type=$type":"")."&fourn_id=$fourn_id&snom=$snom&sref=$sref&batch=$batch&eatby=$eatby&sellby=$sellby"; + + $param=''; + if ($tosell) $param.="&tosell=".$tosell; + if ($tobuy) $param.="&tobuy=".$tobuy; + if ($type) $param.="&type=".$type; + if ($fourn_id) $param.="&fourn_id=".$fourn_id; + if ($snom) $param.="&snom=".$snom; + if ($sref) $param.="&sref=".$sref; + if ($search_batch) $param.="&search_batch=".$search_batch; + /*if ($eatby) $param.="&eatby=".$eatby; + if ($sellby) $param.="&sellby=".$sellby;*/ print ''; @@ -263,17 +256,17 @@ if ($resql) print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "p.ref",$param,"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"], "p.label",$param,"","",$sortfield,$sortorder); if (! empty($conf->service->enabled) && $type == 1) print_liste_field_titre($langs->trans("Duration"), $_SERVER["PHP_SELF"], "p.duration",$param,"",'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Warehouse"), $_SERVER["PHP_SELF"], "",$param,"",'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Warehouse"), $_SERVER["PHP_SELF"], "e.label",$param,"",'',$sortfield,$sortorder); //print_liste_field_titre($langs->trans("DesiredStock"), $_SERVER["PHP_SELF"], "p.desiredstock",$param,"",'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Batch"), $_SERVER["PHP_SELF"], "pb.batch",$param,"",'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("l_eatby"), $_SERVER["PHP_SELF"], "pb.eatby",$param,"",'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("l_sellby"), $_SERVER["PHP_SELF"], "pb.sellby",$param,"",'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("EatByDate"), $_SERVER["PHP_SELF"], "pb.eatby",$param,"",'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("SellByDate"), $_SERVER["PHP_SELF"], "pb.sellby",$param,"",'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("PhysicalStock"), $_SERVER["PHP_SELF"], "stock_physique",$param,"",'align="right"',$sortfield,$sortorder); // TODO Add info of running suppliers/customers orders //print_liste_field_titre($langs->trans("TheoreticalStock"),$_SERVER["PHP_SELF"], "stock_theorique",$param,"",'align="right"',$sortfield,$sortorder); print_liste_field_titre(''); - print_liste_field_titre($langs->trans("Status").' ('.$langs->trans("Sell").')',$_SERVER["PHP_SELF"], "p.tosell",$param,"",'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Status").' ('.$langs->trans("Buy").')',$_SERVER["PHP_SELF"], "p.tobuy",$param,"",'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Status").' ('.$langs->trans("Sell").')',$_SERVER["PHP_SELF"], "p.tosell","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Status").' ('.$langs->trans("Buy").')',$_SERVER["PHP_SELF"], "p.tobuy","",$param,'align="right"',$sortfield,$sortorder); print "\n"; // Lignes des champs de filtre @@ -290,7 +283,7 @@ if ($resql) print ' '; print ''; } - print ''; + print ''; print ''; print ''; print ''; @@ -357,7 +350,9 @@ if ($resql) print ''; diff --git a/htdocs/product/stats/card.php b/htdocs/product/stats/card.php index 138cfe45a2b..e7af303d694 100644 --- a/htdocs/product/stats/card.php +++ b/htdocs/product/stats/card.php @@ -36,6 +36,7 @@ $HEIGHT=DolGraph::getDefaultGraphSizeForStats('height',160); $langs->load("companies"); $langs->load("products"); +$langs->load("stocks"); $langs->load("bills"); $langs->load("other"); @@ -94,7 +95,22 @@ if (! empty($id) || ! empty($ref) || GETPOST('id') == 'all') else { $result = $object->fetch($id,$ref); - llxHeader("",$langs->trans("CardProduct".$object->type)); + + $title = $langs->trans('ProductServiceCard'); + $helpurl = ''; + $shortlabel = dol_trunc($object->label,16); + if (GETPOST("type") == '0' || ($object->type == Product::TYPE_PRODUCT)) + { + $title = $langs->trans('Product')." ". $shortlabel ." - ".$langs->trans('Statistics'); + $helpurl='EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos'; + } + if (GETPOST("type") == '1' || ($object->type == Product::TYPE_SERVICE)) + { + $title = $langs->trans('Service')." ". $shortlabel ." - ".$langs->trans('Statistics'); + $helpurl='EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios'; + } + + llxHeader('', $title, $helpurl); } @@ -108,7 +124,7 @@ if (! empty($id) || ! empty($ref) || GETPOST('id') == 'all') $linkback = ''.$langs->trans("BackToList").''; - dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref'); + dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref', '', '', '', 0, '', '', 1); dol_fiche_end(); } @@ -195,9 +211,9 @@ if (! empty($id) || ! empty($ref) || GETPOST('id') == 'all') //print '
   '; if ($objp->fk_entrepot > 0) { - $warehousetmp->fetch($objp->fk_entrepot); + $warehousetmp->id=$objp->fk_entrepot; + $warehousetmp->label=$objp->warehouse_label; + //$warehousetmp->fetch($objp->fk_entrepot); print $warehousetmp->getNomUrl(1); } print '
'; // Generation des graphs + $dir = (! empty($conf->product->multidir_temp[$object->entity])?$conf->product->multidir_temp[$object->entity]:$conf->service->multidir_temp[$object->entity]); if ($object->id > 0) // We are on statistics for a dedicated product { - $dir = (! empty($conf->product->multidir_temp[$object->entity])?$conf->product->multidir_temp[$object->entity]:$conf->service->multidir_temp[$object->entity]); if (! file_exists($dir.'/'.$object->id)) { if (dol_mkdir($dir.'/'.$object->id) < 0) @@ -208,32 +224,43 @@ if (! empty($id) || ! empty($ref) || GETPOST('id') == 'all') } } - $graphfiles=array( - 'propal' =>array('modulepart'=>'productstats_proposals', - 'file' => $object->id.'/propal12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.'.png', - 'label' => ($mode=='byunit'?$langs->transnoentitiesnoconv("NumberOfUnitsProposals"):$langs->transnoentitiesnoconv("NumberOfProposals"))), - 'proposalssuppliers'=>array('modulepart'=>'productstats_proposalssuppliers', - 'file' => $object->id.'/proposalssuppliers12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.'.png', - 'label' => ($mode=='byunit'?$langs->transnoentitiesnoconv("NumberOfUnitsSupplierProposals"):$langs->transnoentitiesnoconv("NumberOfSupplierProposals"))), - - 'orders' =>array('modulepart'=>'productstats_orders', - 'file' => $object->id.'/orders12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.'.png', - 'label' => ($mode=='byunit'?$langs->transnoentitiesnoconv("NumberOfUnitsCustomerOrders"):$langs->transnoentitiesnoconv("NumberOfCustomerOrders"))), - 'orderssuppliers'=>array('modulepart'=>'productstats_orderssuppliers', - 'file' => $object->id.'/orderssuppliers12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.'.png', - 'label' => ($mode=='byunit'?$langs->transnoentitiesnoconv("NumberOfUnitsSupplierOrders"):$langs->transnoentitiesnoconv("NumberOfSupplierOrders"))), - - 'invoices' =>array('modulepart'=>'productstats_invoices', - 'file' => $object->id.'/invoices12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.'.png', - 'label' => ($mode=='byunit'?$langs->transnoentitiesnoconv("NumberOfUnitsCustomerInvoices"):$langs->transnoentitiesnoconv("NumberOfCustomerInvoices"))), - 'invoicessuppliers'=>array('modulepart'=>'productstats_invoicessuppliers', - 'file' => $object->id.'/invoicessuppliers12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.'.png', - 'label' => ($mode=='byunit'?$langs->transnoentitiesnoconv("NumberOfUnitsSupplierInvoices"):$langs->transnoentitiesnoconv("NumberOfSupplierInvoices"))), - ); + if($conf->propal->enabled) { + $graphfiles['propal']=array('modulepart'=>'productstats_proposals', + 'file' => $object->id.'/propal12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.'.png', + 'label' => ($mode=='byunit'?$langs->transnoentitiesnoconv("NumberOfUnitsProposals"):$langs->transnoentitiesnoconv("NumberOfProposals"))); + } + + if($conf->supplier_proposal->enabled) { + $graphfiles['proposalssuppliers']=array('modulepart'=>'productstats_proposalssuppliers', + 'file' => $object->id.'/proposalssuppliers12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.'.png', + 'label' => ($mode=='byunit'?$langs->transnoentitiesnoconv("NumberOfUnitsSupplierProposals"):$langs->transnoentitiesnoconv("NumberOfSupplierProposals"))); + } + + if($conf->order->enabled) { + $graphfiles['orders']=array('modulepart'=>'productstats_orders', + 'file' => $object->id.'/orders12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.'.png', + 'label' => ($mode=='byunit'?$langs->transnoentitiesnoconv("NumberOfUnitsCustomerOrders"):$langs->transnoentitiesnoconv("NumberOfCustomerOrders"))); + } + + if($conf->fournisseur->enabled) { + $graphfiles['orderssuppliers']=array('modulepart'=>'productstats_orderssuppliers', + 'file' => $object->id.'/orderssuppliers12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.'.png', + 'label' => ($mode=='byunit'?$langs->transnoentitiesnoconv("NumberOfUnitsSupplierOrders"):$langs->transnoentitiesnoconv("NumberOfSupplierOrders"))); + } + + if($conf->facture->enabled) { + $graphfiles['invoices']=array('modulepart'=>'productstats_invoices', + 'file' => $object->id.'/invoices12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.'.png', + 'label' => ($mode=='byunit'?$langs->transnoentitiesnoconv("NumberOfUnitsCustomerInvoices"):$langs->transnoentitiesnoconv("NumberOfCustomerInvoices"))); + + $graphfiles['invoicessuppliers']=array('modulepart'=>'productstats_invoicessuppliers', + 'file' => $object->id.'/invoicessuppliers12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.'.png', + 'label' => ($mode=='byunit'?$langs->transnoentitiesnoconv("NumberOfUnitsSupplierInvoices"):$langs->transnoentitiesnoconv("NumberOfSupplierInvoices"))); + } $px = new DolGraph(); - if (! $error) + if (! $error && count($graphfiles)>0) { $mesg = $px->isGraphKo(); if (! $mesg) @@ -290,64 +317,67 @@ if (! empty($id) || ! empty($ref) || GETPOST('id') == 'all') // Show graphs $i=0; - foreach($graphfiles as $key => $val) + if ( count($graphfiles)>0) { - if (! $graphfiles[$key]['file']) continue; - - if ($graphfiles == 'propal' && ! $user->rights->propale->lire) continue; - if ($graphfiles == 'order' && ! $user->rights->commande->lire) continue; - if ($graphfiles == 'invoices' && ! $user->rights->facture->lire) continue; - if ($graphfiles == 'proposals_suppliers' && ! $user->rights->supplier_proposal->lire) continue; - if ($graphfiles == 'invoices_suppliers' && ! $user->rights->fournisseur->facture->lire) continue; - if ($graphfiles == 'orders_suppliers' && ! $user->rights->fournisseur->commande->lire) continue; - - - if ($i % 2 == 0) + foreach($graphfiles as $key => $val) { - print "\n".'
'."\n"; + if (! $graphfiles[$key]['file']) continue; + + if ($graphfiles == 'propal' && ! $user->rights->propale->lire) continue; + if ($graphfiles == 'order' && ! $user->rights->commande->lire) continue; + if ($graphfiles == 'invoices' && ! $user->rights->facture->lire) continue; + if ($graphfiles == 'proposals_suppliers' && ! $user->rights->supplier_proposal->lire) continue; + if ($graphfiles == 'invoices_suppliers' && ! $user->rights->fournisseur->facture->lire) continue; + if ($graphfiles == 'orders_suppliers' && ! $user->rights->fournisseur->commande->lire) continue; + + + if ($i % 2 == 0) + { + print "\n".'
'."\n"; + } + else + { + print "\n".'
'."\n"; + } + + // Show graph + + print '
'; + // Label + print ''; + // Image + print ''; + // Date generation + print ''; + if ($graphfiles[$key]['output'] && ! $px->isGraphKo()) + { + if (file_exists($dir."/".$graphfiles[$key]['file']) && filemtime($dir."/".$graphfiles[$key]['file'])) print ''; + else print ''; + } + else + { + print ''; + } + print ''; + print ''; + print '
'; + print $graphfiles[$key]['label']; + print '
'; + print $graphfiles[$key]['output']; + print '
'.$langs->trans("GeneratedOn",dol_print_date(filemtime($dir."/".$graphfiles[$key]['file']),"dayhour")).''.$langs->trans("GeneratedOn",dol_print_date(dol_now(),"dayhour")).''.($mesg?''.$mesg.'':$langs->trans("ChartNotGenerated")).'id).((string) $type != ''?'&type='.$type:'').'&action=recalcul&mode='.$mode.'">'.img_picto($langs->trans("ReCalculate"),'refresh').'
'; + + if ($i % 2 == 0) + { + print "\n".''."\n"; + } + else + { + print "\n".''; + print '

'."\n"; + } + + $i++; } - else - { - print "\n".'
'."\n"; - } - - // Show graph - - print ''; - // Label - print ''; - // Image - print ''; - // Date generation - print ''; - if ($graphfiles[$key]['output'] && ! $px->isGraphKo()) - { - if (file_exists($dir."/".$graphfiles[$key]['file']) && filemtime($dir."/".$graphfiles[$key]['file'])) print ''; - else print ''; - } - else - { - print ''; - } - print ''; - print ''; - print '
'; - print $graphfiles[$key]['label']; - print '
'; - print $graphfiles[$key]['output']; - print '
'.$langs->trans("GeneratedOn",dol_print_date(filemtime($dir."/".$graphfiles[$key]['file']),"dayhour")).''.$langs->trans("GeneratedOn",dol_print_date(dol_now(),"dayhour")).''.($mesg?''.$mesg.'':$langs->trans("ChartNotGenerated")).'id).((string) $type != ''?'&type='.$type:'').'&action=recalcul&mode='.$mode.'">'.img_picto($langs->trans("ReCalculate"),'refresh').'
'; - - if ($i % 2 == 0) - { - print "\n".'
'."\n"; - } - else - { - print "\n".'
'; - print '

'."\n"; - } - - $i++; } // div not closed if ($i % 2 == 1) diff --git a/htdocs/product/stats/facture.php b/htdocs/product/stats/facture.php index 6f3f8546454..e9eb3d41859 100644 --- a/htdocs/product/stats/facture.php +++ b/htdocs/product/stats/facture.php @@ -90,7 +90,21 @@ if ($id > 0 || ! empty($ref)) $reshook=$hookmanager->executeHooks('doActions',$parameters,$product,$action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); - llxHeader("","",$langs->trans("CardProduct".$product->type)); + $title = $langs->trans('ProductServiceCard'); + $helpurl = ''; + $shortlabel = dol_trunc($object->label,16); + if (GETPOST("type") == '0' || ($object->type == Product::TYPE_PRODUCT)) + { + $title = $langs->trans('Product')." ". $shortlabel ." - ".$langs->trans('Referers'); + $helpurl='EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos'; + } + if (GETPOST("type") == '1' || ($object->type == Product::TYPE_SERVICE)) + { + $title = $langs->trans('Service')." ". $shortlabel ." - ".$langs->trans('Referers'); + $helpurl='EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios'; + } + + llxHeader('', $title, $helpurl); if ($result > 0) { diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php index 9dcb51fe8ef..f1097b331b9 100644 --- a/htdocs/product/stock/card.php +++ b/htdocs/product/stock/card.php @@ -31,10 +31,12 @@ require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/stock.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; +require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; $langs->load("products"); $langs->load("stocks"); $langs->load("companies"); +$langs->load("categories"); $action=GETPOST('action'); $cancel=GETPOST('cancel'); @@ -64,6 +66,7 @@ $object = new Entrepot($db); if ($action == 'add' && $user->rights->stock->creer) { $object->ref = GETPOST("ref"); + $object->fk_parent = GETPOST("fk_parent"); $object->libelle = GETPOST("libelle"); $object->description = GETPOST("desc"); $object->statut = GETPOST("statut"); @@ -111,6 +114,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->stock->su $result=$object->delete($user); if ($result > 0) { + setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs'); header("Location: ".DOL_URL_ROOT.'/product/stock/list.php'); exit; } @@ -127,6 +131,7 @@ if ($action == 'update' && $cancel <> $langs->trans("Cancel")) if ($object->fetch($id)) { $object->libelle = GETPOST("libelle"); + $object->fk_parent = GETPOST("fk_parent"); $object->description = GETPOST("desc"); $object->statut = GETPOST("statut"); $object->lieu = GETPOST("lieu"); @@ -165,6 +170,7 @@ if ($cancel == $langs->trans("Cancel")) $productstatic=new Product($db); $form=new Form($db); +$formproduct=new FormProduct($db); $formcompany=new FormCompany($db); $help_url='EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks'; @@ -175,7 +181,7 @@ if ($action == 'create') { print load_fiche_titre($langs->trans("NewWarehouse")); - print "\n"; + print ''."\n"; print ''; print ''; print ''; @@ -185,36 +191,42 @@ if ($action == 'create') print ''; // Ref - print ''; + print ''; print ''; + + // Parent entrepot + print ''; // Description - print ''; - print ''; // Zip / Town print ''; + print ''; // Country - print ''; // Status - print ''; print ''; + + // Parent entrepot + print ''; // Description print ''; - print ''; - print ''; + print ''; + print ''; } print ''; - print ''; + print ''; print "\n"; $var=True; diff --git a/htdocs/product/stock/info.php b/htdocs/product/stock/info.php index f9c5e163f4d..7f6a9f6031b 100644 --- a/htdocs/product/stock/info.php +++ b/htdocs/product/stock/info.php @@ -39,18 +39,30 @@ $result=restrictedArea($user,'stock'); $help_url='EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks'; llxHeader("",$langs->trans("Stocks"),$help_url); -$entrepot = new Entrepot($db); -$entrepot->fetch($_GET["id"]); -$entrepot->info($_GET["id"]); +$object = new Entrepot($db); +$object->fetch($_GET["id"]); +$object->info($_GET["id"]); -$head = stock_prepare_head($entrepot); +$head = stock_prepare_head($object); dol_fiche_head($head, 'info', $langs->trans("Warehouse"), 0, 'stock'); -print '
'.$langs->trans("Ref").'
'.$langs->trans("Ref").'
'.$langs->trans("LocationSummary").'
'.$langs->trans("AddIn").''; + print $formproduct->selectWarehouses('', 'fk_parent', '', 1); + print '
'.$langs->trans("Description").''; + print '
'.$langs->trans("Description").''; // Editeur wysiwyg require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $doleditor=new DolEditor('desc',(!empty($object->description)?$object->description:''),'',180,'dolibarr_notes','In',false,true,$conf->fckeditor->enabled,5,70); $doleditor->Create(); print '
'.$langs->trans('Address').'
'.$langs->trans('Zip').''; print $formcompany->select_ziptown((!empty($object->zip)?$object->zip:''),'zipcode',array('town','selectcountry_id','state_id'),6); - print ''.$langs->trans('Town').''; + print '
'.$langs->trans('Town').''; print $formcompany->select_ziptown((!empty($object->town)?$object->town:''),'town',array('zipcode','selectcountry_id','state_id')); print '
'.$langs->trans('Country').''; + print '
'.$langs->trans('Country').''; print $form->select_country((!empty($object->country_id)?$object->country_id:$mysoc->country_code),'country_id'); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); print '
'.$langs->trans("Status").''; + print '
'.$langs->trans("Status").''; print ''; + print '
'; + print ''; + print '     '; + print ''; + print '
'; print ''; } @@ -259,66 +275,80 @@ else dol_fiche_head($head, 'card', $langs->trans("Warehouse"), 0, 'stock'); + $formconfirm = ''; + // Confirm delete third party if ($action == 'delete') { - print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id,$langs->trans("DeleteAWarehouse"),$langs->trans("ConfirmDeleteWarehouse",$object->libelle),"confirm_delete",'',0,2); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id,$langs->trans("DeleteAWarehouse"),$langs->trans("ConfirmDeleteWarehouse",$object->libelle),"confirm_delete",'',0,2); } - print ''; - + if (! $formconfirm) { + $parameters = array(); + $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + if (empty($reshook)) $formconfirm.=$hookmanager->resPrint; + elseif ($reshook > 0) $formconfirm=$hookmanager->resPrint; + } + + // Print form confirm + print $formconfirm; + + // Warehouse card $linkback = ''.$langs->trans("BackToList").''; + + $morehtmlref='
'; + $morehtmlref.=$langs->trans("LocationSummary").' : '.$object->lieu; + $morehtmlref.='
'; + + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'libelle', $morehtmlref); + + + print '
'; + print '
'; + print '
'; + + print '
'; - // Ref - print ''; - - print ''; + // Parent entrepot + $e = new Entrepot($db); + if(!empty($object->fk_parent) && $e->fetch($object->fk_parent) > 0) { + + print ''; + + } // Description - print ''; + print ''; - // Address - print ''; - - // Town - print ''; - print ''; - - // Country - print ''; - - // Status - print ''; - - $calcproductsunique=$object->nb_different_products(); + $calcproductsunique=$object->nb_different_products(); $calcproducts=$object->nb_products(); - - // Total nb of different products - print '"; - + + // Total nb of different products + print '"; + // Nb of products - print '"; - + + print '
'.$langs->trans("Ref").''; - print $form->showrefnav($object, 'id', $linkback, 1, 'rowid', 'libelle'); - print '
'.$langs->trans("LocationSummary").''.$object->lieu.'
'.$langs->trans("ParentWarehouse").''; + print $e->getNomUrl(3); + print '
'.$langs->trans("Description").''.nl2br($object->description).'
'.$langs->trans("Description").''.nl2br($object->description).'
'.$langs->trans('Address').''; - print $object->address; - print '
'.$langs->trans('Zip').''.$object->zip.''.$langs->trans('Town').''.$object->town.'
'.$langs->trans('Country').''; - if (! empty($object->country_code)) - { - $img=picto_from_langcode($object->country_code); - print ($img?$img.' ':''); - } - print $object->country; - print '
'.$langs->trans("Status").''.$object->getLibStatut(4).'
'.$langs->trans("NumberOfDifferentProducts").''; - print empty($calcproductsunique['nb'])?'0':$calcproductsunique['nb']; - print "
'.$langs->trans("NumberOfDifferentProducts").''; + print empty($calcproductsunique['nb'])?'0':$calcproductsunique['nb']; + print "
'.$langs->trans("NumberOfProducts").''; + print '
'.$langs->trans("NumberOfProducts").''; print empty($calcproducts['nb'])?'0':$calcproducts['nb']; print "
'; + + print ''; + print '
'; + print '
'; + print '
'; + + print ''; + // Value - print '"; - + // Last movement $sql = "SELECT max(m.datem) as datem"; $sql .= " FROM ".MAIN_DB_PREFIX."stock_mouvement as m"; @@ -326,14 +356,14 @@ else $resqlbis = $db->query($sql); if ($resqlbis) { - $obj = $db->fetch_object($resqlbis); - $lastmovementdate=$db->jdate($obj->datem); + $obj = $db->fetch_object($resqlbis); + $lastmovementdate=$db->jdate($obj->datem); } else { - dol_print_error($db); + dol_print_error($db); } - print '"; - + print "
'.$langs->trans("EstimatedStockValueShort").''; + print '
'.$langs->trans("EstimatedStockValueShort").''; print price((empty($calcproducts['value'])?'0':price2num($calcproducts['value'],'MT')), 0, $langs, 0, -1, -1, $conf->currency); print "
'.$langs->trans("LastMovement").''; + print '
'.$langs->trans("LastMovement").''; if ($lastmovementdate) { print dol_print_date($lastmovementdate,'dayhour').' '; @@ -341,13 +371,19 @@ else } else { - print $langs->trans("None"); + print $langs->trans("None"); } print "
"; print '
'; + print '
'; + print ''; + + print '
'; + + dol_fiche_end(); /* ************************************************************************** */ @@ -537,6 +573,11 @@ else print '
'.$langs->trans("Ref").'
'.$langs->trans("LocationSummary").'
'.$langs->trans("AddIn").''; + print $formproduct->selectWarehouses($object->fk_parent, 'fk_parent', '', 1); + print '
'.$langs->trans("Description").''; diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index afcaec0bc6b..032a0f3a56d 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -35,6 +35,7 @@ class Entrepot extends CommonObject { public $element='stock'; public $table_element='entrepot'; + public $picto='stock'; /** * Warehouse closed, inactive @@ -108,7 +109,9 @@ class Entrepot extends CommonObject function create($user) { global $conf; - + + $this->libelle = trim($this->libelle); + // Si libelle non defini, erreur if ($this->libelle == '') { @@ -120,8 +123,8 @@ class Entrepot extends CommonObject $this->db->begin(); - $sql = "INSERT INTO ".MAIN_DB_PREFIX."entrepot (entity, datec, fk_user_author, label)"; - $sql .= " VALUES (".$conf->entity.",'".$this->db->idate($now)."',".$user->id.",'".$this->db->escape($this->libelle)."')"; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."entrepot (entity, datec, fk_user_author, label, fk_parent)"; + $sql .= " VALUES (".$conf->entity.",'".$this->db->idate($now)."',".$user->id.",'".$this->db->escape($this->libelle)."', ".($this->fk_parent > 0 ? $this->fk_parent : 'NULL').")"; dol_syslog(get_class($this)."::create", LOG_DEBUG); $result=$this->db->query($sql); @@ -169,6 +172,16 @@ class Entrepot extends CommonObject */ function update($id, $user) { + // Check if new parent is already a child of current warehouse + if(!empty($this->fk_parent)) { + $TChildWarehouses = array($id); + $TChildWarehouses = $this->get_children_warehouses($this->id, $TChildWarehouses); + if(in_array($this->fk_parent, $TChildWarehouses)) { + $this->error = 'ErrorCannotAddThisParentWarehouse'; + return -2; + } + } + $this->libelle=trim($this->libelle); $this->description=trim($this->description); @@ -181,6 +194,7 @@ class Entrepot extends CommonObject $sql = "UPDATE ".MAIN_DB_PREFIX."entrepot "; $sql .= " SET label = '" . $this->db->escape($this->libelle) ."'"; + $sql .= ", fk_parent = '" . (($this->fk_parent > 0) ? $this->fk_parent : 'NULL') ."'"; $sql .= ", description = '" . $this->db->escape($this->description) ."'"; $sql .= ", statut = " . $this->statut; $sql .= ", lieu = '" . $this->db->escape($this->lieu) ."'"; @@ -211,24 +225,40 @@ class Entrepot extends CommonObject /** * Delete a warehouse * - * @param User $user Object user that made deletion - * @return int <0 if KO, >0 if OK + * @param User $user Object user that made deletion + * @param int $notrigger 1=No trigger + * @return int <0 if KO, >0 if OK */ - function delete($user) + function delete($user, $notrigger=0) { $this->db->begin(); - $sql = "DELETE FROM ".MAIN_DB_PREFIX."stock_mouvement"; - $sql.= " WHERE fk_entrepot = " . $this->id; - dol_syslog(get_class($this)."::delete", LOG_DEBUG); - $resql1=$this->db->query($sql); + if (! $error && empty($notrigger)) + { + // Call trigger + $result=$this->call_trigger('WAREHOUSE_DELETE',$user); + if ($result < 0) { $error++; } + // End call triggers + } + + $elements = array('stock_mouvement','product_stock','product_warehouse_properties'); + foreach($elements as $table) + { + if (! $error) + { + $sql = "DELETE FROM ".MAIN_DB_PREFIX.$table; + $sql.= " WHERE fk_entrepot = " . $this->id; + dol_syslog(get_class($this)."::delete", LOG_DEBUG); + $result=$this->db->query($sql); + if (! $result) + { + $error++; + $this->errors[] = $this->db->lasterror(); + } + } + } - $sql = "DELETE FROM ".MAIN_DB_PREFIX."product_stock"; - $sql.= " WHERE fk_entrepot = " . $this->id; - dol_syslog(get_class($this)."::delete", LOG_DEBUG); - $resql2=$this->db->query($sql); - - if ($resql1 && $resql2) + if (! $error) { $sql = "DELETE FROM ".MAIN_DB_PREFIX."entrepot"; $sql.= " WHERE rowid = " . $this->id; @@ -275,7 +305,7 @@ class Entrepot extends CommonObject { global $conf; - $sql = "SELECT rowid, label, description, statut, lieu, address, zip, town, fk_pays as country_id"; + $sql = "SELECT rowid, fk_parent, label, description, statut, lieu, address, zip, town, fk_pays as country_id"; $sql .= " FROM ".MAIN_DB_PREFIX."entrepot"; if ($id) @@ -298,6 +328,7 @@ class Entrepot extends CommonObject $obj=$this->db->fetch_object($result); $this->id = $obj->rowid; + $this->fk_parent = $obj->fk_parent; $this->ref = $obj->rowid; $this->libelle = $obj->label; $this->description = $obj->description; @@ -546,7 +577,7 @@ class Entrepot extends CommonObject $result=''; $label = '' . $langs->trans("ShowWarehouse").''; - $label.= '
' . $langs->trans('Ref') . ': ' . $this->libelle; + $label.= '
' . $langs->trans('Ref') . ': ' . (empty($this->label)?$this->libelle:$this->label); if (! empty($this->lieu)) $label.= '
' . $langs->trans('LocationSummary').': '.$this->lieu; @@ -554,7 +585,7 @@ class Entrepot extends CommonObject $linkend=''; if ($withpicto) $result.=($link.img_object($label, 'stock', 'class="classfortooltip"').$linkend.' '); - $result.=$link.$this->libelle.$linkend; + $result.=$link.$this->get_full_arbo().$linkend; return $result; } @@ -585,4 +616,69 @@ class Entrepot extends CommonObject $this->country_id=1; $this->country_code='FR'; } + + /** + * Return full path to current warehouse + * + * @param int $protection Deep counter to avoid infinite loop + * @return string String full path to current warehouse separated by " >> " + */ + function get_full_arbo($protection=1000) { + + global $user,$langs,$conf; + + $TArbo = array($this->libelle); + + $id = $this->id; + + $i=0; + + while((empty($protection) || $i < $protection)) { + $sql = 'SELECT fk_parent + FROM '.MAIN_DB_PREFIX.'entrepot + WHERE rowid = '.$id; + + $resql = $this->db->query($sql); + if($resql) { + $res = $this->db->fetch_object($resql); + if(empty($res->fk_parent)) break; + $id = $res->fk_parent; + $o = new Entrepot($this->db); + $o->fetch($id); + $TArbo[] = $o->libelle; + } else break; + + $i++; + + } + + return implode(' >> ', array_reverse($TArbo)); + + } + + /** + * Return array of children warehouses ids from $id warehouse (recursive function) + * + * @param int $id id parent warehouse + * @param array() $TChildWarehouses array which will contain all children (param by reference) + * @return array() $TChildWarehouses array which will contain all children + */ + function get_children_warehouses($id, &$TChildWarehouses) { + + $sql = 'SELECT rowid + FROM '.MAIN_DB_PREFIX.'entrepot + WHERE fk_parent = '.$id; + + $resql = $this->db->query($sql); + if($resql) { + while($res = $this->db->fetch_object($resql)) { + $TChildWarehouses[] = $res->rowid; + $this->get_children_warehouses($res->rowid, $TChildWarehouses); + } + } + + return $TChildWarehouses; + + } + } diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index a19a39beb45..1532f62aa22 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -149,8 +149,11 @@ class MouvementStock extends CommonObject { if ($eatby) { - if ($this->db->jdate($obj->eatby) != $eatby) // If found and eatby/sellby defined into table and provided and differs, return error + $tmparray=dol_getdate($eatby, true); + $eatbywithouthour=dol_mktime(0, 0, 0, $tmparray['mon'], $tmparray['mday'], $tmparray['year']); + if ($this->db->jdate($obj->eatby) != $eatby && $this->db->jdate($obj->eatby) != $eatbywithouthour) // We test date without hours and with hours for backward compatibility { + // If found and eatby/sellby defined into table and provided and differs, return error $this->errors[]=$langs->trans("ThisSerialAlreadyExistWithDifferentDate", $batch, dol_print_date($this->db->jdate($obj->eatby)), dol_print_date($eatby)); dol_syslog($langs->transnoentities("ThisSerialAlreadyExistWithDifferentDate", $batch, dol_print_date($this->db->jdate($obj->eatby)), dol_print_date($eatby)), LOG_ERR); $this->db->rollback(); @@ -183,8 +186,11 @@ class MouvementStock extends CommonObject { if ($sellby) { - if ($this->db->jdate($obj->sellby) != $sellby) // If found and eatby/sellby defined into table and provided and differs, return error + $tmparray=dol_getdate($sellby, true); + $sellbywithouthour=dol_mktime(0, 0, 0, $tmparray['mon'], $tmparray['mday'], $tmparray['year']); + if ($this->db->jdate($obj->sellby) != $sellby && $this->db->jdate($obj->sellby) != $sellbywithouthour) // We test date without hours and with hours for backward compatibility { + // If found and eatby/sellby defined into table and provided and differs, return error $this->errors[]=$langs->trans("ThisSerialAlreadyExistWithDifferentDate", $batch, dol_print_date($this->db->jdate($obj->sellby)), dol_print_date($sellby)); dol_syslog($langs->transnoentities("ThisSerialAlreadyExistWithDifferentDate", $batch, dol_print_date($this->db->jdate($obj->sellby)), dol_print_date($sellby)), LOG_ERR); $this->db->rollback(); @@ -222,6 +228,9 @@ class MouvementStock extends CommonObject $productlot = new Productlot($this->db); $productlot->fk_product = $fk_product; $productlot->batch = $batch; + // If we are here = first time we manage this batch, so we used dates provided by users to create lot + $productlot->eatby = $eatby; + $productlot->sellby = $sellby; $result = $productlot->create($user); if ($result <= 0) { @@ -239,21 +248,46 @@ class MouvementStock extends CommonObject return -1; } } - - // TODO Check qty is ok for stock move. - if (! empty($conf->productbatch->enabled) && $product->hasbatch() && ! $skip_batch) - { - - } - else - { - - } - + // Define if we must make the stock change (If product type is a service or if stock is used also for services) $movestock=0; if ($product->type != Product::TYPE_SERVICE || ! empty($conf->global->STOCK_SUPPORTS_SERVICES)) $movestock=1; + // Check if stock is enough when qty is < 0 + // Note that qty should be > 0 with type 0 or 3, < 0 with type 1 or 2. + if ($qty < 0 && empty($conf->global->STOCK_ALLOW_NEGATIVE_TRANSFER)) + { + if (! empty($conf->productbatch->enabled) && $product->hasbatch() && ! $skip_batch) + { + $foundforbatch=0; + $qtyisnotenough=0; + foreach($product->stock_warehouse[$entrepot_id]->detail_batch as $batchcursor => $prodbatch) + { + if ($batch != $batchcursor) continue; + $foundforbatch=1; + if ($prodbatch->qty < abs($qty)) $qtyisnotenough=1; + break; + } + if (! $foundforbatch || $qtyisnotenough) + { + $this->error = $langs->trans('qtyToTranferLotIsNotEnough'); + $this->errors[] = $langs->trans('qtyToTranferLotIsNotEnough'); + $this->db->rollback(); + return -8; + } + } + else + { + if (empty($product->stock_warehouse[$entrepot_id]->real) || $product->stock_warehouse[$entrepot_id]->real < abs($qty)) + { + $this->error = $langs->trans('qtyToTranferIsNotEnough'); + $this->errors[] = $langs->trans('qtyToTranferIsNotEnough'); + $this->db->rollback(); + return -8; + } + } + } + if ($movestock && $entrepot_id > 0) // Change stock for current product, change for subproduct is done after { if(!empty($this->origin)) { // This is set by caller for tracking reason @@ -406,8 +440,8 @@ class MouvementStock extends CommonObject // $sql = "UPDATE ".MAIN_DB_PREFIX."product SET pmp = ".$newpmp.", stock = ".$this->db->ifsql("stock IS NULL", 0, "stock") . " + ".$qty; // $sql.= " WHERE rowid = ".$fk_product; // Update pmp + denormalized fields because we change content of produt_stock. Warning: Do not use "SET p.stock", does not works with pgsql - $sql = "UPDATE ".MAIN_DB_PREFIX."product as p SET p.pmp = ".$newpmp.", "; - $sql.= " stock=(SELECT SUM(ps.reel) FROM ".MAIN_DB_PREFIX."product_stock ps WHERE ps.fk_product = p.rowid)"; + $sql = "UPDATE ".MAIN_DB_PREFIX."product as p SET pmp = ".$newpmp.", "; + $sql.= " stock=(SELECT SUM(ps.reel) FROM ".MAIN_DB_PREFIX."product_stock as ps WHERE ps.fk_product = p.rowid)"; $sql.= " WHERE rowid = ".$fk_product; dol_syslog(get_class($this)."::_create", LOG_DEBUG); @@ -526,7 +560,9 @@ class MouvementStock extends CommonObject */ function livraison($user, $fk_product, $entrepot_id, $qty, $price=0, $label='', $datem='', $eatby='', $sellby='', $batch='', $id_product_batch=0) { - $skip_batch = empty($conf->productbatch->enabled); + global $conf; + + $skip_batch = empty($conf->productbatch->enabled); return $this->_create($user, $fk_product, $entrepot_id, (0 - $qty), 2, $price, $label, '', $datem, $eatby, $sellby, $batch, $skip_batch, $id_product_batch); } @@ -717,7 +753,11 @@ class MouvementStock extends CommonObject require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; $origin = new FactureFournisseur($this->db); break; - + case 'project': + require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; + $origin = new Project($this->db); + break; + default: if ($origintype) { diff --git a/htdocs/product/stock/class/productlot.class.php b/htdocs/product/stock/class/productlot.class.php index 9b15ed31fcc..c5f29df67c6 100644 --- a/htdocs/product/stock/class/productlot.class.php +++ b/htdocs/product/stock/class/productlot.class.php @@ -20,10 +20,9 @@ */ /** - * \file stock/productlot.class.php + * \file product/stock/class/productlot.class.php * \ingroup stock - * \brief This file is an example for a CRUD class file (Create/Read/Update/Delete) - * Put some comments here + * \brief This is CRUD class file to manage table productlot (Create/Read/Update/Delete) */ // Put here all includes required by your class file @@ -32,10 +31,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/commonobject.class.php'; //require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; /** - * Class Productlot - * - * Put here description of your class - * @see CommonObject + * Class with list of lots and properties */ class Productlot extends CommonObject { @@ -47,7 +43,12 @@ class Productlot extends CommonObject * @var string Name of table without prefix where object is stored */ public $table_element = 'product_lot'; - + + public $picto='barcode'; + + public $isnolinkedbythird = 1; + public $ismultientitymanaged = 1; + /** * @var ProductlotLine[] Lines */ @@ -123,7 +124,6 @@ class Productlot extends CommonObject // Insert request $sql = 'INSERT INTO ' . MAIN_DB_PREFIX . $this->table_element . '('; - $sql.= 'entity,'; $sql.= 'fk_product,'; $sql.= 'batch,'; @@ -133,10 +133,7 @@ class Productlot extends CommonObject $sql.= 'fk_user_creat,'; $sql.= 'fk_user_modif,'; $sql.= 'import_key'; - - $sql .= ') VALUES ('; - $sql .= ' '.(! isset($this->entity)?'NULL':$this->entity).','; $sql .= ' '.(! isset($this->fk_product)?'NULL':$this->fk_product).','; $sql .= ' '.(! isset($this->batch)?'NULL':"'".$this->db->escape($this->batch)."'").','; @@ -146,8 +143,6 @@ class Productlot extends CommonObject $sql .= ' '.(! isset($this->fk_user_creat)?'NULL':$this->fk_user_creat).','; $sql .= ' '.(! isset($this->fk_user_modif)?'NULL':$this->fk_user_modif).','; $sql .= ' '.(! isset($this->import_key)?'NULL':$this->import_key); - - $sql .= ')'; $this->db->begin(); @@ -166,10 +161,10 @@ class Productlot extends CommonObject // Uncomment this and change MYOBJECT to your own tag if you // want this action to call a trigger. - //// Call triggers - //$result=$this->call_trigger('MYOBJECT_CREATE',$user); - //if ($result < 0) $error++; - //// End call triggers + // Call triggers + $result=$this->call_trigger('PRODUCTLOT_CREATE',$user); + if ($result < 0) $error++; + // End call triggers } } @@ -189,17 +184,17 @@ class Productlot extends CommonObject * Load object in memory from the database * * @param int $id Id object - * @param string $ref Ref + * @param int $product_id Id of product, batch number parameter required + * @param string $batch batch number * * @return int <0 if KO, 0 if not found, >0 if OK */ - public function fetch($id, $ref = null) + public function fetch($id = 0, $product_id = 0, $batch = '') { dol_syslog(__METHOD__, LOG_DEBUG); $sql = 'SELECT'; $sql .= ' t.rowid,'; - $sql .= " t.entity,"; $sql .= " t.fk_product,"; $sql .= " t.batch,"; @@ -210,11 +205,9 @@ class Productlot extends CommonObject $sql .= " t.fk_user_creat,"; $sql .= " t.fk_user_modif,"; $sql .= " t.import_key"; - - $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t'; - if (null !== $ref) { - $sql .= ' WHERE t.ref = ' . '\'' . $ref . '\''; + if ($product_id > 0 && $batch != '') { + $sql .= ' WHERE t.batch = ' . '\'' . $this->db->escape($batch) . '\' AND t.fk_product = ' . $product_id; } else { $sql .= ' WHERE t.rowid = ' . $id; } @@ -226,10 +219,13 @@ class Productlot extends CommonObject $obj = $this->db->fetch_object($resql); $this->id = $obj->rowid; + $this->ref = $obj->rowid; + //$this->ref = $obj->fk_product.'_'.$obj->batch; + + $this->batch = $obj->batch; $this->entity = $obj->entity; $this->fk_product = $obj->fk_product; - $this->batch = $obj->batch; $this->eatby = $this->db->jdate($obj->eatby); $this->sellby = $this->db->jdate($obj->sellby); $this->datec = $this->db->jdate($obj->datec); @@ -238,7 +234,12 @@ class Productlot extends CommonObject $this->fk_user_modif = $obj->fk_user_modif; $this->import_key = $obj->import_key; - + // Retrieve all extrafields for invoice + // fetch optionals attributes and labels + require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; + $extrafields=new ExtraFields($this->db); + $extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true); + $this->fetch_optionals($this->id,$extralabels); } $this->db->free($resql); @@ -311,7 +312,8 @@ class Productlot extends CommonObject if ($resql) { $num = $this->db->num_rows($resql); - while ($obj = $this->db->fetch_object($resql)) { + while ($obj = $this->db->fetch_object($resql)) + { $line = new ProductlotLine(); $line->id = $obj->rowid; @@ -327,8 +329,6 @@ class Productlot extends CommonObject $line->fk_user_modif = $obj->fk_user_modif; $line->import_key = $obj->import_key; - - $this->lines[$line->id] = $line; } $this->db->free($resql); @@ -377,14 +377,11 @@ class Productlot extends CommonObject $this->import_key = trim($this->import_key); } - - // Check parameters // Put here code to add a control on parameters values // Update request $sql = 'UPDATE ' . MAIN_DB_PREFIX . $this->table_element . ' SET'; - $sql .= ' entity = '.(isset($this->entity)?$this->entity:"null").','; $sql .= ' fk_product = '.(isset($this->fk_product)?$this->fk_product:"null").','; $sql .= ' batch = '.(isset($this->batch)?"'".$this->db->escape($this->batch)."'":"null").','; @@ -395,8 +392,6 @@ class Productlot extends CommonObject $sql .= ' fk_user_creat = '.(isset($this->fk_user_creat)?$this->fk_user_creat:"null").','; $sql .= ' fk_user_modif = '.(isset($this->fk_user_modif)?$this->fk_user_modif:"null").','; $sql .= ' import_key = '.(isset($this->import_key)?$this->import_key:"null"); - - $sql .= ' WHERE rowid=' . $this->id; $this->db->begin(); @@ -412,10 +407,10 @@ class Productlot extends CommonObject // Uncomment this and change MYOBJECT to your own tag if you // want this action calls a trigger. - //// Call triggers - //$result=$this->call_trigger('MYOBJECT_MODIFY',$user); - //if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail} - //// End call triggers + // Call triggers + $result=$this->call_trigger('PRODUCTLOT_MODIFY',$user); + if ($result < 0) { $error++; } + // End call triggers } // Commit or rollback @@ -528,9 +523,9 @@ class Productlot extends CommonObject return - 1; } } - + /** - * Return a link to the user card (with optionaly the picto) + * Return a link to the a lot card (with optionaly the picto) * Use this->id,this->lastname, this->firstname * * @param int $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto) @@ -548,83 +543,27 @@ class Productlot extends CommonObject $result = ''; - $companylink = ''; - $label = '' . $langs->trans("MyModule") . ''; + $label = '' . $langs->trans("Batch") . ''; $label.= '
'; - $label.= '' . $langs->trans('Ref') . ': ' . $this->ref; + $label.= '' . $langs->trans('Batch') . ': ' . $this->batch; - $link = 'ref . $linkend; + $result.= $link . $this->batch . $linkend; return $result; } - /** - * Retourne le libelle du status d'un user (actif, inactif) - * - * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto - * @return string Label of status - */ - function getLibStatut($mode=0) - { - return $this->LibStatut($this->status,$mode); - } - - /** - * Renvoi le libelle d'un status donne - * - * @param int $status Id status - * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto - * @return string Label of status - */ - function LibStatut($status,$mode=0) - { - global $langs; - - if ($mode == 0) - { - $prefix=''; - if ($status == 1) return $langs->trans('Enabled'); - if ($status == 0) return $langs->trans('Disabled'); - } - if ($mode == 1) - { - if ($status == 1) return $langs->trans('Enabled'); - if ($status == 0) return $langs->trans('Disabled'); - } - if ($mode == 2) - { - if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); - if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); - } - if ($mode == 3) - { - if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4'); - if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5'); - } - if ($mode == 4) - { - if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); - if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); - } - if ($mode == 5) - { - if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4'); - if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5'); - } - } - - /** + /** * Initialise object with example values * Id must be 0 if object instance is a specimen * @@ -644,8 +583,6 @@ class Productlot extends CommonObject $this->fk_user_creat = ''; $this->fk_user_modif = ''; $this->import_key = ''; - - } } diff --git a/htdocs/product/stock/class/productstockentrepot.class.php b/htdocs/product/stock/class/productstockentrepot.class.php new file mode 100644 index 00000000000..84c1735ff6e --- /dev/null +++ b/htdocs/product/stock/class/productstockentrepot.class.php @@ -0,0 +1,587 @@ + + * Copyright (C) 2014-2016 Juanjo Menent + * Copyright (C) 2015 Florian Henry + * Copyright (C) 2015 Raphaël Doursenaud + * Copyright (C) ---Put here your own copyright and developer email--- + * + * 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 . + */ + +/** + * \file ProductEntrepot/ProductStockEntrepot.class.php + * \ingroup ProductEntrepot + * \brief This file is an example for a CRUD class file (Create/Read/Update/Delete) + * Put some comments here + */ + +// Put here all includes required by your class file +require_once DOL_DOCUMENT_ROOT . '/core/class/commonobject.class.php'; +//require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; +//require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; + +/** + * Class ProductStockEntrepot + * + * Put here description of your class + * + * @see CommonObject + */ +class ProductStockEntrepot extends CommonObject +{ + /** + * @var string Id to identify managed objects + */ + public $element = 'ProductStockEntrepot'; + /** + * @var string Name of table without prefix where object is stored + */ + public $table_element = 'product_warehouse_properties'; + + /** + */ + + public $tms = ''; + public $fk_product; + public $fk_entrepot; + public $seuil_stock_alerte; + public $desiredstock; + public $import_key; + + /** + */ + + + /** + * Constructor + * + * @param DoliDb $db Database handler + */ + public function __construct(DoliDB $db) + { + $this->db = $db; + } + + /** + * Create object into database + * + * @param User $user User that creates + * @param bool $notrigger false=launch triggers after, true=disable triggers + * + * @return int <0 if KO, Id of created object if OK + */ + public function create(User $user, $notrigger = false) + { + dol_syslog(__METHOD__, LOG_DEBUG); + + $error = 0; + + // Clean parameters + + if (isset($this->fk_product)) $this->fk_product = trim($this->fk_product); + if (isset($this->fk_entrepot)) $this->fk_entrepot = trim($this->fk_entrepot); + if (isset($this->seuil_stock_alerte)) $this->seuil_stock_alerte = trim($this->seuil_stock_alerte); + if (isset($this->desiredstock)) $this->desiredstock = trim($this->desiredstock); + if (isset($this->import_key)) $this->import_key = trim($this->import_key); + + // Check parameters + // Put here code to add control on parameters values + + // Insert request + $sql = 'INSERT INTO ' . MAIN_DB_PREFIX . $this->table_element . '('; + + $sql.= 'fk_product,'; + $sql.= 'fk_entrepot,'; + $sql.= 'seuil_stock_alerte,'; + $sql.= 'desiredstock,'; + $sql.= 'import_key'; + + + $sql .= ') VALUES ('; + + $sql .= ' '.(! isset($this->fk_product)?'NULL':$this->fk_product).','; + $sql .= ' '.(! isset($this->fk_entrepot)?'NULL':$this->fk_entrepot).','; + $sql .= ' '.(! isset($this->seuil_stock_alerte)?'0':$this->seuil_stock_alerte).','; + $sql .= ' '.(! isset($this->desiredstock)?'0':$this->desiredstock).','; + $sql .= ' '.(! isset($this->import_key)?'NULL':"'".$this->db->escape($this->import_key)."'"); + + + $sql .= ')'; + + $this->db->begin(); + + $resql = $this->db->query($sql); + if (!$resql) { + $error ++; + $this->errors[] = 'Error ' . $this->db->lasterror(); + dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR); + } + + if (!$error) { + $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . $this->table_element); + + if (!$notrigger) { + // Uncomment this and change MYOBJECT to your own tag if you + // want this action to call a trigger. + + //// Call triggers + //$result=$this->call_trigger('MYOBJECT_CREATE',$user); + //if ($result < 0) $error++; + //// End call triggers + } + } + + // Commit or rollback + if ($error) { + $this->db->rollback(); + + return - 1 * $error; + } else { + $this->db->commit(); + + return $this->id; + } + } + + /** + * Load object in memory from the database + * + * @param int $id Id object + * @param int $fk_product Id product + * @param int $fk_entrepot Id warehouse + * + * @return int <0 if KO, 0 if not found, >0 if OK + */ + public function fetch($id, $fk_product, $fk_entrepot) + { + if(empty($id) && (empty($fk_product) || empty($fk_entrepot))) return -1; + + dol_syslog(__METHOD__, LOG_DEBUG); + + $sql = 'SELECT'; + $sql .= ' t.rowid,'; + + $sql .= " t.tms,"; + $sql .= " t.fk_product,"; + $sql .= " t.fk_entrepot,"; + $sql .= " t.seuil_stock_alerte,"; + $sql .= " t.desiredstock,"; + $sql .= " t.import_key"; + + + $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t'; + if(!empty($id)) $sql .= ' WHERE t.rowid = ' . $id; + else $sql.= ' WHERE t.fk_product = '.$fk_product.' AND t.fk_entrepot = '.$fk_entrepot; + + $resql = $this->db->query($sql); + if ($resql) { + $numrows = $this->db->num_rows($resql); + if ($numrows) { + $obj = $this->db->fetch_object($resql); + + $this->id = $obj->rowid; + + $this->tms = $this->db->jdate($obj->tms); + $this->fk_product = $obj->fk_product; + $this->fk_entrepot = $obj->fk_entrepot; + $this->seuil_stock_alerte = $obj->seuil_stock_alerte; + $this->desiredstock = $obj->desiredstock; + $this->import_key = $obj->import_key; + + + } + + // Retrieve all extrafields for invoice + // fetch optionals attributes and labels + require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; + $extrafields=new ExtraFields($this->db); + $extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true); + $this->fetch_optionals($this->id,$extralabels); + + // $this->fetch_lines(); + + $this->db->free($resql); + + if ($numrows) { + return 1; + } else { + return 0; + } + } else { + $this->errors[] = 'Error ' . $this->db->lasterror(); + dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR); + + return - 1; + } + } + + /** + * Load object in memory from the database + * + * @param int $fk_product Product from which we want to get limit and desired stock by warehouse + * @param int $fk_entrepot Warehouse in which we want to get products limit and desired stock + * @param string $sortorder Sort Order + * @param string $sortfield Sort field + * @param int $limit offset limit + * @param int $offset offset limit + * @param array $filter filter array + * @param string $filtermode filter mode (AND or OR) + * + * @return int <0 if KO, >0 if OK + */ + public function fetchAll($fk_product='', $fk_entrepot='', $sortorder='', $sortfield='', $limit=0, $offset=0, array $filter = array(), $filtermode='AND') + { + dol_syslog(__METHOD__, LOG_DEBUG); + + $sql = 'SELECT'; + $sql .= ' t.rowid,'; + + $sql .= " t.tms,"; + $sql .= " t.fk_product,"; + $sql .= " t.fk_entrepot,"; + $sql .= " t.seuil_stock_alerte,"; + $sql .= " t.desiredstock,"; + $sql .= " t.import_key"; + + + $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element. ' as t'; + + $sql .= ' WHERE 1=1'; + + // Manage filter + $sqlwhere = array(); + if (count($filter) > 0) { + foreach ($filter as $key => $value) { + $sqlwhere [] = $key . ' LIKE \'%' . $this->db->escape($value) . '%\''; + } + } + if (count($sqlwhere) > 0) $sql .= ' AND ' . implode(' '.$filtermode.' ', $sqlwhere); + + if(!empty($fk_product)) $sql .= ' AND fk_product = '.$fk_product; + elseif(!empty($fk_entrepot)) $sql .= ' AND fk_entrepot = '.$fk_entrepot; + // "elseif" used instead of "if" because getting list with specified fk_product and specified fk_entrepot would be the same as doing a fetch + + if (!empty($sortfield)) $sql .= $this->db->order($sortfield,$sortorder); + if (!empty($limit)) $sql .= ' ' . $this->db->plimit($limit + 1, $offset); + + $lines = array(); + + $resql = $this->db->query($sql); + if ($resql) { + + while ($obj = $this->db->fetch_object($resql)) { + $lines[$obj->rowid] = array( + 'id'=>$obj->rowid + ,'fk_product'=>$obj->fk_product + ,'fk_entrepot'=>$obj->fk_entrepot + ,'seuil_stock_alerte'=>$obj->seuil_stock_alerte + ,'desiredstock'=>$obj->desiredstock + ); + } + $this->db->free($resql); + + return $lines; + } else { + $this->errors[] = 'Error ' . $this->db->lasterror(); + dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR); + + return - 1; + } + } + + /** + * Update object into database + * + * @param User $user User that modifies + * @param bool $notrigger false=launch triggers after, true=disable triggers + * + * @return int <0 if KO, >0 if OK + */ + public function update(User $user, $notrigger = false) + { + $error = 0; + + dol_syslog(__METHOD__, LOG_DEBUG); + + // Clean parameters + + if (isset($this->fk_product)) $this->fk_product = trim($this->fk_product); + if (isset($this->fk_entrepot)) $this->fk_entrepot = trim($this->fk_entrepot); + if (isset($this->seuil_stock_alerte)) $this->seuil_stock_alerte = trim($this->seuil_stock_alerte); + if (isset($this->desiredstock)) $this->desiredstock = trim($this->desiredstock); + if (isset($this->import_key)) $this->import_key = trim($this->import_key); + + + // Check parameters + // Put here code to add a control on parameters values + + // Update request + $sql = 'UPDATE ' . MAIN_DB_PREFIX . $this->table_element . ' SET'; + + $sql .= ' tms = '.(dol_strlen($this->tms) != 0 ? "'".$this->db->idate($this->tms)."'" : "'".$this->db->idate(dol_now())."'").','; + $sql .= ' fk_product = '.(isset($this->fk_product)?$this->fk_product:"null").','; + $sql .= ' fk_entrepot = '.(isset($this->fk_entrepot)?$this->fk_entrepot:"null").','; + $sql .= ' seuil_stock_alerte = '.(isset($this->seuil_stock_alerte)?$this->seuil_stock_alerte:"null").','; + $sql .= ' desiredstock = '.(isset($this->desiredstock)?$this->desiredstock:"null").','; + $sql .= ' import_key = '.(isset($this->import_key)?"'".$this->db->escape($this->import_key)."'":"null"); + + + $sql .= ' WHERE rowid=' . $this->id; + + $this->db->begin(); + + $resql = $this->db->query($sql); + if (!$resql) { + $error ++; + $this->errors[] = 'Error ' . $this->db->lasterror(); + dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR); + } + + if (!$error && !$notrigger) { + // Uncomment this and change MYOBJECT to your own tag if you + // want this action calls a trigger. + + //// Call triggers + //$result=$this->call_trigger('MYOBJECT_MODIFY',$user); + //if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail} + //// End call triggers + } + + // Commit or rollback + if ($error) { + $this->db->rollback(); + + return - 1 * $error; + } else { + $this->db->commit(); + + return 1; + } + } + + /** + * Delete object in database + * + * @param User $user User that deletes + * @param bool $notrigger false=launch triggers after, true=disable triggers + * + * @return int <0 if KO, >0 if OK + */ + public function delete(User $user, $notrigger = false) + { + dol_syslog(__METHOD__, LOG_DEBUG); + + $error = 0; + + $this->db->begin(); + + if (!$error) { + if (!$notrigger) { + // Uncomment this and change MYOBJECT to your own tag if you + // want this action calls a trigger. + + //// Call triggers + //$result=$this->call_trigger('MYOBJECT_DELETE',$user); + //if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail} + //// End call triggers + } + } + + if (!$error) { + $sql = 'DELETE FROM ' . MAIN_DB_PREFIX . $this->table_element; + $sql .= ' WHERE rowid=' . $this->id; + + $resql = $this->db->query($sql); + if (!$resql) { + $error ++; + $this->errors[] = 'Error ' . $this->db->lasterror(); + dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR); + } + } + + // Commit or rollback + if ($error) { + $this->db->rollback(); + + return - 1 * $error; + } else { + $this->db->commit(); + + return 1; + } + } + + /** + * Load an object from its id and create a new one in database + * + * @param int $fromid Id of object to clone + * + * @return int New id of clone + */ + public function createFromClone($fromid) + { + dol_syslog(__METHOD__, LOG_DEBUG); + + global $user; + $error = 0; + $object = new ProductStockEntrepot($this->db); + + $this->db->begin(); + + // Load source object + $object->fetch($fromid); + // Reset object + $object->id = 0; + + // Clear fields + // ... + + // Create clone + $result = $object->create($user); + + // Other options + if ($result < 0) { + $error ++; + $this->errors = $object->errors; + dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR); + } + + // End + if (!$error) { + $this->db->commit(); + + return $object->id; + } else { + $this->db->rollback(); + + return - 1; + } + } + + /** + * Return a link to the user card (with optionaly the picto) + * Use this->id,this->lastname, this->firstname + * + * @param int $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto) + * @param string $option On what the link point to + * @param integer $notooltip 1=Disable tooltip + * @param int $maxlen Max length of visible user name + * @param string $morecss Add more css on link + * @return string String with URL + */ + function getNomUrl($withpicto=0, $option='', $notooltip=0, $maxlen=24, $morecss='') + { + global $langs, $conf, $db; + global $dolibarr_main_authentication, $dolibarr_main_demo; + global $menumanager; + + + $result = ''; + $companylink = ''; + + $label = '' . $langs->trans("MyModule") . ''; + $label.= '
'; + $label.= '' . $langs->trans('Ref') . ': ' . $this->ref; + + $link = 'ref . $linkend; + return $result; + } + + /** + * Retourne le libelle du status d'un user (actif, inactif) + * + * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto + * @return string Label of status + */ + function getLibStatut($mode=0) + { + return $this->LibStatut($this->status,$mode); + } + + /** + * Renvoi le libelle d'un status donne + * + * @param int $status Id status + * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto + * @return string Label of status + */ + function LibStatut($status,$mode=0) + { + global $langs; + + if ($mode == 0) + { + $prefix=''; + if ($status == 1) return $langs->trans('Enabled'); + if ($status == 0) return $langs->trans('Disabled'); + } + if ($mode == 1) + { + if ($status == 1) return $langs->trans('Enabled'); + if ($status == 0) return $langs->trans('Disabled'); + } + if ($mode == 2) + { + if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); + if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); + } + if ($mode == 3) + { + if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4'); + if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5'); + } + if ($mode == 4) + { + if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); + if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); + } + if ($mode == 5) + { + if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4'); + if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5'); + } + } + + + /** + * Initialise object with example values + * Id must be 0 if object instance is a specimen + * + * @return void + */ + public function initAsSpecimen() + { + $this->id = 0; + + $this->tms = ''; + $this->fk_product = ''; + $this->fk_entrepot = ''; + $this->seuil_stock_alerte = ''; + $this->desiredstock = ''; + $this->import_key = ''; + + + } + +} diff --git a/htdocs/product/stock/index.php b/htdocs/product/stock/index.php index 8cff20cfc34..5f075370df6 100644 --- a/htdocs/product/stock/index.php +++ b/htdocs/product/stock/index.php @@ -136,11 +136,11 @@ if ($resql) if (! empty($conf->productbatch->enabled)) { print '
'.$langs->trans("Batch").''.$langs->trans("l_eatby").''.$langs->trans("l_sellby").''.$langs->trans("EatByDate").''.$langs->trans("SellByDate").''.$langs->trans("Warehouse").''.$langs->trans("FullList").''.$langs->trans("FullList").'
'; -dol_print_object_info($entrepot); -print '
'; +$linkback = ''.$langs->trans("BackToList").''; + +$morehtmlref='
'; +$morehtmlref.=$langs->trans("LocationSummary").' : '.$object->lieu; +$morehtmlref.='
'; + +dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'libelle', $morehtmlref); + + +print '
'; +print '
'; + +print '
'; + +dol_print_object_info($object); print '
'; diff --git a/htdocs/product/stock/list.php b/htdocs/product/stock/list.php index a1f19958cc9..0498c32bf05 100644 --- a/htdocs/product/stock/list.php +++ b/htdocs/product/stock/list.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2015 Laurent Destailleur + * Copyright (C) 2004-2016 Laurent Destailleur * Copyright (C) 2005-2014 Regis Houssin * Copyright (C) 2015 Juanjo Menent * @@ -59,6 +59,21 @@ $fieldstosearchall = array( ); +/* + * Actions + */ + +include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; + +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers +{ + $search_ref=""; + $sall=""; + $search_label=""; + $search_status=""; + $search_array_options=array(); +} + /* * View @@ -110,6 +125,10 @@ if ($result) $param=''; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; + if ($search_ref) $param.="&search_ref=".$search_ref; + if ($search_label) $param.="&search_label=".$search_label; + if ($search_status) $param.="&search_status=".$search_status; + if ($sall) $param.="&sall=".$sall; print '
'; print ''; @@ -126,14 +145,14 @@ if ($result) } $moreforfilter=''; - + print ''; print ""; print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"], "e.label","",$param,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("LocationSummary"),$_SERVER["PHP_SELF"], "e.lieu","",$param,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("PhysicalStock"), $_SERVER["PHP_SELF"], "stockqty",'',$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("EstimatedStockValue"), $_SERVER["PHP_SELF"], "e.valo_pmp",'',$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("EstimatedStockValue"), $_SERVER["PHP_SELF"], "estimatedvalue",'',$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("EstimatedStockValueSell"), $_SERVER["PHP_SELF"], "",'',$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"], "e.statut",'',$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'',$param,'',$sortfield,$sortorder,'maxwidthsearch '); diff --git a/htdocs/product/stock/mouvement.php b/htdocs/product/stock/mouvement.php index 8c5f55fb8af..2e7c470639c 100644 --- a/htdocs/product/stock/mouvement.php +++ b/htdocs/product/stock/mouvement.php @@ -128,8 +128,12 @@ if ($action == "correct_stock") if ($product->hasbatch()) { $batch=GETPOST('batch_number'); - $eatby=GETPOST('eatby'); - $sellby=GETPOST('sellby'); + + //$eatby=GETPOST('eatby'); + //$sellby=GETPOST('sellby'); + $eatby=dol_mktime(12, 0, 0, GETPOST('eatbymonth'), GETPOST('eatbyday'), GETPOST('eatbyyear')); + $sellby=dol_mktime(12, 0, 0, GETPOST('sellbymonth'), GETPOST('sellbyday'), GETPOST('sellbyyear')); + $result=$product->correct_stock_batch( $user, $id, @@ -406,8 +410,8 @@ if ($resql) if ($id > 0) { - $entrepot = new Entrepot($db); - $result = $entrepot->fetch($id); + $object = new Entrepot($db); + $result = $object->fetch($id); if ($result < 0) { dol_print_error($db); @@ -426,69 +430,60 @@ if ($resql) */ if ($id) { - $head = stock_prepare_head($entrepot); + $head = stock_prepare_head($object); dol_fiche_head($head, 'movements', $langs->trans("Warehouse"), 0, 'stock'); - + + $linkback = ''.$langs->trans("BackToList").''; + + $morehtmlref='
'; + $morehtmlref.=$langs->trans("LocationSummary").' : '.$object->lieu; + $morehtmlref.='
'; + + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'libelle', $morehtmlref); + + + print '
'; + print '
'; + print '
'; + print '
'; - $linkback = ''.$langs->trans("BackToList").''; - - // Ref - print ''; - - print ''; - // Description - print ''; + print ''; - // Address - print ''; - - // Town - print ''; - print ''; - - // Country - print ''; - - // Status - print ''; - - $calcproductsunique=$entrepot->nb_different_products(); - $calcproducts=$entrepot->nb_products(); + $calcproductsunique=$object->nb_different_products(); + $calcproducts=$object->nb_products(); // Total nb of different products - print '"; // Nb of products - print '"; + print '
'.$langs->trans("Ref").''; - print $form->showrefnav($entrepot, 'id', $linkback, 1, 'rowid', 'libelle'); - print '
'.$langs->trans("LocationSummary").''.$entrepot->lieu.'
'.$langs->trans("Description").''.dol_htmlentitiesbr($entrepot->description).'
'.$langs->trans("Description").''.dol_htmlentitiesbr($object->description).'
'.$langs->trans('Address').''; - print $entrepot->address; - print '
'.$langs->trans('Zip').''.$entrepot->zip.''.$langs->trans('Town').''.$entrepot->town.'
'.$langs->trans('Country').''; - if (! empty($entrepot->country_code)) - { - $img=picto_from_langcode($entrepot->country_code); - print ($img?$img.' ':''); - print $entrepot->country; - } - print '
'.$langs->trans("Status").''.$entrepot->getLibStatut(4).'
'.$langs->trans("NumberOfDifferentProducts").''; + print '
'.$langs->trans("NumberOfDifferentProducts").''; print empty($calcproductsunique['nb'])?'0':$calcproductsunique['nb']; print "
'.$langs->trans("NumberOfProducts").''; + print '
'.$langs->trans("NumberOfProducts").''; print empty($calcproducts['nb'])?'0':$calcproducts['nb']; print "
'; + + print ''; + print '
'; + print '
'; + print '
'; + + print ''; + // Value - print '"; // Last movement $sql = "SELECT MAX(m.datem) as datem"; $sql .= " FROM ".MAIN_DB_PREFIX."stock_mouvement as m"; - $sql .= " WHERE m.fk_entrepot = '".$entrepot->id."'"; + $sql .= " WHERE m.fk_entrepot = '".$object->id."'"; $resqlbis = $db->query($sql); if ($resqlbis) { @@ -500,7 +495,7 @@ if ($resql) dol_print_error($db); } - print '
'.$langs->trans("EstimatedStockValueShort").''; + print '
'.$langs->trans("EstimatedStockValueShort").''; print price((empty($calcproducts['value'])?'0':price2num($calcproducts['value'],'MT')), 0, $langs, 0, -1, -1, $conf->currency); print "
'.$langs->trans("LastMovement").''; + print '
'.$langs->trans("LastMovement").''; if ($lastmovementdate) { print dol_print_date($lastmovementdate,'dayhour'); @@ -513,6 +508,12 @@ if ($resql) print "
"; + print '
'; + print '
'; + print ''; + + print '
'; + dol_fiche_end(); } @@ -522,7 +523,6 @@ if ($resql) */ if ($action == "correction") { - if ($id) $object=$entrepot; include DOL_DOCUMENT_ROOT.'/product/stock/tpl/stockcorrection.tpl.php'; print '
'; } @@ -532,7 +532,6 @@ if ($resql) */ if ($action == "transfert") { - if ($id) $object=$entrepot; include DOL_DOCUMENT_ROOT.'/product/stock/tpl/stocktransfer.tpl.php'; print '
'; } @@ -607,8 +606,8 @@ if ($resql) { $langs->load("productbatch"); print_liste_field_titre($langs->trans("BatchNumberShort"),$_SERVER["PHP_SELF"],'m.batch','',$param,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("l_eatby"),$_SERVER["PHP_SELF"],'m.eatby','',$param,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("l_sellby"),$_SERVER["PHP_SELF"],'m.sellby','',$param,'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("EatByDate"),$_SERVER["PHP_SELF"],'m.eatby','',$param,'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("SellByDate"),$_SERVER["PHP_SELF"],'m.sellby','',$param,'align="center"',$sortfield,$sortorder); } if (! $id > 0) print_liste_field_titre($langs->trans("Warehouse"),$_SERVER["PHP_SELF"], "","",$param,"",$sortfield,$sortorder); // We are on a specific warehouse card, no filter on other should be possible print_liste_field_titre($langs->trans("Author"),$_SERVER["PHP_SELF"], "m.fk_user_author","",$param,"",$sortfield,$sortorder); @@ -647,7 +646,7 @@ if ($resql) // Warehouse if (! $id > 0) { - print ''; + print ''; //print ''; print $formproduct->selectWarehouses($search_warehouse, 'search_warehouse', '', 1); print ''; diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index d8051465626..4482e249410 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -35,6 +35,7 @@ require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; +require_once DOL_DOCUMENT_ROOT.'/product/stock/class/productstockentrepot.class.php'; if (! empty($conf->productbatch->enabled)) require_once DOL_DOCUMENT_ROOT.'/product/class/productbatch.class.php'; $langs->load("products"); @@ -50,7 +51,7 @@ $cancel=GETPOST('cancel'); $id=GETPOST('id', 'int'); $ref=GETPOST('ref', 'alpha'); -$stocklimit = GETPOST('stocklimit'); +$stocklimit = GETPOST('seuil_stock_alerte'); $desiredstock = GETPOST('desiredstock'); $cancel = GETPOST('cancel'); $fieldid = isset($_GET["ref"])?'ref':'rowid'; @@ -63,14 +64,99 @@ if ($user->societe_id) $socid=$user->societe_id; $result=restrictedArea($user,'produit&stock',$id,'product&product','','',$fieldid); +$object = new Product($db); +$extrafields = new ExtraFields($db); + +// fetch optionals attributes and labels +$extralabels=$extrafields->fetch_name_optionals_label($object->table_element); + +if ($id > 0 || ! empty($ref)) +{ + $result = $object->fetch($id, $ref); + +} +$modulepart='product'; + +// Get object canvas (By default, this is not defined, so standard usage of dolibarr) +$canvas = !empty($object->canvas)?$object->canvas:GETPOST("canvas"); +$objcanvas=null; +if (! empty($canvas)) +{ + require_once DOL_DOCUMENT_ROOT.'/core/class/canvas.class.php'; + $objcanvas = new Canvas($db,$action); + $objcanvas->getCanvas('stockproduct','card',$canvas); +} + +// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +$hookmanager->initHooks(array('stockproductcard','globalcard')); + + /* * Actions */ if ($cancel) $action=''; +$parameters=array('id'=>$id, 'ref'=>$ref, 'objcanvas'=>$objcanvas); +$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + +if($action == 'addlimitstockwarehouse') { + + $seuil_stock_alerte = GETPOST('seuil_stock_alerte'); + $desiredstock = GETPOST('desiredstock'); + + $maj_ok = true; + if($seuil_stock_alerte == '') { + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("StockLimit")), null, 'errors'); + $maj_ok = false; + } + if($desiredstock == '') { + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DesiredStock")), null, 'errors'); + $maj_ok = false; + } + + if($maj_ok) { + + $pse = new ProductStockEntrepot($db); + if($pse->fetch('', GETPOST('id'), GETPOST('fk_entrepot')) > 0) { + + // Update + $pse->seuil_stock_alerte = $seuil_stock_alerte; + $pse->desiredstock = $desiredstock; + if($pse->update($user) > 0) setEventMessage($langs->trans('ProductStockWarehouseUpdated')); + + } else { + + // Create + $pse->fk_entrepot = GETPOST('fk_entrepot'); + $pse->fk_product = GETPOST('id'); + $pse->seuil_stock_alerte = GETPOST('seuil_stock_alerte'); + $pse->desiredstock = GETPOST('desiredstock'); + if($pse->create($user) > 0) setEventMessage($langs->trans('ProductStockWarehouseCreated')); + + } + + } + + header("Location: ".$_SERVER["PHP_SELF"]."?id=".GETPOST('id')); + exit; + +} + +if($action == 'delete_productstockwarehouse') +{ + + $pse = new ProductStockEntrepot($db); + $pse->fetch(GETPOST('fk_productstockwarehouse')); + if($pse->delete($user) > 0) setEventMessage($langs->trans('ProductStockWarehouseDeleted')); + + $action = ''; + +} + // Set stock limit -if ($action == 'setstocklimit') +if ($action == 'setseuil_stock_alerte') { $object = new Product($db); $result=$object->fetch($id); @@ -78,6 +164,8 @@ if ($action == 'setstocklimit') $result=$object->update($object->id,$user,0,'update'); if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); + //else + // setEventMessage($lans->trans("SavedRecordSuccessfully")); $action=''; } @@ -231,7 +319,7 @@ if ($action == "transfert_stock" && ! $cancel) $pricesrc=0; if (isset($object->pmp)) $pricesrc=$object->pmp; $pricedest=$pricesrc; - + if ($object->hasbatch()) { $pdluo = new Productbatch($db); @@ -322,6 +410,8 @@ if ($action == "transfert_stock" && ! $cancel) if ($result2 < 0) $error++; } } + + if (! $error && $result1 >= 0 && $result2 >= 0) { $db->commit(); @@ -405,8 +495,21 @@ if ($id > 0 || $ref) $object->load_stock(); - $help_url='EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks'; - llxHeader("",$langs->trans("CardProduct".$object->type),$help_url); + $title = $langs->trans('ProductServiceCard'); + $helpurl = ''; + $shortlabel = dol_trunc($object->label,16); + if (GETPOST("type") == '0' || ($object->type == Product::TYPE_PRODUCT)) + { + $title = $langs->trans('Product')." ". $shortlabel ." - ".$langs->trans('Stock'); + $helpurl='EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos'; + } + if (GETPOST("type") == '1' || ($object->type == Product::TYPE_SERVICE)) + { + $title = $langs->trans('Service')." ". $shortlabel ." - ".$langs->trans('Stock'); + $helpurl='EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios'; + } + + llxHeader('', $title, $helpurl); if ($result > 0) { @@ -488,7 +591,11 @@ if ($id > 0 || $ref) print ''.$form->editfieldkey("StockLimit",'seuil_stock_alerte',$object->seuil_stock_alerte,$object,$user->rights->produit->creer).''; print $form->editfieldval("StockLimit",'seuil_stock_alerte',$object->seuil_stock_alerte,$object,$user->rights->produit->creer,'string'); print ''; - + + // Hook formObject + $parameters=array('colspan' => 3); + $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook + // Desired stock print ''.$form->editfieldkey($form->textwithpicto($langs->trans("DesiredStock"), $langs->trans("DesiredStockDesc"), 1),'desiredstock',$object->desiredstock,$object,$user->rights->produit->creer); print ''; @@ -647,28 +754,33 @@ else /* */ /* ************************************************************************** */ +$parameters=array(); -if (empty($action) && $object->id) +$reshook=$hookmanager->executeHooks('addMoreActionsButtons',$parameters,$object,$action); // Note that $action and $object may have been modified by hook +if (empty($reshook)) { - print "
\n"; - if ($user->rights->stock->mouvement->creer) - { - print ''.$langs->trans("StockCorrection").''; - } - - //if (($user->rights->stock->mouvement->creer) && ! $object->hasbatch()) - if ($user->rights->stock->mouvement->creer) + if (empty($action) && $object->id) { - print ''.$langs->trans("StockTransfer").''; + print "
\n"; + + if ($user->rights->stock->mouvement->creer) + { + print ''.$langs->trans("StockCorrection").''; + } + + //if (($user->rights->stock->mouvement->creer) && ! $object->hasbatch()) + if ($user->rights->stock->mouvement->creer) + { + print ''.$langs->trans("StockTransfer").''; + } + + print '
'; } - print '
'; } - - /* * Stock detail (by warehouse). May go down into batch details. */ @@ -685,8 +797,8 @@ if ((! empty($conf->productbatch->enabled)) && $object->hasbatch()) { print ''; print ''.$langs->trans("batch_number").''; - print ''.$langs->trans("l_eatby").''; - print ''.$langs->trans("l_sellby").''; + print ''.$langs->trans("EatByDate").''; + print ''.$langs->trans("SellByDate").''; print ''; print ''; } @@ -807,6 +919,49 @@ print ''; print ""; print ""; +if(!empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE)) { + + print '

'; + print_titre($langs->trans('AddNewProductStockWarehouse')); + //print '
'; + + print ''; + print ''; + print ''; + print ''; + + print ''; + print ''; + print ''; + print ''; + print ''; + + $pse = new ProductStockEntrepot($db); + $lines = $pse->fetchAll(GETPOST('id')); + + if(!empty($lines)) { + + $var=false; + foreach($lines as $line) { + + $ent = new Entrepot($db); + $ent->fetch($line['fk_entrepot']); + print ''; + print ''; + print ''; + print ''; + print ''; + $var=!$var; + + } + + } + + print "
'.$formproduct->selectWarehouses('', 'fk_entrepot').'
'.$ent->getNomUrl(3).''.$line['seuil_stock_alerte'].''.$line['desiredstock'].''.img_delete().'
"; + + print '
'; + +} llxFooter(); diff --git a/htdocs/product/stock/productlot_card.php b/htdocs/product/stock/productlot_card.php index 4af5b8a4d59..3407c75a6f5 100644 --- a/htdocs/product/stock/productlot_card.php +++ b/htdocs/product/stock/productlot_card.php @@ -17,24 +17,12 @@ */ /** - * \file stock/productlot_card.php + * \file product/stock/productlot_card.php * \ingroup stock * \brief This file is an example of a php page * Initialy built by build_class_from_table on 2016-05-17 12:22 */ -//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); -//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); -//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); -//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); -//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1'); // Do not check anti CSRF attack test -//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK','1'); // Do not check style html tag into posted data -//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Do not check anti POST attack test -//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); // If there is no need to load and show top and left menu -//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); // If we don't need to load the html.form.class.php -//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); -//if (! defined("NOLOGIN")) define("NOLOGIN",'1'); // If this page is public (can be called outside logged session) - // Change this following line to use the correct relative path (../, ../../, etc) $res=0; if (! $res && file_exists("../main.inc.php")) $res=@include '../main.inc.php'; // to work if your module directory is into dolibarr root htdocs directory @@ -44,18 +32,23 @@ if (! $res && file_exists("../../../../dolibarr/htdocs/main.inc.php")) $res=@inc if (! $res) die("Include of main fails"); // Change this following line to use the correct relative path from htdocs include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'); -dol_include_once('/stock/class/productlot.class.php'); +include_once(DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'); +include_once(DOL_DOCUMENT_ROOT.'/product/class/product.class.php'); +require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; +dol_include_once('/product/stock/class/productlot.class.php'); // Load traductions files requiredby by page $langs->load("stock"); $langs->load("other"); +$langs->load("productbatch"); // Get parameters $id = GETPOST('id','int'); $action = GETPOST('action','alpha'); $backtopage = GETPOST('backtopage'); -$myparam = GETPOST('myparam','alpha'); - +$batch = GETPOST('batch','alpha'); +$productid = GETPOST('productid','int'); +$ref = GETPOST('ref','alpha'); // ref is productid_batch $search_entity=GETPOST('search_entity','int'); $search_fk_product=GETPOST('search_fk_product','int'); @@ -64,35 +57,48 @@ $search_fk_user_creat=GETPOST('search_fk_user_creat','int'); $search_fk_user_modif=GETPOST('search_fk_user_modif','int'); $search_import_key=GETPOST('search_import_key','int'); +if (empty($action) && empty($id) && empty($ref)) $action='list'; // Protection if external user if ($user->societe_id > 0) { - //accessforbidden(); + //accessforbidden(); } +//$result = restrictedArea($user, 'mymodule', $id); -if (empty($action) && empty($id) && empty($ref)) $action='list'; -// Load object if id or ref is provided as parameter -$object=new Productlot($db); -if (($id > 0 || ! empty($ref)) && $action != 'add') +$object = new ProductLot($db); +$extrafields = new ExtraFields($db); + +// fetch optionals attributes and labels +$extralabels = $extrafields->fetch_name_optionals_label($object->table_element); + +// Load object +//include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals +if ($id || $ref) { - $result=$object->fetch($id,$ref); - if ($result < 0) dol_print_error($db); + if ($ref) + { + $tmp=explode('_',$ref); + $productid=$tmp[0]; + $batch=$tmp[1]; + } + $object->fetch($id, $productid, $batch); } // Initialize technical object to manage hooks of modules. Note that conf->hooks_modules contains array array -$hookmanager->initHooks(array('productlot')); -$extrafields = new ExtraFields($db); +$hookmanager->initHooks(array('productlotcard','globalcard')); +$permissionnote = $user->rights->stock->creer; // Used by the include of actions_setnotes.inc.php +$permissiondellink = $user->rights->stock->creer; // Used by the include of actions_dellink.inc.php +$permissionedit = $user->rights->stock->creer; // Used by the include of actions_lineupdown.inc.php -/******************************************************************* -* ACTIONS -* -* Put here all code to do according to value of "action" parameter -********************************************************************/ + +/* + * Actions + */ $parameters=array(); $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks @@ -100,6 +106,47 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e if (empty($reshook)) { + if ($action == 'seteatby' && $user->rights->stock->creer) + { + $newvalue = dol_mktime(12, 0, 0, $_POST['eatbymonth'], $_POST['eatbyday'], $_POST['eatbyyear']); + $result = $object->setValueFrom('eatby', $newvalue, '', null, 'date', '', $user, 'PRODUCTLOT_MODIFY'); + if ($result < 0) dol_print_error($db, $object->error); + } + + if ($action == 'setsellby' && $user->rights->stock->creer) + { + $newvalue=dol_mktime(12, 0, 0, $_POST['sellbymonth'], $_POST['sellbyday'], $_POST['sellbyyear']); + $result = $object->setValueFrom('sellby', $newvalue, '', null, 'date', '', $user, 'PRODUCTLOT_MODIFY'); + if ($result < 0) dol_print_error($db, $object->error); + } + + if ($action == 'update_extras') + { + // Fill array 'array_options' with data from update form + $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); + $ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute')); + if ($ret < 0) $error++; + + if (! $error) + { + // Actions on extra fields (by external module or standard code) + $hookmanager->initHooks(array('productlotdao')); + $parameters = array('id' => $object->id); + $reshook = $hookmanager->executeHooks('insertExtraFields', $parameters, $object, $action); // Note that $action and $object may have been modified by + // some hooks + if (empty($reshook)) { + $result = $object->insertExtraFields(); + if ($result < 0) { + $error++; + } + } else if ($reshook < 0) + $error++; + } + + if ($error) + $action = 'edit_extras'; + } + // Action to add record if ($action == 'add') { @@ -114,14 +161,12 @@ if (empty($reshook)) /* object_prop_getpost_prop */ - $object->entity=GETPOST('entity','int'); - $object->fk_product=GETPOST('fk_product','int'); - $object->batch=GETPOST('batch','alpha'); - $object->fk_user_creat=GETPOST('fk_user_creat','int'); - $object->fk_user_modif=GETPOST('fk_user_modif','int'); - $object->import_key=GETPOST('import_key','int'); - - + $object->entity=GETPOST('entity','int'); + $object->fk_product=GETPOST('fk_product','int'); + $object->batch=GETPOST('batch','alpha'); + $object->fk_user_creat=GETPOST('fk_user_creat','int'); + $object->fk_user_modif=GETPOST('fk_user_modif','int'); + $object->import_key=GETPOST('import_key','int'); if (empty($object->ref)) { @@ -159,16 +204,13 @@ if (empty($reshook)) if ($action == 'update' && ! GETPOST('cancel')) { $error=0; - - - $object->entity=GETPOST('entity','int'); - $object->fk_product=GETPOST('fk_product','int'); - $object->batch=GETPOST('batch','alpha'); - $object->fk_user_creat=GETPOST('fk_user_creat','int'); - $object->fk_user_modif=GETPOST('fk_user_modif','int'); - $object->import_key=GETPOST('import_key','int'); - + $object->entity=GETPOST('entity','int'); + $object->fk_product=GETPOST('fk_product','int'); + $object->batch=GETPOST('batch','alpha'); + $object->fk_user_creat=GETPOST('fk_user_creat','int'); + $object->fk_user_modif=GETPOST('fk_user_modif','int'); + $object->import_key=GETPOST('import_key','int'); if (empty($object->ref)) { @@ -219,13 +261,11 @@ if (empty($reshook)) -/*************************************************** -* VIEW -* -* Put here all code to build page -****************************************************/ +/* + * View + */ -llxHeader('','MyPageName',''); +llxHeader('','ProductLot',''); $form=new Form($db); @@ -251,7 +291,7 @@ jQuery(document).ready(function() { // Part to create if ($action == 'create') { - print load_fiche_titre($langs->trans("NewMyModule")); + print load_fiche_titre($langs->trans("Batch")); print '
'; print ''; @@ -262,12 +302,12 @@ if ($action == 'create') print ''."\n"; // print ''; // -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; print '
'.$langs->trans("Label").'
'.$langs->trans("Fieldentity").'
'.$langs->trans("Fieldfk_product").'
'.$langs->trans("Fieldbatch").'
'.$langs->trans("Fieldfk_user_creat").'
'.$langs->trans("Fieldfk_user_modif").'
'.$langs->trans("Fieldimport_key").'
'.$langs->trans("Fieldentity").'
'.$langs->trans("Fieldfk_product").'
'.$langs->trans("Fieldbatch").'
'.$langs->trans("Fieldfk_user_creat").'
'.$langs->trans("Fieldfk_user_modif").'
'.$langs->trans("Fieldimport_key").'
'."\n"; @@ -279,64 +319,60 @@ print ''.$langs->trans("Fieldimport_key").'trans("MyModule")); - - print ''; - print ''; - print ''; - print ''; - - dol_fiche_head(); - - print ''."\n"; - // print ''; - // -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; - - print '
'.$langs->trans("Label").'
'.$langs->trans("Fieldentity").'
'.$langs->trans("Fieldfk_product").'
'.$langs->trans("Fieldbatch").'
'.$langs->trans("Fieldfk_user_creat").'
'.$langs->trans("Fieldfk_user_modif").'
'.$langs->trans("Fieldimport_key").'
'; - - dol_fiche_end(); - - print '
'; - print '   '; - print '
'; - - print ''; -} - - - // Part to show record -if ($id && (empty($action) || $action == 'view' || $action == 'delete')) +if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'))) { - print load_fiche_titre($langs->trans("MyModule")); + $res = $object->fetch_optionals($object->id, $extralabels); + + //print load_fiche_titre($langs->trans("Batch")); - dol_fiche_head(); - + $head = productlot_prepare_head($object); + dol_fiche_head($head, 'card', $langs->trans("Batch"), 0, 'barcode'); + + if ($action == 'delete') { - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteMyOjbect'), $langs->trans('ConfirmDeleteMyObject'), 'confirm_delete', '', 0, 1); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteBatch'), $langs->trans('ConfirmDeleteBatch'), 'confirm_delete', '', 0, 1); print $formconfirm; } print ''."\n"; - // print ''; - // -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; + + $linkback = '' . $langs->trans("BackToList") . ''; + + // Ref + print ''; + print ''; + print ''; + + // Product + print ''; + // Eat by + print ''; + print ''; + + // Sell by + print ''; + print ''; + + // Other attributes + $cols = 2; + include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; + print '
'.$langs->trans("Label").'
'.$langs->trans("Fieldentity").'$object->entity
'.$langs->trans("Fieldfk_product").'$object->fk_product
'.$langs->trans("Fieldbatch").'$object->batch
'.$langs->trans("Fieldfk_user_creat").'$object->fk_user_creat
'.$langs->trans("Fieldfk_user_modif").'$object->fk_user_modif
'.$langs->trans("Fieldimport_key").'$object->import_key
' . $langs->trans('Batch') . ''; + print $form->showrefnav($object, 'id', $linkback, 1, 'rowid', 'batch'); + print '
'.$langs->trans("Product").''; + $producttmp = new Product($db); + $producttmp->fetch($object->fk_product); + print $producttmp->getNomUrl(1, 'stock'); + print '
'; + print $form->editfieldkey($langs->trans('Eatby'), 'eatby', $object->eatby, $object, $user->rights->stock->creer, 'datepicker'); + print ''; + print $form->editfieldval($langs->trans('Eatby'), 'eatby', $object->eatby, $object, $user->rights->stock->creer, 'datepicker'); + print '
'; + print $form->editfieldkey($langs->trans('Sellby'), 'sellby', $object->sellby, $object, $user->rights->stock->creer, 'datepicker'); + print ''; + print $form->editfieldval($langs->trans('Sellby'), 'sellby', $object->sellby, $object, $user->rights->stock->creer, 'datepicker'); + print '
'; dol_fiche_end(); @@ -350,23 +386,23 @@ print ''.$langs->trans("Fieldimport_key").'rights->stock->write) +/*TODO if ($user->rights->stock->lire) { print ''."\n"; } - if ($user->rights->stock->delete) + if ($user->rights->stock->supprimer) { print ''."\n"; } +*/ } print ''."\n"; - - - // Example 2 : Adding links to objects - //$somethingshown=$form->showLinkedObjectBlock($object); - //$linktoelem = $form->showLinkToObjectBlock($object); - //if ($linktoelem) print '
'.$linktoelem; + + + print ''.$langs->trans("ShowCurrentStockOfLot").'
'; + print '
'; + print ''.$langs->trans("ShowLogOfMovementIfLot").'
'; } diff --git a/htdocs/product/stock/productlot_list.php b/htdocs/product/stock/productlot_list.php index 65bd340fa85..ecd14237787 100644 --- a/htdocs/product/stock/productlot_list.php +++ b/htdocs/product/stock/productlot_list.php @@ -1,6 +1,5 @@ - * Copyright (C) ---Put here your own copyright and developer email--- +/* Copyright (C) 2007-2016 Laurent Destailleur * * 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 @@ -17,24 +16,12 @@ */ /** - * \file stock/productlot_list.php + * \file product/stock/productlot_list.php * \ingroup stock * \brief This file is an example of a php page * Initialy built by build_class_from_table on 2016-05-17 12:22 */ -//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); -//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); -//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); -//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); -//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1'); // Do not check anti CSRF attack test -//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK','1'); // Do not check style html tag into posted data -//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Do not check anti POST attack test -//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); // If there is no need to load and show top and left menu -//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); // If we don't need to load the html.form.class.php -//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); -//if (! defined("NOLOGIN")) define("NOLOGIN",'1'); // If this page is public (can be called outside logged session) - // Change this following line to use the correct relative path (../, ../../, etc) $res=0; if (! $res && file_exists("../main.inc.php")) $res=@include '../main.inc.php'; // to work if your module directory is into dolibarr root htdocs directory @@ -46,11 +33,14 @@ if (! $res) die("Include of main fails"); require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'); require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; -dol_include_once('/stock/class/productlot.class.php'); +require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; +dol_include_once('/product/stock/class/productlot.class.php'); // Load traductions files requiredby by page -$langs->load("stock"); +$langs->load("stocks"); +$langs->load("productbatch"); $langs->load("other"); +$langs->load("users"); // Get parameters $id = GETPOST('id','int'); @@ -60,7 +50,7 @@ $myparam = GETPOST('myparam','alpha'); $search_entity=GETPOST('search_entity','int'); -$search_fk_product=GETPOST('search_fk_product','int'); +$search_product=GETPOST('search_product','alpha'); $search_batch=GETPOST('search_batch','alpha'); $search_fk_user_creat=GETPOST('search_fk_user_creat','int'); $search_fk_user_modif=GETPOST('search_fk_user_modif','int'); @@ -79,7 +69,7 @@ if ($page == -1) { $page = 0; } $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; -if (! $sortfield) $sortfield="t.rowid"; // Set here default search field +if (! $sortfield) $sortfield="t.batch"; // Set here default search field if (! $sortorder) $sortorder="ASC"; // Protection if external user @@ -91,34 +81,31 @@ if ($user->societe_id > 0) } // Initialize technical object to manage hooks. Note that conf->hooks_modules contains array -$hookmanager->initHooks(array('productlotlist')); +$hookmanager->initHooks(array('product_lotlist')); $extrafields = new ExtraFields($db); // fetch optionals attributes and labels -$extralabels = $extrafields->fetch_name_optionals_label('stock'); +$extralabels = $extrafields->fetch_name_optionals_label('product_lot'); $search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_'); -// Load object if id or ref is provided as parameter -$object=new Productlot($db); -if (($id > 0 || ! empty($ref)) && $action != 'add') -{ - $result=$object->fetch($id,$ref); - if ($result < 0) dol_print_error($db); -} +// List of fields to search into when doing a "search in all" +$fieldstosearchall = array( + 't.ref'=>'Ref', + 't.note_public'=>'NotePublic', +); // Definition of fields for list $arrayfields=array( - -'t.entity'=>array('label'=>$langs->trans("Fieldentity"), 'checked'=>1), -'t.fk_product'=>array('label'=>$langs->trans("Fieldfk_product"), 'checked'=>1), -'t.batch'=>array('label'=>$langs->trans("Fieldbatch"), 'checked'=>1), -'t.fk_user_creat'=>array('label'=>$langs->trans("Fieldfk_user_creat"), 'checked'=>1), -'t.fk_user_modif'=>array('label'=>$langs->trans("Fieldfk_user_modif"), 'checked'=>1), -'t.import_key'=>array('label'=>$langs->trans("Fieldimport_key"), 'checked'=>1), - - + //'t.entity'=>array('label'=>$langs->trans("Fieldentity"), 'checked'=>1), + 't.batch'=>array('label'=>$langs->trans("Batch"), 'checked'=>1), + 't.fk_product'=>array('label'=>$langs->trans("Product"), 'checked'=>1), + 't.eatby'=>array('label'=>$langs->trans("EatByDate"), 'checked'=>1), + 't.sellby'=>array('label'=>$langs->trans("SellByDate"), 'checked'=>1), + //'t.import_key'=>array('label'=>$langs->trans("ImportKey"), 'checked'=>1), //'t.entity'=>array('label'=>$langs->trans("Entity"), 'checked'=>1, 'enabled'=>(! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode))), - 't.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), + //'t.fk_user_creat'=>array('label'=>$langs->trans("UserCreationShort"), 'checked'=>0, 'position'=>500), + //'t.fk_user_modif'=>array('label'=>$langs->trans("UserModificationShort"), 'checked'=>0, 'position'=>500), + 't.datec'=>array('label'=>$langs->trans("DateCreationShort"), 'checked'=>0, 'position'=>500), 't.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500), //'t.statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000), ); @@ -131,17 +118,22 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab } } +// Load object if id or ref is provided as parameter +$object=new Productlot($db); +if (($id > 0 || ! empty($ref)) && $action != 'add') +{ + $result=$object->fetch($id,$ref); + if ($result < 0) dol_print_error($db); +} -/******************************************************************* -* ACTIONS -* -* Put here all code to do according to value of "action" parameter -********************************************************************/ +/* + * Actions + */ if (GETPOST('cancel')) { $action='list'; $massaction=''; } -if (! GETPOST('confirmmassaction')) { $massaction=''; } +if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; } $parameters=array(); $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks @@ -149,72 +141,50 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e 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 { - -$search_entity=''; -$search_fk_product=''; -$search_batch=''; -$search_fk_user_creat=''; -$search_fk_user_modif=''; -$search_import_key=''; - - + $search_entity=''; + $search_product=''; + $search_batch=''; + $search_fk_user_creat=''; + $search_fk_user_modif=''; + $search_import_key=''; $search_date_creation=''; $search_date_update=''; + $toselect=''; $search_array_options=array(); } if (empty($reshook)) { - // Mass actions. Controls on number of lines checked - $maxformassaction=1000; - if (! empty($massaction) && count($toselect) < 1) - { - $error++; - setEventMessages($langs->trans("NoLineChecked"), null, "warnings"); - } - if (! $error && count($toselect) > $maxformassaction) - { - setEventMessages($langs->trans('TooManyRecordForMassAction',$maxformassaction), null, 'errors'); - $error++; - } - - // Action to delete - if ($action == 'confirm_delete') - { - $result=$object->delete($user); - if ($result > 0) - { - // Delete OK - setEventMessages("RecordDeleted", null, 'mesgs'); - header("Location: ".dol_buildpath('/stock/list.php',1)); - exit; - } - else - { - if (! empty($object->errors)) setEventMessages(null,$object->errors,'errors'); - else setEventMessages($object->error,null,'errors'); - } - } + $objectclass='ProductLot'; + $objectlabel='LotSerial'; + $permtoread = $user->rights->stock->read; + $permtodelete = $user->rights->stock->delete; + $uploaddir = $conf->stock->dir_output; + include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; } -/*************************************************** -* VIEW -* -* Put here all code to build page -****************************************************/ +/* + * VIEW + */ -llxHeader('','MyPageName',''); +$now=dol_now(); $form=new Form($db); +$productstatic=new Product($db); + +//$help_url="EN:Module_Customers_Orders|FR:Module_Commandes_Clients|ES:Módulo_Pedidos_de_clientes"; +$help_url=''; +$title = $langs->trans('LotSerialList'); +llxHeader('', $title, $help_url); // Put here content of your page -$title = $langs->trans('MyModuleListTitle'); // Example : Adding jquery code print ''; - - + } + /* * Boutons actions */ @@ -859,7 +970,16 @@ else { if ($action != "edit" ) { - // Modify + + // Create event + if ($conf->agenda->enabled && ! empty($conf->global->MAIN_ADD_EVENT_ON_ELEMENT_CARD)) // Add hidden condition because this is not a + // "workflow" action so should appears somewhere else on + // page. + { + print ''; + } + + // Modify if ($object->statut != 2 && $user->rights->projet->creer) { if ($userWrite > 0) @@ -871,7 +991,7 @@ else print ''; } } - + // Validate if ($object->statut == 0 && $user->rights->projet->creer) { @@ -884,7 +1004,7 @@ else print ''; } } - + // Close if ($object->statut == 1 && $user->rights->projet->creer) { @@ -897,7 +1017,7 @@ else print ''; } } - + // Reopen if ($object->statut == 2 && $user->rights->projet->creer) { @@ -910,8 +1030,8 @@ else print ''; } } - - // Add button to create objects from project + + // Add button to create objects from project if (! empty($conf->global->PROJECT_SHOW_CREATE_OBJECT_BUTTON)) { if (! empty($conf->propal->enabled) && $user->rights->propal->creer) @@ -965,7 +1085,7 @@ else print ''; } } - + // Clone if ($user->rights->projet->creer) { @@ -978,7 +1098,7 @@ else print ''; } } - + // Delete if ($user->rights->projet->supprimer || ($object->statut == 0 && $user->rights->projet->creer)) { @@ -1012,17 +1132,10 @@ else $var=true; - $somethingshown=$formfile->show_documents('project',$filename,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf); + print $formfile->showdocuments('project',$filename,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf); print '
'; - if (!empty($object->id)) - { - // List of actions on element - include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; - $formactions=new FormActions($db); - $somethingshown=$formactions->showactions($object,'project',$socid); - } print '
'; } diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 236a8154578..1222a8c84d9 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -37,7 +37,8 @@ class Project extends CommonObject public $table_element_line = 'projet_task'; public $fk_element = 'fk_projet'; protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe - + public $picto = 'projectpub'; + /** * {@inheritdoc} */ @@ -54,7 +55,10 @@ class Project extends CommonObject var $date_start; var $date_end; var $date_close; - var $socid; + + var $socid; // To store id of thirdparty + var $thirdparty_name; // To store name of thirdparty (defined only in some cases) + var $user_author_id; //!< Id of project creator. Not defined if shared project. var $user_close_id; var $public; //!< Tell if this is a public or private project @@ -231,7 +235,7 @@ class Project extends CommonObject global $langs, $conf; $error=0; - + // Clean parameters $this->title = trim($this->title); $this->description = trim($this->description); @@ -248,7 +252,7 @@ class Project extends CommonObject $sql.= ", description = '" . $this->db->escape($this->description) . "'"; $sql.= ", fk_soc = " . ($this->socid > 0 ? $this->socid : "null"); $sql.= ", fk_statut = " . $this->statut; - $sql.= ", fk_opp_status = " . ((is_numeric($this->opp_status) && $this->opp_status != '') ? $this->opp_status : 'null'); + $sql.= ", fk_opp_status = " . ((is_numeric($this->opp_status) && $this->opp_status > 0) ? $this->opp_status : 'null'); $sql.= ", opp_percent = " . ((is_numeric($this->opp_percent) && $this->opp_percent != '') ? $this->opp_percent : 'null'); $sql.= ", public = " . ($this->public ? 1 : 0); $sql.= ", datec=" . ($this->date_c != '' ? "'".$this->db->idate($this->date_c)."'" : 'null'); @@ -460,9 +464,9 @@ class Project extends CommonObject function get_element_list($type, $tablename, $datefieldname='', $dates='', $datee='') { $elements = array(); - + if ($this->id <= 0) return $elements; - + if ($type == 'agenda') { $sql = "SELECT id as rowid FROM " . MAIN_DB_PREFIX . "actioncomm WHERE fk_project=" . $this->id; @@ -702,6 +706,13 @@ class Project extends CommonObject if ($this->statut != 1) { + // Check parameters + if (preg_match('/^'.preg_quote($langs->trans("CopyOf").' ').'/', $this->title)) + { + $this->error=$langs->trans("ErrorFieldFormat",$langs->transnoentities("Label")).'. '.$langs->trans('RemoveString',$langs->transnoentitiesnoconv("CopyOf")); + return -1; + } + $this->db->begin(); $sql = "UPDATE " . MAIN_DB_PREFIX . "projet"; @@ -767,7 +778,7 @@ class Project extends CommonObject if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { - // TODO What to do if fk_opp_status is not code 'WIN' or 'LOST' + // TODO What to do if fk_opp_status is not code 'WON' or 'LOST' } dol_syslog(get_class($this)."::setClose", LOG_DEBUG); @@ -878,53 +889,68 @@ class Project extends CommonObject * @param int $addlabel 0=Default, 1=Add label into string, >1=Add first chars into string * @param string $moreinpopup Text to add into popup * @param string $sep Separator between ref and label if option addlabel is set + * @param int $notooltip 1=Disable tooltip * @return string Chaine avec URL */ - function getNomUrl($withpicto=0, $option='', $addlabel=0, $moreinpopup='', $sep=' - ') + function getNomUrl($withpicto=0, $option='', $addlabel=0, $moreinpopup='', $sep=' - ', $notooltip=0) { - global $langs; + global $conf, $langs, $user; + if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips + $result = ''; - $link = ''; - $linkend = ''; + $label=''; if ($option != 'nolink') $label = '' . $langs->trans("ShowProject") . ''; if (! empty($this->ref)) $label .= ($label?'
':'').'' . $langs->trans('Ref') . ': ' . $this->ref; // The space must be after the : to not being explode when showing the title in img_picto if (! empty($this->title)) $label .= ($label?'
':'').'' . $langs->trans('Label') . ': ' . $this->title; // The space must be after the : to not being explode when showing the title in img_picto + if (! empty($this->thirdparty_name)) + $label .= ($label?'
':'').'' . $langs->trans('ThirdParty') . ': ' . $this->thirdparty_name; // The space must be after the : to not being explode when showing the title in img_picto if (! empty($this->dateo)) $label .= ($label?'
':'').'' . $langs->trans('DateStart') . ': ' . dol_print_date($this->dateo, 'day'); // The space must be after the : to not being explode when showing the title in img_picto if (! empty($this->datee)) $label .= ($label?'
':'').'' . $langs->trans('DateEnd') . ': ' . dol_print_date($this->datee, 'day'); // The space must be after the : to not being explode when showing the title in img_picto if ($moreinpopup) $label.='
'.$moreinpopup; - $linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; - if ($option != 'nolink') + if ($option != 'nolink') { if (preg_match('/\.php$/',$option)) { - $link = ''; + $url = DOL_URL_ROOT . '/projet/tasks.php?id=' . $this->id; } else { - $link = 'public) $picto = 'project'; - - if ($withpicto) $result.=($link . img_object($label, $picto, 'class="classfortooltip"') . $linkend); + $linkstart = ''; + $linkend=''; + + if ($withpicto) $result.=($linkstart . img_object(($notooltip?'':$label), $picto, ($notooltip?'':'class="classfortooltip"')) . $linkend); if ($withpicto && $withpicto != 2) $result.=' '; - if ($withpicto != 2) $result.=$link . $this->ref . $linkend . (($addlabel && $this->title) ? $sep . dol_trunc($this->title, ($addlabel > 1 ? $addlabel : 0)) : ''); + if ($withpicto != 2) $result.=$linkstart . $this->ref . $linkend . (($addlabel && $this->title) ? $sep . dol_trunc($this->title, ($addlabel > 1 ? $addlabel : 0)) : ''); return $result; } @@ -1061,7 +1087,7 @@ class Project extends CommonObject } else dol_print_error($this->db); if (count($listofprojectcontacttype) == 0) $listofprojectcontacttype[0]='0'; // To avoid syntax error if not found - + if ($mode == 0) { $sql.= " AND ec.element_id = p.rowid"; @@ -1118,16 +1144,17 @@ class Project extends CommonObject * Load an object from its id and create a new one in database * * @param int $fromid Id of object to clone - * @param bool $clone_contact clone contact of project - * @param bool $clone_task clone task of project - * @param bool $clone_project_file clone file of project - * @param bool $clone_task_file clone file of task (if task are copied) - * @param bool $clone_note clone note of project - * @param bool $move_date move task date on clone - * @param integer $notrigger no trigger flag + * @param bool $clone_contact Clone contact of project + * @param bool $clone_task Clone task of project + * @param bool $clone_project_file Clone file of project + * @param bool $clone_task_file Clone file of task (if task are copied) + * @param bool $clone_note Clone note of project + * @param bool $move_date Move task date on clone + * @param integer $notrigger No trigger flag + * @param int $newthirdpartyid New thirdparty id * @return int New id of clone */ - function createFromClone($fromid,$clone_contact=false,$clone_task=true,$clone_project_file=false,$clone_task_file=false,$clone_note=true,$move_date=true,$notrigger=0) + function createFromClone($fromid,$clone_contact=false,$clone_task=true,$clone_project_file=false,$clone_task_file=false,$clone_note=true,$move_date=true,$notrigger=0,$newthirdpartyid=0) { global $user,$langs,$conf; @@ -1145,6 +1172,8 @@ class Project extends CommonObject // Load source object $clone_project->fetch($fromid); + $clone_project->fetch_optionals(); + if ($newthirdpartyid > 0) $clone_project->socid = $newthirdpartyid; $clone_project->fetch_thirdparty(); $orign_dt_start=$clone_project->date_start; @@ -1188,6 +1217,7 @@ class Project extends CommonObject if (is_numeric($defaultref) && $defaultref <= 0) $defaultref=''; $clone_project->ref=$defaultref; + $clone_project->title=$langs->trans("CopyOf").' '.$clone_project->title; // Create clone $result=$clone_project->create($user,$notrigger); @@ -1311,9 +1341,9 @@ class Project extends CommonObject $tasksarray=$taskstatic->getTasksArray(0, 0, $fromid, $socid, 0); - //manage new parent clone task id $tab_conv_child_parent=array(); + // Loop on each task, to clone it foreach ($tasksarray as $tasktoclone) { $result_clone = $taskstatic->createFromClone($tasktoclone->id,$clone_project_id,$tasktoclone->fk_parent,$move_date,true,false,$clone_task_file,true,false); @@ -1601,11 +1631,11 @@ class Project extends CommonObject function load_board($user) { global $conf, $langs; - + $mine=0; $socid=$user->societe_id; - + $projectsListId = $this->getProjectsAuthorizedForUser($user,$mine?$mine:($user->rights->projet->all->lire?2:0),1,$socid); - + $sql = "SELECT p.rowid, p.fk_statut as status, p.fk_opp_status, p.datee as datee"; $sql.= " FROM (".MAIN_DB_PREFIX."projet as p"; $sql.= ")"; @@ -1618,33 +1648,33 @@ class Project extends CommonObject //if ($socid || ! $user->rights->societe->client->voir) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")"; if ($socid) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")"; if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND ((s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id.") OR (s.rowid IS NULL))"; - + $resql=$this->db->query($sql); if ($resql) { $project_static = new Project($this->db); - + $response = new WorkboardResponse(); $response->warning_delay = $conf->projet->warning_delay/60/60/24; $response->label = $langs->trans("OpenedProjects"); if ($user->rights->projet->all->lire) $response->url = DOL_URL_ROOT.'/projet/list.php?search_status=1&mainmenu=project'; else $response->url = DOL_URL_ROOT.'/projet/list.php?mode=mine&search_status=1&mainmenu=project'; $response->img = img_object($langs->trans("Projects"),"project"); - + // This assignment in condition is not a bug. It allows walking the results. while ($obj=$this->db->fetch_object($resql)) { $response->nbtodo++; - + $project_static->statut = $obj->status; $project_static->opp_status = $obj->opp_status; $project_static->datee = $this->db->jdate($obj->datee); - + if ($project_static->hasDelay()) { $response->nbtodolate++; } } - + return $response; } else @@ -1653,8 +1683,8 @@ class Project extends CommonObject return -1; } } - - + + /** * Function used to replace a thirdparty id with another one. * @@ -1671,8 +1701,8 @@ class Project extends CommonObject return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables); } - - + + /** * Charge indicateurs this->nb pour le tableau de bord * @@ -1681,16 +1711,16 @@ class Project extends CommonObject function load_state_board() { global $conf; - + $this->nb=array(); - + $sql = "SELECT count(u.rowid) as nb"; $sql.= " FROM ".MAIN_DB_PREFIX."projet as u"; $sql.= " WHERE"; //$sql.= " WHERE u.fk_statut > 0"; //$sql.= " AND employee != 0"; $sql.= " u.entity IN (".getEntity('projet', 1).")"; - + $resql=$this->db->query($sql); if ($resql) { @@ -1708,8 +1738,8 @@ class Project extends CommonObject return -1; } } - - + + /** * Is the project delayed? * @@ -1718,14 +1748,123 @@ class Project extends CommonObject public function hasDelay() { global $conf; - + if (! ($this->statut == 1)) return false; if (! $this->datee) return false; $now = dol_now(); return $this->datee < ($now - $conf->projet->warning_delay); - } + } + + + /** + * Charge les informations d'ordre info dans l'objet commande + * + * @param int $id Id of order + * @return void + */ + function info($id) + { + $sql = 'SELECT c.rowid, datec as datec, tms as datem,'; + $sql.= ' date_close as datecloture,'; + $sql.= ' fk_user_creat as fk_user_author, fk_user_close as fk_use_cloture'; + $sql.= ' FROM '.MAIN_DB_PREFIX.'projet as c'; + $sql.= ' WHERE c.rowid = '.$id; + $result=$this->db->query($sql); + if ($result) + { + if ($this->db->num_rows($result)) + { + $obj = $this->db->fetch_object($result); + $this->id = $obj->rowid; + if ($obj->fk_user_author) + { + $cuser = new User($this->db); + $cuser->fetch($obj->fk_user_author); + $this->user_creation = $cuser; + } + + if ($obj->fk_user_cloture) + { + $cluser = new User($this->db); + $cluser->fetch($obj->fk_user_cloture); + $this->user_cloture = $cluser; + } + + $this->date_creation = $this->db->jdate($obj->datec); + $this->date_modification = $this->db->jdate($obj->datem); + $this->date_cloture = $this->db->jdate($obj->datecloture); + } + + $this->db->free($result); + + } + else + { + dol_print_error($this->db); + } + } + + /** + * Sets object to supplied categories. + * + * Deletes object from existing categories not supplied. + * Adds it to non existing supplied categories. + * Existing categories are left untouch. + * + * @param int[]|int $categories Category or categories IDs + */ + public function setCategories($categories) + { + // Decode type + $type_id = Categorie::TYPE_PROJECT; + $type_text = 'project'; + + + // Handle single category + if (!is_array($categories)) { + $categories = array($categories); + } + + // Get current categories + require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; + $c = new Categorie($this->db); + $existing = $c->containing($this->id, $type_id, 'id'); + + // Diff + if (is_array($existing)) { + $to_del = array_diff($existing, $categories); + $to_add = array_diff($categories, $existing); + } else { + $to_del = array(); // Nothing to delete + $to_add = $categories; + } + + // Process + foreach ($to_del as $del) { + if ($c->fetch($del) > 0) { + $result=$c->del_type($this, $type_text); + if ($result<0) { + $this->errors=$c->errors; + $this->error=$c->error; + return -1; + } + } + } + foreach ($to_add as $add) { + if ($c->fetch($add) > 0) { + $result=$c->add_type($this, $type_text); + if ($result<0) { + $this->errors=$c->errors; + $this->error=$c->error; + return -1; + } + } + } + + return 1; + } } diff --git a/htdocs/projet/class/projectstats.class.php b/htdocs/projet/class/projectstats.class.php index 4bb6a1f31fa..88eb8ef5ced 100644 --- a/htdocs/projet/class/projectstats.class.php +++ b/htdocs/projet/class/projectstats.class.php @@ -41,7 +41,8 @@ class ProjectStats extends Stats /** - * Return all leads grouped by status + * Return all leads grouped by status. + * Warning: There is no filter on WON/LOST because we want this for statistics. * * @param int $limit Limit results * @return array|int Array with value or -1 if error @@ -58,7 +59,7 @@ class ProjectStats extends Stats $sql .= " FROM " . MAIN_DB_PREFIX . "projet as t, ".MAIN_DB_PREFIX."c_lead_status as cls"; $sql .= $this->buildWhere(); $sql .= " AND t.fk_opp_status = cls.rowid"; - $sql .= " AND t.fk_statut <> 0"; // We want historic also, so all projects + $sql .= " AND t.fk_statut <> 0"; // We want historic also, so all projects not draft $sql .= " GROUP BY t.fk_opp_status, cls.code, cls.label"; $result = array (); @@ -110,13 +111,16 @@ class ProjectStats extends Stats $datay = array (); - $sql = "SELECT date_format(t.datec,'%Y') as year, COUNT(t.rowid) as nb, SUM(t.opp_amount) as total, AVG(t.opp_amount) as avg"; - $sql .= " FROM " . MAIN_DB_PREFIX . "projet as t"; + $wonlostfilter=0; // No filter on status WON/LOST + + $sql = "SELECT date_format(t.datec,'%Y') as year, COUNT(t.rowid) as nb, SUM(t.opp_amount) as total, AVG(t.opp_amount) as avg,"; + $sql.= " SUM(t.opp_amount * ".$this->db->ifsql("t.opp_percent IS NULL".($wonlostfilter?" OR cls.code IN ('WON','LOST')":""), '0', 't.opp_percent')." / 100) as weighted"; + $sql.= " FROM " . MAIN_DB_PREFIX . "projet as t LEFT JOIN ".MAIN_DB_PREFIX."c_lead_status as cls ON cls.rowid = t.fk_opp_status"; if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "societe_commerciaux as sc ON sc.fk_soc=t.fk_soc AND sc.fk_user=" . $user->id; - $sql .= $this->buildWhere(); - $sql .= " GROUP BY year"; - $sql .= $this->db->order('year', 'DESC'); + $sql.= $this->buildWhere(); + $sql.= " GROUP BY year"; + $sql.= $this->db->order('year', 'DESC'); return $this->_getAllByYear($sql); } @@ -213,9 +217,10 @@ class ProjectStats extends Stats * @param int $endyear Start year * @param int $startyear End year * @param int $cachedelay Delay we accept for cache file (0=No read, no save of cache, -1=No read but save) + * @param int $wonlostfilter Add a filter on status won/lost * @return array Array of values */ - function getWeightedAmountByMonthWithPrevYear($endyear,$startyear,$cachedelay=0) + function getWeightedAmountByMonthWithPrevYear($endyear,$startyear,$cachedelay=0,$wonlostfilter=1) { global $conf,$user,$langs; @@ -262,7 +267,7 @@ class ProjectStats extends Stats $year=$startyear; while($year <= $endyear) { - $datay[$year] = $this->getWeightedAmountByMonth($year); + $datay[$year] = $this->getWeightedAmountByMonth($year,$wonlostfilter); $year++; } @@ -302,18 +307,19 @@ class ProjectStats extends Stats /** - * Return the Project weighted opp amount by month for a year + * Return the Project weighted opp amount by month for a year. * - * @param int $year scan - * @return array with amount by month + * @param int $year Year to scan + * @param int $wonlostfilter Add a filter on status won/lost + * @return array Array with amount by month */ - function getWeightedAmountByMonth($year) + function getWeightedAmountByMonth($year, $wonlostfilter=1) { global $user; $this->yearmonth = $year; - $sql = "SELECT date_format(t.datec,'%m') as dm, SUM(t.opp_amount * ".$this->db->ifsql('cls.percent IS NULL', '0', 'cls.percent')." / 100)"; + $sql = "SELECT date_format(t.datec,'%m') as dm, SUM(t.opp_amount * ".$this->db->ifsql("t.opp_percent IS NULL".($wonlostfilter?" OR cls.code IN ('WON','LOST')":""), '0', 't.opp_percent')." / 100)"; $sql .= " FROM " . MAIN_DB_PREFIX . "projet as t LEFT JOIN ".MAIN_DB_PREFIX.'c_lead_status as cls ON t.fk_opp_status = cls.rowid'; if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "societe_commerciaux as sc ON sc.fk_soc=t.fk_soc AND sc.fk_user=" . $user->id; diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 6db12174539..bb006f23a9d 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -33,7 +33,8 @@ class Task extends CommonObject { public $element='project_task'; //!< Id that identify managed objects public $table_element='projet_task'; //!< Name of table without prefix where object is stored - + public $picto = 'task'; + var $fk_task_parent; var $label; var $description; @@ -58,6 +59,8 @@ class Task extends CommonObject var $timespent_fk_user; var $timespent_note; + public $oldcopy; + /** * Constructor @@ -316,6 +319,30 @@ class Task extends CommonObject } } + if (! $error && (is_object($this->oldcopy) && $this->oldcopy->ref !== $this->ref)) + { + // We remove directory + if ($conf->projet->dir_output) + { + $project = new Project($this->db); + $project->fetch($this->fk_project); + + $olddir = $conf->projet->dir_output.'/'.dol_sanitizeFileName($project->ref).'/'.dol_sanitizeFileName($this->oldcopy->ref); + $newdir = $conf->projet->dir_output.'/'.dol_sanitizeFileName($project->ref).'/'.dol_sanitizeFileName($this->ref); + if (file_exists($olddir)) + { + include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; + $res=dol_move($olddir, $newdir); + if (! $res) + { + $langs->load("errors"); + $this->error=$langs->trans('ErrorFailToRenameDir',$olddir,$newdir); + $error++; + } + } + } + } + // Commit or rollback if ($error) { @@ -494,12 +521,15 @@ class Task extends CommonObject * @param string $mode Mode 'task', 'time', 'contact', 'note', document' define page to link to. * @param int $addlabel 0=Default, 1=Add label into string, >1=Add first chars into string * @param string $sep Separator between ref and label if option addlabel is set + * @param int $notooltip 1=Disable tooltip * @return string Chaine avec URL */ - function getNomUrl($withpicto=0,$option='',$mode='task', $addlabel=0, $sep=' - ') + function getNomUrl($withpicto=0,$option='',$mode='task', $addlabel=0, $sep=' - ', $notooltip=0) { - global $langs; + global $conf, $langs, $user; + if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips + $result=''; $label = '' . $langs->trans("ShowTask") . ''; if (! empty($this->ref)) @@ -510,17 +540,30 @@ class Task extends CommonObject { $label .= "
".get_date_range($this->date_start,$this->date_end,'',$langs,0); } - $linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; + + $url = DOL_URL_ROOT.'/projet/tasks/'.$mode.'.php?id='.$this->id.($option=='withproject'?'&withproject=1':''); - $link = ''; $linkend=''; - + $picto='projecttask'; - - if ($withpicto) $result.=($link.img_object($label, $picto, 'class="classfortooltip"').$linkend); + if ($withpicto) $result.=($linkstart.img_object(($notooltip?'':$label), $picto, ($notooltip?'':'class="classfortooltip"')).$linkend); if ($withpicto && $withpicto != 2) $result.=' '; - if ($withpicto != 2) $result.=$link.$this->ref.$linkend . (($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : ''); + if ($withpicto != 2) $result.=$linkstart.$this->ref.$linkend . (($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : ''); return $result; } @@ -573,10 +616,12 @@ class Task extends CommonObject // List of tasks (does not care about permissions. Filtering will be done later) $sql = "SELECT p.rowid as projectid, p.ref, p.title as plabel, p.public, p.fk_statut as projectstatus,"; $sql.= " t.rowid as taskid, t.ref as taskref, t.label, t.description, t.fk_task_parent, t.duration_effective, t.progress, t.fk_statut as status,"; - $sql.= " t.dateo as date_start, t.datee as date_end, t.planned_workload, t.rang"; + $sql.= " t.dateo as date_start, t.datee as date_end, t.planned_workload, t.rang,"; + $sql.= " s.rowid as thirdparty_id, s.nom as thirdparty_name"; + $sql.= " FROM ".MAIN_DB_PREFIX."projet as p"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON p.fk_soc = s.rowid"; if ($mode == 0) { - $sql.= " FROM ".MAIN_DB_PREFIX."projet as p"; if ($filteronprojuser > 0) { $sql.= ", ".MAIN_DB_PREFIX."element_contact as ec"; @@ -593,7 +638,6 @@ class Task extends CommonObject } elseif ($mode == 1) { - $sql.= " FROM ".MAIN_DB_PREFIX."projet as p"; if ($filteronprojuser > 0) { $sql.= ", ".MAIN_DB_PREFIX."element_contact as ec"; @@ -679,7 +723,8 @@ class Task extends CommonObject $tasks[$i]->projectstatus = $obj->projectstatus; $tasks[$i]->label = $obj->label; $tasks[$i]->description = $obj->description; - $tasks[$i]->fk_parent = $obj->fk_task_parent; + $tasks[$i]->fk_parent = $obj->fk_task_parent; // deprecated + $tasks[$i]->fk_task_parent = $obj->fk_task_parent; $tasks[$i]->duration = $obj->duration_effective; $tasks[$i]->planned_workload= $obj->planned_workload; $tasks[$i]->progress = $obj->progress; @@ -688,6 +733,9 @@ class Task extends CommonObject $tasks[$i]->date_start = $this->db->jdate($obj->date_start); $tasks[$i]->date_end = $this->db->jdate($obj->date_end); $tasks[$i]->rang = $obj->rang; + + $tasks[$i]->thirdparty_id = $obj->thirdparty_id; + $tasks[$i]->thirdparty_name = $obj->thirdparty_name; } $i++; @@ -913,14 +961,19 @@ class Task extends CommonObject /** * Calculate total of time spent for task * - * @param int $id Id of object (here task) + * @param int $userid Filter on user id. 0=No filter * @return array Array of info for task array('min_date', 'max_date', 'total_duration') */ - function getSummaryOfTimeSpent($id='') + function getSummaryOfTimeSpent($userid=0) { global $langs; - if (empty($id)) $id=$this->id; + $id=$this->id; + if (empty($id)) + { + dol_syslog("getSummaryOfTimeSpent called on a not loaded task", LOG_ERR); + return -1; + } $result=array(); @@ -930,7 +983,8 @@ class Task extends CommonObject $sql.= " SUM(t.task_duration) as total_duration"; $sql.= " FROM ".MAIN_DB_PREFIX."projet_task_time as t"; $sql.= " WHERE t.fk_task = ".$id; - + if ($userid > 0) $sql.=" AND t.fk_user = ".$userid; + dol_syslog(get_class($this)."::getSummaryOfTimeSpent", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) @@ -1232,6 +1286,9 @@ class Task extends CommonObject // Load source object $clone_task->fetch($fromid); + $clone_task->fetch_optionals(); + //var_dump($clone_task->array_options);exit; + $origin_task->fetch($fromid); $defaultref=''; diff --git a/htdocs/projet/contact.php b/htdocs/projet/contact.php index 794e9c3af00..c2a24458015 100644 --- a/htdocs/projet/contact.php +++ b/htdocs/projet/contact.php @@ -149,53 +149,42 @@ if ($id > 0 || ! empty($ref)) dol_fiche_head($head, 'contact', $langs->trans("Project"), 0, ($object->public?'projectpub':'project')); - /* - * Projet synthese pour rappel - */ - print ''; + // Project card + + $linkback = ''.$langs->trans("BackToList").''; + + $morehtmlref='
'; + // Title + $morehtmlref.=$object->title; + // Thirdparty + if ($object->thirdparty->id > 0) + { + $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1, 'project'); + } + $morehtmlref.='
'; + + // Define a complementary filter for search of next/prev ref. + if (! $user->rights->projet->all->lire) + { + $objectsListId = $object->getProjectsAuthorizedForUser($user,0,0); + $object->next_prev_filter=" rowid in (".(count($objectsListId)?join(',',array_keys($objectsListId)):'0').")"; + } + + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); - $linkback = ''.$langs->trans("BackToList").''; - // Ref - print ''; - - // Label - print ''; - - // Customer - print ""; - print ''; + print '
'; + print '
'; + print '
'; + print '
'.$langs->trans('Ref').''; - // Define a complementary filter for search of next/prev ref. - if (! $user->rights->projet->all->lire) - { - $objectsListId = $object->getProjectsAuthorizedForUser($user,0,0); - $object->next_prev_filter=" rowid in (".(count($objectsListId)?join(',',array_keys($objectsListId)):'0').")"; - } - print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', ''); - print '
'.$langs->trans("Label").''.$object->title.'
".$langs->trans("ThirdParty")."'; - if ($object->thirdparty->id > 0) print $object->thirdparty->getNomUrl(1); - else print ' '; - print '
'; + // Visibility - print ''; - // Status - print ''; - - // Date start - print ''; - - // Date end - print ''; - if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { // Opportunity status @@ -204,21 +193,66 @@ if ($id > 0 || ! empty($ref)) if ($code) print $langs->trans("OppStatus".$code); print ''; + // Opportunity percent + print ''; + // Opportunity Amount print ''; } - // Budget + // Date start - end + print ''; + + // Budget print ''; + // Other attributes + $cols = 2; + include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; + print "
'.$langs->trans("Visibility").''; + print '
'.$langs->trans("Visibility").''; if ($object->public) print $langs->trans('SharedProject'); else print $langs->trans('PrivateProject'); print '
'.$langs->trans("Status").''.$object->getLibStatut(4).'
'.$langs->trans("DateStart").''; - print dol_print_date($object->date_start,'day'); - print '
'.$langs->trans("DateEnd").''; - print dol_print_date($object->date_end,'day'); - print '
'.$langs->trans("OpportunityProbability").''; + if (strcmp($object->opp_percent,'')) print price($object->opp_percent,'',$langs,1,0).' %'; + print '
'.$langs->trans("OpportunityAmount").''; if (strcmp($object->opp_amount,'')) print price($object->opp_amount,'',$langs,0,0,0,$conf->currency); print '
'.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").''; + print dol_print_date($object->date_start,'day'); + $end=dol_print_date($object->date_end,'day'); + if ($end) print ' - '.$end; + print '
'.$langs->trans("Budget").''; if (strcmp($object->budget_amount, '')) print price($object->budget_amount,'',$langs,0,0,0,$conf->currency); print '
"; - print ''; - + print ''; + print '
'; + print '
'; + print '
'; + + print ''; + + // Description + print ''; + + // Categories + if($conf->categorie->enabled) { + print '"; + } + + print '
'.$langs->trans("Description").''; + print nl2br($object->description); + print '
'.$langs->trans("Categories").''; + print $form->showCategories($object->id,'project',1); + print "
'; + + print '
'; + print '
'; + print ''; + + print '
'; + + dol_fiche_end(); + + print '
'; + // Contacts lines (modules that overwrite templates must declare this into descriptor) $dirtpls=array_merge($conf->modules_parts['tpl'],array('/core/tpl')); foreach($dirtpls as $reldir) diff --git a/htdocs/projet/document.php b/htdocs/projet/document.php index d59dec0dc4a..d5768c355a2 100644 --- a/htdocs/projet/document.php +++ b/htdocs/projet/document.php @@ -106,48 +106,49 @@ if ($object->id > 0) $totalsize+=$file['size']; } + + // Project card + + $linkback = ''.$langs->trans("BackToList").''; + + $morehtmlref='
'; + // Title + $morehtmlref.=$object->title; + // Thirdparty + if ($object->thirdparty->id > 0) + { + $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1, 'project'); + } + $morehtmlref.='
'; + + // Define a complementary filter for search of next/prev ref. + if (! $user->rights->projet->all->lire) + { + $objectsListId = $object->getProjectsAuthorizedForUser($user,0,0); + $object->next_prev_filter=" rowid in (".(count($objectsListId)?join(',',array_keys($objectsListId)):'0').")"; + } + + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + + + print '
'; + print '
'; + print ''; - $linkback = ''.$langs->trans("BackToList").''; - - // Ref - print ''; - - // Label - print ''; - - // Company - print ''; - - // Visibility - print ''; - - // Statut - print ''; - // Files infos - print ''; - print ''; + print ''; + print ''; print "
'.$langs->trans("Ref").''; - // Define a complementary filter for search of next/prev ref. - if (! $user->rights->projet->all->lire) - { - $projectsListId = $object->getProjectsAuthorizedForUser($user,0,0); - $object->next_prev_filter=" rowid in (".(count($projectsListId)?join(',',array_keys($projectsListId)):'0').")"; - } - print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref'); - print '
'.$langs->trans("Label").''.$object->title.'
'.$langs->trans("ThirdParty").''; - if (! empty($object->thirdparty->id)) print $object->thirdparty->getNomUrl(1); - else print ' '; - print '
'.$langs->trans("Visibility").''; - if ($object->public) print $langs->trans('SharedProject'); - else print $langs->trans('PrivateProject'); - print '
'.$langs->trans("Status").''.$object->getLibStatut(4).'
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'.$langs->trans("TotalSizeOfAttachedFiles").''.$totalsize.' '.$langs->trans("bytes").'
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'.$langs->trans("TotalSizeOfAttachedFiles").''.$totalsize.' '.$langs->trans("bytes").'
\n"; - print "
\n"; + + print ''; + + dol_fiche_end(); $modulepart = 'project'; $permission = ($userWrite > 0); + $permtoedit = ($userWrite > 0); include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php'; } diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 1664f2e7269..e94042f43d3 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -2,9 +2,10 @@ /* Copyright (C) 2001-2004 Rodolphe Quiedeville * Copyright (C) 2004-2015 Laurent Destailleur * Copyright (C) 2005-2010 Regis Houssin - * Copyright (C) 2012 Juanjo Menent + * Copyright (C) 2012-2016 Juanjo Menent * Copyright (C) 2015 Alexandre Spangaro * Copyright (C) 2015 Marcos García + * Copyright (C) 2016 Josep Lluís Amador * * 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 @@ -22,7 +23,7 @@ /** * \file htdocs/projet/element.php - * \ingroup projet facture + * \ingroup projet * \brief Page of project referrers */ @@ -37,6 +38,7 @@ if (! empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/ if (! empty($conf->facture->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; if (! empty($conf->facture->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture-rec.class.php'; if (! empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; +if (! empty($conf->supplier_proposal->enabled)) require_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class.php'; if (! empty($conf->fournisseur->enabled)) require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; if (! empty($conf->fournisseur->enabled)) require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; if (! empty($conf->contrat->enabled)) require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; @@ -95,6 +97,8 @@ if ($user->societe_id > 0) $socid=$user->societe_id; $result = restrictedArea($user, 'projet', $projectid, 'projet&project'); +$hookmanager->initHooks(array('projectOverview')); + /* * View */ @@ -117,46 +121,42 @@ $head=project_prepare_head($object); dol_fiche_head($head, 'element', $langs->trans("Project"),0,($object->public?'projectpub':'project')); -print ''; +// Project card $linkback = ''.$langs->trans("BackToList").''; -print ''; -print ''; +dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); -print ''; + +print '
'; +print '
'; +print '
'; + +print '
'.$langs->trans("Ref").''; +$morehtmlref='
'; +// Title +$morehtmlref.=$object->title; +// Thirdparty +if ($object->thirdparty->id > 0) +{ + $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1, 'project'); +} +$morehtmlref.='
'; + // Define a complementary filter for search of next/prev ref. if (! $user->rights->projet->all->lire) { - $projectsListId = $object->getProjectsAuthorizedForUser($user,0,0); - $object->next_prev_filter=" rowid in (".(count($projectsListId)?join(',',array_keys($projectsListId)):'0').")"; + $objectsListId = $object->getProjectsAuthorizedForUser($user,0,0); + $object->next_prev_filter=" rowid in (".(count($objectsListId)?join(',',array_keys($objectsListId)):'0').")"; } -print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref'); -print '
'.$langs->trans("Label").''.$object->title.'
'.$langs->trans("ThirdParty").''; -if (! empty($object->thirdparty->id)) print $object->thirdparty->getNomUrl(1); -else print ' '; -print '
'; // Visibility -print ''; -// Statut -print ''; - -// Date start -print ''; - -// Date end -print ''; - if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { // Opportunity status @@ -164,20 +164,63 @@ if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) $code = dol_getIdFromCode($db, $object->opp_status, 'c_lead_status', 'rowid', 'code'); if ($code) print $langs->trans("OppStatus".$code); print ''; - + + // Opportunity percent + print ''; + // Opportunity Amount print ''; } -// Budget -print ''; +// Budget +print ''; + +// Other attributes +$cols = 2; +include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; + print '
'.$langs->trans("Visibility").''; +print '
'.$langs->trans("Visibility").''; if ($object->public) print $langs->trans('SharedProject'); else print $langs->trans('PrivateProject'); print '
'.$langs->trans("Status").''.$object->getLibStatut(4).'
'.$langs->trans("DateStart").''; -print dol_print_date($object->date_start,'day'); -print '
'.$langs->trans("DateEnd").''; -print dol_print_date($object->date_end,'day'); -print '
'.$langs->trans("OpportunityProbability").''; + if (strcmp($object->opp_percent,'')) print price($object->opp_percent,'',$langs,1,0).' %'; + print '
'.$langs->trans("OpportunityAmount").''; - if (strcmp($object->opp_amount,'')) print price($object->opp_amount,'',$langs,0,0,0,$conf->currency); + if (strcmp($object->opp_amount,'')) print price($object->opp_amount,'',$langs,1,0,0,$conf->currency); print '
'.$langs->trans("Budget").''; -if (strcmp($object->budget_amount, '')) print price($object->budget_amount,'',$langs,0,0,0,$conf->currency); +// Date start - end +print '
'.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").''; +print dol_print_date($object->date_start,'day'); +$end=dol_print_date($object->date_end,'day'); +if ($end) print ' - '.$end; print '
'.$langs->trans("Budget").''; +if (strcmp($object->budget_amount, '')) print price($object->budget_amount,'',$langs,1,0,0,$conf->currency); +print '
'; +print ''; +print '
'; +print '
'; +print '
'; + +print ''; + +// Description +print ''; + +// Categories +if($conf->categorie->enabled) { + print '"; +} + +print '
'.$langs->trans("Description").''; +print nl2br($object->description); +print '
'.$langs->trans("Categories").''; + print $form->showCategories($object->id,'project',1); + print "
'; + +print '
'; +print '
'; +print ''; + +print '
'; + dol_fiche_end(); @@ -192,7 +235,7 @@ $listofreferent=array( 'class'=>'Propal', 'table'=>'propal', 'datefieldname'=>'datep', - 'urlnew'=>DOL_URL_ROOT.'/comm/propal/card.php?action=create&projectid='.$id.'&socid='.$socid, + 'urlnew'=>DOL_URL_ROOT.'/comm/propal/card.php?action=create&origin=project&originid='.$id.'&socid='.$socid, 'lang'=>'propal', 'buttonnew'=>'AddProp', 'testnew'=>$user->rights->propal->creer, @@ -232,11 +275,11 @@ $listofreferent=array( 'testnew'=>$user->rights->facture->creer, 'test'=>$conf->facture->enabled && $user->rights->facture->lire), 'proposal_supplier'=>array( - 'name'=>"SuppliersOrders", - 'title'=>"ListSupplierOrdersAssociatedProject", - 'class'=>'CommandeFournisseur', - 'table'=>'commande_fournisseur', - 'datefieldname'=>'date_commande', + 'name'=>"SuppliersProposals", + 'title'=>"ListSupplierProposalsAssociatedProject", + 'class'=>'SupplierProposal', + 'table'=>'supplier_proposal', + 'datefieldname'=>'date', 'urlnew'=>DOL_URL_ROOT.'/supplier_proposal/card.php?action=create&projectid='.$id.'&socid='.$socid, 'lang'=>'supplier_proposal', 'buttonnew'=>'AddSupplierProposal', @@ -283,7 +326,7 @@ $listofreferent=array( 'table'=>'fichinter', 'datefieldname'=>'date_valid', 'disableamount'=>1, - 'urlnew'=>DOL_URL_ROOT.'/fichinter/card.php?action=create&projectid='.$id.'&socid='.$socid, + 'urlnew'=>DOL_URL_ROOT.'/fichinter/card.php?action=create&origin=project&originid='.$id.'&socid='.$socid, 'lang'=>'interventions', 'buttonnew'=>'AddIntervention', 'testnew'=>$user->rights->ficheinter->creer, @@ -350,24 +393,33 @@ $listofreferent=array( 'test'=>$conf->projet->enabled && $user->rights->projet->lire && $conf->salaries->enabled && empty($conf->global->PROJECT_HIDE_TASKS)), ); +$parameters=array('listofreferent'=>$listofreferent); +$resHook = $hookmanager->executeHooks('completeListOfReferent',$parameters,$object,$action); + +if(!empty($hookmanager->resArray)) { + + $listofreferent = array_merge($listofreferent, $hookmanager->resArray); + +} + if ($action=="addelement") { $tablename = GETPOST("tablename"); $elementselectid = GETPOST("elementselect"); $result=$object->update_element($tablename, $elementselectid); - if ($result<0) + if ($result<0) { setEventMessages($object->error, $object->errors, 'errors'); } } -elseif ($action == "unlink") +elseif ($action == "unlink") { $tablename = GETPOST("tablename"); $elementselectid = GETPOST("elementselect"); $result = $object->remove_element($tablename, $elementselectid); - if ($result < 0) + if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } @@ -398,7 +450,7 @@ if (! $showdatefilter) print ''; print ''; print ''; - + $showdatefilter++; } @@ -438,6 +490,7 @@ foreach ($listofreferent as $key => $value) $element = new $classname($db); $elementarray = $object->get_element_list($key, $tablename, $datefieldname, $dates, $datee); + if (count($elementarray)>0 && is_array($elementarray)) { $total_ht = 0; @@ -453,7 +506,7 @@ foreach ($listofreferent as $key => $value) $element->fetch($idofelement); if ($idofelementuser) $elementuser->fetch($idofelementuser); - if ($tablename != 'expensereport_det') $element->fetch_thirdparty(); + if ($tablename != 'expensereport_det' && method_exists($element, 'fetch_thirdparty')) $element->fetch_thirdparty(); if ($tablename == 'don') $total_ht_by_line=$element->amount; elseif ($tablename == 'projet_task') @@ -471,7 +524,13 @@ foreach ($listofreferent as $key => $value) } else $total_ht_by_line=$element->total_ht; - $total_ht = $total_ht + $total_ht_by_line; + $qualifiedfortotal=true; + if ($key == 'invoice') + { + if (! empty($element->close_code) && $element->close_code == 'replaced') $qualifiedfortotal=false; // Replacement invoice, do not include into total + } + + if ($qualifiedfortotal) $total_ht = $total_ht + $total_ht_by_line; if ($tablename == 'don') $total_ttc_by_line=$element->amount; elseif ($tablename == 'projet_task') @@ -481,7 +540,7 @@ foreach ($listofreferent as $key => $value) } else $total_ttc_by_line=$element->total_ttc; - $total_ttc = $total_ttc + $total_ttc_by_line; + if ($qualifiedfortotal) $total_ttc = $total_ttc + $total_ttc_by_line; } // Calculate margin @@ -568,22 +627,22 @@ foreach ($listofreferent as $key => $value) $urlnew=$value['urlnew']; $buttonnew=$value['buttonnew']; $testnew=$value['testnew']; - + if ($qualified) { // If we want the project task array to have details of users //if ($key == 'project_task') $key = 'project_task_time'; - + if ($langtoload) $langs->load($langtoload); - + $element = new $classname($db); $addform=''; $idtofilterthirdparty=0; - if (! in_array($tablename, array('facture_fourn', 'commande_fourn'))) $idtofilterthirdparty=$object->thirdparty->id; + if (! in_array($tablename, array('facture_fourn', 'commande_fournisseur'))) $idtofilterthirdparty=$object->thirdparty->id; - if (empty($conf->global->PROJECT_LINK_ON_OVERWIEW_DISABLED) && $idtofilterthirdparty > 0) + if (empty($conf->global->PROJECT_LINK_ON_OVERWIEW_DISABLED) && $idtofilterthirdparty > 0) { $selectList=$formproject->select_element($tablename, $idtofilterthirdparty, 'minwidth300'); if (! $selectList || ($selectList<0)) @@ -614,18 +673,19 @@ foreach ($listofreferent as $key => $value) else $addform.=''.($buttonnew?$langs->trans($buttonnew):$langs->trans("Create")).''; $addform.='
'; } - + print load_fiche_titre($langs->trans($title), $addform, ''); + print "\n".''."\n"; print ''; print ''; // Remove link print ''; // Ref - print ''; + print ''.$langs->trans("Ref").''; // Date - print ''; // Thirdparty or user @@ -679,7 +739,7 @@ foreach ($listofreferent as $key => $value) if ($tablename != 'expensereport_det') { - $element->fetch_thirdparty(); + if(method_exists($element, 'fetch_thirdparty')) $element->fetch_thirdparty(); } else { @@ -754,16 +814,33 @@ foreach ($listofreferent as $key => $value) print "\n"; // Date - if ($tablename == 'commande_fournisseur' || $tablename == 'supplier_order') $date=$element->date_commande; - elseif ($tablename == 'projet_task') $date=''; // We show no date. Showing date of beginning of task make user think it is date of time consumed - else + $date=''; + if ($tablename == 'expensereport_det') $date = $element->date; // No draft status on lines + elseif (! empty($element->status) || ! empty($element->statut) || ! empty($element->fk_status)) { - $date=$element->date; - if (empty($date)) $date=$element->datep; - if (empty($date)) $date=$element->date_contrat; - if (empty($date)) $date=$element->datev; //Fiche inter + if ($tablename=='don') $date = $element->datedon; + if ($tablename == 'commande_fournisseur' || $tablename == 'supplier_order') + { + $date=($element->date_commande?$element->date_commande:$element->date_valid); + } + elseif ($tablename == 'supplier_proposal') $date=$element->date_validation; // There is no other date for this + elseif ($tablename == 'fichinter') $date=$element->datev; // There is no other date for this + elseif ($tablename == 'projet_task') $date=''; // We show no date. Showing date of beginning of task make user think it is date of time consumed + else + { + $date=$element->date; // invoice, ... + if (empty($date)) $date=$element->date_contrat; + if (empty($date)) $date=$element->datev; + } } - print ''; + print ''; // Third party or user print ''; + $breakline=''; $breakline.=''; $breakline.=''; - print ''; - print ''; + print ''; + print ''; print "
'.$langs->trans("Ref").''; + print ''; if (! in_array($tablename, array('projet_task'))) print $langs->trans("Date"); print ''.dol_print_date($date,'day').''; + if ($tablename == 'actioncomm') + { + print dol_print_date($element->datep,'dayhour'); + if ($element->datef && $element->datef > $element->datep) print " - ".dol_print_date($element->datef,'dayhour'); + } + else print dol_print_date($date,'day'); + print ''; @@ -801,7 +878,7 @@ foreach ($listofreferent as $key => $value) if ($tmp['nblinesnull'] > 0) { $langs->load("errors"); - $warning=$langs->trans("WarningSomeLinesWithNullHourlyRate"); + $warning=$langs->trans("WarningSomeLinesWithNullHourlyRate", $conf->currency); } } else @@ -876,7 +953,7 @@ foreach ($listofreferent as $key => $value) if (canApplySubtotalOn($tablename)) { - $breakline='
'; $breakline.=''; diff --git a/htdocs/projet/ganttchart.inc.php b/htdocs/projet/ganttchart.inc.php index 771cb7d99cc..f60ada41bb1 100644 --- a/htdocs/projet/ganttchart.inc.php +++ b/htdocs/projet/ganttchart.inc.php @@ -78,11 +78,11 @@ function reloadGraph() { } -var g = new JSGantt.GanttChart('g', document.getElementById('GanttChartDIV'), 'day'); -/* For JSGanttImproved var g = new JSGantt.GanttChart(document.getElementById('GanttChartDIV'), 'day'); */ +//var g = new JSGantt.GanttChart('g', document.getElementById('GanttChartDIV'), 'day'); +var g = new JSGantt.GanttChart(document.getElementById('GanttChartDIV'), 'day'); -/* For JSGanttImproved if (g.getDivId() != null) */ -if (g) +if (g.getDivId() != null) +//if (g) { var booShowRessources = 1; var booShowDurations = 1; @@ -90,10 +90,10 @@ if (g) var barText = "Resource"; var graphFormat = "day"; - g.setDateInputFormat('mm/dd/yyyy'); // Set format of input dates ('mm/dd/yyyy', 'dd/mm/yyyy', does not work with 'yyyy-mm-dd') - g.setDateDisplayFormat(''); - /* For JSGanttImproved g.setDateTaskDisplayFormat(''); */ - /* For JSGanttImproved g.setDayMajorDateDisplayFormat('dd mon'); */ + g.setDateInputFormat(''); // Set format of input dates ('mm/dd/yyyy', 'dd/mm/yyyy', does not work with 'yyyy-mm-dd') + g.setDateTaskTableDisplayFormat(''); // Format of date used into line + g.setDateTaskDisplayFormat(''); // Format of date used into popup, not into line + g.setDayMajorDateDisplayFormat('dd mon'); g.setShowRes(1); // Show/Hide Responsible (0/1) g.setShowDur(1); // Show/Hide Duration (0/1) g.setShowComp(1); // Show/Hide % Complete(0/1) @@ -132,7 +132,7 @@ else * Add a gant chart line * * @param string $tarr tarr - * @param Task $task Task object + * @param array $task Array with properties of one task * @param Project $project_dependencies Project object * @param int $level Level * @param int $project_id Id of project @@ -140,15 +140,17 @@ else */ function constructGanttLine($tarr,$task,$project_dependencies,$level=0,$project_id=null) { + global $dateformatinput2; + $start_date = $task["task_start_date"]; $end_date = $task["task_end_date"]; if (!$end_date) $end_date = $start_date; - $start_date = dol_print_date($start_date,"%m/%d/%Y"); - $end_date = dol_print_date($end_date,"%m/%d/%Y"); + $start_date = dol_print_date($start_date, $dateformatinput2); + $end_date = dol_print_date($end_date, $dateformatinput2); // Resources $resources = $task["task_resources"]; // Define depend (ex: "", "4,13", ...) - $depend = "\""; + $depend = ''; $count = 0; foreach ($project_dependencies as $value) { // Not yet used project_dependencies = array(array(0=>idtask,1=>idtasktofinishfisrt)) @@ -157,7 +159,7 @@ function constructGanttLine($tarr,$task,$project_dependencies,$level=0,$project_ $count ++; } } - $depend .= "\""; + // $depend .= "\""; // Define parent if ($project_id && $level < 0) $parent = 'p'.$project_id; @@ -170,9 +172,9 @@ function constructGanttLine($tarr,$task,$project_dependencies,$level=0,$project_ // Name $name=$task['task_name']; - for($i=0; $i < $level; $i++) { - $name='     '.$name; - } + /*for($i=0; $i < $level; $i++) { + $name=' - '.$name; + }*/ // Add line to gantt /* g.AddTaskItem(new JSGantt.TaskItem(1, 'Define Chart API','', '', 'ggroupblack','', 0, 'Brian', 0, 1,0,1,'','','Some Notes text',g)); @@ -199,12 +201,12 @@ function constructGanttLine($tarr,$task,$project_dependencies,$level=0,$project_
pGantt
(required) javascript JSGantt.GanttChart object from which to take settings. Defaults to "g" for backwards compatibility
*/ - $note=""; + //$note=""; $s = "\n// Add taks id=".$task["task_id"]." level = ".$level."\n"; - $s.= "g.AddTaskItem(new JSGantt.TaskItem(".$task['task_id'].",'".dol_escape_js($name)."','".$start_date."', '".$end_date."', '".$task['task_color']."', '".$link."', ".$task['task_milestone'].", '".$resources."', ".($percent >= 0 ? $percent : 0).", ".($task["task_is_group"]>0?1:0).", '".$parent."', 1, '".($depend?$depend:"")."', '".$note."'));"; + // $s.= "g.AddTaskItem(new JSGantt.TaskItem(".$task['task_id'].",'".dol_escape_js($name)."','".$start_date."', '".$end_date."', '".$task['task_color']."', '".$link."', ".$task['task_milestone'].", '".$resources."', ".($percent >= 0 ? $percent : 0).", ".($task["task_is_group"]>0?1:0).", '".$parent."', 1, '".($depend?$depend:"")."', '".$note."'));"; // For JSGanttImproved - //$s.= "g.AddTaskItem(new JSGantt.TaskItem(".$task['task_id'].",'".dol_escape_js($name)."','".$start_date."', '".$end_date."', 'gtaskblue', '".$link."', ".$task['task_milestone'].", '".$resources."', ".($percent >= 0 ? $percent : 0).", ".($task["task_is_group"]>0?1:0).", '".$parent."', 1, '".($depend?$depend:"")."', '".$note."'));"; + $s.= "g.AddTaskItem(new JSGantt.TaskItem(".$task['task_id'].",'".dol_escape_js(trim($name))."','".$start_date."', '".$end_date."', '".$task['task_css']."', '".$link."', ".$task['task_milestone'].", '".$resources."', ".($percent >= 0 ? $percent : 0).", ".($task["task_is_group"]).", '".$parent."', 1, '".($depend?$depend:$parent."SS")."', '".($percent >= 0 ? $percent.'%' : '0%')."','".$task['note']."'));"; echo $s; diff --git a/htdocs/projet/ganttview.php b/htdocs/projet/ganttview.php index b86a961bd69..1751b30a4bb 100644 --- a/htdocs/projet/ganttview.php +++ b/htdocs/projet/ganttview.php @@ -98,58 +98,90 @@ if ($id > 0 || ! empty($ref)) $param=($mode=='mine'?'&mode=mine':''); - print ''; + + // Project card + $linkback = ''.$langs->trans("BackToList").''; - - // Ref - print ''; - - print ''; - - print ''; - print ''; - + + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + + + print '
'; + print '
'; + print '
'; + + print '
'; - print $langs->trans("Ref"); - print ''; + + $morehtmlref='
'; + // Title + $morehtmlref.=$object->title; + // Thirdparty + if ($object->thirdparty->id > 0) + { + $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1, 'project'); + } + $morehtmlref.='
'; + // Define a complementary filter for search of next/prev ref. if (! $user->rights->projet->all->lire) { - $projectsListId = $object->getProjectsAuthorizedForUser($user,0,0); - $object->next_prev_filter=" rowid in (".(count($projectsListId)?join(',',array_keys($projectsListId)):'0').")"; + $objectsListId = $object->getProjectsAuthorizedForUser($user,0,0); + $object->next_prev_filter=" rowid in (".(count($objectsListId)?join(',',array_keys($objectsListId)):'0').")"; } - print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', '', $param); - print '
'.$langs->trans("Label").''.$object->title.'
'.$langs->trans("ThirdParty").''; - if (! empty($object->thirdparty->id)) print $object->thirdparty->getNomUrl(1); - else print ' '; - print '
'; + // Visibility - print ''; - - // Statut - print ''; - - // Date start - print ''; - - // Date end - print ''; - - // Budget - print ''; - + + // Date start - end + print ''; + + // Budget + print ''; + + // Other attributes + $cols = 2; + include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; + print '
'.$langs->trans("Visibility").''; + print '
'.$langs->trans("Visibility").''; if ($object->public) print $langs->trans('SharedProject'); else print $langs->trans('PrivateProject'); print '
'.$langs->trans("Status").''.$object->getLibStatut(4).'
'.$langs->trans("DateStart").''; - print dol_print_date($object->date_start,'day'); - print '
'.$langs->trans("DateEnd").''; - print dol_print_date($object->date_end,'day'); - print '
'.$langs->trans("Budget").''; - if (strcmp($object->budget_amount, '')) print price($object->budget_amount,'',$langs,0,0,0,$conf->currency); - print '
'.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").''; + print dol_print_date($object->date_start,'day'); + $end=dol_print_date($object->date_end,'day'); + if ($end) print ' - '.$end; + print '
'.$langs->trans("Budget").''; + if (strcmp($object->budget_amount, '')) print price($object->budget_amount,'',$langs,1,0,0,$conf->currency); + print '
'; - + print ''; + print '
'; + print '
'; + print '
'; + + print ''; + + // Description + print ''; + + // Categories + if($conf->categorie->enabled) { + print '"; + } + + print '
'.$langs->trans("Description").''; + print nl2br($object->description); + print '
'.$langs->trans("Categories").''; + print $form->showCategories($object->id,'project',1); + print "
'; + + print '
'; + print '
'; + print ''; + + print '
'; + + dol_fiche_end(); } @@ -206,8 +238,18 @@ if (count($tasksarray)>0) $task->fetch($val->id); $tasks[$taskcursor]['task_id']=$val->id; $tasks[$taskcursor]['task_parent']=$val->fk_parent; - $tasks[$taskcursor]['task_is_group']=0; - $tasks[$taskcursor]['task_milestone']=0; + $tasks[$taskcursor]['task_is_group'] = 0; + $tasks[$taskcursor]['task_css'] = 'gtaskblue'; + + if($val->fk_parent > 0 && $task->hasChildren()> 0){ + $tasks[$taskcursor]['task_is_group']=1; + $tasks[$taskcursor]['task_css'] = 'gtaskred'; + } + elseif($task->hasChildren()> 0) { + $tasks[$taskcursor]['task_is_group'] = 1; + $tasks[$taskcursor]['task_css'] = 'gtaskgreen'; + } + $tasks[$taskcursor]['task_milestone']='0'; $tasks[$taskcursor]['task_percent_complete']=$val->progress; //$tasks[$taskcursor]['task_name']=$task->getNomUrl(1); //print dol_print_date($val->date_start).dol_print_date($val->date_end).'
'."\n"; @@ -217,7 +259,7 @@ if (count($tasksarray)>0) $tasks[$taskcursor]['task_color']='b4d1ea'; $idofusers=$task->getListContactId('internal'); $idofthirdparty=$task->getListContactId('external'); - $s=''; + $s=''; if (count($idofusers)>0) { $s.=$langs->trans("Internals").': '; @@ -225,12 +267,12 @@ if (count($tasksarray)>0) foreach($idofusers as $valid) { $userstatic->fetch($valid); - if ($i) $s.=','; + if ($i) $s.=', '; $s.=$userstatic->login; $i++; } } - if (count($idofusers)>0 && (count($idofthirdparty)>0)) $s.=' - '; + //if (count($idofusers)>0 && (count($idofthirdparty)>0)) $s.=' - '; if (count($idofthirdparty)>0) { if ($s) $s.=' - '; @@ -244,18 +286,25 @@ if (count($tasksarray)>0) $i++; } } - if ($s) $tasks[$taskcursor]['task_resources']=''.$langs->trans("List").''; - /* For JSGanttImproved if ($s) $tasks[$taskcursor]['task_resources']=join(',',$idofusers); */ + //if ($s) $tasks[$taskcursor]['task_resources']=''.$langs->trans("List").''; + /* For JSGanttImproved */ + //if ($s) $tasks[$taskcursor]['task_resources']=implode(',',$idofusers); + $tasks[$taskcursor]['task_resources'] = $s; //print "xxx".$val->id.$tasks[$taskcursor]['task_resources']; + $tasks[$taskcursor]['note']=$task->note_public; $taskcursor++; } print "\n"; - if (! empty($conf->use_javascript_ajax)) + if (! empty($conf->use_javascript_ajax)) { //var_dump($_SESSION); - print '
'."\n"; + $dateformatinput='mm/dd/yyyy'; // How the date for data are formated + $dateformatinput2="%m/%d/%Y"; // How the date for data are formated + //var_dump($dateformatinput); + //var_dump($dateformatinput2); + print '
'."\n"; include_once DOL_DOCUMENT_ROOT.'/projet/ganttchart.inc.php'; print '
'."\n"; } diff --git a/htdocs/projet/graph_opportunities.inc.php b/htdocs/projet/graph_opportunities.inc.php index 199840bb1c6..673fbc973ad 100644 --- a/htdocs/projet/graph_opportunities.inc.php +++ b/htdocs/projet/graph_opportunities.inc.php @@ -1,13 +1,14 @@ global->PROJECT_USE_OPPORTUNITIES)) { - $sql = "SELECT COUNT(p.rowid) as nb, SUM(p.opp_amount) as opp_amount, SUM(p.opp_amount * p.opp_percent) as ponderated_opp_amount, p.fk_opp_status as opp_status"; - $sql.= " FROM ".MAIN_DB_PREFIX."projet as p"; + $sql = "SELECT p.fk_opp_status as opp_status, cls.code, COUNT(p.rowid) as nb, SUM(p.opp_amount) as opp_amount, SUM(p.opp_amount * p.opp_percent) as ponderated_opp_amount"; + $sql.= " FROM ".MAIN_DB_PREFIX."projet as p, ".MAIN_DB_PREFIX."c_lead_status as cls"; $sql.= " WHERE p.entity = ".$conf->entity; - $sql.= " AND p.fk_statut = 1"; + $sql.= " AND p.fk_opp_status = cls.rowid"; + $sql.= " AND p.fk_statut = 1"; // Opend projects only if ($mine || empty($user->rights->projet->all->lire)) $sql.= " AND p.rowid IN (".$projectsListId.")"; if ($socid) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")"; - $sql.= " GROUP BY p.fk_opp_status"; + $sql.= " GROUP BY p.fk_opp_status, cls.code"; $resql = $db->query($sql); if ($resql) @@ -34,8 +35,11 @@ if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) $valsamount[$obj->opp_status]=$obj->opp_amount; $totalnb+=$obj->nb; if ($obj->opp_status) $totaloppnb+=$obj->nb; - $totalamount+=$obj->opp_amount; - $ponderated_opp_amount+=$obj->ponderated_opp_amount; + if (! in_array($obj->code, array('WON', 'LOST'))) + { + $totalamount+=$obj->opp_amount; + $ponderated_opp_amount+=$obj->ponderated_opp_amount; + } } $total+=$row[0]; } @@ -79,8 +83,11 @@ if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) } //if ($totalinprocess != $total) //print '
'.$langs->trans("Total").' ('.$langs->trans("CustomersOrdersRunning").')'.$totalinprocess.'
'.$langs->trans("OpportunityTotalAmount").''.price($totalamount, 0, '', 1, -1, -1, $conf->currency).'
'.$langs->trans("OpportunityPonderatedAmount").''.price(price2num($ponderated_opp_amount,'MT'), 0, '', 1, -1, -1, $conf->currency).'
'.$langs->trans("OpportunityTotalAmount").' ('.$langs->trans("WonLostExcluded").')'.price($totalamount, 0, '', 1, -1, -1, $conf->currency).'
'; + //print $langs->trans("OpportunityPonderatedAmount").' ('.$langs->trans("WonLostExcluded").')'; + print $form->textwithpicto($langs->trans("OpportunityPonderatedAmount").' ('.$langs->trans("WonLostExcluded").')', $langs->trans("OpportunityPonderatedAmountDesc"), 1); + print ''.price(price2num($ponderated_opp_amount,'MT'), 0, '', 1, -1, -1, $conf->currency).'

"; } else diff --git a/htdocs/projet/index.php b/htdocs/projet/index.php index f3623bdd6a1..752e3615464 100644 --- a/htdocs/projet/index.php +++ b/htdocs/projet/index.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2015 Laurent Destailleur + * Copyright (C) 2004-2016 Laurent Destailleur * Copyright (C) 2005-2010 Regis Houssin * * This program is free software; you can redistribute it and/or modify @@ -114,7 +114,7 @@ if (count($listofsearchfields)) { if ($i == 0) print ''.$langs->trans("Search").''; print ''; - print ':'; + print ''; if ($i == 0) print ''; print ''; $i++; diff --git a/htdocs/projet/info.php b/htdocs/projet/info.php new file mode 100644 index 00000000000..5a975b4ec1e --- /dev/null +++ b/htdocs/projet/info.php @@ -0,0 +1,178 @@ + + * Copyright (C) 2005-2009 Regis Houssin + * + * 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 . + */ + +/** + * \file htdocs/projet/info.php + * \ingroup commande + * \brief Page with info on project + */ + +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; + +$langs->load("projects"); + +if (GETPOST('actioncode','array')) +{ + $actioncode=GETPOST('actioncode','array',3); + if (! count($actioncode)) $actioncode='0'; +} +else +{ + $actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE)); +} +$search_agenda_label=GETPOST('search_agenda_label'); + +// Security check +$socid=0; +$id = GETPOST("id",'int'); +if ($user->societe_id) $socid=$user->societe_id; +$result=restrictedArea($user,'projet',$id,''); + +if (!$user->rights->projet->lire) accessforbidden(); + + + +/* + * 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'); + +// 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 +{ + $actioncode=''; + $search_agenda_label=''; +} + + + +/* + * View + */ + +$form = new Form($db); + +$title=$langs->trans("Project").' - '.$object->ref.' '.$object->name; +if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/projectnameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->ref.' '.$object->name.' - '.$langs->trans("Info"); +$help_url="EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos"; +llxHeader("",$title,$help_url); + +$object = new Project($db); +$object->fetch($id); +$object->fetch_thirdparty(); +$object->info($id); + +$head = project_prepare_head($object); + +dol_fiche_head($head, 'agenda', $langs->trans("Project"), 0, ($object->public?'projectpub':'project')); + + +// Project card + +$linkback = ''.$langs->trans("BackToList").''; + +$morehtmlref='
'; +// Title +$morehtmlref.=$object->title; +// Thirdparty +if ($object->thirdparty->id > 0) +{ + $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1, 'project'); +} +$morehtmlref.='
'; + +// Define a complementary filter for search of next/prev ref. +if (! $user->rights->projet->all->lire) +{ + $objectsListId = $object->getProjectsAuthorizedForUser($user,0,0); + $object->next_prev_filter=" rowid in (".(count($objectsListId)?join(',',array_keys($objectsListId)):'0').")"; +} + +dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + + +print '
'; +print '
'; + +dol_print_object_info($object, 1); + +print '
'; + +print '
'; + +dol_fiche_end(); + + +// Actions buttons + +$out=''; +$permok=$user->rights->agenda->myactions->create; +if ($permok) +{ + $out.='&projectid='.$object->id; +} + + +print '
'; + +if (! empty($conf->agenda->enabled)) +{ + if (! empty($user->rights->agenda->myactions->create) || ! empty($user->rights->agenda->allactions->create)) + { + print ''.$langs->trans("AddAction").''; + } + else + { + print ''.$langs->trans("AddAction").''; + } +} + +print '
'; + + +if (!empty($object->id)) +{ + print load_fiche_titre($langs->trans("ActionsOnProject"),'',''); + + // List of actions on element + /*include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; + $formactions=new FormActions($db); + $somethingshown=$formactions->showactions($object,'project',0);*/ + + // List of todo actions + //show_actions_todo($conf,$langs,$db,$object,null,0,$actioncode); + + // List of done actions + //show_actions_done($conf,$langs,$db,$object,null,0,$actioncode); + + // List of all actions + $filters=array(); + $filters['search_agenda_label']=$search_agenda_label; + show_actions_done($conf,$langs,$db,$object,null,0,$actioncode, '', $filters); +} + + +llxFooter(); +$db->close(); diff --git a/htdocs/projet/jsgantt_language.js.php b/htdocs/projet/jsgantt_language.js.php index 16b89fbebb3..f6b5799bda0 100644 --- a/htdocs/projet/jsgantt_language.js.php +++ b/htdocs/projet/jsgantt_language.js.php @@ -32,44 +32,31 @@ if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML',1); if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); -require_once '../main.inc.php'; +require_once __DIR__.'/../main.inc.php'; // Define css type header('Content-type: text/javascript'); global $langs; ?> -var i18n = new Array(); -i18n["sMinute"]= "transnoentities("Minute") ?>"; -i18n["sMinutes"]= "transnoentities("Minutes") ?>"; -i18n["sHour"]= "transnoentities("Hour") ?>"; -i18n["sHours"]= "transnoentities("Hours") ?>"; -i18n["sDay"]= "transnoentities("Day") ?>"; -i18n["sDays"]= "transnoentities("Days") ?>"; -i18n["sWeek"] = "transnoentities("Week") ?>"; -i18n["sMonth"] = "transnoentities("Month") ?>"; -i18n["sQuarter"] = "transnoentities("Quadri") ?>"; -i18n["View"] = "transnoentities("View") ?>"; -i18n["Resource"] = "transnoentities("Resources") ?>"; -i18n["Duration"] = "transnoentities("Duration") ?>"; -i18n["Start_Date"] = "transnoentities("DateStart") ?>"; -i18n["End_Date"] = "transnoentities("DateEnd") ?>"; -i18n["Date_Format"] = "transnoentities("Format") ?>"; -i18n["January"] = "transnoentities("January") ?>"; -i18n["February"] = "transnoentities("February") ?>"; -i18n["March"] = "transnoentities("March") ?>"; -i18n["April"] = "transnoentities("April") ?>"; -i18n["May"] = "transnoentities("May") ?>"; -i18n["June"] = "transnoentities("June") ?>"; -i18n["July"] = "transnoentities("July") ?>"; -i18n["August"] = "transnoentities("August") ?>"; -i18n["September"] = "transnoentities("Septembre") ?>"; -i18n["October"] = "transnoentities("October") ?>"; -i18n["November"] = "transnoentities("November") ?>"; -i18n["December"] = "transnoentities("December") ?>"; -i18n["Quarter"] = "transnoentities("Quarter") ?>"; -i18n["Period"] = "transnoentities("Period") ?>"; - +var vLangs={'getDefaultLang(1);?>': + { + 'format':'transnoentities('Period');?>','hour':'"transnoentities('Hour'); ?>','day':'transnoentities('Day'); ?>', + 'week':'transnoentities('Week'); ?>','month':'transnoentities('Month'); ?>','quarter':'transnoentities('Quadri'); ?>', + 'hours':'transnoentities('Hours'); ?>','days':'transnoentities('Days'); ?>','weeks':'transnoentities('Weeks');?>', + 'months':'transnoentities('Months'); ?>','quarters':'transnoentities('Quadri'); ?>','hr':'Hr','dy':'transnoentities('Day'); ?>','wk':'transnoentities('Week'); ?>','mth':'transnoentities('Month'); ?>','qtr':'transnoentities('Quadri'); ?>','hrs':'transnoentities('Hours'); ?>', + 'dys':'transnoentities('Days'); ?>','wks':'transnoentities('Weeks'); ?>','mths':'transnoentities('Months'); ?>','qtrs':'transnoentities('Quadri'); ?>','resource':'transnoentities('Resources')); ?>','duration':'transnoentities('Duration')); ?>','comp':'% transnoentities('Total')); ?>', + 'completion':'transnoentities('Total'); ?>','startdate':'transnoentities('DateStart'); ?>','enddate':'transnoentities('DateEnd'); ?>','moreinfo':'transnoentities('MoreInformation')); ?>', + 'notes':'transnoentities('NotePublic'); ?>', + 'january':'transnoentities('January'); ?>','february':'transnoentities('February'); ?>','march':'transnoentities('March'); ?>','april':'transnoentities('April'); ?>','maylong':'transnoentities('May'); ?>','june':'transnoentities('June'); ?>','july':'transnoentities('July'); ?>', + 'august':'transnoentities('August'); ?>','september':'transnoentities('September'); ?>','october':'transnoentities('October'); ?>','november':'transnoentities('November'); ?>','december':'transnoentities('December'); ?>', + 'jan':'transnoentities('JanuaryMin'); ?>','feb':'transnoentities('FebruaryMin'); ?>','mar':'transnoentities('MarchMin'); ?>','apr':'transnoentities('AprilMin'); ?>','may':'transnoentities('MayMin'); ?>','jun':'transnoentities('JuneMin'); ?>','jul':'transnoentities('JulyMin'); ?>', + 'aug':'transnoentities('AugustMin'); ?>','sep':'transnoentities('SeptemberMin'); ?>','oct':'transnoentities('OctoberMin'); ?>','nov':'transnoentities('NovemberMin'); ?>','dec':'transnoentities('DecemberMin'); ?>', + 'sunday':'transnoentities('Sunday'); ?>','monday':'transnoentities('Monday'); ?>','tuesday':'transnoentities('Tuesday'); ?>','wednesday':'transnoentities('Wednesday'); ?>','thursday':'transnoentities('Thursday'); ?>','friday':'transnoentities('Friday'); ?>','saturday':'transnoentities('Saturday'); ?>', + 'sun':'transnoentities('SundayMin'); ?>','mon':'transnoentities('MondayMin'); ?>','tue':'transnoentities('TuesdayMin'); ?>','wed':'transnoentities('WednesdayMin'); ?>','thu':'transnoentities('ThursdayMin'); ?>','fri':'transnoentities('FridayMin'); ?>','sat':'transnoentities('SaturdayMin'); ?>' + } +}; +var vLang='getDefaultLang(1);?>'; close(); diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index ce2ff974013..56da78cdbcf 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -63,6 +63,7 @@ $pageprev = $page - 1; $pagenext = $page + 1; $search_all=GETPOST("search_all"); +$search_categ=GETPOST("search_categ",'alpha'); $search_ref=GETPOST("search_ref"); $search_label=GETPOST("search_label"); $search_societe=GETPOST("search_societe"); @@ -72,6 +73,7 @@ $search_status=GETPOST("search_status",'int'); $search_opp_status=GETPOST("search_opp_status",'alpha'); $search_opp_percent=GETPOST("search_opp_percent",'alpha'); $search_opp_amount=GETPOST("search_opp_amount",'alpha'); +$search_budget_amount=GETPOST("search_budget_amount",'alpha'); $search_public=GETPOST("search_public",'int'); $search_user=GETPOST('search_user','int'); $search_sale=GETPOST('search_sale','int'); @@ -121,6 +123,7 @@ $arrayfields=array( 'p.opp_amount'=>array('label'=>$langs->trans("OpportunityAmountShort"), 'checked'=>1, 'enabled'=>($conf->global->PROJECT_USE_OPPORTUNITIES?1:0), 'position'=>103), 'p.fk_opp_status'=>array('label'=>$langs->trans("OpportunityStatusShort"), 'checked'=>1, 'enabled'=>($conf->global->PROJECT_USE_OPPORTUNITIES?1:0), 'position'=>104), 'p.opp_percent'=>array('label'=>$langs->trans("OpportunityProbabilityShort"), 'checked'=>1, 'enabled'=>($conf->global->PROJECT_USE_OPPORTUNITIES?1:0), 'position'=>105), + 'p.budget_amount'=>array('label'=>$langs->trans("Budget"), 'checked'=>0, 'position'=>110), 'p.datec'=>array('label'=>$langs->trans("DateCreationShort"), 'checked'=>0, 'position'=>500), 'p.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500), 'p.fk_statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000), @@ -145,6 +148,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers { $search_all=''; + $search_categ=''; $search_ref=""; $search_label=""; $search_societe=""; @@ -153,6 +157,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP $search_opp_status=-1; $search_opp_amount=''; $search_opp_percent=''; + $search_budget_amount=''; $search_public=""; $search_sale=""; $search_user=''; @@ -201,13 +206,16 @@ if ($resql) else dol_print_error($db); if (count($listofprojectcontacttype) == 0) $listofprojectcontacttype[0]='0'; // To avoid sql syntax error if not found + $distinct='DISTINCT'; // We add distinct until we are added a protection to be sure a contact of a project and task is only once. $sql = "SELECT ".$distinct." p.rowid as projectid, p.ref, p.title, p.fk_statut, p.fk_opp_status, p.public, p.fk_user_creat"; -$sql.= ", p.datec as date_creation, p.dateo as date_start, p.datee as date_end, p.opp_amount, p.opp_percent, p.tms as date_update"; +$sql.= ", p.datec as date_creation, p.dateo as date_start, p.datee as date_end, p.opp_amount, p.opp_percent, p.tms as date_update, p.budget_amount"; $sql.= ", s.nom as name, s.rowid as socid"; $sql.= ", cls.code as opp_status_code"; +// We'll need these fields in order to filter by categ +if ($search_categ) $sql .= ", cs.fk_categorie, cs.fk_project"; // Add fields for extrafields -foreach ($extrafields->attribute_list as $key => $val) $sql.=",ef.".$key.' as options_'.$key; +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 @@ -216,6 +224,8 @@ $sql.= " FROM ".MAIN_DB_PREFIX."projet as p"; if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet_extrafields as ef on (p.rowid = ef.fk_object)"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_lead_status as cls on p.fk_opp_status = cls.rowid"; +// We'll need this table joined to the select in order to filter by categ +if (! empty($search_categ)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_project as cs ON p.rowid = cs.fk_project"; // We'll need this table joined to the select in order to filter by categ // We'll need this table joined to the select in order to filter by sale if ($search_sale > 0 || (! $user->rights->societe->client->voir && ! $socid)) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc = s.rowid"; if ($search_user > 0) @@ -226,6 +236,8 @@ $sql.= " WHERE p.entity IN (".getEntity('project',1).')'; if (! $user->rights->projet->all->lire) $sql.= " AND p.rowid IN (".$projectsListId.")"; // public and assigned to, or restricted to company for external users // No need to check company, as filtering of projects must be done by getProjectsAuthorizedForUser if ($socid) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")"; +if ($search_categ > 0) $sql.= " AND cs.fk_categorie = ".$db->escape($search_categ); +if ($search_categ == -2) $sql.= " AND cs.fk_categorie IS NULL"; if ($search_ref) $sql .= natural_search('p.ref', $search_ref); if ($search_label) $sql .= natural_search('p.title', $search_label); if ($search_societe) $sql .= natural_search('s.nom', $search_societe); @@ -258,18 +270,24 @@ else if ($year > 0) $sql.= " AND p.datee BETWEEN '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'"; } if ($search_all) $sql .= natural_search(array_keys($fieldstosearchall), $search_all); -if ($search_status >= 0) $sql .= " AND p.fk_statut = ".$db->escape($search_status); +if ($search_status >= 0) +{ + if ($search_status == 99) $sql .= " AND p.fk_statut <> 2"; + else $sql .= " AND p.fk_statut = ".$db->escape($search_status); +} if ($search_opp_status) { if (is_numeric($search_opp_status) && $search_opp_status > 0) $sql .= " AND p.fk_opp_status = ".$db->escape($search_opp_status); if ($search_opp_status == 'all') $sql .= " AND p.fk_opp_status IS NOT NULL"; - if ($search_opp_status == 'openedopp') $sql .= " AND p.fk_opp_status IS NOT NULL AND p.fk_opp_status NOT IN (SELECT rowid FROM ".MAIN_DB_PREFIX."c_lead_status WHERE code IN ('WIN','LOST'))"; + if ($search_opp_status == 'openedopp') $sql .= " AND p.fk_opp_status IS NOT NULL AND p.fk_opp_status NOT IN (SELECT rowid FROM ".MAIN_DB_PREFIX."c_lead_status WHERE code IN ('WON','LOST'))"; if ($search_opp_status == 'none') $sql .= " AND p.fk_opp_status IS NULL"; } if ($search_public!='') $sql .= " AND p.public = ".$db->escape($search_public); if ($search_sale > 0) $sql.= " AND sc.fk_user = " .$search_sale; if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND ((s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id.") OR (s.rowid IS NULL))"; if ($search_user > 0) $sql.= " AND ecp.fk_c_type_contact IN (".join(',',array_keys($listofprojectcontacttype)).") AND ecp.element_id = p.rowid AND ecp.fk_socpeople = ".$search_user; +if ($search_opp_amount != '') $sql .= natural_search('p.opp_amount', $search_opp_amount, 1); +if ($search_budget_amount != '') $sql .= natural_search('p.budget_amount', $search_budget_amount, 1); // Add where from extra fields foreach ($search_array_options as $key => $val) { @@ -298,7 +316,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) $sql.= $db->plimit($limit + 1,$offset); - +//print $sql; dol_syslog("list allowed project", LOG_DEBUG); //print $sql; $resql = $db->query($sql); @@ -322,11 +340,13 @@ if ($resql) if ($search_label != '') $param.='&search_label='.$search_label; if ($search_societe != '') $param.='&search_societe='.$search_societe; if ($search_status >= 0) $param.='&search_status='.$search_status; - if ((is_numeric($search_opp_status) && $search_opp_status >= 0) || in_array($search_opp_status, array('all','none'))) $param.='&search_opp_status='.urlencode($search_opp_status); - if ((is_numeric($search_opp_percent) && $search_opp_percent >= 0) || in_array($search_opp_percent, array('all','none'))) $param.='&search_opp_percent='.urlencode($search_opp_percent); + if ((is_numeric($search_opp_status) && $search_opp_status >= 0) || in_array($search_opp_status, array('all','openedopp','none'))) $param.='&search_opp_status='.urlencode($search_opp_status); + if ((is_numeric($search_opp_percent) && $search_opp_percent >= 0) || in_array($search_opp_percent, array('all','openedopp','none'))) $param.='&search_opp_percent='.urlencode($search_opp_percent); if ($search_public != '') $param.='&search_public='.$search_public; if ($search_user > 0) $param.='&search_user='.$search_user; if ($search_sale > 0) $param.='&search_sale='.$search_sale; + if ($search_opp_amount != '') $param.='&search_opp_amount='.$search_opp_amount; + if ($search_budget_amount != '') $param.='&search_budget_amount='.$search_budget_amount; if ($optioncss != '') $param.='&optioncss='.$optioncss; // Add $param from extra fields foreach ($search_array_options as $key => $val) @@ -335,7 +355,7 @@ if ($resql) $tmpkey=preg_replace('/search_options_/','',$key); if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val); } - + $text=$langs->trans("Projects"); if ($search_user == $user->id) $text=$langs->trans('MyProjects'); @@ -365,6 +385,26 @@ if ($resql) print $langs->trans("FilterOnInto", $search_all) . join(', ',$fieldstosearchall); } + $moreforfilter=''; + + // Filter on categories + if (! empty($conf->categorie->enabled)) + { + require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; + $moreforfilter.='
'; + $moreforfilter.=$langs->trans('Categories'). ': '; + $moreforfilter.=$formother->select_categories('project',$search_categ,'search_categ',1); + $moreforfilter.='
'; + } + + // If the user can view user other than himself + $moreforfilter.='
'; + $moreforfilter.=$langs->trans('ProjectsWithThisUserAsContact'). ': '; + $includeonly=''; + if (empty($user->rights->user->user->lire)) $includeonly=array($user->id); + $moreforfilter.=$form->select_dolusers($search_user, 'search_user', 1, '', 0, $includeonly, '', 0, 0, 0, '', 0, '', 'maxwidth300'); + $moreforfilter.='
'; + // If the user can view thirdparties other than his' if ($user->rights->societe->client->voir || $socid) { @@ -375,14 +415,6 @@ if ($resql) $moreforfilter.='
'; } - // If the user can view user other than himself - $moreforfilter.='
'; - $moreforfilter.=$langs->trans('ProjectsWithThisUserAsContact'). ': '; - $includeonly=''; - if (empty($user->rights->user->user->lire)) $includeonly=array($user->id); - $moreforfilter.=$form->select_dolusers($search_user, 'search_user', 1, '', 0, $includeonly, '', 0, 0, 0, '', 0, '', 'maxwidth300'); - $moreforfilter.='
'; - if (! empty($moreforfilter)) { print '
'; @@ -409,7 +441,8 @@ if ($resql) if (! empty($arrayfields['p.opp_amount']['checked'])) print_liste_field_titre($arrayfields['p.opp_amount']['label'],$_SERVER["PHP_SELF"],'p.opp_amount',"",$param,'align="right"',$sortfield,$sortorder); if (! empty($arrayfields['p.fk_opp_status']['checked'])) print_liste_field_titre($arrayfields['p.fk_opp_status']['label'],$_SERVER["PHP_SELF"],'p.fk_opp_status',"",$param,'align="center"',$sortfield,$sortorder); if (! empty($arrayfields['p.opp_percent']['checked'])) print_liste_field_titre($arrayfields['p.opp_percent']['label'],$_SERVER["PHP_SELF"],'p.opp_percent',"",$param,'align="right"',$sortfield,$sortorder); - // Extra fields + if (! empty($arrayfields['p.budget_amount']['checked'])) print_liste_field_titre($arrayfields['p.budget_amount']['label'],$_SERVER["PHP_SELF"],'p.budget_amount',"",$param,'align="right"',$sortfield,$sortorder); + // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { foreach($extrafields->attribute_label as $key => $val) @@ -498,10 +531,16 @@ if ($resql) print ''; print ''; } - // Extra fields - if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) + if (! empty($arrayfields['p.budget_amount']['checked'])) { - foreach($extrafields->attribute_label as $key => $val) + print ''; + print ''; + print ''; + } + // 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'])) { @@ -540,7 +579,10 @@ if ($resql) if (! empty($arrayfields['p.fk_statut']['checked'])) { print ''; - print $form->selectarray('search_status', array('-1'=>'', '0'=>$langs->trans('Draft'),'1'=>$langs->trans('Opened'),'2'=>$langs->trans('Closed')),$search_status); + $arrayofstatus = array(); + foreach($projectstatic->statuts_short as $key => $val) $arrayofstatus[$key]=$langs->trans($val); + $arrayofstatus['99']=$langs->trans("NotClosed").' ('.$langs->trans('Draft').'+'.$langs->trans('Opened').')'; + print $form->selectarray('search_status', $arrayofstatus, $search_status, 1, 0, 0, '', 0, 0, 0, '', 'maxwidth100'); print ''; } // Action column @@ -551,7 +593,9 @@ if ($resql) print ''."\n"; - $i = 0; + $i=0; + $var=true; + $totalarray=array(); while ($i < min($num,$limit)) { $obj = $db->fetch_object($resql); @@ -577,6 +621,7 @@ if ($resql) print $projectstatic->getNomUrl(1); if ($projectstatic->hasDelay()) print img_warning($langs->trans('Late')); print ''; + if (! $i) $totalarray['nbfield']++; } // Title if (! empty($arrayfields['p.title']['checked'])) @@ -584,6 +629,7 @@ if ($resql) print ''; print dol_trunc($obj->title,80); print ''; + if (! $i) $totalarray['nbfield']++; } // Company if (! empty($arrayfields['s.nom']['checked'])) @@ -600,6 +646,7 @@ if ($resql) print ' '; } print ''; + if (! $i) $totalarray['nbfield']++; } // Sales Representatives if (! empty($arrayfields['commercial']['checked'])) @@ -641,6 +688,7 @@ if ($resql) print ' '; } print ''; + if (! $i) $totalarray['nbfield']++; } // Date start if (! empty($arrayfields['p.dateo']['checked'])) @@ -648,13 +696,15 @@ if ($resql) print ''; print dol_print_date($db->jdate($obj->date_start),'day'); print ''; - } + if (! $i) $totalarray['nbfield']++; + } // Date end if (! empty($arrayfields['p.datee']['checked'])) { print ''; print dol_print_date($db->jdate($obj->date_end),'day'); print ''; + if (! $i) $totalarray['nbfield']++; } // Visibility if (! empty($arrayfields['p.public']['checked'])) @@ -663,25 +713,46 @@ if ($resql) if ($obj->public) print $langs->trans('SharedProject'); else print $langs->trans('PrivateProject'); print ''; + if (! $i) $totalarray['nbfield']++; } // Amount if (! empty($arrayfields['p.opp_amount']['checked'])) { print ''; - if ($obj->opp_status_code) print price($obj->opp_amount, 1, '', 1, -1, -1, ''); + if ($obj->opp_status_code) + { + print price($obj->opp_amount, 1, '', 1, -1, -1, ''); + $totalarray['totalopp'] += $obj->opp_amount; + } print ''; + if (! $i) $totalarray['nbfield']++; + if (! $i) $totalarray['totaloppfield']=$totalarray['nbfield']; } if (! empty($arrayfields['p.fk_opp_status']['checked'])) { print ''; if ($obj->opp_status_code) print $langs->trans("OppStatusShort".$obj->opp_status_code); print ''; - } + if (! $i) $totalarray['nbfield']++; + } if (! empty($arrayfields['p.opp_percent']['checked'])) { print ''; if ($obj->opp_percent) print price($obj->opp_percent, 1, '', 1, 0).'%'; print ''; + if (! $i) $totalarray['nbfield']++; + } + if (! empty($arrayfields['p.budget_amount']['checked'])) + { + print ''; + if ($obj->budget_amount != '') + { + print price($obj->budget_amount, 1, '', 1, -1, -1); + $totalarray['totalbudget'] += $obj->budget_amount; + } + print ''; + if (! $i) $totalarray['nbfield']++; + if (! $i) $totalarray['totalbudgetfield']=$totalarray['nbfield']; } // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) @@ -699,6 +770,7 @@ if ($resql) print ''; } } + if (! $i) $totalarray['nbfield']++; } // Fields from hook $parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj); @@ -710,6 +782,7 @@ if ($resql) print ''; print dol_print_date($db->jdate($obj->date_creation), 'dayhour'); print ''; + if (! $i) $totalarray['nbfield']++; } // Date modification if (! empty($arrayfields['p.tms']['checked'])) @@ -717,16 +790,26 @@ if ($resql) print ''; print dol_print_date($db->jdate($obj->date_update), 'dayhour'); print ''; + if (! $i) $totalarray['nbfield']++; } // Status if (! empty($arrayfields['p.fk_statut']['checked'])) { $projectstatic->statut = $obj->fk_statut; print ''.$projectstatic->getLibStatut(5).''; + if (! $i) $totalarray['nbfield']++; } - // Action column - print ''; - + // Action column + print ''; + 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 ''; + } + print ''; + if (! $i) $totalarray['nbfield']++; + print "\n"; } @@ -734,6 +817,27 @@ if ($resql) $i++; } + + // Show total line + if (isset($totalarray['totaloppfield']) || isset($totalarray['totalbudgetfield'])) + { + print ''; + $i=0; + while ($i < $totalarray['nbfield']) + { + $i++; + if ($i == 1) + { + if ($num < $limit) print ''.$langs->trans("Total").''; + else print ''.$langs->trans("Totalforthispage").''; + } + elseif ($totalarray['totaloppfield'] == $i) print ''.price($totalarray['totalopp']).''; + elseif ($totalarray['totalbudgetfield'] == $i) print ''.price($totalarray['totalbudget']).''; + else print ''; + } + print ''; + } + $db->free($resql); $parameters=array('sql' => $sql); diff --git a/htdocs/projet/note.php b/htdocs/projet/note.php index 43df7ce3b3d..31081c92256 100644 --- a/htdocs/projet/note.php +++ b/htdocs/projet/note.php @@ -79,61 +79,41 @@ if ($id > 0 || ! empty($ref)) $head = project_prepare_head($object); dol_fiche_head($head, 'notes', $langs->trans('Project'), 0, ($object->public?'projectpub':'project')); - print ''; - + + // Project card + $linkback = ''.$langs->trans("BackToList").''; - - // Ref - print ''; - - // Label - print ''; - - // Third party - print ''; - - // Visibility - print ''; - - // Statut - print ''; - - // Date start - print ''; - - // Date end - print ''; - - // Budget - print ''; - print "
'.$langs->trans("Ref").''; + + $morehtmlref='
'; + // Title + $morehtmlref.=$object->title; + // Thirdparty + if ($object->thirdparty->id > 0) + { + $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1, 'project'); + } + $morehtmlref.='
'; + // Define a complementary filter for search of next/prev ref. if (! $user->rights->projet->all->lire) { - $projectsListId = $object->getProjectsAuthorizedForUser($user,0,0); - $object->next_prev_filter=" rowid in (".(count($projectsListId)?join(',',array_keys($projectsListId)):'0').")"; + $objectsListId = $object->getProjectsAuthorizedForUser($user,0,0); + $object->next_prev_filter=" rowid in (".(count($objectsListId)?join(',',array_keys($objectsListId)):'0').")"; } - print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref'); - print '
'.$langs->trans("Label").''.$object->title.'
'.$langs->trans("ThirdParty").''; - if ($object->thirdparty->id > 0) print $object->thirdparty->getNomUrl(1); - else print' '; - print '
'.$langs->trans("Visibility").''; - if ($object->public) print $langs->trans('SharedProject'); - else print $langs->trans('PrivateProject'); - print '
'.$langs->trans("Status").''.$object->getLibStatut(4).'
'.$langs->trans("DateStart").''; - print dol_print_date($object->date_start,'day'); - print '
'.$langs->trans("DateEnd").''; - print dol_print_date($object->date_end,'day'); - print '
'.$langs->trans("Budget").''; - if (strcmp($object->budget_amount, '')) print price($object->budget_amount,'',$langs,0,0,0,$conf->currency); - print '
"; - - print '
'; - + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + + + print '
'; + print '
'; + $cssclass="titlefield"; include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; - + + print '
'; + + print '
'; + dol_fiche_end(); } diff --git a/htdocs/projet/stats/index.php b/htdocs/projet/stats/index.php index 1e099ad10a0..15a2f3403c4 100644 --- a/htdocs/projet/stats/index.php +++ b/htdocs/projet/stats/index.php @@ -215,7 +215,7 @@ if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { // Build graphic with transformation rate - $data = $stats_project->getWeightedAmountByMonthWithPrevYear($endyear,$startyear); + $data = $stats_project->getWeightedAmountByMonthWithPrevYear($endyear,$startyear, 0, 0); //var_dump($data); // $data = array(array('Lib',val1,val2,val3),...) @@ -253,6 +253,7 @@ if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) // Show array $stats_project->year=0; $data_all_year = $stats_project->getAllByYear(); + if (!empty($year)) $stats_project->year=$year; $arrayyears=array(); foreach($data_all_year as $val) { @@ -307,8 +308,9 @@ print ''.$langs->trans("Year").''; print ''.$langs->trans("NbOfProjects").''; if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { - print ''.$langs->trans("OpportunityAmount").''; - print ''.$langs->trans("AmountAverage").''; + print ''.$langs->trans("OpportunityAmountShort").''; + print ''.$langs->trans("OpportunityAmountAverageShort").''; + print ''.$langs->trans("OpportunityAmountWeigthedShort").''; } print ''; @@ -327,6 +329,7 @@ foreach ($data_all_year as $val) { print '0'; print '0'; + print '0'; } print '0'; print ''; @@ -337,8 +340,9 @@ foreach ($data_all_year as $val) print ''.$val['nb'].''; if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { - print ''.price(price2num($val['total'],'MT'),1).''; - print ''.price(price2num($val['avg'],'MT'),1).''; + print ''.($val['total']?price(price2num($val['total'],'MT'),1):'0').''; + print ''.($val['avg']?price(price2num($val['avg'],'MT'),1):'0').''; + print ''.($val['weighted']?price(price2num($val['weighted'],'MT'),1):'0').''; } print ''; $oldyear=$year; diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 3d61c96299b..986c0537bc5 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -37,6 +37,7 @@ $langs->load("projects"); $action = GETPOST('action', 'alpha'); $id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); +$taskref = GETPOST('taskref', 'alpha'); $backtopage=GETPOST('backtopage','alpha'); $cancel=GETPOST('cancel'); @@ -88,7 +89,13 @@ if ($action == 'createtask' && $user->rights->projet->creer) if (! $cancel) { - if (empty($label)) + if (empty($taskref)) + { + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Ref")), null, 'errors'); + $action='create'; + $error++; + } + if (empty($label)) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Label")), null, 'errors'); $action='create'; @@ -112,7 +119,7 @@ if ($action == 'createtask' && $user->rights->projet->creer) $task = new Task($db); $task->fk_project = $projectid; - $task->ref = GETPOST('ref','alpha'); + $task->ref = $taskref; $task->label = $label; $task->description = $description; $task->planned_workload = $planned_workload; @@ -121,7 +128,7 @@ if ($action == 'createtask' && $user->rights->projet->creer) $task->date_start = $date_start; $task->date_end = $date_end; $task->progress = $progress; - + // Fill array 'array_options' with data from add form $ret = $extrafields_task->setOptionalsFromPost($extralabels_task,$task); @@ -204,64 +211,106 @@ if ($id > 0 || ! empty($ref)) $param=($mode=='mine'?'&mode=mine':''); - print ''; - $linkback = ''.$langs->trans("BackToList").''; - - // Ref - print ''; + // Project card + + $linkback = ''.$langs->trans("BackToList").''; + + $morehtmlref='
'; + // Title + $morehtmlref.=$object->title; + // Thirdparty + if ($object->thirdparty->id > 0) + { + $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1, 'project'); + } + $morehtmlref.='
'; + + // Define a complementary filter for search of next/prev ref. + if (! $user->rights->projet->all->lire) + { + $objectsListId = $object->getProjectsAuthorizedForUser($user,0,0); + $object->next_prev_filter=" rowid in (".(count($objectsListId)?join(',',array_keys($objectsListId)):'0').")"; + } + + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); - print ''; + print '
'; + print '
'; + print '
'; - print '
'; - print ''; + print '
'; - print $langs->trans("Ref"); - print ''; - // Define a complementary filter for search of next/prev ref. - if (! $user->rights->projet->all->lire) - { - $projectsListId = $object->getProjectsAuthorizedForUser($user,0,0); - $object->next_prev_filter=" rowid in (".(count($projectsListId)?join(',',array_keys($projectsListId)):'0').")"; - } - print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', '', $param); - print '
'.$langs->trans("Label").''.$object->title.'
'.$langs->trans("ThirdParty").''; - if (! empty($object->thirdparty->id)) print $object->thirdparty->getNomUrl(1); - else print ' '; - print '
'; - // Visibility - print ''; + // Visibility + print ''; - // Statut - print ''; + /*if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) + { + // Opportunity status + print ''; - // Date start - print ''; + // Opportunity percent + print ''; - // Date end - print ''; + // Opportunity Amount + print ''; + }*/ - // Budget - print ''; - - // Other options - $parameters=array(); - $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook - if (empty($reshook) && ! empty($extrafields_project->attribute_label)) - { - print $object->showOptionals($extrafields_project); - } + // Date start - end + print ''; + + // Budget + print ''; + + // Other attributes + $cols = 2; + include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; + + print '
'.$langs->trans("Visibility").''; - if ($object->public) print $langs->trans('SharedProject'); - else print $langs->trans('PrivateProject'); - print '
'.$langs->trans("Visibility").''; + if ($object->public) print $langs->trans('SharedProject'); + else print $langs->trans('PrivateProject'); + print '
'.$langs->trans("Status").''.$object->getLibStatut(4).'
'.$langs->trans("OpportunityStatus").''; + $code = dol_getIdFromCode($db, $object->opp_status, 'c_lead_status', 'rowid', 'code'); + if ($code) print $langs->trans("OppStatus".$code); + print '
'.$langs->trans("DateStart").''; - print dol_print_date($object->date_start,'day'); - print '
'.$langs->trans("OpportunityProbability").''; + if (strcmp($object->opp_percent,'')) print price($object->opp_percent,'',$langs,1,0).' %'; + print '
'.$langs->trans("DateEnd").''; - print dol_print_date($object->date_end,'day'); - print '
'.$langs->trans("OpportunityAmount").''; + if (strcmp($object->opp_amount,'')) print price($object->opp_amount,'',$langs,1,0,0,$conf->currency); + print '
'.$langs->trans("Budget").''; - if (strcmp($object->budget_amount, '')) print price($object->budget_amount,'',$langs,0,0,0,$conf->currency); - print '
'.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").''; + print dol_print_date($object->date_start,'day'); + $end=dol_print_date($object->date_end,'day'); + if ($end) print ' - '.$end; + print '
'.$langs->trans("Budget").''; + if (strcmp($object->budget_amount, '')) print price($object->budget_amount,'',$langs,1,0,0,$conf->currency); + print '
'; + + print '
'; + print '
'; + print '
'; + print '
'; + + print ''; + + // Description + print ''; + + // Categories + if($conf->categorie->enabled) { + print '"; + } + + print '
'.$langs->trans("Description").''; + print nl2br($object->description); + print '
'.$langs->trans("Categories").''; + print $form->showCategories($object->id,'project',1); + print "
'; + + print '
'; + print '
'; + print ''; + + print '
'; - print ''; dol_fiche_end(); } @@ -279,7 +328,6 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third print ''; if (! empty($object->id)) print ''; if (! empty($mode)) print ''; - print ''; dol_fiche_head(''); @@ -297,7 +345,10 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third if (is_numeric($defaultref) && $defaultref <= 0) $defaultref=''; // Ref - print ''.$langs->trans("Ref").''.($_POST["ref"]?$_POST["ref"]:$defaultref).''; + print ''.$langs->trans("Ref").''; + print ($_POST["ref"]?$_POST["ref"]:$defaultref); + print ''; + print ''; print ''.$langs->trans("Label").''; print ''; diff --git a/htdocs/projet/tasks/contact.php b/htdocs/projet/tasks/contact.php index f3f58c17119..dcb9f7426a8 100644 --- a/htdocs/projet/tasks/contact.php +++ b/htdocs/projet/tasks/contact.php @@ -191,49 +191,85 @@ if ($id > 0 || ! empty($ref)) $param=($mode=='mine'?'&mode=mine':''); - print ''; - - // Ref - print ''; - - print ''; - - print ''; - print ''; - - // Visibility - print ''; - - // Statut - print ''; - - // Date start - print ''; - - // Date end - print ''; - - print '
'; - print $langs->trans("Ref"); - print ''; - // Define a complementary filter for search of next/prev ref. - if (! $user->rights->projet->all->lire) - { - $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,0); - $projectstatic->next_prev_filter=" rowid in (".(count($projectsListId)?join(',',array_keys($projectsListId)):'0').")"; - } - print $form->showrefnav($projectstatic,'project_ref','',1,'ref','ref','',$param.'&withproject=1'); - print '
'.$langs->trans("Label").''.$projectstatic->title.'
'.$langs->trans("ThirdParty").''; - if (! empty($projectstatic->thirdparty->id)) print $projectstatic->thirdparty->getNomUrl(1); - else print ' '; - print '
'.$langs->trans("Visibility").''; - if ($projectstatic->public) print $langs->trans('SharedProject'); - else print $langs->trans('PrivateProject'); - print '
'.$langs->trans("Status").''.$projectstatic->getLibStatut(4).'
'.$langs->trans("DateStart").''; - print dol_print_date($projectstatic->date_start,'day'); - print '
'.$langs->trans("DateEnd").''; - print dol_print_date($projectstatic->date_end,'day'); - print '
'; + // Project card + + $linkback = ''.$langs->trans("BackToList").''; + + $morehtmlref='
'; + // Title + $morehtmlref.=$projectstatic->title; + // Thirdparty + if ($projectstatic->thirdparty->id > 0) + { + $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $projectstatic->thirdparty->getNomUrl(1, 'project'); + } + $morehtmlref.='
'; + + // Define a complementary filter for search of next/prev ref. + if (! $user->rights->projet->all->lire) + { + $objectsListId = $object->getProjectsAuthorizedForUser($user,0,0); + $projectstatic->next_prev_filter=" rowid in (".(count($objectsListId)?join(',',array_keys($objectsListId)):'0').")"; + } + + dol_banner_tab($projectstatic, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + + print '
'; + print '
'; + print '
'; + + print ''; + + // Visibility + print ''; + + // Date start - end + print ''; + + // Budget + print ''; + + // Other attributes + $cols = 2; + //include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; + + print '
'.$langs->trans("Visibility").''; + if ($projectstatic->public) print $langs->trans('SharedProject'); + else print $langs->trans('PrivateProject'); + print '
'.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").''; + print dol_print_date($projectstatic->date_start,'day'); + $end=dol_print_date($projectstatic->date_end,'day'); + if ($end) print ' - '.$end; + print '
'.$langs->trans("Budget").''; + if (strcmp($projectstatic->budget_amount, '')) print price($projectstatic->budget_amount,'',$langs,1,0,0,$conf->currency); + print '
'; + + print '
'; + print '
'; + print '
'; + print '
'; + + print ''; + + // Description + print ''; + + // Categories + if($conf->categorie->enabled) { + print '"; + } + + print '
'.$langs->trans("Description").''; + print nl2br($projectstatic->description); + print '
'.$langs->trans("Categories").''; + print $form->showCategories($projectstatic->id,'project',1); + print "
'; + + print '
'; + print '
'; + print '
'; + + print '
'; dol_fiche_end(); } @@ -255,7 +291,7 @@ if ($id > 0 || ! empty($ref)) $linkback=GETPOST('withproject')?''.$langs->trans("BackToList").'':''; // Ref - print ''.$langs->trans('Ref').''; + print ''.$langs->trans('Ref').''; if (! GETPOST('withproject') || empty($projectstatic->id)) { $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,1); diff --git a/htdocs/projet/tasks/document.php b/htdocs/projet/tasks/document.php index 07fda131407..7c62fb651f1 100644 --- a/htdocs/projet/tasks/document.php +++ b/htdocs/projet/tasks/document.php @@ -134,50 +134,86 @@ if ($object->id > 0) $param=($mode=='mine'?'&mode=mine':''); - print ''; - - // Ref - print ''; - - print ''; - - print ''; - print ''; - - // Visibility - print ''; - - // Statut - print ''; - - // Date start - print ''; - - // Date end - print ''; - - print '
'; - print $langs->trans("Ref"); - print ''; - // Define a complementary filter for search of next/prev ref. - if (! $user->rights->projet->all->lire) - { - $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,0); - $projectstatic->next_prev_filter=" rowid in (".(count($projectsListId)?join(',',array_keys($projectsListId)):'0').")"; - } - print $form->showrefnav($projectstatic,'project_ref','',1,'ref','ref','',$param.'&withproject=1'); - print '
'.$langs->trans("Label").''.$projectstatic->title.'
'.$langs->trans("ThirdParty").''; - if (! empty($projectstatic->thirdparty->id)) print $projectstatic->thirdparty->getNomUrl(1); - else print ' '; - print '
'.$langs->trans("Visibility").''; - if ($projectstatic->public) print $langs->trans('SharedProject'); - else print $langs->trans('PrivateProject'); - print '
'.$langs->trans("Status").''.$projectstatic->getLibStatut(4).'
'.$langs->trans("DateStart").''; - print dol_print_date($projectstatic->date_start,'day'); - print '
'.$langs->trans("DateEnd").''; - print dol_print_date($projectstatic->date_end,'day'); - print '
'; + // Project card + $linkback = ''.$langs->trans("BackToList").''; + + $morehtmlref='
'; + // Title + $morehtmlref.=$projectstatic->title; + // Thirdparty + if ($projectstatic->thirdparty->id > 0) + { + $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $projectstatic->thirdparty->getNomUrl(1, 'project'); + } + $morehtmlref.='
'; + + // Define a complementary filter for search of next/prev ref. + if (! $user->rights->projet->all->lire) + { + $objectsListId = $object->getProjectsAuthorizedForUser($user,0,0); + $projectstatic->next_prev_filter=" rowid in (".(count($objectsListId)?join(',',array_keys($objectsListId)):'0').")"; + } + + dol_banner_tab($projectstatic, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + + print '
'; + print '
'; + print '
'; + + print ''; + + // Visibility + print ''; + + // Date start - end + print ''; + + // Budget + print ''; + + // Other attributes + $cols = 2; + //include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; + + print '
'.$langs->trans("Visibility").''; + if ($projectstatic->public) print $langs->trans('SharedProject'); + else print $langs->trans('PrivateProject'); + print '
'.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").''; + print dol_print_date($projectstatic->date_start,'day'); + $end=dol_print_date($projectstatic->date_end,'day'); + if ($end) print ' - '.$end; + print '
'.$langs->trans("Budget").''; + if (strcmp($projectstatic->budget_amount, '')) print price($projectstatic->budget_amount,'',$langs,1,0,0,$conf->currency); + print '
'; + + print '
'; + print '
'; + print '
'; + print '
'; + + print ''; + + // Description + print ''; + + // Categories + if($conf->categorie->enabled) { + print '"; + } + + print '
'.$langs->trans("Description").''; + print nl2br($projectstatic->description); + print '
'.$langs->trans("Categories").''; + print $form->showCategories($projectstatic->id,'project',1); + print "
'; + + print '
'; + print '
'; + print '
'; + + print '
'; + dol_fiche_end(); } @@ -198,7 +234,7 @@ if ($object->id > 0) print ''; // Ref - print ''; + + // Other attributes + $parameters=array(); + $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 ''; print '
'; + print '
'; print $langs->trans("Ref"); print ''; if (empty($withproject) || empty($projectstatic->id)) @@ -242,6 +278,7 @@ if ($object->id > 0) if ($withproject) $param .= '&withproject=1'; $modulepart = 'project_task'; $permission = $user->rights->projet->creer; + $permtoedit = $user->rights->projet->creer; $relativepathwithnofile=dol_sanitizeFileName($projectstatic->ref).'/'.dol_sanitizeFileName($object->ref).'/'; include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php'; } diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index 52e01d445a8..f5b422a7ce2 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -38,7 +38,11 @@ $id=GETPOST('id','int'); $search_all=GETPOST('search_all'); $search_project=GETPOST('search_project'); -if (! isset($_GET['search_projectstatus']) && ! isset($_POST['search_projectstatus'])) $search_projectstatus=1; +if (! isset($_GET['search_projectstatus']) && ! isset($_POST['search_projectstatus'])) +{ + if ($search_all != '') $search_projectstatus=-1; + else $search_projectstatus=1; +} else $search_projectstatus=GETPOST('search_projectstatus'); $search_project_ref=GETPOST('search_project_ref'); $search_project_title=GETPOST('search_project_title'); @@ -95,14 +99,14 @@ $fieldstosearchall = array( if (empty($user->socid)) $fieldstosearchall['t.note_private']="NotePrivate"; $arrayfields=array( - 'p.ref'=>array('label'=>$langs->trans("ProjectRef"), 'checked'=>1), - 'p.title'=>array('label'=>$langs->trans("ProjectLabel"), 'checked'=>0), - 's.nom'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>0), - 'p.fk_statut'=>array('label'=>$langs->trans("ProjectStatus"), 'checked'=>1), 't.ref'=>array('label'=>$langs->trans("RefTask"), 'checked'=>1, 'position'=>80), 't.label'=>array('label'=>$langs->trans("LabelTask"), 'checked'=>1, 'position'=>80), 't.dateo'=>array('label'=>$langs->trans("DateStart"), 'checked'=>1, 'position'=>100), 't.datee'=>array('label'=>$langs->trans("DateEnd"), 'checked'=>1, 'position'=>101), + 'p.ref'=>array('label'=>$langs->trans("ProjectRef"), 'checked'=>1), + 'p.title'=>array('label'=>$langs->trans("ProjectLabel"), 'checked'=>0), + 's.nom'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>0), + 'p.fk_statut'=>array('label'=>$langs->trans("ProjectStatus"), 'checked'=>1), 't.planned_workload'=>array('label'=>$langs->trans("PlannedWorkload"), 'checked'=>1, 'position'=>102), 't.duration_effective'=>array('label'=>$langs->trans("TimeSpent"), 'checked'=>1, 'position'=>103), 't.progress_calculated'=>array('label'=>$langs->trans("ProgressCalculated"), 'checked'=>1, 'position'=>104), @@ -146,6 +150,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP $day=''; $month=''; $year=''; + $search_array_options=array(); } if (empty($search_projectstatus) && $search_projectstatus == '') $search_projectstatus=1; @@ -217,8 +222,8 @@ $sql = "SELECT ".$distinct." p.rowid as projectid, p.ref as projectref, p.title $sql.= ", s.nom as name, s.rowid as socid"; $sql.= ", t.datec as date_creation, t.dateo as date_start, t.datee as date_end, t.tms as date_update"; $sql.= ", t.rowid as id, t.ref, t.label, t.planned_workload, t.duration_effective, t.progress, t.fk_statut"; -// Add fields for extrafields -foreach ($extrafields->attribute_list as $key => $val) $sql.=",ef.".$key.' as options_'.$key; +// 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 @@ -227,17 +232,11 @@ $sql.= " FROM ".MAIN_DB_PREFIX."projet as p"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid,"; $sql.= " ".MAIN_DB_PREFIX."projet_task as t"; if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task_extrafields as ef on (t.rowid = ef.fk_object)"; -if ($search_project_user > 0) -{ - $sql.=", ".MAIN_DB_PREFIX."element_contact as ecp"; -} -if ($search_task_user > 0) -{ - $sql.=", ".MAIN_DB_PREFIX."element_contact as ect"; -} +if ($search_project_user > 0) $sql.=", ".MAIN_DB_PREFIX."element_contact as ecp"; +if ($search_task_user > 0) $sql.=", ".MAIN_DB_PREFIX."element_contact as ect"; $sql.= " WHERE t.fk_projet = p.rowid"; $sql.= " AND p.entity IN (".getEntity('project',1).')'; -if (! $user->rights->projet->all->lire) $sql.=" p.rowid IN (".join(',',$projectsListId).")"; // public and assigned to projects, or restricted to company for external users +if (! $user->rights->projet->all->lire) $sql.=" AND p.rowid IN (".($projectsListId?$projectsListId:'0').")"; // public and assigned to projects, or restricted to company for external users // No need to check company, as filtering of projects must be done by getProjectsAuthorizedForUser if ($socid) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")"; if ($search_project_ref) $sql .= natural_search('p.ref', $search_project_ref); @@ -272,7 +271,11 @@ else if ($year > 0) $sql.= " AND t.datee BETWEEN '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'"; } if ($search_all) $sql .= natural_search(array_keys($fieldstosearchall), $search_all); -if ($search_projectstatus >= 0) $sql .= " AND p.fk_statut = ".$db->escape($search_projectstatus); +if ($search_projectstatus >= 0) +{ + if ($search_projectstatus == 99) $sql .= " AND p.fk_statut <> 2"; + else $sql .= " AND p.fk_statut = ".$db->escape($search_projectstatus); +} if ($search_public!='') $sql .= " AND p.public = ".$db->escape($search_public); if ($search_project_user > 0) $sql.= " AND ecp.fk_c_type_contact IN (".join(',',array_keys($listofprojectcontacttype)).") AND ecp.element_id = p.rowid AND ecp.fk_socpeople = ".$search_project_user; if ($search_task_user > 0) $sql.= " AND ect.fk_c_type_contact IN (".join(',',array_keys($listoftaskcontacttype)).") AND ect.element_id = t.rowid AND ect.fk_socpeople = ".$search_task_user; @@ -303,7 +306,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) } $sql.= $db->plimit($limit + 1,$offset); - +//print $sql; dol_syslog("list allowed project", LOG_DEBUG); //print $sql; @@ -358,8 +361,8 @@ if ($resql) if ($search_task_user == $user->id) print $langs->trans("MyTasksDesc").'

'; else { - if ($user->rights->projet->all->lire && ! $socid) print $langs->trans("ProjectsDesc").'

'; - else print $langs->trans("ProjectsPublicDesc").'

'; + if ($user->rights->projet->all->lire && ! $socid) print $langs->trans("TasksOnProjectsDesc").'

'; + else print $langs->trans("TasksOnProjectsPublicDesc").'

'; } if ($search_all) @@ -400,14 +403,14 @@ if ($resql) print ''; print ''; - if (! empty($arrayfields['p.ref']['checked'])) print_liste_field_titre($arrayfields['p.ref']['label'],$_SERVER["PHP_SELF"],"p.ref","",$param,"",$sortfield,$sortorder); - if (! empty($arrayfields['p.title']['checked'])) print_liste_field_titre($arrayfields['p.title']['label'],$_SERVER["PHP_SELF"],"p.title","",$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['p.fk_statut']['checked'])) print_liste_field_titre($arrayfields['p.fk_statut']['label'],$_SERVER["PHP_SELF"],"p.fk_statut","",$param,"",$sortfield,$sortorder); if (! empty($arrayfields['t.ref']['checked'])) print_liste_field_titre($arrayfields['t.ref']['label'],$_SERVER["PHP_SELF"],"t.ref","",$param,"",$sortfield,$sortorder); if (! empty($arrayfields['t.label']['checked'])) print_liste_field_titre($arrayfields['t.label']['label'],$_SERVER["PHP_SELF"],"t.label","",$param,"",$sortfield,$sortorder); if (! empty($arrayfields['t.dateo']['checked'])) print_liste_field_titre($arrayfields['t.dateo']['label'],$_SERVER["PHP_SELF"],"t.dateo","",$param,'align="center"',$sortfield,$sortorder); if (! empty($arrayfields['t.datee']['checked'])) print_liste_field_titre($arrayfields['t.datee']['label'],$_SERVER["PHP_SELF"],"t.datee","",$param,'align="center"',$sortfield,$sortorder); + if (! empty($arrayfields['p.ref']['checked'])) print_liste_field_titre($arrayfields['p.ref']['label'],$_SERVER["PHP_SELF"],"p.ref","",$param,"",$sortfield,$sortorder); + if (! empty($arrayfields['p.title']['checked'])) print_liste_field_titre($arrayfields['p.title']['label'],$_SERVER["PHP_SELF"],"p.title","",$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['p.fk_statut']['checked'])) print_liste_field_titre($arrayfields['p.fk_statut']['label'],$_SERVER["PHP_SELF"],"p.fk_statut","",$param,"",$sortfield,$sortorder); if (! empty($arrayfields['t.planned_workload']['checked'])) print_liste_field_titre($arrayfields['t.planned_workload']['label'],$_SERVER["PHP_SELF"],"t.planned_workload","",$param,'align="center"',$sortfield,$sortorder); if (! empty($arrayfields['t.duration_effective']['checked'])) print_liste_field_titre($arrayfields['t.duration_effective']['label'],$_SERVER["PHP_SELF"],"t.duration_effective","",$param,'align="center"',$sortfield,$sortorder); if (! empty($arrayfields['t.progress_calculated']['checked'])) print_liste_field_titre($arrayfields['t.progress_calculated']['label'],$_SERVER["PHP_SELF"],"","",$param,'align="center"'); @@ -434,32 +437,6 @@ if ($resql) print "\n"; print ''; - if (! empty($arrayfields['p.ref']['checked'])) - { - print ''; - } - if (! empty($arrayfields['p.title']['checked'])) - { - print ''; - } - if (! empty($arrayfields['s.nom']['checked'])) - { - print ''; - } - if (! empty($arrayfields['p.fk_statut']['checked'])) - { - print ''; - } if (! empty($arrayfields['t.ref']['checked'])) { print ''; } + if (! empty($arrayfields['p.ref']['checked'])) + { + print ''; + } + if (! empty($arrayfields['p.title']['checked'])) + { + print ''; + } + if (! empty($arrayfields['s.nom']['checked'])) + { + print ''; + } + if (! empty($arrayfields['p.fk_statut']['checked'])) + { + print ''; + } if (! empty($arrayfields['t.planned_workload']['checked'])) print ''; if (! empty($arrayfields['t.duration_effective']['checked'])) print ''; if (! empty($arrayfields['t.progress_calculated']['checked'])) print ''; @@ -541,7 +545,15 @@ if ($resql) print ''; - $i = 0; + $plannedworkloadoutputformat='allhourmin'; + $timespentoutputformat='allhourmin'; + if (! empty($conf->global->PROJECT_PLANNED_WORKLOAD_FORMAT)) $plannedworkloadoutputformat=$conf->global->PROJECT_PLANNED_WORKLOAD_FORMAT; + if (! empty($conf->global->PROJECT_TIMES_SPENT_FORMAT)) $timespentoutputformat=$conf->global->PROJECT_TIME_SPENT_FORMAT; + + $now = dol_now(); + $i=0; + $var=true; + $totalarray=array(); while ($i < min($num,$limit)) { $obj = $db->fetch_object($resql); @@ -567,44 +579,6 @@ if ($resql) $var=!$var; print ""; - // Project url - if (! empty($arrayfields['p.ref']['checked'])) - { - print ''; - } - // Title - if (! empty($arrayfields['p.title']['checked'])) - { - print ''; - } - // Company - if (! empty($arrayfields['s.nom']['checked'])) - { - print ''; - } - // Status - if (! empty($arrayfields['p.fk_statut']['checked'])) - { - print ''; - } // Ref if (! empty($arrayfields['t.ref']['checked'])) { @@ -612,6 +586,7 @@ if ($resql) print $taskstatic->getNomUrl(1,'withproject'); if ($taskstatic->hasDelay()) print img_warning("Late"); print ''; + if (! $i) $totalarray['nbfield']++; } // Label if (! empty($arrayfields['t.label']['checked'])) @@ -619,6 +594,7 @@ if ($resql) print ''; + if (! $i) $totalarray['nbfield']++; } // Date start if (! empty($arrayfields['t.dateo']['checked'])) @@ -626,19 +602,58 @@ if ($resql) print ''; - } + if (! $i) $totalarray['nbfield']++; + } // Date end if (! empty($arrayfields['t.datee']['checked'])) { print ''; + if (! $i) $totalarray['nbfield']++; + } + // Project ref + if (! empty($arrayfields['p.ref']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Project title + if (! empty($arrayfields['p.title']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Third party + if (! empty($arrayfields['s.nom']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Project status + if (! empty($arrayfields['p.fk_statut']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; } - - $plannedworkloadoutputformat='allhourmin'; - $timespentoutputformat='allhourmin'; - if (! empty($conf->global->PROJECT_PLANNED_WORKLOAD_FORMAT)) $plannedworkloadoutputformat=$conf->global->PROJECT_PLANNED_WORKLOAD_FORMAT; - if (! empty($conf->global->PROJECT_TIMES_SPENT_FORMAT)) $timespentoutputformat=$conf->global->PROJECT_TIME_SPENT_FORMAT; // Planned workload if (! empty($arrayfields['t.planned_workload']['checked'])) @@ -654,6 +669,9 @@ if ($resql) } //else print '--:--'; print ''; + if (! $i) $totalarray['nbfield']++; + if (! $i) $totalarray['totalplannedworkloadfield']=$totalarray['nbfield']; + $totalarray['totalplannedworkload'] += $obj->planned_workload; } // Time spent if (! empty($arrayfields['t.duration_effective']['checked'])) @@ -667,6 +685,9 @@ if ($resql) if ($showlineingray) print ''; else print ''; print ''; + if (! $i) $totalarray['nbfield']++; + if (! $i) $totalarray['totaldurationeffectivefield']=$totalarray['nbfield']; + $totalarray['totaldurationeffective'] += $obj->duration_effective; } // Calculated progress if (! empty($arrayfields['t.progress_calculated']['checked'])) @@ -678,6 +699,7 @@ if ($resql) else print $langs->trans('WorkloadNotDefined'); } print ''; + if (! $i) $totalarray['nbfield']++; } // Declared progress if (! empty($arrayfields['t.progress']['checked'])) @@ -688,6 +710,7 @@ if ($resql) print $obj->progress.' %'; } print ''; + if (! $i) $totalarray['nbfield']++; } // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) @@ -703,6 +726,7 @@ if ($resql) $tmpkey='options_'.$key; print $extrafields->showOutputField($key, $obj->$tmpkey, '', 1); print ''; + if (! $i) $totalarray['nbfield']++; } } } @@ -716,6 +740,7 @@ if ($resql) print ''; + if (! $i) $totalarray['nbfield']++; } // Date modification if (! empty($arrayfields['t.tms']['checked'])) @@ -723,6 +748,7 @@ if ($resql) print ''; + if (! $i) $totalarray['nbfield']++; } // Status /*if (! empty($arrayfields['p.fk_statut']['checked'])) @@ -730,9 +756,17 @@ if ($resql) $projectstatic->statut = $obj->fk_statut; print ''; }*/ - // Action column - print ''; - + // Action column + print ''; + if (! $i) $totalarray['nbfield']++; + print "\n"; //print projectLinesa(); @@ -740,6 +774,27 @@ if ($resql) $i++; } + + // Show total line + if (isset($totalarray['totaldurationeffectivefield']) || isset($totalarray['totalplannedworkloadfield'])) + { + print ''; + $i=0; + while ($i < $totalarray['nbfield']) + { + $i++; + if ($i == 1) + { + if ($num < $limit) print ''; + else print ''; + } + elseif ($totalarray['totalplannedworkloadfield'] == $i) print ''; + elseif ($totalarray['totaldurationeffectivefield'] == $i) print ''; + else print ''; + } + print ''; + } + $db->free($resql); $parameters=array('sql' => $sql); diff --git a/htdocs/projet/tasks/note.php b/htdocs/projet/tasks/note.php index e62e58df58b..f443facaabf 100644 --- a/htdocs/projet/tasks/note.php +++ b/htdocs/projet/tasks/note.php @@ -113,53 +113,86 @@ if ($object->id > 0) dol_fiche_head($head, $tab, $langs->trans("Project"),0,($projectstatic->public?'projectpub':'project')); $param=($mode=='mine'?'&mode=mine':''); - - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - $listofstatus=array(-1=>' '); - foreach($projectstatic->statuts_short as $key => $val) $listofstatus[$key]=$langs->trans($val); - print $form->selectarray('search_projectstatus', $listofstatus, $search_projectstatus); - print ''; @@ -490,6 +467,33 @@ if ($resql) $formother->select_year($year?$year:-1,'year',1, 20, 5); print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + $arrayofstatus = array(); + foreach($projectstatic->statuts_short as $key => $val) $arrayofstatus[$key]=$langs->trans($val); + $arrayofstatus['99']=$langs->trans("NotClosed").' ('.$langs->trans('Draft').'+'.$langs->trans('Opened').')'; + print $form->selectarray('search_projectstatus', $arrayofstatus, $search_projectstatus, 1, 0, 0, '', 0, 0, 0, '', 'maxwidth100'); + print '
'; - print $projectstatic->getNomUrl(1, 'task'); - if ($projectstatic->hasDelay()) print img_warning("Late"); - print ''; - print dol_trunc($obj->projecttitle,80); - print ''; - if ($obj->socid) - { - $socstatic->id=$obj->socid; - $socstatic->name=$obj->name; - print $socstatic->getNomUrl(1); - } - else - { - print ' '; - } - print ''; - print $projectstatic->getLibStatut(1); - print ''; print $taskstatic->label; print ''; print dol_print_date($db->jdate($obj->date_start),'day'); print ''; print dol_print_date($db->jdate($obj->date_end),'day'); print ''; + print $projectstatic->getNomUrl(1, 'task'); + if ($projectstatic->hasDelay()) print img_warning("Late"); + print ''; + print dol_trunc($obj->projecttitle,80); + print ''; + if ($obj->socid) + { + $socstatic->id=$obj->socid; + $socstatic->name=$obj->name; + print $socstatic->getNomUrl(1); + } + else + { + print ' '; + } + print ''; + print $projectstatic->getLibStatut(1); + print ''; print dol_print_date($db->jdate($obj->date_creation), 'dayhour'); print ''; print dol_print_date($db->jdate($obj->date_update), 'dayhour'); print ''.$projectstatic->getLibStatut(5).''; + 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 ''; + } + print '
'.$langs->trans("Total").''.$langs->trans("Totalforthispage").''.convertSecondToTime($totalarray['totalplannedworkload'],$plannedworkloadoutputformat).''.convertSecondToTime($totalarray['totaldurationeffective'],$timespentoutputformat).'
'; - - // Ref - print ''; - - // Project - print ''; - - // Company - print ''; - print ''; - + + dol_banner_tab($projectstatic, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + + print '
'; + print '
'; + print '
'; + + print '
'; - print $langs->trans("Ref"); - print ''; + // Project card + + $linkback = ''.$langs->trans("BackToList").''; + + $morehtmlref='
'; + // Title + $morehtmlref.=$projectstatic->title; + // Thirdparty + if ($projectstatic->thirdparty->id > 0) + { + $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $projectstatic->thirdparty->getNomUrl(1, 'project'); + } + $morehtmlref.='
'; + // Define a complementary filter for search of next/prev ref. if (! $user->rights->projet->all->lire) { - $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,0); - $projectstatic->next_prev_filter=" rowid in (".(count($projectsListId)?join(',',array_keys($projectsListId)):'0').")"; + $objectsListId = $object->getProjectsAuthorizedForUser($user,0,0); + $projectstatic->next_prev_filter=" rowid in (".(count($objectsListId)?join(',',array_keys($objectsListId)):'0').")"; } - print $form->showrefnav($projectstatic,'project_ref','',1,'ref','ref','',$param.'&withproject=1'); - print '
'.$langs->trans("Label").''.$projectstatic->title.'
'.$langs->trans("ThirdParty").''; - if (! empty($projectstatic->thirdparty->id)) print $projectstatic->thirdparty->getNomUrl(1); - else print ' '; - print '
'; + // Visibility - print ''; - - // Statut - print ''; - - // Date start - print ''; - - // Date end - print ''; - + + // Other attributes + $cols = 2; + //include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; + print '
'.$langs->trans("Visibility").''; + print '
'.$langs->trans("Visibility").''; if ($projectstatic->public) print $langs->trans('SharedProject'); else print $langs->trans('PrivateProject'); print '
'.$langs->trans("Status").''.$projectstatic->getLibStatut(4).'
'.$langs->trans("DateStart").''; + + // Date start - end + print '
'.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").''; print dol_print_date($projectstatic->date_start,'day'); + $end=dol_print_date($projectstatic->date_end,'day'); + if ($end) print ' - '.$end; print '
'.$langs->trans("DateEnd").''; - print dol_print_date($projectstatic->date_end,'day'); + + // Budget + print '
'.$langs->trans("Budget").''; + if (strcmp($projectstatic->budget_amount, '')) print price($projectstatic->budget_amount,'',$langs,1,0,0,$conf->currency); print '
'; - + + print ''; + print '
'; + print '
'; + print '
'; + + print ''; + + // Description + print ''; + + // Categories + if($conf->categorie->enabled) { + print '"; + } + + print '
'.$langs->trans("Description").''; + print nl2br($projectstatic->description); + print '
'.$langs->trans("Categories").''; + print $form->showCategories($projectstatic->id,'project',1); + print "
'; + + print '
'; + print '
'; + print ''; + + print '
'; + dol_fiche_end(); } @@ -172,7 +205,7 @@ if ($object->id > 0) $linkback=GETPOST('withproject')?''.$langs->trans("BackToList").'':''; // Ref - print '
'.$langs->trans("Ref").''; + print '
'.$langs->trans("Ref").''; if (empty($withproject) || empty($projectstatic->id)) { $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,1); @@ -203,7 +236,7 @@ if ($object->id > 0) print '
'; - $colwidth=30; + $cssclass='titlefield'; $moreparam=$param; include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index 5b3b8c9fe61..cbee3683f73 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -38,6 +38,7 @@ $langs->load("companies"); $id=GETPOST('id','int'); $ref=GETPOST("ref",'alpha',1); +$taskref=GETPOST("taskref",'alpha'); $action=GETPOST('action','alpha'); $confirm=GETPOST('confirm','alpha'); $withproject=GETPOST('withproject','int'); @@ -68,6 +69,11 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->projet->creer) { $error=0; + if (empty($taskref)) + { + $error++; + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Ref")), null, 'errors'); + } if (empty($_POST["label"])) { $error++; @@ -76,18 +82,19 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->projet->creer) if (! $error) { $object->fetch($id,$ref); + $object->oldcopy = clone $object; $tmparray=explode('_',$_POST['task_parent']); $task_parent=$tmparray[1]; if (empty($task_parent)) $task_parent = 0; // If task_parent is '' - $object->ref = GETPOST("ref",'alpha',2); + $object->ref = $taskref?$taskref:GETPOST("ref",'alpha',2); $object->label = $_POST["label"]; $object->description = $_POST['description']; $object->fk_task_parent = $task_parent; $object->planned_workload = $planned_workload; - $object->date_start = dol_mktime($_POST['dateohour'],$_POST['dateomin'],0,$_POST['dateomonth'],$_POST['dateoday'],$_POST['dateoyear'],'user'); - $object->date_end = dol_mktime($_POST['dateehour'],$_POST['dateemin'],0,$_POST['dateemonth'],$_POST['dateeday'],$_POST['dateeyear'],'user'); + $object->date_start = dol_mktime($_POST['dateohour'],$_POST['dateomin'],0,$_POST['dateomonth'],$_POST['dateoday'],$_POST['dateoyear']); + $object->date_end = dol_mktime($_POST['dateehour'],$_POST['dateemin'],0,$_POST['dateemonth'],$_POST['dateeday'],$_POST['dateeyear']); $object->progress = $_POST['progress']; // Fill array 'array_options' with data from add form @@ -218,52 +225,86 @@ if ($id > 0 || ! empty($ref)) $param=($mode=='mine'?'&mode=mine':''); - print ''; - - $linkback = ''.$langs->trans("BackToList").''; - - // Ref - print ''; - - print ''; - - print ''; - print ''; - - // Visibility - print ''; - - // Statut - print ''; - - // Date start - print ''; - - // Date end - print ''; - - print '
'; - print $langs->trans("Ref"); - print ''; - // Define a complementary filter for search of next/prev ref. - if (! $user->rights->projet->all->lire) - { - $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,0); - $projectstatic->next_prev_filter=" rowid in (".(count($projectsListId)?join(',',array_keys($projectsListId)):'0').")"; - } - print $form->showrefnav($projectstatic,'project_ref',$linkback,1,'ref','ref','',$param.'&withproject=1'); - print '
'.$langs->trans("Label").''.$projectstatic->title.'
'.$langs->trans("ThirdParty").''; - if (! empty($projectstatic->thirdparty->id)) print $projectstatic->thirdparty->getNomUrl(1); - else print ' '; - print '
'.$langs->trans("Visibility").''; - if ($projectstatic->public) print $langs->trans('SharedProject'); - else print $langs->trans('PrivateProject'); - print '
'.$langs->trans("Status").''.$projectstatic->getLibStatut(4).'
'.$langs->trans("DateStart").''; - print dol_print_date($projectstatic->date_start,'day'); - print '
'.$langs->trans("DateEnd").''; - print dol_print_date($projectstatic->date_end,'day'); - print '
'; - + // Project card + + $linkback = ''.$langs->trans("BackToList").''; + + $morehtmlref='
'; + // Title + $morehtmlref.=$projectstatic->title; + // Thirdparty + if ($projectstatic->thirdparty->id > 0) + { + $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $projectstatic->thirdparty->getNomUrl(1, 'project'); + } + $morehtmlref.='
'; + + // Define a complementary filter for search of next/prev ref. + if (! $user->rights->projet->all->lire) + { + $objectsListId = $object->getProjectsAuthorizedForUser($user,0,0); + $projectstatic->next_prev_filter=" rowid in (".(count($objectsListId)?join(',',array_keys($objectsListId)):'0').")"; + } + + dol_banner_tab($projectstatic, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + + print '
'; + print '
'; + print '
'; + + print ''; + + // Visibility + print ''; + + // Date start - end + print ''; + + // Budget + print ''; + + // Other attributes + $cols = 2; + //include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; + + print '
'.$langs->trans("Visibility").''; + if ($projectstatic->public) print $langs->trans('SharedProject'); + else print $langs->trans('PrivateProject'); + print '
'.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").''; + print dol_print_date($projectstatic->date_start,'day'); + $end=dol_print_date($projectstatic->date_end,'day'); + if ($end) print ' - '.$end; + print '
'.$langs->trans("Budget").''; + if (strcmp($projectstatic->budget_amount, '')) print price($projectstatic->budget_amount,'',$langs,1,0,0,$conf->currency); + print '
'; + + print '
'; + print '
'; + print '
'; + print '
'; + + print ''; + + // Description + print ''; + + // Categories + if($conf->categorie->enabled) { + print '"; + } + + print '
'.$langs->trans("Description").''; + print nl2br($projectstatic->description); + print '
'.$langs->trans("Categories").''; + print $form->showCategories($projectstatic->id,'project',1); + print "
'; + + print '
'; + print '
'; + print '
'; + + print '
'; + dol_fiche_end(); } @@ -310,11 +351,11 @@ if ($id > 0 || ! empty($ref)) print ''; // Ref - print ''; - print ''; + print ''; + print ''; // Label - print ''; + print ''; print ''; // Project @@ -399,7 +440,7 @@ if ($id > 0 || ! empty($ref)) print '
'.$langs->trans("Ref").'
'.$langs->trans("Ref").'
'.$langs->trans("Label").'
'.$langs->trans("Label").'
'; // Ref - print ''; + // Other attributes + $parameters=array('objectsrc' => $objectsrc, '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,'edit'); + } + print '
'; + print '
'; print $langs->trans("Ref"); print ''; if (! GETPOST('withproject') || empty($projectstatic->id)) @@ -522,9 +563,9 @@ if ($id > 0 || ! empty($ref)) print ''; } - print '
'; - print ''; // ancre - + print '
'; + print ''; // ancre + /* * Documents generes */ @@ -536,9 +577,11 @@ if ($id > 0 || ! empty($ref)) $var=true; - $somethingshown=$formfile->show_documents('project_task',$filename,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf); + print $formfile->showdocuments('project_task',$filename,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf); - print '
'; + print '
'; + + print '
'; } } } diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index b69c731a1d7..276fc1cd722 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -1,6 +1,6 @@ - * Copyright (C) 2006-2015 Laurent Destailleur + * Copyright (C) 2006-2016 Laurent Destailleur * Copyright (C) 2010-2012 Regis Houssin * Copyright (C) 2011 Juanjo Menent * @@ -34,26 +34,81 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; $langs->load('projects'); $id=GETPOST('id','int'); +$projectid=GETPOST('projectid','int'); $ref=GETPOST('ref','alpha'); $action=GETPOST('action','alpha'); $confirm=GETPOST('confirm','alpha'); $withproject=GETPOST('withproject','int'); $project_ref=GETPOST('project_ref','alpha'); +$search_dateday=GETPOST('search_dateday'); +$search_datemonth=GETPOST('search_datemonth'); +$search_dateyear=GETPOST('search_dateyear'); +$search_datehour=''; +$search_datewithhour=''; +$search_note=GETPOST('search_note','alpha'); +$search_duration=GETPOST('search_duration','int'); +$search_value=GETPOST('search_value','int'); + // Security check $socid=0; if ($user->societe_id > 0) $socid = $user->societe_id; if (!$user->rights->projet->lire) accessforbidden(); +$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='t.task_date,t.task_datehour,t.rowid'; +if (! $sortorder) $sortorder='DESC'; + +// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +$hookmanager->initHooks(array('projecttaskcard','globalcard')); + $object = new Task($db); $projectstatic = new Project($db); +$extrafields_project = new ExtraFields($db); +$extrafields_task = new ExtraFields($db); + +if ($projectid > 0 || ! empty($ref)) +{ + // fetch optionals attributes and labels + $extralabels_projet=$extrafields_project->fetch_name_optionals_label($projectstatic->table_element); +} +$extralabels_task=$extrafields_task->fetch_name_optionals_label($object->table_element); /* * Actions */ -if ($action == 'addtimespent' && $user->rights->projet->creer) +$parameters=array('socid'=>$socid, 'projectid'=>$projectid); +$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 +{ + $search_date=''; + $search_datehour=''; + $search_datewithhour=''; + $search_note=''; + $search_duration=''; + $search_value=''; + $search_date_creation=''; + $search_date_update=''; + $toselect=''; + $search_array_options=array(); + $action=''; +} + +if ($action == 'addtimespent' && $user->rights->projet->lire) { $error=0; @@ -202,7 +257,6 @@ if (GETPOST('projectid')) } - /* * View @@ -223,12 +277,14 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) { $result=$projectstatic->fetch($projectidforalltimes); if (! empty($projectstatic->socid)) $projectstatic->fetch_thirdparty(); + $res=$projectstatic->fetch_optionals($object->id,$extralabels_projet); } elseif ($object->fetch($id, $ref) >= 0) { $result=$projectstatic->fetch($object->fk_project); if (! empty($projectstatic->socid)) $projectstatic->fetch_thirdparty(); - + $res=$projectstatic->fetch_optionals($object->id,$extralabels_projet); + $object->project = clone $projectstatic; } @@ -245,53 +301,85 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) $param=($mode=='mine'?'&mode=mine':''); - print ''; - - $linkback = ''.$langs->trans("BackToList").''; - - // Ref - print ''; - - // Label - print ''; - - // Thirdparty - print ''; - print ''; - - // Visibility - print ''; - - // Statut - print ''; - - // Date start - print ''; - - // Date end - print ''; - - print '
'; - print $langs->trans("Ref"); - print ''; - // Define a complementary filter for search of next/prev ref. - if (! $user->rights->projet->all->lire) - { - $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,0); - $projectstatic->next_prev_filter=" rowid in (".(count($projectsListId)?join(',',array_keys($projectsListId)):'0').")"; - } - print $form->showrefnav($projectstatic,'project_ref',$linkback,1,'ref','ref','',$param.'&withproject=1'); - print '
'.$langs->trans("Label").''.$projectstatic->title.'
'.$langs->trans("ThirdParty").''; - if (! empty($projectstatic->thirdparty->id)) print $projectstatic->thirdparty->getNomUrl(1); - else print ' '; - print '
'.$langs->trans("Visibility").''; - if ($projectstatic->public) print $langs->trans('SharedProject'); - else print $langs->trans('PrivateProject'); - print '
'.$langs->trans("Status").''.$projectstatic->getLibStatut(4).'
'.$langs->trans("DateStart").''; - print dol_print_date($projectstatic->date_start,'day'); - print '
'.$langs->trans("DateEnd").''; - print dol_print_date($projectstatic->date_end,'day'); - print '
'; + // Project card + + $linkback = ''.$langs->trans("BackToList").''; + + $morehtmlref='
'; + // Title + $morehtmlref.=$projectstatic->title; + // Thirdparty + if ($projectstatic->thirdparty->id > 0) + { + $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $projectstatic->thirdparty->getNomUrl(1, 'project'); + } + $morehtmlref.='
'; + + // Define a complementary filter for search of next/prev ref. + if (! $user->rights->projet->all->lire) + { + $objectsListId = $object->getProjectsAuthorizedForUser($user,0,0); + $projectstatic->next_prev_filter=" rowid in (".(count($objectsListId)?join(',',array_keys($objectsListId)):'0').")"; + } + + dol_banner_tab($projectstatic, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + + print '
'; + print '
'; + print '
'; + + print ''; + + // Visibility + print ''; + + // Date start - end + print ''; + + // Budget + print ''; + + // Other attributes + $cols = 2; + //include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; + + print '
'.$langs->trans("Visibility").''; + if ($projectstatic->public) print $langs->trans('SharedProject'); + else print $langs->trans('PrivateProject'); + print '
'.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").''; + print dol_print_date($projectstatic->date_start,'day'); + $end=dol_print_date($projectstatic->date_end,'day'); + if ($end) print ' - '.$end; + print '
'.$langs->trans("Budget").''; + if (strcmp($projectstatic->budget_amount, '')) print price($projectstatic->budget_amount,'',$langs,1,0,0,$conf->currency); + print '
'; + + print '
'; + print '
'; + print '
'; + print '
'; + + print ''; + + // Description + print ''; + + // Categories + if($conf->categorie->enabled) { + print '"; + } + + print '
'.$langs->trans("Description").''; + print nl2br($projectstatic->description); + print '
'.$langs->trans("Categories").''; + print $form->showCategories($projectstatic->id,'project',1); + print "
'; + + print '
'; + print '
'; + print '
'; + + print '
'; dol_fiche_end(); @@ -299,7 +387,8 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) /* * Actions */ - if (empty($id)) + + if ((empty($id) && empty($ref)) || ! empty($projectidforalltimes)) { print '
'; @@ -340,7 +429,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) $linkback=$withproject?''.$langs->trans("BackToList").'':''; // Ref - print '
'; + print '
'; print $langs->trans("Ref"); print ''; if (! GETPOST('withproject') || empty($projectstatic->id)) @@ -421,7 +510,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) print ''; print ''; - print ''; + print ''; print ''; print ''; print ''; @@ -431,20 +520,20 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) print ''; // Date - print ''; // Contributor - print ''; // Note - print ''; // Progress declared @@ -479,19 +568,52 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) if ($projectstatic->id > 0) { + if ($action == 'deleteline') + { + print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id.'&lineid='.$_GET["lineid"].($withproject?'&withproject=1':''),$langs->trans("DeleteATimeSpent"),$langs->trans("ConfirmDeleteATimeSpent"),"confirm_delete",'','',1); + } + + // Initialize technical object to manage hooks. Note that conf->hooks_modules contains array + $hookmanager->initHooks(array('tasktimelist')); + $extrafields = new ExtraFields($db); + + // Definition of fields for list + $arrayfields=array(); + $arrayfields['t.task_date']=array('label'=>$langs->trans("Date"), 'checked'=>1); + if ((empty($id) && empty($ref)) || ! empty($projectidforalltimes)) // Not a dedicated task + { + $arrayfields['t.task_ref']=array('label'=>$langs->trans("RefTask"), 'checked'=>1); + $arrayfields['t.task_label']=array('label'=>$langs->trans("LabelTask"), 'checked'=>1); + } + $arrayfields['author']=array('label'=>$langs->trans("By"), 'checked'=>1); + $arrayfields['t.note']=array('label'=>$langs->trans("Note"), 'checked'=>1); + $arrayfields['t.task_duration']=array('label'=>$langs->trans("Duration"), 'checked'=>1); + $arrayfields['value']=array('label'=>$langs->trans("Value"), 'checked'=>1, 'enabled'=>$conf->salaries->enabled); + // 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]); + } + } + /* * List of time spent */ $tasks = array(); - $sql = "SELECT t.rowid, t.fk_task, t.task_date, t.task_datehour, t.task_date_withhour, t.task_duration, t.fk_user, t.note, t.thm"; - $sql.= ", u.lastname, u.firstname"; - $sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t"; - $sql .= " , ".MAIN_DB_PREFIX."user as u"; - $sql .= " WHERE t.fk_user = u.rowid"; + $sql = "SELECT t.rowid, t.fk_task, t.task_date, t.task_datehour, t.task_date_withhour, t.task_duration, t.fk_user, t.note, t.thm,"; + $sql .= " pt.ref, pt.label,"; + $sql .= " u.lastname, u.firstname"; + $sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t, ".MAIN_DB_PREFIX."projet_task as pt, ".MAIN_DB_PREFIX."user as u"; + $sql .= " WHERE t.fk_user = u.rowid AND t.fk_task = pt.rowid"; if (empty($projectidforalltimes)) $sql .= " AND t.fk_task =".$object->id; - $sql .= " ORDER BY t.task_date DESC, t.task_datehour DESC, t.rowid DESC"; - + else $sql.= " AND pt.fk_projet IN (".$projectidforalltimes.")"; + if ($search_ref) $sql .= natural_search('c.ref', $search_ref); + if ($search_note) $sql .= natural_search('t.note', $search_note); + $sql .= $db->order($sortfield, $sortorder); + $var=true; $resql = $db->query($sql); if ($resql) @@ -521,27 +643,154 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) dol_print_error($db); } - print ''; + + $arrayofselected=is_array($toselect)?$toselect:array(); + + $params=''; + if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; + if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; + if ($search_note != '') $params.= '&search_note='.urlencode($search_note); + if ($search_duration != '') $params.= '&search_field2='.urlencode($search_duration); + 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); + }*/ + if ($id) $params.='&id='.$id; + if ($projectid) $params.='&projectid='.$projectid; + if ($withproject) $params.='&withproject='.$withproject; + + + $arrayofmassactions = array( + //'presend'=>$langs->trans("SendByMail"), + //'builddoc'=>$langs->trans("PDFMerge"), + ); + //if ($user->rights->projet->creer) $arrayofmassactions['delete']=$langs->trans("Delete"); + if ($massaction == 'presend') $arrayofmassactions=array(); + $massactionbutton=$form->selectMassAction('', $arrayofmassactions); + + + + print ''; + if ($optioncss != '') print ''; print ''; - print ''; - print ''; + print ''; + if ($action == 'editline') print ''; + else print ''; + print ''; + print ''; + + print ''; + print ''; print ''; - print '
'.$langs->trans("Date").''.$langs->trans("Date").''.$langs->trans("By").''.$langs->trans("Note").''.$langs->trans("ProgressDeclared").'
'; + print ''; //$newdate=dol_mktime(12,0,0,$_POST["timemonth"],$_POST["timeday"],$_POST["timeyear"]); $newdate=''; - print $form->select_date($newdate,'time',1,1,2,"timespent_date",1,0,1); + print $form->select_date($newdate, 'time', ($conf->browser->layout == 'phone'?2:1), 1, 2, "timespent_date", 1, 0, 1); print ''; + print ''; print img_object('','user','class="hideonsmartphone"'); $contactsoftask=$object->getListContactId('internal'); if (count($contactsoftask)>0) { $userid=$contactsoftask[0]; - print $form->select_dolusers((GETPOST('userid')?GETPOST('userid'):$userid), 'userid', 0, '', 0, '', $contactsoftask, 0, 0, 0, '', 0, $langs->trans("ResourceNotAssignedToTheTask")); + print $form->select_dolusers((GETPOST('userid')?GETPOST('userid'):$userid), 'userid', 0, '', 0, '', $contactsoftask, 0, 0, 0, '', 0, $langs->trans("ResourceNotAssignedToTheTask"), 'maxwidth200'); } else { @@ -453,8 +542,8 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) print ''; - print ''; + print ''; + print ''; print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - if (! empty($conf->salaries->enabled)) + $moreforfilter = ''; + + $parameters=array(); + $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 ''; + print '
'; + print $moreforfilter; + print '
'; } - print ''; + + $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; + $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields + + print '
'.$langs->trans("Date").''.$langs->trans("By").''.$langs->trans("Note").''.$langs->trans("TimeSpent").''.$langs->trans("Value").' 
'."\n"; + + print ''; + if (! empty($arrayfields['t.task_date']['checked'])) print_liste_field_titre($arrayfields['t.task_date']['label'],$_SERVER['PHP_SELF'],'t.task_date,t.task_datehour,t.rowid','',$params,'',$sortfield,$sortorder); + if ((empty($id) && empty($ref)) || ! empty($projectidforalltimes)) // Not a dedicated task + { + if (! empty($arrayfields['t.task_ref']['checked'])) print_liste_field_titre($arrayfields['t.task_ref']['label'],$_SERVER['PHP_SELF'],'pt.ref','',$params,'',$sortfield,$sortorder); + if (! empty($arrayfields['t.task_label']['checked'])) print_liste_field_titre($arrayfields['t.task_label']['label'],$_SERVER['PHP_SELF'],'pt.label','',$params,'',$sortfield,$sortorder); + } + if (! empty($arrayfields['author']['checked'])) print_liste_field_titre($arrayfields['author']['label'],$_SERVER['PHP_SELF'],'','',$params,'',$sortfield,$sortorder); + if (! empty($arrayfields['t.note']['checked'])) print_liste_field_titre($arrayfields['t.note']['label'],$_SERVER['PHP_SELF'],'t.note','',$params,'',$sortfield,$sortorder); + if (! empty($arrayfields['t.task_duration']['checked'])) print_liste_field_titre($arrayfields['t.task_duration']['label'],$_SERVER['PHP_SELF'],'t.task_duration','',$params,'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['value']['checked'])) print_liste_field_titre($arrayfields['value']['label'],$_SERVER['PHP_SELF'],'','',$params,'align="right"',$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; + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch '); print "\n"; + // Fields title search + print ''; + // LIST_OF_TD_TITLE_SEARCH + if (! empty($arrayfields['t.task_date']['checked'])) print ''; + if ((empty($id) && empty($ref)) || ! empty($projectidforalltimes)) // Not a dedicated task + { + if (! empty($arrayfields['t.task_ref']['checked'])) print ''; + if (! empty($arrayfields['t.task_label']['checked'])) print ''; + } + if (! empty($arrayfields['author']['checked'])) print ''; + if (! empty($arrayfields['t.note']['checked'])) print ''; + if (! empty($arrayfields['t.task_duration']['checked'])) print ''; + if (! empty($arrayfields['value']['checked'])) print ''; + // 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 ''; + } + } + }*/ + // 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; + // Action column + print ''; + print ''."\n"; + + $tasktmp = new Task($db); + + $i = 0; $total = 0; $totalvalue = 0; + $totalarray=array(); foreach ($tasks as $task_time) { $var=!$var; @@ -551,76 +800,131 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) $date2=$db->jdate($task_time->task_datehour); // Date - print ''; + if (! $i) $totalarray['nbfield']++; } - else - { - print dol_print_date(($date2?$date2:$date1),($task_time->task_date_withhour?'dayhour':'day')); - } - print ''; - // User - print ''; + // Task ref + if (! empty($arrayfields['t.task_ref']['checked'])) + { + if ((empty($id) && empty($ref)) || ! empty($projectidforalltimes)) // Not a dedicated task + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + } + + // Task label + if (! empty($arrayfields['t.task_label']['checked'])) + { + if ((empty($id) && empty($ref)) || ! empty($projectidforalltimes)) // Not a dedicated task + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + } + + // User + if (! empty($arrayfields['author']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } // Note - print ''; - + if (! empty($arrayfields['t.note']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Time spent - print ''; - + if (! empty($arrayfields['t.task_duration']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + if (! $i) $totalarray['totaldurationfield']=$totalarray['nbfield']; + $totalarray['totalduration'] += $task_time->task_duration; + } + // Value spent - if ($conf->salaries->enabled) - { + if (! empty($arrayfields['value']['checked'])) + { print ''; - } + if (! $i) $totalarray['nbfield']++; + if (! $i) $totalarray['totalvaluefield']=$totalarray['nbfield']; + $totalarray['totalvalue'] += $value; + } - // Edit and delete icon - print ''; - + print ''; + if (! $i) $totalarray['nbfield']++; + print "\n"; - $total += $task_time->task_duration; - $totalvalue += price2num($task_time->thm * $task_time->task_duration / 3600); + + $i++; } - print ''; - print ''; - if ($conf->salaries->enabled) + + // Show total line + if (isset($totalarray['totaldurationfield']) || isset($totalarray['totalvaluefield'])) { - print ''; + print ''; + $i=0; + while ($i < $totalarray['nbfield']) + { + $i++; + if ($i == 1) + { + if ($num < $limit) print ''; + else print ''; + } + elseif ($totalarray['totaldurationfield'] == $i) print ''; + elseif ($totalarray['totalvaluefield'] == $i) print ''; + else print ''; + } + print ''; } - print ''; + print ''; print "
'; + 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 ''; + } + print ''; + $searchpitco=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1); + print $searchpitco; + print '
'; - if ($_GET['action'] == 'editline' && $_GET['lineid'] == $task_time->rowid) + if (! empty($arrayfields['t.task_date']['checked'])) { - print $form->select_date(($date2?$date2:$date1),'timeline',1,1,2,"timespent_date",1,0,1); + print ''; + if ($_GET['action'] == 'editline' && $_GET['lineid'] == $task_time->rowid) + { + print $form->select_date(($date2?$date2:$date1),'timeline',1,1,2,"timespent_date",1,0,1); + } + else + { + print dol_print_date(($date2?$date2:$date1),($task_time->task_date_withhour?'dayhour':'day')); + } + print ''; - if ($_GET['action'] == 'editline' && $_GET['lineid'] == $task_time->rowid) - { - $contactsoftask=$object->getListContactId('internal'); - if (!in_array($task_time->fk_user,$contactsoftask)) { - $contactsoftask[]=$task_time->fk_user; - } - if (count($contactsoftask)>0) { - print img_object('','user','class="hideonsmartphone"'); - print $form->select_dolusers($task_time->fk_user,'userid_line',0,'',0,'',$contactsoftask); - }else { - print img_error($langs->trans('FirstAddRessourceToAllocateTime')).$langs->trans('FirstAddRessourceToAllocateTime'); - } - } - else - { - $userstatic->id = $task_time->fk_user; - $userstatic->lastname = $task_time->lastname; - $userstatic->firstname = $task_time->firstname; - print $userstatic->getNomUrl(1); - } - print ''; + $tasktmp->id = $task_time->fk_task; + $tasktmp->ref = $task_time->ref; + $tasktmp->label = $task_time->label; + print $tasktmp->getNomUrl(1, 'withproject', 'time'); + print ''; + print $task_time->label; + print ''; + if ($_GET['action'] == 'editline' && $_GET['lineid'] == $task_time->rowid) + { + if (empty($object->id)) $object->fetch($id); + $contactsoftask=$object->getListContactId('internal'); + if (!in_array($task_time->fk_user,$contactsoftask)) { + $contactsoftask[]=$task_time->fk_user; + } + if (count($contactsoftask)>0) { + print img_object('','user','class="hideonsmartphone"'); + print $form->select_dolusers($task_time->fk_user,'userid_line',0,'',0,'',$contactsoftask); + }else { + print img_error($langs->trans('FirstAddRessourceToAllocateTime')).$langs->trans('FirstAddRessourceToAllocateTime'); + } + } + else + { + $userstatic->id = $task_time->fk_user; + $userstatic->lastname = $task_time->lastname; + $userstatic->firstname = $task_time->firstname; + print $userstatic->getNomUrl(1); + } + print ''; - if ($_GET['action'] == 'editline' && $_GET['lineid'] == $task_time->rowid) - { - print ''; - } - else - { - print dol_nl2br($task_time->note); - } - print ''; + if ($_GET['action'] == 'editline' && $_GET['lineid'] == $task_time->rowid) + { + print ''; + } + else + { + print dol_nl2br($task_time->note); + } + print ''; - if ($_GET['action'] == 'editline' && $_GET['lineid'] == $task_time->rowid) - { - print ''; - print $form->select_duration('new_duration',$task_time->task_duration,0,'text'); - } - else - { - print convertSecondToTime($task_time->task_duration,'allhourmin'); - } - print ''; + if ($_GET['action'] == 'editline' && $_GET['lineid'] == $task_time->rowid) + { + print ''; + print $form->select_duration('new_duration',$task_time->task_duration,0,'text'); + } + else + { + print convertSecondToTime($task_time->task_duration,'allhourmin'); + } + print ''; - print price(price2num($task_time->thm * $task_time->task_duration / 3600), 1, $langs, 1, -1, -1, $conf->currency); + $value = price2num($task_time->thm * $task_time->task_duration / 3600); + print price($value, 1, $langs, 1, -1, -1, $conf->currency); print ''; + // 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; + + // Action column + print ''; if ($action == 'editline' && $_GET['lineid'] == $task_time->rowid) { print ''; @@ -640,19 +944,34 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) print img_delete(); print ''; } - print '
'.$langs->trans("Total").''.convertSecondToTime($total,'allhourmin').''.price($totalvalue, 1, $langs, 1, -1, -1, $conf->currency).'
'.$langs->trans("Total").''.$langs->trans("Totalforthispage").''.convertSecondToTime($totalarray['totalduration'],'allhourmin').''.price($totalarray['totalvalue']).'
 
"; diff --git a/htdocs/public/demo/index.php b/htdocs/public/demo/index.php index 02f87a89395..e50193d8d51 100644 --- a/htdocs/public/demo/index.php +++ b/htdocs/public/demo/index.php @@ -84,15 +84,15 @@ if (empty($reshook)) // Visible $alwayscheckedmodules=array('barcode','bookmark','categorie','externalrss','fckeditor','geoipmaxmind','gravatar','memcached','syslog','user','webservices'); // Technical module we always want - $alwaysuncheckedmodules=array('dynamicprices','loan','multicurrency','paybox','paypal','google','printing','resource','scanner','workflow'); // Module we never want + $alwaysuncheckedmodules=array('dynamicprices','loan','multicurrency','paybox','paypal','google','printing','scanner','workflow'); // Module we never want // Not visible - $alwayshiddencheckedmodules=array('accounting','barcode','bookmark','clicktodial','comptabilite','document','domain','externalrss','externalsite','fckeditor','geoipmaxmind','gravatar','label','ldap', + $alwayshiddencheckedmodules=array('accounting','api','barcode','bookmark','clicktodial','comptabilite','cron','document','domain','externalrss','externalsite','fckeditor','geoipmaxmind','gravatar','label','ldap', 'mailmanspip','notification','oauth','syslog','user','webservices', // Extended modules 'memcached','numberwords','zipautofillfr'); - $alwayshiddenuncheckedmodules=array('ftp','webservicesclient','api','websites', + $alwayshiddenuncheckedmodules=array('ftp','hrm','webservicesclient','websites', // Extended modules - 'awstats','bittorrent','bootstrap','cabinetmed','cmcic','concatpdf','customfield','dolicloud','filemanager','lightbox','mantis','monitoring','moretemplates','multicompany','nltechno','numberingpack','openstreetmap', + 'awstats','bittorrent','bootstrap','cabinetmed','cmcic','concatpdf','customfield','deplacement','dolicloud','filemanager','lightbox','mantis','monitoring','moretemplates','multicompany','nltechno','numberingpack','openstreetmap', 'ovh','phenix','phpsysinfo','pibarcode','postnuke','selectbank','skincoloreditor','submiteverywhere','survey','thomsonphonebook','topten','tvacerfa','voyage','webcalendar','webmail'); } @@ -361,7 +361,7 @@ foreach ($demoprofiles as $profilearray) print ''."\n"; // Title print ''; - print ''; + print ''; print ''; print ''."\n"; // Modules @@ -375,8 +375,11 @@ foreach ($demoprofiles as $profilearray) $listofdisabledmodules=explode(',',$profilearray['disablemodules']); $j=0; $nbcolsmod=empty($conf->dol_optimize_smallscreen)?4:3; - foreach($modules as $val) // Loop on qualified (enabled) modules + //var_dump($modules); + foreach($orders as $index => $key) // Loop on qualified (enabled) modules { + //print $index.' '.$key; + $val = $modules[$index]; $modulekeyname=strtolower($val->name); $modulequalified=1; @@ -454,7 +457,7 @@ if (! empty($conf->google->enabled) && ! empty($conf->global->MAIN_GOOGLE_AD_CLI } else { - print ''."\n"; + print ''."\n"; } } @@ -478,7 +481,7 @@ function llxHeaderVierge($title, $head = "") top_htmlhead($head,$title); - print ''."\n"; + print ''."\n"; } /** diff --git a/htdocs/public/members/public_list.php b/htdocs/public/members/public_list.php index 4171bbab2e1..404b7085bdb 100644 --- a/htdocs/public/members/public_list.php +++ b/htdocs/public/members/public_list.php @@ -114,7 +114,7 @@ $sql.= " AND statut = 1"; $sql.= " AND public = 1"; $sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($conf->liste_limit+1, $offset); -//$sql = "SELECT d.rowid, d.firstname, d.lastname, d.societe, zip, town, d.email, t.libelle as type, d.morphy, d.statut, t.cotisation"; +//$sql = "SELECT d.rowid, d.firstname, d.lastname, d.societe, zip, town, d.email, t.libelle as type, d.morphy, d.statut, t.subscription"; //$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."adherent_type as t"; //$sql .= " WHERE d.fk_adherent_type = t.rowid AND d.statut = $statut"; //$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit, $offset); diff --git a/htdocs/public/opensurvey/studs.php b/htdocs/public/opensurvey/studs.php index 834f17b8b2c..6f242a00544 100644 --- a/htdocs/public/opensurvey/studs.php +++ b/htdocs/public/opensurvey/studs.php @@ -41,7 +41,6 @@ if (GETPOST('sondage')) $object=new Opensurveysondage($db); $result=$object->fetch(0,$numsondage); -if ($result <= 0) dol_print_error('','Failed to get survey id '.$numsondage); $nblignes=$object->fetch_lines(); @@ -241,6 +240,16 @@ $arrayofjs=array(); $arrayofcss=array('/opensurvey/css/style.css'); llxHeaderSurvey($object->titre, "", 0, 0, $arrayofjs, $arrayofcss); +if (empty($object->ref)) // For survey, id is a hex string +{ + $langs->load("errors"); + print $langs->trans("ErrorRecordNotFound"); + + llxFooterSurvey(); + + $db->close(); + exit; +} // Define format of choices $toutsujet=explode(",",$object->sujet); diff --git a/htdocs/public/paybox/newpayment.php b/htdocs/public/paybox/newpayment.php index 481fd17f049..1945aa6c8cf 100644 --- a/htdocs/public/paybox/newpayment.php +++ b/htdocs/public/paybox/newpayment.php @@ -649,7 +649,7 @@ if (GETPOST("source") == 'membersubscription' && $valid) $langs->load("members"); require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; - require_once DOL_DOCUMENT_ROOT.'/adherents/class/cotisation.class.php'; + require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php'; $member=new Adherent($db); $result=$member->fetch('',$ref); @@ -660,7 +660,7 @@ if (GETPOST("source") == 'membersubscription' && $valid) } else { - $subscription=new Cotisation($db); + $subscription=new Subscription($db); } $amount=$subscription->total_ttc; diff --git a/htdocs/public/paypal/newpayment.php b/htdocs/public/paypal/newpayment.php index dcb43c07170..b5d105d6cf6 100644 --- a/htdocs/public/paypal/newpayment.php +++ b/htdocs/public/paypal/newpayment.php @@ -804,7 +804,7 @@ if (GETPOST("source") == 'membersubscription' && $valid) $langs->load("members"); require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; - require_once DOL_DOCUMENT_ROOT.'/adherents/class/cotisation.class.php'; + require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php'; $member=new Adherent($db); $result=$member->fetch('',$ref); @@ -815,7 +815,7 @@ if (GETPOST("source") == 'membersubscription' && $valid) } else { - $subscription=new Cotisation($db); + $subscription=new Subscription($db); } $amount=$subscription->total_ttc; diff --git a/htdocs/public/test/test_arrays.php b/htdocs/public/test/test_arrays.php index 28ff4bdb743..05eaafc3e09 100644 --- a/htdocs/public/test/test_arrays.php +++ b/htdocs/public/test/test_arrays.php @@ -31,7 +31,6 @@ if (empty($usedolheader)) Test page - @@ -39,7 +38,6 @@ if (empty($usedolheader)) - @@ -54,22 +52,8 @@ if (empty($usedolheader)) } else { - $arraycss=array('/includes/jquery/plugins/datatables/media/css/jquery.dataTables.css', - '/includes/jquery/plugins/datatables/extensions/Buttons/css/buttons.dataTables.min.css', - '/includes/jquery/plugins/datatables/extensions/ColReorder/css/colReorder.dataTables.min.css' - ); - $arrayjs=array('/includes/jquery/plugins/datatables/media/js/jquery.dataTables.js', - '/includes/jquery/plugins/datatables/extensions/Buttons/js/dataTables.buttons.js', - '/includes/jquery/plugins/datatables/extensions/Buttons/js/buttons.colVis.min.js', - '/includes/jquery/plugins/datatables/extensions/Buttons/js/buttons.html5.min.js', - '/includes/jquery/plugins/datatables/extensions/Buttons/js/buttons.flash.min.js', - '/includes/jquery/plugins/datatables/extensions/Buttons/js/buttons.print.min.js', - '/includes/jquery/plugins/datatables/extensions/ColReorder/js/dataTables.colReorder.min.js', - '/includes/jszip/jszip.min.js', - '/includes/pdfmake/pdfmake.min.js', - '/includes/pdfmake/vfs_fonts.js' - ); - + $arraycss=array(); + $arrayjs=array(); llxHeader('','','','',0,0,$arrayjs,$arraycss); } @@ -79,14 +63,14 @@ else //--------- ?> -

+

This page is a sample of page using tables. It is designed to make test with
- css (add parameter &theme=newtheme to test another theme or edit css of current theme)
-- jmobile (add parameter ">dol_use_jmobile=1&dol_optimize_smallscreen=1 to enable view with jmobile)
+- jmobile (add parameter ">dol_use_jmobile=1&dol_optimize_smallscreen=1 and switch to small screen < 960 to enable view with jmobile)
- no javascript / usage for bind people (add parameter ">nojs=1 to force disable javascript)
- dataTables
- tablednd
-

+ diff --git a/htdocs/public/websites/index.php b/htdocs/public/websites/index.php index 4625bc1573a..44789409058 100644 --- a/htdocs/public/websites/index.php +++ b/htdocs/public/websites/index.php @@ -17,8 +17,8 @@ /** * \file htdocs/public/websites/index.php - * \ingroup core - * \brief A redirect page to an error + * \ingroup website + * \brief Page to output pages * \author Laurent Destailleur */ @@ -90,14 +90,14 @@ if (empty($pageid)) // Security: Delete string ../ into $original_file global $dolibarr_main_data_root; -if ($pageid == 'css') +if ($pageid == 'css') // No more used ? { header('Content-type: text/css'); // Important: Following code is to avoid page request by browser and PHP CPU at each Dolibarr page access. //if (empty($dolibarr_nocache)) header('Cache-Control: max-age=3600, public, must-revalidate'); //else header('Cache-Control: no-cache'); - $original_file=$dolibarr_main_data_root.'/websites/'.$website.'/styles.css'; + $original_file=$dolibarr_main_data_root.'/websites/'.$website.'/styles.css.php'; } else { @@ -142,7 +142,12 @@ if (! file_exists($original_file_osencoded)) exit; } + +// Output page content +define('USEDOLIBARRSERVER', 1); +print "\n".''."\n"; include_once $original_file_osencoded; + if (is_object($db)) $db->close(); diff --git a/htdocs/public/websites/styles.css.php b/htdocs/public/websites/styles.css.php new file mode 100644 index 00000000000..5a736affc25 --- /dev/null +++ b/htdocs/public/websites/styles.css.php @@ -0,0 +1,139 @@ + + * + * 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 . + */ + +/** + * \file htdocs/public/websites/styles.css.php + * \ingroup website + * \brief Page to output style page + * \author Laurent Destailleur + */ + +define('NOTOKENRENEWAL',1); // Disables token renewal +define("NOLOGIN",1); +define("NOCSRFCHECK",1); // We accept to go on this page from external web site. +if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); +if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); +if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); + +/** + * Header empty + * + * @return void + */ +function llxHeader() { } +/** + * Footer empty + * + * @return void + */ +function llxFooter() { } + +require '../../master.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + + +$error=0; +$website=GETPOST('website', 'alpha'); +$pageid=GETPOST('page', 'alpha')?GETPOST('page', 'alpha'):GETPOST('pageid', 'alpha'); + +$accessallowed = 1; +$type=''; + + +/* + * View + */ + +$appli=constant('DOL_APPLICATION_TITLE'); +if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $appli=$conf->global->MAIN_APPLICATION_TITLE; + +//print 'Directory with '.$appli.' websites.
'; + +if (empty($pageid)) +{ + require_once DOL_DOCUMENT_ROOT.'/websites/class/website.class.php'; + require_once DOL_DOCUMENT_ROOT.'/websites/class/websitepage.class.php'; + + $object=new Website($db); + $object->fetch(0, $website); + + $objectpage=new WebsitePage($db); + $array=$objectpage->fetchAll($object->id); + + if (count($array) > 0) + { + $firstrep=reset($array); + $pageid=$firstrep->id; + } +} +if (empty($pageid)) +{ + $langs->load("website"); + print $langs->trans("PreviewOfSiteNotYetAvailable"); + exit; +} + +// Security: Delete string ../ into $original_file +global $dolibarr_main_data_root; + +$original_file=$dolibarr_main_data_root.'/websites/'.$website.'/styles.css.php'; + +// Find the subdirectory name as the reference +$refname=basename(dirname($original_file)."/"); + +// Security: +// Limite acces si droits non corrects +if (! $accessallowed) +{ + accessforbidden(); +} + +// Security: +// On interdit les remontees de repertoire ainsi que les pipe dans +// les noms de fichiers. +if (preg_match('/\.\./',$original_file) || preg_match('/[<>|]/',$original_file)) +{ + dol_syslog("Refused to deliver file ".$original_file); + $file=basename($original_file); // Do no show plain path of original_file in shown error message + dol_print_error(0,$langs->trans("ErrorFileNameInvalid",$file)); + exit; +} + +clearstatcache(); + +$filename = basename($original_file); + +// Output file on browser +dol_syslog("styles.css.php include $original_file $filename content-type=$type"); +$original_file_osencoded=dol_osencode($original_file); // New file name encoded in OS encoding charset + +// This test if file exists should be useless. We keep it to find bug more easily +if (! file_exists($original_file_osencoded)) +{ + $langs->load("website"); + print $langs->trans("RequestedPageHasNoContentYet", $pageid); + //dol_print_error(0,$langs->trans("ErrorFileDoesNotExists",$original_file)); + exit; +} + + +// Output page content +require_once $original_file_osencoded; + + +if (is_object($db)) $db->close(); + diff --git a/htdocs/resource/add.php b/htdocs/resource/add.php index cf13c79560f..7c60bf8091d 100644 --- a/htdocs/resource/add.php +++ b/htdocs/resource/add.php @@ -27,6 +27,7 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/resource/class/dolresource.class.php'; require_once DOL_DOCUMENT_ROOT.'/resource/class/html.formresource.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; // Load traductions files required by page $langs->load("resource"); @@ -60,6 +61,11 @@ if ($user->societe_id > 0) $object = new DolResource($db); +$extrafields = new ExtraFields($db); + +// fetch optionals attributes and labels +$extralabels=$extrafields->fetch_name_optionals_label($object->table_element); + if ($action == 'confirm_add_resource') { if (! $cancel) @@ -84,6 +90,12 @@ if ($action == 'confirm_add_resource') $object->description=$description; $object->fk_code_type_resource=$fk_code_type_resource; + // Fill array 'array_options' with data from add form + $ret = $extrafields->setOptionalsFromPost($extralabels, $object); + if ($ret < 0) { + $error ++; + } + $result=$object->create($user); if ($result > 0) { @@ -135,7 +147,7 @@ if (! $action) // Ref / label $field = 'ref'; print '
'; - print ''; print ''; // Type - print ''; + print ''; print ''; @@ -157,20 +169,29 @@ if (! $action) print ''; print ''; print ''; + // Other attributes + $parameters=array('objectsrc' => $objectsrc, '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,'edit'); + } + + print '
Demo '.$profilearray['label'].'Demo '.$profilearray['label'].''.$langs->trans($profilearray['label']).'
'; + print ''; print $langs->trans('ResourceFormLabel_'.$field); print ''; @@ -144,7 +156,7 @@ if (! $action) print '
'.$langs->trans("ResourceType").'
'.$langs->trans("ResourceType").''; $ret = $formresource->select_types_resource($object->fk_code_type_resource, 'fk_code_type_resource', '', 2, 1); print '
'; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor = new DolEditor($field, $$field, 160, '', '', false); + $doleditor = new DolEditor('description', $description, '', '200', 'dolibarr_notes', false); $doleditor->Create(); print '
'; dol_fiche_end(''); - echo '
', - '', - '   ', - '', - '
'; + print '
'; + print ''; + print '     '; + print ''; + print '
'; print ''; } diff --git a/htdocs/resource/card.php b/htdocs/resource/card.php index 95f5cf0574b..d2ec14efd71 100644 --- a/htdocs/resource/card.php +++ b/htdocs/resource/card.php @@ -29,9 +29,10 @@ if (! $res) $res=@include("../../main.inc.php"); // For "custom" directory if (! $res) die("Include of main fails"); require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; -require_once 'class/dolresource.class.php'; -require_once 'class/html.formresource.class.php'; +require_once DOL_DOCUMENT_ROOT.'/resource/class/dolresource.class.php'; +require_once DOL_DOCUMENT_ROOT.'/resource/class/html.formresource.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/resource.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; // Load traductions files requiredby by page $langs->load("resource"); @@ -58,6 +59,11 @@ if( ! $user->rights->resource->read) $object = new Dolresource($db); +$extrafields = new ExtraFields($db); + +// fetch optionals attributes and labels +$extralabels=$extrafields->fetch_name_optionals_label($object->table_element); + $hookmanager->initHooks(array('resource_card','globalcard')); $parameters=array('resource_id'=>$id); $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks @@ -88,6 +94,12 @@ if (empty($reshook)) $object->description = $description; $object->fk_code_type_resource = $fk_code_type_resource; + // Fill array 'array_options' with data from add form + $ret = $extrafields->setOptionalsFromPost($extralabels, $object); + if ($ret < 0) { + $error ++; + } + $result=$object->update($user); if ($result > 0) { @@ -126,7 +138,7 @@ if (empty($reshook)) Header('Location: '.DOL_URL_ROOT.'/resource/list.php'); exit; } - else + else { setEventMessages($object->error, $object->errors, 'errors'); } @@ -188,6 +200,14 @@ if ( $object->fetch($id) > 0 ) print ''; print '
'; dol_fiche_end(); @@ -235,6 +255,15 @@ if ( $object->fetch($id) > 0 ) print '
'; print $object->description; print '
'; diff --git a/htdocs/resource/class/dolresource.class.php b/htdocs/resource/class/dolresource.class.php index 4f08e6f4209..2cf93493739 100644 --- a/htdocs/resource/class/dolresource.class.php +++ b/htdocs/resource/class/dolresource.class.php @@ -63,7 +63,7 @@ class Dolresource extends CommonObject */ function create($user, $notrigger=0) { - global $conf, $langs; + global $conf, $langs, $hookmanager; $error=0; // Clean parameters @@ -107,14 +107,40 @@ class Dolresource extends CommonObject if (! $error) { $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.$this->table_element); + } + if (! $error) + { + $action='create'; + + // Actions on extra fields (by external module or standard code) + // TODO le hook fait double emploi avec le trigger !! + $hookmanager->initHooks(array('actioncommdao')); + $parameters=array('actcomm'=>$this->id); + $reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks + if (empty($reshook)) + { + if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + { + $result=$this->insertExtraFields(); + if ($result < 0) + { + $error++; + } + } + } + else if ($reshook < 0) $error++; + } + + if (! $error) + { if (! $notrigger) { //// Call triggers - //include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - //$interface=new Interfaces($this->db); - //$result=$interface->run_triggers('RESOURCE_CREATE',$this,$user,$langs,$conf); - //if ($result < 0) { $error++; $this->errors=$interface->errors; } + include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; + $interface=new Interfaces($this->db); + $result=$interface->run_triggers('RESOURCE_CREATE',$this,$user,$langs,$conf); + if ($result < 0) { $error++; $this->errors=$interface->errors; } //// End call triggers } } @@ -177,6 +203,13 @@ class Dolresource extends CommonObject $this->note_private = $obj->note_private; $this->type_label = $obj->type_label; + // Retreive all extrafield for thirdparty + // fetch optionals attributes and labels + require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'); + $extrafields=new ExtraFields($this->db); + $extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true); + $this->fetch_optionals($this->id,$extralabels); + } $this->db->free($resql); @@ -199,7 +232,7 @@ class Dolresource extends CommonObject */ function update($user=null, $notrigger=0) { - global $conf, $langs; + global $conf, $langs, $hookmanager; $error=0; // Clean parameters @@ -229,13 +262,35 @@ class Dolresource extends CommonObject // want this action calls a trigger. //// Call triggers - //include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - //$interface=new Interfaces($this->db); - //$result=$interface->run_triggers('MYOBJECT_MODIFY',$this,$user,$langs,$conf); - //if ($result < 0) { $error++; $this->errors=$interface->errors; } + include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; + $interface=new Interfaces($this->db); + $result=$interface->run_triggers('RESOURCE_MODIFY',$this,$user,$langs,$conf); + if ($result < 0) { $error++; $this->errors=$interface->errors; } //// End call triggers } } + if (! $error) + { + $action='update'; + + // Actions on extra fields (by external module or standard code) + // TODO le hook fait double emploi avec le trigger !! + $hookmanager->initHooks(array('actioncommdao')); + $parameters=array('actcomm'=>$this->id); + $reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks + if (empty($reshook)) + { + if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + { + $result=$this->insertExtraFields(); + if ($result < 0) + { + $error++; + } + } + } + else if ($reshook < 0) $error++; + } // Commit or rollback if ($error) @@ -294,10 +349,12 @@ class Dolresource extends CommonObject $this->mandatory = $obj->mandatory; $this->fk_user_create = $obj->fk_user_create; - if($obj->resource_id && $obj->resource_type) + if($obj->resource_id && $obj->resource_type) { $this->objresource = fetchObjectByElement($obj->resource_id,$obj->resource_type); - if($obj->element_id && $obj->element_type) + } + if($obj->element_id && $obj->element_type) { $this->objelement = fetchObjectByElement($obj->element_id,$obj->element_type); + } } $this->db->free($resql); @@ -324,36 +381,57 @@ class Dolresource extends CommonObject $error=0; - if (! $notrigger) - { - // Call trigger - $result=$this->call_trigger('RESOURCE_DELETE',$user); - if ($result < 0) return -1; - // End call triggers - } + $this->db->begin(); $sql = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element; $sql.= " WHERE rowid =".$rowid; - dol_syslog(get_class($this)."::delete", LOG_DEBUG); + dol_syslog(get_class($this), LOG_DEBUG); if ($this->db->query($sql)) { $sql = "DELETE FROM ".MAIN_DB_PREFIX."element_resources"; - $sql.= " WHERE element_type='resource' AND resource_id ='".$this->db->escape($rowid)."'"; + $sql.= " WHERE element_type='resource' AND resource_id =".$this->db->escape($rowid); dol_syslog(get_class($this)."::delete", LOG_DEBUG); - if ($this->db->query($sql)) + $resql=$this->db->query($sql); + if (!$resql) { - return 1; - } - else { - $this->error=$this->db->lasterror(); - return -1; + $this->error=$this->db->lasterror(); + $error++; } } else { $this->error=$this->db->lasterror(); - return -1; + $error++; + } + + // Removed extrafields + if (! $error) { + $result=$this->deleteExtraFields(); + if ($result < 0) + { + $error++; + dol_syslog(get_class($this)."::delete error -3 ".$this->error, LOG_ERR); + } + } + + if (! $notrigger) + { + // Call trigger + $result=$this->call_trigger('RESOURCE_DELETE',$user); + if ($result < 0) $error++; + // End call triggers + } + + if (! $error) + { + $this->db->commit(); + return 1; + } + else + { + $this->db->rollback(); + return -1; } } @@ -377,9 +455,20 @@ class Dolresource extends CommonObject $sql.= " t.description,"; $sql.= " t.fk_code_type_resource,"; $sql.= " t.tms,"; + + require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'); + $extrafields=new ExtraFields($this->db); + $extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true); + if (is_array($extralabels) && count($extralabels)>0) { + foreach($extralabels as $label=>$code) { + $sql.= " ef.".$code." as extra_".$code.","; + } + } + $sql.= " ty.label as type_label"; $sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element." as t"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_type_resource as ty ON ty.code=t.fk_code_type_resource"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX.$this->table_element."_extrafields as ef ON ef.fk_object=t.rowid"; $sql.= " WHERE t.entity IN (".getEntity('resource',1).")"; //Manage filter @@ -388,12 +477,14 @@ class Dolresource extends CommonObject if (strpos($key,'date')) { $sql.= ' AND '.$key.' = \''.$this->db->idate($value).'\''; } + elseif (strpos($key,'ef.')!==false){ + $sql.= $value; + } else { $sql.= ' AND '.$key.' LIKE \'%'.$value.'%\''; } } } - $sql.= " GROUP BY t.rowid, ty.label"; $sql.= $this->db->order($sortfield,$sortorder); $this->num_all = 0; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) @@ -410,10 +501,9 @@ class Dolresource extends CommonObject $num = $this->db->num_rows($resql); if ($num) { - $i = 0; - while ($i < $num) + $this->lines=array(); + while ($obj = $this->db->fetch_object($resql)) { - $obj = $this->db->fetch_object($resql); $line = new Dolresource($this->db); $line->id = $obj->rowid; $line->ref = $obj->ref; @@ -421,8 +511,12 @@ class Dolresource extends CommonObject $line->fk_code_type_resource = $obj->fk_code_type_resource; $line->type_label = $obj->type_label; - $this->lines[$i] = $line; - $i++; + // Retreive all extrafield for thirdparty + // fetch optionals attributes and labels + + $line->fetch_optionals($line->id,$extralabels); + + $this->lines[] = $line; } $this->db->free($resql); } @@ -473,7 +567,6 @@ class Dolresource extends CommonObject } } } - $sql.= " GROUP BY t.rowid, ty.label"; $sql.= $this->db->order($sortfield,$sortorder); if ($limit) $sql.= $this->db->plimit($limit+1,$offset); dol_syslog(get_class($this)."::fetch_all", LOG_DEBUG); @@ -484,10 +577,8 @@ class Dolresource extends CommonObject $num = $this->db->num_rows($resql); if ($num) { - $i = 0; - while ($i < $num) + while ($obj = $this->db->fetch_object($resql)) { - $obj = $this->db->fetch_object($resql); $line = new Dolresource($this->db); $line->id = $obj->rowid; $line->resource_id = $obj->resource_id; @@ -502,9 +593,8 @@ class Dolresource extends CommonObject $line->objresource = fetchObjectByElement($obj->resource_id,$obj->resource_type); if($obj->element_id && $obj->element_type) $line->objelement = fetchObjectByElement($obj->element_id,$obj->element_type); - $this->lines[$i] = $line; + $this->lines[] = $line; - $i++; } $this->db->free($resql); } @@ -559,7 +649,6 @@ class Dolresource extends CommonObject } } } - $sql.= " GROUP BY t.resource_id"; $sql.= $this->db->order($sortfield,$sortorder); if ($limit) $sql.= $this->db->plimit($limit+1,$offset); dol_syslog(get_class($this)."::fetch_all", LOG_DEBUG); @@ -570,10 +659,9 @@ class Dolresource extends CommonObject $num = $this->db->num_rows($resql); if ($num) { - $i = 0; - while ($i < $num) + $this->lines=array(); + while ($obj = $this->db->fetch_object($resql)) { - $obj = $this->db->fetch_object($resql); $line = new Dolresource($this->db); $line->id = $obj->rowid; $line->resource_id = $obj->resource_id; @@ -584,9 +672,7 @@ class Dolresource extends CommonObject $line->mandatory = $obj->mandatory; $line->fk_user_create = $obj->fk_user_create; - $this->lines[$i] = fetchObjectByElement($obj->resource_id,$obj->resource_type); - - $i++; + $this->lines[] = fetchObjectByElement($obj->resource_id,$obj->resource_type); } $this->db->free($resql); } @@ -759,7 +845,7 @@ class Dolresource extends CommonObject /** * Return an array with resources linked to the element - * + * * @param string $element Element * @param int $element_id Id * @param string $resource_type Type @@ -770,7 +856,7 @@ class Dolresource extends CommonObject // Links beetween objects are stored in this table $sql = 'SELECT rowid, resource_id, resource_type, busy, mandatory'; $sql.= ' FROM '.MAIN_DB_PREFIX.'element_resources'; - $sql.= " WHERE element_id='".$element_id."' AND element_type='".$element."'"; + $sql.= " WHERE element_id=".$element_id." AND element_type='".$this->db->escape($element)."'"; if($resource_type) $sql.=" AND resource_type LIKE '%".$resource_type."%'"; $sql .= ' ORDER BY resource_type'; diff --git a/htdocs/resource/element_resource.php b/htdocs/resource/element_resource.php index 7cb5b74fac3..27451b07973 100644 --- a/htdocs/resource/element_resource.php +++ b/htdocs/resource/element_resource.php @@ -30,6 +30,7 @@ if (! $res) die("Include of main fails"); require 'class/dolresource.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; // Load traductions files requiredby by page $langs->load("resource"); @@ -50,7 +51,7 @@ $hookmanager->initHooks(array('element_resource')); $object->available_resources = array('dolresource'); // Get parameters -$id = GETPOST('id','int'); +$id = GETPOST('id','int'); $action = GETPOST('action','alpha'); $mode = GETPOST('mode','alpha'); $lineid = GETPOST('lineid','int'); @@ -195,24 +196,105 @@ else dol_fiche_head($head, 'resources', $langs->trans("Action"),0,'action'); + $linkback =img_picto($langs->trans("BackToList"),'object_list','class="hideonsmartphone pictoactionview"'); + $linkback.= ''.$langs->trans("BackToList").''; + + // Link to other agenda views + $out=''; + $out.=img_picto($langs->trans("ViewPerUser"),'object_calendarperuser','class="hideonsmartphone pictoactionview"'); + $out.=''.$langs->trans("ViewPerUser").''; + $out.='
'; + $out.=img_picto($langs->trans("ViewCal"),'object_calendar','class="hideonsmartphone pictoactionview"'); + $out.=''.$langs->trans("ViewCal").''; + $out.=img_picto($langs->trans("ViewWeek"),'object_calendarweek','class="hideonsmartphone pictoactionview"'); + $out.=''.$langs->trans("ViewWeek").''; + $out.=img_picto($langs->trans("ViewDay"),'object_calendarday','class="hideonsmartphone pictoactionview"'); + $out.=''.$langs->trans("ViewDay").''; + + $linkback.=$out; + + dol_banner_tab($act, 'element_id', $linkback, ($user->societe_id?0:1), 'id', 'ref', '', "&element=".$element); + + print '
'; + + // Ref + /*print ''.$langs->trans("Ref").''; + print $form->showrefnav($act, 'id', $linkback, ($user->societe_id?0:1), 'id', 'ref', ''); + print '';*/ + // Affichage fiche action en mode visu print ''; - $linkback = ''.$langs->trans("BackToList").''; - - // Ref - print ''; - // Type if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) { - print ''; + print ''; } - // Title - print ''; + // Full day event + print ''; + + // Date start + print ''; + print ''; + + // Date end + print ''; + + // Status + /*print '';*/ + + // Location + if (empty($conf->global->AGENDA_DISABLE_LOCATION)) + { + print ''; + } + + // Assigned to + print ''; + print '
'.$langs->trans("Ref").''; - print $form->showrefnav($act, 'id', $linkback, ($user->societe_id?0:1), 'id', 'ref', ''); - print '
'.$langs->trans("Type").''.$act->type.'
'.$langs->trans("Type").''.$act->type.'
'.$langs->trans("Title").''.$act->label.'
'.$langs->trans("EventOnFullDay").''.yn($act->fulldayevent, 3).'
'.$langs->trans("DateActionStart").''; + if (! $act->fulldayevent) print dol_print_date($act->datep,'dayhour'); + else print dol_print_date($act->datep,'day'); + if ($act->percentage == 0 && $act->datep && $act->datep < ($now - $delay_warning)) print img_warning($langs->trans("Late")); + print '
'.$langs->trans("DateActionEnd").''; + if (! $act->fulldayevent) print dol_print_date($act->datef,'dayhour'); + else print dol_print_date($act->datef,'day'); + if ($act->percentage > 0 && $act->percentage < 100 && $act->datef && $act->datef < ($now- $delay_warning)) print img_warning($langs->trans("Late")); + print '
'.$langs->trans("Status").' / '.$langs->trans("Percentage").''; + print $act->getLibStatut(4); + print '
'.$langs->trans("Location").''.$act->location.'
'.$langs->trans("ActionAffectedTo").''; + $listofuserid=array(); + if (empty($donotclearsession)) + { + if ($act->userownerid > 0) $listofuserid[$act->userownerid]=array('id'=>$act->userownerid,'transparency'=>$act->transparency); // Owner first + if (! empty($act->userassigned)) // Now concat assigned users + { + // Restore array with key with same value than param 'id' + $tmplist1=$act->userassigned; $tmplist2=array(); + foreach($tmplist1 as $key => $val) + { + if ($val['id'] && $val['id'] != $act->userownerid) $listofuserid[$val['id']]=$val; + } + } + $_SESSION['assignedtouser']=json_encode($listofuserid); + } + else + { + if (!empty($_SESSION['assignedtouser'])) + { + $listofuserid=json_decode($_SESSION['assignedtouser'], true); + } + } + print '
'; + print $form->select_dolusers_forevent('view', 'assignedtouser', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300'); + print '
'; + if (in_array($user->id,array_keys($listofuserid))) + { + print '
'; + print $langs->trans("MyAvailability").': '.(($act->userassigned[$user->id]['transparency'] > 0)?$langs->trans("Busy"):$langs->trans("Available")); // We show nothing if event is assigned to nobody + print '
'; + } + print '
'; dol_fiche_end(); @@ -224,38 +306,37 @@ else */ if ($element_id && $element == 'societe') { - $socstatic = fetchObjectByElement($element_id,$element); - if (is_object($socstatic)) - { - $savobject = $object; - - $object = $socstatic; - - require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; - $head = societe_prepare_head($socstatic); - - dol_fiche_head($head, 'resources', $langs->trans("ThirdParty"),0,'company'); - - dol_banner_tab($socstatic, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom'); - + $socstatic = fetchObjectByElement($element_id, $element); + if (is_object($socstatic)) { + $savobject = $object; + + $object = $socstatic; + + require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; + $head = societe_prepare_head($socstatic); + + dol_fiche_head($head, 'resources', $langs->trans("ThirdParty"), 0, 'company'); + + dol_banner_tab($socstatic, 'socid', '', ($user->societe_id ? 0 : 1), 'rowid', 'nom'); + print '
'; - - print '
'; + + print '
'; print ''; - + // Alias name (commercial, trademark or alias name) - print '"; - - print '
'.$langs->trans('AliasNames').''; + print '
' . $langs->trans('AliasNames') . ''; print $socstatic->name_alias; print "
'; - - print '
'; - - dol_fiche_end(); - - $object = $savobject; - } + + print ''; + + print ''; + + dol_fiche_end(); + + $object = $savobject; + } } /* @@ -265,7 +346,8 @@ else { require_once DOL_DOCUMENT_ROOT.'/core/lib/fichinter.lib.php'; - $fichinter = fetchObjectByElement($element_id, $element); + $fichinter = new Fichinter($db); + $fichinter->fetch($element_id); if (is_object($fichinter)) { $head=fichinter_prepare_head($fichinter); @@ -283,11 +365,11 @@ else // Customer - if ( is_null($fichinter->client) ) + if ( is_null($fichinter->thirdparty) ) $fichinter->fetch_thirdparty(); print "".$langs->trans("Company").""; - print ''.$fichinter->client->getNomUrl(1).''; + print ''.$fichinter->thirdparty->getNomUrl(1).''; print ""; dol_fiche_end(); @@ -301,13 +383,13 @@ else if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); - //print load_fiche_titre($langs->trans('ResourcesLinkedToElement'),'',''); - - + //print load_fiche_titre($langs->trans('ResourcesLinkedToElement'),'',''); + print '
'; + // Show list of resource links - foreach ($object->available_resources as $modresources => $resources) - { + foreach ($object->available_resources as $modresources => $resources) + { $resources=(array) $resources; // To be sure $resources is an array foreach($resources as $resource_obj) { @@ -325,13 +407,12 @@ else // If we have a specific template we use it if(file_exists(dol_buildpath($path.'/core/tpl/resource_'.$element_prop['element'].'_add.tpl.php'))) { - $res=include dol_buildpath($path.'/core/tpl/resource_'.$element_prop['element'].'_add.tpl.php'); + $res=include dol_buildpath($path.'/core/tpl/resource_'.$element_prop['element'].'_add.tpl.php'); } else { - $res=include DOL_DOCUMENT_ROOT . '/core/tpl/resource_add.tpl.php'; + $res=include DOL_DOCUMENT_ROOT . '/core/tpl/resource_add.tpl.php'; } - //var_dump($element_id); if ($mode != 'add' || $resource_obj != $resource_type) { diff --git a/htdocs/resource/list.php b/htdocs/resource/list.php index 777bcb374d6..3b6338f0fce 100644 --- a/htdocs/resource/list.php +++ b/htdocs/resource/list.php @@ -41,28 +41,103 @@ $resource_id = GETPOST('resource_id','int'); $sortorder = GETPOST('sortorder','alpha'); $sortfield = GETPOST('sortfield','alpha'); -$page = GETPOST('page','int'); + +// Initialize context for list +$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'resourcelist'; $object = new Dolresource($db); +$extrafields = new ExtraFields($db); + +// fetch optionals attributes and labels +$extralabels=$extrafields->fetch_name_optionals_label($object->table_element); +$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_'); +$search_ref=GETPOST("search_ref"); +$search_type=GETPOST("search_type"); + +$filter=array(); + +if ($search_ref != ''){ + $param.='&search_ref='.$search_ref; + $filter['t.ref']=$search_ref; +} +if ($search_type != ''){ + $param.='&search_type='.$search_type; + $filter['ty.label']=$search_type; +} +if ($search_label != '') $param.='&search_label='.$search_label; +// Add $param from extra fields +foreach ($search_array_options as $key => $val) +{ + $crit=$val; + $tmpkey=preg_replace('/search_options_/','',$key); + $typ=$extrafields->attribute_type[$tmpkey]; + if ($val != '') { + $param.='&search_options_'.$tmpkey.'='.urlencode($val); + } + $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))) + { + $filter['ef.'.$tmpkey]=natural_search('ef.'.$tmpkey, $crit, $mode); + } +} +if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; + + $hookmanager->initHooks(array('resource_list')); if (empty($sortorder)) $sortorder="ASC"; if (empty($sortfield)) $sortfield="t.rowid"; if (empty($arch)) $arch = 0; +$page = GETPOST('page','int'); if ($page == -1) { - $page = 0 ; + $page = 0 ; } - -$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; -$offset = $limit * $page ; +$page = is_numeric($page) ? $page : 0; +$page = $page == -1 ? 0 : $page; +if (! $sortfield) $sortfield="p.ref"; +if (! $sortorder) $sortorder="ASC"; +$offset = $conf->liste_limit * $page ; $pageprev = $page - 1; $pagenext = $page + 1; -if( ! $user->rights->resource->read) +if( ! $user->rights->resource->read) { accessforbidden(); +} +$arrayfields = array( + 't.ref' => array( + 'label' => $langs->trans("Ref"), + 'checked' => 1 + ), + 'ty.label' => array( + 'label' => $langs->trans("ResourceType"), + 'checked' => 1 + ), +); +// 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] + ); + } +} +include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; + +// Do we click on purge search criteria ? +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers +{ + $search_ref=""; + $search_label=""; + $search_array_options=array(); + $filter=array(); +} /* * Action @@ -73,7 +148,6 @@ $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); - /* * View */ @@ -86,31 +160,96 @@ llxHeader('',$pagetitle,''); // Confirmation suppression resource line if ($action == 'delete_resource') { - print $form->formconfirm($_SERVER['PHP_SELF']."?element=".$element."&element_id=".$element_id."&lineid=".$lineid,$langs->trans("DeleteResource"),$langs->trans("ConfirmDeleteResourceElement"),"confirm_delete_resource",'','',1); + print $form->formconfirm($_SERVER['PHP_SELF']."?element=".$element."&element_id=".$element_id."&lineid=".$lineid,$langs->trans("DeleteResource"),$langs->trans("ConfirmDeleteResourceElement"),"confirm_delete_resource",'','',1); } // Load object list -$ret = $object->fetch_all($sortorder, $sortfield, $limit, $offset); +$ret = $object->fetch_all($sortorder, $sortfield, $limit, $offset, $filter); if($ret == -1) { dol_print_error($db,$object->error); exit; } else { print_barre_liste($pagetitle, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $ret+1, $object->num_all,'title_generic.png'); } -if(!$ret) { - print '
'.$langs->trans('NoResourceInDatabase').'
'; -} -else + +$var=true; + +$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; +$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); + +print '
'; +if ($optioncss != '') print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; + +print ''."\n"; +print ''; +if (! empty($arrayfields['t.ref']['checked'])) print_liste_field_titre($arrayfields['t.ref']['label'],$_SERVER["PHP_SELF"],"t.ref","",$param,"",$sortfield,$sortorder); +if (! empty($arrayfields['ty.label']['checked'])) print_liste_field_titre($arrayfields['ty.label']['label'],$_SERVER["PHP_SELF"],"t.code","",$param,"",$sortfield,$sortorder); +// Extra fields +if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { - $var=true; + 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); + } + } +} +print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch '); +print "\n"; - print '
'."\n"; - print ''; - print_liste_field_titre($langs->trans('Ref'),$_SERVER['PHP_SELF'],'t.ref','',$param,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('ResourceType'),$_SERVER['PHP_SELF'],'ty.code','',$param,'',$sortfield,$sortorder); - print_liste_field_titre('',"","","","",'width="60" align="center"',"",""); - print "\n"; +print ''; +if (! empty($arrayfields['t.ref']['checked'])) +{ + print ''; +} +if (! empty($arrayfields['ty.label']['checked'])) +{ + print ''; +} +// 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 ''; + } + } +} +// Action column +print ''; +print "\n"; +if ($ret) +{ foreach ($object->lines as $resource) { $var=!$var; @@ -120,13 +259,37 @@ else print ''; - print ''; + if (! empty($arrayfields['t.ref']['checked'])) + { + print ''; + } - print ''; + if (! empty($arrayfields['ty.label']['checked'])) + { + print ''; + } + // 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 'getAlignFlag($key); + if ($align) print ' align="'.$align.'"'; + print '>'; + $tmpkey='options_'.$key; + print $extrafields->showOutputField($key, $resource->array_options[$tmpkey], '', 1); + print ''; + } + } + if (! $i) $totalarray['nbfield']++; + } print '
'; + print ''; + print ''; + print ''; + print ''; + 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 ''; + } + print ''; +$searchpitco=$form->showFilterAndCheckAddButtons(0); +print $searchpitco; +print '
'; - print $resource->getNomUrl(5); - print ''; + print $resource->getNomUrl(5); + print ''; - print $resource->type_label; - print ''; + print $resource->type_label; + print ''; print ''; @@ -142,7 +305,11 @@ else } print '
'; - + print "
\n"; +} +else +{ + print ''.$langs->trans('NoResourceInDatabase').''; } llxFooter(); diff --git a/htdocs/societe/agenda.php b/htdocs/societe/agenda.php index 4547c7d75da..5cedf2fdfaa 100644 --- a/htdocs/societe/agenda.php +++ b/htdocs/societe/agenda.php @@ -34,6 +34,17 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; $langs->load("companies"); +if (GETPOST('actioncode','array')) +{ + $actioncode=GETPOST('actioncode','array',3); + if (! count($actioncode)) $actioncode='0'; +} +else +{ + $actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE)); +} +$search_agenda_label=GETPOST('search_agenda_label'); + // Security check $socid = GETPOST('socid','int'); if ($user->societe_id) $socid=$user->societe_id; @@ -51,6 +62,13 @@ $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'); +// 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 +{ + $actioncode=''; + $search_agenda_label=''; +} + /* @@ -81,7 +99,9 @@ if ($socid) dol_fiche_head($head, 'agenda', $langs->trans("ThirdParty"),0,'company'); - dol_banner_tab($object, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom'); + $linkback = ''.$langs->trans("BackToList").''; + + dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom'); print '
'; @@ -113,10 +133,11 @@ if ($socid) print ''; - - print '
'; + //print '
'; - $object->info($socid); + //print '
'; + + $object->info($socid); print dol_print_object_info($object, 1); print '
'; @@ -125,10 +146,8 @@ if ($socid) - /* - * Barre d'action - */ - + // Actions buttons + $objthirdparty=$object; $objcon=new stdClass(); @@ -144,6 +163,7 @@ if ($socid) //$out.=""; } + print '
'; if (! empty($conf->agenda->enabled)) @@ -162,15 +182,18 @@ if ($socid) if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) )) { - print '
'; - - print load_fiche_titre($langs->trans("ActionsOnCompany"),'',''); - + print load_fiche_titre($langs->trans("ActionsOnCompany"),'',''); + // List of todo actions - show_actions_todo($conf,$langs,$db,$object,null,0,1); - + //show_actions_todo($conf,$langs,$db,$object,null,0,$actioncode); + // List of done actions - show_actions_done($conf,$langs,$db,$object); + //show_actions_done($conf,$langs,$db,$object,null,0,$actioncode); + + // List of all actions + $filters=array(); + $filters['search_agenda_label']=$search_agenda_label; + show_actions_done($conf,$langs,$db,$object,null,0,$actioncode, '', $filters); } } diff --git a/htdocs/societe/canvas/actions_card_common.class.php b/htdocs/societe/canvas/actions_card_common.class.php index 95d5b33e162..689771ad223 100644 --- a/htdocs/societe/canvas/actions_card_common.class.php +++ b/htdocs/societe/canvas/actions_card_common.class.php @@ -260,7 +260,6 @@ abstract class ActionsCardCommon return; } } - exit; } else { diff --git a/htdocs/societe/canvas/company/tpl/card_view.tpl.php b/htdocs/societe/canvas/company/tpl/card_view.tpl.php index 26c1e77742f..fa58b02413c 100644 --- a/htdocs/societe/canvas/company/tpl/card_view.tpl.php +++ b/htdocs/societe/canvas/company/tpl/card_view.tpl.php @@ -260,7 +260,7 @@ $urlsource=$_SERVER["PHP_SELF"]."?socid=".$socid; $genallowed=$user->rights->societe->creer; $delallowed=$user->rights->societe->supprimer; -$somethingshown=$formfile->show_documents('company',$socid,$filedir,$urlsource,$genallowed,$delallowed,'',0,0,0,28,0,'',0,'',$objcanvas->control->object->default_lang); +print $formfile->showdocuments('company',$socid,$filedir,$urlsource,$genallowed,$delallowed,'',0,0,0,28,0,'',0,'',$objcanvas->control->object->default_lang); ?> diff --git a/htdocs/societe/canvas/individual/tpl/card_view.tpl.php b/htdocs/societe/canvas/individual/tpl/card_view.tpl.php index bc83f2955da..7249c752c1c 100644 --- a/htdocs/societe/canvas/individual/tpl/card_view.tpl.php +++ b/htdocs/societe/canvas/individual/tpl/card_view.tpl.php @@ -204,7 +204,7 @@ $urlsource=$_SERVER["PHP_SELF"]."?socid=".$socid; $genallowed=$user->rights->societe->creer; $delallowed=$user->rights->societe->supprimer; -$somethingshown=$formfile->show_documents('company',$socid,$filedir,$urlsource,$genallowed,$delallowed,'',0,0,0,28,0,'',0,'',$objcanvas->control->object->default_lang); +print $formfile->showdocuments('company',$socid,$filedir,$urlsource,$genallowed,$delallowed,'',0,0,0,28,0,'',0,'',$objcanvas->control->object->default_lang); ?> diff --git a/htdocs/societe/checkvat/checkVatPopup.php b/htdocs/societe/checkvat/checkVatPopup.php index 702dbb0a08a..4d3daf138b3 100644 --- a/htdocs/societe/checkvat/checkVatPopup.php +++ b/htdocs/societe/checkvat/checkVatPopup.php @@ -120,7 +120,7 @@ else { if ($result['requestDate']) print $langs->trans("Date").': '.$result['requestDate'].'
'; print $langs->trans("VATIntraSyntaxIsValid").': '.$langs->trans("No").' (Might be a non europeen VAT)
'; - print $langs->trans("VATIntraValueIsValid").': '.$langs->trans("No").' (Might be a non europeen VAT)
'; + print $langs->trans("ValueIsValid").': '.$langs->trans("No").' (Might be a non europeen VAT)
'; //$messagetoshow=$soapclient->response; } else @@ -128,7 +128,7 @@ else // Syntaxe ok if ($result['requestDate']) print $langs->trans("Date").': '.$result['requestDate'].'
'; print $langs->trans("VATIntraSyntaxIsValid").': '.$langs->trans("Yes").'
'; - print $langs->trans("VATIntraValueIsValid").': '; + print $langs->trans("ValueIsValid").': '; if (preg_match('/MS_UNAVAILABLE/i',$result['faultstring'])) { print ''.$langs->trans("ErrorVATCheckMS_UNAVAILABLE",$countryCode).'
'; diff --git a/htdocs/societe/class/api_contacts.class.php b/htdocs/societe/class/api_contacts.class.php new file mode 100644 index 00000000000..11cd1fee919 --- /dev/null +++ b/htdocs/societe/class/api_contacts.class.php @@ -0,0 +1,338 @@ + + * + * 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 . + */ + +use Luracast\Restler\RestException; + +//require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; + +/** + * API class for contacts + * + * @access protected + * @class DolibarrApiAccess {@requires user,external} + */ +class Contacts extends DolibarrApi +{ + /** + * + * @var array $FIELDS Mandatory fields, checked when create and update object + */ + static $FIELDS = array( + 'lastname' + ); + + /** + * @var Contact $contact {@type Contact} + */ + public $contact; + + /** + * Constructor + */ + function __construct() { + global $db, $conf; + $this->db = $db; + $this->contact = new Contact($this->db); + } + + /** + * Get properties of a contact object + * + * Return an array with contact informations + * + * @param int $id ID of contact + * @return array|mixed data without useless information + * + * @throws RestException + */ + function get($id) { + if (!DolibarrApiAccess::$user->rights->societe->contact->lire) + { + throw new RestException(401); + } + + $result = $this->contact->fetch($id); + if (!$result) + { + throw new RestException(404, 'Contact not found'); + } + + if (!DolibarrApi::_checkAccessToResource('contact', $this->contact->id, 'socpeople&societe')) + { + throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login); + } + + return $this->_cleanObjectDatas($this->contact); + } + + /** + * List contacts + * + * Get a list of contacts + * + * @param string $sortfield Sort field + * @param string $sortorder Sort order + * @param int $limit Limit for list + * @param int $page Page number + * @param int $socid ID of thirdparty to filter list + * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" + * @return array Array of contact objects + * + * @throws RestException + */ + function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 0, $page = 0, $socid = 0, $sqlfilters = '') { + global $db, $conf; + + $obj_ret = array(); + + if (!$socid) + { + $socid = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : ''; + } + + // If the internal user must only see his customers, force searching by him + if (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) + $search_sale = DolibarrApiAccess::$user->id; + + $sql = "SELECT t.rowid"; + $sql.= " FROM " . MAIN_DB_PREFIX . "socpeople as t"; + if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) { + // We need this table joined to the select in order to filter by sale + $sql.= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc"; + } + $sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as s ON t.fk_soc = s.rowid"; + $sql.= ' WHERE t.entity IN (' . getEntity('contact', 1) . ')'; + if ($socid) $sql.= " AND t.fk_soc = " . $socid; + + if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) + $sql.= " AND t.fk_soc = sc.fk_soc"; + if ($search_sale > 0) + $sql.= " AND s.rowid = sc.fk_soc"; // Join for the needed table to filter by sale + // Insert sale filter + if ($search_sale > 0) + { + $sql .= " AND sc.fk_user = " . $search_sale; + } + // Add sql filters + if ($sqlfilters) + { + if (! DolibarrApi::_checkFilters($sqlfilters)) + { + throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); + } + $regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; + } + + $sql.= $db->order($sortfield, $sortorder); + + if ($limit) + { + if ($page < 0) + { + $page = 0; + } + $offset = $limit * $page; + + $sql.= $db->plimit($limit + 1, $offset); + } + $result = $db->query($sql); + if ($result) + { + $num = $db->num_rows($result); + while ($i < min($num, ($limit <= 0 ? $num : $limit))) + { + $obj = $db->fetch_object($result); + $contact_static = new Contact($db); + if ($contact_static->fetch($obj->rowid)) + { + $obj_ret[] = parent::_cleanObjectDatas($contact_static); + } + $i++; + } + } + else { + throw new RestException(503, 'Error when retreive contacts : ' . $sql); + } + if (!count($obj_ret)) + { + throw new RestException(404, 'Contacts not found'); + } + return $obj_ret; + } + + /** + * Create contact object + * + * @param array $request_data Request datas + * @return int ID of contact + */ + function post($request_data = NULL) { + if (!DolibarrApiAccess::$user->rights->societe->contact->creer) + { + throw new RestException(401); + } + // Check mandatory fields + $result = $this->_validate($request_data); + + foreach ($request_data as $field => $value) + { + $this->contact->$field = $value; + } + return $this->contact->create(DolibarrApiAccess::$user); + } + + /** + * Update contact + * + * @param int $id Id of contact to update + * @param array $request_data Datas + * @return int + */ + function put($id, $request_data = NULL) { + if (!DolibarrApiAccess::$user->rights->societe->contact->creer) + { + throw new RestException(401); + } + + $result = $this->contact->fetch($id); + if (!$result) + { + throw new RestException(404, 'Contact not found'); + } + + if (!DolibarrApi::_checkAccessToResource('contact', $this->contact->id, 'socpeople&societe')) + { + throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login); + } + + foreach ($request_data as $field => $value) + { + $this->contact->$field = $value; + } + + if ($this->contact->update($id, DolibarrApiAccess::$user, 1, '', '', 'update')) + return $this->get($id); + + return false; + } + + /** + * Delete contact + * + * @param int $id Contact ID + * @return integer + */ + function delete($id) { + if (!DolibarrApiAccess::$user->rights->societe->contact->supprimer) + { + throw new RestException(401); + } + $result = $this->contact->fetch($id); + if (!$result) + { + throw new RestException(404, 'Contact not found'); + } + + if (!DolibarrApi::_checkAccessToResource('contact', $this->contact->id, 'socpeople&societe')) + { + throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login); + } + + return $this->contact->delete($id); + } + + /** + * Create useraccount object from contact + * + * @param int $id Id of contact + * @param array $request_data Request datas + * @return int ID of user + * + * @url POST {id}/createUser + */ + function createUser($id, $request_data = NULL) { + //if (!DolibarrApiAccess::$user->rights->user->user->creer) { + //throw new RestException(401); + //} + + if (!isset($request_data["login"])) + throw new RestException(400, "login field missing"); + if (!isset($request_data["password"])) + throw new RestException(400, "password field missing"); + if (!DolibarrApiAccess::$user->rights->societe->contact->lire) { + throw new RestException(401); + } + $contact = new Contact($this->db); + $contact->fetch($id); + if ($contact->id <= 0) { + throw new RestException(404, 'Contact not found'); + } + + if (!DolibarrApi::_checkAccessToResource('contact', $contact->id, 'socpeople&societe')) { + throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login); + } + // Check mandatory fields + $login = $request_data["login"]; + $password = $request_data["password"]; + $useraccount = new User($this->db); + $result = $useraccount->create_from_contact($contact,$login,$password); + if ($result <= 0) { + throw new RestException(500, "User not created"); + } + // password parameter not used in create_from_contact + $useraccount->setPassword($useraccount,$password); + + return $result; + } + + /** + * Get categories for a contact + * + * @param int $id ID of contact + * @param string $sortfield Sort field + * @param string $sortorder Sort order + * @param int $limit Limit for list + * @param int $page Page number + * + * @return mixed + * + * @url GET {id}/categories + */ + function getCategories($id, $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0) { + $categories = new Categories(); + return $categories->getListForItem('contact', $sortfield, $sortorder, $limit, $page, $id); + } + + /** + * Validate fields before create or update object + * + * @param array|null $data Data to validate + * @return array + * @throws RestException + */ + function _validate($data) { + $contact = array(); + foreach (Contacts::$FIELDS as $field) + { + if (!isset($data[$field])) + throw new RestException(400, "$field field missing"); + $contact[$field] = $data[$field]; + } + return $contact; + } +} diff --git a/htdocs/societe/class/api_contact.class.php b/htdocs/societe/class/api_deprecated_contact.class.php similarity index 92% rename from htdocs/societe/class/api_contact.class.php rename to htdocs/societe/class/api_deprecated_contact.class.php index 5144c000b4d..56ef1eec19a 100644 --- a/htdocs/societe/class/api_contact.class.php +++ b/htdocs/societe/class/api_deprecated_contact.class.php @@ -25,7 +25,7 @@ use Luracast\Restler\RestException; * @smart-auto-routing false * @access protected * @class DolibarrApiAccess {@requires user,external} - * + * @deprecated Use Contacts instead (defined in api_contacts.class.php) */ class ContactApi extends DolibarrApi { @@ -43,7 +43,7 @@ class ContactApi extends DolibarrApi public $contact; /** - * Constructor + * Constructor Warning: Deprecated * * @url contact/ * @@ -55,7 +55,7 @@ class ContactApi extends DolibarrApi } /** - * Get properties of a contact object + * Get properties of a contact object Warning: Deprecated * * Return an array with contact informations * @@ -86,7 +86,7 @@ class ContactApi extends DolibarrApi } /** - * List contacts + * List contacts Warning: Deprecated * * Get a list of contacts * @@ -114,6 +114,7 @@ class ContactApi extends DolibarrApi $socid = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : ''; } + $search_sale = 0; // If the internal user must only see his customers, force searching by him if (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) $search_sale = DolibarrApiAccess::$user->id; @@ -164,8 +165,9 @@ class ContactApi extends DolibarrApi $result = $db->query($sql); if ($result) { - $num = $db->num_rows($result); - while ($i < $num) + $i = 0; + $num = $db->num_rows($result); + while ($i < min($num, ($limit <= 0 ? $num : $limit))) { $obj = $db->fetch_object($result); $contact_static = new Contact($db); @@ -187,7 +189,7 @@ class ContactApi extends DolibarrApi } /** - * Create contact object + * Create contact object Warning: Deprecated * * @param array $request_data Request datas * @return int ID of contact @@ -210,7 +212,7 @@ class ContactApi extends DolibarrApi } /** - * Update contact + * Update contact Warning: Deprecated * * @param int $id Id of contact to update * @param array $request_data Datas @@ -247,7 +249,7 @@ class ContactApi extends DolibarrApi } /** - * Delete contact + * Delete contact Warning: Deprecated * * @param int $id Contact ID * @return integer @@ -276,7 +278,7 @@ class ContactApi extends DolibarrApi /** * Validate fields before create or update object * - * @param array $data Data to validate + * @param array|null $data Data to validate * @return array * @throws RestException */ diff --git a/htdocs/societe/class/api_thirdparty.class.php b/htdocs/societe/class/api_deprecated_thirdparty.class.php similarity index 93% rename from htdocs/societe/class/api_thirdparty.class.php rename to htdocs/societe/class/api_deprecated_thirdparty.class.php index 507d95639e6..3179cb697ce 100644 --- a/htdocs/societe/class/api_thirdparty.class.php +++ b/htdocs/societe/class/api_deprecated_thirdparty.class.php @@ -24,7 +24,7 @@ * @smart-auto-routing false * @access protected * @class DolibarrApiAccess {@requires user,external} - * + * @deprecated Use Thirdparties instead (defined in api_thirdparties.class.php) */ class ThirdpartyApi extends DolibarrApi { @@ -46,7 +46,7 @@ class ThirdpartyApi extends DolibarrApi public $customer; /** - * Constructor + * Constructor Warning: Deprecated * * @url thirdparty/ * @@ -64,7 +64,7 @@ class ThirdpartyApi extends DolibarrApi } /** - * Get properties of a customer object + * Get properties of a customer object Warning: Deprecated * * Return an array with customer informations * @@ -93,7 +93,7 @@ class ThirdpartyApi extends DolibarrApi } /** - * Search customer by email + * Search customer by email Warning: Deprecated * * @param string $email email id * @@ -111,7 +111,7 @@ class ThirdpartyApi extends DolibarrApi } /** - * Get properties of a thirdparty object + * Get properties of a thirdparty object Warning: Deprecated * * Return an array with thirdparty informations * @@ -140,7 +140,7 @@ class ThirdpartyApi extends DolibarrApi } /** - * List thirdparties + * List thirdparties Warning: Deprecated * * Get a list of thirdparties * @@ -211,8 +211,9 @@ class ThirdpartyApi extends DolibarrApi $result = $db->query($sql); if ($result) { + $i = 0; $num = $db->num_rows($result); - while ($i < $num) + while ($i < min($num, ($limit <= 0 ? $num : $limit))) { $obj = $db->fetch_object($result); $soc_static = new Societe($db); @@ -232,7 +233,7 @@ class ThirdpartyApi extends DolibarrApi } /** - * Show customers + * Show customers Warning: Deprecated * * @return array List of customers * @@ -244,7 +245,7 @@ class ThirdpartyApi extends DolibarrApi } /** - * Show prospects + * Show prospects Warning: Deprecated * * @return array List of prospects * @@ -255,7 +256,7 @@ class ThirdpartyApi extends DolibarrApi } /** - * Show other + * Show other Warning: Deprecated * * @return array List of thirpdparties who are not customer neither prospect * @@ -266,7 +267,7 @@ class ThirdpartyApi extends DolibarrApi } /** - * Create thirdparty object + * Create thirdparty object Warning: Deprecated * * @param array $request_data Request datas * @return int ID of thirdparty @@ -289,7 +290,7 @@ class ThirdpartyApi extends DolibarrApi /** - * Create customer object + * Create customer object Warning: Deprecated * * @param array $request_data Request datas * @return int ID of thirdparty @@ -303,7 +304,7 @@ class ThirdpartyApi extends DolibarrApi } /** - * Update thirdparty + * Update thirdparty Warning: Deprecated * * @param int $id Id of thirdparty to update * @param array $request_data Datas @@ -336,7 +337,7 @@ class ThirdpartyApi extends DolibarrApi return false; } /** - * Update customer + * Update customer Warning: Deprecated * * @param int $id Id of thirdparty to update * @param array $request_data Datas @@ -367,7 +368,7 @@ class ThirdpartyApi extends DolibarrApi } /** - * Delete thirdparty + * Delete thirdparty Warning: Deprecated * * @param int $id Thirparty ID * @return integer diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php new file mode 100644 index 00000000000..de21e4fbbe0 --- /dev/null +++ b/htdocs/societe/class/api_thirdparties.class.php @@ -0,0 +1,325 @@ + + * + * 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 . + */ + + use Luracast\Restler\RestException; + + +/** + * API class for thirdparties + * + * @access protected + * @class DolibarrApiAccess {@requires user,external} + * + */ +class Thirdparties extends DolibarrApi +{ + /** + * + * @var array $FIELDS Mandatory fields, checked when create and update object + */ + static $FIELDS = array( + 'name' + ); + + /** + * @var Societe $company {@type Societe} + */ + public $company; + + /** + * Constructor + */ + function __construct() + { + global $db, $conf; + $this->db = $db; + $this->company = new Societe($this->db); + + if (! empty($conf->global->SOCIETE_MAIL_REQUIRED)) { + static::$FIELDS[] = 'email'; + } + } + + /** + * Get properties of a thirdparty object + * + * Return an array with thirdparty informations + * + * @param int $id ID of thirdparty + * @return array|mixed data without useless information + * + * @throws RestException + */ + function get($id) + { + if(! DolibarrApiAccess::$user->rights->societe->lire) { + throw new RestException(401); + } + + $result = $this->company->fetch($id); + if( ! $result ) { + throw new RestException(404, 'Thirdparty not found'); + } + + if( ! DolibarrApi::_checkAccessToResource('societe',$this->company->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + + return $this->_cleanObjectDatas($this->company); + } + + /** + * List thirdparties + * + * Get a list of thirdparties + * + * @param string $sortfield Sort field + * @param string $sortorder Sort order + * @param int $limit Limit for list + * @param int $page Page number + * @param int $mode Set to 1 to show only customers + * Set to 2 to show only prospects + * Set to 3 to show only those are not customer neither prospect + * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" + * @return array Array of thirdparty objects + */ + function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 0, $page = 0, $mode=0, $sqlfilters = '') { + global $db, $conf; + + $obj_ret = array(); + + $socid = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : ''; + + // If the internal user must only see his customers, force searching by him + if (! DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) $search_sale = DolibarrApiAccess::$user->id; + + $sql = "SELECT t.rowid"; + if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects) + $sql.= " FROM ".MAIN_DB_PREFIX."societe as t"; + + if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale + $sql.= ", ".MAIN_DB_PREFIX."c_stcomm as st"; + $sql.= " WHERE t.fk_stcomm = st.id"; + if ($mode == 1) $sql.= " AND t.client IN (1, 3)"; + if ($mode == 2) $sql.= " AND t.client IN (2, 3)"; + if ($mode == 3) $sql.= " AND t.client IN (0)"; + $sql.= ' AND t.entity IN ('.getEntity('societe', 1).')'; + if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= " AND t.rowid = sc.fk_soc"; + //if ($email != NULL) $sql.= " AND s.email = \"".$email."\""; + if ($socid) $sql.= " AND t.rowid = ".$socid; + if ($search_sale > 0) $sql.= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale + // Insert sale filter + if ($search_sale > 0) + { + $sql .= " AND sc.fk_user = ".$search_sale; + } + // Add sql filters + if ($sqlfilters) + { + if (! DolibarrApi::_checkFilters($sqlfilters)) + { + throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); + } + $regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; + } + + $sql.= $db->order($sortfield, $sortorder); + + if ($limit) { + if ($page < 0) + { + $page = 0; + } + $offset = $limit * $page; + + $sql.= $db->plimit($limit + 1, $offset); + } + + $result = $db->query($sql); + if ($result) + { + $num = $db->num_rows($result); + while ($i < min($num, ($limit <= 0 ? $num : $limit))) + { + $obj = $db->fetch_object($result); + $soc_static = new Societe($db); + if($soc_static->fetch($obj->rowid)) { + $obj_ret[] = parent::_cleanObjectDatas($soc_static); + } + $i++; + } + } + else { + throw new RestException(503, 'Error when retrieve thirdparties : ' . $sql); + } + if( ! count($obj_ret)) { + throw new RestException(404, 'Thirdparties not found'); + } + return $obj_ret; + } + + /** + * Create thirdparty object + * + * @param array $request_data Request datas + * @return int ID of thirdparty + */ + function post($request_data = NULL) + { + if(! DolibarrApiAccess::$user->rights->societe->creer) { + throw new RestException(401); + } + // Check mandatory fields + $result = $this->_validate($request_data); + + foreach($request_data as $field => $value) { + $this->company->$field = $value; + } + return $this->company->create(DolibarrApiAccess::$user); + } + + /** + * Update thirdparty + * + * @param int $id Id of thirdparty to update + * @param array $request_data Datas + * @return int + */ + function put($id, $request_data = NULL) + { + if(! DolibarrApiAccess::$user->rights->societe->creer) { + throw new RestException(401); + } + + $result = $this->company->fetch($id); + if( ! $result ) { + throw new RestException(404, 'Thirdparty not found'); + } + + if( ! DolibarrApi::_checkAccessToResource('societe',$this->company->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + + foreach($request_data as $field => $value) { + $this->company->$field = $value; + } + + if($this->company->update($id, DolibarrApiAccess::$user,1,'','','update')) + return $this->get ($id); + + return false; + } + + /** + * Delete thirdparty + * + * @param int $id Thirparty ID + * @return integer + */ + function delete($id) + { + if(! DolibarrApiAccess::$user->rights->societe->supprimer) { + throw new RestException(401); + } + $result = $this->company->fetch($id); + if( ! $result ) { + throw new RestException(404, 'Thirdparty not found'); + } + if( ! DolibarrApi::_checkAccessToResource('societe',$this->company->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + return $this->company->delete($id); + } + + /** + * Get categories for a thirdparty + * + * @param int $id ID of thirdparty + * @param string $sortfield Sort field + * @param string $sortorder Sort order + * @param int $limit Limit for list + * @param int $page Page number + * + * @return mixed + * + * @url GET {id}/categories + */ + function getCategories($id, $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0) { + $categories = new Categories(); + return $categories->getListForItem('customer', $sortfield, $sortorder, $limit, $page, $id); + } + + /** + * Add category to a thirdparty + * + * @param int $id Id of thirdparty + * @param array $request_data Request datas + * + * @return mixed + * + * @url POST {id}/addCategory + */ + function addCategory($id, $request_data = NULL) { + if (!isset($request_data["category_id"])) + throw new RestException(400, "category_id field missing"); + $category_id = $request_data["category_id"]; + + if(! DolibarrApiAccess::$user->rights->societe->creer) { + throw new RestException(401); + } + + $result = $this->company->fetch($id); + if( ! $result ) { + throw new RestException(404, 'Thirdparty not found'); + } + $category = new Categorie($this->db); + $result = $category->fetch($category_id); + if( ! $result ) { + throw new RestException(404, 'category not found'); + } + + if( ! DolibarrApi::_checkAccessToResource('societe',$this->company->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + if( ! DolibarrApi::_checkAccessToResource('category',$category->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + + $category->add_type($this->company,'customer'); + return $this->company; + } + + /** + * Validate fields before create or update object + * + * @param array $data Datas to validate + * @return array + * + * @throws RestException + */ + function _validate($data) + { + $thirdparty = array(); + foreach (Thirdparties::$FIELDS as $field) { + if (!isset($data[$field])) + throw new RestException(400, "$field field missing"); + $thirdparty[$field] = $data[$field]; + } + return $thirdparty; + } +} diff --git a/htdocs/societe/class/companybankaccount.class.php b/htdocs/societe/class/companybankaccount.class.php index 9fa62dea587..68749713788 100644 --- a/htdocs/societe/class/companybankaccount.class.php +++ b/htdocs/societe/class/companybankaccount.class.php @@ -37,6 +37,8 @@ class CompanyBankAccount extends Account var $default_rib; var $frstrecur; + var $rum; + var $date_rum; var $datec; var $datem; @@ -110,6 +112,9 @@ class CompanyBankAccount extends Account { $this->create(); } + + if (dol_strlen($this->domiciliation) > 255) $this->domiciliation = dol_trunc($this->domiciliation, 254, 'right', 'UTF-8', 1); + if (dol_strlen($this->owner_address) > 255) $this->owner_address = dol_trunc($this->owner_address, 254, 'right', 'UTF-8', 1); $sql = "UPDATE ".MAIN_DB_PREFIX."societe_rib SET"; $sql.= " bank = '" .$this->db->escape($this->bank)."'"; @@ -126,6 +131,8 @@ class CompanyBankAccount extends Account if ($conf->prelevement->enabled) { $sql.= ",frstrecur = '".$this->db->escape($this->frstrecur)."'"; + $sql.= ",rum = '".$this->db->escape($this->rum)."'"; + $sql.= ",date_rum = ".($this->date_rum ? "'".$this->db->idate($this->date_rum)."'" : "null"); } if (trim($this->label) != '') $sql.= ",label = '".$this->db->escape($this->label)."'"; @@ -169,6 +176,8 @@ class CompanyBankAccount extends Account { $obj = $this->db->fetch_object($resql); + $this->ref = $obj->fk_soc.'-'.$obj->label; // Generate an artificial ref + $this->id = $obj->rowid; $this->socid = $obj->fk_soc; $this->bank = $obj->bank; @@ -233,7 +242,7 @@ class CompanyBankAccount extends Account { $rib = ''; - if ($this->code_banque || $this->code_guichet || $this->number || $this->cle_rib) { + if ($this->code_banque || $this->code_guichet || $this->number || $this->cle_rib || $this->iban || $this->bic ) { if ($this->label && $displayriblabel) { $rib = $this->label." : "; @@ -299,5 +308,39 @@ class CompanyBankAccount extends Account return -1; } } + + /** + * Initialise an instance with random values. + * Used to build previews or test instances. + * id must be 0 if object instance is a specimen. + * + * @return void + */ + function initAsSpecimen() + { + $this->specimen = 1; + $this->ref = 'CBA'; + $this->label = 'CustomerCorp Bank account'; + $this->bank = 'CustomerCorp Bank'; + $this->courant = Account::TYPE_CURRENT; + $this->clos = Account::STATUS_OPEN; + $this->code_banque = '123'; + $this->code_guichet = '456'; + $this->number = 'CUST12345'; + $this->cle_rib = 50; + $this->bic = 'CC12'; + $this->iban = 'FR999999999'; + $this->domiciliation = 'Bank address of customer corp'; + $this->proprio = 'Owner'; + $this->owner_address = 'Owner address'; + $this->country_id = 1; + + $this->rum = 'UMR-CU1212-0007-5-1475405262'; + $this->date_rum =dol_now() - 10000; + $this->frstrecur = 'FRST'; + + $this->socid = 0; + } + } diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 69262715b31..e69ce5d5490 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -310,7 +310,15 @@ class Societe extends CommonObject * @var int */ var $commercial_id; + /** + * Id of parent thirdparty (if one) + * @var int + */ var $parent; + /** + * Default language code of thirdparty (en_US, ...) + * @var string + */ var $default_lang; var $ref; @@ -357,7 +365,7 @@ class Societe extends CommonObject // Multicurrency var $fk_multicurrency; var $multicurrency_code; - + /** * To contains a clone of this when we need to save old properties of object * @var Societe @@ -406,14 +414,14 @@ class Societe extends CommonObject if (empty($this->client)) $this->client=0; if (empty($this->fournisseur)) $this->fournisseur=0; $this->import_key = trim($this->import_key); - + if (!empty($this->multicurrency_code)) $this->fk_multicurrency = MultiCurrency::getIdFromCode($this->db, $this->multicurrency_code); if (empty($this->fk_multicurrency)) { $this->multicurrency_code = ''; $this->fk_multicurrency = 0; } - + dol_syslog(get_class($this)."::create ".$this->name); // Check parameters @@ -845,7 +853,7 @@ class Societe extends CommonObject $sql .= ",mode_reglement_supplier = ".(! empty($this->mode_reglement_supplier_id)?"'".$this->db->escape($this->mode_reglement_supplier_id)."'":"null"); $sql .= ",cond_reglement_supplier = ".(! empty($this->cond_reglement_supplier_id)?"'".$this->db->escape($this->cond_reglement_supplier_id)."'":"null"); $sql .= ",fk_shipping_method = ".(! empty($this->shipping_method_id)?"'".$this->db->escape($this->shipping_method_id)."'":"null"); - + $sql .= ",client = " . (! empty($this->client)?$this->client:0); $sql .= ",fournisseur = " . (! empty($this->fournisseur)?$this->fournisseur:0); $sql .= ",barcode = ".(! empty($this->barcode)?"'".$this->db->escape($this->barcode)."'":"null"); @@ -1025,7 +1033,7 @@ class Societe extends CommonObject $sql .= ', s.fk_forme_juridique as forme_juridique_code'; $sql .= ', s.webservices_url, s.webservices_key'; $sql .= ', s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur, s.parent, s.barcode'; - $sql .= ', s.fk_departement, s.fk_pays as country_id, s.fk_stcomm, s.remise_client, s.mode_reglement, s.cond_reglement, s.tva_assuj'; + $sql .= ', s.fk_departement, s.fk_pays as country_id, s.fk_stcomm, s.remise_client, s.mode_reglement, s.cond_reglement, s.fk_account, s.tva_assuj'; $sql .= ', s.mode_reglement_supplier, s.cond_reglement_supplier, s.localtax1_assuj, s.localtax1_value, s.localtax2_assuj, s.localtax2_value, s.fk_prospectlevel, s.default_lang, s.logo'; $sql .= ', s.fk_shipping_method'; $sql .= ', s.outstanding_limit, s.import_key, s.canvas, s.fk_incoterms, s.location_incoterms'; @@ -1055,7 +1063,7 @@ class Societe extends CommonObject else if ($idprof4) $sql .= " WHERE s.idprof4 = '".$this->db->escape($idprof4)."' AND s.entity IN (".getEntity($this->element, 1).")"; else if ($idprof5) $sql .= " WHERE s.idprof5 = '".$this->db->escape($idprof5)."' AND s.entity IN (".getEntity($this->element, 1).")"; else if ($idprof6) $sql .= " WHERE s.idprof6 = '".$this->db->escape($idprof6)."' AND s.entity IN (".getEntity($this->element, 1).")"; - + $resql=$this->db->query($sql); dol_syslog(get_class($this)."::fetch ".$sql); if ($resql) @@ -1157,6 +1165,7 @@ class Societe extends CommonObject $this->mode_reglement_supplier_id = $obj->mode_reglement_supplier; $this->cond_reglement_supplier_id = $obj->cond_reglement_supplier; $this->shipping_method_id = ($obj->fk_shipping_method>0)?$obj->fk_shipping_method:null; + $this->fk_account = $obj->fk_account; $this->client = $obj->client; $this->fournisseur = $obj->fournisseur; @@ -1422,6 +1431,18 @@ class Societe extends CommonObject } } + // Remove societe_remise + if (! $error) + { + $sql = "DELETE FROM ".MAIN_DB_PREFIX."societe_remise"; + $sql.= " WHERE fk_soc = " . $id; + if (! $this->db->query($sql)) + { + $error++; + $this->error = $this->db->lasterror(); + } + } + // Remove societe_remise_except if (! $error) { @@ -1533,7 +1554,7 @@ class Societe extends CommonObject */ function set_remise_client($remise, $note, User $user) { - global $langs; + global $conf, $langs; // Nettoyage parametres $note=trim($note); @@ -1565,8 +1586,8 @@ class Societe extends CommonObject // Ecrit trace dans historique des remises $sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_remise"; - $sql.= " (datec, fk_soc, remise_client, note, fk_user_author)"; - $sql.= " VALUES ('".$this->db->idate($now)."', ".$this->id.", '".$this->db->escape($remise)."',"; + $sql.= " (entity, datec, fk_soc, remise_client, note, fk_user_author)"; + $sql.= " VALUES (".$conf->entity.", '".$this->db->idate($now)."', ".$this->id.", '".$this->db->escape($remise)."',"; $sql.= " '".$this->db->escape($note)."',"; $sql.= " ".$user->id; $sql.= ")"; @@ -1675,7 +1696,7 @@ class Societe extends CommonObject $reparray=array(); - $sql = "SELECT DISTINCT u.rowid, u.lastname, u.firstname, u.email, u.statut, u.entity"; + $sql = "SELECT DISTINCT u.rowid, u.login, u.lastname, u.firstname, u.email, u.statut, u.entity, u.photo"; $sql.= " FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc, ".MAIN_DB_PREFIX."user as u"; if (! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode)) { @@ -1703,6 +1724,8 @@ class Societe extends CommonObject $reparray[$i]['email']=$obj->email; $reparray[$i]['statut']=$obj->statut; $reparray[$i]['entity']=$obj->entity; + $reparray[$i]['login']=$obj->login; + $reparray[$i]['photo']=$obj->photo; $i++; } return $reparray; @@ -1805,17 +1828,17 @@ class Societe extends CommonObject * @param int $withpicto Add picto into link (0=No picto, 1=Include picto with link, 2=Picto only) * @param string $option Target of link ('', 'customer', 'prospect', 'supplier', 'project') * @param int $maxlen Max length of name - * @param integer $notooltip 1=Disable tooltip + * @param int $notooltip 1=Disable tooltip * @return string String with URL */ function getNomUrl($withpicto=0, $option='', $maxlen=0, $notooltip=0) { - global $conf,$langs; + global $conf, $langs, $hookmanager; + + if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips $name=$this->name?$this->name:$this->nom; - if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; - if (! empty($conf->global->SOCIETE_ADD_REF_IN_LIST) && (!empty($withpicto))) { if (($this->client) && (! empty ( $this->code_client ))) { @@ -1830,51 +1853,46 @@ class Societe extends CommonObject if (!empty($this->name_alias)) $name .= ' ('.$this->name_alias.')'; $result=''; $label=''; - $link=''; $linkend=''; + $linkstart=''; $linkend=''; $label.= '
'; - if ($option == 'customer' || $option == 'compta') + if ($option == 'customer' || $option == 'compta' || $option == 'category' || $option == 'category_supplier') { $label.= '' . $langs->trans("ShowCustomer") . ''; - $link = 'global->SOCIETE_DISABLE_PROSPECTS)) { $label.= '' . $langs->trans("ShowProspect") . ''; - $link = 'trans("ShowSupplier") . ''; - $link = 'trans("ShowAgenda") . ''; - $link = 'trans("ShowProject") . ''; - $link = 'trans("ShowCategory") . ''; - $link = ''; + $linkstart = ''; - $link = ''; - $link = '' . $langs->trans('CustomerCode') . ': '. $this->code_client; if (! empty($this->code_fournisseur) && $this->fournisseur) $label.= '
' . $langs->trans('SupplierCode') . ': '. $this->code_fournisseur; - + if (! empty($conf->accounting->enabled) && $this->client) + $label.= '
' . $langs->trans('CustomerAccountancyCode') . ': '. $this->code_compta_client; + if (! empty($conf->accounting->enabled) && $this->fournisseur) + $label.= '
' . $langs->trans('SupplierAccountancyCode') . ': '. $this->code_compta_fournisseur; + if (! empty($this->logo)) { $label.= '
'; @@ -1897,23 +1919,35 @@ class Societe extends CommonObject $label.= '
'; // Add type of canvas - $link.=(!empty($this->canvas)?'&canvas='.$this->canvas:'').'"'; + $linkstart.=(!empty($this->canvas)?'&canvas='.$this->canvas:'').'"'; + + $linkclose=''; if (empty($notooltip)) { - if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) + if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { $label=$langs->trans("ShowCompany"); - $link.=' alt="'.dol_escape_htmltag($label, 1).'"'; + $linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"'; } - $link.= ' title="'.dol_escape_htmltag($label, 1).'"'; - $link.=' class="classfortooltip"'; + $linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose.=' class="classfortooltip"'; + + if (! is_object($hookmanager)) + { + include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; + $hookmanager=new HookManager($this->db); + } + $hookmanager->initHooks(array('societedao')); + $parameters=array('id'=>$this->id); + $reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks + if ($reshook > 0) $linkclose = $hookmanager->resPrint; } - $link.='>'; + $linkstart.=$linkclose.'>'; $linkend='
'; - if ($withpicto) $result.=($link.img_object(($notooltip?'':$label), 'company', ($notooltip?'':'class="classfortooltip"')).$linkend); + if ($withpicto) $result.=($linkstart.img_object(($notooltip?'':$label), 'company', ($notooltip?'':'class="classfortooltip"')).$linkend); if ($withpicto && $withpicto != 2) $result.=' '; - if ($withpicto != 2) $result.=$link.($maxlen?dol_trunc($name,$maxlen):$name).$linkend; + if ($withpicto != 2) $result.=$linkstart.($maxlen?dol_trunc($name,$maxlen):$name).$linkend; return $result; } @@ -1953,23 +1987,23 @@ class Societe extends CommonObject } if ($mode == 2) { - if ($statut==0) return img_picto($langs->trans("ActivityCeased"),'statut5').' '.$langs->trans("ActivityCeased"); - if ($statut==1) return img_picto($langs->trans("InActivity"),'statut4').' '.$langs->trans("InActivity"); + if ($statut==0) return img_picto($langs->trans("ActivityCeased"),'statut5', 'class="pictostatus"').' '.$langs->trans("ActivityCeased"); + if ($statut==1) return img_picto($langs->trans("InActivity"),'statut4', 'class="pictostatus"').' '.$langs->trans("InActivity"); } if ($mode == 3) { - if ($statut==0) return img_picto($langs->trans("ActivityCeased"),'statut5'); - if ($statut==1) return img_picto($langs->trans("InActivity"),'statut4'); + if ($statut==0) return img_picto($langs->trans("ActivityCeased"),'statut5', 'class="pictostatus"'); + if ($statut==1) return img_picto($langs->trans("InActivity"),'statut4', 'class="pictostatus"'); } if ($mode == 4) { - if ($statut==0) return img_picto($langs->trans("ActivityCeased"),'statut5').' '.$langs->trans("ActivityCeased"); - if ($statut==1) return img_picto($langs->trans("InActivity"),'statut4').' '.$langs->trans("InActivity"); + if ($statut==0) return img_picto($langs->trans("ActivityCeased"),'statut5', 'class="pictostatus"').' '.$langs->trans("ActivityCeased"); + if ($statut==1) return img_picto($langs->trans("InActivity"),'statut4', 'class="pictostatus"').' '.$langs->trans("InActivity"); } if ($mode == 5) { - if ($statut==0) return $langs->trans("ActivityCeased").' '.img_picto($langs->trans("ActivityCeased"),'statut5'); - if ($statut==1) return $langs->trans("InActivity").' '.img_picto($langs->trans("InActivity"),'statut4'); + if ($statut==0) return $langs->trans("ActivityCeased").' '.img_picto($langs->trans("ActivityCeased"),'statut5', 'class="pictostatus"'); + if ($statut==1) return $langs->trans("InActivity").' '.img_picto($langs->trans("InActivity"),'statut4', 'class="pictostatus"'); } } @@ -1983,11 +2017,10 @@ class Societe extends CommonObject { global $langs; - $contact_emails = $this->contact_property_array('email'); + $contact_emails = $this->contact_property_array('email',1); if ($this->email && $addthirdparty) { if (empty($this->name)) $this->name=$this->nom; - // TODO: Tester si email non deja present dans tableau contact $contact_emails['thirdparty']=$langs->trans("ThirdParty").': '.dol_trunc($this->name,16)." <".$this->email.">"; } return $contact_emails; @@ -2152,7 +2185,7 @@ class Societe extends CommonObject * * @param int $rowid id of contact * @param string $mode 'email' or 'mobile' - * @return string email of contact + * @return string Email of contact with format: "Full name " */ function contact_get_property($rowid,$mode) { @@ -2195,6 +2228,7 @@ class Societe extends CommonObject function display_rib($mode='label') { require_once DOL_DOCUMENT_ROOT . '/societe/class/companybankaccount.class.php'; + $bac = new CompanyBankAccount($this->db); $bac->fetch(0,$this->id); @@ -2206,6 +2240,7 @@ class Societe extends CommonObject { if (empty($bac->rum)) { + require_once DOL_DOCUMENT_ROOT . '/compta/prelevement/class/bonprelevement.class.php'; $prelevement = new BonPrelevement($this->db); $bac->fetch_thirdparty(); $bac->rum = $prelevement->buildRumNumber($bac->thirdparty->code_client, $bac->datec, $bac->id); @@ -2608,7 +2643,7 @@ class Societe extends CommonObject * @param int $idprof 1,2,3,4 (Exemple: 1=siren,2=siret,3=naf,4=rcs/rm) * @param Societe $soc Objet societe * @return int <=0 if KO, >0 if OK - * TODO not in business class + * TODO better to have this in a lib than into a business class */ function id_prof_check($idprof,$soc) { @@ -2720,27 +2755,40 @@ class Societe extends CommonObject } /** - * Renvoi url de verification d'un identifiant professionnal + * Return an url to check online a professional id or empty string * - * @param int $idprof 1,2,3,4 (Exemple: 1=siren,2=siret,3=naf,4=rcs/rm) - * @param Societe $soc Objet societe - * @return string url ou chaine vide si aucune url connue - * TODO not in business class + * @param int $idprof 1,2,3,4 (Example: 1=siren,2=siret,3=naf,4=rcs/rm) + * @param Societe $thirdparty Object thirdparty + * @return string Url or empty string if no URL known + * TODO better in a lib than into business class */ - function id_prof_url($idprof,$soc) + function id_prof_url($idprof,$thirdparty) { - global $conf,$langs; - - if (! empty($conf->global->MAIN_DISABLEPROFIDRULES)) return ''; + global $conf,$langs,$hookmanager; $url=''; + $action = ''; - if ($idprof == 1 && $soc->country_code == 'FR') $url='http://www.societe.com/cgi-bin/recherche?rncs='.$soc->idprof1; - if ($idprof == 1 && ($soc->country_code == 'GB' || $soc->country_code == 'UK')) $url='http://www.companieshouse.gov.uk/WebCHeck/findinfolink/'; - if ($idprof == 1 && $soc->country_code == 'ES') $url='http://www.e-informa.es/servlet/app/portal/ENTP/screen/SProducto/prod/ETIQUETA_EMPRESA/nif/'.$soc->idprof1; - if ($idprof == 1 && $soc->country_code == 'IN') $url='http://www.tinxsys.com/TinxsysInternetWeb/dealerControllerServlet?tinNumber='.$soc->idprof1.';&searchBy=TIN&backPage=searchByTin_Inter.jsp'; + $hookmanager->initHooks(array('idprofurl')); + $parameters=array('idprof'=>$idprof, 'company'=>$thirdparty); + $reshook=$hookmanager->executeHooks('getIdProfUrl',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks + if (empty($reshook)) + { + if (! empty($conf->global->MAIN_DISABLEPROFIDRULES)) return ''; + + // TODO Move links to validate professional ID into a dictionary table "country" + "link" + if ($idprof == 1 && $thirdparty->country_code == 'FR') $url='http://www.societe.com/cgi-bin/search?champs='.$thirdparty->idprof1; // See also http://avis-situation-sirene.insee.fr/ + //if ($idprof == 1 && ($thirdparty->country_code == 'GB' || $thirdparty->country_code == 'UK')) $url='http://www.companieshouse.gov.uk/WebCHeck/findinfolink/'; // Link no more valid + if ($idprof == 1 && $thirdparty->country_code == 'ES') $url='http://www.e-informa.es/servlet/app/portal/ENTP/screen/SProducto/prod/ETIQUETA_EMPRESA/nif/'.$thirdparty->idprof1; + if ($idprof == 1 && $thirdparty->country_code == 'IN') $url='http://www.tinxsys.com/TinxsysInternetWeb/dealerControllerServlet?tinNumber='.$thirdparty->idprof1.';&searchBy=TIN&backPage=searchByTin_Inter.jsp'; + + if ($url) return ''.$langs->trans("Check").''; + } + else + { + return $hookmanager->resPrint; + } - if ($url) return '['.$langs->trans("Check").']'; return ''; } @@ -3126,7 +3174,7 @@ class Societe extends CommonObject } else return false; } - + /** * Check if we must use revenue stamps feature or not according to country (country of $mysocin most cases). * @@ -3355,7 +3403,7 @@ class Societe extends CommonObject } - + /** * Create a document onto disk according to template module. * @@ -3364,34 +3412,48 @@ class Societe extends CommonObject * @param int $hidedetails Hide details of lines * @param int $hidedesc Hide description * @param int $hideref Hide ref + * @param null|array $moreparams Array to provide more information * @return int <0 if KO, >0 if OK */ - public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) + public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $moreparams=null) { global $conf,$user,$langs; - // Positionne le modele sur le nom du modele a utiliser - if (! dol_strlen($modele)) + if (! empty($moreparams) && ! empty($moreparams['use_companybankid'])) { - if (! empty($conf->global->COMPANY_ADDON_PDF)) - { - $modele = $conf->global->COMPANY_ADDON_PDF; - } - else - { - print $langs->trans("Error")." ".$langs->trans("Error_COMPANY_ADDON_PDF_NotDefined"); - return 0; - } + $modelpath = "core/modules/bank/doc/"; + + include_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php'; + $companybankaccount = new CompanyBankAccount($this->db); + $result = $companybankaccount->fetch($moreparams['use_companybankid']); + if (! $result) dol_print_error($this->db, $companybankaccount->error, $companybankaccount->errors); + $result=$companybankaccount->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams); + } + else + { + // Positionne le modele sur le nom du modele a utiliser + if (! dol_strlen($modele)) + { + if (! empty($conf->global->COMPANY_ADDON_PDF)) + { + $modele = $conf->global->COMPANY_ADDON_PDF; + } + else + { + print $langs->trans("Error")." ".$langs->trans("Error_COMPANY_ADDON_PDF_NotDefined"); + return 0; + } + } + + $modelpath = "core/modules/societe/doc/"; + + $result=$this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams); } - - $modelpath = "core/modules/societe/doc/"; - - $result=$this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref); return $result; } - - + + /** * Sets object to supplied categories. * @@ -3466,18 +3528,16 @@ class Societe extends CommonObject * Thirdparty commercials cannot be the same in both thirdparties so we look for them and remove some * Because this function is meant to be executed within a transaction, we won't take care of it. */ - $sql = 'SELECT rowid -FROM llx_societe_commerciaux -WHERE fk_soc = '.(int) $dest_id.' AND fk_user IN ( - SELECT fk_user - FROM llx_societe_commerciaux - WHERE fk_soc = '.(int) $origin_id.' -);'; + $sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'societe_commerciaux '; + $sql .= ' WHERE fk_soc = '.(int) $dest_id.' AND fk_user IN ( '; + $sql .= ' SELECT fk_user '; + $sql .= ' FROM '.MAIN_DB_PREFIX.'societe_commerciaux '; + $sql .= ' WHERE fk_soc = '.(int) $origin_id.') '; $query = $db->query($sql); while ($result = $db->fetch_object($query)) { - $db->query('DELETE FROM llx_societe_commerciaux WHERE rowid = '.$result->rowid); + $db->query('DELETE FROM '.MAIN_DB_PREFIX.'societe_commerciaux WHERE rowid = '.$result->rowid); } /** diff --git a/htdocs/societe/commerciaux.php b/htdocs/societe/commerciaux.php index 08d2bdd7a8b..dd8802779b8 100644 --- a/htdocs/societe/commerciaux.php +++ b/htdocs/societe/commerciaux.php @@ -114,7 +114,9 @@ if (! empty($socid)) dol_fiche_head($head, 'salesrepresentative', $langs->trans("ThirdParty"),0,'company'); - dol_banner_tab($object, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom'); + $linkback = ''.$langs->trans("BackToList").''; + + dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom'); print '
'; @@ -137,7 +139,7 @@ if (! empty($socid)) print ''.$langs->trans("SalesRepresentatives").''; print ''; - $sql = "SELECT DISTINCT u.rowid, u.login, u.fk_soc, u.lastname, u.firstname, u.statut, u.entity"; + $sql = "SELECT DISTINCT u.rowid, u.login, u.fk_soc, u.lastname, u.firstname, u.statut, u.entity, u.photo"; $sql .= " FROM ".MAIN_DB_PREFIX."user as u"; $sql .= " , ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if (! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode)) @@ -184,7 +186,8 @@ if (! empty($socid)) $tmpuser->login = $obj->login; $tmpuser->entity = $obj->entity; $tmpuser->societe_id = $obj->fk_soc; - print $tmpuser->getNomUrl(1); + $tmpuser->photo = $obj->photo; + print $tmpuser->getNomUrl(-1); /*print ''; print img_object($langs->trans("ShowUser"),"user").' '; @@ -227,7 +230,7 @@ if (! empty($socid)) $langs->load("users"); $title=$langs->trans("ListOfUsers"); - $sql = "SELECT DISTINCT u.rowid, u.lastname, u.firstname, u.login, u.email, u.statut, u.fk_soc"; + $sql = "SELECT DISTINCT u.rowid, u.lastname, u.firstname, u.login, u.email, u.statut, u.fk_soc, u.photo"; $sql.= " FROM ".MAIN_DB_PREFIX."user as u"; if (! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode)) { @@ -273,10 +276,11 @@ if (! empty($socid)) $tmpuser->login=$obj->login; $tmpuser->email=$obj->email; $tmpuser->societe_id=$obj->fk_soc; - print $tmpuser->getNomUrl(1); + $tmpuser->photo=$obj->photo; + print $tmpuser->getNomUrl(-1); print ''; print ''.$obj->login.''; - print ''.User::LibStatut($obj->statut,0).''; + print ''.$tmpuser->getLibStatut(2).''; print ''.$langs->trans("Add").''; print ''."\n"; diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php index 70dee1ab8eb..e46e0aa5848 100644 --- a/htdocs/societe/consumption.php +++ b/htdocs/societe/consumption.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2015 Laurent Destailleur + * Copyright (C) 2004-2016 Laurent Destailleur * Copyright (C) 2013-2015 Juanjo Menent * Copyright (C) 2015 Marcos García * Copyright (C) 2015 Ferran Marcet @@ -57,7 +57,7 @@ $month = GETPOST('month','int'); $year = GETPOST('year','int'); // Clean up on purge search criteria ? -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 { $sref=''; $sprod_fulldescr=''; @@ -114,7 +114,9 @@ if (empty($socid)) $head = societe_prepare_head($object); dol_fiche_head($head, 'consumption', $langs->trans("ThirdParty"),0,'company'); -dol_banner_tab($object, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom'); +$linkback = ''.$langs->trans("BackToList").''; + +dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom'); print '
'; @@ -145,10 +147,11 @@ if ($object->client) if ($conf->propal->enabled && $user->rights->propal->lire) $elementTypeArray['propal']=$langs->transnoentitiesnoconv('Proposals'); if ($conf->commande->enabled && $user->rights->commande->lire) $elementTypeArray['order']=$langs->transnoentitiesnoconv('Orders'); if ($conf->facture->enabled && $user->rights->facture->lire) $elementTypeArray['invoice']=$langs->transnoentitiesnoconv('Invoices'); - if ($conf->ficheinter->enabled && $user->rights->ficheinter->lire) $elementTypeArray['fichinter']=$langs->transnoentitiesnoconv('Interventions'); if ($conf->contrat->enabled && $user->rights->contrat->lire) $elementTypeArray['contract']=$langs->transnoentitiesnoconv('Contracts'); } +if ($conf->ficheinter->enabled && $user->rights->ficheinter->lire) $elementTypeArray['fichinter']=$langs->transnoentitiesnoconv('Interventions'); + if ($object->fournisseur) { print ''; @@ -276,12 +279,12 @@ if ($type_element == 'contract') $thirdTypeSelect='customer'; } -if ($sql_select) +if (!empty($sql_select)) { $sql = $sql_select; $sql.= ' d.description as description,'; - if ($type_element != 'fichinter' && $type_element != 'contract') $sql.= ' d.label, d.fk_product as product_id, d.fk_product as fk_product, d.info_bits, d.date_start, d.date_end, d.qty, d.qty as prod_qty,'; - if ($type_element == 'contract') $sql.= ' d.label, d.fk_product as product_id, d.fk_product as fk_product, d.info_bits, d.date_ouverture as date_start, d.date_cloture as date_end, d.qty, d.qty as prod_qty,'; + if ($type_element != 'fichinter' && $type_element != 'contract') $sql.= ' d.label, d.fk_product as product_id, d.fk_product as fk_product, d.info_bits, d.date_start, d.date_end, d.qty, d.qty as prod_qty, d.total_ht as total_ht, '; + if ($type_element == 'contract') $sql.= ' d.label, d.fk_product as product_id, d.fk_product as fk_product, d.info_bits, d.date_ouverture as date_start, d.date_cloture as date_end, d.qty, d.qty as prod_qty, d.total_ht as total_ht, '; if ($type_element != 'fichinter') $sql.= ' p.ref as ref, p.rowid as prod_id, p.rowid as fk_product, p.fk_product_type as prod_type, p.fk_product_type as fk_product_type, p.entity as pentity,'; $sql.= " s.rowid as socid "; if ($type_element != 'fichinter') $sql.= ", p.ref as prod_ref, p.label as product_label"; @@ -302,7 +305,7 @@ if ($sql_select) $sql.= " AND ".$dateprint." BETWEEN '".$db->idate($start)."' AND '".$db->idate($end)."'"; } if ($sref) $sql.= " AND ".$doc_number." LIKE '%".$db->escape($sref)."%'"; - if ($sprod_fulldescr) + if ($sprod_fulldescr) { $sql.= " AND (d.description LIKE '%".$db->escape($sprod_fulldescr)."%'"; if (GETPOST('type_element') != 'fichinter') $sql.= " OR p.ref LIKE '%".$db->escape($sprod_fulldescr)."%'"; @@ -310,19 +313,28 @@ if ($sql_select) $sql.=")"; } $sql.= $db->order($sortfield,$sortorder); - + $resql=$db->query($sql); $totalnboflines = $db->num_rows($resql); - + $sql.= $db->plimit($limit + 1, $offset); //print $sql; } +$disabled=0; +$showempty=2; +if (empty($elementTypeArray) && ! $object->client && ! $object->fournisseur) +{ + $showempty=$langs->trans("ThirdpartyNotCustomerNotSupplierSoNoRef"); + $disabled=1; +} + // Define type of elements -$typeElementString = $form->selectarray("type_element", $elementTypeArray, GETPOST('type_element'), 2); +$typeElementString = $form->selectarray("type_element", $elementTypeArray, GETPOST('type_element'), $showempty, 0, 0, '', 0, 0, $disabled); $button = ''; $param="&sref=".$sref."&month=".$month."&year=".$year."&sprod_fulldescr=".$sprod_fulldescr."&socid=".$socid."&type_element=".$type_element; +$total_qty=0; if ($sql_select) { @@ -351,6 +363,8 @@ if ($sql_select) print_liste_field_titre($langs->trans('Status'),$_SERVER['PHP_SELF'],'fk_statut','',$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans('Product'),$_SERVER['PHP_SELF'],'','',$param,'align="left"',$sortfield,$sortorder); print_liste_field_titre($langs->trans('Quantity'),$_SERVER['PHP_SELF'],'prod_qty','',$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans('TotalHT'),$_SERVER['PHP_SELF'],'total_ht','',$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans('UnitPrice'),$_SERVER['PHP_SELF'],'','',$param,'align="right"',$sortfield,$sortorder); print "\n"; // Filters print ''; @@ -366,6 +380,10 @@ if ($sql_select) print ''; print ''; print ''; + print ''; + print ''; + print ''; + print ''; print ''; $searchpitco=$form->showFilterAndCheckAddButtons(0); print $searchpitco; @@ -543,11 +561,23 @@ if ($sql_select) //print ''.$prodreftxt.''; print ''.$objp->prod_qty.''; + $total_qty+=$objp->prod_qty; + + print ''.price($objp->total_ht).''; + $total_ht+=$objp->total_ht; + + print ''.price($objp->total_ht/(empty($objp->prod_qty)?1:$objp->prod_qty)).''; print "\n"; $i++; } + print ''; + print '' . $langs->trans('Total') . ''; + print ''; + print '' . $total_qty . ''; + print '' . price($total_ht) . ''; + print '' . price($total_ht/(empty($total_qty)?1:$total_qty)) . ''; print ""; if ($num > $limit) { @@ -569,7 +599,7 @@ else if (empty($type_element) || $type_element == -1) print_liste_field_titre($langs->trans('Quantity'),$_SERVER['PHP_SELF'],'prod_qty','',$param,'align="right"',$sortfield,$sortorder); print "\n"; - print ''.$langs->trans("SelectElementAndClickRefresh").''; + print ''.$langs->trans("SelectElementAndClickRefresh").''; print ""; } @@ -578,7 +608,7 @@ else { print ''."\n"; - print ''; + print ''; print "
'.$langs->trans("FeatureNotYetAvailable").'
'.$langs->trans("FeatureNotYetAvailable").'
"; } diff --git a/htdocs/societe/document.php b/htdocs/societe/document.php index 4ad8abc9a43..d83822c2cd7 100644 --- a/htdocs/societe/document.php +++ b/htdocs/societe/document.php @@ -109,7 +109,9 @@ if ($object->id) $totalsize+=$file['size']; } - dol_banner_tab($object, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom'); + $linkback = ''.$langs->trans("BackToList").''; + + dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom'); print '
'; @@ -154,6 +156,7 @@ if ($object->id) $modulepart = 'societe'; $permission = $user->rights->societe->creer; + $permtoedit = $user->rights->societe->creer; $param = '&id=' . $object->id; include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php'; } diff --git a/htdocs/societe/index.php b/htdocs/societe/index.php index 1cc44777438..333ee590f2d 100644 --- a/htdocs/societe/index.php +++ b/htdocs/societe/index.php @@ -79,7 +79,7 @@ if (count($listofsearchfields)) { if ($i == 0) print ''.$langs->trans("Search").''; print ''; - print ':'; + print ''; if ($i == 0) print ''; print ''; $i++; @@ -326,7 +326,7 @@ if ($result) $i++; } - $db->free(); + $db->free($result); print "\n"; print "\n"; diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 019542810e8..40ef1e6c896 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -6,6 +6,7 @@ * Copyright (C) 2013-2015 Raphaël Doursenaud * Copyright (C) 2015 Florian Henry * Copyright (C) 2016 Josep Lluis Amador + * Copyright (C) 2016 Ferran Marcet * * 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 @@ -159,7 +160,8 @@ $arrayfields=array( 's.idprof4'=>array('label'=>$langs->trans("ProfId4Short"), 'checked'=>$checkedprofid4), 's.idprof5'=>array('label'=>$langs->trans("ProfId5Short"), 'checked'=>$checkedprofid5), 's.idprof6'=>array('label'=>$langs->trans("ProfId6Short"), 'checked'=>$checkedprofid6), - 's.fk_prospectlevel'=>array('label'=>$langs->trans("ProspectLevelShort"), 'checked'=>$checkprospectlevel), + 'customerorsupplier'=>array('label'=>'Nature', 'checked'=>1), + 's.fk_prospectlevel'=>array('label'=>$langs->trans("ProspectLevelShort"), 'checked'=>$checkprospectlevel), 's.fk_stcomm'=>array('label'=>$langs->trans("StatusProsp"), 'checked'=>$checkstcomm), 's.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), 's.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500), @@ -168,7 +170,7 @@ $arrayfields=array( // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { - foreach($extrafields->attribute_label as $key => $val) + 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]); } @@ -254,9 +256,6 @@ $prospectstatic=new Client($db); $prospectstatic->client=2; $prospectstatic->loadCacheOfProspStatus(); -$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; -llxHeader('',$langs->trans("ThirdParty"),$help_url); - $title=$langs->trans("ListOfThirdParties"); if ($type == 'c' && (empty($search_type) || ($search_type == '1,3'))) $title=$langs->trans("ListOfCustomers"); @@ -342,8 +341,9 @@ else dol_print_error($db); $sql = "SELECT s.rowid, s.nom as name, s.name_alias, s.barcode, s.town, s.zip, s.datec, s.code_client, s.code_fournisseur, "; $sql.= " st.libelle as stcomm, s.fk_stcomm as stcomm_id, s.fk_prospectlevel, s.prefix_comm, s.client, s.fournisseur, s.canvas, s.status as status,"; -$sql.= " s.siren as idprof1, s.siret as idprof2, ape as idprof3, idprof4 as idprof4, s.fk_pays,"; +$sql.= " s.siren as idprof1, s.siret as idprof2, s.ape as idprof3, s.idprof4 as idprof4, s.fk_pays,"; $sql.= " s.tms as date_update, s.datec as date_creation,"; +$sql.= " s.code_compta,s.code_compta_fournisseur,"; $sql.= " typent.code as typent_code,"; $sql.= " state.code_departement as state_code, state.nom as state_name"; // We'll need these fields in order to filter by sale (including the case where the user can only see his prospects) @@ -409,7 +409,7 @@ foreach ($search_array_options as $key => $val) $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))) + if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit))) { $sql .= natural_search('ef.'.$tmpkey, $crit, $mode); } @@ -432,616 +432,633 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) $sql.= $db->plimit($limit+1, $offset); $resql = $db->query($sql); -if ($resql) +if (! $resql) { - $num = $db->num_rows($resql); - $i = 0; + dol_print_error($db); + exit; +} - $param=''; - if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; - if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; - if ($sall != '') $param .= "&sall=".urlencode($sall); - if ($search_categ > 0) $param.='&search_categ='.urlencode($search_categ); - if ($search_sale > 0) $param.='&search_sale='.urlencode($search_sale); - if ($search_nom != '') $param.= "&search_nom=".urlencode($search_nom); - if ($search_town != '') $param.= "&search_town=".urlencode($search_town); - if ($search_zip != '') $param.= "&search_zip=".urlencode($search_zip); - if ($search_state != '') $param.= "&search_state=".urlencode($search_state); - if ($search_country != '') $param.= "&search_country=".urlencode($search_country); - if ($search_customer_code != '') $param.= "&search_customer_code=".urlencode($search_customer_code); - if ($search_supplier_code != '') $param.= "&search_supplier_code=".urlencode($search_supplier_code); - if ($search_account_customer_code != '') $param.= "&search_account_customer_code=".urlencode($search_account_customer_code); - if ($search_account_supplier_code != '') $param.= "&search_account_supplier_code=".urlencode($search_account_supplier_code); - if ($search_barcode != '') $param.= "&sbarcode=".urlencode($search_barcode); - if ($search_idprof1 != '') $param.= '&search_idprof1='.urlencode($search_idprof1); - if ($search_idprof2 != '') $param.= '&search_idprof2='.urlencode($search_idprof2); - if ($search_idprof3 != '') $param.= '&search_idprof3='.urlencode($search_idprof3); - if ($search_idprof4 != '') $param.= '&search_idprof4='.urlencode($search_idprof4); - if ($search_idprof5 != '') $param.= '&search_idprof5='.urlencode($search_idprof5); - if ($search_idprof6 != '') $param.= '&search_idprof6='.urlencode($search_idprof6); - if ($search_country != '') $param.='&search_country='.urlencode($search_country); - if ($search_type_thirdparty != '') $param.='&search_type_thirdparty='.urlencode($search_type_thirdparty); - if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); - if ($search_status != '') $param.='&search_status='.urlencode($search_status); - if ($search_stcomm != '') $param.='&search_stcomm='.$search_stcomm; - if ($search_level_from != '') $param.='&search_level_from='.$search_level_from; - if ($search_level_to != '') $param.='&search_level_to='.$search_level_to; - if ($type != '') $param.='&type='.urlencode($type); - // Add $param from extra fields - foreach ($search_array_options as $key => $val) +$num = $db->num_rows($resql); +$i = 0; +if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE)) +{ + $obj = $db->fetch_object($resql); + $id = $obj->rowid; + header("Location: ".DOL_URL_ROOT.'/societe/soc.php?socid='.$id); + exit; +} + +$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; +llxHeader('',$langs->trans("ThirdParty"),$help_url); + +$param=''; +if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; +if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; +if ($search_all != '') $param = "&sall=".urlencode($search_all); +if ($sall != '') $param .= "&sall=".urlencode($sall); +if ($search_categ > 0) $param.='&search_categ='.urlencode($search_categ); +if ($search_sale > 0) $param.='&search_sale='.urlencode($search_sale); +if ($search_nom != '') $param.= "&search_nom=".urlencode($search_nom); +if ($search_town != '') $param.= "&search_town=".urlencode($search_town); +if ($search_zip != '') $param.= "&search_zip=".urlencode($search_zip); +if ($search_state != '') $param.= "&search_state=".urlencode($search_state); +if ($search_country != '') $param.= "&search_country=".urlencode($search_country); +if ($search_customer_code != '') $param.= "&search_customer_code=".urlencode($search_customer_code); +if ($search_supplier_code != '') $param.= "&search_supplier_code=".urlencode($search_supplier_code); +if ($search_account_customer_code != '') $param.= "&search_account_customer_code=".urlencode($search_account_customer_code); +if ($search_account_supplier_code != '') $param.= "&search_account_supplier_code=".urlencode($search_account_supplier_code); +if ($search_barcode != '') $param.= "&sbarcode=".urlencode($search_barcode); +if ($search_idprof1 != '') $param.= '&search_idprof1='.urlencode($search_idprof1); +if ($search_idprof2 != '') $param.= '&search_idprof2='.urlencode($search_idprof2); +if ($search_idprof3 != '') $param.= '&search_idprof3='.urlencode($search_idprof3); +if ($search_idprof4 != '') $param.= '&search_idprof4='.urlencode($search_idprof4); +if ($search_idprof5 != '') $param.= '&search_idprof5='.urlencode($search_idprof5); +if ($search_idprof6 != '') $param.= '&search_idprof6='.urlencode($search_idprof6); +if ($search_country != '') $param.='&search_country='.urlencode($search_country); +if ($search_type_thirdparty != '') $param.='&search_type_thirdparty='.urlencode($search_type_thirdparty); +if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); +if ($search_status != '') $param.='&search_status='.urlencode($search_status); +if ($search_stcomm != '') $param.='&search_stcomm='.$search_stcomm; +if ($search_level_from != '') $param.='&search_level_from='.$search_level_from; +if ($search_level_to != '') $param.='&search_level_to='.$search_level_to; +if ($type != '') $param.='&type='.urlencode($type); +// 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); +} + +// Show delete result message +if (GETPOST('delsoc')) +{ + setEventMessages($langs->trans("CompanyDeleted",GETPOST('delsoc')), null, 'mesgs'); +} + +print '
'; +if ($optioncss != '') print ''; +print ''; +print ''; +print ''; +print ''; + +print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies', 0, '', '', $limit); + +$langs->load("other"); +$textprofid=array(); +foreach(array(1,2,3,4,5,6) as $key) +{ + $label=$langs->transnoentities("ProfId".$key.$mysoc->country_code); + $textprofid[$key]=''; + if ($label != "ProfId".$key.$mysoc->country_code) + { // Get only text between () + if (preg_match('/\((.*)\)/i',$label,$reg)) $label=$reg[1]; + $textprofid[$key]=$langs->trans("ProfIdShortDesc",$key,$mysoc->country_code,$label); + } +} + +if ($search_all) +{ + foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); + print $langs->trans("FilterOnInto", $search_all) . join(', ',$fieldstosearchall); +} + +// Filter on categories +$moreforfilter=''; +if ($type == 'c' || $type == 'p') +{ + if (! empty($conf->categorie->enabled)) + { + require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; + $moreforfilter.='
'; + $moreforfilter.=$langs->trans('Categories'). ': '; + $moreforfilter.=$formother->select_categories('customer',$search_categ,'search_categ',1); + $moreforfilter.='
'; + } +} +if ($type == 'f') +{ + if (! empty($conf->categorie->enabled)) { - $crit=$val; - $tmpkey=preg_replace('/search_options_/','',$key); - if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val); - } - - // Show delete result message - if (GETPOST('delsoc')) - { - setEventMessages($langs->trans("CompanyDeleted",GETPOST('delsoc')), null, 'mesgs'); + require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; + $moreforfilter.='
'; + $moreforfilter.=$langs->trans('Categories'). ': '; + $moreforfilter.=$formother->select_categories('supplier',$search_categ,'search_categ',1); + $moreforfilter.='
'; } +} - print ''; - if ($optioncss != '') print ''; - print ''; - print ''; - print ''; - print ''; - - print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies', 0, '', '', $limit); - - $langs->load("other"); - $textprofid=array(); - foreach(array(1,2,3,4,5,6) as $key) - { - $label=$langs->transnoentities("ProfId".$key.$mysoc->country_code); - $textprofid[$key]=''; - if ($label != "ProfId".$key.$mysoc->country_code) - { // Get only text between () - if (preg_match('/\((.*)\)/i',$label,$reg)) $label=$reg[1]; - $textprofid[$key]=$langs->trans("ProfIdShortDesc",$key,$mysoc->country_code,$label); - } - } - - if ($search_all) - { - foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); - print $langs->trans("FilterOnInto", $search_all) . join(', ',$fieldstosearchall); - } - - // Filter on categories - $moreforfilter=''; - if ($type == 'c' || $type == 'p') - { - if (! empty($conf->categorie->enabled)) - { - require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; - $moreforfilter.='
'; - $moreforfilter.=$langs->trans('Categories'). ': '; - $moreforfilter.=$formother->select_categories('customer',$search_categ,'search_categ',1); - $moreforfilter.='
'; - } - } - - // If the user can view prospects other than his' - if ($user->rights->societe->client->voir || $socid) - { - $moreforfilter.='
'; - $moreforfilter.=$langs->trans('SalesRepresentatives'). ': '; - $moreforfilter.=$formother->select_salesrepresentatives($search_sale,'search_sale',$user, 0, 1, 'maxwidth300'); - $moreforfilter.='
'; - } - if ($type == 'f') - { - if (! empty($conf->categorie->enabled)) - { - require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; - $moreforfilter.='
'; - $moreforfilter.=$langs->trans('Categories'). ': '; - $moreforfilter.=$formother->select_categories('supplier',$search_categ,'search_categ',1); - $moreforfilter.='
'; - } - } - if (! empty($moreforfilter)) - { - print '
'; - print $moreforfilter; - $parameters=array('type'=>$type); - $reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - print '
'; - } - - $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; - $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields - - print ''; - - print ''; - if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($langs->trans("Company"), $_SERVER["PHP_SELF"],"s.nom","",$param,"",$sortfield,$sortorder); - if (! empty($arrayfields['s.barcode']['checked'])) print_liste_field_titre($langs->trans("Gencod"), $_SERVER["PHP_SELF"], "s.barcode",$param,'','',$sortfield,$sortorder); - if (! empty($arrayfields['s.code_client']['checked'])) print_liste_field_titre($arrayfields['s.code_client']['label'],$_SERVER["PHP_SELF"],"s.code_client","",$param,'',$sortfield,$sortorder); - if (! empty($arrayfields['s.code_fournisseur']['checked'])) print_liste_field_titre($arrayfields['s.code_fournisseur']['label'],$_SERVER["PHP_SELF"],"s.code_fournisseur","",$param,'',$sortfield,$sortorder); - if (! empty($arrayfields['s.code_compta']['checked'])) print_liste_field_titre($arrayfields['s.code_compta']['label'],$_SERVER["PHP_SELF"],"s.code_compta","",$param,'',$sortfield,$sortorder); - if (! empty($arrayfields['s.code_compta_fournisseur']['checked'])) print_liste_field_titre($arrayfields['s.code_compta_fournisseur']['label'],$_SERVER["PHP_SELF"],"s.code_compta_fournisseur","",$param,'',$sortfield,$sortorder); - if (! empty($arrayfields['s.town']['checked'])) print_liste_field_titre($langs->trans("Town"),$_SERVER["PHP_SELF"],"s.town","",$param,'',$sortfield,$sortorder); - if (! empty($arrayfields['s.zip']['checked'])) print_liste_field_titre($langs->trans("Zip"),$_SERVER["PHP_SELF"],"s.zip","",$param,'',$sortfield,$sortorder); - if (! empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($langs->trans("StateShort"),$_SERVER["PHP_SELF"],"state.nom","",$param,'',$sortfield,$sortorder); - if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($langs->trans("Country"),$_SERVER["PHP_SELF"],"country.code_iso","",$param,'align="center"',$sortfield,$sortorder); - if (! empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($langs->trans("ThirdPartyType"),$_SERVER["PHP_SELF"],"typent.code","",$param,'align="center"',$sortfield,$sortorder); - if (! empty($arrayfields['s.siren']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId1Short"),$textprofid[1],1,0),$_SERVER["PHP_SELF"],"s.siren","",$param,'class="nowrap"',$sortfield,$sortorder); - if (! empty($arrayfields['s.siret']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId2Short"),$textprofid[2],1,0),$_SERVER["PHP_SELF"],"s.siret","",$param,'class="nowrap"',$sortfield,$sortorder); - if (! empty($arrayfields['s.ape']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId3Short"),$textprofid[3],1,0),$_SERVER["PHP_SELF"],"s.ape","",$param,'class="nowrap"',$sortfield,$sortorder); - if (! empty($arrayfields['s.idprof4']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId4Short"),$textprofid[4],1,0),$_SERVER["PHP_SELF"],"s.idprof4","",$param,'class="nowrap"',$sortfield,$sortorder); - if (! empty($arrayfields['s.idprof5']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId5Short"),$textprofid[4],1,0),$_SERVER["PHP_SELF"],"s.idprof5","",$param,'class="nowrap"',$sortfield,$sortorder); - if (! empty($arrayfields['s.idprof6']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId6Short"),$textprofid[4],1,0),$_SERVER["PHP_SELF"],"s.idprof6","",$param,'class="nowrap"',$sortfield,$sortorder); - print_liste_field_titre(''); // type of customer - if (! empty($arrayfields['s.fk_prospectlevel']['checked'])) print_liste_field_titre($arrayfields['s.fk_prospectlevel']['label'],$_SERVER["PHP_SELF"],"s.fk_prospectlevel","",$param,'align="center"',$sortfield,$sortorder); - if (! empty($arrayfields['s.fk_stcomm']['checked'])) print_liste_field_titre($arrayfields['s.fk_stcomm']['label'],$_SERVER["PHP_SELF"],"s.fk_stcomm","",$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 +// If the user can view prospects other than his' +if ($user->rights->societe->client->voir || $socid) +{ + $moreforfilter.='
'; + $moreforfilter.=$langs->trans('SalesRepresentatives'). ': '; + $moreforfilter.=$formother->select_salesrepresentatives($search_sale,'search_sale',$user, 0, 1, 'maxwidth300'); + $moreforfilter.='
'; +} +if (! empty($moreforfilter)) +{ + print '
'; + print $moreforfilter; + $parameters=array('type'=>$type); + $reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - if (! empty($arrayfields['s.datec']['checked'])) print_liste_field_titre($langs->trans("DateCreationShort"),$_SERVER["PHP_SELF"],"s.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); - if (! empty($arrayfields['s.tms']['checked'])) print_liste_field_titre($langs->trans("DateModificationShort"),$_SERVER["PHP_SELF"],"s.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); - if (! empty($arrayfields['s.status']['checked'])) print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"s.status","",$param,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch '); - print "
\n"; + print ''; +} - // Fields title search - print ''; - if (! empty($arrayfields['s.nom']['checked'])) - { - print ''; - } +$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; +$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields + +if (empty($arrayfields['customerorsupplier']['checked'])) print ''; + +print '
'; - if (! empty($search_nom_only) && empty($search_nom)) $search_nom=$search_nom_only; - print ''; - print '
'; + +print ''; +if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($langs->trans("Company"), $_SERVER["PHP_SELF"],"s.nom","",$param,"",$sortfield,$sortorder); +if (! empty($arrayfields['s.barcode']['checked'])) print_liste_field_titre($langs->trans("Gencod"), $_SERVER["PHP_SELF"], "s.barcode",$param,'','',$sortfield,$sortorder); +if (! empty($arrayfields['s.code_client']['checked'])) print_liste_field_titre($arrayfields['s.code_client']['label'],$_SERVER["PHP_SELF"],"s.code_client","",$param,'',$sortfield,$sortorder); +if (! empty($arrayfields['s.code_fournisseur']['checked'])) print_liste_field_titre($arrayfields['s.code_fournisseur']['label'],$_SERVER["PHP_SELF"],"s.code_fournisseur","",$param,'',$sortfield,$sortorder); +if (! empty($arrayfields['s.code_compta']['checked'])) print_liste_field_titre($arrayfields['s.code_compta']['label'],$_SERVER["PHP_SELF"],"s.code_compta","",$param,'',$sortfield,$sortorder); +if (! empty($arrayfields['s.code_compta_fournisseur']['checked'])) print_liste_field_titre($arrayfields['s.code_compta_fournisseur']['label'],$_SERVER["PHP_SELF"],"s.code_compta_fournisseur","",$param,'',$sortfield,$sortorder); +if (! empty($arrayfields['s.town']['checked'])) print_liste_field_titre($langs->trans("Town"),$_SERVER["PHP_SELF"],"s.town","",$param,'',$sortfield,$sortorder); +if (! empty($arrayfields['s.zip']['checked'])) print_liste_field_titre($langs->trans("Zip"),$_SERVER["PHP_SELF"],"s.zip","",$param,'',$sortfield,$sortorder); +if (! empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($langs->trans("StateShort"),$_SERVER["PHP_SELF"],"state.nom","",$param,'',$sortfield,$sortorder); +if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($langs->trans("Country"),$_SERVER["PHP_SELF"],"country.code_iso","",$param,'align="center"',$sortfield,$sortorder); +if (! empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($langs->trans("ThirdPartyType"),$_SERVER["PHP_SELF"],"typent.code","",$param,'align="center"',$sortfield,$sortorder); +if (! empty($arrayfields['s.siren']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId1Short"),$textprofid[1],1,0),$_SERVER["PHP_SELF"],"s.siren","",$param,'class="nowrap"',$sortfield,$sortorder); +if (! empty($arrayfields['s.siret']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId2Short"),$textprofid[2],1,0),$_SERVER["PHP_SELF"],"s.siret","",$param,'class="nowrap"',$sortfield,$sortorder); +if (! empty($arrayfields['s.ape']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId3Short"),$textprofid[3],1,0),$_SERVER["PHP_SELF"],"s.ape","",$param,'class="nowrap"',$sortfield,$sortorder); +if (! empty($arrayfields['s.idprof4']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId4Short"),$textprofid[4],1,0),$_SERVER["PHP_SELF"],"s.idprof4","",$param,'class="nowrap"',$sortfield,$sortorder); +if (! empty($arrayfields['s.idprof5']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId5Short"),$textprofid[4],1,0),$_SERVER["PHP_SELF"],"s.idprof5","",$param,'class="nowrap"',$sortfield,$sortorder); +if (! empty($arrayfields['s.idprof6']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId6Short"),$textprofid[4],1,0),$_SERVER["PHP_SELF"],"s.idprof6","",$param,'class="nowrap"',$sortfield,$sortorder); +if (! empty($arrayfields['customerorsupplier']['checked'])) print_liste_field_titre(''); // type of customer +if (! empty($arrayfields['s.fk_prospectlevel']['checked'])) print_liste_field_titre($arrayfields['s.fk_prospectlevel']['label'],$_SERVER["PHP_SELF"],"s.fk_prospectlevel","",$param,'align="center"',$sortfield,$sortorder); +if (! empty($arrayfields['s.fk_stcomm']['checked'])) print_liste_field_titre($arrayfields['s.fk_stcomm']['label'],$_SERVER["PHP_SELF"],"s.fk_stcomm","",$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['s.datec']['checked'])) print_liste_field_titre($langs->trans("DateCreationShort"),$_SERVER["PHP_SELF"],"s.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); +if (! empty($arrayfields['s.tms']['checked'])) print_liste_field_titre($langs->trans("DateModificationShort"),$_SERVER["PHP_SELF"],"s.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); +if (! empty($arrayfields['s.status']['checked'])) print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"s.status","",$param,'align="center"',$sortfield,$sortorder); +print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch '); +print "\n"; + +// Fields title search +print ''; +if (! empty($arrayfields['s.nom']['checked'])) +{ + print ''; +} +// Barcode +if (! empty($arrayfields['s.barcode']['checked'])) +{ + print ''; +} +// Customer code +if (! empty($arrayfields['s.code_client']['checked'])) +{ + print ''; +} +// Supplier code +if (! empty($arrayfields['s.code_fournisseur']['checked'])) +{ + print ''; +} +// Account Customer code +if (! empty($arrayfields['s.code_compta']['checked'])) +{ + print ''; +} +// Account Supplier code +if (! empty($arrayfields['s.code_compta_fournisseur']['checked'])) +{ + print ''; +} +// Town +if (! empty($arrayfields['s.town']['checked'])) +{ + print ''; +} +// Zip +if (! empty($arrayfields['s.zip']['checked'])) +{ + print ''; +} +// State +if (! empty($arrayfields['state.nom']['checked'])) +{ + print ''; +} +// Country +if (! empty($arrayfields['country.code_iso']['checked'])) +{ + print ''; +} +// Company type +if (! empty($arrayfields['typent.code']['checked'])) +{ + print ''; +} +if (! empty($arrayfields['s.siren']['checked'])) +{ + // IdProf1 + print ''; +} +if (! empty($arrayfields['s.siret']['checked'])) +{ + // IdProf2 + print ''; +} +if (! empty($arrayfields['s.ape']['checked'])) +{ + // IdProf3 + print ''; +} +if (! empty($arrayfields['s.idprof4']['checked'])) +{ + // IdProf4 + print ''; +} +if (! empty($arrayfields['s.idprof5']['checked'])) +{ + // IdProf5 + print ''; +} +if (! empty($arrayfields['s.idprof6']['checked'])) +{ + // IdProf6 + print ''; +} + +// Type (customer/prospect/supplier) +if (! empty($arrayfields['customerorsupplier']['checked'])) +{ + print ''; +} +if (! empty($arrayfields['s.fk_prospectlevel']['checked'])) +{ + // Prospect level + print ''; +} + +if (! empty($arrayfields['s.fk_stcomm']['checked'])) +{ + // Prospect status + print ''; +} +// 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 ''; + } + } +} +// 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['s.datec']['checked'])) +{ + print ''; +} +// Date modification +if (! empty($arrayfields['s.tms']['checked'])) +{ + print ''; +} +// Status +if (! empty($arrayfields['s.status']['checked'])) +{ + print ''; +} +// Action column +print ''; + +print "\n"; + +$var=True; + +while ($i < min($num, $limit)) +{ + $obj = $db->fetch_object($resql); + $var=!$var; + + $companystatic->id=$obj->rowid; + $companystatic->name=$obj->name; + $companystatic->canvas=$obj->canvas; + $companystatic->client=$obj->client; + $companystatic->status=$obj->status; + $companystatic->fournisseur=$obj->fournisseur; + $companystatic->code_client=$obj->code_client; + $companystatic->code_fournisseur=$obj->code_fournisseur; + $companystatic->fk_prospectlevel=$obj->fk_prospectlevel; + $companystatic->name_alias=$obj->name_alias; + + print ""; + if (! empty($arrayfields['s.nom']['checked'])) + { + print "\n"; + } // Barcode if (! empty($arrayfields['s.barcode']['checked'])) - { - print ''; - } + { + print ''; + } // Customer code if (! empty($arrayfields['s.code_client']['checked'])) - { - print ''; - } - // Supplier code + { + print ''; + } + // Supplier code if (! empty($arrayfields['s.code_fournisseur']['checked'])) - { - print ''; - } - // Account Customer code + { + print ''; + } + // Account customer code if (! empty($arrayfields['s.code_compta']['checked'])) - { - print ''; - } - // Account Supplier code + { + print ''; + } + // Account supplier code if (! empty($arrayfields['s.code_compta_fournisseur']['checked'])) - { - print ''; - } - // Town + { + print ''; + } + // Town if (! empty($arrayfields['s.town']['checked'])) { - print ''; + print "\n"; } - // Zip + // Zip if (! empty($arrayfields['s.zip']['checked'])) { - print ''; - } - // State + print "\n"; + } + // State if (! empty($arrayfields['state.nom']['checked'])) { - print ''; - } + print "\n"; + } // Country if (! empty($arrayfields['country.code_iso']['checked'])) { - print ''; + print ''; } - // Company type + // Type ent if (! empty($arrayfields['typent.code']['checked'])) { - print ''; + print ''; + } + if (! empty($arrayfields['s.siren']['checked'])) + { + print "\n"; } - if (! empty($arrayfields['s.siren']['checked'])) - { - // IdProf1 - print ''; - } if (! empty($arrayfields['s.siret']['checked'])) { - // IdProf2 - print ''; + print "\n"; } if (! empty($arrayfields['s.ape']['checked'])) { - // IdProf3 - print ''; + print "\n"; } if (! empty($arrayfields['s.idprof4']['checked'])) { - // IdProf4 - print ''; + print "\n"; } if (! empty($arrayfields['s.idprof5']['checked'])) { - // IdProf5 - print ''; + print "\n"; } if (! empty($arrayfields['s.idprof6']['checked'])) { - // IdProf6 - print '\n"; + } + // Type + if (! empty($arrayfields['customerorsupplier']['checked'])) + { + print ''; } - - // Type (customer/prospect/supplier) - print ''; - + if (! empty($arrayfields['s.fk_prospectlevel']['checked'])) { - // Prospect level - print ''; + // Prospect level + print '"; } - + if (! empty($arrayfields['s.fk_stcomm']['checked'])) { - // Prospect status - print ''; + print ''; } // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { - foreach($extrafields->attribute_label as $key => $val) + foreach($extrafields->attribute_label as $key => $val) { - if (! empty($arrayfields["ef.".$key]['checked'])) + if (! empty($arrayfields["ef.".$key]['checked'])) { - $align=$extrafields->getAlignFlag($key); - $typeofextrafield=$extrafields->attribute_type[$key]; - print ''; } } } // Fields from hook - $parameters=array('arrayfields'=>$arrayfields); - $reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by 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['s.datec']['checked'])) { - print ''; } // Date modification if (! empty($arrayfields['s.tms']['checked'])) { - print ''; } // Status if (! empty($arrayfields['s.status']['checked'])) { - print ''; + print ''; } // Action column - print ''; - - print "\n"; - - $var=True; - - while ($i < min($num, $limit)) - { - $obj = $db->fetch_object($resql); - $var=!$var; - - $companystatic->id=$obj->rowid; - $companystatic->name=$obj->name; - $companystatic->canvas=$obj->canvas; - $companystatic->client=$obj->client; - $companystatic->status=$obj->status; - $companystatic->fournisseur=$obj->fournisseur; - $companystatic->code_client=$obj->code_client; - $companystatic->code_fournisseur=$obj->code_fournisseur; - $companystatic->fk_prospectlevel=$obj->fk_prospectlevel; - $companystatic->name_alias=$obj->name_alias; - - print ""; - if (! empty($arrayfields['s.nom']['checked'])) - { - print "\n"; - } - // Barcode - if (! empty($arrayfields['s.barcode']['checked'])) - { - print ''; - } - // Customer code - if (! empty($arrayfields['s.code_client']['checked'])) - { - print ''; - } - // Supplier code - if (! empty($arrayfields['s.code_fournisseur']['checked'])) - { - print ''; - } - // Account customer code - if (! empty($arrayfields['s.code_compta']['checked'])) - { - print ''; - } - // Account supplier code - if (! empty($arrayfields['s.code_compta_fournisseur']['checked'])) - { - print ''; - } - // Town - if (! empty($arrayfields['s.town']['checked'])) - { - print "\n"; - } - // Zip - if (! empty($arrayfields['s.zip']['checked'])) - { - print "\n"; - } - // State - if (! empty($arrayfields['state.nom']['checked'])) - { - print "\n"; - } - // Country - if (! empty($arrayfields['country.code_iso']['checked'])) - { - print ''; - } - // Type ent - if (! empty($arrayfields['typent.code']['checked'])) - { - print ''; - } - if (! empty($arrayfields['s.siren']['checked'])) - { - print "\n"; - } - if (! empty($arrayfields['s.siret']['checked'])) - { - print "\n"; - } - if (! empty($arrayfields['s.ape']['checked'])) - { - print "\n"; - } - if (! empty($arrayfields['s.idprof4']['checked'])) - { - print "\n"; - } - if (! empty($arrayfields['s.idprof5']['checked'])) - { - print "\n"; - } - if (! empty($arrayfields['s.idprof6']['checked'])) - { - print "\n"; - } - // Type - print ''; - if (! empty($arrayfields['s.fk_prospectlevel']['checked'])) - { - // Prospect level - print '"; - } - if (! empty($arrayfields['s.fk_stcomm']['checked'])) - { - // Prospect status - print ''; - } - // 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 'getAlignFlag($key); - if ($align) print ' align="'.$align.'"'; - print '>'; - $tmpkey='options_'.$key; - print $extrafields->showOutputField($key, $obj->$tmpkey, '', 1); - print ''; - } - } - } - // 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['s.datec']['checked'])) - { - print ''; - } - // Date modification - if (! empty($arrayfields['s.tms']['checked'])) - { - print ''; - } - // Status - if (! empty($arrayfields['s.status']['checked'])) - { - print ''; - } - // Action column - print ''; - - print ''."\n"; - $i++; - } - - $db->free($resql); - - $parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql); - $reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - - print "
'; + if (! empty($search_nom_only) && empty($search_nom)) $search_nom=$search_nom_only; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print $form->select_country($search_country,'search_country','',0,'maxwidth100'); + print ''; + 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 ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + if ($type != '') print ''; + print ''; + $options_from = ''; // Generate in $options_from the list of each option sorted + foreach ($tab_level as $tab_level_sortorder => $tab_level_label) + { + $options_from .= ''; + } + array_reverse($tab_level, true); // Reverse the list + $options_to = ''; // Generate in $options_to the list of each option sorted in the reversed order + foreach ($tab_level as $tab_level_sortorder => $tab_level_label) + { + $options_to .= ''; + } + + // Print these two select + print $langs->trans("From").' '; + print ' '; + print $langs->trans("to").' '; + + print ''; + $arraystcomm=array(); + foreach($prospectstatic->cacheprospectstatus as $key => $val) + { + $arraystcomm[$val['id']]=($langs->trans("StatusProspect".$val['id']) != "StatusProspect".$val['id'] ? $langs->trans("StatusProspect".$val['id']) : $val['label']); + } + print $form->selectarray('search_stcomm', $arraystcomm, $search_stcomm, -2); + print ''; + 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 ''; + } + print ''; + print ''; + print ''; + print $form->selectarray('search_status', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')),$search_status); + print ''; +$searchpitco=$form->showFilterAndCheckAddButtons(0); +print $searchpitco; +print '
"; + print $companystatic->getNomUrl(1,'',100); + print "'; - print ''; - print ''.$obj->barcode.''; - print ''; - print ''.$obj->code_client.''; - print ''; - print ''.$obj->code_fournisseur.''; - print ''; - print ''.$obj->code_compta.''; - print ''; - print ''.$obj->code_compta_fournisseur.''; - print ''; - print '".$obj->town."'; - print ''; - print '".$obj->zip."'; - print ''; - print '".$obj->state_name."'; - print $form->select_country($search_country,'search_country','',0,'maxwidth100'); - print ''; + $tmparray=getCountry($obj->fk_pays,'all'); + print $tmparray['label']; + print ''; - 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 ''; + if (count($typenArray)==0) $typenArray = $formcompany->typent_array(1); + print $typenArray[$obj->typent_code]; + print '".$obj->idprof1."'; - print ''; - print ''; - print ''; - print '".$obj->idprof2."'; - print ''; - print '".$obj->idprof3."'; - print ''; - print '".$obj->idprof4."'; - print ''; - print '".$obj->idprof5."'; - print ''; + print "".$obj->idprof6."'; + $s=''; + if (($obj->client==1 || $obj->client==3) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) + { + $companystatic->name=$langs->trans("Customer"); + $companystatic->name_alias=''; + $s.=$companystatic->getNomUrl(0,'customer'); + } + if (($obj->client==2 || $obj->client==3) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) + { + if ($s) $s.=" / "; + $companystatic->name=$langs->trans("Prospect"); + $companystatic->name_alias=''; + $s.=$companystatic->getNomUrl(0,'prospect'); + } + if (! empty($conf->fournisseur->enabled) && $obj->fournisseur) + { + if ($s) $s.=" / "; + $companystatic->name=$langs->trans("Supplier"); + $companystatic->name_alias=''; + $s.=$companystatic->getNomUrl(0,'supplier'); + } + print $s; print ''; - if ($type != '') print ''; - print ''; - $options_from = ''; // Generate in $options_from the list of each option sorted - foreach ($tab_level as $tab_level_sortorder => $tab_level_label) - { - $options_from .= ''; - } - array_reverse($tab_level, true); // Reverse the list - $options_to = ''; // Generate in $options_to the list of each option sorted in the reversed order - foreach ($tab_level as $tab_level_sortorder => $tab_level_label) - { - $options_to .= ''; - } - - // Print these two select - print $langs->trans("From").' '; - print ' '; - print $langs->trans("to").' '; - - print ''; + print $companystatic->getLibProspLevel(); + print "'; - $arraystcomm=array(); + // Prospect status + print '
'; + print '
'.$companystatic->LibProspCommStatut($obj->stcomm_id,2,$prospectstatic->cacheprospectstatus[$obj->stcomm_id]['label']); + print '
-
'; foreach($prospectstatic->cacheprospectstatus as $key => $val) { - $arraystcomm[$val['id']]=($langs->trans("StatusProspect".$val['id']) != "StatusProspect".$val['id'] ? $langs->trans("StatusProspect".$val['id']) : $val['label']); + $titlealt='default'; + if (! empty($val['code']) && ! in_array($val['code'], array('ST_NO', 'ST_NEVER', 'ST_TODO', 'ST_PEND', 'ST_DONE'))) $titlealt=$val['label']; + if ($obj->stcomm_id != $val['id']) print ''.img_action($titlealt,$val['code']).''; } - print $form->selectarray('search_stcomm', $arraystcomm, $search_stcomm, -2); - print '
'; - 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 ''; - } + print 'getAlignFlag($key); + if ($align) print ' align="'.$align.'"'; + print '>'; + $tmpkey='options_'.$key; + print $extrafields->showOutputField($key, $obj->$tmpkey, '', 1); print ''; + print ''; + print dol_print_date($db->jdate($obj->date_creation), 'dayhour'); print ''; + print ''; + print dol_print_date($db->jdate($obj->date_update), 'dayhour'); print ''; - print $form->selectarray('search_status', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')),$search_status); - print ''.$companystatic->getLibStatut(3).''; - $searchpitco=$form->showFilterAndCheckAddButtons(0); - print $searchpitco; - print '
"; - print $companystatic->getNomUrl(1,'',100); - print "'.$obj->barcode.''.$obj->code_client.''.$obj->code_fournisseur.''.$obj->code_compta.''.$obj->code_compta_fournisseur.'".$obj->town."".$obj->zip."".$obj->state_name."'; - $tmparray=getCountry($obj->fk_pays,'all'); - print $tmparray['label']; - print ''; - if (count($typenArray)==0) $typenArray = $formcompany->typent_array(1); - print $typenArray[$obj->typent_code]; - print '".$obj->idprof1."".$obj->idprof2."".$obj->idprof3."".$obj->idprof4."".$obj->idprof5."".$obj->idprof6."'; - $s=''; - if (($obj->client==1 || $obj->client==3) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) - { - $companystatic->name=$langs->trans("Customer"); - $companystatic->name_alias=''; - $s.=$companystatic->getNomUrl(0,'customer'); - } - if (($obj->client==2 || $obj->client==3) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) - { - if ($s) $s.=" / "; - $companystatic->name=$langs->trans("Prospect"); - $companystatic->name_alias=''; - $s.=$companystatic->getNomUrl(0,'prospect'); - } - if (! empty($conf->fournisseur->enabled) && $obj->fournisseur) - { - if ($s) $s.=" / "; - $companystatic->name=$langs->trans("Supplier"); - $companystatic->name_alias=''; - $s.=$companystatic->getNomUrl(0,'supplier'); - } - print $s; - print ''; - print $companystatic->getLibProspLevel(); - print "
'; - print '
'.$companystatic->LibProspCommStatut($obj->stcomm_id,2,$prospectstatic->cacheprospectstatus[$obj->stcomm_id]['label']); - print '
-
'; - foreach($prospectstatic->cacheprospectstatus as $key => $val) - { - $titlealt='default'; - if (! empty($val['code']) && ! in_array($val['code'], array('ST_NO', 'ST_NEVER', 'ST_TODO', 'ST_PEND', 'ST_DONE'))) $titlealt=$val['label']; - if ($obj->stcomm_id != $val['id']) print ''.img_action($titlealt,$val['code']).''; - } - print '
'; - print dol_print_date($db->jdate($obj->date_creation), 'dayhour'); - print ''; - print dol_print_date($db->jdate($obj->date_update), 'dayhour'); - print ''.$companystatic->getLibStatut(3).'
"; - - print '
'; + print ''; + print ''."\n"; + $i++; } -else -{ - dol_print_error($db); -} + +$db->free($resql); + +$parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql); +$reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook +print $hookmanager->resPrint; + +print ""; + +print ''; llxFooter(); - $db->close(); diff --git a/htdocs/societe/note.php b/htdocs/societe/note.php index 156a4620634..e88f94e4287 100644 --- a/htdocs/societe/note.php +++ b/htdocs/societe/note.php @@ -57,8 +57,10 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, $form = new Form($db); +$title=$langs->trans("ThirdParty").' - '.$langs->trans("Notes"); +if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name.' - '.$langs->trans("Files"); $help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; -llxHeader('',$langs->trans("ThirdParty").' - '.$langs->trans("Notes"),$help_url); +llxHeader('',$title,$help_url); if ($id > 0) { @@ -71,12 +73,14 @@ if ($id > 0) dol_fiche_head($head, 'note', $langs->trans("ThirdParty"),0,'company'); + $linkback = ''.$langs->trans("BackToList").''; + + dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom'); - print '
'; - print ''; - - dol_banner_tab($object, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom'); - + $cssclass='titlefield'; + //if ($action == 'editnote_public') $cssclass='titlefieldcreate'; + //if ($action == 'editnote_private') $cssclass='titlefieldcreate'; + print '
'; print '
'; @@ -84,12 +88,12 @@ if ($id > 0) if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field { - print ''.$langs->trans('Prefix').''.$object->prefix_comm.''; + print ''.$langs->trans('Prefix').''.$object->prefix_comm.''; } if ($object->client) { - print ''; + print ''; print $langs->trans('CustomerCode').''; print $object->code_client; if ($object->check_codeclient() <> 0) print ' ('.$langs->trans("WrongCustomerCode").')'; @@ -98,7 +102,7 @@ if ($id > 0) if ($object->fournisseur) { - print ''; + print ''; print $langs->trans('SupplierCode').''; print $object->code_fournisseur; if ($object->check_codefournisseur() <> 0) print ' ('.$langs->trans("WrongSupplierCode").')'; @@ -109,13 +113,11 @@ if ($id > 0) print '
'; - print '
'; + //print '
'; - //$colwidth='25'; - $cssclass='titlefield'; + //print '
'; include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; - dol_fiche_end(); } diff --git a/htdocs/societe/notify/card.php b/htdocs/societe/notify/card.php index 9e412f1a7f0..bc754d8e9a4 100644 --- a/htdocs/societe/notify/card.php +++ b/htdocs/societe/notify/card.php @@ -51,8 +51,8 @@ if ($page == -1) { $page = 0; } $offset = $conf->liste_limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; -if (! $sortorder) $sortorder="ASC"; -if (! $sortfield) $sortfield="c.lastname"; +if (! $sortorder) $sortorder="DESC"; +if (! $sortfield) $sortfield="n.daten"; $now=dol_now(); @@ -125,7 +125,7 @@ if (empty($reshook)) // Remove a notification if ($action == 'delete') { - $sql = "DELETE FROM ".MAIN_DB_PREFIX."notify_def where rowid=".$_GET["actid"]; + $sql = "DELETE FROM ".MAIN_DB_PREFIX."notify_def where rowid=".GETPOST('actid', 'int'); $db->query($sql); } } @@ -155,7 +155,9 @@ if ($result > 0) dol_fiche_head($head, 'notify', $langs->trans("ThirdParty"),0,'company'); - dol_banner_tab($object, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom'); + $linkback = ''.$langs->trans("BackToList").''; + + dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom'); print '
'; @@ -165,12 +167,12 @@ if ($result > 0) // Prefix if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field { - print ''.$langs->trans('Prefix').''.$object->prefix_comm.''; + print ''.$langs->trans('Prefix').''.$object->prefix_comm.''; } if ($object->client) { - print ''; + print ''; print $langs->trans('CustomerCode').''; print $object->code_client; if ($object->check_codeclient() <> 0) print ' ('.$langs->trans("WrongCustomerCode").')'; @@ -179,14 +181,14 @@ if ($result > 0) if ($object->fournisseur) { - print ''; + print ''; print $langs->trans('SupplierCode').''; print $object->code_fournisseur; if ($object->check_codefournisseur() <> 0) print ' ('.$langs->trans("WrongSupplierCode").')'; print ''; } - print ''.$langs->trans("NbOfActiveNotifications").''; + print ''.$langs->trans("NbOfActiveNotifications").''; print ''; $notify=new Notify($db); $tmparray = $notify->getNotificationsArray('', $object->id); @@ -194,16 +196,20 @@ if ($result > 0) print ''; print ''; - // Help - print '
'.$langs->trans("NotificationsDesc"); - print '
'; dol_fiche_end(); print "\n"; - print '
'; + // Help + print '
'.$langs->trans("NotificationsDesc"); + print '
'.$langs->trans("NotificationsDescUser"); + print '
'.$langs->trans("NotificationsDescContact"); + print '
'.$langs->trans("NotificationsDescGlobal"); + + print '


'."\n"; + // Add notification form print load_fiche_titre($langs->trans("AddNewNotification"),'',''); @@ -217,9 +223,9 @@ if ($result > 0) // Line with titles print ''; print ''; - print_liste_field_titre($langs->trans("Target"),$_SERVER["PHP_SELF"],"c.lastname",'',$param,'"width="45%"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Action"),$_SERVER["PHP_SELF"],"a.titre",'',$param,'"width="35%"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"",'',$param,'"width="10%"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Target"),$_SERVER["PHP_SELF"],"c.lastname,c.firstname",'',$param,'"width="45%"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Action"),$_SERVER["PHP_SELF"],"",'',$param,'"width="35%"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"n.type",'',$param,'"width="10%"',$sortfield,$sortorder); print_liste_field_titre(''); print "\n"; @@ -238,11 +244,11 @@ if ($result > 0) $label=($langs->trans("Notify_".$managedeventfornotification['code'])!="Notify_".$managedeventfornotification['code']?$langs->trans("Notify_".$managedeventfornotification['code']):$managedeventfornotification['label']); $actions[$managedeventfornotification['rowid']]=$label; } - print ''; - print ''; print ''; - print ''; + print print_liste_field_titre($langs->trans("RUM")); + print print_liste_field_titre($langs->trans("WithdrawMode")); } print_liste_field_titre($langs->trans("DefaultRIB"), '', '', '', '', 'align="center"'); + print_liste_field_titre('', '', '', '', '', 'align="center"'); print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch '); print "\n"; @@ -354,16 +462,53 @@ if ($socid && $action != 'edit' && $action != "create") // Bank name print ''; // Account number - print ''; + print ''; // IBAN - print ''; + print ''; // BIC - print ''; + print ''; if (! empty($conf->prelevement->enabled)) { // RUM - print ''; + //print ''; + print ''; // FRSTRECUR print ''; @@ -379,7 +524,60 @@ if ($socid && $action != 'edit' && $action != "create") print img_picto($langs->trans("Enabled"),'on'); } print ''; - + + // Generate doc + print ''; + // Edit/Delete print ''; + print ''; } if (count($rib_list) == 0) { - $colspan=7; + $colspan=8; if (! empty($conf->prelevement->enabled)) $colspan+=2; print ''; } @@ -410,6 +609,68 @@ if ($socid && $action != 'edit' && $action != "create") dol_print_error($db); } + + if ($socid && $action != 'edit' && $action != 'create') + { + /* + * Barre d'actions + */ + print '
'; + + if ($user->rights->societe->creer) + { + print ''.$langs->trans("Add").''; + } + + print '
'; + } + + + + + if (empty($conf->global->SOCIETE_DISABLE_BUILDDOC)) + { + print '
'; + print ''; // ancre + + /* + * Documents generes + */ + $filedir=$conf->societe->multidir_output[$object->entity].'/'.$object->id; + $urlsource=$_SERVER["PHP_SELF"]."?socid=".$object->id; + $genallowed=$user->rights->societe->creer; + $delallowed=$user->rights->societe->supprimer; + + $var=true; + + print $formfile->showdocuments('company', $object->id, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 0, 0, 0, 28, 0, '', 0, '', $object->default_lang); + + print '
'; + + + print '
'; + + print '
'; + } + /* + include_once DOL_DOCUMENT_ROOT.'/core/modules/bank/modules_bank.php'; + $modellist=ModeleBankAccountDoc::liste_modeles($db); + //print 'global->SOCIETE_USEPREFIX)?' colspan="3"':'').'>'; - print ''; + print ''; if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field { print ''; @@ -988,7 +1003,7 @@ else // Alias names (commercial, trademark or alias names) print ''; - print ''; + print ''; // Prospect/Customer print ''; @@ -1002,11 +1017,11 @@ else print ''; print ''; - print '
'; - print $form->selectarray("contactid",$listofemails); + print '
'; + print $form->selectarray("contactid", $listofemails, '', 0, 0, 0, '', 0, 0, 0, '', 'maxwidthonsmartphone'); print ''; - print $form->selectarray("actionid",$actions,'',1); + print ''; + print $form->selectarray("actionid", $actions, '', 1, 0, 0, '', 0, 0, 0, '', 'maxwidthonsmartphone'); print ''; $type=array('email'=>$langs->trans("EMail")); @@ -264,22 +270,7 @@ if ($result > 0) print ''; print '
'; - // List of active notifications - print load_fiche_titre($langs->trans("ListOfActiveNotifications"),'',''); - $var=true; - - // Line with titles - print ''; - print ''; - print_liste_field_titre($langs->trans("Target"),$_SERVER["PHP_SELF"],"c.lastname",'',$param,'"width="45%"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Action"),$_SERVER["PHP_SELF"],"a.titre",'',$param,'"width="35%"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"",'',$param,'"width="10%"',$sortfield,$sortorder); - print_liste_field_titre('','',''); - print ''; - - $langs->load("errors"); - $langs->load("other"); - + // List of notifications enabled for contacts $sql = "SELECT n.rowid, n.type,"; $sql.= " a.code, a.label,"; @@ -290,11 +281,35 @@ if ($result > 0) $sql.= " WHERE a.rowid = n.fk_action"; $sql.= " AND c.rowid = n.fk_contact"; $sql.= " AND c.fk_soc = ".$object->id; - + $resql=$db->query($sql); if ($resql) { $num = $db->num_rows($resql); + } + else + { + dol_print_error($db); + } + + // List of active notifications + print load_fiche_titre($langs->trans("ListOfActiveNotifications").' ('.$num.')','',''); + $var=true; + + // Line with titles + print '
'; + print ''; + print_liste_field_titre($langs->trans("Target"),$_SERVER["PHP_SELF"],"c.lastname,c.firstname",'',$param,'"width="45%"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Action"),$_SERVER["PHP_SELF"],"",'',$param,'"width="35%"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"n.type",'',$param,'"width="10%"',$sortfield,$sortorder); + print_liste_field_titre('','',''); + print ''; + + $langs->load("errors"); + $langs->load("other"); + + if ($num) + { $i = 0; $contactstatic=new Contact($db); @@ -336,10 +351,6 @@ if ($result > 0) } $db->free($resql); } - else - { - dol_print_error($db); - } // List of notifications enabled for fixed email /* @@ -392,23 +403,11 @@ if ($result > 0) } print '
'; - print '
'; + + + print '

'."\n"; - // List of notifications done - print load_fiche_titre($langs->trans("ListOfNotificationsDone"),'',''); - $var=true; - - // Line with titles - print ''; - print ''; - print_liste_field_titre($langs->trans("Target"),$_SERVER["PHP_SELF"],"c.lastname",'',$param,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Action"),$_SERVER["PHP_SELF"],"a.titre",'',$param,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"",'',$param,'',$sortfield,$sortorder); - //print_liste_field_titre($langs->trans("Object"),$_SERVER["PHP_SELF"],"",'',$param,'"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"a.daten",'',$param,'align="right"',$sortfield,$sortorder); - print ''; - // List $sql = "SELECT n.rowid, n.daten, n.email, n.objet_type as object_type, n.objet_id as object_id, n.type,"; $sql.= " c.rowid as id, c.lastname, c.firstname, c.email as contactemail,"; @@ -418,11 +417,34 @@ if ($result > 0) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as c ON n.fk_contact = c.rowid"; $sql.= " WHERE a.rowid = n.fk_action"; $sql.= " AND n.fk_soc = ".$object->id; + $sql.= $db->order($sortfield, $sortorder); $resql=$db->query($sql); if ($resql) { $num = $db->num_rows($resql); + } + else + { + dol_print_error($db); + } + + // List of notifications done + print load_fiche_titre($langs->trans("ListOfNotificationsDone").' ('.$num.')','',''); + $var=true; + + // Line with titles + print '
'; + print ''; + print_liste_field_titre($langs->trans("Target"),$_SERVER["PHP_SELF"],"c.lastname,c.firstname",'',$param,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Action"),$_SERVER["PHP_SELF"],"",'',$param,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"n.type",'',$param,'',$sortfield,$sortorder); + //print_liste_field_titre($langs->trans("Object"),$_SERVER["PHP_SELF"],"",'',$param,'"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"n.daten",'',$param,'align="right"',$sortfield,$sortorder); + print ''; + + if ($num > 0) + { $i = 0; $contactstatic=new Contact($db); @@ -471,10 +493,6 @@ if ($result > 0) } $db->free($resql); } - else - { - dol_print_error($db); - } print '
'; } diff --git a/htdocs/societe/price.php b/htdocs/societe/price.php index 4c988603417..9236fc35f6f 100644 --- a/htdocs/societe/price.php +++ b/htdocs/societe/price.php @@ -151,7 +151,9 @@ $head = societe_prepare_head($object); dol_fiche_head($head, 'price', $langs->trans("ThirdParty"), 0, 'company'); -dol_banner_tab($object, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom'); +$linkback = ''.$langs->trans("BackToList").''; + +dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom'); print '
'; diff --git a/htdocs/societe/project.php b/htdocs/societe/project.php index eb3963d0f7a..fe206dd4cc5 100644 --- a/htdocs/societe/project.php +++ b/htdocs/societe/project.php @@ -32,6 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; $langs->load("companies"); +$langs->load("projects"); // Security check $socid = GETPOST('socid','int'); @@ -71,7 +72,7 @@ if ($socid) $object = new Societe($db); $result = $object->fetch($socid); - $title=$langs->trans("Agenda"); + $title=$langs->trans("Projects"); if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name." - ".$title; llxHeader('',$title); @@ -80,7 +81,9 @@ if ($socid) dol_fiche_head($head, 'project', $langs->trans("ThirdParty"),0,'company'); - dol_banner_tab($object, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom'); + $linkback = ''.$langs->trans("BackToList").''; + + dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom'); print '
'; @@ -94,7 +97,7 @@ if ($socid) if ($object->client) { - print '
'; + print '
'; print $langs->trans('CustomerCode').''; print $object->code_client; if ($object->check_codeclient() <> 0) print ' ('.$langs->trans("WrongCustomerCode").')'; @@ -103,7 +106,7 @@ if ($socid) if ($object->fournisseur) { - print '
'; + print '
'; print $langs->trans('SupplierCode').''; print $object->code_fournisseur; if ($object->check_codefournisseur() <> 0) print ' ('.$langs->trans("WrongSupplierCode").')'; diff --git a/htdocs/societe/rib.php b/htdocs/societe/rib.php index 0d8cdcc1264..1d8e9348f72 100644 --- a/htdocs/societe/rib.php +++ b/htdocs/societe/rib.php @@ -1,7 +1,7 @@ * Copyright (C) 2003 Jean-Louis Bergamo - * Copyright (C) 2004-2015 Laurent Destailleur + * Copyright (C) 2004-2016 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2013 Peter Fontaine * Copyright (C) 2015-2016 Marcos García @@ -29,6 +29,7 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php'; @@ -38,158 +39,269 @@ $langs->load("banks"); $langs->load("bills"); // Security check -$socid = GETPOST("socid"); +$socid = GETPOST("socid","int"); if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'societe','',''); +$id=GETPOST("id","int"); +$ribid=GETPOST("ribid","int"); +$action=GETPOST("action", 'alpha', 3); + $object = new Societe($db); $object->fetch($socid); -$id=GETPOST("id","int"); -$ribid=GETPOST("ribid","int"); -$action=GETPOST("action"); +$account = new CompanyBankAccount($db); +$prelevement = new BonPrelevement($db); + +$extrafields = new ExtraFields($db); + +// fetch optionals attributes and labels +$extralabels=$extrafields->fetch_name_optionals_label($object->table_element); + +// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +$hookmanager->initHooks(array('thirdpartybancard','globalcard')); + /* * Actions */ -if ($action == 'update' && ! $_POST["cancel"]) +$parameters=array('id'=>$socid, 'objcanvas'=>$objcanvas); +$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + +if (empty($reshook)) { - // Modification - $account = new CompanyBankAccount($db); - - $account->fetch($id); - - $account->socid = $object->id; - - $account->bank = $_POST["bank"]; - $account->label = $_POST["label"]; - $account->courant = $_POST["courant"]; - $account->clos = $_POST["clos"]; - $account->code_banque = $_POST["code_banque"]; - $account->code_guichet = $_POST["code_guichet"]; - $account->number = $_POST["number"]; - $account->cle_rib = $_POST["cle_rib"]; - $account->bic = $_POST["bic"]; - $account->iban = $_POST["iban"]; - $account->domiciliation = $_POST["domiciliation"]; - $account->proprio = $_POST["proprio"]; - $account->owner_address = $_POST["owner_address"]; - $account->frstrecur = GETPOST('frstrecur'); - - $result = $account->update($user); - if (! $result) - { - setEventMessages($account->error, $account->errors, 'errors'); - $_GET["action"]='edit'; // Force chargement page edition - } - else - { - // If this account is the default bank account, we disable others - if ($account->default_rib) - { - $account->setAsDefault($id); // This will make sure there is only one default rib - } - - $url=DOL_URL_ROOT.'/societe/rib.php?socid='.$object->id; - header('Location: '.$url); - exit; - } -} - -if ($action == 'add' && ! $_POST["cancel"]) -{ - $error=0; - - if (! GETPOST('label')) - { - setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label")), null, 'errors'); - $action='create'; - $error++; - } - if (! GETPOST('bank')) - { - setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BankName")), null, 'errors'); - $action='create'; - $error++; - } - - if (! $error) - { - // Ajout - $account = new CompanyBankAccount($db); - - $account->socid = $object->id; - - $account->bank = $_POST["bank"]; - $account->label = $_POST["label"]; - $account->courant = $_POST["courant"]; - $account->clos = $_POST["clos"]; - $account->code_banque = $_POST["code_banque"]; - $account->code_guichet = $_POST["code_guichet"]; - $account->number = $_POST["number"]; - $account->cle_rib = $_POST["cle_rib"]; - $account->bic = $_POST["bic"]; - $account->iban = $_POST["iban"]; - $account->domiciliation = $_POST["domiciliation"]; - $account->proprio = $_POST["proprio"]; - $account->owner_address = $_POST["owner_address"]; - $account->frstrecur = GETPOST('frstrecur'); - - $result = $account->update($user); // TODO Use create and include update into create method - if (! $result) - { - setEventMessages($account->error, $account->errors, 'errors'); - $_GET["action"]='create'; // Force chargement page création - } - else - { - $url=DOL_URL_ROOT.'/societe/rib.php?socid='.$object->id; - header('Location: '.$url); - exit; - } - } -} - -if ($action == 'setasdefault') -{ - $account = new CompanyBankAccount($db); - $res = $account->setAsDefault(GETPOST('ribid','int')); - if ($res) + if ($cancel) { - $url=DOL_URL_ROOT.'/societe/rib.php?socid='.$object->id; - header('Location: '.$url); - exit; - } - else - { - setEventMessages($db->lasterror, null, 'errors'); + $action=''; + if (! empty($backtopage)) + { + header("Location: ".$backtopage); + exit; + } } + + + if ($action == 'update' && ! $_POST["cancel"]) + { + // Modification + if (! GETPOST('label')) + { + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label")), null, 'errors'); + $action='update'; + $error++; + } + if (! GETPOST('bank')) + { + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BankName")), null, 'errors'); + $action='update'; + $error++; + } + if ($account->needIBAN() == 1) + { + if (! GETPOST('iban')) + { + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("IBAN")), null, 'errors'); + $action='update'; + $error++; + } + if (! GETPOST('bic')) + { + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BIC")), null, 'errors'); + $action='update'; + $error++; + } + } + + $account->fetch($id); + if (! $error) + { + $account->socid = $object->id; + + $account->bank = GETPOST('bank','alpha'); + $account->label = GETPOST('label','alpha'); + $account->courant = GETPOST('courant','alpha'); + $account->clos = GETPOST('clos','alpha'); + $account->code_banque = GETPOST('code_banque','alpha'); + $account->code_guichet = GETPOST('code_guichet','alpha'); + $account->number = GETPOST('number','alpha'); + $account->cle_rib = GETPOST('cle_rib','alpha'); + $account->bic = GETPOST('bic','alpha'); + $account->iban = GETPOST('iban','alpha'); + $account->domiciliation = GETPOST('domiciliation','alpha'); + $account->proprio = GETPOST('proprio','alpha'); + $account->owner_address = GETPOST('owner_address','alpha'); + $account->frstrecur = GETPOST('frstrecur','alpha'); + $account->rum = GETPOST('rum','alpha'); + if (empty($account->rum)) + { + $account->rum = $prelevement->buildRumNumber($object->code_client, $account->datec, $account->id); + $account->date_rum = dol_now(); + } + + $result = $account->update($user); + if (! $result) + { + setEventMessages($account->error, $account->errors, 'errors'); + } + else + { + // If this account is the default bank account, we disable others + if ($account->default_rib) + { + $account->setAsDefault($id); // This will make sure there is only one default rib + } + + $url=DOL_URL_ROOT.'/societe/rib.php?socid='.$object->id; + header('Location: '.$url); + exit; + } + } + } + + if ($action == 'add' && ! $_POST["cancel"]) + { + $error=0; + + if (! GETPOST('label')) + { + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label")), null, 'errors'); + $action='create'; + $error++; + } + if (! GETPOST('bank')) + { + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BankName")), null, 'errors'); + $action='create'; + $error++; + } + + if (! $error) + { + // Ajout + $account = new CompanyBankAccount($db); + + $account->socid = $object->id; + + $account->bank = GETPOST('bank','alpha'); + $account->label = GETPOST('label','alpha'); + $account->courant = GETPOST('courant','alpha'); + $account->clos = GETPOST('clos','alpha'); + $account->code_banque = GETPOST('code_banque','alpha'); + $account->code_guichet = GETPOST('code_guichet','alpha'); + $account->number = GETPOST('number','alpha'); + $account->cle_rib = GETPOST('cle_rib','alpha'); + $account->bic = GETPOST('bic','alpha'); + $account->iban = GETPOST('iban','alpha'); + $account->domiciliation = GETPOST('domiciliation','alpha'); + $account->proprio = GETPOST('proprio','alpha'); + $account->owner_address = GETPOST('owner_address','alpha'); + $account->frstrecur = GETPOST('frstrecur'); + + // This test can be done only once properties were set + if ($account->needIBAN() == 1) + { + if (! GETPOST('iban')) + { + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("IBAN")), null, 'errors'); + $action='create'; + $error++; + } + if (! GETPOST('bic')) + { + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BIC")), null, 'errors'); + $action='create'; + $error++; + } + } + + if (! $error) + { + if (empty($account->rum)) + { + $account->rum = $prelevement->buildRumNumber($object->code_client, $account->datec, $account->id); + $account->date_rum = dol_now(); + } + + $result = $account->update($user); // This will set the UMR number. + // TODO Use create and include update into create method + if (! $result) + { + setEventMessages($account->error, $account->errors, 'errors'); + $_GET["action"]='create'; // Force chargement page création + } + else + { + $url=DOL_URL_ROOT.'/societe/rib.php?socid='.$object->id; + header('Location: '.$url); + exit; + } + } + } + } + + if ($action == 'setasdefault') + { + $account = new CompanyBankAccount($db); + $res = $account->setAsDefault(GETPOST('ribid','int')); + if ($res) + { + $url=DOL_URL_ROOT.'/societe/rib.php?socid='.$object->id; + header('Location: '.$url); + exit; + } + else + { + setEventMessages($db->lasterror, null, 'errors'); + } + } + + if ($action == 'confirm_delete' && $_GET['confirm'] == 'yes') + { + $account = new CompanyBankAccount($db); + if ($account->fetch($ribid?$ribid:$id)) + { + $result = $account->delete($user); + if ($result > 0) + { + $url = $_SERVER['PHP_SELF']."?socid=".$object->id; + header('Location: '.$url); + exit; + } + else + { + setEventMessages($account->error, $account->errors, 'errors'); + } + } + else + { + setEventMessages($account->error, $account->errors, 'errors'); + } + } + + $savid=$id; + + // Actions to build doc + if ($action == 'builddocrib') + { + $action = 'builddoc'; + $moreparams = array( + 'use_companybankid'=>GETPOST('companybankid'), + 'force_dir_output'=>$conf->societe->dir_output.'/'.dol_sanitizeFileName($object->id) + ); + $_POST['lang_id'] = GETPOST('lang_idrib'.GETPOST('companybankid')); + $_POST['model'] = GETPOST('modelrib'.GETPOST('companybankid')); + } + $id = $socid; + $upload_dir = $conf->societe->dir_output; + $permissioncreate=$user->rights->societe->creer; + include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; + + $id = $savid; } -if ($action == 'confirm_delete' && $_GET['confirm'] == 'yes') -{ - $account = new CompanyBankAccount($db); - if ($account->fetch($ribid?$ribid:$id)) - { - $result = $account->delete($user); - if ($result > 0) - { - $url = $_SERVER['PHP_SELF']."?socid=".$object->id; - header('Location: '.$url); - exit; - } - else - { - setEventMessages($account->error, $account->errors, 'errors'); - } - } - else - { - setEventMessages($account->error, $account->errors, 'errors'); - } -} /* @@ -197,21 +309,18 @@ if ($action == 'confirm_delete' && $_GET['confirm'] == 'yes') */ $form = new Form($db); -$prelevement = new BonPrelevement($db); +$formfile = new FormFile($db); llxHeader(); -$head=societe_prepare_head2($object); +$head=societe_prepare_head($object); - -$account = new CompanyBankAccount($db); if (! $id) $account->fetch(0,$object->id); else $account->fetch($id); if (empty($account->socid)) $account->socid=$object->id; - if ($socid && $action == 'edit' && $user->rights->societe->creer) { print '
'; @@ -238,24 +347,25 @@ if ($socid && $action != 'edit' && $action != "create") print $form->formconfirm($_SERVER["PHP_SELF"]."?socid=".$object->id."&ribid=".($ribid?$ribid:$id), $langs->trans("DeleteARib"), $langs->trans("ConfirmDeleteRib", $account->getRibLabel()), "confirm_delete", '', 0, 1); } - dol_banner_tab($object, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom'); - + $linkback = ''.$langs->trans("BackToList").''; + + dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom'); + print '
'; - + print load_fiche_titre($langs->trans("DefaultRIB"), '', ''); print '
'; print ''; - print ''; + print ''; print ''; print ''; print ''; // Show fields of bank account - - foreach($account->getFieldsToShow() as $val) + foreach($account->getFieldsToShow(1) as $val) { if ($val == 'BankCode') { $content = $account->code_banque; @@ -263,59 +373,56 @@ if ($socid && $action != 'edit' && $action != "create") $content = $account->code_guichet; } elseif ($val == 'BankAccountNumber') { $content = $account->number; + if (! empty($account->label)) { + if (! checkBanForAccount($account)) { + $content.= ' '.img_picto($langs->trans("ValueIsNotValid"),'warning'); + } else { + $content.= ' '.img_picto($langs->trans("ValueIsValid"),'info'); + } + } } elseif ($val == 'BankAccountNumberKey') { $content = $account->cle_rib; + } elseif ($val == 'IBAN') { + $content = $account->iban; + if (! empty($account->iban)) { + if (! checkIbanForAccount($account)) { + $content.= ' '.img_picto($langs->trans("ValueIsNotValid"),'warning'); + } else { + $content.= ' '.img_picto($langs->trans("ValueIsValid"),'info'); + } + } + } elseif ($val == 'BIC') { + $content = $account->bic; + if (! empty($account->bic)) { + if (! checkSwiftForAccount($account)) { + $content.= ' '.img_picto($langs->trans("ValueIsNotValid"),'warning'); + } else { + $content.= ' '.img_picto($langs->trans("ValueIsValid"),'info'); + } + } } print ''; - print ''; + print ''; print ''; } - print ''; - print ''; - - print ''; - print ''; - - print '\n"; - print '\n"; - print '\n"; print '
'.$langs->trans("LabelRIB").'
'.$langs->trans("LabelRIB").''.$account->label.'
'.$langs->trans("BankName").''.$account->bank.'
'.$langs->trans($val).''.$content.''.$content.'
'.$langs->trans("IBAN").''.$account->iban . ' '; - if (! empty($account->iban)) { - if (! checkIbanForAccount($account)) { - print img_picto($langs->trans("IbanNotValid"),'warning'); - } else { - print img_picto($langs->trans("IbanValid"),'info'); - } - } - print '
'.$langs->trans("BIC").''.$account->bic.' '; - if (! empty($account->bic)) { - if (! checkSwiftForAccount($account)) { - print img_picto($langs->trans("SwiftNotValid"),'warning'); - } else { - print img_picto($langs->trans("SwiftValid"),'info'); - } - } - print '
'.$langs->trans("BankAccountDomiciliation").''; + print '
'.$langs->trans("BankAccountDomiciliation").''; print $account->domiciliation; print "
'.$langs->trans("BankAccountOwner").''; + print '
'.$langs->trans("BankAccountOwner").''; print $account->proprio; print "
'.$langs->trans("BankAccountOwnerAddress").''; + print '
'.$langs->trans("BankAccountOwnerAddress").''; print $account->owner_address; print "
'; - // Check BBAN - if ($account->label && ! checkBanForAccount($account)) - { - print '
'.$langs->trans("RIBControlError").'
'; - } - print "
"; - + dol_fiche_end(); @@ -339,10 +446,11 @@ if ($socid && $action != 'edit' && $action != "create") print_liste_field_titre($langs->trans("BIC")); if (! empty($conf->prelevement->enabled)) { - print '
RUM'.$langs->trans("WithdrawMode").'
'.$rib->bank.''.$rib->getRibLabel(false).''; + $string=''; + foreach ($rib->getFieldsToShow() as $val) { + + if ($val == 'BankCode') { + $string .= $rib->code_banque.' '; + } elseif ($val == 'BankAccountNumber') { + $string .= $rib->number.' '; + } elseif ($val == 'DeskCode') { + $string .= $rib->code_guichet.' '; + } elseif ($val == 'BankAccountNumberKey') { + $string .= $rib->cle_rib.' '; + /* Already output after + }elseif ($val == 'BIC') { + $string .= $rib->bic.' '; + }elseif ($val == 'IBAN') { + $string .= $rib->iban.' ';*/ + } + } + print $string; + print ''.$rib->iban.''.$rib->iban; + if (! empty($rib->iban)) { + if (! checkIbanForAccount($rib)) { + print ' '.img_picto($langs->trans("IbanNotValid"),'warning'); + } else { + print ' '.img_picto($langs->trans("IbanValid"),'info'); + } + } + print ''.$rib->bic.''.$rib->bic; + if (! empty($rib->bic)) { + if (! checkSwiftForAccount($rib)) { + print ' '.img_picto($langs->trans("SwiftNotValid"),'warning'); + } else { + print ' '.img_picto($langs->trans("SwiftValid"),'info'); + } + } + print ''.$prelevement->buildRumNumber($object->code_client, $rib->datec, $rib->id).''.$prelevement->buildRumNumber($object->code_client, $rib->datec, $rib->id).''.$rib->rum.''.$rib->frstrecur.''; + + $buttonlabel = $langs->trans("BuildDoc"); + $forname='builddocrib'.$rib->id; + + include_once DOL_DOCUMENT_ROOT.'/core/modules/bank/modules_bank.php'; + $modellist=ModeleBankAccountDoc::liste_modeles($db); + $out = ''; + if (is_array($modellist) && count($modellist)) + { + $out.= ''; + $out.= ''; + $out.= ''; + $out.= ''; + $out.= ''; + + if (is_array($modellist) && count($modellist) == 1) // If there is only one element + { + $arraykeys=array_keys($modellist); + $modelselected=$arraykeys[0]; + } + $out.= $form->selectarray('modelrib'.$rib->id, $modellist, $modelselected, $showempty, 0, 0, '', 0, 0, 0, '', 'minwidth100'); + $out.= ajax_combobox('modelrib'.$rib->id); + + // Language code (if multilang) + if ($conf->global->MAIN_MULTILANGS) + { + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; + $formadmin=new FormAdmin($db); + $defaultlang=$codelang?$codelang:$langs->getDefaultLang(); + $morecss='maxwidth150'; + if (! empty($conf->browser->phone)) $morecss='maxwidth100'; + $out.= $formadmin->select_language($defaultlang, 'lang_idrib'.$rib->id, 0, 0, 0, 0, 0, $morecss); + } + // Button + $genbutton = 'dol_no_mouse_hover) && $modulepart != 'unpaid') + { + $langs->load("errors"); + $genbutton.= ' '.img_warning($langs->transnoentitiesnoconv("WarningNoDocumentModelActivated")); + } + if (! $allowgenifempty && ! is_array($modellist) && empty($modellist) && empty($conf->dol_no_mouse_hover) && $modulepart != 'unpaid') $genbutton=''; + if (empty($modellist) && ! $showempty && $modulepart != 'unpaid') $genbutton=''; + $out.= $genbutton; + $out.= ''; + } + print $out; + print ''; if ($user->rights->societe->creer) @@ -395,12 +593,13 @@ if ($socid && $action != 'edit' && $action != "create") print ''; } print '
'.$langs->trans("NoBANRecord").'
'; + if (is_array($modellist) && count($modellist) == 1) // If there is only one element + { + $arraykeys=array_keys($modellist); + $modelselected=$arraykeys[0]; + } + $out.= $form->selectarray('model', $modellist, $modelselected, 0, 0, 0, '', 0, 0, 0, '', 'minwidth100'); + $out.= ajax_combobox('model'); + //print $out; + $buttonlabel=$langs->trans("Generate"); + $genbutton = ''; // TODO Add link to generate doc + */ } // Edit @@ -417,21 +678,25 @@ if ($socid && $action == 'edit' && $user->rights->societe->creer) { dol_fiche_head($head, 'rib', $langs->trans("ThirdParty"),0,'company'); - dol_banner_tab($object, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom'); - + $linkback = ''.$langs->trans("BackToList").''; + + dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom'); + print '
'; - + print '
'; print ''; - print ''; + print ''; print ''; print ''; print ''; // Show fields of bank account - foreach ($account->getFieldsToShow() as $val) { + foreach ($account->getFieldsToShow(1) as $val) { + + $require=false; if ($val == 'BankCode') { $name = 'code_banque'; $size = 8; @@ -448,31 +713,34 @@ if ($socid && $action == 'edit' && $user->rights->societe->creer) $name = 'cle_rib'; $size = 3; $content = $account->cle_rib; + } elseif ($val == 'IBAN') { + $name = 'iban'; + $size = 30; + $content = $account->iban; + if ($account->needIBAN()) $require=true; + } elseif ($val == 'BIC') { + $name = 'bic'; + $size = 12; + $content = $account->bic; + if ($account->needIBAN()) $require=true; } - print ''; + print ''.$langs->trans($val).''; print ''; print ''; } - // IBAN - print ''; - print ''; - - print ''; - print ''; - - print '"; - print ''; + print ''; print ''; print "\n"; - print '"; @@ -487,18 +755,18 @@ if ($socid && $action == 'edit' && $user->rights->societe->creer) if (empty($account->rum)) $account->rum = $prelevement->buildRumNumber($object->code_client, $account->datec, $account->id); // RUM - print ''; - print ''; + print ''; + print ''; // FRSTRECUR - print ''; - print ''; + print ''; + print ''; print '
'.$langs->trans("LabelRIB").'
'.$langs->trans("LabelRIB").'
'.$langs->trans("BankName").'
'.$langs->trans($val).'
'.$langs->trans("IBAN").'
'.$langs->trans("BIC").'
'.$langs->trans("BankAccountDomiciliation").''; - print '
'.$langs->trans("BankAccountOwner").'
'.$langs->trans("BankAccountOwner").'
'.$langs->trans("BankAccountOwnerAddress").''; - print "
'.$langs->trans("RUM").''.$account->rum.'
'.$langs->trans("RUM").'
'.$langs->trans("WithdrawMode").'
'.$langs->trans("WithdrawMode").'
'; } print '
'; - + dol_fiche_end(); print '
'; @@ -514,14 +782,16 @@ if ($socid && $action == 'create' && $user->rights->societe->creer) { dol_fiche_head($head, 'rib', $langs->trans("ThirdParty"),0,'company'); - dol_banner_tab($object, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom'); - + $linkback = ''.$langs->trans("BackToList").''; + + dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom'); + print '
'; - + print '
'; print ''; - print ''; + print ''; print ''; print ''; @@ -557,23 +827,23 @@ if ($socid && $action == 'create' && $user->rights->societe->creer) } // IBAN - print ''; + print 'needIBAN()?' class="fieldrequired" ':'').'>'.$langs->trans("IBAN").''; print ''; - print ''; + print 'needIBAN()?' class="fieldrequired" ':'').'>'.$langs->trans("BIC").''; print ''; - print '"; - print ''; + print ''; print ''; print "\n"; - print '"; @@ -586,21 +856,21 @@ if ($socid && $action == 'create' && $user->rights->societe->creer) print '
'.$langs->trans("LabelRIB").'
'.$langs->trans("LabelRIB").'
'.$langs->trans("Bank").'
'.$langs->trans("IBAN").'
'.$langs->trans("BIC").'
'.$langs->trans("BankAccountDomiciliation").''; - print '
'.$langs->trans("BankAccountOwner").'
'.$langs->trans("BankAccountOwner").'
'.$langs->trans("BankAccountOwnerAddress").''; - print '
'; // RUM - print ''; - print ''; + print ''; + print ''; // FRSTRECUR - print ''; - print ''; + print ''; + print ''; print '
'.$langs->trans("RUM").''.$langs->trans("RUMWillBeGenerated").'
'.$langs->trans("RUM").''.$langs->trans("RUMWillBeGenerated").'
'.$langs->trans("WithdrawMode").'
'.$langs->trans("WithdrawMode").'
'; } print '
'; - + dol_fiche_end(); - print '
'; + print '
'; print ''; print '     '; print ''; @@ -617,23 +887,6 @@ if ($socid && $action == 'create' && $user->rights->societe->creer) } - -if ($socid && $action != 'edit' && $action != 'create') -{ - /* - * Barre d'actions - */ - print '
'; - - if ($user->rights->societe->creer) - { - print ''.$langs->trans("Add").''; - } - - print '
'; -} - - llxFooter(); $db->close(); diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index fb758c52f29..71f2ae41536 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -106,7 +106,7 @@ if (empty($reshook)) { header("Location: ".$backtopage); exit; - } + } } if ($action == 'confirm_merge' && $confirm == 'yes') @@ -200,8 +200,8 @@ if (empty($reshook)) { setEventMessages($langs->trans('ThirdpartiesMergeSuccess'), null, 'mesgs'); $db->commit(); - } - else + } + else { $langs->load("errors"); setEventMessages($langs->trans('ErrorsThirdpartyMerge'), null, 'errors'); @@ -228,14 +228,14 @@ if (empty($reshook)) //obtidre selected del combobox $value=GETPOST('lt1'); $object->fetch($socid); - $res=$object->setValueFrom('localtax1_value', $value); + $res=$object->setValueFrom('localtax1_value', $value, '', null, 'text', '', $user, 'COMPANY_MODIFY'); } if($action=='set_localtax2') { //obtidre selected del combobox $value=GETPOST('lt2'); $object->fetch($socid); - $res=$object->setValueFrom('localtax2_value', $value); + $res=$object->setValueFrom('localtax2_value', $value, '', null, 'text', '', $user, 'COMPANY_MODIFY'); } // Add new or update third party @@ -262,8 +262,8 @@ if (empty($reshook)) $error++; $action='create'; } - - + + if ($action == 'update') { $ret=$object->fetch($socid); @@ -287,7 +287,7 @@ if (empty($reshook)) $object->name_alias = GETPOST('name_alias'); } - $object->address = GETPOST('address', 'alpha'); + $object->address = GETPOST('address'); $object->zip = GETPOST('zipcode', 'alpha'); $object->town = GETPOST('town', 'alpha'); $object->country_id = GETPOST('country_id', 'int'); @@ -340,13 +340,13 @@ if (empty($reshook)) $object->fk_incoterms = GETPOST('incoterm_id', 'int'); $object->location_incoterms = GETPOST('location_incoterms', 'alpha'); } - + // Multicurrency if (!empty($conf->multicurrency->enabled)) { $object->multicurrency_code = GETPOST('multicurrency_code', 'alpha'); } - + // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost($extralabels,$object); if ($ret < 0) @@ -446,7 +446,7 @@ if (empty($reshook)) if (empty($object->fournisseur)) $object->code_fournisseur=''; $result = $object->create($user); - if ($result >= 0) + if ($result >= 0) { if ($object->particulier) { @@ -509,6 +509,13 @@ if (empty($reshook)) } else { + + if($result == -3) { + $duplicate_code_error = true; + $object->code_fournisseur = null; + $object->code_client = null; + } + $error=$object->error; $errors=$object->errors; } @@ -705,6 +712,7 @@ if (empty($reshook)) $trigger_name='COMPANY_SENTBYMAIL'; $paramname='socid'; $mode='emailfromthirdparty'; + $trackid='thi'.$object->id; include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; // Actions to build doc @@ -732,7 +740,7 @@ if ($socid > 0 && empty($object->id)) } $title=$langs->trans("ThirdParty"); -if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name; +if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name." - ".$langs->trans('Card'); $help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; llxHeader('',$title,$help_url); @@ -802,8 +810,15 @@ else $object->particulier = $private; $object->prefix_comm = GETPOST('prefix_comm'); $object->client = GETPOST('client')?GETPOST('client'):$object->client; - $object->code_client = GETPOST('code_client', 'alpha'); - $object->fournisseur = GETPOST('fournisseur')?GETPOST('fournisseur'):$object->fournisseur; + + if(empty($duplicate_code_error)) { + $object->code_client = GETPOST('code_client', 'alpha'); + $object->fournisseur = GETPOST('fournisseur')?GETPOST('fournisseur'):$object->fournisseur; + } + else { + setEventMessages($langs->trans('NewCustomerSupplierCodeProposed'),'', 'warnings'); + } + $object->code_fournisseur = GETPOST('code_fournisseur', 'alpha'); $object->address = GETPOST('address', 'alpha'); $object->zip = GETPOST('zipcode', 'alpha'); @@ -926,13 +941,13 @@ else print ''; print '     '; print ''; @@ -968,7 +983,7 @@ else print ''.fieldLabel('ThirdPartyName','name').''; } print '
'.$langs->trans('Prefix').'
'.fieldLabel('ProspectCustomer','customerprospect',1).''.fieldLabel('CustomerCode','customer_code').''; + print ''.fieldLabel('CustomerCode','customer_code').''; print '
'; - $tmpcode=$object->code_client; + $tmpcode=$object->code_client; if (empty($tmpcode) && ! empty($modCodeClient->code_auto)) $tmpcode=$modCodeClient->getNextValue($object,0); - print ''; + print ''; print ''; $s=$modCodeClient->getToolTip($langs,$object,0); print $form->textwithpicto('',$s,1); @@ -1026,7 +1041,7 @@ else print ''; // Country - print ''; @@ -1090,9 +1105,9 @@ else // Phone / Fax print ''; - print ''; + print ''; print ''; - print ''; + print ''; // Prof ids $i=1; $j=0; @@ -1117,14 +1132,14 @@ else } if ($j % 2 == 1) print ''; - // Assujeti TVA + // Vat is used print ''; print ''; print ''; print ''; print ''; } @@ -1494,14 +1509,14 @@ else print $object->ref; print ''; } - + // Name print ''; - print ''; + print ''; // Alias names (commercial, trademark or alias names) print ''; - print ''; + print ''; // Prefix if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field @@ -1522,13 +1537,13 @@ else // Prospect/Customer print ''; - print ''; - print '"; // End of subscription date @@ -306,7 +308,7 @@ if ($id > 0 || ! empty($ref)) else { print ''; // Bank Account - if (! empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL) && $conf->banque->enabled) { + if (! empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL) && ! empty($conf->banque->enabled)) { print ''; @@ -1142,14 +1144,14 @@ if ($action == 'create') print ''; print ''; } - + // Multicurrency if (! empty($conf->multicurrency->enabled)) { print ''; print ''; print ''; } @@ -1207,9 +1209,10 @@ if ($action == 'create') if (empty($conf->global->SUPPLIER_PROPOSAL_CLONE_ON_CREATE_PAGE)) print ''; - if (! empty($conf->global->SUPPLIER_PROPOSAL_CLONE_ON_CREATE_PAGE) || ! empty($conf->global->PRODUCT_SHOW_WHEN_CREATE)) print '
'; $tmpcode=$object->code_fournisseur; if (empty($tmpcode) && ! empty($modCodeFournisseur->code_auto)) $tmpcode=$modCodeFournisseur->getNextValue($object,1); - print ''; + print ''; print ''; $s=$modCodeFournisseur->getToolTip($langs,$object,1); print $form->textwithpicto('',$s,1); @@ -1061,7 +1076,7 @@ else print '
'.fieldLabel('Country','selectcountry_id').''; + print '
'.fieldLabel('Country','selectcountry_id').''; print $form->select_country((GETPOST('country_id')!=''?GETPOST('country_id'):$object->country_id)); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); print '
'.fieldLabel('Phone','phone').''.fieldLabel('Fax','fax').'
'.fieldLabel('VATIsUsed','assujtva_value').''; print $form->selectyesno('assujtva_value',1,1); // Assujeti par defaut en creation print ''.fieldLabel('VATIntra','intra_vat').''; - $s = ''; + $s = ''; if (empty($conf->global->MAIN_DISABLEVATCHECK)) { @@ -1207,7 +1222,7 @@ else if (! empty($conf->global->MAIN_MULTILANGS)) { print '
'.fieldLabel('DefaultLang','default_lang').''."\n"; - print $formadmin->select_language(($object->default_lang?$object->default_lang:$conf->global->MAIN_LANG_DEFAULT),'default_lang',0,0,1); + print $formadmin->select_language(($object->default_lang?$object->default_lang:$conf->global->MAIN_LANG_DEFAULT),'default_lang',0,0,1,0,0,'maxwidth200onsmartphone'); print '
'.fieldLabel('ThirdPartyName','name',1).'
'.fieldLabel('ProspectCustomer','customerprospect',1).''.fieldLabel('CustomerCode','customer_code').''; + print ''.fieldLabel('CustomerCode','customer_code').''; print ''; - print ''; print ''; - print ''; + print ''; print ''; - print ''; + print ''; // Prof ids $i=1; $j=0; @@ -1673,15 +1688,65 @@ else } if ($j % 2 == 1) print ''; - // VAT payers - print ''; + // Local Taxes + //TODO: Place into a function to control showing by country or study better option + if($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj=="1") + { + print ''; + + } + elseif($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj!="1") + { + print ''; + + } + elseif($mysoc->localtax2_assuj=="1" && $mysoc->localtax1_assuj!="1") + { + print ''; + } + // VAT Code print ''; - print ''; print ''; - // Local Taxes - //TODO: Place into a function to control showing by country or study better option - if($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj=="1") - { - print ''; - - } - elseif($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj!="1") - { - print ''; - - } - elseif($mysoc->localtax2_assuj=="1" && $mysoc->localtax1_assuj!="1") - { - print ''; - } - // Type - Size print ''; // Juridical type - print ''; @@ -1916,19 +1931,19 @@ else ) ); - print $form->formconfirm($_SERVER["PHP_SELF"]."?socid=".$object->id, $langs->trans("MergeThirdparties"), $langs->trans("ConfirmMergeThirdparties"), "confirm_merge", $formquestion, 'no', 1, 190); + print $form->formconfirm($_SERVER["PHP_SELF"]."?socid=".$object->id, $langs->trans("MergeThirdparties"), $langs->trans("ConfirmMergeThirdparties"), "confirm_merge", $formquestion, 'no', 1, 200); } dol_htmloutput_errors($error,$errors); $linkback = ''.$langs->trans("BackToList").''; - + dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom'); - - + + print '
'; print '
'; - + print '
'; print '
'; if ((!$object->code_client || $object->code_client == -1) && $modCodeClient->code_auto) @@ -1558,7 +1573,7 @@ else if (! empty($conf->fournisseur->enabled) && ! empty($user->rights->fournisseur->lire)) { print '
'.fieldLabel('Supplier','fournisseur',1).''; + print ''.fieldLabel('Supplier','fournisseur',1).''; print $form->selectyesno("fournisseur",$object->fournisseur,1); print ''.fieldLabel('SupplierCode','supplier_code').''; @@ -1643,9 +1658,9 @@ else // Phone / Fax print '
'.fieldLabel('Phone','phone').''.fieldLabel('Fax','fax').'
'.fieldLabel('VATIsUsed','assujtva_value').''; + // VAT is used + print '
'.fieldLabel('VATIsUsed','assujtva_value').''; print $form->selectyesno('assujtva_value',$object->tva_assuj,1); print '
'.fieldLabel($langs->transcountry("LocalTax1IsUsed",$mysoc->country_code),'localtax1assuj_value').''; + print $form->selectyesno('localtax1assuj_value',$object->localtax1_assuj,1); + if(! isOnlyOneLocalTax(1)) + { + print ' '.$langs->transcountry("Type",$mysoc->country_code).': '; + $formcompany->select_localtax(1,$object->localtax1_value, "lt1"); + print ''; + } + + print ''.fieldLabel($langs->transcountry("LocalTax2IsUsed",$mysoc->country_code),'localtax2assuj_value').''; + print $form->selectyesno('localtax2assuj_value',$object->localtax2_assuj,1); + if (! isOnlyOneLocalTax(2)) + { + print ' '.$langs->transcountry("Type",$mysoc->country_code).': '; + $formcompany->select_localtax(2,$object->localtax2_value, "lt2"); + print ''; + } + print '
'.fieldLabel($langs->transcountry("LocalTax1IsUsed",$mysoc->country_code),'localtax1assuj_value').''; + print $form->selectyesno('localtax1assuj_value',$object->localtax1_assuj,1); + if(! isOnlyOneLocalTax(1)) + { + print ' '.$langs->transcountry("Type",$mysoc->country_code).': '; + $formcompany->select_localtax(1,$object->localtax1_value, "lt1"); + print ''; + } + print '
'.fieldLabel($langs->transcountry("LocalTax2IsUsed",$mysoc->country_code),'localtax2assuj_value').''; + print $form->selectyesno('localtax2assuj_value',$object->localtax2_assuj,1); + if(! isOnlyOneLocalTax(2)) + { + print ' '.$langs->transcountry("Type",$mysoc->country_code).': '; + $formcompany->select_localtax(2,$object->localtax2_value, "lt2"); + print ''; + } + print '
'.fieldLabel('VATIntra','intra_vat').''; - $s =''; + print ''; + $s =''; if (empty($conf->global->MAIN_DISABLEVATCHECK)) { @@ -1708,56 +1773,6 @@ else print '
'.fieldLabel($langs->transcountry("LocalTax1IsUsed",$mysoc->country_code),'localtax1assuj_value').''; - print $form->selectyesno('localtax1assuj_value',$object->localtax1_assuj,1); - if(! isOnlyOneLocalTax(1)) - { - print ' '.$langs->transcountry("Type",$mysoc->country_code).': '; - $formcompany->select_localtax(1,$object->localtax1_value, "lt1"); - print ''; - } - - print ''.fieldLabel($langs->transcountry("LocalTax2IsUsed",$mysoc->country_code),'localtax2assuj_value').''; - print $form->selectyesno('localtax2assuj_value',$object->localtax2_assuj,1); - if (! isOnlyOneLocalTax(2)) - { - print ' '.$langs->transcountry("Type",$mysoc->country_code).': '; - $formcompany->select_localtax(2,$object->localtax2_value, "lt2"); - print ''; - } - print '
'.fieldLabel($langs->transcountry("LocalTax1IsUsed",$mysoc->country_code),'localtax1assuj_value').''; - print $form->selectyesno('localtax1assuj_value',$object->localtax1_assuj,1); - if(! isOnlyOneLocalTax(1)) - { - print ' '.$langs->transcountry("Type",$mysoc->country_code).': '; - $formcompany->select_localtax(1,$object->localtax1_value, "lt1"); - print ''; - } - print '
'.fieldLabel($langs->transcountry("LocalTax2IsUsed",$mysoc->country_code),'localtax2assuj_value').''; - print $form->selectyesno('localtax2assuj_value',$object->localtax2_assuj,1); - if(! isOnlyOneLocalTax(2)) - { - print ' '.$langs->transcountry("Type",$mysoc->country_code).': '; - $formcompany->select_localtax(2,$object->localtax2_value, "lt2"); - print ''; - } - print '
'.fieldLabel('ThirdPartyType','typent_id').''; print $form->selectarray("typent_id",$formcompany->typent_array(0), $object->typent_id, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT)?'ASC':$conf->global->SOCIETE_SORT_ON_TYPEENT)); @@ -1769,7 +1784,7 @@ else print '
'.fieldLabel('JuridicalStatus','forme_juridique_code').''; + print '
'.fieldLabel('JuridicalStatus','forme_juridique_code').''; print $formcompany->select_juridicalstatus($object->forme_juridique_code, $object->country_code, '', 'forme_juridique_code'); print '
'; @@ -1936,12 +1951,12 @@ else print ''; - + // Prospect/Customer print ''; - + // Prefix if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field { @@ -2012,13 +2027,111 @@ else } //if ($j % 2 == 1) print ''; - // VAT payers + // VAT is used print ''; print ''; + + // Local Taxes + //TODO: Place into a function to control showing by country or study better option + if($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj=="1") + { + print ''; + + if($object->localtax1_assuj=="1" && (! isOnlyOneLocalTax(1))) + { + print ''; + print ''; + print ''; + print ''; + if($action == 'editRE') + { + print ''; + } + else + { + print ''; + } + print ''; + } + if($object->localtax2_assuj=="1" && (! isOnlyOneLocalTax(2))) + { + print ''; + print ''; + print ''; + print ''; + if($action == 'editIRPF'){ + print ''; + }else{ + print ''; + } + print ''; + } + } + elseif($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj!="1") + { + print ''; + if($object->localtax1_assuj=="1" && (! isOnlyOneLocalTax(1))) + { + print ''; + print ''; + print ''; + print ''; + if($action == 'editRE'){ + print ''; + }else{ + print ''; + } + print ''; + + } + } + elseif($mysoc->localtax2_assuj=="1" && $mysoc->localtax1_assuj!="1") + { + print ''; + if($object->localtax2_assuj=="1" && (! isOnlyOneLocalTax(2))) + { + + print ''; + print ''; + print ''; + print ''; + if($action == 'editIRPF'){ + print ''; + }else{ + print ''; + } + print ''; + + } + } + /* + if ($mysoc->country_code=='ES' && $mysoc->localtax2_assuj!="1" && ! empty($conf->fournisseur->enabled) && $object->fournisseur==1) + { + print ''; + } + */ // VAT Code print ''; @@ -2027,7 +2140,7 @@ else { $s=''; $s.=$object->tva_intra; - $s.=''; + $s.=''; if (empty($conf->global->MAIN_DISABLEVATCHECK)) { @@ -2059,103 +2172,6 @@ else print ''; print ''; - // Local Taxes - //TODO: Place into a function to control showing by country or study better option - if($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj=="1") - { - print ''; - - if($object->localtax1_assuj=="1" && (! isOnlyOneLocalTax(1))) - { - print ''; - print ''; - print ''; - print ''; - if($action == 'editRE') - { - print ''; - } - else - { - print ''; - } - print ''; - } - if($object->localtax2_assuj=="1" && (! isOnlyOneLocalTax(2))) - { - print ''; - print ''; - print ''; - print ''; - if($action == 'editIRPF'){ - print ''; - }else{ - print ''; - } - print ''; - } - } - elseif($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj!="1") - { - print ''; - if($object->localtax1_assuj=="1" && (! isOnlyOneLocalTax(1))) - { - print ''; - print ''; - print ''; - print ''; - if($action == 'editRE'){ - print ''; - }else{ - print ''; - } - print ''; - - } - } - elseif($mysoc->localtax2_assuj=="1" && $mysoc->localtax1_assuj!="1") - { - print ''; - if($object->localtax2_assuj=="1" && (! isOnlyOneLocalTax(2))) - { - - print ''; - print ''; - print ''; - print ''; - if($action == 'editIRPF'){ - print ''; - }else{ - print ''; - } - print ''; - - } - } -/* - if ($mysoc->country_code=='ES' && $mysoc->localtax2_assuj!="1" && ! empty($conf->fournisseur->enabled) && $object->fournisseur==1) - { - print ''; - } -*/ // Type + Staff $arr = $formcompany->typent_array(1); $object->typent= $arr[$object->typent_code]; @@ -2163,15 +2179,35 @@ else print ''; print '
'.$langs->trans('ProspectCustomer').''; print $object->getLibCustProspStatut(); print '
'.$langs->trans('Supplier').''; print yn($object->fournisseur); print '
'; print $langs->trans('VATIsUsed'); print ''; print yn($object->tva_assuj); print '
'.$langs->transcountry("LocalTax1IsUsed",$mysoc->country_code).''; + print yn($object->localtax1_assuj); + print '
'.$langs->transcountry("LocalTax2IsUsed",$mysoc->country_code).''; + print yn($object->localtax2_assuj); + print '
'.$langs->transcountry("TypeLocaltax1", $mysoc->country_code).' id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'),1).''; + $formcompany->select_localtax(1,$object->localtax1_value, "lt1"); + print ''.$object->localtax1_value.'
'.$langs->transcountry("TypeLocaltax2", $mysoc->country_code).'id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'),1).''; + $formcompany->select_localtax(2,$object->localtax2_value, "lt2"); + print ''.$object->localtax2_value.'
'.$langs->transcountry("LocalTax1IsUsed",$mysoc->country_code).''; + print yn($object->localtax1_assuj); + print '
'.$langs->transcountry("TypeLocaltax1", $mysoc->country_code).'id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'),1).''; + $formcompany->select_localtax(1,$object->localtax1_value, "lt1"); + print ''.$object->localtax1_value.'
'.$langs->transcountry("LocalTax2IsUsed",$mysoc->country_code).''; + print yn($object->localtax2_assuj); + print '
'.$langs->transcountry("TypeLocaltax2", $mysoc->country_code).' id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'),1).''; + $formcompany->select_localtax(2,$object->localtax2_value, "lt2"); + print ''.$object->localtax2_value.'
'.$langs->transcountry("LocalTax2IsUsed",$mysoc->country_code).''; + print yn($object->localtax2_assuj); + print '
'.$langs->transcountry("LocalTax1IsUsed",$mysoc->country_code).''; - print yn($object->localtax1_assuj); - print '
'.$langs->transcountry("LocalTax2IsUsed",$mysoc->country_code).''; - print yn($object->localtax2_assuj); - print '
'.$langs->transcountry("TypeLocaltax1", $mysoc->country_code).' id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'),1).''; - $formcompany->select_localtax(1,$object->localtax1_value, "lt1"); - print ''.$object->localtax1_value.'
'.$langs->transcountry("TypeLocaltax2", $mysoc->country_code).'id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'),1).''; - $formcompany->select_localtax(2,$object->localtax2_value, "lt2"); - print ''.$object->localtax2_value.'
'.$langs->transcountry("LocalTax1IsUsed",$mysoc->country_code).''; - print yn($object->localtax1_assuj); - print '
'.$langs->transcountry("TypeLocaltax1", $mysoc->country_code).'id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'),1).''; - $formcompany->select_localtax(1,$object->localtax1_value, "lt1"); - print ''.$object->localtax1_value.'
'.$langs->transcountry("LocalTax2IsUsed",$mysoc->country_code).''; - print yn($object->localtax2_assuj); - print '
'.$langs->transcountry("TypeLocaltax2", $mysoc->country_code).' id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'),1).''; - $formcompany->select_localtax(2,$object->localtax2_value, "lt2"); - print ''.$object->localtax2_value.'
'.$langs->transcountry("LocalTax2IsUsed",$mysoc->country_code).''; - print yn($object->localtax2_assuj); - print '
'.$langs->trans("Staff").''.$object->effectif.'
'; - + print ''; print '
'; - + print '
'; print ''; - + + // Tags / categories + if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire)) + { + // Customer + if ($object->prospect || $object->client) { + print ''; + print '"; + } + + // Supplier + if ($object->fournisseur) { + print ''; + print '"; + } + } + // Legal - print ''; + print ''; // Capital print ''; } - // Tags / categories - if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire)) - { - // Customer - if ($object->prospect || $object->client) { - print ''; - print '"; - } - - // Supplier - if ($object->fournisseur) { - print ''; - print '"; - } - } - // Incoterms if (!empty($conf->incoterm->enabled)) { @@ -2244,7 +2260,7 @@ else print !empty($object->multicurrency_code) ? currency_name($object->multicurrency_code,1) : ''; print ''; } - + // Other attributes $parameters=array('socid'=>$socid, 'colspan' => ' colspan="3"', 'colspanvalue' => '3'); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook @@ -2254,22 +2270,6 @@ else print $object->showOptionals($extrafields); } - // Ban - if (empty($conf->global->SOCIETE_DISABLE_BANKACCOUNT)) - { - print ''; - print ''; - } - // Parent company if (empty($conf->global->SOCIETE_DISABLE_PARENTCOMPANY)) { @@ -2325,10 +2325,10 @@ else print '
' . $langs->trans("CustomersCategoriesShort") . ''; + print $form->showCategories($object->id, 'customer', 1); + print "
' . $langs->trans("SuppliersCategoriesShort") . ''; + print $form->showCategories($object->id, 'supplier', 1); + print "
'.$langs->trans('JuridicalStatus').''.$object->forme_juridique.'
'.$langs->trans('JuridicalStatus').''.$object->forme_juridique.'
'.$langs->trans('Capital').''; @@ -2192,26 +2228,6 @@ else print '
' . $langs->trans("CustomersCategoriesShort") . ''; - print $form->showCategories($object->id, 'customer', 1); - print "
' . $langs->trans("SuppliersCategoriesShort") . ''; - print $form->showCategories($object->id, 'supplier', 1); - print "
'; - print '
'; - print $langs->trans('RIB'); - print ''; - if ($user->rights->societe->creer) print ''.img_edit().''; - else print ' '; - print '
'; - print '
'; - print $object->display_rib(); - print '
'; print '
'; - + print '
'; print '
'; - + dol_fiche_end(); @@ -2345,13 +2345,13 @@ else $TContact = $object->contact_array_objects(); foreach ($TContact as &$contact) { - if (!empty($contact->email)) + if (!empty($contact->email)) { $at_least_one_email_contact = true; break; } } - + if (! empty($object->email) || $at_least_one_email_contact) { $langs->load("mails"); @@ -2408,7 +2408,7 @@ else print load_fiche_titre($langs->trans($titreform)); dol_fiche_head(); - + // Define output language $outputlangs = $langs; $newlang = ''; @@ -2421,10 +2421,12 @@ else include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; $formmail = new FormMail($db); $formmail->param['langsmodels']=(empty($newlang)?$langs->defaultlang:$newlang); - $formmail->fromtype = 'user'; - $formmail->fromid = $user->id; - $formmail->fromname = $user->getFullName($langs); - $formmail->frommail = $user->email; + $formmail->fromtype = (GETPOST('fromtype')?GETPOST('fromtype'):(!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE)?$conf->global->MAIN_MAIL_DEFAULT_FROMTYPE:'user')); + + if($formmail->fromtype === 'user'){ + $formmail->fromid = $user->id; + + } $formmail->trackid='thi'.$object->id; if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set { @@ -2444,6 +2446,8 @@ else $formmail->withdeliveryreceipt=1; $formmail->withcancel=1; // Tableau des substitutions + //$formmail->setSubstitFromObject($object); + $formmail->substit['__THIRDPARTY_NAME__']=$object->name; $formmail->substit['__SIGNATURE__']=$user->signature; $formmail->substit['__PERSONALIZED__']=''; $formmail->substit['__CONTACTCIVNAME__']=''; @@ -2522,8 +2526,11 @@ else print '

'; // Subsidiaries list - $result=show_subsidiaries($conf,$langs,$db,$object); - + if (empty($conf->global->SOCIETE_DISABLE_SUBSIDIARIES)) + { + $result=show_subsidiaries($conf,$langs,$db,$object); + } + // Contacts list if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) { diff --git a/htdocs/societe/societecontact.php b/htdocs/societe/societecontact.php index 69298f263e8..876c383031a 100644 --- a/htdocs/societe/societecontact.php +++ b/htdocs/societe/societecontact.php @@ -149,7 +149,9 @@ if ($id > 0 || ! empty($ref)) print '
'; print ''; - dol_banner_tab($object, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom'); + $linkback = ''.$langs->trans("BackToList").''; + + dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom'); print '
'; @@ -211,7 +213,7 @@ if ($id > 0 || ! empty($ref)) $sql = "SELECT d.rowid, d.login, d.lastname, d.firstname, d.societe as company, d.fk_soc,"; $sql.= " d.datefin,"; $sql.= " d.email, d.fk_adherent_type as type_id, d.morphy, d.statut,"; - $sql.= " t.libelle as type, t.cotisation"; + $sql.= " t.libelle as type, t.subscription"; $sql.= " FROM ".MAIN_DB_PREFIX."adherent as d"; $sql.= ", ".MAIN_DB_PREFIX."adherent_type as t"; $sql.= " WHERE d.fk_soc=".$id; @@ -290,7 +292,7 @@ if ($id > 0 || ! empty($ref)) // Statut print '
'; - print $memberstatic->LibStatut($objp->statut,$objp->cotisation,$datefin,2); + print $memberstatic->LibStatut($objp->statut,$objp->subscription,$datefin,2); print "'; - if ($objp->cotisation == 'yes') + if ($objp->subscription == 'yes') { print $langs->trans("SubscriptionNotReceived"); if ($objp->statut > 0) print " ".img_warning(); diff --git a/htdocs/societe/tpl/linesalesrepresentative.tpl.php b/htdocs/societe/tpl/linesalesrepresentative.tpl.php index 22d99d3e9c3..fe2add787c4 100644 --- a/htdocs/societe/tpl/linesalesrepresentative.tpl.php +++ b/htdocs/societe/tpl/linesalesrepresentative.tpl.php @@ -27,10 +27,12 @@ foreach($listsalesrepresentatives as $val) { $userstatic->id=$val['id']; + $userstatic->login=$val['login']; $userstatic->lastname=$val['lastname']; $userstatic->firstname=$val['firstname']; $userstatic->statut=$val['statut']; - print $userstatic->getNomUrl(1); + $userstatic->photo=$val['photo']; + print $userstatic->getNomUrl(-1); $i++; if ($i < $nbofsalesrepresentative) print ', '; } diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index 8e8c69b0ce9..0658416797e 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -25,6 +25,12 @@ * along with this program. If not, see . */ +/** + * \file htdocs/supplier_proposal/card.php + * \ingroup supplier_proposal + * \brief Card supplier proposal + */ + require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php'; @@ -96,6 +102,8 @@ if ($id > 0 || ! empty($ref)) { $hookmanager->initHooks(array('supplier_proposalcard','globalcard')); $permissionnote = $user->rights->supplier_proposal->creer; // Used by the include of actions_setnotes.inc.php +$permissiondellink=$user->rights->supplier_proposal->creer; // Used by the include of actions_dellink.inc.php +$permissiontoedit=$user->rights->supplier_proposal->creer; // Used by the include of actions_lineupdown.inc.php /* @@ -109,13 +117,13 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e if (empty($reshook)) { if ($cancel) $action=''; - + include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once - + include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once - + include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; // Must be include, not include_once - + // Action clone object if ($action == 'confirm_clone' && $confirm == 'yes') { @@ -130,8 +138,8 @@ if (empty($reshook)) if ($result > 0) { header("Location: " . $_SERVER['PHP_SELF'] . '?id=' . $result); exit(); - } - else + } + else { setEventMessages($object->error, $object->errors, 'errors'); $action = ''; @@ -282,16 +290,6 @@ if (empty($reshook)) $object->multicurrency_code = GETPOST('multicurrency_code', 'alpha'); } - for($i = 1; $i <= $conf->global->PRODUCT_SHOW_WHEN_CREATE; $i ++) - { - if ($_POST['idprod' . $i]) { - $xid = 'idprod' . $i; - $xqty = 'qty' . $i; - $xremise = 'remise' . $i; - $object->add_product($_POST[$xid], $_POST[$xqty], $_POST[$xremise]); - } - } - // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost($extralabels, $object); if ($ret < 0) { @@ -354,10 +352,10 @@ if (empty($reshook)) // Extrafields if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) { $lines[$i]->fetch_optionals($lines[$i]->rowid); - $array_option = $lines[$i]->array_options; + $array_options = $lines[$i]->array_options; } - $result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->qty, $lines[$i]->tva_tx, $lines[$i]->localtax1_tx, $lines[$i]->localtax2_tx, $lines[$i]->fk_product, $lines[$i]->remise_percent, 'HT', 0, $lines[$i]->info_bits, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $fk_parent_line, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $label, $array_option); + $result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->qty, $lines[$i]->tva_tx, $lines[$i]->localtax1_tx, $lines[$i]->localtax2_tx, $lines[$i]->fk_product, $lines[$i]->remise_percent, 'HT', 0, $lines[$i]->info_bits, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $fk_parent_line, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $label, $array_options); if ($result > 0) { $lineid = $result; @@ -476,7 +474,8 @@ if (empty($reshook)) $actiontypecode='AC_ASKPRICE'; $trigger_name='SUPPLIER_PROPOSAL_SENTBYMAIL'; $paramname='id'; - $mode='emailfromsupplier_proposal'; + $mode='emailfromsupplierproposal'; + $trackid='spr'.$object->id; include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; @@ -511,22 +510,28 @@ if (empty($reshook)) } } - // Add line - else if ($action == 'addline' && $user->rights->supplier_proposal->creer) { + // Add a product line + if ($action == 'addline' && $user->rights->supplier_proposal->creer) + { + $langs->load('errors'); + $error = 0; // Set if we used free entry or predefined product $predef=''; $product_desc=(GETPOST('dp_desc')?GETPOST('dp_desc'):''); - $price_ht = GETPOST('price_ht'); - + $date_start=dol_mktime(GETPOST('date_start'.$predef.'hour'), GETPOST('date_start'.$predef.'min'), GETPOST('date_start' . $predef . 'sec'), GETPOST('date_start'.$predef.'month'), GETPOST('date_start'.$predef.'day'), GETPOST('date_start'.$predef.'year')); + $date_end=dol_mktime(GETPOST('date_end'.$predef.'hour'), GETPOST('date_end'.$predef.'min'), GETPOST('date_end' . $predef . 'sec'), GETPOST('date_end'.$predef.'month'), GETPOST('date_end'.$predef.'day'), GETPOST('date_end'.$predef.'year')); + if (GETPOST('prod_entry_mode') == 'free') { $idprod=0; + $price_ht = GETPOST('price_ht'); $tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0); } else { $idprod=GETPOST('idprod', 'int'); + $price_ht = ''; $tva_tx = ''; } @@ -536,7 +541,7 @@ if (empty($reshook)) // Extrafields $extrafieldsline = new ExtraFields($db); $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); - $array_option = $extrafieldsline->getOptionalsFromPost($extralabelsline, $predef); + $array_options = $extrafieldsline->getOptionalsFromPost($extralabelsline, $predef); // Unset extrafield if (is_array($extralabelsline)) { // Get extra fields @@ -559,8 +564,7 @@ if (empty($reshook)) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Description")), null, 'errors'); $error ++; } - - if (! $error && ($qty >= 0) && (! empty($product_desc) || ! empty($idprod))) { + if (! $error && ($qty >= 0)) { $pu_ht = 0; $pu_ttc = 0; $price_min = 0; @@ -571,150 +575,140 @@ if (empty($reshook)) // Ecrase $pu par celui du produit // Ecrase $desc par celui du produit // Ecrase $txtva par celui du produit - if (! empty($idprod)) { - $prod = new Product($db); - $prod->fetch($idprod); + if ((GETPOST('prod_entry_mode') != 'free') && empty($error)) // With combolist mode idprodfournprice is > 0 or -1. With autocomplete, idprodfournprice is > 0 or '' + { + $productsupplier = new ProductFournisseur($db); + + if (empty($conf->global->SUPPLIER_PROPOSAL_WITH_NOPRICEDEFINED)) + { + $idprod=0; + if (GETPOST('idprodfournprice') == -1 || GETPOST('idprodfournprice') == '') $idprod=-99; // Same behaviour than with combolist. When not select idprodfournprice is now -99 (to avoid conflict with next action that may return -1, -2, ...) + } + if (preg_match('/^idprod_([0-9]+)$/',GETPOST('idprodfournprice'), $reg)) + { + $idprod=$reg[1]; + $res=$productsupplier->fetch($idprod); + // Call to init properties of $productsupplier + // So if a supplier price already exists for another thirdparty (first one found), we use it as reference price + $productsupplier->get_buyprice(0, -1, $idprod, 'none'); // We force qty to -1 to be sure to find if a supplier price exist + } + elseif (GETPOST('idprodfournprice') > 0) + { + //$idprod=$productsupplier->get_buyprice(GETPOST('idprodfournprice'), $qty); // Just to see if a price exists for the quantity. Not used to found vat. + $idprod=$productsupplier->get_buyprice(GETPOST('idprodfournprice'), -1); // We force qty to -1 to be sure to find if a supplier price exist + $res=$productsupplier->fetch($idprod); + } + + if ($idprod > 0) + { + $pu_ht = $productsupplier->fourn_pu; + $price_base_type = $productsupplier->fourn_price_base_type; + $type = $productsupplier->type; + $label = $productsupplier->label; + $desc = $productsupplier->description; + if (trim($product_desc) != trim($desc)) $desc = dol_concatdesc($desc, $product_desc); + + $tva_tx = get_default_tva($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice')); + $tva_npr = get_default_npr($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice')); + if (empty($tva_tx)) $tva_npr=0; + $localtax1_tx= get_localtax($tva_tx, 1, $mysoc, $object->thirdparty, $tva_npr); + $localtax2_tx= get_localtax($tva_tx, 2, $mysoc, $object->thirdparty, $tva_npr); - $label = ((GETPOST('product_label') && GETPOST('product_label') != $prod->label) ? GETPOST('product_label') : ''); + $result=$object->addline( + $desc, + $pu_ht, + $qty, + $tva_tx, + $localtax1_tx, + $localtax2_tx, + $productsupplier->id, + $remise_percent, + $price_base_type, + $pu_ttc, + $tva_npr, + $type, + -1, + 0, + GETPOST('fk_parent_line'), + $fournprice, + $buyingprice, + $label, + $array_options, + $ref_fourn + ); + //var_dump($tva_tx);var_dump($productsupplier->fourn_pu);var_dump($price_base_type);exit; + } + if ($idprod == -99 || $idprod == 0) + { + // Product not selected + $error++; + $langs->load("errors"); + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ProductOrService")).' '.$langs->trans("or").' '.$langs->trans("NoPriceDefinedForThisSupplier"), null, 'errors'); + } + if ($idprod == -1) + { + // Quantity too low + $error++; + $langs->load("errors"); + setEventMessages($langs->trans("ErrorQtyTooLowForThisSupplier"), null, 'errors'); + } + } + else if((GETPOST('price_ht')!=='' || GETPOST('price_ttc')!=='') && empty($error)) // Free product + { + $pu_ht = price2num($price_ht, 'MU'); + $pu_ttc = price2num(GETPOST('price_ttc'), 'MU'); + $tva_npr = (preg_match('/\*/', $tva_tx) ? 1 : 0); + $tva_tx = str_replace('*', '', $tva_tx); + $label = (GETPOST('product_label') ? GETPOST('product_label') : ''); + $desc = $product_desc; + $type = GETPOST('type'); - // If prices fields are update - $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; - - //On garde le prix indiqué dans l'input pour la demande de prix fournisseur - //$pu_ht = $prod->price; - $pu_ht = price2num($price_ht, 'MU'); - //$pu_ttc = $prod->price_ttc; - $pu_ttc = price2num($pu_ht * (1 + ($tva_tx / 100)), 'MU'); - - $price_min = $prod->price_min; - $price_base_type = $prod->price_base_type; - - // On defini prix unitaire - if (! empty($conf->global->PRODUIT_MULTIPRICES) && $object->thirdparty->price_level) - { - $pu_ht = $prod->multiprices[$object->thirdparty->price_level]; - $pu_ttc = $prod->multiprices_ttc[$object->thirdparty->price_level]; - $price_min = $prod->multiprices_min[$object->thirdparty->price_level]; - $price_base_type = $prod->multiprices_base_type[$object->thirdparty->price_level]; - if (isset($prod->multiprices_tva_tx[$object->thirdparty->price_level])) $tva_tx=$prod->multiprices_tva_tx[$object->thirdparty->price_level]; - if (isset($prod->multiprices_recuperableonly[$object->thirdparty->price_level])) $tva_npr=$prod->multiprices_recuperableonly[$object->thirdparty->price_level]; - } - elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) - { - require_once DOL_DOCUMENT_ROOT . '/product/class/productcustomerprice.class.php'; - - $prodcustprice = new Productcustomerprice($db); - - $filter = array('t.fk_product' => $prod->id,'t.fk_soc' => $object->thirdparty->id); - - $result = $prodcustprice->fetch_all('', '', 0, 0, $filter); - if ($result) { - if (count($prodcustprice->lines) > 0) { - $pu_ht = price($prodcustprice->lines [0]->price); - $pu_ttc = price($prodcustprice->lines [0]->price_ttc); - $price_base_type = $prodcustprice->lines [0]->price_base_type; - $prod->tva_tx = $prodcustprice->lines [0]->tva_tx; - } - } - } - - // if price ht is forced (ie: calculated by margin rate and cost price) - if (! empty($price_ht)) { - $pu_ht = price2num($price_ht, 'MU'); - $pu_ttc = price2num($pu_ht * (1 + ($tva_tx / 100)), 'MU'); - } - - // On reevalue prix selon taux tva car taux tva transaction peut etre different - // de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur). - elseif ($tva_tx != $prod->tva_tx) { - if ($price_base_type != 'HT') { - $pu_ht = price2num($pu_ttc / (1 + ($tva_tx / 100)), 'MU'); - } else { - $pu_ttc = price2num($pu_ht * (1 + ($tva_tx / 100)), 'MU'); - } - } - - $desc = ''; - - // Define output language - if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) { - $outputlangs = $langs; - $newlang = ''; - if (empty($newlang) && GETPOST('lang_id')) - $newlang = GETPOST('lang_id'); - if (empty($newlang)) - $newlang = $object->thirdparty->default_lang; - if (! empty($newlang)) { - $outputlangs = new Translate("", $conf); - $outputlangs->setDefaultLang($newlang); - } - - $desc = (! empty($prod->multilangs [$outputlangs->defaultlang] ["description"])) ? $prod->multilangs [$outputlangs->defaultlang] ["description"] : $prod->description; - } else { - $desc = $prod->description; - } - - $desc = dol_concatdesc($desc, $product_desc); - - // Add custom code and origin country into description - if (empty($conf->global->MAIN_PRODUCT_DISABLE_CUSTOMCOUNTRYCODE) && (! empty($prod->customcode) || ! empty($prod->country_code))) { - $tmptxt = '('; - if (! empty($prod->customcode)) - $tmptxt .= $langs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode; - if (! empty($prod->customcode) && ! empty($prod->country_code)) - $tmptxt .= ' - '; - if (! empty($prod->country_code)) - $tmptxt .= $langs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, 0, $db, $langs, 0); - $tmptxt .= ')'; - $desc = dol_concatdesc($desc, $tmptxt); - } - - $type = $prod->type; - } else { - $pu_ht = price2num($price_ht, 'MU'); - $pu_ttc = price2num(GETPOST('price_ttc'), 'MU'); - $tva_npr = (preg_match('/\*/', $tva_tx) ? 1 : 0); - $tva_tx = str_replace('*', '', $tva_tx); - $label = (GETPOST('product_label') ? GETPOST('product_label') : ''); - $desc = $product_desc; - $type = GETPOST('type'); + $fk_unit= GETPOST('units', 'alpha'); + + $tva_tx = price2num($tva_tx); // When vat is text input field + + // Local Taxes + $localtax1_tx= get_localtax($tva_tx, 1, $mysoc, $object->thirdparty); + $localtax2_tx= get_localtax($tva_tx, 2, $mysoc, $object->thirdparty); + + if (GETPOST('price_ht')!=='') + { + $price_base_type = 'HT'; + $ht = price2num(GETPOST('price_ht')); + $ttc = 0; + } + else + { + $ttc = price2num(GETPOST('price_ttc')); + $ht = $ttc / (1 + ($tva_tx / 100)); + $price_base_type = 'HT'; + } + + $result = $object->addline($desc, $ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $price_base_type, $ttc, $info_bits, $type, - 1, 0, GETPOST('fk_parent_line'), $fournprice, $buyingprice, $label, $array_options, $ref_fourn); + //$result = $object->addline($desc, $ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, 0, 0, '', $remise_percent, $price_base_type, $ttc, $type,'','', $date_start, $date_end, $array_options, $fk_unit); } - // Margin - $fournprice = (GETPOST('fournprice' . $predef) ? GETPOST('fournprice' . $predef) : ''); - $buyingprice = (GETPOST('buying_price' . $predef) ? GETPOST('buying_price' . $predef) : ''); - // Local Taxes - $localtax1_tx = get_localtax($tva_tx, 1, $object->thirdparty); - $localtax2_tx = get_localtax($tva_tx, 2, $object->thirdparty); - - $info_bits = 0; - if ($tva_npr) - $info_bits |= 0x01; - - if (! empty($price_min) && (price2num($pu_ht) * (1 - price2num($remise_percent) / 100) < price2num($price_min))) { - $mesg = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)); - setEventMessages($mesg, null, 'errors'); - } else { - // Insert line - $ref_fourn = GETPOST('fourn_ref'); - $result = $object->addline($desc, $pu_ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $price_base_type, $pu_ttc, $info_bits, $type, - 1, 0, GETPOST('fk_parent_line'), $fournprice, $buyingprice, $label, $array_option, $ref_fourn); - - if ($result > 0) { + if (! $error && $result > 0) + { $db->commit(); - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { - // Define output language + // Define output language + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) + { $outputlangs = $langs; - if (! empty($conf->global->MAIN_MULTILANGS)) { + $newlang = ''; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha'); + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; + if (! empty($newlang)) { $outputlangs = new Translate("", $conf); - $newlang = (GETPOST('lang_id') ? GETPOST('lang_id') : $object->thirdparty->default_lang); $outputlangs->setDefaultLang($newlang); } + $model=$object->modelpdf; $ret = $object->fetch($id); // Reload to get new records - $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); + + $result=$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); + if ($result < 0) dol_print_error($db,$result); } unset($_POST['prod_entry_mode']); @@ -722,18 +716,23 @@ if (empty($reshook)) unset($_POST['qty']); unset($_POST['type']); unset($_POST['remise_percent']); + unset($_POST['pu']); unset($_POST['price_ht']); unset($_POST['multicurrency_price_ht']); unset($_POST['price_ttc']); unset($_POST['tva_tx']); + unset($_POST['label']); unset($_POST['product_ref']); unset($_POST['product_label']); unset($_POST['product_desc']); unset($_POST['fournprice']); unset($_POST['buying_price']); + unset($localtax1_tx); + unset($localtax2_tx); unset($_POST['np_marginRate']); unset($_POST['np_markRate']); unset($_POST['dp_desc']); + unset($_POST['idprodfournprice']); unset($_POST['idprod']); unset($_POST['date_starthour']); @@ -748,12 +747,14 @@ if (empty($reshook)) unset($_POST['date_endday']); unset($_POST['date_endmonth']); unset($_POST['date_endyear']); - } else { - $db->rollback(); + } + else + { + $db->rollback(); - setEventMessages($object->error, $object->errors, 'errors'); - } + setEventMessages($object->error, $object->errors, 'errors'); } + //} } } @@ -776,12 +777,12 @@ if (empty($reshook)) // Add buying price $fournprice = (GETPOST('fournprice') ? GETPOST('fournprice') : ''); - $buyingprice = (GETPOST('buying_price') != '' ? GETPOST('buying_price') : ''); // If buying_price is '0', we muste keep this value + $buyingprice = (GETPOST('buying_price') != '' ? GETPOST('buying_price') : ''); // If buying_price is '0', we muste keep this value // Extrafields $extrafieldsline = new ExtraFields($db); $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); - $array_option = $extrafieldsline->getOptionalsFromPost($extralabelsline); + $array_options = $extrafieldsline->getOptionalsFromPost($extralabelsline); // Unset extrafield if (is_array($extralabelsline)) { // Get extra fields @@ -826,7 +827,7 @@ if (empty($reshook)) if (! $error) { $db->begin(); $ref_fourn = GETPOST('fourn_ref'); - $result = $object->updateline(GETPOST('lineid'), $pu_ht, GETPOST('qty'), GETPOST('remise_percent'), $vat_rate, $localtax1_rate, $localtax2_rate, $description, 'HT', $info_bits, $special_code, GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, $type, $array_option, $ref_fourn); + $result = $object->updateline(GETPOST('lineid'), $pu_ht, GETPOST('qty'), GETPOST('remise_percent'), $vat_rate, $localtax1_rate, $localtax2_rate, $description, 'HT', $info_bits, $special_code, GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, $type, $array_options, $ref_fourn); if ($result >= 0) { $db->commit(); @@ -947,7 +948,7 @@ if (empty($reshook)) else if ($action == 'setmode' && $user->rights->supplier_proposal->creer) { $result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int')); } - + // Multicurrency Code else if ($action == 'setmulticurrencycode' && $user->rights->supplier_proposal->creer) { $result = $object->setMulticurrencyCode(GETPOST('multicurrency_code', 'alpha')); @@ -955,7 +956,7 @@ if (empty($reshook)) // Multicurrency rate else if ($action == 'setmulticurrencyrate' && $user->rights->supplier_proposal->creer) { - $result = $object->setMulticurrencyRate(GETPOST('multicurrency_tx', 'int')); + $result = $object->setMulticurrencyRate(price2num(GETPOST('multicurrency_tx'))); } else if ($action == 'update_extras') { @@ -999,6 +1000,7 @@ $formfile = new FormFile($db); $formsupplier_proposal = new FormSupplierProposal($db); $formmargin = new FormMargin($db); $companystatic = new Societe($db); +if (! empty($conf->projet->enabled)) { $formproject = new FormProjets($db); } $now = dol_now(); @@ -1085,7 +1087,7 @@ if ($action == 'create') print '
' . $langs->trans('BankAccount') . ''; $form->select_comptes(GETPOST('fk_account')>0 ? GETPOST('fk_account','int') : $fk_account, 'fk_account', 0, '', 1); print '
'.fieldLabel('Currency','multicurrency_code').''; - $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'); print '
'; if (! empty($conf->global->SUPPLIER_PROPOSAL_CLONE_ON_CREATE_PAGE)) { + print '
'; + // For backward compatibility print ''; print ''; @@ -1242,42 +1245,11 @@ if ($action == 'create') } print ''; - if (! empty($conf->global->PRODUCT_SHOW_WHEN_CREATE)) - print ''; - print ''; print ''; } - if (! empty($conf->global->PRODUCT_SHOW_WHEN_CREATE)) - { - print ''; - } - if (! empty($conf->global->SUPPLIER_PROPOSAL_CLONE_ON_CREATE_PAGE) || ! empty($conf->global->PRODUCT_SHOW_WHEN_CREATE)) print '
 
' . $langs->trans("CreateEmptyAsk") . '
'; - if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) { - $lib = $langs->trans("ProductsAndServices"); - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - for($i = 1; $i <= $conf->global->PRODUCT_SHOW_WHEN_CREATE; $i ++) { - print ''; - print ''; - print ''; - print ''; - } - print "
' . $lib . '' . $langs->trans("Qty") . '' . $langs->trans("ReductionShort") . '
'; - // multiprix - if ($conf->global->PRODUIT_MULTIPRICES && $soc->price_level) - $form->select_produits('', "idprod" . $i, '', $conf->product->limit_size, $soc->price_level); - else - $form->select_produits('', "idprod" . $i, '', $conf->product->limit_size); - print '%
"; - } - print '
'; + if (! empty($conf->global->SUPPLIER_PROPOSAL_CLONE_ON_CREATE_PAGE)) print '
'; dol_fiche_end(); @@ -1383,11 +1355,63 @@ if ($action == 'create') // Print form confirm print $formconfirm; + + // Supplier proposal card + $linkback = '' . $langs->trans("BackToList") . ''; + + + $morehtmlref='
'; + // Ref supplier + //$morehtmlref.=$form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->fournisseur->commande->creer, 'string', '', 0, 1); + //$morehtmlref.=$form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->fournisseur->commande->creer, 'string', '', null, null, '', 1); + // Thirdparty + $morehtmlref.=$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); + // Project + if (! empty($conf->projet->enabled)) + { + $langs->load("projects"); + $morehtmlref.='
'.$langs->trans('Project') . ' '; + if ($user->rights->supplier_proposal->creer) + { + if ($action != 'classify') + $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.=''; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (! empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref.=''; + $morehtmlref.=$proj->ref; + $morehtmlref.=''; + } else { + $morehtmlref.=''; + } + } + } + $morehtmlref.='
'; + + + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + + + print '
'; + print '
'; + print '
'; + print ''; - $linkback = '' . $langs->trans("BackToList") . ''; - // Ref + /* print ''; @@ -1395,9 +1419,10 @@ if ($action == 'create') // Company print ''; print ''; - + */ + // Payment term - print ''; } + // Multicompany + // TODO This should be done with hook formObjectOption + if (is_object($mc)) + { + if (! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && ! $user->entity) + { + print '\n"; + } + } + + if (isset($conf->file->main_authentication) && preg_match('/openid/',$conf->file->main_authentication) && ! empty($conf->global->MAIN_OPENIDURL_PERUSER)) + { + print ''; + print ''; + print "\n"; + } + + print ''; + print ''; + print "\n"; + + print ''; + print ''; + print "\n"; + + // Other attributes + $parameters=array(); + $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); + } + // Company / Contact if (! empty($conf->societe->enabled)) { @@ -1488,49 +1552,6 @@ else print ''."\n"; } - // Multicompany - // TODO This should be done with hook formObjectOption - if (is_object($mc)) - { - if (! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && ! $user->entity) - { - print '\n"; - } - } - - if (isset($conf->file->main_authentication) && preg_match('/openid/',$conf->file->main_authentication) && ! empty($conf->global->MAIN_OPENIDURL_PERUSER)) - { - print ''; - print ''; - print "\n"; - } - - print ''; - print ''; - print "\n"; - - print ''; - print ''; - print "\n"; - - // Other attributes - $parameters=array(); - $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 "
' . $langs->trans('Ref') . ''; print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', ''); print '
' . $langs->trans('Supplier') . '' . $soc->getNomUrl(1) . '
'; + print '
'; print ''; @@ -1454,6 +1479,7 @@ if ($action == 'create') print ''; // Project + /* if (! empty($conf->projet->enabled)) { $langs->load("projects"); print ''; - } + }*/ // Multicurrency - if ( empty($conf->multicurrency->enabled)) + if (! empty($conf->multicurrency->enabled)) { // Multicurrency code print ''; @@ -1506,12 +1532,12 @@ if ($action == 'create') $form->form_multicurrency_code($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_code, 'none'); } print ''; - + // Multicurrency rate print ''; print '
'; print $langs->trans('PaymentConditionsShort'); print '
'; @@ -1485,10 +1511,10 @@ if ($action == 'create') } } print '
'; print ''; if ($action != 'editmulticurrencyrate' && ! empty($object->brouillon)) print ''; @@ -1537,7 +1563,7 @@ if ($action == 'create') print ''; } - if (! empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL) && $conf->banque->enabled) + if (! empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL) && ! empty($conf->banque->enabled)) { // Bank Account print '
'; - print fieldLabel('Rate','multicurrency_tx'); + print fieldLabel('CurrencyRate','multicurrency_tx'); print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '
'; @@ -1559,73 +1585,80 @@ if ($action == 'create') // Other attributes $cols = 2; - if (empty($conf->margin->enabled)) $cols++; - include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; + print '
'; + + print ''; + print '
'; + print '
'; + print '
'; + + print ''; + // Amount HT - print ''; - print ''; - - // Margin Infos - if (! empty($conf->margin->enabled)) { - $rowspan=4; - if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) $rowspan++; - if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) $rowspan++; - if (!empty($conf->multicurrency->enabled)) $rowspan+=3; - print ''; - } + print ''; + print ''; print ''; // Amount VAT - print ''; - print ''; + print ''; + print ''; print ''; // Amount Local Taxes if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) // Localtax1 { - print ''; - print ''; + print ''; + print ''; print ''; } if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) // Localtax2 { print ''; - print ''; + print ''; print ''; } // Amount TTC print ''; - print ''; + print ''; print ''; if (!empty($conf->multicurrency->enabled)) { // Multicurrency Amount HT print ''; - print ''; + print ''; print ''; - + // Multicurrency Amount VAT print ''; - print ''; + print ''; print ''; - + // Multicurrency Amount TTC print ''; - print ''; - print ''; + print ''; + print ''; } // Statut - print ''; + //print ''; - print '
' . $langs->trans('AmountHT') . '' . price($object->total_ht, '', $langs, 0, - 1, - 1, $conf->currency) . ''; - $formmargin->displayMarginInfos($object); - print '
' . $langs->trans('AmountHT') . '' . price($object->total_ht, '', $langs, 0, - 1, - 1, $conf->currency) . '
' . $langs->trans('AmountVAT') . '' . price($object->total_tva, '', $langs, 0, - 1, - 1, $conf->currency) . '
' . $langs->trans('AmountVAT') . '' . price($object->total_tva, '', $langs, 0, - 1, - 1, $conf->currency) . '
' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '' . price($object->total_localtax1, '', $langs, 0, - 1, - 1, $conf->currency) . '
' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '' . price($object->total_localtax1, '', $langs, 0, - 1, - 1, $conf->currency) . '
' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '' . price($object->total_localtax2, '', $langs, 0, - 1, - 1, $conf->currency) . '' . price($object->total_localtax2, '', $langs, 0, - 1, - 1, $conf->currency) . '
' . $langs->trans('AmountTTC') . '' . price($object->total_ttc, '', $langs, 0, - 1, - 1, $conf->currency) . '' . price($object->total_ttc, '', $langs, 0, - 1, - 1, $conf->currency) . '
' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . '' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . '' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . '' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . $langs->trans('Status') . '' . $object->getLibStatut(4) . '
' . $langs->trans('Status') . '' . $object->getLibStatut(4) . '

'; + print '
'; + + // Margin Infos + /*if (! empty($conf->margin->enabled)) { + $formmargin->displayMarginInfos($object); + }*/ + print ''; + print ''; + print ''; + + print '

'; + if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) { $blocname = 'contacts'; $title = $langs->trans('ContactsAddresses'); @@ -1658,8 +1691,12 @@ if ($action == 'create') print ''; + // Add free products/services form + global $forceall, $senderissupplier, $dateSelector; + $forceall=1; $senderissupplier=2; $dateSelector=0; // $senderissupplier=2 is same than 1 but disable test on minimum qty. + if (! empty($object->lines)) - $ret = $object->printObjectLines($action, $mysoc, $soc, $lineid, 1); + $ret = $object->printObjectLines($action, $soc, $mysoc, $lineid, 1); // Form to add new line if ($object->statut == 0 && $user->rights->supplier_proposal->creer) @@ -1669,7 +1706,7 @@ if ($action == 'create') $var = true; // Add products/services form - $object->formAddObjectLine(1, $mysoc, $soc); + $object->formAddObjectLine(1, $soc, $mysoc); $parameters = array(); $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook @@ -1770,7 +1807,7 @@ if ($action == 'create') print ''; } - + // Clone if ($user->rights->supplier_proposal->creer) { print ''; @@ -1803,15 +1840,14 @@ if ($action == 'create') $var = true; - $somethingshown = $formfile->show_documents('supplier_proposal', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', 0, '', $soc->default_lang); - - // Linked object block - $somethingshown = $form->showLinkedObjectBlock($object); + print $formfile->showdocuments('supplier_proposal', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', 0, '', $soc->default_lang); + // Show links to link elements - //$linktoelem = $form->showLinkToObjectBlock($object); - //if ($linktoelem) print '
'.$linktoelem; + $linktoelem = $form->showLinkToObjectBlock($object, null, array('supplier_proposal')); + $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem); + print '
'; // List of actions on element @@ -1874,17 +1910,19 @@ if ($action == 'create') include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; $formmail = new FormMail($db); $formmail->param['langsmodels']=(empty($newlang)?$langs->defaultlang:$newlang); - $formmail->fromtype = 'user'; - $formmail->fromid = $user->id; - $formmail->fromname = $user->getFullName($langs); - $formmail->frommail = $user->email; + $formmail->fromtype = (GETPOST('fromtype')?GETPOST('fromtype'):(!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE)?$conf->global->MAIN_MAIL_DEFAULT_FROMTYPE:'user')); + + if($formmail->fromtype === 'user'){ + $formmail->fromid = $user->id; + + } $formmail->trackid='spr'.$object->id; if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set { include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; $formmail->frommail=dolAddEmailTrackId($formmail->frommail, 'spr'.$object->id); } - + $formmail->withfrom = 1; $liste = array(); foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key => $value) diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index fd7f266e159..02f0e8dd6b5 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -48,7 +48,8 @@ class SupplierProposal extends CommonObject public $table_element_line='supplier_proposaldet'; public $fk_element='fk_supplier_proposal'; protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe - + public $picto='propal'; + /** * {@inheritdoc} */ @@ -727,7 +728,7 @@ class SupplierProposal extends CommonObject * this->ref can be set or empty. If empty, we will use "(PROVid)" * * @param User $user User that create - * @param int $notrigger 1=Does not execute triggers, 0= execuete triggers + * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >=0 if OK */ function create($user, $notrigger=0) @@ -926,7 +927,7 @@ class SupplierProposal extends CommonObject if (! $notrigger) { // Call trigger - $result=$this->call_trigger('SUPPLIER_PROPOSAL_CREATE',$user); + $result=$this->call_trigger('PROPAL_SUPPLIER_CREATE',$user); if ($result < 0) { $error++; } // End call triggers } @@ -1192,8 +1193,8 @@ class SupplierProposal extends CommonObject $sql = "SELECT d.rowid, d.fk_supplier_proposal, d.fk_parent_line, d.label as custom_label, d.description, d.price, d.tva_tx, d.localtax1_tx, d.localtax2_tx, d.qty, d.fk_remise_except, d.remise_percent, d.subprice, d.fk_product,"; $sql.= " d.info_bits, d.total_ht, d.total_tva, d.total_localtax1, d.total_localtax2, d.total_ttc, d.fk_product_fournisseur_price as fk_fournprice, d.buy_price_ht as pa_ht, d.special_code, d.rang, d.product_type,"; $sql.= ' p.ref as product_ref, p.description as product_desc, p.fk_product_type, p.label as product_label,'; - $sql.= ' d.ref_fourn as ref_produit_fourn'; - $sql.= ' ,d.fk_multicurrency, d.multicurrency_code, d.multicurrency_subprice, d.multicurrency_total_ht, d.multicurrency_total_tva, d.multicurrency_total_ttc'; + $sql.= ' d.ref_fourn as ref_produit_fourn,'; + $sql.= ' d.fk_multicurrency, d.multicurrency_code, d.multicurrency_subprice, d.multicurrency_total_ht, d.multicurrency_total_tva, d.multicurrency_total_ttc'; $sql.= " FROM ".MAIN_DB_PREFIX."supplier_proposaldet as d"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON d.fk_product = p.rowid"; $sql.= " WHERE d.fk_supplier_proposal = ".$this->id; @@ -1334,7 +1335,7 @@ class SupplierProposal extends CommonObject * Set status to validated * * @param User $user Object user that validate - * @param int $notrigger 1=Does not execute triggers, 0= execuete triggers + * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >=0 if OK */ function valid($user, $notrigger=0) @@ -1542,7 +1543,7 @@ class SupplierProposal extends CommonObject * @param User $user Object user that close * @param int $statut Statut * @param string $note Comment - * @param int $notrigger 1=Does not execute triggers, 0= execuete triggers + * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ function reopen($user, $statut, $note='', $notrigger=0) @@ -1890,7 +1891,7 @@ class SupplierProposal extends CommonObject * Delete askprice * * @param User $user Object user that delete - * @param int $notrigger 1=Does not execute triggers, 0= execuete triggers + * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int 1 if ok, otherwise if error */ function delete($user, $notrigger=0) @@ -2186,7 +2187,8 @@ class SupplierProposal extends CommonObject { global $user,$langs,$conf; - // Charge tableau des produits prodids + // Load array of products prodids + $num_prods = 0; $prodids = array(); $sql = "SELECT rowid"; $sql.= " FROM ".MAIN_DB_PREFIX."product"; @@ -2366,31 +2368,60 @@ class SupplierProposal extends CommonObject * @param int $withpicto Add picto into link * @param string $option Where point the link ('compta', 'expedition', 'document', ...) * @param string $get_params Parametres added to url + * @param int $notooltip 1=Disable tooltip * @return string String with URL */ - function getNomUrl($withpicto=0,$option='', $get_params='') + function getNomUrl($withpicto=0,$option='', $get_params='', $notooltip=0) { - global $langs; + global $langs, $conf, $user; + if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips + + $url=''; $result=''; - $label=$langs->trans("ShowSupplierProposal").': '.$this->ref; - $linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; + + $label=''.$langs->trans("ShowSupplierProposal").''; + if (! empty($this->ref)) + $label.= '
'.$langs->trans('Ref').': '.$this->ref; + if (! empty($this->ref_fourn)) + $label.= '
'.$langs->trans('RefSupplier').': '.$this->ref_fourn; + if (! empty($this->total_ht)) + $label.= '
' . $langs->trans('AmountHT') . ': ' . price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency); + if (! empty($this->total_tva)) + $label.= '
' . $langs->trans('VAT') . ': ' . price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency); + if (! empty($this->total_ttc)) + $label.= '
' . $langs->trans('AmountTTC') . ': ' . price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); if ($option == '') { - $link = 'rights->propal->lire) + { + if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) + { + $label=$langs->trans("ShowSupplierProposal"); + $linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"'; + } + $linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose.=' class="classfortooltip"'; + } + + $linkstart = ''; $linkend=''; $picto='supplier_proposal'; if ($withpicto) - $result.=($link.img_object($label, $picto, 'class="classfortooltip"').$linkend); + $result.=($linkstart.img_object(($notooltip?'':$label), $picto, ($notooltip?'':'class="classfortooltip"')).$linkend); if ($withpicto && $withpicto != 2) $result.=' '; - $result.=$link.$this->ref.$linkend; + $result.=$linkstart.$this->ref.$linkend; return $result; } @@ -2723,7 +2754,7 @@ class SupplierProposalLine extends CommonObject /** * Insert object line propal in database * - * @param int $notrigger 1=Does not execute triggers, 0= execuete triggers + * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ function insert($notrigger=0) @@ -2905,7 +2936,7 @@ class SupplierProposalLine extends CommonObject /** * Update propal line object into DB * - * @param int $notrigger 1=Does not execute triggers, 0= execuete triggers + * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if ko, >0 if ok */ function update($notrigger=0) diff --git a/htdocs/supplier_proposal/document.php b/htdocs/supplier_proposal/document.php index 77844225720..d8c51a45152 100644 --- a/htdocs/supplier_proposal/document.php +++ b/htdocs/supplier_proposal/document.php @@ -115,6 +115,7 @@ if ($object->id > 0) $modulepart = 'supplier_proposal'; $permission = $user->rights->supplier_proposal->creer; + $permtoedit = $user->rights->supplier_proposal->creer; $param = '&id=' . $object->id; include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php'; } diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index 967a510d714..e51ddfcdceb 100644 --- a/htdocs/supplier_proposal/list.php +++ b/htdocs/supplier_proposal/list.php @@ -9,7 +9,8 @@ * Copyright (C) 2010-2011 Philippe Grand * Copyright (C) 2012 Christophe Battarel * Copyright (C) 2013 Cédric Salvador -* + * Copyright (C) 2016 Ferran Marcet + * * 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 @@ -61,6 +62,8 @@ $sall=GETPOST("sall"); $mesg=(GETPOST("msg") ? GETPOST("msg") : GETPOST("mesg")); $year=GETPOST("year"); $month=GETPOST("month"); +$yearvalid=GETPOST("yearvalid"); +$monthvalid=GETPOST("monthvalid"); // Nombre de ligne pour choix de produit/service predefinis $NBLINES=4; @@ -130,6 +133,8 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") ||GETPO $search_societe=''; $search_montant_ht=''; $search_author=''; + $yearvalid=''; + $monthvalid=''; $year=''; $month=''; $viewstatut=''; @@ -191,8 +196,8 @@ $companystatic=new Societe($db); $now=dol_now(); -$sql = 'SELECT s.rowid, s.nom as name, s.town, s.client, s.code_client,'; -$sql.= ' p.rowid as supplier_proposalid, p.note_private, p.total_ht, p.ref, p.fk_statut, p.fk_user_author, p.date_livraison as dp,'; +$sql = 'SELECT s.rowid as socid, s.nom as name, s.town, s.client, s.code_client,'; +$sql.= ' p.rowid, p.note_private, p.total_ht, p.ref, p.fk_statut, p.fk_user_author, p.date_valid, p.date_livraison as dp,'; if (! $user->rights->societe->client->voir && ! $socid) $sql .= " sc.fk_soc, sc.fk_user,"; $sql.= ' u.login'; $sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s, '.MAIN_DB_PREFIX.'supplier_proposal as p'; @@ -211,28 +216,13 @@ if (! $user->rights->societe->client->voir && ! $socid) //restriction { $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; } -if ($search_ref) { - $sql .= natural_search('p.ref', $search_ref); -} -if ($search_societe) { - $sql .= natural_search('s.nom', $search_societe); -} -if ($search_author) -{ - $sql.= " AND u.login LIKE '%".$db->escape(trim($search_author))."%'"; -} -if ($search_montant_ht) -{ - $sql.= " AND p.total_ht='".$db->escape(price2num(trim($search_montant_ht)))."'"; -} -if ($sall) { - $sql .= natural_search(array_keys($fieldstosearchall), $sall); -} +if ($search_ref) $sql .= natural_search('p.ref', $search_ref); +if ($search_societe) $sql .= natural_search('s.nom', $search_societe); +if ($search_author) $sql.= " AND u.login LIKE '%".$db->escape(trim($search_author))."%'"; +if ($search_montant_ht) $sql.= " AND p.total_ht='".$db->escape(price2num(trim($search_montant_ht)))."'"; +if ($sall) $sql .= natural_search(array_keys($fieldstosearchall), $sall); if ($socid) $sql.= ' AND s.rowid = '.$socid; -if ($viewstatut <> '') -{ - $sql.= ' AND p.fk_statut IN ('.$viewstatut.')'; -} +if ($viewstatut <> '') $sql.= ' AND p.fk_statut IN ('.$viewstatut.')'; if ($month > 0) { if ($year > 0 && empty($day)) @@ -246,6 +236,19 @@ else if ($year > 0) { $sql.= " AND p.date_livraison BETWEEN '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'"; } +if ($monthvalid > 0) +{ + if ($yearvalid > 0 && empty($dayvalid)) + $sql.= " AND p.date_valid BETWEEN '".$db->idate(dol_get_first_day($yearvalid,$monthvalid,false))."' AND '".$db->idate(dol_get_last_day($yearvalid,$monthvalid,false))."'"; + else if ($yearvalid > 0 && ! empty($dayvalid)) + $sql.= " AND p.date_valid BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $monthvalid, $dayvalid, $yearvalid))."' AND '".$db->idate(dol_mktime(23, 59, 59, $monthvalid, $dayvalid, $yearvalid))."'"; + else + $sql.= " AND date_format(p.date_valid, '%m') = '".$monthvalid."'"; +} +else if ($yearvalid > 0) +{ + $sql.= " AND p.date_valid BETWEEN '".$db->idate(dol_get_first_day($yearvalid,1,false))."' AND '".$db->idate(dol_get_last_day($yearvalid,12,false))."'"; +} if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$search_sale; if ($search_user > 0) { @@ -279,6 +282,7 @@ if ($result) $param='&socid='.$socid.'&viewstatut='.$viewstatut; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; + if ($sall) $param.='&sall='.$sall; if ($month) $param.='&month='.$month; if ($year) $param.='&year='.$year; if ($search_ref) $param.='&search_ref=' .$search_ref; @@ -341,6 +345,7 @@ if ($result) print '
'; print_liste_field_titre($langs->trans('Ref'),$_SERVER["PHP_SELF"],'p.ref','',$param,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans('Supplier'),$_SERVER["PHP_SELF"],'s.nom','',$param,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans('Date'),$_SERVER["PHP_SELF"],'p.date_valid','',$param, 'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans('SupplierProposalDate'),$_SERVER["PHP_SELF"],'p.date_livraison','',$param, 'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans('AmountHT'),$_SERVER["PHP_SELF"],'p.total_ht','',$param, 'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans('Author'),$_SERVER["PHP_SELF"],'u.login','',$param,'align="center"',$sortfield,$sortorder); @@ -356,6 +361,15 @@ if ($result) print ''; print ''; + // Date valid + print ''; + // Date print ''; - + // Check boxes print ''; print "\n"; @@ -390,73 +404,93 @@ if ($result) while ($i < min($num,$limit)) { - $objp = $db->fetch_object($result); + $obj = $db->fetch_object($result); $now = dol_now(); $var=!$var; + + $objectstatic->id=$obj->rowid; + $objectstatic->ref=$obj->ref; + print ''; print '\n"; - $url = DOL_URL_ROOT.'/comm/card.php?socid='.$objp->rowid; + $url = DOL_URL_ROOT.'/comm/card.php?socid='.$obj->socid; // Company - $companystatic->id=$objp->rowid; - $companystatic->name=$objp->name; - $companystatic->client=$objp->client; - $companystatic->code_client=$objp->code_client; + $companystatic->id=$obj->socid; + $companystatic->name=$obj->name; + $companystatic->client=$obj->client; + $companystatic->code_client=$obj->code_client; print ''; - // Date askprice + // Date print '\n"; + + // Date delivery + print '\n"; - print '\n"; + print '\n"; - $userstatic->id=$objp->fk_user_author; - $userstatic->login=$objp->login; + $userstatic->id=$obj->fk_user_author; + $userstatic->login=$obj->login; print '\n"; - print '\n"; + print '\n"; - print ''; + // Action column + print ''; print "\n"; - $total += $objp->total_ht; - $subtotal += $objp->total_ht; + $total += $obj->total_ht; + $subtotal += $obj->total_ht; $i++; } @@ -466,14 +500,14 @@ if ($result) if($num<$limit){ $var=!$var; print ''; - print ''; + print ''; print ''; } else { $var=!$var; print ''; - print ''; + print ''; print ''; } diff --git a/htdocs/supplier_proposal/note.php b/htdocs/supplier_proposal/note.php index a3799c0eb29..981b654599d 100644 --- a/htdocs/supplier_proposal/note.php +++ b/htdocs/supplier_proposal/note.php @@ -92,6 +92,16 @@ if ($id > 0 || ! empty($ref)) print ""; print ''; + // Payment term + print ''; + print ''; print ''; diff --git a/htdocs/support/inc.php b/htdocs/support/inc.php index 36566b0d3f5..2db312ee630 100644 --- a/htdocs/support/inc.php +++ b/htdocs/support/inc.php @@ -71,6 +71,13 @@ if (! defined('DONOTLOADCONF') && file_exists($conffile) && filesize($conffile) if (empty($dolibarr_main_db_type)) $dolibarr_main_db_type='mysql'; // For backward compatibility + //Mysql driver support has been removed in favor of mysqli + if ($dolibarr_main_db_type == 'mysql') { + $dolibarr_main_db_type = 'mysqli'; + } + + if (empty($dolibarr_main_db_port) && ($dolibarr_main_db_type=='mysqli')) $dolibarr_main_db_port='3306'; // For backward compatibility + // Clean parameters $dolibarr_main_data_root =isset($dolibarr_main_data_root)?trim($dolibarr_main_data_root):''; $dolibarr_main_url_root =isset($dolibarr_main_url_root)?trim($dolibarr_main_url_root):''; diff --git a/htdocs/theme/eldy/ckeditor/config.js b/htdocs/theme/eldy/ckeditor/config.js index cf7163671a3..eb88af48a04 100644 --- a/htdocs/theme/eldy/ckeditor/config.js +++ b/htdocs/theme/eldy/ckeditor/config.js @@ -28,7 +28,9 @@ CKEDITOR.editorConfig = function( config ) config.toolbar_Full = [ - ['Source','-','Save','NewPage','Preview','-','Templates'], + ['Templates','NewPage'], + ['Save'], + ['Source','Maximize','Preview'], ['Cut','Copy','Paste','PasteText','PasteFromWord','-','Print', 'SpellChecker', 'Scayt'], ['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'], ['Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField'], @@ -37,17 +39,17 @@ CKEDITOR.editorConfig = function( config ) ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], ['BidiLtr', 'BidiRtl'], ['Link','Unlink','Anchor'], - ['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak','Iframe'], + ['Image','Table','HorizontalRule','Smiley','SpecialChar','PageBreak','Iframe'], ['Styles','Format','Font','FontSize'], ['TextColor','BGColor'], - ['Maximize', 'ShowBlocks','-','About'] + ['Maximize', 'ShowBlocks'] ]; // Used for mailing fields config.toolbar_dolibarr_mailings = [ - ['Source','Maximize'], - ['Cut','Copy','Paste','-','SpellChecker'], + ['Source','Maximize','Preview'], + ['Cut','Copy','Paste','-','SpellChecker', 'Scayt'], ['Undo','Redo','-','Find','Replace'], ['Format','Font','FontSize'], ['Bold','Italic','Underline','Strike','Subscript','Superscript','-','TextColor','RemoveFormat'], @@ -60,7 +62,7 @@ CKEDITOR.editorConfig = function( config ) config.toolbar_dolibarr_notes = [ ['Source','Maximize'], - ['Cut','Copy','Paste','-','SpellChecker'], + ['Cut','Copy','Paste','-','SpellChecker', 'Scayt'], ['Undo','Redo','-','Find','Replace'], ['Format','Font','FontSize'], ['Bold','Italic','Underline','Strike','Subscript','Superscript','-','TextColor','RemoveFormat'], @@ -73,7 +75,7 @@ CKEDITOR.editorConfig = function( config ) config.toolbar_dolibarr_details = [ ['Source','Maximize'], - ['Cut','Copy','Paste','-','SpellChecker'], + ['Cut','Copy','Paste','-','SpellChecker', 'Scayt'], ['Format','Font','FontSize'], ['Bold','Italic','Underline','Strike','Subscript','Superscript','-','TextColor','RemoveFormat'], ['NumberedList','BulletedList','Outdent','Indent'], diff --git a/htdocs/theme/eldy/img/listlight.png b/htdocs/theme/eldy/img/listlight.png new file mode 100644 index 00000000000..c894f28ce38 Binary files /dev/null and b/htdocs/theme/eldy/img/listlight.png differ diff --git a/htdocs/theme/eldy/img/object_trip.png b/htdocs/theme/eldy/img/object_trip.png index 95cc4412111..d911bd621de 100644 Binary files a/htdocs/theme/eldy/img/object_trip.png and b/htdocs/theme/eldy/img/object_trip.png differ diff --git a/htdocs/theme/eldy/img/playdisabled.png b/htdocs/theme/eldy/img/playdisabled.png new file mode 100644 index 00000000000..1cf122679e2 Binary files /dev/null and b/htdocs/theme/eldy/img/playdisabled.png differ diff --git a/htdocs/theme/eldy/img/preview.png b/htdocs/theme/eldy/img/preview.png new file mode 100644 index 00000000000..9040bf963f7 Binary files /dev/null and b/htdocs/theme/eldy/img/preview.png differ diff --git a/htdocs/theme/eldy/img/preview_ext.png b/htdocs/theme/eldy/img/preview_ext.png new file mode 100644 index 00000000000..8bf0c65a7c0 Binary files /dev/null and b/htdocs/theme/eldy/img/preview_ext.png differ diff --git a/htdocs/theme/eldy/img/puce.png b/htdocs/theme/eldy/img/puce.png index 8c116b0dc42..55046304094 100644 Binary files a/htdocs/theme/eldy/img/puce.png and b/htdocs/theme/eldy/img/puce.png differ diff --git a/htdocs/theme/eldy/img/statut0.png b/htdocs/theme/eldy/img/statut0.png index d11252783a4..f5fce354236 100644 Binary files a/htdocs/theme/eldy/img/statut0.png and b/htdocs/theme/eldy/img/statut0.png differ diff --git a/htdocs/theme/eldy/img/statut0_40x40.png b/htdocs/theme/eldy/img/statut0_40x40.png new file mode 100644 index 00000000000..591aac8e9de Binary files /dev/null and b/htdocs/theme/eldy/img/statut0_40x40.png differ diff --git a/htdocs/theme/eldy/img/statut1.png b/htdocs/theme/eldy/img/statut1.png index 88f3b3c53a0..87b09403e68 100644 Binary files a/htdocs/theme/eldy/img/statut1.png and b/htdocs/theme/eldy/img/statut1.png differ diff --git a/htdocs/theme/eldy/img/statut1_40x40.png b/htdocs/theme/eldy/img/statut1_40x40.png new file mode 100644 index 00000000000..6def06ceaff Binary files /dev/null and b/htdocs/theme/eldy/img/statut1_40x40.png differ diff --git a/htdocs/theme/eldy/img/statut2.png b/htdocs/theme/eldy/img/statut2.png deleted file mode 100644 index ad5a7084474..00000000000 Binary files a/htdocs/theme/eldy/img/statut2.png and /dev/null differ diff --git a/htdocs/theme/eldy/img/statut3.png b/htdocs/theme/eldy/img/statut3.png index e7515796683..bf4f7b8e854 100644 Binary files a/htdocs/theme/eldy/img/statut3.png and b/htdocs/theme/eldy/img/statut3.png differ diff --git a/htdocs/theme/eldy/img/statut3_40x40.png b/htdocs/theme/eldy/img/statut3_40x40.png new file mode 100644 index 00000000000..f71ef4eb962 Binary files /dev/null and b/htdocs/theme/eldy/img/statut3_40x40.png differ diff --git a/htdocs/theme/eldy/img/statut4.png b/htdocs/theme/eldy/img/statut4.png index 6dc05edeba7..7a680ad2b2d 100644 Binary files a/htdocs/theme/eldy/img/statut4.png and b/htdocs/theme/eldy/img/statut4.png differ diff --git a/htdocs/theme/eldy/img/statut4_40x40.png b/htdocs/theme/eldy/img/statut4_40x40.png new file mode 100644 index 00000000000..2da24b66484 Binary files /dev/null and b/htdocs/theme/eldy/img/statut4_40x40.png differ diff --git a/htdocs/theme/eldy/img/statut5.png b/htdocs/theme/eldy/img/statut5.png index 53264a0515d..98bb941a0e5 100644 Binary files a/htdocs/theme/eldy/img/statut5.png and b/htdocs/theme/eldy/img/statut5.png differ diff --git a/htdocs/theme/eldy/img/statut5_40x40.png b/htdocs/theme/eldy/img/statut5_40x40.png new file mode 100644 index 00000000000..7cac0ad23ee Binary files /dev/null and b/htdocs/theme/eldy/img/statut5_40x40.png differ diff --git a/htdocs/theme/eldy/img/statut6.png b/htdocs/theme/eldy/img/statut6.png index c76ab86fe60..fe93f1a0bcc 100644 Binary files a/htdocs/theme/eldy/img/statut6.png and b/htdocs/theme/eldy/img/statut6.png differ diff --git a/htdocs/theme/eldy/img/statut6_40x40.png b/htdocs/theme/eldy/img/statut6_40x40.png new file mode 100644 index 00000000000..0b847c322e2 Binary files /dev/null and b/htdocs/theme/eldy/img/statut6_40x40.png differ diff --git a/htdocs/theme/eldy/img/statut7.png b/htdocs/theme/eldy/img/statut7.png index 8871a45519f..77476349d6d 100644 Binary files a/htdocs/theme/eldy/img/statut7.png and b/htdocs/theme/eldy/img/statut7.png differ diff --git a/htdocs/theme/eldy/img/statut7_40x40.png b/htdocs/theme/eldy/img/statut7_40x40.png new file mode 100644 index 00000000000..48314ccb183 Binary files /dev/null and b/htdocs/theme/eldy/img/statut7_40x40.png differ diff --git a/htdocs/theme/eldy/img/statut8.png b/htdocs/theme/eldy/img/statut8.png index c24d4a9dac2..2627aab8710 100644 Binary files a/htdocs/theme/eldy/img/statut8.png and b/htdocs/theme/eldy/img/statut8.png differ diff --git a/htdocs/theme/eldy/img/statut8_40x40.png b/htdocs/theme/eldy/img/statut8_40x40.png new file mode 100644 index 00000000000..0546ac2c773 Binary files /dev/null and b/htdocs/theme/eldy/img/statut8_40x40.png differ diff --git a/htdocs/theme/eldy/img/statut9.png b/htdocs/theme/eldy/img/statut9.png index 9aa2ae34620..e5304dd791b 100644 Binary files a/htdocs/theme/eldy/img/statut9.png and b/htdocs/theme/eldy/img/statut9.png differ diff --git a/htdocs/theme/eldy/img/statut9_40x40.png b/htdocs/theme/eldy/img/statut9_40x40.png new file mode 100644 index 00000000000..445eac35387 Binary files /dev/null and b/htdocs/theme/eldy/img/statut9_40x40.png differ diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 18e42d6e3be..d1bf48c4656 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -101,6 +101,7 @@ $usegradienttop=(isset($conf->global->THEME_ELDY_TOPMENU_BACK1)?0:1); $usegradienttitle=(isset($conf->global->THEME_ELDY_BACKTITLE1)?0:1); $useboldtitle=(isset($conf->global->THEME_ELDY_USEBOLDTITLE)?$conf->global->THEME_ELDY_USEBOLDTITLE:1); $borderwith=2; +$noborderline=0; // Case of option always editable if (! isset($conf->global->THEME_ELDY_BACKBODY)) $conf->global->THEME_ELDY_BACKBODY=$colorbackbody; @@ -276,7 +277,7 @@ input, input.flat, textarea, textarea.flat, form.flat select, select, select.fla } input, textarea, select { - border-radius:4px; + border-radius: 2px; border:solid 1px rgba(0,0,0,.3); border-top:solid 1px rgba(0,0,0,.3); border-bottom:solid 1px rgba(0,0,0,.2); @@ -336,7 +337,6 @@ textarea:disabled { input[type=checkbox] { background-color: transparent; border: none; box-shadow: none; } input[type=radio] { background-color: transparent; border: none; box-shadow: none; } input[type=image] { background-color: transparent; border: none; box-shadow: none; } -input[type=text] { min-width: 20px; } input:-webkit-autofill { background-color: !important; background-image:none !important; @@ -379,9 +379,9 @@ fieldset { border: 1px solid #AAAAAA !important; } filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); border: 1px solid #bbbbbb; border-bottom-color: #a2a2a2; - -webkit-border-radius: 4px; - -moz-border-radius: 4px; - border-radius: 4px; + -webkit-border-radius: 2px; + -moz-border-radius: 2px; + border-radius: 2px; -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); -moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); @@ -529,25 +529,14 @@ div.confirmmessage { div.myavailability { padding-top: 6px; } -/* Style to move picto into left of button */ -/* -.buttonactionview { - padding-left: 15px; -} -.pictoactionview { - padding-left: 10px; - margin-right: -24px; - z-index: 999999; -} -*/ .googlerefreshcal { padding-top: 4px; padding-bottom: 4px; } .checkallactions { vertical-align: top; - margin-top: 6px; - margin-left: 4px; + margin-top: 6px; + margin-left: 4px; } .selectlimit { margin-right: 10px !important; @@ -561,6 +550,18 @@ div.myavailability { text-overflow: ellipsis; white-space: nowrap; } +.tdoverflowmax100 { + max-width: 100px; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} +.tdoverflowmax300 { + max-width: 300px; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} .tdoverflowauto { max-width: 0; overflow: auto; @@ -568,6 +569,20 @@ div.myavailability { .tablelistofcalendars { margin-top: 25px !important; } +.amountalreadypaid { +} +.amountpaymentcomplete { + color: #008800; + font-weight: bold; +} +.amountremaintopay { + color: #880000; + font-weight: bold; +} +.savingdocmask { + margin-top: 6px; + margin-bottom: 12px; +} /* DOL_XXX for future usage (when left menu has been removed). If we do not use datatable */ .table-responsive { @@ -585,11 +600,22 @@ div.myavailability { .clearboth { clear:both; } .hideobject { display: none; } -.minwidth100 { min-width: 100px; } -.minwidth200 { min-width: 200px; } -.minwidth300 { min-width: 300px; } -.minwidth400 { min-width: 400px; } -.minwidth500 { min-width: 500px; } +.minwidth50 { min-width: 50px; } +/* rule to reduce top menu - 3rd reduction */ +@media only screen and (min-width: px) +{ + .minwidth100 { min-width: 100px; } + .minwidth200 { min-width: 200px; } + .minwidth300 { min-width: 300px; } + .minwidth400 { min-width: 400px; } + .minwidth500 { min-width: 500px; } + .minwidth50imp { min-width: 50px !important; } + .minwidth100imp { min-width: 100px !important; } + .minwidth200imp { min-width: 200px !important; } + .minwidth300imp { min-width: 300px !important; } + .minwidth400imp { min-width: 400px !important; } + .minwidth500imp { min-width: 500px !important; } +} .maxwidth100 { max-width: 100px; } .maxwidth150 { max-width: 150px; } .maxwidth200 { max-width: 200px; } @@ -598,25 +624,53 @@ div.myavailability { .maxwidth500 { max-width: 500px; } .minheight20 { min-height: 20px; } .minheight40 { min-height: 40px; } -.titlefield { width: 25%; } .titlefieldcreate { width: 20%; } +.titlefield { width: 25%; } +.titlefieldmiddle { width: 50%; } /* Force values for small screen */ @media only screen and (max-width: 1400px) { .titlefield { width: 30% !important; } .titlefieldcreate { width: 30% !important; } + .minwidth50imp { min-width: 50px !important; } + .minwidth100imp { min-width: 100px !important; } + .minwidth200imp { min-width: 200px !important; } + .minwidth300imp { min-width: 300px !important; } + .minwidth400imp { min-width: 300px !important; } + .minwidth500imp { min-width: 300px !important; } +} + +@media only screen and (max-width: 960px) +{ + .maxwidthonsmartphone { max-width: 100px; } + .minwidth50imp { min-width: 50px !important; } + .minwidth100imp { min-width: 50px !important; } + .minwidth200imp { min-width: 100px !important; } + .minwidth300imp { min-width: 100px !important; } + .minwidth400imp { min-width: 100px !important; } + .minwidth500imp { min-width: 100px !important; } } /* Force values for small screen */ @media only screen and (max-width: 570px) { + input[type=text] { min-width: 20px; } + .hideonsmartphone { display: none; } .noenlargeonsmartphone { width : 50px !important; display: inline !important; } .maxwidthonsmartphone { max-width: 100px; } .maxwidth100onsmartphone { max-width: 100px; } + .maxwidth150onsmartphone { max-width: 150px; } .maxwidth200onsmartphone { max-width: 200px; } .maxwidth300onsmartphone { max-width: 300px; } + .maxwidth400onsmartphone { max-width: 400px; } + .minwidth50imp { min-width: 50px !important; } + .minwidth100imp { min-width: 50px !important; } + .minwidth200imp { min-width: 50px !important; } + .minwidth300imp { min-width: 50px !important; } + .minwidth400imp { min-width: 50px !important; } + .minwidth500imp { min-width: 50px !important; } .titlefield { width: auto; } .titlefieldcreate { width: auto; } } @@ -651,7 +705,7 @@ td.showDragHandle { table-layout: fixed; } #id-right, #id-left { - padding-top: 12px; + padding-top: 16px; padding-bottom: 8px; display: table-cell; /* DOL_XXX Empeche fonctionnement correct du scroll horizontal sur tableau, avec datatable ou CSS */ @@ -767,8 +821,8 @@ div.ficheaddleft { browser->layout != 'phone') { print "padding-".$left.": 16px;\n"; } else print "margin-top: 10px;\n"; ?> } -/* Force values for small screen */ -@media only screen and (max-width: 900px) +/* Force values on one colum for small screen */ +@media only screen and (max-width: 960px) { div.fiche { margin-: px; @@ -810,6 +864,9 @@ div.ficheaddleft { div.ficheaddleft tr.liste_titre:first-child td table.nobordernopadding td { padding: 0 0 0 0; } +div.nopadding { + padding: 0 !important; +} .containercenter { display : table; @@ -824,8 +881,13 @@ div.ficheaddleft tr.liste_titre:first-child td table.nobordernopadding td { padding-left: 2px; padding-right: 2px; } -.pictowarning { - padding-left: 3px; +.pictostatus { + width: 15px; + vertical-align: middle; + margin-top: -3px +} +.pictowarning, .pictopreview { + padding-: 3px; } .colorthumb { padding-left: 1px !important; @@ -855,12 +917,12 @@ div.divphotoref { } div.statusref { float: right; - padding-right: 12px; - margin-top: 6px; + padding-left: 12px; + margin-top: 8px; margin-bottom: 10px; clear: both; } -img.photoref { +img.photoref, div.photoref { border: 1px solid #CCC; -moz-box-shadow: 3px 3px 4px #DDD; -webkit-box-shadow: 3px 3px 4px #DDD; @@ -868,7 +930,20 @@ img.photoref { padding: 4px; height: 80px; width: 80px; - object-fit: contain + object-fit: contain; +} +div.photoref { + display:table-cell; + vertical-align:middle; + text-align:center; +} + +img.photorefnoborder { + padding: 2px; + height: 48px; + width: 48px; + object-fit: contain; + border: 1px solid #CCC; } .underrefbanner { } @@ -886,8 +961,8 @@ $minwidthtmenu=66; /* minimum width for one top menu entry */ $heightmenu=46; /* height of top menu, part with image */ $heightmenu2=48; /* height of top menu, part with login */ $disableimages = 0; -$maxwidthloginblock = 110; -if (! empty($conf->global->THEME_ELDY_DISABLE_IMAGE)) { $disableimages = 1; $maxwidthloginblock = 180; $minwidthtmenu=0; } +$maxwidthloginblock = 130; +if (! empty($conf->global->THEME_TOPMENU_DISABLE_IMAGE)) { $disableimages = 1; $maxwidthloginblock = 180; $minwidthtmenu=0; } ?> div#id-top { @@ -895,6 +970,8 @@ div#id-top { display:none; background: rgb(); + /*-webkit-box-shadow: 0 0 6px rgba(0,0,0,0.4); + box-shadow: 0 0 6px rgba(0,0,0,0.4); */ background-image: linear-gradient(top, rgba(255,255,255,.1) 0%, rgba(0,0,0,.4) 100%); background-image: -o-linear-gradient(top, rgba(255,255,255,.1) 0%, rgba(0,0,0,.4) 100%); @@ -1056,6 +1133,8 @@ div.tmenucenter div.menu_titre { padding-top: 4px; padding-bottom: 4px; + overflow: hidden; + text-overflow: ellipsis; } .mainmenuaspan { @@ -1169,7 +1248,7 @@ $mainmenuusedarray=array_unique(explode(',',$mainmenuused)); $generic=1; // Put here list of menu entries when the div.mainmenu.menuentry was previously defined -$divalreadydefined=array('home','companies','products','commercial','externalsite','accountancy','project','tools','members','agenda','holiday','bookmark','cashdesk','ecm','geoipmaxmind','gravatar','clicktodial','paypal','webservices','websites'); +$divalreadydefined=array('home','companies','products','commercial','externalsite','accountancy','project','tools','members','agenda','ftp','holiday','hrm','bookmark','cashdesk','ecm','geoipmaxmind','gravatar','clicktodial','paypal','webservices','websites'); // Put here list of menu entries we are sure we don't want $divnotrequired=array('multicurrency','salaries','margin','opensurvey','paybox','expensereport','incoterm','prelevement','propal','workflow','notification','supplier_proposal','cron','product','productbatch','expedition'); foreach($mainmenuusedarray as $val) @@ -1305,9 +1384,9 @@ table.login_table_securitycode tr td { div.login_block { position: absolute; - text-align: right; + text-align: ; : 5px; - top: 2px; + top: 3px; font-weight: bold; max-width: px; @@ -1334,6 +1413,9 @@ div.login a:hover { } div.login_block_user { display: inline-block; + global->THEME_TOPMENU_DISABLE_IMAGE)) { ?> + min-width: 120px; + } div.login_block_other { display: inline-block; @@ -1343,7 +1425,7 @@ div.login_block_other { padding-top: 3px; text-align: right; } .login_block_elem { float: right; vertical-align: top; - padding: 0px 0px 0px 4px !important; + padding: 0px 3px 0px 4px !important; height: 16px; } .atoplogin, .atoplogin:hover { @@ -1419,7 +1501,7 @@ div.vmenu, td.vmenu { .companylogo { } .searchform { padding-top: 4px; } -a.vmenu:link, a.vmenu:visited, a.vmenu:hover, a.vmenu:active { font-size:px; font-family: ; text-align: ; font-weight: bold; } +a.vmenu:link, a.vmenu:visited, a.vmenu:hover, a.vmenu:active { white-space: nowrap; font-size:px; font-family: ; text-align: ; font-weight: bold; } font.vmenudisabled { font-size:px; font-family: ; text-align: ; font-weight: bold; color: #aaa; margin-left: 4px; } a.vmenu:link, a.vmenu:visited { color: #; } @@ -1510,7 +1592,7 @@ div.blockvmenuhelp text-align: center; text-decoration: none; padding-left: 0px; - padding-right: 3px; + padding-right: 6px; padding-top: 3px; padding-bottom: 3px; margin: 4px 0px 0px 0px; @@ -1714,7 +1796,7 @@ img.toolbarbutton { } /* hide the toggler-button when the pane is 'slid open' */ -.ui-layout-resizer-sliding .ui-layout-toggler { +.ui-layout-resizer-sliding .ui-layout-toggler { display: none; } @@ -1811,18 +1893,19 @@ div.tabsElem { div.tabBar { color: #; - padding-top: px; - padding-left: px; - padding-right: px; - padding-bottom: px; + padding-top: 16px; + padding-left: 0px; padding-right: 0px; + /*padding-left: 18px; + padding-right: 18px;*/ + padding-bottom: 14px; margin: 0px 0px 14px 0px; - -moz-border-radius:4px; + /*-moz-border-radius:4px; -webkit-border-radius: 4px; border-radius: 4px; border-right: 1px solid #AAA; - border-bottom: 1px solid #AAA; - border-left: 1px solid #AAA; + border-left: 1px solid #AAA; */ border-top: 1px solid #BBB; + border-bottom: 1px solid #AAA; width: auto; background: rgb(); @@ -1835,6 +1918,7 @@ div.tabBar { } div.popuptabset { padding: 6px; + background: #fff; border: 1px solid #888; } div.popuptab { @@ -1854,12 +1938,11 @@ div.tabsAction > a { a.tabTitle { color:rgba(0,0,0,.5) !important; - margin-right:10px; text-shadow:1px 1px 1px #ffffff; font-family: ; font-weight: normal !important; - padding: 4px 6px 2px 6px; - margin: 0px 6px; + padding: 4px 6px 2px 0px; + margin-right: 10px; text-decoration: none; white-space: nowrap; } @@ -1940,7 +2023,9 @@ span.tabspan { /* Boutons actions */ /* ============================================================================== */ -div.divButAction { margin-bottom: 1.4em; } +div.divButAction { + margin-bottom: 1.4em; +} span.butAction, span.butActionDelete { cursor: pointer; @@ -2005,9 +2090,9 @@ span.butAction, span.butActionDelete { filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); border: 1px solid #bbbbbb; border-bottom-color: #a2a2a2; - -webkit-border-radius: 4px; - -moz-border-radius: 4px; - border-radius: 4px; + -webkit-border-radius: 2px; + -moz-border-radius: 2px; + border-radius: 2px; -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); -moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); @@ -2160,7 +2245,7 @@ a.butAction:link, a.butAction:visited, a.butAction:hover, a.butAction:active { } End bootstrap */ -global->MAIN_BUTTON_HIDE_UNAUTHORIZED)) { ?> +global->MAIN_BUTTON_HIDE_UNAUTHORIZED) && (! $user->admin)) { ?> .butActionRefused { display: none; } @@ -2220,7 +2305,9 @@ tr.nocellnopadd td.nobordernopadding, tr.nocellnopadd td.nocellnopadd table.border, table.dataTable, .table-border, .table-border-col, .table-key-border-col, .table-val-border-col, div.border { + border: 1px solid #E0E0E0; + border-collapse: collapse !important; padding: 1px 2px 1px 3px; /* t r b l */ } @@ -2243,8 +2330,16 @@ div .tdtop { } table.border td, div.border div div.tagtd { + padding: 2px 2px 2px 2px; border: 1px solid #E0E0E0; + + padding: 3px 2px 3px 2px; + border-bottom: 1px solid #E0E0E0; + + padding: 3px 2px 3px 2px; + /* border: 1px solid #E0E0E0; */ + border-collapse: collapse; } @@ -2297,9 +2392,9 @@ table.liste, table.noborder, table.formdoc, div.noborder { -webkit-border-radius: 0.2em; border-radius: 0.2em;*/ } -.liste_titre_add td, .liste_titre_add .tagtd +.liste_titre_add td, .liste_titre_add th, .liste_titre_add .tagtd { - border-top-width: 1px; + border-top-width: 2px; border-top-color: rgb(); border-top-style: solid; } @@ -2364,6 +2459,10 @@ div.refidno { font-weight: normal; color: #444; font-size: px; + line-height: 21px; +} +div.refidno form { + display: inline-block; } div.pagination { @@ -2398,18 +2497,18 @@ div.pagination li.pagination a, div.pagination li.pagination span { dol_use_jmobile)) { ?> padding: 6px 12px; - border-color: #ccc; margin-left: -1px; line-height: 1.42857143; color: #000; text-decoration: none; - + /* + border-color: #ccc; background-color: #f5f5f5; background-image: -moz-linear-gradient(top, #ffffff, #e6e6e6); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#e6e6e6)); background-image: -webkit-linear-gradient(top, #ffffff, #e6e6e6); background-image: -o-linear-gradient(top, #ffffff, #e6e6e6); - background-image: linear-gradient(to bottom, #ffffff, #e6e6e6); + background-image: linear-gradient(to bottom, #ffffff, #e6e6e6);*/ background-repeat: repeat-x; } @@ -2457,7 +2556,7 @@ div.pagination li.noborder a:hover { div.pagination li a, div.pagination li span { background-color: #fff; - border: 1px solid #ddd; + /* border: 1px solid #ddd; */ } div.pagination li:first-child a, div.pagination li:first-child span { @@ -2593,8 +2692,6 @@ table.dataTable td { } tr.even td, tr.pair td, tr.odd td, tr.impair td, form.odd div.tagtd, form.impair div.tagtd, form.pair div.tagtd, div.impair div.tagtd, div.pair div.tagtd, div.liste_titre div.tagtd { padding: 5px 2px 5px 3px; -} -tr.even td, tr.pair td, tr.odd td, tr.impair td, form.odd div.tagtd, form.impair div.tagtd, form.pair div.tagtd, div.impair div.tagtd, div.pair div.tagtd, div.liste_titre div.tagtd { border-bottom: 1px solid #ddd; } tr.even:last-of-type td, tr.pair:last-of-type td, tr.odd:last-of-type td, tr.impair:last-of-type td { @@ -2647,11 +2744,6 @@ tr.liste_titre, tr.liste_titre_sel, form.liste_titre, form.liste_titre_sel, tabl } div.liste_titre, tr.liste_titre, tr.liste_titre_sel, form.liste_titre, form.liste_titre_sel, table.dataTable thead tr { - /* TO MATCH BOOTSTRAP */ - /*background: #ddd; - color: #000 !important;*/ - - /* TO MATCH ELDY */ background-image: -o-linear-gradient(bottom, rgba(0,0,0,0.1) 0%, rgba(,0.4) 100%); background-image: -moz-linear-gradient(bottom, rgba(0,0,0,0.1) 0%, rgba(,0.4) 100%); @@ -2668,9 +2760,9 @@ div.liste_titre, tr.liste_titre, tr.liste_titre_sel, form.liste_titre, form.list border-bottom: 1px solid #FDFFFF; text-align: ; } -tr.liste_titre th, th.liste_titre, form.liste_titre div, div.liste_titre +tr.liste_titre th, tr.liste_titre td, th.liste_titre, form.liste_titre div, div.liste_titre { - border-bottom: 1px solid #FDFFFF; + border-bottom: 1px solid #; } tr.liste_titre th, th.liste_titre, tr.liste_titre td, td.liste_titre, form.liste_titre div, div.liste_titre { @@ -2690,6 +2782,13 @@ tr.liste_titre_topborder td { text-shadow: none !important; color: rgb(); } +.liste_titre td a.notasortlink { + color: rgb(); +} +.liste_titre td a.notasortlink:hover { + background: transparent; +} + tr.liste_titre_sel th, th.liste_titre_sel, tr.liste_titre_sel td, td.liste_titre_sel, form.liste_titre_sel div { font-family: ; @@ -2716,6 +2815,9 @@ input.liste_titre { form.liste_total div { border-top: 1px solid #DDDDDD; } +tr.liste_sub_total, tr.liste_sub_total td { + border-bottom: 2px solid #aaa; +} .tableforservicepart1 .impair, .tableforservicepart1 .pair, .tableforservicepart2 .impair, .tableforservicepart2 .pair { background: #FFF; @@ -2728,8 +2830,12 @@ form.liste_total div { border-top-width: px !important; border-top-color: rgb() !important; border-top-style: solid !important; + margin: 0px 0px 0px 0px !important; +} +.paymenttable tr td:first-child, .margintable tr td:first-child +{ + padding-left: 2px; } - .margintable td { border: 0px !important; } @@ -2766,21 +2872,17 @@ div.tabBar .noborder { margin-bottom: 8px !important;*/ border: 1px solid #CCC; text-align: center; - border-radius: 4px; + border-radius: 2px; } .boxstats:hover { - - background: rgb() !important; - - background-color: #; - + box-shadow: 0px 0px 8px 0px rgba(0,0,0,0.20); } span.boxstatstext { opacity: 0.8; line-height: 18px; } span.boxstatsindicator { - font-size: 110%; + font-size: 130%; font-weight: normal; } span.dashboardlineindicator, span.dashboardlineindicatorlate { @@ -2872,7 +2974,10 @@ tr.box_pair:not(:last-child) td, tr.box_impair:not(:last-child) td { top: 5px; position: relative; } - +.boxfilter { + margin-bottom: 2px; + margin-right: 1px; +} .prod_entry_mode_free, .prod_entry_mode_predef { height: 26px !important; vertical-align: middle; @@ -3249,11 +3354,19 @@ td.hidden { } .websitetools { float: right; - padding-top: 2px; + height: 28px; +} +.websiteinputurl { + display: inline-block; + vertical-align: top; } .websiteiframenoborder { border: 0px; } +a.websitebuttonsitepreview img { + width: 26px; + display: inline-block; +} /* ============================================================================== */ @@ -3302,9 +3415,6 @@ li.cal_event { border: none; list-style-type: none; } .cal_event_busy { } .cal_peruserviewname { max-width: 100px; height: 22px; } -.topmenuimage { - background-size: 28px auto; -} /* ============================================================================== */ /* Ajax - Liste deroulante de l'autocompletion */ @@ -3729,6 +3839,7 @@ div.ecmjqft { text-align: center; min-width: px; width: auto; + max-width: 1024px; padding-left: 10px !important; padding-right: 10px !important; } @@ -3736,9 +3847,9 @@ div.ecmjqft { /* use or not ? */ div.jnotify-background { opacity : 0.95 !important; - -moz-box-shadow: 3px 3px 4px #888 !important; - -webkit-box-shadow: 3px 3px 4px #888 !important; - box-shadow: 3px 3px 4px #888 !important; + -moz-box-shadow: 2px 2px 4px #888 !important; + -webkit-box-shadow: 2px 2px 4px #888 !important; + box-shadow: 2px 2px 4px #888 !important; } /* ============================================================================== */ @@ -3852,8 +3963,18 @@ div.dataTables_length select { /* Select2 */ /* ============================================================================== */ +.select2-container .select2-choice > .select2-chosen { + margin-right: 23px; +} +.select2-container .select2-choice .select2-arrow { + border-radius: 0; +} +.select2-container-multi .select2-choices { + background-image: none; +} .select2-container .select2-choice { color: #000; + border-radius: 0; } .selectoptiondisabledwhite { background: #FFFFFF !important; @@ -4028,10 +4149,17 @@ dl.dropdown { .dropdown dd ul li { white-space: nowrap; font-weight: normal; + padding: 2px; } -.dropdown dd ul li a { - padding:5px; - display:block; +.dropdown dd ul li input[type="checkbox"] { + margin-right: 3px; +} +.dropdown dd ul li a, .dropdown dd ul li span { + padding: 3px; + display: block; +} +.dropdown dd ul li span { + color: #888; } .dropdown dd ul li a:hover { background-color:#fff; @@ -4088,7 +4216,7 @@ select { /* display: inline-block; */ /* We can't set this. This disable ability to make */ /* TODO modified by jmobile, replace jmobile with pure css*/ overflow:hidden; - white-space: nowrap; + white-space: nowrap; /* Enabling this make behaviour strange when selecting the empty value if this empty value is '' instead of ' ' */ text-overflow: ellipsis; } .fiche .ui-controlgroup { @@ -4173,23 +4301,45 @@ ul.ulmenu { } /* Style for first level menu with jmobile */ +.ui-li .ui-btn-inner a.ui-link-inherit, .ui-li-static.ui-li { + padding: 1em 15px; + display: block; +} +.ui-btn-up-c { + font-weight: normal; +} +.ui-focus, .ui-btn:focus { + -moz-box-shadow: none; + -webkit-box-shadow: none; + box-shadow: none; +} +.ui-bar-b { + /*border: 1px solid #888;*/ + border: none; + background: none; + text-shadow: none; + color: rgb() !important; +} .ui-bar-b, .lilevel0 { - border: 1px solid #888 !important; - background: rgb(); background-repeat: repeat-x; + border: none; + background: none; + text-shadow: none; + color: rgb() !important; +} +.alilevel0 { + font-weight: normal !important; +} - background-image: -o-linear-gradient(bottom, rgba(0,0,0,0.3) 0%, rgba(250,250,250,0.3) 100%); - background-image: -moz-linear-gradient(bottom, rgba(0,0,0,0.3) 0%, rgba(250,250,250,0.3) 100%); - background-image: -webkit-linear-gradient(bottom, rgba(0,0,0,0.3) 0%, rgba(250,250,250,0.3) 100%); - background-image: -ms-linear-gradient(bottom, rgba(0,0,0,0.3) 0%, rgba(250,250,250,0.3) 100%); - background-image: linear-gradient(bottom, rgba(0,0,0,0.3) 0%, rgba(250,250,250,0.3) 100%); - font-weight: bold; - - color: rgb() !important; +.ui-li.ui-last-child, .ui-li.ui-field-contain.ui-last-child { + border-bottom-width: 0px !important; } .alilevel0 { color: rgb() !important; - text-shadow: 1px 0px 1px #; +} +.ulmenu { + box-shadow: none !important; + border-bottom: 1px solid #444; } .ui-btn-icon-right { border-right: 1px solid #ccc !important; @@ -4199,7 +4349,7 @@ ul.ulmenu { text-shadow: none; } .ui-btn-up-c, .ui-btn-hover-c { - border: 1px solid #ccc; + /* border: 1px solid #ccc; */ text-shadow: none; } .ui-body-c .ui-link, .ui-body-c .ui-link:visited, .ui-body-c .ui-link:hover { @@ -4217,6 +4367,7 @@ ul.ulmenu { div.tabsElem a.tab { background: transparent; } + /*.ui-controlgroup-horizontal .ui-btn.ui-first-child { -webkit-border-top-left-radius: 6px; border-top-left-radius: 6px; @@ -4225,25 +4376,26 @@ border-top-left-radius: 6px; -webkit-border-top-right-radius: 6px; border-top-right-radius: 6px; }*/ + .alilevel1 { - color: rgb() !important; - text-shadow: 1px 0px 1px #; + color: rgb() !important; } .lilevel1 { - background-image: -webkit-gradient(linear,left top,left bottom,from( #ddd ),to( #d1d1d1 )) !important; - background-image: -webkit-linear-gradient( #ddd,#d1d1d1 ) !important; - background-image: -moz-linear-gradient( #ddd,#d1d1d1 ) !important; - background-image: -ms-linear-gradient( #ddd,#d1d1d1 ) !important; - background-image: -o-linear-gradient( #ddd,#d1d1d1 ) !important; - background-image: linear-gradient( #ddd,#d1d1d1 ) !important; + border-top: 2px solid #444; + background: #fff ! important; +} +.lilevel1 div div a { + font-weight: bold !important; } .lilevel2 { padding-left: 22px; + background: #fff ! important; } .lilevel3 { padding-left: 54px; + background: #fff ! important; } @@ -4255,7 +4407,6 @@ border-top-right-radius: 6px; .menu_choix1 a { background: url('') top left no-repeat; } - .menu_choix2 a { background: url('') top left no-repeat; } @@ -4272,12 +4423,36 @@ border-top-right-radius: 6px; padding-top: 18px; padding-left: 54px; font-size: 14px; - height: 40px; + height: 38px; } .menu_choix1 a:hover,.menu_choix2 a:hover { color: #6d3f6d; } - +.menu li.menu_choix1 { + padding-top: 6px; + padding-right: 10px; + padding-bottom: 2px; +} +.menu li.menu_choix2 { + padding-top: 6px; + padding-right: 10px; + padding-bottom: 2px; +} +@media only screen and (max-width: 767px) +{ + .menu_choix1 a, .menu_choix2 a { + background-size: 36px 36px; + height: 30px; + padding-left: 40px; + } + .menu li.menu_choix1, .menu li.menu_choix2 { + padding-left: 4px; + padding-right: 0; + } + .liste_articles { + margin-right: 0 !important; + } +} /* ============================================================================== */ @@ -4287,7 +4462,9 @@ border-top-right-radius: 6px; /* For demo pages */ img.demothumb { - box-shadow: 2px 2px 8px #888; + box-shadow: 2px 2px 8px #BBB; + margin-right: 20px; + margin-left: 10px; } @@ -4311,6 +4488,10 @@ img.demothumb { /* CSS style used for small screen */ /* ============================================================================== */ +.topmenuimage { + background-size: 22px auto; + top: 2px; +} .imgopensurveywizard { padding: 0 4px 0 4px; @@ -4324,11 +4505,27 @@ img.demothumb { width: px; } + img.demothumb { + box-shadow: 1px 1px 4px #BBB; + margin-right: 6px; + margin-left: 4px; + width: 80px; + } + + div.tabBar { + padding-left: 0px; + padding-right: 0px; + -moz-border-radius: 0; + -webkit-border-radius: 0; + border-radius: 0px; + border-right: none; + border-left: none; + } } /* nboftopmenuentries = , fontsize= */ /* rule to reduce top menu - 1st reduction */ -@media only screen and (max-width: px) +@media only screen and (max-width: px) { div.tmenucenter { max-width: px; /* size of viewport */ @@ -4342,7 +4539,7 @@ img.demothumb { font-size: 10px; } .topmenuimage { - background-size: 26px auto; + background-size: 22px auto; margin-top: 0px; } @@ -4376,7 +4573,7 @@ img.demothumb { } } /* rule to reduce top menu - 3rd reduction */ -@media only screen and (max-width: 660px) +@media only screen and (max-width: px) { /* Reduce login top right info */ .usertextatoplogin { @@ -4394,6 +4591,9 @@ img.demothumb { padding-: 78px; } + div.login_block_user { + min-width: 0; + } div.login_block { top: 2px; @@ -4402,6 +4602,9 @@ img.demothumb { max-width: 82px; } + .login_block_elem { + padding: 0 !important; + } li.tmenu, li.tmenusel { min-width: 32px; } @@ -4423,6 +4626,25 @@ img.demothumb { position: absolute; width: px; } + select { + width: 100%; + max-width: 100px; + min-width: 0 !important; + } + div.divphotoref { + padding-right: 5px; + } + img.photoref, div.photoref { + border: none; + -moz-box-shadow: none; + -webkit-box-shadow: none; + box-shadow: none; + padding: 4px; + height: 20px; + width: 20px; + object-fit: contain; + } + } global->MAIN_TESTMENUHIDER)) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { ?> + position: fixed; top: 50px; - z-index: 4; + + z-index: 200; -webkit-transform: translateZ(0); -moz-transform: translateZ(0); -ms-transform: translateZ(0); @@ -709,9 +760,12 @@ td.showDragHandle { -moz-transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); -webkit-overflow-scrolling: touch; +global->MAIN_TESTMENUHIDER)) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { ?> + overflow-x: hidden; overflow-y: auto; + } .side-nav-vert { margin-left: 228px; @@ -726,15 +780,20 @@ td.showDragHandle { margin-left: 0; } div.login_block { - border-right: none ! important; + /* border-right: none ! important; */ top: inherit !important; } .side-nav { - /*top: inherit !important;*/ +global->MAIN_TESTMENUHIDER)) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { ?> + overflow-x: initial !important; overflow-y: scroll; - /*position: initial !important;*/ + display: none; + + position: auto; + top: auto; + z-index: 200; } div.login_block { /* position: initial !important;*/ @@ -744,7 +803,14 @@ div.login_block { padding-left: 0 ! important; } #id-left { + z-index: 201; + background: #FFF; + border-right: 1px solid rgba(0,0,0,0.3); +global->MAIN_TESTMENUHIDER)) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { ?> + top: 50px ! important; + top: 60px ! important; + } div.fiche { margin-: 6px !important; @@ -787,7 +853,7 @@ div.ficheaddleft { browser->layout != 'phone') { print "padding-".$left.": 16px;\n"; } else print "margin-top: 10px;\n"; ?> } -/* Force values for small screen */ +/* Force values on one colum for small screen */ @media only screen and (max-width: 900px) { div.fiche { @@ -828,9 +894,12 @@ div.ficheaddleft { } /* For table into table into card */ -div.ficheaddleft tr.liste_titre:first-child td table.nobordernopadding td { +div.ficheaddleft tr.liste_titre:first-child td table.nobordernopadding td, div.nopadding { padding: 0 0 0 0; } +div.nopadding { + padding: 0 !important; +} table.noborder tr.liste_titre td { padding: 3px !important; @@ -849,8 +918,13 @@ table.noborder tr.liste_titre td { padding-left: 2px; padding-right: 2px; } -.pictowarning { - padding-left: 3px; +.pictostatus { + width: 15px; + vertical-align: middle; + margin-top: -3px +} +.pictowarning, .pictopreview { + padding-: 3px; } .colorthumb { padding-left: 1px !important; @@ -872,25 +946,40 @@ div.arearef { margin-bottom: 10px; } div.heightref { - min-height: 74px; + min-height: 80px; } div.divphotoref { padding-right: 20px; } div.statusref { float: right; - padding-right: 12px; + padding-left: 12px; margin-top: 8px; margin-bottom: 10px; clear: both; } -img.photoref { - height: 80px; - width: 80px; +img.photoref, div.photoref { border: 1px solid #CCC; -moz-box-shadow: 3px 3px 4px #DDD; -webkit-box-shadow: 3px 3px 4px #DDD; box-shadow: 3px 3px 4px #DDD; + padding: 4px; + height: 80px; + width: 80px; + object-fit: contain; +} +div.photoref { + display:table-cell; + vertical-align:middle; + text-align:center; +} + +img.photorefnoborder { + padding: 2px; + height: 48px; + width: 48px; + object-fit: contain; + border: 1px solid #CCC; } .underrefbanner { } @@ -909,7 +998,7 @@ $heightmenu=48; /* height of top menu, part with image */ $heightmenu2=48; /* height of top menu, ârt with login */ $disableimages = 0; $maxwidthloginblock = 110; -if (! empty($conf->global->THEME_MD_DISABLE_IMAGE)) { $heightmenu = 30; $disableimages = 1; $maxwidthloginblock = 180; $minwidthtmenu=0; } +if (! empty($conf->global->THEME_TOPMENU_DISABLE_IMAGE)) { $heightmenu = 30; $disableimages = 1; $maxwidthloginblock = 180; $minwidthtmenu=0; } ?> div#tmenu_tooltip { @@ -1068,6 +1157,8 @@ div.tmenucenter } div.menu_titre { padding-bottom: 2px; + overflow: hidden; + text-overflow: ellipsis; } .mainmenuaspan { @@ -1093,7 +1184,7 @@ div.mainmenu { div.mainmenu.home{ background-image: url(); - background-position-x: middle; + background-position-x: center; } div.mainmenu.accountancy { @@ -1181,7 +1272,7 @@ $mainmenuusedarray=array_unique(explode(',',$mainmenuused)); $generic=1; // Put here list of menu entries when the div.mainmenu.menuentry was previously defined -$divalreadydefined=array('home','companies','products','commercial','externalsite','accountancy','project','tools','members','agenda','holiday','bookmark','cashdesk','ecm','geoipmaxmind','gravatar','clicktodial','paypal','webservices','websites'); +$divalreadydefined=array('home','companies','products','commercial','externalsite','accountancy','project','tools','members','agenda','ftp','holiday','hrm','bookmark','cashdesk','ecm','geoipmaxmind','gravatar','clicktodial','paypal','webservices','websites'); // Put here list of menu entries we are sure we don't want $divnotrequired=array('multicurrency','salaries','margin','opensurvey','paybox','expensereport','incoterm','prelevement','propal','workflow','notification','supplier_proposal','cron','product','productbatch','expedition'); foreach($mainmenuusedarray as $val) @@ -1207,7 +1298,7 @@ foreach($mainmenuusedarray as $val) $url=dol_buildpath($path.'/theme/'.$theme.'/img/menus/generic'.$generic.".png",1); $found=1; if ($generic < 4) $generic++; - print "/* A mainmenu entry but img file ".$val.".png not found (check /".$val."/img/".$val.".png), so we use a generic one */\n"; + print "/* A mainmenu entry was found but img file ".$val.".png not found (check /".$val."/img/".$val.".png), so we use a generic one */\n"; } if ($found) { @@ -1323,7 +1414,11 @@ div.login_block { padding-bottom: 3px; : 0; top: 0px; +global->MAIN_TESTMENUHIDER)) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { ?> + position: absolute; + position: fixed; + font-weight: bold; z-index: 10; text-align: center; @@ -1435,7 +1530,7 @@ div.vmenu, td.vmenu { .companylogo { padding-top: 4px; } .searchform { padding-top: 8px; } -a.vmenu:link, a.vmenu:visited, a.vmenu:hover, a.vmenu:active { font-size:px; font-family: ; text-align: ; font-weight: bold; } +a.vmenu:link, a.vmenu:visited, a.vmenu:hover, a.vmenu:active { white-space: nowrap; font-size:px; font-family: ; text-align: ; font-weight: bold; } font.vmenudisabled { font-size:px; font-family: ; text-align: ; font-weight: bold; color: #aaa; margin-left: 4px; } a.vmenu:link, a.vmenu:visited { color: #; } @@ -1495,7 +1590,7 @@ div.blockvmenuhelp text-align: center; text-decoration: none; padding-left: 0px; - padding-right: 3px; + padding-right: 8px; padding-top: 3px; padding-bottom: 3px; margin: 4px 0px 0px 0px; @@ -1699,7 +1794,7 @@ img.toolbarbutton { } /* hide the toggler-button when the pane is 'slid open' */ -.ui-layout-resizer-sliding ui-layout-toggler { +.ui-layout-resizer-sliding .ui-layout-toggler { display: none; } @@ -1827,6 +1922,7 @@ div.tabsAction > a { div.popuptabset { padding: 6px; + background: #fff; border: 1px solid #888; } div.popuptab { @@ -1874,6 +1970,12 @@ a.tab:link, a.tab:visited, a.tab:hover, a.tab#active { background-image: none !important; } + +.tabunactive { /* We add some border on tabunactive to avoid change of position of title when switching tabs (border of tabunactive = border of tabactive) */ + border-right: 1px solid rgb(); + border-left: 1px solid rgb(); +} + .tabactive, a.tab#active { color: # !important; background: rgb() !important; @@ -1931,8 +2033,8 @@ span.tabspan { /* Boutons actions */ /* ============================================================================== */ -div.divButAction { - margin-bottom: 1.4em; +div.divButAction { + margin-bottom: 1.4em; vertical-align: top; } @@ -2101,10 +2203,15 @@ tr.nocellnopadd td.nobordernopadding, tr.nocellnopadd td.nocellnopadd table.border, table.dataTable, .table-border, .table-border-col, .table-key-border-col, .table-val-border-col, div.border { + border: 1px solid #f4f4f4; + border-collapse: collapse !important; padding: 1px 2px 1px 3px; /* t r b l */ } +table.borderplus { + border: 1px solid #BBB; +} .border tbody tr, .border tbody tr td { height: 20px; @@ -2115,7 +2222,7 @@ div.tabBar table.border tr { table.border td, div.border div div.tagtd { padding: 2px 2px 2px 2px; - border: 1px solid #f4f4f4; + border: 1px solid #f0f0f0; border-collapse: collapse; } @@ -2127,7 +2234,7 @@ td.border, div.tagtable div div.border { } .table-key-border-col { - width: 25%; + /* width: 25%; */ vertical-align:top; } .table-val-border-col { @@ -2170,11 +2277,12 @@ table.liste, table.noborder, table.formdoc, div.noborder { -webkit-border-radius: 0.1em; border-radius: 0.1em; } +/* #tablelines tr.liste_titre:first-child td, form.formnoborder, tr.liste_titre.trnoborder td { border-top-width: 1px; border-top-color: rgb(); border-top-style: solid; -} +}*/ table.noborder tr, div.noborder form { border-top-color: #FEFEFE; @@ -2188,6 +2296,19 @@ table.noborder tr, div.noborder form { min-height: 26px; } +.liste_titre_add td, .liste_titre_add th, .liste_titre_add .tagtd +{ + border-top-width: 2px; + border-top-color: rgb(); + border-top-style: solid; +} +.liste_titre_add td, .liste_titre_add .tagtd +{ + border-top-width: 1px; + border-top-color: rgb(); + border-top-style: solid; +} + table.liste th, table.noborder th, table.noborder tr.liste_titre td { padding: 8px 2px 8px 3px; /* t r b l */ } @@ -2241,6 +2362,10 @@ div.refidno { font-weight: normal; color: #444; font-size: px; + line-height: 21px; +} +div.refidno form { + display: inline-block; } div.pagination { @@ -2402,8 +2527,6 @@ div.pagination li.paginationafterarrows { { background: rgb() !important; - - /* background: rgba(0, 0, 0, 0.05) !important; */ } @@ -2478,7 +2601,7 @@ div.liste_titre { border-top-style: solid; } div.liste_titre_bydiv { - border-top-width: px; + border-top-width: px; border-top-color: rgb(); border-top-style: solid; @@ -2486,7 +2609,7 @@ div.liste_titre_bydiv { border-collapse: collapse; display: table; padding: 2px 0px 2px 0; - width: 100%; /* 1px more, i don't know why */ + width: 100%; } tr.liste_titre, tr.liste_titre_sel, form.liste_titre, form.liste_titre_sel, table.dataTable.tr { @@ -2494,10 +2617,6 @@ tr.liste_titre, tr.liste_titre_sel, form.liste_titre, form.liste_titre_sel, tabl } div.liste_titre, tr.liste_titre, tr.liste_titre_sel, form.liste_titre, form.liste_titre_sel, table.dataTable thead tr { - /* TO MATCH BOOTSTRAP */ - /* background: #ddd; */ - - /* TO MATCH ELDY */ background-image: -o-linear-gradient(bottom, rgba(0,0,0,0.1) 0%, rgba(250,250,250,0.3) 100%); background-image: -moz-linear-gradient(bottom, rgba(0,0,0,0.1) 0%, rgba(250,250,250,0.3) 100%); @@ -2514,9 +2633,9 @@ div.liste_titre, tr.liste_titre, tr.liste_titre_sel, form.liste_titre, form.list border-bottom: 1px solid #FDFFFF; text-align: ; } -tr.liste_titre th, th.liste_titre, form.liste_titre div, div.liste_titre +tr.liste_titre th, tr.liste_titre td, th.liste_titre, form.liste_titre div, div.liste_titre { - border-bottom: 1px solid #FDFFFF; + border-bottom: 1px solid #; } tr.liste_titre th, th.liste_titre, tr.liste_titre td, td.liste_titre, form.liste_titre div, div.liste_titre { @@ -2536,6 +2655,12 @@ tr.liste_titre_topborder td { text-shadow: none !important; color: rgb(); } +.liste_titre td a.notasortlink { + color: rgb(); +} +.liste_titre td a.notasortlink:hover { + background: transparent; +} div.liste_titre { padding-left: 3px; } @@ -2562,7 +2687,9 @@ input.liste_titre { padding: 4px; height: 20px; } - +tr.liste_sub_total, tr.liste_sub_total td { + border-bottom: 2px solid #aaa; +} .tableforservicepart1 .impair, .tableforservicepart1 .pair, .tableforservicepart2 .impair, .tableforservicepart2 .pair { background: #FFF; @@ -2575,8 +2702,12 @@ input.liste_titre { border-top-width: px !important; border-top-color: rgb() !important; border-top-style: solid !important; + margin: 0px 0px 0px 0px !important; +} +.paymenttable tr td:first-child, .margintable tr td:first-child +{ + padding-left: 2px; } - .margintable td { border: 0px !important; } @@ -2617,14 +2748,10 @@ div.tabBar .noborder { min-height: 38px; } .boxstats:hover { - - background: rgb() !important; - - background-color: #; - + box-shadow: 0px 0px 8px 0px rgba(0,0,0,0.20); } span.boxstatstext { - opacity: 0.9; + /* opacity: 0.9; Disabled. This make text on top of left menu in smartphone size */ line-height: 18px; } span.boxstatsindicator { @@ -2704,8 +2831,13 @@ tr.box_pair { tr.box_pair td, tr.box_impair td { padding: 4px; +} +tr.box_pair:not(:last-child) td, tr.box_impair:not(:last-child) td { border-bottom: 1px solid #f4f4f4; } +.noborderbottom { + border-bottom: none !important; +} .formboxfilter { vertical-align: middle; @@ -2716,6 +2848,10 @@ tr.box_pair td, tr.box_impair td { top: 5px; position: relative; } +.boxfilter { + margin-bottom: 2px; + margin-right: 1px; +} .prod_entry_mode_free, .prod_entry_mode_predef { height: 26px !important; @@ -3112,7 +3248,18 @@ td.hidden { } .websitetools { float: right; - padding-top: 2px; + height: 28px; +} +.websiteinputurl { + display: inline-block; + vertical-align: top; +} +.websiteiframenoborder { + border: 0px; +} +a.websitebuttonsitepreview img { + width: 26px; + display: inline-block; } .websiteiframenoborder { border: 0px; @@ -3529,7 +3676,7 @@ ul.filedirelem li { border: solid 1px #f4f4f4; } -ui-layout-north { +.ui-layout-north { } @@ -3591,6 +3738,7 @@ div.ecmjqft { text-align: center; min-width: px; width: auto; + max-width: 1024px; padding-left: 10px !important; padding-right: 10px !important; } @@ -3598,9 +3746,9 @@ div.ecmjqft { /* use or not ? */ div.jnotify-background { opacity : 0.95 !important; - -moz-box-shadow: 3px 3px 4px #888 !important; - -webkit-box-shadow: 3px 3px 4px #888 !important; - box-shadow: 3px 3px 4px #888 !important; + -moz-box-shadow: 2px 2px 4px #888 !important; + -webkit-box-shadow: 2px 2px 4px #888 !important; + box-shadow: 2px 2px 4px #888 !important; } /* ============================================================================== */ @@ -3715,6 +3863,12 @@ div.dataTables_length select { /* Select2 */ /* ============================================================================== */ +.select2-container .select2-choice > .select2-chosen { + margin-right: 23px; +} +.select2-container .select2-choice .select2-arrow { + border-radius: 0; +} .select2-container .select2-choice { color: #000; } @@ -3890,10 +4044,17 @@ dl.dropdown { .dropdown dd ul li { white-space: nowrap; font-weight: normal; + padding: 2px; } -.dropdown dd ul li a { - padding:5px; - display:block; +.dropdown dd ul li input[type="checkbox"] { + margin-right: 3px; +} +.dropdown dd ul li a, .dropdown dd ul li span { + padding: 3px; + display: block; +} +.dropdown dd ul li span { + color: #888; } .dropdown dd ul li a:hover { background-color:#fff; @@ -3913,6 +4074,9 @@ li.ui-li-divider .ui-link { a.ui-link, a.ui-link:hover, .ui-btn:hover, span.ui-btn-text:hover, span.ui-btn-inner:hover { text-decoration: none !important; } +.ui-body-c { + background: #fff; +} .ui-btn-inner { min-width: .4em; @@ -3947,7 +4111,7 @@ select { /* display: inline-block; */ /* We can't set this. This disable ability to make */ /* TODO modified by jmobile, replace jmobile with pure css*/ overflow:hidden; - white-space: nowrap; + white-space: nowrap; /* Enabling this make behaviour strange when selecting the empty value if this empty value is '' instead of ' ' */ text-overflow: ellipsis; } .fiche .ui-controlgroup { @@ -3980,7 +4144,7 @@ a.tab span.ui-btn-inner color: rgb(); } .liste_titre .ui-link { - color: rgb() !important; + color: rgb() !important; } a.ui-link { @@ -3992,7 +4156,7 @@ a.ui-link { { white-space: normal; overflow: hidden; - text-overflow: hidden; + text-overflow: clip; /* "hidden" : do not exists as a text-overflow value (https://developer.mozilla.org/fr/docs/Web/CSS/text-overflow) */ } /* Warning: setting this may make screen not beeing refreshed after a combo selection */ @@ -4032,23 +4196,45 @@ ul.ulmenu { } /* Style for first level menu with jmobile */ +.ui-li .ui-btn-inner a.ui-link-inherit, .ui-li-static.ui-li { + padding: 1em 15px; + display: block; +} +.ui-btn-up-c { + font-weight: normal; +} +.ui-focus, .ui-btn:focus { + -moz-box-shadow: none; + -webkit-box-shadow: none; + box-shadow: none; +} +.ui-bar-b { + /*border: 1px solid #888;*/ + border: none; + background: none; + text-shadow: none; + color: rgb() !important; +} .ui-bar-b, .lilevel0 { - border: 1px solid #888 !important; - background: rgb(); background-repeat: repeat-x; + border: none; + background: none; + text-shadow: none; + color: rgb() !important; +} +.alilevel0 { + font-weight: normal !important; +} - background-image: -o-linear-gradient(bottom, rgba(0,0,0,0.3) 0%, rgba(250,250,250,0.3) 100%); - background-image: -moz-linear-gradient(bottom, rgba(0,0,0,0.3) 0%, rgba(250,250,250,0.3) 100%); - background-image: -webkit-linear-gradient(bottom, rgba(0,0,0,0.3) 0%, rgba(250,250,250,0.3) 100%); - background-image: -ms-linear-gradient(bottom, rgba(0,0,0,0.3) 0%, rgba(250,250,250,0.3) 100%); - background-image: linear-gradient(bottom, rgba(0,0,0,0.3) 0%, rgba(250,250,250,0.3) 100%); - font-weight: bold; - - color: rgb() !important; +.ui-li.ui-last-child, .ui-li.ui-field-contain.ui-last-child { + border-bottom-width: 0px !important; } .alilevel0 { color: rgb() !important; - text-shadow: 1px 0px 1px #; +} +.ulmenu { + box-shadow: none !important; + border-bottom: 1px solid #444; } .ui-btn-icon-right { border-right: 1px solid #ccc !important; @@ -4058,7 +4244,7 @@ ul.ulmenu { text-shadow: none; } .ui-btn-up-c, .ui-btn-hover-c { - border: 1px solid #ccc; + /* border: 1px solid #ccc; */ text-shadow: none; } .ui-body-c .ui-link, .ui-body-c .ui-link:visited, .ui-body-c .ui-link:hover { @@ -4068,33 +4254,43 @@ ul.ulmenu { color: # !important; text-shadow: none !important; } -.ui-controlgroup-horizontal .ui-btn.ui-first-child { +/* +.ui-btn-up-c { + background: transparent; +} +*/ +div.tabsElem a.tab { + background: transparent; +} + +/*.ui-controlgroup-horizontal .ui-btn.ui-first-child { -webkit-border-top-left-radius: 6px; border-top-left-radius: 6px; } .ui-controlgroup-horizontal .ui-btn.ui-last-child { -webkit-border-top-right-radius: 6px; border-top-right-radius: 6px; -} +}*/ + .alilevel1 { - color: rgb() !important; - text-shadow: 1px 0px 1px #; + color: rgb() !important; } .lilevel1 { - background-image: -webkit-gradient(linear,left top,left bottom,from( #f4f4f4 ),to( #d1d1d1 )) !important; - background-image: -webkit-linear-gradient( #f4f4f4,#d1d1d1 ) !important; - background-image: -moz-linear-gradient( #f4f4f4,#d1d1d1 ) !important; - background-image: -ms-linear-gradient( #f4f4f4,#d1d1d1 ) !important; - background-image: -o-linear-gradient( #f4f4f4,#d1d1d1 ) !important; - background-image: linear-gradient( #f4f4f4,#d1d1d1 ) !important; + border-top: 2px solid #444; + background: #fff ! important; +} +.lilevel1 div div a { + font-weight: bold !important; } .lilevel2 { padding-left: 22px; + background: #fff ! important; } .lilevel3 { padding-left: 54px; + background: #fff ! important; } @@ -4130,7 +4326,31 @@ border-top-right-radius: 6px; .menu_choix1 a:hover,.menu_choix2 a:hover { color: #6d3f6d; } - +.menu li.menu_choix1 { + padding-top: 6px; + padding-right: 10px; + padding-bottom: 2px; +} +.menu li.menu_choix2 { + padding-top: 6px; + padding-right: 10px; + padding-bottom: 2px; +} +@media only screen and (max-width: 767px) +{ + .menu_choix1 a, .menu_choix2 a { + background-size: 36px 36px; + background-position-y: 6px; + padding-left: 40px; + } + .menu li.menu_choix1, .menu li.menu_choix2 { + padding-left: 4px; + padding-right: 0; + } + .liste_articles { + margin-right: 0 !important; + } +} @@ -4175,7 +4395,9 @@ img.demothumb { -/***** CSS style used for small screen *****/ +/* ============================================================================== */ +/* CSS style used for small screen */ +/* ============================================================================== */ .imgopensurveywizard { @@ -4189,6 +4411,24 @@ img.demothumb { position: absolute; width: px; } + + img.demothumb { + box-shadow: 1px 1px 4px #BBB; + margin-right: 6px; + margin-left: 4px; + width: 80px; + } + + div.tabBar { + padding-left: 0px; + padding-right: 0px; + -moz-border-radius: 0; + -webkit-border-radius: 0; + border-radius: 0px; + border-right: none; + border-left: none; + } + } @@ -4267,6 +4507,25 @@ img.demothumb { position: absolute; width: px; } + select { + width: 100%; + max-width: 100px; + min-width: 0 !important; + } + div.divphotoref { + padding-right: 5px; + } + img.photoref, div.photoref { + border: none; + -moz-box-shadow: none; + -webkit-box-shadow: none; + box-shadow: none; + padding: 4px; + height: 20px; + width: 20px; + object-fit: contain; + } + } diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 28b1040f579..d2c96ab7950 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -54,6 +54,7 @@ $mode = GETPOST('mode','alpha'); $confirm = GETPOST('confirm','alpha'); $subaction = GETPOST('subaction','alpha'); $group = GETPOST("group","int",3); +$cancel = GETPOST('cancel'); // Define value to know what current user can do on users $canadduser=(! empty($user->admin) || $user->rights->user->user->creer); @@ -215,6 +216,8 @@ if (empty($reshook)) { $object->weeklyhours = GETPOST("weeklyhours") != '' ? GETPOST("weeklyhours") : ''; $object->color = GETPOST("color") != '' ? GETPOST("color") : ''; + $dateemployment = dol_mktime(0, 0, 0, GETPOST('dateemploymentmonth'), GETPOST('dateemploymentday'), GETPOST('dateemploymentyear')); + $object->dateemployment = $dateemployment; // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost($extralabels, $object); @@ -262,10 +265,7 @@ if (empty($reshook)) { { $langs->load("errors"); $db->rollback(); - if (is_array($object->errors) && count($object->errors)) - { - setEventMessages($object->error, $object->errors, 'errors'); - } + setEventMessages($object->error, $object->errors, 'errors'); $action = "create"; // Go back to create page } } @@ -299,7 +299,8 @@ if (empty($reshook)) { } } - if ($action == 'update' && !$_POST["cancel"]) { + if ($action == 'update' && ! $cancel) + { require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; if ($caneditfield) // Case we can edit all field @@ -358,6 +359,8 @@ if (empty($reshook)) { $object->weeklyhours = GETPOST("weeklyhours") != '' ? GETPOST("weeklyhours") : ''; $object->color = GETPOST("color") != '' ? GETPOST("color") : ''; + $dateemployment = dol_mktime(0, 0, 0, GETPOST('dateemploymentmonth'), GETPOST('dateemploymentday'), GETPOST('dateemploymentyear')); + $object->dateemployment = $dateemployment; if (! empty($conf->multicompany->enabled)) { @@ -395,7 +398,7 @@ if (empty($reshook)) { if (!$error) { $ret = $object->update($user); if ($ret < 0) { - $error ++; + $error++; if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $langs->load("errors"); setEventMessages($langs->trans("ErrorLoginAlreadyExists", $object->login), null, 'errors'); @@ -751,7 +754,7 @@ if (($action == 'create') || ($action == 'adduserldap')) // Employee print ''; print ''; // Position/Job @@ -1058,6 +1061,13 @@ if (($action == 'create') || ($action == 'adduserldap')) print ''; print ''; print "\n"; + + // Date employment + print ''; + print ''; + print "\n"; // Accountancy code if ($conf->accounting->enabled) @@ -1129,6 +1139,10 @@ else $object->fetch($id); if ($res < 0) { dol_print_error($db,$object->error); exit; } $res=$object->fetch_optionals($object->id,$extralabels); + + // Check if user has rights + $object->getrights(); + if(empty($object->nb_rights)) setEventMessages($langs->trans('UserHasNoPermissions'), null, 'warnings'); // Connexion ldap // pour recuperer passDoNotExpire et userChangePassNextLogon @@ -1413,6 +1427,13 @@ else print ''; } + // Date employment + print ''; + print ''; + print "\n"; + print '
'; + //print $langs->trans('Month').': '; + print ''; + //print ' '.$langs->trans('Year').': '; + $syearvalid = $yearvalid; + $formother->select_year($syearvalid,'yearvalid',1, 20, 5); + print ''; //print $langs->trans('Month').': '; @@ -376,10 +390,10 @@ if ($result) print ''; $formsupplier_proposal->selectSupplierProposalStatus($viewstatut,1); print ''; - print ''; - print ''; + $searchpitco=$form->showFilterAndCheckAddButtons(0); + print $searchpitco; print '
'; - $objectstatic->id=$objp->supplier_proposalid; - $objectstatic->ref=$objp->ref; - print ''; + // Picto + Ref print ''; - - print ''; - - // Ref + if ($warnornote) + { + print ''; + } + // Other picto tool print '
'; print $objectstatic->getNomUrl(1); print ''; - if ($objp->fk_statut == 1 && $db->jdate($objp->dfv) < ($now - $conf->supplier_proposal->cloture->warning_delay)) print img_warning($langs->trans("Late")); - if (! empty($objp->note_private)) + // Warning + $warnornote=''; + if ($obj->fk_statut == 1 && $db->jdate($obj->date_valid) < ($now - $conf->supplier_proposal->warning_delay)) $warnornote.=img_warning($langs->trans("Late")); + if (! empty($obj->note_private)) { - print ' '; - print ''.img_picto($langs->trans("ViewPrivateNote"),'object_generic').''; - print ''; + $warnornote.=($warnornote?' ':''); + $warnornote.= ''; + $warnornote.= ''.img_picto($langs->trans("ViewPrivateNote"),'object_generic').''; + $warnornote.= ''; } - print ''; + print $warnornote; + print ''; - $filename=dol_sanitizeFileName($objp->ref); - $filedir=$conf->supplier_proposal->dir_output . '/' . dol_sanitizeFileName($objp->ref); - $urlsource=$_SERVER['PHP_SELF'].'?id='.$objp->supplier_proposalid; + $filename=dol_sanitizeFileName($obj->ref); + $filedir=$conf->supplier_proposal->dir_output . '/' . dol_sanitizeFileName($obj->ref); + $urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid; print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir); print '
'; print "
'; print $companystatic->getNomUrl(1,'customer'); print ''; - print dol_print_date($db->jdate($objp->dp), 'day'); + print dol_print_date($db->jdate($obj->date_valid), 'day'); + print "'; + print dol_print_date($db->jdate($obj->dp), 'day'); print "'.price($objp->total_ht)."'.price($obj->total_ht)."'; if ($userstatic->id) print $userstatic->getLoginUrl(1); else print ' '; print "'.$objectstatic->LibStatut($objp->fk_statut,5)."'.$objectstatic->LibStatut($obj->fk_statut,5)." '; + 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 ''; + } + print '
'.$langs->trans("TotalHT").''.price($total).''.price($total).'
'.$langs->trans("TotalHTforthispage").''.price($total).''.price($total).'
".$langs->trans("Supplier")."'.$object->thirdparty->getNomUrl(1).'
'; + print ''; + print '
'; + print $langs->trans('PaymentConditionsShort'); + print '
'; + print '
'; + $form->form_conditions_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->cond_reglement_id, 'none', 1); + print '
'.$langs->trans('SupplierProposalDate').''; print dol_print_date($object->date_livraison,'daytext'); print '
'.fieldLabel('Employee','employee',0).''; - print $form->selectyesno("employee",(isset($_POST['employee'])?GETPOST('employee'):0),1); + print $form->selectyesno("employee",(GETPOST('employee')?GETPOST('employee'):0),1); print '
'.$langs->trans("DateEmployment").''; + echo $form->select_date(GETPOST('dateemployment'),'dateemployment',0,0,1,'form'.'dateemployment',1,0,1); + print '
'.$object->accountancy_code.'
'.$langs->trans("DateEmployment").''; + print dol_print_date($object->dateemployment); + print '
'; print ''; @@ -1440,6 +1461,49 @@ else print '
'.$langs->trans("Entity").''; + if (empty($object->entity)) + { + print $langs->trans("AllEntities"); + } + else + { + $mc->getInfo($object->entity); + print $mc->label; + } + print "
'.$langs->trans("OpenIDURL").''.$object->openid.'
'.$langs->trans("LastConnexion").''.dol_print_date($object->datelastlogin,"dayhour").'
'.$langs->trans("PreviousConnexion").''.dol_print_date($object->datepreviouslogin,"dayhour").'
'.$langs->trans("Entity").''; - if (empty($object->entity)) - { - print $langs->trans("AllEntities"); - } - else - { - $mc->getInfo($object->entity); - print $mc->label; - } - print "
'.$langs->trans("OpenIDURL").''.$object->openid.'
'.$langs->trans("LastConnexion").''.dol_print_date($object->datelastlogin,"dayhour").'
'.$langs->trans("PreviousConnexion").''.dol_print_date($object->datepreviouslogin,"dayhour").'
\n"; print '
'; @@ -1763,15 +1784,6 @@ else dol_fiche_head($head, 'user', $title, 0, 'user'); - $rowspan=22; - if (isset($conf->file->main_authentication) && preg_match('/openid/',$conf->file->main_authentication) && ! empty($conf->global->MAIN_OPENIDURL_PERUSER)) $rowspan++; - if (! empty($conf->societe->enabled)) $rowspan++; - if (! empty($conf->adherent->enabled)) $rowspan++; - if (! empty($conf->skype->enabled)) $rowspan++; - if (! empty($conf->salaries->enabled) && ! empty($user->rights->salaries->read)) $rowspan = $rowspan+3; - if (! empty($conf->agenda->enabled)) $rowspan++; - if (! empty($conf->accounting->enabled)) $rowspan++; - print ''; // Ref/ID @@ -1798,12 +1810,6 @@ else print $object->lastname; } print ''; - - // Photo - print ''; - print ''; // Firstname @@ -1820,6 +1826,14 @@ else } print ''; + // Photo + print ''; + print ''; + print ''; + print ''; + // Employee print ''; print ''; print "\n"; + // Date employment + print ''; + print ''; + print "\n"; + // Accountancy code if ($conf->accounting->enabled) { @@ -2222,7 +2243,7 @@ else print '"; print ''; diff --git a/htdocs/user/group/perms.php b/htdocs/user/group/perms.php index 9ffda5e96c8..50b1bc56c5e 100644 --- a/htdocs/user/group/perms.php +++ b/htdocs/user/group/perms.php @@ -299,7 +299,7 @@ if ($id) // Own permission by group if ($caneditperms) { - print ''; + print ''; } print ''; + print ''; } print ''; } - $perm_libelle=($conf->global->MAIN_USE_ADVANCED_PERMS && ($langs->trans("PermissionAdvanced".$obj->id)!=("PermissionAdvanced".$obj->id))?$langs->trans("PermissionAdvanced".$obj->id):(($langs->trans("Permission".$obj->id)!=("Permission".$obj->id))?$langs->trans("Permission".$obj->id):$obj->libelle)); + $perm_libelle=($conf->global->MAIN_USE_ADVANCED_PERMS && ($langs->trans("PermissionAdvanced".$obj->id)!=("PermissionAdvanced".$obj->id))?$langs->trans("PermissionAdvanced".$obj->id):(($langs->trans("Permission".$obj->id)!=("Permission".$obj->id))?$langs->trans("Permission".$obj->id):$langs->trans($obj->libelle))); print ''; print ''; diff --git a/htdocs/user/home.php b/htdocs/user/home.php index 6bcd468f62e..a5e9db67867 100644 --- a/htdocs/user/home.php +++ b/htdocs/user/home.php @@ -139,7 +139,7 @@ if ($resql) $fuserstatic->email = $obj->email; $fuserstatic->skype = $obj->skype; $fuserstatic->societe_id = $obj->fk_soc; - print $fuserstatic->getNomUrl(1); + print $fuserstatic->getNomUrl(-1); if (! empty($conf->multicompany->enabled) && $obj->admin && ! $obj->entity) { print img_picto($langs->trans("SuperAdministrator"),'redstar'); diff --git a/htdocs/user/index.php b/htdocs/user/index.php index f7927cee665..459a89e573b 100644 --- a/htdocs/user/index.php +++ b/htdocs/user/index.php @@ -57,8 +57,11 @@ $pagenext = $page + 1; if (! $sortfield) $sortfield="u.login"; if (! $sortorder) $sortorder="ASC"; +// Initialize context for list +$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'userlist'; + // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array -$hookmanager->initHooks(array('userlist')); +$hookmanager->initHooks(array($contextpage)); $extrafields = new ExtraFields($db); // fetch optionals attributes and labels @@ -168,8 +171,6 @@ llxHeader('',$langs->trans("ListOfUsers")); $buttonviewhierarchy=''; -print load_fiche_titre($langs->trans("ListOfUsers"), $buttonviewhierarchy); - $sql = "SELECT u.rowid, u.lastname, u.firstname, u.admin, u.fk_soc, u.login, u.email, u.accountancy_code, u.gender, u.employee, u.photo,"; $sql.= " u.datelastlogin, u.datepreviouslogin,"; $sql.= " u.ldap_sid, u.statut, u.entity,"; @@ -227,7 +228,15 @@ $parameters=array(); $reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook $sql.=$hookmanager->resPrint; $sql.=$db->order($sortfield,$sortorder); -//$sql.= $db->plimit($conf->liste_limit+1, $offset); + +$nbtotalofrecords=0; +$result=$db->query($sql); +if ($result) +{ + $nbtotalofrecords = $db->num_rows($result); +} + +$sql.= $db->plimit($limit+1, $offset); $result = $db->query($sql); if ($result) @@ -236,6 +245,8 @@ if ($result) $i = 0; $param=''; + if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; + if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; if ($sall != '') $param.='&sall='.urlencode($sall); if ($search_user != '') $param.="&search_user=".$search_user; if ($search_login != '') $param.="&search_login=".$search_login; @@ -248,6 +259,7 @@ if ($result) if ($search_supervisor > 0) $param.="&search_supervisor=".$search_supervisor; if ($search_statut != '') $param.="&search_statut=".$search_statut; if ($optioncss != '') $param.='&optioncss='.$optioncss; + if ($mode != '') $param.='&mode='.$mode; // Add $param from extra fields foreach ($search_array_options as $key => $val) { @@ -256,6 +268,7 @@ if ($result) if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val); } + $text = $langs->trans("ListOfUsers"); print ''."\n"; if ($optioncss != '') print ''; @@ -263,8 +276,12 @@ if ($result) print ''; print ''; print ''; - - if ($sall) + print ''; + print ''; + + print_barre_liste($text, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, "", $num, $nbtotalofrecords, 'title_generic', 0, '', '', $limit); + + if ($sall) { foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); @@ -423,8 +440,8 @@ if ($result) $user2=new User($db); $var=True; - //while ($i < min($num,$conf->liste_limit)) - while ($i < $num) + $i = 0; + while ($i < min($num,$limit)) { $obj = $db->fetch_object($result); $var=!$var; diff --git a/htdocs/user/info.php b/htdocs/user/info.php index 1d10875b3eb..e27fcf56266 100644 --- a/htdocs/user/info.php +++ b/htdocs/user/info.php @@ -76,7 +76,6 @@ $object->info($id); // This overwrite ->ref with login instead of id print '
'; - print '
'; print '
'; diff --git a/htdocs/user/notify/card.php b/htdocs/user/notify/card.php new file mode 100644 index 00000000000..ec3691e85db --- /dev/null +++ b/htdocs/user/notify/card.php @@ -0,0 +1,479 @@ + + * Copyright (C) 2004-2014 Laurent Destailleur + * Copyright (C) 2010-2014 Juanjo Menent + * Copyright (C) 2015 Marcos García + * Copyright (C) 2016 Abbes Bahfir + * + * 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 . + */ + +/** + * \file htdocs/user/notify/card.php + * \ingroup user notification + * \brief Tab for notifications of third party + */ + +require '../../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/notify.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/triggers/interface_50_modNotification_Notification.class.php'; + +$langs->load("companies"); +$langs->load("mails"); +$langs->load("admin"); +$langs->load("other"); + +$id = GETPOST("id",'int'); +$action = GETPOST('action'); +$actionid=GETPOST('actionid'); + +// Security check +if ($user->societe_id) $id=$user->societe_id; +$result = restrictedArea($user, 'societe','',''); + +$sortfield = GETPOST("sortfield",'alpha'); +$sortorder = GETPOST("sortorder",'alpha'); +$page = GETPOST("page",'int'); +if ($page == -1) { $page = 0; } +$offset = $conf->liste_limit * $page; +$pageprev = $page - 1; +$pagenext = $page + 1; +if (! $sortorder) $sortorder="DESC"; +if (! $sortfield) $sortfield="n.daten"; + +$now=dol_now(); + + +/* + * Actions + */ + +// Add a notification +if ($action == 'add') +{ + $error=0; + + if ($actionid <= 0) + { + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Action")), 'errors'); + $error++; + } + + if (! $error) + { + $db->begin(); + + $sql = "DELETE FROM ".MAIN_DB_PREFIX."notify_def"; + $sql .= " WHERE fk_user=".$id." AND fk_action=".$actionid; + if ($db->query($sql)) + { + $sql = "INSERT INTO ".MAIN_DB_PREFIX."notify_def (datec,fk_user, fk_action)"; + $sql .= " VALUES ('".$db->idate($now)."',".$id.",".$actionid.")"; + + if (! $db->query($sql)) + { + $error++; + dol_print_error($db); + } + } + else + { + dol_print_error($db); + } + + if (! $error) + { + $db->commit(); + } + else + { + $db->rollback(); + } + } +} + +// Remove a notification +if ($action == 'delete') +{ + $sql = "DELETE FROM ".MAIN_DB_PREFIX."notify_def where rowid=".$_GET["actid"]; + $db->query($sql); +} + + + +/* + * View + */ + +$form = new Form($db); + +$object = new User($db); +$result=$object->fetch($id); + +$title=$langs->trans("ThirdParty").' - '.$langs->trans("Notification"); +if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name.' - '.$langs->trans("Notification"); +$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; +llxHeader('',$title,$help_url); + + +if ($result > 0) +{ + $langs->load("other"); + + $head = user_prepare_head($object); + + dol_fiche_head($head, 'notify', $langs->trans("User"),0,'user'); + + $linkback = ''.$langs->trans("BackToList").''; + + dol_banner_tab($object, 'id', $linkback, $user->rights->user->user->lire || $user->admin); + + /*print '
'; - print $form->showphoto('userphoto',$object,100,0,$caneditfield,'photowithmargin','small'); - print '
'.$langs->trans("Photo").''; + print $form->showphoto('userphoto',$object,100,0,$caneditfield,'photowithmargin','small'); + print '
'.fieldLabel('Employee','employee',0).''; @@ -2187,6 +2201,13 @@ else print '
'.$langs->trans("DateEmployment").''; + echo $form->select_date(GETPOST('dateemployment')?GETPOST('dateemployment'):$object->dateemployment,'dateemployment',0,0,1,'form'.'dateemployment',1,0,1); + print '
'; $cate_arbo = $form->select_all_categories( Categorie::TYPE_CONTACT, null, null, null, null, 1 ); $c = new Categorie( $db ); - $cats = $c->containing( $object->id, 'user' ); + $cats = $c->containing($object->id, Categorie::TYPE_USER); foreach ($cats as $cat) { $arrayselected[] = $cat->id; } diff --git a/htdocs/user/class/api_user.class.php b/htdocs/user/class/api_deprecated_user.class.php similarity index 93% rename from htdocs/user/class/api_user.class.php rename to htdocs/user/class/api_deprecated_user.class.php index e89a5faac0b..f080e8a3b45 100644 --- a/htdocs/user/class/api_user.class.php +++ b/htdocs/user/class/api_deprecated_user.class.php @@ -25,7 +25,7 @@ use Luracast\Restler\RestException; * @smart-auto-routing false * @access protected * @class DolibarrApiAccess {@requires user,external} - * + * @deprecated Use Users instead (defined in api_users.class.php) */ class UserApi extends DolibarrApi { @@ -43,7 +43,7 @@ class UserApi extends DolibarrApi public $useraccount; /** - * Constructor + * Constructor Warning: Deprecated * * @url user/ * @@ -55,7 +55,7 @@ class UserApi extends DolibarrApi } /** - * Get properties of an user object + * Get properties of an user object Warning: Deprecated * * Return an array with user informations * @@ -85,7 +85,7 @@ class UserApi extends DolibarrApi } /** - * Create useraccount object from contact + * Create useraccount object from contact Warning: Deprecated * * @param int $contactid Id of contact * @param array $request_data Request datas @@ -129,7 +129,7 @@ class UserApi extends DolibarrApi /** - * Create user account + * Create user account Warning: Deprecated * * @param array $request_data New user data * @return int @@ -165,7 +165,7 @@ class UserApi extends DolibarrApi /** - * Update account + * Update account Warning: Deprecated * * @param int $id Id of account to update * @param array $request_data Datas @@ -201,7 +201,7 @@ class UserApi extends DolibarrApi } /** - * add user to group + * add user to group Warning: Deprecated * * @param int $id User ID * @param int $group Group ID @@ -228,7 +228,7 @@ class UserApi extends DolibarrApi } /** - * Delete account + * Delete account Warning: Deprecated * * @param int $id Account ID * @return array @@ -256,7 +256,7 @@ class UserApi extends DolibarrApi /** * Validate fields before create or update object * - * @param array $data Data to validate + * @param array|null $data Data to validate * @return array * @throws RestException */ diff --git a/htdocs/user/class/api_users.class.php b/htdocs/user/class/api_users.class.php new file mode 100644 index 00000000000..e177b4d52ec --- /dev/null +++ b/htdocs/user/class/api_users.class.php @@ -0,0 +1,294 @@ + + * + * 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 . + */ + +use Luracast\Restler\RestException; + +//require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; + +/** + * API class for users + * + * @access protected + * @class DolibarrApiAccess {@requires user,external} + */ +class Users extends DolibarrApi +{ + /** + * + * @var array $FIELDS Mandatory fields, checked when create and update object + */ + static $FIELDS = array( + 'login' + ); + + /** + * @var User $user {@type User} + */ + public $useraccount; + + /** + * Constructor + */ + function __construct() { + global $db, $conf; + $this->db = $db; + $this->useraccount = new User($this->db); + } + + + /** + * List Users + * + * Get a list of Users + * + * @param string $sortfield Sort field + * @param string $sortorder Sort order + * @param int $limit Limit for list + * @param int $page Page number + * @param string $user_ids User ids filter field. Example: '1' or '1,2,3' {@pattern /^[0-9,]*$/i} + * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" + * @return array Array of User objects + */ + function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 0, $page = 0, $user_ids = 0, $sqlfilters = '') { + global $db, $conf; + + $obj_ret = array(); + + if(! DolibarrApiAccess::$user->rights->user->user->lire) { + throw new RestException(401, "You are not allowed to read list of users"); + } + + // case of external user, $societe param is ignored and replaced by user's socid + //$socid = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : $societe; + + $sql = "SELECT t.rowid"; + $sql.= " FROM ".MAIN_DB_PREFIX."user as t"; + $sql.= ' WHERE t.entity IN ('.getEntity('user', 1).')'; + if ($user_ids) $sql.=" AND t.rowid IN (".$user_ids.")"; + // Add sql filters + if ($sqlfilters) + { + if (! DolibarrApi::_checkFilters($sqlfilters)) + { + throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); + } + $regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; + } + + $sql.= $db->order($sortfield, $sortorder); + if ($limit) { + if ($page < 0) + { + $page = 0; + } + $offset = $limit * $page; + + $sql.= $db->plimit($limit + 1, $offset); + } + + $result = $db->query($sql); + + if ($result) + { + $num = $db->num_rows($result); + while ($i < min($num, ($limit <= 0 ? $num : $limit))) + { + $obj = $db->fetch_object($result); + $user_static = new User($db); + if($user_static->fetch($obj->rowid)) { + $obj_ret[] = parent::_cleanObjectDatas($user_static); + } + $i++; + } + } + else { + throw new RestException(503, 'Error when retrieve User list'); + } + if( ! count($obj_ret)) { + throw new RestException(404, 'No User found'); + } + return $obj_ret; + } + + /** + * Get properties of an user object + * + * Return an array with user informations + * + * @param int $id ID of user + * @return array|mixed data without useless information + * + * @throws RestException + */ + function get($id) { + //if (!DolibarrApiAccess::$user->rights->user->user->lire) { + //throw new RestException(401); + //} + + $result = $this->useraccount->fetch($id); + if (!$result) + { + throw new RestException(404, 'User not found'); + } + + if (!DolibarrApi::_checkAccessToResource('user', $this->useraccount->id, 'user')) + { + throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login); + } + + return $this->_cleanObjectDatas($this->useraccount); + } + + + /** + * Create user account + * + * @param array $request_data New user data + * @return int + */ + function post($request_data = NULL) { + // check user authorization + //if(! DolibarrApiAccess::$user->rights->user->creer) { + // throw new RestException(401, "User creation not allowed"); + //} + // check mandatory fields + /*if (!isset($request_data["login"])) + throw new RestException(400, "login field missing"); + if (!isset($request_data["password"])) + throw new RestException(400, "password field missing"); + if (!isset($request_data["lastname"])) + throw new RestException(400, "lastname field missing");*/ + //assign field values + $xxx=var_export($request_data, true); + dol_syslog("xxx=".$xxx); + foreach ($request_data as $field => $value) + { + $this->useraccount->$field = $value; + } + + $result = $this->useraccount->create(DolibarrApiAccess::$user); + if ($result <=0) { + throw new RestException(500, "User not created : ".$this->useraccount->error); + } + return array('id'=>$result); + } + + + /** + * Update account + * + * @param int $id Id of account to update + * @param array $request_data Datas + * @return int + */ + function put($id, $request_data = NULL) { + //if (!DolibarrApiAccess::$user->rights->user->user->creer) { + //throw new RestException(401); + //} + + $result = $this->useraccount->fetch($id); + if (!$result) + { + throw new RestException(404, 'Account not found'); + } + + if (!DolibarrApi::_checkAccessToResource('user', $this->useraccount->id, 'user')) + { + throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login); + } + + foreach ($request_data as $field => $value) + { + $this->useraccount->$field = $value; + } + + if ($this->useraccount->update(DolibarrApiAccess::$user, 1)) + return $this->get($id); + + return false; + } + + /** + * add user to group + * + * @param int $id User ID + * @param int $group Group ID + * @return int + * + * @url GET {id}/setGroup/{group} + */ + function setGroup($id, $group) { + //if (!DolibarrApiAccess::$user->rights->user->user->supprimer) { + //throw new RestException(401); + //} + $result = $this->useraccount->fetch($id); + if (!$result) + { + throw new RestException(404, 'User not found'); + } + + if (!DolibarrApi::_checkAccessToResource('user', $this->useraccount->id, 'user')) + { + throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login); + } + + return $this->useraccount->SetInGroup($group,1); + } + + /** + * Delete account + * + * @param int $id Account ID + * @return array + */ + function delete($id) { + //if (!DolibarrApiAccess::$user->rights->user->user->supprimer) { + //throw new RestException(401); + //} + $result = $this->useraccount->fetch($id); + if (!$result) + { + throw new RestException(404, 'User not found'); + } + + if (!DolibarrApi::_checkAccessToResource('user', $this->useraccount->id, 'user')) + { + throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login); + } + + return $this->useraccount->delete($id); + } + + /** + * Validate fields before create or update object + * + * @param array|null $data Data to validate + * @return array + * @throws RestException + */ + function _validate($data) { + $account = array(); + foreach (Users::$FIELDS as $field) + { + if (!isset($data[$field])) + throw new RestException(400, "$field field missing"); + $account[$field] = $data[$field]; + } + return $account; + } +} diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 6a19be4da1e..37832f20ea6 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -107,6 +107,7 @@ class User extends CommonObject var $rights; // Array of permissions user->rights->permx var $all_permissions_are_loaded; /**< \private all_permissions_are_loaded */ private $_tab_loaded=array(); // Array of cache of already loaded permissions + var $nb_rights; // Number of rights granted to the user var $conf; // To store personal config var $oldcopy; // To contains a clone of this when we need to save old properties of object @@ -115,13 +116,17 @@ class User extends CommonObject var $parentof; // To store an array of all parents for all ids. var $accountancy_code; // Accountancy code in prevision of the complete accountancy module - var $thm; // Average cost of employee + + var $thm; // Average cost of employee - Used for valuation of time spent var $tjm; // Average cost of employee - var $salary; // Monthly salary - var $salaryextra; // Monthly salary extra - var $weeklyhours; // Weekly hours + + var $salary; // Monthly salary - Denormalized value from llx_user_employment + var $salaryextra; // Monthly salary extra - Denormalized value from llx_user_employment + var $weeklyhours; // Weekly hours - Denormalized value from llx_user_employment var $color; // Define background color for user in agenda + + var $dateemployment; // Define date of employment by company /** * Constructor de la classe @@ -138,6 +143,7 @@ class User extends CommonObject // For cache usage $this->all_permissions_are_loaded = 0; + $this->nb_rights = 0; // Force some default values $this->admin = 0; @@ -187,6 +193,7 @@ class User extends CommonObject $sql.= " u.salaryextra,"; $sql.= " u.weeklyhours,"; $sql.= " u.color,"; + $sql.= " u.dateemployment,"; $sql.= " u.ref_int, u.ref_ext,"; $sql.= " c.code as country_code, c.label as country,"; $sql.= " d.code_departement as state_code, d.nom as state"; @@ -286,6 +293,7 @@ class User extends CommonObject $this->salaryextra = $obj->salaryextra; $this->weeklyhours = $obj->weeklyhours; $this->color = $obj->color; + $this->dateemployment = $this->db->jdate($obj->dateemployment); $this->datec = $this->db->jdate($obj->datec); $this->datem = $this->db->jdate($obj->datem); @@ -629,10 +637,12 @@ class User extends CommonObject if ($subperms) { if (! isset($this->rights->$module->$perms) || ! is_object($this->rights->$module->$perms)) $this->rights->$module->$perms = new stdClass(); + if(empty($this->rights->$module->$perms->$subperms)) $this->nb_rights++; $this->rights->$module->$perms->$subperms = 1; } else { + if(empty($this->rights->$module->$perms)) $this->nb_rights++; $this->rights->$module->$perms = 1; } @@ -679,10 +689,12 @@ class User extends CommonObject if ($subperms) { if (! isset($this->rights->$module->$perms) || ! is_object($this->rights->$module->$perms)) $this->rights->$module->$perms = new stdClass(); + if(empty($this->rights->$module->$perms->$subperms)) $this->nb_rights++; $this->rights->$module->$perms->$subperms = 1; } else { + if(empty($this->rights->$module->$perms)) $this->nb_rights++; $this->rights->$module->$perms = 1; } @@ -1260,6 +1272,7 @@ class User extends CommonObject $this->town = empty($this->town)?'':$this->town; $this->accountancy_code = trim($this->accountancy_code); $this->color = empty($this->color)?'':$this->color; + $this->dateemployment = empty($this->dateemployment)?'':$this->dateemployment; // Check parameters if (! empty($conf->global->USER_MAIL_REQUIRED) && ! isValidEMail($this->email)) @@ -1300,6 +1313,7 @@ class User extends CommonObject $sql.= ", signature = '".$this->db->escape($this->signature)."'"; $sql.= ", accountancy_code = '".$this->db->escape($this->accountancy_code)."'"; $sql.= ", color = '".$this->db->escape($this->color)."'"; + $sql.= ", dateemployment=".(strval($this->dateemployment)!='' ? "'".$this->db->idate($this->dateemployment)."'" : 'null'); $sql.= ", note = '".$this->db->escape($this->note)."'"; $sql.= ", photo = ".($this->photo?"'".$this->db->escape($this->photo)."'":"null"); $sql.= ", openid = ".($this->openid?"'".$this->db->escape($this->openid)."'":"null"); @@ -1311,7 +1325,7 @@ class User extends CommonObject $sql.= ", weeklyhours= ".($this->weeklyhours != ''?"'".$this->db->escape($this->weeklyhours)."'":"null"); $sql.= ", entity = '".$this->db->escape($this->entity)."'"; $sql.= " WHERE rowid = ".$this->id; - + dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) @@ -1332,14 +1346,14 @@ class User extends CommonObject // If user is linked to a member, remove old link to this member if ($this->fk_member > 0) { - $sql = "UPDATE ".MAIN_DB_PREFIX."user SET fk_member = NULL where fk_member = ".$this->fk_member; - dol_syslog(get_class($this)."::update", LOG_DEBUG); + dol_syslog(get_class($this)."::update remove link with member. We will recreate it later", LOG_DEBUG); + $sql = "UPDATE ".MAIN_DB_PREFIX."user SET fk_member = NULL where fk_member = ".$this->fk_member; $resql = $this->db->query($sql); if (! $resql) { $this->error=$this->db->error(); $this->db->rollback(); return -5; } } // Set link to user + dol_syslog(get_class($this)."::update set link with member", LOG_DEBUG); $sql = "UPDATE ".MAIN_DB_PREFIX."user SET fk_member =".($this->fk_member>0?$this->fk_member:'null')." where rowid = ".$this->id; - dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $this->error=$this->db->error(); $this->db->rollback(); return -5; } @@ -1347,6 +1361,8 @@ class User extends CommonObject { if ($this->fk_member > 0 && ! $nosyncmember) { + dol_syslog(get_class($this)."::update user is linked with a member. We try to update member too.", LOG_DEBUG); + require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; // This user is linked with a member, so we also update members informations @@ -1360,7 +1376,9 @@ class User extends CommonObject $adh->lastname=$this->lastname; $adh->login=$this->login; $adh->gender=$this->gender; + $adh->pass=$this->pass; + $adh->societe=(empty($adh->societe) && $this->societe_id ? $this->societe_id : $adh->societe); $adh->email=$this->email; @@ -1373,17 +1391,19 @@ class User extends CommonObject $adh->user_id=$this->id; $adh->user_login=$this->login; - $result=$adh->update($user,0,1); - if ($result < 0) + $result=$adh->update($user,0,1,0); + if ($result < 0) { - $this->error=$luser->error; - dol_syslog(get_class($this)."::update ".$this->error,LOG_ERR); + $this->error=$adh->error; + $this->errors=$adh->errors; + dol_syslog(get_class($this)."::update error after calling adh->update to sync it with user: ".$this->error, LOG_ERR); $error++; } } else { $this->error=$adh->error; + $this->errors=$adh->errors; $error++; } } @@ -1495,7 +1515,7 @@ class User extends CommonObject $password=getRandomPassword(false); } - // Crypte avec md5 + // Crypt password $password_crypted = dol_hash($password); // Mise a jour @@ -1539,7 +1559,7 @@ class User extends CommonObject if ($result >= 0) { - $result=$adh->setPassword($user,$this->pass,0,1); // Cryptage non gere dans module adherent + $result=$adh->setPassword($user,$this->pass,(empty($conf->global->DATABASE_PWD_ENCRYPTED)?0:1),1); // Cryptage non gere dans module adherent if ($result < 0) { $this->error=$adh->error; @@ -1935,93 +1955,104 @@ class User extends CommonObject */ function getNomUrl($withpictoimg=0, $option='', $infologin=0, $notooltip=0, $maxlen=24, $hidethirdpartylogo=0, $mode='',$morecss='') { - global $langs, $conf, $db; - global $dolibarr_main_authentication, $dolibarr_main_demo; - global $menumanager; + global $langs, $conf, $db, $hookmanager; + global $dolibarr_main_authentication, $dolibarr_main_demo; + global $menumanager; if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && $withpictoimg) $withpictoimg=0; - $result = ''; - $companylink = ''; - $link = ''; + $result = ''; + $companylink = ''; + $link = ''; + + $label = '' . $langs->trans("User") . ''; + $label.= '
'; + $label.= '' . $langs->trans('Name') . ': ' . $this->getFullName($langs,'',''); + if (! empty($this->login)) + $label.= '
' . $langs->trans('Login') . ': ' . $this->login; + $label.= '
' . $langs->trans("EMail").': '.$this->email; + if (! empty($this->admin)) + $label.= '
' . $langs->trans("Administrator").': '.yn($this->admin); + if (! empty($this->societe_id) ) // Add thirdparty for external users + { + $thirdpartystatic = new Societe($db); + $thirdpartystatic->fetch($this->societe_id); + if (empty($hidethirdpartylogo)) $companylink = ' '.$thirdpartystatic->getNomUrl(2); // picto only of company + $company=' ('.$langs->trans("Company").': '.$thirdpartystatic->name.')'; + } + $type=($this->societe_id?$langs->trans("External").$company:$langs->trans("Internal")); + $label.= '
' . $langs->trans("Type") . ': ' . $type; + $label.='
'; + if (! empty($this->photo)) + { + $label.= '
'; + $label.= Form::showphoto('userphoto', $this, 80, 0, 0, 'photowithmargin photologintooltip', 'small', 0, 1); + $label.= '
'; + } - $label = '' . $langs->trans("User") . ''; - $label.= '
'; - $label.= '' . $langs->trans('Name') . ': ' . $this->getFullName($langs,'',''); - if (! empty($this->login)) - $label.= '
' . $langs->trans('Login') . ': ' . $this->login; - $label.= '
' . $langs->trans("EMail").': '.$this->email; - if (! empty($this->admin)) - $label.= '
' . $langs->trans("Administrator").': '.yn($this->admin); - if (! empty($this->societe_id) ) // Add thirdparty for external users - { - $thirdpartystatic = new Societe($db); - $thirdpartystatic->fetch($this->societe_id); - if (empty($hidethirdpartylogo)) $companylink = ' '.$thirdpartystatic->getNomUrl(2); // picto only of company - $company=' ('.$langs->trans("Company").': '.$thirdpartystatic->name.')'; - } - $type=($this->societe_id?$langs->trans("External").$company:$langs->trans("Internal")); - $label.= '
' . $langs->trans("Type") . ': ' . $type; - $label.='
'; - if (! empty($this->photo)) - { - $label.= '
'; - $label.= Form::showphoto('userphoto', $this, 80, 0, 0, 'photowithmargin photologintooltip', 'small', 0, 1); - $label.= '
'; - } - - // Info Login - if ($infologin) - { - $label.= '
'; - $label.= '
'.$langs->trans("Connection").''; - $label.= '
'.$langs->trans("IPAddress").': '.$_SERVER["REMOTE_ADDR"]; - if (! empty($conf->global->MAIN_MODULE_MULTICOMPANY)) $label.= '
'.$langs->trans("ConnectedOnMultiCompany").': '.$conf->entity.' (user entity '.$this->entity.')'; - $label.= '
'.$langs->trans("AuthenticationMode").': '.$_SESSION["dol_authmode"].(empty($dolibarr_main_demo)?'':' (demo)'); - $label.= '
'.$langs->trans("ConnectedSince").': '.dol_print_date($this->datelastlogin,"dayhour"); - $label.= '
'.$langs->trans("PreviousConnexion").': '.dol_print_date($this->datepreviouslogin,"dayhour"); - $label.= '
'.$langs->trans("CurrentTheme").': '.$conf->theme; - $label.= '
'.$langs->trans("CurrentMenuManager").': '.$menumanager->name; - $s=picto_from_langcode($langs->getDefaultLang()); - $label.= '
'.$langs->trans("CurrentUserLanguage").': '.($s?$s.' ':'').$langs->getDefaultLang(); - $label.= '
'.$langs->trans("Browser").': '.$conf->browser->name.($conf->browser->version?' '.$conf->browser->version:'').' ('.$_SERVER['HTTP_USER_AGENT'].')'; - $label.= '
'.$langs->trans("Layout").': '.$conf->browser->layout; - $label.= '
'.$langs->trans("Screen").': '.$_SESSION['dol_screenwidth'].' x '.$_SESSION['dol_screenheight']; - if (! empty($conf->browser->phone)) $label.= '
'.$langs->trans("Phone").': '.$conf->browser->phone; - if (! empty($_SESSION["disablemodules"])) $label.= '
'.$langs->trans("DisabledModules").':
'.join(', ',explode(',',$_SESSION["disablemodules"])); - } + // Info Login + if ($infologin) + { + $label.= '
'; + $label.= '
'.$langs->trans("Connection").''; + $label.= '
'.$langs->trans("IPAddress").': '.$_SERVER["REMOTE_ADDR"]; + if (! empty($conf->global->MAIN_MODULE_MULTICOMPANY)) $label.= '
'.$langs->trans("ConnectedOnMultiCompany").': '.$conf->entity.' (user entity '.$this->entity.')'; + $label.= '
'.$langs->trans("AuthenticationMode").': '.$_SESSION["dol_authmode"].(empty($dolibarr_main_demo)?'':' (demo)'); + $label.= '
'.$langs->trans("ConnectedSince").': '.dol_print_date($this->datelastlogin,"dayhour"); + $label.= '
'.$langs->trans("PreviousConnexion").': '.dol_print_date($this->datepreviouslogin,"dayhour"); + $label.= '
'.$langs->trans("CurrentTheme").': '.$conf->theme; + $label.= '
'.$langs->trans("CurrentMenuManager").': '.$menumanager->name; + $s=picto_from_langcode($langs->getDefaultLang()); + $label.= '
'.$langs->trans("CurrentUserLanguage").': '.($s?$s.' ':'').$langs->getDefaultLang(); + $label.= '
'.$langs->trans("Browser").': '.$conf->browser->name.($conf->browser->version?' '.$conf->browser->version:'').' ('.$_SERVER['HTTP_USER_AGENT'].')'; + $label.= '
'.$langs->trans("Layout").': '.$conf->browser->layout; + $label.= '
'.$langs->trans("Screen").': '.$_SESSION['dol_screenwidth'].' x '.$_SESSION['dol_screenheight']; + if (! empty($conf->browser->phone)) $label.= '
'.$langs->trans("Phone").': '.$conf->browser->phone; + if (! empty($_SESSION["disablemodules"])) $label.= '
'.$langs->trans("DisabledModules").':
'.join(', ',explode(',',$_SESSION["disablemodules"])); + } - if ($option == 'leave') $link.= 'global->MAIN_OPTIMIZEFORTEXTBROWSER)) - { - $langs->load("users"); - $label=$langs->trans("ShowUser"); - $link.=' alt="'.dol_escape_htmltag($label, 1).'"'; - } - $link.= ' title="'.dol_escape_htmltag($label, 1).'"'; - $link.= ' class="classfortooltip'.($morecss?' '.$morecss:'').'"'; - } - $link.= '>'; + if ($option == 'leave') $link.= 'global->MAIN_OPTIMIZEFORTEXTBROWSER)) + { + $langs->load("users"); + $label=$langs->trans("ShowUser"); + $linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"'; + } + $linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose.= ' class="classfortooltip'.($morecss?' '.$morecss:'').'"'; + } + if (! is_object($hookmanager)) + { + include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; + $hookmanager=new HookManager($this->db); + } + $hookmanager->initHooks(array('userdao')); + $parameters=array('id'=>$this->id); + $reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks + if ($reshook > 0) $linkclose = $hookmanager->resPrint; + + $link.=$linkclose.'>'; $linkend=''; //if ($withpictoimg == -1) $result.='
'; $result.=$link; - if ($withpictoimg) - { - $paddafterimage=''; - if (abs($withpictoimg) == 1) $paddafterimage='style="padding-right: 3px;"'; - if ($withpictoimg > 0) $picto='
'.img_object('', 'user', $paddafterimage.' '.($notooltip?'':'class="classfortooltip"')).'
'; - else $picto='
'.Form::showphoto('userphoto', $this, 0, 0, 0, 'loginphoto', 'mini', 0, 1).'
'; - $result.=$picto; + if ($withpictoimg) + { + $paddafterimage=''; + if (abs($withpictoimg) == 1) $paddafterimage='style="margin-right: 3px;"'; + if ($withpictoimg > 0) $picto='
'.img_object('', 'user', $paddafterimage.' '.($notooltip?'':'class="classfortooltip"')).'
'; + else $picto='
'.Form::showphoto('userphoto', $this, 0, 0, 0, 'loginphoto', 'mini', 0, 1).'
'; + $result.=$picto; } if (abs($withpictoimg) != 2) { - if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $result.='
'; + if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $result.='
'; if ($mode == 'login') $result.=dol_trunc($this->login, $maxlen); else $result.=$this->getFullName($langs,'',($mode == 'firstname' ? 2 : -1),$maxlen); if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $result.='
'; @@ -2095,23 +2126,23 @@ class User extends CommonObject } if ($mode == 2) { - if ($statut == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); - if ($statut == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); + if ($statut == 1) return img_picto($langs->trans('Enabled'),'statut4','class="pictostatus"').' '.$langs->trans('Enabled'); + if ($statut == 0) return img_picto($langs->trans('Disabled'),'statut5','class="pictostatus"').' '.$langs->trans('Disabled'); } if ($mode == 3) { - if ($statut == 1) return img_picto($langs->trans('Enabled'),'statut4'); - if ($statut == 0) return img_picto($langs->trans('Disabled'),'statut5'); + if ($statut == 1) return img_picto($langs->trans('Enabled'),'statut4','class="pictostatus"'); + if ($statut == 0) return img_picto($langs->trans('Disabled'),'statut5','class="pictostatus"'); } if ($mode == 4) { - if ($statut == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); - if ($statut == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); + if ($statut == 1) return img_picto($langs->trans('Enabled'),'statut4','class="pictostatus"').' '.$langs->trans('Enabled'); + if ($statut == 0) return img_picto($langs->trans('Disabled'),'statut5','class="pictostatus"').' '.$langs->trans('Disabled'); } if ($mode == 5) { - if ($statut == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4'); - if ($statut == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5'); + if ($statut == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4','class="pictostatus"'); + if ($statut == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5','class="pictostatus"'); } } diff --git a/htdocs/user/class/userbankaccount.class.php b/htdocs/user/class/userbankaccount.class.php index 4e88233fe35..514e8d0b28c 100644 --- a/htdocs/user/class/userbankaccount.class.php +++ b/htdocs/user/class/userbankaccount.class.php @@ -141,8 +141,7 @@ class UserBankAccount extends Account $sql = "SELECT rowid, fk_user, entity, bank, number, code_banque, code_guichet, cle_rib, bic, iban_prefix as iban, domiciliation, proprio,"; $sql.= " owner_address, label, datec, tms as datem"; $sql.= " FROM ".MAIN_DB_PREFIX."user_rib"; - if ($id) $sql.= " WHERE rowid = ".$id; - if ($socid) $sql.= " WHERE fk_user = ".$userid; + $sql.= " WHERE rowid = ".$id; $resql = $this->db->query($sql); if ($resql) diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php index 50237b0ef61..575fdadebe2 100644 --- a/htdocs/user/class/usergroup.class.php +++ b/htdocs/user/class/usergroup.class.php @@ -784,11 +784,8 @@ class UserGroup extends CommonObject { $muser=new User($this->db); $muser->fetch($val->id); - if ($conf->global->LDAP_KEY_USERS == 'cn') $ldapuserid=$muser->getFullName($langs); - elseif ($conf->global->LDAP_KEY_USERS == 'sn') $ldapuserid=$muser->lastname; - elseif ($conf->global->LDAP_KEY_USERS == 'uid') $ldapuserid=$muser->login; - - $valueofldapfield[] = $conf->global->LDAP_KEY_USERS.'='.$ldapuserid.','.$conf->global->LDAP_USER_DN; + $info2 = $muser->_load_ldap_info(); + $valueofldapfield[] = $muser->_load_ldap_dn($info2); } $info[$conf->global->LDAP_GROUP_FIELD_GROUPMEMBERS] = (!empty($valueofldapfield)?$valueofldapfield:''); } diff --git a/htdocs/user/group/card.php b/htdocs/user/group/card.php index 1da40878a62..541d847a45b 100644 --- a/htdocs/user/group/card.php +++ b/htdocs/user/group/card.php @@ -450,7 +450,7 @@ else print "
'; - print ''.img_object($langs->trans("ShowUser"),"user").' '.$useringroup->login.''; + print $useringroup->getNomUrl(-1, '', 0, 0, 24, 0, 'login'); if ($useringroup->admin && ! $useringroup->entity) print img_picto($langs->trans("SuperAdministrator"),'redstar'); else if ($useringroup->admin) print img_picto($langs->trans("Administrator"),'star'); print ''.img_edit_remove($langs->trans("Remove")).''.img_edit_remove($langs->trans("Remove")).''; print img_picto($langs->trans("Active"),'tick'); @@ -310,12 +310,12 @@ if ($id) // Do not own permission if ($caneditperms) { - print ''.img_edit_add($langs->trans("Add")).''.img_edit_add($langs->trans("Add")).' '.$perm_libelle. '
'; + + // Ref + print ''; + print ''; + print ''."\n"; + + print ''; + print ''; + + // Firstname + print ''; + print ''; + print ''."\n"; + + // EMail + print ''; + print ''; + print "\n"; + + print '
'.$langs->trans("Ref").''; + print $form->showrefnav($object,'id','',$user->rights->user->user->lire || $user->admin); + print '
'.$langs->trans("Lastname").''.$object->lastname.'
'.$langs->trans("Firstname").''.$object->firstname.'
'.$langs->trans("EMail").''.dol_print_email($object->email,0,0,1).'
';*/ + + dol_fiche_end(); + + print "\n"; + + // Help + print '
'.$langs->trans("NotificationsDesc"); + print '
'.$langs->trans("NotificationsDescUser"); + print '
'.$langs->trans("NotificationsDescContact"); + print '
'.$langs->trans("NotificationsDescGlobal"); + + print '


'."\n"; + + + // Add notification form + print_fiche_titre($langs->trans("AddNewNotification"),'',''); + + print ''; + print ''; + print ''; + + $param="&id=".$id; + + // Line with titles + print ''; + print ''; + print_liste_field_titre($langs->trans("Target"),$_SERVER["PHP_SELF"],"c.lastname,c.firstname",'',$param,'"width="45%"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Action"),$_SERVER["PHP_SELF"],"",'',$param,'"width="35%"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"n.type",'',$param,'"width="10%"',$sortfield,$sortorder); + print_liste_field_titre(''); + print "\n"; + + $var=false; +// $listofemails=$object->thirdparty_and_contact_email_array(); + if ($object->email) + { + $actions=array(); + + // Load array of available notifications + $notificationtrigger=new InterfaceNotification($db); + $listofnotifiedevents=$notificationtrigger->getListOfManagedEvents(); + + foreach($listofnotifiedevents as $notifiedevent) + { + $label=($langs->trans("Notify_".$notifiedevent['code'])!="Notify_".$notifiedevent['code']?$langs->trans("Notify_".$notifiedevent['code']):$notifiedevent['label']); + $actions[$notifiedevent['rowid']]=$label; + } + print ''; + print ''; + print ''; + print ''; + print ''; + } + else + { + print ''; + } + + print '
'; + print $object->getNomUrl(1); + if (isValidEmail($object->email)) + { + print ' <'.$object->email.'>'; + } + else + { + $langs->load("errors"); + print '   '.img_warning().' '.$langs->trans("ErrorBadEMail",$object->email); + } + print ''; + print $form->selectarray("actionid",$actions,'',1); + print ''; + $type=array('email'=>$langs->trans("EMail")); + print $form->selectarray("typeid",$type); + print '
'; + print $langs->trans("YouMustAssignUserMailFirst"); + print '
'; + + print ''; + print '
'; + + // List of notifications enabled for contacts + $sql = "SELECT n.rowid, n.type,"; + $sql.= " a.code, a.label,"; + $sql.= " c.rowid as userid, c.lastname, c.firstname, c.email"; + $sql.= " FROM ".MAIN_DB_PREFIX."c_action_trigger as a,"; + $sql.= " ".MAIN_DB_PREFIX."notify_def as n,"; + $sql.= " ".MAIN_DB_PREFIX."user c"; + $sql.= " WHERE a.rowid = n.fk_action"; + $sql.= " AND c.rowid = n.fk_user"; + $sql.= " AND c.rowid = ".$object->id; + + $resql=$db->query($sql); + if ($resql) + { + $num = $db->num_rows($resql); + } + else + { + dol_print_error($db); + } + + // List of active notifications + print_fiche_titre($langs->trans("ListOfActiveNotifications").' ('.$num.')','',''); + $var=true; + + // Line with titles + print ''; + print ''; + print_liste_field_titre($langs->trans("Target"),$_SERVER["PHP_SELF"],"c.lastname,c.firstname",'',$param,'"width="45%"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Action"),$_SERVER["PHP_SELF"],"",'',$param,'"width="35%"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"n.type",'',$param,'"width="10%"',$sortfield,$sortorder); + print_liste_field_titre('','',''); + print ''; + + $langs->load("errors"); + $langs->load("other"); + + if ($num) + { + $i = 0; + + $userstatic=new user($db); + + while ($i < $num) + { + $var = !$var; + + $obj = $db->fetch_object($resql); + + $userstatic->id=$obj->userid; + $userstatic->lastname=$obj->lastname; + $userstatic->firstname=$obj->firstname; + print ''; + print ''; + print ''; + print ''; + print ''; + $i++; + } + $db->free($resql); + } + + + // List of notifications enabled for fixed email + /* + foreach($conf->global as $key => $val) + { + if (! preg_match('/^NOTIFICATION_FIXEDEMAIL_(.*)/', $key, $reg)) continue; + $var = ! $var; + print ''; + print ''; + print ''; + print ''; + print ''; + }*/ + if ($user->admin) + { + $var = ! $var; + print ''; + } + + print '
'.$userstatic->getNomUrl(1); + if ($obj->type == 'email') + { + if (isValidEmail($obj->email)) + { + print ' <'.$obj->email.'>'; + } + else + { + $langs->load("errors"); + print '   '.img_warning().' '.$langs->trans("ErrorBadEMail",$obj->email); + } + } + print ''; + $label=($langs->trans("Notify_".$obj->code)!="Notify_".$obj->code?$langs->trans("Notify_".$obj->code):$obj->label); + print $label; + print ''; + if ($obj->type == 'email') print $langs->trans("Email"); + if ($obj->type == 'sms') print $langs->trans("SMS"); + print ''.img_delete().'
'; + $listtmp=explode(',',$val); + $first=1; + foreach($listtmp as $keyemail => $valemail) + { + if (! $first) print ', '; + $first=0; + $valemail=trim($valemail); + //print $keyemail.' - '.$valemail.' - '.$reg[1].'
'; + if (isValidEmail($valemail, 1)) + { + if ($valemail == '__SUPERVISOREMAIL__') print $valemail; + else print ' <'.$valemail.'>'; + } + else + { + print ' '.img_warning().' '.$langs->trans("ErrorBadEMail",$valemail); + } + } + print '
'; + $notifcode=preg_replace('/_THRESHOLD_.*$/','',$reg[1]); + $notifcodecond=preg_replace('/^.*_(THRESHOLD_)/','$1',$reg[1]); + $label=($langs->trans("Notify_".$notifcode)!="Notify_".$notifcode?$langs->trans("Notify_".$notifcode):$notifcode); + print $label; + if (preg_match('/^THRESHOLD_HIGHER_(.*)$/',$notifcodecond,$regcond) && ($regcond[1] > 0)) + { + print ' - '.$langs->trans("IfAmountHigherThan",$regcond[1]); + } + print ''; + print $langs->trans("Email"); + print ''.$langs->trans("SeeModuleSetup", $langs->transnoentitiesnoconv("Module600Name")).'
'; + print '+ '.$langs->trans("SeeModuleSetup", $langs->transnoentitiesnoconv("Module600Name")).''; + print '
'; + + + print '

'."\n"; + + + // List + $sql = "SELECT n.rowid, n.daten, n.email, n.objet_type as object_type, n.objet_id as object_id, n.type,"; + $sql.= " c.rowid as id, c.lastname, c.firstname, c.email as contactemail,"; + $sql.= " a.code, a.label"; + $sql.= " FROM ".MAIN_DB_PREFIX."c_action_trigger as a,"; + $sql.= " ".MAIN_DB_PREFIX."notify as n "; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as c ON n.fk_user = c.rowid"; + $sql.= " WHERE a.rowid = n.fk_action"; + $sql.= " AND n.fk_user = ".$object->id; + $sql.= $db->order($sortfield, $sortorder); + + $resql=$db->query($sql); + if ($resql) + { + $num = $db->num_rows($resql); + } + else + { + dol_print_error($db); + } + + // List of notifications done + print_fiche_titre($langs->trans("ListOfNotificationsDone").' ('.$num.')','',''); + $var=true; + + // Line with titles + print ''; + print ''; + print_liste_field_titre($langs->trans("Target"),$_SERVER["PHP_SELF"],"c.lastname,c.firstname",'',$param,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Action"),$_SERVER["PHP_SELF"],"",'',$param,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"n.type",'',$param,'',$sortfield,$sortorder); + //print_liste_field_titre($langs->trans("Object"),$_SERVER["PHP_SELF"],"",'',$param,'"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"n.daten",'',$param,'align="right"',$sortfield,$sortorder); + print ''; + + if ($num) + { + $i = 0; + + $userstatic=new User($db); + + while ($i < $num) + { + $var = !$var; + + $obj = $db->fetch_object($resql); + + print ''; + print ''; + print ''; + // TODO Add link to object here for other types + /*print '';*/ + // print + print''; + print ''; + $i++; + } + $db->free($resql); + } + + print '
'; + if ($obj->id > 0) + { + $userstatic->id=$obj->id; + $userstatic->lastname=$obj->lastname; + $userstatic->firstname=$obj->firstname; + print $userstatic->getNomUrl(1); + print $obj->email?' <'.$obj->email.'>':$langs->trans("NoMail"); + } + else + { + print $obj->email; + } + print ''; + $label=($langs->trans("Notify_".$obj->code)!="Notify_".$obj->code?$langs->trans("Notify_".$obj->code):$obj->label); + print $label; + print ''; + if ($obj->type == 'email') print $langs->trans("Email"); + if ($obj->type == 'sms') print $langs->trans("Sms"); + print ''; + if ($obj->object_type == 'order') + { + $orderstatic->id=$obj->object_id; + $orderstatic->ref=... + print $orderstatic->getNomUrl(1); + } + print ''.dol_print_date($db->jdate($obj->daten), 'dayhour').'
'; +} +else dol_print_error('','RecordNotFound'); + + +llxFooter(); + +$db->close(); diff --git a/htdocs/user/param_ihm.php b/htdocs/user/param_ihm.php index 4d254349a7d..f0ca0f17c31 100644 --- a/htdocs/user/param_ihm.php +++ b/htdocs/user/param_ihm.php @@ -32,6 +32,8 @@ $langs->load("products"); $langs->load("admin"); $langs->load("users"); $langs->load("languages"); +$langs->load("projects"); +$langs->load("members"); // Defini si peux lire/modifier permisssions $canreaduser=($user->admin || $user->rights->user->user->lire); @@ -91,6 +93,12 @@ if (empty($reshook)) { if (!$_POST["cancel"]) { $tabparam = array(); + if (GETPOST("check_MAIN_LANDING_PAGE") == "on") { + $tabparam["MAIN_LANDING_PAGE"] = $_POST["MAIN_LANDING_PAGE"]; + } else { + $tabparam["MAIN_LANDING_PAGE"] = ''; + } + if (GETPOST("check_MAIN_LANG_DEFAULT") == "on") { $tabparam["MAIN_LANG_DEFAULT"] = $_POST["main_lang_default"]; } else { @@ -145,6 +153,17 @@ if (empty($reshook)) { llxHeader(); +// List of possible landing pages +$tmparray=array('index.php'=>'Dashboard'); +if (! empty($conf->societe->enabled)) $tmparray['societe/index.php?mainmenu=companies&leftmenu=']='ThirdPartiesArea'; +if (! empty($conf->projet->enabled)) $tmparray['projet/index.php?mainmenu=project&leftmenu=']='ProjectsArea'; +if (! empty($conf->holiday->enabled) || ! empty($conf->expensereport->enabled)) $tmparray['hrm/index.php?mainmenu=hrm&leftmenu=']='HRMArea'; // TODO Complete list with first level of menus +if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) $tmparray['product/index.php?mainmenu=products&leftmenu=']='ProductsAndServicesArea'; +if (! empty($conf->propal->enabled) || ! empty($conf->commande->enabled) || ! empty($conf->fichinter->enabled) || ! empty($conf->contrat->enabled)) $tmparray['comm/index.php?mainmenu=commercial&leftmenu=']='CommercialArea'; +if (! empty($conf->compta->enabled) || ! empty($conf->accounting->enabled)) $tmparray['compta/index.php?mainmenu=compta&leftmenu=']='AccountancyTreasuryArea'; +if (! empty($conf->adherent->enabled)) $tmparray['adherents/index.php?mainmenu=members&leftmenu=']='MembersArea'; +if (! empty($conf->agenda->enabled)) $tmparray['comm/action/index.php?mainmenu=agenda&leftmenu=']='Agenda'; + $head = user_prepare_head($object); $title = $langs->trans("User"); @@ -186,7 +205,10 @@ if ($action == 'edit') jQuery(document).ready(function() { function init_myfunc() { - if (jQuery("#check_MAIN_LANG_DEFAULT").prop("checked")) { jQuery("#main_lang_default").removeAttr(\'disabled\'); } + if (jQuery("#check_MAIN_LANDING_PAGE").prop("checked")) { jQuery("#MAIN_LANDING_PAGE").removeAttr(\'disabled\'); } + else { jQuery("#MAIN_LANDING_PAGE").attr(\'disabled\',\'disabled\'); } + + if (jQuery("#check_MAIN_LANG_DEFAULT").prop("checked")) { jQuery("#main_lang_default").removeAttr(\'disabled\'); } else { jQuery("#main_lang_default").attr(\'disabled\',\'disabled\'); } if (jQuery("#check_SIZE_LISTE_LIMIT").prop("checked")) { jQuery("#main_size_liste_limit").removeAttr(\'disabled\'); } @@ -199,7 +221,8 @@ if ($action == 'edit') else { jQuery("#colorpickerTHEME_ELDY_TOPMENU_BACK1").attr(\'disabled\',\'disabled\'); } } init_myfunc(); - jQuery("#check_SIZE_LISTE_LIMIT").click(function() { init_myfunc(); }); + jQuery("#check_MAIN_LANDING_PAGE").click(function() { init_myfunc(); }); + jQuery("#check_SIZE_LISTE_LIMIT").click(function() { init_myfunc(); }); jQuery("#check_MAIN_LANG_DEFAULT").click(function() { init_myfunc(); }); jQuery("#check_MAIN_THEME").click(function() { init_myfunc(); }); jQuery("#check_THEME_ELDY_TOPMENU_BACK1").click(function() { init_myfunc(); }); @@ -215,6 +238,20 @@ if ($action == 'edit') print ''; print ''; + // Landing page + $var=!$var; + print ''; + print ''; + print ''; + print ''; + // Langue par defaut $var=!$var; print ''; @@ -267,6 +304,25 @@ else print '
'.$langs->trans("Parameter").''.$langs->trans("DefaultValue").' '.$langs->trans("PersonalValue").'
'.$langs->trans("LandingPage").''; + print (empty($conf->global->MAIN_LANDING_PAGE)?'':$conf->global->MAIN_LANDING_PAGE); + print 'conf->MAIN_LANDING_PAGE)?" checked":""); + print empty($dolibarr_main_demo)?'':' disabled="disabled"'; // Disabled for demo + print '> '.$langs->trans("UsePersonalValue").''; + print $form->selectarray('MAIN_LANDING_PAGE', $tmparray, (! empty($object->conf->MAIN_LANDING_PAGE)?$object->conf->MAIN_LANDING_PAGE:''), 0, 0, 0, '', 1); + //print info_admin($langs->trans("WarningYouMayLooseAccess"), 0, 0, 0); + print '
'.$langs->trans("Language").'
'; print ''; + // Landing page + $var=!$var; + print ''; + print ''; + print ''; + print ''; + + // Language $var=!$var; print ''; print ''; - print ''; + print ''; print '
'.$langs->trans("Parameter").''.$langs->trans("DefaultValue").' '.$langs->trans("PersonalValue").'
'.$langs->trans("LandingPage").''; + print (empty($conf->global->MAIN_LANDING_PAGE)?'':$conf->global->MAIN_LANDING_PAGE); + print 'conf->MAIN_LANDING_PAGE)?" checked":""); + print empty($dolibarr_main_demo)?'':' disabled="disabled"'; // Disabled for demo + print '> '.$langs->trans("UsePersonalValue").''; + if (! empty($tmparray[$object->conf->MAIN_LANDING_PAGE])) + { + print $langs->trans($tmparray[$object->conf->MAIN_LANDING_PAGE]); + } + else print $object->conf->MAIN_LANDING_PAGE; + //print $form->selectarray('MAIN_LANDING_PAGE', $tmparray, (! empty($object->conf->MAIN_LANDING_PAGE)?$object->conf->MAIN_LANDING_PAGE:''), 0, 0, 0, '', 1); + print '
'.$langs->trans("Language").''; @@ -274,7 +330,7 @@ else print ($s?$s.' ':''); print (isset($conf->global->MAIN_LANG_DEFAULT) && $conf->global->MAIN_LANG_DEFAULT=='auto'?$langs->trans("AutoDetectLang"):$langs->trans("Language_".$conf->global->MAIN_LANG_DEFAULT)); print 'conf->MAIN_LANG_DEFAULT)?" checked":"").'> '.$langs->trans("UsePersonalValue").'conf->MAIN_LANG_DEFAULT)?" checked":"").'> '.$langs->trans("UsePersonalValue").''; $s=(isset($object->conf->MAIN_LANG_DEFAULT) ? picto_from_langcode($object->conf->MAIN_LANG_DEFAULT) : ''); print ($s?$s.' ':''); diff --git a/htdocs/viewimage.php b/htdocs/viewimage.php index 585db4c343e..b6d33de99ae 100644 --- a/htdocs/viewimage.php +++ b/htdocs/viewimage.php @@ -34,8 +34,9 @@ if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); if (! defined('NOREQUIREHOOK')) define('NOREQUIREHOOK','1'); // Disable "main.inc.php" hooks -// Pour autre que companylogo, on charge environnement + info issus de logon comme le user +// Some value of modulepart can be used to get resources that are public so no login are required. if ((isset($_GET["modulepart"]) && $_GET["modulepart"] == 'companylogo') && ! defined("NOLOGIN")) define("NOLOGIN",'1'); +if ((isset($_GET["modulepart"]) && $_GET["modulepart"] == 'medias') && ! defined("NOLOGIN")) define("NOLOGIN",'1'); /** * Header empty diff --git a/htdocs/webservices/server_actioncomm.php b/htdocs/webservices/server_actioncomm.php index a5df31c2a7e..99e8ea59e6f 100644 --- a/htdocs/webservices/server_actioncomm.php +++ b/htdocs/webservices/server_actioncomm.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2006-2016 Laurent Destailleur * Copyright (C) 2012 Florian Henry * * This program is free software; you can redistribute it and/or modify @@ -14,16 +14,16 @@ * * You should have received a copy of the GNU General Public License * along with this program. If not, see . + * + * Path to WSDL is: http://localhost/dolibarr/webservices/server_actioncomm.php?wsdl */ /** * \file htdocs/webservices/server_actioncomm.php * \brief File that is entry point to call Dolibarr WebServices - * \version $Id: server_actioncomm.php,v 1.7 2010/12/19 11:49:37 eldy Exp $ */ -// This is to make Dolibarr working with Plesk -set_include_path($_SERVER['DOCUMENT_ROOT'].'/htdocs'); +if (! defined("NOCSRFCHECK")) define("NOCSRFCHECK",'1'); require_once("../master.inc.php"); require_once(NUSOAP_PATH.'/nusoap.php'); // Include SOAP diff --git a/htdocs/webservices/server_category.php b/htdocs/webservices/server_category.php index 2bf914ebd38..9ef07dda952 100644 --- a/htdocs/webservices/server_category.php +++ b/htdocs/webservices/server_category.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2006-2016 Laurent Destailleur * Copyright (C) 2012 JF FERRY * * This program is free software; you can redistribute it and/or modify @@ -21,8 +21,7 @@ * \brief File that is entry point to call Dolibarr WebServices */ -// This is to make Dolibarr working with Plesk -set_include_path($_SERVER['DOCUMENT_ROOT'].'/htdocs'); +if (! defined("NOCSRFCHECK")) define("NOCSRFCHECK",'1'); require_once("../master.inc.php"); require_once(NUSOAP_PATH.'/nusoap.php'); // Include SOAP diff --git a/htdocs/webservices/server_contact.php b/htdocs/webservices/server_contact.php index f439e791cb4..cab58268f57 100644 --- a/htdocs/webservices/server_contact.php +++ b/htdocs/webservices/server_contact.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2006-2016 Laurent Destailleur * Copyright (C) 2012 JF FERRY * * This program is free software; you can redistribute it and/or modify @@ -21,8 +21,7 @@ * \brief File that is entry point to call Dolibarr WebServices */ -// This is to make Dolibarr working with Plesk -set_include_path($_SERVER['DOCUMENT_ROOT'].'/htdocs'); +if (! defined("NOCSRFCHECK")) define("NOCSRFCHECK",'1'); require_once("../master.inc.php"); require_once(NUSOAP_PATH.'/nusoap.php'); // Include SOAP @@ -660,7 +659,7 @@ function updateContact($authentication,$contact) $object->civility_id=$contact['civility_id']; $object->poste=$contact['poste']; - $object->statut=$contact['statut']; + $object->statut=$contact['status']; //Retreive all extrafield for contact diff --git a/htdocs/webservices/server_invoice.php b/htdocs/webservices/server_invoice.php index 4a495607a29..54f5e3c564c 100644 --- a/htdocs/webservices/server_invoice.php +++ b/htdocs/webservices/server_invoice.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2006-2016 Laurent Destailleur + * Copyright (C) 2016 Juanjo Menent * * 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 @@ -20,8 +21,7 @@ * \brief File that is entry point to call Dolibarr WebServices */ -// This is to make Dolibarr working with Plesk -set_include_path($_SERVER['DOCUMENT_ROOT'].'/htdocs'); +if (! defined("NOCSRFCHECK")) define("NOCSRFCHECK",'1'); require_once '../master.inc.php'; require_once NUSOAP_PATH.'/nusoap.php'; // Include SOAP @@ -412,7 +412,7 @@ function getInvoicesForThirdParty($authentication,$idthirdparty) $error=0; $fuser=check_authentication($authentication,$error,$errorcode,$errorlabel); - if ($fuser->societe_id) $socid=$fuser->societe_id; + if ($fuser->socid) $socid=$fuser->socid; // Check parameters if (! $error && empty($idthirdparty)) @@ -425,7 +425,7 @@ function getInvoicesForThirdParty($authentication,$idthirdparty) { $linesinvoice=array(); - $sql.='SELECT f.rowid as facid, facnumber as ref, ref_ext, type, fk_statut as status, total_ttc, total, tva'; + $sql ='SELECT f.rowid as facid, facnumber as ref, ref_ext, type, fk_statut as status, total_ttc, total, tva'; $sql.=' FROM '.MAIN_DB_PREFIX.'facture as f'; $sql.=" WHERE f.entity = ".$conf->entity; if ($idthirdparty != 'all' ) $sql.=" AND f.fk_soc = ".$db->escape($idthirdparty); @@ -660,7 +660,7 @@ function createInvoice($authentication,$invoice) function createInvoiceFromOrder($authentication,$id_order='', $ref_order='', $ref_ext_order='', $id_invoice='', $ref_invoice='', $ref_ext_invoice='') { - global $db,$conf,$langs; + global $db,$conf; $now=dol_now(); @@ -674,6 +674,7 @@ function createInvoiceFromOrder($authentication,$id_order='', $ref_order='', $re $errorcode='';$errorlabel=''; $error=0; $fuser=check_authentication($authentication,$error,$errorcode,$errorlabel); + if ($fuser->socid) $socid=$fuser->socid; // Check parameters if (empty($id_order) && empty($ref_order) && empty($ref_ext_order)) { @@ -690,7 +691,7 @@ function createInvoiceFromOrder($authentication,$id_order='', $ref_order='', $re if ($fuser->rights->commande->lire) { $order=new Commande($db); - $result=$order->fetch($id,$ref,$ref_ext); + $result=$order->fetch($id_order,$ref_order,$ref_ext_order); if ($result > 0) { // Security for external user diff --git a/htdocs/webservices/server_order.php b/htdocs/webservices/server_order.php index 28518d24763..f477ccfed9c 100644 --- a/htdocs/webservices/server_order.php +++ b/htdocs/webservices/server_order.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2006-2016 Laurent Destailleur * Copyright (C) 2012 JF FERRY * Copyright (C) 2012 Regis Houssin * @@ -22,9 +22,7 @@ * \brief File that is entry point to call Dolibarr WebServices */ - -// This is to make Dolibarr working with Plesk -set_include_path($_SERVER['DOCUMENT_ROOT'].'/htdocs'); +if (! defined("NOCSRFCHECK")) define("NOCSRFCHECK",'1'); require_once '../master.inc.php'; require_once NUSOAP_PATH.'/nusoap.php'; // Include SOAP @@ -935,7 +933,7 @@ function updateOrder($authentication,$order) if (isset($order['billed'])) { if ($order['billed']) $result=$object->classifyBilled($fuser); - if (! $order['billed']) $result=$object->classifyBilled($fuser); + if (! $order['billed']) $result=$object->classifyUnBilled($fuser); } //Retreive all extrafield for object diff --git a/htdocs/webservices/server_other.php b/htdocs/webservices/server_other.php index ba948d463ea..8ac519ae87e 100644 --- a/htdocs/webservices/server_other.php +++ b/htdocs/webservices/server_other.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2006-2016 Laurent Destailleur * * 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 @@ -20,8 +20,7 @@ * \brief File that is entry point to call Dolibarr WebServices */ -// This is to make Dolibarr working with Plesk -set_include_path($_SERVER['DOCUMENT_ROOT'].'/htdocs'); +if (! defined("NOCSRFCHECK")) define("NOCSRFCHECK",'1'); require_once '../master.inc.php'; require_once NUSOAP_PATH.'/nusoap.php'; // Include SOAP diff --git a/htdocs/webservices/server_productorservice.php b/htdocs/webservices/server_productorservice.php index aa43dbb185c..385c7dc3b95 100644 --- a/htdocs/webservices/server_productorservice.php +++ b/htdocs/webservices/server_productorservice.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2006-2016 Laurent Destailleur * Copyright (C) 2012 JF FERRY * * This program is free software; you can redistribute it and/or modify @@ -23,8 +23,7 @@ * \brief File that is entry point to call Dolibarr WebServices */ -// This is to make Dolibarr working with Plesk -set_include_path($_SERVER['DOCUMENT_ROOT'].'/htdocs'); +if (! defined("NOCSRFCHECK")) define("NOCSRFCHECK",'1'); require_once '../master.inc.php'; require_once NUSOAP_PATH.'/nusoap.php'; // Include SOAP diff --git a/htdocs/webservices/server_project.php b/htdocs/webservices/server_project.php index 8838f726d63..5400e069c3f 100644 --- a/htdocs/webservices/server_project.php +++ b/htdocs/webservices/server_project.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2006-2016 Laurent Destailleur * Copyright (C) 2016 Ion Agorria * * This program is free software; you can redistribute it and/or modify @@ -21,8 +21,7 @@ * \brief File that is entry point to call Dolibarr WebServices */ -// This is to make Dolibarr working with Plesk -set_include_path($_SERVER['DOCUMENT_ROOT'].'/htdocs'); +if (! defined("NOCSRFCHECK")) define("NOCSRFCHECK",'1'); require_once '../master.inc.php'; require_once NUSOAP_PATH.'/nusoap.php'; // Include SOAP diff --git a/htdocs/webservices/server_supplier_invoice.php b/htdocs/webservices/server_supplier_invoice.php index fea871ac077..ea162ef2a8b 100644 --- a/htdocs/webservices/server_supplier_invoice.php +++ b/htdocs/webservices/server_supplier_invoice.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2006-2016 Laurent Destailleur * * 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 @@ -20,8 +20,7 @@ * \brief File that is entry point to call Dolibarr WebServices */ -// This is to make Dolibarr working with Plesk -set_include_path($_SERVER['DOCUMENT_ROOT'].'/htdocs'); +if (! defined("NOCSRFCHECK")) define("NOCSRFCHECK",'1'); require_once '../master.inc.php'; require_once NUSOAP_PATH.'/nusoap.php'; // Include SOAP diff --git a/htdocs/webservices/server_thirdparty.php b/htdocs/webservices/server_thirdparty.php index 50b8e80e363..6b2c94a36fd 100644 --- a/htdocs/webservices/server_thirdparty.php +++ b/htdocs/webservices/server_thirdparty.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2006-2016 Laurent Destailleur * * 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 @@ -20,8 +20,7 @@ * \brief File that is entry point to call Dolibarr WebServices */ -// This is to make Dolibarr working with Plesk -set_include_path($_SERVER['DOCUMENT_ROOT'].'/htdocs'); +if (! defined("NOCSRFCHECK")) define("NOCSRFCHECK",'1'); require_once '../master.inc.php'; require_once NUSOAP_PATH.'/nusoap.php'; // Include SOAP diff --git a/htdocs/webservices/server_user.php b/htdocs/webservices/server_user.php index 6339486922f..c4d8ce08724 100644 --- a/htdocs/webservices/server_user.php +++ b/htdocs/webservices/server_user.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2006-2016 Laurent Destailleur * * 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 @@ -18,11 +18,9 @@ /** * \file htdocs/webservices/server_user.php * \brief File that is entry point to call Dolibarr WebServices - * \version $Id: server_user.php,v 1.7 2010/12/19 11:49:37 eldy Exp $ */ -// This is to make Dolibarr working with Plesk -set_include_path($_SERVER['DOCUMENT_ROOT'].'/htdocs'); +if (! defined("NOCSRFCHECK")) define("NOCSRFCHECK",'1'); require_once '../master.inc.php'; require_once NUSOAP_PATH.'/nusoap.php'; // Include SOAP diff --git a/htdocs/websites/class/website.class.php b/htdocs/websites/class/website.class.php index e87e830bb77..e75cacf9100 100644 --- a/htdocs/websites/class/website.class.php +++ b/htdocs/websites/class/website.class.php @@ -85,6 +85,12 @@ class Website extends CommonObject * @var integer */ public $fk_default_home; + /** + * @var string + */ + public $virtualhost; + + public $records; /** @@ -143,7 +149,8 @@ class Website extends CommonObject $sql.= 'ref,'; $sql.= 'description,'; $sql.= 'status,'; - $sql.= 'fk_default_home,'; + $sql.= 'fk_default_home,'; + $sql.= 'virtualhost,'; $sql.= 'date_creation,'; $sql.= 'date_modification'; @@ -154,6 +161,7 @@ class Website extends CommonObject $sql .= ' '.(! isset($this->description)?'NULL':"'".$this->db->escape($this->description)."'").','; $sql .= ' '.(! isset($this->status)?'NULL':$this->status).','; $sql .= ' '.(! isset($this->fk_default_home)?'NULL':$this->fk_default_home).','; + $sql .= ' '.(! isset($this->virtualhost)?'NULL':$this->virtualhost).','; $sql .= ' '.(! isset($this->date_creation) || dol_strlen($this->date_creation)==0?'NULL':"'".$this->db->idate($this->date_creation)."'").','; $sql .= ' '.(! isset($this->date_modification) || dol_strlen($this->date_modification)==0?'NULL':"'".$this->db->idate($this->date_modification)."'"); @@ -214,6 +222,7 @@ class Website extends CommonObject $sql .= " t.description,"; $sql .= " t.status,"; $sql .= " t.fk_default_home,"; + $sql .= " t.virtualhost,"; $sql .= " t.date_creation,"; $sql .= " t.date_modification,"; $sql .= " t.tms"; @@ -237,6 +246,7 @@ class Website extends CommonObject $this->description = $obj->description; $this->status = $obj->status; $this->fk_default_home = $obj->fk_default_home; + $this->virtualhost = $obj->virtualhost; $this->date_creation = $this->db->jdate($obj->date_creation); $this->date_modification = $this->db->jdate($obj->date_modification); $this->tms = $this->db->jdate($obj->tms); @@ -281,7 +291,8 @@ class Website extends CommonObject $sql .= " t.ref,"; $sql .= " t.description,"; $sql .= " t.status,"; - $sql .= " t.fk_default_home,"; + $sql .= " t.fk_default_home,"; + $sql .= " t.virtualhost,"; $sql .= " t.date_creation,"; $sql .= " t.date_modification,"; $sql .= " t.tms"; @@ -321,6 +332,7 @@ class Website extends CommonObject $line->description = $obj->description; $line->status = $obj->status; $line->fk_default_home = $obj->fk_default_home; + $line->virtualhost = $obj->virtualhost; $line->date_creation = $this->db->jdate($obj->date_creation); $line->date_modification = $this->db->jdate($obj->date_modification); $line->tms = $this->db->jdate($obj->tms); @@ -380,6 +392,7 @@ class Website extends CommonObject $sql .= ' description = '.(isset($this->description)?"'".$this->db->escape($this->description)."'":"null").','; $sql .= ' status = '.(isset($this->status)?$this->status:"null").','; $sql .= ' fk_default_home = '.(($this->fk_default_home > 0)?$this->fk_default_home:"null").','; + $sql .= ' virtualhost = '.(($this->virtualhost != '')?"'".$this->db->escape($this->virtualhost)."'":"null").','; $sql .= ' date_creation = '.(! isset($this->date_creation) || dol_strlen($this->date_creation) != 0 ? "'".$this->db->idate($this->date_creation)."'" : 'null').','; $sql .= ' date_modification = '.(! isset($this->date_modification) || dol_strlen($this->date_modification) != 0 ? "'".$this->db->idate($this->date_modification)."'" : 'null').','; $sql .= ' tms = '.(dol_strlen($this->tms) != 0 ? "'".$this->db->idate($this->tms)."'" : "'".$this->db->idate(dol_now())."'"); @@ -627,6 +640,7 @@ class Website extends CommonObject $this->description = 'A specimen website'; $this->status = ''; $this->fk_default_home = null; + $this->virtualhost = 'http://myvirtualhost'; $this->date_creation = dol_now(); $this->date_modification = dol_now(); $this->tms = dol_now(); @@ -665,6 +679,10 @@ class WebsiteLine * @var int */ public $fk_default_home; + /** + * @var string + */ + public $virtualhost; /** * @var mixed */ diff --git a/htdocs/websites/class/websitepage.class.php b/htdocs/websites/class/websitepage.class.php index 65e56e030a1..63dc35b8084 100644 --- a/htdocs/websites/class/websitepage.class.php +++ b/htdocs/websites/class/websitepage.class.php @@ -183,7 +183,7 @@ class WebsitePage extends CommonObject * Load object in memory from the database * * @param int $id Id object - * @param string $website_id Web site page + * @param string $website_id Web site id * @param string $page Page name * * @return int <0 if KO, 0 if not found, >0 if OK @@ -376,14 +376,11 @@ class WebsitePage extends CommonObject $this->status = trim($this->status); } - - // Check parameters // Put here code to add a control on parameters values // Update request $sql = 'UPDATE ' . MAIN_DB_PREFIX . $this->table_element . ' SET'; - $sql .= ' fk_website = '.(isset($this->fk_website)?$this->fk_website:"null").','; $sql .= ' pageurl = '.(isset($this->pageurl)?"'".$this->db->escape($this->pageurl)."'":"null").','; $sql .= ' title = '.(isset($this->title)?"'".$this->db->escape($this->title)."'":"null").','; @@ -394,8 +391,6 @@ class WebsitePage extends CommonObject $sql .= ' date_creation = '.(! isset($this->date_creation) || dol_strlen($this->date_creation) != 0 ? "'".$this->db->idate($this->date_creation)."'" : 'null').','; $sql .= ' date_modification = '.(! isset($this->date_modification) || dol_strlen($this->date_modification) != 0 ? "'".$this->db->idate($this->date_modification)."'" : 'null').','; $sql .= ' tms = '.(dol_strlen($this->tms) != 0 ? "'".$this->db->idate($this->tms)."'" : "'".$this->db->idate(dol_now())."'"); - - $sql .= ' WHERE rowid=' . $this->id; $this->db->begin(); @@ -407,6 +402,12 @@ class WebsitePage extends CommonObject dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR); } + if ($this->old_object->pageurl != $this->pageurl) + { + dol_syslog("The alias was changed, we must rename/recreate the page file into document"); + + } + if (!$error && !$notrigger) { // Uncomment this and change MYOBJECT to your own tag if you // want this action calls a trigger. diff --git a/htdocs/websites/index.php b/htdocs/websites/index.php index ae29dab196b..d0aa6424787 100644 --- a/htdocs/websites/index.php +++ b/htdocs/websites/index.php @@ -123,8 +123,9 @@ if ($pageid > 0 && $action != 'add') global $dolibarr_main_data_root; $pathofwebsite=$dolibarr_main_data_root.'/websites/'.$website; -$filecss=$pathofwebsite.'/styles.css'; +$filecss=$pathofwebsite.'/styles.css.php'; $filetpl=$pathofwebsite.'/page'.$pageid.'.tpl.php'; +$fileindex=$pathofwebsite.'/index.php'; // Define $urlwithroot $urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root)); @@ -137,6 +138,8 @@ $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain * Actions */ +if (GETPOST('refreshsite')) $pageid=0; // If we change the site, we reset the pageid. + // Add page if ($action == 'add') { @@ -174,48 +177,9 @@ if ($action == 'add') { $db->rollback(); } -} - -// Update page -if ($action == 'update') -{ - $db->begin(); - - $res = $object->fetch(0, $website); - - $objectpage->fk_website = $object->id; - $objectpage->pageurl = GETPOST('WEBSITE_PAGENAME'); - - $res = $objectpage->fetch(0, $object->fk_website, $objectpage->pageurl); - - if ($res > 0) - { - $objectpage->title = GETPOST('WEBSITE_TITLE'); - $objectpage->description = GETPOST('WEBSITE_DESCRIPTION'); - $objectpage->keyword = GETPOST('WEBSITE_KEYWORD'); - - $res = $objectpage->update($user); - if (! $res > 0) - { - $error++; - setEventMessages($objectpage->error, $objectpage->errors, 'errors'); - } - - if (! $error) - { - $db->commit(); - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - $action=''; - } - else - { - $db->rollback(); - } - } - else - { - dol_print_error($db); - } + + $action = 'preview'; + $id = $objectpage->id; } // Update page @@ -258,28 +222,47 @@ if ($action == 'delete') // Update css if ($action == 'updatecss') { - $db->begin(); + //$db->begin(); $res = $object->fetch(0, $website); + /* $res = $object->update($user); if ($res > 0) { $db->commit(); - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); $action=''; } else { + $error++; $db->rollback(); }*/ - $csscontent = GETPOST('WEBSITE_CSS_INLINE'); + $csscontent = ''."\n"; + $csscontent.= '"."\n"; + $csscontent.= ''."\n"; + $csscontent.= GETPOST('WEBSITE_CSS_INLINE'); + + dol_syslog("Save file css into ".$filecss); dol_mkdir($pathofwebsite); - file_put_contents($filecss, $csscontent); + $result = file_put_contents($filecss, $csscontent); if (! empty($conf->global->MAIN_UMASK)) @chmod($filecss, octdec($conf->global->MAIN_UMASK)); + + if (! $result) + { + $error++; + setEventMessages('Failed to write file '.$filecss, null, 'errors'); + } + + if (! $error) + { + setEventMessages($langs->trans("Saved"), null, 'mesgs'); + } $action='preview'; } @@ -301,7 +284,23 @@ if ($action == 'setashome') if (! $error) { $db->commit(); - setEventMessages($langs->trans("Saved"), null, 'mesgs'); + + // Generate the index.php page to be the home page + //------------------------------------------------- + dol_mkdir($pathofwebsite); + dol_delete_file($fileindex); + + $indexcontent = ''."\n"; + $result = file_put_contents($fileindex, $indexcontent); + if (! empty($conf->global->MAIN_UMASK)) + @chmod($fileindex, octdec($conf->global->MAIN_UMASK)); + + if ($result) setEventMessages($langs->trans("Saved"), null, 'mesgs'); + else setEventMessages('Failed to write file '.$fileindex, null, 'errors'); + $action='preview'; } else @@ -310,7 +309,7 @@ if ($action == 'setashome') } } -// Update page +// Update page (meta) if ($action == 'updatemeta') { $db->begin(); @@ -321,7 +320,9 @@ if ($action == 'updatemeta') $res = $objectpage->fetch($pageid, $object->fk_website); if ($res > 0) { - $objectpage->pageurl = GETPOST('WEBSITE_PAGENAME'); + $objectpage->old_object = clone $objectpage; + + $objectpage->pageurl = GETPOST('WEBSITE_PAGENAME'); $objectpage->title = GETPOST('WEBSITE_TITLE'); $objectpage->description = GETPOST('WEBSITE_DESCRIPTION'); $objectpage->keywords = GETPOST('WEBSITE_KEYWORDS'); @@ -336,7 +337,83 @@ if ($action == 'updatemeta') if (! $error) { $db->commit(); - setEventMessages($langs->trans("Saved"), null, 'mesgs'); + + $filemaster=$pathofwebsite.'/master.inc.php'; + $fileoldalias=$pathofwebsite.'/'.$objectpage->old_object->pageurl.'.php'; + $filealias=$pathofwebsite.'/'.$objectpage->pageurl.'.php'; + + dol_mkdir($pathofwebsite); + + + // Now generate the master.inc.php page + dol_syslog("We regenerate the master file"); + dol_delete_file($filemaster); + + $mastercontent = ''."\n"; + $result = file_put_contents($filemaster, $mastercontent); + if (! empty($conf->global->MAIN_UMASK)) + @chmod($filemaster, octdec($conf->global->MAIN_UMASK)); + + if (! $result) setEventMessages('Failed to write file '.$filemaster, null, 'errors'); + + + // Now generate the alias.php page + if (! empty($fileoldalias)) + { + dol_syslog("We regenerate alias page new name=".$filealias.", old name=".$fileoldalias); + dol_delete_file($fileoldalias); + } + + $aliascontent = 'id.".tpl.php';\n"; + $aliascontent.= '?>'."\n"; + $result = file_put_contents($filealias, $aliascontent); + if (! empty($conf->global->MAIN_UMASK)) + @chmod($filealias, octdec($conf->global->MAIN_UMASK)); + + if (! $result) setEventMessages('Failed to write file '.$filealias, null, 'errors'); + + + // Now create the .tpl file (duplicate code with actions updatecontent but we need this to save new header) + dol_syslog("We regenerate the tpl page filetpl=".$filetpl); + + dol_delete_file($filetpl); + + $tplcontent =''; + $tplcontent.= ''."\n"; + $tplcontent.= ''."\n"; + $tplcontent.= '
'."\n"; + $tplcontent.= ''."\n"; + $tplcontent.= ''."\n"; + $tplcontent.= ''."\n"; + $tplcontent.= ''."\n"; + $tplcontent.= ''."\n"; + $tplcontent.= ''."\n"; + $tplcontent.= ''."\n"; + $tplcontent.= ''."\n"; + $tplcontent.= ''.dol_escape_htmltag($objectpage->title).''."\n"; + $tplcontent.= '
'."\n"; + + $tplcontent.= ''."\n"; + $tplcontent.= $objectpage->content."\n"; + $tplcontent.= ''."\n"; + //var_dump($filetpl);exit; + $result = file_put_contents($filetpl, $tplcontent); + if (! empty($conf->global->MAIN_UMASK)) + @chmod($filetpl, octdec($conf->global->MAIN_UMASK)); + + if ($result) + { + setEventMessages($langs->trans("Saved"), null, 'mesgs'); + //header("Location: ".$_SERVER["PHP_SELF"].'?website='.$website.'&pageid='.$pageid); + //exit; + } + else setEventMessages('Failed to write file '.$filetpl, null, 'errors'); + $action='preview'; } else @@ -368,7 +445,7 @@ if ($action == 'updatecontent') /* $objectpage->content = preg_replace('//s', '', $objectpage->content); */ $res = $objectpage->update($user); - if (! $res > 0) + if ($res < 0) { $error++; setEventMessages($objectpage->error, $objectpage->errors, 'errors'); @@ -377,16 +454,81 @@ if ($action == 'updatecontent') if (! $error) { $db->commit(); - setEventMessages($langs->trans("Saved"), null, 'mesgs'); + $filemaster=$pathofwebsite.'/master.inc.php'; + //$fileoldalias=$pathofwebsite.'/'.$objectpage->old_object->pageurl.'.php'; + $filealias=$pathofwebsite.'/'.$objectpage->pageurl.'.php'; + dol_mkdir($pathofwebsite); + + + // Now generate the master.inc.php page + dol_syslog("We regenerate the master file"); + dol_delete_file($filemaster); + + $mastercontent = ''."\n"; + $result = file_put_contents($filemaster, $mastercontent); + if (! empty($conf->global->MAIN_UMASK)) + @chmod($filemaster, octdec($conf->global->MAIN_UMASK)); + + if (! $result) setEventMessages('Failed to write file '.$filemaster, null, 'errors'); + + + // Now generate the alias.php page + if (! empty($fileoldalias)) + { + dol_syslog("We regenerate alias page new name=".$filealias.", old name=".$fileoldalias); + dol_delete_file($fileoldalias); + } + + $aliascontent = 'id.".tpl.php';\n"; + $aliascontent.= '?>'."\n"; + $result = file_put_contents($filealias, $aliascontent); + if (! empty($conf->global->MAIN_UMASK)) + @chmod($filealias, octdec($conf->global->MAIN_UMASK)); + + if (! $result) setEventMessages('Failed to write file '.$filealias, null, 'errors'); + + + // Now create the .tpl file + // TODO Keep a one time generate file or include a dynamicaly generated content ? dol_delete_file($filetpl); - file_put_contents($filetpl, $objectpage->content); + + $tplcontent =''; + $tplcontent.= ""."\n"; + $tplcontent.= ''."\n"; + $tplcontent.= '
'."\n"; + $tplcontent.= ''."\n"; + $tplcontent.= ''."\n"; + $tplcontent.= ''."\n"; + $tplcontent.= ''."\n"; + $tplcontent.= ''."\n"; + $tplcontent.= ''."\n"; + $tplcontent.= ''."\n"; + $tplcontent.= ''."\n"; + $tplcontent.= ''.dol_escape_htmltag($objectpage->title).''."\n"; + $tplcontent.= '
'."\n"; + + $tplcontent.= ''."\n"; + $tplcontent.= $objectpage->content."\n"; + $tplcontent.= ''."\n"; + //var_dump($filetpl);exit; + $result = file_put_contents($filetpl, $tplcontent); if (! empty($conf->global->MAIN_UMASK)) @chmod($filetpl, octdec($conf->global->MAIN_UMASK)); - - header("Location: ".$_SERVER["PHP_SELF"].'?website='.$website.'&pageid='.$pageid); - exit; + + if ($result) + { + setEventMessages($langs->trans("Saved"), null, 'mesgs'); + header("Location: ".$_SERVER["PHP_SELF"].'?website='.$website.'&pageid='.$pageid); + exit; + } + else setEventMessages('Failed to write file '.$filetpl, null, 'errors'); } else { @@ -411,7 +553,7 @@ $help_url=''; llxHeader('', $langs->trans("WebsiteSetup"), $help_url); -print "\n".'
'; +print "\n".'
'; print ''; if ($action == 'create') { @@ -452,6 +594,8 @@ print '
'; if (count($object->records) > 0) { + // ***** Part for web sites + print '
'; print $langs->trans("Website").': '; print '
'; @@ -476,15 +620,28 @@ if (count($object->records) > 0) } $out.=''; print $out; - print ''; + print ''; if ($website) { - print ' - '.$langs->trans("RealURL").' '; $realurl=$urlwithroot.'/public/websites/index.php?website='.$website; - print ' '; - print ''.$langs->trans("ViewSiteInNewTab").''; + $dataroot=DOL_DATA_ROOT.'/websites/'.$website; + if (! empty($object->virtualhost)) $realurl=$object->virtualhost; } + + if ($website && $action == 'preview') + { + $disabled=''; + if (empty($user->rights->websites->create)) $disabled=' disabled="disabled"'; + + print '   '; + + //print ''; + print ''; + print ''; + print ''; + } + print '
'; // Button for websites @@ -492,13 +649,22 @@ if (count($object->records) > 0) if ($action == 'preview') { - $disabled=''; - if (empty($user->rights->websites->create)) $disabled=' disabled="disabled"'; - - //print ''; - print ''; - print ''; - print ''; + print '
'; + print ''; + //print ''; + $htmltext=$langs->trans("SetHereVirtualHost", $dataroot); + print $form->textwithpicto('', $htmltext); + print '
'; + + $urlext=$realurl; + $urlint=DOL_URL_ROOT.'/public/websites/index.php?website='.$website; + print ''; + print $form->textwithpicto('', $langs->trans("PreviewSiteServedByWebServer", $langs->transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $urlext), 1, 'preview_ext'); + print ''; + + print ''; + print $form->textwithpicto('', $langs->trans("PreviewSiteServedByDolibarr", $langs->transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $urlint), 1, 'preview'); + print ''; } if (in_array($action, array('editcss','editmenu','create'))) @@ -511,7 +677,8 @@ if (count($object->records) > 0) print '
'; - // Part for pages + // ***** Part for pages + if ($website) { print ''; @@ -525,35 +692,63 @@ if (count($object->records) > 0) print $langs->trans("Page").': '; print ''; print '
'; - $out=''; - $out.=''; + if ($atleastonepage) { - if (empty($pageid) && $action != 'create') $pageid=$valpage->id; + if (empty($pageid) && $action != 'create') // Page id is not defined, we try to take one + { + $firstpageid=0;$homepageid=0; + foreach($array as $key => $valpage) + { + if (empty($firstpageid)) $firstpageid=$valpage->id; + if ($object->fk_default_home && $key == $object->fk_default_home) $homepageid=$valpage->id; + } + $pageid=$homepageid?$homepageid:$firstpageid; // We choose home page and if not defined yet, we take first page + } - $out.=''; + $out.=''; + } } + else $out.=''; + $out.=''; + print $out; } - else $out.=''; - $out.=''; - print $out; - print ''; - print ''; + else + { + print $langs->trans("New"); + } + + print ''; //print $form->selectarray('page', $array); - if ($website && $pageid > 0) + if ($action == 'preview') { - print ' - '.$langs->trans("RealURL").' '; - $realurl=$urlwithroot.'/public/websites/index.php?website='.$website.'&page='.$pageid; - print ' '; - print ''.$langs->trans("ViewPageInNewTab").''; + $disabled=''; + if (empty($user->rights->websites->create)) $disabled=' disabled="disabled"'; + + if ($pageid > 0) + { + print '   '; + + if ($object->fk_default_home > 0 && $pageid == $object->fk_default_home) print ''; + else print ''; + print ''; + print ''; + //print ''.dol_escape_htmltag($langs->trans("EditPageMeta")).''; + //print ''.dol_escape_htmltag($langs->trans("EditPageContent")).''; + print ''; + } } print '
'; @@ -562,31 +757,74 @@ if (count($object->records) > 0) print '
'; - if ($action == 'preview') + if ($website && $pageid > 0 && $action == 'preview') { - $disabled=''; - if (empty($user->rights->websites->create)) $disabled=' disabled="disabled"'; - - if ($pageid > 0) - { - if ($object->fk_default_home > 0 && $pageid == $object->fk_default_home) print ''; - else print ''; - print ''; - print ''; - //print ''.dol_escape_htmltag($langs->trans("EditPageMeta")).''; - //print ''.dol_escape_htmltag($langs->trans("EditPageContent")).''; - } + $websitepage = new WebSitePage($db); + $websitepage->fetch($pageid); + + $realpage=$urlwithroot.'/public/websites/index.php?website='.$website.'&page='.$pageid; + $pagealias = $websitepage->pageurl; + + print '
'; + print ''; + //print ''; + $htmltext=$langs->trans("WEBSITE_PAGENAME", $pagealias); + print $form->textwithpicto('', $htmltext); + print '
'; + + $urlext=$realurl.'/'.$pagealias.'.php'; + print ''; + print $form->textwithpicto('', $langs->trans("PreviewSiteServedByWebServer", $langs->transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $urlext), 1, 'preview_ext'); + print ''; + + print ''; + print $form->textwithpicto('', $langs->trans("PreviewSiteServedByDolibarr", $langs->transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $realpage), 1, 'preview'); + print ''; // View page in new Tab + //print ''; + + // TODO Add js to save alias like we save virtual host name and use dynamic virtual host for url of id=previewpageext } - if (! in_array($action, array('editcss','editmenu','create'))) { if ($action != 'preview') print ''; - if (preg_match('/^create/',$action)) print ''; - if (preg_match('/^edit/',$action)) print ''; + if (preg_match('/^create/',$action)) print ''; + if (preg_match('/^edit/',$action)) print ''; } - + print '
'; + if ($action == 'preview') + { + // Adding jquery code to change on the fly url of preview ext + if (! empty($conf->use_javascript_ajax)) + { + print ''; + } + } } } else @@ -615,12 +853,15 @@ if ($action == 'editcss') print '
'; $csscontent = @file_get_contents($filecss); - + // Clean php css file to get only css part + $csscontent = preg_replace('//s', '', $csscontent); + dol_fiche_head(); + print ''."\n"; print ''; - print '
'; + print '
'; print $langs->trans('WebSite'); print ''; print $website; @@ -657,6 +898,7 @@ if ($action == 'editmeta' || $action == 'create') dol_fiche_head(); + print ''."\n"; print ''; if ($action != 'create') @@ -676,7 +918,7 @@ if ($action == 'editmeta' || $action == 'create') if (GETPOST('WEBSITE_DESCRIPTION')) $pagedescription=GETPOST('WEBSITE_DESCRIPTION'); if (GETPOST('WEBSITE_KEYWORDS')) $pagekeywords=GETPOST('WEBSITE_KEYWORDS'); - print '
'; + print '
'; print $langs->trans('WEBSITE_PAGENAME'); print ''; print ''; @@ -711,11 +953,13 @@ if ($action == 'editmeta' || $action == 'create') if ($action == 'editmedia') { + print ''."\n"; print '
'.$langs->trans("FeatureNotYetAvailable").''; } if ($action == 'editmenu') { + print ''."\n"; print '
'.$langs->trans("FeatureNotYetAvailable").''; } @@ -724,12 +968,21 @@ if ($action == 'editcontent') /* * Editing global variables not related to a specific theme */ + + $csscontent = @file_get_contents($filecss); + + $contentforedit = ''; + /*$contentforedit.=''."\n";*/ + $contentforedit .= $objectpage->content; + require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor=new DolEditor('PAGE_CONTENT',$objectpage->content,'',500,'Full','',true,true,true,5,60); - $doleditor->Create(); + $doleditor=new DolEditor('PAGE_CONTENT',$contentforedit,'',500,'Full','',true,true,true,5,60); + $doleditor->Create(0, '', false); } -print ''; +print "
\n\n"; @@ -739,7 +992,7 @@ if ($action == 'preview') { $objectpage->fetch($pageid); - print "\n".''."\n"; + print "\n".''."\n"; $csscontent = @file_get_contents($filecss); diff --git a/scripts/bank/export-bank-receipts.php b/scripts/bank/export-bank-receipts.php index 98ec3dd84cd..2116d51e65b 100755 --- a/scripts/bank/export-bank-receipts.php +++ b/scripts/bank/export-bank-receipts.php @@ -143,7 +143,7 @@ $objmodel = new $classname($db); // Define target path -$dirname = $conf->banque->dir_temp; +$dirname = $conf->bank->dir_temp; $filename = 'export-bank-receipts-'.$bankref.'-'.$num.'.'.$objmodel->extension; @@ -366,7 +366,7 @@ if ($resql) /*elseif ($links[$key]['type']=='sc') { if ($accountelem) $accountelem.= ', '; - //$accountelem.= ''; + //$accountelem.= ''; //$accountelem.= img_object($langs->transnoentitiesnoconv('ShowBill'),'bill').' '; $accountelem.= $langs->transnoentitiesnoconv("SocialContribution"); //$accountelem.= ''; diff --git a/scripts/cron/cron_run_jobs.php b/scripts/cron/cron_run_jobs.php index df755a50b64..e10d089c2a8 100755 --- a/scripts/cron/cron_run_jobs.php +++ b/scripts/cron/cron_run_jobs.php @@ -27,7 +27,6 @@ if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Disables token if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); -if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); if (! defined('NOLOGIN')) define('NOLOGIN','1'); //if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); @@ -80,6 +79,23 @@ if ($key != $conf->global->CRON_KEY) exit(-1); } +// If param userlogin is reserved word 'firstadmin' +if ($userlogin == 'firstadmin') +{ + $sql='SELECT login from '.MAIN_DB_PREFIX.'user WHERE admin = 1 ORDER BY entity LIMIT 1'; + $resql=$db->query($sql); + if ($resql) + { + $obj=$db->fetch_object($resql); + if ($obj) + { + $userlogin = $obj->login; + echo "First admin user found is login '".$userlogin."'\n
"; + } + } + else dol_print_error($db); +} + // Check user login $user=new User($db); $result=$user->fetch('',$userlogin); @@ -93,8 +109,8 @@ else { if (empty($user->id)) { - echo " User user login: ".$userlogin." do not exists"; - dol_syslog(" User user login:".$userlogin." do not exists", LOG_ERR); + echo "User login: ".$userlogin." does not exists"; + dol_syslog("User login:".$userlogin." does not exists", LOG_ERR); exit(-1); } } @@ -108,8 +124,7 @@ if (isset($argv[3]) || $argv[3]) $object = new Cronjob($db); $filter=array(); -if (empty($id)) { - $filter=array(); +if (! empty($id)) { $filter['t.rowid']=$id; } @@ -136,22 +151,25 @@ if(is_array($object->lines) && (count($object->lines)>0)) //If date_next_jobs is less of current date, execute the program, and store the execution time of the next execution in database if (($line->datenextrun < $now) && (empty($line->datestart) || $line->datestart <= $now) && (empty($line->dateend) || $line->dateend >= $now)) { - dol_syslog("cron_run_jobs.php:: torun line->datenextrun:".dol_print_date($line->datenextrun,'dayhourtext')." line->dateend:".dol_print_date($line->dateend,'dayhourtext')." now:".dol_print_date($now,'dayhourtext')); + dol_syslog("cron_run_jobs.php:: to run line->datenextrun:".dol_print_date($line->datenextrun,'dayhourrfc')." line->datestart:".dol_print_date($line->datestart,'dayhourrfc')." line->dateend:".dol_print_date($line->dateend,'dayhourrfc')." now:".dol_print_date($now,'dayhourrfc')); $cronjob=new Cronjob($db); $result=$cronjob->fetch($line->id); if ($result<0) { - echo "Error:".$cronjob->error; - dol_syslog("cron_run_jobs.php:: fetch Error".$cronjob->error, LOG_ERR); + echo "Error cronjob->fetch: ".$cronjob->error."\n"; + echo "Failed to fetch job ".$line->id."\n"; + dol_syslog("cron_run_jobs.php::fetch Error ".$cronjob->error, LOG_ERR); exit(-1); } // Execute job $result=$cronjob->run_jobs($userlogin); if ($result<0) { - echo "Error:".$cronjob->error; - dol_syslog("cron_run_jobs.php:: run_jobs Error".$cronjob->error, LOG_ERR); + echo "Error cronjob->run_job: ".$cronjob->error."\n"; + echo "At least one job failed. Go on menu Home-Setup-Admin tools to see result for each job.\n"; + echo "You can also enable module Log if not yet enabled, run again and take a look into dolibarr.log file\n"; + dol_syslog("cron_run_jobs.php::run_jobs Error ".$cronjob->error, LOG_ERR); exit(-1); } @@ -159,12 +177,17 @@ if(is_array($object->lines) && (count($object->lines)>0)) $result=$cronjob->reprogram_jobs($userlogin, $now); if ($result<0) { - echo "Error:".$cronjob->error; - dol_syslog("cron_run_jobs.php:: reprogram_jobs Error".$cronjob->error, LOG_ERR); + echo "Error cronjob->reprogram_job: ".$cronjob->error."\n"; + echo "Enable module Log if not yet enabled, run again and take a look into dolibarr.log file\n"; + dol_syslog("cron_run_jobs.php::reprogram_jobs Error ".$cronjob->error, LOG_ERR); exit(-1); } } + else + { + dol_syslog("cron_run_jobs.php:: job not qualified line->datenextrun:".dol_print_date($line->datenextrun,'dayhourrfc')." line->datestart:".dol_print_date($line->datestart,'dayhourrfc')." line->dateend:".dol_print_date($line->dateend,'dayhourrfc')." now:".dol_print_date($now,'dayhourrfc')); + } } } @@ -178,7 +201,7 @@ function usage($path,$script_file) { global $conf; - print "Usage: ".$script_file." securitykey userlogin [cronjobid]\n"; + print "Usage: ".$script_file." securitykey userlogin|'firstadmin' [cronjobid]\n"; print "The script return 0 when everything worked successfully.\n"; print "\n"; print "On Linux system, you can have cron jobs ran automatically by adding an entry into cron.\n"; diff --git a/scripts/product/migrate_picture_path.php b/scripts/product/migrate_picture_path.php index 9d3cba8452f..f8624ebc040 100755 --- a/scripts/product/migrate_picture_path.php +++ b/scripts/product/migrate_picture_path.php @@ -1,6 +1,6 @@ #!/usr/bin/env php +/* Copyright (C) 2007-2016 Laurent Destailleur * Copyright (C) 2015 Jean Heimburger * * This program is free software; you can redistribute it and/or modify @@ -21,7 +21,6 @@ * \file scripts/product/migrate_picture_path.php * \ingroup scripts * \brief Migrate pictures from old system prior to 3.7 to new path for 3.7+ - * */ $sapi_type = php_sapi_name(); @@ -119,7 +118,7 @@ function migrate_product_photospath($product) $handle=opendir($origin_osencoded); if (is_resource($handle)) { - while (($file = readdir($handle)) != false) + while (($file = readdir($handle)) !== false) { if ($file != '.' && $file != '..' && is_dir($origin_osencoded.'/'.$file)) { @@ -127,7 +126,7 @@ function migrate_product_photospath($product) if (is_resource($thumbs)) { dol_mkdir($destin.'/'.$file); - while (($thumb = readdir($thumbs)) != false) + while (($thumb = readdir($thumbs)) !== false) { dol_move($origin.'/'.$file.'/'.$thumb, $destin.'/'.$file.'/'.$thumb); } diff --git a/scripts/withdrawals/build_withdrawal_file.php b/scripts/withdrawals/build_withdrawal_file.php index 1a8c673c5f9..d381c32676a 100755 --- a/scripts/withdrawals/build_withdrawal_file.php +++ b/scripts/withdrawals/build_withdrawal_file.php @@ -70,6 +70,7 @@ if (! isset($argv[1])) { // Check parameters $withdrawreceipt=new BonPrelevement($db); +// $conf->global->PRELEVEMENT_CODE_BANQUE and $conf->global->PRELEVEMENT_CODE_GUICHET should be empty $result=$withdrawreceipt->create($conf->global->PRELEVEMENT_CODE_BANQUE,$conf->global->PRELEVEMENT_CODE_GUICHET,$argv[1]); diff --git a/test/phpunit/CMailFileTest.php b/test/phpunit/CMailFileTest.php index 092d2e1f41c..06f24ba45e0 100755 --- a/test/phpunit/CMailFileTest.php +++ b/test/phpunit/CMailFileTest.php @@ -177,7 +177,22 @@ class CMailFileTest extends PHPUnit_Framework_TestCase $result=$localobject->getValidAddress($src,3,1); print __METHOD__." result=".$result."\n"; $this->assertEquals($result,'"=?UTF-8?B?Sm9obiBEb2U=?=" '); - + + $src='John Doe '; + $result=$localobject->getValidAddress($src,4); + print __METHOD__." result=".$result."\n"; + $this->assertEquals($result,'John Doe'); + + $src='John Doe , John Doe2 , John Doe3 '; + $result=$localobject->getValidAddress($src,4); + print __METHOD__." result=".$result."\n"; + $this->assertEquals($result,'John Doe,John Doe2,John Doe3'); + + $src='John Doe , John Doe2 , John Doe3 '; + $result=$localobject->getValidAddress($src,4,0,2); + print __METHOD__." result=".$result."\n"; + $this->assertEquals($result,'John Doe,John Doe2...'); + return $result; } diff --git a/test/phpunit/CategorieTest.php b/test/phpunit/CategorieTest.php index d9e030ef9ef..574a8d793f9 100644 --- a/test/phpunit/CategorieTest.php +++ b/test/phpunit/CategorieTest.php @@ -200,7 +200,7 @@ class CategorieTest extends PHPUnit_Framework_TestCase // Get list of categories for product $localcateg=new Categorie($this->savdb); - $listofcateg=$localcateg->containing($localobject2->id, 'product', 'label'); + $listofcateg=$localcateg->containing($localobject2->id, Categorie::TYPE_PRODUCT, 'label'); $this->assertTrue(in_array('Specimen Category for product',$listofcateg), 'Categ not found linked to product when it should'); return $id; diff --git a/test/phpunit/EntrepotTest.php b/test/phpunit/EntrepotTest.php index d3d7c300308..e695bff34a3 100644 --- a/test/phpunit/EntrepotTest.php +++ b/test/phpunit/EntrepotTest.php @@ -233,7 +233,7 @@ class EntrepotTest extends PHPUnit_Framework_TestCase $localobject=new Entrepot($this->savdb); $result=$localobject->fetch($id); - $result=$localobject->delete($id); + $result=$localobject->delete($user); print __METHOD__." id=".$id." result=".$result."\n"; $this->assertLessThan($result, 0); diff --git a/test/phpunit/ExportTest.php b/test/phpunit/ExportTest.php index 7c14b0ccd64..364eaf7568d 100644 --- a/test/phpunit/ExportTest.php +++ b/test/phpunit/ExportTest.php @@ -120,9 +120,96 @@ class ExportTest extends PHPUnit_Framework_TestCase } + /** + * Other tests + * + * @return void + */ + public function testExportOther() + { + global $conf,$user,$langs,$db; + + $model='csv'; + + // Creation of class to export using model ExportXXX + $dir = DOL_DOCUMENT_ROOT . "/core/modules/export/"; + $file = "export_".$model.".modules.php"; + $classname = "Export".$model; + require_once $dir.$file; + $objmodel = new $classname($this->db); + + // First test without option USE_STRICT_CSV_RULES + unset($conf->global->USE_STRICT_CSV_RULES); + + $valtotest='A simple string'; + print __METHOD__." valtotest=".$valtotest."\n"; + $result = $objmodel->csvClean($valtotest, $langs->charset_output); + print __METHOD__." result=".$result."\n"; + $this->assertEquals($result, 'A simple string'); + + $valtotest='A string with , and ; inside'; + print __METHOD__." valtotest=".$valtotest."\n"; + $result = $objmodel->csvClean($valtotest, $langs->charset_output); + print __METHOD__." result=".$result."\n"; + $this->assertEquals($result, '"A string with , and ; inside"'); + + $valtotest='A string with " inside'; + print __METHOD__." valtotest=".$valtotest."\n"; + $result = $objmodel->csvClean($valtotest, $langs->charset_output); + print __METHOD__." result=".$result."\n"; + $this->assertEquals($result, '"A string with "" inside"'); + + $valtotest='A string with " inside and '."\r\n".' carriage returns'; + print __METHOD__." valtotest=".$valtotest."\n"; + $result = $objmodel->csvClean($valtotest, $langs->charset_output); + print __METHOD__." result=".$result."\n"; + $this->assertEquals($result, '"A string with "" inside and \n carriage returns"'); + + $valtotest='A string with html
content
inside
'."\n"; + print __METHOD__." valtotest=".$valtotest."\n"; + $result = $objmodel->csvClean($valtotest, $langs->charset_output); + print __METHOD__." result=".$result."\n"; + $this->assertEquals($result, '"A string with html
content
inside"'); + + // Same tests with strict mode + $conf->global->USE_STRICT_CSV_RULES=1; + + $valtotest='A simple string'; + print __METHOD__." valtotest=".$valtotest."\n"; + $result = $objmodel->csvClean($valtotest, $langs->charset_output); + print __METHOD__." result=".$result."\n"; + $this->assertEquals($result, 'A simple string'); + + $valtotest='A string with , and ; inside'; + print __METHOD__." valtotest=".$valtotest."\n"; + $result = $objmodel->csvClean($valtotest, $langs->charset_output); + print __METHOD__." result=".$result."\n"; + $this->assertEquals($result, '"A string with , and ; inside"'); + + $valtotest='A string with " inside'; + print __METHOD__." valtotest=".$valtotest."\n"; + $result = $objmodel->csvClean($valtotest, $langs->charset_output); + print __METHOD__." result=".$result."\n"; + $this->assertEquals($result, '"A string with "" inside"'); + + $valtotest='A string with " inside and '."\r\n".' carriage returns'; + print __METHOD__." valtotest=".$valtotest."\n"; + $result = $objmodel->csvClean($valtotest, $langs->charset_output); + print __METHOD__." result=".$result."\n"; + $this->assertEquals($result, "\"A string with \"\" inside and \r\n carriage returns\""); + + $valtotest='A string with html
content
inside
'."\n"; + print __METHOD__." valtotest=".$valtotest."\n"; + $result = $objmodel->csvClean($valtotest, $langs->charset_output); + print __METHOD__." result=".$result."\n"; + $this->assertEquals($result, '"A string with html
content
inside"'); + + } + /** * Test export function for a personalized dataset * + * @depends testExportOther * @return void */ public function testExportPersonalizedExport() @@ -266,4 +353,5 @@ class ExportTest extends PHPUnit_Framework_TestCase return true; } + } diff --git a/test/phpunit/FactureTest.php b/test/phpunit/FactureTest.php index 142a5284989..8c3d4a2374a 100644 --- a/test/phpunit/FactureTest.php +++ b/test/phpunit/FactureTest.php @@ -274,7 +274,7 @@ class FactureTest extends PHPUnit_Framework_TestCase $localobject=new Facture($this->savdb); $result=$localobject->fetch($id); - $result=$localobject->delete($id); + $result=$localobject->delete($user); print __METHOD__." id=".$id." result=".$result."\n"; $this->assertGreaterThanOrEqual(0, $result); diff --git a/test/phpunit/FilesLibTest.php b/test/phpunit/FilesLibTest.php index b9f334315e6..f9000006b46 100644 --- a/test/phpunit/FilesLibTest.php +++ b/test/phpunit/FilesLibTest.php @@ -399,4 +399,23 @@ class FilesLibTest extends PHPUnit_Framework_TestCase print __METHOD__." result=".join(',',$result)."\n"; $this->assertEquals(0,count($result)); } + + /** + * testDolDirList + * + * @return string + * + * @depends testDolCompressUnCompress + * The depends says test is run only if previous is ok + */ + public function testDolDirList() + { + global $conf,$user,$langs,$db; + + // Scan dir to guaruante we on't have library jquery twice (we accept exception of duplicte into ckeditor because all dir is removed for debian package, so there is no duplicate). + $founddirs=dol_dir_list(DOL_DOCUMENT_ROOT.'/includes/', 'files', 1, '^jquery\.js', array('ckeditor')); + print __METHOD__." count(founddirs)=".count($founddirs)."\n"; + $this->assertEquals(1,count($founddirs)); + } + } diff --git a/test/phpunit/Functions2LibTest.php b/test/phpunit/Functions2LibTest.php index 13462afc601..470a570bf6e 100644 --- a/test/phpunit/Functions2LibTest.php +++ b/test/phpunit/Functions2LibTest.php @@ -223,7 +223,7 @@ class Functions2LibTest extends PHPUnit_Framework_TestCase $ip='169.254.0.0'; $result=is_ip($ip); print __METHOD__." for ".$ip." result=".$result."\n"; - $this->assertEquals(0,$result,$ip); + //$this->assertEquals(2,$result,$ip); // Assertion disabled because returned value differs between PHP patch version $ip='1.2.3.4'; $result=is_ip($ip); diff --git a/test/phpunit/FunctionsLibTest.php b/test/phpunit/FunctionsLibTest.php index 79bcc931c84..ee7288e2928 100644 --- a/test/phpunit/FunctionsLibTest.php +++ b/test/phpunit/FunctionsLibTest.php @@ -206,40 +206,43 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase // True $input='xxx'; $after=dol_textishtml($input); - $this->assertTrue($after); + $this->assertTrue($after, 'Test with html tag'); $input='xxx'; $after=dol_textishtml($input); - $this->assertTrue($after); + $this->assertTrue($after, 'Test with body tag'); $input='xxx yyy zzz'; $after=dol_textishtml($input); - $this->assertTrue($after); + $this->assertTrue($after, 'Test with b tag'); + $input='xxx yyy zzz'; + $after=dol_textishtml($input); + $this->assertTrue($after, 'Test with u tag'); $input='text with
some div
'; $after=dol_textishtml($input); - $this->assertTrue($after); + $this->assertTrue($after, 'Test with div tag'); $input='text with HTML   entities'; $after=dol_textishtml($input); - $this->assertTrue($after); + $this->assertTrue($after, 'Test with entities tag'); $input='xxx
'; $after=dol_textishtml($input); - $this->assertTrue($after); + $this->assertTrue($after, 'Test with entities br'); $input='xxx
'; $after=dol_textishtml($input); - $this->assertTrue($after); + $this->assertTrue($after, 'Test with entities br'); $input='xxx
'; $after=dol_textishtml($input); - $this->assertTrue($after); + $this->assertTrue($after, 'Test with entities br and attributes'); $input='xxx
'; $after=dol_textishtml($input); - $this->assertTrue($after); + $this->assertTrue($after, 'Test with entities br and attributes bis'); $input='

abc

'; $after=dol_textishtml($input); - $this->assertTrue($after); + $this->assertTrue($after, 'Test with entities h2'); $input=''; $after=dol_textishtml($input); - $this->assertTrue($after,'Failure on test of img tag'); + $this->assertTrue($after, 'Test with img tag'); $input=''; $after=dol_textishtml($input); - $this->assertTrue($after,'Failure on test of a tag'); + $this->assertTrue($after, 'Test with a tag'); // False $input='xxx < br>'; @@ -621,6 +624,42 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase $this->assertEquals("21 jump street\nMyTown, MyState, 99999",$address); } + + /** + * testDolFormatAddress + * + * @return void + */ + public function testDolPrintPhone() + { + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; + + $object=new Societe($db); + $object->initAsSpecimen(); + + $object->country_code='FR'; + $phone=dol_print_phone('1234567890', $object->country_code); + $this->assertEquals('12 34 56 78 90', $phone, 'Phone for FR 1'); + + $object->country_code='FR'; + $phone=dol_print_phone('1234567890', $object->country_code, 0, 0, 0, ''); + $this->assertEquals('1234567890', $phone, 'Phone for FR 2'); + + $object->country_code='FR'; + $phone=dol_print_phone('1234567890', $object->country_code, 0, 0, 0, ' '); + $this->assertEquals('12 34 56 78 90', $phone, 'Phone for FR 3'); + + $object->country_code='CA'; + $phone=dol_print_phone('1234567890', $object->country_code, 0, 0, 0, ' '); + $this->assertEquals('(123) 456-7890', $phone, 'Phone for CA 1'); + + } + + /** * testImgPicto * diff --git a/test/phpunit/PgsqlTest.php b/test/phpunit/PgsqlTest.php index 04693c017ed..05efcaeb30b 100644 --- a/test/phpunit/PgsqlTest.php +++ b/test/phpunit/PgsqlTest.php @@ -162,6 +162,18 @@ class PgsqlTest extends PHPUnit_Framework_TestCase print __METHOD__." result=".$result."\n"; $this->assertEquals($result, $sql.' DEFERRABLE INITIALLY IMMEDIATE;'); + // Test GROUP_CONCAT (without SEPARATOR) + $sql="SELECT a.b, GROUP_CONCAT(a.c) FROM table GROUP BY a.b"; + $result=DoliDBPgsql::convertSQLFromMysql($sql); + print __METHOD__." result=".$result."\n"; + $this->assertEquals($result, "SELECT a.b, STRING_AGG(a.c, ',') FROM table GROUP BY a.b", 'Test GROUP_CONCAT (without SEPARATOR)'); + + // Test GROUP_CONCAT (with SEPARATOR) + $sql="SELECT a.b, GROUP_CONCAT(a.c SEPARATOR ',') FROM table GROUP BY a.b"; + $result=DoliDBPgsql::convertSQLFromMysql($sql); + print __METHOD__." result=".$result."\n"; + $this->assertEquals($result, "SELECT a.b, STRING_AGG(a.c, ',') FROM table GROUP BY a.b", 'Test GROUP_CONCAT (with SEPARATOR)'); + return $result; } } diff --git a/test/phpunit/RestAPIUserTest.php b/test/phpunit/RestAPIUserTest.php index 189c17a0bd3..a92bc80ed63 100644 --- a/test/phpunit/RestAPIUserTest.php +++ b/test/phpunit/RestAPIUserTest.php @@ -147,10 +147,10 @@ class RestAPIUserTest extends PHPUnit_Framework_TestCase { global $conf,$user,$langs,$db; - $url = $this->api_url.'/user/123456789?api_key='.$this->api_key; + $url = $this->api_url.'/users/123456789?api_key='.$this->api_key; //$addheaders=array('Content-Type: application/json'); - print __METHOD__." Request url=".$url."\n"; + print __METHOD__." Request GET url=".$url."\n"; $result=getURLContent($url, 'GET', '', 1, array()); //print __METHOD__." Result for unexisting user: ".var_export($result, true)."\n"; print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n"; @@ -159,9 +159,9 @@ class RestAPIUserTest extends PHPUnit_Framework_TestCase $this->assertNotNull($object, "Parsing of json result must no be null"); $this->assertEquals(404, $object['error']['code']); - $url = $this->api_url.'/user/1?api_key='.$this->api_key; + $url = $this->api_url.'/users/1?api_key='.$this->api_key; - print __METHOD__." Request url=".$url."\n"; + print __METHOD__." Request GET url=".$url."\n"; $result=getURLContent($url, 'GET', '', 1, array()); //print __METHOD__." Result for existing user user: ".var_export($result, true)."\n"; print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n"; @@ -174,7 +174,7 @@ class RestAPIUserTest extends PHPUnit_Framework_TestCase public function testRestCreateUser() { // attemp to create without mandatory fields : - $url = $this->api_url.'/user?api_key='.$this->api_key; + $url = $this->api_url.'/users?api_key='.$this->api_key; $addheaders=array('Content-Type: application/json'); $bodyobj = array( @@ -184,7 +184,7 @@ class RestAPIUserTest extends PHPUnit_Framework_TestCase ); $body = json_encode($bodyobj); - print __METHOD__." Request url=".$url."\n"; + print __METHOD__." Request POST url=".$url."\n"; $result=getURLContent($url, 'POST', $body, 1, $addheaders); //print __METHOD__." Result for creating incomplete user".var_export($result, true)."\n"; print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n"; @@ -202,7 +202,7 @@ class RestAPIUserTest extends PHPUnit_Framework_TestCase "email"=>"test@restuser.com" ); $body = json_encode($bodyobj); - print __METHOD__." Request url=".$url."\n"; + print __METHOD__." Request POST url=".$url."\n"; $result=getURLContent($url, 'POST', $body, 1, $addheaders); print __METHOD__." Result code for creating user ".var_export($result, true)."\n"; print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n"; @@ -212,7 +212,7 @@ class RestAPIUserTest extends PHPUnit_Framework_TestCase $this->assertGreaterThan(0, $object['id'], $object['error']['code'].' '.$object['error']['message']); // attempt to create duplicated user - print __METHOD__." Request url=".$url."\n"; + print __METHOD__." Request POST url=".$url."\n"; $result=getURLContent($url, 'POST', $body, 1, $addheaders); //print __METHOD__." Result for creating duplicate user".var_export($result, true)."\n"; print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n"; diff --git a/test/phpunit/WebservicesInvoicesTest.php b/test/phpunit/WebservicesInvoicesTest.php index ce3275bb58e..470bcbf4900 100644 --- a/test/phpunit/WebservicesInvoicesTest.php +++ b/test/phpunit/WebservicesInvoicesTest.php @@ -54,7 +54,8 @@ class WebservicesInvoicesTest extends PHPUnit_Framework_TestCase protected $savlangs; protected $savdb; protected $soapclient; - protected $socid; + + private static $socid; protected $ns = 'http://www.dolibarr.org/ns/'; @@ -72,10 +73,9 @@ class WebservicesInvoicesTest extends PHPUnit_Framework_TestCase $this->savuser=$user; $this->savlangs=$langs; $this->savdb=$db; - $WS_DOL_URL = DOL_MAIN_URL_ROOT.'/webservices/server_invoice.php'; - // Set the WebService URL + $WS_DOL_URL = DOL_MAIN_URL_ROOT.'/webservices/server_invoice.php'; print __METHOD__." create nusoap_client for URL=".$WS_DOL_URL."\n"; $this->soapclient = new nusoap_client($WS_DOL_URL); if ($this->soapclient) @@ -84,7 +84,28 @@ class WebservicesInvoicesTest extends PHPUnit_Framework_TestCase $this->soapclient->decodeUTF8(false); } - // create third_parties, needed to test an invoice + print __METHOD__." db->type=".$db->type." user->id=".$user->id; + //print " - db ".$db->db; + print "\n"; + } + + public static function setUpBeforeClass() + { + global $conf,$user,$langs,$db; + + // create a third_party, needed to create an invoice + // + // The third party is created in setUpBeforeClass() and not in the + // constructor to avoid creating several objects (the constructor is + // called for each test). + // + // The third party must be created before beginning the DB transaction + // because there is a foreign key constraint between invoices and third + // parties (tables: lx_facture and llx_societe) and with MySQL, + // constraints are checked immediately, they are not deferred to + // transaction commit. So if the invoice is created in the same + // transaction than the third party, the FK constraint fails. + // See this post for more detail: http://stackoverflow.com/a/5014744/5187108 $societe=new Societe($db); $societe->ref=''; $societe->name='name'; @@ -97,24 +118,15 @@ class WebservicesInvoicesTest extends PHPUnit_Framework_TestCase $societe->particulier=0; $societe->create($user); - - $this->socid = $societe->id; - + + self::$socid = $societe->id; print __METHOD__." societe created id=".$societe->id."\n"; - print __METHOD__." db->type=".$db->type." user->id=".$user->id; - //print " - db ".$db->db; - print "\n"; - } - - // Static methods - public static function setUpBeforeClass() - { - global $conf,$user,$langs,$db; $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. - print __METHOD__."\n"; + print __METHOD__."\n"; } + public static function tearDownAfterClass() { global $conf,$user,$langs,$db; @@ -135,9 +147,8 @@ class WebservicesInvoicesTest extends PHPUnit_Framework_TestCase $user=$this->savuser; $langs=$this->savlangs; $db=$this->savdb; - + print __METHOD__."\n"; - } /** @@ -166,17 +177,11 @@ class WebservicesInvoicesTest extends PHPUnit_Framework_TestCase $WS_METHOD = 'createInvoice'; - // load societe first - /*$societe=new Societe($db); - $societe->fetch('', '', 'ref-phpunit'); - print __METHOD__." societe loaded id=".$societe->id."\n"; - */ - $body = array ( "id" => NULL, "ref" => NULL, "ref_ext" => "ref-phpunit-2", - "thirdparty_id" => $this->socid, + "thirdparty_id" => self::$socid, "fk_user_author" => NULL, "fk_user_valid" => NULL, "date" => "2015-04-19 20:16:53", @@ -333,7 +338,7 @@ class WebservicesInvoicesTest extends PHPUnit_Framework_TestCase "id" => NULL, "ref" => NULL, "ref_ext" => "ref-phpunit-2", - "thirdparty_id" => $this->socid, + "thirdparty_id" => self::$socid, "fk_user_author" => NULL, "fk_user_valid" => NULL, "date" => "2015-04-19 20:16:53", diff --git a/test/phpunit/functional/InstallTest.php b/test/phpunit/functional/InstallTest.php new file mode 100644 index 00000000000..534d1d602c0 --- /dev/null +++ b/test/phpunit/functional/InstallTest.php @@ -0,0 +1,210 @@ + + * + * Install functional test using PHPUnit's Selenium + * + * 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 . + */ + +/** + * Class InstallTest + */ +class InstallTest extends PHPUnit_Extensions_Selenium2TestCase +{ + protected static $url = 'https://dev.dolibarr.org'; + protected static $db_name = 'dolibarr_test'; + protected static $db_host = 'localhost'; + protected static $db_admin_user = 'root'; + protected static $db_admin_pass = ''; + protected static $db_user = 'dolibarr'; + protected static $db_pass = 'dolibarr'; + protected static $dol_admin_user = 'admin'; + protected static $dol_admin_pass = 'admin'; + + public static $browsers = array( + array( + 'browser' => 'chrome', + 'browserName' => 'chrome', + 'sessionStrategy' => 'shared', + 'desiredCapabilities' => array() + ) + ); + + public static function setUpBeforeClass() + { + // Make sure we backup and remove the configuration file to force new install. + @rename('htdocs/conf/conf.php', sys_get_temp_dir() . '/conf.php'); + + // Start without a database + self::dropTestDatabase(); + + // Run the tests in the same window + self::shareSession(true); + } + + protected static function dropTestDatabase() + { + $mysqli = new mysqli(self::$db_host, self::$db_admin_user, self::$db_admin_pass); + $mysqli->query("DROP DATABASE " . self::$db_name); + } + + public static function tearDownAfterClass() + { + // Remove the generated configuration and restore the backed up file. + @unlink('htdocs/conf/conf.php'); + @rename(sys_get_temp_dir() . '/conf.php', 'htdocs/conf/conf.php'); + + // Cleanup test database + self::dropTestDatabase(); + } + + public function setUp() + { + // Populating the database can take quite long. + $this->setSeleniumServerRequestsTimeout(120000); + $this->setBrowserUrl(self::$url); + } + + public function testInstallRedirect() + { + $this->url('/'); + $this->assertContains('/install/index.php', $this->url()); + } + + public function testInstallPageTitle() + { + $this->assertContains('Dolibarr', $this->title()); + } + + public function testInstallProcess() + { + // FIXME: the button itself should have an ID + $this->byId('nextbutton')->byTag('input')->click(); + $this->assertContains('/install/check.php', $this->url()); + } + + public function testCheckPage() + { + $unavailable_choices = $this->byId('navail_choices'); + $show_hide_choices = $this->byId('AShowChoices')->byTag('a'); + $this->assertFalse($unavailable_choices->displayed()); + // FIXME: the link itself should have an ID + $show_hide_choices->click(); + $this->assertTrue($unavailable_choices->displayed()); + $show_hide_choices->click(); + $this->assertFalse($unavailable_choices->displayed()); + $this->byClassName('button')->click(); + $this->assertContains('/install/fileconf.php', $this->url()); + } + + public function testForm() + { + $this->assertFalse($this->byClassName('hideroot')->displayed()); + $this->assertTrue($this->byClassName('hidesqlite')->displayed()); + + // FIXME: This element should have an ID + $this->assertFalse($this->byName('main_force_https')->selected()); + $this->byName('main_force_https')->click(); + + $this->assertEquals('dolibarr', $this->byId('db_name')->value()); + $this->byId('db_name')->clear(); + $this->byId('db_name')->value(self::$db_name); + + $this->assertEquals('mysqli', $this->byId('db_type')->value()); + + // FIXME: This element should have an ID + $this->assertEquals('localhost', $this->byName('db_host')->value()); + + $this->assertEquals(3306, $this->byId('db_port')->value()); + + $this->assertEquals('llx_', $this->byId('db_prefix')->value()); + + $this->byId('db_create_database')->click(); + $this->assertTrue($this->byClassName('hideroot')->displayed()); + $this->byId('db_create_database')->click(); + $this->assertFalse($this->byClassName('hideroot')->displayed()); + + $this->byId('db_user')->value(self::$db_user); + + $this->byId('db_pass')->value(self::$db_pass); + + $this->byId('db_create_user')->click(); + $this->assertTrue($this->byClassName('hideroot')->displayed()); + $this->byId('db_create_user')->click(); + $this->assertFalse($this->byClassName('hideroot')->displayed()); + + $this->byId('db_create_database')->click(); + $this->byId('db_create_user')->click(); + $this->assertTrue($this->byClassName('hideroot')->displayed()); + + $this->byId('db_user_root')->value('root'); + $this->byId('db_pass_root')->value(''); + } + + public function testFormSubmit() + { + $this->byName('forminstall')->submit(); + $this->assertContains('/install/step1.php', $this->url()); + } + + public function testStep1() + { + $this->assertFalse($this->byId('pleasewait')->displayed()); + $start = new DateTimeImmutable(); + // FIXME: the button itself should have an ID + $this->byId('nextbutton')->byTag('input')->click(); + $time = $start->diff(new DateTimeImmutable()); + echo "\nPopulating the database took " . $time->format("%s seconds.\n"); + $this->assertContains('/install/step2.php', $this->url()); + } + + public function testStep2() + { + $this->byName('forminstall')->submit(); + $this->assertContains('/install/step4.php', $this->url()); + } + + // There is no step 3 + + public function testStep4() + { + // FIXME: should have an ID + $this->byName('login')->value(self::$dol_admin_user); + // FIXME: should have an ID + $this->byName('pass')->value('admin'); + // FIXME: should have an ID + $this->byName('pass_verif')->value(self::$dol_admin_pass); + // FIXME: the button itself should have an ID + $this->byId('nextbutton')->byTag('input')->click(); + $this->assertContains('/install/step5.php', $this->url()); + } + + public function testStep5() + { + // FIXME: this button should have an ID + $this->byTag('a')->click(); + $this->assertContains('/admin/index.php', $this->url()); + } + + public function testFirstLogin() + { + $this->assertEquals('login', $this->byTag('form')->attribute('id')); + $this->assertEquals(self::$dol_admin_user, $this->byId('username')->value()); + $this->byId('password')->value(self::$dol_admin_pass); + // FIXME: login button should have an ID + $this->byId('login')->submit(); + $this->assertEquals('mainbody', $this->byTag('body')->attribute('id')); + } +} diff --git a/test/phpunit/functional/README.md b/test/phpunit/functional/README.md new file mode 100644 index 00000000000..21380100605 --- /dev/null +++ b/test/phpunit/functional/README.md @@ -0,0 +1,77 @@ +Functional tests for Dolibarr +============================= +A.k.a. end-to-end or acceptance tests. + +Prerequisites +------------- + +### Web server + +Any web server compatible with Dolibarr will do. + +For the full test, it should be configured for serving Dolibarr's htdocs directory at `https://dev.dolibarr.org` with SSL/TLS enabled. + +If you want to test at another address and/or without SSL/TLS, you will have to alter the test configuration. + +### Database server + +#### MySQL or MariaDB. + +Running on localhost with the root user without password. + +The database used for the test is `dolibarr_test`. + +**WARNING:** +This database will be dropped before and after the test. +Make sure you don't hold any valuable information in it! + +A user called `dolibarr` with a password `dolibarr` will be created as part of the test. + +You can alter the test configuration to use another host, users and/or database. + +#### Other + +Unsupported at the moment. +Patches welcome. + +### Browser automation + +#### Server + +[Selenium](http://www.seleniumhq.org/) + +#### Driver + +##### Firefox + +Unsupported at the moment. + +I can't get the new [marionette](https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette/WebDriver) [webdriver](https://github.com/mozilla/geckodriver/releases) to work on my workstation. +Patches welcome. + +##### Chrome +[Google Chrome](https://www.google.com/chrome) +[ChromeDriver](https://sites.google.com/a/chromium.org/chromedriver) + +### Test runner +We leverage PHPUnit's selenium integration to run the tests. + +You can install it using composer. +``` +composer --dev require phpunit/phpunit-selenium +``` + +Configuration +------------- + +There is only one test at the moment. +Edit the test file — the configuration values are declared at the top of the class. + +Usage +----- + +Make sure your servers (web, database and browser automation) are started. + +Then from Dolibarr's root directory, run: + +```htdocs/includes/bin/phpunit test/phpunit/functional``` diff --git a/test/soapui/Dolibarr-soapui-project.xml b/test/soapui/Dolibarr-soapui-project.xml index c81b1ac8e1f..b5de27fbf31 100755 --- a/test/soapui/Dolibarr-soapui-project.xml +++ b/test/soapui/Dolibarr-soapui-project.xml @@ -225,7 +225,7 @@ -]]>http://schemas.xmlsoap.org/wsdl/http://localhostdolibarr/dolibarr_new/webservices/server_invoice.phphttp://localhost/dolibarrnew/webservices/server_invoice.php<xml-fragment/>UTF-8http://localhost/dolibarrnew/webservices/server_invoice.php +]]>http://schemas.xmlsoap.org/wsdl/http://localhostgit/dolibarr_dev/htdocs/webservices/server_invoice.phphttp://localhost/dolibarrnew/webservices/server_invoice.php<xml-fragment/>UTF-8http://localhost/dolibarrnew/webservices/server_invoice.php @@ -324,7 +324,7 @@ -]]>UTF-8http://localhostdolibarr/dolibarr_new/webservices/server_invoice.php +]]>UTF-8http://localhostgit/dolibarr_dev/htdocs/webservices/server_invoice.php @@ -383,7 +383,7 @@ -]]>UTF-8http://localhostdolibarr/dolibarr_new/webservices/server_invoice.php +]]>UTF-8http://localhostgit/dolibarr_dev/htdocs/webservices/server_invoice.php @@ -442,7 +442,7 @@ -]]><xml-fragment/>UTF-8http://localhostdolibarr/dolibarr_new/webservices/server_invoice.php +]]><xml-fragment/>UTF-8http://localhostgit/dolibarr_dev/htdocs/webservices/server_invoice.php @@ -532,7 +532,7 @@ -]]><xml-fragment/>UTF-8http://localhostdolibarr/dolibarr_new/webservices/server_invoice.php +]]><xml-fragment/>UTF-8http://localhostgit/dolibarr_dev/htdocs/webservices/server_invoice.php @@ -584,7 +584,7 @@ -]]>UTF-8http://localhostdolibarr/dolibarr_new/webservices/server_invoice.php +]]>UTF-8http://localhostgit/dolibarr_dev/htdocs/webservices/server_invoice.php @@ -616,7 +616,7 @@ 4 -]]>UTF-8http://localhostdolibarr/dolibarr_new/webservices/server_invoice.php +]]>UTF-8http://localhostgit/dolibarr_dev/htdocs/webservices/server_invoice.php