diff --git a/.gitignore b/.gitignore index d0f4a919cde..9b639ce64a6 100755 --- a/.gitignore +++ b/.gitignore @@ -17,7 +17,4 @@ doxygen_warnings.log *.iml Thumbs.db # Vagrant generated files -.vagrant -/index.html -/phpmyadmin -/xhprof +.vagrant \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index 9c7f18481f5..104bb1d00c2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -87,18 +87,22 @@ before_script: script: - cd htdocs/install + - date - php upgrade.php 3.4.0 3.5.0 > upgrade.log - php upgrade2.php 3.4.0 3.5.0 > upgrade2.log - php upgrade.php 3.5.0 3.6.0 >> upgrade.log - php upgrade2.php 3.5.0 3.6.0 >> upgrade2.log + - php upgrade.php 3.6.0 3.7.0 >> upgrade.log + - php upgrade2.php 3.6.0 3.7.0 >> upgrade2.log # - cat upgrade.log # - cat upgrade2.log - cd ../.. - date + - phpunit -d memory_limit=-1 --configuration test/phpunit/phpunittest.xml test/phpunit/AllTests.php + - date # - phpcs -p --warning-severity=0 -s --report-summary --standard=dev/codesniffer/ruleset.xml --tab-width=4 --ignore=/build/html/,/dev/vagrant/,/documents/,/includes/,/test/report/ htdocs/core/class/dolgraph.class.php 2>&1 - phpcs -p --warning-severity=0 -s --report-checkstyle --report-summary --standard=dev/codesniffer/ruleset.xml --tab-width=4 --ignore=/build/html/,/dev/vagrant/,/documents/,/includes/,/test/report/ . 2>&1 - date - - phpunit -d memory_limit=-1 --configuration test/phpunit/phpunittest.xml test/phpunit/AllTests.php after_script: # - echo Output dolibarr log file; cat $(pwd)/htdocs/documents/dolibarr.log diff --git a/ChangeLog b/ChangeLog index d6ba26267a6..c19e957e820 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,98 @@ English Dolibarr ChangeLog -------------------------------------------------------------- + +***** ChangeLog for 3.7 compared to 3.6.* ***** +For users: +- New: On contact list can set filter on both active and not active (no more exclusive select). +- New: Each user can include its own external ics calendar into dolibarr agenda view. +- New: Intervention documents are now available in ECM module. +- New: Can attach supplier order to a customer order. +- New: Supervisor is now visible into user list. +- New: Add user of creation and validation on invoice export. +- New: Add info page about browser. +- New: Enable feature developed for 3.6 we forgot to enabled: Adding prefix + on uploaded file names. +- New: No more dependency between contract and service module. +- New: [ task #867 ] Remove ESAEB external module code from core. +- New: Can create proposal from an intervention. +- New: Can filter events on a group of users. +- New: Can filter events of a thirdparty. +- New: Split Agenda view (month, week, day) into different tabs. +- New: Form to add a photo is immediatly available on photo page if + permissions are ok (save one click per photo to add). +- New: Add option PRODUCT_MAX_VISIBLE_PHOTO to limit number of photos + shown on main product card. +- New: Add event FICHINTER_CLASSIFY_BILLED into list of possible events to + create an automatic event into agenda. +- New: Add new type of event (when type of events are used, not by default) +- New: Add country into table of thirdparties type. This will allow to provide + a list of thirdparty types specific to a country (like argentina that + need type A or B). +- New: Can force a specific bank account onto an invoice/order. +- New: Home page of project area shows list of draft project (like other main page). +- New: Can search on project ref or string from project main page (like other main page). +- New: First change to match accessibility rules: http://www.w3.org/TR/WCAG10-HTML-TECHS/ + Differentiate text and img. + Use label into quick search form. + Use accesskey on form search. +- New: Intervention documents are now available in ECM module +- New: Add attachments on user card + in ECM module +- New: Can add __PROJECT_REF__ and __TIHRPARTY_NAME__ into email topic or content template. +- New: [ task #1204 ] add Numering contrat module free (like leopard in product module) +- New: [ task #712 ] Add warning when creating invoice from proposal or order, when there is already one invoice +- New: Enable supplier price log table +- New: [ task #1204 ] add a External reference to contract +- New: [ task #1218 ] Can drag and drop an event from calendar to change its day. +- Fix: [ bug #1487 ] PAYMENT_DELETE trigger does not intercept trigger action +- Fix: [ bug #1470, #1472, #1473] User trigger problem +- Fix: [ bug #1489, #1491 ] Intervention trigger problem +- Fix: [ bug #1492, #1493 ] Member trigger problem +- Fix: [ bug #1474, #1475 ] Contract trigger problem +- Fix: [ bug #1496 ] ACTION_DELETE trigger does not show trigger error +- Fix: [ bug #1494 ] CATEGORY_CREATE and CATEGORY_MODIFY triggers do not intercept trigger action +- Fix: [ bug #1502 ] DON_CREATE trigger does not intercept trigger action +- Fix: [ bug #1505, #1504] Project trigger problem +- Fix: [ bug #1463, #1464 ] Proposal triggers problem +- Fix: [ bug #1498, #1499 ] Shipment/Delivery triggers problem +- Fix: [ bug #1465, #1466 ] Product triggers problem +- Fix: [ bug #1508 ] STOCK_MOVEMENT does not show trigger error message +- Fix: [ bug #1501 ] DEPLACEMENT_CREATE trigger do not intercept trigger action +- Fix: [ bug #1506, #1507 ] ECM trigger error problem +- Fix: [ bug #1469 ] Triggers CONTACT_MODIFY and CONTACT_DELETE duplicates error message +- Fix: [ bug #1537 ] Difference between societe.nom and adherent.societe. + +For translators: +- Update language files. +- New: When a translation is not available we always jump to en_US and only en_US. + +For developers: +- New: Select list of users can return user into hierarchy. +- New: getBrowserInfo can return type of layout of browser (classic/phone/tablet) +- New: Add hook "searchAgendaFrom". +- New: Add trigger DON_UPDATE, DON_DELETE +- New: Add country iso code on 3 chars into table of countries. +- Qual: Removed hard coded rowid into data init of table llx_c_action_trigger. +- LINEBILL_DELETE, LINK_DELETE, ORDER_SUPPLIER_DELETE, RESOURCE_DELETE trigger called before SQL delete +- New: [ Task #1481 ] Add trigger BILL_SUPPLIER_UPDATE. +- New: [ Task #1495 ] Add trigger LINECONTRACT_CREATE. +- New: Added hook "formConfirm" and "doActions" for supplier invoice card +- New: [ task #1511, #1426 ] Added hook "doActions" for supplier card and supplier order card +- New: renamed table llx_c_pays to llx_c_country & libelle field to label +- Qual: Renamed table llx_c_civilite into llx_c_civility + field civilite into label in the same table + and field civilite into civility in other table + +WARNING: Following change may create regression for some external modules, but was necessary to make +Dolibarr better: + +- Changed the way parameters are provided to scripts sync_xxx_ldap2dolibarr.php +- Some field into database wwere renamed from "libelle" to "label". +- Table llx_c_pays were renamed into llx_c_country. +- Triggers *_BUILDDOC are removed. Building a doc is not a business event. For action after + creation of a pdf or odt, hook "afterPDFCreation" or "afterODTCreation" must be used instead. + + ***** ChangeLog for 3.6 compared to 3.5.* ***** For users: - New: Update ckeditor to version 4. @@ -66,6 +158,9 @@ For users: - Fix: Add actions events not implemented. - Fix: Price min of composition is not supplier price min by quantity. - Fix: [ bug #1356 ] Bank accountancy number is limited to 8 numbers. +- Fix: [ bug #1439 ] impossible to remove a a translation (multilanguage-feature) +- New: If multilangue is enabled, mail (from propal, invoice, etc...) message is pre-defaulted in Customer language +- Fix: [ bug #1459 ] _ADD_CONTACT and _DEL_CONTACT triggers do not intercept insertion when reported an error - Fix: [ bug #1478 ] BILL_PAYED trigger action does not intercept failure under some circumstances - Fix: [ bug #1479 ] Several customer invoice triggers do not intercept trigger action - Fix: [ bug #1477 ] Several customer invoice triggers do not show trigger error messages @@ -93,6 +188,8 @@ For developers: - New: A module can disable a standard ECM view. - New: Add multilang support into product webservice. - New: Add hooks on project card page. +- New: Add call_trigger method on CommonObject class. So new trigger call within object is just : +$result = $this->call_trigger($trigger_name, $user) WARNING: Following change may create regression for some external modules, but was necessary to make Dolibarr better: @@ -100,11 +197,11 @@ Dolibarr better: - The deprecated way (with 4 parameters) to declare a new tab into a module descriptor file has been removed. You must now use the 6 parameters way. See file modMyModule.class.php for example. - Remove the javascript function ac_delay() that is not used anymore by core code. -- Properties "dictionnaries" into module descriptor files has been renamed into "dictionaries". +- Properties "dictionnaries" into module descriptor files have been renamed into "dictionaries". - Method form->select_currency() has been removed. Use instead print form->selectCurrency(). - Method form->select_methodes_commande() has been renamed into english name selectInputMethod(). - The following hooks are now 'addreplace' hooks: "formCreateThirdpartyOptions" - So check that return value is 0 to keep default standard behaviour after hook or 1 to disable + So check that return value is 0 to keep default standard behaviour after hook, or 1 to disable default standard behaviour. - Properties "civilite_id" were renamed into "civility_id". - Remove add_photo_web() that is ot used anymore by core code. diff --git a/build/debian/README.howto b/build/debian/README.howto index 6b6e71c4874..d0bdd4574f4 100644 --- a/build/debian/README.howto +++ b/build/debian/README.howto @@ -153,6 +153,7 @@ from origin/upstream and origin/pristine. * Into root dir, launch: > 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. * Staying into git root directory, run > git-import-orig -vv ../tcpdf_x.y.z+dfsg.orig.tar.xz @@ -162,7 +163,7 @@ Note: If there was errors solved manually, you may need to make a git commit * Add an entry into debian/changelog > dch -v x.y.z-dsfg-1 "My comment" will add entry. For example: dch -v x.y.z-dsfg-1 "New upstream release." for a new version -Then modify changelog to replace "unstable" with "UNRELEASED". +Then modify changelog to replace "version" or "unstable" with "UNRELEASED". Warning: Date must have format reported by "date -R" Warning: Name and email must match value into debian/control file (Entry added here is used by next step). @@ -228,8 +229,13 @@ from origin/upstream and origin/pristine. * If new upstream is available onto sourceforge, launch: > 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 ckeditor and phpexcel and rename file into +* Edit tgz file to remove +- ckeditor +- phpexcel +- tcpdf +And rename file into dolibarr-x.y.z+dsfgw.tgz (x.y.z = version, w start from 1 and is increased for each new import) @@ -244,7 +250,7 @@ Note: If there was errors solved manually after get-orig-sources.sh, you may nee * Add an entry into debian/changelog > dch -v x.y.z-w "My comment" will add entry. For example: dch -v x.y.z-w "New upstream release." for a new version (x.y.z = version, w start from 1 and increaed for each new import) -Then modify changelog to replace "unstable" with "UNRELEASED". +Then modify changelog to replace "version" or "unstable" with "UNRELEASED". Then check/modify also the user/date signature: - Date must have format reported by "date -R" - Name and email must match value into debian/control file (Entry added here is used by next step). diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl index 77f19c1500a..b0ee55e399b 100755 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -960,8 +960,8 @@ if ($nboftargetok) { } } - # Build package for each target - #------------------------------ + # Publish package for each target + #-------------------------------- foreach my $target (keys %CHOOSEDPUBLISH) { if ($CHOOSEDPUBLISH{$target} < 0) { next; } @@ -1039,9 +1039,7 @@ if ($nboftargetok) { print "$command\n"; my $ret=`$command 2>&1`; print "$ret\n"; - } - } } } diff --git a/build/rpm/conf.php b/build/rpm/conf.php index 2e8bd46cf0f..406ba3145c1 100755 --- a/build/rpm/conf.php +++ b/build/rpm/conf.php @@ -5,4 +5,3 @@ // // This file will be filled by installer // -?> \ No newline at end of file diff --git a/dev/codesniffer/ruleset.xml b/dev/codesniffer/ruleset.xml index 38ea1310d22..6b498e7d167 100755 --- a/dev/codesniffer/ruleset.xml +++ b/dev/codesniffer/ruleset.xml @@ -11,10 +11,16 @@ + + + 0 + + + @@ -24,9 +30,6 @@ 0 - - - @@ -153,6 +156,10 @@ + + + + @@ -270,4 +277,10 @@ + + + + + + diff --git a/dev/dolibarr_changes.txt b/dev/dolibarr_changes.txt index 7f3490da165..f63969ea170 100644 --- a/dev/dolibarr_changes.txt +++ b/dev/dolibarr_changes.txt @@ -44,6 +44,8 @@ In htdocs/includes/tcpdf/tcpdf.php - protected $default_monospaced_font = 'courier'; + protected $default_monospaced_font = 'freemono'; +* Renamed getmypid into dol_getmypid(). + JSGANTT: -------- diff --git a/dev/initdata/generate-facture.php b/dev/initdata/generate-facture.php index 0316671d62b..5c630454ba7 100755 --- a/dev/initdata/generate-facture.php +++ b/dev/initdata/generate-facture.php @@ -94,7 +94,7 @@ while ($i < GEN_NUMBER_FACTURE && $result >= 0) print "Invoice ".$i." for socid ".$socid; - $facture = new Facture($db, $socids[$socid]); + $facture = new Facture($db); $facture->date = time(); $facture->cond_reglement_id = 3; $facture->mode_reglement_id = 3; diff --git a/dev/initdata/generate-propale.php b/dev/initdata/generate-propale.php index a62df516481..2efd2af2f08 100755 --- a/dev/initdata/generate-propale.php +++ b/dev/initdata/generate-propale.php @@ -122,7 +122,7 @@ while ($i < GEN_NUMBER_PROPAL && $result >= 0) $soc = new Societe($db); - $propal = new Propal($db, $socids[$socid]); + $propal = new Propal($db); $obj = $conf->global->PROPALE_ADDON; $modPropale = new $obj; @@ -130,6 +130,7 @@ while ($i < GEN_NUMBER_PROPAL && $result >= 0) $propal->ref = $numpr; $propal->contactid = $contids[$socids[$socid]][0]; + $propal->socid = $socids[$socid]; $propal->datep = time(); $propal->cond_reglement_id = 3; $propal->mode_reglement_id = 3; diff --git a/dev/skeletons/modMyModule.class.php b/dev/skeletons/modMyModule.class.php index bdeb61a7821..4c09e379d9b 100644 --- a/dev/skeletons/modMyModule.class.php +++ b/dev/skeletons/modMyModule.class.php @@ -173,7 +173,7 @@ class modMyModule extends DolibarrModules // Add here list of permission defined by an id, a label, a boolean and two constant strings. // Example: - // $this->rights[$r][0] = 2000; // Permission id (must not be already used) + // $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used) // $this->rights[$r][1] = 'Permision label'; // Permission label // $this->rights[$r][3] = 1; // Permission by default for new user (0/1) // $this->rights[$r][4] = 'level1'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) diff --git a/dev/skeletons/skeleton_class.class.php b/dev/skeletons/skeleton_class.class.php index c36dad4b4b5..781bbc1f77c 100644 --- a/dev/skeletons/skeleton_class.class.php +++ b/dev/skeletons/skeleton_class.class.php @@ -91,7 +91,7 @@ class Skeleton_Class extends CommonObject $this->db->begin(); - dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::create", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } @@ -105,10 +105,8 @@ class Skeleton_Class 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_CREATE',$this,$user,$langs,$conf); - //if ($result < 0) { $error++; $this->errors=$interface->errors; } + //$result=$this->call_trigger('MYOBJECT_CREATE',$user); + //if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail} //// End call triggers } } @@ -135,10 +133,11 @@ class Skeleton_Class extends CommonObject /** * Load object in memory from the database * - * @param int $id Id object + * @param int $id Id object + * @param string $ref Ref * @return int <0 if KO, >0 if OK */ - function fetch($id) + function fetch($id,$ref='') { global $langs; $sql = "SELECT"; @@ -147,9 +146,10 @@ class Skeleton_Class extends CommonObject $sql.= " t.field2"; //... $sql.= " FROM ".MAIN_DB_PREFIX."mytable as t"; - $sql.= " WHERE t.rowid = ".$id; + if ($ref) $sql.= " WHERE t.ref = '".$ref."'"; + else $sql.= " WHERE t.rowid = ".$id; - dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetch"); $resql=$this->db->query($sql); if ($resql) { @@ -169,7 +169,6 @@ class Skeleton_Class extends CommonObject else { $this->error="Error ".$this->db->lasterror(); - dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR); return -1; } } @@ -204,7 +203,7 @@ class Skeleton_Class extends CommonObject $this->db->begin(); - dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::update"); $resql = $this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } @@ -216,12 +215,10 @@ class Skeleton_Class 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; } + //$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 @@ -264,12 +261,10 @@ class Skeleton_Class extends CommonObject // Uncomment this and change MYOBJECT to your own tag if you // want this action calls a trigger. - //// Call triggers - //include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - //$interface=new Interfaces($this->db); - //$result=$interface->run_triggers('MYOBJECT_DELETE',$this,$user,$langs,$conf); - //if ($result < 0) { $error++; $this->errors=$interface->errors; } - //// End call triggers + //// 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 } } @@ -278,7 +273,7 @@ class Skeleton_Class extends CommonObject $sql = "DELETE FROM ".MAIN_DB_PREFIX."mytable"; $sql.= " WHERE rowid=".$this->id; - dol_syslog(get_class($this)."::delete sql=".$sql); + dol_syslog(get_class($this)."::delete"); $resql = $this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } } diff --git a/dev/skeletons/skeleton_page.php b/dev/skeletons/skeleton_page.php index bf63a769af7..67d6298863a 100644 --- a/dev/skeletons/skeleton_page.php +++ b/dev/skeletons/skeleton_page.php @@ -43,6 +43,7 @@ if (! $res && file_exists("../../../dolibarr/htdocs/main.inc.php")) $res=@includ if (! $res && file_exists("../../../../dolibarr/htdocs/main.inc.php")) $res=@include '../../../../dolibarr/htdocs/main.inc.php'; // Used on dev env only if (! $res) die("Include of main fails"); // Change this following line to use the correct relative path from htdocs +include_once(DOL_DOCUMENT_ROOT.'/core/class/formcompany.class.php'); dol_include_once('/module/class/skeleton_class.class.php'); // Load traductions files requiredby by page @@ -52,6 +53,7 @@ $langs->load("other"); // Get parameters $id = GETPOST('id','int'); $action = GETPOST('action','alpha'); +$backtopage = GETPOST('backtopage'); $myparam = GETPOST('myparam','alpha'); // Protection if external user @@ -60,6 +62,16 @@ if ($user->societe_id > 0) //accessforbidden(); } +if (empty($action) && empty($id) && empty($ref)) $action='create'; + +// 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); +} + /******************************************************************* @@ -68,19 +80,104 @@ if ($user->societe_id > 0) * Put here all code to do according to value of "action" parameter ********************************************************************/ +// Action to add record if ($action == 'add') { - $object=new Skeleton_Class($db); - $object->prop1=$_POST["field1"]; - $object->prop2=$_POST["field2"]; - $result=$object->create($user); + if (GETPOST('cancel')) + { + $urltogo=$backtopage?$backtopage:dol_buildpath('/buildingmanagement/list.php',1); + header("Location: ".$urltogo); + exit; + } + + $error=0; + + /* object_prop_getpost_prop */ + $object->prop1=GETPOST("field1"); + $object->prop2=GETPOST("field2"); + + if (empty($object->ref)) + { + $error++; + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Ref")),'errors'); + } + + if (! $error) + { + $result=$object->create($user); + if ($result > 0) + { + // Creation OK + $urltogo=$backtopage?$backtopage:dol_buildpath('/mymodule/list.php',1); + header("Location: ".$urltogo); + exit; + } + { + // Creation KO + if (! empty($object->errors)) setEventMessage($object->errors, 'errors'); + else setEventMessage($object->error, 'errors'); + $action='create'; + } + } + else + { + $action='create'; + } +} + +// Cancel +if ($action == 'update' && GETPOST('cancel')) $action='view'; + +// Action to update record +if ($action == 'update' && ! GETPOST('cancel')) +{ + $error=0; + + $object->prop1=GETPOST("field1"); + $object->prop2=GETPOST("field2"); + + if (empty($object->ref)) + { + $error++; + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Ref")),'errors'); + } + + if (! $error) + { + $result=$object->update($user); + if ($result > 0) + { + $action='view'; + } + else + { + // Creation KO + if (! empty($object->errors)) setEventMessage($object->errors, 'errors'); + else setEventMessage($object->error, 'errors'); + $action='edit'; + } + } + else + { + $action='edit'; + } +} + +// Action to delete +if ($action == 'confirm_delete') +{ + $result=$object->delete($user); if ($result > 0) { - // Creation OK + // Delete OK + setEventMessage($langs->trans("RecordDeleted")); + header("Location: ".dol_buildpath('/buildingmanagement/list.php',1)); + exit; } + else { - // Creation KO - $mesg=$object->error; + if (! empty($object->errors)) setEventMessage($object->errors,'errors'); + else setEventMessage($object->error,'errors'); } } @@ -101,7 +198,7 @@ $form=new Form($db); // Put here content of your page -// Example 1 : Adding jquery code +// Example : Adding jquery code print ''; -// Example 2 : Adding links to objects -// The class must extends CommonObject class to have this method available -//$somethingshown=$object->showLinkedObjectBlock(); - - -// Example 3 : List of data -if ($action == 'list') +// Part to show a list +if ($action == 'list' || empty($id)) { $sql = "SELECT"; $sql.= " t.rowid,"; @@ -139,27 +231,24 @@ if ($action == 'list') print_liste_field_titre($langs->trans('field2'),$_SERVER['PHP_SELF'],'t.field2','',$param,'',$sortfield,$sortorder); print ''; - dol_syslog($script_file." sql=".$sql, LOG_DEBUG); + dol_syslog($script_file, LOG_DEBUG); $resql=$db->query($sql); if ($resql) { $num = $db->num_rows($resql); $i = 0; - if ($num) + while ($i < $num) { - while ($i < $num) + $obj = $db->fetch_object($resql); + if ($obj) { - $obj = $db->fetch_object($resql); - if ($obj) - { - // You can use here results - print ''; - print $obj->field1; - print $obj->field2; - print ''; - } - $i++; + // You can use here results + print ''; + print $obj->field1; + print $obj->field2; + print ''; } + $i++; } } else @@ -173,6 +262,100 @@ if ($action == 'list') +// Part to create +if ($action == 'create') +{ + print_fiche_titre($langs->trans("NewResidence")); + + dol_fiche_head(); + + print '
'; + print ''; + print ''; + + print ''."\n"; + print ''; + + print '
'.$langs->trans("Label").''; + print ''; + print '
'."\n"; + + print '
'; + + print '
 
'; + + print '
'; + + dol_fiche_end(); +} + + + +// Part to edit record +if (($id || $ref) && $action == 'edit') +{ + dol_fiche_head(); + + print '
'; + print ''; + print ''; + print ''; + + + print '
'; + + print '
'; + + print '
'; + + dol_fiche_end(); +} + + + +// Part to show record +if ($id && (empty($action) || $action == 'view')) +{ + dol_fiche_head(); + + + + dol_fiche_end(); + + + // Buttons + print '
'."\n"; + $parameters=array(); + $reshook=$hookmanager->executeHooks('addMoreActionsButtons',$parameters,$object,$action); // Note that $action and $object may have been modified by hook + if (empty($reshook)) + { + if ($user->rights->mymodule->write) + { + print ''."\n"; + } + + if ($user->rights->mymodule->delete) + { + if ($conf->use_javascript_ajax && empty($conf->dol_use_jmobile)) // We can't use preloaded confirm form with jmobile + { + print '
'.$langs->trans('Delete').'
'."\n"; + } + else + { + print ''."\n"; + } + } + } + print '
'."\n"; + + + // Example 2 : Adding links to objects + // The class must extends CommonObject class to have this method available + //$somethingshown=$object->showLinkedObjectBlock(); + +} + + // End of page llxFooter(); $db->close(); diff --git a/dev/skeletons/skeleton_script.php b/dev/skeletons/skeleton_script.php index b10b57a730a..35904c9bfd3 100644 --- a/dev/skeletons/skeleton_script.php +++ b/dev/skeletons/skeleton_script.php @@ -57,7 +57,7 @@ if (! $result > 0) { dol_print_error('',$user->error); exit; } $user->getrights(); -print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n"; +print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." *****\n"; if (! isset($argv[1])) { // Check parameters print "Usage: ".$script_file." param1 param2 ...\n"; exit(-1); @@ -119,7 +119,7 @@ $sql.= " FROM ".MAIN_DB_PREFIX."skeleton"; $sql.= " WHERE field3 = 'xxx'"; $sql.= " ORDER BY field1 ASC"; -dol_syslog($script_file." sql=".$sql, LOG_DEBUG); +dol_syslog($script_file, LOG_DEBUG); $resql=$db->query($sql); if ($resql) { diff --git a/dev/vagrant/README.md b/dev/vagrant/README.md index 8056643520e..dc0bc4234e2 100644 --- a/dev/vagrant/README.md +++ b/dev/vagrant/README.md @@ -23,7 +23,7 @@ Usage `cd` into the vagrant box directory and simply type `vagrant up`. -That's all you need to do. It will build a brand new VirtalBox machine for you with everything you need to develop on Dolibarr. +That's all you need to do. It will build a brand new VirtualBox machine for you with everything you need to develop on Dolibarr. ### Name resolution For easy access to the VM you need to setup name resolution to the machines IP. @@ -45,9 +45,16 @@ Somewhat bleeding edge vagrant box for develop branch related work. - IP: 192.168.42.101 - Vhost: dev.dolibarr.org -- OS: Debian Wheezy 7.5 +- OS: Debian Wheezy 7.5 x64 - Webserver: Apache 2.2.22 -- PHP: mod_php 5.5.13-1~dotdeb.1 +- PHP: mod_php 5.5.14-1~dotdeb.1 + Installed modules: + - cli + - curl + - gd + - imagick + - intl + - mcrypt - Database: MySQL 5.5 - Root user: root - Root password: root @@ -55,7 +62,13 @@ Somewhat bleeding edge vagrant box for develop branch related work. - Database user: user - Database password: user - Initial data: dev/initdata/mysqldump_dolibarr-3.5.0.sql +- Database: PostgreSQL 9.3 +- Adminer: lightweight database management. Access through http://192.168.42.101/adminer - Debugger: XDebug -- Profiler: Xhprof +- Profiler: Xhprof. Access through http://192.168.42.101/xhprof/xhprof_html You can access MailCatcher to read all outgoing emails at http://192.168.42.101:1080 + +To access the machine you must use the following private keys: +- User root: located at puphpet/files/dot/ssh/root_rsa +- User vagrant: located at puphpet/files/dot/ssh/id_rsa diff --git a/dev/vagrant/dolibarrdev/Vagrantfile b/dev/vagrant/dolibarrdev/Vagrantfile index f73476207d0..a0bcc88ced6 100644 --- a/dev/vagrant/dolibarrdev/Vagrantfile +++ b/dev/vagrant/dolibarrdev/Vagrantfile @@ -23,13 +23,62 @@ Vagrant.configure("2") do |config| end end + if Vagrant.has_plugin?('vagrant-hostsupdater') + hosts = Array.new() + + if !configValues['apache']['install'].nil? && + configValues['apache']['install'].to_i == 1 && + configValues['apache']['vhosts'].is_a?(Hash) + configValues['apache']['vhosts'].each do |i, vhost| + hosts.push(vhost['servername']) + + if vhost['serveraliases'].is_a?(Array) + vhost['serveraliases'].each do |vhost_alias| + hosts.push(vhost_alias) + end + end + end + elsif !configValues['nginx']['install'].nil? && + configValues['nginx']['install'].to_i == 1 && + configValues['nginx']['vhosts'].is_a?(Hash) + configValues['nginx']['vhosts'].each do |i, vhost| + hosts.push(vhost['server_name']) + + if vhost['server_aliases'].is_a?(Array) + vhost['server_aliases'].each do |x, vhost_alias| + hosts.push(vhost_alias) + end + end + end + end + + if hosts.any? + contents = File.open("#{dir}/puphpet/shell/hostsupdater-notice.txt", 'r'){ |file| file.read } + puts "\n\033[34m#{contents}\033[0m\n" + + if config.vm.hostname.to_s.strip.length == 0 + config.vm.hostname = 'puphpet-dev-machine' + end + + config.hostsupdater.aliases = hosts + end + end + data['vm']['synced_folder'].each do |i, folder| if folder['source'] != '' && folder['target'] != '' - nfs = (folder['nfs'] == "true") ? "nfs" : nil - if nfs == "nfs" - config.vm.synced_folder "#{folder['source']}", "#{folder['target']}", id: "#{i}", type: nfs + if folder['sync_type'] == 'nfs' + config.vm.synced_folder "#{folder['source']}", "#{folder['target']}", id: "#{i}", type: "nfs" + elsif folder['sync_type'] == 'smb' + config.vm.synced_folder "#{folder['source']}", "#{folder['target']}", id: "#{i}", type: "smb" + elsif folder['sync_type'] == 'rsync' + rsync_args = !folder['rsync']['args'].nil? ? folder['rsync']['args'] : ["--verbose", "--archive", "--delete", "-z"] + rsync_auto = !folder['rsync']['auto'].nil? ? folder['rsync']['auto'] : true + rsync_exclude = !folder['rsync']['exclude'].nil? ? folder['rsync']['exclude'] : [".vagrant/"] + + config.vm.synced_folder "#{folder['source']}", "#{folder['target']}", id: "#{i}", + rsync__args: rsync_args, rsync__exclude: rsync_exclude, rsync__auto: rsync_auto, type: "rsync" else - config.vm.synced_folder "#{folder['source']}", "#{folder['target']}", id: "#{i}", type: nfs, + config.vm.synced_folder "#{folder['source']}", "#{folder['target']}", id: "#{i}", group: 'www-data', owner: 'www-data', mount_options: ["dmode=775", "fmode=764"] end end @@ -45,6 +94,9 @@ Vagrant.configure("2") do |config| if key == "memory" next end + if key == "cpus" + next + end if key == "natdnshostresolver1" value = value ? "on" : "off" @@ -54,6 +106,7 @@ Vagrant.configure("2") do |config| end virtualbox.customize ["modifyvm", :id, "--memory", "#{data['vm']['memory']}"] + virtualbox.customize ["modifyvm", :id, "--cpus", "#{data['vm']['cpus']}"] if data['vm']['hostname'].to_s.strip.length != 0 virtualbox.customize ["modifyvm", :id, "--name", config.vm.hostname] @@ -69,11 +122,15 @@ Vagrant.configure("2") do |config| if key == "memsize" next end + if key == "cpus" + next + end v.vmx["#{key}"] = "#{value}" end v.vmx["memsize"] = "#{data['vm']['memory']}" + v.vmx["numvcpus"] = "#{data['vm']['cpus']}" if data['vm']['hostname'].to_s.strip.length != 0 v.vmx["displayName"] = config.vm.hostname @@ -89,11 +146,15 @@ Vagrant.configure("2") do |config| if key == "memsize" next end + if key == "cpus" + next + end v.customize ["set", :id, "--#{key}", "#{value}"] end v.memory = "#{data['vm']['memory']}" + v.cpus = "#{data['vm']['cpus']}" if data['vm']['hostname'].to_s.strip.length != 0 v.name = config.vm.hostname @@ -111,7 +172,8 @@ Vagrant.configure("2") do |config| kg.path = "puphpet/shell/ssh-keygen.sh" kg.args = "#{ssh_username}" end - config.vm.provision :shell, :path => "puphpet/shell/update-puppet.sh" + config.vm.provision :shell, :path => "puphpet/shell/install-ruby.sh" + config.vm.provision :shell, :path => "puphpet/shell/install-puppet.sh" config.vm.provision :puppet do |puppet| puppet.facter = { @@ -128,7 +190,14 @@ Vagrant.configure("2") do |config| end end - config.vm.provision :shell, :path => "puphpet/shell/execute-files.sh" + config.vm.provision :shell do |s| + s.path = "puphpet/shell/execute-files.sh" + s.args = ["exec-once", "exec-always"] + end + config.vm.provision :shell, run: "always" do |s| + s.path = "puphpet/shell/execute-files.sh" + s.args = ["startup-once", "startup-always"] + end config.vm.provision :shell, :path => "puphpet/shell/important-notices.sh" if File.file?("#{dir}/puphpet/files/dot/ssh/id_rsa") @@ -168,3 +237,4 @@ Vagrant.configure("2") do |config| end + diff --git a/dev/vagrant/dolibarrdev/puphpet/.gitattributes b/dev/vagrant/dolibarrdev/puphpet/.gitattributes index 93f9975f88e..5bb817f8e45 100644 --- a/dev/vagrant/dolibarrdev/puphpet/.gitattributes +++ b/dev/vagrant/dolibarrdev/puphpet/.gitattributes @@ -2,9 +2,4 @@ * text=auto # Force the following filetypes to have unix eols, so Windows does not break them -*.pp text eol=lf -*.sh text eol=lf -*.yaml text eol=lf -Puppetfile text eol=lf -.bash_aliases text eol=lf -.vimrc text eol=lf +*.* text eol=lf diff --git a/dev/vagrant/dolibarrdev/puphpet/config.yaml b/dev/vagrant/dolibarrdev/puphpet/config.yaml index 5cfb2601f21..e88a3e13003 100644 --- a/dev/vagrant/dolibarrdev/puphpet/config.yaml +++ b/dev/vagrant/dolibarrdev/puphpet/config.yaml @@ -5,6 +5,7 @@ vagrantfile-local: box_url: puphpet/debian75-x64 hostname: null memory: '512' + cpus: '1' chosen_provider: virtualbox network: private_network: 192.168.42.101 @@ -29,10 +30,12 @@ vagrantfile-local: - '--hiera_config /vagrant/puphpet/puppet/hiera.yaml' - '--parser future' synced_folder: - PL1BkioqqvGY: + w6GqzzS2a7lu: source: ../../../ - target: /var/www - nfs: 'false' + target: /var/www/dolibarr + sync_type: default + rsync: + auto: 'false' usable_port_range: 2200..2250 ssh: host: null @@ -61,8 +64,7 @@ mailcatcher: smtp_port: 1025 http_ip: 0.0.0.0 http_port: '1080' - mailcatcher_path: /usr/local/bin - log_path: /var/log/mailcatcher/mailcatcher.log + mailcatcher_path: /usr/local/rvm/wrappers/default firewall: install: '1' rules: null @@ -71,7 +73,7 @@ apache: settings: user: www-data group: www-data - default_vhost: false + default_vhost: true manage_user: false manage_group: false sendfile: 0 @@ -79,9 +81,9 @@ apache: - php - rewrite vhosts: - CGyWQB0fx4x0: + syTi8VestVdG: servername: dev.dolibarr.org - docroot: /var/www/htdocs + docroot: /var/www/dolibarr/htdocs port: '80' setenv: - 'APP_ENV dev' @@ -96,8 +98,12 @@ apache: mod_spdy: 0 nginx: install: 0 + settings: + default_vhost: 1 + proxy_buffer_size: 128k + proxy_buffers: '4 256k' vhosts: - jeF1sybIJ3V2: + kZiLLcLAIVAF: server_name: awesome.dev server_aliases: - www.awesome.dev @@ -152,7 +158,7 @@ mysql: root_password: root adminer: 0 databases: - 2OfuuapoIqsl: + HHTBm64g1siG: grant: - ALTER - CREATE @@ -166,16 +172,16 @@ mysql: host: localhost user: user password: user - sql_file: /var/www/dev/initdata/mysqldump_dolibarr_3.5.0.sql + sql_file: /var/www/dolibarr/dev/initdata/mysqldump_dolibarr_3.5.0.sql postgresql: - install: 0 + install: '1' settings: - root_password: '123' + root_password: root user_group: postgres encoding: UTF8 version: '9.3' databases: { } - adminer: 0 + adminer: '1' mariadb: install: 0 root_password: '123' diff --git a/dev/vagrant/dolibarrdev/puphpet/files/dot/.gitignore b/dev/vagrant/dolibarrdev/puphpet/files/dot/.gitignore index dcf60545594..e9b023ea6a6 100644 --- a/dev/vagrant/dolibarrdev/puphpet/files/dot/.gitignore +++ b/dev/vagrant/dolibarrdev/puphpet/files/dot/.gitignore @@ -1,4 +1 @@ -ssh/id_rsa -ssh/id_rsa.pub -ssh/insecure_private_key -ssh/id_rsa.ppk \ No newline at end of file +ssh/* \ No newline at end of file diff --git a/dev/vagrant/dolibarrdev/puphpet/files/startup-always/empty b/dev/vagrant/dolibarrdev/puphpet/files/startup-always/empty new file mode 100644 index 00000000000..e69de29bb2d diff --git a/dev/vagrant/dolibarrdev/puphpet/files/startup-once/empty b/dev/vagrant/dolibarrdev/puphpet/files/startup-once/empty new file mode 100644 index 00000000000..e69de29bb2d diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/manifest.pp b/dev/vagrant/dolibarrdev/puphpet/puppet/manifest.pp index 57f759e5531..ea27564f8c9 100644 --- a/dev/vagrant/dolibarrdev/puphpet/puppet/manifest.pp +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/manifest.pp @@ -197,8 +197,8 @@ if is_array($server_values['packages']) and count($server_values['packages']) > } define add_dotdeb ($release){ - apt::source { $name: - location => 'http://packages.dotdeb.org', + apt::source { "${name}-repo.puphpet": + location => 'http://repo.puphpet.com/dotdeb/', release => $release, repos => 'all', required_packages => 'debian-keyring debian-archive-keyring', @@ -270,7 +270,7 @@ if hash_key_equals($mailcatcher_values, 'install', 1) { create_resources('class', { 'mailcatcher' => $mailcatcher_values['settings'] }) - if ! defined(Firewall["100 tcp/${mailcatcher_values['settings']['smtp_port']},${mailcatcher_values['settings']['http_port']}"]) { + if ! defined(Firewall["100 tcp/${mailcatcher_values['settings']['smtp_port']}, ${mailcatcher_values['settings']['http_port']}"]) { firewall { "100 tcp/${mailcatcher_values['settings']['smtp_port']}, ${mailcatcher_values['settings']['http_port']}": port => [$mailcatcher_values['settings']['smtp_port'], $mailcatcher_values['settings']['http_port']], proto => tcp, @@ -279,30 +279,39 @@ if hash_key_equals($mailcatcher_values, 'install', 1) { } if ! defined(Class['supervisord']) { + class{ 'puphpet::python::pip': } + class { 'supervisord': - install_pip => true, + install_pip => false, + require => [ + Class['my_fw::post'], + Class['Puphpet::Python::Pip'], + ], } } - $supervisord_mailcatcher_options = sort(join_keys_to_values({ + $mailcatcher_path = $mailcatcher_values['settings']['mailcatcher_path'] + + $mailcatcher_options = sort(join_keys_to_values({ ' --smtp-ip' => $mailcatcher_values['settings']['smtp_ip'], ' --smtp-port' => $mailcatcher_values['settings']['smtp_port'], ' --http-ip' => $mailcatcher_values['settings']['http_ip'], ' --http-port' => $mailcatcher_values['settings']['http_port'] }, ' ')) - $supervisord_mailcatcher_cmd = "mailcatcher ${supervisord_mailcatcher_options} -f >> ${mailcatcher_values['settings']['log']}" - supervisord::program { 'mailcatcher': - command => $supervisord_mailcatcher_cmd, + command => "${mailcatcher_path}/mailcatcher ${mailcatcher_options} -f", priority => '100', user => 'mailcatcher', autostart => true, autorestart => 'true', environment => { - 'PATH' => "/bin:/sbin:/usr/bin:/usr/sbin:${mailcatcher_values['settings']['path']}" + 'PATH' => "/bin:/sbin:/usr/bin:/usr/sbin:${mailcatcher_path}" }, - require => Package['mailcatcher'] + require => [ + Class['mailcatcher::config'], + File['/var/log/mailcatcher'] + ], } } @@ -312,10 +321,6 @@ if $firewall_values == undef { $firewall_values = hiera('firewall', false) } -resources { 'firewall': - purge => true -} - Firewall { before => Class['my_fw::post'], require => Class['my_fw::pre'], @@ -383,16 +388,15 @@ if hash_key_equals($apache_values, 'install', 1) { include puphpet::params include apache::params - $webroot_location = $puphpet::params::apache_webroot_location + $webroot_location = $puphpet::params::apache_webroot_location + $apache_provider_types = ['virtualbox', 'vmware_fusion', 'vmware_desktop', 'parallels'] exec { "exec mkdir -p ${webroot_location}": command => "mkdir -p ${webroot_location}", creates => $webroot_location, } - if (downcase($::provisioner_type) in ['virtualbox', 'vmware_fusion']) - and ! defined(File[$webroot_location]) - { + if (downcase($::provisioner_type) in $apache_provider_types) and ! defined(File[$webroot_location]) { file { $webroot_location: ensure => directory, mode => 0775, @@ -401,11 +405,7 @@ if hash_key_equals($apache_values, 'install', 1) { Group['www-data'] ] } - } - - if !(downcase($::provisioner_type) in ['virtualbox', 'vmware_fusion']) - and ! defined(File[$webroot_location]) - { + } elsif ! (downcase($::provisioner_type) in $apache_provider_types) and ! defined(File[$webroot_location]) { file { $webroot_location: ensure => directory, group => 'www-data', @@ -435,8 +435,8 @@ if hash_key_equals($apache_values, 'install', 1) { } if $::operatingsystem == 'ubuntu' - and hash_key_equals($php_values, 'install', 1) - and hash_key_equals($php_values, 'version', 55) + and hash_key_equals($php_values, 'install', 1) + and hash_key_equals($php_values, 'version', 55) { $apache_version = '2.4' } else { @@ -467,15 +467,16 @@ if hash_key_equals($apache_values, 'install', 1) { $apache_vhosts = merge($apache_values['vhosts'], { 'default_vhost_80' => { 'servername' => 'default', - 'serveraliases' => ['*'], 'docroot' => '/var/www/default', 'port' => 80, + 'default_vhost' => true, }, 'default_vhost_443' => { 'servername' => 'default', - 'serveraliases' => ['*'], 'docroot' => '/var/www/default', 'port' => 443, + 'default_vhost' => true, + 'ssl' => 1, }, }) } else { @@ -489,7 +490,7 @@ if hash_key_equals($apache_values, 'install', 1) { creates => $vhost['docroot'], } - if (downcase($::provisioner_type) in ['virtualbox', 'vmware_fusion']) + if (downcase($::provisioner_type) in $apache_provider_types) and ! defined(File[$vhost['docroot']]) { file { $vhost['docroot']: @@ -497,9 +498,7 @@ if hash_key_equals($apache_values, 'install', 1) { mode => 0765, require => Exec["exec mkdir -p ${vhost['docroot']} @ key ${key}"] } - } - - if !(downcase($::provisioner_type) in ['virtualbox', 'vmware_fusion']) + } elsif !(downcase($::provisioner_type) in $apache_provider_types) and ! defined(File[$vhost['docroot']]) { file { $vhost['docroot']: @@ -515,11 +514,11 @@ if hash_key_equals($apache_values, 'install', 1) { create_resources(apache::vhost, { "${key}" => merge($vhost, { 'custom_fragment' => template('puphpet/apache/custom_fragment.erb'), - 'ssl' => 'ssl' in $vhost and str2bool($vhost['ssl']) ? { true => true, default => false }, - 'ssl_cert' => 'ssl_cert' in $vhost and $vhost['ssl_cert'] ? { undef => undef, '' => undef, default => $vhost['ssl_cert'] }, - 'ssl_key' => 'ssl_key' in $vhost and $vhost['ssl_key'] ? { undef => undef, '' => undef, default => $vhost['ssl_key'] }, - 'ssl_chain' => 'ssl_chain' in $vhost and $vhost['ssl_chain'] ? { undef => undef, '' => undef, default => $vhost['ssl_chain'] }, - 'ssl_certs_dir' => 'ssl_certs_dir' in $vhost and $vhost['ssl_certs_dir'] ? { undef => undef, '' => undef, default => $vhost['ssl_certs_dir'] } + 'ssl' => 'ssl' in $vhost and str2bool($vhost['ssl']) ? { true => true, default => false }, + 'ssl_cert' => hash_key_true($vhost, 'ssl_cert') ? { true => $vhost['ssl_cert'], default => undef }, + 'ssl_key' => hash_key_true($vhost, 'ssl_key') ? { true => $vhost['ssl_key'], default => undef }, + 'ssl_chain' => hash_key_true($vhost, 'ssl_chain') ? { true => $vhost['ssl_chain'], default => undef }, + 'ssl_certs_dir' => hash_key_true($vhost, 'ssl_certs_dir') ? { true => $vhost['ssl_certs_dir'], default => undef } }) }) @@ -578,33 +577,25 @@ if hash_key_equals($nginx_values, 'install', 1) { } } - $webroot_location = $puphpet::params::nginx_webroot_location + $webroot_location = $puphpet::params::nginx_webroot_location + $nginx_provider_types = ['virtualbox', 'vmware_fusion', 'vmware_desktop', 'parallels'] exec { "exec mkdir -p ${webroot_location}": command => "mkdir -p ${webroot_location}", creates => $webroot_location, } - if (downcase($::provisioner_type) in ['virtualbox', 'vmware_fusion']) - and ! defined(File[$webroot_location]) - { + if (downcase($::provisioner_type) in $nginx_provider_types) and ! defined(File[$webroot_location]) { file { $webroot_location: ensure => directory, mode => 0775, - require => [ - Exec["exec mkdir -p ${webroot_location}"], - Group['www-data'] - ] + require => Exec["exec mkdir -p ${webroot_location}"], } - } - - if !(downcase($::provisioner_type) in ['virtualbox', 'vmware_fusion']) - and ! defined(File[$webroot_location]) - { + } elsif ! (downcase($::provisioner_type) in $nginx_provider_types) and ! defined(File[$webroot_location]) { file { $webroot_location: ensure => directory, - group => 'www-data', mode => 0775, + group => 'www-data', require => [ Exec["exec mkdir -p ${webroot_location}"], Group['www-data'] @@ -626,12 +617,10 @@ if hash_key_equals($nginx_values, 'install', 1) { if hash_key_equals($php_values, 'install', 1) { $php5_fpm_sock = '/var/run/php5-fpm.sock' - if $php_values['version'] == undef { - $fastcgi_pass = null - } elsif $php_values['version'] == '53' { - $fastcgi_pass = '127.0.0.1:9000' - } else { - $fastcgi_pass = "unix:${php5_fpm_sock}" + $fastcgi_pass = $php_values['version'] ? { + '53' => '127.0.0.1:9000', + undef => null, + default => "unix:${php5_fpm_sock}" } if $::osfamily == 'redhat' and $fastcgi_pass == "unix:${php5_fpm_sock}" { @@ -641,7 +630,7 @@ if hash_key_equals($nginx_values, 'install', 1) { require => Package['nginx'], } - exec { "listen = 127.0.0.1:9000 => listen = ${php5_fpm_sock}": + exec { "'listen = 127.0.0.1:9000' => 'listen = ${php5_fpm_sock}'": command => "perl -p -i -e 's#listen = 127.0.0.1:9000#listen = ${php5_fpm_sock}#gi' /etc/php-fpm.d/www.conf", unless => "grep -c 'listen = 127.0.0.1:9000' '${php5_fpm_sock}'", notify => [ @@ -651,29 +640,51 @@ if hash_key_equals($nginx_values, 'install', 1) { require => Exec["create ${php5_fpm_sock} file"] } - set_php5_fpm_sock_group_and_user { 'php_rhel': + set_nginx_php5_fpm_sock_group_and_user { 'php_rhel': require => Exec["create ${php5_fpm_sock} file"], } } else { - set_php5_fpm_sock_group_and_user { 'php': + set_nginx_php5_fpm_sock_group_and_user { 'php': require => Package['nginx'], subscribe => Service['php5-fpm'], } } } elsif hash_key_equals($hhvm_values, 'install', 1) { - $fastcgi_pass = '127.0.0.1:9000' - - set_php5_fpm_sock_group_and_user { 'hhvm': - require => Package['nginx'], - } + $fastcgi_pass = '127.0.0.1:9000' } else { - $fastcgi_pass = '' + $fastcgi_pass = null } class { 'nginx': } - if count($nginx_values['vhosts']) > 0 { - each( $nginx_values['vhosts'] ) |$key, $vhost| { + if hash_key_equals($nginx_values['settings'], 'default_vhost', 1) { + $nginx_vhosts = merge($nginx_values['vhosts'], { + 'default' => { + 'server_name' => '_', + 'server_aliases' => [], + 'www_root' => '/var/www/html', + 'listen_port' => 80, + 'index_files' => ['index', 'index.html', 'index.htm', 'index.php'], + 'envvars' => [], + 'ssl' => '0', + 'ssl_cert' => '', + 'ssl_key' => '', + }, + }) + + if ! defined(File[$puphpet::params::nginx_default_conf_location]) { + file { $puphpet::params::nginx_default_conf_location: + ensure => absent, + require => Package['nginx'], + notify => Class['nginx::service'], + } + } + } else { + $nginx_vhosts = $nginx_values['vhosts'] + } + + if count($nginx_vhosts) > 0 { + each( $nginx_vhosts ) |$key, $vhost| { exec { "exec mkdir -p ${vhost['www_root']} @ key ${key}": command => "mkdir -p ${vhost['www_root']}", creates => $vhost['www_root'], @@ -695,7 +706,7 @@ if hash_key_equals($nginx_values, 'install', 1) { } } - create_resources(nginx_vhost, $nginx_values['vhosts']) + create_resources(nginx_vhost, $nginx_vhosts) } if ! defined(Firewall['100 tcp/443']) { @@ -743,41 +754,12 @@ define nginx_vhost ( $fastcgi_param_parts = [] } - if $ssl == 0 or $ssl == false or $ssl == '' { - $ssl_set = false - } else { - $ssl_set = true - } - - if $ssl_cert == 0 or $ssl_cert == false or $ssl_cert == '' { - $ssl_cert_set = $puphpet::params::ssl_cert_location - } else { - $ssl_cert_set = $ssl_cert - } - - if $ssl_key == 0 or $ssl_key == false or $ssl_key == '' { - $ssl_key_set = $puphpet::params::ssl_key_location - } else { - $ssl_key_set = $ssl_key - } - - if $ssl_port == 0 or $ssl_port == false or $ssl_port == '' { - $ssl_port_set = '443' - } else { - $ssl_port_set = $ssl_port - } - - if $rewrite_to_https == 0 or $rewrite_to_https == false or $rewrite_to_https == '' { - $rewrite_to_https_set = false - } else { - $rewrite_to_https_set = true - } - - if $spdy == off or $spdy == 0 or $spdy == false or $spdy == '' { - $spdy_set = off - } else { - $spdy_set = on - } + $ssl_set = value_true($ssl) ? { true => true, default => false, } + $ssl_cert_set = value_true($ssl_cert) ? { true => $ssl_cert, default => $puphpet::params::ssl_cert_location, } + $ssl_key_set = value_true($ssl_key) ? { true => $ssl_key, default => $puphpet::params::ssl_key_location, } + $ssl_port_set = value_true($ssl_port) ? { true => $ssl_port, default => '443', } + $rewrite_to_https_set = value_true($rewrite_to_https) ? { true => true, default => false, } + $spdy_set = value_true($spdy) ? { true => on, default => off, } nginx::resource::vhost { $server_name: server_name => $merged_server_name, @@ -798,6 +780,19 @@ define nginx_vhost ( $fastcgi_param = concat($fastcgi_param_parts, $envvars) + $fastcgi_pass_hash = fastcgi_pass ? { + null => {}, + '' => {}, + default => {'fastcgi_pass' => $fastcgi_pass}, + } + + $location_cfg_append = merge({ + 'fastcgi_split_path_info' => '^(.+\.php)(/.+)$', + 'fastcgi_param' => $fastcgi_param, + 'fastcgi_index' => 'index.php', + 'include' => 'fastcgi_params' + }, $fastcgi_pass_hash) + nginx::resource::location { "${server_name}-php": ensure => present, vhost => $server_name, @@ -806,20 +801,17 @@ define nginx_vhost ( try_files => ['$uri', '$uri/', "/${try_files}?\$args"], ssl => $ssl_set, www_root => $www_root, - location_cfg_append => { - 'fastcgi_split_path_info' => '^(.+\.php)(/.+)$', - 'fastcgi_param' => $fastcgi_param, - 'fastcgi_pass' => $fastcgi_pass, - 'fastcgi_index' => 'index.php', - 'include' => 'fastcgi_params' - }, + location_cfg_append => $location_cfg_append, notify => Class['nginx::service'], } } -define set_php5_fpm_sock_group_and_user (){ +define set_nginx_php5_fpm_sock_group_and_user () { exec { 'set php5_fpm_sock group and user': - command => "chmod 660 ${php5_fpm_sock} && chown www-data ${php5_fpm_sock} && chgrp www-data ${php5_fpm_sock} && touch /.puphpet-stuff/php5_fpm_sock", + command => "chmod 660 ${php5_fpm_sock} && \ + chown www-data ${php5_fpm_sock} && \ + chgrp www-data ${php5_fpm_sock} && \ + touch /.puphpet-stuff/php5_fpm_sock", creates => '/.puphpet-stuff/php5_fpm_sock', } } @@ -998,7 +990,7 @@ if hash_key_equals($php_values, 'install', 1) { { puphpet::ini { 'sendmail_path': entry => 'CUSTOM/sendmail_path', - value => '/usr/bin/env catchmail', + value => "${mailcatcher_values['settings']['mailcatcher_path']}/catchmail -f", php_version => $php_values['version'], webserver => $php_webserver_service_ini } @@ -1096,7 +1088,7 @@ if hash_key_equals($xhprof_values, 'install', 1) } if hash_key_equals($apache_values, 'install', 1) { - $xhprof_webroot_location = $puphpet::params::apache_webroot_location + $xhprof_webroot_location = '/var/www/default' $xhprof_webserver_service = 'httpd' } elsif hash_key_equals($nginx_values, 'install', 1) { $xhprof_webroot_location = $puphpet::params::nginx_webroot_location @@ -1216,11 +1208,11 @@ if hash_key_equals($mysql_values, 'install', 1) { if hash_key_equals($mysql_values, 'adminer', 1) and $mysql_php_installed { if hash_key_equals($apache_values, 'install', 1) { - $mysql_adminer_webroot_location = $puphpet::params::apache_webroot_location + $mysql_adminer_webroot_location = '/var/www/default' } elsif hash_key_equals($nginx_values, 'install', 1) { $mysql_adminer_webroot_location = $puphpet::params::nginx_webroot_location } else { - $mysql_adminer_webroot_location = $puphpet::params::apache_webroot_location + $mysql_adminer_webroot_location = '/var/www/default' } class { 'puphpet::adminer': @@ -1329,11 +1321,11 @@ if hash_key_equals($postgresql_values, 'install', 1) { if hash_key_equals($postgresql_values, 'adminer', 1) and $postgresql_php_installed { if hash_key_equals($apache_values, 'install', 1) { - $postgresql_adminer_webroot_location = $puphpet::params::apache_webroot_location + $postgresql_adminer_webroot_location = '/var/www/default' } elsif hash_key_equals($nginx_values, 'install', 1) { $postgresql_adminer_webroot_location = $puphpet::params::nginx_webroot_location } else { - $postgresql_adminer_webroot_location = $puphpet::params::apache_webroot_location + $postgresql_adminer_webroot_location = '/var/www/default' } class { 'puphpet::adminer': @@ -1364,7 +1356,7 @@ define postgresql_db ( $table = "${name}.*" exec{ "${name}-import": - command => "psql ${name} < ${sql_file}", + command => "sudo -u postgres psql ${name} < ${sql_file}", logoutput => true, refreshonly => $refresh, require => Postgresql::Server::Db[$name], @@ -1491,11 +1483,11 @@ if hash_key_equals($mariadb_values, 'install', 1) { if hash_key_equals($mariadb_values, 'adminer', 1) and $mariadb_php_installed { if hash_key_equals($apache_values, 'install', 1) { - $mariadb_adminer_webroot_location = $puphpet::params::apache_webroot_location + $mariadb_adminer_webroot_location = '/var/www/default' } elsif hash_key_equals($nginx_values, 'install', 1) { $mariadb_adminer_webroot_location = $puphpet::params::nginx_webroot_location } else { - $mariadb_adminer_webroot_location = $puphpet::params::apache_webroot_location + $mariadb_adminer_webroot_location = '/var/www/default' } class { 'puphpet::adminer': @@ -1662,7 +1654,7 @@ if $beanstalkd_values == undef { } if hash_key_equals($apache_values, 'install', 1) { - $beanstalk_console_webroot_location = "${puphpet::params::apache_webroot_location}/beanstalk_console" + $beanstalk_console_webroot_location = '/var/www/default/beanstalk_console' } elsif hash_key_equals($nginx_values, 'install', 1) { $beanstalk_console_webroot_location = "${puphpet::params::nginx_webroot_location}/beanstalk_console" } else { @@ -1724,6 +1716,11 @@ if hash_key_equals($apache_values, 'install', 1) } if hash_key_equals($rabbitmq_values, 'install', 1) { + if $::osfamily == 'redhat' { + Class['erlang'] -> Class['rabbitmq'] + include 'erlang' + } + create_resources('class', { 'rabbitmq' => $rabbitmq_values['settings'] }) if hash_key_equals($php_values, 'install', 1) and ! defined(Php::Pecl::Module['amqp']) { diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/Gemfile b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/Gemfile new file mode 100644 index 00000000000..95c7a5dd0b0 --- /dev/null +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/Gemfile @@ -0,0 +1,15 @@ +source 'https://rubygems.org' + +group :development, :test do + gem 'rake', :require => false + gem 'rspec-puppet', :require => false + gem 'puppetlabs_spec_helper', :require => false + gem 'puppet-lint', :require => false + gem 'rspec-system-puppet', '~>2.0.0' +end + +if puppetversion = ENV['PUPPET_GEM_VERSION'] + gem 'puppet', puppetversion, :require => false +else + gem 'puppet', :require => false +end \ No newline at end of file diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/LICENSE b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/LICENSE new file mode 100644 index 00000000000..009b66b6cc2 --- /dev/null +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/LICENSE @@ -0,0 +1,13 @@ +Copyright 2012-2014 Michael Stahnke + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/Modulefile b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/Modulefile new file mode 100644 index 00000000000..237d164011a --- /dev/null +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/Modulefile @@ -0,0 +1,8 @@ +name 'stahnma-epel' +version '0.1.0' +source 'http://github.com/stahnma/puppet-module-epel' +author 'stahnma' +license 'Apache License, Version 2.0' +summary 'Setup the EPEL package repo' +description 'Setup the EPEL package repo on Centos/RHEL et all' +project_page 'http://github.com/stahnma/puppet-module-epel' diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/README.md b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/README.md new file mode 100644 index 00000000000..33b87278574 --- /dev/null +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/README.md @@ -0,0 +1,90 @@ +# Configure EPEL (Extra Repository for Enterprise Linux) + +# About +This module basically just mimics the epel-release rpm. The same repos are +enabled/disabled and the GPG key is imported. In the end you will end up with +the EPEL repos configured. + +The following Repos will be setup and enabled by default: + + * epel + +Other repositories that will setup but disabled (as per the epel-release setup) + + * epel-debuginfo + * epel-source + * epel-testing + * epel-testing-debuginfo + * epel-testing-source + +# Proxy +If you have an http proxy required to access the internet, you can use either +a class parameter in the _epel_ class, or edit the $proxy variable in the +params.pp file. By default no proxy is assumed. + +# Why? +I am a big fan of EPEL. I actually was one of the people who helped get it +going. I am also the owner of the epel-release package, so in general this +module should stay fairly up to date with the official upstream package. + +I just got sick of coding Puppet modules and basically having an assumption +that EPEL was setup or installed. I can now depend on this module instead. + +I realize it is fairly trivial to get EPEL setup. Every now-and-then however +the path to epel-release changes because something changes in the package (mass +rebuild, rpm build macros updates, etc). This module will bypass the changing +URL and just setup the package mirrors. + +This does mean that if you are looking for RPM macros that are normally +included with EPEL release, this will not have them. + +# Futher Information + +* [EPEL Wiki](http://fedoraproject.org/wiki/EPEL) +* [epel-release package information](http://mirrors.servercentral.net/fedora/epel/6/i386/repoview/epel-release.html) + +# Testing + +* This is commonly used on Puppet Enterprise 3.x +* This was tested using Puppet 3.3.0 on Centos5/6 +* This was tested using Puppet 3.1.1 on Amazon's AWS Linux +* I assume it will work on any RHEL variant (Amazon Linux is debatable as a variant) + +# Lifecycle +* No functionality has been introduced that should break Puppet 2.6 or 2.7, but I am no longer testing these versions of Puppet as they are end-of-lifed from Puppet Labs. + +## Unit tests + +Install the necessary gems + + bundle install + +Run the RSpec and puppet-lint tests + + bundle exec rake ci + +## System tests + +If you have Vagrant >=1.1.0 you can also run system tests: + + RSPEC_SET=centos-64-x64 bundle exec rake spec:system + +Available RSPEC_SET options are in .nodeset.yml + +# License +Apache Software License 2.0 + +# Author/Contributors + * Chad Metcalf + * Joseph Swick + * Matthaus Owens + * Michael Stahnke + * Michael Stahnke + * Pro Cabales + * Proletaryo Cabales + * Stefan Goethals + * Tim Rupp + * Trey Dockendorf + * Troy Bollinger + * Vlastimil Holer + * Ewoud Kohl van Wijngaarden diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/Rakefile b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/Rakefile new file mode 100644 index 00000000000..5a71d17767d --- /dev/null +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/Rakefile @@ -0,0 +1,17 @@ +require 'puppetlabs_spec_helper/rake_tasks' +require 'puppet-lint/tasks/puppet-lint' +require 'rspec-system/rake_task' + +task :default do + sh %{rake -T} +end + +# Disable specific puppet-lint checks +PuppetLint.configuration.send("disable_80chars") +PuppetLint.configuration.send("disable_class_inherits_from_params_class") + +desc "Run rspec-puppet and puppet-lint tasks" +task :ci => [ + :lint, + :spec, +] diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/files/RPM-GPG-KEY-EPEL-5 b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/files/RPM-GPG-KEY-EPEL-5 new file mode 100644 index 00000000000..5a13bb4f9f9 --- /dev/null +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/files/RPM-GPG-KEY-EPEL-5 @@ -0,0 +1,30 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- +Version: GnuPG v1.2.6 (GNU/Linux) + +mQGiBEXopTIRBACZDBMOoFOakAjaxw1LXjeSvh/kmE35fU1rXfM7T0AV31NATCLF +l5CQiNDA4oWreDThg2Bf6+LIVTsGQb1V+XXuLak4Em5yTYwMTVB//4/nMxQEbpl/ +QB2XwlJ7EQ0vW+kiPDz/7pHJz1p1jADzd9sQQicMtzysS4qT2i5A23j0VwCg1PB/ +lpYqo0ZhWTrevxKMa1n34FcD/REavj0hSLQFTaKNLHRotRTF8V0BajjSaTkUT4uk +/RTaZ8Kr1mTosVtosqmdIAA2XHxi8ZLiVPPSezJjfElsSqOAxEKPL0djfpp2wrTm +l/1iVnX+PZH5DRKCbjdCMLDJhYap7YUhcPsMGSeUKrwmBCBJUPc6DhjFvyhA9IMl +1T0+A/9SKTv94ToP/JYoCTHTgnG5MoVNafisfe0wojP2mWU4gRk8X4dNGKMj6lic +vM6gne3hESyjcqZSmr7yELPPGhI9MNauJ6Ob8cTR2T12Fmv9w03DD3MnBstR6vhP +QcqZKhc5SJYYY7oVfxlSOfF4xfwcHQKoD5TOKwIAQ6T8jyFpKbQkRmVkb3JhIEVQ +RUwgPGVwZWxAZmVkb3JhcHJvamVjdC5vcmc+iGQEExECACQFAkXopTICGwMFCRLM +AwAGCwkIBwMCAxUCAwMWAgECHgECF4AACgkQEZzANiF1IfabmQCgzvE60MnHSOBa +ZXXF7uU2Vzu8EOkAoKg9h+j0NuNom6WUYZyJQt4zc5seuQINBEXopTYQCADapnR/ +blrJ8FhlgNPl0X9S3JE/kygPbNXIqne4XBVYisVp0uzNCRUxNZq30MpY027JCs2J +nL2fMpwvx33f0phU029vrIZKA3CmnnwVsjcWfMJOVPBmVN7m5bGU68F+PdRIcDsl +PMOWRLkTBZOGolLgIbM4719fqA8etewILrX6uPvRDwywV7/sPCFpRcfNNBUY+Zx3 +5bf4fnkaCKxgXgQS3AT+hGYhlzIqQVTkGNveHTnt4SSzgAqR9sSwQwqvEfVtYNeS +w5rDguLG41HQm1Hojv59HNYjH6F/S1rClZi21bLgZbKpCFX76qPt8CTw+iQLBPPd +yoOGHfzyp7nsfhUrAAMFB/9/H9Gpk822ZpBexQW4y3LGFo9ZSnmu+ueOZPU3SqDA +DW1ovZdYzGuJTGGM9oMl6bL8eZrcUBBOFaWge5wZczIE3hx2exEOkDdvq+MUDVD1 +axmN45q/7h1NYRp5GQL2ZsoV4g9U2gMdzHOFtZCER6PP9ErVlfJpgBUCdSL93V4H +Sgpkk7znmTOklbCM6l/G/A6q4sCRqfzHwVSTiruyTBiU9lfROsAl8fjIq2OzWJ2T +P9sadBe1llUYaow7txYSUxssW+89avct35gIyrBbof5M+CBXyAOUaSWmpM2eub24 +0qbqiSr/Y6Om0t6vSzR8gRk7g+1H6IE0Tt1IJCvCAMimiE8EGBECAA8FAkXopTYC +GwwFCRLMAwAACgkQEZzANiF1IfZQYgCgiZHCv4xb+sTHCn/otc1Ovvi/OgMAnRXY +bbsLFWOfmzAnNIGvFRWy+YHi +=MMNL +-----END PGP PUBLIC KEY BLOCK----- diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/files/RPM-GPG-KEY-EPEL-6 b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/files/RPM-GPG-KEY-EPEL-6 new file mode 100644 index 00000000000..7a2030489d2 --- /dev/null +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/files/RPM-GPG-KEY-EPEL-6 @@ -0,0 +1,29 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- +Version: GnuPG v1.4.5 (GNU/Linux) + +mQINBEvSKUIBEADLGnUj24ZVKW7liFN/JA5CgtzlNnKs7sBg7fVbNWryiE3URbn1 +JXvrdwHtkKyY96/ifZ1Ld3lE2gOF61bGZ2CWwJNee76Sp9Z+isP8RQXbG5jwj/4B +M9HK7phktqFVJ8VbY2jfTjcfxRvGM8YBwXF8hx0CDZURAjvf1xRSQJ7iAo58qcHn +XtxOAvQmAbR9z6Q/h/D+Y/PhoIJp1OV4VNHCbCs9M7HUVBpgC53PDcTUQuwcgeY6 +pQgo9eT1eLNSZVrJ5Bctivl1UcD6P6CIGkkeT2gNhqindRPngUXGXW7Qzoefe+fV +QqJSm7Tq2q9oqVZ46J964waCRItRySpuW5dxZO34WM6wsw2BP2MlACbH4l3luqtp +Xo3Bvfnk+HAFH3HcMuwdaulxv7zYKXCfNoSfgrpEfo2Ex4Im/I3WdtwME/Gbnwdq +3VJzgAxLVFhczDHwNkjmIdPAlNJ9/ixRjip4dgZtW8VcBCrNoL+LhDrIfjvnLdRu +vBHy9P3sCF7FZycaHlMWP6RiLtHnEMGcbZ8QpQHi2dReU1wyr9QgguGU+jqSXYar +1yEcsdRGasppNIZ8+Qawbm/a4doT10TEtPArhSoHlwbvqTDYjtfV92lC/2iwgO6g +YgG9XrO4V8dV39Ffm7oLFfvTbg5mv4Q/E6AWo/gkjmtxkculbyAvjFtYAQARAQAB +tCFFUEVMICg2KSA8ZXBlbEBmZWRvcmFwcm9qZWN0Lm9yZz6JAjYEEwECACAFAkvS +KUICGw8GCwkIBwMCBBUCCAMEFgIDAQIeAQIXgAAKCRA7Sd8qBgi4lR/GD/wLGPv9 +qO39eyb9NlrwfKdUEo1tHxKdrhNz+XYrO4yVDTBZRPSuvL2yaoeSIhQOKhNPfEgT +9mdsbsgcfmoHxmGVcn+lbheWsSvcgrXuz0gLt8TGGKGGROAoLXpuUsb1HNtKEOwP +Q4z1uQ2nOz5hLRyDOV0I2LwYV8BjGIjBKUMFEUxFTsL7XOZkrAg/WbTH2PW3hrfS +WtcRA7EYonI3B80d39ffws7SmyKbS5PmZjqOPuTvV2F0tMhKIhncBwoojWZPExft +HpKhzKVh8fdDO/3P1y1Fk3Cin8UbCO9MWMFNR27fVzCANlEPljsHA+3Ez4F7uboF +p0OOEov4Yyi4BEbgqZnthTG4ub9nyiupIZ3ckPHr3nVcDUGcL6lQD/nkmNVIeLYP +x1uHPOSlWfuojAYgzRH6LL7Idg4FHHBA0to7FW8dQXFIOyNiJFAOT2j8P5+tVdq8 +wB0PDSH8yRpn4HdJ9RYquau4OkjluxOWf0uRaS//SUcCZh+1/KBEOmcvBHYRZA5J +l/nakCgxGb2paQOzqqpOcHKvlyLuzO5uybMXaipLExTGJXBlXrbbASfXa/yGYSAG +iVrGz9CE6676dMlm8F+s3XXE13QZrXmjloc6jwOljnfAkjTGXjiB7OULESed96MR +XtfLk0W5Ab9pd7tKDR6QHI7rgHXfCopRnZ2VVQ== +=V/6I +-----END PGP PUBLIC KEY BLOCK----- diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/files/RPM-GPG-KEY-EPEL-7 b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/files/RPM-GPG-KEY-EPEL-7 new file mode 100644 index 00000000000..f205ede4637 --- /dev/null +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/files/RPM-GPG-KEY-EPEL-7 @@ -0,0 +1,29 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- +Version: GnuPG v1.4.11 (GNU/Linux) + +mQINBFKuaIQBEAC1UphXwMqCAarPUH/ZsOFslabeTVO2pDk5YnO96f+rgZB7xArB +OSeQk7B90iqSJ85/c72OAn4OXYvT63gfCeXpJs5M7emXkPsNQWWSju99lW+AqSNm +jYWhmRlLRGl0OO7gIwj776dIXvcMNFlzSPj00N2xAqjMbjlnV2n2abAE5gq6VpqP +vFXVyfrVa/ualogDVmf6h2t4Rdpifq8qTHsHFU3xpCz+T6/dGWKGQ42ZQfTaLnDM +jToAsmY0AyevkIbX6iZVtzGvanYpPcWW4X0RDPcpqfFNZk643xI4lsZ+Y2Er9Yu5 +S/8x0ly+tmmIokaE0wwbdUu740YTZjCesroYWiRg5zuQ2xfKxJoV5E+Eh+tYwGDJ +n6HfWhRgnudRRwvuJ45ztYVtKulKw8QQpd2STWrcQQDJaRWmnMooX/PATTjCBExB +9dkz38Druvk7IkHMtsIqlkAOQMdsX1d3Tov6BE2XDjIG0zFxLduJGbVwc/6rIc95 +T055j36Ez0HrjxdpTGOOHxRqMK5m9flFbaxxtDnS7w77WqzW7HjFrD0VeTx2vnjj +GqchHEQpfDpFOzb8LTFhgYidyRNUflQY35WLOzLNV+pV3eQ3Jg11UFwelSNLqfQf +uFRGc+zcwkNjHh5yPvm9odR1BIfqJ6sKGPGbtPNXo7ERMRypWyRz0zi0twARAQAB +tChGZWRvcmEgRVBFTCAoNykgPGVwZWxAZmVkb3JhcHJvamVjdC5vcmc+iQI4BBMB +AgAiBQJSrmiEAhsPBgsJCAcDAgYVCAIJCgsEFgIDAQIeAQIXgAAKCRBqL66iNSxk +5cfGD/4spqpsTjtDM7qpytKLHKruZtvuWiqt5RfvT9ww9GUUFMZ4ZZGX4nUXg49q +ixDLayWR8ddG/s5kyOi3C0uX/6inzaYyRg+Bh70brqKUK14F1BrrPi29eaKfG+Gu +MFtXdBG2a7OtPmw3yuKmq9Epv6B0mP6E5KSdvSRSqJWtGcA6wRS/wDzXJENHp5re +9Ism3CYydpy0GLRA5wo4fPB5uLdUhLEUDvh2KK//fMjja3o0L+SNz8N0aDZyn5Ax +CU9RB3EHcTecFgoy5umRj99BZrebR1NO+4gBrivIfdvD4fJNfNBHXwhSH9ACGCNv +HnXVjHQF9iHWApKkRIeh8Fr2n5dtfJEF7SEX8GbX7FbsWo29kXMrVgNqHNyDnfAB +VoPubgQdtJZJkVZAkaHrMu8AytwT62Q4eNqmJI1aWbZQNI5jWYqc6RKuCK6/F99q +thFT9gJO17+yRuL6Uv2/vgzVR1RGdwVLKwlUjGPAjYflpCQwWMAASxiv9uPyYPHc +ErSrbRG0wjIfAR3vus1OSOx3xZHZpXFfmQTsDP7zVROLzV98R3JwFAxJ4/xqeON4 +vCPFU6OsT3lWQ8w7il5ohY95wmujfr6lk89kEzJdOTzcn7DBbUru33CQMGKZ3Evt +RjsC7FDbL017qxS+ZVA/HGkyfiu4cpgV8VUnbql5eAZ+1Ll6Dw== +=hdPa +-----END PGP PUBLIC KEY BLOCK----- diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/lib/facter/os_maj_version.rb b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/lib/facter/os_maj_version.rb new file mode 100644 index 00000000000..ba5cb84043e --- /dev/null +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/lib/facter/os_maj_version.rb @@ -0,0 +1,11 @@ +# This is a simple fact to get the Major version of an OS without having to +# have the entire LSB suite installed. LSB seems to pull in about 300 megs of +# stuff I often don't require. This fact is quick to load so it shouldn't be +# much of an issue. + +Facter.add(:os_maj_version) do + setcode do + v = Facter.value(:operatingsystemrelease) + v.split('.')[0].strip + end +end diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/manifests/init.pp b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/manifests/init.pp new file mode 100644 index 00000000000..f9f4be114a6 --- /dev/null +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/manifests/init.pp @@ -0,0 +1,135 @@ +# Class epel +# +# Actions: +# Configure the proper repositories and import GPG keys +# +# Reqiures: +# You should probably be on an Enterprise Linux variant. (Centos, RHEL, +# Scientific, Oracle, Ascendos, et al) +# +# Sample Usage: +# include epel +# +class epel ( + $epel_mirrorlist = $epel::params::epel_mirrorlist, + $epel_baseurl = $epel::params::epel_baseurl, + $epel_failovermethod = $epel::params::epel_failovermethod, + $epel_proxy = $epel::params::epel_proxy, + $epel_enabled = $epel::params::epel_enabled, + $epel_gpgcheck = $epel::params::epel_gpgcheck, + $epel_testing_baseurl = $epel::params::epel_testing_baseurl, + $epel_testing_failovermethod = $epel::params::epel_testing_failovermethod, + $epel_testing_proxy = $epel::params::epel_testing_proxy, + $epel_testing_enabled = $epel::params::epel_testing_enabled, + $epel_testing_gpgcheck = $epel::params::epel_testing_gpgcheck, + $epel_source_mirrorlist = $epel::params::epel_source_mirrorlist, + $epel_source_baseurl = $epel::params::epel_source_baseurl, + $epel_source_failovermethod = $epel::params::epel_source_failovermethod, + $epel_source_proxy = $epel::params::epel_source_proxy, + $epel_source_enabled = $epel::params::epel_source_enabled, + $epel_source_gpgcheck = $epel::params::epel_source_gpgcheck, + $epel_debuginfo_mirrorlist = $epel::params::epel_debuginfo_mirrorlist, + $epel_debuginfo_baseurl = $epel::params::epel_debuginfo_baseurl, + $epel_debuginfo_failovermethod = $epel::params::epel_debuginfo_failovermethod, + $epel_debuginfo_proxy = $epel::params::epel_debuginfo_proxy, + $epel_debuginfo_enabled = $epel::params::epel_debuginfo_enabled, + $epel_debuginfo_gpgcheck = $epel::params::epel_debuginfo_gpgcheck, + $epel_testing_source_baseurl = $epel::params::epel_testing_source_baseurl, + $epel_testing_source_failovermethod = $epel::params::epel_testing_source_failovermethod, + $epel_testing_source_proxy = $epel::params::epel_testing_source_proxy, + $epel_testing_source_enabled = $epel::params::epel_testing_source_enabled, + $epel_testing_source_gpgcheck = $epel::params::epel_testing_source_gpgcheck, + $epel_testing_debuginfo_baseurl = $epel::params::epel_testing_debuginfo_baseurl, + $epel_testing_debuginfo_failovermethod = $epel::params::epel_testing_debuginfo_failovermethod, + $epel_testing_debuginfo_proxy = $epel::params::epel_testing_debuginfo_proxy, + $epel_testing_debuginfo_enabled = $epel::params::epel_testing_debuginfo_enabled, + $epel_testing_debuginfo_gpgcheck = $epel::params::epel_testing_debuginfo_gpgcheck +) inherits epel::params { + + if $::osfamily == 'RedHat' and $::operatingsystem !~ /Fedora|Amazon/ { + yumrepo { 'epel-testing': + baseurl => $epel_testing_baseurl, + failovermethod => $epel_testing_failovermethod, + proxy => $epel_testing_proxy, + enabled => $epel_testing_enabled, + gpgcheck => $epel_testing_gpgcheck, + gpgkey => "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-${::os_maj_version}", + descr => "Extra Packages for Enterprise Linux ${::os_maj_version} - Testing - \$basearch ", + } + + yumrepo { 'epel-testing-debuginfo': + baseurl => $epel_testing_debuginfo_baseurl, + failovermethod => $epel_testing_debuginfo_failovermethod, + proxy => $epel_testing_debuginfo_proxy, + enabled => $epel_testing_debuginfo_enabled, + gpgcheck => $epel_testing_debuginfo_gpgcheck, + gpgkey => "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-${::os_maj_version}", + descr => "Extra Packages for Enterprise Linux ${::os_maj_version} - Testing - \$basearch - Debug", + } + + yumrepo { 'epel-testing-source': + baseurl => $epel_testing_source_baseurl, + failovermethod => $epel_testing_source_failovermethod, + proxy => $epel_testing_source_proxy, + enabled => $epel_testing_source_enabled, + gpgcheck => $epel_testing_source_gpgcheck, + gpgkey => "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-${::os_maj_version}", + descr => "Extra Packages for Enterprise Linux ${::os_maj_version} - Testing - \$basearch - Source", + } + + yumrepo { 'epel': + mirrorlist => $epel_mirrorlist, + baseurl => $epel_baseurl, + failovermethod => $epel_failovermethod, + proxy => $epel_proxy, + enabled => $epel_enabled, + gpgcheck => $epel_gpgcheck, + gpgkey => "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-${::os_maj_version}", + descr => "Extra Packages for Enterprise Linux ${::os_maj_version} - \$basearch", + } + + yumrepo { 'epel-debuginfo': + mirrorlist => $epel_debuginfo_mirrorlist, + baseurl => $epel_debuginfo_baseurl, + failovermethod => $epel_debuginfo_failovermethod, + proxy => $epel_debuginfo_proxy, + enabled => $epel_debuginfo_enabled, + gpgcheck => $epel_debuginfo_gpgcheck, + gpgkey => "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-${::os_maj_version}", + descr => "Extra Packages for Enterprise Linux ${::os_maj_version} - \$basearch - Debug", + } + + yumrepo { 'epel-source': + mirrorlist => $epel_source_mirrorlist, + baseurl => $epel_source_baseurl, + failovermethod => $epel_source_failovermethod, + proxy => $epel_source_proxy, + enabled => $epel_source_enabled, + gpgcheck => $epel_source_gpgcheck, + gpgkey => "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-${::os_maj_version}", + descr => "Extra Packages for Enterprise Linux ${::os_maj_version} - \$basearch - Source", + } + + file { "/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-${::os_maj_version}": + ensure => present, + owner => 'root', + group => 'root', + mode => '0644', + source => "puppet:///modules/epel/RPM-GPG-KEY-EPEL-${::os_maj_version}", + } + + epel::rpm_gpg_key{ "EPEL-${::os_maj_version}": + path => "/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-${::os_maj_version}", + before => Yumrepo['epel','epel-source','epel-debuginfo','epel-testing','epel-testing-source','epel-testing-debuginfo'], + } + + } elsif $::osfamily == 'RedHat' and $::operatingsystem == 'Amazon' { + yumrepo { 'epel': + enabled => $epel_enabled, + gpgcheck => $epel_gpgcheck, + } + } else { + notice ("Your operating system ${::operatingsystem} will not have the EPEL repository applied") + } + +} diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/manifests/params.pp b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/manifests/params.pp new file mode 100644 index 00000000000..0939de9045a --- /dev/null +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/manifests/params.pp @@ -0,0 +1,45 @@ +# Optional parameters in setting up EPEL +class epel::params { + # Setting to 'absent' will fall back to the yum.conf + # Setting proxy here will be the default for all repos. + # + # If you wish to set a proxy for an individual set of repos, + # you can declare $proxy in that class, and should scope to + # the most specific declaration of proxy. + $proxy = 'absent' + + $epel_mirrorlist = "http://mirrors.fedoraproject.org/mirrorlist?repo=epel-${::os_maj_version}&arch=\$basearch" + $epel_baseurl = 'absent' + $epel_failovermethod = 'priority' + $epel_proxy = $proxy + $epel_enabled = '1' + $epel_gpgcheck = '1' + $epel_testing_baseurl = "http://download.fedoraproject.org/pub/epel/testing/${::os_maj_version}/\$basearch" + $epel_testing_failovermethod = 'priority' + $epel_testing_proxy = $proxy + $epel_testing_enabled = '0' + $epel_testing_gpgcheck = '1' + $epel_source_mirrorlist = "http://mirrors.fedoraproject.org/mirrorlist?repo=epel-source-${::os_maj_version}&arch=\$basearch" + $epel_source_baseurl = 'absent' + $epel_source_failovermethod = 'priority' + $epel_source_proxy = $proxy + $epel_source_enabled = '0' + $epel_source_gpgcheck = '1' + $epel_debuginfo_mirrorlist = "http://mirrors.fedoraproject.org/mirrorlist?repo=epel-debug-${::os_maj_version}&arch=\$basearch" + $epel_debuginfo_baseurl = 'absent' + $epel_debuginfo_failovermethod = 'priority' + $epel_debuginfo_proxy = $proxy + $epel_debuginfo_enabled = '0' + $epel_debuginfo_gpgcheck = '1' + $epel_testing_source_baseurl = "http://download.fedoraproject.org/pub/epel/testing/${::os_maj_version}/SRPMS" + $epel_testing_source_failovermethod = 'priority' + $epel_testing_source_proxy = $proxy + $epel_testing_source_enabled = '0' + $epel_testing_source_gpgcheck = '1' + $epel_testing_debuginfo_baseurl = "http://download.fedoraproject.org/pub/epel/testing/${::os_maj_version}/\$basearch/debug" + $epel_testing_debuginfo_failovermethod = 'priority' + $epel_testing_debuginfo_proxy = $proxy + $epel_testing_debuginfo_enabled = '0' + $epel_testing_debuginfo_gpgcheck = '1' + +} diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/manifests/rpm_gpg_key.pp b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/manifests/rpm_gpg_key.pp new file mode 100644 index 00000000000..ee0604dbbf9 --- /dev/null +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/manifests/rpm_gpg_key.pp @@ -0,0 +1,28 @@ +# Define epel::rpm_gpg_key +# +# Actions: +# Import a RPM gpg key +# +# Parameters: +# +# [*path*] +# Path of the RPM GPG key to import +# +# Reqiures: +# You should probably be on an Enterprise Linux variant. (Centos, RHEL, Scientific, Oracle, Ascendos, et al) +# +# Sample Usage: +# epel::rpm_gpg_key{ "EPEL-6": +# path => "/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6" +# } +# +define epel::rpm_gpg_key($path) { + # Given the path to a key, see if it is imported, if not, import it + exec { "import-${name}": + path => '/bin:/usr/bin:/sbin:/usr/sbin', + command => "rpm --import ${path}", + unless => "rpm -q gpg-pubkey-$(echo $(gpg --throw-keyids < ${path}) | cut --characters=11-18 | tr '[A-Z]' '[a-z]')", + require => File[$path], + logoutput => 'on_failure', + } +} diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/metadata.json b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/metadata.json new file mode 100644 index 00000000000..ba8770e8b69 --- /dev/null +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/metadata.json @@ -0,0 +1,45 @@ +{ + "name": "stahnma-epel", + "version": "0.1.0", + "source": "http://github.com/stahnma/puppet-module-epel", + "author": "stahnma", + "license": "Apache License, Version 2.0", + "summary": "Setup the EPEL package repo", + "description": "Setup the EPEL package repo on Centos/RHEL et all", + "project_page": "http://github.com/stahnma/puppet-module-epel", + "dependencies": [ + + ], + "types": [ + + ], + "checksums": { + "Gemfile": "3189476f30a99858b367d955298fe469", + "LICENSE": "94f0b1430ad7e59227ccabf8232f81d5", + "Modulefile": "250a4370b189d3f2e68ffd359ee02bb5", + "README.md": "6b4c4d2e7f0f9c1b6197529fa1120c88", + "Rakefile": "946eced163d7f8e0da85bda4baa7fa9c", + "files/RPM-GPG-KEY-EPEL-5": "0466c259781def56dafe0a2cdc9de0c5", + "files/RPM-GPG-KEY-EPEL-6": "d865e6b948a74cb03bc3401c0b01b785", + "files/RPM-GPG-KEY-EPEL-7": "58fa8ae27c89f37b08429f04fd4a88cc", + "lib/facter/os_maj_version.rb": "806fb856251b605df379e973c716a41c", + "manifests/init.pp": "61856de8db1eb00700e0a9a93aea506f", + "manifests/params.pp": "4fb2e283b4ba6e41abd7a914bdd001b8", + "manifests/rpm_gpg_key.pp": "69086f12752a14b200e462afaa59a93c", + "spec/classes/epel_spec.rb": "7e8e5973fdccb866e91ed00a3fd0af4c", + "spec/classes/shared_base.rb": "a6a46eb7225a1814b9343f32190ba75b", + "spec/classes/shared_debuginfo.rb": "1bd23934bc1f7d14d2491c7741f10299", + "spec/classes/shared_gpgkey.rb": "38a62fe24acfc9cc8d740d242c9f1c85", + "spec/classes/shared_source.rb": "6581989ed1ca2edd589ed98ecb08bdfa", + "spec/classes/shared_testing.rb": "50e936b9cf241c9849cf551961492532", + "spec/classes/shared_testing_debuginfo.rb": "41e8a2215d347246ff241f1b3a819c91", + "spec/classes/shared_testing_source.rb": "8cd827b2cb0b08b1633d70784417f946", + "spec/defines/rpm_gpg_key_spec.rb": "489fa716eaa2aba013089a6cf552c5a6", + "spec/spec_helper.rb": "a5ad64bd67aa3fe2512fa7ba505c8e8b", + "spec/spec_helper_system.rb": "d24a7ffdf4b67dbbd3ef5687292f51cf", + "spec/system/basic_spec.rb": "bc475b95f390134b31d905590bf8b039", + "spec/system/usage_spec.rb": "04506df5627ecbe975acd1fd0407ae40", + "spec/unit/facter/os_maj_version_spec.rb": "67ab2730991d4a8430f1115aad46bcea", + "tests/init.pp": "7c69b7adf2ba141cb62cfc9e0704d59e" + } +} \ No newline at end of file diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/spec/classes/epel_spec.rb b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/spec/classes/epel_spec.rb new file mode 100644 index 00000000000..5d95a61a5f7 --- /dev/null +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/spec/classes/epel_spec.rb @@ -0,0 +1,80 @@ +require 'spec_helper' +require 'classes/shared_gpgkey' +require 'classes/shared_base' +require 'classes/shared_source' +require 'classes/shared_debuginfo' +require 'classes/shared_testing' +require 'classes/shared_testing_source' +require 'classes/shared_testing_debuginfo' + +describe 'epel' do + it { should create_class('epel') } + it { should contain_class('epel::params') } + + context "operatingsystem => #{default_facts[:operatingsystem]}" do + context 'os_maj_version => 6' do + include_context :base_6 + include_context :gpgkey_6 + include_context :epel_source_6 + include_context :epel_debuginfo_6 + include_context :epel_testing_6 + include_context :epel_testing_source_6 + include_context :epel_testing_debuginfo_6 + + let :facts do + default_facts.merge({ + :operatingsystemrelease => '6.4', + :os_maj_version => '6', + }) + end + + context 'epel_baseurl => http://example.com/epel/6/x86_64' do + let(:params) {{ :epel_baseurl => "http://example.com/epel/6/x86_64" }} + it { should contain_yumrepo('epel').with('baseurl' => 'http://example.com/epel/6/x86_64') } + end + + context 'epel_mirrorlist => absent' do + let(:params) {{ :epel_mirrorlist => 'absent' }} + it { should contain_yumrepo('epel').with('mirrorlist' => 'absent') } + end + end + + context 'os_maj_version => 5' do + include_context :base_5 + include_context :gpgkey_5 + include_context :epel_source_5 + include_context :epel_debuginfo_5 + include_context :epel_testing_5 + include_context :epel_testing_source_5 + include_context :epel_testing_debuginfo_5 + + let :facts do + default_facts.merge({ + :operatingsystemrelease => '5.9', + :os_maj_version => '5', + }) + end + end + end + + context 'operatingsystem => Amazon' do + let :facts do + default_facts.merge({ + :operatingsystem => 'Amazon', + }) + end + + it { should_not contain_yumrepo('epel-testing') } + it { should_not contain_yumrepo('epel-testing-debuginfo') } + it { should_not contain_yumrepo('epel-testing-source') } + it { should_not contain_yumrepo('epel-debuginfo') } + it { should_not contain_yumrepo('epel-source') } + + it do + should contain_yumrepo('epel').with({ + 'enabled' => '1', + 'gpgcheck' => '1', + }) + end + end +end \ No newline at end of file diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/spec/classes/shared_base.rb b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/spec/classes/shared_base.rb new file mode 100644 index 00000000000..89b3c58cca7 --- /dev/null +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/spec/classes/shared_base.rb @@ -0,0 +1,36 @@ +require 'spec_helper' + +shared_context :base do + it do + should contain_yumrepo('epel').with({ + 'failovermethod' => 'priority', + 'proxy' => 'absent', + 'enabled' => '1', + 'gpgcheck' => '1', + }) + end +end + +shared_context :base_6 do + include_context :base + + it do + should contain_yumrepo('epel').with({ + 'mirrorlist' => "http://mirrors.fedoraproject.org/mirrorlist?repo=epel-6&arch=$basearch", + 'gpgkey' => "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6", + 'descr' => "Extra Packages for Enterprise Linux 6 - $basearch", + }) + end +end + +shared_context :base_5 do + include_context :base + + it do + should contain_yumrepo('epel').with({ + 'mirrorlist' => "http://mirrors.fedoraproject.org/mirrorlist?repo=epel-5&arch=$basearch", + 'gpgkey' => "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-5", + 'descr' => "Extra Packages for Enterprise Linux 5 - $basearch", + }) + end +end diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/spec/classes/shared_debuginfo.rb b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/spec/classes/shared_debuginfo.rb new file mode 100644 index 00000000000..d47934d1425 --- /dev/null +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/spec/classes/shared_debuginfo.rb @@ -0,0 +1,36 @@ +require 'spec_helper' + +shared_context :epel_debuginfo do + it do + should contain_yumrepo('epel-debuginfo').with({ + 'proxy' => 'absent', + 'failovermethod' => 'priority', + 'enabled' => '0', + 'gpgcheck' => '1', + }) + end +end + +shared_context :epel_debuginfo_6 do + include_context :epel_debuginfo + + it do + should contain_yumrepo('epel-debuginfo').with({ + 'mirrorlist' => "http://mirrors.fedoraproject.org/mirrorlist?repo=epel-debug-6&arch=$basearch", + 'gpgkey' => "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6", + 'descr' => "Extra Packages for Enterprise Linux 6 - $basearch - Debug", + }) + end +end + +shared_context :epel_debuginfo_5 do + include_context :epel_debuginfo + + it do + should contain_yumrepo('epel-debuginfo').with({ + 'mirrorlist' => "http://mirrors.fedoraproject.org/mirrorlist?repo=epel-debug-5&arch=$basearch", + 'gpgkey' => "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-5", + 'descr' => "Extra Packages for Enterprise Linux 5 - $basearch - Debug", + }) + end +end diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/spec/classes/shared_gpgkey.rb b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/spec/classes/shared_gpgkey.rb new file mode 100644 index 00000000000..8b79c8cdd7f --- /dev/null +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/spec/classes/shared_gpgkey.rb @@ -0,0 +1,37 @@ +require 'spec_helper' + +shared_context :gpgkey_6 do + it do + should contain_file("/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6").with({ + 'ensure' => 'present', + 'owner' => 'root', + 'group' => 'root', + 'mode' => '0644', + 'source' => "puppet:///modules/epel/RPM-GPG-KEY-EPEL-6", + }) + end + + it do + should contain_epel__rpm_gpg_key("EPEL-6").with({ + 'path' => "/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6" + }) + end +end + +shared_context :gpgkey_5 do + it do + should contain_file("/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-5").with({ + 'ensure' => 'present', + 'owner' => 'root', + 'group' => 'root', + 'mode' => '0644', + 'source' => "puppet:///modules/epel/RPM-GPG-KEY-EPEL-5", + }) + end + + it do + should contain_epel__rpm_gpg_key("EPEL-5").with({ + 'path' => "/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-5" + }) + end +end diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/spec/classes/shared_source.rb b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/spec/classes/shared_source.rb new file mode 100644 index 00000000000..c371465ba91 --- /dev/null +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/spec/classes/shared_source.rb @@ -0,0 +1,36 @@ +require 'spec_helper' + +shared_context :epel_source do + it do + should contain_yumrepo('epel-source').with({ + 'proxy' => 'absent', + 'failovermethod' => 'priority', + 'enabled' => '0', + 'gpgcheck' => '1', + }) + end +end + +shared_context :epel_source_6 do + include_context :epel_source + + it do + should contain_yumrepo('epel-source').with({ + 'mirrorlist' => "http://mirrors.fedoraproject.org/mirrorlist?repo=epel-source-6&arch=$basearch", + 'gpgkey' => "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6", + 'descr' => "Extra Packages for Enterprise Linux 6 - $basearch - Source", + }) + end +end + +shared_context :epel_source_5 do + include_context :epel_source + + it do + should contain_yumrepo('epel-source').with({ + 'mirrorlist' => "http://mirrors.fedoraproject.org/mirrorlist?repo=epel-source-5&arch=$basearch", + 'gpgkey' => "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-5", + 'descr' => "Extra Packages for Enterprise Linux 5 - $basearch - Source", + }) + end +end diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/spec/classes/shared_testing.rb b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/spec/classes/shared_testing.rb new file mode 100644 index 00000000000..d560edb6e0a --- /dev/null +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/spec/classes/shared_testing.rb @@ -0,0 +1,36 @@ +require 'spec_helper' + +shared_context :epel_testing do + it do + should contain_yumrepo('epel-testing').with({ + 'failovermethod' => 'priority', + 'proxy' => 'absent', + 'enabled' => '0', + 'gpgcheck' => '1', + }) + end +end + +shared_context :epel_testing_6 do + include_context :epel_testing + + it do + should contain_yumrepo('epel-testing').with({ + 'baseurl' => "http://download.fedoraproject.org/pub/epel/testing/6/$basearch", + 'gpgkey' => "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6", + 'descr' => "Extra Packages for Enterprise Linux 6 - Testing - $basearch ", + }) + end +end + +shared_context :epel_testing_5 do + include_context :epel_testing + + it do + should contain_yumrepo('epel-testing').with({ + 'baseurl' => "http://download.fedoraproject.org/pub/epel/testing/5/$basearch", + 'gpgkey' => "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-5", + 'descr' => "Extra Packages for Enterprise Linux 5 - Testing - $basearch ", + }) + end +end diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/spec/classes/shared_testing_debuginfo.rb b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/spec/classes/shared_testing_debuginfo.rb new file mode 100644 index 00000000000..62f647d3790 --- /dev/null +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/spec/classes/shared_testing_debuginfo.rb @@ -0,0 +1,36 @@ +require 'spec_helper' + +shared_context :epel_testing_debuginfo do + it do + should contain_yumrepo('epel-testing-debuginfo').with({ + 'failovermethod' => 'priority', + 'proxy' => 'absent', + 'enabled' => '0', + 'gpgcheck' => '1', + }) + end +end + +shared_context :epel_testing_debuginfo_6 do + include_context :epel_testing_debuginfo + + it do + should contain_yumrepo('epel-testing-debuginfo').with({ + 'baseurl' => "http://download.fedoraproject.org/pub/epel/testing/6/$basearch/debug", + 'gpgkey' => "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6", + 'descr' => "Extra Packages for Enterprise Linux 6 - Testing - $basearch - Debug", + }) + end +end + +shared_context :epel_testing_debuginfo_5 do + include_context :epel_testing_debuginfo + + it do + should contain_yumrepo('epel-testing-debuginfo').with({ + 'baseurl' => "http://download.fedoraproject.org/pub/epel/testing/5/$basearch/debug", + 'gpgkey' => "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-5", + 'descr' => "Extra Packages for Enterprise Linux 5 - Testing - $basearch - Debug", + }) + end +end diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/spec/classes/shared_testing_source.rb b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/spec/classes/shared_testing_source.rb new file mode 100644 index 00000000000..1a7e0a6ae83 --- /dev/null +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/spec/classes/shared_testing_source.rb @@ -0,0 +1,36 @@ +require 'spec_helper' + +shared_context :epel_testing_source do + it do + should contain_yumrepo('epel-testing-source').with({ + 'failovermethod' => 'priority', + 'proxy' => 'absent', + 'enabled' => '0', + 'gpgcheck' => '1', + }) + end +end + +shared_context :epel_testing_source_6 do + include_context :epel_testing_source + + it do + should contain_yumrepo('epel-testing-source').with({ + 'baseurl' => "http://download.fedoraproject.org/pub/epel/testing/6/SRPMS", + 'gpgkey' => "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6", + 'descr' => "Extra Packages for Enterprise Linux 6 - Testing - $basearch - Source", + }) + end +end + +shared_context :epel_testing_source_5 do + include_context :epel_testing_source + + it do + should contain_yumrepo('epel-testing-source').with({ + 'baseurl' => "http://download.fedoraproject.org/pub/epel/testing/5/SRPMS", + 'gpgkey' => "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-5", + 'descr' => "Extra Packages for Enterprise Linux 5 - Testing - $basearch - Source", + }) + end +end diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/spec/defines/rpm_gpg_key_spec.rb b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/spec/defines/rpm_gpg_key_spec.rb new file mode 100644 index 00000000000..63cfe08ff94 --- /dev/null +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/spec/defines/rpm_gpg_key_spec.rb @@ -0,0 +1,57 @@ +require 'spec_helper' + +describe 'epel::rpm_gpg_key' do + context 'os_maj_version => 6' do + let :facts do + default_facts.merge({ + :operatingsystemrelease => '6.4', + :os_maj_version => '6', + }) + end + + let :title do + 'EPEL-6' + end + + let :params do + { :path => "/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6" } + end + + it do + should contain_exec("import-#{title}").with({ + 'path' => '/bin:/usr/bin:/sbin:/usr/sbin', + 'command' => "rpm --import #{params[:path]}", + 'unless' => "rpm -q gpg-pubkey-$(echo $(gpg --throw-keyids < #{params[:path]}) | cut --characters=11-18 | tr '[A-Z]' '[a-z]')", + 'require' => "File[#{params[:path]}]", + 'logoutput' => 'on_failure', + }) + end + end + + context 'os_maj_version => 5' do + let :facts do + default_facts.merge({ + :operatingsystemrelease => '5.9', + :os_maj_version => '5', + }) + end + + let :title do + 'EPEL-5' + end + + let :params do + { :path => "/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-5" } + end + + it do + should contain_exec("import-#{title}").with({ + 'path' => '/bin:/usr/bin:/sbin:/usr/sbin', + 'command' => "rpm --import #{params[:path]}", + 'unless' => "rpm -q gpg-pubkey-$(echo $(gpg --throw-keyids < #{params[:path]}) | cut --characters=11-18 | tr '[A-Z]' '[a-z]')", + 'require' => "File[#{params[:path]}]", + 'logoutput' => 'on_failure', + }) + end + end +end diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/spec/spec_helper.rb b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/spec/spec_helper.rb new file mode 100644 index 00000000000..eafe6b60012 --- /dev/null +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/spec/spec_helper.rb @@ -0,0 +1,8 @@ +require 'puppetlabs_spec_helper/module_spec_helper' + +def default_facts + { + :osfamily => 'RedHat', + :operatingsystem => 'CentOS', + } +end diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/spec/spec_helper_system.rb b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/spec/spec_helper_system.rb similarity index 69% rename from dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/spec/spec_helper_system.rb rename to dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/spec/spec_helper_system.rb index a790d7d526c..cf680367b94 100644 --- a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/spec/spec_helper_system.rb +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/spec/spec_helper_system.rb @@ -4,22 +4,20 @@ require 'rspec-system-puppet/helpers' include RSpecSystemPuppet::Helpers RSpec.configure do |c| - # Project root + # Project root for the this module's code proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..')) - # Enable colour + # Enable colour in Jenkins c.tty = true + c.include RSpecSystemPuppet::Helpers + # This is where we 'setup' the nodes before running our tests c.before :suite do # Install puppet puppet_install puppet_master_install - # Replace mymodule with your module name - puppet_module_install(:source => proj_root, :module_name => 'supervisord') - shell('puppet module install puppetlabs/stdlib') - shell('puppet module install puppetlabs/concat') - + puppet_module_install(:source => proj_root, :module_name => 'epel') end end diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/spec/system/basic_spec.rb b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/spec/system/basic_spec.rb new file mode 100644 index 00000000000..569e12d3737 --- /dev/null +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/spec/system/basic_spec.rb @@ -0,0 +1,36 @@ +require 'spec_helper_system' + +describe 'epel class:' do + context puppet_agent do + its(:stderr) { should be_empty } + its(:exit_code) { should_not == 1 } + end + + # Verify the os_maj_version fact is working + context shell 'facter --puppet os_maj_version' do + its(:stdout) { should_not be_empty } + its(:stderr) { should be_empty } + its(:exit_code) { should be_zero } + end + + pp = "class { 'epel': }" + + context puppet_apply pp do + its(:stderr) { should be_empty } + its(:exit_code) { should_not == 1 } + its(:refresh) { should be_nil } + its(:stderr) { should be_empty } + its(:exit_code) { should be_zero } + end + + context 'test EPEL repo presence' do + facts = node.facts + + # Only test for EPEL's presence if not Fedora + if facts['operatingsystem'] !~ /Fedora/ + context shell '/usr/bin/yum-config-manager epel | grep -q "\[epel\]"' do + its(:exit_code) { should be_zero } + end + end + end +end diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/spec/system/usage_spec.rb b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/spec/system/usage_spec.rb new file mode 100644 index 00000000000..2b0d8f36e28 --- /dev/null +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/spec/system/usage_spec.rb @@ -0,0 +1,60 @@ +require 'spec_helper_system' + +describe 'standage usage tests:' do + context 'test epel baseurl and mirrorlist' do + facts = node.facts + os_maj_version = facts['operatingsystemrelease'].split('.')[0] + pp = <<-EOS + class { 'epel': + epel_baseurl => 'http://dl.fedoraproject.org/pub/epel/#{os_maj_version}/x86_64/', + epel_mirrorlist => 'absent', + } + EOS + + context puppet_apply pp do + its(:stderr) { should be_empty } + its(:exit_code) { should_not == 1 } + its(:refresh) { should be_nil } + its(:stderr) { should be_empty } + its(:exit_code) { should be_zero } + end + + # Only test for EPEL's presence if not Fedora + if facts['operatingsystem'] !~ /Fedora/ + # Test the yum config to ensure mirrorlist was emptied + context shell '/usr/bin/yum-config-manager epel | egrep "^mirrorlist ="' do + its(:stdout) { should =~ /mirrorlist =\s+/ } + end + + # Test the yum config to ensure baseurl was defined + context shell '/usr/bin/yum-config-manager epel | egrep "^baseurl ="' do + its(:stdout) { should =~ /baseurl = http:\/\/dl.fedoraproject.org\/pub\/epel\/#{os_maj_version}\/x86_64\// } + end + end + end + + context 'test epel-testing is enabled' do + facts = node.facts + pp = <<-EOS + class { 'epel': + epel_testing_enabled => '1', + } + EOS + + context puppet_apply pp do + its(:stderr) { should be_empty } + its(:exit_code) { should_not == 1 } + its(:refresh) { should be_nil } + its(:stderr) { should be_empty } + its(:exit_code) { should be_zero } + end + + # Only test for EPEL's presence if not Fedora + if facts['operatingsystem'] !~ /Fedora/ + # Test the yum config to ensure epel-testing was enabled + context shell '/usr/bin/yum-config-manager epel-testing | grep -q "enabled = True"' do + its(:exit_code) { should be_zero } + end + end + end +end diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/spec/unit/facter/os_maj_version_spec.rb b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/spec/unit/facter/os_maj_version_spec.rb new file mode 100644 index 00000000000..83bcdffd2c9 --- /dev/null +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/spec/unit/facter/os_maj_version_spec.rb @@ -0,0 +1,21 @@ +require 'spec_helper' + +describe 'os_maj_version fact' do + before :each do + Facter.clear + end + + context "on 5.9 operatingsystemrelease" do + it "should have os_maj_version => 5" do + Facter.fact(:operatingsystemrelease).stubs(:value).returns("5.9") + Facter.fact(:os_maj_version).value.should == "5" + end + end + + context "on 6.4 operatingsystemrelease" do + it "should have os_maj_version => 6" do + Facter.fact(:operatingsystemrelease).stubs(:value).returns("6.4") + Facter.fact(:os_maj_version).value.should == "6" + end + end +end diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/tests/init.pp b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/tests/init.pp new file mode 100644 index 00000000000..c2e61d42989 --- /dev/null +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/epel/tests/init.pp @@ -0,0 +1,3 @@ +# And by test, I mean, run this thing for me using Puppet apply and I'll check +# it out. +include 'epel' diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/erlang/.fixtures.yml b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/erlang/.fixtures.yml new file mode 100644 index 00000000000..8968df1f459 --- /dev/null +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/erlang/.fixtures.yml @@ -0,0 +1,7 @@ +fixtures: + repositories: + apt: git://github.com/puppetlabs/puppetlabs-apt.git + stdlib: git://github.com/puppetlabs/puppetlabs-stdlib.git + epel: git://github.com/stahnma/puppet-module-epel.git + symlinks: + erlang: "#{source_dir}" diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/erlang/.nodeset.yml b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/erlang/.nodeset.yml new file mode 100644 index 00000000000..cbd0d57b83d --- /dev/null +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/erlang/.nodeset.yml @@ -0,0 +1,35 @@ +--- +default_set: 'centos-64-x64' +sets: + 'centos-59-x64': + nodes: + "main.foo.vm": + prefab: 'centos-59-x64' + 'centos-64-x64': + nodes: + "main.foo.vm": + prefab: 'centos-64-x64' + 'fedora-18-x64': + nodes: + "main.foo.vm": + prefab: 'fedora-18-x64' + 'debian-607-x64': + nodes: + "main.foo.vm": + prefab: 'debian-607-x64' + 'debian-70rc1-x64': + nodes: + "main.foo.vm": + prefab: 'debian-70rc1-x64' + 'ubuntu-server-10044-x64': + nodes: + "main.foo.vm": + prefab: 'ubuntu-server-10044-x64' + 'ubuntu-server-12042-x64': + nodes: + "main.foo.vm": + prefab: 'ubuntu-server-12042-x64' + 'sles-11sp1-x64': + nodes: + "main.foo.vm": + prefab: 'sles-11sp1-x64' diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/erlang/.rspec b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/erlang/.rspec new file mode 100644 index 00000000000..49d5710b3ef --- /dev/null +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/erlang/.rspec @@ -0,0 +1 @@ +--format documentation diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/erlang/.travis.yml b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/erlang/.travis.yml new file mode 100644 index 00000000000..cd412bfd344 --- /dev/null +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/erlang/.travis.yml @@ -0,0 +1,23 @@ +--- +language: ruby +bundler_args: --without development +before_install: rm Gemfile.lock || true +rvm: + - 1.8.7 + - 1.9.3 + - 2.0.0 +script: bundle exec rake test +env: + - PUPPET_VERSION="~> 2.7.0" + - PUPPET_VERSION="~> 3.1.0" + - PUPPET_VERSION="~> 3.2.0" + - PUPPET_VERSION="~> 3.3.0" + - PUPPET_VERSION="~> 3.4.0" +matrix: + exclude: + - rvm: 2.0.0 + env: PUPPET_VERSION="~> 2.7.0" + - rvm: 2.0.0 + env: PUPPET_VERSION="~> 3.1.0" + - rvm: 1.9.3 + env: PUPPET_VERSION="~> 2.7.0" diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/erlang/Gemfile b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/erlang/Gemfile new file mode 100644 index 00000000000..39ba7f9f63a --- /dev/null +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/erlang/Gemfile @@ -0,0 +1,15 @@ +source "http://rubygems.org" + + +gem "rake" +gem "puppet", ENV['PUPPET_VERSION'] || '~> 3.2.0' +gem "puppet-lint" +gem "rspec-puppet", '~> 1.0.0' +gem "puppetlabs_spec_helper" +gem "rspec-system-puppet" +gem "vagrant-wrapper" +gem "puppet-syntax" + +group :development do + gem "puppet-blacksmith" +end diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/erlang/Gemfile.lock b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/erlang/Gemfile.lock new file mode 100644 index 00000000000..d719aa97918 --- /dev/null +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/erlang/Gemfile.lock @@ -0,0 +1,94 @@ +GEM + remote: http://rubygems.org/ + specs: + builder (3.2.2) + diff-lcs (1.2.5) + excon (0.31.0) + facter (1.7.5) + fog (1.20.0) + builder + excon (~> 0.31.0) + formatador (~> 0.2.0) + mime-types + multi_json (~> 1.0) + net-scp (~> 1.1) + net-ssh (>= 2.1.3) + nokogiri (>= 1.5.11) + formatador (0.2.4) + hiera (1.3.2) + json_pure + json_pure (1.8.1) + kwalify (0.7.2) + metaclass (0.0.4) + mime-types (1.25.1) + mocha (1.0.0) + metaclass (~> 0.0.1) + multi_json (1.8.4) + net-scp (1.1.2) + net-ssh (>= 2.6.5) + net-ssh (2.8.0) + nokogiri (1.5.11) + puppet (3.2.4) + facter (~> 1.6) + hiera (~> 1.0) + rgen (~> 0.6.5) + puppet-blacksmith (2.0.2) + nokogiri + puppet (>= 2.7.16) + rest-client + puppet-lint (0.3.2) + puppet-syntax (1.1.0) + puppet (>= 2.7.0) + rake + puppetlabs_spec_helper (0.4.1) + mocha (>= 0.10.5) + rake + rspec (>= 2.9.0) + rspec-puppet (>= 0.1.1) + rake (10.1.1) + rbvmomi (1.8.1) + builder + nokogiri (>= 1.4.1) + trollop + rest-client (1.6.7) + mime-types (>= 1.16) + rgen (0.6.6) + rspec (2.14.1) + rspec-core (~> 2.14.0) + rspec-expectations (~> 2.14.0) + rspec-mocks (~> 2.14.0) + rspec-core (2.14.8) + rspec-expectations (2.14.5) + diff-lcs (>= 1.1.3, < 2.0) + rspec-mocks (2.14.6) + rspec-puppet (1.0.1) + rspec + rspec-system (2.8.0) + fog (~> 1.18) + kwalify (~> 0.7.2) + mime-types (~> 1.16) + net-scp (~> 1.1) + net-ssh (~> 2.7) + nokogiri (~> 1.5.10) + rbvmomi (~> 1.6) + rspec (~> 2.14) + systemu (~> 2.5) + rspec-system-puppet (2.2.1) + rspec-system (~> 2.0) + systemu (2.6.3) + trollop (2.0) + vagrant-wrapper (1.2.1.1) + +PLATFORMS + ruby + +DEPENDENCIES + puppet (~> 3.2.0) + puppet-blacksmith + puppet-lint + puppet-syntax + puppetlabs_spec_helper + rake + rspec-puppet (~> 1.0.0) + rspec-system-puppet + vagrant-wrapper diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/erlang/LICENSE b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/erlang/LICENSE new file mode 100644 index 00000000000..bf023233a1f --- /dev/null +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/erlang/LICENSE @@ -0,0 +1,207 @@ +Apache License +Version 2.0, January 2004 +http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, and + distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by the + copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all other + entities that control, are controlled by, or are under common control with + that entity. For the purposes of this definition, "control" means (i) the + power, direct or indirect, to cause the direction or management of such + entity, whether by contract or otherwise, or (ii) ownership of + fifty percent (50%) or more of the outstanding shares, or (iii) beneficial + ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity exercising + permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation source, + and configuration files. + + "Object" form shall mean any form resulting from mechanical transformation + or translation of a Source form, including but not limited to compiled + object code, generated documentation, and conversions to + other media types. + + "Work" shall mean the work of authorship, whether in Source or Object + form, made available under the License, as indicated by a copyright notice + that is included in or attached to the work (an example is provided in the + Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object form, + that is based on (or derived from) the Work and for which the editorial + revisions, annotations, elaborations, or other modifications represent, + as a whole, an original work of authorship. For the purposes of this + License, Derivative Works shall not include works that remain separable + from, or merely link (or bind by name) to the interfaces of, the Work and + Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including the original + version of the Work and any modifications or additions to that Work or + Derivative Works thereof, that is intentionally submitted to Licensor for + inclusion in the Work by the copyright owner or by an individual or + Legal Entity authorized to submit on behalf of the copyright owner. + For the purposes of this definition, "submitted" means any form of + electronic, verbal, or written communication sent to the Licensor or its + representatives, including but not limited to communication on electronic + mailing lists, source code control systems, and issue tracking systems + that are managed by, or on behalf of, the Licensor for the purpose of + discussing and improving the Work, but excluding communication that is + conspicuously marked or otherwise designated in writing by the copyright + owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity on + behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. + + Subject to the terms and conditions of this License, each Contributor + hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, + royalty-free, irrevocable copyright license to reproduce, prepare + Derivative Works of, publicly display, publicly perform, sublicense, + and distribute the Work and such Derivative Works in + Source or Object form. + +3. Grant of Patent License. + + Subject to the terms and conditions of this License, each Contributor + hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, + royalty-free, irrevocable (except as stated in this section) patent + license to make, have made, use, offer to sell, sell, import, and + otherwise transfer the Work, where such license applies only to those + patent claims licensable by such Contributor that are necessarily + infringed by their Contribution(s) alone or by combination of their + Contribution(s) with the Work to which such Contribution(s) was submitted. + If You institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work or a + Contribution incorporated within the Work constitutes direct or + contributory patent infringement, then any patent licenses granted to + You under this License for that Work shall terminate as of the date such + litigation is filed. + +4. Redistribution. + + You may reproduce and distribute copies of the Work or Derivative Works + thereof in any medium, with or without modifications, and in Source or + Object form, provided that You meet the following conditions: + + 1. You must give any other recipients of the Work or Derivative Works a + copy of this License; and + + 2. You must cause any modified files to carry prominent notices stating + that You changed the files; and + + 3. You must retain, in the Source form of any Derivative Works that You + distribute, all copyright, patent, trademark, and attribution notices from + the Source form of the Work, excluding those notices that do not pertain + to any part of the Derivative Works; and + + 4. If the Work includes a "NOTICE" text file as part of its distribution, + then any Derivative Works that You distribute must include a readable copy + of the attribution notices contained within such NOTICE file, excluding + those notices that do not pertain to any part of the Derivative Works, + in at least one of the following places: within a NOTICE text file + distributed as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, within a + display generated by the Derivative Works, if and wherever such + third-party notices normally appear. The contents of the NOTICE file are + for informational purposes only and do not modify the License. + You may add Your own attribution notices within Derivative Works that You + distribute, alongside or as an addendum to the NOTICE text from the Work, + provided that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and may + provide additional or different license terms and conditions for use, + reproduction, or distribution of Your modifications, or for any such + Derivative Works as a whole, provided Your use, reproduction, and + distribution of the Work otherwise complies with the conditions + stated in this License. + +5. Submission of Contributions. + + Unless You explicitly state otherwise, any Contribution intentionally + submitted for inclusion in the Work by You to the Licensor shall be under + the terms and conditions of this License, without any additional + terms or conditions. Notwithstanding the above, nothing herein shall + supersede or modify the terms of any separate license agreement you may + have executed with Licensor regarding such Contributions. + +6. Trademarks. + + This License does not grant permission to use the trade names, trademarks, + service marks, or product names of the Licensor, except as required for + reasonable and customary use in describing the origin of the Work and + reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. + + Unless required by applicable law or agreed to in writing, Licensor + provides the Work (and each Contributor provides its Contributions) + on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + either express or implied, including, without limitation, any warranties + or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS + FOR A PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any risks + associated with Your exercise of permissions under this License. + +8. Limitation of Liability. + + In no event and under no legal theory, whether in tort + (including negligence), contract, or otherwise, unless required by + applicable law (such as deliberate and grossly negligent acts) or agreed + to in writing, shall any Contributor be liable to You for damages, + including any direct, indirect, special, incidental, or consequential + damages of any character arising as a result of this License or out of + the use or inability to use the Work (including but not limited to damages + for loss of goodwill, work stoppage, computer failure or malfunction, + or any and all other commercial damages or losses), even if such + Contributor has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. + + While redistributing the Work or Derivative Works thereof, You may choose + to offer, and charge a fee for, acceptance of support, warranty, + indemnity, or other liability obligations and/or rights consistent with + this License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf of any + other Contributor, and only if You agree to indemnify, defend, and hold + each Contributor harmless for any liability incurred by, or claims + asserted against, such Contributor by reason of your accepting any such + warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work + + To apply the Apache License to your work, attach the following boilerplate + notice, with the fields enclosed by brackets "[]" replaced with your own + identifying information. (Don't include the brackets!) The text should be + enclosed in the appropriate comment syntax for the file format. We also + recommend that a file or class name and description of purpose be included + on the same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2013 Gareth Rushgrove + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + or implied. See the License for the specific language governing + permissions and limitations under the License. diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/erlang/Modulefile b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/erlang/Modulefile new file mode 100644 index 00000000000..9ca1ef70427 --- /dev/null +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/erlang/Modulefile @@ -0,0 +1,10 @@ +name 'garethr-erlang' +version '0.3.0' +source 'git://github.com/garethr/garethr-erlang.git' +author 'Gareth Rushgrove' +summary 'Module for installing erlang from official repos' +description 'Install one of the official erlang packages' +license 'Apache License, Version 2.0' +dependency 'puppetlabs/apt' +dependency 'puppetlabs/stdlib' +dependency 'stahnma/epel' diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/erlang/README.md b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/erlang/README.md new file mode 100644 index 00000000000..a1959740bc6 --- /dev/null +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/erlang/README.md @@ -0,0 +1,28 @@ +Puppet module for installing Erlang from alternative repositories. + +On debian it will use the official repositories +mentioned on the [Erlang +docs](https://www.erlang-solutions.com/downloads/download-erlang-otp). + +On Redhat 5 it'll use an additional EPEL repository hosted by +[Redhat](http://repos.fedorapeople.org/repos/peter/erlang/epel-erlang.repo). + +On Redhat 6 it'll require EPEL. + +On SUSE it'll use the official repos. + +On Archlinux it'll use community repos. + +This module is also available on the [Puppet +Forge](https://forge.puppetlabs.com/garethr/erlang) + +[![Build +Status](https://secure.travis-ci.org/garethr/garethr-erlang.png)](http://travis-ci.org/garethr/garethr-erlang) + +## Usage + +The module includes a single class: + + include 'erlang' + +By default this sets up the repository and installs the erlang package. diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/erlang/Rakefile b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/erlang/Rakefile new file mode 100644 index 00000000000..d45aa3d5741 --- /dev/null +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/erlang/Rakefile @@ -0,0 +1,35 @@ +require 'puppetlabs_spec_helper/rake_tasks' +require 'puppet-lint/tasks/puppet-lint' +require 'puppet-syntax/tasks/puppet-syntax' +require 'rspec-system/rake_task' + +begin + require 'puppet_blacksmith/rake_tasks' +rescue LoadError +end + +PuppetLint.configuration.log_format = "%{path}:%{linenumber}:%{check}:%{KIND}:%{message}" +PuppetLint.configuration.fail_on_warnings = true + +# Forsake support for Puppet 2.6.2 for the benefit of cleaner code. +# http://puppet-lint.com/checks/class_parameter_defaults/ +PuppetLint.configuration.send('disable_class_parameter_defaults') +# http://puppet-lint.com/checks/class_inherits_from_params_class/ +PuppetLint.configuration.send('disable_class_inherits_from_params_class') +# http://puppet-lint.com/checks/80chars/ +PuppetLint.configuration.send("disable_80chars") + +exclude_paths = [ + "pkg/**/*", + "vendor/**/*", + "spec/**/*", +] +PuppetLint.configuration.ignore_paths = exclude_paths +PuppetSyntax.exclude_paths = exclude_paths + +desc "Run syntax, lint, and spec tests." +task :test => [ + :syntax, + :lint, + :spec, +] diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/erlang/manifests/init.pp b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/erlang/manifests/init.pp new file mode 100644 index 00000000000..045bada9474 --- /dev/null +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/erlang/manifests/init.pp @@ -0,0 +1,45 @@ +# == Class: erlang +# +# Module to install an up-to-date version of Erlang from the +# official repositories +# +# === Parameters +# [*version*] +# The package version to install, passed to ensure. +# Defaults to present. +# +class erlang ( + $epel_enable = $erlang::params::epel_enable, + $key_signature = $erlang::params::key_signature, + $local_repo_location = $erlang::params::local_repo_location, + $package_name = $erlang::params::package_name, + $remote_repo_location = $erlang::params::remote_repo_location, + $remote_repo_key_location = $erlang::params::remote_repo_key_location, + $repos = $erlang::params::repos, + $version = 'present', +) inherits erlang::params { + validate_string($version) + + case $::osfamily { + 'Debian' : { + include '::apt' + include '::erlang::repo::apt' + } + 'RedHat' : { + if $epel_enable { + # Include epel as this is a requirement for erlang in RHEL6. + include '::epel' + Class['epel'] -> Package[$package_name] + } + + # This is only needed on RHEL5, RHEL6 has erlang in EPEL. + if $::operatingsystemrelease =~ /^5/ { + include '::erlang::repo::yum' + } + } + default : { + } + } + + package { $package_name: ensure => $version, } +} diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/erlang/manifests/params.pp b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/erlang/manifests/params.pp new file mode 100644 index 00000000000..9358326cd94 --- /dev/null +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/erlang/manifests/params.pp @@ -0,0 +1,29 @@ +# == Class: erlang::params +# +# Default paramaters setting repository details for different +# operating systems +# +class erlang::params { + $epel_enable = false + + case $::osfamily { + 'Debian' : { + $key_signature = 'D208507CA14F4FCA' + $package_name = 'erlang-nox' + $remote_repo_key_location = 'http://packages.erlang-solutions.com/debian/erlang_solutions.asc' + $remote_repo_location = 'http://packages.erlang-solutions.com/debian' + $repos = 'contrib' + } + 'RedHat', 'SUSE', 'Archlinux' : { + $package_name = 'erlang' + + if $::operatingsystemrelease =~ /^5/ { + $local_repo_location = '/etc/yum.repos.d/epel-erlang.repo' + $remote_repo_location = 'http://repos.fedorapeople.org/repos/peter/erlang/epel-erlang.repo' + } + } + default : { + fail("The ${module_name} module is not supported on an ${::osfamily} based system.") + } + } +} diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/erlang/manifests/repo/apt.pp b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/erlang/manifests/repo/apt.pp new file mode 100644 index 00000000000..dc5dbc9c4fb --- /dev/null +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/erlang/manifests/repo/apt.pp @@ -0,0 +1,41 @@ +# == Class: erlang::repo::apt +# +# Install an apt package repository containing Erlang. +# All parameters have sane default values in erlang::params. +# +# === Parameters +# [*key_signature*] +# The signature for the key used to sign packages in the repository. +# +# [*package_name*] +# Name of the Erlang package in the specified repository. +# +# [*remote_repo_key_location*] +# URL of the public key for the remote repository. +# +# [*remote_repo_location*] +# URL of the remote debian repository. +# +# [*repos*] +# Which of the standard repositories to install from the +# remote repo. For instance main, contrib, restricted. +# +class erlang::repo::apt( + $key_signature = $erlang::key_signature, + $package_name = $erlang::package_name, + $remote_repo_key_location = $erlang::remote_repo_key_location, + $remote_repo_location = $erlang::remote_repo_location, + $repos = $erlang::repos, +) { + + Class['erlang::repo::apt'] -> Package<| title == $package_name |> + + apt::source { 'erlang': + include_src => false, + key => $key_signature, + key_source => $remote_repo_key_location, + location => $remote_repo_location, + repos => $repos, + } + +} diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/erlang/manifests/repo/yum.pp b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/erlang/manifests/repo/yum.pp new file mode 100644 index 00000000000..702e65220b9 --- /dev/null +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/erlang/manifests/repo/yum.pp @@ -0,0 +1,30 @@ +# == Class: erlang::repo::yum +# +# Install a yum package repository containing Erlang. +# All parameters have sane default values in erlang::params. +# +# === Parameters +# [*local_repo_location*] +# File system location to store the repository details +# +# [*package_name*] +# Name of the Erlang package in the specified repository +# +# [*remote_repo_location*] +# URL of the remote repository +# +class erlang::repo::yum ( + $local_repo_location = $erlang::local_repo_location, + $package_name = $erlang::package_name, + $remote_repo_location = $erlang::remote_repo_location, +) inherits erlang { + + Class['erlang::repo::yum'] -> Package<| title == $package_name |> + + exec { 'erlang-repo-download': + command => "curl -o ${local_repo_location} ${remote_repo_location}", + path => '/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin', + creates => $local_repo_location, + } + +} diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/erlang/spec/classes/erlang_spec.rb b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/erlang/spec/classes/erlang_spec.rb new file mode 100644 index 00000000000..8708eb1afe8 --- /dev/null +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/erlang/spec/classes/erlang_spec.rb @@ -0,0 +1,138 @@ +require 'spec_helper' + +describe 'erlang', :type => :class do + + + context 'on Debian' do + let(:facts) { { + :osfamily => 'Debian', + :lsbdistid => 'debian', + :lsbdistcodename => 'squeeze' + }} + + context 'with no parameters' do + it { should compile.with_all_deps } + it { should contain_package('erlang-nox').with_ensure('present') } + it { should contain_apt__source('erlang').with( + 'key_source' => 'http://packages.erlang-solutions.com/debian/erlang_solutions.asc', + 'key' => 'D208507CA14F4FCA' + ) } + end + + context 'with a custom version' do + let(:params) { {'version' => 'absent' } } + it { should contain_package('erlang-nox').with_ensure('absent') } + end + + context 'with a custom package name' do + let(:params) { {'package_name' => 'not-erlang' } } + it { should contain_package('not-erlang').with_ensure('present') } + end + + context 'with custom repository details' do + let(:params) { { + 'key_signature' => '1234ABCD', + 'repos' => 'main', + 'remote_repo_location' => 'http://example.com/debian', + 'remote_repo_key_location' => 'http://example.com/debian/key.asc', + } } + it { should contain_apt__source('erlang').with( + 'location' => 'http://example.com/debian', + 'key_source' => 'http://example.com/debian/key.asc', + 'key' => '1234ABCD', + 'repos' => 'main' + ) } + end + + end + + context 'on RedHat 5' do + let(:facts) { {:osfamily => 'RedHat', :operatingsystemrelease => '5.9' } } + + context "epel enabled" do + let(:params) {{ :epel_enable => true }} + it { should contain_class('epel') } + end + + context "epel disabled" do + let(:params) {{ :epel_enable => false }} + it { should_not contain_class('epel') } + end + + context 'with no parameters' do + it { should contain_package('erlang').with_ensure('present') } + it { should contain_exec('erlang-repo-download').with( + 'command' => 'curl -o /etc/yum.repos.d/epel-erlang.repo http://repos.fedorapeople.org/repos/peter/erlang/epel-erlang.repo', + 'path' => '/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin' + ) + } + end + + context 'with a custom repository' do + let(:params) { { + 'local_repo_location' => '/tmp/yum.repos.d/tmp.repo', + 'remote_repo_location' => 'http://example.com/fake.repo', + } } + + it { should contain_exec('erlang-repo-download').with( + 'command' => 'curl -o /tmp/yum.repos.d/tmp.repo http://example.com/fake.repo' + ) + } + end + + context 'with a custom version' do + let(:params) { {'version' => 'absent' } } + it { should contain_package('erlang').with_ensure('absent') } + end + end + + context 'on RedHat 6' do + let(:facts) { {:osfamily => 'RedHat', :operatingsystemrelease => '6.4' } } + + context "epel enabled" do + let(:params) {{ :epel_enable => true }} + it { should contain_class('epel') } + end + + context "epel disabled" do + let(:params) {{ :epel_enable => false }} + it { should_not contain_class('epel') } + end + + context 'with no parameters' do + it { should contain_package('erlang').with_ensure('present') } + end + + context 'with a custom version' do + let(:params) { {'version' => 'absent' } } + it { should contain_package('erlang').with_ensure('absent') } + end + end + + context 'on SUSE' do + let(:facts) {{ :osfamily => 'SUSE', }} + + context 'with no parameters' do + it { should contain_package('erlang').with_ensure('present') } + end + + context 'with a custom version' do + let(:params) { {'version' => 'absent' } } + it { should contain_package('erlang').with_ensure('absent') } + end + end + + context 'on Archlinux' do + let(:facts) {{ :osfamily => 'Archlinux', }} + + context 'with no parameters' do + it { should contain_package('erlang').with_ensure('present') } + end + + context 'with a custom version' do + let(:params) { {'version' => 'absent' } } + it { should contain_package('erlang').with_ensure('absent') } + end + end + +end diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/erlang/spec/spec_helper.rb b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/erlang/spec/spec_helper.rb new file mode 100644 index 00000000000..2c6f56649ae --- /dev/null +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/erlang/spec/spec_helper.rb @@ -0,0 +1 @@ +require 'puppetlabs_spec_helper/module_spec_helper' diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/erlang/spec/spec_helper_system.rb b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/erlang/spec/spec_helper_system.rb new file mode 100644 index 00000000000..5c370248560 --- /dev/null +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/erlang/spec/spec_helper_system.rb @@ -0,0 +1,17 @@ +require 'rspec-system/spec_helper' +require 'rspec-system-puppet/helpers' + +include RSpecSystemPuppet::Helpers + +RSpec.configure do |c| + proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..')) + c.tty = true + c.include RSpecSystemPuppet::Helpers + + c.before :suite do + puppet_install + puppet_module_install(:source => proj_root, :module_name => 'erlang') + shell('puppet module install puppetlabs-apt') + shell('puppet module install stahnma-epel') + end +end diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/erlang/spec/system/erlang_spec.rb b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/erlang/spec/system/erlang_spec.rb new file mode 100644 index 00000000000..4d5772fa59a --- /dev/null +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/erlang/spec/system/erlang_spec.rb @@ -0,0 +1,25 @@ +require 'spec_helper_system' + +describe 'The erlang puppet module' do + it 'should run without errors' do + pp = <<-EOS + class { 'erlang': + epel_enable => true + } + EOS + + puppet_apply(pp) do |r| + r.exit_code.should == 2 + r.refresh + r.exit_code.should be_zero + end + end + + it 'should install the erl binary into /usr/bin' do + shell 'which erl' do |r| + r.stdout.should =~ /\/usr\/bin\/erl/ + r.stderr.should be_empty + r.exit_code.should be_zero + end + end +end diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/puphpet/lib/puppet/parser/functions/hash_key_true.rb b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/puphpet/lib/puppet/parser/functions/hash_key_true.rb new file mode 100644 index 00000000000..90401172eb7 --- /dev/null +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/puphpet/lib/puppet/parser/functions/hash_key_true.rb @@ -0,0 +1,46 @@ +# +# hash_key_true.rb +# + +module Puppet::Parser::Functions + + newfunction(:hash_key_true, :type => :rvalue, :doc => <<-'ENDHEREDOC') do |args| + + Returns true if the key within hash is truthy + ENDHEREDOC + + unless args.length == 2 + raise Puppet::ParseError, ("hash_key_true(): wrong number of arguments (#{args.length}; must be 2)") + end + + arr = args[0] + key = args[1] + + unless arr.is_a?(Hash) + return false + end + + unless arr.has_key?(key) + return false + end + + if arr[key].nil? + return false + end + + if arr[key] == false + return false + end + + if arr[key] == 'false' + return false + end + + if arr[key].empty? + return false + end + + return true + + end +end diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/puphpet/lib/puppet/parser/functions/value_true.rb b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/puphpet/lib/puppet/parser/functions/value_true.rb new file mode 100644 index 00000000000..d50c2d8304b --- /dev/null +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/puphpet/lib/puppet/parser/functions/value_true.rb @@ -0,0 +1,45 @@ +# +# value_true.rb +# + +module Puppet::Parser::Functions + + newfunction(:value_true, :type => :rvalue, :doc => <<-'ENDHEREDOC') do |args| + + Returns true if value is truthy + ENDHEREDOC + + unless args.length == 1 + raise Puppet::ParseError, ("value_true(): wrong number of arguments (#{args.length}; must be 1)") + end + + value = args[0] + + if value.nil? + return false + end + + if value == false + return false + end + + if value == 0 + return false + end + + if value == '0' + return false + end + + if value == 'false' + return false + end + + if value.empty? + return false + end + + return true + + end +end diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/puphpet/manifests/hhvm.pp b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/puphpet/manifests/hhvm.pp index 90083232cdc..7a35d19efe9 100644 --- a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/puphpet/manifests/hhvm.pp +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/puphpet/manifests/hhvm.pp @@ -44,7 +44,11 @@ class puphpet::hhvm( 'deb http://security.debian.org/ wheezy/updates main', 'deb-src http://security.debian.org/ wheezy/updates main', 'deb http://http.us.debian.org/debian wheezy-updates main', - 'deb-src http://http.us.debian.org/debian wheezy-updates main' + 'deb-src http://http.us.debian.org/debian wheezy-updates main', + 'deb http://http.debian.net/debian wheezy main', + 'deb-src http://http.debian.net/debian wheezy main', + 'deb http://http.debian.net/debian wheezy-updates main', + 'deb-src http://http.debian.net/debian wheezy-updates main', ] each( $deb_srcs ) |$value| { @@ -69,17 +73,39 @@ class puphpet::hhvm( } } 'centos': { + $jemalloc_url = 'http://files.puphpet.com/centos6/jemalloc-3.6.0-1.el6.x86_64.rpm' + $jemalloc_download_location = '/.puphpet-stuff/jemalloc-3.6.0-1.el6.x86_64.rpm' + + $require = defined(Class['my_fw::post']) ? { + true => Class['my_fw::post'], + default => [], + } + + exec { "download jemalloc to ${download_location}": + creates => $download_location, + command => "wget --quiet --tries=5 --connect-timeout=10 -O '${jemalloc_download_location}' '${jemalloc_url}'", + timeout => 30, + path => '/usr/bin', + require => $require + } + + package { 'jemalloc': + ensure => latest, + provider => yum, + source => $download_location, + require => Exec["download jemalloc to ${download_location}"], + } + yum::managed_yumrepo { 'hop5': descr => 'hop5 repository', baseurl => 'http://www.hop5.in/yum/el6/', gpgkey => 'file:///etc/pki/rpm-gpg/RPM-GPG-KEY-HOP5', enabled => 1, gpgcheck => 0, - priority => 1 + priority => 1, } } } - if $real_webserver == 'apache2' { if ! defined(Class['apache::mod::mime']) { class { 'apache::mod::mime': } diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/puphpet/manifests/params.pp b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/puphpet/manifests/params.pp index 1a998e9271b..e266f862cdb 100644 --- a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/puphpet/manifests/params.pp +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/puphpet/manifests/params.pp @@ -53,9 +53,14 @@ class puphpet::params { 'Redhat' => 'php-cgi' } + $nginx_default_conf_location = $::osfamily ? { + 'Debian' => '/etc/nginx/conf.d/default.conf', + 'Redhat' => '/etc/nginx/conf.d/default.conf' + } + $nginx_webroot_location = $::osfamily ? { 'Debian' => '/var/www/html', - 'Redhat' => '/usr/share/nginx/html' + 'Redhat' => '/var/www/html' } $mariadb_package_client_name = $::osfamily ? { diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/puphpet/manifests/php/pear.pp b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/puphpet/manifests/php/pear.pp index 4582e67a17a..f570dcd4fc4 100644 --- a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/puphpet/manifests/php/pear.pp +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/puphpet/manifests/php/pear.pp @@ -3,7 +3,8 @@ */ define puphpet::php::pear ( - $service_autorestart + $service_name = '', + $service_autorestart, ){ $package = { @@ -15,7 +16,9 @@ define puphpet::php::pear ( 'pear_command_packaging' => 'alpha', 'pear_frontend_gtk2' => false, 'php_beautifier' => 'beta', + 'php_parser' => 'alpha', 'php_parser_docblockparser' => 'alpha', + 'soap' => 'beta', 'testing_selenium' => 'beta', 'versioncontrol_git' => 'alpha', 'versioncontrol_svn' => 'alpha', @@ -38,7 +41,8 @@ define puphpet::php::pear ( ::php::pear::module { $name: use_package => false, preferred_state => $preferred_state, - service_autorestart => $php_webserver_restart, + service => $service_name, + service_autorestart => $service_autorestart, } } diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/puphpet/manifests/php/pecl.pp b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/puphpet/manifests/php/pecl.pp index 2dd2b817fec..dfa04232f42 100644 --- a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/puphpet/manifests/php/pecl.pp +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/puphpet/manifests/php/pecl.pp @@ -16,7 +16,10 @@ define puphpet::php::pecl ( $pecl = $::osfamily ? { 'Debian' => { - # + 'mongo' => $::lsbdistcodename ? { + 'precise' => 'mongo', + default => false, + }, }, 'Redhat' => { # @@ -63,24 +66,34 @@ define puphpet::php::pecl ( } } + $auto_answer_hash = { + 'mongo' => 'no\n' + } + $downcase_name = downcase($name) - if has_key($ignore, $downcase_name) { + if has_key($auto_answer_hash, $downcase_name) { + $auto_answer = $auto_answer_hash[$downcase_name] + } else { + $auto_answer = '\\n' + } + + if has_key($ignore, $downcase_name) and $ignore[$downcase_name] { $pecl_name = $pecl[$downcase_name] $package_name = false $preferred_state = 'stable' } - elsif has_key($pecl, $downcase_name) { - $pecl_name = false + elsif has_key($pecl, $downcase_name) and $pecl[$downcase_name] { + $pecl_name = $pecl[$downcase_name] $package_name = false - $preferred_state = false + $preferred_state = 'stable' } elsif has_key($pecl_beta, $downcase_name) and $pecl_beta[$downcase_name] { $pecl_name = $pecl_beta[$downcase_name] $package_name = false $preferred_state = 'beta' } - elsif has_key($package, $downcase_name) { + elsif has_key($package, $downcase_name) and $package[$downcase_name] { $pecl_name = false $package_name = $package[$downcase_name] } @@ -93,6 +106,7 @@ define puphpet::php::pecl ( ::php::pecl::module { $pecl_name: use_package => false, preferred_state => $preferred_state, + auto_answer => $auto_answer, service_autorestart => $service_autorestart, } } diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/puphpet/manifests/python/pip.pp b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/puphpet/manifests/python/pip.pp new file mode 100644 index 00000000000..14b13fe08c6 --- /dev/null +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/puphpet/manifests/python/pip.pp @@ -0,0 +1,22 @@ +class puphpet::python::pip { + + Exec { path => [ '/usr/bin/', '/usr/local/bin', '/bin', '/usr/local/sbin', '/usr/sbin', '/sbin' ] } + + if ! defined(Package['python-setuptools']) { + package { 'python-setuptools': } + } + + exec { 'easy_install pip': + unless => 'which pip', + require => Package['python-setuptools'], + } + + if $::osfamily == 'RedHat' { + exec { 'rhel pip_provider_name_fix': + command => 'alternatives --install /usr/bin/pip-python pip-python /usr/bin/pip 1', + subscribe => Exec['easy_install pip'], + unless => 'which pip-python', + } + } + +} diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/puphpet/manifests/supervisord.pp b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/puphpet/manifests/supervisord.pp new file mode 100644 index 00000000000..a13df08b30b --- /dev/null +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/puphpet/manifests/supervisord.pp @@ -0,0 +1,18 @@ +# This depends on +# ajcrowe/supervisord: https://github.com/ajcrowe/puppet-supervisord + +class puphpet::supervisord { + + if ! defined(Class['::supervisord']) { + class{ 'puphpet::python::pip': } + + class { '::supervisord': + install_pip => false, + require => [ + Class['::my_fw::post'], + Class['puphpet::python::pip'], + ], + } + } + +} diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/rabbitmq/README.md b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/rabbitmq/README.md index c6750445516..d956bdedcff 100644 --- a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/rabbitmq/README.md +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/rabbitmq/README.md @@ -111,6 +111,23 @@ class { 'rabbitmq': } ``` +**NOTE:** If you are using a version of RabbitMQ less than 3.0, +you still need to use `x-ha-policy: all` in your client +applications for any particular queue to take advantage of H/A via +mirrored queues. + +If you are using a version of RabbitMQ >= 3.0 You should set the +'config_mirrored_queues' parameter if you plan +on using RabbitMQ Mirrored Queues within your cluster: + +```puppet +class { 'rabbitmq': + config_cluster => true, + config_mirrored_queues => true, + cluster_nodes => ['rabbit1', 'rabbit2'], +} +``` + ##Reference ##Classes @@ -234,6 +251,15 @@ Determines if the service is managed. The name of the service to manage. +####`ssl` + +Configures the service for using SSL. + +####`ssl_only` + +Configures the service to only use SSL. No cleartext TCP listeners will be created. +Requires that ssl => true also. + ####`stomp_port` The port to use for Stomp. @@ -262,6 +288,16 @@ rabbitmq_user { 'dan': password => 'bar', } ``` +Optional parameter tags will set further rabbitmq tags like monitoring, policymaker, etc. +To set the administrator tag use admin-flag. +```puppet +rabbitmq_user { 'dan': + admin => true, + password => 'bar', + tags => ['monitoring', 'tag1'], +} +``` + ### rabbitmq\_vhost @@ -317,8 +353,8 @@ The module has been tested on: Testing on other platforms has been light and cannot be guaranteed. -### RedHat module dependencies -To have a suitable erlang version installed on RedHat systems, +### Module dependencies +To have a suitable erlang version installed on RedHat and Debian systems, you have to install another puppet module from http://forge.puppetlabs.com/garethr/erlang with: puppet module install garethr-erlang @@ -326,9 +362,18 @@ you have to install another puppet module from http://forge.puppetlabs.com/garet This module handles the packages for erlang. To use the module, add the following snippet to your site.pp or an appropriate profile class: +For RedHat systems: + include 'erlang' class { 'erlang': epel_enable => true} +For Debian systems: + + include 'erlang' + package { 'erlang-base': + ensure => 'latest', + } + ##Development Puppet Labs modules on the Puppet Forge are open projects, and community diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/rabbitmq/files/plugins/amqp_client-2.3.1.ez b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/rabbitmq/files/plugins/amqp_client-2.3.1.ez index 6ef6d4ff148..125a89a7b79 100644 Binary files a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/rabbitmq/files/plugins/amqp_client-2.3.1.ez and b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/rabbitmq/files/plugins/amqp_client-2.3.1.ez differ diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/rabbitmq/lib/puppet/provider/rabbitmq_exchange/rabbitmqadmin.rb b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/rabbitmq/lib/puppet/provider/rabbitmq_exchange/rabbitmqadmin.rb index fcc3764fdd8..8e0d6ab862d 100644 --- a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/rabbitmq/lib/puppet/provider/rabbitmq_exchange/rabbitmqadmin.rb +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/rabbitmq/lib/puppet/provider/rabbitmq_exchange/rabbitmqadmin.rb @@ -2,7 +2,9 @@ require 'puppet' Puppet::Type.type(:rabbitmq_exchange).provide(:rabbitmqadmin) do commands :rabbitmqctl => '/usr/sbin/rabbitmqctl' - commands :rabbitmqadmin => '/usr/local/bin/rabbitmqadmin' + has_command(:rabbitmqadmin, '/usr/local/bin/rabbitmqadmin') do + environment( { 'HOME' => '' }) + end defaultfor :feature => :posix def should_vhost diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/rabbitmq/lib/puppet/provider/rabbitmq_plugin/rabbitmqplugins.rb b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/rabbitmq/lib/puppet/provider/rabbitmq_plugin/rabbitmqplugins.rb index e416cbe02b3..eefc9fb2541 100644 --- a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/rabbitmq/lib/puppet/provider/rabbitmq_plugin/rabbitmqplugins.rb +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/rabbitmq/lib/puppet/provider/rabbitmq_plugin/rabbitmqplugins.rb @@ -1,10 +1,20 @@ Puppet::Type.type(:rabbitmq_plugin).provide(:rabbitmqplugins) do if Puppet::PUPPETVERSION.to_f < 3 - commands :rabbitmqplugins => 'rabbitmq-plugins' + if Facter.value(:osfamily) == 'RedHat' + commands :rabbitmqplugins => '/usr/lib/rabbitmq/bin/rabbitmq-plugins' + else + commands :rabbitmqplugins => 'rabbitmq-plugins' + end else - has_command(:rabbitmqplugins, 'rabbitmq-plugins') do - environment :HOME => "/tmp" + if Facter.value(:osfamily) == 'RedHat' + has_command(:rabbitmqplugins, '/usr/lib/rabbitmq/bin/rabbitmq-plugins') do + environment :HOME => "/tmp" + end + else + has_command(:rabbitmqplugins, 'rabbitmq-plugins') do + environment :HOME => "/tmp" + end end end diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/rabbitmq/lib/puppet/provider/rabbitmq_user/rabbitmqctl.rb b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/rabbitmq/lib/puppet/provider/rabbitmq_user/rabbitmqctl.rb index 9cb2e41c293..ef284bdcdc6 100644 --- a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/rabbitmq/lib/puppet/provider/rabbitmq_user/rabbitmqctl.rb +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/rabbitmq/lib/puppet/provider/rabbitmq_user/rabbitmqctl.rb @@ -27,6 +27,9 @@ Puppet::Type.type(:rabbitmq_user).provide(:rabbitmqctl) do if resource[:admin] == :true make_user_admin() end + if !resource[:tags].nil? + set_user_tags(resource[:tags]) + end end def destroy @@ -39,8 +42,18 @@ Puppet::Type.type(:rabbitmq_user).provide(:rabbitmqctl) do end end - # def password - # def password=() + + def tags + get_user_tags.entries.sort + end + + + def tags=(tags) + if ! tags.nil? + set_user_tags(tags) + end + end + def admin if usertags = get_user_tags (:true if usertags.include?('administrator')) || :false @@ -49,7 +62,6 @@ Puppet::Type.type(:rabbitmq_user).provide(:rabbitmqctl) do end end - def admin=(state) if state == :true make_user_admin() @@ -60,6 +72,16 @@ Puppet::Type.type(:rabbitmq_user).provide(:rabbitmqctl) do end end + def set_user_tags(tags) + is_admin = get_user_tags().member?("administrator") \ + || resource[:admin] == :true + usertags = Set.new(tags) + if is_admin + usertags.add("administrator") + end + rabbitmqctl('set_user_tags', resource[:name], usertags.entries.sort) + end + def make_user_admin usertags = get_user_tags usertags.add('administrator') @@ -73,5 +95,4 @@ Puppet::Type.type(:rabbitmq_user).provide(:rabbitmqctl) do end.compact.first Set.new(match[1].split(/, /)) if match end - end diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/rabbitmq/lib/puppet/type/rabbitmq_user.rb b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/rabbitmq/lib/puppet/type/rabbitmq_user.rb index 642710d1c07..be5219d5c90 100644 --- a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/rabbitmq/lib/puppet/type/rabbitmq_user.rb +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/rabbitmq/lib/puppet/type/rabbitmq_user.rb @@ -33,6 +33,10 @@ Puppet::Type.newtype(:rabbitmq_user) do defaultto :false end + newproperty(:tags, :array_matching => :all) do + desc 'additional tags for the user' + end + validate do if self[:ensure] == :present and ! self[:password] raise ArgumentError, 'must set password when creating user' unless self[:password] diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/rabbitmq/manifests/config.pp b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/rabbitmq/manifests/config.pp index 96877f6a631..8894280f6de 100644 --- a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/rabbitmq/manifests/config.pp +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/rabbitmq/manifests/config.pp @@ -17,11 +17,14 @@ class rabbitmq::config { $port = $rabbitmq::port $service_name = $rabbitmq::service_name $ssl = $rabbitmq::ssl + $ssl_only = $rabbitmq::ssl_only $ssl_cacert = $rabbitmq::ssl_cacert $ssl_cert = $rabbitmq::ssl_cert $ssl_key = $rabbitmq::ssl_key $ssl_management_port = $rabbitmq::ssl_management_port $ssl_stomp_port = $rabbitmq::ssl_stomp_port + $ssl_verify = $rabbitmq::ssl_verify + $ssl_fail_if_no_peer_cert = $rabbitmq::ssl_fail_if_no_peer_cert $stomp_port = $rabbitmq::stomp_port $wipe_db_on_cookie_change = $rabbitmq::wipe_db_on_cookie_change $config_variables = $rabbitmq::config_variables @@ -115,3 +118,4 @@ class rabbitmq::config { } + diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/rabbitmq/manifests/init.pp b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/rabbitmq/manifests/init.pp index 6c14f0097d6..c96128a792e 100644 --- a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/rabbitmq/manifests/init.pp +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/rabbitmq/manifests/init.pp @@ -6,6 +6,7 @@ class rabbitmq( $cluster_nodes = $rabbitmq::params::cluster_nodes, $config = $rabbitmq::params::config, $config_cluster = $rabbitmq::params::config_cluster, + $config_mirrored_queues = $rabbitmq::params::config_mirrored_queues, $config_path = $rabbitmq::params::config_path, $config_stomp = $rabbitmq::params::config_stomp, $default_user = $rabbitmq::params::default_user, @@ -29,6 +30,7 @@ class rabbitmq( $service_manage = $rabbitmq::params::service_manage, $service_name = $rabbitmq::params::service_name, $ssl = $rabbitmq::params::ssl, + $ssl_only = $rabbitmq::params::ssl_only, $ssl_cacert = $rabbitmq::params::ssl_cacert, $ssl_cert = $rabbitmq::params::ssl_cert, $ssl_key = $rabbitmq::params::ssl_key, @@ -59,7 +61,6 @@ class rabbitmq( validate_string($package_gpg_key) validate_string($package_name) validate_string($package_provider) - validate_string($package_source) validate_bool($manage_repos) validate_re($version, '^\d+\.\d+\.\d+(-\d+)*$') # Allow 3 digits and optional -n postfix. # Validate config parameters. @@ -69,6 +70,7 @@ class rabbitmq( validate_string($config) validate_absolute_path($config_path) validate_bool($config_cluster) + validate_bool($config_mirrored_queues) validate_bool($config_stomp) validate_string($default_user) validate_string($default_pass) @@ -87,6 +89,7 @@ class rabbitmq( validate_bool($service_manage) validate_string($service_name) validate_bool($ssl) + validate_bool($ssl_only) validate_string($ssl_cacert) validate_string($ssl_cert) validate_string($ssl_key) @@ -105,6 +108,10 @@ class rabbitmq( validate_hash($config_variables) validate_hash($config_kernel_variables) + if $ssl_only and ! $ssl { + fail('$ssl_only => true requires that $ssl => true') + } + include '::rabbitmq::install' include '::rabbitmq::config' include '::rabbitmq::service' diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/rabbitmq/manifests/management.pp b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/rabbitmq/manifests/management.pp index 481a7b4f931..078e9a95f00 100644 --- a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/rabbitmq/manifests/management.pp +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/rabbitmq/manifests/management.pp @@ -10,4 +10,10 @@ class rabbitmq::management { } } + if $rabbitmq::config_mirrored_queues { + rabbitmq::policy { 'ha-all': + pattern => '.*', + definition => '{"ha-mode":"all","ha-sync-mode":"automatic"}' + } + } } diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/rabbitmq/manifests/params.pp b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/rabbitmq/manifests/params.pp index 9018bb7b244..63e2e491ee1 100644 --- a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/rabbitmq/manifests/params.pp +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/rabbitmq/manifests/params.pp @@ -61,6 +61,7 @@ class rabbitmq::params { $cluster_nodes = [] $config = 'rabbitmq/rabbitmq.config.erb' $config_cluster = false + $config_mirrored_queues = false $config_path = '/etc/rabbitmq/rabbitmq.config' $config_stomp = false $default_user = 'guest' @@ -73,6 +74,7 @@ class rabbitmq::params { $plugin_dir = "/usr/lib/rabbitmq/lib/rabbitmq_server-${version}/plugins" $port = '5672' $ssl = false + $ssl_only = false $ssl_cacert = 'UNSET' $ssl_cert = 'UNSET' $ssl_key = 'UNSET' diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/rabbitmq/manifests/policy.pp b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/rabbitmq/manifests/policy.pp new file mode 100644 index 00000000000..204fb36a9cf --- /dev/null +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/rabbitmq/manifests/policy.pp @@ -0,0 +1,15 @@ +define rabbitmq::policy ( + $pattern, + $definition, + $vhost = '/', + $priority = 0, +) { + + exec { "rabbitmq policy: ${title}": + command => "rabbitmqctl set_policy -p ${vhost} '${name}' '${pattern}' '${definition}' ${priority}", + unless => "rabbitmqctl list_policies | grep -qE '^${vhost}\\s+${name}\\s+${pattern}\\s+${definition}\\s+${priority}$'", + path => ['/bin','/sbin','/usr/bin','/usr/sbin'], + require => Class['rabbitmq::service'], + before => Anchor['rabbitmq::end'] + } +} diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/rabbitmq/manifests/server.pp b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/rabbitmq/manifests/server.pp index 495ea2f2dfc..8ad26cb5bb6 100644 --- a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/rabbitmq/manifests/server.pp +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/rabbitmq/manifests/server.pp @@ -66,7 +66,7 @@ class rabbitmq::server( } if $config_mirrored_queues != undef { - warning('The $config_mirrored_queues parameter is deprecated; it does not affect anything') + warning('The $config_mirrored_queues parameter is deprecated in this class, use the rabbitmq class') } anchor {'before::rabbimq::class': diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/rabbitmq/spec/classes/rabbitmq_spec.rb b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/rabbitmq/spec/classes/rabbitmq_spec.rb index 3e577843e8a..ff93fd4e3fc 100644 --- a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/rabbitmq/spec/classes/rabbitmq_spec.rb +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/rabbitmq/spec/classes/rabbitmq_spec.rb @@ -20,7 +20,7 @@ describe 'rabbitmq' do let(:facts) {{ :osfamily => 'Debian' }} it 'should add a repo with defaults values' do contain_file('/etc/apt/sources.list.d/rabbitmq.list')\ - .with_content(/deb http\:\/\/www\.rabbitmq.com\/debian\/ testing main/) + .with_content(%r|deb http\://www\.rabbitmq.com/debian/ testing main|) end end @@ -32,7 +32,7 @@ describe 'rabbitmq' do }} it 'should add a repo with custom new values' do contain_file('/etc/apt/sources.list.d/rabbitmq.list')\ - .with_content(/deb http\:\/\/www\.foorepo.com\/debian\/ unstable main/) + .with_content(%r|deb http\://www\.foorepo.com/debian/ unstable main|) end end end @@ -275,6 +275,30 @@ describe 'rabbitmq' do end end + describe 'configuring ldap authentication' do + let :params do + { :config_stomp => false, + :ldap_auth => true, + :ldap_server => 'ldap.example.com', + :ldap_user_dn_pattern => 'ou=users,dc=example,dc=com', + :ldap_use_ssl => false, + :ldap_port => '389', + :ldap_log => true + } + end + + it { should contain_rabbitmq_plugin('rabbitmq_auth_backend_ldap') } + + it 'should contain ldap parameters' do + verify_contents(subject, 'rabbitmq.config', + ['[', ' {rabbit, [', ' {auth_backends, [rabbit_auth_backend_internal, rabbit_auth_backend_ldap]},', ' ]}', + ' {rabbitmq_auth_backend_ldap, [', ' {other_bind, anon},', + ' {servers, ["ldap.example.com"]},', + ' {user_dn_pattern, "ou=users,dc=example,dc=com"},', ' {use_ssl, false},', + ' {port, 389},', ' {log, true}']) + end + end + describe 'default_user and default_pass set' do let(:params) {{ :default_user => 'foo', :default_pass => 'bar' }} it 'should set default_user and default_pass to specified values' do @@ -295,10 +319,31 @@ describe 'rabbitmq' do it 'should set ssl options to specified values' do contain_file('rabbitmq.config').with({ - 'content' => /ssl_listeners, \[3141\].* - ssl_options, \[{cacertfile,"\/path\/to\/cacert".* - certfile="\/path\/to\/cert".* - keyfile,"\/path\/to\/key/, + 'content' => %r|ssl_listeners, \[3141\].* + ssl_options, \[{cacertfile,"/path/to/cacert".* + certfile="/path/to/cert".* + keyfile,"/path/to/key|, + }) + end + end + + describe 'ssl options with ssl_only' do + let(:params) { + { :ssl => true, + :ssl_only => true, + :ssl_management_port => 3141, + :ssl_cacert => '/path/to/cacert', + :ssl_cert => '/path/to/cert', + :ssl_key => '/path/to/key' + } } + + it 'should set ssl options to specified values' do + contain_file('rabbitmq.config').with({ + 'content' => %r|tcp_listeners, \[\].* + ssl_listeners, \[3141\].* + ssl_options, \[{cacertfile,"/path/to/cacert".* + certfile="/path/to/cert".* + keyfile,"/path/to/key|, }) end end diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/rabbitmq/spec/unit/puppet/provider/rabbitmq_user/rabbitmqctl_spec.rb b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/rabbitmq/spec/unit/puppet/provider/rabbitmq_user/rabbitmqctl_spec.rb index ea4233cba13..2c13b886a8c 100644 --- a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/rabbitmq/spec/unit/puppet/provider/rabbitmq_user/rabbitmqctl_spec.rb +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/rabbitmq/spec/unit/puppet/provider/rabbitmq_user/rabbitmqctl_spec.rb @@ -147,4 +147,90 @@ EOT @provider.expects(:rabbitmqctl).with('set_user_tags', 'foo', ['bar','baz'].sort) @provider.admin=:false end + + it 'should clear all tags on existing user' do + @provider.expects(:rabbitmqctl).with('list_users').returns <<-EOT +Listing users ... +one [administrator] +foo [tag1,tag2] +icinga [monitoring] +kitchen [] +kitchen2 [abc, def, ghi] +...done. +EOT + @provider.expects(:rabbitmqctl).with('set_user_tags', 'foo', []) + @provider.tags=[] + end + + it 'should set multiple tags' do + @provider.expects(:rabbitmqctl).with('list_users').returns <<-EOT +Listing users ... +one [administrator] +foo [] +icinga [monitoring] +kitchen [] +kitchen2 [abc, def, ghi] +...done. +EOT + @provider.expects(:rabbitmqctl).with('set_user_tags', 'foo', ['tag1','tag2']) + @provider.tags=['tag1','tag2'] + end + + it 'should clear tags while keep admin tag' do + @resource[:admin] = true + @provider.expects(:rabbitmqctl).with('list_users').returns <<-EOT +Listing users ... +one [administrator] +foo [administrator, tag1, tag2] +icinga [monitoring] +kitchen [] +kitchen2 [abc, def, ghi] +...done. +EOT + @provider.expects(:rabbitmqctl).with('set_user_tags', 'foo', ["administrator"]) + @provider.tags=[] + end + + it 'should change tags while keep admin tag' do + @resource[:admin] = true + @provider.expects(:rabbitmqctl).with('list_users').returns <<-EOT +Listing users ... +one [administrator] +foo [administrator, tag1, tag2] +icinga [monitoring] +kitchen [] +kitchen2 [abc, def, ghi] +...done. +EOT + @provider.expects(:rabbitmqctl).with('set_user_tags', 'foo', ["administrator","tag1","tag3","tag7"]) + @provider.tags=['tag1','tag7','tag3'] + end + + it 'should create user with tags and without admin' do + @resource[:tags] = [ "tag1", "tag2" ] + @provider.expects(:rabbitmqctl).with('add_user', 'foo', 'bar') + @provider.expects(:rabbitmqctl).with('set_user_tags', 'foo', ["tag1","tag2"]) + @provider.expects(:rabbitmqctl).with('list_users').returns <<-EOT +Listing users ... +foo [] +...done. +EOT + @provider.create + end + + it 'should create user with tags and with admin' do + @resource[:tags] = [ "tag1", "tag2" ] + @resource[:admin] = true + @provider.expects(:rabbitmqctl).with('add_user', 'foo', 'bar') + @provider.expects(:rabbitmqctl).with('list_users').twice.returns <<-EOT +Listing users ... +foo [] +...done. +EOT + @provider.expects(:rabbitmqctl).with('set_user_tags', 'foo', ["administrator"]) + @provider.expects(:rabbitmqctl).with('set_user_tags', 'foo', ["administrator","tag1","tag2"]) + @provider.create + end + + end diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/rabbitmq/templates/rabbitmq.config.erb b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/rabbitmq/templates/rabbitmq.config.erb index 766192dfdac..2d7f81bf21d 100644 --- a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/rabbitmq/templates/rabbitmq.config.erb +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/rabbitmq/templates/rabbitmq.config.erb @@ -9,7 +9,10 @@ {cluster_nodes, {[<%= @r_cluster_nodes.map { |n| "\'rabbit@#{n}\'" }.join(', ') %>], <%= @cluster_node_type %>}}, {cluster_partition_handling, <%= @cluster_partition_handling %>}, <% end -%> -<%- if @ssl %> +<%- if @ssl_only -%> + {tcp_listeners, []}, +<%- end -%> +<%- if @ssl -%> {ssl_listeners, [<%= @ssl_management_port %>]}, {ssl_options, [{cacertfile,"<%= @ssl_cacert %>"}, {certfile,"<%= @ssl_cert %>"}, @@ -37,6 +40,7 @@ {ssl_listeners, [<%= @ssl_stomp_port %>]} <%- end -%> ]} +<% end -%> <%- if @ldap_auth -%>, % Configure the LDAP authentication plugin {rabbitmq_auth_backend_ldap, [ @@ -47,7 +51,6 @@ {port, <%= @ldap_port %>}, {log, <%= @ldap_log %>} ]} -<% end -%> <%- end -%> ]. % EOF diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/sqlite/Modulefile b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/sqlite/Modulefile new file mode 100644 index 00000000000..19228ff3dbb --- /dev/null +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/sqlite/Modulefile @@ -0,0 +1,13 @@ +name 'puppetlabs-sqlite' +version '0.0.1' +source 'https://github.com/puppetlabs/puppetlabs-sqlite/' +author 'puppetlabs' +license 'Apache' +summary 'Manage a sqlite installation and databases' +description 'This module provides a sqlite class to manage +the installation of sqlite on a node. It also provides +a sqlite::db defined type to manage databases on a system' +project_page 'http://projects.puppetlabs.com/projects/modules/issues' + +## Add dependencies, if any: +# dependency 'username/name', '>= 1.2.0' diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/sqlite/README.md b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/sqlite/README.md new file mode 100644 index 00000000000..1eb43afa55e --- /dev/null +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/sqlite/README.md @@ -0,0 +1,32 @@ +sqlite +====== + +Author: Carl Caum +Copyright (c) 2011, Puppet Labs Inc. + +ABOUT +===== + +This module manages [sqlite](http://www.sqlite.org). Through declarion of the `sqlite` class, sqlite will be installed on the system. + +The `sqlite::db` defined type allows for the management of a sqlite database on the node + +CONFIGURATION +============= + +The main class (sqlite) only needs to be declared. No class parameters or top scope variables are needed. + +The `sqlite::db` defined type can be used to manage a sqlite database on the system. +The following parameters are available for the resources declaration: + +location What directory the database should go in. The presence of the directory must be managed separately of the defined type. +owner The owner of the sqlite database file on disk +group The group owning the sqlite database file on disk +mode The mode of the sqlite database file on disk +ensure Whether the database should be `present` or `absent`. Default to `present` +sqlite_cmd The sqlite command for the node's platform. Defaults to `sqlite3` + +TODO +==== + + * Allow for sql commands to be based to sqlite::db for use during creation diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/sqlite/manifests/db.pp b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/sqlite/manifests/db.pp new file mode 100644 index 00000000000..8b780462e9e --- /dev/null +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/sqlite/manifests/db.pp @@ -0,0 +1,44 @@ +# Define: sqlite::db +# +# This define allows for managing the existance of a sqlite database +# +# Parameters: +# $location: +# The location on disk to store the sqlite database +# $owner: +# The owner of the sqlite database file on disk +# $group: +# The group owning the sqlite database file on disk +# $mode: +# The mode of the sqlite datbase file on disk +# $ensure: +# Whether the database should be `present` or `absent`. Defaults to `present` +# $sqlite_cmd: +# The sqlite command for the node's platform. Defaults to `sqlite3` +define sqlite::db( + $location = '', + $owner = 'root', + $group = 0, + $mode = '755', + $ensure = present, + $sqlite_cmd = 'sqlite3' + ) { + + $safe_location = $location ? { + '' => "/var/lib/sqlite/${name}.db", + default => $location, + } + + file { $safe_location: + ensure => $ensure, + owner => $owner, + group => $group, + notify => Exec["create_${name}_db"], + } + + exec { "create_${name}_db": + command => "${sqlite_cmd} $safe_location", + path => '/usr/bin:/usr/local/bin', + refreshonly => true, + } +} diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/sqlite/manifests/init.pp b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/sqlite/manifests/init.pp new file mode 100644 index 00000000000..46b25062812 --- /dev/null +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/sqlite/manifests/init.pp @@ -0,0 +1,16 @@ +# Class: sqlite +# +# This class manages the installation of the sqlite +# database. +# +# Sample Usage: +# class { 'sqlite': } +class sqlite { + package { 'sqlite': + ensure => installed, + } + + file { '/var/lib/sqlite/': + ensure => directory, + } +} diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/sqlite/metadata.json b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/sqlite/metadata.json new file mode 100644 index 00000000000..8ce7797ff33 --- /dev/null +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/sqlite/metadata.json @@ -0,0 +1,12 @@ +/* ++-----------------------------------------------------------------------+ +| | +| ==> DO NOT EDIT THIS FILE! <== | +| | +| You should edit the `Modulefile` and run `puppet-module build` | +| to generate the `metadata.json` file for your releases. | +| | ++-----------------------------------------------------------------------+ +*/ + +{} diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/sqlite/spec/spec.opts b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/sqlite/spec/spec.opts new file mode 100644 index 00000000000..91cd6427ed6 --- /dev/null +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/sqlite/spec/spec.opts @@ -0,0 +1,6 @@ +--format +s +--colour +--loadby +mtime +--backtrace diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/sqlite/spec/spec_helper.rb b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/sqlite/spec/spec_helper.rb new file mode 100644 index 00000000000..a4aeeae232f --- /dev/null +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/sqlite/spec/spec_helper.rb @@ -0,0 +1,18 @@ +require 'pathname' +dir = Pathname.new(__FILE__).parent +$LOAD_PATH.unshift(dir, dir + 'lib', dir + '../lib') + +require 'mocha' +require 'puppet' +gem 'rspec', '=1.2.9' +require 'spec/autorun' + +Spec::Runner.configure do |config| + config.mock_with :mocha +end + +# We need this because the RAL uses 'should' as a method. This +# allows us the same behaviour but with a different method name. +class Object + alias :must :should +end diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/sqlite/tests/init.pp b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/sqlite/tests/init.pp new file mode 100644 index 00000000000..520d095142b --- /dev/null +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/sqlite/tests/init.pp @@ -0,0 +1 @@ +include sqlite diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/stdlib/spec/unit/facter/coverage/assets/0.8.0/colorbox/border.png b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/stdlib/spec/unit/facter/coverage/assets/0.8.0/colorbox/border.png index df13bb6daf7..bc04508aae3 100644 Binary files a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/stdlib/spec/unit/facter/coverage/assets/0.8.0/colorbox/border.png and b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/stdlib/spec/unit/facter/coverage/assets/0.8.0/colorbox/border.png differ diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/stdlib/spec/unit/facter/coverage/assets/0.8.0/colorbox/controls.png b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/stdlib/spec/unit/facter/coverage/assets/0.8.0/colorbox/controls.png index 65cfd1dc95c..57fe953b7e5 100644 Binary files a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/stdlib/spec/unit/facter/coverage/assets/0.8.0/colorbox/controls.png and b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/stdlib/spec/unit/facter/coverage/assets/0.8.0/colorbox/controls.png differ diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/stdlib/spec/unit/facter/coverage/assets/0.8.0/colorbox/loading_background.png b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/stdlib/spec/unit/facter/coverage/assets/0.8.0/colorbox/loading_background.png index 9de11f46719..2d8598bf8cb 100644 Binary files a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/stdlib/spec/unit/facter/coverage/assets/0.8.0/colorbox/loading_background.png and b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/stdlib/spec/unit/facter/coverage/assets/0.8.0/colorbox/loading_background.png differ diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/stdlib/spec/unit/facter/coverage/assets/0.8.0/favicon_green.png b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/stdlib/spec/unit/facter/coverage/assets/0.8.0/favicon_green.png index 74db330cd05..7cf67ed1993 100644 Binary files a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/stdlib/spec/unit/facter/coverage/assets/0.8.0/favicon_green.png and b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/stdlib/spec/unit/facter/coverage/assets/0.8.0/favicon_green.png differ diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/stdlib/spec/unit/facter/coverage/assets/0.8.0/favicon_red.png b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/stdlib/spec/unit/facter/coverage/assets/0.8.0/favicon_red.png index fbe093a5511..1460b78d120 100644 Binary files a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/stdlib/spec/unit/facter/coverage/assets/0.8.0/favicon_red.png and b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/stdlib/spec/unit/facter/coverage/assets/0.8.0/favicon_red.png differ diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/stdlib/spec/unit/facter/coverage/assets/0.8.0/favicon_yellow.png b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/stdlib/spec/unit/facter/coverage/assets/0.8.0/favicon_yellow.png index e53847ea09a..e7d18257f11 100644 Binary files a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/stdlib/spec/unit/facter/coverage/assets/0.8.0/favicon_yellow.png and b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/stdlib/spec/unit/facter/coverage/assets/0.8.0/favicon_yellow.png differ diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/stdlib/spec/unit/facter/coverage/assets/0.8.0/magnify.png b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/stdlib/spec/unit/facter/coverage/assets/0.8.0/magnify.png index 6073b9530ed..2a5079f4c4c 100644 Binary files a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/stdlib/spec/unit/facter/coverage/assets/0.8.0/magnify.png and b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/stdlib/spec/unit/facter/coverage/assets/0.8.0/magnify.png differ diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/stdlib/spec/unit/facter/coverage/assets/0.8.0/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/stdlib/spec/unit/facter/coverage/assets/0.8.0/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png index 5b5dab2ab7b..68aa3f48d06 100644 Binary files a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/stdlib/spec/unit/facter/coverage/assets/0.8.0/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png and b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/stdlib/spec/unit/facter/coverage/assets/0.8.0/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png differ diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/stdlib/spec/unit/facter/coverage/assets/0.8.0/smoothness/images/ui-bg_flat_75_ffffff_40x100.png b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/stdlib/spec/unit/facter/coverage/assets/0.8.0/smoothness/images/ui-bg_flat_75_ffffff_40x100.png index ac8b229af95..2b49a7ae745 100644 Binary files a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/stdlib/spec/unit/facter/coverage/assets/0.8.0/smoothness/images/ui-bg_flat_75_ffffff_40x100.png and b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/stdlib/spec/unit/facter/coverage/assets/0.8.0/smoothness/images/ui-bg_flat_75_ffffff_40x100.png differ diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/stdlib/spec/unit/facter/coverage/assets/0.8.0/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/stdlib/spec/unit/facter/coverage/assets/0.8.0/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png index ad3d6346e00..4b38ff2d7f6 100644 Binary files a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/stdlib/spec/unit/facter/coverage/assets/0.8.0/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png and b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/stdlib/spec/unit/facter/coverage/assets/0.8.0/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png differ diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/stdlib/spec/unit/facter/coverage/assets/0.8.0/smoothness/images/ui-bg_glass_65_ffffff_1x400.png b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/stdlib/spec/unit/facter/coverage/assets/0.8.0/smoothness/images/ui-bg_glass_65_ffffff_1x400.png index 42ccba269b6..5c0c93f1e9f 100644 Binary files a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/stdlib/spec/unit/facter/coverage/assets/0.8.0/smoothness/images/ui-bg_glass_65_ffffff_1x400.png and b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/stdlib/spec/unit/facter/coverage/assets/0.8.0/smoothness/images/ui-bg_glass_65_ffffff_1x400.png differ diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/stdlib/spec/unit/facter/coverage/assets/0.8.0/smoothness/images/ui-bg_glass_75_dadada_1x400.png b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/stdlib/spec/unit/facter/coverage/assets/0.8.0/smoothness/images/ui-bg_glass_75_dadada_1x400.png index 5a46b47cb16..43d3253fc7e 100644 Binary files a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/stdlib/spec/unit/facter/coverage/assets/0.8.0/smoothness/images/ui-bg_glass_75_dadada_1x400.png and b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/stdlib/spec/unit/facter/coverage/assets/0.8.0/smoothness/images/ui-bg_glass_75_dadada_1x400.png differ diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/stdlib/spec/unit/facter/coverage/assets/0.8.0/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/stdlib/spec/unit/facter/coverage/assets/0.8.0/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png index 86c2baa655e..8265061241d 100644 Binary files a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/stdlib/spec/unit/facter/coverage/assets/0.8.0/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png and b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/stdlib/spec/unit/facter/coverage/assets/0.8.0/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png differ diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/stdlib/spec/unit/facter/coverage/assets/0.8.0/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/stdlib/spec/unit/facter/coverage/assets/0.8.0/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png index 4443fdc1a15..c6270881b87 100644 Binary files a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/stdlib/spec/unit/facter/coverage/assets/0.8.0/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png and b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/stdlib/spec/unit/facter/coverage/assets/0.8.0/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png differ diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/stdlib/spec/unit/facter/coverage/assets/0.8.0/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/stdlib/spec/unit/facter/coverage/assets/0.8.0/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png index 7c9fa6c6edc..67e0eb9b4d1 100644 Binary files a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/stdlib/spec/unit/facter/coverage/assets/0.8.0/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png and b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/stdlib/spec/unit/facter/coverage/assets/0.8.0/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png differ diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/stdlib/spec/unit/facter/coverage/assets/0.8.0/smoothness/images/ui-icons_222222_256x240.png b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/stdlib/spec/unit/facter/coverage/assets/0.8.0/smoothness/images/ui-icons_222222_256x240.png index b273ff111d2..192e2b85257 100644 Binary files a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/stdlib/spec/unit/facter/coverage/assets/0.8.0/smoothness/images/ui-icons_222222_256x240.png and b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/stdlib/spec/unit/facter/coverage/assets/0.8.0/smoothness/images/ui-icons_222222_256x240.png differ diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/stdlib/spec/unit/facter/coverage/assets/0.8.0/smoothness/images/ui-icons_2e83ff_256x240.png b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/stdlib/spec/unit/facter/coverage/assets/0.8.0/smoothness/images/ui-icons_2e83ff_256x240.png index 09d1cdc856c..88442a01937 100644 Binary files a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/stdlib/spec/unit/facter/coverage/assets/0.8.0/smoothness/images/ui-icons_2e83ff_256x240.png and b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/stdlib/spec/unit/facter/coverage/assets/0.8.0/smoothness/images/ui-icons_2e83ff_256x240.png differ diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/stdlib/spec/unit/facter/coverage/assets/0.8.0/smoothness/images/ui-icons_454545_256x240.png b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/stdlib/spec/unit/facter/coverage/assets/0.8.0/smoothness/images/ui-icons_454545_256x240.png index 59bd45b907c..327cc6d4614 100644 Binary files a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/stdlib/spec/unit/facter/coverage/assets/0.8.0/smoothness/images/ui-icons_454545_256x240.png and b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/stdlib/spec/unit/facter/coverage/assets/0.8.0/smoothness/images/ui-icons_454545_256x240.png differ diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/stdlib/spec/unit/facter/coverage/assets/0.8.0/smoothness/images/ui-icons_888888_256x240.png b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/stdlib/spec/unit/facter/coverage/assets/0.8.0/smoothness/images/ui-icons_888888_256x240.png index 6d02426c114..c71c1446075 100644 Binary files a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/stdlib/spec/unit/facter/coverage/assets/0.8.0/smoothness/images/ui-icons_888888_256x240.png and b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/stdlib/spec/unit/facter/coverage/assets/0.8.0/smoothness/images/ui-icons_888888_256x240.png differ diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/stdlib/spec/unit/facter/coverage/assets/0.8.0/smoothness/images/ui-icons_cd0a0a_256x240.png b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/stdlib/spec/unit/facter/coverage/assets/0.8.0/smoothness/images/ui-icons_cd0a0a_256x240.png index 2ab019b73ec..30c8c0d35b8 100644 Binary files a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/stdlib/spec/unit/facter/coverage/assets/0.8.0/smoothness/images/ui-icons_cd0a0a_256x240.png and b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/stdlib/spec/unit/facter/coverage/assets/0.8.0/smoothness/images/ui-icons_cd0a0a_256x240.png differ diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/.fixtures.yml b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/.fixtures.yml index 15f96922e01..3f18ef2fca2 100644 --- a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/.fixtures.yml +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/.fixtures.yml @@ -1,6 +1,10 @@ fixtures: repositories: - stdlib: "git://github.com/puppetlabs/puppetlabs-stdlib" - concat: "git://github.com/puppetlabs/puppetlabs-concat" + 'stdlib': + repo: 'git://github.com/puppetlabs/puppetlabs-stdlib' + ref: '4.1.0' + 'concat': + repo: 'git://github.com/puppetlabs/puppetlabs-concat' + ref: '1.0.1' symlinks: supervisord: "#{source_dir}" \ No newline at end of file diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/.travis.yml b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/.travis.yml index 6e544518c19..bc96a165e59 100644 --- a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/.travis.yml +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/.travis.yml @@ -1,21 +1,28 @@ language: ruby bundler_args: --without development -script: "bundle exec rake spec lint" +script: "bundle exec rake test" rvm: - 1.8.7 - 1.9.3 - 2.0.0 env: - matrix: - - PUPPET_GEM_VERSION="~> 2.7.0" - - PUPPET_GEM_VERSION="~> 3.3.0" - - PUPPET_GEM_VERSION="~> 3.4.0" + - PUPPET_VERSION="~> 2.7.0" + - PUPPET_VERSION="~> 3.1.0" + - PUPPET_VERSION="~> 3.2.0" + - PUPPET_VERSION="~> 3.3.0" + - PUPPET_VERSION="~> 3.4.0" + - PUPPET_VERSION="~> 3.5.0" + - PUPPET_VERSION="~> 3.6.0" matrix: exclude: - - rvm: 1.9.3 - env: PUPPET_GEM_VERSION="~> 2.7.0" - rvm: 2.0.0 - env: PUPPET_GEM_VERSION="~> 2.7.0" + env: PUPPET_VERSION="~> 2.7.0" + - rvm: 1.9.3 + env: PUPPET_VERSION="~> 2.7.0" + - rvm: 2.0.0 + env: PUPPET_VERSION="~> 3.1.0" + - rvm: 1.8.7 + env: PUPPET_VERSION="~> 3.2.0" notifications: email: false diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/Changelog b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/Changelog index ab4faa445ff..ea933f5dbcb 100644 --- a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/Changelog +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/Changelog @@ -1,3 +1,72 @@ +2014-07-02 - v0.4.1 + +Fixes: + +- Fixed status code error on supervisord::supervisorctl commands, thanks to @jtreminio for the PR. + +2014-06-20 - v0.4.0 + +Fixes: + +- Removed root as group and replaced with uid 0 to enhance system +compatibility + +Enhancements: + +- Made package provider a user definable param see supervisord::package_provider and README for details of how to change this. +- All define types can now be automatically pulled in from hiera see example https://github.com/ajcrowe/puppet-supervisord#configure-a-program +- You can now override the default include path of $config_include/*.conf with your own array using $config_dirs. Bear in mind this would need to include whatever you set $config_include to be, with *.conf on the end. + +Many thanks for the PRs from @jasperla, @mvantellingen for the bug report on the service name and @hasc for the enhancement ideas. + +2014-06-06 - v0.3.3 + +Fixes: + +- Fixed typo in stopwaitsec param, should have been stopwaitsecs, thanks to @rchrd2 + +2014-05-03 - v0.3.2 + +Changes: + +- Added supervisord::executable_ctl variable for supervisorctl binary path, thanks to @bpgoldsb + +2014-04-22 - v0.3.1 + +Fixes: + +- Fixed typo in unix_socket_group param, thanks to @dig412 + +2014-03-11 - v0.3.0 + +Fixes: + +- Fixed typo in fcgi config +- Fixed typo in supervisord config with minfds and minprocs, thanks to @peefourtee +- Typo in README fixed thanks to @hopkinsth +- Removed refreshonly from pip_install exec resource +- Number of syntax fixes thanks to `puppet lint` + +Important Changes: + +- Lots of input validation has been added **PLEASE** check your config works before upgrading! +- Changed init_extras naming to defaults and cleaned things up. +- Starting and stopping apps is now done with supervisorctl commands to avoid service restarts + +Other Changes: + +- CSV functions now order things consistently +- Included description for classes and functions +- Expanded spec testing built with Travis CI +- Added beaker acceptance tests +- Added greater validation of various parameters +- Added coverage reporting for resources + +To-Do: + +- Add support for additional OS families such as Solaris. + + 2013-10-31 - v0.2.3 Fixes: diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/Gemfile b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/Gemfile index 8612255f5b8..ba9a19d533a 100644 --- a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/Gemfile +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/Gemfile @@ -1,14 +1,26 @@ source 'https://rubygems.org' -group :development, :test do +group :test do gem 'rake' - gem 'puppetlabs_spec_helper', :require => false - gem 'rspec-system-puppet', '~> 2.0' - gem 'puppet-lint', '~> 0.3.2' + gem 'puppet-lint' + gem 'puppet-syntax' + gem 'puppetlabs_spec_helper' + gem 'rspec-puppet', :git => 'https://github.com/rodjek/rspec-puppet.git' , :ref => 'c44381a240ec420d4ffda7bffc55ee4d9c08d682' + gem 'rspec', '2.14.1' end -if puppetversion = ENV['PUPPET_GEM_VERSION'] - gem 'puppet', puppetversion, :require => false -else - gem 'puppet', :require => false +group :development do + gem 'travis' + gem 'travis-lint' + gem 'beaker' + gem 'beaker-rspec' + gem 'pry' + gem 'guard-rake' +end + + +if puppetversion = ENV['PUPPET_VERSION'] + gem 'puppet', puppetversion +else + gem 'puppet', '~> 3.4.0' end diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/Modulefile b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/Modulefile index 4a0552115da..80d47f22679 100644 --- a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/Modulefile +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/Modulefile @@ -1,5 +1,5 @@ name 'ajcrowe-supervisord' -version '0.2.3' +version '0.4.1' source 'git@github.com/ajcrowe/puppet-supervisord.git' author 'Alex Crowe' license 'Apache License, Version 2.0' diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/README.md b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/README.md index a8419a09082..b454cd9307a 100644 --- a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/README.md +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/README.md @@ -4,7 +4,7 @@ Puppet module to manage the [supervisord](http://supervisord.org/) process control system. -Functions available to configure +Functions available to configure * [programs](http://supervisord.org/configuration.html#program-x-section-settings) * [groups](http://supervisord.org/configuration.html#group-x-section-settings) @@ -31,10 +31,16 @@ class supervisord { } ``` -This will download [setuptool](https://bitbucket.org/pypa/setuptools) and install pip with easy_install. +This will download [setuptool](https://bitbucket.org/pypa/setuptools) and install pip with easy_install. You can pass a specific url with `$setuptools_url = 'url'` +### Install without pip + +If you want to use your system package manager you can specify that with `supervisord::package_provider`. + +You'll also likely need to adjust the `supervisord::service_name` to match that installed by the system package. If you're using Debian or Redhat OS families you'll also want to disable the init scripts with `supervisord::install_init = false`. + Note: Only Debian and RedHat families have an init script currently. ### Configure a program @@ -61,23 +67,61 @@ supervisord::program { 'myprogram': } ``` +Or you can fully define your programs in hiera: + +```yaml +supervisord::programs: + 'myprogram': + command: 'command --args' + autostart: yes + autorestart: 'true' + environment: + HOME: '/home/myuser' + PATH: '/bin:/sbin:/usr/bin:/usr/sbin' + SECRET: 'mysecret' +``` + ### Configure a group ```ruby supervisord::group { 'mygroup': priority => 100, - program => ['program1', 'program2', 'program3'] + programs => ['program1', 'program2', 'program3'] } ``` +### Configure an eventlistener + +```ruby +supervisord::eventlistener { 'mylistener': + command => 'command --args', + events => ['PROCESS_STATE', 'PROCESS_STATE_START'] + priority => '100', + env_var => 'my_common_envs' +} +``` + +### Run supervisorctl Commands + +Should you need to run a sequence of command with `supervisorctl` you can use the define type `supervisord::supervisorctl` + +```ruby +supervisord::supervisorctl { 'restart_myapp': + command => 'restart', + process => 'myapp' +} +``` + +You can also issue a command without specifying a process. + ### Development If you have suggestions or improvements please file an issue or pull request, i'll try and sort them as quickly as possble. -If you submit a pull please try and include tests for the new functionality. The module is tested with [Travis-CI](https://travis-ci.org/ajcrowe/puppet-supervisord). +If you submit a pull please try and include tests for the new functionality/fix. The module is tested with [Travis-CI](https://travis-ci.org/ajcrowe/puppet-supervisord). ### Credits * Debian init script sourced from the system package. -* RedHat/Centos init script sourced from https://github.com/Supervisor/initscripts +* RedHat/Centos init script sourced from https://github.com/Supervisor/initscripts diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/Rakefile b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/Rakefile index e00f7d11877..cd592af48f4 100644 --- a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/Rakefile +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/Rakefile @@ -1,7 +1,28 @@ require 'puppetlabs_spec_helper/rake_tasks' require 'puppet-lint/tasks/puppet-lint' -require 'rspec-system/rake_task' +require 'puppet-syntax/tasks/puppet-syntax' PuppetLint.configuration.send('disable_80chars') PuppetLint.configuration.send('disable_class_inherits_from_params_class') -PuppetLint.configuration.send('disable_documentation') +PuppetLint.configuration.send('disable_quoted_booleans') +PuppetLint.configuration.send('disable_autoloader_layout') + +exclude_paths = [ + "pkg/**/*", + "vendor/**/*", + "spec/**/*", +] +PuppetLint.configuration.ignore_paths = exclude_paths +PuppetSyntax.exclude_paths = exclude_paths + +desc "Acceptance Tests" +RSpec::Core::RakeTask.new(:acceptance) do |t| + t.pattern = 'spec/acceptance' +end + +desc "Test Suite" +task :test => [ + :lint, + :syntax, + :spec +] \ No newline at end of file diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/lib/puppet/parser/functions/array2csv.rb b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/lib/puppet/parser/functions/array2csv.rb index cfa52b2bbf2..6d34d5d5474 100644 --- a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/lib/puppet/parser/functions/array2csv.rb +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/lib/puppet/parser/functions/array2csv.rb @@ -1,14 +1,12 @@ # # Converts the array to a csv string # -# # $array = [ 'string1', 'string2', 'string3' ] # # becomes: # # $string = "string1,string2,string3" # - module Puppet::Parser::Functions newfunction(:array2csv, :type => :rvalue, :doc => <<-'EOS' Returns a sorted csv formatted string from an array in the form diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/lib/puppet/parser/functions/hash2csv.rb b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/lib/puppet/parser/functions/hash2csv.rb index 6098b67367d..5371328f2ff 100644 --- a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/lib/puppet/parser/functions/hash2csv.rb +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/lib/puppet/parser/functions/hash2csv.rb @@ -1,7 +1,6 @@ # # Converts the hash to a csv string # -# # $hash = { # HOME => '/home/user', # ENV1 => 'env1', @@ -12,7 +11,6 @@ # # $string = "HOME='/home/user',ENV1='env1',SECRET='secret'" # - module Puppet::Parser::Functions newfunction(:hash2csv, :type => :rvalue, :doc => <<-'EOS' Returns a csv formatted string from an hash in the form diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/manifests/config.pp b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/manifests/config.pp index cc8b1ee49d0..93713729e8b 100644 --- a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/manifests/config.pp +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/manifests/config.pp @@ -1,6 +1,16 @@ +# Class: supervisord::config +# +# Configuration class for supervisor init and conf directories +# class supervisord::config inherits supervisord { - file { [ "${supervisord::config_include}", "${supervisord::log_path}"]: + file { $supervisord::config_include: + ensure => directory, + owner => 'root', + mode => '0755' + } + + file { $supervisord::log_path: ensure => directory, owner => 'root', mode => '0755' @@ -15,30 +25,26 @@ class supervisord::config inherits supervisord { } if $supervisord::install_init { - - $osname = downcase($::osfamily) - file { '/etc/init.d/supervisord': ensure => present, owner => 'root', mode => '0755', - content => template("supervisord/init/${osname}_init.erb") + content => template("supervisord/init/${::osfamily}/init.erb") } - if $supervisord::init_extras { - file { $supervisord::init_extras: + if $supervisord::init_defaults { + file { $supervisord::init_defaults: ensure => present, owner => 'root', mode => '0755', - content => template("supervisord/init/${osname}_extra.erb") + content => template("supervisord/init/${::osfamily}/defaults.erb") } } - } concat { $supervisord::config_file: owner => 'root', - group => 'root', + group => '0', mode => '0755' } diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/manifests/eventlistener.pp b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/manifests/eventlistener.pp index 41b7cf6c730..fd52d6e4da4 100644 --- a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/manifests/eventlistener.pp +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/manifests/eventlistener.pp @@ -1,8 +1,16 @@ +# Define: supervisord::eventlistener +# +# This define creates an eventlistener configuration file +# +# Documentation on parameters available at: +# http://supervisord.org/configuration.html#eventlistener-x-section-settings +# define supervisord::eventlistener( $command, $ensure = present, + $ensure_process = 'running', + $buffer_size = 10, $events = undef, - $buffer_size = undef, $result_handler = undef, $env_var = undef, $process_name = undef, @@ -15,16 +23,16 @@ define supervisord::eventlistener( $startretries = undef, $exitcodes = undef, $stopsignal = undef, - $stopwaitsec = undef, + $stopwaitsecs = undef, $stopasgroup = undef, $killasgroup = undef, $user = undef, $redirect_stderr = undef, - $stdout_logfile = "${supervisord::log_path}/eventlistener_${name}.log", + $stdout_logfile = "eventlistener_${name}.log", $stdout_logfile_maxbytes = undef, $stdout_logfile_backups = undef, $stdout_events_enabled = undef, - $stderr_logfile = "${supervisord::log_path}/eventlistener_${name}.error", + $stderr_logfile = "eventlistener_${name}.error", $stderr_logfile_maxbytes = undef, $stderr_logfile_backups = undef, $stderr_events_enabled = undef, @@ -36,11 +44,45 @@ define supervisord::eventlistener( include supervisord + # parameter validation + validate_string($command) + validate_re($ensure_process, ['running', 'stopped', 'removed']) + validate_re($buffer_size, '^\d+') + if $events { validate_array($events) } + if $result_handler { validate_string($result_handler) } + if $numprocs { validate_re($numprocs, '^\d+')} + if $numprocs_start { validate_re($numprocs_start, '^\d+')} + if $priority { validate_re($priority, '^\d+') } + if $autostart { validate_bool($autostart) } + if $autorestart { validate_re($autorestart, ['true', 'false', 'unexpected']) } + if $startsecs { validate_re($startsecs, '^\d+')} + if $startretries { validate_re($startretries, '^\d+')} + if $exitcodes { validate_string($exitcodes)} + if $stopsignal { validate_re($stopsignal, ['TERM', 'HUP', 'INT', 'QUIT', 'KILL', 'USR1', 'USR2']) } + if $stopwaitsecs { validate_re($stopwaitsecs, '^\d+')} + if $stopasgroup { validate_bool($stopasgroup) } + if $killasgroup { validate_bool($killasgroup) } + if $user { validate_string($user) } + if $redirect_stderr { validate_bool($redirect_stderr) } + validate_string($stdout_logfile) + if $stdout_logfile_maxbytes { validate_string($stdout_logfile_maxbytes) } + if $stdout_logfile_backups { validate_re($stdout_logfile_backups, '^\d+')} + if $stdout_events_enabled { validate_bool($stdout_events_enabled) } + validate_string($stderr_logfile) + if $stderr_logfile_maxbytes { validate_string($stderr_logfile_maxbytes) } + if $stderr_logfile_backups { validate_re($stderr_logfile_backups, '^\d+')} + if $stderr_events_enabled { validate_bool($stderr_events_enabled) } + if $directory { validate_absolute_path($directory) } + if $umask { validate_re($umask, '^[0-7][0-7][0-7]$') } + + # convert environment data into a csv if $env_var { - $env_hash = hiera($env_var) + $env_hash = hiera_hash($env_var) + validate_hash($env_hash) $env_string = hash2csv($env_hash) } elsif $environment { + validate_hash($environment) $env_string = hash2csv($environment) } @@ -55,6 +97,22 @@ define supervisord::eventlistener( owner => 'root', mode => '0755', content => template('supervisord/conf/eventlistener.erb'), - notify => Class['supervisord::service'] + notify => Class['supervisord::reload'] + } + + case $ensure_process { + 'stopped': { + supervisord::supervisorctl { "stop_${name}": + command => 'stop', + process => $name + } + } + 'removed': { + supervisord::supervisorctl { "remove_${name}": + command => 'remove', + process => $name + } + } + default: { } } } diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/manifests/fcgi_program.pp b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/manifests/fcgi_program.pp index 923b1798bff..633b024917e 100644 --- a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/manifests/fcgi_program.pp +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/manifests/fcgi_program.pp @@ -1,7 +1,15 @@ +# Define: supervisord::fcgi_program +# +# This define creates an eventlistener configuration file +# +# Documentation on parameters available at: +# http://supervisord.org/configuration.html#fcgi-program-x-section-settings +# define supervisord::fcgi_program( $command, $socket, $ensure = present, + $ensure_process = 'running', $socket_owner = undef, $socket_mode = undef, $env_var = undef, @@ -15,17 +23,17 @@ define supervisord::fcgi_program( $startretries = undef, $exitcodes = undef, $stopsignal = undef, - $stopwaitsec = undef, + $stopwaitsecs = undef, $stopasgroup = undef, $killasgroup = undef, $user = undef, $redirect_stderr = undef, - $stdout_logfile = "${supervisord::log_path}/fcgi-program_${name}.log", + $stdout_logfile = "fcgi-program_${name}.log", $stdout_logfile_maxbytes = undef, $stdout_logfile_backups = undef, $stdout_capture_maxbytes = undef, $stdout_events_enabled = undef, - $stderr_logfile = "${supervisord::log_path}/fcgi-program_${name}.error", + $stderr_logfile = "fcgi-program_${name}.error", $stderr_logfile_maxbytes = undef, $stderr_logfile_backups = undef, $stderr_capture_maxbytes = undef, @@ -38,11 +46,46 @@ define supervisord::fcgi_program( include supervisord + # parameter validation + validate_string($command) + validate_re($ensure_process, ['running', 'stopped', 'removed']) + validate_re($socket, ['^tcp:\/\/.*:\d+$', '^unix:\/\/\/']) + if $process_name { validate_string($process_name) } + if $numprocs { validate_re($numprocs, '^\d+')} + if $numprocs_start { validate_re($numprocs_start, '^\d+')} + if $priority { validate_re($priority, '^\d+') } + if $autostart { validate_bool($autostart) } + if $autorestart { validate_re($autorestart, ['true', 'false', 'unexpected']) } + if $startsecs { validate_re($startsecs, '^\d+')} + if $startretries { validate_re($startretries, '^\d+')} + if $exitcodes { validate_string($exitcodes)} + if $stopsignal { validate_re($stopsignal, ['TERM', 'HUP', 'INT', 'QUIT', 'KILL', 'USR1', 'USR2']) } + if $stopwaitsecs { validate_re($stopwaitsecs, '^\d+')} + if $stopasgroup { validate_bool($stopasgroup) } + if $killasgroup { validate_bool($killasgroup) } + if $user { validate_string($user) } + if $redirect_stderr { validate_bool($redirect_stderr) } + validate_string($stdout_logfile) + if $stdout_logfile_maxbytes { validate_string($stdout_logfile_maxbytes) } + if $stdout_logfile_backups { validate_re($stdout_logfile_backups, '^\d+')} + if $stdout_capture_maxbytes { validate_string($stdout_capture_maxbytes) } + if $stdout_events_enabled { validate_bool($stdout_events_enabled) } + validate_string($stderr_logfile) + if $stderr_logfile_maxbytes { validate_string($stderr_logfile_maxbytes) } + if $stderr_logfile_backups { validate_re($stderr_logfile_backups, '^\d+')} + if $stderr_capture_maxbytes { validate_string($stderr_capture_maxbytes) } + if $stderr_events_enabled { validate_bool($stderr_events_enabled) } + if $directory { validate_absolute_path($directory) } + if $umask { validate_re($umask, '^[0-7][0-7][0-7]$') } + + # convert environment data into a csv if $env_var { - $env_hash = hiera($env_var) + $env_hash = hiera_hash($env_var) + validate_hash($env_hash) $env_string = hash2csv($env_hash) } elsif $environment { + validate_hash($environment) $env_string = hash2csv($environment) } @@ -53,6 +96,22 @@ define supervisord::fcgi_program( owner => 'root', mode => '0755', content => template('supervisord/conf/fcgi_program.erb'), - notify => Class['supervisord::service'] + notify => Class['supervisord::reload'] + } + + case $ensure_process { + 'stopped': { + supervisord::supervisorctl { "stop_${name}": + command => 'stop', + process => $name + } + } + 'removed': { + supervisord::supervisorctl { "remove_${name}": + command => 'remove', + process => $name + } + } + default: { } } } diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/manifests/group.pp b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/manifests/group.pp index 0f6b1ca2adc..45cb29cf290 100644 --- a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/manifests/group.pp +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/manifests/group.pp @@ -1,3 +1,10 @@ +# Define: supervisord::group +# +# This define creates an group configuration file +# +# Documentation on parameters available at: +# http://supervisord.org/configuration.html#group-x-section-settings +# define supervisord::group ( $programs, $ensure = present, @@ -6,6 +13,10 @@ define supervisord::group ( include supervisord + # parameter validation + validate_array($programs) + if $priority { validate_re($priority, '^\d+', "invalid priority value of: ${priority}") } + $progstring = array2csv($programs) $conf = "${supervisord::config_include}/group_${name}.conf" @@ -13,6 +24,7 @@ define supervisord::group ( ensure => $ensure, owner => 'root', mode => '0755', - content => template('supervisord/conf/group.erb') + content => template('supervisord/conf/group.erb'), + notify => Class['supervisord::reload'] } } diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/manifests/init.pp b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/manifests/init.pp index 801c46b3b36..fa396da578d 100644 --- a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/manifests/init.pp +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/manifests/init.pp @@ -1,12 +1,20 @@ -# This class installs supervisord and configured it to run on boot +# Class: supervisord +# +# This class installs supervisord via pip +# class supervisord( $package_ensure = $supervisord::params::package_ensure, + $package_name = $supervisord::params::package_name, + $package_provider = $supervisord::params::package_provider, $service_ensure = $supervisord::params::service_ensure, + $service_name = $supervisord::params::service_name, $install_init = $supervisord::params::install_init, $install_pip = false, - $init_extras = $supervisord::params::init_extras, + $init_defaults = $supervisord::params::init_defaults, $setuptools_url = $supervisord::params::setuptools_url, + $executable_path = $supervisord::params::executable_path, $executable = $supervisord::params::executable, + $executable_ctl = $supervisord::params::executable_ctl, $log_path = $supervisord::params::log_path, $log_file = $supervisord::params::log_file, @@ -19,20 +27,20 @@ class supervisord( $nodaemon = $supervisord::params::nodaemon, $minfds = $supervisord::params::minfds, $minprocs = $supervisord::params::minprocs, - $config_path = $supervisord::params::config_path, $config_include = $supervisord::params::config_include, $config_file = $supervisord::params::config_file, + $config_dirs = undef, $umask = $supervisord::params::umask, $unix_socket = $supervisord::params::unix_socket, $unix_socket_file = $supervisord::params::unix_socket_file, $unix_socket_mode = $supervisord::params::unix_socket_mode, $unix_socket_owner = $supervisord::params::unix_socket_owner, - $unix_scoket_group = $supervisord::params::unix_socket_group, + $unix_socket_group = $supervisord::params::unix_socket_group, $inet_server = $supervisord::params::inet_server, - $inet_server_hostname = $supervisord::params::inet_hostname, - $inet_server_port = $supervisord::params::inet_port, + $inet_server_hostname = $supervisord::params::inet_server_hostname, + $inet_server_port = $supervisord::params::inet_server_port, $unix_auth = false, $unix_username = undef, @@ -47,26 +55,76 @@ class supervisord( $childlogdir = undef, $environment = undef, $env_var = undef, + $directory = undef, $strip_ansi = false, - $nocleanup = false + $nocleanup = false, + + $eventlisteners = {}, + $fcgi_programs = {}, + $groups = {}, + $programs = {} ) inherits supervisord::params { + validate_bool($install_pip) + validate_bool($install_init) + validate_bool($nodaemon) + validate_bool($unix_auth) + validate_bool($inet_auth) + validate_bool($strip_ansi) + validate_bool($nocleanup) + + validate_hash($eventlisteners) + validate_hash($fcgi_programs) + validate_hash($groups) + validate_hash($programs) + + validate_absolute_path($config_include) + validate_absolute_path($log_path) + validate_absolute_path($run_path) + if $childlogdir { validate_absolute_path($childlogdir) } + if $directory { validate_absolute_path($directory) } + + $log_levels = ['^critical$', '^error$', '^warn$', '^info$', '^debug$', '^trace$', '^blather$'] + validate_re($log_level, $log_levels, "invalid log_level: ${log_level}") + validate_re($umask, '^0[0-7][0-7]$', "invalid umask: ${umask}.") + validate_re($unix_socket_mode, '^[0-7][0-7][0-7][0-7]$', "invalid unix_socket_mode: ${unix_socket_mode}") + + if ! is_integer($logfile_backups) { fail("invalid logfile_backups: ${logfile_backups}.")} + if ! is_integer($minfds) { fail("invalid minfds: ${minfds}.")} + if ! is_integer($minprocs) { fail("invalid minprocs: ${minprocs}.")} + if ! is_integer($inet_server_port) { fail("invalid inet_server_port: ${inet_server_port}.")} + if $env_var { + validate_hash($env_var) $env_hash = hiera($env_var) $env_string = hash2csv($env_hash) } elsif $environment { + validate_hash($environment) $env_string = hash2csv($environment) } + if $config_dirs { + validate_array($config_dirs) + $config_include_string = join($config_dirs, " ") + } + else { + $config_include_string = "${config_include}/*.conf" + } + + create_resources('supervisord::eventlistener', $eventlisteners) + create_resources('supervisord::fcgi_program', $fcgi_programs) + create_resources('supervisord::group', $groups) + create_resources('supervisord::program', $programs) + if $install_pip { include supervisord::pip Class['supervisord::pip'] -> Class['supervisord::install'] } - include supervisord::install, supervisord::config, supervisord::service + include supervisord::install, supervisord::config, supervisord::service, supervisord::reload Class['supervisord::install'] -> Class['supervisord::config'] ~> Class['supervisord::service'] - + Class['supervisord::reload'] -> Supervisord::Supervisorctl <| |> } diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/manifests/install.pp b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/manifests/install.pp index 1d36ec68334..387c77f5cba 100644 --- a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/manifests/install.pp +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/manifests/install.pp @@ -1,6 +1,10 @@ +# Class supervisord::install +# +# Installs supervisor package (defaults to using pip) +# class supervisord::install inherits supervisord { - package { 'supervisor': + package { $supervisord::package_name: ensure => $supervisord::package_ensure, - provider => 'pip' + provider => $supervisord::package_provider } } diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/manifests/params.pp b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/manifests/params.pp index 87d17d16179..47a21852e01 100644 --- a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/manifests/params.pp +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/manifests/params.pp @@ -1,13 +1,42 @@ +# Class: supervisord::params +# +# Default parameters for supervisord +# class supervisord::params { + case $::osfamily { + 'RedHat': { + $init_defaults = '/etc/sysconfig/supervisord' + $unix_socket_group = 'nobody' + $install_init = true + $executable_path = '/usr/bin' + } + 'Debian': { + $init_defaults = '/etc/default/supervisor' + $unix_socket_group = 'nogroup' + $install_init = true + $executable_path = '/usr/local/bin' + } + default: { + $init_defaults = false + $unix_socket_group = 'nogroup' + $install_init = false + $executable_path = '/usr/local/bin' + } + } + + # default supervisord params $package_ensure = 'installed' + $package_provider = 'pip' $service_ensure = 'running' + $service_name = 'supervisord' $package_name = 'supervisor' - $executable = '/usr/local/bin/supervisord' + $executable = "${$executable_path}/supervisord" + $executable_ctl = "${executable_path}/supervisorctl" $run_path = '/var/run' - $pid_file = "${run_path}/supervisord.pid" + $pid_file = 'supervisord.pid' $log_path = '/var/log/supervisor' - $log_file = "${log_path}/supervisord.log" + $log_file = 'supervisord.log' $logfile_maxbytes = '50MB' $logfile_backups = '10' $log_level = 'info' @@ -20,7 +49,7 @@ class supervisord::params { $setuptools_url = 'https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py' $unix_socket = true - $unix_socket_file = "${run_path}/supervisor.sock" + $unix_socket_file = 'supervisor.sock' $unix_socket_mode = '0700' $unix_socket_owner = 'nobody' @@ -28,22 +57,4 @@ class supervisord::params { $inet_server_hostname = '127.0.0.1' $inet_server_port = '9001' $inet_auth = false - - case $::osfamily { - 'RedHat': { - $init_extras = '/etc/sysconfig/supervisord' - $unix_socket_group = 'nobody' - $install_init = true - } - 'Debian': { - $init_extras = '/etc/default/supervisor' - $unix_socket_group = 'nogroup' - $install_init = true - } - default: { - $init_extras = false - $unix_socket_group = 'nogroup' - $install_init = false - } - } } diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/manifests/pip.pp b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/manifests/pip.pp index c05f2d7f64b..dcf57223498 100644 --- a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/manifests/pip.pp +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/manifests/pip.pp @@ -1,3 +1,7 @@ +# Class: supervisord::pip +# +# Optional class to install setuptool and pip +# class supervisord::pip inherits supervisord { Exec { diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/manifests/program.pp b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/manifests/program.pp index 8a00d41c77c..617a68ab208 100644 --- a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/manifests/program.pp +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/manifests/program.pp @@ -1,6 +1,14 @@ +# Define: supervisord::program +# +# This define creates an program configuration file +# +# Documentation on parameters available at: +# http://supervisord.org/configuration.html#program-x-section-settings +# define supervisord::program( $command, $ensure = present, + $ensure_process = 'running', $env_var = undef, $process_name = undef, $numprocs = undef, @@ -12,17 +20,17 @@ define supervisord::program( $startretries = undef, $exitcodes = undef, $stopsignal = undef, - $stopwaitsec = undef, + $stopwaitsecs = undef, $stopasgroup = undef, $killasgroup = undef, $user = undef, $redirect_stderr = undef, - $stdout_logfile = "${supervisord::log_path}/program_${name}.log", + $stdout_logfile = "program_${name}.log", $stdout_logfile_maxbytes = undef, $stdout_logfile_backups = undef, $stdout_capture_maxbytes = undef, $stdout_events_enabled = undef, - $stderr_logfile = "${supervisord::log_path}/program_${name}.error", + $stderr_logfile = "program_${name}.error", $stderr_logfile_maxbytes = undef, $stderr_logfile_backups = undef, $stderr_capture_maxbytes = undef, @@ -35,11 +43,45 @@ define supervisord::program( include supervisord + # parameter validation + validate_string($command) + validate_re($ensure_process, ['running', 'stopped', 'removed']) + if $process_name { validate_string($process_name) } + if $numprocs { validate_re($numprocs, '^\d+')} + if $numprocs_start { validate_re($numprocs_start, '^\d+')} + if $priority { validate_re($priority, '^\d+') } + if $autostart { validate_bool($autostart) } + if $autorestart { validate_re($autorestart, ['true', 'false', 'unexpected']) } + if $startsecs { validate_re($startsecs, '^\d+')} + if $startretries { validate_re($startretries, '^\d+')} + if $exitcodes { validate_string($exitcodes)} + if $stopsignal { validate_re($stopsignal, ['TERM', 'HUP', 'INT', 'QUIT', 'KILL', 'USR1', 'USR2']) } + if $stopwaitsecs { validate_re($stopwaitsecs, '^\d+')} + if $stopasgroup { validate_bool($stopasgroup) } + if $killasgroup { validate_bool($killasgroup) } + if $user { validate_string($user) } + if $redirect_stderr { validate_bool($redirect_stderr) } + validate_string($stdout_logfile) + if $stdout_logfile_maxbytes { validate_string($stdout_logfile_maxbytes) } + if $stdout_logfile_backups { validate_re($stdout_logfile_backups, '^\d+')} + if $stdout_capture_maxbytes { validate_string($stdout_capture_maxbytes) } + if $stdout_events_enabled { validate_bool($stdout_events_enabled) } + validate_string($stderr_logfile) + if $stderr_logfile_maxbytes { validate_string($stderr_logfile_maxbytes) } + if $stderr_logfile_backups { validate_re($stderr_logfile_backups, '^\d+')} + if $stderr_capture_maxbytes { validate_string($stderr_capture_maxbytes) } + if $stderr_events_enabled { validate_bool($stderr_events_enabled) } + if $directory { validate_absolute_path($directory) } + if $umask { validate_re($umask, '^[0-7][0-7][0-7]$') } + + # convert environment data into a csv if $env_var { - $env_hash = hiera($env_var) + $env_hash = hiera_hash($env_var) + validate_hash($env_hash) $env_string = hash2csv($env_hash) } elsif $environment { + validate_hash($environment) $env_string = hash2csv($environment) } @@ -50,6 +92,22 @@ define supervisord::program( owner => 'root', mode => '0755', content => template('supervisord/conf/program.erb'), - notify => Class['supervisord::service'] + notify => Class['supervisord::reload'] + } + + case $ensure_process { + 'stopped': { + supervisord::supervisorctl { "stop_${name}": + command => 'stop', + process => $name + } + } + 'removed': { + supervisord::supervisorctl { "remove_${name}": + command => 'remove', + process => $name + } + } + default: { } } } diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/manifests/reload.pp b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/manifests/reload.pp new file mode 100644 index 00000000000..79eca3d7e0f --- /dev/null +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/manifests/reload.pp @@ -0,0 +1,19 @@ +# Class: supervisord::reload +# +# Class to reread and update supervisord with supervisorctl +# +class supervisord::reload inherits supervisord { + + $supervisorctl = $::supervisord::executable_ctl + + exec { 'supervisorctl_reread': + command => "${supervisorctl} reread", + refreshonly => true, + require => Service[$supervisord::service_name], + } + exec { 'supervisorctl_update': + command => "${supervisorctl} update", + refreshonly => true, + require => Service[$supervisord::service_name], + } +} diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/manifests/service.pp b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/manifests/service.pp index 6e17976165d..f02a0d0a081 100644 --- a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/manifests/service.pp +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/manifests/service.pp @@ -1,5 +1,9 @@ +# Class: supervisord::service +# +# Class for the supervisord service +# class supervisord::service inherits supervisord { - service { 'supervisord': + service { $supervisord::service_name: ensure => $supervisord::service_ensure, enable => true, hasrestart => true, diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/manifests/supervisorctl.pp b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/manifests/supervisorctl.pp new file mode 100644 index 00000000000..473d301185b --- /dev/null +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/manifests/supervisorctl.pp @@ -0,0 +1,27 @@ +# Define: supervisord:supervisorctl +# +# This define executes command with the supervisorctl tool +# +define supervisord::supervisorctl( + $command, + $process = undef, + $refreshonly = false +) { + + validate_string($command) + validate_string($process) + + $supervisorctl = $::supervisord::executable_ctl + + if $process { + $cmd = join([$supervisorctl, $command, $process], ' ') + } + else { + $cmd = join([$supervisorctl, $command]) + } + + exec { "supervisorctl_command_${name}": + command => $cmd, + refreshonly => $refreshonly + } +} \ No newline at end of file diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/spec/acceptance/nodesets/centos-65-i386.yml b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/spec/acceptance/nodesets/centos-65-i386.yml new file mode 100644 index 00000000000..f8d4013a31b --- /dev/null +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/spec/acceptance/nodesets/centos-65-i386.yml @@ -0,0 +1,10 @@ +HOSTS: + centos-65-i386: + roles: + - master + platform: el-6-i386 + box : centos-65-i386-virtualbox-nocm + box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-65-i386-virtualbox-nocm.box + hypervisor : vagrant +CONFIG: + type: foss diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/spec/acceptance/nodesets/centos-65-x64.yml b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/spec/acceptance/nodesets/centos-65-x64.yml new file mode 100644 index 00000000000..7535c104afb --- /dev/null +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/spec/acceptance/nodesets/centos-65-x64.yml @@ -0,0 +1,10 @@ +HOSTS: + centos-65-x64: + roles: + - master + platform: el-6-x86_64 + box : centos-65-x64-virtualbox-nocm + box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-65-x64-virtualbox-nocm.box + hypervisor : vagrant +CONFIG: + type: foss diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/spec/acceptance/nodesets/debian-73-i386.yml b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/spec/acceptance/nodesets/debian-73-i386.yml new file mode 100644 index 00000000000..d1233aa83d1 --- /dev/null +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/spec/acceptance/nodesets/debian-73-i386.yml @@ -0,0 +1,10 @@ +HOSTS: + debian-73-i386: + roles: + - master + platform: debian-7-i386 + box : debian-73-i386-virtualbox-nocm + box_url : http://puppet-vagrant-boxes.puppetlabs.com/debian-73-i386-virtualbox-nocm.box + hypervisor : vagrant +CONFIG: + type: foss diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/spec/acceptance/nodesets/debian-73-x64.yml b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/spec/acceptance/nodesets/debian-73-x64.yml new file mode 100644 index 00000000000..5b87870a909 --- /dev/null +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/spec/acceptance/nodesets/debian-73-x64.yml @@ -0,0 +1,10 @@ +HOSTS: + debian-73-x64: + roles: + - master + platform: debian-7-amd64 + box : debian-73-x64-virtualbox-nocm + box_url : http://puppet-vagrant-boxes.puppetlabs.com/debian-73-x64-virtualbox-nocm.box + hypervisor : vagrant +CONFIG: + type: foss diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/spec/acceptance/nodesets/default.yml b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/spec/acceptance/nodesets/default.yml new file mode 100644 index 00000000000..5b87870a909 --- /dev/null +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/spec/acceptance/nodesets/default.yml @@ -0,0 +1,10 @@ +HOSTS: + debian-73-x64: + roles: + - master + platform: debian-7-amd64 + box : debian-73-x64-virtualbox-nocm + box_url : http://puppet-vagrant-boxes.puppetlabs.com/debian-73-x64-virtualbox-nocm.box + hypervisor : vagrant +CONFIG: + type: foss diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/spec/acceptance/supervisord_spec.rb b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/spec/acceptance/supervisord_spec.rb new file mode 100644 index 00000000000..47d052a4eec --- /dev/null +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/spec/acceptance/supervisord_spec.rb @@ -0,0 +1,114 @@ +require 'spec_helper_acceptance' + +describe 'supervisord install' do + + context 'default parameters with pip and init install' do + it 'should work with no errors' do + pp = <<-EOS + class { 'supervisord': install_pip => true, install_init => true} + EOS + + expect(apply_manifest(pp).exit_code).to_not eq(1) + expect(apply_manifest(pp).exit_code).to eq(0) + end + + describe service('supervisord') do + it { should be_enabled } + it { should be_running } + it 'should restart successfully' do + cmd="service supervisord restart" + expect(shell(cmd).exit_code).to_not eq(1) + end + end + end +end + +describe 'supervisord::program' do + context 'create a program config' do + it 'should install a program file' do + + pp = <<-EOS + include supervisord + supervisord::program { 'test': + command => 'echo', + priority => '100', + environment => { + 'HOME' => '/root', + 'PATH' => '/bin', + } + } + EOS + + expect(apply_manifest(pp).exit_code).to_not eq(1) + expect(apply_manifest(pp).exit_code).to eq(0) + end + + it 'should contain the correct values' do + cmd='grep command=echo /etc/supervisor.d/program_test.conf' + expect(shell(cmd).exit_code).to eq(0) + cmd='grep priority=100 /etc/supervisor.d/program_test.conf' + expect(shell(cmd).exit_code).to eq(0) + cmd='grep "environment=" /etc/supervisor.d/program_test.conf' + expect(shell(cmd).exit_code).to eq(0) + end + end +end + +describe 'supervisord::fcgi-program' do + context 'create fcgi-program config' do + it 'should install a fcgi-program file' do + + pp = <<-EOS + include supervisord + supervisord::fcgi_program { 'test': + socket => 'tcp://localhost:1000', + command => 'echo', + priority => '100', + environment => { + 'HOME' => '/root', + 'PATH' => '/bin', + } + } + EOS + + expect(apply_manifest(pp).exit_code).to_not eq(1) + expect(apply_manifest(pp).exit_code).to eq(0) + end + + it 'should contain the correct values' do + cmd='grep socket=tcp://localhost:1000 /etc/supervisor.d/fcgi-program_test.conf' + expect(shell(cmd).exit_code).to eq(0) + cmd="grep command=echo /etc/supervisor.d/fcgi-program_test.conf" + expect(shell(cmd).exit_code).to eq(0) + cmd="grep priority=100 /etc/supervisor.d/fcgi-program_test.conf" + expect(shell(cmd).exit_code).to eq(0) + cmd='grep "environment=" /etc/supervisor.d/fcgi-program_test.conf' + expect(shell(cmd).exit_code).to eq(0) + end + end +end + +describe 'supervisord::group' do + context 'create group config' do + it 'should install a group config' do + + pp = <<-EOS + include supervisord + supervisord::group { 'test': + programs => ['test'], + priority => '100', + } + EOS + + expect(apply_manifest(pp).exit_code).to_not eq(1) + expect(apply_manifest(pp).exit_code).to eq(0) + end + + it 'should contain the correct values' do + cmd='grep "programs=test" /etc/supervisor.d/group_test.conf' + expect(shell(cmd).exit_code).to eq(0) + cmd="grep priority=100 /etc/supervisor.d/group_test.conf" + expect(shell(cmd).exit_code).to eq(0) + end + end +end diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/spec/classes/supervisord_spec.rb b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/spec/classes/supervisord_spec.rb index 238876c7dcd..b845920f6fe 100644 --- a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/spec/classes/supervisord_spec.rb +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/spec/classes/supervisord_spec.rb @@ -3,14 +3,26 @@ require 'spec_helper' describe 'supervisord' do concatdir = '/var/lib/puppet/concat' - configfile = '/etc/supervisord.conf' let(:facts) {{ :concat_basedir => concatdir }} it { should contain_class('supervisord') } it { should contain_class('supervisord::install') } it { should contain_class('supervisord::config') } it { should contain_class('supervisord::service') } - it { should contain_concat__fragment('supervisord_main').with_content(/logfile/) } + it { should contain_class('supervisord::params') } + it { should contain_class('supervisord::reload') } + it { should contain_package('supervisor') } + + describe '#service_name' do + context 'default' do + it { should contain_service('supervisord') } + end + + context 'specified' do + let(:params) {{ :service_name => 'myservicename' }} + it { should contain_service('myservicename') } + end + end describe '#install_pip' do context 'default' do @@ -18,8 +30,16 @@ describe 'supervisord' do end context 'true' do - let (:params) {{ :install_pip => true }} + let(:params) {{ :install_pip => true }} it { should contain_class('supervisord::pip') } + it { should contain_exec('install_setuptools') } + it { should contain_exec('install_pip') } + end + + context 'true and RedHat' do + let(:params) {{ :install_pip => true }} + let(:facts) {{ :osfamily => 'RedHat', :concat_basedir => concatdir }} + it { should contain_exec('pip_provider_name_fix') } end end @@ -28,11 +48,6 @@ describe 'supervisord' do it { should contain_class('supervisord').without_env_hash } it { should contain_class('supervisord').without_env_string } end - #context 'is specified' do - # let(:params) {{ :env_var => 'foovars' }} - # let(:hiera_data) {{ :foovars => { 'key1' => 'value1', 'key2' => 'value2' } }} - # it { should contain_concat__fragment('supervisord_main').with_content(/environment=key1='value1',key2='value2'/) } - #end end describe '#environment' do @@ -41,7 +56,8 @@ describe 'supervisord' do end context 'is specified' do let(:params) {{ :environment => { 'key1' => 'value1', 'key2' => 'value2' } }} - it { should contain_concat__fragment('supervisord_main').with_content(/environment=key1='value1',key2='value2'/) } + it { should contain_concat__fragment('supervisord_main')\ + .with_content(/environment=key1='value1',key2='value2'/) } end end @@ -54,17 +70,20 @@ describe 'supervisord' do it { should_not contain_file('/etc/init.d/supervisord') } end - describe 'on supported OS' + describe 'on supported OS' do context 'with Debian' do let(:facts) {{ :osfamily => 'Debian', :concat_basedir => concatdir }} it { should contain_file('/etc/init.d/supervisord') } + it { should contain_file('/etc/default/supervisor') } end context 'with RedHat' do let(:facts) {{ :osfamily => 'RedHat', :concat_basedir => concatdir }} it { should contain_file('/etc/init.d/supervisord') } + it { should contain_file('/etc/sysconfig/supervisord') } end end + end describe '#unix_socket' do context 'default' do @@ -89,10 +108,192 @@ describe 'supervisord' do describe '#run_path' do context 'default' do it { should_not contain_file('/var/run') } + it { should contain_concat__fragment('supervisord_main') \ + .with_content(/pidfile=\/var\/run\/supervisord.pid$/) } end - context 'custom setting' do - let(:params) {{ :run_path => '/var/run/supervisord'}} - it { should contain_file('/var/run/supervisord') } + context 'is specified' do + let(:params) {{ :run_path => '/opt/supervisord/run' }} + it { should contain_file('/opt/supervisord/run') } + it { should contain_concat__fragment('supervisord_main') \ + .with_content(/pidfile=\/opt\/supervisord\/run\/supervisord.pid$/) } + end + end + + describe '#log_path' do + context 'default' do + it { should contain_file('/var/log/supervisor') } + it { should contain_concat__fragment('supervisord_main') \ + .with_content(/logfile=\/var\/log\/supervisor\/supervisord.log$/) } + end + context 'is specified' do + let(:params) {{ :log_path => '/opt/supervisord/logs' }} + it { should contain_file('/opt/supervisord/logs')} + it { should contain_concat__fragment('supervisord_main') \ + .with_content(/logfile=\/opt\/supervisord\/logs\/supervisord.log$/) } + end + end + + describe '#config_include' do + context 'default' do + it { should contain_file('/etc/supervisor.d') } + it { should contain_concat__fragment('supervisord_main') \ + .with_content(/files=\/etc\/supervisor.d\/\*.conf$/) } + end + context 'is specified' do + let(:params) {{ :config_include => '/opt/supervisord/conf.d' }} + it { should contain_file('/opt/supervisord/conf.d') } + it { should contain_concat__fragment('supervisord_main') \ + .with_content(/files=\/opt\/supervisord\/conf.d\/\*.conf$/) } + end + end + + describe '#config_dirs' do + context 'is specified' do + let(:params) {{ :config_dirs => ['/etc/supervisor.d/*.conf', '/opt/supervisor.d/*', '/usr/share/supervisor.d/*.config'] }} + it { should contain_concat__fragment('supervisord_main') \ + .with_content(/files=\/etc\/supervisor.d\/\*.conf \/opt\/supervisor.d\/\* \/usr\/share\/supervisor.d\/\*.config$/) } + end + end + + describe '#config_file' do + context 'default' do + it { should contain_file('/etc/supervisord.conf') } + end + context 'is specified' do + let(:params) {{ :config_file => '/opt/supervisord/supervisor.conf' }} + it { should contain_file('/opt/supervisord/supervisor.conf') } + end + end + + describe '#nodaemon' do + context 'default' do + it { should contain_concat__fragment('supervisord_main') \ + .with_content(/nodaemon=false$/) } + end + context 'true' do + let(:params) {{ :nodaemon => true }} + it { should contain_concat__fragment('supervisord_main') \ + .with_content(/nodaemon=true$/) } + end + context 'invalid' do + let(:params) {{ :nodaemon => 'invalid' }} + it { expect { raise_error(Puppet::Error, /is not a boolean/) }} + end + end + + describe '#minfds' do + context 'default' do + it { should contain_concat__fragment('supervisord_main') \ + .with_content(/minfds=1024$/) } + end + context 'specified' do + let(:params) {{ :minfds => 2048 }} + it { should contain_concat__fragment('supervisord_main') \ + .with_content(/minfds=2048$/) } + end + context 'invalid' do + let(:params) {{ :minfds => 'string' }} + it { expect { raise_error(Puppet::Error, /invalid minfds/) }} + end + end + + describe '#minprocs' do + context 'default' do + it { should contain_concat__fragment('supervisord_main') \ + .with_content(/minprocs=200$/) } + end + context 'specified' do + let(:params) {{ :minprocs => 300 }} + it { should contain_concat__fragment('supervisord_main') \ + .with_content(/minprocs=300$/) } + end + context 'invalid' do + let(:params) {{ :minfds => 'string' }} + it { expect { raise_error(Puppet::Error, /invalid minprocs/) }} + end + end + + describe '#strip_ansi' do + context 'default' do + it { should_not contain_concat__fragment('supervisord_main') \ + .with_content(/strip_ansi$/) } + end + context 'true' do + let(:params) {{ :strip_ansi => true }} + it { should contain_concat__fragment('supervisord_main') \ + .with_content(/strip_ansi=true$/) } + end + context 'invalid' do + let(:params) {{ :strip_ansi => 'string' }} + it { expect { raise_error(Puppet::Error, /is not a boolean/) }} + end + end + + describe '#user' do + context 'default' do + it { should_not contain_concat__fragment('supervisord_main') \ + .with_content(/user$/) } + end + context 'specified' do + let(:params) {{ :user => 'myuser' }} + it { should contain_concat__fragment('supervisord_main') \ + .with_content(/user=myuser$/) } + end + end + + describe '#identifier' do + context 'default' do + it { should_not contain_concat__fragment('supervisord_main') \ + .with_content(/identifier$/) } + end + context 'specified' do + let(:params) {{ :identifier => 'myidentifier' }} + it { should contain_concat__fragment('supervisord_main') \ + .with_content(/identifier=myidentifier$/) } + end + end + + describe '#directory' do + context 'default' do + it { should_not contain_concat__fragment('supervisord_main') \ + .with_content(/directory$/) } + end + context 'specified' do + let(:params) {{ :directory => '/opt/supervisord' }} + it { should contain_concat__fragment('supervisord_main') \ + .with_content(/directory=\/opt\/supervisord$/) } + end + end + + describe '#nocleanup' do + context 'default' do + it { should_not contain_concat__fragment('supervisord_main') \ + .with_content(/nocleanup$/) } + end + context 'true' do + let(:params) {{ :nocleanup => true }} + it { should contain_concat__fragment('supervisord_main') \ + .with_content(/nocleanup=true$/) } + end + context 'invalid' do + let(:params) {{ :nocleanup => 'string' }} + it { expect { raise_error(Puppet::Error, /is not a boolean/) }} + end + end + + describe '#childlogdir' do + context 'default' do + it { should_not contain_concat__fragment('supervisord_main') \ + .with_content(/childlogdir$/) } + end + context 'specified' do + let(:params) {{ :childlogdir => '/opt/supervisord/logdir' }} + it { should contain_concat__fragment('supervisord_main') \ + .with_content(/childlogdir=\/opt\/supervisord\/logdir$/) } + end + context 'invalid' do + let(:params) {{ :childlogdir => 'not_a_path' }} + it { expect { raise_error(Puppet::Error, /is not an absolute path/) }} end end end \ No newline at end of file diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/spec/defines/eventlistener_spec.rb b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/spec/defines/eventlistener_spec.rb index 6e04f44f97b..1083b8a3230 100644 --- a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/spec/defines/eventlistener_spec.rb +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/spec/defines/eventlistener_spec.rb @@ -2,14 +2,85 @@ require 'spec_helper' describe 'supervisord::eventlistener', :type => :define do let(:title) {'foo'} - let(:default_params) {{ :command => 'bar', - :stdout_logfile => '/var/log/supervisor/eventlistener_foo.log', - :stderr_logfile => '/var/log/supervisor/eventlistener_foo.error', - }} - let(:params) { default_params } let(:facts) {{ :concat_basedir => '/var/lib/puppet/concat' }} + let(:default_params) do + { + :command => 'bar', + :process_name => '%(process_num)s', + :events => ['PROCESS_STATE', 'PROCESS_STATE_STARTING'], + :buffer_size => 10, + :numprocs => '1', + :numprocs_start => '0', + :priority => '999', + :autostart => true, + :autorestart => 'unexpected', + :startsecs => '1', + :startretries => '3', + :exitcodes => '0,2', + :stopsignal => 'TERM', + :stopwaitsecs => '10', + :stopasgroup => true, + :killasgroup => true, + :user => 'baz', + :redirect_stderr => true, + :stdout_logfile => 'eventlistener_foo.log', + :stdout_logfile_maxbytes => '50MB', + :stdout_logfile_backups => '10', + :stdout_events_enabled => true, + :stderr_logfile => 'eventlistener_foo.error', + :stderr_logfile_maxbytes => '50MB', + :stderr_logfile_backups => '10', + :stderr_events_enabled => true, + :environment => { 'env1' => 'value1', 'env2' => 'value2' }, + :directory => '/opt/supervisord/chroot', + :umask => '022', + :serverurl => 'AUTO' + } + end - it { should contain_supervisord__eventlistener('foo') } - it { should contain_file('/etc/supervisor.d/eventlistener_foo.conf').with_content(/command=bar/) } + context 'default' do + let(:params) { default_params } + it { should contain_supervisord__eventlistener('foo') } + it { should contain_file('/etc/supervisor.d/eventlistener_foo.conf').with_content(/\[eventlistener:foo\]/) } + it { should contain_file('/etc/supervisor.d/eventlistener_foo.conf').with_content(/command=bar/) } + it { should contain_file('/etc/supervisor.d/eventlistener_foo.conf').with_content(/process_name=\%\(process_num\)s/) } + it { should contain_file('/etc/supervisor.d/eventlistener_foo.conf').with_content(/events=PROCESS_STATE,PROCESS_STATE_STARTING/) } + it { should contain_file('/etc/supervisor.d/eventlistener_foo.conf').with_content(/buffer_size=10/) } + it { should contain_file('/etc/supervisor.d/eventlistener_foo.conf').with_content(/numprocs=1/) } + it { should contain_file('/etc/supervisor.d/eventlistener_foo.conf').with_content(/numprocs_start=0/) } + it { should contain_file('/etc/supervisor.d/eventlistener_foo.conf').with_content(/priority=999/) } + it { should contain_file('/etc/supervisor.d/eventlistener_foo.conf').with_content(/autostart=true/) } + it { should contain_file('/etc/supervisor.d/eventlistener_foo.conf').with_content(/startsecs=1/) } + it { should contain_file('/etc/supervisor.d/eventlistener_foo.conf').with_content(/startretries=3/) } + it { should contain_file('/etc/supervisor.d/eventlistener_foo.conf').with_content(/exitcodes=0,2/) } + it { should contain_file('/etc/supervisor.d/eventlistener_foo.conf').with_content(/stopsignal=TERM/) } + it { should contain_file('/etc/supervisor.d/eventlistener_foo.conf').with_content(/stopwaitsecs=10/) } + it { should contain_file('/etc/supervisor.d/eventlistener_foo.conf').with_content(/stopasgroup=true/) } + it { should contain_file('/etc/supervisor.d/eventlistener_foo.conf').with_content(/killasgroup=true/) } + it { should contain_file('/etc/supervisor.d/eventlistener_foo.conf').with_content(/user=baz/) } + it { should contain_file('/etc/supervisor.d/eventlistener_foo.conf').with_content(/redirect_stderr=true/) } + it { should contain_file('/etc/supervisor.d/eventlistener_foo.conf').with_content(/stdout_logfile=\/var\/log\/supervisor\/eventlistener_foo.log/) } + it { should contain_file('/etc/supervisor.d/eventlistener_foo.conf').with_content(/stdout_logfile_maxbytes=50MB/) } + it { should contain_file('/etc/supervisor.d/eventlistener_foo.conf').with_content(/stdout_logfile_backups=10/) } + it { should contain_file('/etc/supervisor.d/eventlistener_foo.conf').with_content(/stdout_events_enabled=true/) } + it { should contain_file('/etc/supervisor.d/eventlistener_foo.conf').with_content(/stderr_logfile=\/var\/log\/supervisor\/eventlistener_foo.error/) } + it { should contain_file('/etc/supervisor.d/eventlistener_foo.conf').with_content(/stderr_logfile_maxbytes=50MB/) } + it { should contain_file('/etc/supervisor.d/eventlistener_foo.conf').with_content(/stderr_logfile_backups=10/) } + it { should contain_file('/etc/supervisor.d/eventlistener_foo.conf').with_content(/stderr_events_enabled=true/) } + it { should contain_file('/etc/supervisor.d/eventlistener_foo.conf').with_content(/environment=env1='value1',env2='value2'/) } + it { should contain_file('/etc/supervisor.d/eventlistener_foo.conf').with_content(/directory=\/opt\/supervisord\/chroot/) } + it { should contain_file('/etc/supervisor.d/eventlistener_foo.conf').with_content(/umask=022/) } + it { should contain_file('/etc/supervisor.d/eventlistener_foo.conf').with_content(/serverurl=AUTO/) } + end + + context 'ensure_process_stopped' do + let(:params) { default_params.merge({ :ensure_process => 'stopped' }) } + it { should contain_supervisord__supervisorctl('stop_foo') } + end + + context 'ensure_process_removed' do + let(:params) { default_params.merge({ :ensure_process => 'removed' }) } + it { should contain_supervisord__supervisorctl('remove_foo') } + end end diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/spec/defines/fcgi_program_spec.rb b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/spec/defines/fcgi_program_spec.rb index 7fd8ab07b86..e01311be70d 100644 --- a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/spec/defines/fcgi_program_spec.rb +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/spec/defines/fcgi_program_spec.rb @@ -2,21 +2,87 @@ require 'spec_helper' describe 'supervisord::fcgi_program', :type => :define do let(:title) {'foo'} - let(:default_params) {{ :command => 'bar', - :socket => 'tcp://localhost:1000', - :stdout_logfile => '/var/log/supervisor/fcgi-program_foo.log', - :stderr_logfile => '/var/log/supervisor/fcgi-program_foo.error', - :user => 'baz' - }} - let(:params) { default_params } let(:facts) {{ :concat_basedir => '/var/lib/puppet/concat' }} + let(:default_params) do + { + :command => 'bar', + :socket => 'tcp://localhost:1000', + :process_name => '%(process_num)s', + :numprocs => '1', + :numprocs_start => '0', + :priority => '999', + :autostart => true, + :autorestart => 'unexpected', + :startsecs => '1', + :startretries => '3', + :exitcodes => '0,2', + :stopsignal => 'TERM', + :stopwaitsecs => '10', + :stopasgroup => true, + :killasgroup => true, + :user => 'baz', + :redirect_stderr => true, + :stdout_logfile => 'fcgi-program_foo.log', + :stdout_logfile_maxbytes => '50MB', + :stdout_logfile_backups => '10', + :stdout_capture_maxbytes => '0', + :stdout_events_enabled => true, + :stderr_logfile => 'fcgi-program_foo.error', + :stderr_logfile_maxbytes => '50MB', + :stderr_logfile_backups => '10', + :stderr_capture_maxbytes => '0', + :stderr_events_enabled => true, + :environment => { 'env1' => 'value1', 'env2' => 'value2' }, + :directory => '/opt/supervisord/chroot', + :umask => '022', + :serverurl => 'AUTO' + } + end - it { should contain_supervisord__fcgi_program('foo') } - it { should contain_file('/etc/supervisor.d/fcgi-program_foo.conf').with_content(/\[fcgi-program:foo\]/) } - it { should contain_file('/etc/supervisor.d/fcgi-program_foo.conf').with_content(/socket=tcp:\/\/localhost:1000/) } - it { should contain_file('/etc/supervisor.d/fcgi-program_foo.conf').with_content(/command=bar/) } - it { should contain_file('/etc/supervisor.d/fcgi-program_foo.conf').with_content(/user=baz/) } - it { should contain_file('/etc/supervisor.d/fcgi-program_foo.conf').with_content(/stdout_logfile=\/var\/log\/supervisor\/fcgi-program_foo.log/) } - it { should contain_file('/etc/supervisor.d/fcgi-program_foo.conf').with_content(/stderr_logfile=\/var\/log\/supervisor\/fcgi-program_foo.error/) } + context 'default' do + let(:params) { default_params } + it { should contain_supervisord__fcgi_program('foo') } + it { should contain_file('/etc/supervisor.d/fcgi-program_foo.conf').with_content(/\[fcgi-program:foo\]/) } + it { should contain_file('/etc/supervisor.d/fcgi-program_foo.conf').with_content(/socket=tcp:\/\/localhost:1000/) } + it { should contain_file('/etc/supervisor.d/fcgi-program_foo.conf').with_content(/command=bar/) } + it { should contain_file('/etc/supervisor.d/fcgi-program_foo.conf').with_content(/process_name=\%\(process_num\)s/) } + it { should contain_file('/etc/supervisor.d/fcgi-program_foo.conf').with_content(/numprocs=1/) } + it { should contain_file('/etc/supervisor.d/fcgi-program_foo.conf').with_content(/numprocs_start=0/) } + it { should contain_file('/etc/supervisor.d/fcgi-program_foo.conf').with_content(/priority=999/) } + it { should contain_file('/etc/supervisor.d/fcgi-program_foo.conf').with_content(/autostart=true/) } + it { should contain_file('/etc/supervisor.d/fcgi-program_foo.conf').with_content(/startsecs=1/) } + it { should contain_file('/etc/supervisor.d/fcgi-program_foo.conf').with_content(/startretries=3/) } + it { should contain_file('/etc/supervisor.d/fcgi-program_foo.conf').with_content(/exitcodes=0,2/) } + it { should contain_file('/etc/supervisor.d/fcgi-program_foo.conf').with_content(/stopsignal=TERM/) } + it { should contain_file('/etc/supervisor.d/fcgi-program_foo.conf').with_content(/stopwaitsecs=10/) } + it { should contain_file('/etc/supervisor.d/fcgi-program_foo.conf').with_content(/stopasgroup=true/) } + it { should contain_file('/etc/supervisor.d/fcgi-program_foo.conf').with_content(/killasgroup=true/) } + it { should contain_file('/etc/supervisor.d/fcgi-program_foo.conf').with_content(/user=baz/) } + it { should contain_file('/etc/supervisor.d/fcgi-program_foo.conf').with_content(/redirect_stderr=true/) } + it { should contain_file('/etc/supervisor.d/fcgi-program_foo.conf').with_content(/stdout_logfile=\/var\/log\/supervisor\/fcgi-program_foo.log/) } + it { should contain_file('/etc/supervisor.d/fcgi-program_foo.conf').with_content(/stdout_logfile_maxbytes=50MB/) } + it { should contain_file('/etc/supervisor.d/fcgi-program_foo.conf').with_content(/stdout_logfile_backups=10/) } + it { should contain_file('/etc/supervisor.d/fcgi-program_foo.conf').with_content(/stdout_capture_maxbytes=0/) } + it { should contain_file('/etc/supervisor.d/fcgi-program_foo.conf').with_content(/stdout_events_enabled=true/) } + it { should contain_file('/etc/supervisor.d/fcgi-program_foo.conf').with_content(/stderr_logfile=\/var\/log\/supervisor\/fcgi-program_foo.error/) } + it { should contain_file('/etc/supervisor.d/fcgi-program_foo.conf').with_content(/stderr_logfile_maxbytes=50MB/) } + it { should contain_file('/etc/supervisor.d/fcgi-program_foo.conf').with_content(/stderr_logfile_backups=10/) } + it { should contain_file('/etc/supervisor.d/fcgi-program_foo.conf').with_content(/stderr_capture_maxbytes=0/) } + it { should contain_file('/etc/supervisor.d/fcgi-program_foo.conf').with_content(/stderr_events_enabled=true/) } + it { should contain_file('/etc/supervisor.d/fcgi-program_foo.conf').with_content(/environment=env1='value1',env2='value2'/) } + it { should contain_file('/etc/supervisor.d/fcgi-program_foo.conf').with_content(/directory=\/opt\/supervisord\/chroot/) } + it { should contain_file('/etc/supervisor.d/fcgi-program_foo.conf').with_content(/umask=022/) } + it { should contain_file('/etc/supervisor.d/fcgi-program_foo.conf').with_content(/serverurl=AUTO/) } + end + + context 'ensure_process_stopped' do + let(:params) { default_params.merge({ :ensure_process => 'stopped' }) } + it { should contain_supervisord__supervisorctl('stop_foo') } + end + + context 'ensure_process_removed' do + let(:params) { default_params.merge({ :ensure_process => 'removed' }) } + it { should contain_supervisord__supervisorctl('remove_foo') } + end end diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/spec/defines/program_spec.rb b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/spec/defines/program_spec.rb index 077828bdfcf..e32c24ab2d5 100644 --- a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/spec/defines/program_spec.rb +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/spec/defines/program_spec.rb @@ -2,19 +2,85 @@ require 'spec_helper' describe 'supervisord::program', :type => :define do let(:title) {'foo'} - let(:default_params) {{ :command => 'bar', - :stdout_logfile => '/var/log/supervisor/program_foo.log', - :stderr_logfile => '/var/log/supervisor/program_foo.error', - :user => 'baz' - }} - let(:params) { default_params } let(:facts) {{ :concat_basedir => '/var/lib/puppet/concat' }} + let(:default_params) do + { + :command => 'bar', + :process_name => '%(process_num)s', + :numprocs => '1', + :numprocs_start => '0', + :priority => '999', + :autostart => true, + :autorestart => 'unexpected', + :startsecs => '1', + :startretries => '3', + :exitcodes => '0,2', + :stopsignal => 'TERM', + :stopwaitsecs => '10', + :stopasgroup => true, + :killasgroup => true, + :user => 'baz', + :redirect_stderr => true, + :stdout_logfile => 'program_foo.log', + :stdout_logfile_maxbytes => '50MB', + :stdout_logfile_backups => '10', + :stdout_capture_maxbytes => '0', + :stdout_events_enabled => true, + :stderr_logfile => 'program_foo.error', + :stderr_logfile_maxbytes => '50MB', + :stderr_logfile_backups => '10', + :stderr_capture_maxbytes => '0', + :stderr_events_enabled => true, + :environment => { 'env1' => 'value1', 'env2' => 'value2' }, + :directory => '/opt/supervisord/chroot', + :umask => '022', + :serverurl => 'AUTO' + } + end - it { should contain_supervisord__program('foo') } - it { should contain_file('/etc/supervisor.d/program_foo.conf').with_content(/\[program:foo\]/) } - it { should contain_file('/etc/supervisor.d/program_foo.conf').with_content(/command=bar/) } - it { should contain_file('/etc/supervisor.d/program_foo.conf').with_content(/user=baz/) } - it { should contain_file('/etc/supervisor.d/program_foo.conf').with_content(/stdout_logfile=\/var\/log\/supervisor\/program_foo.log/) } - it { should contain_file('/etc/supervisor.d/program_foo.conf').with_content(/stderr_logfile=\/var\/log\/supervisor\/program_foo.error/) } + context 'default' do + let(:params) { default_params } + it { should contain_supervisord__program('foo') } + it { should contain_file('/etc/supervisor.d/program_foo.conf').with_content(/\[program:foo\]/) } + it { should contain_file('/etc/supervisor.d/program_foo.conf').with_content(/command=bar/) } + it { should contain_file('/etc/supervisor.d/program_foo.conf').with_content(/process_name=\%\(process_num\)s/) } + it { should contain_file('/etc/supervisor.d/program_foo.conf').with_content(/numprocs=1/) } + it { should contain_file('/etc/supervisor.d/program_foo.conf').with_content(/numprocs_start=0/) } + it { should contain_file('/etc/supervisor.d/program_foo.conf').with_content(/priority=999/) } + it { should contain_file('/etc/supervisor.d/program_foo.conf').with_content(/autostart=true/) } + it { should contain_file('/etc/supervisor.d/program_foo.conf').with_content(/startsecs=1/) } + it { should contain_file('/etc/supervisor.d/program_foo.conf').with_content(/startretries=3/) } + it { should contain_file('/etc/supervisor.d/program_foo.conf').with_content(/exitcodes=0,2/) } + it { should contain_file('/etc/supervisor.d/program_foo.conf').with_content(/stopsignal=TERM/) } + it { should contain_file('/etc/supervisor.d/program_foo.conf').with_content(/stopwaitsecs=10/) } + it { should contain_file('/etc/supervisor.d/program_foo.conf').with_content(/stopasgroup=true/) } + it { should contain_file('/etc/supervisor.d/program_foo.conf').with_content(/killasgroup=true/) } + it { should contain_file('/etc/supervisor.d/program_foo.conf').with_content(/user=baz/) } + it { should contain_file('/etc/supervisor.d/program_foo.conf').with_content(/redirect_stderr=true/) } + it { should contain_file('/etc/supervisor.d/program_foo.conf').with_content(/stdout_logfile=\/var\/log\/supervisor\/program_foo.log/) } + it { should contain_file('/etc/supervisor.d/program_foo.conf').with_content(/stdout_logfile_maxbytes=50MB/) } + it { should contain_file('/etc/supervisor.d/program_foo.conf').with_content(/stdout_logfile_backups=10/) } + it { should contain_file('/etc/supervisor.d/program_foo.conf').with_content(/stdout_capture_maxbytes=0/) } + it { should contain_file('/etc/supervisor.d/program_foo.conf').with_content(/stdout_events_enabled=true/) } + it { should contain_file('/etc/supervisor.d/program_foo.conf').with_content(/stderr_logfile=\/var\/log\/supervisor\/program_foo.error/) } + it { should contain_file('/etc/supervisor.d/program_foo.conf').with_content(/stderr_logfile_maxbytes=50MB/) } + it { should contain_file('/etc/supervisor.d/program_foo.conf').with_content(/stderr_logfile_backups=10/) } + it { should contain_file('/etc/supervisor.d/program_foo.conf').with_content(/stderr_capture_maxbytes=0/) } + it { should contain_file('/etc/supervisor.d/program_foo.conf').with_content(/stderr_events_enabled=true/) } + it { should contain_file('/etc/supervisor.d/program_foo.conf').with_content(/environment=env1='value1',env2='value2'/) } + it { should contain_file('/etc/supervisor.d/program_foo.conf').with_content(/directory=\/opt\/supervisord\/chroot/) } + it { should contain_file('/etc/supervisor.d/program_foo.conf').with_content(/umask=022/) } + it { should contain_file('/etc/supervisor.d/program_foo.conf').with_content(/serverurl=AUTO/) } + end + + context 'ensure_process_stopped' do + let(:params) { default_params.merge({ :ensure_process => 'stopped' }) } + it { should contain_supervisord__supervisorctl('stop_foo') } + end + + context 'ensure_process_removed' do + let(:params) { default_params.merge({ :ensure_process => 'removed' }) } + it { should contain_supervisord__supervisorctl('remove_foo') } + end end diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/spec/defines/supervisorctl.rb b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/spec/defines/supervisorctl.rb new file mode 100644 index 00000000000..33cfd75efe9 --- /dev/null +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/spec/defines/supervisorctl.rb @@ -0,0 +1,13 @@ +require 'spec_helper' + +describe 'supervisord::supervisorctl', :type => :define do + let(:title) {'command_foo'} + let(:default_params) {{ + :command => 'command', + :process => 'foo' + }} + let(:params) { default_params } + let(:facts) {{ :concat_basedir => '/var/lib/puppet/concat' }} + + it { should contain_supervisord__supervisorctl('command_foo') } +end diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/spec/spec_helper.rb b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/spec/spec_helper.rb index 644f7c33ac0..745ad4a5493 100644 --- a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/spec/spec_helper.rb +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/spec/spec_helper.rb @@ -7,3 +7,4 @@ RSpec.configure do |c| c.manifest_dir = File.join(fixture_path, 'manifests') end +at_exit { RSpec::Puppet::Coverage.report! } diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/spec/spec_helper_acceptance.rb b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/spec/spec_helper_acceptance.rb new file mode 100644 index 00000000000..dcae2850d27 --- /dev/null +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/spec/spec_helper_acceptance.rb @@ -0,0 +1,24 @@ +require 'beaker-rspec' + +hosts.each do |host| + # Install Puppet + install_puppet +end + +RSpec.configure do |c| + # Project root + proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..')) + + # Readable test descriptions + c.formatter = :documentation + + # Configure all nodes in nodeset + c.before :suite do + # Install module + puppet_module_install(:source => proj_root, :module_name => 'supervisord') + hosts.each do |host| + on host, puppet('module','install','puppetlabs-stdlib'), { :acceptable_exit_codes => [0,1] } + on host, puppet('module','install','puppetlabs-concat'), { :acceptable_exit_codes => [0,1] } + end + end +end \ No newline at end of file diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/spec/system/basic_spec.rb b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/spec/system/basic_spec.rb deleted file mode 100644 index 62cf7dd8c2e..00000000000 --- a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/spec/system/basic_spec.rb +++ /dev/null @@ -1,120 +0,0 @@ -require 'spec_helper_system' - -describe 'basic install' do - - it 'class should work with no errors' do - pp = <<-EOS - class { 'supervisord': install_pip => true, install_init => true} - EOS - - puppet_apply(pp) do |r| - r.exit_code.should_not == 1 - r.refresh - r.exit_code.should be_zero - end - - shell("pgrep supervisord") do |r| - r.exit_code.should be_zero - end - - end -end - -describe 'add a program config' do - - it 'supervisord::program should install a program config' do - - pp = <<-EOS - include supervisord - supervisord::program { 'test': - command => 'echo', - priority => '100', - environment => { - 'HOME' => '/root', - 'PATH' => '/bin', - } - } - EOS - - puppet_apply(pp) do |r| - r.exit_code.should_not == 1 - r.refresh - r.exit_code.should be_zero - end - - shell("grep command=echo /etc/supervisor.d/program_test.conf") do |r| - r.exit_code.should be_zero - end - shell("grep priority=100 /etc/supervisor.d/program_test.conf") do |r| - r.exit_code.should be_zero - end - shell('grep "environment=" /etc/supervisor.d/program_test.conf') do |r| - r.exit_code.should be_zero - end - end -end - -describe 'add a fcgi-program config' do - - it 'supervisord::fcgi_program should install a program config' do - - pp = <<-EOS - include supervisord - supervisord::fcgi_program { 'test': - socket => 'tcp://localhost:1000', - command => 'echo', - priority => '100', - environment => { - 'HOME' => '/root', - 'PATH' => '/bin', - } - } - EOS - - puppet_apply(pp) do |r| - r.exit_code.should_not == 1 - r.refresh - r.exit_code.should be_zero - end - - shell("grep socket=tcp://localhost:1000 /etc/supervisor.d/fcgi-program_test.conf") do |r| - r.exit_code.should be_zero - end - shell("grep command=echo /etc/supervisor.d/fcgi-program_test.conf") do |r| - r.exit_code.should be_zero - end - shell("grep priority=100 /etc/supervisor.d/fcgi-program_test.conf") do |r| - r.exit_code.should be_zero - end - shell('grep "environment=" /etc/supervisor.d/fcgi-program_test.conf') do |r| - r.exit_code.should be_zero - end - end -end - -describe 'add a group config' do - - it 'supervisord::group should install a program config' do - - pp = <<-EOS - include supervisord - supervisord::group { 'test': - programs => ['program1', 'program2'], - priority => '100', - } - EOS - - puppet_apply(pp) do |r| - r.exit_code.should_not == 1 - r.refresh - r.exit_code.should be_zero - end - - shell('grep "programs=program1,program2" /etc/supervisor.d/group_test.conf') do |r| - r.exit_code.should be_zero - end - shell("grep priority=100 /etc/supervisor.d/fcgi-program_test.conf") do |r| - r.exit_code.should be_zero - end - end -end diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/templates/conf/eventlistener.erb b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/templates/conf/eventlistener.erb index 4ee2b893419..9875c8ef5b2 100644 --- a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/templates/conf/eventlistener.erb +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/templates/conf/eventlistener.erb @@ -39,8 +39,8 @@ exitcodes=<%= @exitcodes %> <% if @stopsignal -%> stopsignal=<%= @stopsignal %> <% end -%> -<% if @stopwaitsec -%> -stopwaitsec=<%= @stopwaitsec %> +<% if @stopwaitsecs -%> +stopwaitsecs=<%= @stopwaitsecs %> <% end -%> <% if @stopasgroup -%> stopasgroup=<%= @stopasgroup %> @@ -54,7 +54,7 @@ user=<%= @user %> <% if @redirect_stderr -%> redirect_stderr=<%= @redirect_stderr %> <% end -%> -stdout_logfile=<%= @stdout_logfile %> +stdout_logfile=<%= scope.lookupvar('supervisord::log_path') %>/<%= @stdout_logfile %> <% if @stdout_logfile_maxbytes -%> stdout_logfile_maxbytes=<%= @stdout_logfile_maxbytes %> <% end -%> @@ -64,7 +64,7 @@ stdout_logfile_backups=<%= @stdout_logfile_backups %> <% if @stdout_events_enabled -%> stdout_events_enabled=<%= @stdout_events_enabled %> <% end -%> -stderr_logfile=<%= @stderr_logfile %> +stderr_logfile=<%= scope.lookupvar('supervisord::log_path') %>/<%= @stderr_logfile %> <% if @stderr_logfile_maxbytes -%> stderr_logfile_maxbytes=<%= @stderr_logfile_maxbytes %> <% end -%> diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/templates/conf/fcgi_program.erb b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/templates/conf/fcgi_program.erb index a1478bce536..98a7fb1cb32 100644 --- a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/templates/conf/fcgi_program.erb +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/templates/conf/fcgi_program.erb @@ -37,8 +37,8 @@ exitcodes=<%= @exitcodes %> <% if @stopsignal -%> stopsignal=<%= @stopsignal %> <% end -%> -<% if @stopwaitsec -%> -stopwaitsec=<%= @stopwaitsec %> +<% if @stopwaitsecs -%> +stopwaitsecs=<%= @stopwaitsecs %> <% end -%> <% if @stopasgroup -%> stopasgroup=<%= @stopasgroup %> @@ -53,7 +53,7 @@ user=<%= @user %> redirect_stderr=<%= @redirect_stderr %> <% end -%> <% if @stdout_logfile -%> -stdout_logfile=<%= @stdout_logfile %> +stdout_logfile=<%= scope.lookupvar('supervisord::log_path') %>/<%= @stdout_logfile %> <% end -%> <% if @stdout_logfile_maxbytes -%> stdout_logfile_maxbytes=<%= @stdout_logfile_maxbytes %> @@ -68,7 +68,7 @@ stdout_capture_maxbytes=<%= @stdout_capture_maxbytes %> stdout_events_enabled=<%= @stdout_events_enabled %> <% end -%> <% if @stderr_logfile -%> -stderr_logfile=<%= @stderr_logfile %> +stderr_logfile=<%= scope.lookupvar('supervisord::log_path') %>/<%= @stderr_logfile %> <% end -%> <% if @stderr_logfile_maxbytes -%> stderr_logfile_maxbytes=<%= @stderr_logfile_maxbytes %> diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/templates/conf/program.erb b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/templates/conf/program.erb index ca96d34d6ad..78002c87ca6 100644 --- a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/templates/conf/program.erb +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/templates/conf/program.erb @@ -30,8 +30,8 @@ exitcodes=<%= @exitcodes %> <% if @stopsignal -%> stopsignal=<%= @stopsignal %> <% end -%> -<% if @stopwaitsec -%> -stopwaitsec=<%= @stopwaitsec %> +<% if @stopwaitsecs -%> +stopwaitsecs=<%= @stopwaitsecs %> <% end -%> <% if @stopasgroup -%> stopasgroup=<%= @stopasgroup %> @@ -46,7 +46,7 @@ user=<%= @user %> redirect_stderr=<%= @redirect_stderr %> <% end -%> <% if @stdout_logfile -%> -stdout_logfile=<%= @stdout_logfile %> +stdout_logfile=<%= scope.lookupvar('supervisord::log_path') %>/<%= @stdout_logfile %> <% end -%> <% if @stdout_logfile_maxbytes -%> stdout_logfile_maxbytes=<%= @stdout_logfile_maxbytes %> @@ -61,7 +61,7 @@ stdout_capture_maxbytes=<%= @stdout_capture_maxbytes %> stdout_events_enabled=<%= @stdout_events_enabled %> <% end -%> <% if @stderr_logfile -%> -stderr_logfile=<%= @stderr_logfile %> +stderr_logfile=<%= scope.lookupvar('supervisord::log_path') %>/<%= @stderr_logfile %> <% end -%> <% if @stderr_logfile_maxbytes -%> stderr_logfile_maxbytes=<%= @stderr_logfile_maxbytes %> diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/templates/init/debian_extra.erb b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/templates/init/Debian/defaults.erb similarity index 100% rename from dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/templates/init/debian_extra.erb rename to dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/templates/init/Debian/defaults.erb diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/templates/init/debian_init.erb b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/templates/init/Debian/init.erb similarity index 93% rename from dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/templates/init/debian_init.erb rename to dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/templates/init/Debian/init.erb index b94f9337f59..f8bdb5ff854 100644 --- a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/templates/init/debian_init.erb +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/templates/init/Debian/init.erb @@ -16,18 +16,22 @@ DAEMON=<%= @executable %> NAME=supervisord DESC=supervisor -test -x $DAEMON || exit 0 +# Tests if executable exists +if [ ! -x $DAEMON ] ; then + echo "Executable not found ${DAEMON}" + exit 1 +fi LOGDIR=<%= @log_path %> -PIDFILE=<%= @pid_file %> +PIDFILE=<%= @run_path %>/<%= @pid_file %> DODTIME=5 # Time to wait for the server to die, in seconds # If this value is set too low you might not # let some servers to die gracefully and # 'restart' will not work # Include supervisor defaults if available -if [ -f /etc/default/supervisor ] ; then - . /etc/default/supervisor +if [ -f <%= @init_defaults %> ] ; then + . <%= @init_defaults %> fi set -e diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/templates/init/redhat_extra.erb b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/templates/init/RedHat/defaults.erb similarity index 81% rename from dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/templates/init/redhat_extra.erb rename to dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/templates/init/RedHat/defaults.erb index b892c2d6203..0d7862d0233 100644 --- a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/templates/init/redhat_extra.erb +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/templates/init/RedHat/defaults.erb @@ -5,4 +5,4 @@ set -a # should probably put both of these options as runtime arguments OPTIONS="-c <%= @config_file %>" -PIDFILE=<%= @pid_file %> +PIDFILE=<%= @run_path %><%= @pid_file %> diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/templates/init/redhat_init.erb b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/templates/init/RedHat/init.erb similarity index 87% rename from dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/templates/init/redhat_init.erb rename to dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/templates/init/RedHat/init.erb index 1dc2da2aff1..617f3eed93b 100644 --- a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/templates/init/redhat_init.erb +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/templates/init/RedHat/init.erb @@ -13,18 +13,26 @@ # xmlrpc interface as well as a few other nifty features. # processname: supervisord # config: <%= @config_file %> -# pidfile: <%= @pid_file %> +# pidfile: <%= @run_path %>/<%= @pid_file %> # # source function library . /etc/rc.d/init.d/functions # source system settings -[ -e <%= @init_extras %> ] && . <%= @init_extras %> +[ -e <%= @init_defaults %> ] && . <%= @init_defaults %> RETVAL=0 -DAEMON=/usr/bin/supervisord +DAEMON=<%= @executable %> +CTL=<%= @executable_ctl %> DESC=supervisord +PIDFILE=<%= @run_path %>/<%= @pid_file %> + +# Tests if executable exists +if [ ! -x $DAEMON ] ; then + echo "Executable not found ${DAEMON}" + exit 1 +fi running_pid() { @@ -88,7 +96,7 @@ case "$1" in restart ;; reload) - /usr/bin/supervisorctl $OPTIONS reload + $CTL $OPTIONS reload RETVAL=$? ;; condrestart) @@ -109,4 +117,4 @@ case "$1" in exit 1 esac -exit $RETVAL \ No newline at end of file +exit $RETVAL diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/templates/supervisord_main.erb b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/templates/supervisord_main.erb index 1baf5607a2f..8ab8fee51df 100644 --- a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/templates/supervisord_main.erb +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/templates/supervisord_main.erb @@ -1,9 +1,9 @@ [supervisord] -logfile=<%= @log_file %> -pidfile=<%= @pid_file %> +logfile=<%= @log_path %>/<%= @log_file %> +pidfile=<%= @run_path %>/<%= @pid_file %> nodaemon=<%= @nodaemon %> minfds=<%= @minfds %> -minfds=<%= @minprocs %> +minprocs=<%= @minprocs %> umask=<%= @umask %> <% if @strip_ansi -%> strip_ansi=<%= @strip_ansi %> @@ -12,7 +12,7 @@ strip_ansi=<%= @strip_ansi %> user=<%= @user %> <% end -%> <% if @identifier -%> -indentifier=<%= @identifier %> +identifier=<%= @identifier %> <% end -%> <% if @directory -%> directory=<%= @directory %> @@ -31,4 +31,4 @@ environment=<%= @env_string %> supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface [include] -files=<%= @config_include %>/*.conf +files=<%= @config_include_string %> diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/templates/supervisord_unix.erb b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/templates/supervisord_unix.erb index 414e75198ba..39e85199916 100644 --- a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/templates/supervisord_unix.erb +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/templates/supervisord_unix.erb @@ -1,5 +1,5 @@ [unix_http_server] -file=<%= @unix_socket_file %> +file=<%= @run_path %>/<%= @unix_socket_file %> chmod=<%= @unix_socket_mode %> chown=<%= @unix_socket_owner %>:<%= @unix_socket_group %> <% if @unix_auth -%> @@ -8,7 +8,7 @@ password=<%= @unix_socket_password %> <% end -%> [supervisorctl] -serverurl=unix://<%= @unix_socket_file %> +serverurl=unix://<%= @run_path %>/<%= @unix_socket_file %> <% if @unix_auth -%> username=<%= @unix_username %> password=<%= @unix_password %> diff --git a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/tests/program.pp b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/tests/program.pp index 6c789c96dc1..0d45ebe1b3d 100644 --- a/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/tests/program.pp +++ b/dev/vagrant/dolibarrdev/puphpet/puppet/modules/supervisord/tests/program.pp @@ -1,9 +1,35 @@ supervisord::program { 'myprogram': - command => 'command --args', - priority => '100', - environment => { + command => 'command --args', + process_name => '%(process_num)s', + numprocs => '1', + numprocs_start => '0', + priority => '999', + autostart => true, + autorestart => 'unexpected', + startsecs => '1', + startretries => '3', + exitcodes => '0,2', + stopsignal => 'TERM', + stopwaitsecs => '10', + stopasgroup => false, + killasgroup => false, + redirect_stderr => false, + stdout_logfile => 'program_foo.log', + stdout_logfile_maxbytes => '50MB', + stdout_logfile_backups => '10', + stdout_capture_maxbytes => '0', + stdout_events_enabled => false, + stderr_logfile => 'program_foo.error', + stderr_logfile_maxbytes => '50MB', + stderr_logfile_backups => '10', + stderr_capture_maxbytes => '0', + stderr_events_enabled => false, + environment => { 'HOME' => '/home/myuser', 'PATH' => '/bin:/sbin:/usr/bin:/usr/sbin', 'SECRET' => 'mysecret' - } + }, + directory => undef, + umask => '022', + serverurl => 'AUTO' } \ No newline at end of file diff --git a/dev/vagrant/dolibarrdev/puphpet/shell/execute-files.sh b/dev/vagrant/dolibarrdev/puphpet/shell/execute-files.sh index 06713c2ee99..198d7e2dfb7 100644 --- a/dev/vagrant/dolibarrdev/puphpet/shell/execute-files.sh +++ b/dev/vagrant/dolibarrdev/puphpet/shell/execute-files.sh @@ -4,17 +4,27 @@ export DEBIAN_FRONTEND=noninteractive VAGRANT_CORE_FOLDER=$(cat '/.puphpet-stuff/vagrant-core-folder.txt') -shopt -s nullglob -files=("${VAGRANT_CORE_FOLDER}"/files/exec-once/*) +EXEC_ONCE_DIR="$1" +EXEC_ALWAYS_DIR="$2" -if [[ ! -f '/.puphpet-stuff/exec-once-ran' && (${#files[@]} -gt 0) ]]; then - echo 'Running files in files/exec-once' - find "${VAGRANT_CORE_FOLDER}/files/exec-once" -maxdepth 1 -not -path '*/\.*' -type f \( ! -iname "empty" \) -exec chmod +x '{}' \; -exec {} \; - echo 'Finished running files in files/exec-once' - echo 'To run again, delete file /.puphpet-stuff/exec-once-ran' - touch /.puphpet-stuff/exec-once-ran +shopt -s nullglob +files=("${VAGRANT_CORE_FOLDER}"/files/"${EXEC_ONCE_DIR}"/*) + +if [[ (${#files[@]} -gt 0) ]]; then + echo "Running files in files/${EXEC_ONCE_DIR}" + + if [ ! -d "/.puphpet-stuff/${EXEC_ONCE_DIR}-ran" ]; then + mkdir "/.puphpet-stuff/${EXEC_ONCE_DIR}-ran" + echo "Created directory /.puphpet-stuff/${EXEC_ONCE_DIR}-ran" + fi + + find "${VAGRANT_CORE_FOLDER}/files/${EXEC_ONCE_DIR}" -maxdepth 1 -not -path '/.*' -type f \( ! -iname "empty" \) -exec cp -n '{}' "/.puphpet-stuff/${EXEC_ONCE_DIR}-ran" \; + find "/.puphpet-stuff/${EXEC_ONCE_DIR}-ran" -maxdepth 1 -type f -exec chmod +x '{}' \; -exec ls {} \; | sort | xargs -r0 sh -c + echo "Finished running files in files/${EXEC_ONCE_DIR}" + echo "To run again, delete file(s) you want rerun in /.puphpet-stuff/${EXEC_ONCE_DIR}-ran or the whole folder to rerun all" fi -echo 'Running files in files/exec-always' -find "${VAGRANT_CORE_FOLDER}/files/exec-always" -maxdepth 1 -not -path '*/\.*' -type f \( ! -iname "empty" \) -exec chmod +x '{}' \; -exec {} \; -echo 'Finished running files in files/exec-always' +echo "Running files in files/${EXEC_ALWAYS_DIR}" +find "${VAGRANT_CORE_FOLDER}/files/${EXEC_ALWAYS_DIR}" -maxdepth 1 -not -path '/.*' -type f \( ! -iname "empty" \) -exec chmod +x '{}' \; -exec ls {} \; | sort | xargs -r0 sh -c +echo "Finished running files in files/${EXEC_ALWAYS_DIR}" + diff --git a/dev/vagrant/dolibarrdev/puphpet/shell/hostsupdater-notice.txt b/dev/vagrant/dolibarrdev/puphpet/shell/hostsupdater-notice.txt new file mode 100644 index 00000000000..ce3331b3ced --- /dev/null +++ b/dev/vagrant/dolibarrdev/puphpet/shell/hostsupdater-notice.txt @@ -0,0 +1,4 @@ +=============================================================================== +You have the Vagrant::Hostsupdater plugin installed. You may be required to +enter your host's root/privileged password below to continue! +=============================================================================== diff --git a/dev/vagrant/dolibarrdev/puphpet/shell/important-notices.sh b/dev/vagrant/dolibarrdev/puphpet/shell/important-notices.sh index bd1bb95cabe..21486cd3b93 100644 --- a/dev/vagrant/dolibarrdev/puphpet/shell/important-notices.sh +++ b/dev/vagrant/dolibarrdev/puphpet/shell/important-notices.sh @@ -2,8 +2,10 @@ VAGRANT_CORE_FOLDER=$(cat '/.puphpet-stuff/vagrant-core-folder.txt') -if [[ ! -f '/.puphpet-stuff/displayed-important-notices' ]]; then - cat "${VAGRANT_CORE_FOLDER}/shell/important-notices.txt" - - touch '/.puphpet-stuff/displayed-important-notices' +if [[ -f '/.puphpet-stuff/displayed-important-notices' ]]; then + exit 0 fi + +cat "${VAGRANT_CORE_FOLDER}/shell/important-notices.txt" + +touch '/.puphpet-stuff/displayed-important-notices' diff --git a/dev/vagrant/dolibarrdev/puphpet/shell/initial-setup.sh b/dev/vagrant/dolibarrdev/puphpet/shell/initial-setup.sh index 8fbfe3a2014..e653f8991c1 100644 --- a/dev/vagrant/dolibarrdev/puphpet/shell/initial-setup.sh +++ b/dev/vagrant/dolibarrdev/puphpet/shell/initial-setup.sh @@ -8,6 +8,8 @@ OS=$(/bin/bash "${VAGRANT_CORE_FOLDER}/shell/os-detect.sh" ID) CODENAME=$(/bin/bash "${VAGRANT_CORE_FOLDER}/shell/os-detect.sh" CODENAME) cat "${VAGRANT_CORE_FOLDER}/shell/self-promotion.txt" +printf "\n" +echo "" if [[ ! -d '/.puphpet-stuff' ]]; then mkdir '/.puphpet-stuff' @@ -17,91 +19,49 @@ fi touch '/.puphpet-stuff/vagrant-core-folder.txt' echo "${VAGRANT_CORE_FOLDER}" > '/.puphpet-stuff/vagrant-core-folder.txt' -if [[ ! -f '/.puphpet-stuff/initial-setup-base-packages' ]]; then - if [ "${OS}" == 'debian' ] || [ "${OS}" == 'ubuntu' ]; then - echo 'Running initial-setup apt-get update' - apt-get update >/dev/null - echo 'Finished running initial-setup apt-get update' - - echo 'Installing git' - apt-get -q -y install git-core >/dev/null - echo 'Finished installing git' - - if [[ "${CODENAME}" == 'lucid' || "${CODENAME}" == 'precise' ]]; then - echo 'Installing basic curl packages (Ubuntu only)' - apt-get install -y libcurl3 libcurl4-gnutls-dev curl >/dev/null - echo 'Finished installing basic curl packages (Ubuntu only)' - fi - - echo 'Installing rubygems' - apt-get install -y rubygems >/dev/null - echo 'Finished installing rubygems' - - echo 'Installing base packages for r10k' - apt-get install -y build-essential ruby-dev >/dev/null - gem install json >/dev/null - echo 'Finished installing base packages for r10k' - - if [ "${OS}" == 'ubuntu' ]; then - echo 'Updating libgemplugin-ruby (Ubuntu only)' - apt-get install -y libgemplugin-ruby >/dev/null - echo 'Finished updating libgemplugin-ruby (Ubuntu only)' - fi - - if [ "${CODENAME}" == 'lucid' ]; then - echo 'Updating rubygems (Ubuntu Lucid only)' - gem install rubygems-update >/dev/null 2>&1 - /var/lib/gems/1.8/bin/update_rubygems >/dev/null 2>&1 - echo 'Finished updating rubygems (Ubuntu Lucid only)' - fi - - echo 'Installing r10k' - gem install r10k >/dev/null 2>&1 - echo 'Finished installing r10k' - - touch '/.puphpet-stuff/initial-setup-base-packages' - elif [[ "${OS}" == 'centos' ]]; then - echo 'Running initial-setup yum update' - perl -p -i -e 's@enabled=1@enabled=0@gi' /etc/yum/pluginconf.d/fastestmirror.conf - perl -p -i -e 's@#baseurl=http://mirror.centos.org/centos/\$releasever/os/\$basearch/@baseurl=http://mirror.rackspace.com/CentOS//\$releasever/os/\$basearch/\nenabled=1@gi' /etc/yum.repos.d/CentOS-Base.repo - perl -p -i -e 's@#baseurl=http://mirror.centos.org/centos/\$releasever/updates/\$basearch/@baseurl=http://mirror.rackspace.com/CentOS//\$releasever/updates/\$basearch/\nenabled=1@gi' /etc/yum.repos.d/CentOS-Base.repo - perl -p -i -e 's@#baseurl=http://mirror.centos.org/centos/\$releasever/extras/\$basearch/@baseurl=http://mirror.rackspace.com/CentOS//\$releasever/extras/\$basearch/\nenabled=1@gi' /etc/yum.repos.d/CentOS-Base.repo - - yum -y --nogpgcheck install 'http://www.elrepo.org/elrepo-release-6-6.el6.elrepo.noarch.rpm' >/dev/null - yum -y --nogpgcheck install 'https://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm' >/dev/null - yum -y install centos-release-SCL >/dev/null - yum clean all >/dev/null - yum -y check-update >/dev/null - echo 'Finished running initial-setup yum update' - - echo 'Installing git' - yum -y install git >/dev/null - echo 'Finished installing git' - - echo 'Updating to Ruby 1.9.3' - yum -y install centos-release-SCL >/dev/null 2>&1 - yum remove ruby >/dev/null 2>&1 - yum -y install ruby193 ruby193-ruby-irb ruby193-ruby-doc ruby193-libyaml rubygems >/dev/null 2>&1 - yum -y --nogpgcheck install 'https://yum.puppetlabs.com/el/6/dependencies/x86_64/ruby-rgen-0.6.5-2.el6.noarch.rpm' >/dev/null 2>&1 - gem update --system >/dev/null 2>&1 - gem install haml >/dev/null 2>&1 - - yum -y --nogpgcheck install 'https://yum.puppetlabs.com/el/6/products/x86_64/hiera-1.3.2-1.el6.noarch.rpm' >/dev/null - yum -y --nogpgcheck install 'https://yum.puppetlabs.com/el/6/products/x86_64/facter-1.7.5-1.el6.x86_64.rpm' >/dev/null - yum -y --nogpgcheck install 'https://yum.puppetlabs.com/el/6/dependencies/x86_64/rubygem-json-1.5.5-1.el6.x86_64.rpm' >/dev/null - yum -y --nogpgcheck install 'https://yum.puppetlabs.com/el/6/dependencies/x86_64/ruby-json-1.5.5-1.el6.x86_64.rpm' >/dev/null - yum -y --nogpgcheck install 'https://yum.puppetlabs.com/el/6/dependencies/x86_64/ruby-shadow-2.2.0-2.el6.x86_64.rpm' >/dev/null - yum -y --nogpgcheck install 'https://yum.puppetlabs.com/el/6/dependencies/x86_64/ruby-augeas-0.4.1-3.el6.x86_64.rpm' >/dev/null - echo 'Finished updating to Ruby 1.9.3' - - echo 'Installing basic development tools (CentOS)' - yum -y groupinstall 'Development Tools' >/dev/null - echo 'Finished installing basic development tools (CentOS)' - - echo 'Installing r10k' - gem install r10k >/dev/null 2>&1 - echo 'Finished installing r10k' - - touch '/.puphpet-stuff/initial-setup-base-packages' - fi +if [[ -f '/.puphpet-stuff/initial-setup-base-packages' ]]; then + exit 0 fi + +if [ "${OS}" == 'debian' ] || [ "${OS}" == 'ubuntu' ]; then + echo 'Running initial-setup apt-get update' + apt-get update >/dev/null + echo 'Finished running initial-setup apt-get update' + + echo 'Installing git' + apt-get -y install git-core >/dev/null + echo 'Finished installing git' + + if [[ "${CODENAME}" == 'lucid' || "${CODENAME}" == 'precise' ]]; then + echo 'Installing basic curl packages' + apt-get -y install libcurl3 libcurl4-gnutls-dev curl >/dev/null + echo 'Finished installing basic curl packages' + fi + + echo 'Installing build-essential package' + apt-get -y install build-essential >/dev/null + echo 'Finished installing build-essential packages' +elif [[ "${OS}" == 'centos' ]]; then + echo 'Adding repos: elrep, epel, scl' + perl -p -i -e 's@enabled=1@enabled=0@gi' /etc/yum/pluginconf.d/fastestmirror.conf + perl -p -i -e 's@#baseurl=http://mirror.centos.org/centos/\$releasever/os/\$basearch/@baseurl=http://mirror.rackspace.com/CentOS//\$releasever/os/\$basearch/\nenabled=1@gi' /etc/yum.repos.d/CentOS-Base.repo + perl -p -i -e 's@#baseurl=http://mirror.centos.org/centos/\$releasever/updates/\$basearch/@baseurl=http://mirror.rackspace.com/CentOS//\$releasever/updates/\$basearch/\nenabled=1@gi' /etc/yum.repos.d/CentOS-Base.repo + perl -p -i -e 's@#baseurl=http://mirror.centos.org/centos/\$releasever/extras/\$basearch/@baseurl=http://mirror.rackspace.com/CentOS//\$releasever/extras/\$basearch/\nenabled=1@gi' /etc/yum.repos.d/CentOS-Base.repo + + yum -y --nogpgcheck install 'http://www.elrepo.org/elrepo-release-6-6.el6.elrepo.noarch.rpm' >/dev/null + yum -y --nogpgcheck install 'https://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm' >/dev/null + yum -y install centos-release-SCL >/dev/null + yum clean all >/dev/null + yum -y check-update >/dev/null + echo 'Finished adding repos: elrep, epel, scl' + + echo 'Installing git' + yum -y install git >/dev/null + echo 'Finished installing git' + + echo 'Installing Development Tools' + yum -y groupinstall 'Development Tools' >/dev/null + echo 'Finished installing Development Tools' +fi + +touch '/.puphpet-stuff/initial-setup-base-packages' diff --git a/dev/vagrant/dolibarrdev/puphpet/shell/install-puppet.sh b/dev/vagrant/dolibarrdev/puphpet/shell/install-puppet.sh new file mode 100644 index 00000000000..93f1c32c6c7 --- /dev/null +++ b/dev/vagrant/dolibarrdev/puphpet/shell/install-puppet.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +export DEBIAN_FRONTEND=noninteractive + +VAGRANT_CORE_FOLDER=$(cat '/.puphpet-stuff/vagrant-core-folder.txt') + +OS=$(/bin/bash "${VAGRANT_CORE_FOLDER}/shell/os-detect.sh" ID) +RELEASE=$(/bin/bash "${VAGRANT_CORE_FOLDER}/shell/os-detect.sh" RELEASE) +CODENAME=$(/bin/bash "${VAGRANT_CORE_FOLDER}/shell/os-detect.sh" CODENAME) + +if [[ -f '/.puphpet-stuff/install-puppet' ]]; then + exit 0 +fi + +if [ "${OS}" == 'debian' ] || [ "${OS}" == 'ubuntu' ]; then + apt-get -y install augeas-tools libaugeas-dev +elif [[ "${OS}" == 'centos' ]]; then + yum -y install augeas-devel +fi + +echo 'Installing Puppet requirements' +/usr/bin/gem install haml hiera facter json ruby-augeas +echo 'Finished installing Puppet requirements' + +echo 'Installing Puppet 3.4.3' +/usr/bin/gem install puppet --version 3.4.3 + +if [[ -f '/usr/bin/puppet' ]]; then + mv /usr/bin/puppet /usr/bin/puppet-old +fi + +ln -s /usr/local/rvm/wrappers/default/puppet /usr/bin/puppet +echo 'Finished installing Puppet 3.4.3' + +touch '/.puphpet-stuff/install-puppet' diff --git a/dev/vagrant/dolibarrdev/puphpet/shell/install-ruby.sh b/dev/vagrant/dolibarrdev/puphpet/shell/install-ruby.sh new file mode 100644 index 00000000000..d1b94e37f7d --- /dev/null +++ b/dev/vagrant/dolibarrdev/puphpet/shell/install-ruby.sh @@ -0,0 +1,43 @@ +#!/bin/bash + +export DEBIAN_FRONTEND=noninteractive + +VAGRANT_CORE_FOLDER=$(cat '/.puphpet-stuff/vagrant-core-folder.txt') + +OS=$(/bin/bash "${VAGRANT_CORE_FOLDER}/shell/os-detect.sh" ID) +RELEASE=$(/bin/bash "${VAGRANT_CORE_FOLDER}/shell/os-detect.sh" RELEASE) +CODENAME=$(/bin/bash "${VAGRANT_CORE_FOLDER}/shell/os-detect.sh" CODENAME) + +if [[ -f '/.puphpet-stuff/install-ruby' ]]; then + exit 0 +fi + +if [[ -f '/usr/local/rvm/wrappers/default/ruby' ]]; then + RUBY_VERSION=$(/usr/local/rvm/wrappers/default/ruby --version); + if [ "grep '1.9.3' ${RUBY_VERSION}" ]; then + touch '/.puphpet-stuff/install-ruby' + exit 0 + fi +fi + +echo 'Installing Ruby 1.9.3 using RVM' + +curl -sSL https://get.rvm.io | bash -s stable --ruby=1.9.3 +source /usr/local/rvm/scripts/rvm + +if [[ -f '/usr/bin/ruby' ]]; then + mv /usr/bin/ruby /usr/bin/ruby-old +fi + +if [[ -f '/usr/bin/gem' ]]; then + mv /usr/bin/gem /usr/bin/gem-old +fi + +ln -s /usr/local/rvm/wrappers/default/ruby /usr/bin/ruby +ln -s /usr/local/rvm/wrappers/default/gem /usr/bin/gem + +gem update --system >/dev/null + +touch '/.puphpet-stuff/install-ruby' + +echo 'Finished install Ruby 1.9.3 using RVM' diff --git a/dev/vagrant/dolibarrdev/puphpet/shell/os-detect.sh b/dev/vagrant/dolibarrdev/puphpet/shell/os-detect.sh index 3f679008fe8..5a73825dd59 100644 --- a/dev/vagrant/dolibarrdev/puphpet/shell/os-detect.sh +++ b/dev/vagrant/dolibarrdev/puphpet/shell/os-detect.sh @@ -1,36 +1,32 @@ #!/bin/bash -# Try and get debian operating system -# id, codename, and release - TYPE=$(echo "$1" | tr '[A-Z]' '[a-z]') OS=$(uname) ID='unknown' CODENAME='unknown' RELEASE='unknown' +ARCH='unknown' -if [ "${OS}" == 'Linux' ]; then - # detect centos - grep 'centos' /etc/issue -i -q - if [ $? = '0' ]; then - ID='centos' - RELEASE=$(cat /etc/redhat-release | grep -o 'release [0-9]' | cut -d " " -f2) - # could be debian or ubuntu - elif [ $(which lsb_release) ]; then - ID=$(lsb_release -i | cut -f2) - CODENAME=$(lsb_release -c | cut -f2) - RELEASE=$(lsb_release -r | cut -f2) - elif [ -f '/etc/lsb-release' ]; then - ID=$(cat /etc/lsb-release | grep DISTRIB_ID | cut -d "=" -f2) - CODENAME=$(cat /etc/lsb-release | grep DISTRIB_CODENAME | cut -d "=" -f2) - RELEASE=$(cat /etc/lsb-release | grep DISTRIB_RELEASE | cut -d "=" -f2) - elif [ -f '/etc/issue' ]; then - ID=$(head -1 /etc/issue | cut -d " " -f1) - if [ -f '/etc/debian_version' ]; then - RELEASE=$(/dev/null -echo 'Finished running update r10k' diff --git a/dev/vagrant/dolibarrdev/puphpet/shell/ssh-keygen.sh b/dev/vagrant/dolibarrdev/puphpet/shell/ssh-keygen.sh index 6bb7614f9c6..ef00495b2b6 100644 --- a/dev/vagrant/dolibarrdev/puphpet/shell/ssh-keygen.sh +++ b/dev/vagrant/dolibarrdev/puphpet/shell/ssh-keygen.sh @@ -5,37 +5,76 @@ VAGRANT_CORE_FOLDER=$(cat '/.puphpet-stuff/vagrant-core-folder.txt') OS=$(/bin/bash "${VAGRANT_CORE_FOLDER}/shell/os-detect.sh" ID) VAGRANT_SSH_USERNAME=$(echo "$1") -if [[ ! -f "${VAGRANT_CORE_FOLDER}/files/dot/ssh/id_rsa" ]]; then - ssh-keygen -f "${VAGRANT_CORE_FOLDER}/files/dot/ssh/id_rsa" -P "" +function create_key() +{ + BASE_KEY_NAME=$(echo "$1") - if [[ ! -f "${VAGRANT_CORE_FOLDER}/files/dot/ssh/id_rsa.ppk" ]]; then - if [ "${OS}" == 'debian' ] || [ "${OS}" == 'ubuntu' ]; then - apt-get install -y putty-tools >/dev/null - elif [ "${OS}" == 'centos' ]; then - yum -y install putty >/dev/null + if [[ ! -f "${VAGRANT_CORE_FOLDER}/files/dot/ssh/${BASE_KEY_NAME}" ]]; then + ssh-keygen -f "${VAGRANT_CORE_FOLDER}/files/dot/ssh/${BASE_KEY_NAME}" -P "" + + if [[ ! -f "${VAGRANT_CORE_FOLDER}/files/dot/ssh/${BASE_KEY_NAME}.ppk" ]]; then + if [ "${OS}" == 'debian' ] || [ "${OS}" == 'ubuntu' ]; then + apt-get install -y putty-tools >/dev/null + elif [ "${OS}" == 'centos' ]; then + yum -y install putty >/dev/null + fi + + puttygen "${VAGRANT_CORE_FOLDER}/files/dot/ssh/${BASE_KEY_NAME}" -O private -o "${VAGRANT_CORE_FOLDER}/files/dot/ssh/${BASE_KEY_NAME}.ppk" fi - puttygen "${VAGRANT_CORE_FOLDER}/files/dot/ssh/id_rsa" -O private -o "${VAGRANT_CORE_FOLDER}/files/dot/ssh/id_rsa.ppk" + echo "Your private key for SSH-based authentication has been saved to 'puphpet/files/dot/ssh/${BASE_KEY_NAME}'!" + else + echo "Pre-existing private key found at 'puphpet/files/dot/ssh/${BASE_KEY_NAME}'" fi +} - echo 'Your private key for SSH-based authentication have been saved to "puphpet/files/dot/ssh/"!' -else - echo 'Using pre-existing private key at "puphpet/files/dot/ssh/id_rsa"' +create_key 'root_id_rsa' +create_key 'id_rsa' + +PUBLIC_SSH_KEY=$(cat "${VAGRANT_CORE_FOLDER}/files/dot/ssh/id_rsa.pub") + +echo 'Adding generated key to /root/.ssh/id_rsa' +echo 'Adding generated key to /root/.ssh/id_rsa.pub' +echo 'Adding generated key to /root/.ssh/authorized_keys' + +mkdir -p /root/.ssh + +cp "${VAGRANT_CORE_FOLDER}/files/dot/ssh/id_rsa" '/root/.ssh/' +cp "${VAGRANT_CORE_FOLDER}/files/dot/ssh/id_rsa.pub" '/root/.ssh/' + +if [[ ! -f '/root/.ssh/authorized_keys' ]] || ! grep -q "${PUBLIC_SSH_KEY}" '/root/.ssh/authorized_keys'; then + cat "${VAGRANT_CORE_FOLDER}/files/dot/ssh/id_rsa.pub" >> '/root/.ssh/authorized_keys' fi -echo 'Adding generated key to /root/.ssh/authorized_keys' -mkdir -p /root/.ssh -cat "${VAGRANT_CORE_FOLDER}/files/dot/ssh/id_rsa.pub" > '/root/.ssh/authorized_keys' +chown -R root '/root/.ssh' +chgrp -R root '/root/.ssh' +chmod 700 '/root/.ssh' +chmod 644 '/root/.ssh/id_rsa.pub' +chmod 600 '/root/.ssh/id_rsa' chmod 600 '/root/.ssh/authorized_keys' if [ "${VAGRANT_SSH_USERNAME}" != 'root' ]; then VAGRANT_SSH_FOLDER="/home/${VAGRANT_SSH_USERNAME}/.ssh"; - echo "Adding generated key to ${VAGRANT_SSH_FOLDER}/authorized_keys" - cat "${VAGRANT_CORE_FOLDER}/files/dot/ssh/id_rsa.pub" > "${VAGRANT_SSH_FOLDER}/authorized_keys" - chown "${VAGRANT_SSH_USERNAME}" "${VAGRANT_SSH_FOLDER}/authorized_keys" - chgrp "${VAGRANT_SSH_USERNAME}" "${VAGRANT_SSH_FOLDER}/authorized_keys" - chmod 600 "${VAGRANT_SSH_FOLDER}/authorized_keys" -fi + mkdir -p "${VAGRANT_SSH_FOLDER}" -passwd -d vagrant >/dev/null + echo "Adding generated key to ${VAGRANT_SSH_FOLDER}/id_rsa" + echo "Adding generated key to ${VAGRANT_SSH_FOLDER}/id_rsa.pub" + echo "Adding generated key to ${VAGRANT_SSH_FOLDER}/authorized_keys" + + cp "${VAGRANT_CORE_FOLDER}/files/dot/ssh/id_rsa" "${VAGRANT_SSH_FOLDER}/id_rsa" + cp "${VAGRANT_CORE_FOLDER}/files/dot/ssh/id_rsa.pub" "${VAGRANT_SSH_FOLDER}/id_rsa.pub" + + if [[ ! -f "${VAGRANT_SSH_FOLDER}/authorized_keys" ]] || ! grep -q "${PUBLIC_SSH_KEY}" "${VAGRANT_SSH_FOLDER}/authorized_keys"; then + cat "${VAGRANT_CORE_FOLDER}/files/dot/ssh/id_rsa.pub" >> "${VAGRANT_SSH_FOLDER}/authorized_keys" + fi + + chown -R "${VAGRANT_SSH_USERNAME}" "${VAGRANT_SSH_FOLDER}" + chgrp -R "${VAGRANT_SSH_USERNAME}" "${VAGRANT_SSH_FOLDER}" + chmod 700 "${VAGRANT_SSH_FOLDER}" + chmod 644 "${VAGRANT_SSH_FOLDER}/id_rsa.pub" + chmod 600 "${VAGRANT_SSH_FOLDER}/id_rsa" + chmod 600 "${VAGRANT_SSH_FOLDER}/authorized_keys" + + passwd -d "${VAGRANT_SSH_USERNAME}" >/dev/null +fi diff --git a/dev/vagrant/dolibarrdev/puphpet/shell/update-puppet.sh b/dev/vagrant/dolibarrdev/puphpet/shell/update-puppet.sh deleted file mode 100644 index f8c1f5d2256..00000000000 --- a/dev/vagrant/dolibarrdev/puphpet/shell/update-puppet.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/bash - -export DEBIAN_FRONTEND=noninteractive - -VAGRANT_CORE_FOLDER=$(cat '/.puphpet-stuff/vagrant-core-folder.txt') - -OS=$(/bin/bash "${VAGRANT_CORE_FOLDER}/shell/os-detect.sh" ID) -RELEASE=$(/bin/bash "${VAGRANT_CORE_FOLDER}/shell/os-detect.sh" RELEASE) -CODENAME=$(/bin/bash "${VAGRANT_CORE_FOLDER}/shell/os-detect.sh" CODENAME) - -if [[ ! -f '/.puphpet-stuff/update-puppet' ]]; then - if [ "${OS}" == 'debian' ] || [ "${OS}" == 'ubuntu' ]; then - echo "Downloading http://apt.puppetlabs.com/puppetlabs-release-${CODENAME}.deb" - wget --quiet --tries=5 --connect-timeout=10 -O "/.puphpet-stuff/puppetlabs-release-${CODENAME}.deb" "http://apt.puppetlabs.com/puppetlabs-release-${CODENAME}.deb" - echo "Finished downloading http://apt.puppetlabs.com/puppetlabs-release-${CODENAME}.deb" - - dpkg -i "/.puphpet-stuff/puppetlabs-release-${CODENAME}.deb" >/dev/null - - echo 'Running update-puppet apt-get update' - apt-get update >/dev/null - echo 'Finished running update-puppet apt-get update' - - echo 'Updating Puppet to version 3.4.x' - apt-get install -y puppet-common=3.4.* puppet=3.4.* >/dev/null - apt-mark hold puppet puppet-common >/dev/null - PUPPET_VERSION=$(puppet help | grep 'Puppet v') - echo "Finished updating puppet to latest version: ${PUPPET_VERSION}" - - touch '/.puphpet-stuff/update-puppet' - elif [ "${OS}" == 'centos' ]; then - echo "Downloading http://yum.puppetlabs.com/el/${RELEASE}/products/x86_64/puppet-3.4.3-1.el6.noarch.rpm" - yum -y --nogpgcheck install "http://yum.puppetlabs.com/el/${RELEASE}/products/x86_64/puppet-3.4.3-1.el6.noarch.rpm" >/dev/null - echo "Finished downloading http://yum.puppetlabs.com/el/${RELEASE}/products/x86_64/puppet-3.4.3-1.el6.noarch.rpm" - - echo 'Installing/Updating Puppet to version 3.4.x' - yum -y install yum-versionlock puppet >/dev/null - yum versionlock puppet - PUPPET_VERSION=$(puppet help | grep 'Puppet v') - echo "Finished installing/updating puppet to version: ${PUPPET_VERSION}" - - touch '/.puphpet-stuff/update-puppet' - fi -fi diff --git a/htdocs/.gitignore b/htdocs/.gitignore index a4ebd2bb7c7..8ba0a69acb3 100644 --- a/htdocs/.gitignore +++ b/htdocs/.gitignore @@ -2,6 +2,7 @@ /custom* /extensions* /nltechno* +/anco* /bootstrap* /google* /multicompany* diff --git a/htdocs/accountancy/class/index.html b/htdocs/accountancy/class/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/accountancy/index.html b/htdocs/accountancy/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/accountancy/index.php b/htdocs/accountancy/index.php deleted file mode 100644 index 7db0dd9ebf9..00000000000 --- a/htdocs/accountancy/index.php +++ /dev/null @@ -1 +0,0 @@ -Url not available \ No newline at end of file diff --git a/htdocs/adherents/admin/adherent.php b/htdocs/adherents/admin/adherent.php index 0a251536ff6..670260f1287 100644 --- a/htdocs/adherents/admin/adherent.php +++ b/htdocs/adherents/admin/adherent.php @@ -68,11 +68,11 @@ if ($action == 'update' || $action == 'add') if (! $error) { - $mesg = '
'.$langs->trans("SetupSaved").'
'; + setEventMessage($langs->trans("SetupSaved")); } else { - $mesg = '
'.$langs->trans("Error").'
'; + setEventMessage($langs->trans("Error"), 'errors'); } } @@ -117,10 +117,6 @@ $head = member_admin_prepare_head(); dol_fiche_head($head, 'general', $langs->trans("Members"), 0, 'user'); - -dol_htmloutput_mesg($mesg); - - print_fiche_titre($langs->trans("MemberMainOptions"),'',''); print ''; print ''; diff --git a/htdocs/adherents/admin/adherent_extrafields.php b/htdocs/adherents/admin/adherent_extrafields.php index 059e42d50f5..1c98c2c16ba 100644 --- a/htdocs/adherents/admin/adherent_extrafields.php +++ b/htdocs/adherents/admin/adherent_extrafields.php @@ -35,7 +35,7 @@ $extrafields = new ExtraFields($db); $form = new Form($db); // List of supported format -$tmptype2label=getStaticMember(get_class($extrafields),'type2label'); +$tmptype2label=ExtraFields::$type2label; $type2label=array(''); foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val); diff --git a/htdocs/adherents/admin/adherent_type_extrafields.php b/htdocs/adherents/admin/adherent_type_extrafields.php index dca8796b681..b2f839e3c3c 100644 --- a/htdocs/adherents/admin/adherent_type_extrafields.php +++ b/htdocs/adherents/admin/adherent_type_extrafields.php @@ -36,7 +36,7 @@ $extrafields = new ExtraFields($db); $form = new Form($db); // List of supported format -$tmptype2label=getStaticMember(get_class($extrafields),'type2label'); +$tmptype2label=ExtraFields::$type2label; $type2label=array(''); foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val); diff --git a/htdocs/adherents/admin/public.php b/htdocs/adherents/admin/public.php index 8a520a55c4e..740a5c97879 100644 --- a/htdocs/adherents/admin/public.php +++ b/htdocs/adherents/admin/public.php @@ -60,11 +60,11 @@ if ($action == 'update') if (! $error) { - $mesg = "".$langs->trans("SetupSaved").""; + setEventMessage($langs->trans("SetupSaved")); } else { - $mesg = "".$langs->trans("Error").""; + setEventMessage($langs->trans("Error"), 'errors'); } } @@ -86,8 +86,6 @@ $head = member_admin_prepare_head(); dol_fiche_head($head, 'public', $langs->trans("Members"), 0, 'user'); -dol_htmloutput_mesg($mesg); - if ($conf->use_javascript_ajax) { print "\n".' +
trans("Article"); ?> @@ -103,7 +104,9 @@ $langs->load("cashdesk");
- + - + @@ -154,7 +159,9 @@ $langs->load("cashdesk"); - + diff --git a/htdocs/cashdesk/tpl/index.html b/htdocs/cashdesk/tpl/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/cashdesk/tpl/index.php b/htdocs/cashdesk/tpl/index.php deleted file mode 100644 index 7db0dd9ebf9..00000000000 --- a/htdocs/cashdesk/tpl/index.php +++ /dev/null @@ -1 +0,0 @@ -Url not available \ No newline at end of file diff --git a/htdocs/cashdesk/tpl/menu.tpl.php b/htdocs/cashdesk/tpl/menu.tpl.php index 59800fb57c1..4ee52ce0da6 100644 --- a/htdocs/cashdesk/tpl/menu.tpl.php +++ b/htdocs/cashdesk/tpl/menu.tpl.php @@ -78,4 +78,3 @@ if (!empty($_SESSION["CASHDESK_ID_WAREHOUSE"]) && ! empty($conf->stock->enabled) } print ''; print ''; -?> \ No newline at end of file diff --git a/htdocs/cashdesk/tpl/ticket.tpl.php b/htdocs/cashdesk/tpl/ticket.tpl.php index 54e82c3ded7..9ea8cb70943 100644 --- a/htdocs/cashdesk/tpl/ticket.tpl.php +++ b/htdocs/cashdesk/tpl/ticket.tpl.php @@ -153,4 +153,5 @@ echo '
trans("VATRate"); ?>
+ + @@ -112,7 +115,9 @@ $langs->load("cashdesk"); currency; ?> + + currency; ?> + +
'.$langs->trans("TotalTTC").'trans("Close"); ?> - \ No newline at end of file + + diff --git a/htdocs/categories/admin/categorie_extrafields.php b/htdocs/categories/admin/categorie_extrafields.php index 6f8369afc89..2da54e77712 100644 --- a/htdocs/categories/admin/categorie_extrafields.php +++ b/htdocs/categories/admin/categorie_extrafields.php @@ -35,7 +35,7 @@ $extrafields = new ExtraFields($db); $form = new Form($db); // List of supported format -$tmptype2label=getStaticMember(get_class($extrafields),'type2label'); +$tmptype2label=ExtraFields::$type2label; $type2label=array(''); foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val); diff --git a/htdocs/categories/admin/index.html b/htdocs/categories/admin/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index ad436d5c6c8..f9c4a96dcaa 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -87,10 +87,10 @@ class Categorie extends CommonObject else { - if ($label) $sql.= " WHERE label = '".$this->db->escape($label)."' AND entity=".$conf->entity;; + if ($label) $sql.= " WHERE label = '".$this->db->escape($label)."' AND entity IN (".getEntity('category',1).")"; } - dol_syslog(get_class($this)."::fetch sql=".$sql); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -137,7 +137,7 @@ class Categorie extends CommonObject * -3 : categorie invalide * -4 : category already exists */ - function create($user='') + function create($user) { global $conf,$langs,$hookmanager; $langs->load('categories'); @@ -161,7 +161,7 @@ class Categorie extends CommonObject $this->db->begin(); - dol_syslog(get_class($this).'::create sql='.$sql); + dol_syslog(get_class($this).'::create', LOG_DEBUG); $sql = "INSERT INTO ".MAIN_DB_PREFIX."categorie ("; $sql.= "fk_parent,"; $sql.= " label,"; @@ -188,7 +188,7 @@ class Categorie extends CommonObject $sql.= $conf->entity; $sql.= ")"; - dol_syslog(get_class($this).'::create sql='.$sql); + dol_syslog(get_class($this).'::create', LOG_DEBUG); $res = $this->db->query($sql); if ($res) { @@ -216,15 +216,21 @@ class Categorie extends CommonObject } else if ($reshook < 0) $error++; - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('CATEGORY_CREATE',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('CATEGORY_CREATE',$user); + if ($result < 0) { $error++; } + // End call triggers - $this->db->commit(); - return $id; + if ( ! $error ) + { + $this->db->commit(); + return $id; + } + else + { + $this->db->rollback(); + return -3; + } } else { @@ -235,7 +241,6 @@ class Categorie extends CommonObject else { $this->error=$this->db->error(); - dol_syslog(get_class($this)."::create error ".$this->error." sql=".$sql, LOG_ERR); $this->db->rollback(); return -1; } @@ -281,7 +286,7 @@ class Categorie extends CommonObject $sql .= ", fk_parent = ".$this->fk_parent; $sql .= " WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::update sql=".$sql); + dol_syslog(get_class($this)."::update", LOG_DEBUG); if ($this->db->query($sql)) { @@ -306,12 +311,10 @@ class Categorie extends CommonObject $this->db->commit(); - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('CATEGORY_MODIFY',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('CATEGORY_MODIFY',$user); + if ($result < 0) { $error++; $this->db->rollback(); return -1; } + // End call triggers return 1; } @@ -335,6 +338,9 @@ class Categorie extends CommonObject $error=0; + // Clean parameters + $this->fk_parent = ($this->fk_parent != "" ? intval($this->fk_parent) : 0); + dol_syslog(get_class($this)."::remove"); $this->db->begin(); @@ -349,7 +355,6 @@ class Categorie extends CommonObject if (!$this->db->query($sql)) { $this->error=$this->db->lasterror(); - dol_syslog("Error sql=".$sql." ".$this->error, LOG_ERR); $error++; } } @@ -360,7 +365,6 @@ class Categorie extends CommonObject if (!$this->db->query($sql)) { $this->error=$this->db->lasterror(); - dol_syslog("Error sql=".$sql." ".$this->error, LOG_ERR); $error++; } } @@ -371,7 +375,6 @@ class Categorie extends CommonObject if (!$this->db->query($sql)) { $this->error=$this->db->lasterror(); - dol_syslog("Error sql=".$sql." ".$this->error, LOG_ERR); $error++; } } @@ -382,7 +385,6 @@ class Categorie extends CommonObject if (!$this->db->query($sql)) { $this->error=$this->db->lasterror(); - dol_syslog("Error sql=".$sql." ".$this->error, LOG_ERR); $error++; } } @@ -393,7 +395,6 @@ class Categorie extends CommonObject if (!$this->db->query($sql)) { $this->error=$this->db->lasterror(); - dol_syslog("Error sql=".$sql." ".$this->error, LOG_ERR); $error++; } } @@ -404,7 +405,6 @@ class Categorie extends CommonObject if (!$this->db->query($sql)) { $this->error=$this->db->lasterror(); - dol_syslog("Error sql=".$sql." ".$this->error, LOG_ERR); $error++; } } @@ -417,7 +417,6 @@ class Categorie extends CommonObject if (!$this->db->query($sql)) { $this->error=$this->db->lasterror(); - dol_syslog("Error sql=".$sql." ".$this->error, LOG_ERR); $error++; } else @@ -435,12 +434,10 @@ class Categorie extends CommonObject } } } - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('CATEGORY_DELETE',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; $this->error=join(',',$this->errors); } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('CATEGORY_DELETE',$user); + if ($result < 0) { $error++; } + // End call triggers } } @@ -480,10 +477,12 @@ class Categorie extends CommonObject if ($type=='contact') $column_name='socpeople'; if ($type=='fournisseur') $column_name='societe'; + $this->db->begin(); + $sql = "INSERT INTO ".MAIN_DB_PREFIX."categorie_".$type." (fk_categorie, fk_".$column_name.")"; $sql .= " VALUES (".$this->id.", ".$obj->id.")"; - dol_syslog(get_class($this).'::add_type sql='.$sql); + dol_syslog(get_class($this).'::add_type', LOG_DEBUG); if ($this->db->query($sql)) { if (! empty($conf->global->CATEGORIE_RECURSIV_ADD)) @@ -491,7 +490,7 @@ class Categorie extends CommonObject $sql = 'SELECT fk_parent FROM '.MAIN_DB_PREFIX.'categorie'; $sql.= " WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::add_type sql=".$sql); + dol_syslog(get_class($this)."::add_type", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -520,6 +519,7 @@ class Categorie extends CommonObject if ($error) { + $this->db->rollback(); return -1; } } @@ -527,18 +527,26 @@ class Categorie extends CommonObject // Save object we want to link category to into category instance to provide information to trigger $this->linkto=$obj; - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('CATEGORY_LINK',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; $this->error=$interface->error; } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('CATEGORY_LINK',$user); + if ($result < 0) { $error++; } + // End call triggers + + if (! $error) + { + $this->db->commit(); + return 1; + } + else + { + $this->db->rollback(); + return -2; + } - if (! $error) return 1; - else return -2; } else { + $this->db->rollback(); if ($this->db->lasterrno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $this->error=$this->db->lasterrno(); @@ -574,28 +582,37 @@ class Categorie extends CommonObject if ($type=='contact') $column_name='socpeople'; if ($type=='fournisseur') $column_name='societe'; + $this->db->begin(); + $sql = "DELETE FROM ".MAIN_DB_PREFIX."categorie_".$type; $sql .= " WHERE fk_categorie = ".$this->id; $sql .= " AND fk_".$column_name." = ".$obj->id; - dol_syslog(get_class($this).'::del_type sql='.$sql); + dol_syslog(get_class($this).'::del_type', LOG_DEBUG); if ($this->db->query($sql)) { // Save object we want to unlink category off into category instance to provide information to trigger $this->unlinkoff=$obj; - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('CATEGORY_UNLINK',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('CATEGORY_UNLINK',$user); + if ($result < 0) { $error++; } + // End call triggers - if (! $error) return 1; - else return -2; + if (! $error) + { + $this->db->commit(); + return 1; + } + else + { + $this->db->rollback(); + return -2; + } } else { + $this->db->rollback(); $this->error=$this->db->lasterror(); return -1; } @@ -629,7 +646,7 @@ class Categorie extends CommonObject $sql.= " AND c.fk_categorie = ".$this->id; $sql.= " AND c.fk_".$field." = o.rowid"; - dol_syslog(get_class($this)."::getObjectsInCateg sql=".$sql); + dol_syslog(get_class($this)."::getObjectsInCateg", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -644,7 +661,6 @@ class Categorie extends CommonObject else { $this->error=$this->db->error().' sql='.$sql; - dol_syslog(get_class($this)."::getObjectsInCateg ".$this->error, LOG_ERR); return -1; } } @@ -682,13 +698,12 @@ class Categorie extends CommonObject } $sql = "SELECT COUNT(*) as nb FROM " . MAIN_DB_PREFIX . "categorie_" . $category_table; $sql .= " WHERE fk_categorie = " . $this->id . " AND fk_" . $field . " = " . $object_id; - dol_syslog(get_class($this)."::containsObject sql=".$sql); + dol_syslog(get_class($this)."::containsObject", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { return $this->db->fetch_object($resql)->nb; } else { $this->error=$this->db->error().' sql='.$sql; - dol_syslog(get_class($this)."::containsObject ".$this->error, LOG_ERR); return -1; } } @@ -740,7 +755,7 @@ class Categorie extends CommonObject $sql.= " WHERE fk_parent != 0"; $sql.= " AND entity IN (".getEntity('category',1).")"; - dol_syslog(get_class($this)."::load_motherof sql=".$sql); + dol_syslog(get_class($this)."::load_motherof", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -791,7 +806,7 @@ class Categorie extends CommonObject $sql.= " WHERE c.entity IN (".getEntity('category',1).")"; $sql.= " AND c.type = ".$type; - dol_syslog(get_class($this)."::get_full_arbo get category list sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::get_full_arbo get category list", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -985,7 +1000,7 @@ class Categorie extends CommonObject $sql.= " AND c.fk_parent = ".$this->fk_parent; $sql.= " AND c.label = '".$this->db->escape($this->label)."'"; - dol_syslog(get_class($this)."::already_exists sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::already_exists", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -1009,7 +1024,6 @@ class Categorie extends CommonObject else { $this->error=$this->db->error(); - dol_syslog(get_class($this)."::already_exists error ".$this->error." sql=".$sql, LOG_ERR); return -1; } } @@ -1148,7 +1162,7 @@ class Categorie extends CommonObject $sql.= " WHERE ct.fk_categorie = c.rowid AND ct.fk_".$table." = ".$id." AND c.type = ".$typeid; $sql.= " AND c.entity IN (".getEntity('category',1).")"; - dol_syslog(get_class($this).'::containing sql='.$sql); + dol_syslog(get_class($this).'::containing', LOG_DEBUG); $res = $this->db->query($sql); if ($res) { @@ -1230,7 +1244,6 @@ class Categorie extends CommonObject else { $this->error=$this->db->error().' sql='.$sql; - dol_syslog(get_class($this)."::rechercher ".$this->error, LOG_ERR); return -1; } } @@ -1450,11 +1463,10 @@ class Categorie extends CommonObject $sql2.= " VALUES(".$this->id.",'".$key."','". $this->db->escape($this->label); $sql2.= "','".$this->db->escape($this->multilangs["$key"]["description"])."')"; } - dol_syslog(get_class($this).'::setMultiLangs sql='.$sql2); + dol_syslog(get_class($this).'::setMultiLangs', LOG_DEBUG); if (! $this->db->query($sql2)) { $this->error=$this->db->lasterror(); - dol_syslog(get_class($this).'::setMultiLangs error='.$this->error, LOG_ERR); return -1; } } @@ -1476,11 +1488,10 @@ class Categorie extends CommonObject // 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 sql='.$sql2); + dol_syslog(get_class($this).'::setMultiLangs', LOG_DEBUG); if (! $this->db->query($sql2)) { $this->error=$this->db->lasterror(); - dol_syslog(get_class($this).'::setMultiLangs error='.$this->error, LOG_ERR); return -1; } } diff --git a/htdocs/categories/class/index.html b/htdocs/categories/class/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/categories/edit.php b/htdocs/categories/edit.php index 0c61ab8cca6..aa82fdb455d 100644 --- a/htdocs/categories/edit.php +++ b/htdocs/categories/edit.php @@ -80,12 +80,12 @@ if ($action == 'update' && $user->rights->categorie->creer) if (empty($categorie->label)) { $action = 'create'; - $mesg = $langs->trans("ErrorFieldRequired",$langs->transnoentities("Label")); + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Label")), 'errors'); } if (empty($categorie->description)) { $action = 'create'; - $mesg = $langs->trans("ErrorFieldRequired",$langs->transnoentities("Description")); + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Description")), 'errors'); } if (empty($categorie->error)) { @@ -98,12 +98,12 @@ if ($action == 'update' && $user->rights->categorie->creer) } else { - $mesg=$categorie->error; + setEventMessage($categorie->error, 'errors'); } } else { - $mesg=$categorie->error; + setEventMessage($categorie->error, 'errors'); } } @@ -117,10 +117,6 @@ llxHeader("","",$langs->trans("Categories")); print_fiche_titre($langs->trans("ModifCat")); - -dol_htmloutput_errors($mesg); - - $object->fetch($id); $form = new Form($db); diff --git a/htdocs/categories/fiche.php b/htdocs/categories/fiche.php index aca14acce2b..9a41d1b389a 100644 --- a/htdocs/categories/fiche.php +++ b/htdocs/categories/fiche.php @@ -131,14 +131,14 @@ if ($action == 'add' && $user->rights->categorie->creer) if (! $object->label) { $error++; - $errors[] = $langs->trans("ErrorFieldRequired",$langs->transnoentities("Ref")); + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Ref")), 'errors'); $action = 'create'; } // Create category in database if (! $error) { - $result = $object->create(); + $result = $object->create($user); if ($result > 0) { $action = 'confirmed'; @@ -224,8 +224,6 @@ if ($user->rights->categorie->creer) print_fiche_titre($langs->trans("CreateCat")); - dol_htmloutput_errors('',$errors); - print ''; // Ref diff --git a/htdocs/categories/traduction.php b/htdocs/categories/traduction.php index 15e8f7f6a5f..0c154a0b72f 100644 --- a/htdocs/categories/traduction.php +++ b/htdocs/categories/traduction.php @@ -94,7 +94,7 @@ $cancel != $langs->trans("Cancel") && else { $action = 'add'; - $mesg = '
'.$object->error.'
'; + setEventMessage($object->error, 'errors'); } } @@ -127,7 +127,7 @@ $cancel != $langs->trans("Cancel") && else { $action = 'edit'; - $mesg = '
'.$object->error.'
'; + setEventMessage($object->error, 'errors'); } } @@ -153,10 +153,6 @@ else $title=$langs->trans("Category"); $head = categories_prepare_head($object,$type); dol_fiche_head($head, 'translation', $title, 0, 'category'); -if (! empty($mesg)) { - dol_htmloutput_mesg($mesg); -} - print '
'; // Reference diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index bec834e1ff9..898d6626539 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -32,7 +32,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; $langs->load("categories"); -$mesg = ''; $id=GETPOST('id','int'); $ref=GETPOST('ref'); $type=GETPOST('type'); @@ -117,7 +116,7 @@ if ($user->rights->categorie->supprimer && $action == 'confirm_delete' && $confi } else { - $mesg='
'.$object->error.'
'; + setEventMessage($object->error, 'errors'); } } @@ -131,8 +130,6 @@ $form = new Form($db); llxHeader("","",$langs->trans("Categories")); -dol_htmloutput_mesg($mesg); - if ($type == 0) $title=$langs->trans("ProductsCategoryShort"); elseif ($type == 1) $title=$langs->trans("SuppliersCategoryShort"); elseif ($type == 2) $title=$langs->trans("CustomersCategoryShort"); @@ -519,5 +516,5 @@ if($object->type == 4) llxFooter(); + $db->close(); -?> \ No newline at end of file diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index ee9e4c032ee..18bef50369d 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -202,7 +202,7 @@ class ActionComm extends CommonObject $sql.= $conf->entity; $sql.= ")"; - dol_syslog(get_class($this)."::add sql=".$sql); + dol_syslog(get_class($this)."::add", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -227,14 +227,10 @@ class ActionComm extends CommonObject if (! $error && ! $notrigger) { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('ACTION_CREATE',$this,$user,$langs,$conf); - if ($result < 0) { - $error++; $this->errors=$interface->errors; - } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('ACTION_CREATE',$user); + if ($result < 0) { $error++; } + // End call triggers } if (! $error) @@ -252,7 +248,6 @@ class ActionComm extends CommonObject { $this->db->rollback(); $this->error=$this->db->lasterror(); - dol_syslog(get_class($this)."::add ".$this->error,LOG_ERR); return -1; } @@ -292,7 +287,7 @@ class ActionComm extends CommonObject $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on s.rowid = a.fk_soc"; $sql.= " WHERE a.id=".$id." AND a.fk_action=c.id"; - dol_syslog(get_class($this)."::fetch sql=".$sql); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -369,7 +364,7 @@ class ActionComm extends CommonObject $sql = "DELETE FROM ".MAIN_DB_PREFIX."actioncomm"; $sql.= " WHERE id=".$this->id; - dol_syslog(get_class($this)."::delete sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); $res=$this->db->query($sql); if ($res < 0) { $this->error=$this->db->lasterror(); @@ -390,14 +385,10 @@ class ActionComm extends CommonObject { if (! $notrigger) { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('ACTION_DELETE',$this,$user,$langs,$conf); - if ($result < 0) { - $error++; $this->errors=$interface->errors; - } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('ACTION_DELETE',$user); + if ($result < 0) { $error++; } + // End call triggers } if (! $error) @@ -415,7 +406,6 @@ class ActionComm extends CommonObject { $this->db->rollback(); $this->error=$this->db->lasterror(); - dol_syslog(get_class($this)."::delete ".$this->error,LOG_ERR); return -1; } } @@ -477,7 +467,7 @@ class ActionComm extends CommonObject $sql.= ", fk_user_done=".($this->userdone->id > 0 ? "'".$this->userdone->id."'":"null"); $sql.= " WHERE id=".$this->id; - dol_syslog(get_class($this)."::update sql=".$sql); + dol_syslog(get_class($this)."::update", LOG_DEBUG); if ($this->db->query($sql)) { @@ -500,14 +490,10 @@ class ActionComm extends CommonObject if (! $notrigger) { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('ACTION_MODIFY',$this,$user,$langs,$conf); - if ($result < 0) { - $error++; $this->errors=$interface->errors; - } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('ACTION_MODIFY',$user); + if ($result < 0) { $error++; } + // End call triggers } if (! $error) @@ -526,7 +512,6 @@ class ActionComm extends CommonObject { $this->db->rollback(); $this->error=$this->db->lasterror(); - dol_syslog(get_class($this)."::update ".$this->error,LOG_ERR); return -1; } } @@ -558,7 +543,7 @@ class ActionComm extends CommonObject } if (! empty($filter)) $sql.= $filter; - dol_syslog(get_class()."::getActions sql=".$sql); + dol_syslog(get_class()."::getActions", LOG_DEBUG); $resql=$db->query($sql); if ($resql) { @@ -644,7 +629,7 @@ class ActionComm extends CommonObject $sql.= ' FROM '.MAIN_DB_PREFIX.'actioncomm as a'; $sql.= ' WHERE a.id = '.$id; - dol_syslog(get_class($this)."::info sql=".$sql); + dol_syslog(get_class($this)."::info", LOG_DEBUG); $result=$this->db->query($sql); if ($result) { @@ -930,7 +915,7 @@ class ActionComm extends CommonObject $sql.= " ORDER by datep"; //print $sql;exit; - dol_syslog(get_class($this)."::build_exportfile select events sql=".$sql); + dol_syslog(get_class($this)."::build_exportfile select events", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -976,7 +961,6 @@ class ActionComm extends CommonObject else { $this->error=$this->db->lasterror(); - dol_syslog(get_class($this)."::build_exportfile ".$this->db->lasterror(), LOG_ERR); return -1; } @@ -1070,4 +1054,3 @@ class ActionComm extends CommonObject } -?> diff --git a/htdocs/comm/action/class/cactioncomm.class.php b/htdocs/comm/action/class/cactioncomm.class.php index 68960c5a6c0..8908b4e2a46 100644 --- a/htdocs/comm/action/class/cactioncomm.class.php +++ b/htdocs/comm/action/class/cactioncomm.class.php @@ -64,7 +64,7 @@ class CActionComm if (is_numeric($id)) $sql.= " WHERE id=".$id; else $sql.= " WHERE code='".$id."'"; - dol_syslog(get_class($this)."::fetch sql=".$sql); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -117,7 +117,7 @@ class CActionComm if (! empty($excludetype)) $sql.=($active != ''?" AND":" WHERE")." type <> '".$excludetype."'"; $sql.= " ORDER BY module, position"; - dol_syslog(get_class($this)."::liste_array sql=".$sql); + dol_syslog(get_class($this)."::liste_array", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { diff --git a/htdocs/comm/action/class/index.html b/htdocs/comm/action/class/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/comm/action/contact.php b/htdocs/comm/action/contact.php index 84b50893844..334da53a2f4 100644 --- a/htdocs/comm/action/contact.php +++ b/htdocs/comm/action/contact.php @@ -156,8 +156,6 @@ llxHeader('',$langs->trans("Agenda"),$help_url); if ($id > 0 || ! empty($ref)) { - dol_htmloutput_mesg($mesg,$mesgs); - if ($object->fetch($id,$ref) > 0) { diff --git a/htdocs/comm/action/fiche.php b/htdocs/comm/action/fiche.php index d17b1acb4f0..6a11985aa6a 100644 --- a/htdocs/comm/action/fiche.php +++ b/htdocs/comm/action/fiche.php @@ -5,6 +5,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2010-2013 Juanjo Menent * Copyright (C) 2013 Florian Henry + * Copyright (C) 2014 Cedric GROSS * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -62,7 +63,6 @@ $result = restrictedArea($user, 'agenda', $id, 'actioncomm&societe', 'myactions| if ($user->societe_id && $socid) $result = restrictedArea($user,'societe',$socid); $error=GETPOST("error"); -$mesg=''; $cactioncomm = new CActionComm($db); $object = new ActionComm($db); @@ -116,14 +116,14 @@ if ($action == 'add_action') { $error++; $action = 'create'; - $mesg='
'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("DateEnd")).'
'; + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("DateEnd")), 'errors'); } if (empty($conf->global->AGENDA_USE_EVENT_TYPE) && ! GETPOST('label')) { $error++; $action = 'create'; - $mesg='
'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Title")).'
'; + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Title")), 'errors'); } // Initialisation objet cactioncomm @@ -131,7 +131,7 @@ if ($action == 'add_action') { $error++; $action = 'create'; - $mesg='
'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")).'
'; + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")), 'errors'); } else { @@ -201,14 +201,14 @@ if ($action == 'add_action') { $error++; $action = 'create'; - $mesg='
'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("DateEnd")).'
'; + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("DateEnd")), 'errors'); } if (! GETPOST('apyear') && ! GETPOST('adyear')) { $error++; $action = 'create'; - $mesg='
'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date")).'
'; + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date")), 'errors'); } // Fill array 'array_options' with data from add form @@ -283,8 +283,7 @@ if ($action == 'confirm_delete' && GETPOST("confirm") == 'yes') } else { - $mesg=$object->error; - setEventMessage($mesg,'errors'); + setEventMessage($object->error,'errors'); } } } @@ -386,7 +385,48 @@ if ($action == 'update') } } +/* + * Action move update, used when user move an event in calendar by drag'n drop + */ +if ($action == 'mupdate') +{ + $object->fetch($id); + $shour = dol_print_date($object->datep,"%H"); + $smin = dol_print_date($object->datep, "%M"); + + $newdate=GETPOST('newdate','alpha'); + if (empty($newdate) || strpos($newdate,'dayevent_') != 0 ) + { + header("Location: ".$backtopage); + exit; + } + $datep=dol_mktime($shour, $smin, 0, substr($newdate,13,2), substr($newdate,15,2), substr($newdate,9,4)); + if ($datep!=$object->datep) + { + if (!empty($object->datef)) + { + $object->datef+=$datep-$object->datep; + } + $object->datep=$datep; + $result=$object->update($user); + if ($result < 0) + { + setEventMessage($object->error,'errors'); + setEventMessage($object->errors,'errors'); + } + } + if (! empty($backtopage)) + { + header("Location: ".$backtopage); + exit; + } + else + { + $action=''; + } + +} /* * View */ @@ -395,7 +435,7 @@ $help_url='EN:Module_Agenda_En|FR:Module_Agenda|ES:M&omodulodulo_Agenda'; llxHeader('',$langs->trans("Agenda"),$help_url); $form = new Form($db); -$htmlactions = new FormActions($db); +$formactions = new FormActions($db); if ($action == 'create') { @@ -459,15 +499,13 @@ if ($action == 'create') if (GETPOST("actioncode") == 'AC_RDV') print_fiche_titre($langs->trans("AddActionRendezVous")); else print_fiche_titre($langs->trans("AddAnAction")); - dol_htmloutput_mesg($mesg); - print '
'; // Type d'action actifs if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) { print ''; } else print ''; @@ -512,7 +550,7 @@ if ($action == 'create') if (GETPOST("afaire") == 1) $percent=0; else if (GETPOST("afaire") == 2) $percent=100; } - $htmlactions->form_select_status_action('formaction',$percent,1,'complete'); + $formactions->form_select_status_action('formaction',$percent,1,'complete'); print ''; // Location @@ -532,7 +570,7 @@ if ($action == 'create') // Busy print ''; // Realised by @@ -645,10 +683,6 @@ if ($id > 0) { dol_htmloutput_errors($error); } - if ($mesg) - { - dol_htmloutput_mesg($mesg); - } $result=$object->fetch($id); $object->fetch_optionals($id,$extralabels); @@ -740,7 +774,7 @@ if ($id > 0) if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) { print ''; } @@ -766,7 +800,7 @@ if ($id > 0) // Status print ''; // Location @@ -1049,7 +1083,7 @@ if ($id > 0) print $extrafields->showOutputField($key,$value); print "\n"; } - print '
'.$langs->trans("Type").''; - $htmlactions->select_type_actions(GETPOST("actioncode")?GETPOST("actioncode"):$object->type_code, "actioncode","systemauto"); + $formactions->select_type_actions(GETPOST("actioncode")?GETPOST("actioncode"):$object->type_code, "actioncode","systemauto"); print '
'.$langs->trans("Busy").''; - print 'transparency?' checked="checked"':'').'>'; + print ''; print '
'.$langs->trans("Type").''; - $htmlactions->select_type_actions(GETPOST("actioncode")?GETPOST("actioncode"):$object->type_code, "actioncode","systemauto"); + $formactions->select_type_actions(GETPOST("actioncode")?GETPOST("actioncode"):$object->type_code, "actioncode","systemauto"); print '
'.$langs->trans("Status").' / '.$langs->trans("Percentage").''; $percent=GETPOST("percentage")?GETPOST("percentage"):$object->percentage; - $htmlactions->form_select_status_action('formaction',$percent,1); + $formactions->form_select_status_action('formaction',$percent,1); print '


'; + print '
'; } dol_fiche_end(); diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 92b87d94ad1..318d7efbee9 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -1,9 +1,10 @@ * Copyright (C) 2003 Eric Seigne - * Copyright (C) 2004-2013 Laurent Destailleur + * Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2011 Juanjo Menent + * Copyright (C) 2014 Cedric GROSS * * 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 +43,7 @@ $filter=GETPOST("filter",'',3); $filtera = GETPOST("userasked","int",3)?GETPOST("userasked","int",3):GETPOST("filtera","int",3); $filtert = GETPOST("usertodo","int",3)?GETPOST("usertodo","int",3):GETPOST("filtert","int",3); $filterd = GETPOST("userdone","int",3)?GETPOST("userdone","int",3):GETPOST("filterd","int",3); +$usergroup = GETPOST("usergroup","int",3); $showbirthday = empty($conf->use_javascript_ajax)?GETPOST("showbirthday","int"):1; @@ -55,9 +57,10 @@ if (! $sortorder) $sortorder="ASC"; if (! $sortfield) $sortfield="a.datec"; // Security check -$socid = GETPOST("socid","int",1); +$socid = GETPOST("socid","int"); if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'agenda', 0, '', 'myactions'); +if ($socid < 0) $socid=''; $canedit=1; if (! $user->rights->agenda->myactions->read) accessforbidden(); @@ -79,28 +82,36 @@ $pid=GETPOST("projectid","int",3); $status=GETPOST("status"); $type=GETPOST("type"); $maxprint=(isset($_GET["maxprint"])?GETPOST("maxprint"):$conf->global->AGENDA_MAX_EVENTS_DAY_VIEW); -$actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_USE_EVENT_TYPE)?'AC_OTH':'')); +$actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=='0'?'0':''); + +if ($actioncode == '') $actioncode=(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE); +if ($status == '' && ! isset($_GET['status']) && ! isset($_POST['status'])) $status=(empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS)?'':$conf->global->AGENDA_DEFAULT_FILTER_STATUS); +if (empty($action) && ! isset($_GET['action']) && ! isset($_POST['action'])) $action=(empty($conf->global->AGENDA_DEFAULT_VIEW)?'show_month':$conf->global->AGENDA_DEFAULT_VIEW); if (GETPOST('viewcal') && $action != 'show_day' && $action != 'show_week') { $action='show_month'; $day=''; } // View by month -if (GETPOST('viewweek')) { +if (GETPOST('viewweek') || $action == 'show_week') { $action='show_week'; $week=($week?$week:date("W")); $day=($day?$day:date("d")); } // View by week -if (GETPOST('viewday')) { +if (GETPOST('viewday') || $action == 'show_day') { $action='show_day'; $day=($day?$day:date("d")); } // View by day + $langs->load("agenda"); $langs->load("other"); $langs->load("commercial"); +// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +$hookmanager->initHooks(array('agenda')); /* * Actions */ -if (GETPOST("viewlist")) + +if (GETPOST("viewlist") || $action == 'show_list') { $param=''; foreach($_POST as $key => $val) @@ -113,7 +124,20 @@ if (GETPOST("viewlist")) exit; } -if ($action=='delete_action') +if (GETPOST("viewperuser") || $action == 'show_peruser') +{ + $param=''; + foreach($_POST as $key => $val) + { + if ($key=='token') continue; + $param.='&'.$key.'='.urlencode($val); + } + //print $param; + header("Location: ".DOL_URL_ROOT.'/comm/action/peruser.php?'.$param); + exit; +} + +if ($action =='delete_action') { $event = new ActionComm($db); $event->fetch($actionid); @@ -134,9 +158,14 @@ $companystatic=new Societe($db); $contactstatic=new Contact($db); $now=dol_now(); +$nowarray=dol_getdate($now); +$nowyear=$nowarray['year']; +$nowmonth=$nowarray['mon']; +$nowday=$nowarray['mday']; -// Define list of all external calendars $listofextcals=array(); + +// Define list of external calendars (global admin setup) if (empty($conf->global->AGENDA_DISABLE_EXT) && $conf->global->AGENDA_EXT_NB > 0) { $i=0; @@ -154,7 +183,22 @@ if (empty($conf->global->AGENDA_DISABLE_EXT) && $conf->global->AGENDA_EXT_NB > 0 } } } - +// Define list of external calendars (user setup) +$i=0; +while($i < $conf->global->AGENDA_EXT_NB) +{ + $i++; + $source='AGENDA_EXT_SRC_'.$user->id.'_'.$i; + $name='AGENDA_EXT_NAME_'.$user->id.'_'.$i; + $color='AGENDA_EXT_COLOR_'.$user->id.'_'.$i; + $enabled='AGENDA_EXT_ENABLED_'.$user->id.'_'.$i; + $buggedfile='AGENDA_EXT_BUGGEDFILE_'.$user->id.'_'.$i; + if (! empty($user->conf->$source) && ! empty($user->conf->$name)) + { + // Note: $conf->global->buggedfile can be empty or 'uselocalandtznodaylight' or 'uselocalandtzdaylight' + $listofextcals[]=array('src'=>$user->conf->$source,'name'=>$user->conf->$name,'color'=>$user->conf->$color,'buggedfile'=>(isset($user->conf->buggedfile)?$user->conf->buggedfile:0)); + } +} if (empty($action) || $action=='show_month') { @@ -226,8 +270,8 @@ if ($status == 'done') $title=$langs->trans("DoneActions"); if ($status == 'todo') $title=$langs->trans("ToDoActions"); $param=''; -$region=''; -if ($status) $param="&status=".$status; +if ($actioncode || isset($_GET['actioncode']) || isset($_POST['actioncode'])) $param.="&actioncode=".$actioncode; +if ($status || isset($_GET['status']) || isset($_POST['status'])) $param.="&status=".$status; if ($filter) $param.="&filter=".$filter; if ($filtera) $param.="&filtera=".$filtera; if ($filtert) $param.="&filtert=".$filtert; @@ -235,34 +279,36 @@ if ($filterd) $param.="&filterd=".$filterd; if ($socid) $param.="&socid=".$socid; if ($showbirthday) $param.="&showbirthday=1"; if ($pid) $param.="&projectid=".$pid; -if ($actioncode != '') $param.="&actioncode=".$actioncode; if ($type) $param.="&type=".$type; -if ($action == 'show_day' || $action == 'show_week') $param.='&action='.$action; +if ($action == 'show_day' || $action == 'show_week' || $action == 'show_month') $param.='&action='.$action; $param.="&maxprint=".$maxprint; // Show navigation bar if (empty($action) || $action=='show_month') { - $nav ="".img_previous($langs->trans("Previous"))."\n"; + $nav ="".img_previous($langs->trans("Previous"))."\n"; $nav.=" ".dol_print_date(dol_mktime(0,0,0,$month,1,$year),"%b %Y"); $nav.=" \n"; - $nav.="".img_next($langs->trans("Next"))."\n"; + $nav.="".img_next($langs->trans("Next"))."\n"; + $nav.="   (".$langs->trans("Today").")"; $picto='calendar'; } if ($action=='show_week') { - $nav ="".img_previous($langs->trans("Previous"))."\n"; + $nav ="".img_previous($langs->trans("Previous"))."\n"; $nav.=" ".dol_print_date(dol_mktime(0,0,0,$month,1,$year),"%Y").", ".$langs->trans("Week")." ".$week; $nav.=" \n"; - $nav.="".img_next($langs->trans("Next"))."\n"; + $nav.="".img_next($langs->trans("Next"))."\n"; + $nav.="   (".$langs->trans("Today").")"; $picto='calendarweek'; } if ($action=='show_day') { - $nav ="".img_previous($langs->trans("Previous"))."\n"; + $nav ="".img_previous($langs->trans("Previous"))."\n"; $nav.=" ".dol_print_date(dol_mktime(0,0,0,$month,$day,$year),"daytextshort"); $nav.=" \n"; - $nav.="".img_next($langs->trans("Next"))."\n"; + $nav.="".img_next($langs->trans("Next"))."\n"; + $nav.="   (".$langs->trans("Today").")"; $picto='calendarday'; } @@ -273,12 +319,67 @@ $param.='&year='.$year.'&month='.$month.($day?'&day='.$day:''); -$head = calendars_prepare_head(''); +$tabactive=''; +if ($action == 'show_month') $tabactive='cardmonth'; +if ($action == 'show_week') $tabactive='cardweek'; +if ($action == 'show_day') $tabactive='cardday'; +if ($action == 'show_list') $tabactive='cardlist'; -dol_fiche_head($head, 'card', $langs->trans('Events'), 0, $picto); -print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirthday,$filtera,$filtert,$filterd,$pid,$socid,$listofextcals,$actioncode); +$paramnoaction=preg_replace('/action=[a-z_]+/','',$param); + +$head = calendars_prepare_head($paramnoaction); + +dol_fiche_head($head, $tabactive, $langs->trans('Agenda'), 0, 'action'); +print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirthday,$filtera,$filtert,$filterd,$pid,$socid,$action,$listofextcals,$actioncode,$usergroup); dol_fiche_end(); +$showextcals=$listofextcals; +// Legend +if ($conf->use_javascript_ajax) +{ + $s=''; + //print ''; + + //print $langs->trans("Calendars").': '; + //print ''; + $s.='' . "\n"; + if (! empty($conf->use_javascript_ajax)) + { + $s.='
' . $langs->trans("LocalAgenda").'  
'; + if (is_array($showextcals) && count($showextcals) > 0) + { + foreach ($showextcals as $val) + { + $htmlname = dol_string_nospecial($val['name']); + $s.='' . "\n"; + $s.='
' . $val ['name'] . '  
'; + } + } + } + $s.='
'.$langs->trans("AgendaShowBirthdayEvents").'  
'; + + //print ''; +} + + $link=''; // Add link to show birthdays if (empty($conf->use_javascript_ajax)) @@ -294,7 +395,7 @@ if (empty($conf->use_javascript_ajax)) $link.=''; } -print_fiche_titre($title,$link.'     '.$nav, ''); +print_fiche_titre($s,$link.'     '.$nav, ''); // Get event in an array @@ -307,18 +408,19 @@ $sql.= ' a.datea,'; $sql.= ' a.datea2,'; $sql.= ' a.percent,'; $sql.= ' a.fk_user_author,a.fk_user_action,a.fk_user_done,'; -$sql.= ' a.priority, a.fulldayevent, a.location,'; +$sql.= ' a.transparency, a.priority, a.fulldayevent, a.location,'; $sql.= ' a.fk_soc, a.fk_contact,'; $sql.= ' ca.code'; -$sql.= ' FROM ('.MAIN_DB_PREFIX.'c_actioncomm as ca,'; -$sql.= " ".MAIN_DB_PREFIX."actioncomm as a)"; +$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"; +if ($usergroup > 0) $sql.= ", ".MAIN_DB_PREFIX."usergroup_user as ugu"; $sql.= ' WHERE a.fk_action = ca.id'; $sql.= ' AND a.entity IN ('.getEntity('agenda', 1).')'; if ($actioncode) $sql.=" AND ca.code='".$db->escape($actioncode)."'"; if ($pid) $sql.=" AND a.fk_project=".$db->escape($pid); if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")"; -if ($user->societe_id) $sql.= ' AND a.fk_soc = '.$user->societe_id; // To limit to external user company +if ($socid > 0) $sql.= ' AND a.fk_soc = '.$socid; +if ($usergroup > 0) $sql.= " AND ugu.fk_user = a.fk_user_action"; if ($action == 'show_day') { $sql.= " AND ("; @@ -347,21 +449,25 @@ else $sql.= ')'; } if ($type) $sql.= " AND ca.id = ".$type; -if ($status == 'done') { $sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep2 <= '".$db->idate($now)."'))"; } +if ($status == '0') { $sql.= " AND a.percent = 0"; } +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 ($filtera > 0 || $filtert > 0 || $filterd > 0) +if ($filtera > 0 || $filtert > 0 || $filterd > 0 || $usergroup > 0) { $sql.= " AND ("; if ($filtera > 0) $sql.= " a.fk_user_author = ".$filtera; if ($filtert > 0) $sql.= ($filtera>0?" OR ":"")." a.fk_user_action = ".$filtert; if ($filterd > 0) $sql.= ($filtera>0||$filtert>0?" OR ":"")." a.fk_user_done = ".$filterd; + if ($usergroup > 0) $sql.= ($filtera>0||$filtert>0||$filterd>0?" OR ":"")." ugu.fk_usergroup = ".$usergroup; $sql.= ")"; } // Sort on date $sql.= ' ORDER BY datep'; //print $sql; -dol_syslog("comm/action/index.php sql=".$sql, LOG_DEBUG); +dol_syslog("comm/action/index.php", LOG_DEBUG); $resql=$db->query($sql); if ($resql) { @@ -386,6 +492,7 @@ if ($resql) $event->priority=$obj->priority; $event->fulldayevent=$obj->fulldayevent; $event->location=$obj->location; + $event->transparency=$obj->transparency; $event->societe->id=$obj->fk_soc; $event->contact->id=$obj->fk_contact; @@ -472,7 +579,7 @@ if ($showbirthday) } $sql.= ' ORDER BY birthday'; - dol_syslog("comm/action/index.php sql=".$sql, LOG_DEBUG); + dol_syslog("comm/action/index.php", LOG_DEBUG); $resql=$db->query($sql); if ($resql) { @@ -847,6 +954,12 @@ if (empty($action) || $action == 'show_month') // View by month echo " \n"; } echo "\n"; + echo '
'; + echo ''; + echo ''; + echo '' ; + echo '
'; + } elseif ($action == 'show_week') // View by week { @@ -907,6 +1020,11 @@ elseif ($action == 'show_week') // View by week echo " \n"; echo "\n"; + echo '
'; + echo ''; + echo ''; + echo '' ; + echo '
'; } else // View by day { @@ -916,7 +1034,7 @@ else // View by day $newparam=preg_replace('/viewday=[0-9]+&?/i','',$newparam); $newparam.='&viewday=1'; // Code to show just one day - $style='cal_current_month'; + $style='cal_current_month cal_current_month_oneday'; $today=0; $todayarray=dol_getdate($now,'fast'); if ($todayarray['mday']==$day && $todayarray['mon']==$month && $todayarray['year']==$year) $today=1; @@ -924,7 +1042,7 @@ else // View by day $timestamp=dol_mktime(12,0,0,$month,$day,$year); $arraytimestamp=dol_getdate($timestamp); - echo ''; + echo '
'; echo ' '; echo ' \n"; echo " \n"; @@ -938,8 +1056,6 @@ else // View by day } -$db->close(); - /* TODO Export print ' @@ -956,6 +1072,8 @@ $("#actionagenda_vcal_link").attr("href","/public/agenda/agendaexport.php?format llxFooter(); +$db->close(); + /** * Show event of a particular day @@ -1004,13 +1122,13 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa print ''; } print ''; - print ''; print ''; + // Shipping Method + if (! empty($conf->expedition->enabled)) { + print ''; + print ''; + } + // Origin of demand print '
'.$langs->trans("Day".$arraytimestamp['wday'])."
'; + print '
'; //$curtime = dol_mktime (0, 0, 0, $month, $day, $year); $i=0; $nummytasks=0; $numother=0; $numbirthday=0; $numical=0; $numicals=array(); $ymd=sprintf("%04d",$year).sprintf("%02d",$month).sprintf("%02d",$day); - $nextindextouse=count($colorindexused); + $nextindextouse=count($colorindexused); // At first run this is 0, so fist user has 0, next 1, ... //print $nextindextouse; foreach ($eventarray as $daykey => $notused) @@ -1049,9 +1167,9 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa $numicals[dol_string_nospecial($event->icalname)]++; } $color=$event->icalcolor; - $cssclass=(! empty($event->icalname)?'family_'.dol_string_nospecial($event->icalname):'family_other'); + $cssclass=(! empty($event->icalname)?'family_'.dol_string_nospecial($event->icalname):'family_other unsortable'); } - else if ($event->type_code == 'BIRTHDAY') { $numbirthday++; $colorindex=2; $cssclass='family_birthday'; } + else if ($event->type_code == 'BIRTHDAY') { $numbirthday++; $colorindex=2; $cssclass='family_birthday unsortable'; $color=sprintf("%02x%02x%02x",$theme_datacolor[$colorindex][0],$theme_datacolor[$colorindex][1],$theme_datacolor[$colorindex][2]); } else { $numother++; $cssclass='family_other'; } if ($color == -1) // Color was not forced. Set color according to color index. { @@ -1063,21 +1181,44 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa } else { - $colorindex=$nextindextouse; - $colorindexused[$idusertouse]=$colorindex; + $colorindex=$nextindextouse; + $colorindexused[$idusertouse]=$colorindex; if (! empty($theme_datacolor[$nextindextouse+1])) $nextindextouse++; // Prepare to use next color } //print '|'.($color).'='.($idusertouse?$idusertouse:0).'='.$colorindex.'
'; // Define color $color=sprintf("%02x%02x%02x",$theme_datacolor[$colorindex][0],$theme_datacolor[$colorindex][1],$theme_datacolor[$colorindex][2]); - } + } $cssclass=$cssclass.' '.$cssclass.'_day_'.$ymd; + // Defined style to disable drag and drop feature + if (empty($event->fulldayevent)) + { + if ($event->date_end_in_calendar && $event->date_start_in_calendar != $event->date_end_in_calendar) + { + $tmpyearend = date('Y',$event->date_end_in_calendar); + $tmpmonthend = date('m',$event->date_end_in_calendar); + $tmpdayend = date('d',$event->date_end_in_calendar); + if ($tmpyearend != $annee || $tmpmonthend != $mois || $tmpdayend != $jour) + { + $cssclass.= " unsortable"; + } + } + if ($event->type_code =='AC_OTH_AUTO') + { + $cssclass.= " unsortable"; + } + } + // Show rect of event print '
'; print '
  • '; - print ''; - print ''; + print ''; + print '"; + if ($mysoc->localtax1_assuj == "1" || $objectsrc->total_localtax1 != 0 ) // Localtax1 + { + print '"; + } + + if ($mysoc->localtax2_assuj == "1" || $objectsrc->total_localtax2 != 0) // Localtax2 + { + print '"; + } + print '"; + } + + print "
    '; + print ''; + print ''; @@ -414,6 +417,11 @@ if ($object->fetch($id) >= 0) // Statut print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"mc.statut",$param,'','align="right"',$sortfield,$sortorder); + //Search Icon + print ''; + print ''; // Ligne des champs de filtres @@ -435,7 +443,20 @@ if ($object->fetch($id) >= 0) print ' '; print ''; // Source - print ''; + + // Date sending + print ''; + //Statut + print ''; + //Search Icon + print ''; print ''; @@ -506,12 +527,12 @@ if ($object->fetch($id) >= 0) { print ''; print ''; } + + //Sreach Icon + print ''; print ''; $i++; diff --git a/htdocs/comm/mailing/class/index.html b/htdocs/comm/mailing/class/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/comm/mailing/class/mailing.class.php b/htdocs/comm/mailing/class/mailing.class.php index 99b1a2f4419..2f8f7f18e4e 100644 --- a/htdocs/comm/mailing/class/mailing.class.php +++ b/htdocs/comm/mailing/class/mailing.class.php @@ -60,6 +60,9 @@ class Mailing extends CommonObject var $extraparams=array(); + public $statut_dest=array(); + public $statuts=array(); + /** * Constructor @@ -75,6 +78,12 @@ class Mailing extends CommonObject $this->statuts[1] = 'MailingStatusValidated'; $this->statuts[2] = 'MailingStatusSentPartialy'; $this->statuts[3] = 'MailingStatusSentCompletely'; + + $this->statut_dest[-1] = 'MailingStatusError'; + $this->statut_dest[1] = 'MailingStatusSent'; + $this->statut_dest[2] = 'MailingStatusRead'; + $this->statut_dest[3] = 'MailingStatusNotContact'; + } /** @@ -109,7 +118,7 @@ class Mailing extends CommonObject $this->titre = $langs->trans("NoTitle"); } - dol_syslog("Mailing::Create sql=".$sql); + dol_syslog("Mailing::Create", LOG_DEBUG); $result=$this->db->query($sql); if ($result) { @@ -122,7 +131,6 @@ class Mailing extends CommonObject else { $this->error=$this->db->lasterror(); - dol_syslog("Mailing::Create ".$this->error, LOG_ERR); $this->db->rollback(); return -1; } @@ -132,7 +140,6 @@ class Mailing extends CommonObject else { $this->error=$this->db->lasterror(); - dol_syslog("Mailing::Create ".$this->error, LOG_ERR); $this->db->rollback(); return -1; } @@ -157,7 +164,7 @@ class Mailing extends CommonObject $sql .= ", bgimage = '".($this->bgimage?$this->bgimage:null)."'"; $sql .= " WHERE rowid = ".$this->id; - dol_syslog("Mailing::Update sql=".$sql); + dol_syslog("Mailing::Update", LOG_DEBUG); $result=$this->db->query($sql); if ($result) { @@ -166,7 +173,6 @@ class Mailing extends CommonObject else { $this->error=$this->db->lasterror(); - dol_syslog("Mailing::Update ".$this->error, LOG_ERR); return -1; } } @@ -192,7 +198,7 @@ class Mailing extends CommonObject $sql.= " FROM ".MAIN_DB_PREFIX."mailing as m"; $sql.= " WHERE m.rowid = ".$rowid; - dol_syslog(get_class($this)."::fetch sql=".$sql); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $result=$this->db->query($sql); if ($result) { @@ -325,7 +331,7 @@ class Mailing extends CommonObject $sql.= " FROM ".MAIN_DB_PREFIX."mailing_cibles "; $sql.= " WHERE fk_mailing = ".$fromid; - dol_syslog(get_class($this)."::createFromClone sql=".$sql); + dol_syslog(get_class($this)."::createFromClone", LOG_DEBUG); $result=$this->db->query($sql); if ($result) { @@ -348,7 +354,6 @@ class Mailing extends CommonObject else { $this->error=$this->db->lasterror(); - dol_syslog("Mailing::createFromClone ".$this->error, LOG_ERR); return -1; } @@ -384,7 +389,7 @@ class Mailing extends CommonObject $sql .= " SET statut = 1, date_valid = '".$this->db->idate($now)."', fk_user_valid=".$user->id; $sql .= " WHERE rowid = ".$this->id; - dol_syslog("Mailing::valid sql=".$sql, LOG_DEBUG); + dol_syslog("Mailing::valid", LOG_DEBUG); if ($this->db->query($sql)) { return 1; @@ -392,7 +397,6 @@ class Mailing extends CommonObject else { $this->error=$this->db->lasterror(); - dol_syslog("Mailing::Valid ".$this->error, LOG_ERR); return -1; } } @@ -409,7 +413,7 @@ class Mailing extends CommonObject $sql = "DELETE FROM ".MAIN_DB_PREFIX."mailing"; $sql.= " WHERE rowid = ".$rowid; - dol_syslog("Mailing::delete sql=".$sql, LOG_DEBUG); + dol_syslog("Mailing::delete", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -418,7 +422,6 @@ class Mailing extends CommonObject else { $this->error=$this->db->lasterror(); - dol_syslog("Mailing::Valid ".$this->error, LOG_ERR); return -1; } } @@ -436,7 +439,7 @@ class Mailing extends CommonObject $sql.= " SET statut = 0"; $sql.= " WHERE fk_mailing = ".$this->id; - dol_syslog("Mailing::reset_targets_status sql=".$sql, LOG_DEBUG); + dol_syslog("Mailing::reset_targets_status", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -445,7 +448,6 @@ class Mailing extends CommonObject else { $this->error=$this->db->lasterror(); - dol_syslog("Mailing::Valid ".$this->error, LOG_ERR); return -1; } } @@ -512,5 +514,60 @@ class Mailing extends CommonObject } } + + /** + * 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 + */ + static public function libStatutDest($statut,$mode=0) + { + global $langs; + $langs->load('mails'); + + if ($mode == 0) + { + return $langs->trans($this->statut_dest[$statut]); + } + if ($mode == 1) + { + return $langs->trans($this->statut_dest[$statut]); + } + if ($mode == 2) + { + if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error(); + if ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"),'statut4'); + if ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"),'statut6'); + if ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"),'statut8'); + } + if ($mode == 3) + { + if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error(); + if ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"),'statut4'); + if ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"),'statut6'); + if ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"),'statut8'); + } + if ($mode == 4) + { + if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error(); + if ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"),'statut4'); + if ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"),'statut6'); + if ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"),'statut8'); + } + if ($mode == 5) + { + if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error(); + if ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"),'statut4'); + if ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"),'statut6'); + if ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"),'statut8'); + } + + + + + } + } diff --git a/htdocs/comm/mailing/fiche.php b/htdocs/comm/mailing/fiche.php index d803de28357..d64d9188de8 100644 --- a/htdocs/comm/mailing/fiche.php +++ b/htdocs/comm/mailing/fiche.php @@ -107,7 +107,7 @@ if ($action == 'confirm_clone' && $confirm == 'yes') { if (empty($_REQUEST["clone_content"]) && empty($_REQUEST["clone_receivers"])) { - $mesg='
    '.$langs->trans("NoCloneOptionsSpecified").'
    '; + setEventMessage($langs->trans("NoCloneOptionsSpecified"), 'errors'); } else { @@ -119,7 +119,7 @@ if ($action == 'confirm_clone' && $confirm == 'yes') } else { - $mesg=$object->error; + setEventMessage($object->error, 'errors'); } } $action=''; @@ -130,16 +130,17 @@ if ($action == 'sendallconfirmed' && $confirm == 'yes') { if (empty($conf->global->MAILING_LIMIT_SENDBYWEB)) { + //TODO: What is this for? // Pour des raisons de securite, on ne permet pas cette fonction via l'IHM, // on affiche donc juste un message - $mesg='
    '.$langs->trans("MailingNeedCommand").'
    '; - $mesg.='
    '; - $mesg.='

    '.$langs->trans("MailingNeedCommand2").'
    '; + setEventMessage($langs->trans("MailingNeedCommand"), 'warnings'); + setEventMessage('', 'warnings'); + setEventMessage($langs->trans("MailingNeedCommand2"), 'warnings'); $action=''; } else if ($conf->global->MAILING_LIMIT_SENDBYWEB < 0) { - $mesg='
    '.$langs->trans("NotEnoughPermissions").'
    '; + setEventMessage($langs->trans("NotEnoughPermissions"), 'warnings'); $action=''; } else @@ -173,7 +174,7 @@ if ($action == 'sendallconfirmed' && $confirm == 'yes') $sql .= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc"; $sql .= " WHERE mc.statut < 1 AND mc.fk_mailing = ".$object->id; - dol_syslog("fiche.php: select targets sql=".$sql, LOG_DEBUG); + dol_syslog("fiche.php: select targets", LOG_DEBUG); $resql=$db->query($sql); if ($resql) { @@ -295,7 +296,7 @@ if ($action == 'sendallconfirmed' && $confirm == 'yes') { //Update status communication of thirdparty prospect $sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm=2 WHERE rowid IN (SELECT source_id FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE rowid=".$obj->rowid.")"; - dol_syslog("fiche.php: set prospect thirdparty status sql=".$sql, LOG_DEBUG); + dol_syslog("fiche.php: set prospect thirdparty status", LOG_DEBUG); $resql2=$db->query($sql); if (! $resql2) { @@ -304,7 +305,7 @@ if ($action == 'sendallconfirmed' && $confirm == 'yes') //Update status communication of contact prospect $sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm=2 WHERE rowid IN (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."socpeople AS sc INNER JOIN ".MAIN_DB_PREFIX."mailing_cibles AS mc ON mc.rowid=".$obj->rowid." AND mc.source_type = 'contact' AND mc.source_id = sc.rowid)"; - dol_syslog("fiche.php: set prospect contact status sql=".$sql, LOG_DEBUG); + dol_syslog("fiche.php: set prospect contact status", LOG_DEBUG); $resql2=$db->query($sql); if (! $resql2) @@ -363,7 +364,7 @@ if ($action == 'sendallconfirmed' && $confirm == 'yes') } $sql="UPDATE ".MAIN_DB_PREFIX."mailing SET statut=".$statut." WHERE rowid=".$object->id; - dol_syslog("comm/mailing/fiche.php: update global status sql=".$sql, LOG_DEBUG); + dol_syslog("comm/mailing/fiche.php: update global status", LOG_DEBUG); $resql2=$db->query($sql); if (! $resql2) { @@ -390,7 +391,7 @@ if ($action == 'send' && empty($_POST["cancel"])) $object->sendto = $_POST["sendto"]; if (! $object->sendto) { - $mesg='
    '.$langs->trans("ErrorFieldRequired",$langs->trans("MailTo")).'
    '; + setEventMessage($langs->trans("ErrorFieldRequired",$langs->trans("MailTo")), 'errors'); $error++; } @@ -430,11 +431,11 @@ if ($action == 'send' && empty($_POST["cancel"])) $result=$mailfile->sendfile(); if ($result) { - $mesg='
    '.$langs->trans("MailSuccessfulySent",$mailfile->getValidAddress($object->email_from,2),$mailfile->getValidAddress($object->sendto,2)).'
    '; + setEventMessage($langs->trans("MailSuccessfulySent",$mailfile->getValidAddress($object->email_from,2),$mailfile->getValidAddress($object->sendto,2))); } else { - $mesg='
    '.$langs->trans("ResultKo").'
    '.$mailfile->error.' '.$result.'
    '; + setEventMessage($langs->trans("ResultKo").'
    '.$mailfile->error.' '.$result, 'errors'); } $action=''; @@ -444,6 +445,8 @@ if ($action == 'send' && empty($_POST["cancel"])) // Action add emailing if ($action == 'add') { + $mesgs = array(); + $object->email_from = trim($_POST["from"]); $object->email_replyto = trim($_POST["replyto"]); $object->email_errorsto = trim($_POST["errorsto"]); @@ -453,26 +456,32 @@ if ($action == 'add') $object->bgcolor = trim($_POST["bgcolor"]); $object->bgimage = trim($_POST["bgimage"]); - if (! $object->titre) $mesg.=($mesg?'
    ':'').$langs->trans("ErrorFieldRequired",$langs->transnoentities("MailTitle")); - if (! $object->sujet) $mesg.=($mesg?'
    ':'').$langs->trans("ErrorFieldRequired",$langs->transnoentities("MailTopic")); - if (! $object->body) $mesg.=($mesg?'
    ':'').$langs->trans("ErrorFieldRequired",$langs->transnoentities("MailMessage")); + if (! $object->titre) { + $mesgs[] = $langs->trans("ErrorFieldRequired",$langs->transnoentities("MailTitle")); + } + if (! $object->sujet) { + $mesgs[] = $langs->trans("ErrorFieldRequired",$langs->transnoentities("MailTopic")); + } + if (! $object->body) { + $mesgs[] = $langs->trans("ErrorFieldRequired",$langs->transnoentities("MailMessage")); + } - if (! $mesg) + if (!count($mesgs)) { if ($object->create($user) >= 0) { header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; } - $mesg=$object->error; + $mesgs[] = $object->error; } - $mesg='
    '.$mesg.'
    '; + setEventMessage($mesgs, 'errors'); $action="create"; } // Action update description of emailing -if ($action == 'settitre' || $action == 'setemail_from' || $actino == 'setreplyto' || $action == 'setemail_errorsto') +if ($action == 'settitre' || $action == 'setemail_from' || $action == 'setreplyto' || $action == 'setemail_errorsto') { $upload_dir = $conf->mailing->dir_output . "/" . get_exdir($object->id,2,0,1); @@ -480,9 +489,12 @@ if ($action == 'settitre' || $action == 'setemail_from' || $actino == 'setreplyt else if ($action == 'setemail_from') $object->email_from = trim(GETPOST('email_from','alpha')); else if ($action == 'setemail_replyto') $object->email_replyto = trim(GETPOST('email_replyto','alpha')); else if ($action == 'setemail_errorsto') $object->email_errorsto = trim(GETPOST('email_errorsto','alpha')); - - else if ($action == 'settitre' && empty($object->titre)) $mesg.=($mesg?'
    ':'').$langs->trans("ErrorFieldRequired",$langs->transnoentities("MailTitle")); - else if ($action == 'setfrom' && empty($object->email_from)) $mesg.=($mesg?'
    ':'').$langs->trans("ErrorFieldRequired",$langs->transnoentities("MailFrom")); + else if ($action == 'settitre' && empty($object->titre)) { + $mesg = $langs->trans("ErrorFieldRequired",$langs->transnoentities("MailTitle")); + } + else if ($action == 'setfrom' && empty($object->email_from)) { + $mesg = $langs->trans("ErrorFieldRequired",$langs->transnoentities("MailFrom")); + } if (! $mesg) { @@ -491,10 +503,10 @@ if ($action == 'settitre' || $action == 'setemail_from' || $actino == 'setreplyt header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; } - $mesg=$object->error; + $mesg = $object->error; } - $mesg='
    '.$mesg.'
    '; + setEventMessage($mesg, 'errors'); $action=""; } @@ -534,25 +546,31 @@ if ($action == 'update' && empty($_POST["removedfile"]) && empty($_POST["cancel" if (! $isupload) { + $mesgs = array(); + $object->sujet = trim($_POST["sujet"]); $object->body = trim($_POST["body"]); $object->bgcolor = trim($_POST["bgcolor"]); $object->bgimage = trim($_POST["bgimage"]); - if (! $object->sujet) $mesg.=($mesg?'
    ':'').$langs->trans("ErrorFieldRequired",$langs->transnoentities("MailTopic")); - if (! $object->body) $mesg.=($mesg?'
    ':'').$langs->trans("ErrorFieldRequired",$langs->transnoentities("MailMessage")); + if (! $object->sujet) { + $mesgs[] = $langs->trans("ErrorFieldRequired",$langs->transnoentities("MailTopic")); + } + if (! $object->body) { + $mesgs[] = $langs->trans("ErrorFieldRequired",$langs->transnoentities("MailMessage")); + } - if (! $mesg) + if (!count($mesgs)) { if ($object->update($user) >= 0) { header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; } - $mesg=$object->error; + $mesgs[] =$object->error; } - $mesg='
    '.$mesg.'
    '; + setEventMessage($mesgs, 'errors'); $action="edit"; } else @@ -598,7 +616,7 @@ if ($action == 'confirm_reset' && $confirm == 'yes') } else { - $mesg=$object->error; + setEventMessage($object->error, 'errors'); $db->rollback(); } } @@ -646,8 +664,6 @@ if ($action == 'create') print_fiche_titre($langs->trans("NewMailing")); - dol_htmloutput_mesg($mesg); - print '
    '; if ($event->type_code == 'BIRTHDAY') // It's a birthday { print $event->getNomUrl(1,$maxnbofchar,'cal_event','birthday','contact'); @@ -1240,6 +1381,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa print '}'."\n"; print '});'."\n"; + print ''."\n"; } diff --git a/htdocs/comm/action/listactions.php b/htdocs/comm/action/listactions.php index 48e21690d2a..055086bbdbb 100644 --- a/htdocs/comm/action/listactions.php +++ b/htdocs/comm/action/listactions.php @@ -42,11 +42,17 @@ $actioncode=GETPOST("actioncode","alpha",3); $pid=GETPOST("projectid",'int',3); $status=GETPOST("status",'alpha'); $type=GETPOST('type'); +$actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_USE_EVENT_TYPE)?'AC_OTH':'')); + +if ($actioncode == '') $actioncode=(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE); +if ($status == '' && ! isset($_GET['status']) && ! isset($_POST['status'])) $status=(empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS)?'':$conf->global->AGENDA_DEFAULT_FILTER_STATUS); +if (empty($action) && ! isset($_GET['action']) && ! isset($_POST['action'])) $action=(empty($conf->global->AGENDA_DEFAULT_VIEW)?'show_month':$conf->global->AGENDA_DEFAULT_VIEW); $filter=GETPOST("filter",'',3); $filtera = GETPOST("userasked","int",3)?GETPOST("userasked","int",3):GETPOST("filtera","int",3); $filtert = GETPOST("usertodo","int",3)?GETPOST("usertodo","int",3):GETPOST("filtert","int",3); $filterd = GETPOST("userdone","int",3)?GETPOST("userdone","int",3):GETPOST("filterd","int",3); +$usergroup = GETPOST("usergroup","int",3); $showbirthday = empty($conf->use_javascript_ajax)?GETPOST("showbirthday","int"):1; $sortfield = GETPOST("sortfield",'alpha'); @@ -72,6 +78,7 @@ if (! $sortfield) $socid = GETPOST("socid",'int'); if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'agenda', 0, '', 'myactions'); +if ($socid < 0) $socid=''; $canedit=1; if (! $user->rights->agenda->myactions->read) accessforbidden(); @@ -83,6 +90,8 @@ if (! $user->rights->agenda->allactions->read || $filter=='mine') // If no permi $filterd=$user->id; } +// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +$hookmanager->initHooks(array('agendalist')); /* @@ -117,7 +126,8 @@ $form=new Form($db); $listofextcals=array(); $param=''; -if ($status) $param="&status=".$status; +if ($actioncode || isset($_GET['actioncode']) || isset($_POST['actioncode'])) $param.="&actioncode=".$actioncode; +if ($status || isset($_GET['status']) || isset($_POST['status'])) $param.="&status=".$status; if ($filter) $param.="&filter=".$filter; if ($filtera) $param.="&filtera=".$filtera; if ($filtert) $param.="&filtert=".$filtert; @@ -126,7 +136,6 @@ if ($socid) $param.="&socid=".$socid; if ($showbirthday) $param.="&showbirthday=1"; if ($pid) $param.="&projectid=".$pid; if ($type) $param.="&type=".$type; -if ($actioncode) $param.="&actioncode=".$actioncode; $sql = "SELECT s.nom as societe, s.rowid as socid, s.client,"; $sql.= " a.id, a.datep as dp, a.datep2 as dp2,"; @@ -145,29 +154,35 @@ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid" $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as ua ON a.fk_user_author = ua.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as ut ON a.fk_user_action = ut.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as ud ON a.fk_user_done = ud.rowid"; +if ($usergroup > 0) $sql.= ", ".MAIN_DB_PREFIX."usergroup_user as ugu"; $sql.= " WHERE c.id = a.fk_action"; $sql.= ' AND a.fk_user_author = u.rowid'; -$sql.= ' AND a.entity IN ('.getEntity().')'; // To limit to entity +$sql.= ' AND a.entity IN ('.getEntity('agenda', 1).')'; // To limit to entity if ($actioncode) $sql.=" AND c.code='".$db->escape($actioncode)."'"; if ($pid) $sql.=" AND a.fk_project=".$db->escape($pid); if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")"; -if ($socid) $sql.= " AND s.rowid = ".$socid; +if ($socid > 0) $sql.= " AND s.rowid = ".$socid; +if ($usergroup > 0) $sql.= " AND ugu.fk_user = a.fk_user_action"; if ($type) $sql.= " AND c.id = ".$type; -if ($status == 'done') { $sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep2 <= '".$db->idate($now)."'))"; } +if ($status == '0') { $sql.= " AND a.percent = 0"; } +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 ($filtera > 0 || $filtert > 0 || $filterd > 0) +if ($filtera > 0 || $filtert > 0 || $filterd > 0 || $usergroup > 0) { - $sql.= " AND ("; - if ($filtera > 0) $sql.= " a.fk_user_author = ".$filtera; - if ($filtert > 0) $sql.= ($filtera>0?" OR ":"")." a.fk_user_action = ".$filtert; - if ($filterd > 0) $sql.= ($filtera>0||$filtert>0?" OR ":"")." a.fk_user_done = ".$filterd; - $sql.= ")"; + $sql.= " AND ("; + if ($filtera > 0) $sql.= " a.fk_user_author = ".$filtera; + if ($filtert > 0) $sql.= ($filtera>0?" OR ":"")." a.fk_user_action = ".$filtert; + if ($filterd > 0) $sql.= ($filtera>0||$filtert>0?" OR ":"")." a.fk_user_done = ".$filterd; + if ($usergroup > 0) $sql.= ($filtera>0||$filtert>0||$filterd>0?" OR ":"")." ugu.fk_usergroup = ".$usergroup; + $sql.= ")"; } $sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($limit + 1, $offset); //print $sql; -dol_syslog("comm/action/listactions.php sql=".$sql); +dol_syslog("comm/action/listactions.php", LOG_DEBUG); $resql=$db->query($sql); if ($resql) { @@ -180,22 +195,19 @@ if ($resql) if ($status == 'done') $title=$langs->trans("DoneActions"); if ($status == 'todo') $title=$langs->trans("ToDoActions"); - if ($socid) - { - $societe = new Societe($db); - $societe->fetch($socid); - $newtitle=$langs->trans($title).' '.$langs->trans("For").' '.$societe->nom; - } - else - { - $newtitle=$langs->trans($title); - } + $newtitle=$langs->trans($title); + $tabactive=''; + if ($action == 'show_month') $tabactive='cardmonth'; + if ($action == 'show_week') $tabactive='cardweek'; + if ($action == 'show_day') $tabactive='cardday'; + if ($action == 'show_list') $tabactive='cardlist'; + if ($action == 'show_peruser') $tabactive='cardperuser'; - $head = calendars_prepare_head(''); + $head = calendars_prepare_head($param); - dol_fiche_head($head, 'card', $langs->trans('Events'), 0, 'list'); - print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirthday,$filtera,$filtert,$filterd,$pid,$socid,-1); + dol_fiche_head($head, $tabactive, $langs->trans('Agenda'), 0, 'action'); + print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirthday,$filtera,$filtert,$filterd,$pid,$socid,$action,-1,$actioncode,$usergroup); dol_fiche_end(); // Add link to show birthdays @@ -276,7 +288,7 @@ if ($resql) { $societestatic->id=$obj->socid; $societestatic->client=$obj->client; - $societestatic->nom=$obj->societe; + $societestatic->name=$obj->societe; print $societestatic->getNomUrl(1,'',10); } else print ' '; diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php new file mode 100644 index 00000000000..e5cf2f81d98 --- /dev/null +++ b/htdocs/comm/action/peruser.php @@ -0,0 +1,480 @@ + + * Copyright (C) 2003 Eric Seigne + * Copyright (C) 2004-2014 Laurent Destailleur + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2011 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 + * (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/comm/action/peruser.php + * \ingroup agenda + * \brief Tab of calendar events per user + */ + +require '../../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; +require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; +require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php'; +if (! empty($conf->projet->enabled)) { + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; +} + +if (! isset($conf->global->AGENDA_MAX_EVENTS_DAY_VIEW)) $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW=3; + +$filter=GETPOST("filter",'',3); +$filtera = GETPOST("userasked","int",3)?GETPOST("userasked","int",3):GETPOST("filtera","int",3); +$filtert = GETPOST("usertodo","int",3)?GETPOST("usertodo","int",3):GETPOST("filtert","int",3); +$filterd = GETPOST("userdone","int",3)?GETPOST("userdone","int",3):GETPOST("filterd","int",3); +$usergroup = GETPOST("usergroup","int",3); +$showbirthday = empty($conf->use_javascript_ajax)?GETPOST("showbirthday","int"):1; + + +$sortfield = GETPOST("sortfield",'alpha'); +$sortorder = GETPOST("sortorder",'alpha'); +$page = GETPOST("page","int"); +if ($page == -1) { $page = 0; } +$limit = $conf->liste_limit; +$offset = $limit * $page; +if (! $sortorder) $sortorder="ASC"; +if (! $sortfield) $sortfield="a.datec"; + +// Security check +$socid = GETPOST("socid","int"); +if ($user->societe_id) $socid=$user->societe_id; +$result = restrictedArea($user, 'agenda', 0, '', 'myactions'); +if ($socid < 0) $socid=''; + +$canedit=1; +if (! $user->rights->agenda->myactions->read) accessforbidden(); +if (! $user->rights->agenda->allactions->read) $canedit=0; +if (! $user->rights->agenda->allactions->read || $filter =='mine') // If no permission to see all, we show only affected to me +{ + $filtera=$user->id; + $filtert=$user->id; + $filterd=$user->id; +} + +$action=GETPOST('action','alpha'); +//$year=GETPOST("year"); +$year=GETPOST("year","int")?GETPOST("year","int"):date("Y"); +$month=GETPOST("month","int")?GETPOST("month","int"):date("m"); +$week=GETPOST("week","int")?GETPOST("week","int"):date("W"); +$day=GETPOST("day","int")?GETPOST("day","int"):0; +$pid=GETPOST("projectid","int",3); +$status=GETPOST("status"); +$type=GETPOST("type"); +$maxprint=(isset($_GET["maxprint"])?GETPOST("maxprint"):$conf->global->AGENDA_MAX_EVENTS_DAY_VIEW); +$actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=='0'?'0':''); + +if ($actioncode == '') $actioncode=(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE); +if ($status == '') $status=(empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS)?'':$conf->global->AGENDA_DEFAULT_FILTER_STATUS); +if (empty($action)) $action=(empty($conf->global->AGENDA_DEFAULT_VIEW)?'show_month':$conf->global->AGENDA_DEFAULT_VIEW); + +if (GETPOST('viewcal') && $action != 'show_day' && $action != 'show_week') { + $action='show_month'; $day=''; +} // View by month +if (GETPOST('viewweek') || $action == 'show_week') { + $action='show_week'; $week=($week?$week:date("W")); $day=($day?$day:date("d")); +} // View by week +if (GETPOST('viewday') || $action == 'show_day') { + $action='show_day'; $day=($day?$day:date("d")); +} // View by day + + +$langs->load("agenda"); +$langs->load("other"); +$langs->load("commercial"); + +// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +$hookmanager->initHooks(array('agenda')); + + +/* + * Actions + */ + +// None + + +/* + * View + */ + +$help_url='EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda'; +llxHeader('',$langs->trans("Agenda"),$help_url); + +$form=new Form($db); +$companystatic=new Societe($db); +$contactstatic=new Contact($db); + +$now=dol_now(); +$nowarray=dol_getdate($now); +$nowyear=$nowarray['year']; +$nowmonth=$nowarray['mon']; +$nowday=$nowarray['mday']; + +// Define list of all external calendars +$listofextcals=array(); +if (empty($conf->global->AGENDA_DISABLE_EXT) && $conf->global->AGENDA_EXT_NB > 0) +{ + $i=0; + while($i < $conf->global->AGENDA_EXT_NB) + { + $i++; + $source='AGENDA_EXT_SRC'.$i; + $name='AGENDA_EXT_NAME'.$i; + $color='AGENDA_EXT_COLOR'.$i; + $buggedfile='AGENDA_EXT_BUGGEDFILE'.$i; + if (! empty($conf->global->$source) && ! empty($conf->global->$name)) + { + // Note: $conf->global->buggedfile can be empty or 'uselocalandtznodaylight' or 'uselocalandtzdaylight' + $listofextcals[]=array('src'=>$conf->global->$source,'name'=>$conf->global->$name,'color'=>$conf->global->$color,'buggedfile'=>(isset($conf->global->buggedfile)?$conf->global->buggedfile:0)); + } + } +} + + +if (empty($action) || $action=='show_month') +{ + $prev = dol_get_prev_month($month, $year); + $prev_year = $prev['year']; + $prev_month = $prev['month']; + $next = dol_get_next_month($month, $year); + $next_year = $next['year']; + $next_month = $next['month']; + + $max_day_in_prev_month = date("t",dol_mktime(0,0,0,$prev_month,1,$prev_year)); // Nb of days in previous month + $max_day_in_month = date("t",dol_mktime(0,0,0,$month,1,$year)); // Nb of days in next month + // tmpday is a negative or null cursor to know how many days before the 1 to show on month view (if tmpday=0 we start on monday) + $tmpday = -date("w",dol_mktime(0,0,0,$month,1,$year))+2; + $tmpday+=((isset($conf->global->MAIN_START_WEEK)?$conf->global->MAIN_START_WEEK:1)-1); + if ($tmpday >= 1) $tmpday -= 7; + // Define firstdaytoshow and lastdaytoshow + $firstdaytoshow=dol_mktime(0,0,0,$prev_month,$max_day_in_prev_month+$tmpday,$prev_year); + $next_day=7-($max_day_in_month+1-$tmpday)%7; + if ($next_day < 6) $next_day+=7; + $lastdaytoshow=dol_mktime(0,0,0,$next_month,$next_day,$next_year); +} +if ($action=='show_week') +{ + $prev = dol_get_first_day_week($day, $month, $year); + $prev_year = $prev['prev_year']; + $prev_month = $prev['prev_month']; + $prev_day = $prev['prev_day']; + $first_day = $prev['first_day']; + + $week = $prev['week']; + + $day = (int) $day; + $next = dol_get_next_week($day, $week, $month, $year); + $next_year = $next['year']; + $next_month = $next['month']; + $next_day = $next['day']; + + // Define firstdaytoshow and lastdaytoshow + $firstdaytoshow=dol_mktime(0,0,0,$prev_month,$first_day,$prev_year); + $lastdaytoshow=dol_mktime(0,0,0,$next_month,$next_day,$next_year); + + $max_day_in_month = date("t",dol_mktime(0,0,0,$month,1,$year)); + + $tmpday = $first_day; +} +if ($action == 'show_day') +{ + $prev = dol_get_prev_day($day, $month, $year); + $prev_year = $prev['year']; + $prev_month = $prev['month']; + $prev_day = $prev['day']; + $next = dol_get_next_day($day, $month, $year); + $next_year = $next['year']; + $next_month = $next['month']; + $next_day = $next['day']; + + // Define firstdaytoshow and lastdaytoshow + $firstdaytoshow=dol_mktime(0,0,0,$prev_month,$prev_day,$prev_year); + $lastdaytoshow=dol_mktime(0,0,0,$next_month,$next_day,$next_year); +} +//print 'xx'.$prev_year.'-'.$prev_month.'-'.$prev_day; +//print 'xx'.$next_year.'-'.$next_month.'-'.$next_day; +//print dol_print_date($firstdaytoshow,'day'); +//print dol_print_date($lastdaytoshow,'day'); + +$title=$langs->trans("DoneAndToDoActions"); +if ($status == 'done') $title=$langs->trans("DoneActions"); +if ($status == 'todo') $title=$langs->trans("ToDoActions"); + +$param=''; +if ($status) $param="&status=".$status; +if ($filter) $param.="&filter=".$filter; +if ($filtera) $param.="&filtera=".$filtera; +if ($filtert) $param.="&filtert=".$filtert; +if ($filterd) $param.="&filterd=".$filterd; +if ($socid) $param.="&socid=".$socid; +if ($showbirthday) $param.="&showbirthday=1"; +if ($pid) $param.="&projectid=".$pid; +if ($actioncode != '') $param.="&actioncode=".$actioncode; +if ($type) $param.="&type=".$type; +if ($action == 'show_day' || $action == 'show_week') $param.='&action='.$action; +$param.="&maxprint=".$maxprint; + +// Show navigation bar +if (empty($action) || $action=='show_month') +{ + $nav ="".img_previous($langs->trans("Previous"))."\n"; + $nav.=" ".dol_print_date(dol_mktime(0,0,0,$month,1,$year),"%b %Y"); + $nav.=" \n"; + $nav.="".img_next($langs->trans("Next"))."\n"; + $nav.="   (".$langs->trans("Today").")"; + $picto='calendar'; +} +if ($action=='show_week') +{ + $nav ="".img_previous($langs->trans("Previous"))."\n"; + $nav.=" ".dol_print_date(dol_mktime(0,0,0,$month,1,$year),"%Y").", ".$langs->trans("Week")." ".$week; + $nav.=" \n"; + $nav.="".img_next($langs->trans("Next"))."\n"; + $nav.="   (".$langs->trans("Today").")"; + $picto='calendarweek'; +} +if ($action=='show_day') +{ + $nav ="".img_previous($langs->trans("Previous"))."\n"; + $nav.=" ".dol_print_date(dol_mktime(0,0,0,$month,$day,$year),"daytextshort"); + $nav.=" \n"; + $nav.="".img_next($langs->trans("Next"))."\n"; + $nav.="   (".$langs->trans("Today").")"; + $picto='calendarday'; +} + +// Must be after the nav definition +$param.='&year='.$year.'&month='.$month.($day?'&day='.$day:''); +//print 'x'.$param; + + + + +$tabactive='cardperuser'; + +$paramnoaction=preg_replace('/action=[a-z_]+/','',$param); + +$head = calendars_prepare_head($paramnoaction); + +dol_fiche_head($head, $tabactive, $langs->trans('Agenda'), 0, 'action'); +print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirthday,$filtera,$filtert,$filterd,$pid,$socid,$action,$listofextcals,$actioncode,$usergroup); +dol_fiche_end(); + +print_fiche_titre($s,$link.'     '.$nav, ''); + + +// Get event in an array +$eventarray=array(); + +$sql = 'SELECT a.id,a.label,'; +$sql.= ' a.datep,'; +$sql.= ' a.datep2,'; +$sql.= ' a.datea,'; +$sql.= ' a.datea2,'; +$sql.= ' a.percent,'; +$sql.= ' a.fk_user_author,a.fk_user_action,a.fk_user_done,'; +$sql.= ' a.transparency, a.priority, a.fulldayevent, a.location,'; +$sql.= ' a.fk_soc, a.fk_contact,'; +$sql.= ' ca.code'; +$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"; +if ($usergroup > 0) $sql.= ", ".MAIN_DB_PREFIX."usergroup_user as ugu"; +$sql.= ' WHERE a.fk_action = ca.id'; +$sql.= ' AND a.entity IN ('.getEntity('agenda', 1).')'; +if ($actioncode) $sql.=" AND ca.code='".$db->escape($actioncode)."'"; +if ($pid) $sql.=" AND a.fk_project=".$db->escape($pid); +if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")"; +if ($socid > 0) $sql.= ' AND a.fk_soc = '.$socid; +if ($usergroup > 0) $sql.= " AND ugu.fk_user = a.fk_user_action"; +if ($action == 'show_day') +{ + $sql.= " AND ("; + $sql.= " (a.datep BETWEEN '".$db->idate(dol_mktime(0,0,0,$month,$day,$year))."'"; + $sql.= " AND '".$db->idate(dol_mktime(23,59,59,$month,$day,$year))."')"; + $sql.= " OR "; + $sql.= " (a.datep2 BETWEEN '".$db->idate(dol_mktime(0,0,0,$month,$day,$year))."'"; + $sql.= " AND '".$db->idate(dol_mktime(23,59,59,$month,$day,$year))."')"; + $sql.= " OR "; + $sql.= " (a.datep < '".$db->idate(dol_mktime(0,0,0,$month,$day,$year))."'"; + $sql.= " AND a.datep2 > '".$db->idate(dol_mktime(23,59,59,$month,$day,$year))."')"; + $sql.= ')'; +} +else +{ + // To limit array + $sql.= " AND ("; + $sql.= " (a.datep BETWEEN '".$db->idate(dol_mktime(0,0,0,$month,1,$year)-(60*60*24*7))."'"; // Start 7 days before + $sql.= " AND '".$db->idate(dol_mktime(23,59,59,$month,28,$year)+(60*60*24*10))."')"; // End 7 days after + 3 to go from 28 to 31 + $sql.= " OR "; + $sql.= " (a.datep2 BETWEEN '".$db->idate(dol_mktime(0,0,0,$month,1,$year)-(60*60*24*7))."'"; + $sql.= " AND '".$db->idate(dol_mktime(23,59,59,$month,28,$year)+(60*60*24*10))."')"; + $sql.= " OR "; + $sql.= " (a.datep < '".$db->idate(dol_mktime(0,0,0,$month,1,$year)-(60*60*24*7))."'"; + $sql.= " AND a.datep2 > '".$db->idate(dol_mktime(23,59,59,$month,28,$year)+(60*60*24*10))."')"; + $sql.= ')'; +} +if ($type) $sql.= " AND ca.id = ".$type; +if ($status == '0') { $sql.= " AND a.percent = 0"; } +if ($status == '-1') { $sql.= " AND a.percent = -1"; } // Not applicable +if ($status == '50') { $sql.= " AND (a.percent >= 0 AND a.percent < 100)"; } // Running +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 ($filtera > 0 || $filtert > 0 || $filterd > 0 || $usergroup > 0) +{ + $sql.= " AND ("; + if ($filtera > 0) $sql.= " a.fk_user_author = ".$filtera; + if ($filtert > 0) $sql.= ($filtera>0?" OR ":"")." a.fk_user_action = ".$filtert; + if ($filterd > 0) $sql.= ($filtera>0||$filtert>0?" OR ":"")." a.fk_user_done = ".$filterd; + if ($usergroup > 0) $sql.= ($filtera>0||$filtert>0||$filterd>0?" OR ":"")." ugu.fk_usergroup = ".$usergroup; + $sql.= ")"; +} +// Sort on date +$sql.= ' ORDER BY datep'; +//print $sql; + +dol_syslog("comm/action/index.php", LOG_DEBUG); +$resql=$db->query($sql); +if ($resql) +{ + $num = $db->num_rows($resql); + $i=0; + while ($i < $num) + { + $obj = $db->fetch_object($resql); + + // Create a new object action + $event=new ActionComm($db); + $event->id=$obj->id; + $event->datep=$db->jdate($obj->datep); // datep and datef are GMT date + $event->datef=$db->jdate($obj->datep2); + $event->type_code=$obj->code; + $event->libelle=$obj->label; + $event->percentage=$obj->percent; + $event->author->id=$obj->fk_user_author; // user id of creator + $event->usertodo->id=$obj->fk_user_action; // user id of owner + $event->userdone->id=$obj->fk_user_done; // deprecated + // $event->userstodo=... with s after user, in future version, will be an array with all id of user assigned to event + $event->priority=$obj->priority; + $event->fulldayevent=$obj->fulldayevent; + $event->location=$obj->location; + $event->transparency=$obj->transparency; + + $event->societe->id=$obj->fk_soc; + $event->contact->id=$obj->fk_contact; + + // Defined date_start_in_calendar and date_end_in_calendar property + // They are date start and end of action but modified to not be outside calendar view. + if ($event->percentage <= 0) + { + $event->date_start_in_calendar=$event->datep; + if ($event->datef != '' && $event->datef >= $event->datep) $event->date_end_in_calendar=$event->datef; + else $event->date_end_in_calendar=$event->datep; + } + else + { + $event->date_start_in_calendar=$event->datep; + if ($event->datef != '' && $event->datef >= $event->datep) $event->date_end_in_calendar=$event->datef; + else $event->date_end_in_calendar=$event->datep; + } + // Define ponctual property + if ($event->date_start_in_calendar == $event->date_end_in_calendar) + { + $event->ponctuel=1; + } + + // Check values + if ($event->date_end_in_calendar < $firstdaytoshow || + $event->date_start_in_calendar > $lastdaytoshow) + { + // This record is out of visible range + } + else + { + if ($event->date_start_in_calendar < $firstdaytoshow) $event->date_start_in_calendar=$firstdaytoshow; + if ($event->date_end_in_calendar > $lastdaytoshow) $event->date_end_in_calendar=$lastdaytoshow; + + // Add an entry in actionarray for each day + $daycursor=$event->date_start_in_calendar; + $annee = date('Y',$daycursor); + $mois = date('m',$daycursor); + $jour = date('d',$daycursor); + + // Loop on each day covered by action to prepare an index to show on calendar + $loop=true; $j=0; + $daykey=dol_mktime(0,0,0,$mois,$jour,$annee); + do + { + //if ($event->id==408) print 'daykey='.$daykey.' '.$event->datep.' '.$event->datef.'
    '; + + $eventarray[$daykey][]=$event; + $j++; + + $daykey+=60*60*24; + if ($daykey > $event->date_end_in_calendar) $loop=false; + } + while ($loop); + + //print 'Event '.$i.' id='.$event->id.' (start='.dol_print_date($event->datep).'-end='.dol_print_date($event->datef); + //print ' startincalendar='.dol_print_date($event->date_start_in_calendar).'-endincalendar='.dol_print_date($event->date_end_in_calendar).') was added in '.$j.' different index key of array
    '; + } + $i++; + + } +} +else +{ + dol_print_error($db); +} + +$maxnbofchar=18; +$cachethirdparties=array(); +$cachecontacts=array(); + +// Define theme_datacolor array +$color_file = DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/graph-color.php"; +if (is_readable($color_file)) +{ + include_once $color_file; +} +if (! is_array($theme_datacolor)) $theme_datacolor=array(array(120,130,150), array(200,160,180), array(190,190,220)); + + + + +/* TODO Export + print ' + + + + + +'; +*/ + +llxFooter(); + +$db->close(); diff --git a/htdocs/comm/action/rapport/index.php b/htdocs/comm/action/rapport/index.php index 78f1ca24827..3df7acec765 100644 --- a/htdocs/comm/action/rapport/index.php +++ b/htdocs/comm/action/rapport/index.php @@ -37,9 +37,6 @@ $action=GETPOST('action','alpha'); $month=GETPOST('month'); $year=GETPOST('year'); -$mesg=''; -$mesgs=array(); - $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); $page = GETPOST("page",'int'); @@ -64,7 +61,7 @@ if ($action == 'builddoc') $result=$cat->write_file(GETPOST('id','int')); if ($result < 0) { - $mesg=$cat->error; + setEventMessage($cat->error, 'errors'); } } @@ -89,7 +86,7 @@ $sql.= " ORDER BY year DESC, month DESC, df DESC"; $sql.= $db->plimit($limit+1,$offset); //print $sql; -dol_syslog("select sql=".$sql); +dol_syslog("select", LOG_DEBUG); $resql=$db->query($sql); if ($resql) { @@ -97,8 +94,6 @@ if ($resql) print_barre_liste($langs->trans("Actions"), $page, "index.php",'',$sortfield,$sortorder,'',$num); - dol_htmloutput_mesg($mesg,$mesgs); - $i = 0; print ''; print ''; diff --git a/htdocs/comm/address.php b/htdocs/comm/address.php index 8e892845c66..289c2acb7ef 100644 --- a/htdocs/comm/address.php +++ b/htdocs/comm/address.php @@ -106,7 +106,7 @@ if ($action == 'add' || $action == 'update') } else { - $mesg = $object->error; + setEventMessage($object->error, 'errors'); $action='create'; } } @@ -147,8 +147,8 @@ if ($action == 'add' || $action == 'update') else { $reload = 0; - $mesg = $object->error; - $actino= "edit"; + setEventMessage($object->error, 'errors'); + $action= "edit"; } } @@ -181,9 +181,6 @@ $form = new Form($db); $formcompany = new FormCompany($db); $countrynotdefined=$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')'; -dol_htmloutput_errors($mesg); - - if ($action == 'create') { if ($user->rights->societe->creer) @@ -307,7 +304,7 @@ elseif ($action == 'edit') $societe->fetch($socid); $head = societe_prepare_head($societe); - dol_fiche_head($head, 'card', $societe->nom); + dol_fiche_head($head, 'card', $societe->name); print_titre($langs->trans("EditAddress")); print "
    \n"; @@ -410,7 +407,7 @@ else $societe->fetch($object->socid); $head = societe_prepare_head($societe); - dol_fiche_head($head, 'customer', $societe->nom); + dol_fiche_head($head, 'customer', $societe->name); // Confirmation delete diff --git a/htdocs/comm/admin/index.html b/htdocs/comm/admin/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/comm/admin/propal_extrafields.php b/htdocs/comm/admin/propal_extrafields.php index 434d2fc1972..d41dd27b362 100644 --- a/htdocs/comm/admin/propal_extrafields.php +++ b/htdocs/comm/admin/propal_extrafields.php @@ -36,7 +36,7 @@ $extrafields = new ExtraFields($db); $form = new Form($db); // List of supported format -$tmptype2label=getStaticMember(get_class($extrafields),'type2label'); +$tmptype2label=ExtraFields::$type2label; $type2label=array(''); foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val); diff --git a/htdocs/comm/admin/propaldet_extrafields.php b/htdocs/comm/admin/propaldet_extrafields.php index c9c28105466..e83f31e993f 100644 --- a/htdocs/comm/admin/propaldet_extrafields.php +++ b/htdocs/comm/admin/propaldet_extrafields.php @@ -43,7 +43,7 @@ $extrafields = new ExtraFields($db); $form = new Form($db); // List of supported format -$tmptype2label=getStaticMember(get_class($extrafields),'type2label'); +$tmptype2label=ExtraFields::$type2label; $type2label=array(''); foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val); diff --git a/htdocs/comm/fiche.php b/htdocs/comm/fiche.php index 7a79b658a76..76176930da3 100644 --- a/htdocs/comm/fiche.php +++ b/htdocs/comm/fiche.php @@ -5,7 +5,7 @@ * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2008 Raphael Bertrand (Resultic) - * Copyright (C) 2010-2013 Juanjo Menent + * Copyright (C) 2010-2014 Juanjo Menent * Copyright (C) 2013 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify @@ -87,7 +87,7 @@ if ($action == 'setcustomeraccountancycode') $result=$object->update($object->id,$user,1,1,0); if ($result < 0) { - $mesgs[]=join(',',$object->errors); + setEventMessage($object->errors, 'errors'); } $action=""; } @@ -288,30 +288,28 @@ if ($id > 0) print ''; // Local Taxes - if($mysoc->country_code=='ES') + if($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj=="1") { - if($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj=="1") - { - print ''; - print ''; - } - elseif($mysoc->localtax1_assuj=="1") - { - print ''; - } - elseif($mysoc->localtax2_assuj=="1") - { - print ''; - } + print ''; + print ''; } + elseif($mysoc->localtax1_assuj=="1") + { + print ''; + } + elseif($mysoc->localtax2_assuj=="1") + { + print ''; + } + // TVA Intra print ''; print ''; - print ''; + print ':'; + print ''; print ''; print "
    '.$langs->trans('LocalTax1IsUsedES').''; - print yn($object->localtax1_assuj); - print '
    '.$langs->trans('LocalTax2IsUsedES').''; - print yn($object->localtax2_assuj); - print '
    '.$langs->trans("LocalTax1IsUsedES").''; - print yn($object->localtax1_assuj); - print '
    '.$langs->trans("LocalTax2IsUsedES").''; - print yn($object->localtax2_assuj); - print '
    '.$langs->trans('LocalTax1IsUsedES').''; + print yn($object->localtax1_assuj); + print '
    '.$langs->trans('LocalTax2IsUsedES').''; + print yn($object->localtax2_assuj); + print '
    '.$langs->trans("LocalTax1IsUsedES").''; + print yn($object->localtax1_assuj); + print '
    '.$langs->trans("LocalTax2IsUsedES").''; + print yn($object->localtax2_assuj); + print '
    '.$langs->trans('VATIntra').''; @@ -821,11 +819,11 @@ if ($id > 0) /* * Barre d'actions */ - + $parameters = array(); $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been - - + + print '
    '; if (! empty($conf->propal->enabled) && $user->rights->propal->creer) @@ -928,9 +926,7 @@ else dol_print_error($db,'Bad value for socid parameter'); } -dol_htmloutput_mesg('',$mesgs); - // End of page llxFooter(); + $db->close(); -?> diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index 98653992025..eada82f7f6a 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -78,9 +78,9 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire) print ''; print ''; print ''; - print ''; + print ''; print ''; - print ''; + print ''; print ''; print "
    '.$langs->trans("SearchAProposal").'
    '.$langs->trans("Ref").'::
    '.$langs->trans("Other").':
    :
    \n"; print "
    \n"; @@ -95,8 +95,8 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire) print ''; print '
    '.$langs->trans("SearchACustomerOrder").'
    '; - print $langs->trans("Ref").':
    '.$langs->trans("Other").':
    :

    \n"; } @@ -110,9 +110,9 @@ if (! empty($conf->contrat->enabled) && $user->rights->contrat->lire) print ''; print ''; print ''; - print ''; + print ''; print ''; - print ''; + print ''; print ''; print "
    '.$langs->trans("SearchAContract").'
    '.$langs->trans("Ref").'::
    '.$langs->trans("Other").':
    :
    \n"; print "
    "; diff --git a/htdocs/comm/list.php b/htdocs/comm/list.php index 78d2b14c7bc..18f03f28ca9 100644 --- a/htdocs/comm/list.php +++ b/htdocs/comm/list.php @@ -149,7 +149,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) $sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($conf->liste_limit +1, $offset); -dol_syslog('comm/list.php: sql='.$sql,LOG_DEBUG); +dol_syslog('comm/list.php:', LOG_DEBUG); $result = $db->query($sql); if ($result) { diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index d6599f204f1..df51f91e1a2 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -2,6 +2,7 @@ /* Copyright (C) 2004 Rodolphe Quiedeville * Copyright (C) 2005-2013 Laurent Destailleur * Copyright (C) 2005-2010 Regis Houssin + * Copyright (C) 2014 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 @@ -26,6 +27,7 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/modules/mailings/modules_mailings.php'; require_once DOL_DOCUMENT_ROOT.'/comm/mailing/class/mailing.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmailing.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/emailing.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; @@ -36,8 +38,6 @@ $langs->load("mails"); if (! $user->rights->mailing->lire || $user->societe_id > 0) accessforbidden(); -$mesg = ''; - $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); $page = GETPOST("page",'int'); @@ -54,6 +54,7 @@ $action=GETPOST("action"); $search_lastname=GETPOST("search_lastname"); $search_firstname=GETPOST("search_firstname"); $search_email=GETPOST("search_email"); +$search_dest_status=GETPOST('search_dest_status'); // Search modules dirs $modulesdir = dolGetModulesDirs('/mailings'); @@ -170,6 +171,7 @@ if ($_POST["button_removefilter"]) llxHeader('',$langs->trans("Mailing"),'EN:Module_EMailing|FR:Module_Mailing|ES:Módulo_Mailing'); $form = new Form($db); +$formmailing = new FormMailing($db); if ($object->fetch($id) >= 0) { @@ -218,11 +220,9 @@ if ($object->fetch($id) >= 0) print ""; - dol_htmloutput_mesg($mesg); - $var=!$var; - $allowaddtarget=($object->statut == 0 || $object->statut == 1); + $allowaddtarget=($object->statut == 0); // Show email selectors if ($allowaddtarget && $user->rights->mailing->creer) @@ -359,6 +359,7 @@ if ($object->fetch($id) >= 0) if ($search_lastname) $sql.= " AND mc.lastname LIKE '%".$db->escape($search_lastname)."%'"; if ($search_firstname) $sql.= " AND mc.firstname LIKE '%".$db->escape($search_firstname)."%'"; if ($search_email) $sql.= " AND mc.email LIKE '%".$db->escape($search_email)."%'"; + if (!empty($search_dest_status)) $sql.= " AND mc.statut=".$db->escape($search_dest_status)." "; $sql .= $db->order($sortfield,$sortorder); $sql .= $db->plimit($conf->liste_limit+1, $offset); @@ -378,7 +379,9 @@ if ($object->fetch($id) >= 0) print ''; print ''; - $cleartext='
    '.$langs->trans("ToClearAllRecipientsClickHere").': '.''; + if ($allowaddtarget) { + $cleartext='
    '.$langs->trans("ToClearAllRecipientsClickHere").': '.''; + } print_barre_liste($langs->trans("MailSelectedRecipients").$cleartext,$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,"",$num,$object->nbemail,''); @@ -401,7 +404,7 @@ if ($object->fetch($id) >= 0) print_liste_field_titre($langs->trans("OtherInformations"),$_SERVER["PHP_SELF"],"",$param,"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Source"),$_SERVER["PHP_SELF"],"",$param,"",'align="center"',$sortfield,$sortorder); - // Date sendinf + // Date sending if ($object->statut < 2) { print '
     '; + print ' '; + print '
    '; + print ''; + print ' '; + print ''; + print ' '; + print ''; + print $formmailing->selectDestinariesStatus($search_dest_status,'search_dest_status',1); + print ''; print ''; print '  '; print ''; @@ -497,7 +518,7 @@ if ($object->fetch($id) >= 0) { print ' '.$langs->trans("MailingStatusNotSent"); - if ($user->rights->mailing->creer) { + if ($user->rights->mailing->creer && $allowaddtarget) { print ''.img_delete($langs->trans("RemoveRecipient")); } print ''.$obj->date_envoi.''; - if ($obj->statut==-1) print $langs->trans("MailingStatusError").' '.img_error(); - if ($obj->statut==1) print $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"),'statut4'); - if ($obj->statut==2) print $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"),'statut6'); - if ($obj->statut==3) print $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"),'statut5'); + print $object::libStatutDest($obj->statut,2); print '
    '; print ''; print ''; @@ -731,9 +747,9 @@ else { // Pour des raisons de securite, on ne permet pas cette fonction via l'IHM, // on affiche donc juste un message - $mesgembedded.='
    '.$langs->trans("MailingNeedCommand").'
    '; - $mesgembedded.='
    '; - $mesgembedded.='

    '.$langs->trans("MailingNeedCommand2").'
    '; + setEventMessage($langs->trans("MailingNeedCommand"), 'warnings'); + setEventMessage('', 'warnings'); + setEventMessage($langs->trans("MailingNeedCommand2"), 'warnings'); $_GET["action"]=''; } else @@ -829,9 +845,6 @@ else print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id,$langs->trans('CloneEMailing'),$langs->trans('ConfirmCloneEMailing',$object->ref),'confirm_clone',$formquestion,'yes',2,240); } - - dol_htmloutput_mesg($mesg); - /* * Boutons d'action */ @@ -840,7 +853,7 @@ else { print "\n\n
    \n"; - if (($object->statut == 0 || $object->statut == 1) && $user->rights->mailing->creer) + if (($object->statut == 0) && $user->rights->mailing->creer) { print ''.$langs->trans("EditMailing").''; } @@ -916,12 +929,6 @@ else print '

    '; } - if (! empty($mesgembedded)) - { - dol_htmloutput_mesg($mesgembedded,'','warning',1); - print '
    '; - } - // Affichage formulaire de TEST if ($action == 'test') { @@ -1017,8 +1024,6 @@ else * Mailing en mode edition */ - dol_htmloutput_mesg($mesg); - print '
    '.$langs->trans("MailTitle").'
    '.$langs->trans("MailFrom").'
    '; // Ref diff --git a/htdocs/comm/mailing/liste.php b/htdocs/comm/mailing/liste.php index 617096561a3..3e06e5af005 100644 --- a/htdocs/comm/mailing/liste.php +++ b/htdocs/comm/mailing/liste.php @@ -82,7 +82,6 @@ else $sql.= $db->plimit($conf->liste_limit +1, $offset); } -dol_syslog("sql=".$sql); //print $sql; $result = $db->query($sql); if ($result) diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index eaf4f0031eb..35ab381a35f 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -5,10 +5,11 @@ * Copyright (C) 2005 Marc Barilley / Ocebo * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2006 Andre Cianfarani - * Copyright (C) 2010-2013 Juanjo Menent + * Copyright (C) 2010-2014 Juanjo Menent * Copyright (C) 2010-2011 Philippe Grand * Copyright (C) 2012-2013 Christophe Battarel * Copyright (C) 2013-2014 Florian Henry + * Copyright (C) 2014 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,7 @@ $langs->load('bills'); $langs->load('orders'); $langs->load('products'); $langs->load("deliveries"); +$langs->load('sendings'); if (! empty($conf->margin->enabled)) $langs->load('margins'); @@ -150,7 +152,7 @@ else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights-> $outputlangs = $langs; if (! empty($conf->global->MAIN_MULTILANGS)) { $outputlangs = new Translate("", $conf); - $newlang = (GETPOST('lang_id') ? GETPOST('lang_id') : $object->client->default_lang); + $newlang = (GETPOST('lang_id') ? GETPOST('lang_id') : $object->thirdparty->default_lang); $outputlangs->setDefaultLang($newlang); } $ret = $object->fetch($id); // Reload to get new records @@ -170,7 +172,7 @@ else if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->pr $outputlangs = $langs; if (! empty($conf->global->MAIN_MULTILANGS)) { $outputlangs = new Translate("", $conf); - $newlang = (GETPOST('lang_id') ? GETPOST('lang_id') : $object->client->default_lang); + $newlang = (GETPOST('lang_id') ? GETPOST('lang_id') : $object->thirdparty->default_lang); $outputlangs->setDefaultLang($newlang); } $ret = $object->fetch($id); // Reload to get new records @@ -237,11 +239,13 @@ else if ($action == 'add' && $user->rights->propal->creer) { $error ++; } - if (! $error) { + if (! $error) + { $db->begin(); // Si on a selectionne une propal a copier, on realise la copie - if (GETPOST('createmode') == 'copy' && GETPOST('copie_propal')) { + if (GETPOST('createmode') == 'copy' && GETPOST('copie_propal')) + { if ($object->fetch(GETPOST('copie_propal')) > 0) { $object->ref = GETPOST('ref'); $object->datep = $datep; @@ -249,9 +253,11 @@ else if ($action == 'add' && $user->rights->propal->creer) { $object->availability_id = GETPOST('availability_id'); $object->demand_reason_id = GETPOST('demand_reason_id'); $object->fk_delivery_address = GETPOST('fk_address'); + $object->shipping_method_id = GETPOST('shipping_method_id', 'int'); $object->duree_validite = $duration; $object->cond_reglement_id = GETPOST('cond_reglement_id'); $object->mode_reglement_id = GETPOST('mode_reglement_id'); + $object->fk_account = GETPOST('fk_account', 'int'); $object->remise_percent = GETPOST('remise_percent'); $object->remise_absolue = GETPOST('remise_absolue'); $object->socid = GETPOST('socid'); @@ -274,10 +280,11 @@ else if ($action == 'add' && $user->rights->propal->creer) { $object->availability_id = GETPOST('availability_id'); $object->demand_reason_id = GETPOST('demand_reason_id'); $object->fk_delivery_address = GETPOST('fk_address'); + $object->shipping_method_id = GETPOST('shipping_method_id', 'int'); $object->duree_validite = GETPOST('duree_validite'); $object->cond_reglement_id = GETPOST('cond_reglement_id'); $object->mode_reglement_id = GETPOST('mode_reglement_id'); - + $object->fk_account = GETPOST('fk_account', 'int'); $object->contactid = GETPOST('contactidp'); $object->fk_project = GETPOST('projectid'); $object->modelpdf = GETPOST('model'); @@ -287,7 +294,8 @@ else if ($action == 'add' && $user->rights->propal->creer) { $object->origin = GETPOST('origin'); $object->origin_id = GETPOST('originid'); - for($i = 1; $i <= $conf->global->PRODUCT_SHOW_WHEN_CREATE; $i ++) { + for($i = 1; $i <= $conf->global->PRODUCT_SHOW_WHEN_CREATE; $i ++) + { if ($_POST ['idprod' . $i]) { $xid = 'idprod' . $i; $xqty = 'qty' . $i; @@ -304,8 +312,137 @@ else if ($action == 'add' && $user->rights->propal->creer) { } } - if (! $error) { - $id = $object->create($user); + if (! $error) + { + if ($origin && $originid) + { + // Parse element/subelement (ex: project_task) + $element = $subelement = $origin; + if (preg_match('/^([^_]+)_([^_]+)/i', $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 == 'inter') { + $element = $subelement = 'ficheinter'; + } + if ($element == 'shipping') { + $element = $subelement = 'expedition'; + } + + $object->origin = $origin; + $object->origin_id = $originid; + + // Possibility to add external linked objects with hooks + $object->linked_objects [$object->origin] = $object->origin_id; + if (is_array($_POST['other_linked_objects']) && ! empty($_POST['other_linked_objects'])) { + $object->linked_objects = array_merge($object->linked_objects, $_POST['other_linked_objects']); + } + + $id = $object->create($user); + + if ($id > 0) + { + dol_include_once('/' . $element . '/class/' . $subelement . '.class.php'); + + $classname = ucfirst($subelement); + $srcobject = new $classname($db); + + dol_syslog("Try to find source object origin=" . $object->origin . " originid=" . $object->origin_id . " to add lines"); + $result = $srcobject->fetch($object->origin_id); + + if ($result > 0) + { + $lines = $srcobject->lines; + if (empty($lines) && method_exists($srcobject, 'fetch_lines')) $lines = $srcobject->fetch_lines(); + + $fk_parent_line=0; + $num=count($lines); + for ($i=0;$i<$num;$i++) + { + $label=(! empty($lines[$i]->label)?$lines[$i]->label:''); + $desc=(! empty($lines[$i]->desc)?$lines[$i]->desc:$lines[$i]->libelle); + + // 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; + } + + // 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; + } + + $tva_tx=get_default_tva($mysoc, $object->thirdparty); + + $result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->qty, $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, $date_start, $date_end, $array_option); + + 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; + } + } + + // 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 { + $mesgs [] = $srcobject->error; + $error ++; + } + } else { + $mesgs [] = $object->error; + $error ++; + } + } // Standard creation + else + { + $id = $object->create($user); + } if ($id > 0) { // Insertion contact par defaut si defini @@ -325,7 +462,7 @@ else if ($action == 'add' && $user->rights->propal->creer) { $outputlangs = $langs; if (! empty($conf->global->MAIN_MULTILANGS)) { $outputlangs = new Translate("", $conf); - $newlang = (GETPOST('lang_id') ? GETPOST('lang_id') : $object->client->default_lang); + $newlang = (GETPOST('lang_id') ? GETPOST('lang_id') : $object->thirdparty->default_lang); $outputlangs->setDefaultLang($newlang); } $ret = $object->fetch($id); // Reload to get new records @@ -412,11 +549,11 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G // Recipient was provided from combo list if ($_POST ['receiver'] == 'thirdparty') // Id of third party { - $sendto = $object->client->email; + $sendto = $object->thirdparty->email; $sendtoid = 0; } else // Id du contact { - $sendto = $object->client->contact_get_property($_POST ['receiver'], 'email'); + $sendto = $object->thirdparty->contact_get_property($_POST ['receiver'], 'email'); $sendtoid = $_POST ['receiver']; } } @@ -428,6 +565,7 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G $replyto = $_POST ['replytoname'] . ' <' . $_POST ['replytomail'] . '>'; $message = $_POST ['message']; $sendtocc = $_POST ['sendtocc']; + $sendtobcc = (empty($conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO)?'':$conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO); $deliveryreceipt = $_POST ['deliveryreceipt']; if (dol_strlen($_POST ['subject'])) @@ -454,7 +592,7 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G // Envoi de la propal require_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php'; - $mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, '', $deliveryreceipt, - 1); + $mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, $sendtobcc, $deliveryreceipt, - 1); if ($mailfile->error) { setEventMessage($mailfile->error, 'errors'); } else { @@ -520,7 +658,7 @@ if ($action == 'modif' && $user->rights->propal->creer) { $outputlangs = $langs; if (! empty($conf->global->MAIN_MULTILANGS)) { $outputlangs = new Translate("", $conf); - $newlang = (GETPOST('lang_id') ? GETPOST('lang_id') : $object->client->default_lang); + $newlang = (GETPOST('lang_id') ? GETPOST('lang_id') : $object->thirdparty->default_lang); $outputlangs->setDefaultLang($newlang); } $ret = $object->fetch($id); // Reload to get new records @@ -606,18 +744,22 @@ else if ($action == 'addline' && $user->rights->propal->creer) { $label = ((GETPOST('product_label') && GETPOST('product_label') != $prod->label) ? GETPOST('product_label') : ''); // If prices fields are update - $tva_tx = get_default_tva($mysoc, $object->client, $prod->id); - $tva_npr = get_default_npr($mysoc, $object->client, $prod->id); + $tva_tx = get_default_tva($mysoc, $object->thirdparty, $prod->id); + $tva_npr = get_default_npr($mysoc, $object->thirdparty, $prod->id); + $pu_ht = $prod->price; + $pu_ttc = $prod->price_ttc; + $price_min = $prod->price_min; + $price_base_type = $prod->price_base_type; // On defini prix unitaire - if (! empty($conf->global->PRODUIT_MULTIPRICES) && $object->client->price_level) + if (! empty($conf->global->PRODUIT_MULTIPRICES) && $object->thirdparty->price_level) { - $pu_ht = $prod->multiprices [$object->client->price_level]; - $pu_ttc = $prod->multiprices_ttc [$object->client->price_level]; - $price_min = $prod->multiprices_min [$object->client->price_level]; - $price_base_type = $prod->multiprices_base_type [$object->client->price_level]; - $tva_tx=$prod->multiprices_tva_tx[$object->client->price_level]; - $tva_npr=$prod->multiprices_recuperableonly[$object->client->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]; + $tva_tx=$prod->multiprices_tva_tx[$object->thirdparty->price_level]; + $tva_npr=$prod->multiprices_recuperableonly[$object->thirdparty->price_level]; } elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { @@ -628,30 +770,15 @@ else if ($action == 'addline' && $user->rights->propal->creer) { $filter = array('t.fk_product' => $prod->id,'t.fk_soc' => $object->thirdparty->id); $result = $prodcustprice->fetch_all('', '', 0, 0, $filter); - if ($result >= 0) { + if ($result) { if (count($prodcustprice->lines) > 0) { - $found = true; - $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; - }else { - $pu_ht = $prod->price; - $pu_ttc = $prod->price_ttc; - $price_min = $prod->price_min; - $price_base_type = $prod->price_base_type; + $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; } - }else { - setEventMessage($prodcustprice->error,'errors'); } } - else - { - $pu_ht = $prod->price; - $pu_ttc = $prod->price_ttc; - $price_min = $prod->price_min; - $price_base_type = $prod->price_base_type; - } // if price ht is forced (ie: calculated by margin rate and cost price) if (! empty($price_ht)) { @@ -678,7 +805,7 @@ else if ($action == 'addline' && $user->rights->propal->creer) { if (empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id'); if (empty($newlang)) - $newlang = $object->client->default_lang; + $newlang = $object->thirdparty->default_lang; if (! empty($newlang)) { $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); @@ -723,8 +850,8 @@ else if ($action == 'addline' && $user->rights->propal->creer) { $date_end = dol_mktime(0, 0, 0, GETPOST('date_end' . $predef . 'month'), GETPOST('date_end' . $predef . 'day'), GETPOST('date_end' . $predef . 'year')); // Local Taxes - $localtax1_tx = get_localtax($tva_tx, 1, $object->client); - $localtax2_tx = get_localtax($tva_tx, 2, $object->client); + $localtax1_tx = get_localtax($tva_tx, 1, $object->thirdparty); + $localtax2_tx = get_localtax($tva_tx, 2, $object->thirdparty); $info_bits = 0; if ($tva_npr) @@ -745,7 +872,7 @@ else if ($action == 'addline' && $user->rights->propal->creer) { $outputlangs = $langs; if (! empty($conf->global->MAIN_MULTILANGS)) { $outputlangs = new Translate("", $conf); - $newlang = (GETPOST('lang_id') ? GETPOST('lang_id') : $object->client->default_lang); + $newlang = (GETPOST('lang_id') ? GETPOST('lang_id') : $object->thirdparty->default_lang); $outputlangs->setDefaultLang($newlang); } $ret = $object->fetch($id); // Reload to get new records @@ -804,8 +931,8 @@ else if ($action == 'updateligne' && $user->rights->propal->creer && GETPOST('sa // Define vat_rate $vat_rate = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0); $vat_rate = str_replace('*', '', $vat_rate); - $localtax1_rate = get_localtax($vat_rate, 1, $object->client); - $localtax2_rate = get_localtax($vat_rate, 2, $object->client); + $localtax1_rate = get_localtax($vat_rate, 1, $object->thirdparty); + $localtax2_rate = get_localtax($vat_rate, 2, $object->thirdparty); $pu_ht = GETPOST('price_ht'); // Add buying price @@ -840,8 +967,8 @@ else if ($action == 'updateligne' && $user->rights->propal->creer && GETPOST('sa $type = $product->type; $price_min = $product->price_min; - if (! empty($conf->global->PRODUIT_MULTIPRICES) && ! empty($object->client->price_level)) - $price_min = $product->multiprices_min [$object->client->price_level]; + 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') : ''); @@ -873,7 +1000,7 @@ else if ($action == 'updateligne' && $user->rights->propal->creer && GETPOST('sa $outputlangs = $langs; if (! empty($conf->global->MAIN_MULTILANGS)) { $outputlangs = new Translate("", $conf); - $newlang = (GETPOST('lang_id') ? GETPOST('lang_id') : $object->client->default_lang); + $newlang = (GETPOST('lang_id') ? GETPOST('lang_id') : $object->thirdparty->default_lang); $outputlangs->setDefaultLang($newlang); } $ret = $object->fetch($id); // Reload to get new records @@ -915,7 +1042,7 @@ else if ($action == 'builddoc' && $user->rights->propal->creer) { $outputlangs = $langs; if (! empty($conf->global->MAIN_MULTILANGS)) { $outputlangs = new Translate("", $conf); - $newlang = (GETPOST('lang_id') ? GETPOST('lang_id') : $object->client->default_lang); + $newlang = (GETPOST('lang_id') ? GETPOST('lang_id') : $object->thirdparty->default_lang); $outputlangs->setDefaultLang($newlang); } $ret = $object->fetch($id); // Reload to get new records @@ -979,6 +1106,16 @@ else if ($action == 'setmode' && $user->rights->propal->creer) { $result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int')); } +// bank account +else if ($action == 'setbankaccount' && $user->rights->propal->creer) { + $result=$object->setBankAccount(GETPOST('fk_account', 'int')); +} + +// shipping method +else if ($action == 'setshippingmethod' && $user->rights->propal->creer) { + $result=$object->setShippingMethod(GETPOST('shipping_method_id', 'int')); +} + /* * Ordonnancement des lignes */ @@ -991,7 +1128,7 @@ else if ($action == 'up' && $user->rights->propal->creer) { $outputlangs = $langs; if (! empty($conf->global->MAIN_MULTILANGS)) { $outputlangs = new Translate("", $conf); - $newlang = (GETPOST('lang_id') ? GETPOST('lang_id') : $object->client->default_lang); + $newlang = (GETPOST('lang_id') ? GETPOST('lang_id') : $object->thirdparty->default_lang); $outputlangs->setDefaultLang($newlang); } $ret = $object->fetch($id); // Reload to get new records @@ -1010,7 +1147,7 @@ else if ($action == 'down' && $user->rights->propal->creer) { $outputlangs = $langs; if (! empty($conf->global->MAIN_MULTILANGS)) { $outputlangs = new Translate("", $conf); - $newlang = (GETPOST('lang_id') ? GETPOST('lang_id') : $object->client->default_lang); + $newlang = (GETPOST('lang_id') ? GETPOST('lang_id') : $object->thirdparty->default_lang); $outputlangs->setDefaultLang($newlang); } $ret = $object->fetch($id); // Reload to get new records @@ -1112,6 +1249,61 @@ if ($action == 'create') { if ($socid > 0) $res = $soc->fetch($socid); + // Load objectsrc + if (! empty($origin) && ! empty($originid)) + { + // Parse element/subelement (ex: project_task) + $element = $subelement = $origin; + if (preg_match('/^([^_]+)_([^_]+)/i', $origin, $regs)) { + $element = $regs [1]; + $subelement = $regs [2]; + } + + if ($element == 'project') { + $projectid = $originid; + } else { + // For compatibility + if ($element == 'order' || $element == 'commande') { + $element = $subelement = 'commande'; + } + if ($element == 'propal') { + $element = 'comm/propal'; + $subelement = 'propal'; + } + if ($element == 'contract') { + $element = $subelement = 'contrat'; + } + if ($element == 'shipping') { + $element = $subelement = 'expedition'; + } + + dol_include_once('/' . $element . '/class/' . $subelement . '.class.php'); + + $classname = ucfirst($subelement); + $objectsrc = new $classname($db); + $objectsrc->fetch($originid); + if (empty($objectsrc->lines) && method_exists($objectsrc, 'fetch_lines')) + $objectsrc->fetch_lines(); + $objectsrc->fetch_thirdparty(); + + $projectid = (! empty($objectsrc->fk_project) ? $objectsrc->fk_project : ''); + $ref_client = (! empty($objectsrc->ref_client) ? $objectsrc->ref_client : ''); + $ref_int = (! empty($objectsrc->ref_int) ? $objectsrc->ref_int : ''); + + $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)); + $mode_reglement_id = (! empty($objectsrc->mode_reglement_id)?$objectsrc->mode_reglement_id:(! empty($soc->mode_reglement_id)?$soc->mode_reglement_id:0)); + $remise_percent = (! empty($objectsrc->remise_percent)?$objectsrc->remise_percent:(! empty($soc->remise_percent)?$soc->remise_percent:0)); + $remise_absolue = (! empty($objectsrc->remise_absolue)?$objectsrc->remise_absolue:(! empty($soc->remise_absolue)?$soc->remise_absolue:0)); + $dateinvoice = (empty($dateinvoice)?(empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''):$dateinvoice); + + // Replicate extrafields + $objectsrc->fetch_optionals($originid); + $object->array_options = $objectsrc->array_options; + } + } + $object = new Propal($db); print '
    '; @@ -1188,6 +1380,11 @@ if ($action == 'create') { $form->select_types_paiements($soc->mode_reglement_id, 'mode_reglement_id'); print ''; + // Bank Account + print '
    '; + // What trigger creation print ''; + // Shipping Method + if (! empty($conf->expedition->enabled)) { + print ''; + } + // Delivery date (or manufacturing) print ''; print '
    ' . $langs->trans('BankAccount') . ''; + $form->select_comptes($fk_account, 'fk_account', 0, '', 1); + print '
    ' . $langs->trans('Source') . ''; $form->selectInputReason('', 'demand_reason_id', "SRC_PROP", 1); @@ -1198,6 +1395,13 @@ if ($action == 'create') { $form->selectAvailabilityDelay('', 'availability_id', '', 1); print '
    ' . $langs->trans('SendingMethod') . ''; + print $form->selectShippingMethod($shipping_method_id, 'shipping_method_id', '', 1); + print '
    ' . $langs->trans("DeliveryDate") . ''; @@ -1250,16 +1454,62 @@ if ($action == 'create') { print $object->showOptionals($extrafields, 'edit'); } - print "
    "; + + // Lines from source + if (! empty($origin) && ! empty($originid) && is_object($objectsrc)) + { + // TODO for compatibility + if ($origin == 'contrat') { + // Calcul contrat->price (HT), contrat->total (TTC), contrat->tva + $objectsrc->remise_absolue = $remise_absolue; + $objectsrc->remise_percent = $remise_percent; + $objectsrc->update_price(1, - 1, 1); + } + + print "\n"; + print "\n"; + print '' . "\n"; + print '' . "\n"; + print '' . "\n"; + print ''; + print ''; + + $newclassname = $classname; + if ($newclassname == 'Propal') + $newclassname = 'CommercialProposal'; + elseif ($newclassname == 'Commande') + $newclassname = 'Order'; + elseif ($newclassname == 'Expedition') + $newclassname = 'Sending'; + elseif ($newclassname == 'Fichinter') + $newclassname = 'Intervention'; + + print '
    ' . $langs->trans($newclassname) . '' . $objectsrc->getNomUrl(1) . '
    ' . $langs->trans('TotalHT') . '' . price($objectsrc->total_ht) . '
    ' . $langs->trans('TotalVAT') . '' . price($objectsrc->total_tva) . "
    ' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '' . price($objectsrc->total_localtax1) . "
    ' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '' . price($objectsrc->total_localtax2) . "
    ' . $langs->trans('TotalTTC') . '' . price($objectsrc->total_ttc) . "
    \n"; + + print '
    '; + /* * Combobox pour la fonction de copie */ - if (empty($conf->global->PROPAL_CLONE_ON_CREATE_PAGE)) { - print ''; - } + 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 ''; if (! empty($conf->global->PROPAL_CLONE_ON_CREATE_PAGE)) @@ -1303,7 +1553,8 @@ if ($action == 'create') { print ''; } - if (! empty($conf->global->PRODUCT_SHOW_WHEN_CREATE)) { + if (! empty($conf->global->PRODUCT_SHOW_WHEN_CREATE)) + { print '
    ' . $langs->trans("CreateEmptyPropal") . '
    '; if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) { $lib = $langs->trans("ProductsAndServices"); @@ -1332,6 +1583,7 @@ if ($action == 'create') { } if (! empty($conf->global->PROPAL_CLONE_ON_CREATE_PAGE) || ! empty($conf->global->PRODUCT_SHOW_WHEN_CREATE)) print '

    '; + $langs->load("bills"); print '
    '; print ''; @@ -1339,6 +1591,22 @@ if ($action == 'create') { print '
    '; print ""; + + + // Show origin lines + if (! empty($origin) && ! empty($originid) && is_object($objectsrc)) { + print '
    '; + + $title = $langs->trans('ProductsAndServices'); + print_titre($title); + + print ''; + + $objectsrc->printOriginLinesList(); + + print '
    '; + } + } else { /* * Show object in view mode @@ -1390,7 +1658,7 @@ if ($action == 'create') { $numref = $object->getNextNumRef($soc); if (empty($numref)) { $error ++; - dol_htmloutput_errors($object->error); + setEventMessage($object->error, 'errors'); } } else { $numref = $object->ref; @@ -1596,6 +1864,25 @@ if ($action == 'create') { print '
'; + print ''; + if ($action != 'editshippingmethod' && $user->rights->propal->creer) + print ''; + print '
'; + print $langs->trans('SendingMethod'); + print 'id.'">'.img_edit($langs->trans('SetShippingMode'),1).'
'; + print '
'; + if ($action == 'editshippingmethod') { + $form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$object->id, $object->shipping_method_id, 'shipping_method_id', 1); + } else { + $form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$object->id, $object->shipping_method_id, 'none'); + } + print '
'; print ''; + print ''; + // Amount HT print ''; print ''; @@ -1741,13 +2045,13 @@ if ($action == 'create') { print ''; // Amount Local Taxes - if ($mysoc->localtax1_assuj == "1") // Localtax1 + if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) // Localtax1 { print ''; print ''; print ''; } - if ($mysoc->localtax2_assuj == "1") // Localtax2 + if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) // Localtax2 { print ''; print ''; @@ -1985,25 +2289,30 @@ if ($action == 'create') { */ if ($action == 'presend') { + $object->fetch_projet(); + $ref = dol_sanitizeFileName($object->ref); include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; $fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref, preg_quote($ref, '/')); $file = $fileparams ['fullname']; + // Define output language + $outputlangs = $langs; + $newlang = ''; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) + $newlang = $_REQUEST['lang_id']; + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) + $newlang = $object->thirdparty->default_lang; + + if (!empty($newlang)) + { + $outputlangs = new Translate('', $conf); + $outputlangs->setDefaultLang($newlang); + $outputlangs->load('commercial'); + } + // Build document if it not exists if (! $file || ! is_readable($file)) { - // Define output language - $outputlangs = $langs; - $newlang = ''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) - $newlang = $_REQUEST['lang_id']; - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) - $newlang = $object->client->default_lang; - if (! empty($newlang)) { - $outputlangs = new Translate("", $conf); - $outputlangs->setDefaultLang($newlang); - } - $result = propale_pdf_create($db, $object, GETPOST('model') ? GETPOST('model') : $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); if ($result <= 0) { dol_print_error($db, $result); @@ -2019,6 +2328,7 @@ if ($action == 'create') { // Create form object 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); @@ -2031,9 +2341,9 @@ if ($action == 'create') { $formmail->withtocc = $liste; $formmail->withtoccc = (! empty($conf->global->MAIN_EMAIL_USECCC) ? $conf->global->MAIN_EMAIL_USECCC : false); if (empty($object->ref_client)) { - $formmail->withtopic = $langs->trans('SendPropalRef', '__PROPREF__'); + $formmail->withtopic = $outputlangs->trans('SendPropalRef', '__PROPREF__'); } else if (! empty($object->ref_client)) { - $formmail->withtopic = $langs->trans('SendPropalRef', '__PROPREF__(__REFCLIENT__)'); + $formmail->withtopic = $outputlangs->trans('SendPropalRef', '__PROPREF__ (__REFCLIENT__)'); } $formmail->withfile = 2; $formmail->withbody = 1; @@ -2044,6 +2354,8 @@ if ($action == 'create') { $formmail->substit ['__PROPREF__'] = $object->ref; $formmail->substit ['__SIGNATURE__'] = $user->signature; $formmail->substit ['__REFCLIENT__'] = $object->ref_client; + $formmail->substit ['__THIRPARTY_NAME__'] = $object->thirdparty->name; + $formmail->substit ['__PROJECT_REF__'] = (is_object($object->projet)?$object->projet->ref:''); $formmail->substit ['__PERSONALIZED__'] = ''; $formmail->substit ['__CONTACTCIVNAME__'] = ''; @@ -2054,7 +2366,7 @@ if ($action == 'create') { if (is_array($contactarr) && count($contactarr) > 0) { foreach ($contactarr as $contact) { - if ($contact ['libelle'] == $langs->trans('TypeContact_propal_external_CUSTOMER')) { + if ($contact ['libelle'] == $langs->trans('TypeContact_propal_external_CUSTOMER')) { // TODO Use code and not label $contactstatic = new Contact($db); $contactstatic->fetch($contact ['id']); $custcontact = $contactstatic->getFullName($langs, 1); diff --git a/htdocs/comm/propal/class/index.html b/htdocs/comm/propal/class/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index c50e96f56c1..1b7f50b8339 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -6,7 +6,7 @@ * Copyright (C) 2005-2013 Regis Houssin * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2008 Raphael Bertrand - * Copyright (C) 2010-2013 Juanjo Menent + * Copyright (C) 2010-2014 Juanjo Menent * Copyright (C) 2010-2011 Philippe Grand * Copyright (C) 2012-214 Christophe Battarel * Copyright (C) 2013 Florian Henry @@ -79,6 +79,7 @@ class Propal extends CommonObject var $cond_reglement_id; var $cond_reglement_code; + var $fk_account; // Id of bank account var $mode_reglement_id; var $mode_reglement_code; var $remise; @@ -91,6 +92,7 @@ class Propal extends CommonObject var $fk_address; var $address_type; var $address; + var $shipping_method_id; var $availability_id; var $availability_code; var $demand_reason_id; @@ -355,7 +357,7 @@ class Propal extends CommonObject // 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,$mysoc); + $localtaxes_type=getLocalTaxesFromRate($txtva,0,$this->thirdparty,$mysoc); $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, '', $localtaxes_type); $total_ht = $tabprice[0]; @@ -443,7 +445,6 @@ class Propal extends CommonObject else { $this->error=$this->db->error(); - dol_syslog("Error sql=$sql, error=".$this->error,LOG_ERR); $this->db->rollback(); return -1; } @@ -510,7 +511,7 @@ class Propal extends CommonObject // 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,$mysoc); + $localtaxes_type=getLocalTaxesFromRate($txtva,0,$this->thirdparty,$mysoc); $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type,'', $localtaxes_type); $total_ht = $tabprice[0]; @@ -597,7 +598,6 @@ class Propal extends CommonObject { $this->error=$this->db->error(); $this->db->rollback(); - dol_syslog(get_class($this)."::updateline Error=".$this->error, LOG_ERR); return -1; } } @@ -716,8 +716,10 @@ class Propal extends CommonObject $sql.= ", fin_validite"; $sql.= ", fk_cond_reglement"; $sql.= ", fk_mode_reglement"; + $sql.= ", fk_account"; $sql.= ", ref_client"; $sql.= ", date_livraison"; + $sql.= ", fk_shipping_method"; $sql.= ", fk_availability"; $sql.= ", fk_input_reason"; $sql.= ", fk_projet"; @@ -741,15 +743,17 @@ class Propal extends CommonObject $sql.= ", ".($this->fin_validite!=''?"'".$this->db->idate($this->fin_validite)."'":"null"); $sql.= ", ".$this->cond_reglement_id; $sql.= ", ".$this->mode_reglement_id; + $sql.= ", ".($this->fk_account>0?$this->fk_account:'NULL'); $sql.= ", '".$this->db->escape($this->ref_client)."'"; $sql.= ", ".($this->date_livraison!=''?"'".$this->db->idate($this->date_livraison)."'":"null"); + $sql.= ", ".($this->shipping_method_id>0?$this->shipping_method_id:'NULL'); $sql.= ", ".$this->availability_id; $sql.= ", ".$this->demand_reason_id; $sql.= ", ".($this->fk_project?$this->fk_project:"null"); $sql.= ", ".$conf->entity; $sql.= ")"; - dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::create", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -760,7 +764,7 @@ class Propal extends CommonObject $this->ref='(PROV'.$this->id.')'; $sql = 'UPDATE '.MAIN_DB_PREFIX."propal SET ref='".$this->ref."' WHERE rowid=".$this->id; - dol_syslog(get_class($this)."::create sql=".$sql); + dol_syslog(get_class($this)."::create", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) $error++; @@ -858,24 +862,22 @@ class Propal extends CommonObject if (! $notrigger) { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('PROPAL_CREATE',$this,$user,$langs,$conf); - if ($result < 0) { - $error++; $this->errors=$interface->errors; - } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('PROPAL_CREATE',$user); + if ($result < 0) { $error++; } + // End call triggers } } else { + $this->error=$this->db->error(); $error++; } } } else { + $this->error=$this->db->error(); $error++; } @@ -887,8 +889,6 @@ class Propal extends CommonObject } else { - $this->error=$this->db->error(); - dol_syslog(get_class($this)."::create -2 ".$this->error, LOG_ERR); $this->db->rollback(); return -2; } @@ -896,7 +896,6 @@ class Propal extends CommonObject else { $this->error=$this->db->error(); - dol_syslog(get_class($this)."::create -1 ".$this->error, LOG_ERR); $this->db->rollback(); return -1; } @@ -1010,14 +1009,10 @@ class Propal extends CommonObject if ($reshook < 0) $error++; } - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('PROPAL_CLONE',$this,$user,$langs,$conf); - if ($result < 0) { - $error++; $this->errors=$interface->errors; - } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('PROPAL_CLONE',$user); + if ($result < 0) { $error++; } + // End call triggers } // End @@ -1060,6 +1055,8 @@ class Propal extends CommonObject $sql.= ", p.fk_input_reason"; $sql.= ", p.fk_cond_reglement"; $sql.= ", p.fk_mode_reglement"; + $sql.= ', p.fk_account'; + $sql.= ", p.fk_shipping_method"; $sql.= ", c.label as statut_label"; $sql.= ", ca.code as availability_code, ca.label as availability"; $sql.= ", dr.code as demand_reason_code, dr.label as demand_reason"; @@ -1075,7 +1072,7 @@ class Propal extends CommonObject if ($ref) $sql.= " AND p.ref='".$ref."'"; else $sql.= " AND p.rowid=".$rowid; - dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -1113,6 +1110,7 @@ class Propal extends CommonObject $this->datep = $this->db->jdate($obj->dp); // deprecated $this->fin_validite = $this->db->jdate($obj->dfv); $this->date_livraison = $this->db->jdate($obj->date_livraison); + $this->shipping_method_id = ($obj->fk_shipping_method>0)?$obj->fk_shipping_method:null; $this->availability_id = $obj->fk_availability; $this->availability_code = $obj->availability_code; $this->availability = $obj->availability; @@ -1124,6 +1122,7 @@ class Propal extends CommonObject $this->mode_reglement_id = $obj->fk_mode_reglement; $this->mode_reglement_code = $obj->mode_reglement_code; $this->mode_reglement = $obj->mode_reglement; + $this->fk_account = ($obj->fk_account>0)?$obj->fk_account:null; $this->cond_reglement_id = $obj->fk_cond_reglement; $this->cond_reglement_code = $obj->cond_reglement_code; $this->cond_reglement = $obj->cond_reglement; @@ -1226,7 +1225,6 @@ class Propal extends CommonObject else { $this->error=$this->db->error(); - dol_syslog(get_class($this)."::fetch Error ".$this->error, LOG_ERR); return -1; } @@ -1246,7 +1244,6 @@ class Propal extends CommonObject else { $this->error=$this->db->error(); - dol_syslog(get_class($this)."::fetch Error ".$this->error, LOG_ERR); return -1; } } @@ -1327,19 +1324,15 @@ class Propal extends CommonObject $sql.= " fk_statut = 1, date_valid='".$this->db->idate($now)."', fk_user_valid=".$user->id; $sql.= " WHERE rowid = ".$this->id." AND fk_statut = 0"; - dol_syslog(get_class($this).'::valid sql='.$sql); + dol_syslog(get_class($this).'::valid', LOG_DEBUG); if ($this->db->query($sql)) { if (! $notrigger) { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('PROPAL_VALIDATE',$this,$user,$langs,$conf); - if ($result < 0) { - $error++; $this->errors=$interface->errors; - } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('PROPAL_VALIDATE',$user); + if ($result < 0) { $error++; } + // End call triggers } if (! $error) @@ -1412,7 +1405,7 @@ class Propal extends CommonObject $sql = "UPDATE ".MAIN_DB_PREFIX."propal SET datep = '".$this->db->idate($date)."'"; $sql.= " WHERE rowid = ".$this->id." AND fk_statut = 0"; - dol_syslog(get_class($this)."::set_date sql=".$sql); + dol_syslog(get_class($this)."::set_date", LOG_DEBUG); if ($this->db->query($sql) ) { $this->date = $date; @@ -1422,7 +1415,6 @@ class Propal extends CommonObject else { $this->error=$this->db->lasterror(); - dol_syslog(get_class($this)."::set_date ".$this->error, LOG_ERR); return -1; } } @@ -1449,7 +1441,6 @@ class Propal extends CommonObject else { $this->error=$this->db->error(); - dol_syslog(get_class($this)."::set_echeance Erreur SQL".$this->error, LOG_ERR); return -1; } } @@ -1602,7 +1593,6 @@ class Propal extends CommonObject else { $this->error=$this->db->error(); - dol_syslog(get_class($this)."::set_remise_percent Error sql=$sql"); return -1; } } @@ -1637,7 +1627,6 @@ class Propal extends CommonObject else { $this->error=$this->db->error(); - dol_syslog(get_class($this)."::set_remise_absolue Error sql=$sql"); return -1; } } @@ -1669,7 +1658,7 @@ class Propal extends CommonObject $this->db->begin(); - dol_syslog(get_class($this)."::reopen sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::reopen", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); @@ -1678,25 +1667,24 @@ class Propal extends CommonObject { if (! $notrigger) { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('PROPAL_REOPEN',$this,$user,$langs,$conf); - if ($result < 0) { - $error++; $this->errors=$interface->errors; - } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('PROPAL_REOPEN',$user); + if ($result < 0) { $error++; } + // End call triggers } } // Commit or rollback if ($error) { - foreach($this->errors as $errmsg) - { - dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR); - $this->error.=($this->error?', '.$errmsg:$errmsg); - } + if (!empty($this->errors)) + { + foreach($this->errors as $errmsg) + { + dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR); + $this->error.=($this->error?', '.$errmsg:$errmsg); + } + } $this->db->rollback(); return -1*$error; } @@ -1761,14 +1749,10 @@ class Propal extends CommonObject propale_pdf_create($this->db, $this, $conf->global->PROPALE_ADDON_PDF_ODT_TOBILL?$conf->global->PROPALE_ADDON_PDF_ODT_TOBILL:$this->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); } - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('PROPAL_CLOSE_SIGNED',$this,$user,$langs,$conf); - if ($result < 0) { - $error++; $this->errors=$interface->errors; - } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('PROPAL_CLOSE_SIGNED',$user); + if ($result < 0) { $error++; } + // End call triggers } else { @@ -1787,18 +1771,21 @@ class Propal extends CommonObject propale_pdf_create($this->db, $this, $conf->global->PROPALE_ADDON_PDF_ODT_CLOSED?$conf->global->PROPALE_ADDON_PDF_ODT_CLOSED:$this->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); } - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('PROPAL_CLOSE_REFUSED',$this,$user,$langs,$conf); - if ($result < 0) { - $error++; $this->errors=$interface->errors; - } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('PROPAL_CLOSE_REFUSED',$user); + if ($result < 0) { $error++; } + // End call triggers + } + if ( ! $error ) + { + $this->db->commit(); + return 1; + } + else + { + $this->db->rollback(); + return -1; } - - $this->db->commit(); - return 1; } else { @@ -1995,7 +1982,7 @@ class Propal extends CommonObject $sql.= " FROM ".MAIN_DB_PREFIX."facture"; $sql.= " WHERE rowid IN (".implode(',',$linkedInvoices).")"; - dol_syslog(get_class($this)."::InvoiceArrayList sql=".$sql); + dol_syslog(get_class($this)."::InvoiceArrayList", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) @@ -2049,15 +2036,11 @@ class Propal extends CommonObject $this->db->begin(); - if (! $error && ! $notrigger) + if (! $notrigger) { - // Call triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('PROPAL_DELETE',$this,$user,$langs,$conf); - if ($result < 0) { - $error++; $this->errors=$interface->errors; - } + // Call trigger + $result=$this->call_trigger('PROPAL_DELETE',$user); + if ($result < 0) { $error++; } // End call triggers } @@ -2135,7 +2118,6 @@ class Propal extends CommonObject else { $this->error=$this->db->lasterror(); - dol_syslog(get_class($this)."::delete ".$this->error, LOG_ERR); $this->db->rollback(); return 0; } @@ -2143,7 +2125,6 @@ class Propal extends CommonObject else { $this->error=$this->db->lasterror(); - dol_syslog(get_class($this)."::delete ".$this->error, LOG_ERR); $this->db->rollback(); return -3; } @@ -2151,15 +2132,12 @@ class Propal extends CommonObject else { $this->error=$this->db->lasterror(); - dol_syslog(get_class($this)."::delete ".$this->error, LOG_ERR); $this->db->rollback(); return -2; } } else { - $this->error=$this->db->lasterror(); - dol_syslog(get_class($this)."::delete ".$this->error, LOG_ERR); $this->db->rollback(); return -1; } @@ -2537,16 +2515,21 @@ class Propal extends CommonObject { $mybool=false; - $file = $conf->global->PROPALE_ADDON.".php"; - $classname = $conf->global->PROPALE_ADDON; + $dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']); + foreach ($dirmodels as $reldir) + { + $file = $conf->global->PROPALE_ADDON.".php"; + $classname = $conf->global->PROPALE_ADDON; + + // Include file with class + foreach ($conf->file->dol_document_root as $dirroot) + { + $dir = $dirroot.$reldir."/core/modules/propale/"; + // Load file with numbering class (if found) + $mybool|=@include_once $dir.$file; + } + } - // Include file with class - foreach ($conf->file->dol_document_root as $dirroot) - { - $dir = $dirroot."/core/modules/propale/"; - // Load file with numbering class (if found) - $mybool|=@include_once $dir.$file; - } if (! $mybool) { @@ -2635,7 +2618,7 @@ class Propal extends CommonObject $sql.= ' WHERE pt.fk_propal = '.$this->id; $sql.= ' ORDER BY pt.rang ASC, pt.rowid'; - dol_syslog(get_class($this).'::getLinesArray sql='.$sql,LOG_DEBUG); + dol_syslog(get_class($this).'::getLinesArray', LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -2686,7 +2669,6 @@ class Propal extends CommonObject else { $this->error=$this->db->error(); - dol_syslog(get_class($this)."::getLinesArray Error sql=$sql, error=".$this->error,LOG_ERR); return -1; } } @@ -2923,7 +2905,7 @@ class PropaleLigne extends CommonObject $sql.= " ".(! empty($this->date_end)?"'".$this->db->idate($this->date_end)."'":"null"); $sql.= ')'; - dol_syslog(get_class($this).'::insert sql='.$sql, LOG_DEBUG); + dol_syslog(get_class($this).'::insert', LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -2941,14 +2923,14 @@ class PropaleLigne extends CommonObject if (! $notrigger) { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result = $interface->run_triggers('LINEPROPAL_INSERT',$this,$user,$langs,$conf); - if ($result < 0) { - $error++; $this->errors=$interface->errors; - } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('LINEPROPAL_INSERT',$user); + if ($result < 0) + { + $this->db->rollback(); + return -1; + } + // End call triggers } $this->db->commit(); @@ -2957,7 +2939,6 @@ class PropaleLigne extends CommonObject else { $this->error=$this->db->error()." sql=".$sql; - dol_syslog(get_class($this).'::insert Error '.$this->error, LOG_ERR); $this->db->rollback(); return -1; } @@ -2976,7 +2957,7 @@ class PropaleLigne extends CommonObject $this->db->begin(); $sql = "DELETE FROM ".MAIN_DB_PREFIX."propaldet WHERE rowid = ".$this->rowid; - dol_syslog("PropaleLigne::delete sql=".$sql, LOG_DEBUG); + dol_syslog("PropaleLigne::delete", LOG_DEBUG); if ($this->db->query($sql) ) { @@ -2992,14 +2973,14 @@ class PropaleLigne extends CommonObject } } - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result = $interface->run_triggers('LINEPROPAL_DELETE',$this,$user,$langs,$conf); - if ($result < 0) { - $error++; $this->errors=$interface->errors; - } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('LINEPROPAL_DELETE',$user); + if ($result < 0) + { + $this->db->rollback(); + return -1; + } + // End call triggers $this->db->commit(); @@ -3008,7 +2989,6 @@ class PropaleLigne extends CommonObject else { $this->error=$this->db->error()." sql=".$sql; - dol_syslog("PropaleLigne::delete Error ".$this->error, LOG_ERR); $this->db->rollback(); return -1; } @@ -3087,7 +3067,7 @@ class PropaleLigne extends CommonObject $sql.= " , date_end=".(! empty($this->date_end)?"'".$this->db->idate($this->date_end)."'":"null"); $sql.= " WHERE rowid = ".$this->rowid; - dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -3103,14 +3083,14 @@ class PropaleLigne extends CommonObject if (! $notrigger) { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result = $interface->run_triggers('LINEPROPAL_UPDATE',$this,$user,$langs,$conf); - if ($result < 0) { - $error++; $this->errors=$interface->errors; - } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('LINEPROPAL_UPDATE',$user); + if ($result < 0) + { + $this->db->rollback(); + return -1; + } + // End call triggers } $this->db->commit(); @@ -3119,7 +3099,6 @@ class PropaleLigne extends CommonObject else { $this->error=$this->db->error(); - dol_syslog(get_class($this)."::update Error ".$this->error, LOG_ERR); $this->db->rollback(); return -2; } @@ -3142,7 +3121,7 @@ class PropaleLigne extends CommonObject $sql.= ",total_ttc=".price2num($this->total_ttc,'MT').""; $sql.= " WHERE rowid = ".$this->rowid; - dol_syslog("PropaleLigne::update_total sql=$sql"); + dol_syslog("PropaleLigne::update_total", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) @@ -3153,7 +3132,6 @@ class PropaleLigne extends CommonObject else { $this->error=$this->db->error(); - dol_syslog("PropaleLigne::update_total Error ".$this->error, LOG_ERR); $this->db->rollback(); return -2; } diff --git a/htdocs/comm/propal/tpl/index.html b/htdocs/comm/propal/tpl/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/comm/prospect/class/index.html b/htdocs/comm/prospect/class/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/comm/prospect/list.php b/htdocs/comm/prospect/list.php index 58a384df6d0..d4b47283bf3 100644 --- a/htdocs/comm/prospect/list.php +++ b/htdocs/comm/prospect/list.php @@ -233,7 +233,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) $sql.= " ORDER BY $sortfield $sortorder, s.nom ASC"; $sql.= $db->plimit($conf->liste_limit+1, $offset); -dol_syslog('comm/prospect/list.php sql='.$sql,LOG_DEBUG); +dol_syslog('comm/prospect/list.php', LOG_DEBUG); $resql = $db->query($sql); if ($resql) { diff --git a/htdocs/comm/remise.php b/htdocs/comm/remise.php index 5fc0c7ec9bb..544ef619720 100644 --- a/htdocs/comm/remise.php +++ b/htdocs/comm/remise.php @@ -71,7 +71,7 @@ if (GETPOST("action") == 'setremise') } else { - $errmesg=$soc->error; + setEventMessage($soc->error, 'errors'); } } @@ -97,8 +97,6 @@ if ($socid > 0) $objsoc->id=$socid; $objsoc->fetch($socid); - dol_htmloutput_errors($errmesg); - $head = societe_prepare_head($objsoc); dol_fiche_head($head, 'relativediscount', $langs->trans("ThirdParty"),0,'company'); diff --git a/htdocs/comm/remx.php b/htdocs/comm/remx.php index db35db04b14..905f73e3c9b 100644 --- a/htdocs/comm/remx.php +++ b/htdocs/comm/remx.php @@ -65,17 +65,17 @@ if ($action == 'confirm_split' && GETPOST("confirm") == 'yes') if (! $res > 0) { $error++; - $mesg='
'.$langs->trans("ErrorFailedToLoadDiscount").'
'; + setEventMessage($langs->trans("ErrorFailedToLoadDiscount"), 'errors'); } if (! $error && price2num($_POST["amount_ttc_1"]+$_POST["amount_ttc_2"]) != $discount->amount_ttc) { $error++; - $mesg='
'.$langs->trans("TotalOfTwoDiscountMustEqualsOriginal").'
'; + setEventMessage($langs->trans("TotalOfTwoDiscountMustEqualsOriginal"), 'errors'); } if (! $error && $discount->fk_facture_line) { $error++; - $mesg='
'.$langs->trans("ErrorCantSplitAUsedDiscount").'
'; + setEventMessage($langs->trans("ErrorCantSplitAUsedDiscount"), 'errors'); } if (! $error) { @@ -140,7 +140,7 @@ if ($action == 'setremise') $error=0; if (empty($_POST["desc"])) { - $mesg='
'.$langs->trans("ErrorFieldRequired",$langs->trans("ReasonDiscount")).'
'; + setEventMessage($langs->trans("ErrorFieldRequired",$langs->trans("ReasonDiscount")), 'errors'); $error++; } @@ -166,13 +166,13 @@ if ($action == 'setremise') else { $error++; - $mesg='
'.$soc->error.'
'; + setEventMessage($soc->error, 'errors'); } } } else { - $mesg='
'.$langs->trans("ErrorFieldFormat",$langs->trans("NewGlobalDiscount")).'
'; + setEventMessage($langs->trans("ErrorFieldFormat",$langs->trans("NewGlobalDiscount")), 'errors'); } } @@ -194,7 +194,7 @@ if (GETPOST("action") == 'confirm_remove' && GETPOST("confirm")=='yes') } else { - $mesg='
'.$discount->error.'
'; + setEventMessage($discount->error, 'errors'); $db->rollback(); } } @@ -211,8 +211,6 @@ llxHeader('',$langs->trans("GlobalDiscount")); if ($socid > 0) { - dol_htmloutput_mesg($mesg); - // On recupere les donnees societes par l'objet $objsoc = new Societe($db); $objsoc->id=$socid; diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 02f6a7f0741..ac66f7fb048 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2012 Laurent Destailleur * Copyright (C) 2005-2013 Regis Houssin * Copyright (C) 2006 Andre Cianfarani - * Copyright (C) 2010-2013 Juanjo Menent + * Copyright (C) 2010-2014 Juanjo Menent * Copyright (C) 2011 Jean Heimburger * Copyright (C) 2012 Christophe Battarel * Copyright (C) 2013 Florian Henry @@ -60,6 +60,7 @@ class Commande extends CommonOrder var $brouillon; var $cond_reglement_id; var $cond_reglement_code; + var $fk_account; var $mode_reglement_id; var $mode_reglement_code; var $availability_id; @@ -71,6 +72,7 @@ class Commande extends CommonOrder var $date; // Date commande var $date_commande; // Date commande (deprecated) var $date_livraison; // Date livraison souhaitee + var $shipping_method_id; var $fk_remise_except; var $remise_percent; var $total_ht; // Total net of tax @@ -131,18 +133,21 @@ class Commande extends CommonOrder if (! empty($conf->global->COMMANDE_ADDON)) { - $mybool=false; + $mybool=false; + $dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']); + foreach ($dirmodels as $reldir) + { + $file = $conf->global->COMMANDE_ADDON.".php"; + $classname = $conf->global->COMMANDE_ADDON; - $file = $conf->global->COMMANDE_ADDON.".php"; - $classname = $conf->global->COMMANDE_ADDON; - - // Include file with class - foreach ($conf->file->dol_document_root as $dirroot) - { - $dir = $dirroot."/core/modules/commande/"; - // Load file with numbering class (if found) - $mybool|=@include_once $dir.$file; - } + // Include file with class + foreach ($conf->file->dol_document_root as $dirroot) + { + $dir = $dirroot.$reldir."/core/modules/commande/"; + // Load file with numbering class (if found) + $mybool|=@include_once $dir.$file; + } + } if (! $mybool) { @@ -229,12 +234,12 @@ class Commande extends CommonOrder $sql.= " fk_user_valid = ".$user->id; $sql.= " WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::valid() sql=".$sql); + dol_syslog(get_class($this)."::valid()", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) { - dol_syslog(get_class($this)."::valid Echec update - 10 - sql=".$sql, LOG_ERR); dol_print_error($this->db); + $this->error=$this->db->lasterror(); $error++; } @@ -256,8 +261,13 @@ class Commande extends CommonOrder $mouvP->origin = &$this; // We decrement stock of product (and sub-products) $result=$mouvP->livraison($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("OrderValidatedInDolibarr",$num)); - if ($result < 0) { $error++; } + if ($result < 0) + { + $error++; + $this->error=$mouvP->error; + } } + if ($error) break; } } } @@ -293,12 +303,10 @@ class Commande extends CommonOrder if (! $error) { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('ORDER_VALIDATE',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('ORDER_VALIDATE',$user); + if ($result < 0) $error++; + // End call triggers } // Set new ref and current status @@ -316,7 +324,6 @@ class Commande extends CommonOrder else { $this->db->rollback(); - $this->error=$this->db->lasterror(); return -1; } } @@ -352,7 +359,7 @@ class Commande extends CommonOrder $sql.= " SET fk_statut = 0"; $sql.= " WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::set_draft sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::set_draft", LOG_DEBUG); if ($this->db->query($sql)) { // If stock is decremented on validate order, we must reincrement it @@ -395,7 +402,6 @@ class Commande extends CommonOrder { $this->error=$this->db->error(); $this->db->rollback(); - dol_syslog($this->error, LOG_ERR); return -1; } } @@ -424,16 +430,14 @@ class Commande extends CommonOrder $sql.= ' SET fk_statut=1, facture=0'; $sql.= ' WHERE rowid = '.$this->id; - dol_syslog(get_class($this)."::set_reopen sql=".$sql); + dol_syslog(get_class($this)."::set_reopen", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('ORDER_REOPEN',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('ORDER_REOPEN',$user); + if ($result < 0) $error++; + // End call triggers } else { @@ -489,12 +493,10 @@ class Commande extends CommonOrder if ($this->db->query($sql)) { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('ORDER_CLOSE',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('ORDER_CLOSE',$user); + if ($result < 0) $error++; + // End call triggers if (! $error) { @@ -512,7 +514,6 @@ class Commande extends CommonOrder else { $this->error=$this->db->lasterror(); - dol_syslog($this->error, LOG_ERR); $this->db->rollback(); return -1; @@ -540,7 +541,7 @@ class Commande extends CommonOrder $sql.= " WHERE rowid = ".$this->id; $sql.= " AND fk_statut = 1"; - dol_syslog(get_class($this)."::cancel sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::cancel", LOG_DEBUG); if ($this->db->query($sql)) { // If stock is decremented on validate order, we must reincrement it @@ -557,8 +558,11 @@ 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, $this->lines[$i]->subprice, $langs->trans("OrderCanceledInDolibarr",$this->ref)); - if ($result < 0) { + if ($result < 0) + { $error++; + $this->error=$mouvP->error; + break; } } } @@ -566,14 +570,10 @@ class Commande extends CommonOrder if (! $error) { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('ORDER_CANCEL',$this,$user,$langs,$conf); - if ($result < 0) { - $error++; $this->errors=$interface->errors; - } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('ORDER_CANCEL',$user); + if ($result < 0) $error++; + // End call triggers } if (! $error) @@ -584,8 +584,6 @@ class Commande extends CommonOrder } else { - $this->error=$mouvP->error; - foreach($this->errors as $errmsg) { dol_syslog(get_class($this)."::cancel ".$errmsg, LOG_ERR); @@ -599,7 +597,6 @@ class Commande extends CommonOrder { $this->error=$this->db->error(); $this->db->rollback(); - dol_syslog($this->error, LOG_ERR); return -1; } } @@ -659,7 +656,8 @@ class Commande extends CommonOrder $sql = "INSERT INTO ".MAIN_DB_PREFIX."commande ("; $sql.= " ref, fk_soc, date_creation, fk_user_author, fk_projet, date_commande, source, note_private, note_public, ref_client, ref_int"; - $sql.= ", model_pdf, fk_cond_reglement, fk_mode_reglement, fk_availability, fk_input_reason, date_livraison, fk_delivery_address"; + $sql.= ", model_pdf, fk_cond_reglement, fk_mode_reglement, fk_account, fk_availability, fk_input_reason, date_livraison, fk_delivery_address"; + $sql.= ", fk_shipping_method"; $sql.= ", remise_absolue, remise_percent"; $sql.= ", entity"; $sql.= ")"; @@ -674,16 +672,18 @@ class Commande extends CommonOrder $sql.= ", '".$this->modelpdf."'"; $sql.= ", ".($this->cond_reglement_id>0?"'".$this->cond_reglement_id."'":"null"); $sql.= ", ".($this->mode_reglement_id>0?"'".$this->mode_reglement_id."'":"null"); + $sql.= ", ".($this->fk_account>0?$this->fk_account:'NULL'); $sql.= ", ".($this->availability_id>0?"'".$this->availability_id."'":"null"); $sql.= ", ".($this->demand_reason_id>0?"'".$this->demand_reason_id."'":"null"); $sql.= ", ".($this->date_livraison?"'".$this->db->idate($this->date_livraison)."'":"null"); $sql.= ", ".($this->fk_delivery_address>0?$this->fk_delivery_address:'NULL'); + $sql.= ", ".($this->shipping_method_id>0?$this->shipping_method_id:'NULL'); $sql.= ", ".($this->remise_absolue>0?$this->remise_absolue:'NULL'); $sql.= ", ".($this->remise_percent>0?$this->remise_percent:0); $sql.= ", ".$conf->entity; $sql.= ")"; - dol_syslog(get_class($this)."::create sql=".$sql); + dol_syslog(get_class($this)."::create", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -764,9 +764,10 @@ class Commande extends CommonOrder if ($origin == 'propal' && $origin_id) { // On recupere les differents contact interne et externe - $prop = new Propal($this->db, $this->socid, $origin_id); + $prop = new Propal($this->db); + $prop->fetch($origin_id); - // On recupere le commercial suivi propale + // We get ids of sales representatives of proposal $this->userid = $prop->getIdcontact('internal', 'SALESREPFOLL'); if ($this->userid) @@ -775,7 +776,7 @@ class Commande extends CommonOrder $this->add_contact($this->userid[0], 'SALESREPFOLL', 'internal'); } - // On recupere le contact client suivi propale + // We get ids of customer follower of proposal $this->contactid = $prop->getIdcontact('external', 'CUSTOMER'); if ($this->contactid) @@ -811,12 +812,10 @@ class Commande extends CommonOrder if (! $notrigger) { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('ORDER_CREATE',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('ORDER_CREATE',$user); + if ($result < 0) $error++; + // End call triggers } if (!$error) { @@ -908,12 +907,10 @@ class Commande extends CommonOrder if ($reshook < 0) $error++; } - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('ORDER_CLONE',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('ORDER_CLONE',$user); + if ($result < 0) $error++; + // End call triggers } // End @@ -987,9 +984,11 @@ class Commande extends CommonOrder $this->fk_project = $object->fk_project; $this->cond_reglement_id = $object->cond_reglement_id; $this->mode_reglement_id = $object->mode_reglement_id; + $this->fk_account = $object->fk_account; $this->availability_id = $object->availability_id; $this->demand_reason_id = $object->demand_reason_id; $this->date_livraison = $object->date_livraison; + $this->shipping_method_id = $object->shipping_method_id; $this->fk_delivery_address = $object->fk_delivery_address; $this->contact_id = $object->contactid; $this->ref_client = $object->ref_client; @@ -1119,7 +1118,7 @@ class Commande extends CommonOrder // 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,$mysoc); + $localtaxes_type=getLocalTaxesFromRate($txtva,0,$this->thirdparty,$mysoc); $tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type,'', $localtaxes_type); $total_ht = $tabprice[0]; @@ -1330,8 +1329,10 @@ class Commande extends CommonOrder $sql = 'SELECT c.rowid, c.date_creation, c.ref, c.fk_soc, c.fk_user_author, c.fk_statut'; $sql.= ', c.amount_ht, c.total_ht, c.total_ttc, c.tva as total_tva, c.localtax1 as total_localtax1, c.localtax2 as total_localtax2, c.fk_cond_reglement, c.fk_mode_reglement, c.fk_availability, c.fk_input_reason'; + $sql.= ', c.fk_account'; $sql.= ', c.date_commande'; $sql.= ', c.date_livraison'; + $sql.= ', c.fk_shipping_method'; $sql.= ', c.fk_projet, c.remise_percent, c.remise, c.remise_absolue, c.source, c.facture as billed'; $sql.= ', c.note_private, c.note_public, c.ref_client, c.ref_ext, c.ref_int, c.model_pdf, c.fk_delivery_address, c.extraparams'; $sql.= ', p.code as mode_reglement_code, p.libelle as mode_reglement_libelle'; @@ -1349,7 +1350,7 @@ class Commande extends CommonOrder if ($ref_ext) $sql.= " AND c.ref_ext='".$this->db->escape($ref_ext)."'"; if ($ref_int) $sql.= " AND c.ref_int='".$this->db->escape($ref_int)."'"; - dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { @@ -1389,11 +1390,13 @@ class Commande extends CommonOrder $this->cond_reglement_code = $obj->cond_reglement_code; $this->cond_reglement = $obj->cond_reglement_libelle; $this->cond_reglement_doc = $obj->cond_reglement_libelle_doc; + $this->fk_account = $obj->fk_account; $this->availability_id = $obj->fk_availability; $this->availability_code = $obj->availability_code; $this->demand_reason_id = $obj->fk_input_reason; $this->demand_reason_code = $obj->demand_reason_code; $this->date_livraison = $this->db->jdate($obj->date_livraison); + $this->shipping_method_id = ($obj->fk_shipping_method>0)?$obj->fk_shipping_method:null; $this->fk_delivery_address = $obj->fk_delivery_address; $this->extraparams = (array) json_decode($obj->extraparams, true); @@ -1424,13 +1427,11 @@ class Commande extends CommonOrder else { $this->error='Order with id '.$id.' not found sql='.$sql; - dol_syslog(get_class($this).'::fetch '.$this->error); return 0; } } else { - dol_syslog(get_class($this).'::fetch Error rowid='.$id, LOG_ERR); $this->error=$this->db->error(); return -1; } @@ -1533,7 +1534,7 @@ class Commande extends CommonOrder if ($only_product) $sql .= ' AND p.fk_product_type = 0'; $sql .= ' ORDER BY l.rang'; - dol_syslog(get_class($this)."::fetch_lines sql=".$sql,LOG_DEBUG); + dol_syslog(get_class($this)."::fetch_lines", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { @@ -1598,7 +1599,6 @@ class Commande extends CommonOrder else { $this->error=$this->db->error(); - dol_syslog('Commande::fetch_lines: Error '.$this->error, LOG_ERR); return -3; } } @@ -1660,7 +1660,7 @@ class Commande extends CommonOrder $sql.= ' GROUP BY cd.rowid, cd.fk_product'; //print $sql; - dol_syslog(get_class($this)."::loadExpeditions sql=".$sql,LOG_DEBUG); + dol_syslog(get_class($this)."::loadExpeditions", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { @@ -1678,7 +1678,6 @@ class Commande extends CommonOrder else { $this->error=$this->db->lasterror(); - dol_syslog(get_class($this)."::loadExpeditions ".$this->error,LOG_ERR); return -1; } @@ -1893,7 +1892,7 @@ class Commande extends CommonOrder $sql.= ' SET remise_absolue = '.$remise; $sql.= ' WHERE rowid = '.$this->id.' AND fk_statut = 0 ;'; - dol_syslog(get_class($this)."::set_remise_absolue sql=$sql"); + dol_syslog(get_class($this)."::set_remise_absolue", LOG_DEBUG); if ($this->db->query($sql)) { @@ -1925,7 +1924,7 @@ class Commande extends CommonOrder $sql.= " SET date_commande = ".($date ? $this->db->idate($date) : 'null'); $sql.= " WHERE rowid = ".$this->id." AND fk_statut = 0"; - dol_syslog(get_class($this)."::set_date sql=$sql",LOG_DEBUG); + dol_syslog(get_class($this)."::set_date",LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -1935,7 +1934,6 @@ class Commande extends CommonOrder else { $this->error=$this->db->error(); - dol_syslog(get_class($this)."::set_date ".$this->error,LOG_ERR); return -1; } } @@ -1960,7 +1958,7 @@ class Commande extends CommonOrder $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 sql=".$sql,LOG_DEBUG); + dol_syslog(get_class($this)."::set_date_livraison", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -1970,7 +1968,6 @@ class Commande extends CommonOrder else { $this->error=$this->db->error(); - dol_syslog(get_class($this)."::set_date_livraison ".$this->error,LOG_ERR); return -1; } } @@ -2204,7 +2201,6 @@ class Commande extends CommonOrder else { $this->error=$this->db->lasterror(); - dol_syslog(get_class($this).'::set_ref_client Erreur '.$this->error.' - '.$sql, LOG_ERR); return -2; } } @@ -2228,17 +2224,13 @@ class Commande extends CommonOrder $sql = 'UPDATE '.MAIN_DB_PREFIX.'commande SET facture = 1'; $sql.= ' WHERE rowid = '.$this->id.' AND fk_statut > 0'; - dol_syslog(get_class($this)."::classifyBilled sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::classifyBilled", LOG_DEBUG); if ($this->db->query($sql)) { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('ORDER_CLASSIFY_BILLED',$this,$user,$langs,$conf); - if ($result < 0) { - $error++; $this->errors=$interface->errors; - } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('ORDER_CLASSIFY_BILLED',$user); + if ($result < 0) $error++; + // End call triggers if (! $error) { @@ -2250,8 +2242,6 @@ class Commande extends CommonOrder } else { - $this->error=$this->db->error(); - foreach($this->errors as $errmsg) { dol_syslog(get_class($this)."::classifyBilled ".$errmsg, LOG_ERR); @@ -2264,7 +2254,6 @@ class Commande extends CommonOrder else { $this->error=$this->db->error(); - dol_syslog(get_class($this)."::classifyBilled Error ".$this->error, LOG_ERR); $this->db->rollback(); return -1; } @@ -2340,7 +2329,7 @@ class Commande extends CommonOrder // 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,$mysoc); + $localtaxes_type=getLocalTaxesFromRate($txtva,0,$this->thirdparty, $mysoc); $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, '', $localtaxes_type); $total_ht = $tabprice[0]; @@ -2457,34 +2446,31 @@ class Commande extends CommonOrder if (! $error && ! $notrigger) { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('ORDER_DELETE',$this,$user,$langs,$conf); - if ($result < 0) { - $error++; $this->errors=$interface->errors; - } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('ORDER_DELETE',$user); + if ($result < 0) $error++; + // End call triggers } + //TODO: Check for error after each action. If one failed we rollback, don't waste time to do action if previous fail if (! $error) { // Delete order details $sql = 'DELETE FROM '.MAIN_DB_PREFIX."commandedet WHERE fk_commande = ".$this->id; - dol_syslog(get_class($this)."::delete sql=".$sql); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); if (! $this->db->query($sql) ) { - dol_syslog(get_class($this)."::delete error", LOG_ERR); $error++; + $this->errors[]=$this->db->lasterror(); } // Delete order $sql = 'DELETE FROM '.MAIN_DB_PREFIX."commande WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::delete sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); if (! $this->db->query($sql) ) { - dol_syslog(get_class($this)."::delete error", LOG_ERR); $error++; + $this->errors[]=$this->db->lasterror(); } // Delete linked object @@ -2544,7 +2530,6 @@ class Commande extends CommonOrder } else { - $this->error=$this->db->lasterror(); foreach($this->errors as $errmsg) { dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR); @@ -3022,7 +3007,6 @@ class Commande extends CommonOrder else { $this->error=$this->db->error(); - dol_syslog("Error sql=$sql, error=".$this->error,LOG_ERR); return -1; } } @@ -3188,7 +3172,7 @@ class OrderLine extends CommonOrderLine $sql = 'DELETE FROM '.MAIN_DB_PREFIX."commandedet WHERE rowid='".$this->rowid."';"; - dol_syslog("OrderLine::delete sql=".$sql); + dol_syslog("OrderLine::delete", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -3204,12 +3188,10 @@ class OrderLine extends CommonOrderLine } } - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('LINEORDER_DELETE',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('LINEORDER_DELETE',$user); + if ($result < 0) $error++; + // End call triggers if (!$error) { $this->db->commit(); @@ -3227,7 +3209,6 @@ class OrderLine extends CommonOrderLine else { $this->error=$this->db->lasterror(); - dol_syslog("OrderLine::delete ".$this->error, LOG_ERR); return -1; } } @@ -3312,7 +3293,7 @@ class OrderLine extends CommonOrderLine $sql.= " ".(! empty($this->date_end)?"'".$this->db->idate($this->date_end)."'":"null"); $sql.= ')'; - dol_syslog(get_class($this)."::insert sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::insert", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -3330,12 +3311,10 @@ class OrderLine extends CommonOrderLine if (! $notrigger) { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('LINEORDER_INSERT',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('LINEORDER_INSERT',$user); + if ($result < 0) $error++; + // End call triggers } if (!$error) { @@ -3354,7 +3333,6 @@ class OrderLine extends CommonOrderLine else { $this->error=$this->db->error(); - dol_syslog(get_class($this)."::insert Error ".$this->error, LOG_ERR); $this->db->rollback(); return -2; } @@ -3432,7 +3410,7 @@ class OrderLine extends CommonOrderLine if (! empty($this->rang)) $sql.= ", rang=".$this->rang; $sql.= " WHERE rowid = ".$this->rowid; - dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -3448,12 +3426,10 @@ class OrderLine extends CommonOrderLine if (! $notrigger) { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result = $interface->run_triggers('LINEORDER_UPDATE',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('LINEORDER_UPDATE',$user); + if ($result < 0) $error++; + // End call triggers } if (!$error) { @@ -3472,7 +3448,6 @@ class OrderLine extends CommonOrderLine else { $this->error=$this->db->error(); - dol_syslog(get_class($this)."::update Error ".$this->error, LOG_ERR); $this->db->rollback(); return -2; } @@ -3500,7 +3475,7 @@ class OrderLine extends CommonOrderLine $sql.= ",total_ttc='".price2num($this->total_ttc)."'"; $sql.= " WHERE rowid = ".$this->rowid; - dol_syslog("OrderLine::update_total sql=$sql"); + dol_syslog("OrderLine::update_total", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) @@ -3511,7 +3486,6 @@ class OrderLine extends CommonOrderLine else { $this->error=$this->db->error(); - dol_syslog("OrderLine::update_total Error ".$this->error, LOG_ERR); $this->db->rollback(); return -2; } diff --git a/htdocs/commande/class/index.html b/htdocs/commande/class/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/commande/contact.php b/htdocs/commande/contact.php index e4b30a6e60d..5a886664c17 100644 --- a/htdocs/commande/contact.php +++ b/htdocs/commande/contact.php @@ -69,11 +69,11 @@ if ($action == 'addcontact' && $user->rights->commande->creer) if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $langs->load("errors"); - $mesg = '
'.$langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType").'
'; + setEventMessage($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), 'errors'); } else { - $mesg = '
'.$object->error.'
'; + setEventMessage($object->error, 'errors'); } } } @@ -132,7 +132,6 @@ $userstatic=new User($db); /* Mode vue et edition */ /* */ /* *************************************************************************** */ -dol_htmloutput_mesg($mesg); if ($id > 0 || ! empty($ref)) { diff --git a/htdocs/commande/customer.php b/htdocs/commande/customer.php index 373775a0da0..29812903d12 100644 --- a/htdocs/commande/customer.php +++ b/htdocs/commande/customer.php @@ -156,7 +156,7 @@ if ($resql) print "
"; print ''; print ''; @@ -185,7 +185,7 @@ else dol_print_error($db); } +llxFooter(); + $db->close(); -llxFooter(); -?> diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 8f6df313506..1d59311404e 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -9,6 +9,7 @@ * Copyright (C) 2012-2013 Christophe Battarel * Copyright (C) 2012 Marcos García * Copyright (C) 2013 Florian Henry + * Copyright (C) 2014 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 @@ -52,6 +53,7 @@ $langs->load('companies'); $langs->load('bills'); $langs->load('propal'); $langs->load('deliveries'); +$langs->load('sendings'); $langs->load('products'); if (! empty($conf->margin->enabled)) $langs->load('margins'); @@ -65,8 +67,6 @@ $lineid = GETPOST('lineid', 'int'); $origin = GETPOST('origin', 'alpha'); $originid = (GETPOST('originid', 'int') ? GETPOST('originid', 'int') : GETPOST('origin_id', 'int')); // For backward compatibility -$mesg = GETPOST('mesg'); - // PDF $hidedetails = (GETPOST('hidedetails', 'int') ? GETPOST('hidedetails', 'int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0)); $hidedesc = (GETPOST('hidedesc', 'int') ? GETPOST('hidedesc', 'int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0)); @@ -108,7 +108,7 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && $user->rights->commande-> { if (1==0 && ! GETPOST('clone_content') && ! GETPOST('clone_receivers')) { - $mesg='
'.$langs->trans("NoCloneOptionsSpecified").'
'; + setEventMessage($langs->trans("NoCloneOptionsSpecified"), 'errors'); } else { @@ -171,7 +171,7 @@ else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights-> if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id'); if ($conf->global->MAIN_MULTILANGS && empty($newlang)) - $newlang = $object->client->default_lang; + $newlang = $object->thirdparty->default_lang; if (! empty($newlang)) { $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); @@ -201,7 +201,7 @@ else if ($action == 'add' && $user->rights->commande->creer) { $datelivraison = dol_mktime(12, 0, 0, GETPOST('liv_month'), GETPOST('liv_day'), GETPOST('liv_year')); if ($datecommande == '') { - $mesg = '
' . $langs->trans('ErrorFieldRequired', $langs->transnoentities('Date')) . '
'; + setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentities('Date')), 'errors'); $action = 'create'; $error ++; } @@ -227,9 +227,11 @@ else if ($action == 'add' && $user->rights->commande->creer) { $object->modelpdf = GETPOST('model'); $object->cond_reglement_id = GETPOST('cond_reglement_id'); $object->mode_reglement_id = GETPOST('mode_reglement_id'); + $object->fk_account = GETPOST('fk_account', 'int'); $object->availability_id = GETPOST('availability_id'); $object->demand_reason_id = GETPOST('demand_reason_id'); $object->date_livraison = $datelivraison; + $object->shipping_method_id = GETPOST('shipping_method_id', 'int'); $object->fk_delivery_address = GETPOST('fk_address'); $object->contactid = GETPOST('contactidp'); @@ -339,11 +341,11 @@ else if ($action == 'add' && $user->rights->commande->creer) { if ($reshook < 0) $error ++; } else { - $mesg = $srcobject->error; + setEventMessage($srcobject->error, 'errors'); $error ++; } } else { - $mesg = $object->error; + setEventMessage($object->error, 'errors'); $error ++; } } else { @@ -377,7 +379,7 @@ else if ($action == 'add' && $user->rights->commande->creer) { if (GETPOST('contactidp')) { $result = $object->add_contact(GETPOST('contactidp'), 'CUSTOMER', 'external'); if ($result < 0) { - $mesg = '
' . $langs->trans("ErrorFailedToAddContact") . '
'; + setEventMessage($langs->trans("ErrorFailedToAddContact"), 'errors'); $error ++; } } @@ -394,8 +396,7 @@ else if ($action == 'add' && $user->rights->commande->creer) { } else { $db->rollback(); $action = 'create'; - if (! $mesg) - $mesg = '
' . $object->error . '
'; + setEventMessage($object->error, 'errors'); } } } @@ -434,7 +435,7 @@ else if ($action == 'setdate' && $user->rights->commande->creer) { $result = $object->set_date($user, $date); if ($result < 0) { - $mesg = '
' . $object->error . '
'; + setEventMessage($object->error, 'errors'); } } @@ -444,7 +445,7 @@ else if ($action == 'setdate_livraison' && $user->rights->commande->creer) { $result = $object->set_date_livraison($user, $datelivraison); if ($result < 0) { - $mesg = '
' . $object->error . '
'; + setEventMessage($object->error, 'errors'); } } @@ -476,7 +477,7 @@ else if ($action == 'setconditions' && $user->rights->commande->creer) { $outputlangs = $langs; $newlang = GETPOST('lang_id', 'alpha'); if ($conf->global->MAIN_MULTILANGS && empty($newlang)) - $newlang = $object->client->default_lang; + $newlang = $object->thirdparty->default_lang; if (! empty($newlang)) { $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); @@ -488,6 +489,16 @@ else if ($action == 'setconditions' && $user->rights->commande->creer) { } } +// bank account +else if ($action == 'setbankaccount' && $user->rights->commande->creer) { + $result=$object->setBankAccount(GETPOST('fk_account', 'int')); +} + +// shipping method +else if ($action == 'setshippingmethod' && $user->rights->commande->creer) { + $result = $object->setShippingMethod(GETPOST('shipping_method_id', 'int')); +} + else if ($action == 'setremisepercent' && $user->rights->commande->creer) { $result = $object->set_remise($user, GETPOST('remise_percent')); } @@ -571,18 +582,22 @@ else if ($action == 'addline' && $user->rights->commande->creer) { $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->client, $prod->id); - $tva_npr = get_default_npr($mysoc, $object->client, $prod->id); + $tva_tx = get_default_tva($mysoc, $object->thirdparty, $prod->id); + $tva_npr = get_default_npr($mysoc, $object->thirdparty, $prod->id); + $pu_ht = $prod->price; + $pu_ttc = $prod->price_ttc; + $price_min = $prod->price_min; + $price_base_type = $prod->price_base_type; // multiprix - if (! empty($conf->global->PRODUIT_MULTIPRICES) && ! empty($object->client->price_level)) + if (! empty($conf->global->PRODUIT_MULTIPRICES) && ! empty($object->thirdparty->price_level)) { - $pu_ht = $prod->multiprices [$object->client->price_level]; - $pu_ttc = $prod->multiprices_ttc [$object->client->price_level]; - $price_min = $prod->multiprices_min [$object->client->price_level]; - $price_base_type = $prod->multiprices_base_type [$object->client->price_level]; - $tva_tx=$prod->multiprices_tva_tx[$object->client->price_level]; - $tva_npr=$prod->multiprices_recuperableonly[$object->client->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]; + $tva_tx=$prod->multiprices_tva_tx[$object->thirdparty->price_level]; + $tva_npr=$prod->multiprices_recuperableonly[$object->thirdparty->price_level]; } elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { @@ -593,30 +608,15 @@ else if ($action == 'addline' && $user->rights->commande->creer) { $filter = array('t.fk_product' => $prod->id,'t.fk_soc' => $object->thirdparty->id); $result = $prodcustprice->fetch_all('', '', 0, 0, $filter); - if ($result >= 0) { + if ($result) { if (count($prodcustprice->lines) > 0) { - $found = true; - $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; - } else { - $pu_ht = $prod->price; - $pu_ttc = $prod->price_ttc; - $price_min = $prod->price_min; - $price_base_type = $prod->price_base_type; + $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; } - } else { - setEventMessage($prodcustprice->error,'errors'); } } - else - { - $pu_ht = $prod->price; - $pu_ttc = $prod->price_ttc; - $price_min = $prod->price_min; - $price_base_type = $prod->price_base_type; - } // if price ht is forced (ie: calculated by margin rate and cost price) if (! empty($price_ht)) { @@ -643,7 +643,7 @@ else if ($action == 'addline' && $user->rights->commande->creer) { if (empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id'); if (empty($newlang)) - $newlang = $object->client->default_lang; + $newlang = $object->thirdparty->default_lang; if (! empty($newlang)) { $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); @@ -685,8 +685,8 @@ else if ($action == 'addline' && $user->rights->commande->creer) { $buyingprice = (GETPOST('buying_price' . $predef) ? GETPOST('buying_price' . $predef) : ''); // Local Taxes - $localtax1_tx = get_localtax($tva_tx, 1, $object->client); - $localtax2_tx = get_localtax($tva_tx, 2, $object->client); + $localtax1_tx = get_localtax($tva_tx, 1, $object->thirdparty); + $localtax2_tx = get_localtax($tva_tx, 2, $object->thirdparty); $desc = dol_htmlcleanlastbr($desc); @@ -709,7 +709,7 @@ else if ($action == 'addline' && $user->rights->commande->creer) { $outputlangs = $langs; $newlang = GETPOST('lang_id', 'alpha'); if (! empty($conf->global->MAIN_MULTILANGS) && empty($newlang)) - $newlang = $object->client->default_lang; + $newlang = $object->thirdparty->default_lang; if (! empty($newlang)) { $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); @@ -775,8 +775,8 @@ else if ($action == 'updateligne' && $user->rights->commande->creer && GETPOST(' // Define vat_rate $vat_rate = str_replace('*', '', $vat_rate); - $localtax1_rate = get_localtax($vat_rate, 1, $object->client); - $localtax2_rate = get_localtax($vat_rate, 2, $object->client); + $localtax1_rate = get_localtax($vat_rate, 1, $object->thirdparty); + $localtax2_rate = get_localtax($vat_rate, 2, $object->thirdparty); // Add buying price $fournprice = (GETPOST('fournprice') ? GETPOST('fournprice') : ''); @@ -802,8 +802,8 @@ else if ($action == 'updateligne' && $user->rights->commande->creer && GETPOST(' $type = $product->type; $price_min = $product->price_min; - if (! empty($conf->global->PRODUIT_MULTIPRICES) && ! empty($object->client->price_level)) - $price_min = $product->multiprices_min [$object->client->price_level]; + 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') : ''); @@ -833,7 +833,7 @@ else if ($action == 'updateligne' && $user->rights->commande->creer && GETPOST(' if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id'); if ($conf->global->MAIN_MULTILANGS && empty($newlang)) - $newlang = $object->client->default_lang; + $newlang = $object->thirdparty->default_lang; if (! empty($newlang)) { $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); @@ -885,7 +885,7 @@ else if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->co if (! $idwarehouse || $idwarehouse == -1) { $error++; - $mesgs[]='
'.$langs->trans('ErrorFieldRequired',$langs->transnoentitiesnoconv("Warehouse")).'
'; + setEventMessage($langs->trans('ErrorFieldRequired',$langs->transnoentitiesnoconv("Warehouse")), 'errors'); $action=''; } } @@ -899,7 +899,7 @@ else if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->co if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang = $_REQUEST['lang_id']; if ($conf->global->MAIN_MULTILANGS && empty($newlang)) - $newlang = $object->client->default_lang; + $newlang = $object->thirdparty->default_lang; if (! empty($newlang)) { $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); @@ -930,7 +930,7 @@ else if ($action == 'confirm_modif' && $user->rights->commande->creer) { if (! $idwarehouse || $idwarehouse == -1) { $error++; - $mesgs[]='
'.$langs->trans('ErrorFieldRequired',$langs->transnoentitiesnoconv("Warehouse")).'
'; + setEventMessage($langs->trans('ErrorFieldRequired',$langs->transnoentitiesnoconv("Warehouse")), 'errors'); $action=''; } } @@ -944,7 +944,7 @@ else if ($action == 'confirm_modif' && $user->rights->commande->creer) { if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang = $_REQUEST['lang_id']; if ($conf->global->MAIN_MULTILANGS && empty($newlang)) - $newlang = $object->client->default_lang; + $newlang = $object->thirdparty->default_lang; if (! empty($newlang)) { $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); @@ -983,7 +983,7 @@ else if ($action == 'confirm_cancel' && $confirm == 'yes' && $user->rights->comm if (! $idwarehouse || $idwarehouse == -1) { $error++; - $mesgs[]='
'.$langs->trans('ErrorFieldRequired',$langs->transnoentitiesnoconv("Warehouse")).'
'; + setEventMessage($langs->trans('ErrorFieldRequired',$langs->transnoentitiesnoconv("Warehouse")), 'errors'); $action=''; } } @@ -1010,7 +1010,7 @@ else if ($action == 'up' && $user->rights->commande->creer) { if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang = $_REQUEST['lang_id']; if ($conf->global->MAIN_MULTILANGS && empty($newlang)) - $newlang = $object->client->default_lang; + $newlang = $object->thirdparty->default_lang; if (! empty($newlang)) { $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); @@ -1032,7 +1032,7 @@ else if ($action == 'down' && $user->rights->commande->creer) { if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang = $_REQUEST['lang_id']; if ($conf->global->MAIN_MULTILANGS && empty($newlang)) - $newlang = $object->client->default_lang; + $newlang = $object->thirdparty->default_lang; if (! empty($newlang)) { $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); @@ -1061,7 +1061,7 @@ else if ($action == 'builddoc') // In get or post if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang = $_REQUEST['lang_id']; if ($conf->global->MAIN_MULTILANGS && empty($newlang)) - $newlang = $object->client->default_lang; + $newlang = $object->thirdparty->default_lang; if (! empty($newlang)) { $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); @@ -1176,11 +1176,11 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G // Recipient was provided from combo list if (GETPOST('receiver') == 'thirdparty') // Id of third party { - $sendto = $object->client->email; + $sendto = $object->thirdparty->email; $sendtoid = 0; } else // Id du contact { - $sendto = $object->client->contact_get_property(GETPOST('receiver'), 'email'); + $sendto = $object->thirdparty->contact_get_property(GETPOST('receiver'), 'email'); $sendtoid = GETPOST('receiver'); } } @@ -1192,6 +1192,7 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G $replyto = GETPOST('replytoname') . ' <' . GETPOST('replytomail') . '>'; $message = GETPOST('message'); $sendtocc = GETPOST('sendtocc'); + $sendtobcc = (empty($conf->global->MAIN_MAIL_AUTOCOPY_ORDER_TO)?'':$conf->global->MAIN_MAIL_AUTOCOPY_ORDER_TO); $deliveryreceipt = GETPOST('deliveryreceipt'); if ($action == 'send') { @@ -1220,14 +1221,15 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G // 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); + $mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, $sendtobcc, $deliveryreceipt, - 1); if ($mailfile->error) { - $mesg = '
' . $mailfile->error . '
'; + setEventMessage($mailfile->error, 'errors'); } else { $result = $mailfile->sendfile(); if ($result) { - $mesg = $langs->trans('MailSuccessfulySent', $mailfile->getValidAddress($from, 2), $mailfile->getValidAddress($sendto, 2)); // Must not - // contains " + //Must not contain quotes + $mesg = $langs->trans('MailSuccessfulySent', $mailfile->getValidAddress($from, 2), $mailfile->getValidAddress($sendto, 2)); + setEventMessage($mesg); $error = 0; @@ -1254,19 +1256,19 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G } else { // Redirect here // This avoid sending mail twice if going out and then back to page - header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&mesg=' . urlencode($mesg)); + 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 .= '
'; + + setEventMessage($mesg, 'errors'); } } /* } @@ -1279,12 +1281,12 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G }*/ } else { $langs->load("errors"); - $mesg = '
' . $langs->trans('ErrorCantReadFile', $file) . '
'; + setEventMessage($langs->trans('ErrorCantReadFile', $file), 'errors'); dol_syslog('Failed to read file: ' . $file); } } else { $langs->load("other"); - $mesg = '
' . $langs->trans('ErrorFailedToReadEntity', $langs->trans("Order")) . '
'; + setEventMessage($langs->trans('ErrorFailedToReadEntity', $langs->trans("Order")), 'errors'); dol_syslog($langs->trans('ErrorFailedToReadEntity', $langs->trans("Order"))); } } @@ -1302,9 +1304,9 @@ if (! $error && ! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->righ } else { if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $langs->load("errors"); - $mesg = '
' . $langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType") . '
'; + setEventMessage($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), 'errors'); } else { - $mesg = '
' . $object->error . '
'; + setEventMessage($object->error, 'errors'); } } } @@ -1351,8 +1353,6 @@ $formorder = new FormOrder($db); if ($action == 'create' && $user->rights->commande->creer) { print_fiche_titre($langs->trans('CreateOrder')); - dol_htmloutput_mesg($mesg, $mesgs, 'error'); - $soc = new Societe($db); if ($socid > 0) $res = $soc->fetch($socid); @@ -1399,7 +1399,9 @@ if ($action == 'create' && $user->rights->commande->creer) { $soc = $objectsrc->client; $cond_reglement_id = (!empty($objectsrc->cond_reglement_id)?$objectsrc->cond_reglement_id:(!empty($soc->cond_reglement_id)?$soc->cond_reglement_id:1)); $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)); $availability_id = (!empty($objectsrc->availability_id)?$objectsrc->availability_id:(!empty($soc->availability_id)?$soc->availability_id:0)); + $shipping_method_id = (! empty($objectsrc->shipping_method_id)?$objectsrc->shipping_method_id:(! empty($soc->shipping_method_id)?$soc->shipping_method_id:0)); $demand_reason_id = (!empty($objectsrc->demand_reason_id)?$objectsrc->demand_reason_id:(!empty($soc->demand_reason_id)?$soc->demand_reason_id:0)); $remise_percent = (!empty($objectsrc->remise_percent)?$objectsrc->remise_percent:(!empty($soc->remise_percent)?$soc->remise_percent:0)); $remise_absolue = (!empty($objectsrc->remise_absolue)?$objectsrc->remise_absolue:(!empty($soc->remise_absolue)?$soc->remise_absolue:0)); @@ -1418,7 +1420,9 @@ if ($action == 'create' && $user->rights->commande->creer) { { $cond_reglement_id = $soc->cond_reglement_id; $mode_reglement_id = $soc->mode_reglement_id; + $fk_account = $soc->fk_account; $availability_id = $soc->availability_id; + $shipping_method_id = $soc->shipping_method_id; $demand_reason_id = $soc->demand_reason_id; $remise_percent = $soc->remise_percent; $remise_absolue = 0; @@ -1513,11 +1517,23 @@ if ($action == 'create' && $user->rights->commande->creer) { $form->select_types_paiements($mode_reglement_id, 'mode_reglement_id'); print '
'; + // Bank Account + print ''; + // Delivery delay print ''; + // Shipping Method + if (! empty($conf->expedition->enabled)) { + print ''; + } + // What trigger creation print ''; print ''; print '"; - if ($mysoc->localtax1_assuj == "1") // Localtax1 RE + if ($mysoc->localtax1_assuj == "1" || $objectsrc->total_localtax1 != 0) // Localtax1 RE { print '"; } - if ($mysoc->localtax2_assuj == "1") // Localtax2 IRPF + if ($mysoc->localtax2_assuj == "1" || $objectsrc->total_localtax2 != 0) // Localtax2 IRPF { print '"; } @@ -1665,8 +1681,6 @@ if ($action == 'create' && $user->rights->commande->creer) { $now = dol_now(); if ($object->id > 0) { - dol_htmloutput_mesg($mesg, $mesgs); - $product_static = new Product($db); $soc = new Societe($db); @@ -1847,9 +1861,9 @@ if ($action == 'create' && $user->rights->commande->creer) { $nbrow ++; // Local taxes - if ($mysoc->localtax1_assuj == "1") + if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) $nbrow ++; - if ($mysoc->localtax2_assuj == "1") + if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0 ) $nbrow ++; print '
'; @@ -1722,6 +2009,23 @@ if ($action == 'create') { } } + // Bank Account + print '
'; + print ''; + if ($action != 'editbankaccount' && $user->rights->propal->creer) + print ''; + print '
'; + print $langs->trans('BankAccount'); + 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 '
' . $langs->trans('AmountHT') . '' . price($object->total_ht, '', $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) . '
'; - + $result=''; $lien=$lienfin=''; $lien = ''; @@ -164,7 +164,7 @@ if ($resql) $name=$obj->nom; $result.=($lien.img_object($langs->trans("ShowCompany").': '.$name,'company').$lienfin); $result.=$lien.(dol_trunc($name,$maxlen)).$lienfin; - + print $result; print ''.$obj->town.' 
' . $langs->trans('BankAccount') . ''; + $form->select_comptes($fk_account, 'fk_account', 0, '', 1); + print '
' . $langs->trans('AvailabilityPeriod') . ''; $form->selectAvailabilityDelay($availability_id, 'availability_id', '', 1); print '
' . $langs->trans('SendingMethod') . ''; + print $form->selectShippingMethod($shipping_method_id, 'shipping_method_id', '', 1); + print '
' . $langs->trans('Source') . ''; $form->selectInputReason($demand_reason_id, 'demand_reason_id', '', 1); @@ -1596,12 +1612,12 @@ if ($action == 'create' && $user->rights->commande->creer) { print '
' . $langs->trans($newclassname) . '' . $objectsrc->getNomUrl(1) . '
' . $langs->trans('TotalHT') . '' . price($objectsrc->total_ht) . '
' . $langs->trans('TotalVAT') . '' . price($objectsrc->total_tva) . "
' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '' . price($objectsrc->total_localtax1) . "
' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '' . price($objectsrc->total_localtax2) . "
'; @@ -1975,6 +1989,25 @@ if ($action == 'create' && $user->rights->commande->creer) { print ''; print ''; + // Shipping Method + if (! empty($conf->expedition->enabled)) { + print ''; + print ''; + } + // Terms of payment print ''; // Copy to clipboard @@ -648,14 +656,14 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') $sql = "SELECT p.rowid, p.lastname, p.firstname, p.fk_pays as country_id, p.poste, p.phone, p.phone_mobile, p.fax, p.email, p.skype, p.statut "; - $sql .= ", p.civilite as civility_id, p.address, p.zip, p.town"; + $sql .= ", p.civility as civility_id, p.address, p.zip, p.town"; $sql .= " FROM ".MAIN_DB_PREFIX."socpeople as p"; $sql .= " WHERE p.fk_soc = ".$object->id; - if ($search_status!='') $sql .= " AND p.statut = ".$db->escape($search_status); + if ($search_status!='' && $search_status != '-1') $sql .= " AND p.statut = ".$db->escape($search_status); if ($search_name) $sql .= " AND (p.lastname LIKE '%".$db->escape($search_name)."%' OR p.firstname LIKE '%".$db->escape($search_name)."%')"; $sql.= " ORDER BY $sortfield $sortorder"; - dol_syslog('core/lib/company.lib.php :: show_contacts sql='.$sql,LOG_DEBUG); + dol_syslog('core/lib/company.lib.php :: show_contacts', LOG_DEBUG); $result = $db->query($sql); $num = $db->num_rows($result); @@ -953,7 +961,7 @@ function show_actions_todo($conf,$langs,$db,$object,$objcon='',$noprint=0) $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep > '".$db->idate($now)."'))"; $sql.= " ORDER BY a.datep DESC, a.id DESC"; - dol_syslog("company.lib::show_actions_todo sql=".$sql); + dol_syslog("company.lib::show_actions_todo", LOG_DEBUG); $result=$db->query($sql); if ($result) { @@ -1089,7 +1097,7 @@ function show_actions_done($conf,$langs,$db,$object,$objcon='',$noprint=0) $sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep <= '".$db->idate($now)."'))"; $sql.= " ORDER BY a.datep DESC, a.id DESC"; - dol_syslog("company.lib::show_actions_done sql=".$sql, LOG_DEBUG); + dol_syslog("company.lib::show_actions_done", LOG_DEBUG); $resql=$db->query($sql); if ($resql) { @@ -1141,7 +1149,7 @@ function show_actions_done($conf,$langs,$db,$object,$objcon='',$noprint=0) $sql.= " AND mc.fk_mailing=m.rowid"; $sql.= " ORDER BY mc.date_envoi DESC, m.rowid DESC"; - dol_syslog("company.lib::show_actions_done sql=".$sql, LOG_DEBUG); + dol_syslog("company.lib::show_actions_done", LOG_DEBUG); $resql=$db->query($sql); if ($resql) { diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index 4201cde9e9d..3c37a79b7dd 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -659,6 +659,49 @@ function num_public_holiday($timestampStart, $timestampEnd, $countrycode='FR') if($jour_semaine == 0 || $jour_semaine == 6) $ferie=true; //Samedi (6) et dimanche (0) } + + if ($countrycode == 'ES') + { + $countryfound=1; + + // Definition des dates feriees fixes + if($jour == 1 && $mois == 1) $ferie=true; // Año nuevo + if($jour == 6 && $mois == 1) $ferie=true; // Día Reyes + if($jour == 1 && $mois == 5) $ferie=true; // 1 Mayo + if($jour == 15 && $mois == 8) $ferie=true; // 15 Agosto + if($jour == 12 && $mois == 10) $ferie=true; // Día Hispanidad + if($jour == 1 && $mois == 11) $ferie=true; // 1 noviembre + if($jour == 6 && $mois == 12) $ferie=true; // Constitución + if($jour == 8 && $mois == 12) $ferie=true; // Inmaculada + if($jour == 25 && $mois == 12) $ferie=true; // 25 diciembre + + // Calcul día de Pascua + $date_paques = easter_date($annee); + $jour_paques = date("d", $date_paques); + $mois_paques = date("m", $date_paques); + if($jour_paques == $jour && $mois_paques == $mois) $ferie=true; + // Paques + + // Viernes Santo + $date_viernes = mktime( + date("H", $date_paques), + date("i", $date_paques), + date("s", $date_paques), + date("m", $date_paques), + date("d", $date_paques) -2, + date("Y", $date_paques) + ); + $jour_viernes = date("d", $date_viernes); + $mois_viernes = date("m", $date_viernes); + if($jour_viernes == $jour && $mois_viernes == $mois) $ferie=true; + //Viernes Santo + + // Calul des samedis et dimanches + $jour_julien = unixtojd($timestampStart); + $jour_semaine = jddayofweek($jour_julien, 0); + if($jour_semaine == 0 || $jour_semaine == 6) $ferie=true; + //Samedi (6) et dimanche (0) + } // Cas pays non defini if (! $countryfound) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index a6082fa0c29..0dc5a2c4456 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -802,14 +802,15 @@ function dol_delete_dir($dir,$nophperrors=0) } /** - * Remove a directory $dir and its subdirectories + * Remove a directory $dir and its subdirectories (or only files and subdirectories) * * @param string $dir Dir to delete * @param int $count Counter to count nb of deleted elements * @param int $nophperrors Disable all PHP output errors + * @param int $onlysub Delete only files and subdir, not main directory * @return int Number of files and directory removed */ -function dol_delete_dir_recursive($dir,$count=0,$nophperrors=0) +function dol_delete_dir_recursive($dir,$count=0,$nophperrors=0,$onlysub=0) { dol_syslog("functions.lib:dol_delete_dir_recursive ".$dir,LOG_DEBUG); if (dol_is_dir($dir)) @@ -836,9 +837,13 @@ function dol_delete_dir_recursive($dir,$count=0,$nophperrors=0) } } closedir($handle); - dol_delete_dir($dir,$nophperrors); - $count++; - //echo "removing $dir
\n"; + + if (empty($onlysub)) + { + dol_delete_dir($dir,$nophperrors); + $count++; + //echo "removing $dir
\n"; + } } } @@ -1582,6 +1587,16 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu $original_file=$conf->projet->dir_output.'/'.$original_file; $sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."projet WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity; } + // Wrapping for interventions + else if ($modulepart == 'fichinter') + { + if ($fuser->rights->ficheinter->lire || preg_match('/^specimen/i',$original_file)) + { + $accessallowed=1; + } + $original_file=$conf->ficheinter->dir_output.'/'.$original_file; + $sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."fichinter WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity; + } // Wrapping pour les commandes fournisseurs else if ($modulepart == 'commande_fournisseur' || $modulepart == 'order_supplier') diff --git a/htdocs/core/lib/fiscalyear.lib.php b/htdocs/core/lib/fiscalyear.lib.php new file mode 100644 index 00000000000..60b2c810294 --- /dev/null +++ b/htdocs/core/lib/fiscalyear.lib.php @@ -0,0 +1,56 @@ + + * + * 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/lib/fiscalyear.lib.php + * \brief Set basic functions for fiscal years + */ + +/** + * Prepare array with list of tabs + * + * @param Object $object Object related to tabs + * @return array Array of tabs to shoc + */ +function fiscalyear_prepare_head($object) +{ + global $langs, $conf; + + $h = 0; + $head = array(); + + $head[$h][0] = DOL_URL_ROOT . '/admin/fiscalyear_card.php?id=' . $object->id; + $head[$h][1] = $langs->trans("Card"); + $head[$h][2] = 'card'; + $h++; + + // Show more tabs from modules + // Entries must be declared in modules descriptor with line + // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab + // $this->tabs = array('entity:-tabname); to remove a tab + complete_head_from_modules($conf,$langs,$object,$head,$h,'fiscalyear'); + + $head[$h][0] = DOL_URL_ROOT . '/admin/fiscalyear_info.php?id=' . $object->id; + $head[$h][1] = $langs->trans("Info"); + $head[$h][2] = 'info'; + $h++; + + complete_head_from_modules($conf,$langs,$object,$head,$h,'fiscalyear','remove'); + + return $head; +} \ No newline at end of file diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 68c61886efd..8973b54734b 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -7,10 +7,12 @@ * Copyright (C) 2004 Christophe Combelles * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2008 Raphael Bertrand (Resultic) - * Copyright (C) 2010-2011 Juanjo Menent + * Copyright (C) 2010-2014 Juanjo Menent * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2013 Alexandre Spangaro - * + * Copyright (C) 2014 Marcos García + * Copyright (C) 2014 Cédric GROSS + * * 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 @@ -32,11 +34,7 @@ * This file contains all frequently used functions. */ - -if (! function_exists('json_encode')) -{ - include_once DOL_DOCUMENT_ROOT .'/core/lib/json.lib.php'; -} +include_once DOL_DOCUMENT_ROOT .'/core/lib/json.lib.php'; /** * Function to return value of a static property when class @@ -46,26 +44,16 @@ if (! function_exists('json_encode')) * @param string $class Class name * @param string $member Name of property * @return mixed Return value of static property + * @deprecated PHP 5.3 is now the minimum requirement, this is no longer necessary */ function getStaticMember($class, $member) { - if (is_object($class)) $class = get_class($class); - $classObj = new ReflectionClass($class); - $result = null; - - $found=0; - foreach($classObj->getStaticProperties() as $prop => $value) - { - if ($prop == $member) - { - $result = $value; - $found++; - break; - } + if (isset($class::$member)) { + return $class::$member; } - if (! $found) dol_print_error('','Try to get a static member "'.$member.'" in class "'.$class.'" that does not exists or is not static.'); - return $result; + dol_print_error('','Try to get a static member "'.$member.'" in class "'.$class.'" that does not exists or is not static.'); + return null; } @@ -120,11 +108,11 @@ function getEntity($element=false, $shared=false) /** * Return information about user browser * - * @return array Array of information ('browsername'=>,'browseros'=>,'phone'=>,'browserfirefox'=>) + * @return array Array of information ('browsername'=>,'browseros'=>,'browserversion'=>,'layout'=>(classic|phone|tablet)) */ function getBrowserInfo() { - $name='unknown'; $version=''; $os='unknown'; $phone=''; + $name='unknown'; $version=''; $os='unknown'; $phone=''; $tablet=''; // If phone/smartphone, we set phone os name. if (preg_match('/android/i',$_SERVER["HTTP_USER_AGENT"])) { $os=$phone='android'; } @@ -138,6 +126,11 @@ function getBrowserInfo() // MS products at end elseif (preg_match('/iemobile/i',$_SERVER["HTTP_USER_AGENT"])) { $os='windows'; $phone='unkown'; } elseif (preg_match('/windows ce/i',$_SERVER["HTTP_USER_AGENT"])) { $os='windows'; $phone='unkown'; } + + // OS + if (preg_match('/android/i',$_SERVER["HTTP_USER_AGENT"])) { $os='android'; } + elseif (preg_match('/linux/i',$_SERVER["HTTP_USER_AGENT"])) { $os='linux'; } + // Name if (preg_match('/firefox(\/|\s)([\d\.]*)/i', $_SERVER["HTTP_USER_AGENT"], $reg)) { $name='firefox'; $version=$reg[2]; } elseif (preg_match('/chrome(\/|\s)([\d\.]+)/i', $_SERVER["HTTP_USER_AGENT"], $reg)) { $name='chrome'; $version=$reg[2]; } // we can have 'chrome (Mozilla...) chrome x.y' in one string @@ -151,7 +144,12 @@ function getBrowserInfo() $firefox=0; if (in_array($name,array('firefox','iceweasel'))) $firefox=1; - return array('browsername'=>$name, 'browserversion'=>$version, 'browseros'=>$os, 'phone'=>$phone, 'browserfirefox'=>$firefox); + include_once DOL_DOCUMENT_ROOT.'/core/class/mobiledetect.class.php'; + $detectmobile=new MobileDetect(); + $phone=$detectmobile->isMobile(); + $tablet=$detectmobile->isTablet(); + + return array('browsername'=>$name, 'browserversion'=>$version, 'browseros'=>$os, 'browserfirefox'=>$firefox, 'layout'=> ($tablet?'tablet':($phone?'phone':'classic')), 'phone'=>$phone, 'tablet'=>$tablet); } /** @@ -172,11 +170,13 @@ function dol_shutdown() * Return value of a param into GET or POST supervariable * * @param string $paramname Name of parameter to found - * @param string $check Type of check (''=no check, 'int'=check it's numeric, 'alpha'=check it's text and sign, 'aZ'=check it's a-z only, 'array'=check it's array) + * @param string $check Type of check (''=no check, 'int'=check it's numeric, 'alpha'=check it's text and sign, 'aZ'=check it's a-z only, 'array'=check it's array, 'san_alpha'= Use filter_var with FILTER_SANITIZE_STRING, 'custom'= custom filter specify $filter and $options) * @param int $method Type of method (0 = get then post, 1 = only get, 2 = only post, 3 = post then get, 4 = post then get then cookie) + * @param int $filter Filter to apply when $check is set to custom. (See http://php.net/manual/en/filter.filters.php for détails) + * @param mixed $options Options to pass to filter_var when $check is set to custom * @return string||string[] Value found, or '' if check fails */ -function GETPOST($paramname,$check='',$method=0) +function GETPOST($paramname,$check='',$method=0,$filter=NULL,$options=NULL) { if (empty($method)) $out = isset($_GET[$paramname])?$_GET[$paramname]:(isset($_POST[$paramname])?$_POST[$paramname]:''); elseif ($method==1) $out = isset($_GET[$paramname])?$_GET[$paramname]:''; @@ -187,28 +187,33 @@ function GETPOST($paramname,$check='',$method=0) if (! empty($check)) { - // Check if numeric - if ($check == 'int' && ! is_numeric($out)) $out=''; - // Check if alpha - elseif ($check == 'alpha') - { - $out=trim($out); - // '"' is dangerous because param in url can close the href= or src= and add javascript functions. - // '../' is dangerous because it allows dir transversals - if (preg_match('/"/',$out)) $out=''; - else if (preg_match('/\.\.\//',$out)) $out=''; - } - elseif ($check == 'aZ') - { - $out=trim($out); - // '"' is dangerous because param in url can close the href= or src= and add javascript functions. - // '../' is dangerous because it allows dir transversals - if (preg_match('/[^a-z]+/i',$out)) $out=''; - } - elseif ($check == 'array') - { - if (! is_array($out) || empty($out)) $out=array(); - } + switch ($check) + { + case 'int': + if (! is_numeric($out)) { $out=''; } + break; + case 'alpha': + $out=trim($out); + // '"' is dangerous because param in url can close the href= or src= and add javascript functions. + // '../' is dangerous because it allows dir transversals + if (preg_match('/"/',$out)) $out=''; + else if (preg_match('/\.\.\//',$out)) $out=''; + break; + case 'san_alpha': + $out=filter_var($out,FILTER_SANITIZE_STRING); + break; + case 'aZ': + $out=trim($out); + if (preg_match('/[^a-z]+/i',$out)) $out=''; + break; + case 'array': + if (! is_array($out) || empty($out)) $out=array(); + break; + case 'custom': + if (empty($filter)) return 'BadFourthParameterForGETPOST'; + $out=filter_var($out, $filter, $options); + break; + } } return $out; @@ -224,7 +229,12 @@ function GETPOST($paramname,$check='',$method=0) */ function dol_getprefix() { - if (isset($_SERVER["SERVER_NAME"]) && isset($_SERVER["DOCUMENT_ROOT"])) return dol_hash($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"].DOL_DOCUMENT_ROOT.DOL_URL_ROOT); + if (isset($_SERVER["SERVER_NAME"]) && isset($_SERVER["DOCUMENT_ROOT"])) + { + return dol_hash($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"].DOL_DOCUMENT_ROOT.DOL_URL_ROOT); + // Use this for a "clear" cookie name + //return dol_sanitizeFileName($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"].DOL_DOCUMENT_ROOT.DOL_URL_ROOT); + } else return dol_hash(DOL_DOCUMENT_ROOT.DOL_URL_ROOT); } @@ -236,16 +246,23 @@ function dol_getprefix() * * @param string $relpath Relative path to file (Ie: mydir/myfile, ../myfile, ...) * @param string $classname Class name - * @return int false if include fails. + * @return bool */ function dol_include_once($relpath, $classname='') { - global $conf,$langs,$user,$mysoc; // Other global var must be retreived with $GLOBALS['var'] + global $conf,$langs,$user,$mysoc; // Do not remove this. They must be defined for files we include. Other globals var must be retreived with $GLOBALS['var'] + + $fullpath = dol_buildpath($relpath); + + if (!file_exists($fullpath)) { + dol_syslog('functions::dol_include_once Tried to load unexisting file: '.$relpath, LOG_ERR); + return false; + } if (! empty($classname) && ! class_exists($classname)) { - return @include dol_buildpath($relpath); // Remove @ to find error into php log file if you have problems + return include $fullpath; } else { - return @include_once dol_buildpath($relpath); // Remove @ to find error into php log file if you have problems + return include_once $fullpath; } } @@ -1478,19 +1495,11 @@ function dol_print_address($address, $htmlid, $mode, $id) */ function isValidEmail($address) { - if (preg_match("/.*<(.+)>/i", $address, $regs)) { - $address = $regs[1]; - } - // 2 letters domains extensions are for countries - // 3 letters domains extensions: biz|com|edu|gov|int|mil|net|org|pro|... - if (preg_match("/^[^@\s\t]+@([a-zA-Z0-9\-]+\.)+([a-zA-Z0-9\-]{2,3}|asso|aero|coop|info|name)\$/i",$address)) - { + if (filter_var($address, FILTER_VALIDATE_EMAIL)) { return true; } - else - { - return false; - } + + return false; } /** @@ -1768,7 +1777,7 @@ function dol_trunc($string,$size=40,$trunc='right',$stringencoding='UTF-8',$nodo /** * Show picto whatever it's its name (generic function) * - * @param string $alt Text on alt and title of image (alt only if param notitle is set to 1) + * @param string $titlealt Text on title and alt. If text is "TextA:TextB", use Text A on alt and Text B on title. Alt only if param notitle is set to 1. * @param string $picto Name of image file to show ('filenew', ...) * If no extension provided, we use '.png'. Image must be stored into theme/xxx/img directory. * Example: picto.png if picto.png is stored into htdocs/theme/mytheme/img @@ -1781,7 +1790,7 @@ function dol_trunc($string,$size=40,$trunc='right',$stringencoding='UTF-8',$nodo * @return string Return img tag * @see #img_object, #img_picto_common */ -function img_picto($alt, $picto, $options = '', $pictoisfullpath = false, $srconly=0, $notitle=0) +function img_picto($titlealt, $picto, $options = '', $pictoisfullpath = false, $srconly=0, $notitle=0) { global $conf; @@ -1825,13 +1834,19 @@ function img_picto($alt, $picto, $options = '', $pictoisfullpath = false, $srcon } if ($srconly) return $fullpathpicto; - else return ''.dol_escape_htmltag($alt).''; + else + { + $tmparray=explode(':',$titlealt); + $title=$tmparray[0]; + $alt=empty($tmparray[1])?'':$tmparray[1]; + return ''.dol_escape_htmltag($alt).''; // Alt is used for accessibility, title for popup + } } /** * Show a picto called object_picto (generic function) * - * @param string $alt Text of alt on image + * @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title. * @param string $picto Name of image to show object_picto (example: user, group, action, bill, contract, propal, product, ...) * For external modules use imagename@mymodule to search into directory "img" of module. * @param string $options Add more attribute on img tag (ie: class="datecallink") @@ -1839,22 +1854,22 @@ function img_picto($alt, $picto, $options = '', $pictoisfullpath = false, $srcon * @return string Return img tag * @see #img_picto, #img_picto_common */ -function img_object($alt, $picto, $options = '', $pictoisfullpath = false) +function img_object($titlealt, $picto, $options = '', $pictoisfullpath = false) { - return img_picto($alt, 'object_'.$picto, $options, $pictoisfullpath); + return img_picto($titlealt, 'object_'.$picto, $options, $pictoisfullpath); } /** * Show picto (generic function) * - * @param string $alt Text on alt and title of image + * @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title. * @param string $picto Name of image file to show (If no extension provided, we use '.png'). Image must be stored into htdocs/theme/common directory. * @param string $options Add more attribute on img tag * @param int $pictoisfullpath If 1, image path is a full path * @return string Return img tag * @see #img_object, #img_picto */ -function img_picto_common($alt, $picto, $options = '', $pictoisfullpath = 0) +function img_picto_common($titlealt, $picto, $options = '', $pictoisfullpath = 0) { global $conf; @@ -1873,141 +1888,141 @@ function img_picto_common($alt, $picto, $options = '', $pictoisfullpath = 0) } } - return img_picto($alt, $path, $options, 1); + return img_picto($titlealt, $path, $options, 1); } /** * Show logo action * - * @param string $alt Text for image alt and title ('default', ...) + * @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title. * @param int $numaction Action to show * @return string Return an img tag */ -function img_action($alt, $numaction) +function img_action($titlealt, $numaction) { global $conf, $langs; - if ($alt == 'default') + if ($titlealt == 'default') { - if ($numaction == -1) $alt = $langs->transnoentitiesnoconv('ChangeDoNotContact'); - if ($numaction == 0) $alt = $langs->transnoentitiesnoconv('ChangeNeverContacted'); - if ($numaction == 1) $alt = $langs->transnoentitiesnoconv('ChangeToContact'); - if ($numaction == 2) $alt = $langs->transnoentitiesnoconv('ChangeContactInProcess'); - if ($numaction == 3) $alt = $langs->transnoentitiesnoconv('ChangeContactDone'); + if ($numaction == -1) $titlealt = $langs->transnoentitiesnoconv('ChangeDoNotContact'); + if ($numaction == 0) $titlealt = $langs->transnoentitiesnoconv('ChangeNeverContacted'); + if ($numaction == 1) $titlealt = $langs->transnoentitiesnoconv('ChangeToContact'); + if ($numaction == 2) $titlealt = $langs->transnoentitiesnoconv('ChangeContactInProcess'); + if ($numaction == 3) $titlealt = $langs->transnoentitiesnoconv('ChangeContactDone'); } - return img_picto($alt, 'stcomm'.$numaction.'.png'); + return img_picto($titlealt, 'stcomm'.$numaction.'.png'); } /** * Show pdf logo * - * @param string $alt Texte sur le alt de l'image + * @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title. * @param int $size Taille de l'icone : 3 = 16x16px , 2 = 14x14px * @return string Retourne tag img */ -function img_pdf($alt = 'default', $size = 3) +function img_pdf($titlealt = 'default', $size = 3) { global $conf, $langs; - if ($alt == 'default') $alt = $langs->trans('Show'); + if ($titlealt == 'default') $titlealt = $langs->trans('Show'); - return img_picto($alt, 'pdf'.$size.'.png'); + return img_picto($titlealt, 'pdf'.$size.'.png'); } /** * Show logo + * - * @param string $alt Texte sur le alt de l'image + * @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title. * @return string Return tag img */ -function img_edit_add($alt = 'default') +function img_edit_add($titlealt = 'default') { global $conf, $langs; - if ($alt == 'default') $alt = $langs->trans('Add'); + if ($titlealt == 'default') $titlealt = $langs->trans('Add'); - return img_picto($alt, 'edit_add.png'); + return img_picto($titlealt, 'edit_add.png'); } /** * Show logo - * - * @param string $alt Texte sur le alt de l'image - * @return string Retourne tag img + * @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title. + * @return string Return tag img */ -function img_edit_remove($alt = 'default') +function img_edit_remove($titlealt = 'default') { global $conf, $langs; - if ($alt == 'default') $alt = $langs->trans('Remove'); + if ($titlealt == 'default') $titlealt = $langs->trans('Remove'); - return img_picto($alt, 'edit_remove.png'); + return img_picto($titlealt, 'edit_remove.png'); } /** * Show logo editer/modifier fiche * - * @param string $alt Texte sur le alt de l'image + * @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title. * @param float $float Si il faut y mettre le style "float: right" * @param string $other Add more attributes on img - * @return string Retourne tag img + * @return string Return tag img */ -function img_edit($alt = 'default', $float = 0, $other = '') +function img_edit($titlealt = 'default', $float = 0, $other = '') { global $conf, $langs; - if ($alt == 'default') $alt = $langs->trans('Modify'); + if ($titlealt == 'default') $titlealt = $langs->trans('Modify'); - return img_picto($alt, 'edit.png', ($float ? 'style="float: right"' : $other)); + return img_picto($titlealt, 'edit.png', ($float ? 'style="float: right"' : $other)); } /** * Show logo view card * - * @param string $alt Texte sur le alt de l'image - * @param float $float Si il faut y mettre le style "float: right" + * @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title. + * @param float $float Si il faut y mettre le style "float: right" * @param string $other Add more attributes on img - * @return string Retourne tag img + * @return string Return tag img */ -function img_view($alt = 'default', $float = 0, $other = '') +function img_view($titlealt = 'default', $float = 0, $other = '') { global $conf, $langs; - if ($alt == 'default') $alt = $langs->trans('View'); + if ($titlealt == 'default') $titlealt = $langs->trans('View'); $options = ($float ? 'style="float: right" ' : '').$other; - return img_picto($alt, 'view.png', $options); + return img_picto($titlealt, 'view.png', $options); } /** * Show delete logo * - * @param string $alt Text on alt image + * @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title. * @param string $other Add more attributes on img * @return string Retourne tag img */ -function img_delete($alt = 'default', $other = '') +function img_delete($titlealt = 'default', $other = '') { global $conf, $langs; - if ($alt == 'default') $alt = $langs->trans('Delete'); + if ($titlealt == 'default') $titlealt = $langs->trans('Delete'); - return img_picto($alt, 'delete.png', $other); + return img_picto($titlealt, 'delete.png', $other); } /** * Show printer logo * - * @param string $alt Text on alt image + * @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title. * @param string $other Add more attributes on img * @return string Retourne tag img */ -function img_printer($alt = "default", $other='') +function img_printer($titlealt = "default", $other='') { global $conf,$langs; - if ($alt=="default") $alt=$langs->trans("Print"); - return img_picto($alt,'printer.png',$other); + if ($titlealt=="default") $titlealt=$langs->trans("Print"); + return img_picto($titlealt,'printer.png',$other); } /** @@ -2033,159 +2048,159 @@ function img_help($usehelpcursor = 1, $usealttitle = 1) /** * Show info logo * - * @param string $alt Text to show on alt image + * @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title. * @return string Return img tag */ -function img_info($alt = 'default') +function img_info($titlealt = 'default') { global $conf, $langs; - if ($alt == 'default') $alt = $langs->trans('Informations'); + if ($titlealt == 'default') $titlealt = $langs->trans('Informations'); - return img_picto($alt, 'info.png'); + return img_picto($titlealt, 'info.png'); } /** * Show warning logo * - * @param string $alt Text to show on alt image + * @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title. * @param int $float If we must add style "float: right" * @return string Return img tag */ -function img_warning($alt = 'default', $float = 0) +function img_warning($titlealt = 'default', $float = 0) { global $conf, $langs; - if ($alt == 'default') $alt = $langs->trans('Warning'); + if ($titlealt == 'default') $titlealt = $langs->trans('Warning'); - return img_picto($alt, 'warning.png', ($float ? 'style="float: right"' : '')); + return img_picto($titlealt, 'warning.png', ($float ? 'style="float: right"' : '')); } /** * Show error logo * - * @param string $alt Text to show on alt image + * @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title. * @return string Return img tag */ -function img_error($alt = 'default') +function img_error($titlealt = 'default') { global $conf, $langs; - if ($alt == 'default') $alt = $langs->trans('Error'); + if ($titlealt == 'default') $titlealt = $langs->trans('Error'); - return img_picto($alt, 'error.png'); + return img_picto($titlealt, 'error.png'); } /** * Show next logo * - * @param string $alt Text to show on alt image + * @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title. * @return string Return img tag */ -function img_next($alt = 'default') +function img_next($titlealt = 'default') { global $conf, $langs; - if ($alt == 'default') $alt = $langs->trans('Next'); + if ($titlealt == 'default') $titlealt = $langs->trans('Next'); - return img_picto($alt, 'next.png'); + return img_picto($titlealt, 'next.png'); } /** * Show previous logo * - * @param string $alt Text to show on alt image + * @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title. * @return string Return img tag */ -function img_previous($alt = 'default') +function img_previous($titlealt = 'default') { global $conf, $langs; - if ($alt == 'default') $alt = $langs->trans('Previous'); + if ($titlealt == 'default') $titlealt = $langs->trans('Previous'); - return img_picto($alt, 'previous.png'); + return img_picto($titlealt, 'previous.png'); } /** * Show down arrow logo * - * @param string $alt Text to show on alt image + * @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title. * @param int $selected Selected * @return string Return img tag */ -function img_down($alt = 'default', $selected = 0) +function img_down($titlealt = 'default', $selected = 0) { global $conf, $langs; - if ($alt == 'default') $alt = $langs->trans('Down'); + if ($titlealt == 'default') $titlealt = $langs->trans('Down'); - return img_picto($alt, ($selected ? '1downarrow_selected.png' : '1downarrow.png'), 'class="imgdown"'); + return img_picto($titlealt, ($selected ? '1downarrow_selected.png' : '1downarrow.png'), 'class="imgdown"'); } /** * Show top arrow logo * - * @param string $alt Text to show on alt image + * @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title. * @param int $selected Selected * @return string Return img tag */ -function img_up($alt = 'default', $selected = 0) +function img_up($titlealt = 'default', $selected = 0) { global $conf, $langs; - if ($alt == 'default') $alt = $langs->trans('Up'); + if ($titlealt == 'default') $titlealt = $langs->trans('Up'); - return img_picto($alt, ($selected ? '1uparrow_selected.png' : '1uparrow.png'), 'class="imgup"'); + return img_picto($titlealt, ($selected ? '1uparrow_selected.png' : '1uparrow.png'), 'class="imgup"'); } /** * Show left arrow logo * - * @param string $alt Text to show on alt image + * @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title. * @param int $selected Selected * @param string $options Add more attribute on img tag (For example 'style="float: right"') * @return string Return img tag */ -function img_left($alt = 'default', $selected = 0, $options='') +function img_left($titlealt = 'default', $selected = 0, $options='') { global $conf, $langs; - if ($alt == 'default') $alt = $langs->trans('Left'); + if ($titlealt == 'default') $titlealt = $langs->trans('Left'); - return img_picto($alt, ($selected ? '1leftarrow_selected.png' : '1leftarrow.png'), $options); + return img_picto($titlealt, ($selected ? '1leftarrow_selected.png' : '1leftarrow.png'), $options); } /** * Show right arrow logo * - * @param string $alt Text to show on alt image + * @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title. * @param int $selected Selected * @param string $options Add more attribute on img tag (For example 'style="float: right"') * @return string Return img tag */ -function img_right($alt = 'default', $selected = 0, $options='') +function img_right($titlealt = 'default', $selected = 0, $options='') { global $conf, $langs; - if ($alt == 'default') $alt = $langs->trans('Right'); + if ($titlealt == 'default') $titlealt = $langs->trans('Right'); - return img_picto($alt, ($selected ? '1rightarrow_selected.png' : '1rightarrow.png'), $options); + return img_picto($titlealt, ($selected ? '1rightarrow_selected.png' : '1rightarrow.png'), $options); } /** * Show tick logo if allowed * * @param string $allow Allow - * @param string $alt Text to show on alt image + * @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title. * @return string Return img tag */ -function img_allow($allow, $alt = 'default') +function img_allow($allow, $titlealt = 'default') { global $conf, $langs; - if ($alt == 'default') $alt = $langs->trans('Active'); + if ($titlealt == 'default') $titlealt = $langs->trans('Active'); - if ($allow == 1) return img_picto($alt, 'tick.png'); + if ($allow == 1) return img_picto($titlealt, 'tick.png'); return '-'; } @@ -2195,19 +2210,19 @@ function img_allow($allow, $alt = 'default') * Show MIME img of a file * * @param string $file Filename - * @param string $alt Alternate text to show on img mous hover + * @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title. * @return string Return img tag */ -function img_mime($file, $alt = '') +function img_mime($file, $titlealt = '') { require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; $mimetype = dol_mimetype($file, '', 1); $mimeimg = dol_mimetype($file, '', 2); - if (empty($alt)) $alt = 'Mime type: '.$mimetype; + if (empty($titlealt)) $titlealt = 'Mime type: '.$mimetype; - return img_picto_common($alt, 'mime/'.$mimeimg); + return img_picto_common($titlealt, 'mime/'.$mimeimg); } @@ -2215,21 +2230,21 @@ function img_mime($file, $alt = '') * Show phone logo. * Use img_picto instead. * - * @param string $alt Text to show on alt image + * @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title. * @param int $option Option * @return string Return img tag * @deprecated */ -function img_phone($alt = 'default', $option = 0) +function img_phone($titlealt = 'default', $option = 0) { global $conf,$langs; - if ($alt == 'default') $alt = $langs->trans('Call'); + if ($titlealt == 'default') $titlealt = $langs->trans('Call'); if ($option == 1) $img = 'call'; else $img = 'call_out'; - return img_picto($alt, $img); + return img_picto($titlealt, $img); } @@ -2310,7 +2325,7 @@ function dol_print_error($db='',$error='') else // Mode CLI { $out.='> '.$langs->transnoentities("ErrorInternalErrorDetected").":\n".$argv[0]."\n"; - $syslog.="pid=".getmypid(); + $syslog.="pid=".dol_getmypid(); } if (is_object($db)) @@ -2895,11 +2910,16 @@ function get_localtax($tva, $local, $thirdparty_buyer="", $thirdparty_seller="") dol_syslog("get_localtax tva=".$tva." local=".$local." thirdparty_buyer id=".(is_object($thirdparty_buyer)?$thirdparty_buyer->id:'')."/country_code=".(is_object($thirdparty_buyer)?$thirdparty_buyer->country_code:'')." thirdparty_seller id=".$thirdparty_seller->id."/country_code=".$thirdparty_seller->country_code." thirdparty_seller localtax1_assuj=".$thirdparty_seller->localtax1_assuj." thirdparty_seller localtax2_assuj=".$thirdparty_seller->localtax2_assuj); + if($thirdparty_buyer->country_code!=$thirdparty_seller->country_code) + { + return 0; + } // Some test to guess with no need to make database access if ($mysoc->country_code == 'ES') // For spain localtaxes 1 and 2, tax is qualified if buyer use local taxe { if ($local == 1) { + if(! $mysoc->localtax1_assuj) return 0; if ($thirdparty_seller->id==$mysoc->id) { if (! $thirdparty_buyer->localtax1_assuj) return 0; @@ -2912,8 +2932,8 @@ function get_localtax($tva, $local, $thirdparty_buyer="", $thirdparty_seller="") if ($local == 2) { - - if ($thirdparty_seller->id==$mysoc->id) + if(! $mysoc->localtax2_assuj) return 0; + if ($thirdparty_seller->id==$mysoc->id ) { if (! $thirdparty_buyer->localtax2_assuj) return 0; } @@ -2939,12 +2959,49 @@ function get_localtax($tva, $local, $thirdparty_buyer="", $thirdparty_seller="") }*/ // Search local taxes + if ($local==1) + { + if($thirdparty_seller!=$mysoc ) + { + if(!isOnlyOneLocalTax($local)) + { + return $thirdparty_seller->localtax1_value; + } + } + else + { + if(!isOnlyOneLocalTax($local)) + { + return $conf->global->MAIN_INFO_VALUE_LOCALTAX1; + } + } + } + if ($local==2) + { + if($thirdparty_seller!=$mysoc) + { + if(!isOnlyOneLocalTax($local)) + { + return $thirdparty_seller->localtax2_value; + } + } + else + { + if(!isOnlyOneLocalTax($local)) + { + return $conf->global->MAIN_INFO_VALUE_LOCALTAX2; + } + } + } + + + $sql = "SELECT t.localtax1, t.localtax2, t.localtax1_type, t.localtax2_type"; - $sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_pays as p"; - $sql .= " WHERE t.fk_pays = p.rowid AND p.code = '".$thirdparty_seller->country_code."'"; + $sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c"; + $sql .= " WHERE t.fk_pays = c.rowid AND c.code = '".$thirdparty_seller->country_code."'"; $sql .= " AND t.taux = ".$tva." AND t.active = 1"; - dol_syslog("get_localtax sql=".$sql); + dol_syslog("get_localtax", LOG_DEBUG); $resql=$db->query($sql); if ($resql) { @@ -2956,6 +3013,57 @@ function get_localtax($tva, $local, $thirdparty_buyer="", $thirdparty_seller="") return 0; } + +/** + * Return true if LocalTax is unique + * + * @param int $local Local taxt to test + * @return boolean True if LocalTax have multiple values, False if not + */ +function isOnlyOneLocalTax($local) +{ + $tax=get_localtax_by_third($local); + + $valors=explode(":", $tax); + + if(count($valors)>1) + { + return false; + } + else + { + return true; + } +} + +/** + * Get values of localtaxes + * + * @param int $local LocalTax to get + * @return number Values of localtax + */ +function get_localtax_by_third($local) +{ + global $db, $mysoc; + $sql ="SELECT t.localtax1, t.localtax2 "; + $sql.=" FROM ".MAIN_DB_PREFIX."c_tva as t inner join ".MAIN_DB_PREFIX."c_country as c ON c.rowid=t.fk_pays"; + $sql.=" WHERE c.code = '".$mysoc->country_code."' AND t.taux=(SELECT max(tt.taux)"; + $sql.=" FROM ".MAIN_DB_PREFIX."c_tva as tt inner join ".MAIN_DB_PREFIX."c_country as c ON c.rowid=tt.fk_pays"; + $sql.=" WHERE c.code = '".$mysoc->country_code."')"; + + $resql=$db->query($sql); + if ($resql) + { + $obj = $db->fetch_object($resql); + if ($local==1) return $obj->localtax1; + elseif ($local==2) return $obj->localtax2; + } + + return 0; + +} + + /** * Get type and rate of localtaxes for a particular vat rate/country fo thirdparty * TODO @@ -2965,10 +3073,11 @@ function get_localtax($tva, $local, $thirdparty_buyer="", $thirdparty_seller="") * * @param float $vatrate VAT Rate * @param int $local Number of localtax (1 or 2, or 0 to return 1 & 2) - * @param int $thirdparty Company object + * @param int $buyer Company object + * @param int $seller Company object * @return array array(localtax_type1(1-6 / 0 if not found), rate of localtax1, ...) */ -function getLocalTaxesFromRate($vatrate, $local, $thirdparty) +function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller) { global $db; @@ -2976,17 +3085,85 @@ function getLocalTaxesFromRate($vatrate, $local, $thirdparty) // Search local taxes $sql = "SELECT t.localtax1, t.localtax1_type, t.localtax2, t.localtax2_type, t.accountancy_code_sell, t.accountancy_code_buy"; - $sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_pays as p"; - $sql .= " WHERE t.fk_pays = p.rowid AND p.code = '".$thirdparty->country_code."'"; + $sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c"; + $sql .= " WHERE t.fk_pays = c.rowid AND c.code = '".$buyer->country_code."'"; $sql .= " AND t.taux = ".$vatrate." AND t.active = 1"; $resql=$db->query($sql); if ($resql) { $obj = $db->fetch_object($resql); - if ($local == 1) return array($obj->localtax1_type, $obj->localtax1,$obj->accountancy_code_sell,$obj->accountancy_code_buy); - elseif ($local == 2) return array($obj->localtax2_type, $obj->localtax2,$obj->accountancy_code_sell,$obj->accountancy_code_buy); - else return array($obj->localtax1_type, $obj->localtax1, $obj->localtax2_type, $obj->localtax2,$obj->accountancy_code_sell,$obj->accountancy_code_buy); + if ($local == 1) + { + if (! isOnlyOneLocalTax(1)) + { + return array($obj->localtax1_type, get_localtax($vatrate, $local, $buyer, $seller), $obj->accountancy_code_sell,$obj->accountancy_code_buy); + } + else + { + return array($obj->localtax1_type, $obj->localtax1,$obj->accountancy_code_sell,$obj->accountancy_code_buy); + } + } + elseif ($local == 2) + { + if (! isOnlyOneLocalTax(2)) + { + return array($obj->localtax2_type, get_localtax($vatrate, $local, $buyer, $seller),$obj->accountancy_code_sell,$obj->accountancy_code_buy); + } + else + { + return array($obj->localtax2_type, $obj->localtax2,$obj->accountancy_code_sell,$obj->accountancy_code_buy); + } + } + else + { + if(! isOnlyOneLocalTax(1)) + { + if(! isOnlyOneLocalTax(2)) + { + return array($obj->localtax1_type, get_localtax($vatrate, 1, $buyer, $seller), $obj->localtax2_type, get_localtax($vatrate, 2, $buyer, $seller),$obj->accountancy_code_sell,$obj->accountancy_code_buy); + } + else + { + return array($obj->localtax1_type, get_localtax($vatrate, 1, $buyer, $seller), $obj->localtax2_type, $obj->localtax2,$obj->accountancy_code_sell,$obj->accountancy_code_buy); + } + } + else + { + if(! isOnlyOneLocalTax(2)) + { + return array($obj->localtax1_type, $obj->localtax1, $obj->localtax2_type,get_localtax($vatrate, 2, $buyer, $seller) ,$obj->accountancy_code_sell,$obj->accountancy_code_buy); + } + else + { + return array($obj->localtax1_type, $obj->localtax1, $obj->localtax2_type, $obj->localtax2,$obj->accountancy_code_sell,$obj->accountancy_code_buy); + } + } + + if(! isOnlyOneLocalTax(2)) + { + if(! isOnlyOneLocalTax(1)) + { + return array($obj->localtax2_type, get_localtax($vatrate, 1, $buyer, $seller), $obj->localtax2_type, get_localtax($vatrate, 2, $buyer, $seller),$obj->accountancy_code_sell,$obj->accountancy_code_buy); + } + else + { + return array($obj->localtax2_type, get_localtax($vatrate, 1, $buyer, $seller), $obj->localtax2_type, $obj->localtax2,$obj->accountancy_code_sell,$obj->accountancy_code_buy); + } + } + else + { + if(! isOnlyOneLocalTax(1)) + { + return array($obj->localtax2_type, $obj->localtax2, $obj->localtax1_type,get_localtax($vatrate, 1, $buyer, $seller) ,$obj->accountancy_code_sell,$obj->accountancy_code_buy); + } + else + { + return array($obj->localtax2_type, $obj->localtax2, $obj->localtax1_type, $obj->localtax1,$obj->accountancy_code_sell,$obj->accountancy_code_buy); + } + } + + } } return 0; @@ -3043,8 +3220,8 @@ function get_product_vat_for_country($idprod, $thirdparty_seller, $idprodfournpr { // If vat of product for the country not found or not defined, we return higher vat of country. $sql = "SELECT taux as vat_rate"; - $sql.= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_pays as p"; - $sql.= " WHERE t.active=1 AND t.fk_pays = p.rowid AND p.code='".$thirdparty_seller->country_code."'"; + $sql.= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c"; + $sql.= " WHERE t.active=1 AND t.fk_pays = c.rowid AND c.code='".$thirdparty_seller->country_code."'"; $sql.= " ORDER BY t.taux DESC, t.recuperableonly ASC"; $sql.= $db->plimit(1); @@ -3113,8 +3290,8 @@ function get_product_localtax_for_country($idprod, $local, $thirdparty_seller) { // If vat of product for the country not found or not defined, we return higher vat of country. $sql = "SELECT taux as vat_rate, localtax1, localtax2"; - $sql.= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_pays as p"; - $sql.= " WHERE t.active=1 AND t.fk_pays = p.rowid AND p.code='".$thirdparty_seller->country_code."'"; + $sql.= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c"; + $sql.= " WHERE t.active=1 AND t.fk_pays = c.rowid AND c.code='".$thirdparty_seller->country_code."'"; $sql.= " ORDER BY t.taux DESC, t.recuperableonly ASC"; $sql.= $db->plimit(1); @@ -3469,24 +3646,19 @@ function dol_string_nohtmltag($StringHtml,$removelinefeed=1,$pagecodeto='UTF-8') /** - * Replace CRLF in string with a HTML BR tag + * Replace CRLF in string with a HTML BR tag * - * @param string $stringtoencode String to encode - * @param string $nl2brmode 0=Adding br before \n, 1=Replacing \n by br - * @param string $forxml false=Use
, true=Use
- * @return string String encoded + * @param string $stringtoencode String to encode + * @param int $nl2brmode 0=Adding br before \n, 1=Replacing \n by br + * @param bool $forxml false=Use
, true=Use
+ * @return string String encoded */ function dol_nl2br($stringtoencode,$nl2brmode=0,$forxml=false) { - if (! $nl2brmode) - { - // We use @ to avoid warning on PHP4 that does not support entity encoding from UTF8; - if (version_compare(PHP_VERSION, '5.3.0') < 0) return @nl2br($stringtoencode); - else return @nl2br($stringtoencode,$forxml); - } - else - { - $ret=preg_replace('/(\r\n|\r|\n)/i',($forxml?'
':'
'),$stringtoencode); + if (!$nl2brmode) { + return nl2br($stringtoencode, $forxml); + } else { + $ret=preg_replace('/(\r\n|\r|\n)/i', ($forxml?'
':'
'), $stringtoencode); return $ret; } } @@ -3582,12 +3754,11 @@ function dol_html_entity_decode($a,$b,$c='UTF-8') * @param string $encoding Encoding * @param bool $double_encode When double_encode is turned off PHP will not encode existing html entities * @return string $ret Encoded string + * @deprecated Since PHP4 support is no longer available, this function does not make sense */ function dol_htmlentities($string, $flags=null, $encoding='UTF-8', $double_encode=false) { - // We use @ to avoid warning on PHP4 that does not support entity decoding to UTF8; - $ret=@htmlentities($string, $flags, $encoding, $double_encode); - return $ret; + return htmlentities($string, $flags, $encoding, $double_encode); } @@ -3618,7 +3789,7 @@ function dol_string_is_good_iso($s) * Return nb of lines of a clear text * * @param string $s String to check - * @param string $maxchar Not yet used + * @param int $maxchar Not yet used * @return int Number of lines */ function dol_nboflines($s,$maxchar=0) @@ -3673,12 +3844,12 @@ function dol_nboflines_bis($text,$maxlinesize=0,$charset='UTF-8') /** * Same function than microtime in PHP 5 but compatible with PHP4 * - * @return float Time (millisecondes) with microsecondes in decimal part + * @return float Time (millisecondes) with microsecondes in decimal part + * @deprecated Dolibarr does not support PHP4, you should use native function */ function dol_microtime_float() { - list($usec, $sec) = explode(" ", microtime()); - return ((float) $usec + (float) $sec); + return microtime(true); } /** @@ -3886,10 +4057,11 @@ function dolGetFirstLastname($firstname,$lastname,$nameorder=-1) /** - * Set event message in dol_events session + * Set event message in dol_events session object. Will be output by calling dol_htmloutput_events. + * Note: Calling dol_htmloutput_events is done into pages by standard llxFooter() function. * * @param mixed $mesgs Message string or array - * @param string $style Which style to use ('mesgs', 'warnings', 'errors') + * @param string $style Which style to use ('mesgs' by default, 'warnings', 'errors') * @return void * @see dol_htmloutput_events */ @@ -3911,6 +4083,8 @@ function setEventMessage($mesgs, $style='mesgs') /** * Print formated messages to output (Used to show messages on html output). + * Note: Calling dol_htmloutput_events is done into pages by standard llxFooter() function, so there is + * no need to call it explicitely. * * @return void * @see dol_htmloutput_mesg @@ -4209,7 +4383,7 @@ function dol_getIdFromCode($db,$key,$tablename,$fieldkey='code',$fieldid='id') $sql = "SELECT ".$fieldid." as id"; $sql.= " FROM ".MAIN_DB_PREFIX.$tablename; $sql.= " WHERE ".$fieldkey." = '".$key."'"; - dol_syslog('dol_getIdFromCode sql='.$sql, LOG_DEBUG); + dol_syslog('dol_getIdFromCode', LOG_DEBUG); $resql = $db->query($sql); if ($resql) { @@ -4221,7 +4395,6 @@ function dol_getIdFromCode($db,$key,$tablename,$fieldkey='code',$fieldid='id') } else { - dol_syslog("dol_getIdFromCode error=".$db->lasterror(), LOG_ERR); return -1; } } @@ -4556,18 +4729,20 @@ function dol_set_focus($selector) } -if (! function_exists('getmypid')) +/** + * Return getmypid() or random PID when function is disabled + * Some web hosts disable this php function for security reasons + * and sometimes we can't redeclare function + * + * @return int + */ +function dol_getmypid() { - /** - * Return random PID - * Some web hosts disable this php function for security reasons - * - * @return int - */ - function getmypid() - { - return rand(1,32768); - } + if (! function_exists('getmypid')) { + return rand(1,32768); + } else { + return getmypid(); + } } diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 917ceaf0e65..fdb5a26109e 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -2,6 +2,7 @@ /* Copyright (C) 2008-2011 Laurent Destailleur * Copyright (C) 2008-2012 Regis Houssin * Copyright (C) 2008 Raphael Bertrand (Resultic) + * 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 @@ -394,12 +395,12 @@ function isValidMailDomain($mail) * :// [user[:pass]@] hostname [port] [/path] [?getquery] [anchor] * * @param string $url Url - * @param int $http 1: verify http, 0: not verify http - * @param int $pass 1: verify user and pass, 0: not verify user and pass - * @param int $port 1: verify port, 0: not verify port - * @param int $path 1: verify path, 0: not verify path - * @param int $query 1: verify query, 0: not verify query - * @param int $anchor 1: verify anchor, 0: not verify anchor + * @param int $http 1: verify http is provided, 0: not verify http + * @param int $pass 1: verify user and pass is provided, 0: not verify user and pass + * @param int $port 1: verify port is provided, 0: not verify port + * @param int $path 1: verify a path is provided "/" or "/..." or "/.../", 0: not verify path + * @param int $query 1: verify query is provided, 0: not verify query + * @param int $anchor 1: verify anchor is provided, 0: not verify anchor * @return int 1=Check is OK, 0=Check is KO */ function isValidUrl($url,$http=0,$pass=0,$port=0,$path=0,$query=0,$anchor=0) @@ -414,9 +415,9 @@ function isValidUrl($url,$http=0,$pass=0,$port=0,$path=0,$query=0,$anchor=0) if ($pass) $urlregex .= "([a-z0-9+!*(),;?&=\$_.-]+(\:[a-z0-9+!*(),;?&=\$_.-]+)?@)"; // HOSTNAME OR IP - //$urlregex .= "[a-z0-9+\$_-]+(\.[a-z0-9+\$_-]+)*"; // http://x = allowed (ex. http://localhost, http://routerlogin) - //$urlregex .= "[a-z0-9+\$_-]+(\.[a-z0-9+\$_-]+)+"; // http://x.x = minimum - $urlregex .= "([a-z0-9+\$_-]+\.)*[a-z0-9+\$_-]{2,3}"; // http://x.xx(x) = minimum + //$urlregex .= "[a-z0-9+\$_-]+(\.[a-z0-9+\$_-]+)*"; // x allowed (ex. http://localhost, http://routerlogin) + //$urlregex .= "[a-z0-9+\$_-]+(\.[a-z0-9+\$_-]+)+"; // x.x + $urlregex .= "([a-z0-9+\$_\\\:-])+(\.[a-z0-9+\$_-][a-z0-9+\$_-]+)*"; // x ou x.xx (2 x ou plus) //use only one of the above // PORT @@ -433,7 +434,7 @@ function isValidUrl($url,$http=0,$pass=0,$port=0,$path=0,$query=0,$anchor=0) { $ValidUrl = 1; } - //print $urlregex.' - '.$url.' - '.$ValidUrl;exit; + //print $urlregex.' - '.$url.' - '.$ValidUrl; return $ValidUrl; } @@ -744,7 +745,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m if ($sqlwhere) $sql.=' AND '.$sqlwhere; //print $sql.'
'; - dol_syslog("functions2::get_next_value mode=".$mode." sql=".$sql, LOG_DEBUG); + dol_syslog("functions2::get_next_value mode=".$mode."", LOG_DEBUG); $resql=$db->query($sql); if ($resql) { @@ -783,7 +784,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m if ($where) $sql.=$where; if ($sqlwhere) $sql.=' AND '.$sqlwhere; - dol_syslog("functions2::get_next_value sql=".$sql); + dol_syslog("functions2::get_next_value", LOG_DEBUG); $resql=$db->query($sql); if ($resql) { @@ -837,7 +838,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m if ($sqlwhere) $maskrefclient_sql.=' AND '.$sqlwhere; //use the same sqlwhere as general mask $maskrefclient_sql.=' AND (SUBSTRING('.$field.', '.(strpos($maskwithnocode,$maskrefclient)+1).', '.dol_strlen($maskrefclient_maskclientcode).")='".$maskrefclient_clientcode."')"; - dol_syslog("functions2::get_next_value maskrefclient_sql=".$maskrefclient_sql, LOG_DEBUG); + dol_syslog("functions2::get_next_value maskrefclient", LOG_DEBUG); $maskrefclient_resql=$db->query($maskrefclient_sql); if ($maskrefclient_resql) { @@ -1168,7 +1169,7 @@ function dol_set_user_param($db, $conf, &$user, $tab) $i++; } $sql.= ")"; - dol_syslog("functions2.lib::dol_set_user_param sql=".$sql, LOG_DEBUG); + dol_syslog("functions2.lib::dol_set_user_param", LOG_DEBUG); $resql=$db->query($sql); if (! $resql) @@ -1187,7 +1188,7 @@ function dol_set_user_param($db, $conf, &$user, $tab) $sql.= " VALUES (".$user->id.",".$conf->entity.","; $sql.= " '".$key."','".$db->escape($value)."')"; - dol_syslog("functions2.lib::dol_set_user_param sql=".$sql, LOG_DEBUG); + dol_syslog("functions2.lib::dol_set_user_param", LOG_DEBUG); $result=$db->query($sql); if (! $result) { @@ -1293,7 +1294,7 @@ function getListOfModels($db,$type,$maxfilenamelength=0) $sql.= " WHERE type = '".$type."'"; $sql.= " AND entity IN (0,".(! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode)?"1,":"").$conf->entity.")"; - dol_syslog('/core/lib/function2.lib.php::getListOfModels sql='.$sql, LOG_DEBUG); + dol_syslog('/core/lib/function2.lib.php::getListOfModels', LOG_DEBUG); $resql = $db->query($sql); if ($resql) { @@ -1363,20 +1364,24 @@ function getListOfModels($db,$type,$maxfilenamelength=0) /** * This function evaluates a string that should be a valid IPv4 * - * @param string $ip IP Address - * @return It returns 0 if $ip is not a valid IPv4 - * It returns 1 if $ip is a valid IPv4 and is a public IP - * It returns 2 if $ip is a valid IPv4 and is a private lan IP + * @param string $ip IP Address + * @return int 0 if not valid or reserved range, 1 if valid and public IP, 2 if valid and private range IP */ function is_ip($ip) { - if (!preg_match("/^([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/", $ip)) return 0; - if (sprintf("%u",ip2long($ip)) == sprintf("%u",ip2long('255.255.255.255'))) return 0; - if (sprintf("%u",ip2long('10.0.0.0')) <= sprintf("%u",ip2long($ip)) and sprintf("%u",ip2long($ip)) <= sprintf("%u",ip2long('10.255.255.255'))) return 2; - if (sprintf("%u",ip2long('172.16.0.0')) <= sprintf("%u",ip2long($ip)) and sprintf("%u",ip2long($ip)) <= sprintf("%u",ip2long('172.31.255.255'))) return 2; - if (sprintf("%u",ip2long('192.168.0.0')) <= sprintf("%u",ip2long($ip)) and sprintf("%u",ip2long($ip)) <= sprintf("%u",ip2long('192.168.255.255'))) return 2; - if (sprintf("%u",ip2long('169.254.0.0')) <= sprintf("%u",ip2long($ip)) and sprintf("%u",ip2long($ip)) <= sprintf("%u",ip2long('169.254.255.255'))) return 2; - return 1; + // First we test if it is a valid IPv4 + if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) { + + // Then we test if it is a private range + if (! filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE)) return 2; + + // Then we test if it is a reserved range + if (! filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE)) return 0; + + return 1; + } + + return 0; } /** @@ -1582,7 +1587,6 @@ function cleanCorruptedTree($db, $tabletocleantree, $fieldfkparent) // Check loops on each other $sql = "UPDATE ".MAIN_DB_PREFIX.$tabletocleantree." SET ".$fieldfkparent." = 0 WHERE ".$fieldfkparent." = rowid"; // So we update only records linked to themself - dol_syslog("sql=".$sql); $resql = $db->query($sql); if ($resql) { @@ -1623,7 +1627,6 @@ function cleanCorruptedTree($db, $tabletocleantree, $fieldfkparent) $sql = "UPDATE ".MAIN_DB_PREFIX.$tabletocleantree; $sql.= " SET ".$fieldfkparent." = 0"; $sql.= " WHERE rowid IN (".join(',',$listofidtoclean).")"; // So we update only records detected wrong - dol_syslog("sql=".$sql); $resql = $db->query($sql); if ($resql) { @@ -1643,7 +1646,6 @@ function cleanCorruptedTree($db, $tabletocleantree, $fieldfkparent) $sql = "UPDATE ".MAIN_DB_PREFIX.$tabletocleantree; $sql.= " SET ".$fieldfkparent." = 0"; $sql.= " WHERE ".$fieldfkparent." NOT IN (".join(',',$listofid).")"; // So we update only records linked to a non existing parent - dol_syslog("sql=".$sql); $resql = $db->query($sql); if ($resql) { diff --git a/htdocs/core/lib/holiday.lib.php b/htdocs/core/lib/holiday.lib.php index dd299ab5c2c..209ca16f585 100644 --- a/htdocs/core/lib/holiday.lib.php +++ b/htdocs/core/lib/holiday.lib.php @@ -49,5 +49,3 @@ function holiday_prepare_head($object) return $head; } - -?> diff --git a/htdocs/core/lib/index.html b/htdocs/core/lib/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/core/lib/index.php b/htdocs/core/lib/index.php deleted file mode 100644 index 7db0dd9ebf9..00000000000 --- a/htdocs/core/lib/index.php +++ /dev/null @@ -1 +0,0 @@ -Url not available \ No newline at end of file diff --git a/htdocs/core/lib/invoice2.lib.php b/htdocs/core/lib/invoice2.lib.php index 9309d083187..39405db4468 100644 --- a/htdocs/core/lib/invoice2.lib.php +++ b/htdocs/core/lib/invoice2.lib.php @@ -128,7 +128,7 @@ function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filte if ($sqlorder) $sql.=$sqlorder; //print $sql; exit; - dol_syslog("scripts/invoices/rebuild_merge.php: sql=".$sql); + dol_syslog("scripts/invoices/rebuild_merge.php:", LOG_DEBUG); if ($usestdout) print '--- start'."\n"; @@ -139,7 +139,7 @@ function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filte $result = 0; $files = array() ; // liste les fichiers - dol_syslog("scripts/invoices/rebuild_merge.php sql=".$sql); + dol_syslog("scripts/invoices/rebuild_merge.php", LOG_DEBUG); if ( $resql=$db->query($sql) ) { $num = $db->num_rows($resql); diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index bcb1008b622..ade08400762 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -739,7 +739,7 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass // Capital if ($fromcompany->capital) { - $line3.=($line3?" - ":"").$outputlangs->transnoentities("CapitalOf",$fromcompany->capital)." ".$outputlangs->transnoentities("Currency".$conf->currency); + $line3.=($line3?" - ":"").$outputlangs->transnoentities("CapitalOf",price($fromcompany->capital, 0, $outputlangs, 0, 0, 0, $conf->currency)); } // Prof Id 1 if ($fromcompany->idprof1 && ($fromcompany->country_code != 'FR' || ! $fromcompany->idprof2)) @@ -1583,25 +1583,6 @@ function pdf_getLinkedObjects($object,$outputlangs) $linkedobjects[$objecttype]['date_value'] = dol_print_date($objects[$i]->date,'day','',$outputlangs); } } - else if ($objecttype == 'shipping') - { - $outputlangs->load('orders'); - $outputlangs->load('sendings'); - - $num=count($objects); - for ($i=0;$i<$num;$i++) - { - $objects[$i]->fetchObjectLinked(); - $order = $objects[$i]->linkedObjects['commande'][0]; - - $linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefOrder") . ' / ' . $outputlangs->transnoentities("RefSending"); - $linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($order->ref) . ($order->ref_client ? ' ('.$order->ref_client.')' : ''); - $linkedobjects[$objecttype]['ref_value'].= ' / ' . $outputlangs->transnoentities($objects[$i]->ref); - $linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("OrderDate") . ' / ' . $outputlangs->transnoentities("DateSending"); - $linkedobjects[$objecttype]['date_value'] = dol_print_date($order->date,'day','',$outputlangs); - $linkedobjects[$objecttype]['date_value'].= ' / ' . dol_print_date($objects[$i]->date_delivery,'day','',$outputlangs); - } - } else if ($objecttype == 'contrat') { $outputlangs->load('contracts'); diff --git a/htdocs/core/lib/price.lib.php b/htdocs/core/lib/price.lib.php index ac9845f22a1..00144db74e5 100644 --- a/htdocs/core/lib/price.lib.php +++ b/htdocs/core/lib/price.lib.php @@ -111,7 +111,7 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt $sql.= " FROM ".MAIN_DB_PREFIX."c_tva as cv"; $sql.= " WHERE cv.taux = ".$txtva; $sql.= " AND cv.fk_pays = ".$countryid; - dol_syslog("calcul_price_total search vat information sql=".$sql); + dol_syslog("calcul_price_total search vat information", LOG_DEBUG); $resql = $db->query($sql); if ($resql) { diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php index e8c86b37db9..a252b361dcf 100644 --- a/htdocs/core/lib/product.lib.php +++ b/htdocs/core/lib/product.lib.php @@ -357,5 +357,3 @@ function measuring_units_string($unit,$measuring_style='') return $measuring_units[$unit]; } - -?> diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index bfe782c40f9..3a4a2dc6035 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -629,9 +629,10 @@ function searchTaskInChild(&$inc, $parent, &$lines, &$taskrole) * @param int $socid Id thirdparty * @param int $projectsListId Id of project i have permission on * @param int $mytasks Limited to task i am contact to + * @param int $statut -1=No filter on statut, 0 or 1 = Filter on status * @return void */ -function print_projecttasks_array($db, $socid, $projectsListId, $mytasks=0) +function print_projecttasks_array($db, $socid, $projectsListId, $mytasks=0, $statut=-1) { global $langs,$conf,$user,$bc; @@ -642,9 +643,13 @@ function print_projecttasks_array($db, $socid, $projectsListId, $mytasks=0) $sortfield=''; $sortorder=''; + $title=$langs->trans("Project"); + if ($statut == 0) $title=$langs->trans("ProjectDraft"); + if ($statut == 1) $title=$langs->trans("Project").' ('.$langs->trans("Validated").')'; + print '
'; + print ''; + if ($action != 'editshippingmethod' && $user->rights->commande->creer) + print ''; + print '
'; + print $langs->trans('SendingMethod'); + print 'id.'">'.img_edit($langs->trans('SetShippingMode'),1).'
'; + print '
'; + if ($action == 'editshippingmethod') { + $form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$object->id, $object->shipping_method_id, 'shipping_method_id', 1); + } else { + $form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$object->id, $object->shipping_method_id, 'none'); + } + print '
'; print ''; + print ''; + + // Total HT print ''; print ''; @@ -2145,12 +2195,12 @@ if ($action == 'create' && $user->rights->commande->creer) { print ''; // Amount Local Taxes - if ($mysoc->localtax1_assuj == "1") // Localtax1 RE + if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) // Localtax1 { print ''; print ''; } - if ($mysoc->localtax2_assuj == "1") // Localtax2 IRPF + if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) // Localtax2 IRPF { print ''; print ''; @@ -2381,25 +2431,30 @@ if ($action == 'create' && $user->rights->commande->creer) { */ if ($action == 'presend') { + $object->fetch_projet(); + $ref = dol_sanitizeFileName($object->ref); include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; $fileparams = dol_most_recent_file($conf->commande->dir_output . '/' . $ref, preg_quote($ref, '/')); $file = $fileparams ['fullname']; + // Define output language + $outputlangs = $langs; + $newlang = ''; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) + $newlang = $_REQUEST['lang_id']; + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) + $newlang = $object->thirdparty->default_lang; + + if (!empty($newlang)) + { + $outputlangs = new Translate('', $conf); + $outputlangs->setDefaultLang($newlang); + $outputlangs->load('commercial'); + } + // Build document if it not exists if (! $file || ! is_readable($file)) { - // Define output language - $outputlangs = $langs; - $newlang = ''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) - $newlang = $_REQUEST['lang_id']; - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) - $newlang = $object->client->default_lang; - if (! empty($newlang)) { - $outputlangs = new Translate("", $conf); - $outputlangs->setDefaultLang($newlang); - } - $result = commande_pdf_create($db, $object, GETPOST('model') ? GETPOST('model') : $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); if ($result <= 0) { dol_print_error($db, $result); @@ -2415,6 +2470,7 @@ if ($action == 'create' && $user->rights->commande->creer) { // Cree l'objet formulaire mail 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); @@ -2427,9 +2483,9 @@ if ($action == 'create' && $user->rights->commande->creer) { $formmail->withtocc = $liste; $formmail->withtoccc = $conf->global->MAIN_EMAIL_USECCC; if (empty($object->ref_client)) { - $formmail->withtopic = $langs->trans('SendOrderRef', '__ORDERREF__'); + $formmail->withtopic = $outputlangs->trans('SendOrderRef', '__ORDERREF__'); } else if (! empty($object->ref_client)) { - $formmail->withtopic = $langs->trans('SendOrderRef', '__ORDERREF__(__REFCLIENT__)'); + $formmail->withtopic = $outputlangs->trans('SendOrderRef', '__ORDERREF__ (__REFCLIENT__)'); } $formmail->withfile = 2; $formmail->withbody = 1; @@ -2439,6 +2495,8 @@ if ($action == 'create' && $user->rights->commande->creer) { $formmail->substit ['__ORDERREF__'] = $object->ref; $formmail->substit ['__SIGNATURE__'] = $user->signature; $formmail->substit ['__REFCLIENT__'] = $object->ref_client; + $formmail->substit ['__THIRPARTY_NAME__'] = $object->thirdparty->name; + $formmail->substit ['__PROJECT_REF__'] = (is_object($object->projet)?$object->projet->ref:''); $formmail->substit ['__PERSONALIZED__'] = ''; $formmail->substit ['__CONTACTCIVNAME__'] = ''; @@ -2448,7 +2506,7 @@ if ($action == 'create' && $user->rights->commande->creer) { if (is_array($contactarr) && count($contactarr) > 0) { foreach ($contactarr as $contact) { - if ($contact ['libelle'] == $langs->trans('TypeContact_commande_external_CUSTOMER')) { + if ($contact ['libelle'] == $langs->trans('TypeContact_commande_external_CUSTOMER')) { // TODO Use code and not label $contactstatic = new Contact($db); $contactstatic->fetch($contact ['id']); $custcontact = $contactstatic->getFullName($langs, 1); diff --git a/htdocs/commande/orderstoinvoice.php b/htdocs/commande/orderstoinvoice.php index bdb96718dfa..8b16428b23f 100644 --- a/htdocs/commande/orderstoinvoice.php +++ b/htdocs/commande/orderstoinvoice.php @@ -58,6 +58,8 @@ $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); $viewstatut = GETPOST('viewstatut'); +$error = 0; + if (! $sortfield) $sortfield='c.rowid'; if (! $sortorder) $sortorder='DESC'; @@ -71,7 +73,8 @@ if ($action == 'create') { if (is_array($selected) == false) { - $mesgs = array('
'.$langs->trans('Error_OrderNotChecked').'
'); + $error++; + setEventMessage($langs->trans('Error_OrderNotChecked'), 'errors'); } else { @@ -90,7 +93,7 @@ $hookmanager->initHooks(array('orderstoinvoice')); * Actions */ -if (($action == 'create' || $action == 'add') && empty($mesgs)) +if (($action == 'create' || $action == 'add') && !$error) { require_once DOL_DOCUMENT_ROOT.'/core/modules/facture/modules_facture.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php'; @@ -244,7 +247,7 @@ if (($action == 'create' || $action == 'add') && empty($mesgs)) } else { - $mesgs[]=$discount->error; + setEventMessage($discount->error, 'errors'); $error++; break; } @@ -313,7 +316,7 @@ if (($action == 'create' || $action == 'add') && empty($mesgs)) } else { - $mesgs[]=$objectsrc->error; + setEventMessage($objectsrc->error, 'errors'); $error++; } $ii++; @@ -321,7 +324,7 @@ if (($action == 'create' || $action == 'add') && empty($mesgs)) } else { - $mesgs[]=$object->error; + setEventMessage($object->error, 'errors'); $error++; } } @@ -341,7 +344,8 @@ if (($action == 'create' || $action == 'add') && empty($mesgs)) $action='create'; $_GET["origin"]=$_POST["origin"]; $_GET["originid"]=$_POST["originid"]; - $mesgs[]='
'.$object->error.'
'; + setEventMessage($object->error, 'errors'); + $error++; } } } @@ -357,7 +361,7 @@ $formfile = new FormFile($db); $companystatic = new Societe($db); // Mode creation -if ($action == 'create' && empty($mesgs)) +if ($action == 'create' && !$error) { $facturestatic=new Facture($db); @@ -497,7 +501,7 @@ if ($action == 'create' && empty($mesgs)) //Mode liste -if (($action != 'create' && $action != 'add') || ! empty($mesgs)) +if (($action != 'create' && $action != 'add') || !$error) { llxHeader(); ?> @@ -693,7 +697,5 @@ if (($action != 'create' && $action != 'add') || ! empty($mesgs)) } -dol_htmloutput_mesg($mesg,$mesgs); - llxFooter(); $db->close(); diff --git a/htdocs/commande/tpl/index.html b/htdocs/commande/tpl/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/compta/ajaxpayment.php b/htdocs/compta/ajaxpayment.php index 66a1c997be3..27a167bc576 100644 --- a/htdocs/compta/ajaxpayment.php +++ b/htdocs/compta/ajaxpayment.php @@ -32,7 +32,6 @@ if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); // If we don't nee //if (! defined("NOLOGIN")) define("NOLOGIN",'1'); // If this page is public (can be called outside logged session) require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php'; $langs->load('compta'); @@ -115,4 +114,4 @@ $toJsonArray['result'] = price($result); // Return value to user format $toJsonArray['resultnum'] = price2num($result); // Return value to numeric format // Encode to JSON to return -echo dol_json_encode($toJsonArray); // Printing the call's result +echo json_encode($toJsonArray); // Printing the call's result diff --git a/htdocs/compta/bank/account.php b/htdocs/compta/bank/account.php index 0e16f6744fd..69962498312 100644 --- a/htdocs/compta/bank/account.php +++ b/htdocs/compta/bank/account.php @@ -72,8 +72,6 @@ if ($negpage) if ($page > GETPOST("nbpage")) $page = GETPOST("nbpage"); } -$mesg=''; - $object = new Account($db); /* @@ -83,6 +81,8 @@ $dateop=-1; if ($action == 'add' && $id && ! isset($_POST["cancel"]) && $user->rights->banque->modifier) { + $error = 0; + if (price2num($_POST["credit"]) > 0) { $amount = price2num($_POST["credit"]); @@ -98,11 +98,20 @@ if ($action == 'add' && $id && ! isset($_POST["cancel"]) && $user->rights->banqu $label=$_POST["label"]; $cat1=$_POST["cat1"]; - if (! $dateop) $mesg=$langs->trans("ErrorFieldRequired",$langs->trans("Date")); - if (! $operation) $mesg=$langs->trans("ErrorFieldRequired",$langs->trans("Type")); - if (! $amount) $mesg=$langs->trans("ErrorFieldRequired",$langs->trans("Amount")); + if (! $dateop) { + $error++; + setEventMessage($langs->trans("ErrorFieldRequired",$langs->trans("Date")), 'errors'); + } + if (! $operation) { + $error++; + setEventMessage($langs->trans("ErrorFieldRequired",$langs->trans("Type")), 'errors'); + } + if (! $amount) { + $error++; + setEventMessage($langs->trans("ErrorFieldRequired",$langs->trans("Amount")), 'errors'); + } - if (! $mesg) + if (! $error) { $object->fetch($id); $insertid = $object->addline($dateop, $operation, $label, $amount, $num_chq, $cat1, $user); @@ -114,7 +123,7 @@ if ($action == 'add' && $id && ! isset($_POST["cancel"]) && $user->rights->banqu } else { - $mesg=$object->error; + setEventMessage($object->error, 'errors'); } } else @@ -241,7 +250,7 @@ if ($id > 0 || ! empty($ref)) $sql.= " AND ba.entity = ".$conf->entity; $sql.= $sql_rech; - dol_syslog("account.php count transactions - sql=".$sql, LOG_DEBUG); + dol_syslog("account.php count transactions -", LOG_DEBUG); $result=$db->query($sql); if ($result) { @@ -295,8 +304,6 @@ if ($id > 0 || ! empty($ref)) print '
'; - dol_htmloutput_errors($mesg); - /** * Search form */ @@ -485,7 +492,7 @@ if ($id > 0 || ! empty($ref)) $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 - sql=".$sql, LOG_DEBUG); + dol_syslog("account.php get transactions -", LOG_DEBUG); $result = $db->query($sql); if ($result) { diff --git a/htdocs/compta/bank/annuel.php b/htdocs/compta/bank/annuel.php index e54c501fdab..30cf5b9c5ac 100644 --- a/htdocs/compta/bank/annuel.php +++ b/htdocs/compta/bank/annuel.php @@ -289,7 +289,7 @@ if ($result < 0) { $langs->load("errors"); $error++; - $mesg='
'.$langs->trans("ErrorFailedToCreateDir").'
'; + setEventMessage($langs->trans("ErrorFailedToCreateDir"), 'errors'); } else { diff --git a/htdocs/compta/bank/bankid_fr.php b/htdocs/compta/bank/bankid_fr.php index 907792010ba..9c10a311366 100644 --- a/htdocs/compta/bank/bankid_fr.php +++ b/htdocs/compta/bank/bankid_fr.php @@ -80,7 +80,7 @@ if ($action == 'update' && ! $_POST["cancel"]) } else { - $message='
'.$account->error.'
'; + setEventMessage($account->error, 'errors'); $action='edit'; // Force chargement page edition } } @@ -306,8 +306,6 @@ if ($_GET["id"] && $action == 'edit' && $user->rights->banque->configurer) print_fiche_titre($langs->trans("EditFinancialAccount")); print "
"; - dol_htmloutput_mesg($message); - print ''; print ''; print ''; diff --git a/htdocs/compta/bank/categ.php b/htdocs/compta/bank/categ.php index 41abab1ace0..5aa72d4c049 100644 --- a/htdocs/compta/bank/categ.php +++ b/htdocs/compta/bank/categ.php @@ -52,7 +52,6 @@ if (GETPOST('add')) $sql.= ", ".$conf->entity; $sql.= ")"; - dol_syslog("sql=".$sql); $result = $db->query($sql); if (!$result) { @@ -73,7 +72,6 @@ if (GETPOST('update')) $sql.= " WHERE rowid = '".GETPOST('categid')."'"; $sql.= " AND entity = ".$conf->entity; - dol_syslog("sql=".$sql); $result = $db->query($sql); if (!$result) { @@ -92,7 +90,6 @@ if ($action == 'delete') $sql.= " WHERE rowid = '".GETPOST('categid')."'"; $sql.= " AND entity = ".$conf->entity; - dol_syslog("sql=".$sql); $result = $db->query($sql); if (!$result) { diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 8bcabf7f17b..4ca6175d785 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -74,6 +74,7 @@ class Account extends CommonObject var $type_lib=array(); var $account_number; + var $accountancy_journal; var $currency_code; var $min_allowed; @@ -146,7 +147,7 @@ class Account extends CommonObject $sql.= ", '".$type."'"; $sql.= ")"; - dol_syslog(get_class($this)."::add_url_line sql=".$sql); + dol_syslog(get_class($this)."::add_url_line", LOG_DEBUG); if ($this->db->query($sql)) { $rowid = $this->db->last_insert_id(MAIN_DB_PREFIX."bank_url"); @@ -155,7 +156,6 @@ class Account extends CommonObject else { $this->error=$this->db->lasterror(); - dol_syslog(get_class($this)."::add_url_line ".$this->error, LOG_ERR); return -1; } } @@ -189,7 +189,7 @@ class Account extends CommonObject } $sql.= " ORDER BY type, label"; - dol_syslog(get_class($this)."::get_url sql=".$sql); + dol_syslog(get_class($this)."::get_url", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { @@ -302,7 +302,7 @@ class Account extends CommonObject $sql.= ", ".($banque?"'".$this->db->escape($banque)."'":"null"); $sql.= ")"; - dol_syslog(get_class($this)."::addline sql=".$sql); + dol_syslog(get_class($this)."::addline", LOG_DEBUG); if ($this->db->query($sql)) { $rowid = $this->db->last_insert_id(MAIN_DB_PREFIX."bank"); @@ -330,7 +330,6 @@ class Account extends CommonObject else { $this->error=$this->db->lasterror(); - dol_syslog(get_class($this)."::addline ".$this->error, LOG_ERR); $this->db->rollback(); return -2; } @@ -382,6 +381,7 @@ class Account extends CommonObject $sql.= ", label"; $sql.= ", entity"; $sql.= ", account_number"; + $sql.= ", accountancy_journal"; $sql.= ", currency_code"; $sql.= ", rappro"; $sql.= ", min_allowed"; @@ -395,6 +395,7 @@ class Account extends CommonObject $sql.= ", '".$this->db->escape($this->label)."'"; $sql.= ", ".$conf->entity; $sql.= ", '".$this->db->escape($this->account_number)."'"; + $sql.= ", '".$this->db->escape($this->accountancy_journal)."'"; $sql.= ", '".$this->currency_code."'"; $sql.= ", ".$this->rappro; $sql.= ", ".price2num($this->min_allowed); @@ -404,7 +405,7 @@ class Account extends CommonObject $sql.= ", ".$this->country_id; $sql.= ")"; - dol_syslog(get_class($this)."::create sql=".$sql); + dol_syslog(get_class($this)."::create", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -437,7 +438,6 @@ class Account extends CommonObject if (! $resql) { $this->error=$this->db->lasterror(); - dol_syslog($this->error, LOG_ERR); return -3; } } @@ -448,12 +448,10 @@ class Account extends CommonObject if ($this->db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $this->error=$langs->trans("ErrorBankLabelAlreadyExists"); - dol_syslog($this->error, LOG_ERR); return -1; } else { $this->error=$this->db->error()." sql=".$sql; - dol_syslog($this->error, LOG_ERR); return -2; } } @@ -500,6 +498,7 @@ class Account extends CommonObject $sql.= ",rappro = ".$this->rappro; $sql.= ",url = ".($this->url?"'".$this->url."'":"null"); $sql.= ",account_number = '".$this->account_number."'"; + $sql.= ",accountancy_journal = '".$this->accountancy_journal."'"; $sql.= ",currency_code = '".$this->currency_code."'"; @@ -513,7 +512,7 @@ class Account extends CommonObject $sql.= " WHERE rowid = ".$this->id; $sql.= " AND entity = ".$conf->entity; - dol_syslog(get_class($this)."::update sql=".$sql); + dol_syslog(get_class($this)."::update", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { @@ -570,7 +569,7 @@ class Account extends CommonObject $sql.= " WHERE rowid = ".$this->id; $sql.= " AND entity = ".$conf->entity; - dol_syslog(get_class($this)."::update_bban sql=$sql"); + dol_syslog(get_class($this)."::update_bban", LOG_DEBUG); $result = $this->db->query($sql); if ($result) @@ -606,18 +605,18 @@ class Account extends CommonObject $sql = "SELECT ba.rowid, ba.ref, ba.label, ba.bank, ba.number, ba.courant, ba.clos, ba.rappro, ba.url,"; $sql.= " ba.code_banque, ba.code_guichet, ba.cle_rib, ba.bic, ba.iban_prefix as iban,"; $sql.= " ba.domiciliation, ba.proprio, ba.owner_address, ba.state_id, ba.fk_pays as country_id,"; - $sql.= " ba.account_number, ba.currency_code,"; + $sql.= " ba.account_number, ba.accountancy_journal, ba.currency_code,"; $sql.= " ba.min_allowed, ba.min_desired, ba.comment,"; - $sql.= ' p.code as country_code, p.libelle as country,'; + $sql.= ' c.code as country_code, c.label as country,'; $sql.= ' d.code_departement as state_code, d.nom as state'; $sql.= " FROM ".MAIN_DB_PREFIX."bank_account as ba"; - $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_pays as p ON ba.fk_pays = p.rowid'; + $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c ON ba.fk_pays = c.rowid'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_departements as d ON ba.state_id = d.rowid'; $sql.= " WHERE entity IN (".getEntity($this->element, 1).")"; if ($id) $sql.= " AND ba.rowid = ".$id; if ($ref) $sql.= " AND ba.ref = '".$this->db->escape($ref)."'"; - dol_syslog(get_class($this)."::fetch sql=".$sql); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { @@ -656,6 +655,7 @@ class Account extends CommonObject $this->country = $obj->country; $this->account_number = $obj->account_number; + $this->accountancy_journal = $obj->accountancy_journal; $this->currency_code = $obj->currency_code; $this->account_currency_code = $obj->currency_code; @@ -691,7 +691,7 @@ class Account extends CommonObject $sql.= " WHERE rowid = ".$this->rowid; $sql.= " AND entity = ".$conf->entity; - dol_syslog(get_class($this)."::delete sql=".$sql); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { return 1; @@ -1091,7 +1091,7 @@ class AccountLine extends CommonObject else if ($ref) $sql.= " AND b.rowid='".$this->db->escape($ref)."'"; else $sql.= " AND b.rowid=".$rowid; - dol_syslog(get_class($this)."::fetch sql=".$sql); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { @@ -1166,12 +1166,12 @@ class AccountLine extends CommonObject } $sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_class WHERE lineid=".$this->rowid; - dol_syslog(get_class($this)."::delete sql=".$sql); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); $result = $this->db->query($sql); if (! $result) $nbko++; $sql = "DELETE FROM ".MAIN_DB_PREFIX."bank WHERE rowid=".$this->rowid; - dol_syslog(get_class($this)."::delete sql=".$sql); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); $result = $this->db->query($sql); if (! $result) $nbko++; @@ -1208,7 +1208,7 @@ class AccountLine extends CommonObject $this->db->begin(); $sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_url WHERE fk_bank=".$this->rowid; - dol_syslog(get_class($this)."::delete_urls sql=".$sql); + dol_syslog(get_class($this)."::delete_urls", LOG_DEBUG); $result = $this->db->query($sql); if (! $result) $nbko++; @@ -1242,7 +1242,7 @@ class AccountLine extends CommonObject $sql.= " dateo='".$this->db->idate($this->dateo)."'"; $sql.= " WHERE rowid = ".$this->rowid; - dol_syslog(get_class($this)."::update sql=".$sql); + dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -1253,7 +1253,6 @@ class AccountLine extends CommonObject { $this->db->rollback(); $this->error=$this->db->error(); - dol_syslog(get_class($this)."::update ".$this->error, LOG_ERR); return -1; } } @@ -1276,7 +1275,7 @@ class AccountLine extends CommonObject $sql.= ", fk_user_rappro = ".$user->id; $sql.= " WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::update_conciliation sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::update_conciliation", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -1290,7 +1289,7 @@ class AccountLine extends CommonObject $sql.= ", ".$cat; $sql.= ")"; - dol_syslog(get_class($this)."::update_conciliation sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::update_conciliation", LOG_DEBUG); $resql = $this->db->query($sql); // No error check. Can fail if category already affected diff --git a/htdocs/compta/bank/class/bankcateg.class.php b/htdocs/compta/bank/class/bankcateg.class.php index c4066bae655..a1bc0191175 100644 --- a/htdocs/compta/bank/class/bankcateg.class.php +++ b/htdocs/compta/bank/class/bankcateg.class.php @@ -84,7 +84,7 @@ class BankCateg // extends CommonObject $this->db->begin(); - dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::create", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } @@ -142,7 +142,7 @@ class BankCateg // extends CommonObject $sql.= " WHERE t.rowid = ".$id; $sql.= " AND t.entity = ".$conf->entity; - dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -160,7 +160,6 @@ class BankCateg // extends CommonObject else { $this->error="Error ".$this->db->lasterror(); - dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR); return -1; } } @@ -192,7 +191,7 @@ class BankCateg // extends CommonObject $this->db->begin(); - dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } @@ -249,7 +248,7 @@ class BankCateg // extends CommonObject $this->db->begin(); - dol_syslog(get_class($this)."::delete sql=".$sql); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } diff --git a/htdocs/compta/bank/class/index.html b/htdocs/compta/bank/class/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/compta/bank/fiche.php b/htdocs/compta/bank/fiche.php index bdb30e46528..27acf7eba59 100644 --- a/htdocs/compta/bank/fiche.php +++ b/htdocs/compta/bank/fiche.php @@ -1,8 +1,9 @@ - * Copyright (C) 2003 Jean-Louis Bergamo - * Copyright (C) 2004-2012 Laurent Destailleur - * Copytight (C) 2005-2009 Regis Houssin +/* Copyright (C) 2002-2003 Rodolphe Quiedeville + * Copyright (C) 2003 Jean-Louis Bergamo + * Copyright (C) 2004-2012 Laurent Destailleur + * Copytight (C) 2005-2009 Regis Houssin + * Copytight (C) 2014 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,6 +35,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; $langs->load("banks"); $langs->load("categories"); $langs->load("companies"); +$langs->load("compta"); $action=GETPOST("action"); @@ -55,7 +57,7 @@ if ($_POST["action"] == 'add') $error=0; // Create account - $account = new Account($db,0); + $account = new Account($db); $account->ref = dol_sanitizeFileName(trim($_POST["ref"])); $account->label = trim($_POST["label"]); @@ -65,6 +67,7 @@ if ($_POST["action"] == 'add') $account->url = $_POST["url"]; $account->account_number = trim($_POST["account_number"]); + $account->accountancy_journal = trim($_POST["accountancy_journal"]); $account->solde = $_POST["solde"]; $account->date_solde = dol_mktime(12,0,0,$_POST["remonth"],$_POST["reday"],$_POST["reyear"]); @@ -116,7 +119,7 @@ if ($_POST["action"] == 'update' && ! $_POST["cancel"]) $error=0; // Update account - $account = new Account($db, $_POST["id"]); + $account = new Account($db); $account->fetch($_POST["id"]); $account->ref = dol_string_nospecial(trim($_POST["ref"])); @@ -139,6 +142,7 @@ if ($_POST["action"] == 'update' && ! $_POST["cancel"]) $account->owner_address = trim($_POST["owner_address"]); $account->account_number = trim($_POST["account_number"]); + $account->accountancy_journal = trim($_POST["accountancy_journal"]); $account->currency_code = trim($_POST["account_currency_code"]); @@ -177,7 +181,7 @@ if ($_POST["action"] == 'update' && ! $_POST["cancel"]) } else { - $message='
'.$account->error.'
'; + setEventMessage($account->error, 'errors'); $action='edit'; // Force chargement page edition } } @@ -216,8 +220,6 @@ if ($action == 'create') print_fiche_titre($langs->trans("NewFinancialAccount")); - dol_htmloutput_mesg($message); - if ($conf->use_javascript_ajax) { print "\n".''."\n"; } @@ -412,7 +409,6 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie print '
'; $rowspan=5; - if ($conf->use_javascript_ajax && !empty($conf->global->MAIN_JS_ON_PAYMENT)) $rowspan++; // Payment mode print '\n"; - // Payment amount - if ($conf->use_javascript_ajax && !empty($conf->global->MAIN_JS_ON_PAYMENT)) - { - print ''; - print ''; - print ''; - } - // Cheque number print ''; // Description - print ''; + print ''; // VAT - print ''; + print ''; // Price HT - print ''; + print ''; if ($conf->global->MAIN_FEATURES_LEVEL > 1) print ''; // Qty - print ''; + print ''; // Reduction short - print ''; + print ''; if (! empty($conf->margin->enabled) && empty($user->societe_id)) { @@ -3232,12 +3273,17 @@ abstract class CommonObject if (! $user->rights->margins->liretous) return; - $rounding = min($conf->global->MAIN_MAX_DECIMALS_UNIT,$conf->global->MAIN_MAX_DECIMALS_TOT); + $rounding = min($conf->global->MAIN_MAX_DECIMALS_UNIT, $conf->global->MAIN_MAX_DECIMALS_TOT); $marginInfo = $this->getMarginInfos($force_price); - print '
'; @@ -2122,12 +2155,29 @@ if ($action == 'create' && $user->rights->commande->creer) { } $rowspan = 4; - if ($mysoc->localtax1_assuj == "1") + if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) $rowspan ++; - if ($mysoc->localtax2_assuj == "1") + if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) $rowspan ++; - // Total HT + // Bank Account + print '
'; + print ''; + print '
'; + print $langs->trans('BankAccount'); + print ''; + if ($action != 'editbankaccount' && $user->rights->commande->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 '
' . $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) . '
'.$langs->trans('Comments').'
'.$langs->trans('PaymentMode').''; @@ -438,24 +434,6 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie } print "
'.$langs->trans('AmountPayment').''; - if ($action == 'add_paiement') - { - print ''; - print ''; - } - else - { - print ''; - } - print '
'.$langs->trans('Numero'); print ' ('.$langs->trans("ChequeOrTransferNumber").')'; @@ -578,10 +556,8 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie if ($action != 'add_paiement') { - if ($conf->use_javascript_ajax && !empty($conf->global->MAIN_JS_ON_PAYMENT)) - { - print img_picto($langs->trans('AddRemind'),'rightarrow.png','id="'.$objp->facid.'"'); - } + if(!empty($conf->global->FAC_AUTO_FILLJS)) + print img_picto("Auto fill",'rightarrow', "class='AutoFillAmout' data-rowname='".$namef."' data-value='".($sign * $remaintopay)."'"); print ''; print ''; } diff --git a/htdocs/compta/paiement/cheque/class/index.html b/htdocs/compta/paiement/cheque/class/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/compta/paiement/cheque/class/remisecheque.class.php b/htdocs/compta/paiement/cheque/class/remisecheque.class.php index 917c88e0743..39b8f209247 100644 --- a/htdocs/compta/paiement/cheque/class/remisecheque.class.php +++ b/htdocs/compta/paiement/cheque/class/remisecheque.class.php @@ -73,7 +73,7 @@ class RemiseCheque extends CommonObject if ($id) $sql.= " AND bc.rowid = ".$id; if ($ref) $sql.= " AND bc.number = '".$this->db->escape($ref)."'"; - dol_syslog("RemiseCheque::fetch sql=".$sql, LOG_DEBUG); + dol_syslog("RemiseCheque::fetch", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -155,7 +155,7 @@ class RemiseCheque extends CommonObject $sql.= ", ''"; $sql.= ")"; - dol_syslog("RemiseCheque::Create sql=".$sql, LOG_DEBUG); + dol_syslog("RemiseCheque::Create", LOG_DEBUG); $resql = $this->db->query($sql); if ( $resql ) { @@ -172,7 +172,7 @@ class RemiseCheque extends CommonObject $sql.= " SET number='(PROV".$this->id.")'"; $sql.= " WHERE rowid='".$this->id."';"; - dol_syslog("RemiseCheque::Create sql=".$sql, LOG_DEBUG); + dol_syslog("RemiseCheque::Create", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { @@ -192,7 +192,7 @@ class RemiseCheque extends CommonObject $sql.= " AND b.fk_account='".$account_id."'"; if ($limit) $sql.= $this->db->plimit($limit); - dol_syslog("RemiseCheque::Create sql=".$sql, LOG_DEBUG); + dol_syslog("RemiseCheque::Create", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -225,7 +225,7 @@ class RemiseCheque extends CommonObject $sql.= " SET fk_bordereau = ".$this->id; $sql.= " WHERE rowid = ".$lineid; - dol_syslog("RemiseCheque::Create sql=".$sql, LOG_DEBUG); + dol_syslog("RemiseCheque::Create", LOG_DEBUG); $resql = $this->db->query($sql); if (!$resql) { @@ -250,7 +250,6 @@ class RemiseCheque extends CommonObject $this->errno = -1; $this->error=$this->db->lasterror(); $this->errno=$this->db->lasterrno(); - dol_syslog("RemiseCheque::Create Error ".$this->error, LOG_ERR); } if (! $this->errno && ! empty($conf->global->MAIN_DISABLEDRAFTSTATUS)) @@ -351,7 +350,7 @@ class RemiseCheque extends CommonObject $sql.= " AND entity = ".$conf->entity; $sql.= " AND statut = 0"; - dol_syslog("RemiseCheque::Validate sql=".$sql, LOG_DEBUG); + dol_syslog("RemiseCheque::Validate", LOG_DEBUG); $resql = $this->db->query($sql); if ( $resql ) { @@ -410,7 +409,7 @@ class RemiseCheque extends CommonObject $sql.= " WHERE entity = ".$conf->entity; $sql.= " AND number not like '(%'"; - dol_syslog("Remisecheque::getNextNumber sql=".$sql); + dol_syslog("Remisecheque::getNextNumber", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -510,7 +509,7 @@ class RemiseCheque extends CommonObject $sql.= " AND bc.entity = ".$conf->entity; $sql.= " ORDER BY b.dateo ASC, b.rowid ASC"; - dol_syslog("RemiseCheque::generatePdf sql=".$sql, LOG_DEBUG); + dol_syslog("RemiseCheque::generatePdf", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { @@ -705,7 +704,7 @@ class RemiseCheque extends CommonObject $sql.= " SET date_bordereau = ".($date ? $this->db->idate($date) : 'null'); $sql.= " WHERE rowid = ".$this->id; - dol_syslog("RemiseCheque::set_date sql=$sql",LOG_DEBUG); + dol_syslog("RemiseCheque::set_date", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -715,7 +714,6 @@ class RemiseCheque extends CommonObject else { $this->error=$this->db->error(); - dol_syslog("RemiseCheque::set_date ".$this->error,LOG_ERR); return -1; } } @@ -740,7 +738,7 @@ class RemiseCheque extends CommonObject $sql.= " SET number = '".$number."'" ; $sql.= " WHERE rowid = ".$this->id; - dol_syslog("RemiseCheque::set_number sql=$sql",LOG_DEBUG); + dol_syslog("RemiseCheque::set_number", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -750,7 +748,6 @@ class RemiseCheque extends CommonObject else { $this->error=$this->db->error(); - dol_syslog("RemiseCheque::set_number ".$this->error,LOG_ERR); return -1; } } diff --git a/htdocs/compta/paiement/cheque/fiche.php b/htdocs/compta/paiement/cheque/fiche.php index fe396976f10..920a1328a62 100644 --- a/htdocs/compta/paiement/cheque/fiche.php +++ b/htdocs/compta/paiement/cheque/fiche.php @@ -47,8 +47,6 @@ $fieldname = (! empty($ref)?'number':'rowid'); if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'cheque', $id, 'bordereau_cheque','','',$fieldname); -$mesg=''; - $sortfield=GETPOST('sortfield', 'alpha'); $sortorder=GETPOST('sortorder', 'alpha'); $page=GETPOST('page', 'int'); @@ -122,12 +120,12 @@ if ($action == 'setref' && $user->rights->banque->cheque) $result=$object->set_number($user,$number); if ($result < 0) { - $mesg='
'.$object->error.'
'; + setEventMessage($object->error, 'errors'); } } else { - $mesg='
'.$object->error.'
'; + setEventMessage($object->error, 'errors'); } } @@ -337,9 +335,6 @@ else } } - -dol_htmloutput_errors($mesg); - $accounts = array(); if ($action == 'new') @@ -609,7 +604,6 @@ else $sql.= " AND b.fk_bordereau = ".$object->id; $sql.= " ORDER BY $sortfield $sortorder"; - dol_syslog("sql=".$sql); $resql = $db->query($sql); if ($resql) { diff --git a/htdocs/compta/paiement/class/index.html b/htdocs/compta/paiement/class/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index 0eea10bf510..842050c61bc 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -81,7 +81,7 @@ class Paiement extends CommonObject $sql.= ' WHERE p.fk_paiement = c.id'; $sql.= ' AND p.rowid = '.$id; - dol_syslog(get_class($this)."::fetch sql=".$sql); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $result = $this->db->query($sql); if ($result) @@ -161,7 +161,7 @@ class Paiement extends CommonObject $sql = "INSERT INTO ".MAIN_DB_PREFIX."paiement (entity, datec, datep, amount, fk_paiement, num_paiement, note, fk_user_creat)"; $sql.= " VALUES (".$conf->entity.", '".$this->db->idate($now)."', '".$this->db->idate($this->datepaye)."', '".$totalamount."', ".$this->paiementid.", '".$this->num_paiement."', '".$this->db->escape($this->note)."', ".$user->id.")"; - dol_syslog(get_class($this)."::Create insert paiement sql=".$sql); + dol_syslog(get_class($this)."::Create insert paiement", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -177,7 +177,7 @@ class Paiement extends CommonObject $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'paiement_facture (fk_facture, fk_paiement, amount)'; $sql .= ' VALUES ('.$facid.', '. $this->id.', \''.$amount.'\')'; - dol_syslog(get_class($this).'::Create Amount line '.$key.' insert paiement_facture sql='.$sql); + dol_syslog(get_class($this).'::Create Amount line '.$key.' insert paiement_facture', LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -235,7 +235,6 @@ class Paiement extends CommonObject else { $this->error=$this->db->lasterror(); - dol_syslog(get_class($this).'::Create insert paiement_facture error='.$this->error, LOG_ERR); $error++; } } @@ -248,17 +247,14 @@ class Paiement extends CommonObject if (! $error) { // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('PAYMENT_CUSTOMER_CREATE',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } + $result=$this->call_trigger('PAYMENT_CUSTOMER_CREATE', $user); + if ($result < 0) { $error++; } // Fin appel triggers } } else { $this->error=$this->db->lasterror(); - dol_syslog(get_class($this).'::Create insert paiement error='.$this->error, LOG_ERR); $error++; } @@ -363,11 +359,13 @@ class Paiement extends CommonObject if (! $notrigger) { // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('PAYMENT_DELETE',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - // Fin appel triggers + $result=$this->call_trigger('PAYMENT_DELETE', $user); + if ($result < 0) + { + $this->db->rollback(); + return -1; + } + // Fin appel triggers } $this->db->commit(); @@ -516,11 +514,9 @@ class Paiement extends CommonObject if (! $error && ! $notrigger) { // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('PAYMENT_ADD_TO_BANK',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - // Fin appel triggers + $result=$this->call_trigger('PAYMENT_ADD_TO_BANK', $user); + if ($result < 0) { $error++; } + // Fin appel triggers } } else @@ -561,7 +557,7 @@ class Paiement extends CommonObject $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element.' set fk_bank = '.$id_bank; $sql.= ' WHERE rowid = '.$this->id; - dol_syslog(get_class($this).'::update_fk_bank sql='.$sql); + dol_syslog(get_class($this).'::update_fk_bank', LOG_DEBUG); $result = $this->db->query($sql); if ($result) { @@ -589,7 +585,7 @@ class Paiement extends CommonObject $sql.= " SET datep = '".$this->db->idate($date)."'"; $sql.= " WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::update_date sql=".$sql); + dol_syslog(get_class($this)."::update_date", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { @@ -600,7 +596,6 @@ class Paiement extends CommonObject else { $this->error='Error -1 '.$this->db->error(); - dol_syslog(get_class($this)."::update_date ".$this->error, LOG_ERR); return -2; } } @@ -621,7 +616,7 @@ class Paiement extends CommonObject $sql.= " SET num_paiement = '".$this->db->escape($num)."'"; $sql.= " WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::update_num sql=".$sql); + dol_syslog(get_class($this)."::update_num", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { @@ -631,7 +626,6 @@ class Paiement extends CommonObject else { $this->error='Error -1 '.$this->db->error(); - dol_syslog(get_class($this)."::update_num ".$this->error, LOG_ERR); return -2; } } @@ -647,7 +641,7 @@ class Paiement extends CommonObject { $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element.' SET statut = 1 WHERE rowid = '.$this->id; - dol_syslog(get_class($this).'::valide sql='.$sql); + dol_syslog(get_class($this).'::valide', LOG_DEBUG); $result = $this->db->query($sql); if ($result) { @@ -671,7 +665,7 @@ class Paiement extends CommonObject $sql.= ' FROM '.MAIN_DB_PREFIX.'paiement as p'; $sql.= ' WHERE p.rowid = '.$id; - dol_syslog(get_class($this).'::info sql='.$sql); + dol_syslog(get_class($this).'::info', LOG_DEBUG); $result = $this->db->query($sql); if ($result) @@ -734,7 +728,7 @@ class Paiement extends CommonObject else { $this->error=$this->db->error(); - dol_syslog(get_class($this).'::getBillsArray Error '.$this->error.' - sql='.$sql); + dol_syslog(get_class($this).'::getBillsArray Error '.$this->error.' -', LOG_DEBUG); return -1; } } diff --git a/htdocs/compta/paiement/fiche.php b/htdocs/compta/paiement/fiche.php index 97f3fb9d47c..74ec9f4cb69 100644 --- a/htdocs/compta/paiement/fiche.php +++ b/htdocs/compta/paiement/fiche.php @@ -45,8 +45,6 @@ if ($user->societe_id) $socid=$user->societe_id; // TODO ajouter regle pour restreindre acces paiement //$result = restrictedArea($user, 'facture', $id,''); -$mesg=''; - $object = new Paiement($db); @@ -67,7 +65,7 @@ if ($action == 'setnote' && $user->rights->facture->paiement) } else { - $mesg='
'.$object->error.'
'; + setEventMessage($object->error, 'errors'); $db->rollback(); } } @@ -87,7 +85,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->facture-> else { $langs->load("errors"); - $mesg='
'.$langs->trans($object->error).'
'; + setEventMessage($langs->trans($object->error), 'errors'); $db->rollback(); } } @@ -123,7 +121,7 @@ if ($action == 'confirm_valide' && $confirm == 'yes' && $user->rights->facture-> else { $langs->load("errors"); - $mesg='
'.$langs->trans($object->error).'
'; + setEventMessage($langs->trans($object->error), 'errors'); $db->rollback(); } } @@ -134,11 +132,11 @@ if ($action == 'setnum_paiement' && ! empty($_POST['num_paiement'])) $res = $object->update_num($_POST['num_paiement']); if ($res === 0) { - $mesg = '
'.$langs->trans('PaymentNumberUpdateSucceeded').'
'; + setEventMessage($langs->trans('PaymentNumberUpdateSucceeded')); } else { - $mesg = '
'.$langs->trans('PaymentNumberUpdateFailed').'
'; + setEventMessage($langs->trans('PaymentNumberUpdateFailed'), 'errors'); } } @@ -149,11 +147,11 @@ if ($action == 'setdatep' && ! empty($_POST['datepday'])) $res = $object->update_date($datepaye); if ($res === 0) { - $mesg = '
'.$langs->trans('PaymentDateUpdateSucceeded').'
'; + setEventMessage($langs->trans('PaymentDateUpdateSucceeded')); } else { - $mesg = '
'.$langs->trans('PaymentDateUpdateFailed').'
'; + setEventMessage($langs->trans('PaymentDateUpdateFailed'), 'errors'); } } @@ -198,10 +196,6 @@ if ($action == 'valide') } - -dol_htmloutput_mesg($mesg); - - print ''; // Ref diff --git a/htdocs/compta/payment_sc/fiche.php b/htdocs/compta/payment_sc/fiche.php index 3a010bcae37..5c6562b6fc0 100644 --- a/htdocs/compta/payment_sc/fiche.php +++ b/htdocs/compta/payment_sc/fiche.php @@ -211,7 +211,7 @@ $sql.= ' WHERE pf.fk_charge = f.rowid AND f.fk_type = pc.id'; $sql.= ' AND f.entity = '.$conf->entity; $sql.= ' AND pf.rowid = '.$paiement->id; -dol_syslog("compta/payment_sc/fiche.php sql=".$sql); +dol_syslog("compta/payment_sc/fiche.php", LOG_DEBUG); $resql=$db->query($sql); if ($resql) { diff --git a/htdocs/compta/payment_sc/index.html b/htdocs/compta/payment_sc/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 417f4362000..6c0c7c87558 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -279,7 +279,7 @@ class BonPrelevement extends CommonObject $sql.= " WHERE p.rowid = ".$rowid; $sql.= " AND p.entity = ".$conf->entity; - dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $result=$this->db->query($sql); if ($result) { @@ -314,7 +314,6 @@ class BonPrelevement extends CommonObject } else { - dol_syslog(get_class($this)."::Fetch Erreur sql=".$sql, LOG_ERR); return -2; } } @@ -557,8 +556,6 @@ class BonPrelevement extends CommonObject } else { - dol_syslog(get_class($this)."::set_infotrans Erreur 1", LOG_ERR); - dol_syslog($this->db->error()); $error++; } @@ -705,6 +702,7 @@ class BonPrelevement extends CommonObject //if ($banque) $sql.= " AND sr.code_banque = '".$conf->global->PRELEVEMENT_CODE_BANQUE."'"; //if ($agence) $sql.= " AND sr.code_guichet = '".$conf->global->PRELEVEMENT_CODE_GUICHET."'"; + dol_syslog(get_class($this)."::SommeAPrelever"); $resql = $this->db->query($sql); if ( $resql ) @@ -718,7 +716,6 @@ class BonPrelevement extends CommonObject else { $this->error=get_class($this)."::SommeAPrelever Erreur -1 sql=".$this->db->error(); - dol_syslog($this->error, LOG_ERR); return -1; } } @@ -779,7 +776,7 @@ class BonPrelevement extends CommonObject //if ($banque) $sql.= " AND sr.code_banque = '".$conf->global->PRELEVEMENT_CODE_BANQUE."'"; //if ($agence) $sql.= " AND sr.code_guichet = '".$conf->global->PRELEVEMENT_CODE_GUICHET."'"; - dol_syslog(get_class($this)."::Create sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::Create", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -896,7 +893,7 @@ class BonPrelevement extends CommonObject $sql.= " WHERE ref LIKE '".$ref."%'"; $sql.= " AND entity = ".$conf->entity; - dol_syslog(get_class($this)."::Create sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::Create", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) @@ -922,7 +919,7 @@ class BonPrelevement extends CommonObject $sql.= ", '".$this->db->idate($now)."'"; $sql.= ")"; - dol_syslog(get_class($this)."::Create sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::Create", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) @@ -983,7 +980,7 @@ class BonPrelevement extends CommonObject $sql.= ", fk_prelevement_bons = ".$prev_id; $sql.= " WHERE rowid = ".$fac[1]; - dol_syslog(get_class($this)."::Create sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::Create", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) { @@ -1040,7 +1037,7 @@ class BonPrelevement extends CommonObject $sql.= " WHERE rowid = ".$prev_id; $sql.= " AND entity = ".$conf->entity; - dol_syslog(get_class($this)."::Create sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::Create", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) { @@ -1220,8 +1217,7 @@ class BonPrelevement extends CommonObject /** * Generate a withdrawal file. Generation Formats: - * France: CFONB - * Spain: AEB19 (if external module EsAEB is enabled) + * European countries: SEPA * Others: Warning message * File is generated with name this->filename * @@ -1238,76 +1234,10 @@ class BonPrelevement extends CommonObject $this->file = fopen($this->filename,"w"); - // TODO Move code for es and fr into an external module file with selection into setup of prelevement module - $found=0; - // Build file for Spain - if ($mysoc->country_code=='ES') - { - if (! empty($conf->esaeb->enabled)) - { - $found++; - - dol_include_once('/esaeb/class/esaeb19.class.php'); - - //Head - $esaeb19 = new AEB19DocWritter; - $esaeb19->configuraPresentador($this->numero_national_emetteur,$conf->global->ESAEB_SUFIX_PRESENTADOR,$this->raison_sociale,$this->emetteur_code_banque,$this->emetteur_code_guichet); - $idOrdenante = $esaeb19->agregaOrdenante($this->numero_national_emetteur,$conf->global->ESAEB_SUFIX_ORDENANTE,$this->raison_sociale,$this->emetteur_code_banque,$this->emetteur_code_guichet, $this->emetteur_number_key, $this->emetteur_numero_compte); - $this->total = 0; - $sql = "SELECT pl.rowid, pl.fk_soc, pl.client_nom, pl.code_banque, pl.code_guichet, pl.cle_rib, pl.number, pl.amount,"; - $sql.= " f.facnumber, pf.fk_facture"; - $sql.= " FROM"; - $sql.= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,"; - $sql.= " ".MAIN_DB_PREFIX."facture as f,"; - $sql.= " ".MAIN_DB_PREFIX."prelevement_facture as pf"; - $sql.= " WHERE pl.fk_prelevement_bons = ".$this->id; - $sql.= " AND pl.rowid = pf.fk_prelevement_lignes"; - $sql.= " AND pf.fk_facture = f.rowid"; - - //Lines - $i = 0; - $resql=$this->db->query($sql); - if ($resql) - { - $num = $this->db->num_rows($resql); - - $client = new Societe($this->db); - - while ($i < $num) - { - $obj = $this->db->fetch_object($resql); - $client->fetch($obj->fk_soc); - - $esaeb19->agregaRecibo( - $idOrdenante, - $client->idprof1, - $obj->client_nom, - $obj->code_banque, - $obj->code_guichet, - $obj->cle_rib, - $obj->number, - $obj->amount, - "Fra.".$obj->facnumber." ".$obj->amount - ); - - $this->total = $this->total + $obj->amount; - - $i++; - } - } - else - { - $result = -2; - } - - fputs($this->file, $esaeb19->generaRemesa()); - } - } - // Build file for European countries - if (! $found && $mysoc->isInEEC()) + if (! $mysoc->isInEEC()) { $found++; @@ -1330,7 +1260,7 @@ class BonPrelevement extends CommonObject /* * section Debiteur (sepa Debiteurs bloc lines) */ - $sql = "SELECT soc.code_client as code, soc.address, soc.zip, soc.town, soc.datec, p.code as country_code,"; + $sql = "SELECT soc.code_client as code, soc.address, soc.zip, soc.town, soc.datec, c.code as country_code,"; $sql.= " pl.client_nom as nom, pl.code_banque as cb, pl.code_guichet as cg, pl.number as cc, pl.amount as somme,"; $sql.= " f.facnumber as fac, pf.fk_facture as idfac, rib.iban_prefix as iban, rib.bic as bic, rib.rowid as drum"; $sql.= " FROM"; @@ -1338,12 +1268,12 @@ class BonPrelevement extends CommonObject $sql.= " ".MAIN_DB_PREFIX."facture as f,"; $sql.= " ".MAIN_DB_PREFIX."prelevement_facture as pf,"; $sql.= " ".MAIN_DB_PREFIX."societe as soc,"; - $sql.= " ".MAIN_DB_PREFIX."c_pays as p,"; + $sql.= " ".MAIN_DB_PREFIX."c_country as c,"; $sql.= " ".MAIN_DB_PREFIX."societe_rib as rib"; $sql.= " WHERE pl.fk_prelevement_bons = ".$this->id; $sql.= " AND pl.rowid = pf.fk_prelevement_lignes"; $sql.= " AND pf.fk_facture = f.rowid"; - $sql.= " AND soc.fk_pays = p.rowid"; + $sql.= " AND soc.fk_pays = c.rowid"; $sql.= " AND soc.rowid = f.fk_soc"; $sql.= " AND rib.fk_soc = f.fk_soc"; $sql.= " AND rib.default_rib = 1"; @@ -1563,7 +1493,7 @@ class BonPrelevement extends CommonObject * @param string $row_address soc.address AS adr, * @param string $row_zip soc.zip * @param string $row_town soc.town - * @param string $row_country_code p.code AS pays, + * @param string $row_country_code c.code AS country, * @param string $row_cb pl.code_banque AS cb, * @param string $row_cg pl.code_guichet AS cg, * @param string $row_cc pl.number AS cc, @@ -1718,7 +1648,7 @@ class BonPrelevement extends CommonObject $obj = $this->db->fetch_object($resql); // DONNEES BRUTES : par la suite Rows['XXX'] de la requete au dessus - $pays = explode(':', $configuration->global->MAIN_INFO_SOCIETE_COUNTRY); + $country = explode(':', $configuration->global->MAIN_INFO_SOCIETE_COUNTRY); $IdBon = sprintf("%05d", $obj->rowid); $RefBon = $obj->ref; $type = ($nombre == 1) ? 'FRST' : 'RCUR' ; @@ -1743,7 +1673,7 @@ class BonPrelevement extends CommonObject $XML_SEPA_INFO .= ' '.$CrLf; $XML_SEPA_INFO .= ' '.$configuration->global->PRELEVEMENT_RAISON_SOCIALE.''.$CrLf; $XML_SEPA_INFO .= ' '.$CrLf; - $XML_SEPA_INFO .= ' '.$pays[1].''.$CrLf; + $XML_SEPA_INFO .= ' '.$country[1].''.$CrLf; $XML_SEPA_INFO .= ' '.$configuration->global->MAIN_INFO_SOCIETE_ADDRESS.''.$CrLf; $XML_SEPA_INFO .= ' '.$configuration->global->MAIN_INFO_SOCIETE_ZIP.' '.$configuration->global->MAIN_INFO_SOCIETE_TOWN.''.$CrLf; $XML_SEPA_INFO .= ' '.$CrLf; @@ -1761,7 +1691,7 @@ class BonPrelevement extends CommonObject /* $XML_SEPA_INFO .= ' '.$CrLf; $XML_SEPA_INFO .= ' '.$configuration->global->PRELEVEMENT_RAISON_SOCIALE.''.$CrLf; $XML_SEPA_INFO .= ' '.$CrLf; - $XML_SEPA_INFO .= ' '.$pays[1].''.$CrLf; + $XML_SEPA_INFO .= ' '.$country[1].''.$CrLf; $XML_SEPA_INFO .= ' '.$conf->global->MAIN_INFO_SOCIETE_ADDRESS.''.$CrLf; $XML_SEPA_INFO .= ' '.$conf->global->MAIN_INFO_SOCIETE_ZIP.' '.$conf->global->MAIN_INFO_SOCIETE_TOWN.''.$CrLf; $XML_SEPA_INFO .= ' '.$CrLf; diff --git a/htdocs/compta/prelevement/class/index.html b/htdocs/compta/prelevement/class/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index d68aa528122..5dcd09814ad 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -190,7 +190,7 @@ if ($socid) $sql.= " AND f.fk_soc = ".$socid; $sql.= " GROUP BY s.nom, s.rowid"; $sql.= " ORDER BY s.nom, s.rowid"; -dol_syslog("get customer invoices sql=".$sql); +dol_syslog("get customer invoices", LOG_DEBUG); $result = $db->query($sql); if ($result) { $num = $db->num_rows($result); @@ -235,7 +235,7 @@ if ($modecompta != 'CREANCES-DETTES') $sql.= " GROUP BY nom, idp"; $sql.= " ORDER BY nom"; - dol_syslog("get old customer payments not linked to invoices sql=".$sql); + dol_syslog("get old customer payments not linked to invoices", LOG_DEBUG); $result = $db->query($sql); if ($result) { $num = $db->num_rows($result); @@ -320,7 +320,7 @@ print ''; $subtotal_ht = 0; $subtotal_ttc = 0; -dol_syslog("get suppliers invoices sql=".$sql); +dol_syslog("get suppliers invoices", LOG_DEBUG); $result = $db->query($sql); if ($result) { $num = $db->num_rows($result); @@ -401,7 +401,7 @@ $sql.= " AND cs.entity = ".$conf->entity; $sql.= " GROUP BY c.libelle, c.id"; $sql.= " ORDER BY c.libelle, c.id"; -dol_syslog("get social contributions deductible=0 sql=".$sql); +dol_syslog("get social contributions deductible=0", LOG_DEBUG); $result=$db->query($sql); $subtotal_ht = 0; $subtotal_ttc = 0; @@ -478,7 +478,7 @@ else $sql.= " ORDER BY c.libelle, c.id"; } -dol_syslog("get social contributions deductible=1 sql=".$sql); +dol_syslog("get social contributions deductible=1", LOG_DEBUG); $result=$db->query($sql); $subtotal_ht = 0; $subtotal_ttc = 0; @@ -564,7 +564,7 @@ if ($modecompta == 'CREANCES-DETTES') $sql.= " GROUP BY dm"; $sql.= " ORDER BY dm"; - dol_syslog("get vat to pay sql=".$sql); + dol_syslog("get vat to pay", LOG_DEBUG); $result=$db->query($sql); if ($result) { @@ -609,7 +609,7 @@ if ($modecompta == 'CREANCES-DETTES') $sql.= " GROUP BY dm"; $sql.= " ORDER BY dm"; - dol_syslog("get vat received back sql=".$sql); + dol_syslog("get vat received back", LOG_DEBUG); $result=$db->query($sql); if ($result) { @@ -653,7 +653,7 @@ else $sql.= " GROUP BY dm"; $sql.= " ORDER BY dm"; - dol_syslog("get vat really paid sql=".$sql); + dol_syslog("get vat really paid", LOG_DEBUG); $result=$db->query($sql); if ($result) { $num = $db->num_rows($result); @@ -694,7 +694,7 @@ else $sql.= " GROUP BY dm"; $sql.= " ORDER BY dm"; - dol_syslog("get vat really received back sql=".$sql); + dol_syslog("get vat really received back", LOG_DEBUG); $result=$db->query($sql); if ($result) { $num = $db->num_rows($result); diff --git a/htdocs/compta/resultat/index.php b/htdocs/compta/resultat/index.php index b3a42d85a6b..c61c8b76e08 100644 --- a/htdocs/compta/resultat/index.php +++ b/htdocs/compta/resultat/index.php @@ -123,7 +123,7 @@ $sql.= " GROUP BY dm"; $sql.= " ORDER BY dm"; //print $sql; -dol_syslog("get customers invoices sql=".$sql); +dol_syslog("get customers invoices", LOG_DEBUG); $result=$db->query($sql); if ($result) { @@ -157,7 +157,7 @@ if ($modecompta != 'CREANCES-DETTES') $sql.= " GROUP BY dm"; $sql.= " ORDER BY dm"; - dol_syslog("get old customers payments not linked to invoices sql=".$sql); + dol_syslog("get old customers payments not linked to invoices", LOG_DEBUG); $result = $db->query($sql); if ($result) { $num = $db->num_rows($result); @@ -208,7 +208,7 @@ $sql.= " AND f.entity = ".$conf->entity; if ($socid) $sql.= " AND f.fk_soc = ".$socid; $sql.= " GROUP BY dm"; -dol_syslog("get suppliers invoices sql=".$sql); +dol_syslog("get suppliers invoices", LOG_DEBUG); $result=$db->query($sql); if ($result) { @@ -249,7 +249,7 @@ if ($modecompta == 'CREANCES-DETTES') $sql.= " AND f.entity = ".$conf->entity; $sql.= " GROUP BY dm"; - dol_syslog("get vat to pay sql=".$sql); + dol_syslog("get vat to pay", LOG_DEBUG); $result=$db->query($sql); if ($result) { $num = $db->num_rows($result); @@ -280,7 +280,7 @@ if ($modecompta == 'CREANCES-DETTES') $sql.= " AND f.entity = ".$conf->entity; $sql.= " GROUP BY dm"; - dol_syslog("get vat to receive back sql=".$sql); + dol_syslog("get vat to receive back", LOG_DEBUG); $result=$db->query($sql); if ($result) { $num = $db->num_rows($result); @@ -311,7 +311,7 @@ else { $sql.= " AND t.entity = ".$conf->entity; $sql.= " GROUP BY dm"; - dol_syslog("get vat really paid sql=".$sql); + dol_syslog("get vat really paid", LOG_DEBUG); $result=$db->query($sql); if ($result) { $num = $db->num_rows($result); @@ -340,7 +340,7 @@ else { $sql.= " AND t.entity = ".$conf->entity; $sql.= " GROUP BY dm"; - dol_syslog("get vat really received back sql=".$sql); + dol_syslog("get vat really received back", LOG_DEBUG); $result=$db->query($sql); if ($result) { $num = $db->num_rows($result); @@ -390,7 +390,7 @@ else $sql.= " AND cs.entity = ".$conf->entity; $sql.= " GROUP BY c.libelle, dm"; -dol_syslog("get social contributions deductible=0 sql=".$sql); +dol_syslog("get social contributions deductible=0 ", LOG_DEBUG); $result=$db->query($sql); if ($result) { $num = $db->num_rows($result); @@ -440,7 +440,7 @@ else $sql.= " AND cs.entity = ".$conf->entity; $sql.= " GROUP BY c.libelle, dm"; -dol_syslog("get social contributions paid deductible=1 sql=".$sql); +dol_syslog("get social contributions paid deductible=1", LOG_DEBUG); $result=$db->query($sql); if ($result) { $num = $db->num_rows($result); diff --git a/htdocs/compta/salaries/class/index.html b/htdocs/compta/salaries/class/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/compta/salaries/class/paymentsalary.class.php b/htdocs/compta/salaries/class/paymentsalary.class.php index ecf4b16212b..5e728b0cc64 100644 --- a/htdocs/compta/salaries/class/paymentsalary.class.php +++ b/htdocs/compta/salaries/class/paymentsalary.class.php @@ -1,19 +1,20 @@ + * 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 -* 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 . -*/ + * 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/salaries/class/paymentsalary.class.php @@ -114,25 +115,22 @@ class PaymentSalary extends CommonObject $sql.= " WHERE rowid=".$this->id; - dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $this->error="Error ".$this->db->lasterror(); - dol_syslog(get_class($this)."::update ".$this->error, LOG_ERR); return -1; } if (! $notrigger) { - // Start triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('PAYMENT_SALARY_MODIFY',$this,$user,$langs,$conf); - if ($result < 0) { - $error++; $this->errors=$interface->errors; - } - // End triggers + // Call trigger + $result=$this->call_trigger('PAYMENT_SALARY_MODIFY',$user); + if ($result < 0) $error++; + // End call triggers + + //FIXME: Add rollback if trigger fail } return 1; @@ -174,7 +172,7 @@ class PaymentSalary extends CommonObject $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON s.fk_bank = b.rowid"; $sql.= " WHERE s.rowid = ".$id; - dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -209,7 +207,6 @@ class PaymentSalary extends CommonObject else { $this->error="Error ".$this->db->lasterror(); - dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR); return -1; } } @@ -226,28 +223,24 @@ class PaymentSalary extends CommonObject global $conf, $langs; $error=0; + + // Call trigger + $result=$this->call_trigger('PAYMENT_SALARY_DELETE',$user); + if ($result < 0) return -1; + // End call triggers + $sql = "DELETE FROM ".MAIN_DB_PREFIX."payment_salary"; $sql.= " WHERE rowid=".$this->id; - dol_syslog(get_class($this)."::delete sql=".$sql); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $this->error="Error ".$this->db->lasterror(); - dol_syslog(get_class($this)."::delete ".$this->error, LOG_ERR); return -1; } - // Start triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('PAYMENT_SALARY_DELETE',$this,$user,$langs,$conf); - if ($result < 0) { - $error++; $this->errors=$interface->errors; - } - // End triggers - return 1; } @@ -286,6 +279,8 @@ class PaymentSalary extends CommonObject function create($user) { global $conf,$langs; + + $error=0; // Clean parameters $this->amount=price2num(trim($this->amount)); @@ -355,11 +350,10 @@ class PaymentSalary extends CommonObject $sql.= ", ".$conf->entity; $sql.= ")"; - dol_syslog(get_class($this)."::create sql=".$sql); + dol_syslog(get_class($this)."::create", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { - $ok=1; $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."payment_salary"); @@ -395,10 +389,10 @@ class PaymentSalary extends CommonObject else { $this->error=$acc->error; - $ok=0; + $error++; } - if ($ok) + if (! $error) { // Add link 'payment_salary' in bank_url between payment and bank transaction $url=DOL_URL_ROOT.'/compta/salaries/fiche.php?id='; @@ -407,7 +401,7 @@ class PaymentSalary extends CommonObject if ($result <= 0) { $this->error=$acc->error; - $ok=0; + $error++; } } @@ -427,38 +421,25 @@ class PaymentSalary extends CommonObject if ($result <= 0) { $this->error=$acc->error; - $ok=0; + $error++; } } - // Start triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('PAYMENT_SALARY_CREATE',$this,$user,$langs,$conf); - if ($result < 0) { - $error++; $this->errors=$interface->errors; - } - // End triggers - + // Call trigger + $result=$this->call_trigger('PAYMENT_SALARY_CREATE',$user); + if ($result < 0) $error++; + // End call triggers + } - else $ok=0; + else $error++; - if ($ok) + if (! $error) { - if ($ok) - { - $this->db->commit(); - return $this->id; - } - else - { - $this->db->rollback(); - return -3; - } + $this->db->commit(); + return $this->id; } else { - $this->error=$this->db->error(); $this->db->rollback(); return -2; } diff --git a/htdocs/compta/salaries/index.php b/htdocs/compta/salaries/index.php index c7ee207f853..0a4a2d99943 100644 --- a/htdocs/compta/salaries/index.php +++ b/htdocs/compta/salaries/index.php @@ -104,8 +104,6 @@ if ($result) print_barre_liste($langs->trans("SalariesPayments"),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$totalnboflines); - dol_htmloutput_mesg($mesg); - print ''; print '
'.$langs->trans("SuppliersInvoices").'
'; diff --git a/htdocs/compta/sociales/charges.php b/htdocs/compta/sociales/charges.php index 48a8f656959..bce22caaed6 100644 --- a/htdocs/compta/sociales/charges.php +++ b/htdocs/compta/sociales/charges.php @@ -69,7 +69,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes') } else { - $mesg='
'.$chargesociales->error.'
'; + setEventMessage($chargesociales->error, 'errors'); } } @@ -81,22 +81,22 @@ if ($action == 'add' && $user->rights->tax->charges->creer) $dateperiod=@dol_mktime($_POST["periodhour"],$_POST["periodmin"],$_POST["periodsec"],$_POST["periodmonth"],$_POST["periodday"],$_POST["periodyear"]); if (! $dateech) { - $mesg='
'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("DateDue")).'
'; + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("DateDue")), 'errors'); $action = 'create'; } elseif (! $dateperiod) { - $mesg='
'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("Period")).'
'; + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Period")), 'errors'); $action = 'create'; } elseif (! $_POST["actioncode"] > 0) { - $mesg='
'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("Type")).'
'; + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Type")), 'errors'); $action = 'create'; } elseif (! $_POST["amount"]) { - $mesg='
'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("Amount")).'
'; + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Amount")), 'errors'); $action = 'create'; } else @@ -110,13 +110,9 @@ if ($action == 'add' && $user->rights->tax->charges->creer) $chargesociales->amount=$_POST["amount"]; $id=$chargesociales->create($user); - if ($id > 0) + if ($id <= 0) { - //$mesg='
'.$langs->trans("SocialContributionAdded").'
'; - } - else - { - $mesg='
'.$chargesociales->error.'
'; + setEventMessage($chargesociales->error, 'errors'); } } } @@ -128,12 +124,12 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->tax->charges->cr $dateperiod=dol_mktime($_POST["periodhour"],$_POST["periodmin"],$_POST["periodsec"],$_POST["periodmonth"],$_POST["periodday"],$_POST["periodyear"]); if (! $dateech) { - $mesg='
'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("DateDue")).'
'; + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("DateDue")), 'errors'); $action = 'edit'; } elseif (! $dateperiod) { - $mesg='
'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("Period")).'
'; + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Period")), 'errors'); $action = 'edit'; } else @@ -146,13 +142,9 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->tax->charges->cr $chargesociales->periode=$dateperiod; $result=$chargesociales->update($user); - if ($result > 0) + if ($result <= 0) { - //$mesg='
'.$langs->trans("SocialContributionAdded").'
'; - } - else - { - $mesg='
'.$chargesociales->error.'
'; + setEventMessage($chargesociales->error, 'errors'); } } } @@ -176,8 +168,6 @@ if ($action == 'create') print_fiche_titre($langs->trans("NewSocialContribution")); print "
\n"; - dol_htmloutput_mesg($mesg); - $var=false; print ''; @@ -246,8 +236,6 @@ if ($id > 0) if ($result > 0) { - dol_htmloutput_mesg($mesg); - $head=tax_prepare_head($object); dol_fiche_head($head, 'card', $langs->trans("SocialContribution"),0,'bill'); diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php index 6404d9f26c8..09e4ebaef0c 100644 --- a/htdocs/compta/sociales/class/chargesociales.class.php +++ b/htdocs/compta/sociales/class/chargesociales.class.php @@ -74,7 +74,7 @@ class ChargeSociales extends CommonObject $sql.= " WHERE cs.fk_type = c.id"; $sql.= " AND cs.rowid = ".$id; - dol_syslog(get_class($this)."::fetch sql=".$sql); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -137,7 +137,7 @@ class ChargeSociales extends CommonObject $sql.= " ".$conf->entity; $sql.= ")"; - dol_syslog(get_class($this)."::create sql=".$sql); + dol_syslog(get_class($this)."::create", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -192,7 +192,7 @@ class ChargeSociales extends CommonObject if (! $error) { $sql = "DELETE FROM ".MAIN_DB_PREFIX."paiementcharge where fk_charge='".$this->id."'"; - dol_syslog(get_class($this)."::delete sql=".$sql); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) { @@ -204,7 +204,7 @@ class ChargeSociales extends CommonObject if (! $error) { $sql = "DELETE FROM ".MAIN_DB_PREFIX."chargesociales where rowid='".$this->id."'"; - dol_syslog(get_class($this)."::delete sql=".$sql); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) { @@ -243,7 +243,7 @@ class ChargeSociales extends CommonObject $sql.= " periode='".$this->db->idate($this->periode)."'"; $sql.= " WHERE rowid=".$this->id; - dol_syslog(get_class($this)."::update sql=".$sql); + dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -419,7 +419,7 @@ class ChargeSociales extends CommonObject $sql.= ' FROM '.MAIN_DB_PREFIX.$table; $sql.= ' WHERE '.$field.' = '.$this->id; - dol_syslog(get_class($this)."::getSommePaiement sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::getSommePaiement", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -449,7 +449,7 @@ class ChargeSociales extends CommonObject $sql.= " FROM ".MAIN_DB_PREFIX."chargesociales as e"; $sql.= " WHERE e.rowid = ".$id; - dol_syslog(get_class($this)."::info sql=".$sql); + dol_syslog(get_class($this)."::info", LOG_DEBUG); $result=$this->db->query($sql); if ($result) { diff --git a/htdocs/compta/sociales/class/index.html b/htdocs/compta/sociales/class/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php index e89f2a273f8..972fa762b96 100644 --- a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php +++ b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php @@ -116,7 +116,7 @@ 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 sql=".$sql); + dol_syslog(get_class($this)."::create", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -139,7 +139,6 @@ class PaymentSocialContribution extends CommonObject else { $this->error=$this->db->error(); - dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR); $this->db->rollback(); return -1; } @@ -173,7 +172,7 @@ class PaymentSocialContribution extends CommonObject $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON t.fk_bank = b.rowid'; $sql.= " WHERE t.rowid = ".$id." AND t.fk_typepaiement = pt.id"; - dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -209,7 +208,6 @@ class PaymentSocialContribution extends CommonObject else { $this->error="Error ".$this->db->lasterror(); - dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR); return -1; } } @@ -263,7 +261,7 @@ class PaymentSocialContribution extends CommonObject $this->db->begin(); - dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } @@ -321,7 +319,7 @@ class PaymentSocialContribution extends CommonObject $sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_url"; $sql.= " WHERE type='payment_sc' AND url_id=".$this->id; - dol_syslog(get_class($this)."::delete sql=".$sql); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } } @@ -331,7 +329,7 @@ class PaymentSocialContribution extends CommonObject $sql = "DELETE FROM ".MAIN_DB_PREFIX."paiementcharge"; $sql.= " WHERE rowid=".$this->id; - dol_syslog(get_class($this)."::delete sql=".$sql); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } } @@ -560,7 +558,7 @@ class PaymentSocialContribution extends CommonObject { $sql = "UPDATE ".MAIN_DB_PREFIX."paiementcharge SET fk_bank = ".$id_bank." WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::update_fk_bank sql=".$sql); + dol_syslog(get_class($this)."::update_fk_bank", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { @@ -569,7 +567,6 @@ class PaymentSocialContribution extends CommonObject else { $this->error=$this->db->error(); - dol_syslog(get_class($this)."::update_fk_bank ".$this->error, LOG_ERR); return 0; } } diff --git a/htdocs/compta/sociales/index.php b/htdocs/compta/sociales/index.php index e7f0d3a2b1b..022aaf14ff0 100644 --- a/htdocs/compta/sociales/index.php +++ b/htdocs/compta/sociales/index.php @@ -127,10 +127,6 @@ if ($resql) print_barre_liste($langs->trans("SocialContributions"),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$totalnboflines); } - - dol_htmloutput_mesg($mesg); - - if (empty($mysoc->country_id) && empty($mysoc->country_code)) { print '
'; diff --git a/htdocs/compta/stats/cabyprodserv.php b/htdocs/compta/stats/cabyprodserv.php index 2b2ad5be02f..1bc88e176d9 100644 --- a/htdocs/compta/stats/cabyprodserv.php +++ b/htdocs/compta/stats/cabyprodserv.php @@ -212,7 +212,7 @@ if ($modecompta == 'CREANCES-DETTES') $sql.= " GROUP BY p.rowid"; $sql.= " ORDER BY p.ref"; - dol_syslog("cabyprodserv sql=".$sql); + dol_syslog("cabyprodserv", LOG_DEBUG); $result = $db->query($sql); if ($result) { $num = $db->num_rows($result); diff --git a/htdocs/compta/stats/casoc.php b/htdocs/compta/stats/casoc.php index fd4afbfdf01..3535db5594a 100644 --- a/htdocs/compta/stats/casoc.php +++ b/htdocs/compta/stats/casoc.php @@ -250,7 +250,7 @@ $sql.= " GROUP BY s.rowid, s.nom"; $sql.= " ORDER BY s.rowid"; //echo $sql; -dol_syslog("casoc sql=".$sql); +dol_syslog("casoc", LOG_DEBUG); $result = $db->query($sql); if ($result) { $num = $db->num_rows($result); diff --git a/htdocs/compta/tva/class/index.html b/htdocs/compta/tva/class/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/compta/tva/class/tva.class.php b/htdocs/compta/tva/class/tva.class.php index c605c97fed9..4e049594b49 100644 --- a/htdocs/compta/tva/class/tva.class.php +++ b/htdocs/compta/tva/class/tva.class.php @@ -115,32 +115,30 @@ class Tva extends CommonObject $sql.= ")"; - dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG); + 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."tva"); - // Start triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('TVA_CREATE',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - // End triggers + // Call trigger + $result=$this->call_trigger('TVA_CREATE',$user); + if ($result < 0) $error++; + // End call triggers + //FIXME: Add rollback if trigger fail return $this->id; } else { $this->error="Error ".$this->db->lasterror(); - dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR); return -1; } } /** * Update database - * + * * @param User $user User that modify * @param int $notrigger 0=no, 1=yes (no update trigger) * @return int <0 if KO, >0 if OK @@ -178,23 +176,22 @@ class Tva extends CommonObject $sql.= " WHERE rowid=".$this->id; - dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $this->error="Error ".$this->db->lasterror(); - dol_syslog(get_class($this)."::update ".$this->error, LOG_ERR); return -1; } if (! $notrigger) { - // Start triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('TVA_MODIFY',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - // End triggers + // Call trigger + $result=$this->call_trigger('TVA_MODIFY',$user); + if ($result < 0) $error++; + // End call triggers + + //FIXME: Add rollback if trigger fail } return 1; @@ -203,7 +200,7 @@ class Tva extends CommonObject /** * Load object in memory from database - * + * * @param int $id id object * @param User $user User that load * @return int <0 if KO, >0 if OK @@ -233,7 +230,7 @@ class Tva extends CommonObject $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON t.fk_bank = b.rowid"; $sql.= " WHERE t.rowid = ".$id; - dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -265,7 +262,6 @@ class Tva extends CommonObject else { $this->error="Error ".$this->db->lasterror(); - dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR); return -1; } } @@ -273,7 +269,7 @@ class Tva extends CommonObject /** * Delete object in database - * + * * @param User $user User that delete * @return int <0 if KO, >0 if OK */ @@ -283,24 +279,22 @@ class Tva extends CommonObject $error=0; + // Call trigger + $result=$this->call_trigger('TVA_DELETE',$user); + if ($result < 0) return -1; + // End call triggers + $sql = "DELETE FROM ".MAIN_DB_PREFIX."tva"; $sql.= " WHERE rowid=".$this->id; - dol_syslog(get_class($this)."::delete sql=".$sql); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $this->error="Error ".$this->db->lasterror(); - dol_syslog(get_class($this)."::delete ".$this->error, LOG_ERR); return -1; } - // Start triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('TVA_DELETE',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - // End triggers return 1; } @@ -331,7 +325,7 @@ class Tva extends CommonObject /** * Balance of VAT - * + * * @param int $year Year * @return double Amount */ @@ -350,7 +344,7 @@ class Tva extends CommonObject /** * Total of the VAT from invoices emitted by the society. - * + * * @param int $year Year * @return double Amount */ @@ -359,32 +353,30 @@ class Tva extends CommonObject $sql = "SELECT sum(f.tva) as amount"; $sql .= " FROM ".MAIN_DB_PREFIX."facture as f WHERE f.paye = 1"; - if ($year) { $sql .= " AND f.datef >= '".$year."-01-01' AND f.datef <= '".$year."-12-31' "; } $result = $this->db->query($sql); - if ($result) { if ($this->db->num_rows($result)) { $obj = $this->db->fetch_object($result); - return $obj->amount; + $ret = $obj->amount; + $this->db->free($result); + return $ret; } else - { - return 0; + { + $this->db->free($result); + return 0; } - - $this->db->free($result); - } else { - print $this->db->error(); + print $this->db->lasterror(); return -1; } } @@ -400,31 +392,30 @@ class Tva extends CommonObject $sql = "SELECT sum(f.total_tva) as total_tva"; $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f"; - if ($year) { $sql .= " WHERE f.datef >= '".$year."-01-01' AND f.datef <= '".$year."-12-31' "; } - $result = $this->db->query($sql); + $result = $this->db->query($sql); if ($result) { if ($this->db->num_rows($result)) { $obj = $this->db->fetch_object($result); - return $obj->total_tva; + $ret = $obj->total_tva; + $this->db->free($result); + return $ret; } else - { - return 0; + { + $this->db->free($result); + return 0; } - - $this->db->free(); - } else { - print $this->db->error(); + print $this->db->lasterror(); return -1; } } @@ -448,25 +439,24 @@ class Tva extends CommonObject } $result = $this->db->query($sql); - if ($result) { if ($this->db->num_rows($result)) { $obj = $this->db->fetch_object($result); - return $obj->amount; + $ret = $obj->amount; + $this->db->free($result); + return $ret; } else - { - return 0; + { + $this->db->free($result); + return 0; } - - $this->db->free(); - } else { - print $this->db->error(); + print $this->db->lasterror(); return -1; } } @@ -491,7 +481,7 @@ class Tva extends CommonObject $this->fk_bank=trim($this->fk_bank); $this->fk_user_creat=trim($this->fk_user_creat); $this->fk_user_modif=trim($this->fk_user_modif); - + // Check parameters if (! $this->label) { @@ -539,18 +529,21 @@ class Tva extends CommonObject $sql.= ", ".$conf->entity; $sql.= ")"; - dol_syslog(get_class($this)."::addPayment sql=".$sql); + dol_syslog(get_class($this)."::addPayment", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."tva"); // TODO should be called paiementtva - // Start triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('TVA_ADDPAYMENT',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - // End triggers + // Call trigger + //XXX: Should be done just befor commit no ? + $result=$this->call_trigger('TVA_ADDPAYMENT',$user); + if ($result < 0) + { + $this->id = 0; + $ok = 0; + } + // End call triggers if ($this->id > 0) { @@ -599,7 +592,6 @@ class Tva extends CommonObject } else { - $this->error=$this->db->error(); $this->db->rollback(); return -2; } diff --git a/htdocs/compta/tva/reglement.php b/htdocs/compta/tva/reglement.php index c10f7f4509c..9bb4337782e 100644 --- a/htdocs/compta/tva/reglement.php +++ b/htdocs/compta/tva/reglement.php @@ -102,8 +102,6 @@ if ($result) print_barre_liste($langs->trans("VATPayments"),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$totalnboflines); - dol_htmloutput_mesg($mesg); - print ''; print '
'; diff --git a/htdocs/conf/conf.php.example b/htdocs/conf/conf.php.example index 990a10c2500..32adc4b87c9 100644 --- a/htdocs/conf/conf.php.example +++ b/htdocs/conf/conf.php.example @@ -12,8 +12,8 @@ //################### // dolibarr_main_url_root -// This parameter defines the root URL of your Dolibarr index.php page. -// It must link to the htdocs directory htdocs. +// This parameter defines the root URL of your Dolibarr index.php page without ending "/". +// It must link to the directory htdocs. // In most cases, this is autodetected but it's still required // * to show full url bookmarks for some services (ie: agenda rss export url, ...) // * or when using Apache dir aliases (autodetect fails) diff --git a/htdocs/conf/index.html b/htdocs/conf/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/contact/canvas/actions_contactcard_common.class.php b/htdocs/contact/canvas/actions_contactcard_common.class.php index a2612e51e47..3cb150b8432 100644 --- a/htdocs/contact/canvas/actions_contactcard_common.class.php +++ b/htdocs/contact/canvas/actions_contactcard_common.class.php @@ -450,7 +450,7 @@ abstract class ActionsContactCardCommon // We set country_id, and country_code label of the chosen country if ($this->object->country_id) { - $sql = "SELECT code, libelle FROM ".MAIN_DB_PREFIX."c_pays WHERE rowid = ".$this->object->country_id; + $sql = "SELECT code, label FROM ".MAIN_DB_PREFIX."c_country WHERE rowid = ".$this->object->country_id; $resql=$this->db->query($sql); if ($resql) { @@ -460,9 +460,9 @@ abstract class ActionsContactCardCommon { dol_print_error($this->db); } - $this->object->country_id = $langs->trans("Country".$obj->code)?$langs->trans("Country".$obj->code):$obj->libelle; + $this->object->country_id = $langs->trans("Country".$obj->code)?$langs->trans("Country".$obj->code):$obj->label; $this->object->country_code = $obj->code; - $this->object->country = $langs->trans("Country".$obj->code)?$langs->trans("Country".$obj->code):$obj->libelle; + $this->object->country = $langs->trans("Country".$obj->code)?$langs->trans("Country".$obj->code):$obj->label; } } diff --git a/htdocs/contact/canvas/default/index.html b/htdocs/contact/canvas/default/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/contact/canvas/default/index.php b/htdocs/contact/canvas/default/index.php deleted file mode 100644 index 7db0dd9ebf9..00000000000 --- a/htdocs/contact/canvas/default/index.php +++ /dev/null @@ -1 +0,0 @@ -Url not available \ No newline at end of file diff --git a/htdocs/contact/canvas/default/tpl/index.html b/htdocs/contact/canvas/default/tpl/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/contact/canvas/default/tpl/index.php b/htdocs/contact/canvas/default/tpl/index.php deleted file mode 100644 index 7db0dd9ebf9..00000000000 --- a/htdocs/contact/canvas/default/tpl/index.php +++ /dev/null @@ -1 +0,0 @@ -Url not available \ No newline at end of file diff --git a/htdocs/contact/canvas/index.html b/htdocs/contact/canvas/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/contact/canvas/index.php b/htdocs/contact/canvas/index.php deleted file mode 100644 index 7db0dd9ebf9..00000000000 --- a/htdocs/contact/canvas/index.php +++ /dev/null @@ -1 +0,0 @@ -Url not available \ No newline at end of file diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 4187de7136c..878ee1fa956 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -155,7 +155,7 @@ class Contact extends CommonObject $sql.= " ".(! empty($this->import_key)?"'".$this->import_key."'":"null"); $sql.= ")"; - dol_syslog(get_class($this)."::create sql=".$sql); + dol_syslog(get_class($this)."::create", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -183,12 +183,10 @@ class Contact extends CommonObject if (! $error) { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('CONTACT_CREATE',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('CONTACT_CREATE',$user); + if ($result < 0) { $error++; } + // End call triggers } if (! $error) @@ -251,7 +249,7 @@ class Contact extends CommonObject $sql = "UPDATE ".MAIN_DB_PREFIX."socpeople SET "; if ($this->socid > 0) $sql .= " fk_soc='".$this->db->escape($this->socid)."',"; else if ($this->socid == -1) $sql .= " fk_soc=null,"; - $sql .= " civilite='".$this->db->escape($this->civility_id)."'"; + $sql .= " civility='".$this->db->escape($this->civility_id)."'"; $sql .= ", lastname='".$this->db->escape($this->lastname)."'"; $sql .= ", firstname='".$this->db->escape($this->firstname)."'"; $sql .= ", address='".$this->db->escape($this->address)."'"; @@ -276,7 +274,7 @@ class Contact extends CommonObject $sql .= ", no_email=".($this->no_email?"'".$this->no_email."'":"0"); $sql .= " WHERE rowid=".$this->db->escape($id); - dol_syslog(get_class($this)."::update sql=".$sql,LOG_DEBUG); + dol_syslog(get_class($this)."::update", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { @@ -304,12 +302,10 @@ class Contact extends CommonObject if (! $error && ! $notrigger) { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('CONTACT_MODIFY',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('CONTACT_MODIFY',$user); + if ($result < 0) { $error++; } + // End call triggers } if (! $error) @@ -319,7 +315,6 @@ class Contact extends CommonObject } else { - $this->error=join(',',$this->errors); dol_syslog(get_class($this)."::update Error ".$this->error,LOG_ERR); $this->db->rollback(); return -$error; @@ -328,7 +323,6 @@ class Contact extends CommonObject else { $this->error=$this->db->lasterror().' sql='.$sql; - dol_syslog(get_class($this)."::update Error ".$this->error,LOG_ERR); $this->db->rollback(); return -1; } @@ -444,7 +438,7 @@ class Contact extends CommonObject if ($user) $sql .= ", fk_user_modif=".$user->id; $sql.= " WHERE rowid=".$this->db->escape($id); - dol_syslog(get_class($this)."::update_perso this->birthday=".$this->birthday." - sql=".$sql); + dol_syslog(get_class($this)."::update_perso this->birthday=".$this->birthday." -", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { @@ -504,7 +498,7 @@ class Contact extends CommonObject $langs->load("companies"); - $sql = "SELECT c.rowid, c.fk_soc, c.ref_ext, c.civilite as civility_id, c.lastname, c.firstname,"; + $sql = "SELECT c.rowid, c.fk_soc, c.ref_ext, c.civility as civility_id, c.lastname, c.firstname,"; $sql.= " c.address, c.statut, c.zip, c.town,"; $sql.= " c.fk_pays as country_id,"; $sql.= " c.fk_departement,"; @@ -512,18 +506,18 @@ class Contact extends CommonObject $sql.= " c.poste, c.phone, c.phone_perso, c.phone_mobile, c.fax, c.email, c.jabberid, c.skype,"; $sql.= " c.priv, c.note_private, c.note_public, c.default_lang, c.no_email, c.canvas,"; $sql.= " c.import_key,"; - $sql.= " p.libelle as country, p.code as country_code,"; + $sql.= " co.label as country, co.code as country_code,"; $sql.= " d.nom as state, d.code_departement as state_code,"; $sql.= " u.rowid as user_id, u.login as user_login,"; $sql.= " s.nom as socname, s.address as socaddress, s.zip as soccp, s.town as soccity, s.default_lang as socdefault_lang"; $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as c"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_pays as p ON c.fk_pays = p.rowid"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON c.fk_pays = co.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as d ON c.fk_departement = d.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON c.rowid = u.fk_socpeople"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON c.fk_soc = s.rowid"; $sql.= " WHERE c.rowid = ". $id; - dol_syslog(get_class($this)."::fetch sql=".$sql); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -599,7 +593,6 @@ class Contact extends CommonObject else { $this->error=$this->db->error(); - dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR); return -1; } @@ -624,7 +617,6 @@ class Contact extends CommonObject else { $this->error=$this->db->error(); - dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR); return -1; } } @@ -640,7 +632,6 @@ class Contact extends CommonObject else { $this->error=$this->db->error(); - dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR); return -1; } } @@ -664,7 +655,7 @@ class Contact extends CommonObject $sql.=" AND fk_socpeople = ". $this->id; $sql.=" GROUP BY tc.element"; - dol_syslog(get_class($this)."::load_ref_elements sql=".$sql); + dol_syslog(get_class($this)."::load_ref_elements", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) @@ -685,7 +676,6 @@ class Contact extends CommonObject else { $this->error=$this->db->error()." - ".$sql; - dol_syslog(get_class($this)."::load_ref_elements Error ".$this->error, LOG_ERR); return -1; } } @@ -716,7 +706,7 @@ class Contact extends CommonObject $sql.= " WHERE ec.fk_socpeople=".$this->id; $sql.= " AND ec.fk_c_type_contact=tc.rowid"; $sql.= " AND tc.source='external'"; - dol_syslog(get_class($this)."::delete sql=".$sql); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -729,7 +719,7 @@ class Contact extends CommonObject $sqldel = "DELETE FROM ".MAIN_DB_PREFIX."element_contact"; $sqldel.=" WHERE rowid = ".$obj->rowid; - dol_syslog(get_class($this)."::delete sql=".$sqldel); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); $result = $this->db->query($sqldel); if (! $result) { @@ -751,14 +741,13 @@ class Contact extends CommonObject { // Remove category $sql = "DELETE FROM ".MAIN_DB_PREFIX."categorie_contact WHERE fk_socpeople = ".$this->id; - dol_syslog(get_class($this)."::delete sql=".$sql); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) { $error++; $this->error .= $this->db->lasterror(); $errorflag=-1; - dol_syslog(get_class($this)."::delete error ".$errorflag." ".$this->error, LOG_ERR); } } @@ -766,7 +755,7 @@ class Contact extends CommonObject { $sql = "DELETE FROM ".MAIN_DB_PREFIX."socpeople"; $sql .= " WHERE rowid=".$this->id; - dol_syslog(get_class($this)."::delete sql=".$sql); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); $result = $this->db->query($sql); if (! $result) { @@ -783,14 +772,10 @@ class Contact extends CommonObject if (! $error && ! $notrigger) { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('CONTACT_DELETE',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - // Fin appel triggers - - if ($error) $this->error=join(',',$this->errors); + // Call trigger + $result=$this->call_trigger('CONTACT_DELETE',$user); + if ($result < 0) { $error++; } + // End call triggers } if (! $error) @@ -866,7 +851,7 @@ class Contact extends CommonObject $sql.= " WHERE mc.email = '".$this->db->escape($this->email)."'"; $sql.= " AND mc.statut NOT IN (-1,0)"; // -1 erreur, 0 non envoye, 1 envoye avec succes - dol_syslog(get_class($this)."::getNbOfEMailings sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::getNbOfEMailings", LOG_DEBUG); $resql=$this->db->query($sql); @@ -926,7 +911,7 @@ class Contact extends CommonObject $code=(! empty($this->civility_id)?$this->civility_id:(! empty($this->civility_id)?$this->civility_id:'')); if (empty($code)) return ''; - return $langs->getLabelFromKey($this->db, "Civility".$code, "c_civilite", "code", "civilite", $code); + return $langs->getLabelFromKey($this->db, "Civility".$code, "c_civility", "code", "label", $code); } /** @@ -1070,15 +1055,13 @@ class Contact extends CommonObject $sql.= " WHERE rowid = ".$this->id; $result = $this->db->query($sql); - dol_syslog(get_class($this)."::setstatus sql=".$sql); + dol_syslog(get_class($this)."::setstatus", LOG_DEBUG); if ($result) { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('CONTACT_ENABLEDISABLE',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('CONTACT_ENABLEDISABLE',$user); + if ($result < 0) { $error++; } + // End call triggers } if ($error) diff --git a/htdocs/contact/class/index.html b/htdocs/contact/class/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/contact/fiche.php b/htdocs/contact/fiche.php index 9cb52738bb8..4f793fe8538 100644 --- a/htdocs/contact/fiche.php +++ b/htdocs/contact/fiche.php @@ -138,19 +138,30 @@ if (empty($reshook)) if ($action == 'disable') { $object->fetch($id); - $object->setstatus(0); - header("Location: ".$_SERVER['PHP_SELF'].'?id='.$id); - exit; + if ($object->setstatus(0)<0) + { + setEventMessage($object->error,'errors'); + } + else + { + header("Location: ".$_SERVER['PHP_SELF'].'?id='.$id); + exit; + } } // Confirmation activation if ($action == 'enable') { $object->fetch($id); - $object->setstatus(1); - header("Location: ".$_SERVER['PHP_SELF'].'?id='.$id); - exit; - + if ($object->setstatus(1)<0) + { + setEventMessage($object->error,'errors'); + } + else + { + header("Location: ".$_SERVER['PHP_SELF'].'?id='.$id); + exit; + } } // Add contact @@ -235,7 +246,8 @@ if (empty($reshook)) } else { - $error=$object->error; $errors=$object->errors; + setEventMessage($object->error,'errors'); + setEventMessage($object->errors,'errors'); } } @@ -295,7 +307,8 @@ if (empty($reshook)) } else { - $error=$object->error; $errors=$object->errors; + setEventMessage($object->error,'errors'); + setEventMessage($object->errors,'errors'); $action = 'edit'; } } @@ -367,6 +380,8 @@ else $title = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses")); dol_fiche_head($head, 'card', $title, 0, 'contact'); + + dol_htmloutput_events(); } if ($user->rights->societe->contact->creer) @@ -424,42 +439,45 @@ else print '
'; // Name - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; // Company if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) { if ($socid > 0) { - print ''; + print ''; print ''; - print ''; + print ''; print ''; } else { - print ''; } } // Civility - print ''; - print ''; + print ''; + print ''; $colspan=3; if ($conf->use_javascript_ajax && $socid > 0) $colspan=2; // Address if (($objsoc->typent_code == 'TE_PRIVATE' || ! empty($conf->global->CONTACT_USE_COMPANY_ADDRESS)) && dol_strlen(trim($object->address)) == 0) $object->address = $objsoc->address; // Predefined with third party - print ''; + print ''; + print ''; if ($conf->use_javascript_ajax && $socid > 0) { @@ -475,13 +493,13 @@ else // Zip / Town if (($objsoc->typent_code == 'TE_PRIVATE' || ! empty($conf->global->CONTACT_USE_COMPANY_ADDRESS)) && dol_strlen(trim($object->zip)) == 0) $object->zip = $objsoc->zip; // Predefined with third party if (($objsoc->typent_code == 'TE_PRIVATE' || ! empty($conf->global->CONTACT_USE_COMPANY_ADDRESS)) && dol_strlen(trim($object->town)) == 0) $object->town = $objsoc->town; // Predefined with third party - print ''; // Country - print ''; @@ -489,7 +507,7 @@ else // State if (empty($conf->global->SOCIETE_DISABLE_STATE)) { - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; if (($objsoc->typent_code == 'TE_PRIVATE' || ! empty($conf->global->CONTACT_USE_COMPANY_ADDRESS)) && dol_strlen(trim($object->fax)) == 0) $object->fax = $objsoc->fax; // Predefined with third party - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; // EMail if (($objsoc->typent_code == 'TE_PRIVATE' || ! empty($conf->global->CONTACT_USE_COMPANY_ADDRESS)) && dol_strlen(trim($object->email)) == 0) $object->email = $objsoc->email; // Predefined with third party - print ''; + print ''; + print ''; if (! empty($conf->mailing->enabled)) { - print ''; + print ''; + print ''; } else { @@ -524,16 +548,18 @@ else print ''; // Instant message and no email - print ''; + print ''; + print ''; // Skype if (! empty($conf->skype->enabled)) { - print ''; + print ''; + print ''; } // Visibility - print ''; @@ -555,7 +581,7 @@ else print '
'.$langs->trans("Lastname").' / '.$langs->trans("Label").'lastname).'">'.$langs->trans("Firstname").'firstname).'">
lastname).'" autofocus="autofocus">firstname).'">
'.$langs->trans("Company").'
'; print $objsoc->getNomUrl(1); print '
'.$langs->trans("Company").''; + print '
'; print $form->select_company($socid,'socid','',1); print '
'.$langs->trans("UserTitle").''; + print '
'; print $formcompany->select_civility(GETPOST("civility_id",'alpha')?GETPOST("civility_id",'alpha'):$object->civility_id); print '
'.$langs->trans("PostOrFunction").'poste).'">
poste).'">
'.$langs->trans("Address"); - print '
'.$langs->trans("Zip").' / '.$langs->trans("Town").''; + print '
/ '; print $formcompany->select_ziptown((GETPOST("zipcode")?GETPOST("zipcode"):$object->zip),'zipcode',array('town','selectcountry_id','state_id'),6).' '; print $formcompany->select_ziptown((GETPOST("town")?GETPOST("town"):$object->town),'town',array('zipcode','selectcountry_id','state_id')); print '
'.$langs->trans("Country").''; + print '
'; print $form->select_country((GETPOST("country_id",'alpha')?GETPOST("country_id",'alpha'):$object->country_id),'country_id'); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); print '
'.$langs->trans('State').''; + print '
'; if ($object->country_id) { print $formcompany->select_state(GETPOST("state_id",'alpha')?GETPOST("state_id",'alpha'):$object->state_id,$object->country_code,'state_id'); @@ -503,19 +521,25 @@ else // Phone / Fax if (($objsoc->typent_code == 'TE_PRIVATE' || ! empty($conf->global->CONTACT_USE_COMPANY_ADDRESS)) && dol_strlen(trim($object->phone_pro)) == 0) $object->phone_pro = $objsoc->phone; // Predefined with third party - print '
'.$langs->trans("PhonePro").'phone_pro).'">'.$langs->trans("PhonePerso").'phone_perso).'">
phone_pro).'">phone_perso).'">
'.$langs->trans("PhoneMobile").'phone_mobile).'">'.$langs->trans("Fax").'fax).'">
phone_mobile).'">fax).'">
'.$langs->trans("Email").'email).'">
email).'">'.$langs->trans("No_Email").''.$form->selectyesno('no_email',(GETPOST("no_email",'alpha')?GETPOST("no_email",'alpha'):$object->no_email), 1).''.$form->selectyesno('no_email',(GETPOST("no_email",'alpha')?GETPOST("no_email",'alpha'):$object->no_email), 1).'
'.$langs->trans("IM").'jabberid).'">
jabberid).'">
'.$langs->trans("Skype").'skype).'">
skype).'">
'.$langs->trans("ContactVisibility").''; + print '
'; $selectarray=array('0'=>$langs->trans("ContactPublic"),'1'=>$langs->trans("ContactPrivate")); print $form->selectarray('priv',$selectarray,(GETPOST("priv",'alpha')?GETPOST("priv",'alpha'):$object->priv),0); print '
'; // Date To Birth - print ''; - print ''; + print ''; } else { - print ''; + print ''; } print ''; @@ -649,13 +675,15 @@ else print ''; // Lastname - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; // Company if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) { - print ''; + print ''; print ''; @@ -663,15 +691,16 @@ else } // Civility - print ''; - print ''; + print ''; + print ''; // Address - print ''; + print ''; + print ''; $rowspan=3; if (empty($conf->global->SOCIETE_DISABLE_STATE)) $rowspan++; @@ -681,13 +710,13 @@ else print ''; // Zip / Town - print ''; // Country - print ''; @@ -695,20 +724,25 @@ else // State if (empty($conf->global->SOCIETE_DISABLE_STATE)) { - print ''; } // Phone - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; // EMail - print ''; + print ''; + print ''; if (! empty($conf->mailing->enabled)) { $langs->load("mails"); @@ -722,10 +756,12 @@ else print ''; // Jabberid - print ''; + print ''; + print ''; if (! empty($conf->mailing->enabled)) { - print ''; + print ''; + print ''; } else { @@ -736,23 +772,24 @@ else // Skype if (! empty($conf->skype->enabled)) { - print ''; + print ''; + print ''; } // Visibility - print ''; // Note Public - print ''; // Note Private - print ''; diff --git a/htdocs/contact/index.html b/htdocs/contact/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/contact/index.php b/htdocs/contact/index.php deleted file mode 100644 index 7db0dd9ebf9..00000000000 --- a/htdocs/contact/index.php +++ /dev/null @@ -1 +0,0 @@ -Url not available \ No newline at end of file diff --git a/htdocs/contact/ldap.php b/htdocs/contact/ldap.php index 1681324323a..fe3098eaa9a 100644 --- a/htdocs/contact/ldap.php +++ b/htdocs/contact/ldap.php @@ -49,8 +49,6 @@ $contact->fetch($id, $user); if ($action == 'dolibarr2ldap') { - $message=""; - $db->begin(); $ldap=new Ldap(); @@ -64,12 +62,12 @@ if ($action == 'dolibarr2ldap') if ($result >= 0) { - $message.='
'.$langs->trans("ContactSynchronized").'
'; + setEventMessage($langs->trans("ContactSynchronized")); $db->commit(); } else { - $message.='
'.$ldap->error.'
'; + setEventMessage($ldap->error, 'errors'); $db->rollback(); } } @@ -136,10 +134,6 @@ print '
'.$langs->trans("DateToBirth").''; + print '
'; $form=new Form($db); if ($object->birthday) { @@ -567,14 +593,14 @@ else } print ''.$langs->trans("Alert").': '; + print ': '; if ($object->birthday_alert) { - print '
'.$langs->trans("Lastname").' / '.$langs->trans("Label").'lastname).'">'.$langs->trans("Firstname").'firstname).'">
lastname).'" autofocus="autofocus">firstname).'">
'.$langs->trans("Company").'
'; print $form->select_company(GETPOST('socid','int')?GETPOST('socid','int'):($object->socid?$object->socid:-1),'socid','',1); print '
'.$langs->trans("UserTitle").''; + print '
'; print $formcompany->select_civility(isset($_POST["civility_id"])?$_POST["civility_id"]:$object->civility_id); print '
'.$langs->trans("PostOrFunction").'poste).'">
poste).'">
'.$langs->trans("Address"); - print '
'.$langs->trans("Zip").' / '.$langs->trans("Town").''; + print '
/ '; print $formcompany->select_ziptown((isset($_POST["zipcode"])?$_POST["zipcode"]:$object->zip),'zipcode',array('town','selectcountry_id','state_id'),6).' '; print $formcompany->select_ziptown((isset($_POST["town"])?$_POST["town"]:$object->town),'town',array('zipcode','selectcountry_id','state_id')); print '
'.$langs->trans("Country").''; + print '
'; print $form->select_country(isset($_POST["country_id"])?$_POST["country_id"]:$object->country_id,'country_id'); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); print '
'.$langs->trans('State').''; + print '
'; print $formcompany->select_state($object->state_id,isset($_POST["country_id"])?$_POST["country_id"]:$object->country_id,'state_id'); print '
'.$langs->trans("PhonePro").'phone_pro).'">'.$langs->trans("PhonePerso").'phone_perso).'">
phone_pro).'">phone_perso).'">
'.$langs->trans("PhoneMobile").'phone_mobile).'">'.$langs->trans("Fax").'fax).'">
phone_mobile).'">fax).'">
'.$langs->trans("EMail").'email).'">
email).'">
'.$langs->trans("Jabberid").'jabberid).'">
jabberid).'">'.$langs->trans("No_Email").''.$form->selectyesno('no_email',(isset($_POST["no_email"])?$_POST["no_email"]:$object->no_email), 1).''.$form->selectyesno('no_email',(isset($_POST["no_email"])?$_POST["no_email"]:$object->no_email), 1).'
'.$langs->trans("Skype").'skype).'">
skype).'">
'.$langs->trans("ContactVisibility").''; + print '
'; $selectarray=array('0'=>$langs->trans("ContactPublic"),'1'=>$langs->trans("ContactPrivate")); print $form->selectarray('priv',$selectarray,$object->priv,0); print '
'.$langs->trans("NotePublic").''; + print '
'; $doleditor = new DolEditor('note_public', $object->note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70); print $doleditor->Create(1); print '
'.$langs->trans("NotePrivate").''; + print '
'; $doleditor = new DolEditor('note_private', $object->note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70); print $doleditor->Create(1); print '
'; print ''; - -dol_htmloutput_mesg($message); - - /* * Barre d'actions */ diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index fadabea88c1..d8e21b8cc4c 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -124,9 +124,9 @@ $formother=new FormOther($db); $sql = "SELECT s.rowid as socid, s.nom as name,"; $sql.= " p.rowid as cidp, p.lastname as lastname, p.statut, p.firstname, p.poste, p.email, p.skype,"; $sql.= " p.phone, p.phone_mobile, p.fax, p.fk_pays, p.priv, p.tms,"; -$sql.= " cp.code as country_code"; +$sql.= " co.code as country_code"; $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as p"; -$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_pays as cp ON cp.rowid = p.fk_pays"; +$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 (!$user->rights->societe->client->voir && !$socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc"; @@ -239,7 +239,7 @@ else } //print $sql; -dol_syslog("contact/list.php sql=".$sql); +dol_syslog("contact/list.php", LOG_DEBUG); $result = $db->query($sql); if ($result) { diff --git a/htdocs/contrat/admin/contract_extrafields.php b/htdocs/contrat/admin/contract_extrafields.php index 227ef23f741..afb86224151 100644 --- a/htdocs/contrat/admin/contract_extrafields.php +++ b/htdocs/contrat/admin/contract_extrafields.php @@ -39,7 +39,7 @@ $extrafields = new ExtraFields($db); $form = new Form($db); // List of supported format -$tmptype2label=getStaticMember(get_class($extrafields),'type2label'); +$tmptype2label=ExtraFields::$type2label; $type2label=array(''); foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val); diff --git a/htdocs/contrat/admin/index.html b/htdocs/contrat/admin/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 1c23eb62be5..d42db357ffe 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -4,7 +4,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2008 Raphael Bertrand - * Copyright (C) 2010-2013 Juanjo Menent + * Copyright (C) 2010-2014 Juanjo Menent * Copyright (C) 2013 Christophe Battarel * Copyright (C) 2013 Florian Henry * @@ -44,6 +44,8 @@ class Contrat extends CommonObject var $id; var $ref; + var $ref_ext; + var $ref_customer; var $socid; var $societe; // Objet societe var $statut=0; // 0=Draft, @@ -154,16 +156,14 @@ class Contrat extends CommonObject $sql.= " commentaire = '".$this->db->escape($comment)."'"; $sql.= " WHERE rowid = ".$line_id . " AND (statut = 0 OR statut = 3 OR statut = 5)"; - dol_syslog(get_class($this)."::active_line sql=".$sql); + dol_syslog(get_class($this)."::active_line", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('CONTRACT_SERVICE_ACTIVATE',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('CONTRACT_SERVICE_ACTIVATE',$user); + if ($result < 0) { $error++; $this->db->rollback(); return -1; } + // End call triggers $this->db->commit(); return 1; @@ -171,7 +171,6 @@ class Contrat extends CommonObject else { $this->error=$this->db->lasterror(); - dol_syslog(get_class($this)."::active_line error ".$this->error, LOG_ERR); $this->db->rollback(); return -1; } @@ -206,12 +205,10 @@ class Contrat extends CommonObject $resql = $this->db->query($sql); if ($resql) { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('CONTRACT_SERVICE_CLOSE',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('CONTRACT_SERVICE_CLOSE',$user); + if ($result < 0) { $error++; $this->db->rollback(); return -1; } + // End call triggers $this->db->commit(); return 1; @@ -219,7 +216,6 @@ class Contrat extends CommonObject else { $this->error=$this->db->lasterror(); - dol_syslog(get_class($this)."::close_line error ".$this->error, LOG_ERR); $this->db->rollback(); return -1; } @@ -315,13 +311,13 @@ class Contrat extends CommonObject //$sql.= ", fk_user_valid = ".$user->id.", date_valid = '".$this->db->idate($now)."'"; $sql .= " WHERE rowid = ".$this->id . " AND statut = 0"; - dol_syslog(get_class($this)."::validate sql=".$sql); + dol_syslog(get_class($this)."::validate", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { - dol_syslog(get_class($this)."::validate Echec update - 10 - sql=".$sql, LOG_ERR); dol_print_error($this->db); $error++; + $this->error=$this->db->lasterror(); } if (! $error) @@ -365,12 +361,10 @@ class Contrat extends CommonObject // Trigger calls if (! $error) { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('CONTRACT_VALIDATE',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('CONTRACT_VALIDATE',$user); + if ($result < 0) { $error++; } + // End call triggers } } else @@ -386,7 +380,6 @@ class Contrat extends CommonObject else { $this->db->rollback(); - $this->error=$this->db->lasterror(); return -1; } @@ -408,6 +401,8 @@ class Contrat extends CommonObject $sql.= " fk_projet,"; $sql.= " fk_commercial_signature, fk_commercial_suivi,"; $sql.= " note_private, note_public, extraparams"; + $sql.= " ,ref_customer"; + $sql.= " ,ref_ext"; $sql.= " FROM ".MAIN_DB_PREFIX."contrat"; if ($ref) { @@ -416,7 +411,7 @@ class Contrat extends CommonObject } else $sql.= " WHERE rowid=".$id; - dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -426,6 +421,8 @@ class Contrat extends CommonObject { $this->id = $result["rowid"]; $this->ref = (!isset($result["ref"]) || !$result["ref"]) ? $result["rowid"] : $result["ref"]; + $this->ref_customer = $result["ref_customer"]; + $this->ref_ext = $result["ref_ext"]; $this->statut = $result["statut"]; $this->mise_en_service = $this->db->jdate($result["datemise"]); $this->date_contrat = $this->db->jdate($result["datecontrat"]); @@ -513,7 +510,7 @@ class Contrat extends CommonObject $sql.= " WHERE d.fk_contrat = ".$this->id ." AND d.fk_product = p.rowid"; $sql.= " ORDER by d.rowid ASC"; - dol_syslog(get_class($this)."::fetch_lines sql=".$sql); + dol_syslog(get_class($this)."::fetch_lines", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { @@ -726,7 +723,7 @@ class Contrat extends CommonObject // Insert contract $sql = "INSERT INTO ".MAIN_DB_PREFIX."contrat (datec, fk_soc, fk_user_author, date_contrat,"; $sql.= " fk_commercial_signature, fk_commercial_suivi, fk_projet,"; - $sql.= " ref, entity, note_private, note_public)"; + $sql.= " ref, entity, note_private, note_public, ref_customer, ref_ext)"; $sql.= " VALUES ('".$this->db->idate($now)."',".$this->socid.",".$user->id; $sql.= ", '".$this->db->idate($this->date_contrat)."'"; $sql.= ",".($this->commercial_signature_id>0?$this->commercial_signature_id:"NULL"); @@ -736,6 +733,8 @@ class Contrat extends CommonObject $sql.= ", ".$conf->entity; $sql.= ", ".(!empty($this->note_private)?("'".$this->db->escape($this->note_private)."'"):"NULL"); $sql.= ", ".(!empty($this->note_public)?("'".$this->db->escape($this->note_public)."'"):"NULL"); + $sql.= ", ".(!empty($this->ref_customer)?("'".$this->db->escape($this->ref_customer)."'"):"NULL"); + $sql.= ", ".(!empty($this->ref_ext)?("'".$this->db->escape($this->ref_ext)."'"):"NULL"); $sql.= ")"; $resql=$this->db->query($sql); if ($resql) @@ -744,13 +743,28 @@ class Contrat extends CommonObject $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."contrat"); - // Mise a jour ref - $sql = 'UPDATE '.MAIN_DB_PREFIX."contrat SET ref='(PROV".$this->id.")' WHERE rowid=".$this->id; - if ($this->db->query($sql)) + + // Load object modContract + $module=(! empty($conf->global->CONTRACT_ADDON)?$conf->global->CONTRACT_ADDON:'mod_contract_olive'); + if (substr($module, 0, 13) == 'mod_contract_' && substr($module, -3) == 'php') { - if ($this->id) + $module = substr($module, 0, dol_strlen($module)-4); + } + $result=dol_include_once('/core/modules/contract/'.$module.'.php'); + if ($result > 0) + { + $modCodeContract = new $module(); + } + + if (!empty($modCodeContract->code_auto)) { + // Mise a jour ref + $sql = 'UPDATE '.MAIN_DB_PREFIX."contrat SET ref='(PROV".$this->id.")' WHERE rowid=".$this->id; + if ($this->db->query($sql)) { - $this->ref="(PROV".$this->id.")"; + if ($this->id) + { + $this->ref="(PROV".$this->id.")"; + } } } @@ -777,12 +791,10 @@ class Contrat extends CommonObject if (! $error) { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('CONTRACT_CREATE',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('CONTRACT_CREATE',$user); + if ($result < 0) { $error++; } + // End call triggers if (! $error) { @@ -797,7 +809,6 @@ class Contrat extends CommonObject } else { - $this->error=$interface->error; dol_syslog(get_class($this)."::create - 30 - ".$this->error, LOG_ERR); $this->db->rollback(); @@ -815,8 +826,7 @@ class Contrat extends CommonObject } else { - $this->error=$langs->trans("UnknownError: ".$this->db->error()." - sql=".$sql); - dol_syslog(get_class($this)."::create - 10 - ".$this->error, LOG_ERR); + $this->error=$langs->trans("UnknownError: ".$this->db->error()." -", LOG_DEBUG); $this->db->rollback(); return -1; @@ -839,6 +849,11 @@ class Contrat extends CommonObject $this->db->begin(); + // Call trigger + $result=$this->call_trigger('CONTRACT_DELETE',$user); + if ($result < 0) { $error++; } + // End call triggers + if (! $error) { // Delete linked contacts @@ -862,7 +877,7 @@ class Contrat extends CommonObject $sql.= " FROM ".MAIN_DB_PREFIX."contratdet_log as cdl, ".MAIN_DB_PREFIX."contratdet as cd"; $sql.= " WHERE cdl.fk_contratdet=cd.rowid AND cd.fk_contrat=".$this->id; - dol_syslog(get_class($this)."::delete contratdet_log sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::delete contratdet_log", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) { @@ -883,7 +898,7 @@ class Contrat extends CommonObject $sql= "DELETE FROM ".MAIN_DB_PREFIX."contratdet_log "; $sql.= " WHERE ".MAIN_DB_PREFIX."contratdet_log.rowid IN (".implode(",",$tab_resql).")"; - dol_syslog(get_class($this)."::delete contratdet_log sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::delete contratdet_log", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) { @@ -899,7 +914,7 @@ class Contrat extends CommonObject $sql = "DELETE FROM ".MAIN_DB_PREFIX."contratdet"; $sql.= " WHERE fk_contrat=".$this->id; - dol_syslog(get_class($this)."::delete contratdet sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::delete contratdet", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) { @@ -914,7 +929,7 @@ class Contrat extends CommonObject $sql = "DELETE FROM ".MAIN_DB_PREFIX."contrat"; $sql.= " WHERE rowid=".$this->id; - dol_syslog(get_class($this)."::delete contrat sql=".$sql); + dol_syslog(get_class($this)."::delete contrat", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) { @@ -923,18 +938,6 @@ class Contrat extends CommonObject } } - if (! $error) - { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('CONTRACT_DELETE',$this,$user,$langs,$conf); - if ($result < 0) { - $error++; $this->errors=$interface->errors; - } - // Fin appel triggers - } - if (! $error) { // We remove directory @@ -961,13 +964,110 @@ class Contrat extends CommonObject } else { - $this->error=$this->db->error(); - dol_syslog(get_class($this)."::delete ERROR ".$this->error, LOG_ERR); + $this->error=$this->db->lasterror(); $this->db->rollback(); return -1; } } + /** + * Update object into database + * + * @param User $user User that modifies + * @param int $notrigger 0=launch triggers after, 1=disable triggers + * @return int <0 if KO, >0 if OK + */ + function update($user=0, $notrigger=0) + { + global $conf, $langs; + $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_ext)) $this->ref_ext=trim($this->ref_ext); + if (isset($this->entity)) $this->entity=trim($this->entity); + if (isset($this->statut)) $this->statut=trim($this->statut); + if (isset($this->fk_soc)) $this->fk_soc=trim($this->fk_soc); + if (isset($this->fk_projet)) $this->fk_projet=trim($this->fk_projet); + if (isset($this->fk_commercial_signature)) $this->fk_commercial_signature=trim($this->fk_commercial_signature); + if (isset($this->fk_commercial_suivi)) $this->fk_commercial_suivi=trim($this->fk_commercial_suivi); + if (isset($this->fk_user_mise_en_service)) $this->fk_user_mise_en_service=trim($this->fk_user_mise_en_service); + if (isset($this->fk_user_cloture)) $this->fk_user_cloture=trim($this->fk_user_cloture); + if (isset($this->note_private)) $this->note_private=trim($this->note_private); + if (isset($this->note_public)) $this->note_public=trim($this->note_public); + 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.= " 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_ext=".(isset($this->ref_ext)?"'".$this->db->escape($this->ref_ext)."'":"null").","; + $sql.= " entity=".$conf->entity.","; + $sql.= " date_contrat=".(dol_strlen($this->date_contrat)!=0 ? "'".$this->db->idate($this->date_contrat)."'" : 'null').","; + $sql.= " statut=".(isset($this->statut)?$this->statut:"null").","; + $sql.= " mise_en_service=".(dol_strlen($this->mise_en_service)!=0 ? "'".$this->db->idate($this->mise_en_service)."'" : 'null').","; + $sql.= " fin_validite=".(dol_strlen($this->fin_validite)!=0 ? "'".$this->db->idate($this->fin_validite)."'" : 'null').","; + $sql.= " date_cloture=".(dol_strlen($this->date_cloture)!=0 ? "'".$this->db->idate($this->date_cloture)."'" : 'null').","; + $sql.= " fk_soc=".(isset($this->fk_soc)?$this->fk_soc:"null").","; + $sql.= " fk_projet=".(isset($this->fk_projet)?$this->fk_projet:"null").","; + $sql.= " fk_commercial_signature=".(isset($this->fk_commercial_signature)?$this->fk_commercial_signature:"null").","; + $sql.= " fk_commercial_suivi=".(isset($this->fk_commercial_suivi)?$this->fk_commercial_suivi:"null").","; + $sql.= " fk_user_mise_en_service=".(isset($this->fk_user_mise_en_service)?$this->fk_user_mise_en_service:"null").","; + $sql.= " fk_user_cloture=".(isset($this->fk_user_cloture)?$this->fk_user_cloture:"null").","; + $sql.= " note_private=".(isset($this->note_private)?"'".$this->db->escape($this->note_private)."'":"null").","; + $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(); + + $resql = $this->db->query($sql); + if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } + + 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_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) + { + foreach($this->errors as $errmsg) + { + dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR); + $this->error.=($this->error?', '.$errmsg:$errmsg); + } + $this->db->rollback(); + return -1*$error; + } + else + { + $this->db->commit(); + return 1; + } + } + /** * Ajoute une ligne de contrat en base @@ -1030,7 +1130,7 @@ class Contrat extends CommonObject // 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,$mysoc); + $localtaxes_type=getLocalTaxesFromRate($txtva, 0, $this->societe, $mysoc); $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, 1,'', $localtaxes_type); $total_ht = $tabprice[0]; @@ -1089,7 +1189,7 @@ class Contrat extends CommonObject if ($date_end > 0) { $sql.= ",'".$this->db->idate($date_end)."'"; } $sql.= ")"; - dol_syslog(get_class($this)."::addline sql=".$sql); + dol_syslog(get_class($this)."::addline", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) @@ -1097,12 +1197,20 @@ class Contrat extends CommonObject $result=$this->update_statut($user); if ($result > 0) { + // Call trigger + $result=$this->call_trigger('LINECONTRACT_CREATE',$user); + if ($result < 0) + { + $this->db->rollback(); + return -1; + } + // End call triggers + $this->db->commit(); return 1; } else { - dol_syslog("Error sql=$sql, error=".$this->error,LOG_ERR); $this->db->rollback(); return -1; } @@ -1111,7 +1219,6 @@ class Contrat extends CommonObject { $this->db->rollback(); $this->error=$this->db->error()." sql=".$sql; - dol_syslog(get_class($this)."::addline ".$this->error,LOG_ERR); return -1; } } @@ -1178,7 +1285,7 @@ class Contrat extends CommonObject // 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($tvatx,0,$mysoc); + $localtaxes_type=getLocalTaxesFromRate($tvatx, 0, $this->societe, $mysoc); $tabprice=calcul_price_total($qty, $pu, $remise_percent, $tvatx, $localtaxtx1, $txlocaltaxtx2, 0, $price_base_type, $info_bits, 1, '', $localtaxes_type); $total_ht = $tabprice[0]; @@ -1236,13 +1343,22 @@ class Contrat extends CommonObject else { $sql.=",date_cloture=null"; } $sql .= " WHERE rowid = ".$rowid; - dol_syslog(get_class($this)."::updateline sql=".$sql); + dol_syslog(get_class($this)."::updateline", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { $result=$this->update_statut($user); if ($result >= 0) { + // Call trigger + $result=$this->call_trigger('LINECONTRACT_UPDATE',$user); + if ($result < 0) + { + $this->db->rollback(); + return -3; + } + // End call triggers + $this->db->commit(); return 1; } @@ -1277,25 +1393,27 @@ class Contrat extends CommonObject if ($this->statut >= 0) { + + // Call trigger + $result=$this->call_trigger('LINECONTRACT_DELETE',$user); + if ($result < 0) return -1; + // End call triggers + + $this->db->begin(); + $sql = "DELETE FROM ".MAIN_DB_PREFIX."contratdet"; $sql.= " WHERE rowid=".$idline; - dol_syslog(get_class($this)."::delete sql=".$sql); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $this->error="Error ".$this->db->lasterror(); - dol_syslog(get_class($this)."::delete ".$this->error, LOG_ERR); + $this->db->rollback(); return -1; } - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('LINECONTRACT_DELETE',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - // Fin appel triggers - + $this->db->commit(); return 1; } else @@ -1490,7 +1608,7 @@ class Contrat extends CommonObject $sql.= " WHERE fk_contrat =".$this->id; if ($statut >= 0) $sql.= " AND statut = '$statut'"; - dol_syslog(get_class($this)."::array_detail() sql=".$sql,LOG_DEBUG); + dol_syslog(get_class($this)."::array_detail()", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -1526,7 +1644,7 @@ class Contrat extends CommonObject $sql.= " WHERE fk_soc =".$this->socid; if ($option == 'others') $sql.= " AND c.rowid != ".$this->id; - dol_syslog(get_class($this)."::getOtherContracts() sql=".$sql,LOG_DEBUG); + dol_syslog(get_class($this)."::getOtherContracts()", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -1753,13 +1871,8 @@ class Contrat extends CommonObject /** * Classe permettant la gestion des lignes de contrats */ -class ContratLigne +class ContratLigne 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='contratdet'; //!< Id that identify managed objects - //var $table_element='contratdet'; //!< Name of table without prefix where object is stored var $id; var $ref; @@ -1966,7 +2079,7 @@ class ContratLigne if ($id) $sql.= " WHERE t.rowid = ".$id; if ($ref) $sql.= " WHERE t.rowid = '".$ref."'"; - dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -2019,7 +2132,6 @@ class ContratLigne else { $this->error="Error ".$this->db->lasterror(); - dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR); return -1; } } @@ -2086,6 +2198,8 @@ class ContratLigne $this->pa_ht = $this->subprice * (1 - $this->remise_percent / 100); } + $this->db->begin(); + // Update request $sql = "UPDATE ".MAIN_DB_PREFIX."contratdet SET"; $sql.= " fk_contrat='".$this->fk_contrat."',"; @@ -2121,7 +2235,7 @@ class ContratLigne $sql.= " commentaire='".$this->db->escape($this->commentaire)."'"; $sql.= " WHERE rowid=".$this->id; - dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -2132,20 +2246,19 @@ class ContratLigne else { $this->error="Error ".$this->db->lasterror(); - dol_syslog(get_class($this)."::update ".$this->error, LOG_ERR); + $this->db->rollback(); return -1; } if (! $notrigger) { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('LINECONTRACT_UPDATE',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('LINECONTRACT_UPDATE',$user); + if ($result < 0) { $error++; $this->db->rollback(); return -1; } + // End call triggers } + $this->db->commit(); return 1; } @@ -2169,7 +2282,7 @@ class ContratLigne $sql.= ",total_ttc=".price2num($this->total_ttc,'MT').""; $sql.= " WHERE rowid = ".$this->rowid; - dol_syslog(get_class($this)."::update_total sql=".$sql); + dol_syslog(get_class($this)."::update_total", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) @@ -2180,7 +2293,6 @@ class ContratLigne else { $this->error=$this->db->error(); - dol_syslog(get_class($this)."::update_total Error ".$this->error, LOG_ERR); $this->db->rollback(); return -2; } @@ -2202,7 +2314,7 @@ class ContratLigne if (! $sql) return -1; //print $sql; - dol_syslog(get_class($this)."::get_element_list sql=" . $sql); + dol_syslog(get_class($this)."::get_element_list", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { diff --git a/htdocs/contrat/class/index.html b/htdocs/contrat/class/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/contrat/contact.php b/htdocs/contrat/contact.php index dcec3598e7f..7156b69777c 100644 --- a/htdocs/contrat/contact.php +++ b/htdocs/contrat/contact.php @@ -67,15 +67,14 @@ if ($action == 'addcontact' && $user->rights->contrat->creer) } else { - if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') - { + if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $langs->load("errors"); - $mesg = '
'.$langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType").'
'; - } - else - { - $mesg = '
'.$object->error.'
'; + $msg = $langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"); + } else { + $mesg = $object->error; } + + setEventMessage($mesg, 'errors'); } } @@ -117,8 +116,6 @@ $formcompany= new FormCompany($db); $contactstatic=new Contact($db); $userstatic=new User($db); -dol_htmloutput_mesg($mesg); - /* *************************************************************************** */ /* */ /* Mode vue et edition */ @@ -129,8 +126,6 @@ if ($id > 0 || ! empty($ref)) { if ($object->fetch($id, $ref) > 0) { - dol_htmloutput_mesg($mesg); - $object->fetch_thirdparty(); $head = contract_prepare_head($object); diff --git a/htdocs/contrat/fiche.php b/htdocs/contrat/fiche.php index 7bcd7fcbc8d..38f4ba9a8c4 100644 --- a/htdocs/contrat/fiche.php +++ b/htdocs/contrat/fiche.php @@ -48,6 +48,7 @@ $langs->load("orders"); $langs->load("companies"); $langs->load("bills"); $langs->load("products"); +$langs->load('compta'); $action=GETPOST('action','alpha'); $confirm=GETPOST('confirm','alpha'); @@ -206,6 +207,7 @@ if ($action == 'add' && $user->rights->contrat->creer) $object->fk_project = GETPOST('projectid','int'); $object->remise_percent = GETPOST('remise_percent','alpha'); $object->ref = GETPOST('ref','alpha'); + $object->ref_customer = GETPOST('ref_customer','alpha'); // If creation from another object of another module (Example: origin=propal, originid=1) if ($_POST['origin'] && $_POST['originid']) @@ -275,7 +277,7 @@ if ($action == 'add' && $user->rights->contrat->creer) $outputlangs = $langs; $newlang=''; if (empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id'); - if (empty($newlang)) $newlang=$srcobject->client->default_lang; + if (empty($newlang)) $newlang=$srcobject->thirdparty->default_lang; if (! empty($newlang)) { $outputlangs = new Translate("",$conf); @@ -340,7 +342,7 @@ if ($action == 'add' && $user->rights->contrat->creer) // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost($extralabels, $object); - + $result = $object->create($user); if ($result > 0) { @@ -439,7 +441,7 @@ else if ($action == 'addline' && $user->rights->contrat->creer) $prodcustprice = new Productcustomerprice($db); - $filter = array('t.fk_product' => $prod->id,'t.fk_soc' => $object->client->id); + $filter = array('t.fk_product' => $prod->id,'t.fk_soc' => $object->thirdparty->id); $result = $prodcustprice->fetch_all('', '', 0, 0, $filter); if ($result) { @@ -727,6 +729,36 @@ else if ($action == 'confirm_move' && $confirm == 'yes' && $user->rights->contra $action = 'edit_extras'; setEventMessage($object->error,'errors'); } +} elseif ($action=='setref_customer') { + $result = $object->fetch($id); + if ($result < 0) { + setEventMessage($object->errors,'errors'); + } + $object->ref_customer=GETPOST('ref_customer','alpha'); + + $result = $object->update($user); + if ($result < 0) { + setEventMessage($object->errors,'errors'); + $action='editref_customer'; + } else { + header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); + exit; + } +} elseif ($action=='setref') { + $result = $object->fetch($id); + if ($result < 0) { + setEventMessage($object->errors,'errors'); + } + $object->ref=GETPOST('ref','alpha'); + + $result = $object->update($user); + if ($result < 0) { + setEventMessage($object->errors,'errors'); + $action='editref'; + } else { + header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); + exit; + } } if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->contrat->creer) @@ -801,6 +833,18 @@ $form = new Form($db); $objectlignestatic=new ContratLigne($db); +// Load object modContract +$module=(! empty($conf->global->CONTRACT_ADDON)?$conf->global->CONTRACT_ADDON:'mod_contract_olive'); +if (substr($module, 0, 13) == 'mod_contract_' && substr($module, -3) == 'php') +{ + $module = substr($module, 0, dol_strlen($module)-4); +} +$result=dol_include_once('/core/modules/contract/'.$module.'.php'); +if ($result > 0) +{ + $modCodeContract = new $module(); +} + /********************************************************************* * @@ -861,8 +905,6 @@ if ($action == 'create') $object->date_contrat = dol_now(); - $numct = $object->getNextNumRef($soc); - print ''; print ''; @@ -873,7 +915,16 @@ if ($action == 'create') print ''; // Ref - print ''; + if (! empty($modCodeContract->code_auto)) { + $tmpcode=$langs->trans("Draft"); + } else { + $tmpcode=''; + } + print ''; + + // Ref Int + print ''; + print ''; // Customer print ''; @@ -1019,7 +1070,7 @@ else if ($action == 'valid') { $ref = substr($object->ref, 1, 4); - if ($ref == 'PROV') + if ($ref == 'PROV' && !empty($modCodeContract->code_auto)) { $numref = $object->getNextNumRef($soc); } @@ -1058,9 +1109,27 @@ else $linkback = ''.$langs->trans("BackToList").''; // Ref du contrat - print '"; + if (!empty($modCodeContract->code_auto)) { + print '"; + } else { + print ''; + print ''; + print ''; + } + + print ''; + print ''; + print ''; // Customer print ""; diff --git a/htdocs/contrat/index.php b/htdocs/contrat/index.php index 772b0e1ecdc..680ea9c201f 100644 --- a/htdocs/contrat/index.php +++ b/htdocs/contrat/index.php @@ -312,7 +312,7 @@ $sql.= " GROUP BY c.rowid, c.ref, c.datec, c.tms, c.statut, s.nom, s.rowid"; $sql.= " ORDER BY c.tms DESC"; $sql.= " LIMIT ".$max; -dol_syslog("contrat/index.php sql=".$sql, LOG_DEBUG); +dol_syslog("contrat/index.php", LOG_DEBUG); $result=$db->query($sql); if ($result) { diff --git a/htdocs/contrat/liste.php b/htdocs/contrat/liste.php index e1e49a5d7fd..6bd9e249bc7 100644 --- a/htdocs/contrat/liste.php +++ b/htdocs/contrat/liste.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2010 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2013 Cédric Salvador + * 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 @@ -30,6 +31,7 @@ require_once (DOL_DOCUMENT_ROOT."/contrat/class/contrat.class.php"); $langs->load("contracts"); $langs->load("products"); $langs->load("companies"); +$langs->load("compta"); $sortfield=GETPOST('sortfield','alpha'); $sortorder=GETPOST('sortorder','alpha'); @@ -40,6 +42,7 @@ $offset = $limit * $page ; $search_nom=GETPOST('search_nom'); $search_contract=GETPOST('search_contract'); +$search_ref_customer=GETPOST('search_ref_customer','alpha'); $sall=GETPOST('sall'); $statut=GETPOST('statut')?GETPOST('statut'):1; $socid=GETPOST('socid'); @@ -72,6 +75,7 @@ $sql.= ' SUM('.$db->ifsql("cd.statut=4 AND (cd.date_fin_validite IS NOT NULL AND $sql.= ' SUM('.$db->ifsql("cd.statut=5",1,0).') as nb_closed,'; $sql.= " c.rowid as cid, c.ref, c.datec, c.date_contrat, c.statut,"; $sql.= " s.nom, s.rowid as socid"; +$sql.= " ,c.ref_customer"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= ", ".MAIN_DB_PREFIX."contrat as c"; @@ -86,6 +90,9 @@ if ($search_nom) { if ($search_contract) { $sql .= natural_search(array('c.rowid', 'c.ref'), $search_contract); } +if (!empty($search_ref_customer)) { + $sql .= natural_search(array('c.ref_customer'), $search_ref_customer); +} if ($sall) { $sql .= natural_search(array('s.nom', 'cd.label', 'cd.description'), $sall); } @@ -107,7 +114,9 @@ if ($resql) print ''; $param='&search_contract='.$search_contract; $param.='&search_nom='.$search_nom; + $param.='&search_ref_customer='.$search_ref_customer; print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "c.rowid","","$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("Company"), $_SERVER["PHP_SELF"], "s.nom","","$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); @@ -125,6 +134,9 @@ if ($resql) print ''; print ''; print ''; + print ''; print ''; @@ -144,6 +156,7 @@ if ($resql) 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 ''; + print ''; print ''; //print ''; print ''; diff --git a/htdocs/contrat/note.php b/htdocs/contrat/note.php index 3ac3ca47496..cd782d73444 100644 --- a/htdocs/contrat/note.php +++ b/htdocs/contrat/note.php @@ -64,8 +64,6 @@ $form = new Form($db); if ($id > 0 || ! empty($ref)) { - dol_htmloutput_mesg($mesg); - $object->fetch_thirdparty(); $head = contract_prepare_head($object); diff --git a/htdocs/contrat/services.php b/htdocs/contrat/services.php index 382dcad5e93..2f656d14211 100644 --- a/htdocs/contrat/services.php +++ b/htdocs/contrat/services.php @@ -113,7 +113,7 @@ $sql .= $db->order($sortfield,$sortorder); $sql .= $db->plimit($limit + 1, $offset); //print $sql; -dol_syslog("contrat/services.php sql=".$sql); +dol_syslog("contrat/services.php", LOG_DEBUG); $resql=$db->query($sql); if ($resql) { diff --git a/htdocs/contrat/tpl/index.html b/htdocs/contrat/tpl/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/core/actions_sendmails.inc.php b/htdocs/core/actions_sendmails.inc.php index f13113487c1..337cf59c9b0 100644 --- a/htdocs/core/actions_sendmails.inc.php +++ b/htdocs/core/actions_sendmails.inc.php @@ -26,7 +26,8 @@ // $id must be defined // $actiontypecode must be defined - +// $paramname must be defined +// $mode must be defined /* * Add file in email form @@ -115,6 +116,11 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO $replyto = $_POST['replytoname']. ' <' . $_POST['replytomail'].'>'; $message = $_POST['message']; $sendtocc = $_POST['sendtocc']; + $sendtobcc=''; + if ($mode == 'emailfromproposal') $sendtobcc = (empty($conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO)?'':$conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO); + if ($mode == 'emailfromorder') $sendtobcc = (empty($conf->global->MAIN_MAIL_AUTOCOPY_ORDER_TO)?'':$conf->global->MAIN_MAIL_AUTOCOPY_ORDER_TO); + if ($mode == 'emailfrominvoice') $sendtobcc = (empty($conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO)?'':$conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO); + $deliveryreceipt = $_POST['deliveryreceipt']; if ($action == 'send' || $action == 'relance') @@ -141,7 +147,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO // 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); + $mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,$sendtobcc,$deliveryreceipt,-1); if ($mailfile->error) { $mesgs[]='
'.$mailfile->error.'
'; @@ -229,5 +235,3 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO } } - -?> \ No newline at end of file diff --git a/htdocs/core/actions_setnotes.inc.php b/htdocs/core/actions_setnotes.inc.php index 3b2bbef75bb..74f576cf852 100644 --- a/htdocs/core/actions_setnotes.inc.php +++ b/htdocs/core/actions_setnotes.inc.php @@ -43,5 +43,3 @@ else if ($action == 'setnote_private' && ! empty($permissionnote) && ! GETPOST(' $result=$object->update_note(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES),'_private'); if ($result < 0) setEventMessage($object->error,'errors'); } - -?> \ No newline at end of file diff --git a/htdocs/core/ajax/ajaxdirpreview.php b/htdocs/core/ajax/ajaxdirpreview.php index d1a64f6b256..63641d00ab8 100644 --- a/htdocs/core/ajax/ajaxdirpreview.php +++ b/htdocs/core/ajax/ajaxdirpreview.php @@ -153,7 +153,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'); + $automodules = array('company', 'invoice', 'invoice_supplier', 'propal', 'order', 'order_supplier', 'contract', 'product', 'tax', 'project', 'fichinter', 'user'); // TODO change for multicompany sharing // Auto area for suppliers invoices @@ -184,6 +184,10 @@ if ($type == 'directory') else if ($module == 'tax') $upload_dir = $conf->tax->dir_output; // Auto area for projects else if ($module == 'project') $upload_dir = $conf->projet->dir_output; + // Auto area for interventions + else if ($module == 'fichinter') $upload_dir = $conf->ficheinter->dir_output; + // Auto area for users + else if ($module == 'user') $upload_dir = $conf->user->dir_output; if (in_array($module, $automodules)) { diff --git a/htdocs/core/ajax/index.html b/htdocs/core/ajax/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/core/ajax/index.php b/htdocs/core/ajax/index.php deleted file mode 100644 index 7db0dd9ebf9..00000000000 --- a/htdocs/core/ajax/index.php +++ /dev/null @@ -1 +0,0 @@ -Url not available \ No newline at end of file diff --git a/htdocs/core/ajax/ziptown.php b/htdocs/core/ajax/ziptown.php index 80f6cd9bd63..def98b25ae8 100644 --- a/htdocs/core/ajax/ziptown.php +++ b/htdocs/core/ajax/ziptown.php @@ -63,13 +63,13 @@ if (! empty($_GET['zipcode']) || ! empty($_GET['town'])) if (! empty($conf->global->MAIN_USE_ZIPTOWN_DICTIONNARY)) // Use zip-town table { $sql = "SELECT z.rowid, z.zip, z.town, z.fk_county, z.fk_pays as fk_country"; - $sql.= ", p.rowid as fk_country, p.code as country_code, p.libelle as country"; + $sql.= ", c.rowid as fk_country, c.code as country_code, c.label as country"; $sql.= ", d.rowid as fk_county, d.code_departement as county_code, d.nom as county"; - $sql.= " FROM (".MAIN_DB_PREFIX."c_ziptown as z,".MAIN_DB_PREFIX."c_pays as p)"; + $sql.= " FROM (".MAIN_DB_PREFIX."c_ziptown as z,".MAIN_DB_PREFIX."c_country as c)"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX ."c_departements as d ON z.fk_county = d.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_regions as r ON d.fk_region = r.code_region"; - $sql.= " WHERE z.fk_pays = p.rowid"; - $sql.= " AND z.active = 1 AND p.active = 1"; + $sql.= " WHERE z.fk_pays = c.rowid"; + $sql.= " AND z.active = 1 AND c.active = 1"; if ($zipcode) $sql.=" AND z.zip LIKE '" . $db->escape($zipcode) . "%'"; if ($town) $sql.=" AND z.town LIKE '%" . $db->escape($town) . "%'"; $sql.= " ORDER BY z.zip, z.town"; @@ -78,11 +78,11 @@ if (! empty($_GET['zipcode']) || ! empty($_GET['town'])) else // Use table of third parties { $sql = "SELECT DISTINCT s.zip, s.town, s.fk_departement as fk_county, s.fk_pays as fk_country"; - $sql.= ", p.code as country_code, p.libelle as country"; + $sql.= ", c.code as country_code, c.label as country"; $sql.= ", d.code_departement as county_code , d.nom as county"; $sql.= " FROM ".MAIN_DB_PREFIX.'societe as s'; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX ."c_departements as d ON fk_departement = d.rowid"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX.'c_pays as p ON fk_pays = p.rowid'; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX.'c_country as c ON fk_pays = c.rowid'; $sql.= " WHERE"; if ($zipcode) $sql.= " s.zip LIKE '".$db->escape($zipcode)."%'"; if ($town) $sql.= " s.town LIKE '%" . $db->escape($town) . "%'"; diff --git a/htdocs/core/boxes/box_actions.php b/htdocs/core/boxes/box_actions.php index ff63927b526..ae138ae1422 100644 --- a/htdocs/core/boxes/box_actions.php +++ b/htdocs/core/boxes/box_actions.php @@ -2,6 +2,7 @@ /* Copyright (C) 2003-2007 Rodolphe Quiedeville * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2005-2011 Regis Houssin + * Copyright (C) 2014 Charles-Fr 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 @@ -77,7 +78,7 @@ class box_actions extends ModeleBoxes $sql.= " ORDER BY a.datec DESC"; $sql.= $db->plimit($max, 0); - dol_syslog("Box_actions::loadBox sql=".$sql, LOG_DEBUG); + dol_syslog("Box_actions::loadBox", LOG_DEBUG); $result = $db->query($sql); if ($result) { @@ -151,7 +152,70 @@ class box_actions extends ModeleBoxes */ function showBox($head = null, $contents = null) { + global $langs, $conf; parent::showBox($this->info_box_head, $this->info_box_contents); + if ($conf->global->SHOW_DIALOG_HOMEPAGE) + { + $actioncejour=false; + $contents=$this->info_box_contents; + $nblines=count($contents); + $bcx[0] = 'class="box_pair"'; + $bcx[1] = 'class="box_impair"'; + if ($contents[0][0]['text'] != $langs->trans("NoActionsToDo")) + { + print '
trans("ActionsToDo").'">'; + print '
'.$langs->trans('Ref').''.$langs->trans("Draft").'
'.$langs->trans('Ref').''.$tmpcode.'
'.$langs->trans('RefCustomer').'
'.$langs->trans("Ref").''; - print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', ''); - print "
'.$langs->trans("Ref").''; + print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', ''); + 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); + 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); + print '
".$langs->trans("Customer")."
'; + print ''; + print ''; print ''; print ' '.$obj->ref_customer.''.img_object($langs->trans("ShowCompany"),"company").' '.$obj->nom.''.dol_print_date($obj->datec).''.dol_print_date($db->jdate($obj->date_contrat)).'
'; + for ($i=0, $n=$nblines; $i < $n; $i++) + { + if (isset($contents[$i])) + { + // on affiche que les évènement du jours ou passé + // qui ne sont pas à 100% + $actioncejour=true; + $var=!$var; + // TR + $logo=$contents[$i][0]['logo']; + $label=$contents[$i][1]['text']; + $urlevent=$contents[$i][1]['url']; + $logosoc=$contents[$i][2]['logo']; + $nomsoc=$contents[$i][3]['text']; + $urlsoc=$contents[$i][3]['url']; + $dateligne=$contents[$i][4]['text']; + $percentage=$contents[$i][5]['text']; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + } + } + print '
'; + print img_object("",$logo); + print ''.$label.''.img_object("",$logosoc)." ".$nomsoc.''.$dateligne.''.$percentage.'
'; + + } + print ''; + if ($actioncejour) + { + print ''; + } + else + { + print ''; + } + } } } diff --git a/htdocs/core/boxes/box_activity.php b/htdocs/core/boxes/box_activity.php index 986b6c2c2b9..f37079fa037 100644 --- a/htdocs/core/boxes/box_activity.php +++ b/htdocs/core/boxes/box_activity.php @@ -283,7 +283,7 @@ class box_activity extends ModeleBoxes // Add the sum in the bottom of the boxes $this->info_box_contents[$i][1] = array('td' => 'align="left" ', 'text' => $langs->trans("Total")." ".$textHead); - $this->info_box_contents[$i][2] = array('td' => 'align="right" ', 'text' => price($totalnb,1,$langs,0,0,-1,$conf->currency)); + $this->info_box_contents[$i][2] = array('td' => 'align="right" ', 'text' => $totalnb); $this->info_box_contents[$i][3] = array('td' => 'align="right" ', 'text' => price($totalMnt,1,$langs,0,0,-1,$conf->currency)); $this->info_box_contents[$i][4] = array('td' => 'align="right" ', 'text' => ""); $this->info_box_contents[$i][5] = array('td' => 'align="right"', 'text' => ""); diff --git a/htdocs/core/boxes/box_clients.php b/htdocs/core/boxes/box_clients.php index b2ad0a6b718..12145294d64 100644 --- a/htdocs/core/boxes/box_clients.php +++ b/htdocs/core/boxes/box_clients.php @@ -73,7 +73,7 @@ class box_clients extends ModeleBoxes $sql.= " ORDER BY s.tms DESC"; $sql.= $db->plimit($max, 0); - dol_syslog(get_class($this)."::loadBox sql=".$sql,LOG_DEBUG); + dol_syslog(get_class($this)."::loadBox", LOG_DEBUG); $result = $db->query($sql); if ($result) { diff --git a/htdocs/core/boxes/box_comptes.php b/htdocs/core/boxes/box_comptes.php index 8fdc4aff39e..c66326b27fb 100644 --- a/htdocs/core/boxes/box_comptes.php +++ b/htdocs/core/boxes/box_comptes.php @@ -90,7 +90,7 @@ class box_comptes extends ModeleBoxes $sql.= " ORDER BY label"; $sql.= $db->plimit($max, 0); - dol_syslog(get_class($this)."::loadBox sql=".$sql); + dol_syslog(get_class($this)."::loadBox", LOG_DEBUG); $result = $db->query($sql); if ($result) { diff --git a/htdocs/core/boxes/box_contacts.php b/htdocs/core/boxes/box_contacts.php index 1afc0d09e41..a6fe663087e 100644 --- a/htdocs/core/boxes/box_contacts.php +++ b/htdocs/core/boxes/box_contacts.php @@ -61,7 +61,7 @@ class box_contacts extends ModeleBoxes if ($user->rights->societe->lire) { - $sql = "SELECT sp.rowid, sp.lastname, sp.firstname, sp.civilite as civility_id, sp.datec, sp.tms, sp.fk_soc,"; + $sql = "SELECT sp.rowid, sp.lastname, sp.firstname, sp.civility as civility_id, sp.datec, sp.tms, sp.fk_soc,"; $sql.= " s.nom as socname"; $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON sp.fk_soc = s.rowid"; diff --git a/htdocs/core/boxes/box_factures.php b/htdocs/core/boxes/box_factures.php index 18d276b0130..2e8f94e29ff 100644 --- a/htdocs/core/boxes/box_factures.php +++ b/htdocs/core/boxes/box_factures.php @@ -24,7 +24,6 @@ */ include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php'; - /** * Class to manage the box to show last invoices */ @@ -159,4 +158,3 @@ class box_factures extends ModeleBoxes } } - diff --git a/htdocs/core/boxes/box_ficheinter.php b/htdocs/core/boxes/box_ficheinter.php index 3413548c1fd..32038c61928 100644 --- a/htdocs/core/boxes/box_ficheinter.php +++ b/htdocs/core/boxes/box_ficheinter.php @@ -79,7 +79,7 @@ class box_ficheinter extends ModeleBoxes $sql.= " ORDER BY f.tms DESC"; $sql.= $db->plimit($max, 0); - dol_syslog(get_class($this).'::loadBox sql='.$sql,LOG_DEBUG); + dol_syslog(get_class($this).'::loadBox', LOG_DEBUG); $resql = $db->query($sql); if ($resql) { diff --git a/htdocs/core/boxes/box_graph_invoices_permonth.php b/htdocs/core/boxes/box_graph_invoices_permonth.php index ad7cbc0e29c..b272f350717 100644 --- a/htdocs/core/boxes/box_graph_invoices_permonth.php +++ b/htdocs/core/boxes/box_graph_invoices_permonth.php @@ -104,8 +104,7 @@ class box_graph_invoices_permonth extends ModeleBoxes } else { - include_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php'; - $tmparray=dol_json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode],true); + $tmparray=json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode],true); $endyear=$tmparray['year']; $shownb=$tmparray['shownb']; $showtot=$tmparray['showtot']; @@ -115,11 +114,10 @@ class box_graph_invoices_permonth extends ModeleBoxes if (empty($endyear)) $endyear=$nowarray['year']; $startyear=$endyear-1; $mode='customer'; - $userid=0; $WIDTH=(($shownb && $showtot) || ! empty($conf->dol_optimize_smallscreen))?'256':'320'; $HEIGHT='192'; - $stats = new FactureStats($this->db, 0, $mode, ($userid>0?$userid:0)); + $stats = new FactureStats($this->db, $socid, $mode, 0); // Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...) if ($shownb) @@ -222,7 +220,7 @@ class box_graph_invoices_permonth extends ModeleBoxes $stringtoshow.=' '.$langs->trans("AmountOfBillsByMonthHT"); $stringtoshow.='
'; $stringtoshow.=$langs->trans("Year").' '; - $stringtoshow.=''; + $stringtoshow.=''; $stringtoshow.=''; $stringtoshow.=''; if ($shownb && $showtot) diff --git a/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php b/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php index 58d3a27f834..c882acd40c1 100644 --- a/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php +++ b/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php @@ -103,8 +103,7 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes } else { - include_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php'; - $tmparray=dol_json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode],true); + $tmparray=json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode],true); $endyear=$tmparray['year']; $shownb=$tmparray['shownb']; $showtot=$tmparray['showtot']; @@ -114,11 +113,10 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes if (empty($endyear)) $endyear=$nowarray['year']; $startyear=$endyear-1; $mode='supplier'; - $userid=0; $WIDTH=(($shownb && $showtot) || ! empty($conf->dol_optimize_smallscreen))?'256':'320'; $HEIGHT='192'; - $stats = new FactureStats($this->db, 0, $mode, ($userid>0?$userid:0)); + $stats = new FactureStats($this->db, $socid, $mode, 0); // Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...) if ($shownb) @@ -221,7 +219,7 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes $stringtoshow.=' '.$langs->trans("AmountOfBillsByMonthHT"); $stringtoshow.='
'; $stringtoshow.=$langs->trans("Year").' '; - $stringtoshow.=''; + $stringtoshow.=''; $stringtoshow.=''; $stringtoshow.=''; if ($shownb && $showtot) diff --git a/htdocs/core/boxes/box_graph_orders_permonth.php b/htdocs/core/boxes/box_graph_orders_permonth.php index 81c9185c68f..5084691d321 100644 --- a/htdocs/core/boxes/box_graph_orders_permonth.php +++ b/htdocs/core/boxes/box_graph_orders_permonth.php @@ -104,8 +104,7 @@ class box_graph_orders_permonth extends ModeleBoxes } else { - include_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php'; - $tmparray=dol_json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode],true); + $tmparray=json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode],true); $endyear=$tmparray['year']; $shownb=$tmparray['shownb']; $showtot=$tmparray['showtot']; @@ -115,11 +114,10 @@ class box_graph_orders_permonth extends ModeleBoxes if (empty($endyear)) $endyear=$nowarray['year']; $startyear=$endyear-1; $mode='customer'; - $userid=0; $WIDTH=(($shownb && $showtot) || ! empty($conf->dol_optimize_smallscreen))?'256':'320'; $HEIGHT='192'; - $stats = new CommandeStats($this->db, 0, $mode, ($userid>0?$userid:0)); + $stats = new CommandeStats($this->db, $socid, $mode, 0); // Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...) if ($shownb) @@ -222,7 +220,7 @@ class box_graph_orders_permonth extends ModeleBoxes $stringtoshow.=' '.$langs->trans("AmountOfOrdersByMonthHT"); $stringtoshow.='
'; $stringtoshow.=$langs->trans("Year").' '; - $stringtoshow.=''; + $stringtoshow.=''; $stringtoshow.=''; $stringtoshow.=''; if ($shownb && $showtot) diff --git a/htdocs/core/boxes/box_graph_orders_supplier_permonth.php b/htdocs/core/boxes/box_graph_orders_supplier_permonth.php index 98779836576..f398ae9dcb1 100644 --- a/htdocs/core/boxes/box_graph_orders_supplier_permonth.php +++ b/htdocs/core/boxes/box_graph_orders_supplier_permonth.php @@ -103,8 +103,7 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes } else { - include_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php'; - $tmparray=dol_json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode],true); + $tmparray=json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode],true); $endyear=$tmparray['year']; $shownb=$tmparray['shownb']; $showtot=$tmparray['showtot']; @@ -114,11 +113,10 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes if (empty($endyear)) $endyear=$nowarray['year']; $startyear=$endyear-1; $mode='supplier'; - $userid=0; $WIDTH=(($shownb && $showtot) || ! empty($conf->dol_optimize_smallscreen))?'256':'320'; $HEIGHT='192'; - $stats = new CommandeStats($this->db, 0, $mode, ($userid>0?$userid:0)); + $stats = new CommandeStats($this->db, $socid, $mode, 0); // Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...) if ($shownb) @@ -221,7 +219,7 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes $stringtoshow.=' '.$langs->trans("AmountOfOrdersByMonthHT"); $stringtoshow.='
'; $stringtoshow.=$langs->trans("Year").' '; - $stringtoshow.=''; + $stringtoshow.=''; $stringtoshow.=''; $stringtoshow.=''; if ($shownb && $showtot) diff --git a/htdocs/core/boxes/box_graph_product_distribution.php b/htdocs/core/boxes/box_graph_product_distribution.php index 0029866b75a..74d106b7f69 100644 --- a/htdocs/core/boxes/box_graph_product_distribution.php +++ b/htdocs/core/boxes/box_graph_product_distribution.php @@ -96,8 +96,7 @@ class box_graph_product_distribution extends ModeleBoxes } else { - include_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php'; - $tmparray=dol_json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode],true); + $tmparray=json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode],true); $year=$tmparray['year']; $showinvoicenb=$tmparray['showinvoicenb']; $showpropalnb=$tmparray['showpropalnb']; @@ -337,7 +336,7 @@ class box_graph_product_distribution extends ModeleBoxes } $stringtoshow.='
'; $stringtoshow.=$langs->trans("Year").' '; - $stringtoshow.=''; + $stringtoshow.=''; $stringtoshow.=''; $stringtoshow.=''; diff --git a/htdocs/core/boxes/box_graph_propales_permonth.php b/htdocs/core/boxes/box_graph_propales_permonth.php index 61e83f3cd60..974ccaed446 100644 --- a/htdocs/core/boxes/box_graph_propales_permonth.php +++ b/htdocs/core/boxes/box_graph_propales_permonth.php @@ -104,8 +104,7 @@ class box_graph_propales_permonth extends ModeleBoxes } else { - include_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php'; - $tmparray=dol_json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode],true); + $tmparray=json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode],true); $endyear=$tmparray['year']; $shownb=$tmparray['shownb']; $showtot=$tmparray['showtot']; @@ -114,12 +113,10 @@ class box_graph_propales_permonth extends ModeleBoxes $nowarray=dol_getdate(dol_now(),true); if (empty($endyear)) $endyear=$nowarray['year']; $startyear=$endyear-1; - $mode='customer'; - $userid=0; $WIDTH=(($shownb && $showtot) || ! empty($conf->dol_optimize_smallscreen))?'256':'320'; $HEIGHT='192'; - $stats = new PropaleStats($this->db, 0, $mode, ($userid>0?$userid:0)); + $stats = new PropaleStats($this->db, $socid, 0); // Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...) if ($shownb) @@ -128,8 +125,7 @@ class box_graph_propales_permonth extends ModeleBoxes $datatype1 = array_pad(array(), ($endyear-$startyear+1), 'bars'); $filenamenb = $dir."/".$prefix."propalsnbinyear-".$endyear.".png"; - if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstats&file=propalsnbinyear-'.$endyear.'.png'; - if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstatssupplier&file=propalsnbinyear-'.$endyear.'.png'; + $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstats&file=propalsnbinyear-'.$endyear.'.png'; $px1 = new DolGraph(); $mesg = $px1->isGraphKo(); @@ -227,7 +223,7 @@ class box_graph_propales_permonth extends ModeleBoxes $stringtoshow.=' '.$langs->trans("AmountOfProposalsByMonthHT"); $stringtoshow.='
'; $stringtoshow.=$langs->trans("Year").' '; - $stringtoshow.=''; + $stringtoshow.=''; $stringtoshow.=''; $stringtoshow.=''; if ($shownb && $showtot) diff --git a/htdocs/core/boxes/box_project.php b/htdocs/core/boxes/box_project.php new file mode 100644 index 00000000000..62ed89dd65b --- /dev/null +++ b/htdocs/core/boxes/box_project.php @@ -0,0 +1,155 @@ + + * 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/core/boxes/box_activite.php + * \ingroup projet + * \brief Module to show Projet activity of the current Year + */ +include_once(DOL_DOCUMENT_ROOT."/core/boxes/modules_boxes.php"); + +/** + * Class to manage the box to show last projet + */ +class box_project extends ModeleBoxes +{ + var $boxcode="project"; + var $boximg="object_projectpub"; + var $boxlabel; + //var $depends = array("projet"); + var $db; + var $param; + + var $info_box_head = array(); + var $info_box_contents = array(); + + /** + * \brief Constructeur de la classe + */ + function box_project() + { + global $langs; + $langs->load("boxes"); + $langs->load("projects"); + + $this->boxlabel="Projet"; + } + + /** + * Load data for box to show them later + * + * @param int $max Maximum number of records to load + * @return void + */ + function loadBox($max=5) + { + global $conf, $user, $langs, $db; + + $this->max=$max; + + $totalMnt = 0; + $totalnb = 0; + $totalnbTask=0; + include_once(DOL_DOCUMENT_ROOT."/projet/class/project.class.php"); + require_once(DOL_DOCUMENT_ROOT."/core/lib/project.lib.php"); + $projectstatic=new Project($db); + + + + $textHead = $langs->trans("Projet"); + $this->info_box_head = array('text' => $textHead, 'limit'=> dol_strlen($textHead)); + + // list the summary of the orders + if ($user->rights->projet->lire) + { + + $sql = "SELECT p.rowid, p.ref, p.title, p.fk_statut "; + $sql.= " FROM ".MAIN_DB_PREFIX."projet as p"; + $sql.= " WHERE p.entity = ".$conf->entity; + $sql.= " AND p.fk_statut = 1"; // Seulement les projets ouverts + $sql.= " ORDER BY p.datec DESC"; + $sql.= $db->plimit($max, 0); + + $result = $db->query($sql); + + if ($result) + { + $num = $db->num_rows($result); + $i = 0; + while ($i < $num) + { + $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"','logo' => 'object_projectpub'); + + $objp = $db->fetch_object($result); + $projectstatic->fetch($objp->rowid); + + $this->info_box_contents[$i][1] = array('td' => 'align="left"', + 'text' =>$projectstatic->getNomUrl(1) + ); + + $this->info_box_contents[$i][2] = array('td' => 'align="left"', + 'text' => $objp->title + ); + + $sql ="SELECT count(*) as nb, sum(progress) as totprogress"; + $sql.=" FROM ".MAIN_DB_PREFIX."projet as p LEFT JOIN ".MAIN_DB_PREFIX."projet_task as pt on pt.fk_projet = p.rowid"; + $sql.=" WHERE p.entity = ".$conf->entity; + + $resultTask = $db->query($sql); + if ($resultTask) + { + $objTask = $db->fetch_object($resultTask); + $this->info_box_contents[$i][3] = array('td' => 'align="right"', 'text' => number_format($objTask->nb, 0, ',', ' ')." ".$langs->trans("Tasks")); + if ($objTask->nb > 0 ) + $this->info_box_contents[$i][4] = array('td' => 'align="right"', 'text' => number_format(($objTask->totprogress/$objTask->nb), 0, ',', ' ')."%"); + else + $this->info_box_contents[$i][4] = array('td' => 'align="right"', 'text' => "N/A "); + $totalnbTask += $objTask->nb; + } + else + { + $this->info_box_contents[$i][3] = array('td' => 'align="right"', 'text' => number_format(0, 0, ',', ' ')); + $this->info_box_contents[$i][4] = array('td' => 'align="right"', 'text' => "N/A "); + } + + $i++; + } + } + } + + + // Add the sum à the bottom of the boxes + $this->info_box_contents[$i][0] = array('tr' => 'class="liste_total"', 'td' => 'align="left" ', 'text' => $langs->trans("Total")." ".$textHead); + $this->info_box_contents[$i][1] = array('td' => '', 'text' => ""); + $this->info_box_contents[$i][2] = array('td' => 'align="right" ', 'text' => number_format($num, 0, ',', ' ')." ".$langs->trans("Projects")); + $this->info_box_contents[$i][3] = array('td' => 'align="right" ', 'text' => number_format($totalnbTask, 0, ',', ' ')." ".$langs->trans("Tasks")); + $this->info_box_contents[$i][4] = array('td' => '', 'text' => ""); + + } + + /** + * Method to show box + * + * @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) + { + parent::showBox($this->info_box_head, $this->info_box_contents); + } +} + diff --git a/htdocs/core/boxes/box_prospect.php b/htdocs/core/boxes/box_prospect.php index 9c7a666bc4a..c0234f97dc3 100644 --- a/htdocs/core/boxes/box_prospect.php +++ b/htdocs/core/boxes/box_prospect.php @@ -73,7 +73,7 @@ class box_prospect extends ModeleBoxes $sql.= " ORDER BY s.tms DESC"; $sql.= $db->plimit($max, 0); - dol_syslog(get_class($this)."::loadBox sql=".$sql,LOG_DEBUG); + dol_syslog(get_class($this)."::loadBox", LOG_DEBUG); $resql = $db->query($sql); if ($resql) { diff --git a/htdocs/core/boxes/box_task.php b/htdocs/core/boxes/box_task.php new file mode 100644 index 00000000000..c15bc9831ce --- /dev/null +++ b/htdocs/core/boxes/box_task.php @@ -0,0 +1,143 @@ + + * 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/core/boxes/box_task.php + * \ingroup Projet + * \brief Module to Task activity of the current year + * \version $Id: box_task.php,v 1.1 2012/09/11 Charles-François BENKE + */ + +include_once(DOL_DOCUMENT_ROOT."/core/boxes/modules_boxes.php"); +require_once(DOL_DOCUMENT_ROOT."/core/lib/date.lib.php"); + +/** + * Class to manage the box to show last task + */ +class box_task extends ModeleBoxes +{ + var $boxcode="projet"; + var $boximg="object_projecttask"; + var $boxlabel; + //var $depends = array("projet"); + var $db; + var $param; + + var $info_box_head = array(); + var $info_box_contents = array(); + + /** + * \brief Constructeur de la classe + * + * @return void + */ + function box_task() + { + global $langs; + $langs->load("boxes"); + $langs->load("projects"); + $this->boxlabel="Tasks"; + } + + /** + * Load data for box to show them later + * + * @param int $max Maximum number of records to load + * @return void + */ + function loadBox($max=5) + { + global $conf, $user, $langs, $db; + + $this->max=$max; + + $totalMnt = 0; + $totalnb = 0; + $totalDuree=0; + include_once(DOL_DOCUMENT_ROOT."/projet/class/task.class.php"); + $taskstatic=new Task($db); + + + $textHead = $langs->trans("Tasks")." ".date("Y"); + $this->info_box_head = array('text' => $textHead, 'limit'=> dol_strlen($textHead)); + + // list the summary of the orders + if ($user->rights->projet->lire) + { + + $sql = "SELECT pt.fk_statut, count(pt.rowid) as nb, sum(ptt.task_duration) as durationtot, sum(pt.planned_workload) as plannedtot"; + $sql.= " FROM ".MAIN_DB_PREFIX."projet_task as pt, ".MAIN_DB_PREFIX."projet_task_time as ptt"; + $sql.= " WHERE DATE_FORMAT(pt.datec,'%Y') = ".date("Y")." "; + $sql.= " AND pt.rowid = ptt.fk_task"; + $sql.= " GROUP BY pt.fk_statut "; + $sql.= " ORDER BY pt.fk_statut DESC"; + $sql.= $db->plimit($max, 0); + + $result = $db->query($sql); + + if ($result) + { + $num = $db->num_rows($result); + $i = 0; + while ($i < $num) + { + $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"','logo' => 'object_projecttask'); + + $objp = $db->fetch_object($result); + $this->info_box_contents[$i][1] = array('td' => 'align="left"', + 'text' =>$langs->trans("Task")." ".$taskstatic->LibStatut($objp->fk_statut,0) + ); + + $this->info_box_contents[$i][2] = array('td' => 'align="right"', + 'text' => $objp->nb." ".$langs->trans("Tasks"), + 'url' => DOL_URL_ROOT."/projet/tasks/index.php?leftmenu=projects&viewstatut=".$objp->fk_statut + ); + $totalnb += $objp->nb; + $this->info_box_contents[$i][3] = array('td' => 'align="right"', 'text' => ConvertSecondToTime($objp->plannedtot,'all',25200,5)); + $totalplannedtot += $objp->plannedtot; + $this->info_box_contents[$i][4] = array('td' => 'align="right"', 'text' => ConvertSecondToTime($objp->durationtot,'all',25200,5)); + $totaldurationtot += $objp->durationtot; + + $this->info_box_contents[$i][5] = array('td' => 'align="right" width="18"', 'text' => $taskstatic->LibStatut($objp->fk_statut,3)); + + $i++; + } + } + } + + + // Add the sum à the bottom of the boxes + $this->info_box_contents[$i][0] = array('tr' => 'class="liste_total"', 'td' => 'align="left" ', 'text' => $langs->trans("Total")." ".$textHead); + $this->info_box_contents[$i][1] = array('td' => '', 'text' => ""); + $this->info_box_contents[$i][2] = array('td' => 'align="right" ', 'text' => number_format($totalnb, 0, ',', ' ')." ".$langs->trans("Tasks")); + $this->info_box_contents[$i][3] = array('td' => 'align="right" ', 'text' => ConvertSecondToTime($totalplannedtot,'all',25200,5)); + $this->info_box_contents[$i][4] = array('td' => 'align="right" ', 'text' => ConvertSecondToTime($totaldurationtot,'all',25200,5)); + $this->info_box_contents[$i][5] = array('td' => '', 'text' => ""); + + } + + /** + * Method to show box + * + * @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) + { + parent::showBox($this->info_box_head, $this->info_box_contents); + } +} diff --git a/htdocs/core/boxes/index.html b/htdocs/core/boxes/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/core/boxes/index.php b/htdocs/core/boxes/index.php deleted file mode 100644 index 7db0dd9ebf9..00000000000 --- a/htdocs/core/boxes/index.php +++ /dev/null @@ -1 +0,0 @@ -Url not available \ No newline at end of file diff --git a/htdocs/core/boxes/modules_boxes.php b/htdocs/core/boxes/modules_boxes.php index 7b54f0440a0..ece19fe222c 100644 --- a/htdocs/core/boxes/modules_boxes.php +++ b/htdocs/core/boxes/modules_boxes.php @@ -162,7 +162,7 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty" if (! empty($head['sublink'])) print ''; if (! empty($head['subpicto'])) print img_picto($head['subtext'], $head['subpicto'], 'class="'.(empty($head['subclass'])?'':$head['subclass']).'" id="idsubimg'.$this->boxcode.'"'); if (! empty($head['sublink'])) ''; - if ($conf->use_javascript_ajax) + if (! empty($conf->use_javascript_ajax)) { print '
'; // 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 diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 322d7f7ddcb..a289b43c4a9 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -170,7 +170,7 @@ class CMailFile } } - // Add autocopy to + // Add autocopy to (Note: Adding bcc for specific modules are also done from pages) if (! empty($conf->global->MAIN_MAIL_AUTOCOPY_TO)) $addr_bcc.=($addr_bcc?', ':'').$conf->global->MAIN_MAIL_AUTOCOPY_TO; // Action according to choosed sending method @@ -657,6 +657,7 @@ class CMailFile { $out.= "To: ".$this->getValidAddress($this->addr_to,0,1).$this->eol2; } + // Return-Path is important because it is used by SPF. Some MTA does not read Return-Path from header but from command line. See option MAIN_MAIL_ALLOW_SENDMAIL_F for that. $out.= "Return-Path: ".$this->getValidAddress($this->addr_from,0,1).$this->eol2; if (isset($this->reply_to) && $this->reply_to) $out.= "Reply-To: ".$this->getValidAddress($this->reply_to,2).$this->eol2; if (isset($this->errors_to) && $this->errors_to) $out.= "Errors-To: ".$this->getValidAddress($this->errors_to,2).$this->eol2; diff --git a/htdocs/core/class/cpays.class.php b/htdocs/core/class/ccountry.class.php similarity index 86% rename from htdocs/core/class/cpays.class.php rename to htdocs/core/class/ccountry.class.php index e6db8e4b2e9..088dfaf327b 100644 --- a/htdocs/core/class/cpays.class.php +++ b/htdocs/core/class/ccountry.class.php @@ -16,9 +16,9 @@ */ /** - * \file htdocs/core/class/cpays.class.php + * \file htdocs/core/class/ccountry.class.php * \ingroup core - * \brief This file is a CRUD class file (Create/Read/Update/Delete) for c_pays dictionary + * \brief This file is a CRUD class file (Create/Read/Update/Delete) for c_country dictionary */ // Put here all includes required by your class file @@ -30,18 +30,18 @@ /** * Class to manage dictionary Countries (used by imports) */ -class Cpays // extends CommonObject +class Ccountry // 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='cpays'; //!< Id that identify managed objects - //var $table_element='cpays'; //!< Name of table without prefix where object is stored + //var $element='ccountry'; //!< Id that identify managed objects + //var $table_element='ccountry'; //!< Name of table without prefix where object is stored var $id; var $code; var $code_iso; - var $libelle; + var $label; var $active; @@ -74,36 +74,36 @@ class Cpays // extends CommonObject // Clean parameters if (isset($this->code)) $this->code=trim($this->code); if (isset($this->code_iso)) $this->code_iso=trim($this->code_iso); - if (isset($this->libelle)) $this->libelle=trim($this->libelle); + if (isset($this->label)) $this->label=trim($this->label); if (isset($this->active)) $this->active=trim($this->active); // Check parameters // Put here code to add control on parameters values // Insert request - $sql = "INSERT INTO ".MAIN_DB_PREFIX."c_pays("; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."c_country("; $sql.= "rowid,"; $sql.= "code,"; $sql.= "code_iso,"; - $sql.= "libelle,"; + $sql.= "label,"; $sql.= "active"; $sql.= ") VALUES ("; $sql.= " ".(! isset($this->rowid)?'NULL':"'".$this->rowid."'").","; $sql.= " ".(! isset($this->code)?'NULL':"'".$this->db->escape($this->code)."'").","; $sql.= " ".(! isset($this->code_iso)?'NULL':"'".$this->db->escape($this->code_iso)."'").","; - $sql.= " ".(! isset($this->libelle)?'NULL':"'".$this->db->escape($this->libelle)."'").","; + $sql.= " ".(! isset($this->label)?'NULL':"'".$this->db->escape($this->label)."'").","; $sql.= " ".(! isset($this->active)?'NULL':"'".$this->active."'").""; $sql.= ")"; $this->db->begin(); - dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::create", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } if (! $error) { - $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."c_pays"); + $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."c_country"); if (! $notrigger) { @@ -152,13 +152,13 @@ class Cpays // extends CommonObject $sql.= " t.rowid,"; $sql.= " t.code,"; $sql.= " t.code_iso,"; - $sql.= " t.libelle,"; + $sql.= " t.label,"; $sql.= " t.active"; - $sql.= " FROM ".MAIN_DB_PREFIX."c_pays as t"; + $sql.= " FROM ".MAIN_DB_PREFIX."c_country as t"; if ($id) $sql.= " WHERE t.rowid = ".$id; elseif ($code) $sql.= " WHERE t.code = '".$this->db->escape($code)."'"; - dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -169,7 +169,7 @@ class Cpays // extends CommonObject $this->id = $obj->rowid; $this->code = $obj->code; $this->code_iso = $obj->code_iso; - $this->libelle = $obj->libelle; + $this->label = $obj->label; $this->active = $obj->active; } $this->db->free($resql); @@ -179,7 +179,6 @@ class Cpays // extends CommonObject else { $this->error="Error ".$this->db->lasterror(); - dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR); return -1; } } @@ -200,7 +199,7 @@ class Cpays // extends CommonObject // Clean parameters if (isset($this->code)) $this->code=trim($this->code); if (isset($this->code_iso)) $this->code_iso=trim($this->code_iso); - if (isset($this->libelle)) $this->libelle=trim($this->libelle); + if (isset($this->label)) $this->label=trim($this->label); if (isset($this->active)) $this->active=trim($this->active); @@ -208,16 +207,16 @@ class Cpays // extends CommonObject // Put here code to add control on parameters values // Update request - $sql = "UPDATE ".MAIN_DB_PREFIX."c_pays SET"; + $sql = "UPDATE ".MAIN_DB_PREFIX."c_country SET"; $sql.= " code=".(isset($this->code)?"'".$this->db->escape($this->code)."'":"null").","; $sql.= " code_iso=".(isset($this->code_iso)?"'".$this->db->escape($this->code_iso)."'":"null").","; - $sql.= " libelle=".(isset($this->libelle)?"'".$this->db->escape($this->libelle)."'":"null").","; + $sql.= " label=".(isset($this->label)?"'".$this->db->escape($this->label)."'":"null").","; $sql.= " active=".(isset($this->active)?$this->active:"null").""; $sql.= " WHERE rowid=".$this->id; $this->db->begin(); - dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } @@ -268,12 +267,12 @@ class Cpays // extends CommonObject global $conf, $langs; $error=0; - $sql = "DELETE FROM ".MAIN_DB_PREFIX."c_pays"; + $sql = "DELETE FROM ".MAIN_DB_PREFIX."c_country"; $sql.= " WHERE rowid=".$this->id; $this->db->begin(); - dol_syslog(get_class($this)."::delete sql=".$sql); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index 6d657f0c36c..fdc4a35a585 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -47,7 +47,7 @@ abstract class CommonInvoice extends CommonObject $sql.= ' FROM '.MAIN_DB_PREFIX.$table; $sql.= ' WHERE '.$field.' = '.$this->id; - dol_syslog(get_class($this)."::getSommePaiement sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::getSommePaiement", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -308,7 +308,7 @@ abstract class CommonInvoice extends CommonObject if (is_numeric($cond_reglement)) $sqltemp.= " WHERE c.rowid=".$cond_reglement; else $sqltemp.= " WHERE c.code='".$this->db->escape($cond_reglement)."'"; - dol_syslog(get_class($this).'::calculate_date_lim_reglement sql='.$sqltemp); + dol_syslog(get_class($this).'::calculate_date_lim_reglement', LOG_DEBUG); $resqltemp=$this->db->query($sqltemp); if ($resqltemp) { diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 914d9be59a3..af71662b3a5 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -47,6 +47,8 @@ abstract class CommonObject public $array_options=array(); + public $thirdparty; + public $linkedObjectsIds; // Loaded by ->fetchObjectLinked public $linkedObjects; // Loaded by ->fetchObjectLinked @@ -78,7 +80,7 @@ abstract class CommonObject return -1; } - dol_syslog(get_class()."::isExistingObject sql=".$sql); + dol_syslog(get_class()."::isExistingObject", LOG_DEBUG); $resql = $db->query($sql); if ($resql) { @@ -116,7 +118,6 @@ abstract class CommonObject $lastname=$this->lastname; $firstname=$this->firstname; if (empty($lastname)) $lastname=(isset($this->lastname)?$this->lastname:(isset($this->name)?$this->name:(isset($this->nom)?$this->nom:''))); - if (empty($firstname)) $firstname=$this->firstname; $ret=''; if ($option && $this->civility_id) @@ -164,7 +165,6 @@ abstract class CommonObject { global $user,$conf,$langs; - $error=0; dol_syslog(get_class($this)."::add_contact $fk_socpeople, $type_contact, $source"); @@ -205,6 +205,8 @@ abstract class CommonObject $datecreate = dol_now(); + $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) "; @@ -212,23 +214,18 @@ abstract class CommonObject $sql.= "'".$this->db->idate($datecreate)."'"; $sql.= ", 4, '". $id_type_contact . "' "; $sql.= ")"; - dol_syslog(get_class($this)."::add_contact sql=".$sql); + dol_syslog(get_class($this)."::add_contact", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { if (! $notrigger) { - // Call triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers(strtoupper($this->element).'_ADD_CONTACT',$this,$user,$langs,$conf); - if ($result < 0) { - $error++; $this->errors=$interface->errors; - } - // End call triggers + $result=$this->call_trigger(strtoupper($this->element).'_ADD_CONTACT', $user); + if ($result < 0) { $this->db->rollback(); return -1; } } + $this->db->commit(); return 1; } else @@ -236,12 +233,13 @@ abstract class CommonObject if ($this->db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $this->error=$this->db->errno(); + $this->db->rollback(); return -2; } else { $this->error=$this->db->error(); - dol_syslog($this->error,LOG_ERR); + $this->db->rollback(); return -1; } } @@ -264,7 +262,6 @@ abstract class CommonObject if ($this->add_contact($contact['id'], $contact['fk_c_type_contact'], $contact['source']) < 0) { $this->error=$this->db->lasterror(); - dol_syslog(get_class($this)."::copy_contact error=".$this->error, LOG_ERR); return -1; } } @@ -311,32 +308,28 @@ abstract class CommonObject { global $user,$langs,$conf; - $error=0; + + $this->db->begin(); $sql = "DELETE FROM ".MAIN_DB_PREFIX."element_contact"; $sql.= " WHERE rowid =".$rowid; - dol_syslog(get_class($this)."::delete_contact sql=".$sql); + dol_syslog(get_class($this)."::delete_contact", LOG_DEBUG); if ($this->db->query($sql)) { if (! $notrigger) { - // Call triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers(strtoupper($this->element).'_DELETE_CONTACT',$this,$user,$langs,$conf); - if ($result < 0) { - $error++; $this->errors=$interface->errors; - } - // End call triggers + $result=$this->call_trigger(strtoupper($this->element).'_DELETE_CONTACT', $user); + if ($result < 0) { $this->db->rollback(); return -1; } } + $this->db->commit(); return 1; } else { $this->error=$this->db->lasterror(); - dol_syslog(get_class($this)."::delete_contact error=".$this->error, LOG_ERR); + $this->db->rollback(); return -1; } } @@ -361,7 +354,7 @@ abstract class CommonObject $sql.= " WHERE element_id =".$this->id; $sql.= " AND fk_c_type_contact IN (".$listId.")"; - dol_syslog(get_class($this)."::delete_linked_contact sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::delete_linked_contact", LOG_DEBUG); if ($this->db->query($sql)) { return 1; @@ -369,7 +362,6 @@ abstract class CommonObject else { $this->error=$this->db->lasterror(); - dol_syslog(get_class($this)."::delete_linked_contact error=".$this->error, LOG_ERR); return -1; } } @@ -391,7 +383,7 @@ abstract class CommonObject $sql = "SELECT ec.rowid, ec.statut, ec.fk_socpeople as id, ec.fk_c_type_contact"; // This field contains id of llx_socpeople or id of llx_user if ($source == 'internal') $sql.=", '-1' as socid"; if ($source == 'external' || $source == 'thirdparty') $sql.=", t.fk_soc as socid"; - $sql.= ", t.civilite as civility, t.lastname as lastname, t.firstname, t.email"; + $sql.= ", t.civility as civility, t.lastname as lastname, t.firstname, t.email"; $sql.= ", tc.source, tc.element, tc.code, tc.libelle"; $sql.= " FROM ".MAIN_DB_PREFIX."c_type_contact tc"; $sql.= ", ".MAIN_DB_PREFIX."element_contact ec"; @@ -406,7 +398,7 @@ abstract class CommonObject if ($statut >= 0) $sql.= " AND ec.statut = '".$statut."'"; $sql.=" ORDER BY t.lastname ASC"; - dol_syslog(get_class($this)."::liste_contact sql=".$sql); + dol_syslog(get_class($this)."::liste_contact", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -461,7 +453,7 @@ abstract class CommonObject $sql.= " AND ec.fk_c_type_contact=tc.rowid"; $sql.= " AND tc.element = '".$this->element."'"; - dol_syslog(get_class($this)."::swapContactStatus sql=".$sql); + dol_syslog(get_class($this)."::swapContactStatus", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -563,7 +555,7 @@ abstract class CommonObject $sql.= " AND tc.active = 1"; if ($status) $sql.= " AND ec.statut = ".$status; - dol_syslog(get_class($this)."::getIdContact sql=".$sql); + dol_syslog(get_class($this)."::getIdContact", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -576,7 +568,6 @@ abstract class CommonObject else { $this->error=$this->db->error(); - dol_syslog(get_class($this)."::getIdContact ".$this->error, LOG_ERR); return null; } @@ -599,7 +590,7 @@ abstract class CommonObject } /** - * Load the third party of object, from id $this->socid or $this->fk_soc, into this->thirdpary + * Load the third party of object, from id $this->socid or $this->fk_soc, into this->thirdparty * * @return int <0 if KO, >0 if OK */ @@ -607,10 +598,10 @@ abstract class CommonObject { global $conf; - if (empty($this->socid) && empty($this->fk_soc)) return 0; + if (empty($this->socid) && empty($this->fk_soc) && empty($this->fk_thirdparty)) return 0; $thirdparty = new Societe($this->db); - $result=$thirdparty->fetch(isset($this->socid)?$this->socid:$this->fk_soc); + $result=$thirdparty->fetch(isset($this->socid)?$this->socid:(isset($this->fk_soc)?$this->fk_soc:$this->fk_thirdparty)); $this->client = $thirdparty; // deprecated $this->thirdparty = $thirdparty; @@ -653,7 +644,7 @@ abstract class CommonObject $sql = "SELECT rowid, code, libelle as label, coder"; $sql.= " FROM ".MAIN_DB_PREFIX."c_barcode_type"; $sql.= " WHERE rowid = ".$idtype; - dol_syslog(get_class($this).'::fetch_barcode sql='.$sql); + dol_syslog(get_class($this).'::fetch_barcode', LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -739,7 +730,7 @@ abstract class CommonObject $sql.= " WHERE ".$field." = '".$key."'"; $sql.= " AND entity = ".$conf->entity; - dol_syslog(get_class($this).'::fetchObjectFrom sql='.$sql); + dol_syslog(get_class($this).'::fetchObjectFrom', LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -765,7 +756,7 @@ abstract class CommonObject $sql = "SELECT ".$field." FROM ".MAIN_DB_PREFIX.$table; $sql.= " WHERE rowid = ".$id; - dol_syslog(get_class($this).'::getValueFrom sql='.$sql); + dol_syslog(get_class($this).'::getValueFrom', LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -805,7 +796,7 @@ abstract class CommonObject if (is_object($user)) $sql.=", fk_user_modif = ".$user->id; $sql.= " WHERE ".$id_field." = ".$id; - dol_syslog(get_class($this)."::".__FUNCTION__." sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::".__FUNCTION__."", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -931,7 +922,7 @@ abstract class CommonObject else $sql.= ' SET fk_projet = NULL'; $sql.= ' WHERE rowid = '.$this->id; - dol_syslog(get_class($this)."::setProject sql=".$sql); + dol_syslog(get_class($this)."::setProject", LOG_DEBUG); if ($this->db->query($sql)) { $this->fk_project = $projectid; @@ -1052,6 +1043,37 @@ abstract class CommonObject } } + + /** + * Change the shipping method + * + * @param int $shipping_method_id Id of shipping method + * @return int 1 if OK, 0 if KO + */ + function setShippingMethod($shipping_method_id) + { + if (! $this->table_element) { + dol_syslog(get_class($this)."::setShippingMethod was called on objet with property table_element not defined",LOG_ERR); + return -1; + } + if ($shipping_method_id<0) $shipping_method_id='NULL'; + dol_syslog(get_class($this).'::setShippingMethod('.$shipping_method_id.')'); + + $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element; + $sql.= " SET fk_shipping_method = ".$shipping_method_id; + $sql.= " WHERE rowid=".$this->id; + + if ($this->db->query($sql)) { + $this->shipping_method_id = ($shipping_method_id=='NULL')?null:$shipping_method_id; + return 1; + } else { + dol_syslog(get_class($this).'::setShippingMethod Error ', LOG_DEBUG); + $this->error=$this->db->error(); + return 0; + } + } + + /** * Set last model used by doc generator * @@ -1075,7 +1097,7 @@ abstract class CommonObject // if ($this->element == 'facture') $sql.= " AND fk_statut < 2"; // if ($this->element == 'propal') $sql.= " AND fk_statut = 0"; - dol_syslog(get_class($this)."::setDocModel sql=".$sql); + dol_syslog(get_class($this)."::setDocModel", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -1090,6 +1112,36 @@ abstract class CommonObject } + /** + * Change the bank account + * + * @param int $fk_account Id of bank account + * @return int 1 if OK, 0 if KO + */ + function setBankAccount($fk_account) + { + if (! $this->table_element) { + dol_syslog(get_class($this)."::setBankAccount was called on objet with property table_element not defined",LOG_ERR); + return -1; + } + if ($fk_account<0) $fk_account='NULL'; + dol_syslog(get_class($this).'::setBankAccount('.$fk_account.')'); + + $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element; + $sql.= " SET fk_account = ".$fk_account; + $sql.= " WHERE rowid=".$this->id; + + if ($this->db->query($sql)) { + $this->fk_account = ($fk_account=='NULL')?null:$fk_account; + return 1; + } else { + dol_syslog(get_class($this).'::setBankAccount Error '.$sql.' - '.$this->db->error()); + $this->error=$this->db->error(); + return 0; + } + } + + /** * Save a new position (field rang) for details lines. * You can choose to set position for lines with already a position or lines without any position defined. @@ -1119,7 +1171,7 @@ abstract class CommonObject if (! $renum) $sql.= ' AND rang = 0'; if ($renum) $sql.= ' AND rang <> 0'; - dol_syslog(get_class($this)."::line_order sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::line_order", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -1139,7 +1191,7 @@ abstract class CommonObject if ($fk_parent_line) $sql.= ' AND fk_parent_line IS NULL'; $sql.= ' ORDER BY rang ASC, rowid '.$rowidorder; - dol_syslog(get_class($this)."::line_order search all parent lines sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::line_order search all parent lines", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -1191,7 +1243,7 @@ abstract class CommonObject $sql.= ' AND fk_parent_line = '.$id; $sql.= ' ORDER BY rang ASC'; - dol_syslog(get_class($this)."::getChildrenOfLine search children lines for line ".$id." sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::getChildrenOfLine search children lines for line ".$id."", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -1259,7 +1311,7 @@ abstract class CommonObject $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element_line.' SET rang = '.$rang; $sql.= ' WHERE rowid = '.$rowid; - dol_syslog(get_class($this)."::updateRangOfLine sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::updateRangOfLine", LOG_DEBUG); if (! $this->db->query($sql)) { dol_print_error($this->db); @@ -1353,7 +1405,7 @@ abstract class CommonObject $sql = 'SELECT rang FROM '.MAIN_DB_PREFIX.$this->table_element_line; $sql.= ' WHERE rowid ='.$rowid; - dol_syslog(get_class($this)."::getRangOfLine sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::getRangOfLine", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -1396,7 +1448,7 @@ abstract class CommonObject $sql.= ' WHERE '.$this->fk_element.' = '.$this->id; $sql.= ' AND fk_parent_line = '.$fk_parent_line; - dol_syslog(get_class($this)."::line_max sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::line_max", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -1417,7 +1469,7 @@ abstract class CommonObject $sql = 'SELECT max(rang) FROM '.MAIN_DB_PREFIX.$this->table_element_line; $sql.= ' WHERE '.$this->fk_element.' = '.$this->id; - dol_syslog(get_class($this)."::line_max sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::line_max", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -1445,7 +1497,7 @@ abstract class CommonObject $sql.= " SET ref_ext = '".$this->db->escape($ref_ext)."'"; $sql.= " WHERE ".(isset($this->table_rowid)?$this->table_rowid:'rowid')." = ". $this->id; - dol_syslog(get_class($this)."::update_ref_ext sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::update_ref_ext", LOG_DEBUG); if ($this->db->query($sql)) { $this->ref_ext = $ref_ext; @@ -1454,7 +1506,6 @@ abstract class CommonObject else { $this->error=$this->db->error(); - dol_syslog(get_class($this)."::update_ref_ext error=".$this->error, LOG_ERR); return -1; } } @@ -1483,7 +1534,7 @@ abstract class CommonObject $sql.= " SET note".$suffix." = ".(!empty($note)?("'".$this->db->escape($note)."'"):"NULL"); $sql.= " WHERE rowid =". $this->id; - dol_syslog(get_class($this)."::update_note sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::update_note", LOG_DEBUG); if ($this->db->query($sql)) { if ($suffix == '_public') $this->note_public = $note; @@ -1494,7 +1545,6 @@ abstract class CommonObject else { $this->error=$this->db->lasterror(); - dol_syslog(get_class($this)."::update_note error=".$this->error, LOG_ERR); return -1; } } @@ -1558,7 +1608,7 @@ abstract class CommonObject } $sql.= ' ORDER by rowid'; // We want to be sure to always use same order of line to not change lines differently when option MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND is used - dol_syslog(get_class($this)."::update_price sql=".$sql); + dol_syslog(get_class($this)."::update_price", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -1658,13 +1708,12 @@ abstract class CommonObject $sql .= ' WHERE rowid = '.$this->id; //print "xx".$sql; - dol_syslog(get_class($this)."::update_price sql=".$sql); + dol_syslog(get_class($this)."::update_price", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) { $error++; $this->error=$this->db->error(); - dol_syslog(get_class($this)."::update_price error=".$this->error,LOG_ERR); } } @@ -1710,7 +1759,7 @@ abstract class CommonObject $sql.= ", '".$this->element."'"; $sql.= ")"; - dol_syslog(get_class($this)."::add_object_linked sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::add_object_linked", LOG_DEBUG); if ($this->db->query($sql)) { $this->db->commit(); @@ -1787,7 +1836,7 @@ abstract class CommonObject $sql .= ' ORDER BY sourcetype'; //print $sql; - dol_syslog(get_class($this)."::fetchObjectLink sql=".$sql); + dol_syslog(get_class($this)."::fetchObjectLink", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -1912,7 +1961,7 @@ abstract class CommonObject $sql.= " AND sourcetype = '".$this->element."'"; } - dol_syslog(get_class($this)."::updateObjectLinked sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::updateObjectLinked", LOG_DEBUG); if ($this->db->query($sql)) { return 1; @@ -1920,7 +1969,6 @@ abstract class CommonObject else { $this->error=$this->db->lasterror(); - dol_syslog(get_class($this)."::updateObjectLinked error=".$this->error, LOG_ERR); return -1; } } @@ -1966,7 +2014,7 @@ abstract class CommonObject $sql.= " (fk_target = ".$this->id." AND targettype = '".$this->element."')"; } - dol_syslog(get_class($this)."::deleteObjectLinked sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::deleteObjectLinked", LOG_DEBUG); if ($this->db->query($sql)) { return 1; @@ -1974,7 +2022,6 @@ abstract class CommonObject else { $this->error=$this->db->lasterror(); - dol_syslog(get_class($this)."::deleteObjectLinked error=".$this->error, LOG_ERR); return -1; } } @@ -2001,7 +2048,7 @@ abstract class CommonObject $sql.= " SET ".$fieldstatus." = ".$status; $sql.= " WHERE rowid=".$elementId; - dol_syslog(get_class($this)."::setStatut sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::setStatut", LOG_DEBUG); if ($this->db->query($sql)) { $this->db->commit(); @@ -2011,7 +2058,6 @@ abstract class CommonObject else { $this->error=$this->db->lasterror(); - dol_syslog(get_class($this)."::setStatut ".$this->error, LOG_ERR); $this->db->rollback(); return -1; } @@ -2110,7 +2156,7 @@ abstract class CommonObject $sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element."_extrafields"; $sql.= " WHERE fk_object = ".$rowid; - dol_syslog(get_class($this)."::fetch_optionals sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetch_optionals", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -2158,12 +2204,11 @@ abstract class CommonObject $this->db->begin(); $sql_del = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element."_extrafields WHERE fk_object = ".$this->id; - dol_syslog(get_class($this)."::deleteExtraFields delete sql=".$sql_del); + dol_syslog(get_class($this)."::deleteExtraFields delete", LOG_DEBUG); $resql=$this->db->query($sql_del); if (! $resql) { $this->error=$this->db->lasterror(); - dol_syslog(get_class($this)."::deleteExtraFields ".$this->error,LOG_ERR); $this->db->rollback(); return -1; } @@ -2229,7 +2274,7 @@ abstract class CommonObject $this->db->begin(); $sql_del = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element."_extrafields WHERE fk_object = ".$this->id; - dol_syslog(get_class($this)."::insertExtraFields delete sql=".$sql_del); + dol_syslog(get_class($this)."::insertExtraFields delete", LOG_DEBUG); $this->db->query($sql_del); $sql = "INSERT INTO ".MAIN_DB_PREFIX.$this->table_element."_extrafields (fk_object"; foreach($this->array_options as $key => $value) @@ -2258,12 +2303,11 @@ abstract class CommonObject } $sql.=")"; - dol_syslog(get_class($this)."::insertExtraFields insert sql=".$sql); + dol_syslog(get_class($this)."::insertExtraFields insert", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $this->error=$this->db->lasterror(); - dol_syslog(get_class($this)."::update ".$this->error,LOG_ERR); $this->db->rollback(); return -1; } @@ -2436,7 +2480,6 @@ abstract class CommonObject else { $this->error=$this->db->lasterror(); - dol_syslog(get_class($this)."::delete error -1 ".$this->error, LOG_ERR); return -1; } } @@ -2485,7 +2528,7 @@ abstract class CommonObject $sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element."det"; $sql.= " WHERE ".$this->fk_element." = ".$this->id; - dol_syslog(get_class($this).'::getTotalDiscount sql='.$sql); + dol_syslog(get_class($this).'::getTotalDiscount', LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -2506,7 +2549,6 @@ abstract class CommonObject $i++; } } - else dol_syslog(get_class($this).'::getTotalDiscount '.$this->db->lasterror(), LOG_ERR); //print $total_discount; exit; return price2num($total_discount); @@ -2527,12 +2569,11 @@ abstract class CommonObject $sql.= " SET extraparams = ".(! empty($extraparams) ? "'".$this->db->escape($extraparams)."'" : "null"); $sql.= " WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::setExtraParameters sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::setExtraParameters", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $this->error=$this->db->lasterror(); - dol_syslog(get_class($this)."::setExtraParameters ".$this->error, LOG_ERR); $this->db->rollback(); return -1; } @@ -2735,21 +2776,21 @@ abstract class CommonObject if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) print ' '.$langs->trans('Description').''.$langs->trans('VAT').''.$langs->trans('PriceUHT').' '.$langs->trans('Qty').''.$langs->trans('ReductionShort').'
'; + if (! empty($conf->global->MARGININFO_HIDE_SHOW)) + { + print ""; + if ($conf->global->MARGININFO_HIDE_SHOW == 2) print ''; // hide by default + } + print '
'; print ''; print ''; print ''; @@ -3328,7 +3374,7 @@ abstract class CommonObject $sql.= ", '".$mandatory."'"; $sql.= ")"; - dol_syslog(get_class($this)."::add_element_resource sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::add_element_resource", LOG_DEBUG); if ($this->db->query($sql)) { $this->db->commit(); @@ -3354,24 +3400,19 @@ abstract class CommonObject { global $user,$langs,$conf; - $error=0; + + $this->db->begin(); $sql = "DELETE FROM ".MAIN_DB_PREFIX."element_resources"; $sql.= " WHERE rowid =".$rowid; - dol_syslog(get_class($this)."::delete_resource sql=".$sql); + dol_syslog(get_class($this)."::delete_resource", LOG_DEBUG); if ($this->db->query($sql)) { if (! $notrigger) { - // Call triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers(strtoupper($element).'_DELETE_RESOURCE',$this,$user,$langs,$conf); - if ($result < 0) { - $error++; $this->errors=$interface->errors; - } - // End call triggers + $result=$this->call_trigger(strtoupper($element).'_DELETE_RESOURCE', $user); + if ($result < 0) { $this->db->rollback(); return -1; } } return 1; @@ -3379,7 +3420,7 @@ abstract class CommonObject else { $this->error=$this->db->lasterror(); - dol_syslog(get_class($this)."::delete_resource error=".$this->error, LOG_ERR); + $this->db->rollback(); return -1; } } @@ -3403,4 +3444,34 @@ abstract class CommonObject } } + /** + * Call trigger based on this instance + * NB: Error from trigger are stacked in interface->errors + * NB2: If return code of triggers are < 0, action calling trigger should cancel all transaction. + * + * @param string $trigger_name trigger's name to execute + * @param User $user Object user + * @return int Result of run_triggers + */ + 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); + if ($result < 0) + { + if (!empty($this->errors)) + { + $this->errors=array_merge($this->errors,$interface->errors); + } + else + { + $this->errors=$interface->errors; + } + } + return $result; + } + } diff --git a/htdocs/core/class/commonobjectline.class.php b/htdocs/core/class/commonobjectline.class.php index bb253d2eded..675e1cf0794 100644 --- a/htdocs/core/class/commonobjectline.class.php +++ b/htdocs/core/class/commonobjectline.class.php @@ -28,6 +28,34 @@ */ abstract class CommonObjectLine { + /** + * Call trigger based on this instance + * NB: Error from trigger are stacked in interface->errors + * NB2: If return code of triggers are < 0, action calling trigger should cancel all transaction. + * + * @param string $trigger_name trigger's name to execute + * @param User $user Object user + * @return int Result of run_triggers + */ + 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); + if ($result < 0) + { + if (!empty($this->errors)) + { + $this->errors=array_merge($this->errors,$interface->errors); + } + else + { + $this->errors=$interface->errors; + } + } + return $result; + } } diff --git a/htdocs/core/class/ctypent.class.php b/htdocs/core/class/ctypent.class.php index 33070f83412..eea64ed10ac 100644 --- a/htdocs/core/class/ctypent.class.php +++ b/htdocs/core/class/ctypent.class.php @@ -102,7 +102,7 @@ class Ctypent // extends CommonObject $this->db->begin(); - dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::create", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } @@ -156,14 +156,15 @@ class Ctypent // extends CommonObject $sql = "SELECT"; $sql.= " t.id,"; $sql.= " t.code,"; - $sql.= " t.libelle,"; + $sql.= " t.libelle as label,"; + $sql.= " t.fk_country as country_id,"; $sql.= " t.active,"; $sql.= " t.module"; $sql.= " FROM ".MAIN_DB_PREFIX."c_typent as t"; if ($id) $sql.= " WHERE t.id = ".$id; elseif ($code) $sql.= " WHERE t.code = '".$this->db->escape($code)."'"; - dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -173,7 +174,8 @@ class Ctypent // extends CommonObject $this->id = $obj->id; $this->code = $obj->code; - $this->libelle = $obj->libelle; + $this->libelle = $obj->label; + $this->country_id = $obj->country_id; $this->active = $obj->active; $this->module = $obj->module; } @@ -184,7 +186,6 @@ class Ctypent // extends CommonObject else { $this->error="Error ".$this->db->lasterror(); - dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR); return -1; } } @@ -222,7 +223,7 @@ class Ctypent // extends CommonObject $this->db->begin(); - dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } @@ -278,7 +279,7 @@ class Ctypent // extends CommonObject $this->db->begin(); - dol_syslog(get_class($this)."::delete sql=".$sql); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } diff --git a/htdocs/core/class/discount.class.php b/htdocs/core/class/discount.class.php index 23ce9f97f6d..f0291c9d567 100644 --- a/htdocs/core/class/discount.class.php +++ b/htdocs/core/class/discount.class.php @@ -85,7 +85,7 @@ class DiscountAbsolute if ($rowid) $sql.= " sr.rowid=".$rowid; if ($fk_facture_source) $sql.= " sr.fk_facture_source=".$fk_facture_source; - dol_syslog(get_class($this)."::fetch sql=".$sql); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -159,7 +159,7 @@ class DiscountAbsolute $sql.= " ".($this->fk_facture_source?"'".$this->fk_facture_source."'":"null"); $sql.= ")"; - dol_syslog(get_class($this)."::create sql=".$sql); + dol_syslog(get_class($this)."::create", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -169,7 +169,6 @@ class DiscountAbsolute else { $this->error=$this->db->lasterror().' - sql='.$sql; - dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR); return -1; } } @@ -195,7 +194,7 @@ class DiscountAbsolute $sql.=" AND fk_facture_source = ".$this->fk_facture_source; //$sql.=" AND rowid != ".$this->id; - dol_syslog(get_class($this)."::delete Check if we can remove discount sql=".$sql); + dol_syslog(get_class($this)."::delete Check if we can remove discount", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -222,7 +221,7 @@ class DiscountAbsolute $sql.= " AND (fk_facture_line IS NULL"; // Not used as absolute simple discount $sql.= " AND fk_facture IS NULL)"; // Not used as credit note and not used as deposit - dol_syslog(get_class($this)."::delete Delete discount sql=".$sql); + dol_syslog(get_class($this)."::delete Delete discount", LOG_DEBUG); $result=$this->db->query($sql); if ($result) { @@ -233,7 +232,7 @@ class DiscountAbsolute $sql.=" set paye=0, fk_statut=1"; $sql.=" WHERE (type = 2 or type = 3) AND rowid=".$this->fk_facture_source; - dol_syslog(get_class($this)."::delete Update credit note or deposit invoice statut sql=".$sql); + dol_syslog(get_class($this)."::delete Update credit note or deposit invoice statut", LOG_DEBUG); $result=$this->db->query($sql); if ($result) { @@ -291,7 +290,7 @@ class DiscountAbsolute if ($rowidinvoice) $sql.=" SET fk_facture = ".$rowidinvoice; $sql.=" WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::link_to_invoice sql=".$sql,LOG_DEBUG); + dol_syslog(get_class($this)."::link_to_invoice", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -302,7 +301,6 @@ class DiscountAbsolute else { $this->error=$this->db->error(); - dol_syslog(get_class($this)."::link_to_invoice ".$this->error,LOG_ERR); return -3; } } @@ -320,7 +318,7 @@ class DiscountAbsolute $sql.=" SET fk_facture_line = NULL, fk_facture = NULL"; $sql.=" WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::unlink_invoice sql=".$sql,LOG_DEBUG); + dol_syslog(get_class($this)."::unlink_invoice", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -329,7 +327,6 @@ class DiscountAbsolute else { $this->error=$this->db->error(); - dol_syslog(get_class($this)."::unlink_invoice ".$this->error,LOG_ERR); return -3; } } @@ -355,7 +352,7 @@ class DiscountAbsolute if ($filter) $sql.=' AND ('.$filter.')'; if ($maxvalue) $sql.=' AND rc.amount_ttc <= '.price2num($maxvalue); - dol_syslog(get_class($this)."::getAvailableDiscounts sql=".$sql,LOG_DEBUG); + dol_syslog(get_class($this)."::getAvailableDiscounts", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -384,7 +381,7 @@ class DiscountAbsolute $sql.= ' WHERE rc.fk_facture_source=f.rowid AND rc.fk_facture = '.$invoice->id; $sql.= ' AND f.type = 2'; - dol_syslog(get_class($this)."::getSumCreditNotesUsed sql=".$sql,LOG_DEBUG); + dol_syslog(get_class($this)."::getSumCreditNotesUsed", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -410,7 +407,7 @@ class DiscountAbsolute $sql.= ' WHERE rc.fk_facture_source=f.rowid AND rc.fk_facture = '.$invoice->id; $sql.= ' AND f.type = 3'; - dol_syslog(get_class($this)."::getSumDepositsUsed sql=".$sql,LOG_DEBUG); + dol_syslog(get_class($this)."::getSumDepositsUsed", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { diff --git a/htdocs/core/class/dolprintipp.class.php b/htdocs/core/class/dolprintipp.class.php index 768741d9368..942ee3da3c3 100644 --- a/htdocs/core/class/dolprintipp.class.php +++ b/htdocs/core/class/dolprintipp.class.php @@ -201,4 +201,3 @@ class dolprintIPP return $ipp->printer_attributes; } } -?> diff --git a/htdocs/core/class/events.class.php b/htdocs/core/class/events.class.php index b344a0c4059..ba4dcfb94f6 100644 --- a/htdocs/core/class/events.class.php +++ b/htdocs/core/class/events.class.php @@ -132,7 +132,7 @@ class Events // extends CommonObject $sql.= " '".$this->db->escape($this->description)."'"; $sql.= ")"; - dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::create", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -142,7 +142,6 @@ class Events // extends CommonObject else { $this->error="Error ".$this->db->lasterror(); - dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR); return -1; } } @@ -174,12 +173,11 @@ class Events // extends CommonObject $sql.= " description='".$this->db->escape($this->description)."'"; $sql.= " WHERE rowid=".$this->id; - dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $this->error="Error ".$this->db->lasterror(); - dol_syslog(get_class($this)."::update ".$this->error, LOG_ERR); return -1; } return 1; @@ -209,7 +207,7 @@ class Events // extends CommonObject $sql.= " FROM ".MAIN_DB_PREFIX."events as t"; $sql.= " WHERE t.rowid = ".$id; - dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -233,7 +231,6 @@ class Events // extends CommonObject else { $this->error="Error ".$this->db->lasterror(); - dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR); return -1; } } @@ -252,12 +249,11 @@ class Events // extends CommonObject $sql = "DELETE FROM ".MAIN_DB_PREFIX."events"; $sql.= " WHERE rowid=".$this->id; - dol_syslog(get_class($this)."::delete sql=".$sql); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $this->error="Error ".$this->db->lasterror(); - dol_syslog(get_class($this)."::delete ".$this->error, LOG_ERR); return -1; } diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 2f6a63b6d8c..df1527d47b9 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -255,7 +255,7 @@ class ExtraFields $sql.= " '".$params."'"; $sql.=')'; - dol_syslog(get_class($this)."::create_label sql=".$sql); + dol_syslog(get_class($this)."::create_label", LOG_DEBUG); if ($this->db->query($sql)) { return 1; @@ -286,7 +286,6 @@ class ExtraFields if ($result < 0) { $this->error=$this->db->lasterror(); - dol_syslog(get_class($this)."::delete ".$this->error, LOG_ERR); } $result=$this->delete_label($attrname,$elementtype); @@ -318,7 +317,7 @@ class ExtraFields $sql.= " AND entity IN (0,".$conf->entity.')'; $sql.= " AND elementtype = '".$elementtype."'"; - dol_syslog(get_class($this)."::delete_label sql=".$sql); + dol_syslog(get_class($this)."::delete_label", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -399,7 +398,7 @@ class ExtraFields { $sql="ALTER TABLE ".MAIN_DB_PREFIX.$table." DROP INDEX uk_".$table."_".$attrname; } - dol_syslog(get_class($this).'::update sql='.$sql); + dol_syslog(get_class($this).'::update', LOG_DEBUG); $resql=$this->db->query($sql,1,'dml'); return 1; } @@ -454,7 +453,7 @@ class ExtraFields $sql_del.= " WHERE name = '".$attrname."'"; $sql_del.= " AND entity = ".$conf->entity; $sql_del.= " AND elementtype = '".$elementtype."'"; - dol_syslog(get_class($this)."::update_label sql=".$sql_del); + dol_syslog(get_class($this)."::update_label", LOG_DEBUG); $resql1=$this->db->query($sql_del); $sql = "INSERT INTO ".MAIN_DB_PREFIX."extrafields("; @@ -480,7 +479,7 @@ class ExtraFields $sql.= " '".$pos."',"; $sql.= " '".$param."'"; $sql.= ")"; - dol_syslog(get_class($this)."::update_label sql=".$sql); + dol_syslog(get_class($this)."::update_label", LOG_DEBUG); $resql2=$this->db->query($sql); if ($resql1 && $resql2) @@ -537,7 +536,7 @@ class ExtraFields if ($elementtype) $sql.= " AND elementtype = '".$elementtype."'"; $sql.= " ORDER BY pos"; - dol_syslog(get_class($this)."::fetch_name_optionals_label sql=".$sql); + dol_syslog(get_class($this)."::fetch_name_optionals_label", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -674,7 +673,7 @@ class ExtraFields elseif ($type == 'select') { $out = ''; - if ($conf->use_javascript_ajax && $conf->global->COMPANY_USE_SEARCH_TO_SELECT && ! $forcecombo) + if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->COMPANY_USE_SEARCH_TO_SELECT) && ! $forcecombo) { include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; $out.= ajax_combobox('options_'.$key.$keyprefix, array(), $conf->global->COMPANY_USE_SEARCH_TO_SELECT); @@ -755,7 +754,7 @@ class ExtraFields $sql.=preg_replace('/^ AND /','',$sqlwhere); //print $sql; - dol_syslog(get_class($this).'::showInputField type=sellist sql='.$sql); + dol_syslog(get_class($this).'::showInputField type=sellist', LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -965,7 +964,7 @@ class ExtraFields $sql.= " WHERE ".$selectkey."='".$this->db->escape($value)."'"; //$sql.= ' AND entity = '.$conf->entity; - dol_syslog(get_class($this).':showOutputField:$type=sellist sql='.$sql); + dol_syslog(get_class($this).':showOutputField:$type=sellist', LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { diff --git a/htdocs/core/class/fiscalyear.class.php b/htdocs/core/class/fiscalyear.class.php new file mode 100644 index 00000000000..39e72ff7416 --- /dev/null +++ b/htdocs/core/class/fiscalyear.class.php @@ -0,0 +1,326 @@ + + * + * 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/core/class/fiscalyear.php + * \ingroup fiscal year + * \brief File of class to manage fiscal years + */ + +require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php'; + +/** + * Class to manage fiscal year + */ +class Fiscalyear +{ + public $element='fiscalyear'; + public $table_element='accounting_fiscalyear'; + public $table_element_line = ''; + public $fk_element = ''; + protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe + + var $id; + var $rowid; + + var $label; + var $date_start; + var $date_end; + var $statut; // 0=open, 1=closed + var $entity; + + var $statuts=array(); + var $statuts_short=array(); + + /** + * Constructor + * + * @param DoliDB $db Database handler + */ + function __construct($db) + { + $this->db = $db; + + $this->statuts_short = array(0 => 'Opened', 1 => 'Closed'); + $this->statuts = array(0 => 'Opened', 1 => 'Closed'); + + return 1; + } + + /** + * Create object in database + * + * @param User $user User making creation + * @return int <0 if KO, >0 if OK + */ + function create($user) + { + global $conf; + + $error = 0; + + $now=dol_now(); + + $this->db->begin(); + + $sql = "INSERT INTO ".MAIN_DB_PREFIX."accounting_fiscalyear ("; + $sql.= "label"; + $sql.= ", date_start"; + $sql.= ", date_end"; + $sql.= ", statut"; + $sql.= ", entity"; + $sql.= ", datec"; + $sql.= ", fk_user_author"; + $sql.= ") VALUES ("; + $sql.= " '".$this->label."'"; + $sql.= ", '".$this->db->idate($this->date_start)."'"; + $sql.= ", '".$this->db->idate($this->date_end)."'"; + $sql.= ", ".$this->statut; + $sql.= ", ".$conf->entity; + $sql.= ", '".$this->db->idate($now)."'"; + $sql.= ", ". $user->id; + $sql.= ")"; + + dol_syslog(get_class($this)."::create", LOG_DEBUG); + $result = $this->db->query($sql); + if ($result) + { + $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."accounting_fiscalyear"); + + $result=$this->update($user); + if ($result > 0) + { + $this->db->commit(); + return $this->id; + } + else + { + $this->error=$this->db->error(); + $this->db->rollback(); + return $result; + } + } + else + { + $this->error=$this->db->error()." sql=".$sql; + $this->db->rollback(); + return -1; + } + } + + /** + * Update record + * + * @param User $user User making update + * @return int <0 if KO, >0 if OK + */ + function update($user) + { + global $langs; + + // Check parameters + if (empty($this->date_start) && empty($this->date_end)) + { + $this->error='ErrorBadParameter'; + return -1; + } + + $this->db->begin(); + + $sql = "UPDATE ".MAIN_DB_PREFIX."accounting_fiscalyear "; + $sql .= " SET label = '".$this->label."'"; + $sql .= ", date_start = '".$this->db->idate($this->date_start)."'"; + $sql .= ", date_end = '".$this->db->idate($this->date_end)."'"; + $sql .= ", statut = '".$this->statut."'"; + $sql .= ", datec = " . ($this->datec != '' ? $this->db->idate($this->datec) : 'null'); + $sql .= ", fk_user_modif = " . $user->id; + $sql .= " WHERE rowid = ".$this->id; + + dol_syslog(get_class($this)."::update", LOG_DEBUG); + $result = $this->db->query($sql); + if ($result) + { + $this->db->commit(); + return 1; + } + else + { + $this->error=$this->db->lasterror(); + $this->db->rollback(); + return -1; + } + } + + /** + * Load an object from database + * + * @param int $id Id of record to load + * @return int <0 if KO, >0 if OK + */ + function fetch($id) + { + $sql = "SELECT rowid, label, date_start, date_end, statut"; + $sql.= " FROM ".MAIN_DB_PREFIX."accounting_fiscalyear"; + $sql.= " WHERE rowid = ".$id; + + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); + $result = $this->db->query($sql); + if ( $result ) + { + $obj = $this->db->fetch_object($result); + + $this->id = $obj->rowid; + $this->ref = $obj->rowid; + $this->date_start = $this->db->jdate($obj->date_start); + $this->date_end = $this->db->jdate($obj->date_end); + $this->label = $obj->label; + $this->statut = $obj->statut; + + return 1; + } + else + { + $this->error=$this->db->error(); + return -1; + } + } + + /** + * Delete record + * + * @param int $id Id of record to delete + * @return int <0 if KO, >0 if OK + */ + function delete($id) + { + $this->db->begin(); + + $sql = "DELETE FROM ".MAIN_DB_PREFIX."accounting_fiscalyear WHERE rowid = ".$id; + + dol_syslog(get_class($this)."::delete", LOG_DEBUG); + $result = $this->db->query($sql); + if ($result) + { + $this->db->commit(); + return 1; + } + else + { + $this->error=$this->db->error(); + $this->db->rollback(); + return -1; + } + } + + /** + * Give a label from a status + * + * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto + * @return string Label + */ + function getLibStatut($mode=0) + { + return $this->LibStatut($this->statut,$mode); + } + + /** + * Give a label from a status + * + * @param int $statut Id status + * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto + * @return string Label + */ + function LibStatut($statut,$mode=0) + { + global $langs; + + if ($mode == 0) + { + return $langs->trans($this->statuts[$statut]); + } + if ($mode == 1) + { + return $langs->trans($this->statuts_short[$statut]); + } + if ($mode == 2) + { + if ($statut==0) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4').' '.$langs->trans($this->statuts_short[$statut]); + if ($statut==1) return img_picto($langs->trans($this->statuts_short[$statut]),'statut8').' '.$langs->trans($this->statuts_short[$statut]); + } + if ($mode == 3) + { + if ($statut==0 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4'); + if ($statut==1 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut8'); + } + if ($mode == 4) + { + if ($statut==0 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4').' '.$langs->trans($this->statuts[$statut]); + if ($statut==1 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut8').' '.$langs->trans($this->statuts[$statut]); + } + if ($mode == 5) + { + if ($statut==0 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut4'); + if ($statut==1 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut8'); + } + } + + /** + * Information on record + * + * @param int $id Id of record + * @return void + */ + function info($id) + { + $sql = 'SELECT fy.rowid, fy.datec, fy.fk_user_author, fy.fk_user_modif,'; + $sql.= ' fy.tms'; + $sql.= ' FROM '.MAIN_DB_PREFIX.'accounting_fiscalyear as fy'; + $sql.= ' WHERE fy.rowid = '.$id; + + dol_syslog(get_class($this)."::fetch info", LOG_DEBUG); + $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_modif) + { + $muser = new User($this->db); + $muser->fetch($obj->fk_user_modif); + $this->user_modification = $muser; + } + $this->date_creation = $this->db->jdate($obj->datec); + $this->date_modification = $this->db->jdate($obj->tms); + } + $this->db->free($result); + } + else + { + dol_print_error($this->db); + } + } + +} \ No newline at end of file diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 8eb7eee4220..cec72aacacb 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -449,19 +449,6 @@ class Form return $this->textwithtooltip($text, $htmltext, 2, $direction, $img, $extracss, $notabs, '', $noencodehtmltext); } - /** - * Return combo list of activated countries, into language of user - * - * @param string $selected Id or Code or Label of preselected country - * @param string $htmlname Name of html select object - * @param string $htmloption Options html on select object - * @return void - */ - function select_pays($selected='',$htmlname='country_id',$htmloption='') - { - print $this->select_country($selected,$htmlname,$htmloption); - } - /** * Return combo list of activated countries, into language of user * @@ -481,16 +468,16 @@ class Form $countryArray=array(); $label=array(); - $sql = "SELECT rowid, code as code_iso, libelle as label"; - $sql.= " FROM ".MAIN_DB_PREFIX."c_pays"; + $sql = "SELECT rowid, code as code_iso, code_iso as code_iso3, label"; + $sql.= " FROM ".MAIN_DB_PREFIX."c_country"; $sql.= " WHERE active = 1"; //$sql.= " ORDER BY code ASC"; - dol_syslog(get_class($this)."::select_country sql=".$sql); + dol_syslog(get_class($this)."::select_country", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { - $out.= ''; $num = $this->db->num_rows($resql); $i = 0; if ($num) @@ -502,6 +489,7 @@ class Form $obj = $this->db->fetch_object($resql); $countryArray[$i]['rowid'] = $obj->rowid; $countryArray[$i]['code_iso'] = $obj->code_iso; + $countryArray[$i]['code_iso3'] = $obj->code_iso3; $countryArray[$i]['label'] = ($obj->code_iso && $langs->transnoentitiesnoconv("Country".$obj->code_iso)!="Country".$obj->code_iso?$langs->transnoentitiesnoconv("Country".$obj->code_iso):($obj->label!='-'?$obj->label:'')); $label[$i] = dol_string_unaccent($countryArray[$i]['label']); $i++; @@ -512,7 +500,7 @@ class Form foreach ($countryArray as $row) { //print 'rr'.$selected.'-'.$row['label'].'-'.$row['code_iso'].'
'; - if ($selected && $selected != '-1' && ($selected == $row['rowid'] || $selected == $row['code_iso'] || $selected == $row['label']) ) + if ($selected && $selected != '-1' && ($selected == $row['rowid'] || $selected == $row['code_iso'] || $selected == $row['code_iso3'] || $selected == $row['label']) ) { $foundselected=true; $out.= '
'.$langs->trans('Margins').''.$langs->trans('SellingPrice').'
'; + print ''; + print ''; + print '
'; + $this->selectShippingMethod($selected, $htmlname, '', $addempty); + print '
'; + } else { + if ($selected) { + $code=$langs->getLabelFromKey($db, $selected, 'c_shipment_mode', 'rowid', 'code'); + print $langs->trans("SendingMethod".strtoupper($code)); + } else { + print " "; + } + } + } + /** * Return a HTML select list of bank accounts * @@ -2437,7 +2537,7 @@ class Form if ($filtre) $sql.=" AND ".$filtre; $sql.= " ORDER BY label"; - dol_syslog(get_class($this)."::select_comptes sql=".$sql); + dol_syslog(get_class($this)."::select_comptes", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { @@ -2479,6 +2579,40 @@ class Form } } + /** + * Display form to select bank account + * + * @param string $page Page + * @param int $selected Id of bank account + * @param string $htmlname Name of select html field + * @param int $addempty 1=Add an empty value in list, 2=Add an empty value in list only if there is more than 2 entries. + * @return void + */ + function formSelectAccount($page, $selected='', $htmlname='fk_account', $addempty=0) + { + global $langs; + if ($htmlname != "none") { + print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + print '
'; + $this->select_comptes($selected, $htmlname, 0, '', $addempty); + print '
'; + } else { + if ($selected) { + require_once DOL_DOCUMENT_ROOT .'/compta/bank/class/account.class.php'; + $bankstatic=new Account($this->db); + $bankstatic->fetch($selected); + print $this->textwithpicto($bankstatic->label,$langs->trans("AccountCurrency").' '.$bankstatic->currency_code); + } else { + print " "; + } + } + } + /** * Return list of categories having choosed type * @@ -3271,7 +3405,7 @@ class Form if ($selected=='euro' || $selected=='euros') $selected='EUR'; // Pour compatibilite - $out.= ''; foreach ($langs->cache_currencies as $code_iso => $currency) { if ($selected && $selected == $code_iso) @@ -3306,10 +3440,10 @@ class Form if ($num > 0) return $num; // Cache deja charge $sql = "SELECT DISTINCT t.taux, t.recuperableonly"; - $sql.= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_pays as p"; - $sql.= " WHERE t.fk_pays = p.rowid"; + $sql.= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c"; + $sql.= " WHERE t.fk_pays = c.rowid"; $sql.= " AND t.active = 1"; - $sql.= " AND p.code IN (".$country_code.")"; + $sql.= " AND c.code IN (".$country_code.")"; $sql.= " ORDER BY t.taux ASC, t.recuperableonly ASC"; $resql=$this->db->query($sql); @@ -3393,14 +3527,14 @@ class Form //exit; // Define list of countries to use to search VAT rates to show - // First we defined code_pays to use to find list + // First we defined code_country to use to find list if (is_object($societe_vendeuse)) { - $code_pays="'".$societe_vendeuse->country_code."'"; + $code_country="'".$societe_vendeuse->country_code."'"; } else { - $code_pays="'".$mysoc->country_code."'"; // Pour compatibilite ascendente + $code_country="'".$mysoc->country_code."'"; // Pour compatibilite ascendente } if (! empty($conf->global->SERVICE_ARE_ECOMMERCE_200238EC)) // If option to have vat for end customer for services is on { @@ -3411,12 +3545,12 @@ class Form { if ($type == 1) // We know product is a service { - $code_pays.=",'".$societe_acheteuse->country_code."'"; + $code_country.=",'".$societe_acheteuse->country_code."'"; } } else if (! $idprod) // We don't know type of product { - $code_pays.=",'".$societe_acheteuse->country_code."'"; + $code_country.=",'".$societe_acheteuse->country_code."'"; } else { @@ -3424,14 +3558,14 @@ class Form $prodstatic->fetch($idprod); if ($prodstatic->type == 1) // We know product is a service { - $code_pays.=",'".$societe_acheteuse->country_code."'"; + $code_country.=",'".$societe_acheteuse->country_code."'"; } } } } // Now we get list - $num = $this->load_cache_vatrates($code_pays); + $num = $this->load_cache_vatrates($code_country); if ($num > 0) { // Definition du taux a pre-selectionner (si defaulttx non force et donc vaut -1 ou '') @@ -4053,7 +4187,7 @@ class Form $ret.='\n"; } - + // CCC if (! empty($this->withtoccc) || is_array($this->withtoccc)) { @@ -459,7 +459,12 @@ class FormMail $out.= $form->selectarray("receiverccc", $this->withtoccc, GETPOST("receiverccc"), 1); } } - //if (! empty($conf->global->MAIN_MAIL_AUTOCOPY_TO)) print ' '.info_admin("+ ".$conf->global->MAIN_MAIL_AUTOCOPY_TO,1); + + $showinfobcc=''; + if (! empty($conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO) && ! empty($this->param['models']) && $this->param['models'] == 'propal_send') $showinfobcc=$conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO; + if (! empty($conf->global->MAIN_MAIL_AUTOCOPY_ORDER_TO) && ! empty($this->param['models']) && $this->param['models'] == 'order_send') $showinfobcc=$conf->global->MAIN_MAIL_AUTOCOPY_ORDER_TO; + if (! empty($conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO) && ! empty($this->param['models']) && $this->param['models'] == 'facture_send') $showinfobcc=$conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO; + if ($showinfobcc) $out.=' + '.$showinfobcc; $out.= "\n"; } @@ -474,7 +479,11 @@ class FormMail } else { - $out.= $form->selectyesno('deliveryreceipt', (isset($_POST["deliveryreceipt"])?$_POST["deliveryreceipt"]:0), 1); + $defaultvaluefordeliveryreceipt=0; + if (! empty($conf->global->MAIL_FORCE_DELIVERY_RECEIPT_PROPAL) && ! empty($this->param['models']) && $this->param['models'] == 'propal_send') $defaultvaluefordeliveryreceipt=1; + if (! empty($conf->global->MAIL_FORCE_DELIVERY_RECEIPT_ORDER) && ! empty($this->param['models']) && $this->param['models'] == 'order_send') $defaultvaluefordeliveryreceipt=1; + if (! empty($conf->global->MAIL_FORCE_DELIVERY_RECEIPT_INVOICE) && ! empty($this->param['models']) && $this->param['models'] == 'facture_send') $defaultvaluefordeliveryreceipt=1; + $out.= $form->selectyesno('deliveryreceipt', (isset($_POST["deliveryreceipt"])?$_POST["deliveryreceipt"]:$defaultvaluefordeliveryreceipt), 1); } $out.= "\n"; @@ -554,17 +563,30 @@ class FormMail if (! empty($this->withbody)) { $defaultmessage=""; + + // Define output language + $outputlangs = $langs; + $newlang = ''; + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) + $newlang = $this->param['langsmodels']; + + if (! empty($newlang)) { + $outputlangs = new Translate("", $conf); + $outputlangs->setDefaultLang($newlang); + $outputlangs->load('other'); + } + // TODO A partir du type, proposer liste de messages dans table llx_c_email_template - if ($this->param["models"]=='facture_send') { $defaultmessage=$langs->transnoentities("PredefinedMailContentSendInvoice"); } - elseif ($this->param["models"]=='facture_relance') { $defaultmessage=$langs->transnoentities("PredefinedMailContentSendInvoiceReminder"); } - elseif ($this->param["models"]=='propal_send') { $defaultmessage=$langs->transnoentities("PredefinedMailContentSendProposal"); } - elseif ($this->param["models"]=='order_send') { $defaultmessage=$langs->transnoentities("PredefinedMailContentSendOrder"); } - elseif ($this->param["models"]=='order_supplier_send') { $defaultmessage=$langs->transnoentities("PredefinedMailContentSendSupplierOrder"); } - elseif ($this->param["models"]=='invoice_supplier_send') { $defaultmessage=$langs->transnoentities("PredefinedMailContentSendSupplierInvoice"); } - elseif ($this->param["models"]=='shipping_send') { $defaultmessage=$langs->transnoentities("PredefinedMailContentSendShipping"); } - elseif ($this->param["models"]=='fichinter_send') { $defaultmessage=$langs->transnoentities("PredefinedMailContentSendFichInter"); } - elseif ($this->param["models"]=='thirdparty') { $defaultmessage=$langs->transnoentities("PredefinedMailContentThirdparty"); } + if ($this->param["models"]=='facture_send') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentSendInvoice"); } + elseif ($this->param["models"]=='facture_relance') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentSendInvoiceReminder"); } + elseif ($this->param["models"]=='propal_send') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentSendProposal"); } + elseif ($this->param["models"]=='order_send') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentSendOrder"); } + elseif ($this->param["models"]=='order_supplier_send') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentSendSupplierOrder"); } + elseif ($this->param["models"]=='invoice_supplier_send') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentSendSupplierInvoice"); } + elseif ($this->param["models"]=='shipping_send') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentSendShipping"); } + elseif ($this->param["models"]=='fichinter_send') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentSendFichInter"); } + elseif ($this->param["models"]=='thirdparty') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentThirdparty"); } elseif (! is_numeric($this->withbody)) { $defaultmessage=$this->withbody; } // Complete substitution array diff --git a/htdocs/core/class/html.formmailing.class.php b/htdocs/core/class/html.formmailing.class.php new file mode 100644 index 00000000000..98a76c84686 --- /dev/null +++ b/htdocs/core/class/html.formmailing.class.php @@ -0,0 +1,84 @@ +. +*/ + +/** + * \file htdocs/core/class/html.formmailing.class.php + * \ingroup core + * \brief File of predefined functions for HTML forms for mailing module + */ +require_once DOL_DOCUMENT_ROOT .'/core/class/html.form.class.php'; + +/** + * Class to offer components to list and upload files + */ +class FormMailing extends Form +{ + public $db; + public $error; + public $errors=array(); + + + /** + * Constructor + * + * @param DoliDB $db Database handler + */ + function __construct($db) + { + $this->db = $db; + return 1; + } + + /** + * Output a select with destinaries status + * + * @param string $selectedid the selected id + * @param string $htmlname name of controm + * @param number $show_empty show empty option + * @return string HTML select + */ + public function selectDestinariesStatus($selectedid='',$htmlname='dest_status', $show_empty=0) { + + global $langs; + $langs->load("mails"); + + require_once DOL_DOCUMENT_ROOT.'/comm/mailing/class/mailing.class.php'; + $mailing = new Mailing($this->db); + + + $array = $mailing->statut_dest; + //Cannot use form->selectarray because empty value is defaulted to -1 in this method and we use here status -1... + + $out = ''; + return $out; + } +} \ No newline at end of file diff --git a/htdocs/core/class/html.formorder.class.php b/htdocs/core/class/html.formorder.class.php index 6bc626b13f3..5ea5b33c1f4 100644 --- a/htdocs/core/class/html.formorder.class.php +++ b/htdocs/core/class/html.formorder.class.php @@ -116,7 +116,7 @@ class FormOrder $sql.= " FROM ".MAIN_DB_PREFIX."c_input_method"; $sql.= " WHERE active = 1"; - dol_syslog(get_class($this)."::selectInputMethod sql=".$sql); + dol_syslog(get_class($this)."::selectInputMethod", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index fe1cd8ddb6b..968dcd3856e 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -164,12 +164,12 @@ class FormOther global $langs; $sql = "SELECT e.rowid, e.code, e.libelle, e.price, e.organization,"; - $sql.= " p.libelle as pays"; - $sql.= " FROM ".MAIN_DB_PREFIX."c_ecotaxe as e,".MAIN_DB_PREFIX."c_pays as p"; - $sql.= " WHERE e.active = 1 AND e.fk_pays = p.rowid"; - $sql.= " ORDER BY pays, e.organization ASC, e.code ASC"; + $sql.= " c.label as country"; + $sql.= " FROM ".MAIN_DB_PREFIX."c_ecotaxe as e,".MAIN_DB_PREFIX."c_country as c"; + $sql.= " WHERE e.active = 1 AND e.fk_pays = c.rowid"; + $sql.= " ORDER BY country, e.organization ASC, e.code ASC"; - dol_syslog(get_class($this).'::select_ecotaxes sql='.$sql); + dol_syslog(get_class($this).'::select_ecotaxes', LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -223,11 +223,11 @@ class FormOther $out=''; $sql = "SELECT r.taux"; - $sql.= " FROM ".MAIN_DB_PREFIX."c_revenuestamp as r,".MAIN_DB_PREFIX."c_pays as p"; - $sql.= " WHERE r.active = 1 AND r.fk_pays = p.rowid"; - $sql.= " AND p.code = '".$country_code."'"; + $sql.= " FROM ".MAIN_DB_PREFIX."c_revenuestamp as r,".MAIN_DB_PREFIX."c_country as c"; + $sql.= " WHERE r.active = 1 AND r.fk_pays = c.rowid"; + $sql.= " AND c.code = '".$country_code."'"; - dol_syslog(get_class($this).'::select_revenue_stamp sql='.$sql); + dol_syslog(get_class($this).'::select_revenue_stamp', LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -491,7 +491,7 @@ class FormOther { if ($lines[$i]->fk_project != $lastprojectid) // Break found on project { - if ($i > 0 && $conf->browser->firefox) print ''; + if ($i > 0) print ''; print ''; @@ -1138,7 +1138,7 @@ class FormOther $sql.= " FROM ".MAIN_DB_PREFIX.$dictionarytable; $sql.= " ORDER BY ".$labelfield; - dol_syslog(get_class($this)."::select_dictionary sql=".$sql); + dol_syslog(get_class($this)."::select_dictionary", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { diff --git a/htdocs/core/class/html.formprojet.class.php b/htdocs/core/class/html.formprojet.class.php index 8d479e89e44..4042bb16e31 100644 --- a/htdocs/core/class/html.formprojet.class.php +++ b/htdocs/core/class/html.formprojet.class.php @@ -80,7 +80,7 @@ class FormProjets if ($socid > 0) $sql.= " AND (p.fk_soc=".$socid." OR p.fk_soc IS NULL)"; $sql.= " ORDER BY p.ref ASC"; - dol_syslog(get_class($this)."::select_projects sql=".$sql,LOG_DEBUG); + dol_syslog(get_class($this)."::select_projects", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -109,7 +109,7 @@ class FormProjets //else $labeltoshow.=' ('.$langs->trans("Private").')'; if (!empty($selected) && $selected == $obj->rowid && $obj->fk_statut > 0) { - $out.= ''; + $out.= ''; } else { @@ -201,7 +201,7 @@ class FormProjets $sql.= ' AND entity='.getEntity('project'); $sql.= " ORDER BY ref DESC"; - dol_syslog(get_class($this).'::select_element sql='.$sql,LOG_DEBUG); + dol_syslog(get_class($this).'::select_element', LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) diff --git a/htdocs/core/class/html.formpropal.class.php b/htdocs/core/class/html.formpropal.class.php index fcbe46ab51b..df0f2d644dd 100644 --- a/htdocs/core/class/html.formpropal.class.php +++ b/htdocs/core/class/html.formpropal.class.php @@ -56,7 +56,7 @@ class FormPropal $sql = "SELECT id, code, label, active FROM ".MAIN_DB_PREFIX."c_propalst"; $sql .= " WHERE active = 1"; - dol_syslog(get_class($this)."::selectProposalStatus sql=".$sql); + dol_syslog(get_class($this)."::selectProposalStatus", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { diff --git a/htdocs/core/class/html.formsocialcontrib.class.php b/htdocs/core/class/html.formsocialcontrib.class.php index f84f14c1446..abf453cf426 100644 --- a/htdocs/core/class/html.formsocialcontrib.class.php +++ b/htdocs/core/class/html.formsocialcontrib.class.php @@ -73,13 +73,13 @@ class FormSocialContrib else { $sql = "SELECT c.id, c.libelle as type"; - $sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c, ".MAIN_DB_PREFIX."c_pays as p"; - $sql.= " WHERE c.active = 1 AND c.fk_pays = p.rowid"; - $sql.= " AND p.code = '".$mysoc->country_code."'"; + $sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c, ".MAIN_DB_PREFIX."c_country as co"; + $sql.= " WHERE c.active = 1 AND c.fk_pays = co.rowid"; + $sql.= " AND co.code = '".$mysoc->country_code."'"; $sql.= " ORDER BY c.libelle ASC"; } - dol_syslog("Form::select_type_socialcontrib sql=".$sql, LOG_DEBUG); + dol_syslog("Form::select_type_socialcontrib", LOG_DEBUG); $resql=$db->query($sql); if ($resql) { diff --git a/htdocs/core/class/index.html b/htdocs/core/class/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/core/class/index.php b/htdocs/core/class/index.php deleted file mode 100644 index 7db0dd9ebf9..00000000000 --- a/htdocs/core/class/index.php +++ /dev/null @@ -1 +0,0 @@ -Url not available \ No newline at end of file diff --git a/htdocs/core/class/infobox.class.php b/htdocs/core/class/infobox.class.php index c01d2d1f0f5..fdc2d6fbe4f 100644 --- a/htdocs/core/class/infobox.class.php +++ b/htdocs/core/class/infobox.class.php @@ -23,12 +23,19 @@ */ /** - * Class to manage boxes on pages + * Class to manage boxes on pages. This is an utility class (all is static) */ class InfoBox { - static $listOfPages = array(0=>'Home'); // Nom des positions 0=Home, 1=... - + /** + * Name of positions 0=Home, 1=... + * + * @return array Array with list of zones + */ + static function getListOfPagesForBoxes() + { + return array(0=>'Home'); + } /** * Return array of boxes qualified for area and user @@ -73,7 +80,7 @@ class InfoBox } } - dol_syslog(get_class()."::listBoxes get default box list for mode=".$mode." userid=".(is_object($user)?$user->id:'')." sql=".$sql, LOG_DEBUG); + dol_syslog(get_class()."::listBoxes get default box list for mode=".$mode." userid=".(is_object($user)?$user->id:'')."", LOG_DEBUG); $resql = $db->query($sql); if ($resql) { @@ -137,12 +144,12 @@ class InfoBox $arrayelem=explode('|',$moduleelem); $tmpenabled=0; // $tmpenabled is used for the '|' test (OR) foreach($arrayelem as $module) - { + { $tmpmodule=preg_replace('/@[^@]+/','',$module); - if (! empty($conf->$tmpmodule->enabled)) $tmpenabled=1; + if (! empty($conf->$tmpmodule->enabled)) $tmpenabled=1; //print $boxname.'-'.$module.'-module enabled='.(empty($conf->$tmpmodule->enabled)?0:1).'
'; } - if (empty($tmpenabled)) // We found at least one module required that disabled + if (empty($tmpenabled)) // We found at least one module required that disabled { $enabled=0; break; @@ -150,7 +157,7 @@ class InfoBox } } //print '=>'.$boxname.'-enabled='.$enabled.'
'; - + //print 'xx module='.$module.' enabled='.$enabled; if ($enabled) $boxes[]=$box; else unset($box); @@ -163,7 +170,6 @@ class InfoBox { //dol_print_error($db); $error=$db->lasterror(); - dol_syslog(get_class()."::listBoxes Error ".$error, LOG_ERR); } return $boxes; @@ -212,7 +218,7 @@ class InfoBox $sql.= " AND fk_user = ".$userid; $sql.= " AND position = ".$zone; - dol_syslog(get_class()."::saveboxorder sql=".$sql); + dol_syslog(get_class()."::saveboxorder", LOG_DEBUG); $result = $db->query($sql); if ($result) { @@ -243,7 +249,7 @@ class InfoBox $sql.= " ".$conf->entity; $sql.= ")"; - dol_syslog(get_class()."::saveboxorder sql=".$sql); + dol_syslog(get_class()."::saveboxorder", LOG_DEBUG); $result = $db->query($sql); if ($result < 0) { diff --git a/htdocs/core/class/interfaces.class.php b/htdocs/core/class/interfaces.class.php index 51d5456ec28..50a9cced421 100644 --- a/htdocs/core/class/interfaces.class.php +++ b/htdocs/core/class/interfaces.class.php @@ -23,6 +23,7 @@ * \brief Fichier de la classe de gestion des triggers */ +require_once DOL_DOCUMENT_ROOT.'/core/triggers/DolibarrTriggers.class.php'; /** * Class to manage triggers @@ -148,9 +149,23 @@ class Interfaces $objMod = new $modName($this->db); if ($objMod) { - dol_syslog(get_class($this)."::run_triggers action=".$action." Launch triggers for file '".$files[$key]."'", LOG_INFO); + $result=0; + + if (method_exists($objMod, 'runTrigger')) // New method to implement + { + dol_syslog(get_class($this)."::run_triggers action=".$action." Launch runTrigger for file '".$files[$key]."'", LOG_INFO); + $result=$objMod->runTrigger($action,$object,$user,$langs,$conf); + } + elseif (method_exists($objMod, 'run_trigger')) // Deprecated method + { + dol_syslog(get_class($this)."::run_triggers action=".$action." Launch run_trigger for file '".$files[$key]."'", LOG_INFO); + $result=$objMod->run_trigger($action,$object,$user,$langs,$conf); + } + else + { + dol_syslog(get_class($this)."::run_triggers action=".$action." A trigger was declared for class ".get_class($objMod)." but method runTrigger was not found", LOG_ERR); + } - $result=$objMod->run_trigger($action,$object,$user,$langs,$conf); if ($result > 0) { // Action OK @@ -172,7 +187,7 @@ class Interfaces } } else - { + { dol_syslog(get_class($this)."::run_triggers action=".$action." Failed to instantiate trigger for file '".$files[$key]."'", LOG_ERR); } } diff --git a/htdocs/core/class/link.class.php b/htdocs/core/class/link.class.php index 08d520d519e..0c7d52f9569 100644 --- a/htdocs/core/class/link.class.php +++ b/htdocs/core/class/link.class.php @@ -93,21 +93,16 @@ class Link extends CommonObject $sql .= ", '" . $this->objecttype . "'"; $sql .= ", " . $this->objectid . ")"; - dol_syslog(get_class($this)."::create sql=".$sql); + dol_syslog(get_class($this)."::create", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . "links"); if ($this->id > 0) { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('LINK_CREATE', $this, $user, $langs, $conf); - if ($result < 0) { - $error++; - $this->errors = $interface->errors; - } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('LINK_CREATE',$user); + if ($result < 0) $error++; + // End call triggers } else { $error++; } @@ -136,7 +131,6 @@ class Link extends CommonObject else { $this->error=$this->db->lasterror(); - dol_syslog(get_class($this)."::Create fails insert sql=".$sql, LOG_ERR); $result=-2; } $this->db->rollback(); @@ -191,15 +185,10 @@ class Link extends CommonObject { if ($call_trigger) { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface = new Interfaces($this->db); - $result = $interface->run_triggers('LINK_MODIFY', $this, $user, $langs, $conf); - if ($result < 0) { - $error++; - $this->errors = $interface->errors; - } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('LINK_MODIFY',$user); + if ($result < 0) $error++; + // End call triggers } if (! $error) @@ -223,7 +212,6 @@ class Link extends CommonObject else { $this->error = $langs->trans("Error sql = " . $sql); - dol_syslog(get_class($this) . "::Update fails update = " . $this->error, LOG_ERR); $result = -2; } $this->db->rollback(); @@ -256,7 +244,7 @@ class Link extends CommonObject $sql .= " ORDER BY " . $sortfield . " " . $sortorder; } - dol_syslog(get_class($this)."::fetchAll sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetchAll", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -281,7 +269,6 @@ class Link extends CommonObject return 0; } } else { - dol_syslog(get_class($this) . "::FetchAll fails sql=" . $sql, LOG_ERR); return -1; } } @@ -305,7 +292,7 @@ class Link extends CommonObject $sql .= " WHERE rowid = " . $rowid; if($conf->entity != 0) $sql .= " AND entity = " . $conf->entity; - dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -326,7 +313,6 @@ class Link extends CommonObject } } else { $this->error=$this->db->lasterror(); - dol_syslog($this->error, LOG_ERR); return -1; } } @@ -343,33 +329,25 @@ class Link extends CommonObject dol_syslog(get_class($this)."::delete", LOG_DEBUG); $error = 0; + // Call trigger + $result=$this->call_trigger('LINK_DELETE',$user); + if ($result < 0) return -1; + // End call triggers + $this->db->begin(); // Remove link $sql = "DELETE FROM " . MAIN_DB_PREFIX . "links"; $sql.= " WHERE rowid = " . $this->id; - dol_syslog(get_class($this)."::delete sql=" . $sql, LOG_DEBUG); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); if (! $this->db->query($sql)) { $error++; $this->error = $this->db->lasterror(); - dol_syslog(get_class($this)."::delete error -4 " . $this->error, LOG_ERR); } - if (! $error) { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result = $interface->run_triggers('LINK_DELETE', $this, $user, $langs, $conf); - if ($result < 0) { - $error++; - $this->errors = $interface->errors; - } - // Fin appel triggers - } - if (! $error) { $this->db->commit(); diff --git a/htdocs/core/class/menubase.class.php b/htdocs/core/class/menubase.class.php index 966b9ac7f77..aa43c545c8d 100644 --- a/htdocs/core/class/menubase.class.php +++ b/htdocs/core/class/menubase.class.php @@ -162,7 +162,7 @@ class Menubase $sql.= " '".$this->user."'"; $sql.= ")"; - dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::create", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -174,7 +174,6 @@ class Menubase else { $this->error="Error ".$this->db->lasterror(); - dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR); return -1; } } @@ -232,12 +231,11 @@ class Menubase $sql.= " usertype='".$this->user."'"; $sql.= " WHERE rowid=".$this->id; - dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $this->error="Error ".$this->db->lasterror(); - dol_syslog(get_class($this)."::update ".$this->error, LOG_ERR); return -1; } @@ -277,7 +275,7 @@ class Menubase $sql.= " FROM ".MAIN_DB_PREFIX."menu as t"; $sql.= " WHERE t.rowid = ".$id; - dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -311,7 +309,6 @@ class Menubase else { $this->error="Error ".$this->db->lasterror(); - dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR); return -1; } } @@ -330,12 +327,11 @@ class Menubase $sql = "DELETE FROM ".MAIN_DB_PREFIX."menu"; $sql.= " WHERE rowid=".$this->id; - dol_syslog(get_class($this)."::delete sql=".$sql); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $this->error="Error ".$this->db->lasterror(); - dol_syslog(get_class($this)."::delete ".$this->error, LOG_ERR); return -1; } @@ -516,7 +512,7 @@ class Menubase //$tmp1=dol_microtime_float(); //print '>>> 1 0
'; - dol_syslog(get_class($this)."::menuLoad mymainmenu=".$mymainmenu." myleftmenu=".$myleftmenu." type_user=".$type_user." menu_handler=".$menu_handler." tabMenu size=".count($tabMenu)." sql=".$sql); + dol_syslog(get_class($this)."::menuLoad mymainmenu=".$mymainmenu." myleftmenu=".$myleftmenu." type_user=".$type_user." menu_handler=".$menu_handler." tabMenu size=".count($tabMenu)."", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { diff --git a/htdocs/core/class/mobiledetect.class.php b/htdocs/core/class/mobiledetect.class.php new file mode 100644 index 00000000000..107a13f47e3 --- /dev/null +++ b/htdocs/core/class/mobiledetect.class.php @@ -0,0 +1,1252 @@ +, Nick Ilyin + * Original author: Victor Stanciu + * + * @license Code and contributions have 'MIT License' + * More details: https://github.com/serbanghita/Mobile-Detect/blob/master/LICENSE.txt + * + * @link Homepage: http://mobiledetect.net + * GitHub Repo: https://github.com/serbanghita/Mobile-Detect + * Google Code: http://code.google.com/p/php-mobile-detect/ + * README: https://github.com/serbanghita/Mobile-Detect/blob/master/README.md + * HOWTO: https://github.com/serbanghita/Mobile-Detect/wiki/Code-examples + * + * @version 2.8.3 + */ + +/** + * Class to manage detection of type of terminal (classic, tablet, mobile) + */ +class MobileDetect +{ + /** + * Mobile detection type. + * + * @deprecated since version 2.6.9 + */ + const DETECTION_TYPE_MOBILE = 'mobile'; + + /** + * Extended detection type. + * + * @deprecated since version 2.6.9 + */ + const DETECTION_TYPE_EXTENDED = 'extended'; + + /** + * A frequently used regular expression to extract version #s. + * + * @deprecated since version 2.6.9 + */ + const VER = '([\w._\+]+)'; + + /** + * Top-level device. + */ + const MOBILE_GRADE_A = 'A'; + + /** + * Mid-level device. + */ + const MOBILE_GRADE_B = 'B'; + + /** + * Low-level device. + */ + const MOBILE_GRADE_C = 'C'; + + /** + * Stores the version number of the current release. + */ + const VERSION = '2.8.3'; + + /** + * A type for the version() method indicating a string return value. + */ + const VERSION_TYPE_STRING = 'text'; + + /** + * A type for the version() method indicating a float return value. + */ + const VERSION_TYPE_FLOAT = 'float'; + + /** + * The User-Agent HTTP header is stored in here. + * @var string + */ + protected $userAgent = null; + + /** + * HTTP headers in the PHP-flavor. So HTTP_USER_AGENT and SERVER_SOFTWARE. + * @var array + */ + protected $httpHeaders = array(); + + /** + * The detection type, using self::DETECTION_TYPE_MOBILE or self::DETECTION_TYPE_EXTENDED. + * + * @deprecated since version 2.6.9 + * + * @var string + */ + protected $detectionType = self::DETECTION_TYPE_MOBILE; + + /** + * HTTP headers that trigger the 'isMobile' detection + * to be true. + * + * @var array + */ + protected static $mobileHeaders = array( + + 'HTTP_ACCEPT' => array('matches' => array( + // Opera Mini; @reference: http://dev.opera.com/articles/view/opera-binary-markup-language/ + 'application/x-obml2d', + // BlackBerry devices. + 'application/vnd.rim.html', + 'text/vnd.wap.wml', + 'application/vnd.wap.xhtml+xml' + )), + 'HTTP_X_WAP_PROFILE' => null, + 'HTTP_X_WAP_CLIENTID' => null, + 'HTTP_WAP_CONNECTION' => null, + 'HTTP_PROFILE' => null, + // Reported by Opera on Nokia devices (eg. C3). + 'HTTP_X_OPERAMINI_PHONE_UA' => null, + 'HTTP_X_NOKIA_GATEWAY_ID' => null, + 'HTTP_X_ORANGE_ID' => null, + 'HTTP_X_VODAFONE_3GPDPCONTEXT' => null, + 'HTTP_X_HUAWEI_USERID' => null, + // Reported by Windows Smartphones. + 'HTTP_UA_OS' => null, + // Reported by Verizon, Vodafone proxy system. + 'HTTP_X_MOBILE_GATEWAY' => null, + // Seend this on HTC Sensation. @ref: SensationXE_Beats_Z715e. + 'HTTP_X_ATT_DEVICEID' => null, + // Seen this on a HTC. + 'HTTP_UA_CPU' => array('matches' => array('ARM')), + ); + + /** + * List of mobile devices (phones). + * + * @var array + */ + protected static $phoneDevices = array( + 'iPhone' => '\biPhone.*(Mobile|PhoneGap)|\biPod', // |\biTunes + 'BlackBerry' => 'BlackBerry|\bBB10\b|rim[0-9]+', + 'HTC' => 'HTC|HTC.*(Sensation|Evo|Vision|Explorer|6800|8100|8900|A7272|S510e|C110e|Legend|Desire|T8282)|APX515CKT|Qtek9090|APA9292KT|HD_mini|Sensation.*Z710e|PG86100|Z715e|Desire.*(A8181|HD)|ADR6200|ADR6400L|ADR6425|001HT|Inspire 4G|Android.*\bEVO\b|T-Mobile G1|Z520m', + 'Nexus' => 'Nexus One|Nexus S|Galaxy.*Nexus|Android.*Nexus.*Mobile', + // @todo: Is 'Dell Streak' a tablet or a phone? ;) + 'Dell' => 'Dell.*Streak|Dell.*Aero|Dell.*Venue|DELL.*Venue Pro|Dell Flash|Dell Smoke|Dell Mini 3iX|XCD28|XCD35|\b001DL\b|\b101DL\b|\bGS01\b', + 'Motorola' => 'Motorola|DROIDX|DROID BIONIC|\bDroid\b.*Build|Android.*Xoom|HRI39|MOT-|A1260|A1680|A555|A853|A855|A953|A955|A956|Motorola.*ELECTRIFY|Motorola.*i1|i867|i940|MB200|MB300|MB501|MB502|MB508|MB511|MB520|MB525|MB526|MB611|MB612|MB632|MB810|MB855|MB860|MB861|MB865|MB870|ME501|ME502|ME511|ME525|ME600|ME632|ME722|ME811|ME860|ME863|ME865|MT620|MT710|MT716|MT720|MT810|MT870|MT917|Motorola.*TITANIUM|WX435|WX445|XT300|XT301|XT311|XT316|XT317|XT319|XT320|XT390|XT502|XT530|XT531|XT532|XT535|XT603|XT610|XT611|XT615|XT681|XT701|XT702|XT711|XT720|XT800|XT806|XT860|XT862|XT875|XT882|XT883|XT894|XT901|XT907|XT909|XT910|XT912|XT928|XT926|XT915|XT919|XT925', + 'Samsung' => 'Samsung|SGH-I337|BGT-S5230|GT-B2100|GT-B2700|GT-B2710|GT-B3210|GT-B3310|GT-B3410|GT-B3730|GT-B3740|GT-B5510|GT-B5512|GT-B5722|GT-B6520|GT-B7300|GT-B7320|GT-B7330|GT-B7350|GT-B7510|GT-B7722|GT-B7800|GT-C3010|GT-C3011|GT-C3060|GT-C3200|GT-C3212|GT-C3212I|GT-C3262|GT-C3222|GT-C3300|GT-C3300K|GT-C3303|GT-C3303K|GT-C3310|GT-C3322|GT-C3330|GT-C3350|GT-C3500|GT-C3510|GT-C3530|GT-C3630|GT-C3780|GT-C5010|GT-C5212|GT-C6620|GT-C6625|GT-C6712|GT-E1050|GT-E1070|GT-E1075|GT-E1080|GT-E1081|GT-E1085|GT-E1087|GT-E1100|GT-E1107|GT-E1110|GT-E1120|GT-E1125|GT-E1130|GT-E1160|GT-E1170|GT-E1175|GT-E1180|GT-E1182|GT-E1200|GT-E1210|GT-E1225|GT-E1230|GT-E1390|GT-E2100|GT-E2120|GT-E2121|GT-E2152|GT-E2220|GT-E2222|GT-E2230|GT-E2232|GT-E2250|GT-E2370|GT-E2550|GT-E2652|GT-E3210|GT-E3213|GT-I5500|GT-I5503|GT-I5700|GT-I5800|GT-I5801|GT-I6410|GT-I6420|GT-I7110|GT-I7410|GT-I7500|GT-I8000|GT-I8150|GT-I8160|GT-I8190|GT-I8320|GT-I8330|GT-I8350|GT-I8530|GT-I8700|GT-I8703|GT-I8910|GT-I9000|GT-I9001|GT-I9003|GT-I9010|GT-I9020|GT-I9023|GT-I9070|GT-I9082|GT-I9100|GT-I9103|GT-I9220|GT-I9250|GT-I9300|GT-I9305|GT-I9500|GT-I9505|GT-M3510|GT-M5650|GT-M7500|GT-M7600|GT-M7603|GT-M8800|GT-M8910|GT-N7000|GT-S3110|GT-S3310|GT-S3350|GT-S3353|GT-S3370|GT-S3650|GT-S3653|GT-S3770|GT-S3850|GT-S5210|GT-S5220|GT-S5229|GT-S5230|GT-S5233|GT-S5250|GT-S5253|GT-S5260|GT-S5263|GT-S5270|GT-S5300|GT-S5330|GT-S5350|GT-S5360|GT-S5363|GT-S5369|GT-S5380|GT-S5380D|GT-S5560|GT-S5570|GT-S5600|GT-S5603|GT-S5610|GT-S5620|GT-S5660|GT-S5670|GT-S5690|GT-S5750|GT-S5780|GT-S5830|GT-S5839|GT-S6102|GT-S6500|GT-S7070|GT-S7200|GT-S7220|GT-S7230|GT-S7233|GT-S7250|GT-S7500|GT-S7530|GT-S7550|GT-S7562|GT-S7710|GT-S8000|GT-S8003|GT-S8500|GT-S8530|GT-S8600|SCH-A310|SCH-A530|SCH-A570|SCH-A610|SCH-A630|SCH-A650|SCH-A790|SCH-A795|SCH-A850|SCH-A870|SCH-A890|SCH-A930|SCH-A950|SCH-A970|SCH-A990|SCH-I100|SCH-I110|SCH-I400|SCH-I405|SCH-I500|SCH-I510|SCH-I515|SCH-I600|SCH-I730|SCH-I760|SCH-I770|SCH-I830|SCH-I910|SCH-I920|SCH-I959|SCH-LC11|SCH-N150|SCH-N300|SCH-R100|SCH-R300|SCH-R351|SCH-R400|SCH-R410|SCH-T300|SCH-U310|SCH-U320|SCH-U350|SCH-U360|SCH-U365|SCH-U370|SCH-U380|SCH-U410|SCH-U430|SCH-U450|SCH-U460|SCH-U470|SCH-U490|SCH-U540|SCH-U550|SCH-U620|SCH-U640|SCH-U650|SCH-U660|SCH-U700|SCH-U740|SCH-U750|SCH-U810|SCH-U820|SCH-U900|SCH-U940|SCH-U960|SCS-26UC|SGH-A107|SGH-A117|SGH-A127|SGH-A137|SGH-A157|SGH-A167|SGH-A177|SGH-A187|SGH-A197|SGH-A227|SGH-A237|SGH-A257|SGH-A437|SGH-A517|SGH-A597|SGH-A637|SGH-A657|SGH-A667|SGH-A687|SGH-A697|SGH-A707|SGH-A717|SGH-A727|SGH-A737|SGH-A747|SGH-A767|SGH-A777|SGH-A797|SGH-A817|SGH-A827|SGH-A837|SGH-A847|SGH-A867|SGH-A877|SGH-A887|SGH-A897|SGH-A927|SGH-B100|SGH-B130|SGH-B200|SGH-B220|SGH-C100|SGH-C110|SGH-C120|SGH-C130|SGH-C140|SGH-C160|SGH-C170|SGH-C180|SGH-C200|SGH-C207|SGH-C210|SGH-C225|SGH-C230|SGH-C417|SGH-C450|SGH-D307|SGH-D347|SGH-D357|SGH-D407|SGH-D415|SGH-D780|SGH-D807|SGH-D980|SGH-E105|SGH-E200|SGH-E315|SGH-E316|SGH-E317|SGH-E335|SGH-E590|SGH-E635|SGH-E715|SGH-E890|SGH-F300|SGH-F480|SGH-I200|SGH-I300|SGH-I320|SGH-I550|SGH-I577|SGH-I600|SGH-I607|SGH-I617|SGH-I627|SGH-I637|SGH-I677|SGH-I700|SGH-I717|SGH-I727|SGH-i747M|SGH-I777|SGH-I780|SGH-I827|SGH-I847|SGH-I857|SGH-I896|SGH-I897|SGH-I900|SGH-I907|SGH-I917|SGH-I927|SGH-I937|SGH-I997|SGH-J150|SGH-J200|SGH-L170|SGH-L700|SGH-M110|SGH-M150|SGH-M200|SGH-N105|SGH-N500|SGH-N600|SGH-N620|SGH-N625|SGH-N700|SGH-N710|SGH-P107|SGH-P207|SGH-P300|SGH-P310|SGH-P520|SGH-P735|SGH-P777|SGH-Q105|SGH-R210|SGH-R220|SGH-R225|SGH-S105|SGH-S307|SGH-T109|SGH-T119|SGH-T139|SGH-T209|SGH-T219|SGH-T229|SGH-T239|SGH-T249|SGH-T259|SGH-T309|SGH-T319|SGH-T329|SGH-T339|SGH-T349|SGH-T359|SGH-T369|SGH-T379|SGH-T409|SGH-T429|SGH-T439|SGH-T459|SGH-T469|SGH-T479|SGH-T499|SGH-T509|SGH-T519|SGH-T539|SGH-T559|SGH-T589|SGH-T609|SGH-T619|SGH-T629|SGH-T639|SGH-T659|SGH-T669|SGH-T679|SGH-T709|SGH-T719|SGH-T729|SGH-T739|SGH-T746|SGH-T749|SGH-T759|SGH-T769|SGH-T809|SGH-T819|SGH-T839|SGH-T919|SGH-T929|SGH-T939|SGH-T959|SGH-T989|SGH-U100|SGH-U200|SGH-U800|SGH-V205|SGH-V206|SGH-X100|SGH-X105|SGH-X120|SGH-X140|SGH-X426|SGH-X427|SGH-X475|SGH-X495|SGH-X497|SGH-X507|SGH-X600|SGH-X610|SGH-X620|SGH-X630|SGH-X700|SGH-X820|SGH-X890|SGH-Z130|SGH-Z150|SGH-Z170|SGH-ZX10|SGH-ZX20|SHW-M110|SPH-A120|SPH-A400|SPH-A420|SPH-A460|SPH-A500|SPH-A560|SPH-A600|SPH-A620|SPH-A660|SPH-A700|SPH-A740|SPH-A760|SPH-A790|SPH-A800|SPH-A820|SPH-A840|SPH-A880|SPH-A900|SPH-A940|SPH-A960|SPH-D600|SPH-D700|SPH-D710|SPH-D720|SPH-I300|SPH-I325|SPH-I330|SPH-I350|SPH-I500|SPH-I600|SPH-I700|SPH-L700|SPH-M100|SPH-M220|SPH-M240|SPH-M300|SPH-M305|SPH-M320|SPH-M330|SPH-M350|SPH-M360|SPH-M370|SPH-M380|SPH-M510|SPH-M540|SPH-M550|SPH-M560|SPH-M570|SPH-M580|SPH-M610|SPH-M620|SPH-M630|SPH-M800|SPH-M810|SPH-M850|SPH-M900|SPH-M910|SPH-M920|SPH-M930|SPH-N100|SPH-N200|SPH-N240|SPH-N300|SPH-N400|SPH-Z400|SWC-E100|SCH-i909|GT-N7100|GT-N7105|SCH-I535|SM-N900A|SGH-I317|SGH-T999L|GT-S5360B|GT-I8262|GT-S6802|GT-S6312|GT-S6310|GT-S5312|GT-S5310|GT-I9105|GT-I8510|GT-S6790N|SM-G7105|SM-N9005|GT-S5301|GT-I9295|GT-I9195|SM-C101|GT-S7392|GT-S7560|GT-B7610|GT-I5510|GT-S7582|GT-S7530E', + 'LG' => '\bLG\b;|LG[- ]?(C800|C900|E400|E610|E900|E-900|F160|F180K|F180L|F180S|730|855|L160|LS840|LS970|LU6200|MS690|MS695|MS770|MS840|MS870|MS910|P500|P700|P705|VM696|AS680|AS695|AX840|C729|E970|GS505|272|C395|E739BK|E960|L55C|L75C|LS696|LS860|P769BK|P350|P500|P509|P870|UN272|US730|VS840|VS950|LN272|LN510|LS670|LS855|LW690|MN270|MN510|P509|P769|P930|UN200|UN270|UN510|UN610|US670|US740|US760|UX265|UX840|VN271|VN530|VS660|VS700|VS740|VS750|VS910|VS920|VS930|VX9200|VX11000|AX840A|LW770|P506|P925|P999|E612|D955|D802)', + 'Sony' => 'SonyST|SonyLT|SonyEricsson|SonyEricssonLT15iv|LT18i|E10i|LT28h|LT26w|SonyEricssonMT27i', + 'Asus' => 'Asus.*Galaxy|PadFone.*Mobile', + // @ref: http://www.micromaxinfo.com/mobiles/smartphones + // Added because the codes might conflict with Acer Tablets. + 'Micromax' => 'Micromax.*\b(A210|A92|A88|A72|A111|A110Q|A115|A116|A110|A90S|A26|A51|A35|A54|A25|A27|A89|A68|A65|A57|A90)\b', + 'Palm' => 'PalmSource|Palm', // avantgo|blazer|elaine|hiptop|plucker|xiino ; @todo - complete the regex. + 'Vertu' => 'Vertu|Vertu.*Ltd|Vertu.*Ascent|Vertu.*Ayxta|Vertu.*Constellation(F|Quest)?|Vertu.*Monika|Vertu.*Signature', // Just for fun ;) + // @ref: http://www.pantech.co.kr/en/prod/prodList.do?gbrand=VEGA (PANTECH) + // Most of the VEGA devices are legacy. PANTECH seem to be newer devices based on Android. + 'Pantech' => 'PANTECH|IM-A850S|IM-A840S|IM-A830L|IM-A830K|IM-A830S|IM-A820L|IM-A810K|IM-A810S|IM-A800S|IM-T100K|IM-A725L|IM-A780L|IM-A775C|IM-A770K|IM-A760S|IM-A750K|IM-A740S|IM-A730S|IM-A720L|IM-A710K|IM-A690L|IM-A690S|IM-A650S|IM-A630K|IM-A600S|VEGA PTL21|PT003|P8010|ADR910L|P6030|P6020|P9070|P4100|P9060|P5000|CDM8992|TXT8045|ADR8995|IS11PT|P2030|P6010|P8000|PT002|IS06|CDM8999|P9050|PT001|TXT8040|P2020|P9020|P2000|P7040|P7000|C790', + // @ref: http://www.fly-phone.com/devices/smartphones/ ; Included only smartphones. + 'Fly' => 'IQ230|IQ444|IQ450|IQ440|IQ442|IQ441|IQ245|IQ256|IQ236|IQ255|IQ235|IQ245|IQ275|IQ240|IQ285|IQ280|IQ270|IQ260|IQ250', + 'iMobile' => 'i-mobile (IQ|i-STYLE|idea|ZAA|Hitz)', + // Added simvalley mobile just for fun. They have some interesting devices. + // @ref: http://www.simvalley.fr/telephonie---gps-_22_telephonie-mobile_telephones_.html + 'SimValley' => '\b(SP-80|XT-930|SX-340|XT-930|SX-310|SP-360|SP60|SPT-800|SP-120|SPT-800|SP-140|SPX-5|SPX-8|SP-100|SPX-8|SPX-12)\b', + // @Tapatalk is a mobile app; @ref: http://support.tapatalk.com/threads/smf-2-0-2-os-and-browser-detection-plugin-and-tapatalk.15565/#post-79039 + 'GenericPhone' => 'Tapatalk|PDA;|SAGEM|\bmmp\b|pocket|\bpsp\b|symbian|Smartphone|smartfon|treo|up.browser|up.link|vodafone|\bwap\b|nokia|Series40|Series60|S60|SonyEricsson|N900|MAUI.*WAP.*Browser' + ); + + /** + * List of tablet devices. + * + * @var array + */ + protected static $tabletDevices = array( + 'iPad' => 'iPad|iPad.*Mobile', // @todo: check for mobile friendly emails topic. + 'NexusTablet' => 'Android.*Nexus[\s]+(7|10)|^.*Android.*Nexus(?:(?!Mobile).)*$', + 'SamsungTablet' => 'SAMSUNG.*Tablet|Galaxy.*Tab|SC-01C|GT-P1000|GT-P1003|GT-P1010|GT-P3105|GT-P6210|GT-P6800|GT-P6810|GT-P7100|GT-P7300|GT-P7310|GT-P7500|GT-P7510|SCH-I800|SCH-I815|SCH-I905|SGH-I957|SGH-I987|SGH-T849|SGH-T859|SGH-T869|SPH-P100|GT-P3100|GT-P3108|GT-P3110|GT-P5100|GT-P5110|GT-P6200|GT-P7320|GT-P7511|GT-N8000|GT-P8510|SGH-I497|SPH-P500|SGH-T779|SCH-I705|SCH-I915|GT-N8013|GT-P3113|GT-P5113|GT-P8110|GT-N8010|GT-N8005|GT-N8020|GT-P1013|GT-P6201|GT-P7501|GT-N5100|GT-N5105|GT-N5110|SHV-E140K|SHV-E140L|SHV-E140S|SHV-E150S|SHV-E230K|SHV-E230L|SHV-E230S|SHW-M180K|SHW-M180L|SHW-M180S|SHW-M180W|SHW-M300W|SHW-M305W|SHW-M380K|SHW-M380S|SHW-M380W|SHW-M430W|SHW-M480K|SHW-M480S|SHW-M480W|SHW-M485W|SHW-M486W|SHW-M500W|GT-I9228|SCH-P739|SCH-I925|GT-I9200|GT-I9205|GT-P5200|GT-P5210|GT-P5210X|SM-T311|SM-T310|SM-T310X|SM-T210|SM-T210R|SM-T211|SM-P600|SM-P601|SM-P605|SM-P900|SM-P901|SM-T217|SM-T217A|SM-T217S|SM-P6000|SM-T3100|SGH-I467|XE500|SM-T110|GT-P5220|GT-I9200X|GT-N5110X|GT-N5120|SM-P905|SM-T111|SM-T2105|SM-T315|SM-T320|SM-T320X|SM-T321|SM-T520|SM-T525|SM-T530NU|SM-T230NU|SM-T330NU|SM-T900|XE500T1C|SM-P605V|SM-P905V|SM-P600X|SM-P900X|SM-T210X|SM-T230|SM-T230X|SM-T325|GT-P7503|SM-T531|SM-T330|SM-T530|SM-T705C|SM-T535|SM-T331', // SCH-P709|SCH-P729|SM-T2558 - Samsung Mega - treat them like a regular phone. + // @reference: http://www.labnol.org/software/kindle-user-agent-string/20378/ + 'Kindle' => 'Kindle|Silk.*Accelerated|Android.*\b(KFOT|KFTT|KFJWI|KFJWA|KFOTE|KFSOWI|KFTHWI|KFTHWA|KFAPWI|KFAPWA|WFJWAE)\b', + // Only the Surface tablets with Windows RT are considered mobile. + // @ref: http://msdn.microsoft.com/en-us/library/ie/hh920767(v=vs.85).aspx + 'SurfaceTablet' => 'Windows NT [0-9.]+; ARM;', + // @ref: http://shopping1.hp.com/is-bin/INTERSHOP.enfinity/WFS/WW-USSMBPublicStore-Site/en_US/-/USD/ViewStandardCatalog-Browse?CatalogCategoryID=JfIQ7EN5lqMAAAEyDcJUDwMT + 'HPTablet' => 'HP Slate 7|HP ElitePad 900|hp-tablet|EliteBook.*Touch|HP 8', + // @note: watch out for PadFone, see #132 + 'AsusTablet' => '^.*PadFone((?!Mobile).)*$|Transformer|TF101|TF101G|TF300T|TF300TG|TF300TL|TF700T|TF700KL|TF701T|TF810C|ME171|ME301T|ME302C|ME371MG|ME370T|ME372MG|ME172V|ME173X|ME400C|Slider SL101|\bK00F\b|TX201LA', + 'BlackBerryTablet' => 'PlayBook|RIM Tablet', + 'HTCtablet' => 'HTC Flyer|HTC Jetstream|HTC-P715a|HTC EVO View 4G|PG41200', + 'MotorolaTablet' => 'xoom|sholest|MZ615|MZ605|MZ505|MZ601|MZ602|MZ603|MZ604|MZ606|MZ607|MZ608|MZ609|MZ615|MZ616|MZ617', + 'NookTablet' => 'Android.*Nook|NookColor|nook browser|BNRV200|BNRV200A|BNTV250|BNTV250A|BNTV400|BNTV600|LogicPD Zoom2', + // @ref: http://www.acer.ro/ac/ro/RO/content/drivers + // @ref: http://www.packardbell.co.uk/pb/en/GB/content/download (Packard Bell is part of Acer) + // @ref: http://us.acer.com/ac/en/US/content/group/tablets + // @note: Can conflict with Micromax and Motorola phones codes. + 'AcerTablet' => 'Android.*; \b(A100|A101|A110|A200|A210|A211|A500|A501|A510|A511|A700|A701|W500|W500P|W501|W501P|W510|W511|W700|G100|G100W|B1-A71|B1-710|B1-711|A1-810|A1-830)\b|W3-810|\bA3-A10\b', + // @ref: http://eu.computers.toshiba-europe.com/innovation/family/Tablets/1098744/banner_id/tablet_footerlink/ + // @ref: http://us.toshiba.com/tablets/tablet-finder + // @ref: http://www.toshiba.co.jp/regza/tablet/ + 'ToshibaTablet' => 'Android.*(AT100|AT105|AT200|AT205|AT270|AT275|AT300|AT305|AT1S5|AT500|AT570|AT700|AT830)|TOSHIBA.*FOLIO', + // @ref: http://www.nttdocomo.co.jp/english/service/developer/smart_phone/technical_info/spec/index.html + // @ref: http://www.lg.com/us/tablets + 'LGTablet' => '\bL-06C|LG-V900|LG-V500|LG-V909|LG-V500|LG-V510|LG-VK810\b', + 'FujitsuTablet' => 'Android.*\b(F-01D|F-02F|F-05E|F-10D|M532|Q572)\b', + // Prestigio Tablets http://www.prestigio.com/support + 'PrestigioTablet' => 'PMP3170B|PMP3270B|PMP3470B|PMP7170B|PMP3370B|PMP3570C|PMP5870C|PMP3670B|PMP5570C|PMP5770D|PMP3970B|PMP3870C|PMP5580C|PMP5880D|PMP5780D|PMP5588C|PMP7280C|PMP7280C3G|PMP7280|PMP7880D|PMP5597D|PMP5597|PMP7100D|PER3464|PER3274|PER3574|PER3884|PER5274|PER5474|PMP5097CPRO|PMP5097|PMP7380D|PMP5297C|PMP5297C_QUAD', + // @ref: http://support.lenovo.com/en_GB/downloads/default.page?# + 'LenovoTablet' => 'IdeaTab|ThinkPad([ ]+)?Tablet|Lenovo.*(S2109|S2110|S5000|S6000|K3011|A3000|A1000|A2107|A2109|A1107|B6000|B8000|B8080-F)', + // @ref: http://www.yarvik.com/en/matrix/tablets/ + 'YarvikTablet' => 'Android.*\b(TAB210|TAB211|TAB224|TAB250|TAB260|TAB264|TAB310|TAB360|TAB364|TAB410|TAB411|TAB420|TAB424|TAB450|TAB460|TAB461|TAB464|TAB465|TAB467|TAB468|TAB07-100|TAB07-101|TAB07-150|TAB07-151|TAB07-152|TAB07-200|TAB07-201-3G|TAB07-210|TAB07-211|TAB07-212|TAB07-214|TAB07-220|TAB07-400|TAB07-485|TAB08-150|TAB08-200|TAB08-201-3G|TAB08-201-30|TAB09-100|TAB09-211|TAB09-410|TAB10-150|TAB10-201|TAB10-211|TAB10-400|TAB10-410|TAB13-201|TAB274EUK|TAB275EUK|TAB374EUK|TAB462EUK|TAB474EUK|TAB9-200)\b', + 'MedionTablet' => 'Android.*\bOYO\b|LIFE.*(P9212|P9514|P9516|S9512)|LIFETAB', + 'ArnovaTablet' => 'AN10G2|AN7bG3|AN7fG3|AN8G3|AN8cG3|AN7G3|AN9G3|AN7dG3|AN7dG3ST|AN7dG3ChildPad|AN10bG3|AN10bG3DT', + // http://www.intenso.de/kategorie_en.php?kategorie=33 + // @todo: http://www.nbhkdz.com/read/b8e64202f92a2df129126bff.html - investigate + 'IntensoTablet' => 'INM8002KP|INM1010FP|INM805ND|Intenso Tab', + // IRU.ru Tablets http://www.iru.ru/catalog/soho/planetable/ + 'IRUTablet' => 'M702pro', + 'MegafonTablet' => 'MegaFon V9|\bZTE V9\b|Android.*\bMT7A\b', + // @ref: http://www.e-boda.ro/tablete-pc.html + 'EbodaTablet' => 'E-Boda (Supreme|Impresspeed|Izzycomm|Essential)', + // @ref: http://www.allview.ro/produse/droseries/lista-tablete-pc/ + 'AllViewTablet' => 'Allview.*(Viva|Alldro|City|Speed|All TV|Frenzy|Quasar|Shine|TX1|AX1|AX2)', + // @reference: http://wiki.archosfans.com/index.php?title=Main_Page + 'ArchosTablet' => '\b(101G9|80G9|A101IT)\b|Qilive 97R|ARCHOS 101G10|Archos 101 Neon', + // @ref: http://www.ainol.com/plugin.php?identifier=ainol&module=product + 'AinolTablet' => 'NOVO7|NOVO8|NOVO10|Novo7Aurora|Novo7Basic|NOVO7PALADIN|novo9-Spark', + // @todo: inspect http://esupport.sony.com/US/p/select-system.pl?DIRECTOR=DRIVER + // @ref: Readers http://www.atsuhiro-me.net/ebook/sony-reader/sony-reader-web-browser + // @ref: http://www.sony.jp/support/tablet/ + 'SonyTablet' => 'Sony.*Tablet|Xperia Tablet|Sony Tablet S|SO-03E|SGPT12|SGPT13|SGPT114|SGPT121|SGPT122|SGPT123|SGPT111|SGPT112|SGPT113|SGPT131|SGPT132|SGPT133|SGPT211|SGPT212|SGPT213|SGP311|SGP312|SGP321|EBRD1101|EBRD1102|EBRD1201|SGP351|SGP341|SGP511|SGP512|SGP521|SGP541|SGP551', + // @ref: db + http://www.cube-tablet.com/buy-products.html + 'CubeTablet' => 'Android.*(K8GT|U9GT|U10GT|U16GT|U17GT|U18GT|U19GT|U20GT|U23GT|U30GT)|CUBE U8GT', + // @ref: http://www.cobyusa.com/?p=pcat&pcat_id=3001 + 'CobyTablet' => 'MID1042|MID1045|MID1125|MID1126|MID7012|MID7014|MID7015|MID7034|MID7035|MID7036|MID7042|MID7048|MID7127|MID8042|MID8048|MID8127|MID9042|MID9740|MID9742|MID7022|MID7010', + // @ref: http://www.match.net.cn/products.asp + 'MIDTablet' => 'M9701|M9000|M9100|M806|M1052|M806|T703|MID701|MID713|MID710|MID727|MID760|MID830|MID728|MID933|MID125|MID810|MID732|MID120|MID930|MID800|MID731|MID900|MID100|MID820|MID735|MID980|MID130|MID833|MID737|MID960|MID135|MID860|MID736|MID140|MID930|MID835|MID733', + // @ref: http://pdadb.net/index.php?m=pdalist&list=SMiT (NoName Chinese Tablets) + // @ref: http://www.imp3.net/14/show.php?itemid=20454 + 'SMiTTablet' => 'Android.*(\bMID\b|MID-560|MTV-T1200|MTV-PND531|MTV-P1101|MTV-PND530)', + // @ref: http://www.rock-chips.com/index.php?do=prod&pid=2 + 'RockChipTablet' => 'Android.*(RK2818|RK2808A|RK2918|RK3066)|RK2738|RK2808A', + // @ref: http://www.fly-phone.com/devices/tablets/ ; http://www.fly-phone.com/service/ + 'FlyTablet' => 'IQ310|Fly Vision', + // @ref: http://www.bqreaders.com/gb/tablets-prices-sale.html + 'bqTablet' => 'bq.*(Elcano|Curie|Edison|Maxwell|Kepler|Pascal|Tesla|Hypatia|Platon|Newton|Livingstone|Cervantes|Avant)|Maxwell.*Lite|Maxwell.*Plus', + // @ref: http://www.huaweidevice.com/worldwide/productFamily.do?method=index&directoryId=5011&treeId=3290 + // @ref: http://www.huaweidevice.com/worldwide/downloadCenter.do?method=index&directoryId=3372&treeId=0&tb=1&type=software (including legacy tablets) + 'HuaweiTablet' => 'MediaPad|MediaPad 7 Youth|IDEOS S7|S7-201c|S7-202u|S7-101|S7-103|S7-104|S7-105|S7-106|S7-201|S7-Slim', + // Nec or Medias Tab + 'NecTablet' => '\bN-06D|\bN-08D', + // Pantech Tablets: http://www.pantechusa.com/phones/ + 'PantechTablet' => 'Pantech.*P4100', + // Broncho Tablets: http://www.broncho.cn/ (hard to find) + 'BronchoTablet' => 'Broncho.*(N701|N708|N802|a710)', + // @ref: http://versusuk.com/support.html + 'VersusTablet' => 'TOUCHPAD.*[78910]|\bTOUCHTAB\b', + // @ref: http://www.zync.in/index.php/our-products/tablet-phablets + 'ZyncTablet' => 'z1000|Z99 2G|z99|z930|z999|z990|z909|Z919|z900', + // @ref: http://www.positivoinformatica.com.br/www/pessoal/tablet-ypy/ + 'PositivoTablet' => 'TB07STA|TB10STA|TB07FTA|TB10FTA', + // @ref: https://www.nabitablet.com/ + 'NabiTablet' => 'Android.*\bNabi', + 'KoboTablet' => 'Kobo Touch|\bK080\b|\bVox\b Build|\bArc\b Build', + // French Danew Tablets http://www.danew.com/produits-tablette.php + 'DanewTablet' => 'DSlide.*\b(700|701R|702|703R|704|802|970|971|972|973|974|1010|1012)\b', + // Texet Tablets and Readers http://www.texet.ru/tablet/ + 'TexetTablet' => 'NaviPad|TB-772A|TM-7045|TM-7055|TM-9750|TM-7016|TM-7024|TM-7026|TM-7041|TM-7043|TM-7047|TM-8041|TM-9741|TM-9747|TM-9748|TM-9751|TM-7022|TM-7021|TM-7020|TM-7011|TM-7010|TM-7023|TM-7025|TM-7037W|TM-7038W|TM-7027W|TM-9720|TM-9725|TM-9737W|TM-1020|TM-9738W|TM-9740|TM-9743W|TB-807A|TB-771A|TB-727A|TB-725A|TB-719A|TB-823A|TB-805A|TB-723A|TB-715A|TB-707A|TB-705A|TB-709A|TB-711A|TB-890HD|TB-880HD|TB-790HD|TB-780HD|TB-770HD|TB-721HD|TB-710HD|TB-434HD|TB-860HD|TB-840HD|TB-760HD|TB-750HD|TB-740HD|TB-730HD|TB-722HD|TB-720HD|TB-700HD|TB-500HD|TB-470HD|TB-431HD|TB-430HD|TB-506|TB-504|TB-446|TB-436|TB-416|TB-146SE|TB-126SE', + // @note: Avoid detecting 'PLAYSTATION 3' as mobile. + 'PlaystationTablet' => 'Playstation.*(Portable|Vita)', + // @ref: http://www.trekstor.de/surftabs.html + 'TrekstorTablet' => 'ST10416-1|VT10416-1|ST70408-1|ST702xx-1|ST702xx-2|ST80208|ST97216|ST70104-2|VT10416-2|ST10216-2A', + // @ref: http://www.pyleaudio.com/Products.aspx?%2fproducts%2fPersonal-Electronics%2fTablets + 'PyleAudioTablet' => '\b(PTBL10CEU|PTBL10C|PTBL72BC|PTBL72BCEU|PTBL7CEU|PTBL7C|PTBL92BC|PTBL92BCEU|PTBL9CEU|PTBL9CUK|PTBL9C)\b', + // @ref: http://www.advandigital.com/index.php?link=content-product&jns=JP001 + // @Note: because of the short codenames we have to include whitespaces to reduce the possible conflicts. + 'AdvanTablet' => 'Android.* \b(E3A|T3X|T5C|T5B|T3E|T3C|T3B|T1J|T1F|T2A|T1H|T1i|E1C|T1-E|T5-A|T4|E1-B|T2Ci|T1-B|T1-D|O1-A|E1-A|T1-A|T3A|T4i)\b ', + // @ref: http://www.danytech.com/category/tablet-pc + 'DanyTechTablet' => 'Genius Tab G3|Genius Tab S2|Genius Tab Q3|Genius Tab G4|Genius Tab Q4|Genius Tab G-II|Genius TAB GII|Genius TAB GIII|Genius Tab S1', + // @ref: http://www.galapad.net/product.html + 'GalapadTablet' => 'Android.*\bG1\b', + // @ref: http://www.micromaxinfo.com/tablet/funbook + 'MicromaxTablet' => 'Funbook|Micromax.*\b(P250|P560|P360|P362|P600|P300|P350|P500|P275)\b', + // http://www.karbonnmobiles.com/products_tablet.php + 'KarbonnTablet' => 'Android.*\b(A39|A37|A34|ST8|ST10|ST7|Smart Tab3|Smart Tab2)\b', + // @ref: http://www.myallfine.com/Products.asp + 'AllFineTablet' => 'Fine7 Genius|Fine7 Shine|Fine7 Air|Fine8 Style|Fine9 More|Fine10 Joy|Fine11 Wide', + // @ref: http://www.proscanvideo.com/products-search.asp?itemClass=TABLET&itemnmbr= + 'PROSCANTablet' => '\b(PEM63|PLT1023G|PLT1041|PLT1044|PLT1044G|PLT1091|PLT4311|PLT4311PL|PLT4315|PLT7030|PLT7033|PLT7033D|PLT7035|PLT7035D|PLT7044K|PLT7045K|PLT7045KB|PLT7071KG|PLT7072|PLT7223G|PLT7225G|PLT7777G|PLT7810K|PLT7849G|PLT7851G|PLT7852G|PLT8015|PLT8031|PLT8034|PLT8036|PLT8080K|PLT8082|PLT8088|PLT8223G|PLT8234G|PLT8235G|PLT8816K|PLT9011|PLT9045K|PLT9233G|PLT9735|PLT9760G|PLT9770G)\b', + // @ref: http://www.yonesnav.com/products/products.php + 'YONESTablet' => 'BQ1078|BC1003|BC1077|RK9702|BC9730|BC9001|IT9001|BC7008|BC7010|BC708|BC728|BC7012|BC7030|BC7027|BC7026', + // @ref: http://www.cjshowroom.com/eproducts.aspx?classcode=004001001 + // China manufacturer makes tablets for different small brands (eg. http://www.zeepad.net/index.html) + 'ChangJiaTablet' => 'TPC7102|TPC7103|TPC7105|TPC7106|TPC7107|TPC7201|TPC7203|TPC7205|TPC7210|TPC7708|TPC7709|TPC7712|TPC7110|TPC8101|TPC8103|TPC8105|TPC8106|TPC8203|TPC8205|TPC8503|TPC9106|TPC9701|TPC97101|TPC97103|TPC97105|TPC97106|TPC97111|TPC97113|TPC97203|TPC97603|TPC97809|TPC97205|TPC10101|TPC10103|TPC10106|TPC10111|TPC10203|TPC10205|TPC10503', + // @ref: http://www.gloryunion.cn/products.asp + // @ref: http://www.allwinnertech.com/en/apply/mobile.html + // @ref: http://www.ptcl.com.pk/pd_content.php?pd_id=284 (EVOTAB) + // @todo: Softwiner tablets? + // aka. Cute or Cool tablets. Not sure yet, must research to avoid collisions. + 'GUTablet' => 'TX-A1301|TX-M9002|Q702|kf026', // A12R|D75A|D77|D79|R83|A95|A106C|R15|A75|A76|D71|D72|R71|R73|R77|D82|R85|D92|A97|D92|R91|A10F|A77F|W71F|A78F|W78F|W81F|A97F|W91F|W97F|R16G|C72|C73E|K72|K73|R96G + // @ref: http://www.pointofview-online.com/showroom.php?shop_mode=product_listing&category_id=118 + 'PointOfViewTablet' => 'TAB-P506|TAB-navi-7-3G-M|TAB-P517|TAB-P-527|TAB-P701|TAB-P703|TAB-P721|TAB-P731N|TAB-P741|TAB-P825|TAB-P905|TAB-P925|TAB-PR945|TAB-PL1015|TAB-P1025|TAB-PI1045|TAB-P1325|TAB-PROTAB[0-9]+|TAB-PROTAB25|TAB-PROTAB26|TAB-PROTAB27|TAB-PROTAB26XL|TAB-PROTAB2-IPS9|TAB-PROTAB30-IPS9|TAB-PROTAB25XXL|TAB-PROTAB26-IPS10|TAB-PROTAB30-IPS10', + // @ref: http://www.overmax.pl/pl/katalog-produktow,p8/tablety,c14/ + // @todo: add more tests. + 'OvermaxTablet' => 'OV-(SteelCore|NewBase|Basecore|Baseone|Exellen|Quattor|EduTab|Solution|ACTION|BasicTab|TeddyTab|MagicTab|Stream|TB-08|TB-09)', + // @ref: http://hclmetablet.com/India/index.php + 'HCLTablet' => 'HCL.*Tablet|Connect-3G-2.0|Connect-2G-2.0|ME Tablet U1|ME Tablet U2|ME Tablet G1|ME Tablet X1|ME Tablet Y2|ME Tablet Sync', + // @ref: http://www.edigital.hu/Tablet_es_e-book_olvaso/Tablet-c18385.html + 'DPSTablet' => 'DPS Dream 9|DPS Dual 7', + // @ref: http://www.visture.com/index.asp + 'VistureTablet' => 'V97 HD|i75 3G|Visture V4( HD)?|Visture V5( HD)?|Visture V10', + // @ref: http://www.mijncresta.nl/tablet + 'CrestaTablet' => 'CTP(-)?810|CTP(-)?818|CTP(-)?828|CTP(-)?838|CTP(-)?888|CTP(-)?978|CTP(-)?980|CTP(-)?987|CTP(-)?988|CTP(-)?989', + // MediaTek - http://www.mediatek.com/_en/01_products/02_proSys.php?cata_sn=1&cata1_sn=1&cata2_sn=309 + 'MediatekTablet' => '\bMT8125|MT8389|MT8135|MT8377\b', + // Concorde tab + 'ConcordeTablet' => 'Concorde([ ]+)?Tab|ConCorde ReadMan', + // GoClever Tablets - http://www.goclever.com/uk/products,c1/tablet,c5/ + 'GoCleverTablet' => 'GOCLEVER TAB|A7GOCLEVER|M1042|M7841|M742|R1042BK|R1041|TAB A975|TAB A7842|TAB A741|TAB A741L|TAB M723G|TAB M721|TAB A1021|TAB I921|TAB R721|TAB I720|TAB T76|TAB R70|TAB R76.2|TAB R106|TAB R83.2|TAB M813G|TAB I721|GCTA722|TAB I70|TAB I71|TAB S73|TAB R73|TAB R74|TAB R93|TAB R75|TAB R76.1|TAB A73|TAB A93|TAB A93.2|TAB T72|TAB R83|TAB R974|TAB R973|TAB A101|TAB A103|TAB A104|TAB A104.2|R105BK|M713G|A972BK|TAB A971|TAB R974.2|TAB R104|TAB R83.3|TAB A1042', + // Modecom Tablets - http://www.modecom.eu/tablets/portal/ + 'ModecomTablet' => 'FreeTAB 9000|FreeTAB 7.4|FreeTAB 7004|FreeTAB 7800|FreeTAB 2096|FreeTAB 7.5|FreeTAB 1014|FreeTAB 1001 |FreeTAB 8001|FreeTAB 9706|FreeTAB 9702|FreeTAB 7003|FreeTAB 7002|FreeTAB 1002|FreeTAB 7801|FreeTAB 1331|FreeTAB 1004|FreeTAB 8002|FreeTAB 8014|FreeTAB 9704|FreeTAB 1003', + // Vonino Tablets - http://www.vonino.eu/tablets + 'VoninoTablet' => '\b(Argus[ _]?S|Diamond[ _]?79HD|Emerald[ _]?78E|Luna[ _]?70C|Onyx[ _]?S|Onyx[ _]?Z|Orin[ _]?HD|Orin[ _]?S|Otis[ _]?S|SpeedStar[ _]?S|Magnet[ _]?M9|Primus[ _]?94[ _]?3G|Primus[ _]?94HD|Primus[ _]?QS|Android.*\bQ8\b|Sirius[ _]?EVO[ _]?QS|Sirius[ _]?QS|Spirit[ _]?S)\b', + // ECS Tablets - http://www.ecs.com.tw/ECSWebSite/Product/Product_Tablet_List.aspx?CategoryID=14&MenuID=107&childid=M_107&LanID=0 + 'ECSTablet' => 'V07OT2|TM105A|S10OT1|TR10CS1', + // Storex Tablets - http://storex.fr/espace_client/support.html + // @note: no need to add all the tablet codes since they are guided by the first regex. + 'StorexTablet' => 'eZee[_\']?(Tab|Go)[0-9]+|TabLC7|Looney Tunes Tab', + // Generic Vodafone tablets. + 'VodafoneTablet' => 'SmartTab([ ]+)?[0-9]+|SmartTabII10', + // French tablets - Essentiel B http://www.boulanger.fr/tablette_tactile_e-book/tablette_tactile_essentiel_b/cl_68908.htm?multiChoiceToDelete=brand&mc_brand=essentielb + // Aka: http://www.essentielb.fr/ + 'EssentielBTablet' => 'Smart[ \']?TAB[ ]+?[0-9]+|Family[ \']?TAB2', + // Ross & Moor - http://ross-moor.ru/ + 'RossMoorTablet' => 'RM-790|RM-997|RMD-878G|RMD-974R|RMT-705A|RMT-701|RME-601|RMT-501|RMT-711', + // i-mobile http://product.i-mobilephone.com/Mobile_Device + 'iMobileTablet' => 'i-mobile i-note', + // @ref: http://www.tolino.de/de/vergleichen/ + 'TolinoTablet' => 'tolino tab [0-9.]+|tolino shine', + // AudioSonic - a Kmart brand + // http://www.kmart.com.au/webapp/wcs/stores/servlet/Search?langId=-1&storeId=10701&catalogId=10001&categoryId=193001&pageSize=72¤tPage=1&searchCategory=193001%2b4294965664&sortBy=p_MaxPrice%7c1 + 'AudioSonicTablet' => '\bC-22Q|T7-QC|T-17B|T-17P\b', + // AMPE Tablets - http://www.ampe.com.my/product-category/tablets/ + // @todo: add them gradually to avoid conflicts. + 'AMPETablet' => 'Android.* A78 ', + // Skk Mobile - http://skkmobile.com.ph/product_tablets.php + 'SkkTablet' => 'Android.* (SKYPAD|PHOENIX|CYCLOPS)', + // Tecno Mobile (only tablet) - http://www.tecno-mobile.com/index.php/product?filterby=smart&list_order=all&page=1 + 'TecnoTablet' => 'TECNO P9', + // JXD (consoles & tablets) - http://jxd.hk/products.asp?selectclassid=009008&clsid=3 + 'JXDTablet' => 'Android.*\b(F3000|A3300|JXD5000|JXD3000|JXD2000|JXD300B|JXD300|S5800|S7800|S602b|S5110b|S7300|S5300|S602|S603|S5100|S5110|S601|S7100a|P3000F|P3000s|P101|P200s|P1000m|P200m|P9100|P1000s|S6600b|S908|P1000|P300|S18|S6600|S9100)\b', + // i-Joy tablets - http://www.i-joy.es/en/cat/products/tablets/ + 'iJoyTablet' => 'Tablet (Spirit 7|Essentia|Galatea|Fusion|Onix 7|Landa|Titan|Scooby|Deox|Stella|Themis|Argon|Unique 7|Sygnus|Hexen|Finity 7|Cream|Cream X2|Jade|Neon 7|Neron 7|Kandy|Scape|Saphyr 7|Rebel|Biox|Rebel|Rebel 8GB|Myst|Draco 7|Myst|Tab7-004|Myst|Tadeo Jones|Tablet Boing|Arrow|Draco Dual Cam|Aurix|Mint|Amity|Revolution|Finity 9|Neon 9|T9w|Amity 4GB Dual Cam|Stone 4GB|Stone 8GB|Andromeda|Silken|X2|Andromeda II|Halley|Flame|Saphyr 9,7|Touch 8|Planet|Triton|Unique 10|Hexen 10|Memphis 4GB|Memphis 8GB|Onix 10)', + // http://www.intracon.eu/tablet + 'FX2Tablet' => 'FX2 PAD7|FX2 PAD10', + // http://www.xoro.de/produkte/ + // @note: Might be the same brand with 'Simply tablets' + 'XoroTablet' => 'KidsPAD 701|PAD[ ]?712|PAD[ ]?714|PAD[ ]?716|PAD[ ]?717|PAD[ ]?718|PAD[ ]?720|PAD[ ]?721|PAD[ ]?722|PAD[ ]?790|PAD[ ]?792|PAD[ ]?900|PAD[ ]?9715D|PAD[ ]?9716DR|PAD[ ]?9718DR|PAD[ ]?9719QR|PAD[ ]?9720QR|TelePAD1030|Telepad1032|TelePAD730|TelePAD731|TelePAD732|TelePAD735Q|TelePAD830|TelePAD9730|TelePAD795|MegaPAD 1331|MegaPAD 1851|MegaPAD 2151', + // http://www1.viewsonic.com/products/computing/tablets/ + 'ViewsonicTablet' => 'ViewPad 10pi|ViewPad 10e|ViewPad 10s|ViewPad E72|ViewPad7|ViewPad E100|ViewPad 7e|ViewSonic VB733|VB100a', + // http://www.odys.de/web/internet-tablet_en.html + 'OdysTablet' => 'LOOX|XENO10|ODYS Space', + // http://www.captiva-power.de/products.html#tablets-en + 'CaptivaTablet' => 'CAPTIVA PAD', + // IconBIT - http://www.iconbit.com/products/tablets/ + 'IconbitTablet' => 'NetTAB|NT-3702|NT-3702S|NT-3702S|NT-3603P|NT-3603P|NT-0704S|NT-0704S|NT-3805C|NT-3805C|NT-0806C|NT-0806C|NT-0909T|NT-0909T|NT-0907S|NT-0907S|NT-0902S|NT-0902S', + // @ref: http://www.tesco.com/direct/hudl/ + 'Hudl' => 'Hudl HT7S3', + // @ref: http://www.telstra.com.au/home-phone/thub-2/ + 'TelstraTablet' => 'T-Hub2', + 'GenericTablet' => 'Android.*\b97D\b|Tablet(?!.*PC)|BNTV250A|MID-WCDMA|LogicPD Zoom2|\bA7EB\b|CatNova8|A1_07|CT704|CT1002|\bM721\b|rk30sdk|\bEVOTAB\b|M758A|ET904|ALUMIUM10|Smartfren Tab|Endeavour 1010|Tablet-PC-4', + ); + + /** + * List of mobile Operating Systems. + * + * @var array + */ + protected static $operatingSystems = array( + 'AndroidOS' => 'Android', + 'BlackBerryOS' => 'blackberry|\bBB10\b|rim tablet os', + 'PalmOS' => 'PalmOS|avantgo|blazer|elaine|hiptop|palm|plucker|xiino', + 'SymbianOS' => 'Symbian|SymbOS|Series60|Series40|SYB-[0-9]+|\bS60\b', + // @reference: http://en.wikipedia.org/wiki/Windows_Mobile + 'WindowsMobileOS' => 'Windows CE.*(PPC|Smartphone|Mobile|[0-9]{3}x[0-9]{3})|Window Mobile|Windows Phone [0-9.]+|WCE;', + // @reference: http://en.wikipedia.org/wiki/Windows_Phone + // http://wifeng.cn/?r=blog&a=view&id=106 + // http://nicksnettravels.builttoroam.com/post/2011/01/10/Bogus-Windows-Phone-7-User-Agent-String.aspx + 'WindowsPhoneOS' => 'Windows Phone 8.0|Windows Phone OS|XBLWP7|ZuneWP7', + 'iOS' => '\biPhone.*Mobile|\biPod|\biPad', + // http://en.wikipedia.org/wiki/MeeGo + // @todo: research MeeGo in UAs + 'MeeGoOS' => 'MeeGo', + // http://en.wikipedia.org/wiki/Maemo + // @todo: research Maemo in UAs + 'MaemoOS' => 'Maemo', + 'JavaOS' => 'J2ME/|\bMIDP\b|\bCLDC\b', // '|Java/' produces bug #135 + 'webOS' => 'webOS|hpwOS', + 'badaOS' => '\bBada\b', + 'BREWOS' => 'BREW', + ); + + /** + * List of mobile User Agents. + * + * @var array + */ + protected static $browsers = array( + // @reference: https://developers.google.com/chrome/mobile/docs/user-agent + 'Chrome' => '\bCrMo\b|CriOS|Android.*Chrome/[.0-9]* (Mobile)?', + 'Dolfin' => '\bDolfin\b', + 'Opera' => 'Opera.*Mini|Opera.*Mobi|Android.*Opera|Mobile.*OPR/[0-9.]+|Coast/[0-9.]+', + 'Skyfire' => 'Skyfire', + 'IE' => 'IEMobile|MSIEMobile', // |Trident/[.0-9]+ + 'Firefox' => 'fennec|firefox.*maemo|(Mobile|Tablet).*Firefox|Firefox.*Mobile', + 'Bolt' => 'bolt', + 'TeaShark' => 'teashark', + 'Blazer' => 'Blazer', + // @reference: http://developer.apple.com/library/safari/#documentation/AppleApplications/Reference/SafariWebContent/OptimizingforSafarioniPhone/OptimizingforSafarioniPhone.html#//apple_ref/doc/uid/TP40006517-SW3 + 'Safari' => 'Version.*Mobile.*Safari|Safari.*Mobile', + // @ref: http://en.wikipedia.org/wiki/Midori_(web_browser) + //'Midori' => 'midori', + 'Tizen' => 'Tizen', + 'UCBrowser' => 'UC.*Browser|UCWEB', + // @ref: https://github.com/serbanghita/Mobile-Detect/issues/7 + 'DiigoBrowser' => 'DiigoBrowser', + // http://www.puffinbrowser.com/index.php + 'Puffin' => 'Puffin', + // @ref: http://mercury-browser.com/index.html + 'Mercury' => '\bMercury\b', + // @reference: http://en.wikipedia.org/wiki/Minimo + // http://en.wikipedia.org/wiki/Vision_Mobile_Browser + 'GenericBrowser' => 'NokiaBrowser|OviBrowser|OneBrowser|TwonkyBeamBrowser|SEMC.*Browser|FlyFlow|Minimo|NetFront|Novarra-Vision|MQQBrowser|MicroMessenger' + ); + + /** + * Utilities. + * + * @var array + */ + protected static $utilities = array( + // Experimental. When a mobile device wants to switch to 'Desktop Mode'. + // @ref: http://scottcate.com/technology/windows-phone-8-ie10-desktop-or-mobile/ + // @ref: https://github.com/serbanghita/Mobile-Detect/issues/57#issuecomment-15024011 + 'DesktopMode' => 'WPDesktop', + 'TV' => 'SonyDTV|HbbTV', // experimental + 'WebKit' => '(webkit)[ /]([\w.]+)', + 'Bot' => 'Googlebot|DoCoMo|YandexBot|bingbot|ia_archiver|AhrefsBot|Ezooms|GSLFbot|WBSearchBot|Twitterbot|TweetmemeBot|Twikle|PaperLiBot|Wotbox|UnwindFetchor|facebookexternalhit', + 'MobileBot' => 'Googlebot-Mobile|DoCoMo|YahooSeeker/M1A1-R2D2', + // @todo: Include JXD consoles. + 'Console' => '\b(Nintendo|Nintendo WiiU|PLAYSTATION|Xbox)\b', + 'Watch' => 'SM-V700', + ); + + /** + * All possible HTTP headers that represent the + * User-Agent string. + * + * @var array + */ + protected static $uaHttpHeaders = array( + // The default User-Agent string. + 'HTTP_USER_AGENT', + // Header can occur on devices using Opera Mini. + 'HTTP_X_OPERAMINI_PHONE_UA', + // Vodafone specific header: http://www.seoprinciple.com/mobile-web-community-still-angry-at-vodafone/24/ + 'HTTP_X_DEVICE_USER_AGENT', + 'HTTP_X_ORIGINAL_USER_AGENT', + 'HTTP_X_SKYFIRE_PHONE', + 'HTTP_X_BOLT_PHONE_UA', + 'HTTP_DEVICE_STOCK_UA', + 'HTTP_X_UCBROWSER_DEVICE_UA' + ); + + /** + * The individual segments that could exist in a User-Agent string. VER refers to the regular + * expression defined in the constant self::VER. + * + * @var array + */ + protected static $properties = array( + + // Build + 'Mobile' => 'Mobile/[VER]', + 'Build' => 'Build/[VER]', + 'Version' => 'Version/[VER]', + 'VendorID' => 'VendorID/[VER]', + + // Devices + 'iPad' => 'iPad.*CPU[a-z ]+[VER]', + 'iPhone' => 'iPhone.*CPU[a-z ]+[VER]', + 'iPod' => 'iPod.*CPU[a-z ]+[VER]', + //'BlackBerry' => array('BlackBerry[VER]', 'BlackBerry [VER];'), + 'Kindle' => 'Kindle/[VER]', + + // Browser + 'Chrome' => array('Chrome/[VER]', 'CriOS/[VER]', 'CrMo/[VER]'), + 'Coast' => array('Coast/[VER]'), + 'Dolfin' => 'Dolfin/[VER]', + // @reference: https://developer.mozilla.org/en-US/docs/User_Agent_Strings_Reference + 'Firefox' => 'Firefox/[VER]', + 'Fennec' => 'Fennec/[VER]', + // @reference: http://msdn.microsoft.com/en-us/library/ms537503(v=vs.85).aspx + 'IE' => array('IEMobile/[VER];', 'IEMobile [VER]', 'MSIE [VER];'), + // http://en.wikipedia.org/wiki/NetFront + 'NetFront' => 'NetFront/[VER]', + 'NokiaBrowser' => 'NokiaBrowser/[VER]', + 'Opera' => array( ' OPR/[VER]', 'Opera Mini/[VER]', 'Version/[VER]' ), + 'Opera Mini' => 'Opera Mini/[VER]', + 'Opera Mobi' => 'Version/[VER]', + 'UC Browser' => 'UC Browser[VER]', + 'MQQBrowser' => 'MQQBrowser/[VER]', + 'MicroMessenger' => 'MicroMessenger/[VER]', + // @note: Safari 7534.48.3 is actually Version 5.1. + // @note: On BlackBerry the Version is overwriten by the OS. + 'Safari' => array( 'Version/[VER]', 'Safari/[VER]' ), + 'Skyfire' => 'Skyfire/[VER]', + 'Tizen' => 'Tizen/[VER]', + 'Webkit' => 'webkit[ /][VER]', + + // Engine + 'Gecko' => 'Gecko/[VER]', + 'Trident' => 'Trident/[VER]', + 'Presto' => 'Presto/[VER]', + + // OS + 'iOS' => ' \bOS\b [VER] ', + 'Android' => 'Android [VER]', + 'BlackBerry' => array('BlackBerry[\w]+/[VER]', 'BlackBerry.*Version/[VER]', 'Version/[VER]'), + 'BREW' => 'BREW [VER]', + 'Java' => 'Java/[VER]', + // @reference: http://windowsteamblog.com/windows_phone/b/wpdev/archive/2011/08/29/introducing-the-ie9-on-windows-phone-mango-user-agent-string.aspx + // @reference: http://en.wikipedia.org/wiki/Windows_NT#Releases + 'Windows Phone OS' => array( 'Windows Phone OS [VER]', 'Windows Phone [VER]'), + 'Windows Phone' => 'Windows Phone [VER]', + 'Windows CE' => 'Windows CE/[VER]', + // http://social.msdn.microsoft.com/Forums/en-US/windowsdeveloperpreviewgeneral/thread/6be392da-4d2f-41b4-8354-8dcee20c85cd + 'Windows NT' => 'Windows NT [VER]', + 'Symbian' => array('SymbianOS/[VER]', 'Symbian/[VER]'), + 'webOS' => array('webOS/[VER]', 'hpwOS/[VER];'), + ); + + /** + * Construct an instance of this class. + * + * @param array $headers Specify the headers as injection. Should be PHP _SERVER flavored. + * If left empty, will use the global _SERVER['HTTP_*'] vars instead. + * @param string $userAgent Inject the User-Agent header. If null, will use HTTP_USER_AGENT + * from the $headers array instead. + */ + public function __construct(array $headers = null, $userAgent = null) + { + $this->setHttpHeaders($headers); + $this->setUserAgent($userAgent); + } + + /** + * Get the current script version. + * This is useful for the demo.php file, + * so people can check on what version they are testing + * for mobile devices. + * + * @return string The version number in semantic version format. + */ + public static function getScriptVersion() + { + return self::VERSION; + } + + /** + * Set the HTTP Headers. Must be PHP-flavored. This method will reset existing headers. + * + * @param array $httpHeaders The headers to set. If null, then using PHP's _SERVER to extract + * the headers. The default null is left for backwards compatibilty. + * @return void + */ + public function setHttpHeaders($httpHeaders = null) + { + //use global _SERVER if $httpHeaders aren't defined + if (!is_array($httpHeaders) || !count($httpHeaders)) { + $httpHeaders = $_SERVER; + } + + //clear existing headers + $this->httpHeaders = array(); + + //Only save HTTP headers. In PHP land, that means only _SERVER vars that + //start with HTTP_. + foreach ($httpHeaders as $key => $value) { + if (substr($key,0,5) == 'HTTP_') { + $this->httpHeaders[$key] = $value; + } + } + } + + /** + * Retrieves the HTTP headers. + * + * @return array + */ + public function getHttpHeaders() + { + return $this->httpHeaders; + } + + /** + * Retrieves a particular header. If it doesn't exist, no exception/error is caused. + * Simply null is returned. + * + * @param string $header The name of the header to retrieve. Can be HTTP compliant such as + * "User-Agent" or "X-Device-User-Agent" or can be php-esque with the + * all-caps, HTTP_ prefixed, underscore seperated awesomeness. + * + * @return string|null The value of the header. + */ + public function getHttpHeader($header) + { + //are we using PHP-flavored headers? + if (strpos($header, '_') === false) { + $header = str_replace('-', '_', $header); + $header = strtoupper($header); + } + + //test the alternate, too + $altHeader = 'HTTP_' . $header; + + //Test both the regular and the HTTP_ prefix + if (isset($this->httpHeaders[$header])) { + return $this->httpHeaders[$header]; + } elseif (isset($this->httpHeaders[$altHeader])) { + return $this->httpHeaders[$altHeader]; + } + + return null; + } + + public function getMobileHeaders() + { + return self::$mobileHeaders; + } + + /** + * Get all possible HTTP headers that + * can contain the User-Agent string. + * + * @return array List of HTTP headers. + */ + public function getUaHttpHeaders() + { + return self::$uaHttpHeaders; + } + + /** + * Set the User-Agent to be used. + * + * @param string $userAgent The user agent string to set. + * + * @return string|null + */ + public function setUserAgent($userAgent = null) + { + if (!empty($userAgent)) { + return $this->userAgent = $userAgent; + } else { + + $this->userAgent = null; + + foreach($this->getUaHttpHeaders() as $altHeader){ + if(!empty($this->httpHeaders[$altHeader])){ // @todo: should use getHttpHeader(), but it would be slow. (Serban) + $this->userAgent .= $this->httpHeaders[$altHeader] . " "; + } + } + + return $this->userAgent = (!empty($this->userAgent) ? trim($this->userAgent) : null); + + } + } + + /** + * Retrieve the User-Agent. + * + * @return string|null The user agent if it's set. + */ + public function getUserAgent() + { + return $this->userAgent; + } + + /** + * Set the detection type. Must be one of self::DETECTION_TYPE_MOBILE or + * self::DETECTION_TYPE_EXTENDED. Otherwise, nothing is set. + * + * @param string $type The type. Must be a self::DETECTION_TYPE_* constant. The default + * parameter is null which will default to self::DETECTION_TYPE_MOBILE. + * @return void + * + * @deprecated since version 2.6.9 + */ + public function setDetectionType($type = null) + { + if ($type === null) { + $type = self::DETECTION_TYPE_MOBILE; + } + + if ($type != self::DETECTION_TYPE_MOBILE && $type != self::DETECTION_TYPE_EXTENDED) { + return; + } + + $this->detectionType = $type; + } + + /** + * Retrieve the list of known phone devices. + * + * @return array List of phone devices. + */ + public static function getPhoneDevices() + { + return self::$phoneDevices; + } + + /** + * Retrieve the list of known tablet devices. + * + * @return array List of tablet devices. + */ + public static function getTabletDevices() + { + return self::$tabletDevices; + } + + /** + * Alias for getBrowsers() method. + * + * @return array List of user agents. + */ + public static function getUserAgents() + { + return self::getBrowsers(); + } + + /** + * Retrieve the list of known browsers. Specifically, the user agents. + * + * @return array List of browsers / user agents. + */ + public static function getBrowsers() + { + return self::$browsers; + } + + /** + * Retrieve the list of known utilities. + * + * @return array List of utilities. + */ + public static function getUtilities() + { + return self::$utilities; + } + + /** + * Method gets the mobile detection rules. This method is used for the magic methods $detect->is*(). + * + * @deprecated since version 2.6.9 + * + * @return array All the rules (but not extended). + */ + public static function getMobileDetectionRules() + { + static $rules; + + if (!$rules) { + $rules = array_merge( + self::$phoneDevices, + self::$tabletDevices, + self::$operatingSystems, + self::$browsers + ); + } + + return $rules; + + } + + /** + * Method gets the mobile detection rules + utilities. + * The reason this is separate is because utilities rules + * don't necessary imply mobile. This method is used inside + * the new $detect->is('stuff') method. + * + * @deprecated since version 2.6.9 + * + * @return array All the rules + extended. + */ + public function getMobileDetectionRulesExtended() + { + static $rules; + + if (!$rules) { + // Merge all rules together. + $rules = array_merge( + self::$phoneDevices, + self::$tabletDevices, + self::$operatingSystems, + self::$browsers, + self::$utilities + ); + } + + return $rules; + } + + /** + * Retrieve the current set of rules. + * + * @deprecated since version 2.6.9 + * + * @return array + */ + public function getRules() + { + if ($this->detectionType == self::DETECTION_TYPE_EXTENDED) { + return self::getMobileDetectionRulesExtended(); + } else { + return self::getMobileDetectionRules(); + } + } + + /** + * Retrieve the list of mobile operating systems. + * + * @return array The list of mobile operating systems. + */ + public static function getOperatingSystems() + { + return self::$operatingSystems; + } + + /** + * Check the HTTP headers for signs of mobile. + * This is the fastest mobile check possible; it's used + * inside isMobile() method. + * + * @return bool + */ + public function checkHttpHeadersForMobile() + { + + foreach($this->getMobileHeaders() as $mobileHeader => $matchType){ + if( isset($this->httpHeaders[$mobileHeader]) ){ + if( is_array($matchType['matches']) ){ + foreach($matchType['matches'] as $_match){ + if( strpos($this->httpHeaders[$mobileHeader], $_match) !== false ){ + return true; + } + } + return false; + } else { + return true; + } + } + } + + return false; + + } + + /** + * Magic overloading method. + * + * @param string $name Name + * @param array $arguments Arguments + * @return mixed + * + * @throws BadMethodCallException when the method doesn't exist and doesn't start with 'is' + * @method boolean is[...]() + */ + public function __call($name, $arguments) + { + //make sure the name starts with 'is', otherwise + if (substr($name, 0, 2) != 'is') { + throw new BadMethodCallException("No such method exists: $name"); + } + + $this->setDetectionType(self::DETECTION_TYPE_MOBILE); + + $key = substr($name, 2); + + return $this->matchUAAgainstKey($key); + } + + /** + * Find a detection rule that matches the current User-agent. + * + * @param null $userAgent deprecated + * @return boolean + */ + protected function matchDetectionRulesAgainstUA($userAgent = null) + { + // Begin general search. + foreach ($this->getRules() as $_regex) { + if (empty($_regex)) { + continue; + } + if ($this->match($_regex, $userAgent)) { + return true; + } + } + + return false; + } + + /** + * Search for a certain key in the rules array. + * If the key is found the try to match the corresponding + * regex agains the User-Agent. + * + * @param string $key Key + * @param string $userAgent deprecated + * @return mixed + */ + protected function matchUAAgainstKey($key, $userAgent = null) + { + // Make the keys lowercase so we can match: isIphone(), isiPhone(), isiphone(), etc. + $key = strtolower($key); + + //change the keys to lower case + $_rules = array_change_key_case($this->getRules()); + + if (array_key_exists($key, $_rules)) { + if (empty($_rules[$key])) { + return null; + } + + return $this->match($_rules[$key], $userAgent); + } + + return false; + } + + /** + * Check if the device is mobile. + * Returns true if any type of mobile device detected, including special ones + * + * @param string $userAgent deprecated + * @param string $httpHeaders deprecated + * @return bool + */ + public function isMobile($userAgent = null, $httpHeaders = null) + { + + if ($httpHeaders) { + $this->setHttpHeaders($httpHeaders); + } + + if ($userAgent) { + $this->setUserAgent($userAgent); + } + + $this->setDetectionType(self::DETECTION_TYPE_MOBILE); + + if ($this->checkHttpHeadersForMobile()) { + return true; + } else { + return $this->matchDetectionRulesAgainstUA(); + } + + } + + /** + * Check if the device is a tablet. + * Return true if any type of tablet device is detected. + * + * @param string $userAgent deprecated + * @param array $httpHeaders deprecated + * @return bool + */ + public function isTablet($userAgent = null, $httpHeaders = null) + { + $this->setDetectionType(self::DETECTION_TYPE_MOBILE); + + foreach (self::$tabletDevices as $_regex) { + if ($this->match($_regex, $userAgent)) { + return true; + } + } + + return false; + } + + /** + * This method checks for a certain property in the + * userAgent. + * + * @param string $key key + * @param string $userAgent deprecated + * @param string $httpHeaders deprecated + * @return bool|int|null + * + * @todo: The httpHeaders part is not yet used. + */ + public function is($key, $userAgent = null, $httpHeaders = null) + { + // Set the UA and HTTP headers only if needed (eg. batch mode). + if ($httpHeaders) { + $this->setHttpHeaders($httpHeaders); + } + + if ($userAgent) { + $this->setUserAgent($userAgent); + } + + $this->setDetectionType(self::DETECTION_TYPE_EXTENDED); + + return $this->matchUAAgainstKey($key); + } + + /** + * Some detection rules are relative (not standard), + * because of the diversity of devices, vendors and + * their conventions in representing the User-Agent or + * the HTTP headers. + * This method will be used to check custom regexes against + * the User-Agent string. + * + * @param string $regex Regex + * @param string $userAgent User agent + * @return bool + * + * @todo: search in the HTTP headers too. + */ + public function match($regex, $userAgent = null) + { + // Escape the special character which is the delimiter. + $regex = str_replace('/', '\/', $regex); + + return (bool) preg_match('/'.$regex.'/is', (!empty($userAgent) ? $userAgent : $this->userAgent)); + } + + /** + * Get the properties array. + * + * @return array + */ + public static function getProperties() + { + return self::$properties; + } + + /** + * Prepare the version number. + * + * @param string $ver The string version, like "2.6.21.2152"; + * @return float + * + * @todo Remove the error supression from str_replace() call. + */ + public function prepareVersionNo($ver) + { + $ver = str_replace(array('_', ' ', '/'), '.', $ver); + $arrVer = explode('.', $ver, 2); + + if (isset($arrVer[1])) { + $arrVer[1] = @str_replace('.', '', $arrVer[1]); // @todo: treat strings versions. + } + + return (float) implode('.', $arrVer); + } + + /** + * Check the version of the given property in the User-Agent. + * Will return a float number. (eg. 2_0 will return 2.0, 4.3.1 will return 4.31) + * + * @param string $propertyName The name of the property. See self::getProperties() array + * keys for all possible properties. + * @param string $type Either self::VERSION_TYPE_STRING to get a string value or + * self::VERSION_TYPE_FLOAT indicating a float value. This parameter + * is optional and defaults to self::VERSION_TYPE_STRING. Passing an + * invalid parameter will default to the this type as well. + * + * @return string|float The version of the property we are trying to extract. + */ + public function version($propertyName, $type = self::VERSION_TYPE_STRING) + { + if (empty($propertyName)) { + return false; + } + + //set the $type to the default if we don't recognize the type + if ($type != self::VERSION_TYPE_STRING && $type != self::VERSION_TYPE_FLOAT) { + $type = self::VERSION_TYPE_STRING; + } + + $properties = self::getProperties(); + + // Check if the property exists in the properties array. + if (array_key_exists($propertyName, $properties)) { + + // Prepare the pattern to be matched. + // Make sure we always deal with an array (string is converted). + $properties[$propertyName] = (array) $properties[$propertyName]; + + foreach ($properties[$propertyName] as $propertyMatchString) { + + $propertyPattern = str_replace('[VER]', self::VER, $propertyMatchString); + + // Escape the special character which is the delimiter. + $propertyPattern = str_replace('/', '\/', $propertyPattern); + + // Identify and extract the version. + preg_match('/'.$propertyPattern.'/is', $this->userAgent, $match); + + if (!empty($match[1])) { + $version = ( $type == self::VERSION_TYPE_FLOAT ? $this->prepareVersionNo($match[1]) : $match[1] ); + + return $version; + } + + } + + } + + return false; + } + + /** + * Retrieve the mobile grading, using self::MOBILE_GRADE_* constants. + * + * @return string One of the self::MOBILE_GRADE_* constants. + */ + public function mobileGrade() + { + $isMobile = $this->isMobile(); + + if ( + // Apple iOS 3.2-5.1 - Tested on the original iPad (4.3 / 5.0), iPad 2 (4.3), iPad 3 (5.1), original iPhone (3.1), iPhone 3 (3.2), 3GS (4.3), 4 (4.3 / 5.0), and 4S (5.1) + $this->isIOS() && $this->version('iPad', self::VERSION_TYPE_FLOAT)>=4.3 || + $this->isIOS() && $this->version('iPhone', self::VERSION_TYPE_FLOAT)>=3.1 || + $this->isIOS() && $this->version('iPod', self::VERSION_TYPE_FLOAT)>=3.1 || + + // Android 2.1-2.3 - Tested on the HTC Incredible (2.2), original Droid (2.2), HTC Aria (2.1), Google Nexus S (2.3). Functional on 1.5 & 1.6 but performance may be sluggish, tested on Google G1 (1.5) + // Android 3.1 (Honeycomb) - Tested on the Samsung Galaxy Tab 10.1 and Motorola XOOM + // Android 4.0 (ICS) - Tested on a Galaxy Nexus. Note: transition performance can be poor on upgraded devices + // Android 4.1 (Jelly Bean) - Tested on a Galaxy Nexus and Galaxy 7 + ( $this->version('Android', self::VERSION_TYPE_FLOAT)>2.1 && $this->is('Webkit') ) || + + // Windows Phone 7-7.5 - Tested on the HTC Surround (7.0) HTC Trophy (7.5), LG-E900 (7.5), Nokia Lumia 800 + $this->version('Windows Phone OS', self::VERSION_TYPE_FLOAT)>=7.0 || + + // Blackberry 7 - Tested on BlackBerry Torch 9810 + // Blackberry 6.0 - Tested on the Torch 9800 and Style 9670 + $this->is('BlackBerry') && $this->version('BlackBerry', self::VERSION_TYPE_FLOAT)>=6.0 || + // Blackberry Playbook (1.0-2.0) - Tested on PlayBook + $this->match('Playbook.*Tablet') || + + // Palm WebOS (1.4-2.0) - Tested on the Palm Pixi (1.4), Pre (1.4), Pre 2 (2.0) + ( $this->version('webOS', self::VERSION_TYPE_FLOAT)>=1.4 && $this->match('Palm|Pre|Pixi') ) || + // Palm WebOS 3.0 - Tested on HP TouchPad + $this->match('hp.*TouchPad') || + + // Firefox Mobile (12 Beta) - Tested on Android 2.3 device + ( $this->is('Firefox') && $this->version('Firefox', self::VERSION_TYPE_FLOAT)>=12 ) || + + // Chrome for Android - Tested on Android 4.0, 4.1 device + ( $this->is('Chrome') && $this->is('AndroidOS') && $this->version('Android', self::VERSION_TYPE_FLOAT)>=4.0 ) || + + // Skyfire 4.1 - Tested on Android 2.3 device + ( $this->is('Skyfire') && $this->version('Skyfire', self::VERSION_TYPE_FLOAT)>=4.1 && $this->is('AndroidOS') && $this->version('Android', self::VERSION_TYPE_FLOAT)>=2.3 ) || + + // Opera Mobile 11.5-12: Tested on Android 2.3 + ( $this->is('Opera') && $this->version('Opera Mobi', self::VERSION_TYPE_FLOAT)>11 && $this->is('AndroidOS') ) || + + // Meego 1.2 - Tested on Nokia 950 and N9 + $this->is('MeeGoOS') || + + // Tizen (pre-release) - Tested on early hardware + $this->is('Tizen') || + + // Samsung Bada 2.0 - Tested on a Samsung Wave 3, Dolphin browser + // @todo: more tests here! + $this->is('Dolfin') && $this->version('Bada', self::VERSION_TYPE_FLOAT)>=2.0 || + + // UC Browser - Tested on Android 2.3 device + ( ($this->is('UC Browser') || $this->is('Dolfin')) && $this->version('Android', self::VERSION_TYPE_FLOAT)>=2.3 ) || + + // Kindle 3 and Fire - Tested on the built-in WebKit browser for each + ( $this->match('Kindle Fire') || + $this->is('Kindle') && $this->version('Kindle', self::VERSION_TYPE_FLOAT)>=3.0 ) || + + // Nook Color 1.4.1 - Tested on original Nook Color, not Nook Tablet + $this->is('AndroidOS') && $this->is('NookTablet') || + + // Chrome Desktop 11-21 - Tested on OS X 10.7 and Windows 7 + $this->version('Chrome', self::VERSION_TYPE_FLOAT)>=11 && !$isMobile || + + // Safari Desktop 4-5 - Tested on OS X 10.7 and Windows 7 + $this->version('Safari', self::VERSION_TYPE_FLOAT)>=5.0 && !$isMobile || + + // Firefox Desktop 4-13 - Tested on OS X 10.7 and Windows 7 + $this->version('Firefox', self::VERSION_TYPE_FLOAT)>=4.0 && !$isMobile || + + // Internet Explorer 7-9 - Tested on Windows XP, Vista and 7 + $this->version('MSIE', self::VERSION_TYPE_FLOAT)>=7.0 && !$isMobile || + + // Opera Desktop 10-12 - Tested on OS X 10.7 and Windows 7 + // @reference: http://my.opera.com/community/openweb/idopera/ + $this->version('Opera', self::VERSION_TYPE_FLOAT)>=10 && !$isMobile + + ){ + return self::MOBILE_GRADE_A; + } + + if ( + $this->isIOS() && $this->version('iPad', self::VERSION_TYPE_FLOAT)<4.3 || + $this->isIOS() && $this->version('iPhone', self::VERSION_TYPE_FLOAT)<3.1 || + $this->isIOS() && $this->version('iPod', self::VERSION_TYPE_FLOAT)<3.1 || + + // Blackberry 5.0: Tested on the Storm 2 9550, Bold 9770 + $this->is('Blackberry') && $this->version('BlackBerry', self::VERSION_TYPE_FLOAT)>=5 && $this->version('BlackBerry', self::VERSION_TYPE_FLOAT)<6 || + + //Opera Mini (5.0-6.5) - Tested on iOS 3.2/4.3 and Android 2.3 + ( $this->version('Opera Mini', self::VERSION_TYPE_FLOAT)>=5.0 && $this->version('Opera Mini', self::VERSION_TYPE_FLOAT)<=6.5 && + ($this->version('Android', self::VERSION_TYPE_FLOAT)>=2.3 || $this->is('iOS')) ) || + + // Nokia Symbian^3 - Tested on Nokia N8 (Symbian^3), C7 (Symbian^3), also works on N97 (Symbian^1) + $this->match('NokiaN8|NokiaC7|N97.*Series60|Symbian/3') || + + // @todo: report this (tested on Nokia N71) + $this->version('Opera Mobi', self::VERSION_TYPE_FLOAT)>=11 && $this->is('SymbianOS') + ){ + return self::MOBILE_GRADE_B; + } + + if ( + // Blackberry 4.x - Tested on the Curve 8330 + $this->version('BlackBerry', self::VERSION_TYPE_FLOAT)<5.0 || + // Windows Mobile - Tested on the HTC Leo (WinMo 5.2) + $this->match('MSIEMobile|Windows CE.*Mobile') || $this->version('Windows Mobile', self::VERSION_TYPE_FLOAT)<=5.2 + + ){ + return self::MOBILE_GRADE_C; + } + + //All older smartphone platforms and featurephones - Any device that doesn't support media queries + //will receive the basic, C grade experience. + return self::MOBILE_GRADE_C; + } +} diff --git a/htdocs/core/class/notify.class.php b/htdocs/core/class/notify.class.php index 317b00dd33a..03e2a641828 100644 --- a/htdocs/core/class/notify.class.php +++ b/htdocs/core/class/notify.class.php @@ -99,7 +99,7 @@ class Notify $sql.= " AND s.entity IN (".getEntity('societe', 1).")"; $sql.= " AND s.rowid = ".$socid; - dol_syslog("Notify.class::countDefinedNotifications ".$action.", ".$socid." sql=".$sql); + dol_syslog("Notify.class::countDefinedNotifications ".$action.", ".$socid."", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) @@ -147,7 +147,7 @@ class Notify else $sql.= " AND a.code = '".$action."'"; // New usage $sql .= " AND s.rowid = ".$socid; - dol_syslog("Notify::send sql=".$sql); + dol_syslog("Notify::send", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { @@ -226,7 +226,7 @@ class Notify $sql = "INSERT INTO ".MAIN_DB_PREFIX."notify (daten, fk_action, fk_contact, objet_type, objet_id, email)"; $sql.= " VALUES ('".$this->db->idate($now)."', ".$actiondefid.", ".$obj->cid.", '".$objet_type."', ".$objet_id.", '".$this->db->escape($obj->email)."')"; - dol_syslog("Notify::send sql=".$sql); + dol_syslog("Notify::send", LOG_DEBUG); if (! $this->db->query($sql) ) { dol_print_error($this->db); diff --git a/htdocs/core/class/stats.class.php b/htdocs/core/class/stats.class.php index 5018d63cecf..8a4ffd29d68 100644 --- a/htdocs/core/class/stats.class.php +++ b/htdocs/core/class/stats.class.php @@ -81,7 +81,7 @@ abstract class Stats if ($foundintocache) // Cache file found and is not too old { dol_syslog(get_class($this).'::'.__FUNCTION__." read data from cache file ".$newpathofdestfile." ".$filedate."."); - $data = dol_json_decode(file_get_contents($newpathofdestfile), true); + $data = json_decode(file_get_contents($newpathofdestfile), true); } else { @@ -112,7 +112,7 @@ abstract class Stats dol_syslog(get_class($this).'::'.__FUNCTION__." save cache file ".$newpathofdestfile." onto disk."); if (! dol_is_dir($conf->user->dir_temp)) dol_mkdir($conf->user->dir_temp); $fp = fopen($newpathofdestfile, 'w'); - fwrite($fp, dol_json_encode($data)); + fwrite($fp, json_encode($data)); fclose($fp); if (! empty($conf->global->MAIN_UMASK)) $newmask=$conf->global->MAIN_UMASK; @chmod($newpathofdestfile, octdec($newmask)); @@ -172,7 +172,7 @@ abstract class Stats if ($foundintocache) // Cache file found and is not too old { dol_syslog(get_class($this).'::'.__FUNCTION__." read data from cache file ".$newpathofdestfile." ".$filedate."."); - $data = dol_json_decode(file_get_contents($newpathofdestfile), true); + $data = json_decode(file_get_contents($newpathofdestfile), true); } else { @@ -203,7 +203,7 @@ abstract class Stats dol_syslog(get_class($this).'::'.__FUNCTION__." save cache file ".$newpathofdestfile." onto disk."); if (! dol_is_dir($conf->user->dir_temp)) dol_mkdir($conf->user->dir_temp); $fp = fopen($newpathofdestfile, 'w'); - fwrite($fp, dol_json_encode($data)); + fwrite($fp, json_encode($data)); fclose($fp); if (! empty($conf->global->MAIN_UMASK)) $newmask=$conf->global->MAIN_UMASK; @chmod($newpathofdestfile, octdec($newmask)); @@ -295,7 +295,7 @@ abstract class Stats if ($foundintocache) // Cache file found and is not too old { dol_syslog(get_class($this).'::'.__FUNCTION__." read data from cache file ".$newpathofdestfile." ".$filedate."."); - $data = dol_json_decode(file_get_contents($newpathofdestfile), true); + $data = json_decode(file_get_contents($newpathofdestfile), true); } else { @@ -309,7 +309,7 @@ abstract class Stats dol_syslog(get_class($this).'::'.__FUNCTION__." save cache file ".$newpathofdestfile." onto disk."); if (! dol_is_dir($conf->user->dir_temp)) dol_mkdir($conf->user->dir_temp); $fp = fopen($newpathofdestfile, 'w'); - fwrite($fp, dol_json_encode($data)); + fwrite($fp, json_encode($data)); fclose($fp); if (! empty($conf->global->MAIN_UMASK)) $newmask=$conf->global->MAIN_UMASK; @chmod($newpathofdestfile, octdec($newmask)); @@ -334,7 +334,7 @@ abstract class Stats { $result = array(); - dol_syslog(get_class($this).'::'.__FUNCTION__." sql=".$sql); + dol_syslog(get_class($this).'::'.__FUNCTION__."", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -364,7 +364,7 @@ abstract class Stats { $result = array(); - dol_syslog(get_class($this).'::'.__FUNCTION__." sql=".$sql); + dol_syslog(get_class($this).'::'.__FUNCTION__."", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -400,7 +400,7 @@ abstract class Stats $result=array(); $res=array(); - dol_syslog(get_class($this).'::'.__FUNCTION__." sql=".$sql); + dol_syslog(get_class($this).'::'.__FUNCTION__."", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -451,7 +451,7 @@ abstract class Stats $result=array(); $res=array(); - dol_syslog(get_class($this).'::'.__FUNCTION__." sql=".$sql); + dol_syslog(get_class($this).'::'.__FUNCTION__."", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) @@ -499,7 +499,7 @@ abstract class Stats $result=array(); $res=array(); - dol_syslog(get_class($this).'::'.__FUNCTION__." sql=".$sql); + dol_syslog(get_class($this).'::'.__FUNCTION__."", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -548,7 +548,7 @@ abstract class Stats $result=array(); $res=array(); - dol_syslog(get_class($this).'::'.__FUNCTION__." sql=".$sql); + dol_syslog(get_class($this).'::'.__FUNCTION__."", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { diff --git a/htdocs/core/class/translate.class.php b/htdocs/core/class/translate.class.php index c076cc3e874..7462a40e897 100644 --- a/htdocs/core/class/translate.class.php +++ b/htdocs/core/class/translate.class.php @@ -154,7 +154,7 @@ class Translate * If $domain is "file@module" instead of "file" then we look for module lang file * in htdocs/custom/modules/mymodule/langs/code_CODE/file.lang * then in htdocs/module/langs/code_CODE/file.lang instead of htdocs/langs/code_CODE/file.lang - * @param string $alt 0 (try xx_ZZ then 1), 1 (try xx_XX then 2), 2 (try en_US or fr_FR or es_ES) + * @param string $alt 0 (try xx_ZZ then 1), 1 (try xx_XX then 2), 2 (try en_US) * @param int $stopafterdirection Stop when the DIRECTION tag is found (optimize speed) * @param int $forcelangdir To force a different lang directory * @return int <0 if KO, 0 if already loaded or loading not required, >0 if OK @@ -196,7 +196,7 @@ class Translate // Redefine alt $langarray=explode('_',$langofdir); if ($alt < 1 && isset($langarray[1]) && strtolower($langarray[0]) == strtolower($langarray[1])) $alt=1; - if ($alt < 2 && (strtolower($langofdir) == 'en_us' || strtolower($langofdir) == 'fr_fr' || strtolower($langofdir) == 'es_es')) $alt=2; + if ($alt < 2 && strtolower($langofdir) == 'en_us') $alt=2; foreach($this->dir as $keydir => $searchdir) { @@ -312,8 +312,8 @@ class Translate // This function MUST NOT contains call to syslog //dol_syslog("Translate::Load loading alternate translation file (to complete ".$this->defaultlang."/".$newdomain.".lang file)", LOG_DEBUG); $langofdir='en_US'; - if (preg_match('/^fr/i',$langarray[0])) $langofdir='fr_FR'; - if (preg_match('/^es/i',$langarray[0])) $langofdir='es_ES'; + //if (preg_match('/^fr/i',$langarray[0])) $langofdir='fr_FR'; + //if (preg_match('/^es/i',$langarray[0])) $langofdir='es_ES'; $this->load($domain,$alt+1,$stopafterdirection,$langofdir); } @@ -335,11 +335,12 @@ class Translate * Return translated value of key. Search in lang file, then into database. * Key must be any complete entry into lang file: CurrencyEUR, ... * If not found, return key. - * WARNING: To avoid infinite loop (getLabelFromKey->transnoentities->getTradFromKey), getLabelFromKey must - * not be called with same value than input. + * The string return is not formated (translated with transnoentitiesnoconv) + * NOTE: To avoid infinite loop (getLabelFromKey->transnoentities->getTradFromKey), if you modify this function, + * check that getLabelFromKey is not called with same value than input. * * @param string $key Key to translate - * @return string Translated string + * @return string Translated string (translated with transnoentitiesnoconv) */ private function getTradFromKey($key) { @@ -347,7 +348,6 @@ class Translate if (! is_string($key)) return 'ErrorBadValueForParamNotAString'; // Avoid multiple errors with code not using function correctly. - //print 'xx'.$key; $newstr=$key; if (preg_match('/^Currency([A-Z][A-Z][A-Z])$/i',$key,$reg)) { @@ -363,7 +363,7 @@ class Translate } else if (preg_match('/^Civility([0-9A-Z]+)$/i',$key,$reg)) { - $newstr=$this->getLabelFromKey($db,$reg[1],'c_civilite','code','civilite'); + $newstr=$this->getLabelFromKey($db,$reg[1],'c_civility','code','label'); } else if (preg_match('/^OrderSource([0-9A-Z]+)$/i',$key,$reg)) { @@ -592,7 +592,7 @@ class Translate { // Test si fichier dans repertoire de la langue alternative if ($this->defaultlang != "en_US") $filenamealt = $searchdir."/langs/en_US/".$filename; - else $filenamealt = $searchdir."/langs/fr_FR/".$filename; + //else $filenamealt = $searchdir."/langs/fr_FR/".$filename; if (is_readable(dol_osencode($filenamealt))) return true; } } @@ -676,7 +676,7 @@ class Translate $sql = "SELECT ".$fieldlabel." as label"; $sql.= " FROM ".MAIN_DB_PREFIX.$tablename; $sql.= " WHERE ".$fieldkey." = '".($keyforselect?$keyforselect:$key)."'"; - dol_syslog(get_class($this).'::getLabelFromKey sql='.$sql,LOG_DEBUG); + dol_syslog(get_class($this).'::getLabelFromKey', LOG_DEBUG); $resql = $db->query($sql); if ($resql) { @@ -690,7 +690,6 @@ class Translate else { $this->error=$db->lasterror(); - dol_syslog(get_class($this).'::getLabelFromKey error='.$this->error,LOG_ERR); return -1; } } @@ -756,7 +755,7 @@ class Translate if (! empty($currency_code)) $sql.=" AND code_iso = '".$currency_code."'"; //$sql.= " ORDER BY code_iso ASC"; // Not required, a sort is done later - dol_syslog(get_class($this).'::loadCacheCurrencies sql='.$sql, LOG_DEBUG); + dol_syslog(get_class($this).'::loadCacheCurrencies', LOG_DEBUG); $resql = $db->query($sql); if ($resql) { diff --git a/htdocs/core/db/DoliDB.class.php b/htdocs/core/db/DoliDB.class.php index aa0792c5970..e0921f7acac 100644 --- a/htdocs/core/db/DoliDB.class.php +++ b/htdocs/core/db/DoliDB.class.php @@ -32,14 +32,10 @@ abstract class DoliDB implements Database public $db; //! Database type public $type; - //! Database label - static $label; //! Charset used to force charset when creating database public $forcecharset='utf8'; //! Collate used to force collate when creating database public $forcecollate='utf8_general_ci'; - //! Min database version - static $versionmin; //! Resultset of last query private $_results; //! 1 if connected, else 0 diff --git a/htdocs/core/db/index.html b/htdocs/core/db/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/core/db/index.php b/htdocs/core/db/index.php deleted file mode 100644 index 7db0dd9ebf9..00000000000 --- a/htdocs/core/db/index.php +++ /dev/null @@ -1 +0,0 @@ -Url not available \ No newline at end of file diff --git a/htdocs/core/db/mssql.class.php b/htdocs/core/db/mssql.class.php index bf67bd7d8b3..09885257ef6 100644 --- a/htdocs/core/db/mssql.class.php +++ b/htdocs/core/db/mssql.class.php @@ -33,13 +33,13 @@ class DoliDBMssql extends DoliDB //! Database type public $type='mssql'; //! Database label - static $label='MSSQL'; + const LABEL='MSSQL'; //! Charset used to force charset when creating database var $forcecharset='latin1'; // Can't be static as it may be forced with a dynamic value //! Collate used to force collate when creating database var $forcecollate='latin1_swedish_ci'; // Can't be static as it may be forced with a dynamic value //! Version min database - static $versionmin=array(2000); + const VERSIONMIN='2000'; //! Resultset of last query private $_results; @@ -349,6 +349,8 @@ class DoliDBMssql extends DoliDB //print ""; + if (! in_array($query,array('BEGIN','COMMIT','ROLLBACK'))) dol_syslog('sql='.$query, LOG_DEBUG); + if (! $this->database_name) { // Ordre SQL ne necessitant pas de connexion a une base (exemple: CREATE DATABASE) @@ -370,7 +372,9 @@ class DoliDBMssql extends DoliDB $this->lastqueryerror = $query; $this->lasterror = $this->error(); $this->lasterrno = $row["code"]; - dol_syslog(get_class($this)."::query SQL error: ".$query, LOG_WARNING); + + dol_syslog(get_class($this)."::query SQL Error query: ".$query, LOG_ERR); + dol_syslog(get_class($this)."::query SQL Error message: ".$this->lasterror." (".$this->lasterrno.")", LOG_ERR); } $this->lastquery=$query; $this->_results = $ret; diff --git a/htdocs/core/db/mysql.class.php b/htdocs/core/db/mysql.class.php index bfd7c55b4c2..5be76d6d5d7 100644 --- a/htdocs/core/db/mysql.class.php +++ b/htdocs/core/db/mysql.class.php @@ -34,9 +34,9 @@ class DoliDBMysql extends DoliDB //! Database type public $type='mysql'; //! Database label - static $label='MySQL'; + const LABEL='MySQL'; //! Version min database - static $versionmin=array(4,1,0); + const VERSIONMIN='4.1.0'; //! Resultset of last query private $_results; @@ -252,6 +252,8 @@ class DoliDBMysql extends DoliDB { $query = trim($query); + if (! in_array($query,array('BEGIN','COMMIT','ROLLBACK'))) dol_syslog('sql='.$query, LOG_DEBUG); + if (! $this->database_name) { // Ordre SQL ne necessitant pas de connexion a une base (exemple: CREATE DATABASE) @@ -271,7 +273,8 @@ class DoliDBMysql extends DoliDB $this->lastqueryerror = $query; $this->lasterror = $this->error(); $this->lasterrno = $this->errno(); - dol_syslog(get_class($this)."::query SQL error: ".$query." ".$this->lasterrno." ".$this->lasterror, LOG_WARNING); + + dol_syslog(get_class($this)."::query SQL Error message: ".$this->lasterrno." ".$this->lasterror, LOG_ERR); } $this->lastquery=$query; $this->_results = $ret; @@ -827,11 +830,10 @@ class DoliDBMysql extends DoliDB { if ($this->lasterrno != 'DB_ERROR_USER_ALREADY_EXISTS') { - dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_ERR); return -1; } else - { + { // If user already exists, we continue to set permissions dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_WARNING); } @@ -841,17 +843,15 @@ class DoliDBMysql extends DoliDB $resql=$this->query($sql); if (! $resql) { - dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_ERR); return -1; } $sql="FLUSH Privileges"; - dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql); + dol_syslog(get_class($this)."::DDLCreateUser", LOG_DEBUG); $resql=$this->query($sql); if (! $resql) { - dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_ERR); return -1; } diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index 7a964d07afc..31cad578ce8 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -34,9 +34,9 @@ class DoliDBMysqli extends DoliDB //! Database type public $type='mysqli'; //! Database label - static $label='MySQL'; + const LABEL='MySQL'; //! Version min database - static $versionmin=array(4,1,0); + const VERSIONMIN='4.1.0'; //! Resultset of last query private $_results; @@ -255,6 +255,9 @@ class DoliDBMysqli extends DoliDB function query($query,$usesavepoint=0,$type='auto') { $query = trim($query); + + if (! in_array($query,array('BEGIN','COMMIT','ROLLBACK'))) dol_syslog('sql='.$query, LOG_DEBUG); + if (! $this->database_name) { // Ordre SQL ne necessitant pas de connexion a une base (exemple: CREATE DATABASE) @@ -273,7 +276,8 @@ class DoliDBMysqli extends DoliDB $this->lastqueryerror = $query; $this->lasterror = $this->error(); $this->lasterrno = $this->errno(); - dol_syslog(get_class($this)."::query SQL error: ".$query." ".$this->lasterrno." ".$this->lasterror, LOG_WARNING); + + dol_syslog(get_class($this)."::query SQL Error message: ".$this->lasterrno." ".$this->lasterror, LOG_ERR); } $this->lastquery=$query; $this->_results = $ret; @@ -831,11 +835,10 @@ class DoliDBMysqli extends DoliDB { if ($this->lasterrno != 'DB_ERROR_USER_ALREADY_EXISTS') { - dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_ERR); return -1; } else - { + { // If user already exists, we continue to set permissions dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_WARNING); } @@ -845,17 +848,15 @@ class DoliDBMysqli extends DoliDB $resql=$this->query($sql); if (! $resql) { - dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_ERR); return -1; } $sql="FLUSH Privileges"; - dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql); + dol_syslog(get_class($this)."::DDLCreateUser", LOG_DEBUG); $resql=$this->query($sql); if (! $resql) { - dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_ERR); return -1; } diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index 1200deee93e..01ff6774fc3 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -1,7 +1,7 @@ * Copyright (C) 2002-2005 Rodolphe Quiedeville - * Copyright (C) 2004-2012 Laurent Destailleur + * Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2004 Sebastien Di Cintio * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2005-2012 Regis Houssin @@ -37,13 +37,13 @@ class DoliDBPgsql extends DoliDB //! Database type public $type='pgsql'; // Name of manager //! Database label - static $label='PostgreSQL'; // Label of manager + const LABEL='PostgreSQL'; // Label of manager //! Charset var $forcecharset='UTF8'; // Can't be static as it may be forced with a dynamic value //! Collate used to force collate when creating database var $forcecollate=''; // Can't be static as it may be forced with a dynamic value //! Version min database - static $versionmin=array(8,4,0); // Version min database + const VERSIONMIN='8.4.0'; // Version min database //! Resultset of last query private $_results; @@ -491,7 +491,10 @@ class DoliDBPgsql extends DoliDB @pg_query($this->db, 'SAVEPOINT mysavepoint'); } + if (! in_array($query,array('BEGIN','COMMIT','ROLLBACK'))) dol_syslog('sql='.$query, LOG_DEBUG); + $ret = @pg_query($this->db, $query); + //print $query; if (! preg_match("/^COMMIT/i",$query) && ! preg_match("/^ROLLBACK/i",$query)) // Si requete utilisateur, on la sauvegarde ainsi que son resultset { @@ -503,9 +506,10 @@ class DoliDBPgsql extends DoliDB $this->lasterror = $this->error(); $this->lasterrno = $this->errno(); } - dol_syslog(get_class($this)."::query SQL error usesavepoint = ".$usesavepoint." - ".$query." - ".pg_last_error($this->db)." => ".$this->errno(), LOG_WARNING); - //print "\n>> ".$query."
\n"; - //print '>> '.$this->lasterrno.' - '.$this->lasterror.' - '.$this->lastqueryerror."
\n"; + + dol_syslog(get_class($this)."::query SQL Error query: ".$query, LOG_ERR); + dol_syslog(get_class($this)."::query SQL Error message: ".$this->lasterror." (".$this->lasterrno.")", LOG_ERR); + dol_syslog(get_class($this)."::query SQL error usesavepoint = ".$usesavepoint, LOG_ERR); if ($usesavepoint && $this->transaction_opened) // Warning, after that errno will be erased { diff --git a/htdocs/core/db/sqlite.class.php b/htdocs/core/db/sqlite.class.php index ad5c6532c9e..dd040a9b199 100644 --- a/htdocs/core/db/sqlite.class.php +++ b/htdocs/core/db/sqlite.class.php @@ -34,9 +34,9 @@ class DoliDBSqlite extends DoliDB //! Database type public $type='sqlite'; //! Database label - static $label='PDO Sqlite'; + const LABEL='PDO Sqlite'; //! Version min database - static $versionmin=array(3,0,0); + const VERSIONMIN='3.0.0'; //! Resultset of last query private $_results; @@ -389,7 +389,9 @@ class DoliDBSqlite extends DoliDB $query=$this->convertSQLFromMysql($query,$type); //print "After convertSQLFromMysql:\n".$query."
\n"; - // Ordre SQL ne necessitant pas de connexion a une base (exemple: CREATE DATABASE) + dol_syslog('sql='.$query, LOG_DEBUG); + + // Ordre SQL ne necessitant pas de connexion a une base (exemple: CREATE DATABASE) try { //$ret = $this->db->exec($query); $ret = $this->db->query($query); // $ret is a PDO object @@ -407,8 +409,16 @@ class DoliDBSqlite extends DoliDB $this->lastqueryerror = $query; $this->lasterror = $this->error(); $this->lasterrno = $this->errno(); - if (preg_match('/[0-9]/',$this->lasterrno)) dol_syslog(get_class($this)."::query SQL error: ".$query." ".$this->lasterrno." ".$this->lasterror, LOG_WARNING); - else dol_syslog(get_class($this)."::query SQL error: ".$query." ".$this->lasterrno, LOG_WARNING); + + dol_syslog(get_class($this)."::query SQL Error query: ".$query, LOG_ERR); + + $errormsg = get_class($this)."::query SQL Error message: ".$this->lasterror; + + if (preg_match('/[0-9]/',$this->lasterrno)) { + $errormsg .= ' ('.$this->lasterrno.')'; + } + + dol_syslog($errormsg, LOG_ERR); } $this->lastquery=$query; $this->_results = $ret; @@ -970,7 +980,6 @@ class DoliDBSqlite extends DoliDB $resql=$this->query($sql); if (! $resql) { - dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_ERR); return -1; } @@ -979,21 +988,19 @@ class DoliDBSqlite extends DoliDB $sql.= " VALUES ('".$this->escape($dolibarr_main_db_host)."','".$this->escape($dolibarr_main_db_name)."','".addslashes($dolibarr_main_db_user)."'"; $sql.= ",'Y','Y','Y','Y','Y','Y','Y','Y','Y')"; - dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql); + dol_syslog(get_class($this)."::DDLCreateUser", LOG_DEBUG); $resql=$this->query($sql); if (! $resql) { - dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_ERR); return -1; } $sql="FLUSH Privileges"; - dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql); + dol_syslog(get_class($this)."::DDLCreateUser", LOG_DEBUG); $resql=$this->query($sql); if (! $resql) { - dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_ERR); return -1; } diff --git a/htdocs/core/filemanagerdol/browser/default/images/icons/32/index.html b/htdocs/core/filemanagerdol/browser/default/images/icons/32/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/core/filemanagerdol/browser/default/images/icons/index.html b/htdocs/core/filemanagerdol/browser/default/images/icons/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/core/filemanagerdol/browser/default/images/index.html b/htdocs/core/filemanagerdol/browser/default/images/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/core/filemanagerdol/browser/default/index.html b/htdocs/core/filemanagerdol/browser/default/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/core/filemanagerdol/browser/default/js/index.html b/htdocs/core/filemanagerdol/browser/default/js/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/core/filemanagerdol/browser/index.html b/htdocs/core/filemanagerdol/browser/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/core/filemanagerdol/connectors/index.html b/htdocs/core/filemanagerdol/connectors/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/core/filemanagerdol/connectors/php/basexml.php b/htdocs/core/filemanagerdol/connectors/php/basexml.php index 439353b4e26..72c36761386 100644 --- a/htdocs/core/filemanagerdol/connectors/php/basexml.php +++ b/htdocs/core/filemanagerdol/connectors/php/basexml.php @@ -101,6 +101,13 @@ function SendError($number, $text) exit ; } +/** + * SendErrorNode + * + * @param integer $number Number + * @param string $text Text of error + * @return string Error node + */ function SendErrorNode($number, $text) { if ($text) diff --git a/htdocs/core/filemanagerdol/connectors/php/index.html b/htdocs/core/filemanagerdol/connectors/php/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/core/filemanagerdol/connectors/php/io.php b/htdocs/core/filemanagerdol/connectors/php/io.php index 50ce4a33f05..4183b0e0573 100644 --- a/htdocs/core/filemanagerdol/connectors/php/io.php +++ b/htdocs/core/filemanagerdol/connectors/php/io.php @@ -70,6 +70,14 @@ function GetResourceTypeDirectory($resourceType, $sCommand) } } +/** + * GetUrlFromPath + * + * @param string $resourceType Resource type + * @param string $folderPath Path + * @param string $sCommand Command + * @return string Full url + */ function GetUrlFromPath($resourceType, $folderPath, $sCommand) { return CombinePaths(GetResourceTypePath($resourceType, $sCommand), $folderPath); diff --git a/htdocs/core/filemanagerdol/index.html b/htdocs/core/filemanagerdol/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/core/filemanagerdol/index.php b/htdocs/core/filemanagerdol/index.php deleted file mode 100644 index 7db0dd9ebf9..00000000000 --- a/htdocs/core/filemanagerdol/index.php +++ /dev/null @@ -1 +0,0 @@ -Url not available \ No newline at end of file diff --git a/htdocs/core/index.html b/htdocs/core/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/core/index.php b/htdocs/core/index.php deleted file mode 100644 index 7db0dd9ebf9..00000000000 --- a/htdocs/core/index.php +++ /dev/null @@ -1 +0,0 @@ -Url not available \ No newline at end of file diff --git a/htdocs/core/js/index.html b/htdocs/core/js/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/core/js/index.php b/htdocs/core/js/index.php deleted file mode 100644 index 7db0dd9ebf9..00000000000 --- a/htdocs/core/js/index.php +++ /dev/null @@ -1 +0,0 @@ -Url not available \ No newline at end of file diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index c389f442830..b6f2b02567a 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -215,7 +215,6 @@ function run_sql($sqlfile,$silent=1,$entity='',$usesavepoint=1,$handler='',$oker } else { - dol_syslog('Admin.lib::run_sql Failed to get max rowid for '.$table.' '.$db->lasterror().' sql='.$sqlgetrowid, LOG_ERR); if (! $silent) print '
"; if (! $silent) print ''; @@ -226,7 +225,7 @@ function run_sql($sqlfile,$silent=1,$entity='',$usesavepoint=1,$handler='',$oker $from='__+MAX_'.$table.'__'; $to='+'.$listofmaxrowid[$table]; $newsql=str_replace($from,$to,$newsql); - dol_syslog('Admin.lib::run_sql New Request '.($i+1).' (replacing '.$from.' to '.$to.') sql='.$newsql, LOG_DEBUG); + dol_syslog('Admin.lib::run_sql New Request '.($i+1).' (replacing '.$from.' to '.$to.')', LOG_DEBUG); $arraysql[$i]=$newsql; } @@ -251,7 +250,7 @@ function run_sql($sqlfile,$silent=1,$entity='',$usesavepoint=1,$handler='',$oker // Ajout trace sur requete (eventuellement a commenter si beaucoup de requetes) if (! $silent) print '\n"; - dol_syslog('Admin.lib::run_sql Request '.($i+1).' sql='.$newsql, LOG_DEBUG); + dol_syslog('Admin.lib::run_sql Request '.($i+1), LOG_DEBUG); $sqlmodified=0; // Replace for encrypt data @@ -300,7 +299,7 @@ function run_sql($sqlfile,$silent=1,$entity='',$usesavepoint=1,$handler='',$oker $sqlmodified++; } - if ($sqlmodified) dol_syslog('Admin.lib::run_sql New Request '.($i+1).' sql='.$newsql, LOG_DEBUG); + if ($sqlmodified) dol_syslog('Admin.lib::run_sql New Request '.($i+1), LOG_DEBUG); $result=$db->query($newsql,$usesavepoint); if ($result) @@ -393,7 +392,7 @@ function dolibarr_del_const($db, $name, $entity=1) $sql.= ")"; if ($entity >= 0) $sql.= " AND entity = ".$entity; - dol_syslog("admin.lib::dolibarr_del_const sql=".$sql); + dol_syslog("admin.lib::dolibarr_del_const", LOG_DEBUG); $resql=$db->query($sql); if ($resql) { @@ -427,7 +426,7 @@ function dolibarr_get_const($db, $name, $entity=1) $sql.= " WHERE name = ".$db->encrypt($name,1); $sql.= " AND entity = ".$entity; - dol_syslog("admin.lib::dolibarr_get_const sql=".$sql); + dol_syslog("admin.lib::dolibarr_get_const", LOG_DEBUG); $resql=$db->query($sql); if ($resql) { @@ -474,7 +473,7 @@ function dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $not $sql.= " WHERE name = ".$db->encrypt($name,1); if ($entity >= 0) $sql.= " AND entity = ".$entity; - dol_syslog("admin.lib::dolibarr_set_const sql=".$sql, LOG_DEBUG); + dol_syslog("admin.lib::dolibarr_set_const", LOG_DEBUG); $resql=$db->query($sql); if (strcmp($value,'')) // true if different. Must work for $value='0' or $value=0 @@ -487,7 +486,7 @@ function dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $not //print "sql".$value."-".pg_escape_string($value)."-".$sql;exit; //print "xx".$db->escape($value); - dol_syslog("admin.lib::dolibarr_set_const sql=".$sql, LOG_DEBUG); + dol_syslog("admin.lib::dolibarr_set_const", LOG_DEBUG); $resql=$db->query($sql); } @@ -500,7 +499,6 @@ function dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $not else { $error=$db->lasterror(); - dol_syslog("admin.lib::dolibarr_set_const ".$error, LOG_ERR); $db->rollback(); return -1; } @@ -864,9 +862,10 @@ function unActivateModule($value, $requiredby=1) * @param array &$tabrowid Tabrowid * @param array &$tabcond Tabcond * @param array &$tabhelp Tabhelp + * @param array &$tabfieldcheck Tabfieldcheck * @return int 1 */ -function complete_dictionary_with_modules(&$taborder,&$tabname,&$tablib,&$tabsql,&$tabsqlsort,&$tabfield,&$tabfieldvalue,&$tabfieldinsert,&$tabrowid,&$tabcond,&$tabhelp) +function complete_dictionary_with_modules(&$taborder,&$tabname,&$tablib,&$tabsql,&$tabsqlsort,&$tabfield,&$tabfieldvalue,&$tabfieldinsert,&$tabrowid,&$tabcond,&$tabhelp,&$tabfieldcheck) { global $db, $modules, $conf, $langs; @@ -979,6 +978,7 @@ function complete_dictionary_with_modules(&$taborder,&$tabname,&$tablib,&$tabsql foreach($objMod->dictionaries['tabfieldinsert'] as $val) $tabfieldinsert[] = $val; foreach($objMod->dictionaries['tabrowid'] as $val) $tabrowid[] = $val; foreach($objMod->dictionaries['tabcond'] as $val) $tabcond[] = $val; + foreach($objMod->dictionaries['tabfieldcheck'] as $val) $tabfieldcheck[] = $val; if (! empty($objMod->dictionaries['tabhelp'])) foreach($objMod->dictionaries['tabhelp'] as $val) $tabhelp[] = $val; //foreach($objMod->dictionaries['tabsqlsort'] as $val) $tablib[] = $val; //$tabname = array_merge ($tabname, $objMod->dictionaries['tabname']); @@ -1043,7 +1043,7 @@ function form_constantes($tableau,$strictw3c=0) $sql.= " ORDER BY name ASC, entity DESC"; $result = $db->query($sql); - dol_syslog("List params sql=".$sql); + dol_syslog("List params", LOG_DEBUG); if ($result) { $obj = $db->fetch_object($result); // Take first result of select @@ -1217,7 +1217,7 @@ function addDocumentModel($name, $type, $label='', $description='') $sql.= (! empty($description)?"'".$db->escape($description)."'":"null"); $sql.= ")"; - dol_syslog("admin.lib::addDocumentModel sql=".$sql); + dol_syslog("admin.lib::addDocumentModel", LOG_DEBUG); $resql=$db->query($sql); if ($resql) { @@ -1250,7 +1250,7 @@ function delDocumentModel($name, $type) $sql.= " AND type = '".$type."'"; $sql.= " AND entity = ".$conf->entity; - dol_syslog("admin.lib::delDocumentModel sql=".$sql); + dol_syslog("admin.lib::delDocumentModel", LOG_DEBUG); $resql=$db->query($sql); if ($resql) { diff --git a/htdocs/core/lib/agenda.lib.php b/htdocs/core/lib/agenda.lib.php index e730a1ed45b..a0c1e3f1b4b 100644 --- a/htdocs/core/lib/agenda.lib.php +++ b/htdocs/core/lib/agenda.lib.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2008-2014 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2011 Juanjo Menent * @@ -39,25 +39,29 @@ * @param string $filterd Filter of done by user * @param int $pid Product id * @param int $socid Third party id + * @param string $action Action string * @param array $showextcals Array with list of external calendars (used to show links to select calendar), or -1 to show no legend * @param string $actioncode Preselected value of actioncode for filter on type + * @param int $usergroupid Id of group to filter on users * @return void */ -function print_actions_filter($form, $canedit, $status, $year, $month, $day, $showbirthday, $filtera, $filtert, $filterd, $pid, $socid, $showextcals=array(), $actioncode='') { - - global $conf, $user, $langs, $db; +function print_actions_filter($form, $canedit, $status, $year, $month, $day, $showbirthday, $filtera, $filtert, $filterd, $pid, $socid, $action, $showextcals=array(), $actioncode='', $usergroupid='') +{ + global $conf, $user, $langs, $db, $hookmanager; // Filters print '
'; print ''; - print ''; print ''; print ''; print ''; + print ''; print ''; - print '
'; } - $ret.=$object->$fieldref; + $ret.=dol_htmlentities($object->$fieldref); if ($morehtmlref) { $ret.=' '.$morehtmlref; @@ -4196,6 +4330,7 @@ class Form * @param int $enableonly Array list of groups id to be enabled. All other must be disabled * @param int $force_entity 0 or Id of environment to force * @return void + * @see select_dolusers */ function select_dolgroups($selected='', $htmlname='groupid', $show_empty=0, $exclude='', $disabled=0, $include='', $enableonly='', $force_entity=0) { @@ -4229,7 +4364,7 @@ class Form if (is_array($include) && $includeGroups) $sql.= " AND ug.rowid IN ('".$includeGroups."')"; $sql.= " ORDER BY ug.nom ASC"; - dol_syslog(get_class($this)."::select_dolgroups sql=".$sql); + dol_syslog(get_class($this)."::select_dolgroups", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -4237,7 +4372,7 @@ class Form $i = 0; if ($num) { - $out.= ''; if ($show_empty) $out.= ''."\n"; while ($i < $num) diff --git a/htdocs/core/class/html.formactions.class.php b/htdocs/core/class/html.formactions.class.php index 522b2c30662..ed32fcc9f0d 100644 --- a/htdocs/core/class/html.formactions.class.php +++ b/htdocs/core/class/html.formactions.class.php @@ -48,13 +48,15 @@ class FormActions /** * Show list of action status * - * @param string $formname Name of form where select in included - * @param string $selected Preselected value (-1..100) - * @param int $canedit 1=can edit, 0=read only - * @param string $htmlname Name of html prefix for html fields (selectX and valX) + * @param string $formname Name of form where select is included + * @param string $selected Preselected value (-1..100) + * @param int $canedit 1=can edit, 0=read only + * @param string $htmlname Name of html prefix for html fields (selectX and valX) + * @param string $showempty Show an empty line if select is used + * @param string $onlyselect 0=Standard, 1=Hide percent of completion and force usage of a select list, 2=Same than 1 and add "Incomplete (Todo+Running) * @return void */ - function form_select_status_action($formname,$selected,$canedit=1,$htmlname='complete') + function form_select_status_action($formname,$selected,$canedit=1,$htmlname='complete',$showempty=0,$onlyselect=0) { global $langs,$conf; @@ -64,6 +66,7 @@ class FormActions '50' => $langs->trans("ActionRunningShort"), '100' => $langs->trans("ActionDoneShort") ); + // +ActionUncomplete if (! empty($conf->use_javascript_ajax)) { @@ -112,18 +115,32 @@ class FormActions } } \n"; - print ''; + if ($showempty) print ''; foreach($listofstatus as $key => $val) { - print ''; + print ''; + if ($key == '50' && $onlyselect == 2) + { + print ''; + } } print ''; if ($selected == 0 || $selected == 100) $canedit=0; - print ' =0)?'':' disabled="disabled"').'>'; - print '%'; + + if (empty($onlyselect)) + { + print ' =0)?'':' disabled="disabled"').'>'; + print '%'; + } } else - { + { print ' %'; } } @@ -213,14 +230,15 @@ class FormActions * @param string $htmlname Nom champ formulaire * @param string $excludetype Type to exclude * @param string $onlyautoornot Group list by auto events or not: We keep only the 2 generic lines (AC_OTH and AC_OTH_AUTO) + * @param int $hideinfohelp 1=Do not show info help * @return void */ - function select_type_actions($selected='',$htmlname='actioncode',$excludetype='',$onlyautoornot=0) + function select_type_actions($selected='',$htmlname='actioncode',$excludetype='',$onlyautoornot=0, $hideinfohelp=0) { global $langs,$user,$form; if (! is_object($form)) $form=new Form($db); - + require_once DOL_DOCUMENT_ROOT.'/comm/action/class/cactioncomm.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; $caction=new CActionComm($this->db); @@ -234,7 +252,7 @@ class FormActions if ($selected == 'auto') $selected='AC_OTH_AUTO'; print $form->selectarray($htmlname, $arraylist, $selected); - if ($user->admin && empty($onlyautoornot)) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); + if ($user->admin && empty($onlyautoornot) && empty($hideinfohelp)) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); } } diff --git a/htdocs/core/class/html.formadmin.class.php b/htdocs/core/class/html.formadmin.class.php index f7a6154706f..042474781d7 100644 --- a/htdocs/core/class/html.formadmin.class.php +++ b/htdocs/core/class/html.formadmin.class.php @@ -180,7 +180,7 @@ class FormAdmin $newprefix=$tab[0]; if ($newprefix=='1' && ($conf->global->MAIN_FEATURES_LEVEL < 1)) continue; if ($newprefix=='2' && ($conf->global->MAIN_FEATURES_LEVEL < 2)) continue; - if (! empty($conf->browser->firefox) && $newprefix != $oldprefix) // Add separators + if ($newprefix != $oldprefix) // Add separators { // Affiche titre print '
'; if (! $silent) print '
'.$langs->trans("Failed to get max rowid for ".$table)."
'.$langs->trans("Request").' '.($i+1)." sql='".dol_htmlentities($newsql,ENT_NOQUOTES)."'
'; - print ''; + + if (! empty($conf->browser->phone)) print '
'; + else print '
'; + print '
'; + + if (! empty($conf->browser->phone)) print '
'; + else print ''; - - // Buttons - print ''; - - // Legend - if ($conf->use_javascript_ajax && is_array($showextcals)) - { - print ''; - } - - print ''; + // Hooks + $parameters = array('canedit'=>$canedit, 'pid'=>$pid, 'socid'=>$socid); + $reshook = $hookmanager->executeHooks('searchAgendaFrom', $parameters, $object, $action); // Note that $action and $object may have been print '
'; print ''; @@ -65,17 +69,27 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh { print ''; print ''; - print ''; - - print ''; - print ''; /*print ''; @@ -87,13 +101,29 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php'; $formactions=new FormActions($db); + print ''; print ''; + print ''; + print ''; + } + + if (! empty($conf->societe->enabled) && $user->rights->societe->lire) + { + print ''; + print ''; } @@ -110,62 +140,31 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh print ''; } - print '
'; - print $langs->trans("ActionsAskedBy"); - print '  '; - print $form->select_dolusers($filtera, 'userasked', 1, '', ! $canedit); - print '
'; - print $langs->trans("or") . ' ' . $langs->trans("ActionsToDoBy"); - print '  '; + //print $langs->trans("ActionsAskedBy"); + //print '  '; + //print $form->select_dolusers($filtera, 'userasked', 1, '', ! $canedit); + //print '   '.$langs->trans("or") . ' '; + print $langs->trans("ActionAffectedTo").'   '; + print ''; + //print $langs->trans("User"); print $form->select_dolusers($filtert, 'usertodo', 1, '', ! $canedit); + if (! empty($conf->use_javascript_ajax)) + { + include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; + print ajax_combobox('usertodo'); + } + if (empty($conf->dol_optimize_smallscreen)) print '   '.$langs->trans("or") . ' '; + else print '
'; + print $langs->trans("Group").'   '; + print $form->select_dolgroups($usergroupid, 'usergroup', 1, '', ! $canedit); + if (! empty($conf->use_javascript_ajax)) + { + print ajax_combobox('usergroup'); + } print '
'; print $langs->trans("Type"); print '  '; - print $formactions->select_type_actions($actioncode, "actioncode", '', (empty($conf->global->AGENDA_USE_EVENT_TYPE) ? 1 : 0)); + print '
'; + print $langs->trans("Status"); + print '  '; + $formactions->form_select_status_action('formaction',$status,1,'status',1,2); + print '
'; + print $langs->trans("ThirdParty").'   '; + print ''; + print $form->select_thirdparty($socid, 'socid'); print '
'; - print '
'; - print img_picto($langs->trans("ViewCal"), 'object_calendar', 'class="hideonsmartphone"') . ' '; - print '
'; - print img_picto($langs->trans("ViewWeek"), 'object_calendarweek', 'class="hideonsmartphone"') . ' '; - print '
'; - print img_picto($langs->trans("ViewDay"), 'object_calendarday', 'class="hideonsmartphone"') . ' '; - print '
'; - print img_picto($langs->trans("ViewList"), 'object_list', 'class="hideonsmartphone"') . ' '; - print '
'; - print '' . "\n"; - print ''; - if (! empty($conf->use_javascript_ajax)) - { - if (count($showextcals) > 0) - { - print ''; - foreach ($showextcals as $val) - { - $htmlname = dol_string_nospecial($val['name']); - print ''; - } - } - } - print ''; - print '
' . $langs->trans("LocalAgenda") . '
'; - print '' . "\n"; - print ' ' . $val ['name']; - print '
'.$langs->trans("AgendaShowBirthdayEvents").'
'; - print '
'; + + if (! empty($conf->browser->phone)) print '
'; + else print '
'; + + print ''; + print '
'; + print '
'; + print ''; + print '
'; + print '
'; + + if (! empty($conf->browser->phone)) print ''; + else print '
'; + + print ''; // Close fichecenter + print '
'; + print ''; } @@ -369,6 +368,11 @@ function agenda_prepare_head() $h = 0; $head = array(); + $head[$h][0] = DOL_URL_ROOT."/admin/agenda_other.php"; + $head[$h][1] = $langs->trans("Miscellaneous"); + $head[$h][2] = 'other'; + $h++; + $head[$h][0] = DOL_URL_ROOT."/admin/agenda.php"; $head[$h][1] = $langs->trans("AutoActions"); $head[$h][2] = 'autoactions'; @@ -384,11 +388,6 @@ function agenda_prepare_head() $head[$h][2] = 'extsites'; $h++; - $head[$h][0] = DOL_URL_ROOT."/admin/agenda_other.php"; - $head[$h][1] = $langs->trans("Other"); - $head[$h][2] = 'other'; - $h++; - complete_head_from_modules($conf,$langs,null,$head,$h,'agenda_admin'); $head[$h][0] = DOL_URL_ROOT."/admin/agenda_extrafields.php"; @@ -464,9 +463,31 @@ function calendars_prepare_head($param) $h = 0; $head = array(); - $head[$h][0] = DOL_URL_ROOT.'/comm/action/index.php'.($param?'?'.$param:''); - $head[$h][1] = $langs->trans("Agenda"); - $head[$h][2] = 'card'; + $head[$h][0] = DOL_URL_ROOT.'/comm/action/index.php?action=show_month'.($param?'&'.$param:''); + $head[$h][1] = $langs->trans("ViewCal"); + $head[$h][2] = 'cardmonth'; + $h++; + + $head[$h][0] = DOL_URL_ROOT.'/comm/action/index.php?action=show_week'.($param?'&'.$param:''); + $head[$h][1] = $langs->trans("ViewWeek"); + $head[$h][2] = 'cardweek'; + $h++; + + //$paramday=$param; + //if (preg_match('/&month=\d+/',$paramday) && ! preg_match('/&day=\d+/',$paramday)) $paramday.='&day=1'; + $head[$h][0] = DOL_URL_ROOT.'/comm/action/index.php?action=show_day'.($param?'&'.$param:''); + $head[$h][1] = $langs->trans("ViewDay"); + $head[$h][2] = 'cardday'; + $h++; + + $head[$h][0] = DOL_URL_ROOT.'/comm/action/listactions.php'.($param?'?'.$param:''); + $head[$h][1] = $langs->trans("ViewList"); + $head[$h][2] = 'cardlist'; + $h++; + + $head[$h][0] = DOL_URL_ROOT.'/comm/action/peruser.php'.($param?'?'.$param:''); + $head[$h][1] = $langs->trans("ViewPerUser"); + $head[$h][2] = 'cardperuser'; $h++; $object=new stdClass(); diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index e0b1bba891d..e68fe78bc87 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -400,45 +400,53 @@ function ajax_constantonoff($code, $input=array(), $entity=null, $revertonoff=0, $entity = ((isset($entity) && is_numeric($entity) && $entity >= 0) ? $entity : $conf->entity); - $out= "\n".' - '."\n"; - // Del constant - $("#del_" + code).click(function() { - if (input.alert && input.alert.del) { - if (input.alert.del.yesButton) yesButton = input.alert.del.yesButton; - if (input.alert.del.noButton) noButton = input.alert.del.noButton; - confirmConstantAction("del", url, code, input, input.alert.del, entity, yesButton, noButton, strict); - } else { - delConstant(url, code, input, entity, strict); - } - }); - }); - '."\n"; - - $out.= ''; - $out.= ''.($revertonoff?img_picto($langs->trans("Enabled"),'switch_on'):img_picto($langs->trans("Disabled"),'switch_off')).''; - $out.= ''.($revertonoff?img_picto($langs->trans("Disabled"),'switch_off'):img_picto($langs->trans("Enabled"),'switch_on')).''; - $out.="\n"; + $out.= ''; + $out.= ''.($revertonoff?img_picto($langs->trans("Enabled"),'switch_on'):img_picto($langs->trans("Disabled"),'switch_off')).''; + $out.= ''.($revertonoff?img_picto($langs->trans("Disabled"),'switch_off'):img_picto($langs->trans("Enabled"),'switch_on')).''; + $out.="\n"; + } return $out; } diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 0851fb0b7c1..acd39a38901 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -64,13 +64,21 @@ function societe_prepare_head($object) $h++; } - if (($object->localtax1_assuj || $object->localtax2_assuj) && (isset($conf->global->MAIN_FEATURES_LEVEL) && $conf->global->MAIN_FEATURES_LEVEL > 0) ) - { - $head[$h][0] = DOL_URL_ROOT.'/societe/localtaxes.php?socid='.$object->id; - $head[$h][1] = $langs->trans("LocalTaxes"); - $head[$h][2] = 'localtaxes'; - $h++; - } + if (! empty($conf->global->MAIN_SUPPORT_SHARED_CONTACT_BETWEEN_THIRDPARTIES)) + { + $head[$h][0] = DOL_URL_ROOT.'/societe/societecontact.php?socid='.$object->id; + $head[$h][1] = $langs->trans("Contact"); + $head[$h][2] = 'contact'; + $h++; + } + + if (($object->localtax1_assuj || $object->localtax2_assuj) && (isset($conf->global->MAIN_FEATURES_LEVEL) && $conf->global->MAIN_FEATURES_LEVEL > 0) ) + { + $head[$h][0] = DOL_URL_ROOT.'/societe/localtaxes.php?socid='.$object->id; + $head[$h][1] = $langs->trans("LocalTaxes"); + $head[$h][2] = 'localtaxes'; + $h++; + } if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) )) { @@ -262,19 +270,19 @@ function getCountry($searchkey,$withcode='',$dbtouse=0,$outputlangs='',$entconv= if (! is_object($dbtouse)) $dbtouse=$db; if (! is_object($outputlangs)) $outputlangs=$langs; - $sql = "SELECT rowid, code, libelle FROM ".MAIN_DB_PREFIX."c_pays"; + $sql = "SELECT rowid, code, label FROM ".MAIN_DB_PREFIX."c_country"; if (is_numeric($searchkey)) $sql.= " WHERE rowid=".$searchkey; elseif (! empty($searchkey)) $sql.= " WHERE code='".$db->escape($searchkey)."'"; - else $sql.= " WHERE libelle='".$db->escape($searchlabel)."'"; + else $sql.= " WHERE label='".$db->escape($searchlabel)."'"; - dol_syslog("Company.lib::getCountry sql=".$sql); + dol_syslog("Company.lib::getCountry", LOG_DEBUG); $resql=$dbtouse->query($sql); if ($resql) { $obj = $dbtouse->fetch_object($resql); if ($obj) { - $label=((! empty($obj->libelle) && $obj->libelle!='-')?$obj->libelle:''); + $label=((! empty($obj->label) && $obj->label!='-')?$obj->label:''); if (is_object($outputlangs)) { $outputlangs->load("dict"); @@ -317,7 +325,7 @@ function getState($id,$withcode='',$dbtouse=0) $sql = "SELECT rowid, code_departement as code, nom as label FROM ".MAIN_DB_PREFIX."c_departements"; $sql.= " WHERE rowid=".$id; - dol_syslog("Company.lib::getState sql=".$sql); + dol_syslog("Company.lib::getState", LOG_DEBUG); $resql=$dbtouse->query($sql); if ($resql) { @@ -394,7 +402,7 @@ function getFormeJuridiqueLabel($code) $sql = "SELECT libelle FROM ".MAIN_DB_PREFIX."c_forme_juridique"; $sql.= " WHERE code='$code'"; - dol_syslog("Company.lib::getFormeJuridiqueLabel sql=".$sql); + dol_syslog("Company.lib::getFormeJuridiqueLabel", LOG_DEBUG); $resql=$db->query($sql); if ($resql) { @@ -626,7 +634,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') // Status print '
'; - print $form->selectarray('search_status', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')),$search_status); + print $form->selectarray('search_status', array('-1'=>'','0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')),$search_status); print '
'; print ''; - print_liste_field_titre($langs->trans("Project"),"index.php","","","","",$sortfield,$sortorder); + print_liste_field_titre($title,"index.php","","","","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Tasks"),"","","","",'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Status"),"","","","",'align="right"',$sortfield,$sortorder); print "\n"; @@ -672,6 +677,10 @@ function print_projecttasks_array($db, $socid, $projectsListId, $mytasks=0) $sql.= " AND ctc.element = 'project_task'"; $sql.= " AND ec.fk_socpeople = ".$user->id; } + if ($statut >= 0) + { + $sql.= " AND p.fk_statut = ".$statut; + } $sql.= " GROUP BY p.rowid, p.ref, p.title, p.fk_user_creat, p.public, p.fk_statut"; $sql.= " ORDER BY p.title, p.ref"; diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index 31e900f8e7e..c8cccefda7f 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -470,7 +470,6 @@ function restrictedArea($user, $features, $objectid=0, $dbtablename='', $feature } else { - dol_syslog("security.lib:restrictedArea sql=".$sql, LOG_ERR); accessforbidden(); } } diff --git a/htdocs/core/lib/sendings.lib.php b/htdocs/core/lib/sendings.lib.php index 2bfb2ba7c17..d2f3bf563c6 100644 --- a/htdocs/core/lib/sendings.lib.php +++ b/htdocs/core/lib/sendings.lib.php @@ -171,7 +171,7 @@ function show_list_sending_receive($origin,$origin_id,$filter='') $sql.= " ORDER BY obj.fk_product"; - dol_syslog("show_list_sending_receive sql=".$sql, LOG_DEBUG); + dol_syslog("show_list_sending_receive", LOG_DEBUG); $resql = $db->query($sql); if ($resql) { diff --git a/htdocs/core/lib/tax.lib.php b/htdocs/core/lib/tax.lib.php index a52aeb37345..164d346ac1c 100644 --- a/htdocs/core/lib/tax.lib.php +++ b/htdocs/core/lib/tax.lib.php @@ -194,7 +194,7 @@ function vat_by_thirdparty($db, $y, $date_start, $date_end, $modetax, $direction if ($sql == 'TODO') return -2; if ($sql != 'TODO') { - dol_syslog("Tax.lib:thirdparty sql=".$sql); + dol_syslog("Tax.lib:thirdparty", LOG_DEBUG); $resql = $db->query($sql); if ($resql) { @@ -366,7 +366,7 @@ function vat_by_date($db, $y, $q, $date_start, $date_end, $modetax, $direction, if ($sql == 'TODO') return -2; if ($sql != 'TODO') { - dol_syslog("Tax.lib.php::vat_by_date sql=".$sql); + dol_syslog("Tax.lib.php::vat_by_date", LOG_DEBUG); $resql = $db->query($sql); if ($resql) @@ -531,7 +531,7 @@ function vat_by_date($db, $y, $q, $date_start, $date_end, $modetax, $direction, if ($sql == 'TODO') return -2; // -2 = Feature not yet available if ($sql != 'TODO') { - dol_syslog("Tax.lib.php::vat_by_date sql=".$sql); + dol_syslog("Tax.lib.php::vat_by_date", LOG_DEBUG); $resql = $db->query($sql); if ($resql) { diff --git a/htdocs/core/lib/trip.lib.php b/htdocs/core/lib/trip.lib.php index 60794497554..7d58e9e01b1 100644 --- a/htdocs/core/lib/trip.lib.php +++ b/htdocs/core/lib/trip.lib.php @@ -54,10 +54,8 @@ function trip_prepare_head($object) $head[$h][1] = $langs->trans("Info"); $head[$h][2] = 'info'; $h++; - + complete_head_from_modules($conf,$langs,$object,$head,$h,'trip','remove'); return $head; } - -?> \ No newline at end of file diff --git a/htdocs/core/lib/usergroups.lib.php b/htdocs/core/lib/usergroups.lib.php index d6097b6f5a1..97354bd08ab 100644 --- a/htdocs/core/lib/usergroups.lib.php +++ b/htdocs/core/lib/usergroups.lib.php @@ -71,6 +71,14 @@ function user_prepare_head($object) $head[$h][2] = 'guisetup'; $h++; + if (! empty($conf->agenda->enabled)) + { + $head[$h][0] = DOL_URL_ROOT.'/user/agenda_extsites.php?id='.$object->id; + $head[$h][1] = $langs->trans("ExtSites"); + $head[$h][2] = 'extsites'; + $h++; + } + if (! empty($conf->clicktodial->enabled)) { $head[$h][0] = DOL_URL_ROOT.'/user/clicktodial.php?id='.$object->id; @@ -88,10 +96,24 @@ function user_prepare_head($object) //Info on users is visible only by internal user if (empty($user->societe_id)) { - $head[$h][0] = DOL_URL_ROOT.'/user/note.php?id='.$object->id; - $head[$h][1] = $langs->trans("Note"); - $head[$h][2] = 'note'; - $h++; + // Notes + $nbNote = 0; + if(!empty($object->note)) $nbNote++; + $head[$h][0] = DOL_URL_ROOT.'/user/note.php?id='.$object->id; + $head[$h][1] = $langs->trans("Note"); + if($nbNote > 0) $head[$h][1].= ' ('.$nbNote.')'; + $head[$h][2] = 'note'; + $h++; + + // Attached files + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + $upload_dir = $conf->user->dir_output . "/" . $object->id; + $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$')); + $head[$h][0] = DOL_URL_ROOT.'/user/document.php?userid='.$object->id; + $head[$h][1] = $langs->trans("Documents"); + if($nbFiles > 0) $head[$h][1].= ' ('.$nbFiles.')'; + $head[$h][2] = 'document'; + $h++; $head[$h][0] = DOL_URL_ROOT.'/user/info.php?id='.$object->id; $head[$h][1] = $langs->trans("Info"); @@ -342,4 +364,3 @@ function show_theme($fuser,$edit=0,$foruserprofile=false) print '
'; } -?> diff --git a/htdocs/core/login/functions_dolibarr.php b/htdocs/core/login/functions_dolibarr.php index 400b5765719..d1555678313 100644 --- a/htdocs/core/login/functions_dolibarr.php +++ b/htdocs/core/login/functions_dolibarr.php @@ -58,7 +58,7 @@ function check_user_password_dolibarr($usertotest,$passwordtotest,$entitytotest= $sql.=' WHERE '.$usernamecol." = '".$db->escape($usertotest)."'"; $sql.=' AND '.$entitycol." IN (0," . ($entity ? $entity : 1) . ")"; - dol_syslog("functions_dolibarr::check_user_password_dolibarr sql=".$sql); + dol_syslog("functions_dolibarr::check_user_password_dolibarr", LOG_DEBUG); $resql=$db->query($sql); if ($resql) { diff --git a/htdocs/core/login/functions_empty.php b/htdocs/core/login/functions_empty.php index c96a5023d4d..e4379ee2c3a 100644 --- a/htdocs/core/login/functions_empty.php +++ b/htdocs/core/login/functions_empty.php @@ -39,5 +39,3 @@ function check_user_password_empty($usertotest,$passwordtotest,$entitytotest) return $login; } - -?> \ No newline at end of file diff --git a/htdocs/core/login/functions_forceuser.php b/htdocs/core/login/functions_forceuser.php index e74a253550a..c990c0bd45e 100644 --- a/htdocs/core/login/functions_forceuser.php +++ b/htdocs/core/login/functions_forceuser.php @@ -47,5 +47,3 @@ function check_user_password_forceuser($usertotest,$passwordtotest,$entitytotest return $login; } - -?> \ No newline at end of file diff --git a/htdocs/core/login/functions_http.php b/htdocs/core/login/functions_http.php index b224b27f15b..9d03913d2bc 100644 --- a/htdocs/core/login/functions_http.php +++ b/htdocs/core/login/functions_http.php @@ -44,5 +44,3 @@ function check_user_password_http($usertotest,$passwordtotest,$entitytotest) return $login; } - -?> \ No newline at end of file diff --git a/htdocs/core/login/functions_ldap.php b/htdocs/core/login/functions_ldap.php index 403530ac80b..88a5f55de19 100644 --- a/htdocs/core/login/functions_ldap.php +++ b/htdocs/core/login/functions_ldap.php @@ -227,5 +227,3 @@ function check_user_password_ldap($usertotest,$passwordtotest,$entitytotest) return $login; } - -?> diff --git a/htdocs/core/login/functions_openid.php b/htdocs/core/login/functions_openid.php index e183bc40795..83543c43dd5 100644 --- a/htdocs/core/login/functions_openid.php +++ b/htdocs/core/login/functions_openid.php @@ -79,7 +79,7 @@ function check_user_password_openid($usertotest,$passwordtotest,$entitytotest) $sql.=" WHERE openid = '".$db->escape($_GET['openid_identity'])."'"; $sql.=" AND entity IN (0," . ($_SESSION["dol_entity"] ? $_SESSION["dol_entity"] : 1) . ")"; - dol_syslog("functions_openid::check_user_password_openid sql=".$sql); + dol_syslog("functions_openid::check_user_password_openid", LOG_DEBUG); $resql=$db->query($sql); if ($resql) { @@ -112,5 +112,3 @@ function check_user_password_openid($usertotest,$passwordtotest,$entitytotest) return $login; } - -?> \ No newline at end of file diff --git a/htdocs/core/login/index.html b/htdocs/core/login/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/core/login/index.php b/htdocs/core/login/index.php deleted file mode 100644 index 7db0dd9ebf9..00000000000 --- a/htdocs/core/login/index.php +++ /dev/null @@ -1 +0,0 @@ -Url not available \ No newline at end of file diff --git a/htdocs/core/menus/index.html b/htdocs/core/menus/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/core/menus/index.php b/htdocs/core/menus/index.php deleted file mode 100644 index 7db0dd9ebf9..00000000000 --- a/htdocs/core/menus/index.php +++ /dev/null @@ -1 +0,0 @@ -Url not available \ No newline at end of file diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index cf05e461e35..af5473ef3e2 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -25,34 +25,36 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="setup"', __HANDLER__, 'left', 101__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/company.php?leftmenu=setup', 'MenuCompanySetup', 1, 'admin', '', '', 2, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="setup"', __HANDLER__, 'left', 102__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/ihm.php?leftmenu=setup', 'GUISetup', 1, 'admin', '', '', 2, 4, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="setup"', __HANDLER__, 'left', 103__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/modules.php?leftmenu=setup', 'Modules', 1, 'admin', '', '', 2, 2, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="setup"', __HANDLER__, 'left', 104__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/boxes.php?leftmenu=setup', 'Boxes', 1, 'admin', '', '', 2, 5, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="setup"', __HANDLER__, 'left', 104__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/boxes.php?leftmenu=setup', 'Boxes', 1, 'admin', '', '', 2, 6, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="setup"', __HANDLER__, 'left', 105__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/menus.php?leftmenu=setup', 'Menus', 1, 'admin', '', '', 2, 3, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="setup"', __HANDLER__, 'left', 106__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/delais.php?leftmenu=setup', 'Alerts', 1, 'admin', '', '', 2, 6, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="setup"', __HANDLER__, 'left', 108__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/proxy.php?leftmenu=setup', 'Security', 1, 'admin', '', '', 2, 7, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="setup"', __HANDLER__, 'left', 110__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/limits.php?leftmenu=setup', 'MenuLimits', 1, 'admin', '', '', 2, 8, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="setup"', __HANDLER__, 'left', 107__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/pdf.php?leftmenu=setup', 'PDF', 1, 'admin', '', '', 2, 9, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="setup"', __HANDLER__, 'left', 109__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/mails.php?leftmenu=setup', 'Emails', 1, 'admin', '', '', 2, 10, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="setup"', __HANDLER__, 'left', 113__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/sms.php?leftmenu=setup', 'SMS', 1, 'admin', '', '', 2, 11, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="setup"', __HANDLER__, 'left', 111__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/dict.php?leftmenu=setup', 'Dictionary', 1, 'admin', '', '', 2, 12, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="setup"', __HANDLER__, 'left', 112__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/const.php?leftmenu=setup', 'OtherSetup', 1, 'admin', '', '', 2, 13, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="setup"', __HANDLER__, 'left', 114__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/fiscalyear.php?leftmenu=setup', 'Fiscalyear', 1, 'admin', '', '', 2, 5, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="setup"', __HANDLER__, 'left', 106__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/delais.php?leftmenu=setup', 'Alerts', 1, 'admin', '', '', 2, 7, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="setup"', __HANDLER__, 'left', 108__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/proxy.php?leftmenu=setup', 'Security', 1, 'admin', '', '', 2, 8, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="setup"', __HANDLER__, 'left', 110__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/limits.php?leftmenu=setup', 'MenuLimits', 1, 'admin', '', '', 2, 9, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="setup"', __HANDLER__, 'left', 107__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/pdf.php?leftmenu=setup', 'PDF', 1, 'admin', '', '', 2, 10, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="setup"', __HANDLER__, 'left', 109__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/mails.php?leftmenu=setup', 'Emails', 1, 'admin', '', '', 2, 11, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="setup"', __HANDLER__, 'left', 113__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/sms.php?leftmenu=setup', 'SMS', 1, 'admin', '', '', 2, 12, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="setup"', __HANDLER__, 'left', 111__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/dict.php?leftmenu=setup', 'Dictionary', 1, 'admin', '', '', 2, 13, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="setup"', __HANDLER__, 'left', 112__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/const.php?leftmenu=setup', 'OtherSetup', 1, 'admin', '', '', 2, 14, __ENTITY__); -- Home - Sytem info insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$user->admin', __HANDLER__, 'left', 300__+MAX_llx_menu__, 'home', 'admintools', 1__+MAX_llx_menu__, '/admin/tools/index.php?leftmenu=admintools', 'SystemTools', 0, 'admin', '', '', 2, 2, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 201__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/system/dolibarr.php?leftmenu=admintools', 'InfoDolibarr', 1, 'admin', '', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 208__+MAX_llx_menu__, 'home', '', 201__+MAX_llx_menu__, '/admin/system/modules.php?leftmenu=admintools', 'Modules', 2, 'admin', '', '', 2, 2, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 207__+MAX_llx_menu__, 'home', '', 201__+MAX_llx_menu__, '/admin/triggers.php?leftmenu=admintools', 'Triggers', 2, 'admin', '', '', 2, 3, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 204__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/system/os.php?leftmenu=admintools', 'InfoOS', 1, 'admin', '', '', 2, 1, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 205__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/system/web.php?leftmenu=admintools', 'InfoWebServer', 1, 'admin', '', '', 2, 2, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 206__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/system/phpinfo.php?leftmenu=admintools', 'InfoPHP', 1, 'admin', '', '', 2, 3, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 210__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/system/database.php?leftmenu=admintools', 'InfoDatabase', 1, 'admin', '', '', 2, 4, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 301__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/tools/dolibarr_export.php?leftmenu=admintools', 'Backup', 1, 'admin', '', '', 2, 5, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 302__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/tools/dolibarr_import.php?leftmenu=admintools', 'Restore', 1, 'admin', '', '', 2, 6, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 305__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/tools/update.php?leftmenu=admintools', 'MenuUpgrade', 1, 'admin', '', '', 2, 7, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools" && function_exists("eaccelerator_info")', __HANDLER__, 'left', 304__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/tools/eaccelerator.php?leftmenu=admintools', 'EAccelerator', 1, 'admin', '', '', 2, 8, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 306__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/tools/listevents.php?leftmenu=admintools', 'Audit', 1, 'admin', '', '', 2, 9, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 308__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/tools/listsessions.php?leftmenu=admintools', 'Sessions', 1, 'admin', '', '', 2, 10, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 303__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/tools/purge.php?leftmenu=admintools', 'Purge', 1, 'admin', '', '', 2, 11, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 307__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/support/index.php?leftmenu=admintools', 'HelpCenter', 1, 'help', '', '_blank', 2, 12, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 203__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/system/about.php?leftmenu=admintools', 'About', 1, 'admin', '', '', 2, 13, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 204__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/system/browser.php?leftmenu=admintools', 'InfoBrowser', 1, 'admin', '', '', 2, 1, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 204__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/system/os.php?leftmenu=admintools', 'InfoOS', 1, 'admin', '', '', 2, 2, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 205__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/system/web.php?leftmenu=admintools', 'InfoWebServer', 1, 'admin', '', '', 2, 3, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 206__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/system/phpinfo.php?leftmenu=admintools', 'InfoPHP', 1, 'admin', '', '', 2, 4, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 210__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/system/database.php?leftmenu=admintools', 'InfoDatabase', 1, 'admin', '', '', 2, 5, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 301__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/tools/dolibarr_export.php?leftmenu=admintools', 'Backup', 1, 'admin', '', '', 2, 6, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 302__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/tools/dolibarr_import.php?leftmenu=admintools', 'Restore', 1, 'admin', '', '', 2, 7, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 305__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/tools/update.php?leftmenu=admintools', 'MenuUpgrade', 1, 'admin', '', '', 2, 8, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools" && function_exists("eaccelerator_info")', __HANDLER__, 'left', 304__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/tools/eaccelerator.php?leftmenu=admintools', 'EAccelerator', 1, 'admin', '', '', 2, 9, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 306__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/tools/listevents.php?leftmenu=admintools', 'Audit', 1, 'admin', '', '', 2, 10, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 308__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/tools/listsessions.php?leftmenu=admintools', 'Sessions', 1, 'admin', '', '', 2, 11, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 303__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/tools/purge.php?leftmenu=admintools', 'Purge', 1, 'admin', '', '', 2, 12, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 307__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/support/index.php?leftmenu=admintools', 'HelpCenter', 1, 'help', '', '_blank', 2, 13, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 203__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/system/about.php?leftmenu=admintools', 'About', 1, 'admin', '', '', 2, 14, __ENTITY__); -- Home - Menu users and groups insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '1', __HANDLER__, 'left', 400__+MAX_llx_menu__, 'home', 'users', 1__+MAX_llx_menu__, '/user/home.php?leftmenu=users', 'MenuUsersAndGroups', 0, 'users', '', '', 2, 3, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="users"', __HANDLER__, 'left', 401__+MAX_llx_menu__, 'home', '', 400__+MAX_llx_menu__, '/user/index.php?leftmenu=users', 'Users', 1, 'users', '$user->rights->user->user->lire || $user->admin', '', 2, 0, __ENTITY__); diff --git a/htdocs/core/menus/standard/auguria.lib.php b/htdocs/core/menus/standard/auguria.lib.php index 837403828ee..bf5de3c6a91 100644 --- a/htdocs/core/menus/standard/auguria.lib.php +++ b/htdocs/core/menus/standard/auguria.lib.php @@ -431,4 +431,3 @@ function dol_auguria_showmenu($type_user, &$menuentry, &$listofmodulesforexterna return 1; } -?> diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index c31f8bd3855..fba04593b5b 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1,7 +1,7 @@ * Copyright (C) 2010 Regis Houssin - * Copyright (C) 2012-2013 Juanjo Menent + * Copyright (C) 2012-2014 Juanjo Menent * Copyright (C) 2013 Cédric Salvador * * This program is free software; you can redistribute it and/or modify @@ -501,6 +501,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu $newmenu->add("/admin/modules.php?mainmenu=home", $langs->trans("Modules").$warnpicto,1); $newmenu->add("/admin/menus.php?mainmenu=home", $langs->trans("Menus"),1); $newmenu->add("/admin/ihm.php?mainmenu=home", $langs->trans("GUISetup"),1); + $newmenu->add("/admin/fiscalyear.php?mainmenu=home", $langs->trans("Fiscalyear"),1); if (! in_array($langs->defaultlang,array('en_US','en_GB','en_NZ','en_AU','fr_FR','fr_BE','es_ES','ca_ES'))) { if (empty($leftmenu) || $leftmenu=="setup") $newmenu->add("/admin/translation.php", $langs->trans("Translation"),1); @@ -523,6 +524,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu $newmenu->add('/admin/system/dolibarr.php?mainmenu=home&leftmenu=admintools_info', $langs->trans('InfoDolibarr'), 1); if (empty($leftmenu) || $leftmenu=='admintools_info') $newmenu->add('/admin/system/modules.php?mainmenu=home&leftmenu=admintools_info', $langs->trans('Modules'), 2); if (empty($leftmenu) || $leftmenu=='admintools_info') $newmenu->add('/admin/triggers.php?mainmenu=home&leftmenu=admintools_info', $langs->trans('Triggers'), 2); + $newmenu->add('/admin/system/browser.php?mainmenu=home&leftmenu=admintools', $langs->trans('InfoBrowser'), 1); $newmenu->add('/admin/system/os.php?mainmenu=home&leftmenu=admintools', $langs->trans('InfoOS'), 1); $newmenu->add('/admin/system/web.php?mainmenu=home&leftmenu=admintools', $langs->trans('InfoWebServer'), 1); $newmenu->add('/admin/system/phpinfo.php?mainmenu=home&leftmenu=admintools', $langs->trans('InfoPHP'), 1); @@ -834,15 +836,24 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu global $mysoc; //Local Taxes - if($mysoc->country_code=='ES' && (isset($mysoc->localtax2_assuj) && $mysoc->localtax2_assuj=="1")) + //Local Taxes 1 + if($mysoc->useLocalTax(1) && (isset($mysoc->localtax1_assuj) && $mysoc->localtax1_assuj=="1")) { - if (empty($leftmenu) || preg_match('/^tax_vat/i',$leftmenu)) $newmenu->add("/compta/localtax/index.php?leftmenu=tax_vat&mainmenu=accountancy",$langs->transcountry("LT2",$mysoc->country_code),1,$user->rights->tax->charges->lire); - if (empty($leftmenu) || preg_match('/^tax_vat/i',$leftmenu)) $newmenu->add("/compta/localtax/fiche.php?leftmenu=tax_vat&action=create",$langs->trans("NewPayment"),2,$user->rights->tax->charges->creer); - if (empty($leftmenu) || preg_match('/^tax_vat/i',$leftmenu)) $newmenu->add("/compta/localtax/reglement.php?leftmenu=tax_vat",$langs->trans("Payments"),2,$user->rights->tax->charges->lire); - if (empty($leftmenu) || preg_match('/^tax_vat/i',$leftmenu)) $newmenu->add("/compta/localtax/clients.php?leftmenu=tax_vat", $langs->trans("ReportByCustomers"), 2, $user->rights->tax->charges->lire); - //if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/localtax/quadri_detail.php?leftmenu=tax_vat", $langs->trans("ReportByQuarter"), 2, $user->rights->tax->charges->lire); + $newmenu->add("/compta/localtax/index.php?leftmenu=tax_vat&mainmenu=accountancy&localTaxType=1",$langs->transcountry("LT1",$mysoc->country_code),1,$user->rights->tax->charges->lire); + if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/localtax/fiche.php?leftmenu=tax_vat&action=create&localTaxType=1",$langs->trans("NewPayment"),2,$user->rights->tax->charges->creer); + if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/localtax/reglement.php?leftmenu=tax_vat&localTaxType=1",$langs->trans("Payments"),2,$user->rights->tax->charges->lire); + if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/localtax/clients.php?leftmenu=tax_vat&localTaxType=1", $langs->trans("ReportByCustomers"), 2, $user->rights->tax->charges->lire); + if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/localtax/quadri_detail.php?leftmenu=tax_vat&localTaxType=1", $langs->trans("ReportByQuarter"), 2, $user->rights->tax->charges->lire); + } + //Local Taxes 2 + if($mysoc->useLocalTax(2) && (isset($mysoc->localtax2_assuj) && $mysoc->localtax2_assuj=="1")) + { + $newmenu->add("/compta/localtax/index.php?leftmenu=tax_vat&mainmenu=accountancy&localTaxType=2",$langs->transcountry("LT2",$mysoc->country_code),1,$user->rights->tax->charges->lire); + if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/localtax/fiche.php?leftmenu=tax_vat&action=create&localTaxType=2",$langs->trans("NewPayment"),2,$user->rights->tax->charges->creer); + if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/localtax/reglement.php?leftmenu=tax_vat&localTaxType=2",$langs->trans("Payments"),2,$user->rights->tax->charges->lire); + if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/localtax/clients.php?leftmenu=tax_vat&localTaxType=2", $langs->trans("ReportByCustomers"), 2, $user->rights->tax->charges->lire); + if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/localtax/quadri_detail.php?leftmenu=tax_vat&localTaxType=2", $langs->trans("ReportByQuarter"), 2, $user->rights->tax->charges->lire); } - } } } diff --git a/htdocs/core/menus/standard/empty.php b/htdocs/core/menus/standard/empty.php index f316d334928..a6063c84d18 100644 --- a/htdocs/core/menus/standard/empty.php +++ b/htdocs/core/menus/standard/empty.php @@ -115,6 +115,7 @@ class MenuManager $this->menu->add("/admin/modules.php", $langs->trans("Modules"),1); $this->menu->add("/admin/menus.php", $langs->trans("Menus"),1); $this->menu->add("/admin/ihm.php", $langs->trans("GUISetup"),1); + $this->menu->add("/admin/fiscalyear.php", $langs->trans("Fiscalyear"),1); $this->menu->add("/admin/boxes.php", $langs->trans("Boxes"),1); $this->menu->add("/admin/delais.php",$langs->trans("Alerts"),1); $this->menu->add("/admin/proxy.php?mainmenu=home", $langs->trans("Security"),1); diff --git a/htdocs/core/menus/standard/index.html b/htdocs/core/menus/standard/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/core/menus/standard/index.php b/htdocs/core/menus/standard/index.php deleted file mode 100644 index 7db0dd9ebf9..00000000000 --- a/htdocs/core/menus/standard/index.php +++ /dev/null @@ -1 +0,0 @@ -Url not available \ No newline at end of file diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index e25f4d0c715..1215f8e85e2 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -113,14 +113,13 @@ abstract class DolibarrModules // Add current entity id $sql=str_replace('__ENTITY__', $conf->entity, $sql); - dol_syslog(get_class($this)."::_init ignoreerror=".$ignoreerror." sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::_init ignoreerror=".$ignoreerror."", LOG_DEBUG); $result=$this->db->query($sql, $ignoreerror); if (! $result) { if (! $ignoreerror) { $this->error=$this->db->lasterror(); - dol_syslog(get_class($this)."::_init Error ".$this->error, LOG_ERR); $err++; } else @@ -188,12 +187,11 @@ abstract class DolibarrModules { if (! $err) { - dol_syslog(get_class($this)."::_remove sql=".$array_sql[$i], LOG_DEBUG); + dol_syslog(get_class($this)."::_remove", LOG_DEBUG); $result=$this->db->query($array_sql[$i]); if (! $result) { $this->error=$this->db->error(); - dol_syslog(get_class($this)."::_remove Error ".$this->error, LOG_ERR); $err++; } } @@ -373,7 +371,7 @@ abstract class DolibarrModules $sql.= " WHERE ".$this->db->decrypt('name')." = '".$this->const_name."'"; $sql.= " AND entity IN (0, ".$entity.")"; - dol_syslog(get_class($this)."::_active sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::_active", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) $err++; @@ -382,7 +380,7 @@ abstract class DolibarrModules $sql.= ",".$this->db->encrypt('1',1); $sql.= ",0,".$entity.")"; - dol_syslog(get_class($this)."::_active sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::_active", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) $err++; @@ -408,7 +406,7 @@ abstract class DolibarrModules $sql.= " WHERE ".$this->db->decrypt('name')." = '".$this->const_name."'"; $sql.= " AND entity IN (0, ".$entity.")"; - dol_syslog(get_class($this)."::_unactive sql=".$sql); + dol_syslog(get_class($this)."::_unactive", LOG_DEBUG); $this->db->query($sql); return $err; @@ -525,8 +523,10 @@ abstract class DolibarrModules if (is_array($this->boxes)) { - foreach ($this->boxes as $key => $value) - { + $pos_name = InfoBox::getListOfPagesForBoxes(); + + foreach ($this->boxes as $key => $value) + { $file = isset($this->boxes[$key]['file'])?$this->boxes[$key]['file']:''; $note = isset($this->boxes[$key]['note'])?$this->boxes[$key]['note']:''; $enabledbydefaulton = isset($this->boxes[$key]['enabledbydefaulton'])?$this->boxes[$key]['enabledbydefaulton']:'Home'; @@ -540,7 +540,7 @@ abstract class DolibarrModules $sql.= " AND entity = ".$conf->entity; if ($note) $sql.=" AND note ='".$this->db->escape($note)."'"; - dol_syslog(get_class($this)."::insert_boxes sql=".$sql); + dol_syslog(get_class($this)."::insert_boxes", LOG_DEBUG); $result=$this->db->query($sql); if ($result) { @@ -557,7 +557,7 @@ abstract class DolibarrModules $sql.= $note?"'".$this->db->escape($note)."'":"null"; $sql.= ")"; - dol_syslog(get_class($this)."::insert_boxes sql=".$sql); + dol_syslog(get_class($this)."::insert_boxes", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) $err++; @@ -566,7 +566,6 @@ abstract class DolibarrModules { $lastid=$this->db->last_insert_id(MAIN_DB_PREFIX."boxes_def","rowid"); - $pos_name = getStaticMember('InfoBox','listOfPages'); foreach ($pos_name as $key2 => $val2) { //print 'key2='.$key2.'-val2='.$val2."
\n"; @@ -575,7 +574,7 @@ abstract class DolibarrModules $sql = "INSERT INTO ".MAIN_DB_PREFIX."boxes (box_id,position,box_order,fk_user,entity)"; $sql.= " VALUES (".$lastid.", ".$key2.", '0', 0, ".$conf->entity.")"; - dol_syslog(get_class($this)."::insert_boxes onto page ".$key2."=".$val2." sql=".$sql); + dol_syslog(get_class($this)."::insert_boxes onto page ".$key2."=".$val2."", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) $err++; } @@ -588,7 +587,6 @@ abstract class DolibarrModules else { $this->error=$this->db->lasterror(); - dol_syslog(get_class($this)."::insert_boxes ".$this->error, LOG_ERR); $this->db->rollback(); } } @@ -597,7 +595,6 @@ abstract class DolibarrModules else { $this->error=$this->db->lasterror(); - dol_syslog(get_class($this)."::insert_boxes ".$this->error, LOG_ERR); $err++; } } @@ -634,12 +631,11 @@ abstract class DolibarrModules $sql.= " AND ".MAIN_DB_PREFIX."boxes_def.file = '".$this->db->escape($file)."'"; $sql.= " AND ".MAIN_DB_PREFIX."boxes.entity = ".$conf->entity; - dol_syslog(get_class($this)."::delete_boxes sql=".$sql); + dol_syslog(get_class($this)."::delete_boxes", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) { $this->error=$this->db->lasterror(); - dol_syslog(get_class($this)."::delete_boxes ".$this->error, LOG_ERR); $err++; } @@ -647,12 +643,11 @@ abstract class DolibarrModules $sql.= " WHERE file = '".$this->db->escape($file)."'"; $sql.= " AND entity = ".$conf->entity; - dol_syslog(get_class($this)."::delete_boxes sql=".$sql); + dol_syslog(get_class($this)."::delete_boxes", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) { $this->error=$this->db->lasterror(); - dol_syslog(get_class($this)."::delete_boxes ".$this->error, LOG_ERR); $err++; } } @@ -676,11 +671,10 @@ abstract class DolibarrModules $sql.= " WHERE ".$this->db->decrypt('name')." like '".$this->const_name."_TABS_%'"; $sql.= " AND entity = ".$conf->entity; - dol_syslog(get_class($this)."::delete_tabs sql=".$sql); + dol_syslog(get_class($this)."::delete_tabs", LOG_DEBUG); if (! $this->db->query($sql)) { $this->error=$this->db->lasterror(); - dol_syslog(get_class($this)."::delete_tabs ".$this->error, LOG_ERR); $err++; } @@ -722,7 +716,7 @@ abstract class DolibarrModules $sql.= ", ".$conf->entity; $sql.= ")"; - dol_syslog(get_class($this)."::insert_tabs sql=".$sql); + dol_syslog(get_class($this)."::insert_tabs", LOG_DEBUG); $resql=$this->db->query($sql); /* Allow duplicate key if (! $resql) @@ -784,10 +778,9 @@ abstract class DolibarrModules $sql.= ")"; - dol_syslog(get_class($this)."::insert_const sql=".$sql); + dol_syslog(get_class($this)."::insert_const", LOG_DEBUG); if (! $this->db->query($sql) ) { - dol_syslog(get_class($this)."::insert_const ".$this->db->lasterror(), LOG_ERR); $err++; } } @@ -826,11 +819,10 @@ abstract class DolibarrModules $sql = "DELETE FROM ".MAIN_DB_PREFIX."const"; $sql.= " WHERE ".$this->db->decrypt('name')." = '".$name."'"; $sql.= " AND entity in (0, ".$conf->entity.")"; - dol_syslog(get_class($this)."::delete_const sql=".$sql); + dol_syslog(get_class($this)."::delete_const", LOG_DEBUG); if (! $this->db->query($sql)) { $this->error=$this->db->lasterror(); - dol_syslog(get_class($this)."::delete_const ".$this->error, LOG_ERR); $err++; } } @@ -859,8 +851,9 @@ abstract class DolibarrModules $sql_del.= " WHERE ".$this->db->decrypt('name')." = '".$this->const_name."'"; $sql_del.= " AND entity IN (0,".$entity.")"; - dol_syslog(get_class($this)."::insert_permissions sql=".$sql_del); + dol_syslog(get_class($this)."::insert_permissions", LOG_DEBUG); $resql=$this->db->query($sql_del); + if ($resql) { $obj=$this->db->fetch_object($resql); @@ -879,46 +872,57 @@ abstract class DolibarrModules if (empty($r_type)) $r_type='w'; - if (dol_strlen($r_perms) ) + // Search if perm already present + $sql = "SELECT count(*) as nb FROM ".MAIN_DB_PREFIX."rights_def"; + $sql.= " WHERE id = ".$r_id." AND entity = ".$entity; + $resqlselect=$this->db->query($sql); + + $obj = $this->db->fetch_object($resqlselect); + if ($obj->nb == 0) { - if (dol_strlen($r_subperms) ) - { - $sql = "INSERT INTO ".MAIN_DB_PREFIX."rights_def"; - $sql.= " (id, entity, libelle, module, type, bydefault, perms, subperms)"; - $sql.= " VALUES "; - $sql.= "(".$r_id.",".$entity.",'".$this->db->escape($r_desc)."','".$r_modul."','".$r_type."',".$r_def.",'".$r_perms."','".$r_subperms."')"; - } - else - { - $sql = "INSERT INTO ".MAIN_DB_PREFIX."rights_def"; - $sql.= " (id, entity, libelle, module, type, bydefault, perms)"; - $sql.= " VALUES "; - $sql.= "(".$r_id.",".$entity.",'".$this->db->escape($r_desc)."','".$r_modul."','".$r_type."',".$r_def.",'".$r_perms."')"; - } - } - else - { - $sql = "INSERT INTO ".MAIN_DB_PREFIX."rights_def "; - $sql .= " (id, entity, libelle, module, type, bydefault)"; - $sql .= " VALUES "; - $sql .= "(".$r_id.",".$entity.",'".$this->db->escape($r_desc)."','".$r_modul."','".$r_type."',".$r_def.")"; + if (dol_strlen($r_perms) ) + { + if (dol_strlen($r_subperms) ) + { + $sql = "INSERT INTO ".MAIN_DB_PREFIX."rights_def"; + $sql.= " (id, entity, libelle, module, type, bydefault, perms, subperms)"; + $sql.= " VALUES "; + $sql.= "(".$r_id.",".$entity.",'".$this->db->escape($r_desc)."','".$r_modul."','".$r_type."',".$r_def.",'".$r_perms."','".$r_subperms."')"; + } + else + { + $sql = "INSERT INTO ".MAIN_DB_PREFIX."rights_def"; + $sql.= " (id, entity, libelle, module, type, bydefault, perms)"; + $sql.= " VALUES "; + $sql.= "(".$r_id.",".$entity.",'".$this->db->escape($r_desc)."','".$r_modul."','".$r_type."',".$r_def.",'".$r_perms."')"; + } + } + else + { + $sql = "INSERT INTO ".MAIN_DB_PREFIX."rights_def "; + $sql .= " (id, entity, libelle, module, type, bydefault)"; + $sql .= " VALUES "; + $sql .= "(".$r_id.",".$entity.",'".$this->db->escape($r_desc)."','".$r_modul."','".$r_type."',".$r_def.")"; + } + + $resqlinsert=$this->db->query($sql,1); + + if (! $resqlinsert) + { + if ($this->db->errno() != "DB_ERROR_RECORD_ALREADY_EXISTS") + { + $this->error=$this->db->lasterror(); + $err++; + break; + } + else dol_syslog(get_class($this)."::insert_permissions record already exists", LOG_INFO); + + } + + $this->db->free($resqlinsert); } - dol_syslog(get_class($this)."::insert_permissions sql=".$sql, LOG_DEBUG); - $resqlinsert=$this->db->query($sql,1); - if (! $resqlinsert) - { - if ($this->db->errno() != "DB_ERROR_RECORD_ALREADY_EXISTS") - { - $this->error=$this->db->lasterror(); - dol_syslog(get_class($this)."::insert_permissions errno = ".$this->db->errno()." error ".$this->error, LOG_ERR); - $err++; - break; - } - else dol_syslog(get_class($this)."::insert_permissions record already exists", LOG_INFO); - - } - $this->db->free($resqlinsert); + $this->db->free($resqlselect); // If we want to init permissions on admin users if ($reinitadminperms) @@ -927,7 +931,7 @@ abstract class DolibarrModules require DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; } $sql="SELECT rowid FROM ".MAIN_DB_PREFIX."user WHERE admin = 1"; - dol_syslog(get_class($this)."::insert_permissions Search all admin users sql=".$sql); + dol_syslog(get_class($this)."::insert_permissions Search all admin users", LOG_DEBUG); $resqlseladmin=$this->db->query($sql,1); if ($resqlseladmin) { @@ -960,7 +964,6 @@ abstract class DolibarrModules else { $this->error=$this->db->lasterror(); - dol_syslog(get_class($this)."::insert_permissions ".$this->error, LOG_ERR); $err++; } @@ -982,11 +985,10 @@ abstract class DolibarrModules $sql = "DELETE FROM ".MAIN_DB_PREFIX."rights_def"; $sql.= " WHERE module = '".$this->rights_class."'"; $sql.= " AND entity = ".$conf->entity; - dol_syslog(get_class($this)."::delete_permissions sql=".$sql); + dol_syslog(get_class($this)."::delete_permissions", LOG_DEBUG); if (! $this->db->query($sql)) { $this->error=$this->db->lasterror(); - dol_syslog(get_class($this)."::delete_permissions ".$this->error, LOG_ERR); $err++; } @@ -1113,12 +1115,11 @@ abstract class DolibarrModules $sql.= " WHERE module = '".$this->db->escape($this->rights_class)."'"; $sql.= " AND entity = ".$conf->entity; - dol_syslog(get_class($this)."::delete_menus sql=".$sql); + dol_syslog(get_class($this)."::delete_menus", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) { $this->error=$this->db->lasterror(); - dol_syslog(get_class($this)."::delete_menus ".$this->error, LOG_ERR); $err++; } @@ -1201,7 +1202,7 @@ abstract class DolibarrModules $sql.= " WHERE ".$this->db->decrypt('name')." = '".$name."'"; $sql.= " AND entity = ".$conf->entity; - dol_syslog(get_class($this)."::insert_dirs sql=".$sql); + dol_syslog(get_class($this)."::insert_dirs", LOG_DEBUG); $result=$this->db->query($sql); if ($result) { @@ -1212,14 +1213,13 @@ abstract class DolibarrModules $sql = "INSERT INTO ".MAIN_DB_PREFIX."const (name,type,value,note,visible,entity)"; $sql.= " VALUES (".$this->db->encrypt($name,1).",'chaine',".$this->db->encrypt($dir,1).",'Directory for module ".$this->name."','0',".$conf->entity.")"; - dol_syslog(get_class($this)."::insert_dirs sql=".$sql); + dol_syslog(get_class($this)."::insert_dirs", LOG_DEBUG); $resql=$this->db->query($sql); } } else { $this->error=$this->db->lasterror(); - dol_syslog(get_class($this)."::insert_dirs ".$this->error, LOG_ERR); $err++; } @@ -1242,11 +1242,10 @@ abstract class DolibarrModules $sql.= " WHERE ".$this->db->decrypt('name')." LIKE '".$this->const_name."_DIR_%'"; $sql.= " AND entity = ".$conf->entity; - dol_syslog(get_class($this)."::delete_dirs sql=".$sql); + dol_syslog(get_class($this)."::delete_dirs", LOG_DEBUG); if (! $this->db->query($sql)) { $this->error=$this->db->lasterror(); - dol_syslog(get_class($this)."::delete_dirs ".$this->error, LOG_ERR); $err++; } @@ -1319,7 +1318,7 @@ abstract class DolibarrModules $sql.= ", ".$entity; $sql.= ")"; - dol_syslog(get_class($this)."::insert_const_".$key." sql=".$sql); + dol_syslog(get_class($this)."::insert_const_".$key."", LOG_DEBUG); $resql=$this->db->query($sql,1); if (! $resql) { @@ -1327,7 +1326,6 @@ abstract class DolibarrModules { $error++; $this->error=$this->db->lasterror(); - dol_syslog(get_class($this)."::insert_const_".$key." ".$this->error, LOG_ERR); } else { @@ -1362,11 +1360,10 @@ abstract class DolibarrModules $sql.= " WHERE ".$this->db->decrypt('name')." LIKE '".$this->const_name."_".strtoupper($key)."'"; $sql.= " AND entity = ".$entity; - dol_syslog(get_class($this)."::delete_const_".$key." sql=".$sql); + dol_syslog(get_class($this)."::delete_const_".$key."", LOG_DEBUG); if (! $this->db->query($sql)) { $this->error=$this->db->lasterror(); - dol_syslog(get_class($this)."::delete_const_".$key." ".$this->error, LOG_ERR); $err++; } } diff --git a/htdocs/core/modules/action/index.html b/htdocs/core/modules/action/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/core/modules/action/rapport.pdf.php b/htdocs/core/modules/action/rapport.pdf.php index b864205f2c9..7b539f92494 100644 --- a/htdocs/core/modules/action/rapport.pdf.php +++ b/htdocs/core/modules/action/rapport.pdf.php @@ -186,7 +186,7 @@ class CommActionRapport $sql.= " AND '".$this->db->idate(dol_get_last_day($this->year,$this->month,false))."'"; $sql.= " ORDER BY a.datep DESC"; - dol_syslog(get_class($this)."::_page sql=".$sql); + dol_syslog(get_class($this)."::_page", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { diff --git a/htdocs/core/modules/barcode/doc/index.html b/htdocs/core/modules/barcode/doc/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/core/modules/barcode/index.html b/htdocs/core/modules/barcode/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/core/modules/barcode/modules_barcode.class.php b/htdocs/core/modules/barcode/modules_barcode.class.php index 5305ad53cd2..0f87306354a 100644 --- a/htdocs/core/modules/barcode/modules_barcode.class.php +++ b/htdocs/core/modules/barcode/modules_barcode.class.php @@ -109,6 +109,7 @@ abstract class ModeleNumRefBarCode if ($this->version == 'development') return $langs->trans("VersionDevelopment"); if ($this->version == 'experimental') return $langs->trans("VersionExperimental"); if ($this->version == 'dolibarr') return DOL_VERSION; + if ($this->version) return $this->version; return $langs->trans("NotAvailable"); } diff --git a/htdocs/core/modules/cheque/index.html b/htdocs/core/modules/cheque/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/core/modules/cheque/pdf/index.html b/htdocs/core/modules/cheque/pdf/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php index 67d45c39bb3..895ad153fc8 100644 --- a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php +++ b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php @@ -482,6 +482,8 @@ class doc_generic_order_odt extends ModelePDFCommandes } } + $reshook=$hookmanager->executeHooks('afterODTCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks + if (! empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK)); diff --git a/htdocs/core/modules/commande/doc/index.html b/htdocs/core/modules/commande/doc/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index 68266f2cef9..712dd0b765c 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -403,7 +403,7 @@ class pdf_einstein extends ModelePDFCommandes if ((! isset($localtax1_type) || $localtax1_type=='' || ! isset($localtax2_type) || $localtax2_type=='') // if tax type not defined && (! empty($localtax1_rate) || ! empty($localtax2_rate))) // and there is local tax { - $localtaxtmp_array=getLocalTaxesFromRate($vatrate,0,$mysoc); + $localtaxtmp_array=getLocalTaxesFromRate($vatrate,0,$object->thirdparty,$mysoc); $localtax1_type = $localtaxtmp_array[0]; $localtax2_type = $localtaxtmp_array[2]; } diff --git a/htdocs/core/modules/commande/doc/pdf_proforma.modules.php b/htdocs/core/modules/commande/doc/pdf_proforma.modules.php index eb599c2a214..408fd543c93 100644 --- a/htdocs/core/modules/commande/doc/pdf_proforma.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_proforma.modules.php @@ -402,7 +402,7 @@ class pdf_proforma extends ModelePDFCommandes if ((! isset($localtax1_type) || $localtax1_type=='' || ! isset($localtax2_type) || $localtax2_type=='') // if tax type not defined && (! empty($localtax1_rate) || ! empty($localtax2_rate))) // and there is local tax { - $localtaxtmp_array=getLocalTaxesFromRate($vatrate,0,$mysoc); + $localtaxtmp_array=getLocalTaxesFromRate($vatrate,0, $object->thirdparty,$mysoc); $localtax1_type = $localtaxtmp_array[0]; $localtax2_type = $localtaxtmp_array[2]; } diff --git a/htdocs/core/modules/commande/index.html b/htdocs/core/modules/commande/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/core/modules/commande/mod_commande_marbre.php b/htdocs/core/modules/commande/mod_commande_marbre.php index 8075099cdd6..92c8f55581c 100644 --- a/htdocs/core/modules/commande/mod_commande_marbre.php +++ b/htdocs/core/modules/commande/mod_commande_marbre.php @@ -119,7 +119,7 @@ class mod_commande_marbre extends ModeleNumRefCommandes } else { - dol_syslog("mod_commande_marbre::getNextValue sql=".$sql); + dol_syslog("mod_commande_marbre::getNextValue", LOG_DEBUG); return -1; } diff --git a/htdocs/core/modules/commande/modules_commande.php b/htdocs/core/modules/commande/modules_commande.php index 1146b1cc181..63806e4cb46 100644 --- a/htdocs/core/modules/commande/modules_commande.php +++ b/htdocs/core/modules/commande/modules_commande.php @@ -142,6 +142,7 @@ abstract class ModeleNumRefCommandes if ($this->version == 'development') return $langs->trans("VersionDevelopment"); if ($this->version == 'experimental') return $langs->trans("VersionExperimental"); if ($this->version == 'dolibarr') return DOL_VERSION; + if ($this->version) return $this->version; return $langs->trans("NotAvailable"); } } @@ -233,13 +234,6 @@ function commande_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0 // Success in building document. We build meta file. dol_meta_create($object); - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($db); - $result=$interface->run_triggers('ORDER_BUILDDOC',$object,$user,$langs,$conf); - if ($result < 0) { $error++; $obj->errors=$interface->errors; } - // Fin appel triggers - return 1; } else diff --git a/htdocs/core/modules/contract/doc/index.html b/htdocs/core/modules/contract/doc/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/core/modules/contract/index.html b/htdocs/core/modules/contract/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/core/modules/contract/mod_contract_magre.php b/htdocs/core/modules/contract/mod_contract_magre.php index 8281552b459..289b474de5e 100644 --- a/htdocs/core/modules/contract/mod_contract_magre.php +++ b/htdocs/core/modules/contract/mod_contract_magre.php @@ -32,6 +32,7 @@ class mod_contract_magre extends ModelNumRefContracts var $version='dolibarr'; var $error = ''; var $nom = 'Magre'; + var $code_auto=1; /** * Return default description of numbering model diff --git a/htdocs/core/modules/contract/mod_contract_olive.php b/htdocs/core/modules/contract/mod_contract_olive.php new file mode 100644 index 00000000000..2b10d520b25 --- /dev/null +++ b/htdocs/core/modules/contract/mod_contract_olive.php @@ -0,0 +1,106 @@ + + * Copyright (C) 2006-2009 Laurent Destailleur + * Copyright (C) 2014 Floran 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 . + * or see http://www.gnu.org/ + */ + +/** + * \file htdocs/core/modules/contract/mod_contract_olive.php + * \ingroup contract + * \brief File of class to manage contract numbering rules Olive + */ + +require_once DOL_DOCUMENT_ROOT .'/core/modules/contract/modules_contract.php'; + + +/** + * Class to manage contract numbering rules Olive + */ +class mod_contract_olive extends ModelNumRefContracts +{ + + + var $nom='Olive'; // Nom du modele + var $code_modifiable = 1; // Code modifiable + var $code_modifiable_invalide = 1; // Code modifiable si il est invalide + var $code_modifiable_null = 1; // Code modifiables si il est null + var $code_null = 1; // Code facultatif + var $version='dolibarr'; // 'development', 'experimental', 'dolibarr' + var $code_auto = 0; // Numerotation automatique + + + /** + * Return description of module + * + * @return string Description of module + */ + function info() + { + global $langs; + + $langs->load("companies"); + return $langs->trans("LeopardNumRefModelDesc"); + } + + /** + * Return an example of result returned by getNextValue + * + * @param Societe $objsoc Object thirdparty + * @param Contrat $contract Object contract + * @return string Return next value + */ + function getNextValue($objsoc,$contract) + { + global $langs; + return ''; + } + + + /** + * Check validity of code according to its rules + * + * @param DoliDB $db Database handler + * @param string &$code Code to check/correct + * @param Product $product Object product + * @param int $type 0 = product , 1 = service + * @return int 0 if OK + * -1 ErrorBadProductCodeSyntax + * -2 ErrorProductCodeRequired + * -3 ErrorProductCodeAlreadyUsed + * -4 ErrorPrefixRequired + */ + function verif($db, &$code, $product, $type) + { + global $conf; + + $result=0; + $code = strtoupper(trim($code)); + + if (empty($code) && $this->code_null && empty($conf->global->MAIN_CONTARCT_CODE_ALWAYS_REQUIRED)) + { + $result=0; + } + else if (empty($code) && (! $this->code_null || ! empty($conf->global->MAIN_CONTARCT_CODE_ALWAYS_REQUIRED)) ) + { + $result=-2; + } + + dol_syslog("mod_contract_olive::verif type=".$type." result=".$result); + return $result; + } +} + diff --git a/htdocs/core/modules/contract/mod_contract_serpis.php b/htdocs/core/modules/contract/mod_contract_serpis.php index a07f3261133..b909b762541 100644 --- a/htdocs/core/modules/contract/mod_contract_serpis.php +++ b/htdocs/core/modules/contract/mod_contract_serpis.php @@ -32,6 +32,7 @@ class mod_contract_serpis extends ModelNumRefContracts var $prefix='CT'; var $error=''; var $nom='Serpis'; + var $code_auto=1; /** @@ -116,7 +117,7 @@ class mod_contract_serpis extends ModelNumRefContracts } else { - dol_syslog("mod_contract_serpis::getNextValue sql=".$sql); + dol_syslog("mod_contract_serpis::getNextValue", LOG_DEBUG); return -1; } diff --git a/htdocs/core/modules/contract/modules_contract.php b/htdocs/core/modules/contract/modules_contract.php index 9c54ed4a460..689509f2a59 100644 --- a/htdocs/core/modules/contract/modules_contract.php +++ b/htdocs/core/modules/contract/modules_contract.php @@ -138,6 +138,7 @@ class ModelNumRefContracts if ($this->version == 'development') return $langs->trans("VersionDevelopment"); if ($this->version == 'experimental') return $langs->trans("VersionExperimental"); if ($this->version == 'dolibarr') return DOL_VERSION; + if ($this->version) return $this->version; return $langs->trans("NotAvailable"); } } @@ -223,17 +224,10 @@ function contract_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0 // We delete old preview require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; dol_delete_preview($object); - + // Success in building document. We build meta file. dol_meta_create($object); - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($db); - $result=$interface->run_triggers('CONTRACT_BUILDDOC',$object,$user,$langs,$conf); - if ($result < 0) { $error++; $obj->errors=$interface->errors; } - // Fin appel triggers - return 1; } else diff --git a/htdocs/core/modules/dons/html_cerfafr.html b/htdocs/core/modules/dons/html_cerfafr.html index cd4c06e763c..2dc9c72968c 100644 --- a/htdocs/core/modules/dons/html_cerfafr.html +++ b/htdocs/core/modules/dons/html_cerfafr.html @@ -2,7 +2,7 @@ - __DonationReceipt__ + __DonationTitle__ @@ -11,10 +11,10 @@ - + @@ -25,7 +25,6 @@
Cerfa No 11580 01Cerfa N° 11580*03 - __DonationReceipt__
+ __DonationReceipt__
__FrenchArticle__
-
No: __REF__
@@ -37,9 +36,6 @@
-
-
-
@@ -74,6 +70,10 @@
+ +
+
+ +
@@ -93,25 +93,29 @@ +
- - - - - -
- __Name__ :
- __DONATOR_FIRSTNAME__ __DONATOR_LASTNAME__
- __Address__ :
- __DONATOR_ADDRESS__
- __Zip__ : __DONATOR_ZIP__
- __Town__ : __DONATOR_TOWN__
-
- -
+ + + +
+ __Name__ :
+ __DONATOR_FIRSTNAME__ __DONATOR_LASTNAME__
+ __Address__ :
+ __DONATOR_ADDRESS__
+ __Zip__ : __DONATOR_ZIP__
+ __Town__ : __DONATOR_TOWN__
+
+
+
+
+ +'; + print ''; print "
+ '; + // Bank Account + print ''; + print ''; 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 ''; + + print '
@@ -119,20 +123,31 @@
- __AMOUNT__ __CURRENCY__ + + __AMOUNT__ __CURRENCY__ +
- __DatePayment__ : __DATE__
+ __DonationDatePayment__ : __DATE__
__PaymentMode__ : __PAYMENTMODE_LIB__
- +
+ + + +
+
+ __Message__ : + __DonationMessage__
+
+ + - @@ -99,9 +100,12 @@ if (! empty($hookmanager->resArray['options'])) { } } ?> - + - + \n"; @@ -122,8 +125,11 @@ if ($result) print ''; print ''; print ''; - print ''; - print ''; + if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) + { + print ''; + print ''; + } print ''; print "\n"; @@ -150,8 +156,11 @@ if ($result) print ''; print ''; print ''; - print '\n"; - print ''; + if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) + { + print '\n"; + print ''; + } print ''; print "\n"; @@ -159,9 +168,13 @@ if ($result) $total += $objp->duree; $i++; } - print ''; - print ''; - print ''; + $rowspan=3; + if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) + { + print ''; + print ''; + print ''; + } print '
-

- __ThankYou__ - +
+ __FrenchEligibility__
+ __ARTICLE200__ __ARTICLE238__ __ARTICLE885__
@@ -142,8 +157,8 @@
-
__Date__ __Signature__
- __NOW__ +
__Date__ & __Signature__
+
__NOW__
diff --git a/htdocs/core/modules/dons/html_cerfafr.modules.php b/htdocs/core/modules/dons/html_cerfafr.modules.php index e999124300e..b4cc2795c1a 100644 --- a/htdocs/core/modules/dons/html_cerfafr.modules.php +++ b/htdocs/core/modules/dons/html_cerfafr.modules.php @@ -3,6 +3,7 @@ * Copyright (C) 2005-2006 Laurent Destailleur * Copyright (C) 2012 Regis Houssin * Copyright (C) 2012 Marcos García + * Copyright (C) 2014 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 @@ -19,9 +20,9 @@ */ /** - * \file htdocs/core/modules/dons/html_cerfafr.modules.php - * \ingroup don - * \brief Formulaire de don + * \file htdocs/core/modules/dons/html_cerfafr.modules.php + * \ingroup don + * \brief Form of donation */ require_once DOL_DOCUMENT_ROOT.'/core/modules/dons/modules_don.php'; require_once DOL_DOCUMENT_ROOT.'/compta/dons/class/don.class.php'; @@ -44,9 +45,9 @@ class html_cerfafr extends ModeleDon $this->db = $db; $this->name = "cerfafr"; - $this->description = $langs->trans('DonationsReceiptModel'); + $this->description = $langs->trans('DonationsReceiptModel').' - fr_FR - Cerfa 11580*03'; - // Dimension page pour format A4 + // Dimension page for size A4 $this->type = 'html'; } @@ -87,7 +88,7 @@ class html_cerfafr extends ModeleDon if (! empty($conf->don->dir_output)) { - // Definition de l'objet $don (pour compatibilite ascendante) + // Definition of the object don (for upward compatibility) if (! is_object($don)) { $don = new Don($this->db); @@ -95,7 +96,7 @@ class html_cerfafr extends ModeleDon $id=$don->id; } - // Definition de $dir et $file + // Definition of $dir and $file if (! empty($don->specimen)) { $dir = $conf->don->dir_output; @@ -121,8 +122,8 @@ class html_cerfafr extends ModeleDon { $formclass = new Form($this->db); - //This is not the proper way to do it but $formclass->form_modes_reglement - //prints the translation instead of returning it + // This is not the proper way to do it but $formclass->form_modes_reglement + // prints the translation instead of returning it if ($don->modepaiementid) { $formclass->load_cache_types_paiements(); @@ -130,7 +131,7 @@ class html_cerfafr extends ModeleDon } else $paymentmode = ''; - // Defini contenu + // Define contents $donmodel=DOL_DOCUMENT_ROOT ."/core/modules/dons/html_cerfafr.html"; $form = implode('', file($donmodel)); $form = str_replace('__REF__',$don->id,$form); @@ -143,32 +144,79 @@ class html_cerfafr extends ModeleDon $form = str_replace('__MAIN_INFO_SOCIETE_ADDRESS__',$mysoc->address,$form); $form = str_replace('__MAIN_INFO_SOCIETE_ZIP__',$mysoc->zip,$form); $form = str_replace('__MAIN_INFO_SOCIETE_TOWN__',$mysoc->town,$form); - $form = str_replace('__DONATOR_FIRSTNAME__',$don->firstname,$form); + $form = str_replace('__DONATOR_FIRSTNAME__',$don->firstname,$form); $form = str_replace('__DONATOR_LASTNAME__',$don->lastname,$form); $form = str_replace('__DONATOR_ADDRESS__',$don->address,$form); $form = str_replace('__DONATOR_ZIP__',$don->zip,$form); $form = str_replace('__DONATOR_TOWN__',$don->town,$form); $form = str_replace('__PAYMENTMODE_LIB__ ', $paymentmode,$form); - $form = str_replace('__NOW__',dol_print_date($now,'',false,$outputlangs),$form); + $form = str_replace('__NOW__',dol_print_date($now,'day',false,$outputlangs),$form); $form = str_replace('__DonationRef__',$outputlangs->trans("DonationRef"),$form); + $form = str_replace('__DonationTitle__',$outputlangs->trans("DonationTitle"),$form); $form = str_replace('__DonationReceipt__',$outputlangs->trans("DonationReceipt"),$form); $form = str_replace('__DonationRecipient__',$outputlangs->trans("DonationRecipient"),$form); - $form = str_replace('__DatePayment__',$outputlangs->trans("DatePayment"),$form); - $form = str_replace('__PaymentMode__',$outputlangs->trans("PaymentMode"),$form); + $form = str_replace('__DonationDatePayment__',$outputlangs->trans("DonationDatePayment"),$form); + $form = str_replace('__PaymentMode__',$outputlangs->trans("PaymentMode"),$form); $form = str_replace('__Name__',$outputlangs->trans("Name"),$form); $form = str_replace('__Address__',$outputlangs->trans("Address"),$form); $form = str_replace('__Zip__',$outputlangs->trans("Zip"),$form); $form = str_replace('__Town__',$outputlangs->trans("Town"),$form); + $form = str_replace('__Object__',$outputlangs->trans("Object"),$form); $form = str_replace('__Donor__',$outputlangs->trans("Donor"),$form); $form = str_replace('__Date__',$outputlangs->trans("Date"),$form); $form = str_replace('__Signature__',$outputlangs->trans("Signature"),$form); - $form = str_replace('__ThankYou__',$outputlangs->trans("ThankYou"),$form); + $form = str_replace('__Message__',$outputlangs->trans("Message"),$form); $form = str_replace('__IConfirmDonationReception__',$outputlangs->trans("IConfirmDonationReception"),$form); - $frencharticle=''; - if (preg_match('/fr/i',$outputlangs->defaultlang)) $frencharticle='(Article 200-5 du Code Général des Impôts)
+ article 238 bis'; + $form = str_replace('__DonationMessage__',$conf->global->DONATION_MESSAGE,$form); + + $frencharticle=''; + if (preg_match('/fr/i',$outputlangs->defaultlang)) $frencharticle='Article 200, 238 bis et 885-0 V bis A du code général des impôts (CGI)'; $form = str_replace('__FrenchArticle__',$frencharticle,$form); + + $frencheligibility=''; + if (preg_match('/fr/i',$outputlangs->defaultlang)) $frencheligibility='Le bénéficiaire certifie sur l\'honneur que les dons et versements qu\'il reçoit ouvrent droit à la réduction d\'impôt prévue à l\'article :'; + $form = str_replace('__FrenchEligibility__',$frencheligibility,$form); + + $art200=''; + if (preg_match('/fr/i',$outputlangs->defaultlang)) { + if ($conf->global->DONATION_ART200 >= 1) + { + $art200='200 du CGI'; + } + else + { + $art200='200 du CGI'; + } + } + $form = str_replace('__ARTICLE200__',$art200,$form); - // Sauve fichier sur disque + $art238=''; + if (preg_match('/fr/i',$outputlangs->defaultlang)) { + if ($conf->global->DONATION_ART238 >= 1) + { + $art238='238 bis du CGI'; + } + else + { + $art238='238 bis du CGI'; + } + } + $form = str_replace('__ARTICLE238__',$art238,$form); + + $art885=''; + if (preg_match('/fr/i',$outputlangs->defaultlang)) { + if ($conf->global->DONATION_ART885 >= 1) + { + $art885='885-0 V bis du CGI'; + } + else + { + $art885='885-0 V bis du CGI'; + } + } + $form = str_replace('__ARTICLE885__',$art885,$form); + + // Save file on disk dol_syslog("html_cerfafr::write_file $file"); $handle=fopen($file,"w"); fwrite($handle,$form); @@ -190,7 +238,7 @@ class html_cerfafr extends ModeleDon return 0; } $this->error=$langs->trans("ErrorUnknown"); - return 0; // Erreur par defaut + return 0; // Error by default } } diff --git a/htdocs/core/modules/dons/index.html b/htdocs/core/modules/dons/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/core/modules/dons/modules_don.php b/htdocs/core/modules/dons/modules_don.php index c06494fc501..d676d2c6f70 100644 --- a/htdocs/core/modules/dons/modules_don.php +++ b/htdocs/core/modules/dons/modules_don.php @@ -134,6 +134,7 @@ abstract class ModeleNumRefDons if ($this->version == 'development') return $langs->trans("VersionDevelopment"); if ($this->version == 'experimental') return $langs->trans("VersionExperimental"); if ($this->version == 'dolibarr') return DOL_VERSION; + if ($this->version) return $this->version; return $langs->trans("NotAvailable"); } } diff --git a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php index beed6fb5cdb..b4325139878 100644 --- a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php +++ b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php @@ -482,6 +482,8 @@ class doc_generic_shipment_odt extends ModelePdfExpedition } } + $reshook=$hookmanager->executeHooks('afterODTCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks + if (! empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK)); diff --git a/htdocs/core/modules/expedition/doc/index.html b/htdocs/core/modules/expedition/doc/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/core/modules/expedition/index.html b/htdocs/core/modules/expedition/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/core/modules/expedition/mod_expedition_safor.php b/htdocs/core/modules/expedition/mod_expedition_safor.php index ba779658051..581657c6547 100644 --- a/htdocs/core/modules/expedition/mod_expedition_safor.php +++ b/htdocs/core/modules/expedition/mod_expedition_safor.php @@ -116,7 +116,7 @@ class mod_expedition_safor extends ModelNumRefExpedition } else { - dol_syslog("mod_expedition_safor::getNextValue sql=".$sql); + dol_syslog("mod_expedition_safor::getNextValue", LOG_DEBUG); return -1; } diff --git a/htdocs/core/modules/expedition/modules_expedition.php b/htdocs/core/modules/expedition/modules_expedition.php index ceddd5064e1..3f2938ef25f 100644 --- a/htdocs/core/modules/expedition/modules_expedition.php +++ b/htdocs/core/modules/expedition/modules_expedition.php @@ -136,6 +136,7 @@ abstract class ModelNumRefExpedition if ($this->version == 'development') return $langs->trans("VersionDevelopment"); if ($this->version == 'experimental') return $langs->trans("VersionExperimental"); if ($this->version == 'dolibarr') return DOL_VERSION; + if ($this->version) return $this->version; return $langs->trans("NotAvailable"); } } @@ -190,7 +191,7 @@ function expedition_pdf_create($db, $object, $modele, $outputlangs) { $file = $prefix."_".$modele.".modules.php"; - // We check the model location + // We check the model location $file=dol_buildpath($reldir."core/modules/expedition/doc/".$file,0); if (file_exists($file)) { @@ -222,15 +223,6 @@ function expedition_pdf_create($db, $object, $modele, $outputlangs) //require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; //dol_delete_preview($object); - // Calls triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($db); - $result=$interface->run_triggers('SHIPPING_BUILDDOC',$object,$user,$langs,$conf); - if ($result < 0) { - $error++; $obj->errors=$interface->errors; - } - // End calls triggers - return 1; } else diff --git a/htdocs/core/modules/export/index.html b/htdocs/core/modules/export/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php index 9b89555a9ff..0084df11e72 100644 --- a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php +++ b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php @@ -439,6 +439,8 @@ class doc_generic_invoice_odt extends ModelePDFFactures } } + $reshook=$hookmanager->executeHooks('afterODTCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks + if (! empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK)); diff --git a/htdocs/core/modules/facture/doc/index.html b/htdocs/core/modules/facture/doc/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 9186e51b954..d07bd93825c 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -2,7 +2,7 @@ /* Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2008 Raphael Bertrand - * Copyright (C) 2010-2013 Juanjo Menent + * Copyright (C) 2010-2014 Juanjo Menent * Copyright (C) 2012 Christophe Battarel * * This program is free software; you can redistribute it and/or modify @@ -404,7 +404,7 @@ class pdf_crabe extends ModelePDFFactures if ((! isset($localtax1_type) || $localtax1_type=='' || ! isset($localtax2_type) || $localtax2_type=='') // if tax type not defined && (! empty($localtax1_rate) || ! empty($localtax2_rate))) // and there is local tax { - $localtaxtmp_array=getLocalTaxesFromRate($vatrate,0,$mysoc); + $localtaxtmp_array=getLocalTaxesFromRate($vatrate,0, $object->thirdparty, $mysoc); $localtax1_type = $localtaxtmp_array[0]; $localtax2_type = $localtaxtmp_array[2]; } @@ -624,7 +624,6 @@ class pdf_crabe extends ModelePDFFactures else { $this->error=$this->db->lasterror(); - dol_syslog($this->db,$this->error, LOG_ERR); return -1; } @@ -663,7 +662,6 @@ class pdf_crabe extends ModelePDFFactures else { $this->error=$this->db->lasterror(); - dol_syslog($this->db,$this->error, LOG_ERR); return -1; } diff --git a/htdocs/core/modules/facture/index.html b/htdocs/core/modules/facture/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/core/modules/facture/mod_facture_mars.php b/htdocs/core/modules/facture/mod_facture_mars.php index f1a46913e25..25c6d2cd2ad 100644 --- a/htdocs/core/modules/facture/mod_facture_mars.php +++ b/htdocs/core/modules/facture/mod_facture_mars.php @@ -144,7 +144,7 @@ class mod_facture_mars extends ModeleNumRefFactures $sql.= " AND entity = ".$conf->entity; $resql=$db->query($sql); - dol_syslog(get_class($this)."::getNextValue sql=".$sql); + dol_syslog(get_class($this)."::getNextValue", LOG_DEBUG); if ($resql) { $obj = $db->fetch_object($resql); @@ -153,7 +153,6 @@ class mod_facture_mars extends ModeleNumRefFactures } else { - dol_syslog(get_class($this)."::getNextValue sql=".$sql, LOG_ERR); return -1; } @@ -168,7 +167,7 @@ class mod_facture_mars extends ModeleNumRefFactures $sql.= " WHERE facnumber LIKE '".$prefix."____-".$num."'"; $sql.= " AND entity = ".$conf->entity; - dol_syslog(get_class($this)."::getNextValue sql=".$sql); + dol_syslog(get_class($this)."::getNextValue", LOG_DEBUG); $resql=$db->query($sql); if ($resql) { diff --git a/htdocs/core/modules/facture/mod_facture_terre.php b/htdocs/core/modules/facture/mod_facture_terre.php index 9a8b5feaed7..dc06c6202ec 100644 --- a/htdocs/core/modules/facture/mod_facture_terre.php +++ b/htdocs/core/modules/facture/mod_facture_terre.php @@ -160,7 +160,7 @@ class mod_facture_terre extends ModeleNumRefFactures $sql.= " AND entity = ".$conf->entity; $resql=$db->query($sql); - dol_syslog(get_class($this)."::getNextValue sql=".$sql); + dol_syslog(get_class($this)."::getNextValue", LOG_DEBUG); if ($resql) { $obj = $db->fetch_object($resql); @@ -169,7 +169,6 @@ class mod_facture_terre extends ModeleNumRefFactures } else { - dol_syslog(get_class($this)."::getNextValue sql=".$sql, LOG_ERR); return -1; } @@ -184,7 +183,7 @@ class mod_facture_terre extends ModeleNumRefFactures $sql.= " WHERE facnumber LIKE '".$prefix."____-".$num."'"; $sql.= " AND entity = ".$conf->entity; - dol_syslog(get_class($this)."::getNextValue sql=".$sql); + dol_syslog(get_class($this)."::getNextValue", LOG_DEBUG); $resql=$db->query($sql); if ($resql) { diff --git a/htdocs/core/modules/facture/modules_facture.php b/htdocs/core/modules/facture/modules_facture.php index 3253ed00ef9..ae0d9f98cda 100644 --- a/htdocs/core/modules/facture/modules_facture.php +++ b/htdocs/core/modules/facture/modules_facture.php @@ -137,6 +137,7 @@ abstract class ModeleNumRefFactures if ($this->version == 'development') return $langs->trans("VersionDevelopment"); if ($this->version == 'experimental') return $langs->trans("VersionExperimental"); if ($this->version == 'dolibarr') return DOL_VERSION; + if ($this->version) return $this->version; return $langs->trans("NotAvailable"); } } @@ -234,13 +235,6 @@ function facture_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0, // Success in building document. We build meta file. dol_meta_create($object); - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($db); - $result=$interface->run_triggers('BILL_BUILDDOC',$object,$user,$langs,$conf); - if ($result < 0) { $error++; $errors=$interface->errors; } - // Fin appel triggers - return 1; } else diff --git a/htdocs/core/modules/fichinter/doc/index.html b/htdocs/core/modules/fichinter/doc/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/core/modules/fichinter/index.html b/htdocs/core/modules/fichinter/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/core/modules/fichinter/modules_fichinter.php b/htdocs/core/modules/fichinter/modules_fichinter.php index 51084d7b313..dbcdab37530 100644 --- a/htdocs/core/modules/fichinter/modules_fichinter.php +++ b/htdocs/core/modules/fichinter/modules_fichinter.php @@ -136,6 +136,7 @@ abstract class ModeleNumRefFicheinter if ($this->version == 'development') return $langs->trans("VersionDevelopment"); if ($this->version == 'experimental') return $langs->trans("VersionExperimental"); if ($this->version == 'dolibarr') return DOL_VERSION; + if ($this->version) return $this->version; return $langs->trans("NotAvailable"); } } @@ -223,13 +224,6 @@ function fichinter_create($db, $object, $modele, $outputlangs, $hidedetails=0, $ require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; dol_delete_preview($object); - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($db); - $result=$interface->run_triggers('FICHINTER_BUILDDOC',$object,$user,$langs,$conf); - if ($result < 0) { $error++; $obj->errors=$interface->errors; } - // Fin appel triggers - return 1; } else diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php index e83f812e8c4..c8d77040a9d 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -256,15 +256,7 @@ class ImportCsv extends ModeleImports { global $conf; - $arrayres=array(); - if (version_compare(phpversion(), '5.3') < 0) - { - $arrayres=fgetcsv($this->handle,100000,$this->separator,$this->enclosure); - } - else - { - $arrayres=fgetcsv($this->handle,100000,$this->separator,$this->enclosure,$this->escape); - } + $arrayres=fgetcsv($this->handle,100000,$this->separator,$this->enclosure,$this->escape); // End of file if ($arrayres === false) return false; @@ -621,7 +613,7 @@ class ImportCsv extends ModeleImports } if (! empty($objimport->array_import_tables_creator[0][$alias])) $sql.=', '.$user->id; $sql.=')'; - dol_syslog("import_csv.modules sql=".$sql); + dol_syslog("import_csv.modules", LOG_DEBUG); //print '> '.join(',',$arrayrecord); //print 'sql='.$sql; diff --git a/htdocs/core/modules/import/index.html b/htdocs/core/modules/import/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/core/modules/index.html b/htdocs/core/modules/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/core/modules/index.php b/htdocs/core/modules/index.php deleted file mode 100644 index 7db0dd9ebf9..00000000000 --- a/htdocs/core/modules/index.php +++ /dev/null @@ -1 +0,0 @@ -Url not available \ No newline at end of file diff --git a/htdocs/core/modules/livraison/index.html b/htdocs/core/modules/livraison/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/core/modules/livraison/mod_livraison_jade.php b/htdocs/core/modules/livraison/mod_livraison_jade.php index 77ca85f8e6c..3480bb6d609 100644 --- a/htdocs/core/modules/livraison/mod_livraison_jade.php +++ b/htdocs/core/modules/livraison/mod_livraison_jade.php @@ -118,7 +118,7 @@ class mod_livraison_jade extends ModeleNumRefDeliveryOrder $sql.= " AND entity = ".$conf->entity; $resql=$db->query($sql); - dol_syslog("mod_livraison_jade::getNextValue sql=".$sql); + dol_syslog("mod_livraison_jade::getNextValue", LOG_DEBUG); if ($resql) { $obj = $db->fetch_object($resql); @@ -127,7 +127,6 @@ class mod_livraison_jade extends ModeleNumRefDeliveryOrder } else { - dol_syslog("mod_livraison_jade::getNextValue sql=".$sql, LOG_ERR); return -1; } diff --git a/htdocs/core/modules/livraison/modules_livraison.php b/htdocs/core/modules/livraison/modules_livraison.php index 89b226ec066..fe8e4220281 100644 --- a/htdocs/core/modules/livraison/modules_livraison.php +++ b/htdocs/core/modules/livraison/modules_livraison.php @@ -139,6 +139,7 @@ abstract class ModeleNumRefDeliveryOrder if ($this->version == 'development') return $langs->trans("VersionDevelopment"); if ($this->version == 'experimental') return $langs->trans("VersionExperimental"); if ($this->version == 'dolibarr') return DOL_VERSION; + if ($this->version) return $this->version; return $langs->trans("NotAvailable"); } } @@ -225,15 +226,6 @@ function delivery_order_pdf_create($db, $object, $modele, $outputlangs='') require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; dol_delete_preview($object); - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($db); - $result=$interface->run_triggers('DELIVERY_BUILDDOC',$object,$user,$langs,$conf); - if ($result < 0) { - $error++; $obj->errors=$interface->errors; - } - // Fin appel triggers - return 1; } else diff --git a/htdocs/core/modules/livraison/pdf/index.html b/htdocs/core/modules/livraison/pdf/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php b/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php index b13177f9127..095e325cb81 100644 --- a/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php +++ b/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php @@ -97,10 +97,11 @@ class pdf_typhon extends ModelePDFDeliveryOrder // Define position of columns $this->posxdesc=$this->marge_gauche+1; - $this->posxcomm=112; + $this->posxcomm=900; //$this->posxtva=112; //$this->posxup=126; - $this->posxqty=174; + $this->posxqty=140; + $this->posxremainingqty=165; //$this->posxdiscount=162; //$this->postotalht=174; if ($this->page_largeur < 210) // To work with US executive format @@ -207,6 +208,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder $commande->fetch($expedition->origin_id); } $object->commande=$commande; // We set order of shipment onto delivery. + $object->commande->loadExpeditions(); $pdf->Open(); @@ -355,7 +357,12 @@ class pdf_typhon extends ModelePDFDeliveryOrder // Quantity //$qty = pdf_getlineqty($object, $i, $outputlangs, $hidedetails); $pdf->SetXY($this->posxqty, $curY); - $pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->posxqty, 3, $object->lines[$i]->qty_shipped, 0, 'R'); + $pdf->MultiCell($this->posxremainingqty - $this->posxqty, 3, $object->lines[$i]->qty_shipped, 0, 'R'); + + // Remaining to ship + $pdf->SetXY($this->posxremainingqty, $curY); + $qtyRemaining = $object->lines[$i]->qty_asked - $object->commande->expeditions[$object->lines[$i]->fk_origin_line]; + $pdf->MultiCell($this->page_largeur-$this->marge_droite - $this->posxremainingqty, 3, $qtyRemaining, 0, 'R'); /* // Remise sur ligne $pdf->SetXY($this->posxdiscount, $curY); @@ -606,7 +613,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder $pdf->SetXY($this->posxdesc-1, $tab_top+1); $pdf->MultiCell($this->posxcomm - $this->posxdesc,2, $outputlangs->transnoentities("Designation"),'','L'); } - + // Modif SEB pour avoir une col en plus pour les commentaires clients $pdf->line($this->posxcomm, $tab_top, $this->posxcomm, $tab_top + $tab_height); if (empty($hidetop)) { @@ -615,12 +622,18 @@ class pdf_typhon extends ModelePDFDeliveryOrder } // Qty - $pdf->line($this->posxqty-1, $tab_top, $this->posxqty-1, $tab_top + $tab_height); + $pdf->line($this->posxqty, $tab_top, $this->posxqty, $tab_top + $tab_height); if (empty($hidetop)) { - $pdf->SetXY($this->posxqty-1, $tab_top+1); - $pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->posxqty, 2, $outputlangs->transnoentities("QtyShipped"),'','R'); + $pdf->SetXY($this->posxqty, $tab_top+1); + $pdf->MultiCell($this->posxremainingqty - $this->posxqty, 2, $outputlangs->transnoentities("QtyShipped"),'','C'); } + // Remain to ship + $pdf->line($this->posxremainingqty, $tab_top, $this->posxremainingqty, $tab_top + $tab_height); + if (empty($hidetop)) { + $pdf->SetXY($this->posxremainingqty, $tab_top+1); + $pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->posxremainingqty, 2, $outputlangs->transnoentities("KeepToShip"),'','C'); + } } /** diff --git a/htdocs/core/modules/mailings/contacts1.modules.php b/htdocs/core/modules/mailings/contacts1.modules.php index 3d0b0946b8f..2729234483f 100644 --- a/htdocs/core/modules/mailings/contacts1.modules.php +++ b/htdocs/core/modules/mailings/contacts1.modules.php @@ -197,7 +197,7 @@ class mailing_contacts1 extends MailingTargets // La requete doit retourner: id, email, fk_contact, name, firstname, other $sql = "SELECT c.rowid as id, c.email as email, c.rowid as fk_contact,"; - $sql.= " c.lastname, c.firstname, c.civilite as civility_id,"; + $sql.= " c.lastname, c.firstname, c.civility as civility_id,"; $sql.= " s.nom as companyname"; $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as c"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = c.fk_soc"; @@ -239,7 +239,7 @@ class mailing_contacts1 extends MailingTargets 'firstname' => $obj->firstname, 'other' => ($langs->transnoentities("ThirdParty").'='.$obj->companyname).';'. - ($langs->transnoentities("UserTitle").'='.($obj->civilite_id?$langs->transnoentities("Civility".$obj->civilite_id):'')), + ($langs->transnoentities("UserTitle").'='.($obj->civility_id?$langs->transnoentities("Civility".$obj->civility_id):'')), 'source_url' => $this->url($obj->id), 'source_id' => $obj->id, 'source_type' => 'contact' diff --git a/htdocs/core/modules/mailings/contacts2.modules.php b/htdocs/core/modules/mailings/contacts2.modules.php index 7f07cc7fa0a..35d840125a7 100644 --- a/htdocs/core/modules/mailings/contacts2.modules.php +++ b/htdocs/core/modules/mailings/contacts2.modules.php @@ -79,7 +79,7 @@ class mailing_contacts2 extends MailingTargets // La requete doit retourner: id, email, fk_contact, name, firstname, other $sql = "SELECT sp.rowid as id, sp.email as email, sp.rowid as fk_contact,"; - $sql.= " sp.lastname, sp.firstname as firstname, sp.civilite as civility_id,"; + $sql.= " sp.lastname, sp.firstname as firstname, sp.civility as civility_id,"; $sql.= " s.nom as companyname"; $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = sp.fk_soc"; diff --git a/htdocs/core/modules/mailings/contacts3.modules.php b/htdocs/core/modules/mailings/contacts3.modules.php index 4c6480b8812..327e36cf826 100644 --- a/htdocs/core/modules/mailings/contacts3.modules.php +++ b/htdocs/core/modules/mailings/contacts3.modules.php @@ -77,7 +77,7 @@ class mailing_contacts3 extends MailingTargets // La requete doit retourner: id, email, fk_contact, name, firstname, other $sql = "SELECT sp.rowid as id, sp.email as email, sp.rowid as fk_contact,"; - $sql.= " sp.lastname, sp.firstname, sp.civilite as civility_id,"; + $sql.= " sp.lastname, sp.firstname, sp.civility as civility_id,"; $sql.= " s.nom as companyname"; $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = sp.fk_soc"; @@ -92,7 +92,6 @@ class mailing_contacts3 extends MailingTargets if ($filtersarray[0] <> 'all') $sql.= " AND c.label = '".$this->db->escape($filtersarray[0])."'"; $sql.= " ORDER BY sp.lastname, sp.firstname"; - dol_syslog("sql=".$sql); $resql = $this->db->query($sql); if ($resql) { diff --git a/htdocs/core/modules/mailings/contacts4.modules.php b/htdocs/core/modules/mailings/contacts4.modules.php index acf4a316660..c86ca871c17 100644 --- a/htdocs/core/modules/mailings/contacts4.modules.php +++ b/htdocs/core/modules/mailings/contacts4.modules.php @@ -77,7 +77,7 @@ class mailing_contacts4 extends MailingTargets // La requete doit retourner: id, email, fk_contact, name, firstname, other $sql = "SELECT sp.rowid as id, sp.email as email, sp.rowid as fk_contact,"; - $sql.= " sp.lastname, sp.firstname, sp.civilite as civility_id,"; + $sql.= " sp.lastname, sp.firstname, sp.civility as civility_id,"; $sql.= " s.nom as companyname"; $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp"; if ($filtersarray[0] <> 'all')$sql.= " INNER JOIN ".MAIN_DB_PREFIX."categorie_contact as cs ON cs.fk_socpeople=sp.rowid"; @@ -89,7 +89,7 @@ class mailing_contacts4 extends MailingTargets if ($filtersarray[0] <> 'all') $sql.= " AND c.label = '".$this->db->escape($filtersarray[0])."'"; $sql.= " ORDER BY sp.lastname, sp.firstname"; - dol_syslog(get_class($this).':: add_to_target sql='.$sql,LOG_DEBUG); + dol_syslog(get_class($this).':: add_to_target',LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -115,7 +115,6 @@ class mailing_contacts4 extends MailingTargets } }else { $this->error=$this->db->lasterrno(); - dol_syslog(get_class($this)."Error sql=".$sql." ".$this->error, LOG_ERR); return -1; } @@ -215,7 +214,7 @@ class mailing_contacts4 extends MailingTargets $resql = $this->db->query($sql); - dol_syslog(get_class($this).':: formFilter sql='.$sql,LOG_DEBUG); + dol_syslog(get_class($this).':: formFilter',LOG_DEBUG); if ($resql) { $s=''; $s.=' - +
@@ -80,7 +81,7 @@ $(document).ready(function () {
- +
trans('SecurityCode'); ?>
diff --git a/htdocs/core/tpl/notes.tpl.php b/htdocs/core/tpl/notes.tpl.php index 0cce9a3e3b4..66b310da69d 100644 --- a/htdocs/core/tpl/notes.tpl.php +++ b/htdocs/core/tpl/notes.tpl.php @@ -22,6 +22,7 @@ $note_public = 'note_public'; $note_private = 'note_private'; $colwidth=(isset($colwidth)?$colwidth:25); + $permission=(isset($permission)?$permission:(isset($user->rights->$module->creer)?$user->rights->$module->creer:0)); // If already defined by caller page $moreparam=(isset($moreparam)?$moreparam:''); $value_public=$object->note_public; @@ -59,8 +60,9 @@ elseif ($module == 'contact') { $permission=$user->rights->societe->creer;} elseif ($module == 'shipping') { $permission=$user->rights->expedition->creer;} //else dol_print_error('','Bad value '.$module.' for param module'); -if (! empty($conf->global->FCKEDITOR_ENABLE_SOCIETE)) $typeofdata='ckeditor:dolibarr_notes:100%:200::1:12:100'; +if (! empty($conf->global->FCKEDITOR_ENABLE_SOCIETE)) $typeofdata='ckeditor:dolibarr_notes:100%:200::1:12:100'; // Rem: This var is for all notes, not only thirdparties note. else $typeofdata='textarea:12:100'; + ?> diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 68613492df8..17915465543 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -50,23 +50,25 @@ if (in_array($object->element,array('propal','facture','invoice','commande','ord global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="2"' : ''); ?>>
trans('AddNewLine'); ?>trans("FreeZone"); ?> -
- + + - + - - + + element == 'contrat') + { + if (empty($conf->product->enabled) && empty($conf->service->enabled) && empty($conf->global->CONTRACT_SUPPORT_PRODUCTS)) $forceall=-1; // With contract, by default, no choice at all, except if CONTRACT_SUPPORT_PRODUCTS is set + else $forceall=0; + } + // Free line echo ''; // Show radio free line - if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) + if ($forceall >= 0 && (! empty($conf->product->enabled) || ! empty($conf->service->enabled))) { echo 'product->enabled) || empty($conf->service->enabled)))?' checked="true"':'') ); @@ -100,30 +109,28 @@ else { echo '> '; } else echo ''; + // Show type selector -/* if (empty($conf->product->enabled) && empty($conf->service->enabled)) + if ($forceall >= 0) { - // If module product and service disabled, by default this is a product except for contracts it is a service - print ''; - } - else {*/ + echo ''; echo ' '; - echo $form->select_type_of_lines(isset($_POST["type"])?$_POST["type"]:-1,'type',1,1,1); -// } + } + + echo $form->select_type_of_lines(isset($_POST["type"])?$_POST["type"]:-1,'type',1,1,$forceall); + echo ''; // Predefined product/service if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) { - echo '
'; + if ($forceall >= 0) echo '
'; + echo ''; echo ' '; + echo ''; echo ' '; $filtertype=''; @@ -184,7 +192,7 @@ else {
- - + qty > $line->stock) print img_picto($langs->trans("StockTooLow"),"warning", 'style="vertical-align: bottom;"')." "; ?> - +   @@ -115,7 +115,7 @@ $coldisplay=-1; // We remove first td + global->DISPLAY_MARGIN_RATES) && $user->rights->margins->liretous) {?> + * + * 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 that all the triggers must extend + */ +abstract class DolibarrTriggers +{ + + /** + * Database handler + * @var DoliDB + */ + protected $db; + + /** + * Name of the trigger + * @var mixed|string + */ + public $name = ''; + + /** + * Description of the trigger + * @var string + */ + public $description = ''; + + /** + * Version of the trigger + * @var string + */ + public $version = self::VERSION_DEVELOPMENT; + + /** + * Image of the trigger + * @var string + */ + public $picto = 'technic'; + + /** + * Category of the trigger + * @var string + */ + public $family = ''; + + /** + * Error reported by the trigger + * @var string + * @deprecated Use $this->errors + */ + public $error = ''; + + /** + * Errors reported by the trigger + * @var array + */ + public $errors = array(); + + const VERSION_DEVELOPMENT = 'development'; + const VERSION_EXPERIMENTAL = 'experimental'; + const VERSION_DOLIBARR = 'dolibarr'; + + /** + * Constructor + * + * @param DoliDB $db Database handler + */ + public function __construct(DoliDB $db) { + + $this->db = $db; + + if (!isset($this->name)) { + $this->name = preg_replace('/^Interface/i', '', get_class($this)); + } + } + + /** + * Returns the name of the trigger file + * + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Returns the description of trigger file + * + * @return string + */ + public function getDesc() + { + return $this->description; + } + + /** + * Returns the version of the trigger file + * + * @return string Version of trigger file + */ + public function getVersion() + { + global $langs; + $langs->load("admin"); + + if ($this->version == self::VERSION_DEVELOPMENT) { + return $langs->trans("Development"); + } elseif ($this->version == self::VERSION_EXPERIMENTAL) { + return $langs->trans("Experimental"); + } elseif ($this->version == self::VERSION_DOLIBARR) { + return DOL_VERSION; + } elseif ($this->version) { + return $this->version; + } else { + return $langs->trans("Unknown"); + } + } + + /** + * Function called when a Dolibarrr business event is done. + * All functions "runTrigger" are triggered if file is inside directory htdocs/core/triggers or htdocs/module/code/triggers (and declared) + * + * @param string $action Event action code + * @param Object $object Object + * @param User $user Object user + * @param Translate $langs Object langs + * @param conf $conf Object conf + * @return int <0 if KO, 0 if no triggered ran, >0 if OK + */ + abstract function runTrigger($action, $object, User $user, Translate $langs, Conf $conf); + +} \ No newline at end of file diff --git a/htdocs/core/triggers/index.html b/htdocs/core/triggers/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/core/triggers/index.php b/htdocs/core/triggers/index.php deleted file mode 100644 index 7db0dd9ebf9..00000000000 --- a/htdocs/core/triggers/index.php +++ /dev/null @@ -1 +0,0 @@ -Url not available \ No newline at end of file diff --git a/htdocs/core/triggers/interface_20_all_Logevents.class.php b/htdocs/core/triggers/interface_20_all_Logevents.class.php index df6242a20d9..0770af54520 100644 --- a/htdocs/core/triggers/interface_20_all_Logevents.class.php +++ b/htdocs/core/triggers/interface_20_all_Logevents.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2009 Regis Houssin + * 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 @@ -26,81 +27,25 @@ /** * Class of triggers for security events */ -class InterfaceLogevents +class InterfaceLogevents extends DolibarrTriggers { - var $db; - var $error; + public $picto = 'technic'; + public $family = 'core'; + public $description = "Triggers of this module allows to add security event records inside Dolibarr."; + public $version = self::VERSION_DOLIBARR; - var $date; - var $duree; - var $texte; - var $desc; - - /** - * Constructor - * - * @param DoliDB $db Database handler - */ - function __construct($db) - { - $this->db = $db; - - $this->name = preg_replace('/^Interface/i','',get_class($this)); - $this->family = "core"; - $this->description = "Triggers of this module allows to add security event records inside Dolibarr."; - $this->version = 'dolibarr'; // 'experimental' or 'dolibarr' or version - $this->picto = 'technic'; - } - - /** - * Return name of trigger file - * - * @return string Name of trigger file - */ - function getName() - { - return $this->name; - } - - /** - * Return description of trigger file - * - * @return string Description of trigger file - */ - function getDesc() - { - return $this->description; - } - - /** - * Return version of trigger file - * - * @return string Version of trigger file - */ - function getVersion() - { - global $langs; - $langs->load("admin"); - - if ($this->version == 'experimental') return $langs->trans("Experimental"); - elseif ($this->version == 'dolibarr') return DOL_VERSION; - elseif ($this->version) return $this->version; - else return $langs->trans("Unknown"); - } - - /** - * Function called when a Dolibarrr business event is done. - * All functions "run_trigger" are triggered if file is inside directory htdocs/core/triggers - * - * @param string $action Event action code - * @param Object $object Object - * @param User $user Object user - * @param Translate $langs Object langs - * @param conf $conf Object conf - * @param string $entity Value for instance of data (Always 1 except if module MultiCompany is installed) - * @return int <0 if KO, 0 if no triggered ran, >0 if OK - */ - function run_trigger($action,$object,$user,$langs,$conf,$entity=1) + /** + * Function called when a Dolibarrr business event is done. + * All functions "runTrigger" are triggered if file is inside directory htdocs/core/triggers or htdocs/module/code/triggers (and declared) + * + * @param string $action Event action code + * @param Object $object Object + * @param User $user Object user + * @param Translate $langs Object langs + * @param conf $conf Object conf + * @return int <0 if KO, 0 if no triggered ran, >0 if OK + */ + public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf) { if (! empty($conf->global->MAIN_LOGEVENTS_DISABLE_ALL)) return 0; // Log events is disabled (hidden features) @@ -110,8 +55,7 @@ class InterfaceLogevents if (empty($conf->entity)) $conf->entity = $entity; // forcing of the entity if it's not defined (ex: in login form) - $this->date=dol_now(); - $this->duree=0; + $date = dol_now(); // Actions if ($action == 'USER_LOGIN') @@ -119,24 +63,24 @@ class InterfaceLogevents dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); // Initialisation donnees (date,duree,texte,desc) - $this->texte="(UserLogged,".$object->login.")"; - $this->desc="(UserLogged,".$object->login.")"; + $text="(UserLogged,".$object->login.")"; + $desc="(UserLogged,".$object->login.")"; } if ($action == 'USER_LOGIN_FAILED') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); // Initialisation donnees (date,duree,texte,desc) - $this->texte=$object->trigger_mesg; // Message direct - $this->desc=$object->trigger_mesg; // Message direct + $text=$object->trigger_mesg; // Message direct + $desc=$object->trigger_mesg; // Message direct } if ($action == 'USER_LOGOUT') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); // Initialisation donnees (date,duree,texte,desc) - $this->texte="(UserLogoff,".$object->login.")"; - $this->desc="(UserLogoff,".$object->login.")"; + $text="(UserLogoff,".$object->login.")"; + $desc="(UserLogoff,".$object->login.")"; } if ($action == 'USER_CREATE') { @@ -144,8 +88,8 @@ class InterfaceLogevents $langs->load("users"); // Initialisation donnees (date,duree,texte,desc) - $this->texte=$langs->transnoentities("NewUserCreated",$object->login); - $this->desc=$langs->transnoentities("NewUserCreated",$object->login); + $text=$langs->transnoentities("NewUserCreated",$object->login); + $desc=$langs->transnoentities("NewUserCreated",$object->login); } elseif ($action == 'USER_MODIFY') { @@ -153,8 +97,8 @@ class InterfaceLogevents $langs->load("users"); // Initialisation donnees (date,duree,texte,desc) - $this->texte=$langs->transnoentities("EventUserModified",$object->login); - $this->desc=$langs->transnoentities("EventUserModified",$object->login); + $text=$langs->transnoentities("EventUserModified",$object->login); + $desc=$langs->transnoentities("EventUserModified",$object->login); } elseif ($action == 'USER_NEW_PASSWORD') { @@ -162,8 +106,8 @@ class InterfaceLogevents $langs->load("users"); // Initialisation donnees (date,duree,texte,desc) - $this->texte=$langs->transnoentities("NewUserPassword",$object->login); - $this->desc=$langs->transnoentities("NewUserPassword",$object->login); + $text=$langs->transnoentities("NewUserPassword",$object->login); + $desc=$langs->transnoentities("NewUserPassword",$object->login); } elseif ($action == 'USER_ENABLEDISABLE') { @@ -172,13 +116,13 @@ class InterfaceLogevents // Initialisation donnees (date,duree,texte,desc) if ($object->statut == 0) { - $this->texte=$langs->transnoentities("UserEnabled",$object->login); - $this->desc=$langs->transnoentities("UserEnabled",$object->login); + $text=$langs->transnoentities("UserEnabled",$object->login); + $desc=$langs->transnoentities("UserEnabled",$object->login); } if ($object->statut == 1) { - $this->texte=$langs->transnoentities("UserDisabled",$object->login); - $this->desc=$langs->transnoentities("UserDisabled",$object->login); + $text=$langs->transnoentities("UserDisabled",$object->login); + $desc=$langs->transnoentities("UserDisabled",$object->login); } } elseif ($action == 'USER_DELETE') @@ -186,8 +130,8 @@ class InterfaceLogevents dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); $langs->load("users"); // Initialisation donnees (date,duree,texte,desc) - $this->texte=$langs->transnoentities("UserDeleted",$object->login); - $this->desc=$langs->transnoentities("UserDeleted",$object->login); + $text=$langs->transnoentities("UserDeleted",$object->login); + $desc=$langs->transnoentities("UserDeleted",$object->login); } // Groupes @@ -196,24 +140,24 @@ class InterfaceLogevents dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); $langs->load("users"); // Initialisation donnees (date,duree,texte,desc) - $this->texte=$langs->transnoentities("NewGroupCreated",$object->nom); - $this->desc=$langs->transnoentities("NewGroupCreated",$object->nom); + $text=$langs->transnoentities("NewGroupCreated",$object->nom); + $desc=$langs->transnoentities("NewGroupCreated",$object->nom); } elseif ($action == 'GROUP_MODIFY') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); $langs->load("users"); // Initialisation donnees (date,duree,texte,desc) - $this->texte=$langs->transnoentities("GroupModified",$object->nom); - $this->desc=$langs->transnoentities("GroupModified",$object->nom); + $text=$langs->transnoentities("GroupModified",$object->nom); + $desc=$langs->transnoentities("GroupModified",$object->nom); } elseif ($action == 'GROUP_DELETE') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); $langs->load("users"); // Initialisation donnees (date,duree,texte,desc) - $this->texte=$langs->transnoentities("GroupDeleted",$object->nom); - $this->desc=$langs->transnoentities("GroupDeleted",$object->nom); + $text=$langs->transnoentities("GroupDeleted",$object->nom); + $desc=$langs->transnoentities("GroupDeleted",$object->nom); } // If not found @@ -226,30 +170,27 @@ class InterfaceLogevents */ // Add entry in event table - if ($this->date) + include_once DOL_DOCUMENT_ROOT.'/core/class/events.class.php'; + + $event=new Events($this->db); + $event->type=$action; + $event->dateevent=$date; + $event->label=$text; + $event->description=$desc; + $event->user_agent=$_SERVER["HTTP_USER_AGENT"]; + + $result=$event->create($user); + if ($result > 0) { - include_once DOL_DOCUMENT_ROOT.'/core/class/events.class.php'; + return 1; + } + else + { + $error ="Failed to insert security event: ".$event->error; + $this->error=$error; - $event=new Events($this->db); - $event->type=$action; - $event->dateevent=$this->date; - $event->label=$this->texte; - $event->description=$this->desc; - $event->user_agent=$_SERVER["HTTP_USER_AGENT"]; - - $result=$event->create($user); - if ($result > 0) - { - return 1; - } - else - { - $error ="Failed to insert security event: ".$event->error; - $this->error=$error; - - dol_syslog(get_class($this).": ".$this->error, LOG_ERR); - return -1; - } + dol_syslog(get_class($this).": ".$this->error, LOG_ERR); + return -1; } return 0; diff --git a/htdocs/core/triggers/interface_20_modPaypal_PaypalWorkflow.class.php b/htdocs/core/triggers/interface_20_modPaypal_PaypalWorkflow.class.php index 4401a0ebcfa..13647814bb4 100644 --- a/htdocs/core/triggers/interface_20_modPaypal_PaypalWorkflow.class.php +++ b/htdocs/core/triggers/interface_20_modPaypal_PaypalWorkflow.class.php @@ -1,5 +1,6 @@ + * 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 @@ -25,76 +26,25 @@ /** * Class of triggers for paypal module */ -class InterfacePaypalWorkflow +class InterfacePaypalWorkflow extends DolibarrTriggers { - var $db; + public $picto = 'paypal@paypal'; + public $family = 'paypal'; + public $description = "Triggers of this module allows to manage paypal workflow"; + public $version = self::VERSION_DOLIBARR; - /** - * Constructor - * - * @param DoliDB $db Database handler - */ - function __construct($db) - { - $this->db = $db; - - $this->name = preg_replace('/^Interface/i','',get_class($this)); - $this->family = "paypal"; - $this->description = "Triggers of this module allows to manage paypal workflow"; - $this->version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' or version - $this->picto = 'paypal@paypal'; - } - - - /** - * Renvoi nom du lot de triggers - * - * @return string Nom du lot de triggers - */ - function getName() - { - return $this->name; - } - - /** - * Renvoi descriptif du lot de triggers - * - * @return string Descriptif du lot de triggers - */ - function getDesc() - { - return $this->description; - } - - /** - * Renvoi version du lot de triggers - * - * @return string Version du lot de triggers - */ - function getVersion() - { - global $langs; - $langs->load("admin"); - - if ($this->version == 'development') return $langs->trans("Development"); - elseif ($this->version == 'experimental') return $langs->trans("Experimental"); - elseif ($this->version == 'dolibarr') return DOL_VERSION; - elseif ($this->version) return $this->version; - else return $langs->trans("Unknown"); - } - - /** - * Fonction appelee lors du declenchement d'un evenement Dolibarr. - * D'autres fonctions run_trigger peuvent etre presentes dans core/triggers - * - * @param string $action Event action code - * @param Object $object Object - * @param User $user Object user - * @param Translate $langs Object langs - * @param conf $conf Object conf - * @return int <0 if KO, 0 if no triggered ran, >0 if OK - */ - function run_trigger($action,$object,$user,$langs,$conf) + /** + * Function called when a Dolibarrr business event is done. + * All functions "runTrigger" are triggered if file is inside directory htdocs/core/triggers or htdocs/module/code/triggers (and declared) + * + * @param string $action Event action code + * @param Object $object Object + * @param User $user Object user + * @param Translate $langs Object langs + * @param conf $conf Object conf + * @return int <0 if KO, 0 if no triggered ran, >0 if OK + */ + public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf) { // Mettre ici le code a executer en reaction de l'action // Les donnees de l'action sont stockees dans $object diff --git a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php index adca98768d3..c1e3995afa8 100644 --- a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php +++ b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2011 Laurent Destailleur + * 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 @@ -27,76 +28,25 @@ * Class of triggers for workflow module */ -class InterfaceWorkflowManager +class InterfaceWorkflowManager extends DolibarrTriggers { - var $db; + public $picto = 'paypal@paypal'; + public $family = 'core'; + public $description = "Triggers of this module allows to manage workflows"; + public $version = self::VERSION_DOLIBARR; - /** - * Constructor - * - * @param DoliDB $db Database handler - */ - function __construct($db) - { - $this->db = $db; - - $this->name = preg_replace('/^Interface/i','',get_class($this)); - $this->family = "core"; - $this->description = "Triggers of this module allows to manage workflows"; - $this->version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' or version - $this->picto = 'technic'; - } - - - /** - * Return name of trigger file - * - * @return string Name of trigger file - */ - function getName() - { - return $this->name; - } - - /** - * Return description of trigger file - * - * @return string Description of trigger file - */ - function getDesc() - { - return $this->description; - } - - /** - * Return version of trigger file - * - * @return string Version of trigger file - */ - function getVersion() - { - global $langs; - $langs->load("admin"); - - if ($this->version == 'development') return $langs->trans("Development"); - elseif ($this->version == 'experimental') return $langs->trans("Experimental"); - elseif ($this->version == 'dolibarr') return DOL_VERSION; - elseif ($this->version) return $this->version; - else return $langs->trans("Unknown"); - } - - /** - * Function called when a Dolibarrr business event is done. - * All functions "run_trigger" are triggered if file is inside directory htdocs/core/triggers - * - * @param string $action Event action code - * @param Object $object Object - * @param User $user Object user - * @param Translate $langs Object langs - * @param conf $conf Object conf - * @return int <0 if KO, 0 if no triggered ran, >0 if OK - */ - function run_trigger($action,$object,$user,$langs,$conf) + /** + * Function called when a Dolibarrr business event is done. + * All functions "runTrigger" are triggered if file is inside directory htdocs/core/triggers or htdocs/module/code/triggers (and declared) + * + * @param string $action Event action code + * @param Object $object Object + * @param User $user Object user + * @param Translate $langs Object langs + * @param conf $conf Object conf + * @return int <0 if KO, 0 if no triggered ran, >0 if OK + */ + public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf) { if (empty($conf->workflow->enabled)) return 0; // Module not active, we do nothing @@ -166,7 +116,7 @@ class InterfaceWorkflowManager return $ret; } } - + // classify billed order if ($action == 'BILL_VALIDATE') { diff --git a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php index 7b3cbe15f9a..4d2888d8aff 100644 --- a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php +++ b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2009-2011 Regis Houssin * Copyright (C) 2011-2014 Juanjo Menent * Copyright (C) 2013 Cedric GROSS + * 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 @@ -28,123 +29,67 @@ /** * Class of triggered functions for agenda module */ -class InterfaceActionsAuto +class InterfaceActionsAuto extends DolibarrTriggers { - var $db; - var $error; + public $family = 'agenda'; + public $description = "Triggers of this module add actions in agenda according to setup made in agenda setup."; + public $version = self::VERSION_DOLIBARR; + public $picto = 'action'; - var $date; - var $duree; - var $texte; - var $desc; + /** + * Function called when a Dolibarrr business event is done. + * All functions "runTrigger" are triggered if file is inside directory htdocs/core/triggers or htdocs/module/code/triggers (and declared) + * + * Following properties must be filled: + * $object->actiontypecode (translation action code: AC_OTH, ...) + * $object->actionmsg (note, long text) + * $object->actionmsg2 (label, short text) + * $object->sendtoid (id of contact) + * $object->socid + * Optionnal: + * $object->fk_element + * $object->elementtype + * + * @param string $action Event action code + * @param Object $object Object + * @param User $user Object user + * @param Translate $langs Object langs + * @param conf $conf Object conf + * @return int <0 if KO, 0 if no triggered ran, >0 if OK + */ + public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf) + { + // Module not active, we do nothing + if (empty($conf->agenda->enabled)) { + return 0; + } - /** - * Constructor - * - * @param DoliDB $db Database handler - */ - function __construct($db) - { - $this->db = $db; + $key = 'MAIN_AGENDA_ACTIONAUTO_'.$action; - $this->name = preg_replace('/^Interface/i','',get_class($this)); - $this->family = "agenda"; - $this->description = "Triggers of this module add actions in agenda according to setup made in agenda setup."; - $this->version = 'dolibarr'; // 'experimental' or 'dolibarr' or version - $this->picto = 'action'; - } + // Do not log events not enabled for this action + if (empty($conf->global->$key)) { + return 0; + } - /** - * Return name of trigger file - * - * @return string Name of trigger file - */ - function getName() - { - return $this->name; - } - - /** - * Return description of trigger file - * - * @return string Description of trigger file - */ - function getDesc() - { - return $this->description; - } - - /** - * Return version of trigger file - * - * @return string Version of trigger file - */ - function getVersion() - { - global $langs; - $langs->load("admin"); - - if ($this->version == 'experimental') return $langs->trans("Experimental"); - elseif ($this->version == 'dolibarr') return DOL_VERSION; - elseif ($this->version) return $this->version; - else return $langs->trans("Unknown"); - } - - /** - * Function called when a Dolibarrr business event is done. - * All functions "run_trigger" are triggered if file is inside directory htdocs/core/triggers - * - * Following properties must be filled: - * $object->actiontypecode (translation action code: AC_OTH, ...) - * $object->actionmsg (note, long text) - * $object->actionmsg2 (label, short text) - * $object->sendtoid (id of contact) - * $object->socid - * Optionnal: - * $object->fk_element - * $object->elementtype - * - * @param string $action Event action code - * @param Object $object Object - * @param User $user Object user - * @param Translate $langs Object langs - * @param conf $conf Object conf - * @return int <0 if KO, 0 if no triggered ran, >0 if OK - */ - function run_trigger($action,$object,$user,$langs,$conf) - { - $key='MAIN_AGENDA_ACTIONAUTO_'.$action; - //dol_syslog("xxxxxxxxxxx".$key); - - if (empty($conf->agenda->enabled)) return 0; // Module not active, we do nothing - if (empty($conf->global->$key)) return 0; // Log events not enabled for this action - - $ok=0; + $langs->load("agenda"); // Actions if ($action == 'COMPANY_CREATE') { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); $langs->load("other"); - $langs->load("agenda"); $object->actiontypecode='AC_OTH_AUTO'; if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("NewCompanyToDolibarr",$object->nom); $object->actionmsg=$langs->transnoentities("NewCompanyToDolibarr",$object->nom); if (! empty($object->prefix)) $object->actionmsg.=" (".$object->prefix.")"; - //$this->desc.="\n".$langs->transnoentities("Customer").': '.yn($object->client); - //$this->desc.="\n".$langs->transnoentities("Supplier").': '.yn($object->fournisseur); $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; $object->sendtoid=0; $object->socid=$object->id; - $ok=1; } elseif ($action == 'COMPANY_SENTBYMAIL') { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); $langs->load("orders"); - $langs->load("agenda"); if (empty($object->actiontypecode)) $object->actiontypecode='AC_OTH_AUTO'; if (empty($object->actionmsg2)) dol_syslog('Trigger called with property actionmsg2 on object not defined', LOG_ERR); @@ -152,14 +97,11 @@ class InterfaceActionsAuto // Parameters $object->sendtoid defined by caller //$object->sendtoid=0; - $ok=1; } elseif ($action == 'CONTRACT_VALIDATE') { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); $langs->load("other"); $langs->load("contracts"); - $langs->load("agenda"); $object->actiontypecode='AC_OTH_AUTO'; if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ContractValidatedInDolibarr",$object->ref); @@ -167,13 +109,10 @@ class InterfaceActionsAuto $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; $object->sendtoid=0; - $ok=1; } elseif ($action == 'PROPAL_VALIDATE') { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); $langs->load("propal"); - $langs->load("agenda"); $object->actiontypecode='AC_OTH_AUTO'; if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("PropalValidatedInDolibarr",$object->ref); @@ -181,13 +120,10 @@ class InterfaceActionsAuto $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; $object->sendtoid=0; - $ok=1; } elseif ($action == 'PROPAL_SENTBYMAIL') { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); $langs->load("propal"); - $langs->load("agenda"); $object->actiontypecode='AC_OTH_AUTO'; if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ProposalSentByEMail",$object->ref); @@ -199,13 +135,10 @@ class InterfaceActionsAuto // Parameters $object->sendtoid defined by caller //$object->sendtoid=0; - $ok=1; } elseif ($action == 'PROPAL_CLOSE_SIGNED') { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); $langs->load("propal"); - $langs->load("agenda"); $object->actiontypecode='AC_OTH_AUTO'; if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("PropalClosedSignedInDolibarr",$object->ref); @@ -213,13 +146,10 @@ class InterfaceActionsAuto $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; $object->sendtoid=0; - $ok=1; } elseif ($action == 'PROPAL_CLOSE_REFUSED') { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); $langs->load("propal"); - $langs->load("agenda"); $object->actiontypecode='AC_OTH_AUTO'; if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("PropalClosedRefusedInDolibarr",$object->ref); @@ -227,13 +157,10 @@ class InterfaceActionsAuto $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; $object->sendtoid=0; - $ok=1; } elseif ($action == 'ORDER_VALIDATE') { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); $langs->load("orders"); - $langs->load("agenda"); $object->actiontypecode='AC_OTH_AUTO'; if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("OrderValidatedInDolibarr",$object->ref); @@ -241,13 +168,10 @@ class InterfaceActionsAuto $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; $object->sendtoid=0; - $ok=1; } elseif ($action == 'ORDER_SENTBYMAIL') { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); $langs->load("orders"); - $langs->load("agenda"); $object->actiontypecode='AC_OTH_AUTO'; if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("OrderSentByEMail",$object->ref); @@ -259,14 +183,11 @@ class InterfaceActionsAuto // Parameters $object->sendtoid defined by caller //$object->sendtoid=0; - $ok=1; } elseif ($action == 'BILL_VALIDATE') { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); $langs->load("other"); $langs->load("bills"); - $langs->load("agenda"); $object->actiontypecode='AC_OTH_AUTO'; if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoiceValidatedInDolibarr",$object->ref); @@ -274,14 +195,11 @@ class InterfaceActionsAuto $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; $object->sendtoid=0; - $ok=1; } elseif ($action == 'BILL_UNVALIDATE') { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); $langs->load("other"); $langs->load("bills"); - $langs->load("agenda"); $object->actiontypecode='AC_OTH_AUTO'; if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoiceBackToDraftInDolibarr",$object->ref); @@ -289,14 +207,11 @@ class InterfaceActionsAuto $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; $object->sendtoid=0; - $ok=1; } elseif ($action == 'BILL_SENTBYMAIL') { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); $langs->load("other"); $langs->load("bills"); - $langs->load("agenda"); $object->actiontypecode='AC_OTH_AUTO'; if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoiceSentByEMail",$object->ref); @@ -308,14 +223,11 @@ class InterfaceActionsAuto // Parameters $object->sendtoid defined by caller //$object->sendtoid=0; - $ok=1; } elseif ($action == 'BILL_PAYED') { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); $langs->load("other"); $langs->load("bills"); - $langs->load("agenda"); // Values for this action can't be defined by caller. $object->actiontypecode='AC_OTH_AUTO'; @@ -324,14 +236,11 @@ class InterfaceActionsAuto $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; $object->sendtoid=0; - $ok=1; } elseif ($action == 'BILL_CANCEL') { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); $langs->load("other"); $langs->load("bills"); - $langs->load("agenda"); $object->actiontypecode='AC_OTH_AUTO'; if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoiceCanceledInDolibarr",$object->ref); @@ -339,14 +248,11 @@ class InterfaceActionsAuto $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; $object->sendtoid=0; - $ok=1; } elseif ($action == 'FICHINTER_VALIDATE') { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); $langs->load("other"); $langs->load("interventions"); - $langs->load("agenda"); $object->actiontypecode='AC_OTH_AUTO'; if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InterventionValidatedInDolibarr",$object->ref); @@ -356,30 +262,36 @@ class InterfaceActionsAuto $object->sendtoid=0; $object->fk_element=0; $object->elementtype=''; - $ok=1; } elseif ($action == 'FICHINTER_SENTBYMAIL') { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); $langs->load("other"); $langs->load("interventions"); - $langs->load("agenda"); $object->actiontypecode='AC_OTH_AUTO'; if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InterventionSentByEMail",$object->ref); $object->actionmsg=$langs->transnoentities("InterventionSentByEMail",$object->ref); $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; - // Parameters $object->sendotid defined by caller + // Parameters $object->sendtoid defined by caller //$object->sendtoid=0; - $ok=1; } - elseif ($action == 'SHIPPING_VALIDATE') + elseif ($action == 'FICHINTER_CLASSIFY_BILLED') + { + $langs->load("other"); + $langs->load("interventions"); + + $object->actiontypecode='AC_OTH_AUTO'; + if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InterventionClassifiedBilled",$object->ref); + $object->actionmsg=$langs->transnoentities("InterventionClassifiedBilled",$object->ref); + $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; + + $object->sendtoid=0; + } + elseif ($action == 'SHIPPING_VALIDATE') { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); $langs->load("other"); $langs->load("sendings"); - $langs->load("agenda"); $object->actiontypecode='AC_OTH_AUTO'; if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ShippingValidated",$object->ref); @@ -391,14 +303,11 @@ class InterfaceActionsAuto // Parameters $object->sendtoid defined by caller //$object->sendtoid=0; - $ok=1; } elseif ($action == 'SHIPPING_SENTBYMAIL') { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); $langs->load("other"); $langs->load("sendings"); - $langs->load("agenda"); $object->actiontypecode='AC_OTH_AUTO'; if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ShippingSentByEMail",$object->ref); @@ -410,13 +319,10 @@ class InterfaceActionsAuto // Parameters $object->sendtoid defined by caller //$object->sendtoid=0; - $ok=1; } elseif ($action == 'ORDER_SUPPLIER_VALIDATE') { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); $langs->load("orders"); - $langs->load("agenda"); $object->actiontypecode='AC_OTH_AUTO'; if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("OrderValidatedInDolibarr",$object->ref); @@ -424,13 +330,10 @@ class InterfaceActionsAuto $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; $object->sendtoid=0; - $ok=1; } elseif ($action == 'ORDER_SUPPLIER_APPROVE') { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); $langs->load("orders"); - $langs->load("agenda"); $object->actiontypecode='AC_OTH_AUTO'; if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("OrderApprovedInDolibarr",$object->ref); @@ -438,13 +341,10 @@ class InterfaceActionsAuto $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; $object->sendtoid=0; - $ok=1; } elseif ($action == 'ORDER_SUPPLIER_REFUSE') { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); $langs->load("orders"); - $langs->load("agenda"); $object->actiontypecode='AC_OTH_AUTO'; if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("OrderRefusedInDolibarr",$object->ref); @@ -452,14 +352,11 @@ class InterfaceActionsAuto $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; $object->sendtoid=0; - $ok=1; } elseif ($action == 'ORDER_SUPPLIER_SENTBYMAIL') { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); $langs->load("other"); $langs->load("bills"); - $langs->load("agenda"); $langs->load("orders"); $object->actiontypecode='AC_OTH_AUTO'; @@ -470,16 +367,13 @@ class InterfaceActionsAuto $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; } - // Parameters $object->sendotid defined by caller + // Parameters $object->sendtoid defined by caller //$object->sendtoid=0; - $ok=1; } elseif ($action == 'BILL_SUPPLIER_VALIDATE') { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); $langs->load("other"); $langs->load("bills"); - $langs->load("agenda"); $object->actiontypecode='AC_OTH_AUTO'; if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoiceValidatedInDolibarr",$object->ref); @@ -487,14 +381,11 @@ class InterfaceActionsAuto $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; $object->sendtoid=0; - $ok=1; } elseif ($action == 'BILL_SUPPLIER_SENTBYMAIL') { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); $langs->load("other"); $langs->load("bills"); - $langs->load("agenda"); $langs->load("orders"); $object->actiontypecode='AC_OTH_AUTO'; @@ -507,14 +398,11 @@ class InterfaceActionsAuto // Parameters $object->sendtoid defined by caller //$object->sendtoid=0; - $ok=1; } elseif ($action == 'BILL_SUPPLIER_PAYED') { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); $langs->load("other"); $langs->load("bills"); - $langs->load("agenda"); $object->actiontypecode='AC_OTH_AUTO'; if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoicePaidInDolibarr",$object->ref); @@ -522,14 +410,11 @@ class InterfaceActionsAuto $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; $object->sendtoid=0; - $ok=1; } elseif ($action == 'BILL_SUPPLIER_CANCELED') { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); $langs->load("other"); $langs->load("bills"); - $langs->load("agenda"); $object->actiontypecode='AC_OTH_AUTO'; if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoiceCanceledInDolibarr",$object->ref); @@ -537,16 +422,13 @@ class InterfaceActionsAuto $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; $object->sendtoid=0; - $ok=1; } // Members elseif ($action == 'MEMBER_VALIDATE') { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); $langs->load("other"); $langs->load("members"); - $langs->load("agenda"); $object->actiontypecode='AC_OTH_AUTO'; if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberValidatedInDolibarr",$object->ref); @@ -556,14 +438,11 @@ class InterfaceActionsAuto $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; $object->sendtoid=0; - $ok=1; } elseif ($action == 'MEMBER_SUBSCRIPTION') { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); $langs->load("other"); $langs->load("members"); - $langs->load("agenda"); $object->actiontypecode='AC_OTH_AUTO'; if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberSubscriptionAddedInDolibarr",$object->ref); @@ -575,18 +454,11 @@ class InterfaceActionsAuto $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; $object->sendtoid=0; - $ok=1; - } - elseif ($action == 'MEMBER_MODIFY') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); } elseif ($action == 'MEMBER_RESILIATE') { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); $langs->load("other"); $langs->load("members"); - $langs->load("agenda"); $object->actiontypecode='AC_OTH_AUTO'; if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberResiliatedInDolibarr",$object->ref); @@ -596,14 +468,11 @@ class InterfaceActionsAuto $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; $object->sendtoid=0; - $ok=1; } elseif ($action == 'MEMBER_DELETE') { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); $langs->load("other"); $langs->load("members"); - $langs->load("agenda"); $object->actiontypecode='AC_OTH_AUTO'; if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberDeletedInDolibarr",$object->ref); @@ -613,32 +482,27 @@ class InterfaceActionsAuto $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; $object->sendtoid=0; - $ok=1; } // Projects elseif ($action == 'PROJECT_CREATE') { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); $langs->load("other"); $langs->load("projects"); - $langs->load("agenda"); $object->actiontypecode='AC_OTH_AUTO'; if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ProjectCreatedInDolibarr",$object->ref); $object->actionmsg=$langs->transnoentities("ProjectCreatedInDolibarr",$object->ref); $object->actionmsg.="\n".$langs->transnoentities("Project").': '.$object->ref; $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; + $object->sendtoid=0; - $ok=1; } // Project tasks elseif($action == 'TASK_CREATE') { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); $langs->load("other"); $langs->load("projects"); - $langs->load("agenda"); $object->actiontypecode='AC_OTH_AUTO'; @@ -647,14 +511,12 @@ class InterfaceActionsAuto $object->actionmsg.="\n".$langs->transnoentities("Task").': '.$object->ref; $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; - $ok=1; + $object->sendtoid=0; } elseif($action == 'TASK_MODIFY') { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); $langs->load("other"); $langs->load("projects"); - $langs->load("agenda"); $object->actiontypecode='AC_OTH_AUTO'; if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("TaskModifiedInDolibarr",$object->ref); @@ -662,14 +524,12 @@ class InterfaceActionsAuto $object->actionmsg.="\n".$langs->transnoentities("Task").': '.$object->ref; $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; - $ok=1; + $object->sendtoid=0; } elseif($action == 'TASK_DELETE') { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); $langs->load("other"); $langs->load("projects"); - $langs->load("agenda"); $object->actiontypecode='AC_OTH_AUTO'; if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("TaskDeletedInDolibarr",$object->ref); @@ -677,7 +537,7 @@ class InterfaceActionsAuto $object->actionmsg.="\n".$langs->transnoentities("Task").': '.$object->ref; $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; - $ok=1; + $object->sendtoid=0; } // The trigger was enabled but we are missing the implementation, let the log know @@ -687,63 +547,62 @@ class InterfaceActionsAuto return 0; } + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + // Add entry in event table - if ($ok) - { - $now=dol_now(); + $now=dol_now(); - if(isset($_SESSION['listofnames'])) + if(isset($_SESSION['listofnames'])) + { + $attachs=$_SESSION['listofnames']; + if($attachs && strpos($action,'SENTBYMAIL')) { - $attachs=$_SESSION['listofnames']; - if($attachs && strpos($action,'SENTBYMAIL')) - { - $object->actionmsg.="\n".$langs->transnoentities("AttachedFiles").': '.$attachs; - } + $object->actionmsg.="\n".$langs->transnoentities("AttachedFiles").': '.$attachs; } + } - require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; - require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; - $contactforaction=new Contact($this->db); - $societeforaction=new Societe($this->db); - if ($object->sendtoid > 0) $contactforaction->fetch($object->sendtoid); - if ($object->socid > 0) $societeforaction->fetch($object->socid); + require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; + require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; + $contactforaction=new Contact($this->db); + $societeforaction=new Societe($this->db); + if ($object->sendtoid > 0) $contactforaction->fetch($object->sendtoid); + if ($object->socid > 0) $societeforaction->fetch($object->socid); - // Insertion action - require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; - $actioncomm = new ActionComm($this->db); - $actioncomm->type_code = $object->actiontypecode; // code of parent table llx_c_actioncomm (will be deprecated) - $actioncomm->code='AC_'.$action; - $actioncomm->label = $object->actionmsg2; - $actioncomm->note = $object->actionmsg; - $actioncomm->datep = $now; - $actioncomm->datef = $now; - $actioncomm->durationp = 0; - $actioncomm->punctual = 1; - $actioncomm->percentage = -1; // Not applicable - $actioncomm->contact = $contactforaction; - $actioncomm->societe = $societeforaction; - $actioncomm->author = $user; // User saving action - $actioncomm->usertodo = $user; // User action is assigned to (owner of action) - $actioncomm->userdone = $user; // User doing action (deprecated, not used anymore) + // Insertion action + require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; + $actioncomm = new ActionComm($this->db); + $actioncomm->type_code = $object->actiontypecode; // code of parent table llx_c_actioncomm (will be deprecated) + $actioncomm->code='AC_'.$action; + $actioncomm->label = $object->actionmsg2; + $actioncomm->note = $object->actionmsg; + $actioncomm->datep = $now; + $actioncomm->datef = $now; + $actioncomm->durationp = 0; + $actioncomm->punctual = 1; + $actioncomm->percentage = -1; // Not applicable + $actioncomm->contact = $contactforaction; + $actioncomm->societe = $societeforaction; + $actioncomm->author = $user; // User saving action + $actioncomm->usertodo = $user; // User action is assigned to (owner of action) + //$actioncomm->userdone = $user; // User doing action (deprecated, not used anymore) - $actioncomm->fk_element = $object->id; - $actioncomm->elementtype = $object->element; + $actioncomm->fk_element = $object->id; + $actioncomm->elementtype = $object->element; - $ret=$actioncomm->add($user); // User qui saisit l'action - if ($ret > 0) - { - $_SESSION['LAST_ACTION_CREATED'] = $ret; - return 1; - } - else - { - $error ="Failed to insert event : ".$actioncomm->error." ".join(',',$actioncomm->errors); - $this->error=$error; - $this->errors=$actioncomm->errors; + $ret=$actioncomm->add($user); // User qui saisit l'action + if ($ret > 0) + { + $_SESSION['LAST_ACTION_CREATED'] = $ret; + return 1; + } + else + { + $error ="Failed to insert event : ".$actioncomm->error." ".join(',',$actioncomm->errors); + $this->error=$error; + $this->errors=$actioncomm->errors; - dol_syslog("interface_modAgenda_ActionsAuto.class.php: ".$this->error, LOG_ERR); - return -1; - } + dol_syslog("interface_modAgenda_ActionsAuto.class.php: ".$this->error, LOG_ERR); + return -1; } return 0; diff --git a/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php b/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php index 7bc742d3a26..ce3af92d30b 100644 --- a/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php +++ b/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php @@ -1,5 +1,6 @@ + * 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 @@ -27,76 +28,25 @@ require_once (DOL_DOCUMENT_ROOT."/user/class/usergroup.class.php"); /** * Class of triggers for ldap module */ -class InterfaceLdapsynchro +class InterfaceLdapsynchro extends DolibarrTriggers { - var $db; - var $error; + public $family = 'ldap'; + public $description = "Triggers of this module allows to synchronize Dolibarr toward a LDAP database."; + public $version = self::VERSION_DOLIBARR; + public $picto = 'technic'; - - /** - * Constructor - * - * @param DoliDB $db Database handler - */ - function __construct($db) - { - $this->db = $db; - - $this->name = preg_replace('/^Interface/i','',get_class($this)); - $this->family = "ldap"; - $this->description = "Triggers of this module allows to synchronize Dolibarr toward a LDAP database."; - $this->version = 'dolibarr'; // 'experimental' or 'dolibarr' or version - $this->picto = 'technic'; - } - - /** - * Return name of trigger file - * - * @return string Name of trigger file - */ - function getName() - { - return $this->name; - } - - /** - * Return description of trigger file - * - * @return string Description of trigger file - */ - function getDesc() - { - return $this->description; - } - - /** - * Return version of trigger file - * - * @return string Version of trigger file - */ - function getVersion() - { - global $langs; - $langs->load("admin"); - - if ($this->version == 'experimental') return $langs->trans("Experimental"); - elseif ($this->version == 'dolibarr') return DOL_VERSION; - elseif ($this->version) return $this->version; - else return $langs->trans("Unknown"); - } - - /** - * Function called when a Dolibarrr business event is done. - * All functions "run_trigger" are triggered if file is inside directory htdocs/core/triggers - * - * @param string $action Event action code - * @param Object $object Object - * @param User $user Object user - * @param Translate $langs Object langs - * @param conf $conf Object conf - * @return int <0 if KO, 0 if no triggered ran, >0 if OK - */ - function run_trigger($action,$object,$user,$langs,$conf) + /** + * Function called when a Dolibarrr business event is done. + * All functions "runTrigger" are triggered if file is inside directory htdocs/core/triggers or htdocs/module/code/triggers (and declared) + * + * @param string $action Event action code + * @param Object $object Object + * @param User $user Object user + * @param Translate $langs Object langs + * @param conf $conf Object conf + * @return int <0 if KO, 0 if no triggered ran, >0 if OK + */ + public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf) { if (empty($conf->ldap->enabled)) return 0; // Module not active, we do nothing @@ -215,7 +165,7 @@ class InterfaceLdapsynchro $info=$object->_load_ldap_info(); $dn=$object->_load_ldap_dn($info); - $result=$ldap->delete($dn,$info,$user); + $result=$ldap->delete($dn); if ($result < 0) { $this->error="ErrorLDAP ".$ldap->error; @@ -372,7 +322,7 @@ class InterfaceLdapsynchro $info=$object->_load_ldap_info(); $dn=$object->_load_ldap_dn($info); - $result=$ldap->delete($dn,$info,$user); + $result=$ldap->delete($dn); if ($result < 0) { $this->error="ErrorLDAP ".$ldap->error; @@ -449,7 +399,7 @@ class InterfaceLdapsynchro $info=$object->_load_ldap_info(); $dn=$object->_load_ldap_dn($info); - $result=$ldap->delete($dn,$info,$user); + $result=$ldap->delete($dn); if ($result < 0) { $this->error="ErrorLDAP ".$ldap->error; @@ -626,7 +576,7 @@ class InterfaceLdapsynchro $info=$object->_load_ldap_info(); $dn=$object->_load_ldap_dn($info); - $result=$ldap->delete($dn,$info,$user); + $result=$ldap->delete($dn); if ($result < 0) { $this->error="ErrorLDAP ".$ldap->error; diff --git a/htdocs/core/triggers/interface_50_modMailmanspip_Mailmanspipsynchro.class.php b/htdocs/core/triggers/interface_50_modMailmanspip_Mailmanspipsynchro.class.php index 01ce1f7e539..d2c01f5f508 100644 --- a/htdocs/core/triggers/interface_50_modMailmanspip_Mailmanspipsynchro.class.php +++ b/htdocs/core/triggers/interface_50_modMailmanspip_Mailmanspipsynchro.class.php @@ -1,5 +1,6 @@ + * 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 @@ -27,77 +28,26 @@ require_once (DOL_DOCUMENT_ROOT."/user/class/usergroup.class.php"); /** * Class of triggers for MailmanSpip module */ -class InterfaceMailmanSpipsynchro +class InterfaceMailmanSpipsynchro extends DolibarrTriggers { - var $db; - var $error; + public $family = 'ldap'; + public $description = "Triggers of this module allows to synchronize Mailman an Spip."; + public $version = self::VERSION_DOLIBARR; + public $picto = 'technic'; - - /** - * Constructor - * - * @param DoliDB $db Database handler - */ - function __construct($db) - { - $this->db = $db; - - $this->name = preg_replace('/^Interface/i','',get_class($this)); - $this->family = "ldap"; - $this->description = "Triggers of this module allows to synchronize Mailman an Spip."; - $this->version = 'dolibarr'; // 'experimental' or 'dolibarr' or version - $this->picto = 'technic'; - } - - /** - * Return name of trigger file - * - * @return string Name of trigger file - */ - function getName() - { - return $this->name; - } - - /** - * Return description of trigger file - * - * @return string Description of trigger file - */ - function getDesc() - { - return $this->description; - } - - /** - * Return version of trigger file - * - * @return string Version of trigger file - */ - function getVersion() - { - global $langs; - $langs->load("admin"); - - if ($this->version == 'experimental') return $langs->trans("Experimental"); - elseif ($this->version == 'dolibarr') return DOL_VERSION; - elseif ($this->version) return $this->version; - else return $langs->trans("Unknown"); - } - - /** - * Function called when a Dolibarrr business event is done. - * All functions "run_trigger" are triggered if file is inside directory htdocs/core/triggers - * - * @param string $action Event action code - * @param Object $object Object - * @param User $user Object user - * @param Translate $langs Object langs - * @param conf $conf Object conf - * @return int <0 if KO, 0 if no triggered ran, >0 if OK - */ - function run_trigger($action,$object,$user,$langs,$conf) - { + /** + * Function called when a Dolibarrr business event is done. + * All functions "runTrigger" are triggered if file is inside directory htdocs/core/triggers or htdocs/module/code/triggers (and declared) + * + * @param string $action Event action code + * @param Object $object Object + * @param User $user Object user + * @param Translate $langs Object langs + * @param conf $conf Object conf + * @return int <0 if KO, 0 if no triggered ran, >0 if OK + */ + public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf) + { if (empty($conf->mailmanspip->enabled)) return 0; // Module not active, we do nothing if (! function_exists('ldap_connect')) @@ -106,38 +56,7 @@ class InterfaceMailmanSpipsynchro return 0; } - // Users - if ($action == 'USER_CREATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - - } - elseif ($action == 'USER_MODIFY') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'USER_NEW_PASSWORD') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'USER_ENABLEDISABLE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'USER_DELETE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'USER_SETINGROUP') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'USER_REMOVEFROMGROUP') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - - elseif ($action == 'CATEGORY_LINK') + if ($action == 'CATEGORY_LINK') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); @@ -211,10 +130,6 @@ class InterfaceMailmanSpipsynchro return $return; } - elseif ($action == 'MEMBER_NEW_PASSWORD') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } elseif ($action == 'MEMBER_RESILIATE' || $action == 'MEMBER_DELETE') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); @@ -231,16 +146,10 @@ class InterfaceMailmanSpipsynchro { $return=1; } + + return $return; } - // If not found -/* - else - { - dol_syslog("Trigger '".$this->name."' for action '$action' was ran by ".__FILE__." but no handler found for this action."); - return -1; - } -*/ return 0; } diff --git a/htdocs/core/triggers/interface_50_modNotification_Notification.class.php b/htdocs/core/triggers/interface_50_modNotification_Notification.class.php index c035acac207..c26ca4e33ef 100644 --- a/htdocs/core/triggers/interface_50_modNotification_Notification.class.php +++ b/htdocs/core/triggers/interface_50_modNotification_Notification.class.php @@ -1,7 +1,7 @@ * Copyright (C) 2011 Regis Houssin - * Copyright (C) 2013 Marcos García + * Copyright (C) 2013-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 @@ -27,9 +27,13 @@ /** * Class of triggers for notification module */ -class InterfaceNotification +class InterfaceNotification extends DolibarrTriggers { - var $db; + public $family = 'notification'; + public $description = "Triggers of this module send email notifications according to Notification module setup."; + public $version = self::VERSION_DOLIBARR; + public $picto = 'email'; + var $listofmanagedevents=array( 'BILL_VALIDATE', 'ORDER_VALIDATE', @@ -40,187 +44,87 @@ class InterfaceNotification 'SHIPPING_VALIDATE' ); - /** - * Constructor - * - * @param DoliDB $db Database handler - */ - function __construct($db) - { - $this->db = $db; - - $this->name = preg_replace('/^Interface/i','',get_class($this)); - $this->family = "notification"; - $this->description = "Triggers of this module send email notifications according to Notification module setup."; - $this->version = 'dolibarr'; // 'experimental' or 'dolibarr' or version - $this->picto = 'email'; - } - - /** - * Return name of trigger file - * - * @return string Name of trigger file - */ - function getName() - { - return $this->name; - } - - /** - * Return description of trigger file - * - * @return string Description of trigger file - */ - function getDesc() - { - return $this->description; - } - - /** - * Return version of trigger file - * - * @return string Version of trigger file - */ - function getVersion() - { - global $langs; - $langs->load("admin"); - - if ($this->version == 'experimental') return $langs->trans("Experimental"); - elseif ($this->version == 'dolibarr') return DOL_VERSION; - elseif ($this->version) return $this->version; - else return $langs->trans("Unknown"); - } - - /** - * Function called when a Dolibarrr business event is done. - * All functions "run_trigger" are triggered if file is inside directory htdocs/core/triggers - * - * @param string $action Event action code - * @param Object $object Object - * @param User $user Object user - * @param Translate $langs Object langs - * @param conf $conf Object conf - * @return int <0 if KO, 0 if no triggered ran, >0 if OK - */ - function run_trigger($action,$object,$user,$langs,$conf) - { + /** + * Function called when a Dolibarrr business event is done. + * All functions "runTrigger" are triggered if file is inside directory htdocs/core/triggers or htdocs/module/code/triggers (and declared) + * + * @param string $action Event action code + * @param Object $object Object + * @param User $user Object user + * @param Translate $langs Object langs + * @param conf $conf Object conf + * @return int <0 if KO, 0 if no triggered ran, >0 if OK + */ + public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf) + { if (empty($conf->notification->enabled)) return 0; // Module not active, we do nothing require_once DOL_DOCUMENT_ROOT .'/core/class/notify.class.php'; - if ($action == 'BILL_VALIDATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + $langs->load("other"); - $ref = dol_sanitizeFileName($object->ref); - $filepdf = $conf->facture->dir_output . '/' . $ref . '/' . $ref . '.pdf'; - if (! file_exists($filepdf)) $filepdf=''; - $filepdf=''; // We can't add PDF as it is not generated yet. - $langs->load("other"); - $mesg = $langs->transnoentitiesnoconv("EMailTextInvoiceValidated",$object->ref); + switch ($action) { + case 'BILL_VALIDATE': + $dir_output = $conf->facture->dir_output; + $object_type = 'facture'; + $mesg = $langs->transnoentitiesnoconv("EMailTextInvoiceValidated",$object->ref); + break; + case 'ORDER_VALIDATE': + $dir_output = $conf->commande->dir_output; + $object_type = 'order'; + $mesg = $langs->transnoentitiesnoconv("EMailTextOrderValidated",$object->ref); + break; + case 'PROPAL_VALIDATE': + $dir_output = $conf->propal->dir_output; + $object_type = 'propal'; + $mesg = $langs->transnoentitiesnoconv("EMailTextProposalValidated",$object->ref); + break; + case 'FICHINTER_VALIDATE': + $dir_output = $conf->facture->dir_output; + $object_type = 'ficheinter'; + $mesg = $langs->transnoentitiesnoconv("EMailTextInterventionValidated",$object->ref); + break; + case 'ORDER_SUPPLIER_APPROVE': + $dir_output = $conf->fournisseur->dir_output.'/commande/'; + $object_type = 'order_supplier'; + $mesg = $langs->transnoentitiesnoconv("Hello").",\n\n"; + $mesg.= $langs->transnoentitiesnoconv("EMailTextOrderApprovedBy",$object->ref,$user->getFullName($langs)); + $mesg.= "\n\n".$langs->transnoentitiesnoconv("Sincerely").".\n\n"; + break; + case 'ORDER_SUPPLIER_REFUSE': + $dir_output = $conf->fournisseur->dir_output.'/commande/'; + $object_type = 'order_supplier'; + $mesg = $langs->transnoentitiesnoconv("Hello").",\n\n"; + $mesg.= $langs->transnoentitiesnoconv("EMailTextOrderRefusedBy",$object->ref,$user->getFullName($langs)); + $mesg.= "\n\n".$langs->transnoentitiesnoconv("Sincerely").".\n\n"; + break; + case 'SHIPPING_VALIDATE': + $dir_output = $conf->expedition->dir_output.'/sending/'; + $object_type = 'order_supplier'; + $mesg = $langs->transnoentitiesnoconv("EMailTextExpeditionValidated",$object->ref); + break; + + default: + return 0; - $notify = new Notify($this->db); - $notify->send($action, $object->socid, $mesg, 'facture', $object->id, $filepdf); } - elseif ($action == 'ORDER_VALIDATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - $ref = dol_sanitizeFileName($object->ref); - $filepdf = $conf->commande->dir_output . '/' . $ref . '/' . $ref . '.pdf'; - if (! file_exists($filepdf)) $filepdf=''; - $filepdf=''; // We can't add PDF as it is not generated yet. - $langs->load("other"); - $mesg = $langs->transnoentitiesnoconv("EMailTextOrderValidated",$object->ref); + $ref = dol_sanitizeFileName($object->ref); + $pdf_path = "$dir_output/$ref/$ref.pdf"; - $notify = new Notify($this->db); - $notify->send($action, $object->socid, $mesg, 'order', $object->id, $filepdf); + if (!file_exists($pdf_path)) { + // We can't add PDF as it is not generated yet. + $filepdf = ''; + } else { + $filepdf = $pdf_path; } - elseif ($action == 'PROPAL_VALIDATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + $notify = new Notify($this->db); + $notify->send($action, $object->socid, $mesg, $object_type, $object->id, $filepdf); - $ref = dol_sanitizeFileName($object->ref); - $filepdf = $conf->propal->dir_output . '/' . $ref . '/' . $ref . '.pdf'; - if (! file_exists($filepdf)) $filepdf=''; - $filepdf=''; // We can't add PDF as it is not generated yet. - $langs->load("other"); - $mesg = $langs->transnoentitiesnoconv("EMailTextProposalValidated",$object->ref); - - $notify = new Notify($this->db); - $notify->send($action, $object->socid, $mesg, 'propal', $object->id, $filepdf); - } - - elseif ($action == 'FICHINTER_VALIDATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - - $ref = dol_sanitizeFileName($object->ref); - $filepdf = $conf->facture->dir_output . '/' . $ref . '/' . $ref . '.pdf'; - if (! file_exists($filepdf)) $filepdf=''; - $filepdf=''; // We can't add PDF as it is not generated yet. - $langs->load("other"); - $mesg = $langs->transnoentitiesnoconv("EMailTextInterventionValidated",$object->ref); - - $notify = new Notify($this->db); - $notify->send($action, $object->socid, $mesg, 'ficheinter', $object->id, $filepdf); - } - - elseif ($action == 'ORDER_SUPPLIER_APPROVE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - - $ref = dol_sanitizeFileName($object->ref); - $filepdf = $conf->fournisseur->dir_output . '/commande/' . $ref . '/' . $ref . '.pdf'; - if (! file_exists($filepdf)) $filepdf=''; - $mesg = $langs->transnoentitiesnoconv("Hello").",\n\n"; - $mesg.= $langs->transnoentitiesnoconv("EMailTextOrderApprovedBy",$object->ref,$user->getFullName($langs)); - $mesg.= "\n\n".$langs->transnoentitiesnoconv("Sincerely").".\n\n"; - - $notify = new Notify($this->db); - $notify->send($action, $object->socid, $mesg, 'order_supplier', $object->id, $filepdf); - } - - elseif ($action == 'ORDER_SUPPLIER_REFUSE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - - $ref = dol_sanitizeFileName($object->ref); - $filepdf = $conf->fournisseur->dir_output . '/commande/' . $ref . '/' . $ref . '.pdf'; - if (! file_exists($filepdf)) $filepdf=''; - $mesg = $langs->transnoentitiesnoconv("Hello").",\n\n"; - $mesg.= $langs->transnoentitiesnoconv("EMailTextOrderRefusedBy",$object->ref,$user->getFullName($langs)); - $mesg.= "\n\n".$langs->transnoentitiesnoconv("Sincerely").".\n\n"; - - $notify = new Notify($this->db); - $notify->send($action, $object->socid, $mesg, 'order_supplier', $object->id, $filepdf); - } - elseif ($action == 'SHIPPING_VALIDATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - - $ref = dol_sanitizeFileName($object->ref); - $filepdf = $conf->expedition->dir_output . '/sending/' . $ref . '/' . $ref . '.pdf'; - if (! file_exists($filepdf)) $filepdf=''; - $mesg = $langs->transnoentitiesnoconv("EMailTextExpeditionValidated",$object->ref); - - - $notify = new Notify($this->db); - $notify->send($action, $object->socid, $mesg, 'expedition', $object->id, $filepdf); - } - - // If not found -/* - else - { - dol_syslog("Trigger '".$this->name."' for action '$action' was ran by ".__FILE__." but no handler found for this action."); - return -1; - } -*/ - return 0; + return 1; } @@ -231,14 +135,14 @@ class InterfaceNotification */ function getListOfManagedEvents() { - global $conf,$langs; + global $conf; $ret=array(); $sql = "SELECT rowid, code, label, description, elementtype"; $sql.= " FROM ".MAIN_DB_PREFIX."c_action_trigger"; $sql.= $this->db->order("elementtype, code"); - dol_syslog("Get list of notifications sql=".$sql); + dol_syslog("Get list of notifications", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { diff --git a/htdocs/core/triggers/interface_90_all_Demo.class.php-NORUN b/htdocs/core/triggers/interface_90_all_Demo.class.php-NORUN index be0ec9346ae..96401c77251 100644 --- a/htdocs/core/triggers/interface_90_all_Demo.class.php-NORUN +++ b/htdocs/core/triggers/interface_90_all_Demo.class.php-NORUN @@ -1,6 +1,7 @@ - * Copyright (C) 2005-2014 Regis Houssin +/* Copyright (C) 2005-2014 Laurent Destailleur + * Copyright (C) 2005-2014 Regis Houssin + * 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 @@ -32,610 +33,219 @@ /** * Class of triggers for demo module */ -class InterfaceDemo +class InterfaceDemo extends DolibarrTriggers { - var $db; - - /** - * Constructor - * - * @param DoliDB $db Database handler - */ - function __construct($db) - { - $this->db = $db; - - $this->name = preg_replace('/^Interface/i','',get_class($this)); - $this->family = "demo"; - $this->description = "Triggers of this module are empty functions. They have no effect. They are provided for tutorial purpose only."; - $this->version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' or version - $this->picto = 'technic'; - } - - - /** - * Return name of trigger file - * - * @return string Name of trigger file - */ - function getName() - { - return $this->name; - } - - /** - * Return description of trigger file - * - * @return string Description of trigger file - */ - function getDesc() - { - return $this->description; - } - /** - * Return version of trigger file - * - * @return string Version of trigger file - */ - function getVersion() - { - global $langs; - $langs->load("admin"); + public $family = 'demo'; + public $picto = 'technic'; + public $description = "Triggers of this module are empty functions. They have no effect. They are provided for tutorial purpose only."; + public $version = self::VERSION_DOLIBARR; - if ($this->version == 'development') return $langs->trans("Development"); - elseif ($this->version == 'experimental') return $langs->trans("Experimental"); - elseif ($this->version == 'dolibarr') return DOL_VERSION; - elseif ($this->version) return $this->version; - else return $langs->trans("Unknown"); - } - - /** - * Function called when a Dolibarrr business event is done. - * All functions "run_trigger" are triggered if file is inside directory htdocs/core/triggers + /** + * Function called when a Dolibarrr business event is done. + * All functions "runTrigger" are triggered if file is inside directory htdocs/core/triggers or htdocs/module/code/triggers (and declared) * - * @param string $action Event action code - * @param Object $object Object - * @param User $user Object user - * @param Translate $langs Object langs - * @param conf $conf Object conf - * @return int <0 if KO, 0 if no triggered ran, >0 if OK + * @param string $action Event action code + * @param Object $object Object + * @param User $user Object user + * @param Translate $langs Object langs + * @param conf $conf Object conf + * @return int <0 if KO, 0 if no triggered ran, >0 if OK */ - function run_trigger($action,$object,$user,$langs,$conf) + public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf) { - // Put here code you want to execute when a Dolibarr business events occurs. + // Put here code you want to execute when a Dolibarr business events occurs. // Data and type of action are stored into $object and $action - - // Users - if ($action == 'USER_LOGIN') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'USER_UPDATE_SESSION') - { - // Warning: To increase performances, this action is triggered only if - // constant MAIN_ACTIVATE_UPDATESESSIONTRIGGER is set to 1. - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'USER_CREATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'USER_CREATE_FROM_CONTACT') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'USER_MODIFY') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'USER_NEW_PASSWORD') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'USER_ENABLEDISABLE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'USER_DELETE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'USER_LOGOUT') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'USER_SETINGROUP') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'USER_REMOVEFROMGROUP') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } + + switch ($action) { + + // Users + case 'USER_LOGIN': + case 'USER_UPDATE_SESSION': + case 'USER_CREATE': + case 'USER_CREATE_FROM_CONTACT': + case 'USER_LOGIN': + // Warning: To increase performances, this action is triggered only if + // constant MAIN_ACTIVATE_UPDATESESSIONTRIGGER is set to 1. + case 'USER_UPDATE_SESSION': + case 'USER_CREATE': + case 'USER_CREATE_FROM_CONTACT': + case 'USER_MODIFY': + case 'USER_NEW_PASSWORD': + case 'USER_ENABLEDISABLE': + case 'USER_DELETE': + case 'USER_LOGOUT': + case 'USER_SETINGROUP': + case 'USER_REMOVEFROMGROUP': + + // Actions + case 'ACTION_MODIFY': + case 'ACTION_CREATE': + case 'ACTION_DELETE': - // Groups - elseif ($action == 'GROUP_CREATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'GROUP_MODIFY') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'GROUP_DELETE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - - // Companies - elseif ($action == 'COMPANY_CREATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'COMPANY_MODIFY') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'COMPANY_DELETE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } + // Groups + case 'GROUP_CREATE': + case 'GROUP_MODIFY': + case 'GROUP_DELETE': - // Contacts - elseif ($action == 'CONTACT_CREATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'CONTACT_MODIFY') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'CONTACT_DELETE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } + // Companies + case 'COMPANY_CREATE': + case 'COMPANY_MODIFY': + case 'COMPANY_DELETE': - // Products - elseif ($action == 'PRODUCT_CREATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'PRODUCT_MODIFY') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'PRODUCT_DELETE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } + // Contacts + case 'CONTACT_CREATE': + case 'CONTACT_MODIFY': + case 'CONTACT_DELETE': + case 'CONTACT_ENABLEDISABLE': - // Customer orders - elseif ($action == 'ORDER_CREATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'ORDER_CLONE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'ORDER_VALIDATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'ORDER_DELETE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'ORDER_BUILDDOC') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'ORDER_SENTBYMAIL') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'ORDER_CLASSIFY_BILLED') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'LINEORDER_INSERT') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'LINEORDER_UPDATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'LINEORDER_DELETE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } + // Products + case 'PRODUCT_CREATE': + case 'PRODUCT_MODIFY': + case 'PRODUCT_DELETE': + case 'PRODUCT_PRICE_MODIFY': - // Supplier orders - elseif ($action == 'ORDER_SUPPLIER_CREATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'ORDER_SUPPLIER_CLONE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'ORDER_SUPPLIER_VALIDATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'ORDER_SUPPLIER_DELETE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'ORDER_SUPPLIER_APPROVE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'ORDER_SUPPLIER_REFUSE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'ORDER_SUPPLIER_CANCEL') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'ORDER_SUPPLIER_SENTBYMAIL') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'ORDER_SUPPLIER_BUILDDOC') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'LINEORDER_SUPPLIER_DISPATCH') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'LINEORDER_SUPPLIER_CREATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'LINEORDER_SUPPLIER_UPDATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } + //Stock mouvement + case 'STOCK_MOVEMENT': - // Proposals - elseif ($action == 'PROPAL_CREATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'PROPAL_CLONE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'PROPAL_MODIFY') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'PROPAL_VALIDATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'PROPAL_BUILDDOC') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'PROPAL_SENTBYMAIL') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'PROPAL_CLOSE_SIGNED') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'PROPAL_CLOSE_REFUSED') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'PROPAL_DELETE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'LINEPROPAL_INSERT') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'LINEPROPAL_UPDATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'LINEPROPAL_DELETE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } + //MYECMDIR + case 'MYECMDIR_DELETE': + case 'MYECMDIR_CREATE': + case 'MYECMDIR_MODIFY': - // Contracts - elseif ($action == 'CONTRACT_CREATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'CONTRACT_ACTIVATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'CONTRACT_CANCEL') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'CONTRACT_CLOSE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'CONTRACT_DELETE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'LINECONTRACT_UPDATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'LINECONTRACT_DELETE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } + // Customer orders + case 'ORDER_CREATE': + case 'ORDER_CLONE': + case 'ORDER_VALIDATE': + case 'ORDER_DELETE': + case 'ORDER_SENTBYMAIL': + case 'ORDER_CLASSIFY_BILLED': + case 'LINEORDER_INSERT': + case 'LINEORDER_UPDATE': + case 'LINEORDER_DELETE': - // Bills - elseif ($action == 'BILL_CREATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'BILL_CLONE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'BILL_MODIFY') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'BILL_VALIDATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'BILL_UNVALIDATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'BILL_BUILDDOC') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'BILL_SENTBYMAIL') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'BILL_CANCEL') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'BILL_DELETE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'BILL_PAYED') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'LINEBILL_INSERT') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'LINEBILL_UPDATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'LINEBILL_DELETE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } + // Supplier orders + case 'ORDER_SUPPLIER_CREATE': + case 'ORDER_SUPPLIER_CLONE': + case 'ORDER_SUPPLIER_VALIDATE': + case 'ORDER_SUPPLIER_DELETE': + case 'ORDER_SUPPLIER_APPROVE': + case 'ORDER_SUPPLIER_REFUSE': + case 'ORDER_SUPPLIER_CANCEL': + case 'ORDER_SUPPLIER_SENTBYMAIL': + case 'LINEORDER_SUPPLIER_DISPATCH': + case 'LINEORDER_SUPPLIER_CREATE': + case 'LINEORDER_SUPPLIER_UPDATE': - //Supplier Bill - elseif ($action == 'BILL_SUPPLIER_CREATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'BILL_SUPPLIER_DELETE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'BILL_SUPPLIER_PAYED') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'BILL_SUPPLIER_UNPAYED') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'BILL_SUPPLIER_VALIDATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'LINEBILL_SUPPLIER_CREATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'LINEBILL_SUPPLIER_UPDATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'LINEBILL_SUPPLIER_DELETE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - - // Payments - elseif ($action == 'PAYMENT_CUSTOMER_CREATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'PAYMENT_SUPPLIER_CREATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'PAYMENT_ADD_TO_BANK') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'PAYMENT_DELETE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } + // Proposals + case 'PROPAL_CREATE': + case 'PROPAL_CLONE': + case 'PROPAL_MODIFY': + case 'PROPAL_VALIDATE': + case 'PROPAL_SENTBYMAIL': + case 'PROPAL_CLOSE_SIGNED': + case 'PROPAL_CLOSE_REFUSED': + case 'PROPAL_DELETE': + case 'LINEPROPAL_INSERT': + case 'LINEPROPAL_UPDATE': + case 'LINEPROPAL_DELETE': - // Interventions - elseif ($action == 'FICHINTER_CREATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'FICHINTER_MODIFY') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'FICHINTER_VALIDATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'FICHINTER_DELETE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'LINEFICHINTER_CREATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'LINEFICHINTER_UPDATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'LINEFICHINTER_DELETE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - - // Members - elseif ($action == 'MEMBER_CREATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'MEMBER_VALIDATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'MEMBER_SUBSCRIPTION') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'MEMBER_MODIFY') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'MEMBER_NEW_PASSWORD') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'MEMBER_RESILIATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'MEMBER_DELETE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - - // Categories - elseif ($action == 'CATEGORY_CREATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'CATEGORY_MODIFY') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'CATEGORY_DELETE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - - // Projects - elseif ($action == 'PROJECT_CREATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'PROJECT_MODIFY') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'PROJECT_DELETE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'PROJECT_BUILDDOC') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - - // Project tasks - elseif ($action == 'TASK_CREATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'TASK_MODIFY') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'TASK_DELETE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - - // Task time spent - elseif ($action == 'TASK_TIMESPENT_CREATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'TASK_TIMESPENT_MODIFY') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'TASK_TIMESPENT_DELETE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - - // Shipping - elseif ($action == 'SHIPPING_CREATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'SHIPPING_MODIFY') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'SHIPPING_VALIDATE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'SHIPPING_SENTBYMAIL') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'SHIPPING_DELETE') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } - elseif ($action == 'SHIPPING_BUILDDOC') - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } + // Contracts + case 'CONTRACT_CREATE': + case 'CONTRACT_ACTIVATE': + case 'CONTRACT_CANCEL': + case 'CONTRACT_CLOSE': + case 'CONTRACT_DELETE': + case 'LINECONTRACT_CREATE': + case 'LINECONTRACT_UPDATE': + case 'LINECONTRACT_DELETE': - return 0; - } + // Bills + case 'BILL_CREATE': + case 'BILL_CLONE': + case 'BILL_MODIFY': + case 'BILL_VALIDATE': + case 'BILL_UNVALIDATE': + case 'BILL_SENTBYMAIL': + case 'BILL_CANCEL': + case 'BILL_DELETE': + case 'BILL_PAYED': + case 'LINEBILL_INSERT': + case 'LINEBILL_UPDATE': + case 'LINEBILL_DELETE': + + //Supplier Bill + case 'BILL_SUPPLIER_CREATE': + case 'BILL_SUPPLIER_UPDATE': + case 'BILL_SUPPLIER_DELETE': + case 'BILL_SUPPLIER_PAYED': + case 'BILL_SUPPLIER_UNPAYED': + case 'BILL_SUPPLIER_VALIDATE': + case 'LINEBILL_SUPPLIER_CREATE': + case 'LINEBILL_SUPPLIER_UPDATE': + case 'LINEBILL_SUPPLIER_DELETE': + + // Payments + case 'PAYMENT_CUSTOMER_CREATE': + case 'PAYMENT_SUPPLIER_CREATE': + case 'PAYMENT_ADD_TO_BANK': + case 'PAYMENT_DELETE': + + //Donation + case 'DON_CREATE': + case 'DON_UPDATE': + case 'DON_DELETE': + + // Interventions + case 'FICHINTER_CREATE': + case 'FICHINTER_MODIFY': + case 'FICHINTER_VALIDATE': + case 'FICHINTER_DELETE': + case 'LINEFICHINTER_CREATE': + case 'LINEFICHINTER_UPDATE': + case 'LINEFICHINTER_DELETE': + + // Members + case 'MEMBER_CREATE': + case 'MEMBER_VALIDATE': + case 'MEMBER_SUBSCRIPTION': + case 'MEMBER_MODIFY': + case 'MEMBER_NEW_PASSWORD': + case 'MEMBER_RESILIATE': + case 'MEMBER_DELETE': + + // Categories + case 'CATEGORY_CREATE': + case 'CATEGORY_MODIFY': + case 'CATEGORY_DELETE': + + // Projects + case 'PROJECT_CREATE': + case 'PROJECT_MODIFY': + case 'PROJECT_DELETE': + + // Project tasks + case 'TASK_CREATE': + case 'TASK_MODIFY': + case 'TASK_DELETE': + + // Task time spent + case 'TASK_TIMESPENT_CREATE': + case 'TASK_TIMESPENT_MODIFY': + case 'TASK_TIMESPENT_DELETE': + + // Shipping + case 'SHIPPING_CREATE': + case 'SHIPPING_MODIFY': + case 'SHIPPING_VALIDATE': + case 'SHIPPING_SENTBYMAIL': + case 'SHIPPING_DELETE': + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + break; + + } + + return 0; + } } -?> diff --git a/htdocs/cron/admin/index.html b/htdocs/cron/admin/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/cron/card.php b/htdocs/cron/card.php index a785b499642..84465cfd1c0 100644 --- a/htdocs/cron/card.php +++ b/htdocs/cron/card.php @@ -269,7 +269,7 @@ if ($action == 'execute'){ if (empty($object->status) && $action != 'create') { - dol_htmloutput_mesg($langs->trans("CronTaskInactive"),'','warning',1); + setEventMessage($langs->trans("CronTaskInactive"), 'warnings'); } if (($action=="create") || ($action=="edit")) diff --git a/htdocs/cron/class/cronjob.class.php b/htdocs/cron/class/cronjob.class.php index f1fc788a198..23313d27f13 100644 --- a/htdocs/cron/class/cronjob.class.php +++ b/htdocs/cron/class/cronjob.class.php @@ -224,7 +224,7 @@ class Cronjob extends CommonObject $this->db->begin(); - dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::create", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } @@ -309,7 +309,7 @@ class Cronjob extends CommonObject $sql.= " FROM ".MAIN_DB_PREFIX."cronjob as t"; $sql.= " WHERE t.rowid = ".$id; - dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -356,7 +356,6 @@ class Cronjob extends CommonObject else { $this->error="Error ".$this->db->lasterror(); - dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR); return -1; } } @@ -429,7 +428,7 @@ class Cronjob extends CommonObject $sql.= " WHERE ".implode(' AND ',$sqlwhere); } - dol_syslog(get_class($this)."::fetch_all sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetch_all", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -490,7 +489,6 @@ class Cronjob extends CommonObject else { $this->error="Error ".$this->db->lasterror(); - dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR); return -1; } } @@ -609,7 +607,7 @@ class Cronjob extends CommonObject $this->db->begin(); - dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } @@ -683,7 +681,7 @@ class Cronjob extends CommonObject $sql = "DELETE FROM ".MAIN_DB_PREFIX."cronjob"; $sql.= " WHERE rowid=".$this->id; - dol_syslog(get_class($this)."::delete sql=".$sql); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } } @@ -816,7 +814,7 @@ class Cronjob extends CommonObject $sql.= " FROM ".MAIN_DB_PREFIX."cronjob as f"; $sql.= " WHERE f.rowid = ".$this->id; - dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -836,7 +834,6 @@ class Cronjob extends CommonObject else { $this->error="Error ".$this->db->lasterror(); - dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR); return -1; } } diff --git a/htdocs/cron/class/index.html b/htdocs/cron/class/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/cron/index.html b/htdocs/cron/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/ecm/ajax/index.html b/htdocs/ecm/ajax/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/ecm/class/ecmdirectory.class.php b/htdocs/ecm/class/ecmdirectory.class.php index ea29d822102..52c698c240f 100644 --- a/htdocs/ecm/class/ecmdirectory.class.php +++ b/htdocs/ecm/class/ecmdirectory.class.php @@ -142,7 +142,7 @@ class EcmDirectory // extends CommonObject $sql.= " '".$this->fk_user_c."'"; $sql.= ")"; - dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::create", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -152,12 +152,10 @@ class EcmDirectory // extends CommonObject $result=dol_mkdir($dir); if ($result < 0) { $error++; $this->error="ErrorFailedToCreateDir"; } - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('MYECMDIR_CREATE',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('MYECMDIR_CREATE',$user); + if ($result < 0) { $error++; } + // End call triggers if (! $error) { @@ -173,7 +171,6 @@ class EcmDirectory // extends CommonObject else { $this->error="Error ".$this->db->lasterror(); - dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR); $this->db->rollback(); return -1; } @@ -210,23 +207,20 @@ class EcmDirectory // extends CommonObject $sql.= " description='".$this->db->escape($this->description)."'"; $sql.= " WHERE rowid=".$this->id; - dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $error++; $this->error="Error ".$this->db->lasterror(); - dol_syslog("EcmDirectories::update ".$this->error, LOG_ERR); } if (! $error && ! $notrigger) { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('MYECMDIR_MODIFY',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('MYECMDIR_MODIFY',$user); + if ($result < 0) { $error++; } + // End call triggers } if (! $error) @@ -257,12 +251,11 @@ class EcmDirectory // extends CommonObject $sql.= " cachenbofdoc = cachenbofdoc ".$sign." 1"; $sql.= " WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::changeNbOfFiles sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::changeNbOfFiles", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $this->error="Error ".$this->db->lasterror(); - dol_syslog(get_class($this)."::changeNbOfFiles ".$this->error, LOG_ERR); return -1; } @@ -291,7 +284,7 @@ class EcmDirectory // extends CommonObject $sql.= " FROM ".MAIN_DB_PREFIX."ecm_directories as t"; $sql.= " WHERE t.rowid = ".$id; - dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -318,7 +311,6 @@ class EcmDirectory // extends CommonObject else { $this->error="Error ".$this->db->lasterror(); - dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR); return -1; } } @@ -348,16 +340,26 @@ class EcmDirectory // extends CommonObject $sql = "DELETE FROM ".MAIN_DB_PREFIX."ecm_directories"; $sql.= " WHERE rowid=".$this->id; - dol_syslog(get_class($this)."::delete sql=".$sql); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $this->db->rollback(); $this->error="Error ".$this->db->lasterror(); - dol_syslog(get_class($this)."::delete ".$this->error, LOG_ERR); return -2; } - + else + { + // Call trigger + $result=$this->call_trigger('MYECMDIR_DELETE',$user); + if ($result < 0) + { + $this->db->rollback(); + return -2; + } + // End call triggers + } + if ($mode != 'databaseonly') { $file = $conf->ecm->dir_output . "/" . $relativepath; @@ -376,16 +378,6 @@ class EcmDirectory // extends CommonObject $error++; } - if (! $error) - { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('MYECMDIR_DELETE',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - // Fin appel triggers - } - if (! $error) return 1; else return -1; } @@ -499,7 +491,7 @@ class EcmDirectory // extends CommonObject $sql.= " WHERE fk_parent != 0"; $sql.= " AND entity = ".$conf->entity; - dol_syslog(get_class($this)."::load_motherof sql=".$sql); + dol_syslog(get_class($this)."::load_motherof", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -563,7 +555,7 @@ class EcmDirectory // extends CommonObject $sql.= " AND c.entity = ".$conf->entity; $sql.= " ORDER BY c.label, c.rowid"; - dol_syslog(get_class($this)."::get_full_arbo sql=".$sql); + dol_syslog(get_class($this)."::get_full_arbo", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -688,7 +680,7 @@ class EcmDirectory // extends CommonObject $sql.= " WHERE entity = ".$conf->entity; } - dol_syslog(get_class($this)."::refreshcachenboffile sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::refreshcachenboffile", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -698,9 +690,41 @@ class EcmDirectory // extends CommonObject else { $this->error="Error ".$this->db->lasterror(); - dol_syslog(get_class($this)."::refreshcachenboffile ".$this->error, LOG_ERR); return -1; } } + + /** + * Call trigger based on this instance + * + * NB: Error from trigger are stacked in errors + * NB2: if trigger fail, action should be canceled. + * NB3: Should be deleted if EcmDirectory extend CommonObject + * + * @param string $trigger_name trigger's name to execute + * @param User $user Object user + * @return int Result of run_triggers + */ + 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); + if ($result < 0) { + if (!empty($this->errors)) + { + $this->errors=array_merge($this->errors,$interface->errors); + } + else + { + $this->errors=$interface->errors; + } + } + return $result; + + } + } diff --git a/htdocs/ecm/class/index.html b/htdocs/ecm/class/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/ecm/index.php b/htdocs/ecm/index.php index e46011c45ba..8f9bd5573bf 100644 --- a/htdocs/ecm/index.php +++ b/htdocs/ecm/index.php @@ -110,8 +110,6 @@ if (GETPOST("sendit") && ! empty($conf->global->MAIN_UPLOAD_DOC)) $resupload = dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . dol_unescapefile($_FILES['userfile']['name']),0, 0, $_FILES['userfile']['error']); if (is_numeric($resupload) && $resupload > 0) { - //$mesg = '
'.$langs->trans("FileTransferComplete").'
'; - //print_r($_FILES); $result=$ecmdir->changeNbOfFiles('+'); } else @@ -134,7 +132,7 @@ if (GETPOST("sendit") && ! empty($conf->global->MAIN_UPLOAD_DOC)) else { $langs->load("errors"); - $mesg = '
'.$langs->trans("ErrorFailToCreateDir",$upload_dir).'
'; + setEventMessage($langs->trans("ErrorFailToCreateDir",$upload_dir), 'errors'); } } } @@ -156,7 +154,7 @@ if ($action == 'add' && $user->rights->ecm->setup) } else { - $mesg='
Error '.$langs->trans($ecmdir->error).'
'; + setEventMessage('Error '.$langs->trans($ecmdir->error), 'errors'); $action = "create"; } @@ -198,7 +196,7 @@ if ($action == 'confirm_deletefile') if ($action == 'confirm_deletesection' && GETPOST('confirm') == 'yes') { $result=$ecmdir->delete($user); - $mesg = '
'.$langs->trans("ECMSectionWasRemoved", $ecmdir->label).'
'; + setEventMessage($langs->trans("ECMSectionWasRemoved", $ecmdir->label)); clearstatcache(); } @@ -324,7 +322,6 @@ if ($action == 'refreshmanual') $dirtotest=$conf->ecm->dir_output.'/'.$dirdesc['fullrelativename']; if (! dol_is_dir($dirtotest)) { - $mesg.=$dirtotest." not found onto disk. We delete from database dir with id=".$dirdesc['id']."
\n"; $ecmdirtmp->id=$dirdesc['id']; $ecmdirtmp->delete($user,'databaseonly'); //exit; @@ -440,9 +437,6 @@ if ($action == 'delete' && empty($conf->use_javascript_ajax)) } -dol_htmloutput_mesg($mesg); - - if (! empty($conf->use_javascript_ajax)) $classviewhide='hidden'; else $classviewhide='visible'; diff --git a/htdocs/ecm/index_auto.php b/htdocs/ecm/index_auto.php index 9c4ab7e0e2f..7d0fc5c64bf 100644 --- a/htdocs/ecm/index_auto.php +++ b/htdocs/ecm/index_auto.php @@ -110,8 +110,6 @@ if (GETPOST("sendit") && ! empty($conf->global->MAIN_UPLOAD_DOC)) $resupload = dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . dol_unescapefile($_FILES['userfile']['name']),0, 0, $_FILES['userfile']['error']); if (is_numeric($resupload) && $resupload > 0) { - //$mesg = '
'.$langs->trans("FileTransferComplete").'
'; - //print_r($_FILES); $result=$ecmdir->changeNbOfFiles('+'); } else @@ -134,7 +132,7 @@ if (GETPOST("sendit") && ! empty($conf->global->MAIN_UPLOAD_DOC)) else { $langs->load("errors"); - $mesg = '
'.$langs->trans("ErrorFailToCreateDir",$upload_dir).'
'; + setEventMessage($langs->trans("ErrorFailToCreateDir",$upload_dir), 'errors'); } } } @@ -156,7 +154,8 @@ if ($action == 'add' && $user->rights->ecm->setup) } else { - $mesg='
Error '.$langs->trans($ecmdir->error).'
'; + //TODO: Translate + setEventMessage('Error '.$langs->trans($ecmdir->error), 'errors'); $action = "create"; } @@ -198,7 +197,7 @@ if ($action == 'confirm_deletefile') if ($action == 'confirm_deletesection' && GETPOST('confirm') == 'yes') { $result=$ecmdir->delete($user); - $mesg = '
'.$langs->trans("ECMSectionWasRemoved", $ecmdir->label).'
'; + setEventMessage($langs->trans("ECMSectionWasRemoved", $ecmdir->label)); clearstatcache(); } @@ -324,7 +323,6 @@ if ($action == 'refreshmanual') $dirtotest=$conf->ecm->dir_output.'/'.$dirdesc['fullrelativename']; if (! dol_is_dir($dirtotest)) { - $mesg.=$dirtotest." not found onto disk. We delete from database dir with id=".$dirdesc['id']."
\n"; $ecmdirtmp->id=$dirdesc['id']; $ecmdirtmp->delete($user,'databaseonly'); //exit; @@ -411,6 +409,9 @@ if (! empty($conf->global->ECM_AUTO_TREE_ENABLED)) 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)) { $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")); + } print_fiche_titre($langs->trans("ECMArea").' - '.$langs->trans("ECMFileManager")); @@ -436,9 +437,6 @@ if ($action == 'delete' && empty($conf->use_javascript_ajax)) } -dol_htmloutput_mesg($mesg); - - if (! empty($conf->use_javascript_ajax)) $classviewhide='hidden'; else $classviewhide='visible'; diff --git a/htdocs/ecm/tpl/index.html b/htdocs/ecm/tpl/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 93c7f63b4ad..8a5d6b7b73e 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -227,7 +227,7 @@ class Expedition extends CommonObject $sql.= ", ".(!empty($this->model_pdf)?"'".$this->db->escape($this->model_pdf)."'":"null"); $sql.= ")"; - dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::create", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -237,7 +237,7 @@ class Expedition extends CommonObject $sql.= " SET ref = '(PROV".$this->id.")'"; $sql.= " WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::create", LOG_DEBUG); if ($this->db->query($sql)) { // Insertion des lignes @@ -275,12 +275,10 @@ class Expedition extends CommonObject if (! $error) { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT.'/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('SHIPPING_CREATE',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('SHIPPING_CREATE',$user); + if ($result < 0) { $error++; } + // End call triggers if (! $error) { @@ -348,7 +346,7 @@ class Expedition extends CommonObject $sql.= ", ".$qty; $sql.= ")"; - dol_syslog(get_class($this)."::create_line sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::create_line", LOG_DEBUG); if (! $this->db->query($sql)) { $error++; @@ -413,7 +411,7 @@ class Expedition extends CommonObject if ($ref_ext) $sql.= " AND e.ref_ext='".$this->db->escape($ref_ext)."'"; if ($ref_int) $sql.= " AND e.ref_int='".$this->db->escape($ref_int)."'"; - dol_syslog(get_class($this)."::fetch sql=".$sql); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { @@ -487,14 +485,13 @@ class Expedition extends CommonObject } else { - dol_syslog(get_class($this).'::Fetch Error -2'); + dol_syslog(get_class($this).'::Fetch Error -2', LOG_ERR); $this->error='Delivery with id '.$id.' not found sql='.$sql; return -2; } } else { - dol_syslog(get_class($this).'::Fetch Error -1'); $this->error=$this->db->error(); return -1; } @@ -559,11 +556,10 @@ class Expedition extends CommonObject $sql.= ", fk_user_valid = ".$user->id; $sql.= " WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::valid update expedition sql=".$sql); + dol_syslog(get_class($this)."::valid update expedition", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) { - dol_syslog(get_class($this)."::valid Echec update - 10 - sql=".$sql, LOG_ERR); $this->error=$this->db->lasterror(); $error++; } @@ -583,13 +579,15 @@ class Expedition extends CommonObject $sql.= " WHERE ed.fk_expedition = ".$this->id; $sql.= " AND cd.rowid = ed.fk_origin_line"; - dol_syslog(get_class($this)."::valid select details sql=".$sql); + dol_syslog(get_class($this)."::valid select details", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { $cpt = $this->db->num_rows($resql); for ($i = 0; $i < $cpt; $i++) { + if($obj->qty <= 0) continue; + dol_syslog(get_class($this)."::valid movement index ".$i); $obj = $this->db->fetch_object($resql); @@ -614,7 +612,6 @@ class Expedition extends CommonObject { $this->db->rollback(); $this->error=$this->db->error(); - dol_syslog(get_class($this)."::valid ".$this->error, LOG_ERR); return -2; } } @@ -657,12 +654,10 @@ class Expedition extends CommonObject if (! $error) { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT.'/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('SHIPPING_VALIDATE',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('SHIPPING_VALIDATE',$user); + if ($result < 0) { $error++; } + // End call triggers } if (! $error) @@ -860,7 +855,7 @@ class Expedition extends CommonObject $this->db->begin(); - dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } @@ -868,12 +863,10 @@ class Expedition extends CommonObject { if (! $notrigger) { - // Call triggers - include_once DOL_DOCUMENT_ROOT.'/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('SHIPPING_MODIFY',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - // End call triggers + // Call trigger + $result=$this->call_trigger('SHIPPING_MODIFY',$user); + if ($result < 0) { $error++; } + // End call triggers } } @@ -936,7 +929,7 @@ class Expedition extends CommonObject $sql.= " WHERE ed.fk_expedition = ".$this->id; $sql.= " AND cd.rowid = ed.fk_origin_line"; - dol_syslog(get_class($this)."::delete select details sql=".$sql); + dol_syslog(get_class($this)."::delete select details", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -983,12 +976,10 @@ class Expedition extends CommonObject if ($this->db->query($sql)) { - // Call triggers - include_once DOL_DOCUMENT_ROOT.'/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('SHIPPING_DELETE',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - // End call triggers + // Call trigger + $result=$this->call_trigger('SHIPPING_DELETE',$user); + if ($result < 0) { $error++; } + // End call triggers if (! $error) { @@ -1075,8 +1066,9 @@ class Expedition extends CommonObject $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = cd.fk_product"; $sql.= " WHERE ed.fk_expedition = ".$this->id; $sql.= " AND ed.fk_origin_line = cd.rowid"; + $sql.= " ORDER BY cd.rang"; - dol_syslog(get_class($this)."::fetch_lines sql=".$sql); + dol_syslog(get_class($this)."::fetch_lines", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -1158,7 +1150,6 @@ class Expedition extends CommonObject else { $this->error=$this->db->error(); - dol_syslog(get_class($this).'::fetch_lines: Error '.$this->error, LOG_ERR); return -3; } } @@ -1342,7 +1333,7 @@ class Expedition extends CommonObject $sql.= " SET date_delivery = ".($date_livraison ? "'".$this->db->idate($date_livraison)."'" : 'null'); $sql.= " WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::set_date_livraison sql=".$sql,LOG_DEBUG); + dol_syslog(get_class($this)."::set_date_livraison", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -1352,7 +1343,6 @@ class Expedition extends CommonObject else { $this->error=$this->db->error(); - dol_syslog(get_class($this)."::set_date_livraison ".$this->error,LOG_ERR); return -1; } } diff --git a/htdocs/expedition/class/expeditionbatch.class.php b/htdocs/expedition/class/expeditionbatch.class.php index 7bbd99706bd..62d23aaa7ff 100644 --- a/htdocs/expedition/class/expeditionbatch.class.php +++ b/htdocs/expedition/class/expeditionbatch.class.php @@ -69,7 +69,7 @@ class ExpeditionLigneBatch extends CommonObject $sql.= MAIN_DB_PREFIX."product_stock as e on t.fk_product_stock=e.rowid "; $sql.= " WHERE t.rowid = ".(int) $id_stockdluo; - dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -91,7 +91,6 @@ class ExpeditionLigneBatch extends CommonObject else { $this->error="Error ".$this->db->lasterror(); - dol_syslog(__METHOD__ .$this->error, LOG_ERR); return -1; } } @@ -123,7 +122,7 @@ class ExpeditionLigneBatch extends CommonObject $sql.= " ".(! isset($this->fk_origin_stock)?'NULL':$this->fk_origin_stock); $sql.= ")"; - dol_syslog(__METHOD__ ." sql=".$sql, LOG_DEBUG); + dol_syslog(__METHOD__ ."", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } @@ -157,7 +156,7 @@ class ExpeditionLigneBatch extends CommonObject $sql="DELETE FROM ".MAIN_DB_PREFIX.self::$_table_element; $sql.=" WHERE fk_expeditiondet in (SELECT rowid FROM ".MAIN_DB_PREFIX."expeditiondet WHERE fk_expedition=".$id_expedition.")"; - dol_syslog(__METHOD__ ." sql=".$sql, LOG_DEBUG); + dol_syslog(__METHOD__ ."", LOG_DEBUG); if ( $db->query($sql) ) { return 1; @@ -185,7 +184,7 @@ class ExpeditionLigneBatch extends CommonObject $sql.= " FROM ".MAIN_DB_PREFIX.self::$_table_element; $sql.= " WHERE fk_expeditiondet=".(int) $id_line_expdet; - dol_syslog(__METHOD__ ." sql=".$sql, LOG_DEBUG); + dol_syslog(__METHOD__ ."", LOG_DEBUG); $resql=$db->query($sql); if ($resql) { diff --git a/htdocs/expedition/class/index.html b/htdocs/expedition/class/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/expedition/contact.php b/htdocs/expedition/contact.php index facca267160..49b83692630 100644 --- a/htdocs/expedition/contact.php +++ b/htdocs/expedition/contact.php @@ -87,15 +87,14 @@ if ($action == 'addcontact' && $user->rights->expedition->creer) } else { - if ($objectsrc->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') - { + if ($objectsrc->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $langs->load("errors"); - $mesg = '
'.$langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType").'
'; - } - else - { - $mesg = '
'.$objectsrc->error.'
'; + $mesg = $langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"); + } else { + $mesg = $objectsrc->error; } + + setEventMessage($mesg, 'errors'); } } @@ -146,7 +145,6 @@ $userstatic=new User($db); /* Mode vue et edition */ /* */ /* *************************************************************************** */ -dol_htmloutput_mesg($mesg); if ($id > 0 || ! empty($ref)) { diff --git a/htdocs/expedition/fiche.php b/htdocs/expedition/fiche.php index 9a52ce47788..406ba0ebc5d 100644 --- a/htdocs/expedition/fiche.php +++ b/htdocs/expedition/fiche.php @@ -163,7 +163,7 @@ if ($action == 'add') { $qty = "qtyl".$i; if (! isset($batch_line[$i])) { - if (GETPOST($qty,'int') > 0) + if (GETPOST($qty,'int') > 0 || (GETPOST($qty,'int') == 0 && $conf->global->SHIPMENT_GETS_ALL_ORDER_PRODUCTS)) { $ent = "entl".$i; $idl = "idl".$i; @@ -241,26 +241,34 @@ else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->exped $object->fetch_thirdparty(); $result = $object->valid($user); - - // 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->client->default_lang; - if (! empty($newlang)) - { - $outputlangs = new Translate("",$conf); - $outputlangs->setDefaultLang($newlang); - } - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) - { - $ret=$object->fetch($id); // Reload to get new records - $result=expedition_pdf_create($db,$object,$object->modelpdf,$outputlangs); - } + if ($result < 0) { - dol_print_error($db,$result); - exit; + $langs->load("errors"); + setEventMessage($langs->trans($object->error),'errors'); + } + else + { + // 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->client->default_lang; + if (! empty($newlang)) + { + $outputlangs = new Translate("",$conf); + $outputlangs->setDefaultLang($newlang); + } + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) + { + $ret=$object->fetch($id); // Reload to get new records + $result=expedition_pdf_create($db,$object,$object->modelpdf,$outputlangs); + } + if ($result < 0) + { + dol_print_error($db,$result); + exit; + } } } @@ -1573,21 +1581,25 @@ else if ($id || $ref) include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; $fileparams = dol_most_recent_file($conf->expedition->dir_output . '/sending/' . $ref, preg_quote($ref,'/')); $file=$fileparams['fullname']; + + // Define output language + $outputlangs = $langs; + $newlang = ''; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) + $newlang = $_REQUEST['lang_id']; + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) + $newlang = $object->client->default_lang; + + if (!empty($newlang)) + { + $outputlangs = new Translate('', $conf); + $outputlangs->setDefaultLang($newlang); + $outputlangs->load('sendings'); + } // Build document if it not exists if (! $file || ! is_readable($file)) { - // Define output language - $outputlangs = $langs; - $newlang=''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id']; - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang; - if (! empty($newlang)) - { - $outputlangs = new Translate("",$conf); - $outputlangs->setDefaultLang($newlang); - } - $result=expedition_pdf_create($db, $object, GETPOST('model')?GETPOST('model'):$object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); if ($result <= 0) { @@ -1604,6 +1616,7 @@ else if ($id || $ref) // Cree l'objet formulaire mail 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); @@ -1614,7 +1627,7 @@ else if ($id || $ref) $formmail->withto=GETPOST("sendto")?GETPOST("sendto"):$liste; $formmail->withtocc=$liste; $formmail->withtoccc=$conf->global->MAIN_EMAIL_USECCC; - $formmail->withtopic=$langs->trans('SendShippingRef','__SHIPPINGREF__'); + $formmail->withtopic=$outputlangs->trans('SendShippingRef','__SHIPPINGREF__'); $formmail->withfile=2; $formmail->withbody=1; $formmail->withdeliveryreceipt=1; diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index fce9c3bf6a5..0ad306ef8a3 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -116,6 +116,13 @@ if ($action == 'setconditions' && $user->rights->commande->creer) if ($result < 0) dol_print_error($db,$commande->error); } +// shipping method +if ($action == 'setshippingmethod' && $user->rights->commande->creer) { + $commande = new Commande($db); + $commande->fetch($id); + $result=$commande->setShippingMethod(GETPOST('shipping_method_id', 'int')); +} + /* @@ -262,6 +269,23 @@ if ($id > 0 || ! empty($ref)) print ''; print '
'; + // Shipping Method + print ''; + print ''; + // Terms of payment print '"; + print ''; if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) @@ -1318,196 +1334,199 @@ else if ($id > 0 || ! empty($ref)) include DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php'; } - - - print '
'; - print ''; - print ''; - if ($action == 'editline') - { - print ''; - print ''; - } - else - { - print ''; - } - - // Intervention lines - $sql = 'SELECT ft.rowid, ft.description, ft.fk_fichinter, ft.duree, ft.rang,'; - $sql.= ' ft.date as date_intervention'; - $sql.= ' FROM '.MAIN_DB_PREFIX.'fichinterdet as ft'; - $sql.= ' WHERE ft.fk_fichinter = '.$object->id; - $sql.= ' ORDER BY ft.rang ASC, ft.rowid'; - - $resql = $db->query($sql); - if ($resql) - { - $num = $db->num_rows($resql); - $i = 0; - - if ($num) + if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) + { + print ''; + print ''; + print ''; + if ($action == 'editline') { - print ''; - - print ''; - print ''; - print ''; - print ''; - print ''; - print "\n"; + print ''; + print ''; } - $var=true; - while ($i < $num) + else { - $objp = $db->fetch_object($resql); - $var=!$var; + print ''; + } - // Ligne en mode visu - if ($action != 'editline' || GETPOST('line_id','int') != $objp->rowid) + // Intervention lines + $sql = 'SELECT ft.rowid, ft.description, ft.fk_fichinter, ft.duree, ft.rang,'; + $sql.= ' ft.date as date_intervention'; + $sql.= ' FROM '.MAIN_DB_PREFIX.'fichinterdet as ft'; + $sql.= ' WHERE ft.fk_fichinter = '.$object->id; + $sql.= ' ORDER BY ft.rang ASC, ft.rowid'; + + $resql = $db->query($sql); + if ($resql) + { + $num = $db->num_rows($resql); + $i = 0; + + if ($num) { - print ''; - print '
'.$langs->trans('Description').''.$langs->trans('Date').''.$langs->trans('Duration').' 
'; - print ''; // ancre pour retourner sur la ligne - print dol_htmlentitiesbr($objp->description); + print '
'; + print ''; - // Date - print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print "\n"; + } + $var=true; + while ($i < $num) + { + $objp = $db->fetch_object($resql); + $var=!$var; - // Duration - print ''; - - print "\n"; - - - // Icone d'edition et suppression - if ($object->statut == 0 && $user->rights->ficheinter->creer) + // Ligne en mode visu + if ($action != 'editline' || GETPOST('line_id','int') != $objp->rowid) { - print ''; - print ''; - if ($num > 1) + print ''; + print ''; + + // Duration + print ''; + + print "\n"; + + + // Icone d'edition et suppression + if ($object->statut == 0 && $user->rights->ficheinter->creer) { print ''; + print ''; + if ($num > 1) + { + print ''; + } } - } - else - { - print ''; + else + { + print ''; + } + + print ''; } - print ''; + // Line in update mode + if ($object->statut == 0 && $action == 'editline' && $user->rights->ficheinter->creer && GETPOST('line_id','int') == $objp->rowid) + { + print ''; + print ''; + + // Date d'intervention + print ''; + + // Duration + print ''; + + print ''; + print '' . "\n"; + } + + $i++; } - // Line in update mode - if ($object->statut == 0 && $action == 'editline' && $user->rights->ficheinter->creer && GETPOST('line_id','int') == $objp->rowid) - { - print ''; - print '
'.dol_print_date($db->jdate($objp->date_intervention),'dayhour').'
'.$langs->trans('Description').''.$langs->trans('Date').''.$langs->trans('Duration').' 
'.convertSecondToTime($objp->duree).''; - print 'rowid.'#'.$objp->rowid.'">'; - print img_edit(); - print ''; - print ''; - print 'rowid.'">'; - print img_delete(); - print '
'; + print ''; // ancre pour retourner sur la ligne + print dol_htmlentitiesbr($objp->description); + + // Date + print ''.dol_print_date($db->jdate($objp->date_intervention),'dayhour').''.convertSecondToTime($objp->duree).''; - if ($i > 0) - { - print 'rowid.'">'; - print img_up(); - print ''; - } - if ($i < $num-1) - { - print 'rowid.'">'; - print img_down(); - print ''; - } + print 'rowid.'#'.$objp->rowid.'">'; + print img_edit(); + print ''; print ''; + print 'rowid.'">'; + print img_delete(); + print ''; + if ($i > 0) + { + print 'rowid.'">'; + print img_up(); + print ''; + } + if ($i < $num-1) + { + print 'rowid.'">'; + print img_down(); + print ''; + } + print '  
'; + print ''; // ancre pour retourner sur la ligne + + // Editeur wysiwyg + require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; + $doleditor=new DolEditor('np_desc',$objp->description,'',164,'dolibarr_details','',false,true,$conf->global->FCKEDITOR_ENABLE_DETAILS,ROWS_2,70); + $doleditor->Create(); + print ''; + $form->select_date($db->jdate($objp->date_intervention),'di',1,1,0,"date_intervention"); + print ''; + $form->select_duration('duration',$objp->duree); + print ''; + print '
'; - print ''; // ancre pour retourner sur la ligne + $db->free($resql); - // Editeur wysiwyg + // Add new line + if ($object->statut == 0 && $user->rights->ficheinter->creer && $action <> 'editline' && empty($conf->global->FICHINTER_DISABLE_DETAILS)) + { + if (! $num) print '
'; + + print ''; + print ''; + print ''; + print ''; + + print ''; + print "\n"; + + $var=false; + + print '\n"; + print ''; - // Date d'intervention + // Date intervention print ''; // Duration print ''; - print ''; - print '' . "\n"; + print ''; + print ''; + + if (! $num) print '
'; + print ''; // ancre + print $langs->trans('Description').''.$langs->trans('Date').''.$langs->trans('Duration').' 
'; + // editeur wysiwyg require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor=new DolEditor('np_desc',$objp->description,'',164,'dolibarr_details','',false,true,$conf->global->FCKEDITOR_ENABLE_DETAILS,ROWS_2,70); + $doleditor=new DolEditor('np_desc',GETPOST('np_desc','alpha'),'',100,'dolibarr_details','',false,true,$conf->global->FCKEDITOR_ENABLE_DETAILS,ROWS_2,70); $doleditor->Create(); print ''; - $form->select_date($db->jdate($objp->date_intervention),'di',1,1,0,"date_intervention"); + $now=dol_now(); + $timearray=dol_getdate($now); + if (! GETPOST('diday','int')) $timewithnohour=dol_mktime(0,0,0,$timearray['mon'],$timearray['mday'],$timearray['year']); + else $timewithnohour=dol_mktime(GETPOST('dihour','int'),GETPOST('dimin','int'), 0,GETPOST('dimonth','int'),GETPOST('diday','int'),GETPOST('diyear','int')); + $form->select_date($timewithnohour,'di',1,1,0,"addinter"); print ''; - $form->select_duration('duration',$objp->duree); + $selectmode='select'; + if (! empty($conf->global->INTERVENTION_ADDLINE_FREEDUREATION)) $selectmode='text'; + $form->select_duration('duration', (!GETPOST('durationhour','int') && !GETPOST('durationmin','int'))?3600:(60*60*GETPOST('durationhour','int')+60*GETPOST('durationmin','int')), 0, $selectmode, 1); print ''; - print '
'; } - $i++; + if ($num) print '
'; } - - $db->free($resql); - - // Add new line - if ($object->statut == 0 && $user->rights->ficheinter->creer && $action <> 'editline') + else { - if (! $num) print '
'; - - print ''; - print ''; - print ''; - print ''; - - print ''; - print "\n"; - - $var=false; - - print '\n"; - print ''; - - // Date intervention - print ''; - - // Duration - print ''; - - print ''; - print ''; - - if (! $num) print '
'; - print ''; // ancre - print $langs->trans('Description').''.$langs->trans('Date').''.$langs->trans('Duration').' 
'; - // editeur wysiwyg - require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor=new DolEditor('np_desc',GETPOST('np_desc','alpha'),'',100,'dolibarr_details','',false,true,$conf->global->FCKEDITOR_ENABLE_DETAILS,ROWS_2,70); - $doleditor->Create(); - print ''; - $now=dol_now(); - $timearray=dol_getdate($now); - if (! GETPOST('diday','int')) $timewithnohour=dol_mktime(0,0,0,$timearray['mon'],$timearray['mday'],$timearray['year']); - else $timewithnohour=dol_mktime(GETPOST('dihour','int'),GETPOST('dimin','int'), 0,GETPOST('dimonth','int'),GETPOST('diday','int'),GETPOST('diyear','int')); - $form->select_date($timewithnohour,'di',1,1,0,"addinter"); - print ''; - $selectmode='select'; - if (! empty($conf->global->INTERVENTION_ADDLINE_FREEDUREATION)) $selectmode='text'; - $form->select_duration('duration', (!GETPOST('durationhour','int') && !GETPOST('durationmin','int'))?3600:(60*60*GETPOST('durationhour','int')+60*GETPOST('durationmin','int')), 0, $selectmode, 1); - print '
'; + dol_print_error($db); } - if ($num) print '
'; - } - else - { - dol_print_error($db); - } + print '
'."\n"; + } - print ''."\n"; + dol_fiche_end(); - print ''; print "\n"; @@ -1521,14 +1540,14 @@ else if ($id > 0 || ! empty($ref)) if ($action != 'editdescription' && ($action != 'presend')) { // Validate - if ($object->statut == 0 && $user->rights->ficheinter->creer && count($object->lines) > 0) + if ($object->statut == 0 && $user->rights->ficheinter->creer && (count($object->lines) > 0 || ! empty($conf->global->FICHINTER_DISABLE_DETAILS))) { print ''; } // Modify - if ($object->statut == 1 && $user->rights->ficheinter->creer) + if ($object->statut == 1 && $user->rights->ficheinter->creer && empty($conf->global->FICHINTER_DISABLE_DETAILS)) { print ''; @@ -1544,6 +1563,17 @@ else if ($id > 0 || ! empty($ref)) else print ''; } + // Proposal + if (! empty($conf->propal->enabled) && $object->statut > 0) + { + $langs->load("propal"); + if ($object->statut < 2) + { + if ($user->rights->propal->creer) print ''; + else print ''; + } + } + // Invoicing if (! empty($conf->facture->enabled) && $object->statut > 0) { @@ -1560,6 +1590,10 @@ else if ($id > 0 || ! empty($ref)) { print ''; } + else + { + print ''; + } } } @@ -1583,7 +1617,7 @@ else if ($id > 0 || ! empty($ref)) /* * Built documents - */ + */ $filename=dol_sanitizeFileName($object->ref); $filedir=$conf->ficheinter->dir_output . "/".$object->ref; $urlsource=$_SERVER["PHP_SELF"]."?id=".$object->id; @@ -1617,7 +1651,7 @@ else if ($id > 0 || ! empty($ref)) /* * Action presend - */ + */ if ($action == 'presend') { $ref = dol_sanitizeFileName($object->ref); @@ -1625,20 +1659,24 @@ else if ($id > 0 || ! empty($ref)) $fileparams = dol_most_recent_file($conf->ficheinter->dir_output . '/' . $ref, preg_quote($ref,'/')); $file=$fileparams['fullname']; + // Define output language + $outputlangs = $langs; + $newlang = ''; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) + $newlang = $_REQUEST['lang_id']; + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) + $newlang = $object->client->default_lang; + + if (!empty($newlang)) + { + $outputlangs = new Translate('', $conf); + $outputlangs->setDefaultLang($newlang); + $outputlangs->load('interventions'); + } + // Build document if it not exists if (! $file || ! is_readable($file)) { - // Define output language - $outputlangs = $langs; - $newlang=''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id']; - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang; - if (! empty($newlang)) - { - $outputlangs = new Translate("",$conf); - $outputlangs->setDefaultLang($newlang); - } - $result=fichinter_create($db, $object, GETPOST('model')?GETPOST('model'):$object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); if ($result <= 0) { @@ -1655,6 +1693,7 @@ else if ($id > 0 || ! empty($ref)) // Create form object 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); @@ -1665,7 +1704,7 @@ else if ($id > 0 || ! empty($ref)) $formmail->withto=GETPOST("sendto")?GETPOST("sendto"):$liste; $formmail->withtocc=$liste; $formmail->withtoccc=$conf->global->MAIN_EMAIL_USECCC; - $formmail->withtopic=$langs->trans('SendInterventionRef','__FICHINTERREF__'); + $formmail->withtopic=$outputlangs->trans('SendInterventionRef','__FICHINTERREF__'); $formmail->withfile=2; $formmail->withbody=1; $formmail->withdeliveryreceipt=1; diff --git a/htdocs/fichinter/index.html b/htdocs/fichinter/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/fichinter/index.php b/htdocs/fichinter/index.php deleted file mode 100644 index 7db0dd9ebf9..00000000000 --- a/htdocs/fichinter/index.php +++ /dev/null @@ -1 +0,0 @@ -Url not available \ No newline at end of file diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index aa18223c0c5..6a730dbe046 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2011-2012 Juanjo Menent * Copyright (C) 2013 Cédric Salvador @@ -108,8 +108,11 @@ if ($result) print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","",$urlparam,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Description"),$_SERVER["PHP_SELF"],"f.description","",$urlparam,'',$sortfield,$sortorder); print_liste_field_titre('',$_SERVER["PHP_SELF"],''); - print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"fd.date","",$urlparam,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Duration"),$_SERVER["PHP_SELF"],"fd.duree","",$urlparam,'align="right"',$sortfield,$sortorder); + if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) + { + print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"fd.date","",$urlparam,'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Duration"),$_SERVER["PHP_SELF"],"fd.duree","",$urlparam,'align="right"',$sortfield,$sortorder); + } print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"f.fk_statut","",$urlparam,'align="right"',$sortfield,$sortorder); print "
     
'.dol_htmlentitiesbr(dol_trunc($objp->description,20)).''.dol_htmlentitiesbr(dol_trunc($objp->descriptiondetail,20)).''.dol_print_date($db->jdate($objp->dp),'dayhour')."'.convertSecondToTime($objp->duree).''.dol_print_date($db->jdate($objp->dp),'dayhour')."'.convertSecondToTime($objp->duree).''.$interventionstatic->LibStatut($objp->fk_statut,5).'
'.$langs->trans("Total").''.convertSecondToTime($total).' 
'.$langs->trans("Total").''.convertSecondToTime($total).' 
'; print "\n"; diff --git a/htdocs/fichinter/note.php b/htdocs/fichinter/note.php index d263620ae47..3c5fce7caa2 100644 --- a/htdocs/fichinter/note.php +++ b/htdocs/fichinter/note.php @@ -60,8 +60,6 @@ $form = new Form($db); if ($id > 0 || ! empty($ref)) { - dol_htmloutput_mesg($mesg); - $societe = new Societe($db); if ($societe->fetch($object->socid)) { diff --git a/htdocs/fichinter/tpl/index.html b/htdocs/fichinter/tpl/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index b927b0016e8..6f8a2bb9b2c 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -29,7 +29,7 @@ * \brief File that include conf.php file and commons lib like functions.lib.php */ -if (! defined('DOL_VERSION')) define('DOL_VERSION','3.6.0'); +if (! defined('DOL_VERSION')) define('DOL_VERSION','3.7.0-alpha'); if (! defined('EURO')) define('EURO',chr(128)); // Define syslog constants @@ -92,7 +92,7 @@ if (! empty($dolibarr_main_prod)) ini_set('display_errors','Off'); // Clean parameters $dolibarr_main_data_root=trim($dolibarr_main_data_root); -$dolibarr_main_url_root=trim($dolibarr_main_url_root); +$dolibarr_main_url_root=trim(preg_replace('/\/+$/','',$dolibarr_main_url_root)); $dolibarr_main_url_root_alt=(empty($dolibarr_main_url_root_alt)?'':trim($dolibarr_main_url_root_alt)); $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)); diff --git a/htdocs/fourn/ajax/getSupplierPrices.php b/htdocs/fourn/ajax/getSupplierPrices.php index bbe3aeba4dc..fc891af53a3 100644 --- a/htdocs/fourn/ajax/getSupplierPrices.php +++ b/htdocs/fourn/ajax/getSupplierPrices.php @@ -58,7 +58,7 @@ if (! empty($idprod)) $sql.= " AND s.fournisseur = 1"; $sql.= " ORDER BY s.nom, pfp.ref_fourn DESC"; - dol_syslog("Ajax::getSupplierPrices sql=".$sql, LOG_DEBUG); + dol_syslog("Ajax::getSupplierPrices", LOG_DEBUG); $result=$db->query($sql); if ($result) diff --git a/htdocs/fourn/ajax/index.html b/htdocs/fourn/ajax/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/fourn/class/fournisseur.class.php b/htdocs/fourn/class/fournisseur.class.php index f557573fdfc..71942a27f97 100644 --- a/htdocs/fourn/class/fournisseur.class.php +++ b/htdocs/fourn/class/fournisseur.class.php @@ -157,7 +157,7 @@ class Fournisseur extends Societe $sql.= " VALUES "; $sql.= " ('".$this->db->escape($name)."',1,1)"; - dol_syslog("Fournisseur::CreateCategory sql=".$sql); + dol_syslog("Fournisseur::CreateCategory", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index f083318948e..42ed12b1472 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -3,8 +3,8 @@ * Copyright (C) 2004-2012 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2007 Franky Van Liedekerke - * Copyright (C) 2010-2013 Juanjo Menent - * Copyright (C) 2010-2013 Philippe Grand + * Copyright (C) 2010-2014 Juanjo Menent + * Copyright (C) 2010-2014 Philippe Grand * Copyright (C) 2012 Marcos García * Copyright (C) 2013 Florian Henry * Copyright (C) 2013 Cédric Salvador @@ -74,6 +74,7 @@ class CommandeFournisseur extends CommonOrder 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; @@ -126,6 +127,7 @@ class CommandeFournisseur extends CommonOrder $sql.= " c.date_creation, c.date_valid, c.date_approve,"; $sql.= " c.fk_user_author, c.fk_user_valid, c.fk_user_approve,"; $sql.= " c.date_commande as date_commande, c.date_livraison as date_livraison, c.fk_cond_reglement, c.fk_mode_reglement, c.fk_projet as fk_project, c.remise_percent, c.source, c.fk_input_method,"; + $sql.= " c.fk_account,"; $sql.= " c.note_private, c.note_public, c.model_pdf, c.extraparams,"; $sql.= " cm.libelle as methode_commande,"; $sql.= " cr.code as cond_reglement_code, cr.libelle as cond_reglement_libelle,"; @@ -138,14 +140,14 @@ class CommandeFournisseur extends CommonOrder if ($ref) $sql.= " AND c.ref='".$ref."'"; else $sql.= " AND c.rowid=".$id; - dol_syslog(get_class($this)."::fetch sql=".$sql,LOG_DEBUG); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { $obj = $this->db->fetch_object($resql); if (! $obj) { - $this->error='Bill with id '.$id.' not found sql='.$sql; + $this->error='Bill with id '.$id.' not found'; dol_syslog(get_class($this).'::fetch '.$this->error); return 0; } @@ -180,6 +182,7 @@ class CommandeFournisseur extends CommonOrder $this->cond_reglement_code = $obj->cond_reglement_code; $this->cond_reglement = $obj->cond_reglement_libelle; $this->cond_reglement_doc = $obj->cond_reglement_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; @@ -191,6 +194,13 @@ class CommandeFournisseur extends CommonOrder $this->extraparams = (array) json_decode($obj->extraparams, true); $this->db->free($resql); + + // Retreive all extrafield + // 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); if ($this->statut == 0) $this->brouillon = 1; @@ -207,7 +217,7 @@ class CommandeFournisseur extends CommonOrder $sql.= " ORDER BY l.rowid"; //print $sql; - dol_syslog(get_class($this)."::fetch get lines sql=".$sql,LOG_DEBUG); + dol_syslog(get_class($this)."::fetch get lines", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { @@ -259,14 +269,12 @@ class CommandeFournisseur extends CommonOrder else { $this->error=$this->db->error()." sql=".$sql; - dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR); return -1; } } else { $this->error=$this->db->error()." sql=".$sql; - dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR); return -1; } } @@ -288,7 +296,7 @@ class CommandeFournisseur extends CommonOrder $sql.= ($comment?"'".$this->db->escape($comment)."'":'null'); $sql.= ")"; - dol_syslog("FournisseurCommande::log sql=".$sql, LOG_DEBUG); + dol_syslog("FournisseurCommande::log", LOG_DEBUG); if ( $this->db->query($sql) ) { return 1; @@ -296,7 +304,6 @@ class CommandeFournisseur extends CommonOrder else { $this->error=$this->db->lasterror(); - dol_syslog(get_class($this)."::log ".$this->error, LOG_ERR); return -1; } } @@ -346,7 +353,6 @@ class CommandeFournisseur extends CommonOrder $resql=$this->db->query($sql); if (! $resql) { - dol_syslog(get_class($this)."::valid Echec update - 10 - sql=".$sql, LOG_ERR); dol_print_error($this->db); $error++; } @@ -389,18 +395,14 @@ class CommandeFournisseur extends CommonOrder if (! $error) { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('ORDER_SUPPLIER_VALIDATE',$this,$user,$langs,$conf); - if ($result < 0) + // Call trigger + $result=$this->call_trigger('ORDER_SUPPLIER_VALIDATE',$user); + if ($result < 0) { - $error++; - $this->errors=$interface->errors; $this->db->rollback(); return -1; } - // Fin appel triggers + // End call triggers } if (! $error) @@ -410,8 +412,6 @@ class CommandeFournisseur extends CommonOrder } else { - $this->error=$this->db->lasterror(); - dol_syslog(get_class($this)."::valid ".$this->error, LOG_ERR); $this->db->rollback(); return -1; } @@ -656,12 +656,10 @@ class CommandeFournisseur extends CommonOrder if (! $error) { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('ORDER_SUPPLIER_APPROVE',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('ORDER_SUPPLIER_APPROVE',$user); + if ($result < 0) $error++; + // End call triggers } if (! $error) @@ -679,7 +677,6 @@ class CommandeFournisseur extends CommonOrder { $this->db->rollback(); $this->error=$this->db->lasterror(); - dol_syslog(get_class($this)."::approve Error ",$this->error, LOG_ERR); return -1; } } @@ -702,43 +699,32 @@ class CommandeFournisseur extends CommonOrder $error=0; + dol_syslog(get_class($this)."::refuse"); $result = 0; if ($user->rights->fournisseur->commande->approuver) { $this->db->begin(); $sql = "UPDATE ".MAIN_DB_PREFIX."commande_fournisseur SET fk_statut = 9"; - $sql.= " WHERE rowid = ".$this->id; + $sql .= " WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::refuse sql=".$sql); - $resql=$this->db->query($sql); - - if ($resql) + if ($this->db->query($sql)) { $result = 0; $this->log($user, 9, time()); - if (! $error) + if ($error == 0) { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('ORDER_SUPPLIER_REFUSE',$this,$user,$langs,$conf); - if ($result < 0) + // Call trigger + $result=$this->call_trigger('ORDER_SUPPLIER_REFUSE',$user); + if ($result < 0) { $error++; - $this->errors=$interface->errors; + $this->db->rollback(); } - // Fin appel triggers - } - - if (! $error) - { - $this->db->commit(); - } - else - { - $this->db->rollback(); + else + $this->db->commit(); + // End call triggers } } else @@ -753,7 +739,7 @@ class CommandeFournisseur extends CommonOrder { dol_syslog(get_class($this)."::refuse Not Authorized"); } - return $result; + return $result ; } /** @@ -780,18 +766,16 @@ class CommandeFournisseur extends CommonOrder $sql = "UPDATE ".MAIN_DB_PREFIX."commande_fournisseur SET fk_statut = ".$statut; $sql .= " WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::cancel sql=".$sql); + dol_syslog(get_class($this)."::cancel", LOG_DEBUG); if ($this->db->query($sql)) { $result = 0; $this->log($user, $statut, time()); - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('ORDER_SUPPLIER_CANCEL',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('ORDER_SUPPLIER_CANCEL',$user); + if ($result < 0) $error++; + // End call triggers if ($error == 0) { @@ -838,7 +822,7 @@ class CommandeFournisseur extends CommonOrder $sql = "UPDATE ".MAIN_DB_PREFIX."commande_fournisseur SET fk_statut = 3, fk_input_method=".$methode.",date_commande=".$this->db->idate("$date"); $sql .= " WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::commande sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::commande", LOG_DEBUG); if ($this->db->query($sql)) { $result = 1; @@ -846,7 +830,6 @@ class CommandeFournisseur extends CommonOrder } else { - dol_syslog(get_class($this)."::cCommande Error -1", LOG_ERR); $result = -1; } } @@ -894,6 +877,7 @@ class CommandeFournisseur extends CommonOrder $sql.= ", model_pdf"; $sql.= ", fk_mode_reglement"; $sql.= ", fk_cond_reglement"; + $sql.= ", fk_account"; $sql.= ") "; $sql.= " VALUES ("; $sql.= "''"; @@ -910,9 +894,10 @@ class CommandeFournisseur extends CommonOrder $sql.= ", '".$conf->global->COMMANDE_SUPPLIER_ADDON_PDF."'"; $sql.= ", ".($this->mode_reglement_id > 0 ? $this->mode_reglement_id : 'null'); $sql.= ", ".($this->cond_reglement_id > 0 ? $this->cond_reglement_id : 'null'); + $sql.= ", ".($this->fk_account>0?$this->fk_account:'NULL'); $sql.= ")"; - dol_syslog(get_class($this)."::create sql=".$sql); + dol_syslog(get_class($this)."::create", LOG_DEBUG); if ($this->db->query($sql)) { $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."commande_fournisseur"); @@ -951,7 +936,7 @@ class CommandeFournisseur extends CommonOrder $sql = "UPDATE ".MAIN_DB_PREFIX."commande_fournisseur"; $sql.= " SET ref='(PROV".$this->id.")'"; $sql.= " WHERE rowid=".$this->id; - dol_syslog(get_class($this)."::create sql=".$sql); + dol_syslog(get_class($this)."::create", LOG_DEBUG); if ($this->db->query($sql)) { // On logue creation pour historique @@ -980,18 +965,14 @@ class CommandeFournisseur extends CommonOrder if (! $notrigger) { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('ORDER_SUPPLIER_CREATE',$this,$user,$langs,$conf); - if ($result < 0) + // Call trigger + $result=$this->call_trigger('ORDER_SUPPLIER_CREATE',$user); + if ($result < 0) { - $error++; - $this->errors=$interface->errors; $this->db->rollback(); return -1; } - // Fin appel triggers + // End call triggers } $this->db->commit(); @@ -1000,7 +981,6 @@ class CommandeFournisseur extends CommonOrder else { $this->error=$this->db->error(); - dol_syslog(get_class($this)."::create: Failed -2 - ".$this->error, LOG_ERR); $this->db->rollback(); return -2; } @@ -1009,7 +989,6 @@ class CommandeFournisseur extends CommonOrder else { $this->error=$this->db->error(); - dol_syslog(get_class($this)."::create: Failed -1 - ".$this->error, LOG_ERR); $this->db->rollback(); return -1; } @@ -1056,12 +1035,10 @@ class CommandeFournisseur extends CommonOrder if ($reshook < 0) $error++; } - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('ORDER_SUPPLIER_CLONE',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('ORDER_SUPPLIER_CLONE',$user); + if ($result < 0) $error++; + // End call triggers } // End @@ -1188,7 +1165,7 @@ class CommandeFournisseur extends CommonOrder // 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); + $localtaxes_type=getLocalTaxesFromRate($txtva,0,$mysoc,$this->thirdparty); $tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $product_type, $this->thirdparty, $localtaxes_type); $total_ht = $tabprice[0]; @@ -1227,7 +1204,7 @@ class CommandeFournisseur extends CommonOrder $sql.= "'".price2num($total_ttc)."'"; $sql.= ")"; - dol_syslog(get_class($this)."::addline sql=".$sql); + dol_syslog(get_class($this)."::addline", LOG_DEBUG); $resql=$this->db->query($sql); //print $sql; if ($resql) @@ -1237,18 +1214,14 @@ class CommandeFournisseur extends CommonOrder if (! $notrigger) { global $conf, $langs, $user; - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('LINEORDER_SUPPLIER_CREATE',$this,$user,$langs,$conf); - if ($result < 0) + // Call trigger + $result=$this->call_trigger('LINEORDER_SUPPLIER_CREATE',$user); + if ($result < 0) { - $error++; - $this->errors=$interface->errors; $this->db->rollback(); return -1; } - // Fin appel triggers + // End call triggers } $this->update_price('','auto'); @@ -1260,7 +1233,6 @@ class CommandeFournisseur extends CommonOrder { $this->error=$this->db->error(); $this->db->rollback(); - dol_syslog(get_class($this)."::addline ".$this->error, LOG_ERR); return -1; } } @@ -1304,25 +1276,21 @@ class CommandeFournisseur extends CommonOrder $sql.= " (fk_commande,fk_product, qty, fk_entrepot, fk_user, datec) VALUES "; $sql.= " ('".$this->id."','".$product."','".$qty."',".($entrepot>0?"'".$entrepot."'":"null").",'".$user->id."','".$this->db->idate($now)."')"; - dol_syslog(get_class($this)."::DispatchProduct sql=".$sql); + dol_syslog(get_class($this)."::DispatchProduct", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { if (! $notrigger) { global $conf, $langs, $user; - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('LINEORDER_SUPPLIER_DISPATCH',$this,$user,$langs,$conf); - if ($result < 0) + // Call trigger + $result=$this->call_trigger('LINEORDER_SUPPLIER_DISPATCH',$user); + if ($result < 0) { - $error++; - $this->errors=$interface->errors; $this->db->rollback(); return -1; } - // Fin appel triggers + // End call triggers } $this->db->commit(); @@ -1385,15 +1353,10 @@ class CommandeFournisseur extends CommonOrder if (! $notrigger) { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $result = 0; - $interface=new Interfaces($this->db); - $result = $interface->run_triggers('LINEORDER_SUPPLIER_DELETE',$this,$user,$langs,$conf); - if ($result < 0) { - $error++; $this->errors=$interface->errors; - } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('LINEORDER_SUPPLIER_DELETE',$user); + if ($result < 0) $error++; + // End call triggers } if (! $error) @@ -1440,18 +1403,28 @@ class CommandeFournisseur extends CommonOrder require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; $error = 0; + + // Call trigger + $result=$this->call_trigger('ORDER_SUPPLIER_DELETE',$user); + if ($result < 0) + { + dol_syslog(get_class($this)."::delete ".$this->error, LOG_ERR); + return -1; + } + // End call triggers + $this->db->begin(); $sql = "DELETE FROM ".MAIN_DB_PREFIX."commande_fournisseurdet WHERE fk_commande =". $this->id ; - dol_syslog(get_class($this)."::delete sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); if (! $this->db->query($sql) ) { $error++; } $sql = "DELETE FROM ".MAIN_DB_PREFIX."commande_fournisseur WHERE rowid =".$this->id; - dol_syslog(get_class($this)."::delete sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); if ($resql = $this->db->query($sql) ) { if ($this->db->affected_rows($resql) < 1) @@ -1477,18 +1450,6 @@ class CommandeFournisseur extends CommonOrder } } - if (! $error) - { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('ORDER_SUPPLIER_DELETE',$this,$user,$langs,$conf); - if ($result < 0) { - $error++; $this->errors=$interface->errors; - } - // Fin appel triggers - } - if (! $error) { // We remove directory @@ -1595,7 +1556,7 @@ class CommandeFournisseur extends CommonOrder $sql.= " WHERE rowid = ".$this->id; $sql.= " AND fk_statut IN (3,4)"; // Process running or Partially received - dol_syslog(get_class($this)."::Livraison sql=".$sql); + dol_syslog(get_class($this)."::Livraison", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -1608,7 +1569,6 @@ class CommandeFournisseur extends CommonOrder { $this->db->rollback(); $this->error=$this->db->lasterror(); - dol_syslog(get_class($this)."::Livraison Error ".$this->error, LOG_ERR); $result = -1; } } @@ -1641,7 +1601,7 @@ class CommandeFournisseur extends CommonOrder $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 sql=".$sql,LOG_DEBUG); + dol_syslog(get_class($this)."::set_date_livraison", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -1651,7 +1611,6 @@ class CommandeFournisseur extends CommonOrder else { $this->error=$this->db->error(); - dol_syslog(get_class($this)."::set_date_livraison ".$this->error,LOG_ERR); return -1; } } @@ -1721,7 +1680,7 @@ class CommandeFournisseur extends CommonOrder $sql.= ' SET fk_statut='.$status; $sql.= ' WHERE rowid = '.$this->id; - dol_syslog(get_class($this)."::setStatus sql=".$sql); + dol_syslog(get_class($this)."::setStatus", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -1765,6 +1724,7 @@ class CommandeFournisseur extends CommonOrder */ function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0, $txlocaltax2=0, $price_base_type='HT', $info_bits=0, $type=0, $notrigger=false) { + global $mysoc; dol_syslog(get_class($this)."::updateline $rowid, $desc, $pu, $qty, $remise_percent, $txtva, $price_base_type, $info_bits, $type"); include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; @@ -1797,7 +1757,7 @@ class CommandeFournisseur extends CommonOrder // 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); + $localtaxes_type=getLocalTaxesFromRate($txtva,0,$mysoc, $this->thirdparty); $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $this->thirdparty, $localtaxes_type); $total_ht = $tabprice[0]; @@ -1836,7 +1796,7 @@ class CommandeFournisseur extends CommonOrder $sql.= ",product_type=".$type; $sql.= " WHERE rowid = ".$rowid; - dol_syslog(get_class($this)."::updateline sql=".$sql); + dol_syslog(get_class($this)."::updateline", LOG_DEBUG); $result = $this->db->query($sql); if ($result > 0) { @@ -1845,18 +1805,14 @@ class CommandeFournisseur extends CommonOrder if (! $notrigger) { global $conf, $langs, $user; - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('LINEORDER_SUPPLIER_UPDATE',$this,$user,$langs,$conf); - if ($result < 0) + // Call trigger + $result=$this->call_trigger('LINEORDER_SUPPLIER_UPDATE',$user); + if ($result < 0) { - $error++; - $this->errors=$interface->errors; $this->db->rollback(); return -1; } - // Fin appel triggers + // End call triggers } // Mise a jour info denormalisees au niveau facture @@ -1868,7 +1824,6 @@ class CommandeFournisseur extends CommonOrder else { $this->error=$this->db->error(); - dol_syslog(get_class($this)."::updateline ".$this->error, LOG_ERR); $this->db->rollback(); return -1; } @@ -1978,7 +1933,7 @@ class CommandeFournisseur extends CommonOrder $this->nbtodo=$this->nbtodolate=0; $clause = " WHERE"; - $sql = "SELECT c.rowid, c.date_creation as datec, c.fk_statut"; + $sql = "SELECT c.rowid, c.date_creation as datec, c.fk_statut,c.date_livraison as delivery_date"; $sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as c"; if (!$user->rights->societe->client->voir && !$user->societe_id) { @@ -1996,7 +1951,9 @@ class CommandeFournisseur extends CommonOrder while ($obj=$this->db->fetch_object($resql)) { $this->nbtodo++; - if ($obj->fk_statut != 3 && $this->db->jdate($obj->datec) < ($now - $conf->commande->fournisseur->warning_delay)) $this->nbtodolate++; + + $date_to_test = empty($obj->delivery_date) ? $obj->datec : $obj->delivery_date; + if ($obj->fk_statut != 3 && $this->db->jdate($date_to_test) < ($now - $conf->commande->fournisseur->warning_delay)) $this->nbtodolate++; } return 1; } @@ -2162,7 +2119,7 @@ class CommandeFournisseurLigne $sql.= ",total_ttc='".price2num($this->total_ttc)."'"; $sql.= " WHERE rowid = ".$this->rowid; - dol_syslog("CommandeFournisseurLigne.class.php::update_total sql=$sql"); + dol_syslog("CommandeFournisseurLigne.class.php::update_total", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) @@ -2173,7 +2130,6 @@ class CommandeFournisseurLigne else { $this->error=$this->db->error(); - dol_syslog("CommandeFournisseurLigne.class.php::update_total Error ".$this->error, LOG_ERR); $this->db->rollback(); return -2; } diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 786d619665e..4ceea058b4f 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -4,7 +4,7 @@ * Copyright (C) 2004 Christophe Combelles * Copyright (C) 2005 Marc Barilley * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2010-2013 Juanjo Menent + * Copyright (C) 2010-2014 Juanjo Menent * Copyright (C) 2013 Philippe Grand * Copyright (C) 2013 Florian Henry * @@ -79,6 +79,7 @@ class FactureFournisseur extends CommonInvoice var $propalid; var $cond_reglement_id; var $cond_reglement_code; + var $fk_account; var $mode_reglement_id; var $mode_reglement_code; @@ -174,6 +175,7 @@ class FactureFournisseur extends CommonInvoice $sql.= ", fk_projet"; $sql.= ", fk_cond_reglement"; $sql.= ", fk_mode_reglement"; + $sql.= ", fk_account"; $sql.= ", note_private"; $sql.= ", note_public"; $sql.= ", fk_user_author"; @@ -190,13 +192,14 @@ class FactureFournisseur extends CommonInvoice $sql.= ", ".(isset($this->fk_project)?$this->fk_project:"null"); $sql.= ", ".(isset($this->cond_reglement_id)?$this->cond_reglement_id:"null"); $sql.= ", ".(isset($this->mode_reglement_id)?$this->mode_reglement_id:"null"); + $sql.= ", ".($this->fk_account>0?$this->fk_account:'NULL'); $sql.= ", '".$this->db->escape($this->note_private)."'"; $sql.= ", '".$this->db->escape($this->note_public)."'"; $sql.= ", ".$user->id.","; $sql.= $this->date_echeance!=''?"'".$this->db->idate($this->date_echeance)."'":"null"; $sql.= ")"; - dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::create", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -206,7 +209,7 @@ class FactureFournisseur extends CommonInvoice $this->ref='(PROV'.$this->id.')'; $sql = 'UPDATE '.MAIN_DB_PREFIX."facture_fourn SET ref='".$this->ref."' WHERE rowid=".$this->id; - dol_syslog(get_class($this)."::create sql=".$sql); + dol_syslog(get_class($this)."::create", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) $error++; @@ -226,7 +229,7 @@ class FactureFournisseur extends CommonInvoice $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'facture_fourn_det (fk_facture_fourn)'; $sql .= ' VALUES ('.$this->id.');'; - dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::create", LOG_DEBUG); $resql_insert=$this->db->query($sql); if ($resql_insert) { @@ -251,12 +254,10 @@ class FactureFournisseur extends CommonInvoice $result=$this->update_price(); if ($result > 0) { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('BILL_SUPPLIER_CREATE',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('BILL_SUPPLIER_CREATE',$user); + if ($result < 0) $error++; + // End call triggers if (! $error) { @@ -333,7 +334,8 @@ class FactureFournisseur extends CommonInvoice $sql.= " t.fk_facture_source,"; $sql.= " t.fk_projet,"; $sql.= " t.fk_cond_reglement,"; - $sql.= " t.fk_mode_reglement,"; + $sql.= " t.fk_account,"; + $sql.= " t.fk_mode_reglement,"; $sql.= " t.date_lim_reglement,"; $sql.= " t.note_private,"; $sql.= " t.note_public,"; @@ -350,7 +352,7 @@ class FactureFournisseur extends CommonInvoice if ($id) $sql.= " WHERE t.rowid=".$id; if ($ref) $sql.= " WHERE t.ref='".$this->db->escape($ref)."'"; - dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -394,6 +396,7 @@ class FactureFournisseur extends CommonInvoice $this->cond_reglement_code = $obj->cond_reglement_code; $this->cond_reglement = $obj->cond_reglement_libelle; $this->cond_reglement_doc = $obj->cond_reglement_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; @@ -414,14 +417,13 @@ class FactureFournisseur extends CommonInvoice if ($result < 0) { $this->error=$this->db->error(); - dol_syslog(get_class($this).'::fetch Error '.$this->error, LOG_ERR); return -3; } } else { - $this->error='Bill with id '.$id.' not found sql='.$sql; + $this->error='Bill with id '.$id.' not found'; dol_syslog(get_class($this).'::fetch '.$this->error); return 0; } @@ -432,7 +434,6 @@ class FactureFournisseur extends CommonInvoice else { $this->error="Error ".$this->db->lasterror(); - dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR); return -1; } } @@ -453,7 +454,7 @@ class FactureFournisseur extends CommonInvoice $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON f.fk_product = p.rowid'; $sql.= ' WHERE fk_facture_fourn='.$this->id; - dol_syslog(get_class($this)."::fetch_lines sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetch_lines", LOG_DEBUG); $resql_rows = $this->db->query($sql); if ($resql_rows) { @@ -499,7 +500,6 @@ class FactureFournisseur extends CommonInvoice else { $this->error=$this->db->error(); - dol_syslog(get_class($this).'::fetch_lines: Error '.$this->error,LOG_ERR); return -3; } } @@ -591,7 +591,7 @@ class FactureFournisseur extends CommonInvoice $this->db->begin(); - dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } @@ -599,11 +599,9 @@ class FactureFournisseur extends CommonInvoice { if (! $notrigger) { - // Call triggers - //include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - //$interface=new Interfaces($this->db); - //$result=$interface->run_triggers('BILL_SUPPLIER_MODIFY',$this,$user,$langs,$conf); - //if ($result < 0) { $error++; $this->errors=$interface->errors; } + // Call trigger + $result=$this->call_trigger('BILL_SUPPLIER_UPDATE',$user); + if ($result < 0) $error++; // End call triggers } } @@ -647,12 +645,12 @@ class FactureFournisseur extends CommonInvoice $this->db->begin(); $sql = 'DELETE FROM '.MAIN_DB_PREFIX.'facture_fourn_det WHERE fk_facture_fourn = '.$rowid.';'; - dol_syslog(get_class($this)."::delete sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { $sql = 'DELETE FROM '.MAIN_DB_PREFIX.'facture_fourn WHERE rowid = '.$rowid; - dol_syslog(get_class($this)."::delete sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql2 = $this->db->query($sql); if (! $resql2) { $error++; @@ -671,13 +669,10 @@ class FactureFournisseur extends CommonInvoice if (! $error) { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('BILL_SUPPLIER_DELETE',$this,$user,$langs,$conf); - if ($result < 0) { - $error++; - $this->errors=$interface->errors; + // Call trigger + $result=$this->call_trigger('BILL_SUPPLIER_DELETE',$user); + if ($result < 0) + { $this->db->rollback(); return -1; } @@ -742,7 +737,6 @@ class FactureFournisseur extends CommonInvoice else { $this->error=$this->db->lasterror(); - dol_syslog(get_class($this)."::delete ".$this->error, LOG_ERR); $this->db->rollback(); return -$error; } @@ -766,16 +760,14 @@ class FactureFournisseur extends CommonInvoice $sql.= ' SET paye = 1, fk_statut=2'; $sql.= ' WHERE rowid = '.$this->id; - dol_syslog("FactureFournisseur::set_paid sql=".$sql); + dol_syslog("FactureFournisseur::set_paid", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('BILL_SUPPLIER_PAYED',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('BILL_SUPPLIER_PAYED',$user); + if ($result < 0) $error++; + // End call triggers } else { @@ -816,16 +808,14 @@ class FactureFournisseur extends CommonInvoice $sql.= ' SET paye=0, fk_statut=1, close_code=null, close_note=null'; $sql.= ' WHERE rowid = '.$this->id; - dol_syslog("FactureFournisseur::set_unpaid sql=".$sql); + dol_syslog("FactureFournisseur::set_unpaid", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('BILL_SUPPLIER_UNPAYED',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('BILL_SUPPLIER_UNPAYED',$user); + if ($result < 0) $error++; + // End call triggers } else { @@ -894,7 +884,7 @@ class FactureFournisseur extends CommonInvoice $sql.= " SET ref='".$num."', fk_statut = 1, fk_user_valid = ".$user->id; $sql.= " WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::validate sql=".$sql); + dol_syslog(get_class($this)."::validate", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -961,12 +951,10 @@ class FactureFournisseur extends CommonInvoice // Triggers call if (! $error) { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('BILL_SUPPLIER_VALIDATE',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('BILL_SUPPLIER_VALIDATE',$user); + if ($result < 0) $error++; + // End call triggers } if (! $error) @@ -1014,7 +1002,7 @@ class FactureFournisseur extends CommonInvoice $sql.= " SET fk_statut = 0"; $sql.= " WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::set_draft sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::set_draft", LOG_DEBUG); $result=$this->db->query($sql); if ($result) { @@ -1113,7 +1101,7 @@ class FactureFournisseur extends CommonInvoice $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'facture_fourn_det (fk_facture_fourn)'; $sql.= ' VALUES ('.$this->id.')'; - dol_syslog(get_class($this)."::addline sql=".$sql); + dol_syslog(get_class($this)."::addline", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) @@ -1128,18 +1116,14 @@ class FactureFournisseur extends CommonInvoice if (! $notrigger) { global $conf, $langs, $user; - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('LINEBILL_SUPPLIER_CREATE',$this,$user,$langs,$conf); - if ($result < 0) + // Call trigger + $result=$this->call_trigger('LINEBILL_SUPPLIER_CREATE',$user); + if ($result < 0) { - $error++; - $this->errors=$interface->errors; $this->db->rollback(); return -1; } - // Fin appel triggers + // End call triggers } $this->db->commit(); @@ -1180,6 +1164,7 @@ class FactureFournisseur extends CommonInvoice */ 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) { + global $mysoc; dol_syslog(get_class($this)."::updateline $id,$desc,$pu,$vatrate,$qty,$idproduct,$price_base_type,$info_bits,$type,$remise_percent", LOG_DEBUG); include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; @@ -1204,7 +1189,7 @@ class FactureFournisseur 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($vatrate,0,$this->thirdparty); + $localtaxes_type=getLocalTaxesFromRate($vatrate,0,$mysoc, $this->thirdparty); $tabprice = calcul_price_total($qty, $pu, $remise_percent, $vatrate, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $this->thirdparty, $localtaxes_type); $total_ht = $tabprice[0]; @@ -1252,7 +1237,7 @@ class FactureFournisseur extends CommonInvoice $sql.= ", info_bits = ".$info_bits; $sql.= " WHERE rowid = ".$id; - dol_syslog(get_class($this)."::updateline sql=".$sql); + dol_syslog(get_class($this)."::updateline", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -1261,18 +1246,14 @@ class FactureFournisseur extends CommonInvoice if (! $notrigger) { global $conf, $langs, $user; - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('LINEBILL_SUPPLIER_UPDATE',$this,$user,$langs,$conf); - if ($result < 0) - { - $error++; - $this->errors=$interface->errors; + // Call trigger + $result=$this->call_trigger('LINEBILL_SUPPLIER_UPDATE',$user); + if ($result < 0) + { $this->db->rollback(); return -1; } - // Fin appel triggers + // End call triggers } // Update total price into invoice record @@ -1286,7 +1267,6 @@ class FactureFournisseur extends CommonInvoice { $this->db->rollback(); $this->error=$this->db->lasterror(); - dol_syslog(get_class($this)."::updateline error=".$this->error, LOG_ERR); return -1; } } @@ -1311,14 +1291,10 @@ class FactureFournisseur extends CommonInvoice if (! $error && ! $notrigger) { - // Appel des triggers - include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php"); - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('LINEBILL_SUPPLIER_DELETE',$this,$user,$langs,$conf); - if ($result < 0) { - $error++; $this->errors=$interface->errors; - } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('LINEBILL_SUPPLIER_DELETE',$user); + if ($result < 0) $error++; + // End call triggers } if (! $error) @@ -1326,13 +1302,12 @@ class FactureFournisseur extends CommonInvoice // Supprime ligne $sql = 'DELETE FROM '.MAIN_DB_PREFIX.'facture_fourn_det '; $sql.= ' WHERE rowid = '.$rowid; - dol_syslog(get_class($this)."::delete sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $error++; $this->error=$this->db->lasterror(); - dol_syslog(get_class($this)."::delete ".$this->error, LOG_ERR); } } diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index b642926f802..bbb6dbdb33a 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -83,12 +83,11 @@ class ProductFournisseur extends Product $sql = "DELETE FROM ".MAIN_DB_PREFIX."product_fournisseur_price"; $sql.= " WHERE fk_product = ".$this->id." AND fk_soc = ".$id_fourn; - dol_syslog(get_class($this)."::remove_fournisseur sql=".$sql); + dol_syslog(get_class($this)."::remove_fournisseur", LOG_DEBUG); $resql2=$this->db->query($sql); if (! $resql2) { $this->error=$this->db->lasterror(); - dol_syslog(get_class($this)."::remove_fournisseur ".$this->error, LOG_ERR); $ok=0; } @@ -120,7 +119,7 @@ class ProductFournisseur extends Product $sql = "DELETE FROM ".MAIN_DB_PREFIX."product_fournisseur_price"; $sql.= " WHERE rowid = ".$rowid; - dol_syslog(get_class($this)."::remove_product_fournisseur_price sql=".$sql); + dol_syslog(get_class($this)."::remove_product_fournisseur_price", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -130,7 +129,6 @@ class ProductFournisseur extends Product else { $this->error=$this->db->lasterror(); - dol_syslog(get_class($this)."::remove_product_fournisseur_price ".$this->error,LOG_ERR); $this->db->rollback(); return -1; } @@ -156,7 +154,7 @@ class ProductFournisseur extends Product */ function update_buyprice($qty, $buyprice, $user, $price_base_type, $fourn, $availability, $ref_fourn, $tva_tx, $charges=0, $remise_percent=0, $remise=0, $newnpr=0) { - global $conf,$mysoc; + global $conf; // Clean parameter if (empty($qty)) $qty=0; @@ -201,18 +199,14 @@ class ProductFournisseur extends Product $sql.= " WHERE rowid = ".$this->product_fourn_price_id; // TODO Add price_base_type and price_ttc - dol_syslog(get_class($this).'::update_buyprice sql='.$sql); + dol_syslog(get_class($this).'::update_buyprice', LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { - // Appel des triggers - include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php"); - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('SUPPLIER_PRODUCT_BUYPRICE_UPDATE',$this,$user,$langs,$conf); - if ($result < 0) - { - $error++; $this->error=$interface->errors; - } + // Call trigger + $result=$this->call_trigger('SUPPLIER_PRODUCT_BUYPRICE_UPDATE',$user); + if ($result < 0) $error++; + // End call triggers if (empty($error)) { @@ -238,7 +232,7 @@ class ProductFournisseur extends Product // Delete price for this quantity $sql = "DELETE FROM ".MAIN_DB_PREFIX."product_fournisseur_price"; $sql.= " WHERE fk_soc = ".$fourn->id." AND ref_fourn = '".$this->db->escape($ref_fourn)."' AND quantity = ".$qty." AND entity = ".$conf->entity; - dol_syslog(get_class($this).'::update_buyprice sql='.$sql); + dol_syslog(get_class($this).'::update_buyprice', LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -263,15 +257,15 @@ class ProductFournisseur extends Product $sql.= $conf->entity; $sql.=")"; - dol_syslog(get_class($this)."::update_buyprice sql=".$sql); + dol_syslog(get_class($this)."::update_buyprice", LOG_DEBUG); if (! $this->db->query($sql)) { $error++; } - /*if (! $error) + if (! $error && !empty($cong->global->PRODUCT_PRICE_SUPPLIER_NO_LOG)) { - // Ajoute modif dans table log + // Add record into log table $sql = "INSERT INTO ".MAIN_DB_PREFIX."product_fournisseur_price_log("; $sql.= "datec, fk_product_fournisseur,fk_user,price,quantity)"; $sql.= "values('".$this->db->idate($now)."',"; @@ -287,18 +281,14 @@ class ProductFournisseur extends Product $error++; } } - */ + if (! $error) { - // Appel des triggers - include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php"); - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('SUPPLIER_PRODUCT_BUYPRICE_CREATE',$this,$user,$langs,$conf); - if ($result < 0) - { - $error++; $this->error=$interface->errors; - } + // Call trigger + $result=$this->call_trigger('SUPPLIER_PRODUCT_BUYPRICE_CREATE',$user); + if ($result < 0) $error++; + // End call triggers if (empty($error)) { @@ -340,7 +330,7 @@ class ProductFournisseur extends Product $sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp"; $sql.= " WHERE pfp.rowid = ".$rowid; - dol_syslog(get_class($this)."::fetch_product_fournisseur_price sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetch_product_fournisseur_price", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -371,7 +361,6 @@ class ProductFournisseur extends Product else { $this->error=$this->db->error(); - dol_syslog(get_class($this)."::fetch_product_fournisseur_price error=".$this->error, LOG_ERR); return -1; } } @@ -399,7 +388,7 @@ class ProductFournisseur extends Product $sql.= " AND pfp.fk_product = ".$prodid; if (empty($sortfield)) $sql.= " ORDER BY s.nom, pfp.quantity, pfp.price"; else $sql.= $this->db->order($sortfield,$sortorder); - dol_syslog(get_class($this)."::list_product_fournisseur_price sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::list_product_fournisseur_price", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) @@ -449,7 +438,6 @@ class ProductFournisseur extends Product else { $this->error=$this->db->error(); - dol_syslog(get_class($this)."::list_product_fournisseur_price error=".$this->error, LOG_ERR); return -1; } } @@ -488,7 +476,7 @@ class ProductFournisseur extends Product $sql.= " ORDER BY pfp.unitprice"; $sql.= $this->db->plimit(1); - dol_syslog(get_class($this)."::find_min_price_product_fournisseur sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::find_min_price_product_fournisseur", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) @@ -513,7 +501,6 @@ class ProductFournisseur extends Product else { $this->error=$this->db->error(); - dol_syslog(get_class($this)."::find_min_price_product_fournisseur error=".$this->error, LOG_ERR); return -1; } } diff --git a/htdocs/fourn/class/index.html b/htdocs/fourn/class/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/fourn/class/paiementfourn.class.php b/htdocs/fourn/class/paiementfourn.class.php index 627b2de0d84..8903ff3b66a 100644 --- a/htdocs/fourn/class/paiementfourn.class.php +++ b/htdocs/fourn/class/paiementfourn.class.php @@ -149,7 +149,7 @@ class PaiementFourn extends Paiement $sql.= " VALUES ('".$this->db->idate($now)."',"; $sql.= " '".$this->db->idate($this->datepaye)."', '".$this->total."', ".$this->paiementid.", '".$this->num_paiement."', '".$this->db->escape($this->note)."', ".$user->id.", 0)"; - dol_syslog("PaiementFourn::create sql=".$sql); + dol_syslog("PaiementFourn::create", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -201,18 +201,15 @@ class PaiementFourn extends Paiement if (! $error) { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('PAYMENT_SUPPLIER_CREATE',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('PAYMENT_SUPPLIER_CREATE',$user); + if ($result < 0) $error++; + // End call triggers } } else { $this->error=$this->db->lasterror(); - dol_syslog('PaiementFourn::Create Error '.$this->error, LOG_ERR); $error++; } } @@ -258,7 +255,7 @@ class PaiementFourn extends Paiement { if (count($billsarray)) { - $this->error='Can\'t delete a payment shared by at least one invoice with status payed'; + $this->error="ErrorCantDeletePaymentSharedWithPayedInvoice"; $this->db->rollback(); return -1; } @@ -277,7 +274,7 @@ class PaiementFourn extends Paiement $accline->fetch($bank_line_id); if ($accline->rappro) { - $this->error='Impossible de supprimer un paiement qui a genere une ecriture qui a ete rapprochee'; + $this->error="ErrorCantDeletePaymentReconciliated"; $this->db->rollback(); return -3; } @@ -286,13 +283,11 @@ class PaiementFourn extends Paiement // Efface la ligne de paiement (dans paiement_facture et paiement) $sql = 'DELETE FROM '.MAIN_DB_PREFIX.'paiementfourn_facturefourn'; $sql.= ' WHERE fk_paiementfourn = '.$this->id; - dol_syslog("sql=".$sql); $resql = $this->db->query($sql); if ($resql) { $sql = 'DELETE FROM '.MAIN_DB_PREFIX.'paiementfourn'; $sql.= ' WHERE rowid = '.$this->id; - dol_syslog("sql=".$sql); $result = $this->db->query($sql); if (! $result) { @@ -384,7 +379,7 @@ class PaiementFourn extends Paiement $sql.= ' WHERE pf.fk_facturefourn = f.rowid AND fk_paiementfourn = '.$this->id; if ($filter) $sql.= ' AND '.$filter; - dol_syslog(get_class($this).'::getBillsArray sql='.$sql,LOG_DEBUG); + dol_syslog(get_class($this).'::getBillsArray', LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { diff --git a/htdocs/fourn/commande/contact.php b/htdocs/fourn/commande/contact.php index 8311e8bfc9f..ba32a143f8c 100644 --- a/htdocs/fourn/commande/contact.php +++ b/htdocs/fourn/commande/contact.php @@ -69,11 +69,11 @@ if ($action == 'addcontact' && $user->rights->fournisseur->commande->creer) if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $langs->load("errors"); - $mesg = '
'.$langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType").'
'; + setEventMessage($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), 'errors'); } else { - $mesg = '
'.$object->error.'
'; + setEventMessage($object->error, 'errors'); } } } @@ -126,7 +126,6 @@ $userstatic=new User($db); /* Mode vue et edition */ /* */ /* *************************************************************************** */ -dol_htmloutput_mesg($mesg); if ($id > 0 || ! empty($ref)) { diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index 02666e1c855..bea467340e6 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -120,12 +120,9 @@ if ($_POST["action"] == 'dispatch' && $user->rights->fournisseur->commande->rece if (! $notrigger) { global $conf, $langs, $user; - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($db); - $result_trigger=$interface->run_triggers('ORDER_SUPPLIER_DISPATCH',$commande,$user,$langs,$conf); - if ($result_trigger < 0) { $error++; $commande->errors=$interface->errors; } - // Fin appel triggers + // Call trigger + $result=$commande->call_trigger('ORDER_SUPPLIER_DISPATCH',$user); + // End call triggers } if ($result > 0) diff --git a/htdocs/fourn/commande/fiche.php b/htdocs/fourn/commande/fiche.php index 00884d368f6..a5d377c9e39 100644 --- a/htdocs/fourn/commande/fiche.php +++ b/htdocs/fourn/commande/fiche.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2013 Laurent Destailleur * Copyright (C) 2005 Eric Seigne * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2010-2013 Juanjo Menent + * Copyright (C) 2010-2014 Juanjo Menent * Copyright (C) 2011 Philippe Grand * Copyright (C) 2012 Marcos García * Copyright (C) 2013 Florian Henry @@ -105,6 +105,9 @@ $permissionnote=$user->rights->fournisseur->commande->creer; // Used by the incl * Actions */ +$parameters=array('socid'=>$socid); +$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks + include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not includ_once if ($action == 'setref_supplier' && $user->rights->fournisseur->commande->creer) @@ -125,6 +128,11 @@ else if ($action == 'setmode' && $user->rights->fournisseur->commande->creer) $result = $object->setPaymentMethods(GETPOST('mode_reglement_id','int')); } +// bank account +else if ($action == 'setbankaccount' && $user->rights->fournisseur->commande->creer) { + $result=$object->setBankAccount(GETPOST('fk_account', 'int')); + } + // date de livraison if ($action == 'setdate_livraison' && $user->rights->fournisseur->commande->creer) { @@ -150,10 +158,11 @@ else if ($action == 'setremisepercent' && $user->rights->fournisseur->commande-> else if ($action == 'reopen' && $user->rights->fournisseur->commande->approuver) { - if (in_array($object->statut, array(1, 5, 6, 7, 9))) + if (in_array($object->statut, array(1, 2, 5, 6, 7, 9))) { if ($object->statut == 1) $newstatus=0; // Validated->Draft - else if ($object->statut == 5) $newstatus=4; // Received->Received partially + else if ($object->statut == 2) $newstatus=0; // Approved->Draft + else if ($object->statut == 5) $newstatus=4; // Received->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 @@ -633,7 +642,7 @@ else if ($action == 'livraison' && $user->rights->fournisseur->commande->recepti } else { - $mesg='
'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("Delivery")).'
'; + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Delivery")), 'errors'); } } @@ -762,7 +771,7 @@ else if ($action == 'add' && $user->rights->fournisseur->commande->creer) if ($socid <1) { - $mesg='
'.$langs->trans('ErrorFieldRequired',$langs->transnoentities('Supplier')).'
'; + setEventMessage($langs->trans('ErrorFieldRequired',$langs->transnoentities('Supplier')), 'errors'); $action='create'; $error++; } @@ -776,6 +785,7 @@ else if ($action == 'add' && $user->rights->fournisseur->commande->creer) $object->socid = $socid; $object->cond_reglement_id = GETPOST('cond_reglement_id'); $object->mode_reglement_id = GETPOST('mode_reglement_id'); + $object->fk_account = GETPOST('fk_account', 'int'); $object->note_private = GETPOST('note_private'); $object->note_public = GETPOST('note_public'); @@ -792,7 +802,7 @@ else if ($action == 'add' && $user->rights->fournisseur->commande->creer) { $langs->load("errors"); $db->rollback(); - $mesg='
'.$langs->trans($object->error).'
'; + setEventMessage($langs->trans($object->error), 'errors'); $action='create'; $_GET['socid']=$_POST['socid']; } @@ -1064,7 +1074,6 @@ if ($action=="create") { print_fiche_titre($langs->trans('NewOrder')); - dol_htmloutput_mesg($mesg); dol_htmloutput_events(); $societe=''; @@ -1116,6 +1125,11 @@ if ($action=="create") $form->select_types_paiements(isset($_POST['mode_reglement_id'])?$_POST['mode_reglement_id']:$mode_reglement_id,'mode_reglement_id'); print '
' . $langs->trans('BankAccount') . ''; + $form->select_comptes($fk_account, 'fk_account', 0, '', 1); + print '
'.$langs->trans('NotePublic').''; $doleditor = new DolEditor('note_public', GETPOST('note_public'), '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70); @@ -1288,17 +1302,9 @@ elseif (! empty($object->id)) if (! empty($conf->projet->enabled)) $nbrow++; //Local taxes - //TODO: Place into a function to control showing by country or study better option - if ($mysoc->country_code=='ES') - { - if($mysoc->localtax1_assuj=="1") $nbrow++; - if($object->thirdparty->localtax2_assuj=="1") $nbrow++; - } - else - { - if($mysoc->localtax1_assuj=="1") $nbrow++; - if($mysoc->localtax2_assuj=="1") $nbrow++; - } + if($mysoc->localtax1_assuj=="1") $nbrow++; + if($mysoc->localtax2_assuj=="1") $nbrow++; + print ''; $linkback = ''.$langs->trans("BackToList").''; @@ -1389,6 +1395,23 @@ elseif (! empty($object->id)) } print ''; + // Bank Account + print ''; + print ''; + // Delivery date planed print '\n"; @@ -180,6 +182,7 @@ if ($resql) print ''; print ''; print ''; + print ''; print ''; @@ -238,6 +241,12 @@ if ($resql) } print ''; + // Delivery date + print ''; + + // Statut print ''; diff --git a/htdocs/fourn/commande/tpl/index.html b/htdocs/fourn/commande/tpl/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/fourn/facture/contact.php b/htdocs/fourn/facture/contact.php index 25361746869..aaee42e9add 100644 --- a/htdocs/fourn/facture/contact.php +++ b/htdocs/fourn/facture/contact.php @@ -1,6 +1,6 @@ - * Copyright (C) 2005-2012 Laurent Destailleur + * Copyright (C) 2005-2014 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * * This program is free software; you can redistribute it and/or modify @@ -69,11 +69,11 @@ if ($action == 'addcontact' && $user->rights->fournisseur->facture->creer) if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $langs->load("errors"); - $mesg = '
'.$langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType").'
'; + setEventMessage($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), 'errors'); } else { - $mesg = '
'.$object->error.'
'; + setEventMessage($object->error, 'errors'); } } } @@ -125,7 +125,6 @@ $userstatic=new User($db); /* Mode vue et edition */ /* */ /* *************************************************************************** */ -dol_htmloutput_mesg($mesg); if ($id > 0 || ! empty($ref)) { @@ -156,9 +155,54 @@ if ($id > 0 || ! empty($ref)) // Third party print "
"; print ''; + + // Type + print ''; + + // Label + print ''; + print "
'; + print ''; + print '
'; + print $langs->trans('BankAccount'); + print ''; + if ($action != 'editbankaccount' && $user->rights->fournisseur->commande->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 ''; // Amount Local Taxes - //TODO: Place into a function to control showing by country or study better option - if ($mysoc->country_code=='ES') + if ($mysoc->localtax1_assuj=="1" || $object->total_localtax1 != 0) //Localtax1 { - if ($mysoc->localtax1_assuj=="1") //Localtax1 RE - { - print ''; - print ''; - print ''; - } - if ($object->thirdparty->localtax2_assuj=="1") //Localtax2 IRPF - { - print ''; - print ''; - print ''; - } + print ''; + print ''; + print ''; } - else + if ($mysoc->localtax2_assuj=="1" || $object->total_localtax2 != 0) //Localtax2 { - if ($mysoc->localtax1_assuj=="1") //Localtax1 - { - print ''; - print ''; - print ''; - } - if ($mysoc->localtax2_assuj=="1") //Localtax2 - { - print ''; - print ''; - print ''; - } + print ''; + print ''; + print ''; } + print ''; print ''; @@ -1768,7 +1773,6 @@ elseif (! empty($object->id)) $parameters = array(); $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook - } print '
'; @@ -1514,37 +1537,19 @@ elseif (! empty($object->id)) print ''.$langs->trans("Currency".$conf->currency).'
'.$langs->transcountry("AmountLT1",$mysoc->country_code).''.price($object->total_localtax1).''.$langs->trans("Currency".$conf->currency).'
'.$langs->transcountry("AmountLT2",$mysoc->country_code).''.price($object->total_localtax2).''.$langs->trans("Currency".$conf->currency).'
'.$langs->transcountry("AmountLT1",$mysoc->country_code).''.price($object->total_localtax1).''.$langs->trans("Currency".$conf->currency).'
'.$langs->transcountry("AmountLT1",$mysoc->country_code).''.price($object->total_localtax1).''.$langs->trans("Currency".$conf->currency).'
'.$langs->transcountry("AmountLT2",$mysoc->country_code).''.price($object->total_localtax2).''.$langs->trans("Currency".$conf->currency).'
'.$langs->transcountry("AmountLT2",$mysoc->country_code).''.price($object->total_localtax2).''.$langs->trans("Currency".$conf->currency).'
'.$langs->trans("AmountTTC").''.price($object->total_ttc).''.$langs->trans("Currency".$conf->currency).'
'; @@ -1830,7 +1834,7 @@ elseif (! empty($object->id)) } // Reopen - if (in_array($object->statut, array(5, 6, 7, 9))) + if (in_array($object->statut, array(2, 5, 6, 7, 9))) { if ($user->rights->fournisseur->commande->commander) { @@ -1987,20 +1991,24 @@ elseif (! empty($object->id)) $fileparams = dol_most_recent_file($conf->fournisseur->commande->dir_output . '/' . $ref, preg_quote($ref,'/')); $file=$fileparams['fullname']; + // Define output language + $outputlangs = $langs; + $newlang = ''; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) + $newlang = $_REQUEST['lang_id']; + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) + $newlang = $object->client->default_lang; + + if (!empty($newlang)) + { + $outputlangs = new Translate('', $conf); + $outputlangs->setDefaultLang($newlang); + $outputlangs->load('commercial'); + } + // Build document if it not exists if (! $file || ! is_readable($file)) { - // Define output language - $outputlangs = $langs; - $newlang=''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id']; - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang; - if (! empty($newlang)) - { - $outputlangs = new Translate("",$conf); - $outputlangs->setDefaultLang($newlang); - } - $result=supplier_order_pdf_create($db, $object, GETPOST('model')?GETPOST('model'):$object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); if ($result <= 0) { @@ -2018,6 +2026,7 @@ elseif (! empty($object->id)) // Cree l'objet formulaire mail 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); @@ -2028,7 +2037,7 @@ elseif (! empty($object->id)) $formmail->withto=GETPOST("sendto")?GETPOST("sendto"):$liste; $formmail->withtocc=$liste; $formmail->withtoccc=(! empty($conf->global->MAIN_EMAIL_USECCC)?$conf->global->MAIN_EMAIL_USECCC:false); - $formmail->withtopic=$langs->trans('SendOrderRef','__ORDERREF__'); + $formmail->withtopic=$outputlangs->trans('SendOrderRef','__ORDERREF__'); $formmail->withfile=2; $formmail->withbody=1; $formmail->withdeliveryreceipt=1; diff --git a/htdocs/fourn/commande/liste.php b/htdocs/fourn/commande/liste.php index 4b005a88724..c02ab0685f7 100644 --- a/htdocs/fourn/commande/liste.php +++ b/htdocs/fourn/commande/liste.php @@ -34,6 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formorder.class.php'; $langs->load("orders"); +$langs->load("sendings"); $search_ref=GETPOST('search_ref'); @@ -85,7 +86,7 @@ $offset = $conf->liste_limit * $page ; */ $sql = "SELECT s.rowid as socid, s.nom, cf.date_commande as dc,"; -$sql.= " cf.rowid,cf.ref, cf.ref_supplier, cf.fk_statut, cf.total_ttc, cf.fk_user_author,"; +$sql.= " cf.rowid,cf.ref, cf.ref_supplier, cf.fk_statut, cf.total_ttc, cf.fk_user_author,cf.date_livraison,"; $sql.= " u.login"; $sql.= " FROM (".MAIN_DB_PREFIX."societe as s,"; $sql.= " ".MAIN_DB_PREFIX."commande_fournisseur as cf"; @@ -168,6 +169,7 @@ if ($resql) print_liste_field_titre($langs->trans("Author"),$_SERVER["PHP_SELF"],"u.login","",$param,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("AmountTTC"),$_SERVER["PHP_SELF"],"total_ttc","",$param,$sortfield,$sortorder); print_liste_field_titre($langs->trans("OrderDate"),$_SERVER["PHP_SELF"],"dc","",$param,'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans('DateDeliveryPlanned'),$_SERVER["PHP_SELF"],'cf.date_livraison','',$param, 'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"cf.fk_statut","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre(''); print "
  '; $formorder->selectSupplierOrderStatus($search_status,1,'search_status'); print ''; + print dol_print_date($db->jdate($obj->date_livraison), 'day'); + print ''.$commandestatic->LibStatut($obj->fk_statut, 5).'
".$langs->trans("Supplier")."'.$object->thirdparty->getNomUrl(1,'supplier').'
'.$langs->trans('Type').''; + print $object->getLibType(); + if ($object->type == FactureFournisseur::TYPE_REPLACEMENT) + { + $facreplaced=new FactureFournisseur($db); + $facreplaced->fetch($object->fk_facture_source); + print ' ('.$langs->transnoentities("ReplaceInvoice",$facreplaced->getNomUrl(1)).')'; + } + if ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE) + { + $facusing=new FactureFournisseur($db); + $facusing->fetch($object->fk_facture_source); + print ' ('.$langs->transnoentities("CorrectInvoice",$facusing->getNomUrl(1)).')'; + } + + $facidavoir=$object->getListIdAvoirFromInvoice(); + if (count($facidavoir) > 0) + { + print ' ('.$langs->transnoentities("InvoiceHasAvoir"); + $i=0; + foreach($facidavoir as $fid) + { + if ($i==0) print ' '; + else print ','; + $facavoir=new FactureFournisseur($db); + $facavoir->fetch($fid); + print $facavoir->getNomUrl(1); + } + print ')'; + } + if ($facidnext > 0) + { + $facthatreplace=new FactureFournisseur($db); + $facthatreplace->fetch($facidnext); + print ' ('.$langs->transnoentities("ReplacedByInvoice",$facthatreplace->getNomUrl(1)).')'; + } + print '
'.$form->editfieldkey("Label",'label',$object->label,$object,0).''; + print $form->editfieldval("Label",'label',$object->label,$object,0); + print '
"; - print ''; + dol_fiche_end(); print '
'; diff --git a/htdocs/fourn/facture/document.php b/htdocs/fourn/facture/document.php index 79c826a85e9..d47433af4f5 100644 --- a/htdocs/fourn/facture/document.php +++ b/htdocs/fourn/facture/document.php @@ -168,8 +168,36 @@ if ($object->id > 0) print $form->editfieldval("Label",'label',$object->label,$object,0); print '
'.$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).'
'.$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).'

'; + + print ''; + // Nb of files - print ''; + print ''; print ''; diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php index 74cc1bd486d..4f8d6700e35 100644 --- a/htdocs/fourn/facture/fiche.php +++ b/htdocs/fourn/facture/fiche.php @@ -7,6 +7,7 @@ * Copyright (C) 2010-2014 Juanjo Menent * Copyright (C) 2013 Philippe Grand * Copyright (C) 2013 Florian Henry + * 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 @@ -52,8 +53,6 @@ $langs->load('companies'); $langs->load('products'); $langs->load('banks'); -$mesg=''; -$errors=array(); $id = (GETPOST('facid','int') ? GETPOST('facid','int') : GETPOST('id','int')); $action = GETPOST("action"); $confirm = GETPOST("confirm"); @@ -87,17 +86,20 @@ $permissionnote=$user->rights->fournisseur->facture->creer; // Used by the inclu * Actions */ +$parameters=array('socid'=>$socid); +$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks + include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not includ_once // Action clone object if ($action == 'confirm_clone' && $confirm == 'yes') { - if (1==0 && empty($_REQUEST["clone_content"]) && empty($_REQUEST["clone_receivers"])) - { - $mesg='
'.$langs->trans("NoCloneOptionsSpecified").'
'; - } - else - { +// if (1==0 && empty($_REQUEST["clone_content"]) && empty($_REQUEST["clone_receivers"])) +// { +// $mesg='
'.$langs->trans("NoCloneOptionsSpecified").'
'; +// } +// else +// { $result=$object->createFromClone($id); if ($result > 0) { @@ -107,10 +109,10 @@ if ($action == 'confirm_clone' && $confirm == 'yes') else { $langs->load("errors"); - $mesg='
'.$langs->trans($object->error).'
'; + setEventMessage($langs->trans($object->error), 'errors'); $action=''; } - } +// } } elseif ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->fournisseur->facture->valider) @@ -137,7 +139,7 @@ elseif ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->fourni if (! $idwarehouse || $idwarehouse == -1) { $error++; - $errors[]=$langs->trans('ErrorFieldRequired',$langs->transnoentitiesnoconv("Warehouse")); + setEventMessage($langs->trans('ErrorFieldRequired',$langs->transnoentitiesnoconv("Warehouse")), 'errors'); $action=''; } } @@ -165,7 +167,7 @@ elseif ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->fourn } else { - $mesg='
'.$object->error.'
'; + setEventMessage($object->error, 'errors'); } } @@ -180,7 +182,7 @@ elseif ($action == 'confirm_delete_line' && $confirm == 'yes' && $user->rights-> } else { - $mesg='
'.$object->error.'
'; + setEventMessage($object->error, 'errors'); /* Fix bug 1485 : Reset action to avoid asking again confirmation on failure */ $action=''; } @@ -215,6 +217,10 @@ else if ($action == 'setmode' && $user->rights->fournisseur->commande->creer) $result = $object->setPaymentMethods(GETPOST('mode_reglement_id','int')); } +// bank account +else if ($action == 'setbankaccount' && $user->rights->fournisseur->facture->creer) { + $result=$object->setBankAccount(GETPOST('fk_account', 'int')); +} // Set label elseif ($action == 'setlabel' && $user->rights->fournisseur->facture->creer) @@ -254,7 +260,9 @@ elseif ($action == 'deletepaiement' && $user->rights->fournisseur->facture->cree $paiementfourn = new PaiementFourn($db); $result=$paiementfourn->fetch(GETPOST('paiement_id')); if ($result > 0) $result=$paiementfourn->delete(); // If fetch ok and found - if ($result < 0) $mesg='
'.$paiementfourn->error.'
'; + if ($result < 0) { + setEventMessage($paiementfourn->error, 'errors'); + } } } @@ -268,21 +276,21 @@ elseif ($action == 'add' && $user->rights->fournisseur->facture->creer) if (GETPOST('socid','int')<1) { - $mesg='
'.$langs->trans('ErrorFieldRequired',$langs->transnoentities('Supplier')).'
'; + setEventMessage($langs->trans('ErrorFieldRequired',$langs->transnoentities('Supplier')), 'errors'); $action='create'; $error++; } if ($datefacture == '') { - $mesg='
'.$langs->trans('ErrorFieldRequired',$langs->transnoentities('DateInvoice')).'
'; + setEventMessage($langs->trans('ErrorFieldRequired',$langs->transnoentities('DateInvoice')), 'errors'); $action='create'; $_GET['socid']=$_POST['socid']; $error++; } if (! GETPOST('ref_supplier')) { - $mesg='
'.$langs->trans('ErrorFieldRequired',$langs->transnoentities('RefSupplier')).'
'; + setEventMessage($langs->trans('ErrorFieldRequired',$langs->transnoentities('RefSupplier')), 'errors'); $action='create'; $_GET['socid']=$_POST['socid']; $error++; @@ -305,6 +313,7 @@ elseif ($action == 'add' && $user->rights->fournisseur->facture->creer) $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; // Auto calculation of date due if not filled by user @@ -452,7 +461,7 @@ elseif ($action == 'add' && $user->rights->fournisseur->facture->creer) { $langs->load("errors"); $db->rollback(); - $mesg='
'.$langs->trans($object->error).'
'; + setEventMessage($langs->trans($object->error), 'errors'); $action='create'; $_GET['socid']=$_POST['socid']; } @@ -626,14 +635,14 @@ elseif ($action == 'addline' && $user->rights->fournisseur->facture->creer) // Product not selected $error++; $langs->load("errors"); - $mesg='
'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("ProductOrService")).'
'; + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("ProductOrService")), 'errors'); } if ($idprod == -1) { // Quantity too low $error++; $langs->load("errors"); - $mesg='
'.$langs->trans("ErrorQtyTooLowForThisSupplier").'
'; + setEventMessage($langs->trans("ErrorQtyTooLowForThisSupplier"), 'errors'); } } else if( GETPOST('price_ht')!=='' || GETPOST('price_ttc')!=='' ) @@ -658,7 +667,7 @@ elseif ($action == 'addline' && $user->rights->fournisseur->facture->creer) $price_base_type = 'HT'; //print $product_desc, $pu, $txtva, $qty, $fk_product=0, $remise_percent=0, $date_start='', $date_end='', $ventil=0, $info_bits='', $price_base_type='HT', $type=0 - $result=$object->addline($product_desc, $ht, $tva_tx, $localtax1tx, $localtax2tx, $qty, 0, $remise_percent, $datestart, $dateend, 0, $npr, $price_base_type, $type); + $result=$object->addline($product_desc, $ht, $tva_tx, $localtax1_tx, $localtax2_tx, $qty, 0, $remise_percent, $datestart, $dateend, 0, $npr, $price_base_type, $type); } else { @@ -666,7 +675,7 @@ elseif ($action == 'addline' && $user->rights->fournisseur->facture->creer) $ht = $ttc / (1 + ($tva_tx / 100)); $price_base_type = 'HT'; //print $product_desc, $pu, $txtva, $qty, $fk_product=0, $remise_percent=0, $date_start='', $date_end='', $ventil=0, $info_bits='', $price_base_type='HT', $type=0 - $result=$object->addline($product_desc, $ht, $tva_tx,$localtax1tx, $localtax2tx, $qty, 0, $remise_percent, $datestart, $dateend, 0, $npr, $price_base_type, $type); + $result=$object->addline($product_desc, $ht, $tva_tx,$localtax1_tx, $localtax2_tx, $qty, 0, $remise_percent, $datestart, $dateend, 0, $npr, $price_base_type, $type); } } @@ -727,10 +736,7 @@ elseif ($action == 'addline' && $user->rights->fournisseur->facture->creer) else { $db->rollback(); - if (empty($mesg)) - { - $mesg='
'.$object->error.'
'; - } + setEventMessage($object->error, 'errors'); } $action = ''; @@ -793,11 +799,18 @@ elseif ($action == 'reopen' && $user->rights->fournisseur->facture->creer) } else { - $mesg='
'.$object->error.'
'; + setEventMessage($object->error, 'errors'); } } } +// Link invoice to order +if (GETPOST('linkedOrder')) { + $object->fetch($id); + $object->fetch_thirdparty(); + $result = $object->add_object_linked('commande', GETPOST('linkedOrder')); +} + // Add file in email form if (GETPOST('addfile')) { @@ -943,7 +956,6 @@ if ($action == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile'] && ! $_P else { $langs->load("other"); - $mesg='
'; if ($mailfile->error) { $mesg.=$langs->trans('ErrorFailedToSendMail',$from,$sendto); @@ -953,7 +965,7 @@ if ($action == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile'] && ! $_P { $mesg.='No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS'; } - $mesg.='
'; + setEventMessage($mesg, 'errors'); } } } @@ -961,7 +973,7 @@ if ($action == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile'] && ! $_P else { $langs->load("other"); - $mesg='
'.$langs->trans('ErrorMailRecipientIsEmpty').'
'; + setEventMessage($langs->trans('ErrorMailRecipientIsEmpty'), 'errors'); dol_syslog('Recipient email is empty'); } /* } @@ -975,7 +987,7 @@ if ($action == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile'] && ! $_P else { $langs->load("other"); - $mesg='
'.$langs->trans('ErrorFailedToReadEntity',$langs->trans("Invoice")).'
'; + setEventMessage($langs->trans('ErrorFailedToReadEntity',$langs->trans("Invoice")), 'errors'); dol_syslog('Unable to read data from the invoice. The invoice file has perhaps not been generated.'); } @@ -1059,11 +1071,11 @@ if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->fourniss if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $langs->load("errors"); - $mesg = '
'.$langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType").'
'; + setEventMessage($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), 'errors'); } else { - $mesg = '
'.$object->error.'
'; + setEventMessage($object->error, 'errors'); } } } @@ -1114,7 +1126,6 @@ if ($action == 'create') { print_fiche_titre($langs->trans('NewBill')); - dol_htmloutput_mesg($mesg); dol_htmloutput_events(); $societe=''; @@ -1141,7 +1152,6 @@ if ($action == 'create') $element = $subelement = 'commande'; } if ($element == 'propal') { - dol_htmloutput_errors('',$errors); $element = 'comm/propal'; $subelement = 'propal'; } if ($element == 'contract') { @@ -1164,6 +1174,7 @@ if ($action == 'create') $soc = $objectsrc->thirdparty; $cond_reglement_id = (!empty($objectsrc->cond_reglement_id)?$objectsrc->cond_reglement_id:(!empty($soc->cond_reglement_supplier_id)?$soc->cond_reglement_supplier_id:1)); $mode_reglement_id = (!empty($objectsrc->mode_reglement_id)?$objectsrc->mode_reglement_id:(!empty($soc->mode_reglement_supplier_id)?$soc->mode_reglement_supplier_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)); $remise_absolue = (!empty($objectsrc->remise_absolue)?$objectsrc->remise_absolue:(!empty($soc->remise_absolue)?$soc->remise_absolue:0)); $dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''; @@ -1178,6 +1189,7 @@ if ($action == 'create') { $cond_reglement_id = $societe->cond_reglement_supplier_id; $mode_reglement_id = $societe->mode_reglement_supplier_id; + $fk_account = $societe->fk_account; $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']); @@ -1320,6 +1332,11 @@ if ($action == 'create') $form->select_types_paiements(isset($_POST['mode_reglement_id'])?$_POST['mode_reglement_id']:$mode_reglement_id,'mode_reglement_id'); print ''; + // Bank Account + print '
'; + // Public note print ''; print '"; if ($mysoc->country_code=='ES') { - if ($mysoc->localtax1_assuj=="1") //Localtax1 RE + if ($mysoc->localtax1_assuj=="1" || $object->total_localtax1 != 0) //Localtax1 { print '"; } - if ($mysoc->localtax2_assuj=="1") //Localtax2 IRPF + if ($mysoc->localtax2_assuj=="1" || $object->total_localtax2 != 0) //Localtax2 { print '"; } @@ -1457,13 +1474,10 @@ else dol_fiche_head($head, 'card', $titre, 0, 'bill'); - dol_htmloutput_mesg($mesg); - dol_htmloutput_errors('',$errors); - // Confirmation de la suppression d'une ligne produit if ($action == 'confirm_delete_line') { - print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$_GET["lineid"], $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_delete_line', '', 1, 1); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$_GET["lineid"], $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_delete_line', '', 1, 1); } // Clone confirmation @@ -1475,7 +1489,7 @@ else //array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1) ); // Paiement incomplet. On demande si motif = escompte ou autre - print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id,$langs->trans('CloneInvoice'),$langs->trans('ConfirmCloneInvoice',$object->ref),'confirm_clone',$formquestion,'yes', 1); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id,$langs->trans('CloneInvoice'),$langs->trans('ConfirmCloneInvoice',$object->ref),'confirm_clone',$formquestion,'yes', 1); } // Confirmation de la validation @@ -1531,24 +1545,32 @@ else array('type' => 'other', 'name' => 'idwarehouse', 'label' => $langs->trans("SelectWarehouseForStockIncrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse'),'idwarehouse','',1))); } - print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateBill'), $text, 'confirm_valid', $formquestion, 1, 1, 240); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateBill'), $text, 'confirm_valid', $formquestion, 1, 1, 240); } // Confirmation set paid if ($action == 'paid') { - print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ClassifyPaid'), $langs->trans('ConfirmClassifyPaidBill', $object->ref), 'confirm_paid', '', 0, 1); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ClassifyPaid'), $langs->trans('ConfirmClassifyPaidBill', $object->ref), 'confirm_paid', '', 0, 1); } // Confirmation de la suppression de la facture fournisseur if ($action == 'delete') { - print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteBill'), $langs->trans('ConfirmDeleteBill'), 'confirm_delete', '', 0, 1); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteBill'), $langs->trans('ConfirmDeleteBill'), 'confirm_delete', '', 0, 1); } + if (!$formconfirm) { + $parameters=array('lineid'=>$lineid); + $formconfirm=$hookmanager->executeHooks('formConfirm',$parameters,$object,$action); // Note that $action and $object may have been modified by hook + } + + // Print form confirm + print $formconfirm; + /** * Invoice @@ -1621,19 +1643,12 @@ else */ $nbrows=9; $nbcols=2; if (! empty($conf->projet->enabled)) $nbrows++; - if (! empty($conf->banque->enabled)) $nbcols++; + if (! empty($conf->banque->enabled)) { $nbrows++; $nbcols++; } // Local taxes - if ($mysoc->country_code=='ES') - { - if($mysoc->localtax1_assuj=="1") $nbrows++; - if($societe->localtax2_assuj=="1") $nbrows++; - } - else - { - if ($societe->localtax1_assuj=="1") $nbrows++; - if ($societe->localtax2_assuj=="1") $nbrows++; - } + if ($societe->localtax1_assuj=="1") $nbrows++; + if ($societe->localtax2_assuj=="1") $nbrows++; + print ''; + // Bank Account + print '"; + print ''; + // Status $alreadypaid=$object->getSommePaiement(); print ''; @@ -1792,35 +1824,17 @@ else // Amount Local Taxes //TODO: Place into a function to control showing by country or study better option - if ($mysoc->country_code=='ES') + if ($societe->localtax1_assuj=="1") //Localtax1 { - if ($mysoc->localtax1_assuj=="1") //Localtax1 RE - { - print ''; - print ''; - print ''; - } - if ($societe->localtax2_assuj=="1") //Localtax2 IRPF - { - print ''; - print ''; - print ''; - } + print ''; + print ''; + print ''; } - else - { - if ($societe->localtax1_assuj=="1") //Localtax1 RE - { - print ''; - print ''; - print ''; - } - if ($societe->localtax2_assuj=="1") //Localtax2 IRPF - { - print ''; - print ''; - print ''; - } + if ($societe->localtax2_assuj=="1") //Localtax2 + { + print ''; + print ''; + print ''; } print ''; @@ -2146,7 +2160,7 @@ else // Make payments if ($action != 'edit' && $object->statut == 1 && $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 @@ -2216,6 +2230,69 @@ else */ $somethingshown=$object->showLinkedObjectBlock(); + if (empty($somethingshown) && ! empty($conf->fournisseur->enabled)) + { + print '
' . $langs->trans('LinkedOrder') . ''; + + print ' + + '; + + print '
'.$langs->trans('NbOfAttachedFiles').''.count($filearray).'
'.$langs->trans('NbOfAttachedFiles').''.count($filearray).'
'.$langs->trans('TotalSizeOfAttachedFiles').''.$totalsize.' '.$langs->trans('bytes').'
'.$langs->trans('BankAccount').''; + $form->select_comptes($fk_account, 'fk_account', 0, '', 1); + print '
'.$langs->trans('NotePublic').''; @@ -1358,12 +1375,12 @@ if ($action == 'create') print '
'.$langs->trans('TotalVAT').''.price($objectsrc->total_tva)."
'.$langs->transcountry("AmountLT1",$mysoc->country_code).''.price($objectsrc->total_localtax1)."
'.$langs->transcountry("AmountLT2",$mysoc->country_code).''.price($objectsrc->total_localtax2)."
'; $sql = 'SELECT p.datep as dp, p.num_paiement, p.rowid, p.fk_bank,'; @@ -1773,6 +1788,23 @@ else } print '
'; + print ''; + print '
'; + print $langs->trans('BankAccount'); + print ''; + if ($action != 'editbankaccount' && $user->rights->fournisseur->facture->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 "
'.$langs->trans('Status').''.$object->getLibStatut(4,$alreadypaid).'
'.$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->transcountry("AmountLT1",$societe->country_code).''.price($object->total_localtax1,1,$langs,0,-1,-1,$conf->currency).' 
'.$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->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).' 
'; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + while ($i < $num) { + $objp = $db->fetch_object($resqlorderlist); + if ($objp->socid == $societe->id) { + $var = ! $var; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + } + + $i ++; + } + print '
' . $langs->trans("Ref") . '' . $langs->trans("RefSupplier") . '' . $langs->trans("AmountHTShort") . '' . $langs->trans("Company") . '
'; + print ''; + print '' . $objp->ref . '' . $objp->ref_supplier . '' . price($objp->total_ht) . '' . $objp->name . '
'; + print '
'; + print ''; + $db->free($resqlorderlist); + } else { + dol_print_error($db); + } + + print ''; + } + print '
'; //print '
'; //print '
'; @@ -2239,20 +2316,24 @@ else $fileparams = dol_most_recent_file($conf->fournisseur->facture->dir_output.'/'.get_exdir($object->id,2).$ref, preg_quote($ref,'/')); $file=$fileparams['fullname']; + // Define output language + $outputlangs = $langs; + $newlang = ''; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) + $newlang = $_REQUEST['lang_id']; + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) + $newlang = $object->client->default_lang; + + if (!empty($newlang)) + { + $outputlangs = new Translate('', $conf); + $outputlangs->setDefaultLang($newlang); + $outputlangs->load('bills'); + } + // Build document if it not exists if (! $file || ! is_readable($file)) { - // Define output language - $outputlangs = $langs; - $newlang=''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id']; - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang; - if (! empty($newlang)) - { - $outputlangs = new Translate("",$conf); - $outputlangs->setDefaultLang($newlang); - } - $result=supplier_invoice_pdf_create($db, $object, GETPOST('model')?GETPOST('model'):$object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); if ($result <= 0) { @@ -2269,6 +2350,7 @@ else // Cree l'objet formulaire mail 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); @@ -2279,7 +2361,7 @@ else $formmail->withto=GETPOST("sendto")?GETPOST("sendto"):$liste; $formmail->withtocc=$liste; $formmail->withtoccc=$conf->global->MAIN_EMAIL_USECCC; - $formmail->withtopic=$langs->trans('SendBillRef','__FACREF__'); + $formmail->withtopic=$outputlangs->trans('SendBillRef','__FACREF__'); $formmail->withfile=2; $formmail->withbody=1; $formmail->withdeliveryreceipt=1; diff --git a/htdocs/fourn/facture/index.html b/htdocs/fourn/facture/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/fourn/facture/index.php b/htdocs/fourn/facture/index.php deleted file mode 100644 index 7db0dd9ebf9..00000000000 --- a/htdocs/fourn/facture/index.php +++ /dev/null @@ -1 +0,0 @@ -Url not available \ No newline at end of file diff --git a/htdocs/fourn/facture/note.php b/htdocs/fourn/facture/note.php index d5654c9215c..7d68a3c5a95 100644 --- a/htdocs/fourn/facture/note.php +++ b/htdocs/fourn/facture/note.php @@ -21,8 +21,8 @@ /** * \file htdocs/fourn/facture/note.php * \ingroup facture -* \brief Fiche de notes sur une facture fournisseur -*/ + * \brief Fiche de notes sur une facture fournisseur + */ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/fourn.lib.php'; @@ -137,7 +137,7 @@ if ($object->id > 0) // Label print '
'.$form->editfieldkey("Label",'label',$object->label,$object,0).''; print $form->editfieldval("Label",'label',$object->label,$object,0); - print '
"; diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php index 7b443bf15c0..c66a03382de 100644 --- a/htdocs/fourn/facture/paiement.php +++ b/htdocs/fourn/facture/paiement.php @@ -5,6 +5,7 @@ * Copyright (C) 2004 Christophe Combelles * Copyright (C) 2005 Marc Barilley / Ocebo * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2014 Teddy Andreotti <125155@supinfo.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -328,9 +329,19 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie { $i = 0; print '
'; - print $langs->trans('Invoices').'
'; - print ''; + + if(!empty($conf->global->FAC_AUTO_FILLJS)){ + //Add js for AutoFill + print "\n".''."\n"; + } + print '
'; print ''; print ''; print ''; @@ -370,8 +381,10 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie print ''; print '\n"; + print "\n"; $total+=$objp->total_ht; $total_ttc+=$objp->total_ttc; $totalrecu+=$objp->am; @@ -503,9 +516,6 @@ if (empty($action)) print_barre_liste($langs->trans('SupplierPayments'), $page, 'paiement.php',$paramlist,$sortfield,$sortorder,'',$num); - if ($mesg) dol_htmloutput_mesg($mesg); - if ($errmsg) dol_htmloutput_errors($errmsg); - print ''; print '
'.$langs->trans('Ref').''.$langs->trans('RefSupplier').''.price($objp->total_ttc - $objp->am).''; $namef = 'amount_'.$objp->facid; + if(!empty($conf->global->FAC_AUTO_FILLJS)) + print img_picto("Auto fill",'rightarrow', "class='AutoFillAmout' data-rowname='".$namef."' data-value='".($objp->total_ttc - $objp->am)."'"); print ''; - print "
'; print ''; diff --git a/htdocs/fourn/facture/tpl/index.html b/htdocs/fourn/facture/tpl/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/fourn/fiche.php b/htdocs/fourn/fiche.php index 127dcfdcc8c..11e505334cd 100644 --- a/htdocs/fourn/fiche.php +++ b/htdocs/fourn/fiche.php @@ -3,7 +3,7 @@ * Copyright (C) 2003 Eric Seigne * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2005-2010 Regis Houssin - * Copyright (C) 2010-2013 Juanjo Menent + * Copyright (C) 2010-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,6 +52,9 @@ $object = new Fournisseur($db); * Action */ +$parameters=array('socid'=>$socid); +$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks + if ($action == 'setsupplieraccountancycode') { $result=$object->fetch($id); @@ -166,38 +169,26 @@ if ($object->fetch($id)) print ''; // Local Taxes - //TODO: Place into a function to control showing by country or study better option - if($mysoc->country_code=='ES') + if($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj=="1") { - if($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj=="1") - { - print ''; - print ''; - } - elseif($mysoc->localtax1_assuj=="1") - { - print ''; - } - elseif($mysoc->localtax2_assuj=="1") - { - print ''; - } - - if ($mysoc->localtax2_assuj!="1") - { - print ''; - } - + print ''; + print ''; + } + elseif($mysoc->localtax1_assuj=="1") + { + print ''; + } + elseif($mysoc->localtax2_assuj=="1") + { + print ''; } // TVA Intra diff --git a/htdocs/fourn/liste.php b/htdocs/fourn/liste.php index 81837feb41f..341f3ffca54 100644 --- a/htdocs/fourn/liste.php +++ b/htdocs/fourn/liste.php @@ -118,7 +118,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) $sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($conf->liste_limit+1, $offset); -dol_syslog('fourn/liste.php: sql='.$sql,LOG_DEBUG); +dol_syslog('fourn/liste.php:', LOG_DEBUG); $resql = $db->query($sql); if ($resql) { diff --git a/htdocs/fourn/paiement/fiche.php b/htdocs/fourn/paiement/fiche.php index 9a38e16f7f4..32edf72a2ad 100644 --- a/htdocs/fourn/paiement/fiche.php +++ b/htdocs/fourn/paiement/fiche.php @@ -36,8 +36,6 @@ $langs->load('banks'); $langs->load('companies'); $langs->load("suppliers"); -$mesg=''; - $id = GETPOST('id','int'); $action = GETPOST('action','alpha'); $confirm = GETPOST('confirm','alpha'); @@ -61,7 +59,7 @@ if ($action == 'setnote' && $user->rights->fournisseur->facture->creer) } else { - $mesg='
'.$object->error.'
'; + setEventMessage($object->error, 'errors'); $db->rollback(); } } @@ -80,7 +78,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->fournisse } else { - $mesg='
'.$object->error.'
'; + setEventMessage($object->error, 'errors'); $db->rollback(); } } @@ -98,7 +96,7 @@ if ($action == 'confirm_valide' && $confirm == 'yes' && $user->rights->fournisse } else { - $mesg='
'.$object->error.'
'; + setEventMessage($object->error, 'errors'); $db->rollback(); } } @@ -109,11 +107,11 @@ if ($action == 'setnum_paiement' && ! empty($_POST['num_paiement'])) $res = $object->update_num($_POST['num_paiement']); if ($res === 0) { - $mesg = '
'.$langs->trans('PaymentNumberUpdateSucceeded').'
'; + $setEventMessage($langs->trans('PaymentNumberUpdateSucceeded')); } else { - $mesg = '
'.$langs->trans('PaymentNumberUpdateFailed').'
'; + setEventMessage($langs->trans('PaymentNumberUpdateFailed'), 'errors'); } } @@ -124,11 +122,11 @@ if ($action == 'setdatep' && ! empty($_POST['datepday'])) $res = $object->update_date($datepaye); if ($res === 0) { - $mesg = '
'.$langs->trans('PaymentDateUpdateSucceeded').'
'; + setEventMessage($langs->trans('PaymentDateUpdateSucceeded')); } else { - $mesg = '
'.$langs->trans('PaymentDateUpdateFailed').'
'; + setEventMessage($langs->trans('PaymentDateUpdateFailed'), 'errors'); } } @@ -229,8 +227,6 @@ if ($result > 0) print '
'.$langs->trans('LocalTax1IsUsedES').''; - print yn($object->localtax1_assuj); - print '
'.$langs->trans('LocalTax2IsUsedES').''; - print yn($object->localtax2_assuj); - print '
'.$langs->trans("LocalTax1IsUsedES").''; - print yn($object->localtax1_assuj); - print '
'.$langs->trans("LocalTax2IsUsedES").''; - print yn($object->localtax2_assuj); - print '
'.$langs->transcountry("LocalTax2IsUsed",$mysoc->country_code).''; - print yn($object->localtax2_assuj); - print '
'.$langs->trans('LocalTax1IsUsedES').''; + print yn($object->localtax1_assuj); + print '
'.$langs->trans('LocalTax2IsUsedES').''; + print yn($object->localtax2_assuj); + print '
'.$langs->trans("LocalTax1IsUsedES").''; + print yn($object->localtax1_assuj); + print '
'.$langs->trans("LocalTax2IsUsedES").''; + print yn($object->localtax2_assuj); + print '
'; - dol_htmloutput_mesg($mesg); - print '
'; /** diff --git a/htdocs/fourn/paiement/index.html b/htdocs/fourn/paiement/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/fourn/paiement/index.php b/htdocs/fourn/paiement/index.php deleted file mode 100644 index 7db0dd9ebf9..00000000000 --- a/htdocs/fourn/paiement/index.php +++ /dev/null @@ -1 +0,0 @@ -Url not available \ No newline at end of file diff --git a/htdocs/fourn/product/categorie.php b/htdocs/fourn/product/categorie.php index ad46210ed3b..b2d353046df 100644 --- a/htdocs/fourn/product/categorie.php +++ b/htdocs/fourn/product/categorie.php @@ -52,14 +52,14 @@ if ($_GET["id"]) //on veut supprimer une cat�gorie if ($_REQUEST["cat"]) { - $cat = new Categorie($db,$_REQUEST["cat"]); + $cat = new Categorie($db); $cat->del_product($product); } //on veut ajouter une cat�gorie if (isset($_REQUEST["add_cat"]) && $_REQUEST["add_cat"]>=0) { - $cat = new Categorie($db,$_REQUEST["add_cat"]); + $cat = new Categorie($db); $cat->add_product($product); } diff --git a/htdocs/fourn/product/liste.php b/htdocs/fourn/product/liste.php index ffd413cbf2f..c8911837a40 100644 --- a/htdocs/fourn/product/liste.php +++ b/htdocs/fourn/product/liste.php @@ -121,7 +121,7 @@ if ($fourn_id > 0) $sql .= " ORDER BY ".$sortfield." ".$sortorder; $sql .= $db->plimit($limit + 1, $offset); -dol_syslog("fourn/product/liste.php: sql=".$sql); +dol_syslog("fourn/product/liste.php:", LOG_DEBUG); $resql = $db->query($sql); if ($resql) { @@ -149,7 +149,7 @@ if ($resql) if (isset($catid)) { print "
"; - $c = new Categorie($db, $catid); + $c = new Categorie($db); $ways = $c->print_all_ways(' > ','fourn/product/liste.php'); print " > ".$ways[0]."
\n"; print "

"; diff --git a/htdocs/ftp/admin/ftpclient.php b/htdocs/ftp/admin/ftpclient.php index 1ff142f7be7..1b252c480af 100644 --- a/htdocs/ftp/admin/ftpclient.php +++ b/htdocs/ftp/admin/ftpclient.php @@ -58,18 +58,17 @@ if ($action == 'add' || GETPOST('modify','alpha')) $ftp_server = "FTP_SERVER_" . $entry; //$_POST["numero_entry"]; $error=0; - $mesg=''; if (! GETPOST("$ftp_name",'alpha')) { $error=1; - $mesg.='
'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Label")).'
'; + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Label")), 'errors'); } if (! GETPOST("$ftp_server",'alpha')) { $error=1; - $mesg.='
'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Server")).'
'; + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Server")), 'errors'); } if (! $error) @@ -91,7 +90,6 @@ if ($action == 'add' || GETPOST('modify','alpha')) if ($result1 && $result2 && $result3 && $result4 && $result5 && $result6) { $db->commit(); - //$mesg='
'.$langs->trans("Success").'
'; header("Location: ".$_SERVER["PHP_SELF"]); exit; } @@ -119,7 +117,6 @@ if (GETPOST('delete','alpha')) if ($result1 && $result2 && $result3 && $result4 && $result5 && $result6) { $db->commit(); - //$mesg='
'.$langs->trans("Success").'
'; header("Location: ".$_SERVER["PHP_SELF"]); exit; } @@ -218,7 +215,7 @@ else $sql.=" WHERE name like 'FTP_SERVER_%'"; $sql.=" ORDER BY name"; - dol_syslog("ftpclient select ftp setup sql=".$sql,LOG_DEBUG); + dol_syslog("ftpclient select ftp setup", LOG_DEBUG); $resql=$db->query($sql); if ($resql) { @@ -301,9 +298,6 @@ else } -dol_htmloutput_mesg($mesg); - - llxFooter(); $db->close(); diff --git a/htdocs/ftp/admin/index.html b/htdocs/ftp/admin/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/ftp/index.php b/htdocs/ftp/index.php index 0c72bcc1b1a..f1a051bcf2a 100644 --- a/htdocs/ftp/index.php +++ b/htdocs/ftp/index.php @@ -100,8 +100,6 @@ if ( $_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC)) $resupload = dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . dol_unescapefile($_FILES['userfile']['name']),0); if (is_numeric($resupload) && $resupload > 0) { - //$mesg = '
'.$langs->trans("FileTransferComplete").'
'; - //print_r($_FILES); $result=$ecmdir->changeNbOfFiles('+'); } else { @@ -124,7 +122,7 @@ if ( $_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC)) { // Echec transfert (fichier depassant la limite ?) $langs->load("errors"); - $mesg = '
'.$langs->trans("ErrorFailToCreateDir",$upload_dir).'
'; + setEventMessage($langs->trans("ErrorFailToCreateDir",$upload_dir), 'errors'); } } @@ -143,7 +141,8 @@ if ($_POST["action"] == 'add' && $user->rights->ftp->setup) } else { - $mesg='
Error '.$langs->trans($ecmdir->error).'
'; + //TODO: Translate + setEventMessage('Error '.$langs->trans($ecmdir->error)); $_GET["action"] = "create"; } } @@ -175,12 +174,12 @@ if ($_REQUEST['action'] == 'confirm_deletefile' && $_REQUEST['confirm'] == 'yes' $result=@ftp_delete($conn_id, $newremotefileiso); if ($result) { - $mesg = '
'.$langs->trans("FileWasRemoved",$file).'
'; + setEventMessage($langs->trans("FileWasRemoved",$file)); } else { dol_syslog("ftp/index.php ftp_delete", LOG_ERR); - $mesg = '
'.$langs->trans("FTPFailedToRemoveFile",$file).'
'; + setEventMessage($langs->trans("FTPFailedToRemoveFile",$file), 'errors'); } //ftp_close($conn_id); Close later @@ -225,12 +224,12 @@ if ($_POST["const"] && $_POST["delete"] && $_POST["delete"] == $langs->trans("De $result=@ftp_delete($conn_id, $newremotefileiso); if ($result) { - $mesg .= '
'.$langs->trans("FileWasRemoved",$file).'
'; + setEventMessage($langs->trans("FileWasRemoved",$file)); } else { dol_syslog("ftp/index.php ftp_delete", LOG_ERR); - $mesg .= '
'.$langs->trans("FTPFailedToRemoveFile",$file).'
'; + setEventMessage($langs->trans("FTPFailedToRemoveFile",$file), 'errors'); } //ftp_close($conn_id); Close later @@ -269,11 +268,11 @@ if ($_REQUEST['action'] == 'confirm_deletesection' && $_REQUEST['confirm'] == 'y $result=@ftp_rmdir($conn_id, $newremotefileiso); if ($result) { - $mesg = '
'.$langs->trans("DirWasRemoved",$file).'
'; + setEventMessage($langs->trans("DirWasRemoved",$file)); } else { - $mesg = '
'.$langs->trans("FTPFailedToRemoveDir",$file).'
'; + setEventMessage($langs->trans("FTPFailedToRemoveDir",$file), 'errors'); } //ftp_close($conn_id); Close later @@ -340,7 +339,8 @@ if ($_REQUEST['action'] == 'download') } else { - $mesg='
Failed to get file '.$remotefile.'
'; + //TODO: Translate + setEventMessage('Failed to get file '.$remotefile, 'errors'); } } @@ -444,9 +444,6 @@ else print '
'; print "
\n"; - if ($mesg) { print $mesg."
"; } - - print ''; print ''; print ''; @@ -596,9 +593,6 @@ else print "
"; - - if (! $ok && $mesg) print $mesg; - // Actions /* if ($user->rights->ftp->write && ! empty($section)) diff --git a/htdocs/holiday/admin/holiday.php b/htdocs/holiday/admin/holiday.php index 2b265711fa1..1986ae1cdf7 100644 --- a/htdocs/holiday/admin/holiday.php +++ b/htdocs/holiday/admin/holiday.php @@ -59,7 +59,6 @@ $cp = new Holiday($db); // Contrôle du formulaire if ($action == "add") { - $message = ''; $error = 0; // Option du groupe de validation @@ -142,9 +141,9 @@ if ($action == "add") if ($error) { - $message = '
'.$langs->trans('ErrorUpdateConfCP').'
'; + setEventMessage($langs->trans('ErrorUpdateConfCP'), 'errors'); } else { - $message = '
'.$langs->trans('UpdateConfCPOK').'
'; + setEventMessage($langs->trans('UpdateConfCPOK')); } // Si première mise à jour, prévenir l'utilisateur de mettre à jour le solde des congés payés @@ -156,12 +155,9 @@ if ($action == "add") if($num < 1) { $cp->createCPusers(); - $message.= '
'.$langs->trans('AddCPforUsers').'
'; + setEventMessage($langs->trans('AddCPforUsers'), 'warnings'); } - dol_htmloutput_mesg($message); - - // Si il s'agit de créer un event } elseif ($action == 'create_event') @@ -173,12 +169,12 @@ elseif ($action == 'create_event') if (! $optName) { - $message='
'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Name")).'
'; + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Name")), 'errors'); $error++; } if (! $optValue > 0) { - $message='
'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Value")).'
'; + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Value")), 'errors'); $error++; } @@ -190,17 +186,15 @@ elseif ($action == 'create_event') $result = $cp->createEventCP($user); if($result > 0) { - $message = 'OkCreateEventCP'; + setEventMessage('OkCreateEventCP'); $optName=''; $optValue=''; } else { - $message = '
'.$cp->error.'
'; + setEventMessage($cp->error, 'errors'); } } - - dol_htmloutput_mesg($message); } elseif($action == 'event' && isset($_POST['update_event'])) { @@ -234,15 +228,13 @@ elseif($action == 'event' && isset($_POST['update_event'])) // Mise à jour des congés de l'utilisateur $update = $cp->updateEventCP($eventId,$eventName,$eventValue); if(!$update) { - $message='ErrorUpdateEventCP'; + setEventMessage('ErrorUpdateEventCP', 'errors'); } else { - $message='UpdateEventOkCP'; + setEventMessage('UpdateEventOkCP'); } } else { - $message='ErrorUpdateEventCP'; + setEventMessage('ErrorUpdateEventCP', 'errors'); } - - dol_htmloutput_mesg($message); } elseif($action && isset($_POST['delete_event'])) { @@ -365,15 +357,15 @@ if($cp_events == 1) { print ''."\n"; - foreach($cp->events as $infos_event) { - + foreach($cp->events as $infos_event) + { $var=!$var; print ''."\n"; print ''."\n"; print ' '.$langs->trans('DurationDays').''."\n"; print ''."\n"; - print ''."\n"; + print ''."\n"; print ''; $i++; diff --git a/htdocs/holiday/admin/index.html b/htdocs/holiday/admin/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/holiday/admin/tomergewithholiday.php b/htdocs/holiday/admin/tomergewithholiday.php new file mode 100755 index 00000000000..c301e1ba348 --- /dev/null +++ b/htdocs/holiday/admin/tomergewithholiday.php @@ -0,0 +1,225 @@ + + * Copyright (C) 2011 Dimitri Mouillard + * Copyright (C) 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 . + */ + +/** + * Page module configuration paid holiday. + * + * \file holiday.php + * \ingroup holiday + * \brief Page module configuration paid holiday. + */ + +require '../../main.inc.php'; +require DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php'; +require_once DOL_DOCUMENT_ROOT. '/core/class/html.form.class.php'; +require_once DOL_DOCUMENT_ROOT. '/user/class/user.class.php'; +require_once DOL_DOCUMENT_ROOT. '/user/class/usergroup.class.php'; + +// Si pas administrateur +if (! $user->admin) accessforbidden(); + + +/* + * View + */ + +// Vérification si module activé +if (empty($conf->holiday->enabled)) print $langs->trans('NotActiveModCP'); + +llxheader('',$langs->trans('TitleAdminCP')); + +print_fiche_titre($langs->trans('MenuCPTypes')); + +echo '
'; + +echo ''; +echo ''; +echo ''; +echo ''; +echo ''; +echo ''; +echo ''; +echo ''; +echo ''; +echo ''; + +$types = $db->query( + "SELECT * + FROM llx_congespayes_types + WHERE deleteAt IS NULL + ORDER BY label" +); + +while($type = $db->fetch_array($types)) +{ + echo' + + + + + + + + + + + + + '; +} + +echo ' + + + + + + +
' . $langs->trans('TypeLabel') . '' . $langs->trans('TypeDescription') . '' . $langs->trans('TypeAffect') . '' . $langs->trans('TypeDelay') . '' . $langs->trans('nbCongesDeductedCPMini') . '' . $langs->trans('nbCongesEveryMonthCPMini') . '
'.$type['label'].''.($type['description']?$type['description']:'N/A').' + '.($type['affect']?$langs->trans('TypeAffectYes'):$langs->trans('TypeAffectNo')).' + '.$type['delay'].''.$type['nbCongesDeducted'].''.$type['nbCongesEveryMonth'].' + + +
+ +
+ +'; + +echo '
'; + +llxFooter(); + +$db->close(); diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index 5398b398e6c..b88547729c1 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -137,7 +137,7 @@ class Holiday extends CommonObject $this->db->begin(); - dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::create", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); @@ -200,7 +200,7 @@ class Holiday extends CommonObject $sql.= " FROM ".MAIN_DB_PREFIX."holiday as cp"; $sql.= " WHERE cp.rowid = ".$id; - dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -238,7 +238,6 @@ class Holiday extends CommonObject else { $this->error="Error ".$this->db->lasterror(); - dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR); return -1; } } @@ -294,7 +293,7 @@ class Holiday extends CommonObject $sql.= $order; } - dol_syslog(get_class($this)."::fetchByUser sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetchByUser", LOG_DEBUG); $resql=$this->db->query($sql); // Si pas d'erreur SQL @@ -351,7 +350,6 @@ class Holiday extends CommonObject { // Erreur SQL $this->error="Error ".$this->db->lasterror(); - dol_syslog(get_class($this)."::fetchByUser ".$this->error, LOG_ERR); return -1; } } @@ -405,7 +403,7 @@ class Holiday extends CommonObject $sql.= $order; } - dol_syslog(get_class($this)."::fetchAll sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetchAll", LOG_DEBUG); $resql=$this->db->query($sql); // Si pas d'erreur SQL @@ -461,7 +459,6 @@ class Holiday extends CommonObject { // Erreur SQL $this->error="Error ".$this->db->lasterror(); - dol_syslog(get_class($this)."::fetchAll ".$this->error, LOG_ERR); return -1; } } @@ -544,7 +541,7 @@ class Holiday extends CommonObject $this->db->begin(); - dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); @@ -591,7 +588,7 @@ class Holiday extends CommonObject $this->db->begin(); - dol_syslog(get_class($this)."::delete sql=".$sql); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); @@ -787,7 +784,7 @@ class Holiday extends CommonObject $sql.= " FROM ".MAIN_DB_PREFIX."usergroup as u"; $sql.= " ORDER BY u.rowid"; - dol_syslog(get_class($this)."::selectUserGroup sql=".$sql,LOG_DEBUG); + dol_syslog(get_class($this)."::selectUserGroup", LOG_DEBUG); $result = $this->db->query($sql); // Si pas d'erreur SQL @@ -813,7 +810,6 @@ class Holiday extends CommonObject { // Erreur SQL $this->error=$this->db->lasterror(); - dol_syslog(get_class($this)."::selectUserGroup ".$this->error, LOG_ERR); return -1; } @@ -834,7 +830,7 @@ class Holiday extends CommonObject $sql.= " value = '".$value."'"; $sql.= " WHERE name = '".$name."'"; - dol_syslog(get_class($this).'::updateConfCP name='.$name.' sql='.$sql); + dol_syslog(get_class($this).'::updateConfCP name='.$name.'', LOG_DEBUG); $result = $this->db->query($sql); if($result) { return true; @@ -855,7 +851,7 @@ class Holiday extends CommonObject $sql.= " FROM ".MAIN_DB_PREFIX."holiday_config"; $sql.= " WHERE name = '".$name."'"; - dol_syslog(get_class($this).'::getConfCP name='.$name.' sql='.$sql); + dol_syslog(get_class($this).'::getConfCP name='.$name.'', LOG_DEBUG); $result = $this->db->query($sql); // Si pas d'erreur @@ -869,7 +865,6 @@ class Holiday extends CommonObject // Erreur SQL $this->error=$this->db->lasterror(); - dol_syslog(get_class($this)."::getConfCP ".$this->error, LOG_ERR); return -1; } } @@ -903,7 +898,7 @@ class Holiday extends CommonObject $sql.= " value = '".dol_print_date($now,'%Y%m%d%H%M%S')."'"; $sql.= " WHERE name = 'lastUpdate'"; - dol_syslog(get_class($this).'::updateSoldeCP sql='.$sql); + dol_syslog(get_class($this).'::updateSoldeCP', LOG_DEBUG); $result = $this->db->query($sql); // On ajoute x jours à chaque utilisateurs @@ -929,7 +924,7 @@ class Holiday extends CommonObject $sql2 = "UPDATE ".MAIN_DB_PREFIX."holiday_users SET"; $sql2.= " nb_holiday = nb_holiday + ".$nb_holiday; - dol_syslog(get_class($this).'::updateSoldeCP sql='.$sql2); + dol_syslog(get_class($this).'::updateSoldeCP', LOG_DEBUG); $result= $this->db->query($sql2); if ($result) return 1; @@ -948,7 +943,7 @@ class Holiday extends CommonObject $sql.= " nb_holiday = ".$nbHoliday; $sql.= " WHERE fk_user = '".$userID."'"; - dol_syslog(get_class($this).'::updateSoldeCP sql='.$sql); + dol_syslog(get_class($this).'::updateSoldeCP', LOG_DEBUG); $result = $this->db->query($sql); if ($result) return 1; @@ -1046,7 +1041,7 @@ class Holiday extends CommonObject $sql.= " FROM ".MAIN_DB_PREFIX."holiday_users"; $sql.= " WHERE fk_user = '".$user_id."'"; - dol_syslog(get_class($this).'::getCPforUser sql='.$sql); + dol_syslog(get_class($this).'::getCPforUser', LOG_DEBUG); $result = $this->db->query($sql); if($result) { $obj = $this->db->fetch_object($result); @@ -1077,7 +1072,7 @@ class Holiday extends CommonObject $sql.= " FROM ".MAIN_DB_PREFIX."user as u"; $sql.= " WHERE statut > 0"; - dol_syslog(get_class($this)."::fetchUsers sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetchUsers", LOG_DEBUG); $resql=$this->db->query($sql); // Si pas d'erreur SQL @@ -1107,7 +1102,6 @@ class Holiday extends CommonObject { // Erreur SQL $this->error="Error ".$this->db->lasterror(); - dol_syslog(get_class($this)."::fetchUsers ".$this->error, LOG_ERR); return -1; } @@ -1115,7 +1109,7 @@ class Holiday extends CommonObject $sql = "SELECT u.fk_user"; $sql.= " FROM ".MAIN_DB_PREFIX."holiday_users as u"; - dol_syslog(get_class($this)."::fetchUsers sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetchUsers", LOG_DEBUG); $resql=$this->db->query($sql); // Si pas d'erreur SQL @@ -1145,7 +1139,6 @@ class Holiday extends CommonObject { // Erreur SQL $this->error="Error ".$this->db->lasterror(); - dol_syslog(get_class($this)."::fetchUsers ".$this->error, LOG_ERR); return -1; } } @@ -1159,7 +1152,7 @@ class Holiday extends CommonObject $sql.= " FROM ".MAIN_DB_PREFIX."user as u"; $sql.= " WHERE statut > 0"; - dol_syslog(get_class($this)."::fetchUsers sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetchUsers", LOG_DEBUG); $resql=$this->db->query($sql); // Si pas d'erreur SQL @@ -1187,7 +1180,6 @@ class Holiday extends CommonObject { // Erreur SQL $this->error="Error ".$this->db->lasterror(); - dol_syslog(get_class($this)."::fetchUsers ".$this->error, LOG_ERR); return -1; } @@ -1199,7 +1191,7 @@ class Holiday extends CommonObject $sql.= " ".MAIN_DB_PREFIX."user as u"; $sql.= " WHERE cpu.fk_user = u.rowid"; - dol_syslog(get_class($this)."::fetchUsers sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetchUsers", LOG_DEBUG); $resql=$this->db->query($sql); // Si pas d'erreur SQL @@ -1227,7 +1219,6 @@ class Holiday extends CommonObject { // Erreur SQL $this->error="Error ".$this->db->lasterror(); - dol_syslog(get_class($this)."::fetchUsers ".$this->error, LOG_ERR); return -1; } } @@ -1382,7 +1373,7 @@ class Holiday extends CommonObject $sql.= " FROM ".MAIN_DB_PREFIX."holiday_events as cpe"; - dol_syslog(get_class($this)."::fetchEventsCP sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetchEventsCP", LOG_DEBUG); $resql=$this->db->query($sql); // Si pas d'erreur SQL @@ -1416,7 +1407,6 @@ class Holiday extends CommonObject { // Erreur SQL $this->error="Error ".$this->db->lasterror(); - dol_syslog(get_class($this)."::fetchEventsCP ".$this->error, LOG_ERR); return -1; } } @@ -1447,7 +1437,7 @@ class Holiday extends CommonObject $this->db->begin(); - dol_syslog(get_class($this)."::createEventCP sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::createEventCP", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); @@ -1640,7 +1630,7 @@ class Holiday extends CommonObject $this->db->begin(); - dol_syslog(get_class($this)."::addLogCP sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::addLogCP", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); @@ -1703,7 +1693,7 @@ class Holiday extends CommonObject $sql.= " ".$order; } - dol_syslog(get_class($this)."::fetchLog sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetchLog", LOG_DEBUG); $resql=$this->db->query($sql); // Si pas d'erreur SQL @@ -1741,11 +1731,34 @@ class Holiday extends CommonObject { // Erreur SQL $this->error="Error ".$this->db->lasterror(); - dol_syslog(get_class($this)."::fetchLog ".$this->error, LOG_ERR); return -1; } } + + /** + * Tous les types + * + * @return boolean Return array with list of types + */ + function getTypes() + { + $result = $this->db->query("SELECT rowid, type, affect FROM " . MAIN_DB_PREFIX . "holiday_types"); + $num = $this->db->num_rows($result); + if ($num) + { + while ($obj = $this->db->fetch_object($result)) + { + $types[] = array('rowid'=> $obj->rowid, 'type'=> $obj->type, 'affect'=>$obj->affect); + } + + return $types; + } + + return array(); + } + + /** * Initialise an instance with random values. * Used to build previews or test instances. diff --git a/htdocs/holiday/class/index.html b/htdocs/holiday/class/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/holiday/define_holiday.php b/htdocs/holiday/define_holiday.php index 4e1540c99e5..62e8fc698c9 100644 --- a/htdocs/holiday/define_holiday.php +++ b/htdocs/holiday/define_holiday.php @@ -84,13 +84,10 @@ if ($action == 'update' && isset($_POST['update_cp'])) $sql = "UPDATE ".MAIN_DB_PREFIX."holiday_config SET"; $sql.= " value = '".dol_print_date($now,'%Y%m%d%H%M%S')."'"; $sql.= " WHERE name = 'lastUpdate' and value IS NULL"; // Add value IS NULL to be sure to update only at init. - dol_syslog('define_holiday update lastUpdate entry sql='.$sql); + dol_syslog('define_holiday update lastUpdate entry', LOG_DEBUG); $result = $db->query($sql); - $mesg='
'.$langs->trans('UpdateConfCPOK').'
'; - - dol_htmloutput_mesg($mesg); - + setEventMessage($langs->trans('UpdateConfCPOK')); } elseif($action == 'add_event') { @@ -108,7 +105,7 @@ elseif($action == 'add_event') if ($error) { - $message = '
'.$langs->trans('ErrorAddEventToUserCP').'
'; + setEventMessage($langs->trans('ErrorAddEventToUserCP'), 'errors'); } else { @@ -121,10 +118,8 @@ elseif($action == 'add_event') $holiday->updateSoldeCP($userCP,$new_holiday); - $message = $langs->trans('AddEventToUserOkCP'); + setEventMessage($langs->trans('AddEventToUserOkCP')); } - - dol_htmloutput_mesg($message); } $langs->load('users'); @@ -193,4 +188,3 @@ dol_fiche_end(); llxFooter(); $db->close(); -?> diff --git a/htdocs/holiday/fiche.php b/htdocs/holiday/fiche.php index d66d1c8cfbd..9fc3e278ac5 100644 --- a/htdocs/holiday/fiche.php +++ b/htdocs/holiday/fiche.php @@ -3,6 +3,7 @@ * Copyright (C) 2012-2013 Laurent Destailleur * Copyright (C) 2012 Regis Houssin * Copyright (C) 2013 Juanjo Menent + * Copyright (C) 2014 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 @@ -111,7 +112,7 @@ if ($action == 'create') // Si aucun jours ouvrés dans la demande $nbopenedday=num_open_day($date_debut_gmt, $date_fin_gmt, 0, 1, $halfday); - if($nbopenedday < 1) + if($nbopenedday < 0.5) { header('Location: fiche.php?action=request&error=DureeHoliday'); exit; @@ -208,7 +209,7 @@ if ($action == 'update') // Si pas de jours ouvrés dans la demande $nbopenedday=num_open_day($date_debut_gmt, $date_fin_gmt, 0, 1, $halfday); - if ($nbopenedday < 1) + if ($nbopenedday < 0.5) { header('Location: fiche.php?id='.$_POST['holiday_id'].'&action=edit&error=DureeHoliday'); exit; @@ -398,7 +399,7 @@ if($action == 'confirm_valid') if ($verif > 0) { // Calculcate number of days consummed - $nbopenedday=num_open_day($cp->date_debut_gmt,$cp->date_fin_gmt,0,1); + $nbopenedday=num_open_day($cp->date_debut_gmt,$cp->date_fin_gmt,0,1,$cp->halfday); $soldeActuel = $cp->getCpforUser($cp->fk_user); $newSolde = $soldeActuel - ($nbopenedday * $cp->getConfCP('nbHolidayDeducted')); @@ -704,7 +705,7 @@ if (empty($id) || $action == 'add' || $action == 'request' || $action == 'create break; } - dol_htmloutput_mesg('',$errors,'error'); + setEventMessage($errors, 'errors'); } @@ -760,8 +761,9 @@ if (empty($id) || $action == 'add' || $action == 'request' || $action == 'create print ''; } else print $form->select_users(GETPOST('userid')?GETPOST('userid'):$user->id,'userid',0,'',0); + //var_dump($cp->getConfCP('nbHolidayDeducted')); $nb_holiday = $cp->getCPforUser($user->id) / $cp->getConfCP('nbHolidayDeducted'); - print '   '.$langs->trans('SoldeCPUser', round($nb_holiday,0)).''; + print '   '.$langs->trans('SoldeCPUser', round($nb_holiday,2)).''; print ''; print ''; print ''; @@ -889,7 +891,7 @@ else break; } - dol_htmloutput_mesg('',$errors,'error'); + setEventMessage($errors, 'errors'); } // On vérifie si l'utilisateur à le droit de lire cette demande @@ -1069,7 +1071,7 @@ else // Liste des utiliseurs du groupes choisi dans la config $idGroupValid = $cp->getConfCP('userGroup'); - $validator = new UserGroup($db,$idGroupValid); + $validator = new UserGroup($db); $valideur = $validator->listUsersForGroup('',1); print ''; diff --git a/htdocs/holiday/img/add.png b/htdocs/holiday/img/add.png new file mode 100755 index 00000000000..d15cb50d835 Binary files /dev/null and b/htdocs/holiday/img/add.png differ diff --git a/htdocs/holiday/img/delete.png b/htdocs/holiday/img/delete.png new file mode 100755 index 00000000000..e22ed6f43fc Binary files /dev/null and b/htdocs/holiday/img/delete.png differ diff --git a/htdocs/holiday/img/edit.png b/htdocs/holiday/img/edit.png new file mode 100755 index 00000000000..c74571fde8a Binary files /dev/null and b/htdocs/holiday/img/edit.png differ diff --git a/htdocs/holiday/img/index.html b/htdocs/holiday/img/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/holiday/tomergewithdefine_holiday.php b/htdocs/holiday/tomergewithdefine_holiday.php new file mode 100755 index 00000000000..4bf904528a0 --- /dev/null +++ b/htdocs/holiday/tomergewithdefine_holiday.php @@ -0,0 +1,125 @@ + + * Copyright (C) 2011 Dimitri Mouillard + * + * 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/** + * \file define_congespayes.php + * \ingroup congespayes + * \brief File that defines the balance of paid leave of users. + * \version $Id: define_congespayes.php,v 1.00 2011/09/15 11:00:00 dmouillard Exp $ + * \author dmouillard@teclib.com + * \remarks File that defines the balance of paid leave of users. + */ + +require('../main.inc.php'); +require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; +require_once DOL_DOCUMENT_ROOT.'/holiday/common.inc.php'; + +// Protection if external user +if ($user->societe_id > 0) accessforbidden(); + +// If the user does not have perm to read the page +if(!$user->rights->holiday->define_holiday) accessforbidden(); + + +/* + * View + */ + +llxHeader(array(),$langs->trans('CPTitreMenu')); + + +print_fiche_titre($langs->trans('MenuConfCP')); + +$congespayes = new Holidays($db); +$listUsers = $congespayes->fetchUsers(false, true); + +// Si il y a une action de mise à jour +if (isset($_POST['action']) && $_POST['action'] == 'update') { + + $fk_type = $_POST['fk_type']; + + foreach ($_POST['nb_conges'] as $user_id => $compteur) { + if (!empty($compteur)) { + $userValue = str_replace(',', '.', $compteur); + $userValue = number_format($userValue, 2, '.', ''); + } else { + $userValue = '0.00'; + } + $congespayes->updateSoldeCP($user_id,$userValue,$fk_type); + } + + print '
'; + print $langs->trans('UpdateConfCPOK'); + print '
'; + +} + +$var = true; +$i = 0; + +foreach($congespayes->getTypes() as $type) +{ + if($type['affect']==1) + { + print '
'; + + print '

'.$type['label'].'

'; + + print '
' . "\n"; + print ''; + print ''; + + print ''; + print ""; + print ''; + print ''; + print ''; + + foreach ($listUsers as $users) { + $var = !$var; + print ''; + print ''; + print '' . "\n"; + print ''; + + $i++; + } + + echo ""; + print ''; + echo ""; + + print '
' . $langs->trans('Employee') . '' . $langs->trans('Counter') . '
' . $users['name'] . ' ' . $users['firstname'] . ''; + print ''; + print ' jours
'; + print '
'; + + print '
'; + } +} + +// Fin de page +$db->close(); +llxFooter(); diff --git a/htdocs/holiday/view_log.php b/htdocs/holiday/view_log.php index dba8969adca..5f18a524acc 100644 --- a/htdocs/holiday/view_log.php +++ b/htdocs/holiday/view_log.php @@ -26,6 +26,7 @@ require('../main.inc.php'); require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; require_once DOL_DOCUMENT_ROOT.'/holiday/common.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; // Protection if external user if ($user->societe_id > 0) accessforbidden(); @@ -33,6 +34,12 @@ if ($user->societe_id > 0) accessforbidden(); // Si l'utilisateur n'a pas le droit de lire cette page if(!$user->rights->holiday->view_log) accessforbidden(); +$year=GETPOST('year'); +if (empty($year)) +{ + $tmpdate=dol_getdate(dol_now()); + $year=$tmpdate['year']; +} /* @@ -41,14 +48,14 @@ if(!$user->rights->holiday->view_log) accessforbidden(); $langs->load('users'); -llxHeader(array(),$langs->trans('CPTitreMenu')); +llxHeader(array(),$langs->trans('CPTitreMenu').' ('.$langs->trans("Year").' '.$year.')'); $cp = new Holiday($db); // Recent changes are more important than old changes -$log_holiday = $cp->fetchLog('ORDER BY cpl.rowid DESC',''); +$log_holiday = $cp->fetchLog('ORDER BY cpl.rowid DESC', " AND date_action BETWEEN '".$db->idate(dol_get_first_day($year,1,1))."' AND '".$db->idate(dol_get_last_day($year,12,1))."'"); // Load $cp->logs -print_fiche_titre($langs->trans('LogCP')); +print_fiche_titre($langs->trans('LogCP'),''.img_previous().' '.$langs->trans("Year").':'.$year.' '.img_next().''); print ''; print ''; diff --git a/htdocs/imports/class/import.class.php b/htdocs/imports/class/import.class.php index b1fa3552d9a..58a1bf3e931 100644 --- a/htdocs/imports/class/import.class.php +++ b/htdocs/imports/class/import.class.php @@ -233,7 +233,7 @@ class Import $sql.= ')'; $sql.= " VALUES (".($user->id > 0 ? $user->id : 0).", '".$this->db->escape($this->model_name)."', '".$this->datatoimport."', '".$this->hexa."')"; - dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::create", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -244,7 +244,6 @@ class Import { $this->error=$this->db->lasterror(); $this->errno=$this->db->lasterrno(); - dol_syslog(get_class($this)."::create error ".$this->error, LOG_ERR); $this->db->rollback(); return -1; } @@ -262,7 +261,7 @@ class Import $sql.= ' FROM '.MAIN_DB_PREFIX.'import_model as em'; $sql.= ' WHERE em.rowid = '.$id; - dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { @@ -306,7 +305,7 @@ class Import $this->db->begin(); - dol_syslog(get_class($this)."::delete sql=".$sql); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } @@ -314,12 +313,10 @@ class Import { if (! $notrigger) { - // Call triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('IMPORT_DELETE',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - // End call triggers + // Call trigger + $result=$this->call_trigger('IMPORT_DELETE',$user); + if ($result < 0) $error++; + // End call triggers } } diff --git a/htdocs/imports/class/index.html b/htdocs/imports/class/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php index 41a82de36b1..0b4856fab61 100644 --- a/htdocs/imports/import.php +++ b/htdocs/imports/import.php @@ -138,11 +138,11 @@ if ($action == 'builddoc') $result=$objimport->build_file($user, GETPOST('model','alpha'), $datatoimport, $array_match_file_to_database); if ($result < 0) { - $mesg='
'.$objimport->error.'
'; + setEventMessage($objimport->error, 'errors'); } else { - $mesg='
'.$langs->trans("FileSuccessfullyBuilt").'
'; + setEventMessage($langs->trans("FileSuccessfullyBuilt")); } } @@ -175,21 +175,23 @@ if ($action == 'add_import_model') $result = $objimport->create($user); if ($result >= 0) { - $mesg='
'.$langs->trans("ImportModelSaved",$objimport->model_name).'
'; + setEventMessage($langs->trans("ImportModelSaved",$objimport->model_name)); } else { $langs->load("errors"); if ($objimport->errno == 'DB_ERROR_RECORD_ALREADY_EXISTS') { - $mesg='
'.$langs->trans("ErrorImportDuplicateProfil").'
'; + setEventMessage($langs->trans("ErrorImportDuplicateProfil"), 'errors'); + } + else { + setEventMessage($objimport->error, 'errors'); } - else $mesg='
'.$objimport->error.'
'; } } else { - $mesg='
'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("ImportModelName")).'
'; + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("ImportModelName")), 'errors'); } } @@ -385,8 +387,6 @@ if ($step == 1 || ! $datatoimport) dol_fiche_end(); - if ($mesg) print $mesg; - } @@ -461,7 +461,6 @@ if ($step == 2 && $datatoimport) dol_fiche_end(); - if ($mesg) print $mesg; } @@ -597,10 +596,7 @@ if ($step == 3 && $datatoimport) print '
'; - dol_fiche_end(); - - if ($mesg) print $mesg; } @@ -1010,9 +1006,6 @@ if ($step == 4 && $datatoimport) print ''."\n"; } - - if ($mesg) print $mesg; - /* * Barre d'action */ @@ -1438,8 +1431,6 @@ if ($step == 5 && $datatoimport) } print ''; } - - if ($mesg) print $mesg; } @@ -1679,8 +1670,6 @@ if ($step == 6 && $datatoimport) print $langs->trans("FileWasImported",$importid).'
'; print $langs->trans("YouCanUseImportIdToFindRecord",$importid).'
'; print ''; - - if ($mesg) print $mesg; } diff --git a/htdocs/includes/adodbtime/index.html b/htdocs/includes/adodbtime/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/includes/adodbtime/index.php b/htdocs/includes/adodbtime/index.php deleted file mode 100644 index 7db0dd9ebf9..00000000000 --- a/htdocs/includes/adodbtime/index.php +++ /dev/null @@ -1 +0,0 @@ -Url not available \ No newline at end of file diff --git a/htdocs/includes/index.html b/htdocs/includes/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/includes/index.php b/htdocs/includes/index.php deleted file mode 100644 index 7db0dd9ebf9..00000000000 --- a/htdocs/includes/index.php +++ /dev/null @@ -1 +0,0 @@ -Url not available \ No newline at end of file diff --git a/htdocs/includes/phpexcel/PHPExcel/Shared/PDF/tcpdf.php b/htdocs/includes/phpexcel/PHPExcel/Shared/PDF/tcpdf.php index 6a155c19396..47b23913fe3 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Shared/PDF/tcpdf.php +++ b/htdocs/includes/phpexcel/PHPExcel/Shared/PDF/tcpdf.php @@ -11427,7 +11427,7 @@ class TCPDF { } $seed .= uniqid('', true); $seed .= rand(); - $seed .= getmypid(); + $seed .= dol_getmypid(); $seed .= __FILE__; $seed .= $this->bufferlen; if (isset($_SERVER['REMOTE_ADDR'])) { diff --git a/htdocs/includes/tcpdf/include/tcpdf_static.php b/htdocs/includes/tcpdf/include/tcpdf_static.php index 19eccc477b4..bc1e4abcc5b 100644 --- a/htdocs/includes/tcpdf/include/tcpdf_static.php +++ b/htdocs/includes/tcpdf/include/tcpdf_static.php @@ -1358,7 +1358,7 @@ class TCPDF_STATIC { } $seed .= uniqid('', true); $seed .= rand(); - $seed .= getmypid(); + $seed .= dol_getmypid(); $seed .= __FILE__; if (isset($_SERVER['REMOTE_ADDR'])) { $seed .= $_SERVER['REMOTE_ADDR']; diff --git a/htdocs/index.php b/htdocs/index.php index d18c05d4f12..6dbccde9cf0 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -256,7 +256,7 @@ if (empty($user->societe_id)) $text=$langs->trans($titres[$key]); print '
'; print ''; - print img_object($text,$icons[$key]).' '.$text.'
'; + print img_object("",$icons[$key]).' '.$text.'
'; print '
'; print ''; print $board->nb[$val]; diff --git a/htdocs/install/background.png b/htdocs/install/background.png deleted file mode 100644 index b264649fcbc..00000000000 Binary files a/htdocs/install/background.png and /dev/null differ diff --git a/htdocs/install/check.php b/htdocs/install/check.php index 486811f7157..d815d67dd59 100644 --- a/htdocs/install/check.php +++ b/htdocs/install/check.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2013 Laurent Destailleur * Copyright (C) 2005 Marc Barilley / Ocebo * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2013 Juanjo Menent + * Copyright (C) 2013-2014 Juanjo Menent * Copyright (C) 2014 Marcos García * * This program is free software; you can redistribute it and/or modify @@ -57,7 +57,7 @@ pHeader('',''); // No next step for navigation buttons. Next step is defined //print "
\n"; //print $langs->trans("InstallEasy")."

\n"; -print ''.$langs->trans("MiscellaneousChecks").":
\n"; +print '

'.$langs->trans("MiscellaneousChecks").":

\n"; // Check browser $useragent=$_SERVER['HTTP_USER_AGENT']; @@ -152,6 +152,7 @@ if ($memmaxorig != '') preg_match('/([0-9]+)([a-zA-Z]*)/i',$memmax,$reg); if ($reg[2]) { + if (strtoupper($reg[2]) == 'G') $memmax=$reg[1]*1024*1024*1024; if (strtoupper($reg[2]) == 'M') $memmax=$reg[1]*1024*1024; if (strtoupper($reg[2]) == 'K') $memmax=$reg[1]*1024; } @@ -393,7 +394,8 @@ else array('from'=>'3.2.0', 'to'=>'3.3.0'), array('from'=>'3.3.0', 'to'=>'3.4.0'), array('from'=>'3.4.0', 'to'=>'3.5.0'), - array('from'=>'3.5.0', 'to'=>'3.6.0') + array('from'=>'3.5.0', 'to'=>'3.6.0'), + array('from'=>'3.6.0', 'to'=>'3.7.0') ); $count=0; @@ -438,7 +440,7 @@ else } } - $choice .= ''; + $choice .= ''; $choice .= ''.$langs->trans("Upgrade").'
'.$newversionfrom.$newversionfrombis.' -> '.$newversionto.'
'; $choice .= ''; $choice .= $langs->trans("UpgradeDesc"); diff --git a/htdocs/install/default.css b/htdocs/install/default.css index 0c550cd1119..7ba1a9b136b 100644 --- a/htdocs/install/default.css +++ b/htdocs/install/default.css @@ -18,9 +18,8 @@ body { font-size:13px; -font-family: Verdana, Tahoma, Arial, Helvetica, sans-serif; -background: #f9f9f9 url(headbg.jpg) 0 0 no-repeat; -/* background-color: #F4F4F4; */ +font-family: Verdana, Arial, Helvetica, Tahoma, sans-serif; +background: #f6f6f6; margin: 15px 30px 10px; } @@ -33,8 +32,8 @@ span.titre { font-size: 1.1em; font-weight: bold; background: #FFFFFF; -color: #4965B3; -border: 1px solid #8CACBB; +color: #444; +border: 1px solid #999; padding: 5px 5px 5px 5px; margin: 0 0 0 0; } @@ -45,8 +44,8 @@ font-weight: bold; color: #4965B3; padding: 0 1.2em 0.5em 2em; margin: 1.2em 1.2em 1.2em 1.2em; -border-bottom: 1px solid #8CACBB; -border-right: 1px solid #8CACBB; +border-bottom: 1px solid #999; +border-right: 1px solid #999; text-align: right; } @@ -71,10 +70,13 @@ input:-webkit-autofill { } table.main { -background: #F0F0F0 url(background.png) repeat-x; +background: #FfFfFf; text-align: left; -border: 1px solid #8CACBB; +border: 1px solid #999; color: #000000; +-webkit-box-shadow: 3px 3px 4px #DDD !important; +-moz-box-shadow: 3px 3px 4px #DDD !important; +box-shadow: 3px 3px 4px #DDD !important; } table.main-inside { @@ -89,7 +91,7 @@ table.listofchoices, tr.listofchoices, td.listofchoices { border-collapse: collapse; padding: 4px; color: #000000; -border: 1px solid #888888 !important; +border: 1px solid #999 !important; } tr.listofchoices { @@ -104,8 +106,8 @@ tr.listofchoices { .installchoices table tr td { margin-left: 2px; margin-right: 2px; -border-bottom: 1px solid #8CACBB; -border-right: 1px solid #8CACBB; +border-bottom: 1px solid #999; +border-right: 1px solid #999; color: #000000; } @@ -178,6 +180,7 @@ margin-top: 10px; font-size:16px; font-weight: normal; color: #4965B3; +text-shadow: 2px 1px 2px #c0c0c0; } tr.bg1 { @@ -212,7 +215,7 @@ font-size: 12px; .install { -border: 1px solid #8CACBB; +border: 1px solid #999; padding: 4px 4px 4px 4px; } @@ -246,3 +249,9 @@ ul { a.button:hover { text-decoration:none; } + +.choiceselected { +background-color: #dfd; +background-repeat: repeat-x; +background-position: top left; +} diff --git a/htdocs/install/doctemplates/index.html b/htdocs/install/doctemplates/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/install/doctemplates/invoices/index.html b/htdocs/install/doctemplates/invoices/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/install/doctemplates/orders/index.html b/htdocs/install/doctemplates/orders/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/install/doctemplates/projects/index.html b/htdocs/install/doctemplates/projects/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/install/doctemplates/proposals/index.html b/htdocs/install/doctemplates/proposals/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/install/doctemplates/shipment/index.html b/htdocs/install/doctemplates/shipment/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/install/doctemplates/tasks/index.html b/htdocs/install/doctemplates/tasks/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/install/doctemplates/thirdparties/index.html b/htdocs/install/doctemplates/thirdparties/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/install/etape1.php b/htdocs/install/etape1.php index 43d063bf270..831283c6a46 100644 --- a/htdocs/install/etape1.php +++ b/htdocs/install/etape1.php @@ -256,8 +256,6 @@ if (! $error && $db->connected) { if (! empty($_POST["db_create_database"])) // If we create database, we force default value { - //$defaultCharacterSet=getStaticMember(get_class($db),'forcecharset'); - //$defaultDBSortingCollation=getStaticMember(get_class($db),'forcecollate'); $defaultCharacterSet=$db->forcecharset; $defaultDBSortingCollation=$db->forcecollate; } diff --git a/htdocs/install/fileconf.php b/htdocs/install/fileconf.php index 665d766a8dd..2c6a5730100 100644 --- a/htdocs/install/fileconf.php +++ b/htdocs/install/fileconf.php @@ -309,8 +309,8 @@ if (! empty($force_install_message)) if ($type == 'sqlite') continue; // We hide sqlite because support can't be complete unti sqlit does not manage foreign key creation after table creation // Version min of database - $versionbasemin=getStaticMember($class, 'versionmin'); - $note='('.getStaticMember($class, 'label').' >= '.versiontostring($versionbasemin).')'; + $versionbasemin=explode('.',$class::VERSIONMIN); + $note='('.$class::LABEL.' >= '.$class::VERSIONMIN.')'; // Switch to mysql if mysqli is not present if ($defaultype=='mysqli' && !function_exists('mysqli_connect')) $defaultype = 'mysql'; diff --git a/htdocs/install/headbg.jpg b/htdocs/install/headbg.jpg deleted file mode 100644 index 5491c6e4acb..00000000000 Binary files a/htdocs/install/headbg.jpg and /dev/null differ diff --git a/htdocs/install/lib/index.html b/htdocs/install/lib/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/install/mssql/functions/index.html b/htdocs/install/mssql/functions/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/install/mssql/index.html b/htdocs/install/mssql/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/install/mysql/data/index.html b/htdocs/install/mysql/data/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/install/mysql/data/llx_00_c_country.sql b/htdocs/install/mysql/data/llx_00_c_country.sql new file mode 100644 index 00000000000..497b85d4059 --- /dev/null +++ b/htdocs/install/mysql/data/llx_00_c_country.sql @@ -0,0 +1,272 @@ +-- Copyright (C) 2001-2004 Rodolphe Quiedeville +-- Copyright (C) 2003 Jean-Louis Bergamo +-- Copyright (C) 2004-2010 Laurent Destailleur +-- Copyright (C) 2004 Benoit Mortier +-- Copyright (C) 2004 Guillaume Delecourt +-- Copyright (C) 2005-2009 Regis Houssin +-- Copyright (C) 2007 Patrick Raguin +-- +-- 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 . +-- +-- Do not add comment at end of line. This file is parsed by install and -- are removed + +-- +-- Countries +-- + +-- delete from llx_c_country; +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (0,'',NULL,'-',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (1,'FR','FRA','France',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (2,'BE','BEL','Belgium',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (3,'IT','ITA','Italy',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (4,'ES','ESP','Spain',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (5,'DE','DEU','Germany',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (6,'CH','CHE','Switzerland',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (7,'GB','GBR','United Kingdom',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (8,'IE','IRL','Irland',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (9,'CN','CHN','China',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (10,'TN','TUN','Tunisia',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (11,'US','USA','United States',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (12,'MA','MAR','Maroc',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (13,'DZ','DZA','Algeria',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (14,'CA','CAN','Canada',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (15,'TG','TGO','Togo',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (16,'GA','GAB','Gabon',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (17,'NL','NLD','Nerderland',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (18,'HU','HUN','Hongrie',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (19,'RU','RUS','Russia',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (20,'SE','SWE','Sweden',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (21,'CI','CIV','Côte d''Ivoire',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (22,'SN','SEN','Senegal',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (23,'AR','ARG','Argentine',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (24,'CM','CMR','Cameroun',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (25,'PT','PRT','Portugal',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (26,'SA','SAU','Saudi Arabia',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (27,'MC','MCO','Monaco',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (28,'AU','AUS','Australia',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (29,'SG','SGP','Singapour',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (30,'AF','AFG','Afghanistan',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (31,'AX','ALA','Iles Aland',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (32,'AL','ALB','Albanie',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (33,'AS','ASM','Samoa américaines',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (34,'AD','AND','Andorre',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (35,'AO','AGO','Angola',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (36,'AI','AIA','Anguilla',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (37,'AQ','ATA','Antarctique',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (38,'AG','ATG','Antigua-et-Barbuda',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (39,'AM','ARM','Arménie',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (40,'AW','ABW','Aruba',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (41,'AT','AUT','Autriche',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (42,'AZ','AZE','Azerbaïdjan',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (43,'BS','BHS','Bahamas',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (44,'BH','BHR','Bahreïn',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (45,'BD','BGD','Bangladesh',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (46,'BB','BRB','Barbade',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (47,'BY','BLR','Biélorussie',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (48,'BZ','BLZ','Belize',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (49,'BJ','BEN','Bénin',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (50,'BM','BMU','Bermudes',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (51,'BT','BTN','Bhoutan',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (52,'BO','BOL','Bolivie',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (53,'BA','BIH','Bosnie-Herzégovine',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (54,'BW','BWA','Botswana',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (55,'BV','BVT','Ile Bouvet',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (56,'BR','BRA','Brazil',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (57,'IO','IOT','Territoire britannique de l''Océan Indien',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (58,'BN','BRN','Brunei',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (59,'BG','BGR','Bulgarie',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (60,'BF','BFA','Burkina Faso',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (61,'BI','BDI','Burundi',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (62,'KH','KHM','Cambodge',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (63,'CV','CPV','Cap-Vert',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (64,'KY','CYM','Iles Cayman',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (65,'CF','CAF','République centrafricaine',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (66,'TD','TCD','Tchad',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (67,'CL','CHL','Chili',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (68,'CX','CXR','Ile Christmas',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (69,'CC','CCK','Iles des Cocos (Keeling)',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (70,'CO','COL','Colombie',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (71,'KM','COM','Comores',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (72,'CG','COG','Congo',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (73,'CD','COD','République démocratique du Congo',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (74,'CK','COK','Iles Cook',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (75,'CR','CRI','Costa Rica',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (76,'HR','HRV','Croatie',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (77,'CU','CUB','Cuba',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (78,'CY','CYP','Chypre',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (79,'CZ','CZE','République Tchèque',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (80,'DK','DNK','Danemark',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (81,'DJ','DJI','Djibouti',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (82,'DM','DMA','Dominique',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (83,'DO','DOM','République Dominicaine',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (84,'EC','ECU','Equateur',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (85,'EG','EGY','Egypte',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (86,'SV','SLV','Salvador',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (87,'GQ','GNQ','Guinée Equatoriale',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (88,'ER','ERI','Erythrée',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (89,'EE','EST','Estonia',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (90,'ET','ETH','Ethiopie',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (91,'FK','FLK','Iles Falkland',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (92,'FO','FRO','Iles Féroé',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (93,'FJ','FJI','Iles Fidji',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (94,'FI','FIN','Finlande',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (95,'GF','GUF','Guyane française',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (96,'PF','PYF','Polynésie française',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (97,'TF','ATF','Terres australes françaises',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (98,'GM','GMB','Gambie',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (99,'GE','GEO','Georgia',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (100,'GH','GHA','Ghana',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (101,'GI','GIB','Gibraltar',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (102,'GR','GRC','Greece',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (103,'GL','GRL','Groenland',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (104,'GD','GRD','Grenade',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (106,'GU','GUM','Guam',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (107,'GT','GTM','Guatemala',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (108,'GN','GIN','Guinea',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (109,'GW','GNB','Guinea-Bissao',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (111,'HT','HTI','Haiti',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (112,'HM','HMD','Iles Heard et McDonald',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (113,'VA','VAT','Saint-Siège (Vatican)',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (114,'HN','HND','Honduras',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (115,'HK','HKG','Hong Kong',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (116,'IS','ISL','Islande',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (117,'IN','IND','India',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (118,'ID','IDN','Indonésie',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (119,'IR','IRN','Iran',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (120,'IQ','IRQ','Iraq',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (121,'IL','ISR','Israel',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (122,'JM','JAM','Jamaïque',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (123,'JP','JPN','Japon',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (124,'JO','JOR','Jordanie',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (125,'KZ','KAZ','Kazakhstan',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (126,'KE','KEN','Kenya',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (127,'KI','KIR','Kiribati',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (128,'KP','PRK','North Corea',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (129,'KR','KOR','South Corea',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (130,'KW','KWT','Koweït',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (131,'KG','KGZ','Kirghizistan',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (132,'LA','LAO','Laos',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (133,'LV','LVA','Lettonie',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (134,'LB','LBN','Liban',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (135,'LS','LSO','Lesotho',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (136,'LR','LBR','Liberia',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (137,'LY','LBY','Libye',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (138,'LI','LIE','Liechtenstein',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (139,'LT','LTU','Lituanie',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (140,'LU','LUX','Luxembourg',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (141,'MO','MAC','Macao',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (142,'MK','MKD','ex-République yougoslave de Macédoine',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (143,'MG','MDG','Madagascar',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (144,'MW','MWI','Malawi',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (145,'MY','MYS','Malaisie',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (146,'MV','MDV','Maldives',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (147,'ML','MLI','Mali',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (148,'MT','MLT','Malte',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (149,'MH','MHL','Iles Marshall',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (151,'MR','MRT','Mauritanie',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (152,'MU','MUS','Maurice',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (153,'YT','MYT','Mayotte',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (154,'MX','MEX','Mexique',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (155,'FM','FSM','Micronésie',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (156,'MD','MDA','Moldavie',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (157,'MN','MNG','Mongolie',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (158,'MS','MSR','Monserrat',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (159,'MZ','MOZ','Mozambique',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (160,'MM','MMR','Birmanie (Myanmar)',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (161,'NA','NAM','Namibie',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (162,'NR','NRU','Nauru',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (163,'NP','NPL','Népal',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (164,'AN',NULL,'Antilles néerlandaises',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (165,'NC','NCL','Nouvelle-Calédonie',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (166,'NZ','NZL','Nouvelle-Zélande',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (167,'NI','NIC','Nicaragua',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (168,'NE','NER','Niger',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (169,'NG','NGA','Nigeria',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (170,'NU','NIU','Nioué',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (171,'NF','NFK','Ile Norfolk',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (172,'MP','MNP','Mariannes du Nord',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (173,'NO','NOR','Norvège',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (174,'OM','OMN','Oman',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (175,'PK','PAK','Pakistan',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (176,'PW','PLW','Palaos',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (177,'PS','PSE','Territoire Palestinien Occupé',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (178,'PA','PAN','Panama',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (179,'PG','PNG','Papouasie-Nouvelle-Guinée',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (180,'PY','PRY','Paraguay',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (181,'PE','PER','Peru',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (182,'PH','PHL','Philippines',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (183,'PN','PCN','Iles Pitcairn',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (184,'PL','POL','Pologne',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (185,'PR','PRI','Porto Rico',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (186,'QA','QAT','Qatar',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (188,'RO','ROU','Roumanie',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (189,'RW','RWA','Rwanda',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (190,'SH','SHN','Sainte-Hélène',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (191,'KN','KNA','Saint-Christophe-et-Niévès',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (192,'LC','LCA','Sainte-Lucie',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (193,'PM','SPM','Saint-Pierre-et-Miquelon',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (194,'VC','VCT','Saint-Vincent-et-les-Grenadines',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (195,'WS','WSM','Samoa',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (196,'SM','SMR','Saint-Marin',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (197,'ST','STP','Sao Tomé-et-Principe',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (198,'RS','SRB','Serbie',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (199,'SC','SYC','Seychelles',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (200,'SL','SLE','Sierra Leone',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (201,'SK','SVK','Slovaquie',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (202,'SI','SVN','Slovénie',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (203,'SB','SLB','Iles Salomon',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (204,'SO','SOM','Somalie',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (205,'ZA','ZAF','Afrique du Sud',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (206,'GS','SGS','Iles Géorgie du Sud et Sandwich du Sud',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (207,'LK','LKA','Sri Lanka',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (208,'SD','SDN','Soudan',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (209,'SR','SUR','Suriname',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (210,'SJ','SJM','Iles Svalbard et Jan Mayen',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (211,'SZ','SWZ','Swaziland',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (212,'SY','SYR','Syrie',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (213,'TW','TWN','Taïwan',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (214,'TJ','TJK','Tadjikistan',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (215,'TZ','TZA','Tanzanie',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (216,'TH','THA','Thaïlande',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (217,'TL','TLS','Timor Oriental',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (218,'TK','TKL','Tokélaou',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (219,'TO','TON','Tonga',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (220,'TT','TTO','Trinité-et-Tobago',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (221,'TR','TUR','Turquie',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (222,'TM','TKM','Turkménistan',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (223,'TC','TCA','Iles Turks-et-Caicos',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (224,'TV','TUV','Tuvalu',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (225,'UG','UGA','Ouganda',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (226,'UA','UKR','Ukraine',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (227,'AE','ARE','Émirats arabes unis',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (228,'UM','UMI','Iles mineures éloignées des États-Unis',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (229,'UY','URY','Uruguay',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (230,'UZ','UZB','Ouzbékistan',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (231,'VU','VUT','Vanuatu',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (232,'VE','VEN','Vénézuela',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (233,'VN','VNM','Viêt Nam',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (234,'VG','VGB','Iles Vierges britanniques',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (235,'VI','VIR','Iles Vierges américaines',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (236,'WF','WLF','Wallis-et-Futuna',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (237,'EH','ESH','Sahara occidental',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (238,'YE','YEM','Yémen',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (239,'ZM','ZMB','Zambie',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (240,'ZW','ZWE','Zimbabwe',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (241,'GG','GGY','Guernesey',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (242,'IM','IMN','Ile de Man',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (243,'JE','JEY','Jersey',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (244,'ME','MNE','Monténégro',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (245,'BL','BLM','Saint-Barthélemy',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (246,'MF','MAF','Saint-Martin',1); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active) VALUES (247,'BU', null, 'Burundi',1); diff --git a/htdocs/install/mysql/data/llx_00_c_pays.sql b/htdocs/install/mysql/data/llx_00_c_pays.sql deleted file mode 100644 index e40eff745e6..00000000000 --- a/htdocs/install/mysql/data/llx_00_c_pays.sql +++ /dev/null @@ -1,281 +0,0 @@ --- Copyright (C) 2001-2004 Rodolphe Quiedeville --- Copyright (C) 2003 Jean-Louis Bergamo --- Copyright (C) 2004-2010 Laurent Destailleur --- Copyright (C) 2004 Benoit Mortier --- Copyright (C) 2004 Guillaume Delecourt --- Copyright (C) 2005-2009 Regis Houssin --- Copyright (C) 2007 Patrick Raguin --- --- 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 . --- --- - --- --- Ne pas placer de commentaire en fin de ligne, ce fichier est parsé lors --- de l'install et tous les sigles '--' sont supprimés. --- - --- --- Pays --- - --- delete from llx_c_pays; -insert into llx_c_pays (rowid,code,libelle) values (0, '' , '-' ); -insert into llx_c_pays (rowid,code,libelle) values (1, 'FR', 'France' ); -insert into llx_c_pays (rowid,code,libelle) values (2, 'BE', 'Belgium' ); -insert into llx_c_pays (rowid,code,libelle) values (3, 'IT', 'Italy' ); -insert into llx_c_pays (rowid,code,libelle) values (4, 'ES', 'Spain' ); -insert into llx_c_pays (rowid,code,libelle) values (5, 'DE', 'Germany' ); -insert into llx_c_pays (rowid,code,libelle) values (6, 'CH', 'Switzerland' ); -insert into llx_c_pays (rowid,code,libelle) values (7, 'GB', 'United Kingdom' ); -insert into llx_c_pays (rowid,code,libelle) values (8, 'IE', 'Irland' ); -insert into llx_c_pays (rowid,code,libelle) values (9, 'CN', 'China' ); -insert into llx_c_pays (rowid,code,libelle) values (10, 'TN', 'Tunisia' ); -insert into llx_c_pays (rowid,code,libelle) values (11, 'US', 'United States' ); -insert into llx_c_pays (rowid,code,libelle) values (12, 'MA', 'Maroc' ); -insert into llx_c_pays (rowid,code,libelle) values (13, 'DZ', 'Algeria' ); -insert into llx_c_pays (rowid,code,libelle) values (14, 'CA', 'Canada' ); -insert into llx_c_pays (rowid,code,libelle) values (15, 'TG', 'Togo' ); -insert into llx_c_pays (rowid,code,libelle) values (16, 'GA', 'Gabon' ); -insert into llx_c_pays (rowid,code,libelle) values (17, 'NL', 'Nerderland' ); -insert into llx_c_pays (rowid,code,libelle) values (18, 'HU', 'Hongrie' ); -insert into llx_c_pays (rowid,code,libelle) values (19, 'RU', 'Russia' ); -insert into llx_c_pays (rowid,code,libelle) values (20, 'SE', 'Sweden' ); -insert into llx_c_pays (rowid,code,libelle) values (21, 'CI', 'Côte d''Ivoire' ); -insert into llx_c_pays (rowid,code,libelle) values (22, 'SN', 'Senegal' ); -insert into llx_c_pays (rowid,code,libelle) values (23, 'AR', 'Argentine' ); -insert into llx_c_pays (rowid,code,libelle) values (24, 'CM', 'Cameroun' ); -insert into llx_c_pays (rowid,code,libelle) values (25, 'PT', 'Portugal' ); -insert into llx_c_pays (rowid,code,libelle) values (26, 'SA', 'Saudi Arabia' ); -insert into llx_c_pays (rowid,code,libelle) values (27, 'MC', 'Monaco' ); -insert into llx_c_pays (rowid,code,libelle) values (28, 'AU', 'Australia' ); -insert into llx_c_pays (rowid,code,libelle) values (29, 'SG', 'Singapour' ); -insert into llx_c_pays (rowid,code,libelle) values (30, 'AF', 'Afghanistan' ); -insert into llx_c_pays (rowid,code,libelle) values (31, 'AX', 'Iles Aland' ); -insert into llx_c_pays (rowid,code,libelle) values (32, 'AL', 'Albanie' ); -insert into llx_c_pays (rowid,code,libelle) values (33, 'AS', 'Samoa américaines'); -insert into llx_c_pays (rowid,code,libelle) values (34, 'AD', 'Andorre' ); -insert into llx_c_pays (rowid,code,libelle) values (35, 'AO', 'Angola' ); -insert into llx_c_pays (rowid,code,libelle) values (36, 'AI', 'Anguilla' ); -insert into llx_c_pays (rowid,code,libelle) values (37, 'AQ', 'Antarctique' ); -insert into llx_c_pays (rowid,code,libelle) values (38, 'AG', 'Antigua-et-Barbuda'); -insert into llx_c_pays (rowid,code,libelle) values (39, 'AM', 'Arménie' ); -insert into llx_c_pays (rowid,code,libelle) values (40, 'AW', 'Aruba' ); -insert into llx_c_pays (rowid,code,libelle) values (41, 'AT', 'Autriche' ); -insert into llx_c_pays (rowid,code,libelle) values (42, 'AZ', 'Azerbaïdjan' ); -insert into llx_c_pays (rowid,code,libelle) values (43, 'BS', 'Bahamas' ); -insert into llx_c_pays (rowid,code,libelle) values (44, 'BH', 'Bahreïn' ); -insert into llx_c_pays (rowid,code,libelle) values (45, 'BD', 'Bangladesh' ); -insert into llx_c_pays (rowid,code,libelle) values (46, 'BB', 'Barbade' ); -insert into llx_c_pays (rowid,code,libelle) values (47, 'BY', 'Biélorussie' ); -insert into llx_c_pays (rowid,code,libelle) values (48, 'BZ', 'Belize' ); -insert into llx_c_pays (rowid,code,libelle) values (49, 'BJ', 'Bénin' ); -insert into llx_c_pays (rowid,code,libelle) values (50, 'BM', 'Bermudes' ); -insert into llx_c_pays (rowid,code,libelle) values (51, 'BT', 'Bhoutan' ); -insert into llx_c_pays (rowid,code,libelle) values (52, 'BO', 'Bolivie' ); -insert into llx_c_pays (rowid,code,libelle) values (53, 'BA', 'Bosnie-Herzégovine'); -insert into llx_c_pays (rowid,code,libelle) values (54, 'BW', 'Botswana' ); -insert into llx_c_pays (rowid,code,libelle) values (55, 'BV', 'Ile Bouvet' ); -insert into llx_c_pays (rowid,code,libelle) values (56, 'BR', 'Brazil' ); -insert into llx_c_pays (rowid,code,libelle) values (57, 'IO', 'Territoire britannique de l''Océan Indien'); -insert into llx_c_pays (rowid,code,libelle) values (58, 'BN', 'Brunei' ); -insert into llx_c_pays (rowid,code,libelle) values (59, 'BG', 'Bulgarie' ); -insert into llx_c_pays (rowid,code,libelle) values (60, 'BF', 'Burkina Faso' ); -insert into llx_c_pays (rowid,code,libelle) values (61, 'BI', 'Burundi' ); -insert into llx_c_pays (rowid,code,libelle) values (62, 'KH', 'Cambodge' ); -insert into llx_c_pays (rowid,code,libelle) values (63, 'CV', 'Cap-Vert' ); -insert into llx_c_pays (rowid,code,libelle) values (64, 'KY', 'Iles Cayman' ); -insert into llx_c_pays (rowid,code,libelle) values (65, 'CF', 'République centrafricaine'); -insert into llx_c_pays (rowid,code,libelle) values (66, 'TD', 'Tchad' ); -insert into llx_c_pays (rowid,code,libelle) values (67, 'CL', 'Chili' ); -insert into llx_c_pays (rowid,code,libelle) values (68, 'CX', 'Ile Christmas' ); -insert into llx_c_pays (rowid,code,libelle) values (69, 'CC', 'Iles des Cocos (Keeling)'); -insert into llx_c_pays (rowid,code,libelle) values (70, 'CO', 'Colombie' ); -insert into llx_c_pays (rowid,code,libelle) values (71, 'KM', 'Comores' ); -insert into llx_c_pays (rowid,code,libelle) values (72, 'CG', 'Congo' ); -insert into llx_c_pays (rowid,code,libelle) values (73, 'CD', 'République démocratique du Congo'); -insert into llx_c_pays (rowid,code,libelle) values (74, 'CK', 'Iles Cook' ); -insert into llx_c_pays (rowid,code,libelle) values (75, 'CR', 'Costa Rica' ); -insert into llx_c_pays (rowid,code,libelle) values (76, 'HR', 'Croatie' ); -insert into llx_c_pays (rowid,code,libelle) values (77, 'CU', 'Cuba' ); -insert into llx_c_pays (rowid,code,libelle) values (78, 'CY', 'Chypre' ); -insert into llx_c_pays (rowid,code,libelle) values (79, 'CZ', 'République Tchèque'); -insert into llx_c_pays (rowid,code,libelle) values (80, 'DK', 'Danemark' ); -insert into llx_c_pays (rowid,code,libelle) values (81, 'DJ', 'Djibouti' ); -insert into llx_c_pays (rowid,code,libelle) values (82, 'DM', 'Dominique' ); -insert into llx_c_pays (rowid,code,libelle) values (83, 'DO', 'République Dominicaine'); -insert into llx_c_pays (rowid,code,libelle) values (84, 'EC', 'Equateur' ); -insert into llx_c_pays (rowid,code,libelle) values (85, 'EG', 'Egypte' ); -insert into llx_c_pays (rowid,code,libelle) values (86, 'SV', 'Salvador' ); -insert into llx_c_pays (rowid,code,libelle) values (87, 'GQ', 'Guinée Equatoriale'); -insert into llx_c_pays (rowid,code,libelle) values (88, 'ER', 'Erythrée' ); -insert into llx_c_pays (rowid,code,libelle) values (89, 'EE', 'Estonia' ); -insert into llx_c_pays (rowid,code,libelle) values (90, 'ET', 'Ethiopie' ); -insert into llx_c_pays (rowid,code,libelle) values (91, 'FK', 'Iles Falkland' ); -insert into llx_c_pays (rowid,code,libelle) values (92, 'FO', 'Iles Féroé' ); -insert into llx_c_pays (rowid,code,libelle) values (93, 'FJ', 'Iles Fidji' ); -insert into llx_c_pays (rowid,code,libelle) values (94, 'FI', 'Finlande' ); -insert into llx_c_pays (rowid,code,libelle) values (95, 'GF', 'Guyane française'); -insert into llx_c_pays (rowid,code,libelle) values (96, 'PF', 'Polynésie française'); -insert into llx_c_pays (rowid,code,libelle) values (97, 'TF', 'Terres australes françaises'); -insert into llx_c_pays (rowid,code,libelle) values (98, 'GM', 'Gambie' ); -insert into llx_c_pays (rowid,code,libelle) values (99, 'GE', 'Georgia' ); -insert into llx_c_pays (rowid,code,libelle) values (100, 'GH', 'Ghana' ); -insert into llx_c_pays (rowid,code,libelle) values (101, 'GI', 'Gibraltar' ); -insert into llx_c_pays (rowid,code,libelle) values (102, 'GR', 'Greece' ); -insert into llx_c_pays (rowid,code,libelle) values (103, 'GL', 'Groenland' ); -insert into llx_c_pays (rowid,code,libelle) values (104, 'GD', 'Grenade' ); ---insert into llx_c_pays (rowid,code,libelle) values (105, 'GP', 'Guadeloupe' ); -insert into llx_c_pays (rowid,code,libelle) values (106, 'GU', 'Guam' ); -insert into llx_c_pays (rowid,code,libelle) values (107, 'GT', 'Guatemala' ); -insert into llx_c_pays (rowid,code,libelle) values (108, 'GN', 'Guinea' ); -insert into llx_c_pays (rowid,code,libelle) values (109, 'GW', 'Guinea-Bissao' ); ---insert into llx_c_pays (rowid,code,libelle) values (110, 'GY', 'Guyana' ); -insert into llx_c_pays (rowid,code,libelle) values (111, 'HT', 'Haiti' ); -insert into llx_c_pays (rowid,code,libelle) values (112, 'HM', 'Iles Heard et McDonald'); -insert into llx_c_pays (rowid,code,libelle) values (113, 'VA', 'Saint-Siège (Vatican)'); -insert into llx_c_pays (rowid,code,libelle) values (114, 'HN', 'Honduras' ); -insert into llx_c_pays (rowid,code,libelle) values (115, 'HK', 'Hong Kong' ); -insert into llx_c_pays (rowid,code,libelle) values (116, 'IS', 'Islande' ); -insert into llx_c_pays (rowid,code,libelle) values (117, 'IN', 'India' ); -insert into llx_c_pays (rowid,code,libelle) values (118, 'ID', 'Indonésie' ); -insert into llx_c_pays (rowid,code,libelle) values (119, 'IR', 'Iran' ); -insert into llx_c_pays (rowid,code,libelle) values (120, 'IQ', 'Iraq' ); -insert into llx_c_pays (rowid,code,libelle) values (121, 'IL', 'Israel' ); -insert into llx_c_pays (rowid,code,libelle) values (122, 'JM', 'Jamaïque' ); -insert into llx_c_pays (rowid,code,libelle) values (123, 'JP', 'Japon' ); -insert into llx_c_pays (rowid,code,libelle) values (124, 'JO', 'Jordanie' ); -insert into llx_c_pays (rowid,code,libelle) values (125, 'KZ', 'Kazakhstan' ); -insert into llx_c_pays (rowid,code,libelle) values (126, 'KE', 'Kenya' ); -insert into llx_c_pays (rowid,code,libelle) values (127, 'KI', 'Kiribati' ); -insert into llx_c_pays (rowid,code,libelle) values (128, 'KP', 'North Corea' ); -insert into llx_c_pays (rowid,code,libelle) values (129, 'KR', 'South Corea' ); -insert into llx_c_pays (rowid,code,libelle) values (130, 'KW', 'Koweït' ); -insert into llx_c_pays (rowid,code,libelle) values (131, 'KG', 'Kirghizistan' ); -insert into llx_c_pays (rowid,code,libelle) values (132, 'LA', 'Laos' ); -insert into llx_c_pays (rowid,code,libelle) values (133, 'LV', 'Lettonie' ); -insert into llx_c_pays (rowid,code,libelle) values (134, 'LB', 'Liban' ); -insert into llx_c_pays (rowid,code,libelle) values (135, 'LS', 'Lesotho' ); -insert into llx_c_pays (rowid,code,libelle) values (136, 'LR', 'Liberia' ); -insert into llx_c_pays (rowid,code,libelle) values (137, 'LY', 'Libye' ); -insert into llx_c_pays (rowid,code,libelle) values (138, 'LI', 'Liechtenstein' ); -insert into llx_c_pays (rowid,code,libelle) values (139, 'LT', 'Lituanie' ); -insert into llx_c_pays (rowid,code,libelle) values (140, 'LU', 'Luxembourg' ); -insert into llx_c_pays (rowid,code,libelle) values (141, 'MO', 'Macao' ); -insert into llx_c_pays (rowid,code,libelle) values (142, 'MK', 'ex-République yougoslave de Macédoine'); -insert into llx_c_pays (rowid,code,libelle) values (143, 'MG', 'Madagascar' ); -insert into llx_c_pays (rowid,code,libelle) values (144, 'MW', 'Malawi' ); -insert into llx_c_pays (rowid,code,libelle) values (145, 'MY', 'Malaisie' ); -insert into llx_c_pays (rowid,code,libelle) values (146, 'MV', 'Maldives' ); -insert into llx_c_pays (rowid,code,libelle) values (147, 'ML', 'Mali' ); -insert into llx_c_pays (rowid,code,libelle) values (148, 'MT', 'Malte' ); -insert into llx_c_pays (rowid,code,libelle) values (149, 'MH', 'Iles Marshall' ); ---insert into llx_c_pays (rowid,code,libelle) values (150, 'MQ', 'Martinique' ); -insert into llx_c_pays (rowid,code,libelle) values (151, 'MR', 'Mauritanie' ); -insert into llx_c_pays (rowid,code,libelle) values (152, 'MU', 'Maurice' ); -insert into llx_c_pays (rowid,code,libelle) values (153, 'YT', 'Mayotte' ); -insert into llx_c_pays (rowid,code,libelle) values (154, 'MX', 'Mexique' ); -insert into llx_c_pays (rowid,code,libelle) values (155, 'FM', 'Micronésie' ); -insert into llx_c_pays (rowid,code,libelle) values (156, 'MD', 'Moldavie' ); -insert into llx_c_pays (rowid,code,libelle) values (157, 'MN', 'Mongolie' ); -insert into llx_c_pays (rowid,code,libelle) values (158, 'MS', 'Monserrat' ); -insert into llx_c_pays (rowid,code,libelle) values (159, 'MZ', 'Mozambique' ); -insert into llx_c_pays (rowid,code,libelle) values (160, 'MM', 'Birmanie (Myanmar)' ); -insert into llx_c_pays (rowid,code,libelle) values (161, 'NA', 'Namibie' ); -insert into llx_c_pays (rowid,code,libelle) values (162, 'NR', 'Nauru' ); -insert into llx_c_pays (rowid,code,libelle) values (163, 'NP', 'Népal' ); -insert into llx_c_pays (rowid,code,libelle) values (164, 'AN', 'Antilles néerlandaises'); -insert into llx_c_pays (rowid,code,libelle) values (165, 'NC', 'Nouvelle-Calédonie'); -insert into llx_c_pays (rowid,code,libelle) values (166, 'NZ', 'Nouvelle-Zélande'); -insert into llx_c_pays (rowid,code,libelle) values (167, 'NI', 'Nicaragua' ); -insert into llx_c_pays (rowid,code,libelle) values (168, 'NE', 'Niger' ); -insert into llx_c_pays (rowid,code,libelle) values (169, 'NG', 'Nigeria' ); -insert into llx_c_pays (rowid,code,libelle) values (170, 'NU', 'Nioué' ); -insert into llx_c_pays (rowid,code,libelle) values (171, 'NF', 'Ile Norfolk' ); -insert into llx_c_pays (rowid,code,libelle) values (172, 'MP', 'Mariannes du Nord'); -insert into llx_c_pays (rowid,code,libelle) values (173, 'NO', 'Norvège' ); -insert into llx_c_pays (rowid,code,libelle) values (174, 'OM', 'Oman' ); -insert into llx_c_pays (rowid,code,libelle) values (175, 'PK', 'Pakistan' ); -insert into llx_c_pays (rowid,code,libelle) values (176, 'PW', 'Palaos' ); -insert into llx_c_pays (rowid,code,libelle) values (177, 'PS', 'Territoire Palestinien Occupé'); -insert into llx_c_pays (rowid,code,libelle) values (178, 'PA', 'Panama' ); -insert into llx_c_pays (rowid,code,libelle) values (179, 'PG', 'Papouasie-Nouvelle-Guinée'); -insert into llx_c_pays (rowid,code,libelle) values (180, 'PY', 'Paraguay' ); -insert into llx_c_pays (rowid,code,libelle) values (181, 'PE', 'Peru' ); -insert into llx_c_pays (rowid,code,libelle) values (182, 'PH', 'Philippines' ); -insert into llx_c_pays (rowid,code,libelle) values (183, 'PN', 'Iles Pitcairn' ); -insert into llx_c_pays (rowid,code,libelle) values (184, 'PL', 'Pologne' ); -insert into llx_c_pays (rowid,code,libelle) values (185, 'PR', 'Porto Rico' ); -insert into llx_c_pays (rowid,code,libelle) values (186, 'QA', 'Qatar' ); ---insert into llx_c_pays (rowid,code,libelle) values (187, 'RE', 'Réunion' ); -insert into llx_c_pays (rowid,code,libelle) values (188, 'RO', 'Roumanie' ); -insert into llx_c_pays (rowid,code,libelle) values (189, 'RW', 'Rwanda' ); -insert into llx_c_pays (rowid,code,libelle) values (190, 'SH', 'Sainte-Hélène' ); -insert into llx_c_pays (rowid,code,libelle) values (191, 'KN', 'Saint-Christophe-et-Niévès'); -insert into llx_c_pays (rowid,code,libelle) values (192, 'LC', 'Sainte-Lucie' ); -insert into llx_c_pays (rowid,code,libelle) values (193, 'PM', 'Saint-Pierre-et-Miquelon'); -insert into llx_c_pays (rowid,code,libelle) values (194, 'VC', 'Saint-Vincent-et-les-Grenadines'); -insert into llx_c_pays (rowid,code,libelle) values (195, 'WS', 'Samoa' ); -insert into llx_c_pays (rowid,code,libelle) values (196, 'SM', 'Saint-Marin' ); -insert into llx_c_pays (rowid,code,libelle) values (197, 'ST', 'Sao Tomé-et-Principe'); -insert into llx_c_pays (rowid,code,libelle) values (198, 'RS', 'Serbie' ); -insert into llx_c_pays (rowid,code,libelle) values (199, 'SC', 'Seychelles' ); -insert into llx_c_pays (rowid,code,libelle) values (200, 'SL', 'Sierra Leone' ); -insert into llx_c_pays (rowid,code,libelle) values (201, 'SK', 'Slovaquie' ); -insert into llx_c_pays (rowid,code,libelle) values (202, 'SI', 'Slovénie' ); -insert into llx_c_pays (rowid,code,libelle) values (203, 'SB', 'Iles Salomon' ); -insert into llx_c_pays (rowid,code,libelle) values (204, 'SO', 'Somalie' ); -insert into llx_c_pays (rowid,code,libelle) values (205, 'ZA', 'Afrique du Sud'); -insert into llx_c_pays (rowid,code,libelle) values (206, 'GS', 'Iles Géorgie du Sud et Sandwich du Sud'); -insert into llx_c_pays (rowid,code,libelle) values (207, 'LK', 'Sri Lanka' ); -insert into llx_c_pays (rowid,code,libelle) values (208, 'SD', 'Soudan' ); -insert into llx_c_pays (rowid,code,libelle) values (209, 'SR', 'Suriname' ); -insert into llx_c_pays (rowid,code,libelle) values (210, 'SJ', 'Iles Svalbard et Jan Mayen'); -insert into llx_c_pays (rowid,code,libelle) values (211, 'SZ', 'Swaziland' ); -insert into llx_c_pays (rowid,code,libelle) values (212, 'SY', 'Syrie' ); -insert into llx_c_pays (rowid,code,libelle) values (213, 'TW', 'Taïwan' ); -insert into llx_c_pays (rowid,code,libelle) values (214, 'TJ', 'Tadjikistan' ); -insert into llx_c_pays (rowid,code,libelle) values (215, 'TZ', 'Tanzanie' ); -insert into llx_c_pays (rowid,code,libelle) values (216, 'TH', 'Thaïlande' ); -insert into llx_c_pays (rowid,code,libelle) values (217, 'TL', 'Timor Oriental'); -insert into llx_c_pays (rowid,code,libelle) values (218, 'TK', 'Tokélaou' ); -insert into llx_c_pays (rowid,code,libelle) values (219, 'TO', 'Tonga' ); -insert into llx_c_pays (rowid,code,libelle) values (220, 'TT', 'Trinité-et-Tobago'); -insert into llx_c_pays (rowid,code,libelle) values (221, 'TR', 'Turquie' ); -insert into llx_c_pays (rowid,code,libelle) values (222, 'TM', 'Turkménistan' ); -insert into llx_c_pays (rowid,code,libelle) values (223, 'TC', 'Iles Turks-et-Caicos'); -insert into llx_c_pays (rowid,code,libelle) values (224, 'TV', 'Tuvalu' ); -insert into llx_c_pays (rowid,code,libelle) values (225, 'UG', 'Ouganda' ); -insert into llx_c_pays (rowid,code,libelle) values (226, 'UA', 'Ukraine' ); -insert into llx_c_pays (rowid,code,libelle) values (227, 'AE', 'Émirats arabes unis'); -insert into llx_c_pays (rowid,code,libelle) values (228, 'UM', 'Iles mineures éloignées des États-Unis'); -insert into llx_c_pays (rowid,code,libelle) values (229, 'UY', 'Uruguay' ); -insert into llx_c_pays (rowid,code,libelle) values (230, 'UZ', 'Ouzbékistan' ); -insert into llx_c_pays (rowid,code,libelle) values (231, 'VU', 'Vanuatu' ); -insert into llx_c_pays (rowid,code,libelle) values (232, 'VE', 'Vénézuela' ); -insert into llx_c_pays (rowid,code,libelle) values (233, 'VN', 'Viêt Nam' ); -insert into llx_c_pays (rowid,code,libelle) values (234, 'VG', 'Iles Vierges britanniques'); -insert into llx_c_pays (rowid,code,libelle) values (235, 'VI', 'Iles Vierges américaines'); -insert into llx_c_pays (rowid,code,libelle) values (236, 'WF', 'Wallis-et-Futuna'); -insert into llx_c_pays (rowid,code,libelle) values (237, 'EH', 'Sahara occidental'); -insert into llx_c_pays (rowid,code,libelle) values (238, 'YE', 'Yémen' ); -insert into llx_c_pays (rowid,code,libelle) values (239, 'ZM', 'Zambie' ); -insert into llx_c_pays (rowid,code,libelle) values (240, 'ZW', 'Zimbabwe' ); -insert into llx_c_pays (rowid,code,libelle) values (241, 'GG', 'Guernesey' ); -insert into llx_c_pays (rowid,code,libelle) values (242, 'IM', 'Ile de Man' ); -insert into llx_c_pays (rowid,code,libelle) values (243, 'JE', 'Jersey' ); -insert into llx_c_pays (rowid,code,libelle) values (244, 'ME', 'Monténégro' ); -insert into llx_c_pays (rowid,code,libelle) values (245, 'BL', 'Saint-Barthélemy'); -insert into llx_c_pays (rowid,code,libelle) values (246, 'MF', 'Saint-Martin' ); -insert into llx_c_pays (rowid,code,libelle) values (247, 'BU', 'Burundi' ); diff --git a/htdocs/install/mysql/data/llx_10_c_regions.sql b/htdocs/install/mysql/data/llx_10_c_regions.sql index f8cf6e6618f..4415f5711bf 100644 --- a/htdocs/install/mysql/data/llx_10_c_regions.sql +++ b/htdocs/install/mysql/data/llx_10_c_regions.sql @@ -32,242 +32,243 @@ -- Regions -- -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (1,0,0,'0',0,'-'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 0, 0, '0',0,'-'); -- Regions France (id country=1) -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values ( 101, 1, 1,'97105',3,'Guadeloupe'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values ( 102, 1, 2,'97209',3,'Martinique'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values ( 103, 1, 3,'97302',3,'Guyane'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values ( 104, 1, 4,'97411',3,'Réunion'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values ( 105, 1, 11,'75056',1,'Île-de-France'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values ( 106, 1, 21,'51108',0,'Champagne-Ardenne'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values ( 107, 1, 22,'80021',0,'Picardie'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values ( 108, 1, 23,'76540',0,'Haute-Normandie'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values ( 109, 1, 24,'45234',2,'Centre'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values ( 110, 1, 25,'14118',0,'Basse-Normandie'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values ( 111, 1, 26,'21231',0,'Bourgogne'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values ( 112, 1, 31,'59350',2,'Nord-Pas-de-Calais'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values ( 113, 1, 41,'57463',0,'Lorraine'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values ( 114, 1, 42,'67482',1,'Alsace'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values ( 115, 1, 43,'25056',0,'Franche-Comté'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values ( 116, 1, 52,'44109',4,'Pays de la Loire'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values ( 117, 1, 53,'35238',0,'Bretagne'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values ( 118, 1, 54,'86194',2,'Poitou-Charentes'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values ( 119, 1, 72,'33063',1,'Aquitaine'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values ( 120, 1, 73,'31555',0,'Midi-Pyrénées'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values ( 121, 1, 74,'87085',2,'Limousin'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values ( 122, 1, 82,'69123',2,'Rhône-Alpes'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values ( 123, 1, 83,'63113',1,'Auvergne'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values ( 124, 1, 91,'34172',2,'Languedoc-Roussillon'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values ( 125, 1, 93,'13055',0,'Provence-Alpes-Côte d''Azur'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values ( 126, 1, 94,'2A004',0,'Corse'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 1,'97105',3,'Guadeloupe'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 2,'97209',3,'Martinique'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 3,'97302',3,'Guyane'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 4,'97411',3,'Réunion'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 6,'',3,'Mayotte'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 11,'75056',1,'Île-de-France'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 21,'51108',0,'Champagne-Ardenne'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 22,'80021',0,'Picardie'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 23,'76540',0,'Haute-Normandie'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 24,'45234',2,'Centre'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 25,'14118',0,'Basse-Normandie'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 26,'21231',0,'Bourgogne'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 31,'59350',2,'Nord-Pas-de-Calais'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 41,'57463',0,'Lorraine'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 42,'67482',1,'Alsace'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 43,'25056',0,'Franche-Comté'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 52,'44109',4,'Pays de la Loire'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 53,'35238',0,'Bretagne'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 54,'86194',2,'Poitou-Charentes'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 72,'33063',1,'Aquitaine'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 73,'31555',0,'Midi-Pyrénées'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 74,'87085',2,'Limousin'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 82,'69123',2,'Rhône-Alpes'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 83,'63113',1,'Auvergne'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 91,'34172',2,'Languedoc-Roussillon'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 93,'13055',0,'Provence-Alpes-Côte d''Azur'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 94,'2A004',0,'Corse'); -- Regions Belgium (id country=2) -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values ( 201, 2, 201, '',1,'Flandre'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values ( 202, 2, 202, '',2,'Wallonie'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values ( 203, 2, 203, '',3,'Bruxelles-Capitale'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 2, 201, '',1,'Flandre'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 2, 202, '',2,'Wallonie'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 2, 203, '',3,'Bruxelles-Capitale'); -- Regions Italy (id country=3) -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (301, 3, 301, NULL, 1, 'Abruzzo'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (302, 3, 302, NULL, 1, 'Basilicata'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (303, 3, 303, NULL, 1, 'Calabria'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (304, 3, 304, NULL, 1, 'Campania'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (305, 3, 305, NULL, 1, 'Emilia-Romagna'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (306, 3, 306, NULL, 1, 'Friuli-Venezia Giulia'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (307, 3, 307, NULL, 1, 'Lazio'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (308, 3, 308, NULL, 1, 'Liguria'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (309, 3, 309, NULL, 1, 'Lombardia'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (310, 3, 310, NULL, 1, 'Marche'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (311, 3, 311, NULL, 1, 'Molise'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (312, 3, 312, NULL, 1, 'Piemonte'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (313, 3, 313, NULL, 1, 'Puglia'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (314, 3, 314, NULL, 1, 'Sardegna'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (315, 3, 315, NULL, 1, 'Sicilia'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (316, 3, 316, NULL, 1, 'Toscana'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (317, 3, 317, NULL, 1, 'Trentino-Alto Adige'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (318, 3, 318, NULL, 1, 'Umbria'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (319, 3, 319, NULL, 1, 'Valle d Aosta'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (320, 3, 320, NULL, 1, 'Veneto'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 3, 301, NULL, 1, 'Abruzzo'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 3, 302, NULL, 1, 'Basilicata'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 3, 303, NULL, 1, 'Calabria'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 3, 304, NULL, 1, 'Campania'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 3, 305, NULL, 1, 'Emilia-Romagna'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 3, 306, NULL, 1, 'Friuli-Venezia Giulia'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 3, 307, NULL, 1, 'Lazio'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 3, 308, NULL, 1, 'Liguria'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 3, 309, NULL, 1, 'Lombardia'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 3, 310, NULL, 1, 'Marche'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 3, 311, NULL, 1, 'Molise'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 3, 312, NULL, 1, 'Piemonte'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 3, 313, NULL, 1, 'Puglia'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 3, 314, NULL, 1, 'Sardegna'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 3, 315, NULL, 1, 'Sicilia'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 3, 316, NULL, 1, 'Toscana'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 3, 317, NULL, 1, 'Trentino-Alto Adige'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 3, 318, NULL, 1, 'Umbria'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 3, 319, NULL, 1, 'Valle d Aosta'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 3, 320, NULL, 1, 'Veneto'); -- Regions Spain (id country=4) -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (401, 4, 401, '', 0, 'Andalucia', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (402, 4, 402, '', 0, 'Aragón', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (403, 4, 403, '', 0, 'Castilla y León', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (404, 4, 404, '', 0, 'Castilla la Mancha', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (405, 4, 405, '', 0, 'Canarias', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (406, 4, 406, '', 0, 'Cataluña', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (407, 4, 407, '', 0, 'Comunidad de Ceuta', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (408, 4, 408, '', 0, 'Comunidad Foral de Navarra', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (409, 4, 409, '', 0, 'Comunidad de Melilla', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (410, 4, 410, '', 0, 'Cantabria', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (411, 4, 411, '', 0, 'Comunidad Valenciana', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (412, 4, 412, '', 0, 'Extemadura', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (413, 4, 413, '', 0, 'Galicia', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (414, 4, 414, '', 0, 'Islas Baleares', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (415, 4, 415, '', 0, 'La Rioja', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (416, 4, 416, '', 0, 'Comunidad de Madrid', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (417, 4, 417, '', 0, 'Región de Murcia', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (418, 4, 418, '', 0, 'Principado de Asturias', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (419, 4, 419, '', 0, 'Pais Vasco', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (420, 4, 420, '', 0, 'Otros', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 4, 401, '', 0, 'Andalucia', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 4, 402, '', 0, 'Aragón', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 4, 403, '', 0, 'Castilla y León', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 4, 404, '', 0, 'Castilla la Mancha', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 4, 405, '', 0, 'Canarias', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 4, 406, '', 0, 'Cataluña', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 4, 407, '', 0, 'Comunidad de Ceuta', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 4, 408, '', 0, 'Comunidad Foral de Navarra', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 4, 409, '', 0, 'Comunidad de Melilla', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 4, 410, '', 0, 'Cantabria', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 4, 411, '', 0, 'Comunidad Valenciana', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 4, 412, '', 0, 'Extemadura', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 4, 413, '', 0, 'Galicia', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 4, 414, '', 0, 'Islas Baleares', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 4, 415, '', 0, 'La Rioja', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 4, 416, '', 0, 'Comunidad de Madrid', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 4, 417, '', 0, 'Región de Murcia', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 4, 418, '', 0, 'Principado de Asturias', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 4, 419, '', 0, 'Pais Vasco', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 4, 420, '', 0, 'Otros', 1); -- Regions Germany (id country=5) -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (501, 5, 501, '', 0, 'Deutschland', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 5, 501, '', 0, 'Deutschland', 1); -- Regions Greece (id_country=102) -INSERT INTO llx_c_regions (rowid, code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (10201, 10201, 102, NULL, NULL, 'Αττική', 1); -INSERT INTO llx_c_regions (rowid, code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (10202, 10202, 102, NULL, NULL, 'Στερεά Ελλάδα', 1); -INSERT INTO llx_c_regions (rowid, code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (10203, 10203, 102, NULL, NULL, 'Κεντρική Μακεδονία', 1); -INSERT INTO llx_c_regions (rowid, code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (10204, 10204, 102, NULL, NULL, 'Κρήτη', 1); -INSERT INTO llx_c_regions (rowid, code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (10205, 10205, 102, NULL, NULL, 'Ανατολική Μακεδονία και Θράκη', 1); -INSERT INTO llx_c_regions (rowid, code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (10206, 10206, 102, NULL, NULL, 'Ήπειρος', 1); -INSERT INTO llx_c_regions (rowid, code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (10207, 10207, 102, NULL, NULL, 'Ιόνια νησιά', 1); -INSERT INTO llx_c_regions (rowid, code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (10208, 10208, 102, NULL, NULL, 'Βόρειο Αιγαίο', 1); -INSERT INTO llx_c_regions (rowid, code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (10209, 10209, 102, NULL, NULL, 'Πελοπόννησος', 1); -INSERT INTO llx_c_regions (rowid, code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (10210, 10210, 102, NULL, NULL, 'Νότιο Αιγαίο', 1); -INSERT INTO llx_c_regions (rowid, code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (10211, 10211, 102, NULL, NULL, 'Δυτική Ελλάδα', 1); -INSERT INTO llx_c_regions (rowid, code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (10212, 10212, 102, NULL, NULL, 'Θεσσαλία', 1); -INSERT INTO llx_c_regions (rowid, code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (10213, 10213, 102, NULL, NULL, 'Δυτική Μακεδονία', 1); +INSERT INTO llx_c_regions ( code_region, fk_pays, cheflieu, tncc, nom, active) values ( 10201, 102, NULL, NULL, 'Αττική', 1); +INSERT INTO llx_c_regions ( code_region, fk_pays, cheflieu, tncc, nom, active) values ( 10202, 102, NULL, NULL, 'Στερεά Ελλάδα', 1); +INSERT INTO llx_c_regions ( code_region, fk_pays, cheflieu, tncc, nom, active) values ( 10203, 102, NULL, NULL, 'Κεντρική Μακεδονία', 1); +INSERT INTO llx_c_regions ( code_region, fk_pays, cheflieu, tncc, nom, active) values ( 10204, 102, NULL, NULL, 'Κρήτη', 1); +INSERT INTO llx_c_regions ( code_region, fk_pays, cheflieu, tncc, nom, active) values ( 10205, 102, NULL, NULL, 'Ανατολική Μακεδονία και Θράκη', 1); +INSERT INTO llx_c_regions ( code_region, fk_pays, cheflieu, tncc, nom, active) values ( 10206, 102, NULL, NULL, 'Ήπειρος', 1); +INSERT INTO llx_c_regions ( code_region, fk_pays, cheflieu, tncc, nom, active) values ( 10207, 102, NULL, NULL, 'Ιόνια νησιά', 1); +INSERT INTO llx_c_regions ( code_region, fk_pays, cheflieu, tncc, nom, active) values ( 10208, 102, NULL, NULL, 'Βόρειο Αιγαίο', 1); +INSERT INTO llx_c_regions ( code_region, fk_pays, cheflieu, tncc, nom, active) values ( 10209, 102, NULL, NULL, 'Πελοπόννησος', 1); +INSERT INTO llx_c_regions ( code_region, fk_pays, cheflieu, tncc, nom, active) values ( 10210, 102, NULL, NULL, 'Νότιο Αιγαίο', 1); +INSERT INTO llx_c_regions ( code_region, fk_pays, cheflieu, tncc, nom, active) values ( 10211, 102, NULL, NULL, 'Δυτική Ελλάδα', 1); +INSERT INTO llx_c_regions ( code_region, fk_pays, cheflieu, tncc, nom, active) values ( 10212, 102, NULL, NULL, 'Θεσσαλία', 1); +INSERT INTO llx_c_regions ( code_region, fk_pays, cheflieu, tncc, nom, active) values ( 10213, 102, NULL, NULL, 'Δυτική Μακεδονία', 1); -- Regions Switzerland (id country=6) -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (601, 6, 601, '', 1, 'Cantons', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 6, 601, '', 1, 'Cantons', 1); -- Regions England (id_country=7) -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (701, 7, 701, '', 0, 'England', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (702, 7, 702, '', 0, 'Wales', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (703, 7, 703, '', 0, 'Scotland', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (704, 7, 704, '', 0, 'Northern Ireland', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 7, 701, '', 0, 'England', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 7, 702, '', 0, 'Wales', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 7, 703, '', 0, 'Scotland', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 7, 704, '', 0, 'Northern Ireland', 1); -- Regions Tunisia (id country=10) -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (1001,10,1001, '',0,'Ariana'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (1002,10,1002, '',0,'Béja'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (1003,10,1003, '',0,'Ben Arous'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (1004,10,1004, '',0,'Bizerte'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (1005,10,1005, '',0,'Gabès'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (1006,10,1006, '',0,'Gafsa'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (1007,10,1007, '',0,'Jendouba'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (1008,10,1008, '',0,'Kairouan'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (1009,10,1009, '',0,'Kasserine'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (1010,10,1010, '',0,'Kébili'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (1011,10,1011, '',0,'La Manouba'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (1012,10,1012, '',0,'Le Kef'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (1013,10,1013, '',0,'Mahdia'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (1014,10,1014, '',0,'Médenine'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (1015,10,1015, '',0,'Monastir'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (1016,10,1016, '',0,'Nabeul'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (1017,10,1017, '',0,'Sfax'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (1018,10,1018, '',0,'Sidi Bouzid'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (1019,10,1019, '',0,'Siliana'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (1020,10,1020, '',0,'Sousse'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (1021,10,1021, '',0,'Tataouine'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (1022,10,1022, '',0,'Tozeur'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (1023,10,1023, '',0,'Tunis'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (1024,10,1024, '',0,'Zaghouan'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (10,1001, '',0,'Ariana'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (10,1002, '',0,'Béja'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (10,1003, '',0,'Ben Arous'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (10,1004, '',0,'Bizerte'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (10,1005, '',0,'Gabès'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (10,1006, '',0,'Gafsa'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (10,1007, '',0,'Jendouba'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (10,1008, '',0,'Kairouan'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (10,1009, '',0,'Kasserine'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (10,1010, '',0,'Kébili'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (10,1011, '',0,'La Manouba'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (10,1012, '',0,'Le Kef'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (10,1013, '',0,'Mahdia'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (10,1014, '',0,'Médenine'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (10,1015, '',0,'Monastir'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (10,1016, '',0,'Nabeul'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (10,1017, '',0,'Sfax'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (10,1018, '',0,'Sidi Bouzid'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (10,1019, '',0,'Siliana'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (10,1020, '',0,'Sousse'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (10,1021, '',0,'Tataouine'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (10,1022, '',0,'Tozeur'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (10,1023, '',0,'Tunis'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (10,1024, '',0,'Zaghouan'); -- Region US (id country=11) -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (1101, 11, 1101, '', 0, 'United-States', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 11, 1101, '', 0, 'United-States', 1); -- Region Canada (id country=14) -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (1401, 14, 1401, '', 0, 'Canada', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 14, 1401, '', 0, 'Canada', 1); -- Regions The Netherlands (id country=17) -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (1701, 17, 1701, '', 0,'Provincies van Nederland ', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 17, 1701, '', 0,'Provincies van Nederland ', 1); -- Regions Argentina (id country=23) -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (2301, 23, 2301, '', 0, 'Norte', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (2302, 23, 2302, '', 0, 'Litoral', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (2303, 23, 2303, '', 0, 'Cuyana', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (2304, 23, 2304, '', 0, 'Central', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (2305, 23, 2305, '', 0, 'Patagonia', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 23, 2301, '', 0, 'Norte', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 23, 2302, '', 0, 'Litoral', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 23, 2303, '', 0, 'Cuyana', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 23, 2304, '', 0, 'Central', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 23, 2305, '', 0, 'Patagonia', 1); -- Regions Australia (id country=28) -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (2801, 28, 2801, '', 0, 'Australia', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 28, 2801, '', 0, 'Australia', 1); -- Regions Brazil (id country=56) -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (5601, 56, 5601, '', 0, 'Brasil', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 56, 5601, '', 0, 'Brasil', 1); -- Regions Colombie (id country=70) -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (7001, 70, 7001, '', 0, 'Colombie', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 70, 7001, '', 0, 'Colombie', 1); -- Regions Chile (id country=67) -INSERT INTO llx_c_regions (rowid, code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (6701, 6701, 67, NULL, NULL, 'Tarapacá', 1); -INSERT INTO llx_c_regions (rowid, code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (6702, 6702, 67, NULL, NULL, 'Antofagasta', 1); -INSERT INTO llx_c_regions (rowid, code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (6703, 6703, 67, NULL, NULL, 'Atacama', 1); -INSERT INTO llx_c_regions (rowid, code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (6704, 6704, 67, NULL, NULL, 'Coquimbo', 1); -INSERT INTO llx_c_regions (rowid, code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (6705, 6705, 67, NULL, NULL, 'Valparaíso', 1); -INSERT INTO llx_c_regions (rowid, code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (6706, 6706, 67, NULL, NULL, 'General Bernardo O Higgins', 1); -INSERT INTO llx_c_regions (rowid, code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (6707, 6707, 67, NULL, NULL, 'Maule', 1); -INSERT INTO llx_c_regions (rowid, code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (6708, 6708, 67, NULL, NULL, 'Biobío', 1); -INSERT INTO llx_c_regions (rowid, code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (6709, 6709, 67, NULL, NULL, 'Raucanía', 1); -INSERT INTO llx_c_regions (rowid, code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (6710, 6710, 67, NULL, NULL, 'Los Lagos', 1); -INSERT INTO llx_c_regions (rowid, code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (6711, 6711, 67, NULL, NULL, 'Aysén General Carlos Ibáñez del Campo', 1); -INSERT INTO llx_c_regions (rowid, code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (6712, 6712, 67, NULL, NULL, 'Magallanes y Antártica Chilena', 1); -INSERT INTO llx_c_regions (rowid, code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (6713, 6713, 67, NULL, NULL, 'Metropolitana de Santiago', 1); -INSERT INTO llx_c_regions (rowid, code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (6714, 6714, 67, NULL, NULL, 'Los Ríos', 1); -INSERT INTO llx_c_regions (rowid, code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (6715, 6715, 67, NULL, NULL, 'Arica y Parinacota', 1); +INSERT INTO llx_c_regions ( code_region, fk_pays, cheflieu, tncc, nom, active) values ( 6701, 67, NULL, NULL, 'Tarapacá', 1); +INSERT INTO llx_c_regions ( code_region, fk_pays, cheflieu, tncc, nom, active) values ( 6702, 67, NULL, NULL, 'Antofagasta', 1); +INSERT INTO llx_c_regions ( code_region, fk_pays, cheflieu, tncc, nom, active) values ( 6703, 67, NULL, NULL, 'Atacama', 1); +INSERT INTO llx_c_regions ( code_region, fk_pays, cheflieu, tncc, nom, active) values ( 6704, 67, NULL, NULL, 'Coquimbo', 1); +INSERT INTO llx_c_regions ( code_region, fk_pays, cheflieu, tncc, nom, active) values ( 6705, 67, NULL, NULL, 'Valparaíso', 1); +INSERT INTO llx_c_regions ( code_region, fk_pays, cheflieu, tncc, nom, active) values ( 6706, 67, NULL, NULL, 'General Bernardo O Higgins', 1); +INSERT INTO llx_c_regions ( code_region, fk_pays, cheflieu, tncc, nom, active) values ( 6707, 67, NULL, NULL, 'Maule', 1); +INSERT INTO llx_c_regions ( code_region, fk_pays, cheflieu, tncc, nom, active) values ( 6708, 67, NULL, NULL, 'Biobío', 1); +INSERT INTO llx_c_regions ( code_region, fk_pays, cheflieu, tncc, nom, active) values ( 6709, 67, NULL, NULL, 'Raucanía', 1); +INSERT INTO llx_c_regions ( code_region, fk_pays, cheflieu, tncc, nom, active) values ( 6710, 67, NULL, NULL, 'Los Lagos', 1); +INSERT INTO llx_c_regions ( code_region, fk_pays, cheflieu, tncc, nom, active) values ( 6711, 67, NULL, NULL, 'Aysén General Carlos Ibáñez del Campo', 1); +INSERT INTO llx_c_regions ( code_region, fk_pays, cheflieu, tncc, nom, active) values ( 6712, 67, NULL, NULL, 'Magallanes y Antártica Chilena', 1); +INSERT INTO llx_c_regions ( code_region, fk_pays, cheflieu, tncc, nom, active) values ( 6713, 67, NULL, NULL, 'Metropolitana de Santiago', 1); +INSERT INTO llx_c_regions ( code_region, fk_pays, cheflieu, tncc, nom, active) values ( 6714, 67, NULL, NULL, 'Los Ríos', 1); +INSERT INTO llx_c_regions ( code_region, fk_pays, cheflieu, tncc, nom, active) values ( 6715, 67, NULL, NULL, 'Arica y Parinacota', 1); -- Regions San Salvador (id country=86) -INSERT INTO llx_c_regions (rowid, code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (8601, 8601, 86, NULL, NULL, 'Central', 1); -INSERT INTO llx_c_regions (rowid, code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (8602, 8602, 86, NULL, NULL, 'Oriental', 1); -INSERT INTO llx_c_regions (rowid, code_region, fk_pays, cheflieu, tncc, nom, active) VALUES (8603, 8603, 86, NULL, NULL, 'Occidental', 1); +INSERT INTO llx_c_regions ( code_region, fk_pays, cheflieu, tncc, nom, active) values ( 8601, 86, NULL, NULL, 'Central', 1); +INSERT INTO llx_c_regions ( code_region, fk_pays, cheflieu, tncc, nom, active) values ( 8602, 86, NULL, NULL, 'Oriental', 1); +INSERT INTO llx_c_regions ( code_region, fk_pays, cheflieu, tncc, nom, active) values ( 8603, 86, NULL, NULL, 'Occidental', 1); -- Regions Honduras (id country=114) -insert into llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) values (11401, 114, 11401, '', 0, 'Honduras', 1); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 114, 11401, '', 0, 'Honduras', 1); -- Regions India (id country=117) -insert into llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) values (11701, 117, 11701, '', 0, 'India', 1); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 117, 11701, '', 0, 'India', 1); -- Regions Mauritius (id country=152) -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (15201, 152, 15201, '', 0, 'Rivière Noire', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (15202, 152, 15202, '', 0, 'Flacq', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (15203, 152, 15203, '', 0, 'Grand Port', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (15204, 152, 15204, '', 0, 'Moka', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (15205, 152, 15205, '', 0, 'Pamplemousses', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (15206, 152, 15206, '', 0, 'Plaines Wilhems', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (15207, 152, 15207, '', 0, 'Port-Louis', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (15208, 152, 15208, '', 0, 'Rivière du Rempart', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (15209, 152, 15209, '', 0, 'Savanne', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (15210, 152, 15210, '', 0, 'Rodrigues', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (15211, 152, 15211, '', 0, 'Les îles Agaléga', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (15212, 152, 15212, '', 0, 'Les écueils des Cargados Carajos', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 152, 15201, '', 0, 'Rivière Noire', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 152, 15202, '', 0, 'Flacq', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 152, 15203, '', 0, 'Grand Port', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 152, 15204, '', 0, 'Moka', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 152, 15205, '', 0, 'Pamplemousses', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 152, 15206, '', 0, 'Plaines Wilhems', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 152, 15207, '', 0, 'Port-Louis', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 152, 15208, '', 0, 'Rivière du Rempart', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 152, 15209, '', 0, 'Savanne', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 152, 15210, '', 0, 'Rodrigues', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 152, 15211, '', 0, 'Les îles Agaléga', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 152, 15212, '', 0, 'Les écueils des Cargados Carajos', 1); -- Regions Mexique (id country=154) -insert into llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) values (15401, 154, 15401, '', 0, 'Mexique', 1); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 154, 15401, '', 0, 'Mexique', 1); -- Regions Barbados (id country=46) -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (4601, 46, 4601, '', 0, 'Barbados', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 46, 4601, '', 0, 'Barbados', 1); -- Regions Venezuela (id country=232) -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (23201, 232, 23201, '', 0, 'Los Andes', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (23202, 232, 23202, '', 0, 'Capital', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (23203, 232, 23203, '', 0, 'Central', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (23204, 232, 23204, '', 0, 'Cento Occidental', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (23205, 232, 23205, '', 0, 'Guayana', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (23206, 232, 23206, '', 0, 'Insular', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (23207, 232, 23207, '', 0, 'Los Llanos', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (23208, 232, 23208, '', 0, 'Nor-Oriental', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (23209, 232, 23209, '', 0, 'Zuliana', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 232, 23201, '', 0, 'Los Andes', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 232, 23202, '', 0, 'Capital', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 232, 23203, '', 0, 'Central', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 232, 23204, '', 0, 'Cento Occidental', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 232, 23205, '', 0, 'Guayana', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 232, 23206, '', 0, 'Insular', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 232, 23207, '', 0, 'Los Llanos', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 232, 23208, '', 0, 'Nor-Oriental', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 232, 23209, '', 0, 'Zuliana', 1); -- Regions Algeria (id country=13) -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES(1301, 13, 1301, '', 0, 'Algerie', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 13, 1301, '', 0, 'Algerie', 1); -- Regions Maroc (id country=12) -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES(1201, 12, 1201, '', 0, 'Tanger-Tétouan', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES(1202, 12, 1202, '', 0, 'Gharb-Chrarda-Beni Hssen', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES(1203, 12, 1203, '', 0, 'Taza-Al Hoceima-Taounate', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES(1204, 12, 1204, '', 0, 'L''Oriental', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES(1205, 12, 1205, '', 0, 'Fès-Boulemane', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES(1206, 12, 1206, '', 0, 'Meknès-Tafialet', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES(1207, 12, 1207, '', 0, 'Rabat-Salé-Zemour-Zaër', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES(1208, 12, 1208, '', 0, 'Grand Cassablanca', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES(1209, 12, 1209, '', 0, 'Chaouia-Ouardigha', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES(1210, 12, 1210, '', 0, 'Doukahla-Adba', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES(1211, 12, 1211, '', 0, 'Marrakech-Tensift-Al Haouz', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES(1212, 12, 1212, '', 0, 'Tadla-Azilal', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES(1213, 12, 1213, '', 0, 'Sous-Massa-Drâa', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES(1214, 12, 1214, '', 0, 'Guelmim-Es Smara', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES(1215, 12, 1215, '', 0, 'Laâyoune-Boujdour-Sakia el Hamra', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES(1216, 12, 1216, '', 0, 'Oued Ed-Dahab Lagouira', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 12, 1201, '', 0, 'Tanger-Tétouan', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 12, 1202, '', 0, 'Gharb-Chrarda-Beni Hssen', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 12, 1203, '', 0, 'Taza-Al Hoceima-Taounate', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 12, 1204, '', 0, 'L''Oriental', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 12, 1205, '', 0, 'Fès-Boulemane', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 12, 1206, '', 0, 'Meknès-Tafialet', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 12, 1207, '', 0, 'Rabat-Salé-Zemour-Zaër', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 12, 1208, '', 0, 'Grand Cassablanca', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 12, 1209, '', 0, 'Chaouia-Ouardigha', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 12, 1210, '', 0, 'Doukahla-Adba', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 12, 1211, '', 0, 'Marrakech-Tensift-Al Haouz', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 12, 1212, '', 0, 'Tadla-Azilal', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 12, 1213, '', 0, 'Sous-Massa-Drâa', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 12, 1214, '', 0, 'Guelmim-Es Smara', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 12, 1215, '', 0, 'Laâyoune-Boujdour-Sakia el Hamra', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 12, 1216, '', 0, 'Oued Ed-Dahab Lagouira', 1); -- Regions Tunisia (id country=10) -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES(1001, 10, 1001, '', 0, 'Algerie', 1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 10, 1001, '', 0, 'Algerie', 1); diff --git a/htdocs/install/mysql/data/llx_20_c_departements.sql b/htdocs/install/mysql/data/llx_20_c_departements.sql index 739b1d1f537..116f9572052 100644 --- a/htdocs/install/mysql/data/llx_20_c_departements.sql +++ b/htdocs/install/mysql/data/llx_20_c_departements.sql @@ -32,7 +32,7 @@ -- Departements/Cantons/Provinces -- -insert into llx_c_departements (rowid, fk_region, code_departement,cheflieu,tncc,ncc,nom) values (0,0,'0','0',0,'-','-'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values ( 0, '0', '0',0,'-','-'); -- Departements France (id country=1) insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (82,'01','01053',5,'AIN','Ain'); diff --git a/htdocs/install/mysql/data/llx_accounting.sql b/htdocs/install/mysql/data/llx_accounting.sql index 3fc66e39b92..afc70f08a9f 100644 --- a/htdocs/install/mysql/data/llx_accounting.sql +++ b/htdocs/install/mysql/data/llx_accounting.sql @@ -27,8 +27,8 @@ -- de l'install et tous les sigles '--' sont supprimés. -- -DELETE FROM llx_accountingaccount; -DELETE FROM llx_accounting_system; +delete from llx_accountingaccount; +delete from llx_accounting_system; -- -- Descriptif des plans comptables FR PCG99-ABREGE @@ -1420,3 +1420,792 @@ INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (1355, 'PCMN-BASE', 'FINAN', 'XXXXXX', '5', '', 'Placement de trésorerie et de valeurs disponibles', '1'); INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (1356, 'PCMN-BASE', 'CHARGE', 'XXXXXX', '6', '', 'Charges', '1'); INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (1357, 'PCMN-BASE', 'PROD', 'XXXXXX', '7', '', 'Produits', '1'); + +-- +-- Descriptif des plans comptables ES PCG08-PYME +-- + +INSERT INTO llx_accounting_system (rowid, pcg_version, fk_pays, label, active) VALUES (4, 'PCG08-PYME', '4', 'The PYME accountancy spanish plan', '1'); + +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4001,'PCG08-PYME','FINANCIACION', 'XXXXXX', '1', '', 'Financiación básica', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4002,'PCG08-PYME','ACTIVO', 'XXXXXX', '2', '', 'Activo no corriente', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4003,'PCG08-PYME','EXISTENCIAS', 'XXXXXX', '3', '', 'Existencias', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4004,'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4', '', 'Acreedores y deudores por operaciones comerciales', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4005,'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5', '', 'Cuentas financieras', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4006,'PCG08-PYME','COMPRAS_GASTOS','XXXXXX', '6', '', 'Compras y gastos', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4007,'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7', '', 'Ventas e ingresos', '1'); + +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4008, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '10', '4001', 'CAPITAL', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4009, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '100', '4008', 'Capital social', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4010, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '101', '4008', 'Fondo social', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4011, 'PCG08-PYME','FINANCIACION', 'CAPITAL', '102', '4008', 'Capital', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4012, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '103', '4008', 'Socios por desembolsos no exigidos', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4013, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '1030', '4012', 'Socios por desembolsos no exigidos capital social', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4014, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '1034', '4012', 'Socios por desembolsos no exigidos capital pendiente de inscripción', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4015, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '104', '4008', 'Socios por aportaciones no dineradas pendientes', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4016, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '1040', '4015', 'Socios por aportaciones no dineradas pendientes capital social', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4017, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '1044', '4015', 'Socios por aportaciones no dineradas pendientes capital pendiente de inscripción', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4018, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '108', '4008', 'Acciones o participaciones propias en situaciones especiales', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4019, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '109', '4008', 'Acciones o participaciones propias para reducción de capital', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4020, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '11', '4001', 'Reservas y otros instrumentos de patrimonio', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4021, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '110', '4020', 'Prima de emisión o asunción', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4022, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '111', '4020', 'Otros instrumentos de patrimonio neto', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4023, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '1110', '4022', 'Patrimonio neto por emisión de instrumentos financieros compuestos', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4024, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '1111', '4022', 'Resto de instrumentos de patrimoio neto', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4025, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '112', '4020', 'Reserva legal', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4026, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '113', '4020', 'Reservas voluntarias', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4027, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '114', '4020', 'Reservas especiales', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4028, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '1140', '4027', 'Reservas para acciones o participaciones de la sociedad dominante', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4029, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '1141', '4027', 'Reservas estatutarias', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4030, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '1142', '4027', 'Reservas por capital amortizado', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4031, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '1143', '4027', 'Reservas por fondo de comercio', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4032, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '1144', '4028', 'Reservas por acciones propias aceptadas en garantía', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4033, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '115', '4020', 'Reservas por pérdidas y ganancias actuariales y otros ajustes', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4034, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '118', '4020', 'Aportaciones de socios o propietarios', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4035, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '119', '4020', 'Diferencias por ajuste del capital a euros', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4036, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '12', '4001', 'Resultados pendientes de aplicación', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4037, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '120', '4036', 'Remanente', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4038, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '121', '4036', 'Resultados negativos de ejercicios anteriores', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4039, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '129', '4036', 'Resultado del ejercicio', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4040, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '13', '4001', 'Subvenciones, donaciones y ajustes por cambio de valor', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4041, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '130', '4040', 'Subvenciones oficiales de capital', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4042, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '131', '4040', 'Donaciones y legados de capital', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4043, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '132', '4040', 'Otras subvenciones, donaciones y legados', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4044, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '133', '4040', 'Ajustes por valoración en activos financieros disponibles para la venta', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4045, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '134', '4040', 'Operaciones de cobertura', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4046, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '1340', '4045', 'Cobertura de flujos de efectivo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4047, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '1341', '4045', 'Cobertura de una inversión neta en un negocio extranjero', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4048, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '135', '4040', 'Diferencias de conversión', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4049, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '136', '4040', 'Ajustes por valoración en activos no corrientes y grupos enajenables de elementos mantenidos para la venta', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4050, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '137', '4040', 'Ingresos fiscales a distribuir en varios ejercicios', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4051, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '1370', '4050', 'Ingresos fiscales por diferencias permanentes a distribuir en varios ejercicios', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4052, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '1371', '4050', 'Ingresos fiscales por deducciones y bonificaciones a distribuir en varios ejercicios', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4053, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '14', '4001', 'Provisiones', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4054, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '141', '4053', 'Provisión para impuestos', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4055, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '142', '4053', 'Provisión para otras responsabilidades', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4056, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '143', '4053', 'Provisión por desmantelamiento, retiro o rehabilitación del inmovilizado', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4057, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '145', '4053', 'Provisión para actuaciones medioambientales', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4058, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '15', '4001', 'Deudas a largo plazo con características especiales', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4059, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '150', '4058', 'Acciones o participaciones a largo plazo consideradas como pasivos financieros', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4060, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '153', '4058', 'Desembolsos no exigidos por acciones o participaciones consideradas como pasivos financieros', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4061, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '1533', '4060', 'Desembolsos no exigidos empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4062, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '1534', '4060', 'Desembolsos no exigidos empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4063, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '1535', '4060', 'Desembolsos no exigidos otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4064, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '1536', '4060', 'Otros desembolsos no exigidos', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4065, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '154', '4058', 'Aportaciones no dinerarias pendientes por acciones o participaciones consideradas como pasivos financieros', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4066, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '1543', '4065', 'Aportaciones no dinerarias pendientes empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4067, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '1544', '4065', 'Aportaciones no dinerarias pendientes empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4068, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '1545', '4065', 'Aportaciones no dinerarias pendientes otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4069, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '1546', '4065', 'Otras aportaciones no dinerarias pendientes', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4070, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '16', '4001', 'Deudas a largo plazo con partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4071, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '160', '4070', 'Deudas a largo plazo con entidades de crédito vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4072, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '1603', '4071', 'Deudas a largo plazo con entidades de crédito empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4073, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '1604', '4071', 'Deudas a largo plazo con entidades de crédito empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4074, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '1605', '4071', 'Deudas a largo plazo con otras entidades de crédito vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4075, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '161', '4070', 'Proveedores de inmovilizado a largo plazo partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4076, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '1613', '4075', 'Proveedores de inmovilizado a largo plazo empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4077, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '1614', '4075', 'Proveedores de inmovilizado a largo plazo empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4078, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '1615', '4075', 'Proveedores de inmovilizado a largo plazo otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4079, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '162', '4070', 'Acreedores por arrendamiento financiero a largo plazo partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4080, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '1623', '4079', 'Acreedores por arrendamiento financiero a largo plazo empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4081, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '1624', '4080', 'Acreedores por arrendamiento financiero a largo plazo empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4082, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '1625', '4080', 'Acreedores por arrendamiento financiero a largo plazo otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4083, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '163', '4070', 'Otras deudas a largo plazo con partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4084, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '1633', '4083', 'Otras deudas a largo plazo empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4085, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '1634', '4083', 'Otras deudas a largo plazo empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4086, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '1635', '4083', 'Otras deudas a largo plazo otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4087, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '17', '4001', 'Deudas a largo plazo por préstamos recibidos empresitos y otros conceptos', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4088, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '170', '4087', 'Deudas a largo plazo con entidades de crédito', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4089, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '171', '4087', 'Deudas a largo plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4090, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '172', '4087', 'Deudas a largo plazo transformables en suvbenciones donaciones y legados', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4091, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '173', '4087', 'Proveedores de inmovilizado a largo plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4092, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '174', '4087', 'Acreedores por arrendamiento financiero a largo plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4093, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '175', '4087', 'Efectos a pagar a largo plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4094, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '176', '4087', 'Pasivos por derivados financieros a largo plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4095, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '177', '4087', 'Obligaciones y bonos', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4096, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '179', '4087', 'Deudas representadas en otros valores negociables', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4097, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '18', '4001', 'Pasivos por fianzas garantias y otros conceptos a largo plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4098, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '180', '4097', 'Fianzas recibidas a largo plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4099, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '181', '4097', 'Anticipos recibidos por ventas o prestaciones de servicios a largo plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4100, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '185', '4097', 'Depositos recibidos a largo plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4101, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '19', '4001', 'Situaciones transitorias de financiación', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4102, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '190', '4101', 'Acciones o participaciones emitidas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4103, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '192', '4101', 'Suscriptores de acciones', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4104, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '194', '4101', 'Capital emitido pendiente de inscripción', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4105, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '195', '4101', 'Acciones o participaciones emitidas consideradas como pasivos financieros', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4106, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '197', '4101', 'Suscriptores de acciones consideradas como pasivos financieros', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4107, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '199', '4101', 'Acciones o participaciones emitidas consideradas como pasivos financieros pendientes de inscripción', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4108, 'PCG08-PYME','ACTIVO', 'XXXXXX', '20', '4002', 'Inmovilizaciones intangibles', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4109, 'PCG08-PYME','ACTIVO', 'XXXXXX', '200', '4108', 'Investigación', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4110, 'PCG08-PYME','ACTIVO', 'XXXXXX', '201', '4108', 'Desarrollo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4111, 'PCG08-PYME','ACTIVO', 'XXXXXX', '202', '4108', 'Concesiones administrativas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4112, 'PCG08-PYME','ACTIVO', 'XXXXXX', '203', '4108', 'Propiedad industrial', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4113, 'PCG08-PYME','ACTIVO', 'XXXXXX', '205', '4108', 'Derechos de transpaso', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4114, 'PCG08-PYME','ACTIVO', 'XXXXXX', '206', '4108', 'Aplicaciones informáticas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4115, 'PCG08-PYME','ACTIVO', 'XXXXXX', '209', '4108', 'Anticipos para inmovilizaciones intangibles', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4116, 'PCG08-PYME','ACTIVO', 'XXXXXX', '21', '4002', 'Inmovilizaciones materiales', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4117, 'PCG08-PYME','ACTIVO', 'XXXXXX', '210', '4116', 'Terrenos y bienes naturales', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4118, 'PCG08-PYME','ACTIVO', 'XXXXXX', '211', '4116', 'Construcciones', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4119, 'PCG08-PYME','ACTIVO', 'XXXXXX', '212', '4116', 'Instalaciones técnicas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4120, 'PCG08-PYME','ACTIVO', 'XXXXXX', '213', '4116', 'Maquinaria', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4121, 'PCG08-PYME','ACTIVO', 'XXXXXX', '214', '4116', 'Utillaje', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4122, 'PCG08-PYME','ACTIVO', 'XXXXXX', '215', '4116', 'Otras instalaciones', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4123, 'PCG08-PYME','ACTIVO', 'XXXXXX', '216', '4116', 'Mobiliario', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4124, 'PCG08-PYME','ACTIVO', 'XXXXXX', '217', '4116', 'Equipos para procesos de información', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4125, 'PCG08-PYME','ACTIVO', 'XXXXXX', '218', '4116', 'Elementos de transporte', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4126, 'PCG08-PYME','ACTIVO', 'XXXXXX', '219', '4116', 'Otro inmovilizado material', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4127, 'PCG08-PYME','ACTIVO', 'XXXXXX', '22', '4002', 'Inversiones inmobiliarias', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4128, 'PCG08-PYME','ACTIVO', 'XXXXXX', '220', '4127', 'Inversiones en terreons y bienes naturales', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4129, 'PCG08-PYME','ACTIVO', 'XXXXXX', '221', '4127', 'Inversiones en construcciones', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4130, 'PCG08-PYME','ACTIVO', 'XXXXXX', '23', '4002', 'Inmovilizaciones materiales en curso', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4131, 'PCG08-PYME','ACTIVO', 'XXXXXX', '230', '4130', 'Adaptación de terrenos y bienes naturales', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4132, 'PCG08-PYME','ACTIVO', 'XXXXXX', '231', '4130', 'Construcciones en curso', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4133, 'PCG08-PYME','ACTIVO', 'XXXXXX', '232', '4130', 'Instalaciones técnicas en montaje', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4134, 'PCG08-PYME','ACTIVO', 'XXXXXX', '233', '4130', 'Maquinaria en montaje', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4135, 'PCG08-PYME','ACTIVO', 'XXXXXX', '237', '4130', 'Equipos para procesos de información en montaje', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4136, 'PCG08-PYME','ACTIVO', 'XXXXXX', '239', '4130', 'Anticipos para inmovilizaciones materiales', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4137, 'PCG08-PYME','ACTIVO', 'XXXXXX', '24', '4002', 'Inversiones financieras a largo plazo en partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4138, 'PCG08-PYME','ACTIVO', 'XXXXXX', '240', '4137', 'Participaciones a largo plazo en partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4139, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2403', '4138', 'Participaciones a largo plazo en empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4140, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2404', '4138', 'Participaciones a largo plazo en empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4141, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2405', '4138', 'Participaciones a largo plazo en otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4142, 'PCG08-PYME','ACTIVO', 'XXXXXX', '241', '4137', 'Valores representativos de deuda a largo plazo de partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4143, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2413', '4142', 'Valores representativos de deuda a largo plazo de empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4144, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2414', '4142', 'Valores representativos de deuda a largo plazo de empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4145, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2415', '4142', 'Valores representativos de deuda a largo plazo de otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4146, 'PCG08-PYME','ACTIVO', 'XXXXXX', '242', '4137', 'Créditos a largo plazo a partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4147, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2423', '4146', 'Créditos a largo plazo a empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4148, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2424', '4146', 'Créditos a largo plazo a empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4149, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2425', '4146', 'Créditos a largo plazo a otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4150, 'PCG08-PYME','ACTIVO', 'XXXXXX', '249', '4137', 'Desembolsos pendientes sobre participaciones a largo plazo en partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4151, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2493', '4150', 'Desembolsos pendientes sobre participaciones a largo plazo en empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4152, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2494', '4150', 'Desembolsos pendientes sobre participaciones a largo plazo en empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4153, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2495', '4150', 'Desembolsos pendientes sobre participaciones a largo plazo en otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4154, 'PCG08-PYME','ACTIVO', 'XXXXXX', '25', '4002', 'Otras inversiones financieras a largo plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4155, 'PCG08-PYME','ACTIVO', 'XXXXXX', '250', '4154', 'Inversiones financieras a largo plazo en instrumentos de patrimonio', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4156, 'PCG08-PYME','ACTIVO', 'XXXXXX', '251', '4154', 'Valores representativos de deuda a largo plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4157, 'PCG08-PYME','ACTIVO', 'XXXXXX', '252', '4154', 'Créditos a largo plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4158, 'PCG08-PYME','ACTIVO', 'XXXXXX', '253', '4154', 'Créditos a largo plazo por enajenación de inmovilizado', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4159, 'PCG08-PYME','ACTIVO', 'XXXXXX', '254', '4154', 'Créditos a largo plazo al personal', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4160, 'PCG08-PYME','ACTIVO', 'XXXXXX', '255', '4154', 'Activos por derivados financieros a largo plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4161, 'PCG08-PYME','ACTIVO', 'XXXXXX', '258', '4154', 'Imposiciones a largo plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4162, 'PCG08-PYME','ACTIVO', 'XXXXXX', '259', '4154', 'Desembolsos pendientes sobre participaciones en el patrimonio neto a largo plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4163, 'PCG08-PYME','ACTIVO', 'XXXXXX', '26', '4002', 'Fianzas y depósitos constituidos a largo plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4164, 'PCG08-PYME','ACTIVO', 'XXXXXX', '260', '4163', 'Fianzas constituidas a largo plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4165, 'PCG08-PYME','ACTIVO', 'XXXXXX', '261', '4163', 'Depósitos constituidos a largo plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4166, 'PCG08-PYME','ACTIVO', 'XXXXXX', '28', '4002', 'Amortización acumulada del inmovilizado', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4167, 'PCG08-PYME','ACTIVO', 'XXXXXX', '280', '4166', 'Amortización acumulado del inmovilizado intangible', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4168, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2800', '4167', 'Amortización acumulada de investigación', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4169, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2801', '4167', 'Amortización acumulada de desarrollo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4170, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2802', '4167', 'Amortización acumulada de concesiones administrativas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4171, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2803', '4167', 'Amortización acumulada de propiedad industrial', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4172, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2805', '4167', 'Amortización acumulada de derechos de transpaso', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4173, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2806', '4167', 'Amortización acumulada de aplicaciones informáticas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4174, 'PCG08-PYME','ACTIVO', 'XXXXXX', '281', '4166', 'Amortización acumulado del inmovilizado material', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4175, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2811', '4174', 'Amortización acumulada de construcciones', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4176, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2812', '4174', 'Amortización acumulada de instalaciones técnicas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4177, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2813', '4174', 'Amortización acumulada de maquinaria', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4178, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2814', '4174', 'Amortización acumulada de utillaje', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4179, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2815', '4174', 'Amortización acumulada de otras instalaciones', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4180, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2816', '4174', 'Amortización acumulada de mobiliario', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4181, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2817', '4174', 'Amortización acumulada de equipos para proceso de información', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4182, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2818', '4174', 'Amortización acumulada de elementos de transporte', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4183, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2819', '4175', 'Amortización acumulada de otro inmovilizado material', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4184, 'PCG08-PYME','ACTIVO', 'XXXXXX', '282', '4166', 'Amortización acumulada de las inversiones inmobiliarias', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4185, 'PCG08-PYME','ACTIVO', 'XXXXXX', '29', '4002', 'Deterioro de valor de activos no corrientes', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4186, 'PCG08-PYME','ACTIVO', 'XXXXXX', '290', '4185', 'Deterioro de valor del inmovilizado intangible', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4187, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2900', '4186', 'Deterioro de valor de investigación', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4188, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2901', '4186', 'Deterioro de valor de desarrollo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4189, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2902', '4186', 'Deterioro de valor de concesiones administrativas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4190, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2903', '4186', 'Deterioro de valor de propiedad industrial', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4191, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2905', '4186', 'Deterioro de valor de derechos de transpaso', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4192, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2906', '4186', 'Deterioro de valor de aplicaciones informáticas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4193, 'PCG08-PYME','ACTIVO', 'XXXXXX', '291', '4185', 'Deterioro de valor del inmovilizado material', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4194, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2910', '4193', 'Deterioro de valor de terrenos y bienes naturales', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4195, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2911', '4193', 'Deterioro de valor de construcciones', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4196, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2912', '4193', 'Deterioro de valor de instalaciones técnicas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4197, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2913', '4193', 'Deterioro de valor de maquinaria', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4198, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2914', '4193', 'Deterioro de valor de utillajes', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4199, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2915', '4194', 'Deterioro de valor de otras instalaciones', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4200, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2916', '4194', 'Deterioro de valor de mobiliario', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4201, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2917', '4194', 'Deterioro de valor de equipos para proceso de información', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4202, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2918', '4194', 'Deterioro de valor de elementos de transporte', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4203, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2919', '4194', 'Deterioro de valor de otro inmovilizado material', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4204, 'PCG08-PYME','ACTIVO', 'XXXXXX', '292', '4185', 'Deterioro de valor de las inversiones inmobiliarias', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4205, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2920', '4204', 'Deterioro de valor de terrenos y bienes naturales', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4206, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2921', '4204', 'Deterioro de valor de construcciones', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4207, 'PCG08-PYME','ACTIVO', 'XXXXXX', '293', '4185', 'Deterioro de valor de participaciones a largo plazo en partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4208, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2933', '4207', 'Deterioro de valor de participaciones a largo plazo en empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4209, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2934', '4207', 'Deterioro de valor de sobre participaciones a largo plazo en empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4210, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2935', '4207', 'Deterioro de valor de sobre participaciones a largo plazo en otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4211, 'PCG08-PYME','ACTIVO', 'XXXXXX', '294', '4185', 'Deterioro de valor de valores representativos de deuda a largo plazo en partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4212, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2943', '4211', 'Deterioro de valor de valores representativos de deuda a largo plazo en empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4213, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2944', '4211', 'Deterioro de valor de valores representativos de deuda a largo plazo en empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4214, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2945', '4211', 'Deterioro de valor de valores representativos de deuda a largo plazo en otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4215, 'PCG08-PYME','ACTIVO', 'XXXXXX', '295', '4185', 'Deterioro de valor de créditos a largo plazo a partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4216, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2953', '4215', 'Deterioro de valor de créditos a largo plazo a empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4217, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2954', '4215', 'Deterioro de valor de créditos a largo plazo a empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4218, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2955', '4215', 'Deterioro de valor de créditos a largo plazo a otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4219, 'PCG08-PYME','ACTIVO', 'XXXXXX', '296', '4185', 'Deterioro de valor de participaciones en el patrimonio netoa largo plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4220, 'PCG08-PYME','ACTIVO', 'XXXXXX', '297', '4185', 'Deterioro de valor de valores representativos de deuda a largo plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4221, 'PCG08-PYME','ACTIVO', 'XXXXXX', '298', '4185', 'Deterioro de valor de créditos a largo plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4222, 'PCG08-PYME','EXISTENCIAS', 'XXXXXX', '30', '4003', 'Comerciales', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4223, 'PCG08-PYME','EXISTENCIAS', 'XXXXXX', '300', '4222', 'Mercaderías A', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4224, 'PCG08-PYME','EXISTENCIAS', 'XXXXXX', '301', '4222', 'Mercaderías B', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4225, 'PCG08-PYME','EXISTENCIAS', 'XXXXXX', '31', '4003', 'Materias primas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4226, 'PCG08-PYME','EXISTENCIAS', 'XXXXXX', '310', '4225', 'Materias primas A', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4227, 'PCG08-PYME','EXISTENCIAS', 'XXXXXX', '311', '4225', 'Materias primas B', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4228, 'PCG08-PYME','EXISTENCIAS', 'XXXXXX', '32', '4003', 'Otros aprovisionamientos', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4229, 'PCG08-PYME','EXISTENCIAS', 'XXXXXX', '320', '4228', 'Elementos y conjuntos incorporables', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4230, 'PCG08-PYME','EXISTENCIAS', 'XXXXXX', '321', '4228', 'Combustibles', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4231, 'PCG08-PYME','EXISTENCIAS', 'XXXXXX', '322', '4228', 'Repuestos', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4232, 'PCG08-PYME','EXISTENCIAS', 'XXXXXX', '325', '4228', 'Materiales diversos', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4233, 'PCG08-PYME','EXISTENCIAS', 'XXXXXX', '326', '4228', 'Embalajes', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4234, 'PCG08-PYME','EXISTENCIAS', 'XXXXXX', '327', '4228', 'Envases', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4235, 'PCG08-PYME','EXISTENCIAS', 'XXXXXX', '328', '4229', 'Material de oficina', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4236, 'PCG08-PYME','EXISTENCIAS', 'XXXXXX', '33', '4003', 'Productos en curso', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4237, 'PCG08-PYME','EXISTENCIAS', 'XXXXXX', '330', '4236', 'Productos en curos A', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4238, 'PCG08-PYME','EXISTENCIAS', 'XXXXXX', '331', '4236', 'Productos en curso B', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4239, 'PCG08-PYME','EXISTENCIAS', 'XXXXXX', '34', '4003', 'Productos semiterminados', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4240, 'PCG08-PYME','EXISTENCIAS', 'XXXXXX', '340', '4239', 'Productos semiterminados A', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4241, 'PCG08-PYME','EXISTENCIAS', 'XXXXXX', '341', '4239', 'Productos semiterminados B', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4242, 'PCG08-PYME','EXISTENCIAS', 'XXXXXX', '35', '4003', 'Productos terminados', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4243, 'PCG08-PYME','EXISTENCIAS', 'XXXXXX', '350', '4242', 'Productos terminados A', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4244, 'PCG08-PYME','EXISTENCIAS', 'XXXXXX', '351', '4242', 'Productos terminados B', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4245, 'PCG08-PYME','EXISTENCIAS', 'XXXXXX', '36', '4003', 'Subproductos, residuos y materiales recuperados', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4246, 'PCG08-PYME','EXISTENCIAS', 'XXXXXX', '360', '4245', 'Subproductos A', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4247, 'PCG08-PYME','EXISTENCIAS', 'XXXXXX', '361', '4245', 'Subproductos B', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4248, 'PCG08-PYME','EXISTENCIAS', 'XXXXXX', '365', '4245', 'Residuos A', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4249, 'PCG08-PYME','EXISTENCIAS', 'XXXXXX', '366', '4245', 'Residuos B', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4250, 'PCG08-PYME','EXISTENCIAS', 'XXXXXX', '368', '4245', 'Materiales recuperados A', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4251, 'PCG08-PYME','EXISTENCIAS', 'XXXXXX', '369', '4245', 'Materiales recuperados B', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4252, 'PCG08-PYME','EXISTENCIAS', 'XXXXXX', '39', '4003', 'Deterioro de valor de las existencias', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4253, 'PCG08-PYME','EXISTENCIAS', 'XXXXXX', '390', '4252', 'Deterioro de valor de las mercaderías', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4254, 'PCG08-PYME','EXISTENCIAS', 'XXXXXX', '391', '4252', 'Deterioro de valor de las materias primas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4255, 'PCG08-PYME','EXISTENCIAS', 'XXXXXX', '392', '4252', 'Deterioro de valor de otros aprovisionamientos', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4256, 'PCG08-PYME','EXISTENCIAS', 'XXXXXX', '393', '4252', 'Deterioro de valor de los productos en curso', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4257, 'PCG08-PYME','EXISTENCIAS', 'XXXXXX', '394', '4252', 'Deterioro de valor de los productos semiterminados', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4258, 'PCG08-PYME','EXISTENCIAS', 'XXXXXX', '395', '4252', 'Deterioro de valor de los productos terminados', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4259, 'PCG08-PYME','EXISTENCIAS', 'XXXXXX', '396', '4252', 'Deterioro de valor de los subproductos, residuos y materiales recuperados', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4260, 'PCG08-PYME','ACREEDORES_DEUDORES', 'PROVEEDORES', '40', '4004', 'Proveedores', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4261, 'PCG08-PYME','ACREEDORES_DEUDORES', 'PROVEEDORES', '400', '4260', 'Proveedores', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4262, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4000', '4261', 'Proveedores euros', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4263, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4004', '4261', 'Proveedores moneda extranjera', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4264, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4009', '4261', 'Proveedores facturas pendientes de recibir o formalizar', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4265, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '401', '4260', 'Proveedores efectos comerciales a pagar', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4266, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '403', '4260', 'Proveedores empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4267, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4030', '4266', 'Proveedores empresas del grupo euros', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4268, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4031', '4266', 'Efectos comerciales a pagar empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4269, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4034', '4266', 'Proveedores empresas del grupo moneda extranjera', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4270, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4036', '4266', 'Envases y embalajes a devolver a proveedores empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4271, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4039', '4266', 'Proveedores empresas del grupo facturas pendientes de recibir o de formalizar', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4272, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '404', '4260', 'Proveedores empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4273, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '405', '4260', 'Proveedores otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4274, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '406', '4260', 'Envases y embalajes a devolver a proveedores', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4275, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '407', '4260', 'Anticipos a proveedores', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4276, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '41', '4004', 'Acreedores varios', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4277, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '410', '4276', 'Acreedores por prestaciones de servicios', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4278, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4100', '4277', 'Acreedores por prestaciones de servicios euros', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4279, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4104', '4277', 'Acreedores por prestaciones de servicios moneda extranjera', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4280, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4109', '4277', 'Acreedores por prestaciones de servicios facturas pendientes de recibir o formalizar', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4281, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '411', '4276', 'Acreedores efectos comerciales a pagar', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4282, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '419', '4276', 'Acreedores por operaciones en común', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4283, 'PCG08-PYME','ACREEDORES_DEUDORES', 'CLIENTES', '43', '4004', 'Clientes', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4284, 'PCG08-PYME','ACREEDORES_DEUDORES', 'CLIENTES', '430', '4283', 'Clientes', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4285, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4300', '4284', 'Clientes euros', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4286, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4304', '4284', 'Clientes moneda extranjera', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4287, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4309', '4284', 'Clientes facturas pendientes de formalizar', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4288, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '431', '4283', 'Clientes efectos comerciales a cobrar', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4289, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4310', '4288', 'Efectos comerciales en cartera', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4290, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4311', '4288', 'Efectos comerciales descontados', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4291, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4312', '4288', 'Efectos comerciales en gestión de cobro', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4292, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4315', '4288', 'Efectos comerciales impagados', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4293, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '432', '4283', 'Clientes operaciones de factoring', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4294, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '433', '4283', 'Clientes empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4295, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4330', '4294', 'Clientes empresas del grupo euros', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4296, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4331', '4294', 'Efectos comerciales a cobrar empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4297, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4332', '4294', 'Clientes empresas del grupo operaciones de factoring', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4298, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4334', '4294', 'Clientes empresas del grupo moneda extranjera', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4299, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4336', '4294', 'Clientes empresas del grupo dudoso cobro', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4300, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4337', '4294', 'Envases y embalajes a devolver a clientes empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4301, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4339', '4294', 'Clientes empresas del grupo facturas pendientes de formalizar', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4302, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '434', '4283', 'Clientes empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4303, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '435', '4283', 'Clientes otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4304, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '436', '4283', 'Clientes de dudoso cobro', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4305, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '437', '4283', 'Envases y embalajes a devolver por clientes', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4306, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '438', '4283', 'Anticipos de clientes', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4307, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '44', '4004', 'Deudores varios', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4308, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '440', '4307', 'Deudores', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4309, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4400', '4308', 'Deudores euros', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4310, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4404', '4308', 'Deudores moneda extranjera', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4311, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4409', '4308', 'Deudores facturas pendientes de formalizar', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4312, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '441', '4307', 'Deudores efectos comerciales a cobrar', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4313, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4410', '4312', 'Deudores efectos comerciales en cartera', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4314, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4411', '4312', 'Deudores efectos comerciales descontados', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4315, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4412', '4312', 'Deudores efectos comerciales en gestión de cobro', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4316, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4415', '4312', 'Deudores efectos comerciales impagados', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4317, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '446', '4307', 'Deudores de dusoso cobro', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4318, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '449', '4307', 'Deudores por operaciones en común', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4319, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '46', '4004', 'Personal', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4320, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '460', '4319', 'Anticipos de renumeraciones', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4321, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '465', '4319', 'Renumeraciones pendientes de pago', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4322, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '47', '4004', 'Administraciones Públicas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4323, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '470', '4322', 'Hacienda Pública deudora por diversos conceptos', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4324, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4700', '4323', 'Hacienda Pública deudora por IVA', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4325, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4708', '4323', 'Hacienda Pública deudora por subvenciones concedidas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4326, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4709', '4323', 'Hacienda Pública deudora por devolución de impuestos', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4327, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '471', '4322', 'Organismos de la Seguridad Social deudores', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4328, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '472', '4322', 'Hacienda Pública IVA soportado', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4329, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '473', '4322', 'Hacienda Pública retenciones y pagos a cuenta', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4330, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '474', '4322', 'Activos por impuesto diferido', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4331, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4740', '4330', 'Activos por diferencias temporarias deducibles', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4332, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4742', '4330', 'Derechos por deducciones y bonificaciones pendientes de aplicar', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4333, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4745', '4330', 'Crédito por pérdidasa compensar del ejercicio', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4334, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '475', '4322', 'Hacienda Pública acreedora por conceptos fiscales', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4335, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4750', '4334', 'Hacienda Pública acreedora por IVA', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4336, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4751', '4334', 'Hacienda Pública acreedora por retenciones practicadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4337, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4752', '4334', 'Hacienda Pública acreedora por impuesto sobre sociedades', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4338, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4758', '4334', 'Hacienda Pública acreedora por subvenciones a integrar', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4339, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '476', '4322', 'Organismos de la Seguridad Social acreedores', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4340, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '477', '4322', 'Hacienda Pública IVA repercutido', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4341, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '479', '4322', 'Pasivos por diferencias temporarias imponibles', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4342, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '48', '4004', 'Ajustes por periodificación', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4343, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '480', '4342', 'Gastos anticipados', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4344, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '485', '4342', 'Ingresos anticipados', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4345, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '49', '4004', 'Deterioro de valor de créditos comerciales y provisiones a corto plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4346, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '490', '4345', 'Deterioro de valor de créditos por operaciones comerciales', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4347, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '493', '4345', 'Deterioro de valor de créditos por operaciones comerciales con partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4348, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4933', '4347', 'Deterioro de valor de créditos por operaciones comerciales con empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4349, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4934', '4347', 'Deterioro de valor de créditos por operaciones comerciales con empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4350, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4935', '4347', 'Deterioro de valor de créditos por operaciones comerciales con otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4351, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '499', '4345', 'Provisiones por operaciones comerciales', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4352, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4994', '4351', 'Provisión para contratos anerosos', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4353, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4999', '4351', 'Provisión para otras operaciones comerciales', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4354, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '50', '4005', 'Emprésitos deudas con características especiales y otras emisiones análogas a corto plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4355, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '500', '4354', 'Obligaciones y bonos a corto plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4356, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '502', '4354', 'Acciones o participaciones a corto plazo consideradas como pasivos financieros', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4357, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '505', '4354', 'Deudas representadas en otros valores negociables a corto plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4358, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '506', '4354', 'Intereses a corto plazo de emprésitos y otras emisiones analógicas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4359, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '507', '4354', 'Dividendos de acciones o participaciones consideradas como pasivos financieros', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4360, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '509', '4354', 'Valores negociables amortizados', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4361, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5090', '4360', 'Obligaciones y bonos amortizados', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4362, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5095', '4360', 'Otros valores negociables amortizados', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4363, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '51', '4005', 'Deudas a corto plazo con partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4364, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '510', '4363', 'Deudas a corto plazo con entidades de crédito vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4365, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5103', '4364', 'Deudas a corto plazo con entidades de crédito empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4366, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5104', '4364', 'Deudas a corto plazo con entidades de crédito empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4367, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5105', '4364', 'Deudas a corto plazo con otras entidades de crédito vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4368, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '511', '4363', 'Proveedores de inmovilizado a corto plazo partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4369, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5113', '4368', 'Proveedores de inmovilizado a corto plazo empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4370, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5114', '4368', 'Proveedores de inmovilizado a corto plazo empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4371, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5115', '4368', 'Proveedores de inmovilizado a corto plazo otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4372, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '512', '4363', 'Acreedores por arrendamiento financiero a corto plazo partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4373, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5123', '4372', 'Acreedores por arrendamiento financiero a corto plazo empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4374, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5124', '4372', 'Acreedores por arrendamiento financiero a corto plazo empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4375, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5125', '4372', 'Acreedores por arrendamiento financiero a corto plazo otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4376, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '513', '4363', 'Otras deudas a corto plazo con partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4377, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5133', '4376', 'Otras deudas a corto plazo con empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4378, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5134', '4376', 'Otras deudas a corto plazo con empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4379, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5135', '4376', 'Otras deudas a corto plazo con partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4380, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '514', '4363', 'Intereses a corto plazo con partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4381, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5143', '4380', 'Intereses a corto plazo empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4382, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5144', '4380', 'Intereses a corto plazo empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4383, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5145', '4380', 'Intereses deudas a corto plazo partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4384, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '52', '4005', 'Deudas a corto plazo por préstamos recibidos y otros conceptos', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4385, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '520', '4384', 'Deudas a corto plazo con entidades de crédito', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4386, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5200', '4385', 'Préstamos a corto plazo de entidades de crédito', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4387, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5201', '4385', 'Deudas a corto plazo por crédito dispuesto', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4388, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5208', '4385', 'Deudas por efectos descontados', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4389, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5209', '4385', 'Deudas por operaciones de factoring', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4390, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '521', '4384', 'Deudas a corto plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4391, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '522', '4384', 'Deudas a corto plazo transformables en subvenciones donaciones y legados', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4392, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '523', '4384', 'Proveedores de inmovilizado a corto plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4393, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '526', '4384', 'Dividendo activo a pagar', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4394, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '527', '4384', 'Intereses a corto plazo de deudas con entidades de crédito', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4395, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '528', '4384', 'Intereses a corto plazo de deudas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4396, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '529', '4384', 'Provisiones a corto plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4397, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5291', '4396', 'Provisión a corto plazo para impuestos', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4398, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5292', '4396', 'Provisión a corto plazo para otras responsabilidades', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4399, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5293', '4396', 'Provisión a corto plazo por desmantelamiento retiro o rehabilitación del inmovilizado', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4400, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5295', '4396', 'Provisión a corto plazo para actuaciones medioambientales', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4401, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '53', '4005', 'Inversiones financieras a corto plazo en partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4402, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '530', '4401', 'Participaciones a corto plazo en partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4403, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5303', '4402', 'Participaciones a corto plazo en empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4404, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5304', '4402', 'Participaciones a corto plazo en empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4405, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5305', '4402', 'Participaciones a corto plazo en otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4406, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '531', '4401', 'Valores representativos de deuda a corto plazo de partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4407, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5313', '4406', 'Valores representativos de deuda a corto plazo de empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4408, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5314', '4406', 'Valores representativos de deuda a corto plazo de empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4409, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5315', '4406', 'Valores representativos de deuda a corto plazo de otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4410, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '532', '4401', 'Créditos a corto plazo a partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4411, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5323', '4410', 'Créditos a corto plazo a empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4412, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5324', '4410', 'Créditos a corto plazo a empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4413, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5325', '4410', 'Créditos a corto plazo a otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4414, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '533', '4401', 'Intereses a corto plazo de valores representativos de deuda de partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4415, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5333', '4414', 'Intereses a corto plazo de valores representativos de deuda en empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4416, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5334', '4414', 'Intereses a corto plazo de valores representativos de deuda en empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4417, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5335', '4414', 'Intereses a corto plazo de valores representativos de deuda en otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4418, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '534', '4401', 'Intereses a corto plazo de créditos a partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4419, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5343', '4418', 'Intereses a corto plazo de créditos a empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4420, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5344', '4418', 'Intereses a corto plazo de créditos a empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4421, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5345', '4418', 'Intereses a corto plazo de créditos a otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4422, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '535', '4401', 'Dividendo a cobrar de inversiones financieras en partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4423, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5353', '4422', 'Dividendo a cobrar de empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4424, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5354', '4422', 'Dividendo a cobrar de empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4425, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5355', '4422', 'Dividendo a cobrar de otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4426, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '539', '4401', 'Desembolsos pendientes sobre participaciones a corto plazo en partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4427, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5393', '4426', 'Desembolsos pendientes sobre participaciones a corto plazo en empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4428, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5394', '4426', 'Desembolsos pendientes sobre participaciones a corto plazo en empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4429, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5395', '4426', 'Desembolsos pendientes sobre participaciones a corto plazo en otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4430, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '54', '4005', 'Otras inversiones financieras a corto plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4431, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '540', '4430', 'Inversiones financieras a corto plazo en instrumentos de patrimonio', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4432, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '541', '4430', 'Valores representativos de deuda a corto plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4433, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '542', '4430', 'Créditos a corto plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4434, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '543', '4430', 'Créditos a corto plazo por enejenación de inmovilizado', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4435, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '544', '4430', 'Créditos a corto plazo al personal', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4436, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '545', '4430', 'Dividendo a cobrar', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4437, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '546', '4430', 'Intereses a corto plazo de valores reprsentativos de deuda', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4438, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '547', '4430', 'Intereses a corto plazo de créditos', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4439, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '548', '4430', 'Imposiciones a corto plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4440, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '549', '4430', 'Desembolsos pendientes sobre participaciones en el patrimonio neto a corto plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4441, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '55', '4005', 'Otras cuentas no bancarias', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4442, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '550', '4441', 'Titular de la explotación', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4443, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '551', '4441', 'Cuenta corriente con socios y administradores', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4444, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '552', '4441', 'Cuenta corriente otras personas y entidades vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4445, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5523', '4444', 'Cuenta corriente con empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4446, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5524', '4444', 'Cuenta corriente con empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4447, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5525', '4444', 'Cuenta corriente con otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4448, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '554', '4441', 'Cuenta corriente con uniones temporales de empresas y comunidades de bienes', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4449, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '555', '4441', 'Partidas pendientes de aplicación', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4450, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '556', '4441', 'Desembolsos exigidos sobre participaciones en el patrimonio neto', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4451, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5563', '4450', 'Desembolsos exigidos sobre participaciones empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4452, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5564', '4450', 'Desembolsos exigidos sobre participaciones empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4453, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5565', '4450', 'Desembolsos exigidos sobre participaciones otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4454, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5566', '4450', 'Desembolsos exigidos sobre participaciones otras empresas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4455, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '557', '4441', 'Dividendo activo a cuenta', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4456, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '558', '4441', 'Socios por desembolsos exigidos', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4457, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5580', '4456', 'Socios por desembolsos exigidos sobre acciones o participaciones ordinarias', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4458, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5585', '4456', 'Socios por desembolsos exigidos sobre acciones o participaciones consideradas como pasivos financieros', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4459, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '559', '4441', 'Derivados financieros a corto plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4460, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5590', '4459', 'Activos por derivados financieros a corto plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4461, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5595', '4459', 'Pasivos por derivados financieros a corto plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4462, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '56', '4005', 'Finanzas y depósitos recibidos y constituidos a corto plazo y ajustes por periodificación', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4463, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '560', '4462', 'Finanzas recibidas a corto plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4464, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '561', '4462', 'Depósitos recibidos a corto plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4465, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '565', '4462', 'Finanzas constituidas a corto plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4466, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '566', '4462', 'Depósitos constituidos a corto plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4467, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '567', '4462', 'Intereses pagados por anticipado', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4468, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '568', '4462', 'Intereses cobrados a corto plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4469, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '57', '4005', 'Tesorería', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4470, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'CAJA', '570', '4469', 'Caja euros', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4471, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '571', '4469', 'Caja moneda extranjera', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4472, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'BANCOS', '572', '4469', 'Bancos e instituciones de crédito cc vista euros', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4473, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '573', '4469', 'Bancos e instituciones de crédito cc vista moneda extranjera', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4474, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '574', '4469', 'Bancos e instituciones de crédito cuentas de ahorro euros', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4475, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '575', '4469', 'Bancos e instituciones de crédito cuentas de ahorro moneda extranjera', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4476, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '576', '4469', 'Inversiones a corto plazo de gran liquidez', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4477, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '59', '4005', 'Deterioro del valor de las inversiones financieras a corto plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4478, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '593', '4477', 'Deterioro del valor de participaciones a corto plazo en partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4479, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5933', '4478', 'Deterioro del valor de participaciones a corto plazo en empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4480, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5934', '4478', 'Deterioro del valor de participaciones a corto plazo en empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4481, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5935', '4478', 'Deterioro del valor de participaciones a corto plazo en otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4482, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '594', '4477', 'Deterioro del valor de valores representativos de deuda a corto plazo en partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4483, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5943', '4482', 'Deterioro del valor de valores representativos de deuda a corto plazo en empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4484, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5944', '4482', 'Deterioro del valor de valores representativos de deuda a corto plazo en empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4485, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5945', '4482', 'Deterioro del valor de valores representativos de deuda a corto plazo en otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4486, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '595', '4477', 'Deterioro del valor de créditos a corto plazo en partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4487, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5953', '4486', 'Deterioro del valor de créditos a corto plazo en empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4488, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5954', '4486', 'Deterioro del valor de créditos a corto plazo en empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4489, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5955', '4486', 'Deterioro del valor de créditos a corto plazo en otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4490, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '596', '4477', 'Deterioro del valor de participaciones a corto plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4491, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '597', '4477', 'Deterioro del valor de valores representativos de deuda a corto plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4492, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '598', '4477', 'Deterioro de valor de créditos a corto plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4493, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '60', '4006', 'Compras', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4494, 'PCG08-PYME','COMPRAS_GASTOS', 'COMPRAS', '600', '4493', 'Compras de mercaderías', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4495, 'PCG08-PYME','COMPRAS_GASTOS', 'COMPRAS', '601', '4493', 'Compras de materias primas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4496, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '602', '4493', 'Compras de otros aprovisionamientos', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4497, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '606', '4493', 'Descuentos sobre compras por pronto pago', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4498, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6060', '4497', 'Descuentos sobre compras por pronto pago de mercaderías', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4499, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6061', '4497', 'Descuentos sobre compras por pronto pago de materias primas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4500, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6062', '4497', 'Descuentos sobre compras por pronto pago de otros aprovisionamientos', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4501, 'PCG08-PYME','COMPRAS_GASTOS', 'COMPRAS', '607', '4493', 'Trabajos realizados por otras empresas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4502, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '608', '4493', 'Devoluciones de compras y operaciones similares', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4503, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6080', '4502', 'Devoluciones de compras de mercaderías', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4504, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6081', '4502', 'Devoluciones de compras de materias primas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4505, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6082', '4502', 'Devoluciones de compras de otros aprovisionamientos', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4506, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '609', '4493', 'Rappels por compras', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4507, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6090', '4506', 'Rappels por compras de mercaderías', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4508, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6091', '4506', 'Rappels por compras de materias primas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4509, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6092', '4506', 'Rappels por compras de otros aprovisionamientos', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4510, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '61', '4006', 'Variación de existencias', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4511, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '610', '4510', 'Variación de existencias de mercaderías', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4512, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '611', '4510', 'Variación de existencias de materias primas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4513, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '612', '4510', 'Variación de existencias de otros aprovisionamientos', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4514, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '62', '4006', 'Servicios exteriores', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4515, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '620', '4514', 'Gastos en investigación y desarrollo del ejercicio', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4516, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '621', '4514', 'Arrendamientos y cánones', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4517, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '622', '4514', 'Reparaciones y conservación', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4518, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '623', '4514', 'Servicios profesionales independientes', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4519, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '624', '4514', 'Transportes', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4520, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '625', '4514', 'Primas de seguros', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4521, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '626', '4514', 'Servicios bancarios y similares', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4522, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '627', '4514', 'Publicidad, propaganda y relaciones públicas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4523, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '628', '4514', 'Suministros', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4524, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '629', '4514', 'Otros servicios', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4525, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '63', '4006', 'Tributos', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4526, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '630', '4525', 'Impuesto sobre benecifios', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4527, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6300', '4526', 'Impuesto corriente', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4528, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6301', '4526', 'Impuesto diferido', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4529, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '631', '4525', 'Otros tributos', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4530, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '633', '4525', 'Ajustes negativos en la imposición sobre beneficios', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4531, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '634', '4525', 'Ajustes negativos en la imposición indirecta', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4532, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6341', '4531', 'Ajustes negativos en IVA de activo corriente', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4533, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6342', '4531', 'Ajustes negativos en IVA de inversiones', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4534, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '636', '4525', 'Devolución de impuestos', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4535, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '638', '4525', 'Ajustes positivos en la imposición sobre beneficios', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4536, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '639', '4525', 'Ajustes positivos en la imposición directa', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4537, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6391', '4536', 'Ajustes positivos en IVA de activo corriente', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4538, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6392', '4536', 'Ajustes positivos en IVA de inversiones', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4539, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '64', '4006', 'Gastos de personal', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4540, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '640', '4539', 'Sueldos y salarios', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4541, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '641', '4539', 'Indemnizaciones', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4542, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '642', '4539', 'Seguridad social a cargo de la empresa', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4543, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '649', '4539', 'Otros gastos sociales', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4544, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '65', '4006', 'Otros gastos de gestión', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4545, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '650', '4544', 'Pérdidas de créditos comerciales incobrables', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4546, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '651', '4544', 'Resultados de operaciones en común', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4547, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6510', '4546', 'Beneficio transferido gestor', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4548, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6511', '4546', 'Pérdida soportada participe o asociado no gestor', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4549, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '659', '4544', 'Otras pérdidas en gestión corriente', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4550, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '66', '4006', 'Gastos financieros', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4551, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '660', '4550', 'Gastos financieros por actualización de provisiones', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4552, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '661', '4550', 'Intereses de obligaciones y bonos', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4553, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6610', '4452', 'Intereses de obligaciones y bonos a largo plazo empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4554, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6611', '4452', 'Intereses de obligaciones y bonos a largo plazo empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4555, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6612', '4452', 'Intereses de obligaciones y bonos a largo plazo otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4556, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6613', '4452', 'Intereses de obligaciones y bonos a largo plazo otras empresas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4557, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6615', '4452', 'Intereses de obligaciones y bonos a corto plazo empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4558, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6616', '4452', 'Intereses de obligaciones y bonos a corto plazo empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4559, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6617', '4452', 'Intereses de obligaciones y bonos a corto plazo otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4560, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6618', '4452', 'Intereses de obligaciones y bonos a corto plazo otras empresas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4561, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '662', '4550', 'Intereses de deudas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4562, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6620', '4561', 'Intereses de deudas empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4563, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6621', '4561', 'Intereses de deudas empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4564, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6622', '4561', 'Intereses de deudas otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4565, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6623', '4561', 'Intereses de deudas con entidades de crédito', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4566, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6624', '4561', 'Intereses de deudas otras empresas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4567, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '663', '4550', 'Pérdidas por valorización de activos y pasivos financieros por su valor razonable', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4568, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '664', '4550', 'Gastos por dividendos de acciones o participaciones consideradas como pasivos financieros', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4569, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6640', '4568', 'Dividendos de pasivos empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4570, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6641', '4568', 'Dividendos de pasivos empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4571, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6642', '4568', 'Dividendos de pasivos otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4572, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6643', '4568', 'Dividendos de pasivos otras empresas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4573, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '665', '4550', 'Intereses por descuento de efectos y operaciones de factoring', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4574, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6650', '4573', 'Intereses por descuento de efectos en entidades de crédito del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4575, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6651', '4573', 'Intereses por descuento de efectos en entidades de crédito asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4576, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6652', '4573', 'Intereses por descuento de efectos en entidades de crédito vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4577, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6653', '4573', 'Intereses por descuento de efectos en otras entidades de crédito', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4578, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6654', '4573', 'Intereses por operaciones de factoring con entidades de crédito del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4579, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6655', '4573', 'Intereses por operaciones de factoring con entidades de crédito asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4580, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6656', '4573', 'Intereses por operaciones de factoring con otras entidades de crédito vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4581, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6657', '4573', 'Intereses por operaciones de factoring con otras entidades de crédito', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4582, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '666', '4550', 'Pérdidas en participaciones y valores representativos de deuda', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4583, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6660', '4582', 'Pérdidas en valores representativos de deuda a largo plazo empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4584, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6661', '4582', 'Pérdidas en valores representativos de deuda a largo plazo empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4585, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6662', '4582', 'Pérdidas en valores representativos de deuda a largo plazo otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4586, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6663', '4582', 'Pérdidas en participaciones y valores representativos de deuda a largo plazo otras empresas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4587, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6665', '4582', 'Pérdidas en participaciones y valores representativos de deuda a corto plazo empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4588, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6666', '4582', 'Pérdidas en participaciones y valores representativos de deuda a corto plazo empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4589, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6667', '4582', 'Pérdidas en valores representativos de deuda a corto plazo otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4590, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6668', '4582', 'Pérdidas en valores representativos de deuda a corto plazo otras empresas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4591, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '667', '4550', 'Pérdidas de créditos no comerciales', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4592, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6670', '4591', 'Pérdidas de créditos a largo plazo empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4593, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6671', '4591', 'Pérdidas de créditos a largo plazo empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4594, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6672', '4591', 'Pérdidas de créditos a largo plazo otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4595, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6673', '4591', 'Pérdidas de créditos a largo plazo otras empresas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4596, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6675', '4591', 'Pérdidas de créditos a corto plazo empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4597, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6676', '4591', 'Pérdidas de créditos a corto plazo empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4598, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6677', '4591', 'Pérdidas de créditos a corto plazo otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4599, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6678', '4591', 'Pérdidas de créditos a corto plazo otras empresas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4600, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '668', '4550', 'Diferencias negativas de cambio', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4601, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '669', '4550', 'Otros gastos financieros', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4602, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '67', '4006', 'Pérdidas procedentes de activos no corrientes y gastos excepcionales', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4603, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '670', '4602', 'Pérdidas procedentes del inmovilizado intangible', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4604, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '671', '4602', 'Pérdidas procedentes del inmovilizado material', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4605, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '672', '4602', 'Pérdidas procedentes de las inversiones inmobiliarias', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4607, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '673', '4602', 'Pérdidas procedentes de participaciones a largo plazo en partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4608, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6733', '4607', 'Pérdidas procedentes de participaciones a largo plazo empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4609, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6734', '4607', 'Pérdidas procedentes de participaciones a largo plazo empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4610, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6735', '4607', 'Pérdidas procedentes de participaciones a largo plazo otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4611, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '675', '4602', 'Pérdidas por operaciones con obligaciones propias', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4612, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '678', '4602', 'Gastos excepcionales', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4613, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '68', '4006', 'Dotaciones para amortizaciones', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4614, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '680', '4613', 'Amortización del inmovilizado intangible', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4615, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '681', '4613', 'Amortización del inmovilizado material', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4616, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '682', '4613', 'Amortización de las inversiones inmobiliarias', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4617, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '69', '4006', 'Pérdidas por deterioro y otras dotaciones', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4618, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '690', '4617', 'Pérdidas por deterioro del inmovilizado intangible', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4619, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '691', '4617', 'Pérdidas por deterioro del inmovilizado material', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4620, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '692', '4617', 'Pérdidas por deterioro de las inversiones inmobiliarias', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4621, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '693', '4617', 'Pérdidas por deterioro de existencias', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4622, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6930', '4621', 'Pérdidas por deterioro de productos terminados y en curso de fabricación', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4623, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6931', '4621', 'Pérdidas por deterioro de mercaderías', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4624, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6932', '4621', 'Pérdidas por deterioro de materias primas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4625, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6933', '4621', 'Pérdidas por deterioro de otros aprovisionamientos', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4626, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '694', '4617', 'Pérdidas por deterioro de créditos por operaciones comerciales', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4627, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '695', '4617', 'Dotación a la provisión por operaciones comerciales', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4628, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6954', '4627', 'Dotación a la provisión por contratos onerosos', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4629, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6959', '4628', 'Dotación a la provisión para otras operaciones comerciales', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4630, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '696', '4617', 'Pérdidas por deterioro de participaciones y valores representativos de deuda a largo plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4631, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6960', '4630', 'Pérdidas por deterioro de participaciones en instrumentos de patrimonio neto a largo plazo empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4632, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6961', '4630', 'Pérdidas por deterioro de participaciones en instrumentos de patrimonio neto a largo plazo empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4633, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6962', '4630', 'Pérdidas por deterioro de participaciones en instrumentos de patrimonio neto a largo plazo otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4634, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6963', '4630', 'Pérdidas por deterioro de participaciones en instrumentos de patrimonio neto a largo plazo otras empresas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4635, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6965', '4630', 'Pérdidas por deterioro en valores representativos de deuda a largo plazo empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4636, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6966', '4630', 'Pérdidas por deterioro en valores representativos de deuda a largo plazo empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4637, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6967', '4630', 'Pérdidas por deterioro en valores representativos de deuda a largo plazo otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4638, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6968', '4630', 'Pérdidas por deterioro en valores representativos de deuda a largo plazo otras empresas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4639, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '697', '4617', 'Pérdidas por deterioro de créditos a largo plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4640, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6970', '4639', 'Pérdidas por deterioro de créditos a largo plazo empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4641, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6971', '4639', 'Pérdidas por deterioro de créditos a largo plazo empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4642, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6972', '4639', 'Pérdidas por deterioro de créditos a largo plazo otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4643, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6973', '4639', 'Pérdidas por deterioro de créditos a largo plazo otras empresas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4644, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '698', '4617', 'Pérdidas por deterioro de participaciones y valores representativos de deuda a corto plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4645, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6980', '4644', 'Pérdidas por deterioro de participaciones en instrumentos de patrimonio neto a corto plazo empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4646, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6981', '4644', 'Pérdidas por deterioro de participaciones en instrumentos de patrimonio neto a corto plazo empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4647, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6985', '4644', 'Pérdidas por deterioro en valores representativos de deuda a corto plazo empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4648, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6986', '4644', 'Pérdidas por deterioro en valores representativos de deuda a corto plazo empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4649, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6988', '4644', 'Pérdidas por deterioro en valores representativos de deuda a corto plazo de otras empresas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4650, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '699', '4617', 'Pérdidas por deterioro de crédito a corto plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4651, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6990', '4650', 'Pérdidas por deterioro de crédito a corto plazo empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4652, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6991', '4650', 'Pérdidas por deterioro de crédito a corto plazo empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4653, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6992', '4650', 'Pérdidas por deterioro de crédito a corto plazo otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4654, 'PCG08-PYME','COMPRAS_GASTOS', 'XXXXXX', '6993', '4650', 'Pérdidas por deterioro de crédito a corto plazo otras empresas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4655, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '70', '4007', 'Ventas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4656, 'PCG08-PYME','VENTAS_E_INGRESOS', 'VENTAS', '700', '4655', 'Ventas de mercaderías', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4657, 'PCG08-PYME','VENTAS_E_INGRESOS', 'VENTAS', '701', '4655', 'Ventas de productos terminados', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4658, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '702', '4655', 'Ventas de productos semiterminados', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4659, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '703', '4655', 'Ventas de subproductos y residuos', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4660, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '704', '4655', 'Ventas de envases y embalajes', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4661, 'PCG08-PYME','VENTAS_E_INGRESOS', 'VENTAS', '705', '4655', 'Prestaciones de servicios', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4662, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '706', '4655', 'Descuentos sobre ventas por pronto pago', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4663, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7060', '4662', 'Descuentos sobre ventas por pronto pago de mercaderías', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4664, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7061', '4662', 'Descuentos sobre ventas por pronto pago de productos terminados', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4665, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7062', '4662', 'Descuentos sobre ventas por pronto pago de productos semiterminados', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4666, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7063', '4662', 'Descuentos sobre ventas por pronto pago de subproductos y residuos', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4667, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '708', '4655', 'Devoluciones de ventas y operacioes similares', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4668, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7080', '4667', 'Devoluciones de ventas de mercaderías', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4669, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7081', '4667', 'Devoluciones de ventas de productos terminados', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4670, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7082', '4667', 'Devoluciones de ventas de productos semiterminados', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4671, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7083', '4667', 'Devoluciones de ventas de subproductos y residuos', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4672, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7084', '4667', 'Devoluciones de ventas de envases y embalajes', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4673, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '71', '4007', 'Variación de existencias', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4674, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '710', '4673', 'Variación de existencias de productos en curso', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4675, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '711', '4673', 'Variación de existencias de productos semiterminados', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4676, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '712', '4673', 'Variación de existencias de productos terminados', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4677, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '713', '4673', 'Variación de existencias de subproductos, residuos y materiales recuperados', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4678, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '73', '4007', 'Trabajos realizados para la empresa', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4679, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '730', '4678', 'Trabajos realizados para el inmovilizado intangible', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4680, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '731', '4678', 'Trabajos realizados para el inmovilizado tangible', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4681, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '732', '4678', 'Trabajos realizados en inversiones inmobiliarias', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4682, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '733', '4678', 'Trabajos realizados para el inmovilizado material en curso', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4683, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '74', '4007', 'Subvenciones, donaciones y legados', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4684, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '740', '4683', 'Subvenciones, donaciones y legados a la explotación', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4685, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '746', '4683', 'Subvenciones, donaciones y legados de capital transferidos al resultado del ejercicio', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4686, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '747', '4683', 'Otras subvenciones, donaciones y legados transferidos al resultado del ejercicio', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4687, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '75', '4007', 'Otros ingresos de gestión', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4688, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '751', '4687', 'Resultados de operaciones en común', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4689, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7510', '4688', 'Pérdida transferida gestor', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4690, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7511', '4688', 'Beneficio atribuido participe o asociado no gestor', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4691, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '752', '4687', 'Ingreso por arrendamiento', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4692, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '753', '4687', 'Ingresos de propiedad industrial cedida en explotación', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4693, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '754', '4687', 'Ingresos por comisiones', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4694, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '755', '4687', 'Ingresos por servicios al personal', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4695, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '759', '4687', 'Ingresos por servicios diversos', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4696, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '76', '4007', 'Ingresos financieros', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4697, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '760', '4696', 'Ingresos de participaciones en instrumentos de patrimonio', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4698, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7600', '4697', 'Ingresos de participaciones en instrumentos de patrimonio empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4699, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7601', '4697', 'Ingresos de participaciones en instrumentos de patrimonio empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4700, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7602', '4697', 'Ingresos de participaciones en instrumentos de patrimonio otras partes asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4701, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7603', '4697', 'Ingresos de participaciones en instrumentos de patrimonio otras empresas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4702, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '761', '4696', 'Ingresos de valores representativos de deuda', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4703, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7610', '4702', 'Ingresos de valores representativos de deuda empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4704, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7611', '4702', 'Ingresos de valores representativos de deuda empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4705, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7612', '4702', 'Ingresos de valores representativos de deuda otras partes asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4706, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7613', '4702', 'Ingresos de valores representativos de deuda otras empresas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4707, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '762', '4696', 'Ingresos de créditos', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4708, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7620', '4707', 'Ingresos de créditos a largo plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4709, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '76200', '4708', 'Ingresos de crédito a largo plazo empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4710, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '76201', '4708', 'Ingresos de crédito a largo plazo empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4711, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '76202', '4708', 'Ingresos de crédito a largo plazo otras partes asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4712, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '76203', '4708', 'Ingresos de crédito a largo plazo otras empresas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4713, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7621', '4707', 'Ingresos de créditos a corto plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4714, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '76210', '4713', 'Ingresos de crédito a corto plazo empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4715, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '76211', '4713', 'Ingresos de crédito a corto plazo empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4716, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '76212', '4713', 'Ingresos de crédito a corto plazo otras partes asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4717, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '76213', '4713', 'Ingresos de crédito a corto plazo otras empresas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4718, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '763', '4696', 'Beneficios por valorización de activos y pasivos financieros por su valor razonable', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4719, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '766', '4696', 'Beneficios en participaciones y valores representativos de deuda', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4720, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7660', '4719', 'Beneficios en participaciones y valores representativos de deuda a largo plazo empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4721, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7661', '4719', 'Beneficios en participaciones y valores representativos de deuda a largo plazo empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4722, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7662', '4719', 'Beneficios en participaciones y valores representativos de deuda a largo plazo otras partes asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4723, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7663', '4719', 'Beneficios en participaciones y valores representativos de deuda a largo plazo otras empresas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4724, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7665', '4719', 'Beneficios en participaciones y valores representativos de deuda a corto plazo empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4725, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7666', '4719', 'Beneficios en participaciones y valores representativos de deuda a corto plazo empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4726, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7667', '4719', 'Beneficios en participaciones y valores representativos de deuda a corto plazo otras partes asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4727, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7668', '4719', 'Beneficios en participaciones y valores representativos de deuda a corto plazo otras empresas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4728, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '768', '4696', 'Diferencias positivas de cambio', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4729, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '769', '4696', 'Otros ingresos financieros', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4730, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '77', '4007', 'Beneficios procedentes de activos no corrientes e ingresos excepcionales', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4731, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '770', '4730', 'Beneficios procedentes del inmovilizado intangible', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4732, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '771', '4730', 'Beneficios procedentes del inmovilizado material', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4733, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '772', '4730', 'Beneficios procedentes de las inversiones inmobiliarias', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4734, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '773', '4730', 'Beneficios procedentes de participaciones a largo plazo en partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4735, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7733', '4734', 'Beneficios procedentes de participaciones a largo plazo empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4736, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7734', '4734', 'Beneficios procedentes de participaciones a largo plazo empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4737, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7735', '4734', 'Beneficios procedentes de participaciones a largo plazo otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4738, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '775', '4730', 'Beneficios por operaciones con obligaciones propias', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4739, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '778', '4730', 'Ingresos excepcionales', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4741, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '79', '4007', 'Excesos y aplicaciones de provisiones y pérdidas por deterioro', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4742, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '790', '4741', 'Revisión del deterioro del inmovilizado intangible', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4743, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '791', '4741', 'Revisión del deterioro del inmovilizado material', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4744, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '792', '4741', 'Revisión del deterioro de las inversiones inmobiliarias', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4745, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '793', '4741', 'Revisión del deterioro de las existencias', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4746, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7930', '4745', 'Revisión del deterioro de productos terminados y en curso de fabricación', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4747, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7931', '4745', 'Revisión del deterioro de mercaderías', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4748, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7932', '4745', 'Revisión del deterioro de materias primas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4749, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7933', '4745', 'Revisión del deterioro de otros aprovisionamientos', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4750, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '794', '4741', 'Revisión del deterioro de créditos por operaciones comerciales', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4751, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '795', '4741', 'Exceso de provisiones', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4752, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7951', '4751', 'Exceso de provisión para impuestos', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4753, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7952', '4751', 'Exceso de provisión para otras responsabilidades', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4755, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7954', '4751', 'Exceso de provisión para operaciones comerciales', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4756, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '79544', '4755', 'Exceso de provisión por contratos onerosos', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4757, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '79549', '4755', 'Exceso de provisión para otras operaciones comerciales', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4758, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7955', '4751', 'Exceso de provisión para actuaciones medioambienteales', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4759, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '796', '4741', 'Revisión del deterioro de participaciones y valores representativos de deuda a largo plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4760, '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', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4761, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7961', '4759', 'Revisión del deterioro de participaciones en instrumentos de patrimonio neto a largo plazo empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4762, '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', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4763, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7963', '4759', 'Revisión del deterioro de participaciones en instrumentos de patrimonio neto a largo plazo otras empresas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4764, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7965', '4759', 'Revisión del deterioro de valores representativos a largo plazo empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4765, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7966', '4759', 'Revisión del deterioro de valores representativos a largo plazo empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4766, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7967', '4759', 'Revisión del deterioro de valores representativos a largo otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4767, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7968', '4759', 'Revisión del deterioro de valores representativos a largo plazo otras empresas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4768, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '797', '4741', 'Revisión del deterioro de créditos a largo plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4769, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7970', '4768', 'Revisión del deterioro de créditos a largo plazo empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4770, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7971', '4768', 'Revisión del deterioro de créditos a largo plazo empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4771, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7972', '4768', 'Revisión del deterioro de créditos a largo plazo otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4772, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7973', '4768', 'Revisión del deterioro de créditos a largo plazo otras empresas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4773, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '798', '4741', 'Revisión del deterioro de participaciones y valores representativos de deuda a corto plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4774, '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', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4775, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7981', '4773', 'Revisión del deterioro de participaciones en instrumentos de patrimonio neto a corto plazo empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4776, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7985', '4773', 'Revisión del deterioro de valores representativos de deuda a corto plazo empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4777, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7986', '4773', 'Revisión del deterioro de valores representativos de deuda a corto plazo empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4778, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7987', '4773', 'Revisión del deterioro de valores representativos de deuda a corto plazo otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4779, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7988', '4773', 'Revisión del deterioro de valores representativos de deuda a corto plazo otras empresas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4780, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '799', '4741', 'Revisión del deterioro de créditos a corto plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4781, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7990', '4780', 'Revisión del deterioro de créditos a corto plazo empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4782, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7991', '4780', 'Revisión del deterioro de créditos a corto plazo empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4783, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7992', '4780', 'Revisión del deterioro de créditos a corto plazo otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4784, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7993', '4780', 'Revisión del deterioro de créditos a corto plazo otras empresas', '1'); diff --git a/htdocs/install/mysql/data/llx_c_action_trigger.sql b/htdocs/install/mysql/data/llx_c_action_trigger.sql index 971d2d7514a..6eddd5883c8 100644 --- a/htdocs/install/mysql/data/llx_c_action_trigger.sql +++ b/htdocs/install/mysql/data/llx_c_action_trigger.sql @@ -32,38 +32,39 @@ -- List of all managed triggered events (used for trigger agenda and for notification) -- delete from llx_c_action_trigger; -insert into llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values (1,'FICHINTER_VALIDATE','Intervention validated','Executed when a intervention is validated','ficheinter',19); -insert into llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values (2,'BILL_VALIDATE','Customer invoice validated','Executed when a customer invoice is approved','facture',6); -insert into llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values (3,'ORDER_SUPPLIER_APPROVE','Supplier order request approved','Executed when a supplier order is approved','order_supplier',12); -insert into llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values (4,'ORDER_SUPPLIER_REFUSE','Supplier order request refused','Executed when a supplier order is refused','order_supplier',13); -insert into llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values (5,'ORDER_VALIDATE','Customer order validate','Executed when a customer order is validated','commande',4); -insert into llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values (6,'PROPAL_VALIDATE','Customer proposal validated','Executed when a commercial proposal is validated','propal',2); -insert into llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values (9,'COMPANY_SENTBYMAIL','Mails sent from third party card','Executed when you send email from third party card','societe',1); -insert into llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values (10,'COMPANY_CREATE','Third party created','Executed when a third party is created','societe',1); -insert into llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values (11,'CONTRACT_VALIDATE','Contract validated','Executed when a contract is validated','contrat',18); -insert into llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values (12,'PROPAL_SENTBYMAIL','Commercial proposal sent by mail','Executed when a commercial proposal is sent by mail','propal',3); -insert into llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values (13,'ORDER_SENTBYMAIL','Customer order sent by mail','Executed when a customer order is sent by mail ','commande',5); -insert into llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values (14,'BILL_PAYED','Customer invoice payed','Executed when a customer invoice is payed','facture',7); -insert into llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values (15,'BILL_CANCEL','Customer invoice canceled','Executed when a customer invoice is conceled','facture',8); -insert into llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values (16,'BILL_SENTBYMAIL','Customer invoice sent by mail','Executed when a customer invoice is sent by mail','facture',9); -insert into llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values (17,'ORDER_SUPPLIER_VALIDATE','Supplier order validated','Executed when a supplier order is validated','order_supplier',11); -insert into llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values (18,'ORDER_SUPPLIER_SENTBYMAIL','Supplier order sent by mail','Executed when a supplier order is sent by mail','order_supplier',14); -insert into llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values (19,'BILL_SUPPLIER_VALIDATE','Supplier invoice validated','Executed when a supplier invoice is validated','invoice_supplier',15); -insert into llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values (20,'BILL_SUPPLIER_PAYED','Supplier invoice payed','Executed when a supplier invoice is payed','invoice_supplier',16); -insert into llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values (21,'BILL_SUPPLIER_SENTBYMAIL','Supplier invoice sent by mail','Executed when a supplier invoice is sent by mail','invoice_supplier',17); -insert into llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values (22,'SHIPPING_VALIDATE','Shipping validated','Executed when a shipping is validated','shipping',20); -insert into llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values (23,'SHIPPING_SENTBYMAIL','Shipping sent by mail','Executed when a shipping is sent by mail','shipping',21); -insert into llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values (24,'MEMBER_VALIDATE','Member validated','Executed when a member is validated','member',22); -insert into llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values (25,'MEMBER_SUBSCRIPTION','Member subscribed','Executed when a member is subscribed','member',23); -insert into llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values (26,'MEMBER_RESILIATE','Member resiliated','Executed when a member is resiliated','member',24); -insert into llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values (27,'MEMBER_DELETE','Member deleted','Executed when a member is deleted','member',25); -insert into llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values (28,'BILL_UNVALIDATE','Customer invoice unvalidated','Executed when a customer invoice status set back to draft','facture',10); -insert into llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values (29,'FICHINTER_SENTBYMAIL','Intervention sent by mail','Executed when a intervention is sent by mail','ficheinter',29); -insert into llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values (30,'PROJECT_CREATE','Project creation','Executed when a project is created','project',30); -insert into llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values (31,'PROPAL_CLOSE_SIGNED','Customer proposal closed signed','Executed when a customer proposal is closed signed','propal',31); -insert into llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values (32,'PROPAL_CLOSE_REFUSED','Customer proposal closed refused','Executed when a customer proposal is closed refused','propal',32); -insert into llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values (33,'BILL_SUPPLIER_CANCELED','Supplier invoice cancelled','Executed when a supplier invoice is cancelled','invoice_supplier',33); -insert into llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values (34,'MEMBER_MODIFY','Member modified','Executed when a member is modified','member',34); -insert into llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values (35,'TASK_CREATE','Task created','Executed when a project task is created','project',35); -insert into llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values (36,'TASK_MODIFY','Task modified','Executed when a project task is modified','project',36); -insert into llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values (37,'TASK_DELETE','Task deleted','Executed when a project task is deleted','project',37); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_VALIDATE','Intervention validated','Executed when a intervention is validated','ficheinter',19); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_VALIDATE','Customer invoice validated','Executed when a customer invoice is approved','facture',6); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_SUPPLIER_APPROVE','Supplier order request approved','Executed when a supplier order is approved','order_supplier',12); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_SUPPLIER_REFUSE','Supplier order request refused','Executed when a supplier order is refused','order_supplier',13); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_VALIDATE','Customer order validate','Executed when a customer order is validated','commande',4); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPAL_VALIDATE','Customer proposal validated','Executed when a commercial proposal is validated','propal',2); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('COMPANY_SENTBYMAIL','Mails sent from third party card','Executed when you send email from third party card','societe',1); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('COMPANY_CREATE','Third party created','Executed when a third party is created','societe',1); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('CONTRACT_VALIDATE','Contract validated','Executed when a contract is validated','contrat',18); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPAL_SENTBYMAIL','Commercial proposal sent by mail','Executed when a commercial proposal is sent by mail','propal',3); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_SENTBYMAIL','Customer order sent by mail','Executed when a customer order is sent by mail ','commande',5); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_PAYED','Customer invoice payed','Executed when a customer invoice is payed','facture',7); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_CANCEL','Customer invoice canceled','Executed when a customer invoice is conceled','facture',8); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_SENTBYMAIL','Customer invoice sent by mail','Executed when a customer invoice is sent by mail','facture',9); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_SUPPLIER_VALIDATE','Supplier order validated','Executed when a supplier order is validated','order_supplier',11); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_SUPPLIER_SENTBYMAIL','Supplier order sent by mail','Executed when a supplier order is sent by mail','order_supplier',14); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_SUPPLIER_VALIDATE','Supplier invoice validated','Executed when a supplier invoice is validated','invoice_supplier',15); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_SUPPLIER_PAYED','Supplier invoice payed','Executed when a supplier invoice is payed','invoice_supplier',16); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_SUPPLIER_SENTBYMAIL','Supplier invoice sent by mail','Executed when a supplier invoice is sent by mail','invoice_supplier',17); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('SHIPPING_VALIDATE','Shipping validated','Executed when a shipping is validated','shipping',20); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('SHIPPING_SENTBYMAIL','Shipping sent by mail','Executed when a shipping is sent by mail','shipping',21); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MEMBER_VALIDATE','Member validated','Executed when a member is validated','member',22); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MEMBER_SUBSCRIPTION','Member subscribed','Executed when a member is subscribed','member',23); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MEMBER_RESILIATE','Member resiliated','Executed when a member is resiliated','member',24); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MEMBER_DELETE','Member deleted','Executed when a member is deleted','member',25); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_UNVALIDATE','Customer invoice unvalidated','Executed when a customer invoice status set back to draft','facture',10); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_SENTBYMAIL','Intervention sent by mail','Executed when a intervention is sent by mail','ficheinter',19); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROJECT_CREATE','Project creation','Executed when a project is created','project',30); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPAL_CLOSE_SIGNED','Customer proposal closed signed','Executed when a customer proposal is closed signed','propal',2); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPAL_CLOSE_REFUSED','Customer proposal closed refused','Executed when a customer proposal is closed refused','propal',2); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_SUPPLIER_CANCELED','Supplier invoice cancelled','Executed when a supplier invoice is cancelled','invoice_supplier',17); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MEMBER_MODIFY','Member modified','Executed when a member is modified','member',24); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('TASK_CREATE','Task created','Executed when a project task is created','project',35); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('TASK_MODIFY','Task modified','Executed when a project task is modified','project',36); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('TASK_DELETE','Task deleted','Executed when a project task is deleted','project',37); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_CLASSIFY_BILLED','Classify intervention as billed','Executed when a intervention is classified as billed (when option FICHINTER_DISABLE_DETAILS is set)','ficheinter',19); diff --git a/htdocs/install/mysql/data/llx_c_actioncomm.sql b/htdocs/install/mysql/data/llx_c_actioncomm.sql index 43c00faba6a..2b84ee6ff82 100644 --- a/htdocs/install/mysql/data/llx_c_actioncomm.sql +++ b/htdocs/install/mysql/data/llx_c_actioncomm.sql @@ -36,6 +36,7 @@ insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 2,'AC_FAX','system','Send Fax',NULL, 1, 3); insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 4,'AC_EMAIL','system','Send Email',NULL, 1, 4); insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 5,'AC_RDV','system','Rendez-vous',NULL, 1, 1); +insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values (11,'AC_INT','system','Intervention on site',NULL, 1, 4); -- Code kept for backward compatibility < 3.3 insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 3,'AC_PROP','systemauto', 'Send commercial proposal by email','propal',0,10); insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 8,'AC_COM','systemauto','Send customer order by email','order', 0,8); diff --git a/htdocs/install/mysql/data/llx_c_civilite.sql b/htdocs/install/mysql/data/llx_c_civilite.sql index 097539417ee..0d7c0753131 100644 --- a/htdocs/install/mysql/data/llx_c_civilite.sql +++ b/htdocs/install/mysql/data/llx_c_civilite.sql @@ -27,12 +27,12 @@ -- -- --- Civilites +-- Civilities -- -delete from llx_c_civilite; -insert into llx_c_civilite (rowid, code, civilite, active) values (1 , 'MME', 'Madame', 1); -insert into llx_c_civilite (rowid, code, civilite, active) values (3 , 'MR', 'Monsieur', 1); -insert into llx_c_civilite (rowid, code, civilite, active) values (5 , 'MLE', 'Mademoiselle', 1); -insert into llx_c_civilite (rowid, code, civilite, active) values (7 , 'MTRE', 'Maître', 1); -insert into llx_c_civilite (rowid, code, civilite, active) values (8 , 'DR', 'Docteur', 1); +delete from llx_c_civility; +insert into llx_c_civility (rowid, code, label, active) values (1 , 'MME', 'Madame', 1); +insert into llx_c_civility (rowid, code, label, active) values (3 , 'MR', 'Monsieur', 1); +insert into llx_c_civility (rowid, code, label, active) values (5 , 'MLE', 'Mademoiselle', 1); +insert into llx_c_civility (rowid, code, label, active) values (7 , 'MTRE', 'Maître', 1); +insert into llx_c_civility (rowid, code, label, active) values (8 , 'DR', 'Docteur', 1); diff --git a/htdocs/install/mysql/data/llx_c_shipment_mode.sql b/htdocs/install/mysql/data/llx_c_shipment_mode.sql index a54a392fac7..7bc3f8f590d 100644 --- a/htdocs/install/mysql/data/llx_c_shipment_mode.sql +++ b/htdocs/install/mysql/data/llx_c_shipment_mode.sql @@ -31,9 +31,9 @@ -- INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (1,'CATCH','Catch','Catch by client','',1); INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (2,'TRANS','Transporter','Generic transporter','',1); -INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (3,'COLSUI','Colissimo Suivi','Colissimo Suivi','',0); +INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (3,'COLSUI','Colissimo Suivi','Colissimo Suivi','http://www.colissimo.fr/portail_colissimo/suivre.do?colispart={TRACKID}',0); INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (4,'LETTREMAX','Lettre Max','Courrier Suivi et Lettre Max','',0); INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (5,'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); INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (6,'KIALA','KIALA','Relais Kiala','http://www.kiala.fr/tnt/delivery/{TRACKID}',0); -INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (7,'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); +INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (7,'GLS','GLS','General Logistics Systems','https://gls-group.eu/FR/fr/suivi-colis?match={TRACKID}',0); INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (8,'CHRONO','Chronopost','Chronopost','http://www.chronopost.fr/expedier/inputLTNumbersNoJahia.do?listeNumeros={TRACKID}',0); diff --git a/htdocs/install/mysql/data/llx_c_tva.sql b/htdocs/install/mysql/data/llx_c_tva.sql index c8091e3889e..01d2894bca6 100644 --- a/htdocs/install/mysql/data/llx_c_tva.sql +++ b/htdocs/install/mysql/data/llx_c_tva.sql @@ -124,10 +124,17 @@ insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 3 insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 34, 3, '0','0','VAT Rate 0',1); -- INDIA (id country=117) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1171, 117, '12.5','0','VAT standard rate',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1172, 117, '4','0','VAT reduced rate',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1173, 117, '1','0','VAT super-reduced rate',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1174, 117, '0','0','VAT Rate 0',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1171, 117, '12.5','0','VAT standard rate',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1172, 117, '4','0','VAT reduced rate',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1173, 117, '1','0','VAT super-reduced rate',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1174, 117, '0','0','VAT Rate 0',1); + +-- IRELAND (id country=8) +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (81, 8, '0','0','VAT Rate 0',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (82, 8, '23','0','VAT standard rate',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (83, 8, '13.5','0','VAT reduced rate',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (84, 8, '9','0','VAT reduced rate',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (85, 8, '4.8','0','VAT reduced rate',1); -- JAPAN (id country=123) insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1231, 123, '0','0','VAT Rate 0',1); @@ -216,10 +223,10 @@ INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES (20 INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES (2023, 202, '0', '0', 'VAT Rate 0', 1); -- SPAIN (id country=4) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active) values ( 41, 4,'21','0','5.2','3','-21','1','VAT standard rate',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active) values ( 42, 4,'10','0','1.4','3','-21','1','VAT reduced rate',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active) values ( 43, 4, '4','0','0.5','3','-21','1','VAT super-reduced rate',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active) values ( 44, 4, '0','0', '0','3','-21','1','VAT Rate 0',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active) values ( 41, 4,'21','0','5.2','3','-21:-9:-2','1','VAT standard rate',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active) values ( 42, 4,'10','0','1.4','3','-21:-9:-2','1','VAT reduced rate',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active) values ( 43, 4, '4','0','0.5','3','-21:-9:-2','1','VAT super-reduced rate',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active) values ( 44, 4, '0','0', '0','3','-21:-9:-2','1','VAT Rate 0',1); -- SWEDEN (id country=20) insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (201,20, '25','0','VAT standard rate',1); diff --git a/htdocs/install/mysql/data/llx_c_type_fees.sql b/htdocs/install/mysql/data/llx_c_type_fees.sql index 55c3268b635..9e763bf5ba8 100644 --- a/htdocs/install/mysql/data/llx_c_type_fees.sql +++ b/htdocs/install/mysql/data/llx_c_type_fees.sql @@ -30,6 +30,6 @@ -- Type fees -- -insert into llx_c_type_fees (code,libelle,active) values ('TF_OTHER', 'Other', 1); -insert into llx_c_type_fees (code,libelle,active) values ('TF_TRIP', 'Trip', 1); -insert into llx_c_type_fees (code,libelle,active) values ('TF_LUNCH', 'Lunch', 1); +insert into llx_c_type_fees (code,label,active) values ('TF_OTHER', 'Other', 1); +insert into llx_c_type_fees (code,label,active) values ('TF_TRIP', 'Trip', 1); +insert into llx_c_type_fees (code,label,active) values ('TF_LUNCH', 'Lunch', 1); diff --git a/htdocs/install/mysql/data/llx_c_typent.sql b/htdocs/install/mysql/data/llx_c_typent.sql index 154798cdd4f..918230cc5a3 100644 --- a/htdocs/install/mysql/data/llx_c_typent.sql +++ b/htdocs/install/mysql/data/llx_c_typent.sql @@ -27,17 +27,20 @@ -- -- --- Types entreprises +-- Types of thirdparties -- delete from llx_c_typent; -insert into llx_c_typent (id,code,libelle,active) values ( 0, 'TE_UNKNOWN', '-', 1); -insert into llx_c_typent (id,code,libelle,active) values ( 1, 'TE_STARTUP', 'Start-up', 0); -insert into llx_c_typent (id,code,libelle,active) values ( 2, 'TE_GROUP', 'Grand groupe', 1); -insert into llx_c_typent (id,code,libelle,active) values ( 3, 'TE_MEDIUM', 'PME/PMI', 1); -insert into llx_c_typent (id,code,libelle,active) values ( 4, 'TE_SMALL', 'TPE', 1); -insert into llx_c_typent (id,code,libelle,active) values ( 5, 'TE_ADMIN', 'Administration',1); -insert into llx_c_typent (id,code,libelle,active) values ( 6, 'TE_WHOLE', 'Grossiste', 0); -insert into llx_c_typent (id,code,libelle,active) values ( 7, 'TE_RETAIL', 'Revendeur', 0); -insert into llx_c_typent (id,code,libelle,active) values ( 8, 'TE_PRIVATE', 'Particulier', 1); -insert into llx_c_typent (id,code,libelle,active) values (100, 'TE_OTHER', 'Autres', 1); +insert into llx_c_typent (id,code,libelle,fk_country,active) values ( 0, 'TE_UNKNOWN', '-', NULL, 1); +insert into llx_c_typent (id,code,libelle,fk_country,active) values ( 1, 'TE_STARTUP', 'Start-up', NULL, 0); +insert into llx_c_typent (id,code,libelle,fk_country,active) values ( 2, 'TE_GROUP', 'Grand groupe', NULL, 1); +insert into llx_c_typent (id,code,libelle,fk_country,active) values ( 3, 'TE_MEDIUM', 'PME/PMI', NULL, 1); +insert into llx_c_typent (id,code,libelle,fk_country,active) values ( 4, 'TE_SMALL', 'TPE', NULL, 1); +insert into llx_c_typent (id,code,libelle,fk_country,active) values ( 5, 'TE_ADMIN', 'Administration',NULL, 1); +insert into llx_c_typent (id,code,libelle,fk_country,active) values ( 6, 'TE_WHOLE', 'Grossiste', NULL, 0); +insert into llx_c_typent (id,code,libelle,fk_country,active) values ( 7, 'TE_RETAIL', 'Revendeur', NULL, 0); +insert into llx_c_typent (id,code,libelle,fk_country,active) values ( 8, 'TE_PRIVATE', 'Particulier', NULL, 1); +insert into llx_c_typent (id,code,libelle,fk_country,active) values (100, 'TE_OTHER', 'Autres', NULL, 1); +insert into llx_c_typent (id,code,libelle,fk_country,active) values (231, 'TE_A_RI', 'Responsable Inscripto', 23, 0); +insert into llx_c_typent (id,code,libelle,fk_country,active) values (232, 'TE_B_RNI', 'Responsable No Inscripto', 23, 0); +insert into llx_c_typent (id,code,libelle,fk_country,active) values (233, 'TE_C_FE', 'Consumidor Final/Exento', 23, 0); diff --git a/htdocs/install/mysql/functions/index.html b/htdocs/install/mysql/functions/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/install/mysql/index.html b/htdocs/install/mysql/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/install/mysql/migration/2.0.0-2.1.0.sql b/htdocs/install/mysql/migration/2.0.0-2.1.0.sql deleted file mode 100644 index e2205b29953..00000000000 --- a/htdocs/install/mysql/migration/2.0.0-2.1.0.sql +++ /dev/null @@ -1,958 +0,0 @@ --- --- Attention a l ordre des requetes. --- Ce fichier doit etre charge sur une version 2.0.0 --- sans AUCUNE erreur ni warning --- - -create table llx_paiementfourn_facturefourn -( - rowid integer AUTO_INCREMENT PRIMARY KEY, - fk_paiementfourn INT(11) DEFAULT NULL, - fk_facturefourn INT(11) DEFAULT NULL, - amount DOUBLE DEFAULT '0' -) TYPE=innodb; -ALTER TABLE llx_paiementfourn_facturefourn ADD INDEX idx_paiementfourn_facturefourn_fk_facture(fk_facturefourn); -ALTER TABLE llx_paiementfourn_facturefourn ADD INDEX idx_paiementfourn_facturefourn_fk_paiement(fk_paiementfourn); - - -drop table if exists llx_commande_model_pdf; -drop table if exists llx_commande_fournisseur_model_pdf; - -alter table llx_commande add column note_public text after note; - -alter table llx_contrat add column note text; -alter table llx_contrat add column note_public text after note; - -alter table llx_facture add column note_public text after note; -alter table llx_facture add column remise_absolue real DEFAULT 0 after remise_percent; -alter table llx_facture add column close_code varchar(16) after remise; -alter table llx_facture add column close_note varchar(128) after close_code; -alter table llx_facture modify close_code varchar(16); - -alter table llx_propal add column note_public text after note; -alter table llx_propal add column remise_absolue real DEFAULT 0 after remise_percent; - -alter table llx_commande add column remise_absolue real DEFAULT 0 after remise_percent; - -ALTER TABLE llx_societe add mode_reglement tinyint; -ALTER TABLE llx_societe add cond_reglement tinyint; -ALTER TABLE llx_societe add tva_assuj tinyint DEFAULT '1'; -ALTER TABLE llx_societe add email varchar(128) after url; - -ALTER TABLE llx_societe change active statut tinyint DEFAULT 0; - -ALTER TABLE llx_societe modify mode_reglement tinyint NULL; -ALTER TABLE llx_societe modify cond_reglement tinyint NULL; -ALTER TABLE llx_societe modify cond_reglement tinyint NULL; -ALTER TABLE llx_societe modify fk_stcomm tinyint DEFAULT 0; -ALTER TABLE llx_societe modify services tinyint DEFAULT 0; -ALTER TABLE llx_societe modify client tinyint DEFAULT 0; -ALTER TABLE llx_societe modify fournisseur tinyint DEFAULT 0; - -ALTER TABLE llx_societe add customer_bad tinyint DEFAULT 0 after fournisseur; -ALTER TABLE llx_societe add customer_rate real DEFAULT 0 after customer_bad; -ALTER TABLE llx_societe add supplier_rate real DEFAULT 0 after customer_rate; - -ALTER TABLE llx_societe modify siren varchar(16); -ALTER TABLE llx_societe modify siret varchar(16); -ALTER TABLE llx_societe modify ape varchar(16); -ALTER TABLE llx_societe add idprof4 varchar(16) after ape; - -ALTER TABLE llx_societe drop column id; - -ALTER TABLE llx_societe modify parent integer; -UPDATE llx_societe set parent = null where parent = 0; - -ALTER TABLE llx_product ADD COLUMN stock_loc VARCHAR(10) DEFAULT NULL; -ALTER TABLE llx_product ADD COLUMN gencode VARCHAR(255) DEFAULT NULL; -ALTER TABLE llx_product ADD COLUMN weight float DEFAULT NULL; -ALTER TABLE llx_product ADD COLUMN weight_units tinyint DEFAULT NULL; -ALTER TABLE llx_product ADD COLUMN canvas varchar(15) DEFAULT ''; - -ALTER TABLE llx_stock_mouvement ADD COLUMN price FLOAT(13,4) DEFAULT 0; - -insert into llx_cond_reglement(rowid, code, sortorder, active, libelle, libelle_facture, fdm, nbjour) values (6,'PROFORMA', 6,1, 'Proforma','R�glement avant livraison',0,0); - -alter table llx_cond_reglement add (decalage smallint(6) default 0); - -alter table llx_commande add fk_cond_reglement integer DEFAULT NULL; -alter table llx_commande add fk_mode_reglement integer DEFAULT NULL; - - -alter table llx_categorie drop column fk_statut; -alter table llx_categorie add visible tinyint DEFAULT 1 NOT NULL; -ALTER TABLE llx_categorie ADD UNIQUE INDEX uk_categorie_ref (label); - -alter table llx_c_actioncomm add module varchar(16) DEFAULT NULL after libelle; - -delete from llx_c_actioncomm where id in (1,2,3,4,5,8,9,50); -insert into llx_c_actioncomm (id, code, type, libelle, module) values ( 1, 'AC_TEL', 'system', 'Appel Téléphonique' ,NULL); -insert into llx_c_actioncomm (id, code, type, libelle, module) values ( 2, 'AC_FAX', 'system', 'Envoi Fax' ,NULL); -insert into llx_c_actioncomm (id, code, type, libelle, module) values ( 3, 'AC_PROP', 'system', 'Envoi Proposition' ,'propal'); -insert into llx_c_actioncomm (id, code, type, libelle, module) values ( 4, 'AC_EMAIL','system', 'Envoi Email' ,NULL); -insert into llx_c_actioncomm (id, code, type, libelle, module) values ( 5, 'AC_RDV', 'system', 'Rendez-vous' ,NULL); -insert into llx_c_actioncomm (id, code, type, libelle, module) values ( 8, 'AC_COM', 'system', 'Envoi Commande' ,'order'); -insert into llx_c_actioncomm (id, code, type, libelle, module) values ( 9, 'AC_FAC', 'system', 'Envoi Facture' ,'invoice'); -insert into llx_c_actioncomm (id, code, type, libelle, module) values (50, 'AC_OTH', 'system', 'Autre' ,NULL); - -alter table llx_actioncomm modify datea datetime; -alter table llx_actioncomm add column datec datetime after id; -alter table llx_actioncomm add column datep datetime after datec; -alter table llx_actioncomm add column datep2 datetime after datep; -alter table llx_actioncomm add column datea2 datetime after datea; -alter table llx_actioncomm add column tms timestamp after datea2; -alter table llx_actioncomm add column fk_commande integer after propalrowid; -alter table llx_actioncomm add column fk_parent integer NOT NULL default 0 after fk_contact; -alter table llx_actioncomm add column durationp real after percent; -alter table llx_actioncomm add column durationa real after durationp; -alter table llx_actioncomm add column fk_projet integer after label; -alter table llx_actioncomm add column punctual smallint NOT NULL default 1 after priority; - - -update llx_actioncomm set datec = datea where datec is null; -update llx_actioncomm set datep = datea where datep is null AND percent < 100; -update llx_actioncomm set datep = datec where datea is null AND datep is null AND percent < 100; -update llx_actioncomm set datea = datec where datea is null AND datep is null AND percent = 100; -update llx_actioncomm set fk_action = '8' where fk_action = '3' and label = 'Envoi commande par mail'; - - - -drop table if exists llx_expedition_model_pdf; - - -create table llx_product_det -( - rowid integer AUTO_INCREMENT PRIMARY KEY, - fk_product integer DEFAULT 0 NOT NULL, - lang varchar(5) DEFAULT 0 NOT NULL, - label varchar(255) NOT NULL, - description text, - note text -)ENGINE=innodb; - -ALTER TABLE `llx_propal` ADD `date_livraison` DATE; -ALTER TABLE `llx_commande` ADD `date_livraison` DATE; -update llx_commande set date_livraison = null where date_livraison = '0000-00-00'; -update llx_commande set date_livraison = null where date_livraison = '1970-01-01'; - -ALTER TABLE llx_facture_fourn DROP INDEX facnumber; -ALTER TABLE llx_facture_fourn ADD UNIQUE INDEX uk_facture_fourn_ref (facnumber, fk_soc); -ALTER TABLE llx_facture_fourn ADD note_public text after note; -alter table llx_facture_fourn add column `type` smallint DEFAULT 0 NOT NULL after facnumber; - -ALTER TABLE llx_facture_fourn_det ADD INDEX idx_facture_fourn_det_fk_facture (fk_facture_fourn); -ALTER TABLE llx_facture_fourn_det ADD CONSTRAINT fk_facture_fourn_det_fk_facture FOREIGN KEY (fk_facture_fourn) REFERENCES llx_facture_fourn (rowid); - - -ALTER TABLE llx_facturedet ADD COLUMN fk_remise_except integer NULL AFTER remise; -ALTER TABLE llx_facturedet ADD COLUMN total_ht real AFTER price; -ALTER TABLE llx_facturedet ADD COLUMN total_tva real AFTER total_ht; -ALTER TABLE llx_facturedet ADD COLUMN total_ttc real AFTER total_tva; -ALTER TABLE llx_facturedet ADD COLUMN info_bits integer DEFAULT 0 AFTER date_end; -ALTER TABLE llx_facturedet modify fk_product integer NULL; - -UPDATE llx_facturedet SET info_bits=0 where (fk_remise_except IS NULL OR fk_remise_except = 0); -UPDATE llx_facturedet SET fk_product=NULL where fk_product=0; - -ALTER TABLE llx_propaldet ADD COLUMN total_ht real AFTER price; -ALTER TABLE llx_propaldet ADD COLUMN total_tva real AFTER total_ht; -ALTER TABLE llx_propaldet ADD COLUMN total_ttc real AFTER total_tva; -ALTER TABLE llx_propaldet ADD COLUMN info_bits integer DEFAULT 0 AFTER total_ttc; - -ALTER TABLE llx_commandedet ADD COLUMN total_ht real AFTER price; -ALTER TABLE llx_commandedet ADD COLUMN total_tva real AFTER total_ht; -ALTER TABLE llx_commandedet ADD COLUMN total_ttc real AFTER total_tva; -ALTER TABLE llx_commandedet ADD COLUMN info_bits integer DEFAULT 0 AFTER total_ttc; - -ALTER TABLE llx_contratdet ADD COLUMN total_ht real AFTER price_ht; -ALTER TABLE llx_contratdet ADD COLUMN total_tva real AFTER total_ht; -ALTER TABLE llx_contratdet ADD COLUMN total_ttc real AFTER total_tva; -ALTER TABLE llx_contratdet ADD COLUMN info_bits integer DEFAULT 0 AFTER total_ttc; - - -ALTER TABLE llx_commande ADD INDEX idx_commande_fk_soc (fk_soc); -ALTER TABLE llx_commande ADD CONSTRAINT fk_commande_societe FOREIGN KEY (fk_soc) REFERENCES llx_societe (idp); - -ALTER TABLE llx_commande_fournisseur ADD INDEX idx_commande_fournisseur_fk_soc (fk_soc); -ALTER TABLE llx_commande_fournisseur ADD CONSTRAINT fk_commande_fournisseur_societe FOREIGN KEY (fk_soc) REFERENCES llx_societe (idp); - - -alter table llx_commande_fournisseur add note_public text after note; - - -drop table if exists llx_avoir_model_pdf; - - -drop table if exists llx_soc_recontact; - - -update llx_const set name='PRODUIT_DESC_IN_FORM' where name='FORM_ADD_PROD_DESC'; -update llx_const set name='PRODUIT_CHANGE_PROD_DESC' where name='CHANGE_PROD_DESC'; -update llx_const set name='COMMANDE_ADD_PROD_DESC' where name='COM_ADD_PROD_DESC'; -update llx_const set name='PROPALE_ADD_PROD_DESC' where name='PROP_ADD_PROD_DESC'; -update llx_const set name='DON_FORM' where name='DONS_FORM'; -update llx_const set name='MAIN_SIZE_LISTE_LIMIT' where name='SIZE_LISTE_LIMIT'; -update llx_const set name='SOCIETE_FISCAL_MONTH_START' where name='FISCAL_MONTH_START'; -update llx_const set visible=0 where name='FACTURE_DISABLE_RECUR'; -update llx_const set visible=0 where name='MAILING_EMAIL_FROM'; -update llx_const set visible=1 where name='PRODUIT_CONFIRM_DELETE_LINE'; -update llx_const set name='NOTIFICATION_EMAIL_FROM', visible=0 where name='MAIN_MAIL_FROM'; -update llx_const set name='NOTIFICATION_EMAIL_FROM', visible=0 where name='MAIN_EMAIL_FROM'; -update llx_const set value=2048, visible=0 where name='MAIN_UPLOAD_DOC' and value=1; -delete from llx_const where name = 'SIZE_LISTE_LIMIT'; - - -insert into llx_const(name,value,type,visible,note) values('MAIN_SHOW_DEVELOPMENT_MODULES','0','yesno',1,'Make development modules visible'); - -delete from llx_const where name in ('OSC_CATALOG_URL','OSC_LANGUAGE_ID'); -update llx_const set visible=0 where name like 'OSC_DB_%'; - -alter table llx_paiementfourn add statut smallint(6) NOT NULL DEFAULT 0; - - -alter table llx_bank_url add column type enum("company","payment","member","subscription","donation","sc","payment_sc"); -update llx_bank_url set type=null where type=''; -alter table llx_bank_url modify type enum("company","payment","member","subscription","donation","sc","payment_sc") NOT NULL; - -update llx_bank_url set type = 'payment_supplier' where label = '(paiement)' and type='payment' and url like '%/fourn/%'; - -alter table llx_bank_url drop index fk_bank; -alter table llx_bank_url drop index fk_bank_2; -alter table llx_bank_url drop index fk_bank_3; -alter table llx_bank_url drop index fk_bank_4; -alter table llx_bank_url drop index fk_bank_5; -alter table llx_bank_url drop index fk_bank_6; -alter table llx_bank_url drop index fk_bank_7; -alter table llx_bank_url drop index fk_bank_8; -alter table llx_bank_url drop index fk_bank_9; - -ALTER TABLE llx_bank_url DROP INDEX uk_bank_url; -ALTER TABLE llx_bank_url ADD UNIQUE INDEX uk_bank_url (fk_bank,type); - -create table llx_societe_adresse_livraison -( - rowid integer AUTO_INCREMENT PRIMARY KEY, - datec datetime, - tms timestamp, - fk_societe integer DEFAULT 0, - nom varchar(60), - address varchar(255), - cp varchar(10), - ville varchar(50), - fk_departement integer DEFAULT 0, - fk_pays integer DEFAULT 0, - note text, - fk_user_creat integer, - fk_user_modif integer -)ENGINE=innodb; - -alter table llx_societe_adresse_livraison add column label varchar(30) after tms; - -alter table llx_propal add column fk_adresse_livraison integer after date_livraison; -alter table llx_commande add column fk_adresse_livraison integer after date_livraison; - -alter table llx_c_pays modify libelle varchar(50) NOT NULL; - -SET FOREIGN_KEY_CHECKS = 0; -delete from llx_c_pays; -SET FOREIGN_KEY_CHECKS = 1; -insert into llx_c_pays (rowid,code,libelle) values (0, '' , '-' ); -insert into llx_c_pays (rowid,code,libelle) values (1, 'FR', 'France' ); -insert into llx_c_pays (rowid,code,libelle) values (2, 'BE', 'Belgique' ); -insert into llx_c_pays (rowid,code,libelle) values (3, 'IT', 'Italie' ); -insert into llx_c_pays (rowid,code,libelle) values (4, 'ES', 'Espagne' ); -insert into llx_c_pays (rowid,code,libelle) values (5, 'DE', 'Allemagne' ); -insert into llx_c_pays (rowid,code,libelle) values (6, 'CH', 'Suisse' ); -insert into llx_c_pays (rowid,code,libelle) values (7, 'GB', 'Royaume uni' ); -insert into llx_c_pays (rowid,code,libelle) values (8, 'IE', 'Irlande' ); -insert into llx_c_pays (rowid,code,libelle) values (9, 'CN', 'Chine' ); -insert into llx_c_pays (rowid,code,libelle) values (10, 'TN', 'Tunisie' ); -insert into llx_c_pays (rowid,code,libelle) values (11, 'US', 'Etats Unis' ); -insert into llx_c_pays (rowid,code,libelle) values (12, 'MA', 'Maroc' ); -insert into llx_c_pays (rowid,code,libelle) values (13, 'DZ', 'Algérie' ); -insert into llx_c_pays (rowid,code,libelle) values (14, 'CA', 'Canada' ); -insert into llx_c_pays (rowid,code,libelle) values (15, 'TG', 'Togo' ); -insert into llx_c_pays (rowid,code,libelle) values (16, 'GA', 'Gabon' ); -insert into llx_c_pays (rowid,code,libelle) values (17, 'NL', 'Pays Bas' ); -insert into llx_c_pays (rowid,code,libelle) values (18, 'HU', 'Hongrie' ); -insert into llx_c_pays (rowid,code,libelle) values (19, 'RU', 'Russie' ); -insert into llx_c_pays (rowid,code,libelle) values (20, 'SE', 'Suède' ); -insert into llx_c_pays (rowid,code,libelle) values (21, 'CI', 'Côte d\'Ivoire' ); -insert into llx_c_pays (rowid,code,libelle) values (22, 'SN', 'Sénégal' ); -insert into llx_c_pays (rowid,code,libelle) values (23, 'AR', 'Argentine' ); -insert into llx_c_pays (rowid,code,libelle) values (24, 'CM', 'Cameroun' ); -insert into llx_c_pays (rowid,code,libelle) values (25, 'PT', 'Portugal' ); -insert into llx_c_pays (rowid,code,libelle) values (26, 'SA', 'Arabie Saoudite'); -insert into llx_c_pays (rowid,code,libelle) values (27, 'MC', 'Monaco' ); -insert into llx_c_pays (rowid,code,libelle) values (28, 'AU', 'Australie' ); -insert into llx_c_pays (rowid,code,libelle) values (29, 'SG', 'Singapoure' ); -insert into llx_c_pays (rowid,code,libelle) values (30, 'AF', 'Afghanistan' ); -insert into llx_c_pays (rowid,code,libelle) values (31, 'AX', 'Iles Aland' ); -insert into llx_c_pays (rowid,code,libelle) values (32, 'AL', 'Albanie' ); -insert into llx_c_pays (rowid,code,libelle) values (33, 'AS', 'Samoa américaines'); -insert into llx_c_pays (rowid,code,libelle) values (34, 'AD', 'Andorre' ); -insert into llx_c_pays (rowid,code,libelle) values (35, 'AO', 'Angola' ); -insert into llx_c_pays (rowid,code,libelle) values (36, 'AI', 'Anguilla' ); -insert into llx_c_pays (rowid,code,libelle) values (37, 'AQ', 'Antarctique' ); -insert into llx_c_pays (rowid,code,libelle) values (38, 'AG', 'Antigua-et-Barbuda'); -insert into llx_c_pays (rowid,code,libelle) values (39, 'AM', 'Arménie' ); -insert into llx_c_pays (rowid,code,libelle) values (40, 'AW', 'Aruba' ); -insert into llx_c_pays (rowid,code,libelle) values (41, 'AT', 'Autriche' ); -insert into llx_c_pays (rowid,code,libelle) values (42, 'AZ', 'Azerbaïdjan' ); -insert into llx_c_pays (rowid,code,libelle) values (43, 'BS', 'Bahamas' ); -insert into llx_c_pays (rowid,code,libelle) values (44, 'BH', 'Bahreïn' ); -insert into llx_c_pays (rowid,code,libelle) values (45, 'BD', 'Bangladesh' ); -insert into llx_c_pays (rowid,code,libelle) values (46, 'BB', 'Barbade' ); -insert into llx_c_pays (rowid,code,libelle) values (47, 'BY', 'Biélorussie' ); -insert into llx_c_pays (rowid,code,libelle) values (48, 'BZ', 'Belize' ); -insert into llx_c_pays (rowid,code,libelle) values (49, 'BJ', 'Bénin' ); -insert into llx_c_pays (rowid,code,libelle) values (50, 'BM', 'Bermudes' ); -insert into llx_c_pays (rowid,code,libelle) values (51, 'BT', 'Bhoutan' ); -insert into llx_c_pays (rowid,code,libelle) values (52, 'BO', 'Bolivie' ); -insert into llx_c_pays (rowid,code,libelle) values (53, 'BA', 'Bosnie-Herzégovine'); -insert into llx_c_pays (rowid,code,libelle) values (54, 'BW', 'Botswana' ); -insert into llx_c_pays (rowid,code,libelle) values (55, 'BV', 'Ile Bouvet' ); -insert into llx_c_pays (rowid,code,libelle) values (56, 'BR', 'Brésil' ); -insert into llx_c_pays (rowid,code,libelle) values (57, 'IO', 'Territoire britannique de l\'Océan Indien'); -insert into llx_c_pays (rowid,code,libelle) values (58, 'BN', 'Brunei' ); -insert into llx_c_pays (rowid,code,libelle) values (59, 'BG', 'Bulgarie' ); -insert into llx_c_pays (rowid,code,libelle) values (60, 'BF', 'Burkina Faso' ); -insert into llx_c_pays (rowid,code,libelle) values (61, 'BI', 'Burundi' ); -insert into llx_c_pays (rowid,code,libelle) values (62, 'KH', 'Cambodge' ); -insert into llx_c_pays (rowid,code,libelle) values (63, 'CV', 'Cap-Vert' ); -insert into llx_c_pays (rowid,code,libelle) values (64, 'KY', 'Iles Cayman' ); -insert into llx_c_pays (rowid,code,libelle) values (65, 'CF', 'République centrafricaine'); -insert into llx_c_pays (rowid,code,libelle) values (66, 'TD', 'Tchad' ); -insert into llx_c_pays (rowid,code,libelle) values (67, 'CL', 'Chili' ); -insert into llx_c_pays (rowid,code,libelle) values (68, 'CX', 'Ile Christmas' ); -insert into llx_c_pays (rowid,code,libelle) values (69, 'CC', 'Iles des Cocos (Keeling)'); -insert into llx_c_pays (rowid,code,libelle) values (70, 'CO', 'Colombie' ); -insert into llx_c_pays (rowid,code,libelle) values (71, 'KM', 'Comores' ); -insert into llx_c_pays (rowid,code,libelle) values (72, 'CG', 'Congo' ); -insert into llx_c_pays (rowid,code,libelle) values (73, 'CD', 'République démocratique du Congo'); -insert into llx_c_pays (rowid,code,libelle) values (74, 'CK', 'Iles Cook' ); -insert into llx_c_pays (rowid,code,libelle) values (75, 'CR', 'Costa Rica' ); -insert into llx_c_pays (rowid,code,libelle) values (76, 'HR', 'Croatie' ); -insert into llx_c_pays (rowid,code,libelle) values (77, 'CU', 'Cuba' ); -insert into llx_c_pays (rowid,code,libelle) values (78, 'CY', 'Chypre' ); -insert into llx_c_pays (rowid,code,libelle) values (79, 'CZ', 'République Tchèque'); -insert into llx_c_pays (rowid,code,libelle) values (80, 'DK', 'Danemark' ); -insert into llx_c_pays (rowid,code,libelle) values (81, 'DJ', 'Djibouti' ); -insert into llx_c_pays (rowid,code,libelle) values (82, 'DM', 'Dominique' ); -insert into llx_c_pays (rowid,code,libelle) values (83, 'DO', 'République Dominicaine'); -insert into llx_c_pays (rowid,code,libelle) values (84, 'EC', 'Equateur' ); -insert into llx_c_pays (rowid,code,libelle) values (85, 'EG', 'Egypte' ); -insert into llx_c_pays (rowid,code,libelle) values (86, 'SV', 'Salvador' ); -insert into llx_c_pays (rowid,code,libelle) values (87, 'GQ', 'Guinée Equatoriale'); -insert into llx_c_pays (rowid,code,libelle) values (88, 'ER', 'Erythrée' ); -insert into llx_c_pays (rowid,code,libelle) values (89, 'EE', 'Estonie' ); -insert into llx_c_pays (rowid,code,libelle) values (90, 'ET', 'Ethiopie' ); -insert into llx_c_pays (rowid,code,libelle) values (91, 'FK', 'Iles Falkland' ); -insert into llx_c_pays (rowid,code,libelle) values (92, 'FO', 'Iles Féroé' ); -insert into llx_c_pays (rowid,code,libelle) values (93, 'FJ', 'Iles Fidji' ); -insert into llx_c_pays (rowid,code,libelle) values (94, 'FI', 'Finlande' ); -insert into llx_c_pays (rowid,code,libelle) values (95, 'GF', 'Guyane française'); -insert into llx_c_pays (rowid,code,libelle) values (96, 'PF', 'Polynésie française'); -insert into llx_c_pays (rowid,code,libelle) values (97, 'TF', 'Terres australes françaises'); -insert into llx_c_pays (rowid,code,libelle) values (98, 'GM', 'Gambie' ); -insert into llx_c_pays (rowid,code,libelle) values (99, 'GE', 'Géorgie' ); -insert into llx_c_pays (rowid,code,libelle) values (100, 'GH', 'Ghana' ); -insert into llx_c_pays (rowid,code,libelle) values (101, 'GI', 'Gibraltar' ); -insert into llx_c_pays (rowid,code,libelle) values (102, 'GR', 'Grèce' ); -insert into llx_c_pays (rowid,code,libelle) values (103, 'GL', 'Groenland' ); -insert into llx_c_pays (rowid,code,libelle) values (104, 'GD', 'Grenade' ); -insert into llx_c_pays (rowid,code,libelle) values (105, 'GP', 'Guadeloupe' ); -insert into llx_c_pays (rowid,code,libelle) values (106, 'GU', 'Guam' ); -insert into llx_c_pays (rowid,code,libelle) values (107, 'GT', 'Guatemala' ); -insert into llx_c_pays (rowid,code,libelle) values (108, 'GN', 'Guinée' ); -insert into llx_c_pays (rowid,code,libelle) values (109, 'GW', 'Guinée-Bissao' ); -insert into llx_c_pays (rowid,code,libelle) values (110, 'GY', 'Guyana' ); -insert into llx_c_pays (rowid,code,libelle) values (111, 'HT', 'Haïti' ); -insert into llx_c_pays (rowid,code,libelle) values (112, 'HM', 'Iles Heard et McDonald'); -insert into llx_c_pays (rowid,code,libelle) values (113, 'VA', 'Saint-Siège (Vatican)'); -insert into llx_c_pays (rowid,code,libelle) values (114, 'HN', 'Honduras' ); -insert into llx_c_pays (rowid,code,libelle) values (115, 'HK', 'Hong Kong' ); -insert into llx_c_pays (rowid,code,libelle) values (116, 'IS', 'Islande' ); -insert into llx_c_pays (rowid,code,libelle) values (117, 'IN', 'Inde' ); -insert into llx_c_pays (rowid,code,libelle) values (118, 'ID', 'Indonésie' ); -insert into llx_c_pays (rowid,code,libelle) values (119, 'IR', 'Iran' ); -insert into llx_c_pays (rowid,code,libelle) values (120, 'IQ', 'Iraq' ); -insert into llx_c_pays (rowid,code,libelle) values (121, 'IL', 'Israël' ); -insert into llx_c_pays (rowid,code,libelle) values (122, 'JM', 'Jamaïque' ); -insert into llx_c_pays (rowid,code,libelle) values (123, 'JP', 'Japon' ); -insert into llx_c_pays (rowid,code,libelle) values (124, 'JO', 'Jordanie' ); -insert into llx_c_pays (rowid,code,libelle) values (125, 'KZ', 'Kazakhstan' ); -insert into llx_c_pays (rowid,code,libelle) values (126, 'KE', 'Kenya' ); -insert into llx_c_pays (rowid,code,libelle) values (127, 'KI', 'Kiribati' ); -insert into llx_c_pays (rowid,code,libelle) values (128, 'KP', 'Corée du Nord' ); -insert into llx_c_pays (rowid,code,libelle) values (129, 'KR', 'Corée du Sud' ); -insert into llx_c_pays (rowid,code,libelle) values (130, 'KW', 'Koweït' ); -insert into llx_c_pays (rowid,code,libelle) values (131, 'KG', 'Kirghizistan' ); -insert into llx_c_pays (rowid,code,libelle) values (132, 'LA', 'Laos' ); -insert into llx_c_pays (rowid,code,libelle) values (133, 'LV', 'Lettonie' ); -insert into llx_c_pays (rowid,code,libelle) values (134, 'LB', 'Liban' ); -insert into llx_c_pays (rowid,code,libelle) values (135, 'LS', 'Lesotho' ); -insert into llx_c_pays (rowid,code,libelle) values (136, 'LR', 'Liberia' ); -insert into llx_c_pays (rowid,code,libelle) values (137, 'LY', 'Libye' ); -insert into llx_c_pays (rowid,code,libelle) values (138, 'LI', 'Liechtenstein' ); -insert into llx_c_pays (rowid,code,libelle) values (139, 'LT', 'Lituanie' ); -insert into llx_c_pays (rowid,code,libelle) values (140, 'LU', 'Luxembourg' ); -insert into llx_c_pays (rowid,code,libelle) values (141, 'MO', 'Macao' ); -insert into llx_c_pays (rowid,code,libelle) values (142, 'MK', 'ex-République yougoslave de Macédoine'); -insert into llx_c_pays (rowid,code,libelle) values (143, 'MG', 'Madagascar' ); -insert into llx_c_pays (rowid,code,libelle) values (144, 'MW', 'Malawi' ); -insert into llx_c_pays (rowid,code,libelle) values (145, 'MY', 'Malaisie' ); -insert into llx_c_pays (rowid,code,libelle) values (146, 'MV', 'Maldives' ); -insert into llx_c_pays (rowid,code,libelle) values (147, 'ML', 'Mali' ); -insert into llx_c_pays (rowid,code,libelle) values (148, 'MT', 'Malte' ); -insert into llx_c_pays (rowid,code,libelle) values (149, 'MH', 'Iles Marshall' ); -insert into llx_c_pays (rowid,code,libelle) values (150, 'MQ', 'Martinique' ); -insert into llx_c_pays (rowid,code,libelle) values (151, 'MR', 'Mauritanie' ); -insert into llx_c_pays (rowid,code,libelle) values (152, 'MU', 'Maurice' ); -insert into llx_c_pays (rowid,code,libelle) values (153, 'YT', 'Mayotte' ); -insert into llx_c_pays (rowid,code,libelle) values (154, 'MX', 'Mexique' ); -insert into llx_c_pays (rowid,code,libelle) values (155, 'FM', 'Micronésie' ); -insert into llx_c_pays (rowid,code,libelle) values (156, 'MD', 'Moldavie' ); -insert into llx_c_pays (rowid,code,libelle) values (157, 'MN', 'Mongolie' ); -insert into llx_c_pays (rowid,code,libelle) values (158, 'MS', 'Monserrat' ); -insert into llx_c_pays (rowid,code,libelle) values (159, 'MZ', 'Mozambique' ); -insert into llx_c_pays (rowid,code,libelle) values (160, 'MM', 'Birmanie' ); -insert into llx_c_pays (rowid,code,libelle) values (161, 'NA', 'Namibie' ); -insert into llx_c_pays (rowid,code,libelle) values (162, 'NR', 'Nauru' ); -insert into llx_c_pays (rowid,code,libelle) values (163, 'NP', 'Népal' ); -insert into llx_c_pays (rowid,code,libelle) values (164, 'AN', 'Antilles néerlandaises'); -insert into llx_c_pays (rowid,code,libelle) values (165, 'NC', 'Nouvelle-Calédonie'); -insert into llx_c_pays (rowid,code,libelle) values (166, 'NZ', 'Nouvelle-Zélande'); -insert into llx_c_pays (rowid,code,libelle) values (167, 'NI', 'Nicaragua' ); -insert into llx_c_pays (rowid,code,libelle) values (168, 'NE', 'Niger' ); -insert into llx_c_pays (rowid,code,libelle) values (169, 'NG', 'Nigeria' ); -insert into llx_c_pays (rowid,code,libelle) values (170, 'NU', 'Nioué' ); -insert into llx_c_pays (rowid,code,libelle) values (171, 'NF', 'Ile Norfolk' ); -insert into llx_c_pays (rowid,code,libelle) values (172, 'MP', 'Mariannes du Nord'); -insert into llx_c_pays (rowid,code,libelle) values (173, 'NO', 'Norvège' ); -insert into llx_c_pays (rowid,code,libelle) values (174, 'OM', 'Oman' ); -insert into llx_c_pays (rowid,code,libelle) values (175, 'PK', 'Pakistan' ); -insert into llx_c_pays (rowid,code,libelle) values (176, 'PW', 'Palaos' ); -insert into llx_c_pays (rowid,code,libelle) values (177, 'PS', 'territoire Palestinien Occupé'); -insert into llx_c_pays (rowid,code,libelle) values (178, 'PA', 'Panama' ); -insert into llx_c_pays (rowid,code,libelle) values (179, 'PG', 'Papouasie-Nouvelle-Guinée'); -insert into llx_c_pays (rowid,code,libelle) values (180, 'PY', 'Paraguay' ); -insert into llx_c_pays (rowid,code,libelle) values (181, 'PE', 'Pérou' ); -insert into llx_c_pays (rowid,code,libelle) values (182, 'PH', 'Philippines' ); -insert into llx_c_pays (rowid,code,libelle) values (183, 'PN', 'Iles Pitcairn' ); -insert into llx_c_pays (rowid,code,libelle) values (184, 'PL', 'Pologne' ); -insert into llx_c_pays (rowid,code,libelle) values (185, 'PR', 'Porto Rico' ); -insert into llx_c_pays (rowid,code,libelle) values (186, 'QA', 'Qatar' ); -insert into llx_c_pays (rowid,code,libelle) values (187, 'RE', 'Réunion' ); -insert into llx_c_pays (rowid,code,libelle) values (188, 'RO', 'Roumanie' ); -insert into llx_c_pays (rowid,code,libelle) values (189, 'RW', 'Rwanda' ); -insert into llx_c_pays (rowid,code,libelle) values (190, 'SH', 'Sainte-Hélène' ); -insert into llx_c_pays (rowid,code,libelle) values (191, 'KN', 'Saint-Christophe-et-Niévès'); -insert into llx_c_pays (rowid,code,libelle) values (192, 'LC', 'Sainte-Lucie' ); -insert into llx_c_pays (rowid,code,libelle) values (193, 'PM', 'Saint-Pierre-et-Miquelon'); -insert into llx_c_pays (rowid,code,libelle) values (194, 'VC', 'Saint-Vincent-et-les-Grenadines'); -insert into llx_c_pays (rowid,code,libelle) values (195, 'WS', 'Samoa' ); -insert into llx_c_pays (rowid,code,libelle) values (196, 'SM', 'Saint-Marin' ); -insert into llx_c_pays (rowid,code,libelle) values (197, 'ST', 'Sao Tomé-et-Principe'); -insert into llx_c_pays (rowid,code,libelle) values (198, 'RS', 'Serbie' ); -insert into llx_c_pays (rowid,code,libelle) values (199, 'SC', 'Seychelles' ); -insert into llx_c_pays (rowid,code,libelle) values (200, 'SL', 'Sierra Leone' ); -insert into llx_c_pays (rowid,code,libelle) values (201, 'SK', 'Slovaquie' ); -insert into llx_c_pays (rowid,code,libelle) values (202, 'SI', 'Slovénie' ); -insert into llx_c_pays (rowid,code,libelle) values (203, 'SB', 'Iles Salomon' ); -insert into llx_c_pays (rowid,code,libelle) values (204, 'SO', 'Somalie' ); -insert into llx_c_pays (rowid,code,libelle) values (205, 'ZA', 'Afrique du Sud'); -insert into llx_c_pays (rowid,code,libelle) values (206, 'GS', 'Iles Géorgie du Sud et Sandwich du Sud'); -insert into llx_c_pays (rowid,code,libelle) values (207, 'LK', 'Sri Lanka' ); -insert into llx_c_pays (rowid,code,libelle) values (208, 'SD', 'Soudan' ); -insert into llx_c_pays (rowid,code,libelle) values (209, 'SR', 'Suriname' ); -insert into llx_c_pays (rowid,code,libelle) values (210, 'SJ', 'Iles Svalbard et Jan Mayen'); -insert into llx_c_pays (rowid,code,libelle) values (211, 'SZ', 'Swaziland' ); -insert into llx_c_pays (rowid,code,libelle) values (212, 'SY', 'Syrie' ); -insert into llx_c_pays (rowid,code,libelle) values (213, 'TW', 'Taïwan' ); -insert into llx_c_pays (rowid,code,libelle) values (214, 'TJ', 'Tadjikistan' ); -insert into llx_c_pays (rowid,code,libelle) values (215, 'TZ', 'Tanzanie' ); -insert into llx_c_pays (rowid,code,libelle) values (216, 'TH', 'Thaïlande' ); -insert into llx_c_pays (rowid,code,libelle) values (217, 'TL', 'Timor Oriental'); -insert into llx_c_pays (rowid,code,libelle) values (218, 'TK', 'Tokélaou' ); -insert into llx_c_pays (rowid,code,libelle) values (219, 'TO', 'Tonga' ); -insert into llx_c_pays (rowid,code,libelle) values (220, 'TT', 'Trinité-et-Tobago'); -insert into llx_c_pays (rowid,code,libelle) values (221, 'TR', 'Turquie' ); -insert into llx_c_pays (rowid,code,libelle) values (222, 'TM', 'Turkménistan' ); -insert into llx_c_pays (rowid,code,libelle) values (223, 'TC', 'Iles Turks-et-Caicos'); -insert into llx_c_pays (rowid,code,libelle) values (224, 'TV', 'Tuvalu' ); -insert into llx_c_pays (rowid,code,libelle) values (225, 'UG', 'Ouganda' ); -insert into llx_c_pays (rowid,code,libelle) values (226, 'UA', 'Ukraine' ); -insert into llx_c_pays (rowid,code,libelle) values (227, 'AE', 'Emirats arabes unis'); -insert into llx_c_pays (rowid,code,libelle) values (228, 'UM', 'Iles mineures éloignées des états-Unis'); -insert into llx_c_pays (rowid,code,libelle) values (229, 'UY', 'Uruguay' ); -insert into llx_c_pays (rowid,code,libelle) values (230, 'UZ', 'Ouzbékistan' ); -insert into llx_c_pays (rowid,code,libelle) values (231, 'VU', 'Vanuatu' ); -insert into llx_c_pays (rowid,code,libelle) values (232, 'VE', 'Vénézuela' ); -insert into llx_c_pays (rowid,code,libelle) values (233, 'VN', 'Viêt Nam' ); -insert into llx_c_pays (rowid,code,libelle) values (234, 'VG', 'Iles Vierges britanniques'); -insert into llx_c_pays (rowid,code,libelle) values (235, 'VI', 'Iles Vierges américaines'); -insert into llx_c_pays (rowid,code,libelle) values (236, 'WF', 'Wallis-et-Futuna'); -insert into llx_c_pays (rowid,code,libelle) values (237, 'EH', 'Sahara occidental'); -insert into llx_c_pays (rowid,code,libelle) values (238, 'YE', 'Yémen' ); -insert into llx_c_pays (rowid,code,libelle) values (239, 'ZM', 'Zambie' ); -insert into llx_c_pays (rowid,code,libelle) values (240, 'ZW', 'Zimbabwe' ); - -delete from llx_c_regions where rowid='2901' and code_region='2901'; -delete from llx_c_departements where fk_region='2901'; - -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (2801,28,2801, '',0,'Australia'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (2801,'NSW','',1,'','New South Wales'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (2801,'VIC','',1,'','Victoria'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (2801,'QLD','',1,'','Queensland'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (2801, 'SA','',1,'','South Australia'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (2801,'ACT','',1,'','Australia Capital Territory'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (2801,'TAS','',1,'','Tasmania'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (2801, 'WA','',1,'','Western Australia'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (2801, 'NT','',1,'','Northern Territory'); - -delete from llx_c_tva where rowid='291' and fk_pays='5'; -delete from llx_c_tva where rowid='292' and fk_pays='5'; -delete from llx_c_tva where rowid='291' and fk_pays='29'; -delete from llx_c_tva where rowid='292' and fk_pays='29'; -delete from llx_c_tva where rowid='261' and fk_pays='26'; -delete from llx_c_tva where rowid='262' and fk_pays='26'; -delete from llx_c_tva where rowid='263' and fk_pays='26'; -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (281, 28, '10','0','VAT Rate 10',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (282, 28, '0','0','VAT Rate 0',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (251,25, '17','0','VAT Rate 17',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (252,25, '12','0','VAT Rate 12',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (253,25, '0','0','VAT Rate 0',1); - - -update llx_const set name='DON_ADDON_MODEL' where name='DON_ADDON'; -update llx_const set value='neptune' where value='pluton' and name = 'FACTURE_ADDON'; -update llx_const set value='azur' where value='orange' and name = 'PROPALE_ADDON'; -update llx_const set value='mod_commande_diamant' where value='mod_commande_jade' and name ='COMMANDE_ADDON'; -insert into llx_const (name, value, type, visible) values ('FICHEINTER_ADDON', 'pacific','chaine',0); - -alter table llx_propal_model_pdf rename to llx_document_model; - -alter table llx_document_model DROP PRIMARY KEY; -alter table llx_document_model add column rowid integer AUTO_INCREMENT PRIMARY KEY FIRST; -alter table llx_document_model add column type varchar(20) NOT NULL after nom; -update llx_document_model set type='propal' where type=''; - -delete from llx_document_model where nom='adytek'; -delete from llx_document_model where nom='rouge' and type='order'; -delete from llx_document_model where nom='azur' and type='order'; -delete from llx_document_model where nom='orange' and type='propal'; -delete from llx_document_model where nom='transporteur' and type='shipping'; -delete from llx_document_model where nom='dorade' and type='shipping'; - - - - -ALTER TABLE llx_facture ADD UNIQUE INDEX idx_facture_uk_facnumber (facnumber); - -alter table llx_facture_rec add column remise_absolue real default 0 after remise_percent; -alter table llx_facture_rec add column fk_mode_reglement integer default 0 after fk_cond_reglement; -alter table llx_facture_rec add column date_lim_reglement date after fk_mode_reglement; -alter table llx_facture_rec add column note_public text after note; -update llx_facture_rec set fk_mode_reglement='0' where fk_mode_reglement='NULL'; - -ALTER TABLE llx_facture_rec ADD INDEX idx_facture_rec_fk_soc (fk_soc); -ALTER TABLE llx_facture_rec ADD INDEX idx_facture_rec_fk_user_author (fk_user_author); -ALTER TABLE llx_facture_rec ADD INDEX idx_facture_rec_fk_projet (fk_projet); - -ALTER TABLE llx_facture_rec ADD CONSTRAINT fk_facture_rec_fk_user_author FOREIGN KEY (fk_user_author) REFERENCES llx_user (rowid); -ALTER TABLE llx_facture_rec ADD CONSTRAINT fk_facture_rec_fk_projet FOREIGN KEY (fk_projet) REFERENCES llx_projet (rowid); - -ALTER TABLE llx_facture_rec ADD UNIQUE INDEX idx_facture_rec_uk_titre (titre); - -ALTER TABLE llx_commandedet ADD COLUMN fk_remise_except integer NULL AFTER remise; -ALTER TABLE llx_commandedet ADD COLUMN special_code tinyint(1) UNSIGNED DEFAULT 0; - -ALTER TABLE llx_propaldet ADD COLUMN fk_remise_except integer NULL AFTER remise; - -ALTER TABLE llx_contratdet ADD COLUMN fk_remise_except integer NULL AFTER remise; - -create table llx_livraison -( - rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, - fk_commande integer DEFAULT 0, - fk_expedition integer, - ref varchar(30) NOT NULL, - date_creation datetime, - date_valid datetime, - fk_user_author integer, - fk_user_valid integer, - fk_statut smallint default 0, - note text, - note_public text, - model_pdf varchar(50), - date_livraison date default NULL, - fk_adresse_livraison integer, - - UNIQUE INDEX (ref), - key(fk_commande) -)ENGINE=innodb; - -alter table llx_livraison drop foreign key fk_livraison_societe; -alter table llx_livraison drop column fk_soc; - - -create table llx_livraisondet -( - rowid integer AUTO_INCREMENT PRIMARY KEY, - fk_livraison integer, - fk_commande_ligne integer NOT NULL, - qty real, - key(fk_livraison), - key(fk_commande_ligne) -)ENGINE=innodb; - - -insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (90, 'commande', 'internal', 'SALESREPSIGN', 'Commercial signataire de la commande', 1); -insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (91, 'commande', 'internal', 'SALESREPFOLL', 'Commercial suivi de la commande', 1); -insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (100, 'commande', 'external', 'BILLING', 'Contact client facturation commande', 1); -insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (101, 'commande', 'external', 'CUSTOMER', 'Contact client suivi commande', 1); - -alter table llx_bank_account add column ref varchar(12) NOT NULL; -alter table llx_bank_account add column url varchar(128); -alter table llx_bank_account add column currency_code varchar(2) NOT NULL; -alter table llx_bank_account add column min_allowed integer DEFAULT 0; -alter table llx_bank_account add column min_desired integer DEFAULT 0; -alter table llx_bank_account add column comment varchar(254); -alter table llx_bank_account modify bic varchar(11); - -update llx_bank_account set currency_code='EU'; -update llx_bank_account set rappro=0 where courant=2; - -ALTER TABLE llx_bank ADD COLUMN fk_bordereau INTEGER DEFAULT 0; -ALTER TABLE llx_bank ADD COLUMN banque varchar(255); -ALTER TABLE llx_bank ADD COLUMN emetteur varchar(255); - -alter table llx_accountingsystem_det rename to llx_accountingaccount; - - -insert into llx_rights_def (id, libelle, module, type, bydefault, subperms, perms) values (262,'Consulter tous les clients','commercial','r',1,'voir','client'); --- V4.1 insert into llx_user_rights(fk_user,fk_id) select distinct fk_user, '262' from llx_user_rights where fk_id = 261; -update llx_rights_def set subperms='creer' where subperms='supprimer' AND module='user' AND perms='self' AND id=255; -update llx_rights_def set module='tax' where module='compta' AND id in ('91','92','93'); -update llx_rights_def set subperms='receptionner' where id=186; - - -alter table llx_commandedet add column rang integer DEFAULT 0; -alter table llx_propaldet add column rang integer DEFAULT 0; - -alter table llx_facture drop column model; -alter table llx_facture add column model_pdf varchar(50) after note_public; - -alter table llx_facture drop foreign key fk_facture_fk_facture; -alter table llx_facture drop column fk_facture; -alter table llx_facture add column fk_facture_source integer after fk_user_valid; -ALTER TABLE llx_facture ADD INDEX idx_facture_fk_facture_source (fk_facture_source); -ALTER TABLE llx_facture ADD CONSTRAINT fk_facture_source_fk_facture FOREIGN KEY (fk_facture_source) REFERENCES llx_facture (rowid); -alter table llx_facture add column type smallint DEFAULT 0 NOT NULL after facnumber; - - --- Supprimme orphelins pour permettre montée de la clé --- V4 DELETE llx_commandedet FROM llx_commandedet LEFT JOIN llx_commande ON llx_commandedet.fk_commande = llx_commande.rowid WHERE llx_commande.rowid IS NULL; - -ALTER TABLE llx_commandedet ADD INDEX idx_commandedet_fk_commande (fk_commande); -ALTER TABLE llx_commandedet ADD CONSTRAINT fk_commandedet_fk_commande FOREIGN KEY (fk_commande) REFERENCES llx_commande (rowid); - - --- drop table llx_societe_remise_except; -create table llx_societe_remise_except -( - rowid integer AUTO_INCREMENT PRIMARY KEY, - fk_soc integer NOT NULL, - datec datetime, - amount_ht real NOT NULL, - fk_user integer NOT NULL, - fk_facture integer, - description varchar(255) NOT NULL -)ENGINE=innodb; - -alter table llx_societe_remise_except ADD COLUMN amount_tva real DEFAULT 0 NOT NULL after amount_ht; -alter table llx_societe_remise_except ADD COLUMN amount_ttc real DEFAULT 0 NOT NULL after amount_tva; -alter table llx_societe_remise_except ADD COLUMN tva_tx real DEFAULT 0 NOT NULL after amount_ttc; -alter table llx_societe_remise_except ADD COLUMN fk_facture_source integer after fk_user; - -update llx_societe_remise_except set amount_tva=0, tva_tx=0, amount_ttc = amount_ht where amount_ttc = 0; -delete from llx_societe_remise_except WHERE amount_ht=0; - --- Supprimme orphelins pour permettre montée de la clé --- V4 DELETE llx_societe_remise_except FROM llx_societe_remise_except LEFT JOIN llx_facturedet ON llx_societe_remise_except.fk_facture = llx_facturedet.rowid WHERE llx_facturedet.rowid IS NULL; - -ALTER TABLE llx_societe_remise_except DROP FOREIGN KEY fk_societe_remise_fk_facture; -ALTER TABLE llx_societe_remise_except DROP FOREIGN KEY fk_societe_remise_fk_facture_source; - -ALTER TABLE llx_societe_remise_except ADD INDEX idx_societe_remise_except_fk_user (fk_user); -ALTER TABLE llx_societe_remise_except ADD INDEX idx_societe_remise_except_fk_soc (fk_soc); -ALTER TABLE llx_societe_remise_except ADD INDEX idx_societe_remise_except_fk_facture (fk_facture); -ALTER TABLE llx_societe_remise_except ADD INDEX idx_societe_remise_except_fk_facture_source (fk_facture_source); -ALTER TABLE llx_societe_remise_except ADD CONSTRAINT fk_societe_remise_fk_user FOREIGN KEY (fk_user) REFERENCES llx_user (rowid); -ALTER TABLE llx_societe_remise_except ADD CONSTRAINT fk_societe_remise_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe (idp); -ALTER TABLE llx_societe_remise_except ADD CONSTRAINT fk_societe_remise_fk_facture FOREIGN KEY (fk_facture) REFERENCES llx_facturedet (rowid); -ALTER TABLE llx_societe_remise_except ADD CONSTRAINT fk_societe_remise_fk_facture_source FOREIGN KEY (fk_facture_source) REFERENCES llx_facture (rowid); - -update llx_societe_remise_except set description='Remise sans description' where description is NULL or description =''; -alter table llx_societe_remise_except modify description varchar(255) NOT NULL; - -insert into llx_const (name, value, type, visible, note) VALUES ('PROPALE_VALIDITY_DURATION', '15', 'chaine', 0, 'Durée de validitée des propales'); - -alter table llx_propal add column ref_client varchar(30) after ref; - -alter table llx_societe_adresse_livraison drop column fk_departement; - -alter table llx_user change datelastaccess datelastlogin datetime; -alter table llx_user add column datepreviouslogin datetime after datelastlogin; -alter table llx_user add column ldap_sid varchar(255) DEFAULT NULL; -alter table llx_user add column statut tinyint DEFAULT 1; -alter table llx_user add column lang varchar(6); -alter table llx_user add column pass_crypted varchar(128) after pass; - -alter table llx_user add column office_phone varchar(20); -alter table llx_user add column office_fax varchar(20); -alter table llx_user add column user_mobile varchar(20); - - -alter table llx_user modify login varchar(24) NOT NULL; -alter table llx_user drop code; - - -update llx_user set pass_crypted = MD5(pass) where pass IS NOT NULL AND pass_crypted IS NULL and length(pass) < 32; -update llx_user set pass_crypted = pass where pass IS NOT NULL AND pass_crypted IS NULL and length(pass) = 32; -update llx_user set pass = NULL where length(pass) = 32; - -ALTER TABLE llx_user modify fk_societe integer; -ALTER TABLE llx_user modify fk_socpeople integer; -alter table llx_user add column fk_member integer after fk_socpeople; - -update llx_user set fk_societe = NULL where fk_societe = 0; -update llx_user set fk_socpeople = NULL where fk_socpeople = 0; -update llx_user set fk_member = NULL where fk_member = 0; - -ALTER TABLE llx_user DROP INDEX login; - -ALTER TABLE llx_user ADD UNIQUE INDEX uk_user_login (login); - -ALTER TABLE llx_user ADD INDEX uk_user_fk_societe (fk_societe); - -ALTER TABLE llx_user ADD UNIQUE INDEX uk_user_fk_socpeople (fk_socpeople); -ALTER TABLE llx_user ADD UNIQUE INDEX uk_user_fk_member (fk_member); - - -alter table llx_boxes add column fk_user integer; - -alter table llx_commande_fournisseur drop column fk_soc_contact; -alter table llx_commande drop column fk_soc_contact; -alter table llx_livraison drop column fk_soc_contact; -alter table llx_propal drop column fk_soc_contact; - -alter table llx_commandedet drop column label; - - -insert into llx_action_def (rowid,code,titre,description,objet_type) values (3,'NOTIFY_VAL_ORDER_SUUPLIER','Validation commande fournisseur','Déclenché lors de la validation d\'une commande fournisseur','order_supplier'); - - - -drop table if exists llx_sqltables; - - -ALTER IGNORE TABLE llx_categorie_product DROP FOREIGN KEY llx_categorie_product_ibfk_1; -ALTER IGNORE TABLE llx_categorie_product DROP FOREIGN KEY llx_categorie_product_ibfk_2; -ALTER IGNORE TABLE llx_categorie_product DROP FOREIGN KEY llx_categorie_product_ibfk_3; -ALTER IGNORE TABLE llx_categorie_product DROP FOREIGN KEY llx_categorie_product_ibfk_4; -ALTER IGNORE TABLE llx_categorie_product DROP FOREIGN KEY llx_categorie_product_ibfk_5; - -ALTER TABLE llx_categorie_product ADD CONSTRAINT fk_categorie_product_categorie_rowid FOREIGN KEY (fk_categorie) REFERENCES llx_categorie (rowid); -ALTER TABLE llx_categorie_product ADD CONSTRAINT fk_categorie_product_product_rowid FOREIGN KEY (fk_product) REFERENCES llx_product (rowid); - -ALTER TABLE llx_categorie_product ADD PRIMARY KEY (fk_categorie, fk_product); - -alter table llx_product modify label varchar(255) NOT NULL; -alter table llx_product modify description text; -ALTER TABLE llx_product ADD COLUMN price_base_type varchar(3) DEFAULT 'HT' AFTER price; -ALTER TABLE llx_product ADD COLUMN price_ttc float(12,4) DEFAULT 0 AFTER price_base_type; -alter table llx_product_det modify label varchar(255) NOT NULL; -alter table llx_product_det modify description text; - -create table llx_accountingdebcred -( - fk_transaction integer NOT NULL, - fk_account integer NOT NULL, - amount real NOT NULL, - direction varchar(1) NOT NULL -)ENGINE=innodb; - -alter table llx_facturedet_rec add column total_ht real; -alter table llx_facturedet_rec add column total_tva real; -alter table llx_facturedet_rec add column total_ttc real; - -alter table llx_adherent add column phone varchar(30) after email; -alter table llx_adherent add column phone_perso varchar(30) after phone; -alter table llx_adherent add column phone_mobile varchar(30) after phone_perso; - -delete from llx_adherent_type where libelle IS NULL; -alter table llx_adherent_type modify libelle varchar(50) NOT NULL; - -update llx_facture set fk_facture_source=null where fk_facture_source is not null and type = 0; -update llx_facture set fk_statut=2 where paye=1; -update llx_facture set fk_statut=2 where close_code is not null and close_code != '' and close_code != 'replaced'; - - -update llx_boxes set fk_user = 0 where fk_user IS NULL; -ALTER TABLE llx_boxes modify fk_user integer default 0 NOT NULL; - --- Supprimme orphelins pour permettre montee de la cle --- V4 DELETE llx_boxes FROM llx_boxes LEFT JOIN llx_boxes_def ON llx_boxes.box_id = llx_boxes_def.rowid WHERE llx_boxes_def.rowid IS NULL; - -ALTER TABLE llx_boxes ADD INDEX idx_boxes_boxid (box_id); --- V4 ALTER TABLE llx_boxes ADD CONSTRAINT fk_boxes_box_id FOREIGN KEY (box_id) REFERENCES llx_boxes_def (rowid); - -ALTER TABLE llx_boxes ADD INDEX idx_boxes_fk_user (fk_user); - - -create table llx_categorie_fournisseur -( - fk_categorie integer NOT NULL, - fk_societe integer NOT NULL, - UNIQUE (fk_categorie, fk_societe) -)ENGINE=innodb; - - -create table llx_fournisseur_ca -( - fk_societe integer, - date_calcul datetime, - year smallint UNSIGNED, - ca_genere float, - UNIQUE (fk_societe, year) -)ENGINE=innodb; - -alter table llx_fournisseur_ca add ca_achat float(11,2) DEFAULT 0; - -create table llx_product_ca -( - fk_product integer, - date_calcul datetime, - year smallint UNSIGNED, - ca_genere float, - UNIQUE (fk_product, year) -)ENGINE=innodb; - -create table llx_commande_fournisseur_dispatch -( - rowid integer AUTO_INCREMENT PRIMARY KEY, - fk_commande integer, - fk_product integer, - qty float, -- quantit� - fk_entrepot integer, - fk_user integer, - datec datetime -)ENGINE=innodb; - -ALTER TABLE llx_commande_fournisseur_dispatch ADD INDEX (fk_commande); - -create table llx_stock_valorisation -( - rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, -- date technique mise a jour automatiquement - date_valo datetime, -- date de valorisation - fk_product integer NOT NULL, -- id du produit concerne par l'operation - qty_ope float(9,3), -- quantite de l'operation - price_ope float(12,4), -- prix unitaire du produit concerne par l'operation - valo_ope float(12,4), -- valorisation de l'operation - price_pmp float(12,4), -- valeur PMP de l'operation - qty_stock float(9,3) DEFAULT 0, -- qunatite en stock - valo_pmp float(12,4), -- valorisation du stock en PMP - fk_stock_mouvement integer, -- id du mouvement de stock - - key(fk_product) -)ENGINE=innodb; - - -create table llx_entrepot_valorisation -( - rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, -- date technique mise a jour automatiquement - date_calcul date, -- date auquel a ete calcule la valeur - fk_entrepot integer UNSIGNED NOT NULL , - valo_pmp float(12,4), -- valoristaion du stock en PMP - key(fk_entrepot) -)ENGINE=innodb; - -ALTER TABLE llx_entrepot ADD COLUMN valo_pmp float(12,4) DEFAULT 0; - -create table llx_user_entrepot -( - rowid integer AUTO_INCREMENT PRIMARY KEY, - fk_entrepot integer UNSIGNED, -- pointe sur llx_entrepot - fk_user integer UNSIGNED, -- pointe sur llx_user - consult tinyint(1) UNSIGNED, - send tinyint(1) UNSIGNED -)ENGINE=innodb; - -create table llx_product_subproduct -( - rowid integer AUTO_INCREMENT PRIMARY KEY, - fk_product integer NOT NULL, -- id du produit maitre - fk_product_subproduct integer NOT NULL, -- id du sous-produit - UNIQUE(fk_product, fk_product_subproduct) -)ENGINE=innodb; - -create table llx_bordereau_cheque -( - rowid integer AUTO_INCREMENT PRIMARY KEY, - datec datetime, - date_bordereau date, - number mediumint, - amount float(12,2), - nbcheque smallint UNSIGNED DEFAULT 0, - fk_bank_account integer, - fk_user_author integer, - note text, - statut tinyint(1) UNSIGNED DEFAULT 0 -)ENGINE=innodb; - -alter table llx_product_price add price_level tinyint(4) NULL DEFAULT 1; -alter table llx_product_price add column price_ttc float(12,4) DEFAULT 0 after price; -alter table llx_product_price add column price_base_type varchar(3) DEFAULT 'HT' after price_ttc; - -ALTER TABLE llx_document_model ADD UNIQUE uk_document_model (nom,type); - -ALTER TABLE llx_chargesociales drop column date_pai; - -UPDATE llx_facture SET type=0 where type=3; - -create table llx_export_model -( - rowid integer AUTO_INCREMENT PRIMARY KEY, - label varchar(50) NOT NULL, - type varchar(20) NOT NULL, - field text -)ENGINE=innodb; - -ALTER table llx_export_model add fk_user integer DEFAULT 0 NOT NULL after rowid; - -ALTER TABLE llx_export_model ADD UNIQUE uk_export_model (label); - -UPDATE llx_rights_def SET ID=ID+1001 WHERE ID BETWEEN 180 AND 189 AND module='fournisseur'; -UPDATE llx_user_rights SET fk_id=fk_id+1001 WHERE fk_id BETWEEN 180 AND 189; -UPDATE llx_usergroup_rights SET fk_id=fk_id+1001 WHERE fk_id BETWEEN 180 AND 189; - -UPDATE llx_rights_def SET ID=ID+1000 WHERE ID BETWEEN 230 AND 236 AND module='fournisseur'; -UPDATE llx_user_rights SET fk_id=fk_id+1000 WHERE fk_id BETWEEN 230 AND 236; -UPDATE llx_usergroup_rights SET fk_id=fk_id+1000 WHERE fk_id BETWEEN 230 AND 236; - -UPDATE llx_rights_def SET ID=ID+1 WHERE ID BETWEEN 1320 AND 1320 AND module='facture'; -UPDATE llx_user_rights SET fk_id=fk_id+1 WHERE fk_id BETWEEN 1320 AND 1320; -UPDATE llx_usergroup_rights SET fk_id=fk_id+1 WHERE fk_id BETWEEN 1320 AND 1320; - -UPDATE llx_rights_def SET ID=ID+1 WHERE ID BETWEEN 1420 AND 1420 AND module='commande'; -UPDATE llx_user_rights SET fk_id=fk_id+1 WHERE fk_id BETWEEN 1420 AND 1420; -UPDATE llx_usergroup_rights SET fk_id=fk_id+1 WHERE fk_id BETWEEN 1420 AND 1420; - - --- Not used. Just to be compatible with upgrade process of higher versions -alter table llx_const add column entity integer DEFAULT 1 NOT NULL; diff --git a/htdocs/install/mysql/migration/2.1.0-2.2.0.sql b/htdocs/install/mysql/migration/2.1.0-2.2.0.sql deleted file mode 100644 index 835c78e151a..00000000000 --- a/htdocs/install/mysql/migration/2.1.0-2.2.0.sql +++ /dev/null @@ -1,1183 +0,0 @@ --- --- Attention a l ordre des requetes. --- Ce fichier doit etre charge sur une version 2.1.0 --- sans AUCUNE erreur ni warning --- - - -alter table llx_commande_fournisseur_dispatch drop index fk_commande; -alter table llx_commande_fournisseur_dispatch drop index fk_commande_2; -alter table llx_commande_fournisseur_dispatch drop index fk_commande_3; -alter table llx_commande_fournisseur_dispatch drop index fk_commande_4; -alter table llx_commande_fournisseur_dispatch drop index fk_commande_5; - -ALTER TABLE llx_commande_fournisseur_dispatch ADD INDEX idx_commande_fournisseur_dispatch_fk_commande (fk_commande); - ---V4.1 UPDATE llx_product_fournisseur_price set fk_user = null where fk_user not in (select rowid from llx_user); ---V4.1 delete llx_commande where fk_soc not in (select rowid from llx_societe); - -alter table llx_categorie add column type tinyint DEFAULT 1 NOT NULL; - --- Supprime les doublons de la table llx_categories --- V4.1 DROP TABLE tmp_categorie1; --- V4.1 DROP TABLE tmp_categorie2; --- V4.1 CREATE TABLE tmp_categorie1 SELECT * FROM llx_categorie; --- V4.1 CREATE TABLE tmp_categorie2 SELECT * FROM llx_categorie; --- V4.1 delete c from llx_categorie as c where c.rowid in (select distinct c2.rowid from tmp_categorie1 as c2, tmp_categorie2 as cc2 where c2.rowid != cc2.rowid and c2.type = cc2.type and c2.label = cc2.label) and c.rowid not in (select min(c3.rowid) from tmp_categorie1 as c3, tmp_categorie2 as cc3 where c3.rowid != cc3.rowid and c3.type = cc3.type and c3.label = cc3.label group by c3.label,c3.type); --- V4.1 DROP TABLE tmp_categorie1; --- V4.1 DROP TABLE tmp_categorie2; --- Si suppression des doublons precedente a ete faite, on monte la cle sur les categories --- V4.1 ALTER TABLE llx_categorie ADD UNIQUE INDEX uk_categorie_ref (label,type); - --- On migre les categories fournisseur de la table llx_fournisseur_categorie qui est obsolete vers table llx_categories qui est generique pour gerer les categories de tout type --- V4.1 INSERT into llx_categorie (label, description, visible, type) (select distinct label, label, 1, 1 from llx_fournisseur_categorie); --- V4.1 UPDATE llx_categorie_fournisseur as cf SET cf.fk_categorie = IFNULL((SELECT distinct c.rowid from llx_categorie as c, llx_fournisseur_categorie as fc where fc.rowid = cf.fk_categorie AND c.type = 1 AND c.label = fc.label),cf.fk_categorie); - --- Supprime les doublons de la table llx_categories --- V4.1 DROP TABLE tmp_categorie1; --- V4.1 DROP TABLE tmp_categorie2; --- V4.1 CREATE TABLE tmp_categorie1 SELECT * FROM llx_categorie; --- V4.1 CREATE TABLE tmp_categorie2 SELECT * FROM llx_categorie; --- V4.1 delete c from llx_categorie as c where c.rowid in (select distinct c2.rowid from tmp_categorie1 as c2, tmp_categorie2 as cc2 where c2.rowid != cc2.rowid and c2.type = cc2.type and c2.label = cc2.label) and c.rowid not in (select min(c3.rowid) from tmp_categorie1 as c3, tmp_categorie2 as cc3 where c3.rowid != cc3.rowid and c3.type = cc3.type and c3.label = cc3.label group by c3.label,c3.type); --- V4.1 DROP TABLE tmp_categorie1; --- V4.1 DROP TABLE tmp_categorie2; --- Si suppression des doublons precedente a ete faite, on monte la cle sur les categories --- V4.1 ALTER TABLE llx_categorie ADD UNIQUE INDEX uk_categorie_ref (label,type); - - --- Corrige mauvaise insertion du a champ trop court -alter table llx_action_def modify code varchar(28) UNIQUE NOT NULL; -alter table llx_action_def modify objet_type varchar(16) NOT NULL; -update llx_action_def set code = 'NOTIFY_VAL_ORDER_SUPPLIER' where code = 'NOTIFY_VAL_ORDER_SUUPLIE'; -update llx_action_def set objet_type = 'order_supplier' where code = 'NOTIFY_VAL_ORDER_SUPPLIER'; - --- Nettoyage champ ref table llx_bank_account -update llx_bank_account set ref=concat('ACCOUNT',rowid) where (ref='' or ref is null); - -update llx_bank_account set currency_code='EU' where (currency_code IS NULL or currency_code=''); -alter table llx_bank_account modify currency_code varchar(3) NOT NULL; -update llx_bank_account set currency_code='EUR' where (currency_code IS NULL or currency_code='' or currency_code='EU'); - --- Sequence de requete pour nettoyage et correction champ type table llx_bank_url -update llx_bank_url set type='company' where (type is null or type = '') and url like '%compta/fiche.php?socid=%'; -alter table llx_bank_url modify `type` varchar(20); -update llx_bank_url set type='?' where (type is null or type = '') and url like '%compta/facture.php?facid=%'; -update llx_bank_url set type='payment_supplier' where (type='' or type is null) and url like '%fourn/paiement/fiche.php?id=%'; -update llx_bank_url set type='?' where (type is null or type = ''); -alter table llx_bank_url modify `type` varchar(20) NOT NULL; - -update llx_bank set datev = datec where datev = '1970-01-01 00:00:00' and rappro = 0; -update llx_bank set dateo = datec where datev = '1970-01-01 00:00:00' and rappro = 0; - -alter table llx_c_chargesociales add column actioncompta varchar(12) NOT NULL; -insert into llx_c_chargesociales (id, libelle, deductible, active, actioncompta) values ( 1, 'Allocations familiales', 1,1,'TAXFAM'); -insert into llx_c_chargesociales (id, libelle, deductible, active, actioncompta) values ( 2, 'GSG Déductible', 1,1,'TAXCSGD'); -insert into llx_c_chargesociales (id, libelle, deductible, active, actioncompta) values ( 3, 'GSG/CRDS NON Déductible',0,1,'TAXCSGND'); -insert into llx_c_chargesociales (id, libelle, deductible, active, actioncompta) values (10, 'Taxe apprentissage', 0,1,'TAXAPP'); -insert into llx_c_chargesociales (id, libelle, deductible, active, actioncompta) values (11, 'Taxe professionnelle', 0,1,'TAXPRO'); -insert into llx_c_chargesociales (id, libelle, deductible, active, actioncompta) values (12, 'Contribution à la formation professionnelle', 1,1,'TAXOPCA'); -insert into llx_c_chargesociales (id, libelle, deductible, active, actioncompta) values (20, 'Impots locaux/fonciers', 0,1,'TAXFON'); -insert into llx_c_chargesociales (id, libelle, deductible, active, actioncompta) values (30, 'Assurance Santé (SECU-URSSAF)', 0,1,'TAXSECU'); -insert into llx_c_chargesociales (id, libelle, deductible, active, actioncompta) values (40, 'Mutuelle', 0,1,'TAXMUT'); -insert into llx_c_chargesociales (id, libelle, deductible, active, actioncompta) values (50, 'Assurance vieillesse (CNAV)', 0,1,'TAXRET'); -insert into llx_c_chargesociales (id, libelle, deductible, active, actioncompta) values (60, 'Assurance Chomage (ASSEDIC)', 0,1,'TAXCHOM'); -update llx_c_chargesociales set actioncompta='TAXFAM' where id = 1; -update llx_c_chargesociales set actioncompta='TAXCSGD' where id = 2; -update llx_c_chargesociales set actioncompta='TAXCSGND' where id = 3; -update llx_c_chargesociales set actioncompta='TAXAPP' where id = 10; -update llx_c_chargesociales set actioncompta='TAXPRO' where id = 11; -update llx_c_chargesociales set actioncompta='TAXFON' where id = 20; -alter table llx_chargesociales modify fk_type integer NOT NULL; -alter table llx_chargesociales modify libelle varchar(80) NOT NULL; - -insert into llx_rights_def (id, libelle, module, type, bydefault, subperms, perms) values (114,'Rapprocher transactions','banque','w',0,null,'consolidate'); -update llx_rights_def set libelle='Creer/modifier/supprimer ecriture bancaire' where perms='modifier' AND module='banque'; - --- Supprime colone en doublon avec fk_user_creat -alter table llx_paiement drop column author; - -update llx_actioncomm set fk_action = 9 where fk_action = 10; -update llx_actioncomm set percent = 100 where percent = 0 and datea is not null; - -ALTER TABLE llx_cotisation ADD COLUMN datef date after dateadh; -ALTER TABLE llx_cotisation modify datef date; -ALTER TABLE llx_cotisation ADD UNIQUE INDEX uk_cotisation (fk_adherent,dateadh); --- V4.1 update llx_cotisation set datef = ADDDATE(ADDDATE(dateadh, INTERVAL 1 YEAR),INTERVAL -1 DAY); - - -delete from llx_const where name='MAIN_SHOW_DEVELOPMENT_MODULES'; -delete from llx_const where name='MAIN_ENABLE_DEVELOPMENT'; -DELETE FROM llx_const WHERE name = 'PRODUIT_CHANGE_PROD_DESC'; -DELETE FROM llx_const WHERE name like 'FICHINTER_ADDON%'; -insert into llx_const (name, value, type, visible) values ('FICHEINTER_ADDON', 'pacific','chaine',0); -insert into llx_const (name, value, type, visible) values ('FICHEINTER_ADDON_PDF','soleil','chaine',0); - -INSERT INTO llx_const(name, value, type, note, visible) VALUES ('GENBARCODE_LOCATION','/usr/local/bin/genbarcode','chaine','location of genbarcode',0); -insert into llx_const(name, value, type, visible, note) values('MAIN_FEATURES_LEVEL','0','chaine',1,'Level of features to show (0=stable only, 1=stable+experimental, 2=stable+experimental+development'); - -update llx_const set name='MAIN_MAIL_EMAIL_FROM' where name='NOTIFICATION_EMAIL_FROM'; - -update llx_const set value='bluelagoon' where name='MAIN_THEME' and value ='dolibarr'; - -update llx_const set visible=0 where name in ('MAIN_UPLOAD_DOC','MAIN_MAIL_SMTP_SERVER','MAIN_MAIL_SMTP_PORT','MAIN_MAIL_EMAIL_FROM'); - -update llx_const set value='rodolphe.php' where name='MAIN_MENU_BARRELEFT' and value='default.php'; -update llx_const set value='rodolphe.php' where name='MAIN_MENU_BARRETOP' and value='default.php'; -update llx_const set value='rodolphe.php' where name='MAIN_MENUFRONT_BARRELEFT' and value='default.php'; -update llx_const set value='rodolphe.php' where name='MAIN_MENUFRONT_BARRETOP' and value='default.php'; - - -delete from llx_adherent_type where libelle IS NULL; -alter table llx_adherent_type modify libelle varchar(50) NOT NULL; - - -alter table llx_tva add fk_bank integer NOT NULL; -alter table llx_tva add fk_user_creat integer; -alter table llx_tva add fk_user_modif integer; - --- V4.1 UPDATE llx_tva as t set fk_bank = (SELECT IFNULL(MIN(rowid),0) FROM llx_bank as b WHERE b.datev = t.datev AND b.amount = -t.amount AND b.label like 'R%glement TVA') WHERE t.fk_bank = 0; --- V4.1 UPDATE llx_tva as t set fk_user_creat = (SELECT MIN(fk_user_author) FROM llx_bank as b WHERE b.datev = t.datev AND b.amount = -t.amount AND b.label like 'R%glement TVA') WHERE t.fk_user_creat IS NULL; - - --- Extention de la gestion des categories -alter table llx_categorie ADD type int not null default '0'; --- V4 ALTER TABLE llx_categorie DROP INDEX uk_categorie_ref; - -create table `llx_categorie_societe` ( - `fk_categorie` integer not null, - `fk_societe` integer not null, - UNIQUE KEY `fk_categorie` (`fk_categorie`,`fk_societe`), - KEY `fk_societe` (`fk_societe`) -) ENGINE=innodb; - -alter table `llx_categorie_societe` drop foreign key fk_societe; -alter table `llx_categorie_societe` add constraint `fk_categorie_societe_categorie_rowid` foreign key(`fk_categorie`) REFERENCES `llx_categorie` (`rowid`); -alter table `llx_categorie_societe` add constraint `fk_categorie_societe_fk_soc` foreign key(`fk_societe`) REFERENCES `llx_societe` (`rowid`); - -create table `llx_categorie_product` ( - `fk_categorie` integer not null, - `fk_product` integer not null, - PRIMARY KEY (`fk_categorie`,`fk_product`), - KEY `idx_categorie_product_fk_categorie` (`fk_categorie`), - KEY `idx_categorie_product_fk_product` (`fk_product`) -) ENGINE=innodb; - -alter table `llx_categorie_product` - add constraint `fk_categorie_product_categorie_rowid` foreign key(`fk_categorie`) REFERENCES `llx_categorie` (`rowid`), - add constraint `fk_categorie_product_product_rowid` foreign key(`fk_product`) REFERENCES `llx_product` (`rowid`); - - --- Ajout gestion du droit de pret -drop table if exists `llx_droitpret_rapport`; -create table `llx_droitpret_rapport` ( - `rowid` integer NOT NULL auto_increment, - `date_envoie` datetime NOT NULL, - `format` varchar(10) NOT NULL, - `date_debut` datetime NOT NULL, - `date_fin` datetime NOT NULL, - `fichier` varchar(255) NOT NULL, - `nbfact` integer NOT NULL, - PRIMARY KEY (`rowid`) -) ENGINE=innodb; - - --- Gestion des menu -CREATE TABLE `llx_menu` ( - `rowid` integer NOT NULL, - `menu_handler` varchar(16) NOT NULL default 'auguria', - `type` enum('top','left') NOT NULL default 'left', - `mainmenu` varchar(100) NOT NULL, - `fk_menu` integer NOT NULL, - `order` tinyint(4) NOT NULL, - `url` varchar(255) NOT NULL, - `target` varchar(100) NULL, - `titre` varchar(255) NOT NULL, - `langs` varchar(100), - `level` tinyint(1), - `leftmenu` varchar(100) NULL, - `right` varchar(255), - `user` tinyint(4) NOT NULL default '0', - PRIMARY KEY (`rowid`) -) ENGINE=innodb; - -create table `llx_menu_constraint` ( - `rowid` integer NOT NULL, - `action` varchar(255) NOT NULL, - PRIMARY KEY (`rowid`) -) ENGINE=innodb; - -create table `llx_menu_const` ( - `rowid` integer NOT NULL auto_increment, - `fk_menu` integer NOT NULL, - `fk_constraint` integer NOT NULL, - `user` tinyint(4) NOT NULL default '2', - PRIMARY KEY (`rowid`) -) ENGINE=innodb; - -ALTER TABLE `llx_menu_const` ADD INDEX `idx_menu_const_fk_menu` (`fk_menu`); -ALTER TABLE `llx_menu_const` ADD INDEX `idx_menu_const_fk_constraint` (`fk_constraint`); - -ALTER TABLE `llx_menu_const` ADD CONSTRAINT `fk_menu_const_fk_menu` FOREIGN KEY (`fk_menu`) REFERENCES `llx_menu` (`rowid`); -ALTER TABLE `llx_menu_const` ADD CONSTRAINT `fk_menu_const_fk_constraint` FOREIGN KEY (`fk_constraint`) REFERENCES `llx_menu_constraint` (`rowid`); - - --- --- Contenu de la table `llx_menu` --- -delete from llx_menu_const; -delete from llx_menu_constraint; -delete from llx_menu where menu_handler='auguria'; -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (1, 'home', '', 0, '/index.php?mainmenu=home&leftmenu=', 'Home', -1, '', '', '', 2, 1); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (2, 'companies', '', 0, '/index.php?mainmenu=companies&leftmenu=', 'ThirdParties', -1, 'companies', '', '', 2, 2); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (3, 'products', '', 0, '/product/index.php?mainmenu=products&leftmenu=', 'Products/Services', -1, 'products', '$user->rights->produit->lire', '', 0, 3); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (4, 'suppliers', '', 0, '/fourn/index.php?mainmenu=suppliers&leftmenu=', 'Suppliers', -1, 'suppliers', '$user->rights->fournisseur->lire', '', 0, 4); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (5, 'commercial', '', 0, '/comm/index.php?mainmenu=commercial&leftmenu=', 'Commercial', -1, 'commercial', '$user->rights->commercial->main->lire', '', 2, 5); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (6, 'accountancy', '', 0, '/compta/index.php?mainmenu=accountancy&leftmenu=', 'MenuFinancial', -1, 'compta', '$user->rights->compta->resultat->lire || $user->rights->comptaexpert->plancompte->lire || $user->rights->commande->lire || $user->rights->facture->lire || $user->rights->banque->lire', '', 2, 6); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (7, 'project', '', 0, '/projet/index.php?mainmenu=project&leftmenu=', 'Projects', -1, 'projects', '$user->rights->projet->lire', '', 0, 7); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (8, 'tools', '', 0, '/index.php?mainmenu=tools&leftmenu=', 'Tools', -1, 'other', '$user->rights->mailing->lire || $user->rights->bookmark->lire || $user->rights->export->lire', '', 2, 8); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (9, 'telephony', '', 0, '/telephonie/index.php?mainmenu=telephony&leftmenu=', 'Telephony', -1, 'telephony', '$user->rights->telephonie->lire', '', 2, 9); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (10, 'energy', '', 0, '/energie/index.php?mainmenu=energy&leftmenu=', 'Energy', -1, 'energy', '', '', 2, 10); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (11, 'shop', '', 0, '/boutique/index.php?mainmenu=shop&leftmenu=', 'OSCommerce', -1, 'shop', '', '', 0, 11); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (12, 'shop', '', 0, '/oscommerce_ws/index.php?mainmenu=shop&leftmenu=', 'OSCommerce', -1, 'shop', '', '', 0, 12); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (13, 'webcal', '', 0, '/webcal/webcal.php?mainmenu=webcal&leftmenu=', 'Calendar', -1, 'other', '', '', 0, 13); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (14, 'mantis', '', 0, '/mantis/mantis.php?mainmenu=mantis', 'BugTracker', -1, 'other', '', '', 2, 14); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (15, 'members', '', 0, '/adherents/index.php?mainmenu=members&leftmenu=', 'Members', -1, 'members', '', '', 2, 15); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (16, 'phenix', '', 0, '/phenix/phenix.php?mainmenu=phenix&leftmenu=', 'Calendar', -1, 'other', '', '', 0, 16); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (100, 'home', '', 1, '/admin/index.php?leftmenu=setup', 'Setup', 0, 'admin', '', '', 2, 0); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (101, 'home', '$leftmenu=="setup"', 100, '/admin/company.php', 'MenuCompanySetup', 1, 'admin', '', '', 2, 0); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (102, 'home', '$leftmenu=="setup"', 100, '/admin/ihm.php', 'GUISetup', 1, 'admin', '', '', 2, 1); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (103, 'home', '$leftmenu=="setup"', 100, '/admin/modules.php', 'Modules', 1, 'admin', '', '', 2, 2); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (104, 'home', '$leftmenu=="setup"', 100, '/admin/boxes.php', 'Boxes', 1, 'admin', '', '', 2, 3); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (105, 'home', '$leftmenu=="setup"', 100, '/admin/menus.php', 'Menus', 1, 'admin', '', '', 2, 4); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (106, 'home', '$leftmenu=="setup"', 100, '/admin/delais.php', 'DelaysBeforeWarning', 1, 'admin', '', '', 2, 5); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (107, 'home', '$leftmenu=="setup"', 100, '/admin/triggers.php', 'Triggers', 1, 'admin', '', '', 2, 6); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (108, 'home', '$leftmenu=="setup"', 100, '/admin/perms.php', 'Security', 1, 'admin', '', '', 2, 7); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (109, 'home', '$leftmenu=="setup"', 100, '/admin/mails.php', 'Emails', 1, 'admin', '', '', 2, 8); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (110, 'home', '$leftmenu=="setup"', 100, '/admin/limits.php', 'Limits', 1, 'admin', '', '', 2, 9); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (111, 'home', '$leftmenu=="setup"', 100, '/admin/dict.php', 'DictionarySetup', 1, 'admin', '', '', 2, 10); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (112, 'home', '$leftmenu=="setup"', 100, '/admin/const.php', 'OtherSetup', 1, 'admin', '', '', 2, 11); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (200, 'home', '', 1, '/admin/system/index.php?leftmenu=system', 'SystemInfo', 0, 'admin', '', '', 2, 1); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (201, 'home', '$leftmenu=="system"', 200, '/admin/system/dolibarr.php', 'Dolibarr', 1, 'admin', '', '', 2, 0); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (202, 'home', '$leftmenu=="system"', 201, '/admin/system/constall.php', 'AllParameters', 2, 'admin', '', '', 2, 0); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (203, 'home', '$leftmenu=="system"', 201, '/about.php', 'About', 2, 'admin', '', '', 2, 1); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (204, 'home', '$leftmenu=="system"', 200, '/admin/system/os.php', 'OS', 1, 'admin', '', '', 2, 1); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (205, 'home', '$leftmenu=="system"', 200, '/admin/system/web.php', 'WebServer', 1, 'admin', '', '', 2, 2); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (206, 'home', '$leftmenu=="system"', 200, '/admin/system/phpinfo.php', 'Php', 1, 'admin', '', '', 2, 3); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (207, 'home', '$leftmenu=="system"', 206, '/admin/system/phpinfo.php?what=conf', 'PhpConf', 2, 'admin', '', '', 2, 0); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (208, 'home', '$leftmenu=="system"', 206, '/admin/system/phpinfo.php?what=env', 'PhpEnv', 2, 'admin', '', '', 2, 1); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (209, 'home', '$leftmenu=="system"', 206, '/admin/system/phpinfo.php?what=modules', 'PhpModules', 2, 'admin', '', '', 2, 2); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (210, 'home', '$leftmenu=="system"', 200, '/admin/system/database.php', 'Database', 1, 'admin', '', '', 2, 4); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (211, 'home', '$leftmenu=="system"', 210, '/admin/system/database-tables.php', 'Tables', 2, 'admin', '', '', 2, 0); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (212, 'home', '$leftmenu=="system"', 210, '/admin/system/database-tables-contraintes.php', 'Constraints', 2, 'admin', '', '', 2, 1); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (300, 'home', '', 1, '/admin/tools/index.php?leftmenu=admintools', 'SystemTools', 0, 'admin', '', '', 2, 2); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (301, 'home', '$leftmenu=="admintools"', 300, '/admin/tools/dolibarr_export.php', 'Backup', 1, 'admin', '', '', 2, 0); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (302, 'home', '$leftmenu=="admintools"', 300, '/admin/tools/dolibarr_import.php', 'Restore', 1, 'admin', '', '', 2, 1); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (303, 'home', '$leftmenu=="admintools"', 300, '/admin/tools/purge.php', 'Purge', 1, 'admin', '', '', 2, 2); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (304, 'home', '$leftmenu=="admintools"', 300, '/admin/tools/eaccelerator.php', 'EAccelerator', 1, 'admin', '', '', 2, 3); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (400, 'home', '', 1, '/user/home.php?leftmenu=users', 'MenuUsersAndGroups', 0, 'users', '', '', 2, 3); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (401, 'home', '$leftmenu=="users"', 400, '/user/index.php', 'Users', 1, 'users', '$user->rights->user->user->lire || $user->admin', '', 2, 0); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (402, 'home', '$leftmenu=="users"', 401, '/user/fiche.php?action=create', 'NewUser', 2, 'users', '$user->rights->user->user->creer || $user->admin', '', 2, 0); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (403, 'home', '$leftmenu=="users"', 400, '/user/group/index.php', 'Groups', 1, 'users', '$user->rights->user->user->lire || $user->admin', '', 2, 1); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (404, 'home', '$leftmenu=="users"', 403, '/user/group/fiche.php?action=create', 'NewGroup', 2, 'users', '$user->rights->user->user->creer || $user->admin', '', 2, 0); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (500, 'companies', '', 2, '/societe.php', 'ThirdParty', 0, 'companies', '$user->rights->societe->lire', '', 2, 0); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (501, 'companies', '', 500, '/soc.php?action=create', 'MenuNewThirdParty', 1, 'companies', '$user->rights->societe->lire', '', 2, 0); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (502, 'companies', '', 500, '/societe/groupe/index.php', 'MenuSocGroup', 1, 'companies', '$user->rights->societe->lire', '', 2, 1); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (503, 'companies', '', 500, '/fourn/liste.php?leftmenu=suppliers', 'Suppliers', 1, 'suppliers', '$user->rights->societe->lire && $user->rights->fournisseur->lire', '', 2, 2); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (504, 'companies', '', 503, '/soc.php?leftmenu=supplier&action=create&type=f', 'NewSupplier', 2, 'suppliers', '$user->rights->societe->lire', '', 2, 0); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (505, 'companies', '', 503, '/contact/index.php?leftmenu=suppliers&type=f', 'Contacts', 2, 'suppliers', '$user->rights->societe->lire && $user->rights->fournisseur->lire', '', 2, 1); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (506, 'companies', '', 500, '/comm/prospect/prospects.php?leftmenu=prospects', 'Prospects', 1, 'companies', '$user->rights->societe->lire', '', 2, 3); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (507, 'companies', '', 506, '/soc.php?leftmenu=prospects&action=create&type=p', 'MenuNewProspect', 2, 'companies', '$user->rights->societe->creer', '', 2, 0); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (508, 'companies', '', 506, '/contact/index.php?leftmenu=customers&type=p', 'Contacts', 2, 'companies', '$user->rights->societe->lire', '', 2, 1); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (509, 'companies', '', 500, '/comm/clients.php?leftmenu=customers', 'Customers', 1, 'companies', '$user->rights->societe->lire', '', 2, 4); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (510, 'companies', '', 509, '/soc.php?leftmenu=customers&action=create&type=c', 'MenuNewCustomer', 2, 'companies', '$user->rights->societe->creer', '', 2, 0); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (511, 'companies', '', 509, '/contact/index.php?leftmenu=customers&type=c', 'Contacts', 2, 'companies', '$user->rights->societe->lire', '', 2, 1); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (600, 'companies', '', 2, '/contact/index.php?leftmenu=contacts', 'Contacts', 0, 'companies', '$user->rights->societe->lire', '', 2, 1); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (601, 'companies', '', 600, '/contact/fiche.php?leftmenu=contacts&action=create', 'NewContact', 1, 'companies', '$user->rights->societe->creer', '', 2, 0); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (602, 'companies', '', 600, '/contact/index.php?leftmenu=contacts', 'List', 1, 'companies', '$user->rights->societe->lire', '', 2, 1); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (700, 'commercial', '', 5, '/comm/prospect/index.php?leftmenu=prospects', 'Prospects', 0, 'companies', '$user->rights->societe->lire', '', 0, 0); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (701, 'commercial', '', 700, '/soc.php?leftmenu=prospects&action=create&type=c', 'MenuNewProspect', 1, 'companies', '$user->rights->societe->creer', '', 0, 0); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (702, 'commercial', '', 700, '/contact/index.php?leftmenu=prospects&type=p', 'List', 1, 'companies', '$user->rights->societe->lire', '', 0, 1); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (703, 'commercial', '$leftmenu=="prospects"', 702, '/comm/prospect/prospects.php?sortfield=s.datec&sortorder=desc&begin=&stcomm=-1', 'LastProspectDoNotContact', 2, 'companies', '$user->rights->societe->lire', '', 0, 0); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (704, 'commercial', '$leftmenu=="prospects"', 702, '/comm/prospect/prospects.php?sortfield=s.datec&sortorder=desc&begin=&stcomm=0', 'LastProspectNeverContacted', 2, 'companies', '$user->rights->societe->lire', '', 0, 1); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (705, 'commercial', '$leftmenu=="prospects"', 702, '/comm/prospect/prospects.php?sortfield=s.datec&sortorder=desc&begin=&stcomm=1', 'LastProspectToContact', 2, 'companies', '$user->rights->societe->lire', '', 0, 2); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (706, 'commercial', '$leftmenu=="prospects"', 702, '/comm/prospect/prospects.php?sortfield=s.datec&sortorder=desc&begin=&stcomm=2', 'LastProspectContactInProcess', 2, 'companies', '$user->rights->societe->lire', '', 0, 3); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (707, 'commercial', '$leftmenu=="prospects"', 702, '/comm/prospect/prospects.php?sortfield=s.datec&sortorder=desc&begin=&stcomm=3', 'LastProspectContactDone', 2, 'companies', '$user->rights->societe->lire', '', 0, 4); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (708, 'commercial', '', 700, '/contact/index.php?leftmenu=prospects&type=p', 'Contacts', 1, 'companies', '$user->rights->societe->lire', '', 0, 2); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (800, 'commercial', '', 5, '/comm/index.php?leftmenu=customers', 'Customers', 0, 'companies', '$user->rights->societe->lire', '', 0, 1); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (801, 'commercial', '', 800, '/soc.php?leftmenu=customers&action=create&type=c', 'MenuNewCustomer', 1, 'companies', '$user->rights->societe->creer', '', 0, 0); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (802, 'commercial', '', 800, '/comm/clients.php?leftmenu=customers', 'List', 1, 'companies', '$user->rights->societe->lire', '', 0, 1); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (803, 'commercial', '', 800, '/contact/index.php?leftmenu=customers&type=c', 'Contacts', 1, 'companies', '$user->rights->societe->lire', '', 0, 2); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (900, 'commercial', '', 5, '/contact/index.php?leftmenu=contacts', 'Contacts', 0, 'companies', '$user->rights->societe->lire', '', 0, 2); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (901, 'commercial', '', 900, '/contact/fiche.php?leftmenu=contacts&action=create', 'NewContact', 1, 'companies', '$user->rights->societe->creer', '', 0, 0); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (902, 'commercial', '', 900, '/contact/index.php?leftmenu=contacts&action=create', 'List', 1, 'companies', '$user->rights->societe->lire', '', 0, 1); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (1000, 'commercial', '', 5, '/comm/action/index.php?leftmenu=actions', 'Actions', 0, 'companies', '$user->rights->societe->lire', '', 0, 3); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (1001, 'commercial', '$leftmenu=="actions"', 1000, '/societe.php?leftmenu=actions', 'NewAction', 1, 'companies', '$user->rights->societe->lire', '', 0, 0); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (1002, 'commercial', '$leftmenu=="actions"', 1000, '/comm/action/index.php?leftmenu=actions&status=todo', 'MenuToDoActions', 1, 'companies', '$user->rights->societe->lire', '', 0, 1); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (1003, 'commercial', '$leftmenu=="actions"', 1000, '/comm/action/index.php?leftmenu=actions&time=today', 'Today', 1, 'companies', '$user->rights->societe->lire', '', 0, 2); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (1004, 'commercial', '$leftmenu=="actions"', 1000, '/comm/action/rapport/index.php?leftmenu=actions', 'Reportings', 1, 'companies', '$user->rights->societe->lire', '', 0, 3); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (1100, 'commercial', '', 5, '/comm/propal.php?leftmenu=propals', 'Prop', 0, 'propal', '$user->rights->propale->lire', '', 2, 4); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (1101, 'commercial', '$leftmenu=="propals"', 1100, '/societe.php?leftmenu=propals', 'NewPropal', 1, 'propal', '$user->rights->propale->creer', '', 2, 0); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (1102, 'commercial', '$leftmenu=="propals"', 1100, '/comm/propal.php?viewstatut=0', 'PropalsDraft', 1, 'propal', '$user->rights->propale->lire', '', 2, 1); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (1103, 'commercial', '$leftmenu=="propals"', 1100, '/comm/propal.php?viewstatut=1', 'PropalsOpened', 1, 'propal', '$user->rights->propale->lire', '', 2, 2); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (1104, 'commercial', '$leftmenu=="propals"', 1100, '/comm/propal.php?viewstatut=2,3,4', 'PropalStatusClosedShort', 1, 'propal', '$user->rights->propale->lire', '', 2, 3); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (1105, 'commercial', '$leftmenu=="propals"', 1100, '/comm/propal/stats/index.php?leftmenu=propals', 'Statistics', 1, 'propal', '$user->rights->propale->lire', '', 2, 4); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (1200, 'commercial', '', 5, '/commande/index.php?leftmenu=orders', 'Orders', 0, 'orders', '$user->rights->commande->lire', '', 2, 5); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (1201, 'commercial', '$leftmenu=="orders"', 1200, '/societe.php?leftmenu=orders', 'NewOrder', 1, 'orders', '$user->rights->commande->creer', '', 2, 0); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (1202, 'commercial', '$leftmenu=="orders"', 1200, '/commande/liste.php?leftmenu=orders&viewstatut=0', 'StatusOrderDraftShort', 1, 'orders', '$user->rights->commande->lire', '', 2, 1); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (1203, 'commercial', '$leftmenu=="orders"', 1200, '/commande/liste.php?leftmenu=orders&viewstatut=1', 'StatusOrderValidated', 1, 'orders', '$user->rights->commande->lire', '', 2, 2); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (1204, 'commercial', '$leftmenu=="orders"', 1200, '/commande/liste.php?leftmenu=orders&viewstatut=2', 'StatusOrderOnProcessShort', 1, 'orders', '$user->rights->commande->lire', '', 2, 3); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (1205, 'commercial', '$leftmenu=="orders"', 1200, '/commande/liste.php?leftmenu=orders&viewstatut=3', 'StatusOrderToBill', 1, 'orders', '$user->rights->commande->lire', '', 2, 4); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (1206, 'commercial', '$leftmenu=="orders"', 1200, '/commande/liste.php?leftmenu=orders&viewstatut=4', 'StatusOrderProcessed', 1, 'orders', '$user->rights->commande->lire', '', 2, 5); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (1207, 'commercial', '$leftmenu=="orders"', 1200, '/commande/liste.php?leftmenu=orders&viewstatut=-1', 'StatusOrderCanceledShort', 1, 'orders', '$user->rights->commande->lire', '', 2, 6); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (1208, 'commercial', '$leftmenu=="orders"', 1200, '/commande/stats/index.php?leftmenu=orders', 'Statistics', 1, 'orders', '$user->rights->commande->lire', '', 2, 7); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (1300, 'commercial', '', 5, '/expedition/index.php?leftmenu=sendings', 'Sendings', 0, 'orders', '$user->rights->expedition->lire', '', 2, 6); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (1301, 'commercial', '$leftmenu=="sendings"', 1300, '/expedition/liste.php?leftmenu=sendings', 'List', 1, 'orders', '$user->rights->expedition->lire', '', 2, 0); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (1302, 'commercial', '$leftmenu=="sendings"', 1300, '/expedition/stats/index.php?leftmenu=sendings', 'Statistics', 1, 'orders', '$user->rights->expedition->lire', '', 2, 1); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (1400, 'commercial', '', 5, '/contrat/index.php?leftmenu=contracts', 'Contracts', 0, 'contracts', '$user->rights->contrat->lire', '', 2, 7); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (1401, 'commercial', '$leftmenu=="contracts"', 1400, '/societe.php?leftmenu=contracts', 'NewContract', 1, 'contracts', '$user->rights->contrat->creer', '', 2, 0); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (1402, 'commercial', '$leftmenu=="contracts"', 1400, '/contrat/liste.php?leftmenu=contracts', 'List', 1, 'contracts', '$user->rights->contrat->lire', '', 2, 1); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (1403, 'commercial', '$leftmenu=="contracts"', 1400, '/contrat/services.php?leftmenu=contracts', 'MenuServices', 1, 'contracts', '$user->rights->contrat->lire', '', 2, 2); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (1404, 'commercial', '$leftmenu=="contracts"', 1402, '/contrat/services.php?leftmenu=contracts&mode=0', 'MenuInactiveServices', 2, 'contracts', '$user->rights->contrat->lire', '', 2, 0); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (1405, 'commercial', '$leftmenu=="contracts"', 1402, '/contrat/services.php?leftmenu=contracts&mode=4', 'MenuRunningServices', 2, 'contracts', '$user->rights->contrat->lire', '', 2, 1); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (1406, 'commercial', '$leftmenu=="contracts"', 1402, '/contrat/services.php?leftmenu=contracts&mode=4&filter=expired', 'MenuExpiredServices', 2, 'contracts', '$user->rights->contrat->lire', '', 2, 2); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (1407, 'commercial', '$leftmenu=="contracts"', 1402, '/contrat/services.php?leftmenu=contracts&mode=5', 'MenuClosedServices', 2, 'contracts', '$user->rights->contrat->lire', '', 2, 3); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (1500, 'commercial', '', 5, '/fichinter/index.php?leftmenu=ficheinter', 'Interventions', 0, 'interventions', '$user->rights->ficheinter->lire', '', 2, 8); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (1501, 'commercial', '$leftmenu=="ficheinter"', 1500, '/fichinter/fiche.php?action=create&leftmenu=ficheinter', 'NewIntervention', 1, 'interventions', '$user->rights->ficheinter->creer', '', 2, 0); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (1502, 'commercial', '$leftmenu=="ficheinter"', 1500, '/fichinter/index.php?leftmenu=ficheinter', 'List', 1, 'interventions', '$user->rights->ficheinter->lire', '', 2, 1); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (1600, 'accountancy', '', 6, '/compta/index.php?leftmenu=suppliers', 'Suppliers', 0, 'companies', '$user->rights->societe->lire && $user->rights->fournisseur->lire', '', 2, 0); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (1601, 'accountancy', '', 1600, '/soc.php?leftmenu=suppliers&action=create&type=f', 'NewSupplier', 1, 'companies', '$user->rights->societe->creer && $user->rights->fournisseur->lire', '', 2, 0); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (1602, 'accountancy', '', 1600, '/fourn/liste.php?leftmenu=suppliers', 'List', 1, 'companies', '$user->rights->societe->lire && $user->rights->fournisseur->lire', '', 2, 1); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (1603, 'accountancy', '', 1600, '/contact/index.php?leftmenu=suppliers&type=f', 'Contacts', 1, 'companies', '$user->rights->societe->lire && $user->rights->fournisseur->lire', '', 2, 2); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (1604, 'accountancy', '', 1600, '/fourn/facture/index.php?leftmenu=suppliers_bills', 'BillsSuppliers', 1, 'bills', '$user->rights->fournisseur->facture->lire', '', 2, 3); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (1605, 'accountancy', '$leftmenu=="suppliers_bills"', 1604, '/fourn/facture/fiche.php?action=create', 'NewBill', 2, 'bills', '$user->rights->fournisseur->facture->creer', '', 2, 0); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (1606, 'accountancy', '$leftmenu=="suppliers_bills"', 1604, '/fourn/facture/impayees.php', 'Unpaid', 2, 'bills', '$user->rights->fournisseur->facture->lire', '', 2, 1); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (1607, 'accountancy', '$leftmenu=="suppliers_bills"', 1604, '/fourn/facture/paiement.php', 'Payments', 2, 'bills', '$user->rights->fournisseur->facture->lire', '', 2, 2); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (1700, 'accountancy', '', 6, '/compta/index.php?leftmenu=customers', 'Customers', 0, 'companies', '$user->rights->societe->lire', '', 2, 1); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (1701, 'accountancy', '', 1700, '/soc.php?leftmenu=customers&action=create&type=c', 'MenuNewCustomer', 1, 'companies', '$user->rights->societe->creer', '', 2, 0); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (1702, 'accountancy', '', 1700, '/compta/clients.php?leftmenu=customers', 'List', 1, 'companies', '$user->rights->societe->lire', '', 2, 1); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (1703, 'accountancy', '', 1700, '/contact/index.php?leftmenu=customers&type=c', 'Contacts', 1, 'companies', '$user->rights->societe->lire && $user->rights->fournisseur->lire', '', 2, 2); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (1704, 'accountancy', '', 1700, '/compta/facture/list.php?leftmenu=customers_bills', 'BillsCustomers', 1, 'bills', '$user->rights->facture->lire', '', 2, 3); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (1705, 'accountancy', 'preg_match("/customers_bills/i",$leftmenu)', 1704, '/compta/clients.php?action=facturer&leftmenu=customers_bills', 'NewBill', 2, 'bills', '$user->rights->facture->creer', '', 2, 3); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (1706, 'accountancy', 'preg_match("/customers_bills/i",$leftmenu)', 1704, '/compta/facture/fiche-rec.php?leftmenu=customers_bills', 'Repeatable', 2, 'bills', '$user->rights->facture->lire', '', 2, 4); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (1707, 'accountancy', 'preg_match("/customers_bills/i",$leftmenu)', 1704, '/compta/facture/impayees.php?action=facturer&leftmenu=customers_bills', 'Unpaid', 2, 'bills', '$user->rights->facture->lire', '', 2, 5); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (1708, 'accountancy', 'preg_match("/customers_bills/i",$leftmenu)', 1704, '/compta/paiement/liste.php?leftmenu=customers_bills_payments', 'Payments', 2, 'bills', '$user->rights->facture->lire', '', 2, 6); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (1709, 'accountancy', 'preg_match("/customers_bills_payments/i",$leftmenu)', 1708, '/compta/paiement/avalider.php?leftmenu=customers_bills_payments', 'MenuToValid', 3, 'bills', '$user->rights->facture->lire', '', 2, 0); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (1710, 'accountancy', 'preg_match("/customers_bills_payments/i",$leftmenu)', 1708, '/compta/paiement/rapport.php?leftmenu=customers_bills_payments', 'Reportings', 3, 'bills', '$user->rights->facture->lire', '', 2, 1); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (1711, 'accountancy', '', 6, '/compta/paiement/cheque/index.php?leftmenu=checks', 'MenuChequeDeposits', 0, 'bills', '$user->rights->facture->lire', '', 2, 1); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (1712, 'accountancy', 'preg_match("/checks/i",$leftmenu)', 1711, '/compta/paiement/cheque/fiche.php?leftmenu=checks&action=new', 'NewCheckDeposit', 1, 'bills', '$user->rights->facture->lire', '', 2, 0); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (1713, 'accountancy', 'preg_match("/checks/i",$leftmenu)', 1711, '/compta/paiement/cheque/liste.php?leftmenu=checks', 'MenuChequesReceipts', 1, 'bills', '$user->rights->facture->lire', '', 2, 1); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (1714, 'accountancy', 'preg_match("/customers_bills/i",$leftmenu)', 1704, '/compta/facture/stats/index.php?leftmenu=customers_bills', 'Statistics', 2, 'bills', '$user->rights->facture->lire', '', 2, 8); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (1715, 'accountancy', '', 1700, '/compta/paiement/cheque/index.php', 'CheckReceipt', 1, 'bills', '$user->rights->facture->lire', '', 1, 4); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (1716, 'accountancy', '', 1704, '/compta/paiement/cheque/fiche.php?action=new', 'New', 2, 'bills', '$user->rights->facture->lire', '', 1, 9); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (1717, 'accountancy', '', 1704, '/compta/paiement/cheque/liste.php', 'List', 2, 'bills', '$user->rights->facture->lire', '', 1, 10); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (1800, 'accountancy', '', 6, '/compta/propal.php', 'Prop', 0, 'propal', '$user->rights->propale->lire', '', 2, 2); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (1900, 'accountancy', '', 6, '/compta/commande/liste.php?leftmenu=orders&status=3&afacturer=1', 'MenuOrdersToBill', 0, 'orders', '$user->rights->commande->lire', '', 0, 3); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (2000, 'accountancy', '', 6, '/compta/dons/index.php?leftmenu=donations&mainmenu=accountancy', 'Donations', 0, 'donations', '$user->rights->don->lire', '', 2, 4); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (2001, 'accountancy', '$leftmenu=="donations"', 2000, '/compta/dons/fiche.php?action=create', 'NewDonation', 1, 'donations', '$user->rights->don->creer', '', 2, 0); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (2002, 'accountancy', '$leftmenu=="donations"', 2000, '/compta/dons/liste.php?action=create', 'List', 1, 'donations', '$user->rights->don->lire', '', 2, 1); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (2003, 'accountancy', '$leftmenu=="donations"', 2000, '/compta/dons/stats.php', 'Statistics', 1, 'donations', '$user->rights->don->lire', '', 2, 2); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (2100, 'accountancy', '', 6, '/compta/deplacement/index.php', 'Trips', 0, 'trips', '$user->rights->deplacement->lire', '', 0, 5); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (2200, 'accountancy', '', 6, '/compta/charges/index.php?leftmenu=charges&mainmenu=accountancy', 'Charges', 0, 'Charges', '$user->rights->tax->charges->lire', '', 0, 6); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (2201, 'accountancy', '$leftmenu=="charges"', 2200, '/compta/sociales/index.php', 'SocialContributions', 1, '', '$user->rights->tax->charges->lire', '', 0, 0); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (2300, 'accountancy', '', 6, '/compta/tva/index.php?leftmenu=vat&mainmenu=accountancy', 'VAT', 0, 'companies', '$user->rights->tax->charges->lire', '', 0, 7); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (2301, 'accountancy', '$leftmenu=="vat"', 2300, '/compta/tva/fiche.php?action=create', 'NewPayment', 1, 'companies', '$user->rights->tax->charges->creer', '', 0, 0); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (2302, 'accountancy', '$leftmenu=="vat"', 2300, '/compta/tva/reglement.php', 'Payments', 1, 'companies', '$user->rights->tax->charges->lire', '', 0, 1); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (2303, 'accountancy', '$leftmenu=="vat"', 2300, '/compta/tva/clients.php', 'ReportByCustomers', 1, 'companies', '$user->rights->tax->charges->lire', '', 0, 2); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (2400, 'accountancy', '', 6, '/compta/ventilation/index.php?leftmenu=ventil', 'Ventilation', 0, 'companies', '$user->rights->compta->ventilation->lire', '', 0, 8); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (2401, 'accountancy', '$leftmenu=="ventil"', 2400, '/compta/ventilation/liste.php', 'A ventiler', 1, 'companies', '$user->rights->compta->ventilation->lire', '', 0, 0); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (2402, 'accountancy', '$leftmenu=="ventil"', 2400, '/compta/ventilation/lignes.php', 'Ventil�es', 1, 'companies', '$user->rights->compta->ventilation->lire', '', 0, 1); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (2403, 'accountancy', '$leftmenu=="ventil"', 2400, '/compta/param/', 'Setup', 1, 'companies', '$user->rights->compta->ventilation->parametrer', '', 0, 2); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (2404, 'accountancy', '$leftmenu=="ventil"', 2403, '/compta/param/comptes/liste.php', 'List', 2, 'companies', '$user->rights->compta->ventilation->parametrer', '', 0, 0); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (2405, 'accountancy', '$leftmenu=="ventil"', 2403, '/compta/param/comptes/fiche.php?action=create', 'New', 2, 'companies', '$user->rights->compta->ventilation->parametrer', '', 0, 1); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (2406, 'accountancy', '$leftmenu=="ventil"', 2400, '/compta/export/', 'Export', 1, 'companies', '$user->rights->compta->ventilation->lire', '', 0, 3); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (2407, 'accountancy', '$leftmenu=="ventil"', 2406, '/compta/export/index.php', 'New', 2, 'companies', '$user->rights->compta->ventilation->lire', '', 0, 0); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (2408, 'accountancy', '$leftmenu=="ventil"', 2406, '/compta/export/liste.php', 'List', 2, 'companies', '$user->rights->compta->ventilation->lire', '', 0, 1); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (2500, 'accountancy', '', 6, '/compta/prelevement/index.php?leftmenu=withdraw', 'StandingOrders', 0, 'withdrawals', '$user->rights->prelevement->bons->lire', '', 2, 9); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (2501, 'accountancy', '$leftmenu=="withdraw"', 2500, '/compta/prelevement/demandes.php?status=0', 'StandingOrderToProcess', 1, 'withdrawals', '$user->rights->prelevement->bons->lire', '', 2, 0); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (2502, 'accountancy', '$leftmenu=="withdraw"', 2500, '/compta/prelevement/create.php', 'NewStandingOrder', 1, 'withdrawals', '$user->rights->prelevement->bons->lire', '', 2, 1); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (2503, 'accountancy', '$leftmenu=="withdraw"', 2500, '/compta/prelevement/bons.php', 'WithdrawalsReceipts', 1, 'withdrawals', '$user->rights->prelevement->bons->lire', '', 2, 2); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (2504, 'accountancy', '$leftmenu=="withdraw"', 2500, '/compta/prelevement/liste.php', 'WithdrawalsLines', 1, 'withdrawals', '$user->rights->prelevement->bons->lire', '', 2, 3); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (2505, 'accountancy', '$leftmenu=="withdraw"', 2500, '/compta/prelevement/liste_factures.php', 'WithdrawedBills', 1, 'withdrawals', '$user->rights->prelevement->bons->lire', '', 2, 4); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (2506, 'accountancy', '$leftmenu=="withdraw"', 2500, '/compta/prelevement/rejets.php', 'Rejects', 1, 'withdrawals', '$user->rights->prelevement->bons->lire', '', 2, 5); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (2507, 'accountancy', '$leftmenu=="withdraw"', 2500, '/compta/prelevement/stats.php', 'Statistics', 1, 'withdrawals', '$user->rights->prelevement->bons->lire', '', 2, 6); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (2508, 'accountancy', '$leftmenu=="withdraw"', 2500, '/compta/prelevement/config.php', 'Setup', 1, 'withdrawals', '$user->rights->prelevement->bons->configurer', '', 2, 7); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (2600, 'accountancy', '', 6, '/compta/bank/index.php?leftmenu=bank', 'MenuBankCash', 0, 'banks', '$user->rights->banque->lire', '', 0, 10); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (2601, 'accountancy', '$leftmenu=="bank"', 2600, '/compta/bank/fiche.php?action=create', 'MenuNewFinancialAccount', 1, 'banks', '$user->rights->banque->configurer', '', 0, 0); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (2602, 'accountancy', '$leftmenu=="bank"', 2600, '/compta/bank/categ.php', 'Categories', 1, 'banks', '$user->rights->banque->configurer', '', 0, 1); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (2603, 'accountancy', '$leftmenu=="bank"', 2600, '/compta/bank/search.php', 'SearchTransaction', 1, 'banks', '$user->rights->banque->lire', '', 0, 2); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (2604, 'accountancy', '$leftmenu=="bank"', 2600, '/compta/bank/budget.php', 'ByRubriques', 1, 'banks', '$user->rights->banque->lire', '', 0, 3); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (2605, 'accountancy', '$leftmenu=="bank"', 2600, '/compta/bank/bilan.php', 'Bilan', 1, 'banks', '$user->rights->banque->lire', '', 0, 4); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (2606, 'accountancy', '$leftmenu=="bank"', 2600, '/compta/bank/virement.php', 'BankTransfers', 1, 'banks', '$user->rights->banque->modifier', '', 0, 5); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (2607, 'accountancy', '$leftmenu=="bank"', 2600, '/compta/bank/bplc.php', 'Transactions BPLC', 1, 'banks', '', '', 0, 6); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (2700, 'accountancy', '', 6, '/compta/resultat/index.php?leftmenu=ca&mainmenu=accountancy', 'Reportings', 0, 'main', '$user->rights->compta->resultat->lire || $user->rights->comptaexpert->comptarapport->lire', '', 0, 11); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (2701, 'accountancy', '$leftmenu=="ca"', 2700, '/compta/resultat/index.php?leftmenu=ca', 'R�sultat / Exercice', 1, 'main', '$user->rights->compta->resultat->lire || $user->rights->comptaexpert->comptarapport->lire', '', 0, 0); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (2702, 'accountancy', '$leftmenu=="ca"', 2701, '/compta/resultat/clientfourn.php?leftmenu=ca', 'ByCompanies', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->comptaexpert->comptarapport->lire', '', 0, 0); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (2703, 'accountancy', '$leftmenu=="ca"', 2700, '/compta/stats/index.php?leftmenu=ca', 'Chiffre d''affaire', 1, 'main', '$user->rights->compta->resultat->lire || $user->rights->comptaexpert->comptarapport->lire', '', 0, 1); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (2704, 'accountancy', '$leftmenu=="ca"', 2703, '/compta/stats/casoc?leftmenu=ca', 'ByCompanies', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->comptaexpert->comptarapport->lire', '', 0, 0); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (2705, 'accountancy', '$leftmenu=="ca"', 2703, '/compta/stats/cabyuser.php?leftmenu=ca', 'ByUsers', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->comptaexpert->comptarapport->lire', '', 0, 1); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (2800, 'products', '', 3, '/product/index.php?leftmenu=product&type=0', 'Products', 0, 'products', '$user->rights->produit->lire', '', 2, 0); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (2801, 'products', '', 2800, '/product/fiche.php?leftmenu=product&action=create&type=0', 'NewProduct', 1, 'products', '$user->rights->produit->creer', '', 2, 0); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (2802, 'products', '', 2800, '/product/liste.php?leftmenu=product&type=0', 'List', 1, 'products', '$user->rights->produit->lire', '', 2, 1); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (2803, 'products', '', 2800, '/product/reassort.php?type=0', 'Stocks', 1, 'products', '$user->rights->stock->lire', '', 2, 4); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (2804, 'products', '', 2800, '/product/fiche.php?leftmenu=product&action=create&type=0&canvas=livre', 'Nouveau livre', 1, 'products', '$user->rights->produit->creer', '', 2, 2); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (2805, 'products', '', 2800, '/product/liste.php?leftmenu=product&type=0&canvas=livre', 'Livre', 1, 'products', '$user->rights->produit->lire', '', 2, 3); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (2900, 'products', '', 3, '/product/index.php?leftmenu=service&type=1', 'Services', 0, 'products', '$user->rights->produit->lire', '', 2, 1); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (2901, 'products', '', 2900, '/product/fiche.php?leftmenu=service&action=create&type=1', 'NewService', 1, 'products', '$user->rights->produit->creer', '', 2, 0); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (2902, 'products', '', 2900, '/product/liste.php?leftmenu=service&type=1', 'List', 1, 'products', '$user->rights->produit->lire', '', 2, 1); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (3000, 'products', '', 3, '/product/stats/index.php?leftmenu=stats', 'Statistics', 0, 'main', '$user->rights->produit>lire', '', 2, 2); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (3001, 'products', '', 3000, '/product/popuprop.php?leftmenu=stats', 'Popularity', 1, 'main', '$user->rights->produit>lire', '', 2, 0); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (3100, 'products', '', 3, '/product/stock/index.php?leftmenu=stock', 'Stock', 0, 'stocks', '$user->rights->stock->lire', '', 2, 3); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (3101, 'products', '$leftmenu=="stock"', 3100, '/product/stock/fiche.php?action=create', 'MenuNewWarehouse', 1, 'stocks', '$user->rights->stock->creer', '', 2, 0); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (3102, 'products', '$leftmenu=="stock"', 3100, '/product/stock/liste.php', 'List', 1, 'stocks', '$user->rights->stock->lire', '', 2, 1); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (3103, 'products', '$leftmenu=="stock"', 3100, '/product/stock/valo.php', 'EnhancedValue', 1, 'stocks', '$user->rights->stock->lire', '', 2, 2); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (3104, 'products', '$leftmenu=="stock"', 3100, '/product/stock/mouvement.php', 'Movements', 1, 'stocks', '$user->rights->stock->mouvement->lire', '', 2, 3); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (3200, 'products', '', 3, '/categories/index.php?leftmenu=cat&type=0', 'Categories', 0, 'categories', '$user->rights->categorie>lire', '', 2, 4); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (3201, 'products', '$leftmenu=="cat"', 3200, '/categories/fiche.php?action=create&type=0', 'NewCat', 1, 'categories', '$user->rights->categorie>creer', '', 2, 0); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (3300, 'suppliers', '', 4, '/fourn/index.php?leftmenu=suppliers', 'Suppliers', 0, 'suppliers', '$user->rights->societe->lire && $user->rights->fournisseur->lire', '', 2, 0); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (3301, 'suppliers', '', 3300, '/soc.php?leftmenu=suppliers&action=create&type=f', 'NewSupplier', 1, 'suppliers', '$user->rights->societe->creer && $user->rights->fournisseur->lire', '', 2, 0); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (3302, 'suppliers', '', 3300, '/fourn/liste.php', 'List', 1, 'suppliers', '$user->rights->societe->lire && $user->rights->fournisseur->lire', '', 2, 1); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (3303, 'suppliers', '', 3300, '/contact/index.php?leftmenu=supplier&type=f', 'Contacts', 1, 'suppliers', '$user->rights->societe->lire && $user->rights->fournisseur->lire', '', 2, 2); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (3304, 'suppliers', '', 3300, '/fourn/stats.php', 'Statistics', 1, 'suppliers', '$user->rights->societe->lire && $user->rights->fournisseur->lire', '', 2, 3); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (3400, 'suppliers', '', 4, '/fourn/facture/index.php', 'Bills', 0, 'bills', '$user->rights->fournisseur->facture->lire', '', 2, 1); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (3401, 'suppliers', '', 3400, '/fourn/facture/fiche.php?action=create', 'NewBill', 1, 'bills', '$user->rights->fournisseur->facture->creer', '', 2, 0); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (3402, 'suppliers', '', 3400, '/fourn/facture/paiement.php', 'Payments', 1, 'bills', '$user->rights->fournisseur->facture->lire', '', 2, 1); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (3500, 'suppliers', '', 4, '/fourn/commande/index.php?leftmenu=suppliers', 'Orders', 0, 'orders', '$user->rights->fournisseur->commande->lire', '', 2, 2); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (3501, 'suppliers', '', 3500, '/societe.php?leftmenu=supplier', 'NewOrder', 1, 'orders', '$user->rights->fournisseur->commande->creer', '', 2, 0); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (3502, 'suppliers', '', 3500, '/fourn/commande/liste.php?leftmenu=suppliers', 'List', 1, 'orders', '$user->rights->fournisseur->commande->lire', '', 2, 1); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (3600, 'project', '', 7, '/projet/index.php?leftmenu=projects', 'Projects', 0, 'projects', '$user->rights->projet->lire', '', 2, 0); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (3601, 'project', '', 3600, '/comm/clients.php?leftmenu=projects', 'NewProject', 1, 'projects', '$user->rights->projet->lire', '', 2, 0); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (3602, 'project', '', 3600, '/projet/liste.php?leftmenu=projects', 'List', 1, 'projects', '$user->rights->projet->lire', '', 2, 1); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (3700, 'project', '', 7, '/projet/tasks', 'Tasks', 0, 'projects', '$user->rights->projet->lire', '', 2, 1); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (3701, 'project', '', 3700, '/projet/tasks/mytasks.php', 'MyTasks', 1, 'projects', '$user->rights->projet->lire', '', 2, 0); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (3800, 'project', '', 7, '/projet/activity', 'Activity', 0, 'projects', '$user->rights->projet->lire', '', 2, 2); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (3801, 'project', '', 3800, '/projet/activity/myactivity.php', 'MyActivity', 1, 'projects', '$user->rights->projet->lire', '', 2, 0); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (3900, 'tools', '', 8, '/comm/mailing/index.php?leftmenu=mailing', 'EMailings', 0, 'mails', '$user->rights->mailing->lire', '', 0, 0); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (3901, 'tools', '', 3900, '/comm/mailing/fiche.php?leftmenu=mailing&action=create', 'NewMailing', 1, 'mails', '$user->rights->mailing->creer', '', 0, 0); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (3902, 'tools', '', 3900, '/comm/mailing/liste.php?leftmenu=mailing', 'List', 1, 'mails', '$user->rights->mailing->lire', '', 0, 1); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (4000, 'tools', '', 8, '/bookmarks/liste.php?leftmenu=bookmarks', 'Bookmarks', 0, 'other', '$user->rights->bookmark->lire', '', 2, 1); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (4001, 'tools', '', 4000, '/bookmarks/fiche.php?action=create', 'NewBookmark', 1, 'other', '$user->rights->bookmark->creer', '', 2, 0); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (4002, 'tools', '', 4000, '/bookmarks/liste.php', 'List', 1, 'other', '$user->rights->bookmark->lire', '', 2, 1); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (4100, 'tools', '', 8, '/exports/index.php?leftmenu=export', 'FormatedExport', 0, 'exports', '$user->rights->export->lire', '', 2, 2); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (4101, 'tools', '', 4100, '/exports/export.php?leftmenu=export', 'NewExport', 1, 'exports', '$user->rights->export->creer', '', 2, 0); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (4130, 'tools', '', 8, '/admin/import/index.php?leftmenu=import', 'FormatedImport', 0, 'imports', '$user->rights->import->lire', '', 2, 2); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (4131, 'tools', '', 4130, '/admin/import/import.php?leftmenu=import', 'NewImport', 1, 'imports', '$user->rights->import->creer', '', 2, 0); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (4200, 'members', '', 15, '/adherents/index.php?leftmenu=members&mainmenu=members', 'Members', 0, 'members', '$user->rights->adherent->lire', '', 2, 0); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (4201, 'members', '', 4200, '/adherents/fiche.php?action=create', 'NewMember', 1, 'members', '$user->rights->adherent->creer', '', 2, 0); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (4202, 'members', '', 4200, '/adherents/liste.php', 'List', 1, 'members', '$user->rights->adherent->lire', '', 2, 1); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (4203, 'members', '', 4200, '/adherents/liste.php?statut=-1', 'MenuMembersToValidate', 1, 'members', '$user->rights->adherent->lire', '', 2, 2); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (4204, 'members', '', 4200, '/adherents/liste.php?statut=1', 'MenuMembersValidated', 1, 'members', '$user->rights->adherent->lire', '', 2, 3); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (4205, 'members', '', 4200, '/adherents/liste.php?statut=1&filter=outofdate', 'MenuMembersNotUpToDate', 1, 'members', '$user->rights->adherent->lire', '', 2, 4); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (4206, 'members', '', 4200, '/adherents/liste.php?statut=1&filter=uptodate', 'MenuMembersUpToDate', 1, 'members', '$user->rights->adherent->lire', '', 2, 5); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (4207, 'members', '', 4200, '/adherents/liste.php?statut=0', 'MenuMembersResiliated', 1, 'members', '$user->rights->adherent->lire', '', 2, 6); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (4300, 'members', '', 15, '/adherents/index.php?leftmenu=accountancy&mainmenu=members', 'Subscriptions', 0, 'compta', '$user->rights->adherent->cotisation->lire', '', 2, 1); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (4301, 'members', '', 4300, '/adherents/liste.php?statut=-1&leftmenu=accountancy&mainmenu=members', 'NewSubscription', 1, 'compta', '$user->rights->adherent->cotisation->creer', '', 2, 0); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (4302, 'members', '', 4300, '/adherents/cotisations.php?leftmenu=accountancy', 'List', 1, 'compta', '$user->rights->adherent->cotisation->lire', '', 2, 1); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (4400, 'members', '', 15, '/compta/bank/index.php?leftmenu=accountancy', 'Bank', 0, 'banks', '$user->rights->adherent->lire', '', 2, 2); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (4500, 'members', '', 15, '/adherents/index.php?leftmenu=export&mainmenu=members', 'Exports', 0, 'members', '$user->rights->adherent->export', '', 2, 3); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (4501, 'members', '$leftmenu=="export"', 4500, '/exports/index.php?leftmenu=export', 'Datas', 1, 'members', '$user->rights->adherent->export', '', 2, 0); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (4502, 'members', '$leftmenu=="export"', 4500, '/adherents/htpasswd.php?leftmenu=export', 'Filehtpasswd', 1, 'members', '$user->rights->adherent->export', '', 2, 1); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (4503, 'members', '$leftmenu=="export"', 4500, '/adherents/cartes/carte.php?leftmenu=export', 'MembersCards', 1, 'members', '$user->rights->adherent->export', '_blank', 2, 2); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (4504, 'members', '$leftmenu=="export"', 4500, '/adherents/cartes/etiquette.php?leftmenu=export', 'Etiquettes d''adh�rents', 1, 'members', '$user->rights->adherent->export', '_blank', 2, 3); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (4600, 'members', '', 15, '/public/adherents/index.php?leftmenu=member_public', 'MemberPublicLinks', 0, 'members', '$user->rights->adherent->export', '', 2, 4); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (4700, 'members', '', 15, '/adherents/index.php?leftmenu=setup&mainmenu=members', 'Setup', 0, 'members', '$user->rights->adherent->configurer', '', 2, 5); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (4701, 'members', '', 4700, '/adherents/type.php?leftmenu=setup', 'MembersTypes', 1, 'members', '$user->rights->adherent->configurer', '', 2, 0); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (4702, 'members', '', 4700, '/adherents/options.php?leftmenu=setup', 'MembersAttributes', 1, 'members', '$user->rights->adherent->configurer', '', 2, 1); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (4800, 'product', '', 3, '/product/droitpret/index.php?leftmenu=droitpret', 'Droit de pr�t', 0, 'products', '$user->rights->droitpret->lire', '', 2, 5); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (4801, 'product', '$leftmenu=="droitpret"', 4800, '/product/droitpret/index.php?leftmenu=droitpret', 'G�n�rer rapport', 1, 'products', '$user->rights->droitpret->creer', '', 2, 1); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (4900, 'suppliers', '', 4, '/categories/index.php?leftmenu=cat&type=1', 'Categories', 0, 'categories', '$user->rights->categorie>lire', '', 2, 3); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (4901, 'suppliers', '$leftmenu=="cat"', 4900, '/categories/fiche.php?action=create&type=1', 'NewCat', 1, 'categories', '$user->rights->categorie>creer', '', 2, 0); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (5000, 'commercial', '', 5, '/categories/index.php?leftmenu=cat&type=2', 'Categories', 0, 'commercial', '$user->rights->categorie>lire', '', 2, 9); -insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (5001, 'commercial', '$leftmenu=="cat"', 5000, '/categories/fiche.php?action=create&type=2', 'NewCat', 1, 'commercial', '$user->rights->categorie>creer', '', 2, 0); -update llx_menu set type='top' where level=-1; - --- --- Contenu de la table `llx_menu_constraint` --- -insert into `llx_menu_constraint` (`rowid`, `action`) values (1, '$user->admin'); -insert into `llx_menu_constraint` (`rowid`, `action`) values (2, '$conf->societe->enabled && $user->rights->societe->lire'); -insert into `llx_menu_constraint` (`rowid`, `action`) values (3, '$user->rights->societe->creer'); -insert into `llx_menu_constraint` (`rowid`, `action`) values (4, 'is_dir("societe/groupe")'); -insert into `llx_menu_constraint` (`rowid`, `action`) values (5, '$conf->societe->enabled && $conf->fournisseur->enabled'); -insert into `llx_menu_constraint` (`rowid`, `action`) values (6, '$user->societe_id == 0'); -insert into `llx_menu_constraint` (`rowid`, `action`) values (7, '$conf->propal->enabled'); -insert into `llx_menu_constraint` (`rowid`, `action`) values (8, '$conf->commande->enabled'); -insert into `llx_menu_constraint` (`rowid`, `action`) values (9, '$conf->expedition->enabled'); -insert into `llx_menu_constraint` (`rowid`, `action`) values (10, '$conf->contrat->enabled'); -insert into `llx_menu_constraint` (`rowid`, `action`) values (11, '$conf->fichinter->enabled'); -insert into `llx_menu_constraint` (`rowid`, `action`) values (12, '$conf->societe->enabled'); -insert into `llx_menu_constraint` (`rowid`, `action`) values (13, '$conf->facture->enabled'); -insert into `llx_menu_constraint` (`rowid`, `action`) values (14, '! $conf->global->FACTURE_DISABLE_RECUR'); -insert into `llx_menu_constraint` (`rowid`, `action`) values (15, '$conf->don->enabled'); -insert into `llx_menu_constraint` (`rowid`, `action`) values (16, '$conf->deplacement->enabled'); -insert into `llx_menu_constraint` (`rowid`, `action`) values (17, '$conf->tax->enabled'); -insert into `llx_menu_constraint` (`rowid`, `action`) values (18, '($conf->compta->enabled || $conf->comptaexpert->enabled) && empty($conf->global->TAX_DISABLE_VAT_MENUS) && $user->societe_id == 0'); -insert into `llx_menu_constraint` (`rowid`, `action`) values (19, '$conf->compta-enabled'); -insert into `llx_menu_constraint` (`rowid`, `action`) values (20, '$conf->prelevement->enabled'); -insert into `llx_menu_constraint` (`rowid`, `action`) values (21, '$conf->banque->enabled'); -insert into `llx_menu_constraint` (`rowid`, `action`) values (22, '$conf->compta->enabled || $conf->comptaexpert->enabled'); -insert into `llx_menu_constraint` (`rowid`, `action`) values (23, '$conf->produit->enabled'); -insert into `llx_menu_constraint` (`rowid`, `action`) values (24, '$conf->stock->enabled'); -insert into `llx_menu_constraint` (`rowid`, `action`) values (25, '$conf->service->enabled'); -insert into `llx_menu_constraint` (`rowid`, `action`) values (26, '$conf->categorie->enabled'); -insert into `llx_menu_constraint` (`rowid`, `action`) values (27, '$conf->projet->enabled'); -insert into `llx_menu_constraint` (`rowid`, `action`) values (28, '$conf->mailing->enabled'); -insert into `llx_menu_constraint` (`rowid`, `action`) values (29, '$conf->bookmark->enabled'); -insert into `llx_menu_constraint` (`rowid`, `action`) values (30, '$conf->export->enabled'); -insert into `llx_menu_constraint` (`rowid`, `action`) values (31, '$conf->adherent->enabled'); -insert into `llx_menu_constraint` (`rowid`, `action`) values (32, '($conf->societe->enabled && $user->rights->societe->lire) || ($conf->fournisseur->enabled && $user->rights->fournisseur->lire)'); -insert into `llx_menu_constraint` (`rowid`, `action`) values (33, '$conf->produit->enabled || $conf->service->enabled'); -insert into `llx_menu_constraint` (`rowid`, `action`) values (34, '$conf->fournisseur->enabled'); -insert into `llx_menu_constraint` (`rowid`, `action`) values (35, '$conf->commercial->enabled'); -insert into `llx_menu_constraint` (`rowid`, `action`) values (36, '$conf->compta->enabled || $conf->comptaexpert->enabled || $conf->banque->enabled\r\n || $conf->commande->enabled || $conf->facture->enabled'); -insert into `llx_menu_constraint` (`rowid`, `action`) values (37, '$conf->mailing->enabled || $conf->export->enabled || $conf->bookmark->enabled'); -insert into `llx_menu_constraint` (`rowid`, `action`) values (38, '$conf->boutique->enabled'); -insert into `llx_menu_constraint` (`rowid`, `action`) values (39, '$conf->oscommerce2->enabled'); -insert into `llx_menu_constraint` (`rowid`, `action`) values (40, '$conf->webcal->enabled'); -insert into `llx_menu_constraint` (`rowid`, `action`) values (41, '$conf->mantis->enabled'); -insert into `llx_menu_constraint` (`rowid`, `action`) values (42, '(dolibarr_get_const($this->db,"PRODUIT_SPECIAL_LIVRE")) && (dolibarr_get_const($this->db,"PRODUCT_CANVAS_ABILITY"))'); -insert into `llx_menu_constraint` (`rowid`, `action`) values (43, '!((dolibarr_get_const($this->db,"PRODUIT_SPECIAL_LIVRE")) && (dolibarr_get_const($this->db,"PRODUCT_CANVAS_ABILITY")))'); -insert into `llx_menu_constraint` (`rowid`, `action`) values (44, '$conf->droitpret->enabled'); -insert into `llx_menu_constraint` (`rowid`, `action`) values (45, '$conf->menudb->enabled'); -insert into `llx_menu_constraint` (`rowid`, `action`) values (46, '$conf->energie->enabled'); -insert into `llx_menu_constraint` (`rowid`, `action`) values (47, '$conf->telephonie->enabled'); -insert into `llx_menu_constraint` (`rowid`, `action`) values (48, '($user->admin && function_exists("eaccelerator_info"))'); -insert into `llx_menu_constraint` (`rowid`, `action`) values (49, '$conf->import->enabled'); -insert into `llx_menu_constraint` (`rowid`, `action`) values (50, '$conf->phenix->enabled'); - --- --- Contenu de la table `llx_menu_const` --- -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (1, 100, 1, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (2, 200, 1, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (3, 300, 1, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (4, 304, 48, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (5, 501, 3, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (6, 502, 4, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (7, 504, 6, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (8, 503, 5, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (9, 504, 5, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (10, 505, 5, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (11, 500, 2, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (12, 1100, 7, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (13, 1200, 8, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (14, 1300, 9, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (15, 1400, 10, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (16, 1500, 11, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (17, 1600, 5, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (18, 1601, 6, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (19, 1603, 12, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (20, 1605, 6, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (21, 1604, 13, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (22, 1605, 13, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (23, 1606, 13, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (24, 1607, 13, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (25, 1701, 6, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (26, 1700, 12, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (27, 1705, 6, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (28, 1706, 14, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (29, 1704, 13, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (30, 1705, 13, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (31, 1706, 13, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (32, 1708, 13, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (33, 1709, 13, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (34, 1710, 13, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (35, 1711, 13, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (36, 1712, 13, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (37, 1713, 13, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (38, 1714, 13, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (39, 1800, 7, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (40, 1900, 13, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (41, 1900, 8, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (42, 2000, 15, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (43, 2100, 16, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (44, 2200, 17, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (45, 2300, 18, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (46, 2400, 19, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (47, 2500, 20, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (48, 2300, 21, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (49, 2700, 22, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (50, 2800, 23, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (51, 2801, 6, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (52, 2803, 24, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (53, 2900, 25, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (54, 2901, 6, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (55, 3000, 7, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (56, 3100, 24, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (57, 3200, 26, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (58, 3201, 6, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (59, 3300, 5, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (60, 3301, 6, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (61, 3400, 13, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (62, 3401, 6, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (63, 3500, 8, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (64, 3600, 27, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (65, 3700, 27, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (66, 3800, 27, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (67, 3900, 28, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (68, 4000, 29, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (69, 4100, 30, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (70, 4130, 49, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (71, 4200, 31, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (72, 4300, 31, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (73, 4400, 31, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (74, 4500, 31, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (75, 4600, 31, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (76, 4700, 31, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (77, 4400, 21, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (78, 4501, 30, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (79, 2, 32, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (80, 3, 33, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (81, 4, 34, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (82, 5, 35, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (83, 6, 36, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (84, 7, 27, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (85, 8, 37, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (86, 9, 47, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (87, 10, 46, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (88, 11, 38, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (89, 12, 39, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (90, 13, 40, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (91, 14, 41, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (92, 15, 31, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (93, 16, 50, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (100, 1715, 13, 1); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (101, 1716, 13, 1); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (102, 1717, 13, 1); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (103, 2804, 42, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (104, 2805, 42, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (105, 2801, 43, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (106, 2802, 43, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (110, 4800, 44, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (111, 4900, 26, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (112, 4901, 6, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (113, 5000, 26, 2); -insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) values (114, 5001, 6, 2); - -ALTER TABLE llx_product ADD COLUMN volume float DEFAULT NULL after weight_units; -ALTER TABLE llx_product ADD COLUMN volume_units tinyint DEFAULT NULL after volume; - -ALTER TABLE llx_product modify ref varchar(32) NOT NULL; - -ALTER TABLE `llx_socpeople` CHANGE `fk_user` `fk_user_creat` INT(11) NULL; -ALTER TABLE `llx_socpeople` CHANGE `fk_user_create` `fk_user_creat` INT(11) NULL; --- V4.1 UPDATE llx_socpeople set fk_user_creat = null where llx_socpeople.fk_user_creat is not null and llx_socpeople.fk_user_creat not in (select rowid from llx_user); --- V4 ALTER TABLE llx_socpeople ADD INDEX idx_socpeople_fk_user_creat (fk_user_creat); --- V4 ALTER TABLE llx_socpeople DROP INDEX idx_fk_user_creat; --- V4 ALTER TABLE llx_socpeople ADD CONSTRAINT fk_socpeople_user_creat_user_rowid FOREIGN KEY (fk_user_creat) REFERENCES llx_user (rowid); - -ALTER TABLE llx_user add pass_temp VARCHAR(32) NULL after pass_crypted; -update llx_user set pass = null where pass = pass_crypted and length(pass) = 32; - -drop table if exists llx_soc_events; -drop table if exists llx_todocomm; -drop table if exists llx_ventes; -drop table if exists llx_pointmort; -drop table if exists llx_birthday_alert; - -ALTER TABLE llx_commande_fournisseurdet ADD total_ht double(24,8) DEFAULT 0 after subprice; -ALTER TABLE llx_commande_fournisseurdet ADD total_tva double(24,8) DEFAULT 0 after total_ht; -ALTER TABLE llx_commande_fournisseurdet ADD total_ttc double(24,8) DEFAULT 0 after total_tva; -ALTER TABLE llx_commande_fournisseurdet ADD info_bits integer DEFAULT 0 after total_ttc; - - --- Pas de limite sur nb decimal des prix dans base car definie en option --- Tous les prix doivent etre au format float(16,8) --- Tous les tx tva doivent etre au format float(6,3) -ALTER TABLE llx_product_price ADD COLUMN price_ttc double(24,8) DEFAULT 0 AFTER price; -ALTER TABLE llx_product ADD COLUMN price_ttc double(24,8) DEFAULT 0 AFTER price_base_type; - -ALTER TABLE llx_product MODIFY price double(24,8) DEFAULT 0; -ALTER TABLE llx_product MODIFY price_ttc double(24,8) DEFAULT 0; -ALTER TABLE llx_product MODIFY tva_tx double(6,3) DEFAULT 0; - -ALTER TABLE llx_product_price MODIFY price double(24,8) DEFAULT 0; -ALTER TABLE llx_product_price MODIFY price_ttc double(24,8) DEFAULT 0; -ALTER TABLE llx_product_price MODIFY tva_tx double(6,3) DEFAULT 0; - -ALTER TABLE llx_product_fournisseur_price_log MODIFY price double(24,8) DEFAULT 0; -ALTER TABLE llx_product_fournisseur_price_log MODIFY quantity double; -ALTER TABLE llx_product_fournisseur_price MODIFY price double(24,8) DEFAULT 0; -ALTER TABLE llx_product_fournisseur_price MODIFY quantity double; - - -ALTER TABLE llx_facture_fourn MODIFY amount double(24,8) DEFAULT 0 NOT NULL; -ALTER TABLE llx_facture_fourn MODIFY remise double(24,8) DEFAULT 0; -ALTER TABLE llx_facture_fourn MODIFY tva double(24,8) DEFAULT 0; -ALTER TABLE llx_facture_fourn MODIFY total double(24,8) DEFAULT 0; -ALTER TABLE llx_facture_fourn MODIFY total_ht double(24,8) DEFAULT 0; -ALTER TABLE llx_facture_fourn MODIFY total_tva double(24,8) DEFAULT 0; -ALTER TABLE llx_facture_fourn MODIFY total_ttc double(24,8) DEFAULT 0; - -ALTER TABLE llx_facture_fourn_det MODIFY pu_ht double(24,8); -ALTER TABLE llx_facture_fourn_det ADD pu_ttc double(24,8) AFTER pu_ht; -ALTER TABLE llx_facture_fourn_det MODIFY pu_ttc double(24,8); -ALTER TABLE llx_facture_fourn_det MODIFY qty smallint DEFAULT 1; -ALTER TABLE llx_facture_fourn_det MODIFY total_ht double(24,8) DEFAULT 0; -ALTER TABLE llx_facture_fourn_det MODIFY tva_taux double(24,8) DEFAULT 0; -ALTER TABLE llx_facture_fourn_det MODIFY tva double(24,8) DEFAULT 0; -ALTER TABLE llx_facture_fourn_det MODIFY total_ttc double(24,8) DEFAULT 0; - -ALTER TABLE llx_propal ADD total_ht double(24,8) DEFAULT 0 after remise; - -ALTER TABLE llx_propal MODIFY tva double(24,8) DEFAULT 0; -ALTER TABLE llx_propal MODIFY total_ht double(24,8) DEFAULT 0; -ALTER TABLE llx_propal MODIFY total double(24,8) DEFAULT 0; - -ALTER TABLE llx_propaldet MODIFY tva_tx double(6,3) DEFAULT 0; -ALTER TABLE llx_propaldet MODIFY total_ht double(24,8) DEFAULT 0; -ALTER TABLE llx_propaldet MODIFY total_tva double(24,8) DEFAULT 0; -ALTER TABLE llx_propaldet MODIFY total_ttc double(24,8) DEFAULT 0; -ALTER TABLE llx_propaldet MODIFY subprice double(24,8) DEFAULT 0; - -ALTER TABLE llx_contratdet MODIFY tva_tx double(6,3) DEFAULT 0; -ALTER TABLE llx_contratdet MODIFY subprice double(24,8) DEFAULT 0; -ALTER TABLE llx_contratdet MODIFY total_ht double(24,8) DEFAULT 0; -ALTER TABLE llx_contratdet MODIFY total_tva double(24,8) DEFAULT 0; -ALTER TABLE llx_contratdet MODIFY total_ttc double(24,8) DEFAULT 0; - -ALTER TABLE llx_commande MODIFY total_ht double(24,8) DEFAULT 0; -ALTER TABLE llx_commande MODIFY tva double(24,8) DEFAULT 0; -ALTER TABLE llx_commande MODIFY total_ttc double(24,8) DEFAULT 0; - -ALTER TABLE llx_commande_fournisseur MODIFY total_ht double(24,8) DEFAULT 0; -ALTER TABLE llx_commande_fournisseur MODIFY tva double(24,8) DEFAULT 0; -ALTER TABLE llx_commande_fournisseur MODIFY total_ttc double(24,8) DEFAULT 0; - -ALTER TABLE llx_commandedet MODIFY subprice double(24,8) DEFAULT 0; -ALTER TABLE llx_commandedet MODIFY total_tva double(24,8) DEFAULT 0; -ALTER TABLE llx_commandedet MODIFY total_ht double(24,8) DEFAULT 0; -ALTER TABLE llx_commandedet MODIFY total_ttc double(24,8) DEFAULT 0; -ALTER TABLE llx_commandedet MODIFY tva_tx double(6,3) DEFAULT 0; - -ALTER TABLE llx_commande_fournisseurdet MODIFY subprice double(24,8) DEFAULT 0; -ALTER TABLE llx_commande_fournisseurdet MODIFY total_tva double(24,8) DEFAULT 0; -ALTER TABLE llx_commande_fournisseurdet MODIFY total_ht double(24,8) DEFAULT 0; -ALTER TABLE llx_commande_fournisseurdet MODIFY total_ttc double(24,8) DEFAULT 0; -ALTER TABLE llx_commande_fournisseurdet MODIFY tva_tx double(6,3) DEFAULT 0; - -ALTER TABLE llx_societe_remise_except MODIFY amount_ht double(24,8) DEFAULT 0; -ALTER TABLE llx_societe_remise_except MODIFY amount_tva double(24,8) DEFAULT 0; -ALTER TABLE llx_societe_remise_except MODIFY amount_ttc double(24,8) DEFAULT 0; -ALTER TABLE llx_societe_remise_except MODIFY tva_tx double(6,3) DEFAULT 0; - - --- Supprimme orphelins pour permettre montee de la cle --- V4 DELETE llx_commande_fournisseur FROM llx_commande_fournisseur LEFT JOIN llx_societe ON llx_commande_fournisseur.fk_soc = llx_societe.rowid WHERE llx_societe.rowid IS NULL; - - --- Changement de idp en rowid --- V4 ALTER TABLE llx_propal DROP FOREIGN KEY llx_propal_ibfk1; --- V4 ALTER TABLE llx_socpeople DROP FOREIGN KEY fk_socpeople_fk_soc; --- V4 ALTER TABLE llx_commande DROP FOREIGN KEY fk_commande_societe; --- V4 ALTER TABLE llx_commande_fournisseur DROP FOREIGN KEY fk_commande_fournisseur_societe; --- V4 ALTER TABLE llx_contrat DROP FOREIGN KEY fk_contrat_societe; --- V4 ALTER TABLE llx_facture DROP FOREIGN KEY fk_facture_fk_soc; --- V4 ALTER TABLE llx_facture_fourn DROP FOREIGN KEY fk_facture_fourn_fk_soc; --- V4 ALTER TABLE llx_fichinter DROP FOREIGN KEY fk_fichinter_fk_soc; --- V4 ALTER TABLE llx_osc_customer DROP FOREIGN KEY llx_osc_customer_fk_soc; --- V4 ALTER TABLE llx_propal DROP FOREIGN KEY fk_propal_fk_soc; --- V4 ALTER TABLE llx_societe_remise_except DROP FOREIGN KEY fk_societe_remise_fk_soc; --- V4 ALTER TABLE llx_product_fournisseur_price DROP FOREIGN KEY fk_product_fournisseur_price_fk_soc; --- V4 ALTER TABLE llx_categorie_societe DROP FOREIGN KEY fk_categorie_societe_societe_rowid; - --- V4 ALTER TABLE `llx_osc_customer` DROP FOREIGN KEY llx_osc_customer_societe_idp; --- V4 ALTER TABLE `llx_osc_customer` DROP FOREIGN KEY fk_osc_customer_fk_soc; - --- V4 ALTER TABLE llx_telephonie_adsl_fournisseur DROP FOREIGN KEY fk_soc; --- V4 ALTER TABLE llx_telephonie_client_stats DROP FOREIGN KEY fk_client_comm; --- V4 ALTER TABLE llx_telephonie_contact_facture DROP FOREIGN KEY fk_contact; --- V4 ALTER TABLE llx_telephonie_societe_ligne DROP FOREIGN KEY fk_client_comm; --- V4 ALTER TABLE llx_telephonie_societe_ligne DROP FOREIGN KEY fk_soc; --- V4 ALTER TABLE llx_telephonie_societe_ligne DROP FOREIGN KEY fk_soc_facture; --- V4 ALTER TABLE llx_telephonie_tarif_client DROP FOREIGN KEY fk_client; --- V4 ALTER TABLE llx_telephonie_adsl_fournisseur DROP INDEX fk_soc_2; --- V4 ALTER TABLE llx_telephonie_commande_ligne DROP INDEX fk_ligne_2; --- V4 ALTER TABLE llx_telephonie_commande_ligne DROP INDEX fk_commande_2; --- V4 ALTER TABLE llx_telephonie_commande DROP INDEX fk_user_creat_2; --- V4 ALTER TABLE llx_telephonie_commande DROP INDEX fk_fournisseur_2; --- V4 ALTER TABLE llx_telephonie_contact_facture DROP INDEX fk_contact_2; --- V4 ALTER TABLE llx_telephonie_contact_facture DROP INDEX fk_contact_3; --- V4 ALTER TABLE llx_telephonie_contact_facture DROP INDEX fk_ligne_2; --- V4 ALTER TABLE llx_telephonie_contact_facture DROP INDEX fk_ligne_3; - -ALTER TABLE `llx_societe` CHANGE `idp` `rowid` integer AUTO_INCREMENT; -ALTER TABLE `llx_socpeople` CHANGE `idp` `rowid` integer AUTO_INCREMENT; - -ALTER TABLE `llx_osc_customer` CHANGE `osc_custid` `rowid` integer NOT NULL default 0; -ALTER TABLE `llx_osc_customer` CHANGE `osc_lastmodif` `datem` datetime default NULL; -ALTER TABLE `llx_osc_customer` CHANGE `doli_socidp` `fk_soc` integer NOT NULL default '0'; -ALTER TABLE `llx_osc_customer` ADD PRIMARY KEY (rowid); -ALTER TABLE `llx_osc_customer` ADD UNIQUE KEY `fk_soc` (`fk_soc`); -ALTER TABLE `llx_osc_order` CHANGE `osc_orderid` `rowid` integer NOT NULL default 0; -ALTER TABLE `llx_osc_order` CHANGE `osc_lastmodif` `datem` datetime default NULL; -ALTER TABLE `llx_osc_order` CHANGE `doli_orderidp` `fk_commande` integer NOT NULL default 0; -ALTER TABLE `llx_osc_order` ADD PRIMARY KEY (rowid); -ALTER TABLE `llx_osc_order` ADD UNIQUE KEY `fk_commande` (`fk_commande`); -ALTER TABLE `llx_osc_product` CHANGE `osc_prodid` `rowid` integer NOT NULL default 0; -ALTER TABLE `llx_osc_product` CHANGE `osc_lastmodif` `datem` datetime default NULL; -ALTER TABLE `llx_osc_product` CHANGE `doli_prodidp` `fk_product` integer NOT NULL default 0; -ALTER TABLE `llx_osc_product` ADD PRIMARY KEY (rowid); -ALTER TABLE `llx_osc_product` ADD UNIQUE KEY `fk_product` (`fk_product`); - --- V4 ALTER TABLE llx_socpeople ADD CONSTRAINT fk_socpeople_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe (rowid); --- V4 ALTER TABLE llx_commande ADD CONSTRAINT fk_commande_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe (rowid); --- V4 ALTER TABLE llx_commande_fournisseur ADD CONSTRAINT fk_commande_fournisseur_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe (rowid); --- V4 ALTER TABLE llx_contrat ADD CONSTRAINT fk_contrat_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe (rowid); --- V4 ALTER TABLE llx_facture ADD CONSTRAINT fk_facture_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe (rowid); --- V4 ALTER TABLE llx_facture_fourn ADD CONSTRAINT fk_facture_fourn_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe (rowid); --- V4 ALTER TABLE llx_fichinter ADD CONSTRAINT fk_fichinter_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe (rowid); --- V4 ALTER TABLE llx_propal ADD CONSTRAINT fk_propal_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe (rowid); --- V4 ALTER TABLE llx_societe_remise_except ADD CONSTRAINT fk_societe_remise_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe (rowid); --- V4 ALTER TABLE llx_categorie_societe ADD CONSTRAINT fk_categorie_societe_fk_soc FOREIGN KEY (fk_societe) REFERENCES llx_societe (rowid); - --- V4 ALTER TABLE llx_osc_customer ADD CONSTRAINT fk_osc_customer_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe (rowid); - --- V4 ALTER TABLE llx_telephonie_adsl_fournisseur ADD CONSTRAINT fk_telephonie_adsl_fournisseur_societe FOREIGN KEY (fk_soc) REFERENCES llx_societe (rowid); --- V4 ALTER TABLE llx_telephonie_client_stats ADD CONSTRAINT fk_telephonie_client_stats_societe FOREIGN KEY (fk_client_comm) REFERENCES llx_societe(rowid); --- V4 ALTER TABLE llx_telephonie_contact_facture ADD CONSTRAINT fk_telephonie_contact_facture_contact FOREIGN KEY (fk_contact) REFERENCES llx_socpeople (rowid); --- V4 ALTER TABLE llx_telephonie_contact_facture ADD CONSTRAINT fk_telephonie_contact_facture_ligne FOREIGN KEY (fk_ligne) REFERENCES llx_telephonie_societe_ligne (rowid); --- V4 ALTER TABLE llx_telephonie_societe_ligne ADD CONSTRAINT llx_telephonie_societe_ligne_client_comm FOREIGN KEY (fk_client_comm) REFERENCES llx_societe(rowid); --- V4 ALTER TABLE llx_telephonie_societe_ligne ADD CONSTRAINT llx_telephonie_societe_ligne_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe(rowid); --- V4 ALTER TABLE llx_telephonie_societe_ligne ADD CONSTRAINT llx_telephonie_societe_ligne_soc_facture FOREIGN KEY (fk_soc_facture) REFERENCES llx_societe(rowid); --- V4 ALTER TABLE llx_telephonie_tarif_client ADD CONSTRAINT llx_telephonie_tarif_client_client FOREIGN KEY (fk_client) REFERENCES llx_societe (rowid); --- fin du changement idp en rowid - -insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (120, 'fichinter','internal', 'INTERREPFOLL', 'Responsable suivi de l\'intervention', 1); -insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (121, 'fichinter','internal', 'INTERVENING', 'Intervenant', 1); -insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (130, 'fichinter','external', 'BILLING', 'Contact client facturation intervention', 1); -insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (131, 'fichinter','external', 'CUSTOMER', 'Contact client suivi de l\'intervention', 1); - -ALTER TABLE llx_fichinter CHANGE note description text DEFAULT NULL; -ALTER TABLE llx_fichinter ADD COLUMN note_private text DEFAULT NULL after description; -ALTER TABLE llx_fichinter ADD COLUMN note_public text DEFAULT NULL after note_private; -ALTER TABLE llx_fichinter ADD COLUMN tms timestamp after ref; -ALTER TABLE llx_fichinter ADD COLUMN fk_contrat integer DEFAULT 0 after fk_projet; - -drop table if exists `llx_accountingsystem_det`; - - -update llx_bank set label='(InitialBankBalance)' where fk_type='SOLD' and label in ('Balance','(Balance)','Solde','(Solde)'); - -alter table llx_product_fournisseur_price add unitprice double(24,8); -alter table llx_product_fournisseur_price MODIFY unitprice double(24,8); -update llx_product_fournisseur_price set unitprice = ROUND(price/quantity,8) where unitprice IS NULL; - -update llx_fichinter set tms=datec where tms < datec; -update llx_fichinter set tms=date_valid where tms < date_valid; - -ALTER TABLE llx_commande_fournisseur DROP INDEX ref; -ALTER TABLE llx_commande_fournisseur ADD UNIQUE INDEX uk_commande_fournisseur_ref (ref, fk_soc); - -create table llx_c_ecotaxe -( - rowid integer AUTO_INCREMENT PRIMARY KEY, - code varchar(64) UNIQUE NOT NULL, - libelle varchar(255), - price double(24,8), - organization varchar(255), - fk_pays integer NOT NULL, - active tinyint DEFAULT 1 NOT NULL -)ENGINE=innodb; - -INSERT INTO `llx_c_ecotaxe` (`rowid`, `code`, `libelle`, `price`, `organization`, `fk_pays`, `active`) VALUES (1, 'ER-A-A', 'Mat�riels �lectriques < 0,2kg', 0.01000000, 'ERP', 1, 1); -INSERT INTO `llx_c_ecotaxe` (`rowid`, `code`, `libelle`, `price`, `organization`, `fk_pays`, `active`) VALUES (2, 'ER-A-B', 'Mat�riels �lectriques >= 0,2 kg et < 0,5 kg', 0.03000000, 'ERP', 1, 1); -INSERT INTO `llx_c_ecotaxe` (`rowid`, `code`, `libelle`, `price`, `organization`, `fk_pays`, `active`) VALUES (3, 'ER-A-C', 'Mat�riels �lectriques >= 0,5 kg et < 1 kg', 0.04000000, 'ERP', 1, 1); -INSERT INTO `llx_c_ecotaxe` (`rowid`, `code`, `libelle`, `price`, `organization`, `fk_pays`, `active`) VALUES (4, 'ER-A-D', 'Mat�riels �lectriques >= 1 kg et < 2 kg', 0.13000000, 'ERP', 1, 1); -INSERT INTO `llx_c_ecotaxe` (`rowid`, `code`, `libelle`, `price`, `organization`, `fk_pays`, `active`) VALUES (5, 'ER-A-E', 'Mat�riels �lectriques >= 2 kg et < 4kg', 0.21000000, 'ERP', 1, 1); -INSERT INTO `llx_c_ecotaxe` (`rowid`, `code`, `libelle`, `price`, `organization`, `fk_pays`, `active`) VALUES (6, 'ER-A-F', 'Mat�riels �lectriques >= 4 kg et < 8 kg', 0.42000000, 'ERP', 1, 1); -INSERT INTO `llx_c_ecotaxe` (`rowid`, `code`, `libelle`, `price`, `organization`, `fk_pays`, `active`) VALUES (7, 'ER-A-G', 'Mat�riels �lectriques >= 8 kg et < 15 kg', 0.84000000, 'ERP', 1, 1); -INSERT INTO `llx_c_ecotaxe` (`rowid`, `code`, `libelle`, `price`, `organization`, `fk_pays`, `active`) VALUES (8, 'ER-A-H', 'Mat�riels �lectriques >= 15 kg et < 20 kg', 1.25000000, 'ERP', 1, 1); -INSERT INTO `llx_c_ecotaxe` (`rowid`, `code`, `libelle`, `price`, `organization`, `fk_pays`, `active`) VALUES (9, 'ER-A-I', 'Mat�riels �lectriques >= 20 kg et < 30 kg', 1.88000000, 'ERP', 1, 1); -INSERT INTO `llx_c_ecotaxe` (`rowid`, `code`, `libelle`, `price`, `organization`, `fk_pays`, `active`) VALUES (10, 'ER-A-J', 'Mat�riels �lectriques >= 30 kg', 3.34000000, 'ERP', 1, 1); -INSERT INTO `llx_c_ecotaxe` (`rowid`, `code`, `libelle`, `price`, `organization`, `fk_pays`, `active`) VALUES (11, 'ER-M-1', 'TV, Moniteurs < 9kg', 0.84000000, 'ERP', 1, 1); -INSERT INTO `llx_c_ecotaxe` (`rowid`, `code`, `libelle`, `price`, `organization`, `fk_pays`, `active`) VALUES (12, 'ER-M-2', 'TV, Moniteurs >= 9kg et < 15kg', 1.67000000, 'ERP', 1, 1); -INSERT INTO `llx_c_ecotaxe` (`rowid`, `code`, `libelle`, `price`, `organization`, `fk_pays`, `active`) VALUES (13, 'ER-M-3', 'TV, Moniteurs >= 15kg et < 30kg', 3.34000000, 'ERP', 1, 1); -INSERT INTO `llx_c_ecotaxe` (`rowid`, `code`, `libelle`, `price`, `organization`, `fk_pays`, `active`) VALUES (14, 'ER-M-4', 'TV, Moniteurs >= 30 kg', 6.69000000, 'ERP', 1, 1); -INSERT INTO `llx_c_ecotaxe` (`rowid`, `code`, `libelle`, `price`, `organization`, `fk_pays`, `active`) VALUES (15, 'EC-A-A', 'Mat�riels �lectriques 0,2 kg max', 0.00840000, 'Ecologic', 1, 1); -INSERT INTO `llx_c_ecotaxe` (`rowid`, `code`, `libelle`, `price`, `organization`, `fk_pays`, `active`) VALUES (16, 'EC-A-B', 'Mat�riels �lectriques 0,21 kg min - 0,50 kg max', 0.02500000, 'Ecologic', 1, 1); -INSERT INTO `llx_c_ecotaxe` (`rowid`, `code`, `libelle`, `price`, `organization`, `fk_pays`, `active`) VALUES (17, 'EC-A-C', 'Mat�riels �lectriques 0,51 kg min - 1 kg max', 0.04000000, 'Ecologic', 1, 1); -INSERT INTO `llx_c_ecotaxe` (`rowid`, `code`, `libelle`, `price`, `organization`, `fk_pays`, `active`) VALUES (18, 'EC-A-D', 'Mat�riels �lectriques 1,01 kg min - 2,5 kg max', 0.13000000, 'Ecologic', 1, 1); -INSERT INTO `llx_c_ecotaxe` (`rowid`, `code`, `libelle`, `price`, `organization`, `fk_pays`, `active`) VALUES (19, 'EC-A-E', 'Mat�riels �lectriques 2,51 kg min - 4 kg max', 0.21000000, 'Ecologic', 1, 1); -INSERT INTO `llx_c_ecotaxe` (`rowid`, `code`, `libelle`, `price`, `organization`, `fk_pays`, `active`) VALUES (20, 'EC-A-F', 'Mat�riels �lectriques 4,01 kg min - 8 kg max', 0.42000000, 'Ecologic', 1, 1); -INSERT INTO `llx_c_ecotaxe` (`rowid`, `code`, `libelle`, `price`, `organization`, `fk_pays`, `active`) VALUES (21, 'EC-A-G', 'Mat�riels �lectriques 8,01 kg min - 12 kg max', 0.63000000, 'Ecologic', 1, 1); -INSERT INTO `llx_c_ecotaxe` (`rowid`, `code`, `libelle`, `price`, `organization`, `fk_pays`, `active`) VALUES (22, 'EC-A-H', 'Mat�riels �lectriques 12,01 kg min - 20 kg max', 1.05000000, 'Ecologic', 1, 1); -INSERT INTO `llx_c_ecotaxe` (`rowid`, `code`, `libelle`, `price`, `organization`, `fk_pays`, `active`) VALUES (23, 'EC-A-I', 'Mat�riels �lectriques 20,01 kg min', 1.88000000, 'Ecologic', 1, 1); -INSERT INTO `llx_c_ecotaxe` (`rowid`, `code`, `libelle`, `price`, `organization`, `fk_pays`, `active`) VALUES (24, 'EC-M-1', 'TV, Moniteurs 9 kg max', 0.84000000, 'Ecologic', 1, 1); -INSERT INTO `llx_c_ecotaxe` (`rowid`, `code`, `libelle`, `price`, `organization`, `fk_pays`, `active`) VALUES (25, 'EC-M-2', 'TV, Moniteurs 9,01 kg min - 18 kg max', 1.67000000, 'Ecologic', 1, 1); -INSERT INTO `llx_c_ecotaxe` (`rowid`, `code`, `libelle`, `price`, `organization`, `fk_pays`, `active`) VALUES (26, 'EC-M-3', 'TV, Moniteurs 18,01 kg min - 36 kg max', 3.34000000, 'Ecologic', 1, 1); -INSERT INTO `llx_c_ecotaxe` (`rowid`, `code`, `libelle`, `price`, `organization`, `fk_pays`, `active`) VALUES (27, 'EC-M-4', 'TV, Moniteurs 36,01 kg min', 6.69000000, 'Ecologic', 1, 1); -INSERT INTO `llx_c_ecotaxe` (`rowid`, `code`, `libelle`, `price`, `organization`, `fk_pays`, `active`) VALUES (28, 'ES-M-1', 'TV, Moniteurs <= 20 pouces', 0.84000000, 'Eco-syst�mes', 1, 1); -INSERT INTO `llx_c_ecotaxe` (`rowid`, `code`, `libelle`, `price`, `organization`, `fk_pays`, `active`) VALUES (29, 'ES-M-2', 'TV, Moniteurs > 20 pouces et <= 32 pouces', 3.34000000, 'Eco-syst�mes', 1, 1); -INSERT INTO `llx_c_ecotaxe` (`rowid`, `code`, `libelle`, `price`, `organization`, `fk_pays`, `active`) VALUES (30, 'ES-M-3', 'TV, Moniteurs > 32 pouces et autres grands �crans', 6.69000000, 'Eco-syst�mes', 1, 1); -INSERT INTO `llx_c_ecotaxe` (`rowid`, `code`, `libelle`, `price`, `organization`, `fk_pays`, `active`) VALUES (31, 'ES-A-A', 'Ordinateur fixe, Audio home systems (HIFI), �l�ments hifi s�par�s...', 0.84000000, 'Eco-syst�mes', 1, 1); -INSERT INTO `llx_c_ecotaxe` (`rowid`, `code`, `libelle`, `price`, `organization`, `fk_pays`, `active`) VALUES (32, 'ES-A-B', 'Ordinateur portable, CD-RCR, VCR, lecteurs et enregistreurs DVD... Instruments de musique et caisses de r�sonance, haut parleurs...', 0.25000000, 'Eco-syst�mes', 1, 1); -INSERT INTO `llx_c_ecotaxe` (`rowid`, `code`, `libelle`, `price`, `organization`, `fk_pays`, `active`) VALUES (33, 'ES-A-C', 'Imprimante, photocopieur, t�l�copieur,...', 0.42000000, 'Eco-syst�mes', 1, 1); -INSERT INTO `llx_c_ecotaxe` (`rowid`, `code`, `libelle`, `price`, `organization`, `fk_pays`, `active`) VALUES (34, 'ES-A-D', 'Accessoires, clavier, souris, PDA, imprimante photo, appareil photo, gps, t�l�phone, r�pondeur, t�l�phone sans fil, modem,... T�l�commande, casque, cam�scope, baladeur mp3, radio portable, radio K7 et CD portable, set top box, radio r�veil,...', 0.08400000, 'Eco-syst�mes', 1, 1); -INSERT INTO `llx_c_ecotaxe` (`rowid`, `code`, `libelle`, `price`, `organization`, `fk_pays`, `active`) VALUES (35, 'ES-A-E', 'GSM', 0.00840000, 'Eco-syst�mes', 1, 1); -INSERT INTO `llx_c_ecotaxe` (`rowid`, `code`, `libelle`, `price`, `organization`, `fk_pays`, `active`) VALUES (36, 'ES-A-F', 'Jouets et �quipements de loisirs et de sports < 0,5 kg', 0.04200000, 'Eco-syst�mes', 1, 1); -INSERT INTO `llx_c_ecotaxe` (`rowid`, `code`, `libelle`, `price`, `organization`, `fk_pays`, `active`) VALUES (37, 'ES-A-G', 'Jouets et �quipements de loisirs et de sports > 0,5 kg', 0.17000000, 'Eco-syst�mes', 1, 1); -INSERT INTO `llx_c_ecotaxe` (`rowid`, `code`, `libelle`, `price`, `organization`, `fk_pays`, `active`) VALUES (38, 'ES-A-H', 'Jouets et �quipements de loisirs et de sports > 10 kg', 1.25000000, 'Eco-syst�mes', 1, 1); - -ALTER TABLE llx_commandedet CHANGE coef marge_tx double(6,3) DEFAULT 0; -ALTER TABLE llx_commandedet ADD COLUMN marge_tx double(6,3) DEFAULT 0; -ALTER TABLE llx_commandedet ADD COLUMN marque_tx double(6,3) DEFAULT 0 after marge_tx; -ALTER TABLE llx_commandedet MODIFY marge_tx double(6,3) DEFAULT 0; -ALTER TABLE llx_commandedet MODIFY marque_tx double(6,3) DEFAULT 0; - -ALTER TABLE llx_propaldet CHANGE coef marge_tx double(6,3) DEFAULT 0; -ALTER TABLE llx_propaldet ADD COLUMN marge_tx double(6,3) DEFAULT 0; -ALTER TABLE llx_propaldet ADD COLUMN marque_tx double(6,3) DEFAULT 0 after marge_tx; -ALTER TABLE llx_propaldet MODIFY marge_tx double(6,3) DEFAULT 0; -ALTER TABLE llx_propaldet MODIFY marque_tx double(6,3) DEFAULT 0; - --- Nouveau mode de stockage de l'ordre des box (X99 ou X = colonne et 99 position dans colonne) -alter table llx_boxes modify box_order varchar(3) NOT NULL; --- V4.1 update llx_boxes set box_order = concat('A0',box_order) where length(box_order) = 1 and substring(box_order,-1) in ('1','3','5','7','9'); --- V4.1 update llx_boxes set box_order = concat('B0',box_order) where length(box_order) = 1 and substring(box_order,-1) in ('0','2','4','6','8'); --- V4.1 update llx_boxes set box_order = concat('A',box_order) where length(box_order) = 2 and substring(box_order,-1) in ('1','3','5','7','9'); --- V4.1 update llx_boxes set box_order = concat('B',box_order) where length(box_order) = 2 and substring(box_order,-1) in ('0','2','4','6','8'); - -create table llx_fichinterdet -( - rowid integer AUTO_INCREMENT PRIMARY KEY, - fk_fichinter integer, - date date, - description text, - duree integer, - rang integer DEFAULT 0 -)ENGINE=innodb; - -ALTER TABLE llx_fichinter ADD COLUMN model_pdf varchar(50) after note_public; - -ALTER TABLE llx_bordereau_cheque MODIFY number varchar(16) NOT NULL; -ALTER TABLE llx_bordereau_cheque MODIFY amount double(24,8) NOT NULL; -ALTER TABLE llx_bordereau_cheque MODIFY nbcheque smallint NOT NULL; -ALTER TABLE llx_bordereau_cheque MODIFY statut smallint(1) NOT NULL DEFAULT 0; - -ALTER TABLE llx_facturedet ADD COLUMN special_code tinyint(4) unsigned default 0; -ALTER TABLE llx_facturedet MODIFY special_code tinyint(4) unsigned default 0; - -ALTER TABLE llx_commandedet MODIFY special_code tinyint(4) unsigned default 0; - -ALTER TABLE llx_propaldet ADD COLUMN special_code tinyint(4) unsigned default 0 after marque_tx; -ALTER TABLE llx_propaldet ADD COLUMN pa_ht double(24,8) DEFAULT 0 after info_bits; -ALTER TABLE llx_propaldet MODIFY pa_ht double(24,8) DEFAULT 0; - -ALTER TABLE llx_bank MODIFY amount double(24,8) DEFAULT 0; - - --- Nouveau fonctionnement de la table llx_product_fournisseur_price --- V4 ALTER TABLE llx_product_fournisseur_price DROP FOREIGN KEY fk_product_fournisseur_price_fk_user; --- V4 ALTER TABLE llx_product_fournisseur_price DROP FOREIGN KEY fk_product_fournisseur_price_fk_soc; --- V4 ALTER TABLE llx_product_fournisseur_price DROP FOREIGN KEY fk_product_fournisseur_price_fk_product; -ALTER TABLE llx_product_fournisseur_price DROP INDEX idx_product_fournisseur_price_fk_user; -ALTER TABLE llx_product_fournisseur_price DROP INDEX idx_product_fournisseur_price_fk_soc; -ALTER TABLE llx_product_fournisseur_price DROP INDEX idx_product_fournisseur_price_fk_product; -ALTER TABLE llx_product_fournisseur_price DROP COLUMN ref_fourn; --- V4.1 UPDATE llx_product_fournisseur_price as pfp SET pfp.fk_product = (SELECT pf.rowid FROM llx_product_fournisseur AS pf WHERE pfp.fk_product = pf.fk_product AND pfp.fk_soc = pf.fk_soc); -ALTER TABLE llx_product_fournisseur_price DROP COLUMN fk_soc; -ALTER TABLE llx_product_fournisseur_price CHANGE fk_product fk_product_fournisseur integer NOT NULL; -ALTER TABLE llx_product_fournisseur_price ADD INDEX idx_product_fournisseur_price_fk_user (fk_user); -ALTER TABLE llx_product_fournisseur_price ADD INDEX idx_product_fournisseur_price_fk_product_fournisseur (fk_product_fournisseur); --- V4 ALTER TABLE llx_product_fournisseur_price ADD CONSTRAINT fk_product_fournisseur_price_fk_user FOREIGN KEY (fk_user) REFERENCES llx_user (rowid); --- V4 ALTER TABLE llx_product_fournisseur_price ADD CONSTRAINT fk_product_fournisseur_price_fk_product_fournisseur FOREIGN KEY (fk_product_fournisseur) REFERENCES llx_product_fournisseur (rowid); - --- Nouveau fonctionnement de la table llx_product_fournisseur_price_log --- V4.1 UPDATE llx_product_fournisseur_price_log as pfpl SET pfpl.fk_product = (SELECT pf.rowid FROM llx_product_fournisseur AS pf WHERE pfpl.fk_product = pf.fk_product AND pfpl.fk_soc = pf.fk_soc); -ALTER TABLE llx_product_fournisseur_price_log DROP COLUMN fk_soc; -ALTER TABLE llx_product_fournisseur_price_log CHANGE fk_product fk_product_fournisseur integer NOT NULL; - -ALTER TABLE llx_commande_fournisseurdet MODIFY fk_commande integer NOT NULL; - -ALTER TABLE llx_product ADD COLUMN partnumber varchar(32) after gencode; - -ALTER TABLE llx_element_contact ADD INDEX idx_element_contact_fk_socpeople (fk_socpeople); - --- Supprimme orphelins pour permettre montee de la cle --- V4 DELETE llx_fichinter FROM llx_fichinter LEFT JOIN llx_societe ON llx_fichinter.fk_soc = llx_societe.rowid WHERE llx_societe.rowid IS NULL; - - - -ALTER TABLE llx_societe ADD COLUMN supplier_account varchar(32) after fournisseur; - -drop table if exists llx_c_barcode; - -create table llx_c_barcode_type -( - rowid integer AUTO_INCREMENT PRIMARY KEY, - code varchar(16) NOT NULL, - libelle varchar(50) NOT NULL, - coder integer NOT NULL DEFAULT 0, - example varchar(16) NOT NULL -)ENGINE=innodb; - -INSERT INTO llx_c_barcode_type (rowid, code, libelle, coder, example) VALUES (1, 'EAN8', 'EAN8', 0, '1234567'); -INSERT INTO llx_c_barcode_type (rowid, code, libelle, coder, example) VALUES (2, 'EAN13', 'EAN13', 0, '123456789012'); -INSERT INTO llx_c_barcode_type (rowid, code, libelle, coder, example) VALUES (3, 'UPC', 'UPC', 0, '123456789012'); -INSERT INTO llx_c_barcode_type (rowid, code, libelle, coder, example) VALUES (4, 'ISBN', 'ISBN', 0, '123456789'); -INSERT INTO llx_c_barcode_type (rowid, code, libelle, coder, example) VALUES (5, 'C39', 'Code 39', 0, '1234567890'); -INSERT INTO llx_c_barcode_type (rowid, code, libelle, coder, example) VALUES (6, 'C128', 'Code 128', 0, 'ABCD1234567890'); - -ALTER TABLE llx_product CHANGE gencode barcode varchar(255) DEFAULT NULL; -ALTER TABLE llx_product ADD COLUMN fk_barcode_type integer DEFAULT 0 after barcode; - -create table llx_c_paper_format -( - rowid integer AUTO_INCREMENT PRIMARY KEY, - code varchar(16) NOT NULL, - label varchar(50) NOT NULL, - width float(6,2) DEFAULT 0, - height float(6,2) DEFAULT 0, - unit enum('mm','cm','point','inch') NOT NULL, - active tinyint DEFAULT 1 NOT NULL -)ENGINE=innodb; - -INSERT INTO llx_c_paper_format (rowid, code, label, width, height, unit, active) VALUES (1, '4A0', 'Format 4A0', '1682', '2378', 'mm', 1); -INSERT INTO llx_c_paper_format (rowid, code, label, width, height, unit, active) VALUES (2, '2A0', 'Format 2A0', '1189', '1682', 'mm', 1); -INSERT INTO llx_c_paper_format (rowid, code, label, width, height, unit, active) VALUES (3, 'A0', 'Format A0', '840', '1189', 'mm', 1); -INSERT INTO llx_c_paper_format (rowid, code, label, width, height, unit, active) VALUES (4, 'A1', 'Format A1', '594', '840', 'mm', 1); -INSERT INTO llx_c_paper_format (rowid, code, label, width, height, unit, active) VALUES (5, 'A2', 'Format A2', '420', '594', 'mm', 1); -INSERT INTO llx_c_paper_format (rowid, code, label, width, height, unit, active) VALUES (6, 'A3', 'Format A3', '297', '420', 'mm', 1); -INSERT INTO llx_c_paper_format (rowid, code, label, width, height, unit, active) VALUES (7, 'A4', 'Format A4', '210', '297', 'mm', 1); -INSERT INTO llx_c_paper_format (rowid, code, label, width, height, unit, active) VALUES (8, 'A5', 'Format A5', '148', '210', 'mm', 1); -INSERT INTO llx_c_paper_format (rowid, code, label, width, height, unit, active) VALUES (9, 'A6', 'Format A6', '105', '148', 'mm', 1); - -ALTER TABLE llx_user ADD COLUMN phenix_login varchar(25) after webcal_login; -ALTER TABLE llx_user ADD COLUMN phenix_pass varchar(128) after phenix_login; - -update llx_propal set total_ht = price where total_ht = 0 and total > 0; -update llx_propal set date_livraison = NULL where date_livraison = '1970-01-01 00:00:00'; - -insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (102,'commande','external', 'SHIPPING', 'Contact client livraison commande', 1); - --- Uniformisation du nom. Rem: Cette table n'est pas utilise en lecture a ce jour -drop table llx_socstatutlog; -create table llx_societe_log -( - id integer AUTO_INCREMENT PRIMARY KEY, - datel datetime, - fk_soc integer, - fk_statut integer, - fk_user integer, - author varchar(30), - label varchar(128) -)ENGINE=innodb; - - --- Pour la Tunisie (Formes les plus utilisees) -insert into llx_c_forme_juridique (fk_pays, code, libelle) values (10, '1000','Société à responsabilité limitée SARL'); -insert into llx_c_forme_juridique (fk_pays, code, libelle) values (10, '1001','Société en Nom Collectif'); -insert into llx_c_forme_juridique (fk_pays, code, libelle) values (10, '1002','Société en Commandite Simple'); -insert into llx_c_forme_juridique (fk_pays, code, libelle) values (10, '1003','société en participation'); -insert into llx_c_forme_juridique (fk_pays, code, libelle) values (10, '1004','Société Anonyme SA'); -insert into llx_c_forme_juridique (fk_pays, code, libelle) values (10, '1005','Société Unipersonnelle à Responsabilité Limitée SUARL'); -insert into llx_c_forme_juridique (fk_pays, code, libelle) values (10, '1006','Groupement d\'intérêt économique GEI'); -insert into llx_c_forme_juridique (fk_pays, code, libelle) values (10, '1007','Groupe de sociétés'); - --- Regions de Tunisie (id pays=10) -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (1001,10,1001, '',0,'Ariana'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (1002,10,1002, '',0,'Béja'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (1003,10,1003, '',0,'Ben Arous'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (1004,10,1004, '',0,'Bizerte'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (1005,10,1005, '',0,'Gabès'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (1006,10,1006, '',0,'Gafsa'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (1007,10,1007, '',0,'Jendouba'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (1008,10,1008, '',0,'Kairouan'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (1009,10,1009, '',0,'Kasserine'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (1010,10,1010, '',0,'Kèbili'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (1011,10,1011, '',0,'La Manouba'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (1012,10,1012, '',0,'Le Kef'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (1013,10,1013, '',0,'Mahdia'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (1014,10,1014, '',0,'Médenine'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (1015,10,1015, '',0,'Monastir'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (1016,10,1016, '',0,'Nabeul'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (1017,10,1017, '',0,'Sfax'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (1018,10,1018, '',0,'Sidi Bouzid'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (1019,10,1019, '',0,'Siliana'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (1020,10,1020, '',0,'Sousse'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (1021,10,1021, '',0,'Tataouine'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (1022,10,1022, '',0,'Tozeur'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (1023,10,1023, '',0,'Tunis'); -insert into llx_c_regions (rowid,fk_pays,code_region,cheflieu,tncc,nom) values (1024,10,1024, '',0,'Zaghouan'); - --- TUNISIE (id 10) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (101,10, '6','0','TVA 6%',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (102,10, '12','0','TVA 12%',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (103,10, '18','0','VAT 18%',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (104,10, '7.5','0','TVA 6% Majoré à 25% (7.5%)',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (105,10, '15','0','TVA 12% Majoré à 25% (15%)',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (106,10, '22.5','0','VAT 18% Majoré à 25% (22.5%)',1); - --- GUADELOUPE (id 105) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 111, 105, '8.5','0','VAT Rate 8.5',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 112, 105, '8.5','1','VAT Rate 8.5 non perçu par le vendeur mais récupérable par l\'acheteur',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 113, 105, '0','0','VAT Rate 0 ou non applicable',1); - --- MARTINIQUE (id 150) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 121, 150, '8.5','0','VAT Rate 8.5',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 122, 150, '8.5','1','VAT Rate 8.5 non perçu par le vendeur mais récupérable par l\'acheteur',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 123, 150, '0','0','VAT Rate 0 ou non applicable',1); - --- REUNION (id 187) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 131, 187, '8.5','0','VAT Rate 8.5',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 132, 187, '8.5','1','VAT Rate 8.5 non perçu par le vendeur mais récupérable par l\'acheteur',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 133, 187, '0','0','VAT Rate 0 ou non applicable',1); - -ALTER TABLE llx_bank_account MODIFY iban_prefix varchar(50); -ALTER TABLE llx_bank_account ADD COLUMN country_iban varchar(2) after iban_prefix; -ALTER TABLE llx_bank_account ADD COLUMN cle_iban varchar(2) after country_iban; - - --- Mise a jour des pays -update llx_c_pays set libelle = 'Palaos' where rowid = 176 and code = 'PW' and libelle = 'Belau'; -update llx_c_pays set libelle = 'Serbie' where rowid = 198 and code = 'CS'; -update llx_c_pays set code = 'RS' where rowid = 198 and code = 'CS'; -insert into llx_c_pays (rowid,code,libelle) values (241, 'GG', 'Guernesey' ); -insert into llx_c_pays (rowid,code,libelle) values (242, 'IM', 'Ile de Man' ); -insert into llx_c_pays (rowid,code,libelle) values (243, 'JE', 'Jersey' ); -insert into llx_c_pays (rowid,code,libelle) values (244, 'ME', 'Monténégro' ); -insert into llx_c_pays (rowid,code,libelle) values (245, 'BL', 'Saint-Barthélemy'); -insert into llx_c_pays (rowid,code,libelle) values (246, 'MF', 'Saint-Martin' ); - - -ALTER TABLE llx_boxes ADD UNIQUE INDEX uk_boxes (box_id, position, fk_user); - --- Nettoyage vieux enregistrement detail pourris -delete from llx_facturedet where price = 0 and subprice = 0 and remise_percent = 0 and total_ttc = 0 and total_ht = 0; - - --- Drop constraints to allow rename -ALTER TABLE llx_societe_remise_except drop foreign key fk_societe_remise_fk_facture; -ALTER TABLE llx_societe_remise_except drop index idx_societe_remise_except_fk_facture; - --- Rename field -ALTER TABLE llx_societe_remise_except change fk_facture fk_facture_line integer; -ALTER TABLE llx_societe_remise_except add fk_facture integer after fk_facture_line; - --- Create constraints -ALTER TABLE llx_societe_remise_except ADD INDEX idx_societe_remise_except_fk_facture_line (fk_facture_line); -ALTER TABLE llx_societe_remise_except ADD INDEX idx_societe_remise_except_fk_facture (fk_facture); -ALTER TABLE llx_societe_remise_except ADD CONSTRAINT fk_societe_remise_fk_facture_line FOREIGN KEY (fk_facture_line) REFERENCES llx_facturedet (rowid); -ALTER TABLE llx_societe_remise_except ADD CONSTRAINT fk_societe_remise_fk_facture FOREIGN KEY (fk_facture) REFERENCES llx_facture (rowid); - --- Corrige statut des avoirs qui ont ete transforme en reduc et pour lesquels la reduc a ete ensuite supprimee --- V4.1 update llx_facture set paye=0, fk_statut=1 where paye=1 and type=2 and rowid not in (select fk_facture_source from llx_societe_remise_except); - --- Corrige avoirs affectes en ligne a affectation sur facture. On met total a null pour permettre recalcul par upgrade2 --- V4.1 update llx_facture set total_ttc = NULL where rowid in (select fk_facture from llx_facturedet where description = '(CREDIT_NOTE)'); --- V4.1 update llx_societe_remise_except as re set re.fk_facture = (select fk_facture from llx_facturedet as fd where fd.rowid = re.fk_facture_line), re.fk_facture_line = NULL where re.fk_facture_line in (select rowid from llx_facturedet where description = '(CREDIT_NOTE)'); --- V4.1 delete from llx_facturedet where description = '(CREDIT_NOTE)'; - -update llx_facture set close_code = 'discount_vat' where close_code = 'escompte'; - -ALTER TABLE llx_commande_fournisseurdet MODIFY fk_product integer; - --- Le prix d'un produit ne doit pas avoir la valeur NULL -UPDATE llx_product SET price = 0 WHERE price is NULL; -UPDATE llx_product SET price_ttc = 0 WHERE price_ttc is NULL; - - --- Not used. Just to be compatible with upgrade process of higher versions -alter table llx_const add column entity integer DEFAULT 1 NOT NULL; --- Not used. Just to be compatible with 2.7 upgrade process or higher -alter table llx_menu add column enabled varchar(255) NULL default '1'; diff --git a/htdocs/install/mysql/migration/2.2.0-2.4.0.sql b/htdocs/install/mysql/migration/2.2.0-2.4.0.sql deleted file mode 100644 index 372131e331c..00000000000 --- a/htdocs/install/mysql/migration/2.2.0-2.4.0.sql +++ /dev/null @@ -1,351 +0,0 @@ --- --- Attention a l ordre des requetes. --- Ce fichier doit etre charge sur une version 2.2.0 --- - -DROP TABLE llx_facture_tva_sum; -DROP TABLE llx_c_ape; - -delete from llx_const where name='MAIN_GRAPH_LIBRARY' and (value like 'phplot%' or value like 'artichow%'); - -ALTER TABLE llx_societe_adresse_livraison ADD COLUMN tel varchar(20) after fk_pays; -ALTER TABLE llx_societe_adresse_livraison ADD COLUMN fax varchar(20) after tel; - -RENAME TABLE llx_c_barcode TO llx_c_barcode_type; - -alter table llx_c_barcode_type modify coder varchar(16) NOT NULL; -update llx_c_barcode_type set coder = 0 where coder in (1,2); - -update llx_const set value='' where name='MAIN_FORCE_SETLOCALE_LC_ALL' and value='MAIN_FORCE_SETLOCALE_LC_ALL'; -update llx_const set value='' where name='MAIN_FORCE_SETLOCALE_LC_MONETARY' and value='MAIN_FORCE_SETLOCALE_LC_MONETARY'; -update llx_const set value='' where name='MAIN_FORCE_SETLOCALE_LC_NUMERIC' and value='MAIN_FORCE_SETLOCALE_LC_NUMERIC'; -update llx_const set value='' where name='MAIN_FORCE_SETLOCALE_LC_TIME' and value='MAIN_FORCE_SETLOCALE_LC_TIME'; - --- remove old deprecated options -update llx_const set name='SOCIETE_CODECLIENT_ADDON' where name='CODECLIENT_ADDON'; -update llx_const set name='SOCIETE_CODEFOURNISSEUR_ADDON' where name='CODEFOURNISSEUR_ADDON'; -delete from llx_const where name='CODECLIENT_ADDON'; -delete from llx_const where name='CODEFOURNISSEUR_ADDON'; - -alter table llx_const add tms timestamp; -update llx_const set tms=sysdate() where tms is null; -update llx_const set tms=sysdate() where tms <= 0; - - -alter table llx_document_model modify type varchar(20) NOT NULL; - -DELETE FROM llx_rights_def WHERE module = 'menudb'; - -ALTER table llx_boxes_def drop column name; -ALTER table llx_boxes_def add column tms timestamp; - --- Rename primary key of llx_menu -ALTER TABLE llx_menu_const drop foreign key fk_menu_const_fk_menu; -alter table llx_menu drop primary key; -alter table llx_menu modify rowid integer AUTO_INCREMENT NOT NULL PRIMARY KEY; -ALTER TABLE llx_menu_const ADD CONSTRAINT fk_menu_const_fk_menu FOREIGN KEY (fk_menu) REFERENCES llx_menu (rowid); - -alter table llx_menu modify user integer NOT NULL default '0'; -alter table llx_menu change `order` position integer NOT NULL; -alter table llx_menu change `right` perms varchar(255); -alter table llx_menu add column module varchar(64) after menu_handler; -alter table llx_menu add column tms timestamp; - --- Add a unique key -update llx_menu set url='/comm/prospect/prospects.php?leftmenu=prospects' where rowid=702 and url='/contact/index.php?leftmenu=prospects&type=p'; -ALTER TABLE llx_menu ADD UNIQUE INDEX idx_menu_uk_menu (menu_handler, fk_menu, url); - --- Drop unused table -drop table if exists llx_so_gr; - --- Modification expedition -create table llx_co_exp -( - rowid integer AUTO_INCREMENT PRIMARY KEY, - fk_commande integer NOT NULL, - fk_expedition integer NOT NULL, - - key(fk_commande), - key(fk_expedition) -)ENGINE=innodb; - --- V4 ALTER TABLE llx_expedition DROP INDEX fk_expedition_methode; --- V4 ALTER TABLE llx_expedition DROP INDEX fk_commande; --- V4 ALTER TABLE llx_expedition DROP INDEX ref; --- V4 ALTER TABLE llx_expeditiondet DROP INDEX fk_expedition; --- V4 ALTER TABLE llx_expeditiondet DROP INDEX fk_commande_ligne; - --- V4.1 update llx_commande set fk_adresse_livraison = null where fk_adresse_livraison is not null and fk_adresse_livraison not in (select rowid from llx_societe_adresse_livraison); --- V4.1 delete from llx_expeditiondet where fk_expedition not in (select rowid from llx_expedition); --- V4.1 delete from llx_livraisondet where fk_livraison not in (select rowid from llx_livraison); - -alter table llx_expedition add column fk_soc integer NOT NULL after ref; -alter table llx_expedition add column fk_adresse_livraison integer DEFAULT NULL after date_expedition; --- V4.1 UPDATE llx_expedition as e SET e.fk_soc = (SELECT c.fk_soc FROM llx_commande AS c WHERE e.fk_commande = c.rowid); --- V4.1 UPDATE llx_expedition as e SET e.fk_adresse_livraison = (SELECT c.fk_adresse_livraison FROM llx_commande AS c WHERE e.fk_commande = c.rowid); -update llx_expedition set fk_adresse_livraison=NULL where fk_adresse_livraison = 0; - -ALTER TABLE llx_expedition ADD INDEX idx_expedition_fk_soc (fk_soc); -ALTER TABLE llx_expedition ADD INDEX idx_expedition_fk_user_author (fk_user_author); -ALTER TABLE llx_expedition ADD INDEX idx_expedition_fk_user_valid (fk_user_valid); -ALTER TABLE llx_expedition ADD INDEX idx_expedition_fk_adresse_livraison (fk_adresse_livraison); -ALTER TABLE llx_expedition ADD INDEX idx_expedition_fk_expedition_methode (fk_expedition_methode); --- V4 ALTER TABLE llx_expedition ADD CONSTRAINT fk_expedition_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe (rowid); --- V4 ALTER TABLE llx_expedition ADD CONSTRAINT fk_expedition_fk_user_author FOREIGN KEY (fk_user_author) REFERENCES llx_user (rowid); --- V4 ALTER TABLE llx_expedition ADD CONSTRAINT fk_expedition_fk_user_valid FOREIGN KEY (fk_user_valid) REFERENCES llx_user (rowid); --- V4 ALTER TABLE llx_expedition ADD CONSTRAINT fk_expedition_fk_adresse_livraison FOREIGN KEY (fk_adresse_livraison) REFERENCES llx_societe_adresse_livraison (rowid); --- V4 ALTER TABLE llx_expedition ADD CONSTRAINT fk_expedition_fk_expedition_methode FOREIGN KEY (fk_expedition_methode) REFERENCES llx_expedition_methode (rowid); -ALTER TABLE llx_expedition ADD UNIQUE INDEX idx_expedition_uk_ref (ref); - -ALTER TABLE llx_expeditiondet CHANGE fk_commande_ligne fk_origin_line integer; -ALTER TABLE llx_expeditiondet ADD COLUMN fk_entrepot integer after fk_origin_line; -ALTER TABLE llx_expeditiondet ADD COLUMN rang integer DEFAULT 0 after qty; --- V4.1 UPDATE llx_expeditiondet as ed SET ed.fk_entrepot = (SELECT e.fk_entrepot FROM llx_expedition AS e WHERE ed.fk_expedition = e.rowid); -ALTER TABLE llx_expedition DROP COLUMN fk_entrepot; - -ALTER TABLE llx_expeditiondet ADD INDEX idx_expeditiondet_fk_expedition (fk_expedition); -ALTER TABLE llx_expeditiondet ADD INDEX idx_expeditiondet_fk_entrepot (fk_entrepot); --- V4 ALTER TABLE llx_expeditiondet ADD CONSTRAINT fk_expeditiondet_fk_expedition FOREIGN KEY (fk_expedition) REFERENCES llx_expedition (rowid); --- V4 ALTER TABLE llx_expeditiondet ADD CONSTRAINT fk_expeditiondet_fk_entrepot FOREIGN KEY (fk_entrepot) REFERENCES llx_entrepot (rowid); - --- Modification livraison -create table llx_co_liv -( - rowid integer AUTO_INCREMENT PRIMARY KEY, - fk_commande integer NOT NULL, - fk_livraison integer NOT NULL, - - key(fk_commande), - key(fk_livraison) -)ENGINE=innodb; - --- V4 ALTER TABLE llx_livraison DROP INDEX fk_commande; --- V4 ALTER TABLE llx_livraison DROP INDEX ref; --- V4 ALTER TABLE llx_livraisondet DROP INDEX fk_livraison; --- V4 ALTER TABLE llx_livraisondet DROP INDEX fk_commande_ligne; -ALTER TABLE llx_livraison DROP COLUMN total_ttc; - -ALTER TABLE llx_livraison add column total_ht double(24,8) DEFAULT 0; -ALTER TABLE llx_livraison MODIFY total_ht double(24,8) DEFAULT 0; -ALTER TABLE llx_livraison MODIFY fk_adresse_livraison integer DEFAULT NULL; -alter table llx_livraison add column ref_client varchar(30) after ref; -alter table llx_livraison add column fk_soc integer NOT NULL after ref_client; -UPDATE llx_livraison SET fk_adresse_livraison = NULL WHERE fk_adresse_livraison = 0; --- V4.1 UPDATE llx_livraison as l SET l.fk_soc = (SELECT c.fk_soc FROM llx_commande AS c WHERE l.fk_commande = c.rowid); - -ALTER TABLE llx_livraison ADD INDEX idx_livraison_fk_soc (fk_soc); -ALTER TABLE llx_livraison ADD INDEX idx_livraison_fk_user_author (fk_user_author); -ALTER TABLE llx_livraison ADD INDEX idx_livraison_fk_user_valid (fk_user_valid); -ALTER TABLE llx_livraison ADD INDEX idx_livraison_fk_adresse_livraison (fk_adresse_livraison); --- V4 ALTER TABLE llx_livraison ADD CONSTRAINT fk_livraison_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe (rowid); --- V4 ALTER TABLE llx_livraison ADD CONSTRAINT fk_livraison_fk_user_author FOREIGN KEY (fk_user_author) REFERENCES llx_user (rowid); --- V4 ALTER TABLE llx_livraison ADD CONSTRAINT fk_livraison_fk_user_valid FOREIGN KEY (fk_user_valid) REFERENCES llx_user (rowid); --- V4 ALTER TABLE llx_livraison ADD CONSTRAINT fk_livraison_fk_adresse_livraison FOREIGN KEY (fk_adresse_livraison) REFERENCES llx_societe_adresse_livraison (rowid); -ALTER TABLE llx_livraison ADD UNIQUE INDEX idx_livraison_uk_ref (ref); - -alter table llx_livraisondet add column fk_product integer after fk_livraison; -alter table llx_livraisondet add column description text after fk_product; -alter table llx_livraisondet add column subprice double(24,8) DEFAULT 0 after qty; -alter table llx_livraisondet add column total_ht double(24,8) DEFAULT 0 after subprice; -alter table llx_livraisondet add column rang integer DEFAULT 0 after total_ht; - -ALTER TABLE llx_livraisondet ADD INDEX idx_livraisondet_fk_expedition (fk_livraison); --- V4 ALTER TABLE llx_livraisondet ADD CONSTRAINT fk_livraisondet_fk_livraison FOREIGN KEY (fk_livraison) REFERENCES llx_livraison (rowid); - -create table llx_pr_exp -( - rowid integer AUTO_INCREMENT PRIMARY KEY, - fk_propal integer NOT NULL, - fk_expedition integer NOT NULL, - - key(fk_propal), - key(fk_expedition) -)ENGINE=innodb; - -create table llx_pr_liv -( - rowid integer AUTO_INCREMENT PRIMARY KEY, - fk_propal integer NOT NULL, - fk_livraison integer NOT NULL, - - key(fk_propal), - key(fk_livraison) -)ENGINE=innodb; - -ALTER TABLE llx_paiement modify fk_bank integer NOT NULL DEFAULT 0; - - -create table llx_element_element -( - rowid integer AUTO_INCREMENT PRIMARY KEY, - sourceid integer NOT NULL, - sourcetype varchar(12) NOT NULL, - targetid integer NOT NULL, - targettype varchar(12) NOT NULL -) ENGINE=innodb; - - -ALTER TABLE llx_element_element - ADD UNIQUE INDEX idx_element_element_idx1 (sourceid, sourcetype, targetid, targettype); - -ALTER TABLE llx_element_element ADD INDEX idx_element_element_targetid (targetid); - - -ALTER TABLE llx_actioncomm add column fk_user_mod integer after fk_user_author; -ALTER TABLE llx_actioncomm add column fk_user_done integer after fk_user_action; - ---drop table if exists llx_events; -create table llx_events -( - rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, - type varchar(32) NOT NULL, - dateevent datetime, - fk_user integer, - description varchar(250) NOT NULL, - ip varchar(32) NOT NULL, - fk_object integer -) ENGINE=innodb; - - -ALTER TABLE llx_events ADD INDEX idx_events_dateevent (dateevent); - -ALTER TABLE llx_c_forme_juridique ADD isvatexempted tinyint DEFAULT 0 NOT NULL after libelle; - -ALTER TABLE llx_facturedet ADD product_type integer DEFAULT NULL after total_ttc; -ALTER TABLE llx_facture_fourn_det ADD product_type integer DEFAULT NULL after total_ttc; - --- V4.1 update llx_facturedet set product_type = 0 where fk_product in (select rowid from llx_product where fk_product_type = 0); --- V4.1 update llx_facture_fourn_det set product_type = 0 where fk_product in (select rowid from llx_product where fk_product_type = 0); --- V4.1 update llx_facturedet set product_type = 1 where fk_product in (select rowid from llx_product where fk_product_type = 1); --- V4.1 update llx_facture_fourn_det set product_type = 1 where fk_product in (select rowid from llx_product where fk_product_type = 1); --- V4.1 update llx_facturedet set product_type = 1 where product_type is null; --- V4.1 update llx_facture_fourn_det set product_type = 1 where product_type is null; - -create table llx_c_prospectlevel -( - code varchar(12) PRIMARY KEY, - label varchar(30), - sortorder smallint, - active smallint DEFAULT 1 NOT NULL -) ENGINE=innodb; - -insert into llx_c_prospectlevel (code,label,sortorder) values ('PL_UNKOWN', 'Unknown', 1); -insert into llx_c_prospectlevel (code,label,sortorder) values ('PL_LOW', 'Low', 2); -insert into llx_c_prospectlevel (code,label,sortorder) values ('PL_MEDIUM', 'Medium', 3); -insert into llx_c_prospectlevel (code,label,sortorder) values ('PL_HIGH', 'High', 4); - - -alter table llx_societe add column fk_prospectlevel varchar(12) after fournisseur; -alter table llx_societe modify tva_assuj tinyint DEFAULT 1; - - ---update llx_actioncomm set datea = datep where datea is null and percent = 100; ---update llx_actioncomm set datea2 = datea where datea2 is null and percent = 100; -update llx_actioncomm set datep = datea where datep is null and datea is not null; -update llx_actioncomm set datep = datec where datep is null and datea is null; -update llx_actioncomm set datep2 = datep where datep2 is null and percent = 100; - - -alter table llx_projet modify fk_soc integer; - -update llx_rights_def set module='societe' where module='commercial' and perms='client' and subperms='voir'; - -insert into llx_c_chargesociales (id, libelle, deductible, active, actioncompta) values (25, 'Impots revenus', 0,1,'TAXREV'); - -alter table llx_socpeople add priv smallint NOT NULL DEFAULT 0 after jabberid; - -alter table llx_tva modify fk_bank integer; - -delete from llx_const where name='MAIN_USE_PREVIEW_TABS'; - -alter table llx_menu_const drop column user; -update llx_menu set leftmenu = '1' where leftmenu != '0'; -alter table llx_menu modify leftmenu varchar(1) default '1'; - - -create table llx_ecm_directories -( - rowid integer AUTO_INCREMENT PRIMARY KEY, - label varchar(32) NOT NULL, - fk_parent integer, - description varchar(255) NOT NULL, - cachenbofdoc integer NOT NULL DEFAULT 0, - date_c datetime, - date_m timestamp, - fk_user_c integer, - fk_user_m integer -) ENGINE=innodb; - -create table llx_ecm_documents -( - rowid integer AUTO_INCREMENT PRIMARY KEY, - ref varchar(16) NOT NULL, - filename varchar(255) NOT NULL, - filesize integer 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 integer NOT NULL, - fk_update integer, - date_c datetime NOT NULL, - date_u timestamp, - fk_directory integer, - fk_status smallint DEFAULT 0, - private smallint DEFAULT 0 -) ENGINE=innodb; - -ALTER TABLE llx_bank modify num_chq varchar(50); - -ALTER TABLE llx_menu_const ADD UNIQUE KEY uk_menu_const(fk_menu, fk_constraint); - -INSERT INTO llx_c_paper_format (rowid, code, label, width, height, unit, active) VALUES (100, 'USLetter', 'Format Letter (A)', '216', '279', 'mm', 0); -INSERT INTO llx_c_paper_format (rowid, code, label, width, height, unit, active) VALUES (105, 'USLegal', 'Format Legal', '216', '356', 'mm', 0); -INSERT INTO llx_c_paper_format (rowid, code, label, width, height, unit, active) VALUES (110, 'USExecutive', 'Format Executive', '190', '254', 'mm', 0); -INSERT INTO llx_c_paper_format (rowid, code, label, width, height, unit, active) VALUES (115, 'USLedger', 'Format Ledger/Tabloid (B)', '279', '432', 'mm', 0); - -INSERT INTO llx_c_paper_format (rowid, code, label, width, height, unit, active) VALUES (200, 'Canadian P1', 'Format Canadian P1', '560', '860', 'mm', 0); -INSERT INTO llx_c_paper_format (rowid, code, label, width, height, unit, active) VALUES (205, 'Canadian P2', 'Format Canadian P2', '430', '560', 'mm', 0); -INSERT INTO llx_c_paper_format (rowid, code, label, width, height, unit, active) VALUES (210, 'Canadian P3', 'Format Canadian P3', '280', '430', 'mm', 0); -INSERT INTO llx_c_paper_format (rowid, code, label, width, height, unit, active) VALUES (215, 'Canadian P4', 'Format Canadian P4', '215', '280', 'mm', 0); -INSERT INTO llx_c_paper_format (rowid, code, label, width, height, unit, active) VALUES (220, 'Canadian P5', 'Format Canadian P5', '140', '215', 'mm', 0); -INSERT INTO llx_c_paper_format (rowid, code, label, width, height, unit, active) VALUES (225, 'Canadian P6', 'Format Canadian P6', '107', '140', 'mm', 0); - -ALTER TABLE llx_commande_fournisseurdet DROP COLUMN price; - -alter table llx_adherent modify fk_user_mod integer; -alter table llx_adherent modify fk_user_valid integer; - -create table llx_c_type_fees -( - id integer AUTO_INCREMENT PRIMARY KEY, - code varchar(12) UNIQUE NOT NULL, - libelle varchar(30), - active tinyint DEFAULT 1 NOT NULL -)ENGINE=innodb; - - -alter table llx_deplacement modify type varchar(12) NOT NULL; -alter table llx_deplacement modify km real; - -insert into llx_c_type_fees (code,libelle,active) values ('TF_OTHER', 'Other', 1); -insert into llx_c_type_fees (code,libelle,active) values ('TF_TRIP', 'Trip', 1); -insert into llx_c_type_fees (code,libelle,active) values ('TF_LUNCH', 'Lunch', 1); - -drop table llx_comfourn_facfourn; - -alter table llx_element_element modify sourcetype varchar(16) NOT NULL; -alter table llx_element_element modify targettype varchar(16) NOT NULL; - -update llx_societe set fk_typent = 0 where fk_typent is null; - -ALTER TABLE llx_surveys_answers_summary ENGINE=innodb; - - --- Not used. Just to be compatible with upgrade process of higher versions -alter table llx_const add column entity integer DEFAULT 1 NOT NULL; --- Not used. Just to be compatible with 2.7 upgrade process or higher -alter table llx_menu add column enabled varchar(255) NULL default '1'; - diff --git a/htdocs/install/mysql/migration/2.4.0-2.5.0.sql b/htdocs/install/mysql/migration/2.4.0-2.5.0.sql deleted file mode 100644 index 36d78dac859..00000000000 --- a/htdocs/install/mysql/migration/2.4.0-2.5.0.sql +++ /dev/null @@ -1,115 +0,0 @@ --- --- Be carefull to requests order. --- This file must be loaded by calling /install/index.php page --- when current version is 2.4.0 or higher. --- - -alter table llx_product add column price_min double(24,8) DEFAULT 0; -alter table llx_product add column price_min_ttc double(24,8) DEFAULT 0; -alter table llx_product add column finished tinyint DEFAULT NULL after canvas; - -alter table llx_product_price add column price_min double(24,8) default NULL; -alter table llx_product_price add column price_min_ttc double(24,8) default NULL; - -alter table llx_societe add column gencod varchar(255); - -delete from llx_user_param where page <> ''; - -alter table llx_expedition add column tracking_number varchar(50) after fk_expedition_methode; - -alter table llx_actioncomm add column location varchar(128) after percent; - --- remove enum type -alter table llx_adherent_type modify column cotisation varchar(3) NOT NULL DEFAULT 'yes'; -alter table llx_adherent_type modify column vote varchar(3) NOT NULL DEFAULT 'yes'; -alter table llx_adherent modify column morphy varchar(3) NOT NULL; -alter table llx_c_paper_format modify column unit varchar(5) NOT NULL; -alter table llx_const modify column type varchar(6); -alter table llx_menu modify column type varchar(4) NOT NULL; -alter table llx_notify modify column objet_type varchar(24) NOT NULL; -alter table llx_projet_task_actors modify column role varchar(5) DEFAULT 'admin'; -alter table llx_projet_task modify column statut varchar(6) DEFAULT 'open'; -alter table llx_rights_def modify column type varchar(1); - -ALTER TABLE llx_menu ADD COLUMN enabled varchar(255) NULL default '1' after perms; - -ALTER TABLE `llx_commandedet` ADD column `date_start` DATETIME DEFAULT NULL, ADD `date_end` DATETIME DEFAULT NULL ; - -alter table llx_categorie add column fk_soc integer DEFAULT NULL after description; - -alter table llx_product drop column nbvente; - -alter table llx_product add column import_key varchar(14); -alter table llx_socpeople add column import_key varchar(14); -alter table llx_facture add column import_key varchar(14); -alter table llx_facturedet add column import_key varchar(14); -alter table llx_commande add column import_key varchar(14); -alter table llx_commandedet add column import_key varchar(14); -alter table llx_facture_fourn add column import_key varchar(14); -alter table llx_facture_fourn_det add column import_key varchar(14); - -alter table llx_commande modify column source smallint NULL; - -update llx_c_prospectlevel set code='PL_NONE', label='None' where code='PL_UNKOWN' or code='PL_NONE'; - -update llx_societe set fk_prospectlevel=null where fk_prospectlevel='PL_UNKOWN'; - -alter table llx_expedition add height integer; -alter table llx_expedition add width integer; -alter table llx_expedition add size_units integer; -alter table llx_expedition add size integer; -alter table llx_expedition add weight_units integer; -alter table llx_expedition add weight integer; - -ALTER TABLE llx_paiement_facture ADD UNIQUE INDEX uk_paiement_facture(fk_paiement, fk_facture); -ALTER TABLE llx_paiementfourn_facturefourn ADD UNIQUE INDEX uk_paiementfourn_facturefourn(fk_paiementfourn, fk_facturefourn); - -update llx_expedition_methode set code='ENL', libelle='Enlevement' where code='enlevement'; -update llx_expedition_methode set code='TRANS', libelle='Transporteur' where code='transporteur'; - -alter table llx_fichinterdet modify date datetime; - -alter table llx_don modify fk_don_projet integer NULL; -alter table llx_don modify fk_user_valid integer NULL; -alter table llx_don add note_public text; -alter table llx_don add model_pdf varchar(50); -alter table llx_don add import_key varchar(14); - -ALTER TABLE llx_export_model DROP INDEX uk_export_model; -ALTER TABLE llx_export_model ADD UNIQUE uk_export_model (label,type); - -alter table llx_adherent_options_label add column type varchar(8); -alter table llx_adherent_options_label add column size integer DEFAULT 0; -alter table llx_adherent_options_label add column pos integer DEFAULT 0; - --- Reverse option -update llx_const set visible = 1, name = 'FACTURE_ENABLE_RECUR', value='1' where name = 'FACTURE_DISABLE_RECUR' and value = '0'; -delete from llx_const where name = 'FACTURE_DISABLE_RECUR' and value = '1'; -delete from llx_const where name like 'MAIN_FASTSEARCH_%'; - -alter table llx_bank_account modify comment text; - -update llx_bank_account set ref = label where ref is null or ref = ''; - --- 2.5.1 -update llx_actioncomm set datep = datea where datep is null; - - -insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (70, 'facture_fourn', 'internal', 'SALESREPFOLL', 'Responsable suivi du paiement', 1); -insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (71, 'facture_fourn', 'external', 'BILLING', 'Contact fournisseur facturation', 1); -insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (72, 'facture_fourn', 'external', 'SHIPPING', 'Contact fournisseur livraison', 1); -insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (73, 'facture_fourn', 'external', 'SERVICE', 'Contact fournisseur prestation', 1); - -alter table llx_product_stock add column pmp double(24,8) default 0 NOT NULL; - -alter table llx_expedition_methode change statut active tinyint DEFAULT 1; - -INSERT INTO llx_expedition_methode (rowid,code,libelle,description,active) VALUES (1,'CATCH','Catch','Catch by client',1); -INSERT INTO llx_expedition_methode (rowid,code,libelle,description,active) VALUES (2,'TRANS','Transporter','Generic transporter',1); -INSERT INTO llx_expedition_methode (rowid,code,libelle,description,active) VALUES (3,'COLSUI','Colissimo Suivi','Colissimo Suivi',0); - - --- Not used. Just to be compatible with upgrade process of higher versions -alter table llx_const add column entity integer DEFAULT 1 NOT NULL; --- Not used. Just to be compatible with 2.7 upgrade process or higher -alter table llx_menu add column enabled varchar(255) NULL default '1'; diff --git a/htdocs/install/mysql/migration/2.5.0-2.6.0.sql b/htdocs/install/mysql/migration/2.5.0-2.6.0.sql deleted file mode 100644 index 5bfc011e579..00000000000 --- a/htdocs/install/mysql/migration/2.5.0-2.6.0.sql +++ /dev/null @@ -1,139 +0,0 @@ --- --- Be carefull to requests order. --- This file must be loaded by calling /install/index.php page --- when current version is 2.5.0 or higher. --- - -insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (140,'order_supplier','internal', 'SALESREPFOLL', 'Responsable suivi de la commande', 1); -insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (141,'order_supplier','internal', 'SHIPPING', 'Responsable reception de la commande', 1); -insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (142,'order_supplier','external', 'BILLING', 'Contact fournisseur facturation commande', 1); -insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (143,'order_supplier','external', 'CUSTOMER', 'Contact fournisseur suivi commande', 1); -insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (145,'order_supplier','external', 'SHIPPING', 'Contact fournisseur livraison commande', 1); - -update llx_const set visible = 1 where name = 'PROPALE_ADD_DELIVERY_ADDRESS'; - -delete from llx_const where name like 'MAIN_LOGEVENTS_%' and name not like 'MAIN_LOGEVENTS_USER%' and name not like 'MAIN_LOGEVENTS_GROUP%'; -delete from llx_events where type not like 'USER%' and type not like 'GROUP%'; - -alter table llx_expedition_methode change statut active tinyint DEFAULT 1; - -update llx_actioncomm set datep = datea where datep is null; - - -INSERT INTO llx_expedition_methode (rowid,code,libelle,description,active) VALUES (1,'CATCH','Catch','Catch by client',1); -INSERT INTO llx_expedition_methode (rowid,code,libelle,description,active) VALUES (2,'TRANS','Transporter','Generic transporter',1); -INSERT INTO llx_expedition_methode (rowid,code,libelle,description,active) VALUES (3,'COLSUI','Colissimo Suivi','Colissimo Suivi',0); -UPDATE llx_expedition_methode set code='CATCH', libelle='Catch', description='Catch by client' where rowid=1; -UPDATE llx_expedition_methode set code='TRANS', libelle='Transporter', description='Generic transporter' where rowid=2; -UPDATE llx_expedition_methode set code='COLSUI', libelle='Colissimo Suivi', description='Colissimo Suivi' where rowid=3; - - -insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (70, 'facture_fourn', 'internal', 'SALESREPFOLL', 'Responsable suivi du paiement', 1); -insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (71, 'facture_fourn', 'external', 'BILLING', 'Contact fournisseur facturation', 1); -insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (72, 'facture_fourn', 'external', 'SHIPPING', 'Contact fournisseur livraison', 1); -insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (73, 'facture_fourn', 'external', 'SERVICE', 'Contact fournisseur prestation', 1); - -alter table llx_product_stock add column pmp double(24,8) default 0 NOT NULL; -alter table llx_product add column pmp double(24,8) default 0 NOT NULL; - -alter table llx_product_stock modify column reel real; - -ALTER TABLE llx_bank ADD INDEX idx_bank_datev(datev); -ALTER TABLE llx_bank ADD INDEX idx_bank_dateo(dateo); -ALTER TABLE llx_bank ADD INDEX idx_bank_fk_account(fk_account); -ALTER TABLE llx_bank ADD INDEX idx_bank_rappro(rappro); - - -ALTER TABLE llx_mailing_cibles add column other varchar(255) NULL; - -ALTER TABLE llx_mailing_cibles ADD INDEX idx_mailing_cibles_email (email); - -ALTER TABLE llx_categorie ADD INDEX idx_categorie_type (type); - -ALTER TABLE llx_product drop column stock_propale; -ALTER TABLE llx_product drop column stock_commande; -ALTER TABLE llx_product add column stock integer after import_key; - -ALTER TABLE llx_product ADD INDEX idx_product_barcode (barcode); -ALTER TABLE llx_product ADD INDEX idx_product_import_key (import_key); - -ALTER TABLE llx_adherent drop index login; -ALTER TABLE llx_adherent ADD UNIQUE INDEX uk_adherent_login (login); - -ALTER TABLE llx_adherent add column fk_soc integer NULL after societe; -ALTER TABLE llx_adherent ADD INDEX idx_adherent_fk_soc (fk_soc); -ALTER TABLE llx_adherent ADD CONSTRAINT adherent_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe (rowid); -ALTER TABLE llx_adherent modify column fk_user_author integer NULL; - -ALTER TABLE llx_societe drop column rubrique; - --- SAINT PIERRE ET MIQUELON -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1931,193, '0','0','No VAT in SPM',1); - --- SAINT MARTIN -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (2461,246, '0','0','VAT Rate 0',1); - - -insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'35','Regime auto-entrepreneur'); - - -alter table llx_user_param drop column page; - -alter table llx_commande_fournisseur_log add column comment varchar(255) NULL; - -delete from llx_categorie_association where fk_categorie_mere = fk_categorie_fille; - - -alter table llx_societe add price_level tinyint(4) NULL; - -delete from llx_document_model where nom = 'huitre' and type = 'invoice'; - -drop table llx_don_projet; - -alter table llx_facture_fourn_det add column date_start datetime DEFAULT NULL; -alter table llx_facture_fourn_det add column date_end datetime DEFAULT NULL; - -alter table llx_commandedet add column product_type integer DEFAULT 0 after total_ttc; - -alter table llx_propaldet add column product_type integer DEFAULT 0 after total_ttc; -alter table llx_propaldet add column date_start datetime DEFAULT NULL after product_type; -alter table llx_propaldet add column date_end datetime DEFAULT NULL after date_start; - -alter table llx_commande_fournisseurdet add column product_type integer DEFAULT 0 after total_ttc; -alter table llx_commande_fournisseurdet add column date_start datetime DEFAULT NULL after product_type; -alter table llx_commande_fournisseurdet add column date_end datetime DEFAULT NULL after date_start; -alter table llx_commande_fournisseur drop column product_type; -alter table llx_commande_fournisseur drop column date_start; -alter table llx_commande_fournisseur drop column date_end; - -drop table llx_models; - --- V4.1 delete from llx_projet_task where fk_projet not in (select rowid from llx_projet); --- V4.1 ALTER TABLE llx_projet_task ADD CONSTRAINT fk_projet_task_fk_projet FOREIGN KEY (fk_projet) REFERENCES llx_projet (rowid); - -ALTER TABLE llx_adherent modify fk_adherent_type integer NOT NULL; -ALTER TABLE llx_adherent ADD INDEX idx_adherent_fk_adherent_type (fk_adherent_type); --- V4.1 delete from llx_adherent where fk_adherent_type not in (select rowid from llx_adherent_type); --- V4.1 ALTER TABLE llx_adherent ADD CONSTRAINT fk_adherent_adherent_type FOREIGN KEY (fk_adherent_type) REFERENCES llx_adherent_type (rowid); - --- Put at the end. Cas have duplicate values -ALTER TABLE llx_categorie_association drop index idx_categorie_association_fk_categorie_fille; -ALTER TABLE llx_categorie_association ADD UNIQUE INDEX uk_categorie_association (fk_categorie_mere, fk_categorie_fille); -ALTER TABLE llx_categorie_association ADD UNIQUE INDEX uk_categorie_association_fk_categorie_fille (fk_categorie_fille); - --- Multi company -ALTER TABLE llx_const ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER name; -ALTER TABLE llx_user ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER login; -ALTER TABLE llx_usergroup ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER nom; - -ALTER TABLE llx_const DROP INDEX name; -ALTER TABLE llx_user DROP INDEX uk_user_login; -ALTER TABLE llx_usergroup DROP INDEX nom; - -ALTER TABLE llx_const ADD UNIQUE INDEX uk_const (name, entity); -ALTER TABLE llx_user ADD UNIQUE INDEX uk_user_login (login, entity); -ALTER TABLE llx_usergroup ADD UNIQUE INDEX uk_usergroup_name (nom, entity); - - --- Not used. Just to be compatible with 2.7 upgrade process or higher -alter table llx_menu add column enabled varchar(255) NULL default '1'; diff --git a/htdocs/install/mysql/migration/2.6.0-2.7.0.sql b/htdocs/install/mysql/migration/2.6.0-2.7.0.sql deleted file mode 100644 index be3b786e8a7..00000000000 --- a/htdocs/install/mysql/migration/2.6.0-2.7.0.sql +++ /dev/null @@ -1,476 +0,0 @@ --- --- Be carefull to requests order. --- This file must be loaded by calling /install/index.php page --- when current version is 2.6.0 or higher. --- - -alter table llx_tmp_caisse modify fk_tva integer NOT NULL; - -drop table llx_facture_stats; -drop table llx_stock_valorisation; -drop table llx_entrepot_valorisation; -drop table llx_groupesociete_remise; -drop table llx_groupesociete; - -update llx_actioncomm set datep = datec where datep is null and datec is not null; - --- Create new table for import module -create table llx_import_model -( - rowid integer AUTO_INCREMENT PRIMARY KEY, - fk_user integer DEFAULT 0 NOT NULL, - label varchar(50) NOT NULL, - type varchar(20) NOT NULL, - field text NOT NULL -)ENGINE=innodb; - -update llx_bank_url set type='banktransfert' where type='?' and label='(banktransfert)'; - -ALTER TABLE llx_import_model ADD UNIQUE INDEX uk_import_model (label,type); - -delete from llx_const where name = 'FACTURE_ENABLE_RECUR'; - -alter table llx_facturedet_rec add column product_type integer DEFAULT 0 after fk_product; - -alter table llx_c_chargesociales change actioncompta code varchar(12) NOT NULL; -alter table llx_c_chargesociales add column fk_pays integer DEFAULT 1 NOT NULL; - --- Usage of llx_menu_const and llx_menu_constraint is too complicated --- so we made first change to remove it -alter table llx_menu_const drop foreign key fk_menu_const_fk_menu; -update llx_menu_constraint set action = '$conf->societe->enabled' where action = '$conf->commercial->enabled'; - -ALTER TABLE llx_adherent ADD UNIQUE INDEX uk_adherent_fk_soc (fk_soc); - -alter table llx_facture add column tms timestamp after date_valid; -alter table llx_facture_fourn add column tms timestamp after datef; -alter table llx_facture_fourn add column fk_facture_source integer after fk_user_valid; - -update llx_facture set tms = datec where tms <= 0; -update llx_facture_fourn set tms = datec where tms <= 0; - - --- Clean no more required parameters -delete from llx_const where name = 'MAIN_MODULE_COMMERCIAL'; -delete from llx_const where name like 'MAIN_MODULE_%_DIR_OUTPUT'; -delete from llx_const where name like 'MAIN_MODULE_%_DIR_TEMP'; -delete from llx_const where name like 'PRODUIT_CONFIRM_DELETE_LINE'; -delete from llx_const where name = 'MAIN_MODULE_SYSLOG' and entity = 2; -delete from llx_const where name = 'SYSLOG_FILE' and entity = 2; -delete from llx_const where name = 'SYSLOG_LEVEL' and entity = 2; - -alter table llx_societe add column import_key varchar(14); - - --- V4.1 delete from llx_paiementfourn where rowid not in (select fk_paiementfourn from llx_paiementfourn_facturefourn); --- V4.1 delete from llx_paiementfourn_facturefourn where fk_facturefourn not in (select rowid from llx_facture_fourn); - - - --- Multi company -ALTER TABLE llx_rights_def ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER module; -ALTER TABLE llx_events ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER type; -ALTER TABLE llx_boxes_def ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER file; -ALTER TABLE llx_user_param ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER fk_user; -ALTER TABLE llx_societe ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER nom; -ALTER TABLE llx_socpeople ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER fk_soc; -ALTER TABLE llx_product ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER ref; -ALTER TABLE llx_entrepot ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER label; -ALTER TABLE llx_chargesociales ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER libelle; -ALTER TABLE llx_tva ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER label; -ALTER TABLE llx_bank_account ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER label; -ALTER TABLE llx_document_model ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER nom; -ALTER TABLE llx_menu ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER menu_handler; -ALTER TABLE llx_ecm_directories ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER label; -ALTER TABLE llx_mailing ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER titre; -ALTER TABLE llx_categorie ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER label; -ALTER TABLE llx_propal ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER ref; -ALTER TABLE llx_commande ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER ref; -ALTER TABLE llx_commande_fournisseur ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER ref; -ALTER TABLE llx_product_fournisseur ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER ref_fourn; -ALTER TABLE llx_facture ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER facnumber; -ALTER TABLE llx_expedition ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER ref; -ALTER TABLE llx_facture_fourn ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER facnumber; -ALTER TABLE llx_livraison ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER ref; -ALTER TABLE llx_fichinter ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER ref; -ALTER TABLE llx_contrat ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER ref; -ALTER TABLE llx_c_barcode_type ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER code; -ALTER TABLE llx_dolibarr_modules ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER numero; -ALTER TABLE llx_bank_categ ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER label; -ALTER TABLE llx_bordereau_cheque ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER number; -ALTER TABLE llx_prelevement_bons ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER ref; -ALTER TABLE llx_projet ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER ref; -ALTER TABLE llx_adherent ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER rowid; -ALTER TABLE llx_adherent_type ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER rowid; -ALTER TABLE llx_adherent_options_label ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER name; -ALTER TABLE llx_facture_rec ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER fk_soc; - -ALTER TABLE llx_rights_def DROP PRIMARY KEY; -ALTER TABLE llx_dolibarr_modules DROP PRIMARY KEY; - -ALTER TABLE llx_adherent_options_label DROP PRIMARY KEY; -ALTER TABLE llx_adherent_options_label MODIFY COLUMN name varchar(64) NOT NULL; -ALTER TABLE llx_adherent_options_label ADD COLUMN rowid integer AUTO_INCREMENT PRIMARY KEY FIRST; - -ALTER TABLE llx_user_param DROP INDEX fk_user; -ALTER TABLE llx_societe DROP INDEX uk_societe_prefix_comm; -ALTER TABLE llx_societe DROP INDEX uk_societe_code_client; -ALTER TABLE llx_product DROP INDEX uk_product_ref; -ALTER TABLE llx_entrepot DROP INDEX label; -ALTER TABLE llx_bank_account DROP INDEX uk_bank_account_label; -ALTER TABLE llx_document_model DROP INDEX uk_document_model; -ALTER TABLE llx_menu DROP INDEX idx_menu_uk_menu; -ALTER TABLE llx_categorie DROP INDEX uk_categorie_ref; -ALTER TABLE llx_propal DROP INDEX ref; -ALTER TABLE llx_commande DROP INDEX ref; -ALTER TABLE llx_commande_fournisseur DROP INDEX uk_commande_fournisseur_ref; -ALTER TABLE llx_product_fournisseur DROP INDEX fk_product; -ALTER TABLE llx_product_fournisseur DROP INDEX fk_soc; -ALTER TABLE llx_facture DROP INDEX idx_facture_uk_facnumber; -ALTER TABLE llx_expedition DROP INDEX idx_expedition_uk_ref; -ALTER TABLE llx_facture_fourn DROP INDEX uk_facture_fourn_ref; -ALTER TABLE llx_livraison DROP INDEX idx_expedition_uk_ref; -ALTER TABLE llx_livraison DROP INDEX idx_livraison_uk_ref; -ALTER TABLE llx_fichinter DROP INDEX ref; -ALTER TABLE llx_prelevement_bons DROP INDEX ref; -ALTER TABLE llx_projet DROP INDEX ref; -ALTER TABLE llx_boxes_def DROP INDEX uk_boxes_def; -ALTER TABLE llx_adherent DROP INDEX uk_adherent_login; -ALTER TABLE llx_adherent_type DROP INDEX uk_adherent_type_libelle; -ALTER TABLE llx_facture_rec DROP INDEX idx_facture_rec_uk_titre; - -ALTER TABLE llx_rights_def ADD PRIMARY KEY pk_rights_def (id, entity); -ALTER TABLE llx_dolibarr_modules ADD PRIMARY KEY pk_dolibarr_modules (numero, entity); - -ALTER TABLE llx_user_param ADD UNIQUE INDEX uk_user_param (fk_user,param,entity); -ALTER TABLE llx_societe ADD UNIQUE INDEX uk_societe_prefix_comm (prefix_comm, entity); -ALTER TABLE llx_societe ADD UNIQUE INDEX uk_societe_code_client (code_client, entity); -ALTER TABLE llx_product ADD UNIQUE INDEX uk_product_ref (ref, entity); -ALTER TABLE llx_entrepot ADD UNIQUE INDEX uk_entrepot_label (label, entity); -ALTER TABLE llx_bank_account ADD UNIQUE INDEX uk_bank_account_label (label, entity); -ALTER TABLE llx_document_model ADD UNIQUE INDEX uk_document_model (nom, type, entity); -ALTER TABLE llx_menu ADD UNIQUE INDEX idx_menu_uk_menu (menu_handler, fk_menu, url, entity); -ALTER TABLE llx_categorie ADD UNIQUE INDEX uk_categorie_ref (label, type, entity); -ALTER TABLE llx_propal ADD UNIQUE INDEX uk_propal_ref (ref, entity); -ALTER TABLE llx_commande ADD UNIQUE INDEX uk_commande_ref (ref, entity); -ALTER TABLE llx_commande_fournisseur ADD UNIQUE INDEX uk_commande_fournisseur_ref (ref, fk_soc, entity); -ALTER TABLE llx_product_fournisseur ADD UNIQUE INDEX uk_product_fournisseur_ref (ref_fourn, fk_soc, entity); -ALTER TABLE llx_product_fournisseur ADD INDEX idx_product_fourn_fk_product (fk_product, entity); -ALTER TABLE llx_product_fournisseur ADD INDEX idx_product_fourn_fk_soc (fk_soc, entity); -ALTER TABLE llx_facture ADD UNIQUE INDEX idx_facture_uk_facnumber (facnumber, entity); -ALTER TABLE llx_expedition ADD UNIQUE INDEX idx_expedition_uk_ref (ref, entity); -ALTER TABLE llx_facture_fourn ADD UNIQUE INDEX uk_facture_fourn_ref (facnumber, fk_soc, entity); -ALTER TABLE llx_livraison ADD UNIQUE INDEX idx_livraison_uk_ref (ref, entity); -ALTER TABLE llx_fichinter ADD UNIQUE INDEX uk_fichinter_ref (ref, entity); -ALTER TABLE llx_contrat ADD UNIQUE INDEX uk_contrat_ref (ref, entity); -ALTER TABLE llx_bordereau_cheque ADD UNIQUE INDEX uk_bordereau_cheque (number, entity); -ALTER TABLE llx_prelevement_bons ADD UNIQUE INDEX uk_prelevement_bons_ref (ref, entity); -ALTER TABLE llx_projet ADD UNIQUE INDEX uk_projet_ref (ref, entity); -ALTER TABLE llx_boxes_def ADD UNIQUE INDEX uk_boxes_def (file, entity); -ALTER TABLE llx_adherent ADD UNIQUE INDEX uk_adherent_login (login, entity); -ALTER TABLE llx_adherent_type ADD UNIQUE INDEX uk_adherent_type_libelle (libelle, entity); -ALTER TABLE llx_adherent_options_label ADD UNIQUE INDEX uk_adherent_options_label_name (name, entity); -ALTER TABLE llx_facture_rec ADD UNIQUE INDEX idx_facture_rec_uk_titre (titre, entity); - -ALTER TABLE llx_projet ADD INDEX idx_projet_fk_soc (fk_soc); --- V4.1 update llx_projet set fk_soc=null where fk_soc is not null and fk_soc not in (select rowid from llx_societe); -ALTER TABLE llx_projet ADD CONSTRAINT fk_projet_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe (rowid); - -ALTER TABLE llx_facture_rec ADD CONSTRAINT fk_facture_rec_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe (rowid); - - -UPDATE llx_const SET entity=0 WHERE name='MAIN_MODULE_USER' AND entity=1; -UPDATE llx_const SET entity=0 WHERE name='MAIN_POPUP_CALENDAR' AND entity=1; -UPDATE llx_const SET entity=0 WHERE name='MAIN_MAIL_SMTP_SERVER' AND entity=1; -UPDATE llx_const SET entity=0 WHERE name='MAIN_MAIL_SMTP_PORT' AND entity=1; -UPDATE llx_const SET entity=0 WHERE name='MAIN_UPLOAD_DOC' AND entity=1; -UPDATE llx_const SET entity=0 WHERE name='MAIN_FEATURES_LEVEL' AND entity=1; -UPDATE llx_const SET entity=0 WHERE name='MAIN_SEARCHFORM_SOCIETE' AND entity=1; -UPDATE llx_const SET entity=0 WHERE name='MAIN_SEARCHFORM_CONTACT' AND entity=1; -UPDATE llx_const SET entity=0 WHERE name='MAIN_SEARCHFORM_PRODUITSERVICE' AND entity=1; -UPDATE llx_const SET entity=0 WHERE name='MAIN_SEARCHFORM_ADHERENT' AND entity=1; -UPDATE llx_const SET entity=0 WHERE name='MAIN_SIZE_LISTE_LIMIT' AND entity=1; -UPDATE llx_const SET entity=0 WHERE name='MAIN_SHOW_WORKBOARD' AND entity=1; -UPDATE llx_const SET entity=0 WHERE name='SOCIETE_NOLIST_COURRIER' AND entity=1; -UPDATE llx_const SET entity=0 WHERE name='GENBARCODE_LOCATION' AND entity=1; - -UPDATE llx_const SET entity=0 WHERE name='MAIN_MODULE_SYSLOG'; -UPDATE llx_const SET entity=0 WHERE name='SYSLOG_FILE'; -UPDATE llx_const SET entity=0 WHERE name='SYSLOG_LEVEL'; - - --- Fix to solve forgoten names on keys -ALTER TABLE llx_dolibarr_modules drop primary KEY; -ALTER TABLE llx_dolibarr_modules ADD PRIMARY KEY pk_dolibarr_modules (numero, entity); - -ALTER TABLE llx_events add column user_agent varchar(128) NULL after ip; - - -alter table llx_commande_fournisseur add column ref_supplier varchar(30) after entity; - -alter table llx_mailing add column bgcolor varchar(8) after body; -alter table llx_mailing add column bgimage varchar(255) after bgcolor; - --- Added US states -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (1101, 11, 1101, '', 0, 'United-States', 1); --- --- Provinces US -insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('AL', 1101, '', 0, 'ALABAMA', 'Alabama', 1); -insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('AK', 1101, '', 0, 'ALASKA', 'Alaska', 1); -insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('AZ', 1101, '', 0, 'ARIZONA', 'Arizona', 1); -insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('AR', 1101, '', 0, 'ARKANSAS', 'Arkansas', 1); -insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('CA', 1101, '', 0, 'CALIFORNIA', 'California', 1); -insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('CO', 1101, '', 0, 'COLORADO', 'Colorado', 1); -insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('CT', 1101, '', 0, 'CONNECTICUT', 'Connecticut', 1); -insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('DE', 1101, '', 0, 'DELAWARE', 'Delaware', 1); -insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('FL', 1101, '', 0, 'FLORIDA', 'Florida', 1); -insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('GA', 1101, '', 0, 'GEORGIA', 'Georgia', 1); -insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('HI', 1101, '', 0, 'HAWAII', 'Hawaii', 1); -insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('ID', 1101, '', 0, 'IDAHO', 'Idaho', 1); -insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('IL', 1101, '', 0, 'ILLINOIS','Illinois', 1); -insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('IN', 1101, '', 0, 'INDIANA', 'Indiana', 1); -insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('IA', 1101, '', 0, 'IOWA', 'Iowa', 1); -insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('KS', 1101, '', 0, 'KANSAS', 'Kansas', 1); -insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('KY', 1101, '', 0, 'KENTUCKY', 'Kentucky', 1); -insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('LA', 1101, '', 0, 'LOUISIANA', 'Louisiana', 1); -insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('ME', 1101, '', 0, 'MAINE', 'Maine', 1); -insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('MD', 1101, '', 0, 'MARYLAND', 'Maryland', 1); -insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('MA', 1101, '', 0, 'MASSACHUSSETTS', 'Massachusetts', 1); -insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('MI', 1101, '', 0, 'MICHIGAN', 'Michigan', 1); -insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('MN', 1101, '', 0, 'MINNESOTA', 'Minnesota', 1); -insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('MS', 1101, '', 0, 'MISSISSIPPI', 'Mississippi', 1); -insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('MO', 1101, '', 0, 'MISSOURI', 'Missouri', 1); -insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('MT', 1101, '', 0, 'MONTANA', 'Montana', 1); -insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('NE', 1101, '', 0, 'NEBRASKA', 'Nebraska', 1); -insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('NV', 1101, '', 0, 'NEVADA', 'Nevada', 1); -insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('NH', 1101, '', 0, 'NEW HAMPSHIRE', 'New Hampshire', 1); -insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('NJ', 1101, '', 0, 'NEW JERSEY', 'New Jersey', 1); -insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('NM', 1101, '', 0, 'NEW MEXICO', 'New Mexico', 1); -insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('NY', 1101, '', 0, 'NEW YORK', 'New York', 1); -insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('NC', 1101, '', 0, 'NORTH CAROLINA', 'North Carolina', 1); -insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('ND', 1101, '', 0, 'NORTH DAKOTA', 'North Dakota', 1); -insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('OH', 1101, '', 0, 'OHIO', 'Ohio', 1); -insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('OK', 1101, '', 0, 'OKLAHOMA', 'Oklahoma', 1); -insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('OR', 1101, '', 0, 'OREGON', 'Oregon', 1); -insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('PA', 1101, '', 0, 'PENNSYLVANIA', 'Pennsylvania', 1); -insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('RI', 1101, '', 0, 'RHODE ISLAND', 'Rhode Island', 1); -insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('SC', 1101, '', 0, 'SOUTH CAROLINA', 'South Carolina', 1); -insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('SD', 1101, '', 0, 'SOUTH DAKOTA', 'South Dakota', 1); -insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('TN', 1101, '', 0, 'TENNESSEE', 'Tennessee', 1); -insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('TX', 1101, '', 0, 'TEXAS', 'Texas', 1); -insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('UT', 1101, '', 0, 'UTAH', 'Utah', 1); -insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('VT', 1101, '', 0, 'VERMONT', 'Vermont', 1); -insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('VA', 1101, '', 0, 'VIRGINIA', 'Virginia', 1); -insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('WA', 1101, '', 0, 'WASHINGTON', 'Washington', 1); -insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('WV', 1101, '', 0, 'WEST VIRGINIA', 'West Virginia', 1); -insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('WI', 1101, '', 0, 'WISCONSIN', 'Wisconsin', 1); -insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('WY', 1101, '', 0, 'WYOMING', 'Wyoming', 1); - -alter table llx_facture_fourn_det add column ref varchar(50) after fk_product; -alter table llx_facture_fourn_det add column label varchar(255) after ref; - -alter table llx_societe_rib modify column iban_prefix varchar(34); -alter table llx_bank_account modify column iban_prefix varchar(34); - - -alter table llx_projet add column datec date after fk_statut; - -delete from llx_action_def; -insert into llx_action_def (rowid,code,titre,description,objet_type) values (1,'NOTIFY_VAL_FICHINTER','Validation fiche intervention','Executed when a intervention is validated','ficheinter'); -insert into llx_action_def (rowid,code,titre,description,objet_type) values (2,'NOTIFY_VAL_FAC','Validation facture client','Executed when a customer invoice is approved','facture'); -insert into llx_action_def (rowid,code,titre,description,objet_type) values (3,'NOTIFY_APP_ORDER_SUPPLIER','Approbation commande fournisseur','Executed when a supplier order is approved','order_supplier'); -insert into llx_action_def (rowid,code,titre,description,objet_type) values (4,'NOTIFY_REF_ORDER_SUPPLIER','Refus commande fournisseur','Executed when a supplier order is refused','order_supplier'); - - -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 51, 5, '19','0','VAT standard rate',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 52, 5, '7','0','VAT reduced rate', 1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 53, 5, '0','0','VAT Rate 0', 1); - --- Add rule to avoid duplicate use of discount -update llx_facturedet set fk_remise_except = null where fk_remise_except = 0; -ALTER TABLE llx_facturedet ADD UNIQUE INDEX uk_fk_remise_except (fk_remise_except); - --- Add Mauritius -INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (152, '15201', 'Mauritius Private Company Limited By Shares', 1); -INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (152, '15202', 'Mauritius Company Limited By Guarantee', 1); -INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (152, '15203', 'Mauritius Public Company Limited By Shares', 1); -INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (152, '15204', 'Mauritius Foreign Company', 1); -INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (152, '15205', 'Mauritius GBC1 (Offshore Company)', 1); -INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (152, '15206', 'Mauritius GBC2 (International Company)', 1); -INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (152, '15207', 'Mauritius General Partnership', 1); -INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (152, '15208', 'Mauritius Limited Partnership', 1); -INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (152, '15209', 'Mauritius Sole Proprietorship', 1); -INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (152, '15210', 'Mauritius Trusts', 1); - -insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'MU', 'MUR', 1, 'Roupies mauritiennes'); - -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1521,152, '0','0','VAT Rate 0',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1522,152, '15','0','VAT Rate 15',1); - -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (15201, 152, 15201, '', 0, 'Rivière Noire', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (15202, 152, 15202, '', 0, 'Flacq', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (15203, 152, 15203, '', 0, 'Grand Port', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (15204, 152, 15204, '', 0, 'Moka', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (15205, 152, 15205, '', 0, 'Pamplemousses', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (15206, 152, 15206, '', 0, 'Plaines Wilhems', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (15207, 152, 15207, '', 0, 'Port-Louis', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (15208, 152, 15208, '', 0, 'Rivière du Rempart', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (15209, 152, 15209, '', 0, 'Savanne', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (15210, 152, 15210, '', 0, 'Rodrigues', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (15211, 152, 15211, '', 0, 'Les îles Agaléga', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (15212, 152, 15212, '', 0, 'Les écueils des Cargados Carajos', 1); - -alter table llx_const modify column name varchar(255) NOT NULL; -alter table llx_const modify column value text NOT NULL; - --- SWEDEN (id 20) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (201,20, '25','0','VAT standard rate',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (202,20, '12','0','VAT reduced rate',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (203,20, '6','0','VAT super-reduced rate',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (204,20, '0','0','VAT Rate 0', 1); - --- Regions Suisse (id pays=6) -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (601, 6, 601, '', 1, 'Cantons', 1); - --- Cantons Suisse -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom, active) VALUES (601,'AG','ARGOVIE','Argovie',1); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom, active) VALUES (601,'AI','APPENZELL RHODES INTERIEURES','Appenzell Rhodes intérieures',1); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom, active) VALUES (601,'AR','APPENZELL RHODES EXTERIEURES','Appenzell Rhodes extérieures',1); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom, active) VALUES (601,'BE','BERNE','Berne',1); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom, active) VALUES (601,'BL','BALE CAMPAGNE','Bâle Campagne',1); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom, active) VALUES (601,'BS','BALE VILLE','Bâle Ville',1); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom, active) VALUES (601,'FR','FRIBOURG','Fribourg',1); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom, active) VALUES (601,'GE','GENEVE','Genève',1); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom, active) VALUES (601,'GL','GLARIS','Glaris',1); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom, active) VALUES (601,'GR','GRISONS','Grisons',1); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom, active) VALUES (601,'JU','JURA','Jura',1); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom, active) VALUES (601,'LU','LUCERNE','Lucerne',1); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom, active) VALUES (601,'NE','NEUCHATEL','Neuchâtel',1); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom, active) VALUES (601,'NW','NIDWALD','Nidwald',1); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom, active) VALUES (601,'OW','OBWALD','Obwald',1); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom, active) VALUES (601,'SG','SAINT-GALL','Saint-Gall',1); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom, active) VALUES (601,'SH','SCHAFFHOUSE','Schaffhouse',1); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom, active) VALUES (601,'SO','SOLEURE','Soleure',1); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom, active) VALUES (601,'SZ','SCHWYZ','Schwyz',1); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom, active) VALUES (601,'TG','THURGOVIE','Thurgovie',1); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom, active) VALUES (601,'TI','TESSIN','Tessin',1); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom, active) VALUES (601,'UR','URI','Uri',1); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom, active) VALUES (601,'VD','VAUD','Vaud',1); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom, active) VALUES (601,'VS','VALAIS','Valais',1); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom, active) VALUES (601,'ZG','ZUG','Zug',1); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom, active) VALUES (601,'ZH','ZURICH','Zürich',1); - --- Regions spain (id pays=4) -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (401, 4, 401, '', 0, 'Andalucia', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (402, 4, 402, '', 0, 'Aragón', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (403, 4, 403, '', 0, 'Castilla y León', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (404, 4, 404, '', 0, 'Castilla la Mancha', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (405, 4, 405, '', 0, 'Canarias', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (406, 4, 406, '', 0, 'Cataluña', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (407, 4, 407, '', 0, 'Comunidad de Ceuta', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (408, 4, 408, '', 0, 'Comunidad Foral de Navarra', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (409, 4, 409, '', 0, 'Comunidad de Melilla', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (410, 4, 410, '', 0, 'Cantabria', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (411, 4, 411, '', 0, 'Comunidad Valenciana', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (412, 4, 412, '', 0, 'Extemadura', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (413, 4, 413, '', 0, 'Galicia', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (414, 4, 414, '', 0, 'Islas Baleares', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (415, 4, 415, '', 0, 'La Rioja', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (416, 4, 416, '', 0, 'Comunidad de Madrid', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (417, 4, 417, '', 0, 'Región de Murcia', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (418, 4, 418, '', 0, 'Principado de Asturias', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (419, 4, 419, '', 0, 'Pais Vasco', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (420, 4, 420, '', 0, 'Otros', 1); - --- Provinces Spain -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('01', 419, '', 19, 'PAIS VASCO', 'País Vasco', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('02', 404, '', 4, 'ALBACETE', 'Albacete', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('03', 411, '', 11, 'ALICANTE', 'Alicante', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('04', 401, '', 1, 'ALMERIA', 'Almería', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('05', 403, '', 3, 'AVILA', 'Avila', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('06', 412, '', 12, 'BADAJOZ', 'Badajoz', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('07', 414, '', 14, 'ISLAS BALEARES', 'Islas Baleares', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('08', 406, '', 6, 'BARCELONA', 'Barcelona', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('09', 403, '', 8, 'BURGOS', 'Burgos', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('10', 412, '', 12, 'CACERES', 'Cáceres', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('11', 401, '', 1, 'CADIz', 'Cádiz', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('12', 411, '', 11, 'CASTELLON', 'Castellón', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('13', 404, '', 4, 'CIUDAD REAL', 'Ciudad Real', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('14', 401, '', 1, 'CORDOBA', 'Córdoba', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('15', 413, '', 13, 'LA CORUÑA', 'La Coruña', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('16', 404, '', 4, 'CUENCA', 'Cuenca', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('17', 406, '', 6, 'GERONA', 'Gerona', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('18', 401, '', 1, 'GRANADA', 'Granada', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('19', 404, '', 4, 'GUADALAJARA', 'Guadalajara', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('20', 419, '', 19, 'GUIPUZCOA', 'Guipúzcoa', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('21', 401, '', 1, 'HUELVA', 'Huelva', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('22', 402, '', 2, 'HUESCA', 'Huesca', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('23', 401, '', 1, 'JAEN', 'Jaén', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('24', 403, '', 3, 'LEON', 'León', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('25', 406, '', 6, 'LERIDA', 'Lérida', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('26', 415, '', 15, 'LA RIOJA', 'La Rioja', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('27', 413, '', 13, 'LUGO', 'Lugo', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('28', 416, '', 16, 'MADRID', 'Madrid', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('29', 401, '', 1, 'MALAGA', 'Málaga', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('30', 417, '', 17, 'MURCIA', 'Murcia', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('31', 408, '', 8, 'NAVARRA', 'Navarra', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('32', 413, '', 13, 'ORENSE', 'Orense', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('33', 418, '', 18, 'ASTURIAS', 'Asturias', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('34', 403, '', 3, 'PALENCIA', 'Palencia', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('35', 405, '', 5, 'LAS PALMAS', 'Las Palmas', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('36', 413, '', 13, 'PONTEVEDRA', 'Pontevedra', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('37', 403, '', 3, 'SALAMANCA', 'Salamanca', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('38', 405, '', 5, 'STA. CRUZ DE TENERIFE', 'Sta. Cruz de Tenerife', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('39', 410, '', 10, 'CANTABRIA', 'Cantabria', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('40', 403, '', 3, 'SEGOVIA', 'Segovia', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('41', 401, '', 1, 'SEVILLA', 'Sevilla', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('42', 403, '', 3, 'SORIA', 'Soria', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('43', 406, '', 6, 'TARRAGONA', 'Tarragona', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('44', 402, '', 2, 'TERUEL', 'Teruel', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('45', 404, '', 5, 'TOLEDO', 'Toledo', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('46', 411, '', 11, 'VALENCIA', 'Valencia', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('47', 403, '', 3, 'VALLADOLID', 'Valladolid', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('48', 419, '', 19, 'VIZCAYA', 'Vizcaya', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('49', 403, '', 3, 'ZAMORA', 'Zamora', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('50', 402, '', 1, 'ZARAGOZA', 'Zaragoza', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('51', 407, '', 7, 'CEUTA', 'Ceuta', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('52', 409, '', 9, 'MELILLA', 'Melilla', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('53', 420, '', 20, 'OTROS', 'Otros', 1); - - -alter table llx_product_price modify price_level smallint NULL DEFAULT 1; -alter table llx_commandedet modify special_code integer UNSIGNED DEFAULT 0; -alter table llx_facturedet modify special_code integer UNSIGNED DEFAULT 0; -alter table llx_propaldet modify special_code integer UNSIGNED DEFAULT 0; -alter table llx_societe modify special_code integer NULL; -alter table llx_c_forme_juridique modify code integer NOT NULL; - -ALTER TABLE llx_bank_class ADD UNIQUE INDEX idx_bank_class_lineid (lineid); -ALTER TABLE llx_c_ecotaxe ADD UNIQUE INDEX uk_c_ecotaxe (code); -ALTER TABLE llx_c_methode_commande_fournisseur ADD UNIQUE INDEX uk_c_methode_commande_fournisseur (code); - -ALTER TABLE llx_menu change user usertype integer NOT NULL default '0'; - --- Rename index -ALTER TABLE llx_adherent_options MODIFY COLUMN optid integer; -ALTER TABLE llx_adherent_options DROP PRIMARY KEY; -ALTER TABLE llx_adherent_options DROP INDEX uk_adherent_options; -ALTER TABLE llx_adherent_options DROP INDEX idx_adherent_options; -ALTER TABLE llx_adherent_options DROP INDEX adhid; -ALTER TABLE llx_adherent_options CHANGE optid rowid integer AUTO_INCREMENT PRIMARY KEY; -ALTER TABLE llx_adherent_options CHANGE adhid fk_member integer NOT NULL; -ALTER TABLE llx_adherent_options ADD INDEX idx_adherent_options (fk_member); - -ALTER TABLE llx_adherent DROP INDEX idx_adherent_fk_soc; - -ALTER TABLE llx_propaldet ADD INDEX idx_propaldet_fk_propal (fk_propal); --- V4.1 delete from llx_propaldet where fk_propal not in (select rowid from llx_propal); -ALTER TABLE llx_propaldet ADD CONSTRAINT fk_propaldet_fk_propal FOREIGN KEY (fk_propal) REFERENCES llx_propal (rowid); - -ALTER TABLE llx_bank_class DROP INDEX idx_bank_class_lineid; -ALTER TABLE llx_bank_class DROP INDEX uk_bank_class_lineid; -ALTER TABLE llx_bank_class ADD UNIQUE INDEX uk_bank_class_lineid (lineid, fk_categ); - - --- Not used. Just to be compatible with 2.7 upgrade process or higher -alter table llx_menu add column enabled varchar(255) NULL default '1'; diff --git a/htdocs/install/mysql/migration/2.7.0-2.8.0.sql b/htdocs/install/mysql/migration/2.7.0-2.8.0.sql deleted file mode 100755 index 045f72cf9f5..00000000000 --- a/htdocs/install/mysql/migration/2.7.0-2.8.0.sql +++ /dev/null @@ -1,211 +0,0 @@ --- --- Be carefull to requests order. --- This file must be loaded by calling /install/index.php page --- when current version is 2.7.0 or higher. --- - -ALTER TABLE llx_actioncomm CHANGE fk_projet fk_project integer; - -ALTER TABLE llx_don ADD COLUMN ref varchar(30) DEFAULT NULL AFTER rowid; -ALTER TABLE llx_don ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER ref; - -ALTER TABLE llx_stock_mouvement ADD COLUMN label varchar(128); - -ALTER TABLE llx_deplacement ADD COLUMN ref varchar(30) DEFAULT NULL AFTER rowid; -ALTER TABLE llx_deplacement ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER ref; -ALTER TABLE llx_deplacement ADD COLUMN note_public text; - -ALTER TABLE llx_element_element DROP INDEX idx_element_element_idx1; -ALTER TABLE llx_element_element DROP INDEX idx_element_element_targetid; -ALTER TABLE llx_element_element CHANGE sourceid fk_source integer NOT NULL; -ALTER TABLE llx_element_element CHANGE targetid fk_target integer NOT NULL; -ALTER TABLE llx_element_element ADD UNIQUE INDEX idx_element_element_idx1 (fk_source, sourcetype, fk_target, targettype); -ALTER TABLE llx_element_element ADD INDEX idx_element_element_fk_target (fk_target); - -ALTER TABLE llx_ecm_document RENAME TO llx_ecm_documents; -ALTER TABLE llx_ecm_documents ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER ref; -ALTER TABLE llx_ecm_documents ADD COLUMN crc varchar(32) DEFAULT '' NOT NULL AFTER private; -ALTER TABLE llx_ecm_documents ADD COLUMN cryptkey varchar(50) DEFAULT '' NOT NULL AFTER crc; -ALTER TABLE llx_ecm_documents ADD COLUMN cipher varchar(50) DEFAULT 'twofish' NOT NULL AFTER cryptkey; - -ALTER TABLE llx_facture_fourn_det MODIFY COLUMN qty real; - - -ALTER TABLE llx_notify ADD COLUMN email VARCHAR(255); - -ALTER TABLE llx_c_currencies ADD COLUMN labelsing varchar(64); -update llx_c_currencies set labelsing='Euro' where code_iso='EUR'; -update llx_c_currencies set labelsing='Dollar' where code_iso='USD'; - -insert into llx_action_def (rowid,code,titre,description,objet_type) values (5,'NOTIFY_VAL_ORDER','Validation commande client','Executed when a customer order is validated','order'); -insert into llx_action_def (rowid,code,titre,description,objet_type) values (6,'NOTIFY_VAL_PROPAL','Validation proposition client','Executed when a commercial proposal is validated','propal'); - -UPDATE llx_c_type_contact SET element='project' WHERE element='projet'; - -UPDATE llx_const set value='mail' where value='simplemail' and name='MAIN_MAIL_SENDMODE'; - -ALTER TABLE llx_projet ADD COLUMN model_pdf varchar(50) AFTER note; - -ALTER TABLE llx_societe ADD COLUMN localtax1_assuj tinyint DEFAULT 0 after tva_assuj; -ALTER TABLE llx_societe ADD COLUMN localtax2_assuj tinyint DEFAULT 0 after localtax1_assuj; - -ALTER TABLE llx_user ADD COLUMN photo varchar(255) after statut; - --- Create table of extra fields -create table llx_extra_fields -( - rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, - entity integer DEFAULT 1 NOT NULL, - object varchar(64) NOT NULL, - assign integer, - name varchar(64) NOT NULL, - label varchar(64) NOT NULL, - format varchar(8) NOT NULL, - fieldsize integer, - maxlength integer, - options varchar(45), - rank integer -)ENGINE=innodb; - -ALTER TABLE llx_extra_fields ADD UNIQUE INDEX idx_extra_fields_name (name, entity); - --- Create table of possible values -create table llx_extra_fields_options -( - rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, - fk_extra_fields integer NOT NULL, - value varchar(255) NOT NULL, - rank integer -)ENGINE=innodb; - -ALTER TABLE llx_extra_fields_options ADD INDEX idx_extra_fields_options_fk_extra_fields (fk_extra_fields); -ALTER TABLE llx_extra_fields_options ADD CONSTRAINT fk_extra_fields_options_fk_extra_fields FOREIGN KEY (fk_extra_fields) REFERENCES llx_extra_fields (rowid); - --- Create table of values -create table llx_extra_fields_values -( - rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, - entity integer DEFAULT 1 NOT NULL, - datec datetime, - datem datetime, - fk_object integer NOT NULL, - fk_extra_fields integer NOT NULL, - value varchar(255), - fk_user_create integer, - fk_user_modif integer -)ENGINE=innodb; - -ALTER TABLE llx_extra_fields_values ADD INDEX idx_extra_fields_values_fk_extra_fields (fk_extra_fields, entity); -ALTER TABLE llx_extra_fields_values ADD CONSTRAINT fk_extra_fields_values_fk_extra_fields FOREIGN KEY (fk_extra_fields) REFERENCES llx_extra_fields (rowid); - -ALTER TABLE llx_bank_class DROP INDEX idx_bank_class_lineid; -ALTER TABLE llx_bank_class DROP INDEX uk_bank_class_lineid; -ALTER TABLE llx_bank_class ADD UNIQUE INDEX uk_bank_class_lineid (lineid, fk_categ); - -ALTER TABLE llx_rights_def MODIFY COLUMN module varchar(64); - --- Enhancement of project tasks -ALTER TABLE llx_projet ADD COLUMN datee DATE AFTER dateo; -ALTER TABLE llx_projet ADD COLUMN public integer; - -ALTER TABLE llx_projet_task ADD COLUMN datec datetime AFTER fk_task_parent; -ALTER TABLE llx_projet_task ADD COLUMN tms timestamp AFTER datec; -ALTER TABLE llx_projet_task ADD COLUMN dateo datetime AFTER tms; -ALTER TABLE llx_projet_task ADD COLUMN datee datetime AFTER dateo; -ALTER TABLE llx_projet_task ADD COLUMN datev datetime AFTER datee; -ALTER TABLE llx_projet_task CHANGE title label varchar(255) NOT NULL; -ALTER TABLE llx_projet_task ADD COLUMN description text AFTER label; -ALTER TABLE llx_projet_task MODIFY description text; -ALTER TABLE llx_projet_task MODIFY duration_effective real DEFAULT 0 NOT NULL; -ALTER TABLE llx_projet_task ADD COLUMN progress integer DEFAULT 0 AFTER duration_effective; -ALTER TABLE llx_projet_task ADD COLUMN priority integer DEFAULT 0 AFTER progress; -ALTER TABLE llx_projet_task ADD COLUMN fk_milestone integer DEFAULT 0 AFTER priority; -ALTER TABLE llx_projet_task ADD COLUMN fk_user_modif integer AFTER fk_user_creat; -ALTER TABLE llx_projet_task ADD COLUMN fk_user_valid integer AFTER fk_user_modif; -UPDATE llx_projet_task SET statut='1' WHERE statut='open'; -ALTER TABLE llx_projet_task CHANGE statut fk_statut smallint DEFAULT 0 NOT NULL; -ALTER TABLE llx_projet_task CHANGE note note_private text; -ALTER TABLE llx_projet_task ADD COLUMN note_public text AFTER note_private; -ALTER TABLE llx_projet_task ADD COLUMN rang integer DEFAULT 0 AFTER note_public; - --- Delete old key -ALTER TABLE llx_projet_task DROP INDEX fk_projet; -ALTER TABLE llx_projet_task DROP INDEX fk_user_creat; -ALTER TABLE llx_projet_task DROP INDEX statut; --- Add new key -ALTER TABLE llx_projet_task ADD INDEX idx_projet_task_fk_projet (fk_projet); -ALTER TABLE llx_projet_task ADD INDEX idx_projet_task_fk_user_creat (fk_user_creat); -ALTER TABLE llx_projet_task ADD INDEX idx_projet_task_fk_user_valid (fk_user_valid); --- V4.1 DELETE FROM llx_projet_task WHERE fk_projet NOT IN (SELECT rowid from llx_projet); --- V4.1 UPDATE llx_projet_task set fk_user_creat=NULL WHERE fk_user_creat IS NOT NULL AND fk_user_creat NOT IN (SELECT rowid from llx_user); --- V4.1 UPDATE llx_projet_task set fk_user_valid=NULL WHERE fk_user_valid IS NOT NULL AND fk_user_valid NOT IN (SELECT rowid from llx_user); -ALTER TABLE llx_projet_task ADD CONSTRAINT fk_projet_task_fk_projet FOREIGN KEY (fk_projet) REFERENCES llx_projet (rowid); -ALTER TABLE llx_projet_task ADD CONSTRAINT fk_projet_task_fk_user_creat FOREIGN KEY (fk_user_creat) REFERENCES llx_user (rowid); -ALTER TABLE llx_projet_task ADD CONSTRAINT fk_projet_task_fk_user_valid FOREIGN KEY (fk_user_valid) REFERENCES llx_user (rowid); - -ALTER TABLE llx_element_contact DROP FOREIGN KEY fk_element_contact_fk_c_type_contact; -ALTER TABLE llx_element_contact DROP INDEX fk_element_contact_fk_c_type_contact; -UPDATE llx_c_type_contact SET rowid='160' WHERE rowid='80'; -UPDATE llx_c_type_contact SET rowid='170' WHERE rowid='81'; -UPDATE llx_element_contact SET fk_c_type_contact='160' WHERE fk_c_type_contact='80'; -UPDATE llx_element_contact SET fk_c_type_contact='170' WHERE fk_c_type_contact='81'; -ALTER TABLE llx_element_contact ADD CONSTRAINT fk_element_contact_fk_c_type_contact FOREIGN KEY (fk_c_type_contact) REFERENCES llx_c_type_contact(rowid); - -insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (161, 'project', 'internal', 'CONTRIBUTOR', 'Intervenant', 1); -insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (171, 'project', 'external', 'CONTRIBUTOR', 'Intervenant', 1); -insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (180, 'project_task', 'internal', 'TASKEXECUTIVE', 'Responsable', 1); -insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (181, 'project_task', 'internal', 'CONTRIBUTOR', 'Intervenant', 1); -insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (190, 'project_task', 'external', 'TASKEXECUTIVE', 'Responsable', 1); -insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (191, 'project_task', 'external', 'CONTRIBUTOR', 'Intervenant', 1); - -ALTER TABLE llx_projet ADD COLUMN description text AFTER title; -ALTER TABLE llx_projet CHANGE note note_private text; -ALTER TABLE llx_projet ADD COLUMN note_public text AFTER note_private; -ALTER TABLE llx_projet MODIFY fk_statut smallint DEFAULT 0 NOT NULL; -ALTER TABLE llx_projet MODIFY fk_user_creat integer NOT NULL; - --- Uniformize code: change tva_taux to tva_tx -ALTER TABLE llx_facturedet CHANGE tva_taux tva_tx real; -ALTER TABLE llx_facture_fourn_det CHANGE tva_taux tva_tx double(6,3); -ALTER TABLE llx_facturedet_rec CHANGE tva_taux tva_tx real DEFAULT 19.6; - --- Create table for entities -create table llx_entity -( - rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, - label varchar(255) NOT NULL, - description text, - datec datetime, - fk_user_creat integer, - visible tinyint DEFAULT 1 NOT NULL, - active tinyint DEFAULT 1 NOT NULL -) ENGINE=innodb; - -INSERT INTO llx_entity (rowid, label, description, datec, fk_user_creat, visible, active) VALUES (1, 'Default Entity', 'This is the default entity', NOW(), 1, 1, 1); - --- Add constraint --- V4.1 DELETE FROM llx_fichinterdet WHERE fk_fichinter NOT IN (SELECT rowid from llx_fichinter); -ALTER TABLE llx_fichinterdet ADD INDEX idx_fichinterdet_fk_fichinter (fk_fichinter); -ALTER TABLE llx_fichinterdet ADD CONSTRAINT fk_fichinterdet_fk_fichinter FOREIGN KEY (fk_fichinter) REFERENCES llx_fichinter (rowid); - - - --- This was created into 2.9.0 but we need them to avoid errors of migration to 2.8 using new classes -alter table llx_facture add column localtax1 double(24,8) DEFAULT 0 after tva; -alter table llx_facture add column localtax2 double(24,8) DEFAULT 0 after localtax1; -alter table llx_facturedet add column localtax1_tx double(6,3) DEFAULT 0 after tva_tx; -alter table llx_facturedet add column localtax2_tx double(6,3) DEFAULT 0 after localtax1_tx; -alter table llx_facturedet add column total_localtax1 double(24,8) DEFAULT 0 after total_tva; -alter table llx_facturedet add column total_localtax2 double(24,8) DEFAULT 0 after total_localtax1; - - - --- This was created into 3.0.0 but we need them to avoid errors of migration to 2.8 using new classes -ALTER TABLE llx_propaldet ADD COLUMN fk_parent_line integer NULL AFTER fk_propal; -ALTER TABLE llx_commandedet ADD COLUMN fk_parent_line integer NULL AFTER fk_commande; -ALTER TABLE llx_facturedet ADD COLUMN fk_parent_line integer NULL AFTER fk_facture; -ALTER TABLE llx_facturedet_rec ADD COLUMN fk_parent_line integer NULL AFTER fk_facture; diff --git a/htdocs/install/mysql/migration/2.8.0-2.9.0.sql b/htdocs/install/mysql/migration/2.8.0-2.9.0.sql deleted file mode 100755 index d4c889d9398..00000000000 --- a/htdocs/install/mysql/migration/2.8.0-2.9.0.sql +++ /dev/null @@ -1,329 +0,0 @@ --- --- Be carefull to requests order. --- This file must be loaded by calling /install/index.php page --- when current version is 2.8.0 or higher. --- - --- Add unique key -ALTER TABLE llx_product_stock ADD UNIQUE INDEX uk_product_stock (fk_product,fk_entrepot); - -ALTER TABLE llx_product_stock drop column location; - --- Add missing table llx_product_association -create table llx_product_association -( - rowid integer AUTO_INCREMENT PRIMARY KEY, - fk_product_pere integer NOT NULL DEFAULT 0, - fk_product_fils integer NOT NULL DEFAULT 0, - qty double NULL -)ENGINE=innodb; - - -ALTER TABLE llx_product_association ADD UNIQUE INDEX uk_product_association (fk_product_pere, fk_product_fils); - -ALTER TABLE llx_product_association ADD INDEX idx_product_association_fils (fk_product_fils); - - - -ALTER TABLE llx_product ADD INDEX idx_product_label (label); - --- V4.1 DELETE FROM llx_projet_task WHERE fk_projet NOT IN (SELECT rowid from llx_projet); --- V4.1 UPDATE llx_projet_task set fk_user_creat=NULL WHERE fk_user_creat IS NOT NULL AND fk_user_creat NOT IN (SELECT rowid from llx_user); --- V4.1 UPDATE llx_projet_task set fk_user_valid=NULL WHERE fk_user_valid IS NOT NULL AND fk_user_valid NOT IN (SELECT rowid from llx_user); - -ALTER table llx_bank_account ADD COLUMN fk_pays integer DEFAULT 0 NOT NULL after domiciliation; -ALTER TABLE llx_bank_account ADD COLUMN fk_departement integer DEFAULT NULL after domiciliation; -ALTER TABLE llx_socpeople ADD COLUMN fk_departement integer DEFAULT NULL after ville; -ALTER TABLE llx_adherent ADD COLUMN fk_departement integer DEFAULT NULL after ville; -ALTER TABLE llx_entrepot ADD COLUMN fk_departement integer DEFAULT NULL after ville; - -ALTER TABLE llx_bookmark ADD COLUMN position integer DEFAULT 0; - --- Rename llx_product_det -ALTER TABLE llx_product_det RENAME TO llx_product_lang; -ALTER TABLE llx_product_lang ADD UNIQUE INDEX uk_product_lang (fk_product, lang); --- V4.1 DELETE FROM llx_product_lang WHERE fk_product NOT IN (SELECT rowid from llx_product); -ALTER TABLE llx_product_lang ADD CONSTRAINT fk_product_lang_fk_product FOREIGN KEY (fk_product) REFERENCES llx_product (rowid); - -ALTER TABLE llx_product ADD COLUMN virtual tinyint DEFAULT 0 NOT NULL AFTER tms; -ALTER TABLE llx_product ADD COLUMN fk_parent integer DEFAULT 0 AFTER virtual; - -alter table llx_societe add column default_lang varchar(6) after price_level; -alter table llx_socpeople add column default_lang varchar(6) after note; - - -alter table llx_mailing add column joined_file1 varchar(255); -alter table llx_mailing add column joined_file2 varchar(255); -alter table llx_mailing add column joined_file3 varchar(255); -alter table llx_mailing add column joined_file4 varchar(255); - -update llx_facture_fourn set fk_statut=2 where fk_statut=1 AND paye=1; - -alter table llx_facture_fourn add column close_code varchar(16) after remise; -alter table llx_facture_fourn add column close_note varchar(128) after close_code; - --- Add local taxes -alter table llx_facture add column localtax1 double(24,8) DEFAULT 0 after tva; -alter table llx_facture add column localtax2 double(24,8) DEFAULT 0 after localtax1; -alter table llx_facturedet add column localtax1_tx double(6,3) DEFAULT 0 after tva_tx; -alter table llx_facturedet add column localtax2_tx double(6,3) DEFAULT 0 after localtax1_tx; -alter table llx_facturedet add column total_localtax1 double(24,8) DEFAULT 0 after total_tva; -alter table llx_facturedet add column total_localtax2 double(24,8) DEFAULT 0 after total_localtax1; - -alter table llx_facture_rec add column localtax1 double(24,8) DEFAULT 0 after tva; -alter table llx_facture_rec add column localtax2 double(24,8) DEFAULT 0 after localtax1; -alter table llx_facturedet_rec add column localtax1_tx double(6,3) DEFAULT 0 after tva_tx; -alter table llx_facturedet_rec add column localtax2_tx double(6,3) DEFAULT 0 after localtax1_tx; -alter table llx_facturedet_rec add column total_localtax1 double(24,8) DEFAULT 0 after total_tva; -alter table llx_facturedet_rec add column total_localtax2 double(24,8) DEFAULT 0 after total_localtax1; - -alter table llx_c_tva add column localtax1 double NOT NULL DEFAULT 0 after taux; -alter table llx_c_tva add column localtax2 double NOT NULL DEFAULT 0 after localtax1; - -alter table llx_propal add column localtax1 double(24,8) DEFAULT 0 after tva; -alter table llx_propal add column localtax2 double(24,8) DEFAULT 0 after localtax1; -alter table llx_propaldet add column localtax1_tx double(6,3) DEFAULT 0 after tva_tx; -alter table llx_propaldet add column localtax2_tx double(6,3) DEFAULT 0 after localtax1_tx; -alter table llx_propaldet add column total_localtax1 double(24,8) DEFAULT 0 after total_tva; -alter table llx_propaldet add column total_localtax2 double(24,8) DEFAULT 0 after total_localtax1; - -alter table llx_commande add column localtax1 double(24,8) DEFAULT 0 after tva; -alter table llx_commande add column localtax2 double(24,8) DEFAULT 0 after localtax1; -alter table llx_commandedet add column localtax1_tx double(6,3) DEFAULT 0 after tva_tx; -alter table llx_commandedet add column localtax2_tx double(6,3) DEFAULT 0 after localtax1_tx; -alter table llx_commandedet add column total_localtax1 double(24,8) DEFAULT 0 after total_tva; -alter table llx_commandedet add column total_localtax2 double(24,8) DEFAULT 0 after total_localtax1; - -alter table llx_commande_fournisseur add column localtax1 double(24,8) DEFAULT 0 after tva; -alter table llx_commande_fournisseur add column localtax2 double(24,8) DEFAULT 0 after localtax1; -alter table llx_commande_fournisseurdet add column localtax1_tx double(6,3) DEFAULT 0 after tva_tx; -alter table llx_commande_fournisseurdet add column localtax2_tx double(6,3) DEFAULT 0 after localtax1_tx; -alter table llx_commande_fournisseurdet add column total_localtax1 double(24,8) DEFAULT 0 after total_tva; -alter table llx_commande_fournisseurdet add column total_localtax2 double(24,8) DEFAULT 0 after total_localtax1; - -alter table llx_facture_fourn add column localtax1 double(24,8) DEFAULT 0 after tva; -alter table llx_facture_fourn add column localtax2 double(24,8) DEFAULT 0 after localtax1; -alter table llx_facture_fourn_det add column localtax1_tx double(6,3) DEFAULT 0 after tva_tx; -alter table llx_facture_fourn_det add column localtax2_tx double(6,3) DEFAULT 0 after localtax1_tx; -alter table llx_facture_fourn_det add column total_localtax1 double(24,8) DEFAULT 0 after tva; -alter table llx_facture_fourn_det add column total_localtax2 double(24,8) DEFAULT 0 after total_localtax1; - -alter table llx_product add column localtax1_tx double(6,3) DEFAULT 0 after tva_tx; -alter table llx_product add column localtax2_tx double(6,3) DEFAULT 0 after localtax1_tx; -alter table llx_product_price add column localtax1_tx double(6,3) DEFAULT 0 after tva_tx; -alter table llx_product_price add column localtax2_tx double(6,3) DEFAULT 0 after localtax1_tx; - -alter table llx_contratdet add column localtax1_tx double(6,3) DEFAULT 0 after tva_tx; -alter table llx_contratdet add column localtax2_tx double(6,3) DEFAULT 0 after localtax1_tx; -alter table llx_contratdet add column total_localtax1 double(24,8) DEFAULT 0 after total_tva; -alter table llx_contratdet add column total_localtax2 double(24,8) DEFAULT 0 after total_localtax1; - -alter table llx_product add column hidden tinyint DEFAULT 0; - -alter table llx_product add column length float DEFAULT NULL after weight_units; -alter table llx_product add column length_units tinyint DEFAULT NULL after length; -alter table llx_product add column surface float DEFAULT NULL after length_units; -alter table llx_product add column surface_units tinyint DEFAULT NULL after surface; - -alter table llx_product add column accountancy_code_sell varchar(15) after fk_barcode_type; -alter table llx_product add column accountancy_code_buy varchar(15) after accountancy_code_sell; - -ALTER TABLE llx_product drop column stock_loc; -ALTER TABLE llx_product_stock add column location varchar(32); - -ALTER TABLE llx_expedition DROP FOREIGN KEY fk_expedition_fk_adresse_livraison; -ALTER TABLE llx_expedition DROP INDEX idx_expedition_fk_adresse_livraison; -ALTER TABLE llx_expedition ADD COLUMN ref_customer varchar(30) AFTER entity; -ALTER TABLE llx_expedition ADD COLUMN date_delivery date DEFAULT NULL AFTER date_expedition; -ALTER TABLE llx_expedition CHANGE COLUMN fk_adresse_livraison fk_address integer DEFAULT NULL; - -ALTER TABLE llx_livraison DROP FOREIGN KEY fk_livraison_fk_adresse_livraison; -ALTER TABLE llx_livraison DROP INDEX idx_livraison_fk_adresse_livraison; -ALTER TABLE llx_livraison change ref_client ref_customer varchar(30); -ALTER TABLE llx_livraison change date_livraison date_delivery date DEFAULT NULL; -ALTER TABLE llx_livraison CHANGE COLUMN fk_adresse_livraison fk_address integer DEFAULT NULL; - -ALTER TABLE llx_c_actioncomm MODIFY libelle varchar(48) NOT NULL; - -ALTER TABLE llx_facture MODIFY tva double(24,8) DEFAULT 0; -ALTER TABLE llx_facture MODIFY total double(24,8) DEFAULT 0; -ALTER TABLE llx_facture MODIFY total_ttc double(24,8) DEFAULT 0; -ALTER TABLE llx_facture MODIFY amount double(24,8) DEFAULT 0 NOT NULL; - -ALTER TABLE llx_facturedet MODIFY tva_tx double(6,3); -ALTER TABLE llx_facturedet MODIFY subprice double(24,8); -ALTER TABLE llx_facturedet MODIFY price double(24,8); -ALTER TABLE llx_facturedet MODIFY total_ht double(24,8); -ALTER TABLE llx_facturedet MODIFY total_tva double(24,8); -ALTER TABLE llx_facturedet MODIFY total_ttc double(24,8); - -ALTER TABLE llx_facture_rec MODIFY tva double(24,8) DEFAULT 0; -ALTER TABLE llx_facture_rec MODIFY total double(24,8) DEFAULT 0; -ALTER TABLE llx_facture_rec MODIFY total_ttc double(24,8) DEFAULT 0; -ALTER TABLE llx_facture_rec MODIFY amount double(24,8) DEFAULT 0 NOT NULL; - -ALTER TABLE llx_facturedet_rec MODIFY tva_tx double(6,3); -ALTER TABLE llx_facturedet_rec MODIFY subprice double(24,8); -ALTER TABLE llx_facturedet_rec MODIFY price double(24,8); -ALTER TABLE llx_facturedet_rec MODIFY total_ht double(24,8); -ALTER TABLE llx_facturedet_rec MODIFY total_tva double(24,8); -ALTER TABLE llx_facturedet_rec MODIFY total_ttc double(24,8); - - -ALTER TABLE llx_adherent ADD COLUMN civilite varchar(6) after entity; - -ALTER TABLE llx_deplacement ADD COLUMN fk_projet integer DEFAULT 0 after fk_soc; - --- Custom list -DROP TABLE llx_c_field_list; -create table llx_c_field_list -( - rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, - element varchar(64) NOT NULL, - entity integer DEFAULT 1 NOT NULL, - name varchar(32) NOT NULL, - alias varchar(32) NOT NULL, - title varchar(32) NOT NULL, - align varchar(6) DEFAULT 'left', - sort tinyint DEFAULT 1 NOT NULL, - search tinyint DEFAULT 0 NOT NULL, - enabled varchar(255) DEFAULT 1, - rang integer DEFAULT 0 -)ENGINE=innodb; - -INSERT INTO llx_c_field_list (rowid, element, entity, name, alias, title, align, sort, search, enabled, rang) VALUES -(1, 'product_default', 1, 'p.ref', 'ref', 'Ref', 'left', 1, 1, '1', 1), -(2, 'product_default', 1, 'p.label', 'label', 'Label', 'left', 1, 1, '1', 2), -(3, 'product_default', 1, 'p.barcode', 'barcode', 'BarCode', 'center', 1, 1, '$conf->barcode->enabled', 3), -(4, 'product_default', 1, 'p.tms', 'datem', 'DateModification', 'center', 1, 0, '1', 4), -(5, 'product_default', 1, 'p.price', 'price', 'SellingPriceHT', 'right', 1, 0, '1', 5), -(6, 'product_default', 1, 'p.price_ttc', 'price_ttc', 'SellingPriceTTC', 'right', 1, 0, '1', 6), -(7, 'product_default', 1, 'p.stock', 'stock', 'Stock', 'right', 0, 0, '$conf->stock->enabled', 7), -(8, 'product_default', 1, 'p.envente', 'status', 'Status', 'right', 1, 0, '1', 8); - - -UPDATE llx_adherent SET pays = null where pays <= '0' and pays != '0'; -ALTER table llx_adherent MODIFY pays integer; - --- Drop old tables -DROP TABLE llx_projet_milestone; -ALTER TABLE llx_projet drop column fk_milestone; - -ALTER TABLE llx_deplacement ADD COLUMN fk_statut INTEGER DEFAULT 1 NOT NULL after type; - -drop table llx_appro; - -ALTER TABLE llx_events MODIFY COLUMN user_agent varchar(255) NULL; - -create table llx_categorie_member -( - fk_categorie integer NOT NULL, - fk_member integer NOT NULL -)ENGINE=innodb; - -ALTER TABLE llx_categorie_member ADD PRIMARY KEY (fk_categorie, fk_member); -ALTER TABLE llx_categorie_member ADD INDEX idx_categorie_member_fk_categorie (fk_categorie); -ALTER TABLE llx_categorie_member ADD INDEX idx_categorie_member_fk_member (fk_member); - -ALTER TABLE llx_categorie_member ADD CONSTRAINT fk_categorie_member_categorie_rowid FOREIGN KEY (fk_categorie) REFERENCES llx_categorie (rowid); -ALTER TABLE llx_categorie_member ADD CONSTRAINT fk_categorie_member_member_rowid FOREIGN KEY (fk_member) REFERENCES llx_adherent (rowid); - -ALTER TABLE llx_product ADD COLUMN canvas varchar(32) DEFAULT 'default@product'; -ALTER TABLE llx_product MODIFY COLUMN canvas varchar(32) DEFAULT 'default@product'; -UPDATE llx_product SET canvas = 'default@product' WHERE fk_product_type = 0 AND (canvas = '' OR canvas = 'default'); -UPDATE llx_product SET canvas = 'service@product' WHERE fk_product_type = 1 AND (canvas = '' OR canvas = 'service'); -UPDATE llx_product SET canvas = 'livre@droitpret' WHERE canvas = 'livre'; -UPDATE llx_product SET canvas = 'livrecontrat@droitpret' WHERE canvas = 'livrecontrat'; -UPDATE llx_product SET canvas = 'livrecouverture@droitpret' WHERE canvas = 'livrecouverture'; - - -ALTER TABLE llx_menu DROP INDEX idx_menu_uk_menu; - -ALTER TABLE llx_menu ADD UNIQUE INDEX idx_menu_uk_menu (menu_handler, fk_menu, position, url, entity); - -UPDATE llx_const SET name = 'MAIN_MODULE_PRODUCT' WHERE name = 'MAIN_MODULE_PRODUIT'; - -UPDATE llx_expedition set ref_customer = NULL where ref_customer = ''; - --- Add more predefined action codes -- -insert into llx_c_actioncomm (id, code, type, libelle, module) values (30, 'AC_SUP_ORD', 'system', 'Send supplier order by email' ,'supplier_order'); -insert into llx_c_actioncomm (id, code, type, libelle, module) values (31, 'AC_SUP_INV', 'system', 'Send supplier invoice by email' ,'supplier_invoice'); - --- Rename llx_societe_adresse_livraison -ALTER TABLE llx_societe_adresse_livraison RENAME TO llx_societe_address; -ALTER TABLE llx_societe_address CHANGE COLUMN nom name varchar(60); -ALTER TABLE llx_societe_address CHANGE COLUMN fk_societe fk_soc integer DEFAULT 0; - --- Add new spanish VAT from July 2010 -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,note,active) values ( 45, 4, '18','0','4','VAT standard rate from July 2010',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,note,active) values ( 46, 4, '8','0','1','VAT reduced rate from July 2010',1); - --- Add Argentina Data --- Regions Argentina (id pays=23) -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (2301, 23, 2301, '', 0, 'Norte', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (2302, 23, 2302, '', 0, 'Litoral', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (2303, 23, 2303, '', 0, 'Cuyana', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (2304, 23, 2304, '', 0, 'Central', 1); -INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (2305, 23, 2305, '', 0, 'Patagonia', 1); - --- Provinces Argentina -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('2301', 2301, '', 01, 'CATAMARCA', 'Catamarca', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('2302', 2301, '', 02, 'YUJUY', 'Yujuy', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('2303', 2301, '', 03, 'TUCAMAN', 'Tucamán', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('2304', 2301, '', 04, 'SANTIAGO DEL ESTERO', 'Santiago del Estero', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('2305', 2301, '', 05, 'SALTA', 'Salta', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('2306', 2302, '', 06, 'CHACO', 'Chaco', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('2307', 2302, '', 07, 'CORRIENTES', 'Corrientes', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('2308', 2302, '', 08, 'ENTRE RIOS', 'Entre Ríos', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('2309', 2302, '', 09, 'FORMOSA MISIONES', 'Formosa Misiones', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('2310', 2302, '', 10, 'SANTA FE', 'Santa Fe', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('2311', 2303, '', 11, 'LA RIOJA', 'La Rioja', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('2312', 2303, '', 12, 'MENDOZA', 'Mendoza', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('2313', 2303, '', 13, 'SAN JUAN', 'San Juan', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('2314', 2303, '', 14, 'SAN LUIS', 'San Luis', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('2315', 2304, '', 15, 'CORDOBA', 'Córdoba', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('2316', 2304, '', 16, 'BUENOS AIRES', 'Buenos Aires', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('2317', 2304, '', 17, 'CABA', 'Caba', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('2318', 2305, '', 18, 'LA PAMPA', 'La Pampa', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('2319', 2305, '', 19, 'NEUQUEN', 'Neuquén', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('2320', 2305, '', 20, 'RIO NEGRO', 'Río Negro', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('2321', 2305, '', 21, 'CHUBUT', 'Chubut', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('2322', 2305, '', 22, 'SANTA CRUZ', 'Santa Cruz', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('2323', 2305, '', 23, 'TIERRA DEL FUEGO', 'Tierra del Fuego', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('2324', 2305, '', 24, 'ISLAS MALVINAS', 'Islas Malvinas', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('2325', 2305, '', 25, 'ANTARTIDA', 'Antártida', 1); - --- Juridical status Argentina -INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (23, '2301', 'Monotributista', 1); -INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (23, '2302', 'Sociedad Civil', 1); -INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (23, '2303', 'Sociedades Comerciales', 1); -INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (23, '2304', 'Sociedades de Hecho', 1); -INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (23, '2305', 'Sociedades Irregulares', 1); -INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (23, '2306', 'Sociedad Colectiva', 1); -INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (23, '2307', 'Sociedad en Comandita Simple', 1); -INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (23, '2308', 'Sociedad de Capital e Industria', 1); -INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (23, '2309', 'Sociedad Accidental o en participación', 1); -INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (23, '2310', 'Sociedad de Responsabilidad Limitada', 1); -INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (23, '2311', 'Sociedad Anónima', 1); -INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (23, '2312', 'Sociedad Anónima con Participación Estatal Mayoritaria', 1); -INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (23, '2313', 'Sociedad en Comandita por Acciones (arts. 315 a 324, LSC)', 1); - - -DELETE from llx_const where name='USER_PASSWORD_GENERATED' and value='default'; - - -ALTER TABLE llx_boxes_def DROP INDEX uk_boxes_def; -ALTER TABLE llx_boxes_def MODIFY file varchar(200) NOT NULL; -ALTER TABLE llx_boxes_def MODIFY note varchar(130); -ALTER TABLE llx_boxes_def ADD UNIQUE INDEX uk_boxes_def (file, entity, note); - --- Fix bad old data -UPDATE llx_bank_url SET type='payment' WHERE type='?' AND label='(payment)' AND url LIKE '%compta/paiement/fiche.php%'; - - -update llx_const set value ='eldy' where name = 'MAIN_THEME' and (value= 'rodolphe' or value='dev' or value='bluelagoon'); -update llx_user_param set value ='eldy' where param = 'MAIN_THEME' and (value= 'rodolphe' or value='dev' or value='bluelagoon'); - - -ALTER TABLE llx_tmp_caisse MODIFY fk_article integer NOT NULL; diff --git a/htdocs/install/mysql/migration/2.9.0-3.0.0.sql b/htdocs/install/mysql/migration/2.9.0-3.0.0.sql deleted file mode 100644 index b3fbcca8ed1..00000000000 --- a/htdocs/install/mysql/migration/2.9.0-3.0.0.sql +++ /dev/null @@ -1,169 +0,0 @@ --- --- Be carefull to requests order. --- This file must be loaded by calling /install/index.php page --- when current version is 2.9.0 or higher. --- --- To add a column: ALTER TABLE llx_table ADD COLUMN newcol varchar(60) NOT NULL DEFAULT '0' AFTER existingcol; --- To rename a column: ALTER TABLE llx_table CHANGE COLUMN oldname newname varchar(60); --- To change type of field: ALTER TABLE llx_table MODIFY name varchar(60); --- To remove a column: ALTER TABLE llx_table DROP COLUMN colname; - -ALTER TABLE llx_paiement MODIFY amount double(24,8); -ALTER TABLE llx_paiement_facture MODIFY amount double(24,8); - --- Fix bad old data -UPDATE llx_bank_url SET type='payment' WHERE type='?' AND label='(payment)' AND url LIKE '%compta/paiement/fiche.php%'; - --- Add recuperableonly field -ALTER TABLE llx_product add COLUMN recuperableonly integer NOT NULL DEFAULT '0' after tva_tx; -ALTER TABLE llx_product_price add COLUMN recuperableonly integer NOT NULL DEFAULT '0' after tva_tx; - --- Rename envente into tosell and add tobuy -ALTER TABLE llx_product CHANGE COLUMN envente tosell tinyint DEFAULT 1; -ALTER TABLE llx_product add COLUMN tobuy tinyint DEFAULT 1 after tosell; -ALTER TABLE llx_product_price CHANGE COLUMN envente tosell tinyint DEFAULT 1; - -ALTER TABLE llx_bank MODIFY COLUMN fk_type varchar(6); - -ALTER TABLE llx_boxes_def DROP INDEX uk_boxes_def; -ALTER TABLE llx_boxes_def MODIFY file varchar(200) NOT NULL; -ALTER TABLE llx_boxes_def MODIFY note varchar(130); -ALTER TABLE llx_boxes_def ADD UNIQUE INDEX uk_boxes_def (file, entity, note); - -ALTER TABLE llx_notify_def MODIFY fk_contact integer NULL; -ALTER TABLE llx_notify_def ADD COLUMN fk_user integer NULL after fk_contact; -ALTER TABLE llx_notify_def ADD COLUMN type varchar(16) DEFAULT 'email'; - -ALTER TABLE llx_notify MODIFY fk_contact integer NULL; -ALTER TABLE llx_notify ADD COLUMN fk_user integer NULL after fk_contact; -ALTER TABLE llx_notify ADD COLUMN type varchar(16) DEFAULT 'email'; - -ALTER TABLE llx_actioncomm MODIFY label varchar(128) NOT NULL; - -ALTER TABLE llx_expedition MODIFY date_expedition datetime; -ALTER TABLE llx_expedition MODIFY date_delivery datetime NULL; - -ALTER TABLE llx_societe ADD COLUMN canvas varchar(32) NULL AFTER default_lang; -ALTER TABLE llx_societe MODIFY canvas varchar(32) NULL; - -ALTER TABLE llx_cond_reglement RENAME TO llx_c_payment_term; -ALTER TABLE llx_expedition_methode RENAME TO llx_c_shipment_mode; - -ALTER TABLE llx_facturedet_rec ADD COLUMN special_code integer UNSIGNED DEFAULT 0 AFTER total_ttc; -ALTER TABLE llx_facturedet_rec ADD COLUMN rang integer DEFAULT 0 AFTER special_code; - -ALTER TABLE llx_actioncomm ADD COLUMN fk_supplier_order integer; -ALTER TABLE llx_actioncomm ADD COLUMN fk_supplier_invoice integer; - -ALTER TABLE llx_propaldet ADD COLUMN fk_parent_line integer NULL AFTER fk_propal; -ALTER TABLE llx_commandedet ADD COLUMN fk_parent_line integer NULL AFTER fk_commande; -ALTER TABLE llx_facturedet ADD COLUMN fk_parent_line integer NULL AFTER fk_facture; -ALTER TABLE llx_facturedet_rec ADD COLUMN fk_parent_line integer NULL AFTER fk_facture; - --- Remove old Spanish TVA -UPDATE llx_c_tva SET taux = '18' WHERE rowid = 41; -UPDATE llx_c_tva SET taux = '8' WHERE rowid = 42; -DELETE FROM llx_c_tva WHERE rowid = 45; -DELETE FROM llx_c_tva WHERE rowid = 46; - - -ALTER TABLE llx_adherent ADD COLUMN import_key varchar(14); -ALTER TABLE llx_categorie ADD COLUMN import_key varchar(14); - - -ALTER TABLE llx_product ADD COLUMN customcode varchar(32) after note; -ALTER TABLE llx_product ADD COLUMN fk_country integer after customcode; - - -ALTER TABLE llx_ecm_directories ADD UNIQUE INDEX idx_ecm_directories (label, fk_parent, entity); -ALTER TABLE llx_ecm_documents ADD UNIQUE INDEX idx_ecm_documents (fullpath_dol); - --- Add modules facture fournisseur -INSERT INTO llx_const (name, value, type, note, visible) values ('INVOICE_SUPPLIER_ADDON_PDF', 'canelle','chaine','',0); -ALTER TABLE llx_facture_fourn ADD COLUMN model_pdf varchar(50) after note_public; - -CREATE TABLE llx_c_ziptown -( - rowid integer NOT NULL AUTO_INCREMENT PRIMARY KEY, - code varchar(5) DEFAULT NULL, - fk_county integer NOT NULL, - zip varchar(10) NOT NULL, - town varchar(255) NOT NULL, - active tinyint NOT NULL DEFAULT 1 -) ENGINE=innodb; - -ALTER TABLE llx_c_ziptown ADD INDEX idx_c_ziptown_fk_county (fk_county); -ALTER TABLE llx_c_ziptown ADD CONSTRAINT fk_c_ziptown_fk_county FOREIGN KEY (fk_county) REFERENCES llx_c_departements (rowid); - -ALTER TABLE llx_socpeople ADD COLUMN canvas varchar(32) NULL after default_lang; -ALTER TABLE llx_socpeople MODIFY canvas varchar(32) NULL; - -UPDATE llx_socpeople SET canvas = 'default' WHERE canvas = 'default@contact'; -UPDATE llx_societe SET canvas = 'default' WHERE canvas = 'default@thirdparty'; -UPDATE llx_societe SET canvas = 'individual' WHERE canvas = 'individual@thirdparty'; - -INSERT INTO llx_const (name, value, type, note, visible) values ('MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS','7','chaine','Tolérance de retard avant alerte (en jours) sur commandes fournisseurs non traitées',0); - -ALTER TABLE llx_actioncomm ADD COLUMN fulldayevent smallint NOT NULL default 0 after priority; - --- Enhance POS module -DROP TABLE llx_tmp_caisse; -CREATE TABLE llx_pos_tmp ( - id integer NOT NULL AUTO_INCREMENT PRIMARY KEY, - fk_article integer NOT NULL, - qte real NOT NULL, - fk_tva integer NOT NULL, - remise_percent real NOT NULL, - remise real NOT NULL, - total_ht double(24,8) NOT NULL, - total_tva double(24,8) NOT NULL, - total_ttc double(24,8) NOT NULL -) ENGINE=innodb; - --- Add external ref -ALTER TABLE llx_facture ADD COLUMN ref_ext varchar(30) after entity; -ALTER TABLE llx_commande ADD COLUMN ref_ext varchar(30) after entity; -ALTER TABLE llx_propal ADD COLUMN ref_ext varchar(30) after entity; -ALTER TABLE llx_user ADD COLUMN ref_ext varchar(30) after entity; -ALTER TABLE llx_societe ADD COLUMN ref_ext varchar(60) after entity; -ALTER TABLE llx_product ADD COLUMN ref_ext varchar(30) after entity; - - -ALTER TABLE llx_mailing_cibles CHANGE COLUMN url source_url integer; -ALTER TABLE llx_mailing_cibles MODIFY source_url varchar(160); -ALTER TABLE llx_mailing_cibles ADD COLUMN source_id integer after source_url; -ALTER TABLE llx_mailing_cibles ADD COLUMN source_type varchar(16) after source_id; - -ALTER TABLE llx_facture_rec DROP COLUMN frequency; -ALTER TABLE llx_facture_rec ADD COLUMN frequency integer; -ALTER TABLE llx_facture_rec ADD COLUMN unit_frequency varchar(2) DEFAULT 'd'; -ALTER TABLE llx_facture_rec ADD COLUMN date_when datetime DEFAULT NULL; -ALTER TABLE llx_facture_rec ADD COLUMN date_last_gen datetime DEFAULT NULL; -ALTER TABLE llx_facture_rec ADD COLUMN nb_gen_done integer DEFAULT NULL; -ALTER TABLE llx_facture_rec ADD COLUMN nb_gen_max integer DEFAULT NULL; - - -ALTER TABLE llx_user ADD COLUMN openid varchar(255); - --- Enhance Withdrawal module -INSERT INTO llx_action_def (rowid,code,titre,description,objet_type) values (7,'NOTIFY_TRN_WITHDRAW','Transmit withdraw','Executed when a withdrawal is transmited','withdraw'); -INSERT INTO llx_action_def (rowid,code,titre,description,objet_type) values (8,'NOTIFY_CRD_WITHDRAW','Credite withdraw','Executed when a withdrawal is credited','withdraw'); -INSERT INTO llx_action_def (rowid,code,titre,description,objet_type) values (9,'NOTIFY_EMT_WITHDRAW','Emit withdraw','Executed when a withdrawal is emited','withdraw'); - -ALTER TABLE llx_prelevement_notifications MODIFY action varchar(32); - -ALTER TABLE llx_c_tva ADD COLUMN accountancy_code varchar(15) DEFAULT NULL; - - -UPDATE llx_c_actioncomm set module='invoice_supplier' WHERE module='supplier_invoice'; -UPDATE llx_c_actioncomm set module='order_supplier' WHERE module='supplier_order'; -UPDATE llx_documentmodel set type='invoice_supplier' WHERE type='supplier_invoice'; -UPDATE llx_documentmodel set type='order_supplier' WHERE type='supplier_order'; -UPDATE llx_c_type_contact set element='invoice_supplier' WHERE element='facture_fourn'; -UPDATE llx_c_type_contact set module='invoice_supplier' WHERE module='supplier_invoice'; -UPDATE llx_c_type_contact set module='order_supplier' WHERE module='supplier_order'; - -ALTER TABLE llx_facturedet DROP INDEX uk_fk_remise_except; -ALTER TABLE llx_facturedet ADD UNIQUE INDEX uk_fk_remise_except (fk_remise_except, fk_facture); - -ALTER TABLE llx_societe_remise MODIFY remise_client double(6,3) DEFAULT 0 NOT NULL; diff --git a/htdocs/install/mysql/migration/3.5.0-3.6.0.sql b/htdocs/install/mysql/migration/3.5.0-3.6.0.sql index 919fbee7d4d..b36c27de253 100644 --- a/htdocs/install/mysql/migration/3.5.0-3.6.0.sql +++ b/htdocs/install/mysql/migration/3.5.0-3.6.0.sql @@ -38,7 +38,7 @@ create table llx_c_email_templates ( rowid integer AUTO_INCREMENT PRIMARY KEY, entity integer DEFAULT 1 NOT NULL, -- multi company id - type_template varchar(32), -- template for wich type of email (send invoice by email, send order, ...) + type_template varchar(32), -- template for which type of email (send invoice by email, send order, ...) datec datetime, label varchar(255), content text @@ -196,6 +196,10 @@ ALTER TABLE llx_expeditiondet_batch ADD INDEX idx_fk_expeditiondet (fk_expeditio ALTER TABLE llx_expeditiondet_batch ADD CONSTRAINT fk_expeditiondet_batch_fk_expeditiondet FOREIGN KEY (fk_expeditiondet) REFERENCES llx_expeditiondet(rowid); +ALTER TABLE llx_product_batch ADD INDEX ix_fk_product_stock (fk_product_stock); +ALTER TABLE llx_product_batch ADD CONSTRAINT fk_product_batch_fk_product_stock FOREIGN KEY (fk_product_stock) REFERENCES llx_product_stock (rowid); + + -- New 1074 : Stock mouvement link to origin ALTER TABLE llx_stock_mouvement ADD fk_origin integer; ALTER TABLE llx_stock_mouvement ADD origintype VARCHAR(32); diff --git a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql new file mode 100644 index 00000000000..868496f3316 --- /dev/null +++ b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql @@ -0,0 +1,994 @@ +-- +-- Be carefull to requests order. +-- This file must be loaded by calling /install/index.php page +-- when current version is 3.7.0 or higher. +-- +-- To rename a table: ALTER TABLE llx_table RENAME TO llx_table_new; +-- To add a column: ALTER TABLE llx_table ADD COLUMN newcol varchar(60) NOT NULL DEFAULT '0' AFTER existingcol; +-- To rename a column: ALTER TABLE llx_table CHANGE COLUMN oldname newname varchar(60); +-- To drop a column: ALTER TABLE llx_table DROP COLUMN oldname; +-- To change type of field: ALTER TABLE llx_table MODIFY COLUMN name varchar(60); +-- To drop a foreign key: ALTER TABLE llx_table DROP FOREIGN KEY fk_name; +-- To restrict request to Mysql version x.y use -- VMYSQLx.y +-- To restrict request to Pgsql version x.y use -- VPGSQLx.y +-- To make pk to be auto increment (mysql): VMYSQL4.3 ALTER TABLE llx_c_shipment_mode CHANGE COLUMN rowid rowid INTEGER NOT NULL AUTO_INCREMENT; +-- To make pk to be auto increment (postgres): VPGSQL8.2 NOT POSSIBLE. MUST DELETE/CREATE TABLE +-- To set a field as NULL: VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name DROP NOT NULL; +-- To set a field as defailt NULL: VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name SET DEFAULT NULL; +-- -- VPGSQL8.2 DELETE FROM llx_usergroup_user WHERE fk_user NOT IN (SELECT rowid from llx_user); +-- -- VMYSQL4.1 DELETE FROM llx_usergroup_user WHERE fk_usergroup NOT IN (SELECT rowid from llx_usergroup); + + + +ALTER TABLE llx_c_paiement ADD COLUMN accountancy_code varchar(32) DEFAULT NULL AFTER active; + +-- Defined only to have specific list for countries that can't use generic list (like argentina that need type A or B) +ALTER TABLE llx_c_typent ADD COLUMN fk_country integer NULL AFTER libelle; + +INSERT INTO llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values (29,'FICHINTER_CLASSIFY_BILLED','Classify intervention as billed','Executed when a intervention is classified as billed (when option FICHINTER_DISABLE_DETAILS is set)','ficheinter',19); + +INSERT INTO llx_c_actioncomm (id, code, type, libelle, module, active, position) values (11,'AC_INT','system','Intervention on site',NULL, 1, 4); + + +ALTER TABLE llx_user ADD COLUMN fk_user_creat integer AFTER tms; +ALTER TABLE llx_user ADD COLUMN fk_user_modif integer AFTER fk_user_creat; + + +ALTER TABLE llx_accountingaccount add column entity integer DEFAULT 1 NOT NULL AFTER rowid; +ALTER TABLE llx_accountingaccount add column datec datetime NOT NULL AFTER entity; +ALTER TABLE llx_accountingaccount add column tms timestamp AFTER datec; +ALTER TABLE llx_accountingaccount add column fk_user_author integer DEFAULT NULL AFTER label; +ALTER TABLE llx_accountingaccount add column fk_user_modif integer DEFAULT NULL AFTER fk_user_author; + + +-- Drop old table +DROP TABLE llx_compta; +DROP TABLE llx_compta_account; +DROP TABLE llx_compta_compte_generaux; + +-- Align size for accounting account +ALTER TABLE llx_accountingaccount MODIFY COLUMN account_number varchar(32); +ALTER TABLE llx_accountingaccount MODIFY COLUMN account_parent varchar(32); +ALTER TABLE llx_accountingdebcred MODIFY COLUMN account_number varchar(32); +ALTER TABLE llx_bank_account MODIFY COLUMN account_number varchar(32); +ALTER TABLE llx_c_chargesociales MODIFY COLUMN accountancy_code varchar(32); +ALTER TABLE llx_c_revenuestamp MODIFY COLUMN accountancy_code_sell varchar(32); +ALTER TABLE llx_c_revenuestamp MODIFY COLUMN accountancy_code_buy varchar(32); +ALTER TABLE llx_c_tva MODIFY COLUMN accountancy_code_sell varchar(32); +ALTER TABLE llx_c_tva MODIFY COLUMN accountancy_code_buy varchar(32); +ALTER TABLE llx_product MODIFY COLUMN accountancy_code_sell varchar(32); +ALTER TABLE llx_product MODIFY COLUMN accountancy_code_buy varchar(32); +ALTER TABLE llx_user MODIFY COLUMN accountancy_code varchar(32); + + +ALTER TABLE llx_bank_account ADD COLUMN accountancy_journal varchar(3) DEFAULT NULL AFTER account_number; + +ALTER TABLE llx_projet_task_time ADD COLUMN task_datehour datetime after task_date; + + +-- Localtaxes by thirds +ALTER TABLE llx_c_tva MODIFY COLUMN localtax1 varchar(10); +ALTER TABLE llx_c_tva MODIFY COLUMN localtax2 varchar(10); +ALTER TABLE llx_localtax ADD COLUMN localtaxtype tinyint after entity; +ALTER TABLE llx_societe ADD COLUMN localtax1_value double(6,3) after localtax1_assuj; +ALTER TABLE llx_societe ADD COLUMN localtax2_value double(6,3) after localtax2_assuj; + +-- Change on table c_pays +ALTER TABLE llx_c_pays RENAME TO llx_c_country; + +ALTER TABLE llx_c_country CHANGE libelle label VARCHAR(50); + +ALTER TABLE llx_c_ziptown ADD CONSTRAINT fk_c_ziptown_fk_pays FOREIGN KEY (fk_pays) REFERENCES llx_c_country (rowid); +ALTER TABLE llx_c_regions ADD CONSTRAINT fk_c_regions_fk_pays FOREIGN KEY (fk_pays) REFERENCES llx_c_country (rowid); + + +-- Added missing relations of llx_product +-- fk_country +ALTER TABLE llx_product MODIFY COLUMN fk_country INTEGER NULL DEFAULT NULL; +-- VPGSQL8.2 ALTER TABLE llx_product ALTER COLUMN fk_country DROP NOT NULL; +-- VPGSQL8.2 ALTER TABLE llx_product ALTER COLUMN fk_country SET DEFAULT NULL; +UPDATE llx_product SET fk_country = NULL WHERE fk_country = 0; +ALTER TABLE llx_product ADD INDEX idx_product_fk_country (fk_country); +ALTER TABLE llx_product ADD CONSTRAINT fk_product_fk_country FOREIGN KEY (fk_country) REFERENCES llx_c_country (rowid); +-- fk_user_author +ALTER TABLE llx_product MODIFY COLUMN fk_user_author INTEGER NULL DEFAULT NULL; +-- VPGSQL8.2 ALTER TABLE llx_product ALTER COLUMN fk_user_author DROP NOT NULL; +-- VPGSQL8.2 ALTER TABLE llx_product ALTER COLUMN fk_user_author SET DEFAULT NULL; +ALTER TABLE llx_product ADD INDEX idx_product_fk_user_author (fk_user_author); +-- fk_barcode_type +ALTER TABLE llx_product MODIFY COLUMN fk_barcode_type INTEGER NULL DEFAULT NULL; +-- VPGSQL8.2 ALTER TABLE llx_product ALTER COLUMN fk_barcode_type DROP NOT NULL; +-- VPGSQL8.2 ALTER TABLE llx_product ALTER COLUMN fk_barcode_type SET DEFAULT NULL; +UPDATE llx_product SET fk_barcode_type = NULL WHERE fk_barcode_type = 0; +ALTER TABLE llx_product ADD INDEX idx_product_fk_barcode_type (fk_barcode_type); +ALTER TABLE llx_product ADD CONSTRAINT fk_product_barcode_type FOREIGN KEY (fk_barcode_type) REFERENCES llx_c_barcode_type (rowid); + + +-- Added missing relations of llx_product_price +-- fk_user_author +ALTER TABLE llx_product_price ADD INDEX idx_product_price_fk_user_author (fk_user_author); +UPDATE llx_product_price set fk_user_author = null where fk_user_author = 0; +ALTER TABLE llx_product_price ADD CONSTRAINT fk_product_price_user_author FOREIGN KEY (fk_user_author) REFERENCES llx_user (rowid); +-- fk_user_author +ALTER TABLE llx_product_price ADD INDEX idx_product_price_fk_product (fk_product); +DELETE from llx_product_price where fk_product NOT IN (SELECT rowid from llx_product); +ALTER TABLE llx_product_price ADD CONSTRAINT fk_product_price_product FOREIGN KEY (fk_product) REFERENCES llx_product (rowid); + +ALTER TABLE llx_commande_fournisseur ADD COLUMN fk_account integer AFTER date_livraison; +ALTER TABLE llx_facture_fourn ADD COLUMN fk_account integer AFTER fk_projet; + +-- Fiscal years +create table llx_accounting_fiscalyear +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + label varchar(128) NOT NULL, + date_start date, + date_end date, + statut tinyint DEFAULT 0 NOT NULL, + entity integer DEFAULT 1 NOT NULL, -- multi company id + datec datetime NOT NULL, + tms timestamp, + fk_user_author integer NULL, + fk_user_modif integer NULL +)ENGINE=innodb; + +ALTER TABLE llx_contrat ADD COLUMN ref_ext varchar(30) after ref; +ALTER TABLE llx_contrat ADD COLUMN ref_customer varchar(30) after ref_ext; + +ALTER TABLE llx_propal ADD COLUMN fk_shipping_method integer AFTER date_livraison; +ALTER TABLE llx_commande ADD COLUMN fk_shipping_method integer AFTER date_livraison; + +ALTER TABLE llx_adherents MODIFY COLUMN societe VARCHAR(60); + +-- +-- Descriptif des plans comptables ES PCG08-PYME +-- + +INSERT INTO llx_accounting_system (rowid, pcg_version, fk_pays, label, active) VALUES (4, 'PCG08-PYME', '4', 'The PYME accountancy spanish plan', '1'); + +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4001,'PCG08-PYME','FINANCIACION', 'XXXXXX', '1', '', 'Financiación básica', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4002,'PCG08-PYME','ACTIVO', 'XXXXXX', '2', '', 'Activo no corriente', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4003,'PCG08-PYME','EXISTENCIAS', 'XXXXXX', '3', '', 'Existencias', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4004,'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4', '', 'Acreedores y deudores por operaciones comerciales', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4005,'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5', '', 'Cuentas financieras', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4006,'PCG08-PYME','COMPRAS_Y_GASTOS','XXXXXX', '6', '', 'Compras y gastos', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4007,'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7', '', 'Ventas e ingresos', '1'); + +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4008, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '10', '4001', 'CAPITAL', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4009, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '100', '4008', 'Capital social', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4010, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '101', '4008', 'Fondo social', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4011, 'PCG08-PYME','FINANCIACION', 'CAPITAL', '102', '4008', 'Capital', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4012, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '103', '4008', 'Socios por desembolsos no exigidos', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4013, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '1030', '4012', 'Socios por desembolsos no exigidos capital social', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4014, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '1034', '4012', 'Socios por desembolsos no exigidos capital pendiente de inscripción', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4015, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '104', '4008', 'Socios por aportaciones no dineradas pendientes', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4016, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '1040', '4015', 'Socios por aportaciones no dineradas pendientes capital social', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4017, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '1044', '4015', 'Socios por aportaciones no dineradas pendientes capital pendiente de inscripción', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4018, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '108', '4008', 'Acciones o participaciones propias en situaciones especiales', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4019, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '109', '4008', 'Acciones o participaciones propias para reducción de capital', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4020, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '11', '4001', 'Reservas y otros instrumentos de patrimonio', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4021, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '110', '4020', 'Prima de emisión o asunción', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4022, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '111', '4020', 'Otros instrumentos de patrimonio neto', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4023, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '1110', '4022', 'Patrimonio neto por emisión de instrumentos financieros compuestos', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4024, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '1111', '4022', 'Resto de instrumentos de patrimoio neto', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4025, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '112', '4020', 'Reserva legal', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4026, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '113', '4020', 'Reservas voluntarias', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4027, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '114', '4020', 'Reservas especiales', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4028, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '1140', '4027', 'Reservas para acciones o participaciones de la sociedad dominante', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4029, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '1141', '4027', 'Reservas estatutarias', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4030, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '1142', '4027', 'Reservas por capital amortizado', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4031, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '1143', '4027', 'Reservas por fondo de comercio', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4032, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '1144', '4028', 'Reservas por acciones propias aceptadas en garantía', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4033, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '115', '4020', 'Reservas por pérdidas y ganancias actuariales y otros ajustes', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4034, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '118', '4020', 'Aportaciones de socios o propietarios', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4035, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '119', '4020', 'Diferencias por ajuste del capital a euros', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4036, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '12', '4001', 'Resultados pendientes de aplicación', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4037, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '120', '4036', 'Remanente', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4038, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '121', '4036', 'Resultados negativos de ejercicios anteriores', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4039, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '129', '4036', 'Resultado del ejercicio', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4040, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '13', '4001', 'Subvenciones, donaciones y ajustes por cambio de valor', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4041, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '130', '4040', 'Subvenciones oficiales de capital', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4042, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '131', '4040', 'Donaciones y legados de capital', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4043, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '132', '4040', 'Otras subvenciones, donaciones y legados', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4044, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '133', '4040', 'Ajustes por valoración en activos financieros disponibles para la venta', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4045, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '134', '4040', 'Operaciones de cobertura', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4046, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '1340', '4045', 'Cobertura de flujos de efectivo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4047, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '1341', '4045', 'Cobertura de una inversión neta en un negocio extranjero', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4048, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '135', '4040', 'Diferencias de conversión', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4049, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '136', '4040', 'Ajustes por valoración en activos no corrientes y grupos enajenables de elementos mantenidos para la venta', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4050, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '137', '4040', 'Ingresos fiscales a distribuir en varios ejercicios', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4051, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '1370', '4050', 'Ingresos fiscales por diferencias permanentes a distribuir en varios ejercicios', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4052, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '1371', '4050', 'Ingresos fiscales por deducciones y bonificaciones a distribuir en varios ejercicios', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4053, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '14', '4001', 'Provisiones', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4054, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '141', '4053', 'Provisión para impuestos', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4055, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '142', '4053', 'Provisión para otras responsabilidades', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4056, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '143', '4053', 'Provisión por desmantelamiento, retiro o rehabilitación del inmovilizado', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4057, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '145', '4053', 'Provisión para actuaciones medioambientales', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4058, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '15', '4001', 'Deudas a largo plazo con características especiales', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4059, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '150', '4058', 'Acciones o participaciones a largo plazo consideradas como pasivos financieros', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4060, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '153', '4058', 'Desembolsos no exigidos por acciones o participaciones consideradas como pasivos financieros', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4061, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '1533', '4060', 'Desembolsos no exigidos empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4062, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '1534', '4060', 'Desembolsos no exigidos empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4063, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '1535', '4060', 'Desembolsos no exigidos otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4064, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '1536', '4060', 'Otros desembolsos no exigidos', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4065, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '154', '4058', 'Aportaciones no dinerarias pendientes por acciones o participaciones consideradas como pasivos financieros', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4066, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '1543', '4065', 'Aportaciones no dinerarias pendientes empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4067, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '1544', '4065', 'Aportaciones no dinerarias pendientes empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4068, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '1545', '4065', 'Aportaciones no dinerarias pendientes otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4069, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '1546', '4065', 'Otras aportaciones no dinerarias pendientes', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4070, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '16', '4001', 'Deudas a largo plazo con partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4071, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '160', '4070', 'Deudas a largo plazo con entidades de crédito vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4072, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '1603', '4071', 'Deudas a largo plazo con entidades de crédito empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4073, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '1604', '4071', 'Deudas a largo plazo con entidades de crédito empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4074, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '1605', '4071', 'Deudas a largo plazo con otras entidades de crédito vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4075, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '161', '4070', 'Proveedores de inmovilizado a largo plazo partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4076, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '1613', '4075', 'Proveedores de inmovilizado a largo plazo empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4077, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '1614', '4075', 'Proveedores de inmovilizado a largo plazo empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4078, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '1615', '4075', 'Proveedores de inmovilizado a largo plazo otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4079, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '162', '4070', 'Acreedores por arrendamiento financiero a largo plazo partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4080, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '1623', '4079', 'Acreedores por arrendamiento financiero a largo plazo empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4081, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '1624', '4080', 'Acreedores por arrendamiento financiero a largo plazo empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4082, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '1625', '4080', 'Acreedores por arrendamiento financiero a largo plazo otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4083, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '163', '4070', 'Otras deudas a largo plazo con partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4084, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '1633', '4083', 'Otras deudas a largo plazo empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4085, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '1634', '4083', 'Otras deudas a largo plazo empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4086, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '1635', '4083', 'Otras deudas a largo plazo otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4087, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '17', '4001', 'Deudas a largo plazo por préstamos recibidos empresitos y otros conceptos', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4088, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '170', '4087', 'Deudas a largo plazo con entidades de crédito', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4089, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '171', '4087', 'Deudas a largo plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4090, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '172', '4087', 'Deudas a largo plazo transformables en suvbenciones donaciones y legados', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4091, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '173', '4087', 'Proveedores de inmovilizado a largo plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4092, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '174', '4087', 'Acreedores por arrendamiento financiero a largo plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4093, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '175', '4087', 'Efectos a pagar a largo plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4094, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '176', '4087', 'Pasivos por derivados financieros a largo plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4095, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '177', '4087', 'Obligaciones y bonos', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4096, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '179', '4087', 'Deudas representadas en otros valores negociables', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4097, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '18', '4001', 'Pasivos por fianzas garantias y otros conceptos a largo plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4098, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '180', '4097', 'Fianzas recibidas a largo plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4099, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '181', '4097', 'Anticipos recibidos por ventas o prestaciones de servicios a largo plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4100, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '185', '4097', 'Depositos recibidos a largo plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4101, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '19', '4001', 'Situaciones transitorias de financiación', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4102, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '190', '4101', 'Acciones o participaciones emitidas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4103, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '192', '4101', 'Suscriptores de acciones', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4104, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '194', '4101', 'Capital emitido pendiente de inscripción', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4105, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '195', '4101', 'Acciones o participaciones emitidas consideradas como pasivos financieros', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4106, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '197', '4101', 'Suscriptores de acciones consideradas como pasivos financieros', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4107, 'PCG08-PYME','FINANCIACION', 'XXXXXX', '199', '4101', 'Acciones o participaciones emitidas consideradas como pasivos financieros pendientes de inscripción', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4108, 'PCG08-PYME','ACTIVO', 'XXXXXX', '20', '4002', 'Inmovilizaciones intangibles', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4109, 'PCG08-PYME','ACTIVO', 'XXXXXX', '200', '4108', 'Investigación', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4110, 'PCG08-PYME','ACTIVO', 'XXXXXX', '201', '4108', 'Desarrollo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4111, 'PCG08-PYME','ACTIVO', 'XXXXXX', '202', '4108', 'Concesiones administrativas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4112, 'PCG08-PYME','ACTIVO', 'XXXXXX', '203', '4108', 'Propiedad industrial', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4113, 'PCG08-PYME','ACTIVO', 'XXXXXX', '205', '4108', 'Derechos de transpaso', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4114, 'PCG08-PYME','ACTIVO', 'XXXXXX', '206', '4108', 'Aplicaciones informáticas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4115, 'PCG08-PYME','ACTIVO', 'XXXXXX', '209', '4108', 'Anticipos para inmovilizaciones intangibles', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4116, 'PCG08-PYME','ACTIVO', 'XXXXXX', '21', '4002', 'Inmovilizaciones materiales', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4117, 'PCG08-PYME','ACTIVO', 'XXXXXX', '210', '4116', 'Terrenos y bienes naturales', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4118, 'PCG08-PYME','ACTIVO', 'XXXXXX', '211', '4116', 'Construcciones', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4119, 'PCG08-PYME','ACTIVO', 'XXXXXX', '212', '4116', 'Instalaciones técnicas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4120, 'PCG08-PYME','ACTIVO', 'XXXXXX', '213', '4116', 'Maquinaria', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4121, 'PCG08-PYME','ACTIVO', 'XXXXXX', '214', '4116', 'Utillaje', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4122, 'PCG08-PYME','ACTIVO', 'XXXXXX', '215', '4116', 'Otras instalaciones', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4123, 'PCG08-PYME','ACTIVO', 'XXXXXX', '216', '4116', 'Mobiliario', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4124, 'PCG08-PYME','ACTIVO', 'XXXXXX', '217', '4116', 'Equipos para procesos de información', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4125, 'PCG08-PYME','ACTIVO', 'XXXXXX', '218', '4116', 'Elementos de transporte', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4126, 'PCG08-PYME','ACTIVO', 'XXXXXX', '219', '4116', 'Otro inmovilizado material', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4127, 'PCG08-PYME','ACTIVO', 'XXXXXX', '22', '4002', 'Inversiones inmobiliarias', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4128, 'PCG08-PYME','ACTIVO', 'XXXXXX', '220', '4127', 'Inversiones en terreons y bienes naturales', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4129, 'PCG08-PYME','ACTIVO', 'XXXXXX', '221', '4127', 'Inversiones en construcciones', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4130, 'PCG08-PYME','ACTIVO', 'XXXXXX', '23', '4002', 'Inmovilizaciones materiales en curso', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4131, 'PCG08-PYME','ACTIVO', 'XXXXXX', '230', '4130', 'Adaptación de terrenos y bienes naturales', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4132, 'PCG08-PYME','ACTIVO', 'XXXXXX', '231', '4130', 'Construcciones en curso', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4133, 'PCG08-PYME','ACTIVO', 'XXXXXX', '232', '4130', 'Instalaciones técnicas en montaje', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4134, 'PCG08-PYME','ACTIVO', 'XXXXXX', '233', '4130', 'Maquinaria en montaje', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4135, 'PCG08-PYME','ACTIVO', 'XXXXXX', '237', '4130', 'Equipos para procesos de información en montaje', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4136, 'PCG08-PYME','ACTIVO', 'XXXXXX', '239', '4130', 'Anticipos para inmovilizaciones materiales', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4137, 'PCG08-PYME','ACTIVO', 'XXXXXX', '24', '4002', 'Inversiones financieras a largo plazo en partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4138, 'PCG08-PYME','ACTIVO', 'XXXXXX', '240', '4137', 'Participaciones a largo plazo en partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4139, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2403', '4138', 'Participaciones a largo plazo en empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4140, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2404', '4138', 'Participaciones a largo plazo en empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4141, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2405', '4138', 'Participaciones a largo plazo en otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4142, 'PCG08-PYME','ACTIVO', 'XXXXXX', '241', '4137', 'Valores representativos de deuda a largo plazo de partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4143, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2413', '4142', 'Valores representativos de deuda a largo plazo de empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4144, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2414', '4142', 'Valores representativos de deuda a largo plazo de empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4145, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2415', '4142', 'Valores representativos de deuda a largo plazo de otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4146, 'PCG08-PYME','ACTIVO', 'XXXXXX', '242', '4137', 'Créditos a largo plazo a partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4147, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2423', '4146', 'Créditos a largo plazo a empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4148, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2424', '4146', 'Créditos a largo plazo a empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4149, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2425', '4146', 'Créditos a largo plazo a otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4150, 'PCG08-PYME','ACTIVO', 'XXXXXX', '249', '4137', 'Desembolsos pendientes sobre participaciones a largo plazo en partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4151, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2493', '4150', 'Desembolsos pendientes sobre participaciones a largo plazo en empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4152, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2494', '4150', 'Desembolsos pendientes sobre participaciones a largo plazo en empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4153, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2495', '4150', 'Desembolsos pendientes sobre participaciones a largo plazo en otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4154, 'PCG08-PYME','ACTIVO', 'XXXXXX', '25', '4002', 'Otras inversiones financieras a largo plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4155, 'PCG08-PYME','ACTIVO', 'XXXXXX', '250', '4154', 'Inversiones financieras a largo plazo en instrumentos de patrimonio', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4156, 'PCG08-PYME','ACTIVO', 'XXXXXX', '251', '4154', 'Valores representativos de deuda a largo plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4157, 'PCG08-PYME','ACTIVO', 'XXXXXX', '252', '4154', 'Créditos a largo plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4158, 'PCG08-PYME','ACTIVO', 'XXXXXX', '253', '4154', 'Créditos a largo plazo por enajenación de inmovilizado', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4159, 'PCG08-PYME','ACTIVO', 'XXXXXX', '254', '4154', 'Créditos a largo plazo al personal', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4160, 'PCG08-PYME','ACTIVO', 'XXXXXX', '255', '4154', 'Activos por derivados financieros a largo plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4161, 'PCG08-PYME','ACTIVO', 'XXXXXX', '258', '4154', 'Imposiciones a largo plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4162, 'PCG08-PYME','ACTIVO', 'XXXXXX', '259', '4154', 'Desembolsos pendientes sobre participaciones en el patrimonio neto a largo plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4163, 'PCG08-PYME','ACTIVO', 'XXXXXX', '26', '4002', 'Fianzas y depósitos constituidos a largo plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4164, 'PCG08-PYME','ACTIVO', 'XXXXXX', '260', '4163', 'Fianzas constituidas a largo plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4165, 'PCG08-PYME','ACTIVO', 'XXXXXX', '261', '4163', 'Depósitos constituidos a largo plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4166, 'PCG08-PYME','ACTIVO', 'XXXXXX', '28', '4002', 'Amortización acumulada del inmovilizado', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4167, 'PCG08-PYME','ACTIVO', 'XXXXXX', '280', '4166', 'Amortización acumulado del inmovilizado intangible', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4168, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2800', '4167', 'Amortización acumulada de investigación', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4169, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2801', '4167', 'Amortización acumulada de desarrollo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4170, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2802', '4167', 'Amortización acumulada de concesiones administrativas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4171, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2803', '4167', 'Amortización acumulada de propiedad industrial', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4172, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2805', '4167', 'Amortización acumulada de derechos de transpaso', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4173, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2806', '4167', 'Amortización acumulada de aplicaciones informáticas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4174, 'PCG08-PYME','ACTIVO', 'XXXXXX', '281', '4166', 'Amortización acumulado del inmovilizado material', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4175, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2811', '4174', 'Amortización acumulada de construcciones', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4176, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2812', '4174', 'Amortización acumulada de instalaciones técnicas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4177, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2813', '4174', 'Amortización acumulada de maquinaria', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4178, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2814', '4174', 'Amortización acumulada de utillaje', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4179, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2815', '4174', 'Amortización acumulada de otras instalaciones', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4180, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2816', '4174', 'Amortización acumulada de mobiliario', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4181, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2817', '4174', 'Amortización acumulada de equipos para proceso de información', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4182, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2818', '4174', 'Amortización acumulada de elementos de transporte', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4183, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2819', '4175', 'Amortización acumulada de otro inmovilizado material', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4184, 'PCG08-PYME','ACTIVO', 'XXXXXX', '282', '4166', 'Amortización acumulada de las inversiones inmobiliarias', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4185, 'PCG08-PYME','ACTIVO', 'XXXXXX', '29', '4002', 'Deterioro de valor de activos no corrientes', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4186, 'PCG08-PYME','ACTIVO', 'XXXXXX', '290', '4185', 'Deterioro de valor del inmovilizado intangible', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4187, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2900', '4186', 'Deterioro de valor de investigación', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4188, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2901', '4186', 'Deterioro de valor de desarrollo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4189, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2902', '4186', 'Deterioro de valor de concesiones administrativas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4190, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2903', '4186', 'Deterioro de valor de propiedad industrial', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4191, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2905', '4186', 'Deterioro de valor de derechos de transpaso', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4192, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2906', '4186', 'Deterioro de valor de aplicaciones informáticas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4193, 'PCG08-PYME','ACTIVO', 'XXXXXX', '291', '4185', 'Deterioro de valor del inmovilizado material', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4194, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2910', '4193', 'Deterioro de valor de terrenos y bienes naturales', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4195, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2911', '4193', 'Deterioro de valor de construcciones', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4196, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2912', '4193', 'Deterioro de valor de instalaciones técnicas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4197, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2913', '4193', 'Deterioro de valor de maquinaria', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4198, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2914', '4193', 'Deterioro de valor de utillajes', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4199, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2915', '4194', 'Deterioro de valor de otras instalaciones', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4200, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2916', '4194', 'Deterioro de valor de mobiliario', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4201, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2917', '4194', 'Deterioro de valor de equipos para proceso de información', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4202, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2918', '4194', 'Deterioro de valor de elementos de transporte', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4203, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2919', '4194', 'Deterioro de valor de otro inmovilizado material', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4204, 'PCG08-PYME','ACTIVO', 'XXXXXX', '292', '4185', 'Deterioro de valor de las inversiones inmobiliarias', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4205, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2920', '4204', 'Deterioro de valor de terrenos y bienes naturales', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4206, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2921', '4204', 'Deterioro de valor de construcciones', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4207, 'PCG08-PYME','ACTIVO', 'XXXXXX', '293', '4185', 'Deterioro de valor de participaciones a largo plazo en partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4208, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2933', '4207', 'Deterioro de valor de participaciones a largo plazo en empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4209, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2934', '4207', 'Deterioro de valor de sobre participaciones a largo plazo en empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4210, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2935', '4207', 'Deterioro de valor de sobre participaciones a largo plazo en otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4211, 'PCG08-PYME','ACTIVO', 'XXXXXX', '294', '4185', 'Deterioro de valor de valores representativos de deuda a largo plazo en partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4212, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2943', '4211', 'Deterioro de valor de valores representativos de deuda a largo plazo en empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4213, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2944', '4211', 'Deterioro de valor de valores representativos de deuda a largo plazo en empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4214, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2945', '4211', 'Deterioro de valor de valores representativos de deuda a largo plazo en otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4215, 'PCG08-PYME','ACTIVO', 'XXXXXX', '295', '4185', 'Deterioro de valor de créditos a largo plazo a partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4216, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2953', '4215', 'Deterioro de valor de créditos a largo plazo a empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4217, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2954', '4215', 'Deterioro de valor de créditos a largo plazo a empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4218, 'PCG08-PYME','ACTIVO', 'XXXXXX', '2955', '4215', 'Deterioro de valor de créditos a largo plazo a otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4219, 'PCG08-PYME','ACTIVO', 'XXXXXX', '296', '4185', 'Deterioro de valor de participaciones en el patrimonio netoa largo plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4220, 'PCG08-PYME','ACTIVO', 'XXXXXX', '297', '4185', 'Deterioro de valor de valores representativos de deuda a largo plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4221, 'PCG08-PYME','ACTIVO', 'XXXXXX', '298', '4185', 'Deterioro de valor de créditos a largo plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4222, 'PCG08-PYME','EXISTENCIAS', 'XXXXXX', '30', '4003', 'Comerciales', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4223, 'PCG08-PYME','EXISTENCIAS', 'XXXXXX', '300', '4222', 'Mercaderías A', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4224, 'PCG08-PYME','EXISTENCIAS', 'XXXXXX', '301', '4222', 'Mercaderías B', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4225, 'PCG08-PYME','EXISTENCIAS', 'XXXXXX', '31', '4003', 'Materias primas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4226, 'PCG08-PYME','EXISTENCIAS', 'XXXXXX', '310', '4225', 'Materias primas A', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4227, 'PCG08-PYME','EXISTENCIAS', 'XXXXXX', '311', '4225', 'Materias primas B', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4228, 'PCG08-PYME','EXISTENCIAS', 'XXXXXX', '32', '4003', 'Otros aprovisionamientos', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4229, 'PCG08-PYME','EXISTENCIAS', 'XXXXXX', '320', '4228', 'Elementos y conjuntos incorporables', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4230, 'PCG08-PYME','EXISTENCIAS', 'XXXXXX', '321', '4228', 'Combustibles', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4231, 'PCG08-PYME','EXISTENCIAS', 'XXXXXX', '322', '4228', 'Repuestos', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4232, 'PCG08-PYME','EXISTENCIAS', 'XXXXXX', '325', '4228', 'Materiales diversos', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4233, 'PCG08-PYME','EXISTENCIAS', 'XXXXXX', '326', '4228', 'Embalajes', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4234, 'PCG08-PYME','EXISTENCIAS', 'XXXXXX', '327', '4228', 'Envases', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4235, 'PCG08-PYME','EXISTENCIAS', 'XXXXXX', '328', '4229', 'Material de oficina', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4236, 'PCG08-PYME','EXISTENCIAS', 'XXXXXX', '33', '4003', 'Productos en curso', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4237, 'PCG08-PYME','EXISTENCIAS', 'XXXXXX', '330', '4236', 'Productos en curos A', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4238, 'PCG08-PYME','EXISTENCIAS', 'XXXXXX', '331', '4236', 'Productos en curso B', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4239, 'PCG08-PYME','EXISTENCIAS', 'XXXXXX', '34', '4003', 'Productos semiterminados', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4240, 'PCG08-PYME','EXISTENCIAS', 'XXXXXX', '340', '4239', 'Productos semiterminados A', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4241, 'PCG08-PYME','EXISTENCIAS', 'XXXXXX', '341', '4239', 'Productos semiterminados B', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4242, 'PCG08-PYME','EXISTENCIAS', 'XXXXXX', '35', '4003', 'Productos terminados', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4243, 'PCG08-PYME','EXISTENCIAS', 'XXXXXX', '350', '4242', 'Productos terminados A', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4244, 'PCG08-PYME','EXISTENCIAS', 'XXXXXX', '351', '4242', 'Productos terminados B', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4245, 'PCG08-PYME','EXISTENCIAS', 'XXXXXX', '36', '4003', 'Subproductos, residuos y materiales recuperados', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4246, 'PCG08-PYME','EXISTENCIAS', 'XXXXXX', '360', '4245', 'Subproductos A', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4247, 'PCG08-PYME','EXISTENCIAS', 'XXXXXX', '361', '4245', 'Subproductos B', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4248, 'PCG08-PYME','EXISTENCIAS', 'XXXXXX', '365', '4245', 'Residuos A', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4249, 'PCG08-PYME','EXISTENCIAS', 'XXXXXX', '366', '4245', 'Residuos B', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4250, 'PCG08-PYME','EXISTENCIAS', 'XXXXXX', '368', '4245', 'Materiales recuperados A', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4251, 'PCG08-PYME','EXISTENCIAS', 'XXXXXX', '369', '4245', 'Materiales recuperados B', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4252, 'PCG08-PYME','EXISTENCIAS', 'XXXXXX', '39', '4003', 'Deterioro de valor de las existencias', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4253, 'PCG08-PYME','EXISTENCIAS', 'XXXXXX', '390', '4252', 'Deterioro de valor de las mercaderías', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4254, 'PCG08-PYME','EXISTENCIAS', 'XXXXXX', '391', '4252', 'Deterioro de valor de las materias primas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4255, 'PCG08-PYME','EXISTENCIAS', 'XXXXXX', '392', '4252', 'Deterioro de valor de otros aprovisionamientos', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4256, 'PCG08-PYME','EXISTENCIAS', 'XXXXXX', '393', '4252', 'Deterioro de valor de los productos en curso', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4257, 'PCG08-PYME','EXISTENCIAS', 'XXXXXX', '394', '4252', 'Deterioro de valor de los productos semiterminados', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4258, 'PCG08-PYME','EXISTENCIAS', 'XXXXXX', '395', '4252', 'Deterioro de valor de los productos terminados', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4259, 'PCG08-PYME','EXISTENCIAS', 'XXXXXX', '396', '4252', 'Deterioro de valor de los subproductos, residuos y materiales recuperados', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4260, 'PCG08-PYME','ACREEDORES_DEUDORES', 'PROVEEDORES', '40', '4004', 'Proveedores', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4261, 'PCG08-PYME','ACREEDORES_DEUDORES', 'PROVEEDORES', '400', '4260', 'Proveedores', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4262, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4000', '4261', 'Proveedores euros', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4263, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4004', '4261', 'Proveedores moneda extranjera', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4264, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4009', '4261', 'Proveedores facturas pendientes de recibir o formalizar', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4265, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '401', '4260', 'Proveedores efectos comerciales a pagar', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4266, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '403', '4260', 'Proveedores empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4267, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4030', '4266', 'Proveedores empresas del grupo euros', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4268, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4031', '4266', 'Efectos comerciales a pagar empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4269, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4034', '4266', 'Proveedores empresas del grupo moneda extranjera', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4270, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4036', '4266', 'Envases y embalajes a devolver a proveedores empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4271, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4039', '4266', 'Proveedores empresas del grupo facturas pendientes de recibir o de formalizar', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4272, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '404', '4260', 'Proveedores empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4273, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '405', '4260', 'Proveedores otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4274, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '406', '4260', 'Envases y embalajes a devolver a proveedores', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4275, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '407', '4260', 'Anticipos a proveedores', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4276, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '41', '4004', 'Acreedores varios', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4277, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '410', '4276', 'Acreedores por prestaciones de servicios', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4278, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4100', '4277', 'Acreedores por prestaciones de servicios euros', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4279, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4104', '4277', 'Acreedores por prestaciones de servicios moneda extranjera', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4280, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4109', '4277', 'Acreedores por prestaciones de servicios facturas pendientes de recibir o formalizar', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4281, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '411', '4276', 'Acreedores efectos comerciales a pagar', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4282, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '419', '4276', 'Acreedores por operaciones en común', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4283, 'PCG08-PYME','ACREEDORES_DEUDORES', 'CLIENTES', '43', '4004', 'Clientes', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4284, 'PCG08-PYME','ACREEDORES_DEUDORES', 'CLIENTES', '430', '4283', 'Clientes', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4285, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4300', '4284', 'Clientes euros', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4286, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4304', '4284', 'Clientes moneda extranjera', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4287, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4309', '4284', 'Clientes facturas pendientes de formalizar', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4288, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '431', '4283', 'Clientes efectos comerciales a cobrar', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4289, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4310', '4288', 'Efectos comerciales en cartera', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4290, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4311', '4288', 'Efectos comerciales descontados', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4291, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4312', '4288', 'Efectos comerciales en gestión de cobro', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4292, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4315', '4288', 'Efectos comerciales impagados', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4293, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '432', '4283', 'Clientes operaciones de factoring', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4294, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '433', '4283', 'Clientes empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4295, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4330', '4294', 'Clientes empresas del grupo euros', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4296, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4331', '4294', 'Efectos comerciales a cobrar empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4297, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4332', '4294', 'Clientes empresas del grupo operaciones de factoring', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4298, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4334', '4294', 'Clientes empresas del grupo moneda extranjera', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4299, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4336', '4294', 'Clientes empresas del grupo dudoso cobro', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4300, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4337', '4294', 'Envases y embalajes a devolver a clientes empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4301, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4339', '4294', 'Clientes empresas del grupo facturas pendientes de formalizar', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4302, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '434', '4283', 'Clientes empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4303, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '435', '4283', 'Clientes otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4304, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '436', '4283', 'Clientes de dudoso cobro', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4305, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '437', '4283', 'Envases y embalajes a devolver por clientes', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4306, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '438', '4283', 'Anticipos de clientes', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4307, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '44', '4004', 'Deudores varios', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4308, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '440', '4307', 'Deudores', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4309, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4400', '4308', 'Deudores euros', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4310, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4404', '4308', 'Deudores moneda extranjera', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4311, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4409', '4308', 'Deudores facturas pendientes de formalizar', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4312, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '441', '4307', 'Deudores efectos comerciales a cobrar', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4313, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4410', '4312', 'Deudores efectos comerciales en cartera', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4314, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4411', '4312', 'Deudores efectos comerciales descontados', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4315, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4412', '4312', 'Deudores efectos comerciales en gestión de cobro', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4316, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4415', '4312', 'Deudores efectos comerciales impagados', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4317, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '446', '4307', 'Deudores de dusoso cobro', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4318, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '449', '4307', 'Deudores por operaciones en común', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4319, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '46', '4004', 'Personal', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4320, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '460', '4319', 'Anticipos de renumeraciones', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4321, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '465', '4319', 'Renumeraciones pendientes de pago', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4322, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '47', '4004', 'Administraciones Públicas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4323, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '470', '4322', 'Hacienda Pública deudora por diversos conceptos', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4324, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4700', '4323', 'Hacienda Pública deudora por IVA', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4325, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4708', '4323', 'Hacienda Pública deudora por subvenciones concedidas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4326, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4709', '4323', 'Hacienda Pública deudora por devolución de impuestos', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4327, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '471', '4322', 'Organismos de la Seguridad Social deudores', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4328, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '472', '4322', 'Hacienda Pública IVA soportado', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4329, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '473', '4322', 'Hacienda Pública retenciones y pagos a cuenta', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4330, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '474', '4322', 'Activos por impuesto diferido', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4331, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4740', '4330', 'Activos por diferencias temporarias deducibles', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4332, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4742', '4330', 'Derechos por deducciones y bonificaciones pendientes de aplicar', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4333, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4745', '4330', 'Crédito por pérdidasa compensar del ejercicio', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4334, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '475', '4322', 'Hacienda Pública acreedora por conceptos fiscales', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4335, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4750', '4334', 'Hacienda Pública acreedora por IVA', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4336, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4751', '4334', 'Hacienda Pública acreedora por retenciones practicadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4337, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4752', '4334', 'Hacienda Pública acreedora por impuesto sobre sociedades', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4338, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4758', '4334', 'Hacienda Pública acreedora por subvenciones a integrar', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4339, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '476', '4322', 'Organismos de la Seguridad Social acreedores', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4340, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '477', '4322', 'Hacienda Pública IVA repercutido', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4341, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '479', '4322', 'Pasivos por diferencias temporarias imponibles', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4342, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '48', '4004', 'Ajustes por periodificación', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4343, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '480', '4342', 'Gastos anticipados', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4344, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '485', '4342', 'Ingresos anticipados', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4345, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '49', '4004', 'Deterioro de valor de créditos comerciales y provisiones a corto plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4346, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '490', '4345', 'Deterioro de valor de créditos por operaciones comerciales', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4347, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '493', '4345', 'Deterioro de valor de créditos por operaciones comerciales con partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4348, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4933', '4347', 'Deterioro de valor de créditos por operaciones comerciales con empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4349, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4934', '4347', 'Deterioro de valor de créditos por operaciones comerciales con empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4350, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4935', '4347', 'Deterioro de valor de créditos por operaciones comerciales con otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4351, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '499', '4345', 'Provisiones por operaciones comerciales', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4352, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4994', '4351', 'Provisión para contratos anerosos', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4353, 'PCG08-PYME','ACREEDORES_DEUDORES', 'XXXXXX', '4999', '4351', 'Provisión para otras operaciones comerciales', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4354, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '50', '4005', 'Emprésitos deudas con características especiales y otras emisiones análogas a corto plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4355, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '500', '4354', 'Obligaciones y bonos a corto plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4356, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '502', '4354', 'Acciones o participaciones a corto plazo consideradas como pasivos financieros', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4357, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '505', '4354', 'Deudas representadas en otros valores negociables a corto plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4358, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '506', '4354', 'Intereses a corto plazo de emprésitos y otras emisiones analógicas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4359, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '507', '4354', 'Dividendos de acciones o participaciones consideradas como pasivos financieros', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4360, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '509', '4354', 'Valores negociables amortizados', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4361, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5090', '4360', 'Obligaciones y bonos amortizados', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4362, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5095', '4360', 'Otros valores negociables amortizados', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4363, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '51', '4005', 'Deudas a corto plazo con partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4364, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '510', '4363', 'Deudas a corto plazo con entidades de crédito vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4365, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5103', '4364', 'Deudas a corto plazo con entidades de crédito empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4366, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5104', '4364', 'Deudas a corto plazo con entidades de crédito empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4367, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5105', '4364', 'Deudas a corto plazo con otras entidades de crédito vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4368, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '511', '4363', 'Proveedores de inmovilizado a corto plazo partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4369, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5113', '4368', 'Proveedores de inmovilizado a corto plazo empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4370, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5114', '4368', 'Proveedores de inmovilizado a corto plazo empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4371, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5115', '4368', 'Proveedores de inmovilizado a corto plazo otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4372, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '512', '4363', 'Acreedores por arrendamiento financiero a corto plazo partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4373, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5123', '4372', 'Acreedores por arrendamiento financiero a corto plazo empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4374, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5124', '4372', 'Acreedores por arrendamiento financiero a corto plazo empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4375, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5125', '4372', 'Acreedores por arrendamiento financiero a corto plazo otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4376, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '513', '4363', 'Otras deudas a corto plazo con partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4377, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5133', '4376', 'Otras deudas a corto plazo con empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4378, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5134', '4376', 'Otras deudas a corto plazo con empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4379, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5135', '4376', 'Otras deudas a corto plazo con partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4380, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '514', '4363', 'Intereses a corto plazo con partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4381, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5143', '4380', 'Intereses a corto plazo empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4382, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5144', '4380', 'Intereses a corto plazo empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4383, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5145', '4380', 'Intereses deudas a corto plazo partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4384, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '52', '4005', 'Deudas a corto plazo por préstamos recibidos y otros conceptos', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4385, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '520', '4384', 'Deudas a corto plazo con entidades de crédito', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4386, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5200', '4385', 'Préstamos a corto plazo de entidades de crédito', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4387, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5201', '4385', 'Deudas a corto plazo por crédito dispuesto', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4388, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5208', '4385', 'Deudas por efectos descontados', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4389, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5209', '4385', 'Deudas por operaciones de factoring', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4390, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '521', '4384', 'Deudas a corto plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4391, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '522', '4384', 'Deudas a corto plazo transformables en subvenciones donaciones y legados', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4392, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '523', '4384', 'Proveedores de inmovilizado a corto plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4393, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '526', '4384', 'Dividendo activo a pagar', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4394, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '527', '4384', 'Intereses a corto plazo de deudas con entidades de crédito', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4395, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '528', '4384', 'Intereses a corto plazo de deudas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4396, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '529', '4384', 'Provisiones a corto plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4397, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5291', '4396', 'Provisión a corto plazo para impuestos', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4398, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5292', '4396', 'Provisión a corto plazo para otras responsabilidades', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4399, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5293', '4396', 'Provisión a corto plazo por desmantelamiento retiro o rehabilitación del inmovilizado', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4400, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5295', '4396', 'Provisión a corto plazo para actuaciones medioambientales', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4401, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '53', '4005', 'Inversiones financieras a corto plazo en partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4402, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '530', '4401', 'Participaciones a corto plazo en partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4403, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5303', '4402', 'Participaciones a corto plazo en empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4404, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5304', '4402', 'Participaciones a corto plazo en empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4405, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5305', '4402', 'Participaciones a corto plazo en otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4406, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '531', '4401', 'Valores representativos de deuda a corto plazo de partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4407, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5313', '4406', 'Valores representativos de deuda a corto plazo de empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4408, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5314', '4406', 'Valores representativos de deuda a corto plazo de empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4409, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5315', '4406', 'Valores representativos de deuda a corto plazo de otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4410, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '532', '4401', 'Créditos a corto plazo a partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4411, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5323', '4410', 'Créditos a corto plazo a empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4412, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5324', '4410', 'Créditos a corto plazo a empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4413, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5325', '4410', 'Créditos a corto plazo a otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4414, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '533', '4401', 'Intereses a corto plazo de valores representativos de deuda de partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4415, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5333', '4414', 'Intereses a corto plazo de valores representativos de deuda en empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4416, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5334', '4414', 'Intereses a corto plazo de valores representativos de deuda en empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4417, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5335', '4414', 'Intereses a corto plazo de valores representativos de deuda en otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4418, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '534', '4401', 'Intereses a corto plazo de créditos a partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4419, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5343', '4418', 'Intereses a corto plazo de créditos a empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4420, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5344', '4418', 'Intereses a corto plazo de créditos a empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4421, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5345', '4418', 'Intereses a corto plazo de créditos a otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4422, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '535', '4401', 'Dividendo a cobrar de inversiones financieras en partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4423, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5353', '4422', 'Dividendo a cobrar de empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4424, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5354', '4422', 'Dividendo a cobrar de empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4425, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5355', '4422', 'Dividendo a cobrar de otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4426, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '539', '4401', 'Desembolsos pendientes sobre participaciones a corto plazo en partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4427, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5393', '4426', 'Desembolsos pendientes sobre participaciones a corto plazo en empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4428, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5394', '4426', 'Desembolsos pendientes sobre participaciones a corto plazo en empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4429, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5395', '4426', 'Desembolsos pendientes sobre participaciones a corto plazo en otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4430, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '54', '4005', 'Otras inversiones financieras a corto plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4431, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '540', '4430', 'Inversiones financieras a corto plazo en instrumentos de patrimonio', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4432, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '541', '4430', 'Valores representativos de deuda a corto plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4433, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '542', '4430', 'Créditos a corto plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4434, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '543', '4430', 'Créditos a corto plazo por enejenación de inmovilizado', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4435, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '544', '4430', 'Créditos a corto plazo al personal', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4436, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '545', '4430', 'Dividendo a cobrar', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4437, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '546', '4430', 'Intereses a corto plazo de valores reprsentativos de deuda', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4438, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '547', '4430', 'Intereses a corto plazo de créditos', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4439, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '548', '4430', 'Imposiciones a corto plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4440, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '549', '4430', 'Desembolsos pendientes sobre participaciones en el patrimonio neto a corto plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4441, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '55', '4005', 'Otras cuentas no bancarias', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4442, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '550', '4441', 'Titular de la explotación', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4443, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '551', '4441', 'Cuenta corriente con socios y administradores', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4444, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '552', '4441', 'Cuenta corriente otras personas y entidades vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4445, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5523', '4444', 'Cuenta corriente con empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4446, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5524', '4444', 'Cuenta corriente con empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4447, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5525', '4444', 'Cuenta corriente con otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4448, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '554', '4441', 'Cuenta corriente con uniones temporales de empresas y comunidades de bienes', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4449, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '555', '4441', 'Partidas pendientes de aplicación', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4450, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '556', '4441', 'Desembolsos exigidos sobre participaciones en el patrimonio neto', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4451, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5563', '4450', 'Desembolsos exigidos sobre participaciones empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4452, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5564', '4450', 'Desembolsos exigidos sobre participaciones empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4453, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5565', '4450', 'Desembolsos exigidos sobre participaciones otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4454, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5566', '4450', 'Desembolsos exigidos sobre participaciones otras empresas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4455, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '557', '4441', 'Dividendo activo a cuenta', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4456, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '558', '4441', 'Socios por desembolsos exigidos', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4457, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5580', '4456', 'Socios por desembolsos exigidos sobre acciones o participaciones ordinarias', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4458, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5585', '4456', 'Socios por desembolsos exigidos sobre acciones o participaciones consideradas como pasivos financieros', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4459, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '559', '4441', 'Derivados financieros a corto plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4460, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5590', '4459', 'Activos por derivados financieros a corto plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4461, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5595', '4459', 'Pasivos por derivados financieros a corto plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4462, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '56', '4005', 'Finanzas y depósitos recibidos y constituidos a corto plazo y ajustes por periodificación', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4463, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '560', '4462', 'Finanzas recibidas a corto plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4464, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '561', '4462', 'Depósitos recibidos a corto plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4465, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '565', '4462', 'Finanzas constituidas a corto plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4466, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '566', '4462', 'Depósitos constituidos a corto plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4467, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '567', '4462', 'Intereses pagados por anticipado', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4468, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '568', '4462', 'Intereses cobrados a corto plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4469, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '57', '4005', 'Tesorería', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4470, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'CAJA', '570', '4469', 'Caja euros', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4471, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '571', '4469', 'Caja moneda extranjera', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4472, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'BANCOS', '572', '4469', 'Bancos e instituciones de crédito cc vista euros', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4473, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '573', '4469', 'Bancos e instituciones de crédito cc vista moneda extranjera', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4474, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '574', '4469', 'Bancos e instituciones de crédito cuentas de ahorro euros', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4475, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '575', '4469', 'Bancos e instituciones de crédito cuentas de ahorro moneda extranjera', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4476, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '576', '4469', 'Inversiones a corto plazo de gran liquidez', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4477, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '59', '4005', 'Deterioro del valor de las inversiones financieras a corto plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4478, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '593', '4477', 'Deterioro del valor de participaciones a corto plazo en partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4479, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5933', '4478', 'Deterioro del valor de participaciones a corto plazo en empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4480, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5934', '4478', 'Deterioro del valor de participaciones a corto plazo en empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4481, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5935', '4478', 'Deterioro del valor de participaciones a corto plazo en otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4482, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '594', '4477', 'Deterioro del valor de valores representativos de deuda a corto plazo en partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4483, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5943', '4482', 'Deterioro del valor de valores representativos de deuda a corto plazo en empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4484, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5944', '4482', 'Deterioro del valor de valores representativos de deuda a corto plazo en empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4485, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5945', '4482', 'Deterioro del valor de valores representativos de deuda a corto plazo en otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4486, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '595', '4477', 'Deterioro del valor de créditos a corto plazo en partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4487, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5953', '4486', 'Deterioro del valor de créditos a corto plazo en empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4488, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5954', '4486', 'Deterioro del valor de créditos a corto plazo en empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4489, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '5955', '4486', 'Deterioro del valor de créditos a corto plazo en otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4490, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '596', '4477', 'Deterioro del valor de participaciones a corto plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4491, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '597', '4477', 'Deterioro del valor de valores representativos de deuda a corto plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4492, 'PCG08-PYME','CUENTAS_FINANCIERAS', 'XXXXXX', '598', '4477', 'Deterioro de valor de créditos a corto plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4493, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '60', '4006', 'Compras', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4494, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'COMPRAS', '600', '4493', 'Compras de mercaderías', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4495, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'COMPRAS', '601', '4493', 'Compras de materias primas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4496, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '602', '4493', 'Compras de otros aprovisionamientos', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4497, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '606', '4493', 'Descuentos sobre compras por pronto pago', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4498, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6060', '4497', 'Descuentos sobre compras por pronto pago de mercaderías', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4499, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6061', '4497', 'Descuentos sobre compras por pronto pago de materias primas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4500, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6062', '4497', 'Descuentos sobre compras por pronto pago de otros aprovisionamientos', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4501, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'COMPRAS', '607', '4493', 'Trabajos realizados por otras empresas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4502, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '608', '4493', 'Devoluciones de compras y operaciones similares', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4503, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6080', '4502', 'Devoluciones de compras de mercaderías', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4504, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6081', '4502', 'Devoluciones de compras de materias primas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4505, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6082', '4502', 'Devoluciones de compras de otros aprovisionamientos', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4506, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '609', '4493', 'Rappels por compras', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4507, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6090', '4506', 'Rappels por compras de mercaderías', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4508, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6091', '4506', 'Rappels por compras de materias primas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4509, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6092', '4506', 'Rappels por compras de otros aprovisionamientos', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4510, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '61', '4006', 'Variación de existencias', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4511, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '610', '4510', 'Variación de existencias de mercaderías', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4512, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '611', '4510', 'Variación de existencias de materias primas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4513, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '612', '4510', 'Variación de existencias de otros aprovisionamientos', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4514, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '62', '4006', 'Servicios exteriores', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4515, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '620', '4514', 'Gastos en investigación y desarrollo del ejercicio', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4516, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '621', '4514', 'Arrendamientos y cánones', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4517, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '622', '4514', 'Reparaciones y conservación', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4518, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '623', '4514', 'Servicios profesionales independientes', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4519, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '624', '4514', 'Transportes', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4520, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '625', '4514', 'Primas de seguros', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4521, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '626', '4514', 'Servicios bancarios y similares', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4522, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '627', '4514', 'Publicidad, propaganda y relaciones públicas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4523, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '628', '4514', 'Suministros', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4524, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '629', '4514', 'Otros servicios', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4525, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '63', '4006', 'Tributos', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4526, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '630', '4525', 'Impuesto sobre benecifios', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4527, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6300', '4526', 'Impuesto corriente', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4528, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6301', '4526', 'Impuesto diferido', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4529, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '631', '4525', 'Otros tributos', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4530, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '633', '4525', 'Ajustes negativos en la imposición sobre beneficios', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4531, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '634', '4525', 'Ajustes negativos en la imposición indirecta', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4532, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6341', '4531', 'Ajustes negativos en IVA de activo corriente', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4533, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6342', '4531', 'Ajustes negativos en IVA de inversiones', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4534, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '636', '4525', 'Devolución de impuestos', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4535, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '638', '4525', 'Ajustes positivos en la imposición sobre beneficios', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4536, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '639', '4525', 'Ajustes positivos en la imposición directa', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4537, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6391', '4536', 'Ajustes positivos en IVA de activo corriente', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4538, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6392', '4536', 'Ajustes positivos en IVA de inversiones', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4539, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '64', '4006', 'Gastos de personal', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4540, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '640', '4539', 'Sueldos y salarios', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4541, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '641', '4539', 'Indemnizaciones', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4542, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '642', '4539', 'Seguridad social a cargo de la empresa', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4543, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '649', '4539', 'Otros gastos sociales', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4544, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '65', '4006', 'Otros gastos de gestión', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4545, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '650', '4544', 'Pérdidas de créditos comerciales incobrables', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4546, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '651', '4544', 'Resultados de operaciones en común', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4547, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6510', '4546', 'Beneficio transferido gestor', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4548, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6511', '4546', 'Pérdida soportada participe o asociado no gestor', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4549, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '659', '4544', 'Otras pérdidas en gestión corriente', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4550, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '66', '4006', 'Gastos financieros', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4551, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '660', '4550', 'Gastos financieros por actualización de provisiones', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4552, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '661', '4550', 'Intereses de obligaciones y bonos', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4553, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6610', '4452', 'Intereses de obligaciones y bonos a largo plazo empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4554, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6611', '4452', 'Intereses de obligaciones y bonos a largo plazo empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4555, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6612', '4452', 'Intereses de obligaciones y bonos a largo plazo otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4556, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6613', '4452', 'Intereses de obligaciones y bonos a largo plazo otras empresas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4557, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6615', '4452', 'Intereses de obligaciones y bonos a corto plazo empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4558, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6616', '4452', 'Intereses de obligaciones y bonos a corto plazo empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4559, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6617', '4452', 'Intereses de obligaciones y bonos a corto plazo otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4560, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6618', '4452', 'Intereses de obligaciones y bonos a corto plazo otras empresas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4561, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '662', '4550', 'Intereses de deudas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4562, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6620', '4561', 'Intereses de deudas empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4563, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6621', '4561', 'Intereses de deudas empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4564, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6622', '4561', 'Intereses de deudas otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4565, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6623', '4561', 'Intereses de deudas con entidades de crédito', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4566, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6624', '4561', 'Intereses de deudas otras empresas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4567, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '663', '4550', 'Pérdidas por valorización de activos y pasivos financieros por su valor razonable', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4568, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '664', '4550', 'Gastos por dividendos de acciones o participaciones consideradas como pasivos financieros', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4569, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6640', '4568', 'Dividendos de pasivos empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4570, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6641', '4568', 'Dividendos de pasivos empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4571, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6642', '4568', 'Dividendos de pasivos otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4572, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6643', '4568', 'Dividendos de pasivos otras empresas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4573, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '665', '4550', 'Intereses por descuento de efectos y operaciones de factoring', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4574, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6650', '4573', 'Intereses por descuento de efectos en entidades de crédito del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4575, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6651', '4573', 'Intereses por descuento de efectos en entidades de crédito asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4576, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6652', '4573', 'Intereses por descuento de efectos en entidades de crédito vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4577, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6653', '4573', 'Intereses por descuento de efectos en otras entidades de crédito', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4578, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6654', '4573', 'Intereses por operaciones de factoring con entidades de crédito del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4579, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6655', '4573', 'Intereses por operaciones de factoring con entidades de crédito asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4580, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6656', '4573', 'Intereses por operaciones de factoring con otras entidades de crédito vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4581, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6657', '4573', 'Intereses por operaciones de factoring con otras entidades de crédito', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4582, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '666', '4550', 'Pérdidas en participaciones y valores representativos de deuda', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4583, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6660', '4582', 'Pérdidas en valores representativos de deuda a largo plazo empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4584, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6661', '4582', 'Pérdidas en valores representativos de deuda a largo plazo empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4585, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6662', '4582', 'Pérdidas en valores representativos de deuda a largo plazo otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4586, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6663', '4582', 'Pérdidas en participaciones y valores representativos de deuda a largo plazo otras empresas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4587, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6665', '4582', 'Pérdidas en participaciones y valores representativos de deuda a corto plazo empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4588, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6666', '4582', 'Pérdidas en participaciones y valores representativos de deuda a corto plazo empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4589, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6667', '4582', 'Pérdidas en valores representativos de deuda a corto plazo otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4590, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6668', '4582', 'Pérdidas en valores representativos de deuda a corto plazo otras empresas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4591, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '667', '4550', 'Pérdidas de créditos no comerciales', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4592, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6670', '4591', 'Pérdidas de créditos a largo plazo empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4593, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6671', '4591', 'Pérdidas de créditos a largo plazo empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4594, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6672', '4591', 'Pérdidas de créditos a largo plazo otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4595, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6673', '4591', 'Pérdidas de créditos a largo plazo otras empresas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4596, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6675', '4591', 'Pérdidas de créditos a corto plazo empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4597, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6676', '4591', 'Pérdidas de créditos a corto plazo empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4598, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6677', '4591', 'Pérdidas de créditos a corto plazo otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4599, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6678', '4591', 'Pérdidas de créditos a corto plazo otras empresas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4600, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '668', '4550', 'Diferencias negativas de cambio', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4601, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '669', '4550', 'Otros gastos financieros', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4602, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '67', '4006', 'Pérdidas procedentes de activos no corrientes y gastos excepcionales', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4603, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '670', '4602', 'Pérdidas procedentes del inmovilizado intangible', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4604, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '671', '4602', 'Pérdidas procedentes del inmovilizado material', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4605, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '672', '4602', 'Pérdidas procedentes de las inversiones inmobiliarias', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4607, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '673', '4602', 'Pérdidas procedentes de participaciones a largo plazo en partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4608, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6733', '4607', 'Pérdidas procedentes de participaciones a largo plazo empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4609, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6734', '4607', 'Pérdidas procedentes de participaciones a largo plazo empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4610, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6735', '4607', 'Pérdidas procedentes de participaciones a largo plazo otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4611, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '675', '4602', 'Pérdidas por operaciones con obligaciones propias', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4612, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '678', '4602', 'Gastos excepcionales', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4613, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '68', '4006', 'Dotaciones para amortizaciones', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4614, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '680', '4613', 'Amortización del inmovilizado intangible', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4615, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '681', '4613', 'Amortización del inmovilizado material', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4616, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '682', '4613', 'Amortización de las inversiones inmobiliarias', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4617, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '69', '4006', 'Pérdidas por deterioro y otras dotaciones', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4618, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '690', '4617', 'Pérdidas por deterioro del inmovilizado intangible', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4619, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '691', '4617', 'Pérdidas por deterioro del inmovilizado material', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4620, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '692', '4617', 'Pérdidas por deterioro de las inversiones inmobiliarias', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4621, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '693', '4617', 'Pérdidas por deterioro de existencias', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4622, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6930', '4621', 'Pérdidas por deterioro de productos terminados y en curso de fabricación', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4623, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6931', '4621', 'Pérdidas por deterioro de mercaderías', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4624, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6932', '4621', 'Pérdidas por deterioro de materias primas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4625, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6933', '4621', 'Pérdidas por deterioro de otros aprovisionamientos', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4626, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '694', '4617', 'Pérdidas por deterioro de créditos por operaciones comerciales', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4627, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '695', '4617', 'Dotación a la provisión por operaciones comerciales', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4628, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6954', '4627', 'Dotación a la provisión por contratos onerosos', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4629, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6959', '4628', 'Dotación a la provisión para otras operaciones comerciales', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4630, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '696', '4617', 'Pérdidas por deterioro de participaciones y valores representativos de deuda a largo plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4631, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6960', '4630', 'Pérdidas por deterioro de participaciones en instrumentos de patrimonio neto a largo plazo empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4632, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6961', '4630', 'Pérdidas por deterioro de participaciones en instrumentos de patrimonio neto a largo plazo empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4633, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6962', '4630', 'Pérdidas por deterioro de participaciones en instrumentos de patrimonio neto a largo plazo otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4634, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6963', '4630', 'Pérdidas por deterioro de participaciones en instrumentos de patrimonio neto a largo plazo otras empresas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4635, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6965', '4630', 'Pérdidas por deterioro en valores representativos de deuda a largo plazo empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4636, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6966', '4630', 'Pérdidas por deterioro en valores representativos de deuda a largo plazo empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4637, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6967', '4630', 'Pérdidas por deterioro en valores representativos de deuda a largo plazo otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4638, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6968', '4630', 'Pérdidas por deterioro en valores representativos de deuda a largo plazo otras empresas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4639, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '697', '4617', 'Pérdidas por deterioro de créditos a largo plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4640, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6970', '4639', 'Pérdidas por deterioro de créditos a largo plazo empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4641, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6971', '4639', 'Pérdidas por deterioro de créditos a largo plazo empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4642, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6972', '4639', 'Pérdidas por deterioro de créditos a largo plazo otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4643, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6973', '4639', 'Pérdidas por deterioro de créditos a largo plazo otras empresas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4644, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '698', '4617', 'Pérdidas por deterioro de participaciones y valores representativos de deuda a corto plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4645, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6980', '4644', 'Pérdidas por deterioro de participaciones en instrumentos de patrimonio neto a corto plazo empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4646, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6981', '4644', 'Pérdidas por deterioro de participaciones en instrumentos de patrimonio neto a corto plazo empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4647, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6985', '4644', 'Pérdidas por deterioro en valores representativos de deuda a corto plazo empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4648, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6986', '4644', 'Pérdidas por deterioro en valores representativos de deuda a corto plazo empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4649, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6988', '4644', 'Pérdidas por deterioro en valores representativos de deuda a corto plazo de otras empresas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4650, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '699', '4617', 'Pérdidas por deterioro de crédito a corto plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4651, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6990', '4650', 'Pérdidas por deterioro de crédito a corto plazo empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4652, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6991', '4650', 'Pérdidas por deterioro de crédito a corto plazo empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4653, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6992', '4650', 'Pérdidas por deterioro de crédito a corto plazo otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4654, 'PCG08-PYME','COMPRAS_Y_GASTOS', 'XXXXXX', '6993', '4650', 'Pérdidas por deterioro de crédito a corto plazo otras empresas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4655, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '70', '4007', 'Ventas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4656, 'PCG08-PYME','VENTAS_E_INGRESOS', 'VENTAS', '700', '4655', 'Ventas de mercaderías', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4657, 'PCG08-PYME','VENTAS_E_INGRESOS', 'VENTAS', '701', '4655', 'Ventas de productos terminados', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4658, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '702', '4655', 'Ventas de productos semiterminados', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4659, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '703', '4655', 'Ventas de subproductos y residuos', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4660, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '704', '4655', 'Ventas de envases y embalajes', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4661, 'PCG08-PYME','VENTAS_E_INGRESOS', 'VENTAS', '705', '4655', 'Prestaciones de servicios', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4662, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '706', '4655', 'Descuentos sobre ventas por pronto pago', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4663, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7060', '4662', 'Descuentos sobre ventas por pronto pago de mercaderías', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4664, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7061', '4662', 'Descuentos sobre ventas por pronto pago de productos terminados', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4665, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7062', '4662', 'Descuentos sobre ventas por pronto pago de productos semiterminados', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4666, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7063', '4662', 'Descuentos sobre ventas por pronto pago de subproductos y residuos', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4667, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '708', '4655', 'Devoluciones de ventas y operacioes similares', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4668, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7080', '4667', 'Devoluciones de ventas de mercaderías', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4669, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7081', '4667', 'Devoluciones de ventas de productos terminados', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4670, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7082', '4667', 'Devoluciones de ventas de productos semiterminados', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4671, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7083', '4667', 'Devoluciones de ventas de subproductos y residuos', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4672, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7084', '4667', 'Devoluciones de ventas de envases y embalajes', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4673, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '71', '4007', 'Variación de existencias', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4674, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '710', '4673', 'Variación de existencias de productos en curso', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4675, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '711', '4673', 'Variación de existencias de productos semiterminados', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4676, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '712', '4673', 'Variación de existencias de productos terminados', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4677, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '713', '4673', 'Variación de existencias de subproductos, residuos y materiales recuperados', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4678, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '73', '4007', 'Trabajos realizados para la empresa', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4679, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '730', '4678', 'Trabajos realizados para el inmovilizado intangible', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4680, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '731', '4678', 'Trabajos realizados para el inmovilizado tangible', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4681, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '732', '4678', 'Trabajos realizados en inversiones inmobiliarias', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4682, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '733', '4678', 'Trabajos realizados para el inmovilizado material en curso', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4683, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '74', '4007', 'Subvenciones, donaciones y legados', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4684, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '740', '4683', 'Subvenciones, donaciones y legados a la explotación', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4685, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '746', '4683', 'Subvenciones, donaciones y legados de capital transferidos al resultado del ejercicio', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4686, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '747', '4683', 'Otras subvenciones, donaciones y legados transferidos al resultado del ejercicio', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4687, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '75', '4007', 'Otros ingresos de gestión', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4688, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '751', '4687', 'Resultados de operaciones en común', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4689, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7510', '4688', 'Pérdida transferida gestor', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4690, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7511', '4688', 'Beneficio atribuido participe o asociado no gestor', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4691, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '752', '4687', 'Ingreso por arrendamiento', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4692, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '753', '4687', 'Ingresos de propiedad industrial cedida en explotación', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4693, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '754', '4687', 'Ingresos por comisiones', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4694, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '755', '4687', 'Ingresos por servicios al personal', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4695, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '759', '4687', 'Ingresos por servicios diversos', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4696, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '76', '4007', 'Ingresos financieros', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4697, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '760', '4696', 'Ingresos de participaciones en instrumentos de patrimonio', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4698, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7600', '4697', 'Ingresos de participaciones en instrumentos de patrimonio empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4699, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7601', '4697', 'Ingresos de participaciones en instrumentos de patrimonio empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4700, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7602', '4697', 'Ingresos de participaciones en instrumentos de patrimonio otras partes asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4701, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7603', '4697', 'Ingresos de participaciones en instrumentos de patrimonio otras empresas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4702, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '761', '4696', 'Ingresos de valores representativos de deuda', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4703, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7610', '4702', 'Ingresos de valores representativos de deuda empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4704, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7611', '4702', 'Ingresos de valores representativos de deuda empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4705, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7612', '4702', 'Ingresos de valores representativos de deuda otras partes asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4706, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7613', '4702', 'Ingresos de valores representativos de deuda otras empresas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4707, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '762', '4696', 'Ingresos de créditos', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4708, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7620', '4707', 'Ingresos de créditos a largo plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4709, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '76200', '4708', 'Ingresos de crédito a largo plazo empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4710, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '76201', '4708', 'Ingresos de crédito a largo plazo empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4711, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '76202', '4708', 'Ingresos de crédito a largo plazo otras partes asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4712, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '76203', '4708', 'Ingresos de crédito a largo plazo otras empresas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4713, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7621', '4707', 'Ingresos de créditos a corto plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4714, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '76210', '4713', 'Ingresos de crédito a corto plazo empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4715, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '76211', '4713', 'Ingresos de crédito a corto plazo empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4716, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '76212', '4713', 'Ingresos de crédito a corto plazo otras partes asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4717, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '76213', '4713', 'Ingresos de crédito a corto plazo otras empresas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4718, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '763', '4696', 'Beneficios por valorización de activos y pasivos financieros por su valor razonable', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4719, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '766', '4696', 'Beneficios en participaciones y valores representativos de deuda', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4720, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7660', '4719', 'Beneficios en participaciones y valores representativos de deuda a largo plazo empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4721, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7661', '4719', 'Beneficios en participaciones y valores representativos de deuda a largo plazo empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4722, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7662', '4719', 'Beneficios en participaciones y valores representativos de deuda a largo plazo otras partes asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4723, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7663', '4719', 'Beneficios en participaciones y valores representativos de deuda a largo plazo otras empresas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4724, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7665', '4719', 'Beneficios en participaciones y valores representativos de deuda a corto plazo empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4725, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7666', '4719', 'Beneficios en participaciones y valores representativos de deuda a corto plazo empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4726, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7667', '4719', 'Beneficios en participaciones y valores representativos de deuda a corto plazo otras partes asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4727, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7668', '4719', 'Beneficios en participaciones y valores representativos de deuda a corto plazo otras empresas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4728, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '768', '4696', 'Diferencias positivas de cambio', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4729, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '769', '4696', 'Otros ingresos financieros', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4730, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '77', '4007', 'Beneficios procedentes de activos no corrientes e ingresos excepcionales', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4731, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '770', '4730', 'Beneficios procedentes del inmovilizado intangible', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4732, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '771', '4730', 'Beneficios procedentes del inmovilizado material', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4733, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '772', '4730', 'Beneficios procedentes de las inversiones inmobiliarias', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4734, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '773', '4730', 'Beneficios procedentes de participaciones a largo plazo en partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4735, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7733', '4734', 'Beneficios procedentes de participaciones a largo plazo empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4736, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7734', '4734', 'Beneficios procedentes de participaciones a largo plazo empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4737, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7735', '4734', 'Beneficios procedentes de participaciones a largo plazo otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4738, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '775', '4730', 'Beneficios por operaciones con obligaciones propias', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4739, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '778', '4730', 'Ingresos excepcionales', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4741, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '79', '4007', 'Excesos y aplicaciones de provisiones y pérdidas por deterioro', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4742, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '790', '4741', 'Revisión del deterioro del inmovilizado intangible', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4743, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '791', '4741', 'Revisión del deterioro del inmovilizado material', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4744, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '792', '4741', 'Revisión del deterioro de las inversiones inmobiliarias', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4745, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '793', '4741', 'Revisión del deterioro de las existencias', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4746, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7930', '4745', 'Revisión del deterioro de productos terminados y en curso de fabricación', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4747, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7931', '4745', 'Revisión del deterioro de mercaderías', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4748, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7932', '4745', 'Revisión del deterioro de materias primas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4749, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7933', '4745', 'Revisión del deterioro de otros aprovisionamientos', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4750, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '794', '4741', 'Revisión del deterioro de créditos por operaciones comerciales', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4751, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '795', '4741', 'Exceso de provisiones', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4752, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7951', '4751', 'Exceso de provisión para impuestos', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4753, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7952', '4751', 'Exceso de provisión para otras responsabilidades', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4755, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7954', '4751', 'Exceso de provisión para operaciones comerciales', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4756, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '79544', '4755', 'Exceso de provisión por contratos onerosos', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4757, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '79549', '4755', 'Exceso de provisión para otras operaciones comerciales', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4758, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7955', '4751', 'Exceso de provisión para actuaciones medioambienteales', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4759, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '796', '4741', 'Revisión del deterioro de participaciones y valores representativos de deuda a largo plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4760, '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', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4761, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7961', '4759', 'Revisión del deterioro de participaciones en instrumentos de patrimonio neto a largo plazo empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4762, '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', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4763, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7963', '4759', 'Revisión del deterioro de participaciones en instrumentos de patrimonio neto a largo plazo otras empresas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4764, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7965', '4759', 'Revisión del deterioro de valores representativos a largo plazo empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4765, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7966', '4759', 'Revisión del deterioro de valores representativos a largo plazo empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4766, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7967', '4759', 'Revisión del deterioro de valores representativos a largo otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4767, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7968', '4759', 'Revisión del deterioro de valores representativos a largo plazo otras empresas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4768, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '797', '4741', 'Revisión del deterioro de créditos a largo plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4769, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7970', '4768', 'Revisión del deterioro de créditos a largo plazo empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4770, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7971', '4768', 'Revisión del deterioro de créditos a largo plazo empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4771, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7972', '4768', 'Revisión del deterioro de créditos a largo plazo otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4772, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7973', '4768', 'Revisión del deterioro de créditos a largo plazo otras empresas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4773, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '798', '4741', 'Revisión del deterioro de participaciones y valores representativos de deuda a corto plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4774, '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', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4775, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7981', '4773', 'Revisión del deterioro de participaciones en instrumentos de patrimonio neto a corto plazo empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4776, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7985', '4773', 'Revisión del deterioro de valores representativos de deuda a corto plazo empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4777, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7986', '4773', 'Revisión del deterioro de valores representativos de deuda a corto plazo empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4778, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7987', '4773', 'Revisión del deterioro de valores representativos de deuda a corto plazo otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4779, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7988', '4773', 'Revisión del deterioro de valores representativos de deuda a corto plazo otras empresas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4780, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '799', '4741', 'Revisión del deterioro de créditos a corto plazo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4781, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7990', '4780', 'Revisión del deterioro de créditos a corto plazo empresas del grupo', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4782, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7991', '4780', 'Revisión del deterioro de créditos a corto plazo empresas asociadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4783, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7992', '4780', 'Revisión del deterioro de créditos a corto plazo otras partes vinculadas', '1'); +INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (4784, 'PCG08-PYME','VENTAS_E_INGRESOS', 'XXXXXX', '7993', '4780', 'Revisión del deterioro de créditos a corto plazo otras empresas', '1'); + + +DROP TABLE llx_texts; + + +DROP TABLE llx_c_email_templates; +create table llx_c_email_templates +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + entity integer DEFAULT 1 NOT NULL, -- multi company id + module varchar(32), -- Nom du module en rapport avec le modele + type_template varchar(32), -- template for which type of email (send invoice by email, send order, ...) + private smallint DEFAULT 0 NOT NULL, -- Template public or private + fk_user integer, -- Id utilisateur si modele prive, sinon null + datec datetime, + tms timestamp, + label varchar(255), -- Label of predefined email + position smallint, -- Position + topic text, -- Predefined topic + content text -- Predefined text +) ENGINE=innodb; + + +ALTER TABLE llx_c_departements DROP FOREIGN KEY fk_departements_fk_region; +--UPDATE llx_c_regions SET rowid = 0 where rowid = 1; + +ALTER TABLE llx_c_regions ADD UNIQUE INDEX uk_code_region (code_region); + +DELETE FROM llx_c_departements WHERE fk_region NOT IN (select code_region from llx_c_regions) AND fk_region IS NOT NULL AND fk_region <> 0; + +ALTER TABLE llx_c_departements ADD CONSTRAINT fk_departements_code_region FOREIGN KEY (fk_region) REFERENCES llx_c_regions (code_region); + + +CREATE TABLE llx_holiday_types ( + rowid integer NOT NULL AUTO_INCREMENT PRIMARY KEY, + label varchar(45) NOT NULL, + description varchar(255) NOT NULL, + affect integer NOT NULL, + delay integer NOT NULL, + insertAt DATETIME NOT NULL, + updateAt DATETIME, + deleteAt DATETIME, + nbCongesDeducted varchar(255) NOT NULL, + nbCongesEveryMonth varchar(255) NOT NULL +); + +-- Change on table c_civilite +DROP INDEX uk_c_civilite ON llx_c_civilite; +ALTER TABLE llx_c_civilite RENAME TO llx_c_civility; +ALTER TABLE llx_c_civility CHANGE civilite label VARCHAR(50); +ALTER TABLE llx_c_civility ADD UNIQUE INDEX uk_c_civility(code); +ALTER TABLE llx_adherent CHANGE civilite civility VARCHAR(6); +ALTER TABLE llx_socpeople CHANGE civilite civility VARCHAR(6); +ALTER TABLE llx_user CHANGE civilite civility VARCHAR(6); +) ENGINE=innodb; + +ALTER TABLE llx_c_type_fees CHANGE libelle label VARCHAR(30); +ALTER TABLE llx_c_type_fees ADD COLUMN accountancy_code varchar(32) DEFAULT NULL AFTER label; + +ALTER TABLE llx_actioncomm ADD INDEX idx_actioncomm_fk_element (fk_element); + +ALTER TABLE llx_projet_task_time ADD INDEX idx_projet_task_time_task (fk_task); +ALTER TABLE llx_projet_task_time ADD INDEX idx_projet_task_time_date (task_date); +ALTER TABLE llx_projet_task_time ADD INDEX idx_projet_task_time_datehour (task_datehour); diff --git a/htdocs/install/mysql/migration/index.html b/htdocs/install/mysql/migration/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql index 224a76cdf73..87769ab9558 100644 --- a/htdocs/install/mysql/migration/repair.sql +++ b/htdocs/install/mysql/migration/repair.sql @@ -108,14 +108,6 @@ UPDATE llx_product p SET p.stock= (SELECT SUM(ps.reel) FROM llx_product_stock ps -- VMYSQL DELETE from llx_menu where module = 'margins' and url = '/margin/index.php' and not exists (select * from llx_const where name = 'MAIN_MODULE_MARGIN' or name = 'MAIN_MODULE_MARGINS'); --- Requests to clean old tables or fields - --- DROP TABLE llx_c_methode_commande_fournisseur; --- DROP TABLE llx_c_source; --- DROP TABLE llx_cond_reglement; --- DROP TABLE llx_expedition_methode; --- DROP TABLE llx_product_fournisseur; --- ALTER TABLE llx_product_fournisseur_price DROP COLUMN fk_product_fournisseur; ALTER TABLE llx_product_fournisseur_price DROP FOREIGN KEY fk_product_fournisseur; @@ -155,3 +147,34 @@ UPDATE llx_projet_task SET fk_task_parent = 0 WHERE fk_task_parent = rowid UPDATE llx_actioncomm set fk_user_action = fk_user_done where fk_user_done > 0 and (fk_user_action is null or fk_user_action = 0); UPDATE llx_actioncomm set fk_user_action = fk_user_author where fk_user_author > 0 and (fk_user_action is null or fk_user_action = 0); + + +-- Requests to clean old tables or external modules tables + +-- DROP TABLE llx_c_methode_commande_fournisseur; +-- DROP TABLE llx_c_source; +-- DROP TABLE llx_congespayes; +-- DROP TABLE llx_congespayes_config; +-- DROP TABLE llx_congespayes_log; +-- DROP TABLE llx_congespayes_events; +-- DROP TABLE llx_congespayes_users; +-- DROP TABLE llx_compta; +-- DROP TABLE llx_compta_compte_generaux; +-- DROP TABLE llx_compta_account; +-- DROP TABLE llx_cabinetmed*; +-- DROP TABLE llx_cond_reglement; +-- DROP TABLE llx_expedition_methode; +-- DROP TABLE llx_product_fournisseur; +-- DROP TABLE llx_element_rang; +-- DROP TABLE llx_dolicloud_customers; +-- DROP TABLE llx_dolicloud_emailstemplates; +-- DROP TABLE llx_dolicloud_stats; +-- DROP TABLE llx_submitew_message; +-- DROP TABLE llx_submitew_targets; +-- DROP TABLE llx_submitew_targets_param; +-- DROP TABLE llx_pos_cash; +-- DROP TABLE llx_pos_control_cash; +-- DROP TABLE llx_pos_facture; +-- DROP TABLE llx_pos_moviments; +-- DROP TABLE llx_pos_ticketdet; + diff --git a/htdocs/install/mysql/tables/index.html b/htdocs/install/mysql/tables/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/install/mysql/tables/llx_accounting_fiscalyear.sql b/htdocs/install/mysql/tables/llx_accounting_fiscalyear.sql new file mode 100644 index 00000000000..569c22dd57e --- /dev/null +++ b/htdocs/install/mysql/tables/llx_accounting_fiscalyear.sql @@ -0,0 +1,31 @@ +-- ============================================================================ +-- Copyright (C) 2014 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 . +-- +-- ============================================================================ + +create table llx_accounting_fiscalyear +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + label varchar(128) NOT NULL, + date_start date, + date_end date, + statut tinyint DEFAULT 0 NOT NULL, + entity integer DEFAULT 1 NOT NULL, -- multi company id + datec datetime NOT NULL, + tms timestamp, + fk_user_author integer DEFAULT NULL, + fk_user_modif integer DEFAULT NULL +)ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_accountingaccount.key.sql b/htdocs/install/mysql/tables/llx_accountingaccount.key.sql index 5ddd524592e..49758c3d4ea 100644 --- a/htdocs/install/mysql/tables/llx_accountingaccount.key.sql +++ b/htdocs/install/mysql/tables/llx_accountingaccount.key.sql @@ -20,5 +20,6 @@ ALTER TABLE llx_accountingaccount ADD INDEX idx_accountingaccount_fk_pcg_version (fk_pcg_version); - ALTER TABLE llx_accountingaccount ADD CONSTRAINT fk_accountingaccount_fk_pcg_version FOREIGN KEY (fk_pcg_version) REFERENCES llx_accounting_system (pcg_version); + +--ALTER TABLE llx_accountingaccount ADD CONSTRAINT fk_accountingaccount_fk_account_number FOREIGN KEY (fk_account_number) REFERENCES llx_accountingaccount (account_number); diff --git a/htdocs/install/mysql/tables/llx_accountingaccount.sql b/htdocs/install/mysql/tables/llx_accountingaccount.sql index a3143a263f9..f4e4d694471 100644 --- a/htdocs/install/mysql/tables/llx_accountingaccount.sql +++ b/htdocs/install/mysql/tables/llx_accountingaccount.sql @@ -1,5 +1,6 @@ -- ============================================================================ -- Copyright (C) 2004-2006 Laurent Destailleur +-- 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 @@ -20,11 +21,16 @@ create table llx_accountingaccount ( rowid integer AUTO_INCREMENT PRIMARY KEY, + entity integer DEFAULT 1 NOT NULL, + datec datetime, + tms timestamp, fk_pcg_version varchar(12) NOT NULL, pcg_type varchar(20) NOT NULL, pcg_subtype varchar(20) NOT NULL, - account_number varchar(20) NOT NULL, - account_parent varchar(20), + account_number varchar(32) NOT NULL, + account_parent varchar(32), label varchar(255) NOT NULL, + fk_user_author integer DEFAULT NULL, + fk_user_modif integer DEFAULT NULL, active tinyint DEFAULT 1 NOT NULL )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_accountingdebcred.sql b/htdocs/install/mysql/tables/llx_accountingdebcred.sql index f1191803d0e..f7ea28b127a 100644 --- a/htdocs/install/mysql/tables/llx_accountingdebcred.sql +++ b/htdocs/install/mysql/tables/llx_accountingdebcred.sql @@ -20,7 +20,7 @@ create table llx_accountingdebcred ( fk_transaction integer NOT NULL, - account_number varchar(20) NOT NULL, + account_number varchar(32) NOT NULL, amount real NOT NULL, direction varchar(1) NOT NULL )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_actioncomm.key.sql b/htdocs/install/mysql/tables/llx_actioncomm.key.sql index 9a48747c4da..1da34c65bab 100644 --- a/htdocs/install/mysql/tables/llx_actioncomm.key.sql +++ b/htdocs/install/mysql/tables/llx_actioncomm.key.sql @@ -22,3 +22,4 @@ ALTER TABLE llx_actioncomm ADD INDEX idx_actioncomm_datea (datea); ALTER TABLE llx_actioncomm ADD INDEX idx_actioncomm_fk_soc (fk_soc); ALTER TABLE llx_actioncomm ADD INDEX idx_actioncomm_fk_contact (fk_contact); ALTER TABLE llx_actioncomm ADD INDEX idx_actioncomm_code (code); +ALTER TABLE llx_actioncomm ADD INDEX idx_actioncomm_fk_element (fk_element); diff --git a/htdocs/install/mysql/tables/llx_actioncomm_resources.key.sql b/htdocs/install/mysql/tables/llx_actioncomm_resources.key.sql index 6d6999e7232..caaa0969944 100644 --- a/htdocs/install/mysql/tables/llx_actioncomm_resources.key.sql +++ b/htdocs/install/mysql/tables/llx_actioncomm_resources.key.sql @@ -21,5 +21,5 @@ ALTER TABLE llx_actioncomm_resources ADD UNIQUE INDEX idx_actioncomm_resources_idx1 (fk_actioncomm, element_type, fk_element); ALTER TABLE llx_actioncomm_resources ADD INDEX idx_actioncomm_resources_fk_element (fk_element); --- Pas de contraite sur fk_source et fk_target car pointe sur differentes tables +-- Pas de contrainte sur fk_source et fk_target car pointe sur differentes tables diff --git a/htdocs/install/mysql/tables/llx_adherent.sql b/htdocs/install/mysql/tables/llx_adherent.sql index 6d5a4723462..9e4db2b604a 100644 --- a/htdocs/install/mysql/tables/llx_adherent.sql +++ b/htdocs/install/mysql/tables/llx_adherent.sql @@ -30,14 +30,14 @@ create table llx_adherent entity integer DEFAULT 1 NOT NULL, -- multi company id ref_ext varchar(128), -- reference into an external system (not used by dolibarr) - civilite varchar(6), + civility varchar(6), lastname varchar(50), firstname varchar(50), login varchar(50), -- login pass varchar(50), -- password fk_adherent_type integer NOT NULL, morphy varchar(3) NOT NULL, -- personne morale / personne physique - societe varchar(50), + societe varchar(60), -- company name (should be same lenght than societe.name) fk_soc integer NULL, -- Link to third party linked to member address text, zip varchar(30), diff --git a/htdocs/install/mysql/tables/llx_bank_account.sql b/htdocs/install/mysql/tables/llx_bank_account.sql index 198b0ca87ab..63a0e23762d 100644 --- a/htdocs/install/mysql/tables/llx_bank_account.sql +++ b/htdocs/install/mysql/tables/llx_bank_account.sql @@ -1,7 +1,8 @@ -- ============================================================================= --- Copyright (C) 2000-2004 Rodolphe Quiedeville --- Copyright (C) 2004-2007 Laurent Destailleur --- Copyright (C) 2005-2012 Regis Houssin +-- Copyright (C) 2000-2004 Rodolphe Quiedeville +-- Copyright (C) 2004-2014 Laurent Destailleur +-- Copyright (C) 2005-2012 Regis Houssin +-- Copyright (C) 2014 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,39 +19,39 @@ -- -- ============================================================================= --- courant : type de compte: 0 epargne, 1 courant, 2 caisse --- clos : le compte est-il clos ou encore ouvert +-- courant : type of account: 0 epargne, 1 curent/card/cheque, 2 cash +-- clos : is account opened or closed create table llx_bank_account ( - rowid integer AUTO_INCREMENT PRIMARY KEY, - datec datetime, - tms timestamp, - ref varchar(12) NOT NULL, - label varchar(30) NOT NULL, - entity integer DEFAULT 1 NOT NULL, -- multi company id - bank varchar(60), - code_banque varchar(8), - code_guichet varchar(6), - number varchar(255), - cle_rib varchar(5), - bic varchar(11), - iban_prefix varchar(34), -- 34 according to ISO 13616 - country_iban varchar(2), -- deprecated - cle_iban varchar(2), - domiciliation varchar(255), - state_id integer DEFAULT NULL, - fk_pays integer NOT NULL, - proprio varchar(60), - owner_address varchar(255), - courant smallint DEFAULT 0 NOT NULL, - clos smallint DEFAULT 0 NOT NULL, - rappro smallint DEFAULT 1, - url varchar(128), - account_number varchar(24), -- bank accountancy number - currency_code varchar(3) NOT NULL, - min_allowed integer DEFAULT 0, - min_desired integer DEFAULT 0, - comment text - + rowid integer AUTO_INCREMENT PRIMARY KEY, + datec datetime, + tms timestamp, + ref varchar(12) NOT NULL, + label varchar(30) NOT NULL, + entity integer DEFAULT 1 NOT NULL, -- multi company id + bank varchar(60), + code_banque varchar(8), + code_guichet varchar(6), + number varchar(255), + cle_rib varchar(5), + bic varchar(11), + iban_prefix varchar(34), -- 34 according to ISO 13616 + country_iban varchar(2), -- deprecated + cle_iban varchar(2), + domiciliation varchar(255), + state_id integer DEFAULT NULL, + fk_pays integer NOT NULL, + proprio varchar(60), + owner_address varchar(255), + courant smallint DEFAULT 0 NOT NULL, + clos smallint DEFAULT 0 NOT NULL, + rappro smallint DEFAULT 1, + url varchar(128), + account_number varchar(32), -- bank accountancy number + accountancy_journal varchar(3) DEFAULT NULL, -- bank accountancy journal + currency_code varchar(3) NOT NULL, + min_allowed integer DEFAULT 0, + min_desired integer DEFAULT 0, + comment text )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_c_action_trigger.sql b/htdocs/install/mysql/tables/llx_c_action_trigger.sql index 26f46c6ff8f..fa8052d77f9 100644 --- a/htdocs/install/mysql/tables/llx_c_action_trigger.sql +++ b/htdocs/install/mysql/tables/llx_c_action_trigger.sql @@ -14,6 +14,9 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -- +-- This table is a list of all available possible automatic actions +-- It is read only by admin page to select action code and save them +-- into llx_const with name MAIN_AGENDA_ACTIONAUTO_XXX_YYY. -- =================================================================== create table llx_c_action_trigger @@ -24,5 +27,4 @@ create table llx_c_action_trigger description varchar(255), elementtype varchar(16) NOT NULL, rang integer DEFAULT 0 - )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_c_chargesociales.sql b/htdocs/install/mysql/tables/llx_c_chargesociales.sql index b9c448e1d95..5b5cf1edf24 100644 --- a/htdocs/install/mysql/tables/llx_c_chargesociales.sql +++ b/htdocs/install/mysql/tables/llx_c_chargesociales.sql @@ -24,7 +24,7 @@ create table llx_c_chargesociales deductible smallint DEFAULT 0 NOT NULL, active tinyint DEFAULT 1 NOT NULL, code varchar(12) NOT NULL, - accountancy_code varchar(24) DEFAULT NULL, + accountancy_code varchar(32) DEFAULT NULL, fk_pays integer DEFAULT 1 NOT NULL, module varchar(32) NULL )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_c_civilite.key.sql b/htdocs/install/mysql/tables/llx_c_civility.key.sql similarity index 93% rename from htdocs/install/mysql/tables/llx_c_civilite.key.sql rename to htdocs/install/mysql/tables/llx_c_civility.key.sql index 1e8e7dee011..ff095fe9d03 100644 --- a/htdocs/install/mysql/tables/llx_c_civilite.key.sql +++ b/htdocs/install/mysql/tables/llx_c_civility.key.sql @@ -16,4 +16,4 @@ -- -- ======================================================================== -ALTER TABLE llx_c_civilite ADD UNIQUE INDEX uk_c_civilite(code); +ALTER TABLE llx_c_civility ADD UNIQUE INDEX uk_c_civility(code); diff --git a/htdocs/install/mysql/tables/llx_c_civilite.sql b/htdocs/install/mysql/tables/llx_c_civility.sql similarity index 95% rename from htdocs/install/mysql/tables/llx_c_civilite.sql rename to htdocs/install/mysql/tables/llx_c_civility.sql index da53e4789f7..139d0b68f3b 100644 --- a/htdocs/install/mysql/tables/llx_c_civilite.sql +++ b/htdocs/install/mysql/tables/llx_c_civility.sql @@ -17,11 +17,11 @@ -- -- ======================================================================== -create table llx_c_civilite +create table llx_c_civility ( rowid integer PRIMARY KEY, code varchar(6) NOT NULL, - civilite varchar(50), + label varchar(50), active tinyint DEFAULT 1 NOT NULL, module varchar(32) NULL )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_c_pays.key.sql b/htdocs/install/mysql/tables/llx_c_country.key.sql similarity index 79% rename from htdocs/install/mysql/tables/llx_c_pays.key.sql rename to htdocs/install/mysql/tables/llx_c_country.key.sql index 6714a0644b2..b65d78d559f 100644 --- a/htdocs/install/mysql/tables/llx_c_pays.key.sql +++ b/htdocs/install/mysql/tables/llx_c_country.key.sql @@ -17,6 +17,6 @@ -- ======================================================================== -ALTER TABLE llx_c_pays ADD UNIQUE INDEX idx_c_country_code (code); -ALTER TABLE llx_c_pays ADD UNIQUE INDEX idx_c_country_code_iso (code_iso); -ALTER TABLE llx_c_pays ADD UNIQUE INDEX idx_c_pays_libelle (libelle); +ALTER TABLE llx_c_country ADD UNIQUE INDEX idx_c_country_code (code); +ALTER TABLE llx_c_country ADD UNIQUE INDEX idx_c_country_code_iso (code_iso); +ALTER TABLE llx_c_country ADD UNIQUE INDEX idx_c_country_label (label); diff --git a/htdocs/install/mysql/tables/llx_c_pays.sql b/htdocs/install/mysql/tables/llx_c_country.sql similarity index 94% rename from htdocs/install/mysql/tables/llx_c_pays.sql rename to htdocs/install/mysql/tables/llx_c_country.sql index 6f4401d5110..f9c69a5093b 100644 --- a/htdocs/install/mysql/tables/llx_c_pays.sql +++ b/htdocs/install/mysql/tables/llx_c_country.sql @@ -17,11 +17,11 @@ -- -- ======================================================================== -create table llx_c_pays +create table llx_c_country ( rowid integer PRIMARY KEY, code varchar(2) NOT NULL, code_iso varchar(3) , - libelle varchar(50) NOT NULL, + label varchar(50) NOT NULL, active tinyint DEFAULT 1 NOT NULL )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_c_departements.key.sql b/htdocs/install/mysql/tables/llx_c_departements.key.sql index 0d8459c1ba0..427d031a705 100644 --- a/htdocs/install/mysql/tables/llx_c_departements.key.sql +++ b/htdocs/install/mysql/tables/llx_c_departements.key.sql @@ -19,5 +19,7 @@ ALTER TABLE llx_c_departements ADD UNIQUE uk_departements (code_departement,fk_region); - ALTER TABLE llx_c_departements ADD INDEX idx_departements_fk_region (fk_region); + +ALTER TABLE llx_c_departements ADD CONSTRAINT fk_departements_fk_region FOREIGN KEY (fk_region) REFERENCES llx_c_regions (code_region); + diff --git a/htdocs/install/mysql/tables/llx_c_email_template.sql b/htdocs/install/mysql/tables/llx_c_email_template.sql index b3f8ca1e1e0..532ecd995eb 100644 --- a/htdocs/install/mysql/tables/llx_c_email_template.sql +++ b/htdocs/install/mysql/tables/llx_c_email_template.sql @@ -17,12 +17,18 @@ -- Table with templates of emails -- =================================================================== -create table llx_c_email_templates +create table llx_c_email_template ( rowid integer AUTO_INCREMENT PRIMARY KEY, entity integer DEFAULT 1 NOT NULL, -- multi company id - type_template varchar(32), -- template for wich type of email (send invoice by email, send order, ...) + module varchar(32), -- Nom du module en rapport avec le modele + type_template varchar(32), -- template for which type of email (send invoice by email, send order, ...) + private smallint DEFAULT 0 NOT NULL, -- Template public or private + fk_user integer, -- Id utilisateur si modele prive, sinon null datec datetime, - label varchar(255), - content text + tms timestamp, + label varchar(255), -- Label of predefined email + position smallint, -- Position + topic text, -- Predefined topic + content text -- Predefined text )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_c_paiement.sql b/htdocs/install/mysql/tables/llx_c_paiement.sql index 8d78992a4f8..665897069cc 100644 --- a/htdocs/install/mysql/tables/llx_c_paiement.sql +++ b/htdocs/install/mysql/tables/llx_c_paiement.sql @@ -1,6 +1,7 @@ -- ======================================================================== -- Copyright (C) 2001-2004 Rodolphe Quiedeville -- Copyright (C) 2004 Laurent Destailleur +-- Copyright (C) 2014 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 @@ -26,12 +27,13 @@ create table llx_c_paiement ( - id integer PRIMARY KEY, - code varchar(6) NOT NULL, - libelle varchar(30), - type smallint, - active tinyint DEFAULT 1 NOT NULL, - module varchar(32) NULL + id integer PRIMARY KEY, + code varchar(6) NOT NULL, + libelle varchar(30), + type smallint, + active tinyint DEFAULT 1 NOT NULL, + accountancy_code varchar(32) NULL, + module varchar(32) NULL )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_c_regions.key.sql b/htdocs/install/mysql/tables/llx_c_regions.key.sql index 838396d5d57..82295ba52b3 100644 --- a/htdocs/install/mysql/tables/llx_c_regions.key.sql +++ b/htdocs/install/mysql/tables/llx_c_regions.key.sql @@ -18,4 +18,5 @@ ALTER TABLE llx_c_regions ADD INDEX idx_c_regions_fk_pays (fk_pays); -ALTER TABLE llx_c_regions ADD CONSTRAINT fk_c_regions_fk_pays FOREIGN KEY (fk_pays) REFERENCES llx_c_pays (rowid); +ALTER TABLE llx_c_regions ADD UNIQUE INDEX uk_code_region (code_region); +ALTER TABLE llx_c_regions ADD CONSTRAINT fk_c_regions_fk_pays FOREIGN KEY (fk_pays) REFERENCES llx_c_country (rowid); diff --git a/htdocs/install/mysql/tables/llx_c_regions.sql b/htdocs/install/mysql/tables/llx_c_regions.sql index c15c1e9b204..9c677ee44f7 100644 --- a/htdocs/install/mysql/tables/llx_c_regions.sql +++ b/htdocs/install/mysql/tables/llx_c_regions.sql @@ -20,7 +20,7 @@ create table llx_c_regions ( rowid integer AUTO_INCREMENT PRIMARY KEY, - code_region integer UNIQUE NOT NULL, + code_region integer NOT NULL, fk_pays integer NOT NULL, cheflieu varchar(50), tncc integer, diff --git a/htdocs/install/mysql/tables/llx_c_revenuestamp.sql b/htdocs/install/mysql/tables/llx_c_revenuestamp.sql index 7a47c05dca3..0eb5a46216d 100644 --- a/htdocs/install/mysql/tables/llx_c_revenuestamp.sql +++ b/htdocs/install/mysql/tables/llx_c_revenuestamp.sql @@ -23,7 +23,7 @@ create table llx_c_revenuestamp taux double NOT NULL, note varchar(128), active tinyint DEFAULT 1 NOT NULL, - accountancy_code_sell varchar(15) DEFAULT NULL, - accountancy_code_buy varchar(15) DEFAULT NULL + accountancy_code_sell varchar(32) DEFAULT NULL, + accountancy_code_buy varchar(32) DEFAULT NULL )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_c_tva.sql b/htdocs/install/mysql/tables/llx_c_tva.sql index 46aa3632faa..2a0b275ce96 100644 --- a/htdocs/install/mysql/tables/llx_c_tva.sql +++ b/htdocs/install/mysql/tables/llx_c_tva.sql @@ -1,6 +1,6 @@ -- ======================================================================== -- Copyright (C) 2005 Laurent Destailleur --- Copyright (C) 2010 Juanjo Menent +-- Copyright (C) 2010-2014 Juanjo Menent -- Copyright (C) 2011-2012 Alexandre Spangaro -- -- This program is free software; you can redistribute it and/or modify @@ -23,14 +23,14 @@ create table llx_c_tva rowid integer NOT NULL AUTO_INCREMENT PRIMARY KEY, fk_pays integer NOT NULL, taux double NOT NULL, - localtax1 double NOT NULL DEFAULT 0, + localtax1 varchar(10) NOT NULL DEFAULT '0', localtax1_type varchar(10) NOT NULL DEFAULT '0', - localtax2 double NOT NULL DEFAULT 0, - localtax2_type varchar(10) NOT NULL DEFAULT '0', + localtax2 varchar(10) NOT NULL DEFAULT '0', + localtax2_type varchar(10) NOT NULL DEFAULT '0', recuperableonly integer NOT NULL DEFAULT 0, note varchar(128), active tinyint DEFAULT 1 NOT NULL, - accountancy_code_sell varchar(15) DEFAULT NULL, - accountancy_code_buy varchar(15) DEFAULT NULL + accountancy_code_sell varchar(32) DEFAULT NULL, + accountancy_code_buy varchar(32) DEFAULT NULL )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_c_type_fees.sql b/htdocs/install/mysql/tables/llx_c_type_fees.sql index b19aae75e5a..145330012eb 100644 --- a/htdocs/install/mysql/tables/llx_c_type_fees.sql +++ b/htdocs/install/mysql/tables/llx_c_type_fees.sql @@ -1,6 +1,7 @@ -- ======================================================================== -- Copyright (C) 2001-2002,2004 Rodolphe Quiedeville -- Copyright (C) 2004 Laurent Destailleur +-- Copyright (C) 2014 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 @@ -19,9 +20,10 @@ create table llx_c_type_fees ( - id integer AUTO_INCREMENT PRIMARY KEY, - code varchar(12) NOT NULL, - libelle varchar(30), - active tinyint DEFAULT 1 NOT NULL, - module varchar(32) NULL + id integer AUTO_INCREMENT PRIMARY KEY, + code varchar(12) NOT NULL, + label varchar(30), + accountancy_code varchar(32) NULL, + active tinyint DEFAULT 1 NOT NULL, + module varchar(32) NULL )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_c_typent.sql b/htdocs/install/mysql/tables/llx_c_typent.sql index 62d39cea8ad..06a41727b69 100644 --- a/htdocs/install/mysql/tables/llx_c_typent.sql +++ b/htdocs/install/mysql/tables/llx_c_typent.sql @@ -19,9 +19,10 @@ create table llx_c_typent ( - id integer PRIMARY KEY, - code varchar(12) NOT NULL, - libelle varchar(30), - active tinyint DEFAULT 1 NOT NULL, - module varchar(32) NULL + id integer PRIMARY KEY, + code varchar(12) NOT NULL, + libelle varchar(30), + fk_country integer NULL, -- Defined only to have specific list for countries that can't use generic list (like argentina that need type A or B) + active tinyint DEFAULT 1 NOT NULL, + module varchar(32) NULL )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_c_ziptown.key.sql b/htdocs/install/mysql/tables/llx_c_ziptown.key.sql index 3bc138d8816..9d4ff705d04 100644 --- a/htdocs/install/mysql/tables/llx_c_ziptown.key.sql +++ b/htdocs/install/mysql/tables/llx_c_ziptown.key.sql @@ -23,6 +23,6 @@ ALTER TABLE llx_c_ziptown ADD INDEX idx_c_ziptown_fk_pays (fk_pays); ALTER TABLE llx_c_ziptown ADD INDEX idx_c_ziptown_zip (zip); ALTER TABLE llx_c_ziptown ADD CONSTRAINT fk_c_ziptown_fk_county FOREIGN KEY (fk_county) REFERENCES llx_c_departements (rowid); -ALTER TABLE llx_c_ziptown ADD CONSTRAINT fk_c_ziptown_fk_pays FOREIGN KEY (fk_pays) REFERENCES llx_c_pays(rowid); +ALTER TABLE llx_c_ziptown ADD CONSTRAINT fk_c_ziptown_fk_pays FOREIGN KEY (fk_pays) REFERENCES llx_c_country(rowid); ALTER TABLE llx_c_ziptown ADD UNIQUE INDEX uk_ziptown_fk_pays (zip, town, fk_pays); diff --git a/htdocs/install/mysql/tables/llx_c_ziptown.sql b/htdocs/install/mysql/tables/llx_c_ziptown.sql index 11a0dfe0350..0eaab74af20 100644 --- a/htdocs/install/mysql/tables/llx_c_ziptown.sql +++ b/htdocs/install/mysql/tables/llx_c_ziptown.sql @@ -21,7 +21,7 @@ create table llx_c_ziptown rowid integer NOT NULL AUTO_INCREMENT PRIMARY KEY, code varchar(5) DEFAULT NULL, -- ex: code insee pour la France fk_county integer, -- State id in llx_c_departements - fk_pays integer NOT NULL DEFAULT 0, -- Country id in llx_c_pays + fk_pays integer NOT NULL DEFAULT 0, -- Country id in llx_c_country zip varchar(10) NOT NULL, -- Zip code town varchar(255) NOT NULL, -- Town name active tinyint NOT NULL DEFAULT 1 diff --git a/htdocs/install/mysql/tables/llx_commande.sql b/htdocs/install/mysql/tables/llx_commande.sql index f1c12a6741f..3cf3fdac226 100644 --- a/htdocs/install/mysql/tables/llx_commande.sql +++ b/htdocs/install/mysql/tables/llx_commande.sql @@ -61,6 +61,7 @@ create table llx_commande fk_mode_reglement integer, -- mode de reglement date_livraison date default NULL, + fk_shipping_method integer, -- shipping method id fk_availability integer NULL, fk_input_reason integer, fk_delivery_address integer, -- delivery address (deprecated) diff --git a/htdocs/install/mysql/tables/llx_commande_fournisseur.sql b/htdocs/install/mysql/tables/llx_commande_fournisseur.sql index 51e57452397..d8076c1c06c 100644 --- a/htdocs/install/mysql/tables/llx_commande_fournisseur.sql +++ b/htdocs/install/mysql/tables/llx_commande_fournisseur.sql @@ -55,6 +55,7 @@ create table llx_commande_fournisseur model_pdf varchar(255), date_livraison date default NULL, + fk_account integer, -- bank account fk_cond_reglement integer, -- condition de reglement fk_mode_reglement integer, -- mode de reglement fk_input_method integer default 0, diff --git a/htdocs/install/mysql/tables/llx_contrat.sql b/htdocs/install/mysql/tables/llx_contrat.sql index 7521eb0aa1b..496ecd4c97d 100644 --- a/htdocs/install/mysql/tables/llx_contrat.sql +++ b/htdocs/install/mysql/tables/llx_contrat.sql @@ -20,11 +20,12 @@ create table llx_contrat ( - rowid integer AUTO_INCREMENT PRIMARY KEY, - ref varchar(30), -- reference de contrat + rowid integer AUTO_INCREMENT PRIMARY KEY, + ref varchar(30), -- contrat reference + ref_supplier varchar(30), -- suplier contract ref entity integer DEFAULT 1 NOT NULL, -- multi company id tms timestamp, - datec datetime, -- date de creation de l enregistrement + datec datetime, -- creation date date_contrat datetime, statut smallint DEFAULT 0, mise_en_service datetime, @@ -40,7 +41,7 @@ create table llx_contrat note_private text, note_public text, import_key varchar(14), - extraparams varchar(255) -- for stock other parameters with json format - + extraparams varchar(255) + )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_expeditiondet_batch.key.sql b/htdocs/install/mysql/tables/llx_expeditiondet_batch.key.sql index 44acf1d7afe..70bfe974f34 100644 --- a/htdocs/install/mysql/tables/llx_expeditiondet_batch.key.sql +++ b/htdocs/install/mysql/tables/llx_expeditiondet_batch.key.sql @@ -15,5 +15,6 @@ -- along with this program. If not, see . -- -- ============================================================================ + ALTER TABLE llx_expeditiondet_batch ADD INDEX idx_fk_expeditiondet (fk_expeditiondet); ALTER TABLE llx_expeditiondet_batch ADD CONSTRAINT fk_expeditiondet_batch_fk_expeditiondet FOREIGN KEY (fk_expeditiondet) REFERENCES llx_expeditiondet(rowid); diff --git a/htdocs/install/mysql/tables/llx_facture_fourn.sql b/htdocs/install/mysql/tables/llx_facture_fourn.sql index c980d43e40f..2bb85f8400e 100644 --- a/htdocs/install/mysql/tables/llx_facture_fourn.sql +++ b/htdocs/install/mysql/tables/llx_facture_fourn.sql @@ -58,6 +58,7 @@ create table llx_facture_fourn fk_facture_source integer, -- facture origine si facture avoir fk_projet integer, -- projet auquel est associee la facture + fk_account integer, -- bank account fk_cond_reglement integer, -- condition de reglement (30 jours, fin de mois ...) fk_mode_reglement integer, -- mode de reglement (CHQ, VIR, ...) date_lim_reglement date, -- date limite de reglement diff --git a/htdocs/install/mysql/tables/llx_compta_compte_generaux.sql b/htdocs/install/mysql/tables/llx_holiday_types.sql old mode 100644 new mode 100755 similarity index 63% rename from htdocs/install/mysql/tables/llx_compta_compte_generaux.sql rename to htdocs/install/mysql/tables/llx_holiday_types.sql index d830e8dbd66..d49a79f5748 --- a/htdocs/install/mysql/tables/llx_compta_compte_generaux.sql +++ b/htdocs/install/mysql/tables/llx_holiday_types.sql @@ -1,5 +1,5 @@ -- =================================================================== --- Copyright (C) 2004 Rodolphe Quiedeville +-- Copyright (C) 2014 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 @@ -16,14 +16,15 @@ -- -- =================================================================== -create table llx_compta_compte_generaux -( - rowid integer AUTO_INCREMENT PRIMARY KEY, - date_creation datetime, - numero varchar(50), - intitule varchar(255), - fk_user_author integer, - note text, - - UNIQUE(numero) -)ENGINE=innodb; +CREATE TABLE llx_holiday_types ( + rowid integer NOT NULL AUTO_INCREMENT PRIMARY KEY, + label varchar(45) NOT NULL, + description varchar(255) NOT NULL, + affect integer NOT NULL, + delay integer NOT NULL, + insertAt DATETIME NOT NULL, + updateAt DATETIME, + deleteAt DATETIME, + nbCongesDeducted varchar(255) NOT NULL, + nbCongesEveryMonth varchar(255) NOT NULL +) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_localtax.sql b/htdocs/install/mysql/tables/llx_localtax.sql index c7ca3ca44f6..65c9fbe496b 100644 --- a/htdocs/install/mysql/tables/llx_localtax.sql +++ b/htdocs/install/mysql/tables/llx_localtax.sql @@ -1,6 +1,6 @@ -- =================================================================== --- Copyright (C) 2011 Juanjo Menent --- Copyright (C) 2011 Regis Houssin +-- Copyright (C) 2011-2014 Juanjo Menent +-- Copyright (C) 2011 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 @@ -21,6 +21,7 @@ create table llx_localtax ( rowid integer AUTO_INCREMENT PRIMARY KEY, entity integer DEFAULT 1 NOT NULL, + localtaxtype tinyint, tms timestamp, datep date, -- date of payment datev date, -- date of value @@ -30,5 +31,4 @@ create table llx_localtax fk_bank integer, fk_user_creat integer, fk_user_modif integer - )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_product.key.sql b/htdocs/install/mysql/tables/llx_product.key.sql index a2cb0e539f9..fb471910230 100644 --- a/htdocs/install/mysql/tables/llx_product.key.sql +++ b/htdocs/install/mysql/tables/llx_product.key.sql @@ -2,6 +2,7 @@ -- Copyright (C) 2002-2004 Rodolphe Quiedeville -- Copyright (C) 2004-2013 Laurent Destailleur -- Copyright (C) 2005-2009 Regis Houssin +-- 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 @@ -25,6 +26,11 @@ ALTER TABLE llx_product ADD INDEX idx_product_label (label); ALTER TABLE llx_product ADD INDEX idx_product_barcode (barcode); ALTER TABLE llx_product ADD INDEX idx_product_import_key (import_key); ALTER TABLE llx_product ADD INDEX idx_product_seuil_stock_alerte (seuil_stock_alerte); - +ALTER TABLE llx_product ADD INDEX idx_product_fk_country (fk_country); +ALTER TABLE llx_product ADD INDEX idx_product_fk_user_author (fk_user_author); +ALTER TABLE llx_product ADD INDEX idx_product_fk_barcode_type (fk_barcode_type); ALTER TABLE llx_product ADD UNIQUE INDEX uk_product_barcode (barcode, fk_barcode_type, entity); + +ALTER TABLE llx_product ADD CONSTRAINT fk_product_fk_country FOREIGN KEY (fk_country) REFERENCES llx_c_country (rowid); +ALTER TABLE llx_product ADD CONSTRAINT fk_product_barcode_type FOREIGN KEY (fk_barcode_type) REFERENCES llx_c_barcode_type (rowid); diff --git a/htdocs/install/mysql/tables/llx_product.sql b/htdocs/install/mysql/tables/llx_product.sql index 582f8161365..0ab9a24785c 100644 --- a/htdocs/install/mysql/tables/llx_product.sql +++ b/htdocs/install/mysql/tables/llx_product.sql @@ -4,6 +4,7 @@ -- Copyright (C) 2005-2010 Regis Houssin -- Copyright (C) 2010 juanjo Menent -- Copyright (C) 2013 Cédric Salvador +-- 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 @@ -37,7 +38,7 @@ create table llx_product description text, note text, customcode varchar(32), -- Optionnal custom code - fk_country integer, -- Optionnal id of original country + fk_country integer DEFAULT NULL, -- Optionnal id of original country price double(24,8) DEFAULT 0, price_ttc double(24,8) DEFAULT 0, price_min double(24,8) DEFAULT 0, @@ -47,7 +48,7 @@ create table llx_product recuperableonly integer NOT NULL DEFAULT '0', -- French NPR VAT localtax1_tx double(6,3) DEFAULT 0, -- Spanish local VAT 1 localtax2_tx double(6,3) DEFAULT 0, -- Spanish local VAT 2 - fk_user_author integer, + fk_user_author integer DEFAULT NULL, tosell tinyint DEFAULT 1, -- Product you sell tobuy tinyint DEFAULT 1, -- Product you buy tobatch tinyint DEFAULT 0 NOT NULL, -- Is it a product that need a batch or eat-by management @@ -56,9 +57,9 @@ create table llx_product seuil_stock_alerte integer DEFAULT 0, url varchar(255), barcode varchar(255) DEFAULT NULL, - fk_barcode_type integer DEFAULT 0, - accountancy_code_sell varchar(15), -- Selling accountancy code - accountancy_code_buy varchar(15), -- Buying accountancy code + fk_barcode_type integer DEFAULT NULL, + accountancy_code_sell varchar(32), -- Selling accountancy code + accountancy_code_buy varchar(32), -- Buying accountancy code partnumber varchar(32), -- Not used. Used by external modules. weight float DEFAULT NULL, weight_units tinyint DEFAULT NULL, diff --git a/htdocs/install/mysql/tables/llx_compta.sql b/htdocs/install/mysql/tables/llx_product_price.key.sql similarity index 59% rename from htdocs/install/mysql/tables/llx_compta.sql rename to htdocs/install/mysql/tables/llx_product_price.key.sql index b7b06636e51..b3018cea95b 100644 --- a/htdocs/install/mysql/tables/llx_compta.sql +++ b/htdocs/install/mysql/tables/llx_product_price.key.sql @@ -1,5 +1,5 @@ --- =================================================================== --- Copyright (C) 2000-2002 Rodolphe Quiedeville +-- ============================================================================ +-- 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 @@ -14,19 +14,10 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -- --- =================================================================== +-- ============================================================================ -create table llx_compta -( - rowid integer AUTO_INCREMENT PRIMARY KEY, - datec datetime, - datev date, -- date de valeur - amount real DEFAULT 0 NOT NULL , - label varchar(255), - fk_compta_account integer, - fk_user_author integer, - fk_user_valid integer, - valid tinyint DEFAULT 0, - note text +ALTER TABLE llx_product_price ADD INDEX idx_product_price_fk_user_author (fk_user_author); +ALTER TABLE llx_product_price ADD INDEX idx_product_price_fk_product (fk_product); -)ENGINE=innodb; +ALTER TABLE llx_product_price ADD CONSTRAINT fk_product_price_user_author FOREIGN KEY (fk_product) REFERENCES llx_product (rowid); +ALTER TABLE llx_product_price ADD CONSTRAINT fk_product_price_product FOREIGN KEY (fk_user_author) REFERENCES llx_user (rowid); diff --git a/htdocs/install/mysql/tables/llx_compta_account.sql b/htdocs/install/mysql/tables/llx_projet_task_time.key.sql similarity index 68% rename from htdocs/install/mysql/tables/llx_compta_account.sql rename to htdocs/install/mysql/tables/llx_projet_task_time.key.sql index b70ad9ba160..ad1433f8dca 100644 --- a/htdocs/install/mysql/tables/llx_compta_account.sql +++ b/htdocs/install/mysql/tables/llx_projet_task_time.key.sql @@ -1,5 +1,5 @@ --- =================================================================== --- Copyright (C) 2000-2002 Rodolphe Quiedeville +-- =========================================================================== +-- Copyright (C) 2014 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 @@ -14,15 +14,9 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -- --- =================================================================== +-- =========================================================================== -create table llx_compta_account -( - rowid integer AUTO_INCREMENT PRIMARY KEY, - datec datetime, - number varchar(12), - label varchar(255), - fk_user_author integer, - note text +ALTER TABLE llx_projet_task_time ADD INDEX idx_projet_task_time_task (fk_task); +ALTER TABLE llx_projet_task_time ADD INDEX idx_projet_task_time_date (task_date); +ALTER TABLE llx_projet_task_time ADD INDEX idx_projet_task_time_datehour (task_datehour); -)ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_projet_task_time.sql b/htdocs/install/mysql/tables/llx_projet_task_time.sql index 8bef980a12e..d5d89812b4a 100644 --- a/htdocs/install/mysql/tables/llx_projet_task_time.sql +++ b/htdocs/install/mysql/tables/llx_projet_task_time.sql @@ -20,7 +20,8 @@ create table llx_projet_task_time ( rowid integer AUTO_INCREMENT PRIMARY KEY, fk_task integer NOT NULL, - task_date date, + task_date date, -- only the day + task_datehour datetime, -- day + hour task_duration double, fk_user integer, thm double(24,8), diff --git a/htdocs/install/mysql/tables/llx_propal.sql b/htdocs/install/mysql/tables/llx_propal.sql index 0ca800c9bca..c9ab3ecd138 100644 --- a/htdocs/install/mysql/tables/llx_propal.sql +++ b/htdocs/install/mysql/tables/llx_propal.sql @@ -61,6 +61,7 @@ create table llx_propal note_public text, model_pdf varchar(255), date_livraison date DEFAULT NULL, -- delivery date + fk_shipping_method integer, -- shipping method id fk_availability integer NULL, fk_input_reason integer, import_key varchar(14), diff --git a/htdocs/install/mysql/tables/llx_societe.sql b/htdocs/install/mysql/tables/llx_societe.sql index e2c08d246be..bfe69b0d5f8 100644 --- a/htdocs/install/mysql/tables/llx_societe.sql +++ b/htdocs/install/mysql/tables/llx_societe.sql @@ -22,7 +22,7 @@ create table llx_societe ( rowid integer AUTO_INCREMENT PRIMARY KEY, - nom varchar(60), -- company reference name + nom varchar(60), -- company reference name (should be smae length than adherent.societe) entity integer DEFAULT 1 NOT NULL, -- multi company id ref_ext varchar(128), -- reference into an external system (not used by dolibarr) @@ -81,7 +81,9 @@ create table llx_societe cond_reglement_supplier tinyint, -- condition de reglement fournisseur tva_assuj tinyint DEFAULT 1, -- assujeti ou non a la TVA localtax1_assuj tinyint DEFAULT 0, -- assujeti ou non a local tax 1 + localtax1_value double(6,3), localtax2_assuj tinyint DEFAULT 0, -- assujeti ou non a local tax 2 + localtax2_value double(6,3), barcode varchar(255), -- barcode fk_barcode_type integer NULL DEFAULT 0, -- barcode type price_level integer NULL, -- level of price for multiprices diff --git a/htdocs/install/mysql/tables/llx_socpeople.sql b/htdocs/install/mysql/tables/llx_socpeople.sql index 04635061e59..4b99598a3b9 100644 --- a/htdocs/install/mysql/tables/llx_socpeople.sql +++ b/htdocs/install/mysql/tables/llx_socpeople.sql @@ -26,7 +26,7 @@ create table llx_socpeople fk_soc integer, -- lien vers la societe entity integer DEFAULT 1 NOT NULL, -- multi company id ref_ext varchar(128), -- reference into an external system (not used by dolibarr) - civilite varchar(6), + civility varchar(6), lastname varchar(50), firstname varchar(50), address varchar(255), diff --git a/htdocs/install/mysql/tables/llx_texts.sql b/htdocs/install/mysql/tables/llx_texts.sql deleted file mode 100644 index 9e667120287..00000000000 --- a/htdocs/install/mysql/tables/llx_texts.sql +++ /dev/null @@ -1,34 +0,0 @@ --- ============================================================================ --- Copyright (C) 2007-2009 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 . --- --- ============================================================================ - -create table llx_texts -( - rowid integer AUTO_INCREMENT PRIMARY KEY, - - module varchar(32), -- Nom du module en rapport avec le modele - typemodele varchar(32), -- Type du modele - sortorder smallint, -- Ordre affichage - - private smallint DEFAULT 0 NOT NULL, -- Modele publique ou prive - fk_user integer, -- Id utilisateur si modele prive, sinon null - title varchar(128), -- Titre du modele - filename varchar(128), -- Nom fichier si modele fichier - content text, -- Texte si modele texte - - tms timestamp -)ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_user.sql b/htdocs/install/mysql/tables/llx_user.sql index 4b537e21f0c..8a75b545a54 100644 --- a/htdocs/install/mysql/tables/llx_user.sql +++ b/htdocs/install/mysql/tables/llx_user.sql @@ -28,11 +28,13 @@ create table llx_user datec datetime, tms timestamp, + fk_user_creat integer, + fk_user_modif integer, login varchar(24) NOT NULL, pass varchar(32), pass_crypted varchar(128), pass_temp varchar(32), -- temporary password when asked for forget password - civilite varchar(6), + civility varchar(6), lastname varchar(50), firstname varchar(50), address varchar(255), -- user personal address @@ -67,7 +69,7 @@ create table llx_user color varchar(6), barcode varchar(255) DEFAULT NULL, fk_barcode_type integer DEFAULT 0, - accountancy_code varchar(24) NULL, + accountancy_code varchar(32) NULL, nb_holiday integer DEFAULT 0, salary double(24,8) )ENGINE=innodb; diff --git a/htdocs/install/pgsql/functions/functions.sql b/htdocs/install/pgsql/functions/functions.sql index 3275d589685..89395436c43 100644 --- a/htdocs/install/pgsql/functions/functions.sql +++ b/htdocs/install/pgsql/functions/functions.sql @@ -62,6 +62,7 @@ CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_adherent_type FOR EA CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_bank FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_bank_account FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_boxes_def FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); +CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_c_email_template FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_c_field_list FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_c_shipment_mode FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_chargesociales FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); @@ -111,7 +112,6 @@ CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_societe_rib FOR EACH CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_socpeople FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_socpeople_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_stock_mouvement FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); -CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_texts FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_tva FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_user FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_user_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); diff --git a/htdocs/install/pgsql/functions/index.html b/htdocs/install/pgsql/functions/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/install/pgsql/index.html b/htdocs/install/pgsql/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/install/upgrade.php b/htdocs/install/upgrade.php index 9b15d36ffe9..d89596e25e6 100644 --- a/htdocs/install/upgrade.php +++ b/htdocs/install/upgrade.php @@ -168,7 +168,7 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action'))) dolibarr_install_syslog("upgrade: ".$langs->transnoentities("ServerVersion")." : $version"); // Test database version - $versionmindb=getStaticMember(get_class($db),'versionmin'); + $versionmindb=$db::VERSIONMIN; //print join('.',$versionarray).' - '.join('.',$versionmindb); if (count($versionmindb) && count($versionarray) && versioncompare($versionarray,$versionmindb) < 0) @@ -203,7 +203,7 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action'))) $filles=array(); $sql = "SELECT fk_categorie_mere, fk_categorie_fille"; $sql.= " FROM ".MAIN_DB_PREFIX."categorie_association"; - dolibarr_install_syslog("upgrade: search duplicate sql=".$sql); + dolibarr_install_syslog("upgrade: search duplicate", LOG_DEBUG); $resql = $db->query($sql); if ($resql) { @@ -231,7 +231,7 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action'))) // We delete all $sql="DELETE FROM ".MAIN_DB_PREFIX."categorie_association"; - dolibarr_install_syslog("upgrade: delete association sql=".$sql); + dolibarr_install_syslog("upgrade: delete association", LOG_DEBUG); $resqld=$db->query($sql); if ($resqld) { @@ -240,7 +240,7 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action'))) { $sql ="INSERT INTO ".MAIN_DB_PREFIX."categorie_association(fk_categorie_mere,fk_categorie_fille)"; $sql.=" VALUES(".$val['mere'].", ".$val['fille'].")"; - dolibarr_install_syslog("upgrade: insert association sql=".$sql); + dolibarr_install_syslog("upgrade: insert association", LOG_DEBUG); $resqli=$db->query($sql); if (! $resqli) $error++; } diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index 736346d0f72..f9fa76541a5 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -413,7 +413,7 @@ function migrate_paiements($db,$langs,$conf) $resql = $db->query($sql); - dolibarr_install_syslog("upgrade2::migrate_paiements sql=".$sql); + dolibarr_install_syslog("upgrade2::migrate_paiements", LOG_DEBUG); if ($resql) { $i = 0; @@ -513,7 +513,7 @@ function migrate_paiements_orphelins_1($db,$langs,$conf) $resql = $db->query($sql); - dolibarr_install_syslog("upgrade2::migrate_paiements_orphelins_1 sql=".$sql); + dolibarr_install_syslog("upgrade2::migrate_paiements_orphelins_1", LOG_DEBUG); $row = array(); if ($resql) { @@ -639,7 +639,7 @@ function migrate_paiements_orphelins_2($db,$langs,$conf) $resql = $db->query($sql); - dolibarr_install_syslog("upgrade2::migrate_paiements_orphelins_2 sql=".$sql); + dolibarr_install_syslog("upgrade2::migrate_paiements_orphelins_2", LOG_DEBUG); $row = array(); if ($resql) { @@ -779,7 +779,7 @@ function migrate_contracts_det($db,$langs,$conf) $sql.= " WHERE cd.rowid IS NULL AND p.rowid IS NOT NULL"; $resql = $db->query($sql); - dolibarr_install_syslog("upgrade2::migrate_contracts_det sql=".$sql); + dolibarr_install_syslog("upgrade2::migrate_contracts_det", LOG_DEBUG); if ($resql) { $i = 0; @@ -875,7 +875,7 @@ function migrate_links_transfert($db,$langs,$conf) $sql.= " AND bu.fk_bank IS NULL"; $resql = $db->query($sql); - dolibarr_install_syslog("upgrade2::migrate_links_transfert sql=".$sql); + dolibarr_install_syslog("upgrade2::migrate_links_transfert", LOG_DEBUG); if ($resql) { $i = 0; @@ -899,7 +899,7 @@ function migrate_links_transfert($db,$langs,$conf) $sql.= ")"; print $sql.'
'; - dolibarr_install_syslog("migrate_links_transfert sql=".$sql); + dolibarr_install_syslog("migrate_links_transfert", LOG_DEBUG); if (! $db->query($sql)) { @@ -950,7 +950,7 @@ function migrate_contracts_date1($db,$langs,$conf) print ''.$langs->trans('MigrationContractsEmptyDatesUpdate')."
\n"; $sql="update llx_contrat set date_contrat=tms where date_contrat is null"; - dolibarr_install_syslog("upgrade2::migrate_contracts_date1 sql=".$sql); + dolibarr_install_syslog("upgrade2::migrate_contracts_date1", LOG_DEBUG); $resql = $db->query($sql); if (! $resql) dol_print_error($db); if ($db->affected_rows($resql) > 0) @@ -959,7 +959,7 @@ function migrate_contracts_date1($db,$langs,$conf) print $langs->trans('MigrationContractsEmptyDatesNothingToUpdate')."
\n"; $sql="update llx_contrat set datec=tms where datec is null"; - dolibarr_install_syslog("upgrade2::migrate_contracts_date1 sql=".$sql); + dolibarr_install_syslog("upgrade2::migrate_contracts_date1", LOG_DEBUG); $resql = $db->query($sql); if (! $resql) dol_print_error($db); if ($db->affected_rows($resql) > 0) @@ -989,7 +989,7 @@ function migrate_contracts_date2($db,$langs,$conf) $sql.= " GROUP BY c.rowid, c.date_contrat"; $resql = $db->query($sql); - dolibarr_install_syslog("upgrade2::migrate_contracts_date2 sql=".$sql); + dolibarr_install_syslog("upgrade2::migrate_contracts_date2", LOG_DEBUG); if ($resql) { $i = 0; @@ -1050,7 +1050,7 @@ function migrate_contracts_date3($db,$langs,$conf) print ''.$langs->trans('MigrationContractsIncoherentCreationDateUpdate')."
\n"; $sql="update llx_contrat set datec=date_contrat where datec is null or datec > date_contrat"; - dolibarr_install_syslog("upgrade2::migrate_contracts_date3 sql=".$sql); + dolibarr_install_syslog("upgrade2::migrate_contracts_date3", LOG_DEBUG); $resql = $db->query($sql); if (! $resql) dol_print_error($db); if ($db->affected_rows($resql) > 0) @@ -1078,7 +1078,7 @@ function migrate_contracts_open($db,$langs,$conf) $sql = "SELECT c.rowid as cref FROM llx_contrat as c, llx_contratdet as cd"; $sql.= " WHERE cd.statut = 4 AND c.statut=2 AND c.rowid=cd.fk_contrat"; - dolibarr_install_syslog("upgrade2::migrate_contracts_open sql=".$sql); + dolibarr_install_syslog("upgrade2::migrate_contracts_open", LOG_DEBUG); $resql = $db->query($sql); if (! $resql) dol_print_error($db); if ($db->affected_rows($resql) > 0) { @@ -1148,7 +1148,7 @@ function migrate_paiementfourn_facturefourn($db,$langs,$conf) $select_sql.= ' FROM '.MAIN_DB_PREFIX.'paiementfourn'; $select_sql.= ' WHERE fk_facture_fourn IS NOT NULL'; - dolibarr_install_syslog("upgrade2::migrate_paiementfourn_facturefourn sql=".$select_sql); + dolibarr_install_syslog("upgrade2::migrate_paiementfourn_facturefourn", LOG_DEBUG); $select_resql = $db->query($select_sql); if ($select_resql) { @@ -1264,7 +1264,7 @@ function migrate_price_facture($db,$langs,$conf) $sql.= " AND (((fd.total_ttc = 0 AND fd.remise_percent != 100) or fd.total_ttc IS NULL) or f.total_ttc IS NULL)"; //print $sql; - dolibarr_install_syslog("upgrade2::migrate_price_facture sql=".$sql); + dolibarr_install_syslog("upgrade2::migrate_price_facture", LOG_DEBUG); $resql=$db->query($sql); if ($resql) { @@ -1377,7 +1377,7 @@ function migrate_price_propal($db,$langs,$conf) $sql.= " WHERE pd.fk_propal = p.rowid"; $sql.= " AND ((pd.total_ttc = 0 AND pd.remise_percent != 100) or pd.total_ttc IS NULL)"; - dolibarr_install_syslog("upgrade2::migrate_price_propal sql=".$sql); + dolibarr_install_syslog("upgrade2::migrate_price_propal", LOG_DEBUG); $resql=$db->query($sql); if ($resql) { @@ -1412,7 +1412,7 @@ function migrate_price_propal($db,$langs,$conf) dolibarr_install_syslog("upgrade2: Line $rowid: propalid=$obj->rowid pu=$pu qty=$qty tva_taux=$txtva remise_percent=$remise_percent remise_global=$remise_percent_global -> $total_ht, $total_tva, $total_ttc"); print ". "; - $propalligne->update_total($rowid); + $propalligne->update_total(); /* On touche pas a propal mere @@ -1486,7 +1486,7 @@ function migrate_price_contrat($db,$langs,$conf) $sql.= " WHERE cd.fk_contrat = c.rowid"; $sql.= " AND ((cd.total_ttc = 0 AND cd.remise_percent != 100 AND cd.subprice > 0) or cd.total_ttc IS NULL)"; - dolibarr_install_syslog("upgrade2::migrate_price_contrat sql=".$sql); + dolibarr_install_syslog("upgrade2::migrate_price_contrat", LOG_DEBUG); $resql=$db->query($sql); if ($resql) { @@ -1521,7 +1521,7 @@ function migrate_price_contrat($db,$langs,$conf) dolibarr_install_syslog("upgrade2: Line $rowid: contratdetid=$obj->rowid pu=$pu qty=$qty tva_taux=$txtva remise_percent=$remise_percent -> $total_ht, $total_tva, $total_ttc"); print ". "; - $contratligne->update_total($rowid); + $contratligne->update_total(); $i++; } @@ -1571,7 +1571,7 @@ function migrate_price_commande($db,$langs,$conf) $sql.= " WHERE cd.fk_commande = c.rowid"; $sql.= " AND ((cd.total_ttc = 0 AND cd.remise_percent != 100) or cd.total_ttc IS NULL)"; - dolibarr_install_syslog("upgrade2::migrate_price_commande sql=".$sql); + dolibarr_install_syslog("upgrade2::migrate_price_commande", LOG_DEBUG); $resql=$db->query($sql); if ($resql) { @@ -1606,7 +1606,7 @@ function migrate_price_commande($db,$langs,$conf) dolibarr_install_syslog("upgrade2: Line $rowid: commandeid=$obj->rowid pu=$pu qty=$qty tva_taux=$txtva remise_percent=$remise_percent remise_global=$remise_percent_global -> $total_ht, $total_tva, $total_ttc"); print ". "; - $commandeligne->update_total($rowid); + $commandeligne->update_total(); /* On touche pas a facture mere $commande = new Commande($db); @@ -1685,7 +1685,7 @@ function migrate_price_commande_fournisseur($db,$langs,$conf) $sql.= " WHERE cd.fk_commande = c.rowid"; $sql.= " AND ((cd.total_ttc = 0 AND cd.remise_percent != 100) or cd.total_ttc IS NULL)"; - dolibarr_install_syslog("upgrade2::migrate_price_commande_fournisseur sql=".$sql); + dolibarr_install_syslog("upgrade2::migrate_price_commande_fournisseur", LOG_DEBUG); $resql=$db->query($sql); if ($resql) { @@ -1720,7 +1720,7 @@ function migrate_price_commande_fournisseur($db,$langs,$conf) dolibarr_install_syslog("upgrade2: Line $rowid: commandeid=$obj->rowid pu=$pu qty=$qty tva_taux=$txtva remise_percent=$remise_percent remise_global=$remise_percent_global -> $total_ht, $total_tva, $total_ttc"); print ". "; - $commandeligne->update_total($rowid); + $commandeligne->update_total(); /* On touche pas a facture mere $commande = new Commande($db); @@ -2406,7 +2406,7 @@ function migrate_restore_missing_links($db,$langs,$conf) $sql.= " (SELECT t2.rowid FROM ".MAIN_DB_PREFIX.$table2." as t2"; $sql.= " WHERE t1.rowid = t2.".$field2.")"; - dolibarr_install_syslog("upgrade2:migrate_restore_missing_links DIRECTION 1 sql=".$sql); + dolibarr_install_syslog("upgrade2:migrate_restore_missing_links DIRECTION 1", LOG_DEBUG); $resql = $db->query($sql); if ($resql) { @@ -2472,7 +2472,7 @@ function migrate_restore_missing_links($db,$langs,$conf) $sql.= " (SELECT t2.rowid FROM ".MAIN_DB_PREFIX.$table2." as t2"; $sql.= " WHERE t1.rowid = t2.".$field2.")"; - dolibarr_install_syslog("upgrade2:migrate_restore_missing_links DIRECTION 2 sql=".$sql); + dolibarr_install_syslog("upgrade2:migrate_restore_missing_links DIRECTION 2", LOG_DEBUG); $resql = $db->query($sql); if ($resql) { diff --git a/htdocs/langs/de_CH/companies.lang b/htdocs/langs/de_CH/companies.lang new file mode 100644 index 00000000000..26cd766b83e --- /dev/null +++ b/htdocs/langs/de_CH/companies.lang @@ -0,0 +1,11 @@ +# Dolibarr language file - Source file is en_US - companies +JuridicalStatus600=Einzelfirma +JuridicalStatus601=Einfache Gesellschaft +JuridicalStatus602=Kollektivgesellschaft +JuridicalStatus603=Kommanditgesellschaft +JuridicalStatus604=Aktiengesellschaft (AG) +JuridicalStatus605=Kommanditaktiengesellschaft +JuridicalStatus606=Gesellschaft mit beschränkter Haftung (GmbH) +JuridicalStatus607=Genossenschaft +JuridicalStatus608=Verein +JuridicalStatus609=Stiftung \ No newline at end of file diff --git a/htdocs/langs/de_CH/main.lang b/htdocs/langs/de_CH/main.lang new file mode 100644 index 00000000000..adbf494c99e --- /dev/null +++ b/htdocs/langs/de_CH/main.lang @@ -0,0 +1,20 @@ +# Dolibarr language file - Source file is en_US - main +DIRECTION=ltr +FONTFORPDF=helvetica +FONTSIZEFORPDF=10 +SeparatorDecimal=, +SeparatorThousand=None +FormatDateShort=%d/%m/%Y +FormatDateShortInput=%d/%m/%Y +FormatDateShortJava=dd/MM/yyyy +FormatDateShortJavaInput=dd/MM/yyyy +FormatDateShortJQuery=dd/MM/yy +FormatDateShortJQueryInput=dd/MM/yy +FormatHourShort=%H:%M +FormatHourShortDuration=%H:%M +FormatDateTextShort=%d %b %Y +FormatDateText=%d %B %Y +FormatDateHourShort=%d/%m/%Y %H:%M +FormatDateHourSecShort=%d/%m/%Y %H:%M:%S +FormatDateHourTextShort=%d %b %Y %H:%M +FormatDateHourText=%d %B %Y %H:%M \ No newline at end of file diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 6e67c9c8765..e4cf7ab08ce 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -47,7 +47,7 @@ DictionarySetup=Dictionary setup Dictionary=Dictionaries ErrorReservedTypeSystemSystemAuto=Value 'system' and 'systemauto' for type is reserved. You can use 'user' as value to add your own record ErrorCodeCantContainZero=Code can't contain value 0 -DisableJavascript=Disable JavaScript and Ajax functions +DisableJavascript=Disable JavaScript and Ajax functions (Recommended for blind person or text browsers) ConfirmAjax=Use Ajax confirmation popups UseSearchToSelectCompanyTooltip=Also if you have a large number of third parties (> 100 000), you can increase speed by setting constant COMPANY_DONOTSEARCH_ANYWHERE to 1 in Setup->Other. Search will then be limited to start of string. UseSearchToSelectCompany=Use autocompletion fields to choose third parties instead of using a list box. @@ -257,6 +257,9 @@ MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike=SMTP/SMTPS Host (Not defined into MAIN_MAIL_EMAIL_FROM=Sender e-mail for automatic emails (By default in php.ini: %s) MAIN_MAIL_ERRORS_TO=Sender e-mail used for error returns emails sent MAIN_MAIL_AUTOCOPY_TO= Send systematically a hidden carbon-copy of all sent emails to +MAIN_MAIL_AUTOCOPY_PROPOSAL_TO= Send systematically a hidden carbon-copy of proposals sent by email to +MAIN_MAIL_AUTOCOPY_ORDER_TO= Send systematically a hidden carbon-copy of orders sent by email to +MAIN_MAIL_AUTOCOPY_INVOICE_TO= Send systematically a hidden carbon-copy of invoice sent by emails to MAIN_DISABLE_ALL_MAILS=Disable all e-mails sendings (for test purposes or demos) MAIN_MAIL_SENDMODE=Method to use to send EMails MAIN_MAIL_SMTPS_ID=SMTP ID if authentication required @@ -296,7 +299,7 @@ CurrentVersion=Dolibarr current version CallUpdatePage=Go to the page that updates the database structure and datas: %s. LastStableVersion=Last stable version GenericMaskCodes=You may enter any numbering mask. In this mask, the following tags could be used:
{000000} corresponds to a number which will be incremented on each %s. Enter as many zeros as the desired length of the counter. The counter will be completed by zeros from the left in order to have as many zeros as the mask.
{000000+000} same as previous but an offset corresponding to the number to the right of the + sign is applied starting on first %s.
{000000@x} same as previous but the counter is reset to zero when month x is reached (x between 1 and 12, or 0 to use the early months of fiscal year defined in your configuration, or 99 to reset to zero every month). If this option is used and x is 2 or higher, then sequence {yy}{mm} or {yyyy}{mm} is also required.
{dd} day (01 to 31).
{mm} month (01 to 12).
{yy}, {yyyy} or {y} year over 2, 4 or 1 numbers.
-GenericMaskCodes2={cccc} the client code on n characters
{cccc000} the client code on n characters is followed by a counter dedicated for customer. This counter dedicated to customer is reset at same time than global counter.
{tttt} The code of company type on n characters (see dictionary-company types).
+GenericMaskCodes2={cccc} the client code on n characters
{cccc000} the client code on n characters is followed by a counter dedicated for customer. This counter dedicated to customer is reset at same time than global counter.
{tttt} The code of thirdparty type on n characters (see dictionary-thirdparty types).
GenericMaskCodes3=All other characters in the mask will remain intact.
Spaces are not allowed.
GenericMaskCodes4a=Example on the 99th %s of the third party TheCompany done 2007-01-31:
GenericMaskCodes4b=Example on third party created on 2007-03-01:
@@ -514,12 +517,16 @@ Module6000Name=Workflow Module6000Desc=Workflow management Module20000Name=Holidays Module20000Desc=Declare and follow employees holidays +Module39000Name=Product batch +Module39000Desc=Batch number, eat-by and sell-by date management on products Module50000Name=PayBox Module50000Desc=Module to offer an online payment page by credit card with PayBox Module50100Name=Point of sales Module50100Desc=Point of sales module Module50200Name= Paypal Module50200Desc= Module to offer an online payment page by credit card with Paypal +Module50400Name=Accounting (advanced) +Module50400Desc=Accounting management (double parties) Module54000Name=PrintIPP Module54000Desc=Print via Cups IPP Printer. Module55000Name=Open Poll @@ -785,6 +792,7 @@ VATIsNotUsedDesc=By default the proposed VAT is 0 which can be used for cases li VATIsUsedExampleFR=In France, it means companies or organisations having a real fiscal system (Simplified real or normal real). A system in which VAT is declared. VATIsNotUsedExampleFR=In France, it means associations that are non VAT declared or companies, organisations or liberal professions that have chosen the micro enterprise fiscal system (VAT in franchise) and paid a franchise VAT without any VAT declaration. This choice will display the reference "Non applicable VAT - art-293B of CGI" on invoices. ##### Local Taxes ##### +LTRate=Rate LocalTax1IsUsed=Use second tax LocalTax1IsNotUsed=Do not use second tax LocalTax1IsUsedDesc=Use a second type of tax (other than VAT) @@ -809,6 +817,13 @@ LocalTax2IsUsedDescES= The RE rate by default when creating prospects, invoices, LocalTax2IsNotUsedDescES= By default the proposed IRPF is 0. End of rule. LocalTax2IsUsedExampleES= In Spain, freelancers and independent professionals who provide services and companies who have chosen the tax system of modules. LocalTax2IsNotUsedExampleES= In Spain they are bussines not subject to tax system of modules. +CalcLocaltax=Reports +CalcLocaltax1ES=Sales - Purchases +CalcLocaltax1Desc=Local Taxes reports are calculated with the difference between localtaxes sales and localtaxes purchases +CalcLocaltax2ES=Purchases +CalcLocaltax2Desc=Local Taxes reports are the total of localtaxes purchases +CalcLocaltax3ES=Sales +CalcLocaltax3Desc=Local Taxes reports are the total of localtaxes sales LabelUsedByDefault=Label used by default if no translation can be found for code LabelOnDocuments=Label on documents NbOfDays=Nb of days @@ -920,11 +935,14 @@ EventsSetup=Setup for events logs LogEvents=Security audit events Audit=Audit InfoDolibarr=Infos Dolibarr +InfoBrowser=Infos Browser InfoOS=Infos OS InfoWebServer=Infos web server InfoDatabase=Infos database InfoPHP=Infos PHP InfoPerf=Infos performances +BrowserName=Browser name +BrowserOS=Browser OS ListEvents=Audit events ListOfSecurityEvents=List of Dolibarr security events SecurityEventsPurged=Security events purged @@ -1455,6 +1473,9 @@ AgendaSetup=Events and agenda module setup PasswordTogetVCalExport=Key to authorize export link PastDelayVCalExport=Do not export event older than AGENDA_USE_EVENT_TYPE=Use events types (managed into menu Setup -> Dictionary -> Type of agenda events) +AGENDA_DEFAULT_FILTER_TYPE=Set automatically this type of event into search filter of agenda view +AGENDA_DEFAULT_FILTER_STATUS=Set automatically this status for events into search filter of agenda view +AGENDA_DEFAULT_VIEW=Which tab do you want to open by default when selecting menu Agenda ##### ClickToDial ##### ClickToDialDesc=This module allows to add an icon after phone numbers. A click on this icon will call a server with a particular URL you define below. This can be used to call a call center system from Dolibarr that can call the phone number on a SIP system for example. ##### Point Of Sales (CashDesk) ##### @@ -1504,7 +1525,18 @@ TasksNumberingModules=Tasks numbering module TaskModelModule=Tasks reports document model ##### ECM (GED) ##### ECMSetup = GED Setup -ECMAutoTree = Automatic tree folder and document - +ECMAutoTree = Automatic tree folder and document +##### Fiscal Year ##### +FiscalYears=Fiscal years +FiscalYear=Fiscal year +FiscalYearCard=Fiscal year card +NewFiscalYear=New fiscal year +EditFiscalYear=Edit fiscal year +OpenFiscalYear=Open fiscal year +CloseFiscalYear=Close fiscal year +DeleteFiscalYear=Delete fiscal year +ConfirmDeleteFiscalYear=Are you sure to delete this fiscal year ? +Opened=Opened +Closed=Closed Format=Format diff --git a/htdocs/langs/en_US/agenda.lang b/htdocs/langs/en_US/agenda.lang index 687e3cae146..d18276c362e 100644 --- a/htdocs/langs/en_US/agenda.lang +++ b/htdocs/langs/en_US/agenda.lang @@ -25,12 +25,15 @@ ListOfEvents= List of Dolibarr events ActionsAskedBy=Events reported by ActionsToDoBy=Events assigned to ActionsDoneBy=Events done by +ActionsForUser=Events for user +ActionsForUsersGroup=Events for all users of group AllMyActions= All my events/tasks AllActions= All events/tasks ViewList=List view ViewCal=Month view ViewDay=Day view ViewWeek=Week view +ViewPerUser=Per user ViewWithPredefinedFilters= View with predefined filters AutoActions= Automatic filling AgendaAutoActionDesc= Define here events for which you want Dolibarr to create automatically an event in agenda. If nothing is checked (by default), only manual actions will be included in agenda. @@ -55,6 +58,7 @@ SupplierInvoiceSentByEMail=Supplier invoice %s sent by EMail ShippingSentByEMail=Shipping %s sent by EMail ShippingValidated= Shipping %s validated InterventionSentByEMail=Intervention %s sent by EMail +InterventionClassifiedBilled=Intervention %s classified as Billed NewCompanyToDolibarr= Third party created DateActionPlannedStart= Planned start date DateActionPlannedEnd= Planned end date @@ -71,7 +75,8 @@ AgendaShowBirthdayEvents=Show birthday's contacts AgendaHideBirthdayEvents=Hide birthday's contacts Busy=Busy ExportDataset_event1=List of agenda events - +DefaultWorkingDays=Default working days range in week (Example: 1-5, 1-6) +DefaultWorkingHours=Default working hours in day (Example: 9-18) # External Sites ical ExportCal=Export calendar ExtSites=Import external calendars diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index 9f8353acfda..5490d496221 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -197,8 +197,8 @@ Rest=Pending AmountExpected=Amount claimed ExcessReceived=Excess received EscompteOffered=Discount offered (payment before term) -SendBillRef=Send invoice %s -SendReminderBillRef=Send invoice %s (reminder) +SendBillRef=Submission of invoice %s +SendReminderBillRef=Submission of invoice %s (reminder) StandingOrders=Standing orders StandingOrder=Standing order NoDraftBills=No draft invoices @@ -295,6 +295,8 @@ TotalOfTwoDiscountMustEqualsOriginal=Total of two new discount must be equal to ConfirmRemoveDiscount=Are you sure you want to remove this discount ? RelatedBill=Related invoice RelatedBills=Related invoices +LatestRelatedBill=Latest related invoice +WarningBillExist=Warning, one or more invoice already exist # PaymentConditions PaymentConditionShortRECEP=Immediate diff --git a/htdocs/langs/en_US/commercial.lang b/htdocs/langs/en_US/commercial.lang index 3f2f5a6a96a..73c399eb604 100644 --- a/htdocs/langs/en_US/commercial.lang +++ b/htdocs/langs/en_US/commercial.lang @@ -44,8 +44,8 @@ DoneActions=Completed events DoneActionsFor=Completed events for %s ToDoActions=Incomplete events ToDoActionsFor=Incomplete events for %s -SendPropalRef=Send commercial proposal %s -SendOrderRef=Send order %s +SendPropalRef=Submission of commercial proposal %s +SendOrderRef=Submission of order %s StatusNotApplicable=Not applicable StatusActionToDo=To do StatusActionDone=Complete @@ -71,6 +71,7 @@ ActionAC_FAX=Send fax ActionAC_PROP=Send proposal by mail ActionAC_EMAIL=Send Email ActionAC_RDV=Meetings +ActionAC_INT=Intervention on site ActionAC_FAC=Send customer invoice by mail ActionAC_REL=Send customer invoice by mail (reminder) ActionAC_CLO=Close diff --git a/htdocs/langs/en_US/companies.lang b/htdocs/langs/en_US/companies.lang index 000d7496afc..1b2ea17215b 100644 --- a/htdocs/langs/en_US/companies.lang +++ b/htdocs/langs/en_US/companies.lang @@ -91,6 +91,9 @@ LocalTax2IsUsedES= IRPF is used LocalTax2IsNotUsedES= IRPF is not used LocalTax1ES=RE LocalTax2ES=IRPF +TypeLocaltax1ES=RE Type +TypeLocaltax2ES=IRPF Type +TypeES=Type ThirdPartyEMail=%s WrongCustomerCode=Customer code invalid WrongSupplierCode=Supplier code invalid diff --git a/htdocs/langs/en_US/compta.lang b/htdocs/langs/en_US/compta.lang index 281ee374343..363f1f17395 100644 --- a/htdocs/langs/en_US/compta.lang +++ b/htdocs/langs/en_US/compta.lang @@ -4,6 +4,7 @@ AccountancyCard=Accountancy card Treasury=Treasury MenuFinancial=Financial TaxModuleSetupToModifyRules=Go to
Taxes module setup to modify rules for calculation +TaxModuleSetupToModifyRulesLT=Go to Company setup to modify rules for calculation OptionMode=Option for accountancy OptionModeTrue=Option Incomes-Expenses OptionModeVirtual=Option Claims-Debts @@ -11,6 +12,7 @@ OptionModeTrueDesc=In this context, the turnover is calculated over payments (da OptionModeVirtualDesc=In this context, the turnover is calculated over invoices (date of validation). When these invoices are due, whether they have been paid or not, they are listed in the turnover output. FeatureIsSupportedInInOutModeOnly=Feature only available in CREDITS-DEBTS accountancy mode (See Accountancy module configuration) VATReportBuildWithOptionDefinedInModule=Amounts shown here are calculated using rules defined by Tax module setup. +LTReportBuildWithOptionDefinedInModule=Amounts shown here are calculated using rules defined by Company setup. Param=Setup RemainingAmountPayment=Amount payment remaining : AmountToBeCharged=Total amount to pay : @@ -40,11 +42,15 @@ VATReceived=VAT received VATToCollect=VAT purchases VATSummary=VAT Balance LT2SummaryES=IRPF Balance +LT1SummaryES=RE Balance VATPaid=VAT paid SalaryPaid=Salary paid LT2PaidES=IRPF Paid +LT1PaidES=RE Paid LT2CustomerES=IRPF sales LT2SupplierES=IRPF purchases +LT1CustomerES=RE sales +LT1SupplierES=RE purchases VATCollected=VAT collected ToPay=To pay ToGet=To get back @@ -77,8 +83,11 @@ DateStartPeriod=Date start period DateEndPeriod=Date end period NewVATPayment=New VAT payment newLT2PaymentES=New IRPF payment +newLT1PaymentES=New RE payment LT2PaymentES=IRPF Payment LT2PaymentsES=IRPF Payments +LT1PaymentES=RE Payment +LT1PaymentsES=RE Payments VATPayment=VAT Payment VATPayments=VAT Payments SocialContributionsPayments=Social contributions payments @@ -114,6 +123,12 @@ CalcModeVATDebt=Mode %sVAT on commitment accounting%s. CalcModeVATEngagement=Mode %sVAT on incomes-expenses%s. CalcModeDebt=Mode %sClaims-Debts%s said Commitment accounting. CalcModeEngagement=Mode %sIncomes-Expenses%s said cash accounting +CalcModeLT1= Mode %sRE on customer invoices - suppliers invoices%s +CalcModeLT1Debt=Mode %sRE on customer invoices%s +CalcModeLT1Rec= Mode %sRE on suppliers invoices%s +CalcModeLT2= Mode %sIRPF on customer invoices - suppliers invoices%s +CalcModeLT2Debt=Mode %sIRPF on customer invoices%s +CalcModeLT2Rec= Mode %sIRPF on suppliers invoices%s AnnualSummaryDueDebtMode=Balance of income and expenses, annual summary AnnualSummaryInputOutputMode=Balance of income and expenses, annual summary AnnualByCompaniesDueDebtMode=Balance of income and expenses, detail by third parties, mode %sClaims-Debts%s said Commitment accounting. @@ -128,10 +143,15 @@ RulesCAIn=- It includes all the effective payments of invoices received from cli DepositsAreNotIncluded=- Deposit invoices are nor included DepositsAreIncluded=- Deposit invoices are included LT2ReportByCustomersInInputOutputModeES=Report by third party IRPF +LT1ReportByCustomersInInputOutputModeES=Report by third party RE VATReportByCustomersInInputOutputMode=Report by the customer VAT collected and paid VATReportByCustomersInDueDebtMode=Report by the customer VAT collected and paid VATReportByQuartersInInputOutputMode=Report by rate of the VAT collected and paid +LT1ReportByQuartersInInputOutputMode=Report by RE rate +LT2ReportByQuartersInInputOutputMode=Report by IRPF rate VATReportByQuartersInDueDebtMode=Report by rate of the VAT collected and paid +LT1ReportByQuartersInDueDebtMode=Report by RE rate +LT2ReportByQuartersInDueDebtMode=Report by IRPF rate SeeVATReportInInputOutputMode=See report %sVAT encasement%s for a standard calculation SeeVATReportInDueDebtMode=See report %sVAT on flow%s for a calculation with an option on the flow RulesVATInServices=- For services, the report includes the VAT regulations actually received or issued on the basis of the date of payment. @@ -175,6 +195,7 @@ CalculationRuleDesc=To calculate total VAT, there is two methods:
Method 1 is CalculationRuleDescSupplier=according to supplier, choose appropriate method to apply same calculation rule and get same result expected by your supplier. TurnoverPerProductInCommitmentAccountingNotRelevant=Turnover report per product, when using a cash accountancy mode is not relevant. This report is only available when using engagement accountancy mode (see setup of accountancy module). CalculationMode=Calculation mode +AccountancyJournal=Accountancy code journal COMPTA_PRODUCT_BUY_ACCOUNT=Default accountancy code to buy products COMPTA_PRODUCT_SOLD_ACCOUNT=Default accountancy code to sell products COMPTA_SERVICE_BUY_ACCOUNT=Default accountancy code to buy services diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index b874ef58f07..89404614db5 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -136,6 +136,8 @@ ErrorBadFormat=Bad format! ErrorPaymentDateLowerThanInvoiceDate=Payment date (%s) cant' be before invoice date (%s) for invoice %s. ErrorMemberNotLinkedToAThirpartyLinkOrCreateFirst=Error, this member is not yet linked to any thirdparty. Link member to an existing third party or create a new thirdparty before creating subscription with invoice. ErrorThereIsSomeDeliveries=Error, there is some deliveries linked to this shipment. Deletion refused. +ErrorCantDeletePaymentReconciliated=Can't delete a payment that had generated a bank transaction that was conciliated +ErrorCantDeletePaymentSharedWithPayedInvoice=Can't delete a payment shared by at least one invoice with status Payed # Warnings WarningMandatorySetupNotComplete=Mandatory setup parameters are not yet defined diff --git a/htdocs/langs/en_US/interventions.lang b/htdocs/langs/en_US/interventions.lang index 58579a74276..266ce059d8b 100644 --- a/htdocs/langs/en_US/interventions.lang +++ b/htdocs/langs/en_US/interventions.lang @@ -25,9 +25,11 @@ NameAndSignatureOfExternalContact=Name and signature of customer : DocumentModelStandard=Standard document model for interventions InterventionCardsAndInterventionLines=Interventions and lines of interventions ClassifyBilled=Classify "Billed" +ClassifyUnBilled=Classify "Unbilled" StatusInterInvoiced=Billed RelatedInterventions=Related interventions ShowIntervention=Show intervention +SendInterventionRef=Submission of intervention %s ##### Types de contacts ##### TypeContact_fichinter_internal_INTERREPFOLL=Representative following-up intervention TypeContact_fichinter_internal_INTERVENING=Intervening diff --git a/htdocs/langs/en_US/languages.lang b/htdocs/langs/en_US/languages.lang index e94e8e13ac3..1116e29c21c 100644 --- a/htdocs/langs/en_US/languages.lang +++ b/htdocs/langs/en_US/languages.lang @@ -10,6 +10,7 @@ Language_da_DA=Danish Language_da_DK=Danish Language_de_DE=German Language_de_AT=German (Austria) +Language_de_CH=German (Switzerland) Language_el_GR=Greek Language_en_AU=English (Australia) Language_en_GB=English (United Kingdom) diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 9b8f06f262e..8540b665b55 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -356,6 +356,7 @@ ActionNotApplicable=Not applicable ActionRunningNotStarted=To start ActionRunningShort=Started ActionDoneShort=Finished +ActionUncomplete=Uncomplete CompanyFoundation=Company/Foundation ContactsForCompany=Contacts for this third party ContactsAddressesForCompany=Contacts/addresses for this third party @@ -671,6 +672,8 @@ HelpCopyToClipboard=Use Ctrl+C to copy to clipboard SaveUploadedFileWithMask=Save file on server with name "%s" (otherwise "%s") OriginFileName=Original filename SetDemandReason=Set source +SetBankAccount=Define Bank Account +AccountCurrency=Account Currency ViewPrivateNote=View notes XMoreLines=%s line(s) hidden PublicUrl=Public URL diff --git a/htdocs/langs/en_US/other.lang b/htdocs/langs/en_US/other.lang index 6a8fdd730c9..6758b2b482e 100644 --- a/htdocs/langs/en_US/other.lang +++ b/htdocs/langs/en_US/other.lang @@ -80,6 +80,16 @@ ModifiedBy=Modified by %s ValidatedBy=Validated by %s CanceledBy=Canceled by %s ClosedBy=Closed by %s +CreatedById=User id who created +ModifiedById=User id who made last change +ValidatedById=User id who validated +CanceledById=User id who canceled +ClosedById=User id who closed +CreatedByLogin=User login who created +ModifiedByLogin=User login who made last change +ValidatedByLogin=User login who validated +CanceledByLogin=User login who canceled +ClosedByLogin=User login who closed FileWasRemoved=File %s was removed DirWasRemoved=Directory %s was removed FeatureNotYetAvailableShort=Available in a next version diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang index a37e9651bcc..55970f0b35c 100644 --- a/htdocs/langs/en_US/projects.lang +++ b/htdocs/langs/en_US/projects.lang @@ -125,3 +125,6 @@ DocumentModelBaleine=A complete project's report model (logo...) PlannedWorkload = Planned workload WorkloadOccupation= Workload affectation ProjectReferers=Refering objects +SearchAProject=Search a project +ProjectMustBeValidatedFirst=Project must be validated first +ProjectDraft=Draft projects diff --git a/htdocs/langs/en_US/sendings.lang b/htdocs/langs/en_US/sendings.lang index 039d47f6aa9..170f5984c4d 100644 --- a/htdocs/langs/en_US/sendings.lang +++ b/htdocs/langs/en_US/sendings.lang @@ -54,7 +54,7 @@ StatsOnShipmentsOnlyValidated=Statistics conducted on shipments only validated. DateDeliveryPlanned=Planed date of delivery DateReceived=Date delivery received SendShippingByEMail=Send shipment by EMail -SendShippingRef=Send shipment %s +SendShippingRef=Submission of shipment %s ActionsOnShipping=Events on shipment LinkToTrackYourPackage=Link to track your package ShipmentCreationIsDoneFromOrder=For the moment, creation of a new shipment is done from the order card. diff --git a/htdocs/langs/en_US/users.lang b/htdocs/langs/en_US/users.lang index a9d789b8c31..972b8534213 100644 --- a/htdocs/langs/en_US/users.lang +++ b/htdocs/langs/en_US/users.lang @@ -114,7 +114,7 @@ YourRole=Your roles YourQuotaOfUsersIsReached=Your quota of active users is reached ! NbOfUsers=Nb of users DontDowngradeSuperAdmin=Only a superadmin can downgrade a superadmin -HierarchicalResponsible=Hierarchical responsible +HierarchicalResponsible=Supervisor HierarchicView=Hierarchical view UseTypeFieldToChange=Use field Type to change OpenIDURL=OpenID URL diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index 1624a8222bd..289b8401dbe 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -81,6 +81,8 @@ MustBeLowerThanPHPLimit=Remarque : Votre PHP limite la taille des envois à NoMaxSizeByPHPLimit=Aucune limite configurée dans votre serveur PHP MaxSizeForUploadedFiles=Taille maximum des fichiers envoyés (0 pour interdire l'envoi) UseCaptchaCode=Utilisation du code graphique (CAPTCHA) sur la page de connexion +HiddeNumVersion=Modifier titre du site +HiddeNumVersionExample=Remplace titre du site, si laisser vide cela affiche la valeur par defaut ( Dolibarr X.X.X ) UseAvToScanUploadedFiles=Utiliser un antivirus pour vérifier les fichiers envoyés AntiVirusCommand= Chemin complet vers la commande antivirus AntiVirusCommandExample= Exemple pour ClamWin : c:\\Progra~1\\ClamWin\\bin\\clamscan.exe
Exemple pour ClamAv : /usr/bin/clamscan @@ -1075,6 +1077,7 @@ NotificationsDesc=La fonction des notifications par emails permet d'envoyer auto ModelModules=Modèle de documents DocumentModelOdt=Génération depuis des modèles OpenDocument (Fichier .ODT ou .ODS OpenOffice, KOffice, TextEdit…) WatermarkOnDraft=Filigrane sur les documents brouillons +JSOnPaimentBill=Ajout surcouche js CompanyIdProfChecker=Règles sur les Identifiants professionnels MustBeUnique=Doit être unique ? MustBeMandatory=Obligatoire pour creer tiers ? diff --git a/htdocs/langs/fr_FR/bills.lang b/htdocs/langs/fr_FR/bills.lang index c4bf33c56cc..aaea4122b22 100644 --- a/htdocs/langs/fr_FR/bills.lang +++ b/htdocs/langs/fr_FR/bills.lang @@ -295,6 +295,8 @@ TotalOfTwoDiscountMustEqualsOriginal=La somme du montant des 2 nouvelles réduct ConfirmRemoveDiscount=Êtes-vous sûr de vouloir supprimer cette réduction ? RelatedBill=Facture associée RelatedBills=Factures associées +LatestRelatedBill=Dernière facture associée +WarningBillExist=Attention, il existe déjà une ou plusieurs factures # PaymentConditions PaymentConditionShortRECEP=A réception diff --git a/htdocs/langs/fr_FR/donations.lang b/htdocs/langs/fr_FR/donations.lang index f8a71165842..9af7a87a12d 100644 --- a/htdocs/langs/fr_FR/donations.lang +++ b/htdocs/langs/fr_FR/donations.lang @@ -1,7 +1,7 @@ # Dolibarr language file - Source file is en_US - donations Donation=Don Donations=Dons -DonationRef=Réf. donation +DonationRef=Numéro d'ordre du reçu Donor=Donateur Donors=Donateurs AddDonation=Ajouter don @@ -22,11 +22,19 @@ DonationStatusPromiseNotValidatedShort=Non validée DonationStatusPromiseValidatedShort=Validée DonationStatusPaidShort=Payé ValidPromess=Valider promesse -DonationReceipt=Reçu de dons +DonationTitle=Reçu au titre des dons +DonationReceipt=Reçu au titre des dons
à certains organismes d'intéret général +DonationDatePayment=Date de versement ou du don BuildDonationReceipt=Créer reçu DonationsModels=Modèles de documents de bon de réception de dons LastModifiedDonations=Les %s derniers dons modifiés SearchADonation=Rechercher un don DonationRecipient=Bénéficiaire des versements ThankYou=Merci -IConfirmDonationReception=Le bénéficiaire reconnait avoir reçu au titre des versements ouvrant droit à réduction d'impôt, la somme de +FreeTextOnDonations=Message affiché sur le récépissé de versements ou dons +IConfirmDonationReception=Le bénéficiaire reconnait avoir reçu au titre des dons et versements ouvrant droit à réduction d'impôt, la somme de +# French Options +FrenchOptions=Options éligibles en France +DONATION_ART200=Les dons ou versements reçus sont éligibles à l'article 200 du CGI +DONATION_ART238=Les dons ou versements reçus sont éligibles à l'article 238bis du CGI +DONATION_ART885=Les dons ou versements reçus sont éligibles à l'article 885-0 V bis A du CGI \ No newline at end of file diff --git a/htdocs/livraison/class/index.html b/htdocs/livraison/class/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/livraison/class/livraison.class.php b/htdocs/livraison/class/livraison.class.php index 58ad4f1bc0d..7db42b6ac44 100644 --- a/htdocs/livraison/class/livraison.class.php +++ b/htdocs/livraison/class/livraison.class.php @@ -128,7 +128,7 @@ class Livraison extends CommonObject $sql.= ", ".(!empty($this->model_pdf)?"'".$this->db->escape($this->model_pdf)."'":"null"); $sql.= ")"; - dol_syslog("Livraison::create sql=".$sql, LOG_DEBUG); + dol_syslog("Livraison::create", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -140,7 +140,7 @@ class Livraison extends CommonObject $sql.= "SET ref = '".$this->db->escape($numref)."'"; $sql.= " WHERE rowid = ".$this->id; - dol_syslog("Livraison::create sql=".$sql, LOG_DEBUG); + dol_syslog("Livraison::create", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -195,7 +195,6 @@ class Livraison extends CommonObject { $error++; $this->error=$this->db->lasterror()." - sql=".$this->db->lastqueryerror; - dol_syslog("Livraison::create Error -3 ".$this->error, LOG_ERR); $this->db->rollback(); return -3; } @@ -204,7 +203,6 @@ class Livraison extends CommonObject { $error++; $this->error=$this->db->lasterror()." - sql=".$this->db->lastqueryerror; - dol_syslog("Livraison::create Error -2 ".$this->error, LOG_ERR); $this->db->rollback(); return -2; } @@ -213,7 +211,6 @@ class Livraison extends CommonObject { $error++; $this->error=$this->db->lasterror()." - sql=".$this->db->lastqueryerror; - dol_syslog("Livraison::create Error -1 ".$this->error, LOG_ERR); $this->db->rollback(); return -1; } @@ -241,7 +238,7 @@ class Livraison extends CommonObject $sql.= " ".($description?"'".$this->db->escape($description)."'":"null").","; $sql.= $qty.")"; - dol_syslog(get_class($this)."::create_line sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::create_line", LOG_DEBUG); if (! $this->db->query($sql) ) { $error++; @@ -271,7 +268,7 @@ class Livraison extends CommonObject $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON el.fk_target = l.rowid AND el.targettype = '".$this->element."'"; $sql.= " WHERE l.rowid = ".$id; - dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { @@ -321,7 +318,6 @@ class Livraison extends CommonObject } else { - dol_syslog(get_class($this).'::fetch Error '.$this->error, LOG_ERR); $this->error=$this->db->error(); return -1; } @@ -438,7 +434,6 @@ class Livraison extends CommonObject { $this->db->rollback(); $this->error=$this->db->error()." - sql=$sql"; - dol_syslog(get_class($this)."::valid ".$this->error, LOG_ERR); return -1; } } @@ -451,15 +446,12 @@ class Livraison extends CommonObject return -1; } - // Appel des triggers - include_once DOL_DOCUMENT_ROOT.'/core/class/interfaces.class.php'; - $interface = new Interfaces($this->db); - $result = $interface->run_triggers('DELIVERY_VALIDATE', $this, $user, $langs, $conf); - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('DELIVERY_VALIDATE',$user); + // End call triggers if ($result < 0) { $this->db->rollback(); - $this->error = $interface->errors; dol_syslog(get_class($this)."::valid ".$this->error, LOG_ERR); return -1; } @@ -609,14 +601,14 @@ class Livraison extends CommonObject } } - // Call triggers - include_once DOL_DOCUMENT_ROOT.'/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('DELIVERY_DELETE',$this,$user,$langs,$conf); - if ($result < 0) { - $error++; $this->errors=$interface->errors; - } - // End call triggers + // Call trigger + $result=$this->call_trigger('DELIVERY_DELETE',$user); + if ($result < 0) + { + $this->db->rollback(); + return -4; + } + // End call triggers return 1; } @@ -677,7 +669,7 @@ class Livraison extends CommonObject { $this->lines = array(); - $sql = "SELECT ld.rowid, ld.fk_product, ld.description, ld.subprice, ld.total_ht, ld.qty as qty_shipped,"; + $sql = "SELECT ld.rowid, ld.fk_product, ld.description, ld.subprice, ld.total_ht, ld.qty as qty_shipped, ld.fk_origin_line, "; $sql.= " cd.qty as qty_asked, cd.label as custom_label,"; $sql.= " p.ref as product_ref, p.fk_product_type as fk_product_type, p.label as product_label, p.description as product_desc"; $sql.= " FROM ".MAIN_DB_PREFIX."commandedet as cd, ".MAIN_DB_PREFIX."livraisondet as ld"; @@ -685,7 +677,7 @@ class Livraison extends CommonObject $sql.= " WHERE ld.fk_origin_line = cd.rowid"; $sql.= " AND ld.fk_livraison = ".$this->id; - dol_syslog(get_class($this)."::fetch_lines sql=".$sql); + dol_syslog(get_class($this)."::fetch_lines", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -709,6 +701,7 @@ class Livraison extends CommonObject $line->product_ref = $obj->product_ref; // Product ref $line->product_desc = $obj->product_desc; // Product description $line->product_type = $obj->fk_product_type; + $line->fk_origin_line = $obj->fk_origin_line; $line->price = $obj->price; $line->total_ht = $obj->total_ht; @@ -895,7 +888,6 @@ class Livraison extends CommonObject else { $this->error=$this->db->error()." - sql=$sqlSourceLine"; - dol_syslog(get_class($this)."::getRemainingDelivered ".$this->error, LOG_ERR); return -1; } } @@ -915,7 +907,7 @@ class Livraison extends CommonObject $sql.= " SET date_delivery = ".($date_livraison ? "'".$this->db->idate($date_livraison)."'" : 'null'); $sql.= " WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::set_date_livraison sql=".$sql,LOG_DEBUG); + dol_syslog(get_class($this)."::set_date_livraison", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -925,7 +917,6 @@ class Livraison extends CommonObject else { $this->error=$this->db->error(); - dol_syslog(get_class($this)."::set_date_livraison ".$this->error,LOG_ERR); return -1; } } @@ -968,5 +959,3 @@ class LivraisonLigne } } - -?> diff --git a/htdocs/livraison/index.html b/htdocs/livraison/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/livraison/index.php b/htdocs/livraison/index.php deleted file mode 100644 index 7db0dd9ebf9..00000000000 --- a/htdocs/livraison/index.php +++ /dev/null @@ -1 +0,0 @@ -Url not available \ No newline at end of file diff --git a/htdocs/mailmanspip/class/index.html b/htdocs/mailmanspip/class/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/mailmanspip/class/mailmanspip.class.php b/htdocs/mailmanspip/class/mailmanspip.class.php index d4db8deb01c..6e772b09c03 100644 --- a/htdocs/mailmanspip/class/mailmanspip.class.php +++ b/htdocs/mailmanspip/class/mailmanspip.class.php @@ -112,7 +112,7 @@ class MailmanSpip /** * Function used to connect to Mailman * - * @param object $object Object with the data + * @param Adherent $object Object with the data * @param string $url Mailman URL to be called with patterns * @param string $list Name of mailing-list * @return mixed Boolean or string @@ -146,6 +146,7 @@ class MailmanSpip curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, empty($conf->global->MAIN_USE_CONNECT_TIMEOUT)?5:$conf->global->MAIN_USE_CONNECT_TIMEOUT); curl_setopt($ch, CURLOPT_TIMEOUT, empty($conf->global->MAIN_USE_RESPONSE_TIMEOUT)?30:$conf->global->MAIN_USE_RESPONSE_TIMEOUT); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); + curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); $result = curl_exec($ch); dol_syslog('result curl_exec='.$result); diff --git a/htdocs/mailmanspip/index.html b/htdocs/mailmanspip/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 30837b590f8..dea52ae6ef9 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -166,7 +166,6 @@ require_once 'filefunc.inc.php'; // If there is a POST parameter to tell to save automatically some POST parameters into a cookies, we do it if (! empty($_POST["DOL_AUTOSET_COOKIE"])) { - require_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php'; $tmpautoset=explode(':',$_POST["DOL_AUTOSET_COOKIE"],2); $tmplist=explode(',',$tmpautoset[1]); $cookiearrayvalue=''; @@ -177,7 +176,7 @@ if (! empty($_POST["DOL_AUTOSET_COOKIE"])) if (! empty($_POST[$postkey])) $cookiearrayvalue[$tmpkey]=$_POST[$postkey]; } $cookiename=$tmpautoset[0]; - $cookievalue=dol_json_encode($cookiearrayvalue); + $cookievalue=json_encode($cookiearrayvalue); //var_dump('setcookie cookiename='.$cookiename.' cookievalue='.$cookievalue); setcookie($cookiename, empty($cookievalue)?'':$cookievalue, empty($cookievalue)?0:(time()+(86400*354)), '/'); // keep cookie 1 year if (empty($cookievalue)) unset($_COOKIE[$cookiename]); @@ -209,11 +208,12 @@ register_shutdown_function('dol_shutdown'); if (isset($_SERVER["HTTP_USER_AGENT"])) { $tmp=getBrowserInfo(); - $conf->browser->phone=$tmp['phone']; $conf->browser->name=$tmp['browsername']; $conf->browser->os=$tmp['browseros']; - $conf->browser->firefox=$tmp['browserfirefox']; $conf->browser->version=$tmp['browserversion']; + $conf->browser->layout=$tmp['layout']; + $conf->browser->phone=$tmp['phone']; // deprecated, use layout + $conf->browser->tablet=$tmp['tablet']; // deprecated, use layout } @@ -411,7 +411,7 @@ if (! defined('NOLOGIN')) // Call of triggers include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; $interface=new Interfaces($db); - $result=$interface->run_triggers('USER_LOGIN_FAILED',$user,$user,$langs,$conf,GETPOST('entity','int')); + $result=$interface->run_triggers('USER_LOGIN_FAILED',$user,$user,$langs,$conf); if ($result < 0) { $error++; } @@ -514,10 +514,11 @@ if (! defined('NOLOGIN')) $_SESSION["dol_loginmesg"]=$user->error; } + // TODO We should use a hook here, not a trigger. // Call triggers include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; $interface=new Interfaces($db); - $result=$interface->run_triggers('USER_LOGIN_FAILED',$user,$user,$langs,$conf,$_POST["entity"]); + $result=$interface->run_triggers('USER_LOGIN_FAILED',$user,$user,$langs,$conf); if ($result < 0) { $error++; } @@ -556,10 +557,11 @@ if (! defined('NOLOGIN')) $_SESSION["dol_loginmesg"]=$user->error; } + // TODO We should use a hook here, not a trigger. // Call triggers include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; $interface=new Interfaces($db); - $result=$interface->run_triggers('USER_LOGIN_FAILED',$user,$user,$langs,$conf,(isset($_POST["entity"])?$_POST["entity"]:0)); + $result=$interface->run_triggers('USER_LOGIN_FAILED',$user,$user,$langs,$conf); if ($result < 0) { $error++; } @@ -572,10 +574,11 @@ if (! defined('NOLOGIN')) { if (! empty($conf->global->MAIN_ACTIVATE_UPDATESESSIONTRIGGER)) // We do not execute such trigger at each page load by default (triggers are time consuming) { + // TODO We should use a hook here, not a trigger. // Call triggers include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; $interface=new Interfaces($db); - $result=$interface->run_triggers('USER_UPDATE_SESSION',$user,$user,$langs,$conf,$conf->entity); + $result=$interface->run_triggers('USER_UPDATE_SESSION',$user,$user,$langs,$conf); if ($result < 0) { $error++; } @@ -588,7 +591,7 @@ if (! defined('NOLOGIN')) // If we are here, this means authentication was successfull. if (! isset($_SESSION["dol_login"])) { - // New session for this login. + // New session for this login has started. $error=0; // Store value into session (values always stored) @@ -617,10 +620,11 @@ if (! defined('NOLOGIN')) $user->update_last_login_date(); + // TODO We should use a hook here, not a trigger // Call triggers include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; $interface=new Interfaces($db); - $result=$interface->run_triggers('USER_LOGIN',$user,$user,$langs,$conf,GETPOST('entity','int')); + $result=$interface->run_triggers('USER_LOGIN',$user,$user,$langs,$conf); if ($result < 0) { $error++; } @@ -717,10 +721,13 @@ if (GETPOST('dol_hide_topmenu') || ! empty($_SESSION['dol_hide_topmenu'])) if (GETPOST('dol_optimize_smallscreen') || ! empty($_SESSION['dol_optimize_smallscreen'])) $conf->dol_optimize_smallscreen=1; if (GETPOST('dol_no_mouse_hover') || ! empty($_SESSION['dol_no_mouse_hover'])) $conf->dol_no_mouse_hover=1; if (GETPOST('dol_use_jmobile') || ! empty($_SESSION['dol_use_jmobile'])) $conf->dol_use_jmobile=1; -if (! empty($conf->browser->phone)) +if (! empty($conf->browser->phone)) $conf->dol_no_mouse_hover=1; +if (! empty($conf->browser->phone) + || (! empty($_SESSION['dol_screenwidth']) && $_SESSION['dol_screenwidth'] < 400) + || (! empty($_SESSION['dol_screenheight']) && $_SESSION['dol_screenheight'] < 400) +) { $conf->dol_optimize_smallscreen=1; - $conf->dol_no_mouse_hover=1; } // If we force to use jmobile, then we reenable javascript if (! empty($conf->dol_use_jmobile)) $conf->use_javascript_ajax=1; @@ -954,8 +961,8 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs //print ''; //print ''; print "\n"; - if (! empty($conf->global->MAIN_USE_CACHE_MANIFEST)) print ''."\n"; - else print ''."\n"; + if (! empty($conf->global->MAIN_USE_CACHE_MANIFEST)) print ''."\n"; + else print ''."\n"; //print ''."\n"; if (empty($disablehead)) { @@ -1038,14 +1045,14 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs } } } - $themeparam='?lang='.$langs->defaultlang.'&theme='.$conf->theme.(GETPOST('optioncss')?'&optioncss='.GETPOST('optioncss','alpha',1):'').'&userid='.$user->id.'&entity='.$conf->entity; - $themeparam.=($ext?'&'.$ext:''); - if (! empty($_SESSION['dol_resetcache'])) $themeparam.='&dol_resetcache='.$_SESSION['dol_resetcache']; - if (GETPOST('dol_hide_topmenu')) { $themeparam.='&dol_hide_topmenu='.GETPOST('dol_hide_topmenu','int'); } - if (GETPOST('dol_hide_leftmenu')) { $themeparam.='&dol_hide_leftmenu='.GETPOST('dol_hide_leftmenu','int'); } - if (GETPOST('dol_optimize_smallscreen')) { $themeparam.='&dol_optimize_smallscreen='.GETPOST('dol_optimize_smallscreen','int'); } - if (GETPOST('dol_no_mouse_hover')) { $themeparam.='&dol_no_mouse_hover='.GETPOST('dol_no_mouse_hover','int'); } - if (GETPOST('dol_use_jmobile')) { $themeparam.='&dol_use_jmobile='.GETPOST('dol_use_jmobile','int'); $conf->dol_use_jmobile=GETPOST('dol_use_jmobile','int'); } + $themeparam='?lang='.$langs->defaultlang.'&theme='.$conf->theme.(GETPOST('optioncss')?'&optioncss='.GETPOST('optioncss','alpha',1):'').'&userid='.$user->id.'&entity='.$conf->entity; + $themeparam.=($ext?'&'.$ext:''); + if (! empty($_SESSION['dol_resetcache'])) $themeparam.='&dol_resetcache='.$_SESSION['dol_resetcache']; + if (GETPOST('dol_hide_topmenu')) { $themeparam.='&dol_hide_topmenu='.GETPOST('dol_hide_topmenu','int'); } + if (GETPOST('dol_hide_leftmenu')) { $themeparam.='&dol_hide_leftmenu='.GETPOST('dol_hide_leftmenu','int'); } + if (GETPOST('dol_optimize_smallscreen')) { $themeparam.='&dol_optimize_smallscreen='.GETPOST('dol_optimize_smallscreen','int'); } + if (GETPOST('dol_no_mouse_hover')) { $themeparam.='&dol_no_mouse_hover='.GETPOST('dol_no_mouse_hover','int'); } + if (GETPOST('dol_use_jmobile')) { $themeparam.='&dol_use_jmobile='.GETPOST('dol_use_jmobile','int'); $conf->dol_use_jmobile=GETPOST('dol_use_jmobile','int'); } //print 'themepath='.$themepath.' themeparam='.$themeparam;exit; print ''."\n"; @@ -1400,6 +1407,7 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a $logintext.='>'.$user->login.''; if ($user->societe_id) $logintext.=$companylink; $logintext.='
'; + $loginhtmltext.=''.$langs->trans("User").''; $loginhtmltext.='
'.$langs->trans("Name").': '.$user->getFullName($langs); $loginhtmltext.='
'.$langs->trans("Login").': '.$user->login; @@ -1433,27 +1441,23 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a } else $appli.=" ".DOL_VERSION; - // Link info $logouttext=''; $logouthtmltext=$appli.'
'; if ($_SESSION["dol_authmode"] != 'forceuser' && $_SESSION["dol_authmode"] != 'http') { $logouthtmltext.=$langs->trans("Logout").'
'; - $logouttext .='trans('Logout'), 'logout.png', 'class="login"', 0, 0, 1); + $logouttext .=''; + $logouttext .= img_picto($langs->trans('Logout').":".$langs->trans('Logout'), 'logout.png', 'class="login"', 0, 0, 1); $logouttext .=''; } else { $logouthtmltext.=$langs->trans("NoLogoutProcessWithAuthMode",$_SESSION["dol_authmode"]); - $logouttext .= img_picto($langs->trans('Logout'), 'logout.png', 'class="login"', 0, 0, 1); + $logouttext .= img_picto($langs->trans('Logout').":".$langs->trans('Logout'), 'logout.png', 'class="login"', 0, 0, 1); } print '\n"; unset($form); @@ -1537,7 +1540,7 @@ function left_menu($menu_array_before, $helppagename='', $moresearchform='', $me 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) && $user->rights->societe->lire) { $langs->load("companies"); - $searchform.=printSearchForm(DOL_URL_ROOT.'/societe/societe.php', DOL_URL_ROOT.'/societe/societe.php', img_object('','company').' '.$langs->trans("ThirdParties"), 'soc', 'socname'); + $searchform.=printSearchForm(DOL_URL_ROOT.'/societe/societe.php', DOL_URL_ROOT.'/societe/societe.php', img_object('','company').' '.$langs->trans("ThirdParties"), 'soc', 'socname', 'T'); } if (! empty($conf->societe->enabled) && ! empty($conf->global->MAIN_SEARCHFORM_CONTACT) && $user->rights->societe->lire) @@ -1550,7 +1553,7 @@ function left_menu($menu_array_before, $helppagename='', $moresearchform='', $me && ! empty($conf->global->MAIN_SEARCHFORM_PRODUITSERVICE)) { $langs->load("products"); - $searchform.=printSearchForm(DOL_URL_ROOT.'/product/liste.php', DOL_URL_ROOT.'/product/liste.php', img_object('','product').' '.$langs->trans("Products")."/".$langs->trans("Services"), 'products', 'sall'); + $searchform.=printSearchForm(DOL_URL_ROOT.'/product/liste.php', DOL_URL_ROOT.'/product/liste.php', img_object('','product').' '.$langs->trans("Products")."/".$langs->trans("Services"), 'products', 'sall', 'P'); } if (((! empty($conf->product->enabled) && $user->rights->produit->lire) || (! empty($conf->service->enabled) && $user->rights->service->lire)) && ! empty($conf->fournisseur->enabled) @@ -1563,7 +1566,7 @@ function left_menu($menu_array_before, $helppagename='', $moresearchform='', $me if (! empty($conf->adherent->enabled) && ! empty($conf->global->MAIN_SEARCHFORM_ADHERENT) && $user->rights->adherent->lire) { $langs->load("members"); - $searchform.=printSearchForm(DOL_URL_ROOT.'/adherents/liste.php', DOL_URL_ROOT.'/adherents/liste.php', img_object('','user').' '.$langs->trans("Members"), 'member', 'sall'); + $searchform.=printSearchForm(DOL_URL_ROOT.'/adherents/liste.php', DOL_URL_ROOT.'/adherents/liste.php', img_object('','user').' '.$langs->trans("Members"), 'member', 'sall', 'M'); } // Execute hook printSearchForm @@ -1794,25 +1797,30 @@ function getHelpParamFor($helppagename,$langs) * @param string $title Title search area * @param string $htmlmodesearch Value to set into parameter "mode_search" ('soc','contact','products','member',...) * @param string $htmlinputname Field Name input form + * @param string $accesskey Accesskey * @return string */ -function printSearchForm($urlaction,$urlobject,$title,$htmlmodesearch,$htmlinputname) +function printSearchForm($urlaction,$urlobject,$title,$htmlmodesearch,$htmlinputname,$accesskey='') { global $conf,$langs; $ret=''; - $ret.=''; $ret.='
'; + $ret.=''; $ret.=''; $ret.=''; $ret.=''; - $ret.='global->MAIN_HTML5_PLACEHOLDER)) $ret.=' placeholder="'.$langs->trans("SearchOf").''.strip_tags($title).'"'; else $ret.=' title="'.$langs->trans("SearchOf").''.strip_tags($title).'"'; - $ret.=' name="'.$htmlinputname.'" size="10" />'; + $ret.=' name="'.$htmlinputname.'" id="'.$htmlinputname.'" size="10" />'; $ret.=''; $ret.="
\n"; return $ret; diff --git a/htdocs/margin/admin/index.html b/htdocs/margin/admin/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/margin/agentMargins.php b/htdocs/margin/agentMargins.php index 74b82cbcb3b..df43f39ff2e 100644 --- a/htdocs/margin/agentMargins.php +++ b/htdocs/margin/agentMargins.php @@ -74,7 +74,7 @@ $form = new Form($db); llxHeader('',$langs->trans("Margins").' - '.$langs->trans("Agents")); $text=$langs->trans("Margins"); -print_fiche_titre($text); +//print_fiche_titre($text); // Show tabs $head=marges_prepare_head($user); @@ -144,7 +144,7 @@ $sql.=$db->order($sortfield,$sortorder); // TODO: calculate total to display then restore pagination //$sql.= $db->plimit($conf->liste_limit +1, $offset); -dol_syslog('margin::agentMargins.php sql='.$sql,LOG_DEBUG); +dol_syslog('margin::agentMargins.php', LOG_DEBUG); $result = $db->query($sql); if ($result) { diff --git a/htdocs/margin/customerMargins.php b/htdocs/margin/customerMargins.php index 6675753d4d6..c0f7e41b97e 100644 --- a/htdocs/margin/customerMargins.php +++ b/htdocs/margin/customerMargins.php @@ -66,7 +66,7 @@ $form = new Form($db); llxHeader('',$langs->trans("Margins").' - '.$langs->trans("Clients")); $text=$langs->trans("Margins"); -print_fiche_titre($text); +//print_fiche_titre($text); // Show tabs $head=marges_prepare_head($user); @@ -80,7 +80,7 @@ print ''; $client = false; if ($socid > 0) { - $soc = new Societe($db, $socid); + $soc = new Societe($db); $soc->fetch($socid); if ($soc->client) @@ -188,7 +188,7 @@ $sql.=$db->order($sortfield,$sortorder); // TODO: calculate total to display then restore pagination //$sql.= $db->plimit($conf->liste_limit +1, $offset); -dol_syslog('margin::customerMargins.php sql='.$sql,LOG_DEBUG); +dol_syslog('margin::customerMargins.php', LOG_DEBUG); $result = $db->query($sql); if ($result) { diff --git a/htdocs/margin/lib/index.html b/htdocs/margin/lib/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/margin/productMargins.php b/htdocs/margin/productMargins.php index a394b42686e..a8830f777ec 100644 --- a/htdocs/margin/productMargins.php +++ b/htdocs/margin/productMargins.php @@ -89,8 +89,7 @@ $form = new Form($db); llxHeader('',$langs->trans("Margins").' - '.$langs->trans("Products")); $text=$langs->trans("Margins"); - -print_fiche_titre($text); +//print_fiche_titre($text); // Show tabs $head=marges_prepare_head($user); @@ -193,7 +192,7 @@ $sql.=$db->order($sortfield,$sortorder); // TODO: calculate total to display then restore pagination //$sql.= $db->plimit($conf->liste_limit +1, $offset); -dol_syslog('margin::productMargins.php sql='.$sql,LOG_DEBUG); +dol_syslog('margin::productMargins.php', LOG_DEBUG); $result = $db->query($sql); if ($result) { diff --git a/htdocs/margin/tabs/index.html b/htdocs/margin/tabs/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/margin/tabs/productMargins.php b/htdocs/margin/tabs/productMargins.php index 825d2043683..c1881433947 100644 --- a/htdocs/margin/tabs/productMargins.php +++ b/htdocs/margin/tabs/productMargins.php @@ -128,91 +128,86 @@ if ($id > 0 || ! empty($ref)) print ''; - $sql = "SELECT s.nom, s.rowid as socid, s.code_client,"; - $sql.= " f.rowid as facid, f.facnumber, f.total as total_ht,"; - $sql.= " f.datef, f.paye, f.fk_statut as statut,"; - if (!$user->rights->societe->client->voir && !$socid) $sql.= " sc.fk_soc, sc.fk_user,"; - $sql.= " sum(d.total_ht) as selling_price,"; - $sql.= $db->ifsql('f.type =2','sum(d.qty *-1)','sum(d.qty)')." as qty,"; - $sql.= $db->ifsql('f.type =2','sum(d.qty * d.buy_price_ht *-1)','sum(d.qty * d.buy_price_ht)')." as buying_price,"; - $sql.= $db->ifsql('f.type =2','sum(-1 * (abs(d.total_ht) - (d.buy_price_ht * d.qty)))','sum(d.total_ht - (d.buy_price_ht * d.qty))')." as marge" ; - $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; - $sql.= ", ".MAIN_DB_PREFIX."facture as f"; - $sql.= ", ".MAIN_DB_PREFIX."facturedet as d"; - if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql.= " WHERE f.fk_soc = s.rowid"; - $sql.= " AND f.fk_statut > 0"; - $sql.= " AND s.entity = ".$conf->entity; - $sql.= " AND d.fk_facture = f.rowid"; - $sql.= " AND d.fk_product =".$object->id; - if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; - if (! empty($socid)) $sql.= " AND f.fk_soc = $socid"; - $sql .= " AND d.buy_price_ht IS NOT NULL"; - if (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1) $sql .= " AND d.buy_price_ht <> 0"; - $sql.= " GROUP BY s.nom, s.rowid, s.code_client, f.rowid, f.facnumber, f.total, f.datef, f.paye, f.fk_statut"; - if (!$user->rights->societe->client->voir && !$socid) $sql.= ", sc.fk_soc, sc.fk_user"; - $sql.= " ORDER BY ".$sortfield." ".$sortorder; - // TODO: calculate total to display then restore pagination - //$sql.= $db->plimit($conf->liste_limit +1, $offset); - dol_syslog('margin:tabs:productMargins.php sql='.$sql,LOG_DEBUG); - $result = $db->query($sql); - if ($result) - { - $num = $db->num_rows($result); + if ($user->rights->facture->lire) { + $sql = "SELECT s.nom, s.rowid as socid, s.code_client,"; + $sql.= " f.rowid as facid, f.facnumber, f.total as total_ht,"; + $sql.= " f.datef, f.paye, f.fk_statut as statut,"; + if (!$user->rights->societe->client->voir && !$socid) $sql.= " sc.fk_soc, sc.fk_user,"; + $sql.= " sum(d.total_ht) as selling_price,"; + $sql.= $db->ifsql('f.type =2','sum(d.qty *-1)','sum(d.qty)')." as qty,"; + $sql.= $db->ifsql('f.type =2','sum(d.qty * d.buy_price_ht *-1)','sum(d.qty * d.buy_price_ht)')." as buying_price,"; + $sql.= $db->ifsql('f.type =2','sum(-1 * (abs(d.total_ht) - (d.buy_price_ht * d.qty)))','sum(d.total_ht - (d.buy_price_ht * d.qty))')." as marge" ; + $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; + $sql.= ", ".MAIN_DB_PREFIX."facture as f"; + $sql.= ", ".MAIN_DB_PREFIX."facturedet as d"; + if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + $sql.= " WHERE f.fk_soc = s.rowid"; + $sql.= " AND f.fk_statut > 0"; + $sql.= " AND s.entity = ".$conf->entity; + $sql.= " AND d.fk_facture = f.rowid"; + $sql.= " AND d.fk_product =".$object->id; + if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; + if (! empty($socid)) $sql.= " AND f.fk_soc = $socid"; + $sql .= " AND d.buy_price_ht IS NOT NULL"; + if (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1) $sql .= " AND d.buy_price_ht <> 0"; + $sql.= " GROUP BY s.nom, s.rowid, s.code_client, f.rowid, f.facnumber, f.total, f.datef, f.paye, f.fk_statut"; + if (!$user->rights->societe->client->voir && !$socid) $sql.= ", sc.fk_soc, sc.fk_user"; + $sql.= " ORDER BY ".$sortfield." ".$sortorder; + // TODO: calculate total to display then restore pagination + //$sql.= $db->plimit($conf->liste_limit +1, $offset); + dol_syslog('margin:tabs:productMargins.php', LOG_DEBUG); + $result = $db->query($sql); + if ($result) { + $num = $db->num_rows($result); - print_barre_liste($langs->trans("MarginDetails"),$page,$_SERVER["PHP_SELF"],"&id=$object->id",$sortfield,$sortorder,'',0,0,''); + print_barre_liste($langs->trans("MarginDetails"),$page,$_SERVER["PHP_SELF"],"&id=$object->id",$sortfield,$sortorder,'',0,0,''); - $i = 0; - print "
"; + $i = 0; + print '
'; - print ''; - print_liste_field_titre($langs->trans("Invoice"),$_SERVER["PHP_SELF"],"f.facnumber","","&id=".$object->id,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","","&id=".$object->id,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("CustomerCode"),$_SERVER["PHP_SELF"],"s.code_client","","&id=".$object->id,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("DateInvoice"),$_SERVER["PHP_SELF"],"f.datef","","&id=".$object->id,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("SellingPrice"),$_SERVER["PHP_SELF"],"selling_price","","&id=".$object->id,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("BuyingPrice"),$_SERVER["PHP_SELF"],"buying_price","","&id=".$object->id,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Qty"),$_SERVER["PHP_SELF"],"d.qty","","&id=".$object->id,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Margin"),$_SERVER["PHP_SELF"],"marge","","&id=".$object->id,'align="right"',$sortfield,$sortorder); - if (! empty($conf->global->DISPLAY_MARGIN_RATES)) - print_liste_field_titre($langs->trans("MarginRate"),$_SERVER["PHP_SELF"],"","","&id=".$object->id,'align="right"',$sortfield,$sortorder); - if (! empty($conf->global->DISPLAY_MARK_RATES)) - print_liste_field_titre($langs->trans("MarkRate"),$_SERVER["PHP_SELF"],"","","&id=".$object->id,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"f.paye,f.fk_statut","","&id=".$object->id,'align="right"',$sortfield,$sortorder); - print "\n"; + print ''; + print_liste_field_titre($langs->trans("Invoice"),$_SERVER["PHP_SELF"],"f.facnumber","","&id=".$object->id,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","","&id=".$object->id,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("CustomerCode"),$_SERVER["PHP_SELF"],"s.code_client","","&id=".$object->id,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("DateInvoice"),$_SERVER["PHP_SELF"],"f.datef","","&id=".$object->id,'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("SellingPrice"),$_SERVER["PHP_SELF"],"selling_price","","&id=".$object->id,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("BuyingPrice"),$_SERVER["PHP_SELF"],"buying_price","","&id=".$object->id,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Qty"),$_SERVER["PHP_SELF"],"d.qty","","&id=".$object->id,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Margin"),$_SERVER["PHP_SELF"],"marge","","&id=".$object->id,'align="right"',$sortfield,$sortorder); + if (! empty($conf->global->DISPLAY_MARGIN_RATES)) + print_liste_field_titre($langs->trans("MarginRate"),$_SERVER["PHP_SELF"],"","","&id=".$object->id,'align="right"',$sortfield,$sortorder); + if (! empty($conf->global->DISPLAY_MARK_RATES)) + print_liste_field_titre($langs->trans("MarkRate"),$_SERVER["PHP_SELF"],"","","&id=".$object->id,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"f.paye,f.fk_statut","","&id=".$object->id,'align="right"',$sortfield,$sortorder); + print "\n"; - $cumul_achat = 0; - $cumul_vente = 0; - $cumul_qty = 0; - $rounding = min($conf->global->MAIN_MAX_DECIMALS_UNIT,$conf->global->MAIN_MAX_DECIMALS_TOT); + $cumul_achat = 0; + $cumul_vente = 0; + $cumul_qty = 0; + $rounding = min($conf->global->MAIN_MAX_DECIMALS_UNIT,$conf->global->MAIN_MAX_DECIMALS_TOT); - if ($num > 0) - { - $var=True; - while ($i < $num /*&& $i < $conf->liste_limit*/) - { - $objp = $db->fetch_object($result); - $var=!$var; + if ($num > 0) { + $var=True; + while ($i < $num /*&& $i < $conf->liste_limit*/) { + $objp = $db->fetch_object($result); + $var=!$var; - if ($objp->marge < 0) - { - $marginRate = ($objp->buying_price != 0)?-1*(100 * $objp->marge / $objp->buying_price):'' ; - $markRate = ($objp->selling_price != 0)?-1*(100 * $objp->marge / $objp->selling_price):'' ; - } - else - { - $marginRate = ($objp->buying_price != 0)?(100 * $objp->marge / $objp->buying_price):'' ; - $markRate = ($objp->selling_price != 0)?(100 * $objp->marge / $objp->selling_price):'' ; - } + if ($objp->marge < 0) { + $marginRate = ($objp->buying_price != 0)?-1*(100 * $objp->marge / $objp->buying_price):'' ; + $markRate = ($objp->selling_price != 0)?-1*(100 * $objp->marge / $objp->selling_price):'' ; + } else { + $marginRate = ($objp->buying_price != 0)?(100 * $objp->marge / $objp->buying_price):'' ; + $markRate = ($objp->selling_price != 0)?(100 * $objp->marge / $objp->selling_price):'' ; + } - print ""; - print '\n"; - print ''; - print "\n"; + print ''; + print '\n"; + print ''; + print "\n"; print ""; print "\n"; @@ -224,52 +219,46 @@ if ($id > 0 || ! empty($ref)) if (! empty($conf->global->DISPLAY_MARK_RATES)) print "\n"; print ''; - print "\n"; - $i++; - $cumul_achat += $objp->buying_price; - $cumul_vente += $objp->selling_price; - $cumul_qty += $objp->qty; - } - } + print "\n"; + $i++; + $cumul_achat += $objp->buying_price; + $cumul_vente += $objp->selling_price; + $cumul_qty += $objp->qty; + } + } - // affichage totaux marges - $var=!$var; - $totalMargin = $cumul_vente - $cumul_achat; - if ($totalMargin < 0) - { - $marginRate = ($cumul_achat != 0)?-1*(100 * $totalMargin / $cumul_achat):''; - $markRate = ($cumul_vente != 0)?-1*(100 * $totalMargin / $cumul_vente):''; - } - else - { - $marginRate = ($cumul_achat != 0)?(100 * $totalMargin / $cumul_achat):''; - $markRate = ($cumul_vente != 0)?(100 * $totalMargin / $cumul_vente):''; - } - print ''; - print '"; - print "\n"; - print "\n"; - print "\n"; - print "\n"; - if (! empty($conf->global->DISPLAY_MARGIN_RATES)) - print "\n"; - if (! empty($conf->global->DISPLAY_MARK_RATES)) - print "\n"; - print ''; - print "\n"; - } - else - { - dol_print_error($db); - } - print "
'; - $invoicestatic->id=$objp->facid; - $invoicestatic->ref=$objp->facnumber; - print $invoicestatic->getNomUrl(1); - print "'.img_object($langs->trans("ShowCompany"),"company").' '.dol_trunc($objp->nom,44).'".$objp->code_client."
'; + $invoicestatic->id=$objp->facid; + $invoicestatic->ref=$objp->facnumber; + print $invoicestatic->getNomUrl(1); + print "'.img_object($langs->trans("ShowCompany"),"company").' '.dol_trunc($objp->nom,44).'".$objp->code_client.""; print dol_print_date($db->jdate($objp->datef),'day')."".price($objp->selling_price, null, null, null, null, $rounding)."".(($markRate === '')?'n/a':price($markRate, null, null, null, null, $rounding)."%")."'.$invoicestatic->LibStatut($objp->paye,$objp->statut,5).'
'.$langs->trans('TotalMargin')."".price($cumul_vente, null, null, null, null, $rounding)."".price($cumul_achat, null, null, null, null, $rounding)."".price($cumul_qty, null, null, null, null, $rounding)."".price($totalMargin, null, null, null, null, $rounding)."".(($marginRate === '')?'n/a':price($marginRate, null, null, null, null, $rounding)."%")."".(($markRate === '')?'n/a':price($markRate, null, null, null, null, $rounding)."%")." 
"; - print '
'; - $db->free($result); - } -} -else -{ - dol_print_error(); + // affichage totaux marges + $var=!$var; + $totalMargin = $cumul_vente - $cumul_achat; + if ($totalMargin < 0) { + $marginRate = ($cumul_achat != 0)?-1*(100 * $totalMargin / $cumul_achat):''; + $markRate = ($cumul_vente != 0)?-1*(100 * $totalMargin / $cumul_vente):''; + } else { + $marginRate = ($cumul_achat != 0)?(100 * $totalMargin / $cumul_achat):''; + $markRate = ($cumul_vente != 0)?(100 * $totalMargin / $cumul_vente):''; + } + print ''; + print ''.$langs->trans('TotalMargin').""; + print ''.price($cumul_vente, null, null, null, null, $rounding)."\n"; + print ''.price($cumul_achat, null, null, null, null, $rounding)."\n"; + print ''.price($cumul_qty, null, null, null, null, $rounding)."\n"; + print ''.price($totalMargin, null, null, null, null, $rounding)."\n"; + if (! empty($conf->global->DISPLAY_MARGIN_RATES)) + print ''.(($marginRate === '')?'n/a':price($marginRate, null, null, null, null, $rounding)."%")."\n"; + if (! empty($conf->global->DISPLAY_MARK_RATES)) + print "".(($markRate === '')?'n/a':price($markRate, null, null, null, null, $rounding)."%")."\n"; + print ' '; + print "\n"; + print ""; + print '
'; + } else { + dol_print_error($db); + } + $db->free($result); + } + } +} else { + dol_print_error(); } diff --git a/htdocs/margin/tabs/thirdpartyMargins.php b/htdocs/margin/tabs/thirdpartyMargins.php index 8e7807817a6..cc7a5fb1c75 100644 --- a/htdocs/margin/tabs/thirdpartyMargins.php +++ b/htdocs/margin/tabs/thirdpartyMargins.php @@ -62,7 +62,7 @@ llxHeader('',$langs->trans("ThirdParty").' - '.$langs->trans("Margins"),$help_ur if ($socid > 0) { - $societe = new Societe($db, $socid); + $societe = new Societe($db); $societe->fetch($socid); /* @@ -147,7 +147,7 @@ if ($socid > 0) // TODO: calculate total to display then restore pagination //$sql.= $db->plimit($conf->liste_limit +1, $offset); - dol_syslog('margin:tabs:thirdpartyMargins.php sql='.$sql,LOG_DEBUG); + dol_syslog('margin:tabs:thirdpartyMargins.php', LOG_DEBUG); $result = $db->query($sql); if ($result) { diff --git a/htdocs/master.inc.php b/htdocs/master.inc.php index 3c2424ed88a..7c0000bedea 100644 --- a/htdocs/master.inc.php +++ b/htdocs/master.inc.php @@ -9,6 +9,7 @@ * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2010 Juanjo Menent * Copyright (C) 2011 Philippe Grand + * Copyright (C) 2014 Teddy Andreotti <125155@supinfo.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -244,8 +245,6 @@ $hookmanager=new HookManager($db); if (! defined('MAIN_LABEL_MENTION_NPR') ) define('MAIN_LABEL_MENTION_NPR','NPR'); -// We force feature to help debug -//$conf->global->MAIN_JS_ON_PAYMENT=0; // We force FPDF if (! empty($dolibarr_pdf_force_fpdf)) $conf->global->MAIN_USE_FPDF=$dolibarr_pdf_force_fpdf; diff --git a/htdocs/opensurvey/class/index.html b/htdocs/opensurvey/class/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/opensurvey/class/opensurveysondage.class.php b/htdocs/opensurvey/class/opensurveysondage.class.php index c20c4ebca0d..c4ca544d861 100644 --- a/htdocs/opensurvey/class/opensurveysondage.class.php +++ b/htdocs/opensurvey/class/opensurveysondage.class.php @@ -137,7 +137,7 @@ class Opensurveysondage extends CommonObject $this->db->begin(); - dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::create", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } @@ -147,12 +147,10 @@ class Opensurveysondage extends CommonObject { global $langs, $conf; - //// Call triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('OPENSURVEY_CREATE',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - //// End call triggers + // Call trigger + $result=$this->call_trigger('OPENSURVEY_CREATE',$user); + if ($result < 0) $error++; + // End call triggers } } @@ -201,7 +199,7 @@ class Opensurveysondage extends CommonObject $sql.= " FROM ".MAIN_DB_PREFIX."opensurvey_sondage as t"; $sql.= " WHERE t.id_sondage = '".$this->db->escape($numsurvey)."'"; - dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -242,7 +240,6 @@ class Opensurveysondage extends CommonObject else { $this->error="Error ".$this->db->lasterror(); - dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR); $ret=-1; } @@ -286,7 +283,7 @@ class Opensurveysondage extends CommonObject $this->db->begin(); - dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } @@ -344,12 +341,10 @@ class Opensurveysondage extends CommonObject { if (! $notrigger) { - //// Call triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('OPENSURVEY_DELETE',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - //// End call triggers + // Call trigger + $result=$this->call_trigger('OPENSURVEY_DELETE',$user); + if ($result < 0) $error++; + // End call triggers } } @@ -357,16 +352,16 @@ class Opensurveysondage extends CommonObject { $sql='DELETE FROM '.MAIN_DB_PREFIX."opensurvey_comments WHERE id_sondage = '".$this->db->escape($numsondage)."'"; - dol_syslog(get_class($this)."::delete sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql=$this->db->query($sql); $sql='DELETE FROM '.MAIN_DB_PREFIX."opensurvey_user_studs WHERE id_sondage = '".$this->db->escape($numsondage)."'"; - dol_syslog(get_class($this)."::delete sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql=$this->db->query($sql); $sql = "DELETE FROM ".MAIN_DB_PREFIX."opensurvey_sondage"; $sql.= " WHERE id_sondage = '".$this->db->escape($numsondage)."'"; - dol_syslog(get_class($this)."::delete sql=".$sql); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } } @@ -479,7 +474,6 @@ class Opensurveysondage extends CommonObject $sql = "INSERT INTO ".MAIN_DB_PREFIX."opensurvey_comments (id_sondage, comment, usercomment)"; $sql.= " VALUES ('".$this->db->escape($this->id_sondage)."','".$this->db->escape($comment)."','".$this->db->escape($comment_user)."')"; $resql = $this->db->query($sql); - dol_syslog("sql=".$sql); if (!$resql) { return false; diff --git a/htdocs/opensurvey/css/index.html b/htdocs/opensurvey/css/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/opensurvey/exportcsv.php b/htdocs/opensurvey/exportcsv.php index 2c31b67f574..fec8174a7ef 100644 --- a/htdocs/opensurvey/exportcsv.php +++ b/htdocs/opensurvey/exportcsv.php @@ -86,7 +86,6 @@ $sql ='SELECT nom, reponses'; $sql.=' FROM '.MAIN_DB_PREFIX."opensurvey_user_studs"; $sql.=" WHERE id_sondage='" . $db->escape($numsondage) . "'"; $sql.=" ORDER BY id_users"; -dol_syslog("sql=".$sql); $resql=$db->query($sql); if ($resql) { diff --git a/htdocs/opensurvey/fonctions.php b/htdocs/opensurvey/fonctions.php index c3c80a59b86..b65abcaffe9 100644 --- a/htdocs/opensurvey/fonctions.php +++ b/htdocs/opensurvey/fonctions.php @@ -25,14 +25,14 @@ /** * Returns an array with the tabs for the "Opensurvey poll" section * It loads tabs from modules looking for the entity Opensurveyso - * + * * @param Opensurveysondage $object Current viewing poll * @return array Tabs for the opensurvey section */ function opensurvey_prepare_head(Opensurveysondage $object) { - + global $langs, $conf; - + $h = 0; $head = array(); @@ -40,7 +40,7 @@ function opensurvey_prepare_head(Opensurveysondage $object) { $head[0][1] = $langs->trans("Card"); $head[0][2] = 'general'; $h++; - + $head[1][0] = 'results.php?id='.$object->id_sondage; $head[1][1] = $langs->trans("SurveyResults"); $head[1][2] = 'preview'; @@ -111,12 +111,12 @@ function showlogo() $urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=companylogo&file=thumbs/'.urlencode($mysoc->logo_small); } } - + if (!$urllogo && (is_readable(DOL_DOCUMENT_ROOT.'/theme/dolibarr_logo.png'))) { $urllogo=DOL_URL_ROOT.'/theme/dolibarr_logo.png'; } - + print '
Logo
'; print '
'; } @@ -205,14 +205,14 @@ function dol_survey_random($car) function ajouter_sondage() { global $db, $user; - + require_once DOL_DOCUMENT_ROOT.'/opensurvey/class/opensurveysondage.class.php'; $sondage=dol_survey_random(16); $allow_comments = empty($_SESSION['allow_comments']) ? 0 : 1; $allow_spy = empty($_SESSION['allow_spy']) ? 0 : 1; - + // Insert survey $opensurveysondage = new Opensurveysondage($db); $opensurveysondage->id_sondage = $sondage; @@ -226,9 +226,9 @@ function ajouter_sondage() $opensurveysondage->allow_comments = $allow_comments; $opensurveysondage->allow_spy = $allow_spy; $opensurveysondage->sujet = $_SESSION['toutchoix']; - + $res = $opensurveysondage->create($user); - + if ($res < 0) { dol_print_error($db); } @@ -243,11 +243,9 @@ function ajouter_sondage() unset($_SESSION['toutchoix']); unset($_SESSION['totalchoixjour']); unset($_SESSION['champdatefin']); - + $urlback=dol_buildpath('/opensurvey/card.php',1).'?id='.$sondage; header("Location: ".$urlback); exit(); } - -?> diff --git a/htdocs/opensurvey/img/index.html b/htdocs/opensurvey/img/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/opensurvey/public/index.html b/htdocs/opensurvey/public/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/opensurvey/public/studs.php b/htdocs/opensurvey/public/studs.php index 01bb969df20..c85a62ae61a 100644 --- a/htdocs/opensurvey/public/studs.php +++ b/htdocs/opensurvey/public/studs.php @@ -212,7 +212,6 @@ if ($testmodifier) $sql.= " SET reponses = '".$db->escape($nouveauchoix)."'"; $sql.= " WHERE id_users = '".$db->escape($idtomodify)."'"; - dol_syslog("sql=".$sql); $resql = $db->query($sql); if (! $resql) dol_print_error($db); } @@ -393,7 +392,6 @@ $compteur = 0; $sql ="SELECT id_users, nom, id_sondage, reponses"; $sql.=" FROM ".MAIN_DB_PREFIX."opensurvey_user_studs"; $sql.=" WHERE id_sondage = '".$db->escape($numsondage)."'"; -dol_syslog('sql='.$sql); $resql=$db->query($sql); if (! $resql) { diff --git a/htdocs/opensurvey/results.php b/htdocs/opensurvey/results.php index 48c585c0f2e..63c56f9d5e3 100644 --- a/htdocs/opensurvey/results.php +++ b/htdocs/opensurvey/results.php @@ -151,7 +151,6 @@ if ($testmodifier) $sql.= " SET reponses = '".$db->escape($nouveauchoix)."'"; $sql.= " WHERE id_users = '".$db->escape($idtomodify)."'"; - dol_syslog("sql=".$sql); $resql = $db->query($sql); if (! $resql) dol_print_error($db); } @@ -172,7 +171,6 @@ if (GETPOST("ajoutercolonne") && GETPOST('nouvellecolonne') && $object->format = $sql = 'UPDATE '.MAIN_DB_PREFIX."opensurvey_sondage"; $sql.= " SET sujet = '".$db->escape($nouveauxsujets)."'"; $sql.= " WHERE id_sondage = '".$db->escape($numsondage)."'"; - dol_syslog("sql=".$sql); $resql = $db->query($sql); if (! $resql) dol_print_error($db); else { @@ -258,7 +256,6 @@ if (isset($_POST["ajoutercolonne"]) && $object->format == "D") $sql = 'UPDATE '.MAIN_DB_PREFIX."opensurvey_sondage"; $sql.= " SET sujet = '".$db->escape($dateinsertion)."'"; $sql.= " WHERE id_sondage = '".$db->escape($numsondage)."'"; - dol_syslog("sql=".$sql); $resql = $db->query($sql); if (! $resql) dol_print_error($db); else { @@ -289,7 +286,6 @@ for ($i = 0; $i < $nblignes; $i++) $sql ="SELECT id_users, nom, id_sondage, reponses"; $sql.=" FROM ".MAIN_DB_PREFIX."opensurvey_user_studs"; $sql.=" WHERE id_sondage = '".$db->escape($numsondage)."'"; - dol_syslog('sql='.$sql); $resql=$db->query($sql); if (! $resql) dol_print_error($db); $num=$db->num_rows($resql); @@ -340,7 +336,6 @@ for ($i = 0; $i < $nbcolonnes; $i++) // Mise a jour des sujets dans la base $sql = 'UPDATE '.MAIN_DB_PREFIX."opensurvey_sondage"; $sql.= " SET sujet = '".$db->escape($nouveauxsujets)."' WHERE id_sondage = '".$db->escape($numsondage)."'"; - dol_syslog("sql=".$sql); $resql = $db->query($sql); if (! $resql) dol_print_error($db); @@ -1083,4 +1078,3 @@ print ''."\n"; llxFooterSurvey(); $db->close(); -?> diff --git a/htdocs/paybox/admin/index.html b/htdocs/paybox/admin/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/paybox/admin/paybox.php b/htdocs/paybox/admin/paybox.php index 7eefafb9c8c..30e02591190 100644 --- a/htdocs/paybox/admin/paybox.php +++ b/htdocs/paybox/admin/paybox.php @@ -67,7 +67,7 @@ if ($action == 'setvalue' && $user->admin) if (! $error) { $db->commit(); - $mesg='
'.$langs->trans("SetupSaved").'
'; + setEventMessage($langs->trans("SetupSaved")); } else { @@ -227,8 +227,6 @@ if (! empty($conf->adherent->enabled)) print "
"; print info_admin($langs->trans("YouCanAddTagOnUrl")); -dol_htmloutput_mesg($mesg); - $db->close(); dol_fiche_end(); llxFooter(); diff --git a/htdocs/paybox/img/index.html b/htdocs/paybox/img/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/paybox/index.html b/htdocs/paybox/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/paybox/index.php b/htdocs/paybox/index.php deleted file mode 100644 index 7db0dd9ebf9..00000000000 --- a/htdocs/paybox/index.php +++ /dev/null @@ -1 +0,0 @@ -Url not available \ No newline at end of file diff --git a/htdocs/paybox/lib/index.html b/htdocs/paybox/lib/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/paybox/lib/paybox.lib.php b/htdocs/paybox/lib/paybox.lib.php index f56367c9a36..09bacc3764f 100644 --- a/htdocs/paybox/lib/paybox.lib.php +++ b/htdocs/paybox/lib/paybox.lib.php @@ -183,27 +183,6 @@ function print_paybox_redirect($PRICE,$CURRENCY,$EMAIL,$urlok,$urlko,$TAG) // Formulaire pour module Paybox print '
'."\n"; - // For Paybox V1 (IBS_xxx) - /* - print ''."\n"; - print ''."\n"; - print ''."\n"; - print ''."\n"; - print ''."\n"; - print ''."\n"; - print ''."\n"; - print ''."\n"; - print ''."\n"; - print ''."\n"; - print ''."\n"; - print ''."\n"; - print ''."\n"; - print ''."\n"; - print ''."\n"; - print ''."\n"; - print ''."\n"; - */ - // For Paybox V2 (PBX_xxx) print ''."\n"; print ''."\n"; @@ -228,8 +207,6 @@ function print_paybox_redirect($PRICE,$CURRENCY,$EMAIL,$urlok,$urlko,$TAG) print '
'."\n"; - // Formulaire pour module Paybox v2 (PBX_xxx) - print "\n"; print ' - -
+ + + +
This page is a sample of page using tables. To make test with
- css (edit page to change)
- jmobile (edit page to enable/disable)
- dataTables
- tablednd
-
-Example 0a : Table with div+div+div containg a select that should be overflowed and truncated
+


Example 0a : Table with div+div+div containg a select that should be overflowed and truncated => Use this to align text or form
+ +
@@ -55,7 +76,9 @@ Example 0a : Table with div+div+div containg a select that should be overflowed
-Example 0b: Table with div+form+div containg a select that should be overflowed and truncated
+ +


Example 0b: Table with div+form+div containg a select that should be overflowed and truncated => Use this to align text or form
+
@@ -66,7 +89,9 @@ Example 0b: Table with div+form+div containg a select that should be overflowed
-Example 0c: Table with table+tr+td containg a select that should be overflowed and truncated
+ +


Example 0c: Table with table+tr+td containg a select that should be overflowed and truncated => Use this to align text or form
+
@@ -80,8 +105,9 @@ Example 0c: Table with table+tr+td containg a select that should be overflowed a -
-Example 1 : Table using tags: div.tagtable+div.tagtr+div or div.tagtable+div.tagtr+div.tagtd
+


Example 1 : Table using tags: div.tagtable+div.tagtr+div or div.tagtable+div.tagtr+div.tagtd => Use this for tables that are edited forms

+ +
+


Example 2 : Table using tags: table/thead/tbody/tr/td + dataTable => Use this for long result tables
-Example 2 : Table using tags: table/thead/tbody/tr/td + dataTable
- - +
@@ -249,12 +304,9 @@ $('xxxth').replaceWith(
snake
-

+


Example 3 : Standard table => Use this if you need the drag and drop for lines
- -
-Example 3 : Standard table

+ + + \ No newline at end of file diff --git a/htdocs/resource/class/html.formresource.class.php b/htdocs/resource/class/html.formresource.class.php index f618581aecd..241d440cc0f 100644 --- a/htdocs/resource/class/html.formresource.class.php +++ b/htdocs/resource/class/html.formresource.class.php @@ -88,7 +88,7 @@ class FormResource if ($resourcestat) { - if ($conf->use_javascript_ajax && $conf->global->COMPANY_USE_SEARCH_TO_SELECT && ! $forcecombo) + if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->COMPANY_USE_SEARCH_TO_SELECT) && ! $forcecombo) { //$minLength = (is_numeric($conf->global->COMPANY_USE_SEARCH_TO_SELECT)?$conf->global->COMPANY_USE_SEARCH_TO_SELECT:2); $out.= ajax_combobox($htmlname, $event, $conf->global->COMPANY_USE_SEARCH_TO_SELECT); diff --git a/htdocs/resource/class/index.html b/htdocs/resource/class/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/resource/class/resource.class.php b/htdocs/resource/class/resource.class.php index 6edeef201fb..f9eacda124a 100644 --- a/htdocs/resource/class/resource.class.php +++ b/htdocs/resource/class/resource.class.php @@ -106,7 +106,7 @@ class Resource extends CommonObject $this->db->begin(); - dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::create", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); @@ -168,7 +168,7 @@ class Resource extends CommonObject $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_type_resource as ty ON ty.code=t.fk_code_type_resource"; $sql.= " WHERE t.rowid = ".$this->db->escape($id); - dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -225,7 +225,7 @@ class Resource extends CommonObject $this->db->begin(); - dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } @@ -285,7 +285,7 @@ class Resource extends CommonObject $sql.= " FROM ".MAIN_DB_PREFIX."element_resources as t"; $sql.= " WHERE t.rowid = ".$this->db->escape($id); - dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -315,7 +315,6 @@ class Resource extends CommonObject else { $this->error="Error ".$this->db->lasterror(); - dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR); return -1; } } @@ -332,42 +331,36 @@ class Resource extends CommonObject global $user,$langs,$conf; $error=0; - + + if (! $notrigger) + { + // Call trigger + $result=$this->call_trigger('RESOURCE_DELETE',$user); + if ($result < 0) return -1; + // End call triggers + } + $sql = "DELETE FROM ".MAIN_DB_PREFIX."resource"; $sql.= " WHERE rowid =".$rowid; - dol_syslog(get_class($this)."::delete sql=".$sql); + dol_syslog(get_class($this)."::delete", 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)."'"; - dol_syslog(get_class($this)."::delete sql=".$sql); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); if ($this->db->query($sql)) { - if (! $notrigger) - { - // Call triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('RESOURCE_DELETE',$this,$user,$langs,$conf); - if ($result < 0) { - $error++; $this->errors=$interface->errors; - } - // End call triggers - } - return 1; } else { $this->error=$this->db->lasterror(); - dol_syslog(get_class($this)."::delete_resource error=".$this->error, LOG_ERR); return -1; } } else { $this->error=$this->db->lasterror(); - dol_syslog(get_class($this)."::delete_resource error=".$this->error, LOG_ERR); return -1; } } @@ -411,7 +404,7 @@ class Resource extends CommonObject $sql.= " GROUP BY t.rowid"; $sql.= " ORDER BY $sortfield $sortorder "; if ($limit) $sql.= $this->db->plimit($limit+1,$offset); - dol_syslog(get_class($this)."::fetch_all sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetch_all", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) @@ -484,7 +477,7 @@ class Resource extends CommonObject } $sql.= " GROUP BY t.rowid"; $sql.= " ORDER BY $sortfield $sortorder " . $this->db->plimit($limit+1,$offset); - dol_syslog(get_class($this)."::fetch_all sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetch_all", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) @@ -569,7 +562,7 @@ class Resource extends CommonObject } $sql.= " GROUP BY t.resource_id"; $sql.= " ORDER BY " . $sortfield . " " . $sortorder . " " . $this->db->plimit($limit+1,$offset); - dol_syslog(get_class($this)."::fetch_all sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetch_all", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) @@ -729,7 +722,7 @@ class Resource extends CommonObject $this->db->begin(); - dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } @@ -737,15 +730,10 @@ class Resource extends CommonObject { if (! $notrigger) { - // Uncomment this and change MYOBJECT to your own tag if you - // want this action calls a trigger. - - // Call triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('RESOURCE_MODIFY',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - // End call triggers + // Call trigger + $result=$this->call_trigger('RESOURCE_MODIFY',$user); + if ($result < 0) $error++; + // End call triggers } } @@ -784,7 +772,7 @@ class Resource extends CommonObject $sql.=" AND resource_type LIKE '%".$resource_type."%'"; $sql .= ' ORDER BY resource_type'; - dol_syslog(get_class($this)."::getElementResources sql=".$sql); + dol_syslog(get_class($this)."::getElementResources", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -837,7 +825,7 @@ class Resource extends CommonObject $sql.= " FROM ".MAIN_DB_PREFIX."c_type_resource"; $sql.= " WHERE active > 0"; $sql.= " ORDER BY rowid"; - dol_syslog(get_class($this)."::load_cache_code_type_resource sql=".$sql,LOG_DEBUG); + dol_syslog(get_class($this)."::load_cache_code_type_resource", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { diff --git a/htdocs/resource/img/index.html b/htdocs/resource/img/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/resource/index.html b/htdocs/resource/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/societe/admin/contact_extrafields.php b/htdocs/societe/admin/contact_extrafields.php index c4712817955..9bb756ac7ee 100644 --- a/htdocs/societe/admin/contact_extrafields.php +++ b/htdocs/societe/admin/contact_extrafields.php @@ -35,7 +35,7 @@ $extrafields = new ExtraFields($db); $form = new Form($db); // List of supported format -$tmptype2label=getStaticMember(get_class($extrafields),'type2label'); +$tmptype2label=ExtraFields::$type2label; $type2label=array(''); foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val); diff --git a/htdocs/societe/admin/societe.php b/htdocs/societe/admin/societe.php index 5bb227dde46..b1680d2803e 100644 --- a/htdocs/societe/admin/societe.php +++ b/htdocs/societe/admin/societe.php @@ -77,11 +77,11 @@ if ($action == 'updateoptions') if (! $res > 0) $error++; if (! $error) { - $mesg = "".$langs->trans("SetupSaved").""; + setEventMessage($langs->trans("SetupSaved")); } else { - $mesg = "".$langs->trans("Error").""; + setEventMessage($langs->trans("Error"), 'errors'); } } @@ -92,11 +92,11 @@ if ($action == 'updateoptions') if (! $res > 0) $error++; if (! $error) { - $mesg = "".$langs->trans("SetupSaved").""; + setEventMessage($langs->trans("SetupSaved")); } else { - $mesg = "".$langs->trans("Error").""; + setEventMessage($langs->trans("Error"), 'errors'); } } } @@ -121,12 +121,12 @@ if ($action == 'setModuleOptions') if (! $error) { $db->commit(); - $mesg = "".$langs->trans("SetupSaved").""; + setEventMessage($langs->trans("SetupSaved")); } else { $db->rollback(); - $mesg = "".$langs->trans("Error").""; + setEventMessage($langs->trans("Error"), 'errors'); } } @@ -184,7 +184,7 @@ if ($action == 'setdoc') $sql.= ($label?"'".$db->escape($label)."'":'null').", "; $sql.= (! empty($scandir)?"'".$db->escape($scandir)."'":"null"); $sql.= ")"; - dol_syslog("societe.php ".$sql); + dol_syslog("societe.php", LOG_DEBUG); $result2=$db->query($sql); if ($result1 && $result2) { @@ -192,7 +192,6 @@ if ($action == 'setdoc') } else { - dol_syslog("societe.php ".$db->lasterror(), LOG_ERR); $db->rollback(); } } @@ -221,11 +220,11 @@ if ($action=="setaddrefinlist") { if (! $res > 0) $error++; if (! $error) { - $mesg = "".$langs->trans("SetupSaved").""; + setEventMessage($langs->trans("SetupSaved")); } else { - $mesg = "".$langs->trans("Error").""; + setEventMessage($langs->trans("Error"), 'errors'); } } @@ -299,9 +298,6 @@ $head = societe_admin_prepare_head(null); dol_fiche_head($head, 'general', $langs->trans("ThirdParties"), 0, 'company'); -dol_htmloutput_mesg($mesg); - - $dirsociete=array_merge(array('/core/modules/societe/'),$conf->modules_parts['societe']); // Module to manage customer/supplier code diff --git a/htdocs/societe/admin/societe_extrafields.php b/htdocs/societe/admin/societe_extrafields.php index 5ca23df284a..b6485e0d489 100644 --- a/htdocs/societe/admin/societe_extrafields.php +++ b/htdocs/societe/admin/societe_extrafields.php @@ -36,7 +36,7 @@ $extrafields = new ExtraFields($db); $form = new Form($db); // List of supported format -$tmptype2label=getStaticMember(get_class($extrafields),'type2label'); +$tmptype2label=ExtraFields::$type2label; $type2label=array(''); foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val); diff --git a/htdocs/societe/ajax/index.html b/htdocs/societe/ajax/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/societe/ajaxcompanies.php b/htdocs/societe/ajaxcompanies.php index 32fbe2e2c00..8771c0219c7 100644 --- a/htdocs/societe/ajaxcompanies.php +++ b/htdocs/societe/ajaxcompanies.php @@ -84,7 +84,7 @@ if (GETPOST('newcompany') || GETPOST('socid','int') || GETPOST('id_fourn')) if (! empty($_GET["filter"])) $sql.= " AND ".$_GET["filter"]; // Add other filters $sql.= " ORDER BY nom ASC"; - //dol_syslog("ajaxcompanies sql=".$sql); + //dol_syslog("ajaxcompanies", LOG_DEBUG); $resql=$db->query($sql); if ($resql) { @@ -110,5 +110,3 @@ else { echo json_encode(array('nom'=>'ErrorBadParameter','label'=>'ErrorBadParameter','key'=>'ErrorBadParameter','value'=>'ErrorBadParameter')); } - -?> \ No newline at end of file diff --git a/htdocs/societe/ajaxcountries.php b/htdocs/societe/ajaxcountries.php index 78018a22035..7eb22035d6b 100644 --- a/htdocs/societe/ajaxcountries.php +++ b/htdocs/societe/ajaxcountries.php @@ -31,7 +31,7 @@ if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1'); require '../main.inc.php'; -$country=GETPOST('pays', 'alpha'); +$country=GETPOST('country', 'alpha'); /* @@ -49,16 +49,16 @@ print ' Discarded'."\n"; + continue; + } + $fuser = new User($db); if($conf->global->LDAP_KEY_USERS == $conf->global->LDAP_FIELD_SID) { diff --git a/scripts/withdrawals/build_withdrawal_file.php b/scripts/withdrawals/build_withdrawal_file.php index b8be0c9b244..cb01c3f6678 100755 --- a/scripts/withdrawals/build_withdrawal_file.php +++ b/scripts/withdrawals/build_withdrawal_file.php @@ -50,7 +50,7 @@ $error=0; */ @set_time_limit(0); -print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n"; +print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." *****\n"; dol_syslog($script_file." launched with arg ".join(',',$argv)); $datetimeprev = dol_now(); diff --git a/test/phpunit/CategorieTest.php b/test/phpunit/CategorieTest.php index bae2e989f24..3d4801a5854 100755 --- a/test/phpunit/CategorieTest.php +++ b/test/phpunit/CategorieTest.php @@ -305,7 +305,7 @@ class CategorieTest extends PHPUnit_Framework_TestCase $localobject=new Categorie($this->savdb); $result=$localobject->fetch($id); - $result=$localobject->delete($id); + $result=$localobject->delete($user); print __METHOD__." id=".$id." result=".$result."\n"; $this->assertGreaterThan(0, $result); diff --git a/test/phpunit/CommandeFournisseurTest.php b/test/phpunit/CommandeFournisseurTest.php index 2c83b4fdfc3..90c0d10e3fb 100644 --- a/test/phpunit/CommandeFournisseurTest.php +++ b/test/phpunit/CommandeFournisseurTest.php @@ -338,4 +338,3 @@ class CommandeFournisseurTest extends PHPUnit_Framework_TestCase } } -?> \ No newline at end of file diff --git a/test/phpunit/CommandeTest.php b/test/phpunit/CommandeTest.php index 451e886a761..8a2e3f57120 100644 --- a/test/phpunit/CommandeTest.php +++ b/test/phpunit/CommandeTest.php @@ -265,4 +265,3 @@ class CommandeTest extends PHPUnit_Framework_TestCase } } -?> \ No newline at end of file diff --git a/test/phpunit/CommonObjectTest.php b/test/phpunit/CommonObjectTest.php index cbdde31e14d..a22146dfc2a 100644 --- a/test/phpunit/CommonObjectTest.php +++ b/test/phpunit/CommonObjectTest.php @@ -183,4 +183,3 @@ class CommonObjectTest extends PHPUnit_Framework_TestCase return $result; } } -?> \ No newline at end of file diff --git a/test/phpunit/CompanyBankAccountTest.php b/test/phpunit/CompanyBankAccountTest.php index 24d6ad03d80..a105bb37a53 100644 --- a/test/phpunit/CompanyBankAccountTest.php +++ b/test/phpunit/CompanyBankAccountTest.php @@ -233,4 +233,3 @@ class CompanyBankAccountTest extends PHPUnit_Framework_TestCase } } -?> diff --git a/test/phpunit/EntrepotTest.php b/test/phpunit/EntrepotTest.php index efd5f54008f..53788d71dab 100755 --- a/test/phpunit/EntrepotTest.php +++ b/test/phpunit/EntrepotTest.php @@ -257,4 +257,3 @@ class EntrepotTest extends PHPUnit_Framework_TestCase return; } } -?> \ No newline at end of file diff --git a/test/phpunit/ExportTest.php b/test/phpunit/ExportTest.php index d5938fc4691..49695ab1946 100755 --- a/test/phpunit/ExportTest.php +++ b/test/phpunit/ExportTest.php @@ -265,4 +265,3 @@ class ExportTest extends PHPUnit_Framework_TestCase return true; } } -?> diff --git a/test/phpunit/FactureRecTest.php b/test/phpunit/FactureRecTest.php index 4adace8ef9a..8933b9a73e0 100644 --- a/test/phpunit/FactureRecTest.php +++ b/test/phpunit/FactureRecTest.php @@ -131,7 +131,7 @@ class FactureRecTest extends PHPUnit_Framework_TestCase $localobjectinv=new Facture($this->savdb); $localobjectinv->initAsSpecimen(); $localobjectinv->create($user); - + $localobject=new FactureRec($this->savdb); $localobject->initAsSpecimen(); $result=$localobject->create($user, $localobjectinv->id); @@ -141,11 +141,11 @@ class FactureRecTest extends PHPUnit_Framework_TestCase return $result; } - - - - - + + + + + /** * Edit an object to test updates * @@ -196,4 +196,3 @@ class FactureRecTest extends PHPUnit_Framework_TestCase return $retAr; } } -?> \ No newline at end of file diff --git a/test/phpunit/FactureTest.php b/test/phpunit/FactureTest.php index 9551c6ce02e..a16ddbbbf47 100644 --- a/test/phpunit/FactureTest.php +++ b/test/phpunit/FactureTest.php @@ -329,4 +329,3 @@ class FactureTest extends PHPUnit_Framework_TestCase return $retAr; } } -?> diff --git a/test/phpunit/Functions2LibTest.php b/test/phpunit/Functions2LibTest.php index 8e4bfe7550f..969810cb314 100755 --- a/test/phpunit/Functions2LibTest.php +++ b/test/phpunit/Functions2LibTest.php @@ -130,7 +130,7 @@ class Functions2LibTest extends PHPUnit_Framework_TestCase } /** - * isValidMailDomain + * testIsValidMailDomain * * @return void */ @@ -140,18 +140,109 @@ class Functions2LibTest extends PHPUnit_Framework_TestCase } /** - * isValidURL + * testIsValidURL * * @return void */ public function testIsValidUrl() { - $result=isValidUrl('http://www.google.com',1); - print __METHOD__." result=".$result."\n"; - $this->assertEquals(1,$result); - $result=isValidUrl('www.google.com',2); - print __METHOD__." result=".$result."\n"; - $this->assertEquals(0,$result); + //Simple check + $result = isValidUrl('http://google.com'); + $this->assertEquals(1, $result); + + $result = isValidUrl('goo=gle'); // This is good, it might be an alias of hostname + $this->assertEquals(1, $result); + + //With scheme check + $result = isValidUrl('http://www.google.com', 1); + $this->assertEquals(1, $result); + + $result = isValidUrl('ftp://www.google.com', 1); + $this->assertEquals(0, $result); + + //With password check invalid. This test should be ko but currently it is not + //$result = isValidUrl('http://user:password@http://www.google.com', 1, 1); + //$this->assertEquals(0, $result); + + //With password check valid + $result = isValidUrl('http://user:password@www.google.com', 1, 1); + $this->assertEquals(1, $result); + + $result = isValidUrl('http://www.google.com', 1, 1); + $this->assertEquals(0, $result); + + //With port check + $result = isValidUrl('http://google.com:8080', 0, 0, 1); + $this->assertEquals(1, $result); + + $result = isValidUrl('http://google.com', 0, 0, 1); + $this->assertEquals(0, $result); + + //With path check + $result = isValidUrl('http://google.com/search', 0, 0, 0, 1); + $this->assertEquals(1, $result); + + $result = isValidUrl('http://google.com', 0, 0, 0, 0); + $this->assertEquals(1, $result); + + //With query check + $result = isValidUrl('http://google.com/search?test=test', 0, 0, 0, 0, 1); + $this->assertEquals(1, $result); + + //With query check + $result = isValidUrl('http://google.com?test=test', 0, 0, 0, 0, 1); + $this->assertEquals(1, $result); + + $result = isValidUrl('http://google.com', 0, 0, 0, 0, 1); + $this->assertEquals(0, $result); + + //With anchor check + $result = isValidUrl('http://google.com/search#done', 0, 0, 0, 0, 0, 1); + $this->assertEquals(1, $result); + + $result = isValidUrl('http://google.com/search', 0, 0, 0, 0, 0, 1); + $this->assertEquals(0, $result); } + /** + * testIsIP + * + * @return void + */ + public function testIsIP() + { + // Not valid + $ip='a299.299.299.299'; + $result=is_ip($ip); + print __METHOD__." for ".$ip." result=".$result."\n"; + $this->assertEquals(0,$result,$ip); + + // Reserved IP range (not checked by is_ip function) + $ip='169.254.0.0'; + $result=is_ip($ip); + print __METHOD__." for ".$ip." result=".$result."\n"; + $this->assertEquals(0,$result,$ip); + + $ip='1.2.3.4'; + $result=is_ip($ip); + print __METHOD__." for ".$ip." result=".$result."\n"; + $this->assertEquals(1,$result,$ip); + + // Private IP ranges + $ip='10.0.0.0'; + $result=is_ip($ip); + print __METHOD__." for ".$ip." result=".$result."\n"; + $this->assertEquals(2,$result,$ip); + + $ip='172.16.0.0'; + $result=is_ip($ip); + print __METHOD__." for ".$ip." result=".$result."\n"; + $this->assertEquals(2,$result,$ip); + + $ip='192.168.0.0'; + $result=is_ip($ip); + print __METHOD__." for ".$ip." result=".$result."\n"; + $this->assertEquals(2,$result,$ip); + + } } diff --git a/test/phpunit/FunctionsLibTest.php b/test/phpunit/FunctionsLibTest.php index 2178ad6fb5a..75877895e52 100755 --- a/test/phpunit/FunctionsLibTest.php +++ b/test/phpunit/FunctionsLibTest.php @@ -558,22 +558,26 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase */ public function testImgPicto() { - $s=img_picto('alt','user'); + $s=img_picto('title','user'); print __METHOD__." s=".$s."\n"; $this->assertContains('theme',$s,'testImgPicto1'); - $s=img_picto('alt','img.png','style="float: right"',0); + $s=img_picto('title','img.png','style="float: right"',0); print __METHOD__." s=".$s."\n"; $this->assertContains('theme',$s,'testImgPicto2'); $this->assertContains('style="float: right"',$s,'testImgPicto2'); - $s=img_picto('alt','/fullpath/img.png','',1); + $s=img_picto('title','/fullpath/img.png','',1); print __METHOD__." s=".$s."\n"; - $this->assertEquals($s,'alt','testImgPicto3'); + $this->assertEquals('',$s,'testImgPicto3'); - $s=img_picto('alt','/fullpath/img.png','',true); + $s=img_picto('title','/fullpath/img.png','',true); print __METHOD__." s=".$s."\n"; - $this->assertEquals($s,'alt','testImgPicto3'); + $this->assertEquals('',$s,'testImgPicto4'); + + $s=img_picto('title:alt','/fullpath/img.png','',true); + print __METHOD__." s=".$s."\n"; + $this->assertEquals('alt',$s,'testImgPicto5'); } /** @@ -783,5 +787,26 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase $this->assertEquals('{"AA":"B\/B","CC":"","EE":"FF","HH":"GG;"}',json_encode($tmp)); } + /** + * dol_nl2br + * + * @return void + */ + public function testDolNl2Br() { + + //String to encode + $string = "a\na"; + + $this->assertEquals(dol_nl2br($string), "a
\na"); + + //With $forxml parameter + $this->assertEquals(dol_nl2br($string, 0, 1), "a
\na"); + + //Replacing \n by br + $this->assertEquals(dol_nl2br($string, 1), "a
a"); + + //With $forxml parameter + $this->assertEquals(dol_nl2br($string, 1, 1), "a
a"); + } + } -?> diff --git a/test/phpunit/JsonLibTest.php b/test/phpunit/JsonLibTest.php index caceb6d0dc3..1a7127c69b1 100755 --- a/test/phpunit/JsonLibTest.php +++ b/test/phpunit/JsonLibTest.php @@ -27,7 +27,6 @@ global $conf,$user,$langs,$db; //define('TEST_DB_FORCE_TYPE','mysql'); // This is to force using mysql driver //require_once 'PHPUnit/Autoload.php'; require_once dirname(__FILE__).'/../../htdocs/master.inc.php'; -require_once dirname(__FILE__).'/../../htdocs/core/lib/json.lib.php'; if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); diff --git a/test/phpunit/PropalTest.php b/test/phpunit/PropalTest.php index 3cac847a01f..20b6a5afa38 100644 --- a/test/phpunit/PropalTest.php +++ b/test/phpunit/PropalTest.php @@ -265,4 +265,3 @@ class PropalTest extends PHPUnit_Framework_TestCase } } -?> diff --git a/test/phpunit/SocieteTest.php b/test/phpunit/SocieteTest.php index 162248f2e98..730d3d457a2 100755 --- a/test/phpunit/SocieteTest.php +++ b/test/phpunit/SocieteTest.php @@ -456,4 +456,3 @@ class SocieteTest extends PHPUnit_Framework_TestCase } } -?> diff --git a/test/phpunit/SqlTest.php b/test/phpunit/SqlTest.php index b2c9409d653..251709f8471 100755 --- a/test/phpunit/SqlTest.php +++ b/test/phpunit/SqlTest.php @@ -139,25 +139,31 @@ class SqlTest extends PHPUnit_Framework_TestCase $langs=$this->savlangs; $db=$this->savdb; - $filesarray = scandir(DOL_DOCUMENT_ROOT.'/install/mysql/tables'); - foreach($filesarray as $key => $file) + $listofsqldir = array(DOL_DOCUMENT_ROOT.'/install/mysql/tables', DOL_DOCUMENT_ROOT.'/install/mysql/migration'); + + foreach ($listofsqldir as $dir) { - if (! preg_match('/\.sql$/',$file)) continue; + print 'Process dir '.$dir."\n"; + $filesarray = scandir($dir); + foreach($filesarray as $key => $file) + { + if (! preg_match('/\.sql$/',$file)) continue; - print 'Check sql file '.$file."\n"; - $filecontent=file_get_contents(DOL_DOCUMENT_ROOT.'/install/mysql/tables/'.$file); + print 'Check sql file '.$file."\n"; + $filecontent=file_get_contents($dir.'/'.$file); - $result=strpos($filecontent,'`'); - print __METHOD__." Result for checking we don't have back quote = ".$result."\n"; - $this->assertTrue($result===false, 'Found ON back quote. Bad.'); + $result=strpos($filecontent,'`'); + print __METHOD__." Result for checking we don't have back quote = ".$result."\n"; + $this->assertTrue($result===false, 'Found back quote into '.$file.'. Bad.'); - $result=strpos($filecontent,'int('); - print __METHOD__." Result for checking we don't have 'int(' instead of 'integer' = ".$result."\n"; - $this->assertTrue($result===false, 'Found int(x) instead of integer. Bad.'); + $result=strpos($filecontent,'int('); + print __METHOD__." Result for checking we don't have 'int(' instead of 'integer' = ".$result."\n"; + $this->assertTrue($result===false, 'Found int(x) instead of integer into '.$file.'. Bad.'); - $result=strpos($filecontent,'ON DELETE CASCADE'); - print __METHOD__." Result for checking we don't have 'ON DELETE CASCADE' = ".$result."\n"; - $this->assertTrue($result===false, 'Found ON DELETE CASCADE. Bad.'); + $result=strpos($filecontent,'ON DELETE CASCADE'); + print __METHOD__." Result for checking we don't have 'ON DELETE CASCADE' = ".$result."\n"; + $this->assertTrue($result===false, 'Found ON DELETE CASCADE into '.$file.'. Bad.'); + } } return; diff --git a/test/phpunit/UserTest.php b/test/phpunit/UserTest.php index d161b3ce395..5df1549ea14 100644 --- a/test/phpunit/UserTest.php +++ b/test/phpunit/UserTest.php @@ -318,4 +318,3 @@ class UserTest extends PHPUnit_Framework_TestCase return $retAr; } } -?> \ No newline at end of file diff --git a/test/phpunit/WebservicesInvoicesTest.php b/test/phpunit/WebservicesInvoicesTest.php index 12c01eeba70..20e01595375 100755 --- a/test/phpunit/WebservicesInvoicesTest.php +++ b/test/phpunit/WebservicesInvoicesTest.php @@ -181,4 +181,3 @@ class WebservicesInvoicesTest extends PHPUnit_Framework_TestCase } } -?> diff --git a/test/phpunit/WebservicesThirdpartyTest.php b/test/phpunit/WebservicesThirdpartyTest.php index 8ef0c383955..64753dcc502 100755 --- a/test/phpunit/WebservicesThirdpartyTest.php +++ b/test/phpunit/WebservicesThirdpartyTest.php @@ -181,4 +181,3 @@ class WebservicesThirdpartyTest extends PHPUnit_Framework_TestCase } } -?>