From ddf98055a33f4852f42e4c24529ccf8053f924a9 Mon Sep 17 00:00:00 2001 From: Dennis Priskorn Date: Sat, 19 Jun 2021 13:45:20 +0200 Subject: [PATCH 001/610] Update README.md List missing features for the REST API --- README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/README.md b/README.md index b7cbe471426..fdfbbb5a4a2 100644 --- a/README.md +++ b/README.md @@ -220,6 +220,17 @@ These are features that Dolibarr does **not** yet fully support: - Payroll module - No native embedded Webmail, but you can send email to contacts in Dolibarr with e.g. offers, invoices, etc. - Dolibarr can't do coffee (yet) +- The REST API currently cannot: + - Update a supplier order + - Get tickets + - Add new ledger entry + - Output extrafields when getting orders + - Get virtual products (aka lots) + - Add special taxcodes to a line on a supplier invoice + - Get or post shipments + - Do updating or inserting of extrafields on any objects + - Add an image to a product + - Add multiprices to products ## DOCUMENTATION From f56c26a2142444022628c5fa9931b3eeb47e3670 Mon Sep 17 00:00:00 2001 From: Dennis Priskorn Date: Fri, 2 Jul 2021 13:00:29 +0200 Subject: [PATCH 002/610] Update README.md Removed a few and added issue links to the rest --- README.md | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index fdfbbb5a4a2..0d0e2d89d00 100644 --- a/README.md +++ b/README.md @@ -221,16 +221,13 @@ These are features that Dolibarr does **not** yet fully support: - No native embedded Webmail, but you can send email to contacts in Dolibarr with e.g. offers, invoices, etc. - Dolibarr can't do coffee (yet) - The REST API currently cannot: - - Update a supplier order - - Get tickets - - Add new ledger entry - - Output extrafields when getting orders - - Get virtual products (aka lots) - - Add special taxcodes to a line on a supplier invoice - - Get or post shipments - - Do updating or inserting of extrafields on any objects - - Add an image to a product - - Add multiprices to products + - Add new ledger entry [#14675](https://github.com/Dolibarr/dolibarr/issues/14675) + - Get virtual products (aka lots) [#14457](https://github.com/Dolibarr/dolibarr/issues/14457) + - Add special taxcodes to a line on a supplier invoice (vat_src_code) [#14404](https://github.com/Dolibarr/dolibarr/issues/14404) + - Get or post shipments on customer orders [#18074](https://github.com/Dolibarr/dolibarr/issues/18074) + - Get or post shipments on supplier orders [#14334](https://github.com/Dolibarr/dolibarr/issues/14334) + - Add an image to a product [#14262](https://github.com/Dolibarr/dolibarr/issues/14262) + - Add multiprices to products [#12812](https://github.com/Dolibarr/dolibarr/issues/12812) ## DOCUMENTATION From d601f621943173642b393ba6e32979792a553bb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 23 Nov 2021 21:38:29 +0100 Subject: [PATCH 003/610] can merge products but experimental --- htdocs/categories/class/categorie.class.php | 17 ++ htdocs/comm/propal/class/propal.class.php | 18 +- htdocs/commande/class/commande.class.php | 17 ++ .../facture/class/facture-rec.class.php | 17 ++ htdocs/compta/facture/class/facture.class.php | 17 ++ htdocs/contrat/class/contrat.class.php | 17 ++ htdocs/core/class/commonobject.class.php | 33 +++- htdocs/delivery/class/delivery.class.php | 17 ++ htdocs/expedition/class/expedition.class.php | 17 ++ htdocs/fichinter/class/fichinter.class.php | 17 ++ htdocs/fichinter/class/fichinterrec.class.php | 18 +- .../class/fournisseur.commande.class.php | 17 ++ htdocs/langs/en_US/products.lang | 4 + htdocs/product/card.php | 185 ++++++++++++++++++ htdocs/product/class/product.class.php | 3 +- 15 files changed, 408 insertions(+), 6 deletions(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 9a449d63700..0aee9cbfc81 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -1947,6 +1947,23 @@ class Categorie extends CommonObject return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables, 1); } + /** + * Function used to replace a product id with another one. + * + * @param DoliDB $db Database handler + * @param int $origin_id Old product id + * @param int $dest_id New product id + * @return bool + */ + public static function replaceProduct(DoliDB $db, $origin_id, $dest_id) + { + $tables = array( + 'categorie_product' + ); + + return CommonObject::commonReplaceProduct($db, $origin_id, $dest_id, $tables); + } + /** * Return the addtional SQL JOIN query for filtering a list by a category * diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 2f055f54a42..6b9b259fd52 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -3740,8 +3740,24 @@ class Propal extends CommonObject return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables); } -} + /** + * Function used to replace a product id with another one. + * + * @param DoliDB $db Database handler + * @param int $origin_id Old product id + * @param int $dest_id New product id + * @return bool + */ + public static function replaceProduct(DoliDB $db, $origin_id, $dest_id) + { + $tables = array( + 'propaldet' + ); + + return CommonObject::commonReplaceProduct($db, $origin_id, $dest_id, $tables); + } +} /** * Class to manage commercial proposal lines diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 9b315698527..0fe8d52cd1d 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -3999,6 +3999,23 @@ class Commande extends CommonOrder return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables); } + /** + * Function used to replace a product id with another one. + * + * @param DoliDB $db Database handler + * @param int $origin_id Old product id + * @param int $dest_id New product id + * @return bool + */ + public static function replaceProduct(DoliDB $db, $origin_id, $dest_id) + { + $tables = array( + 'commandedet', + ); + + return CommonObject::commonReplaceProduct($db, $origin_id, $dest_id, $tables); + } + /** * Is the customer order delayed? * diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 100334e046a..c868e1e9992 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -1725,6 +1725,23 @@ class FactureRec extends CommonInvoice return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables); } + /** + * Function used to replace a product id with another one. + * + * @param DoliDB $db Database handler + * @param int $origin_id Old product id + * @param int $dest_id New product id + * @return bool + */ + public static function replaceProduct(DoliDB $db, $origin_id, $dest_id) + { + $tables = array( + 'facturedet_rec' + ); + + return CommonObject::commonReplaceProduct($db, $origin_id, $dest_id, $tables); + } + /** * Update frequency and unit * diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 649b7b0c093..ffa520b1284 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -4738,6 +4738,23 @@ class Facture extends CommonInvoice return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables); } + /** + * Function used to replace a product id with another one. + * + * @param DoliDB $db Database handler + * @param int $origin_id Old product id + * @param int $dest_id New product id + * @return bool + */ + public static function replaceProduct(DoliDB $db, $origin_id, $dest_id) + { + $tables = array( + 'facturedet' + ); + + return CommonObject::commonReplaceProduct($db, $origin_id, $dest_id, $tables); + } + /** * Is the customer invoice delayed? * diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index fe8edd30ea4..cb97e6bc895 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -2459,6 +2459,23 @@ class Contrat extends CommonObject return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables); } + /** + * Function used to replace a product id with another one. + * + * @param DoliDB $db Database handler + * @param int $origin_id Old product id + * @param int $dest_id New product id + * @return bool + */ + public static function replaceProduct(DoliDB $db, $origin_id, $dest_id) + { + $tables = array( + 'contratdet' + ); + + return CommonObject::commonReplaceProduct($db, $origin_id, $dest_id, $tables); + } + /** * Load an object from its id and create a new one in database * diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 5dd392ad065..601457aba71 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -7990,7 +7990,7 @@ abstract class CommonObject /** * Function used to replace a thirdparty id with another one. - * This function is meant to be called from replaceThirdparty with the appropiate tables + * This function is meant to be called from replaceThirdparty with the appropriate tables * Column name fk_soc MUST be used to identify thirdparties * * @param DoliDB $db Database handler @@ -8007,7 +8007,36 @@ abstract class CommonObject if (!$db->query($sql)) { if ($ignoreerrors) { - return true; // TODO Not enough. If there is A-B on kept thirdarty and B-C on old one, we must get A-B-C after merge. Not A-B. + return true; // TODO Not enough. If there is A-B on kept thirdparty and B-C on old one, we must get A-B-C after merge. Not A-B. + } + //$this->errors = $db->lasterror(); + return false; + } + } + + return true; + } + + /** + * Function used to replace a product id with another one. + * This function is meant to be called from replaceProduct with the appropriate tables + * Column name fk_product MUST be used to identify products + * + * @param DoliDB $db Database handler + * @param int $origin_id Old product id (the product to delete) + * @param int $dest_id New product id (the product that will received element of the other) + * @param string[] $tables Tables that need to be changed + * @param int $ignoreerrors Ignore errors. Return true even if errors. We need this when replacement can fails like for categories (categorie of old product may already exists on new one) + * @return bool True if success, False if error + */ + public static function commonReplaceProduct(DoliDB $db, $origin_id, $dest_id, array $tables, $ignoreerrors = 0) + { + foreach ($tables as $table) { + $sql = 'UPDATE '.MAIN_DB_PREFIX.$table.' SET fk_product = '.((int) $dest_id).' WHERE fk_product = '.((int) $origin_id); + + if (!$db->query($sql)) { + if ($ignoreerrors) { + return true; // TODO Not enough. If there is A-B on kept thirdparty and B-C on old one, we must get A-B-C after merge. Not A-B. } //$this->errors = $db->lasterror(); return false; diff --git a/htdocs/delivery/class/delivery.class.php b/htdocs/delivery/class/delivery.class.php index 6bfe3a33dd7..47300702baf 100644 --- a/htdocs/delivery/class/delivery.class.php +++ b/htdocs/delivery/class/delivery.class.php @@ -1082,6 +1082,23 @@ class Delivery extends CommonObject return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables); } + + /** + * Function used to replace a product id with another one. + * + * @param DoliDB $db Database handler + * @param int $origin_id Old product id + * @param int $dest_id New product id + * @return bool + */ + public static function replaceProduct(DoliDB $db, $origin_id, $dest_id) + { + $tables = array( + 'deliverydet' + ); + + return CommonObject::commonReplaceProduct($db, $origin_id, $dest_id, $tables); + } } diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 8ef7be75f52..8218e1c6402 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -2503,6 +2503,23 @@ class Expedition extends CommonObject return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables); } + + /** + * Function used to replace a product id with another one. + * + * @param DoliDB $db Database handler + * @param int $origin_id Old product id + * @param int $dest_id New product id + * @return bool + */ + public static function replaceProduct(DoliDB $db, $origin_id, $dest_id) + { + $tables = array( + 'expeditiondet' + ); + + return CommonObject::commonReplaceProduct($db, $origin_id, $dest_id, $tables); + } } diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 297e03fa379..af5801a48fb 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -1374,6 +1374,23 @@ class Fichinter extends CommonObject return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables); } + + /** + * Function used to replace a product id with another one. + * + * @param DoliDB $db Database handler + * @param int $origin_id Old product id + * @param int $dest_id New product id + * @return bool + */ + public static function replaceProduct(DoliDB $db, $origin_id, $dest_id) + { + $tables = array( + 'fichinterdet' + ); + + return CommonObject::commonReplaceProduct($db, $origin_id, $dest_id, $tables); + } } /** diff --git a/htdocs/fichinter/class/fichinterrec.class.php b/htdocs/fichinter/class/fichinterrec.class.php index d5690265028..9557707ad84 100644 --- a/htdocs/fichinter/class/fichinterrec.class.php +++ b/htdocs/fichinter/class/fichinterrec.class.php @@ -40,7 +40,7 @@ class FichinterRec extends Fichinter { public $element = 'fichinterrec'; public $table_element = 'fichinter_rec'; - public $table_element_line = 'fichinter_rec'; + public $table_element_line = 'fichinterdet_rec'; /** * @var string Fieldname with ID of parent key if this field has a parent @@ -693,6 +693,22 @@ class FichinterRec extends Fichinter return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables); } + /** + * Function used to replace a product id with another one. + * + * @param DoliDB $db Database handler + * @param int $origin_id Old product id + * @param int $dest_id New product id + * @return bool + */ + public static function replaceProduct(DoliDB $db, $origin_id, $dest_id) + { + $tables = array( + 'fichinterdet_rec' + ); + + return CommonObject::commonReplaceProduct($db, $origin_id, $dest_id, $tables); + } /** * Update frequency and unit diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 9b68ef199db..c5788197c68 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -3191,6 +3191,23 @@ class CommandeFournisseur extends CommonOrder return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables); } + /** + * Function used to replace a product id with another one. + * + * @param DoliDB $db Database handler + * @param int $origin_id Old product id + * @param int $dest_id New product id + * @return bool + */ + public static function replaceProduct(DoliDB $db, $origin_id, $dest_id) + { + $tables = array( + 'commande_fournisseurdet' + ); + + return CommonObject::commonReplaceProduct($db, $origin_id, $dest_id, $tables); + } + /** * Is the supplier order delayed? * We suppose a purchase ordered as late if a the purchase order has been sent and the delivery date is set and before the delay. diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index 205a28980a8..f4e196d0b7e 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -408,3 +408,7 @@ mandatoryHelper=Message to the user on the need to enter a start date and an end DefaultBOM=Default BOM DefaultBOMDesc=The default BOM recommended to use to manufacture this product. This field can be set only if nature of product is '%s'. Rank=Rank +MergeOriginProduct=Duplicate product (product you want to delete) +MergeProducts=Merge products +ConfirmMergeProducts=Are you sure you want to merge the chosen product with the current one? All linked objects (invoices, orders, ...) will be moved to the current product, after which the chosen product will be deleted. +ProductsMergeSuccess=Products have been merged diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 420203eedae..06a5a4102ff 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -226,6 +226,177 @@ if (empty($reshook)) { } $action = ''; } + // merge products + if ($action == 'confirm_merge' && $confirm == 'yes' && $user->rights->societe->creer) { + $error = 0; + $productOriginId = GETPOST('product_origin', 'int'); + $productOrigin = new Product($db); + + if ($productOriginId <= 0) { + $langs->load('errors'); + setEventMessages($langs->trans('ErrorProductIdIsMandatory', $langs->transnoentitiesnoconv('MergeOriginProduct')), null, 'errors'); + } else { + if (!$error && $productOrigin->fetch($productOriginId) < 1) { + setEventMessages($langs->trans('ErrorRecordNotFound'), null, 'errors'); + $error++; + } + + if (!$error) { + // TODO Move the merge function into class of object. + $db->begin(); + + // Recopy some data + //$object->client = $object->client | $productOrigin->client; + //$object->fournisseur = $object->fournisseur | $productOrigin->fournisseur; + $listofproperties = array( + 'ref', + 'ref_ext', + 'label', + 'description', + 'url', + 'barcode', + 'fk_barcode_type', + 'import_key', + 'mandatory_period', + 'accountancy_code_buy', + 'accountancy_code_buy_intra', + 'accountancy_code_buy_export', + 'accountancy_code_sell', + 'accountancy_code_sell_intra', + 'accountancy_code_sell_export' + ); + foreach ($listofproperties as $property) { + if (empty($object->$property)) { + $object->$property = $productOrigin->$property; + } + } + // Concat some data + $listofproperties = array( + 'note_public', 'note_private' + ); + foreach ($listofproperties as $property) { + $object->$property = dol_concatdesc($object->$property, $productOrigin->$property); + } + + // Merge extrafields + if (is_array($productOrigin->array_options)) { + foreach ($productOrigin->array_options as $key => $val) { + if (empty($object->array_options[$key])) { + $object->array_options[$key] = $val; + } + } + } + + // Merge categories + $static_cat = new Categorie($db); + $custcats_ori = $static_cat->containing($productOrigin->id, 'product', 'id'); + $custcats = $static_cat->containing($object->id, 'product', 'id'); + $custcats = array_merge($custcats, $custcats_ori); + $object->setCategories($custcats); + + // If product has a new code that is same than origin, we clean origin code to avoid duplicate key from database unique keys. + if ($productOrigin->barcode == $object->barcode) { + dol_syslog("We clean customer and supplier code so we will be able to make the update of target"); + $productOrigin->barcode = ''; + //$productOrigin->update($productOrigin->id, $user, 0, 'merge'); + } + + // Update + $result = $object->update($object->id, $user, 0, 'merge'); + if ($result <= 0) { + setEventMessages($object->error, $object->errors, 'errors'); + $error++; + } + + // Move links + if (!$error) { + // This list is also into the api_products.class.php + // TODO Mutualise the list into object product.class.php + $objects = array( + 'Categorie' => '/categories/class/categorie.class.php', + 'Propal' => '/comm/propal/class/propal.class.php', + 'Commande' => '/commande/class/commande.class.php', + 'Facture' => '/compta/facture/class/facture.class.php', + 'FactureRec' => '/compta/facture/class/facture-rec.class.php', + // 'Mo' => '/mrp/class/mo.class.php', + 'Contrat' => '/contrat/class/contrat.class.php', + 'Expedition' => '/expedition/class/expedition.class.php', + 'Fichinter' => '/fichinter/class/fichinter.class.php', + 'FichinterRec' => '/fichinter/class/fichinter.class.php', + 'CommandeFournisseur' => '/fourn/class/fournisseur.commande.class.php', + // 'FactureFournisseur' => '/fourn/class/fournisseur.facture.class.php', + // 'SupplierProposal' => '/supplier_proposal/class/supplier_proposal.class.php', + // 'ProductFournisseur' => '/fourn/class/fournisseur.product.class.php', + 'Delivery' => '/delivery/class/delivery.class.php', + // 'Project' => '/projet/class/project.class.php', + // 'Ticket' => '/ticket/class/ticket.class.php', + // 'ConferenceOrBoothAttendee' => '/eventorganization/class/conferenceorboothattendee.class.php' + ); + + //First, all core objects must update their tables + foreach ($objects as $object_name => $object_file) { + require_once DOL_DOCUMENT_ROOT.$object_file; + + if (!$error && !$object_name::replaceProduct($db, $productOrigin->id, $object->id)) { + $error++; + setEventMessages($db->lasterror(), null, 'errors'); + break; + } + } + } + + // External modules should update their ones too + if (!$error) { + $reshook = $hookmanager->executeHooks( + 'replaceProduct', + array( + 'soc_origin' => $productOrigin->id, + 'soc_dest' => $object->id, + ), + $object, + $action + ); + + if ($reshook < 0) { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + $error++; + } + } + + + if (!$error) { + $object->context = array( + 'merge' => 1, + 'mergefromid' => $productOrigin->id, + ); + + // Call trigger + $result = $object->call_trigger('PRODUCT_MODIFY', $user); + if ($result < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + $error++; + } + // End call triggers + } + + if (!$error) { + // We finally remove the old product + if ($productOrigin->delete($user) < 1) { + $error++; + } + } + + if (!$error) { + setEventMessages($langs->trans('ProductsMergeSuccess'), null, 'mesgs'); + $db->commit(); + } else { + $langs->load("errors"); + setEventMessages($langs->trans('ErrorsProductsMerge'), null, 'errors'); + $db->rollback(); + } + } + } + } // Type if ($action == 'setfk_product_type' && $usercancreate) { @@ -2502,6 +2673,17 @@ if (($action == 'delete' && (empty($conf->use_javascript_ajax) || !empty($conf-> || (!empty($conf->use_javascript_ajax) && empty($conf->dol_use_jmobile))) { // Always output when not jmobile nor js $formconfirm = $form->formconfirm("card.php?id=".$object->id, $langs->trans("DeleteProduct"), $langs->trans("ConfirmDeleteProduct"), "confirm_delete", '', 0, "action-delete"); } +if ($action == 'merge') { + $formquestion = array( + array( + 'name' => 'product_origin', + 'label' => $langs->trans('MergeOriginProduct'), + 'type' => 'other', + 'value' => $form->select_produits('', 'product_origin', '', 0, 0, 1, 2, '', 1, array(), 0, 1, 0, '', 0, '', null, 1), + ) + ); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id, $langs->trans("MergeProducts"), $langs->trans("ConfirmMergeProducts"), "confirm_merge", $formquestion, 'no', 1, 250); +} // Clone confirmation if (($action == 'clone' && (empty($conf->use_javascript_ajax) || !empty($conf->dol_use_jmobile))) // Output when action = clone if jmobile or no js @@ -2569,6 +2751,9 @@ if ($action != 'create' && $action != 'edit') { } else { print ''.$langs->trans("Delete").''; } + if (getDolGlobalInt('MAIN_FEATURES_LEVEL') > 1) { + print ''.$langs->trans('Merge').''."\n"; + } } else { print ''.$langs->trans("Delete").''; } diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index a7865474014..1018f43832a 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -491,8 +491,7 @@ class Product extends CommonObject 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'index'=>0, 'position'=>1000), //'tosell' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'default'=>0, 'index'=>1, 'position'=>1000, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Active', -1=>'Cancel')), //'tobuy' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'default'=>0, 'index'=>1, 'position'=>1000, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Active', -1=>'Cancel')), - 'mandatory_period' =>array('type'=>'integer', 'label'=>'mandatory_period', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'default'=>0, 'index'=>1, 'position'=>1000), - + 'mandatory_period' => array('type'=>'integer', 'label'=>'mandatory_period', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'default'=>0, 'index'=>1, 'position'=>1000), ); /** From c56f1805153888a7a43d13ed230c9634a43c362a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 23 Nov 2021 21:52:40 +0100 Subject: [PATCH 004/610] can merge products but experimental --- htdocs/bom/class/bom.class.php | 17 +++++++++++++++++ htdocs/product/card.php | 4 ++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index fd8d4a19a75..ae352623d42 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -1078,6 +1078,23 @@ class BOM extends CommonObject } } } + + /** + * Function used to replace a product id with another one. + * + * @param DoliDB $db Database handler + * @param int $origin_id Old product id + * @param int $dest_id New product id + * @return bool + */ + public static function replaceProduct(DoliDB $db, $origin_id, $dest_id) + { + $tables = array( + 'bom_bomline' + ); + + return CommonObject::commonReplaceProduct($db, $origin_id, $dest_id, $tables); + } } diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 06a5a4102ff..41ecd4ff56c 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -318,7 +318,7 @@ if (empty($reshook)) { 'Commande' => '/commande/class/commande.class.php', 'Facture' => '/compta/facture/class/facture.class.php', 'FactureRec' => '/compta/facture/class/facture-rec.class.php', - // 'Mo' => '/mrp/class/mo.class.php', + 'Bom' => '/bom/class/bom.class.php', 'Contrat' => '/contrat/class/contrat.class.php', 'Expedition' => '/expedition/class/expedition.class.php', 'Fichinter' => '/fichinter/class/fichinter.class.php', @@ -2679,7 +2679,7 @@ if ($action == 'merge') { 'name' => 'product_origin', 'label' => $langs->trans('MergeOriginProduct'), 'type' => 'other', - 'value' => $form->select_produits('', 'product_origin', '', 0, 0, 1, 2, '', 1, array(), 0, 1, 0, '', 0, '', null, 1), + 'value' => $form->select_produits('', 'product_origin', '', 0, 0, 1, 2, '', 1, array(), 0, 1, 0, 'minwidth200', 0, '', null, 1), ) ); $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id, $langs->trans("MergeProducts"), $langs->trans("ConfirmMergeProducts"), "confirm_merge", $formquestion, 'no', 1, 250); From d9bcd277642e9c227d8c1d02a0f10aaa007ac1fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 23 Nov 2021 21:55:48 +0100 Subject: [PATCH 005/610] can merge products but experimental --- htdocs/core/class/commonobject.class.php | 2 +- htdocs/langs/en_US/products.lang | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 601457aba71..23d6e203bb5 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -8036,7 +8036,7 @@ abstract class CommonObject if (!$db->query($sql)) { if ($ignoreerrors) { - return true; // TODO Not enough. If there is A-B on kept thirdparty and B-C on old one, we must get A-B-C after merge. Not A-B. + return true; // TODO Not enough. If there is A-B on kept product and B-C on old one, we must get A-B-C after merge. Not A-B. } //$this->errors = $db->lasterror(); return false; diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index f4e196d0b7e..097ea001c48 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -412,3 +412,4 @@ MergeOriginProduct=Duplicate product (product you want to delete) MergeProducts=Merge products ConfirmMergeProducts=Are you sure you want to merge the chosen product with the current one? All linked objects (invoices, orders, ...) will be moved to the current product, after which the chosen product will be deleted. ProductsMergeSuccess=Products have been merged +ErrorsProductsMerge=Errors in products merge From 429e5cf5171c51a29f58f12beb42226896995f76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 23 Nov 2021 22:02:55 +0100 Subject: [PATCH 006/610] can merge products but experimental --- .../fourn/class/fournisseur.facture.class.php | 17 +++++++++++++++++ htdocs/product/card.php | 5 +++-- htdocs/reception/class/reception.class.php | 17 +++++++++++++++++ .../class/supplier_proposal.class.php | 18 ++++++++++++++++++ 4 files changed, 55 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index a1db1826684..dc5560093c0 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -2929,6 +2929,23 @@ class FactureFournisseur extends CommonInvoice return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables); } + /** + * Function used to replace a product id with another one. + * + * @param DoliDB $db Database handler + * @param int $origin_id Old product id + * @param int $dest_id New product id + * @return bool + */ + public static function replaceProduct(DoliDB $db, $origin_id, $dest_id) + { + $tables = array( + 'facture_fourn_det' + ); + + return CommonObject::commonReplaceProduct($db, $origin_id, $dest_id, $tables); + } + /** * Is the payment of the supplier invoice having a delay? * diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 41ecd4ff56c..c17f3290df9 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -321,11 +321,12 @@ if (empty($reshook)) { 'Bom' => '/bom/class/bom.class.php', 'Contrat' => '/contrat/class/contrat.class.php', 'Expedition' => '/expedition/class/expedition.class.php', + 'Reception' => '/reception/class/reception.class.php', 'Fichinter' => '/fichinter/class/fichinter.class.php', 'FichinterRec' => '/fichinter/class/fichinter.class.php', 'CommandeFournisseur' => '/fourn/class/fournisseur.commande.class.php', - // 'FactureFournisseur' => '/fourn/class/fournisseur.facture.class.php', - // 'SupplierProposal' => '/supplier_proposal/class/supplier_proposal.class.php', + 'FactureFournisseur' => '/fourn/class/fournisseur.facture.class.php', + 'SupplierProposal' => '/supplier_proposal/class/supplier_proposal.class.php', // 'ProductFournisseur' => '/fourn/class/fournisseur.product.class.php', 'Delivery' => '/delivery/class/delivery.class.php', // 'Project' => '/projet/class/project.class.php', diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index 954e7f192cd..fadf013670e 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -1949,4 +1949,21 @@ class Reception extends CommonObject return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables); } + + /** + * Function used to replace a product id with another one. + * + * @param DoliDB $db Database handler + * @param int $origin_id Old product id + * @param int $dest_id New product id + * @return bool + */ + public static function replaceProduct(DoliDB $db, $origin_id, $dest_id) + { + $tables = array( + 'commande_fournisseur_dispatch' + ); + + return CommonObject::commonReplaceProduct($db, $origin_id, $dest_id, $tables); + } } diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 9c84e2c2e89..f5b1b44bd85 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -2681,6 +2681,24 @@ class SupplierProposal extends CommonObject return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables); } + + /** + * Function used to replace a product id with another one. + * + * @param DoliDB $db Database handler + * @param int $origin_id Old product id + * @param int $dest_id New product id + * @return bool + */ + public static function replaceProduct(DoliDB $db, $origin_id, $dest_id) + { + $tables = array( + 'supplier_proposaldet' + ); + + return CommonObject::commonReplaceProduct($db, $origin_id, $dest_id, $tables); + } + } From 799862362d07a6f5617b4b0c7846cbceebab2a1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 23 Nov 2021 22:03:46 +0100 Subject: [PATCH 007/610] can merge products but experimental --- htdocs/supplier_proposal/class/supplier_proposal.class.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index f5b1b44bd85..9c4818edfec 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -2698,7 +2698,6 @@ class SupplierProposal extends CommonObject return CommonObject::commonReplaceProduct($db, $origin_id, $dest_id, $tables); } - } From 99cddfa235feb2d6e07410d5a8188103ad070998 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 23 Nov 2021 22:36:14 +0100 Subject: [PATCH 008/610] can merge products but experimental --- htdocs/compta/bank/class/account.class.php | 2 +- .../fourn/class/fournisseur.product.class.php | 17 +++++++++++++++++ htdocs/product/card.php | 10 +++------- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 685c78f5f1b..d8115e48cac 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -1708,7 +1708,7 @@ class Account extends CommonObject if ($dbs->query($sql)) { return true; } else { - //if ($ignoreerrors) return true; // TODO Not enough. If there is A-B on kept thirdarty and B-C on old one, we must get A-B-C after merge. Not A-B. + //if ($ignoreerrors) return true; // TODO Not enough. If there is A-B on kept thirdparty and B-C on old one, we must get A-B-C after merge. Not A-B. //$this->errors = $dbs->lasterror(); return false; } diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index 5b523d8d7e8..f1487c7d8be 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -978,6 +978,23 @@ class ProductFournisseur extends Product return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables); } + /** + * Function used to replace a product id with another one. + * + * @param DoliDB $db Database handler + * @param int $origin_id Old product id + * @param int $dest_id New product id + * @return bool + */ + public static function replaceProduct(DoliDB $db, $origin_id, $dest_id) + { + $tables = array( + 'product_fournisseur_price' + ); + + return CommonObject::commonReplaceProduct($db, $origin_id, $dest_id, $tables); + } + /** * List supplier prices log of a supplier price * diff --git a/htdocs/product/card.php b/htdocs/product/card.php index c17f3290df9..25503bdbf60 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -246,8 +246,6 @@ if (empty($reshook)) { $db->begin(); // Recopy some data - //$object->client = $object->client | $productOrigin->client; - //$object->fournisseur = $object->fournisseur | $productOrigin->fournisseur; $listofproperties = array( 'ref', 'ref_ext', @@ -310,7 +308,7 @@ if (empty($reshook)) { // Move links if (!$error) { - // This list is also into the api_products.class.php + // TODO add this functionality into the api_products.class.php // TODO Mutualise the list into object product.class.php $objects = array( 'Categorie' => '/categories/class/categorie.class.php', @@ -327,11 +325,8 @@ if (empty($reshook)) { 'CommandeFournisseur' => '/fourn/class/fournisseur.commande.class.php', 'FactureFournisseur' => '/fourn/class/fournisseur.facture.class.php', 'SupplierProposal' => '/supplier_proposal/class/supplier_proposal.class.php', - // 'ProductFournisseur' => '/fourn/class/fournisseur.product.class.php', + 'ProductFournisseur' => '/fourn/class/fournisseur.product.class.php', 'Delivery' => '/delivery/class/delivery.class.php', - // 'Project' => '/projet/class/project.class.php', - // 'Ticket' => '/ticket/class/ticket.class.php', - // 'ConferenceOrBoothAttendee' => '/eventorganization/class/conferenceorboothattendee.class.php' ); //First, all core objects must update their tables @@ -382,6 +377,7 @@ if (empty($reshook)) { if (!$error) { // We finally remove the old product + // TODO merge attached files from old product into new one before delete if ($productOrigin->delete($user) < 1) { $error++; } From 6cbc3c60334587b676dac8a62148cea31c110e6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 23 Nov 2021 22:55:35 +0100 Subject: [PATCH 009/610] clean code --- htdocs/categories/class/categorie.class.php | 17 ----------------- htdocs/expedition/class/expedition.class.php | 17 ----------------- htdocs/product/card.php | 4 ++-- 3 files changed, 2 insertions(+), 36 deletions(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 0aee9cbfc81..9a449d63700 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -1947,23 +1947,6 @@ class Categorie extends CommonObject return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables, 1); } - /** - * Function used to replace a product id with another one. - * - * @param DoliDB $db Database handler - * @param int $origin_id Old product id - * @param int $dest_id New product id - * @return bool - */ - public static function replaceProduct(DoliDB $db, $origin_id, $dest_id) - { - $tables = array( - 'categorie_product' - ); - - return CommonObject::commonReplaceProduct($db, $origin_id, $dest_id, $tables); - } - /** * Return the addtional SQL JOIN query for filtering a list by a category * diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 8218e1c6402..8ef7be75f52 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -2503,23 +2503,6 @@ class Expedition extends CommonObject return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables); } - - /** - * Function used to replace a product id with another one. - * - * @param DoliDB $db Database handler - * @param int $origin_id Old product id - * @param int $dest_id New product id - * @return bool - */ - public static function replaceProduct(DoliDB $db, $origin_id, $dest_id) - { - $tables = array( - 'expeditiondet' - ); - - return CommonObject::commonReplaceProduct($db, $origin_id, $dest_id, $tables); - } } diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 25503bdbf60..874930d2ca9 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -311,14 +311,14 @@ if (empty($reshook)) { // TODO add this functionality into the api_products.class.php // TODO Mutualise the list into object product.class.php $objects = array( - 'Categorie' => '/categories/class/categorie.class.php', + // do not use Categorie, it cause foreign key error, merge is done before + //'Categorie' => '/categories/class/categorie.class.php', 'Propal' => '/comm/propal/class/propal.class.php', 'Commande' => '/commande/class/commande.class.php', 'Facture' => '/compta/facture/class/facture.class.php', 'FactureRec' => '/compta/facture/class/facture-rec.class.php', 'Bom' => '/bom/class/bom.class.php', 'Contrat' => '/contrat/class/contrat.class.php', - 'Expedition' => '/expedition/class/expedition.class.php', 'Reception' => '/reception/class/reception.class.php', 'Fichinter' => '/fichinter/class/fichinter.class.php', 'FichinterRec' => '/fichinter/class/fichinter.class.php', From 21a3a6cc7a145398308a10bd8de4d8e434f4b478 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 23 Nov 2021 23:55:01 +0100 Subject: [PATCH 010/610] clean code --- htdocs/core/class/commonobject.class.php | 2 ++ htdocs/fichinter/class/fichinter.class.php | 17 ----------------- htdocs/product/card.php | 3 +-- 3 files changed, 3 insertions(+), 19 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 23d6e203bb5..ab988d11db2 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -8038,6 +8038,8 @@ abstract class CommonObject if ($ignoreerrors) { return true; // TODO Not enough. If there is A-B on kept product and B-C on old one, we must get A-B-C after merge. Not A-B. } + print $sql; + //$this->errors = $db->lasterror(); return false; } diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index af5801a48fb..297e03fa379 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -1374,23 +1374,6 @@ class Fichinter extends CommonObject return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables); } - - /** - * Function used to replace a product id with another one. - * - * @param DoliDB $db Database handler - * @param int $origin_id Old product id - * @param int $dest_id New product id - * @return bool - */ - public static function replaceProduct(DoliDB $db, $origin_id, $dest_id) - { - $tables = array( - 'fichinterdet' - ); - - return CommonObject::commonReplaceProduct($db, $origin_id, $dest_id, $tables); - } } /** diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 874930d2ca9..ff73dff45c9 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -320,8 +320,7 @@ if (empty($reshook)) { 'Bom' => '/bom/class/bom.class.php', 'Contrat' => '/contrat/class/contrat.class.php', 'Reception' => '/reception/class/reception.class.php', - 'Fichinter' => '/fichinter/class/fichinter.class.php', - 'FichinterRec' => '/fichinter/class/fichinter.class.php', + 'FichinterRec' => '/fichinter/class/fichinterrec.class.php', 'CommandeFournisseur' => '/fourn/class/fournisseur.commande.class.php', 'FactureFournisseur' => '/fourn/class/fournisseur.facture.class.php', 'SupplierProposal' => '/supplier_proposal/class/supplier_proposal.class.php', From 3301790647112734ade5fdf8e38bddd3b32e8230 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 23 Nov 2021 23:56:52 +0100 Subject: [PATCH 011/610] clean code --- htdocs/core/class/commonobject.class.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index ab988d11db2..23d6e203bb5 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -8038,8 +8038,6 @@ abstract class CommonObject if ($ignoreerrors) { return true; // TODO Not enough. If there is A-B on kept product and B-C on old one, we must get A-B-C after merge. Not A-B. } - print $sql; - //$this->errors = $db->lasterror(); return false; } From ebc54f82e66710cfdeb17434d966fd1d50b4b633 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 24 Nov 2021 18:16:48 +0100 Subject: [PATCH 012/610] move actioncomm --- htdocs/comm/action/class/actioncomm.class.php | 20 +++++++++++++++++++ htdocs/product/card.php | 18 +++++++++-------- 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 3e2520f43da..bcfb15b932f 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -2203,6 +2203,26 @@ class ActionComm extends CommonObject return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables); } + /** + * Function used to replace a product id with another one. + * + * @param DoliDB $db Database handler + * @param int $origin_id Old product id + * @param int $dest_id New product id + * @return bool + */ + public static function replaceProduct(DoliDB $db, $origin_id, $dest_id) + { + $sql = 'UPDATE ' . MAIN_DB_PREFIX . 'actioncomm SET fk_element = ' . ((int) $dest_id) . ' WHERE elementtype="product" AND fk_element = '.((int) $origin_id); + + if (!$db->query($sql)) { + //$this->errors = $db->lasterror(); + return false; + } + + return true; + } + /** * Is the action delayed? * diff --git a/htdocs/product/card.php b/htdocs/product/card.php index ff73dff45c9..625d94e6566 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -311,21 +311,23 @@ if (empty($reshook)) { // TODO add this functionality into the api_products.class.php // TODO Mutualise the list into object product.class.php $objects = array( + 'ActionComm' => '/comm/action/class/actioncomm.class.php', + 'Bom' => '/bom/class/bom.class.php', // do not use Categorie, it cause foreign key error, merge is done before //'Categorie' => '/categories/class/categorie.class.php', - 'Propal' => '/comm/propal/class/propal.class.php', 'Commande' => '/commande/class/commande.class.php', - 'Facture' => '/compta/facture/class/facture.class.php', - 'FactureRec' => '/compta/facture/class/facture-rec.class.php', - 'Bom' => '/bom/class/bom.class.php', - 'Contrat' => '/contrat/class/contrat.class.php', - 'Reception' => '/reception/class/reception.class.php', - 'FichinterRec' => '/fichinter/class/fichinterrec.class.php', 'CommandeFournisseur' => '/fourn/class/fournisseur.commande.class.php', + 'Contrat' => '/contrat/class/contrat.class.php', + 'Delivery' => '/delivery/class/delivery.class.php', + 'Facture' => '/compta/facture/class/facture.class.php', 'FactureFournisseur' => '/fourn/class/fournisseur.facture.class.php', + 'FactureRec' => '/compta/facture/class/facture-rec.class.php', + 'FichinterRec' => '/fichinter/class/fichinterrec.class.php', 'SupplierProposal' => '/supplier_proposal/class/supplier_proposal.class.php', 'ProductFournisseur' => '/fourn/class/fournisseur.product.class.php', - 'Delivery' => '/delivery/class/delivery.class.php', + 'Propal' => '/comm/propal/class/propal.class.php', + 'Reception' => '/reception/class/reception.class.php', + 'SupplierProposal' => '/supplier_proposal/class/supplier_proposal.class.php', ); //First, all core objects must update their tables From 38f2a2ca430ef58385233b73023497de773567b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 24 Nov 2021 18:19:59 +0100 Subject: [PATCH 013/610] move actioncomm --- htdocs/product/card.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 625d94e6566..063e6d04f09 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -323,7 +323,6 @@ if (empty($reshook)) { 'FactureFournisseur' => '/fourn/class/fournisseur.facture.class.php', 'FactureRec' => '/compta/facture/class/facture-rec.class.php', 'FichinterRec' => '/fichinter/class/fichinterrec.class.php', - 'SupplierProposal' => '/supplier_proposal/class/supplier_proposal.class.php', 'ProductFournisseur' => '/fourn/class/fournisseur.product.class.php', 'Propal' => '/comm/propal/class/propal.class.php', 'Reception' => '/reception/class/reception.class.php', From 661e404a14500b7185a7852ec46a70f622cd57ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 24 Nov 2021 22:56:32 +0100 Subject: [PATCH 014/610] fix tests --- htdocs/comm/action/class/actioncomm.class.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index bcfb15b932f..e2f78e82c99 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -2206,17 +2206,17 @@ class ActionComm extends CommonObject /** * Function used to replace a product id with another one. * - * @param DoliDB $db Database handler + * @param DoliDB $dbs Database handler * @param int $origin_id Old product id * @param int $dest_id New product id * @return bool */ - public static function replaceProduct(DoliDB $db, $origin_id, $dest_id) + public static function replaceProduct(DoliDB $dbs, $origin_id, $dest_id) { $sql = 'UPDATE ' . MAIN_DB_PREFIX . 'actioncomm SET fk_element = ' . ((int) $dest_id) . ' WHERE elementtype="product" AND fk_element = '.((int) $origin_id); - - if (!$db->query($sql)) { - //$this->errors = $db->lasterror(); + // using $dbs, not $this->db because function is static + if (!$dbs->query($sql)) { + //$this->errors = $dbs->lasterror(); return false; } From efc0251a66ad35d1bcbd4511aa36ed1791277058 Mon Sep 17 00:00:00 2001 From: lvessiller Date: Mon, 6 Dec 2021 11:40:50 +0100 Subject: [PATCH 015/610] FIX can modify tag in thirdparty card if const THIRDPARTY_CAN_HAVE_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT_SUPPLIER enabled --- htdocs/societe/card.php | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 052d681b0a0..9a6e0888b8c 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -1126,13 +1126,14 @@ else document.formsoc.private.value=1; }); + var canHaveCategoryIfNotCustomerProspectSupplier = ' . (empty($conf->global->THIRDPARTY_CAN_HAVE_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT_SUPPLIER) ? '0' : '1') . '; init_customer_categ(); $("#customerprospect").change(function() { init_customer_categ(); }); function init_customer_categ() { console.log("is customer or prospect = "+jQuery("#customerprospect").val()); - if (jQuery("#customerprospect").val() == 0 && (jQuery("#fournisseur").val() == 0 || ' . (empty($conf->global->THIRDPARTY_CAN_HAVE_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT_SUPPLIER) ? '1' : '0').')) + if (jQuery("#customerprospect").val() == 0 && (jQuery("#fournisseur").val() != 0 || !canHaveCategoryIfNotCustomerProspectSupplier)) { jQuery(".visibleifcustomer").hide(); } @@ -1151,10 +1152,16 @@ else if (jQuery("#fournisseur").val() == 0) { jQuery(".visibleifsupplier").hide(); + if (jQuery("#customerprospect").val() == 0 && canHaveCategoryIfNotCustomerProspectSupplier && jQuery(".visibleifcustomer").is(":hidden")) { + jQuery(".visibleifcustomer").show(); + } } else { jQuery(".visibleifsupplier").show(); + if (jQuery("#customerprospect").val() == 0 && jQuery(".visibleifcustomer").is(":visible")) { + jQuery(".visibleifcustomer").hide(); + } } } @@ -1769,13 +1776,14 @@ else } }); + var canHaveCategoryIfNotCustomerProspectSupplier = ' . (empty($conf->global->THIRDPARTY_CAN_HAVE_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT_SUPPLIER) ? '0' : '1') . '; init_customer_categ(); $("#customerprospect").change(function() { init_customer_categ(); }); function init_customer_categ() { console.log("is customer or prospect = "+jQuery("#customerprospect").val()); - if (jQuery("#customerprospect").val() == 0 && (jQuery("#fournisseur").val() == 0 || '.(empty($conf->global->THIRDPARTY_CAN_HAVE_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT_SUPPLIER) ? '1' : '0').')) + if (jQuery("#customerprospect").val() == 0 && (jQuery("#fournisseur").val() != 0 || !canHaveCategoryIfNotCustomerProspectSupplier)) { jQuery(".visibleifcustomer").hide(); } @@ -1794,10 +1802,16 @@ else if (jQuery("#fournisseur").val() == 0) { jQuery(".visibleifsupplier").hide(); + if (jQuery("#customerprospect").val() == 0 && canHaveCategoryIfNotCustomerProspectSupplier && jQuery(".visibleifcustomer").is(":hidden")) { + jQuery(".visibleifcustomer").show(); + } } else { jQuery(".visibleifsupplier").show(); + if (jQuery("#customerprospect").val() == 0 && jQuery(".visibleifcustomer").is(":visible")) { + jQuery(".visibleifcustomer").hide(); + } } }; From 03d43173020ef87fe0fdd7696ad64d02f755e831 Mon Sep 17 00:00:00 2001 From: Christian Foellmann Date: Tue, 26 Oct 2021 18:26:36 +0200 Subject: [PATCH 016/610] add hook 'menuDropdownQuickaddItems' to manipulate dropdown menu --- htdocs/core/class/hookmanager.class.php | 1 + htdocs/main.inc.php | 319 +++++++++++------------- htdocs/theme/eldy/dropdown.inc.php | 10 +- 3 files changed, 158 insertions(+), 172 deletions(-) diff --git a/htdocs/core/class/hookmanager.class.php b/htdocs/core/class/hookmanager.class.php index d1b1e08710e..82772418b36 100644 --- a/htdocs/core/class/hookmanager.class.php +++ b/htdocs/core/class/hookmanager.class.php @@ -195,6 +195,7 @@ class HookManager 'getFormatedSupplierRef', 'getIdProfUrl', 'getInputIdProf', + 'menuDropdownQuickaddItems', 'menuLeftMenuItems', 'moveUploadedFile', 'moreHtmlStatus', diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index dec6e389156..d15abb78098 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -2264,185 +2264,16 @@ function top_menu_user($hideloginname = 0, $urllogout = '') */ function top_menu_quickadd() { - global $langs, $conf, $db, $hookmanager, $user; - global $menumanager; + global $langs; $html = ''; - // Define $dropDownQuickAddHtml - $dropDownQuickAddHtml = ''; - - $dropDownQuickAddHtml .= ''; $html .= ' '; $html .= ' @@ -2477,6 +2308,152 @@ function top_menu_quickadd() return $html; } +/** + * Generate list of quickadd items + * + * @return string HTML output + */ +function printDropdownQuickadd() +{ + global $conf, $user, $langs, $hookmanager; + + $items = array( + 'items' => array( + array( + "url" => "/societe/card.php?action=create", + "title" => "MenuNewThirdParty@companies", + "name" => "ThirdParty@companies", + "picto" => "object_company", + "activation" => !empty($conf->societe->enabled) && $user->rights->societe->creer, // vs hooking + "position" => 10, + ), + array( + "url" => "/contact/card.php?action=create", + "title" => "NewContactAddress@companies", + "name" => "Contact@companies", + "picto" => "object_contact", + "activation" => !empty($conf->societe->enabled) && $user->rights->societe->contact->creer, // vs hooking + "position" => 20, + ), + array( + "url" => "/comm/propal/card.php?action=create", + "title" => "NewPropal@propal", + "name" => "Proposal@propal", + "picto" => "object_propal", + "activation" => !empty($conf->propal->enabled) && $user->rights->propale->creer, // vs hooking + "position" => 30, + ), + + array( + "url" => "/commande/card.php?action=create", + "title" => "NewOrder@orders", + "name" => "Order@orders", + "picto" => "object_order", + "activation" => !empty($conf->commande->enabled) && $user->rights->commande->creer, // vs hooking + "position" => 40, + ), + array( + "url" => "/compta/facture/card.php?action=create", + "title" => "NewBill@bills", + "name" => "Bill@bills", + "picto" => "object_bill", + "activation" => !empty($conf->facture->enabled) && $user->rights->facture->creer, // vs hooking + "position" => 50, + ), + array( + "url" => "/compta/facture/card.php?action=create", + "title" => "NewContractSubscription@contracts", + "name" => "Contract@contracts", + "picto" => "object_contract", + "activation" => !empty($conf->contrat->enabled) && $user->rights->contrat->creer, // vs hooking + "position" => 60, + ), + array( + "url" => "/supplier_proposal/card.php?action=create", + "title" => "SupplierProposalNew@supplier_proposal", + "name" => "SupplierProposal@supplier_proposal", + "picto" => "object_propal", + "activation" => !empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->creer, // vs hooking + "position" => 70, + ), + array( + "url" => "/fourn/commande/card.php?action=create", + "title" => "NewSupplierOrderShort@orders", + "name" => "SupplierOrder@orders", + "picto" => "object_order", + "activation" => (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->commande->creer) || (!empty($conf->supplier_order->enabled) && $user->rights->supplier_order->creer), // vs hooking + "position" => 80, + ), + array( + "url" => "/fourn/facture/card.php?action=create", + "title" => "NewBill@bills", + "name" => "SupplierBill@bills", + "picto" => "object_bill", + "activation" => (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->facture->creer) || (!empty($conf->supplier_invoice->enabled) && $user->rights->supplier_invoice->creer), // vs hooking + "position" => 90, + ), + array( + "url" => "/product/card.php?action=create&type=0", + "title" => "NewProduct@products", + "name" => "Product@products", + "picto" => "object_product", + "activation" => !empty($conf->product->enabled) && $user->rights->produit->creer, // vs hooking + "position" => 100, + ), + array( + "url" => "/product/card.php?action=create&type=1", + "title" => "NewService@products", + "name" => "Service@products", + "picto" => "object_service", + "activation" => !empty($conf->service->enabled) && $user->rights->service->creer, // vs hooking + "position" => 110, + ), + ), + ); + + $dropDownQuickAddHtml = ''; + + // Define $dropDownQuickAddHtml + $dropDownQuickAddHtml .= ''; + + return $dropDownQuickAddHtml; +} + /** * Build the tooltip on top menu bookmark * diff --git a/htdocs/theme/eldy/dropdown.inc.php b/htdocs/theme/eldy/dropdown.inc.php index dcf7ca787b7..41622afc53c 100644 --- a/htdocs/theme/eldy/dropdown.inc.php +++ b/htdocs/theme/eldy/dropdown.inc.php @@ -423,7 +423,15 @@ a.top-menu-dropdown-link { .quickadd-body.dropdown-body { padding: unset; - padding-top: 15px; +} + +.quickadd-item { + padding-top: 6px; + padding-bottom: 6px; +} + +.quickadd-item:before { + content: none; } .quickadd-header { From 9329e54fc3dcaa48bb74c32c394cc046f6632eac Mon Sep 17 00:00:00 2001 From: Christian Foellmann Date: Tue, 26 Oct 2021 18:28:08 +0200 Subject: [PATCH 017/610] fix hook 'menuDropdownQuickaddItems' --- htdocs/main.inc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index d15abb78098..18095df707c 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -2421,9 +2421,9 @@ function printDropdownQuickadd() $parameters = array(); $hook_items = $items; $reshook = $hookmanager->executeHooks('menuDropdownQuickaddItems', $parameters, $hook_items); // Note that $action and $object may have been modified by some hooks - if (is_numeric($reshook) && !empty($hookmanager->results)) { + if (is_numeric($reshook) && is_array($hookmanager->results)) { if ($reshook == 0) { - $items['items'][] = $hookmanager->results; // add + $items['items'] = array_merge($items['items'],$hookmanager->results); // add } else { $items = $hookmanager->results; // replace } From 0f177274e01a0d83ce5d354c28f7bcfdae197722 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Tue, 26 Oct 2021 16:31:06 +0000 Subject: [PATCH 018/610] Fixing style errors. --- htdocs/main.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 18095df707c..cf0a27efd53 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -2423,7 +2423,7 @@ function printDropdownQuickadd() $reshook = $hookmanager->executeHooks('menuDropdownQuickaddItems', $parameters, $hook_items); // Note that $action and $object may have been modified by some hooks if (is_numeric($reshook) && is_array($hookmanager->results)) { if ($reshook == 0) { - $items['items'] = array_merge($items['items'],$hookmanager->results); // add + $items['items'] = array_merge($items['items'], $hookmanager->results); // add } else { $items = $hookmanager->results; // replace } From 706ee8ce6236e3de47a3b148a0bed57706ae170b Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Tue, 28 Dec 2021 16:26:21 +0100 Subject: [PATCH 019/610] Fix #19662 : mysql8 user creation in 2 steps --- htdocs/core/db/mysqli.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index 3a8aabd3bf9..c733792b6b6 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -939,7 +939,7 @@ class DoliDBMysqli extends DoliDB public function DDLCreateUser($dolibarr_main_db_host, $dolibarr_main_db_user, $dolibarr_main_db_pass, $dolibarr_main_db_name) { // phpcs:enable - $sql = "CREATE USER '".$this->escape($dolibarr_main_db_user)."'"; + $sql = "CREATE USER '".$this->escape($dolibarr_main_db_user)."'@'".$this->escape($dolibarr_main_db_host)."' IDENTIFIED BY '".$this->escape($dolibarr_main_db_pass)."'"; dol_syslog(get_class($this)."::DDLCreateUser", LOG_DEBUG); // No sql to avoid password in log $resql = $this->query($sql); if (!$resql) { @@ -952,14 +952,14 @@ class DoliDBMysqli extends DoliDB } // Redo with localhost forced (sometimes user is created on %) - $sql = "CREATE USER '".$this->escape($dolibarr_main_db_user)."'@'localhost'"; + $sql = "CREATE USER '".$this->escape($dolibarr_main_db_user)."'@'localhost' IDENTIFIED BY '".$this->escape($dolibarr_main_db_pass)."'"; $resql = $this->query($sql); - $sql = "GRANT ALL PRIVILEGES ON ".$this->escape($dolibarr_main_db_name).".* TO '".$this->escape($dolibarr_main_db_user)."'@'".$this->escape($dolibarr_main_db_host)."' IDENTIFIED BY '".$this->escape($dolibarr_main_db_pass)."'"; + $sql = "GRANT ALL PRIVILEGES ON ".$this->escape($dolibarr_main_db_name).".* TO '".$this->escape($dolibarr_main_db_user)."'@'".$this->escape($dolibarr_main_db_host)."'"; dol_syslog(get_class($this)."::DDLCreateUser", LOG_DEBUG); // No sql to avoid password in log $resql = $this->query($sql); if (!$resql) { - $this->error = "Connected user not allowed to GRANT ALL PRIVILEGES ON ".$this->escape($dolibarr_main_db_name).".* TO '".$this->escape($dolibarr_main_db_user)."'@'".$this->escape($dolibarr_main_db_host)."' IDENTIFIED BY '*****'"; + $this->error = "Connected user not allowed to GRANT ALL PRIVILEGES ON ".$this->escape($dolibarr_main_db_name).".* TO '".$this->escape($dolibarr_main_db_user)."'@'".$this->escape($dolibarr_main_db_host)."'"; return -1; } From 04cc0a0480459c19837abb4e0f8f88d01689301f Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Mon, 10 Jan 2022 17:02:15 +0100 Subject: [PATCH 020/610] NEW : Add column "Total HT" to products array on document creation card --- htdocs/core/class/commonobject.class.php | 2 ++ htdocs/core/tpl/originproductline.tpl.php | 1 + 2 files changed, 3 insertions(+) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index a01e2d7c209..e89990b7b5e 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -4441,6 +4441,7 @@ abstract class CommonObject print ''.$langs->trans('Unit').''; } print ''.$langs->trans('ReductionShort').''; + print ''.$langs->trans('TotalHT').''; print ''.$form->showCheckAddButtons('checkforselect', 1).''; print ''; $i = 0; @@ -4593,6 +4594,7 @@ abstract class CommonObject if (!empty($line->vat_src_code) && !preg_match('/\(/', $this->tpl['vat_rate'])) $this->tpl['vat_rate'] .= ' ('.$line->vat_src_code.')'; $this->tpl['price'] = price($line->subprice); + $this->tpl['total_ht'] = price($line->total_ht); $this->tpl['multicurrency_price'] = price($line->multicurrency_subprice); $this->tpl['qty'] = (($line->info_bits & 2) != 2) ? $line->qty : ' '; if ($conf->global->PRODUCT_USE_UNITS) $this->tpl['unit'] = $langs->transnoentities($line->getLabelOfUnit('long')); diff --git a/htdocs/core/tpl/originproductline.tpl.php b/htdocs/core/tpl/originproductline.tpl.php index 1b996556253..cc520039af5 100644 --- a/htdocs/core/tpl/originproductline.tpl.php +++ b/htdocs/core/tpl/originproductline.tpl.php @@ -40,6 +40,7 @@ if ($conf->global->PRODUCT_USE_UNITS) print ''.$langs->trans($this->tpl['unit']).''; print ''.$this->tpl['remise_percent'].''; +print ''.$this->tpl['total_ht'].''; $selected = 1; if (!empty($selectedLines) && !in_array($this->tpl['id'], $selectedLines)) $selected = 0; From 99fb08240376c647b11bbd708bcb4457377ee9d7 Mon Sep 17 00:00:00 2001 From: Atm-Gregr Date: Mon, 24 Jan 2022 14:50:54 +0100 Subject: [PATCH 021/610] prevent access denied page --- htdocs/core/lib/security.lib.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index 3ea554a4a8f..b26c723a014 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -615,6 +615,9 @@ function checkUserAccessToObject($user, array $featuresarray, $objectid = 0, $ta if ($feature == 'task') { $feature = 'projet_task'; } + if ($feature == 'banque') { + $feature = 'fk_account@bank_account'; + } $check = array('adherent', 'banque', 'bom', 'don', 'mrp', 'user', 'usergroup', 'payment', 'payment_supplier', 'product', 'produit', 'service', 'produit|service', 'categorie', 'resource', 'expensereport', 'holiday', 'salaries', 'website'); // Test on entity only (Objects with no link to company) $checksoc = array('societe'); // Test for societe object From 97850a6fbf56ef92402cc5f5ed9ece80081bc623 Mon Sep 17 00:00:00 2001 From: habot-it Date: Sat, 5 Feb 2022 12:22:18 +0000 Subject: [PATCH 022/610] Add options in function pdf_pagefoot of pdf.lib.php --- htdocs/core/lib/pdf.lib.php | 47 +++++++++++++++++++++++++++++++++---- 1 file changed, 42 insertions(+), 5 deletions(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 75443366037..c79cbbca645 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1130,6 +1130,11 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_ $pdf->SetFont('', '', 7); $pdf->SetDrawColor(224, 224, 224); + // Option for footer text color + if (!empty($conf->global->PDF_FOOTER_TEXT_COLOR)) { + list($r, $g, $b) = sscanf($conf->global->PDF_FOOTER_TEXT_COLOR, '%d, %d, %d'); + $pdf->SetTextColor($r, $g, $b); + } // The start of the bottom of this page footer is positioned according to # of lines $freetextheight = 0; @@ -1149,6 +1154,8 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_ } } + $pdf->SetAutoPageBreak(0, 0); // Disable auto pagebreak + // For customize footer if (is_object($hookmanager)) { $parameters = array('line1' => $line1, 'line2' => $line2, 'line3' => $line3, 'line4' => $line4, 'outputlangs'=>$outputlangs); @@ -1161,6 +1168,12 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_ $marginwithfooter = $marge_basse + $freetextheight + $mycustomfooterheight; $posy = $marginwithfooter + 0; + // Option for footer background color (without freetext zone) + if (!empty($conf->global->PDF_FOOTER_BACKGROUND_COLOR)) { + list($r, $g, $b) = sscanf($conf->global->PDF_FOOTER_BACKGROUND_COLOR, '%d, %d, %d'); + $pdf->Rect(0, $dims['hk'] - $posy + $freetextheight, $dims['wk'] + 1, $marginwithfooter + 1, 'F', '', $fill_color = array($r, $g, $b)); + } + if ($line) { // Free text $pdf->SetXY($dims['lm'], -$posy); if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) { // by default @@ -1172,10 +1185,18 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_ } $pdf->SetY(-$posy); - $pdf->line($dims['lm'], $dims['hk'] - $posy, $dims['wk'] - $dims['rm'], $dims['hk'] - $posy); - $posy--; - $pdf->writeHTMLCell($pdf->page_largeur - $pdf->margin_left - $pdf->margin_right, $freetextheight, $dims['lm'], $dims['hk'] - $posy, dol_htmlentitiesbr($mycustomfooter, 1, 'UTF-8', 0)); + // Hide footer line if footer background color is set + if (empty($conf->global->PDF_FOOTER_BACKGROUND_COLOR)) { + $pdf->line($dims['lm'], $dims['hk'] - $posy, $dims['wk'] - $dims['rm'], $dims['hk'] - $posy); + } + + // Option for set top margin height of footer after freetext + if (!empty($conf->global->PDF_FOOTER_TOP_MARGIN) || ($conf->global->PDF_FOOTER_TOP_MARGIN === '0')) { + $posy -= $conf->global->PDF_FOOTER_TOP_MARGIN; + } else { $posy--; } + + $pdf->writeHTMLCell($pdf->page_largeur - $pdf->margin_left - $pdf->margin_right, $mycustomfooterheight, $dims['lm'], $dims['hk'] - $posy, dol_htmlentitiesbr($mycustomfooter, 1, 'UTF-8', 0)); $posy -= $mycustomfooterheight - 3; } else { @@ -1183,6 +1204,12 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_ $marginwithfooter = $marge_basse + $freetextheight + (!empty($line1) ? 3 : 0) + (!empty($line2) ? 3 : 0) + (!empty($line3) ? 3 : 0) + (!empty($line4) ? 3 : 0); $posy = $marginwithfooter + 0; + // Option for footer background color (without freetext zone) + if (!empty($conf->global->PDF_FOOTER_BACKGROUND_COLOR)) { + list($r, $g, $b) = sscanf($conf->global->PDF_FOOTER_BACKGROUND_COLOR, '%d, %d, %d'); + $pdf->Rect(0, $dims['hk'] - $posy + $freetextheight, $dims['wk'] + 1, $marginwithfooter + 1, 'F', '', $fill_color = array($r, $g, $b)); + } + if ($line) { // Free text $pdf->SetXY($dims['lm'], -$posy); if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) { // by default @@ -1194,8 +1221,16 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_ } $pdf->SetY(-$posy); - $pdf->line($dims['lm'], $dims['hk'] - $posy, $dims['wk'] - $dims['rm'], $dims['hk'] - $posy); - $posy--; + + // Hide footer line if footer background color is set + if (empty($conf->global->PDF_FOOTER_BACKGROUND_COLOR)) { + $pdf->line($dims['lm'], $dims['hk'] - $posy, $dims['wk'] - $dims['rm'], $dims['hk'] - $posy); + } + + // Option for set top margin height of footer after freetext + if (!empty($conf->global->PDF_FOOTER_TOP_MARGIN) || ($conf->global->PDF_FOOTER_TOP_MARGIN === '0')) { + $posy -= $conf->global->PDF_FOOTER_TOP_MARGIN; + } else { $posy--; } if (!empty($line1)) { $pdf->SetFont('', 'B', 7); @@ -1232,6 +1267,8 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_ $pdf->MultiCell(15, 2, $pdf->PageNo().'/'.$pdf->getAliasNbPages(), 0, 'R', 0); } + $pdf->SetAutoPageBreak(1, 0); // Restore pagebreak + return $marginwithfooter; } From a15353fa333bd1bfa42a8a1657d2083a48aae89b Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sun, 13 Feb 2022 13:42:40 +0100 Subject: [PATCH 023/610] FIX Disable customer type by default if type prospect/customer is disabled --- htdocs/societe/admin/societe.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/htdocs/societe/admin/societe.php b/htdocs/societe/admin/societe.php index c87289da390..55c42cd4c28 100644 --- a/htdocs/societe/admin/societe.php +++ b/htdocs/societe/admin/societe.php @@ -1,9 +1,10 @@ - * Copyright (C) 2004 Eric Seigne - * Copyright (C) 2005-2011 Laurent Destailleur - * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2011-2012 Juanjo Menent +/* Copyright (C) 2004 Rodolphe Quiedeville + * Copyright (C) 2004 Eric Seigne + * Copyright (C) 2005-2011 Laurent Destailleur + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2011-2012 Juanjo Menent + * Copyright (C) 2022 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 @@ -225,10 +226,12 @@ if ($action == "setaskforshippingmet") { } } -//Activate "Disable prospect/customer type" +// Activate "Disable prospect/customer type" if ($action == "setdisableprospectcustomer") { $setdisableprospectcustomer = GETPOST('value', 'int'); $res = dolibarr_set_const($db, "SOCIETE_DISABLE_PROSPECTSCUSTOMERS", $setdisableprospectcustomer, 'yesno', 0, '', $conf->entity); + // Remove customer type by default if type prospect/customer is disabled + $res = dolibarr_del_const($db, "THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT", $conf->entity); if (!($res > 0)) { $error++; } From 5a86f998904f386cb7af9dbb987c8244f5dc825a Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sun, 13 Feb 2022 17:53:22 +0100 Subject: [PATCH 024/610] FIX Disable customer type by default if type prospect/customer is disabled --- htdocs/societe/admin/societe.php | 3 --- htdocs/societe/card.php | 41 +++++++++++++++++--------------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/htdocs/societe/admin/societe.php b/htdocs/societe/admin/societe.php index 55c42cd4c28..ab6c6bd063d 100644 --- a/htdocs/societe/admin/societe.php +++ b/htdocs/societe/admin/societe.php @@ -4,7 +4,6 @@ * Copyright (C) 2005-2011 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2011-2012 Juanjo Menent - * Copyright (C) 2022 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 @@ -230,8 +229,6 @@ if ($action == "setaskforshippingmet") { if ($action == "setdisableprospectcustomer") { $setdisableprospectcustomer = GETPOST('value', 'int'); $res = dolibarr_set_const($db, "SOCIETE_DISABLE_PROSPECTSCUSTOMERS", $setdisableprospectcustomer, 'yesno', 0, '', $conf->entity); - // Remove customer type by default if type prospect/customer is disabled - $res = dolibarr_del_const($db, "THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT", $conf->entity); if (!($res > 0)) { $error++; } diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 668d8199b16..8c2c7e85e56 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -6,7 +6,7 @@ * Copyright (C) 2005-2017 Regis Houssin * Copyright (C) 2008 Patrick Raguin * Copyright (C) 2010-2020 Juanjo Menent - * Copyright (C) 2011-2013 Alexandre Spangaro + * Copyright (C) 2011-2022 Alexandre Spangaro * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2015 Marcos García * Copyright (C) 2015 Raphaël Doursenaud @@ -986,21 +986,24 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { $modCodeFournisseur = new $module; // Define if customer/prospect or supplier status is set or not - if (GETPOST("type") != 'f') { + if (GETPOST("type", 'aZ') != 'f') { $object->client = -1; if (!empty($conf->global->THIRDPARTY_CUSTOMERPROSPECT_BY_DEFAULT)) { $object->client = 3; } } // Prospect / Customer - if (GETPOST("type") == 'c') { + if (GETPOST("type", 'aZ') == 'c') { if (!empty($conf->global->THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT)) { $object->client = $conf->global->THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT; } else { $object->client = 3; } } - if (GETPOST("type") == 'p') { + if (!empty($conf->global->SOCIETE_DISABLE_PROSPECTSCUSTOMERS)) { + $object->client = 1; + } + if (GETPOST("type", 'aZ') == 'p') { $object->client = 2; } if (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && (GETPOST("type") == 'f' || (GETPOST("type") == '' && !empty($conf->global->THIRDPARTY_SUPPLIER_BY_DEFAULT)))) { @@ -1757,21 +1760,21 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { if (GETPOSTISSET('name')) { // We overwrite with values if posted - $object->name = GETPOST('name', 'alphanohtml'); - $object->prefix_comm = GETPOST('prefix_comm', 'alphanohtml'); - $object->client = GETPOST('client', 'int'); - $object->code_client = GETPOST('customer_code', 'alpha'); - $object->fournisseur = GETPOST('fournisseur', 'int'); - $object->code_fournisseur = GETPOST('supplier_code', 'alpha'); - $object->address = GETPOST('address', 'alphanohtml'); - $object->zip = GETPOST('zipcode', 'alphanohtml'); - $object->town = GETPOST('town', 'alphanohtml'); - $object->country_id = GETPOST('country_id') ?GETPOST('country_id', 'int') : $mysoc->country_id; - $object->state_id = GETPOST('state_id', 'int'); - //$object->skype = GETPOST('skype', 'alpha'); - //$object->twitter = GETPOST('twitter', 'alpha'); - //$object->facebook = GETPOST('facebook', 'alpha'); - //$object->linkedin = GETPOST('linkedin', 'alpha'); + $object->name = GETPOST('name', 'alphanohtml'); + $object->prefix_comm = GETPOST('prefix_comm', 'alphanohtml'); + $object->client = GETPOST('client', 'int'); + $object->code_client = GETPOST('customer_code', 'alpha'); + $object->fournisseur = GETPOST('fournisseur', 'int'); + $object->code_fournisseur = GETPOST('supplier_code', 'alpha'); + $object->address = GETPOST('address', 'alphanohtml'); + $object->zip = GETPOST('zipcode', 'alphanohtml'); + $object->town = GETPOST('town', 'alphanohtml'); + $object->country_id = GETPOST('country_id') ?GETPOST('country_id', 'int') : $mysoc->country_id; + $object->state_id = GETPOST('state_id', 'int'); + //$object->skype = GETPOST('skype', 'alpha'); + //$object->twitter = GETPOST('twitter', 'alpha'); + //$object->facebook = GETPOST('facebook', 'alpha'); + //$object->linkedin = GETPOST('linkedin', 'alpha'); $object->socialnetworks = array(); if (!empty($conf->socialnetworks->enabled)) { foreach ($socialnetworks as $key => $value) { From fd478ba3fa6814681cb648d4a28c4c0139daf567 Mon Sep 17 00:00:00 2001 From: BB2A Anthony Berton Date: Wed, 16 Feb 2022 15:13:50 +0100 Subject: [PATCH 025/610] add param for md theme --- htdocs/core/lib/usergroups.lib.php | 2 -- htdocs/theme/md/style.css.php | 30 +++++++++++++++++++----------- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/htdocs/core/lib/usergroups.lib.php b/htdocs/core/lib/usergroups.lib.php index 2792b6d9997..c963c74c8b6 100644 --- a/htdocs/core/lib/usergroups.lib.php +++ b/htdocs/core/lib/usergroups.lib.php @@ -507,7 +507,6 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) } // BorderTableActive - /* Disabled because not supported by md theme if ($foruserprofile) { } else { $default = $langs->trans('No'); @@ -525,7 +524,6 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) print ''; print ''; } - */ // Background color THEME_ELDY_BACKBODY if ($foruserprofile) { diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index da706095e17..943060bb581 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -119,7 +119,7 @@ $dol_no_mouse_hover = $conf->dol_no_mouse_hover; $useboldtitle = (isset($conf->global->THEME_ELDY_USEBOLDTITLE) ? $conf->global->THEME_ELDY_USEBOLDTITLE : 0); $borderwidth = 2; -$userborderontable = 1; +$userborderontable = getDolGlobalInt('THEME_ELDY_USEBORDERONTABLE');; // Case of option always editable if (!isset($conf->global->THEME_ELDY_BACKBODY)) { @@ -3641,8 +3641,10 @@ div.colorback margin-top: 5px; } .liste_titre_bydiv { - border-right: 1px solid #ccc; - border-left: 1px solid #ccc; + + border-right: 1px solid var(--colortopbordertitle1); + border-left: 1px solid var(--colortopbordertitle1); + } table.liste, table.noborder, table.formdoc, div.noborder { width: calc(100% - 2px); /* -2 to fix a bug. Without, a scroll appears due to overflow-x: auto; of div-table-responsive */ @@ -3655,12 +3657,15 @@ table.liste, table.noborder, table.formdoc, div.noborder { border-top-style: solid; border-bottom-width: 1px; - border-bottom-color: #BBB; + border-bottom-color: var(--colortopbordertitle1); border-bottom-style: solid; - border-right: 1px solid #ccc; - border-left: 1px solid #ccc; - + + border-right: 1px solid var(--colortopbordertitle1); + border-left: 1px solid var(--colortopbordertitle1); + + margin: 0px 0px 20px 0px; -webkit-border-radius: 0.1em; @@ -4039,7 +4044,9 @@ tr.pair td .nobordernopadding tr td, tr.impair td .nobordernopadding tr td { /* table.nobottomiftotal tr.liste_total td { background-color: #fff; + border-bottom: 0px !important; + } */ div.liste_titre .tagtd { @@ -4052,22 +4059,23 @@ div.liste_titre { padding-bottom: 2px; /*border-right-width: 1px; - border-right-color: #BBB; + border-right-color: var(--colortopbordertitle1); border-right-style: solid; border-left-width: 1px; - border-left-color: #BBB; + border-left-color: var(--colortopbordertitle1); border-left-style: solid;*/ border-top-width: 1px; - border-top-color: #BBB; + border-top-color: var(--colortopbordertitle1); border-top-style: solid; } div.liste_titre_bydiv { + border-top-width: px; border-top-color: var(--colortopbordertitle1); border-top-style: solid; - + border-collapse: collapse; display: table; padding: 2px 0px 2px 0; From 6b29b2d9dc9bc50e600f9d015aff5d6fc10483e1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 22 Feb 2022 10:51:51 +0100 Subject: [PATCH 026/610] Add preg_quote --- htdocs/core/class/utils.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/utils.class.php b/htdocs/core/class/utils.class.php index 09e11ed5221..17afecde14a 100644 --- a/htdocs/core/class/utils.class.php +++ b/htdocs/core/class/utils.class.php @@ -376,9 +376,9 @@ class Utils continue; } fwrite($handle, $read.($execmethod == 2 ? '' : "\n")); - if (preg_match('/'.preg_quote('-- Dump completed').'/i', $read)) { + if (preg_match('/'.preg_quote('-- Dump completed', '/').'/i', $read)) { $ok = 1; - } elseif (preg_match('/'.preg_quote('SET SQL_NOTES=@OLD_SQL_NOTES').'/i', $read)) { + } elseif (preg_match('/'.preg_quote('SET SQL_NOTES=@OLD_SQL_NOTES', '/').'/i', $read)) { $ok = 1; } } From 57ed890b73da8e2ff3ad5a3f209d47b5c9bd71ed Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Wed, 23 Feb 2022 12:28:37 +0100 Subject: [PATCH 027/610] NEW : dol_uncompress new extensions --- htdocs/core/lib/files.lib.php | 120 +++++++++++++++++++++------------- 1 file changed, 76 insertions(+), 44 deletions(-) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 60382cc4906..86c740c4f44 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -2083,65 +2083,97 @@ function dol_compress_file($inputfile, $outputfile, $mode = "gz", &$errorstring */ function dol_uncompress($inputfile, $outputdir) { - global $conf, $langs; + global $conf, $langs, $db; - if (defined('ODTPHP_PATHTOPCLZIP') && empty($conf->global->MAIN_USE_ZIPARCHIVE_FOR_ZIP_UNCOMPRESS)) { - dol_syslog("Constant ODTPHP_PATHTOPCLZIP for pclzip library is set to ".ODTPHP_PATHTOPCLZIP.", so we use Pclzip to unzip into ".$outputdir); - include_once ODTPHP_PATHTOPCLZIP.'/pclzip.lib.php'; - $archive = new PclZip($inputfile); + include_once DOL_DOCUMENT_ROOT."/core/class/utils.class.php"; + $utils = new Utils($db); + $fileinfo = pathinfo($inputfile); + if ($fileinfo["extension"] == "zip") { + if (defined('ODTPHP_PATHTOPCLZIP') && empty($conf->global->MAIN_USE_ZIPARCHIVE_FOR_ZIP_UNCOMPRESS)) { + dol_syslog("Constant ODTPHP_PATHTOPCLZIP for pclzip library is set to ".ODTPHP_PATHTOPCLZIP.", so we use Pclzip to unzip into ".$outputdir); + include_once ODTPHP_PATHTOPCLZIP.'/pclzip.lib.php'; + $archive = new PclZip($inputfile); - // Extract into outputdir, but only files that match the regex '/^((?!\.\.).)*$/' that means "does not include .." - $result = $archive->extract(PCLZIP_OPT_PATH, $outputdir, PCLZIP_OPT_BY_PREG, '/^((?!\.\.).)*$/'); + // Extract into outputdir, but only files that match the regex '/^((?!\.\.).)*$/' that means "does not include .." + $result = $archive->extract(PCLZIP_OPT_PATH, $outputdir, PCLZIP_OPT_BY_PREG, '/^((?!\.\.).)*$/'); - if (!is_array($result) && $result <= 0) { - return array('error'=>$archive->errorInfo(true)); - } else { - $ok = 1; - $errmsg = ''; - // Loop on each file to check result for unzipping file - foreach ($result as $key => $val) { - if ($val['status'] == 'path_creation_fail') { - $langs->load("errors"); - $ok = 0; - $errmsg = $langs->trans("ErrorFailToCreateDir", $val['filename']); - break; + if (!is_array($result) && $result <= 0) { + return array('error'=>$archive->errorInfo(true)); + } else { + $ok = 1; + $errmsg = ''; + // Loop on each file to check result for unzipping file + foreach ($result as $key => $val) { + if ($val['status'] == 'path_creation_fail') { + $langs->load("errors"); + $ok = 0; + $errmsg = $langs->trans("ErrorFailToCreateDir", $val['filename']); + break; + } + } + + if ($ok) { + return array(); + } else { + return array('error'=>$errmsg); } } + } - if ($ok) { + if (class_exists('ZipArchive')) { // Must install php-zip to have it + dol_syslog("Class ZipArchive is set so we unzip using ZipArchive to unzip into ".$outputdir); + $zip = new ZipArchive; + $res = $zip->open($inputfile); + if ($res === true) { + //$zip->extractTo($outputdir.'/'); + // We must extract one file at time so we can check that file name does not contains '..' to avoid transversal path of zip built for example using + // python3 path_traversal_archiver.py test.zip -l 10 -p tmp/ + // with -l is the range of dot to go back in path. + // and path_traversal_archiver.py found at https://github.com/Alamot/code-snippets/blob/master/path_traversal/path_traversal_archiver.py + for ($i = 0; $i < $zip->numFiles; $i++) { + if (preg_match('/\.\./', $zip->getNameIndex($i))) { + dol_syslog("Warning: Try to unzip a file with a transversal path ".$zip->getNameIndex($i), LOG_WARNING); + continue; // Discard the file + } + $zip->extractTo($outputdir.'/', array($zip->getNameIndex($i))); + } + + $zip->close(); return array(); } else { - return array('error'=>$errmsg); + return array('error'=>'ErrUnzipFails'); } } - } - if (class_exists('ZipArchive')) { // Must install php-zip to have it - dol_syslog("Class ZipArchive is set so we unzip using ZipArchive to unzip into ".$outputdir); - $zip = new ZipArchive; - $res = $zip->open($inputfile); - if ($res === true) { - //$zip->extractTo($outputdir.'/'); - // We must extract one file at time so we can check that file name does not contains '..' to avoid transversal path of zip built for example using - // python3 path_traversal_archiver.py test.zip -l 10 -p tmp/ - // with -l is the range of dot to go back in path. - // and path_traversal_archiver.py found at https://github.com/Alamot/code-snippets/blob/master/path_traversal/path_traversal_archiver.py - for ($i = 0; $i < $zip->numFiles; $i++) { - if (preg_match('/\.\./', $zip->getNameIndex($i))) { - dol_syslog("Warning: Try to unzip a file with a transversal path ".$zip->getNameIndex($i), LOG_WARNING); - continue; // Discard the file - } - $zip->extractTo($outputdir.'/', array($zip->getNameIndex($i))); - } - - $zip->close(); - return array(); + return array('error'=>'ErrNoZipEngine'); + } elseif ($fileinfo["extension"] == "gz" || $fileinfo["extension"] == "bz2") { + $extension = pathinfo($fileinfo["filename"], PATHINFO_EXTENSION); + if ($extension == "tar") { + $cmd = "tar -C ".$outputdir." -xvf ".$fileinfo["dirname"]."/".$fileinfo["basename"]; + $resarray = $utils->executeCLI($cmd, $outputdir); } else { - return array('error'=>'ErrUnzipFails'); + $program = ""; + if ($fileinfo["extension"] == "gz") { + $program = "gzip"; + } elseif ($fileinfo["extension"] == "bz2") { + $program = "bzip2"; + } else { + return array('error'=>'ErrFileExtension'); + } + $cmd = $program." -dc ".$fileinfo["dirname"]."/".$fileinfo["basename"]; + $outputfilename = $outputdir."/".$fileinfo["filename"]; + $resarray = $utils->executeCLI($cmd, $outputfilename, 0, $outputfilename); + if ($resarray["output"] == 2) { + $resarray["error"] = "ErrFilePermOrFileNotFound"; + } + if ($resarray["output"] == 1) { + $resarray["error"] = "Error"; + } } + return $resarray["output"] != 0 ? $resarray["error"] : array(); } - return array('error'=>'ErrNoZipEngine'); + return array('error'=>'ErrFileExtension'); } From c65680dbcf7f29a59d7cc00a83f0bc98e3d80ad2 Mon Sep 17 00:00:00 2001 From: GregM Date: Thu, 24 Feb 2022 11:48:10 +0100 Subject: [PATCH 028/610] WIP dolGetButtonAction on Product --- htdocs/product/card.php | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 64c6b6817bd..05475563e17 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -2539,6 +2539,11 @@ print $formconfirm; * Action bar */ if ($action != 'create' && $action != 'edit') { + $cloneProductUrl = $_SERVER["PHP_SELF"].'?action=clone&token='.newToken(); + $cloneButtonId = 'action-clone-no-ajax'; + $deleteProductUrl = $_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$object->id; + $deleteButtonId = 'action-delete-no-ajax'; + print "\n".'
'."\n"; $parameters = array(); @@ -2547,14 +2552,16 @@ if ($action != 'create' && $action != 'edit') { if ($usercancreate) { if (!isset($object->no_button_edit) || $object->no_button_edit <> 1) { print 'id.'">'.$langs->trans("Modify").''; + print dolGetButtonAction('', $langs->trans('ModifyGREG'), 'default', $_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'&id='.$object->id, '', $user->rights->societe->creer); } if (!isset($object->no_button_copy) || $object->no_button_copy <> 1) { if (!empty($conf->use_javascript_ajax) && empty($conf->dol_use_jmobile)) { - print ''.$langs->trans('ToClone').''."\n"; - } else { - print 'id.'">'.$langs->trans("ToClone").''; + //print ''.$langs->trans('ToClone').''."\n"; + $cloneProductUrl = ''; + $cloneButtonId = 'action-clone'; } + print dolGetButtonAction($langs->trans('ToCloneGREG'), '', 'default', $cloneProductUrl, $cloneButtonId, $user->rights->societe->creer); } } $object_is_used = $object->isObjectUsed($object->id); @@ -2563,6 +2570,8 @@ if ($action != 'create' && $action != 'edit') { if (empty($object_is_used) && (!isset($object->no_button_delete) || $object->no_button_delete <> 1)) { if (!empty($conf->use_javascript_ajax) && empty($conf->dol_use_jmobile)) { print ''.$langs->trans('Delete').''."\n"; + //$deleteProductUrl = ''; + //$cloneButtonId = 'action-delete'; } else { print 'id.'">'.$langs->trans("Delete").''; } @@ -2572,6 +2581,8 @@ if ($action != 'create' && $action != 'edit') { } else { print ''.$langs->trans("Delete").''; } + print dolGetButtonAction($langs->trans('deleteGREG'), '', 'danger', $deleteProductUrl, $deleteButtonId, $user->rights->societe->creer); + print dolGetButtonAction($langs->trans('DeleteNEW'), '', 'danger', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), '', $user->rights->societe->creer); } print "\n
\n"; From a761afe5ed69680da78ce1ff97d24dbe61acb043 Mon Sep 17 00:00:00 2001 From: GregM Date: Fri, 25 Feb 2022 10:14:39 +0100 Subject: [PATCH 029/610] FIX add dolGetButtonAction on Product --- htdocs/product/card.php | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 05475563e17..15a6f6e82f9 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -2551,17 +2551,15 @@ if ($action != 'create' && $action != 'edit') { if (empty($reshook)) { if ($usercancreate) { if (!isset($object->no_button_edit) || $object->no_button_edit <> 1) { - print 'id.'">'.$langs->trans("Modify").''; - print dolGetButtonAction('', $langs->trans('ModifyGREG'), 'default', $_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'&id='.$object->id, '', $user->rights->societe->creer); + print dolGetButtonAction('', $langs->trans('Modify'), 'default', $_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'&id='.$object->id, '', $user->rights->societe->creer); } if (!isset($object->no_button_copy) || $object->no_button_copy <> 1) { if (!empty($conf->use_javascript_ajax) && empty($conf->dol_use_jmobile)) { - //print ''.$langs->trans('ToClone').''."\n"; $cloneProductUrl = ''; $cloneButtonId = 'action-clone'; } - print dolGetButtonAction($langs->trans('ToCloneGREG'), '', 'default', $cloneProductUrl, $cloneButtonId, $user->rights->societe->creer); + print dolGetButtonAction($langs->trans('ToClone'), '', 'default', $cloneProductUrl, $cloneButtonId, $user->rights->societe->creer); } } $object_is_used = $object->isObjectUsed($object->id); @@ -2569,20 +2567,16 @@ if ($action != 'create' && $action != 'edit') { if ($usercandelete) { if (empty($object_is_used) && (!isset($object->no_button_delete) || $object->no_button_delete <> 1)) { if (!empty($conf->use_javascript_ajax) && empty($conf->dol_use_jmobile)) { - print ''.$langs->trans('Delete').''."\n"; - //$deleteProductUrl = ''; - //$cloneButtonId = 'action-delete'; + print dolGetButtonAction($langs->trans('Delete'), '', 'delete', '#', 'action-delete', true); } else { - print 'id.'">'.$langs->trans("Delete").''; + print dolGetButtonAction('', $langs->trans('Delete'), 'delete', $_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$object->id, ''); } } else { - print ''.$langs->trans("Delete").''; + print dolGetButtonAction($langs->trans("ProductIsUsed"), $langs->trans('Delete'), 'delete', $_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$object->id, '', false); } } else { - print ''.$langs->trans("Delete").''; + print dolGetButtonAction($langs->trans("NotEnoughPermissions"), $langs->trans('Delete'), 'delete', $_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$object->id, '', false); } - print dolGetButtonAction($langs->trans('deleteGREG'), '', 'danger', $deleteProductUrl, $deleteButtonId, $user->rights->societe->creer); - print dolGetButtonAction($langs->trans('DeleteNEW'), '', 'danger', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), '', $user->rights->societe->creer); } print "\n\n"; From 22aae26f71d28f1f17416d2ce715d8a7bf1ffa37 Mon Sep 17 00:00:00 2001 From: GregM Date: Fri, 25 Feb 2022 10:27:26 +0100 Subject: [PATCH 030/610] update product card --- htdocs/product/card.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 15a6f6e82f9..4de5e0406e0 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -2541,8 +2541,6 @@ print $formconfirm; if ($action != 'create' && $action != 'edit') { $cloneProductUrl = $_SERVER["PHP_SELF"].'?action=clone&token='.newToken(); $cloneButtonId = 'action-clone-no-ajax'; - $deleteProductUrl = $_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$object->id; - $deleteButtonId = 'action-delete-no-ajax'; print "\n".'
'."\n"; From 79a0aa816fedfd2630a367716b8d5c0be4fe913a Mon Sep 17 00:00:00 2001 From: GregM Date: Fri, 25 Feb 2022 16:42:25 +0100 Subject: [PATCH 031/610] DolGetButtonAction add $usercancreate --- htdocs/product/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 4de5e0406e0..bedeae3264a 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -2549,7 +2549,7 @@ if ($action != 'create' && $action != 'edit') { if (empty($reshook)) { if ($usercancreate) { if (!isset($object->no_button_edit) || $object->no_button_edit <> 1) { - print dolGetButtonAction('', $langs->trans('Modify'), 'default', $_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'&id='.$object->id, '', $user->rights->societe->creer); + print dolGetButtonAction('', $langs->trans('Modify'), 'default', $_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'&id='.$object->id, '', $usercancreate); } if (!isset($object->no_button_copy) || $object->no_button_copy <> 1) { @@ -2557,7 +2557,7 @@ if ($action != 'create' && $action != 'edit') { $cloneProductUrl = ''; $cloneButtonId = 'action-clone'; } - print dolGetButtonAction($langs->trans('ToClone'), '', 'default', $cloneProductUrl, $cloneButtonId, $user->rights->societe->creer); + print dolGetButtonAction($langs->trans('ToClone'), '', 'default', $cloneProductUrl, $cloneButtonId, $usercancreate); } } $object_is_used = $object->isObjectUsed($object->id); From 08fa2dfadd3725e917d18da16e850396956946e2 Mon Sep 17 00:00:00 2001 From: steve Date: Mon, 28 Feb 2022 15:58:23 +0100 Subject: [PATCH 032/610] wip: add read employee and write employee --- htdocs/core/modules/modHRM.class.php | 16 ++++++++++++++++ htdocs/langs/en_US/admin.lang | 2 ++ 2 files changed, 18 insertions(+) diff --git a/htdocs/core/modules/modHRM.class.php b/htdocs/core/modules/modHRM.class.php index 3e75f8efcd5..32bdc267276 100644 --- a/htdocs/core/modules/modHRM.class.php +++ b/htdocs/core/modules/modHRM.class.php @@ -249,6 +249,22 @@ class modHRM extends DolibarrModules $this->rights[$r][4] = 'compare_advance'; $this->rights[$r][5] = 'read'; // In php code, permission will be checked by test if ($user->rights->hrm->compare_advance->read) $r++; + + // Read employee + $this->rights[$r][0] = 4031; // Permission id (must not be already used) + $this->rights[$r][1] = 'Read employee'; // Permission label + $this->rights[$r][3] = 0; // Permission by default for new user (0/1) + $this->rights[$r][4] = 'read_employee'; + $this->rights[$r][5] = 'read'; // In php code, permission will be checked by test if ($user->rights->hrm->compare_advance->read) + $r++; + + // Write employee + $this->rights[$r][0] = 4032; // Permission id (must not be already used) + $this->rights[$r][1] = 'Write employee'; // Permission label + $this->rights[$r][3] = 0; // Permission by default for new user (0/1) + $this->rights[$r][4] = 'write_employee'; + $this->rights[$r][5] = 'write'; // In php code, permission will be checked by test if ($user->rights->hrm->compare_advance->read) + $r++; } /** diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 426e1186868..61f40fdb1c1 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -969,6 +969,8 @@ Permission4021=Create/modify your evaluation Permission4022=Validate evaluation Permission4023=Delete evaluation Permission4030=See comparison menu +Permission4031=Read employee +Permission4032=Write employee Permission10001=Read website content Permission10002=Create/modify website content (html and javascript content) Permission10003=Create/modify website content (dynamic php code). Dangerous, must be reserved to restricted developers. From 91ee90ebeba24a8fcb04ef0535efbc95ceca3aa0 Mon Sep 17 00:00:00 2001 From: steve Date: Mon, 28 Feb 2022 16:48:08 +0100 Subject: [PATCH 033/610] fix: read employee and write employee --- htdocs/core/lib/usergroups.lib.php | 2 +- htdocs/core/modules/modHRM.class.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/usergroups.lib.php b/htdocs/core/lib/usergroups.lib.php index 2792b6d9997..8e764c14ea4 100644 --- a/htdocs/core/lib/usergroups.lib.php +++ b/htdocs/core/lib/usergroups.lib.php @@ -141,7 +141,7 @@ function user_prepare_head($object) // $this->tabs = array('entity:-tabname); to remove a tab complete_head_from_modules($conf, $langs, $object, $head, $h, 'user'); - if ((!empty($conf->salaries->enabled) && !empty($user->rights->salaries->read)) + if ((!empty($conf->salaries->enabled) && !empty($user->rights->salaries->read) && !empty($user->rights->hrm->read_employee->read)) || (!empty($conf->hrm->enabled) && !empty($user->rights->hrm->employee->read)) || (!empty($conf->expensereport->enabled) && !empty($user->rights->expensereport->lire) && ($user->id == $object->id || $user->rights->expensereport->readall)) || (!empty($conf->holiday->enabled) && !empty($user->rights->holiday->read) && ($user->id == $object->id || $user->rights->holiday->readall)) diff --git a/htdocs/core/modules/modHRM.class.php b/htdocs/core/modules/modHRM.class.php index 32bdc267276..35deea09a07 100644 --- a/htdocs/core/modules/modHRM.class.php +++ b/htdocs/core/modules/modHRM.class.php @@ -255,7 +255,7 @@ class modHRM extends DolibarrModules $this->rights[$r][1] = 'Read employee'; // Permission label $this->rights[$r][3] = 0; // Permission by default for new user (0/1) $this->rights[$r][4] = 'read_employee'; - $this->rights[$r][5] = 'read'; // In php code, permission will be checked by test if ($user->rights->hrm->compare_advance->read) + $this->rights[$r][5] = 'read'; // In php code, permission will be checked by test if ($user->rights->hrm->read_employee->read) $r++; // Write employee @@ -263,7 +263,7 @@ class modHRM extends DolibarrModules $this->rights[$r][1] = 'Write employee'; // Permission label $this->rights[$r][3] = 0; // Permission by default for new user (0/1) $this->rights[$r][4] = 'write_employee'; - $this->rights[$r][5] = 'write'; // In php code, permission will be checked by test if ($user->rights->hrm->compare_advance->read) + $this->rights[$r][5] = 'write'; // In php code, permission will be checked by test if ($user->rights->hrm->write_employee->write) $r++; } From e5fd11c8e075d275e69be05cf6073d0345f0cb7f Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 1 Mar 2022 09:28:38 +0100 Subject: [PATCH 034/610] FIX missing advanced perms --- htdocs/comm/propal/card.php | 2 +- htdocs/fourn/paiement/card.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 9f902c51e29..9e6e68a2ee9 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -116,7 +116,7 @@ $usercandelete = $user->rights->propal->supprimer; $usercanclose = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->propal->propal_advance->close))); $usercanvalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->propal->propal_advance->validate))); -$usercansend = (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->propal->propal_advance->send); +$usercansend = (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->propal->propal_advance->send)); $usercancreateorder = $user->rights->commande->creer; $usercancreateinvoice = $user->rights->facture->creer; diff --git a/htdocs/fourn/paiement/card.php b/htdocs/fourn/paiement/card.php index f8f484f0cc9..3c077881f99 100644 --- a/htdocs/fourn/paiement/card.php +++ b/htdocs/fourn/paiement/card.php @@ -344,7 +344,7 @@ if ($result > 0) { // Send by mail if ($user->socid == 0 && $action == '') { - $usercansend = (empty($conf->global->MAIN_USE_ADVANCED_PERMS)); + $usercansend = (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->fournisseur->supplier_invoice_advance->send))); if ($usercansend) { print ''.$langs->trans('SendMail').''; } else { From e3aae6d2e1343a905f34624368e59d377c0e7a3a Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Tue, 1 Mar 2022 10:50:22 +0100 Subject: [PATCH 035/610] FIX: object cloning: set unique extrafield values to null to prevent duplicates --- htdocs/core/class/commonobject.class.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index a4fc828ef4b..b2d5ac8e068 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -5307,8 +5307,15 @@ abstract class CommonObject $attributeLabel = $extrafields->attributes[$this->table_element]['label'][$attributeKey]; $attributeParam = $extrafields->attributes[$this->table_element]['param'][$attributeKey]; $attributeRequired = $extrafields->attributes[$this->table_element]['required'][$attributeKey]; + $attributeUnique = $extrafields->attributes[$this->table_element]['unique'][$attributeKey]; $attrfieldcomputed = $extrafields->attributes[$this->table_element]['computed'][$attributeKey]; + // If we clone, we have to clean unique extrafields to prevent duplicates. + // This behaviour can be prevented by external code by changing $this->context['createfromclone'] value in createFrom hook + if (! empty($this->context['createfromclone']) && $this->context['createfromclone'] == 'createfromclone' && ! empty($attributeUnique)) { + $new_array_options[$key] = null; + } + // Similar code than into insertExtraFields if ($attributeRequired) { From 1908acb1311150e1fcdb7d3a91dc23f0b21e9a61 Mon Sep 17 00:00:00 2001 From: steve Date: Tue, 1 Mar 2022 11:42:10 +0100 Subject: [PATCH 036/610] feat: add Accountancy code --- htdocs/user/bank.php | 6 ++++++ htdocs/user/card.php | 8 ++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/htdocs/user/bank.php b/htdocs/user/bank.php index fa4c7231de5..47cc3826e51 100644 --- a/htdocs/user/bank.php +++ b/htdocs/user/bank.php @@ -502,6 +502,12 @@ if ($action != 'edit' && $action != 'create') { // If not bank account yet, $ac print ''; } + // Accountancy code + if (!empty($conf->accounting->enabled)) { + print ''.$langs->trans("AccountancyCode").''; + print ''.$object->accountancy_code.''; + } + print ''; print '
'; diff --git a/htdocs/user/card.php b/htdocs/user/card.php index de1ca3a5d92..f50a4622cd4 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -1577,10 +1577,10 @@ if ($action == 'create' || $action == 'adduserldap') { } // Accountancy code - if (!empty($conf->accounting->enabled)) { - print ''.$langs->trans("AccountancyCode").''; - print ''.$object->accountancy_code.''; - } + //if (!empty($conf->accounting->enabled)) { + // print ''.$langs->trans("AccountancyCode").''; + // print ''.$object->accountancy_code.''; + //} print ''; From cb17f2029ed1bddd2d6b310bd307725fb251242f Mon Sep 17 00:00:00 2001 From: Steve Date: Wed, 2 Mar 2022 11:20:07 +0100 Subject: [PATCH 037/610] wip: add ref_employee and national_registration_number fields --- .../install/mysql/migration/15.0.0-16.0.0.sql | 5 ++++- htdocs/install/mysql/tables/llx_user.sql | 2 ++ htdocs/user/bank.php | 13 ++++++++++++ htdocs/user/card.php | 21 +++++++++++++++++++ htdocs/user/class/user.class.php | 21 +++++++++++++++++++ 5 files changed, 61 insertions(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql index 5d838fc8bb1..fd32936fb04 100644 --- a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql +++ b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql @@ -272,4 +272,7 @@ ALTER TABLE llx_reception MODIFY COLUMN ref_supplier varchar(128); ALTER TABLE llx_bank_account ADD COLUMN pti_in_ctti smallint DEFAULT 0 AFTER domiciliation; -- Set default ticket type to OTHER if no default exists -UPDATE llx_c_ticket_type SET use_default=1 WHERE code='OTHER' AND NOT EXISTS(SELECT * FROM (SELECT * FROM llx_c_ticket_type) AS t WHERE use_default=1); \ No newline at end of file +UPDATE llx_c_ticket_type SET use_default=1 WHERE code='OTHER' AND NOT EXISTS(SELECT * FROM (SELECT * FROM llx_c_ticket_type) AS t WHERE use_default=1); + +ALTER TABLE llx_user ADD COLUMN ref_employee varchar(50) DEFAULT NULL; +ALTER TABLE llx_user ADD COLUMN national_registration_number varchar(50) DEFAULT NULL; diff --git a/htdocs/install/mysql/tables/llx_user.sql b/htdocs/install/mysql/tables/llx_user.sql index 6cfdf8bfbb8..694ed360b21 100644 --- a/htdocs/install/mysql/tables/llx_user.sql +++ b/htdocs/install/mysql/tables/llx_user.sql @@ -108,5 +108,7 @@ create table llx_user import_key varchar(14), -- import key default_range integer, default_c_exp_tax_cat integer, + employee_number varchar(50), + national_registration_number varchar(50), fk_warehouse integer -- default warehouse os user )ENGINE=innodb; diff --git a/htdocs/user/bank.php b/htdocs/user/bank.php index 47cc3826e51..17d52d7cbb6 100644 --- a/htdocs/user/bank.php +++ b/htdocs/user/bank.php @@ -508,6 +508,19 @@ if ($action != 'edit' && $action != 'create') { // If not bank account yet, $ac print ''.$object->accountancy_code.''; } + // Employee Number + if (!empty($conf->accounting->enabled)) { + print ''.$langs->trans("ref_employee").''; + print ''.$object->ref_employee.''; + } + + // National registration number + if (!empty($conf->accounting->enabled)) { + print ''.$langs->trans("NationalRegistrationNumber").''; + print ''.$object->national_registration_number.''; + } + + print ''; print '
'; diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 00c94feaf44..68b62950811 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -247,6 +247,8 @@ if (empty($reshook)) { $object->civility_code = GETPOST("civility_code", 'aZ09'); $object->lastname = GETPOST("lastname", 'alphanohtml'); $object->firstname = GETPOST("firstname", 'alphanohtml'); + $object->ref_employee = GETPOST("ref_employee", 'alphanohtml'); + $object->national_registration_number = GETPOST("national_registration_number", 'alphanohtml'); $object->login = GETPOST("login", 'alphanohtml'); $object->api_key = GETPOST("api_key", 'alphanohtml'); $object->gender = GETPOST("gender", 'aZ09'); @@ -259,6 +261,7 @@ if (empty($reshook)) { $object->office_phone = GETPOST("office_phone", 'alphanohtml'); $object->office_fax = GETPOST("office_fax", 'alphanohtml'); $object->user_mobile = GETPOST("user_mobile", 'alphanohtml'); + $object->ref_employee = GETPOST("ref_employee", 'alphanohtml'); if (!empty($conf->socialnetworks->enabled)) { $object->socialnetworks = array(); @@ -402,6 +405,7 @@ if (empty($reshook)) { $object->civility_code = GETPOST("civility_code", 'aZ09'); $object->lastname = GETPOST("lastname", 'alphanohtml'); $object->firstname = GETPOST("firstname", 'alphanohtml'); + $object->ref_employee = GETPOST("ref_employee", 'alphanohtml'); $object->gender = GETPOST("gender", 'aZ09'); $object->pass = GETPOST("password", 'none'); // We can keep 'none' for password fields $object->api_key = (GETPOST("api_key", 'alphanohtml')) ? GETPOST("api_key", 'alphanohtml') : $object->api_key; @@ -845,6 +849,12 @@ if ($action == 'create' || $action == 'adduserldap') { } print ''; + // Ref remployee + print ''.$langs->trans("ref_employee").''; + print ''; + print ''; + print ''; + // Login print ''.$langs->trans("Login").''; print ''; @@ -2089,6 +2099,17 @@ if ($action == 'create' || $action == 'adduserldap') { } print ''; + // Ref employee + print "".''.$langs->trans("ref_employee").''; + print ''; + if ($caneditfield && !$object->ldap_sid) { + print ''; + } else { + print ''; + print $object->ref_employee; + } + print ''; + // Login print "".''.$langs->trans("Login").''; print ''; diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 6c5926f8c43..84118961692 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -339,6 +339,17 @@ class User extends CommonObject public $dateemploymentend; // Define date of employment end by company public $default_c_exp_tax_cat; + + /** + * @var string ref for employee + */ + public $ref_employee; + + /** + * @var string national registration number + */ + public $national_registration_number; + public $default_range; /** @@ -350,6 +361,8 @@ class User extends CommonObject 'rowid'=>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'index'=>1, 'position'=>1, 'comment'=>'Id'), 'lastname'=>array('type'=>'varchar(50)', 'label'=>'LastName', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>20, 'searchall'=>1), 'firstname'=>array('type'=>'varchar(50)', 'label'=>'FirstName', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1), + 'ref_employee'=>array('type'=>'varchar(50)', 'label'=>'ref_employee', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>30, 'searchall'=>1), + 'national_registration_number'=>array('type'=>'varchar(50)', 'label'=>'national_registration_number', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>40, 'searchall'=>1) ); @@ -437,6 +450,8 @@ class User extends CommonObject $sql .= " u.fk_warehouse,"; $sql .= " u.ref_ext,"; $sql .= " u.default_range, u.default_c_exp_tax_cat,"; // Expense report default mode + $sql .= " u.national_registration_number,"; + $sql .= " u.ref_employee,"; $sql .= " c.code as country_code, c.label as country,"; $sql .= " d.code_departement as state_code, d.nom as state"; $sql .= " FROM ".$this->db->prefix()."user as u"; @@ -488,6 +503,8 @@ class User extends CommonObject $this->civility_code = $obj->civility_code; $this->lastname = $obj->lastname; $this->firstname = $obj->firstname; + $this->ref_employee = $obj->ref_employee; + $this->national_registration_number = $obj->national_registration_number; $this->employee = $obj->employee; @@ -1755,6 +1772,8 @@ class User extends CommonObject $this->civility_code = trim($this->civility_code); $this->lastname = trim($this->lastname); $this->firstname = trim($this->firstname); + $this->ref_employee = trim($this->ref_employee); + $this->national_registration_number = trim($this->national_registration_number); $this->employee = $this->employee ? $this->employee : 0; $this->login = trim($this->login); $this->gender = trim($this->gender); @@ -1847,6 +1866,8 @@ class User extends CommonObject $sql .= " civility = '".$this->db->escape($this->civility_code)."'"; $sql .= ", lastname = '".$this->db->escape($this->lastname)."'"; $sql .= ", firstname = '".$this->db->escape($this->firstname)."'"; + $sql .= ", ref_employee = '".$this->db->escape($this->ref_employee)."'"; + $sql .= ", national_registration_number = '".$this->db->escape($this->national_registration_number)."'"; $sql .= ", employee = ".(int) $this->employee; $sql .= ", login = '".$this->db->escape($this->login)."'"; $sql .= ", api_key = ".($this->api_key ? "'".$this->db->escape($this->api_key)."'" : "null"); From dcabd046d92b16f286542eaf6f59176e9bebdfa7 Mon Sep 17 00:00:00 2001 From: steve Date: Wed, 2 Mar 2022 11:52:44 +0100 Subject: [PATCH 038/610] feat: add ref_employee and national_registration_number fields --- htdocs/user/card.php | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 68b62950811..961ace97f53 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -261,7 +261,6 @@ if (empty($reshook)) { $object->office_phone = GETPOST("office_phone", 'alphanohtml'); $object->office_fax = GETPOST("office_fax", 'alphanohtml'); $object->user_mobile = GETPOST("user_mobile", 'alphanohtml'); - $object->ref_employee = GETPOST("ref_employee", 'alphanohtml'); if (!empty($conf->socialnetworks->enabled)) { $object->socialnetworks = array(); @@ -406,6 +405,7 @@ if (empty($reshook)) { $object->lastname = GETPOST("lastname", 'alphanohtml'); $object->firstname = GETPOST("firstname", 'alphanohtml'); $object->ref_employee = GETPOST("ref_employee", 'alphanohtml'); + $object->national_registration_number = GETPOST("national_registration_number", 'alphanohtml'); $object->gender = GETPOST("gender", 'aZ09'); $object->pass = GETPOST("password", 'none'); // We can keep 'none' for password fields $object->api_key = (GETPOST("api_key", 'alphanohtml')) ? GETPOST("api_key", 'alphanohtml') : $object->api_key; @@ -855,6 +855,12 @@ if ($action == 'create' || $action == 'adduserldap') { print ''; print ''; + // National registration number + print ''.$langs->trans("national_registration_number").''; + print ''; + print ''; + print ''; + // Login print ''.$langs->trans("Login").''; print ''; @@ -2110,6 +2116,17 @@ if ($action == 'create' || $action == 'adduserldap') { } print ''; + // National registration number + print "".''.$langs->trans("national_registration_number").''; + print ''; + if ($caneditfield && !$object->ldap_sid) { + print ''; + } else { + print ''; + print $object->national_registration_number; + } + print ''; + // Login print "".''.$langs->trans("Login").''; print ''; From e2f727ef55b794c5a0d9b63593040bbc3bcd5687 Mon Sep 17 00:00:00 2001 From: steve Date: Wed, 2 Mar 2022 14:21:49 +0100 Subject: [PATCH 039/610] feat: langs trans ref_employee and national registration number --- htdocs/langs/en_US/companies.lang | 2 ++ htdocs/user/bank.php | 2 +- htdocs/user/card.php | 8 ++++---- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/htdocs/langs/en_US/companies.lang b/htdocs/langs/en_US/companies.lang index 3e85f1b35f7..edd6f7b7dd8 100644 --- a/htdocs/langs/en_US/companies.lang +++ b/htdocs/langs/en_US/companies.lang @@ -51,6 +51,8 @@ CivilityCode=Civility code RegisteredOffice=Registered office Lastname=Last name Firstname=First name +RefEmployee=Employee reference +NationalRegistrationNumber=National registration number PostOrFunction=Job position UserTitle=Title NatureOfThirdParty=Nature of Third party diff --git a/htdocs/user/bank.php b/htdocs/user/bank.php index 17d52d7cbb6..b84ae16c55f 100644 --- a/htdocs/user/bank.php +++ b/htdocs/user/bank.php @@ -510,7 +510,7 @@ if ($action != 'edit' && $action != 'create') { // If not bank account yet, $ac // Employee Number if (!empty($conf->accounting->enabled)) { - print ''.$langs->trans("ref_employee").''; + print ''.$langs->trans("RefEmployee").''; print ''.$object->ref_employee.''; } diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 961ace97f53..3bbf6438489 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -850,13 +850,13 @@ if ($action == 'create' || $action == 'adduserldap') { print ''; // Ref remployee - print ''.$langs->trans("ref_employee").''; + print ''.$langs->trans("RefEmployee").''; print ''; print ''; print ''; // National registration number - print ''.$langs->trans("national_registration_number").''; + print ''.$langs->trans("NationalRegistrationNumber").''; print ''; print ''; print ''; @@ -2106,7 +2106,7 @@ if ($action == 'create' || $action == 'adduserldap') { print ''; // Ref employee - print "".''.$langs->trans("ref_employee").''; + print "".''.$langs->trans("RefEmployee").''; print ''; if ($caneditfield && !$object->ldap_sid) { print ''; @@ -2117,7 +2117,7 @@ if ($action == 'create' || $action == 'adduserldap') { print ''; // National registration number - print "".''.$langs->trans("national_registration_number").''; + print "".''.$langs->trans("NationalRegistrationNumber").''; print ''; if ($caneditfield && !$object->ldap_sid) { print ''; From 9900e5dd319692905785bbdbbf3406740021490a Mon Sep 17 00:00:00 2001 From: steve Date: Wed, 2 Mar 2022 14:51:16 +0100 Subject: [PATCH 040/610] Clean --- htdocs/user/card.php | 6 ------ 1 file changed, 6 deletions(-) diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 3bbf6438489..720387e6c47 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -1592,12 +1592,6 @@ if ($action == 'create' || $action == 'adduserldap') { print ''; } - // Accountancy code - //if (!empty($conf->accounting->enabled)) { - // print ''.$langs->trans("AccountancyCode").''; - // print ''.$object->accountancy_code.''; - //} - print ''; print '
'; From dd9a350136daf495348a548bc971369e19e4a226 Mon Sep 17 00:00:00 2001 From: wdammak <26695620+wdammak@users.noreply.github.com> Date: Wed, 2 Mar 2022 22:41:00 +0100 Subject: [PATCH 041/610] Simplification of the code by separating the part given to menu processing The goal: - A simplification of the code for easier maintenance is targeted - Separation of data to left menu display processing - Plan in the future to put the left menu data directly in the folders of the modules concerned and which will be loaded automatically by eldy.lib.php or eldy_menus.php (for example add a folder "menus/leftmenu.php" in the module "bank" => "bank/menus/leftmenu.php")... This greatly cleans up the code and makes the modules easier to maintain while also avoiding the massive use of hooks for external modules. - A reuse of the left menus in other corners of the ERP just by calling the function of the desired menu. - The code is much lighter! is more readable with easier display order modification! --- htdocs/core/menus/standard/eldy.lib.php | 2530 ++++++++++++----------- 1 file changed, 1378 insertions(+), 1152 deletions(-) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 9361b01b086..5d2181c3e82 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -676,7 +676,1372 @@ function print_end_menu_array() print "\n"; } +/** + * Get left Menu HOME + * + * @param string $mainmenu + * @param Menu &$newmenu Object Menu to return back list of menu entries + * @param string $usemenuhider + * @param string $leftmenu + * @param int $type_user + * @return void + */ +function get_left_menu_home($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0) +{ + global $user, $conf, $langs; + if ($mainmenu == 'home') { + $langs->load("users"); + + // Home - dashboard + $newmenu->add("/index.php?mainmenu=home&leftmenu=home", $langs->trans("MyDashboard"), 0, 1, '', $mainmenu, 'home', 0, '', '', '', ''); + + // Setup + $newmenu->add("/admin/index.php?mainmenu=home&leftmenu=setup", $langs->trans("Setup"), 0, $user->admin, '', $mainmenu, 'setup', 0, '', '', '', ''); + + if ($usemenuhider || empty($leftmenu) || $leftmenu == "setup") { + // Load translation files required by the page + $langs->loadLangs(array("admin", "help")); + + $warnpicto = ''; + if (empty($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_INFO_SOCIETE_COUNTRY)) { + $langs->load("errors"); + $warnpicto = img_warning($langs->trans("WarningMandatorySetupNotComplete")); + } + $newmenu->add("/admin/company.php?mainmenu=home", $langs->trans("MenuCompanySetup").$warnpicto, 1); + + $warnpicto = ''; + if (count($conf->modules) <= (empty($conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING) ? 1 : $conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)) { // If only user module enabled + $langs->load("errors"); + $warnpicto = img_warning($langs->trans("WarningMandatorySetupNotComplete")); + } + $newmenu->add("/admin/modules.php?mainmenu=home", $langs->trans("Modules").$warnpicto, 1); + $newmenu->add("/admin/ihm.php?mainmenu=home", $langs->trans("GUISetup"), 1); + $newmenu->add("/admin/menus.php?mainmenu=home", $langs->trans("Menus"), 1); + + $newmenu->add("/admin/translation.php?mainmenu=home", $langs->trans("Translation"), 1); + $newmenu->add("/admin/defaultvalues.php?mainmenu=home", $langs->trans("DefaultValues"), 1); + $newmenu->add("/admin/boxes.php?mainmenu=home", $langs->trans("Boxes"), 1); + $newmenu->add("/admin/delais.php?mainmenu=home", $langs->trans("MenuWarnings"), 1); + $newmenu->add("/admin/security_other.php?mainmenu=home", $langs->trans("Security"), 1); + $newmenu->add("/admin/limits.php?mainmenu=home", $langs->trans("MenuLimits"), 1); + $newmenu->add("/admin/pdf.php?mainmenu=home", $langs->trans("PDF"), 1); + + $warnpicto = ''; + if (!empty($conf->global->MAIN_MAIL_SENDMODE) && $conf->global->MAIN_MAIL_SENDMODE == 'mail' && empty($conf->global->MAIN_HIDE_WARNING_TO_ENCOURAGE_SMTP_SETUP)) { + $langs->load("errors"); + $warnpicto = img_warning($langs->trans("WarningPHPMailD")); + } + if (!empty($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmail')) && empty($conf->global->MAIN_MAIL_SMTP_SERVER)) { + $langs->load("errors"); + $warnpicto = img_warning($langs->trans("ErrorSetupOfEmailsNotComplete")); + } + + $newmenu->add("/admin/mails.php?mainmenu=home", $langs->trans("Emails").$warnpicto, 1); + $newmenu->add("/admin/sms.php?mainmenu=home", $langs->trans("SMS"), 1); + $newmenu->add("/admin/dict.php?mainmenu=home", $langs->trans("Dictionary"), 1); + $newmenu->add("/admin/const.php?mainmenu=home", $langs->trans("OtherSetup"), 1); + } + + // System tools + $newmenu->add("/admin/tools/index.php?mainmenu=home&leftmenu=admintools", $langs->trans("AdminTools"), 0, $user->admin, '', $mainmenu, 'admintools', 0, '', '', '', ''); + if ($usemenuhider || empty($leftmenu) || preg_match('/^admintools/', $leftmenu)) { + // Load translation files required by the page + $langs->loadLangs(array('admin', 'help')); + + $newmenu->add('/admin/system/dolibarr.php?mainmenu=home&leftmenu=admintools_info', $langs->trans('InfoDolibarr'), 1); + if ($usemenuhider || empty($leftmenu) || $leftmenu == 'admintools_info') { + $newmenu->add('/admin/system/modules.php?mainmenu=home&leftmenu=admintools_info', $langs->trans('Modules'), 2); + $newmenu->add('/admin/triggers.php?mainmenu=home&leftmenu=admintools_info', $langs->trans('Triggers'), 2); + $newmenu->add('/admin/system/filecheck.php?mainmenu=home&leftmenu=admintools_info', $langs->trans('FileCheck'), 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); + $newmenu->add('/admin/system/database.php?mainmenu=home&leftmenu=admintools', $langs->trans('InfoDatabase'), 1); + $newmenu->add("/admin/system/perf.php?mainmenu=home&leftmenu=admintools", $langs->trans("InfoPerf"), 1); + $newmenu->add("/admin/system/security.php?mainmenu=home&leftmenu=admintools", $langs->trans("InfoSecurity"), 1); + $newmenu->add("/admin/tools/dolibarr_export.php?mainmenu=home&leftmenu=admintools", $langs->trans("Backup"), 1); + $newmenu->add("/admin/tools/dolibarr_import.php?mainmenu=home&leftmenu=admintools", $langs->trans("Restore"), 1); + $newmenu->add("/admin/tools/update.php?mainmenu=home&leftmenu=admintools", $langs->trans("MenuUpgrade"), 1); + $newmenu->add("/admin/tools/purge.php?mainmenu=home&leftmenu=admintools", $langs->trans("Purge"), 1); + $newmenu->add("/admin/tools/listevents.php?mainmenu=home&leftmenu=admintools", $langs->trans("Audit"), 1); + $newmenu->add("/admin/tools/listsessions.php?mainmenu=home&leftmenu=admintools", $langs->trans("Sessions"), 1); + $newmenu->add('/admin/system/about.php?mainmenu=home&leftmenu=admintools', $langs->trans('ExternalResources'), 1); + + if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) { + $langs->load("products"); + $newmenu->add("/product/admin/product_tools.php?mainmenu=home&leftmenu=admintools", $langs->trans("ProductVatMassChange"), 1, $user->admin); + } + } + + $newmenu->add("/user/home.php?leftmenu=users", $langs->trans("MenuUsersAndGroups"), 0, $user->rights->user->user->lire, '', $mainmenu, 'users', 0, '', '', '', img_picto('', 'user', 'class="paddingright pictofixedwidth"')); + if ($user->rights->user->user->lire) { + if ($usemenuhider || empty($leftmenu) || $leftmenu == "users") { + $newmenu->add("", $langs->trans("Users"), 1, $user->rights->user->user->lire || $user->admin); + $newmenu->add("/user/card.php?leftmenu=users&action=create", $langs->trans("NewUser"), 2, ($user->rights->user->user->creer || $user->admin) && !(!empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE), '', 'home'); + $newmenu->add("/user/list.php?leftmenu=users", $langs->trans("ListOfUsers"), 2, $user->rights->user->user->lire || $user->admin); + $newmenu->add("/user/hierarchy.php?leftmenu=users", $langs->trans("HierarchicView"), 2, $user->rights->user->user->lire || $user->admin); + if (!empty($conf->categorie->enabled)) { + $langs->load("categories"); + $newmenu->add("/categories/index.php?leftmenu=users&type=7", $langs->trans("UsersCategoriesShort"), 2, $user->rights->categorie->lire, '', $mainmenu, 'cat'); + } + $newmenu->add("", $langs->trans("Groups"), 1, ($user->rights->user->user->lire || $user->admin) && !(!empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE)); + $newmenu->add("/user/group/card.php?leftmenu=users&action=create", $langs->trans("NewGroup"), 2, ((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) ? $user->rights->user->group_advance->write : $user->rights->user->user->creer) || $user->admin) && !(!empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE)); + $newmenu->add("/user/group/list.php?leftmenu=users", $langs->trans("ListOfGroups"), 2, ((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) ? $user->rights->user->group_advance->read : $user->rights->user->user->lire) || $user->admin) && !(!empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE)); + } + } + } +} + +/** + * Get left Menu THIRDPARTIES + * + * @param string $mainmenu + * @param Menu &$newmenu Object Menu to return back list of menu entries + * @param string $usemenuhider + * @param string $leftmenu + * @param int $type_user + * @return void + */ +function get_left_menu_thridparties($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0) +{ + global $user, $conf, $langs; + + if ($mainmenu == 'companies') { + // Societes + if (!empty($conf->societe->enabled)) { + $langs->load("companies"); + $newmenu->add("/societe/index.php?leftmenu=thirdparties", $langs->trans("ThirdParty"), 0, $user->rights->societe->lire, '', $mainmenu, 'thirdparties', 0, '', '', '', img_picto('', 'company', 'class="paddingright pictofixedwidth"')); + + if ($user->rights->societe->creer) { + $newmenu->add("/societe/card.php?action=create", $langs->trans("MenuNewThirdParty"), 1); + if (!$conf->use_javascript_ajax) { + $newmenu->add("/societe/card.php?action=create&private=1", $langs->trans("MenuNewPrivateIndividual"), 1); + } + } + } + + $newmenu->add("/societe/list.php?leftmenu=thirdparties", $langs->trans("List"), 1); + + // Prospects + if (!empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) { + $langs->load("commercial"); + $newmenu->add("/societe/list.php?type=p&leftmenu=prospects", $langs->trans("ListProspectsShort"), 2, $user->rights->societe->lire, '', $mainmenu, 'prospects'); + /* no more required, there is a filter that can do more + if ($usemenuhider || empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/societe/list.php?type=p&sortfield=s.datec&sortorder=desc&begin=&search_stcomm=-1", $langs->trans("LastProspectDoNotContact"), 2, $user->rights->societe->lire); + if ($usemenuhider || empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/societe/list.php?type=p&sortfield=s.datec&sortorder=desc&begin=&search_stcomm=0", $langs->trans("LastProspectNeverContacted"), 2, $user->rights->societe->lire); + if ($usemenuhider || empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/societe/list.php?type=p&sortfield=s.datec&sortorder=desc&begin=&search_stcomm=1", $langs->trans("LastProspectToContact"), 2, $user->rights->societe->lire); + if ($usemenuhider || empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/societe/list.php?type=p&sortfield=s.datec&sortorder=desc&begin=&search_stcomm=2", $langs->trans("LastProspectContactInProcess"), 2, $user->rights->societe->lire); + if ($usemenuhider || empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/societe/list.php?type=p&sortfield=s.datec&sortorder=desc&begin=&search_stcomm=3", $langs->trans("LastProspectContactDone"), 2, $user->rights->societe->lire); + */ + $newmenu->add("/societe/card.php?leftmenu=prospects&action=create&type=p", $langs->trans("MenuNewProspect"), 3, $user->rights->societe->creer); + } + + // Customers/Prospects + if (!empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) { + $langs->load("commercial"); + $newmenu->add("/societe/list.php?type=c&leftmenu=customers", $langs->trans("ListCustomersShort"), 2, $user->rights->societe->lire, '', $mainmenu, 'customers'); + + $newmenu->add("/societe/card.php?leftmenu=customers&action=create&type=c", $langs->trans("MenuNewCustomer"), 3, $user->rights->societe->creer); + } + + // Suppliers + if (!empty($conf->societe->enabled) && (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) || !empty($conf->supplier_proposal->enabled))) { + $langs->load("suppliers"); + $newmenu->add("/societe/list.php?type=f&leftmenu=suppliers", $langs->trans("ListSuppliersShort"), 2, ($user->rights->fournisseur->lire || $user->rights->supplier_order->lire || $user->rights->supplier_invoice->lire || $user->rights->supplier_proposal->lire), '', $mainmenu, 'suppliers'); + $newmenu->add("/societe/card.php?leftmenu=suppliers&action=create&type=f", $langs->trans("MenuNewSupplier"), 3, $user->rights->societe->creer && ($user->rights->fournisseur->lire || $user->rights->supplier_order->lire || $user->rights->supplier_invoice->lire || $user->rights->supplier_proposal->lire)); + } + + // Categories + if (!empty($conf->categorie->enabled)) { + $langs->load("categories"); + if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) { + // Categories prospects/customers + $menutoshow = $langs->trans("CustomersProspectsCategoriesShort"); + if (!empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) { + $menutoshow = $langs->trans("CustomersCategoriesShort"); + } + if (!empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) { + $menutoshow = $langs->trans("ProspectsCategoriesShort"); + } + $newmenu->add("/categories/index.php?leftmenu=cat&type=2", $menutoshow, 1, $user->rights->categorie->lire, '', $mainmenu, 'cat'); + } + // Categories suppliers + if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) { + $newmenu->add("/categories/index.php?leftmenu=catfournish&type=1", $langs->trans("SuppliersCategoriesShort"), 1, $user->rights->categorie->lire); + } + } + + // Contacts + $newmenu->add("/societe/index.php?leftmenu=thirdparties", (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses")), 0, $user->rights->societe->contact->lire, '', $mainmenu, 'contacts', 0, '', '', '', img_picto('', 'contact', 'class="paddingright pictofixedwidth"')); + + $newmenu->add("/contact/card.php?leftmenu=contacts&action=create", (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("NewContact") : $langs->trans("NewContactAddress")), 1, $user->rights->societe->contact->creer); + $newmenu->add("/contact/list.php?leftmenu=contacts", $langs->trans("List"), 1, $user->rights->societe->contact->lire); + if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) { + $newmenu->add("/contact/list.php?leftmenu=contacts&type=p", $langs->trans("Prospects"), 2, $user->rights->societe->contact->lire); + } + if (empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) { + $newmenu->add("/contact/list.php?leftmenu=contacts&type=c", $langs->trans("Customers"), 2, $user->rights->societe->contact->lire); + } + if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) { + $newmenu->add("/contact/list.php?leftmenu=contacts&type=f", $langs->trans("Suppliers"), 2, $user->rights->societe->contact->lire); + } + $newmenu->add("/contact/list.php?leftmenu=contacts&type=o", $langs->trans("ContactOthers"), 2, $user->rights->societe->contact->lire); + //$newmenu->add("/contact/list.php?userid=$user->id", $langs->trans("MyContacts"), 1, $user->rights->societe->contact->lire); + + // Categories + if (!empty($conf->categorie->enabled)) { + $langs->load("categories"); + // Categories Contact + $newmenu->add("/categories/index.php?leftmenu=catcontact&type=4", $langs->trans("ContactCategoriesShort"), 1, $user->rights->categorie->lire, '', $mainmenu, 'cat'); + } + } +} + +/** + * Get left Menu COMMERCIAL (propal, commande, supplier_proposal, supplier_order, contrat, ficheinter) + * + * @param string $mainmenu + * @param Menu &$newmenu Object Menu to return back list of menu entries + * @param string $usemenuhider + * @param string $leftmenu + * @param int $type_user + * @return void + */ +function get_left_menu_commercial($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0) +{ + global $user, $conf, $langs; + + if ($mainmenu == 'commercial') { + $langs->load("companies"); + + // Customer proposal + if (!empty($conf->propal->enabled)) { + $langs->load("propal"); + $newmenu->add("/comm/propal/index.php?leftmenu=propals", $langs->trans("Proposals"), 0, $user->rights->propale->lire, '', $mainmenu, 'propals', 100, '', '', '', img_picto('', 'propal', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/comm/propal/card.php?action=create&leftmenu=propals", $langs->trans("NewPropal"), 1, $user->rights->propale->creer); + $newmenu->add("/comm/propal/list.php?leftmenu=propals", $langs->trans("List"), 1, $user->rights->propale->lire); + if ($usemenuhider || empty($leftmenu) || $leftmenu == "propals") { + $newmenu->add("/comm/propal/list.php?leftmenu=propals&search_status=0", $langs->trans("PropalsDraft"), 2, $user->rights->propale->lire); + $newmenu->add("/comm/propal/list.php?leftmenu=propals&search_status=1", $langs->trans("PropalsOpened"), 2, $user->rights->propale->lire); + $newmenu->add("/comm/propal/list.php?leftmenu=propals&search_status=2", $langs->trans("PropalStatusSigned"), 2, $user->rights->propale->lire); + $newmenu->add("/comm/propal/list.php?leftmenu=propals&search_status=3", $langs->trans("PropalStatusNotSigned"), 2, $user->rights->propale->lire); + $newmenu->add("/comm/propal/list.php?leftmenu=propals&search_status=4", $langs->trans("PropalStatusBilled"), 2, $user->rights->propale->lire); + //$newmenu->add("/comm/propal/list.php?leftmenu=propals&search_status=2,3,4", $langs->trans("PropalStatusClosedShort"), 2, $user->rights->propale->lire); + } + $newmenu->add("/comm/propal/stats/index.php?leftmenu=propals", $langs->trans("Statistics"), 1, $user->rights->propale->lire); + } + + // Customers orders + if (!empty($conf->commande->enabled)) { + $langs->load("orders"); + $newmenu->add("/commande/index.php?leftmenu=orders", $langs->trans("CustomersOrders"), 0, $user->rights->commande->lire, '', $mainmenu, 'orders', 200, '', '', '', img_picto('', 'order', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/commande/card.php?action=create&leftmenu=orders", $langs->trans("NewOrder"), 1, $user->rights->commande->creer); + $newmenu->add("/commande/list.php?leftmenu=orders", $langs->trans("List"), 1, $user->rights->commande->lire); + if ($usemenuhider || empty($leftmenu) || $leftmenu == "orders") { + $newmenu->add("/commande/list.php?leftmenu=orders&search_status=0", $langs->trans("StatusOrderDraftShort"), 2, $user->rights->commande->lire); + $newmenu->add("/commande/list.php?leftmenu=orders&search_status=1", $langs->trans("StatusOrderValidated"), 2, $user->rights->commande->lire); + if (!empty($conf->expedition->enabled)) { + $newmenu->add("/commande/list.php?leftmenu=orders&search_status=2", $langs->trans("StatusOrderSentShort"), 2, $user->rights->commande->lire); + } + $newmenu->add("/commande/list.php?leftmenu=orders&search_status=3", $langs->trans("StatusOrderDelivered"), 2, $user->rights->commande->lire); + //$newmenu->add("/commande/list.php?leftmenu=orders&search_status=4", $langs->trans("StatusOrderProcessed"), 2, $user->rights->commande->lire); + $newmenu->add("/commande/list.php?leftmenu=orders&search_status=-1", $langs->trans("StatusOrderCanceledShort"), 2, $user->rights->commande->lire); + } + $newmenu->add("/commande/stats/index.php?leftmenu=orders", $langs->trans("Statistics"), 1, $user->rights->commande->lire); + } + + // Supplier proposal + if (!empty($conf->supplier_proposal->enabled)) { + $langs->load("supplier_proposal"); + $newmenu->add("/supplier_proposal/index.php?leftmenu=propals_supplier", $langs->trans("SupplierProposalsShort"), 0, $user->rights->supplier_proposal->lire, '', $mainmenu, 'propals_supplier', 300, '', '', '', img_picto('', 'supplier_proposal', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/supplier_proposal/card.php?action=create&leftmenu=supplier_proposals", $langs->trans("SupplierProposalNew"), 1, $user->rights->supplier_proposal->creer); + $newmenu->add("/supplier_proposal/list.php?leftmenu=supplier_proposals", $langs->trans("List"), 1, $user->rights->supplier_proposal->lire); + $newmenu->add("/comm/propal/stats/index.php?leftmenu=supplier_proposals&mode=supplier", $langs->trans("Statistics"), 1, $user->rights->supplier_proposal->lire); + } + + // Suppliers orders + if (!empty($conf->supplier_order->enabled)) { + $langs->load("orders"); + $newmenu->add("/fourn/commande/index.php?leftmenu=orders_suppliers", $langs->trans("SuppliersOrders"), 0, $user->rights->fournisseur->commande->lire, '', $mainmenu, 'orders_suppliers', 400, '', '', '', img_picto('', 'supplier_order', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/fourn/commande/card.php?action=create&leftmenu=orders_suppliers", $langs->trans("NewSupplierOrderShort"), 1, $user->rights->fournisseur->commande->creer); + $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers", $langs->trans("List"), 1, $user->rights->fournisseur->commande->lire); + + if ($usemenuhider || empty($leftmenu) || $leftmenu == "orders_suppliers") { + $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=0", $langs->trans("StatusSupplierOrderDraftShort"), 2, $user->rights->fournisseur->commande->lire); + if (empty($conf->global->SUPPLIER_ORDER_HIDE_VALIDATED)) { + $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=1", $langs->trans("StatusSupplierOrderValidated"), 2, $user->rights->fournisseur->commande->lire); + } + $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=2", $langs->trans("StatusSupplierOrderApprovedShort"), 2, $user->rights->fournisseur->commande->lire); + $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=3", $langs->trans("StatusSupplierOrderOnProcessShort"), 2, $user->rights->fournisseur->commande->lire); + $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=4", $langs->trans("StatusSupplierOrderReceivedPartiallyShort"), 2, $user->rights->fournisseur->commande->lire); + $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=5", $langs->trans("StatusSupplierOrderReceivedAll"), 2, $user->rights->fournisseur->commande->lire); + $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=6,7", $langs->trans("StatusSupplierOrderCanceled"), 2, $user->rights->fournisseur->commande->lire); + $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=9", $langs->trans("StatusSupplierOrderRefused"), 2, $user->rights->fournisseur->commande->lire); + } + // Billed is another field. We should add instead a dedicated filter on list. if ($usemenuhider || empty($leftmenu) || $leftmenu=="orders_suppliers") $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&billed=1", $langs->trans("Billed"), 2, $user->rights->fournisseur->commande->lire); + + + $newmenu->add("/commande/stats/index.php?leftmenu=orders_suppliers&mode=supplier", $langs->trans("Statistics"), 1, $user->rights->fournisseur->commande->lire); + } + + // Contrat + if (!empty($conf->contrat->enabled)) { + $langs->load("contracts"); + $newmenu->add("/contrat/index.php?leftmenu=contracts", $langs->trans("ContractsSubscriptions"), 0, $user->rights->contrat->lire, '', $mainmenu, 'contracts', 2000, '', '', '', img_picto('', 'contract', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/contrat/card.php?action=create&leftmenu=contracts", $langs->trans("NewContractSubscription"), 1, $user->rights->contrat->creer); + $newmenu->add("/contrat/list.php?leftmenu=contracts", $langs->trans("List"), 1, $user->rights->contrat->lire); + $newmenu->add("/contrat/services_list.php?leftmenu=contracts", $langs->trans("MenuServices"), 1, $user->rights->contrat->lire); + if ($usemenuhider || empty($leftmenu) || $leftmenu == "contracts") { + $newmenu->add("/contrat/services_list.php?leftmenu=contracts&mode=0", $langs->trans("MenuInactiveServices"), 2, $user->rights->contrat->lire); + $newmenu->add("/contrat/services_list.php?leftmenu=contracts&mode=4", $langs->trans("MenuRunningServices"), 2, $user->rights->contrat->lire); + $newmenu->add("/contrat/services_list.php?leftmenu=contracts&mode=4&filter=expired", $langs->trans("MenuExpiredServices"), 2, $user->rights->contrat->lire); + $newmenu->add("/contrat/services_list.php?leftmenu=contracts&mode=5", $langs->trans("MenuClosedServices"), 2, $user->rights->contrat->lire); + } + } + + // Interventions + if (!empty($conf->ficheinter->enabled)) { + $langs->load("interventions"); + $newmenu->add("/fichinter/index.php?leftmenu=ficheinter", $langs->trans("Interventions"), 0, $user->rights->ficheinter->lire, '', $mainmenu, 'ficheinter', 2200, '', '', '', img_picto('', 'intervention', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/fichinter/card.php?action=create&leftmenu=ficheinter", $langs->trans("NewIntervention"), 1, $user->rights->ficheinter->creer, '', '', '', 201); + $newmenu->add("/fichinter/list.php?leftmenu=ficheinter", $langs->trans("List"), 1, $user->rights->ficheinter->lire, '', '', '', 202); + if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { + $newmenu->add("/fichinter/card-rec.php?leftmenu=ficheinter", $langs->trans("ListOfTemplates"), 1, $user->rights->ficheinter->lire, '', '', '', 203); + } + $newmenu->add("/fichinter/stats/index.php?leftmenu=ficheinter", $langs->trans("Statistics"), 1, $user->rights->ficheinter->lire); + } + } +} + +/** + * Get left COMPTA-FINANCIAL + * + * @param string $mainmenu + * @param Menu &$newmenu Object Menu to return back list of menu entries + * @param string $usemenuhider + * @param string $leftmenu + * @param int $type_user + * @return void + */ +function get_left_menu_billing($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0) +{ + global $user, $conf, $langs; + + if ($mainmenu == 'billing') { + $langs->load("companies"); + + // Customers invoices + if (!empty($conf->facture->enabled)) { + $langs->load("bills"); + $newmenu->add("/compta/facture/index.php?leftmenu=customers_bills", $langs->trans("BillsCustomers"), 0, $user->rights->facture->lire, '', $mainmenu, 'customers_bills', 0, '', '', '', img_picto('', 'bill', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/compta/facture/card.php?action=create", $langs->trans("NewBill"), 1, $user->rights->facture->creer); + $newmenu->add("/compta/facture/list.php?leftmenu=customers_bills", $langs->trans("List"), 1, $user->rights->facture->lire, '', $mainmenu, 'customers_bills_list'); + + if ($usemenuhider || empty($leftmenu) || preg_match('/customers_bills(|_draft|_notpaid|_paid|_canceled)$/', $leftmenu)) { + $newmenu->add("/compta/facture/list.php?leftmenu=customers_bills_draft&search_status=0", $langs->trans("BillShortStatusDraft"), 2, $user->rights->facture->lire); + $newmenu->add("/compta/facture/list.php?leftmenu=customers_bills_notpaid&search_status=1", $langs->trans("BillShortStatusNotPaid"), 2, $user->rights->facture->lire); + $newmenu->add("/compta/facture/list.php?leftmenu=customers_bills_paid&search_status=2", $langs->trans("BillShortStatusPaid"), 2, $user->rights->facture->lire); + $newmenu->add("/compta/facture/list.php?leftmenu=customers_bills_canceled&search_status=3", $langs->trans("BillShortStatusCanceled"), 2, $user->rights->facture->lire); + } + $newmenu->add("/compta/facture/invoicetemplate_list.php?leftmenu=customers_bills_templates", $langs->trans("ListOfTemplates"), 1, $user->rights->facture->creer, '', $mainmenu, 'customers_bills_templates'); // No need to see recurring invoices, if user has no permission to create invoice. + + $newmenu->add("/compta/paiement/list.php?leftmenu=customers_bills_payment", $langs->trans("Payments"), 1, $user->rights->facture->lire, '', $mainmenu, 'customers_bills_payment'); + + if (!empty($conf->global->BILL_ADD_PAYMENT_VALIDATION)) { + $newmenu->add("/compta/paiement/tovalidate.php?leftmenu=customers_bills_tovalid", $langs->trans("MenuToValid"), 2, $user->rights->facture->lire, '', $mainmenu, 'customer_bills_tovalid'); + } + if ($usemenuhider || empty($leftmenu) || preg_match('/customers_bills/', $leftmenu)) { + $newmenu->add("/compta/paiement/rapport.php?leftmenu=customers_bills_payment_report", $langs->trans("Reportings"), 2, $user->rights->facture->lire, '', $mainmenu, 'customers_bills_payment_report'); + } + + $newmenu->add("/compta/facture/stats/index.php?leftmenu=customers_bills_stats", $langs->trans("Statistics"), 1, $user->rights->facture->lire, '', $mainmenu, 'customers_bills_stats'); + } + + // Suppliers invoices + if (!empty($conf->societe->enabled) && !empty($conf->supplier_invoice->enabled)) { + $langs->load("bills"); + $newmenu->add("/fourn/facture/index.php?leftmenu=suppliers_bills", $langs->trans("BillsSuppliers"), 0, $user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills', 0, '', '', '', img_picto('', 'supplier_invoice', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/fourn/facture/card.php?leftmenu=suppliers_bills&action=create", $langs->trans("NewBill"), 1, ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer), '', $mainmenu, 'suppliers_bills_create'); + $newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills", $langs->trans("List"), 1, $user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills_list'); + + if ($usemenuhider || empty($leftmenu) || preg_match('/suppliers_bills/', $leftmenu)) { + $newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills_draft&search_status=0", $langs->trans("BillShortStatusDraft"), 2, $user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills_draft'); + $newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills_notpaid&search_status=1", $langs->trans("BillShortStatusNotPaid"), 2, $user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills_notpaid'); + $newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills_paid&search_status=2", $langs->trans("BillShortStatusPaid"), 2, $user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills_paid'); + } + + $newmenu->add("/fourn/facture/list-rec.php?leftmenu=supplierinvoicestemplate_list", $langs->trans("ListOfTemplates"), 1, $user->rights->fournisseur->facture->lire, '', $mainmenu, 'supplierinvoicestemplate_list'); + + $newmenu->add("/fourn/paiement/list.php?leftmenu=suppliers_bills_payment", $langs->trans("Payments"), 1, $user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills_payment'); + + if ($usemenuhider || empty($leftmenu) || preg_match('/suppliers_bills/', $leftmenu)) { + $newmenu->add("/fourn/facture/rapport.php?leftmenu=suppliers_bills_payment_report", $langs->trans("Reportings"), 2, $user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills_payment_report'); + } + + $newmenu->add("/compta/facture/stats/index.php?mode=supplier&leftmenu=suppliers_bills_stats", $langs->trans("Statistics"), 1, $user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills_stats'); + } + + // Orders + if (!empty($conf->commande->enabled)) { + $langs->load("orders"); + if (!empty($conf->facture->enabled)) { + $newmenu->add("/commande/list.php?leftmenu=orders&search_status=-3&billed=0&contextpage=billableorders", $langs->trans("MenuOrdersToBill2"), 0, $user->rights->commande->lire, '', $mainmenu, 'orders', 0, '', '', '', img_picto('', 'order', 'class="paddingright pictofixedwidth"')); + } + //if ($usemenuhider || empty($leftmenu) || $leftmenu=="orders") $newmenu->add("/commande/", $langs->trans("StatusOrderToBill"), 1, $user->rights->commande->lire); + } + + // Supplier Orders to bill + if (!empty($conf->supplier_invoice->enabled)) { + if (!empty($conf->global->SUPPLIER_MENU_ORDER_RECEIVED_INTO_INVOICE)) { + $langs->load("supplier"); + $newmenu->add("/fourn/commande/list.php?leftmenu=orders&search_status=5&billed=0", $langs->trans("MenuOrdersSupplierToBill"), 0, $user->rights->commande->lire, '', $mainmenu, 'orders', 0, '', '', '', img_picto('', 'supplier_order', 'class="paddingright pictofixedwidth"')); + //if ($usemenuhider || empty($leftmenu) || $leftmenu=="orders") $newmenu->add("/commande/", $langs->trans("StatusOrderToBill"), 1, $user->rights->commande->lire); + } + } + + + // Donations + if (!empty($conf->don->enabled)) { + $langs->load("donations"); + $newmenu->add("/don/index.php?leftmenu=donations&mainmenu=billing", $langs->trans("Donations"), 0, $user->rights->don->lire, '', $mainmenu, 'donations', 0, '', '', '', img_picto('', 'donation', 'class="paddingright pictofixedwidth"')); + if ($usemenuhider || empty($leftmenu) || $leftmenu == "donations") { + $newmenu->add("/don/card.php?leftmenu=donations&action=create", $langs->trans("NewDonation"), 1, $user->rights->don->creer); + $newmenu->add("/don/list.php?leftmenu=donations", $langs->trans("List"), 1, $user->rights->don->lire); + } + // if ($leftmenu=="donations") $newmenu->add("/don/stats/index.php",$langs->trans("Statistics"), 1, $user->rights->don->lire); + } + + // Taxes and social contributions + if (!empty($conf->tax->enabled)) { + $newmenu->add("/compta/charges/index.php?leftmenu=tax&mainmenu=billing", $langs->trans("MenuTaxesAndSpecialExpenses"), 0, $user->rights->tax->charges->lire, '', $mainmenu, 'tax', 0, '', '', '', img_picto('', 'payment', 'class="paddingright pictofixedwidth"')); + + $newmenu->add("/compta/sociales/list.php?leftmenu=tax_social", $langs->trans("MenuSocialContributions"), 1, $user->rights->tax->charges->lire); + if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_social/i', $leftmenu)) { + $newmenu->add("/compta/sociales/card.php?leftmenu=tax_social&action=create", $langs->trans("MenuNewSocialContribution"), 2, $user->rights->tax->charges->creer); + $newmenu->add("/compta/sociales/list.php?leftmenu=tax_social", $langs->trans("List"), 2, $user->rights->tax->charges->lire); + $newmenu->add("/compta/sociales/payments.php?leftmenu=tax_social&mainmenu=billing", $langs->trans("Payments"), 2, $user->rights->tax->charges->lire); + } + // VAT + if (empty($conf->global->TAX_DISABLE_VAT_MENUS)) { + global $mysoc; + + $newmenu->add("/compta/tva/list.php?leftmenu=tax_vat&mainmenu=billing", $langs->transcountry("VAT", $mysoc->country_code), 1, $user->rights->tax->charges->lire, '', $mainmenu, 'tax_vat'); + if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_vat/i', $leftmenu)) { + $newmenu->add("/compta/tva/card.php?leftmenu=tax_vat&action=create", $langs->trans("New"), 2, $user->rights->tax->charges->creer); + $newmenu->add("/compta/tva/list.php?leftmenu=tax_vat", $langs->trans("List"), 2, $user->rights->tax->charges->lire); + $newmenu->add("/compta/tva/payments.php?mode=tvaonly&leftmenu=tax_vat", $langs->trans("Payments"), 2, $user->rights->tax->charges->lire); + $newmenu->add("/compta/tva/index.php?leftmenu=tax_vat", $langs->trans("ReportByMonth"), 2, $user->rights->tax->charges->lire); + $newmenu->add("/compta/tva/clients.php?leftmenu=tax_vat", $langs->trans("ReportByThirdparties"), 2, $user->rights->tax->charges->lire); + $newmenu->add("/compta/tva/quadri_detail.php?leftmenu=tax_vat", $langs->trans("ReportByQuarter"), 2, $user->rights->tax->charges->lire); + } + + //Local Taxes 1 + if ($mysoc->useLocalTax(1) && (isset($mysoc->localtax1_assuj) && $mysoc->localtax1_assuj == "1")) { + $newmenu->add("/compta/localtax/list.php?leftmenu=tax_1_vat&mainmenu=billing&localTaxType=1", $langs->transcountry("LT1", $mysoc->country_code), 1, $user->rights->tax->charges->lire); + if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_1_vat/i', $leftmenu)) { + $newmenu->add("/compta/localtax/card.php?leftmenu=tax_1_vat&action=create&localTaxType=1", $langs->trans("New"), 2, $user->rights->tax->charges->creer); + $newmenu->add("/compta/localtax/list.php?leftmenu=tax_1_vat&localTaxType=1", $langs->trans("List"), 2, $user->rights->tax->charges->lire); + $newmenu->add("/compta/localtax/index.php?leftmenu=tax_1_vat&localTaxType=1", $langs->trans("ReportByMonth"), 2, $user->rights->tax->charges->lire); + $newmenu->add("/compta/localtax/clients.php?leftmenu=tax_1_vat&localTaxType=1", $langs->trans("ReportByThirdparties"), 2, $user->rights->tax->charges->lire); + $newmenu->add("/compta/localtax/quadri_detail.php?leftmenu=tax_1_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/list.php?leftmenu=tax_2_vat&mainmenu=billing&localTaxType=2", $langs->transcountry("LT2", $mysoc->country_code), 1, $user->rights->tax->charges->lire); + if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_2_vat/i', $leftmenu)) { + $newmenu->add("/compta/localtax/card.php?leftmenu=tax_2_vat&action=create&localTaxType=2", $langs->trans("New"), 2, $user->rights->tax->charges->creer); + $newmenu->add("/compta/localtax/list.php?leftmenu=tax_2_vat&localTaxType=2", $langs->trans("List"), 2, $user->rights->tax->charges->lire); + $newmenu->add("/compta/localtax/index.php?leftmenu=tax_2_vat&localTaxType=2", $langs->trans("ReportByMonth"), 2, $user->rights->tax->charges->lire); + $newmenu->add("/compta/localtax/clients.php?leftmenu=tax_2_vat&localTaxType=2", $langs->trans("ReportByThirdparties"), 2, $user->rights->tax->charges->lire); + $newmenu->add("/compta/localtax/quadri_detail.php?leftmenu=tax_2_vat&localTaxType=2", $langs->trans("ReportByQuarter"), 2, $user->rights->tax->charges->lire); + } + } + } + } + + // Salaries + if (!empty($conf->salaries->enabled)) { + $langs->load("salaries"); + $newmenu->add("/salaries/list.php?leftmenu=tax_salary&mainmenu=billing", $langs->trans("Salaries"), 0, $user->rights->salaries->read, '', $mainmenu, 'tax_salary', 0, '', '', '', img_picto('', 'salary', 'class="paddingright pictofixedwidth"')); + if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_salary/i', $leftmenu)) { + $newmenu->add("/salaries/card.php?leftmenu=tax_salary&action=create", $langs->trans("New"), 1, $user->rights->salaries->write); + $newmenu->add("/salaries/list.php?leftmenu=tax_salary", $langs->trans("List"), 1, $user->rights->salaries->read); + $newmenu->add("/salaries/payments.php?leftmenu=tax_salary", $langs->trans("Payments"), 1, $user->rights->salaries->read); + $newmenu->add("/salaries/stats/index.php?leftmenu=tax_salary", $langs->trans("Statistics"), 1, $user->rights->salaries->read); + } + } + + // Loan + if (!empty($conf->loan->enabled)) { + $langs->load("loan"); + $newmenu->add("/loan/list.php?leftmenu=tax_loan&mainmenu=billing", $langs->trans("Loans"), 0, $user->rights->loan->read, '', $mainmenu, 'tax_loan', 0, '', '', '', img_picto('', 'loan', 'class="paddingright pictofixedwidth"')); + if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_loan/i', $leftmenu)) { + $newmenu->add("/loan/card.php?leftmenu=tax_loan&action=create", $langs->trans("NewLoan"), 1, $user->rights->loan->write); + //$newmenu->add("/loan/payment/list.php?leftmenu=tax_loan",$langs->trans("Payments"),2,$user->rights->loan->read); + } + } + + // Various payment + if (!empty($conf->banque->enabled) && empty($conf->global->BANK_USE_OLD_VARIOUS_PAYMENT)) { + $langs->load("banks"); + $newmenu->add("/compta/bank/various_payment/list.php?leftmenu=tax_various&mainmenu=billing", $langs->trans("MenuVariousPayment"), 0, $user->rights->banque->lire, '', $mainmenu, 'tax_various', 0, '', '', '', img_picto('', 'payment', 'class="paddingright pictofixedwidth"')); + if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_various/i', $leftmenu)) { + $newmenu->add("/compta/bank/various_payment/card.php?leftmenu=tax_various&action=create", $langs->trans("New"), 1, $user->rights->banque->modifier); + $newmenu->add("/compta/bank/various_payment/list.php?leftmenu=tax_various", $langs->trans("List"), 1, $user->rights->banque->lire); + } + } + } +} + +/** + * Get left COMPTA-FINANCIAL (accountancy) + * + * @param string $mainmenu + * @param Menu &$newmenu Object Menu to return back list of menu entries + * @param string $usemenuhider + * @param string $leftmenu + * @param int $type_user + * @param DB $db + * @return void + */ +function get_left_menu_accountancy($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0, $db) +{ + global $user, $conf, $langs; + + if ($mainmenu == 'accountancy') { + $langs->load("companies"); + + // Accounting (Double entries) + if (!empty($conf->accounting->enabled)) { + //$permtoshowmenu = (!empty($conf->accounting->enabled) || $user->rights->accounting->bind->write || $user->rights->compta->resultat->lire); + //$newmenu->add("/accountancy/index.php?leftmenu=accountancy", $langs->trans("MenuAccountancy"), 0, $permtoshowmenu, '', $mainmenu, 'accountancy'); + + // Configuration + $newmenu->add("/accountancy/index.php?leftmenu=accountancy_admin", $langs->trans("Setup"), 0, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin', 1, '', '', '', img_picto('', 'technic', 'class="paddingright pictofixedwidth"')); + if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/', $leftmenu)) { + global $mysoc; + $newmenu->add("/accountancy/admin/index.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("General"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_general', 10); + + // Fiscal year - Not really yet used. In a future will lock some periods. + if ($conf->global->MAIN_FEATURES_LEVEL > 1) { + $newmenu->add("/accountancy/admin/fiscalyear.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("FiscalPeriod"), 1, $user->rights->accounting->fiscalyear->write, '', $mainmenu, 'fiscalyear', 20); + } + + $newmenu->add("/accountancy/admin/journals_list.php?id=35&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("AccountingJournals"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_journal', 30); + $newmenu->add("/accountancy/admin/accountmodel.php?id=31&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("Pcg_version"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_chartmodel', 40); + $newmenu->add("/accountancy/admin/account.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("Chartofaccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_chart', 41); + $newmenu->add("/accountancy/admin/subaccount.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("ChartOfSubaccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_chart', 41); + $newmenu->add("/accountancy/admin/categories_list.php?id=32&search_country_id=".$mysoc->country_id."&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("AccountingCategory"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_chart', 50); + $newmenu->add("/accountancy/admin/defaultaccounts.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuDefaultAccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 60); + if (!empty($conf->banque->enabled)) { + $newmenu->add("/compta/bank/list.php?mainmenu=accountancy&leftmenu=accountancy_admin&search_status=-1", $langs->trans("MenuBankAccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_bank', 70); + } + if (!empty($conf->facture->enabled) || ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_invoice->enabled))) { + $newmenu->add("/admin/dict.php?id=10&from=accountancy&search_country_id=".$mysoc->country_id."&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuVatAccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 80); + } + if (!empty($conf->tax->enabled)) { + $newmenu->add("/admin/dict.php?id=7&from=accountancy&search_country_id=".$mysoc->country_id."&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuTaxAccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 90); + } + if (!empty($conf->expensereport->enabled)) { + $newmenu->add("/admin/dict.php?id=17&from=accountancy&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuExpenseReportAccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 100); + } + $newmenu->add("/accountancy/admin/productaccount.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuProductsAccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_product', 110); + if ($conf->global->MAIN_FEATURES_LEVEL > 1) { + $newmenu->add("/accountancy/admin/closure.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuClosureAccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_closure', 120); + } + $newmenu->add("/accountancy/admin/export.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("ExportOptions"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_export', 130); + } + + // Transfer in accounting + $newmenu->add("/accountancy/index.php?leftmenu=accountancy_transfer", $langs->trans("TransferInAccounting"), 0, $user->rights->accounting->bind->write, '', $mainmenu, 'transfer', 1, '', '', '', img_picto('', 'long-arrow-alt-right', 'class="paddingright pictofixedwidth"')); + + // Binding + // $newmenu->add("", $langs->trans("Binding"), 0, $user->rights->accounting->bind->write, '', $mainmenu, 'dispatch'); + if (!empty($conf->facture->enabled) && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_SALES)) { + $newmenu->add("/accountancy/customer/index.php?leftmenu=accountancy_dispatch_customer&mainmenu=accountancy", $langs->trans("CustomersVentilation"), 1, $user->rights->accounting->bind->write, '', $mainmenu, 'dispatch_customer'); + if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_dispatch_customer/', $leftmenu)) { + $newmenu->add("/accountancy/customer/list.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_customer", $langs->trans("ToBind"), 2, $user->rights->accounting->bind->write); + $newmenu->add("/accountancy/customer/lines.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_customer", $langs->trans("Binded"), 2, $user->rights->accounting->bind->write); + } + } + if (!empty($conf->supplier_invoice->enabled) && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_PURCHASES)) { + $newmenu->add("/accountancy/supplier/index.php?leftmenu=accountancy_dispatch_supplier&mainmenu=accountancy", $langs->trans("SuppliersVentilation"), 1, $user->rights->accounting->bind->write, '', $mainmenu, 'dispatch_supplier'); + if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_dispatch_supplier/', $leftmenu)) { + $newmenu->add("/accountancy/supplier/list.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_supplier", $langs->trans("ToBind"), 2, $user->rights->accounting->bind->write); + $newmenu->add("/accountancy/supplier/lines.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_supplier", $langs->trans("Binded"), 2, $user->rights->accounting->bind->write); + } + } + if (!empty($conf->expensereport->enabled) && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS)) { + $newmenu->add("/accountancy/expensereport/index.php?leftmenu=accountancy_dispatch_expensereport&mainmenu=accountancy", $langs->trans("ExpenseReportsVentilation"), 1, $user->rights->accounting->bind->write, '', $mainmenu, 'dispatch_expensereport'); + if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_dispatch_expensereport/', $leftmenu)) { + $newmenu->add("/accountancy/expensereport/list.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_expensereport", $langs->trans("ToBind"), 2, $user->rights->accounting->bind->write); + $newmenu->add("/accountancy/expensereport/lines.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_expensereport", $langs->trans("Binded"), 2, $user->rights->accounting->bind->write); + } + } + + // Journals + if (!empty($conf->accounting->enabled) && !empty($user->rights->accounting->comptarapport->lire) && $mainmenu == 'accountancy') { + $newmenu->add('', $langs->trans("RegistrationInAccounting"), 1, $user->rights->accounting->comptarapport->lire, '', '', ''); + + // Multi journal + $sql = "SELECT rowid, code, label, nature"; + $sql .= " FROM ".MAIN_DB_PREFIX."accounting_journal"; + $sql .= " WHERE entity = ".$conf->entity; + $sql .= " AND active = 1"; + $sql .= " ORDER BY nature ASC, label DESC"; + + $resql = $db->query($sql); + if ($resql) { + $numr = $db->num_rows($resql); + $i = 0; + + if ($numr > 0) { + while ($i < $numr) { + $objp = $db->fetch_object($resql); + + $nature = ''; + + // Must match array $sourceList defined into journals_list.php + if ($objp->nature == 2 && !empty($conf->facture->enabled) && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_SALES)) { + $nature = "sells"; + } + if ($objp->nature == 3 + && ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_invoice->enabled)) + && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_PURCHASES)) { + $nature = "purchases"; + } + if ($objp->nature == 4 && !empty($conf->banque->enabled)) { + $nature = "bank"; + } + if ($objp->nature == 5 && !empty($conf->expensereport->enabled) && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS)) { + $nature = "expensereports"; + } + if ($objp->nature == 1) { + $nature = "various"; + } + if ($objp->nature == 8) { + $nature = "inventory"; + } + if ($objp->nature == 9) { + $nature = "hasnew"; + } + + // To enable when page exists + if (empty($conf->global->ACCOUNTANCY_SHOW_DEVELOP_JOURNAL)) { + if ($nature == 'hasnew' || $nature == 'inventory') { + $nature = ''; + } + } + + if ($nature) { + $langs->load('accountancy'); + $journallabel = $langs->transnoentities($objp->label); // Labels in this table are set by loading llx_accounting_abc.sql. Label can be 'ACCOUNTING_SELL_JOURNAL', 'InventoryJournal', ... + $newmenu->add('/accountancy/journal/'.$nature.'journal.php?mainmenu=accountancy&leftmenu=accountancy_journal&id_journal='.$objp->rowid, $journallabel, 2, $user->rights->accounting->comptarapport->lire); + } + $i++; + } + } else { + // Should not happend. Entries are added + $newmenu->add('', $langs->trans("NoJournalDefined"), 2, $user->rights->accounting->comptarapport->lire); + } + } else { + dol_print_error($db); + } + $db->free($resql); + } + + // Files + if (empty($conf->global->ACCOUNTANCY_HIDE_EXPORT_FILES_MENU)) { + $newmenu->add("/compta/accounting-files.php?mainmenu=accountancy&leftmenu=accountancy_files", $langs->trans("AccountantFiles"), 1, $user->rights->accounting->mouvements->lire); + } + + + // Accounting + $newmenu->add("/accountancy/index.php?leftmenu=accountancy_accountancy", $langs->trans("MenuAccountancy"), 0, $user->rights->accounting->mouvements->lire || $user->rights->accounting->comptarapport->lire, '', $mainmenu, 'accountancy', 1, '', '', '', img_picto('', 'accountancy', 'class="paddingright pictofixedwidth"')); + + // General Ledger + $newmenu->add("/accountancy/bookkeeping/listbyaccount.php?mainmenu=accountancy&leftmenu=accountancy_accountancy", $langs->trans("Bookkeeping"), 1, $user->rights->accounting->mouvements->lire); + + // Journals + $newmenu->add("/accountancy/bookkeeping/list.php?mainmenu=accountancy&leftmenu=accountancy_accountancy", $langs->trans("Journals"), 1, $user->rights->accounting->mouvements->lire); + + // Account Balance + $newmenu->add("/accountancy/bookkeeping/balance.php?mainmenu=accountancy&leftmenu=accountancy_accountancy", $langs->trans("AccountBalance"), 1, $user->rights->accounting->mouvements->lire); + + // Closure + $newmenu->add("/accountancy/closure/index.php?mainmenu=accountancy&leftmenu=accountancy_closure", $langs->trans("MenuAccountancyClosure"), 1, $user->rights->accounting->fiscalyear->write, '', $mainmenu, 'closure'); + + // Reports + $newmenu->add("/accountancy/index.php?leftmenu=accountancy_report", $langs->trans("Reportings"), 1, $user->rights->accounting->comptarapport->lire, '', $mainmenu, 'ca'); + + if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/', $leftmenu)) { + $newmenu->add("/compta/resultat/index.php?leftmenu=accountancy_report", $langs->trans("MenuReportInOut"), 2, $user->rights->accounting->comptarapport->lire); + $newmenu->add("/compta/resultat/clientfourn.php?leftmenu=accountancy_report", $langs->trans("ByPredefinedAccountGroups"), 3, $user->rights->accounting->comptarapport->lire); + $newmenu->add("/compta/resultat/result.php?leftmenu=accountancy_report", $langs->trans("ByPersonalizedAccountGroups"), 3, $user->rights->accounting->comptarapport->lire); + } + + $modecompta = 'CREANCES-DETTES'; + if (!empty($conf->accounting->enabled) && !empty($user->rights->accounting->comptarapport->lire) && $mainmenu == 'accountancy') { + $modecompta = 'BOOKKEEPING'; // Not yet implemented. Should be BOOKKEEPINGCOLLECTED + } + if ($modecompta) { + if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/', $leftmenu)) { + $newmenu->add("/compta/stats/index.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ReportTurnover"), 2, $user->rights->accounting->comptarapport->lire); + $newmenu->add("/compta/stats/casoc.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 3, $user->rights->accounting->comptarapport->lire); + $newmenu->add("/compta/stats/cabyuser.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByUsers"), 3, $user->rights->accounting->comptarapport->lire); + $newmenu->add("/compta/stats/cabyprodserv.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByProductsAndServices"), 3, $user->rights->accounting->comptarapport->lire); + $newmenu->add("/compta/stats/byratecountry.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByVatRate"), 3, $user->rights->accounting->comptarapport->lire); + } + } + + $modecompta = 'RECETTES-DEPENSES'; + //if (! empty($conf->accounting->enabled) && ! empty($user->rights->accounting->comptarapport->lire) && $mainmenu == 'accountancy') $modecompta=''; // Not yet implemented. Should be BOOKKEEPINGCOLLECTED + if ($modecompta) { + if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/', $leftmenu)) { + $newmenu->add("/compta/stats/index.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ReportTurnoverCollected"), 2, $user->rights->accounting->comptarapport->lire); + $newmenu->add("/compta/stats/casoc.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 3, $user->rights->accounting->comptarapport->lire); + $newmenu->add("/compta/stats/cabyuser.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByUsers"), 3, $user->rights->accounting->comptarapport->lire); + //$newmenu->add("/compta/stats/cabyprodserv.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByProductsAndServices"),3,$user->rights->accounting->comptarapport->lire); + //$newmenu->add("/compta/stats/byratecountry.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByVatRate"),3,$user->rights->accounting->comptarapport->lire); + } + } + + $modecompta = 'CREANCES-DETTES'; + if (!empty($conf->accounting->enabled) && !empty($user->rights->accounting->comptarapport->lire) && $mainmenu == 'accountancy') { + $modecompta = 'BOOKKEEPING'; // Not yet implemented. + } + if ($modecompta && ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_invoice->enabled))) { + if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/', $leftmenu)) { + $newmenu->add("/compta/stats/supplier_turnover.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ReportPurchaseTurnover"), 2, $user->rights->accounting->comptarapport->lire); + $newmenu->add("/compta/stats/supplier_turnover_by_thirdparty.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 3, $user->rights->accounting->comptarapport->lire); + $newmenu->add("/compta/stats/supplier_turnover_by_prodserv.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByProductsAndServices"), 3, $user->rights->accounting->comptarapport->lire); + } + } + + $modecompta = 'RECETTES-DEPENSES'; + if (!empty($conf->accounting->enabled) && !empty($user->rights->accounting->comptarapport->lire) && $mainmenu == 'accountancy') { + $modecompta = 'BOOKKEEPINGCOLLECTED'; // Not yet implemented. + } + if ($modecompta && ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_invoice->enabled))) { + if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/', $leftmenu)) { + $newmenu->add("/compta/stats/supplier_turnover.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ReportPurchaseTurnoverCollected"), 2, $user->rights->accounting->comptarapport->lire); + $newmenu->add("/compta/stats/supplier_turnover_by_thirdparty.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 3, $user->rights->accounting->comptarapport->lire); + } + } + } + + // Accountancy (simple) + if (!empty($conf->comptabilite->enabled)) { + // Files + if (empty($conf->global->ACCOUNTANCY_HIDE_EXPORT_FILES_MENU)) { + $newmenu->add("/compta/accounting-files.php?mainmenu=accountancy&leftmenu=accountancy_files", $langs->trans("AccountantFiles"), 0, $user->rights->compta->resultat->lire, '', $mainmenu, 'files'); + } + + // Bilan, resultats + $newmenu->add("/compta/resultat/index.php?leftmenu=report&mainmenu=accountancy", $langs->trans("Reportings"), 0, $user->rights->compta->resultat->lire, '', $mainmenu, 'ca'); + + if ($usemenuhider || empty($leftmenu) || preg_match('/report/', $leftmenu)) { + $newmenu->add("/compta/resultat/index.php?leftmenu=report", $langs->trans("MenuReportInOut"), 1, $user->rights->compta->resultat->lire); + $newmenu->add("/compta/resultat/clientfourn.php?leftmenu=report", $langs->trans("ByCompanies"), 2, $user->rights->compta->resultat->lire); + /* On verra ca avec module compabilite expert + $newmenu->add("/compta/resultat/compteres.php?leftmenu=report","Compte de resultat",2,$user->rights->compta->resultat->lire); + $newmenu->add("/compta/resultat/bilan.php?leftmenu=report","Bilan",2,$user->rights->compta->resultat->lire); + */ + + /* + $newmenu->add("/compta/stats/cumul.php?leftmenu=report","Cumule",2,$user->rights->compta->resultat->lire); + if (! empty($conf->propal->enabled)) { + $newmenu->add("/compta/stats/prev.php?leftmenu=report","Previsionnel",2,$user->rights->compta->resultat->lire); + $newmenu->add("/compta/stats/comp.php?leftmenu=report","Transforme",2,$user->rights->compta->resultat->lire); + } + */ + + $modecompta = 'CREANCES-DETTES'; + $newmenu->add("/compta/stats/index.php?leftmenu=report&modecompta=".$modecompta, $langs->trans("ReportTurnover"), 1, $user->rights->compta->resultat->lire); + $newmenu->add("/compta/stats/casoc.php?leftmenu=report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 2, $user->rights->compta->resultat->lire); + $newmenu->add("/compta/stats/cabyuser.php?leftmenu=report&modecompta=".$modecompta, $langs->trans("ByUsers"), 2, $user->rights->compta->resultat->lire); + $newmenu->add("/compta/stats/cabyprodserv.php?leftmenu=report&modecompta=".$modecompta, $langs->trans("ByProductsAndServices"), 2, $user->rights->compta->resultat->lire); + $newmenu->add("/compta/stats/byratecountry.php?leftmenu=report&modecompta=".$modecompta, $langs->trans("ByVatRate"), 2, $user->rights->compta->resultat->lire); + + $modecompta = 'RECETTES-DEPENSES'; + $newmenu->add("/compta/stats/index.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ReportTurnoverCollected"), 1, $user->rights->compta->resultat->lire); + $newmenu->add("/compta/stats/casoc.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 2, $user->rights->compta->resultat->lire); + $newmenu->add("/compta/stats/cabyuser.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByUsers"), 2, $user->rights->compta->resultat->lire); + + //Achats + $modecompta = 'CREANCES-DETTES'; + $newmenu->add("/compta/stats/supplier_turnover.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ReportPurchaseTurnover"), 1, $user->rights->compta->resultat->lire); + $newmenu->add("/compta/stats/supplier_turnover_by_thirdparty.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 2, $user->rights->compta->resultat->lire); + $newmenu->add("/compta/stats/supplier_turnover_by_prodserv.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByProductsAndServices"), 2, $user->rights->compta->resultat->lire); + + /* + $modecompta = 'RECETTES-DEPENSES'; + $newmenu->add("/compta/stats/index.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ReportPurchaseTurnoverCollected"), 1, $user->rights->compta->resultat->lire); + $newmenu->add("/compta/stats/casoc.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 2, $user->rights->compta->resultat->lire); + $newmenu->add("/compta/stats/cabyuser.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByUsers"), 2, $user->rights->compta->resultat->lire); + */ + + // Journals + $newmenu->add("/compta/journal/sellsjournal.php?leftmenu=report", $langs->trans("SellsJournal"), 1, $user->rights->compta->resultat->lire, '', '', '', 50); + $newmenu->add("/compta/journal/purchasesjournal.php?leftmenu=report", $langs->trans("PurchasesJournal"), 1, $user->rights->compta->resultat->lire, '', '', '', 51); + } + //if ($leftmenu=="ca") $newmenu->add("/compta/journaux/index.php?leftmenu=ca",$langs->trans("Journals"),1,$user->rights->compta->resultat->lire||$user->rights->accounting->comptarapport->lire); + } + + // Intracomm report + if (!empty($conf->intracommreport->enabled)) { + $newmenu->add("/intracommreport/list.php?leftmenu=intracommreport", $langs->trans("MenuIntracommReport"), 0, $user->rights->intracommreport->read, '', $mainmenu, 'intracommreport', 60, '', '', '', img_picto('', 'intracommreport', 'class="paddingright pictofixedwidth"')); + if ($usemenuhider || empty($leftmenu) || preg_match('/intracommreport/', $leftmenu)) { + // DEB / DES + $newmenu->add("/intracommreport/card.php?action=create&leftmenu=intracommreport", $langs->trans("MenuIntracommReportNew"), 1, $user->rights->intracommreport->write, '', $mainmenu, 'intracommreport', 1); + $newmenu->add("/intracommreport/list.php?leftmenu=intracommreport", $langs->trans("MenuIntracommReportList"), 1, $user->rights->intracommreport->read, '', $mainmenu, 'intracommreport', 1); + } + } + + // Assets + if (!empty($conf->asset->enabled)) { + $newmenu->add("/asset/list.php?leftmenu=asset&mainmenu=accountancy", $langs->trans("MenuAssets"), 0, $user->rights->asset->read, '', $mainmenu, 'asset', 100, '', '', '', img_picto('', 'payment', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/asset/card.php?leftmenu=asset&action=create", $langs->trans("MenuNewAsset"), 1, $user->rights->asset->write); + $newmenu->add("/asset/list.php?leftmenu=asset&mainmenu=accountancy", $langs->trans("MenuListAssets"), 1, $user->rights->asset->read); + $newmenu->add("/asset/model/list.php?leftmenu=asset_model", $langs->trans("MenuAssetModels"), 1, (empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->read) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->setup_advance->read)), '', $mainmenu, 'asset_model'); + if ($usemenuhider || empty($leftmenu) || preg_match('/asset_model/', $leftmenu)) { + $newmenu->add("/asset/model/card.php?leftmenu=asset_model&action=create", $langs->trans("MenuNewAssetModel"), 2, (empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->write) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->setup_advance->write))); + $newmenu->add("/asset/model/list.php?leftmenu=asset_model", $langs->trans("MenuListAssetModels"), 2, (empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->read) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->setup_advance->read))); + } + } + } +} + + +/** + * Get left Menu BANK + * + * @param string $mainmenu + * @param Menu &$newmenu Object Menu to return back list of menu entries + * @param string $usemenuhider + * @param string $leftmenu + * @param int $type_user + * @return void + */ +function get_left_menu_bank($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0) +{ + global $user, $conf, $langs; + + if ($mainmenu == 'bank') { + // Load translation files required by the page + $langs->loadLangs(array("withdrawals", "banks", "bills", "categories")); + + // Bank-Cash account + if (!empty($conf->banque->enabled)) { + $newmenu->add("/compta/bank/list.php?leftmenu=bank&mainmenu=bank", $langs->trans("MenuBankCash"), 0, $user->rights->banque->lire, '', $mainmenu, 'bank', 0, '', '', '', img_picto('', 'bank_account', 'class="paddingright pictofixedwidth"')); + + $newmenu->add("/compta/bank/card.php?action=create", $langs->trans("MenuNewFinancialAccount"), 1, $user->rights->banque->configurer); + $newmenu->add("/compta/bank/list.php?leftmenu=bank&mainmenu=bank", $langs->trans("List"), 1, $user->rights->banque->lire, '', $mainmenu, 'bank'); + $newmenu->add("/compta/bank/bankentries_list.php", $langs->trans("ListTransactions"), 1, $user->rights->banque->lire); + $newmenu->add("/compta/bank/budget.php", $langs->trans("ListTransactionsByCategory"), 1, $user->rights->banque->lire); + + $newmenu->add("/compta/bank/transfer.php", $langs->trans("MenuBankInternalTransfer"), 1, $user->rights->banque->transfer); + } + + if (!empty($conf->categorie->enabled)) { + $langs->load("categories"); + $newmenu->add("/categories/index.php?type=5", $langs->trans("Rubriques"), 1, $user->rights->categorie->creer, '', $mainmenu, 'tags'); + $newmenu->add("/compta/bank/categ.php", $langs->trans("RubriquesTransactions"), 1, $user->rights->banque->configurer, '', $mainmenu, 'tags'); + } + + // Direct debit order + if (!empty($conf->prelevement->enabled)) { + $newmenu->add("/compta/prelevement/index.php?leftmenu=withdraw&mainmenu=bank", $langs->trans("PaymentByDirectDebit"), 0, $user->rights->prelevement->bons->lire, '', $mainmenu, 'withdraw', 0, '', '', '', img_picto('', 'payment', 'class="paddingright pictofixedwidth"')); + + if ($usemenuhider || empty($leftmenu) || $leftmenu == "withdraw") { + $newmenu->add("/compta/prelevement/create.php?mainmenu=bank", $langs->trans("NewStandingOrder"), 1, $user->rights->prelevement->bons->creer); + + $newmenu->add("/compta/prelevement/orders_list.php?mainmenu=bank", $langs->trans("WithdrawalsReceipts"), 1, $user->rights->prelevement->bons->lire); + $newmenu->add("/compta/prelevement/list.php?mainmenu=bank", $langs->trans("WithdrawalsLines"), 1, $user->rights->prelevement->bons->lire); + $newmenu->add("/compta/prelevement/rejets.php?mainmenu=bank", $langs->trans("Rejects"), 1, $user->rights->prelevement->bons->lire); + $newmenu->add("/compta/prelevement/stats.php?mainmenu=bank", $langs->trans("Statistics"), 1, $user->rights->prelevement->bons->lire); + } + } + + // Bank transfer order + if (!empty($conf->paymentbybanktransfer->enabled)) { + $newmenu->add("/compta/paymentbybanktransfer/index.php?leftmenu=banktransfer&mainmenu=bank", $langs->trans("PaymentByBankTransfer"), 0, $user->rights->paymentbybanktransfer->read, '', $mainmenu, 'banktransfer', 0, '', '', '', img_picto('', 'payment', 'class="paddingright pictofixedwidth"')); + + if ($usemenuhider || empty($leftmenu) || $leftmenu == "banktransfer") { + $newmenu->add("/compta/prelevement/create.php?type=bank-transfer&mainmenu=bank", $langs->trans("NewPaymentByBankTransfer"), 1, $user->rights->paymentbybanktransfer->create); + + $newmenu->add("/compta/prelevement/orders_list.php?type=bank-transfer&mainmenu=bank", $langs->trans("PaymentByBankTransferReceipts"), 1, $user->rights->paymentbybanktransfer->read); + $newmenu->add("/compta/prelevement/list.php?type=bank-transfer&mainmenu=bank", $langs->trans("PaymentByBankTransferLines"), 1, $user->rights->paymentbybanktransfer->read); + $newmenu->add("/compta/prelevement/rejets.php?type=bank-transfer&mainmenu=bank", $langs->trans("Rejects"), 1, $user->rights->paymentbybanktransfer->read); + $newmenu->add("/compta/prelevement/stats.php?type=bank-transfer&mainmenu=bank", $langs->trans("Statistics"), 1, $user->rights->paymentbybanktransfer->read); + } + } + + // Management of checks + if (empty($conf->global->BANK_DISABLE_CHECK_DEPOSIT) && !empty($conf->banque->enabled) && (!empty($conf->facture->enabled) || !empty($conf->global->MAIN_MENU_CHEQUE_DEPOSIT_ON))) { + $newmenu->add("/compta/paiement/cheque/index.php?leftmenu=checks&mainmenu=bank", $langs->trans("MenuChequeDeposits"), 0, $user->rights->banque->cheque, '', $mainmenu, 'checks', 0, '', '', '', img_picto('', 'payment', 'class="paddingright pictofixedwidth"')); + if (preg_match('/checks/', $leftmenu)) { + $newmenu->add("/compta/paiement/cheque/card.php?leftmenu=checks_bis&action=new&mainmenu=bank", $langs->trans("NewChequeDeposit"), 1, $user->rights->banque->cheque); + $newmenu->add("/compta/paiement/cheque/list.php?leftmenu=checks_bis&mainmenu=bank", $langs->trans("List"), 1, $user->rights->banque->cheque); + } + } + + // Cash Control + if (!empty($conf->takepos->enabled) || !empty($conf->cashdesk->enabled)) { + $permtomakecashfence = ($user->hasRight('cashdesk', 'run')|| $user->hasRight('takepos', 'run')); + $newmenu->add("/compta/cashcontrol/cashcontrol_list.php?action=list", $langs->trans("POS"), 0, $permtomakecashfence, '', $mainmenu, 'cashcontrol', 0, '', '', '', img_picto('', 'pos', 'class="pictofixedwidth"')); + $newmenu->add("/compta/cashcontrol/cashcontrol_card.php?action=create", $langs->trans("NewCashFence"), 1, $permtomakecashfence); + $newmenu->add("/compta/cashcontrol/cashcontrol_list.php?action=list", $langs->trans("List"), 1, $permtomakecashfence); + } + } +} + +/** + * Get left Menu PRODUCTS-SERVICES + * + * @param string $mainmenu + * @param Menu &$newmenu Object Menu to return back list of menu entries + * @param string $usemenuhider + * @param string $leftmenu + * @param int $type_user + * @return void + */ +function get_left_menu_products($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0) +{ + global $user, $conf, $langs; + + if ($mainmenu == 'products') { + // Products + if (!empty($conf->product->enabled)) { + $newmenu->add("/product/index.php?leftmenu=product&type=0", $langs->trans("Products"), 0, $user->rights->produit->lire, '', $mainmenu, 'product', 0, '', '', '', img_picto('', 'product', 'class="pictofixedwidth"')); + $newmenu->add("/product/card.php?leftmenu=product&action=create&type=0", $langs->trans("NewProduct"), 1, $user->rights->produit->creer); + $newmenu->add("/product/list.php?leftmenu=product&type=0", $langs->trans("List"), 1, $user->rights->produit->lire); + if (!empty($conf->stock->enabled)) { + $newmenu->add("/product/reassort.php?type=0", $langs->trans("MenuStocks"), 1, $user->rights->produit->lire && $user->rights->stock->lire); + } + if (!empty($conf->productbatch->enabled)) { + $langs->load("stocks"); + $newmenu->add("/product/reassortlot.php?type=0", $langs->trans("StocksByLotSerial"), 1, $user->rights->produit->lire && $user->rights->stock->lire); + $newmenu->add("/product/stock/productlot_list.php", $langs->trans("LotSerial"), 1, $user->rights->produit->lire && $user->rights->stock->lire); + } + if (!empty($conf->variants->enabled)) { + $newmenu->add("/variants/list.php", $langs->trans("VariantAttributes"), 1, $user->rights->produit->lire); + } + if (!empty($conf->propal->enabled) || (!empty($conf->commande->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->facture->enabled) || !empty($conf->fournisseur->enabled) || !empty($conf->supplier_proposal->enabled) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) { + $newmenu->add("/product/stats/card.php?id=all&leftmenu=stats&type=0", $langs->trans("Statistics"), 1, $user->rights->produit->lire && $user->rights->propale->lire); + } + + // Categories + if (!empty($conf->categorie->enabled)) { + $langs->load("categories"); + $newmenu->add("/categories/index.php?leftmenu=cat&type=0", $langs->trans("Categories"), 1, $user->rights->categorie->lire, '', $mainmenu, 'cat'); + //if ($usemenuhider || empty($leftmenu) || $leftmenu=="cat") $newmenu->add("/categories/list.php", $langs->trans("List"), 1, $user->rights->categorie->lire); + } + } + + // Services + if (!empty($conf->service->enabled)) { + $newmenu->add("/product/index.php?leftmenu=service&type=1", $langs->trans("Services"), 0, $user->rights->service->lire, '', $mainmenu, 'service', 0, '', '', '', img_picto('', 'service', 'class="pictofixedwidth"')); + $newmenu->add("/product/card.php?leftmenu=service&action=create&type=1", $langs->trans("NewService"), 1, $user->rights->service->creer); + $newmenu->add("/product/list.php?leftmenu=service&type=1", $langs->trans("List"), 1, $user->rights->service->lire); + if (!empty($conf->propal->enabled) || !empty($conf->commande->enabled) || !empty($conf->facture->enabled) || (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_proposal->enabled) || !empty($conf->supplier_oder->enabled) || !empty($conf->supplier_invoice->enabled)) { + $newmenu->add("/product/stats/card.php?id=all&leftmenu=stats&type=1", $langs->trans("Statistics"), 1, $user->rights->service->lire || $user->rights->product->lire); + } + // Categories + if (!empty($conf->categorie->enabled)) { + $langs->load("categories"); + $newmenu->add("/categories/index.php?leftmenu=cat&type=0", $langs->trans("Categories"), 1, $user->rights->categorie->lire, '', $mainmenu, 'cat'); + //if ($usemenuhider || empty($leftmenu) || $leftmenu=="cat") $newmenu->add("/categories/list.php", $langs->trans("List"), 1, $user->rights->categorie->lire); + } + } + + // Warehouse + if (!empty($conf->stock->enabled)) { + $langs->load("stocks"); + $newmenu->add("/product/stock/index.php?leftmenu=stock", $langs->trans("Warehouses"), 0, $user->rights->stock->lire, '', $mainmenu, 'stock', 0, '', '', '', img_picto('', 'stock', 'class="pictofixedwidth"')); + $newmenu->add("/product/stock/card.php?action=create", $langs->trans("MenuNewWarehouse"), 1, $user->rights->stock->creer); + $newmenu->add("/product/stock/list.php", $langs->trans("List"), 1, $user->rights->stock->lire); + $newmenu->add("/product/stock/movement_list.php", $langs->trans("Movements"), 1, $user->rights->stock->mouvement->lire); + + $newmenu->add("/product/stock/massstockmove.php", $langs->trans("MassStockTransferShort"), 1, $user->rights->stock->mouvement->creer); + if ($conf->supplier_order->enabled) { + $newmenu->add("/product/stock/replenish.php", $langs->trans("Replenishment"), 1, $user->rights->stock->mouvement->creer && $user->rights->fournisseur->lire); + } + $newmenu->add("/product/stock/stockatdate.php", $langs->trans("StockAtDate"), 1, $user->rights->produit->lire && $user->rights->stock->lire); + + // Categories for warehouses + if (!empty($conf->categorie->enabled)) { + $newmenu->add("/categories/index.php?leftmenu=stock&type=9", $langs->trans("Categories"), 1, $user->rights->categorie->lire, '', $mainmenu, 'cat'); + } + } + + // Inventory + if (!empty($conf->stock->enabled)) { + $langs->load("stocks"); + if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) { + $newmenu->add("/product/inventory/list.php?leftmenu=stock_inventories", $langs->trans("Inventories"), 0, $user->rights->stock->lire, '', $mainmenu, 'stock', 0, '', '', '', img_picto('', 'inventory', 'class="pictofixedwidth"')); + if ($usemenuhider || empty($leftmenu) || $leftmenu == "stock_inventories") { + $newmenu->add("/product/inventory/card.php?action=create&leftmenu=stock_inventories", $langs->trans("NewInventory"), 1, $user->rights->stock->creer); + $newmenu->add("/product/inventory/list.php?leftmenu=stock_inventories", $langs->trans("List"), 1, $user->rights->stock->lire); + } + } else { + $newmenu->add("/product/inventory/list.php?leftmenu=stock_inventories", $langs->trans("Inventories"), 0, $user->rights->stock->inventory_advance->read, '', $mainmenu, 'stock', 0, '', '', '', img_picto('', 'inventory', 'class="pictofixedwidth"')); + if ($usemenuhider || empty($leftmenu) || $leftmenu == "stock_inventories") { + $newmenu->add("/product/inventory/card.php?action=create&leftmenu=stock_inventories", $langs->trans("NewInventory"), 1, $user->rights->stock->inventory_advance->write); + $newmenu->add("/product/inventory/list.php?leftmenu=stock_inventories", $langs->trans("List"), 1, $user->rights->stock->inventory_advance->read); + } + } + } + + // Shipments + if (!empty($conf->expedition->enabled)) { + $langs->load("sendings"); + $newmenu->add("/expedition/index.php?leftmenu=sendings", $langs->trans("Shipments"), 0, $user->rights->expedition->lire, '', $mainmenu, 'sendings', 0, '', '', '', img_picto('', 'shipment', 'class="pictofixedwidth"')); + $newmenu->add("/expedition/card.php?action=create2&leftmenu=sendings", $langs->trans("NewSending"), 1, $user->rights->expedition->creer); + $newmenu->add("/expedition/list.php?leftmenu=sendings", $langs->trans("List"), 1, $user->rights->expedition->lire); + if ($usemenuhider || empty($leftmenu) || $leftmenu == "sendings") { + $newmenu->add("/expedition/list.php?leftmenu=sendings&search_status=0", $langs->trans("StatusSendingDraftShort"), 2, $user->rights->expedition->lire); + $newmenu->add("/expedition/list.php?leftmenu=sendings&search_status=1", $langs->trans("StatusSendingValidatedShort"), 2, $user->rights->expedition->lire); + $newmenu->add("/expedition/list.php?leftmenu=sendings&search_status=2", $langs->trans("StatusSendingProcessedShort"), 2, $user->rights->expedition->lire); + } + $newmenu->add("/expedition/stats/index.php?leftmenu=sendings", $langs->trans("Statistics"), 1, $user->rights->expedition->lire); + } + + // Receptions + if (!empty($conf->reception->enabled)) { + $langs->load("receptions"); + $newmenu->add("/reception/index.php?leftmenu=receptions", $langs->trans("Receptions"), 0, $user->rights->reception->lire, '', $mainmenu, 'receptions', 0, '', '', '', img_picto('', 'dollyrevert', 'class="pictofixedwidth"')); + $newmenu->add("/reception/card.php?action=create2&leftmenu=receptions", $langs->trans("NewReception"), 1, $user->rights->reception->creer); + $newmenu->add("/reception/list.php?leftmenu=receptions", $langs->trans("List"), 1, $user->rights->reception->lire); + if ($usemenuhider || empty($leftmenu) || $leftmenu == "receptions") { + $newmenu->add("/reception/list.php?leftmenu=receptions&search_status=0", $langs->trans("StatusReceptionDraftShort"), 2, $user->rights->reception->lire); + } + if ($usemenuhider || empty($leftmenu) || $leftmenu == "receptions") { + $newmenu->add("/reception/list.php?leftmenu=receptions&search_status=1", $langs->trans("StatusReceptionValidatedShort"), 2, $user->rights->reception->lire); + } + if ($usemenuhider || empty($leftmenu) || $leftmenu == "receptions") { + $newmenu->add("/reception/list.php?leftmenu=receptions&search_status=2", $langs->trans("StatusReceptionProcessedShort"), 2, $user->rights->reception->lire); + } + $newmenu->add("/reception/stats/index.php?leftmenu=receptions", $langs->trans("Statistics"), 1, $user->rights->reception->lire); + } + } +} + +/** + * Get left Menu PRODUCTS-SERVICES MRP - GPAO + * + * @param string $mainmenu + * @param Menu &$newmenu Object Menu to return back list of menu entries + * @param string $usemenuhider + * @param string $leftmenu + * @param int $type_user + * @return void + */ +function get_left_menu_mrp($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0) +{ + global $user, $conf, $langs; + + if ($mainmenu == 'mrp') { + // BOM + if (!empty($conf->bom->enabled) || !empty($conf->mrp->enabled)) { + $langs->load("mrp"); + + $newmenu->add("", $langs->trans("MenuBOM"), 0, $user->rights->bom->read, '', $mainmenu, 'bom', 0, '', '', '', img_picto('', 'bom', 'class="paddingrightonly pictofixedwidth"')); + $newmenu->add("/bom/bom_card.php?leftmenu=bom&action=create", $langs->trans("NewBOM"), 1, $user->rights->bom->write, '', $mainmenu, 'bom'); + $newmenu->add("/bom/bom_list.php?leftmenu=bom", $langs->trans("List"), 1, $user->rights->bom->read, '', $mainmenu, 'bom'); + } + + if (!empty($conf->mrp->enabled)) { + $langs->load("mrp"); + + $newmenu->add("", $langs->trans("MenuMRP"), 0, $user->rights->mrp->read, '', $mainmenu, 'mo', 0, '', '', '', img_picto('', 'mrp', 'class="paddingrightonly pictofixedwidth"')); + $newmenu->add("/mrp/mo_card.php?leftmenu=mo&action=create", $langs->trans("NewMO"), 1, $user->rights->mrp->write, '', $mainmenu, 'mo'); + $newmenu->add("/mrp/mo_list.php?leftmenu=mo", $langs->trans("List"), 1, $user->rights->mrp->read, '', $mainmenu, 'mo'); + } + } +} + +/** + * Get left Menu PROJECTS + * + * @param string $mainmenu + * @param Menu &$newmenu Object Menu to return back list of menu entries + * @param string $usemenuhider + * @param string $leftmenu + * @param int $type_user + * @return void + */ +function get_left_menu_projects($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0) +{ + global $user, $conf, $langs; + + if ($mainmenu == 'project') { + if (!empty($conf->projet->enabled)) { + $langs->load("projects"); + + $search_project_user = GETPOST('search_project_user', 'int'); + + $tmpentry = array( + 'enabled'=>(!empty($conf->projet->enabled)), + 'perms'=>(!empty($user->rights->projet->lire)), + 'module'=>'projet' + ); + $listofmodulesforexternal = explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL); + $showmode = isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal); + + $titleboth = $langs->trans("LeadsOrProjects"); + $titlenew = $langs->trans("NewLeadOrProject"); // Leads and opportunities by default + if (empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { + $titleboth = $langs->trans("Projects"); + $titlenew = $langs->trans("NewProject"); + } + if (isset($conf->global->PROJECT_USE_OPPORTUNITIES) && $conf->global->PROJECT_USE_OPPORTUNITIES == 2) { // 2 = leads only + $titleboth = $langs->trans("Leads"); + $titlenew = $langs->trans("NewLead"); + } + + // Project assigned to user + $newmenu->add("/projet/index.php?leftmenu=projects".($search_project_user ? '&search_project_user='.$search_project_user : ''), $titleboth, 0, $user->rights->projet->lire, '', $mainmenu, 'projects', 0, '', '', '', img_picto('', 'project', 'class="pictofixedwidth"')); + $newmenu->add("/projet/card.php?leftmenu=projects&action=create".($search_project_user ? '&search_project_user='.$search_project_user : ''), $titlenew, 1, $user->rights->projet->creer); + + if (empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { + $newmenu->add("/projet/list.php?leftmenu=projets".($search_project_user ? '&search_project_user='.$search_project_user : '').'&search_status=99', $langs->trans("List"), 1, $showmode, '', 'project', 'list'); + } elseif (isset($conf->global->PROJECT_USE_OPPORTUNITIES) && $conf->global->PROJECT_USE_OPPORTUNITIES == 1) { + $newmenu->add("/projet/list.php?leftmenu=projets".($search_project_user ? '&search_project_user='.$search_project_user : ''), $langs->trans("List"), 1, $showmode, '', 'project', 'list'); + $newmenu->add('/projet/list.php?mainmenu=project&leftmenu=list&search_usage_opportunity=1&search_status=99&search_opp_status=openedopp&contextpage=lead', $langs->trans("ListOpenLeads"), 2, $showmode); + $newmenu->add('/projet/list.php?mainmenu=project&leftmenu=list&search_opp_status=notopenedopp&search_status=99&contextpage=project', $langs->trans("ListOpenProjects"), 2, $showmode); + } elseif (isset($conf->global->PROJECT_USE_OPPORTUNITIES) && $conf->global->PROJECT_USE_OPPORTUNITIES == 2) { // 2 = leads only + $newmenu->add('/projet/list.php?mainmenu=project&leftmenu=list&search_usage_opportunity=1&search_status=99', $langs->trans("List"), 2, $showmode); + } + + $newmenu->add("/projet/stats/index.php?leftmenu=projects", $langs->trans("Statistics"), 1, $user->rights->projet->lire); + + // Categories + if (!empty($conf->categorie->enabled)) { + $langs->load("categories"); + $newmenu->add("/categories/index.php?leftmenu=cat&type=6", $langs->trans("Categories"), 1, $user->rights->categorie->lire, '', $mainmenu, 'cat'); + } + + if (empty($conf->global->PROJECT_HIDE_TASKS)) { + // Project affected to user + $newmenu->add("/projet/activity/index.php?leftmenu=tasks".($search_project_user ? '&search_project_user='.$search_project_user : ''), $langs->trans("Activities"), 0, $user->rights->projet->lire, '', 'project', 'tasks', 0, '', '', '', img_picto('', 'projecttask', 'class="pictofixedwidth"')); + $newmenu->add("/projet/tasks.php?leftmenu=tasks&action=create", $langs->trans("NewTask"), 1, $user->rights->projet->creer); + $newmenu->add("/projet/tasks/list.php?leftmenu=tasks".($search_project_user ? '&search_project_user='.$search_project_user : ''), $langs->trans("List"), 1, $user->rights->projet->lire); + $newmenu->add("/projet/tasks/stats/index.php?leftmenu=projects", $langs->trans("Statistics"), 1, $user->rights->projet->lire); + + $newmenu->add("/projet/activity/perweek.php?leftmenu=tasks".($search_project_user ? '&search_project_user='.$search_project_user : ''), $langs->trans("NewTimeSpent"), 0, $user->rights->projet->lire, '', 'project', 'timespent', 0, '', '', '', img_picto('', 'timespent', 'class="pictofixedwidth"')); + } + } + } +} + +/** + * Get left Menu HRM + * + * @param string $mainmenu + * @param Menu &$newmenu Object Menu to return back list of menu entries + * @param string $usemenuhider + * @param string $leftmenu + * @param int $type_user + * @return void + */ +function get_left_menu_hrm($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0) +{ + global $user, $conf, $langs; + + if ($mainmenu == 'hrm') { + // HRM module + if (!empty($conf->hrm->enabled)) { + $langs->load("hrm"); + + $newmenu->add("/user/list.php?mainmenu=hrm&leftmenu=hrm&mode=employee", $langs->trans("Employees"), 0, $user->rights->user->user->lire, '', $mainmenu, 'hrm', 0, '', '', '', img_picto('', 'user', 'class="pictofixedwidth"')); + $newmenu->add("/user/card.php?mainmenu=hrm&leftmenu=hrm&action=create&employee=1", $langs->trans("NewEmployee"), 1, $user->rights->user->user->creer); + $newmenu->add("/user/list.php?mainmenu=hrm&leftmenu=hrm&mode=employee&contextpage=employeelist", $langs->trans("List"), 1, $user->rights->user->user->lire); + + $newmenu->add("/hrm/index.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("SkillsManagement"), 0, $user->rights->hrm->all->read, '', $mainmenu, 'hrm_sm', 0, '', '', '', img_picto('', 'user', 'class="pictofixedwidth"')); + + if ($usemenuhider || empty($leftmenu) || $leftmenu == "hrm_sm") { + // Skills + $newmenu->add("/hrm/skill_list.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("Skills"), 1, $user->rights->hrm->all->read, '', $mainmenu, 'hrm_sm', 0, '', '', '', img_picto('', 'shapes', 'class="pictofixedwidth"')); + //$newmenu->add("/hrm/skill_card.php?mainmenu=hrm&leftmenu=hrm_sm&action=create", $langs->trans("NewSkill"), 1, $user->rights->hrm->all->write); + //$newmenu->add("/hrm/skill_list.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("List"), 1, $user->rights->hrm->all->read); + + // Job (Description of work to do and skills required) + $newmenu->add("/hrm/job_list.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("JobsPosition"), 1, $user->rights->hrm->all->read, '', $mainmenu, 'hrm_sm', 0, '', '', '', img_picto('', 'technic', 'class="pictofixedwidth"')); + //$newmenu->add("/hrm/job_card.php?mainmenu=hrm&leftmenu=hrm_sm&action=create", $langs->transnoentities("NewObject", $langs->trans("Job")), 1, $user->rights->hrm->all->write); + //$newmenu->add("/hrm/job_list.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("List"), 1, $user->rights->hrm->all->read); + + // Position = Link job - user + $newmenu->add("/hrm/position_list.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("EmployeePositions"), 1, $user->rights->hrm->all->read, '', $mainmenu, 'hrm_sm', 0, '', '', '', img_picto('', 'user-cog', 'class="pictofixedwidth"')); + //$newmenu->add("/hrm/position.php?mainmenu=hrm&leftmenu=hrm_sm&action=create", $langs->transnoentities("NewObject", $langs->trans("Position")), 1, $user->rights->hrm->all->write); + //$newmenu->add("/hrm/position_list.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("List"), 1, $user->rights->hrm->all->read); + + // Evaluation + $newmenu->add("/hrm/evaluation_list.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("Evalutions"), 1, $user->rights->hrm->evaluation->read, '', $mainmenu, 'hrm_sm', 0, '', '', '', img_picto('', 'user', 'class="pictofixedwidth"')); + //$newmenu->add("/hrm/evaluation_card.php?mainmenu=hrm&leftmenu=hrm_sm&action=create", $langs->trans("NewEval"), 1, $user->rights->hrm->evaluation->write); + //$newmenu->add("/hrm/evaluation_list.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("List"), 1, $user->rights->hrm->evaluation->read); + $newmenu->add("/hrm/compare.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("SkillComparison"), 1, $user->rights->hrm->evaluation->read || $user->rights->hrm->compare_advance->read); + } + } + + // Leave/Holiday/Vacation module + if (!empty($conf->holiday->enabled)) { + // Load translation files required by the page + $langs->loadLangs(array("holiday", "trips")); + + $newmenu->add("/holiday/list.php?mainmenu=hrm&leftmenu=hrm", $langs->trans("CPTitreMenu"), 0, $user->rights->holiday->read, '', $mainmenu, 'hrm', 0, '', '', '', img_picto('', 'holiday', 'class="pictofixedwidth"')); + $newmenu->add("/holiday/card.php?mainmenu=hrm&leftmenu=holiday&action=create", $langs->trans("New"), 1, $user->rights->holiday->write); + $newmenu->add("/holiday/list.php?mainmenu=hrm&leftmenu=hrm", $langs->trans("List"), 1, $user->rights->holiday->read); + if ($usemenuhider || empty($leftmenu) || $leftmenu == "hrm") { + $newmenu->add("/holiday/list.php?search_status=1&mainmenu=hrm&leftmenu=hrm", $langs->trans("DraftCP"), 2, $user->rights->holiday->read); + $newmenu->add("/holiday/list.php?search_status=2&mainmenu=hrm&leftmenu=hrm", $langs->trans("ToReviewCP"), 2, $user->rights->holiday->read); + $newmenu->add("/holiday/list.php?search_status=3&mainmenu=hrm&leftmenu=hrm", $langs->trans("ApprovedCP"), 2, $user->rights->holiday->read); + $newmenu->add("/holiday/list.php?search_status=4&mainmenu=hrm&leftmenu=hrm", $langs->trans("CancelCP"), 2, $user->rights->holiday->read); + $newmenu->add("/holiday/list.php?search_status=5&mainmenu=hrm&leftmenu=hrm", $langs->trans("RefuseCP"), 2, $user->rights->holiday->read); + } + $newmenu->add("/holiday/define_holiday.php?mainmenu=hrm&action=request", $langs->trans("MenuConfCP"), 1, $user->rights->holiday->read); + $newmenu->add("/holiday/month_report.php?mainmenu=hrm&leftmenu=holiday", $langs->trans("MenuReportMonth"), 1, $user->rights->holiday->readall); + $newmenu->add("/holiday/view_log.php?mainmenu=hrm&leftmenu=holiday&action=request", $langs->trans("MenuLogCP"), 1, $user->rights->holiday->define_holiday); + } + + // Trips and expenses (old module) + if (!empty($conf->deplacement->enabled)) { + $langs->load("trips"); + $newmenu->add("/compta/deplacement/index.php?leftmenu=tripsandexpenses&mainmenu=hrm", $langs->trans("TripsAndExpenses"), 0, $user->rights->deplacement->lire, '', $mainmenu, 'tripsandexpenses', 0, '', '', '', img_picto('', 'trip', 'class="pictofixedwidth"')); + $newmenu->add("/compta/deplacement/card.php?action=create&leftmenu=tripsandexpenses&mainmenu=hrm", $langs->trans("New"), 1, $user->rights->deplacement->creer); + $newmenu->add("/compta/deplacement/list.php?leftmenu=tripsandexpenses&mainmenu=hrm", $langs->trans("List"), 1, $user->rights->deplacement->lire); + $newmenu->add("/compta/deplacement/stats/index.php?leftmenu=tripsandexpenses&mainmenu=hrm", $langs->trans("Statistics"), 1, $user->rights->deplacement->lire); + } + + // Expense report + if (!empty($conf->expensereport->enabled)) { + $langs->load("trips"); + $newmenu->add("/expensereport/index.php?leftmenu=expensereport&mainmenu=hrm", $langs->trans("TripsAndExpenses"), 0, $user->rights->expensereport->lire, '', $mainmenu, 'expensereport', 0, '', '', '', img_picto('', 'trip', 'class="pictofixedwidth"')); + $newmenu->add("/expensereport/card.php?action=create&leftmenu=expensereport&mainmenu=hrm", $langs->trans("New"), 1, $user->rights->expensereport->creer); + $newmenu->add("/expensereport/list.php?leftmenu=expensereport&mainmenu=hrm", $langs->trans("List"), 1, $user->rights->expensereport->lire); + if ($usemenuhider || empty($leftmenu) || $leftmenu == "expensereport") { + $newmenu->add("/expensereport/list.php?search_status=0&leftmenu=expensereport&mainmenu=hrm", $langs->trans("Draft"), 2, $user->rights->expensereport->lire); + $newmenu->add("/expensereport/list.php?search_status=2&leftmenu=expensereport&mainmenu=hrm", $langs->trans("Validated"), 2, $user->rights->expensereport->lire); + $newmenu->add("/expensereport/list.php?search_status=5&leftmenu=expensereport&mainmenu=hrm", $langs->trans("Approved"), 2, $user->rights->expensereport->lire); + $newmenu->add("/expensereport/list.php?search_status=6&leftmenu=expensereport&mainmenu=hrm", $langs->trans("Paid"), 2, $user->rights->expensereport->lire); + $newmenu->add("/expensereport/list.php?search_status=4&leftmenu=expensereport&mainmenu=hrm", $langs->trans("Canceled"), 2, $user->rights->expensereport->lire); + $newmenu->add("/expensereport/list.php?search_status=99&leftmenu=expensereport&mainmenu=hrm", $langs->trans("Refused"), 2, $user->rights->expensereport->lire); + } + $newmenu->add("/expensereport/stats/index.php?leftmenu=expensereport&mainmenu=hrm", $langs->trans("Statistics"), 1, $user->rights->expensereport->lire); + } + + if (!empty($conf->projet->enabled)) { + if (empty($conf->global->PROJECT_HIDE_TASKS)) { + $langs->load("projects"); + + $search_project_user = GETPOST('search_project_user', 'int'); + + $newmenu->add("/projet/activity/perweek.php?leftmenu=tasks".($search_project_user ? '&search_project_user='.$search_project_user : ''), $langs->trans("NewTimeSpent"), 0, $user->rights->projet->lire, '', $mainmenu, 'timespent', 0, '', '', '', img_picto('', 'timespent', 'class="pictofixedwidth"')); + } + } + } +} + +/** + * Get left Menu TOOLS + * + * @param string $mainmenu + * @param Menu &$newmenu Object Menu to return back list of menu entries + * @param string $usemenuhider + * @param string $leftmenu + * @param int $type_user + * @return void + */ +function get_left_menu_tools($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0) +{ + global $user, $conf, $langs; + + if ($mainmenu == 'tools') { + if (empty($user->socid)) { // limit to internal users + $langs->load("mails"); + $newmenu->add("/admin/mails_templates.php?leftmenu=email_templates", $langs->trans("EMailTemplates"), 0, 1, '', $mainmenu, 'email_templates', 0, '', '', '', img_picto('', 'email', 'class="paddingright pictofixedwidth"')); + } + + if (!empty($conf->mailing->enabled)) { + $newmenu->add("/comm/mailing/index.php?leftmenu=mailing", $langs->trans("EMailings"), 0, $user->rights->mailing->lire, '', $mainmenu, 'mailing', 0, '', '', '', img_picto('', 'email', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/comm/mailing/card.php?leftmenu=mailing&action=create", $langs->trans("NewMailing"), 1, $user->rights->mailing->creer); + $newmenu->add("/comm/mailing/list.php?leftmenu=mailing", $langs->trans("List"), 1, $user->rights->mailing->lire); + } + + if (!empty($conf->export->enabled)) { + $langs->load("exports"); + $newmenu->add("/exports/index.php?leftmenu=export", $langs->trans("FormatedExport"), 0, $user->rights->export->lire, '', $mainmenu, 'export', 0, '', '', '', img_picto('', 'technic', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/exports/export.php?leftmenu=export", $langs->trans("NewExport"), 1, $user->rights->export->creer); + //$newmenu->add("/exports/export.php?leftmenu=export",$langs->trans("List"),1, $user->rights->export->lire); + } + + if (!empty($conf->import->enabled)) { + $langs->load("exports"); + $newmenu->add("/imports/index.php?leftmenu=import", $langs->trans("FormatedImport"), 0, $user->rights->import->run, '', $mainmenu, 'import', 0, '', '', '', img_picto('', 'technic', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/imports/import.php?leftmenu=import", $langs->trans("NewImport"), 1, $user->rights->import->run); + } + } +} + +/** + * Get left Menu MEMBERS + * + * @param string $mainmenu + * @param Menu &$newmenu Object Menu to return back list of menu entries + * @param string $usemenuhider + * @param string $leftmenu + * @param int $type_user + * @return void + */ +function get_left_menu_members($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0) +{ + global $user, $conf, $langs; + + if ($mainmenu == 'members') { + if (!empty($conf->adherent->enabled)) { + // Load translation files required by the page + $langs->loadLangs(array("members", "compta")); + + $newmenu->add("/adherents/index.php?leftmenu=members&mainmenu=members", $langs->trans("Members"), 0, $user->rights->adherent->lire, '', $mainmenu, 'members', 0, '', '', '', img_picto('', 'member', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/adherents/card.php?leftmenu=members&action=create", $langs->trans("NewMember"), 1, $user->rights->adherent->creer); + $newmenu->add("/adherents/list.php?leftmenu=members", $langs->trans("List"), 1, $user->rights->adherent->lire); + $newmenu->add("/adherents/list.php?leftmenu=members&statut=-1", $langs->trans("MenuMembersToValidate"), 2, $user->rights->adherent->lire); + $newmenu->add("/adherents/list.php?leftmenu=members&statut=1", $langs->trans("MenuMembersValidated"), 2, $user->rights->adherent->lire); + $newmenu->add("/adherents/list.php?leftmenu=members&statut=1&filter=withoutsubscription", $langs->trans("WithoutSubscription"), 3, $user->rights->adherent->lire); + $newmenu->add("/adherents/list.php?leftmenu=members&statut=1&filter=uptodate", $langs->trans("UpToDate"), 3, $user->rights->adherent->lire); + $newmenu->add("/adherents/list.php?leftmenu=members&statut=1&filter=outofdate", $langs->trans("OutOfDate"), 3, $user->rights->adherent->lire); + $newmenu->add("/adherents/list.php?leftmenu=members&statut=0", $langs->trans("MenuMembersResiliated"), 2, $user->rights->adherent->lire); + $newmenu->add("/adherents/stats/index.php?leftmenu=members", $langs->trans("MenuMembersStats"), 1, $user->rights->adherent->lire); + + $newmenu->add("/adherents/cartes/carte.php?leftmenu=export", $langs->trans("MembersCards"), 1, $user->rights->adherent->export); + if (!empty($conf->global->MEMBER_LINK_TO_HTPASSWDFILE) && ($usemenuhider || empty($leftmenu) || $leftmenu == 'none' || $leftmenu == "members" || $leftmenu == "export")) { + $newmenu->add("/adherents/htpasswd.php?leftmenu=export", $langs->trans("Filehtpasswd"), 1, $user->rights->adherent->export); + } + + if (!empty($conf->categorie->enabled)) { + $langs->load("categories"); + $newmenu->add("/categories/index.php?leftmenu=cat&type=3", $langs->trans("Categories"), 1, $user->rights->categorie->lire, '', $mainmenu, 'cat'); + } + + $newmenu->add("/adherents/index.php?leftmenu=members&mainmenu=members", $langs->trans("Subscriptions"), 0, $user->rights->adherent->cotisation->lire, '', $mainmenu, 'members', 0, '', '', '', img_picto('', 'payment', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/adherents/list.php?leftmenu=members&statut=-1,1&mainmenu=members", $langs->trans("NewSubscription"), 1, $user->rights->adherent->cotisation->creer); + $newmenu->add("/adherents/subscription/list.php?leftmenu=members", $langs->trans("List"), 1, $user->rights->adherent->cotisation->lire); + $newmenu->add("/adherents/stats/index.php?leftmenu=members", $langs->trans("MenuMembersStats"), 1, $user->rights->adherent->lire); + + //$newmenu->add("/adherents/index.php?leftmenu=export&mainmenu=members",$langs->trans("Tools"),0,$user->rights->adherent->export, '', $mainmenu, 'export'); + //if (! empty($conf->export->enabled) && ($usemenuhider || empty($leftmenu) || $leftmenu=="export")) $newmenu->add("/exports/index.php?leftmenu=export",$langs->trans("Datas"),1,$user->rights->adherent->export); + + // Type + $newmenu->add("/adherents/type.php?leftmenu=setup&mainmenu=members", $langs->trans("MembersTypes"), 0, $user->rights->adherent->configurer, '', $mainmenu, 'setup', 0, '', '', '', img_picto('', 'members', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/adherents/type.php?leftmenu=setup&mainmenu=members&action=create", $langs->trans("New"), 1, $user->rights->adherent->configurer); + $newmenu->add("/adherents/type.php?leftmenu=setup&mainmenu=members", $langs->trans("List"), 1, $user->rights->adherent->configurer); + } + } +} /** * Core function to output left menu eldy @@ -697,7 +2062,7 @@ function print_end_menu_array() function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabMenu, &$menu, $noout = 0, $forcemainmenu = '', $forceleftmenu = '', $moredata = null, $type_user = 0) { - global $user, $conf, $langs, $dolibarr_main_db_name, $mysoc, $hookmanager; + global $user, $conf, $langs, $hookmanager; //var_dump($tabMenu); @@ -739,1223 +2104,84 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM * Menu HOME */ if ($mainmenu == 'home') { - $langs->load("users"); - - // Home - dashboard - $newmenu->add("/index.php?mainmenu=home&leftmenu=home", $langs->trans("MyDashboard"), 0, 1, '', $mainmenu, 'home', 0, '', '', '', ''); - - // Setup - $newmenu->add("/admin/index.php?mainmenu=home&leftmenu=setup", $langs->trans("Setup"), 0, $user->admin, '', $mainmenu, 'setup', 0, '', '', '', ''); - - if ($usemenuhider || empty($leftmenu) || $leftmenu == "setup") { - // Load translation files required by the page - $langs->loadLangs(array("admin", "help")); - - $warnpicto = ''; - if (empty($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_INFO_SOCIETE_COUNTRY)) { - $langs->load("errors"); - $warnpicto = img_warning($langs->trans("WarningMandatorySetupNotComplete")); - } - $newmenu->add("/admin/company.php?mainmenu=home", $langs->trans("MenuCompanySetup").$warnpicto, 1); - - $warnpicto = ''; - if (count($conf->modules) <= (empty($conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING) ? 1 : $conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)) { // If only user module enabled - $langs->load("errors"); - $warnpicto = img_warning($langs->trans("WarningMandatorySetupNotComplete")); - } - $newmenu->add("/admin/modules.php?mainmenu=home", $langs->trans("Modules").$warnpicto, 1); - $newmenu->add("/admin/ihm.php?mainmenu=home", $langs->trans("GUISetup"), 1); - $newmenu->add("/admin/menus.php?mainmenu=home", $langs->trans("Menus"), 1); - - $newmenu->add("/admin/translation.php?mainmenu=home", $langs->trans("Translation"), 1); - $newmenu->add("/admin/defaultvalues.php?mainmenu=home", $langs->trans("DefaultValues"), 1); - $newmenu->add("/admin/boxes.php?mainmenu=home", $langs->trans("Boxes"), 1); - $newmenu->add("/admin/delais.php?mainmenu=home", $langs->trans("MenuWarnings"), 1); - $newmenu->add("/admin/security_other.php?mainmenu=home", $langs->trans("Security"), 1); - $newmenu->add("/admin/limits.php?mainmenu=home", $langs->trans("MenuLimits"), 1); - $newmenu->add("/admin/pdf.php?mainmenu=home", $langs->trans("PDF"), 1); - - $warnpicto = ''; - if (!empty($conf->global->MAIN_MAIL_SENDMODE) && $conf->global->MAIN_MAIL_SENDMODE == 'mail' && empty($conf->global->MAIN_HIDE_WARNING_TO_ENCOURAGE_SMTP_SETUP)) { - $langs->load("errors"); - $warnpicto = img_warning($langs->trans("WarningPHPMailD")); - } - if (!empty($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmail')) && empty($conf->global->MAIN_MAIL_SMTP_SERVER)) { - $langs->load("errors"); - $warnpicto = img_warning($langs->trans("ErrorSetupOfEmailsNotComplete")); - } - - $newmenu->add("/admin/mails.php?mainmenu=home", $langs->trans("Emails").$warnpicto, 1); - $newmenu->add("/admin/sms.php?mainmenu=home", $langs->trans("SMS"), 1); - $newmenu->add("/admin/dict.php?mainmenu=home", $langs->trans("Dictionary"), 1); - $newmenu->add("/admin/const.php?mainmenu=home", $langs->trans("OtherSetup"), 1); - } - - // System tools - $newmenu->add("/admin/tools/index.php?mainmenu=home&leftmenu=admintools", $langs->trans("AdminTools"), 0, $user->admin, '', $mainmenu, 'admintools', 0, '', '', '', ''); - if ($usemenuhider || empty($leftmenu) || preg_match('/^admintools/', $leftmenu)) { - // Load translation files required by the page - $langs->loadLangs(array('admin', 'help')); - - $newmenu->add('/admin/system/dolibarr.php?mainmenu=home&leftmenu=admintools_info', $langs->trans('InfoDolibarr'), 1); - if ($usemenuhider || empty($leftmenu) || $leftmenu == 'admintools_info') { - $newmenu->add('/admin/system/modules.php?mainmenu=home&leftmenu=admintools_info', $langs->trans('Modules'), 2); - $newmenu->add('/admin/triggers.php?mainmenu=home&leftmenu=admintools_info', $langs->trans('Triggers'), 2); - $newmenu->add('/admin/system/filecheck.php?mainmenu=home&leftmenu=admintools_info', $langs->trans('FileCheck'), 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); - $newmenu->add('/admin/system/database.php?mainmenu=home&leftmenu=admintools', $langs->trans('InfoDatabase'), 1); - $newmenu->add("/admin/system/perf.php?mainmenu=home&leftmenu=admintools", $langs->trans("InfoPerf"), 1); - $newmenu->add("/admin/system/security.php?mainmenu=home&leftmenu=admintools", $langs->trans("InfoSecurity"), 1); - $newmenu->add("/admin/tools/dolibarr_export.php?mainmenu=home&leftmenu=admintools", $langs->trans("Backup"), 1); - $newmenu->add("/admin/tools/dolibarr_import.php?mainmenu=home&leftmenu=admintools", $langs->trans("Restore"), 1); - $newmenu->add("/admin/tools/update.php?mainmenu=home&leftmenu=admintools", $langs->trans("MenuUpgrade"), 1); - $newmenu->add("/admin/tools/purge.php?mainmenu=home&leftmenu=admintools", $langs->trans("Purge"), 1); - $newmenu->add("/admin/tools/listevents.php?mainmenu=home&leftmenu=admintools", $langs->trans("Audit"), 1); - $newmenu->add("/admin/tools/listsessions.php?mainmenu=home&leftmenu=admintools", $langs->trans("Sessions"), 1); - $newmenu->add('/admin/system/about.php?mainmenu=home&leftmenu=admintools', $langs->trans('ExternalResources'), 1); - - if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) { - $langs->load("products"); - $newmenu->add("/product/admin/product_tools.php?mainmenu=home&leftmenu=admintools", $langs->trans("ProductVatMassChange"), 1, $user->admin); - } - } - - $newmenu->add("/user/home.php?leftmenu=users", $langs->trans("MenuUsersAndGroups"), 0, $user->rights->user->user->lire, '', $mainmenu, 'users', 0, '', '', '', img_picto('', 'user', 'class="paddingright pictofixedwidth"')); - if ($user->rights->user->user->lire) { - if ($usemenuhider || empty($leftmenu) || $leftmenu == "users") { - $newmenu->add("", $langs->trans("Users"), 1, $user->rights->user->user->lire || $user->admin); - $newmenu->add("/user/card.php?leftmenu=users&action=create", $langs->trans("NewUser"), 2, ($user->rights->user->user->creer || $user->admin) && !(!empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE), '', 'home'); - $newmenu->add("/user/list.php?leftmenu=users", $langs->trans("ListOfUsers"), 2, $user->rights->user->user->lire || $user->admin); - $newmenu->add("/user/hierarchy.php?leftmenu=users", $langs->trans("HierarchicView"), 2, $user->rights->user->user->lire || $user->admin); - if (!empty($conf->categorie->enabled)) { - $langs->load("categories"); - $newmenu->add("/categories/index.php?leftmenu=users&type=7", $langs->trans("UsersCategoriesShort"), 2, $user->rights->categorie->lire, '', $mainmenu, 'cat'); - } - $newmenu->add("", $langs->trans("Groups"), 1, ($user->rights->user->user->lire || $user->admin) && !(!empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE)); - $newmenu->add("/user/group/card.php?leftmenu=users&action=create", $langs->trans("NewGroup"), 2, ((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) ? $user->rights->user->group_advance->write : $user->rights->user->user->creer) || $user->admin) && !(!empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE)); - $newmenu->add("/user/group/list.php?leftmenu=users", $langs->trans("ListOfGroups"), 2, ((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) ? $user->rights->user->group_advance->read : $user->rights->user->user->lire) || $user->admin) && !(!empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE)); - } - } + get_left_menu_home($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user); } - /* * Menu THIRDPARTIES */ if ($mainmenu == 'companies') { - // Societes - if (!empty($conf->societe->enabled)) { - $langs->load("companies"); - $newmenu->add("/societe/index.php?leftmenu=thirdparties", $langs->trans("ThirdParty"), 0, $user->rights->societe->lire, '', $mainmenu, 'thirdparties', 0, '', '', '', img_picto('', 'company', 'class="paddingright pictofixedwidth"')); - - if ($user->rights->societe->creer) { - $newmenu->add("/societe/card.php?action=create", $langs->trans("MenuNewThirdParty"), 1); - if (!$conf->use_javascript_ajax) { - $newmenu->add("/societe/card.php?action=create&private=1", $langs->trans("MenuNewPrivateIndividual"), 1); - } - } - } - - $newmenu->add("/societe/list.php?leftmenu=thirdparties", $langs->trans("List"), 1); - - // Prospects - if (!empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) { - $langs->load("commercial"); - $newmenu->add("/societe/list.php?type=p&leftmenu=prospects", $langs->trans("ListProspectsShort"), 2, $user->rights->societe->lire, '', $mainmenu, 'prospects'); - /* no more required, there is a filter that can do more - if ($usemenuhider || empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/societe/list.php?type=p&sortfield=s.datec&sortorder=desc&begin=&search_stcomm=-1", $langs->trans("LastProspectDoNotContact"), 2, $user->rights->societe->lire); - if ($usemenuhider || empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/societe/list.php?type=p&sortfield=s.datec&sortorder=desc&begin=&search_stcomm=0", $langs->trans("LastProspectNeverContacted"), 2, $user->rights->societe->lire); - if ($usemenuhider || empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/societe/list.php?type=p&sortfield=s.datec&sortorder=desc&begin=&search_stcomm=1", $langs->trans("LastProspectToContact"), 2, $user->rights->societe->lire); - if ($usemenuhider || empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/societe/list.php?type=p&sortfield=s.datec&sortorder=desc&begin=&search_stcomm=2", $langs->trans("LastProspectContactInProcess"), 2, $user->rights->societe->lire); - if ($usemenuhider || empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/societe/list.php?type=p&sortfield=s.datec&sortorder=desc&begin=&search_stcomm=3", $langs->trans("LastProspectContactDone"), 2, $user->rights->societe->lire); - */ - $newmenu->add("/societe/card.php?leftmenu=prospects&action=create&type=p", $langs->trans("MenuNewProspect"), 3, $user->rights->societe->creer); - } - - // Customers/Prospects - if (!empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) { - $langs->load("commercial"); - $newmenu->add("/societe/list.php?type=c&leftmenu=customers", $langs->trans("ListCustomersShort"), 2, $user->rights->societe->lire, '', $mainmenu, 'customers'); - - $newmenu->add("/societe/card.php?leftmenu=customers&action=create&type=c", $langs->trans("MenuNewCustomer"), 3, $user->rights->societe->creer); - } - - // Suppliers - if (!empty($conf->societe->enabled) && (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) || !empty($conf->supplier_proposal->enabled))) { - $langs->load("suppliers"); - $newmenu->add("/societe/list.php?type=f&leftmenu=suppliers", $langs->trans("ListSuppliersShort"), 2, ($user->rights->fournisseur->lire || $user->rights->supplier_order->lire || $user->rights->supplier_invoice->lire || $user->rights->supplier_proposal->lire), '', $mainmenu, 'suppliers'); - $newmenu->add("/societe/card.php?leftmenu=suppliers&action=create&type=f", $langs->trans("MenuNewSupplier"), 3, $user->rights->societe->creer && ($user->rights->fournisseur->lire || $user->rights->supplier_order->lire || $user->rights->supplier_invoice->lire || $user->rights->supplier_proposal->lire)); - } - - // Categories - if (!empty($conf->categorie->enabled)) { - $langs->load("categories"); - if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) { - // Categories prospects/customers - $menutoshow = $langs->trans("CustomersProspectsCategoriesShort"); - if (!empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) { - $menutoshow = $langs->trans("CustomersCategoriesShort"); - } - if (!empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) { - $menutoshow = $langs->trans("ProspectsCategoriesShort"); - } - $newmenu->add("/categories/index.php?leftmenu=cat&type=2", $menutoshow, 1, $user->rights->categorie->lire, '', $mainmenu, 'cat'); - } - // Categories suppliers - if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) { - $newmenu->add("/categories/index.php?leftmenu=catfournish&type=1", $langs->trans("SuppliersCategoriesShort"), 1, $user->rights->categorie->lire); - } - } - - // Contacts - $newmenu->add("/societe/index.php?leftmenu=thirdparties", (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses")), 0, $user->rights->societe->contact->lire, '', $mainmenu, 'contacts', 0, '', '', '', img_picto('', 'contact', 'class="paddingright pictofixedwidth"')); - - $newmenu->add("/contact/card.php?leftmenu=contacts&action=create", (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("NewContact") : $langs->trans("NewContactAddress")), 1, $user->rights->societe->contact->creer); - $newmenu->add("/contact/list.php?leftmenu=contacts", $langs->trans("List"), 1, $user->rights->societe->contact->lire); - if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) { - $newmenu->add("/contact/list.php?leftmenu=contacts&type=p", $langs->trans("Prospects"), 2, $user->rights->societe->contact->lire); - } - if (empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) { - $newmenu->add("/contact/list.php?leftmenu=contacts&type=c", $langs->trans("Customers"), 2, $user->rights->societe->contact->lire); - } - if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) { - $newmenu->add("/contact/list.php?leftmenu=contacts&type=f", $langs->trans("Suppliers"), 2, $user->rights->societe->contact->lire); - } - $newmenu->add("/contact/list.php?leftmenu=contacts&type=o", $langs->trans("ContactOthers"), 2, $user->rights->societe->contact->lire); - //$newmenu->add("/contact/list.php?userid=$user->id", $langs->trans("MyContacts"), 1, $user->rights->societe->contact->lire); - - // Categories - if (!empty($conf->categorie->enabled)) { - $langs->load("categories"); - // Categories Contact - $newmenu->add("/categories/index.php?leftmenu=catcontact&type=4", $langs->trans("ContactCategoriesShort"), 1, $user->rights->categorie->lire, '', $mainmenu, 'cat'); - } + get_left_menu_thridparties($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user); } /* * Menu COMMERCIAL (propal, commande, supplier_proposal, supplier_order, contrat, ficheinter) */ if ($mainmenu == 'commercial') { - $langs->load("companies"); - - // Customer proposal - if (!empty($conf->propal->enabled)) { - $langs->load("propal"); - $newmenu->add("/comm/propal/index.php?leftmenu=propals", $langs->trans("Proposals"), 0, $user->rights->propale->lire, '', $mainmenu, 'propals', 100, '', '', '', img_picto('', 'propal', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/comm/propal/card.php?action=create&leftmenu=propals", $langs->trans("NewPropal"), 1, $user->rights->propale->creer); - $newmenu->add("/comm/propal/list.php?leftmenu=propals", $langs->trans("List"), 1, $user->rights->propale->lire); - if ($usemenuhider || empty($leftmenu) || $leftmenu == "propals") { - $newmenu->add("/comm/propal/list.php?leftmenu=propals&search_status=0", $langs->trans("PropalsDraft"), 2, $user->rights->propale->lire); - $newmenu->add("/comm/propal/list.php?leftmenu=propals&search_status=1", $langs->trans("PropalsOpened"), 2, $user->rights->propale->lire); - $newmenu->add("/comm/propal/list.php?leftmenu=propals&search_status=2", $langs->trans("PropalStatusSigned"), 2, $user->rights->propale->lire); - $newmenu->add("/comm/propal/list.php?leftmenu=propals&search_status=3", $langs->trans("PropalStatusNotSigned"), 2, $user->rights->propale->lire); - $newmenu->add("/comm/propal/list.php?leftmenu=propals&search_status=4", $langs->trans("PropalStatusBilled"), 2, $user->rights->propale->lire); - //$newmenu->add("/comm/propal/list.php?leftmenu=propals&search_status=2,3,4", $langs->trans("PropalStatusClosedShort"), 2, $user->rights->propale->lire); - } - $newmenu->add("/comm/propal/stats/index.php?leftmenu=propals", $langs->trans("Statistics"), 1, $user->rights->propale->lire); - } - - // Customers orders - if (!empty($conf->commande->enabled)) { - $langs->load("orders"); - $newmenu->add("/commande/index.php?leftmenu=orders", $langs->trans("CustomersOrders"), 0, $user->rights->commande->lire, '', $mainmenu, 'orders', 200, '', '', '', img_picto('', 'order', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/commande/card.php?action=create&leftmenu=orders", $langs->trans("NewOrder"), 1, $user->rights->commande->creer); - $newmenu->add("/commande/list.php?leftmenu=orders", $langs->trans("List"), 1, $user->rights->commande->lire); - if ($usemenuhider || empty($leftmenu) || $leftmenu == "orders") { - $newmenu->add("/commande/list.php?leftmenu=orders&search_status=0", $langs->trans("StatusOrderDraftShort"), 2, $user->rights->commande->lire); - $newmenu->add("/commande/list.php?leftmenu=orders&search_status=1", $langs->trans("StatusOrderValidated"), 2, $user->rights->commande->lire); - if (!empty($conf->expedition->enabled)) { - $newmenu->add("/commande/list.php?leftmenu=orders&search_status=2", $langs->trans("StatusOrderSentShort"), 2, $user->rights->commande->lire); - } - $newmenu->add("/commande/list.php?leftmenu=orders&search_status=3", $langs->trans("StatusOrderDelivered"), 2, $user->rights->commande->lire); - //$newmenu->add("/commande/list.php?leftmenu=orders&search_status=4", $langs->trans("StatusOrderProcessed"), 2, $user->rights->commande->lire); - $newmenu->add("/commande/list.php?leftmenu=orders&search_status=-1", $langs->trans("StatusOrderCanceledShort"), 2, $user->rights->commande->lire); - } - $newmenu->add("/commande/stats/index.php?leftmenu=orders", $langs->trans("Statistics"), 1, $user->rights->commande->lire); - } - - // Supplier proposal - if (!empty($conf->supplier_proposal->enabled)) { - $langs->load("supplier_proposal"); - $newmenu->add("/supplier_proposal/index.php?leftmenu=propals_supplier", $langs->trans("SupplierProposalsShort"), 0, $user->rights->supplier_proposal->lire, '', $mainmenu, 'propals_supplier', 300, '', '', '', img_picto('', 'supplier_proposal', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/supplier_proposal/card.php?action=create&leftmenu=supplier_proposals", $langs->trans("SupplierProposalNew"), 1, $user->rights->supplier_proposal->creer); - $newmenu->add("/supplier_proposal/list.php?leftmenu=supplier_proposals", $langs->trans("List"), 1, $user->rights->supplier_proposal->lire); - $newmenu->add("/comm/propal/stats/index.php?leftmenu=supplier_proposals&mode=supplier", $langs->trans("Statistics"), 1, $user->rights->supplier_proposal->lire); - } - - // Suppliers orders - if (!empty($conf->supplier_order->enabled)) { - $langs->load("orders"); - $newmenu->add("/fourn/commande/index.php?leftmenu=orders_suppliers", $langs->trans("SuppliersOrders"), 0, $user->rights->fournisseur->commande->lire, '', $mainmenu, 'orders_suppliers', 400, '', '', '', img_picto('', 'supplier_order', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/fourn/commande/card.php?action=create&leftmenu=orders_suppliers", $langs->trans("NewSupplierOrderShort"), 1, $user->rights->fournisseur->commande->creer); - $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers", $langs->trans("List"), 1, $user->rights->fournisseur->commande->lire); - - if ($usemenuhider || empty($leftmenu) || $leftmenu == "orders_suppliers") { - $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=0", $langs->trans("StatusSupplierOrderDraftShort"), 2, $user->rights->fournisseur->commande->lire); - if (empty($conf->global->SUPPLIER_ORDER_HIDE_VALIDATED)) { - $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=1", $langs->trans("StatusSupplierOrderValidated"), 2, $user->rights->fournisseur->commande->lire); - } - $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=2", $langs->trans("StatusSupplierOrderApprovedShort"), 2, $user->rights->fournisseur->commande->lire); - $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=3", $langs->trans("StatusSupplierOrderOnProcessShort"), 2, $user->rights->fournisseur->commande->lire); - $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=4", $langs->trans("StatusSupplierOrderReceivedPartiallyShort"), 2, $user->rights->fournisseur->commande->lire); - $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=5", $langs->trans("StatusSupplierOrderReceivedAll"), 2, $user->rights->fournisseur->commande->lire); - $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=6,7", $langs->trans("StatusSupplierOrderCanceled"), 2, $user->rights->fournisseur->commande->lire); - $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=9", $langs->trans("StatusSupplierOrderRefused"), 2, $user->rights->fournisseur->commande->lire); - } - // Billed is another field. We should add instead a dedicated filter on list. if ($usemenuhider || empty($leftmenu) || $leftmenu=="orders_suppliers") $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&billed=1", $langs->trans("Billed"), 2, $user->rights->fournisseur->commande->lire); - - - $newmenu->add("/commande/stats/index.php?leftmenu=orders_suppliers&mode=supplier", $langs->trans("Statistics"), 1, $user->rights->fournisseur->commande->lire); - } - - // Contrat - if (!empty($conf->contrat->enabled)) { - $langs->load("contracts"); - $newmenu->add("/contrat/index.php?leftmenu=contracts", $langs->trans("ContractsSubscriptions"), 0, $user->rights->contrat->lire, '', $mainmenu, 'contracts', 2000, '', '', '', img_picto('', 'contract', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/contrat/card.php?action=create&leftmenu=contracts", $langs->trans("NewContractSubscription"), 1, $user->rights->contrat->creer); - $newmenu->add("/contrat/list.php?leftmenu=contracts", $langs->trans("List"), 1, $user->rights->contrat->lire); - $newmenu->add("/contrat/services_list.php?leftmenu=contracts", $langs->trans("MenuServices"), 1, $user->rights->contrat->lire); - if ($usemenuhider || empty($leftmenu) || $leftmenu == "contracts") { - $newmenu->add("/contrat/services_list.php?leftmenu=contracts&mode=0", $langs->trans("MenuInactiveServices"), 2, $user->rights->contrat->lire); - $newmenu->add("/contrat/services_list.php?leftmenu=contracts&mode=4", $langs->trans("MenuRunningServices"), 2, $user->rights->contrat->lire); - $newmenu->add("/contrat/services_list.php?leftmenu=contracts&mode=4&filter=expired", $langs->trans("MenuExpiredServices"), 2, $user->rights->contrat->lire); - $newmenu->add("/contrat/services_list.php?leftmenu=contracts&mode=5", $langs->trans("MenuClosedServices"), 2, $user->rights->contrat->lire); - } - } - - // Interventions - if (!empty($conf->ficheinter->enabled)) { - $langs->load("interventions"); - $newmenu->add("/fichinter/index.php?leftmenu=ficheinter", $langs->trans("Interventions"), 0, $user->rights->ficheinter->lire, '', $mainmenu, 'ficheinter', 2200, '', '', '', img_picto('', 'intervention', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/fichinter/card.php?action=create&leftmenu=ficheinter", $langs->trans("NewIntervention"), 1, $user->rights->ficheinter->creer, '', '', '', 201); - $newmenu->add("/fichinter/list.php?leftmenu=ficheinter", $langs->trans("List"), 1, $user->rights->ficheinter->lire, '', '', '', 202); - if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { - $newmenu->add("/fichinter/card-rec.php?leftmenu=ficheinter", $langs->trans("ListOfTemplates"), 1, $user->rights->ficheinter->lire, '', '', '', 203); - } - $newmenu->add("/fichinter/stats/index.php?leftmenu=ficheinter", $langs->trans("Statistics"), 1, $user->rights->ficheinter->lire); - } + get_left_menu_commercial($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user); } - /* * Menu COMPTA-FINANCIAL */ if ($mainmenu == 'billing') { - $langs->load("companies"); - - // Customers invoices - if (!empty($conf->facture->enabled)) { - $langs->load("bills"); - $newmenu->add("/compta/facture/index.php?leftmenu=customers_bills", $langs->trans("BillsCustomers"), 0, $user->rights->facture->lire, '', $mainmenu, 'customers_bills', 0, '', '', '', img_picto('', 'bill', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/compta/facture/card.php?action=create", $langs->trans("NewBill"), 1, $user->rights->facture->creer); - $newmenu->add("/compta/facture/list.php?leftmenu=customers_bills", $langs->trans("List"), 1, $user->rights->facture->lire, '', $mainmenu, 'customers_bills_list'); - - if ($usemenuhider || empty($leftmenu) || preg_match('/customers_bills(|_draft|_notpaid|_paid|_canceled)$/', $leftmenu)) { - $newmenu->add("/compta/facture/list.php?leftmenu=customers_bills_draft&search_status=0", $langs->trans("BillShortStatusDraft"), 2, $user->rights->facture->lire); - $newmenu->add("/compta/facture/list.php?leftmenu=customers_bills_notpaid&search_status=1", $langs->trans("BillShortStatusNotPaid"), 2, $user->rights->facture->lire); - $newmenu->add("/compta/facture/list.php?leftmenu=customers_bills_paid&search_status=2", $langs->trans("BillShortStatusPaid"), 2, $user->rights->facture->lire); - $newmenu->add("/compta/facture/list.php?leftmenu=customers_bills_canceled&search_status=3", $langs->trans("BillShortStatusCanceled"), 2, $user->rights->facture->lire); - } - $newmenu->add("/compta/facture/invoicetemplate_list.php?leftmenu=customers_bills_templates", $langs->trans("ListOfTemplates"), 1, $user->rights->facture->creer, '', $mainmenu, 'customers_bills_templates'); // No need to see recurring invoices, if user has no permission to create invoice. - - $newmenu->add("/compta/paiement/list.php?leftmenu=customers_bills_payment", $langs->trans("Payments"), 1, $user->rights->facture->lire, '', $mainmenu, 'customers_bills_payment'); - - if (!empty($conf->global->BILL_ADD_PAYMENT_VALIDATION)) { - $newmenu->add("/compta/paiement/tovalidate.php?leftmenu=customers_bills_tovalid", $langs->trans("MenuToValid"), 2, $user->rights->facture->lire, '', $mainmenu, 'customer_bills_tovalid'); - } - if ($usemenuhider || empty($leftmenu) || preg_match('/customers_bills/', $leftmenu)) { - $newmenu->add("/compta/paiement/rapport.php?leftmenu=customers_bills_payment_report", $langs->trans("Reportings"), 2, $user->rights->facture->lire, '', $mainmenu, 'customers_bills_payment_report'); - } - - $newmenu->add("/compta/facture/stats/index.php?leftmenu=customers_bills_stats", $langs->trans("Statistics"), 1, $user->rights->facture->lire, '', $mainmenu, 'customers_bills_stats'); - } - - // Suppliers invoices - if (!empty($conf->societe->enabled) && !empty($conf->supplier_invoice->enabled)) { - $langs->load("bills"); - $newmenu->add("/fourn/facture/index.php?leftmenu=suppliers_bills", $langs->trans("BillsSuppliers"), 0, $user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills', 0, '', '', '', img_picto('', 'supplier_invoice', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/fourn/facture/card.php?leftmenu=suppliers_bills&action=create", $langs->trans("NewBill"), 1, ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer), '', $mainmenu, 'suppliers_bills_create'); - $newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills", $langs->trans("List"), 1, $user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills_list'); - - if ($usemenuhider || empty($leftmenu) || preg_match('/suppliers_bills/', $leftmenu)) { - $newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills_draft&search_status=0", $langs->trans("BillShortStatusDraft"), 2, $user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills_draft'); - $newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills_notpaid&search_status=1", $langs->trans("BillShortStatusNotPaid"), 2, $user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills_notpaid'); - $newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills_paid&search_status=2", $langs->trans("BillShortStatusPaid"), 2, $user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills_paid'); - } - - $newmenu->add("/fourn/facture/list-rec.php?leftmenu=supplierinvoicestemplate_list", $langs->trans("ListOfTemplates"), 1, $user->rights->fournisseur->facture->lire, '', $mainmenu, 'supplierinvoicestemplate_list'); - - $newmenu->add("/fourn/paiement/list.php?leftmenu=suppliers_bills_payment", $langs->trans("Payments"), 1, $user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills_payment'); - - if ($usemenuhider || empty($leftmenu) || preg_match('/suppliers_bills/', $leftmenu)) { - $newmenu->add("/fourn/facture/rapport.php?leftmenu=suppliers_bills_payment_report", $langs->trans("Reportings"), 2, $user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills_payment_report'); - } - - $newmenu->add("/compta/facture/stats/index.php?mode=supplier&leftmenu=suppliers_bills_stats", $langs->trans("Statistics"), 1, $user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills_stats'); - } - - // Orders - if (!empty($conf->commande->enabled)) { - $langs->load("orders"); - if (!empty($conf->facture->enabled)) { - $newmenu->add("/commande/list.php?leftmenu=orders&search_status=-3&billed=0&contextpage=billableorders", $langs->trans("MenuOrdersToBill2"), 0, $user->rights->commande->lire, '', $mainmenu, 'orders', 0, '', '', '', img_picto('', 'order', 'class="paddingright pictofixedwidth"')); - } - //if ($usemenuhider || empty($leftmenu) || $leftmenu=="orders") $newmenu->add("/commande/", $langs->trans("StatusOrderToBill"), 1, $user->rights->commande->lire); - } - - // Supplier Orders to bill - if (!empty($conf->supplier_invoice->enabled)) { - if (!empty($conf->global->SUPPLIER_MENU_ORDER_RECEIVED_INTO_INVOICE)) { - $langs->load("supplier"); - $newmenu->add("/fourn/commande/list.php?leftmenu=orders&search_status=5&billed=0", $langs->trans("MenuOrdersSupplierToBill"), 0, $user->rights->commande->lire, '', $mainmenu, 'orders', 0, '', '', '', img_picto('', 'supplier_order', 'class="paddingright pictofixedwidth"')); - //if ($usemenuhider || empty($leftmenu) || $leftmenu=="orders") $newmenu->add("/commande/", $langs->trans("StatusOrderToBill"), 1, $user->rights->commande->lire); - } - } - - - // Donations - if (!empty($conf->don->enabled)) { - $langs->load("donations"); - $newmenu->add("/don/index.php?leftmenu=donations&mainmenu=billing", $langs->trans("Donations"), 0, $user->rights->don->lire, '', $mainmenu, 'donations', 0, '', '', '', img_picto('', 'donation', 'class="paddingright pictofixedwidth"')); - if ($usemenuhider || empty($leftmenu) || $leftmenu == "donations") { - $newmenu->add("/don/card.php?leftmenu=donations&action=create", $langs->trans("NewDonation"), 1, $user->rights->don->creer); - $newmenu->add("/don/list.php?leftmenu=donations", $langs->trans("List"), 1, $user->rights->don->lire); - } - // if ($leftmenu=="donations") $newmenu->add("/don/stats/index.php",$langs->trans("Statistics"), 1, $user->rights->don->lire); - } - - // Taxes and social contributions - if (!empty($conf->tax->enabled)) { - $newmenu->add("/compta/charges/index.php?leftmenu=tax&mainmenu=billing", $langs->trans("MenuTaxesAndSpecialExpenses"), 0, $user->rights->tax->charges->lire, '', $mainmenu, 'tax', 0, '', '', '', img_picto('', 'payment', 'class="paddingright pictofixedwidth"')); - - $newmenu->add("/compta/sociales/list.php?leftmenu=tax_social", $langs->trans("MenuSocialContributions"), 1, $user->rights->tax->charges->lire); - if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_social/i', $leftmenu)) { - $newmenu->add("/compta/sociales/card.php?leftmenu=tax_social&action=create", $langs->trans("MenuNewSocialContribution"), 2, $user->rights->tax->charges->creer); - $newmenu->add("/compta/sociales/list.php?leftmenu=tax_social", $langs->trans("List"), 2, $user->rights->tax->charges->lire); - $newmenu->add("/compta/sociales/payments.php?leftmenu=tax_social&mainmenu=billing", $langs->trans("Payments"), 2, $user->rights->tax->charges->lire); - } - // VAT - if (empty($conf->global->TAX_DISABLE_VAT_MENUS)) { - global $mysoc; - - $newmenu->add("/compta/tva/list.php?leftmenu=tax_vat&mainmenu=billing", $langs->transcountry("VAT", $mysoc->country_code), 1, $user->rights->tax->charges->lire, '', $mainmenu, 'tax_vat'); - if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_vat/i', $leftmenu)) { - $newmenu->add("/compta/tva/card.php?leftmenu=tax_vat&action=create", $langs->trans("New"), 2, $user->rights->tax->charges->creer); - $newmenu->add("/compta/tva/list.php?leftmenu=tax_vat", $langs->trans("List"), 2, $user->rights->tax->charges->lire); - $newmenu->add("/compta/tva/payments.php?mode=tvaonly&leftmenu=tax_vat", $langs->trans("Payments"), 2, $user->rights->tax->charges->lire); - $newmenu->add("/compta/tva/index.php?leftmenu=tax_vat", $langs->trans("ReportByMonth"), 2, $user->rights->tax->charges->lire); - $newmenu->add("/compta/tva/clients.php?leftmenu=tax_vat", $langs->trans("ReportByThirdparties"), 2, $user->rights->tax->charges->lire); - $newmenu->add("/compta/tva/quadri_detail.php?leftmenu=tax_vat", $langs->trans("ReportByQuarter"), 2, $user->rights->tax->charges->lire); - } - - //Local Taxes 1 - if ($mysoc->useLocalTax(1) && (isset($mysoc->localtax1_assuj) && $mysoc->localtax1_assuj == "1")) { - $newmenu->add("/compta/localtax/list.php?leftmenu=tax_1_vat&mainmenu=billing&localTaxType=1", $langs->transcountry("LT1", $mysoc->country_code), 1, $user->rights->tax->charges->lire); - if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_1_vat/i', $leftmenu)) { - $newmenu->add("/compta/localtax/card.php?leftmenu=tax_1_vat&action=create&localTaxType=1", $langs->trans("New"), 2, $user->rights->tax->charges->creer); - $newmenu->add("/compta/localtax/list.php?leftmenu=tax_1_vat&localTaxType=1", $langs->trans("List"), 2, $user->rights->tax->charges->lire); - $newmenu->add("/compta/localtax/index.php?leftmenu=tax_1_vat&localTaxType=1", $langs->trans("ReportByMonth"), 2, $user->rights->tax->charges->lire); - $newmenu->add("/compta/localtax/clients.php?leftmenu=tax_1_vat&localTaxType=1", $langs->trans("ReportByThirdparties"), 2, $user->rights->tax->charges->lire); - $newmenu->add("/compta/localtax/quadri_detail.php?leftmenu=tax_1_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/list.php?leftmenu=tax_2_vat&mainmenu=billing&localTaxType=2", $langs->transcountry("LT2", $mysoc->country_code), 1, $user->rights->tax->charges->lire); - if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_2_vat/i', $leftmenu)) { - $newmenu->add("/compta/localtax/card.php?leftmenu=tax_2_vat&action=create&localTaxType=2", $langs->trans("New"), 2, $user->rights->tax->charges->creer); - $newmenu->add("/compta/localtax/list.php?leftmenu=tax_2_vat&localTaxType=2", $langs->trans("List"), 2, $user->rights->tax->charges->lire); - $newmenu->add("/compta/localtax/index.php?leftmenu=tax_2_vat&localTaxType=2", $langs->trans("ReportByMonth"), 2, $user->rights->tax->charges->lire); - $newmenu->add("/compta/localtax/clients.php?leftmenu=tax_2_vat&localTaxType=2", $langs->trans("ReportByThirdparties"), 2, $user->rights->tax->charges->lire); - $newmenu->add("/compta/localtax/quadri_detail.php?leftmenu=tax_2_vat&localTaxType=2", $langs->trans("ReportByQuarter"), 2, $user->rights->tax->charges->lire); - } - } - } - } - - // Salaries - if (!empty($conf->salaries->enabled)) { - $langs->load("salaries"); - $newmenu->add("/salaries/list.php?leftmenu=tax_salary&mainmenu=billing", $langs->trans("Salaries"), 0, $user->rights->salaries->read, '', $mainmenu, 'tax_salary', 0, '', '', '', img_picto('', 'salary', 'class="paddingright pictofixedwidth"')); - if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_salary/i', $leftmenu)) { - $newmenu->add("/salaries/card.php?leftmenu=tax_salary&action=create", $langs->trans("New"), 1, $user->rights->salaries->write); - $newmenu->add("/salaries/list.php?leftmenu=tax_salary", $langs->trans("List"), 1, $user->rights->salaries->read); - $newmenu->add("/salaries/payments.php?leftmenu=tax_salary", $langs->trans("Payments"), 1, $user->rights->salaries->read); - $newmenu->add("/salaries/stats/index.php?leftmenu=tax_salary", $langs->trans("Statistics"), 1, $user->rights->salaries->read); - } - } - - // Loan - if (!empty($conf->loan->enabled)) { - $langs->load("loan"); - $newmenu->add("/loan/list.php?leftmenu=tax_loan&mainmenu=billing", $langs->trans("Loans"), 0, $user->rights->loan->read, '', $mainmenu, 'tax_loan', 0, '', '', '', img_picto('', 'loan', 'class="paddingright pictofixedwidth"')); - if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_loan/i', $leftmenu)) { - $newmenu->add("/loan/card.php?leftmenu=tax_loan&action=create", $langs->trans("NewLoan"), 1, $user->rights->loan->write); - //$newmenu->add("/loan/payment/list.php?leftmenu=tax_loan",$langs->trans("Payments"),2,$user->rights->loan->read); - } - } - - // Various payment - if (!empty($conf->banque->enabled) && empty($conf->global->BANK_USE_OLD_VARIOUS_PAYMENT)) { - $langs->load("banks"); - $newmenu->add("/compta/bank/various_payment/list.php?leftmenu=tax_various&mainmenu=billing", $langs->trans("MenuVariousPayment"), 0, $user->rights->banque->lire, '', $mainmenu, 'tax_various', 0, '', '', '', img_picto('', 'payment', 'class="paddingright pictofixedwidth"')); - if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_various/i', $leftmenu)) { - $newmenu->add("/compta/bank/various_payment/card.php?leftmenu=tax_various&action=create", $langs->trans("New"), 1, $user->rights->banque->modifier); - $newmenu->add("/compta/bank/various_payment/list.php?leftmenu=tax_various", $langs->trans("List"), 1, $user->rights->banque->lire); - } - } + get_left_menu_billing($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user); } /* * Menu COMPTA-FINANCIAL */ if ($mainmenu == 'accountancy') { - $langs->load("companies"); - - // Accounting (Double entries) - if (!empty($conf->accounting->enabled)) { - //$permtoshowmenu = (!empty($conf->accounting->enabled) || $user->rights->accounting->bind->write || $user->rights->compta->resultat->lire); - //$newmenu->add("/accountancy/index.php?leftmenu=accountancy", $langs->trans("MenuAccountancy"), 0, $permtoshowmenu, '', $mainmenu, 'accountancy'); - - // Configuration - $newmenu->add("/accountancy/index.php?leftmenu=accountancy_admin", $langs->trans("Setup"), 0, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin', 1, '', '', '', img_picto('', 'technic', 'class="paddingright pictofixedwidth"')); - if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/', $leftmenu)) { - $newmenu->add("/accountancy/admin/index.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("General"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_general', 10); - - // Fiscal year - Not really yet used. In a future will lock some periods. - if ($conf->global->MAIN_FEATURES_LEVEL > 1) { - $newmenu->add("/accountancy/admin/fiscalyear.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("FiscalPeriod"), 1, $user->rights->accounting->fiscalyear->write, '', $mainmenu, 'fiscalyear', 20); - } - - $newmenu->add("/accountancy/admin/journals_list.php?id=35&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("AccountingJournals"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_journal', 30); - $newmenu->add("/accountancy/admin/accountmodel.php?id=31&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("Pcg_version"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_chartmodel', 40); - $newmenu->add("/accountancy/admin/account.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("Chartofaccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_chart', 41); - $newmenu->add("/accountancy/admin/subaccount.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("ChartOfSubaccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_chart', 41); - $newmenu->add("/accountancy/admin/categories_list.php?id=32&search_country_id=".$mysoc->country_id."&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("AccountingCategory"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_chart', 50); - $newmenu->add("/accountancy/admin/defaultaccounts.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuDefaultAccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 60); - if (!empty($conf->banque->enabled)) { - $newmenu->add("/compta/bank/list.php?mainmenu=accountancy&leftmenu=accountancy_admin&search_status=-1", $langs->trans("MenuBankAccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_bank', 70); - } - if (!empty($conf->facture->enabled) || ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_invoice->enabled))) { - $newmenu->add("/admin/dict.php?id=10&from=accountancy&search_country_id=".$mysoc->country_id."&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuVatAccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 80); - } - if (!empty($conf->tax->enabled)) { - $newmenu->add("/admin/dict.php?id=7&from=accountancy&search_country_id=".$mysoc->country_id."&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuTaxAccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 90); - } - if (!empty($conf->expensereport->enabled)) { - $newmenu->add("/admin/dict.php?id=17&from=accountancy&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuExpenseReportAccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 100); - } - $newmenu->add("/accountancy/admin/productaccount.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuProductsAccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_product', 110); - if ($conf->global->MAIN_FEATURES_LEVEL > 1) { - $newmenu->add("/accountancy/admin/closure.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuClosureAccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_closure', 120); - } - $newmenu->add("/accountancy/admin/export.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("ExportOptions"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_export', 130); - } - - // Transfer in accounting - $newmenu->add("/accountancy/index.php?leftmenu=accountancy_transfer", $langs->trans("TransferInAccounting"), 0, $user->rights->accounting->bind->write, '', $mainmenu, 'transfer', 1, '', '', '', img_picto('', 'long-arrow-alt-right', 'class="paddingright pictofixedwidth"')); - - // Binding - // $newmenu->add("", $langs->trans("Binding"), 0, $user->rights->accounting->bind->write, '', $mainmenu, 'dispatch'); - if (!empty($conf->facture->enabled) && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_SALES)) { - $newmenu->add("/accountancy/customer/index.php?leftmenu=accountancy_dispatch_customer&mainmenu=accountancy", $langs->trans("CustomersVentilation"), 1, $user->rights->accounting->bind->write, '', $mainmenu, 'dispatch_customer'); - if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_dispatch_customer/', $leftmenu)) { - $newmenu->add("/accountancy/customer/list.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_customer", $langs->trans("ToBind"), 2, $user->rights->accounting->bind->write); - $newmenu->add("/accountancy/customer/lines.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_customer", $langs->trans("Binded"), 2, $user->rights->accounting->bind->write); - } - } - if (!empty($conf->supplier_invoice->enabled) && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_PURCHASES)) { - $newmenu->add("/accountancy/supplier/index.php?leftmenu=accountancy_dispatch_supplier&mainmenu=accountancy", $langs->trans("SuppliersVentilation"), 1, $user->rights->accounting->bind->write, '', $mainmenu, 'dispatch_supplier'); - if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_dispatch_supplier/', $leftmenu)) { - $newmenu->add("/accountancy/supplier/list.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_supplier", $langs->trans("ToBind"), 2, $user->rights->accounting->bind->write); - $newmenu->add("/accountancy/supplier/lines.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_supplier", $langs->trans("Binded"), 2, $user->rights->accounting->bind->write); - } - } - if (!empty($conf->expensereport->enabled) && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS)) { - $newmenu->add("/accountancy/expensereport/index.php?leftmenu=accountancy_dispatch_expensereport&mainmenu=accountancy", $langs->trans("ExpenseReportsVentilation"), 1, $user->rights->accounting->bind->write, '', $mainmenu, 'dispatch_expensereport'); - if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_dispatch_expensereport/', $leftmenu)) { - $newmenu->add("/accountancy/expensereport/list.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_expensereport", $langs->trans("ToBind"), 2, $user->rights->accounting->bind->write); - $newmenu->add("/accountancy/expensereport/lines.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_expensereport", $langs->trans("Binded"), 2, $user->rights->accounting->bind->write); - } - } - - // Journals - if (!empty($conf->accounting->enabled) && !empty($user->rights->accounting->comptarapport->lire) && $mainmenu == 'accountancy') { - $newmenu->add('', $langs->trans("RegistrationInAccounting"), 1, $user->rights->accounting->comptarapport->lire, '', '', ''); - - // Multi journal - $sql = "SELECT rowid, code, label, nature"; - $sql .= " FROM ".MAIN_DB_PREFIX."accounting_journal"; - $sql .= " WHERE entity = ".$conf->entity; - $sql .= " AND active = 1"; - $sql .= " ORDER BY nature ASC, label DESC"; - - $resql = $db->query($sql); - if ($resql) { - $numr = $db->num_rows($resql); - $i = 0; - - if ($numr > 0) { - while ($i < $numr) { - $objp = $db->fetch_object($resql); - - $nature = ''; - - // Must match array $sourceList defined into journals_list.php - if ($objp->nature == 2 && !empty($conf->facture->enabled) && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_SALES)) { - $nature = "sells"; - } - if ($objp->nature == 3 - && ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_invoice->enabled)) - && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_PURCHASES)) { - $nature = "purchases"; - } - if ($objp->nature == 4 && !empty($conf->banque->enabled)) { - $nature = "bank"; - } - if ($objp->nature == 5 && !empty($conf->expensereport->enabled) && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS)) { - $nature = "expensereports"; - } - if ($objp->nature == 1) { - $nature = "various"; - } - if ($objp->nature == 8) { - $nature = "inventory"; - } - if ($objp->nature == 9) { - $nature = "hasnew"; - } - - // To enable when page exists - if (empty($conf->global->ACCOUNTANCY_SHOW_DEVELOP_JOURNAL)) { - if ($nature == 'hasnew' || $nature == 'inventory') { - $nature = ''; - } - } - - if ($nature) { - $langs->load('accountancy'); - $journallabel = $langs->transnoentities($objp->label); // Labels in this table are set by loading llx_accounting_abc.sql. Label can be 'ACCOUNTING_SELL_JOURNAL', 'InventoryJournal', ... - $newmenu->add('/accountancy/journal/'.$nature.'journal.php?mainmenu=accountancy&leftmenu=accountancy_journal&id_journal='.$objp->rowid, $journallabel, 2, $user->rights->accounting->comptarapport->lire); - } - $i++; - } - } else { - // Should not happend. Entries are added - $newmenu->add('', $langs->trans("NoJournalDefined"), 2, $user->rights->accounting->comptarapport->lire); - } - } else { - dol_print_error($db); - } - $db->free($resql); - } - - // Files - if (empty($conf->global->ACCOUNTANCY_HIDE_EXPORT_FILES_MENU)) { - $newmenu->add("/compta/accounting-files.php?mainmenu=accountancy&leftmenu=accountancy_files", $langs->trans("AccountantFiles"), 1, $user->rights->accounting->mouvements->lire); - } - - - // Accounting - $newmenu->add("/accountancy/index.php?leftmenu=accountancy_accountancy", $langs->trans("MenuAccountancy"), 0, $user->rights->accounting->mouvements->lire || $user->rights->accounting->comptarapport->lire, '', $mainmenu, 'accountancy', 1, '', '', '', img_picto('', 'accountancy', 'class="paddingright pictofixedwidth"')); - - // General Ledger - $newmenu->add("/accountancy/bookkeeping/listbyaccount.php?mainmenu=accountancy&leftmenu=accountancy_accountancy", $langs->trans("Bookkeeping"), 1, $user->rights->accounting->mouvements->lire); - - // Journals - $newmenu->add("/accountancy/bookkeeping/list.php?mainmenu=accountancy&leftmenu=accountancy_accountancy", $langs->trans("Journals"), 1, $user->rights->accounting->mouvements->lire); - - // Account Balance - $newmenu->add("/accountancy/bookkeeping/balance.php?mainmenu=accountancy&leftmenu=accountancy_accountancy", $langs->trans("AccountBalance"), 1, $user->rights->accounting->mouvements->lire); - - // Closure - $newmenu->add("/accountancy/closure/index.php?mainmenu=accountancy&leftmenu=accountancy_closure", $langs->trans("MenuAccountancyClosure"), 1, $user->rights->accounting->fiscalyear->write, '', $mainmenu, 'closure'); - - // Reports - $newmenu->add("/accountancy/index.php?leftmenu=accountancy_report", $langs->trans("Reportings"), 1, $user->rights->accounting->comptarapport->lire, '', $mainmenu, 'ca'); - - if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/', $leftmenu)) { - $newmenu->add("/compta/resultat/index.php?leftmenu=accountancy_report", $langs->trans("MenuReportInOut"), 2, $user->rights->accounting->comptarapport->lire); - $newmenu->add("/compta/resultat/clientfourn.php?leftmenu=accountancy_report", $langs->trans("ByPredefinedAccountGroups"), 3, $user->rights->accounting->comptarapport->lire); - $newmenu->add("/compta/resultat/result.php?leftmenu=accountancy_report", $langs->trans("ByPersonalizedAccountGroups"), 3, $user->rights->accounting->comptarapport->lire); - } - - $modecompta = 'CREANCES-DETTES'; - if (!empty($conf->accounting->enabled) && !empty($user->rights->accounting->comptarapport->lire) && $mainmenu == 'accountancy') { - $modecompta = 'BOOKKEEPING'; // Not yet implemented. Should be BOOKKEEPINGCOLLECTED - } - if ($modecompta) { - if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/', $leftmenu)) { - $newmenu->add("/compta/stats/index.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ReportTurnover"), 2, $user->rights->accounting->comptarapport->lire); - $newmenu->add("/compta/stats/casoc.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 3, $user->rights->accounting->comptarapport->lire); - $newmenu->add("/compta/stats/cabyuser.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByUsers"), 3, $user->rights->accounting->comptarapport->lire); - $newmenu->add("/compta/stats/cabyprodserv.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByProductsAndServices"), 3, $user->rights->accounting->comptarapport->lire); - $newmenu->add("/compta/stats/byratecountry.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByVatRate"), 3, $user->rights->accounting->comptarapport->lire); - } - } - - $modecompta = 'RECETTES-DEPENSES'; - //if (! empty($conf->accounting->enabled) && ! empty($user->rights->accounting->comptarapport->lire) && $mainmenu == 'accountancy') $modecompta=''; // Not yet implemented. Should be BOOKKEEPINGCOLLECTED - if ($modecompta) { - if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/', $leftmenu)) { - $newmenu->add("/compta/stats/index.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ReportTurnoverCollected"), 2, $user->rights->accounting->comptarapport->lire); - $newmenu->add("/compta/stats/casoc.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 3, $user->rights->accounting->comptarapport->lire); - $newmenu->add("/compta/stats/cabyuser.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByUsers"), 3, $user->rights->accounting->comptarapport->lire); - //$newmenu->add("/compta/stats/cabyprodserv.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByProductsAndServices"),3,$user->rights->accounting->comptarapport->lire); - //$newmenu->add("/compta/stats/byratecountry.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByVatRate"),3,$user->rights->accounting->comptarapport->lire); - } - } - - $modecompta = 'CREANCES-DETTES'; - if (!empty($conf->accounting->enabled) && !empty($user->rights->accounting->comptarapport->lire) && $mainmenu == 'accountancy') { - $modecompta = 'BOOKKEEPING'; // Not yet implemented. - } - if ($modecompta && ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_invoice->enabled))) { - if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/', $leftmenu)) { - $newmenu->add("/compta/stats/supplier_turnover.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ReportPurchaseTurnover"), 2, $user->rights->accounting->comptarapport->lire); - $newmenu->add("/compta/stats/supplier_turnover_by_thirdparty.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 3, $user->rights->accounting->comptarapport->lire); - $newmenu->add("/compta/stats/supplier_turnover_by_prodserv.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByProductsAndServices"), 3, $user->rights->accounting->comptarapport->lire); - } - } - - $modecompta = 'RECETTES-DEPENSES'; - if (!empty($conf->accounting->enabled) && !empty($user->rights->accounting->comptarapport->lire) && $mainmenu == 'accountancy') { - $modecompta = 'BOOKKEEPINGCOLLECTED'; // Not yet implemented. - } - if ($modecompta && ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_invoice->enabled))) { - if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/', $leftmenu)) { - $newmenu->add("/compta/stats/supplier_turnover.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ReportPurchaseTurnoverCollected"), 2, $user->rights->accounting->comptarapport->lire); - $newmenu->add("/compta/stats/supplier_turnover_by_thirdparty.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 3, $user->rights->accounting->comptarapport->lire); - } - } - } - - // Accountancy (simple) - if (!empty($conf->comptabilite->enabled)) { - // Files - if (empty($conf->global->ACCOUNTANCY_HIDE_EXPORT_FILES_MENU)) { - $newmenu->add("/compta/accounting-files.php?mainmenu=accountancy&leftmenu=accountancy_files", $langs->trans("AccountantFiles"), 0, $user->rights->compta->resultat->lire, '', $mainmenu, 'files'); - } - - // Bilan, resultats - $newmenu->add("/compta/resultat/index.php?leftmenu=report&mainmenu=accountancy", $langs->trans("Reportings"), 0, $user->rights->compta->resultat->lire, '', $mainmenu, 'ca'); - - if ($usemenuhider || empty($leftmenu) || preg_match('/report/', $leftmenu)) { - $newmenu->add("/compta/resultat/index.php?leftmenu=report", $langs->trans("MenuReportInOut"), 1, $user->rights->compta->resultat->lire); - $newmenu->add("/compta/resultat/clientfourn.php?leftmenu=report", $langs->trans("ByCompanies"), 2, $user->rights->compta->resultat->lire); - /* On verra ca avec module compabilite expert - $newmenu->add("/compta/resultat/compteres.php?leftmenu=report","Compte de resultat",2,$user->rights->compta->resultat->lire); - $newmenu->add("/compta/resultat/bilan.php?leftmenu=report","Bilan",2,$user->rights->compta->resultat->lire); - */ - - /* - $newmenu->add("/compta/stats/cumul.php?leftmenu=report","Cumule",2,$user->rights->compta->resultat->lire); - if (! empty($conf->propal->enabled)) { - $newmenu->add("/compta/stats/prev.php?leftmenu=report","Previsionnel",2,$user->rights->compta->resultat->lire); - $newmenu->add("/compta/stats/comp.php?leftmenu=report","Transforme",2,$user->rights->compta->resultat->lire); - } - */ - - $modecompta = 'CREANCES-DETTES'; - $newmenu->add("/compta/stats/index.php?leftmenu=report&modecompta=".$modecompta, $langs->trans("ReportTurnover"), 1, $user->rights->compta->resultat->lire); - $newmenu->add("/compta/stats/casoc.php?leftmenu=report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 2, $user->rights->compta->resultat->lire); - $newmenu->add("/compta/stats/cabyuser.php?leftmenu=report&modecompta=".$modecompta, $langs->trans("ByUsers"), 2, $user->rights->compta->resultat->lire); - $newmenu->add("/compta/stats/cabyprodserv.php?leftmenu=report&modecompta=".$modecompta, $langs->trans("ByProductsAndServices"), 2, $user->rights->compta->resultat->lire); - $newmenu->add("/compta/stats/byratecountry.php?leftmenu=report&modecompta=".$modecompta, $langs->trans("ByVatRate"), 2, $user->rights->compta->resultat->lire); - - $modecompta = 'RECETTES-DEPENSES'; - $newmenu->add("/compta/stats/index.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ReportTurnoverCollected"), 1, $user->rights->compta->resultat->lire); - $newmenu->add("/compta/stats/casoc.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 2, $user->rights->compta->resultat->lire); - $newmenu->add("/compta/stats/cabyuser.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByUsers"), 2, $user->rights->compta->resultat->lire); - - //Achats - $modecompta = 'CREANCES-DETTES'; - $newmenu->add("/compta/stats/supplier_turnover.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ReportPurchaseTurnover"), 1, $user->rights->compta->resultat->lire); - $newmenu->add("/compta/stats/supplier_turnover_by_thirdparty.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 2, $user->rights->compta->resultat->lire); - $newmenu->add("/compta/stats/supplier_turnover_by_prodserv.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByProductsAndServices"), 2, $user->rights->compta->resultat->lire); - - /* - $modecompta = 'RECETTES-DEPENSES'; - $newmenu->add("/compta/stats/index.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ReportPurchaseTurnoverCollected"), 1, $user->rights->compta->resultat->lire); - $newmenu->add("/compta/stats/casoc.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 2, $user->rights->compta->resultat->lire); - $newmenu->add("/compta/stats/cabyuser.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByUsers"), 2, $user->rights->compta->resultat->lire); - */ - - // Journals - $newmenu->add("/compta/journal/sellsjournal.php?leftmenu=report", $langs->trans("SellsJournal"), 1, $user->rights->compta->resultat->lire, '', '', '', 50); - $newmenu->add("/compta/journal/purchasesjournal.php?leftmenu=report", $langs->trans("PurchasesJournal"), 1, $user->rights->compta->resultat->lire, '', '', '', 51); - } - //if ($leftmenu=="ca") $newmenu->add("/compta/journaux/index.php?leftmenu=ca",$langs->trans("Journals"),1,$user->rights->compta->resultat->lire||$user->rights->accounting->comptarapport->lire); - } - - // Intracomm report - if (!empty($conf->intracommreport->enabled)) { - $newmenu->add("/intracommreport/list.php?leftmenu=intracommreport", $langs->trans("MenuIntracommReport"), 0, $user->rights->intracommreport->read, '', $mainmenu, 'intracommreport', 60, '', '', '', img_picto('', 'intracommreport', 'class="paddingright pictofixedwidth"')); - if ($usemenuhider || empty($leftmenu) || preg_match('/intracommreport/', $leftmenu)) { - // DEB / DES - $newmenu->add("/intracommreport/card.php?action=create&leftmenu=intracommreport", $langs->trans("MenuIntracommReportNew"), 1, $user->rights->intracommreport->write, '', $mainmenu, 'intracommreport', 1); - $newmenu->add("/intracommreport/list.php?leftmenu=intracommreport", $langs->trans("MenuIntracommReportList"), 1, $user->rights->intracommreport->read, '', $mainmenu, 'intracommreport', 1); - } - } - - // Assets - if (!empty($conf->asset->enabled)) { - $newmenu->add("/asset/list.php?leftmenu=asset&mainmenu=accountancy", $langs->trans("MenuAssets"), 0, $user->rights->asset->read, '', $mainmenu, 'asset', 100, '', '', '', img_picto('', 'payment', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/asset/card.php?leftmenu=asset&action=create", $langs->trans("MenuNewAsset"), 1, $user->rights->asset->write); - $newmenu->add("/asset/list.php?leftmenu=asset&mainmenu=accountancy", $langs->trans("MenuListAssets"), 1, $user->rights->asset->read); - $newmenu->add("/asset/model/list.php?leftmenu=asset_model", $langs->trans("MenuAssetModels"), 1, (empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->read) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->setup_advance->read)), '', $mainmenu, 'asset_model'); - if ($usemenuhider || empty($leftmenu) || preg_match('/asset_model/', $leftmenu)) { - $newmenu->add("/asset/model/card.php?leftmenu=asset_model&action=create", $langs->trans("MenuNewAssetModel"), 2, (empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->write) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->setup_advance->write))); - $newmenu->add("/asset/model/list.php?leftmenu=asset_model", $langs->trans("MenuListAssetModels"), 2, (empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->read) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->setup_advance->read))); - } - } + get_left_menu_accountancy($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user, $db); } - /* * Menu BANK */ if ($mainmenu == 'bank') { - // Load translation files required by the page - $langs->loadLangs(array("withdrawals", "banks", "bills", "categories")); - - // Bank-Cash account - if (!empty($conf->banque->enabled)) { - $newmenu->add("/compta/bank/list.php?leftmenu=bank&mainmenu=bank", $langs->trans("MenuBankCash"), 0, $user->rights->banque->lire, '', $mainmenu, 'bank', 0, '', '', '', img_picto('', 'bank_account', 'class="paddingright pictofixedwidth"')); - - $newmenu->add("/compta/bank/card.php?action=create", $langs->trans("MenuNewFinancialAccount"), 1, $user->rights->banque->configurer); - $newmenu->add("/compta/bank/list.php?leftmenu=bank&mainmenu=bank", $langs->trans("List"), 1, $user->rights->banque->lire, '', $mainmenu, 'bank'); - $newmenu->add("/compta/bank/bankentries_list.php", $langs->trans("ListTransactions"), 1, $user->rights->banque->lire); - $newmenu->add("/compta/bank/budget.php", $langs->trans("ListTransactionsByCategory"), 1, $user->rights->banque->lire); - - $newmenu->add("/compta/bank/transfer.php", $langs->trans("MenuBankInternalTransfer"), 1, $user->rights->banque->transfer); - } - - if (!empty($conf->categorie->enabled)) { - $langs->load("categories"); - $newmenu->add("/categories/index.php?type=5", $langs->trans("Rubriques"), 1, $user->rights->categorie->creer, '', $mainmenu, 'tags'); - $newmenu->add("/compta/bank/categ.php", $langs->trans("RubriquesTransactions"), 1, $user->rights->banque->configurer, '', $mainmenu, 'tags'); - } - - // Direct debit order - if (!empty($conf->prelevement->enabled)) { - $newmenu->add("/compta/prelevement/index.php?leftmenu=withdraw&mainmenu=bank", $langs->trans("PaymentByDirectDebit"), 0, $user->rights->prelevement->bons->lire, '', $mainmenu, 'withdraw', 0, '', '', '', img_picto('', 'payment', 'class="paddingright pictofixedwidth"')); - - if ($usemenuhider || empty($leftmenu) || $leftmenu == "withdraw") { - $newmenu->add("/compta/prelevement/create.php?mainmenu=bank", $langs->trans("NewStandingOrder"), 1, $user->rights->prelevement->bons->creer); - - $newmenu->add("/compta/prelevement/orders_list.php?mainmenu=bank", $langs->trans("WithdrawalsReceipts"), 1, $user->rights->prelevement->bons->lire); - $newmenu->add("/compta/prelevement/list.php?mainmenu=bank", $langs->trans("WithdrawalsLines"), 1, $user->rights->prelevement->bons->lire); - $newmenu->add("/compta/prelevement/rejets.php?mainmenu=bank", $langs->trans("Rejects"), 1, $user->rights->prelevement->bons->lire); - $newmenu->add("/compta/prelevement/stats.php?mainmenu=bank", $langs->trans("Statistics"), 1, $user->rights->prelevement->bons->lire); - } - } - - // Bank transfer order - if (!empty($conf->paymentbybanktransfer->enabled)) { - $newmenu->add("/compta/paymentbybanktransfer/index.php?leftmenu=banktransfer&mainmenu=bank", $langs->trans("PaymentByBankTransfer"), 0, $user->rights->paymentbybanktransfer->read, '', $mainmenu, 'banktransfer', 0, '', '', '', img_picto('', 'payment', 'class="paddingright pictofixedwidth"')); - - if ($usemenuhider || empty($leftmenu) || $leftmenu == "banktransfer") { - $newmenu->add("/compta/prelevement/create.php?type=bank-transfer&mainmenu=bank", $langs->trans("NewPaymentByBankTransfer"), 1, $user->rights->paymentbybanktransfer->create); - - $newmenu->add("/compta/prelevement/orders_list.php?type=bank-transfer&mainmenu=bank", $langs->trans("PaymentByBankTransferReceipts"), 1, $user->rights->paymentbybanktransfer->read); - $newmenu->add("/compta/prelevement/list.php?type=bank-transfer&mainmenu=bank", $langs->trans("PaymentByBankTransferLines"), 1, $user->rights->paymentbybanktransfer->read); - $newmenu->add("/compta/prelevement/rejets.php?type=bank-transfer&mainmenu=bank", $langs->trans("Rejects"), 1, $user->rights->paymentbybanktransfer->read); - $newmenu->add("/compta/prelevement/stats.php?type=bank-transfer&mainmenu=bank", $langs->trans("Statistics"), 1, $user->rights->paymentbybanktransfer->read); - } - } - - // Management of checks - if (empty($conf->global->BANK_DISABLE_CHECK_DEPOSIT) && !empty($conf->banque->enabled) && (!empty($conf->facture->enabled) || !empty($conf->global->MAIN_MENU_CHEQUE_DEPOSIT_ON))) { - $newmenu->add("/compta/paiement/cheque/index.php?leftmenu=checks&mainmenu=bank", $langs->trans("MenuChequeDeposits"), 0, $user->rights->banque->cheque, '', $mainmenu, 'checks', 0, '', '', '', img_picto('', 'payment', 'class="paddingright pictofixedwidth"')); - if (preg_match('/checks/', $leftmenu)) { - $newmenu->add("/compta/paiement/cheque/card.php?leftmenu=checks_bis&action=new&mainmenu=bank", $langs->trans("NewChequeDeposit"), 1, $user->rights->banque->cheque); - $newmenu->add("/compta/paiement/cheque/list.php?leftmenu=checks_bis&mainmenu=bank", $langs->trans("List"), 1, $user->rights->banque->cheque); - } - } - - // Cash Control - if (!empty($conf->takepos->enabled) || !empty($conf->cashdesk->enabled)) { - $permtomakecashfence = ($user->hasRight('cashdesk', 'run')|| $user->hasRight('takepos', 'run')); - $newmenu->add("/compta/cashcontrol/cashcontrol_list.php?action=list", $langs->trans("POS"), 0, $permtomakecashfence, '', $mainmenu, 'cashcontrol', 0, '', '', '', img_picto('', 'pos', 'class="pictofixedwidth"')); - $newmenu->add("/compta/cashcontrol/cashcontrol_card.php?action=create", $langs->trans("NewCashFence"), 1, $permtomakecashfence); - $newmenu->add("/compta/cashcontrol/cashcontrol_list.php?action=list", $langs->trans("List"), 1, $permtomakecashfence); - } + get_left_menu_bank($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user); } /* * Menu PRODUCTS-SERVICES */ if ($mainmenu == 'products') { - // Products - if (!empty($conf->product->enabled)) { - $newmenu->add("/product/index.php?leftmenu=product&type=0", $langs->trans("Products"), 0, $user->rights->produit->lire, '', $mainmenu, 'product', 0, '', '', '', img_picto('', 'product', 'class="pictofixedwidth"')); - $newmenu->add("/product/card.php?leftmenu=product&action=create&type=0", $langs->trans("NewProduct"), 1, $user->rights->produit->creer); - $newmenu->add("/product/list.php?leftmenu=product&type=0", $langs->trans("List"), 1, $user->rights->produit->lire); - if (!empty($conf->stock->enabled)) { - $newmenu->add("/product/reassort.php?type=0", $langs->trans("MenuStocks"), 1, $user->rights->produit->lire && $user->rights->stock->lire); - } - if (!empty($conf->productbatch->enabled)) { - $langs->load("stocks"); - $newmenu->add("/product/reassortlot.php?type=0", $langs->trans("StocksByLotSerial"), 1, $user->rights->produit->lire && $user->rights->stock->lire); - $newmenu->add("/product/stock/productlot_list.php", $langs->trans("LotSerial"), 1, $user->rights->produit->lire && $user->rights->stock->lire); - } - if (!empty($conf->variants->enabled)) { - $newmenu->add("/variants/list.php", $langs->trans("VariantAttributes"), 1, $user->rights->produit->lire); - } - if (!empty($conf->propal->enabled) || (!empty($conf->commande->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->facture->enabled) || !empty($conf->fournisseur->enabled) || !empty($conf->supplier_proposal->enabled) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) { - $newmenu->add("/product/stats/card.php?id=all&leftmenu=stats&type=0", $langs->trans("Statistics"), 1, $user->rights->produit->lire && $user->rights->propale->lire); - } - - // Categories - if (!empty($conf->categorie->enabled)) { - $langs->load("categories"); - $newmenu->add("/categories/index.php?leftmenu=cat&type=0", $langs->trans("Categories"), 1, $user->rights->categorie->lire, '', $mainmenu, 'cat'); - //if ($usemenuhider || empty($leftmenu) || $leftmenu=="cat") $newmenu->add("/categories/list.php", $langs->trans("List"), 1, $user->rights->categorie->lire); - } - } - - // Services - if (!empty($conf->service->enabled)) { - $newmenu->add("/product/index.php?leftmenu=service&type=1", $langs->trans("Services"), 0, $user->rights->service->lire, '', $mainmenu, 'service', 0, '', '', '', img_picto('', 'service', 'class="pictofixedwidth"')); - $newmenu->add("/product/card.php?leftmenu=service&action=create&type=1", $langs->trans("NewService"), 1, $user->rights->service->creer); - $newmenu->add("/product/list.php?leftmenu=service&type=1", $langs->trans("List"), 1, $user->rights->service->lire); - if (!empty($conf->propal->enabled) || !empty($conf->commande->enabled) || !empty($conf->facture->enabled) || (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_proposal->enabled) || !empty($conf->supplier_oder->enabled) || !empty($conf->supplier_invoice->enabled)) { - $newmenu->add("/product/stats/card.php?id=all&leftmenu=stats&type=1", $langs->trans("Statistics"), 1, $user->rights->service->lire || $user->rights->product->lire); - } - // Categories - if (!empty($conf->categorie->enabled)) { - $langs->load("categories"); - $newmenu->add("/categories/index.php?leftmenu=cat&type=0", $langs->trans("Categories"), 1, $user->rights->categorie->lire, '', $mainmenu, 'cat'); - //if ($usemenuhider || empty($leftmenu) || $leftmenu=="cat") $newmenu->add("/categories/list.php", $langs->trans("List"), 1, $user->rights->categorie->lire); - } - } - - // Warehouse - if (!empty($conf->stock->enabled)) { - $langs->load("stocks"); - $newmenu->add("/product/stock/index.php?leftmenu=stock", $langs->trans("Warehouses"), 0, $user->rights->stock->lire, '', $mainmenu, 'stock', 0, '', '', '', img_picto('', 'stock', 'class="pictofixedwidth"')); - $newmenu->add("/product/stock/card.php?action=create", $langs->trans("MenuNewWarehouse"), 1, $user->rights->stock->creer); - $newmenu->add("/product/stock/list.php", $langs->trans("List"), 1, $user->rights->stock->lire); - $newmenu->add("/product/stock/movement_list.php", $langs->trans("Movements"), 1, $user->rights->stock->mouvement->lire); - - $newmenu->add("/product/stock/massstockmove.php", $langs->trans("MassStockTransferShort"), 1, $user->rights->stock->mouvement->creer); - if ($conf->supplier_order->enabled) { - $newmenu->add("/product/stock/replenish.php", $langs->trans("Replenishment"), 1, $user->rights->stock->mouvement->creer && $user->rights->fournisseur->lire); - } - $newmenu->add("/product/stock/stockatdate.php", $langs->trans("StockAtDate"), 1, $user->rights->produit->lire && $user->rights->stock->lire); - - // Categories for warehouses - if (!empty($conf->categorie->enabled)) { - $newmenu->add("/categories/index.php?leftmenu=stock&type=9", $langs->trans("Categories"), 1, $user->rights->categorie->lire, '', $mainmenu, 'cat'); - } - } - - // Inventory - if (!empty($conf->stock->enabled)) { - $langs->load("stocks"); - if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) { - $newmenu->add("/product/inventory/list.php?leftmenu=stock_inventories", $langs->trans("Inventories"), 0, $user->rights->stock->lire, '', $mainmenu, 'stock', 0, '', '', '', img_picto('', 'inventory', 'class="pictofixedwidth"')); - if ($usemenuhider || empty($leftmenu) || $leftmenu == "stock_inventories") { - $newmenu->add("/product/inventory/card.php?action=create&leftmenu=stock_inventories", $langs->trans("NewInventory"), 1, $user->rights->stock->creer); - $newmenu->add("/product/inventory/list.php?leftmenu=stock_inventories", $langs->trans("List"), 1, $user->rights->stock->lire); - } - } else { - $newmenu->add("/product/inventory/list.php?leftmenu=stock_inventories", $langs->trans("Inventories"), 0, $user->rights->stock->inventory_advance->read, '', $mainmenu, 'stock', 0, '', '', '', img_picto('', 'inventory', 'class="pictofixedwidth"')); - if ($usemenuhider || empty($leftmenu) || $leftmenu == "stock_inventories") { - $newmenu->add("/product/inventory/card.php?action=create&leftmenu=stock_inventories", $langs->trans("NewInventory"), 1, $user->rights->stock->inventory_advance->write); - $newmenu->add("/product/inventory/list.php?leftmenu=stock_inventories", $langs->trans("List"), 1, $user->rights->stock->inventory_advance->read); - } - } - } - - // Shipments - if (!empty($conf->expedition->enabled)) { - $langs->load("sendings"); - $newmenu->add("/expedition/index.php?leftmenu=sendings", $langs->trans("Shipments"), 0, $user->rights->expedition->lire, '', $mainmenu, 'sendings', 0, '', '', '', img_picto('', 'shipment', 'class="pictofixedwidth"')); - $newmenu->add("/expedition/card.php?action=create2&leftmenu=sendings", $langs->trans("NewSending"), 1, $user->rights->expedition->creer); - $newmenu->add("/expedition/list.php?leftmenu=sendings", $langs->trans("List"), 1, $user->rights->expedition->lire); - if ($usemenuhider || empty($leftmenu) || $leftmenu == "sendings") { - $newmenu->add("/expedition/list.php?leftmenu=sendings&search_status=0", $langs->trans("StatusSendingDraftShort"), 2, $user->rights->expedition->lire); - $newmenu->add("/expedition/list.php?leftmenu=sendings&search_status=1", $langs->trans("StatusSendingValidatedShort"), 2, $user->rights->expedition->lire); - $newmenu->add("/expedition/list.php?leftmenu=sendings&search_status=2", $langs->trans("StatusSendingProcessedShort"), 2, $user->rights->expedition->lire); - } - $newmenu->add("/expedition/stats/index.php?leftmenu=sendings", $langs->trans("Statistics"), 1, $user->rights->expedition->lire); - } - - // Receptions - if (!empty($conf->reception->enabled)) { - $langs->load("receptions"); - $newmenu->add("/reception/index.php?leftmenu=receptions", $langs->trans("Receptions"), 0, $user->rights->reception->lire, '', $mainmenu, 'receptions', 0, '', '', '', img_picto('', 'dollyrevert', 'class="pictofixedwidth"')); - $newmenu->add("/reception/card.php?action=create2&leftmenu=receptions", $langs->trans("NewReception"), 1, $user->rights->reception->creer); - $newmenu->add("/reception/list.php?leftmenu=receptions", $langs->trans("List"), 1, $user->rights->reception->lire); - if ($usemenuhider || empty($leftmenu) || $leftmenu == "receptions") { - $newmenu->add("/reception/list.php?leftmenu=receptions&search_status=0", $langs->trans("StatusReceptionDraftShort"), 2, $user->rights->reception->lire); - } - if ($usemenuhider || empty($leftmenu) || $leftmenu == "receptions") { - $newmenu->add("/reception/list.php?leftmenu=receptions&search_status=1", $langs->trans("StatusReceptionValidatedShort"), 2, $user->rights->reception->lire); - } - if ($usemenuhider || empty($leftmenu) || $leftmenu == "receptions") { - $newmenu->add("/reception/list.php?leftmenu=receptions&search_status=2", $langs->trans("StatusReceptionProcessedShort"), 2, $user->rights->reception->lire); - } - $newmenu->add("/reception/stats/index.php?leftmenu=receptions", $langs->trans("Statistics"), 1, $user->rights->reception->lire); - } + get_left_menu_products($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user); } /* * Menu PRODUCTS-SERVICES MRP - GPAO */ if ($mainmenu == 'mrp') { - // BOM - if (!empty($conf->bom->enabled) || !empty($conf->mrp->enabled)) { - $langs->load("mrp"); - - $newmenu->add("", $langs->trans("MenuBOM"), 0, $user->rights->bom->read, '', $mainmenu, 'bom', 0, '', '', '', img_picto('', 'bom', 'class="paddingrightonly pictofixedwidth"')); - $newmenu->add("/bom/bom_card.php?leftmenu=bom&action=create", $langs->trans("NewBOM"), 1, $user->rights->bom->write, '', $mainmenu, 'bom'); - $newmenu->add("/bom/bom_list.php?leftmenu=bom", $langs->trans("List"), 1, $user->rights->bom->read, '', $mainmenu, 'bom'); - } - - if (!empty($conf->mrp->enabled)) { - $langs->load("mrp"); - - $newmenu->add("", $langs->trans("MenuMRP"), 0, $user->rights->mrp->read, '', $mainmenu, 'mo', 0, '', '', '', img_picto('', 'mrp', 'class="paddingrightonly pictofixedwidth"')); - $newmenu->add("/mrp/mo_card.php?leftmenu=mo&action=create", $langs->trans("NewMO"), 1, $user->rights->mrp->write, '', $mainmenu, 'mo'); - $newmenu->add("/mrp/mo_list.php?leftmenu=mo", $langs->trans("List"), 1, $user->rights->mrp->read, '', $mainmenu, 'mo'); - } + get_left_menu_mrp($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user); } /* * Menu PROJECTS */ if ($mainmenu == 'project') { - if (!empty($conf->projet->enabled)) { - $langs->load("projects"); - - $search_project_user = GETPOST('search_project_user', 'int'); - - $tmpentry = array( - 'enabled'=>(!empty($conf->projet->enabled)), - 'perms'=>(!empty($user->rights->projet->lire)), - 'module'=>'projet' - ); - $showmode = isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal); - - $titleboth = $langs->trans("LeadsOrProjects"); - $titlenew = $langs->trans("NewLeadOrProject"); // Leads and opportunities by default - if (empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { - $titleboth = $langs->trans("Projects"); - $titlenew = $langs->trans("NewProject"); - } - if (isset($conf->global->PROJECT_USE_OPPORTUNITIES) && $conf->global->PROJECT_USE_OPPORTUNITIES == 2) { // 2 = leads only - $titleboth = $langs->trans("Leads"); - $titlenew = $langs->trans("NewLead"); - } - - // Project assigned to user - $newmenu->add("/projet/index.php?leftmenu=projects".($search_project_user ? '&search_project_user='.$search_project_user : ''), $titleboth, 0, $user->rights->projet->lire, '', $mainmenu, 'projects', 0, '', '', '', img_picto('', 'project', 'class="pictofixedwidth"')); - $newmenu->add("/projet/card.php?leftmenu=projects&action=create".($search_project_user ? '&search_project_user='.$search_project_user : ''), $titlenew, 1, $user->rights->projet->creer); - - if (empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { - $newmenu->add("/projet/list.php?leftmenu=projets".($search_project_user ? '&search_project_user='.$search_project_user : '').'&search_status=99', $langs->trans("List"), 1, $showmode, '', 'project', 'list'); - } elseif (isset($conf->global->PROJECT_USE_OPPORTUNITIES) && $conf->global->PROJECT_USE_OPPORTUNITIES == 1) { - $newmenu->add("/projet/list.php?leftmenu=projets".($search_project_user ? '&search_project_user='.$search_project_user : ''), $langs->trans("List"), 1, $showmode, '', 'project', 'list'); - $newmenu->add('/projet/list.php?mainmenu=project&leftmenu=list&search_usage_opportunity=1&search_status=99&search_opp_status=openedopp&contextpage=lead', $langs->trans("ListOpenLeads"), 2, $showmode); - $newmenu->add('/projet/list.php?mainmenu=project&leftmenu=list&search_opp_status=notopenedopp&search_status=99&contextpage=project', $langs->trans("ListOpenProjects"), 2, $showmode); - } elseif (isset($conf->global->PROJECT_USE_OPPORTUNITIES) && $conf->global->PROJECT_USE_OPPORTUNITIES == 2) { // 2 = leads only - $newmenu->add('/projet/list.php?mainmenu=project&leftmenu=list&search_usage_opportunity=1&search_status=99', $langs->trans("List"), 2, $showmode); - } - - $newmenu->add("/projet/stats/index.php?leftmenu=projects", $langs->trans("Statistics"), 1, $user->rights->projet->lire); - - // Categories - if (!empty($conf->categorie->enabled)) { - $langs->load("categories"); - $newmenu->add("/categories/index.php?leftmenu=cat&type=6", $langs->trans("Categories"), 1, $user->rights->categorie->lire, '', $mainmenu, 'cat'); - } - - if (empty($conf->global->PROJECT_HIDE_TASKS)) { - // Project affected to user - $newmenu->add("/projet/activity/index.php?leftmenu=tasks".($search_project_user ? '&search_project_user='.$search_project_user : ''), $langs->trans("Activities"), 0, $user->rights->projet->lire, '', 'project', 'tasks', 0, '', '', '', img_picto('', 'projecttask', 'class="pictofixedwidth"')); - $newmenu->add("/projet/tasks.php?leftmenu=tasks&action=create", $langs->trans("NewTask"), 1, $user->rights->projet->creer); - $newmenu->add("/projet/tasks/list.php?leftmenu=tasks".($search_project_user ? '&search_project_user='.$search_project_user : ''), $langs->trans("List"), 1, $user->rights->projet->lire); - $newmenu->add("/projet/tasks/stats/index.php?leftmenu=projects", $langs->trans("Statistics"), 1, $user->rights->projet->lire); - - $newmenu->add("/projet/activity/perweek.php?leftmenu=tasks".($search_project_user ? '&search_project_user='.$search_project_user : ''), $langs->trans("NewTimeSpent"), 0, $user->rights->projet->lire, '', 'project', 'timespent', 0, '', '', '', img_picto('', 'timespent', 'class="pictofixedwidth"')); - } - } + get_left_menu_projects($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user); } /* * Menu HRM */ if ($mainmenu == 'hrm') { - // HRM module - if (!empty($conf->hrm->enabled)) { - $langs->load("hrm"); - - $newmenu->add("/user/list.php?mainmenu=hrm&leftmenu=hrm&mode=employee", $langs->trans("Employees"), 0, $user->rights->user->user->lire, '', $mainmenu, 'hrm', 0, '', '', '', img_picto('', 'user', 'class="pictofixedwidth"')); - $newmenu->add("/user/card.php?mainmenu=hrm&leftmenu=hrm&action=create&employee=1", $langs->trans("NewEmployee"), 1, $user->rights->user->user->creer); - $newmenu->add("/user/list.php?mainmenu=hrm&leftmenu=hrm&mode=employee&contextpage=employeelist", $langs->trans("List"), 1, $user->rights->user->user->lire); - - $newmenu->add("/hrm/index.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("SkillsManagement"), 0, $user->rights->hrm->all->read, '', $mainmenu, 'hrm_sm', 0, '', '', '', img_picto('', 'user', 'class="pictofixedwidth"')); - - if ($usemenuhider || empty($leftmenu) || $leftmenu == "hrm_sm") { - // Skills - $newmenu->add("/hrm/skill_list.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("Skills"), 1, $user->rights->hrm->all->read, '', $mainmenu, 'hrm_sm', 0, '', '', '', img_picto('', 'shapes', 'class="pictofixedwidth"')); - //$newmenu->add("/hrm/skill_card.php?mainmenu=hrm&leftmenu=hrm_sm&action=create", $langs->trans("NewSkill"), 1, $user->rights->hrm->all->write); - //$newmenu->add("/hrm/skill_list.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("List"), 1, $user->rights->hrm->all->read); - - // Job (Description of work to do and skills required) - $newmenu->add("/hrm/job_list.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("JobsPosition"), 1, $user->rights->hrm->all->read, '', $mainmenu, 'hrm_sm', 0, '', '', '', img_picto('', 'technic', 'class="pictofixedwidth"')); - //$newmenu->add("/hrm/job_card.php?mainmenu=hrm&leftmenu=hrm_sm&action=create", $langs->transnoentities("NewObject", $langs->trans("Job")), 1, $user->rights->hrm->all->write); - //$newmenu->add("/hrm/job_list.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("List"), 1, $user->rights->hrm->all->read); - - // Position = Link job - user - $newmenu->add("/hrm/position_list.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("EmployeePositions"), 1, $user->rights->hrm->all->read, '', $mainmenu, 'hrm_sm', 0, '', '', '', img_picto('', 'user-cog', 'class="pictofixedwidth"')); - //$newmenu->add("/hrm/position.php?mainmenu=hrm&leftmenu=hrm_sm&action=create", $langs->transnoentities("NewObject", $langs->trans("Position")), 1, $user->rights->hrm->all->write); - //$newmenu->add("/hrm/position_list.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("List"), 1, $user->rights->hrm->all->read); - - // Evaluation - $newmenu->add("/hrm/evaluation_list.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("Evalutions"), 1, $user->rights->hrm->evaluation->read, '', $mainmenu, 'hrm_sm', 0, '', '', '', img_picto('', 'user', 'class="pictofixedwidth"')); - //$newmenu->add("/hrm/evaluation_card.php?mainmenu=hrm&leftmenu=hrm_sm&action=create", $langs->trans("NewEval"), 1, $user->rights->hrm->evaluation->write); - //$newmenu->add("/hrm/evaluation_list.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("List"), 1, $user->rights->hrm->evaluation->read); - $newmenu->add("/hrm/compare.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("SkillComparison"), 1, $user->rights->hrm->evaluation->read || $user->rights->hrm->compare_advance->read); - } - } - - // Leave/Holiday/Vacation module - if (!empty($conf->holiday->enabled)) { - // Load translation files required by the page - $langs->loadLangs(array("holiday", "trips")); - - $newmenu->add("/holiday/list.php?mainmenu=hrm&leftmenu=hrm", $langs->trans("CPTitreMenu"), 0, $user->rights->holiday->read, '', $mainmenu, 'hrm', 0, '', '', '', img_picto('', 'holiday', 'class="pictofixedwidth"')); - $newmenu->add("/holiday/card.php?mainmenu=hrm&leftmenu=holiday&action=create", $langs->trans("New"), 1, $user->rights->holiday->write); - $newmenu->add("/holiday/list.php?mainmenu=hrm&leftmenu=hrm", $langs->trans("List"), 1, $user->rights->holiday->read); - if ($usemenuhider || empty($leftmenu) || $leftmenu == "hrm") { - $newmenu->add("/holiday/list.php?search_status=1&mainmenu=hrm&leftmenu=hrm", $langs->trans("DraftCP"), 2, $user->rights->holiday->read); - $newmenu->add("/holiday/list.php?search_status=2&mainmenu=hrm&leftmenu=hrm", $langs->trans("ToReviewCP"), 2, $user->rights->holiday->read); - $newmenu->add("/holiday/list.php?search_status=3&mainmenu=hrm&leftmenu=hrm", $langs->trans("ApprovedCP"), 2, $user->rights->holiday->read); - $newmenu->add("/holiday/list.php?search_status=4&mainmenu=hrm&leftmenu=hrm", $langs->trans("CancelCP"), 2, $user->rights->holiday->read); - $newmenu->add("/holiday/list.php?search_status=5&mainmenu=hrm&leftmenu=hrm", $langs->trans("RefuseCP"), 2, $user->rights->holiday->read); - } - $newmenu->add("/holiday/define_holiday.php?mainmenu=hrm&action=request", $langs->trans("MenuConfCP"), 1, $user->rights->holiday->read); - $newmenu->add("/holiday/month_report.php?mainmenu=hrm&leftmenu=holiday", $langs->trans("MenuReportMonth"), 1, $user->rights->holiday->readall); - $newmenu->add("/holiday/view_log.php?mainmenu=hrm&leftmenu=holiday&action=request", $langs->trans("MenuLogCP"), 1, $user->rights->holiday->define_holiday); - } - - // Trips and expenses (old module) - if (!empty($conf->deplacement->enabled)) { - $langs->load("trips"); - $newmenu->add("/compta/deplacement/index.php?leftmenu=tripsandexpenses&mainmenu=hrm", $langs->trans("TripsAndExpenses"), 0, $user->rights->deplacement->lire, '', $mainmenu, 'tripsandexpenses', 0, '', '', '', img_picto('', 'trip', 'class="pictofixedwidth"')); - $newmenu->add("/compta/deplacement/card.php?action=create&leftmenu=tripsandexpenses&mainmenu=hrm", $langs->trans("New"), 1, $user->rights->deplacement->creer); - $newmenu->add("/compta/deplacement/list.php?leftmenu=tripsandexpenses&mainmenu=hrm", $langs->trans("List"), 1, $user->rights->deplacement->lire); - $newmenu->add("/compta/deplacement/stats/index.php?leftmenu=tripsandexpenses&mainmenu=hrm", $langs->trans("Statistics"), 1, $user->rights->deplacement->lire); - } - - // Expense report - if (!empty($conf->expensereport->enabled)) { - $langs->load("trips"); - $newmenu->add("/expensereport/index.php?leftmenu=expensereport&mainmenu=hrm", $langs->trans("TripsAndExpenses"), 0, $user->rights->expensereport->lire, '', $mainmenu, 'expensereport', 0, '', '', '', img_picto('', 'trip', 'class="pictofixedwidth"')); - $newmenu->add("/expensereport/card.php?action=create&leftmenu=expensereport&mainmenu=hrm", $langs->trans("New"), 1, $user->rights->expensereport->creer); - $newmenu->add("/expensereport/list.php?leftmenu=expensereport&mainmenu=hrm", $langs->trans("List"), 1, $user->rights->expensereport->lire); - if ($usemenuhider || empty($leftmenu) || $leftmenu == "expensereport") { - $newmenu->add("/expensereport/list.php?search_status=0&leftmenu=expensereport&mainmenu=hrm", $langs->trans("Draft"), 2, $user->rights->expensereport->lire); - $newmenu->add("/expensereport/list.php?search_status=2&leftmenu=expensereport&mainmenu=hrm", $langs->trans("Validated"), 2, $user->rights->expensereport->lire); - $newmenu->add("/expensereport/list.php?search_status=5&leftmenu=expensereport&mainmenu=hrm", $langs->trans("Approved"), 2, $user->rights->expensereport->lire); - $newmenu->add("/expensereport/list.php?search_status=6&leftmenu=expensereport&mainmenu=hrm", $langs->trans("Paid"), 2, $user->rights->expensereport->lire); - $newmenu->add("/expensereport/list.php?search_status=4&leftmenu=expensereport&mainmenu=hrm", $langs->trans("Canceled"), 2, $user->rights->expensereport->lire); - $newmenu->add("/expensereport/list.php?search_status=99&leftmenu=expensereport&mainmenu=hrm", $langs->trans("Refused"), 2, $user->rights->expensereport->lire); - } - $newmenu->add("/expensereport/stats/index.php?leftmenu=expensereport&mainmenu=hrm", $langs->trans("Statistics"), 1, $user->rights->expensereport->lire); - } - - if (!empty($conf->projet->enabled)) { - if (empty($conf->global->PROJECT_HIDE_TASKS)) { - $langs->load("projects"); - - $search_project_user = GETPOST('search_project_user', 'int'); - - $newmenu->add("/projet/activity/perweek.php?leftmenu=tasks".($search_project_user ? '&search_project_user='.$search_project_user : ''), $langs->trans("NewTimeSpent"), 0, $user->rights->projet->lire, '', $mainmenu, 'timespent', 0, '', '', '', img_picto('', 'timespent', 'class="pictofixedwidth"')); - } - } + get_left_menu_hrm($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user); } - /* * Menu TOOLS */ if ($mainmenu == 'tools') { - if (empty($user->socid)) { // limit to internal users - $langs->load("mails"); - $newmenu->add("/admin/mails_templates.php?leftmenu=email_templates", $langs->trans("EMailTemplates"), 0, 1, '', $mainmenu, 'email_templates', 0, '', '', '', img_picto('', 'email', 'class="paddingright pictofixedwidth"')); - } - - if (!empty($conf->mailing->enabled)) { - $newmenu->add("/comm/mailing/index.php?leftmenu=mailing", $langs->trans("EMailings"), 0, $user->rights->mailing->lire, '', $mainmenu, 'mailing', 0, '', '', '', img_picto('', 'email', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/comm/mailing/card.php?leftmenu=mailing&action=create", $langs->trans("NewMailing"), 1, $user->rights->mailing->creer); - $newmenu->add("/comm/mailing/list.php?leftmenu=mailing", $langs->trans("List"), 1, $user->rights->mailing->lire); - } - - if (!empty($conf->export->enabled)) { - $langs->load("exports"); - $newmenu->add("/exports/index.php?leftmenu=export", $langs->trans("FormatedExport"), 0, $user->rights->export->lire, '', $mainmenu, 'export', 0, '', '', '', img_picto('', 'technic', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/exports/export.php?leftmenu=export", $langs->trans("NewExport"), 1, $user->rights->export->creer); - //$newmenu->add("/exports/export.php?leftmenu=export",$langs->trans("List"),1, $user->rights->export->lire); - } - - if (!empty($conf->import->enabled)) { - $langs->load("exports"); - $newmenu->add("/imports/index.php?leftmenu=import", $langs->trans("FormatedImport"), 0, $user->rights->import->run, '', $mainmenu, 'import', 0, '', '', '', img_picto('', 'technic', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/imports/import.php?leftmenu=import", $langs->trans("NewImport"), 1, $user->rights->import->run); - } + get_left_menu_tools($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user); } /* * Menu MEMBERS */ if ($mainmenu == 'members') { - if (!empty($conf->adherent->enabled)) { - // Load translation files required by the page - $langs->loadLangs(array("members", "compta")); - - $newmenu->add("/adherents/index.php?leftmenu=members&mainmenu=members", $langs->trans("Members"), 0, $user->rights->adherent->lire, '', $mainmenu, 'members', 0, '', '', '', img_picto('', 'member', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/adherents/card.php?leftmenu=members&action=create", $langs->trans("NewMember"), 1, $user->rights->adherent->creer); - $newmenu->add("/adherents/list.php?leftmenu=members", $langs->trans("List"), 1, $user->rights->adherent->lire); - $newmenu->add("/adherents/list.php?leftmenu=members&statut=-1", $langs->trans("MenuMembersToValidate"), 2, $user->rights->adherent->lire); - $newmenu->add("/adherents/list.php?leftmenu=members&statut=1", $langs->trans("MenuMembersValidated"), 2, $user->rights->adherent->lire); - $newmenu->add("/adherents/list.php?leftmenu=members&statut=1&filter=withoutsubscription", $langs->trans("WithoutSubscription"), 3, $user->rights->adherent->lire); - $newmenu->add("/adherents/list.php?leftmenu=members&statut=1&filter=uptodate", $langs->trans("UpToDate"), 3, $user->rights->adherent->lire); - $newmenu->add("/adherents/list.php?leftmenu=members&statut=1&filter=outofdate", $langs->trans("OutOfDate"), 3, $user->rights->adherent->lire); - $newmenu->add("/adherents/list.php?leftmenu=members&statut=0", $langs->trans("MenuMembersResiliated"), 2, $user->rights->adherent->lire); - $newmenu->add("/adherents/stats/index.php?leftmenu=members", $langs->trans("MenuMembersStats"), 1, $user->rights->adherent->lire); - - $newmenu->add("/adherents/cartes/carte.php?leftmenu=export", $langs->trans("MembersCards"), 1, $user->rights->adherent->export); - if (!empty($conf->global->MEMBER_LINK_TO_HTPASSWDFILE) && ($usemenuhider || empty($leftmenu) || $leftmenu == 'none' || $leftmenu == "members" || $leftmenu == "export")) { - $newmenu->add("/adherents/htpasswd.php?leftmenu=export", $langs->trans("Filehtpasswd"), 1, $user->rights->adherent->export); - } - - if (!empty($conf->categorie->enabled)) { - $langs->load("categories"); - $newmenu->add("/categories/index.php?leftmenu=cat&type=3", $langs->trans("Categories"), 1, $user->rights->categorie->lire, '', $mainmenu, 'cat'); - } - - $newmenu->add("/adherents/index.php?leftmenu=members&mainmenu=members", $langs->trans("Subscriptions"), 0, $user->rights->adherent->cotisation->lire, '', $mainmenu, 'members', 0, '', '', '', img_picto('', 'payment', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/adherents/list.php?leftmenu=members&statut=-1,1&mainmenu=members", $langs->trans("NewSubscription"), 1, $user->rights->adherent->cotisation->creer); - $newmenu->add("/adherents/subscription/list.php?leftmenu=members", $langs->trans("List"), 1, $user->rights->adherent->cotisation->lire); - $newmenu->add("/adherents/stats/index.php?leftmenu=members", $langs->trans("MenuMembersStats"), 1, $user->rights->adherent->lire); - - //$newmenu->add("/adherents/index.php?leftmenu=export&mainmenu=members",$langs->trans("Tools"),0,$user->rights->adherent->export, '', $mainmenu, 'export'); - //if (! empty($conf->export->enabled) && ($usemenuhider || empty($leftmenu) || $leftmenu=="export")) $newmenu->add("/exports/index.php?leftmenu=export",$langs->trans("Datas"),1,$user->rights->adherent->export); - - // Type - $newmenu->add("/adherents/type.php?leftmenu=setup&mainmenu=members", $langs->trans("MembersTypes"), 0, $user->rights->adherent->configurer, '', $mainmenu, 'setup', 0, '', '', '', img_picto('', 'members', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/adherents/type.php?leftmenu=setup&mainmenu=members&action=create", $langs->trans("New"), 1, $user->rights->adherent->configurer); - $newmenu->add("/adherents/type.php?leftmenu=setup&mainmenu=members", $langs->trans("List"), 1, $user->rights->adherent->configurer); - } + get_left_menu_members($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user); } // Add personalized menus and modules menus From cf43024d5df66185d5c6533ec0a43c09e125e843 Mon Sep 17 00:00:00 2001 From: wdammak <26695620+wdammak@users.noreply.github.com> Date: Thu, 3 Mar 2022 11:29:47 +0100 Subject: [PATCH 042/610] Update eldy.lib.php --- htdocs/core/menus/standard/eldy.lib.php | 734 ++++++++++++------------ 1 file changed, 367 insertions(+), 367 deletions(-) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 5d2181c3e82..efe8d87ff86 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -676,6 +676,373 @@ function print_end_menu_array() print "\n"; } +/** + * Core function to output left menu eldy + * Fill &$menu (example with $forcemainmenu='home' $forceleftmenu='all', return left menu tree of Home) + * + * @param DoliDB $db Database handler + * @param array $menu_array_before Table of menu entries to show before entries of menu handler (menu->liste filled with menu->add) + * @param array $menu_array_after Table of menu entries to show after entries of menu handler (menu->liste filled with menu->add) + * @param array $tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty) + * @param Menu $menu Object Menu to return back list of menu entries + * @param int $noout Disable output (Initialise &$menu only). + * @param string $forcemainmenu 'x'=Force mainmenu to mainmenu='x' + * @param string $forceleftmenu 'all'=Force leftmenu to '' (= all). If value come being '', we change it to value in session and 'none' if not defined in session. + * @param array $moredata An array with more data to output + * @param int $type_user 0=Menu for backoffice, 1=Menu for front office + * @return int Nb of menu entries + */ +function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabMenu, &$menu, $noout = 0, $forcemainmenu = '', $forceleftmenu = '', $moredata = null, $type_user = 0) +{ + + global $user, $conf, $langs, $hookmanager; + + //var_dump($tabMenu); + + $newmenu = $menu; + + $mainmenu = ($forcemainmenu ? $forcemainmenu : $_SESSION["mainmenu"]); + $leftmenu = ($forceleftmenu ? '' : (empty($_SESSION["leftmenu"]) ? 'none' : $_SESSION["leftmenu"])); + + $usemenuhider = 0; + + if (is_array($moredata) && !empty($moredata['searchform'])) { // searchform can contains select2 code or link to show old search form or link to switch on search page + print "\n"; + print "\n"; + print '
'."\n"; + print $moredata['searchform']; + print '
'."\n"; + print "\n"; + } + + if (is_array($moredata) && !empty($moredata['bookmarks'])) { + print "\n"; + print "\n"; + print '
'."\n"; + print $moredata['bookmarks']; + print '
'."\n"; + print "\n"; + } + + $substitarray = getCommonSubstitutionArray($langs, 0, null, null); + + $listofmodulesforexternal = explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL); + + /** + * We update newmenu with entries found into database + * -------------------------------------------------- + */ + if ($mainmenu) { // If this is empty, loading hard coded menu and loading personalised menu will fail + /* + * Menu HOME + */ + if ($mainmenu == 'home') { + get_left_menu_home($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user); + } + + /* + * Menu THIRDPARTIES + */ + if ($mainmenu == 'companies') { + get_left_menu_thridparties($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user); + } + + /* + * Menu COMMERCIAL (propal, commande, supplier_proposal, supplier_order, contrat, ficheinter) + */ + if ($mainmenu == 'commercial') { + get_left_menu_commercial($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user); + } + + /* + * Menu COMPTA-FINANCIAL + */ + if ($mainmenu == 'billing') { + get_left_menu_billing($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user); + } + + /* + * Menu COMPTA-FINANCIAL + */ + if ($mainmenu == 'accountancy') { + get_left_menu_accountancy($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user, $db); + } + + /* + * Menu BANK + */ + if ($mainmenu == 'bank') { + get_left_menu_bank($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user); + } + + /* + * Menu PRODUCTS-SERVICES + */ + if ($mainmenu == 'products') { + get_left_menu_products($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user); + } + + /* + * Menu PRODUCTS-SERVICES MRP - GPAO + */ + if ($mainmenu == 'mrp') { + get_left_menu_mrp($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user); + } + + /* + * Menu PROJECTS + */ + if ($mainmenu == 'project') { + get_left_menu_projects($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user); + } + + /* + * Menu HRM + */ + if ($mainmenu == 'hrm') { + get_left_menu_hrm($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user); + } + + /* + * Menu TOOLS + */ + if ($mainmenu == 'tools') { + get_left_menu_tools($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user); + } + + /* + * Menu MEMBERS + */ + if ($mainmenu == 'members') { + get_left_menu_members($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user); + } + + // Add personalized menus and modules menus + //var_dump($newmenu->liste); // + $menuArbo = new Menubase($db, 'eldy'); + $newmenu = $menuArbo->menuLeftCharger($newmenu, $mainmenu, $leftmenu, (empty($user->socid) ? 0 : 1), 'eldy', $tabMenu); + //var_dump($newmenu->liste); // + + if (!empty($conf->ftp->enabled) && $mainmenu == 'ftp') { // Entry for FTP + $MAXFTP = 20; + $i = 1; + while ($i <= $MAXFTP) { + $paramkey = 'FTP_NAME_'.$i; + //print $paramkey; + if (!empty($conf->global->$paramkey)) { + $link = "/ftp/index.php?idmenu=".$_SESSION["idmenu"]."&numero_ftp=".$i; + $newmenu->add($link, dol_trunc($conf->global->$paramkey, 24)); + } + $i++; + } + } + } + + //var_dump($tabMenu); // + //var_dump($newmenu->liste); + + // Build final $menu_array = $menu_array_before +$newmenu->liste + $menu_array_after + //var_dump($menu_array_before);exit; + //var_dump($menu_array_after);exit; + $menu_array = $newmenu->liste; + if (is_array($menu_array_before)) { + $menu_array = array_merge($menu_array_before, $menu_array); + } + if (is_array($menu_array_after)) { + $menu_array = array_merge($menu_array, $menu_array_after); + } + //var_dump($menu_array);exit; + if (!is_array($menu_array)) { + return 0; + } + + // Allow the $menu_array of the menu to be manipulated by modules + $parameters = array( + 'mainmenu' => $mainmenu, + ); + $hook_items = $menu_array; + $reshook = $hookmanager->executeHooks('menuLeftMenuItems', $parameters, $hook_items); // Note that $action and $object may have been modified by some hooks + + if (is_numeric($reshook)) { + if ($reshook == 0 && !empty($hookmanager->results)) { + $menu_array[] = $hookmanager->results; // add + } elseif ($reshook == 1) { + $menu_array = $hookmanager->results; // replace + } + + // @todo Sort menu items by 'position' value + // $position = array(); + // foreach ($menu_array as $key => $row) { + // $position[$key] = $row['position']; + // } + // array_multisort($position, SORT_ASC, $menu_array); + } + + // TODO Use the position property in menu_array to reorder the $menu_array + //var_dump($menu_array); + /*$new_menu_array = array(); + $level=0; $cusor=0; $position=0; + $nbentry = count($menu_array); + while (findNextEntryForLevel($menu_array, $cursor, $position, $level)) + { + + $cursor++; + }*/ + + // Show menu + $invert = empty($conf->global->MAIN_MENU_INVERT) ? "" : "invert"; + if (empty($noout)) { + $altok = 0; + $blockvmenuopened = false; + $lastlevel0 = ''; + $num = count($menu_array); + for ($i = 0; $i < $num; $i++) { // Loop on each menu entry + $showmenu = true; + if (!empty($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED) && empty($menu_array[$i]['enabled'])) { + $showmenu = false; + } + + // Begin of new left menu block + if (empty($menu_array[$i]['level']) && $showmenu) { + $altok++; + $blockvmenuopened = true; + $lastopened = true; + for ($j = ($i + 1); $j < $num; $j++) { + if (empty($menu_array[$j]['level'])) { + $lastopened = false; + } + } + if ($altok % 2 == 0) { + print '
'."\n"; + } else { + print '
'."\n"; + } + } + + // Add tabulation + $tabstring = ''; + $tabul = ($menu_array[$i]['level'] - 1); + if ($tabul > 0) { + for ($j = 0; $j < $tabul; $j++) { + $tabstring .= '   '; + } + } + + // $menu_array[$i]['url'] can be a relative url, a full external url. We try substitution + + $menu_array[$i]['url'] = make_substitutions($menu_array[$i]['url'], $substitarray); + + $url = $shorturl = $shorturlwithoutparam = $menu_array[$i]['url']; + if (!preg_match("/^(http:\/\/|https:\/\/)/i", $menu_array[$i]['url'])) { + $tmp = explode('?', $menu_array[$i]['url'], 2); + $url = $shorturl = $tmp[0]; + $param = (isset($tmp[1]) ? $tmp[1] : ''); // params in url of the menu link + + // Complete param to force leftmenu to '' to close open menu when we click on a link with no leftmenu defined. + if ((!preg_match('/mainmenu/i', $param)) && (!preg_match('/leftmenu/i', $param)) && !empty($menu_array[$i]['mainmenu'])) { + $param .= ($param ? '&' : '').'mainmenu='.$menu_array[$i]['mainmenu'].'&leftmenu='; + } + if ((!preg_match('/mainmenu/i', $param)) && (!preg_match('/leftmenu/i', $param)) && empty($menu_array[$i]['mainmenu'])) { + $param .= ($param ? '&' : '').'leftmenu='; + } + //$url.="idmenu=".$menu_array[$i]['rowid']; // Already done by menuLoad + $url = dol_buildpath($url, 1).($param ? '?'.$param : ''); + $shorturlwithoutparam = $shorturl; + $shorturl = $shorturl.($param ? '?'.$param : ''); + } + + + print ''."\n"; + + // Menu level 0 + if ($menu_array[$i]['level'] == 0) { + if ($menu_array[$i]['enabled']) { // Enabled so visible + print ''."\n"; + $lastlevel0 = 'enabled'; + } elseif ($showmenu) { // Not enabled but visible (so greyed) + print ''."\n"; + $lastlevel0 = 'greyed'; + } else { + $lastlevel0 = 'hidden'; + } + if ($showmenu) { + print ''."\n"; + } + } + + // Menu level > 0 + if ($menu_array[$i]['level'] > 0) { + $cssmenu = ''; + if ($menu_array[$i]['url']) { + $cssmenu = ' menu_contenu'.dol_string_nospecial(preg_replace('/\.php.*$/', '', $menu_array[$i]['url'])); + } + + if ($menu_array[$i]['enabled'] && $lastlevel0 == 'enabled') { + // Enabled so visible, except if parent was not enabled. + print ''."\n"; + } elseif ($showmenu && $lastlevel0 == 'enabled') { + // Not enabled but visible (so greyed), except if parent was not enabled. + print ''."\n"; + } + } + + // If next is a new block or if there is nothing after + if (empty($menu_array[$i + 1]['level'])) { // End menu block + if ($showmenu) { + print ''."\n"; + } + if ($blockvmenuopened) { + print '
'."\n"; + $blockvmenuopened = false; + } + } + } + + if ($altok) { + print '
'; // End menu block + } + } + + return count($menu_array); +} + + /** * Get left Menu HOME * @@ -1516,7 +1883,6 @@ function get_left_menu_accountancy($mainmenu, &$newmenu, $usemenuhider = 1, $lef } } - /** * Get left Menu BANK * @@ -2042,369 +2408,3 @@ function get_left_menu_members($mainmenu, &$newmenu, $usemenuhider = 1, $leftmen } } } - -/** - * Core function to output left menu eldy - * Fill &$menu (example with $forcemainmenu='home' $forceleftmenu='all', return left menu tree of Home) - * - * @param DoliDB $db Database handler - * @param array $menu_array_before Table of menu entries to show before entries of menu handler (menu->liste filled with menu->add) - * @param array $menu_array_after Table of menu entries to show after entries of menu handler (menu->liste filled with menu->add) - * @param array $tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty) - * @param Menu $menu Object Menu to return back list of menu entries - * @param int $noout Disable output (Initialise &$menu only). - * @param string $forcemainmenu 'x'=Force mainmenu to mainmenu='x' - * @param string $forceleftmenu 'all'=Force leftmenu to '' (= all). If value come being '', we change it to value in session and 'none' if not defined in session. - * @param array $moredata An array with more data to output - * @param int $type_user 0=Menu for backoffice, 1=Menu for front office - * @return int Nb of menu entries - */ -function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabMenu, &$menu, $noout = 0, $forcemainmenu = '', $forceleftmenu = '', $moredata = null, $type_user = 0) -{ - - global $user, $conf, $langs, $hookmanager; - - //var_dump($tabMenu); - - $newmenu = $menu; - - $mainmenu = ($forcemainmenu ? $forcemainmenu : $_SESSION["mainmenu"]); - $leftmenu = ($forceleftmenu ? '' : (empty($_SESSION["leftmenu"]) ? 'none' : $_SESSION["leftmenu"])); - - $usemenuhider = 0; - - if (is_array($moredata) && !empty($moredata['searchform'])) { // searchform can contains select2 code or link to show old search form or link to switch on search page - print "\n"; - print "\n"; - print '
'."\n"; - print $moredata['searchform']; - print '
'."\n"; - print "\n"; - } - - if (is_array($moredata) && !empty($moredata['bookmarks'])) { - print "\n"; - print "\n"; - print '
'."\n"; - print $moredata['bookmarks']; - print '
'."\n"; - print "\n"; - } - - $substitarray = getCommonSubstitutionArray($langs, 0, null, null); - - $listofmodulesforexternal = explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL); - - /** - * We update newmenu with entries found into database - * -------------------------------------------------- - */ - if ($mainmenu) { // If this is empty, loading hard coded menu and loading personalised menu will fail - /* - * Menu HOME - */ - if ($mainmenu == 'home') { - get_left_menu_home($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user); - } - - /* - * Menu THIRDPARTIES - */ - if ($mainmenu == 'companies') { - get_left_menu_thridparties($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user); - } - - /* - * Menu COMMERCIAL (propal, commande, supplier_proposal, supplier_order, contrat, ficheinter) - */ - if ($mainmenu == 'commercial') { - get_left_menu_commercial($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user); - } - - /* - * Menu COMPTA-FINANCIAL - */ - if ($mainmenu == 'billing') { - get_left_menu_billing($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user); - } - - /* - * Menu COMPTA-FINANCIAL - */ - if ($mainmenu == 'accountancy') { - get_left_menu_accountancy($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user, $db); - } - - /* - * Menu BANK - */ - if ($mainmenu == 'bank') { - get_left_menu_bank($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user); - } - - /* - * Menu PRODUCTS-SERVICES - */ - if ($mainmenu == 'products') { - get_left_menu_products($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user); - } - - /* - * Menu PRODUCTS-SERVICES MRP - GPAO - */ - if ($mainmenu == 'mrp') { - get_left_menu_mrp($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user); - } - - /* - * Menu PROJECTS - */ - if ($mainmenu == 'project') { - get_left_menu_projects($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user); - } - - /* - * Menu HRM - */ - if ($mainmenu == 'hrm') { - get_left_menu_hrm($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user); - } - - /* - * Menu TOOLS - */ - if ($mainmenu == 'tools') { - get_left_menu_tools($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user); - } - - /* - * Menu MEMBERS - */ - if ($mainmenu == 'members') { - get_left_menu_members($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user); - } - - // Add personalized menus and modules menus - //var_dump($newmenu->liste); // - $menuArbo = new Menubase($db, 'eldy'); - $newmenu = $menuArbo->menuLeftCharger($newmenu, $mainmenu, $leftmenu, (empty($user->socid) ? 0 : 1), 'eldy', $tabMenu); - //var_dump($newmenu->liste); // - - if (!empty($conf->ftp->enabled) && $mainmenu == 'ftp') { // Entry for FTP - $MAXFTP = 20; - $i = 1; - while ($i <= $MAXFTP) { - $paramkey = 'FTP_NAME_'.$i; - //print $paramkey; - if (!empty($conf->global->$paramkey)) { - $link = "/ftp/index.php?idmenu=".$_SESSION["idmenu"]."&numero_ftp=".$i; - $newmenu->add($link, dol_trunc($conf->global->$paramkey, 24)); - } - $i++; - } - } - } - - //var_dump($tabMenu); // - //var_dump($newmenu->liste); - - // Build final $menu_array = $menu_array_before +$newmenu->liste + $menu_array_after - //var_dump($menu_array_before);exit; - //var_dump($menu_array_after);exit; - $menu_array = $newmenu->liste; - if (is_array($menu_array_before)) { - $menu_array = array_merge($menu_array_before, $menu_array); - } - if (is_array($menu_array_after)) { - $menu_array = array_merge($menu_array, $menu_array_after); - } - //var_dump($menu_array);exit; - if (!is_array($menu_array)) { - return 0; - } - - // Allow the $menu_array of the menu to be manipulated by modules - $parameters = array( - 'mainmenu' => $mainmenu, - ); - $hook_items = $menu_array; - $reshook = $hookmanager->executeHooks('menuLeftMenuItems', $parameters, $hook_items); // Note that $action and $object may have been modified by some hooks - - if (is_numeric($reshook)) { - if ($reshook == 0 && !empty($hookmanager->results)) { - $menu_array[] = $hookmanager->results; // add - } elseif ($reshook == 1) { - $menu_array = $hookmanager->results; // replace - } - - // @todo Sort menu items by 'position' value - // $position = array(); - // foreach ($menu_array as $key => $row) { - // $position[$key] = $row['position']; - // } - // array_multisort($position, SORT_ASC, $menu_array); - } - - // TODO Use the position property in menu_array to reorder the $menu_array - //var_dump($menu_array); - /*$new_menu_array = array(); - $level=0; $cusor=0; $position=0; - $nbentry = count($menu_array); - while (findNextEntryForLevel($menu_array, $cursor, $position, $level)) - { - - $cursor++; - }*/ - - // Show menu - $invert = empty($conf->global->MAIN_MENU_INVERT) ? "" : "invert"; - if (empty($noout)) { - $altok = 0; - $blockvmenuopened = false; - $lastlevel0 = ''; - $num = count($menu_array); - for ($i = 0; $i < $num; $i++) { // Loop on each menu entry - $showmenu = true; - if (!empty($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED) && empty($menu_array[$i]['enabled'])) { - $showmenu = false; - } - - // Begin of new left menu block - if (empty($menu_array[$i]['level']) && $showmenu) { - $altok++; - $blockvmenuopened = true; - $lastopened = true; - for ($j = ($i + 1); $j < $num; $j++) { - if (empty($menu_array[$j]['level'])) { - $lastopened = false; - } - } - if ($altok % 2 == 0) { - print '
'."\n"; - } else { - print '
'."\n"; - } - } - - // Add tabulation - $tabstring = ''; - $tabul = ($menu_array[$i]['level'] - 1); - if ($tabul > 0) { - for ($j = 0; $j < $tabul; $j++) { - $tabstring .= '   '; - } - } - - // $menu_array[$i]['url'] can be a relative url, a full external url. We try substitution - - $menu_array[$i]['url'] = make_substitutions($menu_array[$i]['url'], $substitarray); - - $url = $shorturl = $shorturlwithoutparam = $menu_array[$i]['url']; - if (!preg_match("/^(http:\/\/|https:\/\/)/i", $menu_array[$i]['url'])) { - $tmp = explode('?', $menu_array[$i]['url'], 2); - $url = $shorturl = $tmp[0]; - $param = (isset($tmp[1]) ? $tmp[1] : ''); // params in url of the menu link - - // Complete param to force leftmenu to '' to close open menu when we click on a link with no leftmenu defined. - if ((!preg_match('/mainmenu/i', $param)) && (!preg_match('/leftmenu/i', $param)) && !empty($menu_array[$i]['mainmenu'])) { - $param .= ($param ? '&' : '').'mainmenu='.$menu_array[$i]['mainmenu'].'&leftmenu='; - } - if ((!preg_match('/mainmenu/i', $param)) && (!preg_match('/leftmenu/i', $param)) && empty($menu_array[$i]['mainmenu'])) { - $param .= ($param ? '&' : '').'leftmenu='; - } - //$url.="idmenu=".$menu_array[$i]['rowid']; // Already done by menuLoad - $url = dol_buildpath($url, 1).($param ? '?'.$param : ''); - $shorturlwithoutparam = $shorturl; - $shorturl = $shorturl.($param ? '?'.$param : ''); - } - - - print ''."\n"; - - // Menu level 0 - if ($menu_array[$i]['level'] == 0) { - if ($menu_array[$i]['enabled']) { // Enabled so visible - print ''."\n"; - $lastlevel0 = 'enabled'; - } elseif ($showmenu) { // Not enabled but visible (so greyed) - print ''."\n"; - $lastlevel0 = 'greyed'; - } else { - $lastlevel0 = 'hidden'; - } - if ($showmenu) { - print ''."\n"; - } - } - - // Menu level > 0 - if ($menu_array[$i]['level'] > 0) { - $cssmenu = ''; - if ($menu_array[$i]['url']) { - $cssmenu = ' menu_contenu'.dol_string_nospecial(preg_replace('/\.php.*$/', '', $menu_array[$i]['url'])); - } - - if ($menu_array[$i]['enabled'] && $lastlevel0 == 'enabled') { - // Enabled so visible, except if parent was not enabled. - print ''."\n"; - } elseif ($showmenu && $lastlevel0 == 'enabled') { - // Not enabled but visible (so greyed), except if parent was not enabled. - print ''."\n"; - } - } - - // If next is a new block or if there is nothing after - if (empty($menu_array[$i + 1]['level'])) { // End menu block - if ($showmenu) { - print ''."\n"; - } - if ($blockvmenuopened) { - print '
'."\n"; - $blockvmenuopened = false; - } - } - } - - if ($altok) { - print '
'; // End menu block - } - } - - return count($menu_array); -} From 6c172d6441c97368f8baa1e72d987247894f5313 Mon Sep 17 00:00:00 2001 From: lvessiller Date: Thu, 3 Mar 2022 11:58:29 +0100 Subject: [PATCH 043/610] NEW option update prices on proposal cloning --- htdocs/comm/propal/card.php | 6 +-- htdocs/comm/propal/class/propal.class.php | 54 ++++++++++++++++++++++- htdocs/langs/en_US/products.lang | 1 + htdocs/langs/fr_FR/products.lang | 1 + 4 files changed, 57 insertions(+), 5 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 61ecb966359..e30adc2f860 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -220,7 +220,7 @@ if (empty($reshook)) { } } - $result = $object->createFromClone($user, $socid, (GETPOSTISSET('entity') ? GETPOST('entity', 'int') : null)); + $result = $object->createFromClone($user, $socid, (GETPOSTISSET('entity') ? GETPOST('entity', 'int') : null), GETPOSTISSET('update_prices')); if ($result > 0) { header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result); exit(); @@ -1914,8 +1914,8 @@ if ($action == 'create') { $formquestion = array( // 'text' => $langs->trans("ConfirmClone"), // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), - // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1), - array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $form->select_company(GETPOST('socid', 'int'), 'socid', '(s.client=1 OR s.client=2 OR s.client=3)')) + array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $form->select_company(GETPOST('socid', 'int'), 'socid', '(s.client=1 OR s.client=2 OR s.client=3)')), + array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans('PuttingPricesUpToDate'), 'value' => 1), ); if (!empty($conf->global->PROPAL_CLONE_DATE_DELIVERY) && !empty($object->delivery_date)) { $formquestion[] = array('type' => 'date', 'name' => 'date_delivery', 'label' => $langs->trans("DeliveryDate"), 'value' => $object->delivery_date); diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 6a6031c3a99..0f711432eb9 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -1324,11 +1324,12 @@ class Propal extends CommonObject * @param User $user User making the clone * @param int $socid Id of thirdparty * @param int $forceentity Entity id to force + * @param bool $update_prices [=false] Update prices if true * @return int New id of clone */ - public function createFromClone(User $user, $socid = 0, $forceentity = null) + public function createFromClone(User $user, $socid = 0, $forceentity = null, $update_prices = false) { - global $conf, $hookmanager; + global $conf, $hookmanager, $mysoc; dol_include_once('/projet/class/project.class.php'); @@ -1375,6 +1376,55 @@ class Propal extends CommonObject $objsoc->fetch($object->socid); } + // update prices + if ($update_prices === true) { + if ($objsoc->id > 0 && !empty($object->lines)) { + if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { + // If price per customer + require_once DOL_DOCUMENT_ROOT . '/product/class/productcustomerprice.class.php'; + } + + foreach ($object->lines as $line) { + if ($line->fk_product > 0) { + $prod = new Product($this->db); + $res = $prod->fetch($line->fk_product); + if ($res > 0) { + $pu_ht = $prod->price; + $tva_tx = get_default_tva($mysoc, $objsoc, $prod->id); + $remise_percent = $objsoc->remise_percent; + + if (!empty($conf->global->PRODUIT_MULTIPRICES) && $objsoc->price_level > 0) { + $pu_ht = $prod->multiprices[$objsoc->price_level]; + if (!empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) { // using this option is a bug. kept for backward compatibility + if (isset($prod->multiprices_tva_tx[$objsoc->price_level])) { + $tva_tx = $prod->multiprices_tva_tx[$objsoc->price_level]; + } + } + } elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { + $prodcustprice = new Productcustomerprice($this->db); + $filter = array('t.fk_product' => $prod->id, 't.fk_soc' => $objsoc->id); + $result = $prodcustprice->fetch_all('', '', 0, 0, $filter); + if ($result) { + // If there is some prices specific to the customer + if (count($prodcustprice->lines) > 0) { + $pu_ht = price($prodcustprice->lines[0]->price); + $tva_tx = ($prodcustprice->lines[0]->default_vat_code ? $prodcustprice->lines[0]->tva_tx.' ('.$prodcustprice->lines[0]->default_vat_code.' )' : $prodcustprice->lines[0]->tva_tx); + if ($prodcustprice->lines[0]->default_vat_code && !preg_match('/\(.*\)/', $tva_tx)) { + $tva_tx .= ' ('.$prodcustprice->lines[0]->default_vat_code.')'; + } + } + } + } + + $line->subprice = $pu_ht; + $line->tva_tx = $tva_tx; + $line->remise_percent = $remise_percent; + } + } + } + } + } + $object->id = 0; $object->ref = ''; $object->entity = (!empty($forceentity) ? $forceentity : $object->entity); diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index 960bf02eb46..b6e41c1f9d5 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -412,3 +412,4 @@ SwitchOnSaleStatus=Switch on sale status SwitchOnPurchaseStatus=Switch on purchase status StockMouvementExtraFields= Extra Fields (stock mouvement) InventoryExtraFields= Extra Fields (inventory) +PuttingPricesUpToDate=Update prices diff --git a/htdocs/langs/fr_FR/products.lang b/htdocs/langs/fr_FR/products.lang index a9ae791ec8d..c99f15a4613 100644 --- a/htdocs/langs/fr_FR/products.lang +++ b/htdocs/langs/fr_FR/products.lang @@ -411,3 +411,4 @@ Rank=Classement SwitchOnSaleStatus=Basculer le statut En vente SwitchOnPurchaseStatus=Basculer le statut En achat StockMouvementExtraFields= Champs supplémentaires (mouvement de stock) +PuttingPricesUpToDate=Mettre à jour les tarifs From 7239fa36052c68e8761b1753fd0806a485db608e Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Thu, 3 Mar 2022 12:19:47 +0100 Subject: [PATCH 044/610] FIX: project creation prevented if PROJECTLEADER contact role renamed, de-activated or deleted --- htdocs/projet/card.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 3f496de2f66..ab61a613734 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -174,10 +174,11 @@ if (empty($reshook)) if (!$error && $result > 0) { // Add myself as project leader - $typeofcontact = 'PROJECTLEADER'; // TODO If use rename this code in dictionary, the add_contact will generate an error. + $typeofcontact = 'PROJECTLEADER'; $result = $object->add_contact($user->id, $typeofcontact, 'internal'); - if ($result < 0) - { + + // -3 means type not found (PROJECTLEADER renamed, de-activated or deleted), so don't prevent creation if it has been the case + if ($result < 0 && $result != -3) { $langs->load("errors"); setEventMessages($object->error, $object->errors, 'errors'); $error++; From 436b8fa5b5d94a9df8da0b17e958c00468f38baf Mon Sep 17 00:00:00 2001 From: steve Date: Thu, 3 Mar 2022 16:18:09 +0100 Subject: [PATCH 045/610] apply feedbacks --- htdocs/core/lib/usergroups.lib.php | 2 +- htdocs/core/modules/modHRM.class.php | 16 ----------- htdocs/langs/en_US/admin.lang | 2 -- htdocs/user/bank.php | 41 ++++++++++++++++++++++------ htdocs/user/card.php | 34 ----------------------- 5 files changed, 33 insertions(+), 62 deletions(-) diff --git a/htdocs/core/lib/usergroups.lib.php b/htdocs/core/lib/usergroups.lib.php index 8e764c14ea4..2792b6d9997 100644 --- a/htdocs/core/lib/usergroups.lib.php +++ b/htdocs/core/lib/usergroups.lib.php @@ -141,7 +141,7 @@ function user_prepare_head($object) // $this->tabs = array('entity:-tabname); to remove a tab complete_head_from_modules($conf, $langs, $object, $head, $h, 'user'); - if ((!empty($conf->salaries->enabled) && !empty($user->rights->salaries->read) && !empty($user->rights->hrm->read_employee->read)) + if ((!empty($conf->salaries->enabled) && !empty($user->rights->salaries->read)) || (!empty($conf->hrm->enabled) && !empty($user->rights->hrm->employee->read)) || (!empty($conf->expensereport->enabled) && !empty($user->rights->expensereport->lire) && ($user->id == $object->id || $user->rights->expensereport->readall)) || (!empty($conf->holiday->enabled) && !empty($user->rights->holiday->read) && ($user->id == $object->id || $user->rights->holiday->readall)) diff --git a/htdocs/core/modules/modHRM.class.php b/htdocs/core/modules/modHRM.class.php index 35deea09a07..3e75f8efcd5 100644 --- a/htdocs/core/modules/modHRM.class.php +++ b/htdocs/core/modules/modHRM.class.php @@ -249,22 +249,6 @@ class modHRM extends DolibarrModules $this->rights[$r][4] = 'compare_advance'; $this->rights[$r][5] = 'read'; // In php code, permission will be checked by test if ($user->rights->hrm->compare_advance->read) $r++; - - // Read employee - $this->rights[$r][0] = 4031; // Permission id (must not be already used) - $this->rights[$r][1] = 'Read employee'; // Permission label - $this->rights[$r][3] = 0; // Permission by default for new user (0/1) - $this->rights[$r][4] = 'read_employee'; - $this->rights[$r][5] = 'read'; // In php code, permission will be checked by test if ($user->rights->hrm->read_employee->read) - $r++; - - // Write employee - $this->rights[$r][0] = 4032; // Permission id (must not be already used) - $this->rights[$r][1] = 'Write employee'; // Permission label - $this->rights[$r][3] = 0; // Permission by default for new user (0/1) - $this->rights[$r][4] = 'write_employee'; - $this->rights[$r][5] = 'write'; // In php code, permission will be checked by test if ($user->rights->hrm->write_employee->write) - $r++; } /** diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 6674f6cb58a..cffd3532c05 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -969,8 +969,6 @@ Permission4021=Create/modify your evaluation Permission4022=Validate evaluation Permission4023=Delete evaluation Permission4030=See comparison menu -Permission4031=Read employee -Permission4032=Write employee Permission10001=Read website content Permission10002=Create/modify website content (html and javascript content) Permission10003=Create/modify website content (dynamic php code). Dangerous, must be reserved to restricted developers. diff --git a/htdocs/user/bank.php b/htdocs/user/bank.php index b84ae16c55f..38b6066e9d2 100644 --- a/htdocs/user/bank.php +++ b/htdocs/user/bank.php @@ -230,6 +230,24 @@ if ($action == 'setpersonal_mobile' && $canadduser && !$cancel) { } } +// update ref_employee +if ($action == 'setref_employee' && $canadduser && !$cancel) { + $object->ref_employee = (string) GETPOST('ref_employee', 'alphanohtml'); + $result = $object->update($user); + if ($result < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + } +} + +// update national_registration_number +if ($action == 'setnational_registration_number' && $canadduser && !$cancel) { + $object->national_registration_number = (string) GETPOST('national_registration_number', 'alphanohtml'); + $result = $object->update($user); + if ($result < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + } +} + if (!empty($conf->global->MAIN_USE_EXPENSE_IK)) { // update default_c_exp_tax_cat if ($action == 'setdefault_c_exp_tax_cat' && $canadduser) { @@ -509,17 +527,22 @@ if ($action != 'edit' && $action != 'create') { // If not bank account yet, $ac } // Employee Number - if (!empty($conf->accounting->enabled)) { - print ''.$langs->trans("RefEmployee").''; - print ''.$object->ref_employee.''; - } + print ''; + print ''; + print $form->editfieldkey("RefEmployee", 'ref_employee', $object->ref_employee, $object, $user->rights->user->user->creer); + print ''; + print $form->editfieldval("RefEmployee", 'ref_employee', $object->ref_employee, $object, $user->rights->user->user->creer, 'string', $object->ref_employee); + print ''; + print ''; // National registration number - if (!empty($conf->accounting->enabled)) { - print ''.$langs->trans("NationalRegistrationNumber").''; - print ''.$object->national_registration_number.''; - } - + print ''; + print ''; + print $form->editfieldkey("NationalRegistrationNumber", 'national_registration_number', $object->national_registration_number, $object, $user->rights->user->user->creer); + print ''; + print $form->editfieldval("NationalRegistrationNumber", 'national_registration_number', $object->national_registration_number, $object, $user->rights->user->user->creer, 'string', $object->national_registration_number); + print ''; + print ''; print ''; diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 720387e6c47..e5381a7271e 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -849,18 +849,6 @@ if ($action == 'create' || $action == 'adduserldap') { } print ''; - // Ref remployee - print ''.$langs->trans("RefEmployee").''; - print ''; - print ''; - print ''; - - // National registration number - print ''.$langs->trans("NationalRegistrationNumber").''; - print ''; - print ''; - print ''; - // Login print ''.$langs->trans("Login").''; print ''; @@ -2099,28 +2087,6 @@ if ($action == 'create' || $action == 'adduserldap') { } print ''; - // Ref employee - print "".''.$langs->trans("RefEmployee").''; - print ''; - if ($caneditfield && !$object->ldap_sid) { - print ''; - } else { - print ''; - print $object->ref_employee; - } - print ''; - - // National registration number - print "".''.$langs->trans("NationalRegistrationNumber").''; - print ''; - if ($caneditfield && !$object->ldap_sid) { - print ''; - } else { - print ''; - print $object->national_registration_number; - } - print ''; - // Login print "".''.$langs->trans("Login").''; print ''; From 801402f46aa7e085c7e6ea72b28c403c73f04718 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 4 Mar 2022 11:58:52 +0100 Subject: [PATCH 046/610] fix: #20267 --- htdocs/comm/action/card.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 752868acb87..ee71cc48f07 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -1439,6 +1439,10 @@ if ($id > 0) { $("#fullday").change(function() { setdatefields(); }); + $("#actioncode").change(function() { + if ($("#actioncode").val() == \'AC_RDV\') $("#dateend").addClass("fieldrequired"); + else $("#dateend").removeClass("fieldrequired"); + }); })'; print ''."\n"; } @@ -1483,7 +1487,12 @@ if ($id > 0) { print ''.$langs->trans("EventOnFullDay").'fulldayevent ? ' checked' : '').'>'; // Date start - end - print ''.$langs->trans("DateActionStart").' - '.$langs->trans("DateActionEnd").''; + print ''; + print ''.$langs->trans("DateActionStart").''; + print ' - '; + print 'type_code == 'AC_RDV' ? ' class="fieldrequired"' : '').'>'.$langs->trans("DateActionEnd").''; + print ''; + //print ''.$langs->trans("DateActionStart").' - '.$langs->trans("DateActionEnd").''; if (GETPOST("afaire") == 1) { print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 0, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', 'tzuser'); } elseif (GETPOST("afaire") == 2) { From 665e401564b30079c1f2ba64b016c374e11da60e Mon Sep 17 00:00:00 2001 From: steve Date: Fri, 4 Mar 2022 17:03:40 +0100 Subject: [PATCH 047/610] wip: replace butAction --- htdocs/compta/facture/card.php | 89 +++++++++++++++++++++++++--------- 1 file changed, 67 insertions(+), 22 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index a4d85c257f8..5b4acb040d6 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -5359,6 +5359,12 @@ if ($action == 'create') { $parameters = array(); $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook if (empty($reshook)) { + $params = array( + 'attr' => array( + 'title' => '', + 'class' => 'classfortooltip' + ) + ); // Editer une facture deja validee, sans paiement effectue et pas exporte en compta if ($object->statut == Facture::STATUS_VALIDATED) { // We check if lines of invoice are not already transfered into accountancy @@ -5368,18 +5374,27 @@ if ($action == 'create') { if (!empty($conf->global->INVOICE_CAN_ALWAYS_BE_EDITED) || ($resteapayer == price2num($object->total_ttc, 'MT', 1) && empty($object->paye))) { if (!$objectidnext && $object->is_last_in_cycle()) { if ($usercanunvalidate) { - print ''.$langs->trans('Modify').''; + //print ''.$langs->trans('Modify').''; + print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=modif', '', true, $params); } else { - print ''.$langs->trans('Modify').''; + //print ''.$langs->trans('Modify').''; + $params['attr']['title'] = $langs->trans('NotEnoughPermissions'); + print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=modif', '', false, $params); } } elseif (!$object->is_last_in_cycle()) { - print ''.$langs->trans('Modify').''; + //print ''.$langs->trans('Modify').''; + $params['attr']['title'] = $langs->trans('NotLastInCycle'); + print dolGetButtonAction($langs->trans('Modify'), '', 'default', '#', '', false, $params); } else { - print ''.$langs->trans('Modify').''; + //print ''.$langs->trans('Modify').''; + $params['attr']['title'] = $langs->trans('DisabledBecauseReplacedInvoice'); + print dolGetButtonAction($langs->trans('Modify'), '', 'default', '#', '', false, $params); } } } else { - print ''.$langs->trans('Modify').''; + //print ''.$langs->trans('Modify').''; + $params['attr']['title'] = $langs->trans('DisabledBecauseDispatchedInBookkeeping'); + print dolGetButtonAction($langs->trans('Modify'), '', 'default', '#', '', false, $params); } } @@ -5414,7 +5429,8 @@ if ($action == 'create') { // Validate if ($object->statut == Facture::STATUS_DRAFT && count($object->lines) > 0 && ((($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA || $object->type == Facture::TYPE_SITUATION) && (!empty($conf->global->FACTURE_ENABLE_NEGATIVE) || $object->total_ttc >= 0)) || ($object->type == Facture::TYPE_CREDIT_NOTE && $object->total_ttc <= 0))) { if ($usercanvalidate) { - print ''.$langs->trans('Validate').''; + print dolGetButtonAction($langs->trans('Validate'), '', 'default', $_SERVER["PHP_SELF"].'?facid='.$object->id.'&action=valid&token='.newToken(), '', true, $params); + //print ''.$langs->trans('Validate').''; } } @@ -5425,9 +5441,11 @@ if ($action == 'create') { print ''.$langs->trans('SendMail').''; } else { if ($usercansend) { - print ''.$langs->trans('SendMail').''; + //print ''.$langs->trans('SendMail').''; + print dolGetButtonAction($langs->trans('SendMail'), '', 'default', $_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=presend&mode=init#formmailbeforetitle', '', true, $params); } else { - print ''.$langs->trans('SendMail').''; + //print ''.$langs->trans('SendMail').''; + print dolGetButtonAction($langs->trans('SendMail'), '', 'default', '#', '', false, $params); } } } @@ -5464,10 +5482,13 @@ if ($action == 'create') { } else { if ($object->type == Facture::TYPE_DEPOSIT && $resteapayer == 0) { // For down payment, we refuse to receive more than amount to pay. - print ''.$langs->trans('DoPayment').''; + //print ''.$langs->trans('DoPayment').''; + $params['attr']['title'] = $langs->trans('DisabledBecauseRemainderToPayIsZero'); + print dolGetButtonAction($langs->trans('DoPayment'), '', 'default', '#', '', false, $params); } else { // Sometimes we can receive more, so we accept to enter more and will offer a button to convert into discount (but it is not a credit note, just a prepayment done) - print ''.$langs->trans('DoPayment').''; + //print ''.$langs->trans('DoPayment').''; + print dolGetButtonAction($langs->trans('DoPayment'), '', 'default', DOL_URL_ROOT.'/compta/paiement.php?facid='.$object->id.'&action=create&accountid='.$object->fk_account, '', true, $params); } } } @@ -5516,9 +5537,12 @@ if ($action == 'create') { ) { if ($object->type == Facture::TYPE_DEPOSIT && price2num($object->total_ttc, 'MT') != price2num($sumofpaymentall, 'MT')) { // We can close a down payment only if paid amount is same than amount of down payment (by definition) - print ''.$langs->trans('ClassifyPaid').''; + //print ''.$langs->trans('ClassifyPaid').''; + $params['attr']['title'] = $langs->trans('AmountPaidMustMatchAmountOfDownPayment'); + print dolGetButtonAction($langs->trans('ClassifyPaid'), '', 'default', '#', '', false, $params); } else { - print ''.$langs->trans('ClassifyPaid').''; + //print ''.$langs->trans('ClassifyPaid').''; + print dolGetButtonAction($langs->trans('ClassifyPaid'), '', 'default', $_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=paid', '', true, $params); } } @@ -5563,13 +5587,15 @@ if ($action == 'create') { // Clone if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA) && $usercancreate) { - print ''.$langs->trans("ToClone").''; + //print ''.$langs->trans("ToClone").''; + print dolGetButtonAction($langs->trans('ToClone'), '', 'default', $_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=clone&object=invoice', '', true, $params); } // Clone as predefined / Create template if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA) && $object->statut == 0 && $usercancreate) { if (!$objectidnext && count($object->lines) > 0) { - print ''.$langs->trans("ChangeIntoRepeatableInvoice").''; + //print ''.$langs->trans("ChangeIntoRepeatableInvoice").''; + print dolGetButtonAction($langs->trans('ChangeIntoRepeatableInvoice'), '', 'default', DOL_URL_ROOT.'/compta/facture/card-rec.php?facid='.$object->id.'&action=create', '', true, $params); } } @@ -5602,25 +5628,44 @@ if ($action == 'create') { // Delete $isErasable = $object->is_erasable(); + $params = array( + 'attr' => array( + 'title' => '', + 'class' => 'classfortooltip' + ) + ); if ($usercandelete || ($usercancreate && $isErasable == 1)) { // isErasable = 1 means draft with temporary ref (draft can always be deleted with no need of permissions) //var_dump($isErasable); + $enableDelete = false; + $deleteHref = '#'; if ($isErasable == -4) { - print ''.$langs->trans('Delete').''; + $params['attr']['title'] = $langs->trans('DisabledBecausePayments'); + //print ''.$langs->trans('Delete').''; } elseif ($isErasable == -3) { - print ''.$langs->trans('Delete').''; + $params['attr']['title'] = $langs->trans('DisabledBecauseNotLastSituationInvoice'); + //print ''.$langs->trans('Delete').''; } elseif ($isErasable == -2) { - print ''.$langs->trans('Delete').''; + $params['attr']['title'] = $langs->trans('DisabledBecauseNotLastInvoice'); + //print ''.$langs->trans('Delete').''; } elseif ($isErasable == -1) { - print ''.$langs->trans('Delete').''; + $params['attr']['title'] = $langs->trans('DisabledBecauseDispatchedInBookkeeping'); + //print ''.$langs->trans('Delete').''; } elseif ($isErasable <= 0) { // Any other cases - print ''.$langs->trans('Delete').''; + $params['attr']['title'] = $langs->trans('DisabledBecauseNotErasable'); + //print ''.$langs->trans('Delete').''; } elseif ($objectidnext) { - print ''.$langs->trans('Delete').''; + $params['attr']['title'] = $langs->trans('DisabledBecauseReplacedInvoice'); + //print ''.$langs->trans('Delete').''; } else { - print ''.$langs->trans('Delete').''; + //print ''.$langs->trans('Delete').''; + $deleteHref = $_SERVER["PHP_SELF"].'?facid='.$object->id.'&action=delete&token='.newToken(); + $enableDelete = true; } + print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $deleteHref, '', $enableDelete, $params); } else { - print ''.$langs->trans('Delete').''; + //print ''.$langs->trans('Delete').''; + $params['attr']['title'] = $langs->trans('NotAllowed'); + print dolGetButtonAction($langs->trans('Delete'), '', 'delete', '#', '', false, $params); } } print '
'; From e4f4a07fc669568f00895100905a5b13854974a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9=20Cendrier?= Date: Fri, 4 Mar 2022 17:31:04 +0100 Subject: [PATCH 048/610] correct mass action "classify delivered" --- htdocs/commande/list.php | 8 ++++---- htdocs/langs/en_US/orders.lang | 3 +++ htdocs/langs/fr_FR/orders.lang | 3 +++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index b534d915914..2033b5626b2 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -337,15 +337,15 @@ if ($action == 'shipped' && $permissiontoadd) { $error = 0; foreach ($toselect as $checked) { if ($objecttmp->fetch($checked)) { - if ($objecttmp->statut == 1) { + if ($objecttmp->statut == 1 || $objecttmp->statut == 2) { if ($objecttmp->cloture($user)) { - setEventMessage($objecttmp->ref." ".$langs->trans('PassedInOpenStatus'), 'mesgs'); + setEventMessage($objecttmp->ref." ".$langs->trans('PassedInShippedStatus'), 'mesgs'); } else { - setEventMessage($langs->trans('CantBeValidated'), 'errors'); + setEventMessage($langs->trans('YouCantShipThis'), 'errors'); $error++; } } else { - setEventMessage($objecttmp->ref." ".$langs->trans('IsNotADraft'), 'errors'); + setEventMessage($objecttmp->ref." ".$langs->trans('MustBeValidatedBefore'), 'errors'); $error++; } } else { diff --git a/htdocs/langs/en_US/orders.lang b/htdocs/langs/en_US/orders.lang index 9018db40a5b..e94153db1a9 100644 --- a/htdocs/langs/en_US/orders.lang +++ b/htdocs/langs/en_US/orders.lang @@ -102,6 +102,9 @@ ConfirmCancelOrder=Are you sure you want to cancel this order? ConfirmMakeOrder=Are you sure you want to confirm you made this order on %s? GenerateBill=Generate invoice ClassifyShipped=Classify delivered +PassedInShippedStatus=classified delivered +YouCantShipThis=I can't classify this. Please check user permissions +MustBeValidatedBefore=must be Validated or Shipping in order to be classified as shipped DraftOrders=Draft orders DraftSuppliersOrders=Draft purchase orders OnProcessOrders=In process orders diff --git a/htdocs/langs/fr_FR/orders.lang b/htdocs/langs/fr_FR/orders.lang index 16d1ecc2b27..3b0a3e38a7d 100644 --- a/htdocs/langs/fr_FR/orders.lang +++ b/htdocs/langs/fr_FR/orders.lang @@ -102,6 +102,9 @@ ConfirmCancelOrder=Êtes-vous sûr de vouloir annuler cette commande ? ConfirmMakeOrder=Êtes-vous sûr de vouloir confirmer cette commande en date du %s ? GenerateBill=Facturer ClassifyShipped=Classer livrée +PassedInShippedStatus=classée livrée +YouCantShipThis=Classement impossible : veuillez vérifier les droits utilisateur +MustBeValidatedBefore=doit être Validée ou En cours de livraison pour pouvoir être classée livrée DraftOrders=Commandes brouillons DraftSuppliersOrders=Commandes fournisseurs brouillons OnProcessOrders=Commandes en cours de traitement From cfabaea645a9f8bbe0ad23b668ae770c26264ae4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9=20Cendrier?= Date: Fri, 4 Mar 2022 17:38:39 +0100 Subject: [PATCH 049/610] translation refining --- htdocs/langs/en_US/orders.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/orders.lang b/htdocs/langs/en_US/orders.lang index e94153db1a9..cbe9cca4d7a 100644 --- a/htdocs/langs/en_US/orders.lang +++ b/htdocs/langs/en_US/orders.lang @@ -104,7 +104,7 @@ GenerateBill=Generate invoice ClassifyShipped=Classify delivered PassedInShippedStatus=classified delivered YouCantShipThis=I can't classify this. Please check user permissions -MustBeValidatedBefore=must be Validated or Shipping in order to be classified as shipped +MustBeValidatedBefore=must be Validated or In process in order to be classified as shipped DraftOrders=Draft orders DraftSuppliersOrders=Draft purchase orders OnProcessOrders=In process orders From af8ecd1a384ab9ae796e06adf4213e3f39500e71 Mon Sep 17 00:00:00 2001 From: Quentin VIAL-GOUTEYRON Date: Mon, 7 Mar 2022 16:02:49 +0100 Subject: [PATCH 050/610] NEW Availibility dictionnary column unit and number --- htdocs/admin/dict.php | 25 ++++++++++++++----- .../install/mysql/data/llx_c_availability.sql | 10 ++++---- .../install/mysql/migration/15.0.0-16.0.0.sql | 10 ++++++++ .../mysql/tables/llx_c_availability.sql | 2 ++ 4 files changed, 36 insertions(+), 11 deletions(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 74d26e29da5..111186d6e6a 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -218,7 +218,7 @@ $tabsql[17] = "SELECT id as rowid, code, label, accountancy_code, active FR $tabsql[18] = "SELECT rowid as rowid, code, libelle, tracking, active FROM ".MAIN_DB_PREFIX."c_shipment_mode"; $tabsql[19] = "SELECT id as rowid, code, libelle, active FROM ".MAIN_DB_PREFIX."c_effectif"; $tabsql[20] = "SELECT rowid as rowid, code, libelle, active FROM ".MAIN_DB_PREFIX."c_input_method"; -$tabsql[21] = "SELECT c.rowid as rowid, c.code, c.label, c.active, c.position FROM ".MAIN_DB_PREFIX."c_availability AS c"; +$tabsql[21] = "SELECT c.rowid as rowid, c.code, c.label, c.type_duration, c.number, c.active, c.position FROM ".MAIN_DB_PREFIX."c_availability AS c"; $tabsql[22] = "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_input_reason"; $tabsql[23] = "SELECT t.rowid as rowid, t.taux, t.revenuestamp_type, c.label as country, c.code as country_code, t.fk_pays as country_id, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_revenuestamp as t, ".MAIN_DB_PREFIX."c_country as c WHERE t.fk_pays=c.rowid"; $tabsql[24] = "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_type_resource"; @@ -265,7 +265,7 @@ $tabsqlsort[17] = "code ASC"; $tabsqlsort[18] = "code ASC, libelle ASC"; $tabsqlsort[19] = "id ASC"; $tabsqlsort[20] = "code ASC, libelle ASC"; -$tabsqlsort[21] = "code ASC, label ASC, position ASC"; +$tabsqlsort[21] = "code ASC, label ASC, position ASC, type_duration ASC, number ASC"; $tabsqlsort[22] = "code ASC, label ASC"; $tabsqlsort[23] = "country ASC, taux ASC"; $tabsqlsort[24] = "code ASC, label ASC"; @@ -312,7 +312,7 @@ $tabfield[17] = "code,label,accountancy_code"; $tabfield[18] = "code,libelle,tracking"; $tabfield[19] = "code,libelle"; $tabfield[20] = "code,libelle"; -$tabfield[21] = "code,label,position"; +$tabfield[21] = "code,label,number,type_duration,position"; $tabfield[22] = "code,label"; $tabfield[23] = "country_id,country,taux,revenuestamp_type,accountancy_code_sell,accountancy_code_buy,note"; $tabfield[24] = "code,label"; @@ -359,7 +359,7 @@ $tabfieldvalue[17] = "code,label,accountancy_code"; $tabfieldvalue[18] = "code,libelle,tracking"; $tabfieldvalue[19] = "code,libelle"; $tabfieldvalue[20] = "code,libelle"; -$tabfieldvalue[21] = "code,label,position"; +$tabfieldvalue[21] = "code,label,number,type_duration,position"; $tabfieldvalue[22] = "code,label"; $tabfieldvalue[23] = "country,taux,revenuestamp_type,accountancy_code_sell,accountancy_code_buy,note"; $tabfieldvalue[24] = "code,label"; @@ -406,7 +406,7 @@ $tabfieldinsert[17] = "code,label,accountancy_code"; $tabfieldinsert[18] = "code,libelle,tracking"; $tabfieldinsert[19] = "code,libelle"; $tabfieldinsert[20] = "code,libelle"; -$tabfieldinsert[21] = "code,label,position"; +$tabfieldinsert[21] = "code,label,number,type_duration,position"; $tabfieldinsert[22] = "code,label"; $tabfieldinsert[23] = "fk_pays,taux,revenuestamp_type,accountancy_code_sell,accountancy_code_buy,note"; $tabfieldinsert[24] = "code,label"; @@ -566,7 +566,7 @@ $tabhelp[33] = array('code'=>$langs->trans("EnterAnyCode")); $tabhelp[34] = array('code'=>$langs->trans("EnterAnyCode")); $tabhelp[35] = array(); $tabhelp[36] = array('range_ik'=>$langs->trans('PrevRangeToThisRange')); -$tabhelp[37] = array('code'=>$langs->trans("EnterAnyCode"), 'unit_type' => $langs->trans('MeasuringUnitTypeDesc'), 'scale' => $langs->trans('MeasuringScaleDesc')); +$tabhelp[37] = array('code'=>$langs->trans("EnterAnyCode"), 'unit_type' => $langs->trans('Measuringtype_durationDesc'), 'scale' => $langs->trans('MeasuringScaleDesc')); $tabhelp[38] = array('code'=>$langs->trans("EnterAnyCode"), 'url' => $langs->trans('UrlSocialNetworksDesc'), 'icon' => $langs->trans('FafaIconSocialNetworksDesc')); $tabhelp[39] = array('code'=>$langs->trans("EnterAnyCode")); $tabhelp[40] = array('code'=>$langs->trans("EnterAnyCode"), 'picto'=>$langs->trans("PictoHelp")); @@ -1466,6 +1466,9 @@ if ($id) { if ($value == 'block_if_negative') { $valuetoshow = $langs->trans('BlockHolidayIfNegative'); } + if ($value == 'type_duration') { + $valuetoshow = $langs->trans('Unit'); + } if ($id == 2) { // Special case for state page if ($value == 'region_id') { @@ -1818,6 +1821,9 @@ if ($id) { if ($value == 'block_if_negative') { $valuetoshow = $langs->trans('BlockHolidayIfNegative'); } + if ($value == 'type_duration') { + $valuetoshow = $langs->trans('Unit'); + } if ($value == 'region_id' || $value == 'country_id') { $showfield = 0; @@ -2055,6 +2061,9 @@ if ($id) { $valuetoshow = $langs->trans($obj->{$value}); } elseif ($value == 'block_if_negative') { $valuetoshow = yn($obj->{$value}); + } elseif ($value == 'type_duration') { + $TDurationTypes = array('y'=>$langs->trans('Years'), 'm'=>$langs->trans('Month'), 'w'=>$langs->trans('Weeks'), 'd'=>$langs->trans('Days'), 'h'=>$langs->trans('Hours'), 'i'=>$langs->trans('Minutes')); + $valuetoshow =$TDurationTypes[$obj->{$value}]; } $class .= ($class ? ' ' : '').'tddict'; if ($value == 'note' && $id == 10) { @@ -2450,6 +2459,10 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '') print ''; print $form->selectyesno("block_if_negative", (!empty($obj->{$value}) ? $obj->{$value}:''), 1); print ''; + } elseif ($value == 'type_duration') { + print ''; + print $form->selectTypeDuration('', $obj->{$value}, array('i','h')); + print ''; } else { $fieldValue = isset($obj->{$value}) ? $obj->{$value}: ''; diff --git a/htdocs/install/mysql/data/llx_c_availability.sql b/htdocs/install/mysql/data/llx_c_availability.sql index 7291c399da0..e3c043d9ac9 100644 --- a/htdocs/install/mysql/data/llx_c_availability.sql +++ b/htdocs/install/mysql/data/llx_c_availability.sql @@ -26,9 +26,9 @@ -- delete from llx_c_availability; -INSERT INTO llx_c_availability (rowid,code,label,active,position) VALUES (1, 'AV_NOW', 'Immediate', 1, 10); -INSERT INTO llx_c_availability (rowid,code,label,active,position) VALUES (2, 'AV_1W', '1 week', 1, 20); -INSERT INTO llx_c_availability (rowid,code,label,active,position) VALUES (3, 'AV_2W', '2 weeks', 1, 30); -INSERT INTO llx_c_availability (rowid,code,label,active,position) VALUES (4, 'AV_3W', '3 weeks', 1, 40); -INSERT INTO llx_c_availability (rowid,code,label,active,position) VALUES (5, 'AV_4W', '4 weeks', 1, 50); +INSERT INTO llx_c_availability (rowid,code,label,type_duration,number,active,position) VALUES (1, 'AV_NOW', 'Immediate', null, 0, 1, 10); +INSERT INTO llx_c_availability (rowid,code,label,type_duration,number,active,position) VALUES (2, 'AV_1W', '1 week', 'w', 1, 1, 20); +INSERT INTO llx_c_availability (rowid,code,label,type_duration,number,active,position) VALUES (3, 'AV_2W', '2 weeks', 'w', 2, 1, 30); +INSERT INTO llx_c_availability (rowid,code,label,type_duration,number,active,position) VALUES (4, 'AV_3W', '3 weeks', 'w', 3, 1, 40); +INSERT INTO llx_c_availability (rowid,code,label,type_duration,number,active,position) VALUES (5, 'AV_4W', '4 weeks', 'w', 4, 1, 50); diff --git a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql index 8e1a713ecf7..2cd3612bb09 100644 --- a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql +++ b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql @@ -276,3 +276,13 @@ UPDATE llx_c_ticket_type SET use_default=1 WHERE code='OTHER' AND NOT EXISTS(SEL UPDATE llx_c_country SET eec=0 WHERE eec IS NULL; ALTER TABLE llx_c_country MODIFY COLUMN eec tinyint DEFAULT 0 NOT NULL; + +ALTER TABLE llx_c_availability ADD COLUMN type_duration char(1); +ALTER TABLE llx_c_availability ADD COLUMN number real DEFAULT 0; + +delete from llx_c_availability WHERE rowid IN (1,2,3,4,5); +INSERT INTO llx_c_availability (rowid,code,label,type_duration,number,active,position) VALUES (1, 'AV_NOW', 'Immediate', null, 0, 1, 10); +INSERT INTO llx_c_availability (rowid,code,label,type_duration,number,active,position) VALUES (2, 'AV_1W', '1 week', 'w', 1, 1, 20); +INSERT INTO llx_c_availability (rowid,code,label,type_duration,number,active,position) VALUES (3, 'AV_2W', '2 weeks', 'w', 2, 1, 30); +INSERT INTO llx_c_availability (rowid,code,label,type_duration,number,active,position) VALUES (4, 'AV_3W', '3 weeks', 'w', 3, 1, 40); +INSERT INTO llx_c_availability (rowid,code,label,type_duration,number,active,position) VALUES (5, 'AV_4W', '4 weeks', 'w', 4, 1, 50); diff --git a/htdocs/install/mysql/tables/llx_c_availability.sql b/htdocs/install/mysql/tables/llx_c_availability.sql index b36d89870b4..dd999128f36 100644 --- a/htdocs/install/mysql/tables/llx_c_availability.sql +++ b/htdocs/install/mysql/tables/llx_c_availability.sql @@ -23,6 +23,8 @@ create table llx_c_availability rowid integer AUTO_INCREMENT PRIMARY KEY, code varchar(30) NOT NULL, label varchar(128) NOT NULL, + type_duration char(1), + number real, active tinyint DEFAULT 1 NOT NULL, position integer NOT NULL DEFAULT 0 )ENGINE=innodb; From fb2fb46d17ae59805ca5df50053c8755fbe5c376 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 7 Mar 2022 16:04:55 +0100 Subject: [PATCH 051/610] FIX Drag and drop line of files on join files tab --- htdocs/core/ajax/row.php | 18 ++++++--- htdocs/core/class/html.formfile.class.php | 38 +++++++++---------- .../tpl/document_actions_post_headers.tpl.php | 2 +- 3 files changed, 32 insertions(+), 26 deletions(-) diff --git a/htdocs/core/ajax/row.php b/htdocs/core/ajax/row.php index 0b1106ca20a..8b16cd4699c 100644 --- a/htdocs/core/ajax/row.php +++ b/htdocs/core/ajax/row.php @@ -81,8 +81,6 @@ if (GETPOST('roworder', 'alpha', 3) && GETPOST('table_element_line', 'aZ09', 3) $perm = 1; } elseif ($table_element_line == 'facturedet_rec' && $user->rights->facture->creer) { $perm = 1; - } elseif ($table_element_line == 'ecm_files' && $user->rights->ecm->creer) { - $perm = 1; } elseif ($table_element_line == 'emailcollector_emailcollectoraction' && $user->admin) { $perm = 1; } elseif ($table_element_line == 'bom_bomline' && $user->rights->bom->write) { @@ -95,10 +93,18 @@ if (GETPOST('roworder', 'alpha', 3) && GETPOST('table_element_line', 'aZ09', 3) $perm = 1; } elseif ($table_element_line == 'facture_fourn_det' && $user->rights->fournisseur->facture->creer) { $perm = 1; - } elseif ($table_element_line == 'ecm_files' && $fk_element == 'fk_product' && (!empty($user->rights->produit->creer) || !empty($user->rights->service->creer))) { - $perm = 1; - } elseif ($table_element_line == 'ecm_files' && $fk_element == 'fk_ticket' && !empty($user->rights->ticket->write)) { - $perm = 1; + } elseif ($table_element_line == 'ecm_files') { // Used when of page "documents.php" + if (!empty($user->rights->ecm->creer)) { + $perm = 1; + } elseif ($fk_element == 'fk_product' && (!empty($user->rights->produit->creer) || !empty($user->rights->service->creer))) { + $perm = 1; + } elseif ($fk_element == 'fk_ticket' && !empty($user->rights->ticket->write)) { + $perm = 1; + } elseif ($fk_element == 'fk_holiday' && !empty($user->rights->holiday->write)) { + $perm = 1; + } elseif ($fk_element == 'fk_soc' && !empty($user->rights->societe->creer)) { + $perm = 1; + } } elseif ($table_element_line == 'product_association' && $fk_element == 'fk_product' && (!empty($user->rights->produit->creer) || !empty($user->rights->service->creer))) { $perm = 1; } elseif ($table_element_line == 'projet_task' && $fk_element == 'fk_projet' && $user->rights->projet->creer) { diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 26d39674e08..cad584e8731 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -1281,12 +1281,22 @@ class FormFile } print ''; print ''; - if (!$disablemove) { + if (empty($disablemove) && count($filearray) > 1) { print ''; } print "\n"; } + // Get list of files stored into database for same relative directory + if ($relativedir) { + completeFileArrayWithDatabaseInfo($filearray, $relativedir); + + //var_dump($sortfield.' - '.$sortorder); + if ($sortfield && $sortorder) { // If $sortfield is for example 'position_name', we will sort on the property 'position_name' (that is concat of position+name) + $filearray = dol_sort_array($filearray, $sortfield, $sortorder); + } + } + print ''; //print $url.' sortfield='.$sortfield.' sortorder='.$sortorder; print_liste_field_titre('Documents2', $url, "name", "", $param, '', $sortfield, $sortorder, 'left '); @@ -1299,21 +1309,11 @@ class FormFile print_liste_field_titre(''); // Action button print_liste_field_titre(''); - if (!$disablemove) { + if (empty($disablemove) && count($filearray) > 1) { print_liste_field_titre(''); } print "\n"; - // Get list of files stored into database for same relative directory - if ($relativedir) { - completeFileArrayWithDatabaseInfo($filearray, $relativedir); - - //var_dump($sortfield.' - '.$sortorder); - if ($sortfield && $sortorder) { // If $sortfield is for example 'position_name', we will sort on the property 'position_name' (that is concat of position+name) - $filearray = dol_sort_array($filearray, $sortfield, $sortorder); - } - } - $nboffiles = count($filearray); if ($nboffiles > 0) { include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; @@ -1508,18 +1508,18 @@ class FormFile } print ""; - if (empty($disablemove)) { + if (empty($disablemove) && count($filearray) > 1) { if ($nboffiles > 1 && $conf->browser->layout != 'phone') { print ''; if ($i > 0) { print 'id.'">'.img_up('default', 0, 'imgupforline').''; } - if ($i < $nboffiles - 1) { + if ($i < ($nboffiles - 1)) { print 'id.'">'.img_down('default', 0, 'imgdownforline').''; } print ''; } else { - print 'browser->layout != 'phone' && empty($disablemove)) ? ' class="linecolmove tdlineupdown center"' : ' class="linecolmove center"').'>'; + print 'browser->layout != 'phone') ? ' class="linecolmove tdlineupdown center"' : ' class="linecolmove center"').'>'; print ''; } } @@ -1529,7 +1529,7 @@ class FormFile print ''; print ''; print ''; - if (empty($disablemove)) { + if (empty($disablemove) && count($filearray) > 1) { print ''; } } @@ -1540,7 +1540,7 @@ class FormFile } if ($nboffiles == 0) { $colspan = '6'; - if (empty($disablemove)) { + if (empty($disablemove) && count($filearray) > 1) { $colspan++; // 6 columns or 7 } print ''; @@ -2030,7 +2030,7 @@ class FormFile print '
'; print ''; - print ''; + print '
'; print ''; print_liste_field_titre( $langs->trans("Links"), @@ -2115,7 +2115,7 @@ class FormFile print ''; +print ''; +print ''; +print ''; +print ''; +print ''; + /* print ''; print ''; diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index e30adc2f860..3267b7b8b67 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -220,7 +220,7 @@ if (empty($reshook)) { } } - $result = $object->createFromClone($user, $socid, (GETPOSTISSET('entity') ? GETPOST('entity', 'int') : null), GETPOSTISSET('update_prices')); + $result = $object->createFromClone($user, $socid, (GETPOSTISSET('entity') ? GETPOST('entity', 'int') : null), (GETPOST('update_prices', 'aZ') ? true : false)); if ($result > 0) { header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result); exit(); @@ -1915,7 +1915,7 @@ if ($action == 'create') { // 'text' => $langs->trans("ConfirmClone"), // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $form->select_company(GETPOST('socid', 'int'), 'socid', '(s.client=1 OR s.client=2 OR s.client=3)')), - array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans('PuttingPricesUpToDate'), 'value' => 1), + array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans('PuttingPricesUpToDate'), 'value' => (!empty($conf->global->PROPOSAL_CLONE_UPDATE_PRICES) ? 1 : 0)), ); if (!empty($conf->global->PROPAL_CLONE_DATE_DELIVERY) && !empty($object->delivery_date)) { $formquestion[] = array('type' => 'date', 'name' => 'date_delivery', 'label' => $langs->trans("DeliveryDate"), 'value' => $object->delivery_date); diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index b6e41c1f9d5..eb890560d36 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -412,4 +412,4 @@ SwitchOnSaleStatus=Switch on sale status SwitchOnPurchaseStatus=Switch on purchase status StockMouvementExtraFields= Extra Fields (stock mouvement) InventoryExtraFields= Extra Fields (inventory) -PuttingPricesUpToDate=Update prices +PuttingPricesUpToDate=Update prices with current known prices diff --git a/htdocs/langs/en_US/propal.lang b/htdocs/langs/en_US/propal.lang index db7b559a8a7..f12832129a8 100644 --- a/htdocs/langs/en_US/propal.lang +++ b/htdocs/langs/en_US/propal.lang @@ -54,6 +54,7 @@ NoDraftProposals=No draft proposals CopyPropalFrom=Create commercial proposal by copying existing proposal CreateEmptyPropal=Create empty commercial proposal or from list of products/services DefaultProposalDurationValidity=Default commercial proposal validity duration (in days) +DefaultPuttingPricesUpToDate=By default update prices with current known prices on cloning a proposal UseCustomerContactAsPropalRecipientIfExist=Use contact/address with type 'Contact following-up proposal' if defined instead of third party address as proposal recipient address ConfirmClonePropal=Are you sure you want to clone the commercial proposal %s? ConfirmReOpenProp=Are you sure you want to open back the commercial proposal %s? diff --git a/htdocs/langs/fr_FR/products.lang b/htdocs/langs/fr_FR/products.lang index c99f15a4613..97443fa3f64 100644 --- a/htdocs/langs/fr_FR/products.lang +++ b/htdocs/langs/fr_FR/products.lang @@ -411,4 +411,4 @@ Rank=Classement SwitchOnSaleStatus=Basculer le statut En vente SwitchOnPurchaseStatus=Basculer le statut En achat StockMouvementExtraFields= Champs supplémentaires (mouvement de stock) -PuttingPricesUpToDate=Mettre à jour les tarifs +PuttingPricesUpToDate=Mettre à jour les prix diff --git a/htdocs/langs/fr_FR/propal.lang b/htdocs/langs/fr_FR/propal.lang index c32edfad8c1..54723a5747f 100644 --- a/htdocs/langs/fr_FR/propal.lang +++ b/htdocs/langs/fr_FR/propal.lang @@ -54,6 +54,7 @@ NoDraftProposals=Pas de propositions brouillons CopyPropalFrom=Créer proposition/devis par recopie d'un proposition existante CreateEmptyPropal=Créer proposition/devis vierge ou avec la liste des produits/services DefaultProposalDurationValidity=Délai de validité par défaut (en jours) +DefaultPuttingPricesUpToDate=Par défaut, mettre à jour les prix lors de clonage d'une proposition commerciale UseCustomerContactAsPropalRecipientIfExist=Utiliser l'adresse de 'contact suivi client' si définie plutôt que l'adresse du tiers comme destinataire des propositions ConfirmClonePropal=Êtes-vous sûr de vouloir cloner la proposition commerciale %s ? ConfirmReOpenProp=Êtes-vous sûr de vouloir réouvrir la proposition commerciale %s ? From bbe3cfffb187e84491c265057015043afc27d289 Mon Sep 17 00:00:00 2001 From: lvessiller Date: Tue, 8 Mar 2022 10:17:47 +0100 Subject: [PATCH 058/610] FIX stickler-ci --- htdocs/admin/propal.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/propal.php b/htdocs/admin/propal.php index f0996b02f75..da886630ac9 100644 --- a/htdocs/admin/propal.php +++ b/htdocs/admin/propal.php @@ -198,9 +198,9 @@ if ($action == 'updateMask') { // par appel methode canBeActivated dolibarr_set_const($db, "PROPALE_ADDON", $value, 'chaine', 0, '', $conf->entity); -} elseif (preg_match('/set_(.*)/',$action,$reg)) { +} elseif (preg_match('/set_(.*)/', $action, $reg)) { $code = $reg[1]; - $value=(GETPOST($code) ? GETPOST($code) : 1); + $value = (GETPOST($code) ? GETPOST($code) : 1); $res = dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity); if (!($res > 0)) { @@ -214,7 +214,7 @@ if ($action == 'updateMask') { header("Location: " . $_SERVER["PHP_SELF"]); exit(); } -} elseif (preg_match('/del_(.*)/',$action,$reg)) { +} elseif (preg_match('/del_(.*)/', $action, $reg)) { $code = $reg[1]; $res = dolibarr_del_const($db, $code, $conf->entity); From 397776d4a42edeaddd7a36ece03ae833020b276a Mon Sep 17 00:00:00 2001 From: lvessiller Date: Tue, 8 Mar 2022 11:29:01 +0100 Subject: [PATCH 059/610] FIX check mandatory thirdparty fields for mass action --- htdocs/compta/facture/card.php | 39 ----------------- htdocs/compta/facture/class/facture.class.php | 42 ++++++++++++++++++- 2 files changed, 41 insertions(+), 40 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index d3e5a0062b0..573f1548b9a 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -566,45 +566,6 @@ if (empty($reshook)) // Check parameters - // Check for mandatory fields in thirdparty (defined into setup) - $array_to_check = array('IDPROF1', 'IDPROF2', 'IDPROF3', 'IDPROF4', 'IDPROF5', 'IDPROF6', 'EMAIL'); - foreach ($array_to_check as $key) - { - $keymin = strtolower($key); - $i = (int) preg_replace('/[^0-9]/', '', $key); - $vallabel = $object->thirdparty->$keymin; - - if ($i > 0) - { - if ($object->thirdparty->isACompany()) - { - // Check for mandatory prof id (but only if country is other than ours) - if ($mysoc->country_id > 0 && $object->thirdparty->country_id == $mysoc->country_id) - { - $idprof_mandatory = 'SOCIETE_'.$key.'_INVOICE_MANDATORY'; - if (!$vallabel && !empty($conf->global->$idprof_mandatory)) - { - $langs->load("errors"); - $error++; - setEventMessages($langs->trans('ErrorProdIdIsMandatory', $langs->transcountry('ProfId'.$i, $object->thirdparty->country_code)).' ('.$langs->trans("ForbiddenBySetupRules").')', null, 'errors'); - } - } - } - } else { - //var_dump($conf->global->SOCIETE_EMAIL_MANDATORY); - if ($key == 'EMAIL') - { - // Check for mandatory - if (!empty($conf->global->SOCIETE_EMAIL_INVOICE_MANDATORY) && !isValidEMail($object->thirdparty->email)) - { - $langs->load("errors"); - $error++; - setEventMessages($langs->trans("ErrorBadEMail", $object->thirdparty->email).' ('.$langs->trans("ForbiddenBySetupRules").')', null, 'errors'); - } - } - } - } - // Check for mandatory fields in invoice $array_to_check = array('REF_CUSTOMER'=>'RefCustomer'); foreach ($array_to_check as $key => $val) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 63a7b2f8e21..6ae01621b2e 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2470,7 +2470,7 @@ class Facture extends CommonInvoice */ public function validate($user, $force_number = '', $idwarehouse = 0, $notrigger = 0, $batch_rule = 0) { - global $conf, $langs; + global $conf, $langs, $mysoc; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; $productStatic = null; @@ -2512,6 +2512,46 @@ class Facture extends CommonInvoice return -1; } + // Check for mandatory fields in thirdparty (defined into setup) + $array_to_check = array('IDPROF1', 'IDPROF2', 'IDPROF3', 'IDPROF4', 'IDPROF5', 'IDPROF6', 'EMAIL'); + foreach ($array_to_check as $key) + { + $keymin = strtolower($key); + $i = (int) preg_replace('/[^0-9]/', '', $key); + $vallabel = $this->thirdparty->$keymin; + + if ($i > 0) + { + if ($this->thirdparty->isACompany()) + { + // Check for mandatory prof id (but only if country is other than ours) + if ($mysoc->country_id > 0 && $this->thirdparty->country_id == $mysoc->country_id) + { + $idprof_mandatory = 'SOCIETE_'.$key.'_INVOICE_MANDATORY'; + if (!$vallabel && !empty($conf->global->$idprof_mandatory)) + { + $langs->load("errors"); + $this->error = $langs->trans('ErrorProdIdIsMandatory', $langs->transcountry('ProfId'.$i, $this->thirdparty->country_code)).' ('.$langs->trans("ForbiddenBySetupRules").')'.' ['.$langs->trans('Company').' : '.$this->thirdparty->name.']'; + dol_syslog(__METHOD__.' '.$this->error, LOG_ERR); + return -1; + } + } + } + } else { + if ($key == 'EMAIL') + { + // Check for mandatory + if (!empty($conf->global->SOCIETE_EMAIL_INVOICE_MANDATORY) && !isValidEMail($this->thirdparty->email)) + { + $langs->load("errors"); + $this->error = $langs->trans("ErrorBadEMail", $this->thirdparty->email).' ('.$langs->trans("ForbiddenBySetupRules").')'.' ['.$langs->trans('Company').' : '.$this->thirdparty->name.']'; + dol_syslog(__METHOD__.' '.$this->error, LOG_ERR); + return -1; + } + } + } + } + $this->db->begin(); // Check parameters From 19ad2310125a57069ae76ef774664ac051996c03 Mon Sep 17 00:00:00 2001 From: lvessiller Date: Tue, 8 Mar 2022 12:02:05 +0100 Subject: [PATCH 060/610] FIX stickler-ci --- htdocs/compta/facture/class/facture.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 6ae01621b2e..00734ccb680 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2531,7 +2531,7 @@ class Facture extends CommonInvoice if (!$vallabel && !empty($conf->global->$idprof_mandatory)) { $langs->load("errors"); - $this->error = $langs->trans('ErrorProdIdIsMandatory', $langs->transcountry('ProfId'.$i, $this->thirdparty->country_code)).' ('.$langs->trans("ForbiddenBySetupRules").')'.' ['.$langs->trans('Company').' : '.$this->thirdparty->name.']'; + $this->error = $langs->trans('ErrorProdIdIsMandatory', $langs->transcountry('ProfId'.$i, $this->thirdparty->country_code)).' ('.$langs->trans("ForbiddenBySetupRules").') ['.$langs->trans('Company').' : '.$this->thirdparty->name.']'; dol_syslog(__METHOD__.' '.$this->error, LOG_ERR); return -1; } @@ -2544,7 +2544,7 @@ class Facture extends CommonInvoice if (!empty($conf->global->SOCIETE_EMAIL_INVOICE_MANDATORY) && !isValidEMail($this->thirdparty->email)) { $langs->load("errors"); - $this->error = $langs->trans("ErrorBadEMail", $this->thirdparty->email).' ('.$langs->trans("ForbiddenBySetupRules").')'.' ['.$langs->trans('Company').' : '.$this->thirdparty->name.']'; + $this->error = $langs->trans("ErrorBadEMail", $this->thirdparty->email).' ('.$langs->trans("ForbiddenBySetupRules").') ['.$langs->trans('Company').' : '.$this->thirdparty->name.']'; dol_syslog(__METHOD__.' '.$this->error, LOG_ERR); return -1; } From e9893716519da24ded648c4b51c872ffbccc148d Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Tue, 8 Mar 2022 14:49:26 +0100 Subject: [PATCH 061/610] FIX: better error management at product selling price update --- htdocs/product/class/product.class.php | 3 +- htdocs/product/price.php | 40 +++++++++++++------ .../class/ProductCombination.class.php | 20 +++++++++- 3 files changed, 48 insertions(+), 15 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index ce7a5858a6a..cdab6a18c38 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -2045,7 +2045,8 @@ class Product extends CommonObject $this->db->commit(); } else { $this->db->rollback(); - dol_print_error($this->db); + $this->error = $this->db->lasterror(); + return -1; } } diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 9c084cd8352..704db910147 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -163,11 +163,15 @@ if (empty($reshook)) setEventMessages($object->error, $object->errors, 'errors'); } - if ($error) - { + if (!$error) { //$localtaxarray=array('0'=>$localtax1_type,'1'=>$localtax1,'2'=>$localtax2_type,'3'=>$localtax2); $localtaxarray = array(); // We do not store localtaxes into product, we will use instead the "vat code" to retrieve them. - $object->updatePrice(0, $object->price_base_type, $user, $tva_tx, '', 0, $npr, 0, 0, $localtaxarray, $vatratecode); + $ret = $object->updatePrice(0, $object->price_base_type, $user, $tva_tx, '', 0, $npr, 0, 0, $localtaxarray, $vatratecode); + + if ($ret < 0) { + $error++; + setEventMessages($object->error, $object->errors, 'errors'); + } } if (!$error) @@ -400,14 +404,22 @@ if (empty($reshook)) { // Activating product price by quantity add a new price line with price_by_qty set to 1 $level = GETPOST('level', 'int'); - $object->updatePrice(0, $object->price_base_type, $user, $object->tva_tx, 0, $level, $object->tva_npr, 1); + $ret = $object->updatePrice(0, $object->price_base_type, $user, $object->tva_tx, 0, $level, $object->tva_npr, 1); + + if ($ret < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + } } // Unset Price by quantity if ($action == 'disable_price_by_qty') { // Disabling product price by quantity add a new price line with price_by_qty set to 0 $level = GETPOST('level', 'int'); - $object->updatePrice(0, $object->price_base_type, $user, $object->tva_tx, 0, $level, $object->tva_npr, 0); + $ret = $object->updatePrice(0, $object->price_base_type, $user, $object->tva_tx, 0, $level, $object->tva_npr, 0); + + if ($ret < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + } } if ($action == 'edit_price_by_qty') @@ -1444,17 +1456,21 @@ if ((empty($conf->global->PRODUIT_CUSTOMER_PRICES) || $action == 'showlog_defaul { $db->free($result); - // Il doit au moins y avoir la ligne de prix initial. - // On l'ajoute donc pour remettre a niveau (pb vieilles versions) - // We emulate the change of the price from interface with the same value than the one into table llx_product + // Il doit au moins y avoir la ligne de prix initial. + // On l'ajoute donc pour remettre a niveau (pb vieilles versions) + // We emulate the change of the price from interface with the same value than the one into table llx_product if (!empty($conf->global->PRODUIT_MULTIPRICES)) { - $object->updatePrice(($object->multiprices_base_type[1] == 'TTC' ? $object->multiprices_ttc[1] : $object->multiprices[1]), $object->multiprices_base_type[1], $user, (empty($object->multiprices_tva_tx[1]) ? 0 : $object->multiprices_tva_tx[1]), ($object->multiprices_base_type[1] == 'TTC' ? $object->multiprices_min_ttc[1] : $object->multiprices_min[1]), 1); + $ret = $object->updatePrice(($object->multiprices_base_type[1] == 'TTC' ? $object->multiprices_ttc[1] : $object->multiprices[1]), $object->multiprices_base_type[1], $user, (empty($object->multiprices_tva_tx[1]) ? 0 : $object->multiprices_tva_tx[1]), ($object->multiprices_base_type[1] == 'TTC' ? $object->multiprices_min_ttc[1] : $object->multiprices_min[1]), 1); } else { - $object->updatePrice(($object->price_base_type == 'TTC' ? $object->price_ttc : $object->price), $object->price_base_type, $user, $object->tva_tx, ($object->price_base_type == 'TTC' ? $object->price_min_ttc : $object->price_min)); + $ret = $object->updatePrice(($object->price_base_type == 'TTC' ? $object->price_ttc : $object->price), $object->price_base_type, $user, $object->tva_tx, ($object->price_base_type == 'TTC' ? $object->price_min_ttc : $object->price_min)); } - $result = $db->query($sql); - $num = $db->num_rows($result); + if ($ret < 0) { + dol_print_error($db, $object->error, $object->errors); + } else { + $result = $db->query($sql); + $num = $db->num_rows($result); + } } if ($num > 0) { diff --git a/htdocs/variants/class/ProductCombination.class.php b/htdocs/variants/class/ProductCombination.class.php index 336503056f9..93960b62f9e 100644 --- a/htdocs/variants/class/ProductCombination.class.php +++ b/htdocs/variants/class/ProductCombination.class.php @@ -534,7 +534,14 @@ class ProductCombination $new_price += $variation_price; } - $child->updatePrice($new_price, $new_type, $user, $new_vat, $new_min_price, $i, $new_npr, $new_psq, 0, array(), $parent->default_vat_code); + $ret = $child->updatePrice($new_price, $new_type, $user, $new_vat, $new_min_price, $i, $new_npr, $new_psq, 0, array(), $parent->default_vat_code); + + if ($ret < 0) { + $this->db->rollback(); + $this->error = $child->error; + $this->errors = $child->errors; + return $ret; + } } } } else { @@ -556,7 +563,14 @@ class ProductCombination $new_price += $this->variation_price; } - $child->updatePrice($new_price, $new_type, $user, $new_vat, $new_min_price, 1, $new_npr, $new_psq); + $ret = $child->updatePrice($new_price, $new_type, $user, $new_vat, $new_min_price, 1, $new_npr, $new_psq); + + if ($ret < 0) { + $this->db->rollback(); + $this->error = $child->error; + $this->errors = $child->errors; + return $ret; + } } $this->db->commit(); @@ -565,6 +579,8 @@ class ProductCombination } $this->db->rollback(); + $this->error = $child->error; + $this->errors = $child->errors; return -1; } From f837845c122840182ca1f52e0f5a50066accbc70 Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Tue, 8 Mar 2022 15:07:02 +0100 Subject: [PATCH 062/610] FIX: still prevent project creation if PROJECTLEADER role unavailable, but with a specific error message --- htdocs/langs/en_US/projects.lang | 3 ++- htdocs/projet/card.php | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang index 2aedbd53377..d93bbbe4a9d 100644 --- a/htdocs/langs/en_US/projects.lang +++ b/htdocs/langs/en_US/projects.lang @@ -267,4 +267,5 @@ NewInvoice=New invoice OneLinePerTask=One line per task OneLinePerPeriod=One line per period RefTaskParent=Ref. Parent Task -ProfitIsCalculatedWith=Profit is calculated using \ No newline at end of file +ProfitIsCalculatedWith=Profit is calculated using +ErrorPROJECTLEADERRoleMissingOrDeActivatedPleaseRestoreItInContactTypesDictionary=The "PROJECTLEADER" role is missing or has been de-activited, please restore in the dictionary of contact types \ No newline at end of file diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index ab61a613734..8c921c0868e 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -178,7 +178,10 @@ if (empty($reshook)) $result = $object->add_contact($user->id, $typeofcontact, 'internal'); // -3 means type not found (PROJECTLEADER renamed, de-activated or deleted), so don't prevent creation if it has been the case - if ($result < 0 && $result != -3) { + if ($result == -3) { + setEventMessage('ErrorPROJECTLEADERRoleMissingOrDeActivatedPleaseRestoreItInContactTypesDictionary', 'errors'); + $error++; + } elseif ($result < 0) { $langs->load("errors"); setEventMessages($object->error, $object->errors, 'errors'); $error++; From 8e944b8b6de998f1c8a03a22044015d7ffb7a9ee Mon Sep 17 00:00:00 2001 From: Ferran Marcet Date: Tue, 8 Mar 2022 17:34:51 +0100 Subject: [PATCH 063/610] Fix: Error whem generating supplier payment pdf --- .../core/modules/supplier_payment/doc/pdf_standard.modules.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php b/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php index b6da2d4c294..1f32f645116 100644 --- a/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php @@ -2,6 +2,7 @@ /* Copyright (C) 2010-2011 Juanjo Menent * Copyright (C) 2010-2014 Laurent Destailleur * Copyright (C) 2015 Marcos García + * Copyright (C) 2022 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 @@ -132,7 +133,7 @@ class pdf_standard extends ModelePDFSuppliersPayments $this->db = $db; $this->name = "standard"; $this->description = $langs->trans('DocumentModelStandardPDF'); - $this->update_main_doc_field = 1; // Save the name of generated file as the main doc when generating a doc with this template + $this->update_main_doc_field = 0; // Save the name of generated file as the main doc when generating a doc with this template // Page size for A4 format $this->type = 'pdf'; From a14bf4b6217ae2e72f5165a54613283e9d0a211d Mon Sep 17 00:00:00 2001 From: Ferran Marcet Date: Tue, 8 Mar 2022 18:02:55 +0100 Subject: [PATCH 064/610] Fix: New hidden option MAIN_LINK_BY_REF_IN_LINKTO don't work --- htdocs/core/class/html.form.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 821d87dcd82..f91063653a4 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -16,7 +16,7 @@ * Copyright (C) 2012 Cedric Salvador * Copyright (C) 2012-2015 Raphaël Doursenaud * Copyright (C) 2014-2020 Alexandre Spangaro - * Copyright (C) 2018-2021 Ferran Marcet + * Copyright (C) 2018-2022 Ferran Marcet * Copyright (C) 2018-2021 Frédéric France * Copyright (C) 2018 Nicolas ZABOURI * Copyright (C) 2018 Christophe Battarel @@ -8482,6 +8482,7 @@ class Form print '
'; print ''; print ''; + print ''; print ''; print '
'; print ''.img_edit().''; // id= is included into $param if ($permissiontodelete) { - print '   '.img_delete().''; // id= is included into $param + print '   '.img_delete().''; // id= is included into $param } else { print ' '; } diff --git a/htdocs/core/tpl/document_actions_post_headers.tpl.php b/htdocs/core/tpl/document_actions_post_headers.tpl.php index fdc315a588d..8b48a63e34d 100644 --- a/htdocs/core/tpl/document_actions_post_headers.tpl.php +++ b/htdocs/core/tpl/document_actions_post_headers.tpl.php @@ -66,7 +66,7 @@ if (in_array($modulepart, array('product', 'produit', 'societe', 'user', 'ticket * Confirm form to delete a file */ -if ($action == 'deletefile') { +if ($action == 'deletefile' || $action == 'deletelink') { $langs->load("companies"); // Need for string DeleteFile+ConfirmDeleteFiles print $form->formconfirm( $_SERVER["PHP_SELF"].'?id='.$object->id.'&urlfile='.urlencode(GETPOST("urlfile")).'&linkid='.GETPOST('linkid', 'int').(empty($param) ? '' : $param), From ec77b81d1a6acac46323e952cfe7d8d65c72eaa4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 7 Mar 2022 18:07:20 +0100 Subject: [PATCH 052/610] Prepare 15.0.1 --- htdocs/filefunc.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index 3b21a9bbf37..771cd4ec8a0 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -34,7 +34,7 @@ if (!defined('DOL_APPLICATION_TITLE')) { define('DOL_APPLICATION_TITLE', 'Dolibarr'); } if (!defined('DOL_VERSION')) { - define('DOL_VERSION', '15.0.0'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c + define('DOL_VERSION', '15.0.1'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c } if (!defined('EURO')) { From af542746038e19c031b0c22d329ecf3df7c668c3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 7 Mar 2022 20:09:14 +0100 Subject: [PATCH 053/610] css --- htdocs/theme/eldy/global.inc.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index a4020edccdb..123d24f54f3 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -168,6 +168,10 @@ table.liste th.wrapcolumntitle.liste_titre:not(.maxwidthsearch), table.liste td. .liste_titre input[name=search_day_date_when], .liste_titre input[name=search_month_date_when], .liste_titre input[name=search_year_date_when], .liste_titre input[name=search_dtstartday], .liste_titre input[name=search_dtendday], .liste_titre input[name=search_dtstartmonth], .liste_titre input[name=search_dtendmonth], */ +.liste_titre input[name=search_month] { + margin-right: 4px; +} + select#date_startday, select#date_startmonth, select#date_endday, select#date_endmonth, select#reday, select#remonth, input, input.flat, form.flat select, select, select.flat, .dataTables_length label select { border: none; From 70810dfbab0ad6c22dab26b0f29acdc4c2b065e4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 8 Mar 2022 02:26:04 +0100 Subject: [PATCH 054/610] Doc --- ChangeLog | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/ChangeLog b/ChangeLog index a65a8f21329..e55cfad84d1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,34 @@ English Dolibarr ChangeLog -------------------------------------------------------------- +***** ChangeLog for 15.0.1 compared to 15.0.0 ***** +FIX: #19777 #20281 +FIX: bad position of extrafields for interventions +FIX: Blocking situation when a payment was deleted in bank. +FIX: creation of the shipment if order contains services +FIX: Drag and drop line of files on join files tab +FIX: Error management on mass action "Approve holiday" +FIX: error with php8 +FIX: in case of VAT refund, negative amount must be allowed +FIX: invoice pdf: lines originating from deposits were not detailed anymore +FIX: Invoice - When you create an invoice for a given thirdparty, fk_account is not retrieved from company card +FIX: list of visible type of event was not correctly filtered +FIX: Missing or bad permissions +FIX: Missing the field date start/end in export supplier invoice/order +FIX: On large proposal or invoice, fix n(n+1) sql into a n sql. +FIX: options should not exists on invoices +FIX: payment not completed when using Paypal. +FIX: permission to download files of expense report with readall. +FIX- Preview icon in documents list PDF in the admin page third-party +FIX: shipping list, e.shipping_method_id should be e.fk_shipping_method. +FIX: Show product photo on Supplier order Cornas model. +FIX: User name in ManufacturingOrder +FIX: viewimage.php blocks requests with multicompany from other enties +FIX: #yogosha9048 +FIX: #yogosha9054 +FIX: #yogosha9095 + + ***** ChangeLog for 15.0.0 compared to 14.0.0 ***** For users: From 87b187bded77fc30f63a30986a45619906366e97 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 8 Mar 2022 03:43:40 +0100 Subject: [PATCH 055/610] FIX #20279 Accountancy - PostGreSQL - Error on mass update lines already binded --- htdocs/accountancy/customer/lines.php | 6 +++--- htdocs/accountancy/supplier/lines.php | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index c45e7b27b0a..63314208883 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -121,9 +121,9 @@ if (is_array($changeaccount) && count($changeaccount) > 0) { { $db->begin(); - $sql1 = "UPDATE ".MAIN_DB_PREFIX."facturedet as l"; - $sql1 .= " SET l.fk_code_ventilation=".(GETPOST('account_parent', 'int') > 0 ? GETPOST('account_parent', 'int') : '0'); - $sql1 .= ' WHERE l.rowid IN ('.implode(',', $changeaccount).')'; + $sql1 = "UPDATE ".MAIN_DB_PREFIX."facturedet"; + $sql1 .= " SET fk_code_ventilation=".(GETPOST('account_parent', 'int') > 0 ? GETPOST('account_parent', 'int') : '0'); + $sql1 .= ' WHERE rowid IN ('.implode(',', $changeaccount).')'; dol_syslog('accountancy/customer/lines.php::changeaccount sql= '.$sql1); $resql1 = $db->query($sql1); diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php index 30976287769..2edf3d01791 100644 --- a/htdocs/accountancy/supplier/lines.php +++ b/htdocs/accountancy/supplier/lines.php @@ -123,9 +123,9 @@ if (is_array($changeaccount) && count($changeaccount) > 0) { { $db->begin(); - $sql1 = "UPDATE ".MAIN_DB_PREFIX."facture_fourn_det as l"; - $sql1 .= " SET l.fk_code_ventilation=".(GETPOST('account_parent', 'int') > 0 ? GETPOST('account_parent', 'int') : '0'); - $sql1 .= ' WHERE l.rowid IN ('.implode(',', $changeaccount).')'; + $sql1 = "UPDATE ".MAIN_DB_PREFIX."facture_fourn_det"; + $sql1 .= " SET fk_code_ventilation=".(GETPOST('account_parent', 'int') > 0 ? GETPOST('account_parent', 'int') : '0'); + $sql1 .= ' WHERE rowid IN ('.implode(',', $changeaccount).')'; dol_syslog('accountancy/supplier/lines.php::changeaccount sql= '.$sql1); $resql1 = $db->query($sql1); From 44577b2d1a636dee4340ef6ea41e852ccc4b0626 Mon Sep 17 00:00:00 2001 From: Quentin VIAL-GOUTEYRON Date: Tue, 8 Mar 2022 08:51:31 +0100 Subject: [PATCH 056/610] fix remove delete and add update lxx c availability --- htdocs/install/mysql/migration/15.0.0-16.0.0.sql | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql index c81204ae954..297c11bd7e3 100644 --- a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql +++ b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql @@ -282,11 +282,11 @@ ALTER TABLE llx_c_country MODIFY COLUMN eec tinyint DEFAULT 0 NOT NULL; ALTER TABLE llx_c_availability ADD COLUMN type_duration char(1); ALTER TABLE llx_c_availability ADD COLUMN number real DEFAULT 0; -INSERT INTO llx_c_availability (rowid,code,label,type_duration,number,active,position) VALUES (1, 'AV_NOW', 'Immediate', null, 0, 1, 10); -INSERT INTO llx_c_availability (rowid,code,label,type_duration,number,active,position) VALUES (2, 'AV_1W', '1 week', 'w', 1, 1, 20); -INSERT INTO llx_c_availability (rowid,code,label,type_duration,number,active,position) VALUES (3, 'AV_2W', '2 weeks', 'w', 2, 1, 30); -INSERT INTO llx_c_availability (rowid,code,label,type_duration,number,active,position) VALUES (4, 'AV_3W', '3 weeks', 'w', 3, 1, 40); -INSERT INTO llx_c_availability (rowid,code,label,type_duration,number,active,position) VALUES (5, 'AV_4W', '4 weeks', 'w', 4, 1, 50); +INSERT INTO llx_c_availability (code,label,type_duration,number,active,position) VALUES ( 'AV_NOW', 'Immediate', null, 0, 1, 10); +INSERT INTO llx_c_availability (code,label,type_duration,number,active,position) VALUES ( 'AV_1W', '1 week', 'w', 1, 1, 20); +INSERT INTO llx_c_availability (code,label,type_duration,number,active,position) VALUES ( 'AV_2W', '2 weeks', 'w', 2, 1, 30); +INSERT INTO llx_c_availability (code,label,type_duration,number,active,position) VALUES ( 'AV_3W', '3 weeks', 'w', 3, 1, 40); +INSERT INTO llx_c_availability (code,label,type_duration,number,active,position) VALUES ( 'AV_4W', '4 weeks', 'w', 4, 1, 50); UPDATE llx_c_availability SET type_duration = null, number = 0 WHERE code = 'AV_NOW'; UPDATE llx_c_availability SET type_duration = 'w', number = 1 WHERE code = 'AV_1W'; UPDATE llx_c_availability SET type_duration = 'w', number = 2 WHERE code = 'AV_2W'; From 2561fcbb85abd89c6ec21fc37c7463242d834fb2 Mon Sep 17 00:00:00 2001 From: lvessiller Date: Tue, 8 Mar 2022 10:06:57 +0100 Subject: [PATCH 057/610] FIX translate update prices and add const in proposal setup --- htdocs/admin/propal.php | 51 ++++++++++++++++++++++++++++++++ htdocs/comm/propal/card.php | 4 +-- htdocs/langs/en_US/products.lang | 2 +- htdocs/langs/en_US/propal.lang | 1 + htdocs/langs/fr_FR/products.lang | 2 +- htdocs/langs/fr_FR/propal.lang | 1 + 6 files changed, 57 insertions(+), 4 deletions(-) diff --git a/htdocs/admin/propal.php b/htdocs/admin/propal.php index 6384c561967..f0996b02f75 100644 --- a/htdocs/admin/propal.php +++ b/htdocs/admin/propal.php @@ -198,6 +198,37 @@ if ($action == 'updateMask') { // par appel methode canBeActivated dolibarr_set_const($db, "PROPALE_ADDON", $value, 'chaine', 0, '', $conf->entity); +} elseif (preg_match('/set_(.*)/',$action,$reg)) { + $code = $reg[1]; + $value=(GETPOST($code) ? GETPOST($code) : 1); + + $res = dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity); + if (!($res > 0)) { + $error++; + } + + if ($error) { + setEventMessages($langs->trans('Error'), null, 'errors'); + } else { + setEventMessages($langs->trans('SetupSaved'), null, 'mesgs'); + header("Location: " . $_SERVER["PHP_SELF"]); + exit(); + } +} elseif (preg_match('/del_(.*)/',$action,$reg)) { + $code = $reg[1]; + $res = dolibarr_del_const($db, $code, $conf->entity); + + if (!($res > 0)) { + $error++; + } + + if ($error) { + setEventMessages($langs->trans('Error'), null, 'errors'); + } else { + setEventMessages($langs->trans('SetupSaved'), null, 'mesgs'); + header("Location: " . $_SERVER["PHP_SELF"]); + exit(); + } } @@ -593,6 +624,26 @@ print ''; +print ''; +print '
' . $langs->trans('DefaultPuttingPricesUpToDate').''; +if (!empty($conf->use_javascript_ajax)) { + print ajax_constantonoff('PROPOSAL_CLONE_UPDATE_PRICES', array(), $conf->entity, 0, 0, 1, 0); +} else { + if (empty($conf->global->PROPOSAL_CLONE_UPDATE_PRICES)) { + print '' . img_picto($langs->trans('Disabled'), 'switch_off') . ''; + } else { + print '' . img_picto($langs->trans('Enabled'), 'switch_on') . ''; + } +} +print '
'; print ''; From eae3fe78f140e1b7e0f30c1112c6d75867686b36 Mon Sep 17 00:00:00 2001 From: BB2A Anthony Berton Date: Tue, 8 Mar 2022 18:06:26 +0100 Subject: [PATCH 065/610] init --- htdocs/core/lib/functions.lib.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index af5671437ae..5e56ff5b36c 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -8750,7 +8750,7 @@ function getLanguageCodeFromCountryCode($countrycode) */ function complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, $mode = 'add') { - global $hookmanager; + global $hookmanager, $db; if (isset($conf->modules_parts['tabs'][$type]) && is_array($conf->modules_parts['tabs'][$type])) { foreach ($conf->modules_parts['tabs'][$type] as $value) { @@ -8771,7 +8771,18 @@ function complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, complete_substitutions_array($substitutionarray, $langs, $object, array('needforkey'=>$values[2])); $label = make_substitutions($reg[1], $substitutionarray); } else { - $label = $langs->trans($values[2]); + $labeltemp = explode(',', $values[2]); + if (is_array($labeltemp)) { + $label = $langs->trans($labeltemp[0]); + if (!empty($labeltemp[1]) && is_object($object) && !empty($object->id)) { + dol_include_once($labeltemp[2]); + $obj = new $labeltemp[1]($db); + $function = $labeltemp[3]; + $label .= $obj->$function($object->id, $obj); + } + } else { + $label = $langs->trans($values[2]); + } } $head[$h][0] = dol_buildpath(preg_replace('/__ID__/i', ((is_object($object) && !empty($object->id)) ? $object->id : ''), $values[5]), 1); From cef9cf8670842955fca199edaaad25eb799057c9 Mon Sep 17 00:00:00 2001 From: BB2A Anthony Berton Date: Tue, 8 Mar 2022 18:34:56 +0100 Subject: [PATCH 066/610] int --- htdocs/core/lib/functions.lib.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 5e56ff5b36c..109f0fa3f13 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -8778,7 +8778,8 @@ function complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, dol_include_once($labeltemp[2]); $obj = new $labeltemp[1]($db); $function = $labeltemp[3]; - $label .= $obj->$function($object->id, $obj); + $nbrec = $obj->$function($object->id, $obj); + $label .= ''.$nbrec.''; } } else { $label = $langs->trans($values[2]); From 2d93c6b678b5b0bf1c9fb4a345c339edd9845b26 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 8 Mar 2022 19:00:21 +0100 Subject: [PATCH 067/610] Fix template --- .../core/modules/project/doc/pdf_baleine.modules.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/project/doc/pdf_baleine.modules.php b/htdocs/core/modules/project/doc/pdf_baleine.modules.php index 716c88e1f92..776f2f9d1e6 100644 --- a/htdocs/core/modules/project/doc/pdf_baleine.modules.php +++ b/htdocs/core/modules/project/doc/pdf_baleine.modules.php @@ -432,10 +432,12 @@ class pdf_baleine extends ModelePDFProjects $pdf->MultiCell($this->posxlabel - $this->posxref, 3, $outputlangs->convToOutputCharset($ref), 0, 'L'); // Workload $pdf->SetXY($this->posxworkload, $curY); + $pdf->SetFont('', '', $default_font_size - 2); // We use a smaller font $pdf->MultiCell($this->posxprogress - $this->posxworkload, 3, $planned_workload ? $planned_workload : '', 0, 'R'); // Progress $pdf->SetXY($this->posxprogress, $curY); $pdf->MultiCell($this->posxdatestart - $this->posxprogress, 3, $progress, 0, 'R'); + $pdf->SetFont('', '', $default_font_size - 1); // We restore font // Date start and end $pdf->SetXY($this->posxdatestart, $curY); @@ -640,9 +642,11 @@ class pdf_baleine extends ModelePDFProjects $pdf->SetTextColor(0, 0, 60); $pdf->MultiCell(100, 4, $outputlangs->transnoentities("DateStart")." : ".dol_print_date($object->date_start, 'day', false, $outputlangs, true), '', 'R'); - $posy += 6; - $pdf->SetXY($posx, $posy); - $pdf->MultiCell(100, 4, $outputlangs->transnoentities("DateEnd")." : ".dol_print_date($object->date_end, 'day', false, $outputlangs, true), '', 'R'); + if ($object->date_end) { + $posy += 6; + $pdf->SetXY($posx, $posy); + $pdf->MultiCell(100, 4, $outputlangs->transnoentities("DateEnd")." : ".dol_print_date($object->date_end, 'day', false, $outputlangs, true), '', 'R'); + } if (is_object($object->thirdparty)) { $posy += 6; From c7bb6c3c4c5c5f88359eeb4a470b7ecf6e3159f3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 8 Mar 2022 20:46:56 +0100 Subject: [PATCH 068/610] FIX Upload in the filemanager use the Dolibarr methods --- .../browser/default/frmupload.php | 5 ++++- .../connectors/php/commands.php | 20 +++++++++++++++++-- .../core/filemanagerdol/connectors/php/io.php | 3 ++- .../filemanagerdol/connectors/php/upload.php | 4 +++- 4 files changed, 27 insertions(+), 5 deletions(-) diff --git a/htdocs/core/filemanagerdol/browser/default/frmupload.php b/htdocs/core/filemanagerdol/browser/default/frmupload.php index c82581cc51c..7ab5ee3bffa 100644 --- a/htdocs/core/filemanagerdol/browser/default/frmupload.php +++ b/htdocs/core/filemanagerdol/browser/default/frmupload.php @@ -65,6 +65,7 @@ function SetCurrentFolder( resourceType, folderPath ) function OnSubmit() { + console.log("Click on OnSubmit"); if ( document.getElementById('NewFile').value.length == 0 ) { alert( 'Please select a file from your computer' ); @@ -80,6 +81,8 @@ function OnSubmit() function OnUploadCompleted( errorNumber, data ) { + console.log("errorNumber = "+errorNumber); + // Reset the Upload Worker Frame. window.parent.frames['frmUploadWorker'].location = 'javascript:void(0)' ; @@ -106,7 +109,7 @@ function OnUploadCompleted( errorNumber, data ) alert( 'A file with the same name is already available. The uploaded file has been renamed to "' + data + '"' ); break; case 202: - alert( 'Invalid file' ); + alert( 'Invalid file (Bad extension)' ); break; default: alert( 'Error on file upload. Error number: ' + errorNumber ); diff --git a/htdocs/core/filemanagerdol/connectors/php/commands.php b/htdocs/core/filemanagerdol/connectors/php/commands.php index b4fb1224f4c..6db2c3c1b25 100644 --- a/htdocs/core/filemanagerdol/connectors/php/commands.php +++ b/htdocs/core/filemanagerdol/connectors/php/commands.php @@ -203,12 +203,17 @@ function FileUpload($resourceType, $currentFolder, $sCommand, $CKEcallback = '') $oFile = isset($_FILES['NewFile']) ? $_FILES['NewFile'] : $_FILES['upload']; + // $resourceType should be 'Image'; + $detectHtml = 0; + // Map the virtual path to the local server path. $sServerDir = ServerMapFolder($resourceType, $currentFolder, $sCommand); // Get the uploaded file name. $sFileName = $oFile['name']; - $sFileName = SanitizeFileName($sFileName); + + //$sFileName = SanitizeFileName($sFileName); + $sFileName = dol_sanitizeFileName($sFileName); $sOriginalFileName = $sFileName; @@ -216,6 +221,8 @@ function FileUpload($resourceType, $currentFolder, $sCommand, $CKEcallback = '') $sExtension = substr($sFileName, (strrpos($sFileName, '.') + 1)); $sExtension = strtolower($sExtension); + //var_dump($Config); + /* if (isset($Config['SecureImageUploads'])) { if (($isImageValid = IsImageValid($oFile['tmp_name'], $sExtension)) === false) { $sErrorNumber = '202'; @@ -228,6 +235,14 @@ function FileUpload($resourceType, $currentFolder, $sCommand, $CKEcallback = '') $sErrorNumber = '202'; } } + */ + + include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; + $isImageValid = image_format_supported($sFileName) > 0 ? true : false; + if (!$isImageValid) { + $sErrorNumber = '202'; + } + // Check if it is an allowed extension. if (!$sErrorNumber && IsAllowedExt($sExtension, $resourceType)) { @@ -241,7 +256,8 @@ function FileUpload($resourceType, $currentFolder, $sCommand, $CKEcallback = '') $sFileName = RemoveExtension($sOriginalFileName).'('.$iCounter.').'.$sExtension; $sErrorNumber = '201'; } else { - move_uploaded_file($oFile['tmp_name'], $sFilePath); + include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + dol_move_uploaded_file($oFile['tmp_name'], $sFilePath, 0, 0); if (is_file($sFilePath)) { if (isset($Config['ChmodOnUpload']) && !$Config['ChmodOnUpload']) { diff --git a/htdocs/core/filemanagerdol/connectors/php/io.php b/htdocs/core/filemanagerdol/connectors/php/io.php index c9fce179799..ba027727db3 100644 --- a/htdocs/core/filemanagerdol/connectors/php/io.php +++ b/htdocs/core/filemanagerdol/connectors/php/io.php @@ -408,7 +408,8 @@ EOF; } $rpl = array('\\' => '\\\\', '"' => '\\"'); - echo 'window.parent.OnUploadCompleted('.$errorNumber.',"'.strtr($fileUrl, $rpl).'","'.strtr($fileName, $rpl).'", "'.strtr($customMsg, $rpl).'");'; + echo 'console.log('.$errorNumber.');'; + echo 'window.parent.OnUploadCompleted('.$errorNumber.', "'.strtr($fileUrl, $rpl).'", "'.strtr($fileName, $rpl).'", "'.strtr($customMsg, $rpl).'");'; echo ''; exit; } diff --git a/htdocs/core/filemanagerdol/connectors/php/upload.php b/htdocs/core/filemanagerdol/connectors/php/upload.php index bd9b9218155..b9296d68bcf 100644 --- a/htdocs/core/filemanagerdol/connectors/php/upload.php +++ b/htdocs/core/filemanagerdol/connectors/php/upload.php @@ -22,11 +22,12 @@ * This is the "File Uploader" for PHP. */ -require 'config.php'; +require 'config.php'; // This include the main.inc.php require 'util.php'; require 'io.php'; require 'commands.php'; + /** * SendError * @@ -63,6 +64,7 @@ if (!IsAllowedType($sType)) { } + // @CHANGE //FileUpload( $sType, $sCurrentFolder, $sCommand ) From 3dfd92e9c0fda483facd6b6a39b71604d8718609 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 8 Mar 2022 21:19:29 +0100 Subject: [PATCH 069/610] Fix do not modify entity on group edit https://www.dolibarr.fr/forum/t/etoile-globalgroup-dans-les-groupes-dutilisateurs-quelle-signification-quel-usage/38772/26 --- htdocs/user/group/card.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/user/group/card.php b/htdocs/user/group/card.php index c3e0e00fdf6..3cce6710f7f 100644 --- a/htdocs/user/group/card.php +++ b/htdocs/user/group/card.php @@ -206,8 +206,8 @@ if (empty($reshook)) { $object->oldcopy = clone $object; - $object->name = GETPOST("nom", 'nohtml'); - $object->note = dol_htmlcleanlastbr(trim(GETPOST("note", 'restricthtml'))); + $object->name = GETPOST("nom", 'nohtml'); + $object->note = dol_htmlcleanlastbr(trim(GETPOST("note", 'restricthtml'))); // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost(null, $object, '@GETPOSTISSET'); @@ -218,7 +218,7 @@ if (empty($reshook)) { if (!empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) { $object->entity = 0; } else { - $object->entity = GETPOST("entity"); + $object->entity = GETPOSTISSET("entity") ? GETPOST("entity") : $conf->entity; } $ret = $object->update(); From 8f7c361a126fc89710eb2149dbb0462d2d072690 Mon Sep 17 00:00:00 2001 From: Yoan Mollard Date: Wed, 9 Mar 2022 01:31:04 +0100 Subject: [PATCH 070/610] Restoring missing VATIsNotUsed label Overwritten by a transiflex sync --- htdocs/langs/en_US/bills.lang | 1 + htdocs/langs/fr_FR/bills.lang | 1 + 2 files changed, 2 insertions(+) diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index 851323cadd9..b9b4b111b43 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -482,6 +482,7 @@ PaymentByChequeOrderedToShort=Check payments (incl. tax) are payable to SendTo=sent to PaymentByTransferOnThisBankAccount=Payment by transfer to the following bank account VATIsNotUsedForInvoice=* Non applicable VAT art-293B of CGI +VATIsNotUsedForInvoiceAsso=* Non applicable VAT art-261-7 of CGI LawApplicationPart1=By application of the law 80.335 of 12/05/80 LawApplicationPart2=the goods remain the property of LawApplicationPart3=the seller until full payment of diff --git a/htdocs/langs/fr_FR/bills.lang b/htdocs/langs/fr_FR/bills.lang index d06da508e4e..d1a0dbbbe92 100644 --- a/htdocs/langs/fr_FR/bills.lang +++ b/htdocs/langs/fr_FR/bills.lang @@ -482,6 +482,7 @@ PaymentByChequeOrderedToShort=Règlement TTC par chèque à l'ordre de SendTo=envoyé à PaymentByTransferOnThisBankAccount=Règlement par virement sur le compte bancaire suivant VATIsNotUsedForInvoice=* TVA non applicable art-293B du CGI +VATIsNotUsedForInvoiceAsso=* TVA non applicable art-261-7 du CGI LawApplicationPart1=Par application de la loi 80.335 du 12/05/80 LawApplicationPart2=les marchandises demeurent la propriété du LawApplicationPart3=vendeur jusqu'à complet encaissement de From 6e08115aa2f4794dda3ba330691b1722e87e3710 Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Tue, 1 Mar 2022 14:52:19 +0100 Subject: [PATCH 071/610] introduce constant INVOICE_CHECK_POSTERIOR_DATE in Facture module --- htdocs/core/modules/modFacture.class.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/htdocs/core/modules/modFacture.class.php b/htdocs/core/modules/modFacture.class.php index fac768b9c60..2d1a742a304 100644 --- a/htdocs/core/modules/modFacture.class.php +++ b/htdocs/core/modules/modFacture.class.php @@ -106,6 +106,13 @@ class modFacture extends DolibarrModules $this->const[$r][4] = 0; $r++;*/ + $this->const[$r][0] = "INVOICE_CHECK_POSTERIOR_DATE"; + $this->const[$r][1] = "chaine"; + $this->const[$r][2] = 0; + $this->const[$r][3] = "When validating an invoice, check that its date is posterior to last invoice date for invoices of same type."; + $this->const[$r][4] = 0; + $r++; + // Boxes //$this->boxes = array(0=>array(1=>'box_factures_imp.php'),1=>array(1=>'box_factures.php')); From 02693ba5eab08ed1d3de0ce5994a5e0d40c751a0 Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Tue, 1 Mar 2022 15:22:46 +0100 Subject: [PATCH 072/610] Facture : add config option for INVOICE_CHECK_POSTERIOR_DATE --- htdocs/admin/facture.php | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/htdocs/admin/facture.php b/htdocs/admin/facture.php index 9eec54b03a7..f2ab39f6fb4 100644 --- a/htdocs/admin/facture.php +++ b/htdocs/admin/facture.php @@ -225,6 +225,12 @@ if ($action == 'updateMask') { setEventMessages($langs->trans("Error"), null, 'errors'); } } +} elseif ($action == 'set_INVOICE_CHECK_POSTERIOR_DATE') { + $check_posterior_date = GETPOST('INVOICE_CHECK_POSTERIOR_DATE', 'int'); + $res = dolibarr_set_const($db, 'INVOICE_CHECK_POSTERIOR_DATE', $check_posterior_date, 'chaine', 0, '', $conf->entity); + if (!($res > 0)) { + $error++; + } } @@ -761,6 +767,25 @@ print '\n"; print ''; + +print ''; +print ''; +print ''; + print '
'.$langs->trans("InvoiceCheckPosteriorDate"). ' ' ; +print $form->textwithpicto('', $langs->trans("InvoiceCheckPosteriorDateHelp"), 1, 'help') . ''; +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('INVOICE_CHECK_POSTERIOR_DATE'); +} else { + print '
'; + print ''; + print ''; + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("INVOICE_CHECK_POSTERIOR_DATE", $arrval, $conf->global->INVOICE_CHECK_POSTERIOR_DATE); +} +print '
'; +print ''; +print ''; +print '
'; print '
'; From ad416ef7925bc28c70f9bef882b971d6d5a72006 Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Tue, 1 Mar 2022 16:18:34 +0100 Subject: [PATCH 073/610] Facture: create method willBeLastOfSameType() --- htdocs/compta/facture/class/facture.class.php | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 70aebe6932c..10bc1b0af62 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -5123,6 +5123,38 @@ class Facture extends CommonInvoice return $error; } } + + /** + * See if current invoice date is posterior to the last invoice date among validated invoices of same type. + * @param bool $strict compare precise time or only days. + * @return boolean + */ + public function willBeLastOfSameType() + { + // get date of last validated invoices of same type + $sql = 'SELECT datef'; + $sql .= ' FROM '.MAIN_DB_PREFIX.'facture'; + $sql .= ' WHERE type = ' . (int) $this->type ; + $sql .= ' AND date_valid IS NOT NULL'; + $sql .= ' ORDER BY datef DESC LIMIT 1'; + + $result = $this->db->query($sql); + if ($result) { + // compare with current validation date + if ($this->db->num_rows($result)) { + $obj = $this->db->fetch_object($result); + $last_date = $this->db->jdate($obj->datef); + $invoice_date = $this->date; + + return [$invoice_date >= $last_date, $last_date]; + } else { + // element is first of type to be validated + return [true]; + } + } else { + dol_print_error($this->db); + } + } } /** From eda9622c9ca769ac3a6782b3e5d57d949aac415b Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Wed, 2 Mar 2022 10:16:14 +0100 Subject: [PATCH 074/610] Facture: enhance validation by adding INVOICE_CHECK_POSTERIOR_DATE option --- htdocs/compta/facture/class/facture.class.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 10bc1b0af62..569f677e66b 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2671,6 +2671,13 @@ class Facture extends CommonInvoice dol_syslog(get_class($this)."::validate ".$this->error.' MAIN_USE_ADVANCED_PERMS='.$conf->global->MAIN_USE_ADVANCED_PERMS, LOG_ERR); return -1; } + if (!empty($conf->global-> INVOICE_CHECK_POSTERIOR_DATE)) { + $last_of_type = $this->willBeLastOfSameType(); + if (!$last_of_type[0]) { + $this->error = $langs->transnoentities("ErrorInvoiceIsNotLastOfSameType", $this->ref , dol_print_date($this->date, 'day'), dol_print_date($last_of_type[1], 'day')); + return -1; + } + } $this->db->begin(); From 7c866ce6a2086355fbac0af97b1cb28a048fa783 Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Tue, 1 Mar 2022 17:18:29 +0100 Subject: [PATCH 075/610] facture/card.php: avoid validating invoices with date anterior to last invoice date --- htdocs/compta/facture/card.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index a4d85c257f8..f980d1c6bde 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -302,6 +302,15 @@ if (empty($reshook)) { // Validation $object->fetch($id); + if (!empty($conf->global-> INVOICE_CHECK_POSTERIOR_DATE)) { + $last_of_type = $object->willBeLastOfSameType(); + if (empty($object->date_validation) && !$last_of_type[0]) { + setEventMessages($langs->transnoentities("ErrorInvoiceIsNotLastOfSameType", $object->ref , dol_print_date($object->date, 'day'), dol_print_date($last_of_type[1], 'day')), null, 'errors'); + header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$id); + exit; + } + } + // On verifie signe facture if ($object->type == Facture::TYPE_CREDIT_NOTE) { // Si avoir, le signe doit etre negatif From 288663be3682dbd9bdab5600ce45338a4b082abc Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Wed, 2 Mar 2022 10:16:48 +0100 Subject: [PATCH 076/610] Facture mass validation: sort by date to avoid conflicts --- htdocs/core/actions_massactions.inc.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 5a4ec3bf02f..4a5fe519acb 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -1209,6 +1209,26 @@ if (!$error && $massaction == 'validate' && $permissiontoadd) { setEventMessages($langs->trans('ErrorMassValidationNotAllowedWhenStockIncreaseOnAction'), null, 'errors'); $error++; } + if ($objecttmp->element == 'facture') { + if (!empty($toselect) && !empty($conf->global->INVOICE_CHECK_POSTERIOR_DATE)) { + // order $toselect by date + $sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'facture'; + $sql .= ' WHERE rowid IN ('.$db->escape(implode(', ', $toselect)).')'; + $sql .= ' ORDER BY datef'; + + $resql = $db->query($sql); + if ($resql) { + $toselectnew = []; + while ( !empty($arr = $db->fetch_row($resql))) { + $toselectnew[] = $arr[0]; + } + $toselect = (empty($toselectnew)) ? $toselect : $toselectnew; + } else { + dol_print_error($db); + $error++; + } + } + } if (!$error) { $db->begin(); From 07672b23b92ca503e840c1b721632f1565e7d195 Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Tue, 1 Mar 2022 17:24:28 +0100 Subject: [PATCH 077/610] Langs/bills.lang: add error string for invoice date check --- htdocs/langs/en_US/admin.lang | 2 ++ htdocs/langs/en_US/bills.lang | 1 + 2 files changed, 3 insertions(+) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index cffd3532c05..fd86b2e7788 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1421,6 +1421,8 @@ WatermarkOnDraftInvoices=Watermark on draft invoices (none if empty) PaymentsNumberingModule=Payments numbering model SuppliersPayment=Vendor payments SupplierPaymentSetup=Vendor payments setup +InvoiceCheckPosteriorDate=Check facture date before validation +InvoiceCheckPosteriorDateHelp=Validating an invoice will be forbidden if its date is anterior to the date of last invoice of same type. ##### Proposals ##### PropalSetup=Commercial proposals module setup ProposalsNumberingModules=Commercial proposal numbering models diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index 851323cadd9..993f5a21b2b 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -156,6 +156,7 @@ ErrorInvoiceAvoirMustBeNegative=Error, correct invoice must have a negative amou ErrorInvoiceOfThisTypeMustBePositive=Error, this type of invoice must have an amount excluding tax positive (or null) ErrorCantCancelIfReplacementInvoiceNotValidated=Error, can't cancel an invoice that has been replaced by another invoice that is still in draft status ErrorThisPartOrAnotherIsAlreadyUsedSoDiscountSerieCantBeRemoved=This part or another is already used so discount series cannot be removed. +ErrorInvoiceIsNotLastOfSameType=Error: The date of invoice %s is %s. It must be posterior or equal to last date for same type invoices (%s). Please change the invoice date. BillFrom=From BillTo=To ActionsOnBill=Actions on invoice From 9ce51ba4b73d8cdcdda5c858784faad004f9029b Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Wed, 2 Mar 2022 12:07:40 +0100 Subject: [PATCH 078/610] admin/facture: don't show the modify button if not in an HTML form --- htdocs/admin/facture.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/admin/facture.php b/htdocs/admin/facture.php index f2ab39f6fb4..599aac27c3f 100644 --- a/htdocs/admin/facture.php +++ b/htdocs/admin/facture.php @@ -779,11 +779,11 @@ if ($conf->use_javascript_ajax) { print ''; $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); print $form->selectarray("INVOICE_CHECK_POSTERIOR_DATE", $arrval, $conf->global->INVOICE_CHECK_POSTERIOR_DATE); + print ''; + print ''; + print ''; + print ''; } -print ''; -print ''; -print ''; -print ''; print ''; print ''; From 4ad92a04fc78c45b4654710ef56eb55f62ac4ddb Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Wed, 2 Mar 2022 12:53:44 +0100 Subject: [PATCH 079/610] stickler corrections --- htdocs/compta/facture/card.php | 2 +- htdocs/compta/facture/class/facture.class.php | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index f980d1c6bde..1540846d99a 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -305,7 +305,7 @@ if (empty($reshook)) { if (!empty($conf->global-> INVOICE_CHECK_POSTERIOR_DATE)) { $last_of_type = $object->willBeLastOfSameType(); if (empty($object->date_validation) && !$last_of_type[0]) { - setEventMessages($langs->transnoentities("ErrorInvoiceIsNotLastOfSameType", $object->ref , dol_print_date($object->date, 'day'), dol_print_date($last_of_type[1], 'day')), null, 'errors'); + setEventMessages($langs->transnoentities("ErrorInvoiceIsNotLastOfSameType", $object->ref, dol_print_date($object->date, 'day'), dol_print_date($last_of_type[1], 'day')), null, 'errors'); header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$id); exit; } diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 569f677e66b..0d52e4b9fd0 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2674,7 +2674,7 @@ class Facture extends CommonInvoice if (!empty($conf->global-> INVOICE_CHECK_POSTERIOR_DATE)) { $last_of_type = $this->willBeLastOfSameType(); if (!$last_of_type[0]) { - $this->error = $langs->transnoentities("ErrorInvoiceIsNotLastOfSameType", $this->ref , dol_print_date($this->date, 'day'), dol_print_date($last_of_type[1], 'day')); + $this->error = $langs->transnoentities("ErrorInvoiceIsNotLastOfSameType", $this->ref, dol_print_date($this->date, 'day'), dol_print_date($last_of_type[1], 'day')); return -1; } } @@ -5133,7 +5133,6 @@ class Facture extends CommonInvoice /** * See if current invoice date is posterior to the last invoice date among validated invoices of same type. - * @param bool $strict compare precise time or only days. * @return boolean */ public function willBeLastOfSameType() From 93765add38e9ad9754df340a6f20faf5a34b4429 Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Wed, 2 Mar 2022 13:08:42 +0100 Subject: [PATCH 080/610] Travis fix, hopefully. --- htdocs/core/actions_massactions.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 4a5fe519acb..bdf13214717 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -1213,7 +1213,7 @@ if (!$error && $massaction == 'validate' && $permissiontoadd) { if (!empty($toselect) && !empty($conf->global->INVOICE_CHECK_POSTERIOR_DATE)) { // order $toselect by date $sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'facture'; - $sql .= ' WHERE rowid IN ('.$db->escape(implode(', ', $toselect)).')'; + $sql .= ' WHERE rowid IN ('.$db->sanitize(implode(',', $toselect)).')'; $sql .= ' ORDER BY datef'; $resql = $db->query($sql); From 7f527b85b0c3bc83ee00d8df94a6de6a06a8455b Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Wed, 9 Mar 2022 09:34:50 +0100 Subject: [PATCH 081/610] use double quotes to compose SQL requests --- htdocs/compta/facture/class/facture.class.php | 10 +++++----- htdocs/core/actions_massactions.inc.php | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 0d52e4b9fd0..5ca66ac0cd3 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -5138,11 +5138,11 @@ class Facture extends CommonInvoice public function willBeLastOfSameType() { // get date of last validated invoices of same type - $sql = 'SELECT datef'; - $sql .= ' FROM '.MAIN_DB_PREFIX.'facture'; - $sql .= ' WHERE type = ' . (int) $this->type ; - $sql .= ' AND date_valid IS NOT NULL'; - $sql .= ' ORDER BY datef DESC LIMIT 1'; + $sql = "SELECT datef"; + $sql .= " FROM ".MAIN_DB_PREFIX."facture"; + $sql .= " WHERE type = " . (int) $this->type ; + $sql .= " AND date_valid IS NOT NULL"; + $sql .= " ORDER BY datef DESC LIMIT 1"; $result = $this->db->query($sql); if ($result) { diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index bdf13214717..39d99c4a03b 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -1212,9 +1212,9 @@ if (!$error && $massaction == 'validate' && $permissiontoadd) { if ($objecttmp->element == 'facture') { if (!empty($toselect) && !empty($conf->global->INVOICE_CHECK_POSTERIOR_DATE)) { // order $toselect by date - $sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'facture'; - $sql .= ' WHERE rowid IN ('.$db->sanitize(implode(',', $toselect)).')'; - $sql .= ' ORDER BY datef'; + $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."facture"; + $sql .= " WHERE rowid IN (".$db->sanitize(implode(",", $toselect)).")"; + $sql .= " ORDER BY datef"; $resql = $db->query($sql); if ($resql) { From 7ae96b9839fb200c0cf5a4e2dfbfe1df86cf62c3 Mon Sep 17 00:00:00 2001 From: Quentin VIAL-GOUTEYRON Date: Wed, 9 Mar 2022 10:34:23 +0100 Subject: [PATCH 082/610] convert number into qty --- htdocs/admin/dict.php | 10 +++++----- .../install/mysql/data/llx_c_availability.sql | 10 +++++----- .../install/mysql/migration/15.0.0-16.0.0.sql | 17 ++++++----------- .../install/mysql/tables/llx_c_availability.sql | 2 +- 4 files changed, 17 insertions(+), 22 deletions(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 111186d6e6a..8cfd45fc395 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -218,7 +218,7 @@ $tabsql[17] = "SELECT id as rowid, code, label, accountancy_code, active FR $tabsql[18] = "SELECT rowid as rowid, code, libelle, tracking, active FROM ".MAIN_DB_PREFIX."c_shipment_mode"; $tabsql[19] = "SELECT id as rowid, code, libelle, active FROM ".MAIN_DB_PREFIX."c_effectif"; $tabsql[20] = "SELECT rowid as rowid, code, libelle, active FROM ".MAIN_DB_PREFIX."c_input_method"; -$tabsql[21] = "SELECT c.rowid as rowid, c.code, c.label, c.type_duration, c.number, c.active, c.position FROM ".MAIN_DB_PREFIX."c_availability AS c"; +$tabsql[21] = "SELECT c.rowid as rowid, c.code, c.label, c.type_duration, c.qty, c.active, c.position FROM ".MAIN_DB_PREFIX."c_availability AS c"; $tabsql[22] = "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_input_reason"; $tabsql[23] = "SELECT t.rowid as rowid, t.taux, t.revenuestamp_type, c.label as country, c.code as country_code, t.fk_pays as country_id, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_revenuestamp as t, ".MAIN_DB_PREFIX."c_country as c WHERE t.fk_pays=c.rowid"; $tabsql[24] = "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_type_resource"; @@ -265,7 +265,7 @@ $tabsqlsort[17] = "code ASC"; $tabsqlsort[18] = "code ASC, libelle ASC"; $tabsqlsort[19] = "id ASC"; $tabsqlsort[20] = "code ASC, libelle ASC"; -$tabsqlsort[21] = "code ASC, label ASC, position ASC, type_duration ASC, number ASC"; +$tabsqlsort[21] = "code ASC, label ASC, position ASC, type_duration ASC, qty ASC"; $tabsqlsort[22] = "code ASC, label ASC"; $tabsqlsort[23] = "country ASC, taux ASC"; $tabsqlsort[24] = "code ASC, label ASC"; @@ -312,7 +312,7 @@ $tabfield[17] = "code,label,accountancy_code"; $tabfield[18] = "code,libelle,tracking"; $tabfield[19] = "code,libelle"; $tabfield[20] = "code,libelle"; -$tabfield[21] = "code,label,number,type_duration,position"; +$tabfield[21] = "code,label,qty,type_duration,position"; $tabfield[22] = "code,label"; $tabfield[23] = "country_id,country,taux,revenuestamp_type,accountancy_code_sell,accountancy_code_buy,note"; $tabfield[24] = "code,label"; @@ -359,7 +359,7 @@ $tabfieldvalue[17] = "code,label,accountancy_code"; $tabfieldvalue[18] = "code,libelle,tracking"; $tabfieldvalue[19] = "code,libelle"; $tabfieldvalue[20] = "code,libelle"; -$tabfieldvalue[21] = "code,label,number,type_duration,position"; +$tabfieldvalue[21] = "code,label,qty,type_duration,position"; $tabfieldvalue[22] = "code,label"; $tabfieldvalue[23] = "country,taux,revenuestamp_type,accountancy_code_sell,accountancy_code_buy,note"; $tabfieldvalue[24] = "code,label"; @@ -406,7 +406,7 @@ $tabfieldinsert[17] = "code,label,accountancy_code"; $tabfieldinsert[18] = "code,libelle,tracking"; $tabfieldinsert[19] = "code,libelle"; $tabfieldinsert[20] = "code,libelle"; -$tabfieldinsert[21] = "code,label,number,type_duration,position"; +$tabfieldinsert[21] = "code,label,qty,type_duration,position"; $tabfieldinsert[22] = "code,label"; $tabfieldinsert[23] = "fk_pays,taux,revenuestamp_type,accountancy_code_sell,accountancy_code_buy,note"; $tabfieldinsert[24] = "code,label"; diff --git a/htdocs/install/mysql/data/llx_c_availability.sql b/htdocs/install/mysql/data/llx_c_availability.sql index 2e5c64fec05..9b5d1ca5e32 100644 --- a/htdocs/install/mysql/data/llx_c_availability.sql +++ b/htdocs/install/mysql/data/llx_c_availability.sql @@ -25,9 +25,9 @@ -- Availability type -- -INSERT INTO llx_c_availability (code,label,type_duration,number,active,position) VALUES ('AV_NOW', 'Immediate', null, 0, 1, 10); -INSERT INTO llx_c_availability (code,label,type_duration,number,active,position) VALUES ('AV_1W', '1 week', 'w', 1, 1, 20); -INSERT INTO llx_c_availability (code,label,type_duration,number,active,position) VALUES ('AV_2W', '2 weeks', 'w', 2, 1, 30); -INSERT INTO llx_c_availability (code,label,type_duration,number,active,position) VALUES ('AV_3W', '3 weeks', 'w', 3, 1, 40); -INSERT INTO llx_c_availability (code,label,type_duration,number,active,position) VALUES ('AV_4W', '4 weeks', 'w', 4, 1, 50); +INSERT INTO llx_c_availability (code,label,type_duration,qty,active,position) VALUES ('AV_NOW', 'Immediate', null, 0, 1, 10); +INSERT INTO llx_c_availability (code,label,type_duration,qty,active,position) VALUES ('AV_1W', '1 week', 'w', 1, 1, 20); +INSERT INTO llx_c_availability (code,label,type_duration,qty,active,position) VALUES ('AV_2W', '2 weeks', 'w', 2, 1, 30); +INSERT INTO llx_c_availability (code,label,type_duration,qty,active,position) VALUES ('AV_3W', '3 weeks', 'w', 3, 1, 40); +INSERT INTO llx_c_availability (code,label,type_duration,qty,active,position) VALUES ('AV_4W', '4 weeks', 'w', 4, 1, 50); diff --git a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql index 297c11bd7e3..746aeae84d3 100644 --- a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql +++ b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql @@ -280,15 +280,10 @@ ALTER TABLE llx_propal ADD last_main_doc VARCHAR(255) NULL AFTER model_pdf; UPDATE llx_c_country SET eec=0 WHERE eec IS NULL; ALTER TABLE llx_c_country MODIFY COLUMN eec tinyint DEFAULT 0 NOT NULL; ALTER TABLE llx_c_availability ADD COLUMN type_duration char(1); -ALTER TABLE llx_c_availability ADD COLUMN number real DEFAULT 0; +ALTER TABLE llx_c_availability ADD COLUMN qty real DEFAULT 0; -INSERT INTO llx_c_availability (code,label,type_duration,number,active,position) VALUES ( 'AV_NOW', 'Immediate', null, 0, 1, 10); -INSERT INTO llx_c_availability (code,label,type_duration,number,active,position) VALUES ( 'AV_1W', '1 week', 'w', 1, 1, 20); -INSERT INTO llx_c_availability (code,label,type_duration,number,active,position) VALUES ( 'AV_2W', '2 weeks', 'w', 2, 1, 30); -INSERT INTO llx_c_availability (code,label,type_duration,number,active,position) VALUES ( 'AV_3W', '3 weeks', 'w', 3, 1, 40); -INSERT INTO llx_c_availability (code,label,type_duration,number,active,position) VALUES ( 'AV_4W', '4 weeks', 'w', 4, 1, 50); -UPDATE llx_c_availability SET type_duration = null, number = 0 WHERE code = 'AV_NOW'; -UPDATE llx_c_availability SET type_duration = 'w', number = 1 WHERE code = 'AV_1W'; -UPDATE llx_c_availability SET type_duration = 'w', number = 2 WHERE code = 'AV_2W'; -UPDATE llx_c_availability SET type_duration = 'w', number = 3 WHERE code = 'AV_3W'; -UPDATE llx_c_availability SET type_duration = 'w', number = 4 WHERE code = 'AV_4W'; +UPDATE llx_c_availability SET type_duration = null, qty = 0 WHERE code = 'AV_NOW'; +UPDATE llx_c_availability SET type_duration = 'w', qty = 1 WHERE code = 'AV_1W'; +UPDATE llx_c_availability SET type_duration = 'w', qty = 2 WHERE code = 'AV_2W'; +UPDATE llx_c_availability SET type_duration = 'w', qty = 3 WHERE code = 'AV_3W'; +UPDATE llx_c_availability SET type_duration = 'w', qty = 4 WHERE code = 'AV_4W'; diff --git a/htdocs/install/mysql/tables/llx_c_availability.sql b/htdocs/install/mysql/tables/llx_c_availability.sql index dd999128f36..8dfd2e1d5d6 100644 --- a/htdocs/install/mysql/tables/llx_c_availability.sql +++ b/htdocs/install/mysql/tables/llx_c_availability.sql @@ -24,7 +24,7 @@ create table llx_c_availability code varchar(30) NOT NULL, label varchar(128) NOT NULL, type_duration char(1), - number real, + qty real, active tinyint DEFAULT 1 NOT NULL, position integer NOT NULL DEFAULT 0 )ENGINE=innodb; From e06c38650796bbfb531ec98556f7a5cfd4bc2f3b Mon Sep 17 00:00:00 2001 From: kamel Date: Wed, 9 Mar 2022 11:32:07 +0100 Subject: [PATCH 083/610] Fix errors propagation and trigger position on delete proposal line --- htdocs/comm/propal/card.php | 5 ++- htdocs/comm/propal/class/propal.class.php | 52 +++++++++++++---------- 2 files changed, 33 insertions(+), 24 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 63f2977acdb..a77e242379f 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -231,8 +231,11 @@ if (empty($reshook)) { // Remove line $result = $object->deleteline($lineid); // reorder lines - if ($result) { + if ($result > 0) { $object->line_order(true); + } else { + $langs->load("errors"); + setEventMessages($object->error, $object->errors, 'errors'); } if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 0142d0c1b7a..16db2b12723 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -980,6 +980,8 @@ class Propal extends CommonObject $this->db->commit(); return 1; } else { + $this->error = $line->error; + $this->errors = $line->errors; $this->db->rollback(); return -1; } @@ -4166,36 +4168,40 @@ class PropaleLigne extends CommonObjectLine $error = 0; $this->db->begin(); - $sql = "DELETE FROM ".MAIN_DB_PREFIX."propaldet WHERE rowid = ".((int) $this->rowid); - dol_syslog("PropaleLigne::delete", LOG_DEBUG); - if ($this->db->query($sql)) { - // Remove extrafields - if (!$error) { - $this->id = $this->rowid; - $result = $this->deleteExtraFields(); - if ($result < 0) { - $error++; - dol_syslog(get_class($this)."::delete error -4 ".$this->error, LOG_ERR); - } + if (!$notrigger) { + // Call trigger + $result = $this->call_trigger('LINEPROPAL_DELETE', $user); + if ($result < 0) { + $error++; } + } + // End call triggers - if (!$error && !$notrigger) { - // Call trigger - $result = $this->call_trigger('LINEPROPAL_DELETE', $user); - if ($result < 0) { - $this->db->rollback(); - return -1; + if (!$error) { + $sql = "DELETE FROM " . MAIN_DB_PREFIX . "propaldet WHERE rowid = " . ((int)$this->rowid); + dol_syslog("PropaleLigne::delete", LOG_DEBUG); + if ($this->db->query($sql)) { + // Remove extrafields + if (!$error) { + $this->id = $this->rowid; + $result = $this->deleteExtraFields(); + if ($result < 0) { + $error++; + dol_syslog(get_class($this) . "::delete error -4 " . $this->error, LOG_ERR); + } } + } else { + $this->error = $this->db->error() . " sql=" . $sql; + $error++; } - // End call triggers + } - $this->db->commit(); - - return 1; - } else { - $this->error = $this->db->error()." sql=".$sql; + if ($error) { $this->db->rollback(); return -1; + } else { + $this->db->commit(); + return 1; } } From 1f00dff4dac508c367f29025ef2302815670347b Mon Sep 17 00:00:00 2001 From: kamel Date: Wed, 9 Mar 2022 11:40:26 +0100 Subject: [PATCH 084/610] Correction Stickler CI / stickler-ci --- htdocs/comm/propal/class/propal.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 16db2b12723..65a2e60777f 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -4178,7 +4178,7 @@ class PropaleLigne extends CommonObjectLine // End call triggers if (!$error) { - $sql = "DELETE FROM " . MAIN_DB_PREFIX . "propaldet WHERE rowid = " . ((int)$this->rowid); + $sql = "DELETE FROM " . MAIN_DB_PREFIX . "propaldet WHERE rowid = " . ((int) $this->rowid); dol_syslog("PropaleLigne::delete", LOG_DEBUG); if ($this->db->query($sql)) { // Remove extrafields From e76afe475b3d0b8c1580e15c3bcd8411b78b3929 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 9 Mar 2022 11:02:35 +0100 Subject: [PATCH 085/610] Fix responsive --- htdocs/core/class/html.form.class.php | 6 +++--- htdocs/core/lib/project.lib.php | 4 ++-- htdocs/projet/activity/perday.php | 12 ++++++------ htdocs/projet/activity/perweek.php | 11 ++++++----- htdocs/projet/tasks/stats/index.php | 10 +++++----- htdocs/public/opensurvey/studs.php | 3 ++- 6 files changed, 24 insertions(+), 22 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 821d87dcd82..1b4500cdb27 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -6584,7 +6584,7 @@ class Form // phpcs:enable global $langs; - $retstring = ''; + $retstring = ''; $hourSelected = 0; $minSelected = 0; @@ -6616,7 +6616,7 @@ class Form if ($typehour != 'text') { $retstring .= ' '.$langs->trans('HourShort'); } else { - $retstring .= ':'; + $retstring .= ':'; } // Minutes @@ -6644,7 +6644,7 @@ class Form $retstring .= ' '.$langs->trans('MinuteShort'); } - //$retstring.=" "; + $retstring.=""; if (!empty($nooutput)) { return $retstring; diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 90a67991413..15162c8b273 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -1561,8 +1561,8 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr $disabledtask = 1; } - // Form to add new time - print ''; + // Select hour + print ''; $tableCell = $form->selectDate($preselectedday, $lines[$i]->id, 1, 1, 2, "addtime", 0, 0, $disabledtask); print $tableCell; print ''; diff --git a/htdocs/projet/activity/perday.php b/htdocs/projet/activity/perday.php index b743dffbc53..c840ff3438a 100644 --- a/htdocs/projet/activity/perday.php +++ b/htdocs/projet/activity/perday.php @@ -349,7 +349,7 @@ $next_day = $next['mday']; $title = $langs->trans("TimeSpent"); -$projectsListId = $projectstatic->getProjectsAuthorizedForUser($usertoprocess, (empty($usertoprocess->id) ? 2 : 0), 1); // Return all project i have permission on. I want my tasks and some of my task may be on a public projet that is not my project +$projectsListId = $projectstatic->getProjectsAuthorizedForUser($usertoprocess, (empty($usertoprocess->id) ? 2 : 0), 1); // Return all project i have permission on (assigned to me+public). I want my tasks and some of my task may be on a public projet that is not my project if ($id) { $project->fetch($id); @@ -476,12 +476,12 @@ if ($usertoprocess->id != $user->id) { $titleassigntask = $langs->transnoentities("AssignTaskToUser", $usertoprocess->getFullName($langs)); } print '
'; -print img_picto('', 'projecttask'); +print img_picto('', 'projecttask', 'class="pictofixedwidth"'); $formproject->selectTasks($socid ? $socid : -1, $taskid, 'taskid', 32, 0, '-- '.$langs->trans("ChooseANotYetAssignedTask").' --', 1, 0, 0, '', '', 'all', $usertoprocess); print '
'; print ' '; print $formcompany->selectTypeContact($object, '', 'type', 'internal', 'rowid', 0, 'maxwidth150onsmartphone'); -print ''; +print ''; print ''; print '
'; @@ -596,10 +596,10 @@ $extrafieldsobjectkey = 'projet_task'; $extrafieldsobjectprefix = 'efpt.'; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; if (!empty($arrayfields['t.planned_workload']['checked'])) { - print ''.$langs->trans("PlannedWorkload").''; + print ''.$langs->trans("PlannedWorkload").''; } if (!empty($arrayfields['t.progress']['checked'])) { - print ''.$langs->trans("ProgressDeclared").''; + print 'trans("ProgressDeclared")).'">'.$langs->trans("ProgressDeclared").''; } if (!empty($arrayfields['timeconsumed']['checked'])) { print ''.$langs->trans("TimeSpent").'
'; @@ -608,7 +608,7 @@ if (!empty($arrayfields['timeconsumed']['checked'])) { print ''.$langs->trans("Everybody").''; print ''; print ''; - print ''.$langs->trans("TimeSpent").($usertoprocess->firstname ? '
'.$usertoprocess->getNomUrl(-2).''.dol_trunc($usertoprocess->firstname, 10).'' : '').''; + print ''.$langs->trans("TimeSpent").($usertoprocess->firstname ? '
'.$usertoprocess->getNomUrl(-2).''.dol_trunc($usertoprocess->firstname, 10).'' : '').''; } print ''.$langs->trans("HourStart").''; diff --git a/htdocs/projet/activity/perweek.php b/htdocs/projet/activity/perweek.php index 763ecefe650..385565c7616 100644 --- a/htdocs/projet/activity/perweek.php +++ b/htdocs/projet/activity/perweek.php @@ -119,6 +119,7 @@ $extrafields = new ExtraFields($db); // fetch optionals attributes and labels $extrafields->fetch_name_optionals_label($object->table_element); +// Definition of fields for list $arrayfields = array(); /*$arrayfields=array( // Project @@ -441,7 +442,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; // Show navigation bar $nav = ''.img_previous($langs->trans("Previous"))."\n"; -$nav .= " ".dol_print_date(dol_mktime(0, 0, 0, $first_month, $first_day, $first_year), "%Y").", ".$langs->trans("WeekShort")." ".$week." \n"; +$nav .= ' '.dol_print_date(dol_mktime(0, 0, 0, $first_month, $first_day, $first_year), "%Y").", ".$langs->trans("WeekShort")." ".$week." \n"; $nav .= ''.img_next($langs->trans("Next"))."\n"; $nav .= ' '.$form->selectDate(-1, '', 0, 0, 2, "addtime", 1, 1).' '; $nav .= ' '; @@ -652,10 +653,10 @@ $extrafieldsobjectkey = 'projet_task'; $extrafieldsobjectprefix = 'efpt.'; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; if (!empty($arrayfields['t.planned_workload']['checked'])) { - print ''.$langs->trans("PlannedWorkload").''; + print ''.$langs->trans("PlannedWorkload").''; } if (!empty($arrayfields['t.progress']['checked'])) { - print ''.$langs->trans("ProgressDeclared").''; + print ''.$langs->trans("ProgressDeclared").''; } if (!empty($arrayfields['timeconsumed']['checked'])) { print ''.$langs->trans("TimeSpent").'
'; @@ -664,7 +665,7 @@ if (!empty($arrayfields['timeconsumed']['checked'])) { print ''.$langs->trans("Everybody").''; print ''; print ''; - print ''.$langs->trans("TimeSpent").($usertoprocess->firstname ? '
'.$usertoprocess->getNomUrl(-2).''.dol_trunc($usertoprocess->firstname, 10).'' : '').''; + print ''.$langs->trans("TimeSpent").($usertoprocess->firstname ? '
'.$usertoprocess->getNomUrl(-2).''.dol_trunc($usertoprocess->firstname, 10).'' : '').''; } for ($idw = 0; $idw < 7; $idw++) { $dayinloopfromfirstdaytoshow = dol_time_plus_duree($firstdaytoshow, $idw, 'd'); // $firstdaytoshow is a date with hours = 0 @@ -691,7 +692,7 @@ for ($idw = 0; $idw < 7; $idw++) { $cssonholiday .= 'onholidayafternoon '; } - print ''; + print ''; print dol_print_date($dayinloopfromfirstdaytoshow, '%a'); print '
'.dol_print_date($dayinloopfromfirstdaytoshow, 'dayreduceformat').''; } diff --git a/htdocs/projet/tasks/stats/index.php b/htdocs/projet/tasks/stats/index.php index 70c093f46e3..2ca72552fa4 100644 --- a/htdocs/projet/tasks/stats/index.php +++ b/htdocs/projet/tasks/stats/index.php @@ -180,7 +180,7 @@ print '

'; print '
'; print ''; -print ''; +print ''; print ''; print ''; print ''; @@ -191,14 +191,14 @@ foreach ($data_all_year as $val) { while ($year && $oldyear > $year + 1) { // If we have empty year $oldyear--; - print ''; - print ''; + print ''; + print ''; print ''; print ''; } - print ''; - print ''; + print ''; + print ''; print ''; print ''; $oldyear = $year; diff --git a/htdocs/public/opensurvey/studs.php b/htdocs/public/opensurvey/studs.php index 42cde055ac2..4cabb3448e3 100644 --- a/htdocs/public/opensurvey/studs.php +++ b/htdocs/public/opensurvey/studs.php @@ -286,10 +286,11 @@ print '
'."\n"; // show title of survey $titre = str_replace("\\", "", $object->title); -print ''.dol_htmlentities($titre).'

'."\n"; +print ''.dol_htmlentities($titre).''; // show description of survey if ($object->description) { + print '

'."\n"; print dol_htmlentitiesbr($object->description); print '
'."\n"; } From 8ddd37a4190f7dd9a508662ee4aae232077038a3 Mon Sep 17 00:00:00 2001 From: javieralapps4up Date: Wed, 9 Mar 2022 13:16:09 +0100 Subject: [PATCH 086/610] Enabled to add links to local object with local browser in email templates It is forbidden by default --- htdocs/admin/mails_templates.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php index 25a33717c46..6280db04b15 100644 --- a/htdocs/admin/mails_templates.php +++ b/htdocs/admin/mails_templates.php @@ -739,7 +739,7 @@ if ($action == 'view') { if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) { $okforextended = false; } - $doleditor = new DolEditor($tmpfieldlist, (!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 180, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_4, '90%'); + $doleditor = new DolEditor($tmpfieldlist, (!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 180, 'dolibarr_mailings', 'In', 0, true, $okforextended, ROWS_4, '90%'); print $doleditor->Create(1); } print ''; @@ -969,7 +969,7 @@ if ($resql) { if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) { $okforextended = false; } - $doleditor = new DolEditor($tmpfieldlist.'-'.$rowid, (!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 500, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_6, '90%'); + $doleditor = new DolEditor($tmpfieldlist.'-'.$rowid, (!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 500, 'dolibarr_mailings', 'In', 0, true, $okforextended, ROWS_6, '90%'); print $doleditor->Create(1); } print ''; @@ -1134,7 +1134,7 @@ if ($resql) { $okforextended = true; if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) $okforextended = false; - $doleditor = new DolEditor($tmpfieldlist.'-'.$i, (! empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 140, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_6, '90%', 1); + $doleditor = new DolEditor($tmpfieldlist.'-'.$i, (! empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 140, 'dolibarr_mailings', 'In', 0, true, $okforextended, ROWS_6, '90%', 1); print $doleditor->Create(1); print ''; print '
'; From 22249d15c3e2bd054ab206bdc186b745553f07af Mon Sep 17 00:00:00 2001 From: kevin Date: Wed, 9 Mar 2022 14:09:22 +0100 Subject: [PATCH 087/610] Add WYSIWYG Editor on project's tasks description field --- htdocs/projet/tasks.php | 15 ++++++++++++++- htdocs/projet/tasks/task.php | 25 ++++++++++++++++++++++--- 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 310857e24cc..bd1fcb326c2 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -763,7 +763,20 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third // Description print ''; print ''; print ''; diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index 19be96cc558..74ea6b17649 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -45,6 +45,7 @@ $confirm = GETPOST('confirm', 'alpha'); $withproject = GETPOST('withproject', 'int'); $project_ref = GETPOST('project_ref', 'alpha'); $planned_workload = ((GETPOST('planned_workloadhour', 'int') != '' || GETPOST('planned_workloadmin', 'int') != '') ? (GETPOST('planned_workloadhour', 'int') > 0 ?GETPOST('planned_workloadhour', 'int') * 3600 : 0) + (GETPOST('planned_workloadmin', 'int') > 0 ?GETPOST('planned_workloadmin', 'int') * 60 : 0) : ''); +$description = GETPOST('description', 'restricthtml'); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('projecttaskcard', 'globalcard')); @@ -99,7 +100,8 @@ if ($action == 'update' && !GETPOST("cancel") && $user->rights->projet->creer) { $object->ref = $taskref ? $taskref : GETPOST("ref", 'alpha', 2); $object->label = GETPOST("label", "alphanohtml"); - $object->description = GETPOST('description', "alphanohtml"); + if (empty($conf->global->FCKEDITOR_ENABLE_SOCIETE)) $object->description = GETPOST('description', "alphanohtml"); + else $object->description = GETPOST('description', "restricthtml"); $object->fk_task_parent = $task_parent; $object->planned_workload = $planned_workload; $object->date_start = dol_mktime(GETPOST('dateohour', 'int'), GETPOST('dateomin', 'int'), 0, GETPOST('dateomonth', 'int'), GETPOST('dateoday', 'int'), GETPOST('dateoyear', 'int')); @@ -439,7 +441,20 @@ if ($id > 0 || !empty($ref)) { // Description print ''; print ''; print ''; @@ -536,7 +551,11 @@ if ($id > 0 || !empty($ref)) { // Description print ''; print '
'.$langs->trans("Year").''.$langs->trans("NbOfTasks").'
0 ? '&userid='.$userid : '').'">'.$oldyear.'
0 ? '&userid='.$userid : '').'">'.$oldyear.'0
0 ? '&userid='.$userid : '').'">'.$year.'
0 ? '&userid='.$userid : '').'">'.$year.''.$val['nb'].'
'.$langs->trans("Description").''; - print ''; + + if (empty($conf->global->FCKEDITOR_ENABLE_SOCIETE)) { + print ''; + } else { + // WYSIWYG editor + include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; + $cked_enabled = (!empty($conf->global->FCKEDITOR_ENABLE_DETAILS) ? $conf->global->FCKEDITOR_ENABLE_DETAILS : 0); + if (!empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) { + $nbrows = $conf->global->MAIN_INPUT_DESC_HEIGHT; + } + $doleditor = new DolEditor('description', $object->description, '', 80, 'dolibarr_details', '', false, true, $cked_enabled, $nbrows); + print $doleditor->Create(); + } + print '
'.$langs->trans("Budget").'
'.$langs->trans("Description").''; - print ''; + + if (empty($conf->global->FCKEDITOR_ENABLE_SOCIETE)) { + print ''; + } else { + // WYSIWYG editor + include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; + $cked_enabled = (!empty($conf->global->FCKEDITOR_ENABLE_DETAILS) ? $conf->global->FCKEDITOR_ENABLE_DETAILS : 0); + if (!empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) { + $nbrows = $conf->global->MAIN_INPUT_DESC_HEIGHT; + } + $description = !empty($description) ? $description : $object->description; + $doleditor = new DolEditor('description', $description, '', 80, 'dolibarr_details', '', false, true, $cked_enabled, $nbrows); + print $doleditor->Create(); + } print '
'.$langs->trans("Budget").''.$langs->trans("Description").''; - print nl2br($object->description); + if (!empty($conf->global->FCKEDITOR_ENABLE_SOCIETE)) { + print $object->description; + } else { + print nl2br($object->description); + } print '
'; From bb2f57a962f81204ddd71ee19376fa321bfbf137 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 9 Mar 2022 13:15:30 +0000 Subject: [PATCH 088/610] Fixing style errors. --- htdocs/projet/tasks.php | 24 +++++++++++----------- htdocs/projet/tasks/task.php | 40 ++++++++++++++++++------------------ 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index bd1fcb326c2..364fcfe49f1 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -764,18 +764,18 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third print ''.$langs->trans("Description").''; print ''; - if (empty($conf->global->FCKEDITOR_ENABLE_SOCIETE)) { - print ''; - } else { - // WYSIWYG editor - include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $cked_enabled = (!empty($conf->global->FCKEDITOR_ENABLE_DETAILS) ? $conf->global->FCKEDITOR_ENABLE_DETAILS : 0); - if (!empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) { - $nbrows = $conf->global->MAIN_INPUT_DESC_HEIGHT; - } - $doleditor = new DolEditor('description', $object->description, '', 80, 'dolibarr_details', '', false, true, $cked_enabled, $nbrows); - print $doleditor->Create(); - } + if (empty($conf->global->FCKEDITOR_ENABLE_SOCIETE)) { + print ''; + } else { + // WYSIWYG editor + include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; + $cked_enabled = (!empty($conf->global->FCKEDITOR_ENABLE_DETAILS) ? $conf->global->FCKEDITOR_ENABLE_DETAILS : 0); + if (!empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) { + $nbrows = $conf->global->MAIN_INPUT_DESC_HEIGHT; + } + $doleditor = new DolEditor('description', $object->description, '', 80, 'dolibarr_details', '', false, true, $cked_enabled, $nbrows); + print $doleditor->Create(); + } print ''; diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index 74ea6b17649..41f8fe1f852 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -100,8 +100,8 @@ if ($action == 'update' && !GETPOST("cancel") && $user->rights->projet->creer) { $object->ref = $taskref ? $taskref : GETPOST("ref", 'alpha', 2); $object->label = GETPOST("label", "alphanohtml"); - if (empty($conf->global->FCKEDITOR_ENABLE_SOCIETE)) $object->description = GETPOST('description', "alphanohtml"); - else $object->description = GETPOST('description', "restricthtml"); + if (empty($conf->global->FCKEDITOR_ENABLE_SOCIETE)) $object->description = GETPOST('description', "alphanohtml"); + else $object->description = GETPOST('description', "restricthtml"); $object->fk_task_parent = $task_parent; $object->planned_workload = $planned_workload; $object->date_start = dol_mktime(GETPOST('dateohour', 'int'), GETPOST('dateomin', 'int'), 0, GETPOST('dateomonth', 'int'), GETPOST('dateoday', 'int'), GETPOST('dateoyear', 'int')); @@ -442,19 +442,19 @@ if ($id > 0 || !empty($ref)) { print ''.$langs->trans("Description").''; print ''; - if (empty($conf->global->FCKEDITOR_ENABLE_SOCIETE)) { - print ''; - } else { - // WYSIWYG editor - include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $cked_enabled = (!empty($conf->global->FCKEDITOR_ENABLE_DETAILS) ? $conf->global->FCKEDITOR_ENABLE_DETAILS : 0); - if (!empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) { - $nbrows = $conf->global->MAIN_INPUT_DESC_HEIGHT; - } - $description = !empty($description) ? $description : $object->description; - $doleditor = new DolEditor('description', $description, '', 80, 'dolibarr_details', '', false, true, $cked_enabled, $nbrows); - print $doleditor->Create(); - } + if (empty($conf->global->FCKEDITOR_ENABLE_SOCIETE)) { + print ''; + } else { + // WYSIWYG editor + include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; + $cked_enabled = (!empty($conf->global->FCKEDITOR_ENABLE_DETAILS) ? $conf->global->FCKEDITOR_ENABLE_DETAILS : 0); + if (!empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) { + $nbrows = $conf->global->MAIN_INPUT_DESC_HEIGHT; + } + $description = !empty($description) ? $description : $object->description; + $doleditor = new DolEditor('description', $description, '', 80, 'dolibarr_details', '', false, true, $cked_enabled, $nbrows); + print $doleditor->Create(); + } print ''; print ''.$langs->trans("Budget").''; @@ -551,11 +551,11 @@ if ($id > 0 || !empty($ref)) { // Description print ''.$langs->trans("Description").''; - if (!empty($conf->global->FCKEDITOR_ENABLE_SOCIETE)) { - print $object->description; - } else { - print nl2br($object->description); - } + if (!empty($conf->global->FCKEDITOR_ENABLE_SOCIETE)) { + print $object->description; + } else { + print nl2br($object->description); + } print ''; print ''; From 2279674f013bbee1c3581685a3ba76396b449ae3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 9 Mar 2022 15:58:23 +0100 Subject: [PATCH 089/610] Trans --- htdocs/langs/en_US/products.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index a8942bd337f..e6903e360da 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -346,7 +346,7 @@ UseProductFournDesc=Add a feature to define the product description defined by t ProductSupplierDescription=Vendor description for the product UseProductSupplierPackaging=Use packaging on supplier prices (recalculate quantities according to packaging set on supplier price when adding/updating line in supplier documents) PackagingForThisProduct=Packaging -PackagingForThisProductDesc=On supplier order, you will automaticly order this quantity (or a multiple of this quantity). Cannot be less than minimum buying quantity +PackagingForThisProductDesc=You will automaticaly buy a multiple of this quantity. Can't be lower than the minimum purchase quantity QtyRecalculatedWithPackaging=The quantity of the line were recalculated according to supplier packaging #Attributes From 25fcb83b7490c6abbedbcb953fcc6c30ebbd7c06 Mon Sep 17 00:00:00 2001 From: steve Date: Wed, 9 Mar 2022 16:41:26 +0100 Subject: [PATCH 090/610] wip: reopen button --- htdocs/compta/facture/card.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 5b4acb040d6..c974a1b053c 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -5409,9 +5409,12 @@ if ($action == 'create') { && ($object->statut == Facture::STATUS_CLOSED || $object->statut == Facture::STATUS_ABANDONED || ($object->statut == 1 && $object->paye == 1)) // Condition ($object->statut == 1 && $object->paye == 1) should not happened but can be found due to corrupted data && ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || $usercanreopen)) { // A paid invoice (partially or completely) if ($object->close_code != 'replaced' || (!$objectidnext)) { // Not replaced by another invoice or replaced but the replacement invoice has been deleted - print ''.$langs->trans('ReOpen').''; + //print ''.$langs->trans('ReOpen').''; + print dolGetButtonAction($langs->trans('ReOpen'), '', 'default', $_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=reopen&token='.newToken(), '', true, $params); } else { - print ''.$langs->trans('ReOpen').''; + //print ''.$langs->trans('ReOpen').''; + $params['attr']['title'] = $langs->trans("DisabledBecauseReplacedInvoice"); + print dolGetButtonAction($langs->trans('ReOpen'), '', 'default', '#', '', false, $params); } } From c3b22ed26ec1773556140ec2e54e6d62d0e3430a Mon Sep 17 00:00:00 2001 From: steve Date: Wed, 9 Mar 2022 17:10:53 +0100 Subject: [PATCH 091/610] wip: clean comments --- htdocs/compta/facture/card.php | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index c974a1b053c..710ae01d1a6 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -5374,25 +5374,20 @@ if ($action == 'create') { if (!empty($conf->global->INVOICE_CAN_ALWAYS_BE_EDITED) || ($resteapayer == price2num($object->total_ttc, 'MT', 1) && empty($object->paye))) { if (!$objectidnext && $object->is_last_in_cycle()) { if ($usercanunvalidate) { - //print ''.$langs->trans('Modify').''; print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=modif', '', true, $params); } else { - //print ''.$langs->trans('Modify').''; $params['attr']['title'] = $langs->trans('NotEnoughPermissions'); print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=modif', '', false, $params); } } elseif (!$object->is_last_in_cycle()) { - //print ''.$langs->trans('Modify').''; $params['attr']['title'] = $langs->trans('NotLastInCycle'); print dolGetButtonAction($langs->trans('Modify'), '', 'default', '#', '', false, $params); } else { - //print ''.$langs->trans('Modify').''; $params['attr']['title'] = $langs->trans('DisabledBecauseReplacedInvoice'); print dolGetButtonAction($langs->trans('Modify'), '', 'default', '#', '', false, $params); } } } else { - //print ''.$langs->trans('Modify').''; $params['attr']['title'] = $langs->trans('DisabledBecauseDispatchedInBookkeeping'); print dolGetButtonAction($langs->trans('Modify'), '', 'default', '#', '', false, $params); } @@ -5409,10 +5404,8 @@ if ($action == 'create') { && ($object->statut == Facture::STATUS_CLOSED || $object->statut == Facture::STATUS_ABANDONED || ($object->statut == 1 && $object->paye == 1)) // Condition ($object->statut == 1 && $object->paye == 1) should not happened but can be found due to corrupted data && ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || $usercanreopen)) { // A paid invoice (partially or completely) if ($object->close_code != 'replaced' || (!$objectidnext)) { // Not replaced by another invoice or replaced but the replacement invoice has been deleted - //print ''.$langs->trans('ReOpen').''; print dolGetButtonAction($langs->trans('ReOpen'), '', 'default', $_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=reopen&token='.newToken(), '', true, $params); } else { - //print ''.$langs->trans('ReOpen').''; $params['attr']['title'] = $langs->trans("DisabledBecauseReplacedInvoice"); print dolGetButtonAction($langs->trans('ReOpen'), '', 'default', '#', '', false, $params); } @@ -5433,7 +5426,6 @@ if ($action == 'create') { if ($object->statut == Facture::STATUS_DRAFT && count($object->lines) > 0 && ((($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA || $object->type == Facture::TYPE_SITUATION) && (!empty($conf->global->FACTURE_ENABLE_NEGATIVE) || $object->total_ttc >= 0)) || ($object->type == Facture::TYPE_CREDIT_NOTE && $object->total_ttc <= 0))) { if ($usercanvalidate) { print dolGetButtonAction($langs->trans('Validate'), '', 'default', $_SERVER["PHP_SELF"].'?facid='.$object->id.'&action=valid&token='.newToken(), '', true, $params); - //print ''.$langs->trans('Validate').''; } } @@ -5444,10 +5436,8 @@ if ($action == 'create') { print ''.$langs->trans('SendMail').''; } else { if ($usercansend) { - //print ''.$langs->trans('SendMail').''; print dolGetButtonAction($langs->trans('SendMail'), '', 'default', $_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=presend&mode=init#formmailbeforetitle', '', true, $params); } else { - //print ''.$langs->trans('SendMail').''; print dolGetButtonAction($langs->trans('SendMail'), '', 'default', '#', '', false, $params); } } @@ -5485,7 +5475,6 @@ if ($action == 'create') { } else { if ($object->type == Facture::TYPE_DEPOSIT && $resteapayer == 0) { // For down payment, we refuse to receive more than amount to pay. - //print ''.$langs->trans('DoPayment').''; $params['attr']['title'] = $langs->trans('DisabledBecauseRemainderToPayIsZero'); print dolGetButtonAction($langs->trans('DoPayment'), '', 'default', '#', '', false, $params); } else { @@ -5540,11 +5529,9 @@ if ($action == 'create') { ) { if ($object->type == Facture::TYPE_DEPOSIT && price2num($object->total_ttc, 'MT') != price2num($sumofpaymentall, 'MT')) { // We can close a down payment only if paid amount is same than amount of down payment (by definition) - //print ''.$langs->trans('ClassifyPaid').''; $params['attr']['title'] = $langs->trans('AmountPaidMustMatchAmountOfDownPayment'); print dolGetButtonAction($langs->trans('ClassifyPaid'), '', 'default', '#', '', false, $params); } else { - //print ''.$langs->trans('ClassifyPaid').''; print dolGetButtonAction($langs->trans('ClassifyPaid'), '', 'default', $_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=paid', '', true, $params); } } @@ -5590,14 +5577,12 @@ if ($action == 'create') { // Clone if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA) && $usercancreate) { - //print ''.$langs->trans("ToClone").''; print dolGetButtonAction($langs->trans('ToClone'), '', 'default', $_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=clone&object=invoice', '', true, $params); } // Clone as predefined / Create template if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA) && $object->statut == 0 && $usercancreate) { if (!$objectidnext && count($object->lines) > 0) { - //print ''.$langs->trans("ChangeIntoRepeatableInvoice").''; print dolGetButtonAction($langs->trans('ChangeIntoRepeatableInvoice'), '', 'default', DOL_URL_ROOT.'/compta/facture/card-rec.php?facid='.$object->id.'&action=create', '', true, $params); } } @@ -5638,35 +5623,26 @@ if ($action == 'create') { ) ); if ($usercandelete || ($usercancreate && $isErasable == 1)) { // isErasable = 1 means draft with temporary ref (draft can always be deleted with no need of permissions) - //var_dump($isErasable); $enableDelete = false; $deleteHref = '#'; if ($isErasable == -4) { $params['attr']['title'] = $langs->trans('DisabledBecausePayments'); - //print ''.$langs->trans('Delete').''; } elseif ($isErasable == -3) { $params['attr']['title'] = $langs->trans('DisabledBecauseNotLastSituationInvoice'); - //print ''.$langs->trans('Delete').''; } elseif ($isErasable == -2) { $params['attr']['title'] = $langs->trans('DisabledBecauseNotLastInvoice'); - //print ''.$langs->trans('Delete').''; } elseif ($isErasable == -1) { $params['attr']['title'] = $langs->trans('DisabledBecauseDispatchedInBookkeeping'); - //print ''.$langs->trans('Delete').''; } elseif ($isErasable <= 0) { // Any other cases $params['attr']['title'] = $langs->trans('DisabledBecauseNotErasable'); - //print ''.$langs->trans('Delete').''; } elseif ($objectidnext) { $params['attr']['title'] = $langs->trans('DisabledBecauseReplacedInvoice'); - //print ''.$langs->trans('Delete').''; } else { - //print ''.$langs->trans('Delete').''; $deleteHref = $_SERVER["PHP_SELF"].'?facid='.$object->id.'&action=delete&token='.newToken(); $enableDelete = true; } print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $deleteHref, '', $enableDelete, $params); } else { - //print ''.$langs->trans('Delete').''; $params['attr']['title'] = $langs->trans('NotAllowed'); print dolGetButtonAction($langs->trans('Delete'), '', 'delete', '#', '', false, $params); } From f2aaa27d7b25477380272a8ff84afa6115756a65 Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Wed, 9 Mar 2022 17:41:48 +0100 Subject: [PATCH 092/610] FIX : when we use ajax select product fourn price on supplier order for example, unitprice should be rounded with MU and not MT --- htdocs/core/class/html.form.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 39d53e9dbc7..9c14bfeb866 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -3400,7 +3400,7 @@ class Form 'value'=>$outref, 'label'=>$outval, 'qty'=>$outqty, - 'price_ht'=>price2num($objp->unitprice, 'MT'), + 'price_ht'=>price2num($objp->unitprice, 'MU'), 'discount'=>$outdiscount, 'type'=>$outtype, 'duration_value'=>$outdurationvalue, From 3a5a74478f7f359bac4934f2804ae08437bd3a75 Mon Sep 17 00:00:00 2001 From: BB2A Anthony Berton Date: Wed, 9 Mar 2022 18:05:07 +0100 Subject: [PATCH 093/610] Add auther notif --- htdocs/core/class/notify.class.php | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/notify.class.php b/htdocs/core/class/notify.class.php index 853de6d0a41..7e011482f43 100644 --- a/htdocs/core/class/notify.class.php +++ b/htdocs/core/class/notify.class.php @@ -69,7 +69,9 @@ class Notify 'ORDER_CREATE', 'ORDER_VALIDATE', 'PROPAL_VALIDATE', + 'PROPAL_CLOSE_REFUSED', 'PROPAL_CLOSE_SIGNED', + 'PROPAL_SENTBYMAIL', 'FICHINTER_VALIDATE', 'FICHINTER_ADD_CONTACT', 'ORDER_SUPPLIER_VALIDATE', @@ -80,7 +82,8 @@ class Notify 'EXPENSE_REPORT_APPROVE', 'HOLIDAY_VALIDATE', 'HOLIDAY_APPROVE', - 'ACTION_CREATE' + 'ACTION_CREATE', + 'FUNDING_SENTBYMAIL', ); /** @@ -577,6 +580,13 @@ class Notify $labeltouse = $conf->global->ACTION_CREATE_TEMPLATE; $mesg = $outputlangs->transnoentitiesnoconv("EMailTextActionAdded", $link); break; + default: + $object_type = $object->element; + $dir_output = $conf->$object_type->multidir_output[$object->entity ? $object->entity : $conf->entity]."/".get_exdir(0, 0, 0, 1, $object, $object_type); + $template = $notifcode.'_TEMPLATE'; + $labeltouse = $conf->global->$template; + $mesg = $outputlangs->transnoentitiesnoconv('Notify_'.$notifcode).' '.$newref.' '.$dir_output; + break; } include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; @@ -812,9 +822,14 @@ class Notify $object_type = 'action'; $mesg = $langs->transnoentitiesnoconv("EMailTextActionAdded", $link); break; + default: + $object_type = $object->element; + $dir_output = $conf->$object_type->multidir_output[$object->entity ? $object->entity : $conf->entity]."/".get_exdir(0, 0, 0, 1, $object, $object_type); + $mesg = $langs->transnoentitiesnoconv('Notify_'.$notifcode).' '.$newref; + break; } $ref = dol_sanitizeFileName($newref); - $pdf_path = $dir_output."/".$ref."/".$ref.".pdf"; + $pdf_path = $dir_output."/".$ref.".pdf"; if (!dol_is_file($pdf_path)) { // We can't add PDF as it is not generated yet. $filepdf = ''; From 032b8692b1b7425a7ee82bc834f3b32683a6d0a1 Mon Sep 17 00:00:00 2001 From: BB2A Anthony Berton Date: Wed, 9 Mar 2022 19:42:17 +0100 Subject: [PATCH 094/610] Add hook --- ...ce_50_modNotification_Notification.class.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/htdocs/core/triggers/interface_50_modNotification_Notification.class.php b/htdocs/core/triggers/interface_50_modNotification_Notification.class.php index fe89a05ab20..3c52f89cd41 100644 --- a/htdocs/core/triggers/interface_50_modNotification_Notification.class.php +++ b/htdocs/core/triggers/interface_50_modNotification_Notification.class.php @@ -90,9 +90,26 @@ class InterfaceNotification extends DolibarrTriggers public function getListOfManagedEvents() { global $conf; + global $hookmanager; + + + if (!is_object($hookmanager)) { + include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; + $hookmanager = new HookManager($this->db); + } + $hookmanager->initHooks(array('notification')); + + $parameters = array('arrayofnotifsupported'=>$arrayofnotifsupported); + $reshook = $hookmanager->executeHooks('notifsupported', $parameters); + if (empty($reshook)) { + if (!empty($hookmanager->resArray['arrayofnotifsupported'])) { + $this->listofmanagedevents = array_merge($this->listofmanagedevents, $hookmanager->resArray['arrayofnotifsupported']); + } + } $ret = array(); + $sql = "SELECT rowid, code, label, description, elementtype"; $sql .= " FROM ".MAIN_DB_PREFIX."c_action_trigger"; $sql .= $this->db->order("rang, elementtype, code"); From e1e573c532d9e00bf86c1b0c1be0f401f57f69fd Mon Sep 17 00:00:00 2001 From: BB2A Anthony Berton Date: Wed, 9 Mar 2022 19:55:40 +0100 Subject: [PATCH 095/610] Add Hook --- htdocs/core/class/notify.class.php | 21 ++++++++++++------- ..._50_modNotification_Notification.class.php | 3 +-- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/htdocs/core/class/notify.class.php b/htdocs/core/class/notify.class.php index 7e011482f43..df5f19a64bf 100644 --- a/htdocs/core/class/notify.class.php +++ b/htdocs/core/class/notify.class.php @@ -71,7 +71,6 @@ class Notify 'PROPAL_VALIDATE', 'PROPAL_CLOSE_REFUSED', 'PROPAL_CLOSE_SIGNED', - 'PROPAL_SENTBYMAIL', 'FICHINTER_VALIDATE', 'FICHINTER_ADD_CONTACT', 'ORDER_SUPPLIER_VALIDATE', @@ -83,7 +82,6 @@ class Notify 'HOLIDAY_VALIDATE', 'HOLIDAY_APPROVE', 'ACTION_CREATE', - 'FUNDING_SENTBYMAIL', ); /** @@ -358,17 +356,26 @@ class Notify global $dolibarr_main_url_root; global $action; - if (!in_array($notifcode, Notify::$arrayofnotifsupported)) { - return 0; - } - - include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; if (!is_object($hookmanager)) { include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; $hookmanager = new HookManager($this->db); } $hookmanager->initHooks(array('notification')); + + $reshook = $hookmanager->executeHooks('notifsupported'); + if (empty($reshook)) { + if (!empty($hookmanager->resArray['arrayofnotifsupported'])) { + Notify::$arrayofnotifsupported = array_merge(Notify::$arrayofnotifsupported, $hookmanager->resArray['arrayofnotifsupported']); + } + } + + if (!in_array($notifcode, Notify::$arrayofnotifsupported)) { + return 0; + } + + include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + dol_syslog(get_class($this)."::send notifcode=".$notifcode.", object=".$object->id); $langs->load("other"); diff --git a/htdocs/core/triggers/interface_50_modNotification_Notification.class.php b/htdocs/core/triggers/interface_50_modNotification_Notification.class.php index 3c52f89cd41..2013933e54b 100644 --- a/htdocs/core/triggers/interface_50_modNotification_Notification.class.php +++ b/htdocs/core/triggers/interface_50_modNotification_Notification.class.php @@ -99,8 +99,7 @@ class InterfaceNotification extends DolibarrTriggers } $hookmanager->initHooks(array('notification')); - $parameters = array('arrayofnotifsupported'=>$arrayofnotifsupported); - $reshook = $hookmanager->executeHooks('notifsupported', $parameters); + $reshook = $hookmanager->executeHooks('notifsupported'); if (empty($reshook)) { if (!empty($hookmanager->resArray['arrayofnotifsupported'])) { $this->listofmanagedevents = array_merge($this->listofmanagedevents, $hookmanager->resArray['arrayofnotifsupported']); From 1a5beb0664ec00a373695c01bfe0ff2fe7b8c2fc Mon Sep 17 00:00:00 2001 From: BB2A Anthony Berton Date: Wed, 9 Mar 2022 19:55:55 +0100 Subject: [PATCH 096/610] Fix style --- htdocs/core/class/notify.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/notify.class.php b/htdocs/core/class/notify.class.php index df5f19a64bf..1078c02e362 100644 --- a/htdocs/core/class/notify.class.php +++ b/htdocs/core/class/notify.class.php @@ -375,7 +375,7 @@ class Notify } include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - + dol_syslog(get_class($this)."::send notifcode=".$notifcode.", object=".$object->id); $langs->load("other"); From cc57d3dbc105e533db8adcfb3a8e4107cc18d53d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 9 Mar 2022 22:25:29 +0100 Subject: [PATCH 097/610] Fix phpcs --- htdocs/product/class/product.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index b08ccb139ba..323c6ffca3c 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -1804,7 +1804,7 @@ class Product extends CommonObject if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) $sql .= ", pfp.packaging"; $sql .= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp"; $sql .= " WHERE 1 = 1"; - if ($product_id > 0) { + if ($product_id > 0) { $sql .= " AND pfp.fk_product = ".((int) $product_id); } if ($fourn_ref != 'none') { $sql .= " AND pfp.ref_fourn = '".$fourn_ref."'"; From eadd8da3d5110640bdaca2ef46cc31f0289c0fd9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 9 Mar 2022 23:32:59 +0100 Subject: [PATCH 098/610] FIX exclusion of other backup files into backup file --- htdocs/admin/tools/export_files.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/tools/export_files.php b/htdocs/admin/tools/export_files.php index a3c20d0dffc..19a3c83a14c 100644 --- a/htdocs/admin/tools/export_files.php +++ b/htdocs/admin/tools/export_files.php @@ -137,7 +137,7 @@ $dirtocompress = basename($fulldirtocompress); if ($compression == 'zip') { $file .= '.zip'; - $excludefiles = '/(\.back|\.old|\.log|\.pdf_preview-.*\.png|[\/\\\]temp[\/\\\]|documents[\/\\\]admin[\/\\\]documents[\/\\\])/i'; + $excludefiles = '/(\.back|\.old|\.log|\.pdf_preview-.*\.png|[\/\\\]temp[\/\\\]|[\/\\\]admin[\/\\\]documents[\/\\\])/i'; //var_dump($fulldirtocompress); //var_dump($outputdir."/".$file);exit; From d7fe48ebc0be43e3249ea6794d48a96ce38f7ff7 Mon Sep 17 00:00:00 2001 From: Khang Date: Thu, 10 Mar 2022 14:14:10 +0700 Subject: [PATCH 099/610] Vietnam date format https://en.wikipedia.org/wiki/Date_and_time_notation_in_Vietnam --- htdocs/langs/vi_VN/main.lang | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/langs/vi_VN/main.lang b/htdocs/langs/vi_VN/main.lang index 7c554f803a4..be80241bf8a 100644 --- a/htdocs/langs/vi_VN/main.lang +++ b/htdocs/langs/vi_VN/main.lang @@ -8,19 +8,19 @@ FONTFORPDF=DejaVuSans FONTSIZEFORPDF=10 SeparatorDecimal=. SeparatorThousand=, -FormatDateShort=%m/%d/%Y -FormatDateShortInput=%m/%d/%Y -FormatDateShortJava=MM/dd/yyyy -FormatDateShortJavaInput=MM/dd/yyyy -FormatDateShortJQuery=mm/dd/yy -FormatDateShortJQueryInput=mm/dd/yy +FormatDateShort=%d/%m/%Y +FormatDateShortInput=%d/%m/%Y +FormatDateShortJava=dd/MM/yyyy +FormatDateShortJavaInput=dd/MM/yyyy +FormatDateShortJQuery=dd/mm/yy +FormatDateShortJQueryInput=dd/mm/yy FormatHourShortJQuery=HH:MI FormatHourShort=%I:%M %p FormatHourShortDuration=%H:%M FormatDateTextShort=%b %d, %Y FormatDateText=%B %d, %Y -FormatDateHourShort=%m/%d/%Y %I:%M %p -FormatDateHourSecShort=%m/%d/%Y %I:%M:%S %p +FormatDateHourShort=%d/%m/%Y %I:%M %p +FormatDateHourSecShort=%d/%m/%Y %I:%M:%S %p FormatDateHourTextShort=%b %d, %Y, %I:%M %p FormatDateHourText=%B %d, %Y, %I:%M %p DatabaseConnection=Kết nối cơ sở dữ liệu From 7291bbf7102a7d13f31ae66c6b53c33679ab75ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 10 Mar 2022 13:52:05 +0100 Subject: [PATCH 100/610] tooltip order date is date not datetime from sql table date_commande date, -- date de la commande --- htdocs/commande/class/commande.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 0c43cc4ad2d..234f2fba627 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -3723,7 +3723,7 @@ class Commande extends CommonOrder $label .= '
'.$langs->trans('AmountTTC').': '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); } if (!empty($this->date)) { - $label .= '
'.$langs->trans('Date').': '.dol_print_date($this->date, 'dayhour'); + $label .= '
'.$langs->trans('Date').': '.dol_print_date($this->date, 'day'); } if (!empty($this->delivery_date)) { $label .= '
'.$langs->trans('DeliveryDate').': '.dol_print_date($this->delivery_date, 'dayhour'); From f6cfe0557bca6a6f076febc0bb2038461780e39d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 9 Mar 2022 23:32:59 +0100 Subject: [PATCH 101/610] FIX exclusion of other backup files into backup file Conflicts: htdocs/admin/tools/export_files.php --- htdocs/admin/tools/export_files.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/admin/tools/export_files.php b/htdocs/admin/tools/export_files.php index 384b08e19cf..4bae5f4862d 100644 --- a/htdocs/admin/tools/export_files.php +++ b/htdocs/admin/tools/export_files.php @@ -126,8 +126,10 @@ $utils = new Utils($db); if ($compression == 'zip') { $file .= '.zip'; - $excludefiles = '/(\.back|\.old|\.log|[\/\\\]temp[\/\\\]|documents[\/\\\]admin[\/\\\]documents[\/\\\])/i'; + + $excludefiles = '/(\.back|\.old|\.log|\.pdf_preview-.*\.png|[\/\\\]temp[\/\\\]|[\/\\\]admin[\/\\\]documents[\/\\\])/i'; $ret = dol_compress_dir(DOL_DATA_ROOT, $outputdir."/".$file, $compression, $excludefiles); + if ($ret < 0) { if ($ret == -2) { $langs->load("errors"); From 5d942c9d1a8d4bb588845aa07612cb0be82de0f2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 10 Mar 2022 15:46:00 +0100 Subject: [PATCH 102/610] Fix infinit logs --- htdocs/core/class/utils.class.php | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/htdocs/core/class/utils.class.php b/htdocs/core/class/utils.class.php index dee63987d45..5cd5625e051 100644 --- a/htdocs/core/class/utils.class.php +++ b/htdocs/core/class/utils.class.php @@ -292,17 +292,19 @@ class Utils dol_syslog("Run command ".$fullcommandcrypted); $handlein = popen($fullcommandclear, 'r'); $i=0; - while (!feof($handlein)) - { - $i++; // output line number - $read = fgets($handlein); - // Exclude warning line we don't want - if ($i == 1 && preg_match('/Warning.*Using a password/i', $read)) continue; - fwrite($handle,$read); - if (preg_match('/'.preg_quote('-- Dump completed').'/i',$read)) $ok=1; - elseif (preg_match('/'.preg_quote('SET SQL_NOTES=@OLD_SQL_NOTES').'/i',$read)) $ok=1; + if ($handlein) { + while (!feof($handlein)) + { + $i++; // output line number + $read = fgets($handlein); + // Exclude warning line we don't want + if ($i == 1 && preg_match('/Warning.*Using a password/i', $read)) continue; + fwrite($handle,$read); + if (preg_match('/'.preg_quote('-- Dump completed').'/i',$read)) $ok=1; + elseif (preg_match('/'.preg_quote('SET SQL_NOTES=@OLD_SQL_NOTES').'/i',$read)) $ok=1; + } + pclose($handlein); } - pclose($handlein); if ($compression == 'none') fclose($handle); if ($compression == 'gz') gzclose($handle); From fffbc9eac866f63651b97c92790ada8d52fd8f7a Mon Sep 17 00:00:00 2001 From: steve Date: Thu, 10 Mar 2022 15:56:10 +0100 Subject: [PATCH 103/610] wip: Contrat dolGetButtonAction --- htdocs/contrat/card.php | 63 ++++++++++++++++++++++++++++++----------- 1 file changed, 46 insertions(+), 17 deletions(-) diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 87d6b98475b..ab97a549df5 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -2027,62 +2027,87 @@ if ($action == 'create') { $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook if (empty($reshook)) { + $params = array( + 'attr' => array( + 'title' => '', + 'class' => 'classfortooltip' + ) + ); + // Send if (empty($user->socid)) { if ($object->statut == 1) { if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->contrat->creer)) { - print ''; + //print ''; + print dolGetButtonAction($langs->trans('SendMail'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&token='.newToken().'&mode=init#formmailbeforetitle', '', true, $params); } else { - print ''; + //print ''; + print dolGetButtonAction($langs->trans('SendMail'), '', 'default', '#', '', false, $params); } } } if ($object->statut == 0 && $nbofservices) { if ($user->rights->contrat->creer) { - print ''; + //print ''; + print dolGetButtonAction($langs->trans('Validate'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=valid&token='.newToken(), '', true, $params); } else { - print ''; + //print ''; + $params['attr']['title'] = $langs->trans("NotEnoughPermissions"); + print dolGetButtonAction($langs->trans('Validate'), '', 'default', '#', '', false, $params); } } if ($object->statut == 1) { if ($user->rights->contrat->creer) { - print ''; + //print ''; + print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=reopen&token='.newToken(), '', true, $params); } else { - print ''; + //print ''; + $params['attr']['title'] = $langs->trans("NotEnoughPermissions"); + print dolGetButtonAction($langs->trans('Modify'), '', 'default', '#', '', false, $params); } } if (!empty($conf->commande->enabled) && $object->statut > 0 && $object->nbofservicesclosed < $nbofservices) { $langs->load("orders"); if ($user->rights->commande->creer) { - print ''; + //print ''; + print dolGetButtonAction($langs->trans('CreateOrder'), '', 'default', DOL_URL_ROOT.'/commande/card.php?action=create&token='.newToken().'&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->thirdparty->id, '', true, $params); } else { - print ''; + //print ''; + $params['attr']['title'] = $langs->trans("NotEnoughPermissions"); + print dolGetButtonAction($langs->trans('CreateOrder'), '', 'default', '#', '', false, $params); } } if (!empty($conf->facture->enabled) && $object->statut > 0) { $langs->load("bills"); if ($user->rights->facture->creer) { - print ''; + //print ''; + print dolGetButtonAction($langs->trans('CreateBill'), '', 'default', DOL_URL_ROOT.'/compta/facture/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->thirdparty->id, '', true, $params); } else { - print ''; + //print ''; + $params['attr']['title'] = $langs->trans("NotEnoughPermissions"); + print dolGetButtonAction($langs->trans('CreateBill'), '', 'default', '#', '', false, $params); } } if ($object->nbofservicesclosed > 0 || $object->nbofserviceswait > 0) { if ($user->rights->contrat->activer) { - print ''; + //print ''; + print dolGetButtonAction($langs->trans('ActivateAllContracts'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=activate&token='.newToken(), '', true, $params); } else { - print ''; + //print ''; + print dolGetButtonAction($langs->trans('ActivateAllContracts'), '', 'default', '#', '', false, $params); } } if ($object->nbofservicesclosed < $nbofservices) { if ($user->rights->contrat->desactiver) { - print ''; + //print ''; + print dolGetButtonAction($langs->trans('CloseAllContracts'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=close&token='.newToken(), '', true, $params); } else { - print ''; + //print ''; + print dolGetButtonAction($langs->trans('CloseAllContracts'), '', 'default', '#', '', false, $params); } //if (! $numactive) @@ -2104,16 +2129,20 @@ if ($action == 'create') { // Clone if ($user->rights->contrat->creer) { - print ''; + //print ''; + print dolGetButtonAction($langs->trans('ToClone'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&token='.newToken(), '', true, $params); } // On peut supprimer entite si // - Droit de creer + mode brouillon (erreur creation) // - Droit de supprimer if (($user->rights->contrat->creer && $object->statut == $object::STATUS_DRAFT) || $user->rights->contrat->supprimer) { - print ''; + //print ''; + print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), '', true, $params); } else { - print ''; + //print ''; + $params['attr']['title'] = $langs->trans("NotAllowed"); + print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), '', false, $params); } } From 7b3d472fa2f4f497249725a45dca49c23e19d75a Mon Sep 17 00:00:00 2001 From: kevin Date: Thu, 10 Mar 2022 16:10:34 +0100 Subject: [PATCH 104/610] Rework code to best match the standard --- htdocs/projet/tasks/task.php | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index 74ea6b17649..53607645906 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -45,7 +45,6 @@ $confirm = GETPOST('confirm', 'alpha'); $withproject = GETPOST('withproject', 'int'); $project_ref = GETPOST('project_ref', 'alpha'); $planned_workload = ((GETPOST('planned_workloadhour', 'int') != '' || GETPOST('planned_workloadmin', 'int') != '') ? (GETPOST('planned_workloadhour', 'int') > 0 ?GETPOST('planned_workloadhour', 'int') * 3600 : 0) + (GETPOST('planned_workloadmin', 'int') > 0 ?GETPOST('planned_workloadmin', 'int') * 60 : 0) : ''); -$description = GETPOST('description', 'restricthtml'); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('projecttaskcard', 'globalcard')); @@ -451,8 +450,7 @@ if ($id > 0 || !empty($ref)) { if (!empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) { $nbrows = $conf->global->MAIN_INPUT_DESC_HEIGHT; } - $description = !empty($description) ? $description : $object->description; - $doleditor = new DolEditor('description', $description, '', 80, 'dolibarr_details', '', false, true, $cked_enabled, $nbrows); + $doleditor = new DolEditor('description', $object->description, '', 80, 'dolibarr_details', '', false, true, $cked_enabled, $nbrows); print $doleditor->Create(); } print ''; @@ -551,11 +549,7 @@ if ($id > 0 || !empty($ref)) { // Description print ''.$langs->trans("Description").''; - if (!empty($conf->global->FCKEDITOR_ENABLE_SOCIETE)) { - print $object->description; - } else { - print nl2br($object->description); - } + print dol_htmlentitiesbr($object->description); print ''; print ''; From f987c30a10ca67b0d0c1bcecddb98f10afa88a3b Mon Sep 17 00:00:00 2001 From: steve Date: Thu, 10 Mar 2022 16:19:32 +0100 Subject: [PATCH 105/610] clean comments --- htdocs/contrat/card.php | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index ab97a549df5..7265a69d1af 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -2038,10 +2038,8 @@ if ($action == 'create') { if (empty($user->socid)) { if ($object->statut == 1) { if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->contrat->creer)) { - //print ''; print dolGetButtonAction($langs->trans('SendMail'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&token='.newToken().'&mode=init#formmailbeforetitle', '', true, $params); } else { - //print ''; print dolGetButtonAction($langs->trans('SendMail'), '', 'default', '#', '', false, $params); } } @@ -2049,20 +2047,16 @@ if ($action == 'create') { if ($object->statut == 0 && $nbofservices) { if ($user->rights->contrat->creer) { - //print ''; print dolGetButtonAction($langs->trans('Validate'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=valid&token='.newToken(), '', true, $params); } else { - //print ''; $params['attr']['title'] = $langs->trans("NotEnoughPermissions"); print dolGetButtonAction($langs->trans('Validate'), '', 'default', '#', '', false, $params); } } if ($object->statut == 1) { if ($user->rights->contrat->creer) { - //print ''; print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=reopen&token='.newToken(), '', true, $params); } else { - //print ''; $params['attr']['title'] = $langs->trans("NotEnoughPermissions"); print dolGetButtonAction($langs->trans('Modify'), '', 'default', '#', '', false, $params); } @@ -2071,10 +2065,8 @@ if ($action == 'create') { if (!empty($conf->commande->enabled) && $object->statut > 0 && $object->nbofservicesclosed < $nbofservices) { $langs->load("orders"); if ($user->rights->commande->creer) { - //print ''; print dolGetButtonAction($langs->trans('CreateOrder'), '', 'default', DOL_URL_ROOT.'/commande/card.php?action=create&token='.newToken().'&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->thirdparty->id, '', true, $params); } else { - //print ''; $params['attr']['title'] = $langs->trans("NotEnoughPermissions"); print dolGetButtonAction($langs->trans('CreateOrder'), '', 'default', '#', '', false, $params); } @@ -2083,10 +2075,8 @@ if ($action == 'create') { if (!empty($conf->facture->enabled) && $object->statut > 0) { $langs->load("bills"); if ($user->rights->facture->creer) { - //print ''; print dolGetButtonAction($langs->trans('CreateBill'), '', 'default', DOL_URL_ROOT.'/compta/facture/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->thirdparty->id, '', true, $params); } else { - //print ''; $params['attr']['title'] = $langs->trans("NotEnoughPermissions"); print dolGetButtonAction($langs->trans('CreateBill'), '', 'default', '#', '', false, $params); } @@ -2094,19 +2084,15 @@ if ($action == 'create') { if ($object->nbofservicesclosed > 0 || $object->nbofserviceswait > 0) { if ($user->rights->contrat->activer) { - //print ''; print dolGetButtonAction($langs->trans('ActivateAllContracts'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=activate&token='.newToken(), '', true, $params); } else { - //print ''; print dolGetButtonAction($langs->trans('ActivateAllContracts'), '', 'default', '#', '', false, $params); } } if ($object->nbofservicesclosed < $nbofservices) { if ($user->rights->contrat->desactiver) { - //print ''; print dolGetButtonAction($langs->trans('CloseAllContracts'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=close&token='.newToken(), '', true, $params); } else { - //print ''; print dolGetButtonAction($langs->trans('CloseAllContracts'), '', 'default', '#', '', false, $params); } @@ -2129,7 +2115,6 @@ if ($action == 'create') { // Clone if ($user->rights->contrat->creer) { - //print ''; print dolGetButtonAction($langs->trans('ToClone'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&token='.newToken(), '', true, $params); } @@ -2137,10 +2122,8 @@ if ($action == 'create') { // - Droit de creer + mode brouillon (erreur creation) // - Droit de supprimer if (($user->rights->contrat->creer && $object->statut == $object::STATUS_DRAFT) || $user->rights->contrat->supprimer) { - //print ''; print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), '', true, $params); } else { - //print ''; $params['attr']['title'] = $langs->trans("NotAllowed"); print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), '', false, $params); } From bf9b6c05a2c12c39665fc04ca2e9d72ed406a268 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 10 Mar 2022 15:20:37 +0000 Subject: [PATCH 106/610] Fixing style errors. --- htdocs/projet/tasks/task.php | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index e36c243e403..f6e9b6803af 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -99,8 +99,8 @@ if ($action == 'update' && !GETPOST("cancel") && $user->rights->projet->creer) { $object->ref = $taskref ? $taskref : GETPOST("ref", 'alpha', 2); $object->label = GETPOST("label", "alphanohtml"); - if (empty($conf->global->FCKEDITOR_ENABLE_SOCIETE)) $object->description = GETPOST('description', "alphanohtml"); - else $object->description = GETPOST('description', "restricthtml"); + if (empty($conf->global->FCKEDITOR_ENABLE_SOCIETE)) $object->description = GETPOST('description', "alphanohtml"); + else $object->description = GETPOST('description', "restricthtml"); $object->fk_task_parent = $task_parent; $object->planned_workload = $planned_workload; $object->date_start = dol_mktime(GETPOST('dateohour', 'int'), GETPOST('dateomin', 'int'), 0, GETPOST('dateomonth', 'int'), GETPOST('dateoday', 'int'), GETPOST('dateoyear', 'int')); @@ -441,18 +441,18 @@ if ($id > 0 || !empty($ref)) { print ''.$langs->trans("Description").''; print ''; - if (empty($conf->global->FCKEDITOR_ENABLE_SOCIETE)) { - print ''; - } else { - // WYSIWYG editor - include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $cked_enabled = (!empty($conf->global->FCKEDITOR_ENABLE_DETAILS) ? $conf->global->FCKEDITOR_ENABLE_DETAILS : 0); - if (!empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) { - $nbrows = $conf->global->MAIN_INPUT_DESC_HEIGHT; - } - $doleditor = new DolEditor('description', $object->description, '', 80, 'dolibarr_details', '', false, true, $cked_enabled, $nbrows); - print $doleditor->Create(); - } + if (empty($conf->global->FCKEDITOR_ENABLE_SOCIETE)) { + print ''; + } else { + // WYSIWYG editor + include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; + $cked_enabled = (!empty($conf->global->FCKEDITOR_ENABLE_DETAILS) ? $conf->global->FCKEDITOR_ENABLE_DETAILS : 0); + if (!empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) { + $nbrows = $conf->global->MAIN_INPUT_DESC_HEIGHT; + } + $doleditor = new DolEditor('description', $object->description, '', 80, 'dolibarr_details', '', false, true, $cked_enabled, $nbrows); + print $doleditor->Create(); + } print ''; print ''.$langs->trans("Budget").''; From 994ea81ce02f015e6d12fccb06ffafe1ce3b66aa Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 10 Mar 2022 17:24:54 +0100 Subject: [PATCH 107/610] Fix test send email feature --- htdocs/admin/mails.php | 5 +-- htdocs/admin/mails_emailing.php | 66 +++++++++++++++++++-------------- 2 files changed, 41 insertions(+), 30 deletions(-) diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index 41a436b70a8..6b700119e8a 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -50,7 +50,7 @@ $substitutionarrayfortest = array( //'__EMAIL__' => 'RecipientEMail', // Done into actions_sendmails '__CHECK_READ__' => (!empty($object) && is_object($object) && is_object($object->thirdparty)) ? '' : '', '__USER_SIGNATURE__' => (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? $usersignature : ''), // Done into actions_sendmails - '__LOGIN__' => 'RecipientLogin', + '__LOGIN__' => $user->login, '__LASTNAME__' => 'RecipientLastname', '__FIRSTNAME__' => 'RecipientFirstname', '__ADDRESS__'=> 'RecipientAddress', @@ -662,7 +662,7 @@ if ($action == 'edit') { print ''.$langs->trans("MAIN_MAIL_EMAIL_DKIM_ENABLED").''; if (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('swiftmailer'))) { if (function_exists('openssl_open')) { - print yn($conf->global->MAIN_MAIL_EMAIL_DKIM_ENABLED); + print yn(getDolGlobalInt('MAIN_MAIL_EMAIL_DKIM_ENABLED')); } else { print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')'; } @@ -887,7 +887,6 @@ if ($action == 'edit') { } setEventMessages($errormsg, null, 'errors'); - print $errormsg; } print '
'; } diff --git a/htdocs/admin/mails_emailing.php b/htdocs/admin/mails_emailing.php index 6b1aa3334b5..40af4c4ae2a 100644 --- a/htdocs/admin/mails_emailing.php +++ b/htdocs/admin/mails_emailing.php @@ -31,7 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; $langs->loadLangs(array('companies', 'products', 'admin', 'mails', 'other', 'errors')); $action = GETPOST('action', 'aZ09'); -$cancel = GETPOST('cancel', 'alpha'); +$cancel = GETPOST('cancel', 'aZ09'); if (!$user->admin) { accessforbidden(); @@ -40,17 +40,22 @@ if (!$user->admin) { $usersignature = $user->signature; // For action = test or send, we ensure that content is not html, even for signature, because this we want a test with NO html. if ($action == 'test' || $action == 'send') { - $usersignature = dol_string_nohtmltag($usersignature); + $usersignature = dol_string_nohtmltag($usersignature, 2); } $substitutionarrayfortest = array( -'__LOGIN__' => $user->login, -'__ID__' => 'TESTIdRecord', -'__EMAIL__' => 'TESTEMail', -'__LASTNAME__' => 'TESTLastname', -'__FIRSTNAME__' => 'TESTFirstname', -'__USER_SIGNATURE__' => (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? $usersignature : ''), -//'__PERSONALIZED__' => 'TESTPersonalized' // Hiden because not used yet + '__DOL_MAIN_URL_ROOT__'=>DOL_MAIN_URL_ROOT, + '__ID__' => 'RecipientIdRecord', + //'__EMAIL__' => 'RecipientEMail', // Done into actions_sendmails + '__CHECK_READ__' => (!empty($object) && is_object($object) && is_object($object->thirdparty)) ? '' : '', + '__USER_SIGNATURE__' => (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? $usersignature : ''), // Done into actions_sendmails + '__LOGIN__' => $user->login, + '__LASTNAME__' => 'RecipientLastname', + '__FIRSTNAME__' => 'RecipientFirstname', + '__ADDRESS__'=> 'RecipientAddress', + '__ZIP__'=> 'RecipientZip', + '__TOWN_'=> 'RecipientTown', + '__COUNTRY__'=> 'RecipientCountry' ); complete_substitutions_array($substitutionarrayfortest, $langs); @@ -86,10 +91,10 @@ $trackid = (($action == 'testhtml') ? "testhtml" : "test"); $sendcontext = 'emailing'; // Force to use dedicated context of setup for emailing include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; -if ($action == 'presend' && GETPOST('trackid') == 'test') { +if ($action == 'presend' && GETPOST('trackid', 'alphanohtml') == 'test') { $action = 'test'; } -if ($action == 'presend' && GETPOST('trackid') == 'testhtml') { +if ($action == 'presend' && GETPOST('trackid', 'alphanohtml') == 'testhtml') { $action = 'testhtml'; } @@ -271,12 +276,15 @@ if ($action == 'edit') { // Host server - print ''; + print ''; if (!$conf->use_javascript_ajax && $linuxlike && $conf->global->MAIN_MAIL_SENDMODE_EMAILING == 'mail') { + print ''; print $langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike"); print ''; - print $langs->trans("SeeLocalSendMailSetup"); + print ''.$langs->trans("SeeLocalSendMailSetup").''; + print ''; } else { + print ''; $mainserver = (!empty($conf->global->MAIN_MAIL_SMTP_SERVER_EMAILING) ? $conf->global->MAIN_MAIL_SMTP_SERVER_EMAILING : ''); $smtpserver = ini_get('SMTP') ?ini_get('SMTP') : $langs->transnoentities("Undefined"); if ($linuxlike) { @@ -287,17 +295,19 @@ if ($action == 'edit') { print ''; // SuperAdministrator access only if (empty($conf->multicompany->enabled) || ($user->admin && !$user->entity)) { - print ''; + print ''; print ''; - print ''.$langs->trans("SeeLocalSendMailSetup").''; + print ''.$langs->trans("SeeLocalSendMailSetup").''; + print ' '.$langs->trans("SeeLinkToOnlineDocumentation").''; } else { $text = !empty($mainserver) ? $mainserver : $smtpserver; $htmltext = $langs->trans("ContactSuperAdminForChange"); print $form->textwithpicto($text, $htmltext, 1, 'superadmin'); print ''; } + print ''; } - print ''; + print ''; // Port @@ -305,7 +315,7 @@ if ($action == 'edit') { if (!$conf->use_javascript_ajax && $linuxlike && $conf->global->MAIN_MAIL_SENDMODE_EMAILING == 'mail') { print $langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike"); print ''; - print $langs->trans("SeeLocalSendMailSetup"); + print ''.$langs->trans("SeeLocalSendMailSetup").''; } else { $mainport = (!empty($conf->global->MAIN_MAIL_SMTP_PORT_EMAILING) ? $conf->global->MAIN_MAIL_SMTP_PORT_EMAILING : ''); $smtpport = ini_get('smtp_port') ?ini_get('smtp_port') : $langs->transnoentities("Undefined"); @@ -319,7 +329,7 @@ if ($action == 'edit') { if (empty($conf->multicompany->enabled) || ($user->admin && !$user->entity)) { print ''; print ''; - print ''.$langs->trans("SeeLocalSendMailSetup").''; + print ''.$langs->trans("SeeLocalSendMailSetup").''; } else { $text = (!empty($mainport) ? $mainport : $smtpport); $htmltext = $langs->trans("ContactSuperAdminForChange"); @@ -360,7 +370,6 @@ if ($action == 'edit') { } // TLS - print ''.$langs->trans("MAIN_MAIL_EMAIL_TLS").''; if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer')))) { if (function_exists('openssl_open')) { @@ -374,7 +383,6 @@ if ($action == 'edit') { print ''; // STARTTLS - print ''.$langs->trans("MAIN_MAIL_EMAIL_STARTTLS").''; if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer')))) { if (function_exists('openssl_open')) { @@ -388,7 +396,6 @@ if ($action == 'edit') { print ''; // SMTP_ALLOW_SELF_SIGNED_EMAILING - print ''.$langs->trans("MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED").''; if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer')))) { if (function_exists('openssl_open')) { @@ -414,6 +421,7 @@ if ($action == 'edit') { print ''.$langs->trans("EMailsDesc")."
\n"; print "

\n"; + print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table print ''; print ''; @@ -460,7 +468,7 @@ if ($action == 'edit') { print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')'; } } else { - print yn(0).' ('.$langs->trans("NotSupported").')'; + print ''.yn(0).' ('.$langs->trans("NotSupported").')'; } print ''; @@ -492,6 +500,7 @@ if ($action == 'edit') { } print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'; + print '
'; print dol_get_fiche_end(); @@ -543,6 +552,7 @@ if ($action == 'edit') { // Run the test to connect if ($action == 'testconnect') { + print '
'; print load_fiche_titre($langs->trans("DoTestServerAvailability")); include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; @@ -573,16 +583,18 @@ if ($action == 'edit') { // Cree l'objet formulaire mail include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; $formmail = new FormMail($db); + $formmail->trackid = (($action == 'testhtml') ? "testhtml" : "test"); $formmail->fromname = (GETPOSTISSET('fromname') ? GETPOST('fromname', 'restricthtml') : $conf->global->MAIN_MAIL_EMAIL_FROM); $formmail->frommail = (GETPOSTISSET('frommail') ? GETPOST('frommail', 'restricthtml') : $conf->global->MAIN_MAIL_EMAIL_FROM); - $formmail->trackid = (($action == 'testhtml') ? "testhtml" : "test"); + $formmail->fromid = $user->id; + $formmail->fromalsorobot = 1; $formmail->withfromreadonly = 0; $formmail->withsubstit = 0; $formmail->withfrom = 1; $formmail->witherrorsto = 1; - $formmail->withto = (!GETPOST('sendto') ? GETPOST('sendto', 'restricthtml') : ($user->email ? $user->email : 1)); - $formmail->withtocc = (!GETPOST(['sendtocc']) ? GETPOST('sendtocc', 'restricthtml') : 1); // ! empty to keep field if empty - $formmail->withtoccc = (!GETPOST(['sendtoccc']) ? GETPOST('sendtoccc', 'restricthtml') : 1); // ! empty to keep field if empty + $formmail->withto = (GETPOSTISSET('sendto') ? GETPOST('sendto', 'restricthtml') : ($user->email ? $user->email : 1)); + $formmail->withtocc = (GETPOSTISSET(['sendtocc']) ? GETPOST('sendtocc', 'restricthtml') : 1); // ! empty to keep field if empty + $formmail->withtoccc = (GETPOSTISSET(['sendtoccc']) ? GETPOST('sendtoccc', 'restricthtml') : 1); // ! empty to keep field if empty $formmail->withtopic = (GETPOSTISSET('subject') ? GETPOST('subject') : $langs->trans("Test")); $formmail->withtopicreadonly = 0; $formmail->withfile = 2; @@ -601,7 +613,7 @@ if ($action == 'edit') { $formmail->param["returnurl"] = $_SERVER["PHP_SELF"]; // Init list of files - if (GETPOST("mode") == 'init') { + if (GETPOST("mode", "aZ09") == 'init') { $formmail->clear_attached_files(); } From b9a698b3edc597412b7ec8df53bbfca883736365 Mon Sep 17 00:00:00 2001 From: Sylvain Legrand Date: Thu, 10 Mar 2022 17:39:53 +0100 Subject: [PATCH 108/610] DLC and DLUO are reversed in the called function --- htdocs/fourn/commande/dispatch.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index ca9bd1b3065..08b4b2c6bf0 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -337,7 +337,7 @@ if ($action == 'dispatch' && $permissiontoreceive) { } if (!$error) { - $result = $object->dispatchProduct($user, GETPOST($prod, 'int'), GETPOST($qty), GETPOST($ent, 'int'), GETPOST($pu), GETPOST('comment'), $dDLC, $dDLUO, GETPOST($lot, 'alpha'), GETPOST($fk_commandefourndet, 'int'), $notrigger); + $result = $object->dispatchProduct($user, GETPOST($prod, 'int'), GETPOST($qty), GETPOST($ent, 'int'), GETPOST($pu), GETPOST('comment'), $dDLUO, $dDLC, GETPOST($lot, 'alpha'), GETPOST($fk_commandefourndet, 'int'), $notrigger); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); $error++; From 5680e7c3d72594976200ec4cd7ba2fef6e0d7f99 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 10 Mar 2022 18:26:00 +0100 Subject: [PATCH 109/610] FIX Cancel edit on surveyr --- htdocs/opensurvey/results.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/htdocs/opensurvey/results.php b/htdocs/opensurvey/results.php index e37f9bf3de5..b807484cfd4 100644 --- a/htdocs/opensurvey/results.php +++ b/htdocs/opensurvey/results.php @@ -53,7 +53,7 @@ $nblines = $object->fetch_lines(); // Return to the results if (GETPOST('retoursondage')) { - header('Location: results.php?id='.GETPOST('id', 'int')); + header('Location: results.php?id='.(GETPOSTISSET('id_sondage') ? GETPOST('id_sondage', 'aZ09') : GETPOST('id', 'int'))); exit; } @@ -588,6 +588,7 @@ if (GETPOST('ajoutsujet')) { $tmparray = array('checkbox'=>$langs->trans("CheckBox"), 'yesno'=>$langs->trans("YesNoList"), 'foragainst'=>$langs->trans("PourContreList")); print $langs->trans("Type").' '.$form->selectarray("typecolonne", $tmparray, GETPOST('typecolonne')).'

'; print ''; + print ''; print '     '; print ''; print '

'."\n"; @@ -663,6 +664,7 @@ $nbcolonnes = substr_count($object->sujet, ',') + 1; print '
'."\n"; print ''; +print ''; print '
'."\n"; @@ -851,7 +853,7 @@ while ($compteur < $num) { print ''."\n"; if ($user->rights->opensurvey->write) { - print ''."\n"; + print ''."\n"; } // Name @@ -1012,7 +1014,7 @@ while ($compteur < $num) { // Button edit at end of line if ($compteur != $ligneamodifier && ($user->rights->opensurvey->write)) { - print ''."\n"; + print ''."\n"; } //demande de confirmation pour modification de ligne @@ -1021,7 +1023,7 @@ while ($compteur < $num) { if ($compteur == $i) { print ''; print ''; - print ''; + print ''; print ''."\n"; } } From 27baeef719dda7470c5eb859e081007a09f11865 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 10 Mar 2022 20:42:02 +0100 Subject: [PATCH 110/610] Add sticky left --- htdocs/modulebuilder/index.php | 8 ++++---- htdocs/theme/eldy/global.inc.php | 6 ++++++ htdocs/theme/md/style.css.php | 5 +++++ 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index 60f23cbee1a..8488eac3026 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -2287,7 +2287,7 @@ if ($module == 'initmodule') { print ''; print ''; - print_liste_field_titre("#", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder); + print_liste_field_titre("#", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder, ' aaa '); print_liste_field_titre("Table", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Label", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder); print_liste_field_titre("SQL", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder); @@ -2699,7 +2699,7 @@ if ($module == 'initmodule') { print '
'; print '
'; print ''; - print ''; print ''; - print ''; + print ''; print ''; print ''; print ''; @@ -2803,7 +2803,7 @@ if ($module == 'initmodule') { print ''; - print ''; print ''; print ''; diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index ca9de1cc5ab..37d1a4d08ab 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -122,7 +122,7 @@ class MyObject extends CommonObject 'last_main_doc' => array('type'=>'varchar(255)', 'label'=>'LastMainDoc', 'enabled'=>1, 'visible'=>0, 'notnull'=>0, 'position'=>600), 'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'index'=>0, 'position'=>1000), 'model_pdf' => array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'notnull'=>-1, 'position'=>1010), - 'status' => array('type'=>'smallint', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=> 1, 'default'=>0, 'index'=>1, 'position'=>1000, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Validated', 9=>'Canceled'), 'validate'=>1), + 'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=> 1, 'default'=>0, 'index'=>1, 'position'=>1000, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Validated', 9=>'Canceled'), 'validate'=>1), ); /** From bc6249f0eba9fad1f184e26cc29d32f3cf3f5f80 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 10 Mar 2022 22:17:04 +0100 Subject: [PATCH 112/610] Better error message --- htdocs/langs/en_US/modulebuilder.lang | 1 + htdocs/modulebuilder/index.php | 55 ++++++++++++++------------- 2 files changed, 30 insertions(+), 26 deletions(-) diff --git a/htdocs/langs/en_US/modulebuilder.lang b/htdocs/langs/en_US/modulebuilder.lang index 61b5c939d12..2c83ada73c2 100644 --- a/htdocs/langs/en_US/modulebuilder.lang +++ b/htdocs/langs/en_US/modulebuilder.lang @@ -145,3 +145,4 @@ TableNotEmptyDropCanceled=Table not empty. Drop has been canceled. ModuleBuilderNotAllowed=The module builder is available but not allowed to your user. ImportExportProfiles=Import and export profiles ValidateModBuilderDesc=Put 1 if this field need to be validated with $this->validateField() or 0 if validation required +WarningDatabaseIsNotUpdated=Warning: The database is not updated automatically, you must destroy tables and disable-enable the module to have tables recreated \ No newline at end of file diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index e4513b6ff82..4bec7027caf 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -1304,33 +1304,33 @@ if ($dirins && $action == 'addproperty' && empty($cancel) && !empty($module) && $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Type")), null, 'errors'); } - } - if (!$error) { - $addfieldentry = array( - 'name'=>GETPOST('propname', 'aZ09'), - 'label'=>GETPOST('proplabel', 'alpha'), - 'type'=>GETPOST('proptype', 'alpha'), - 'arrayofkeyval'=>GETPOST('proparrayofkeyval', 'restricthtml'), // Example json string '{"0":"Draft","1":"Active","-1":"Cancel"}' - 'visible'=>GETPOST('propvisible', 'int'), - 'enabled'=>GETPOST('propenabled', 'int'), - 'position'=>GETPOST('propposition', 'int'), - 'notnull'=>GETPOST('propnotnull', 'int'), - 'index'=>GETPOST('propindex', 'int'), - 'searchall'=>GETPOST('propsearchall', 'int'), - 'isameasure'=>GETPOST('propisameasure', 'int'), - 'comment'=>GETPOST('propcomment', 'alpha'), - 'help'=>GETPOST('prophelp', 'alpha'), - 'css'=>GETPOST('propcss', 'aZ09'), - 'cssview'=>GETPOST('propcssview', 'aZ09'), - 'csslist'=>GETPOST('propcsslist', 'aZ09'), - 'default'=>GETPOST('propdefault', 'restricthtml'), - 'noteditable'=>intval(GETPOST('propnoteditable', 'int')), - 'validate' => GETPOST('propvalidate', 'int') - ); + if (!$error) { + $addfieldentry = array( + 'name'=>GETPOST('propname', 'aZ09'), + 'label'=>GETPOST('proplabel', 'alpha'), + 'type'=>GETPOST('proptype', 'alpha'), + 'arrayofkeyval'=>GETPOST('proparrayofkeyval', 'restricthtml'), // Example json string '{"0":"Draft","1":"Active","-1":"Cancel"}' + 'visible'=>GETPOST('propvisible', 'int'), + 'enabled'=>GETPOST('propenabled', 'int'), + 'position'=>GETPOST('propposition', 'int'), + 'notnull'=>GETPOST('propnotnull', 'int'), + 'index'=>GETPOST('propindex', 'int'), + 'searchall'=>GETPOST('propsearchall', 'int'), + 'isameasure'=>GETPOST('propisameasure', 'int'), + 'comment'=>GETPOST('propcomment', 'alpha'), + 'help'=>GETPOST('prophelp', 'alpha'), + 'css'=>GETPOST('propcss', 'aZ09'), + 'cssview'=>GETPOST('propcssview', 'aZ09'), + 'csslist'=>GETPOST('propcsslist', 'aZ09'), + 'default'=>GETPOST('propdefault', 'restricthtml'), + 'noteditable'=>intval(GETPOST('propnoteditable', 'int')), + 'validate' => GETPOST('propvalidate', 'int') + ); - if (!empty($addfieldentry['arrayofkeyval']) && !is_array($addfieldentry['arrayofkeyval'])) { - $addfieldentry['arrayofkeyval'] = json_decode($addfieldentry['arrayofkeyval'], true); + if (!empty($addfieldentry['arrayofkeyval']) && !is_array($addfieldentry['arrayofkeyval'])) { + $addfieldentry['arrayofkeyval'] = json_decode($addfieldentry['arrayofkeyval'], true); + } } } @@ -1343,8 +1343,9 @@ if ($dirins && $action == 'addproperty' && empty($cancel) && !empty($module) && // Edit the class file to write properties if (!$error) { $moduletype = 'external'; - + var_dump($addfieldentry); $object = rebuildObjectClass($destdir, $module, $objectname, $newmask, $srcdir, $addfieldentry, $moduletype); + if (is_numeric($object) && $object <= 0) { $error++; } @@ -1363,6 +1364,8 @@ if ($dirins && $action == 'addproperty' && empty($cancel) && !empty($module) && if (!$error) { setEventMessages($langs->trans('FilesForObjectUpdated', $objectname), null); + setEventMessages($langs->trans('WarningDatabaseIsNotUpdated'), null); + clearstatcache(true); // Make a redirect to reload all data From 6100bc86f85cd77dd1599b6147d61eae9d197fdb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Mar 2022 10:32:06 +0100 Subject: [PATCH 113/610] FIX css not saved in modulebuilder --- htdocs/langs/en_US/modulebuilder.lang | 2 +- htdocs/modulebuilder/index.php | 38 ++++++++++++++----- .../core/modules/modMyModule.class.php | 2 +- 3 files changed, 31 insertions(+), 11 deletions(-) diff --git a/htdocs/langs/en_US/modulebuilder.lang b/htdocs/langs/en_US/modulebuilder.lang index 2c83ada73c2..87044364b39 100644 --- a/htdocs/langs/en_US/modulebuilder.lang +++ b/htdocs/langs/en_US/modulebuilder.lang @@ -138,7 +138,7 @@ CSSViewClass=CSS for read form CSSListClass=CSS for list NotEditable=Not editable ForeignKey=Foreign key -TypeOfFieldsHelp=Type of fields:
varchar(99), double(24,8), real, text, html, datetime, timestamp, integer, integer:ClassName:relativepath/to/classfile.class.php[:1[:filter]] ('1' means we add a + button after the combo to create the record, 'filter' can be 'status=1 AND fk_user = __USER_ID AND entity IN (__SHARED_ENTITIES__)' for example) +TypeOfFieldsHelp=Type of fields:
varchar(99), double(24,8), real, text, html, datetime, timestamp, integer, integer:ClassName:relativepath/to/classfile.class.php[:1[:filter]]
'1' means we add a + button after the combo to create the record
'filter' is a sql condition, example: 'status=1 AND fk_user=__USER_ID__ AND entity IN (__SHARED_ENTITIES__)' AsciiToHtmlConverter=Ascii to HTML converter AsciiToPdfConverter=Ascii to PDF converter TableNotEmptyDropCanceled=Table not empty. Drop has been canceled. diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index 4bec7027caf..ba6e951ae55 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -952,6 +952,18 @@ if ($dirins && $action == 'initobject' && $module && GETPOST('createtablearray', if ($fieldname == 'entity') { $index = 1; } + // css + $css = ''; + $cssview = ''; + $csslist = ''; + if ($fieldname == 'import_key') { + $css = 'minwidth300'; + $cssview = 'wordbreak'; + } + if (in_array($fieldname, array('note_public', 'note_private'))) { + $cssview = 'wordbreak'; + } + $string .= "'".$obj->Field."' =>array('type'=>'".$type."', 'label'=>'".$label."',"; if ($default != '') { @@ -969,6 +981,15 @@ if ($dirins && $action == 'initobject' && $module && GETPOST('createtablearray', if ($index) { $string .= ", 'index'=>".$index; } + if ($css) { + $string .= ", 'css'=>".$css; + } + if ($cssview) { + $string .= ", 'cssview'=>".$cssview; + } + if ($csslist) { + $string .= ", 'csslist'=>".$csslist; + } $string .= "),\n"; $string .= "
"; $i += 5; @@ -1320,9 +1341,9 @@ if ($dirins && $action == 'addproperty' && empty($cancel) && !empty($module) && 'isameasure'=>GETPOST('propisameasure', 'int'), 'comment'=>GETPOST('propcomment', 'alpha'), 'help'=>GETPOST('prophelp', 'alpha'), - 'css'=>GETPOST('propcss', 'aZ09'), - 'cssview'=>GETPOST('propcssview', 'aZ09'), - 'csslist'=>GETPOST('propcsslist', 'aZ09'), + 'css'=>GETPOST('propcss', 'alpha'), // Can be 'maxwidth500 widthcentpercentminusxx' for example + 'cssview'=>GETPOST('propcssview', 'alpha'), + 'csslist'=>GETPOST('propcsslist', 'alpha'), 'default'=>GETPOST('propdefault', 'restricthtml'), 'noteditable'=>intval(GETPOST('propnoteditable', 'int')), 'validate' => GETPOST('propvalidate', 'int') @@ -1343,7 +1364,6 @@ if ($dirins && $action == 'addproperty' && empty($cancel) && !empty($module) && // Edit the class file to write properties if (!$error) { $moduletype = 'external'; - var_dump($addfieldentry); $object = rebuildObjectClass($destdir, $module, $objectname, $newmask, $srcdir, $addfieldentry, $moduletype); if (is_numeric($object) && $object <= 0) { @@ -1940,6 +1960,11 @@ if ($module == 'initmodule') { $head2[$h][2] = 'description'; $h++; + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=objects&module='.$module.($forceddirread ? '@'.$dirread : ''); + $head2[$h][1] = $langs->trans("Objects"); + $head2[$h][2] = 'objects'; + $h++; + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=languages&module='.$module.($forceddirread ? '@'.$dirread : ''); $head2[$h][1] = $langs->trans("Languages"); $head2[$h][2] = 'languages'; @@ -1950,11 +1975,6 @@ if ($module == 'initmodule') { $head2[$h][2] = 'dictionaries'; $h++; - $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=objects&module='.$module.($forceddirread ? '@'.$dirread : ''); - $head2[$h][1] = $langs->trans("Objects"); - $head2[$h][2] = 'objects'; - $h++; - $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=permissions&module='.$module.($forceddirread ? '@'.$dirread : ''); $head2[$h][1] = $langs->trans("Permissions"); $head2[$h][2] = 'permissions'; diff --git a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php index 02eb1c18fb6..874d964ad6e 100644 --- a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php +++ b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php @@ -305,7 +305,7 @@ class modMyModule extends DolibarrModules /* BEGIN MODULEBUILDER LEFTMENU MYOBJECT $this->menu[$r++]=array( 'fk_menu'=>'fk_mainmenu=mymodule', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode - 'type'=>'left', // This is a Top menu entry + 'type'=>'left', // This is a Left menu entry 'titre'=>'MyObject', 'prefix' => img_picto('', $this->picto, 'class="paddingright pictofixedwidth valignmiddle"'), 'mainmenu'=>'mymodule', From c9cc067075bcc0f7c3c7cc8b436c4eb031f94557 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 11 Mar 2022 10:48:51 +0100 Subject: [PATCH 114/610] FIX missing parenthesis --- htdocs/comm/propal/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 9e6e68a2ee9..a737da87e94 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -116,7 +116,7 @@ $usercandelete = $user->rights->propal->supprimer; $usercanclose = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->propal->propal_advance->close))); $usercanvalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->propal->propal_advance->validate))); -$usercansend = (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->propal->propal_advance->send)); +$usercansend = (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->propal->propal_advance->send))); $usercancreateorder = $user->rights->commande->creer; $usercancreateinvoice = $user->rights->facture->creer; From f2377627ec01cb8cecd5595a17db9c0684e65e33 Mon Sep 17 00:00:00 2001 From: BB2A Anthony Berton Date: Fri, 11 Mar 2022 10:50:11 +0100 Subject: [PATCH 115/610] Add template custom module --- htdocs/admin/notification.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/admin/notification.php b/htdocs/admin/notification.php index db79a1503c9..f6d71fe6817 100644 --- a/htdocs/admin/notification.php +++ b/htdocs/admin/notification.php @@ -267,6 +267,7 @@ $constantes = array(); foreach ($listofnotifiedevents as $notifiedevent) { $label = $langs->trans("Notify_".$notifiedevent['code']); //!=$langs->trans("Notify_".$notifiedevent['code'])?$langs->trans("Notify_".$notifiedevent['code']):$notifiedevent['label']; $elementLabel = $langs->trans(ucfirst($notifiedevent['elementtype'])); + $model = $notifiedevent['elementtype'].'_send'; if ($notifiedevent['elementtype'] == 'order_supplier') { $elementLabel = $langs->trans('SupplierOrder'); From 193a073b16d42caf64bf21e4563af102182be429 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 11 Mar 2022 11:18:09 +0100 Subject: [PATCH 116/610] FIX missing multientity managed --- htdocs/mrp/class/mo.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index 8b86c7db6e9..6f7dfd2260b 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -46,7 +46,7 @@ class Mo extends CommonObject /** * @var int Does mo support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe */ - public $ismultientitymanaged = 0; + public $ismultientitymanaged = 1; /** * @var int Does mo support extrafields ? 0=No, 1=Yes From 80a2499844965950a154c3ff9397d9a7a9c931f3 Mon Sep 17 00:00:00 2001 From: BB2A Anthony Berton Date: Fri, 11 Mar 2022 11:25:49 +0100 Subject: [PATCH 117/610] Clean --- htdocs/core/class/notify.class.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/core/class/notify.class.php b/htdocs/core/class/notify.class.php index 1078c02e362..0b92cc47a70 100644 --- a/htdocs/core/class/notify.class.php +++ b/htdocs/core/class/notify.class.php @@ -69,7 +69,6 @@ class Notify 'ORDER_CREATE', 'ORDER_VALIDATE', 'PROPAL_VALIDATE', - 'PROPAL_CLOSE_REFUSED', 'PROPAL_CLOSE_SIGNED', 'FICHINTER_VALIDATE', 'FICHINTER_ADD_CONTACT', From f2d52217846554fa6dc979a8421b76c836cd7ca9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Mar 2022 10:55:28 +0100 Subject: [PATCH 118/610] Debug ModuleBuilder --- htdocs/modulebuilder/index.php | 10 +++++-- .../template/class/myobject.class.php | 8 ++--- .../template/myobject_agenda.php | 17 ++++++++--- .../modulebuilder/template/myobject_card.php | 30 ++++++++++++++----- .../template/myobject_contact.php | 17 ++++++++--- .../template/myobject_document.php | 17 ++++++++--- .../modulebuilder/template/myobject_list.php | 22 ++++++++------ .../modulebuilder/template/myobject_note.php | 24 +++++++++++---- 8 files changed, 104 insertions(+), 41 deletions(-) diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index ba6e951ae55..be0d83a50a6 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -956,7 +956,10 @@ if ($dirins && $action == 'initobject' && $module && GETPOST('createtablearray', $css = ''; $cssview = ''; $csslist = ''; - if ($fieldname == 'import_key') { + if (preg_match('/^fk_/', $fieldname)) { + $css = 'maxwidth500 widthcentpercentminusxx'; + } + if ($fieldname == 'label') { $css = 'minwidth300'; $cssview = 'wordbreak'; } @@ -2557,8 +2560,9 @@ if ($module == 'initmodule') { $pathtoapi = strtolower($module).'/class/api_'.strtolower($module).'s.class.php'; $realpathtoapi = $dirread.'/'.$pathtoapi; } - $urloflist = $dirread.'/'.$pathtolist; - $urlofcard = $dirread.'/'.$pathtocard; + + $urloflist = dol_buildpath('/'.$pathtolist, 1); + $urlofcard = dol_buildpath('/'.$pathtocard, 1); print '
'; print ' '.$langs->trans("ClassFile").' : '.($realpathtoclass ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtoclass).($realpathtoclass ? '' : '').''; diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index 37d1a4d08ab..0c3b3745d11 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -108,11 +108,11 @@ class MyObject extends CommonObject 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'searchall'=>1, 'css'=>'minwidth300', 'cssview'=>'wordbreak', 'help'=>'Help text', 'showoncombobox'=>2, 'validate'=>1), 'amount' => array('type'=>'price', 'label'=>'Amount', 'enabled'=>1, 'visible'=>1, 'default'=>'null', 'position'=>40, 'searchall'=>0, 'isameasure'=>1, 'help'=>'Help text for amount', 'validate'=>1), 'qty' => array('type'=>'real', 'label'=>'Qty', 'enabled'=>1, 'visible'=>1, 'default'=>'0', 'position'=>45, 'searchall'=>0, 'isameasure'=>1, 'help'=>'Help text for quantity', 'css'=>'maxwidth75imp', 'validate'=>1), - 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'picto'=>'company', 'label'=>'ThirdParty', 'visible'=> 1, 'enabled'=>1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'help'=>'LinkToThirparty', 'validate'=>1), - 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'picto'=>'project', 'enabled'=>1, 'visible'=>-1, 'position'=>52, 'notnull'=>-1, 'index'=>1, 'validate'=>1), + 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'picto'=>'company', 'label'=>'ThirdParty', 'visible'=> 1, 'enabled'=>1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'help'=>'LinkToThirparty', 'validate'=>1, 'css'=>'maxwidth500 widthcentpercentminusxx'), + 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'picto'=>'project', 'enabled'=>1, 'visible'=>-1, 'position'=>52, 'notnull'=>-1, 'index'=>1, 'validate'=>1, 'css'=>'maxwidth500 widthcentpercentminusxx'), 'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>3, 'position'=>60, 'validate'=>1), - 'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>61, 'validate'=>1), - 'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>62, 'validate'=>1), + 'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>61, 'validate'=>1, 'cssview'=>'wordbreak'), + 'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>62, 'validate'=>1, 'cssview'=>'wordbreak'), 'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'notnull'=> 1, 'position'=>500), 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'notnull'=> 0, 'position'=>501), //'date_validation ' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>502), diff --git a/htdocs/modulebuilder/template/myobject_agenda.php b/htdocs/modulebuilder/template/myobject_agenda.php index 5eb4f6e3028..b40092f93a7 100644 --- a/htdocs/modulebuilder/template/myobject_agenda.php +++ b/htdocs/modulebuilder/template/myobject_agenda.php @@ -132,15 +132,24 @@ if ($id > 0 || !empty($ref)) { $upload_dir = $conf->mymodule->multidir_output[!empty($object->entity) ? $object->entity : $conf->entity]."/".$object->id; } -$permissiontoadd = $user->rights->mymodule->myobject->write; // Used by the include of actions_addupdatedelete.inc.php +// There is several ways to check permission. +// Set $enablepermissioncheck to 1 to enable a minimum low level of checks +$enablepermissioncheck = 0; +if ($enablepermissioncheck) { + $permissiontoread = $user->rights->mymodule->myobject->read; + $permissiontoadd = $user->rights->mymodule->myobject->write; +} else { + $permissiontoread = 1; + $permissiontoadd = 1; +} // Security check (enable the most restrictive one) //if ($user->socid > 0) accessforbidden(); //if ($user->socid > 0) $socid = $user->socid; //$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); //restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); -//if (empty($conf->mymodule->enabled)) accessforbidden(); -//if (!$permissiontoread) accessforbidden(); +if (empty($conf->mymodule->enabled)) accessforbidden(); +if (!$permissiontoread) accessforbidden(); /* @@ -187,7 +196,7 @@ if ($object->id > 0) { $head = myobjectPrepareHead($object); - print dol_get_fiche_head($head, 'agenda', '', -1, $object->picto); + print dol_get_fiche_head($head, 'agenda', $langs->trans("MyObject"), -1, $object->picto); // Object card // ------------------------------------------------------------ diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php index bacb2f988dc..f53ce5adae3 100644 --- a/htdocs/modulebuilder/template/myobject_card.php +++ b/htdocs/modulebuilder/template/myobject_card.php @@ -122,12 +122,23 @@ if (empty($action) && empty($id) && empty($ref)) { // Load object include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once. +// There is several ways to check permission. +// Set $enablepermissioncheck to 1 to enable a minimum low level of checks +$enablepermissioncheck = 0; +if ($enablepermissioncheck) { + $permissiontoread = $user->rights->mymodule->myobject->read; + $permissiontoadd = $user->rights->mymodule->myobject->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php + $permissiontodelete = $user->rights->mymodule->myobject->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT); + $permissionnote = $user->rights->mymodule->myobject->write; // Used by the include of actions_setnotes.inc.php + $permissiondellink = $user->rights->mymodule->myobject->write; // Used by the include of actions_dellink.inc.php +} else { + $permissiontoread = 1; + $permissiontoadd = 1; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php + $permissiontodelete = 1; + $permissionnote = 1; + $permissiondellink = 1; +} -$permissiontoread = $user->rights->mymodule->myobject->read; -$permissiontoadd = $user->rights->mymodule->myobject->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php -$permissiontodelete = $user->rights->mymodule->myobject->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT); -$permissionnote = $user->rights->mymodule->myobject->write; // Used by the include of actions_setnotes.inc.php -$permissiondellink = $user->rights->mymodule->myobject->write; // Used by the include of actions_dellink.inc.php $upload_dir = $conf->mymodule->multidir_output[isset($object->entity) ? $object->entity : 1].'/myobject'; // Security check (enable the most restrictive one) @@ -135,8 +146,8 @@ $upload_dir = $conf->mymodule->multidir_output[isset($object->entity) ? $object- //if ($user->socid > 0) $socid = $user->socid; //$isdraft = (isset($object->status) && ($object->status == $object::STATUS_DRAFT) ? 1 : 0); //restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); -//if (empty($conf->mymodule->enabled)) accessforbidden(); -//if (!$permissiontoread) accessforbidden(); +if (empty($conf->mymodule->enabled)) accessforbidden(); +if (!$permissiontoread) accessforbidden(); /* @@ -230,6 +241,11 @@ llxHeader('', $title, $help_url); // Part to create if ($action == 'create') { + if (empty($permissiontoadd)) { + accessforbidden($langs->trans('NotEnoughPermissions'), 0, 1); + exit; + } + print load_fiche_titre($langs->trans("NewObject", $langs->transnoentitiesnoconv("MyObject")), '', 'object_'.$object->picto); print ''; diff --git a/htdocs/modulebuilder/template/myobject_contact.php b/htdocs/modulebuilder/template/myobject_contact.php index d2de342c861..64f5ebba976 100644 --- a/htdocs/modulebuilder/template/myobject_contact.php +++ b/htdocs/modulebuilder/template/myobject_contact.php @@ -78,15 +78,24 @@ $extrafields->fetch_name_optionals_label($object->table_element); // Load object include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals -$permission = $user->rights->mymodule->myobject->write; +// There is several ways to check permission. +// Set $enablepermissioncheck to 1 to enable a minimum low level of checks +$enablepermissioncheck = 0; +if ($enablepermissioncheck) { + $permissiontoread = $user->rights->mymodule->myobject->read; + $permission = $user->rights->mymodule->myobject->write; +} else { + $permissiontoread = 1; + $permission = 1; +} // Security check (enable the most restrictive one) //if ($user->socid > 0) accessforbidden(); //if ($user->socid > 0) $socid = $user->socid; //$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); //restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); -//if (empty($conf->mymodule->enabled)) accessforbidden(); -//if (!$permissiontoread) accessforbidden(); +if (empty($conf->mymodule->enabled)) accessforbidden(); +if (!$permissiontoread) accessforbidden(); /* @@ -152,7 +161,7 @@ if ($object->id) { */ $head = myobjectPrepareHead($object); - print dol_get_fiche_head($head, 'contact', '', -1, $object->picto); + print dol_get_fiche_head($head, 'contact', $langs->trans("MyObject"), -1, $object->picto); $linkback = ''.$langs->trans("BackToList").''; diff --git a/htdocs/modulebuilder/template/myobject_document.php b/htdocs/modulebuilder/template/myobject_document.php index 3db0271dd01..d1040364182 100644 --- a/htdocs/modulebuilder/template/myobject_document.php +++ b/htdocs/modulebuilder/template/myobject_document.php @@ -124,15 +124,24 @@ if ($id > 0 || !empty($ref)) { $upload_dir = $conf->mymodule->multidir_output[$object->entity ? $object->entity : $conf->entity]."/myobject/".get_exdir(0, 0, 0, 1, $object); } -$permissiontoadd = $user->rights->mymodule->myobject->write; // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles.inc.php +// There is several ways to check permission. +// Set $enablepermissioncheck to 1 to enable a minimum low level of checks +$enablepermissioncheck = 0; +if ($enablepermissioncheck) { + $permissiontoread = $user->rights->mymodule->myobject->read; + $permissiontoadd = $user->rights->mymodule->myobject->write; // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles.inc.php +} else { + $permissiontoread = 1; + $permission = 1; +} // Security check (enable the most restrictive one) //if ($user->socid > 0) accessforbidden(); //if ($user->socid > 0) $socid = $user->socid; //$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); //restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); -//if (empty($conf->mymodule->enabled)) accessforbidden(); -//if (!$permissiontoread) accessforbidden(); +if (empty($conf->mymodule->enabled)) accessforbidden(); +if (!$permissiontoread) accessforbidden(); /* @@ -159,7 +168,7 @@ if ($object->id) { */ $head = myobjectPrepareHead($object); - print dol_get_fiche_head($head, 'document', '', -1, $object->picto); + print dol_get_fiche_head($head, 'document', $langs->trans("MyObject"), -1, $object->picto); // Build file list diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index ced309b4eff..92b131d56ba 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -176,13 +176,17 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); -$permissiontoread = $user->rights->mymodule->myobject->read; -$permissiontoadd = $user->rights->mymodule->myobject->write; -$permissiontodelete = $user->rights->mymodule->myobject->delete; - -// Security check -if (empty($conf->mymodule->enabled)) { - accessforbidden('Module not enabled'); +// There is several ways to check permission. +// Set $enablepermissioncheck to 1 to enable a minimum low level of checks +$enablepermissioncheck = 0; +if ($enablepermissioncheck) { + $permissiontoread = $user->rights->mymodule->myobject->read; + $permissiontoadd = $user->rights->mymodule->myobject->write; + $permissiontodelete = $user->rights->mymodule->myobject->delete; +} else { + $permissiontoread = 1; + $permissiontoadd = 1; + $permissiontodelete = 1; } // Security check (enable the most restrictive one) @@ -191,8 +195,8 @@ if ($user->socid > 0) accessforbidden(); //$socid = 0; if ($user->socid > 0) $socid = $user->socid; //$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); //restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); -//if (empty($conf->mymodule->enabled)) accessforbidden(); -//if (!$permissiontoread) accessforbidden(); +if (empty($conf->mymodule->enabled)) accessforbidden('Moule not enabled'); +if (!$permissiontoread) accessforbidden(); diff --git a/htdocs/modulebuilder/template/myobject_note.php b/htdocs/modulebuilder/template/myobject_note.php index 6733919289b..9c6831e5c7b 100644 --- a/htdocs/modulebuilder/template/myobject_note.php +++ b/htdocs/modulebuilder/template/myobject_note.php @@ -101,23 +101,35 @@ if ($id > 0 || !empty($ref)) { $upload_dir = $conf->mymodule->multidir_output[!empty($object->entity) ? $object->entity : $conf->entity]."/".$object->id; } -$permissionnote = $user->rights->mymodule->myobject->write; // Used by the include of actions_setnotes.inc.php -$permissiontoadd = $user->rights->mymodule->myobject->write; // Used by the include of actions_addupdatedelete.inc.php + +// There is several ways to check permission. +// Set $enablepermissioncheck to 1 to enable a minimum low level of checks +$enablepermissioncheck = 0; +if ($enablepermissioncheck) { + $permissiontoread = $user->rights->mymodule->myobject->read; + $permissiontoadd = $user->rights->mymodule->myobject->write; + $permissionnote = $user->rights->mymodule->myobject->write; // Used by the include of actions_setnotes.inc.php +} else { + $permissiontoread = 1; + $permissiontoadd = 1; + $permissionnote = 1; +} // Security check (enable the most restrictive one) //if ($user->socid > 0) accessforbidden(); //if ($user->socid > 0) $socid = $user->socid; //$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); //restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); -//if (empty($conf->mymodule->enabled)) accessforbidden(); -//if (!$permissiontoread) accessforbidden(); +if (empty($conf->mymodule->enabled)) accessforbidden(); +if (!$permissiontoread) accessforbidden(); /* * Actions */ -$reshook = $hookmanager->executeHooks('doActions', array(), $object, $action); // Note that $action and $object may have been modified by some hooks +$parameters = array(); +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } @@ -141,7 +153,7 @@ if ($id > 0 || !empty($ref)) { $head = myobjectPrepareHead($object); - print dol_get_fiche_head($head, 'note', '', -1, $object->picto); + print dol_get_fiche_head($head, 'note', $langs->trans("MyObject"), -1, $object->picto); // Object card // ------------------------------------------------------------ From 32b508ae1921ec63bed5d3235fc16d3bc25bb7ef Mon Sep 17 00:00:00 2001 From: BB2A Anthony Berton Date: Fri, 11 Mar 2022 11:48:50 +0100 Subject: [PATCH 119/610] Lang --- htdocs/langs/en_US/propal.lang | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/langs/en_US/propal.lang b/htdocs/langs/en_US/propal.lang index db7b559a8a7..82854821176 100644 --- a/htdocs/langs/en_US/propal.lang +++ b/htdocs/langs/en_US/propal.lang @@ -92,6 +92,7 @@ LineBuyPriceHT=Buy Price Amount net of tax for line SignPropal=Accept proposal RefusePropal=Refuse proposal Sign=Sign +NoSign=Refuse PropalAlreadySigned=Proposal already accepted PropalAlreadyRefused=Proposal already refused PropalSigned=Proposal accepted From 31aa5515dbb35825e66f1ff4ce42fb12b22ce986 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Mar 2022 12:05:28 +0100 Subject: [PATCH 120/610] Debug v15 --- htdocs/adherents/card.php | 20 ++------------ htdocs/adherents/subscription.php | 46 +++++++++++++++---------------- 2 files changed, 26 insertions(+), 40 deletions(-) diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index a2e3779d52b..99ebda6fcd7 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -1718,8 +1718,6 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print '
'; print ''; - print ''; - // Company print ''; @@ -1736,9 +1734,9 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { if ($user->admin) { print ''; } - print 'trans("Hidden").''; + print ''.$langs->trans("Hidden").''; } - if ((!empty($object->pass) || !empty($object->pass_crypted)) && empty($object->user_id)) { + if (!empty($object->pass_indatabase) && empty($object->user_id)) { // Show warning only for old password still in clear (does not happen anymore) $langs->load("errors"); $htmltext = $langs->trans("WarningPasswordSetWithNoAccount"); print ' '.$form->textwithpicto('', $htmltext, 1, 'warning'); @@ -1777,7 +1775,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print '
'; print '
'; - print '
'.$langs->trans("Property"); + print ''.$langs->trans("Property"); print ' ('.$langs->trans("SeeExamples").')'; print ''; @@ -2736,7 +2736,7 @@ if ($module == 'initmodule') { if (!empty($properties)) { // Line to add a property print '
'; + print ''; print dol_escape_htmltag($propname); print ''; diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 06b52f7f4f1..1ba6ec11119 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -3543,6 +3543,12 @@ td.border, div.tagtable div div.border { width:auto; } +.thsticky, .tdsticky { + position: sticky; + left: 0px; +} + + /* To have left column sticky */ /*.tagtable td[data-key="ref"], .tagtable th[data-key="ref"] { position: sticky; diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 700449d177a..be8bf0f009e 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -3599,6 +3599,11 @@ td.border, div.tagtable div div.border { width:auto; } +.thsticky, .tdsticky { + position: sticky; + left: 0px; +} + global->THEME_ENABLE_STICKY_COLUMN_REF)) { ?> /* To have left column sticky */ .tagtable td[data-key="ref"], .tagtable th[data-key="ref"] { From 5516eae05694c23275d8b66c7163c7387173f546 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 10 Mar 2022 21:31:09 +0100 Subject: [PATCH 111/610] FIX type smallint in module builder and case in values of a property --- htdocs/modulebuilder/index.php | 6 +++--- htdocs/modulebuilder/template/class/myobject.class.php | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index 4e66e655f5e..e4513b6ff82 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -2815,7 +2815,7 @@ if ($module == 'initmodule') { print ''; print ''; print ''; @@ -2881,8 +2881,8 @@ if ($module == 'initmodule') { print ''; if ($proparrayofkeyval) { - print ''; - print dol_escape_htmltag(json_encode($proparrayofkeyval)); + print ''; + print dol_escape_htmltag(json_encode($proparrayofkeyval, JSON_UNESCAPED_UNICODE)); print ''; } print '
'.$langs->trans("MemberNature").''.$object->getmorphylib().'
'.$langs->trans("Company").''.dol_escape_htmltag($object->company).'
'; + print '
'; // Tags / Categories if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) { @@ -1852,18 +1850,6 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { } print ''; - // VCard - /* - print ''; - */ - print "
'; - print $langs->trans("VCard").''; - print ''; - print img_picto($langs->trans("Download").' vcard', 'vcard.png', 'class="paddingrightonly"'); - print $langs->trans("Download"); - print img_picto($langs->trans("Download").' vcard', 'download', 'class="paddingleft"'); - print ''; - print '
\n"; print "
\n"; diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php index e26db90c4ff..1e83a9c6c19 100644 --- a/htdocs/adherents/subscription.php +++ b/htdocs/adherents/subscription.php @@ -499,7 +499,7 @@ if ($rowid > 0) { // Login if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) { - print ''.$langs->trans("Login").' / '.$langs->trans("Id").''.$object->login.' '; + print ''.$langs->trans("Login").' / '.$langs->trans("Id").''.dol_escape_htmltag($object->login).''; } // Type @@ -510,25 +510,24 @@ if ($rowid > 0) { print ''; // Company - print ''.$langs->trans("Company").''.$object->company.''; + print ''.$langs->trans("Company").''.dol_escape_htmltag($object->company).''; // Civility - print ''.$langs->trans("UserTitle").''.$object->getCivilityLabel().' '; + print ''.$langs->trans("UserTitle").''.$object->getCivilityLabel().''; print ''; // Password if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) { - print ''.$langs->trans("Password").''.preg_replace('/./i', '*', $object->pass); + print ''.$langs->trans("Password").''; if ($object->pass) { print preg_replace('/./i', '*', $object->pass); } else { if ($user->admin) { - print $langs->trans("Crypted").': '.$object->pass_indatabase_crypted; - } else { - print $langs->trans("Hidden"); + print ''; } + print ''.$langs->trans("Hidden").''; } - if ((!empty($object->pass) || !empty($object->pass_crypted)) && empty($object->user_id)) { + if (!empty($object->pass_indatabase) && empty($object->user_id)) { // Show warning only for old password still in clear (does not happen anymore) $langs->load("errors"); $htmltext = $langs->trans("WarningPasswordSetWithNoAccount"); print ' '.$form->textwithpicto('', $htmltext, 1, 'warning'); @@ -544,15 +543,17 @@ if ($rowid > 0) { print " ".img_warning($langs->trans("Late")); } } else { - if (!$adht->subscription) { + if ($object->need_subscription == 0) { + print $langs->trans("SubscriptionNotNeeded"); + } elseif (!$adht->subscription) { print $langs->trans("SubscriptionNotRecorded"); - if ($object->statut > 0) { - print " ".img_warning($langs->trans("Late")); // Display a delay picto only if it is not a draft and is not canceled + if (Adherent::STATUS_VALIDATED == $object->statut) { + print " ".img_warning($langs->trans("Late")); // displays delay Pictogram only if not a draft, not excluded and not resiliated } } else { print $langs->trans("SubscriptionNotReceived"); - if ($object->statut > 0) { - print " ".img_warning($langs->trans("Late")); // Display a delay picto only if it is not a draft and is not canceled + if (Adherent::STATUS_VALIDATED == $object->statut) { + print " ".img_warning($langs->trans("Late")); // displays delay Pictogram only if not a draft, not excluded and not resiliated } } } @@ -561,18 +562,13 @@ if ($rowid > 0) { print ''; print ''; - print '
'; + print '
'; print '
'; + print ''; - // Birthday - print ''; - - // Public - print ''; - - // Categories + // Tags / Categories if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) { print ''; print ''; } + // Birth Date + print ''; + + // Public + print ''; + // Other attributes $cols = 2; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; @@ -661,8 +663,6 @@ if ($rowid > 0) { print dol_get_fiche_end(); - print ''; - /* * Action bar From 9e3742ab81c4945effc3e17fe2b69444d1d3f880 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Mar 2022 13:34:14 +0100 Subject: [PATCH 121/610] Trans --- htdocs/langs/en_US/modulebuilder.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/modulebuilder.lang b/htdocs/langs/en_US/modulebuilder.lang index 87044364b39..86ff832cd04 100644 --- a/htdocs/langs/en_US/modulebuilder.lang +++ b/htdocs/langs/en_US/modulebuilder.lang @@ -94,7 +94,7 @@ LanguageDefDesc=Enter in this files, all the key and the translation for each la MenusDefDesc=Define here the menus provided by your module DictionariesDefDesc=Define here the dictionaries provided by your module PermissionsDefDesc=Define here the new permissions provided by your module -MenusDefDescTooltip=The menus provided by your module/application are defined into the array $this->menus into the module descriptor file. You can edit manually this file or use the embedded editor.

Note: Once defined (and module re-activated), menus are also visible into the menu editor available to administrator users on %s. +MenusDefDescTooltip=The menus provided by your module/application are defined into the array $this->menus into the module descriptor file. You can edit manually this file or use the embedded editor.

Note: Once defined (and the module re-activated), the menus are also visible into the menu editor available to administrator users on %s. DictionariesDefDescTooltip=The dictionaries provided by your module/application are defined into the array $this->dictionaries into the module descriptor file. You can edit manually this file or use the embedded editor.

Note: Once defined (and module re-activated), dictionaries are also visible into the setup area to administrator users on %s. PermissionsDefDescTooltip=The permissions provided by your module/application are defined into the array $this->rights into the module descriptor file. You can edit manually this file or use the embedded editor.

Note: Once defined (and module re-activated), permissions are visible into the default permissions setup %s. HooksDefDesc=Define in the module_parts['hooks'] property, in the module descriptor, the context of hooks you want to manage (list of contexts can be found by a search on 'initHooks(' in core code).
Edit the hook file to add code of your hooked functions (hookable functions can be found by a search on 'executeHooks' in core code). From 11d18fae4a4c6535fcdf41c2fdbf0f02afd8f43a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Mar 2022 13:36:58 +0100 Subject: [PATCH 122/610] Clean code --- .../interface_99_modZapier_ZapierTriggers.class.php | 12 +----------- ...terface_99_modMyModule_MyModuleTriggers.class.php | 2 -- 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/htdocs/core/triggers/interface_99_modZapier_ZapierTriggers.class.php b/htdocs/core/triggers/interface_99_modZapier_ZapierTriggers.class.php index 8025f0c0293..8a2cffe05f3 100644 --- a/htdocs/core/triggers/interface_99_modZapier_ZapierTriggers.class.php +++ b/htdocs/core/triggers/interface_99_modZapier_ZapierTriggers.class.php @@ -18,17 +18,7 @@ /** * \file core/triggers/interface_99_modZapier_ZapierTriggers.class.php * \ingroup zapier - * \brief Example trigger. - * - * - * \remarks You can create other triggers by copying this one. - * - File name should be either: - * - interface_99_modZapier_MyTrigger.class.php - * - interface_99_all_MyTrigger.class.php - * - The file must stay in core/triggers - * - The class name must be InterfaceMytrigger - * - The constructor method must be named InterfaceMytrigger - * - The name property name must be MyTrigger + * \brief File for Zappier Triggers. */ require_once DOL_DOCUMENT_ROOT.'/core/triggers/dolibarrtriggers.class.php'; diff --git a/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php b/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php index e29057c5423..37ece327185 100644 --- a/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php +++ b/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php @@ -28,8 +28,6 @@ * - interface_99_all_MyTrigger.class.php * - The file must stay in core/triggers * - The class name must be InterfaceMytrigger - * - The constructor method must be named InterfaceMytrigger - * - The name property name must be MyTrigger */ require_once DOL_DOCUMENT_ROOT.'/core/triggers/dolibarrtriggers.class.php'; From f72f71a972bc24656bec1f7c6433fb503281efb4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Mar 2022 16:21:28 +0100 Subject: [PATCH 123/610] FIX Delete of doc and package in modulebuilder --- htdocs/core/class/utils.class.php | 12 ++++++++++-- htdocs/langs/en_US/modulebuilder.lang | 5 +++-- htdocs/modulebuilder/admin/setup.php | 2 +- htdocs/modulebuilder/index.php | 23 +++++++++++++++-------- 4 files changed, 29 insertions(+), 13 deletions(-) diff --git a/htdocs/core/class/utils.class.php b/htdocs/core/class/utils.class.php index 2fa329406fb..2f32e600841 100644 --- a/htdocs/core/class/utils.class.php +++ b/htdocs/core/class/utils.class.php @@ -847,8 +847,13 @@ class Utils $resarray = $utils->executeCLI($command, $outfile); if ($resarray['result'] != '0') { $this->error = $resarray['error'].' '.$resarray['output']; + $this->errors[] = $this->error; } $result = ($resarray['result'] == 0) ? 1 : 0; + if ($result < 0 && empty($this->errors)) { + $this->error = $langs->trans("ErrorFailToGenerateFile", $FILENAMEDOC); + $this->errors[] = $this->error; + } // Build PDF doc $command = $conf->global->MODULEBUILDER_ASCIIDOCTORPDF.' '.$destfile.' -n -o '.$dirofmoduledoc.'/'.$FILENAMEDOCPDF; @@ -856,8 +861,13 @@ class Utils $resarray = $utils->executeCLI($command, $outfile); if ($resarray['result'] != '0') { $this->error = $resarray['error'].' '.$resarray['output']; + $this->errors[] = $this->error; } $result = ($resarray['result'] == 0) ? 1 : 0; + if ($result < 0 && empty($this->errors)) { + $this->error = $langs->trans("ErrorFailToGenerateFile", $FILENAMEDOCPDF); + $this->errors[] = $this->error; + } chdir($currentdir); } else { @@ -868,8 +878,6 @@ class Utils return 1; } else { $error++; - $langs->load("errors"); - $this->error = $langs->trans("ErrorFailToGenerateFile", $outputfiledoc); } } else { $error++; diff --git a/htdocs/langs/en_US/modulebuilder.lang b/htdocs/langs/en_US/modulebuilder.lang index 86ff832cd04..7610aa78e9e 100644 --- a/htdocs/langs/en_US/modulebuilder.lang +++ b/htdocs/langs/en_US/modulebuilder.lang @@ -110,7 +110,7 @@ DropTableIfEmpty=(Destroy table if empty) TableDoesNotExists=The table %s does not exists TableDropped=Table %s deleted InitStructureFromExistingTable=Build the structure array string of an existing table -UseAboutPage=Disable the about page +UseAboutPage=Do not generate the About page UseDocFolder=Disable the documentation folder UseSpecificReadme=Use a specific ReadMe ContentOfREADMECustomized=Note: The content of the README.md file has been replaced with the specific value defined into setup of ModuleBuilder. @@ -145,4 +145,5 @@ TableNotEmptyDropCanceled=Table not empty. Drop has been canceled. ModuleBuilderNotAllowed=The module builder is available but not allowed to your user. ImportExportProfiles=Import and export profiles ValidateModBuilderDesc=Put 1 if this field need to be validated with $this->validateField() or 0 if validation required -WarningDatabaseIsNotUpdated=Warning: The database is not updated automatically, you must destroy tables and disable-enable the module to have tables recreated \ No newline at end of file +WarningDatabaseIsNotUpdated=Warning: The database is not updated automatically, you must destroy tables and disable-enable the module to have tables recreated +LinkToParentMenu=Parent menu (fk_xxxxmenu) \ No newline at end of file diff --git a/htdocs/modulebuilder/admin/setup.php b/htdocs/modulebuilder/admin/setup.php index e5ccb0c3966..01a02d0c7dd 100644 --- a/htdocs/modulebuilder/admin/setup.php +++ b/htdocs/modulebuilder/admin/setup.php @@ -120,7 +120,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { print '
'; print ''; - print ''; print_liste_field_titre("Type", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder); - print_liste_field_titre("fk_menu", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder); + print_liste_field_titre("LinkToParentMenu", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Title", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder); print_liste_field_titre("mainmenu", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder); print_liste_field_titre("leftmenu", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder); - print_liste_field_titre("URL", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder); + print_liste_field_titre("RelativeURL", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder); print_liste_field_titre("LanguageFile", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder); - print_liste_field_titre("Position", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder); - print_liste_field_titre("Enabled", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder); + print_liste_field_titre("Position", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("Enabled", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre("Permission", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Target", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder); print_liste_field_titre("UserType", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder, 'right '); @@ -3148,15 +3148,15 @@ if ($module == 'initmodule') { print dol_escape_htmltag($menu['langs']); print ''; - print ''; - print ''; - print ''; @@ -3858,8 +3858,10 @@ if ($module == 'initmodule') { $FILENAMEDOCPDF = $modulelowercase.'.pdf'; $outputfiledoc = dol_buildpath($modulelowercase, 0).'/doc/'.$FILENAMEDOC; $outputfiledocurl = dol_buildpath($modulelowercase, 1).'/doc/'.$FILENAMEDOC; + $outputfiledocrel = $modulelowercase.'/doc/'.$FILENAMEDOC; $outputfiledocpdf = dol_buildpath($modulelowercase, 0).'/doc/'.$FILENAMEDOCPDF; $outputfiledocurlpdf = dol_buildpath($modulelowercase, 1).'/doc/'.$FILENAMEDOCPDF; + $outputfiledocrelpdf = $modulelowercase.'/doc/'.$FILENAMEDOCPDF; // HTML print ' '.$langs->trans("PathToModuleDocumentation", "HTML").' : '; @@ -3872,6 +3874,7 @@ if ($module == 'initmodule') { print ''; print ''; print ' ('.$langs->trans("GeneratedOn").' '.dol_print_date(dol_filemtime($outputfiledoc), 'dayhour').')'; + print ' '.img_picto($langs->trans("Delete"), 'delete').''; } print '
'; @@ -3886,6 +3889,7 @@ if ($module == 'initmodule') { print ''; print ''; print ' ('.$langs->trans("GeneratedOn").' '.dol_print_date(dol_filemtime($outputfiledocpdf), 'dayhour').')'; + print ' '.img_picto($langs->trans("Delete"), 'delete').''; } print '
'; @@ -3952,8 +3956,11 @@ if ($module == 'initmodule') { $relativepath = $modulelowercase.'/bin/'.$FILENAMEZIP; print ''.$outputfilezip.''; print ' ('.$langs->trans("GeneratedOn").' '.dol_print_date(dol_filemtime($outputfilezip), 'dayhour').')'; + print ' '.img_picto($langs->trans("Delete"), 'delete').''; } - print '
'; + print ''; + + print '
'; print '
'; From dc9d8336f54cecb1aa2679ce4061f4a4b15f7853 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Mar 2022 17:07:23 +0100 Subject: [PATCH 124/610] Fix typo --- htdocs/modulebuilder/template/myobject_list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index f4d1b7b779f..589f4052724 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -197,7 +197,7 @@ if ($user->socid > 0) accessforbidden(); //$socid = 0; if ($user->socid > 0) $socid = $user->socid; //$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); //restrictedArea($user, $object->element, 0, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); -if (empty($conf->mymodule->enabled)) accessforbidden('Moule not enabled'); +if (empty($conf->mymodule->enabled)) accessforbidden('Module not enabled'); if (!$permissiontoread) accessforbidden(); From bb82e6328d6978293501e3eb617d06c3c3575703 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Sat, 12 Mar 2022 12:08:53 +0100 Subject: [PATCH 125/610] Update init_menu_auguria.sql --- htdocs/core/menus/init_menu_auguria.sql | 67 ++++++++++++++++++++++--- 1 file changed, 61 insertions(+), 6 deletions(-) diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index 3b173cecb26..5a3bc2fa2c4 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -8,7 +8,9 @@ delete from llx_menu where menu_handler=__HANDLER__ and entity=__ENTITY__; -- -- table llx_menu -- -insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '1', 1__+MAX_llx_menu__, __HANDLER__, 'top', 'home', '', 0, '/index.php?mainmenu=home&leftmenu=', 'Home', -1, '', '', '', 2, 10, __ENTITY__); + +-- Top-Menu +insert into llx_menu (rowid, enabled, module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '1', 1__+MAX_llx_menu__, __HANDLER__, 'top', 'home', '', 0, '/index.php?mainmenu=home&leftmenu=', 'Home', -1, '', '', '', 2, 10, __ENTITY__); insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('societe|fournisseur|supplier_order|supplier_invoice', '($conf->societe->enabled && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) || !empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || $conf->supplier_order->enabled || $conf->supplier_invoice->enabled))', 2__+MAX_llx_menu__, __HANDLER__, 'top', 'companies', '', 0, '/societe/index.php?mainmenu=companies&leftmenu=', 'ThirdParties', -1, 'companies', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 20, __ENTITY__); insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('product|service', '$conf->product->enabled || $conf->service->enabled', 3__+MAX_llx_menu__, __HANDLER__, 'top', 'products', '', 0, '/product/index.php?mainmenu=products&leftmenu=', 'ProductsPipeServices', -1, 'products', '$user->rights->produit->lire||$user->rights->service->lire', '', 0, 30, __ENTITY__); insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('bom|mrp', '$conf->bom->enabled || $conf->mrp->enabled', 16__+MAX_llx_menu__, __HANDLER__, 'top', 'mrp', '', 0, '/mrp/index.php?mainmenu=mrp&leftmenu=', 'MRP', -1, 'mrp', '$user->rights->bom->read||$user->rights->mrp->read', '', 0, 31, __ENTITY__); @@ -21,15 +23,18 @@ insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, left insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('adherent', '$conf->adherent->enabled', 13__+MAX_llx_menu__, __HANDLER__, 'top', 'members', '', 0, '/adherents/index.php?mainmenu=members&leftmenu=', 'Members', -1, 'members', '$user->rights->adherent->lire', '', 2, 19, __ENTITY__); insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('hrm|holiday|deplacement|expensereport', '$conf->hrm->enabled || $conf->holiday->enabled || $conf->deplacement->enabled || $conf->expensereport->enabled', 15__+MAX_llx_menu__, __HANDLER__, 'top', 'hrm', '', 0, '/hrm/index.php?mainmenu=hrm&leftmenu=', 'HRM', -1, 'holiday', '$user->rights->user->user->lire || $user->rights->holiday->read || $user->rights->deplacement->lire || $user->rights->expensereport->lire', '', 0, 80, __ENTITY__); + +-- Sub-Menu + -- Home - Dashboard 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', 90__+MAX_llx_menu__, 'home', '', 1__+MAX_llx_menu__, '/index.php', 'MyDashboard', 0, '', '', '', 2, 0, __ENTITY__); -- Home - Setup -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', 100__+MAX_llx_menu__, 'home', 'setup', 1__+MAX_llx_menu__, '/admin/index.php?mainmenu=home&leftmenu=setup', 'Setup', 0, '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', 101__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/company.php?mainmenu=home&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?mainmenu=home&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', 114__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/translation.php?mainmenu=home&leftmenu=setup', 'Translation', 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', 115__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/defaultvalues.php?mainmenu=home&leftmenu=setup', 'DefaultValues', 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 ('', '$user->admin' , __HANDLER__, 'left', 100__+MAX_llx_menu__, 'home', 'setup', 1__+MAX_llx_menu__, '/admin/index.php?mainmenu=home&leftmenu=setup', 'Setup', 0, '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', 101__+MAX_llx_menu__, 'home', '' , 100__+MAX_llx_menu__, '/admin/company.php?mainmenu=home&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?mainmenu=home&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', 114__+MAX_llx_menu__, 'home', '' , 100__+MAX_llx_menu__, '/admin/translation.php?mainmenu=home&leftmenu=setup', 'Translation', 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', 115__+MAX_llx_menu__, 'home', '' , 100__+MAX_llx_menu__, '/admin/defaultvalues.php?mainmenu=home&leftmenu=setup', 'DefaultValues', 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?mainmenu=home&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?mainmenu=home&leftmenu=setup', 'Boxes', 1, 'admin', '', '', 2, 6, __ENTITY__); @@ -42,6 +47,7 @@ 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', 113__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/sms.php?mainmenu=home&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?mainmenu=home&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?mainmenu=home&leftmenu=setup', 'OtherSetup', 1, 'admin', '', '', 2, 14, __ENTITY__); + -- Home - Admin tools 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?mainmenu=home&leftmenu=admintools', 'AdminTools', 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?mainmenu=home&leftmenu=admintools', 'InfoDolibarr', 1, 'admin', '', '', 2, 0, __ENTITY__); @@ -62,6 +68,7 @@ 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=="admintools"', __HANDLER__, 'left', 311__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/system/about.php?mainmenu=home&leftmenu=admintools', 'ExternalResources', 1, 'admin', '', '', 2, 14, __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', 320__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/product/admin/product_tools.php?mainmenu=home&leftmenu=admintools', 'ProductVatMassChange', 1, 'products', '', '', 2, 15, __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?mainmenu=home&leftmenu=users', 'MenuUsersAndGroups', 0, 'users', '', '', 2, 4, __ENTITY__); @@ -84,6 +91,7 @@ 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 ('', '$conf->societe->enabled', __HANDLER__, 'left', 507__+MAX_llx_menu__, 'companies', '', 506__+MAX_llx_menu__, '/societe/card.php?mainmenu=companies&leftmenu=prospects&action=create&type=p', 'MenuNewProspect', 2, 'companies', '$user->rights->societe->creer', '', 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 ('', '$conf->societe->enabled', __HANDLER__, 'left', 509__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/list.php?mainmenu=companies&type=c&leftmenu=customers', 'ListCustomersShort', 1, 'companies', '$user->rights->societe->lire', '', 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 ('', '$conf->societe->enabled', __HANDLER__, 'left', 510__+MAX_llx_menu__, 'companies', '', 509__+MAX_llx_menu__, '/societe/card.php?mainmenu=companies&leftmenu=customers&action=create&type=c', 'MenuNewCustomer', 2, 'companies', '$user->rights->societe->creer', '', 2, 0, __ENTITY__); + -- Third parties - Contacts insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 600__+MAX_llx_menu__, 'companies', 'contacts', 2__+MAX_llx_menu__, '/contact/list.php?mainmenu=companies&leftmenu=contacts', 'ContactsAddresses', 0, 'companies', '$user->rights->societe->lire', '', 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 ('', '$conf->societe->enabled', __HANDLER__, 'left', 601__+MAX_llx_menu__, 'companies', '', 600__+MAX_llx_menu__, '/contact/card.php?mainmenu=companies&leftmenu=contacts&action=create', 'NewContactAddress', 1, 'companies', '$user->rights->societe->creer', '', 2, 0, __ENTITY__); @@ -92,15 +100,19 @@ 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 ('', '$conf->societe->enabled', __HANDLER__, 'left', 605__+MAX_llx_menu__, 'companies', '', 602__+MAX_llx_menu__, '/contact/list.php?mainmenu=companies&leftmenu=contacts&type=c', 'ThirdPartyCustomers', 2, 'companies', '$user->rights->societe->contact->lire', '', 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 ('', '$conf->societe->enabled && (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled))', __HANDLER__, 'left', 606__+MAX_llx_menu__, 'companies', '', 602__+MAX_llx_menu__, '/contact/list.php?mainmenu=companies&leftmenu=contacts&type=f', 'ThirdPartySuppliers', 2, 'companies', '$user->rights->societe->contact->lire', '', 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 ('', '$conf->societe->enabled', __HANDLER__, 'left', 607__+MAX_llx_menu__, 'companies', '', 602__+MAX_llx_menu__, '/contact/list.php?mainmenu=companies&leftmenu=contacts&type=o', 'Others', 2, 'companies', '$user->rights->societe->contact->lire', '', 2, 4, __ENTITY__); + -- Third parties - Category customer insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled && $conf->categorie->enabled', __HANDLER__, 'left', 650__+MAX_llx_menu__, 'companies', 'cat', 2__+MAX_llx_menu__, '/categories/index.php?mainmenu=companies&leftmenu=cat&type=1', 'SuppliersCategoriesShort', 0, 'categories', '$user->rights->categorie->lire', '', 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 ('', '$conf->societe->enabled && $conf->categorie->enabled', __HANDLER__, 'left', 651__+MAX_llx_menu__, 'companies', '', 650__+MAX_llx_menu__, '/categories/card.php?mainmenu=companies&action=create&type=1', 'NewCategory', 1, 'categories', '$user->rights->categorie->creer', '', 2, 0, __ENTITY__); + -- Third parties - Category supplier insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '(!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && $conf->categorie->enabled', __HANDLER__, 'left', 660__+MAX_llx_menu__, 'companies', 'cat', 2__+MAX_llx_menu__, '/categories/index.php?mainmenu=companies&leftmenu=cat&type=2', 'CustomersProspectsCategoriesShort', 0, 'categories', '$user->rights->categorie->lire', '', 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 ('', '(!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && $conf->categorie->enabled', __HANDLER__, 'left', 661__+MAX_llx_menu__, 'companies', '', 660__+MAX_llx_menu__, '/categories/card.php?mainmenu=companies&action=create&type=2', 'NewCategory', 1, 'categories', '$user->rights->categorie->creer', '', 2, 0, __ENTITY__); + -- Third parties - Category contact insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled && $conf->categorie->enabled', __HANDLER__, 'left', 670__+MAX_llx_menu__, 'companies', 'cat', 2__+MAX_llx_menu__, '/categories/index.php?mainmenu=companies&leftmenu=cat&type=4', 'ContactCategoriesShort', 0, 'categories', '$user->rights->categorie->lire', '', 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 ('', '$conf->societe->enabled && $conf->categorie->enabled', __HANDLER__, 'left', 671__+MAX_llx_menu__, 'companies', '', 670__+MAX_llx_menu__, '/categories/card.php?mainmenu=companies&action=create&type=4', 'NewCategory', 1, 'categories', '$user->rights->categorie->creer', '', 2, 0, __ENTITY__); + -- Product - Product insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->product->enabled', __HANDLER__, 'left', 2800__+MAX_llx_menu__, 'products', 'product', 3__+MAX_llx_menu__, '/product/index.php?mainmenu=products&leftmenu=product&type=0', 'Products', 0, 'products', '$user->rights->produit->lire', '', 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 ('', '$conf->product->enabled', __HANDLER__, 'left', 2801__+MAX_llx_menu__, 'products', '', 2800__+MAX_llx_menu__, '/product/card.php?mainmenu=products&leftmenu=product&action=create&type=0', 'NewProduct', 1, 'products', '$user->rights->produit->creer', '', 2, 0, __ENTITY__); @@ -112,11 +124,13 @@ 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 ('', '$conf->variants->enabled', __HANDLER__, 'left', 2807__+MAX_llx_menu__, 'products', '', 2800__+MAX_llx_menu__, '/variants/list.php?mainmenu=products', 'VariantAttributes', 1, 'products', '$user->rights->produit->lire', '', 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 ('', '$conf->propal->enabled', __HANDLER__, 'left', 2804__+MAX_llx_menu__, 'products', '', 2800__+MAX_llx_menu__, '/product/stats/card.php?mainmenu=products&id=all&leftmenu=stats&type=0', 'Statistics', 1, 'main', '$user->rights->produit->lire', '', 2, 8, __ENTITY__); + -- Product - Services insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->service->enabled', __HANDLER__, 'left', 2900__+MAX_llx_menu__, 'products', 'service', 3__+MAX_llx_menu__, '/product/index.php?mainmenu=products&leftmenu=service&type=1', 'Services', 0, 'products', '$user->rights->service->lire', '', 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 ('', '$conf->service->enabled', __HANDLER__, 'left', 2901__+MAX_llx_menu__, 'products', '', 2900__+MAX_llx_menu__, '/product/card.php?mainmenu=products&leftmenu=service&action=create&type=1', 'NewService', 1, 'products', '$user->rights->service->creer', '', 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 ('', '$conf->service->enabled', __HANDLER__, 'left', 2902__+MAX_llx_menu__, 'products', '', 2900__+MAX_llx_menu__, '/product/list.php?mainmenu=products&leftmenu=service&type=1', 'List', 1, 'products', '$user->rights->service->lire', '', 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 ('', '$conf->propal->enabled', __HANDLER__, 'left', 2903__+MAX_llx_menu__, 'products', '', 2900__+MAX_llx_menu__, '/product/stats/card.php?mainmenu=products&id=all&leftmenu=stats&type=1', 'Statistics', 1, 'main', '$user->rights->service->lire', '', 2, 5, __ENTITY__); + -- Product - Stocks insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled', __HANDLER__, 'left', 3100__+MAX_llx_menu__, 'products', 'stock', 3__+MAX_llx_menu__, '/product/stock/index.php?mainmenu=products&leftmenu=stock', 'Stock', 0, 'stocks', '$user->rights->stock->lire', '', 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 ('', '$conf->stock->enabled', __HANDLER__, 'left', 3101__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/card.php?mainmenu=products&action=create', 'MenuNewWarehouse', 1, 'stocks', '$user->rights->stock->creer', '', 2, 0, __ENTITY__); @@ -128,11 +142,13 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left -- Product - Categories insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->categorie->enabled', __HANDLER__, 'left', 3200__+MAX_llx_menu__, 'products', 'cat', 3__+MAX_llx_menu__, '/categories/index.php?mainmenu=products&leftmenu=cat&type=0', 'Categories', 0, 'categories', '$user->rights->categorie->lire', '', 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 ('', '$conf->categorie->enabled', __HANDLER__, 'left', 3201__+MAX_llx_menu__, 'products', '', 3200__+MAX_llx_menu__, '/categories/card.php?mainmenu=products&action=create&type=0', 'NewCategory', 1, 'categories', '$user->rights->categorie->creer', '', 2, 0, __ENTITY__); + -- Product - Shipment insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->expedition->enabled', __HANDLER__, 'left', 1300__+MAX_llx_menu__, 'commercial', 'sendings', 3__+MAX_llx_menu__, '/expedition/index.php?mainmenu=commercial&leftmenu=sendings', 'Shipments', 0, 'sendings', '$user->rights->expedition->lire', '', 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 ('', '$conf->expedition->enabled && $leftmenu=="sendings"', __HANDLER__, 'left', 1301__+MAX_llx_menu__, 'commercial', '', 1300__+MAX_llx_menu__, '/expedition/card.php?mainmenu=commercial&action=create2&leftmenu=sendings', 'NewSending', 1, 'sendings', '$user->rights->expedition->creer', '', 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 ('', '$conf->expedition->enabled && $leftmenu=="sendings"', __HANDLER__, 'left', 1302__+MAX_llx_menu__, 'commercial', '', 1300__+MAX_llx_menu__, '/expedition/list.php?mainmenu=commercial&leftmenu=sendings', 'List', 1, 'sendings', '$user->rights->expedition->lire', '', 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 ('', '$conf->expedition->enabled && $leftmenu=="sendings"', __HANDLER__, 'left', 1303__+MAX_llx_menu__, 'commercial', '', 1300__+MAX_llx_menu__, '/expedition/stats/index.php?mainmenu=commercial&leftmenu=sendings', 'Statistics', 1, 'sendings', '$user->rights->expedition->lire', '', 2, 2, __ENTITY__); + -- Product - Reception insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->reception->enabled', __HANDLER__, 'left', 1350__+MAX_llx_menu__, 'commercial', 'receptions', 3__+MAX_llx_menu__, '/reception/index.php?mainmenu=commercial&leftmenu=receptions', 'Receptions', 0, 'receptions', '$user->rights->reception->lire', '', 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 ('', '$conf->reception->enabled && $leftmenu=="receptions"', __HANDLER__, 'left', 1351__+MAX_llx_menu__, 'commercial', '', 1350__+MAX_llx_menu__, '/reception/card.php?mainmenu=commercial&action=create2&leftmenu=receptions', 'NewSending', 1, 'receptions', '$user->rights->reception->creer', '', 2, 0, __ENTITY__); @@ -149,6 +165,7 @@ 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 ('', '$conf->propal->enabled && $leftmenu=="propals"', __HANDLER__, 'left', 1106__+MAX_llx_menu__, 'commercial', '', 1102__+MAX_llx_menu__, '/comm/propal/list.php?mainmenu=commercial&leftmenu=propals&search_status=3', 'PropalStatusNotSigned', 1, 'propal', '$user->rights->propale->lire', '', 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 ('', '$conf->propal->enabled && $leftmenu=="propals"', __HANDLER__, 'left', 1107__+MAX_llx_menu__, 'commercial', '', 1102__+MAX_llx_menu__, '/comm/propal/list.php?mainmenu=commercial&leftmenu=propals&search_status=4', 'PropalStatusBilled', 1, 'propal', '$user->rights->propale->lire', '', 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 ('', '$conf->propal->enabled', __HANDLER__, 'left', 1110__+MAX_llx_menu__, 'commercial', '', 1100__+MAX_llx_menu__, '/comm/propal/stats/index.php?mainmenu=commercial&leftmenu=propals', 'Statistics', 1, 'propal', '$user->rights->propale->lire', '', 2, 4, __ENTITY__); + -- Commercial - Customer's orders insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->commande->enabled', __HANDLER__, 'left', 1200__+MAX_llx_menu__, 'commercial', 'orders', 5__+MAX_llx_menu__, '/commande/index.php?mainmenu=commercial&leftmenu=orders', 'CustomersOrders', 0, 'orders', '$user->rights->commande->lire', '', 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 ('', '$conf->commande->enabled', __HANDLER__, 'left', 1201__+MAX_llx_menu__, 'commercial', '', 1200__+MAX_llx_menu__, '/commande/card.php?mainmenu=commercial&action=create&leftmenu=orders', 'NewOrder', 1, 'orders', '$user->rights->commande->creer', '', 2, 0, __ENTITY__); @@ -160,11 +177,13 @@ 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 ('', '$conf->commande->enabled && $leftmenu=="orders"', __HANDLER__, 'left', 1207__+MAX_llx_menu__, 'commercial', '', 1202__+MAX_llx_menu__, '/commande/list.php?mainmenu=commercial&leftmenu=orders&search_status=4', 'StatusOrderProcessed', 1, 'orders', '$user->rights->commande->lire', '', 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 ('', '$conf->commande->enabled && $leftmenu=="orders"', __HANDLER__, 'left', 1208__+MAX_llx_menu__, 'commercial', '', 1202__+MAX_llx_menu__, '/commande/list.php?mainmenu=commercial&leftmenu=orders&search_status=-1', 'StatusOrderCanceledShort', 1, 'orders', '$user->rights->commande->lire', '', 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 ('', '$conf->commande->enabled', __HANDLER__, 'left', 1209__+MAX_llx_menu__, 'commercial', '', 1200__+MAX_llx_menu__, '/commande/stats/index.php?mainmenu=commercial&leftmenu=orders', 'Statistics', 1, 'orders', '$user->rights->commande->lire', '', 2, 4, __ENTITY__); + -- Commercial - Supplier's proposals insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_proposal->enabled', __HANDLER__, 'left', 1650__+MAX_llx_menu__, 'commercial', 'propals_supplier', 3__+MAX_llx_menu__, '/supplier_proposal/index.php?leftmenu=propals_supplier', 'SupplierProposalsShort', 0, 'supplier_proposal', '$user->rights->supplier_proposal->lire', '', 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 ('', '$conf->supplier_proposal->enabled', __HANDLER__, 'left', 1651__+MAX_llx_menu__, 'commercial', '', 1650__+MAX_llx_menu__, '/supplier_proposal/card.php?action=create&leftmenu=supplier_proposals', 'SupplierProposalNew', 1, 'supplier_proposal', '$user->rights->supplier_proposal->creer', '', 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 ('', '$conf->supplier_proposal->enabled', __HANDLER__, 'left', 1652__+MAX_llx_menu__, 'commercial', '', 1650__+MAX_llx_menu__, '/supplier_proposal/list.php?leftmenu=supplier_proposals', 'List', 1, 'supplier_proposal', '$user->rights->supplier_proposal->lire', '', 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 ('', '$conf->supplier_proposal->enabled', __HANDLER__, 'left', 1653__+MAX_llx_menu__, 'commercial', '', 1650__+MAX_llx_menu__, '/comm/propal/stats/index.php?leftmenu=supplier_proposals&mode=supplier', 'Statistics', 1, 'supplier_proposal', '$user->rights->supplier_proposal->lire', '', 2, 2, __ENTITY__); + -- Commercial - Supplier's orders insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_order->enabled', __HANDLER__, 'left', 5100__+MAX_llx_menu__, 'commercial', 'orders_suppliers', 5__+MAX_llx_menu__, '/fourn/commande/index.php?mainmenu=commercial&leftmenu=orders_suppliers', 'SuppliersOrders', 0, 'orders', '($user->rights->fournisseur->commande->lire || $user->rights->supplier_order->lire)', '', 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 ('', '$conf->supplier_order->enabled', __HANDLER__, 'left', 5101__+MAX_llx_menu__, 'commercial', '', 5100__+MAX_llx_menu__, '/fourn/commande/card.php?mainmenu=commercial&action=create&leftmenu=orders_suppliers', 'NewSupplierOrderShort', 1, 'orders', '($user->rights->fournisseur->commande->creer || $user->rights->supplier_order->creer)', '', 2, 0, __ENTITY__); @@ -178,6 +197,7 @@ 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 ('', '$conf->supplier_order->enabled && $leftmenu=="orders_suppliers"', __HANDLER__, 'left', 5109__+MAX_llx_menu__, 'commercial', '', 5102__+MAX_llx_menu__, '/fourn/commande/list.php?mainmenu=commercial&leftmenu=orders_suppliers&statut=6,7', 'StatusOrderCanceled', 1, 'orders', '($user->rights->fournisseur->commande->lire || $user->rights->supplier_order->lire)', '', 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 ('', '$conf->supplier_order->enabled && $leftmenu=="orders_suppliers"', __HANDLER__, 'left', 5110__+MAX_llx_menu__, 'commercial', '', 5102__+MAX_llx_menu__, '/fourn/commande/list.php?mainmenu=commercial&leftmenu=orders_suppliers&statut=9', 'StatusOrderRefused', 1, 'orders', '($user->rights->fournisseur->commande->lire || $user->rights->supplier_order->lire)', '', 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 ('', '$conf->supplier_order->enabled', __HANDLER__, 'left', 5111__+MAX_llx_menu__, 'commercial', '', 5100__+MAX_llx_menu__, '/commande/stats/index.php?mainmenu=commercial&leftmenu=orders_suppliers&mode=supplier', 'Statistics', 1, 'orders', '($user->rights->fournisseur->commande->lire || $user->rights->supplier_order->lire)', '', 2, 7, __ENTITY__); + -- Commercial - Contracts insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->contrat->enabled', __HANDLER__, 'left', 1400__+MAX_llx_menu__, 'commercial', 'contracts', 5__+MAX_llx_menu__, '/contrat/index.php?mainmenu=commercial&leftmenu=contracts', 'Contracts', 0, 'contracts', '$user->rights->contrat->lire', '', 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 ('', '$conf->contrat->enabled', __HANDLER__, 'left', 1401__+MAX_llx_menu__, 'commercial', '', 1400__+MAX_llx_menu__, '/contrat/card.php?mainmenu=commercial&action=create&leftmenu=contracts', 'NewContract', 1, 'contracts', '$user->rights->contrat->creer', '', 2, 0, __ENTITY__); @@ -187,11 +207,13 @@ 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 ('', '$conf->contrat->enabled && $leftmenu=="contracts"', __HANDLER__, 'left', 1405__+MAX_llx_menu__, 'commercial', '', 1403__+MAX_llx_menu__, '/contrat/services_list.php?mainmenu=commercial&leftmenu=contracts&mode=4', 'MenuRunningServices', 2, 'contracts', '$user->rights->contrat->lire', '', 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 ('', '$conf->contrat->enabled && $leftmenu=="contracts"', __HANDLER__, 'left', 1406__+MAX_llx_menu__, 'commercial', '', 1403__+MAX_llx_menu__, '/contrat/services_list.php?mainmenu=commercial&leftmenu=contracts&mode=4&filter=expired', 'MenuExpiredServices', 2, 'contracts', '$user->rights->contrat->lire', '', 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 ('', '$conf->contrat->enabled && $leftmenu=="contracts"', __HANDLER__, 'left', 1407__+MAX_llx_menu__, 'commercial', '', 1403__+MAX_llx_menu__, '/contrat/services_list.php?mainmenu=commercial&leftmenu=contracts&mode=5', 'MenuClosedServices', 2, 'contracts', '$user->rights->contrat->lire', '', 2, 3, __ENTITY__); + -- Commercial - Interventions insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->ficheinter->enabled', __HANDLER__, 'left', 1500__+MAX_llx_menu__, 'commercial', 'ficheinter', 5__+MAX_llx_menu__, '/fichinter/list.php?mainmenu=commercial&leftmenu=ficheinter', 'Interventions', 0, 'interventions', '$user->rights->ficheinter->lire', '', 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 ('', '$conf->ficheinter->enabled', __HANDLER__, 'left', 1501__+MAX_llx_menu__, 'commercial', '', 1500__+MAX_llx_menu__, '/fichinter/card.php?mainmenu=commercial&action=create&leftmenu=ficheinter', 'NewIntervention', 1, 'interventions', '$user->rights->ficheinter->creer', '', 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 ('', '$conf->ficheinter->enabled', __HANDLER__, 'left', 1502__+MAX_llx_menu__, 'commercial', '', 1500__+MAX_llx_menu__, '/fichinter/list.php?mainmenu=commercial&leftmenu=ficheinter', 'List', 1, 'interventions', '$user->rights->ficheinter->lire', '', 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 ('', '$conf->ficheinter->enabled', __HANDLER__, 'left', 1503__+MAX_llx_menu__, 'commercial', '', 1500__+MAX_llx_menu__, '/fichinter/stats/index.php?mainmenu=commercial&leftmenu=ficheinter', 'Statistics', 1, 'interventions', '$user->rights->ficheinter->lire', '', 2, 2, __ENTITY__); + -- Billing - Supplier invoice insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_invoice->enabled', __HANDLER__, 'left', 1600__+MAX_llx_menu__, 'billing', 'supplier_bills', 6__+MAX_llx_menu__, '/fourn/facture/list.php?mainmenu=billing&leftmenu=suppliers_bills', 'BillsSuppliers', 0, 'bills', '$user->rights->fournisseur->facture->lire', '', 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 ('', '$conf->supplier_invoice->enabled', __HANDLER__, 'left', 1601__+MAX_llx_menu__, 'billing', '', 1600__+MAX_llx_menu__, '/fourn/facture/card.php?mainmenu=billing&action=create&leftmenu=suppliers_bills', 'NewBill', 1, 'bills', '$user->rights->fournisseur->facture->creer', '', 2, 0, __ENTITY__); @@ -200,6 +222,7 @@ 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 ('', '$conf->supplier_invoice->enabled', __HANDLER__, 'left', 1603__+MAX_llx_menu__, 'billing', 'suppliers_bills_payment', 1600__+MAX_llx_menu__, '/fourn/facture/paiement.php?mainmenu=billing&leftmenu=suppliers_bills_payment', 'Payments', 1, 'bills', '$user->rights->fournisseur->facture->lire', '', 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 ('', '$conf->supplier_invoice->enabled', __HANDLER__, 'left', 1605__+MAX_llx_menu__, 'billing', 'suppliers_bills_reports', 1603__+MAX_llx_menu__, '/fourn/facture/rapport.php?mainmenu=billing&leftmenu=suppliers_bills_reports', 'Reporting', 2, 'bills', '$user->rights->fournisseur->facture->lire', '', 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 ('', '$conf->supplier_invoice->enabled', __HANDLER__, 'left', 1604__+MAX_llx_menu__, 'billing', 'customers_bills_stats', 1600__+MAX_llx_menu__, '/compta/facture/stats/index.php?mainmenu=billing&leftmenu=customers_bills_stats&mode=supplier', 'Statistics', 1, 'bills', '$user->rights->fournisseur->facture->lire', '', 2, 8, __ENTITY__); + -- Billing - Customer invoice insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1700__+MAX_llx_menu__, 'billing', 'customer_bills', 6__+MAX_llx_menu__, '/compta/facture/list.php?mainmenu=billing&leftmenu=customers_bills', 'BillsCustomers', 0, 'bills', '$user->rights->facture->lire', '', 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 ('', '$conf->facture->enabled', __HANDLER__, 'left', 1701__+MAX_llx_menu__, 'billing', '', 1700__+MAX_llx_menu__, '/compta/facture/card.php?mainmenu=billing&action=create&leftmenu=customers_bills', 'NewBill', 1, 'bills', '$user->rights->facture->creer', '', 2, 3, __ENTITY__); @@ -215,19 +238,24 @@ 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 ('', '$conf->facture->enabled', __HANDLER__, 'left', 1704__+MAX_llx_menu__, 'billing', 'customers_bills_payment', 1700__+MAX_llx_menu__, '/compta/paiement/list.php?mainmenu=billing&leftmenu=customers_bills_payment', 'Payments', 1, 'bills', '$user->rights->facture->lire', '', 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 ('', '$conf->facture->enabled', __HANDLER__, 'left', 1710__+MAX_llx_menu__, 'billing', 'customers_bills_reports', 1704__+MAX_llx_menu__, '/compta/paiement/rapport.php?mainmenu=billing&leftmenu=customers_bills_reports', 'Reportings', 2, 'bills', '$user->rights->facture->lire', '', 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 ('', '$conf->facture->enabled', __HANDLER__, 'left', 1714__+MAX_llx_menu__, 'billing', 'customers_bills_stats', 1700__+MAX_llx_menu__, '/compta/facture/stats/index.php?mainmenu=billing&leftmenu=customers_bills_stats', 'Statistics', 1, 'bills', '$user->rights->facture->lire', '', 2, 8, __ENTITY__); + -- Billing - Orders to bill insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->commande->enabled', __HANDLER__, 'left', 1900__+MAX_llx_menu__, 'billing', 'orders', 6__+MAX_llx_menu__, '/commande/list.php?mainmenu=billing&leftmenu=orders&search_status=3', 'MenuOrdersToBill', 0, 'orders', '$user->rights->commande->lire', '', 0, 3, __ENTITY__); + -- Donations insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->don->enabled', __HANDLER__, 'left', 2000__+MAX_llx_menu__, 'billing', 'donations', 6__+MAX_llx_menu__, '/don/index.php?mainmenu=billing&leftmenu=donations', 'Donations', 0, 'donations', '$user->rights->don->lire', '', 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 ('', '$conf->don->enabled && $leftmenu=="donations"', __HANDLER__, 'left', 2001__+MAX_llx_menu__, 'billing', '', 2000__+MAX_llx_menu__, '/don/card.php?mainmenu=billing&leftmenu=donations&action=create', 'NewDonation', 1, 'donations', '$user->rights->don->creer', '', 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 ('', '$conf->don->enabled && $leftmenu=="donations"', __HANDLER__, 'left', 2002__+MAX_llx_menu__, 'billing', '', 2000__+MAX_llx_menu__, '/don/list.php?mainmenu=billing&leftmenu=donations', 'List', 1, 'donations', '$user->rights->don->lire', '', 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 ('', '$conf->don->enabled && $leftmenu=="donations"', __HANDLER__, 'left', 2003__+MAX_llx_menu__, 'billing', '', 2000__+MAX_llx_menu__, '/don/stats/index.php?mainmenu=billing&leftmenu=donations', 'Statistics', 1, 'donations', '$user->rights->don->lire', '', 2, 2, __ENTITY__); + -- Special expenses insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled || $conf->salaries->enabled || $conf->loan->enabled || $conf->banque->enabled', __HANDLER__, 'left', 2200__+MAX_llx_menu__, 'billing', 'tax', 6__+MAX_llx_menu__, '/compta/charges/index.php?mainmenu=billing&leftmenu=tax', 'MenuTaxesAndSpecialExpenses', 0, 'compta', '(! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) || (! empty($conf->salaries->enabled) && ! empty($user->rights->salaries->read)) || (! empty($conf->loan->enabled) && $user->rights->loan->read) || (! empty($conf->banque->enabled) && $user->rights->banque->lire)', '', 0, 6, __ENTITY__); + -- Social contributions insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled', __HANDLER__, 'left', 2250__+MAX_llx_menu__, 'billing', 'tax_social', 2200__+MAX_llx_menu__, '/compta/sociales/list.php?mainmenu=billing&leftmenu=tax_social', 'SocialContributions', 1, '', '$user->rights->tax->charges->lire', '', 0, 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 ('', '$conf->tax->enabled && $leftmenu=="tax_social"', __HANDLER__, 'left', 2251__+MAX_llx_menu__, 'billing', '', 2250__+MAX_llx_menu__, '/compta/sociales/card.php?mainmenu=billing&leftmenu=tax_social&action=create', 'MenuNewSocialContribution', 2, '', '$user->rights->tax->charges->creer', '', 0, 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 ('', '$conf->tax->enabled && $leftmenu=="tax_social"', __HANDLER__, 'left', 2252__+MAX_llx_menu__, 'billing', '', 2250__+MAX_llx_menu__, '/compta/sociales/payments.php?mainmenu=billing&leftmenu=tax_social', 'Payments', 2, '', '$user->rights->tax->charges->lire', '', 0, 3, __ENTITY__); + -- VAT insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS)', __HANDLER__, 'left', 2300__+MAX_llx_menu__, 'billing', 'tax_vat', 2200__+MAX_llx_menu__, '/compta/tva/list.php?mainmenu=billing&leftmenu=tax_vat', 'VAT', 1, 'companies', '$user->rights->tax->charges->lire', '', 0, 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 ('', '$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS) && $leftmenu=="tax_vat"', __HANDLER__, 'left', 2301__+MAX_llx_menu__, 'billing', '', 2300__+MAX_llx_menu__, '/compta/tva/card.php?mainmenu=billing&leftmenu=tax_vat&action=create', 'New', 2, 'companies', '$user->rights->tax->charges->creer', '', 0, 0, __ENTITY__); @@ -235,22 +263,27 @@ 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 ('', '$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS) && $leftmenu=="tax_vat"', __HANDLER__, 'left', 2303__+MAX_llx_menu__, 'billing', '', 2300__+MAX_llx_menu__, '/compta/tva/index.php?mainmenu=billing&leftmenu=tax_vat', 'ReportByMonth', 2, 'companies', '$user->rights->tax->charges->lire', '', 0, 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 ('', '$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS) && $leftmenu=="tax_vat"', __HANDLER__, 'left', 2304__+MAX_llx_menu__, 'billing', '', 2300__+MAX_llx_menu__, '/compta/tva/clients.php?mainmenu=billing&leftmenu=tax_vat', 'ReportByThirdparties', 2, 'companies', '$user->rights->tax->charges->lire', '', 0, 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 ('', '$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS) && $leftmenu=="tax_vat"', __HANDLER__, 'left', 2305__+MAX_llx_menu__, 'billing', '', 2300__+MAX_llx_menu__, '/compta/tva/quadri_detail.php?mainmenu=billing&leftmenu=tax_vat', 'ReportByQuarter', 2, 'companies', '$user->rights->tax->charges->lire', '', 0, 4, __ENTITY__); + -- Salary insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->salaries->enabled', __HANDLER__, 'left', 2210__+MAX_llx_menu__, 'billing', 'tax_sal', 6__+MAX_llx_menu__, '/salaries/list.php?mainmenu=billing&leftmenu=tax_salary', 'Salaries', 0, 'salaries', '$user->rights->salaries->read', '', 0, 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 ('', '$conf->salaries->enabled && $leftmenu=="tax_salary"', __HANDLER__, 'left', 2211__+MAX_llx_menu__, 'billing', '', 2210__+MAX_llx_menu__, '/salaries/card.php?mainmenu=billing&leftmenu=tax_salary&action=create', 'NewPayment', 1, 'companies', '$user->rights->salaries->write', '', 0, 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 ('', '$conf->salaries->enabled && $leftmenu=="tax_salary"', __HANDLER__, 'left', 2212__+MAX_llx_menu__, 'billing', '', 2210__+MAX_llx_menu__, '/salaries/list.php?mainmenu=billing&leftmenu=tax_salary', 'Payments', 1, 'companies', '$user->rights->salaries->read', '', 0, 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 ('', '$conf->salaries->enabled && $leftmenu=="tax_salary"', __HANDLER__, 'left', 2213__+MAX_llx_menu__, 'billing', '', 2210__+MAX_llx_menu__, '/salaries/stats/index.php?mainmenu=billing&leftmenu=tax_salary', 'Statistics', 1, 'companies', '$user->rights->salaries->read', '', 0, 4, __ENTITY__); + -- Loan insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->loan->enabled', __HANDLER__, 'left', 2220__+MAX_llx_menu__, 'billing', 'tax_loan', 6__+MAX_llx_menu__, '/loan/list.php?mainmenu=billing&leftmenu=tax_loan', 'Loans', 0, 'loan', '$user->rights->loan->read', '', 0, 20, __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 ('', '$conf->loan->enabled && $leftmenu=="tax_loan"', __HANDLER__, 'left', 2221__+MAX_llx_menu__, 'billing', '', 2220__+MAX_llx_menu__, '/loan/card.php?mainmenu=billing&leftmenu=tax_loan&action=create', 'NewLoan', 1, 'loan', '$user->rights->loan->write', '', 0, 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 ('', '$conf->loan->enabled && $leftmenu=="tax_loan"', __HANDLER__, 'left', 2222__+MAX_llx_menu__, 'billing', '', 2220__+MAX_llx_menu__, '/loan/payment/list.php?mainmenu=billing&leftmenu=tax_loan', 'Payments', 1, 'companies', '$user->rights->loan->read', '', 0, 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 ('', '$conf->loan->enabled && $leftmenu=="tax_loan" && ! empty($conf->global->LOAN_SHOW_CALCULATOR)', __HANDLER__, 'left', 2223__+MAX_llx_menu__, 'billing', '', 2220__+MAX_llx_menu__, '/loan/calc.php?mainmenu=billing&leftmenu=tax_loan', 'Calculator', 1, 'companies', '$user->rights->loan->calc', '', 0, 4, __ENTITY__); + -- Various payments insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && empty($conf->global->BANK_USE_OLD_VARIOUS_PAYMENT)', __HANDLER__, 'left', 2350__+MAX_llx_menu__, 'billing', 'tax_various', 6__+MAX_llx_menu__, '/compta/bank/various_payment/list.php?mainmenu=billing&leftmenu=tax_various', 'MenuVariousPayment', 0, 'banks', '$user->rights->banque->lire', '', 0, 30, __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 ('', '$conf->banque->enabled && $leftmenu=="tax_various"', __HANDLER__, 'left', 2351__+MAX_llx_menu__, 'billing', '', 2350__+MAX_llx_menu__, '/compta/bank/various_payment/card.php?mainmenu=billing&leftmenu=tax_various&action=create', 'New', 1, 'various_payment', '$user->rights->banque->modifier', '', 0, 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 ('', '$conf->banque->enabled && $leftmenu=="tax_various"', __HANDLER__, 'left', 2352__+MAX_llx_menu__, 'billing', '', 2350__+MAX_llx_menu__, '/compta/bank/various_payment/list.php?mainmenu=billing&leftmenu=tax_various', 'List', 1, 'various_payment', '$user->rights->banque->lire', '', 0, 3, __ENTITY__); + -- Accounting (Double entries) insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2400__+MAX_llx_menu__, 'accountancy', 'accountancy', 9__+MAX_llx_menu__, '/accountancy/index.php?mainmenu=accountancy&leftmenu=accountancy', 'MenuAccountancy', 0, 'main', '! empty($conf->accounting->enabled) || $user->rights->accounting->bind->write || $user->rights->accounting->bind->write || $user->rights->compta->resultat->lire', '', 0, 7, __ENTITY__); + -- Setup insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2451__+MAX_llx_menu__, 'accountancy', 'accountancy_admin', 2400__+MAX_llx_menu__, '/accountancy/index.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'Setup', 1, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 1, __ENTITY__); @@ -271,8 +304,10 @@ 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 ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2465__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_export', 2451__+MAX_llx_menu__, '/accountancy/admin/export.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'ExportOptions', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 60, __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 ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin" && $conf->global->MAIN_FEATURES_LEVEL > 1', __HANDLER__, 'left', 2466__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_closure', 2451__+MAX_llx_menu__, '/accountancy/admin/closure.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuClosureAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 70, __ENTITY__); + -- Accounting period insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin" && $conf->global->MAIN_FEATURES_LEVEL > 0', __HANDLER__, 'left', 2450__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_period', 2451__+MAX_llx_menu__, '/accountancy/admin/fiscalyear.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'FiscalPeriod', 1, 'admin', '', '', 2, 80, __ENTITY__); + -- Binding insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $conf->facture->enabled && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_SALES)', __HANDLER__, 'left', 2401__+MAX_llx_menu__, 'accountancy', 'accountancy_dispatch_customer', 2400__+MAX_llx_menu__, '/accountancy/customer/index.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_customer', 'CustomersVentilation', 1, 'accountancy', '$user->rights->accounting->bind->write', '', 0, 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 ('', '$conf->accounting->enabled && $conf->facture->enabled && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_SALES) && $leftmenu=="accountancy_dispatch_customer"', __HANDLER__, 'left', 2402__+MAX_llx_menu__, 'accountancy', '', 2401__+MAX_llx_menu__, '/accountancy/customer/list.php?mainmenu=accountancy', 'ToDispatch', 2, 'accountancy', '$user->rights->accounting->bind->write', '', 0, 3, __ENTITY__); @@ -283,22 +318,29 @@ 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 ('', '$conf->accounting->enabled && $conf->expensereport->enabled && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS)', __HANDLER__, 'left', 2420__+MAX_llx_menu__, 'accountancy', 'accountancy_dispatch_expensereport', 2400__+MAX_llx_menu__, '/accountancy/expensereport/index.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_expensereport', 'ExpenseReportsVentilation', 1, 'accountancy', '$user->rights->accounting->bind->write', '', 0, 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 ('', '$conf->accounting->enabled && $conf->expensereport->enabled && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS) && $leftmenu=="accountancy_dispatch_expensereport"', __HANDLER__, 'left', 2421__+MAX_llx_menu__, 'accountancy', '', 2420__+MAX_llx_menu__, '/accountancy/expensereport/list.php?mainmenu=accountancy', 'ToDispatch', 2, 'accountancy', '$user->rights->accounting->bind->write', '', 0, 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 ('', '$conf->accounting->enabled && $conf->expensereport->enabled && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS) && $leftmenu=="accountancy_dispatch_expensereport"', __HANDLER__, 'left', 2422__+MAX_llx_menu__, 'accountancy', '', 2420__+MAX_llx_menu__, '/accountancy/expensereport/lines.php?mainmenu=accountancy', 'Dispatched', 2, 'accountancy', '$user->rights->accounting->bind->write', '', 0, 7, __ENTITY__); + -- Export accounting documents insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled || $conf->accounting->enabled', __HANDLER__, 'left', 2436__+MAX_llx_menu__, 'accountancy', 'accountancy_files', 2400__+MAX_llx_menu__, '/compta/accounting-files.php?mainmenu=accountancy&leftmenu=accountancy_files', 'AccountantFiles', 1, 'accountancy', '$user->rights->compta->resultat->lire || $user->rights->accounting->mouvements->lire', '', 0, 16, __ENTITY__); + -- Journals --insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2705__+MAX_llx_menu__, 'accountancy', '', 2400__+MAX_llx_menu__, '', 'Journalization', 1, 'main', '$user->rights->accounting->comptarapport->lire', '', 0, 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 ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2707__+MAX_llx_menu__, 'accountancy', '', 2705__+MAX_llx_menu__, '/accountancy/journal/bankjournal.php?mainmenu=accountancy&leftmenu=accountancy_journal&id_journal=3', 'BankJournal', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 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 ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2708__+MAX_llx_menu__, 'accountancy', '', 2705__+MAX_llx_menu__, '/accountancy/journal/expensereportsjournal.php?mainmenu=accountancy&leftmenu=accountancy_journal&id_journal=6', 'ExpenseReportJournal', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 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 ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2709__+MAX_llx_menu__, 'accountancy', '', 2705__+MAX_llx_menu__, '/accountancy/journal/purchasesjournal.php?mainmenu=accountancy&leftmenu=accountancy_journal&id_journal=2', 'PurchasesJournal', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 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 ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2706__+MAX_llx_menu__, 'accountancy', '', 2705__+MAX_llx_menu__, '/accountancy/journal/sellsjournal.php?mainmenu=accountancy&leftmenu=accountancy_journal&id_journal=1', 'SellsJournal', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 4, __ENTITY__); + -- Balance insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2430__+MAX_llx_menu__, 'accountancy', 'balance', 2400__+MAX_llx_menu__, '/accountancy/bookkeeping/balance.php?mainmenu=accountancy&leftmenu=accountancy_balance', 'AccountBalance', 1, 'accountancy', '$user->rights->accounting->mouvements->lire', '', 0, 10, __ENTITY__); + -- General Ledger insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2432__+MAX_llx_menu__, 'accountancy', 'bookkeeping', 2400__+MAX_llx_menu__, '/accountancy/bookkeeping/listbyaccount.php?mainmenu=accountancy&leftmenu=accountancy_bookeeping', 'Bookkeeping', 1, 'accountancy', '$user->rights->accounting->mouvements->lire', '', 0, 12, __ENTITY__); + -- Journals insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2434__+MAX_llx_menu__, 'accountancy', 'bookkeeping', 2400__+MAX_llx_menu__, '/accountancy/bookkeeping/list.php?mainmenu=accountancy&leftmenu=accountancy_bookeeping', 'Journals', 1, 'accountancy', '$user->rights->accounting->mouvements->lire', '', 0, 15, __ENTITY__); + -- Closure insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2437__+MAX_llx_menu__, 'accountancy', 'accountancy_closure', 2400__+MAX_llx_menu__, '/accountancy/closure/index.php?mainmenu=accountancy&leftmenu=accountancy_closure', 'MenuAccountancyClosure', 1, 'accountancy', '$user->rights->accounting->fiscalyear->write', '', 0, 17, __ENTITY__); + -- Reports insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2440__+MAX_llx_menu__, 'accountancy', 'accountancy_report', 2400__+MAX_llx_menu__, '/compta/resultat/index.php?mainmenu=accountancy&leftmenu=accountancy_report', 'Reportings', 1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 17, __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 ('', '$conf->accounting->enabled && $leftmenu=="accountancy_report"', __HANDLER__, 'left', 2441__+MAX_llx_menu__, 'accountancy', 'accountancy_report', 2440__+MAX_llx_menu__, '/compta/resultat/index.php?mainmenu=accountancy&leftmenu=accountancy_report', 'MenuReportInOut', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 18, __ENTITY__); @@ -308,6 +350,7 @@ 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 ('', '$conf->accounting->enabled && $leftmenu=="accountancy_report"', __HANDLER__, 'left', 2445__+MAX_llx_menu__, 'accountancy', 'accountancy_report', 2444__+MAX_llx_menu__, '/compta/stats/casoc.php?mainmenu=accountancy&leftmenu=accountancy_report', 'ByCompanies', 3, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 22, __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 ('', '$conf->accounting->enabled && $leftmenu=="accountancy_report"', __HANDLER__, 'left', 2446__+MAX_llx_menu__, 'accountancy', 'accountancy_report', 2444__+MAX_llx_menu__, '/compta/stats/cabyuser.php?mainmenu=accountancy&leftmenu=accountancy_report', 'ByUsers', 3, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 23, __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 ('', '$conf->accounting->enabled && $leftmenu=="accountancy_report"', __HANDLER__, 'left', 2447__+MAX_llx_menu__, 'accountancy', 'accountancy_report', 2444__+MAX_llx_menu__, '/compta/stats/cabyprodserv.php?mainmenu=accountancy&leftmenu=accountancy_report', 'ByProductsAndServices', 3, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 24, __ENTITY__); + -- Accounting simple insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled', __HANDLER__, 'left', 2700__+MAX_llx_menu__, 'accountancy', 'ca', 9__+MAX_llx_menu__, '/compta/resultat/index.php?mainmenu=accountancy&leftmenu=ca', 'Reportings', 0, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 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 ('', '$conf->comptabilite->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2711__+MAX_llx_menu__, 'accountancy', '', 2700__+MAX_llx_menu__, '/compta/resultat/index.php?mainmenu=accountancy&leftmenu=ca', 'MenuReportInOut', 1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 0, __ENTITY__); @@ -316,6 +359,7 @@ 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 ('', '$conf->comptabilite->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2714__+MAX_llx_menu__, 'accountancy', '', 2703__+MAX_llx_menu__, '/compta/stats/casoc.php?mainmenu=accountancy&leftmenu=ca', 'ByCompanies', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 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 ('', '$conf->comptabilite->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2715__+MAX_llx_menu__, 'accountancy', '', 2703__+MAX_llx_menu__, '/compta/stats/cabyuser.php?mainmenu=accountancy&leftmenu=ca', 'ByUsers', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 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 ('', '$conf->comptabilite->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2716__+MAX_llx_menu__, 'accountancy', '', 2703__+MAX_llx_menu__, '/compta/stats/cabyprodserv.php?mainmenu=accountancy&leftmenu=ca', 'ByProductsAndServices', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 1, __ENTITY__); + -- Assets insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->asset->enabled', __HANDLER__, 'left', 3000__+MAX_llx_menu__, 'accountancy', 'asset', 9__+MAX_llx_menu__, '/asset/list.php?mainmenu=accountancy&leftmenu=asset', 'MenuAssets', 1, 'assets', '$user->rights->asset->read', '', 0, 20, __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 ('', '$conf->asset->enabled && $leftmenu=="asset"', __HANDLER__, 'left', 3001__+MAX_llx_menu__, 'asset', '', 3000__+MAX_llx_menu__, '/asset/card.php?mainmenu=accountancy&leftmenu=asset&action=create', 'MenuNewAsset', 2, 'assets', '$user->rights->asset->write', '', 0, 21, __ENTITY__); @@ -323,10 +367,12 @@ 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 ('', '$conf->asset->enabled && $leftmenu=="asset"', __HANDLER__, 'left', 3004__+MAX_llx_menu__, 'asset', 'asset_type', 3000__+MAX_llx_menu__, '/asset/type.php?mainmenu=accountancy&leftmenu=asset', 'MenuTypeAssets', 2, 'assets', '$user->rights->asset->read', '', 0, 23, __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 ('', '$conf->asset->enabled && $leftmenu=="asset"', __HANDLER__, 'left', 3005__+MAX_llx_menu__, 'asset', '', 3004__+MAX_llx_menu__, '/asset/type.php?mainmenu=accountancy&action=create', 'MenuNewTypeAssets', 3, 'assets', '$user->rights->asset->setup_advance', '', 0, 24, __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 ('', '$conf->asset->enabled && $leftmenu=="asset"', __HANDLER__, 'left', 3006__+MAX_llx_menu__, 'asset', '', 3004__+MAX_llx_menu__, '/asset/type.php?mainmenu=accountancy', 'MenuListTypeAssets', 3, 'assets', '$user->rights->asset->read', '', 0, 25, __ENTITY__); + -- Check deposit insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'empty($conf->global->BANK_DISABLE_CHECK_DEPOSIT) && ! empty($conf->banque->enabled) && (! empty($conf->facture->enabled) || ! empty($conf->global->MAIN_MENU_CHEQUE_DEPOSIT_ON))', __HANDLER__, 'left', 1711__+MAX_llx_menu__, 'accountancy', 'checks', 14__+MAX_llx_menu__, '/compta/paiement/cheque/index.php?mainmenu=bank&leftmenu=checks', 'MenuChequeDeposits', 0, 'bills', '$user->rights->banque->lire', '', 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 ('', 'empty($conf->global->BANK_DISABLE_CHECK_DEPOSIT) && ! empty($conf->banque->enabled) && (! empty($conf->facture->enabled) || ! empty($conf->global->MAIN_MENU_CHEQUE_DEPOSIT_ON))', __HANDLER__, 'left', 1712__+MAX_llx_menu__, 'accountancy', '', 1711__+MAX_llx_menu__, '/compta/paiement/cheque/card.php?mainmenu=bank&leftmenu=checks&action=new', 'NewCheckDeposit', 1, 'compta', '$user->rights->banque->lire', '', 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 ('', 'empty($conf->global->BANK_DISABLE_CHECK_DEPOSIT) && ! empty($conf->banque->enabled) && (! empty($conf->facture->enabled) || ! empty($conf->global->MAIN_MENU_CHEQUE_DEPOSIT_ON))', __HANDLER__, 'left', 1713__+MAX_llx_menu__, 'accountancy', '', 1711__+MAX_llx_menu__, '/compta/paiement/cheque/list.php?mainmenu=bank&leftmenu=checks', 'List', 1, 'bills', '$user->rights->banque->lire', '', 2, 1, __ENTITY__); + -- PaymentByDirectDebit insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->prelevement->enabled', __HANDLER__, 'left', 2500__+MAX_llx_menu__, 'accountancy', 'withdraw', 14__+MAX_llx_menu__, '/compta/prelevement/index.php?mainmenu=bank&leftmenu=withdraw', 'PaymentByDirectDebit', 0, 'withdrawals', '$user->rights->prelevement->bons->lire', '', 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 ('', '$conf->prelevement->enabled && $leftmenu=="withdraw"', __HANDLER__, 'left', 2502__+MAX_llx_menu__, 'accountancy', '', 2500__+MAX_llx_menu__, '/compta/prelevement/create.php?mainmenu=bank&leftmenu=withdraw', 'NewStandingOrder', 1, 'withdrawals', '$user->rights->prelevement->bons->lire', '', 2, 0, __ENTITY__); @@ -334,6 +380,7 @@ 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 ('', '$conf->prelevement->enabled && $leftmenu=="withdraw"', __HANDLER__, 'left', 2504__+MAX_llx_menu__, 'accountancy', '', 2500__+MAX_llx_menu__, '/compta/prelevement/list.php?mainmenu=bank&leftmenu=withdraw', 'WithdrawalsLines', 1, 'withdrawals', '$user->rights->prelevement->bons->lire', '', 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 ('', '$conf->prelevement->enabled && $leftmenu=="withdraw"', __HANDLER__, 'left', 2506__+MAX_llx_menu__, 'accountancy', '', 2500__+MAX_llx_menu__, '/compta/prelevement/rejets.php?mainmenu=bank&leftmenu=withdraw', 'Rejects', 1, 'withdrawals', '$user->rights->prelevement->bons->lire', '', 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 ('', '$conf->prelevement->enabled && $leftmenu=="withdraw"', __HANDLER__, 'left', 2507__+MAX_llx_menu__, 'accountancy', '', 2500__+MAX_llx_menu__, '/compta/prelevement/stats.php?mainmenu=bank&leftmenu=withdraw', 'Statistics', 1, 'withdrawals', '$user->rights->prelevement->bons->lire', '', 2, 6, __ENTITY__); + -- PaymentByCreditTransfer insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->prelevement->enabled', __HANDLER__, 'left', 2510__+MAX_llx_menu__, 'accountancy', 'banktransfer', 14__+MAX_llx_menu__, '/compta/prelevement/index.php?mainmenu=bank&leftmenu=banktransfer&type=bank-transfer', 'PaymentByBankTransfer', 0, 'withdrawals', '$user->rights->prelevement->bons->lire', '', 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 ('', '$conf->prelevement->enabled && $leftmenu=="banktransfer"', __HANDLER__, 'left', 2512__+MAX_llx_menu__, 'accountancy', '', 2510__+MAX_llx_menu__, '/compta/prelevement/create.php?mainmenu=bank&leftmenu=banktransfer&type=bank-transfer', 'NewStandingOrder', 1, 'withdrawals', '$user->rights->prelevement->bons->lire', '', 2, 0, __ENTITY__); @@ -341,6 +388,7 @@ 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 ('', '$conf->prelevement->enabled && $leftmenu=="banktransfer"', __HANDLER__, 'left', 2514__+MAX_llx_menu__, 'accountancy', '', 2510__+MAX_llx_menu__, '/compta/prelevement/list.php?mainmenu=bank&leftmenu=banktransfer&type=bank-transfer', 'WithdrawalsLines', 1, 'withdrawals', '$user->rights->prelevement->bons->lire', '', 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 ('', '$conf->prelevement->enabled && $leftmenu=="banktransfer"', __HANDLER__, 'left', 2516__+MAX_llx_menu__, 'accountancy', '', 2510__+MAX_llx_menu__, '/compta/prelevement/rejets.php?mainmenu=bank&leftmenu=banktransfer&type=bank-transfer', 'Rejects', 1, 'withdrawals', '$user->rights->prelevement->bons->lire', '', 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 ('', '$conf->prelevement->enabled && $leftmenu=="banktransfer"', __HANDLER__, 'left', 2517__+MAX_llx_menu__, 'accountancy', '', 2510__+MAX_llx_menu__, '/compta/prelevement/stats.php?mainmenu=bank&leftmenu=banktransfer&type=bank-transfer', 'Statistics', 1, 'withdrawals', '$user->rights->prelevement->bons->lire', '', 2, 6, __ENTITY__); + -- Bank insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled', __HANDLER__, 'left', 2600__+MAX_llx_menu__, 'accountancy', 'bank', 14__+MAX_llx_menu__, '/compta/bank/list.php?mainmenu=bank&leftmenu=bank', 'MenuBankCash', 0, 'banks', '$user->rights->banque->lire', '', 0, 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 ('', '$conf->banque->enabled && ($leftmenu=="bank" || $leftmenu=="checks" || $leftmenu=="withdraw")', __HANDLER__, 'left', 2601__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/card.php?mainmenu=bank&action=create&leftmenu=bank', 'MenuNewFinancialAccount', 1, 'banks', '$user->rights->banque->configurer', '', 0, 0, __ENTITY__); @@ -348,9 +396,12 @@ 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 ('', '$conf->banque->enabled && ($leftmenu=="bank" || $leftmenu=="checks" || $leftmenu=="withdraw")', __HANDLER__, 'left', 2603__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/bankentries_list.php?mainmenu=bank&leftmenu=bank', 'ListTransactions', 1, 'banks', '$user->rights->banque->lire', '', 0, 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 ('', '$conf->banque->enabled && ($leftmenu=="bank" || $leftmenu=="checks" || $leftmenu=="withdraw")', __HANDLER__, 'left', 2604__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/budget.php?mainmenu=bank&leftmenu=bank', 'ListTransactionsByCategory', 1, 'banks', '$user->rights->banque->lire', '', 0, 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 ('', '$conf->banque->enabled && ($leftmenu=="bank" || $leftmenu=="checks" || $leftmenu=="withdraw")', __HANDLER__, 'left', 2606__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/transfer.php?mainmenu=bank&leftmenu=bank', 'BankTransfers', 1, 'banks', '$user->rights->banque->transfer', '', 0, 5, __ENTITY__); + -- Bank - Categories insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->categorie->enabled', __HANDLER__, 'left', 2650__+MAX_llx_menu__, 'accountancy', 'cat', 14__+MAX_llx_menu__, '/categories/index.php?mainmenu=bank&leftmenu=bank&type=5', 'Categories', 0, 'categories', '$user->rights->categorie->lire', '', 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 ('', '$conf->categorie->enabled', __HANDLER__, 'left', 2651__+MAX_llx_menu__, 'accountancy', '', 2650__+MAX_llx_menu__, '/categories/card.php?mainmenu=bank&leftmenu=bank&action=create&type=5', 'NewCategory', 1, 'categories', '$user->rights->categorie->creer', '', 2, 0, __ENTITY__); + + -- Project insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3600__+MAX_llx_menu__, 'project', 'projects', 7__+MAX_llx_menu__, '/projet/index.php?mainmenu=project&leftmenu=projects', 'LeadsOrProjects', 0, 'projects', '$user->rights->projet->lire', '', 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 ('', '$conf->projet->enabled', __HANDLER__, 'left', 3601__+MAX_llx_menu__, 'project', '', 3600__+MAX_llx_menu__, '/projet/card.php?mainmenu=project&leftmenu=projects&action=create', 'New', 1, 'projects', '$user->rights->projet->creer', '', 2, 1, __ENTITY__); @@ -370,6 +421,7 @@ 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 ('', '$conf->bom->enabled', __HANDLER__, 'left', 5400__+MAX_llx_menu__, 'mrp', 'bom', 16__+MAX_llx_menu__, '/bom/bom_list.php?mainmenu=mrp&leftmenu=bom', 'MenuBOM', 1, 'mrp', '$user->rights->bom->read', '', 0, 20, __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 ('', '$conf->bom->enabled', __HANDLER__, 'left', 5401__+MAX_llx_menu__, 'mrp', '', 5400__+MAX_llx_menu__, '/bom/bom_card.php?mainmenu=mrp&leftmenu=bom&action=create', 'NewBOM', 2, 'mrp', '$user->rights->bom->write', '', 0, 21, __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 ('', '$conf->bom->enabled', __HANDLER__, 'left', 5403__+MAX_llx_menu__, 'mrp', '', 5400__+MAX_llx_menu__, '/bom/bom_list.php?mainmenu=mrp&leftmenu=bom', 'List', 2, 'mrp', '$user->rights->bom->read', '', 0, 22, __ENTITY__); + -- MRP insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->bom->enabled', __HANDLER__, 'left', 5450__+MAX_llx_menu__, 'mrp', 'mrp', 16__+MAX_llx_menu__, '/mrp/mo_list.php?mainmenu=mrp&leftmenu=mrp', 'MenuMRP', 1, 'mrp', '$user->rights->mrp->read', '', 0, 20, __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 ('', '$conf->bom->enabled', __HANDLER__, 'left', 5451__+MAX_llx_menu__, 'mrp', '', 5450__+MAX_llx_menu__, '/mrp/mo_card.php?mainmenu=mrp&leftmenu=mrp&action=create', 'NewMO', 2, 'mrp', '$user->rights->mrp->write', '', 0, 21, __ENTITY__); @@ -379,6 +431,7 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left -- Project - Categories insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->categorie->enabled', __HANDLER__, 'left', 3804__+MAX_llx_menu__, 'project', 'cat', 7__+MAX_llx_menu__, '/categories/index.php?mainmenu=project&leftmenu=cat&type=6', 'Categories', 0, 'categories', '$user->rights->categorie->lire', '', 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 ('', '$conf->categorie->enabled', __HANDLER__, 'left', 3805__+MAX_llx_menu__, 'project', '', 3804__+MAX_llx_menu__, '/categories/card.php?mainmenu=project&action=create&type=6', 'NewCategory', 1, 'categories', '$user->rights->categorie->creer', '', 2, 0, __ENTITY__); + -- Tools insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'empty($user->socid)', __HANDLER__, 'left', 3900__+MAX_llx_menu__, 'tools', 'email_templates', 8__+MAX_llx_menu__, '/admin/mails_templates.php?mainmenu=tools&leftmenu=email_templates', 'EMailTemplates', 0, '', '', '', 0, 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 ('', '$conf->mailing->enabled', __HANDLER__, 'left', 3910__+MAX_llx_menu__, 'tools', 'mailing', 8__+MAX_llx_menu__, '/comm/mailing/index.php?mainmenu=tools&leftmenu=mailing', 'EMailings', 0, 'mails', '$user->rights->mailing->lire', '', 0, 0, __ENTITY__); @@ -388,6 +441,7 @@ 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 ('', '$conf->export->enabled', __HANDLER__, 'left', 4101__+MAX_llx_menu__, 'tools', '', 4100__+MAX_llx_menu__, '/exports/export.php?mainmenu=tools&leftmenu=export', 'NewExport', 1, 'exports', '$user->rights->export->creer', '', 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 ('', '$conf->import->enabled', __HANDLER__, 'left', 4130__+MAX_llx_menu__, 'tools', 'import', 8__+MAX_llx_menu__, '/imports/index.php?mainmenu=tools&leftmenu=import', 'FormatedImport', 0, 'exports', '$user->rights->import->run', '', 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 ('', '$conf->import->enabled', __HANDLER__, 'left', 4131__+MAX_llx_menu__, 'tools', '', 4130__+MAX_llx_menu__, '/imports/import.php?mainmenu=tools&leftmenu=import', 'NewImport', 1, 'exports', '$user->rights->import->run', '', 2, 0, __ENTITY__); + -- Members insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled', __HANDLER__, 'left', 4200__+MAX_llx_menu__, 'members', 'members', 13__+MAX_llx_menu__, '/adherents/index.php?mainmenu=members&leftmenu=members', 'Members', 0, 'members', '$user->rights->adherent->lire', '', 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 ('', '$conf->adherent->enabled', __HANDLER__, 'left', 4201__+MAX_llx_menu__, 'members', '', 4200__+MAX_llx_menu__, '/adherents/card.php?mainmenu=members&leftmenu=members&action=create', 'NewMember', 1, 'members', '$user->rights->adherent->creer', '', 2, 0, __ENTITY__); @@ -412,6 +466,7 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left -- Members - Category member insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled && $conf->categorie->enabled', __HANDLER__, 'left', 5200__+MAX_llx_menu__, 'members', 'cat', 13__+MAX_llx_menu__, '/categories/index.php?mainmenu=members&leftmenu=cat&type=3', 'MembersCategoriesShort', 0, 'categories', '$user->rights->categorie->lire', '', 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 ('', '$conf->adherent->enabled && $conf->categorie->enabled', __HANDLER__, 'left', 5201__+MAX_llx_menu__, 'members', '', 5200__+MAX_llx_menu__, '/categories/card.php?mainmenu=members&action=create&type=3', 'NewCategory', 1, 'categories', '$user->rights->categorie->creer', '', 2, 0, __ENTITY__); + -- HRM - Employee insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->hrm->enabled', __HANDLER__, 'left', 4600__+MAX_llx_menu__, 'hrm', 'hrm', 15__+MAX_llx_menu__, '/user/list.php?mainmenu=hrm&leftmenu=hrm&mode=employee', 'Employees', 0, 'hrm', '$user->rights->user->user->lire', '', 0, 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 ('', '$conf->hrm->enabled', __HANDLER__, 'left', 4601__+MAX_llx_menu__, 'hrm', '', 4600__+MAX_llx_menu__, '/user/card.php?mainmenu=hrm&action=create&employee=1', 'NewEmployee', 1, 'hrm', '$user->rights->user->user->creer', '', 0, 1, __ENTITY__); From bc60a1c819a2d332d8f8b6677be6e9c3a62f9a89 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Sat, 12 Mar 2022 12:19:13 +0100 Subject: [PATCH 126/610] Update init_menu_auguria.sql --- htdocs/core/menus/init_menu_auguria.sql | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index 5a3bc2fa2c4..20946d73e55 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -10,18 +10,18 @@ delete from llx_menu where menu_handler=__HANDLER__ and entity=__ENTITY__; -- -- Top-Menu -insert into llx_menu (rowid, enabled, module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '1', 1__+MAX_llx_menu__, __HANDLER__, 'top', 'home', '', 0, '/index.php?mainmenu=home&leftmenu=', 'Home', -1, '', '', '', 2, 10, __ENTITY__); -insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('societe|fournisseur|supplier_order|supplier_invoice', '($conf->societe->enabled && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) || !empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || $conf->supplier_order->enabled || $conf->supplier_invoice->enabled))', 2__+MAX_llx_menu__, __HANDLER__, 'top', 'companies', '', 0, '/societe/index.php?mainmenu=companies&leftmenu=', 'ThirdParties', -1, 'companies', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 20, __ENTITY__); -insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('product|service', '$conf->product->enabled || $conf->service->enabled', 3__+MAX_llx_menu__, __HANDLER__, 'top', 'products', '', 0, '/product/index.php?mainmenu=products&leftmenu=', 'ProductsPipeServices', -1, 'products', '$user->rights->produit->lire||$user->rights->service->lire', '', 0, 30, __ENTITY__); -insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('bom|mrp', '$conf->bom->enabled || $conf->mrp->enabled', 16__+MAX_llx_menu__, __HANDLER__, 'top', 'mrp', '', 0, '/mrp/index.php?mainmenu=mrp&leftmenu=', 'MRP', -1, 'mrp', '$user->rights->bom->read||$user->rights->mrp->read', '', 0, 31, __ENTITY__); -insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('projet', '$conf->projet->enabled', 7__+MAX_llx_menu__, __HANDLER__, 'top', 'project', '', 0, '/projet/index.php?mainmenu=project&leftmenu=', 'Projects', -1, 'projects', '$user->rights->projet->lire', '', 2, 32, __ENTITY__); -insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('propal|commande|fournisseur|supplier_order|supplier_invoice|contrat|ficheinter', '$conf->propal->enabled || $conf->commande->enabled || $conf->supplier_order->enabled || $conf->contrat->enabled || $conf->ficheinter->enabled', 5__+MAX_llx_menu__, __HANDLER__, 'top', 'commercial', '', 0, '/comm/index.php?mainmenu=commercial&leftmenu=', 'Commercial', -1, 'commercial', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 40, __ENTITY__); -insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('facture|don|tax|salaries|loan|banque', '$conf->comptabilite->enabled || $conf->accounting->enabled || $conf->facture->enabled || $conf->don->enabled || $conf->tax->enabled || $conf->salaries->enabled || $conf->supplier_invoice->enabled || $conf->loan->enabled || $conf->banque->enabled', 6__+MAX_llx_menu__, __HANDLER__, 'top', 'billing', '', 0, '/compta/index.php?mainmenu=billing&leftmenu=', 'MenuFinancial', -1, 'compta', '$user->rights->facture->lire|| $user->rights->don->lire || $user->rights->tax->charges->lire || $user->rights->salaries->read || $user->rights->loan->read || $user->rights->banque->lire', '', 2, 50, __ENTITY__); -insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('banque|prelevement', '$conf->banque->enabled || $conf->prelevement->enabled', 14__+MAX_llx_menu__, __HANDLER__, 'top', 'bank', '', 0, '/compta/bank/list.php?mainmenu=bank&leftmenu=bank', 'MenuBankCash', -1, 'banks', '$user->rights->banque->lire || $user->rights->prelevement->bons->lire', '', 0, 52, __ENTITY__); -insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('comptabilite|accounting|asset', '$conf->comptabilite->enabled || $conf->accounting->enabled || $conf->asset->enabled', 9__+MAX_llx_menu__, __HANDLER__, 'top', 'accountancy', '', 0, '/compta/index.php?mainmenu=accountancy&leftmenu=accountancy', 'MenuAccountancy', -1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->mouvements->lire || $user->rights->asset->read', '', 2, 54, __ENTITY__); -insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '', 8__+MAX_llx_menu__, __HANDLER__, 'top', 'tools', '', 0, '/core/tools.php?mainmenu=tools&leftmenu=', 'Tools', -1, 'other', '', '', 2, 90, __ENTITY__); -insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('adherent', '$conf->adherent->enabled', 13__+MAX_llx_menu__, __HANDLER__, 'top', 'members', '', 0, '/adherents/index.php?mainmenu=members&leftmenu=', 'Members', -1, 'members', '$user->rights->adherent->lire', '', 2, 19, __ENTITY__); -insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('hrm|holiday|deplacement|expensereport', '$conf->hrm->enabled || $conf->holiday->enabled || $conf->deplacement->enabled || $conf->expensereport->enabled', 15__+MAX_llx_menu__, __HANDLER__, 'top', 'hrm', '', 0, '/hrm/index.php?mainmenu=hrm&leftmenu=', 'HRM', -1, 'holiday', '$user->rights->user->user->lire || $user->rights->holiday->read || $user->rights->deplacement->lire || $user->rights->expensereport->lire', '', 0, 80, __ENTITY__); +insert into llx_menu (rowid, enabled, module, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 1__+MAX_llx_menu__, '1', '', __HANDLER__, 'top', 'home', '', 0, '/index.php?mainmenu=home&leftmenu=', 'Home', -1, '', '', '', 2, 10, __ENTITY__); +insert into llx_menu (rowid, enabled, module, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 2__+MAX_llx_menu__,'societe|fournisseur|supplier_order|supplier_invoice', '($conf->societe->enabled && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) || !empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || $conf->supplier_order->enabled || $conf->supplier_invoice->enabled))', __HANDLER__, 'top', 'companies', '', 0, '/societe/index.php?mainmenu=companies&leftmenu=', 'ThirdParties', -1, 'companies', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 20, __ENTITY__); +insert into llx_menu (rowid, enabled, module, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('product|service', '$conf->product->enabled || $conf->service->enabled', 3__+MAX_llx_menu__, __HANDLER__, 'top', 'products', '', 0, '/product/index.php?mainmenu=products&leftmenu=', 'ProductsPipeServices', -1, 'products', '$user->rights->produit->lire||$user->rights->service->lire', '', 0, 30, __ENTITY__); +insert into llx_menu (rowid, enabled, module, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('bom|mrp', '$conf->bom->enabled || $conf->mrp->enabled', 16__+MAX_llx_menu__, __HANDLER__, 'top', 'mrp', '', 0, '/mrp/index.php?mainmenu=mrp&leftmenu=', 'MRP', -1, 'mrp', '$user->rights->bom->read||$user->rights->mrp->read', '', 0, 31, __ENTITY__); +insert into llx_menu (rowid, enabled, module, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('projet', '$conf->projet->enabled', 7__+MAX_llx_menu__, __HANDLER__, 'top', 'project', '', 0, '/projet/index.php?mainmenu=project&leftmenu=', 'Projects', -1, 'projects', '$user->rights->projet->lire', '', 2, 32, __ENTITY__); +insert into llx_menu (rowid, enabled, module, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('propal|commande|fournisseur|supplier_order|supplier_invoice|contrat|ficheinter', '$conf->propal->enabled || $conf->commande->enabled || $conf->supplier_order->enabled || $conf->contrat->enabled || $conf->ficheinter->enabled', 5__+MAX_llx_menu__, __HANDLER__, 'top', 'commercial', '', 0, '/comm/index.php?mainmenu=commercial&leftmenu=', 'Commercial', -1, 'commercial', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 40, __ENTITY__); +insert into llx_menu (rowid, enabled, module, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('facture|don|tax|salaries|loan|banque', '$conf->comptabilite->enabled || $conf->accounting->enabled || $conf->facture->enabled || $conf->don->enabled || $conf->tax->enabled || $conf->salaries->enabled || $conf->supplier_invoice->enabled || $conf->loan->enabled || $conf->banque->enabled', 6__+MAX_llx_menu__, __HANDLER__, 'top', 'billing', '', 0, '/compta/index.php?mainmenu=billing&leftmenu=', 'MenuFinancial', -1, 'compta', '$user->rights->facture->lire|| $user->rights->don->lire || $user->rights->tax->charges->lire || $user->rights->salaries->read || $user->rights->loan->read || $user->rights->banque->lire', '', 2, 50, __ENTITY__); +insert into llx_menu (rowid, enabled, module, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('banque|prelevement', '$conf->banque->enabled || $conf->prelevement->enabled', 14__+MAX_llx_menu__, __HANDLER__, 'top', 'bank', '', 0, '/compta/bank/list.php?mainmenu=bank&leftmenu=bank', 'MenuBankCash', -1, 'banks', '$user->rights->banque->lire || $user->rights->prelevement->bons->lire', '', 0, 52, __ENTITY__); +insert into llx_menu (rowid, enabled, module, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('comptabilite|accounting|asset', '$conf->comptabilite->enabled || $conf->accounting->enabled || $conf->asset->enabled', 9__+MAX_llx_menu__, __HANDLER__, 'top', 'accountancy', '', 0, '/compta/index.php?mainmenu=accountancy&leftmenu=accountancy', 'MenuAccountancy', -1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->mouvements->lire || $user->rights->asset->read', '', 2, 54, __ENTITY__); +insert into llx_menu (rowid, enabled, module, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '', 8__+MAX_llx_menu__, __HANDLER__, 'top', 'tools', '', 0, '/core/tools.php?mainmenu=tools&leftmenu=', 'Tools', -1, 'other', '', '', 2, 90, __ENTITY__); +insert into llx_menu (rowid, enabled, module, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('adherent', '$conf->adherent->enabled', 13__+MAX_llx_menu__, __HANDLER__, 'top', 'members', '', 0, '/adherents/index.php?mainmenu=members&leftmenu=', 'Members', -1, 'members', '$user->rights->adherent->lire', '', 2, 19, __ENTITY__); +insert into llx_menu (rowid, enabled, module, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('hrm|holiday|deplacement|expensereport', '$conf->hrm->enabled || $conf->holiday->enabled || $conf->deplacement->enabled || $conf->expensereport->enabled', 15__+MAX_llx_menu__, __HANDLER__, 'top', 'hrm', '', 0, '/hrm/index.php?mainmenu=hrm&leftmenu=', 'HRM', -1, 'holiday', '$user->rights->user->user->lire || $user->rights->holiday->read || $user->rights->deplacement->lire || $user->rights->expensereport->lire', '', 0, 80, __ENTITY__); -- Sub-Menu From 7ff53ddb74740cbff02c719e067d0a54c498e431 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Sat, 12 Mar 2022 12:25:49 +0100 Subject: [PATCH 127/610] Update init_menu_auguria.sql --- htdocs/core/menus/init_menu_auguria.sql | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index 20946d73e55..e3d8c76b7c1 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -10,9 +10,10 @@ delete from llx_menu where menu_handler=__HANDLER__ and entity=__ENTITY__; -- -- Top-Menu -insert into llx_menu (rowid, enabled, module, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 1__+MAX_llx_menu__, '1', '', __HANDLER__, 'top', 'home', '', 0, '/index.php?mainmenu=home&leftmenu=', 'Home', -1, '', '', '', 2, 10, __ENTITY__); -insert into llx_menu (rowid, enabled, module, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 2__+MAX_llx_menu__,'societe|fournisseur|supplier_order|supplier_invoice', '($conf->societe->enabled && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) || !empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || $conf->supplier_order->enabled || $conf->supplier_invoice->enabled))', __HANDLER__, 'top', 'companies', '', 0, '/societe/index.php?mainmenu=companies&leftmenu=', 'ThirdParties', -1, 'companies', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 20, __ENTITY__); -insert into llx_menu (rowid, enabled, module, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('product|service', '$conf->product->enabled || $conf->service->enabled', 3__+MAX_llx_menu__, __HANDLER__, 'top', 'products', '', 0, '/product/index.php?mainmenu=products&leftmenu=', 'ProductsPipeServices', -1, 'products', '$user->rights->produit->lire||$user->rights->service->lire', '', 0, 30, __ENTITY__); +-- old: (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) +insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 1__+MAX_llx_menu__, '', '1', __HANDLER__, 'top', 'home', '', 0, '/index.php?mainmenu=home&leftmenu=', 'Home', -1, '', '', '', 2, 10, __ENTITY__); +insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 2__+MAX_llx_menu__, 'societe|fournisseur|supplier_order|supplier_invoice', '($conf->societe->enabled && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) || !empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || $conf->supplier_order->enabled || $conf->supplier_invoice->enabled))', __HANDLER__, 'top', 'companies', '', 0, '/societe/index.php?mainmenu=companies&leftmenu=', 'ThirdParties', -1, 'companies', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 20, __ENTITY__); +insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 3__+MAX_llx_menu__, 'product|service', '$conf->product->enabled || $conf->service->enabled', __HANDLER__, 'top', 'products', '', 0, '/product/index.php?mainmenu=products&leftmenu=', 'ProductsPipeServices', -1, 'products', '$user->rights->produit->lire||$user->rights->service->lire', '', 0, 30, __ENTITY__); insert into llx_menu (rowid, enabled, module, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('bom|mrp', '$conf->bom->enabled || $conf->mrp->enabled', 16__+MAX_llx_menu__, __HANDLER__, 'top', 'mrp', '', 0, '/mrp/index.php?mainmenu=mrp&leftmenu=', 'MRP', -1, 'mrp', '$user->rights->bom->read||$user->rights->mrp->read', '', 0, 31, __ENTITY__); insert into llx_menu (rowid, enabled, module, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('projet', '$conf->projet->enabled', 7__+MAX_llx_menu__, __HANDLER__, 'top', 'project', '', 0, '/projet/index.php?mainmenu=project&leftmenu=', 'Projects', -1, 'projects', '$user->rights->projet->lire', '', 2, 32, __ENTITY__); insert into llx_menu (rowid, enabled, module, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('propal|commande|fournisseur|supplier_order|supplier_invoice|contrat|ficheinter', '$conf->propal->enabled || $conf->commande->enabled || $conf->supplier_order->enabled || $conf->contrat->enabled || $conf->ficheinter->enabled', 5__+MAX_llx_menu__, __HANDLER__, 'top', 'commercial', '', 0, '/comm/index.php?mainmenu=commercial&leftmenu=', 'Commercial', -1, 'commercial', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 40, __ENTITY__); From 4438ef74f15db8a8d5550eb36ae7da32f6df63dd Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Sat, 12 Mar 2022 12:29:10 +0100 Subject: [PATCH 128/610] Update init_menu_auguria.sql --- htdocs/core/menus/init_menu_auguria.sql | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index e3d8c76b7c1..891decba79b 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -14,15 +14,15 @@ delete from llx_menu where menu_handler=__HANDLER__ and entity=__ENTITY__; insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 1__+MAX_llx_menu__, '', '1', __HANDLER__, 'top', 'home', '', 0, '/index.php?mainmenu=home&leftmenu=', 'Home', -1, '', '', '', 2, 10, __ENTITY__); insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 2__+MAX_llx_menu__, 'societe|fournisseur|supplier_order|supplier_invoice', '($conf->societe->enabled && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) || !empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || $conf->supplier_order->enabled || $conf->supplier_invoice->enabled))', __HANDLER__, 'top', 'companies', '', 0, '/societe/index.php?mainmenu=companies&leftmenu=', 'ThirdParties', -1, 'companies', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 20, __ENTITY__); insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 3__+MAX_llx_menu__, 'product|service', '$conf->product->enabled || $conf->service->enabled', __HANDLER__, 'top', 'products', '', 0, '/product/index.php?mainmenu=products&leftmenu=', 'ProductsPipeServices', -1, 'products', '$user->rights->produit->lire||$user->rights->service->lire', '', 0, 30, __ENTITY__); -insert into llx_menu (rowid, enabled, module, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('bom|mrp', '$conf->bom->enabled || $conf->mrp->enabled', 16__+MAX_llx_menu__, __HANDLER__, 'top', 'mrp', '', 0, '/mrp/index.php?mainmenu=mrp&leftmenu=', 'MRP', -1, 'mrp', '$user->rights->bom->read||$user->rights->mrp->read', '', 0, 31, __ENTITY__); -insert into llx_menu (rowid, enabled, module, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('projet', '$conf->projet->enabled', 7__+MAX_llx_menu__, __HANDLER__, 'top', 'project', '', 0, '/projet/index.php?mainmenu=project&leftmenu=', 'Projects', -1, 'projects', '$user->rights->projet->lire', '', 2, 32, __ENTITY__); -insert into llx_menu (rowid, enabled, module, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('propal|commande|fournisseur|supplier_order|supplier_invoice|contrat|ficheinter', '$conf->propal->enabled || $conf->commande->enabled || $conf->supplier_order->enabled || $conf->contrat->enabled || $conf->ficheinter->enabled', 5__+MAX_llx_menu__, __HANDLER__, 'top', 'commercial', '', 0, '/comm/index.php?mainmenu=commercial&leftmenu=', 'Commercial', -1, 'commercial', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 40, __ENTITY__); -insert into llx_menu (rowid, enabled, module, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('facture|don|tax|salaries|loan|banque', '$conf->comptabilite->enabled || $conf->accounting->enabled || $conf->facture->enabled || $conf->don->enabled || $conf->tax->enabled || $conf->salaries->enabled || $conf->supplier_invoice->enabled || $conf->loan->enabled || $conf->banque->enabled', 6__+MAX_llx_menu__, __HANDLER__, 'top', 'billing', '', 0, '/compta/index.php?mainmenu=billing&leftmenu=', 'MenuFinancial', -1, 'compta', '$user->rights->facture->lire|| $user->rights->don->lire || $user->rights->tax->charges->lire || $user->rights->salaries->read || $user->rights->loan->read || $user->rights->banque->lire', '', 2, 50, __ENTITY__); -insert into llx_menu (rowid, enabled, module, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('banque|prelevement', '$conf->banque->enabled || $conf->prelevement->enabled', 14__+MAX_llx_menu__, __HANDLER__, 'top', 'bank', '', 0, '/compta/bank/list.php?mainmenu=bank&leftmenu=bank', 'MenuBankCash', -1, 'banks', '$user->rights->banque->lire || $user->rights->prelevement->bons->lire', '', 0, 52, __ENTITY__); -insert into llx_menu (rowid, enabled, module, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('comptabilite|accounting|asset', '$conf->comptabilite->enabled || $conf->accounting->enabled || $conf->asset->enabled', 9__+MAX_llx_menu__, __HANDLER__, 'top', 'accountancy', '', 0, '/compta/index.php?mainmenu=accountancy&leftmenu=accountancy', 'MenuAccountancy', -1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->mouvements->lire || $user->rights->asset->read', '', 2, 54, __ENTITY__); -insert into llx_menu (rowid, enabled, module, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '', 8__+MAX_llx_menu__, __HANDLER__, 'top', 'tools', '', 0, '/core/tools.php?mainmenu=tools&leftmenu=', 'Tools', -1, 'other', '', '', 2, 90, __ENTITY__); -insert into llx_menu (rowid, enabled, module, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('adherent', '$conf->adherent->enabled', 13__+MAX_llx_menu__, __HANDLER__, 'top', 'members', '', 0, '/adherents/index.php?mainmenu=members&leftmenu=', 'Members', -1, 'members', '$user->rights->adherent->lire', '', 2, 19, __ENTITY__); -insert into llx_menu (rowid, enabled, module, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('hrm|holiday|deplacement|expensereport', '$conf->hrm->enabled || $conf->holiday->enabled || $conf->deplacement->enabled || $conf->expensereport->enabled', 15__+MAX_llx_menu__, __HANDLER__, 'top', 'hrm', '', 0, '/hrm/index.php?mainmenu=hrm&leftmenu=', 'HRM', -1, 'holiday', '$user->rights->user->user->lire || $user->rights->holiday->read || $user->rights->deplacement->lire || $user->rights->expensereport->lire', '', 0, 80, __ENTITY__); +insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 16__+MAX_llx_menu__, 'bom|mrp', '$conf->bom->enabled || $conf->mrp->enabled', __HANDLER__, 'top', 'mrp', '', 0, '/mrp/index.php?mainmenu=mrp&leftmenu=', 'MRP', -1, 'mrp', '$user->rights->bom->read||$user->rights->mrp->read', '', 0, 31, __ENTITY__); +insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 7__+MAX_llx_menu__, 'projet', '$conf->projet->enabled', __HANDLER__, 'top', 'project', '', 0, '/projet/index.php?mainmenu=project&leftmenu=', 'Projects', -1, 'projects', '$user->rights->projet->lire', '', 2, 32, __ENTITY__); +insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 5__+MAX_llx_menu__, 'propal|commande|fournisseur|supplier_order|supplier_invoice|contrat|ficheinter', '$conf->propal->enabled || $conf->commande->enabled || $conf->supplier_order->enabled || $conf->contrat->enabled || $conf->ficheinter->enabled', __HANDLER__, 'top', 'commercial', '', 0, '/comm/index.php?mainmenu=commercial&leftmenu=', 'Commercial', -1, 'commercial', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 40, __ENTITY__); +insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 6__+MAX_llx_menu__, 'facture|don|tax|salaries|loan|banque', '$conf->comptabilite->enabled || $conf->accounting->enabled || $conf->facture->enabled || $conf->don->enabled || $conf->tax->enabled || $conf->salaries->enabled || $conf->supplier_invoice->enabled || $conf->loan->enabled || $conf->banque->enabled', __HANDLER__, 'top', 'billing', '', 0, '/compta/index.php?mainmenu=billing&leftmenu=', 'MenuFinancial', -1, 'compta', '$user->rights->facture->lire|| $user->rights->don->lire || $user->rights->tax->charges->lire || $user->rights->salaries->read || $user->rights->loan->read || $user->rights->banque->lire', '', 2, 50, __ENTITY__); +insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('banque|prelevement', '$conf->banque->enabled || $conf->prelevement->enabled', 14__+MAX_llx_menu__, __HANDLER__, 'top', 'bank', '', 0, '/compta/bank/list.php?mainmenu=bank&leftmenu=bank', 'MenuBankCash', -1, 'banks', '$user->rights->banque->lire || $user->rights->prelevement->bons->lire', '', 0, 52, __ENTITY__); +insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('comptabilite|accounting|asset', '$conf->comptabilite->enabled || $conf->accounting->enabled || $conf->asset->enabled', 9__+MAX_llx_menu__, __HANDLER__, 'top', 'accountancy', '', 0, '/compta/index.php?mainmenu=accountancy&leftmenu=accountancy', 'MenuAccountancy', -1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->mouvements->lire || $user->rights->asset->read', '', 2, 54, __ENTITY__); +insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '', 8__+MAX_llx_menu__, __HANDLER__, 'top', 'tools', '', 0, '/core/tools.php?mainmenu=tools&leftmenu=', 'Tools', -1, 'other', '', '', 2, 90, __ENTITY__); +insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('adherent', '$conf->adherent->enabled', 13__+MAX_llx_menu__, __HANDLER__, 'top', 'members', '', 0, '/adherents/index.php?mainmenu=members&leftmenu=', 'Members', -1, 'members', '$user->rights->adherent->lire', '', 2, 19, __ENTITY__); +insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('hrm|holiday|deplacement|expensereport', '$conf->hrm->enabled || $conf->holiday->enabled || $conf->deplacement->enabled || $conf->expensereport->enabled', 15__+MAX_llx_menu__, __HANDLER__, 'top', 'hrm', '', 0, '/hrm/index.php?mainmenu=hrm&leftmenu=', 'HRM', -1, 'holiday', '$user->rights->user->user->lire || $user->rights->holiday->read || $user->rights->deplacement->lire || $user->rights->expensereport->lire', '', 0, 80, __ENTITY__); -- Sub-Menu From 4134bf5890a900cf2ee612e5057138c760eb6556 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Sat, 12 Mar 2022 12:31:52 +0100 Subject: [PATCH 129/610] Update init_menu_auguria.sql --- htdocs/core/menus/init_menu_auguria.sql | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index 891decba79b..0fc9968b7a3 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -11,18 +11,18 @@ delete from llx_menu where menu_handler=__HANDLER__ and entity=__ENTITY__; -- Top-Menu -- old: (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) -insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 1__+MAX_llx_menu__, '', '1', __HANDLER__, 'top', 'home', '', 0, '/index.php?mainmenu=home&leftmenu=', 'Home', -1, '', '', '', 2, 10, __ENTITY__); -insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 2__+MAX_llx_menu__, 'societe|fournisseur|supplier_order|supplier_invoice', '($conf->societe->enabled && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) || !empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || $conf->supplier_order->enabled || $conf->supplier_invoice->enabled))', __HANDLER__, 'top', 'companies', '', 0, '/societe/index.php?mainmenu=companies&leftmenu=', 'ThirdParties', -1, 'companies', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 20, __ENTITY__); -insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 3__+MAX_llx_menu__, 'product|service', '$conf->product->enabled || $conf->service->enabled', __HANDLER__, 'top', 'products', '', 0, '/product/index.php?mainmenu=products&leftmenu=', 'ProductsPipeServices', -1, 'products', '$user->rights->produit->lire||$user->rights->service->lire', '', 0, 30, __ENTITY__); +insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 1__+MAX_llx_menu__, '', '1', __HANDLER__, 'top', 'home', '', 0, '/index.php?mainmenu=home&leftmenu=', 'Home', -1, '', '', '', 2, 10, __ENTITY__); +insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 2__+MAX_llx_menu__, 'societe|fournisseur|supplier_order|supplier_invoice', '($conf->societe->enabled && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) || !empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || $conf->supplier_order->enabled || $conf->supplier_invoice->enabled))', __HANDLER__, 'top', 'companies', '', 0, '/societe/index.php?mainmenu=companies&leftmenu=', 'ThirdParties', -1, 'companies', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 20, __ENTITY__); +insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 3__+MAX_llx_menu__, 'product|service', '$conf->product->enabled || $conf->service->enabled', __HANDLER__, 'top', 'products', '', 0, '/product/index.php?mainmenu=products&leftmenu=', 'ProductsPipeServices', -1, 'products', '$user->rights->produit->lire||$user->rights->service->lire', '', 0, 30, __ENTITY__); insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 16__+MAX_llx_menu__, 'bom|mrp', '$conf->bom->enabled || $conf->mrp->enabled', __HANDLER__, 'top', 'mrp', '', 0, '/mrp/index.php?mainmenu=mrp&leftmenu=', 'MRP', -1, 'mrp', '$user->rights->bom->read||$user->rights->mrp->read', '', 0, 31, __ENTITY__); -insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 7__+MAX_llx_menu__, 'projet', '$conf->projet->enabled', __HANDLER__, 'top', 'project', '', 0, '/projet/index.php?mainmenu=project&leftmenu=', 'Projects', -1, 'projects', '$user->rights->projet->lire', '', 2, 32, __ENTITY__); -insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 5__+MAX_llx_menu__, 'propal|commande|fournisseur|supplier_order|supplier_invoice|contrat|ficheinter', '$conf->propal->enabled || $conf->commande->enabled || $conf->supplier_order->enabled || $conf->contrat->enabled || $conf->ficheinter->enabled', __HANDLER__, 'top', 'commercial', '', 0, '/comm/index.php?mainmenu=commercial&leftmenu=', 'Commercial', -1, 'commercial', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 40, __ENTITY__); -insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 6__+MAX_llx_menu__, 'facture|don|tax|salaries|loan|banque', '$conf->comptabilite->enabled || $conf->accounting->enabled || $conf->facture->enabled || $conf->don->enabled || $conf->tax->enabled || $conf->salaries->enabled || $conf->supplier_invoice->enabled || $conf->loan->enabled || $conf->banque->enabled', __HANDLER__, 'top', 'billing', '', 0, '/compta/index.php?mainmenu=billing&leftmenu=', 'MenuFinancial', -1, 'compta', '$user->rights->facture->lire|| $user->rights->don->lire || $user->rights->tax->charges->lire || $user->rights->salaries->read || $user->rights->loan->read || $user->rights->banque->lire', '', 2, 50, __ENTITY__); -insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('banque|prelevement', '$conf->banque->enabled || $conf->prelevement->enabled', 14__+MAX_llx_menu__, __HANDLER__, 'top', 'bank', '', 0, '/compta/bank/list.php?mainmenu=bank&leftmenu=bank', 'MenuBankCash', -1, 'banks', '$user->rights->banque->lire || $user->rights->prelevement->bons->lire', '', 0, 52, __ENTITY__); -insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('comptabilite|accounting|asset', '$conf->comptabilite->enabled || $conf->accounting->enabled || $conf->asset->enabled', 9__+MAX_llx_menu__, __HANDLER__, 'top', 'accountancy', '', 0, '/compta/index.php?mainmenu=accountancy&leftmenu=accountancy', 'MenuAccountancy', -1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->mouvements->lire || $user->rights->asset->read', '', 2, 54, __ENTITY__); -insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '', 8__+MAX_llx_menu__, __HANDLER__, 'top', 'tools', '', 0, '/core/tools.php?mainmenu=tools&leftmenu=', 'Tools', -1, 'other', '', '', 2, 90, __ENTITY__); -insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('adherent', '$conf->adherent->enabled', 13__+MAX_llx_menu__, __HANDLER__, 'top', 'members', '', 0, '/adherents/index.php?mainmenu=members&leftmenu=', 'Members', -1, 'members', '$user->rights->adherent->lire', '', 2, 19, __ENTITY__); -insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('hrm|holiday|deplacement|expensereport', '$conf->hrm->enabled || $conf->holiday->enabled || $conf->deplacement->enabled || $conf->expensereport->enabled', 15__+MAX_llx_menu__, __HANDLER__, 'top', 'hrm', '', 0, '/hrm/index.php?mainmenu=hrm&leftmenu=', 'HRM', -1, 'holiday', '$user->rights->user->user->lire || $user->rights->holiday->read || $user->rights->deplacement->lire || $user->rights->expensereport->lire', '', 0, 80, __ENTITY__); +insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 7__+MAX_llx_menu__, 'projet', '$conf->projet->enabled', __HANDLER__, 'top', 'project', '', 0, '/projet/index.php?mainmenu=project&leftmenu=', 'Projects', -1, 'projects', '$user->rights->projet->lire', '', 2, 32, __ENTITY__); +insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 5__+MAX_llx_menu__, 'propal|commande|fournisseur|supplier_order|supplier_invoice|contrat|ficheinter', '$conf->propal->enabled || $conf->commande->enabled || $conf->supplier_order->enabled || $conf->contrat->enabled || $conf->ficheinter->enabled', __HANDLER__, 'top', 'commercial', '', 0, '/comm/index.php?mainmenu=commercial&leftmenu=', 'Commercial', -1, 'commercial', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 40, __ENTITY__); +insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 6__+MAX_llx_menu__, 'facture|don|tax|salaries|loan|banque', '$conf->comptabilite->enabled || $conf->accounting->enabled || $conf->facture->enabled || $conf->don->enabled || $conf->tax->enabled || $conf->salaries->enabled || $conf->supplier_invoice->enabled || $conf->loan->enabled || $conf->banque->enabled', __HANDLER__, 'top', 'billing', '', 0, '/compta/index.php?mainmenu=billing&leftmenu=', 'MenuFinancial', -1, 'compta', '$user->rights->facture->lire|| $user->rights->don->lire || $user->rights->tax->charges->lire || $user->rights->salaries->read || $user->rights->loan->read || $user->rights->banque->lire', '', 2, 50, __ENTITY__); +insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 14__+MAX_llx_menu__, 'banque|prelevement', '$conf->banque->enabled || $conf->prelevement->enabled', __HANDLER__, 'top', 'bank', '', 0, '/compta/bank/list.php?mainmenu=bank&leftmenu=bank', 'MenuBankCash', -1, 'banks', '$user->rights->banque->lire || $user->rights->prelevement->bons->lire', '', 0, 52, __ENTITY__); +insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 9__+MAX_llx_menu__, 'comptabilite|accounting|asset', '$conf->comptabilite->enabled || $conf->accounting->enabled || $conf->asset->enabled', __HANDLER__, 'top', 'accountancy', '', 0, '/compta/index.php?mainmenu=accountancy&leftmenu=accountancy', 'MenuAccountancy', -1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->mouvements->lire || $user->rights->asset->read', '', 2, 54, __ENTITY__); +insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 8__+MAX_llx_menu__, '', '', __HANDLER__, 'top', 'tools', '', 0, '/core/tools.php?mainmenu=tools&leftmenu=', 'Tools', -1, 'other', '', '', 2, 90, __ENTITY__); +insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 13__+MAX_llx_menu__, 'adherent', '$conf->adherent->enabled', __HANDLER__, 'top', 'members', '', 0, '/adherents/index.php?mainmenu=members&leftmenu=', 'Members', -1, 'members', '$user->rights->adherent->lire', '', 2, 19, __ENTITY__); +insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 15__+MAX_llx_menu__, 'hrm|holiday|deplacement|expensereport', '$conf->hrm->enabled || $conf->holiday->enabled || $conf->deplacement->enabled || $conf->expensereport->enabled', __HANDLER__, 'top', 'hrm', '', 0, '/hrm/index.php?mainmenu=hrm&leftmenu=', 'HRM', -1, 'holiday', '$user->rights->user->user->lire || $user->rights->holiday->read || $user->rights->deplacement->lire || $user->rights->expensereport->lire', '', 0, 80, __ENTITY__); -- Sub-Menu From 993cb70a6fc12a838187796a321c9578b7fedc5c Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Sat, 12 Mar 2022 12:38:58 +0100 Subject: [PATCH 130/610] Update init_menu_auguria.sql --- htdocs/core/menus/init_menu_auguria.sql | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index 0fc9968b7a3..9a91aa58ac1 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -10,7 +10,7 @@ delete from llx_menu where menu_handler=__HANDLER__ and entity=__ENTITY__; -- -- Top-Menu --- old: (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) +-- old: (module, enabled, rowid, ...) insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 1__+MAX_llx_menu__, '', '1', __HANDLER__, 'top', 'home', '', 0, '/index.php?mainmenu=home&leftmenu=', 'Home', -1, '', '', '', 2, 10, __ENTITY__); insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 2__+MAX_llx_menu__, 'societe|fournisseur|supplier_order|supplier_invoice', '($conf->societe->enabled && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) || !empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || $conf->supplier_order->enabled || $conf->supplier_invoice->enabled))', __HANDLER__, 'top', 'companies', '', 0, '/societe/index.php?mainmenu=companies&leftmenu=', 'ThirdParties', -1, 'companies', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 20, __ENTITY__); insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 3__+MAX_llx_menu__, 'product|service', '$conf->product->enabled || $conf->service->enabled', __HANDLER__, 'top', 'products', '', 0, '/product/index.php?mainmenu=products&leftmenu=', 'ProductsPipeServices', -1, 'products', '$user->rights->produit->lire||$user->rights->service->lire', '', 0, 30, __ENTITY__); @@ -25,7 +25,7 @@ insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, left insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 15__+MAX_llx_menu__, 'hrm|holiday|deplacement|expensereport', '$conf->hrm->enabled || $conf->holiday->enabled || $conf->deplacement->enabled || $conf->expensereport->enabled', __HANDLER__, 'top', 'hrm', '', 0, '/hrm/index.php?mainmenu=hrm&leftmenu=', 'HRM', -1, 'holiday', '$user->rights->user->user->lire || $user->rights->holiday->read || $user->rights->deplacement->lire || $user->rights->expensereport->lire', '', 0, 80, __ENTITY__); --- Sub-Menu +-- Sub-Menues -- Home - Dashboard 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', 90__+MAX_llx_menu__, 'home', '', 1__+MAX_llx_menu__, '/index.php', 'MyDashboard', 0, '', '', '', 2, 0, __ENTITY__); @@ -257,7 +257,7 @@ 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 ('', '$conf->tax->enabled && $leftmenu=="tax_social"', __HANDLER__, 'left', 2251__+MAX_llx_menu__, 'billing', '', 2250__+MAX_llx_menu__, '/compta/sociales/card.php?mainmenu=billing&leftmenu=tax_social&action=create', 'MenuNewSocialContribution', 2, '', '$user->rights->tax->charges->creer', '', 0, 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 ('', '$conf->tax->enabled && $leftmenu=="tax_social"', __HANDLER__, 'left', 2252__+MAX_llx_menu__, 'billing', '', 2250__+MAX_llx_menu__, '/compta/sociales/payments.php?mainmenu=billing&leftmenu=tax_social', 'Payments', 2, '', '$user->rights->tax->charges->lire', '', 0, 3, __ENTITY__); --- VAT +-- VAT/TVA/IVA insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS)', __HANDLER__, 'left', 2300__+MAX_llx_menu__, 'billing', 'tax_vat', 2200__+MAX_llx_menu__, '/compta/tva/list.php?mainmenu=billing&leftmenu=tax_vat', 'VAT', 1, 'companies', '$user->rights->tax->charges->lire', '', 0, 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 ('', '$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS) && $leftmenu=="tax_vat"', __HANDLER__, 'left', 2301__+MAX_llx_menu__, 'billing', '', 2300__+MAX_llx_menu__, '/compta/tva/card.php?mainmenu=billing&leftmenu=tax_vat&action=create', 'New', 2, 'companies', '$user->rights->tax->charges->creer', '', 0, 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 ('', '$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS) && $leftmenu=="tax_vat"', __HANDLER__, 'left', 2302__+MAX_llx_menu__, 'billing', '', 2300__+MAX_llx_menu__, '/compta/tva/list.php?mainmenu=billing&leftmenu=tax_vat', 'List', 2, 'companies', '$user->rights->tax->charges->lire', '', 0, 1, __ENTITY__); @@ -418,21 +418,22 @@ 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 ('', '$conf->projet->enabled && !$conf->global->PROJECT_HIDE_TASKS', __HANDLER__, 'left', 3400__+MAX_llx_menu__, 'project', '', 7__+MAX_llx_menu__, '/projet/activity/perweek.php?mainmenu=project&leftmenu=projects', 'NewTimeSpent', 0, 'projects', '$user->rights->projet->lire', '', 2, 3, __ENTITY__); +-- Project - Categories +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->categorie->enabled', __HANDLER__, 'left', 3804__+MAX_llx_menu__, 'project', 'cat', 7__+MAX_llx_menu__, '/categories/index.php?mainmenu=project&leftmenu=cat&type=6', 'Categories', 0, 'categories', '$user->rights->categorie->lire', '', 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 ('', '$conf->categorie->enabled', __HANDLER__, 'left', 3805__+MAX_llx_menu__, 'project', '', 3804__+MAX_llx_menu__, '/categories/card.php?mainmenu=project&action=create&type=6', 'NewCategory', 1, 'categories', '$user->rights->categorie->creer', '', 2, 0, __ENTITY__); + + -- BOM insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->bom->enabled', __HANDLER__, 'left', 5400__+MAX_llx_menu__, 'mrp', 'bom', 16__+MAX_llx_menu__, '/bom/bom_list.php?mainmenu=mrp&leftmenu=bom', 'MenuBOM', 1, 'mrp', '$user->rights->bom->read', '', 0, 20, __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 ('', '$conf->bom->enabled', __HANDLER__, 'left', 5401__+MAX_llx_menu__, 'mrp', '', 5400__+MAX_llx_menu__, '/bom/bom_card.php?mainmenu=mrp&leftmenu=bom&action=create', 'NewBOM', 2, 'mrp', '$user->rights->bom->write', '', 0, 21, __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 ('', '$conf->bom->enabled', __HANDLER__, 'left', 5403__+MAX_llx_menu__, 'mrp', '', 5400__+MAX_llx_menu__, '/bom/bom_list.php?mainmenu=mrp&leftmenu=bom', 'List', 2, 'mrp', '$user->rights->bom->read', '', 0, 22, __ENTITY__); --- MRP +-- MRP/MO insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->bom->enabled', __HANDLER__, 'left', 5450__+MAX_llx_menu__, 'mrp', 'mrp', 16__+MAX_llx_menu__, '/mrp/mo_list.php?mainmenu=mrp&leftmenu=mrp', 'MenuMRP', 1, 'mrp', '$user->rights->mrp->read', '', 0, 20, __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 ('', '$conf->bom->enabled', __HANDLER__, 'left', 5451__+MAX_llx_menu__, 'mrp', '', 5450__+MAX_llx_menu__, '/mrp/mo_card.php?mainmenu=mrp&leftmenu=mrp&action=create', 'NewMO', 2, 'mrp', '$user->rights->mrp->write', '', 0, 21, __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 ('', '$conf->bom->enabled', __HANDLER__, 'left', 5453__+MAX_llx_menu__, 'mrp', '', 5450__+MAX_llx_menu__, '/mrp/mo_list.php?mainmenu=mrp&leftmenu=mrp', 'List', 2, 'mrp', '$user->rights->mrp->read', '', 0, 22, __ENTITY__); --- Project - Categories -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->categorie->enabled', __HANDLER__, 'left', 3804__+MAX_llx_menu__, 'project', 'cat', 7__+MAX_llx_menu__, '/categories/index.php?mainmenu=project&leftmenu=cat&type=6', 'Categories', 0, 'categories', '$user->rights->categorie->lire', '', 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 ('', '$conf->categorie->enabled', __HANDLER__, 'left', 3805__+MAX_llx_menu__, 'project', '', 3804__+MAX_llx_menu__, '/categories/card.php?mainmenu=project&action=create&type=6', 'NewCategory', 1, 'categories', '$user->rights->categorie->creer', '', 2, 0, __ENTITY__); - -- Tools insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'empty($user->socid)', __HANDLER__, 'left', 3900__+MAX_llx_menu__, 'tools', 'email_templates', 8__+MAX_llx_menu__, '/admin/mails_templates.php?mainmenu=tools&leftmenu=email_templates', 'EMailTemplates', 0, '', '', '', 0, 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 ('', '$conf->mailing->enabled', __HANDLER__, 'left', 3910__+MAX_llx_menu__, 'tools', 'mailing', 8__+MAX_llx_menu__, '/comm/mailing/index.php?mainmenu=tools&leftmenu=mailing', 'EMailings', 0, 'mails', '$user->rights->mailing->lire', '', 0, 0, __ENTITY__); @@ -456,6 +457,7 @@ 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 ('', '$conf->adherent->enabled', __HANDLER__, 'left', 4209__+MAX_llx_menu__, 'members', '', 4200__+MAX_llx_menu__, '/adherents/stats/geo.php?mainmenu=members&leftmenu=members&mode=memberbycountry', 'MenuMembersStats', 1, 'members', '$user->rights->adherent->lire', '', 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 ('', '! empty($conf->global->MEMBER_LINK_TO_HTPASSWDFILE) && $conf->adherent->enabled', __HANDLER__, 'left', 4502__+MAX_llx_menu__, 'members', '', 4200__+MAX_llx_menu__, '/adherents/htpasswd.php?mainmenu=members&leftmenu=export', 'Filehtpasswd', 1, 'members', '$user->rights->adherent->export', '', 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 ('', '$conf->adherent->enabled', __HANDLER__, 'left', 4503__+MAX_llx_menu__, 'members', '', 4200__+MAX_llx_menu__, '/adherents/cartes/carte.php?mainmenu=members&leftmenu=export', 'MembersCards', 1, 'members', '$user->rights->adherent->export', '', 2, 10, __ENTITY__); + -- Members - Subscriptions insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled', __HANDLER__, 'left', 4300__+MAX_llx_menu__, 'members', '', 13__+MAX_llx_menu__, '/adherents/index.php?mainmenu=members&leftmenu=members', 'Subscriptions', 0, 'compta', '$user->rights->adherent->cotisation->lire', '', 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 ('', '$conf->adherent->enabled', __HANDLER__, 'left', 4301__+MAX_llx_menu__, 'members', '', 4300__+MAX_llx_menu__, '/adherents/list.php?mainmenu=members&statut=-1&leftmenu=accountancy', 'NewSubscription', 1, 'compta', '$user->rights->adherent->cotisation->creer', '', 2, 0, __ENTITY__); @@ -464,14 +466,17 @@ 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 ('', '$conf->adherent->enabled', __HANDLER__, 'left', 4700__+MAX_llx_menu__, 'members', 'setup', 13__+MAX_llx_menu__, '/adherents/type.php?mainmenu=members&leftmenu=setup', 'MembersTypes', 0, 'members', '$user->rights->adherent->configurer', '', 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 ('', '$conf->adherent->enabled', __HANDLER__, 'left', 4701__+MAX_llx_menu__, 'members', '', 4700__+MAX_llx_menu__, '/adherents/type.php?mainmenu=members&leftmenu=setup&action=create', 'New', 1, 'members', '$user->rights->adherent->configurer', '', 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 ('', '$conf->adherent->enabled', __HANDLER__, 'left', 4702__+MAX_llx_menu__, 'members', '', 4700__+MAX_llx_menu__, '/adherents/type.php?mainmenu=members&leftmenu=setup', 'List', 1, 'members', '$user->rights->adherent->configurer', '', 2, 1, __ENTITY__); + -- Members - Category member insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled && $conf->categorie->enabled', __HANDLER__, 'left', 5200__+MAX_llx_menu__, 'members', 'cat', 13__+MAX_llx_menu__, '/categories/index.php?mainmenu=members&leftmenu=cat&type=3', 'MembersCategoriesShort', 0, 'categories', '$user->rights->categorie->lire', '', 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 ('', '$conf->adherent->enabled && $conf->categorie->enabled', __HANDLER__, 'left', 5201__+MAX_llx_menu__, 'members', '', 5200__+MAX_llx_menu__, '/categories/card.php?mainmenu=members&action=create&type=3', 'NewCategory', 1, 'categories', '$user->rights->categorie->creer', '', 2, 0, __ENTITY__); + -- HRM - Employee insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->hrm->enabled', __HANDLER__, 'left', 4600__+MAX_llx_menu__, 'hrm', 'hrm', 15__+MAX_llx_menu__, '/user/list.php?mainmenu=hrm&leftmenu=hrm&mode=employee', 'Employees', 0, 'hrm', '$user->rights->user->user->lire', '', 0, 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 ('', '$conf->hrm->enabled', __HANDLER__, 'left', 4601__+MAX_llx_menu__, 'hrm', '', 4600__+MAX_llx_menu__, '/user/card.php?mainmenu=hrm&action=create&employee=1', 'NewEmployee', 1, 'hrm', '$user->rights->user->user->creer', '', 0, 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 ('', '$conf->hrm->enabled', __HANDLER__, 'left', 4602__+MAX_llx_menu__, 'hrm', '', 4600__+MAX_llx_menu__, '/user/list.php?mainmenu=hrm&leftmenu=hrm&mode=employee&contextpage=employeelist', 'List', 1, 'hrm', '$user->rights->user->user->lire', '', 0, 2, __ENTITY__); + -- HRM - Holiday insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5000__+MAX_llx_menu__, 'hrm', 'hrm', 15__+MAX_llx_menu__, '/holiday/list.php?mainmenu=hrm&leftmenu=hrm', 'CPTitreMenu', 0, 'holiday', '$user->rights->holiday->read', '', 0, 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 ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5001__+MAX_llx_menu__, 'hrm', '', 5000__+MAX_llx_menu__, '/holiday/card.php?mainmenu=hrm&action=create', 'MenuAddCP', 1, 'holiday', '$user->rights->holiday->write', '', 0, 1, __ENTITY__); @@ -479,11 +484,13 @@ 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 ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5003__+MAX_llx_menu__, 'hrm', '', 5002__+MAX_llx_menu__, '/holiday/list.php?mainmenu=hrm&search_statut=2&leftmenu=hrm', 'ListToApprove', 2, 'trips', '$user->rights->holiday->read', '', 0, 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 ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5004__+MAX_llx_menu__, 'hrm', '', 5000__+MAX_llx_menu__, '/holiday/define_holiday.php?mainmenu=hrm&action=request', 'MenuConfCP', 1, 'holiday', '$user->rights->holiday->define_holiday', '', 0, 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 ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5005__+MAX_llx_menu__, 'hrm', '', 5000__+MAX_llx_menu__, '/holiday/view_log.php?mainmenu=hrm&action=request', 'MenuLogCP', 1, 'holiday', '$user->rights->holiday->define_holiday', '', 0, 3, __ENTITY__); + -- HRM - Trips and expenses (old module) insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->deplacement->enabled', __HANDLER__, 'left', 2100__+MAX_llx_menu__, 'accountancy', 'tripsandexpenses', 15__+MAX_llx_menu__, '/compta/deplacement/index.php?mainmenu=accountancy&leftmenu=tripsandexpenses', 'TripsAndExpenses', 0, 'trips', '$user->rights->deplacement->lire', '', 0, 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 ('', '$conf->deplacement->enabled', __HANDLER__, 'left', 2101__+MAX_llx_menu__, 'accountancy', '', 2100__+MAX_llx_menu__, '/compta/deplacement/card.php?mainmenu=accountancy&action=create&leftmenu=tripsandexpenses', 'New', 1, 'trips', '$user->rights->deplacement->creer', '', 0, 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 ('', '$conf->deplacement->enabled', __HANDLER__, 'left', 2102__+MAX_llx_menu__, 'accountancy', '', 2100__+MAX_llx_menu__, '/compta/deplacement/list.php?mainmenu=accountancy&leftmenu=tripsandexpenses', 'List', 1, 'trips', '$user->rights->deplacement->lire', '', 0, 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 ('', '$conf->deplacement->enabled', __HANDLER__, 'left', 2103__+MAX_llx_menu__, 'accountancy', '', 2100__+MAX_llx_menu__, '/compta/deplacement/stats/index.php?mainmenu=accountancy&leftmenu=tripsandexpenses', 'Statistics', 1, 'trips', '$user->rights->deplacement->lire', '', 0, 2, __ENTITY__); + -- HRM - Expense reports insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->expensereport->enabled', __HANDLER__, 'left', 5300__+MAX_llx_menu__, 'hrm', 'expensereport', 15__+MAX_llx_menu__, '/expensereport/index.php?mainmenu=hrm&leftmenu=expensereport', 'TripsAndExpenses', 0, 'trips', '$user->rights->expensereport->lire', '', 0, 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 ('', '$conf->expensereport->enabled', __HANDLER__, 'left', 5301__+MAX_llx_menu__, 'hrm', '', 5300__+MAX_llx_menu__, '/expensereport/card.php?mainmenu=hrm&action=create&leftmenu=expensereport', 'New', 1, 'trips', '$user->rights->expensereport->creer', '', 0, 1, __ENTITY__); From d36d962d36cb623b841d1155089990f2ee0a8c80 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Sat, 12 Mar 2022 14:49:54 +0100 Subject: [PATCH 131/610] Update step2.php some english translations at //comments --- htdocs/install/step2.php | 55 +++++++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 23 deletions(-) diff --git a/htdocs/install/step2.php b/htdocs/install/step2.php index 45b7d742f3e..06fb7949397 100644 --- a/htdocs/install/step2.php +++ b/htdocs/install/step2.php @@ -34,12 +34,13 @@ $step = 2; $ok = 0; -// Cette page peut etre longue. On augmente le delai autorise. -// Ne fonctionne que si on est pas en safe_mode. +// This page can be long. We increase the time allowed. / Cette page peut etre longue. On augmente le delai autorise. +// Only works if you are not in safe_mode. / Ne fonctionne que si on est pas en safe_mode. + $err = error_reporting(); -error_reporting(0); // Disable all errors +error_reporting(0); // Disable all errors //error_reporting(E_ALL); -@set_time_limit(1800); // Need 1800 on some very slow OS like Windows 7/64 +@set_time_limit(1800); // Need 1800 on some very slow OS like Windows 7/64 error_reporting($err); $action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : (empty($argv[1]) ? '' : $argv[1]); @@ -48,6 +49,9 @@ $langs->setDefaultLang($setuplang); $langs->loadLangs(array("admin", "install")); + +// Choice of DBMS + $choix = 0; if ($dolibarr_main_db_type == "mysqli") { $choix = 1; @@ -64,10 +68,11 @@ if ($dolibarr_main_db_type == "sqlite") { if ($dolibarr_main_db_type == "sqlite3") { $choix = 5; } - //if (empty($choix)) dol_print_error('','Database type '.$dolibarr_main_db_type.' not supported into step2.php page'); + // Now we load forced values from install.forced.php file. + $useforcedwizard = false; $forcedfile = "./install.forced.php"; if ($conffile == "/etc/dolibarr/conf.php") { @@ -124,8 +129,8 @@ if ($action == "set") { } } - - // Affiche version + + // Display version / Affiche version if ($ok) { $version = $db->getVersion(); $versionarray = $db->getVersionArray(); @@ -154,7 +159,7 @@ if ($action == "set") { /************************************************************************************** * - * Load files tables/*.sql (not the *.key.sql). Files with '-xxx' in name are excluded (they will be loaded during activation o fmodule 'xxx'). + * Load files tables/*.sql (not the *.key.sql). Files with '-xxx' in name are excluded (they will be loaded during activation of module 'xxx'). * To do before the files *.key.sql * ***************************************************************************************/ @@ -208,18 +213,18 @@ if ($action == "set") { $buffer = preg_replace('/llx_/i', $dolibarr_main_db_prefix, $buffer); } - //print ""; + // print ""; $db->free($resql); } else { if ($db->errno() == 'DB_ERROR_TABLE_ALREADY_EXISTS' || - $db->errno() == 'DB_ERROR_TABLE_OR_KEY_ALREADY_EXISTS') { - //print ""; + $db->errno() == 'DB_ERROR_TABLE_OR_KEY_ALREADY_EXISTS') { + //print ""; } else { print ""; + //print ""; $buffer = ''; $fp = fopen($dir.$file, "r"); if ($fp) { @@ -287,6 +292,7 @@ if ($action == "set") { $buf = fgets($fp, 4096); // Special case of lines allowed for some version only + // MySQL if ($choix == 1 && preg_match('/^--\sV([0-9\.]+)/i', $buf, $reg)) { $versioncommande = explode('.', $reg[1]); //print var_dump($versioncommande); @@ -298,6 +304,7 @@ if ($action == "set") { //print "Ligne $i qualifiee par version: ".$buf.'
'; } } + // PGSQL if ($choix == 2 && preg_match('/^--\sPOSTGRESQL\sV([0-9\.]+)/i', $buf, $reg)) { $versioncommande = explode('.', $reg[1]); //print var_dump($versioncommande); @@ -310,14 +317,14 @@ if ($action == "set") { } } - // Ajout ligne si non commentaire + // Add line if no comment if (!preg_match('/^--/i', $buf)) { $buffer .= $buf; } } fclose($fp); - // Si plusieurs requetes, on boucle sur chaque + // If several requests, we loop on each $listesql = explode(';', $buffer); foreach ($listesql as $req) { $buffer = trim($req); @@ -327,13 +334,13 @@ if ($action == "set") { $buffer = preg_replace('/llx_/i', $dolibarr_main_db_prefix, $buffer); } - //print ""; + //print ""; $requestnb++; dolibarr_install_syslog("step2: request: ".$buffer); $resql = $db->query($buffer, 0, 'dml'); if ($resql) { - //print ""; + //print ""; $db->free($resql); } else { if ($db->errno() == 'DB_ERROR_KEY_NAME_ALREADY_EXISTS' || @@ -372,7 +379,7 @@ if ($action == "set") { /*************************************************************************************** * - * Lod the file 'functions.sql' + * Load the file 'functions.sql' * ***************************************************************************************/ if ($ok && $createfunctions) { @@ -387,7 +394,7 @@ if ($action == "set") { $dir = "sqlite3/functions/"; } - // Creation donnees + // Creation of data $file = "functions.sql"; if (file_exists($dir.$file)) { $fp = fopen($dir.$file, "r"); @@ -449,7 +456,7 @@ if ($action == "set") { /*************************************************************************************** * - * Load files data/*.sql. Files with '-xxx' in name are excluded (they will be loaded during activation o fmodule 'xxx'). + * Load files data/*.sql. Files with '-xxx' in name are excluded (they will be loaded during activation of module 'xxx'). * ***************************************************************************************/ if ($ok && $createdata) { @@ -465,7 +472,7 @@ if ($action == "set") { while (($file = readdir($handle)) !== false) { if (preg_match('/\.sql$/i', $file) && preg_match('/^llx_/i', $file) && !preg_match('/\-/', $file)) { if (preg_match('/^llx_accounting_account_/', $file)) { - continue; // We discard data file of chart of account. Will be loaded when a chart is selected. + continue; // We discard data file of chart of account. This will be loaded when a chart is selected. } //print 'x'.$file.'-'.$createdata.'
'; @@ -520,7 +527,7 @@ if ($action == "set") { // We loop on each requests of file foreach ($arrayofrequests as $buffer) { - // Replace the prefix tables + // Replace the tables prefixes if ($dolibarr_main_db_prefix != 'llx_') { $buffer = preg_replace('/llx_/i', $dolibarr_main_db_prefix, $buffer); } @@ -570,8 +577,10 @@ dolibarr_install_syslog("Exit ".$ret); dolibarr_install_syslog("- step2: end"); + // Force here a value we need after because master.inc.php is not loaded into step2. // This code must be similar with the one into main.inc.php + $conf->file->instance_unique_id = (empty($dolibarr_main_instance_unique_id) ? (empty($dolibarr_main_cookie_cryptkey) ? '' : $dolibarr_main_cookie_cryptkey) : $dolibarr_main_instance_unique_id); // Unique id of instance $hash_unique_id = md5('dolibarr'.$conf->file->instance_unique_id); From 277142dcab448facff9dfe2b9482e8bfe7143530 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Sat, 12 Mar 2022 13:53:15 +0000 Subject: [PATCH 132/610] Fixing style errors. --- htdocs/install/step2.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/install/step2.php b/htdocs/install/step2.php index 06fb7949397..33e69377904 100644 --- a/htdocs/install/step2.php +++ b/htdocs/install/step2.php @@ -50,7 +50,7 @@ $langs->setDefaultLang($setuplang); $langs->loadLangs(array("admin", "install")); -// Choice of DBMS +// Choice of DBMS $choix = 0; if ($dolibarr_main_db_type == "mysqli") { @@ -129,7 +129,7 @@ if ($action == "set") { } } - + // Display version / Affiche version if ($ok) { $version = $db->getVersion(); @@ -223,7 +223,7 @@ if ($action == "set") { $db->free($resql); } else { if ($db->errno() == 'DB_ERROR_TABLE_ALREADY_EXISTS' || - $db->errno() == 'DB_ERROR_TABLE_OR_KEY_ALREADY_EXISTS') { + $db->errno() == 'DB_ERROR_TABLE_OR_KEY_ALREADY_EXISTS') { //print ""; } else { print "'; print '\n"; + + + + $filename = dol_sanitizeFileName($objp->ref); + $filedir = $conf->order->multidir_output[$conf->entity].'/'.dol_sanitizeFileName($objp->ref); + $urlsource = '/dolibarr/commande/card.php?id='.$objp->cid; + + print $formfile->getDocumentsLink($commande_static->element, $filename, $filedir); + print ''; + + print '\n"; print ''; print ''; $i++; @@ -1211,8 +1223,20 @@ if ($object->id > 0) { print ''; print ''; + + // Other picto tool + print ''; + + if ($objp->frequency && $objp->date_last_gen > 0) { print ''; } else { From 7d000e4c9f4e64976d2f7abc5fec844937d8c58e Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Sat, 12 Mar 2022 15:57:03 +0100 Subject: [PATCH 134/610] Update llx_adherent.sql --- htdocs/install/mysql/tables/llx_adherent.sql | 26 ++++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/htdocs/install/mysql/tables/llx_adherent.sql b/htdocs/install/mysql/tables/llx_adherent.sql index bd74c33c688..eabb2d3c478 100644 --- a/htdocs/install/mysql/tables/llx_adherent.sql +++ b/htdocs/install/mysql/tables/llx_adherent.sql @@ -20,9 +20,9 @@ -- =================================================================== -- -- statut --- -1 : brouillon --- 0 : resilie --- 1 : valide +-- -1 : draft / brouillon +-- 0 : canceled / resilie +-- 1 : valid / valide create table llx_adherent ( @@ -39,7 +39,7 @@ create table llx_adherent pass varchar(50), -- password pass_crypted varchar(128), fk_adherent_type integer NOT NULL, - morphy varchar(3) NOT NULL, -- personne morale / personne physique + morphy varchar(3) NOT NULL, -- EN: legal entity / natural person FR: personne morale / personne physique societe varchar(128), -- company name (should be same length than societe.name). No more used. fk_soc integer NULL, -- Link to third party linked to member address text, @@ -64,20 +64,20 @@ create table llx_adherent phone varchar(30), phone_perso varchar(30), phone_mobile varchar(30), - birth date, -- birthday - photo varchar(255), -- filename or url of photo + birth date, -- birthday + photo varchar(255), -- filename or url of photo statut smallint NOT NULL DEFAULT 0, - public smallint NOT NULL DEFAULT 0, -- certain champ de la fiche sont ils public ou pas ? - datefin datetime, -- date de fin de validite de la cotisation + public smallint NOT NULL DEFAULT 0, -- certain champ de la fiche sont ils public ou pas ? + datefin datetime, -- end date of validity of the contribution / date de fin de validite de la cotisation note_private text DEFAULT NULL, note_public text DEFAULT NULL, model_pdf varchar(255), - datevalid datetime, -- date de validation - datec datetime, -- date de creation + datevalid datetime, -- date of validation + datec datetime, -- date of creation tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- last modification date - fk_user_author integer, -- can be null because member can be create by a guest + fk_user_author integer, -- can be null because member can be create by a guest fk_user_mod integer, fk_user_valid integer, - canvas varchar(32), -- type of canvas if used (null by default) - import_key varchar(14) -- Import key + canvas varchar(32), -- type of canvas if used (null by default) + import_key varchar(14) -- Import key )ENGINE=innodb; From db799d79133e5bab6fb1a67e4492bcde34707e0b Mon Sep 17 00:00:00 2001 From: BB2A Anthony Berton Date: Sat, 12 Mar 2022 16:00:22 +0100 Subject: [PATCH 135/610] comm card propal preview --- htdocs/comm/card.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 07743b21709..0993f0c78ab 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -861,6 +861,13 @@ if ($object->id > 0) { $propal_static->total_tva = $objp->total_tva; $propal_static->total_ttc = $objp->total_ttc; print $propal_static->getNomUrl(1); + + $filename = dol_sanitizeFileName($objp->ref); + $filedir = $conf->propal->multidir_output[$conf->entity].'/'.dol_sanitizeFileName($objp->ref); + $urlsource = '/comm/propal/card.php?id='.$objp->cid; + + print $formfile->getDocumentsLink($propal_static->element, $filename, $filedir); + if (($db->jdate($objp->date_limit) < ($now - $conf->propal->cloture->warning_delay)) && $objp->fk_statut == $propal_static::STATUS_VALIDATED) { print " ".img_warning(); } @@ -943,11 +950,9 @@ if ($object->id > 0) { print ''; From 961636ea35b64fbe34befec338b413b86376e968 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 12 Mar 2022 16:04:00 +0100 Subject: [PATCH 136/610] CSS --- htdocs/compta/facture/card.php | 8 +++++--- .../compta/facture/tpl/linkedobjectblock.tpl.php | 2 +- .../facture/tpl/linkedobjectblockForRec.tpl.php | 2 +- htdocs/theme/eldy/global.inc.php | 15 +++++++++++++++ 4 files changed, 22 insertions(+), 5 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 3ee76f1ec8c..a6aa30504e6 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -4805,6 +4805,7 @@ if ($action == 'create') { // List of previous situation invoices if (($object->situation_cycle_ref > 0) && !empty($conf->global->INVOICE_USE_SITUATION)) { + print ''; print '
'.$langs->trans("DateOfBirth").''.dol_print_date($object->birth, 'day').'
'.$langs->trans("Public").''.yn($object->public).'
'.$langs->trans("Categories").''; @@ -580,6 +576,12 @@ if ($rowid > 0) { print '
'.$langs->trans("DateOfBirth").''.dol_print_date($object->birth, 'day').'
'.$langs->trans("Public").''.yn($object->public).'
'.$langs->trans("UseAboutPage").''; + print ''; if ($conf->use_javascript_ajax) { print ajax_constantonoff('MODULEBUILDER_USE_ABOUT'); } else { diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index be0d83a50a6..872a88b28aa 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -3103,14 +3103,14 @@ if ($module == 'initmodule') { print '
'; + print ''; print dol_escape_htmltag($menu['position']); print ''; + print ''; print dol_escape_htmltag($menu['enabled']); print ''; + print ''; print dol_escape_htmltag($menu['perms']); print '
Creation de la table $name/td>"; + //print "
Creation of table $name/td>"; $requestnb++; dolibarr_install_syslog("step2: request: ".$buffer); $resql = $db->query($buffer, 0, 'dml'); if ($resql) { - // print "OK requete ==== $buffer
OK request ==== $buffer
Deja existante
already existing
".$langs->trans("CreateTableAndPrimaryKey", $name); print "
\n".$langs->trans("Request").' '.$requestnb.' : '.$buffer.'
Executed query : '.$db->lastquery; @@ -252,7 +257,7 @@ if ($action == "set") { /*************************************************************************************** * - * Load files tables/*.key.sql. Files with '-xxx' in name are excluded (they will be loaded during activation o fmodule 'xxx'). + * Load files tables/*.key.sql. Files with '-xxx' in name are excluded (they will be loaded during activation of module 'xxx'). * To do after the files *.sql * ***************************************************************************************/ @@ -279,7 +284,7 @@ if ($action == "set") { sort($tabledata); foreach ($tabledata as $file) { $name = substr($file, 0, dol_strlen($file) - 4); - //print "
Creation de la table $name
Creation of table $name
Creation des cles et index de la table $name: '$buffer'
Creation of keys and table index $name: '$buffer'OK requete ==== $buffer
OK request ==== $buffer
already existing
".$langs->trans("CreateTableAndPrimaryKey", $name); @@ -292,7 +292,7 @@ if ($action == "set") { $buf = fgets($fp, 4096); // Special case of lines allowed for some version only - // MySQL + // MySQL if ($choix == 1 && preg_match('/^--\sV([0-9\.]+)/i', $buf, $reg)) { $versioncommande = explode('.', $reg[1]); //print var_dump($versioncommande); @@ -324,7 +324,7 @@ if ($action == "set") { } fclose($fp); - // If several requests, we loop on each + // If several requests, we loop on each $listesql = explode(';', $buffer); foreach ($listesql as $req) { $buffer = trim($req); From f3f1c9ba788f1ac427cf1d5910b96f645cb259ce Mon Sep 17 00:00:00 2001 From: BB2A Anthony Berton Date: Sat, 12 Mar 2022 15:54:25 +0100 Subject: [PATCH 133/610] comm card order --- htdocs/comm/card.php | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index eabcb1a55bf..07743b21709 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -38,6 +38,7 @@ require_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; if (!empty($conf->facture->enabled)) { require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; } @@ -112,6 +113,7 @@ $cancel = GETPOST('cancel', 'alpha'); $object = new Client($db); $extrafields = new ExtraFields($db); +$formfile = new FormFile($db); // fetch optionals attributes and labels $extrafields->fetch_name_optionals_label($object->table_element); @@ -940,7 +942,17 @@ if ($object->id > 0) { print '
'; print $commande_static->getNomUrl(1); - print ''.dol_print_date($db->jdate($objp->dc), 'day')."'.dol_print_date($db->jdate($objp->dc), 'day')."'.price($objp->total_ht).''.$commande_static->LibStatut($objp->fk_statut, $objp->facture, 5).'
'; + + print $invoicetemplate->getNomUrl(1); print ''; + $filename = dol_sanitizeFileName($invoicetemplate->ref); + $filedir = $conf->propal->multidir_output[$invoicetemplate->propal_entity].'/'.dol_sanitizeFileName($invoicetemplate->ref); + $urlsource = $_SERVER['PHP_SELF'].'?id='.$invoicetemplate->rowid; + print $formfile->getDocumentsLink($invoicetemplate->element, $filename, $filedir); + print ''.dol_print_date($db->jdate($objp->date_last_gen), 'day').''; print $commande_static->getNomUrl(1); - - $filename = dol_sanitizeFileName($objp->ref); $filedir = $conf->order->multidir_output[$conf->entity].'/'.dol_sanitizeFileName($objp->ref); - $urlsource = '/dolibarr/commande/card.php?id='.$objp->cid; + $urlsource = '/commande/card.php?id='.$objp->cid; print $formfile->getDocumentsLink($commande_static->element, $filename, $filedir); print '
'; print ''; @@ -4943,15 +4944,16 @@ if ($action == 'create') { // List of payments already done + print ''; print '
'; print '
'; print ''; print ''; - print ''; - print ''; + print ''; + print ''; if (!empty($conf->banque->enabled)) { - print ''; + print ''; } print ''; print ''; diff --git a/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php b/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php index 0b22e31be4b..de7be8a81b3 100644 --- a/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php +++ b/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php @@ -45,7 +45,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) { $trclass .= ' liste_sub_total'; } print ''; - print ' - + diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 123d24f54f3..0a1000cce05 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -7397,6 +7397,21 @@ div.clipboardCPValue.hidewithsize { .a-mesure, .a-mesure-disabled { text-align: center; } + + + div.fichehalfright { + margin-top: 30px; + } + + .valuefield.fieldname_type span.badgeneutral { + margin-top: 5px; + display: inline-block; + } + + tr.trextrafieldseparator td, tr.trextrafields_collapse_last td { + /* border-bottom: 2px solid var(--colorbackhmenu1) !important; */ + border-bottom: 1px solid var(--colortopbordertitle1) !important; + } } @media only screen and (max-width: 320px) From 19b8d418e24f11948b603537bc78f4a204eeeb8b Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Sat, 12 Mar 2022 16:18:09 +0100 Subject: [PATCH 137/610] Update 15.0.0-16.0.0.sql --- .../install/mysql/migration/15.0.0-16.0.0.sql | 94 +++++++++---------- 1 file changed, 47 insertions(+), 47 deletions(-) diff --git a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql index 3f313c180eb..ea0e742559d 100644 --- a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql +++ b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql @@ -32,7 +32,10 @@ -- Missing in v15 or lower +ALTER TABLE llx_c_actioncomm MODIFY COLUMN libelle varchar(128); ALTER TABLE llx_c_availability MODIFY COLUMN label varchar(128); +ALTER TABLE llx_c_barcode_type MODIFY COLUMN libelle varchar(128); +ALTER TABLE llx_c_chargesociales MODIFY COLUMN libelle varchar(128); ALTER TABLE llx_c_civility MODIFY COLUMN label varchar(128); ALTER TABLE llx_c_country MODIFY COLUMN label varchar(128); ALTER TABLE llx_c_currencies MODIFY COLUMN label varchar(128); @@ -40,8 +43,10 @@ ALTER TABLE llx_c_effectif MODIFY COLUMN libelle varchar(128); ALTER TABLE llx_c_exp_tax_cat MODIFY COLUMN label varchar(128); ALTER TABLE llx_c_hrm_department MODIFY COLUMN label varchar(128); ALTER TABLE llx_c_hrm_function MODIFY COLUMN label varchar(128); +ALTER TABLE llx_c_input_method MODIFY COLUMN libelle varchar(128); ALTER TABLE llx_c_input_reason MODIFY COLUMN label varchar(128); ALTER TABLE llx_c_lead_status MODIFY COLUMN label varchar(128); +ALTER TABLE llx_c_paiement MODIFY COLUMN libelle varchar(128); ALTER TABLE llx_c_paper_format MODIFY COLUMN label varchar(128); ALTER TABLE llx_c_partnership_type MODIFY COLUMN label varchar(128); ALTER TABLE llx_c_product_nature MODIFY COLUMN label varchar(128); @@ -50,25 +55,21 @@ ALTER TABLE llx_c_propalst MODIFY COLUMN label varchar(128); ALTER TABLE llx_c_prospectcontactlevel MODIFY COLUMN label varchar(128); ALTER TABLE llx_c_prospectlevel MODIFY COLUMN label varchar(128); ALTER TABLE llx_c_recruitment_origin MODIFY COLUMN label varchar(128); -ALTER TABLE llx_c_shipment_package_type MODIFY COLUMN label varchar(128); -ALTER TABLE llx_c_type_container MODIFY COLUMN label varchar(128); -ALTER TABLE llx_c_type_fees MODIFY COLUMN label varchar(128); -ALTER TABLE llx_c_type_resource MODIFY COLUMN label varchar(128); -ALTER TABLE llx_c_units MODIFY COLUMN label varchar(128); -ALTER TABLE llx_c_actioncomm MODIFY COLUMN libelle varchar(128); -ALTER TABLE llx_c_barcode_type MODIFY COLUMN libelle varchar(128); -ALTER TABLE llx_c_chargesociales MODIFY COLUMN libelle varchar(128); -ALTER TABLE llx_c_input_method MODIFY COLUMN libelle varchar(128); -ALTER TABLE llx_c_paiement MODIFY COLUMN libelle varchar(128); ALTER TABLE llx_c_shipment_mode MODIFY COLUMN libelle varchar(128); +ALTER TABLE llx_c_shipment_package_type MODIFY COLUMN label varchar(128); ALTER TABLE llx_c_stcomm MODIFY COLUMN libelle varchar(128); ALTER TABLE llx_c_stcommcontact MODIFY COLUMN libelle varchar(128); ALTER TABLE llx_c_type_contact MODIFY COLUMN libelle varchar(128); +ALTER TABLE llx_c_type_container MODIFY COLUMN label varchar(128); +ALTER TABLE llx_c_type_fees MODIFY COLUMN label varchar(128); +ALTER TABLE llx_c_type_resource MODIFY COLUMN label varchar(128); ALTER TABLE llx_c_typent MODIFY COLUMN libelle varchar(128); +ALTER TABLE llx_c_units MODIFY COLUMN label varchar(128); + UPDATE llx_rights_def SET perms = 'writeall' WHERE perms = 'writeall_advance' AND module = 'holiday'; - +-- Insert company legal forms of Mexico INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15401', '601 - General de Ley Personas Morales', 1); INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15402', '603 - Personas Morales con Fines no Lucrativos', 1); INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15403', '605 - Sueldos y Salarios e Ingresos Asimilados a Salarios', 1); @@ -188,40 +189,40 @@ ALTER TABLE llx_facture_fourn_rec_extrafields ADD INDEX idx_facture_fourn_rec_ex CREATE TABLE llx_facture_fourn_det_rec ( - rowid integer AUTO_INCREMENT PRIMARY KEY, - fk_facture_fourn integer NOT NULL, - fk_parent_line integer NULL, - fk_product integer NULL, - ref varchar(50), - label varchar(255) DEFAULT NULL, - description text, - pu_ht double(24,8), - pu_ttc double(24,8), - qty real, - remise_percent real DEFAULT 0, - fk_remise_except integer NULL, - vat_src_code varchar(10) DEFAULT '', - tva_tx double(7,4), - localtax1_tx double(7,4) DEFAULT 0, - localtax1_type varchar(10) NULL, - localtax2_tx double(7,4) DEFAULT 0, - localtax2_type varchar(10) NULL, - total_ht double(24,8), - total_tva double(24,8), - total_localtax1 double(24,8) DEFAULT 0, - total_localtax2 double(24,8) DEFAULT 0, - total_ttc double(24,8), - product_type integer DEFAULT 0, - date_start integer DEFAULT NULL, - date_end integer DEFAULT NULL, - info_bits integer DEFAULT 0, - special_code integer UNSIGNED DEFAULT 0, - rang integer DEFAULT 0, - fk_unit integer DEFAULT NULL, - import_key varchar(14), - fk_user_author integer, - fk_user_modif integer, - fk_multicurrency integer, + rowid integer AUTO_INCREMENT PRIMARY KEY, + fk_facture_fourn integer NOT NULL, + fk_parent_line integer NULL, + fk_product integer NULL, + ref varchar(50), + label varchar(255) DEFAULT NULL, + description text, + pu_ht double(24,8), + pu_ttc double(24,8), + qty real, + remise_percent real DEFAULT 0, + fk_remise_except integer NULL, + vat_src_code varchar(10) DEFAULT '', + tva_tx double(7,4), + localtax1_tx double(7,4) DEFAULT 0, + localtax1_type varchar(10) NULL, + localtax2_tx double(7,4) DEFAULT 0, + localtax2_type varchar(10) NULL, + total_ht double(24,8), + total_tva double(24,8), + total_localtax1 double(24,8) DEFAULT 0, + total_localtax2 double(24,8) DEFAULT 0, + total_ttc double(24,8), + product_type integer DEFAULT 0, + date_start integer DEFAULT NULL, + date_end integer DEFAULT NULL, + info_bits integer DEFAULT 0, + special_code integer UNSIGNED DEFAULT 0, + rang integer DEFAULT 0, + fk_unit integer DEFAULT NULL, + import_key varchar(14), + fk_user_author integer, + fk_user_modif integer, + fk_multicurrency integer, multicurrency_code varchar(3), multicurrency_subprice double(24,8) DEFAULT 0, multicurrency_total_ht double(24,8) DEFAULT 0, @@ -252,7 +253,6 @@ ALTER TABLE llx_product_attribute_value MODIFY COLUMN value VARCHAR(255) NOT NUL ALTER TABLE llx_product_attribute_value ADD COLUMN position INTEGER NOT NULL DEFAULT 0; ALTER TABLE llx_product_attribute CHANGE rang position INTEGER DEFAULT 0 NOT NULL; - ALTER TABLE llx_advtargetemailing RENAME TO llx_mailing_advtarget; ALTER TABLE llx_mailing ADD UNIQUE uk_mailing(titre, entity); @@ -264,8 +264,8 @@ create table llx_inventory_extrafields fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; -ALTER TABLE llx_inventory_extrafields ADD INDEX idx_inventory_extrafields (fk_object); +ALTER TABLE llx_inventory_extrafields ADD INDEX idx_inventory_extrafields (fk_object); ALTER TABLE llx_reception MODIFY COLUMN ref_supplier varchar(128); From f808756c3e1aa8a4ff5668de76c998f8b4682bb5 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Sat, 12 Mar 2022 16:34:15 +0100 Subject: [PATCH 138/610] Update llx_00_c_country.sql MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bahreïn --> Bahrain Barbade --> Barbados Bénin --> Benin Bermudes --> Bermuda Bhoutan --> Bhutan Bolivie --> Bolivia Bosnie-Herzégovine --> Bosnia and Herzegovina Ile Bouvet --> Bouvet Island (Population: 0 ;-)) Territoire britannique de l''Océan Indien --> British Indian Ocean Territory Bulgarie --> Bulgaria --- .../install/mysql/data/llx_00_c_country.sql | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/htdocs/install/mysql/data/llx_00_c_country.sql b/htdocs/install/mysql/data/llx_00_c_country.sql index 7217fda7d09..61b3f346b39 100644 --- a/htdocs/install/mysql/data/llx_00_c_country.sql +++ b/htdocs/install/mysql/data/llx_00_c_country.sql @@ -71,22 +71,22 @@ INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (39 INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (41,'AT','AUT','Austria',1,0); INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (42,'AZ','AZE','Azerbaijan',1,0); INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (43,'BS','BHS','Bahamas',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (44,'BH','BHR','Bahreïn',1,0); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (44,'BH','BHR','Bahrain',1,0); INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (45,'BD','BGD','Bangladesh',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (46,'BB','BRB','Barbade',1,0); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (46,'BB','BRB','Barbados',1,0); INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (47,'BY','BLR','Belarus',1,0); INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (48,'BZ','BLZ','Belize',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (49,'BJ','BEN','Bénin',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (50,'BM','BMU','Bermudes',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (51,'BT','BTN','Bhoutan',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (52,'BO','BOL','Bolivie',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (53,'BA','BIH','Bosnie-Herzégovine',1,0); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (49,'BJ','BEN','Benin',1,0); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (50,'BM','BMU','Bermuda',1,0); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (51,'BT','BTN','Bhutan',1,0); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (52,'BO','BOL','Bolivia',1,0); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (53,'BA','BIH','Bosnia and Herzegovina',1,0); INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (54,'BW','BWA','Botswana',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (55,'BV','BVT','Ile Bouvet',1,0); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (55,'BV','BVT','Bouvet Island',0,0); INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (56,'BR','BRA','Brazil',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (57,'IO','IOT','Territoire britannique de l''Océan Indien',1,0); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (57,'IO','IOT','British Indian Ocean Territory',1,0); INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (58,'BN','BRN','Brunei',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (59,'BG','BGR','Bulgarie',1,0); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (59,'BG','BGR','Bulgaria',1,0); INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (60,'BF','BFA','Burkina Faso',1,0); INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (61,'BI','BDI','Burundi',1,0); INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (62,'KH','KHM','Cambodge',1,0); From 4f4c95344e840118831003dd865c17ff8c59e567 Mon Sep 17 00:00:00 2001 From: BB2A Anthony Berton Date: Sat, 12 Mar 2022 16:36:32 +0100 Subject: [PATCH 139/610] Other --- htdocs/comm/card.php | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 0993f0c78ab..86d70e04c9a 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -861,13 +861,10 @@ if ($object->id > 0) { $propal_static->total_tva = $objp->total_tva; $propal_static->total_ttc = $objp->total_ttc; print $propal_static->getNomUrl(1); - $filename = dol_sanitizeFileName($objp->ref); $filedir = $conf->propal->multidir_output[$conf->entity].'/'.dol_sanitizeFileName($objp->ref); $urlsource = '/comm/propal/card.php?id='.$objp->cid; - print $formfile->getDocumentsLink($propal_static->element, $filename, $filedir); - if (($db->jdate($objp->date_limit) < ($now - $conf->propal->cloture->warning_delay)) && $objp->fk_statut == $propal_static::STATUS_VALIDATED) { print " ".img_warning(); } @@ -949,11 +946,9 @@ if ($object->id > 0) { print ''; print ''; @@ -1020,6 +1015,10 @@ if ($object->id > 0) { print ''; print ''; if ($objp->date_creation > 0) { print ''; @@ -1093,6 +1092,10 @@ if ($object->id > 0) { print ''; print '\n"; print '\n"; @@ -1154,6 +1157,10 @@ if ($object->id > 0) { print ''; print ''."\n"; //print ''."\n"; print ''."\n"; @@ -1228,20 +1235,9 @@ if ($object->id > 0) { print ''; print ''; - // Other picto tool - print ''; - - if ($objp->frequency && $objp->date_last_gen > 0) { print ''; } else { @@ -1330,6 +1326,10 @@ if ($object->id > 0) { print ''; print ''; if ($objp->df > 0) { print ''; From 899598bbb348d7afe551b18339c255f95cc8ccf1 Mon Sep 17 00:00:00 2001 From: BB2A Anthony Berton Date: Sat, 12 Mar 2022 16:50:48 +0100 Subject: [PATCH 140/610] Cop --- htdocs/admin/notification.php | 3 ++- htdocs/core/class/notify.class.php | 1 + .../interface_50_modNotification_Notification.class.php | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/admin/notification.php b/htdocs/admin/notification.php index f6d71fe6817..ac32d01522d 100644 --- a/htdocs/admin/notification.php +++ b/htdocs/admin/notification.php @@ -1,9 +1,10 @@ * Copyright (C) 2005-2015 Laurent Destailleur - * Copyright (C) 2013 Juanjo Menent + * Copyright (C) 2013 Juanjo Menent * Copyright (C) 2015 Bahfir Abbes * Copyright (C) 2020 Thibault FOUCART + * Copyright (C) 2022 Anthony Berton * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/htdocs/core/class/notify.class.php b/htdocs/core/class/notify.class.php index 0b92cc47a70..8e72d8e4773 100644 --- a/htdocs/core/class/notify.class.php +++ b/htdocs/core/class/notify.class.php @@ -4,6 +4,7 @@ * Copyright (C) 2014 Juanjo Menent * Copyright (C) 2018 Philippe Grand * Copyright (C) 2021 Thibault FOUCART + * Copyright (C) 2022 Anthony Berton * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/htdocs/core/triggers/interface_50_modNotification_Notification.class.php b/htdocs/core/triggers/interface_50_modNotification_Notification.class.php index 2013933e54b..b32b63ba3d0 100644 --- a/htdocs/core/triggers/interface_50_modNotification_Notification.class.php +++ b/htdocs/core/triggers/interface_50_modNotification_Notification.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2006-2011 Laurent Destailleur * Copyright (C) 2011 Regis Houssin * Copyright (C) 2013-2014 Marcos García + * Copyright (C) 2022 Anthony Berton * * 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 From a2b880bdbf5f94f0dabe1ee94d6915c99bff461b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 12 Mar 2022 18:20:15 +0100 Subject: [PATCH 141/610] Fix access to the bank receipt view --- htdocs/compta/bank/releve.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/bank/releve.php b/htdocs/compta/bank/releve.php index d21717473ff..2385f2210a5 100644 --- a/htdocs/compta/bank/releve.php +++ b/htdocs/compta/bank/releve.php @@ -60,10 +60,11 @@ $newbankreceipt = GETPOST('newbankreceipt', 'alpha'); // Security check $fieldid = (!empty($ref) ? $ref : $id); -$fieldname = isset($ref) ? 'ref' : 'rowid'; +$fieldname = (!empty($ref) ? 'ref' : 'rowid'); if ($user->socid) { $socid = $user->socid; } + $result = restrictedArea($user, 'banque', $fieldid, 'bank_account', '', '', $fieldname); if ($user->rights->banque->consolidate && $action == 'dvnext' && !empty($dvid)) { From 8410298c7e5cd505eaa26182a3617cd8114e7d2d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 12 Mar 2022 18:20:15 +0100 Subject: [PATCH 142/610] Fix access to the bank receipt view --- htdocs/compta/bank/releve.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/bank/releve.php b/htdocs/compta/bank/releve.php index d21717473ff..2385f2210a5 100644 --- a/htdocs/compta/bank/releve.php +++ b/htdocs/compta/bank/releve.php @@ -60,10 +60,11 @@ $newbankreceipt = GETPOST('newbankreceipt', 'alpha'); // Security check $fieldid = (!empty($ref) ? $ref : $id); -$fieldname = isset($ref) ? 'ref' : 'rowid'; +$fieldname = (!empty($ref) ? 'ref' : 'rowid'); if ($user->socid) { $socid = $user->socid; } + $result = restrictedArea($user, 'banque', $fieldid, 'bank_account', '', '', $fieldname); if ($user->rights->banque->consolidate && $action == 'dvnext' && !empty($dvid)) { From 368a247f95b7b138a60dcb36cb6e62605f58e6c9 Mon Sep 17 00:00:00 2001 From: BB2A Anthony Berton Date: Sat, 12 Mar 2022 18:53:27 +0100 Subject: [PATCH 143/610] New method --- htdocs/comm/card.php | 190 ++++++++++++++++++++++++++++++++++++++----- 1 file changed, 171 insertions(+), 19 deletions(-) diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 86d70e04c9a..c829ec30550 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -10,6 +10,7 @@ * Copyright (C) 2015-2021 Frédéric France * Copyright (C) 2015 Marcos García * Copyright (C) 2020 Open-Dsi + * Copyright (C) 2022 Anthony Berton * * 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 @@ -861,10 +862,36 @@ if ($object->id > 0) { $propal_static->total_tva = $objp->total_tva; $propal_static->total_ttc = $objp->total_ttc; print $propal_static->getNomUrl(1); - $filename = dol_sanitizeFileName($objp->ref); + + // Preview $filedir = $conf->propal->multidir_output[$conf->entity].'/'.dol_sanitizeFileName($objp->ref); - $urlsource = '/comm/propal/card.php?id='.$objp->cid; - print $formfile->getDocumentsLink($propal_static->element, $filename, $filedir); + $file_list = null; + if (!empty($filedir)) { + $file_list = dol_dir_list($filedir, 'files', 0, '', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC); + } + if (is_array($file_list)) { + // Defined relative dir to DOL_DATA_ROOT + $relativedir = ''; + if ($filedir) { + $relativedir = preg_replace('/^'.preg_quote(DOL_DATA_ROOT, '/').'/', '', $filedir); + $relativedir = preg_replace('/^[\\/]/', '', $relativedir); + } + // Get list of files stored into database for same relative directory + if ($relativedir) { + completeFileArrayWithDatabaseInfo($file_list, $relativedir); + + //var_dump($sortfield.' - '.$sortorder); + if (!empty($sortfield) && !empty($sortorder)) { // If $sortfield is for example 'position_name', we will sort on the property 'position_name' (that is concat of position+name) + $file_list = dol_sort_array($file_list, $sortfield, $sortorder); + } + } + $relativepath = dol_sanitizeFileName($objp->ref).'/'.dol_sanitizeFileName($objp->ref).'.pdf'; + print $formfile->showPreview($file_list, $propal_static->element, $relativepath, 0, $param); + } + // $filename = dol_sanitizeFileName($objp->ref); + // $filedir = $conf->propal->multidir_output[$conf->entity].'/'.dol_sanitizeFileName($objp->ref); + // $urlsource = '/comm/propal/card.php?id='.$objp->cid; + // print $formfile->getDocumentsLink($propal_static->element, $filename, $filedir); if (($db->jdate($objp->date_limit) < ($now - $conf->propal->cloture->warning_delay)) && $objp->fk_statut == $propal_static::STATUS_VALIDATED) { print " ".img_warning(); } @@ -946,10 +973,35 @@ if ($object->id > 0) { print ''; print ''; print '\n"; @@ -1015,10 +1067,35 @@ if ($object->id > 0) { print ''; print ''; if ($objp->date_creation > 0) { print ''; @@ -1092,10 +1169,35 @@ if ($object->id > 0) { print ''; print '\n"; print '\n"; @@ -1157,10 +1259,35 @@ if ($object->id > 0) { print ''; print ''."\n"; //print ''."\n"; print ''."\n"; @@ -1326,10 +1453,35 @@ if ($object->id > 0) { print ''; print ''; if ($objp->df > 0) { print ''; From a1ac38ae034ca0dc0ef5b3fbe896688c81cb60f3 Mon Sep 17 00:00:00 2001 From: BB2A Anthony Berton Date: Sat, 12 Mar 2022 21:03:11 +0100 Subject: [PATCH 144/610] entity --- htdocs/comm/card.php | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index c829ec30550..9e5ef8be35c 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -864,7 +864,7 @@ if ($object->id > 0) { print $propal_static->getNomUrl(1); // Preview - $filedir = $conf->propal->multidir_output[$conf->entity].'/'.dol_sanitizeFileName($objp->ref); + $filedir = $conf->propal->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref); $file_list = null; if (!empty($filedir)) { $file_list = dol_dir_list($filedir, 'files', 0, '', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC); @@ -889,7 +889,7 @@ if ($object->id > 0) { print $formfile->showPreview($file_list, $propal_static->element, $relativepath, 0, $param); } // $filename = dol_sanitizeFileName($objp->ref); - // $filedir = $conf->propal->multidir_output[$conf->entity].'/'.dol_sanitizeFileName($objp->ref); + // $filedir = $conf->propal->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref); // $urlsource = '/comm/propal/card.php?id='.$objp->cid; // print $formfile->getDocumentsLink($propal_static->element, $filename, $filedir); if (($db->jdate($objp->date_limit) < ($now - $conf->propal->cloture->warning_delay)) && $objp->fk_statut == $propal_static::STATUS_VALIDATED) { @@ -974,7 +974,7 @@ if ($object->id > 0) { print ''; @@ -1068,7 +1068,7 @@ if ($object->id > 0) { print ''; @@ -1170,7 +1170,7 @@ if ($object->id > 0) { print ''."\n"; @@ -1454,7 +1454,7 @@ if ($object->id > 0) { print ''; From 316380afd26f4eeca65f5affb3e066508a25b535 Mon Sep 17 00:00:00 2001 From: BB2A Anthony Berton Date: Sat, 12 Mar 2022 23:41:16 +0100 Subject: [PATCH 145/610] 1 --- htdocs/core/class/notify.class.php | 4 ++-- .../interface_50_modNotification_Notification.class.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/notify.class.php b/htdocs/core/class/notify.class.php index 8e72d8e4773..5bb448ad11d 100644 --- a/htdocs/core/class/notify.class.php +++ b/htdocs/core/class/notify.class.php @@ -81,7 +81,7 @@ class Notify 'EXPENSE_REPORT_APPROVE', 'HOLIDAY_VALIDATE', 'HOLIDAY_APPROVE', - 'ACTION_CREATE', + 'ACTION_CREATE' ); /** @@ -363,7 +363,7 @@ class Notify $hookmanager->initHooks(array('notification')); - $reshook = $hookmanager->executeHooks('notifsupported'); + $reshook = $hookmanager->executeHooks('notifsupported', $parameters, $object, $action); if (empty($reshook)) { if (!empty($hookmanager->resArray['arrayofnotifsupported'])) { Notify::$arrayofnotifsupported = array_merge(Notify::$arrayofnotifsupported, $hookmanager->resArray['arrayofnotifsupported']); diff --git a/htdocs/core/triggers/interface_50_modNotification_Notification.class.php b/htdocs/core/triggers/interface_50_modNotification_Notification.class.php index b32b63ba3d0..6e4f8cb1563 100644 --- a/htdocs/core/triggers/interface_50_modNotification_Notification.class.php +++ b/htdocs/core/triggers/interface_50_modNotification_Notification.class.php @@ -100,7 +100,7 @@ class InterfaceNotification extends DolibarrTriggers } $hookmanager->initHooks(array('notification')); - $reshook = $hookmanager->executeHooks('notifsupported'); + $reshook = $hookmanager->executeHooks('notifsupported', $parameters, $object, $action); if (empty($reshook)) { if (!empty($hookmanager->resArray['arrayofnotifsupported'])) { $this->listofmanagedevents = array_merge($this->listofmanagedevents, $hookmanager->resArray['arrayofnotifsupported']); From 22b3c0ccaec4cc60caf373cb973b49c2cce4baad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Serti=C4=87?= Date: Sun, 13 Mar 2022 12:59:52 +0100 Subject: [PATCH 146/610] Add forme juridique for croatia --- htdocs/install/mysql/data/llx_c_forme_juridique.sql | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/htdocs/install/mysql/data/llx_c_forme_juridique.sql b/htdocs/install/mysql/data/llx_c_forme_juridique.sql index a1293084a52..aadb47c3ff6 100644 --- a/htdocs/install/mysql/data/llx_c_forme_juridique.sql +++ b/htdocs/install/mysql/data/llx_c_forme_juridique.sql @@ -382,3 +382,16 @@ INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2009', ' INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2010', 'Enkelt bolag'); INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2011', 'Ideell förening'); INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2012', 'Stiftelse'); + +-- Croatia (id country=76) +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (76, '7601', 'Društvo s ograničenom odgovornošću (d.o.o.)'); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (76, '7602', 'Jednostavno društvo s ograničenom odgovornošću (j.d.o.o.)'); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (76, '7603', 'Dioničko društvo (d.d.)'); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (76, '7604', 'Obrt'); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (76, '7605', 'Javno trgovačko društvo (j.t.d.)'); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (76, '7606', 'Komanditno društvo (k.d.)'); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (76, '7607', 'Gospodarsko interesno udruženje (GIU)'); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (76, '7608', 'Predstavništvo'); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (76, '7609', 'Državno tijelo'); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (76, '7610', 'Kućna radinost'); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (76, '7611', 'Sporedno zanimanje'); From ba4b72e59df4921b28b0f301e341ad8e7d98dafb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Serti=C4=87?= Date: Sun, 13 Mar 2022 13:07:42 +0100 Subject: [PATCH 147/610] Add regions for Croatia --- htdocs/install/mysql/data/llx_10_c_regions.sql | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/htdocs/install/mysql/data/llx_10_c_regions.sql b/htdocs/install/mysql/data/llx_10_c_regions.sql index daf6e16ea9e..368b6d9dccf 100644 --- a/htdocs/install/mysql/data/llx_10_c_regions.sql +++ b/htdocs/install/mysql/data/llx_10_c_regions.sql @@ -11,6 +11,7 @@ -- Copyright (C) 2015 Ferran Marcet -- Copyright (C) 2019~ Lao Tian <281388879@qq.com> -- Copyright (C) 2020-2021 Udo Tamm +-- Copyright (C) 2022 Miro Sertić -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by @@ -55,6 +56,7 @@ -- Chile -- China -- Colombie -> for Departmements +-- Croatia -> for Departmements -- Denmark -- France -- Germany -> for Departmements @@ -207,6 +209,13 @@ insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9 INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 70, 7001, '', 0, 'Colombie'); +-- Croatia Regions (id country=76) +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 76, 7601, '', 0, 'Središnja'); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 76, 7602, '', 0, 'Dalmacija'); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 76, 7603, '', 0, 'Slavonija'); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 76, 7604, '', 0, 'Istra'); + + -- Denmark Regions (id country=80) INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 80, 8001, '', 0, 'Nordjylland'); INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 80, 8002, '', 0, 'Midtjylland'); From 25d31e38ea5dea7033c23bb19bc08169edbed728 Mon Sep 17 00:00:00 2001 From: Khang Date: Sun, 13 Mar 2022 19:15:25 +0700 Subject: [PATCH 148/610] Add (llx_c_tva.sql) VIETNAM VAT --- htdocs/install/mysql/data/llx_c_tva.sql | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/install/mysql/data/llx_c_tva.sql b/htdocs/install/mysql/data/llx_c_tva.sql index 7a84c622b47..d35e439c2da 100644 --- a/htdocs/install/mysql/data/llx_c_tva.sql +++ b/htdocs/install/mysql/data/llx_c_tva.sql @@ -384,6 +384,11 @@ insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (23 insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (2322,232, '12','0','VAT 12%',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (2323,232, '8','0','VAT 8%',1); +-- VIETNAM (id country=233) +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (2331,233, '0','0','Thuế GTGT đươc khấu trừ 0%',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (2332,233, '5','0','Thuế GTGT đươc khấu trừ 5%',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (2333,233, '8','0','Thuế GTGT đươc khấu trừ 8%',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (2334,233, '10','0','Thuế GTGT đươc khấu trừ 10%',1); -- Example of code to insert a VAT rate 0 for each country --delete from llx_c_tva where rowid = 1181; -- to delete a record that does not follow rules for rowid (fk_pays+'1') --insert into llx_c_tva(rowid, fk_pays, taux, recuperableonly, note, active) SELECT CONCAT(c.rowid, '1'), c.rowid, 0, 0, 'No VAT', 1 from llx_c_country as c where c.rowid not in (select fk_pays from llx_c_tva); From 339152cf68a89c74022e3c4517eeee014bcb202e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Serti=C4=87?= Date: Sun, 13 Mar 2022 13:50:11 +0100 Subject: [PATCH 149/610] Add departments for Croatia --- .../mysql/data/llx_20_c_departements.sql | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/htdocs/install/mysql/data/llx_20_c_departements.sql b/htdocs/install/mysql/data/llx_20_c_departements.sql index 47f51f33986..15c99b0b99b 100644 --- a/htdocs/install/mysql/data/llx_20_c_departements.sql +++ b/htdocs/install/mysql/data/llx_20_c_departements.sql @@ -10,6 +10,7 @@ -- Copyright (C) 2012 Ricardo Schluter -- Copyright (C) 2015 Ferran Marcet -- Copyright (C) 2020-2021 Udo Tamm +-- Copyright (C) 2022 Miro Sertić -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by @@ -47,6 +48,7 @@ -- Canada -- Chile -- Colombia +-- Croatia -- France -- Germany -- Honduras @@ -367,6 +369,29 @@ INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (7001, 'CES', '', 0, 'CES', 'Cesar'); INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (7001, 'MAG', '', 0, 'MAG', 'Magdalena'); +-- Croatia Departments (id country=76) +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (7601, 'HR-01', 'Bjelovar', 0, NULL, 'Bjelovarsko-bilogorska županija'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (7601, 'HR-02', 'Karlovac', 0, NULL, 'Karlovačka županija'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (7601, 'HR-03', 'Koprivnica', 0, NULL, 'Koprivničko-križevačka županija'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (7601, 'HR-04', 'Krapina', 0, NULL, 'Krapinsko-zagorska županija'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (7601, 'HR-05', 'Gospić', 0, NULL, 'Ličko-senjska županija'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (7601, 'HR-06', 'Čakovec', 0, NULL, 'Međimurska županija'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (7601, 'HR-07', 'Rijeka', 0, NULL, 'Primorsko-goranska županija'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (7601, 'HR-08', 'Sisak', 0, NULL, 'Sisačko-moslavačka županija'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (7601, 'HR-09', 'Varaždin', 0, NULL, 'Varaždinska županija'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (7601, 'HR-10', 'Zagreb', 0, NULL, 'Zagrebačka županija'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (7601, 'HR-11', 'Zagreb', 0, NULL, 'Grad Zagreb'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (7602, 'HR-12', 'Zadar', 0, NULL, 'Zadarska županija'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (7602, 'HR-13', 'Šibenik', 0, NULL, 'Šibensko-kninska županija'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (7602, 'HR-14', 'Split', 0, NULL, 'Splitsko-dalmatinska županija'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (7602, 'HR-15', 'Dubrovnik', 0, NULL, 'Dubrovačko-neretvanska županija'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (7603, 'HR-16', 'Slavonski Brod', 0, NULL, 'Brodsko-posavska županija'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (7603, 'HR-17', 'Osijek', 0, NULL, 'Osječko-baranjska županija'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (7603, 'HR-18', 'Požega', 0, NULL, 'Požeško-slavonska županija'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (7603, 'HR-19', 'Virovitica', 0, NULL, 'Virovitičko-podravska županija'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (7603, 'HR-20', 'Vukovar', 0, NULL, 'Vukovarsko-srijemska županija'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (7604, 'HR-21', 'Pazin', 0, NULL, 'Istarska županija'); + -- France Departements (id country=1) insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values ( 1, '971','97105',3,'GUADELOUPE','Guadeloupe'); From fc59f49b32f2b2466629318d0f91b9ab9bc0e2be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Serti=C4=87?= Date: Sun, 13 Mar 2022 14:18:14 +0100 Subject: [PATCH 150/610] Add vat for Croatia --- htdocs/install/mysql/data/llx_c_tva.sql | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/htdocs/install/mysql/data/llx_c_tva.sql b/htdocs/install/mysql/data/llx_c_tva.sql index 7a84c622b47..788aec5251e 100644 --- a/htdocs/install/mysql/data/llx_c_tva.sql +++ b/htdocs/install/mysql/data/llx_c_tva.sql @@ -8,6 +8,7 @@ -- Copyright (C) 2010-2016 Juanjo Menent -- Copyright (C) 2012 Sebastian Neuwert -- Copyright (C) 2012 Ricardo Schluter +-- Copyright (C) 2022 Miro Sertić -- -- 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 @@ -106,6 +107,12 @@ insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 9 insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (721, 72, '0','0','VAT rate 0',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,note,active) values (722, 72, '18','0', '0.9', '1', 'VAT rate 18+0.9', 1); +-- CROATIA (id country=76) +insert into llx_c_tva(rowid,fk_pays,taux,note,active) values (761, 76, '25','PDV 25%', 1); +insert into llx_c_tva(rowid,fk_pays,taux,note,active) values (762, 76, '13','PDV 13%', 1); +insert into llx_c_tva(rowid,fk_pays,taux,note,active) values (763, 76, '5', 'PDV 5%', 1); +insert into llx_c_tva(rowid,fk_pays,taux,note,active) values (764, 76, '0', 'PDV 0%', 1); + -- CYPRUS (id country=78) insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (781, 78, '0','0','VAT rate 0',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (782, 78, '9','0','VAT rate 9',1); From f22888e4267f699979543d86f84d8442d1d35161 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Serti=C4=87?= Date: Sun, 13 Mar 2022 14:34:14 +0100 Subject: [PATCH 151/610] Add contributor to llx_c_forme_juridique.sql --- htdocs/install/mysql/data/llx_c_forme_juridique.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/install/mysql/data/llx_c_forme_juridique.sql b/htdocs/install/mysql/data/llx_c_forme_juridique.sql index aadb47c3ff6..2b3accc5482 100644 --- a/htdocs/install/mysql/data/llx_c_forme_juridique.sql +++ b/htdocs/install/mysql/data/llx_c_forme_juridique.sql @@ -11,6 +11,7 @@ -- Copyright (C) 2012 Ricardo Schluter -- Copyright (C) 2013 Cedric GROSS -- Copyright (C) 2020-2021 Udo Tamm +-- Copyright (C) 2022 Miro Sertić -- -- 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 From 45df52343b6d7048b615a70d0ff245be0a0948cc Mon Sep 17 00:00:00 2001 From: daraelmin Date: Sun, 13 Mar 2022 14:42:38 +0100 Subject: [PATCH 152/610] Fix Warning in htdocs/adherents/card.php Fix Warning: Creating default object from empty value in htdocs/adherents/card.php on line 1058 --- htdocs/adherents/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index e081b126dfe..b36781a99b1 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -789,8 +789,8 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { $object->country = $tmparray['label']; } + $soc = new Societe($db); if (!empty($socid)) { - $soc = new Societe($db); if ($socid > 0) $soc->fetch($socid); if (!($soc->id > 0)) { From b1197d4f4e089c42dd44979a78ca6f0a7e30b6ef Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sun, 13 Mar 2022 15:31:37 +0100 Subject: [PATCH 153/610] Fix for multicompany on online sign url --- htdocs/core/lib/signature.lib.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/htdocs/core/lib/signature.lib.php b/htdocs/core/lib/signature.lib.php index 1d529be6327..c57807800d7 100644 --- a/htdocs/core/lib/signature.lib.php +++ b/htdocs/core/lib/signature.lib.php @@ -119,11 +119,9 @@ function getOnlineSignatureUrl($mode, $type, $ref = '', $localorexternal = 1) } // For multicompany - /* - if (!empty($out)) { - $out .= "&entity=".$conf->entity; // Check the entity because He may be the same reference in several entities + if (!empty($out) && !empty($conf->multicompany->enabled)) { + $out .= "&entity=".$conf->entity; // Check the entity because we may have the same reference in several entities } - */ return $out; } From ec4ba46582608fefedeb313a818c328431f9af5b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 13 Mar 2022 18:30:31 +0100 Subject: [PATCH 154/610] NEW Add private and public notes on tax files. --- .../sociales/class/chargesociales.class.php | 4 +- htdocs/compta/sociales/info.php | 4 +- htdocs/compta/sociales/note.php | 135 ++++++++++++++++++ htdocs/core/lib/tax.lib.php | 5 + .../install/mysql/migration/15.0.0-16.0.0.sql | 4 + .../mysql/tables/llx_chargesociales.key.sql | 20 +++ .../mysql/tables/llx_chargesociales.sql | 3 + .../modulebuilder/template/myobject_note.php | 3 +- 8 files changed, 174 insertions(+), 4 deletions(-) create mode 100644 htdocs/compta/sociales/note.php create mode 100644 htdocs/install/mysql/tables/llx_chargesociales.key.sql diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php index caa04146264..6419e2b8970 100644 --- a/htdocs/compta/sociales/class/chargesociales.class.php +++ b/htdocs/compta/sociales/class/chargesociales.class.php @@ -139,7 +139,7 @@ class ChargeSociales extends CommonObject { $sql = "SELECT cs.rowid, cs.date_ech"; $sql .= ", cs.libelle as label, cs.fk_type, cs.amount, cs.fk_projet as fk_project, cs.paye, cs.periode, cs.import_key"; - $sql .= ", cs.fk_account, cs.fk_mode_reglement, cs.fk_user"; + $sql .= ", cs.fk_account, cs.fk_mode_reglement, cs.fk_user, note_public, note_private"; $sql .= ", c.libelle as type_label"; $sql .= ', p.code as mode_reglement_code, p.libelle as mode_reglement_libelle'; $sql .= " FROM ".MAIN_DB_PREFIX."chargesociales as cs"; @@ -172,6 +172,8 @@ class ChargeSociales extends CommonObject $this->amount = $obj->amount; $this->fk_project = $obj->fk_project; $this->fk_user = $obj->fk_user; + $this->note_public = $obj->note_public; + $this->note_private = $obj->note_private; $this->paye = $obj->paye; $this->periode = $this->db->jdate($obj->periode); $this->import_key = $this->import_key; diff --git a/htdocs/compta/sociales/info.php b/htdocs/compta/sociales/info.php index 546a4c711d0..4c49a3008c6 100644 --- a/htdocs/compta/sociales/info.php +++ b/htdocs/compta/sociales/info.php @@ -81,7 +81,7 @@ $object->info($id); $head = tax_prepare_head($object); -print dol_get_fiche_head($head, 'info', $langs->trans("SocialContribution"), -1, 'bill'); +print dol_get_fiche_head($head, 'info', $langs->trans("SocialContribution"), -1, $object->picto); $morehtmlref = '
'; // Label of social contribution @@ -115,7 +115,7 @@ print '
'; print '
'; -print '
'.($object->type == Facture::TYPE_CREDIT_NOTE ? $langs->trans("PaymentsBack") : $langs->trans('Payments')).''.$langs->trans('Date').''.$langs->trans('Type').''.$langs->trans('Date').''.$langs->trans('Type').''.$langs->trans('BankAccount').''.$langs->trans('BankAccount').''.$langs->trans('Amount').' 
'; + print ''; switch ($objectlink->type) { case Facture::TYPE_REPLACEMENT: echo $langs->trans("InvoiceReplacement"); diff --git a/htdocs/compta/facture/tpl/linkedobjectblockForRec.tpl.php b/htdocs/compta/facture/tpl/linkedobjectblockForRec.tpl.php index d222dfd21dc..efe2e6f6029 100644 --- a/htdocs/compta/facture/tpl/linkedobjectblockForRec.tpl.php +++ b/htdocs/compta/facture/tpl/linkedobjectblockForRec.tpl.php @@ -46,7 +46,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) { } ?>
trans("RepeatableInvoice"); ?>trans("RepeatableInvoice"); ?> getNomUrl(1); ?> date_when, 'day'); ?>
'; print $commande_static->getNomUrl(1); - $filename = dol_sanitizeFileName($objp->ref); $filedir = $conf->order->multidir_output[$conf->entity].'/'.dol_sanitizeFileName($objp->ref); $urlsource = '/commande/card.php?id='.$objp->cid; - print $formfile->getDocumentsLink($commande_static->element, $filename, $filedir); print '
'; print $sendingstatic->getNomUrl(1); + $filename = dol_sanitizeFileName($objp->ref); + $filedir = $conf->expedition->multidir_output[$conf->entity].'/'.dol_sanitizeFileName($objp->ref); + $urlsource = '/expedition/card.php?id='.$objp->cid; + print $formfile->getDocumentsLink($sendingstatic->element, $filename, $filedir); print ''.dol_print_date($db->jdate($objp->date_creation), 'day').'
'; print $contrat->getNomUrl(1, 12); + $filename = dol_sanitizeFileName($objp->ref); + $filedir = $conf->contrat->multidir_output[$conf->entity].'/'.dol_sanitizeFileName($objp->ref); + $urlsource = '/contrat/card.php?id='.$objp->cid; + print $formfile->getDocumentsLink($contrat->element, $filename, $filedir); print $late; print "'.dol_trunc($objp->refsup, 12)."
'; print $fichinter_static->getNomUrl(1); + $filename = dol_sanitizeFileName($objp->ref); + $filedir = $conf->fichinter->multidir_output[$conf->entity].'/'.dol_sanitizeFileName($objp->ref); + $urlsource = '/fichinter/card.php?id='.$objp->cid; + print $formfile->getDocumentsLink($fichinter_static->element, $filename, $filedir); print ''.dol_print_date($db->jdate($objp->startdate)).''.convertSecondToTime($objp->duration).'
'; - - print $invoicetemplate->getNomUrl(1); print ''; - $filename = dol_sanitizeFileName($invoicetemplate->ref); - $filedir = $conf->propal->multidir_output[$invoicetemplate->propal_entity].'/'.dol_sanitizeFileName($invoicetemplate->ref); - $urlsource = $_SERVER['PHP_SELF'].'?id='.$invoicetemplate->rowid; - print $formfile->getDocumentsLink($invoicetemplate->element, $filename, $filedir); - print ''.dol_print_date($db->jdate($objp->date_last_gen), 'day').'
'; print $facturestatic->getNomUrl(1); + $filename = dol_sanitizeFileName($objp->ref); + $filedir = $conf->facture->multidir_output[$conf->entity].'/'.dol_sanitizeFileName($objp->ref); + $urlsource = '/compta/facture/card.php?id='.$objp->cid; + print $formfile->getDocumentsLink($invoicetemplate->element, $filename, $filedir); print ''.dol_print_date($db->jdate($objp->df), 'day').'
'; print $commande_static->getNomUrl(1); - $filename = dol_sanitizeFileName($objp->ref); - $filedir = $conf->order->multidir_output[$conf->entity].'/'.dol_sanitizeFileName($objp->ref); - $urlsource = '/commande/card.php?id='.$objp->cid; - print $formfile->getDocumentsLink($commande_static->element, $filename, $filedir); + // Preview + $filedir = $conf->commande->multidir_output[$conf->entity].'/'.dol_sanitizeFileName($objp->ref); + $file_list = null; + if (!empty($filedir)) { + $file_list = dol_dir_list($filedir, 'files', 0, '', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC); + } + if (is_array($file_list)) { + // Defined relative dir to DOL_DATA_ROOT + $relativedir = ''; + if ($filedir) { + $relativedir = preg_replace('/^'.preg_quote(DOL_DATA_ROOT, '/').'/', '', $filedir); + $relativedir = preg_replace('/^[\\/]/', '', $relativedir); + } + // Get list of files stored into database for same relative directory + if ($relativedir) { + completeFileArrayWithDatabaseInfo($file_list, $relativedir); + + //var_dump($sortfield.' - '.$sortorder); + if (!empty($sortfield) && !empty($sortorder)) { // If $sortfield is for example 'position_name', we will sort on the property 'position_name' (that is concat of position+name) + $file_list = dol_sort_array($file_list, $sortfield, $sortorder); + } + } + $relativepath = dol_sanitizeFileName($objp->ref).'/'.dol_sanitizeFileName($objp->ref).'.pdf'; + print $formfile->showPreview($file_list, $commande_static->element, $relativepath, 0, $param); + } + // $filename = dol_sanitizeFileName($objp->ref); + // $filedir = $conf->order->multidir_output[$conf->entity].'/'.dol_sanitizeFileName($objp->ref); + // $urlsource = '/commande/card.php?id='.$objp->cid; + // print $formfile->getDocumentsLink($commande_static->element, $filename, $filedir); print ''.dol_print_date($db->jdate($objp->dc), 'day')."
'; print $sendingstatic->getNomUrl(1); - $filename = dol_sanitizeFileName($objp->ref); + // Preview $filedir = $conf->expedition->multidir_output[$conf->entity].'/'.dol_sanitizeFileName($objp->ref); - $urlsource = '/expedition/card.php?id='.$objp->cid; - print $formfile->getDocumentsLink($sendingstatic->element, $filename, $filedir); + $file_list = null; + if (!empty($filedir)) { + $file_list = dol_dir_list($filedir, 'files', 0, '', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC); + } + if (is_array($file_list)) { + // Defined relative dir to DOL_DATA_ROOT + $relativedir = ''; + if ($filedir) { + $relativedir = preg_replace('/^'.preg_quote(DOL_DATA_ROOT, '/').'/', '', $filedir); + $relativedir = preg_replace('/^[\\/]/', '', $relativedir); + } + // Get list of files stored into database for same relative directory + if ($relativedir) { + completeFileArrayWithDatabaseInfo($file_list, $relativedir); + + //var_dump($sortfield.' - '.$sortorder); + if (!empty($sortfield) && !empty($sortorder)) { // If $sortfield is for example 'position_name', we will sort on the property 'position_name' (that is concat of position+name) + $file_list = dol_sort_array($file_list, $sortfield, $sortorder); + } + } + $relativepath = dol_sanitizeFileName($objp->ref).'/'.dol_sanitizeFileName($objp->ref).'.pdf'; + print $formfile->showPreview($file_list, $sendingstatic->element, $relativepath, 0, $param); + } + // $filename = dol_sanitizeFileName($objp->ref); + // $filedir = $conf->expedition->multidir_output[$conf->entity].'/'.dol_sanitizeFileName($objp->ref); + // $urlsource = '/expedition/card.php?id='.$objp->cid; + // print $formfile->getDocumentsLink($sendingstatic->element, $filename, $filedir); print ''.dol_print_date($db->jdate($objp->date_creation), 'day').'
'; print $contrat->getNomUrl(1, 12); - $filename = dol_sanitizeFileName($objp->ref); + // Preview $filedir = $conf->contrat->multidir_output[$conf->entity].'/'.dol_sanitizeFileName($objp->ref); - $urlsource = '/contrat/card.php?id='.$objp->cid; - print $formfile->getDocumentsLink($contrat->element, $filename, $filedir); + $file_list = null; + if (!empty($filedir)) { + $file_list = dol_dir_list($filedir, 'files', 0, '', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC); + } + if (is_array($file_list)) { + // Defined relative dir to DOL_DATA_ROOT + $relativedir = ''; + if ($filedir) { + $relativedir = preg_replace('/^'.preg_quote(DOL_DATA_ROOT, '/').'/', '', $filedir); + $relativedir = preg_replace('/^[\\/]/', '', $relativedir); + } + // Get list of files stored into database for same relative directory + if ($relativedir) { + completeFileArrayWithDatabaseInfo($file_list, $relativedir); + + //var_dump($sortfield.' - '.$sortorder); + if (!empty($sortfield) && !empty($sortorder)) { // If $sortfield is for example 'position_name', we will sort on the property 'position_name' (that is concat of position+name) + $file_list = dol_sort_array($file_list, $sortfield, $sortorder); + } + } + $relativepath = dol_sanitizeFileName($objp->ref).'/'.dol_sanitizeFileName($objp->ref).'.pdf'; + print $formfile->showPreview($file_list, $contrat->element, $relativepath, 0, $param); + } + // $filename = dol_sanitizeFileName($objp->ref); + // $filedir = $conf->contrat->multidir_output[$conf->entity].'/'.dol_sanitizeFileName($objp->ref); + // $urlsource = '/contrat/card.php?id='.$objp->cid; + // print $formfile->getDocumentsLink($contrat->element, $filename, $filedir); print $late; print "'.dol_trunc($objp->refsup, 12)."
'; print $fichinter_static->getNomUrl(1); - $filename = dol_sanitizeFileName($objp->ref); + // Preview $filedir = $conf->fichinter->multidir_output[$conf->entity].'/'.dol_sanitizeFileName($objp->ref); - $urlsource = '/fichinter/card.php?id='.$objp->cid; - print $formfile->getDocumentsLink($fichinter_static->element, $filename, $filedir); + $file_list = null; + if (!empty($filedir)) { + $file_list = dol_dir_list($filedir, 'files', 0, '', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC); + } + if (is_array($file_list)) { + // Defined relative dir to DOL_DATA_ROOT + $relativedir = ''; + if ($filedir) { + $relativedir = preg_replace('/^'.preg_quote(DOL_DATA_ROOT, '/').'/', '', $filedir); + $relativedir = preg_replace('/^[\\/]/', '', $relativedir); + } + // Get list of files stored into database for same relative directory + if ($relativedir) { + completeFileArrayWithDatabaseInfo($file_list, $relativedir); + + //var_dump($sortfield.' - '.$sortorder); + if (!empty($sortfield) && !empty($sortorder)) { // If $sortfield is for example 'position_name', we will sort on the property 'position_name' (that is concat of position+name) + $file_list = dol_sort_array($file_list, $sortfield, $sortorder); + } + } + $relativepath = dol_sanitizeFileName($objp->ref).'/'.dol_sanitizeFileName($objp->ref).'.pdf'; + print $formfile->showPreview($file_list, $fichinter_static->element, $relativepath, 0, $param); + } + // $filename = dol_sanitizeFileName($objp->ref); + // $filedir = $conf->fichinter->multidir_output[$conf->entity].'/'.dol_sanitizeFileName($objp->ref); + // $urlsource = '/fichinter/card.php?id='.$objp->cid; + // print $formfile->getDocumentsLink($fichinter_static->element, $filename, $filedir); print ''.dol_print_date($db->jdate($objp->startdate)).''.convertSecondToTime($objp->duration).'
'; print $facturestatic->getNomUrl(1); - $filename = dol_sanitizeFileName($objp->ref); + // Preview $filedir = $conf->facture->multidir_output[$conf->entity].'/'.dol_sanitizeFileName($objp->ref); - $urlsource = '/compta/facture/card.php?id='.$objp->cid; - print $formfile->getDocumentsLink($invoicetemplate->element, $filename, $filedir); + $file_list = null; + if (!empty($filedir)) { + $file_list = dol_dir_list($filedir, 'files', 0, '', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC); + } + if (is_array($file_list)) { + // Defined relative dir to DOL_DATA_ROOT + $relativedir = ''; + if ($filedir) { + $relativedir = preg_replace('/^'.preg_quote(DOL_DATA_ROOT, '/').'/', '', $filedir); + $relativedir = preg_replace('/^[\\/]/', '', $relativedir); + } + // Get list of files stored into database for same relative directory + if ($relativedir) { + completeFileArrayWithDatabaseInfo($file_list, $relativedir); + + //var_dump($sortfield.' - '.$sortorder); + if (!empty($sortfield) && !empty($sortorder)) { // If $sortfield is for example 'position_name', we will sort on the property 'position_name' (that is concat of position+name) + $file_list = dol_sort_array($file_list, $sortfield, $sortorder); + } + } + $relativepath = dol_sanitizeFileName($objp->ref).'/'.dol_sanitizeFileName($objp->ref).'.pdf'; + print $formfile->showPreview($file_list, $facturestatic->element, $relativepath, 0, $param); + } + // $filename = dol_sanitizeFileName($objp->ref); + // $filedir = $conf->facture->multidir_output[$conf->entity].'/'.dol_sanitizeFileName($objp->ref); + // $urlsource = '/compta/facture/card.php?id='.$objp->cid; + //print $formfile->getDocumentsLink($facturestatic->element, $filename, $filedir); print ''.dol_print_date($db->jdate($objp->df), 'day').''; print $commande_static->getNomUrl(1); // Preview - $filedir = $conf->commande->multidir_output[$conf->entity].'/'.dol_sanitizeFileName($objp->ref); + $filedir = $conf->commande->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref); $file_list = null; if (!empty($filedir)) { $file_list = dol_dir_list($filedir, 'files', 0, '', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC); @@ -999,7 +999,7 @@ if ($object->id > 0) { print $formfile->showPreview($file_list, $commande_static->element, $relativepath, 0, $param); } // $filename = dol_sanitizeFileName($objp->ref); - // $filedir = $conf->order->multidir_output[$conf->entity].'/'.dol_sanitizeFileName($objp->ref); + // $filedir = $conf->order->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref); // $urlsource = '/commande/card.php?id='.$objp->cid; // print $formfile->getDocumentsLink($commande_static->element, $filename, $filedir); print ''; print $sendingstatic->getNomUrl(1); // Preview - $filedir = $conf->expedition->multidir_output[$conf->entity].'/'.dol_sanitizeFileName($objp->ref); + $filedir = $conf->expedition->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref); $file_list = null; if (!empty($filedir)) { $file_list = dol_dir_list($filedir, 'files', 0, '', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC); @@ -1093,7 +1093,7 @@ if ($object->id > 0) { print $formfile->showPreview($file_list, $sendingstatic->element, $relativepath, 0, $param); } // $filename = dol_sanitizeFileName($objp->ref); - // $filedir = $conf->expedition->multidir_output[$conf->entity].'/'.dol_sanitizeFileName($objp->ref); + // $filedir = $conf->expedition->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref); // $urlsource = '/expedition/card.php?id='.$objp->cid; // print $formfile->getDocumentsLink($sendingstatic->element, $filename, $filedir); print ''; print $contrat->getNomUrl(1, 12); // Preview - $filedir = $conf->contrat->multidir_output[$conf->entity].'/'.dol_sanitizeFileName($objp->ref); + $filedir = $conf->contrat->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref); $file_list = null; if (!empty($filedir)) { $file_list = dol_dir_list($filedir, 'files', 0, '', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC); @@ -1195,7 +1195,7 @@ if ($object->id > 0) { print $formfile->showPreview($file_list, $contrat->element, $relativepath, 0, $param); } // $filename = dol_sanitizeFileName($objp->ref); - // $filedir = $conf->contrat->multidir_output[$conf->entity].'/'.dol_sanitizeFileName($objp->ref); + // $filedir = $conf->contrat->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref); // $urlsource = '/contrat/card.php?id='.$objp->cid; // print $formfile->getDocumentsLink($contrat->element, $filename, $filedir); print $late; @@ -1260,7 +1260,7 @@ if ($object->id > 0) { print ''; print $fichinter_static->getNomUrl(1); // Preview - $filedir = $conf->fichinter->multidir_output[$conf->entity].'/'.dol_sanitizeFileName($objp->ref); + $filedir = $conf->fichinter->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref); $file_list = null; if (!empty($filedir)) { $file_list = dol_dir_list($filedir, 'files', 0, '', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC); @@ -1285,7 +1285,7 @@ if ($object->id > 0) { print $formfile->showPreview($file_list, $fichinter_static->element, $relativepath, 0, $param); } // $filename = dol_sanitizeFileName($objp->ref); - // $filedir = $conf->fichinter->multidir_output[$conf->entity].'/'.dol_sanitizeFileName($objp->ref); + // $filedir = $conf->fichinter->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref); // $urlsource = '/fichinter/card.php?id='.$objp->cid; // print $formfile->getDocumentsLink($fichinter_static->element, $filename, $filedir); print ''; print $facturestatic->getNomUrl(1); // Preview - $filedir = $conf->facture->multidir_output[$conf->entity].'/'.dol_sanitizeFileName($objp->ref); + $filedir = $conf->facture->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref); $file_list = null; if (!empty($filedir)) { $file_list = dol_dir_list($filedir, 'files', 0, '', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC); @@ -1479,7 +1479,7 @@ if ($object->id > 0) { print $formfile->showPreview($file_list, $facturestatic->element, $relativepath, 0, $param); } // $filename = dol_sanitizeFileName($objp->ref); - // $filedir = $conf->facture->multidir_output[$conf->entity].'/'.dol_sanitizeFileName($objp->ref); + // $filedir = $conf->facture->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref); // $urlsource = '/compta/facture/card.php?id='.$objp->cid; //print $formfile->getDocumentsLink($facturestatic->element, $filename, $filedir); print '
'; if (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) { print ''; print ''; - print ''; + print ''; print ''; } @@ -587,16 +598,18 @@ print ''; if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) { print ''; - print ''; - print ''; + print ''; print ''; print ''; - print ''; - print ''; + print ''; print ''; } From 4b3b9ed66b9ee349f8bbac7ff995ec8077333487 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 14 Mar 2022 11:29:17 +0100 Subject: [PATCH 161/610] Look and feel v15 --- htdocs/langs/en_US/products.lang | 3 ++- htdocs/product/composition/card.php | 5 +++++ htdocs/product/fournisseurs.php | 8 +++++--- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index 0fa5567cf11..aaa2fe0ead0 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -137,7 +137,8 @@ ConfirmDeleteProductLine=Are you sure you want to delete this product line? ProductSpecial=Special QtyMin=Min. purchase quantity PriceQtyMin=Price quantity min. -PriceQtyMinCurrency=Price (currency) for this qty. (no discount) +PriceQtyMinCurrency=Price (currency) for this qty. +WithoutDiscount=Without discount VATRateForSupplierProduct=VAT Rate (for this vendor/product) DiscountQtyMin=Discount for this qty. NoPriceDefinedForThisSupplier=No price/qty defined for this vendor/product diff --git a/htdocs/product/composition/card.php b/htdocs/product/composition/card.php index d5325029771..a6bb38adfe2 100644 --- a/htdocs/product/composition/card.php +++ b/htdocs/product/composition/card.php @@ -266,6 +266,11 @@ if ($id > 0 || !empty($ref)) { print dol_get_fiche_end(); + + print '
'; + print '
'; + print '
'; + print '
'; $prodsfather = $object->getFather(); // Parent Products diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index 3bf563c82f7..d4785f101cf 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -523,7 +523,9 @@ if ($id > 0 || $ref) { $reshook = $hookmanager->executeHooks('formCreateThirdpartyOptions', $parameters, $object, $action); if (empty($reshook)) { if (empty($form->result)) { - print ' - '.$langs->trans("CreateDolibarrThirdPartySupplier").''; + print ''; + print img_picto($langs->trans("CreateDolibarrThirdPartySupplier"), 'add', 'class="marginleftonly"'); + print ''; } } } @@ -665,7 +667,7 @@ if ($id > 0 || $ref) { print ''; // Currency price qty min - print '
'; + print ''; $pricesupplierincurrencytouse = (GETPOST('multicurrency_price') ? GETPOST('multicurrency_price') : (isset($object->fourn_multicurrency_price) ? $object->fourn_multicurrency_price : '')); print ''; // Price qty min - print ''; + print ''; print '\n"; // Date of birth - print ''; - print ''; - print "\n"; + if ($user->rights->hrm->read_employee->read || $user->rights->hrm->write_employee->write) { + print ''; + print ''; + print "\n"; + } // Personal email - print ''; - print ''; - print ''; + if ($user->rights->hrm->read_employee->read || $user->rights->hrm->write_employee->write) { + print ''; + print ''; + print ''; + } // Personal phone - print ''; - print ''; - print ''; + if ($user->rights->hrm->read_employee->read || $user->rights->hrm->write_employee->write) { + print ''; + print ''; + print ''; + } if (!empty($conf->global->MAIN_USE_EXPENSE_IK)) { print ''; @@ -527,22 +533,26 @@ if ($action != 'edit' && $action != 'create') { // If not bank account yet, $ac } // Employee Number - print ''; - print ''; - print ''; + if ($user->rights->hrm->read_employee->read || $user->rights->hrm->write_employee->write) { + print ''; + print ''; + print ''; + } // National registration number - print ''; - print ''; - print ''; + if ($user->rights->hrm->read_employee->read || $user->rights->hrm->write_employee->write) { + print ''; + print ''; + print ''; + } print '
'; +print '
'; dol_print_object_info($object); print '
'; diff --git a/htdocs/compta/sociales/note.php b/htdocs/compta/sociales/note.php new file mode 100644 index 00000000000..f7850287c1e --- /dev/null +++ b/htdocs/compta/sociales/note.php @@ -0,0 +1,135 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/compta/sociales/note.php + * \ingroup tax + * \brief Tab for notes on Taxes + */ + +require '../../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; +if (!empty($conf->projet->enabled)) { + include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; +} + +// Load translation files required by the page +$langs->loadLangs(array('compta', 'bills')); + +// Get parameters +$id = GETPOST('id', 'int'); +$ref = GETPOST('ref', 'alpha'); +$action = GETPOST('action', 'aZ09'); +$cancel = GETPOST('cancel', 'aZ09'); +$backtopage = GETPOST('backtopage', 'alpha'); + +$object = new ChargeSociales($db); +if ($id > 0) { + $object->fetch($id); +} + +// Security check +$socid = GETPOST('socid', 'int'); +if ($user->socid) { + $socid = $user->socid; +} +$result = restrictedArea($user, 'tax', $object->id, 'chargesociales', 'charges'); + +$permissiontoread = $user->rights->tax->charges->lire; +$permissiontoadd = $user->rights->tax->charges->creer; +$permissionnote = $user->rights->tax->charges->creer; // Used by the include of actions_setnotes.inc.php + + +/* + * Actions + */ + +$parameters = array(); +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); +} +if (empty($reshook)) { + include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once +} + + +/* + * View + */ + +$form = new Form($db); + +$title = $langs->trans("SocialContribution").' - '.$langs->trans("Note"); +$help_url = 'EN:Module_Taxes_and_social_contributions|FR:Module Taxes et dividendes|ES:Módulo Impuestos y cargas sociales (IVA, impuestos)'; +llxHeader('', $title, $help_url); + +if ($id > 0 || !empty($ref)) { + $object->fetch_thirdparty(); + + $head = tax_prepare_head($object); + + print dol_get_fiche_head($head, 'note', $langs->trans("SocialContribution"), -1, $object->picto); + + $morehtmlref = '
'; + // Label of social contribution + $morehtmlref .= $form->editfieldkey("Label", 'lib', $object->label, $object, $user->rights->tax->charges->creer, 'string', '', 0, 1); + $morehtmlref .= $form->editfieldval("Label", 'lib', $object->label, $object, $user->rights->tax->charges->creer, 'string', '', null, null, '', 1); + // Project + if (!empty($conf->projet->enabled)) { + $langs->load("projects"); + $morehtmlref .= '
'.$langs->trans('Project').' : '; + if (!empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref .= ' : '.$proj->getNomUrl(1); + if ($proj->title) { + $morehtmlref .= ' - '.$proj->title; + } + } else { + $morehtmlref .= ''; + } + } + $morehtmlref .= '
'; + + // Object card + // ------------------------------------------------------------ + $linkback = ''.$langs->trans("BackToList").''; + + $object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status + + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright); + + + print '
'; + print '
'; + + + $cssclass = "titlefield"; + include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; + + print '
'; + + print dol_get_fiche_end(); +} + +// End of page +llxFooter(); +$db->close(); diff --git a/htdocs/core/lib/tax.lib.php b/htdocs/core/lib/tax.lib.php index 490b95cc92d..c8c7ee86e85 100644 --- a/htdocs/core/lib/tax.lib.php +++ b/htdocs/core/lib/tax.lib.php @@ -71,6 +71,11 @@ function tax_prepare_head(ChargeSociales $object) $head[$h][2] = 'info'; $h++; + $head[$h][0] = DOL_URL_ROOT.'/compta/sociales/note.php?id='.$object->id; + $head[$h][1] = $langs->trans("Notes"); + $head[$h][2] = 'note'; + $h++; + complete_head_from_modules($conf, $langs, $object, $head, $h, 'tax', 'remove'); return $head; diff --git a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql index 3f313c180eb..e11fd27a5d2 100644 --- a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql +++ b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql @@ -280,3 +280,7 @@ ALTER TABLE llx_propal ADD last_main_doc VARCHAR(255) NULL AFTER model_pdf; UPDATE llx_c_country SET eec=0 WHERE eec IS NULL; ALTER TABLE llx_c_country MODIFY COLUMN eec tinyint DEFAULT 0 NOT NULL; + +ALTER TABLE llx_chargesociales ADD COLUMN note_private text; +ALTER TABLE llx_chargesociales ADD COLUMN note_public text; + diff --git a/htdocs/install/mysql/tables/llx_chargesociales.key.sql b/htdocs/install/mysql/tables/llx_chargesociales.key.sql new file mode 100644 index 00000000000..8815b87c65c --- /dev/null +++ b/htdocs/install/mysql/tables/llx_chargesociales.key.sql @@ -0,0 +1,20 @@ +-- =================================================================== +-- Copyright (C) 2022 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 . +-- +-- =================================================================== + + +--ALTER TABLE llx_chargesociales ADD INDEX idx_chargesociales (ref); diff --git a/htdocs/install/mysql/tables/llx_chargesociales.sql b/htdocs/install/mysql/tables/llx_chargesociales.sql index 220c85410ce..93640a930b3 100644 --- a/htdocs/install/mysql/tables/llx_chargesociales.sql +++ b/htdocs/install/mysql/tables/llx_chargesociales.sql @@ -3,6 +3,7 @@ -- Copyright (C) 2005-2009 Regis Houssin -- Copyright (C) 2017 Alexandre Spangaro -- Copyright (C) 2021 Gauthier VERDOL +-- Copyright (C) 2022 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 @@ -40,6 +41,8 @@ create table llx_chargesociales paye smallint default 0 NOT NULL, periode date, fk_projet integer DEFAULT NULL, + note_private text, + note_public text, import_key varchar(14) )ENGINE=innodb; diff --git a/htdocs/modulebuilder/template/myobject_note.php b/htdocs/modulebuilder/template/myobject_note.php index 9c6831e5c7b..bda60f90d52 100644 --- a/htdocs/modulebuilder/template/myobject_note.php +++ b/htdocs/modulebuilder/template/myobject_note.php @@ -146,7 +146,8 @@ $form = new Form($db); //$help_url='EN:Customers_Orders|FR:Commandes_Clients|ES:Pedidos de clientes'; $help_url = ''; -llxHeader('', $langs->trans('MyObject'), $help_url); +$title = $langs->trans('MyObject').' - '.$langs->trans("Notes"); +llxHeader('', $title, $help_url); if ($id > 0 || !empty($ref)) { $object->fetch_thirdparty(); From 2367f0d030f1d0bcde970f86b8b36510357eca7c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 13 Mar 2022 18:39:45 +0100 Subject: [PATCH 155/610] Fix missing badge --- htdocs/compta/sociales/note.php | 4 ++-- htdocs/core/lib/tax.lib.php | 15 ++++++++++++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/sociales/note.php b/htdocs/compta/sociales/note.php index f7850287c1e..cf9d0cbdec5 100644 --- a/htdocs/compta/sociales/note.php +++ b/htdocs/compta/sociales/note.php @@ -101,7 +101,7 @@ if ($id > 0 || !empty($ref)) { $proj->fetch($object->fk_project); $morehtmlref .= ' : '.$proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); } } else { $morehtmlref .= ''; @@ -113,7 +113,7 @@ if ($id > 0 || !empty($ref)) { // ------------------------------------------------------------ $linkback = ''.$langs->trans("BackToList").''; - $object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status + //$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright); diff --git a/htdocs/core/lib/tax.lib.php b/htdocs/core/lib/tax.lib.php index c8c7ee86e85..cab5d434d53 100644 --- a/htdocs/core/lib/tax.lib.php +++ b/htdocs/core/lib/tax.lib.php @@ -66,16 +66,29 @@ function tax_prepare_head(ChargeSociales $object) $head[$h][2] = 'documents'; $h++; + $head[$h][0] = DOL_URL_ROOT.'/compta/sociales/info.php?id='.$object->id; $head[$h][1] = $langs->trans("Info"); $head[$h][2] = 'info'; $h++; + + $nbNote = 0; + if (!empty($object->note_private)) { + $nbNote++; + } + if (!empty($object->note_public)) { + $nbNote++; + } $head[$h][0] = DOL_URL_ROOT.'/compta/sociales/note.php?id='.$object->id; - $head[$h][1] = $langs->trans("Notes"); + $head[$h][1] = $langs->trans('Notes'); + if ($nbNote > 0) { + $head[$h][1] .= (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? ''.$nbNote.'' : ''); + } $head[$h][2] = 'note'; $h++; + complete_head_from_modules($conf, $langs, $object, $head, $h, 'tax', 'remove'); return $head; From 22fb2845ae44f365239467c896ddc17bae7482b6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 13 Mar 2022 18:40:43 +0100 Subject: [PATCH 156/610] Fix position of tabs --- htdocs/core/lib/tax.lib.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/core/lib/tax.lib.php b/htdocs/core/lib/tax.lib.php index cab5d434d53..a0602dfd74e 100644 --- a/htdocs/core/lib/tax.lib.php +++ b/htdocs/core/lib/tax.lib.php @@ -67,12 +67,6 @@ function tax_prepare_head(ChargeSociales $object) $h++; - $head[$h][0] = DOL_URL_ROOT.'/compta/sociales/info.php?id='.$object->id; - $head[$h][1] = $langs->trans("Info"); - $head[$h][2] = 'info'; - $h++; - - $nbNote = 0; if (!empty($object->note_private)) { $nbNote++; @@ -89,6 +83,12 @@ function tax_prepare_head(ChargeSociales $object) $h++; + $head[$h][0] = DOL_URL_ROOT.'/compta/sociales/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, 'tax', 'remove'); return $head; From 44b6f8a48d9b1c1495a7d353fc58cd7b183c5b66 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 14 Mar 2022 09:20:10 +0100 Subject: [PATCH 157/610] FIX avoid php warning --- .../contract/doc/pdf_strato.modules.php | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/htdocs/core/modules/contract/doc/pdf_strato.modules.php b/htdocs/core/modules/contract/doc/pdf_strato.modules.php index 69a4d5ce96e..67dca0ecf1b 100644 --- a/htdocs/core/modules/contract/doc/pdf_strato.modules.php +++ b/htdocs/core/modules/contract/doc/pdf_strato.modules.php @@ -321,28 +321,28 @@ class pdf_strato extends ModelePDFContract // Description of product line - if ($objectligne->date_ouverture_prevue) { - $datei = dol_print_date($objectligne->date_ouverture_prevue, 'day', false, $outputlangs, true); + if (!empty($objectligne->date_start)) { + $datei = dol_print_date((int) $objectligne->date_start, 'day', false, $outputlangs, true); } else { $datei = $langs->trans("Unknown"); } - if ($objectligne->date_fin_validite) { - $durationi = convertSecondToTime($objectligne->date_fin_validite - $objectligne->date_ouverture_prevue, 'allwithouthour'); - $datee = dol_print_date($objectligne->date_fin_validite, 'day', false, $outputlangs, true); + if (!empty($objectligne->date_end)) { + $durationi = convertSecondToTime((int) $objectligne->date_end - (int) $objectligne->date_start, 'allwithouthour'); + $datee = dol_print_date($objectligne->date_end, 'day', false, $outputlangs, true); } else { $durationi = $langs->trans("Unknown"); $datee = $langs->trans("Unknown"); } - if ($objectligne->date_ouverture) { - $daters = dol_print_date($objectligne->date_ouverture, 'day', false, $outputlangs, true); + if (!empty($objectligne->date_start_real)) { + $daters = dol_print_date((int) $objectligne->date_start_real, 'day', false, $outputlangs, true); } else { $daters = $langs->trans("Unknown"); } - if ($objectligne->date_cloture) { - $datere = dol_print_date($objectligne->date_cloture, 'day', false, $outputlangs, true); + if (!empty($objectligne->date_end_real)) { + $datere = dol_print_date((int) $objectligne->date_end_real, 'day', false, $outputlangs, true); } else { $datere = $langs->trans("Unknown"); } @@ -363,7 +363,7 @@ class pdf_strato extends ModelePDFContract if (empty($conf->global->CONTRACT_HIDE_REAL_DATE_ON_PDF)) { $txt .= '
'; $txt .= $outputlangs->transnoentities("DateStartRealShort")." : ".$daters.''; - if ($objectligne->date_cloture) { + if (!empty($objectligne->date_end_real)) { $txt .= " - ".$outputlangs->transnoentities("DateEndRealShort")." : ''".$datere.''; } } From 3eebbc0b14c8eb9f4d5a283651eb61b531ac9e29 Mon Sep 17 00:00:00 2001 From: daraelmin Date: Mon, 14 Mar 2022 09:24:26 +0100 Subject: [PATCH 158/610] Fix #20263 Accountancy setup displayed with right Fix #20263 Accountancy setup is displayed only for user with rights->accounting->chartofaccount --- htdocs/accountancy/index.php | 151 ++++++++++++++++++----------------- 1 file changed, 76 insertions(+), 75 deletions(-) diff --git a/htdocs/accountancy/index.php b/htdocs/accountancy/index.php index f44b5bc72f8..c71e51ed427 100644 --- a/htdocs/accountancy/index.php +++ b/htdocs/accountancy/index.php @@ -93,88 +93,89 @@ if ($conf->accounting->enabled) print '
'; // hideobject is to start hidden print "
\n"; print ''.$langs->trans("AccountancyAreaDescIntro")."
\n"; - print "
\n"; print "
\n"; + if (!empty($user->rights->accounting->chartofaccount)){ + print "
\n"; print "
\n"; - print load_fiche_titre(' '.$langs->trans("AccountancyAreaDescActionOnce"), '', '')."\n"; - print '
'; - print "
\n"; + print load_fiche_titre(' '.$langs->trans("AccountancyAreaDescActionOnce"), '', '')."\n"; + print '
'; + print "
\n"; - // STEPS - $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescJournalSetup", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("AccountingJournals").''); - print "
\n"; - $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChartModel", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Pcg_version").''); - print "
\n"; - $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChart", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Chartofaccounts").''); - print "
\n"; + // STEPS + $step++; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescJournalSetup", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("AccountingJournals").''); + print "
\n"; + $step++; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChartModel", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Pcg_version").''); + print "
\n"; + $step++; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChart", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Chartofaccounts").''); + print "
\n"; - print "
\n"; - print $langs->trans("AccountancyAreaDescActionOnceBis"); - print "
\n"; - print "
\n"; + print "
\n"; + print $langs->trans("AccountancyAreaDescActionOnceBis"); + print "
\n"; + print "
\n"; - $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDefault", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").''); - print "
\n"; + $step++; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDefault", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").''); + print "
\n"; - $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBank", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuBankAccounts").'')."\n"; - print "
\n"; + $step++; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBank", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuBankAccounts").'')."\n"; + print "
\n"; - $step++; - $textlink = ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuVatAccounts").''; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescVat", $step, $textlink); - print "
\n"; - if (!empty($conf->tax->enabled)) - { - $textlink = ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuTaxAccounts").''; - $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescContrib", $step, $textlink); - print "
\n"; + $step++; + $textlink = ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuVatAccounts").''; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescVat", $step, $textlink); + print "
\n"; + if (!empty($conf->tax->enabled)) + { + $textlink = ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuTaxAccounts").''; + $step++; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescContrib", $step, $textlink); + print "
\n"; + } + /*if (! empty($conf->salaries->enabled)) + { + $step++; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescSal", $step, ''.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").''); + // htdocs/admin/salaries.php + print "
\n"; + print "
\n"; + }*/ + if (!empty($conf->expensereport->enabled)) // TODO Move this in the default account page because this is only one accounting account per purpose, not several. + { + $step++; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescExpenseReport", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuExpenseReportAccounts").''); + print "
\n"; + } + /* + if (! empty($conf->loan->enabled)) + { + $step++; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescLoan", $step, ''.$langs->transnoentitiesnoconv("MenuSpecialExpenses").' - '.$langs->transnoentitiesnoconv("Loans").' '.$langs->transnoentitiesnoconv("or").' '.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").''); + print "
\n"; + } + if (! empty($conf->don->enabled)) + { + $step++; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDonation", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").''); + print "
\n"; + } + if (! empty($conf->adherents->enabled)) + { + $step++; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescSubscription", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").''); + print "
\n"; + }*/ + + $step++; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescProd", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("ProductsBinding").''); + print "
\n"; + + print '
'; } - /*if (! empty($conf->salaries->enabled)) - { - $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescSal", $step, ''.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").''); - // htdocs/admin/salaries.php - print "
\n"; - print "
\n"; - }*/ - if (!empty($conf->expensereport->enabled)) // TODO Move this in the default account page because this is only one accounting account per purpose, not several. - { - $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescExpenseReport", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuExpenseReportAccounts").''); - print "
\n"; - } - /* - if (! empty($conf->loan->enabled)) - { - $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescLoan", $step, ''.$langs->transnoentitiesnoconv("MenuSpecialExpenses").' - '.$langs->transnoentitiesnoconv("Loans").' '.$langs->transnoentitiesnoconv("or").' '.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").''); - print "
\n"; - } - if (! empty($conf->don->enabled)) - { - $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDonation", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").''); - print "
\n"; - } - if (! empty($conf->adherents->enabled)) - { - $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescSubscription", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").''); - print "
\n"; - }*/ - - $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescProd", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("ProductsBinding").''); - print "
\n"; - - - print '
'; - + // Step A - E print "
\n"; From 19be5f662d9fdbdb443a665da539519778fa0084 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Mon, 14 Mar 2022 08:25:15 +0000 Subject: [PATCH 159/610] Fixing style errors. --- htdocs/accountancy/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/index.php b/htdocs/accountancy/index.php index c71e51ed427..b0305050840 100644 --- a/htdocs/accountancy/index.php +++ b/htdocs/accountancy/index.php @@ -175,7 +175,7 @@ if ($conf->accounting->enabled) print '
'; } - + // Step A - E print "
\n"; From 6ffa4fa7cedb482417084de1e60d700d05a8b998 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 14 Mar 2022 11:19:08 +0100 Subject: [PATCH 160/610] Fix setup when js disabled. --- htdocs/product/admin/product.php | 47 ++++++++++++++++++++------------ 1 file changed, 30 insertions(+), 17 deletions(-) diff --git a/htdocs/product/admin/product.php b/htdocs/product/admin/product.php index e2e06bef551..eeeaa094f29 100644 --- a/htdocs/product/admin/product.php +++ b/htdocs/product/admin/product.php @@ -144,16 +144,17 @@ if ($action == 'other') { $value = GETPOST('activate_usesearchtoselectproduct', 'alpha'); $res = dolibarr_set_const($db, "PRODUIT_USE_SEARCH_TO_SELECT", $value, 'chaine', 0, '', $conf->entity); - $value = GETPOST('activate_useProdFournDesc', 'alpha'); - $res = dolibarr_set_const($db, "PRODUIT_FOURN_TEXTS", $value, 'chaine', 0, '', $conf->entity); - $value = GETPOST('activate_FillProductDescAuto', 'alpha'); $res = dolibarr_set_const($db, "PRODUIT_AUTOFILL_DESC", $value, 'chaine', 0, '', $conf->entity); - $value = GETPOST('activate_useProdSupplierPackaging', 'alpha'); + $value = GETPOST('PRODUIT_FOURN_TEXTS', 'alpha'); + $res = dolibarr_set_const($db, "PRODUIT_FOURN_TEXTS", $value, 'chaine', 0, '', $conf->entity); + + $value = GETPOST('PRODUCT_USE_SUPPLIER_PACKAGING', 'alpha'); $res = dolibarr_set_const($db, "PRODUCT_USE_SUPPLIER_PACKAGING", $value, 'chaine', 0, '', $conf->entity); } + if ($action == 'specimen') { // For products $modele = GETPOST('module', 'alpha'); @@ -233,12 +234,22 @@ if ($action == 'set') { } } -//if ($action == 'other') -//{ -// $value = GETPOST('activate_units', 'alpha'); -// $res = dolibarr_set_const($db, "PRODUCT_USE_UNITS", $value, 'chaine', 0, '', $conf->entity); -// if (! $res > 0) $error++; -//} +// To enable a constant whithout javascript +if (preg_match('/set_(.+)/', $action, $reg)) { + $keyforvar = $reg[1]; + if ($keyforvar) { + $value = 1; + $res = dolibarr_set_const($db, $keyforvar, $value, 'chaine', 0, '', $conf->entity); + } +} + +// To disable a constant whithout javascript +if (preg_match('/del_(.+)/', $action, $reg)) { + $keyforvar = $reg[1]; + if ($keyforvar) { + $res = dolibarr_del_const($db, $keyforvar, $conf->entity); + } +} if ($action) { if (!$error) { @@ -573,7 +584,7 @@ print '
'.$langs->trans("MultiPricesNumPrices").'
'.$langs->trans("UseProductFournDesc").''; - print $form->selectyesno("activate_useProdFournDesc", (!empty($conf->global->PRODUIT_FOURN_TEXTS) ? $conf->global->PRODUIT_FOURN_TEXTS : 0), 1); + print ''.$langs->trans("UseProductSupplierPackaging").''; + print ajax_constantonoff("PRODUCT_USE_SUPPLIER_PACKAGING", array(), $conf->entity, 0, 0, 0, 0); + //print $form->selectyesno("activate_useProdSupplierPackaging", (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING) ? $conf->global->PRODUCT_USE_SUPPLIER_PACKAGING : 0), 1); print '
'.$langs->trans("UseProductSupplierPackaging").''; - print $form->selectyesno("activate_useProdSupplierPackaging", (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING) ? $conf->global->PRODUCT_USE_SUPPLIER_PACKAGING : 0), 1); + print ''.$langs->trans("UseProductFournDesc").''; + print ajax_constantonoff("PRODUIT_FOURN_TEXTS", array(), $conf->entity, 0, 0, 0, 0); + //print $form->selectyesno("activate_useProdFournDesc", (!empty($conf->global->PRODUIT_FOURN_TEXTS) ? $conf->global->PRODUIT_FOURN_TEXTS : 0), 1); print '
'.$langs->trans("PriceQtyMinCurrency").'
'.$form->textwithpicto($langs->trans("PriceQtyMinCurrency"), $langs->transnoentitiesnoconv("WithoutDiscount")).''; print ' '; @@ -673,7 +675,7 @@ if ($id > 0 || $ref) { print '
'.$langs->trans("PriceQtyMin").'
'.$form->textwithpicto($langs->trans("PriceQtyMin"), $langs->transnoentitiesnoconv("WithoutDiscount")).''; print ''; print ''; From 8d11813ea5fbefc3cfbb6e3295dc8fd5fcfc8d3d Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Mon, 14 Mar 2022 11:45:23 +0100 Subject: [PATCH 162/610] fix security problems and add zstd support --- htdocs/core/lib/files.lib.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 86c740c4f44..37bc946a8b6 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -2146,22 +2146,24 @@ function dol_uncompress($inputfile, $outputdir) } return array('error'=>'ErrNoZipEngine'); - } elseif ($fileinfo["extension"] == "gz" || $fileinfo["extension"] == "bz2") { + } elseif (in_array($fileinfo["extension"], array('gz','bz2','zst'))) { $extension = pathinfo($fileinfo["filename"], PATHINFO_EXTENSION); if ($extension == "tar") { - $cmd = "tar -C ".$outputdir." -xvf ".$fileinfo["dirname"]."/".$fileinfo["basename"]; + $cmd = 'tar -C '.escapeshellcmd(dol_sanitizePathName($outputdir)).' -xvf '.escapeshellcmd(dol_sanitizePathName($fileinfo["dirname"]).'/'.dol_sanitizeFileName($fileinfo["basename"])); $resarray = $utils->executeCLI($cmd, $outputdir); } else { $program = ""; if ($fileinfo["extension"] == "gz") { - $program = "gzip"; + $program = 'gzip'; } elseif ($fileinfo["extension"] == "bz2") { - $program = "bzip2"; + $program = 'bzip2'; + } elseif ($fileinfo["extension"] == "zst") { + $program = 'zstd'; } else { return array('error'=>'ErrFileExtension'); } - $cmd = $program." -dc ".$fileinfo["dirname"]."/".$fileinfo["basename"]; - $outputfilename = $outputdir."/".$fileinfo["filename"]; + $cmd = $program.' -dc '.escapeshellcmd(dol_sanitizePathName($fileinfo["dirname"]).'/'.dol_sanitizeFileName($fileinfo["basename"])); + $outputfilename = escapeshellcmd(dol_sanitizePathName($outputdir).'/'.dol_sanitizeFileName($fileinfo["filename"])); $resarray = $utils->executeCLI($cmd, $outputfilename, 0, $outputfilename); if ($resarray["output"] == 2) { $resarray["error"] = "ErrFilePermOrFileNotFound"; From 57c0e7109af25aee84328adc6b2373970c6ab28c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 14 Mar 2022 14:35:06 +0100 Subject: [PATCH 163/610] Fix parntership module --- htdocs/partnership/class/partnership.class.php | 4 ++-- htdocs/partnership/class/partnership_type.class.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/partnership/class/partnership.class.php b/htdocs/partnership/class/partnership.class.php index adc9e115aa5..45f4decc740 100644 --- a/htdocs/partnership/class/partnership.class.php +++ b/htdocs/partnership/class/partnership.class.php @@ -106,7 +106,7 @@ class Partnership extends CommonObject 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"), 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>10, 'notnull'=>1, 'visible'=>4, 'noteditable'=>'1', 'default'=>'(PROV)', 'index'=>1, 'searchall'=>1, 'showoncombobox'=>'1', 'comment'=>"Reference of object"), 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => 1, 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 15, 'index' => 1), - 'fk_type' => array('type' => 'integer:PartnershipType:partnership/class/partnership_type.class.php', 'label' => 'Type', 'notnull'=>1, 'enabled' => 1, 'visible' => 1, 'position' => 20), + 'fk_type' => array('type' => 'integer:PartnershipType:partnership/class/partnership_type.class.php:0:active=1', 'label' => 'Type', 'notnull'=>1, 'enabled' => 1, 'visible' => 1, 'position' => 20), 'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>'1', 'position'=>61, 'notnull'=>0, 'visible'=>0,), 'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>'1', 'position'=>62, 'notnull'=>0, 'visible'=>0,), 'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>'1', 'position'=>500, 'notnull'=>1, 'visible'=>-2,), @@ -201,7 +201,7 @@ class Partnership extends CommonObject if (!empty($conf->global->PARTNERSHIP_IS_MANAGED_FOR) && $conf->global->PARTNERSHIP_IS_MANAGED_FOR == 'member') { $this->fields['fk_member'] = array('type'=>'integer:Adherent:adherents/class/adherent.class.php:1', 'label'=>'Member', 'enabled'=>'1', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'picto'=>'member', 'csslist'=>'tdoverflowmax150'); } else { - $this->fields['fk_soc'] = array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'enabled'=>'1', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'picto'=>'company', 'csslist'=>'tdoverflowmax150'); + $this->fields['fk_soc'] = array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'enabled'=>'1', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'picto'=>'company', 'css'=>'maxwidth500', 'csslist'=>'tdoverflowmax150'); } if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) { diff --git a/htdocs/partnership/class/partnership_type.class.php b/htdocs/partnership/class/partnership_type.class.php index 6916d95e4f3..536ccdf0c88 100644 --- a/htdocs/partnership/class/partnership_type.class.php +++ b/htdocs/partnership/class/partnership_type.class.php @@ -69,7 +69,7 @@ class PartnershipType extends CommonObject public $fields=array( 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10), 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>15, 'index'=>1), - 'code' =>array('type'=>'varchar(32)', 'label'=>'Code', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>20, 'showoncombobox'=>1), + 'code' =>array('type'=>'varchar(32)', 'label'=>'Code', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>20), 'label' =>array('type'=>'varchar(64)', 'label'=>'Label', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>25, 'showoncombobox'=>1), 'active' =>array('type'=>'integer', 'label'=>'Active', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>30), ); From 1a20afe29b7ce023ddc3574a11c4f35b3dc93acf Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Mon, 14 Mar 2022 16:11:34 +0100 Subject: [PATCH 164/610] Fix #20351 : top navbar no longer hiden in extarnal site --- htdocs/core/js/lib_head.js.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/js/lib_head.js.php b/htdocs/core/js/lib_head.js.php index c0d4f0f3829..3037fe29c4f 100644 --- a/htdocs/core/js/lib_head.js.php +++ b/htdocs/core/js/lib_head.js.php @@ -1138,7 +1138,7 @@ $(document).ready(function() { // Force to hide menus when page is inside an iFrame $(document).ready(function() { - if (window.location !== window.parent.location ) { + if (window.location.pathname.indexOf("externalsite/frametop.php") == -1 &&window.location !== window.parent.location ) { console.log("Page is detected to be into an iframe, we hide by CSS the menus"); // The page is in an iframe jQuery(".side-nav-vert, .side-nav, .websitebar").hide(); From f789fc24f7807dd02571d8d0eedc57c4d66fb82c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 14 Mar 2022 16:20:57 +0100 Subject: [PATCH 165/610] Fix filter --- htdocs/core/js/lib_head.js.php | 2 +- htdocs/ecm/class/ecmfiles.class.php | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/htdocs/core/js/lib_head.js.php b/htdocs/core/js/lib_head.js.php index 68bb8236d72..5606586a6e2 100644 --- a/htdocs/core/js/lib_head.js.php +++ b/htdocs/core/js/lib_head.js.php @@ -1167,7 +1167,7 @@ $(document).ready(function() { }); -// Force to hide menus when page is inside an iFrame +// Force to hide menus when page is inside an iFrame so we can show any page into a dialog popup $(document).ready(function() { if (window.location !== window.parent.location ) { console.log("Page is detected to be into an iframe, we hide by CSS the menus"); diff --git a/htdocs/ecm/class/ecmfiles.class.php b/htdocs/ecm/class/ecmfiles.class.php index 1ffe39f26ce..3fe71278101 100644 --- a/htdocs/ecm/class/ecmfiles.class.php +++ b/htdocs/ecm/class/ecmfiles.class.php @@ -369,7 +369,7 @@ class EcmFiles extends CommonObject * @param string $ref Hash of file name (filename+filepath). Not always defined on some version. * @param string $relativepath Relative path of file from document directory. Example: 'path/path2/file' or 'path/path2/*' * @param string $hashoffile Hash of file content. Take the first one found if same file is at different places. This hash will also change if file content is changed. - * @param string $hashforshare Hash of file sharing. + * @param string $hashforshare Hash of file sharing or 'shared' * @param string $src_object_type src_object_type to search (value of object->table_element) * @param string $src_object_id src_object_id to search * @return int <0 if KO, 0 if not found, >0 if OK @@ -425,12 +425,16 @@ class EcmFiles extends CommonObject $sql .= " AND t.label = '".$this->db->escape($hashoffile)."'"; $sql .= " AND t.entity = ".$conf->entity; // unique key include the entity so each company has its own index } elseif (!empty($hashforshare)) { - $sql .= " AND t.share = '".$this->db->escape($hashforshare)."'"; + if ($hashforshare != 'shared') { + $sql .= " AND t.share = '".$this->db->escape($hashforshare)."'"; + } else { + $sql .= " AND t.share IS NOT NULL AND t.share <> ''"; + } //$sql .= " AND t.entity = ".$conf->entity; // hashforshare already unique } elseif ($src_object_type && $src_object_id) { // Warning: May return several record, and only first one is returned ! $sql .= " AND t.src_object_type = '".$this->db->escape($src_object_type)."' AND t.src_object_id = ".((int) $src_object_id); - $sql .= " AND t.entity = ".$conf->entity; + $sql .= " AND t.entity = ".((int) $conf->entity); } else { $sql .= ' AND t.rowid = '.((int) $id); // rowid already unique } From 22706b70e9fde88e7a31e1d19a035fd4714dafaa Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Mon, 14 Mar 2022 16:21:12 +0100 Subject: [PATCH 166/610] fix syntax error --- htdocs/core/js/lib_head.js.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/js/lib_head.js.php b/htdocs/core/js/lib_head.js.php index 3037fe29c4f..53e89182227 100644 --- a/htdocs/core/js/lib_head.js.php +++ b/htdocs/core/js/lib_head.js.php @@ -1138,7 +1138,7 @@ $(document).ready(function() { // Force to hide menus when page is inside an iFrame $(document).ready(function() { - if (window.location.pathname.indexOf("externalsite/frametop.php") == -1 &&window.location !== window.parent.location ) { + if (window.location.pathname.indexOf("externalsite/frametop.php") == -1 && window.location !== window.parent.location ) { console.log("Page is detected to be into an iframe, we hide by CSS the menus"); // The page is in an iframe jQuery(".side-nav-vert, .side-nav, .websitebar").hide(); From 1555a95ce881bcc8c278c43426c98d784fa63226 Mon Sep 17 00:00:00 2001 From: steve Date: Mon, 14 Mar 2022 16:50:43 +0100 Subject: [PATCH 167/610] Activate new rights read and write --- htdocs/core/modules/modHRM.class.php | 16 ++++++ htdocs/langs/en_US/admin.lang | 2 + htdocs/user/bank.php | 86 ++++++++++++++++------------ 3 files changed, 66 insertions(+), 38 deletions(-) diff --git a/htdocs/core/modules/modHRM.class.php b/htdocs/core/modules/modHRM.class.php index 3e75f8efcd5..35deea09a07 100644 --- a/htdocs/core/modules/modHRM.class.php +++ b/htdocs/core/modules/modHRM.class.php @@ -249,6 +249,22 @@ class modHRM extends DolibarrModules $this->rights[$r][4] = 'compare_advance'; $this->rights[$r][5] = 'read'; // In php code, permission will be checked by test if ($user->rights->hrm->compare_advance->read) $r++; + + // Read employee + $this->rights[$r][0] = 4031; // Permission id (must not be already used) + $this->rights[$r][1] = 'Read employee'; // Permission label + $this->rights[$r][3] = 0; // Permission by default for new user (0/1) + $this->rights[$r][4] = 'read_employee'; + $this->rights[$r][5] = 'read'; // In php code, permission will be checked by test if ($user->rights->hrm->read_employee->read) + $r++; + + // Write employee + $this->rights[$r][0] = 4032; // Permission id (must not be already used) + $this->rights[$r][1] = 'Write employee'; // Permission label + $this->rights[$r][3] = 0; // Permission by default for new user (0/1) + $this->rights[$r][4] = 'write_employee'; + $this->rights[$r][5] = 'write'; // In php code, permission will be checked by test if ($user->rights->hrm->write_employee->write) + $r++; } /** diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index cffd3532c05..6674f6cb58a 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -969,6 +969,8 @@ Permission4021=Create/modify your evaluation Permission4022=Validate evaluation Permission4023=Delete evaluation Permission4030=See comparison menu +Permission4031=Read employee +Permission4032=Write employee Permission10001=Read website content Permission10002=Create/modify website content (html and javascript content) Permission10003=Create/modify website content (dynamic php code). Dangerous, must be reserved to restricted developers. diff --git a/htdocs/user/bank.php b/htdocs/user/bank.php index 38b6066e9d2..d9bbb16f3aa 100644 --- a/htdocs/user/bank.php +++ b/htdocs/user/bank.php @@ -78,8 +78,8 @@ if (empty($account->userid)) { // Define value to know what current user can do on users -$canadduser = (!empty($user->admin) || $user->rights->user->user->creer); -$canreaduser = (!empty($user->admin) || $user->rights->user->user->lire); +$canadduser = (!empty($user->admin) || $user->rights->user->user->creer || $user->rights->hrm->write_employee->write); +$canreaduser = (!empty($user->admin) || $user->rights->user->user->lire || $user->rights->hrm->read_employee->read); $permissiontoaddbankaccount = (!empty($user->rights->salaries->write) || !empty($user->rights->hrm->employee->write) || !empty($user->rights->user->creer)); // Ok if user->rights->salaries->read or user->rights->hrm->read @@ -281,7 +281,7 @@ llxHeader(null, $langs->trans("BankAccounts")); $head = user_prepare_head($object); -if ($id && $bankid && $action == 'edit' && $user->rights->user->user->creer) { +if ($id && $bankid && $action == 'edit' && ($user->rights->user->user->creer || $user->rights->hrm->write_employee->write)) { print '
'; print ''; print ''; @@ -446,31 +446,37 @@ if ($action != 'edit' && $action != 'create') { // If not bank account yet, $ac print "
'; - print $form->editfieldkey("DateOfBirth", 'birth', $object->birth, $object, $user->rights->user->user->creer); - print ''; - print $form->editfieldval("DateOfBirth", 'birth', $object->birth, $object, $user->rights->user->user->creer, 'day', $object->birth); - print '
'; + print $form->editfieldkey("DateOfBirth", 'birth', $object->birth, $object, $user->rights->user->user->creer); + print ''; + print $form->editfieldval("DateOfBirth", 'birth', $object->birth, $object, $user->rights->user->user->creer, 'day', $object->birth); + print '
'; - print $form->editfieldkey("UserPersonalEmail", 'personal_email', $object->personal_email, $object, $user->rights->user->user->creer); - print ''; - print $form->editfieldval("UserPersonalEmail", 'personal_email', $object->personal_email, $object, $user->rights->user->user->creer, 'email', '', null, null, '', 0, 'dol_print_email'); - print '
'; + print $form->editfieldkey("UserPersonalEmail", 'personal_email', $object->personal_email, $object, $user->rights->user->user->creer || $user->rights->hrm->write_employee->write); + print ''; + print $form->editfieldval("UserPersonalEmail", 'personal_email', $object->personal_email, $object, $user->rights->user->user->creer || $user->rights->hrm->write_employee->write, 'email', '', null, null, '', 0, 'dol_print_email'); + print '
'; - print $form->editfieldkey("UserPersonalMobile", 'personal_mobile', $object->personal_mobile, $object, $user->rights->user->user->creer); - print ''; - print $form->editfieldval("UserPersonalMobile", 'personal_mobile', $object->personal_mobile, $object, $user->rights->user->user->creer, 'string', '', null, null, '', 0, 'dol_print_phone'); - print '
'; + print $form->editfieldkey("UserPersonalMobile", 'personal_mobile', $object->personal_mobile, $object, $user->rights->user->user->creer || $user->rights->hrm->write_employee->write); + print ''; + print $form->editfieldval("UserPersonalMobile", 'personal_mobile', $object->personal_mobile, $object, $user->rights->user->user->creer || $user->rights->hrm->write_employee->write, 'string', '', null, null, '', 0, 'dol_print_phone'); + print '
'; - print $form->editfieldkey("RefEmployee", 'ref_employee', $object->ref_employee, $object, $user->rights->user->user->creer); - print ''; - print $form->editfieldval("RefEmployee", 'ref_employee', $object->ref_employee, $object, $user->rights->user->user->creer, 'string', $object->ref_employee); - print '
'; + print $form->editfieldkey("RefEmployee", 'ref_employee', $object->ref_employee, $object, $user->rights->user->user->creer || $user->rights->hrm->write_employee->write); + print ''; + print $form->editfieldval("RefEmployee", 'ref_employee', $object->ref_employee, $object, $user->rights->user->user->creer || $user->rights->hrm->write_employee->write, 'string', $object->ref_employee); + print '
'; - print $form->editfieldkey("NationalRegistrationNumber", 'national_registration_number', $object->national_registration_number, $object, $user->rights->user->user->creer); - print ''; - print $form->editfieldval("NationalRegistrationNumber", 'national_registration_number', $object->national_registration_number, $object, $user->rights->user->user->creer, 'string', $object->national_registration_number); - print '
'; + print $form->editfieldkey("NationalRegistrationNumber", 'national_registration_number', $object->national_registration_number, $object, $user->rights->user->user->creer || $user->rights->hrm->write_employee->write); + print ''; + print $form->editfieldval("NationalRegistrationNumber", 'national_registration_number', $object->national_registration_number, $object, $user->rights->user->user->creer || $user->rights->hrm->write_employee->write, 'string', $object->national_registration_number); + print '
'; From 207aba2e9895a4697632d8c7ad95a5dfb9bfb86e Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Mon, 14 Mar 2022 17:59:18 +0100 Subject: [PATCH 168/610] FIX: Stock move on shipment close and reception close also moves lot/serial type. --- htdocs/core/class/conf.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 60ee78bbff5..023546494b6 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -532,15 +532,15 @@ class Conf if (!empty($this->productbatch->enabled)) { $this->global->STOCK_CALCULATE_ON_BILL = 0; $this->global->STOCK_CALCULATE_ON_VALIDATE_ORDER = 0; - $this->global->STOCK_CALCULATE_ON_SHIPMENT = 1; - $this->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE = 0; + if (empty($this->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE)) $this->global->STOCK_CALCULATE_ON_SHIPMENT = 1; + if (empty($this->global->STOCK_CALCULATE_ON_SHIPMENT)) $this->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE = 1; $this->global->STOCK_CALCULATE_ON_SUPPLIER_BILL = 0; $this->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER = 0; if (empty($this->reception->enabled)) { $this->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER = 1; } else { - $this->global->STOCK_CALCULATE_ON_RECEPTION = 1; - $this->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE = 0; + if (empty($this->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE)) $this->global->STOCK_CALCULATE_ON_RECEPTION = 1; + if (empty($this->global->STOCK_CALCULATE_ON_RECEPTION)) $this->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE = 1; } } From 5fafa8b642d7ed55868c9e7633c9810fbc852677 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 15 Mar 2022 06:29:26 +0100 Subject: [PATCH 169/610] NEW Accountancy - Add subledger account when we generate a transaction with a deposit invoice --- htdocs/accountancy/journal/sellsjournal.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index 884c56ee6f2..6f2fce7c10c 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -412,8 +412,13 @@ if ($action == 'writebookkeeping') { $bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add $bookkeeping->thirdparty_code = $companystatic->code_client; - $bookkeeping->subledger_account = ''; - $bookkeeping->subledger_label = ''; + if($k == $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT) { + $bookkeeping->subledger_account = $tabcompany[$key]['code_compta']; + $bookkeeping->subledger_label = $tabcompany[$key]['name']; + } else { + $bookkeeping->subledger_account = ''; + $bookkeeping->subledger_label = ''; + } $bookkeeping->numero_compte = $k; $bookkeeping->label_compte = $label_account; @@ -886,6 +891,13 @@ if (empty($action) || $action == 'view') { print ""; // Subledger account print ""; + if($k == $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT) { + if (($accountoshow == "") || $accountoshow == 'NotDefined') { + print ''.$langs->trans("ThirdpartyAccountNotDefined").''; + } else { + print length_accounta($tabcompany[$key]['code_compta']); + } + } print ''; $companystatic->id = $tabcompany[$key]['id']; $companystatic->name = $tabcompany[$key]['name']; From 92bfd6893d84d13410591d74b52c2ec6100b376e Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 15 Mar 2022 09:10:41 +0100 Subject: [PATCH 170/610] fix:incoterm bad sql request --- htdocs/core/class/commonincoterm.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/commonincoterm.class.php b/htdocs/core/class/commonincoterm.class.php index f98f3aaabad..f349925a00a 100644 --- a/htdocs/core/class/commonincoterm.class.php +++ b/htdocs/core/class/commonincoterm.class.php @@ -122,7 +122,7 @@ trait CommonIncoterm $this->fk_incoterms = $id_incoterm; $this->location_incoterms = $location; - $sql = 'SELECT libelle as label_incotermsFROM '.MAIN_DB_PREFIX.'c_incoterms WHERE rowid = '.(int) $this->fk_incoterms; + $sql = 'SELECT libelle as label_incoterms FROM '.MAIN_DB_PREFIX.'c_incoterms WHERE rowid = '.(int) $this->fk_incoterms; $res = $this->db->query($sql); if ($res) { From 587b2076d85dc1b54e503460043b2a06c742a411 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Tue, 15 Mar 2022 08:11:44 +0000 Subject: [PATCH 171/610] Fixing style errors. --- htdocs/accountancy/journal/sellsjournal.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index 6f2fce7c10c..110919ce73b 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -412,7 +412,7 @@ if ($action == 'writebookkeeping') { $bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add $bookkeeping->thirdparty_code = $companystatic->code_client; - if($k == $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT) { + if ($k == $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT) { $bookkeeping->subledger_account = $tabcompany[$key]['code_compta']; $bookkeeping->subledger_label = $tabcompany[$key]['name']; } else { @@ -891,7 +891,7 @@ if (empty($action) || $action == 'view') { print ""; // Subledger account print ""; - if($k == $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT) { + if ($k == $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT) { if (($accountoshow == "") || $accountoshow == 'NotDefined') { print ''.$langs->trans("ThirdpartyAccountNotDefined").''; } else { From 0766355cbae1b32ab9ab5f740662391785691d4e Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Tue, 15 Mar 2022 11:04:56 +0100 Subject: [PATCH 172/610] Update llx_adherent.sql add state -2 --- htdocs/install/mysql/tables/llx_adherent.sql | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/install/mysql/tables/llx_adherent.sql b/htdocs/install/mysql/tables/llx_adherent.sql index eabb2d3c478..01a87167411 100644 --- a/htdocs/install/mysql/tables/llx_adherent.sql +++ b/htdocs/install/mysql/tables/llx_adherent.sql @@ -19,10 +19,12 @@ -- -- =================================================================== -- --- statut +-- state / statut +-- -2 : excluded / exclu -- -1 : draft / brouillon -- 0 : canceled / resilie -- 1 : valid / valide +-- create table llx_adherent ( From 0be989dceb6ed3a60859a952306d2a811b9d2105 Mon Sep 17 00:00:00 2001 From: atm-greg Date: Tue, 15 Mar 2022 11:18:11 +0100 Subject: [PATCH 173/610] add more specific context and doAction hook --- htdocs/admin/dict.php | 733 ++++++++++++++++++++++-------------------- 1 file changed, 380 insertions(+), 353 deletions(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 5245e60ad67..20b1461ad4f 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -94,7 +94,7 @@ if (!GETPOSTISSET('search_country_id') && $search_country_id == '' && ($id == 2 $search_code = GETPOST('search_code', 'alpha'); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context -$hookmanager->initHooks(array('admin')); +$hookmanager->initHooks(array('admin', 'dictionaryadmin')); // This page is a generic page to edit dictionaries // Put here declaration of dictionaries properties @@ -683,407 +683,434 @@ if ($id == 10) { * Actions */ -if (GETPOST('button_removefilter', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter_x', 'alpha')) { - $search_country_id = ''; - $search_code = ''; +$parameters = array( + 'id' =>$id, + 'rowid' =>$rowid, + 'code' =>$code, + 'confirm' =>$confirm, + 'entity' =>$entity, + 'taborder' =>$taborder, + 'tabname' =>$tabname, + 'tablib' =>$tablib, + 'tabsql' =>$tabsql, + 'tabsqlsort' =>$tabsqlsort, + 'tabfield' =>$tabfield, + 'tabfieldvalue' =>$tabfieldvalue, + 'tabfieldinsert'=>$tabfieldinsert, + 'tabrowid' =>$tabrowid, + 'tabcond' =>$tabcond, + 'tabhelp' =>$tabhelp, + 'tabcomplete' =>$tabcomplete +); +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } -// Actions add or modify an entry into a dictionary -if (GETPOST('actionadd') || GETPOST('actionmodify')) { - $listfield = explode(',', str_replace(' ', '', $tabfield[$id])); - $listfieldinsert = explode(',', $tabfieldinsert[$id]); - $listfieldmodify = explode(',', $tabfieldinsert[$id]); - $listfieldvalue = explode(',', $tabfieldvalue[$id]); - - // Check that all mandatory fields are filled - $ok = 1; - foreach ($listfield as $f => $value) { - // Discard check of mandatory fields for country for some tables - if ($value == 'country_id' && in_array($tablib[$id], array('DictionaryPublicHolidays', 'DictionaryVAT', 'DictionaryRegion', 'DictionaryCompanyType', 'DictionaryHolidayTypes', 'DictionaryRevenueStamp', 'DictionaryAccountancysystem', 'DictionaryAccountancyCategory'))) { - continue; // For some pages, country is not mandatory - } - if ($value == 'country' && in_array($tablib[$id], array('DictionaryPublicHolidays', 'DictionaryCanton', 'DictionaryCompanyType', 'DictionaryHolidayTypes', 'DictionaryRevenueStamp'))) { - continue; // For some pages, country is not mandatory - } - // Discard check of mandatory fiedls for other fields - if ($value == 'localtax1' && empty($_POST['localtax1_type'])) { - continue; - } - if ($value == 'localtax2' && empty($_POST['localtax2_type'])) { - continue; - } - if ($value == 'color' && empty($_POST['color'])) { - continue; - } - if ($value == 'formula' && empty($_POST['formula'])) { - continue; - } - if ($value == 'dayrule' && empty($_POST['dayrule'])) { - continue; - } - if ($value == 'sortorder') { - continue; // For a column name 'sortorder', we use the field name 'position' - } - if ((!GETPOSTISSET($value) || GETPOST($value) == '') - && (!in_array($value, array('decalage', 'module', 'accountancy_code', 'accountancy_code_sell', 'accountancy_code_buy', 'tracking', 'picto')) // Fields that are not mandatory - && ($id != 10 || ($value != 'code' && $value != 'note')) // Field code and note is not mandatory for dictionary table 10 - ) - ) { - $ok = 0; - $fieldnamekey = $value; - // We take translate key of field - if ($fieldnamekey == 'libelle' || ($fieldnamekey == 'label')) { - $fieldnamekey = 'Label'; - } - if ($fieldnamekey == 'libelle_facture') { - $fieldnamekey = 'LabelOnDocuments'; - } - if ($fieldnamekey == 'nbjour') { - $fieldnamekey = 'NbOfDays'; - } - if ($fieldnamekey == 'decalage') { - $fieldnamekey = 'Offset'; - } - if ($fieldnamekey == 'module') { - $fieldnamekey = 'Module'; - } - if ($fieldnamekey == 'code') { - $fieldnamekey = 'Code'; - } - if ($fieldnamekey == 'note') { - $fieldnamekey = 'Note'; - } - if ($fieldnamekey == 'taux') { - $fieldnamekey = 'Rate'; - } - if ($fieldnamekey == 'type') { - $fieldnamekey = 'Type'; - } - if ($fieldnamekey == 'position') { - $fieldnamekey = 'Position'; - } - if ($fieldnamekey == 'unicode') { - $fieldnamekey = 'Unicode'; - } - if ($fieldnamekey == 'deductible') { - $fieldnamekey = 'Deductible'; - } - if ($fieldnamekey == 'sortorder') { - $fieldnamekey = 'SortOrder'; - } - if ($fieldnamekey == 'category_type') { - $fieldnamekey = 'Calculated'; - } - if ($fieldnamekey == 'revenuestamp_type') { - $fieldnamekey = 'TypeOfRevenueStamp'; - } - if ($fieldnamekey == 'use_default') { - $fieldnamekey = 'UseByDefault'; - } - - setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors'); - } - } - // Other checks - if (GETPOST('actionadd') && $tabname[$id] == MAIN_DB_PREFIX."c_actioncomm" && GETPOSTISSET("type") && in_array(GETPOST("type"), array('system', 'systemauto'))) { - $ok = 0; - setEventMessages($langs->transnoentities('ErrorReservedTypeSystemSystemAuto'), null, 'errors'); - } - if (GETPOSTISSET("code")) { - if (GETPOST("code") == '0') { - $ok = 0; - setEventMessages($langs->transnoentities('ErrorCodeCantContainZero'), null, 'errors'); - } - /*if (!is_numeric($_POST['code'])) // disabled, code may not be in numeric base - { - $ok = 0; - $msg .= $langs->transnoentities('ErrorFieldFormat', $langs->transnoentities('Code')).'
'; - }*/ - } - if (GETPOSTISSET("country") && (GETPOST("country") == '0') && ($id != 2)) { - if (in_array($tablib[$id], array('DictionaryCompanyType', 'DictionaryHolidayTypes'))) { // Field country is no mandatory for such dictionaries - $_POST["country"] = ''; - } else { - $ok = 0; - setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities("Country")), null, 'errors'); - } - } - if (($id == 3 || $id == 42) && !is_numeric(GETPOST("code"))) { - $ok = 0; - setEventMessages($langs->transnoentities("ErrorFieldMustBeANumeric", $langs->transnoentities("Code")), null, 'errors'); +if (empty($reshook)) +{ + if (GETPOST('button_removefilter', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter_x', 'alpha')) { + $search_country_id = ''; + $search_code = ''; } - // Clean some parameters - if ((GETPOST("localtax1_type") || (GETPOST('localtax1_type') == '0')) && !GETPOST("localtax1")) { - $_POST["localtax1"] = '0'; // If empty, we force to 0 - } - if ((GETPOST("localtax2_type") || (GETPOST('localtax2_type') == '0')) && !GETPOST("localtax2")) { - $_POST["localtax2"] = '0'; // If empty, we force to 0 - } - if (GETPOST("accountancy_code") <= 0) { - $_POST["accountancy_code"] = ''; // If empty, we force to null - } - if (GETPOST("accountancy_code_sell") <= 0) { - $_POST["accountancy_code_sell"] = ''; // If empty, we force to null - } - if (GETPOST("accountancy_code_buy") <= 0) { - $_POST["accountancy_code_buy"] = ''; // If empty, we force to null - } - if ($id == 10 && GETPOSTISSET("code")) { // Spaces are not allowed into code for tax dictionary - $_POST["code"] = preg_replace('/[^a-zA-Z0-9\-\+]/', '', $_POST["code"]); - } + // Actions add or modify an entry into a dictionary + if (GETPOST('actionadd') || GETPOST('actionmodify')) { + $listfield = explode(',', str_replace(' ', '', $tabfield[$id])); + $listfieldinsert = explode(',', $tabfieldinsert[$id]); + $listfieldmodify = explode(',', $tabfieldinsert[$id]); + $listfieldvalue = explode(',', $tabfieldvalue[$id]); - // If check ok and action add, add the line - if ($ok && GETPOST('actionadd')) { - if ($tabrowid[$id]) { - // Get free id for insert - $newid = 0; - $sql = "SELECT max(".$tabrowid[$id].") newid from ".$tabname[$id]; - $result = $db->query($sql); - if ($result) { - $obj = $db->fetch_object($result); - $newid = ($obj->newid + 1); + // Check that all mandatory fields are filled + $ok = 1; + foreach ($listfield as $f => $value) { + // Discard check of mandatory fields for country for some tables + if ($value == 'country_id' && in_array($tablib[$id], array('DictionaryPublicHolidays', 'DictionaryVAT', 'DictionaryRegion', 'DictionaryCompanyType', 'DictionaryHolidayTypes', 'DictionaryRevenueStamp', 'DictionaryAccountancysystem', 'DictionaryAccountancyCategory'))) { + continue; // For some pages, country is not mandatory + } + if ($value == 'country' && in_array($tablib[$id], array('DictionaryPublicHolidays', 'DictionaryCanton', 'DictionaryCompanyType', 'DictionaryHolidayTypes', 'DictionaryRevenueStamp'))) { + continue; // For some pages, country is not mandatory + } + // Discard check of mandatory fiedls for other fields + if ($value == 'localtax1' && empty($_POST['localtax1_type'])) { + continue; + } + if ($value == 'localtax2' && empty($_POST['localtax2_type'])) { + continue; + } + if ($value == 'color' && empty($_POST['color'])) { + continue; + } + if ($value == 'formula' && empty($_POST['formula'])) { + continue; + } + if ($value == 'dayrule' && empty($_POST['dayrule'])) { + continue; + } + if ($value == 'sortorder') { + continue; // For a column name 'sortorder', we use the field name 'position' + } + if ((!GETPOSTISSET($value) || GETPOST($value) == '') + && (!in_array($value, array('decalage', 'module', 'accountancy_code', 'accountancy_code_sell', 'accountancy_code_buy', 'tracking', 'picto')) // Fields that are not mandatory + && ($id != 10 || ($value != 'code' && $value != 'note')) // Field code and note is not mandatory for dictionary table 10 + ) + ) { + $ok = 0; + $fieldnamekey = $value; + // We take translate key of field + if ($fieldnamekey == 'libelle' || ($fieldnamekey == 'label')) { + $fieldnamekey = 'Label'; + } + if ($fieldnamekey == 'libelle_facture') { + $fieldnamekey = 'LabelOnDocuments'; + } + if ($fieldnamekey == 'nbjour') { + $fieldnamekey = 'NbOfDays'; + } + if ($fieldnamekey == 'decalage') { + $fieldnamekey = 'Offset'; + } + if ($fieldnamekey == 'module') { + $fieldnamekey = 'Module'; + } + if ($fieldnamekey == 'code') { + $fieldnamekey = 'Code'; + } + if ($fieldnamekey == 'note') { + $fieldnamekey = 'Note'; + } + if ($fieldnamekey == 'taux') { + $fieldnamekey = 'Rate'; + } + if ($fieldnamekey == 'type') { + $fieldnamekey = 'Type'; + } + if ($fieldnamekey == 'position') { + $fieldnamekey = 'Position'; + } + if ($fieldnamekey == 'unicode') { + $fieldnamekey = 'Unicode'; + } + if ($fieldnamekey == 'deductible') { + $fieldnamekey = 'Deductible'; + } + if ($fieldnamekey == 'sortorder') { + $fieldnamekey = 'SortOrder'; + } + if ($fieldnamekey == 'category_type') { + $fieldnamekey = 'Calculated'; + } + if ($fieldnamekey == 'revenuestamp_type') { + $fieldnamekey = 'TypeOfRevenueStamp'; + } + if ($fieldnamekey == 'use_default') { + $fieldnamekey = 'UseByDefault'; + } + + setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors'); + } + } + // Other checks + if (GETPOST('actionadd') && $tabname[$id] == MAIN_DB_PREFIX."c_actioncomm" && GETPOSTISSET("type") && in_array(GETPOST("type"), array('system', 'systemauto'))) { + $ok = 0; + setEventMessages($langs->transnoentities('ErrorReservedTypeSystemSystemAuto'), null, 'errors'); + } + if (GETPOSTISSET("code")) { + if (GETPOST("code") == '0') { + $ok = 0; + setEventMessages($langs->transnoentities('ErrorCodeCantContainZero'), null, 'errors'); + } + /*if (!is_numeric($_POST['code'])) // disabled, code may not be in numeric base + { + $ok = 0; + $msg .= $langs->transnoentities('ErrorFieldFormat', $langs->transnoentities('Code')).'
'; + }*/ + } + if (GETPOSTISSET("country") && (GETPOST("country") == '0') && ($id != 2)) { + if (in_array($tablib[$id], array('DictionaryCompanyType', 'DictionaryHolidayTypes'))) { // Field country is no mandatory for such dictionaries + $_POST["country"] = ''; } else { - dol_print_error($db); + $ok = 0; + setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities("Country")), null, 'errors'); } } - - // Add new entry - $sql = "INSERT INTO ".$tabname[$id]." ("; - // List of fields - if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldinsert)) { - $sql .= $tabrowid[$id].","; + if (($id == 3 || $id == 42) && !is_numeric(GETPOST("code"))) { + $ok = 0; + setEventMessages($langs->transnoentities("ErrorFieldMustBeANumeric", $langs->transnoentities("Code")), null, 'errors'); } - $sql .= $tabfieldinsert[$id]; - $sql .= ",active)"; - $sql .= " VALUES("; - // List of values - if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldinsert)) { - $sql .= $newid.","; + // Clean some parameters + if ((GETPOST("localtax1_type") || (GETPOST('localtax1_type') == '0')) && !GETPOST("localtax1")) { + $_POST["localtax1"] = '0'; // If empty, we force to 0 } - $i = 0; - foreach ($listfieldinsert as $f => $value) { - $keycode = $listfieldvalue[$i]; - if (empty($keycode)) { - $keycode = $value; + if ((GETPOST("localtax2_type") || (GETPOST('localtax2_type') == '0')) && !GETPOST("localtax2")) { + $_POST["localtax2"] = '0'; // If empty, we force to 0 + } + if (GETPOST("accountancy_code") <= 0) { + $_POST["accountancy_code"] = ''; // If empty, we force to null + } + if (GETPOST("accountancy_code_sell") <= 0) { + $_POST["accountancy_code_sell"] = ''; // If empty, we force to null + } + if (GETPOST("accountancy_code_buy") <= 0) { + $_POST["accountancy_code_buy"] = ''; // If empty, we force to null + } + if ($id == 10 && GETPOSTISSET("code")) { // Spaces are not allowed into code for tax dictionary + $_POST["code"] = preg_replace('/[^a-zA-Z0-9\-\+]/', '', $_POST["code"]); + } + + // If check ok and action add, add the line + if ($ok && GETPOST('actionadd')) { + if ($tabrowid[$id]) { + // Get free id for insert + $newid = 0; + $sql = "SELECT max(".$tabrowid[$id].") newid from ".$tabname[$id]; + $result = $db->query($sql); + if ($result) { + $obj = $db->fetch_object($result); + $newid = ($obj->newid + 1); + } else { + dol_print_error($db); + } } - if ($value == 'price' || preg_match('/^amount/i', $value)) { - $_POST[$keycode] = price2num(GETPOST($keycode), 'MU'); - } elseif ($value == 'taux' || $value == 'localtax1') { - $_POST[$keycode] = price2num(GETPOST($keycode), 8); // Note that localtax2 can be a list of rates separated by coma like X:Y:Z - } elseif ($value == 'entity') { - $_POST[$keycode] = getEntity($tabname[$id]); + // Add new entry + $sql = "INSERT INTO ".$tabname[$id]." ("; + // List of fields + if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldinsert)) { + $sql .= $tabrowid[$id].","; } + $sql .= $tabfieldinsert[$id]; + $sql .= ",active)"; + $sql .= " VALUES("; - if ($i) { - $sql .= ","; + // List of values + if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldinsert)) { + $sql .= $newid.","; } + $i = 0; + foreach ($listfieldinsert as $f => $value) { + $keycode = $listfieldvalue[$i]; + if (empty($keycode)) { + $keycode = $value; + } - if ($keycode == 'sortorder') { // For column name 'sortorder', we use the field name 'position' - $sql .= (int) GETPOST('position', 'int'); - } elseif ($_POST[$keycode] == '' && !($keycode == 'code' && $id == 10)) { - $sql .= "null"; // For vat, we want/accept code = '' - } elseif ($keycode == 'content') { - $sql .= "'".$db->escape(GETPOST($keycode, 'restricthtml'))."'"; - } elseif (in_array($keycode, array('joinfile', 'private', 'pos', 'position', 'scale', 'use_default'))) { - $sql .= (int) GETPOST($keycode, 'int'); + if ($value == 'price' || preg_match('/^amount/i', $value)) { + $_POST[$keycode] = price2num(GETPOST($keycode), 'MU'); + } elseif ($value == 'taux' || $value == 'localtax1') { + $_POST[$keycode] = price2num(GETPOST($keycode), 8); // Note that localtax2 can be a list of rates separated by coma like X:Y:Z + } elseif ($value == 'entity') { + $_POST[$keycode] = getEntity($tabname[$id]); + } + + if ($i) { + $sql .= ","; + } + + if ($keycode == 'sortorder') { // For column name 'sortorder', we use the field name 'position' + $sql .= (int) GETPOST('position', 'int'); + } elseif ($_POST[$keycode] == '' && !($keycode == 'code' && $id == 10)) { + $sql .= "null"; // For vat, we want/accept code = '' + } elseif ($keycode == 'content') { + $sql .= "'".$db->escape(GETPOST($keycode, 'restricthtml'))."'"; + } elseif (in_array($keycode, array('joinfile', 'private', 'pos', 'position', 'scale', 'use_default'))) { + $sql .= (int) GETPOST($keycode, 'int'); + } else { + $sql .= "'".$db->escape(GETPOST($keycode, 'nohtml'))."'"; + } + + $i++; + } + $sql .= ",1)"; + + dol_syslog("actionadd", LOG_DEBUG); + $resql = $db->query($sql); + if ($resql) { // Add is ok + setEventMessages($langs->transnoentities("RecordCreatedSuccessfully"), null, 'mesgs'); + + // Clean $_POST array, we keep only id of dictionary + if ($id == 10 && GETPOST('country', 'int') > 0) { + $search_country_id = GETPOST('country', 'int'); + } + $_POST = array('id'=>$id); } else { - $sql .= "'".$db->escape(GETPOST($keycode, 'nohtml'))."'"; + if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { + setEventMessages($langs->transnoentities("ErrorRecordAlreadyExists"), null, 'errors'); + } else { + dol_print_error($db); + } } - - $i++; } - $sql .= ",1)"; - dol_syslog("actionadd", LOG_DEBUG); - $resql = $db->query($sql); - if ($resql) { // Add is ok - setEventMessages($langs->transnoentities("RecordCreatedSuccessfully"), null, 'mesgs'); - - // Clean $_POST array, we keep only id of dictionary - if ($id == 10 && GETPOST('country', 'int') > 0) { - $search_country_id = GETPOST('country', 'int'); - } - $_POST = array('id'=>$id); - } else { - if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { - setEventMessages($langs->transnoentities("ErrorRecordAlreadyExists"), null, 'errors'); + // If verif ok and action modify, modify the line + if ($ok && GETPOST('actionmodify')) { + if ($tabrowid[$id]) { + $rowidcol = $tabrowid[$id]; } else { - dol_print_error($db); + $rowidcol = "rowid"; + } + + // Modify entry + $sql = "UPDATE ".$tabname[$id]." SET "; + // Modifie valeur des champs + if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldmodify)) { + $sql .= $tabrowid[$id]."="; + $sql .= "'".$db->escape($rowid)."', "; + } + $i = 0; + foreach ($listfieldmodify as $field) { + $keycode = $listfieldvalue[$i]; + if (empty($keycode)) { + $keycode = $field; + } + + if ($field == 'price' || preg_match('/^amount/i', $field)) { + $_POST[$keycode] = price2num(GETPOST($keycode), 'MU'); + } elseif ($field == 'taux' || $field == 'localtax1') { + $_POST[$keycode] = price2num(GETPOST($keycode), 8); // Note that localtax2 can be a list of rates separated by coma like X:Y:Z + } elseif ($field == 'entity') { + $_POST[$keycode] = getEntity($tabname[$id]); + } + + if ($i) { + $sql .= ","; + } + $sql .= $field."="; + if ($listfieldvalue[$i] == 'sortorder') { // For column name 'sortorder', we use the field name 'position' + $sql .= (int) GETPOST('position', 'int'); + } elseif ($_POST[$keycode] == '' && !($keycode == 'code' && $id == 10)) { + $sql .= "null"; // For vat, we want/accept code = '' + } elseif ($keycode == 'content') { + $sql .= "'".$db->escape(GETPOST($keycode, 'restricthtml'))."'"; + } elseif (in_array($keycode, array('joinfile', 'private', 'pos', 'position', 'scale', 'use_default'))) { + $sql .= (int) GETPOST($keycode, 'int'); + } else { + $sql .= "'".$db->escape(GETPOST($keycode, 'nohtml'))."'"; + } + + $i++; + } + if (in_array($rowidcol, array('code', 'code_iso'))) { + $sql .= " WHERE ".$rowidcol." = '".$db->escape($rowid)."'"; + } else { + $sql .= " WHERE ".$rowidcol." = ".((int) $rowid); + } + if (in_array('entity', $listfieldmodify)) { + $sql .= " AND entity = ".((int) getEntity($tabname[$id], 0)); + } + + dol_syslog("actionmodify", LOG_DEBUG); + //print $sql; + $resql = $db->query($sql); + if (!$resql) { + setEventMessages($db->error(), null, 'errors'); } } + //$_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition } - // If verif ok and action modify, modify the line - if ($ok && GETPOST('actionmodify')) { + if (GETPOST('actioncancel')) { + //$_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition + } + + if ($action == 'confirm_delete' && $confirm == 'yes') { // delete if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } else { $rowidcol = "rowid"; } - // Modify entry - $sql = "UPDATE ".$tabname[$id]." SET "; - // Modifie valeur des champs - if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldmodify)) { - $sql .= $tabrowid[$id]."="; - $sql .= "'".$db->escape($rowid)."', "; - } - $i = 0; - foreach ($listfieldmodify as $field) { - $keycode = $listfieldvalue[$i]; - if (empty($keycode)) { - $keycode = $field; - } + $sql = "DELETE FROM ".$tabname[$id]." WHERE ".$rowidcol."='".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); - if ($field == 'price' || preg_match('/^amount/i', $field)) { - $_POST[$keycode] = price2num(GETPOST($keycode), 'MU'); - } elseif ($field == 'taux' || $field == 'localtax1') { - $_POST[$keycode] = price2num(GETPOST($keycode), 8); // Note that localtax2 can be a list of rates separated by coma like X:Y:Z - } elseif ($field == 'entity') { - $_POST[$keycode] = getEntity($tabname[$id]); - } - - if ($i) { - $sql .= ","; - } - $sql .= $field."="; - if ($listfieldvalue[$i] == 'sortorder') { // For column name 'sortorder', we use the field name 'position' - $sql .= (int) GETPOST('position', 'int'); - } elseif ($_POST[$keycode] == '' && !($keycode == 'code' && $id == 10)) { - $sql .= "null"; // For vat, we want/accept code = '' - } elseif ($keycode == 'content') { - $sql .= "'".$db->escape(GETPOST($keycode, 'restricthtml'))."'"; - } elseif (in_array($keycode, array('joinfile', 'private', 'pos', 'position', 'scale', 'use_default'))) { - $sql .= (int) GETPOST($keycode, 'int'); + dol_syslog("delete", LOG_DEBUG); + $result = $db->query($sql); + if (!$result) { + if ($db->errno() == 'DB_ERROR_CHILD_EXISTS') { + setEventMessages($langs->transnoentities("ErrorRecordIsUsedByChild"), null, 'errors'); } else { - $sql .= "'".$db->escape(GETPOST($keycode, 'nohtml'))."'"; + dol_print_error($db); } - - $i++; - } - if (in_array($rowidcol, array('code', 'code_iso'))) { - $sql .= " WHERE ".$rowidcol." = '".$db->escape($rowid)."'"; - } else { - $sql .= " WHERE ".$rowidcol." = ".((int) $rowid); - } - if (in_array('entity', $listfieldmodify)) { - $sql .= " AND entity = ".((int) getEntity($tabname[$id], 0)); - } - - dol_syslog("actionmodify", LOG_DEBUG); - //print $sql; - $resql = $db->query($sql); - if (!$resql) { - setEventMessages($db->error(), null, 'errors'); } } - //$_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition -} -if (GETPOST('actioncancel')) { - //$_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition -} - -if ($action == 'confirm_delete' && $confirm == 'yes') { // delete - if ($tabrowid[$id]) { - $rowidcol = $tabrowid[$id]; - } else { - $rowidcol = "rowid"; - } - - $sql = "DELETE FROM ".$tabname[$id]." WHERE ".$rowidcol."='".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); - - dol_syslog("delete", LOG_DEBUG); - $result = $db->query($sql); - if (!$result) { - if ($db->errno() == 'DB_ERROR_CHILD_EXISTS') { - setEventMessages($langs->transnoentities("ErrorRecordIsUsedByChild"), null, 'errors'); + // activate + if ($action == $acts[0]) { + if ($tabrowid[$id]) { + $rowidcol = $tabrowid[$id]; } else { + $rowidcol = "rowid"; + } + + if ($rowid) { + $sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE ".$rowidcol."='".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); + } elseif ($code) { + $sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); + } + + $result = $db->query($sql); + if (!$result) { dol_print_error($db); } } -} -// activate -if ($action == $acts[0]) { - if ($tabrowid[$id]) { - $rowidcol = $tabrowid[$id]; - } else { - $rowidcol = "rowid"; + // disable + if ($action == $acts[1]) { + if ($tabrowid[$id]) { + $rowidcol = $tabrowid[$id]; + } else { + $rowidcol = "rowid"; + } + + if ($rowid) { + $sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE ".$rowidcol."='".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); + } elseif ($code) { + $sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); + } + + $result = $db->query($sql); + if (!$result) { + dol_print_error($db); + } } - if ($rowid) { - $sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE ".$rowidcol."='".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); - } elseif ($code) { - $sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); + // favorite + if ($action == 'activate_favorite') { + if ($tabrowid[$id]) { + $rowidcol = $tabrowid[$id]; + } else { + $rowidcol = "rowid"; + } + + if ($rowid) { + $sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE ".$rowidcol."='".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); + } elseif ($code) { + $sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); + } + + $result = $db->query($sql); + if (!$result) { + dol_print_error($db); + } } - $result = $db->query($sql); - if (!$result) { - dol_print_error($db); - } -} + // disable favorite + if ($action == 'disable_favorite') { + if ($tabrowid[$id]) { + $rowidcol = $tabrowid[$id]; + } else { + $rowidcol = "rowid"; + } -// disable -if ($action == $acts[1]) { - if ($tabrowid[$id]) { - $rowidcol = $tabrowid[$id]; - } else { - $rowidcol = "rowid"; - } + if ($rowid) { + $sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE ".$rowidcol."='".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); + } elseif ($code) { + $sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); + } - if ($rowid) { - $sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE ".$rowidcol."='".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); - } elseif ($code) { - $sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); - } - - $result = $db->query($sql); - if (!$result) { - dol_print_error($db); - } -} - -// favorite -if ($action == 'activate_favorite') { - if ($tabrowid[$id]) { - $rowidcol = $tabrowid[$id]; - } else { - $rowidcol = "rowid"; - } - - if ($rowid) { - $sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE ".$rowidcol."='".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); - } elseif ($code) { - $sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); - } - - $result = $db->query($sql); - if (!$result) { - dol_print_error($db); - } -} - -// disable favorite -if ($action == 'disable_favorite') { - if ($tabrowid[$id]) { - $rowidcol = $tabrowid[$id]; - } else { - $rowidcol = "rowid"; - } - - if ($rowid) { - $sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE ".$rowidcol."='".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); - } elseif ($code) { - $sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); - } - - $result = $db->query($sql); - if (!$result) { - dol_print_error($db); + $result = $db->query($sql); + if (!$result) { + dol_print_error($db); + } } } From 43ab784be254ca3396213b22ad324ad3b0c42f35 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Tue, 15 Mar 2022 10:26:47 +0000 Subject: [PATCH 174/610] Fixing style errors. --- htdocs/admin/dict.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 20b1461ad4f..8b96bee60ab 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -707,8 +707,7 @@ if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } -if (empty($reshook)) -{ +if (empty($reshook)) { if (GETPOST('button_removefilter', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter_x', 'alpha')) { $search_country_id = ''; $search_code = ''; From 69654b2b4398bfec1bb3f1c88cb9b73617ebb618 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 15 Mar 2022 12:14:46 +0100 Subject: [PATCH 175/610] Fix sort not working on security page to test file upload --- htdocs/admin/security_file.php | 12 +++++++++--- htdocs/core/class/html.formfile.class.php | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/htdocs/admin/security_file.php b/htdocs/admin/security_file.php index 82df4bed430..67c6914f1cf 100644 --- a/htdocs/admin/security_file.php +++ b/htdocs/admin/security_file.php @@ -36,6 +36,14 @@ if (!$user->admin) { } $action = GETPOST('action', 'aZ09'); +$sortfield = GETPOST('sortfield', 'aZ09'); +$sortorder = GETPOST('sortorder', 'aZ09'); +if (empty($sortfield)) { + $sortfield = 'date'; +} +if (empty($sortorder)) { + $sortorder = 'desc'; +} $upload_dir = $conf->admin->dir_temp; @@ -73,8 +81,6 @@ if ($action == 'updateform') { } else { setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile', 'alpha')), null, 'errors'); } - Header('Location: '.$_SERVER["PHP_SELF"]); - exit; } @@ -190,7 +196,7 @@ $formfile = new FormFile($db); $formfile->form_attach_new_file($_SERVER['PHP_SELF'], $langs->trans("FormToTestFileUploadForm"), 0, 0, 1, 50, '', '', 1, '', 0); // List of document -$filearray = dol_dir_list($upload_dir, "files", 0, '', '', 'name', SORT_ASC, 1); +$filearray = dol_dir_list($upload_dir, "files", 0, '', '', $sortfield, $sortorder == 'desc' ? SORT_DESC : SORT_ASC, 1); $formfile->list_of_documents($filearray, null, 'admin_temp', ''); // End of page diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index cad584e8731..c01ff5af541 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -1504,7 +1504,7 @@ class FormFile if (!empty($conf->global->MAIN_ECM_DISABLE_JS)) { $useajax = 0; } - print ''.img_delete().''; + print ''.img_delete().''; } print ""; From 271857189c150593f6fc2369a96614b4b5660712 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Tue, 15 Mar 2022 13:29:34 +0100 Subject: [PATCH 176/610] Update llx_20_c_departements.sql --- .../mysql/data/llx_20_c_departements.sql | 363 +++++++++--------- 1 file changed, 187 insertions(+), 176 deletions(-) diff --git a/htdocs/install/mysql/data/llx_20_c_departements.sql b/htdocs/install/mysql/data/llx_20_c_departements.sql index 47f51f33986..d51bb70ec21 100644 --- a/htdocs/install/mysql/data/llx_20_c_departements.sql +++ b/htdocs/install/mysql/data/llx_20_c_departements.sql @@ -1,16 +1,21 @@ --- 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 --- Copyright (C) 2010-2016 Juanjo Menent --- Copyright (C) 2012 Sebastian Neuwert --- Copyright (C) 2012 Ricardo Schluter --- Copyright (C) 2015 Ferran Marcet --- Copyright (C) 2020-2021 Udo Tamm +-- file: /htdocs/install/mysql/data/llx_20_c_departements.sql + +-- Authors ----------------------------------------------------------------------- +-- 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 +-- Copyright (C) 2010-2016 Juanjo Menent +-- Copyright (C) 2012 Sebastian Neuwert +-- Copyright (C) 2012 Ricardo Schluter +-- Copyright (C) 2015 Ferran Marcet +-- Copyright (C) 2020-2021 Udo Tamm -- + +-- License ---------------------------------------------------------------------- -- 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 @@ -60,14 +65,19 @@ -- Portugal -- Romania -- Slovenia (need to check code SI-Id) +-- Switzerland / Suisse -- Taiwan -- Tunisia -- United States of America +-- +-- others .. unsorted + -- TEMPLATE ------------------------------------------------------------------------------------------------------------- -insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values ( 0, '0', '0',0,'-','-'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ( 0, '0', '0',0,'-','-'); +-- active is always set as on = 1 -- Algeria Provinces (id country=13) @@ -144,7 +154,7 @@ INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (35001, 'AO-HUI', NULL, NULL, 'HUÍLA', 'Huila'); INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (35001, 'AO-LUA', NULL, NULL, 'LUANDA', 'Luanda'); INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (35001, 'AO-LNO', NULL, NULL, 'LUNDA-NORTE', 'Lunda-Norte'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (35001, 'AO-LSU',NULL, NULL, 'LUNDA-SUL', 'Lunda-Sul'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (35001, 'AO-LSU', NULL, NULL, 'LUNDA-SUL', 'Lunda-Sul'); INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (35001, 'AO-MAL', NULL, NULL, 'MALANGE', 'Malange'); INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (35001, 'AO-MOX', NULL, NULL, 'MOXICO', 'Moxico'); INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (35001, 'AO-NAM', NULL, NULL, 'NAMÍBE', 'Namíbe'); @@ -182,26 +192,26 @@ INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc -- Australia States & Territories (id country=28) -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'); +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'); -- Austria States / Österreich Bundesländer (id country=41) -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom, active) VALUES (4101, 'B','BURGENLAND','Burgenland',1); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom, active) VALUES (4101, 'K','KAERNTEN','Kärnten',1); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom, active) VALUES (4101, 'N','NIEDEROESTERREICH','Niederösterreich',1); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom, active) VALUES (4101, 'O','OBEROESTERREICH','Oberösterreich',1); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom, active) VALUES (4101, 'S','SALZBURG','Salzburg',1); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom, active) VALUES (4101, 'ST','STEIERMARK','Steiermark',1); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom, active) VALUES (4101, 'T','TIROL','Tirol',1); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom, active) VALUES (4101, 'V','VORARLBERG','Vorarlberg',1); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom, active) VALUES (4101, 'W','WIEN','Wien',1); +INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (4101, 'B', 'BURGENLAND', 'Burgenland'); +INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (4101, 'K', 'KAERNTEN', 'Kärnten'); +INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (4101, 'N', 'NIEDEROESTERREICH', 'Niederösterreich'); +INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (4101, 'O', 'OBEROESTERREICH', 'Oberösterreich'); +INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (4101, 'S', 'SALZBURG', 'Salzburg'); +INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (4101, 'ST', 'STEIERMARK', 'Steiermark'); +INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (4101, 'T', 'TIROL', 'Tirol'); +INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (4101, 'V', 'VORARLBERG', 'Vorarlberg'); +INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (4101, 'W', 'WIEN', 'Wien'); -- Barbados Parish (id country=46) @@ -219,17 +229,17 @@ INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc -- Belgium Provinces (id country=2) -insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (201, '01','',1,'ANVERS','Anvers'); -insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (203, '02','',3,'BRUXELLES-CAPITALE','Bruxelles-Capitale'); -insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (202, '03','',2,'BRABANT-WALLON','Brabant-Wallon'); -insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (201, '04','',1,'BRABANT-FLAMAND','Brabant-Flamand'); -insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (201, '05','',1,'FLANDRE-OCCIDENTALE','Flandre-Occidentale'); -insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (201, '06','',1,'FLANDRE-ORIENTALE','Flandre-Orientale'); -insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (202, '07','',2,'HAINAUT','Hainaut'); -insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (202, '08','',2,'LIEGE','Liège'); -insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (202, '09','',1,'LIMBOURG','Limbourg'); -insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (202, '10','',2,'LUXEMBOURG','Luxembourg'); -insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (202, '11','',2,'NAMUR','Namur'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (201, '01', '', 1, 'ANVERS', 'Anvers'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (203, '02', '', 3, 'BRUXELLES-CAPITALE', 'Bruxelles-Capitale'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (202, '03', '', 2, 'BRABANT-WALLON', 'Brabant-Wallon'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (201, '04', '', 1, 'BRABANT-FLAMAND', 'Brabant-Flamand'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (201, '05', '', 1, 'FLANDRE-OCCIDENTALE', 'Flandre-Occidentale'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (201, '06', '', 1, 'FLANDRE-ORIENTALE', 'Flandre-Orientale'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (202, '07', '', 2, 'HAINAUT', 'Hainaut'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (202, '08', '', 2, 'LIEGE', 'Liège'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (202, '09', '', 1, 'LIMBOURG', 'Limbourg'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (202, '10', '', 2, 'LUXEMBOURG', 'Luxembourg'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (202, '11', '', 2, 'NAMUR', 'Namur'); -- Brazil Provinces (id country=56) @@ -263,16 +273,16 @@ INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc -- Canada Provinces & Territories (id country=14) -insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (1401, 'ON','',1,'','Ontario'); -insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (1401, 'QC','',1,'','Quebec'); -insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (1401, 'NS','',1,'','Nova Scotia'); -insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (1401, 'NB','',1,'','New Brunswick'); -insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (1401, 'MB','',1,'','Manitoba'); -insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (1401, 'BC','',1,'','British Columbia'); -insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (1401, 'PE','',1,'','Prince Edward Island'); -insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (1401, 'SK','',1,'','Saskatchewan'); -insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (1401, 'AB','',1,'','Alberta'); -insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (1401, 'NL','',1,'','Newfoundland and Labrador'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1401, 'ON', '', 1, '', 'Ontario'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1401, 'QC', '', 1, '', 'Quebec'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1401, 'NS', '', 1, '', 'Nova Scotia'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1401, 'NB', '', 1, '', 'New Brunswick'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1401, 'MB', '', 1, '', 'Manitoba'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1401, 'BC', '', 1, '', 'British Columbia'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1401, 'PE', '', 1, '', 'Prince Edward Island'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1401, 'SK', '', 1, '', 'Saskatchewan'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1401, 'AB', '', 1, '', 'Alberta'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1401, 'NL', '', 1, '', 'Newfoundland and Labrador'); -- Chile Provinces (id country=67) @@ -375,102 +385,102 @@ insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values ( 4, '974','97411',3,'REUNION','Réunion'); insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values ( 6, '976','97601',3,'MAYOTTE','Mayotte'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (84,'01','01053',5,'AIN','Ain'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (32,'02','02408',5,'AISNE','Aisne'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (84,'03','03190',5,'ALLIER','Allier'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (93,'04','04070',4,'ALPES-DE-HAUTE-PROVENCE','Alpes-de-Haute-Provence'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (93,'05','05061',4,'HAUTES-ALPES','Hautes-Alpes'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (93,'06','06088',4,'ALPES-MARITIMES','Alpes-Maritimes'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (84,'07','07186',5,'ARDECHE','Ardèche'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (44,'08','08105',4,'ARDENNES','Ardennes'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (76,'09','09122',5,'ARIEGE','Ariège'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (44,'10','10387',5,'AUBE','Aube'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (76,'11','11069',5,'AUDE','Aude'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (76,'12','12202',5,'AVEYRON','Aveyron'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (93,'13','13055',4,'BOUCHES-DU-RHONE','Bouches-du-Rhône'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (28,'14','14118',2,'CALVADOS','Calvados'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (84,'15','15014',2,'CANTAL','Cantal'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (75,'16','16015',3,'CHARENTE','Charente'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (75,'17','17300',3,'CHARENTE-MARITIME','Charente-Maritime'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (24,'18','18033',2,'CHER','Cher'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (75,'19','19272',3,'CORREZE','Corrèze'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (94,'2A','2A004',3,'CORSE-DU-SUD','Corse-du-Sud'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (94,'2B','2B033',3,'HAUTE-CORSE','Haute-Corse'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (27,'21','21231',3,'COTE-D OR','Côte-d Or'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (53,'22','22278',4,'COTES-D ARMOR','Côtes-d Armor'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (75,'23','23096',3,'CREUSE','Creuse'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (75,'24','24322',3,'DORDOGNE','Dordogne'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (27,'25','25056',2,'DOUBS','Doubs'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (84,'26','26362',3,'DROME','Drôme'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (28,'27','27229',5,'EURE','Eure'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (24,'28','28085',1,'EURE-ET-LOIR','Eure-et-Loir'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (53,'29','29232',2,'FINISTERE','Finistère'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (76,'30','30189',2,'GARD','Gard'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (76,'31','31555',3,'HAUTE-GARONNE','Haute-Garonne'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (76,'32','32013',2,'GERS','Gers'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (75,'33','33063',3,'GIRONDE','Gironde'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (76,'34','34172',5,'HERAULT','Hérault'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (53,'35','35238',1,'ILLE-ET-VILAINE','Ille-et-Vilaine'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (24,'36','36044',5,'INDRE','Indre'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (24,'37','37261',1,'INDRE-ET-LOIRE','Indre-et-Loire'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (84,'38','38185',5,'ISERE','Isère'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (27,'39','39300',2,'JURA','Jura'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (75,'40','40192',4,'LANDES','Landes'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (24,'41','41018',0,'LOIR-ET-CHER','Loir-et-Cher'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (84,'42','42218',3,'LOIRE','Loire'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (84,'43','43157',3,'HAUTE-LOIRE','Haute-Loire'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (52,'44','44109',3,'LOIRE-ATLANTIQUE','Loire-Atlantique'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (24,'45','45234',2,'LOIRET','Loiret'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (76,'46','46042',2,'LOT','Lot'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (75,'47','47001',0,'LOT-ET-GARONNE','Lot-et-Garonne'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (76,'48','48095',3,'LOZERE','Lozère'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (52,'49','49007',0,'MAINE-ET-LOIRE','Maine-et-Loire'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (28,'50','50502',3,'MANCHE','Manche'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (44,'51','51108',3,'MARNE','Marne'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (44,'52','52121',3,'HAUTE-MARNE','Haute-Marne'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (52,'53','53130',3,'MAYENNE','Mayenne'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (44,'54','54395',0,'MEURTHE-ET-MOSELLE','Meurthe-et-Moselle'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (44,'55','55029',3,'MEUSE','Meuse'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (53,'56','56260',2,'MORBIHAN','Morbihan'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (44,'57','57463',3,'MOSELLE','Moselle'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (27,'58','58194',3,'NIEVRE','Nièvre'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (32,'59','59350',2,'NORD','Nord'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (32,'60','60057',5,'OISE','Oise'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (28,'61','61001',5,'ORNE','Orne'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (32,'62','62041',2,'PAS-DE-CALAIS','Pas-de-Calais'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (84,'63','63113',2,'PUY-DE-DOME','Puy-de-Dôme'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (75,'64','64445',4,'PYRENEES-ATLANTIQUES','Pyrénées-Atlantiques'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (76,'65','65440',4,'HAUTES-PYRENEES','Hautes-Pyrénées'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (76,'66','66136',4,'PYRENEES-ORIENTALES','Pyrénées-Orientales'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (44,'67','67482',2,'BAS-RHIN','Bas-Rhin'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (44,'68','68066',2,'HAUT-RHIN','Haut-Rhin'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (84,'69','69123',2,'RHONE','Rhône'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (27,'70','70550',3,'HAUTE-SAONE','Haute-Saône'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (27,'71','71270',0,'SAONE-ET-LOIRE','Saône-et-Loire'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (52,'72','72181',3,'SARTHE','Sarthe'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (84,'73','73065',3,'SAVOIE','Savoie'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (84,'74','74010',3,'HAUTE-SAVOIE','Haute-Savoie'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (11,'75','75056',0,'PARIS','Paris'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (28,'76','76540',3,'SEINE-MARITIME','Seine-Maritime'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (11,'77','77288',0,'SEINE-ET-MARNE','Seine-et-Marne'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (11,'78','78646',4,'YVELINES','Yvelines'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (75,'79','79191',4,'DEUX-SEVRES','Deux-Sèvres'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (32,'80','80021',3,'SOMME','Somme'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (76,'81','81004',2,'TARN','Tarn'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (76,'82','82121',0,'TARN-ET-GARONNE','Tarn-et-Garonne'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (93,'83','83137',2,'VAR','Var'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (93,'84','84007',0,'VAUCLUSE','Vaucluse'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (52,'85','85191',3,'VENDEE','Vendée'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (75,'86','86194',3,'VIENNE','Vienne'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (75,'87','87085',3,'HAUTE-VIENNE','Haute-Vienne'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (44,'88','88160',4,'VOSGES','Vosges'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (27,'89','89024',5,'YONNE','Yonne'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (27,'90','90010',0,'TERRITOIRE DE BELFORT','Territoire de Belfort'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (11,'91','91228',5,'ESSONNE','Essonne'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (11,'92','92050',4,'HAUTS-DE-SEINE','Hauts-de-Seine'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (11,'93','93008',3,'SEINE-SAINT-DENIS','Seine-Saint-Denis'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (11,'94','94028',2,'VAL-DE-MARNE','Val-de-Marne'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (11,'95','95500',2,'VAL-D OISE','Val-d Oise'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (84,'01','01053',5,'AIN','Ain'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (32,'02','02408',5,'AISNE','Aisne'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (84,'03','03190',5,'ALLIER','Allier'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (93,'04','04070',4,'ALPES-DE-HAUTE-PROVENCE','Alpes-de-Haute-Provence'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (93,'05','05061',4,'HAUTES-ALPES','Hautes-Alpes'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (93,'06','06088',4,'ALPES-MARITIMES','Alpes-Maritimes'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (84,'07','07186',5,'ARDECHE','Ardèche'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (44,'08','08105',4,'ARDENNES','Ardennes'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (76,'09','09122',5,'ARIEGE','Ariège'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (44,'10','10387',5,'AUBE','Aube'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (76,'11','11069',5,'AUDE','Aude'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (76,'12','12202',5,'AVEYRON','Aveyron'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (93,'13','13055',4,'BOUCHES-DU-RHONE','Bouches-du-Rhône'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (28,'14','14118',2,'CALVADOS','Calvados'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (84,'15','15014',2,'CANTAL','Cantal'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (75,'16','16015',3,'CHARENTE','Charente'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (75,'17','17300',3,'CHARENTE-MARITIME','Charente-Maritime'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (24,'18','18033',2,'CHER','Cher'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (75,'19','19272',3,'CORREZE','Corrèze'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (94,'2A','2A004',3,'CORSE-DU-SUD','Corse-du-Sud'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (94,'2B','2B033',3,'HAUTE-CORSE','Haute-Corse'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (27,'21','21231',3,'COTE-D OR','Côte-d Or'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (53,'22','22278',4,'COTES-D ARMOR','Côtes-d Armor'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (75,'23','23096',3,'CREUSE','Creuse'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (75,'24','24322',3,'DORDOGNE','Dordogne'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (27,'25','25056',2,'DOUBS','Doubs'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (84,'26','26362',3,'DROME','Drôme'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (28,'27','27229',5,'EURE','Eure'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (24,'28','28085',1,'EURE-ET-LOIR','Eure-et-Loir'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (53,'29','29232',2,'FINISTERE','Finistère'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (76,'30','30189',2,'GARD','Gard'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (76,'31','31555',3,'HAUTE-GARONNE','Haute-Garonne'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (76,'32','32013',2,'GERS','Gers'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (75,'33','33063',3,'GIRONDE','Gironde'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (76,'34','34172',5,'HERAULT','Hérault'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (53,'35','35238',1,'ILLE-ET-VILAINE','Ille-et-Vilaine'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (24,'36','36044',5,'INDRE','Indre'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (24,'37','37261',1,'INDRE-ET-LOIRE','Indre-et-Loire'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (84,'38','38185',5,'ISERE','Isère'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (27,'39','39300',2,'JURA','Jura'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (75,'40','40192',4,'LANDES','Landes'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (24,'41','41018',0,'LOIR-ET-CHER','Loir-et-Cher'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (84,'42','42218',3,'LOIRE','Loire'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (84,'43','43157',3,'HAUTE-LOIRE','Haute-Loire'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (52,'44','44109',3,'LOIRE-ATLANTIQUE','Loire-Atlantique'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (24,'45','45234',2,'LOIRET','Loiret'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (76,'46','46042',2,'LOT','Lot'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (75,'47','47001',0,'LOT-ET-GARONNE','Lot-et-Garonne'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (76,'48','48095',3,'LOZERE','Lozère'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (52,'49','49007',0,'MAINE-ET-LOIRE','Maine-et-Loire'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (28,'50','50502',3,'MANCHE','Manche'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (44,'51','51108',3,'MARNE','Marne'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (44,'52','52121',3,'HAUTE-MARNE','Haute-Marne'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (52,'53','53130',3,'MAYENNE','Mayenne'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (44,'54','54395',0,'MEURTHE-ET-MOSELLE','Meurthe-et-Moselle'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (44,'55','55029',3,'MEUSE','Meuse'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (53,'56','56260',2,'MORBIHAN','Morbihan'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (44,'57','57463',3,'MOSELLE','Moselle'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (27,'58','58194',3,'NIEVRE','Nièvre'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (32,'59','59350',2,'NORD','Nord'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (32,'60','60057',5,'OISE','Oise'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (28,'61','61001',5,'ORNE','Orne'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (32,'62','62041',2,'PAS-DE-CALAIS','Pas-de-Calais'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (84,'63','63113',2,'PUY-DE-DOME','Puy-de-Dôme'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (75,'64','64445',4,'PYRENEES-ATLANTIQUES','Pyrénées-Atlantiques'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (76,'65','65440',4,'HAUTES-PYRENEES','Hautes-Pyrénées'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (76,'66','66136',4,'PYRENEES-ORIENTALES','Pyrénées-Orientales'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (44,'67','67482',2,'BAS-RHIN','Bas-Rhin'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (44,'68','68066',2,'HAUT-RHIN','Haut-Rhin'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (84,'69','69123',2,'RHONE','Rhône'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (27,'70','70550',3,'HAUTE-SAONE','Haute-Saône'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (27,'71','71270',0,'SAONE-ET-LOIRE','Saône-et-Loire'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (52,'72','72181',3,'SARTHE','Sarthe'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (84,'73','73065',3,'SAVOIE','Savoie'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (84,'74','74010',3,'HAUTE-SAVOIE','Haute-Savoie'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (11,'75','75056',0,'PARIS','Paris'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (28,'76','76540',3,'SEINE-MARITIME','Seine-Maritime'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (11,'77','77288',0,'SEINE-ET-MARNE','Seine-et-Marne'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (11,'78','78646',4,'YVELINES','Yvelines'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (75,'79','79191',4,'DEUX-SEVRES','Deux-Sèvres'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (32,'80','80021',3,'SOMME','Somme'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (76,'81','81004',2,'TARN','Tarn'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (76,'82','82121',0,'TARN-ET-GARONNE','Tarn-et-Garonne'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (93,'83','83137',2,'VAR','Var'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (93,'84','84007',0,'VAUCLUSE','Vaucluse'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (52,'85','85191',3,'VENDEE','Vendée'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (75,'86','86194',3,'VIENNE','Vienne'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (75,'87','87085',3,'HAUTE-VIENNE','Haute-Vienne'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (44,'88','88160',4,'VOSGES','Vosges'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (27,'89','89024',5,'YONNE','Yonne'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (27,'90','90010',0,'TERRITOIRE DE BELFORT','Territoire de Belfort'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (11,'91','91228',5,'ESSONNE','Essonne'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (11,'92','92050',4,'HAUTS-DE-SEINE','Hauts-de-Seine'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (11,'93','93008',3,'SEINE-SAINT-DENIS','Seine-Saint-Denis'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (11,'94','94028',2,'VAL-DE-MARNE','Val-de-Marne'); +insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (11,'95','95500',2,'VAL-D OISE','Val-d Oise'); -- Germany States / Bundesländer (id country=5) @@ -1060,6 +1070,35 @@ INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (20204, 'SI044', NULL, NULL, 'COASTAL–KARST', 'Coastal–Karst'); +-- Switzerland Cantons (id country=6) +INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'AG','ARGOVIE','Argovie'); +INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'AI','APPENZELL RHODES INTERIEURES','Appenzell Rhodes intérieures'); +INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'AR','APPENZELL RHODES EXTERIEURES','Appenzell Rhodes extérieures'); +INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'BE','BERNE','Berne'); +INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'BL','BALE CAMPAGNE','Bâle Campagne'); +INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'BS','BALE VILLE','Bâle Ville'); +INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'FR','FRIBOURG','Fribourg'); +INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'GE','GENEVE','Genève'); +INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'GL','GLARIS','Glaris'); +INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'GR','GRISONS','Grisons'); +INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'JU','JURA','Jura'); +INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'LU','LUCERNE','Lucerne'); +INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'NE','NEUCHATEL','Neuchâtel'); +INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'NW','NIDWALD','Nidwald'); +INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'OW','OBWALD','Obwald'); +INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'SG','SAINT-GALL','Saint-Gall'); +INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'SH','SCHAFFHOUSE','Schaffhouse'); +INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'SO','SOLEURE','Soleure'); +INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'SZ','SCHWYZ','Schwyz'); +INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'TG','THURGOVIE','Thurgovie'); +INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'TI','TESSIN','Tessin'); +INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'UR','URI','Uri'); +INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'VD','VAUD','Vaud'); +INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'VS','VALAIS','Valais'); +INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'ZG','ZUG','Zug'); +INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'ZH','ZURICH','Zürich'); + + -- Taiwan Divisions / Provinces / Counties (rowid country=886) INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-KLU', 'KLU', NULL, '基隆市'); INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-TPE', 'TPE', NULL, '臺北市'); @@ -1417,34 +1456,6 @@ INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('65', 10204, '', 0, '', 'Χανιά', 1); --- Switzerland Cantons (id country=6) -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'AG','ARGOVIE','Argovie'); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'AI','APPENZELL RHODES INTERIEURES','Appenzell Rhodes intérieures'); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'AR','APPENZELL RHODES EXTERIEURES','Appenzell Rhodes extérieures'); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'BE','BERNE','Berne'); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'BL','BALE CAMPAGNE','Bâle Campagne'); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'BS','BALE VILLE','Bâle Ville'); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'FR','FRIBOURG','Fribourg'); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'GE','GENEVE','Genève'); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'GL','GLARIS','Glaris'); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'GR','GRISONS','Grisons'); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'JU','JURA','Jura'); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'LU','LUCERNE','Lucerne'); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'NE','NEUCHATEL','Neuchâtel'); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'NW','NIDWALD','Nidwald'); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'OW','OBWALD','Obwald'); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'SG','SAINT-GALL','Saint-Gall'); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'SH','SCHAFFHOUSE','Schaffhouse'); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'SO','SOLEURE','Soleure'); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'SZ','SCHWYZ','Schwyz'); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'TG','THURGOVIE','Thurgovie'); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'TI','TESSIN','Tessin'); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'UR','URI','Uri'); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'VD','VAUD','Vaud'); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'VS','VALAIS','Valais'); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'ZG','ZUG','Zug'); -INSERT INTO llx_c_departements (fk_region, code_departement, ncc, nom) VALUES (601, 'ZH','ZURICH','Zürich'); - -- Provinces GB (id country=7) INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('701', 701, NULL, 0,NULL, 'Bedfordshire', 1); From 64525349e01c78375b4c9beaf65cd6e97c4f1d34 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Tue, 15 Mar 2022 13:46:14 +0100 Subject: [PATCH 177/610] Update llx_c_hrm_public_holiday.sql add fk_departement see #16646 --- .../mysql/tables/llx_c_hrm_public_holiday.sql | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/htdocs/install/mysql/tables/llx_c_hrm_public_holiday.sql b/htdocs/install/mysql/tables/llx_c_hrm_public_holiday.sql index f3f26e41866..f057d8e7d5c 100644 --- a/htdocs/install/mysql/tables/llx_c_hrm_public_holiday.sql +++ b/htdocs/install/mysql/tables/llx_c_hrm_public_holiday.sql @@ -18,14 +18,15 @@ create table llx_c_hrm_public_holiday ( - id integer AUTO_INCREMENT PRIMARY KEY, - entity integer DEFAULT 0 NOT NULL, -- multi company id, 0 = all - fk_country integer, - code varchar(62), - dayrule varchar(64) DEFAULT '', -- 'easter', 'eastermonday', ... - day integer, - month integer, - year integer, -- 0 for all years - active integer DEFAULT 1, - import_key varchar(14) + id integer AUTO_INCREMENT PRIMARY KEY, + entity integer DEFAULT 0 NOT NULL, -- multi company id, 0 = all + fk_country integer, + fk_departement integer, + code varchar(62), + dayrule varchar(64) DEFAULT '', -- 'easter', 'eastermonday', ... + day integer, + month integer, + year integer, -- 0 for all years + active integer DEFAULT 1, + import_key varchar(14) )ENGINE=innodb; From 6080e1f988d7860571d4af9f5d1199506a4118fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9=20GDSOFT?= Date: Tue, 15 Mar 2022 14:59:26 +0100 Subject: [PATCH 178/610] fix : keep lines order when creating invoices from receptions --- htdocs/fourn/commande/dispatch.php | 2 +- htdocs/reception/class/reception.class.php | 1 + htdocs/reception/list.php | 13 ++++++++++++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index 9a8ab1fa7ef..fda6d1aba4a 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -709,7 +709,7 @@ if ($id > 0 || !empty($ref)) { $sql .= $hookmanager->resPrint; $sql .= " GROUP BY p.ref, p.label, p.tobatch, p.fk_default_warehouse, l.rowid, l.fk_product, l.subprice, l.remise_percent, l.ref"; // Calculation of amount dispatched is done per fk_product so we must group by fk_product - $sql .= " ORDER BY p.ref, p.label"; + $sql .= " ORDER BY l.rang, p.ref, p.label"; $resql = $db->query($sql); if ($resql) { diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index 5fb8e3b8af0..62a9c8a8dde 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -1055,6 +1055,7 @@ class Reception extends CommonObject $sql_commfourndet = 'SELECT qty, ref, label, description, tva_tx, vat_src_code, subprice, multicurrency_subprice, remise_percent'; $sql_commfourndet .= ' FROM '.MAIN_DB_PREFIX.'commande_fournisseurdet'; $sql_commfourndet .= ' WHERE rowid = '.((int) $line->fk_commandefourndet); + $sql_commfourndet .= ' ORDER BY rang'; $resql_commfourndet = $this->db->query($sql_commfourndet); if (!empty($resql_commfourndet)) { $obj = $this->db->fetch_object($resql_commfourndet); diff --git a/htdocs/reception/list.php b/htdocs/reception/list.php index 9f98202099a..cf12c6f8191 100644 --- a/htdocs/reception/list.php +++ b/htdocs/reception/list.php @@ -175,6 +175,7 @@ if (empty($reshook)) { $TFact = array(); $TFactThird = array(); + $TFactThirdNbLines = array(); $nb_bills_created = 0; $lastid= 0; @@ -182,6 +183,8 @@ if (empty($reshook)) { $db->begin(); + //sort ids to keep order if one bill per third + sort($receptions); foreach ($receptions as $id_reception) { $rcp = new Reception($db); // We only invoice reception that are validated @@ -254,6 +257,7 @@ if (empty($reshook)) { $lastid = $objecttmp->id; $TFactThird[$rcp->socid] = $objecttmp; + $TFactThirdNbLines[$rcp->socid] = 0; //init nblines to have lines ordered by expedition and rang } else { $langs->load("errors"); $errors[] = $rcp->ref.' : '.$langs->trans($objecttmp->error); @@ -343,6 +347,11 @@ if (empty($reshook)) { $objecttmp->context['createfromclone']; + $rang = $i; + //there may already be rows from previous receptions + if (!empty($createbills_onebythird)) + $rang = $TFactThirdNbLines[$rcp->socid]; + $result = $objecttmp->addline( $desc, $lines[$i]->subprice, @@ -358,7 +367,7 @@ if (empty($reshook)) { $lines[$i]->info_bits, 'HT', $product_type, - $i, + $rang, false, 0, null, @@ -371,6 +380,8 @@ if (empty($reshook)) { if ($result > 0) { $lineid = $result; + if (!empty($createbills_onebythird)) //increment rang to keep order + $TFactThirdNbLines[$rcp->socid]++; } else { $lineid = 0; $error++; From ffa6cb06106562aa1325296790f9df9a706ccd6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9=20GDSOFT?= Date: Tue, 15 Mar 2022 15:47:36 +0100 Subject: [PATCH 179/610] fix : keep lines order when creating invoices from orders --- htdocs/core/actions_massactions.inc.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 64578ad68bb..b70e17b2ebb 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -635,6 +635,7 @@ if ($massaction == 'confirm_createbills') { // Create bills from orders. $TFact = array(); $TFactThird = array(); + $TFactThirdNbLines = array(); $nb_bills_created = 0; $lastid= 0; @@ -685,6 +686,7 @@ if ($massaction == 'confirm_createbills') { // Create bills from orders. $lastid = $objecttmp->id; $TFactThird[$cmd->socid] = $objecttmp; + $TFactThirdNbLines[$cmd->socid] = 0; //init nblines to have lines ordered by expedition and rang } else { $langs->load("errors"); $errors[] = $cmd->ref.' : '.$langs->trans($objecttmp->error); @@ -774,6 +776,11 @@ if ($massaction == 'confirm_createbills') { // Create bills from orders. $objecttmp->context['createfromclone']; + $rang = $lines[$i]->rang; + //there may already be rows from previous orders + if (!empty($createbills_onebythird)) + $rang = $TFactThirdNbLines[$cmd->socid]; + $result = $objecttmp->addline( $desc, $lines[$i]->subprice, @@ -791,7 +798,7 @@ if ($massaction == 'confirm_createbills') { // Create bills from orders. 'HT', 0, $product_type, - $lines[$i]->rang, + $rang, $lines[$i]->special_code, $objecttmp->origin, $lines[$i]->rowid, @@ -806,6 +813,8 @@ if ($massaction == 'confirm_createbills') { // Create bills from orders. ); if ($result > 0) { $lineid = $result; + if (!empty($createbills_onebythird)) //increment rang to keep order + $TFactThirdNbLines[$rcp->socid]++; } else { $lineid = 0; $error++; From 58f5cafc3497e2b3bcece75fa45587d746a56fd7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 15 Mar 2022 19:15:02 +0100 Subject: [PATCH 180/610] FIX #20359 --- htdocs/projet/card.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 6f587a67a7f..433a933c75b 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -632,11 +632,11 @@ if ($action == 'create' && $user->rights->projet->creer) { } if (count($array) > 0) { - print $form->selectarray('public', $array, GETPOSTISSET('public') ? GETPOST('public') : $object->public, 0, 0, 0, '', 0, 0, 0, '', '', 1); + print $form->selectarray('public', $array, GETPOST('public'), 0, 0, 0, '', 0, 0, 0, '', '', 1); } else { - print ''; + print ''; - if ( (GETPOSTISSET('public') ? GETPOST('public') : $object->public)==0) { + if (GETPOST('public') == 0) { print $langs->trans("PrivateProject"); } else { print $langs->trans("SharedProject"); From 0899caf74d7ba437b539765cc6d49d71ab8b4668 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 15 Mar 2022 19:23:17 +0100 Subject: [PATCH 181/610] Update lib_head.js.php --- htdocs/core/js/lib_head.js.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/js/lib_head.js.php b/htdocs/core/js/lib_head.js.php index 53e89182227..9a0eaf0e0ed 100644 --- a/htdocs/core/js/lib_head.js.php +++ b/htdocs/core/js/lib_head.js.php @@ -1138,7 +1138,7 @@ $(document).ready(function() { // Force to hide menus when page is inside an iFrame $(document).ready(function() { - if (window.location.pathname.indexOf("externalsite/frametop.php") == -1 && window.location !== window.parent.location ) { + if (window.location && window.location.pathname.indexOf("externalsite/frametop.php") == -1 && window.location !== window.parent.location ) { console.log("Page is detected to be into an iframe, we hide by CSS the menus"); // The page is in an iframe jQuery(".side-nav-vert, .side-nav, .websitebar").hide(); From 5a2ed9461fbffdc083f92039507e3d0ca11c08a9 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Wed, 16 Mar 2022 08:58:01 +0100 Subject: [PATCH 182/610] FIX Reception - Error on trackid --- htdocs/reception/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index e5f5fccffad..48b0953e399 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -679,7 +679,7 @@ if (empty($reshook)) { $triggersendname = 'RECEPTION_SENTBYMAIL'; $paramname = 'id'; $mode = 'emailfromreception'; - $trackid = 'shi'.$object->id; + $trackid = 'rec'.$object->id; include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; } From cfa3f2f4a13ab5d069d88306fb2a5f0ee6d05004 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Wed, 16 Mar 2022 09:36:52 +0100 Subject: [PATCH 183/610] fix: prededefault setup values for public field (visibility) works --- htdocs/projet/card.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 89bdb013a32..c2f7df6c222 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -615,11 +615,11 @@ if ($action == 'create' && $user->rights->projet->creer) { } if (count($array) > 0) { - print $form->selectarray('public', $array, GETPOSTISSET('public') ? GETPOST('public') : $object->public, 0, 0, 0, '', 0, 0, 0, '', '', 1); + print $form->selectarray('public', $array, GETPOST('public'), 0, 0, 0, '', 0, 0, 0, '', '', 1); } else { - print ''; + print ''; - if ( (GETPOSTISSET('public') ? GETPOST('public') : $object->public)==0) { + if (GETPOST('public') == 0) { print $langs->trans("PrivateProject"); } else { print $langs->trans("SharedProject"); From 9514062868456d7270dedd492373d4f09dd68d98 Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Wed, 16 Mar 2022 09:40:31 +0100 Subject: [PATCH 184/610] FIX: holiday monthly report: wrong 'Employee' and holiday type translations --- htdocs/holiday/month_report.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/htdocs/holiday/month_report.php b/htdocs/holiday/month_report.php index 6f8b0830b2a..fe98779c516 100644 --- a/htdocs/holiday/month_report.php +++ b/htdocs/holiday/month_report.php @@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; // Load translation files required by the page -$langs->loadLangs(array("holiday")); +$langs->loadLangs(array('holiday', 'hrm')); // Security check $socid = 0; @@ -106,7 +106,7 @@ if (empty($reshook)) $arrayfields = array( 'cp.ref'=>array('label'=>$langs->trans('Ref'), 'checked'=>1), 'cp.fk_user'=>array('label'=>$langs->trans('Employee'), 'checked'=>1), - 'ct.label'=>array('label'=>$langs->trans('Type'), 'checked'=>1), + 'cp.fk_type'=>array('label'=>$langs->trans('Type'), 'checked'=>1), 'cp.date_debut'=>array('label'=>$langs->trans('DateDebCP'), 'checked'=>1), 'cp.date_fin'=>array('label'=>$langs->trans('DateFinCP'), 'checked'=>1), 'used_days'=>array('label'=>$langs->trans('NbUseDaysCPShort'), 'checked'=>1), @@ -133,10 +133,9 @@ $search_month = GETPOST("remonth", 'int') ?GETPOST("remonth", 'int') : date("m", $search_year = GETPOST("reyear", 'int') ?GETPOST("reyear", 'int') : date("Y", time()); $year_month = sprintf("%04d", $search_year).'-'.sprintf("%02d", $search_month); -$sql = "SELECT cp.rowid, cp.ref, cp.fk_user, cp.date_debut, cp.date_fin, ct.label, cp.description, cp.halfday"; +$sql = "SELECT cp.rowid, cp.ref, cp.fk_user, cp.date_debut, cp.date_fin, cp.fk_type, cp.description, cp.halfday"; $sql .= " FROM ".MAIN_DB_PREFIX."holiday cp"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user u ON cp.fk_user = u.rowid"; -$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_holiday_types ct ON cp.fk_type = ct.rowid"; $sql .= " WHERE cp.rowid > 0"; $sql .= " AND cp.statut = ".Holiday::STATUS_APPROVED; $sql .= " AND ("; @@ -223,7 +222,7 @@ if (!empty($arrayfields['cp.fk_user']['checked'])) { } // Filter: Type -if (!empty($arrayfields['ct.label']['checked'])) { +if (!empty($arrayfields['cp.fk_type']['checked'])) { $typeleaves = $holidaystatic->getTypes(1, -1); $arraytypeleaves = array(); foreach ($typeleaves as $key => $val) @@ -261,7 +260,7 @@ print ''; print ''; if (!empty($arrayfields['cp.ref']['checked'])) print_liste_field_titre($arrayfields['cp.ref']['label'], $_SERVER["PHP_SELF"], 'cp.ref', '', '', '', $sortfield, $sortorder); if (!empty($arrayfields['cp.fk_user']['checked'])) print_liste_field_titre($arrayfields['cp.fk_user']['label'], $_SERVER["PHP_SELF"], 'cp.fk_user', '', '', '', $sortfield, $sortorder); -if (!empty($arrayfields['ct.label']['checked'])) print_liste_field_titre($arrayfields['ct.label']['label'], $_SERVER["PHP_SELF"], 'ct.label', '', '', '', $sortfield, $sortorder); +if (!empty($arrayfields['cp.fk_type']['checked'])) print_liste_field_titre($arrayfields['cp.fk_type']['label'], $_SERVER["PHP_SELF"], 'cp.fk_type', '', '', '', $sortfield, $sortorder); if (!empty($arrayfields['cp.date_debut']['checked'])) print_liste_field_titre($arrayfields['cp.date_debut']['label'], $_SERVER["PHP_SELF"], 'cp.date_debut', '', '', '', $sortfield, $sortorder); if (!empty($arrayfields['cp.date_fin']['checked'])) print_liste_field_titre($arrayfields['cp.date_fin']['label'], $_SERVER["PHP_SELF"], 'cp.date_fin', '', '', '', $sortfield, $sortorder); if (!empty($arrayfields['used_days']['checked'])) print_liste_field_titre($arrayfields['used_days']['label'], $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder); @@ -323,7 +322,10 @@ else { if (!empty($arrayfields['cp.ref']['checked'])) print ''.$holidaystatic->getNomUrl(1, 1).''; if (!empty($arrayfields['cp.fk_user']['checked'])) print ''.$user->getFullName($langs).''; - if (!empty($arrayfields['ct.label']['checked'])) print ''.$obj->label.''; + + if (!empty($arrayfields['cp.fk_type']['checked'])) { + print ''.$arraytypeleaves[$obj->fk_type].''; + } if (!empty($arrayfields['cp.date_debut']['checked'])) { From 8a8462bf5785e8fb1aa165851b892a40edb0f047 Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Wed, 16 Mar 2022 09:47:57 +0100 Subject: [PATCH 185/610] FIX: holiday monthly report: html entity codes showing in description with WYSIWYG activated --- htdocs/holiday/month_report.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/holiday/month_report.php b/htdocs/holiday/month_report.php index fe98779c516..b45444524f7 100644 --- a/htdocs/holiday/month_report.php +++ b/htdocs/holiday/month_report.php @@ -358,7 +358,10 @@ else { } if (!empty($arrayfields['used_days_month']['checked'])) print ''.num_open_day($date_start_inmonth, $date_end_inmonth, 0, 1, $halfdayinmonth).''; - if (!empty($arrayfields['cp.description']['checked'])) print ''.dol_escape_htmltag(dolGetFirstLineOfText($obj->description)).''; + + if (!empty($arrayfields['cp.description']['checked'])) { + print ''.dolGetFirstLineOfText($obj->description).''; + } print ''; print ''; From 6d6e6ff70c8ada313776d1364b7da0f40da3b8d7 Mon Sep 17 00:00:00 2001 From: lvessiller Date: Wed, 16 Mar 2022 10:49:16 +0100 Subject: [PATCH 186/610] NEW clean values and amount in FEC import --- .../class/accountancyimport.class.php | 40 +++++++++++++++++-- .../modules/import/import_csv.modules.php | 2 +- .../modules/import/import_xlsx.modules.php | 2 +- htdocs/core/modules/modAccounting.class.php | 2 + 4 files changed, 41 insertions(+), 5 deletions(-) diff --git a/htdocs/accountancy/class/accountancyimport.class.php b/htdocs/accountancy/class/accountancyimport.class.php index ea88534b6ed..5231d3a0e36 100644 --- a/htdocs/accountancy/class/accountancyimport.class.php +++ b/htdocs/accountancy/class/accountancyimport.class.php @@ -39,6 +39,35 @@ */ class AccountancyImport { + /** + * Clean amount + * + * @param array $arrayrecord Array of read values: [fieldpos] => (['val']=>val, ['type']=>-1=null,0=blank,1=string), [fieldpos+1]... + * @param string $fieldname Field name with alias + * @param array $listfields Fields list to add + * @param array $listvalues Values list to add + * @param int $record_key Record key + * @return int <0 if KO, >0 if OK + */ + public function cleanAmount(&$arrayrecord, $fieldname, &$listfields, &$listvalues, $record_key) { + $value_trim = trim($arrayrecord[$record_key]['val']); + $arrayrecord[$record_key]['val'] = floatval($value_trim); + } + + /** + * Clean value with trim + * + * @param array $arrayrecord Array of read values: [fieldpos] => (['val']=>val, ['type']=>-1=null,0=blank,1=string), [fieldpos+1]... + * @param string $fieldname Field name with alias + * @param array $listfields Fields list to add + * @param array $listvalues Values list to add + * @param int $record_key Record key + * @return int <0 if KO, >0 if OK + */ + public function cleanValue(&$arrayrecord, $fieldname, &$listfields, &$listvalues, $record_key) { + $arrayrecord[$record_key]['val'] = trim($arrayrecord[$record_key]['val']); + } + /** * Compute amount * @@ -55,13 +84,19 @@ class AccountancyImport $fieldname = $fieldArr[1]; } - $debit = floatval(trim($arrayrecord[11]['val'])); - $credit = floatval(trim($arrayrecord[12]['val'])); + $debit_index = 11; + $credit_index = 12; + $debit_val = trim($arrayrecord[$debit_index]['val']); + $credit_val = trim($arrayrecord[$credit_index]['val']); + $debit = floatval($debit_val); + $credit = floatval($credit_val); if (!empty($debit)) { $amount = $debit; } else { $amount = $credit; } + $listvalues[$debit_index] = "'" . $debit . "'"; + $listvalues[$credit_index] = "'" . $credit . "'"; $listfields[] = $fieldname; $listvalues[] = "'" . abs($amount) . "'"; @@ -69,7 +104,6 @@ class AccountancyImport return 1; } - /** * Compute sens * diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php index 781c22ce7e3..0ff69e9ffa0 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -612,7 +612,7 @@ class ImportCsv extends ModeleImports break; } $classinstance = new $class($this->db); - $res = call_user_func_array(array($classinstance, $method), array(&$arrayrecord)); + $res = call_user_func_array(array($classinstance, $method), array(&$arrayrecord, $fieldname, &$listfields, &$listvalues, $key - 1)); if ($res < 0) { if (!empty($objimport->array_import_convertvalue[0][$val]['dict'])) { $this->errors[$error]['lib'] = $langs->trans('ErrorFieldValueNotIn', $key, $newval, 'code', $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['dict'])); diff --git a/htdocs/core/modules/import/import_xlsx.modules.php b/htdocs/core/modules/import/import_xlsx.modules.php index 1c38f52cbfc..804b4b00c2c 100644 --- a/htdocs/core/modules/import/import_xlsx.modules.php +++ b/htdocs/core/modules/import/import_xlsx.modules.php @@ -653,7 +653,7 @@ class ImportXlsx extends ModeleImports break; } $classinstance = new $class($this->db); - $res = call_user_func_array(array($classinstance, $method), array(&$arrayrecord)); + $res = call_user_func_array(array($classinstance, $method), array(&$arrayrecord, $fieldname, &$listfields, &$listvalues, $key - 1)); if ($res < 0) { if (!empty($objimport->array_import_convertvalue[0][$val]['dict'])) { $this->errors[$error]['lib'] = $langs->trans('ErrorFieldValueNotIn', $key, $newval, 'code', $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['dict'])); diff --git a/htdocs/core/modules/modAccounting.class.php b/htdocs/core/modules/modAccounting.class.php index 73494a6cb04..2331d4da118 100644 --- a/htdocs/core/modules/modAccounting.class.php +++ b/htdocs/core/modules/modAccounting.class.php @@ -354,8 +354,10 @@ class modAccounting extends DolibarrModules 'b.sens'=>'rule-computeDirection' ); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent) $this->import_convertvalue_array[$r]=array( + 'b.piece_num' => array('rule' => 'compute', 'classfile' => '/accountancy/class/accountancyimport.class.php', 'class' => 'AccountancyImport', 'method' => 'cleanValue', 'element' => 'Accountancy'), 'b.numero_compte'=>array('rule'=>'accountingaccount'), 'b.subledger_account'=>array('rule'=>'accountingaccount'), + 'b.multicurrency_amount' => array('rule' => 'compute', 'classfile' => '/accountancy/class/accountancyimport.class.php', 'class' => 'AccountancyImport', 'method' => 'cleanAmount', 'element' => 'Accountancy'), 'b.montant' => array('rule' => 'compute', 'classfile' => '/accountancy/class/accountancyimport.class.php', 'class' => 'AccountancyImport', 'method' => 'computeAmount', 'element' => 'Accountancy'), 'b.sens' => array('rule' => 'compute', 'classfile' => '/accountancy/class/accountancyimport.class.php', 'class' => 'AccountancyImport', 'method' => 'computeDirection', 'element' => 'Accountancy'), ); From 4ad6cc6a65c77254581ac77dcec748da8286bec9 Mon Sep 17 00:00:00 2001 From: lvessiller Date: Wed, 16 Mar 2022 11:00:14 +0100 Subject: [PATCH 187/610] FIX stickler-ci --- htdocs/accountancy/class/accountancyimport.class.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/accountancy/class/accountancyimport.class.php b/htdocs/accountancy/class/accountancyimport.class.php index 5231d3a0e36..b2211b8cf7c 100644 --- a/htdocs/accountancy/class/accountancyimport.class.php +++ b/htdocs/accountancy/class/accountancyimport.class.php @@ -49,7 +49,8 @@ class AccountancyImport * @param int $record_key Record key * @return int <0 if KO, >0 if OK */ - public function cleanAmount(&$arrayrecord, $fieldname, &$listfields, &$listvalues, $record_key) { + public function cleanAmount(&$arrayrecord, $fieldname, &$listfields, &$listvalues, $record_key) + { $value_trim = trim($arrayrecord[$record_key]['val']); $arrayrecord[$record_key]['val'] = floatval($value_trim); } @@ -64,7 +65,8 @@ class AccountancyImport * @param int $record_key Record key * @return int <0 if KO, >0 if OK */ - public function cleanValue(&$arrayrecord, $fieldname, &$listfields, &$listvalues, $record_key) { + public function cleanValue(&$arrayrecord, $fieldname, &$listfields, &$listvalues, $record_key) + { $arrayrecord[$record_key]['val'] = trim($arrayrecord[$record_key]['val']); } From cbbfe684824906e2d04e4c51d39223c1b622bfc8 Mon Sep 17 00:00:00 2001 From: lvessiller Date: Wed, 16 Mar 2022 11:06:14 +0100 Subject: [PATCH 188/610] FIX stickler-ci --- htdocs/accountancy/class/accountancyimport.class.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/accountancy/class/accountancyimport.class.php b/htdocs/accountancy/class/accountancyimport.class.php index b2211b8cf7c..a79484b2a83 100644 --- a/htdocs/accountancy/class/accountancyimport.class.php +++ b/htdocs/accountancy/class/accountancyimport.class.php @@ -33,7 +33,6 @@ */ - /** * Manage the different format accountancy import */ From 4f395a836ea3b180f38c2d6e42d2d0cd76096a63 Mon Sep 17 00:00:00 2001 From: ATM john Date: Wed, 16 Mar 2022 12:10:10 +0100 Subject: [PATCH 189/610] fix crabe multidir output --- htdocs/core/modules/facture/doc/pdf_crabe.modules.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index e26b03cdc46..00f91b6399b 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -290,11 +290,11 @@ class pdf_crabe extends ModelePDFFactures // Definition of $dir and $file if ($object->specimen) { - $dir = $conf->facture->dir_output; + $dir = $conf->facture->multidir_output[$conf->entity]; $file = $dir."/SPECIMEN.pdf"; } else { $objectref = dol_sanitizeFileName($object->ref); - $dir = $conf->facture->dir_output."/".$objectref; + $dir = $conf->facture->multidir_output[$object->entity]."/".$objectref; $file = $dir."/".$objectref.".pdf"; } if (!file_exists($dir)) { From 41fa1f968b47f8e12f5752974771160e1f3122be Mon Sep 17 00:00:00 2001 From: oscim Date: Wed, 16 Mar 2022 12:30:30 +0100 Subject: [PATCH 190/610] Update notify.class.php add in var $parameters transmited in hook outputlangs and labeltouse for customise by hook --- htdocs/core/class/notify.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/notify.class.php b/htdocs/core/class/notify.class.php index 853de6d0a41..7ecd4cde09b 100644 --- a/htdocs/core/class/notify.class.php +++ b/htdocs/core/class/notify.class.php @@ -608,7 +608,7 @@ class Notify $mimefilename_list[] = $ref.".pdf"; } - $parameters = array('notifcode'=>$notifcode, 'sendto'=>$sendto, 'replyto'=>$replyto, 'file'=>$filename_list, 'mimefile'=>$mimetype_list, 'filename'=>$mimefilename_list); + $parameters = array('notifcode'=>$notifcode, 'sendto'=>$sendto, 'replyto'=>$replyto, 'file'=>$filename_list, 'mimefile'=>$mimetype_list, 'filename'=>$mimefilename_list, 'outputlangs'=>$outputlangs, 'labeltouse'=>$labeltouse); if (!isset($action)) { $action = ''; } From a028e795f746c077db56a7cc65114331ca627f17 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Wed, 16 Mar 2022 13:54:21 +0100 Subject: [PATCH 191/610] add missing colspan --- htdocs/comm/action/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index ee71cc48f07..0833929c82a 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -1491,7 +1491,7 @@ if ($id > 0) { print ''.$langs->trans("DateActionStart").''; print ' - '; print 'type_code == 'AC_RDV' ? ' class="fieldrequired"' : '').'>'.$langs->trans("DateActionEnd").''; - print ''; + print ''; //print ''.$langs->trans("DateActionStart").' - '.$langs->trans("DateActionEnd").''; if (GETPOST("afaire") == 1) { print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 0, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', 'tzuser'); From d2005a3bb96723d9f5ccda5df2442d27411923d1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 16 Mar 2022 15:40:17 +0100 Subject: [PATCH 192/610] Fix regression on extrafields not visible --- htdocs/core/tpl/extrafields_view.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/extrafields_view.tpl.php b/htdocs/core/tpl/extrafields_view.tpl.php index f14052766ee..ac243396c72 100644 --- a/htdocs/core/tpl/extrafields_view.tpl.php +++ b/htdocs/core/tpl/extrafields_view.tpl.php @@ -122,7 +122,7 @@ if (empty($reshook) && isset($extrafields->attributes[$object->table_element]['l print ' trextrafields_collapse_last'; } print '"'; - if (empty($extrafields->expand_display[$collapse_group])) { + if (isset($extrafields->expand_display) && empty($extrafields->expand_display[$collapse_group])) { print ' style="display: none;"'; } print '>'; From 536bae97e8dda9b720720bee954902cf24367b9c Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Wed, 16 Mar 2022 15:49:49 +0100 Subject: [PATCH 193/610] FIX Update icon of module reception --- htdocs/admin/mails_templates.php | 2 +- htdocs/core/boxes/box_supplier_orders_awaiting_reception.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php index 0adc526d69e..3abeb0bde54 100644 --- a/htdocs/admin/mails_templates.php +++ b/htdocs/admin/mails_templates.php @@ -205,7 +205,7 @@ if (!empty($conf->expedition->enabled)) { $elementList['shipping_send'] = img_picto('', 'dolly', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendShipment')); } if (!empty($conf->reception->enabled)) { - $elementList['reception_send'] = img_picto('', 'dolly', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendReception')); + $elementList['reception_send'] = img_picto('', 'dollyrevert', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendReception')); } if (!empty($conf->ficheinter->enabled)) { $elementList['fichinter_send'] = img_picto('', 'intervention', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendIntervention')); diff --git a/htdocs/core/boxes/box_supplier_orders_awaiting_reception.php b/htdocs/core/boxes/box_supplier_orders_awaiting_reception.php index 78d38455d83..6345e13cce0 100644 --- a/htdocs/core/boxes/box_supplier_orders_awaiting_reception.php +++ b/htdocs/core/boxes/box_supplier_orders_awaiting_reception.php @@ -162,7 +162,7 @@ class box_supplier_orders_awaiting_reception extends ModeleBoxes $this->info_box_contents[$line][] = array( 'td' => 'class="right"', - 'text' => $delayIcon.' '.dol_print_date($delivery_date, 'day', 'tzuserrel').'', + 'text' => $delayIcon.' '.dol_print_date($delivery_date, 'day', 'tzuserrel').'', 'asis' => 1 ); From 43c39d833ac8fd11e6229d8edc7ece333dbac589 Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Wed, 16 Mar 2022 15:56:39 +0100 Subject: [PATCH 194/610] Fix bug preview on closed status page --- htdocs/core/lib/functions.lib.php | 2 +- htdocs/core/website.inc.php | 7 ++++++- htdocs/website/index.php | 3 ++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index af5671437ae..54090cf2fc6 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -10563,7 +10563,7 @@ function isAFileWithExecutableContent($filename) */ function newToken() { - return $_SESSION['newtoken']; + return !empty($_SESSION['newtoken']) ? $_SESSION['newtoken'] : ""; } /** diff --git a/htdocs/core/website.inc.php b/htdocs/core/website.inc.php index 97199614ece..8205696751b 100644 --- a/htdocs/core/website.inc.php +++ b/htdocs/core/website.inc.php @@ -27,6 +27,11 @@ include_once DOL_DOCUMENT_ROOT.'/website/class/website.class.php'; include_once DOL_DOCUMENT_ROOT.'/website/class/websitepage.class.php'; +$website = null; +$websitepage = null; +$weblangs = null; +$pagelangs = null; + // Detection browser (copy of code from main.inc.php) if (isset($_SERVER["HTTP_USER_AGENT"]) && is_object($conf) && empty($conf->browser->name)) { $tmp = getBrowserInfo($_SERVER["HTTP_USER_AGENT"]); @@ -68,7 +73,7 @@ if ($pageid > 0) { $weblangs->setDefaultLang(GETPOSTISSET('lang') ? GETPOST('lang', 'aZ09') : (empty($_COOKIE['weblangs-shortcode']) ? 'auto' : preg_replace('/[^a-zA-Z0-9_\-]/', '', $_COOKIE['weblangs-shortcode']))); $pagelangs->setDefaultLang($websitepage->lang ? $websitepage->lang : $weblangs->shortlang); - if (!defined('USEDOLIBARREDITOR') && (in_array($websitepage->type_container, array('menu', 'other')) || empty($websitepage->status))) { + if (!defined('USEDOLIBARREDITOR') && (in_array($websitepage->type_container, array('menu', 'other')) || empty($websitepage->status) && !defined('USEDOLIBARRSERVER'))) { $weblangs->load("website"); http_response_code(404); print '


'.$weblangs->trans("YouTryToAccessToAFileThatIsNotAWebsitePage", $websitepage->pageurl, $websitepage->type_container, $websitepage->status).'
'; diff --git a/htdocs/website/index.php b/htdocs/website/index.php index ee279343a6f..d916d0a0e5f 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -2520,6 +2520,7 @@ $form = new Form($db); $formadmin = new FormAdmin($db); $formwebsite = new FormWebsite($db); $formother = new FormOther($db); +$formconfirm = ""; // Confirm generation of website sitemaps if ($action == 'confirmgeneratesitemaps') { @@ -3040,7 +3041,7 @@ if (!GETPOST('hide_websitemenu')) { print ''."\n"; print ' - - - - - - - - - $attribute) { - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print "\n"; -} -print '
trans('Ref') ?>trans('Label') ?>trans('NbOfDifferentValues') ?>trans('NbProducts') ?>
'.dol_htmlentities($attribute->ref).''.dol_htmlentities($attribute->label).''.$attribute->countChildValues().''.$attribute->countChildProducts().''; - print ''.img_edit().''; - print ''.img_delete().''; - print ''; - if ($key > 0) { - print ''.img_up('default', 0, 'imgupforline').''; - } - if ($key < count($variants) - 1) { - print ''.img_down('default', 0, 'imgdownforline').''; - } - print '
'; +if (in_array('builddoc', $arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords)) { + $hidegeneratedfilelistifempty = 1; + if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) { + $hidegeneratedfilelistifempty = 0; + } + + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; + $formfile = new FormFile($db); + + // Show list of available documents + $urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder; + $urlsource .= str_replace('&', '&', $param); + + $filedir = $diroutputmassaction; + $genallowed = $permissiontoread; + $delallowed = $permissiontoadd; + + print $formfile->showdocuments('massfilesarea_productattribute', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty); +} // End of page llxFooter(); diff --git a/htdocs/variants/tpl/README b/htdocs/variants/tpl/README new file mode 100644 index 00000000000..432895e939f --- /dev/null +++ b/htdocs/variants/tpl/README @@ -0,0 +1,3 @@ +README (english) + +This directory is used for storing the common default templates of the system core. (outside any modules) \ No newline at end of file diff --git a/htdocs/variants/tpl/productattributevalueline_create.tpl.php b/htdocs/variants/tpl/productattributevalueline_create.tpl.php new file mode 100644 index 00000000000..cc16302a68d --- /dev/null +++ b/htdocs/variants/tpl/productattributevalueline_create.tpl.php @@ -0,0 +1,91 @@ + + * + * 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 . + * + * Need to have following variables defined: + * $object (invoice, order, ...) + * $conf + * $langs + * $dateSelector + * $forceall (0 by default, 1 for supplier invoices/orders) + * $senderissupplier (0 by default, 1 or 2 for supplier invoices/orders) + * $inputalsopricewithtax (0 by default, 1 to also show column with unit price including tax) + */ + +// Protection to avoid direct call of template +if (empty($object) || !is_object($object)) { + print "Error: this template page cannot be called directly as an URL"; + exit; +} + +global $forcetoshowtitlelines; + +// Define colspan for the button 'Add' +$colspan = 3; // Columns: col edit + col delete + move button + +// Lines for extrafield +$objectline = null; + +print "\n"; +$nolinesbefore = (count($this->lines) == 0 || $forcetoshowtitlelines); +if ($nolinesbefore) { + ?> + + global->MAIN_VIEW_LINE_NUMBER)) { ?> + + + +
trans('AddNewLine'); ?> + + trans('Value'); ?> +   + + + + global->MAIN_VIEW_LINE_NUMBER)) { + $coldisplay++; + echo ''; + } + $coldisplay++; + ?> + + trans('Ref') . ': '; } ?> + " autofocus> + executeHooks('formCreateValueOptions', $parameters, $object, $action); + if (!empty($hookmanager->resPrint)) { + print $hookmanager->resPrint; + } + } + ?> + + + + "> + + + + + + + + diff --git a/htdocs/variants/tpl/productattributevalueline_edit.tpl.php b/htdocs/variants/tpl/productattributevalueline_edit.tpl.php new file mode 100644 index 00000000000..3b842962258 --- /dev/null +++ b/htdocs/variants/tpl/productattributevalueline_edit.tpl.php @@ -0,0 +1,77 @@ + + * + * 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 . + * + * Need to have following variables defined: + * $object (invoice, order, ...) + * $conf + * $langs + * $seller, $buyer + * $dateSelector + * $forceall (0 by default, 1 for supplier invoices/orders) + * $senderissupplier (0 by default, 1 for supplier invoices/orders) + * $inputalsopricewithtax (0 by default, 1 to also show column with unit price including tax) + * $canchangeproduct (0 by default, 1 to allow to change the product if it is a predefined product) + */ + +// Protection to avoid direct call of template +if (empty($object) || !is_object($object)) { + print "Error, template page can't be called as URL"; + exit; +} + +// Define colspan for the button 'Add' +$colspan = 3; // Column: col edit + col delete + move button + +print "\n"; + +$coldisplay = 0; +?> + +global->MAIN_VIEW_LINE_NUMBER)) { ?> + + + +
+ + + + ref); ?>"> + $line); + $reshook = $hookmanager->executeHooks('formEditProductOptions', $parameters, $object, $action); + if (!empty($hookmanager->resPrint)) { + print $hookmanager->resPrint; + } + } + ?> + + + + value); ?>"> + + + + + ">
+ "> + + + + diff --git a/htdocs/variants/tpl/productattributevalueline_title.tpl.php b/htdocs/variants/tpl/productattributevalueline_title.tpl.php new file mode 100644 index 00000000000..ac32a229d5b --- /dev/null +++ b/htdocs/variants/tpl/productattributevalueline_title.tpl.php @@ -0,0 +1,70 @@ + + * + * 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 . + * + * Need to have following variables defined: + * $object (invoice, order, ...) + * $conf + * $langs + * $element (used to test $user->rights->$element->creer) + * $permtoedit (used to replace test $user->rights->$element->creer) + * $inputalsopricewithtax (0 by default, 1 to also show column with unit price including tax) + * $outputalsopricetotalwithtax + * $usemargins (0 to disable all margins columns, 1 to show according to margin setup) + * + * $type, $text, $description, $line + */ + +// Protection to avoid direct call of template +if (empty($object) || !is_object($object)) { + print "Error, template page can't be called as URL"; + exit; +} + +print "\n"; + +// Title line +print "\n"; + +print ''; + +// Adds a line numbering column +if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { + print ' '; +} + +// Ref +print ''.$langs->trans('Ref').''; + +// Value +print ''.$langs->trans('Value').''; + +print ''; // No width to allow autodim + +print ''; + +print ''; + +if ($action == 'selectlines') { + print ''; + print ''; + print ''; + print ''; +} + +print "\n"; +print "\n"; + +print "\n"; diff --git a/htdocs/variants/tpl/productattributevalueline_view.tpl.php b/htdocs/variants/tpl/productattributevalueline_view.tpl.php new file mode 100644 index 00000000000..6acf155f89a --- /dev/null +++ b/htdocs/variants/tpl/productattributevalueline_view.tpl.php @@ -0,0 +1,105 @@ + + * + * 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 . + * + * Need to have following variables defined: + * $object (invoice, order, ...) + * $conf + * $langs + * $dateSelector + * $forceall (0 by default, 1 for supplier invoices/orders) + * $element (used to test $user->rights->$element->creer) + * $permtoedit (used to replace test $user->rights->$element->creer) + * $senderissupplier (0 by default, 1 for supplier invoices/orders) + * $inputalsopricewithtax (0 by default, 1 to also show column with unit price including tax) + * $outputalsopricetotalwithtax + * $usemargins (0 to disable all margins columns, 1 to show according to margin setup) + * $object_rights->creer initialized from = $object->getRights() + * $disableedit, $disablemove, $disableremove + * + * $text, $description, $line + */ + +// Protection to avoid direct call of template +if (empty($object) || !is_object($object)) { + print "Error, template page can't be called as URL"; + exit; +} + +// add html5 elements +$domData = ' data-element="'.$line->element.'"'; +$domData .= ' data-id="'.$line->id.'"'; + +$coldisplay = 0; +?> + + > +global->MAIN_VIEW_LINE_NUMBER)) { ?> + + +
+ ref ?> + + + value ?> +write) && $action != 'selectlines') { + print ''; + $coldisplay++; + if (empty($disableedit)) { ?> + id.'#line_'.$line->id; ?>"> + '; + } + print ''; + + print ''; + $coldisplay++; + if (empty($disableremove)) { // For situation invoice, deletion is not possible if there is a parent company. + print 'id.'">'; + print img_delete(); + print ''; + } + print ''; + + if ($num > 1 && $conf->browser->layout != 'phone' && empty($disablemove)) { + print ''; + $coldisplay++; + if ($i > 0) { ?> + id; ?>"> + + + + id; ?>"> + + + '; + } else { + print 'browser->layout != 'phone' && empty($disablemove)) ? ' class="linecolmove tdlineupdown center"' : ' class="linecolmove center"').'>'; + $coldisplay++; + } +} else { + print ''; + $coldisplay = $coldisplay + 3; +} + +if ($action == 'selectlines') { ?> + +\n"; + +print "\n"; From 26a462dce0babaa1d3f8fb093281672282c99d45 Mon Sep 17 00:00:00 2001 From: kamel Date: Fri, 18 Mar 2022 15:43:32 +0100 Subject: [PATCH 270/610] NEW : Update variants to standard card and list (permission) --- htdocs/core/modules/modVariants.class.php | 14 ++++++++++++++ htdocs/langs/en_US/admin.lang | 3 +++ htdocs/variants/card.php | 8 ++++---- htdocs/variants/class/ProductAttribute.class.php | 2 +- htdocs/variants/list.php | 6 +++--- 5 files changed, 25 insertions(+), 8 deletions(-) diff --git a/htdocs/core/modules/modVariants.class.php b/htdocs/core/modules/modVariants.class.php index 049377a561f..ad71d2ca300 100644 --- a/htdocs/core/modules/modVariants.class.php +++ b/htdocs/core/modules/modVariants.class.php @@ -109,5 +109,19 @@ class modVariants extends DolibarrModules // Permissions $this->rights = array(); // Permission array used by this module + $r = 0; + + $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used) + $this->rights[$r][1] = 'Read objects of ProductAttribute'; // Permission label + $this->rights[$r][4] = 'read'; // In php code, permission will be checked by test if ($user->rights->eventorganization->level1) + $r++; + $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used) + $this->rights[$r][1] = 'Create/Update objects of ProductAttribute'; // Permission label + $this->rights[$r][4] = 'write'; // In php code, permission will be checked by test if ($user->rights->eventorganization->level1) + $r++; + $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used) + $this->rights[$r][1] = 'Delete objects of ProductAttribute'; // Permission label + $this->rights[$r][4] = 'delete'; // In php code, permission will be checked by test if ($user->rights->eventorganization->level1) + $r++; } } diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index cffd3532c05..0971771e9ca 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -883,6 +883,9 @@ Permission564=Record Debits/Rejections of credit transfer Permission601=Read stickers Permission602=Create/modify stickers Permission609=Delete stickers +Permission611=Read objects of ProductAttribute +Permission612=Create/Update objects of ProductAttribute +Permission613=Delete objects of ProductAttribute Permission650=Read Bills of Materials Permission651=Create/Update Bills of Materials Permission652=Delete Bills of Materials diff --git a/htdocs/variants/card.php b/htdocs/variants/card.php index 1ee1543b9e4..1a97c2252df 100644 --- a/htdocs/variants/card.php +++ b/htdocs/variants/card.php @@ -58,10 +58,10 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be includ // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('productattributecard', 'globalcard')); -$permissiontoread = $user->rights->produit->lire || $user->rights->service->lire; -$permissiontoadd = $user->rights->produit->lire || $user->rights->service->lire; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php -$permissiontoedit = $user->rights->produit->lire || $user->rights->service->lire; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php -$permissiontodelete = $user->rights->produit->lire || $user->rights->service->lire; +$permissiontoread = $user->rights->variants->read; +$permissiontoadd = $user->rights->variants->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php +$permissiontoedit = $user->rights->variants->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php +$permissiontodelete = $user->rights->variants->delete; $error = 0; diff --git a/htdocs/variants/class/ProductAttribute.class.php b/htdocs/variants/class/ProductAttribute.class.php index 94aa87d6031..2a97b44009e 100644 --- a/htdocs/variants/class/ProductAttribute.class.php +++ b/htdocs/variants/class/ProductAttribute.class.php @@ -1346,7 +1346,7 @@ class ProductAttribute extends CommonObject global $form; global $object_rights, $disableedit, $disablemove, $disableremove; // TODO We should not use global var for this ! - $object_rights = $user->rights->produit->lire || $user->rights->service->lire; + $object_rights = $user->rights->variants; // Line in view mode if ($action != 'editline' || $selected != $line->id) { diff --git a/htdocs/variants/list.php b/htdocs/variants/list.php index 6881b17b781..950db09bb4b 100644 --- a/htdocs/variants/list.php +++ b/htdocs/variants/list.php @@ -131,9 +131,9 @@ $arrayfields['nb_products'] = array( $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); -$permissiontoread = $user->rights->produit->lire || $user->rights->service->lire; -$permissiontoadd = $user->rights->produit->lire || $user->rights->service->lire; -$permissiontodelete = $user->rights->produit->lire || $user->rights->service->lire; +$permissiontoread = $user->rights->variants->read; +$permissiontoadd = $user->rights->variants->write; +$permissiontodelete = $user->rights->variants->delete; // Security check if (empty($conf->variants->enabled)) { From 84ef951a99d783cb2523382f6551ef84c74a1111 Mon Sep 17 00:00:00 2001 From: GregM Date: Fri, 18 Mar 2022 16:12:38 +0100 Subject: [PATCH 271/610] replacing to dolGetButtonAction on Salaries card --- htdocs/salaries/card.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/salaries/card.php b/htdocs/salaries/card.php index 32be3b3013d..dd5e381cb5f 100644 --- a/htdocs/salaries/card.php +++ b/htdocs/salaries/card.php @@ -1043,34 +1043,34 @@ if ($id) { if ($action != 'edit') { // Reopen if ($object->paye && $user->rights->salaries->write) { - print '"; + print dolGetButtonAction('', $langs->trans('ReOpen'), 'default', $_SERVER["PHP_SELF"].'?action=reopen&token='.newToken().'&id='.$object->id, ''); } // Edit if ($object->paye == 0 && $user->rights->salaries->write) { - print '"; + print dolGetButtonAction('', $langs->trans('Modify'), 'default', $_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'&id='.$object->id, ''); } // Emit payment if ($object->paye == 0 && ((price2num($object->amount) < 0 && $resteapayer < 0) || (price2num($object->amount) > 0 && $resteapayer > 0)) && $user->rights->salaries->write) { - print '"; + print dolGetButtonAction('', $langs->trans('DoPayment'), 'default', DOL_URL_ROOT.'/salaries/paiement_salary.php'.'?action=create&token='.newToken().'&id='.$object->id, ''); } // Classify 'paid' // If payment complete $resteapayer <= 0 on a positive salary, or if amount is negative, we allow to classify as paid. if ($object->paye == 0 && (($resteapayer <= 0 && $object->amount > 0) || ($object->amount <= 0)) && $user->rights->salaries->write) { - print '"; + print dolGetButtonAction('', $langs->trans('ClassifyPaid'), 'default', $_SERVER["PHP_SELF"].'?action=paid&token='.newToken().'&id='.$object->id, ''); } // Clone if ($user->rights->salaries->write) { - print '"; + print dolGetButtonAction('', $langs->trans('ToClone'), 'default', $_SERVER["PHP_SELF"].'?action=clone&token='.newToken().'&id='.$object->id, ''); } if (!empty($user->rights->salaries->delete) && empty($totalpaye)) { - print ''; + print dolGetButtonAction('', $langs->trans('Delete'), 'delete', $_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$object->id, ''); } else { - print ''; + print dolGetButtonAction($langs->trans('DisabledBecausePayments'),$langs->trans('Delete'), 'default', $_SERVER['PHP_SELF'].'#', '', false); } } print "
"; From ed631b2b060742a1e894d93cc652f487cb7cde68 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 18 Mar 2022 16:14:20 +0100 Subject: [PATCH 272/610] Fix doxygen, missing error message --- htdocs/adherents/class/api_members.class.php | 2 +- .../class/api_memberstypes.class.php | 2 +- .../class/api_subscriptions.class.php | 4 +-- htdocs/api/class/api_documents.class.php | 6 ++-- .../comm/propal/class/api_proposals.class.php | 4 +-- htdocs/commande/class/api_orders.class.php | 8 ++--- .../facture/class/api_invoices.class.php | 14 ++++---- htdocs/don/class/api_donations.class.php | 2 +- .../class/api_expensereports.class.php | 2 +- .../class/api_supplier_invoices.class.php | 8 ++--- .../fourn/class/api_supplier_orders.class.php | 2 +- htdocs/product/class/api_products.class.php | 34 +++++++++---------- .../societe/class/api_thirdparties.class.php | 2 +- htdocs/ticket/class/api_tickets.class.php | 4 +-- htdocs/user/class/api_users.class.php | 2 +- 15 files changed, 48 insertions(+), 48 deletions(-) diff --git a/htdocs/adherents/class/api_members.class.php b/htdocs/adherents/class/api_members.class.php index 6fad266ea36..d30e851b9a2 100644 --- a/htdocs/adherents/class/api_members.class.php +++ b/htdocs/adherents/class/api_members.class.php @@ -358,7 +358,7 @@ class Members extends DolibarrApi if ($member->update(DolibarrApiAccess::$user) >= 0) { return $this->get($id); } else { - throw new RestException(500, $member->error); + throw new RestException(500, 'Error when updating member: '.$member->error); } } diff --git a/htdocs/adherents/class/api_memberstypes.class.php b/htdocs/adherents/class/api_memberstypes.class.php index be8f22f3c45..d95de755166 100644 --- a/htdocs/adherents/class/api_memberstypes.class.php +++ b/htdocs/adherents/class/api_memberstypes.class.php @@ -204,7 +204,7 @@ class MembersTypes extends DolibarrApi if ($membertype->update(DolibarrApiAccess::$user) >= 0) { return $this->get($id); } else { - throw new RestException(500, $membertype->error); + throw new RestException(500, 'Error when updating member type: '.$membertype->error); } } diff --git a/htdocs/adherents/class/api_subscriptions.class.php b/htdocs/adherents/class/api_subscriptions.class.php index 55b93df7663..f969017146b 100644 --- a/htdocs/adherents/class/api_subscriptions.class.php +++ b/htdocs/adherents/class/api_subscriptions.class.php @@ -159,7 +159,7 @@ class Subscriptions extends DolibarrApi $subscription->$field = $value; } if ($subscription->create(DolibarrApiAccess::$user) < 0) { - throw new RestException(500, 'Error when creating subscription', array_merge(array($subscription->error), $subscription->errors)); + throw new RestException(500, 'Error when creating contribution', array_merge(array($subscription->error), $subscription->errors)); } return $subscription->id; } @@ -193,7 +193,7 @@ class Subscriptions extends DolibarrApi if ($subscription->update(DolibarrApiAccess::$user) > 0) { return $this->get($id); } else { - throw new RestException(500, $subscription->error); + throw new RestException(500, 'Error when updating contribution: '.$subscription->error); } } diff --git a/htdocs/api/class/api_documents.class.php b/htdocs/api/class/api_documents.class.php index 28dbef6887e..da49e4cbba7 100644 --- a/htdocs/api/class/api_documents.class.php +++ b/htdocs/api/class/api_documents.class.php @@ -126,7 +126,7 @@ class Documents extends DolibarrApi * @param string $langcode Language code like 'en_US', 'fr_FR', 'es_ES', ... (If not set, use the default language). * @return array List of documents * - * @throws RestException 500 + * @throws RestException 500 System error * @throws RestException 501 * @throws RestException 400 * @throws RestException 401 @@ -249,7 +249,7 @@ class Documents extends DolibarrApi * @throws RestException 400 * @throws RestException 401 * @throws RestException 404 - * @throws RestException 500 + * @throws RestException 500 System error * * @url GET / */ @@ -546,7 +546,7 @@ class Documents extends DolibarrApi * @throws RestException 400 * @throws RestException 401 * @throws RestException 404 - * @throws RestException 500 + * @throws RestException 500 System error * * @url POST /upload */ diff --git a/htdocs/comm/propal/class/api_proposals.class.php b/htdocs/comm/propal/class/api_proposals.class.php index 41ed388e044..2cc17987224 100644 --- a/htdocs/comm/propal/class/api_proposals.class.php +++ b/htdocs/comm/propal/class/api_proposals.class.php @@ -533,7 +533,7 @@ class Proposals extends DolibarrApi * * @throws RestException 401 * @throws RestException 404 - * @throws RestException 500 + * @throws RestException 500 System error */ public function deleteContact($id, $contactid, $type) { @@ -707,7 +707,7 @@ class Proposals extends DolibarrApi * @throws RestException 304 * @throws RestException 401 * @throws RestException 404 - * @throws RestException 500 + * @throws RestException 500 System error * * @return array */ diff --git a/htdocs/commande/class/api_orders.class.php b/htdocs/commande/class/api_orders.class.php index 48865f958a2..fb912139d5f 100644 --- a/htdocs/commande/class/api_orders.class.php +++ b/htdocs/commande/class/api_orders.class.php @@ -574,7 +574,7 @@ class Orders extends DolibarrApi * * @throws RestException 401 * @throws RestException 404 - * @throws RestException 500 + * @throws RestException 500 System error */ public function deleteContact($id, $contactid, $type) { @@ -704,7 +704,7 @@ class Orders extends DolibarrApi * @throws RestException 304 * @throws RestException 401 * @throws RestException 404 - * @throws RestException 500 + * @throws RestException 500 System error * * @return array */ @@ -974,7 +974,7 @@ class Orders extends DolibarrApi * * @throws RestException 401 * @throws RestException 404 - * @throws RestException 500 + * @throws RestException 500 System error */ public function getOrderShipments($id) { @@ -1030,7 +1030,7 @@ class Orders extends DolibarrApi * * @throws RestException 401 * @throws RestException 404 - * @throws RestException 500 + * @throws RestException 500 System error */ public function createOrderShipment($id, $warehouse_id) { diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index 8282610d01d..61f0a9e8d15 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -507,7 +507,7 @@ class Invoices extends DolibarrApi * * @throws RestException 401 * @throws RestException 404 - * @throws RestException 500 + * @throws RestException 500 System error */ public function deleteContact($id, $contactid, $type) { @@ -649,7 +649,7 @@ class Invoices extends DolibarrApi $result = $this->invoice->delete(DolibarrApiAccess::$user); if ($result < 0) { - throw new RestException(500); + throw new RestException(500, 'Error when deleting invoice'); } return array( @@ -768,7 +768,7 @@ class Invoices extends DolibarrApi * @throws RestException 304 * @throws RestException 401 * @throws RestException 404 - * @throws RestException 500 + * @throws RestException 500 System error * */ public function addContact($id, $fk_socpeople, $type_contact, $source, $notrigger = 0) @@ -817,7 +817,7 @@ class Invoices extends DolibarrApi * @throws RestException 304 * @throws RestException 401 * @throws RestException 404 - * @throws RestException 500 + * @throws RestException 500 System error * */ public function settodraft($id, $idwarehouse = -1) @@ -920,7 +920,7 @@ class Invoices extends DolibarrApi * @throws RestException 304 * @throws RestException 401 * @throws RestException 404 - * @throws RestException 500 + * @throws RestException 500 System error */ public function settopaid($id, $close_code = '', $close_note = '') { @@ -970,7 +970,7 @@ class Invoices extends DolibarrApi * @throws RestException 304 * @throws RestException 401 * @throws RestException 404 - * @throws RestException 500 + * @throws RestException 500 System error */ public function settounpaid($id) { @@ -1057,7 +1057,7 @@ class Invoices extends DolibarrApi * @throws RestException 304 * @throws RestException 401 * @throws RestException 404 - * @throws RestException 500 + * @throws RestException 500 System error */ public function markAsCreditAvailable($id) { diff --git a/htdocs/don/class/api_donations.class.php b/htdocs/don/class/api_donations.class.php index 597f15b7f10..f9af0568bf0 100644 --- a/htdocs/don/class/api_donations.class.php +++ b/htdocs/don/class/api_donations.class.php @@ -293,7 +293,7 @@ class Donations extends DolibarrApi * @throws RestException 304 * @throws RestException 401 * @throws RestException 404 - * @throws RestException 500 + * @throws RestException 500 System error * * @return array */ diff --git a/htdocs/expensereport/class/api_expensereports.class.php b/htdocs/expensereport/class/api_expensereports.class.php index df942ff93e6..37319a3ec71 100644 --- a/htdocs/expensereport/class/api_expensereports.class.php +++ b/htdocs/expensereport/class/api_expensereports.class.php @@ -401,7 +401,7 @@ class ExpenseReports extends DolibarrApi * * @throws RestException 401 Not allowed * @throws RestException 404 Expense report not found - * @throws RestException 500 + * @throws RestException 500 System error */ public function put($id, $request_data = null) { diff --git a/htdocs/fourn/class/api_supplier_invoices.class.php b/htdocs/fourn/class/api_supplier_invoices.class.php index 06c836b4d77..35e783729ff 100644 --- a/htdocs/fourn/class/api_supplier_invoices.class.php +++ b/htdocs/fourn/class/api_supplier_invoices.class.php @@ -211,7 +211,7 @@ class SupplierInvoices extends DolibarrApi * @return int ID of supplier invoice * * @throws RestException 401 - * @throws RestException 500 + * @throws RestException 500 System error */ public function post($request_data = null) { @@ -283,7 +283,7 @@ class SupplierInvoices extends DolibarrApi * * @throws RestException 401 * @throws RestException 404 - * @throws RestException 500 + * @throws RestException 500 System error */ public function delete($id) { @@ -300,7 +300,7 @@ class SupplierInvoices extends DolibarrApi } if ($this->invoice->delete(DolibarrApiAccess::$user) < 0) { - throw new RestException(500); + throw new RestException(500, 'Error when deleting invoice'); } return array( @@ -326,7 +326,7 @@ class SupplierInvoices extends DolibarrApi * @throws RestException 401 * @throws RestException 404 * @throws RestException 405 - * @throws RestException 500 + * @throws RestException 500 System error */ public function validate($id, $idwarehouse = 0, $notrigger = 0) { diff --git a/htdocs/fourn/class/api_supplier_orders.class.php b/htdocs/fourn/class/api_supplier_orders.class.php index e21eb3436dc..d55a398dbd6 100644 --- a/htdocs/fourn/class/api_supplier_orders.class.php +++ b/htdocs/fourn/class/api_supplier_orders.class.php @@ -309,7 +309,7 @@ class SupplierOrders extends DolibarrApi } if ($this->order->delete(DolibarrApiAccess::$user) < 0) { - throw new RestException(500); + throw new RestException(500, 'Error when deleting order'); } return array( diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index ec735da3865..0f21b2aac3c 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -742,7 +742,7 @@ class Products extends DolibarrApi * @param int $fk_barcode_type Barcode type * @return int * - * @throws RestException 500 + * @throws RestException 500 System error * @throws RestException 401 * * @url POST {id}/purchase_prices @@ -1158,7 +1158,7 @@ class Products extends DolibarrApi * @param string $ref_ext External reference of Attribute * @return array * - * @throws RestException 500 + * @throws RestException 500 System error * @throws RestException 401 * * @url GET attributes/ref_ext/{ref_ext} @@ -1206,7 +1206,7 @@ class Products extends DolibarrApi * @param string $ref_ext Reference of Attribute * @return int * - * @throws RestException 500 + * @throws RestException 500 System error * @throws RestException 401 * * @url POST attributes @@ -1283,7 +1283,7 @@ class Products extends DolibarrApi * @param int $id ID of Attribute * @return int Result of deletion * - * @throws RestException 500 + * @throws RestException 500 System error * @throws RestException 401 * * @url DELETE attributes/{id} @@ -1311,7 +1311,7 @@ class Products extends DolibarrApi * @param int $id ID of Attribute value * @return array * - * @throws RestException 500 + * @throws RestException 500 System error * @throws RestException 401 * * @url GET attributes/values/{id} @@ -1352,7 +1352,7 @@ class Products extends DolibarrApi * @param string $ref Ref of Attribute value * @return array * - * @throws RestException 500 + * @throws RestException 500 System error * @throws RestException 401 * * @url GET attributes/{id}/values/ref/{ref} @@ -1439,7 +1439,7 @@ class Products extends DolibarrApi * @return array * * @throws RestException 401 - * @throws RestException 500 + * @throws RestException 500 System error * * @url GET attributes/{id}/values */ @@ -1511,7 +1511,7 @@ class Products extends DolibarrApi * @param string $value Value of Attribute value * @return int * - * @throws RestException 500 + * @throws RestException 500 System error * @throws RestException 401 * * @url POST attributes/{id}/values @@ -1545,7 +1545,7 @@ class Products extends DolibarrApi * @return array * * @throws RestException 401 - * @throws RestException 500 + * @throws RestException 500 System error * * @url PUT attributes/values/{id} */ @@ -1590,7 +1590,7 @@ class Products extends DolibarrApi * @param int $id ID of Attribute value * @return int * - * @throws RestException 500 + * @throws RestException 500 System error * @throws RestException 401 * * @url DELETE attributes/values/{id} @@ -1617,7 +1617,7 @@ class Products extends DolibarrApi * @param int $includestock Default value 0. If parameter is set to 1 the response will contain stock data of each variant * @return array * - * @throws RestException 500 + * @throws RestException 500 System error * @throws RestException 401 * * @url GET {id}/variants @@ -1653,7 +1653,7 @@ class Products extends DolibarrApi * @param string $ref Ref of Product * @return array * - * @throws RestException 500 + * @throws RestException 500 System error * @throws RestException 401 * * @url GET ref/{ref}/variants @@ -1695,7 +1695,7 @@ class Products extends DolibarrApi * @param string $ref_ext External reference of variant * @return int * - * @throws RestException 500 + * @throws RestException 500 System error * @throws RestException 401 * @throws RestException 404 * @@ -1752,7 +1752,7 @@ class Products extends DolibarrApi * @param array $features List of attributes pairs id_attribute->id_value. Example: array(id_color=>id_Blue, id_size=>id_small, id_option=>id_val_a, ...) * @return int * - * @throws RestException 500 + * @throws RestException 500 System error * @throws RestException 401 * @throws RestException 404 * @@ -1807,7 +1807,7 @@ class Products extends DolibarrApi * @param array $request_data Datas * @return int * - * @throws RestException 500 + * @throws RestException 500 System error * @throws RestException 401 * * @url PUT variants/{id} @@ -1841,7 +1841,7 @@ class Products extends DolibarrApi * @param int $id ID of Variant * @return int Result of deletion * - * @throws RestException 500 + * @throws RestException 500 System error * @throws RestException 401 * * @url DELETE variants/{id} @@ -1869,7 +1869,7 @@ class Products extends DolibarrApi * @param int $selected_warehouse_id ID of warehouse * @return int * - * @throws RestException 500 + * @throws RestException 500 System error * @throws RestException 401 * @throws RestException 404 * diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php index 47e893846e6..962bbf021b8 100644 --- a/htdocs/societe/class/api_thirdparties.class.php +++ b/htdocs/societe/class/api_thirdparties.class.php @@ -1409,7 +1409,7 @@ class Thirdparties extends DolibarrApi if ($result > 0) { return array("success" => $result); } else { - throw new RestException(500); + throw new RestException(500, 'Error generating the document '.$this->error); } } diff --git a/htdocs/ticket/class/api_tickets.class.php b/htdocs/ticket/class/api_tickets.class.php index 75c2db21224..3151f75877b 100644 --- a/htdocs/ticket/class/api_tickets.class.php +++ b/htdocs/ticket/class/api_tickets.class.php @@ -377,7 +377,7 @@ class Tickets extends DolibarrApi } $this->ticket->message = $ticketMessageText; if (!$this->ticket->createTicketMessage(DolibarrApiAccess::$user)) { - throw new RestException(500); + throw new RestException(500, 'Error when creating ticket'); } return $this->ticket->id; } @@ -438,7 +438,7 @@ class Tickets extends DolibarrApi } if (!$this->ticket->delete($id)) { - throw new RestException(500); + throw new RestException(500, 'Error when deleting ticket'); } return array( diff --git a/htdocs/user/class/api_users.class.php b/htdocs/user/class/api_users.class.php index 68aa2b650f7..66d842c3564 100644 --- a/htdocs/user/class/api_users.class.php +++ b/htdocs/user/class/api_users.class.php @@ -466,7 +466,7 @@ class Users extends DolibarrApi * * @throws RestException 401 Not allowed * @throws RestException 404 User not found - * @throws RestException 500 Error + * @throws RestException 500 System error * * @url GET {id}/setGroup/{group} */ From c336352ecbbeb152509c3cc9664c8636494a84cf Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Fri, 18 Mar 2022 15:19:53 +0000 Subject: [PATCH 273/610] Fixing style errors. --- htdocs/salaries/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/salaries/card.php b/htdocs/salaries/card.php index dd5e381cb5f..0e15abe113d 100644 --- a/htdocs/salaries/card.php +++ b/htdocs/salaries/card.php @@ -1070,7 +1070,7 @@ if ($id) { if (!empty($user->rights->salaries->delete) && empty($totalpaye)) { print dolGetButtonAction('', $langs->trans('Delete'), 'delete', $_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$object->id, ''); } else { - print dolGetButtonAction($langs->trans('DisabledBecausePayments'),$langs->trans('Delete'), 'default', $_SERVER['PHP_SELF'].'#', '', false); + print dolGetButtonAction($langs->trans('DisabledBecausePayments'), $langs->trans('Delete'), 'default', $_SERVER['PHP_SELF'].'#', '', false); } } print "
"; From a64bb071cfb18489d29997eb8478a80a3e53e86d Mon Sep 17 00:00:00 2001 From: GregM Date: Fri, 18 Mar 2022 16:20:18 +0100 Subject: [PATCH 274/610] fix dolGetButtonAction params --- htdocs/ticket/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index 397d68e1efb..1db57a96cf8 100755 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -1424,7 +1424,7 @@ if ($action == 'create' || $action == 'presend') { // Link to create an intervention // socid is needed otherwise fichinter ask it and forgot origin after form submit :\ if (!$object->fk_soc && $user->rights->ficheinter->creer) { - print dolGetButtonAction($langs->trans('UnableToCreateInterIfNoSocid'),$langs->trans('TicketAddIntervention'), '', 'default', $_SERVER['PHP_SELF'].'#', '', false); + print dolGetButtonAction($langs->trans('UnableToCreateInterIfNoSocid'),$langs->trans('TicketAddIntervention'),'default', $_SERVER['PHP_SELF'].'#', '', false); } if ($object->fk_soc > 0 && $object->fk_statut < Ticket::STATUS_CLOSED && $user->rights->ficheinter->creer) { print dolGetButtonAction('', $langs->trans('TicketAddIntervention'), 'default', DOL_URL_ROOT.'/fichinter/card.php'.'?action=create&token='.newToken().'&socid='.$object->fk_soc.'&origin=ticket_ticket&originid='.$object->id, ''); From 4c4d18ebd6c1c0f91699400c66783e71593220c3 Mon Sep 17 00:00:00 2001 From: GregM Date: Fri, 18 Mar 2022 16:28:25 +0100 Subject: [PATCH 275/610] clean --- htdocs/salaries/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/salaries/card.php b/htdocs/salaries/card.php index dd5e381cb5f..0e15abe113d 100644 --- a/htdocs/salaries/card.php +++ b/htdocs/salaries/card.php @@ -1070,7 +1070,7 @@ if ($id) { if (!empty($user->rights->salaries->delete) && empty($totalpaye)) { print dolGetButtonAction('', $langs->trans('Delete'), 'delete', $_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$object->id, ''); } else { - print dolGetButtonAction($langs->trans('DisabledBecausePayments'),$langs->trans('Delete'), 'default', $_SERVER['PHP_SELF'].'#', '', false); + print dolGetButtonAction($langs->trans('DisabledBecausePayments'), $langs->trans('Delete'), 'default', $_SERVER['PHP_SELF'].'#', '', false); } } print ""; From 3ef36c566fbe74bbe8c143fd07e69c87703f3737 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Fri, 18 Mar 2022 15:32:11 +0000 Subject: [PATCH 276/610] Fixing style errors. --- htdocs/ticket/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index 2e1dc59dd15..179edddf495 100755 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -1424,7 +1424,7 @@ if ($action == 'create' || $action == 'presend') { // Link to create an intervention // socid is needed otherwise fichinter ask it and forgot origin after form submit :\ if (!$object->fk_soc && $user->rights->ficheinter->creer) { - print dolGetButtonAction($langs->trans('UnableToCreateInterIfNoSocid'), $langs->trans('TicketAddIntervention'),'default', $_SERVER['PHP_SELF'].'#', '', false); + print dolGetButtonAction($langs->trans('UnableToCreateInterIfNoSocid'), $langs->trans('TicketAddIntervention'), 'default', $_SERVER['PHP_SELF'].'#', '', false); } if ($object->fk_soc > 0 && $object->fk_statut < Ticket::STATUS_CLOSED && $user->rights->ficheinter->creer) { print dolGetButtonAction('', $langs->trans('TicketAddIntervention'), 'default', DOL_URL_ROOT.'/fichinter/card.php'.'?action=create&token='.newToken().'&socid='.$object->fk_soc.'&origin=ticket_ticket&originid='.$object->id, ''); From 006dc787c19b5c2fbca8e6c4b2d825b0c002e7a1 Mon Sep 17 00:00:00 2001 From: BB2A Anthony Berton Date: Fri, 18 Mar 2022 16:34:44 +0100 Subject: [PATCH 277/610] method_exists skip fatal error --- htdocs/core/lib/functions.lib.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 109f0fa3f13..b37eff45df6 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -8778,8 +8778,10 @@ function complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, dol_include_once($labeltemp[2]); $obj = new $labeltemp[1]($db); $function = $labeltemp[3]; - $nbrec = $obj->$function($object->id, $obj); - $label .= ''.$nbrec.''; + if (method_exists($obj, $function)) { + $nbrec = $obj->$function($object->id, $obj); + $label .= ''.$nbrec.''; + } } } else { $label = $langs->trans($values[2]); From e2068f1aa8fe8e22d20efb77db56238c050ee97e Mon Sep 17 00:00:00 2001 From: GregM Date: Fri, 18 Mar 2022 16:41:18 +0100 Subject: [PATCH 278/610] clean --- htdocs/ticket/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index 179edddf495..824fc143f3f 100755 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -1424,7 +1424,7 @@ if ($action == 'create' || $action == 'presend') { // Link to create an intervention // socid is needed otherwise fichinter ask it and forgot origin after form submit :\ if (!$object->fk_soc && $user->rights->ficheinter->creer) { - print dolGetButtonAction($langs->trans('UnableToCreateInterIfNoSocid'), $langs->trans('TicketAddIntervention'), 'default', $_SERVER['PHP_SELF'].'#', '', false); + print dolGetButtonAction($langs->trans('UnableToCreateInterIfNoSocid'), $langs->trans('TicketAddIntervention'), 'default', $_SERVER['PHP_SELF']. '#', '', false); } if ($object->fk_soc > 0 && $object->fk_statut < Ticket::STATUS_CLOSED && $user->rights->ficheinter->creer) { print dolGetButtonAction('', $langs->trans('TicketAddIntervention'), 'default', DOL_URL_ROOT.'/fichinter/card.php'.'?action=create&token='.newToken().'&socid='.$object->fk_soc.'&origin=ticket_ticket&originid='.$object->id, ''); From f0e3c33dc306aeed046ade52519ab2a5a0fb4235 Mon Sep 17 00:00:00 2001 From: BB2A Anthony Berton Date: Fri, 18 Mar 2022 16:55:53 +0100 Subject: [PATCH 279/610] $labeltemp is alwase true --- htdocs/core/lib/functions.lib.php | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index b37eff45df6..517d09ba453 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -8772,19 +8772,15 @@ function complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, $label = make_substitutions($reg[1], $substitutionarray); } else { $labeltemp = explode(',', $values[2]); - if (is_array($labeltemp)) { - $label = $langs->trans($labeltemp[0]); - if (!empty($labeltemp[1]) && is_object($object) && !empty($object->id)) { - dol_include_once($labeltemp[2]); - $obj = new $labeltemp[1]($db); - $function = $labeltemp[3]; - if (method_exists($obj, $function)) { - $nbrec = $obj->$function($object->id, $obj); - $label .= ''.$nbrec.''; - } + $label = $langs->trans($labeltemp[0]); + if (!empty($labeltemp[1]) && is_object($object) && !empty($object->id)) { + dol_include_once($labeltemp[2]); + $obj = new $labeltemp[1]($db); + $function = $labeltemp[3]; + if (method_exists($obj, $function)) { + $nbrec = $obj->$function($object->id, $obj); + $label .= ''.$nbrec.''; } - } else { - $label = $langs->trans($values[2]); } } From 457c76017744caa9eec28cb72dfa31ad878fa31e Mon Sep 17 00:00:00 2001 From: GregM Date: Fri, 18 Mar 2022 16:57:42 +0100 Subject: [PATCH 280/610] clean --- htdocs/salaries/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/salaries/card.php b/htdocs/salaries/card.php index 0e15abe113d..f9a0b17adfd 100644 --- a/htdocs/salaries/card.php +++ b/htdocs/salaries/card.php @@ -1053,7 +1053,7 @@ if ($id) { // Emit payment if ($object->paye == 0 && ((price2num($object->amount) < 0 && $resteapayer < 0) || (price2num($object->amount) > 0 && $resteapayer > 0)) && $user->rights->salaries->write) { - print dolGetButtonAction('', $langs->trans('DoPayment'), 'default', DOL_URL_ROOT.'/salaries/paiement_salary.php'.'?action=create&token='.newToken().'&id='.$object->id, ''); + print dolGetButtonAction('', $langs->trans('DoPayment'), 'default', DOL_URL_ROOT.'/salaries/paiement_salary.php?action=create&token='.newToken().'&id='. $object->id, ''); } // Classify 'paid' From 941754599758e4cc6a102aa60e0327f8efd84296 Mon Sep 17 00:00:00 2001 From: GregM Date: Fri, 18 Mar 2022 16:58:59 +0100 Subject: [PATCH 281/610] clean --- htdocs/ticket/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index 824fc143f3f..3e37c2c28e5 100755 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -1427,7 +1427,7 @@ if ($action == 'create' || $action == 'presend') { print dolGetButtonAction($langs->trans('UnableToCreateInterIfNoSocid'), $langs->trans('TicketAddIntervention'), 'default', $_SERVER['PHP_SELF']. '#', '', false); } if ($object->fk_soc > 0 && $object->fk_statut < Ticket::STATUS_CLOSED && $user->rights->ficheinter->creer) { - print dolGetButtonAction('', $langs->trans('TicketAddIntervention'), 'default', DOL_URL_ROOT.'/fichinter/card.php'.'?action=create&token='.newToken().'&socid='.$object->fk_soc.'&origin=ticket_ticket&originid='.$object->id, ''); + print dolGetButtonAction('', $langs->trans('TicketAddIntervention'), 'default', DOL_URL_ROOT.'/fichinter/card.php?action=create&token='.newToken().'&socid='. $object->fk_soc.'&origin=ticket_ticket&originid='. $object->id, ''); } /* This is useless. We can already modify each field individually From 12acf2342c75be46cae1b1f6132d72a8940aa45e Mon Sep 17 00:00:00 2001 From: Lenin Rivas <53640168+leninrivas@users.noreply.github.com> Date: Fri, 18 Mar 2022 16:01:56 -0500 Subject: [PATCH 282/610] Fix delete link en Delivery Add actions dellink --- htdocs/delivery/card.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/delivery/card.php b/htdocs/delivery/card.php index 00975946f6b..af78a36a33e 100644 --- a/htdocs/delivery/card.php +++ b/htdocs/delivery/card.php @@ -90,6 +90,9 @@ $error = 0; $parameters = array(); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks +// Delete Link +$permissiondellink = $user->rights->expedition->delivery->supprimer; // Used by the include of actions_dellink.inc.php +include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once if ($action == 'add') { $db->begin(); From ef21def5cec3bf370dda7eddb67e622ee8a44936 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 18 Mar 2022 14:09:53 +0100 Subject: [PATCH 283/610] NEW Add option MAIN_API_DEBUG to save API logs into a file --- htdocs/api/index.php | 19 +++++++++++++++++++ .../install/mysql/migration/15.0.0-16.0.0.sql | 4 ++++ 2 files changed, 23 insertions(+) diff --git a/htdocs/api/index.php b/htdocs/api/index.php index d5bc7e273e2..c66573e8022 100644 --- a/htdocs/api/index.php +++ b/htdocs/api/index.php @@ -158,6 +158,25 @@ if (!empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/swagger.json' || $ $api = new DolibarrApi($db, '', $refreshcache); //var_dump($api->r->apiVersionMap); +// If MAIN_API_DEBUG is set to 1, we save logs into file "dolibarr_api.log" +if (!empty($conf->global->MAIN_API_DEBUG)) { + $r = $api->r; + $r->onCall(function () use ($r) { + // Don't log Luracast Restler Explorer recources calls + //if (!preg_match('/^explorer/', $r->url)) { + // 'method' => $api->r->requestMethod, + // 'url' => $api->r->url, + // 'route' => $api->r->apiMethodInfo->className.'::'.$api->r->apiMethodInfo->methodName, + // 'version' => $api->r->getRequestedApiVersion(), + // 'data' => $api->r->getRequestData(), + //dol_syslog("Debug API input ".var_export($r, true), LOG_DEBUG, 0, '_api'); + dol_syslog("Debug API url ".var_export($r->url, true), LOG_DEBUG, 0, '_api'); + dol_syslog("Debug API input ".var_export($r->getRequestData(), true), LOG_DEBUG, 0, '_api'); + //} + }); +} + + // Enable the Restler API Explorer. // See https://github.com/Luracast/Restler-API-Explorer for more info. $api->r->addAPIClass('Luracast\\Restler\\Explorer'); diff --git a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql index 5e9a0250a38..2933acd00d7 100644 --- a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql +++ b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql @@ -91,6 +91,10 @@ INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15419', '626 - Régimen Simplificado de Confianza', 1); +ALTER TABLE llx_partnership ADD UNIQUE INDEX uk_fk_type_fk_soc (fk_type, fk_soc, date_partnership_start); +ALTER TABLE llx_partnership ADD UNIQUE INDEX uk_fk_type_fk_member (fk_type, fk_member, date_partnership_start); + + -- v16 ALTER TABLE llx_projet_task_time ADD COLUMN fk_product integer NULL; From 4c293aa49b47f4ddb1169e57cce2299adf2c1410 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 19 Mar 2022 13:06:30 +0100 Subject: [PATCH 284/610] Update doc --- htdocs/core/db/mysqli.class.php | 2 +- htdocs/modulebuilder/template/myobject_list.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index fa24e4a70ac..520fba66ce1 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -266,7 +266,7 @@ class DoliDBMysqli extends DoliDB * @param int $usesavepoint 0=Default mode, 1=Run a savepoint before and a rollback to savepoint if error (this allow to have some request with errors inside global transactions). * Note that with Mysql, this parameter is not used as Myssql can already commit a transaction even if one request is in error, without using savepoints. * @param string $type Type of SQL order ('ddl' for insert, update, select, delete or 'dml' for create, alter...) - * @param int $result_mode Result mode + * @param int $result_mode Result mode (Using 1=MYSQLI_USE_RESULT instead of 0=MYSQLI_STORE_RESULT will not buffer the result and save memory) * @return bool|mysqli_result Resultset of answer */ public function query($query, $usesavepoint = 0, $type = 'auto', $result_mode = 0) diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index 589f4052724..67186fcf102 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -372,7 +372,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $nbtotalofrecords++; }*/ /* The fast and low memory method to get and count full list converts the sql into a sql count */ - $sqlforcount = preg_replace('/^SELECT[a-z0-9\._\s\(\),]+FROM/i', 'SELECT COUNT(*) as nbtotalofrecords FROM', $sql); + $sqlforcount = preg_replace('/^SELECT[a-zA-Z0-9\._\s\(\),]+FROM/', 'SELECT COUNT(*) as nbtotalofrecords FROM', $sql); $resql = $db->query($sqlforcount); $objforcount = $db->fetch_object($resql); $nbtotalofrecords = $objforcount->nbtotalofrecords; From 65ed94f9d0650e385414c0c393ae536a8c2f1ff1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 19 Mar 2022 13:14:34 +0100 Subject: [PATCH 285/610] Fix sql is executed twice --- htdocs/contrat/list.php | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index e6446e3585b..036331eecd0 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -352,12 +352,6 @@ if ($search_dfyear > 0 && $search_op2df) { } $sql .= $db->order($sortfield, $sortorder); -$totalnboflines = 0; -$result = $db->query($sql); -if ($result) { - $totalnboflines = $db->num_rows($result); -} - $nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); @@ -508,7 +502,7 @@ print ''; print ''; print ''; -print_barre_liste($langs->trans("ListOfContracts"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $totalnboflines, 'contract', 0, $newcardbutton, '', $limit, 0, 0, 1); +print_barre_liste($langs->trans("ListOfContracts"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'contract', 0, $newcardbutton, '', $limit, 0, 0, 1); $topicmail = "SendContractRef"; $modelmail = "contract"; From 6a7309305b49e856f25782906c19a6640051cdb3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 19 Mar 2022 14:41:10 +0100 Subject: [PATCH 286/610] Fix out of memory with a lot of contracts --- htdocs/contrat/list.php | 42 +++++++++++++------ .../modulebuilder/template/myobject_list.php | 10 +++-- 2 files changed, 37 insertions(+), 15 deletions(-) diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index e6446e3585b..0c8eefdef44 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -350,25 +350,43 @@ if ($search_dfyear > 0 && $search_op2df) { $sql .= " HAVING MIN(".$db->ifsql("cd.statut=4", "cd.date_fin_validite", "null").") <= '".$db->idate(dol_get_last_day($search_dfyear, $search_dfmonth, false))."' AND MIN(".$db->ifsql("cd.statut=4", "cd.date_fin_validite", "null").") >= '".$db->idate(dol_get_first_day($search_dfyear, $search_dfmonth, false))."'"; } } -$sql .= $db->order($sortfield, $sortorder); -$totalnboflines = 0; -$result = $db->query($sql); -if ($result) { - $totalnboflines = $db->num_rows($result); -} - -$nbtotalofrecords = ''; +$nbtotalofrecords = 0; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { - $result = $db->query($sql); - $nbtotalofrecords = $db->num_rows($result); + //$result = $db->query($sql); + //$nbtotalofrecords = $db->num_rows($result); + + if ($search_dfyear > 0 && $search_op2df) { + $resql = $db->query($sql, 0, 'auto', 1); + while ($db->fetch_object($resql)) { + if (empty($nbtotalofrecords)) { + $nbtotalofrecords = 1; // We can't make +1 because init value is '' + } else { + $nbtotalofrecords++; + } + } + } else { + $sqlforcount = preg_replace('/^SELECT[a-zA-Z0-9\._\s\(\),=<>\:\-\']+\sFROM/', 'SELECT COUNT(*) as nbtotalofrecords FROM', $sql); + $sqlforcount = preg_replace('/LEFT JOIN '.MAIN_DB_PREFIX.'contratdet as cd ON c.rowid = cd.fk_contrat/', '', $sqlforcount); + $sqlforcount = preg_replace('/LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product=cd.fk_product/', '', $sqlforcount); + $sqlforcount = preg_replace('/AND cp.fk_categorie = '.((int) $search_product_category).'/', '', $sqlforcount); + $sqlforcount = preg_replace('/GROUP BY.*$/', '', $sqlforcount); + + $resql = $db->query($sqlforcount); + $objforcount = $db->fetch_object($resql); + $nbtotalofrecords = $objforcount->nbtotalofrecords; + } + if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0 $page = 0; $offset = 0; } } -$sql .= $db->plimit($limit + 1, $offset); +$sql .= $db->order($sortfield, $sortorder); +if ($limit) { + $sql .= $db->plimit($limit + 1, $offset); +} $resql = $db->query($sql); if (!$resql) { @@ -508,7 +526,7 @@ print ''; print ''; print ''; -print_barre_liste($langs->trans("ListOfContracts"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $totalnboflines, 'contract', 0, $newcardbutton, '', $limit, 0, 0, 1); +print_barre_liste($langs->trans("ListOfContracts"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'contract', 0, $newcardbutton, '', $limit, 0, 0, 1); $topicmail = "SendContractRef"; $modelmail = "contract"; diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index 67186fcf102..902969ee430 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -369,10 +369,14 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { /* The slow method does not consume memory on mysql (not tested on pgsql) */ /*$resql = $db->query($sql, 0, 'auto', 1); while ($db->fetch_object($resql)) { - $nbtotalofrecords++; - }*/ + if (empty($nbtotalofrecords)) { + $nbtotalofrecords = 1; // We can't make +1 because init value is '' + } else { + $nbtotalofrecords++; + } + }*/ /* The fast and low memory method to get and count full list converts the sql into a sql count */ - $sqlforcount = preg_replace('/^SELECT[a-zA-Z0-9\._\s\(\),]+FROM/', 'SELECT COUNT(*) as nbtotalofrecords FROM', $sql); + $sqlforcount = preg_replace('/^SELECT[a-zA-Z0-9\._\s\(\),=<>\:\-\']+\sFROM/', 'SELECT COUNT(*) as nbtotalofrecords FROM', $sql); $resql = $db->query($sqlforcount); $objforcount = $db->fetch_object($resql); $nbtotalofrecords = $objforcount->nbtotalofrecords; From e48d29e4f23fae90e5685bd69ab1355490b267c3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 19 Mar 2022 14:48:22 +0100 Subject: [PATCH 287/610] Fix bad position of order --- htdocs/contrat/list.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index 036331eecd0..8b00ec2a857 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -350,19 +350,22 @@ if ($search_dfyear > 0 && $search_op2df) { $sql .= " HAVING MIN(".$db->ifsql("cd.statut=4", "cd.date_fin_validite", "null").") <= '".$db->idate(dol_get_last_day($search_dfyear, $search_dfmonth, false))."' AND MIN(".$db->ifsql("cd.statut=4", "cd.date_fin_validite", "null").") >= '".$db->idate(dol_get_first_day($search_dfyear, $search_dfmonth, false))."'"; } } -$sql .= $db->order($sortfield, $sortorder); $nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); $nbtotalofrecords = $db->num_rows($result); + if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0 $page = 0; $offset = 0; } } -$sql .= $db->plimit($limit + 1, $offset); +$sql .= $db->order($sortfield, $sortorder); +if ($limit) { + $sql .= $db->plimit($limit + 1, $offset); +} $resql = $db->query($sql); if (!$resql) { From 1bb1475b54b383d75660d17f9c71a65675366e00 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 19 Mar 2022 15:03:32 +0100 Subject: [PATCH 288/610] Fix phpdoc --- htdocs/core/menus/standard/eldy.lib.php | 218 ++++++++++++------------ 1 file changed, 109 insertions(+), 109 deletions(-) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index efe8d87ff86..6edc4cb2c3c 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -156,8 +156,8 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = 'name' => 'Products', 'link' => '/product/index.php?mainmenu=products&leftmenu=', 'title' => (!empty($conf->product->enabled) && !empty($conf->service->enabled)) - ? (array("TMenuProducts", " | ", "TMenuServices")) - : (!empty($conf->product->enabled) ? "TMenuProducts" : "TMenuServices"), + ? (array("TMenuProducts", " | ", "TMenuServices")) + : (!empty($conf->product->enabled) ? "TMenuProducts" : "TMenuServices"), 'level' => 0, 'enabled' => $showmode = isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal), 'target' => $atarget, @@ -232,7 +232,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = || !empty($conf->supplier_order->enabled) || !empty($conf->contrat->enabled) || !empty($conf->ficheinter->enabled) - ) ? 1 : 0, + ) ? 1 : 0, 'perms'=>(!empty($user->rights->propal->lire) || !empty($user->rights->commande->lire) || !empty($user->rights->supplier_proposal->lire) @@ -241,17 +241,17 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = || !empty($user->rights->supplier_order->lire) || !empty($user->rights->contrat->lire) || !empty($user->rights->ficheinter->lire) - ), + ), 'module'=>'propal|commande|supplier_proposal|supplier_order|contrat|ficheinter' ); $onlysupplierorder = !empty($user->rights->fournisseur->commande->lire) && - empty($user->rights->propal->lire) && - empty($user->rights->commande->lire) && - empty($user->rights->supplier_order->lire) && - empty($user->rights->supplier_proposal->lire) && - empty($user->rights->contrat->lire) && - empty($user->rights->ficheinter->lire); + empty($user->rights->propal->lire) && + empty($user->rights->commande->lire) && + empty($user->rights->supplier_order->lire) && + empty($user->rights->supplier_proposal->lire) && + empty($user->rights->contrat->lire) && + empty($user->rights->ficheinter->lire); $menu_arr[] = array( 'name' => 'Commercial', @@ -524,7 +524,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = $idsel, $classname, $newTabMenu[$i]['prefix'] - ); + ); } // Sort on position @@ -544,9 +544,9 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = if (!empty($mysoc->logo_squarred_mini) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_squarred_mini)) { $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_squarred_mini); /*} elseif (! empty($mysoc->logo_mini) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini)) - { - $urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_mini); - }*/ + { + $urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_mini); + }*/ } else { $urllogo = DOL_URL_ROOT.'/theme/dolibarr_512x512_white.png'; $logoContainerAdditionalClass = ''; @@ -798,7 +798,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM /* * Menu HRM - */ + */ if ($mainmenu == 'hrm') { get_left_menu_hrm($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user); } @@ -881,13 +881,13 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM // TODO Use the position property in menu_array to reorder the $menu_array //var_dump($menu_array); /*$new_menu_array = array(); - $level=0; $cusor=0; $position=0; - $nbentry = count($menu_array); - while (findNextEntryForLevel($menu_array, $cursor, $position, $level)) - { + $level=0; $cusor=0; $position=0; + $nbentry = count($menu_array); + while (findNextEntryForLevel($menu_array, $cursor, $position, $level)) + { - $cursor++; - }*/ + $cursor++; + }*/ // Show menu $invert = empty($conf->global->MAIN_MENU_INVERT) ? "" : "invert"; @@ -1046,11 +1046,11 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM /** * Get left Menu HOME * - * @param string $mainmenu - * @param Menu &$newmenu Object Menu to return back list of menu entries - * @param string $usemenuhider - * @param string $leftmenu - * @param int $type_user + * @param string $mainmenu Main menu + * @param Menu $newmenu Object Menu to return back list of menu entries + * @param string $usemenuhider Use menu hider + * @param string $leftmenu Left menu + * @param int $type_user Type of user * @return void */ function get_left_menu_home($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0) @@ -1165,11 +1165,11 @@ function get_left_menu_home($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = /** * Get left Menu THIRDPARTIES * - * @param string $mainmenu - * @param Menu &$newmenu Object Menu to return back list of menu entries - * @param string $usemenuhider - * @param string $leftmenu - * @param int $type_user + * @param string $mainmenu Main menu + * @param Menu $newmenu Object Menu to return back list of menu entries + * @param string $usemenuhider Use menu hider + * @param string $leftmenu Left menu + * @param int $type_user Type of targeted user for menu * @return void */ function get_left_menu_thridparties($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0) @@ -1197,12 +1197,12 @@ function get_left_menu_thridparties($mainmenu, &$newmenu, $usemenuhider = 1, $le $langs->load("commercial"); $newmenu->add("/societe/list.php?type=p&leftmenu=prospects", $langs->trans("ListProspectsShort"), 2, $user->rights->societe->lire, '', $mainmenu, 'prospects'); /* no more required, there is a filter that can do more - if ($usemenuhider || empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/societe/list.php?type=p&sortfield=s.datec&sortorder=desc&begin=&search_stcomm=-1", $langs->trans("LastProspectDoNotContact"), 2, $user->rights->societe->lire); - if ($usemenuhider || empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/societe/list.php?type=p&sortfield=s.datec&sortorder=desc&begin=&search_stcomm=0", $langs->trans("LastProspectNeverContacted"), 2, $user->rights->societe->lire); - if ($usemenuhider || empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/societe/list.php?type=p&sortfield=s.datec&sortorder=desc&begin=&search_stcomm=1", $langs->trans("LastProspectToContact"), 2, $user->rights->societe->lire); - if ($usemenuhider || empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/societe/list.php?type=p&sortfield=s.datec&sortorder=desc&begin=&search_stcomm=2", $langs->trans("LastProspectContactInProcess"), 2, $user->rights->societe->lire); - if ($usemenuhider || empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/societe/list.php?type=p&sortfield=s.datec&sortorder=desc&begin=&search_stcomm=3", $langs->trans("LastProspectContactDone"), 2, $user->rights->societe->lire); - */ + if ($usemenuhider || empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/societe/list.php?type=p&sortfield=s.datec&sortorder=desc&begin=&search_stcomm=-1", $langs->trans("LastProspectDoNotContact"), 2, $user->rights->societe->lire); + if ($usemenuhider || empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/societe/list.php?type=p&sortfield=s.datec&sortorder=desc&begin=&search_stcomm=0", $langs->trans("LastProspectNeverContacted"), 2, $user->rights->societe->lire); + if ($usemenuhider || empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/societe/list.php?type=p&sortfield=s.datec&sortorder=desc&begin=&search_stcomm=1", $langs->trans("LastProspectToContact"), 2, $user->rights->societe->lire); + if ($usemenuhider || empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/societe/list.php?type=p&sortfield=s.datec&sortorder=desc&begin=&search_stcomm=2", $langs->trans("LastProspectContactInProcess"), 2, $user->rights->societe->lire); + if ($usemenuhider || empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/societe/list.php?type=p&sortfield=s.datec&sortorder=desc&begin=&search_stcomm=3", $langs->trans("LastProspectContactDone"), 2, $user->rights->societe->lire); + */ $newmenu->add("/societe/card.php?leftmenu=prospects&action=create&type=p", $langs->trans("MenuNewProspect"), 3, $user->rights->societe->creer); } @@ -1270,11 +1270,11 @@ function get_left_menu_thridparties($mainmenu, &$newmenu, $usemenuhider = 1, $le /** * Get left Menu COMMERCIAL (propal, commande, supplier_proposal, supplier_order, contrat, ficheinter) * - * @param string $mainmenu - * @param Menu &$newmenu Object Menu to return back list of menu entries - * @param string $usemenuhider - * @param string $leftmenu - * @param int $type_user + * @param string $mainmenu Main menu + * @param Menu $newmenu Object Menu to return back list of menu entries + * @param string $usemenuhider Use menu hider + * @param string $leftmenu Left menu + * @param int $type_user Type of targeted user for menu * @return void */ function get_left_menu_commercial($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0) @@ -1386,11 +1386,11 @@ function get_left_menu_commercial($mainmenu, &$newmenu, $usemenuhider = 1, $left /** * Get left COMPTA-FINANCIAL * - * @param string $mainmenu - * @param Menu &$newmenu Object Menu to return back list of menu entries - * @param string $usemenuhider - * @param string $leftmenu - * @param int $type_user + * @param string $mainmenu Main menu + * @param Menu $newmenu Object Menu to return back list of menu entries + * @param string $usemenuhider Use menu hider + * @param string $leftmenu Left menu + * @param int $type_user Type of targeted user for menu * @return void */ function get_left_menu_billing($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0) @@ -1567,17 +1567,17 @@ function get_left_menu_billing($mainmenu, &$newmenu, $usemenuhider = 1, $leftmen /** * Get left COMPTA-FINANCIAL (accountancy) * - * @param string $mainmenu - * @param Menu &$newmenu Object Menu to return back list of menu entries - * @param string $usemenuhider - * @param string $leftmenu - * @param int $type_user - * @param DB $db + * @param string $mainmenu Main menu + * @param Menu $newmenu Object Menu to return back list of menu entries + * @param string $usemenuhider Use menu hider + * @param string $leftmenu Left menu + * @param int $type_user Type of targeted user for menu * @return void */ -function get_left_menu_accountancy($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0, $db) +function get_left_menu_accountancy($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0) { global $user, $conf, $langs; + global $db; if ($mainmenu == 'accountancy') { $langs->load("companies"); @@ -1679,7 +1679,7 @@ function get_left_menu_accountancy($mainmenu, &$newmenu, $usemenuhider = 1, $lef if ($objp->nature == 3 && ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_invoice->enabled)) && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_PURCHASES)) { - $nature = "purchases"; + $nature = "purchases"; } if ($objp->nature == 4 && !empty($conf->banque->enabled)) { $nature = "bank"; @@ -1697,7 +1697,7 @@ function get_left_menu_accountancy($mainmenu, &$newmenu, $usemenuhider = 1, $lef $nature = "hasnew"; } - // To enable when page exists + // To enable when page exists if (empty($conf->global->ACCOUNTANCY_SHOW_DEVELOP_JOURNAL)) { if ($nature == 'hasnew' || $nature == 'inventory') { $nature = ''; @@ -1709,7 +1709,7 @@ function get_left_menu_accountancy($mainmenu, &$newmenu, $usemenuhider = 1, $lef $journallabel = $langs->transnoentities($objp->label); // Labels in this table are set by loading llx_accounting_abc.sql. Label can be 'ACCOUNTING_SELL_JOURNAL', 'InventoryJournal', ... $newmenu->add('/accountancy/journal/'.$nature.'journal.php?mainmenu=accountancy&leftmenu=accountancy_journal&id_journal='.$objp->rowid, $journallabel, 2, $user->rights->accounting->comptarapport->lire); } - $i++; + $i++; } } else { // Should not happend. Entries are added @@ -1815,17 +1815,17 @@ function get_left_menu_accountancy($mainmenu, &$newmenu, $usemenuhider = 1, $lef $newmenu->add("/compta/resultat/index.php?leftmenu=report", $langs->trans("MenuReportInOut"), 1, $user->rights->compta->resultat->lire); $newmenu->add("/compta/resultat/clientfourn.php?leftmenu=report", $langs->trans("ByCompanies"), 2, $user->rights->compta->resultat->lire); /* On verra ca avec module compabilite expert - $newmenu->add("/compta/resultat/compteres.php?leftmenu=report","Compte de resultat",2,$user->rights->compta->resultat->lire); - $newmenu->add("/compta/resultat/bilan.php?leftmenu=report","Bilan",2,$user->rights->compta->resultat->lire); - */ + $newmenu->add("/compta/resultat/compteres.php?leftmenu=report","Compte de resultat",2,$user->rights->compta->resultat->lire); + $newmenu->add("/compta/resultat/bilan.php?leftmenu=report","Bilan",2,$user->rights->compta->resultat->lire); + */ /* - $newmenu->add("/compta/stats/cumul.php?leftmenu=report","Cumule",2,$user->rights->compta->resultat->lire); - if (! empty($conf->propal->enabled)) { - $newmenu->add("/compta/stats/prev.php?leftmenu=report","Previsionnel",2,$user->rights->compta->resultat->lire); - $newmenu->add("/compta/stats/comp.php?leftmenu=report","Transforme",2,$user->rights->compta->resultat->lire); - } - */ + $newmenu->add("/compta/stats/cumul.php?leftmenu=report","Cumule",2,$user->rights->compta->resultat->lire); + if (! empty($conf->propal->enabled)) { + $newmenu->add("/compta/stats/prev.php?leftmenu=report","Previsionnel",2,$user->rights->compta->resultat->lire); + $newmenu->add("/compta/stats/comp.php?leftmenu=report","Transforme",2,$user->rights->compta->resultat->lire); + } + */ $modecompta = 'CREANCES-DETTES'; $newmenu->add("/compta/stats/index.php?leftmenu=report&modecompta=".$modecompta, $langs->trans("ReportTurnover"), 1, $user->rights->compta->resultat->lire); @@ -1846,11 +1846,11 @@ function get_left_menu_accountancy($mainmenu, &$newmenu, $usemenuhider = 1, $lef $newmenu->add("/compta/stats/supplier_turnover_by_prodserv.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByProductsAndServices"), 2, $user->rights->compta->resultat->lire); /* - $modecompta = 'RECETTES-DEPENSES'; - $newmenu->add("/compta/stats/index.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ReportPurchaseTurnoverCollected"), 1, $user->rights->compta->resultat->lire); - $newmenu->add("/compta/stats/casoc.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 2, $user->rights->compta->resultat->lire); - $newmenu->add("/compta/stats/cabyuser.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByUsers"), 2, $user->rights->compta->resultat->lire); - */ + $modecompta = 'RECETTES-DEPENSES'; + $newmenu->add("/compta/stats/index.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ReportPurchaseTurnoverCollected"), 1, $user->rights->compta->resultat->lire); + $newmenu->add("/compta/stats/casoc.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 2, $user->rights->compta->resultat->lire); + $newmenu->add("/compta/stats/cabyuser.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByUsers"), 2, $user->rights->compta->resultat->lire); + */ // Journals $newmenu->add("/compta/journal/sellsjournal.php?leftmenu=report", $langs->trans("SellsJournal"), 1, $user->rights->compta->resultat->lire, '', '', '', 50); @@ -1886,11 +1886,11 @@ function get_left_menu_accountancy($mainmenu, &$newmenu, $usemenuhider = 1, $lef /** * Get left Menu BANK * - * @param string $mainmenu - * @param Menu &$newmenu Object Menu to return back list of menu entries - * @param string $usemenuhider - * @param string $leftmenu - * @param int $type_user + * @param string $mainmenu Main menu + * @param Menu $newmenu Object Menu to return back list of menu entries + * @param string $usemenuhider Use menu hider + * @param string $leftmenu Left menu + * @param int $type_user Type of targeted user for menu * @return void */ function get_left_menu_bank($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0) @@ -1969,11 +1969,11 @@ function get_left_menu_bank($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = /** * Get left Menu PRODUCTS-SERVICES * - * @param string $mainmenu - * @param Menu &$newmenu Object Menu to return back list of menu entries - * @param string $usemenuhider - * @param string $leftmenu - * @param int $type_user + * @param string $mainmenu Main menu + * @param Menu $newmenu Object Menu to return back list of menu entries + * @param string $usemenuhider Use menu hider + * @param string $leftmenu Left menu + * @param int $type_user Type of targeted user for menu * @return void */ function get_left_menu_products($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0) @@ -2100,17 +2100,17 @@ function get_left_menu_products($mainmenu, &$newmenu, $usemenuhider = 1, $leftme /** * Get left Menu PRODUCTS-SERVICES MRP - GPAO * - * @param string $mainmenu - * @param Menu &$newmenu Object Menu to return back list of menu entries - * @param string $usemenuhider - * @param string $leftmenu - * @param int $type_user + * @param string $mainmenu Main menu + * @param Menu $newmenu Object Menu to return back list of menu entries + * @param string $usemenuhider Use menu hider + * @param string $leftmenu Left menu + * @param int $type_user Type of targeted user for menu * @return void */ function get_left_menu_mrp($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0) { global $user, $conf, $langs; - + if ($mainmenu == 'mrp') { // BOM if (!empty($conf->bom->enabled) || !empty($conf->mrp->enabled)) { @@ -2134,17 +2134,17 @@ function get_left_menu_mrp($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = /** * Get left Menu PROJECTS * - * @param string $mainmenu - * @param Menu &$newmenu Object Menu to return back list of menu entries - * @param string $usemenuhider - * @param string $leftmenu - * @param int $type_user + * @param string $mainmenu Main menu + * @param Menu $newmenu Object Menu to return back list of menu entries + * @param string $usemenuhider Use menu hider + * @param string $leftmenu Left menu + * @param int $type_user Type of targeted user for menu * @return void */ function get_left_menu_projects($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0) { global $user, $conf, $langs; - + if ($mainmenu == 'project') { if (!empty($conf->projet->enabled)) { $langs->load("projects"); @@ -2208,11 +2208,11 @@ function get_left_menu_projects($mainmenu, &$newmenu, $usemenuhider = 1, $leftme /** * Get left Menu HRM * - * @param string $mainmenu - * @param Menu &$newmenu Object Menu to return back list of menu entries - * @param string $usemenuhider - * @param string $leftmenu - * @param int $type_user + * @param string $mainmenu Main menu + * @param Menu $newmenu Object Menu to return back list of menu entries + * @param string $usemenuhider Use menu hider + * @param string $leftmenu Left menu + * @param int $type_user Type of targeted user for menu * @return void */ function get_left_menu_hrm($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0) @@ -2315,17 +2315,17 @@ function get_left_menu_hrm($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = /** * Get left Menu TOOLS * - * @param string $mainmenu - * @param Menu &$newmenu Object Menu to return back list of menu entries - * @param string $usemenuhider - * @param string $leftmenu - * @param int $type_user + * @param string $mainmenu Main menu + * @param Menu $newmenu Object Menu to return back list of menu entries + * @param string $usemenuhider Use menu hider + * @param string $leftmenu Left menu + * @param int $type_user Type of targeted user for menu * @return void */ function get_left_menu_tools($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0) { global $user, $conf, $langs; - + if ($mainmenu == 'tools') { if (empty($user->socid)) { // limit to internal users $langs->load("mails"); @@ -2356,11 +2356,11 @@ function get_left_menu_tools($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu /** * Get left Menu MEMBERS * - * @param string $mainmenu - * @param Menu &$newmenu Object Menu to return back list of menu entries - * @param string $usemenuhider - * @param string $leftmenu - * @param int $type_user + * @param string $mainmenu Main menu + * @param Menu $newmenu Object Menu to return back list of menu entries + * @param string $usemenuhider Use menu hider + * @param string $leftmenu Left menu + * @param int $type_user Type of targeted user for menu * @return void */ function get_left_menu_members($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0) From 9878b04a9817c0d8be38f8976b785a20f0d9b62d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 19 Mar 2022 18:20:24 +0100 Subject: [PATCH 289/610] Fix position of text in PDF --- .../facture/doc/pdf_sponge.modules.php | 167 +++++++++--------- 1 file changed, 88 insertions(+), 79 deletions(-) diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index 5d5b3cf762a..a5e9c0b841b 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -870,9 +870,9 @@ class pdf_sponge extends ModelePDFFactures // Retrieve type from database for backward compatibility with old records 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, $object->thirdparty, $mysoc); - $localtax1_type = isset($localtaxtmp_array[0]) ? $localtaxtmp_array[0] : ''; - $localtax2_type = isset($localtaxtmp_array[2]) ? $localtaxtmp_array[2] : ''; + $localtaxtmp_array = getLocalTaxesFromRate($vatrate, 0, $object->thirdparty, $mysoc); + $localtax1_type = isset($localtaxtmp_array[0]) ? $localtaxtmp_array[0] : ''; + $localtax2_type = isset($localtaxtmp_array[2]) ? $localtaxtmp_array[2] : ''; } // retrieve global local tax @@ -989,9 +989,9 @@ class pdf_sponge extends ModelePDFFactures @chmod($file, octdec($conf->global->MAIN_UMASK)); } - $this->result = array('fullpath'=>$file); + $this->result = array('fullpath'=>$file); - return 1; // No error + return 1; // No error } else { $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir); return 0; @@ -1177,20 +1177,24 @@ class pdf_sponge extends ModelePDFFactures $posy = $pdf->GetY() + 4; } - $posxval = 52; + $posxval = 52; // Position of values of properties shown on left side + $posxend = 110; // End of x for text on left side + if ($this->page_largeur < 210) { // To work with US executive format + $posxend -= 10; + } // Show payments conditions if ($object->type != 2 && ($object->cond_reglement_code || $object->cond_reglement)) { $pdf->SetFont('', 'B', $default_font_size - 2); $pdf->SetXY($this->marge_gauche, $posy); $titre = $outputlangs->transnoentities("PaymentConditions").':'; - $pdf->MultiCell(43, 4, $titre, 0, 'L'); + $pdf->MultiCell($posxval - $this->marge_gauche, 4, $titre, 0, 'L'); $pdf->SetFont('', '', $default_font_size - 2); $pdf->SetXY($posxval, $posy); $lib_condition_paiement = $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) != ('PaymentCondition'.$object->cond_reglement_code) ? $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) : $outputlangs->convToOutputCharset($object->cond_reglement_doc ? $object->cond_reglement_doc : $object->cond_reglement_label); $lib_condition_paiement = str_replace('\n', "\n", $lib_condition_paiement); - $pdf->MultiCell(67, 4, $lib_condition_paiement, 0, 'L'); + $pdf->MultiCell($posxend - $posxval, 4, $lib_condition_paiement, 0, 'L'); $posy = $pdf->GetY() + 3; // We need spaces for 2 lines payment conditions } @@ -1198,42 +1202,42 @@ class pdf_sponge extends ModelePDFFactures if ($object->type != 2) { // Check a payment mode is defined if (empty($object->mode_reglement_code) - && empty($conf->global->FACTURE_CHQ_NUMBER) - && empty($conf->global->FACTURE_RIB_NUMBER)) { - $this->error = $outputlangs->transnoentities("ErrorNoPaiementModeConfigured"); + && empty($conf->global->FACTURE_CHQ_NUMBER) + && empty($conf->global->FACTURE_RIB_NUMBER)) { + $this->error = $outputlangs->transnoentities("ErrorNoPaiementModeConfigured"); } elseif (($object->mode_reglement_code == 'CHQ' && empty($conf->global->FACTURE_CHQ_NUMBER) && empty($object->fk_account) && empty($object->fk_bank)) - || ($object->mode_reglement_code == 'VIR' && empty($conf->global->FACTURE_RIB_NUMBER) && empty($object->fk_account) && empty($object->fk_bank))) { - // Avoid having any valid PDF with setup that is not complete - $outputlangs->load("errors"); + || ($object->mode_reglement_code == 'VIR' && empty($conf->global->FACTURE_RIB_NUMBER) && empty($object->fk_account) && empty($object->fk_bank))) { + // Avoid having any valid PDF with setup that is not complete + $outputlangs->load("errors"); - $pdf->SetXY($this->marge_gauche, $posy); - $pdf->SetTextColor(200, 0, 0); - $pdf->SetFont('', 'B', $default_font_size - 2); - $this->error = $outputlangs->transnoentities("ErrorPaymentModeDefinedToWithoutSetup", $object->mode_reglement_code); - $pdf->MultiCell(80, 3, $this->error, 0, 'L', 0); - $pdf->SetTextColor(0, 0, 0); + $pdf->SetXY($this->marge_gauche, $posy); + $pdf->SetTextColor(200, 0, 0); + $pdf->SetFont('', 'B', $default_font_size - 2); + $this->error = $outputlangs->transnoentities("ErrorPaymentModeDefinedToWithoutSetup", $object->mode_reglement_code); + $pdf->MultiCell($posxend - $this->marge_gauche, 3, $this->error, 0, 'L', 0); + $pdf->SetTextColor(0, 0, 0); - $posy = $pdf->GetY() + 1; + $posy = $pdf->GetY() + 1; } - // Show payment mode + // Show payment mode if (!empty($object->mode_reglement_code) - && $object->mode_reglement_code != 'CHQ' - && $object->mode_reglement_code != 'VIR') { - $pdf->SetFont('', 'B', $default_font_size - 2); - $pdf->SetXY($this->marge_gauche, $posy); - $titre = $outputlangs->transnoentities("PaymentMode").':'; - $pdf->MultiCell(80, 5, $titre, 0, 'L'); + && $object->mode_reglement_code != 'CHQ' + && $object->mode_reglement_code != 'VIR') { + $pdf->SetFont('', 'B', $default_font_size - 2); + $pdf->SetXY($this->marge_gauche, $posy); + $titre = $outputlangs->transnoentities("PaymentMode").':'; + $pdf->MultiCell($posxend - $this->marge_gauche, 5, $titre, 0, 'L'); - $pdf->SetFont('', '', $default_font_size - 2); - $pdf->SetXY($posxval, $posy); - $lib_mode_reg = $outputlangs->transnoentities("PaymentType".$object->mode_reglement_code) != ('PaymentType'.$object->mode_reglement_code) ? $outputlangs->transnoentities("PaymentType".$object->mode_reglement_code) : $outputlangs->convToOutputCharset($object->mode_reglement); - $pdf->MultiCell(80, 5, $lib_mode_reg, 0, 'L'); + $pdf->SetFont('', '', $default_font_size - 2); + $pdf->SetXY($posxval, $posy); + $lib_mode_reg = $outputlangs->transnoentities("PaymentType".$object->mode_reglement_code) != ('PaymentType'.$object->mode_reglement_code) ? $outputlangs->transnoentities("PaymentType".$object->mode_reglement_code) : $outputlangs->convToOutputCharset($object->mode_reglement); + $pdf->MultiCell($posxend - $posxval, 5, $lib_mode_reg, 0, 'L'); - $posy = $pdf->GetY(); + $posy = $pdf->GetY(); } - // Show online payment link + // Show online payment link if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'CB' || $object->mode_reglement_code == 'VAD') { $useonlinepayment = 0; if (!empty($conf->global->PDF_SHOW_LINK_TO_ONLINE_PAYMENT)) { @@ -1258,13 +1262,13 @@ class pdf_sponge extends ModelePDFFactures $linktopay = $langs->trans("ToOfferALinkForOnlinePayment", $servicename).' '.$outputlangs->transnoentities("ClickHere").''; $pdf->SetXY($this->marge_gauche, $posy); - $pdf->writeHTMLCell(80, 5, '', '', dol_htmlentitiesbr($linktopay), 0, 1); + $pdf->writeHTMLCell($posxend - $this->marge_gauche, 5, '', '', dol_htmlentitiesbr($linktopay), 0, 1); $posy = $pdf->GetY() + 1; } } - // Show payment mode CHQ + // Show payment mode CHQ if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'CHQ') { // If payment mode unregulated or payment mode forced to CHQ if (!empty($conf->global->FACTURE_CHQ_NUMBER)) { @@ -1276,33 +1280,33 @@ class pdf_sponge extends ModelePDFFactures $pdf->SetXY($this->marge_gauche, $posy); $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo', $account->proprio), 0, 'L', 0); + $pdf->MultiCell($posxend - $this->marge_gauche, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo', $account->proprio), 0, 'L', 0); $posy = $pdf->GetY() + 1; if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS)) { $pdf->SetXY($this->marge_gauche, $posy); $pdf->SetFont('', '', $default_font_size - $diffsizetitle); - $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($account->owner_address), 0, 'L', 0); + $pdf->MultiCell($posxend - $this->marge_gauche, 3, $outputlangs->convToOutputCharset($account->owner_address), 0, 'L', 0); $posy = $pdf->GetY() + 2; } } if ($conf->global->FACTURE_CHQ_NUMBER == -1) { $pdf->SetXY($this->marge_gauche, $posy); $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo', $this->emetteur->name), 0, 'L', 0); + $pdf->MultiCell($posxend - $this->marge_gauche, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo', $this->emetteur->name), 0, 'L', 0); $posy = $pdf->GetY() + 1; if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS)) { $pdf->SetXY($this->marge_gauche, $posy); $pdf->SetFont('', '', $default_font_size - $diffsizetitle); - $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($this->emetteur->getFullAddress()), 0, 'L', 0); + $pdf->MultiCell($posxend - $this->marge_gauche, 3, $outputlangs->convToOutputCharset($this->emetteur->getFullAddress()), 0, 'L', 0); $posy = $pdf->GetY() + 2; } } } } - // If payment mode not forced or forced to VIR, show payment with BAN + // If payment mode not forced or forced to VIR, show payment with BAN if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'VIR') { if ($object->fk_account > 0 || $object->fk_bank > 0 || !empty($conf->global->FACTURE_RIB_NUMBER)) { $bankid = ($object->fk_account <= 0 ? $conf->global->FACTURE_RIB_NUMBER : $object->fk_account); @@ -1350,7 +1354,11 @@ class pdf_sponge extends ModelePDFFactures $tab2_top = $posy; $tab2_hl = 4; - $pdf->SetFont('', '', $default_font_size - 1); + if (is_object($outputlangsbis)) { // When we show 2 languages we need more room for text, so we use a smaller font. + $pdf->SetFont('', '', $default_font_size - 2); + } else { + $pdf->SetFont('', '', $default_font_size - 1); + } // Total table $col1x = 120; @@ -1482,9 +1490,10 @@ class pdf_sponge extends ModelePDFFactures $tab2_top = $posy; $index = 0; + + $tab2_top += 3; } - $tab2_top += 3; // Get Total HT $total_ht = (!empty($conf->multicurrency->enabled) && $object->mylticurrency_tx != 1 ? $object->multicurrency_total_ht : $object->total_ht); @@ -1805,19 +1814,19 @@ class pdf_sponge extends ModelePDFFactures } /* - if ($object->close_code == Facture::CLOSECODE_DISCOUNTVAT) - { - $index++; - $pdf->SetFillColor(255, 255, 255); + if ($object->close_code == Facture::CLOSECODE_DISCOUNTVAT) + { + $index++; + $pdf->SetFillColor(255, 255, 255); - $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("EscompteOfferedShort").(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transnoentities("EscompteOfferedShort") : ''), $useborder, 'L', 1); - $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ttc - $deja_regle - $creditnoteamount - $depositsamount, 0, $outputlangs), $useborder, 'R', 1); + $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("EscompteOfferedShort").(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transnoentities("EscompteOfferedShort") : ''), $useborder, 'L', 1); + $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); + $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ttc - $deja_regle - $creditnoteamount - $depositsamount, 0, $outputlangs), $useborder, 'R', 1); - $resteapayer = 0; - } - */ + $resteapayer = 0; + } + */ $index++; $pdf->SetTextColor(0, 0, 60); @@ -1937,7 +1946,7 @@ class pdf_sponge extends ModelePDFFactures // Show Draft Watermark if ($object->statut == $object::STATUS_DRAFT && (!empty($conf->global->FACTURE_DRAFT_WATERMARK))) { - pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur, 'mm', $conf->global->FACTURE_DRAFT_WATERMARK); + pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur, 'mm', $conf->global->FACTURE_DRAFT_WATERMARK); } $pdf->SetTextColor(0, 0, 60); @@ -2024,15 +2033,15 @@ class pdf_sponge extends ModelePDFFactures $pdf->SetFont('', 'B', $default_font_size); /* - $posy += 5; - $pdf->SetXY($posx, $posy); - $pdf->SetTextColor(0, 0, 60); - $textref = $outputlangs->transnoentities("Ref")." : ".$outputlangs->convToOutputCharset($object->ref); - if ($object->statut == $object::STATUS_DRAFT) { - $pdf->SetTextColor(128, 0, 0); - $textref .= ' - '.$outputlangs->transnoentities("NotValidated"); - } - $pdf->MultiCell($w, 4, $textref, '', 'R');*/ + $posy += 5; + $pdf->SetXY($posx, $posy); + $pdf->SetTextColor(0, 0, 60); + $textref = $outputlangs->transnoentities("Ref")." : ".$outputlangs->convToOutputCharset($object->ref); + if ($object->statut == $object::STATUS_DRAFT) { + $pdf->SetTextColor(128, 0, 0); + $textref .= ' - '.$outputlangs->transnoentities("NotValidated"); + } + $pdf->MultiCell($w, 4, $textref, '', 'R');*/ $posy += 3; $pdf->SetFont('', '', $default_font_size - 2); @@ -2296,21 +2305,21 @@ class pdf_sponge extends ModelePDFFactures /* * For exemple - $this->cols['theColKey'] = array( - 'rank' => $rank, // int : use for ordering columns - 'width' => 20, // the column width in mm - 'title' => array( - 'textkey' => 'yourLangKey', // if there is no label, yourLangKey will be translated to replace label - 'label' => ' ', // the final label : used fore final generated text - 'align' => 'L', // text alignement : R,C,L - 'padding' => array(0.5,0.5,0.5,0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left - ), - 'content' => array( - 'align' => 'L', // text alignement : R,C,L - 'padding' => array(0.5,0.5,0.5,0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left - ), - ); - */ + $this->cols['theColKey'] = array( + 'rank' => $rank, // int : use for ordering columns + 'width' => 20, // the column width in mm + 'title' => array( + 'textkey' => 'yourLangKey', // if there is no label, yourLangKey will be translated to replace label + 'label' => ' ', // the final label : used fore final generated text + 'align' => 'L', // text alignement : R,C,L + 'padding' => array(0.5,0.5,0.5,0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left + ), + 'content' => array( + 'align' => 'L', // text alignement : R,C,L + 'padding' => array(0.5,0.5,0.5,0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left + ), + ); + */ $rank = 0; // do not use negative rank $this->cols['desc'] = array( From cb93ab472dfc734e5de28bf9b8aab5639d137098 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 19 Mar 2022 19:14:12 +0100 Subject: [PATCH 290/610] FIX ZATCA Encoding --- .../iso-normes/QR code for invoices.txt | 8 +- htdocs/core/class/commoninvoice.class.php | 8 +- test/phpunit/BarcodeTest.php | 203 ++++++++++++++++++ 3 files changed, 214 insertions(+), 5 deletions(-) create mode 100644 test/phpunit/BarcodeTest.php diff --git a/dev/resources/iso-normes/QR code for invoices.txt b/dev/resources/iso-normes/QR code for invoices.txt index a55c9569297..f03351f453f 100644 --- a/dev/resources/iso-normes/QR code for invoices.txt +++ b/dev/resources/iso-normes/QR code for invoices.txt @@ -8,6 +8,10 @@ https://en.wikipedia.org/wiki/EPC_QR_code#Generators -* For ZATCA QR Code format (Saudi Arabia) ------------------------------------------ +* For ZATCA QR Code format (Saudi Arabia). Used when INVOICE_ADD_ZATCA_QR_CODE is set +------------------------------------------------------------------------------------- https://www.pwc.com/m1/en/services/tax/me-tax-legal-news/2021/saudi-arabia-guide-to-develop-compliant-qr-code-for-simplified-einvoices.html + +https://www.tecklenborgh.com/post/ksa-zatca-publishes-guide-on-how-to-develop-a-fatoora-compliant-qr-code + +Method to encode/decode ZATCA string is available in test/phpunit/BarcodeTest.php diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index 29fd230a61b..eedc1b2fa10 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -827,8 +827,10 @@ abstract class CommonInvoice extends CommonObject $tmplang->load("main"); $datestring = dol_print_date($this->date, 'dayhourrfc'); - $pricewithtaxstring = price($this->total_ttc, 0, $tmplang, 0, -1, 2); - $pricetaxstring = price($this->total_tva, 0, $tmplang, 0, -1, 2); + //$pricewithtaxstring = price($this->total_ttc, 0, $tmplang, 0, -1, 2); + //$pricetaxstring = price($this->total_tva, 0, $tmplang, 0, -1, 2); + $pricewithtaxstring = price2num($this->total_ttc, 2, 1); + $pricetaxstring = price2num($this->total_tva, 2, 1); /* $name = implode(unpack("H*", $this->thirdparty->name)); @@ -857,7 +859,7 @@ abstract class CommonInvoice extends CommonObject // Using TLV format $s = pack('C1', 1).pack('C1', strlen($this->thirdparty->name)).$this->thirdparty->name; $s .= pack('C1', 2).pack('C1', strlen($this->thirdparty->tva_intra)).$this->thirdparty->tva_intra; - $s .= pack('C1', 3).pack('C1', strlen($datestring)).$this->date; + $s .= pack('C1', 3).pack('C1', strlen($datestring)).$datestring; $s .= pack('C1', 4).pack('C1', strlen($pricewithtaxstring)).$pricewithtaxstring; $s .= pack('C1', 5).pack('C1', strlen($pricetaxstring)).$pricetaxstring; $s .= ''; // Hash of xml invoice diff --git a/test/phpunit/BarcodeTest.php b/test/phpunit/BarcodeTest.php new file mode 100644 index 00000000000..132ba8c1126 --- /dev/null +++ b/test/phpunit/BarcodeTest.php @@ -0,0 +1,203 @@ + + * + * 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 https://www.gnu.org/ + */ + +/** + * \file test/phpunit/BarcodeTest.php + * \ingroup test + * \brief PHPUnit test + * \remarks To run this script as CLI: phpunit filename.php + */ + +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/compta/facture/class/facture.class.php'; + + +if (empty($user->id)) { + print "Load permissions for admin user nb 1\n"; + $user->fetch(1); + $user->getrights(); +} +$conf->global->MAIN_DISABLE_ALL_MAILS=1; + +$langs->load("main"); + + +/** + * Class for PHPUnit tests + * + * @backupGlobals disabled + * @backupStaticAttributes enabled + * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. + */ +class BarcodeTest extends PHPUnit\Framework\TestCase +{ + protected $savconf; + protected $savuser; + protected $savlangs; + protected $savdb; + + /** + * Constructor + * We save global variables into local variables + * + * @return BarcodeTest + */ + public function __construct() + { + parent::__construct(); + + //$this->sharedFixture + global $conf,$user,$langs,$db; + $this->savconf=$conf; + $this->savuser=$user; + $this->savlangs=$langs; + $this->savdb=$db; + + print __METHOD__." db->type=".$db->type." user->id=".$user->id; + //print " - db ".$db->db; + print "\n"; + } + + /** + * setUpBeforeClass + * + * @return void + */ + public static function setUpBeforeClass() + { + global $conf,$user,$langs,$db; + $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. + + print __METHOD__."\n"; + } + + /** + * tearDownAfterClass + * + * @return void + */ + public static function tearDownAfterClass() + { + global $conf,$user,$langs,$db; + $db->rollback(); + + print __METHOD__."\n"; + } + + /** + * Init phpunit tests + * + * @return void + */ + protected function setUp() + { + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; + + print __METHOD__."\n"; + } + + /** + * End phpunit tests + * + * @return void + */ + protected function tearDown() + { + print __METHOD__."\n"; + } + + + /** + * testBarcodeZATCAEncode + * + * @return int + */ + public function testBarcodeZATCAEncode() + { + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; + + $company = new Societe($db); + $company->name = 'Specimen company'; + $company->tva_intra = '123456789'; + + $tmpinvoice = new Facture($db); + + $tmpinvoice->thirdparty = $company; + $tmpinvoice->total_ht = 100; + $tmpinvoice->total_tva = 20; + $tmpinvoice->total_ttc = $tmpinvoice->total_ht + $tmpinvoice->total_tva; + $tmpinvoice->date = dol_mktime(12, 34, 56, 1, 1, 2020, 'gmt'); + + $string_zatca = $tmpinvoice->buildZATCAQRString(); + + $this->assertEquals($string_zatca, "ARBTcGVjaW1lbiBjb21wYW55AgkxMjM0NTY3ODkDFDIwMjAtMDEtMDFUMDk6MzQ6NTZaBAMxMjAFAjIw"); + + return 1; + } + + + + /** + * testBarcodeZATCADecode + * + * @return int + */ + public function testBarcodeZATCADecode() + { + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; + + //$string_zatca_base64 = "AQZSYWZlZXECDTEyMzQ1Njc4OVQxMjUDFDIwMjEtMDctMTJUMTQ6MjU6MDlaBAM3ODYFAjI1"; + $string_zatca_base64 = "ARBTcGVjaW1lbiBjb21wYW55AgkxMjM0NTY3ODkDFDIwMjAtMDEtMDFUMDk6MzQ6NTZaBAMxMjAFAjIw"; + + $decoded = base64_decode($string_zatca_base64); + + //print_r($decoded) + //raw data + //\u0001\u0006Rafeeq\u0002\t123456789\u0003\u00142021-07-12T14:25:09Z\u0004\u0003786\u0005\u000225 + + $result_data = preg_replace('/[\x00-\x1F\x80-\xFF]/', ',', $decoded); + + $arrayOfData = explode(',,', $result_data); + + + print __METHOD__." result=".var_export($arrayOfData, true)."\n"; + $this->assertEquals("", $arrayOfData[0]); + $this->assertEquals("Specimen company", $arrayOfData[1]); + $this->assertEquals("123456789", $arrayOfData[2]); + $this->assertEquals("2020-01-01T09:34:56Z", $arrayOfData[3]); + $this->assertEquals("120", $arrayOfData[4]); + $this->assertEquals("20", $arrayOfData[5]); + + return 1; + } +} From 592a27709100eef14ddec5765b4388884e292613 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 19 Mar 2022 19:14:12 +0100 Subject: [PATCH 291/610] FIX ZATCA Encoding --- .../iso-normes/QR code for invoices.txt | 8 +- htdocs/core/class/commoninvoice.class.php | 8 +- test/phpunit/BarcodeTest.php | 203 ++++++++++++++++++ 3 files changed, 214 insertions(+), 5 deletions(-) create mode 100644 test/phpunit/BarcodeTest.php diff --git a/dev/resources/iso-normes/QR code for invoices.txt b/dev/resources/iso-normes/QR code for invoices.txt index a55c9569297..f03351f453f 100644 --- a/dev/resources/iso-normes/QR code for invoices.txt +++ b/dev/resources/iso-normes/QR code for invoices.txt @@ -8,6 +8,10 @@ https://en.wikipedia.org/wiki/EPC_QR_code#Generators -* For ZATCA QR Code format (Saudi Arabia) ------------------------------------------ +* For ZATCA QR Code format (Saudi Arabia). Used when INVOICE_ADD_ZATCA_QR_CODE is set +------------------------------------------------------------------------------------- https://www.pwc.com/m1/en/services/tax/me-tax-legal-news/2021/saudi-arabia-guide-to-develop-compliant-qr-code-for-simplified-einvoices.html + +https://www.tecklenborgh.com/post/ksa-zatca-publishes-guide-on-how-to-develop-a-fatoora-compliant-qr-code + +Method to encode/decode ZATCA string is available in test/phpunit/BarcodeTest.php diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index 6043814dc45..795c0550ae1 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -827,8 +827,10 @@ abstract class CommonInvoice extends CommonObject $tmplang->load("main"); $datestring = dol_print_date($this->date, 'dayhourrfc'); - $pricewithtaxstring = price($this->total_ttc, 0, $tmplang, 0, -1, 2); - $pricetaxstring = price($this->total_tva, 0, $tmplang, 0, -1, 2); + //$pricewithtaxstring = price($this->total_ttc, 0, $tmplang, 0, -1, 2); + //$pricetaxstring = price($this->total_tva, 0, $tmplang, 0, -1, 2); + $pricewithtaxstring = price2num($this->total_ttc, 2, 1); + $pricetaxstring = price2num($this->total_tva, 2, 1); /* $name = implode(unpack("H*", $this->thirdparty->name)); @@ -857,7 +859,7 @@ abstract class CommonInvoice extends CommonObject // Using TLV format $s = pack('C1', 1).pack('C1', strlen($this->thirdparty->name)).$this->thirdparty->name; $s .= pack('C1', 2).pack('C1', strlen($this->thirdparty->tva_intra)).$this->thirdparty->tva_intra; - $s .= pack('C1', 3).pack('C1', strlen($datestring)).$this->date; + $s .= pack('C1', 3).pack('C1', strlen($datestring)).$datestring; $s .= pack('C1', 4).pack('C1', strlen($pricewithtaxstring)).$pricewithtaxstring; $s .= pack('C1', 5).pack('C1', strlen($pricetaxstring)).$pricetaxstring; $s .= ''; // Hash of xml invoice diff --git a/test/phpunit/BarcodeTest.php b/test/phpunit/BarcodeTest.php new file mode 100644 index 00000000000..132ba8c1126 --- /dev/null +++ b/test/phpunit/BarcodeTest.php @@ -0,0 +1,203 @@ + + * + * 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 https://www.gnu.org/ + */ + +/** + * \file test/phpunit/BarcodeTest.php + * \ingroup test + * \brief PHPUnit test + * \remarks To run this script as CLI: phpunit filename.php + */ + +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/compta/facture/class/facture.class.php'; + + +if (empty($user->id)) { + print "Load permissions for admin user nb 1\n"; + $user->fetch(1); + $user->getrights(); +} +$conf->global->MAIN_DISABLE_ALL_MAILS=1; + +$langs->load("main"); + + +/** + * Class for PHPUnit tests + * + * @backupGlobals disabled + * @backupStaticAttributes enabled + * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. + */ +class BarcodeTest extends PHPUnit\Framework\TestCase +{ + protected $savconf; + protected $savuser; + protected $savlangs; + protected $savdb; + + /** + * Constructor + * We save global variables into local variables + * + * @return BarcodeTest + */ + public function __construct() + { + parent::__construct(); + + //$this->sharedFixture + global $conf,$user,$langs,$db; + $this->savconf=$conf; + $this->savuser=$user; + $this->savlangs=$langs; + $this->savdb=$db; + + print __METHOD__." db->type=".$db->type." user->id=".$user->id; + //print " - db ".$db->db; + print "\n"; + } + + /** + * setUpBeforeClass + * + * @return void + */ + public static function setUpBeforeClass() + { + global $conf,$user,$langs,$db; + $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. + + print __METHOD__."\n"; + } + + /** + * tearDownAfterClass + * + * @return void + */ + public static function tearDownAfterClass() + { + global $conf,$user,$langs,$db; + $db->rollback(); + + print __METHOD__."\n"; + } + + /** + * Init phpunit tests + * + * @return void + */ + protected function setUp() + { + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; + + print __METHOD__."\n"; + } + + /** + * End phpunit tests + * + * @return void + */ + protected function tearDown() + { + print __METHOD__."\n"; + } + + + /** + * testBarcodeZATCAEncode + * + * @return int + */ + public function testBarcodeZATCAEncode() + { + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; + + $company = new Societe($db); + $company->name = 'Specimen company'; + $company->tva_intra = '123456789'; + + $tmpinvoice = new Facture($db); + + $tmpinvoice->thirdparty = $company; + $tmpinvoice->total_ht = 100; + $tmpinvoice->total_tva = 20; + $tmpinvoice->total_ttc = $tmpinvoice->total_ht + $tmpinvoice->total_tva; + $tmpinvoice->date = dol_mktime(12, 34, 56, 1, 1, 2020, 'gmt'); + + $string_zatca = $tmpinvoice->buildZATCAQRString(); + + $this->assertEquals($string_zatca, "ARBTcGVjaW1lbiBjb21wYW55AgkxMjM0NTY3ODkDFDIwMjAtMDEtMDFUMDk6MzQ6NTZaBAMxMjAFAjIw"); + + return 1; + } + + + + /** + * testBarcodeZATCADecode + * + * @return int + */ + public function testBarcodeZATCADecode() + { + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; + + //$string_zatca_base64 = "AQZSYWZlZXECDTEyMzQ1Njc4OVQxMjUDFDIwMjEtMDctMTJUMTQ6MjU6MDlaBAM3ODYFAjI1"; + $string_zatca_base64 = "ARBTcGVjaW1lbiBjb21wYW55AgkxMjM0NTY3ODkDFDIwMjAtMDEtMDFUMDk6MzQ6NTZaBAMxMjAFAjIw"; + + $decoded = base64_decode($string_zatca_base64); + + //print_r($decoded) + //raw data + //\u0001\u0006Rafeeq\u0002\t123456789\u0003\u00142021-07-12T14:25:09Z\u0004\u0003786\u0005\u000225 + + $result_data = preg_replace('/[\x00-\x1F\x80-\xFF]/', ',', $decoded); + + $arrayOfData = explode(',,', $result_data); + + + print __METHOD__." result=".var_export($arrayOfData, true)."\n"; + $this->assertEquals("", $arrayOfData[0]); + $this->assertEquals("Specimen company", $arrayOfData[1]); + $this->assertEquals("123456789", $arrayOfData[2]); + $this->assertEquals("2020-01-01T09:34:56Z", $arrayOfData[3]); + $this->assertEquals("120", $arrayOfData[4]); + $this->assertEquals("20", $arrayOfData[5]); + + return 1; + } +} From d5dc29e79437bd60bb709de68b042e32125c802e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 19 Mar 2022 19:26:58 +0100 Subject: [PATCH 292/610] Fix position of image on line --- htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php | 2 +- htdocs/core/modules/delivery/doc/pdf_storm.modules.php | 2 +- htdocs/core/modules/expedition/doc/pdf_espadon.modules.php | 2 +- htdocs/core/modules/facture/doc/pdf_sponge.modules.php | 2 +- htdocs/core/modules/propale/doc/pdf_cyan.modules.php | 2 +- htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php index d30107fcbfb..3b946d1f3ce 100644 --- a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php @@ -609,7 +609,7 @@ class pdf_eratosthene extends ModelePDFCommandes } if (!empty($this->cols['photo']) && isset($imglinesize['width']) && isset($imglinesize['height'])) { - $pdf->Image($realpatharray[$i], $this->getColumnContentXStart('photo'), $curY, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi + $pdf->Image($realpatharray[$i], $this->getColumnContentXStart('photo'), $curY + 1, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi // $pdf->Image does not increase value return by getY, so we save it manually $posYAfterImage = $curY + $imglinesize['height']; } diff --git a/htdocs/core/modules/delivery/doc/pdf_storm.modules.php b/htdocs/core/modules/delivery/doc/pdf_storm.modules.php index 742d06e2e34..65912a8b9a0 100644 --- a/htdocs/core/modules/delivery/doc/pdf_storm.modules.php +++ b/htdocs/core/modules/delivery/doc/pdf_storm.modules.php @@ -461,7 +461,7 @@ class pdf_storm extends ModelePDFDeliveryOrder if (!empty($this->cols['photo']) && isset($imglinesize['width']) && isset($imglinesize['height'])) { - $pdf->Image($realpatharray[$i], $this->getColumnContentXStart('photo'), $curY, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi + $pdf->Image($realpatharray[$i], $this->getColumnContentXStart('photo'), $curY + 1, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi // $pdf->Image does not increase value return by getY, so we save it manually $posYAfterImage = $curY + $imglinesize['height']; } diff --git a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php index fc1094ea949..efc061b9e67 100644 --- a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php @@ -562,7 +562,7 @@ class pdf_espadon extends ModelePdfExpedition if (!empty($this->cols['photo']) && isset($imglinesize['width']) && isset($imglinesize['height'])) { - $pdf->Image($realpatharray[$i], $this->getColumnContentXStart('photo'), $curY, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi + $pdf->Image($realpatharray[$i], $this->getColumnContentXStart('photo'), $curY + 1, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi // $pdf->Image does not increase value return by getY, so we save it manually $posYAfterImage = $curY + $imglinesize['height']; } diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index a5e9c0b841b..26b5a064a57 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -685,7 +685,7 @@ class pdf_sponge extends ModelePDFFactures } if (!empty($this->cols['photo']) && isset($imglinesize['width']) && isset($imglinesize['height'])) { - $pdf->Image($realpatharray[$i], $this->getColumnContentXStart('photo'), $curY, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi + $pdf->Image($realpatharray[$i], $this->getColumnContentXStart('photo'), $curY + 1, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi // $pdf->Image does not increase value return by getY, so we save it manually $posYAfterImage = $curY + $imglinesize['height']; } diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index 86e311b1306..4ceaf99c2cf 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -622,7 +622,7 @@ class pdf_cyan extends ModelePDFPropales if (!empty($this->cols['photo']) && isset($imglinesize['width']) && isset($imglinesize['height'])) { - $pdf->Image($realpatharray[$i], $this->getColumnContentXStart('photo'), $curY, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi + $pdf->Image($realpatharray[$i], $this->getColumnContentXStart('photo'), $curY + 1, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi // $pdf->Image does not increase value return by getY, so we save it manually $posYAfterImage = $curY + $imglinesize['height']; } diff --git a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php index 8d8df36e088..2be12805685 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php @@ -566,7 +566,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders } if (!empty($this->cols['photo']) && isset($imglinesize['width']) && isset($imglinesize['height'])) { - $pdf->Image($realpatharray[$i], $this->getColumnContentXStart('photo'), $curY, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi + $pdf->Image($realpatharray[$i], $this->getColumnContentXStart('photo'), $curY + 1, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi // $pdf->Image does not increase value return by getY, so we save it manually $posYAfterImage = $curY + $imglinesize['height']; } From 3293a6f8b85298f68334e1861a6c5e99d7c951ed Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 19 Mar 2022 19:40:20 +0100 Subject: [PATCH 293/610] Fix position of table on new page of PDF --- htdocs/core/modules/facture/doc/pdf_crabe.modules.php | 2 +- htdocs/core/modules/facture/doc/pdf_sponge.modules.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index df4bfeedb9c..8046347e881 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -477,7 +477,7 @@ class pdf_crabe extends ModelePDFFactures } $tab_top += $extra_under_address_shift; - $tab_top_newpage += $extra_under_address_shift; + $tab_top_newpage += 0; // Incoterm $height_incoterms = 0; diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index 26b5a064a57..c1e0468b868 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -460,7 +460,7 @@ class pdf_sponge extends ModelePDFFactures } $tab_top += $extra_under_address_shift; - $tab_top_newpage += $extra_under_address_shift; + $tab_top_newpage += 0; // Define heigth of table for lines (for first page) From 6c0e333c7d7e5a92b8b1902919bb90a8100c1723 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 20 Mar 2022 16:33:35 +0100 Subject: [PATCH 294/610] Fix we must user relative timezone of date. --- htdocs/comm/action/card.php | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 1d084c915d8..ee8fff4adc8 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -1546,19 +1546,19 @@ if ($id > 0) { print ''; $tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT'); if (GETPOST("afaire") == 1) { - print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 0, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuser') : 'tzuser'); + print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 0, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel'); } elseif (GETPOST("afaire") == 2) { - print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuser') : 'tzuser'); + print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel'); } else { - print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuser') : 'tzuser'); + print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel'); } print ' - '; if (GETPOST("afaire") == 1) { - print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuser') : 'tzuser'); + print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel'); } elseif (GETPOST("afaire") == 2) { - print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuser') : 'tzuser'); + print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel'); } else { - print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuser') : 'tzuser'); + print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel'); } print ''; @@ -1996,11 +1996,15 @@ if ($id > 0) { // Date start print ''.$langs->trans("DateActionStart").''; + // Test a date before the 27 march and one after + //print dol_print_date($object->datep, 'dayhour', 'gmt'); + //print dol_print_date($object->datep, 'dayhour', 'tzuser'); + //print dol_print_date($object->datep, 'dayhour', 'tzuserrel'); if (empty($object->fulldayevent)) { - print dol_print_date($object->datep, 'dayhour', 'tzuser'); + print dol_print_date($object->datep, 'dayhour', 'tzuserrel'); } else { $tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT'); - print dol_print_date($object->datep, 'day', ($tzforfullday ? $tzforfullday : 'tzuser')); + print dol_print_date($object->datep, 'day', ($tzforfullday ? $tzforfullday : 'tzuserrel')); } if ($object->percentage == 0 && $object->datep && $object->datep < ($now - $delay_warning)) { print img_warning($langs->trans("Late")); @@ -2011,10 +2015,10 @@ if ($id > 0) { // Date end print ''.$langs->trans("DateActionEnd").''; if (empty($object->fulldayevent)) { - print dol_print_date($object->datef, 'dayhour', 'tzuser'); + print dol_print_date($object->datef, 'dayhour', 'tzuserrel'); } else { $tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT'); - print dol_print_date($object->datef, 'day', ($tzforfullday ? $tzforfullday : 'tzuser')); + print dol_print_date($object->datef, 'day', ($tzforfullday ? $tzforfullday : 'tzuserrel')); } if ($object->percentage > 0 && $object->percentage < 100 && $object->datef && $object->datef < ($now - $delay_warning)) { print img_warning($langs->trans("Late")); From cd37d4b403080089399601540d9aa3d67c2432c5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 21 Mar 2022 00:14:42 +0100 Subject: [PATCH 295/610] Code comment --- htdocs/core/class/doleditor.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/doleditor.class.php b/htdocs/core/class/doleditor.class.php index 4a2e65ba1f3..23c04a98a81 100644 --- a/htdocs/core/class/doleditor.class.php +++ b/htdocs/core/class/doleditor.class.php @@ -193,10 +193,10 @@ class DolEditor removePlugins : \''.$pluginstodisable.'\', readOnly : '.($this->readonly ? 'true' : 'false').', htmlEncodeOutput :'.$htmlencode_force.', - allowedContent :'.($disallowAnyContent ? 'false' : 'true').', - extraAllowedContent : \'a[target];div{float,display}\', /* Add the style float and display into div to default other allowed tags */ - disallowedContent : '.($disallowAnyContent ? '\'\'' : '\'\'').', - fullPage : '.($fullpage ? 'true' : 'false').', + allowedContent :'.($disallowAnyContent ? 'false' : 'true').', /* Advanced Content Filter (ACF) is own when allowedContent is false */ + extraAllowedContent : \'a[target];div{float,display}\', /* Add the style float and display into div to default other allowed tags */ + disallowedContent : '.($disallowAnyContent ? '\'\'' : '\'\'').', /* Tags that are not allowed */ + fullPage : '.($fullpage ? 'true' : 'false').', /* if true, the html, header and body tags are kept */ toolbar: \''.$this->toolbarname.'\', toolbarStartupExpanded: '.($this->toolbarstartexpanded ? 'true' : 'false').', width: '.($this->width ? '\''.$this->width.'\'' : '\'\'').', From 1313be410af4309dc4cfd27b69637a185dcdf23c Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Mon, 21 Mar 2022 10:49:37 +0100 Subject: [PATCH 296/610] Update fournisseurs.php $helpurl for DE --- htdocs/product/fournisseurs.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index 15b861ce812..8a8f3793b8f 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -383,11 +383,11 @@ $helpurl = ''; $shortlabel = dol_trunc($object->label, 16); if (GETPOST("type") == '0' || ($object->type == Product::TYPE_PRODUCT)) { $title = $langs->trans('Product')." ".$shortlabel." - ".$langs->trans('BuyingPrices'); - $helpurl = 'EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos'; + $helpurl = 'EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos|DE:Modul_Produkte'; } if (GETPOST("type") == '1' || ($object->type == Product::TYPE_SERVICE)) { $title = $langs->trans('Service')." ".$shortlabel." - ".$langs->trans('BuyingPrices'); - $helpurl = 'EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios'; + $helpurl = 'EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios|DE:Modul_Lesitungen'; } llxHeader('', $title, $helpurl, '', 0, 0, '', '', '', 'classforhorizontalscrolloftabs'); From bf7c707d0535de8539b556e0e73f1ae1a090565a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 21 Mar 2022 11:11:36 +0100 Subject: [PATCH 297/610] Doc --- .../modules/facture/doc/doc_generic_invoice_odt.modules.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 60e3d6bcfdd..50f4c1a60eb 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 @@ -383,10 +383,10 @@ class doc_generic_invoice_odt extends ModelePDFFactures } // Define substitution array - $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object); + $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object); // Set tags __...__ $array_object_from_properties = $this->get_substitutionarray_each_var_object($object, $outputlangs); - $array_objet = $this->get_substitutionarray_object($object, $outputlangs); - $array_user = $this->get_substitutionarray_user($user, $outputlangs); + $array_objet = $this->get_substitutionarray_object($object, $outputlangs); // Set tags object_... + $array_user = $this->get_substitutionarray_user($user, $outputlangs); // Set tags myuser_... $array_soc = $this->get_substitutionarray_mysoc($mysoc, $outputlangs); $array_thirdparty = $this->get_substitutionarray_thirdparty($socobject, $outputlangs); $array_propal = is_object($propal_object) ? $this->get_substitutionarray_object($propal_object, $outputlangs, 'propal') : array(); From 362352b1986f41b683ed161eef45aa968f7e14f6 Mon Sep 17 00:00:00 2001 From: GregM Date: Mon, 21 Mar 2022 12:18:36 +0100 Subject: [PATCH 298/610] replacing to dolGetButtonAction on Expedition card --- htdocs/expedition/card.php | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 163761c1f6f..5079f11ac2f 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -2460,9 +2460,9 @@ if ($action == 'create') { if ($object->statut == Expedition::STATUS_DRAFT && $num_prod > 0) { if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->expedition->creer)) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->expedition->shipping_advance->validate))) { - print ''.$langs->trans("Validate").''; + print dolGetButtonAction('', $langs->trans('Validate'), 'default', $_SERVER["PHP_SELF"].'?action=valid&token='.newToken().'&id='.$object->id, ''); } else { - print ''.$langs->trans("Validate").''; + print dolGetButtonAction($langs->trans('NotAllowed'), $langs->trans('Validate'), 'default', $_SERVER['PHP_SELF']. '#', '', false); } } @@ -2470,9 +2470,9 @@ if ($action == 'create') { // 0=draft, 1=validated, 2=billed, we miss a status "delivered" (only available on order) if ($object->statut == Expedition::STATUS_CLOSED && $user->rights->expedition->creer) { if (!empty($conf->facture->enabled) && !empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)) { // Quand l'option est on, il faut avoir le bouton en plus et non en remplacement du Close ? - print ''.$langs->trans("ClassifyUnbilled").''; + print dolGetButtonAction('', $langs->trans('ClassifyUnbilled'), 'default', $_SERVER["PHP_SELF"].'?action=reopen&token='.newToken().'&id='.$object->id, ''); } else { - print ''.$langs->trans("ReOpen").''; + print dolGetButtonAction('', $langs->trans('ReOpen'), 'default', $_SERVER["PHP_SELF"].'?action=reopen&token='.newToken().'&id='.$object->id, ''); } } @@ -2480,9 +2480,9 @@ if ($action == 'create') { if (empty($user->socid)) { if ($object->statut > 0) { if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->expedition->shipping_advance->send) { - print ''.$langs->trans('SendMail').''; + print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"].'?action=presend&token='.newToken().'&id='.$object->id.'&mode=init#formmailbeforetitle', ''); } else { - print ''.$langs->trans('SendMail').''; + print dolGetButtonAction('',$langs->trans('SendMail'), 'default', $_SERVER['PHP_SELF']. '#', '', false); } } } @@ -2492,14 +2492,14 @@ if ($action == 'create') { if ($user->rights->facture->creer) { // TODO show button only if (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)) // If we do that, we must also make this option official. - print ''.$langs->trans("CreateBill").''; + print dolGetButtonAction('', $langs->trans('CreateBill'), 'default', DOL_URL_ROOT.'/compta/facture/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid, ''); } } // This is just to generate a delivery receipt //var_dump($object->linkedObjectsIds['delivery']); if ($conf->delivery_note->enabled && ($object->statut == Expedition::STATUS_VALIDATED || $object->statut == Expedition::STATUS_CLOSED) && $user->rights->expedition->delivery->creer && empty($object->linkedObjectsIds['delivery'])) { - print ''.$langs->trans("CreateDeliveryOrder").''; + print dolGetButtonAction('', $langs->trans('CreateDeliveryOrder'), 'default', $_SERVER["PHP_SELF"].'?action=create_delivery&token='.newToken().'&id='.$object->id, ''); } // Close if ($object->statut == Expedition::STATUS_VALIDATED) { @@ -2510,20 +2510,20 @@ if ($action == 'create') { $label = "ClassifyBilled"; $paramaction = 'classifybilled'; } - print ''.$langs->trans($label).''; + print dolGetButtonAction('', $langs->trans($label), 'default', $_SERVER["PHP_SELF"].'?action='. $paramaction .'&token='.newToken().'&id='.$object->id, ''); } } // Cancel if ($object->statut == Expedition::STATUS_VALIDATED) { if ($user->rights->expedition->supprimer) { - print ''.$langs->trans("Cancel").''; + print dolGetButtonAction('', $langs->trans('Cancel'), 'danger', $_SERVER["PHP_SELF"].'?action=cancel&token='.newToken().'&id='.$object->id.'&mode=init#formmailbeforetitle', ''); } } // Delete if ($user->rights->expedition->supprimer) { - print ''.$langs->trans("Delete").''; + print dolGetButtonAction('', $langs->trans('Delete'), 'delete', $_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$object->id, ''); } } From aec5f4da13cd4885b67c893a51fd38109026463f Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Mon, 21 Mar 2022 11:25:46 +0000 Subject: [PATCH 299/610] Fixing style errors. --- htdocs/expedition/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 5079f11ac2f..428fb6c7438 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -2482,7 +2482,7 @@ if ($action == 'create') { if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->expedition->shipping_advance->send) { print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"].'?action=presend&token='.newToken().'&id='.$object->id.'&mode=init#formmailbeforetitle', ''); } else { - print dolGetButtonAction('',$langs->trans('SendMail'), 'default', $_SERVER['PHP_SELF']. '#', '', false); + print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER['PHP_SELF']. '#', '', false); } } } From dd38f6c35b46b97c63ccb54a0d0d50a978cc5d08 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 21 Mar 2022 12:53:03 +0100 Subject: [PATCH 300/610] Prepare 15.0.2 --- htdocs/filefunc.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index 771cd4ec8a0..3d03730f9ba 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -34,7 +34,7 @@ if (!defined('DOL_APPLICATION_TITLE')) { define('DOL_APPLICATION_TITLE', 'Dolibarr'); } if (!defined('DOL_VERSION')) { - define('DOL_VERSION', '15.0.1'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c + define('DOL_VERSION', '15.0.2'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c } if (!defined('EURO')) { From 5fd2ec3fdadda4e94b6bdc141df391c941dd3221 Mon Sep 17 00:00:00 2001 From: BENKE Charlene <1179011+defrance@users.noreply.github.com> Date: Mon, 21 Mar 2022 15:43:37 +0100 Subject: [PATCH 301/610] add hook for more buttons --- htdocs/compta/prelevement/card.php | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/htdocs/compta/prelevement/card.php b/htdocs/compta/prelevement/card.php index a076299b4cd..0b1b82998b2 100644 --- a/htdocs/compta/prelevement/card.php +++ b/htdocs/compta/prelevement/card.php @@ -309,20 +309,23 @@ if ($id > 0 || $ref) { // Actions if ($action != 'settransmitted' && $action != 'setcredited') { print "\n".'
'."\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 (empty($object->date_trans)) { - if ($object->type == 'bank-transfer') print dolGetButtonAction($langs->trans("SetToStatusSent"), '', 'default', 'card.php?action=settransmitted&token='.newToken().'&id='.$object->id, '', $user->rights->paymentbybanktransfer->send); - else print dolGetButtonAction($langs->trans("SetToStatusSent"), '', 'default', 'card.php?action=settransmitted&token='.newToken().'&id='.$object->id, '', $user->rights->prelevement->bons->send); + if (empty($object->date_trans)) { + if ($object->type == 'bank-transfer') print dolGetButtonAction($langs->trans("SetToStatusSent"), '', 'default', 'card.php?action=settransmitted&token='.newToken().'&id='.$object->id, '', $user->rights->paymentbybanktransfer->send); + else print dolGetButtonAction($langs->trans("SetToStatusSent"), '', 'default', 'card.php?action=settransmitted&token='.newToken().'&id='.$object->id, '', $user->rights->prelevement->bons->send); + } + + if (!empty($object->date_trans) && $object->date_credit == 0) { + if ($object->type == 'bank-transfer') print dolGetButtonAction($langs->trans("ClassDebited"), '', 'default', 'card.php?action=setcredited&token='.newToken().'&id='.$object->id, '', $user->rights->paymentbybanktransfer->debit); + else print dolGetButtonAction($langs->trans("ClassCredited"), '', 'default', 'card.php?action=setcredited&token='.newToken().'&id='.$object->id, '', $user->rights->prelevement->bons->credit); + } + + if ($object->type == 'bank-transfer') print dolGetButtonAction($langs->trans("Delete"), '', 'delete', 'card.php?action=delete&token='.newToken().'&id='.$object->id, '', $user->rights->paymentbybanktransfer->create); + else print dolGetButtonAction($langs->trans("Delete"), '', 'delete', 'card.php?action=delete&token='.newToken().'&id='.$object->id, '', $user->rights->prelevement->bons->creer); } - - if (!empty($object->date_trans) && $object->date_credit == 0) { - if ($object->type == 'bank-transfer') print dolGetButtonAction($langs->trans("ClassDebited"), '', 'default', 'card.php?action=setcredited&token='.newToken().'&id='.$object->id, '', $user->rights->paymentbybanktransfer->debit); - else print dolGetButtonAction($langs->trans("ClassCredited"), '', 'default', 'card.php?action=setcredited&token='.newToken().'&id='.$object->id, '', $user->rights->prelevement->bons->credit); - } - - if ($object->type == 'bank-transfer') print dolGetButtonAction($langs->trans("Delete"), '', 'delete', 'card.php?action=delete&token='.newToken().'&id='.$object->id, '', $user->rights->paymentbybanktransfer->create); - else print dolGetButtonAction($langs->trans("Delete"), '', 'delete', 'card.php?action=delete&token='.newToken().'&id='.$object->id, '', $user->rights->prelevement->bons->creer); - print '
'; } From 14d91a98fa5d74c3ba9cac664c8713c1b6123dbe Mon Sep 17 00:00:00 2001 From: GregM Date: Mon, 21 Mar 2022 15:55:53 +0100 Subject: [PATCH 302/610] replacing to dolGetButtonAction on Delivery card --- htdocs/delivery/card.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/delivery/card.php b/htdocs/delivery/card.php index 00975946f6b..5b413459445 100644 --- a/htdocs/delivery/card.php +++ b/htdocs/delivery/card.php @@ -649,15 +649,15 @@ if ($action == 'create') { // Create. Seems to no be used if ($object->statut == 0 && $num_prod > 0) { if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->expedition->delivery->creer)) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->expedition->delivery_advance->validate))) { - print ''.$langs->trans("Validate").''; + print dolGetButtonAction('', $langs->trans('Validate'), 'default', $_SERVER["PHP_SELF"].'?action=valid&token='.newToken().'&id='.$object->id, ''); } } if ($user->rights->expedition->delivery->supprimer) { if ($conf->expedition_bon->enabled) { - print ''.$langs->trans("Delete").''; + print dolGetButtonAction('', $langs->trans('Delete'), 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&expid='.$object->origin_id.'&action=delete&token='.newToken().'&backtopage='.urlencode(DOL_URL_ROOT.'/expedition/card.php?id='.$object->origin_id), ''); } else { - print ''.$langs->trans("Delete").''; + print dolGetButtonAction('', $langs->trans('Delete'), 'delete', $_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$object->id, ''); } } From 40fbaf15fef5c4aeb06075b20abeb0ec82117ead Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 21 Mar 2022 17:12:26 +0100 Subject: [PATCH 303/610] Add welsh language --- htdocs/langs/en_US/languages.lang | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/langs/en_US/languages.lang b/htdocs/langs/en_US/languages.lang index 7c2a0f8b6ec..820339e6875 100644 --- a/htdocs/langs/en_US/languages.lang +++ b/htdocs/langs/en_US/languages.lang @@ -16,6 +16,7 @@ Language_bg_BG=Bulgarian Language_bs_BA=Bosnian Language_ca_ES=Catalan Language_cs_CZ=Czech +Language_cy_GB=Welsh Language_da_DA=Danish Language_da_DK=Danish Language_de_DE=German From 2e27c40de4a233c89dd71c9cbc4607676145f662 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 21 Mar 2022 22:02:34 +0100 Subject: [PATCH 304/610] Fix customreport with link to parents --- htdocs/contrat/class/contrat.class.php | 4 +- htdocs/core/customreports.php | 58 +++++++++++++++++++++----- htdocs/langs/en_US/contracts.lang | 4 +- 3 files changed, 52 insertions(+), 14 deletions(-) diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 4e4437c1b2c..c9341d23ee3 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -2750,8 +2750,8 @@ class ContratLigne extends CommonObjectLine //'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>115), //'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>120), //'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>-1, 'position'=>125), - 'fk_user_ouverture' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserOpen', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>135), - 'fk_user_cloture' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserCloture', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>135), + 'fk_user_ouverture' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserStartingService', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>135), + 'fk_user_cloture' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserClosingService', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>135), 'statut' =>array('type'=>'smallint(6)', 'label'=>'Statut', 'enabled'=>1, 'visible'=>-1, 'position'=>500, 'arrayofkeyval'=>array(0=>'Draft', 4=>'Open', 5=>'Closed')) ); // END MODULEBUILDER PROPERTIES diff --git a/htdocs/core/customreports.php b/htdocs/core/customreports.php index 7331b08e13e..ec0ce330dc4 100644 --- a/htdocs/core/customreports.php +++ b/htdocs/core/customreports.php @@ -556,9 +556,26 @@ if (!empty($search_measures) && !empty($search_xaxis)) { $sql .= ' AND parenttable.entity IN ('.getEntity($tmparray[1]).')'; } } + + // Add INNER JOIN for all parent tables + //var_dump($arrayofxaxis); var_dump($search_xaxis); + $listoftablesalreadyadded = array($object->table_element => $object->table_element); + foreach ($search_xaxis as $key => $val) { + if (!empty($arrayofxaxis[$val])) { + $tmpval = explode('.', $val); + //var_dump($arrayofxaxis[$val]['table']); + if (! in_array($arrayofxaxis[$val]['table'], $listoftablesalreadyadded)) { // We do not add join for main table already added + $sql .= ' INNER JOIN '.MAIN_DB_PREFIX.$arrayofxaxis[$val]['table'].' as '.$tmpval[0]; + $listoftablesalreadyadded[$arrayofxaxis[$val]['table']] = $arrayofxaxis[$val]['table']; + } + } else { + dol_print_error($db, 'Found an key into search_xaxis not found into arrayofxaxis'); + } + } + $sql .= ' WHERE 1 = 1'; if ($object->ismultientitymanaged == 1) { - $sql .= ' AND entity IN ('.getEntity($object->element).')'; + $sql .= ' AND t.entity IN ('.getEntity($object->element).')'; } // Add the where here $sqlfilters = $search_component_params_hidden; @@ -914,7 +931,7 @@ function fillArrayOfMeasures($object, $tablealias, $labelofobject, &$arrayofmesu * Fill arrayofmesures for an object * * @param mixed $object Any object - * @param string $tablealias Alias of table + * @param string $tablealias Alias of table ('t' for example) * @param string $labelofobject Label of object * @param array $arrayofxaxis Array of xaxis already filled * @param int $level Level @@ -964,14 +981,31 @@ function fillArrayOfXAxis($object, $tablealias, $labelofobject, &$arrayofxaxis, continue; } if (in_array($val['type'], array('timestamp', 'date', 'datetime'))) { - $arrayofxaxis[$tablealias.'.'.$key.'-year'] = array('label' => img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' ('.$YYYY.')', 'position' => ($val['position']+($count * 100000)).'.1'); - $arrayofxaxis[$tablealias.'.'.$key.'-month'] = array('label' => img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' ('.$YYYY.'-'.$MM.')', 'position' => ($val['position']+($count * 100000)).'.2'); - $arrayofxaxis[$tablealias.'.'.$key.'-day'] = array('label' => img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' ('.$YYYY.'-'.$MM.'-'.$DD.')', 'position' => ($val['position']+($count * 100000)).'.3'); + $arrayofxaxis[$tablealias.'.'.$key.'-year'] = array( + 'label' => img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' ('.$YYYY.')', + 'position' => ($val['position']+($count * 100000)).'.1', + 'table' => $object->table_element + ); + $arrayofxaxis[$tablealias.'.'.$key.'-month'] = array( + 'label' => img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' ('.$YYYY.'-'.$MM.')', + 'position' => ($val['position']+($count * 100000)).'.2', + 'table' => $object->table_element + ); + $arrayofxaxis[$tablealias.'.'.$key.'-day'] = array( + 'label' => img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' ('.$YYYY.'-'.$MM.'-'.$DD.')', + 'position' => ($val['position']+($count * 100000)).'.3', + 'table' => $object->table_element + ); } else { - $arrayofxaxis[$tablealias.'.'.$key] = array('label' => img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']), 'position' => ($val['position']+($count * 100000))); + $arrayofxaxis[$tablealias.'.'.$key] = array( + 'label' => img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']), + 'position' => ($val['position']+($count * 100000)), + 'table' => $object->table_element + ); } } } + // Add extrafields to X-Axis if ($object->isextrafieldmanaged) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { @@ -981,9 +1015,14 @@ function fillArrayOfXAxis($object, $tablealias, $labelofobject, &$arrayofxaxis, if (!empty($extrafields->attributes[$object->table_element]['totalizable'][$key])) { continue; } - $arrayofxaxis[$tablealias.'e.'.$key] = array('label' => img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($extrafields->attributes[$object->table_element]['label'][$key]), 'position' => 1000 + (int) $extrafields->attributes[$object->table_element]['pos'][$key] + ($count * 100000)); + $arrayofxaxis[$tablealias.'e.'.$key] = array( + 'label' => img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($extrafields->attributes[$object->table_element]['label'][$key]), + 'position' => 1000 + (int) $extrafields->attributes[$object->table_element]['pos'][$key] + ($count * 100000), + 'table' => $object->table_element + ); } } + // Add fields for parent objects foreach ($object->fields as $key => $val) { if (preg_match('/^[^:]+:[^:]+:/', $val['type'])) { @@ -993,10 +1032,7 @@ function fillArrayOfXAxis($object, $tablealias, $labelofobject, &$arrayofxaxis, dol_include_once($tmptype[2]); if (class_exists($newobject)) { $tmpobject = new $newobject($db); - /*var_dump($val['label']); - var_dump($tmptype); - var_dump($arrayofmesures); - var_dump('t-'.$key);*/ + //var_dump($key); var_dump($tmpobject->element); var_dump($val['label']); var_dump($tmptype); var_dump('t-'.$key); $count++; $arrayofxaxis = fillArrayOfXAxis($tmpobject, $tablealias.'__'.$key, $langs->trans($val['label']), $arrayofxaxis, $level + 1, $count); } else { diff --git a/htdocs/langs/en_US/contracts.lang b/htdocs/langs/en_US/contracts.lang index 746c7fdfeb6..8d209623c1b 100644 --- a/htdocs/langs/en_US/contracts.lang +++ b/htdocs/langs/en_US/contracts.lang @@ -102,4 +102,6 @@ TypeContact_contrat_external_CUSTOMER=Follow-up customer contact TypeContact_contrat_external_SALESREPSIGN=Signing contract customer contact HideClosedServiceByDefault=Hide closed services by default ShowClosedServices=Show Closed Services -HideClosedServices=Hide Closed Services \ No newline at end of file +HideClosedServices=Hide Closed Services +UserStartingService=User starting service +UserClosingService=User closing service From 8ef55eae0734cfc71f80082a791dc08625333eeb Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Tue, 22 Mar 2022 10:04:05 +0100 Subject: [PATCH 305/610] FIX: propal list: missing translation keys for transifex --- htdocs/langs/en_US/propal.lang | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/htdocs/langs/en_US/propal.lang b/htdocs/langs/en_US/propal.lang index 557df2f840f..afab92970ef 100644 --- a/htdocs/langs/en_US/propal.lang +++ b/htdocs/langs/en_US/propal.lang @@ -84,6 +84,17 @@ ProposalCustomerSignature=Written acceptance, company stamp, date and signature ProposalsStatisticsSuppliers=Vendor proposals statistics CaseFollowedBy=Case followed by SignedOnly=Signed only +IsNotADraft=is not a draft +PassedInOpenStatus=has been validated +CantBeSign=cannot be signed +Sign=Sign +Signed=signed +CantBeSign=cannot be signed +CantBeValidated=cannot be validated +ConfirmMassValidation=Bulk Validate confirmation +ConfirmMassSignature=Bulk Signature confirmation +ConfirmMassValidationQuestion=Are you sure you want to validate the selected records ? +ConfirmMassSignatureQuestion=Are you sure you want to sign the selected records ? IdProposal=Proposal ID IdProduct=Product ID PrParentLine=Proposal Parent Line From 33398a3031b651693b45884f60db731cf18555f4 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 22 Mar 2022 10:10:42 +0100 Subject: [PATCH 306/610] FIX missing object and action hooks parameters --- htdocs/contact/list.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 66561730829..b661bc61713 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -384,7 +384,7 @@ if (!empty($conf->mailing->enabled)) { } // Add fields from hooks $parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; $sql .= " FROM ".MAIN_DB_PREFIX."socpeople as p"; if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { @@ -543,7 +543,7 @@ if (!empty($socid)) { include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; // Add where from hooks $parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; // Add order if ($view == "recent") { @@ -767,7 +767,7 @@ $moreforfilter .= ''; print '
'; print $moreforfilter; $parameters = array('type'=>$type); -$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; print '
'; @@ -910,7 +910,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; // Fields from hook $parameters = array('arrayfields'=>$arrayfields); -$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Date creation if (!empty($arrayfields['p.datec']['checked'])) { @@ -1018,7 +1018,7 @@ $parameters = array( 'sortfield'=>$sortfield, 'sortorder'=>$sortorder, ); -$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; if (!empty($arrayfields['p.datec']['checked'])) { print_liste_field_titre($arrayfields['p.datec']['label'], $_SERVER["PHP_SELF"], "p.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap '); @@ -1255,7 +1255,7 @@ while ($i < min($num, $limit)) { include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; // Fields from hook $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); - $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Date creation if (!empty($arrayfields['p.datec']['checked'])) { @@ -1312,7 +1312,7 @@ while ($i < min($num, $limit)) { $db->free($resql); $parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql); -$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; print ""; From d4f55ae1167087452c177cdded0ae7b5973131af Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Tue, 22 Mar 2022 10:11:10 +0100 Subject: [PATCH 307/610] FIX: propal list: bad error management in mass actions --- htdocs/comm/propal/list.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index d92ec87ca29..5b25fd89819 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -272,9 +272,9 @@ if ($action == 'validate') { $db->begin(); $error = 0; foreach ($toselect as $checked) { - if ($tmpproposal->fetch($checked)) { + if ($tmpproposal->fetch($checked) > 0) { if ($tmpproposal->statut == $tmpproposal::STATUS_DRAFT) { - if ($tmpproposal->valid($user)) { + if ($tmpproposal->valid($user) > 0) { setEventMessage($tmpproposal->ref." ".$langs->trans('PassedInOpenStatus'), 'mesgs'); } else { setEventMessage($langs->trans('CantBeValidated'), 'errors'); @@ -285,7 +285,7 @@ if ($action == 'validate') { $error++; } } else { - dol_print_error($db); + setEventMessages($tmpproposal->error, $tmpproposal->errors, 'errors'); $error++; } } @@ -305,14 +305,14 @@ if ($action == "sign") { $db->begin(); $error = 0; foreach ($toselect as $checked) { - if ($tmpproposal->fetch($checked)) { + if ($tmpproposal->fetch($checked) > 0) { if ($tmpproposal->statut == $tmpproposal::STATUS_VALIDATED) { $tmpproposal->statut = $tmpproposal::STATUS_SIGNED; - if ($tmpproposal->update($user)) { + if ($tmpproposal->update($user) > 0) { setEventMessage($tmpproposal->ref." ".$langs->trans('Signed'), 'mesgs'); } else { - dol_print_error($db); + setEventMessages($tmpproposal->error, $tmpproposal->errors, 'errors'); $error++; } } else { @@ -320,7 +320,7 @@ if ($action == "sign") { $error++; } } else { - dol_print_error($db); + setEventMessages($tmpproposal->error, $tmpproposal->errors, 'errors'); $error++; } } From f24e1862eec65fc9452d62977bcb61509823a597 Mon Sep 17 00:00:00 2001 From: GregM Date: Tue, 22 Mar 2022 10:29:34 +0100 Subject: [PATCH 308/610] replacing to dolGetButtonAction on Fourn card --- htdocs/fourn/card.php | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php index 77932cf4e3d..42b29fc74aa 100644 --- a/htdocs/fourn/card.php +++ b/htdocs/fourn/card.php @@ -837,24 +837,24 @@ if ($object->id > 0) { // modified by hook if (empty($reshook)) { if ($object->status != 1) { - print ''; + print dolGetButtonAction($langs->trans('ThirdPartyIsClosed'), $langs->trans('ThirdPartyIsClosed'), 'default', $_SERVER['PHP_SELF'].'#', '', false); } if (!empty($conf->supplier_proposal->enabled) && !empty($user->rights->supplier_proposal->creer)) { $langs->load("supplier_proposal"); if ($object->status == 1) { - print ''.$langs->trans("AddSupplierProposal").''; + print dolGetButtonAction('', $langs->trans('AddSupplierProposal'), 'default', DOL_URL_ROOT.'/supplier_proposal/card.php?action=create&socid='.$object->id, ''); } else { - print ''.$langs->trans("AddSupplierProposal").''; + print dolGetButtonAction($langs->trans('ThirdPartyIsClosed'), $langs->trans('AddSupplierProposalGR'), 'default', $_SERVER['PHP_SELF'].'#', '', false); } } if ($user->rights->fournisseur->commande->creer || $user->rights->supplier_order->creer) { $langs->load("orders"); if ($object->status == 1) { - print ''.$langs->trans("AddSupplierOrderShort").''; + print dolGetButtonAction('', $langs->trans('AddSupplierOrderShort'), 'default', DOL_URL_ROOT.'/fourn/commande/card.php?action=create&token='.newToken().'&socid='.$object->id, ''); } else { - print ''.$langs->trans("AddSupplierOrderShort").''; + print dolGetButtonAction($langs->trans('ThirdPartyIsClosed'), $langs->trans('AddSupplierOrderShort'), 'default', $_SERVER['PHP_SELF'].'#', '', false); } } @@ -862,30 +862,30 @@ if ($object->id > 0) { if (!empty($orders2invoice) && $orders2invoice > 0) { if ($object->status == 1) { // Company is open - print ''; + print dolGetButtonAction('', $langs->trans('CreateInvoiceForThisSupplierGR'), 'default', DOL_URL_ROOT.'/fourn/commande/list.php?socid='.$object->id.'&search_billed=0&autoselectall=1', ''); } else { - print ''; + print dolGetButtonAction('', $langs->trans('CreateInvoiceForThisCustomer'), 'default', $_SERVER['PHP_SELF'].'#', '', false); } } else { - print ''; + print dolGetButtonAction($langs->trans("NoOrdersToInvoice").' ('.$langs->trans("WithReceptionFinished").')', $langs->trans('CreateInvoiceForThisCustomer'), 'default', $_SERVER['PHP_SELF'].'#', '', false); } } if ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer) { $langs->load("bills"); if ($object->status == 1) { - print ''.$langs->trans("AddBill").''; + print dolGetButtonAction('', $langs->trans('AddBill'), 'default', DOL_URL_ROOT.'/fourn/facture/card.php?action=create&socid='.$object->id, ''); } else { - print ''.$langs->trans("AddBill").''; + print dolGetButtonAction($langs->trans('ThirdPartyIsClosed'), $langs->trans('AddBill'), 'default', $_SERVER['PHP_SELF'].'#', '', false); } } // Add action if (!empty($conf->agenda->enabled) && !empty($conf->global->MAIN_REPEATTASKONEACHTAB) && $object->status == 1) { if ($user->rights->agenda->myactions->create) { - print ''.$langs->trans("AddAction").''; + print dolGetButtonAction('', $langs->trans('AddAction'), 'default', DOL_URL_ROOT.'/comm/action/card.php?action=create&socid='.$object->id, ''); } else { - print ''.$langs->trans("AddAction").''; + print dolGetButtonAction($langs->trans('NotAllowed'), $langs->trans('AddAction'), 'default', $_SERVER['PHP_SELF'].'#', '', false); } } } From 4efe10a9a55367baf5eb76a4db7bfd448511e43b Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 22 Mar 2022 10:46:26 +0100 Subject: [PATCH 309/610] NEW add hook printFieldListWhere in "show_contacts" function --- htdocs/core/lib/company.lib.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 4bf8a0e7219..7f1f03cd121 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -1102,6 +1102,10 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '') // Add where from extra fields $extrafieldsobjectkey = $contactstatic->table_element; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; + // Add where from hooks + $parameters = array('socid' => $object->id); + $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook + $sql .= $hookmanager->resPrint; if ($sortfield == "t.name") { $sql .= " ORDER BY t.lastname $sortorder, t.firstname $sortorder"; } else { From cf64fc288d36fb1bbf2433949b3e831dcf3cf580 Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Tue, 22 Mar 2022 10:49:03 +0100 Subject: [PATCH 310/610] FIX: propal list: missing not signed massaction translation keys for transifex --- htdocs/langs/en_US/propal.lang | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/langs/en_US/propal.lang b/htdocs/langs/en_US/propal.lang index edbc08236d3..86ee94ceee3 100644 --- a/htdocs/langs/en_US/propal.lang +++ b/htdocs/langs/en_US/propal.lang @@ -85,6 +85,11 @@ ProposalCustomerSignature=Written acceptance, company stamp, date and signature ProposalsStatisticsSuppliers=Vendor proposals statistics CaseFollowedBy=Case followed by SignedOnly=Signed only +NoSign=Set not signed +NoSigned=set not signed +CantBeSign=cannot be set not signed +ConfirmMassNoSignature=Bulk Not signed confirmation +ConfirmMassNoSignatureQuestion=Are you sure you want to set not signed the selected records ? IdProposal=Proposal ID IdProduct=Product ID PrParentLine=Proposal Parent Line From 00fab67225ff883d1dcd67bf7eaade04a7fab849 Mon Sep 17 00:00:00 2001 From: GregM Date: Tue, 22 Mar 2022 10:52:58 +0100 Subject: [PATCH 311/610] add & --- htdocs/delivery/card.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/delivery/card.php b/htdocs/delivery/card.php index 5b413459445..b699e044c84 100644 --- a/htdocs/delivery/card.php +++ b/htdocs/delivery/card.php @@ -649,15 +649,15 @@ if ($action == 'create') { // Create. Seems to no be used if ($object->statut == 0 && $num_prod > 0) { if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->expedition->delivery->creer)) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->expedition->delivery_advance->validate))) { - print dolGetButtonAction('', $langs->trans('Validate'), 'default', $_SERVER["PHP_SELF"].'?action=valid&token='.newToken().'&id='.$object->id, ''); + print dolGetButtonAction('', $langs->trans('Validate'), 'default', $_SERVER["PHP_SELF"].'?action=valid&token='.newToken().'&id='.$object->id, ''); } } if ($user->rights->expedition->delivery->supprimer) { if ($conf->expedition_bon->enabled) { - print dolGetButtonAction('', $langs->trans('Delete'), 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&expid='.$object->origin_id.'&action=delete&token='.newToken().'&backtopage='.urlencode(DOL_URL_ROOT.'/expedition/card.php?id='.$object->origin_id), ''); + print dolGetButtonAction('', $langs->trans('Delete'), 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&expid='.$object->origin_id.'&action=delete&token='.newToken().'&backtopage='.urlencode(DOL_URL_ROOT.'/expedition/card.php?id='.$object->origin_id), ''); } else { - print dolGetButtonAction('', $langs->trans('Delete'), 'delete', $_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$object->id, ''); + print dolGetButtonAction('', $langs->trans('Delete'), 'delete', $_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$object->id, ''); } } From 3aae8cc3bbc10f5f07333e54f3b7430146808a4b Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Tue, 22 Mar 2022 10:54:04 +0100 Subject: [PATCH 312/610] FIX: propal list: bad error management for set not ssigned mass action --- htdocs/comm/propal/list.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 3e467539c88..16a754a61bb 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -405,27 +405,28 @@ if ($action == "sign" && $permissiontoclose) { } } } + if ($action == "nosign" && $permissiontoclose) { if (GETPOST('confirm') == 'yes') { $tmpproposal = new Propal($db); $db->begin(); $error = 0; foreach ($toselect as $checked) { - if ($tmpproposal->fetch($checked)) { + if ($tmpproposal->fetch($checked) > 0) { if ($tmpproposal->statut == $tmpproposal::STATUS_VALIDATED) { $tmpproposal->statut = $tmpproposal::STATUS_NOTSIGNED; - if ($tmpproposal->closeProposal($user, $tmpproposal::STATUS_NOTSIGNED)) { + if ($tmpproposal->closeProposal($user, $tmpproposal::STATUS_NOTSIGNED) > 0) { setEventMessage($tmpproposal->ref." ".$langs->trans('NoSigned'), 'mesgs'); } else { - dol_print_error($db); + setEventMessages($tmpproposal->error, $tmpproposal->errors, 'errors'); $error++; } } else { - setEventMessage($tmpproposal->ref." ".$langs->trans('CantBeClosed'), 'errors'); + setEventMessage($tmpproposal->ref." ".$langs->trans('CantBeNoSign'), 'errors'); $error++; } } else { - dol_print_error($db); + setEventMessages($tmpproposal->error, $tmpproposal->errors, 'errors'); $error++; } } From 5914f2ac65622478c06d6f396e601e0a8c365f90 Mon Sep 17 00:00:00 2001 From: lvessiller Date: Tue, 22 Mar 2022 11:17:27 +0100 Subject: [PATCH 313/610] FIX include discount price for PMP after a reception (Issue #20029) --- htdocs/reception/class/reception.class.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index ef12d844ddc..2b458f9d57c 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -554,7 +554,7 @@ class Reception extends CommonObject // Loop on each product line to add a stock movement // TODO in future, reception lines may not be linked to order line - $sql = "SELECT cd.fk_product, cd.subprice,"; + $sql = "SELECT cd.fk_product, cd.subprice, cd.remise_percent,"; $sql .= " ed.rowid, ed.qty, ed.fk_entrepot,"; $sql .= " ed.eatby, ed.sellby, ed.batch"; $sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as cd,"; @@ -580,12 +580,18 @@ class Reception extends CommonObject $mouvS = new MouvementStock($this->db); $mouvS->origin = &$this; + // get unit price with discount + $up_ht_disc = $obj->subprice; + if (!empty($obj->remise_percent) && empty($conf->global->STOCK_EXCLUDE_DISCOUNT_FOR_PMP)) { + $up_ht_disc = price2num($up_ht_disc * (100 - $obj->remise_percent) / 100, 'MU'); + } + if (empty($obj->batch)) { // line without batch detail // We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record. - $result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ReceptionValidatedInDolibarr", $numref)); + $result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $qty, $up_ht_disc, $langs->trans("ReceptionValidatedInDolibarr", $numref)); if ($result < 0) { $error++; $this->errors[] = $mouvS->error; @@ -597,7 +603,7 @@ class Reception extends CommonObject // We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record. // Note: ->fk_origin_stock = id into table llx_product_batch (may be rename into llx_product_stock_batch in another version) - $result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ReceptionValidatedInDolibarr", $numref), $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch); + $result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $qty, $up_ht_disc, $langs->trans("ReceptionValidatedInDolibarr", $numref), $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch); if ($result < 0) { $error++; $this->errors[] = $mouvS->error; From 344c29ae151fa0c7cb1ba865802c4ce1a69966f7 Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Tue, 22 Mar 2022 11:35:37 +0100 Subject: [PATCH 314/610] FIX: trans --- htdocs/langs/en_US/propal.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/propal.lang b/htdocs/langs/en_US/propal.lang index 86ee94ceee3..c7332005f86 100644 --- a/htdocs/langs/en_US/propal.lang +++ b/htdocs/langs/en_US/propal.lang @@ -87,7 +87,7 @@ CaseFollowedBy=Case followed by SignedOnly=Signed only NoSign=Set not signed NoSigned=set not signed -CantBeSign=cannot be set not signed +CantBeNoSign=cannot be set not signed ConfirmMassNoSignature=Bulk Not signed confirmation ConfirmMassNoSignatureQuestion=Are you sure you want to set not signed the selected records ? IdProposal=Proposal ID From 02e2f9815def4051bfbd4350c72e7331937089a8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 22 Mar 2022 11:47:25 +0100 Subject: [PATCH 315/610] NEW Add option INVOICEREC_SET_AUTOFILL_DATE_START/END --- htdocs/compta/facture/card-rec.php | 24 +++--- htdocs/compta/facture/card.php | 1 - .../facture/class/facture-rec.class.php | 13 ++-- htdocs/core/customreports.php | 75 +++++++++++++------ htdocs/core/tpl/objectline_title.tpl.php | 4 +- htdocs/core/tpl/objectline_view.tpl.php | 15 +++- 6 files changed, 90 insertions(+), 42 deletions(-) diff --git a/htdocs/compta/facture/card-rec.php b/htdocs/compta/facture/card-rec.php index 1266232a46e..6116db707e2 100644 --- a/htdocs/compta/facture/card-rec.php +++ b/htdocs/compta/facture/card-rec.php @@ -208,6 +208,9 @@ if (empty($reshook)) { $object->model_pdf = GETPOST('modelpdf', 'alpha'); $object->usenewprice = GETPOST('usenewprice', 'alpha'); + $object->mode_reglement_id = GETPOST('mode_reglement_id', 'int'); + $object->cond_reglement_id = GETPOST('cond_reglement_id', 'int'); + $object->frequency = $frequency; $object->unit_frequency = GETPOST('unit_frequency', 'alpha'); $object->nb_gen_max = $nb_gen_max; @@ -261,8 +264,6 @@ if (empty($reshook)) { } else { $db->rollback(); - $error++; - setEventMessages($object->error, $object->errors, 'errors'); $action = "create"; } } @@ -1027,12 +1028,14 @@ if ($action == 'create') { // Payment term print "".$langs->trans("PaymentConditions").""; - $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->cond_reglement_id, 'none'); + print $form->getSelectConditionsPaiements(GETPOSTISSET('cond_reglement_id') ? GETPOST('cond_reglement_id', 'int') : $object->cond_reglement_id, 'cond_reglement_id', -1, 0, 0, ''); + //$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->cond_reglement_id, 'cond_reglement_id'); print ""; // Payment mode print "".$langs->trans("PaymentMode").""; - $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'none', '', 1); + print $form->select_types_paiements(GETPOSTISSET('mode_reglement_id') ? GETPOST('mode_reglement_id', 'int') : $object->mode_reglement_id, 'mode_reglement_id', '', 0, 1, 0, 0, 1, '', 1); + //$form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'mode_reglement_id', '', 1); print ""; // Project @@ -1040,8 +1043,9 @@ if ($action == 'create') { $projectid = GETPOST('projectid') ?GETPOST('projectid') : $object->fk_project; $langs->load('projects'); print ''.$langs->trans('Project').''; + print img_picto('', 'project'); $numprojet = $formproject->select_projects($object->thirdparty->id, $projectid, 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 0, 0, ''); - print '   thirdparty->id.(!empty($id) ? '&id='.$id : '')).'">'.$langs->trans("AddProject").''; + print '   thirdparty->id.(!empty($id) ? '&id='.$id : '')).'">'.img_object($langs->trans("AddProject"), 'add').''; print ''; } @@ -1074,7 +1078,8 @@ if ($action == 'create') { // Frequency + unit print ''.$form->textwithpicto($langs->trans("Frequency"), $langs->transnoentitiesnoconv('toolTipFrequency')).""; - print " ".$form->selectarray('unit_frequency', array('d'=>$langs->trans('Day'), 'm'=>$langs->trans('Month'), 'y'=>$langs->trans('Year')), (GETPOST('unit_frequency') ?GETPOST('unit_frequency') : 'm')); + print " "; + print $form->selectarray('unit_frequency', array('d'=>$langs->trans('Day'), 'm'=>$langs->trans('Month'), 'y'=>$langs->trans('Year')), (GETPOST('unit_frequency') ?GETPOST('unit_frequency') : 'm')); print ""; // Date next run @@ -1474,15 +1479,16 @@ if ($action == 'create') { print ''; print ''; print ''; - print ''; + print ''; print '
'; - print " ".$form->selectarray('unit_frequency', array('d'=>$langs->trans('Day'), 'm'=>$langs->trans('Month'), 'y'=>$langs->trans('Year')), ($object->unit_frequency ? $object->unit_frequency : 'm')); + print " "; + print $form->selectarray('unit_frequency', array('d'=>$langs->trans('Day'), 'm'=>$langs->trans('Month'), 'y'=>$langs->trans('Year')), ($object->unit_frequency ? $object->unit_frequency : 'm')); print '
'; } else { if ($object->frequency > 0) { print $langs->trans('FrequencyPer_'.$object->unit_frequency, $object->frequency); } else { - print $langs->trans("NotARecurringInvoiceTemplate"); + print ''.$langs->trans("NotARecurringInvoiceTemplate").''; } } print ''; diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 2bfbe368aa8..4b78f22ceac 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -3857,7 +3857,6 @@ if ($action == 'create') { print "\n"; } elseif ($id > 0 || !empty($ref)) { if (empty($object->id)) { - llxHeader(); $langs->load('errors'); echo '
'.$langs->trans("ErrorRecordNotFound").'
'; llxFooter(); diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index ae264f7a813..6d61316f168 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -309,10 +309,10 @@ class FactureRec extends CommonInvoice $sql .= ", ".(!empty($this->note_public) ? ("'".$this->db->escape($this->note_public)."'") : "NULL"); $sql .= ", ".(!empty($this->model_pdf) ? ("'".$this->db->escape($this->model_pdf)."'") : "NULL"); $sql .= ", ".((int) $user->id); - $sql .= ", ".(!empty($facsrc->fk_project) ? ((int) $facsrc->fk_project) : "null"); + $sql .= ", ".(!empty($this->fk_project) ? ((int) $this->fk_project) : "null"); $sql .= ", ".(!empty($facsrc->fk_account) ? ((int) $facsrc->fk_account) : "null"); - $sql .= ", ".($facsrc->cond_reglement_id > 0 ? ((int) $facsrc->cond_reglement_id) : "null"); - $sql .= ", ".($facsrc->mode_reglement_id > 0 ? ((int) $facsrc->mode_reglement_id) : "null"); + $sql .= ", ".($this->cond_reglement_id > 0 ? ((int) $this->cond_reglement_id) : "null"); + $sql .= ", ".($this->mode_reglement_id > 0 ? ((int) $this->mode_reglement_id) : "null"); $sql .= ", ".((int) $this->usenewprice); $sql .= ", ".((int) $this->frequency); $sql .= ", '".$this->db->escape($this->unit_frequency)."'"; @@ -344,6 +344,9 @@ class FactureRec extends CommonInvoice $tva_tx .= ' ('.$facsrc->lines[$i]->vat_src_code.')'; } + $default_start_fill = getDolGlobalInt('INVOICEREC_SET_AUTOFILL_DATE_START'); + $default_end_fill = getDolGlobalInt('INVOICEREC_SET_AUTOFILL_DATE_END'); + $result_insert = $this->addline( $facsrc->lines[$i]->desc, $facsrc->lines[$i]->subprice, @@ -363,8 +366,8 @@ class FactureRec extends CommonInvoice $facsrc->lines[$i]->label, $facsrc->lines[$i]->fk_unit, $facsrc->lines[$i]->multicurrency_subprice, - 0, - 0, + $default_start_fill, + $default_end_fill, null, $facsrc->lines[$i]->pa_ht ); diff --git a/htdocs/core/customreports.php b/htdocs/core/customreports.php index ec0ce330dc4..f208baee872 100644 --- a/htdocs/core/customreports.php +++ b/htdocs/core/customreports.php @@ -212,6 +212,28 @@ if (!defined('USE_CUSTOM_REPORT_AS_INCLUDE')) { print dol_get_fiche_head($head, 'customreports', $title, -1, $picto); } +$newarrayoftype = array(); +foreach ($arrayoftype as $key => $val) { + if (dol_eval($val['enabled'], 1, 1, '1')) { + $newarrayoftype[$key] = $arrayoftype[$key]; + } + if ($val['langs']) { + $langs->load($val['langs']); + } +} + +$count = 0; +$arrayofmesures = fillArrayOfMeasures($object, 't', $langs->trans($newarrayoftype[$objecttype]['label']), $arrayofmesures, 0, $count); + +$count = 0; +$arrayofxaxis = fillArrayOfXAxis($object, 't', $langs->trans($newarrayoftype[$objecttype]['label']), $arrayofxaxis, 0, $count); +$arrayofxaxis = dol_sort_array($arrayofxaxis, 'position', 'asc', 0, 0, 1); + +$count = 0; +$arrayofgroupby = fillArrayOfGroupBy($object, 't', $langs->trans($newarrayoftype[$objecttype]['label']), $arrayofgroupby, 0, $count); +$arrayofgroupby = dol_sort_array($arrayofgroupby, 'position', 'asc', 0, 0, 1); + + // Check parameters if ($action == 'viewgraph') { if (!count($search_measures)) { @@ -252,6 +274,8 @@ if (is_array($search_groupby) && count($search_groupby)) { $fieldtocount = $search_groupby[$gkey]; } + var_dump($fieldtocount); + var_dump($arrayofgroupby); $sql = "SELECT DISTINCT ".$fieldtocount." as val"; if (strpos($fieldtocount, 'te.') === 0) { $sql .= ' FROM '.MAIN_DB_PREFIX.$object->table_element.'_extrafields as te'; @@ -380,15 +404,6 @@ print '
'; // Select object print '
'; print '
'.$langs->trans("StatisticsOn").'
'; -$newarrayoftype = array(); -foreach ($arrayoftype as $key => $val) { - if (dol_eval($val['enabled'], 1, 1, '1')) { - $newarrayoftype[$key] = $arrayoftype[$key]; - } - if ($val['langs']) { - $langs->load($val['langs']); - } -} print $form->selectarray('objecttype', $newarrayoftype, $objecttype, 0, 0, 0, '', 1, 0, 0, '', 'minwidth200', 1); if (empty($conf->use_javascript_ajax)) { print ''; @@ -412,7 +427,6 @@ print '
'; // Add measures into array $count = 0; -$arrayofmesures = fillArrayOfMeasures($object, 't', $langs->trans($newarrayoftype[$objecttype]['label']), $arrayofmesures, 0, $count); //var_dump($arrayofmesures); print '
'; print '
'; @@ -421,8 +435,6 @@ print '
'; // XAxis $count = 0; -$arrayofxaxis = fillArrayOfXAxis($object, 't', $langs->trans($newarrayoftype[$objecttype]['label']), $arrayofxaxis, 0, $count); -$arrayofxaxis = dol_sort_array($arrayofxaxis, 'position', 'asc', 0, 0, 1); print '
'; print '
'; //var_dump($arrayofxaxis); @@ -431,8 +443,6 @@ print '
'; // Group by $count = 0; -$arrayofgroupby = fillArrayOfGroupBy($object, 't', $langs->trans($newarrayoftype[$objecttype]['label']), $arrayofgroupby, 0, $count); -$arrayofgroupby = dol_sort_array($arrayofgroupby, 'position', 'asc', 0, 0, 1); print '
'; print '
'; print $formother->selectGroupByField($object, $search_groupby, $arrayofgroupby, 'minwidth200 maxwidth250', $langs->trans("GroupBy")); // Fill the array $arrayofgroupby with possible fields @@ -1100,14 +1110,31 @@ function fillArrayOfGroupBy($object, $tablealias, $labelofobject, &$arrayofgroup continue; } if (in_array($val['type'], array('timestamp', 'date', 'datetime'))) { - $arrayofgroupby[$tablealias.'.'.$key.'-year'] = array('label' => img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' ('.$YYYY.')', 'position' => ($val['position']+($count * 100000)).'.1'); - $arrayofgroupby[$tablealias.'.'.$key.'-month'] = array('label' => img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' ('.$YYYY.'-'.$MM.')', 'position' => ($val['position']+($count * 100000)).'.2'); - $arrayofgroupby[$tablealias.'.'.$key.'-day'] = array('label' => img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' ('.$YYYY.'-'.$MM.'-'.$DD.')', 'position' => ($val['position']+($count * 100000)).'.3'); + $arrayofgroupby[$tablealias.'.'.$key.'-year'] = array( + 'label' => img_picto('', $object->picto, + 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' ('.$YYYY.')', 'position' => ($val['position']+($count * 100000)).'.1', + 'table' => $object->table_element + ); + $arrayofgroupby[$tablealias.'.'.$key.'-month'] = array( + 'label' => img_picto('', $object->picto, + 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' ('.$YYYY.'-'.$MM.')', 'position' => ($val['position']+($count * 100000)).'.2', + 'table' => $object->table_element + ); + $arrayofgroupby[$tablealias.'.'.$key.'-day'] = array( + 'label' => img_picto('', $object->picto, + 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' ('.$YYYY.'-'.$MM.'-'.$DD.')', 'position' => ($val['position']+($count * 100000)).'.3', + 'table' => $object->table_element + ); } else { - $arrayofgroupby[$tablealias.'.'.$key] = array('label' => img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']), 'position' => ($val['position']+($count * 100000))); + $arrayofgroupby[$tablealias.'.'.$key] = array( + 'label' => img_picto('', $object->picto, + 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']), 'position' => ($val['position']+($count * 100000)), + 'table' => $object->table_element + ); } } } + // Add extrafields to Group by if ($object->isextrafieldmanaged) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { @@ -1117,9 +1144,14 @@ function fillArrayOfGroupBy($object, $tablealias, $labelofobject, &$arrayofgroup if (!empty($extrafields->attributes[$object->table_element]['totalizable'][$key])) { continue; } - $arrayofgroupby[$tablealias.'e.'.$key] = array('label' => img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($extrafields->attributes[$object->table_element]['label'][$key]), 'position' => 1000 + (int) $extrafields->attributes[$object->table_element]['pos'][$key] + ($count * 100000)); + $arrayofgroupby[$tablealias.'e.'.$key] = array( + 'label' => img_picto('', $object->picto, + 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($extrafields->attributes[$object->table_element]['label'][$key]), 'position' => 1000 + (int) $extrafields->attributes[$object->table_element]['pos'][$key] + ($count * 100000), + 'table' => $object->table_element + ); } } + // Add fields for parent objects foreach ($object->fields as $key => $val) { if (preg_match('/^[^:]+:[^:]+:/', $val['type'])) { @@ -1129,10 +1161,7 @@ function fillArrayOfGroupBy($object, $tablealias, $labelofobject, &$arrayofgroup dol_include_once($tmptype[2]); if (class_exists($newobject)) { $tmpobject = new $newobject($db); - /*var_dump($val['label']); - var_dump($tmptype); - var_dump($arrayofmesures); - var_dump('t-'.$key);*/ + //var_dump($key); var_dump($tmpobject->element); var_dump($val['label']); var_dump($tmptype); var_dump('t-'.$key); $count++; $arrayofgroupby = fillArrayOfGroupBy($tmpobject, $tablealias.'__'.$key, $langs->trans($val['label']), $arrayofgroupby, $level + 1, $count); } else { diff --git a/htdocs/core/tpl/objectline_title.tpl.php b/htdocs/core/tpl/objectline_title.tpl.php index c40f07716f2..e8dbec2ac77 100644 --- a/htdocs/core/tpl/objectline_title.tpl.php +++ b/htdocs/core/tpl/objectline_title.tpl.php @@ -71,7 +71,9 @@ if (!empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) || !empty($conf->global->FA if (in_array($object->element, array('propal', 'commande', 'facture')) && $object->status == $object::STATUS_DRAFT) { global $mysoc; - print 'id.'">'.img_edit($langs->trans("UpdateForAllLines"), 0, 'class="clickvatforalllines opacitymedium paddingleft cursorpointer"').''; + if (empty($disableedit)) { + print 'id.'">'.img_edit($langs->trans("UpdateForAllLines"), 0, 'class="clickvatforalllines opacitymedium paddingleft cursorpointer"').''; + } //print ''; if (GETPOST('mode', 'aZ09') == 'vatforalllines') { print '
'; diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index e8316392043..c2d81b81eb5 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -172,13 +172,13 @@ if (($line->info_bits & 2) == 2) { print '
'; } if ($line->date_start_fill) { - print ''.$langs->trans('AutoFillDateFromShort').': '.yn($line->date_start_fill); + print ''.$langs->trans('AutoFillDateFromShort').': '.yn($line->date_start_fill); } if ($line->date_start_fill && $line->date_end_fill) { print ' - '; } if ($line->date_end_fill) { - print ''.$langs->trans('AutoFillDateToShort').': '.yn($line->date_end_fill); + print ''.$langs->trans('AutoFillDateToShort').': '.yn($line->date_end_fill); } if ($line->date_start_fill || $line->date_end_fill) { print '
'; @@ -200,7 +200,16 @@ if (($line->info_bits & 2) == 2) { } } - //print get_date_range($line->date_start, $line->date_end, $format); + // If we show the lines in a context to create a recurring sale invoice + if (basename($_SERVER["PHP_SELF"]) == 'card-rec.php') { + $default_start_fill = getDolGlobalInt('INVOICEREC_SET_AUTOFILL_DATE_START'); + $default_end_fill = getDolGlobalInt('INVOICEREC_SET_AUTOFILL_DATE_END'); + print '
'; + print ''.$langs->trans('AutoFillDateFromShort').': '.yn($default_start_fill); + print ' - '; + print ''.$langs->trans('AutoFillDateToShort').': '.yn($default_end_fill); + print '
'; + } } // Add description in form From 4fb62ee15adcdfcfc3bfcfbd5b143b246080845e Mon Sep 17 00:00:00 2001 From: GregM Date: Tue, 22 Mar 2022 12:04:51 +0100 Subject: [PATCH 316/610] replacing to dolGetButtonAction on Commande card --- htdocs/commande/card.php | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 471363f74ec..e8f88800693 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -2520,27 +2520,27 @@ if ($action == 'create' && $usercancreate) { if (empty($reshook)) { // Reopen a closed order if (($object->statut == Commande::STATUS_CLOSED || $object->statut == Commande::STATUS_CANCELED) && $usercancreate) { - print ''.$langs->trans('ReOpen').''; + print dolGetButtonAction('', $langs->trans('ReOpen'), 'default', $_SERVER["PHP_SELF"].'?action=reopen&token='.newToken().'&id='.$object->id, ''); } // Send if (empty($user->socid)) { if ($object->statut > Commande::STATUS_DRAFT || !empty($conf->global->COMMANDE_SENDBYEMAIL_FOR_ALL_STATUS)) { if ($usercansend) { - print ''.$langs->trans('SendMail').''; + print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"].'?action=presend&token='.newToken().'&id='.$object->id.'&mode=init#formmailbeforetitle', ''); } else { - print ''.$langs->trans('SendMail').''; + print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER['PHP_SELF']. '#', '', false); } } } // Valid if ($object->statut == Commande::STATUS_DRAFT && ($object->total_ttc >= 0 || !empty($conf->global->ORDER_ENABLE_NEGATIVE)) && $numlines > 0 && $usercanvalidate) { - print ''.$langs->trans('Validate').''; + print dolGetButtonAction('', $langs->trans('Validate'), 'default', $_SERVER["PHP_SELF"].'?action=validate&token='.newToken().'&id='.$object->id, ''); } // Edit if ($object->statut == Commande::STATUS_VALIDATED && $usercancreate) { - print ''.$langs->trans('Modify').''; + print dolGetButtonAction('', $langs->trans('Modify'), 'default', $_SERVER["PHP_SELF"].'?action=modif&token='.newToken().'&id='.$object->id, ''); } // Create event /*if ($conf->agenda->enabled && ! empty($conf->global->MAIN_ADD_EVENT_ON_ELEMENT_CARD)) @@ -2555,7 +2555,7 @@ if ($action == 'create' && $usercancreate) { if (!empty($conf->global->WORKFLOW_CAN_CREATE_PURCHASE_ORDER_FROM_SALE_ORDER)) { if (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled)) && $object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && $object->getNbOfServicesLines() > 0) { if ($usercancreatepurchaseorder) { - print ''.$langs->trans("AddPurchaseOrder").''; + print dolGetButtonAction('', $langs->trans('AddPurchaseOrder'), 'default', DOL_URL_ROOT.'/fourn/commande/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid, ''); } } } @@ -2566,9 +2566,9 @@ if ($action == 'create' && $usercancreate) { if ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && $object->getNbOfServicesLines() > 0) { if ($user->rights->ficheinter->creer) { - print ''.$langs->trans('AddIntervention').''; + print dolGetButtonAction('', $langs->trans('AddInterventionGR'), 'default', DOL_URL_ROOT.'/fichinter/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid, ''); } else { - print ''.$langs->trans('AddIntervention').''; + print dolGetButtonAction($langs->trans('NotAllowed'), $langs->trans('AddIntervention'), 'default', $_SERVER['PHP_SELF']. '#', '', false); } } } @@ -2578,7 +2578,7 @@ if ($action == 'create' && $usercancreate) { $langs->load("contracts"); if ($user->rights->contrat->creer) { - print ''.$langs->trans('AddContract').''; + print dolGetButtonAction('', $langs->trans('AddContract'), 'default', DOL_URL_ROOT.'/contrat/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid, ''); } } @@ -2590,52 +2590,52 @@ if ($action == 'create' && $usercancreate) { if ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && ($object->getNbOfProductsLines() > 0 || !empty($conf->global->STOCK_SUPPORTS_SERVICES))) { if (($conf->expedition_bon->enabled && $user->rights->expedition->creer) || ($conf->delivery_note->enabled && $user->rights->expedition->delivery->creer)) { if ($user->rights->expedition->creer) { - print ''.$langs->trans('CreateShipment').''; + print dolGetButtonAction('', $langs->trans('CreateShipment'), 'default', DOL_URL_ROOT.'/expedition/shipment.php?id='.$object->id, ''); } else { - print ''.$langs->trans('CreateShipment').''; + print dolGetButtonAction($langs->trans('NotAllowed'), $langs->trans('CreateShipment'), 'default', $_SERVER['PHP_SELF']. '#', '', false); } } else { $langs->load("errors"); - print 'transnoentitiesnoconv("Shipment"))).'">'.$langs->trans('CreateShipment').''; + print dolGetButtonAction($langs->trans('ErrorModuleSetupNotComplete'), $langs->trans('CreateShipment'), 'default', $_SERVER['PHP_SELF']. '#', '', false); } } } // Set to shipped if (($object->statut == Commande::STATUS_VALIDATED || $object->statut == Commande::STATUS_SHIPMENTONPROCESS) && $usercanclose) { - print ''.$langs->trans('ClassifyShipped').''; + print dolGetButtonAction('', $langs->trans('ClassifyShipped'), 'default', $_SERVER["PHP_SELF"].'?action=shipped&token='.newToken().'&id='.$object->id, ''); } // Create bill and Classify billed // Note: Even if module invoice is not enabled, we should be able to use button "Classified billed" if ($object->statut > Commande::STATUS_DRAFT && !$object->billed && $object->total_ttc >= 0) { if (!empty($conf->facture->enabled) && $user->rights->facture->creer && empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) { - print ''.$langs->trans("CreateBill").''; + print dolGetButtonAction('', $langs->trans('CreateBill'), 'default', DOL_URL_ROOT.'/compta/facture/card.php?action=create&token='.newToken().'&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid, ''); } if ($usercancreate && $object->statut >= Commande::STATUS_VALIDATED && empty($conf->global->WORKFLOW_DISABLE_CLASSIFY_BILLED_FROM_ORDER) && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)) { - print ''.$langs->trans("ClassifyBilled").''; + print dolGetButtonAction('', $langs->trans('ClassifyBilled'), 'default', $_SERVER["PHP_SELF"].'?action=classifybilled&token='.newToken().'&id='.$object->id, ''); } } if ($object->statut > Commande::STATUS_DRAFT && $object->billed) { if ($usercancreate && $object->statut >= Commande::STATUS_VALIDATED && empty($conf->global->WORKFLOW_DISABLE_CLASSIFY_BILLED_FROM_ORDER) && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)) { - print ''.$langs->trans("ClassifyUnBilled").''; + print dolGetButtonAction('', $langs->trans('ClassifyUnBilled'), 'default', $_SERVER["PHP_SELF"].'?action=classifyunbilled&token='.newToken().'&id='.$object->id, ''); } } // Clone if ($usercancreate) { - print ''.$langs->trans("ToClone").''; + print dolGetButtonAction('', $langs->trans('ToClone'), 'default', $_SERVER["PHP_SELF"].'?action=clone&token='.newToken().'&id='.$object->id.'&socid='.$object->socid, ''); } // Cancel order if ($object->statut == Commande::STATUS_VALIDATED && (!empty($usercanclose) || !empty($usercancancel))) { - print ''.$langs->trans("Cancel").''; + print dolGetButtonAction('', $langs->trans('Cancel'), 'danger', $_SERVER["PHP_SELF"].'?action=cancel&token='.newToken().'&id='.$object->id, ''); } // Delete order if ($usercandelete) { if ($numshipping == 0) { - print ''.$langs->trans('Delete').''; + print dolGetButtonAction('', $langs->trans('Delete'), 'delete', $_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$object->id, ''); } else { - print ''.$langs->trans("Delete").''; + print dolGetButtonAction($langs->trans('ShippingExist'), $langs->trans('Delete'), 'default', $_SERVER['PHP_SELF']. '#', '', false); } } } From ca3a4839e5fdd4ae74802e58ccfed4ad2990868e Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 22 Mar 2022 12:06:37 +0100 Subject: [PATCH 317/610] FIX try to fix CodingPhpTest::testPHP error --- htdocs/core/customreports.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/customreports.php b/htdocs/core/customreports.php index ec0ce330dc4..df7ff549bbb 100644 --- a/htdocs/core/customreports.php +++ b/htdocs/core/customreports.php @@ -565,7 +565,7 @@ if (!empty($search_measures) && !empty($search_xaxis)) { $tmpval = explode('.', $val); //var_dump($arrayofxaxis[$val]['table']); if (! in_array($arrayofxaxis[$val]['table'], $listoftablesalreadyadded)) { // We do not add join for main table already added - $sql .= ' INNER JOIN '.MAIN_DB_PREFIX.$arrayofxaxis[$val]['table'].' as '.$tmpval[0]; + $sql .= ' INNER JOIN '.MAIN_DB_PREFIX.$arrayofxaxis[$val]['table'].' as '.$db->escape($tmpval[0]); $listoftablesalreadyadded[$arrayofxaxis[$val]['table']] = $arrayofxaxis[$val]['table']; } } else { From 5adcdd6b4e9715189a2a40b70ba70c3e55b1df0a Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 22 Mar 2022 12:27:36 +0100 Subject: [PATCH 318/610] FIX use sanitize instead escape --- htdocs/core/customreports.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/customreports.php b/htdocs/core/customreports.php index df7ff549bbb..b640df8768f 100644 --- a/htdocs/core/customreports.php +++ b/htdocs/core/customreports.php @@ -565,7 +565,7 @@ if (!empty($search_measures) && !empty($search_xaxis)) { $tmpval = explode('.', $val); //var_dump($arrayofxaxis[$val]['table']); if (! in_array($arrayofxaxis[$val]['table'], $listoftablesalreadyadded)) { // We do not add join for main table already added - $sql .= ' INNER JOIN '.MAIN_DB_PREFIX.$arrayofxaxis[$val]['table'].' as '.$db->escape($tmpval[0]); + $sql .= ' INNER JOIN '.MAIN_DB_PREFIX.$arrayofxaxis[$val]['table'].' as '.$db->sanitize($tmpval[0]); $listoftablesalreadyadded[$arrayofxaxis[$val]['table']] = $arrayofxaxis[$val]['table']; } } else { From 8686e37fa9e4c21903033c517308f4ad44257fbb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 22 Mar 2022 13:23:16 +0100 Subject: [PATCH 319/610] Work on generic report. --- htdocs/contrat/class/contrat.class.php | 10 +- htdocs/core/customreports.php | 193 +++++++++++++++++++------ 2 files changed, 154 insertions(+), 49 deletions(-) diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index c9341d23ee3..1a31e478f56 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -233,10 +233,10 @@ class Contrat extends CommonObject 'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>40), 'date_contrat' =>array('type'=>'datetime', 'label'=>'Date contrat', 'enabled'=>1, 'visible'=>-1, 'position'=>45), 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>70), - 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>1, 'visible'=>-1, 'position'=>75), - 'fk_commercial_signature' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk commercial signature', 'enabled'=>1, 'visible'=>-1, 'position'=>80), - 'fk_commercial_suivi' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk commercial suivi', 'enabled'=>1, 'visible'=>-1, 'position'=>85), - 'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user author', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>90), + 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>1, 'visible'=>-1, 'position'=>75), + 'fk_commercial_signature' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'SaleRepresentative Signature', 'enabled'=>1, 'visible'=>-1, 'position'=>80), + 'fk_commercial_suivi' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'SaleRepresentative follower', 'enabled'=>1, 'visible'=>-1, 'position'=>85), + 'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>90), 'note_private' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>105), 'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>110), 'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>115), @@ -245,7 +245,7 @@ class Contrat extends CommonObject 'ref_customer' =>array('type'=>'varchar(50)', 'label'=>'Ref customer', 'enabled'=>1, 'visible'=>-1, 'position'=>130), 'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>135), 'last_main_doc' =>array('type'=>'varchar(255)', 'label'=>'Last main doc', 'enabled'=>1, 'visible'=>-1, 'position'=>140), - 'statut' =>array('type'=>'smallint(6)', 'label'=>'Statut', 'enabled'=>1, 'visible'=>-1, 'position'=>500, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Validated', 2=>'Closed')) + 'statut' =>array('type'=>'smallint(6)', 'label'=>'Statut', 'enabled'=>1, 'visible'=>-1, 'position'=>500, 'notnull'=>1, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Validated', 2=>'Closed')) ); // END MODULEBUILDER PROPERTIES diff --git a/htdocs/core/customreports.php b/htdocs/core/customreports.php index f208baee872..4ded4498add 100644 --- a/htdocs/core/customreports.php +++ b/htdocs/core/customreports.php @@ -224,6 +224,7 @@ foreach ($arrayoftype as $key => $val) { $count = 0; $arrayofmesures = fillArrayOfMeasures($object, 't', $langs->trans($newarrayoftype[$objecttype]['label']), $arrayofmesures, 0, $count); +$arrayofmesures = dol_sort_array($arrayofmesures, 'position', 'asc', 0, 0, 1); $count = 0; $arrayofxaxis = fillArrayOfXAxis($object, 't', $langs->trans($newarrayoftype[$objecttype]['label']), $arrayofxaxis, 0, $count); @@ -274,13 +275,19 @@ if (is_array($search_groupby) && count($search_groupby)) { $fieldtocount = $search_groupby[$gkey]; } - var_dump($fieldtocount); - var_dump($arrayofgroupby); $sql = "SELECT DISTINCT ".$fieldtocount." as val"; + if (strpos($fieldtocount, 'te.') === 0) { $sql .= ' FROM '.MAIN_DB_PREFIX.$object->table_element.'_extrafields as te'; } else { - $sql .= ' FROM '.MAIN_DB_PREFIX.$object->table_element.' as t'; + $tabletouse = $object->table_element; + $tablealiastouse = 't'; + if (!empty($arrayofgroupby[$gval])) { + $tmpval = explode('.', $gval); + $tabletouse = $arrayofgroupby[$gval]['table']; + $tablealiastouse = $tmpval[0]; + } + $sql .= ' FROM '.MAIN_DB_PREFIX.$tabletouse.' as '.$tablealiastouse; } // Add the where here @@ -343,8 +350,17 @@ if (is_array($search_groupby) && count($search_groupby)) { $arrayofvaluesforgroupby['g_'.$gkey][$keytouse] = $valuetranslated; } + // Add also the possible NULL value if field is a parent field that is not a strict join + $tmpfield = explode('.', $gval); + if ($tmpfield[0] != 't' || (is_array($object->fields[$tmpfield[1]]) && empty($object->fields[$tmpfield[1]]['notnull']))) { + dol_syslog("The group by field ".$gval." may be null (because field is null or it is a left join), so we add __NULL__ entry in list of possible values"); + //var_dump($gval); var_dump($object->fields); + $arrayofvaluesforgroupby['g_'.$gkey]['__NULL__'] = $langs->transnoentitiesnoconv("NotDefined"); + } + asort($arrayofvaluesforgroupby['g_'.$gkey]); + // Add a protection/error to refuse the request if number of differentr values for the group by is higher than $MAXUNIQUEVALFORGROUP if (count($arrayofvaluesforgroupby['g_'.$gkey]) > $MAXUNIQUEVALFORGROUP) { $langs->load("errors"); if (strpos($fieldtocount, 'te.') === 0) { @@ -430,7 +446,11 @@ $count = 0; //var_dump($arrayofmesures); print '
'; print '
'; -print $form->multiselectarray('search_measures', $arrayofmesures, $search_measures, 0, 0, 'minwidth400', 1, 0, '', '', $langs->trans("Measures")); // Fill the array $arrayofmeasures with possible fields +$simplearrayofmesures = array(); +foreach ($arrayofmesures as $key => $val) { + $simplearrayofmesures[$key] = $arrayofmesures[$key]['label']; +} +print $form->multiselectarray('search_measures', $simplearrayofmesures, $search_measures, 0, 0, 'minwidth400', 1, 0, '', '', $langs->trans("Measures")); // Fill the array $arrayofmeasures with possible fields print '
'; // XAxis @@ -464,18 +484,38 @@ if ($mode == 'grid') { continue; } if (in_array($val['type'], array('timestamp', 'date', 'datetime'))) { - $arrayofyaxis['t.'.$key.'-year'] = array('label' => $langs->trans($val['label']).' ('.$YYYY.')', 'position' => $val['position']); - $arrayofyaxis['t.'.$key.'-month'] = array('label' => $langs->trans($val['label']).' ('.$YYYY.'-'.$MM.')', 'position' => $val['position']); - $arrayofyaxis['t.'.$key.'-day'] = array('label' => $langs->trans($val['label']).' ('.$YYYY.'-'.$MM.'-'.$DD.')', 'position' => $val['position']); + $arrayofyaxis['t.'.$key.'-year'] = array( + 'label' => $langs->trans($val['label']).' ('.$YYYY.')', + 'position' => $val['position'], + 'table' => $object->table_element + ); + $arrayofyaxis['t.'.$key.'-month'] = array( + 'label' => $langs->trans($val['label']).' ('.$YYYY.'-'.$MM.')', + 'position' => $val['position'], + 'table' => $object->table_element + ); + $arrayofyaxis['t.'.$key.'-day'] = array( + 'label' => $langs->trans($val['label']).' ('.$YYYY.'-'.$MM.'-'.$DD.')', + 'position' => $val['position'], + 'table' => $object->table_element + ); } else { - $arrayofyaxis['t.'.$key] = array('label' => $val['label'], 'position' => (int) $val['position']); + $arrayofyaxis['t.'.$key] = array( + 'label' => $val['label'], + 'position' => (int) $val['position'], + 'table' => $object->table_element + ); } } // Add measure from extrafields if ($object->isextrafieldmanaged) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { if (!empty($extrafields->attributes[$object->table_element]['totalizable'][$key]) && (!isset($extrafields->attributes[$object->table_element]['enabled'][$key]) || dol_eval($extrafields->attributes[$object->table_element]['enabled'][$key], 1, 1, '1'))) { - $arrayofyaxis['te.'.$key] = array('label' => $extrafields->attributes[$object->table_element]['label'][$key], 'position' => (int) $extrafields->attributes[$object->table_element]['pos'][$key]); + $arrayofyaxis['te.'.$key] = array( + 'label' => $extrafields->attributes[$object->table_element]['label'][$key], + 'position' => (int) $extrafields->attributes[$object->table_element]['pos'][$key], + 'table' => $object->table_element + ); } } } @@ -505,7 +545,7 @@ $sql = ''; if (!empty($search_measures) && !empty($search_xaxis)) { $fieldid = 'rowid'; - $sql = 'SELECT '; + $sql = "SELECT "; foreach ($search_xaxis as $key => $val) { if (preg_match('/\-year$/', $val)) { $tmpval = preg_replace('/\-year$/', '', $val); @@ -552,40 +592,72 @@ if (!empty($search_measures) && !empty($search_xaxis)) { } } $sql = preg_replace('/,\s*$/', '', $sql); - $sql .= ' FROM '.MAIN_DB_PREFIX.$object->table_element.' as t'; + $sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t"; // Add measure from extrafields if ($object->isextrafieldmanaged) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as te ON te.fk_object = t.".$fieldid; } - if ($object->ismultientitymanaged) { + // Add table for link for multientity + if ($object->ismultientitymanaged) { // 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table if ($object->ismultientitymanaged == 1) { - // Nothing here + // No table to add here } else { $tmparray = explode('@', $object->ismultientitymanaged); - $sql .= " INNER JOIN ".MAIN_DB_PREFIX.$tmparray[1]." as parenttable ON t.".$tmparray[0]." = parenttable.rowid"; - $sql .= ' AND parenttable.entity IN ('.getEntity($tmparray[1]).')'; + $sql .= " INNER JOIN ".MAIN_DB_PREFIX.$tmparray[1]." as parenttableforentity ON t.".$tmparray[0]." = parenttableforentity.rowid"; + $sql .= " AND parenttableforentity.entity IN (".getEntity($tmparray[1]).")"; } } - // Add INNER JOIN for all parent tables - //var_dump($arrayofxaxis); var_dump($search_xaxis); $listoftablesalreadyadded = array($object->table_element => $object->table_element); + + // Add LEFT JOIN for all parent tables mentionned into the Xaxis + //var_dump($arrayofxaxis); var_dump($search_xaxis); foreach ($search_xaxis as $key => $val) { if (!empty($arrayofxaxis[$val])) { $tmpval = explode('.', $val); //var_dump($arrayofxaxis[$val]['table']); if (! in_array($arrayofxaxis[$val]['table'], $listoftablesalreadyadded)) { // We do not add join for main table already added - $sql .= ' INNER JOIN '.MAIN_DB_PREFIX.$arrayofxaxis[$val]['table'].' as '.$tmpval[0]; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$arrayofxaxis[$val]['table']." as ".$tmpval[0]." ON t.".str_replace('t__', '', $tmpval[0])." = ".$tmpval[0].".rowid"; $listoftablesalreadyadded[$arrayofxaxis[$val]['table']] = $arrayofxaxis[$val]['table']; } } else { - dol_print_error($db, 'Found an key into search_xaxis not found into arrayofxaxis'); + dol_print_error($db, 'Found a key into search_xaxis not found into arrayofxaxis'); } } - $sql .= ' WHERE 1 = 1'; - if ($object->ismultientitymanaged == 1) { - $sql .= ' AND t.entity IN ('.getEntity($object->element).')'; + // Add LEFT JOIN for all parent tables mentionned into the Group by + //var_dump($arrayofgroupby); var_dump($search_groupby); + foreach ($search_groupby as $key => $val) { + if (!empty($arrayofgroupby[$val])) { + $tmpval = explode('.', $val); + //var_dump($arrayofxaxis[$val]['table']); + if (! in_array($arrayofgroupby[$val]['table'], $listoftablesalreadyadded)) { // We do not add join for main table already added + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$arrayofgroupby[$val]['table']." as ".$tmpval[0]." ON t.".str_replace('t__', '', $tmpval[0])." = ".$tmpval[0].".rowid"; + $listoftablesalreadyadded[$arrayofgroupby[$val]['table']] = $arrayofgroupby[$val]['table']; + } + } else { + dol_print_error($db, 'Found a key into search_groupby not found into arrayofgroupby'); + } + } + + // Add LEFT JOIN for all parent tables mentionned into the Yaxis + //var_dump($arrayofgroupby); var_dump($search_groupby); + foreach ($search_measures as $key => $val) { + if (!empty($arrayofmesures[$val])) { + $tmpval = explode('.', $val); + //var_dump($arrayofxaxis[$val]['table']); + if (! in_array($arrayofmesures[$val]['table'], $listoftablesalreadyadded)) { // We do not add join for main table already added + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$arrayofmesures[$val]['table']." as ".$tmpval[0]." ON t.".str_replace('t__', '', $tmpval[0])." = ".$tmpval[0].".rowid"; + $listoftablesalreadyadded[$arrayofmesures[$val]['table']] = $arrayofmesures[$val]['table']; + } + } else { + dol_print_error($db, 'Found a key into search_measures not found into arrayofmesures'); + } + } + + $sql .= " WHERE 1 = 1"; + if ($object->ismultientitymanaged == 1) { // 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table + $sql .= " AND t.entity IN (".getEntity($object->element).")"; } // Add the where here $sqlfilters = $search_component_params_hidden; @@ -598,7 +670,7 @@ if (!empty($search_measures) && !empty($search_xaxis)) { print $errormessage; } } - $sql .= ' GROUP BY '; + $sql .= " GROUP BY "; foreach ($search_xaxis as $key => $val) { if (preg_match('/\-year$/', $val)) { $tmpval = preg_replace('/\-year$/', '', $val); @@ -663,7 +735,7 @@ if (!empty($search_measures) && !empty($search_xaxis)) { $legend = array(); foreach ($search_measures as $key => $val) { - $legend[] = $langs->trans($arrayofmesures[$val]); + $legend[] = $langs->trans($arrayofmesures[$val]['label']); } $useagroupby = (is_array($search_groupby) && count($search_groupby)); @@ -694,7 +766,7 @@ if ($sql) { if (!empty($object->fields[$xvalwithoutprefix]['arrayofkeyval'])) { $xlabel = $object->fields[$xvalwithoutprefix]['arrayofkeyval'][$obj->$fieldforxkey]; } - $labeltouse = (($xlabel || $xlabel == '0') ? dol_trunc($xlabel, 20, 'middle') : ($xlabel === '' ? $langs->trans("Empty") : $langs->trans("NotDefined"))); + $labeltouse = (($xlabel || $xlabel == '0') ? dol_trunc($xlabel, 20, 'middle') : ($xlabel === '' ? $langs->transnoentitiesnoconv("Empty") : $langs->transnoentitiesnoconv("NotDefined"))); if ($oldlabeltouse && ($labeltouse != $oldlabeltouse)) { $xi++; // Increase $xi @@ -888,26 +960,62 @@ function fillArrayOfMeasures($object, $tablealias, $labelofobject, &$arrayofmesu if ($level == 0) { // Add the count of record only for the main/first level object. Parents are necessarly unique for each record. - $arrayofmesures[$tablealias.'.count'] = img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': Count'; + $arrayofmesures[$tablealias.'.count'] = array( + 'label' => img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': Count', + 'position' => 0, + 'table' => $object->table_element + ); } // Add main fields of object foreach ($object->fields as $key => $val) { if (!empty($val['isameasure']) && (!isset($val['enabled']) || dol_eval($val['enabled'], 1, 1, '1'))) { - $arrayofmesures[$tablealias.'.'.$key.'-sum'] = img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' ('.$langs->trans("Sum").')'; - $arrayofmesures[$tablealias.'.'.$key.'-average'] = img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' ('.$langs->trans("Average").')'; - $arrayofmesures[$tablealias.'.'.$key.'-min'] = img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' ('.$langs->trans("Minimum").')'; - $arrayofmesures[$tablealias.'.'.$key.'-max'] = img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' ('.$langs->trans("Maximum").')'; + $arrayofmesures[$tablealias.'.'.$key.'-sum'] = array( + 'label' => img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' ('.$langs->trans("Sum").')', + 'position' => ($val['position']+($count * 100000)).'.1', + 'table' => $object->table_element + ); + $arrayofmesures[$tablealias.'.'.$key.'-average'] = array( + 'label' => img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' ('.$langs->trans("Average").')', + 'position' => ($val['position']+($count * 100000)).'.2', + 'table' => $object->table_element + ); + $arrayofmesures[$tablealias.'.'.$key.'-min'] = array( + 'label' => img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' ('.$langs->trans("Minimum").')', + 'position' => ($val['position']+($count * 100000)).'.3', + 'table' => $object->table_element + ); + $arrayofmesures[$tablealias.'.'.$key.'-max'] = array( + 'label' => img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' ('.$langs->trans("Maximum").')', + 'position' => ($val['position']+($count * 100000)).'.4', + 'table' => $object->table_element + ); } } // Add extrafields to Measures if ($object->isextrafieldmanaged) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { if (!empty($extrafields->attributes[$object->table_element]['totalizable'][$key]) && (!isset($extrafields->attributes[$object->table_element]['enabled'][$key]) || dol_eval($extrafields->attributes[$object->table_element]['enabled'][$key], 1, 1, '1'))) { - $arrayofmesures[$tablealias.'e.'.$key.'-sum'] = img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($extrafields->attributes[$object->table_element]['label'][$key]).' ('.$langs->trans("Sum").')'; - $arrayofmesures[$tablealias.'e.'.$key.'-average'] = img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($extrafields->attributes[$object->table_element]['label'][$key]).' ('.$langs->trans("Average").')'; - $arrayofmesures[$tablealias.'e.'.$key.'-min'] = img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($extrafields->attributes[$object->table_element]['label'][$key]).' ('.$langs->trans("Minimum").')'; - $arrayofmesures[$tablealias.'e.'.$key.'-max'] = img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($extrafields->attributes[$object->table_element]['label'][$key]).' ('.$langs->trans("Maximum").')'; + $arrayofmesures[$tablealias.'e.'.$key.'-sum'] = array( + 'label' => img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($extrafields->attributes[$object->table_element]['label'][$key]).' ('.$langs->trans("Sum").')', + 'position' => ($val['position']+($count * 100000)).'.1', + 'table' => $object->table_element + ); + $arrayofmesures[$tablealias.'e.'.$key.'-average'] = array( + 'label' => img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($extrafields->attributes[$object->table_element]['label'][$key]).' ('.$langs->trans("Average").')', + 'position' => ($val['position']+($count * 100000)).'.2', + 'table' => $object->table_element + ); + $arrayofmesures[$tablealias.'e.'.$key.'-min'] = array( + 'label' => img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($extrafields->attributes[$object->table_element]['label'][$key]).' ('.$langs->trans("Minimum").')', + 'position' => ($val['position']+($count * 100000)).'.3', + 'table' => $object->table_element + ); + $arrayofmesures[$tablealias.'e.'.$key.'-max'] = array( + 'label' => img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($extrafields->attributes[$object->table_element]['label'][$key]).' ('.$langs->trans("Maximum").')', + 'position' => ($val['position']+($count * 100000)).'.4', + 'table' => $object->table_element + ); } } } @@ -915,19 +1023,16 @@ function fillArrayOfMeasures($object, $tablealias, $labelofobject, &$arrayofmesu foreach ($object->fields as $key => $val) { if (preg_match('/^[^:]+:[^:]+:/', $val['type'])) { $tmptype = explode(':', $val['type'], 4); - if ($tmptype[0] = 'integer' && $tmptype[1] && $tmptype[2]) { + if ($tmptype[0] == 'integer' && $tmptype[1] && $tmptype[2]) { $newobject = $tmptype[1]; dol_include_once($tmptype[2]); if (class_exists($newobject)) { $tmpobject = new $newobject($db); - /*var_dump($val['label']); - var_dump($tmptype); - var_dump($arrayofmesures); - var_dump('t-'.$key);*/ + //var_dump($key); var_dump($tmpobject->element); var_dump($val['label']); var_dump($tmptype); var_dump('t-'.$key); $count++; $arrayofmesures = fillArrayOfMeasures($tmpobject, $tablealias.'__'.$key, $langs->trans($val['label']), $arrayofmesures, $level + 1, $count); } else { - print 'Failed to find '.$newobject.' class for field '.$key.' of object '.$object->element."\n"; + print 'For property '.$object->element.'->'.$key.', type="'.$val['type'].'": Failed to find class '.$newobject." in file ".$tmptype[2]."
\n"; } } } @@ -1037,7 +1142,7 @@ function fillArrayOfXAxis($object, $tablealias, $labelofobject, &$arrayofxaxis, foreach ($object->fields as $key => $val) { if (preg_match('/^[^:]+:[^:]+:/', $val['type'])) { $tmptype = explode(':', $val['type'], 4); - if ($tmptype[0] = 'integer' && $tmptype[1] && $tmptype[2]) { + if ($tmptype[0] == 'integer' && $tmptype[1] && $tmptype[2]) { $newobject = $tmptype[1]; dol_include_once($tmptype[2]); if (class_exists($newobject)) { @@ -1046,7 +1151,7 @@ function fillArrayOfXAxis($object, $tablealias, $labelofobject, &$arrayofxaxis, $count++; $arrayofxaxis = fillArrayOfXAxis($tmpobject, $tablealias.'__'.$key, $langs->trans($val['label']), $arrayofxaxis, $level + 1, $count); } else { - print 'Failed to find '.$newobject.' class for field '.$key.' of object '.$object->element."\n"; + print 'For property '.$object->element.'->'.$key.', type="'.$val['type'].'": Failed to find class '.$newobject." in file ".$tmptype[2]."
\n"; } } } @@ -1156,7 +1261,7 @@ function fillArrayOfGroupBy($object, $tablealias, $labelofobject, &$arrayofgroup foreach ($object->fields as $key => $val) { if (preg_match('/^[^:]+:[^:]+:/', $val['type'])) { $tmptype = explode(':', $val['type'], 4); - if ($tmptype[0] = 'integer' && $tmptype[1] && $tmptype[2]) { + if ($tmptype[0] == 'integer' && $tmptype[1] && $tmptype[2]) { $newobject = $tmptype[1]; dol_include_once($tmptype[2]); if (class_exists($newobject)) { @@ -1165,7 +1270,7 @@ function fillArrayOfGroupBy($object, $tablealias, $labelofobject, &$arrayofgroup $count++; $arrayofgroupby = fillArrayOfGroupBy($tmpobject, $tablealias.'__'.$key, $langs->trans($val['label']), $arrayofgroupby, $level + 1, $count); } else { - print 'Failed to find '.$newobject.' class for field '.$key.' of object '.$object->element."\n"; + print 'For property '.$object->element.'->'.$key.', type="'.$val['type'].'": Failed to find class '.$newobject." in file ".$tmptype[2]."
\n"; } } } From f662afa7624524f57d27f1b425ec8e44981f79d4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 22 Mar 2022 13:37:33 +0100 Subject: [PATCH 320/610] Fix sql syntax --- htdocs/core/customreports.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/customreports.php b/htdocs/core/customreports.php index 4ded4498add..030762fd0aa 100644 --- a/htdocs/core/customreports.php +++ b/htdocs/core/customreports.php @@ -278,7 +278,7 @@ if (is_array($search_groupby) && count($search_groupby)) { $sql = "SELECT DISTINCT ".$fieldtocount." as val"; if (strpos($fieldtocount, 'te.') === 0) { - $sql .= ' FROM '.MAIN_DB_PREFIX.$object->table_element.'_extrafields as te'; + $sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element."_extrafields as te"; } else { $tabletouse = $object->table_element; $tablealiastouse = 't'; @@ -287,7 +287,7 @@ if (is_array($search_groupby) && count($search_groupby)) { $tabletouse = $arrayofgroupby[$gval]['table']; $tablealiastouse = $tmpval[0]; } - $sql .= ' FROM '.MAIN_DB_PREFIX.$tabletouse.' as '.$tablealiastouse; + $sql .= " FROM ".MAIN_DB_PREFIX.$tabletouse." as ".$tablealiastouse; } // Add the where here @@ -303,7 +303,7 @@ if (is_array($search_groupby) && count($search_groupby)) { } }*/ - $sql .= ' LIMIT '.($MAXUNIQUEVALFORGROUP + 1); + $sql .= " LIMIT ".((int) ($MAXUNIQUEVALFORGROUP + 1)); //print $sql; $resql = $db->query($sql); From ccf8b01020330d0d012e131a13fe6ce68649901d Mon Sep 17 00:00:00 2001 From: Ferran Marcet Date: Tue, 22 Mar 2022 13:46:55 +0100 Subject: [PATCH 321/610] Fix: The origin of the stock movement is not being recorded --- htdocs/commande/class/commande.class.php | 5 ++++- htdocs/compta/facture/class/facture.class.php | 5 ++++- htdocs/expedition/class/expedition.class.php | 5 ++++- htdocs/fourn/class/fournisseur.commande.class.php | 6 +++--- htdocs/fourn/class/fournisseur.facture.class.php | 4 +++- htdocs/fourn/commande/dispatch.php | 4 +++- htdocs/reception/class/reception.class.php | 6 +++++- 7 files changed, 26 insertions(+), 9 deletions(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 429996ee314..f51c8026672 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -10,7 +10,7 @@ * Copyright (C) 2013 Florian Henry * Copyright (C) 2014-2015 Marcos García * Copyright (C) 2018 Nicolas ZABOURI - * Copyright (C) 2016-2018 Ferran Marcet + * Copyright (C) 2016-2022 Ferran Marcet * Copyright (C) 2021 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -518,6 +518,7 @@ class Commande extends CommonOrder if ($this->lines[$i]->fk_product > 0) { $mouvP = new MouvementStock($this->db); $mouvP->origin = &$this; + $mouvP->setOrigin($this->element, $this->id); // 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) { @@ -645,6 +646,7 @@ class Commande extends CommonOrder if ($this->lines[$i]->fk_product > 0) { $mouvP = new MouvementStock($this->db); $mouvP->origin = &$this; + $mouvP->setOrigin($this->element, $this->id); // We increment stock of product (and sub-products) $result = $mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, 0, $langs->trans("OrderBackToDraftInDolibarr", $this->ref)); if ($result < 0) { @@ -823,6 +825,7 @@ class Commande extends CommonOrder for ($i = 0; $i < $num; $i++) { if ($this->lines[$i]->fk_product > 0) { $mouvP = new MouvementStock($this->db); + $mouvP->setOrigin($this->element, $this->id); // We increment stock of product (and sub-products) $result = $mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, 0, $langs->trans("OrderCanceledInDolibarr", $this->ref)); // price is 0, we don't want WAP to be changed if ($result < 0) { diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 5e61499464c..55fa26d3c6b 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -14,7 +14,7 @@ * Copyright (C) 2012-2014 Raphaël Doursenaud * Copyright (C) 2013 Cedric Gross * Copyright (C) 2013 Florian Henry - * Copyright (C) 2016 Ferran Marcet + * Copyright (C) 2016-2022 Ferran Marcet * Copyright (C) 2018 Alexandre Spangaro * Copyright (C) 2018 Nicolas ZABOURI * Copyright (C) 2022 Sylvain Legrand @@ -2323,6 +2323,7 @@ class Facture extends CommonInvoice if ($this->lines[$i]->fk_product > 0) { $mouvP = new MouvementStock($this->db); $mouvP->origin = &$this; + $mouvP->setOrigin($this->element, $this->id); // We decrease stock for product if ($this->type == self::TYPE_CREDIT_NOTE) { $result = $mouvP->livraison($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("InvoiceDeleteDolibarr", $this->ref)); @@ -2759,6 +2760,7 @@ class Facture extends CommonInvoice if ($this->lines[$i]->fk_product > 0) { $mouvP = new MouvementStock($this->db); $mouvP->origin = &$this; + $mouvP->setOrigin($this->element, $this->id); // We decrease stock for product if ($this->type == self::TYPE_CREDIT_NOTE) { $result = $mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, 0, $langs->trans("InvoiceValidatedInDolibarr", $num)); @@ -3051,6 +3053,7 @@ class Facture extends CommonInvoice if ($this->lines[$i]->fk_product > 0) { $mouvP = new MouvementStock($this->db); $mouvP->origin = &$this; + $mouvP->setOrigin($this->element, $this->id); // We decrease stock for product if ($this->type == self::TYPE_CREDIT_NOTE) { $result = $mouvP->livraison($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("InvoiceBackToDraftInDolibarr", $this->ref)); diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 600f498da7c..a29919b7346 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -9,7 +9,7 @@ * Copyright (C) 2014-2015 Marcos García * Copyright (C) 2014-2017 Francis Appels * Copyright (C) 2015 Claudio Aschieri - * Copyright (C) 2016-2021 Ferran Marcet + * Copyright (C) 2016-2022 Ferran Marcet * Copyright (C) 2018 Nicolas ZABOURI * Copyright (C) 2018-2020 Frédéric France * Copyright (C) 2020 Lenin Rivas @@ -753,6 +753,7 @@ class Expedition extends CommonObject //var_dump($this->lines[$i]); $mouvS = new MouvementStock($this->db); $mouvS->origin = dol_clone($this, 1); + $mouvS->setOrigin($this->element, $this->id); if (empty($obj->edbrowid)) { // line without batch detail @@ -2233,6 +2234,7 @@ class Expedition extends CommonObject $mouvS = new MouvementStock($this->db); $mouvS->origin = &$this; + $mouvS->setOrigin($this->element, $this->id); if (empty($obj->edbrowid)) { // line without batch detail @@ -2404,6 +2406,7 @@ class Expedition extends CommonObject //var_dump($this->lines[$i]); $mouvS = new MouvementStock($this->db); $mouvS->origin = &$this; + $mouvS->setOrigin($this->element, $this->id); if (empty($obj->edbrowid)) { // line without batch detail diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 649fb0e106f..a20075295d9 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -10,7 +10,7 @@ * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2018 Nicolas ZABOURI * Copyright (C) 2018-2020 Frédéric France - * Copyright (C) 2018-2021 Ferran Marcet + * Copyright (C) 2018-2022 Ferran Marcet * Copyright (C) 2021 Josep Lluís Amador * * This program is free software; you can redistribute it and/or modify @@ -1071,6 +1071,7 @@ class CommandeFournisseur extends CommonOrder $this->line = $this->lines[$i]; $mouvP = new MouvementStock($this->db); $mouvP->origin = &$this; + $mouvP->setOrigin($this->element, $this->id); // We decrement stock of product (and sub-products) $up_ht_disc = $this->lines[$i]->subprice; if (!empty($this->lines[$i]->remise_percent) && empty($conf->global->STOCK_EXCLUDE_DISCOUNT_FOR_PMP)) { @@ -2037,8 +2038,7 @@ class CommandeFournisseur extends CommonOrder if ($product > 0) { // $price should take into account discount (except if option STOCK_EXCLUDE_DISCOUNT_FOR_PMP is on) $mouv->origin = &$this; - $mouv->origin_type = $this->element; - $mouv->origin_id = $this->id; + $mouv->setOrigin($this->element, $this->id); $result = $mouv->reception($user, $product, $entrepot, $qty, $price, $comment, $eatby, $sellby, $batch); if ($result < 0) { $this->error = $mouv->error; diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 2a1a54e70d3..bd25fbea6ec 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -9,7 +9,7 @@ * Copyright (C) 2013 Florian Henry * Copyright (C) 2014-2016 Marcos García * Copyright (C) 2015 Bahfir Abbes - * Copyright (C) 2015-2019 Ferran Marcet + * Copyright (C) 2015-2022 Ferran Marcet * Copyright (C) 2016-2021 Alexandre Spangaro * Copyright (C) 2018 Nicolas ZABOURI * Copyright (C) 2018-2022 Frédéric France @@ -1605,6 +1605,7 @@ class FactureFournisseur extends CommonInvoice $this->line = $this->lines[$i]; $mouvP = new MouvementStock($this->db); $mouvP->origin = &$this; + $mouvP->setOrigin($this->element, $this->id); // We increase stock for product $up_ht_disc = $this->lines[$i]->pu_ht; if (!empty($this->lines[$i]->remise_percent) && empty($conf->global->STOCK_EXCLUDE_DISCOUNT_FOR_PMP)) { @@ -1734,6 +1735,7 @@ class FactureFournisseur extends CommonInvoice if ($this->lines[$i]->fk_product > 0) { $mouvP = new MouvementStock($this->db); $mouvP->origin = &$this; + $mouvP->setOrigin($this->element, $this->id); // We increase stock for product if ($this->type == FactureFournisseur::TYPE_CREDIT_NOTE) { $result = $mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("InvoiceBackToDraftInDolibarr", $this->ref)); diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index bb56e5d4555..a1ddef959a0 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -6,7 +6,7 @@ * Copyright (C) 2010-2021 Juanjo Menent * Copyright (C) 2014 Cedric Gross * Copyright (C) 2016 Florian Henry - * Copyright (C) 2017-2020 Ferran Marcet + * Copyright (C) 2017-2022 Ferran Marcet * Copyright (C) 2018 Frédéric France * Copyright (C) 2019-2020 Christophe Battarel * @@ -423,6 +423,7 @@ if ($action == 'confirm_deleteline' && $confirm == 'yes' && $permissiontoreceive $mouv = new MouvementStock($db); if ($product > 0) { $mouv->origin = &$object; + $mouv->setOrigin($object->element, $object->id); $result = $mouv->livraison($user, $product, $entrepot, $qty, $price, $comment, '', $eatby, $sellby, $batch); if ($result < 0) { $errors = $mouv->errors; @@ -469,6 +470,7 @@ if ($action == 'updateline' && $permissiontoreceive) { $mouv = new MouvementStock($db); if ($product > 0) { $mouv->origin = &$object; + $mouv->setOrigin($object->element, $object->id); $result = $mouv->livraison($user, $product, $entrepot, $qty, $price, $comment, '', $eatby, $sellby, $batch); if ($result < 0) { $errors = $mouv->errors; diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index 28fb783e2c9..b8246b7fe8e 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -9,7 +9,7 @@ * Copyright (C) 2014-2015 Marcos García * Copyright (C) 2014-2020 Francis Appels * Copyright (C) 2015 Claudio Aschieri - * Copyright (C) 2016 Ferran Marcet + * Copyright (C) 2016-2022 Ferran Marcet * Copyright (C) 2018 Quentin Vial-Gouteyron * * This program is free software; you can redistribute it and/or modify @@ -591,6 +591,7 @@ class Reception extends CommonObject //var_dump($this->lines[$i]); $mouvS = new MouvementStock($this->db); $mouvS->origin = &$this; + $mouvS->setOrigin($this->element, $this->id); if (empty($obj->batch)) { // line without batch detail @@ -1632,6 +1633,7 @@ class Reception extends CommonObject $mouvS = new MouvementStock($this->db); $mouvS->origin = &$this; + $mouvS->setOrigin($this->element, $this->id); if (empty($obj->batch)) { // line without batch detail @@ -1796,6 +1798,7 @@ class Reception extends CommonObject //var_dump($this->lines[$i]); $mouvS = new MouvementStock($this->db); $mouvS->origin = &$this; + $mouvS->setOrigin($this->element, $this->id); if (empty($obj->batch)) { // line without batch detail @@ -1926,6 +1929,7 @@ class Reception extends CommonObject //var_dump($this->lines[$i]); $mouvS = new MouvementStock($this->db); $mouvS->origin = &$this; + $mouvS->setOrigin($this->element, $this->id); if (empty($obj->batch)) { // line without batch detail From e3a375b948309e68355417049e654a75dc474a8c Mon Sep 17 00:00:00 2001 From: GregM Date: Tue, 22 Mar 2022 14:18:48 +0100 Subject: [PATCH 322/610] add & --- htdocs/delivery/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/delivery/card.php b/htdocs/delivery/card.php index b699e044c84..4b4e88c94c3 100644 --- a/htdocs/delivery/card.php +++ b/htdocs/delivery/card.php @@ -657,7 +657,7 @@ if ($action == 'create') { // Create. Seems to no be used if ($conf->expedition_bon->enabled) { print dolGetButtonAction('', $langs->trans('Delete'), 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&expid='.$object->origin_id.'&action=delete&token='.newToken().'&backtopage='.urlencode(DOL_URL_ROOT.'/expedition/card.php?id='.$object->origin_id), ''); } else { - print dolGetButtonAction('', $langs->trans('Delete'), 'delete', $_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$object->id, ''); + print dolGetButtonAction('', $langs->trans('Delete'), 'delete', $_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$object->id, ''); } } From 4ca3d45ecaf814f98102a982c409412e8bc50c97 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 22 Mar 2022 15:51:30 +0100 Subject: [PATCH 323/610] NEW add hook printFieldWhere in load_state_board function --- htdocs/contact/class/contact.class.php | 8 +++++++- htdocs/fourn/class/fournisseur.class.php | 8 +++++++- htdocs/product/class/product.class.php | 2 +- htdocs/societe/class/client.class.php | 8 +++++++- 4 files changed, 22 insertions(+), 4 deletions(-) diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 589d09ce1e7..92549312e59 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -376,7 +376,7 @@ class Contact extends CommonObject public function load_state_board() { // phpcs:enable - global $user; + global $user, $hookmanager; $this->nb = array(); $clause = "WHERE"; @@ -394,6 +394,12 @@ class Contact extends CommonObject if ($user->socid > 0) { $sql .= " AND sp.fk_soc = ".((int) $user->socid); } + // Add where from hooks + if (is_object($hookmanager)) { + $parameters = array(); + $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $this); // Note that $action and $object may have been modified by hook + $sql .= $hookmanager->resPrint; + } $resql = $this->db->query($sql); if ($resql) { diff --git a/htdocs/fourn/class/fournisseur.class.php b/htdocs/fourn/class/fournisseur.class.php index b47cfa263c0..baed7051ef8 100644 --- a/htdocs/fourn/class/fournisseur.class.php +++ b/htdocs/fourn/class/fournisseur.class.php @@ -106,7 +106,7 @@ class Fournisseur extends Societe public function load_state_board() { // phpcs:enable - global $conf, $user; + global $conf, $user, $hookmanager; $this->nb = array(); $clause = "WHERE"; @@ -120,6 +120,12 @@ class Fournisseur extends Societe } $sql .= " ".$clause." s.fournisseur = 1"; $sql .= " AND s.entity IN (".getEntity('societe').")"; + // Add where from hooks + if (is_object($hookmanager)) { + $parameters = array(); + $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $this); // Note that $action and $object may have been modified by hook + $sql .= $hookmanager->resPrint; + } $resql = $this->db->query($sql); if ($resql) { diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 839a9f18ba2..c809a41f824 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -5692,7 +5692,7 @@ class Product extends CommonObject // Add where from hooks if (is_object($hookmanager)) { $parameters = array(); - $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook + $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $this); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; } $sql .= ' GROUP BY fk_product_type'; diff --git a/htdocs/societe/class/client.class.php b/htdocs/societe/class/client.class.php index 4e55a914339..eeae4e77731 100644 --- a/htdocs/societe/class/client.class.php +++ b/htdocs/societe/class/client.class.php @@ -57,7 +57,7 @@ class Client extends Societe public function load_state_board() { // phpcs:enable - global $user; + global $user, $hookmanager; $this->nb = array("prospects" => 0, "customers" => 0); $clause = "WHERE"; @@ -71,6 +71,12 @@ class Client extends Societe } $sql .= " ".$clause." s.client IN (1,2,3)"; $sql .= ' AND s.entity IN ('.getEntity($this->element).')'; + // Add where from hooks + if (is_object($hookmanager)) { + $parameters = array(); + $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $this); // Note that $action and $object may have been modified by hook + $sql .= $hookmanager->resPrint; + } $sql .= " GROUP BY s.client"; $resql = $this->db->query($sql); From b95bb58ba053e5a4321e4bfe021bf536e29a2ed2 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 22 Mar 2022 16:49:29 +0100 Subject: [PATCH 324/610] FIX remove unused global --- htdocs/product/class/product.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index c809a41f824..d87f60525e3 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -5682,7 +5682,7 @@ class Product extends CommonObject public function load_state_board() { // phpcs:enable - global $conf, $user, $hookmanager; + global $hookmanager; $this->nb = array(); From 2943e68c42dc421e8f51fb55428be792630283dc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 22 Mar 2022 16:57:39 +0100 Subject: [PATCH 325/610] Fix regression --- htdocs/compta/prelevement/class/bonprelevement.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 0b419dacace..6181bafdca8 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -1831,7 +1831,7 @@ class BonPrelevement extends CommonObject $DtOfSgntr = dol_print_date($row_datec, '%Y-%m-%d'); if ($type != 'bank-transfer') { - // SEPA Paiement Information of buyer for Direct debit + // SEPA Paiement Information of buyer for Direct Debit $XML_DEBITOR = ''; $XML_DEBITOR .= ' '.$CrLf; $XML_DEBITOR .= ' '.$CrLf; @@ -1884,7 +1884,7 @@ class BonPrelevement extends CommonObject // Add EndToEndId. Must be a unique ID for each payment (for example by including bank, buyer or seller, date, checksum) $XML_CREDITOR .= ' '.(($conf->global->PRELEVEMENT_END_TO_END != "") ? $conf->global->PRELEVEMENT_END_TO_END : ('CT-'.dol_trunc($row_idfac.'-'.$row_ref, 20, 'right', 'UTF-8', 1)).'-'.$Rowing).''.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters $XML_CREDITOR .= ' '.$CrLf; - if ($this->sepa_xml_pti_in_ctti) { + if (!empty($this->sepa_xml_pti_in_ctti)) { $XML_CREDITOR .= ' ' . $CrLf; // Can be 'NORM' for normal or 'HIGH' for high priority level @@ -2076,7 +2076,7 @@ class BonPrelevement extends CommonObject $RefBon = $obj->ref; if ($type != 'bank-transfer') { - // SEPA Paiement Information of my company for Direct debit + // SEPA Paiement Information of my company for Direct Debit $XML_SEPA_INFO = ''; $XML_SEPA_INFO .= ' '.$CrLf; $XML_SEPA_INFO .= ' '.('DD/'.$dateTime_YMD.'/ID'.$IdBon.'-'.$RefBon).''.$CrLf; @@ -2147,7 +2147,7 @@ class BonPrelevement extends CommonObject //$XML_SEPA_INFO .= ' False'.$CrLf; $XML_SEPA_INFO .= ' '.$nombre.''.$CrLf; $XML_SEPA_INFO .= ' '.$total.''.$CrLf; - if (!$this->sepa_xml_pti_in_ctti) { + if (!empty($this->sepa_xml_pti_in_ctti) && !empty($format)) { // @TODO Using $format (FRST ou RCUR) in a section for a Credit Transfer looks strange. $XML_SEPA_INFO .= ' ' . $CrLf; $XML_SEPA_INFO .= ' ' . $CrLf; $XML_SEPA_INFO .= ' SEPA' . $CrLf; From 100c48372b7f806dbac0a6e43725221ac306944a Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Tue, 22 Mar 2022 17:13:48 +0100 Subject: [PATCH 326/610] FIX: permit access to medias when logged in a different entity --- htdocs/viewimage.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/htdocs/viewimage.php b/htdocs/viewimage.php index 69d0b38571c..fda4cdfbf20 100644 --- a/htdocs/viewimage.php +++ b/htdocs/viewimage.php @@ -186,6 +186,13 @@ $refname = basename(dirname($original_file)."/"); // Security check if (empty($modulepart)) accessforbidden('Bad value for parameter modulepart', 0, 0, 1); +// When logged in a different entity, medias cannot be accessed because $conf->$module->multidir_output +// is not set on the requested entity, but they are public documents, so reset entity +if ($modulepart === 'medias' && $entity != $conf->entity) { + $conf->entity = $entity; + $conf->setValues($db); +} + $check_access = dol_check_secure_access_document($modulepart, $original_file, $entity, $user, $refname); $accessallowed = $check_access['accessallowed']; $sqlprotectagainstexternals = $check_access['sqlprotectagainstexternals']; From 8ad310c8a04def966dfa0aff400472ed20594de6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 23 Mar 2022 13:01:24 +0100 Subject: [PATCH 327/610] FIX Bad filter on date on salary list --- htdocs/salaries/list.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/htdocs/salaries/list.php b/htdocs/salaries/list.php index 2e77c29cd01..4f7ea9d777c 100644 --- a/htdocs/salaries/list.php +++ b/htdocs/salaries/list.php @@ -260,12 +260,19 @@ if ($search_user) { if ($search_label) { $sql .= natural_search(array('s.label'), $search_label); } -if (!empty($search_date_start_from) && !empty($search_date_start_to)) { - $sql .= " AND s.datesp BETWEEN '".$db->idate($search_date_start_from)."' AND '".$db->idate($search_date_start_to)."'"; +if (!empty($search_date_start_from)) { + $sql .= " AND s.datesp >= '".$db->idate($search_date_start_from)."'"; } -if (!empty($search_date_end_from) && !empty($search_date_end_to)) { - $sql .= " AND s.dateep BETWEEN '".$db->idate($search_date_end_from)."' AND '".$db->idate($search_date_end_to)."'"; +if (!empty($search_date_end_from)) { + $sql .= " AND s.dateep >= '".$db->idate($search_date_end_from)."'"; } +if (!empty($search_date_start_to)) { + $sql .= " AND s.datesp <= '".$db->idate($search_date_start_to)."'"; +} +if (!empty($search_date_end_to)) { + $sql .= " AND s.dateep <= '".$db->idate($search_date_end_to)."'"; +} + if ($search_amount) { $sql .= natural_search("s.amount", $search_amount, 1); } From 12db2a8f67f31e41179d969622511c4d86ff96e1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 23 Mar 2022 13:02:49 +0100 Subject: [PATCH 328/610] Doc --- htdocs/core/lib/functions.lib.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 0f57222a6ce..6a1bac203bb 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -9111,6 +9111,7 @@ function dol_getmypid() * 3=value is list of string separated with comma (Example 'text 1,text 2'), 4=value is a list of ID separated with comma (Example '2,7') to be used to search into a multiselect string '1,2,3,4' * @param integer $nofirstand 1=Do not output the first 'AND' * @return string $res The statement to append to the SQL query + * @see dolSqlDateFilter() */ function natural_search($fields, $value, $mode = 0, $nofirstand = 0) { From 279a8c9df5f5996b7ee1403595e46cbf41fcab34 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 23 Mar 2022 14:39:10 +0100 Subject: [PATCH 329/610] Code comment --- htdocs/core/modules/import/import_csv.modules.php | 2 ++ htdocs/core/modules/import/import_xlsx.modules.php | 2 ++ 2 files changed, 4 insertions(+) diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php index 781c22ce7e3..7d535520496 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -716,6 +716,8 @@ class ImportCsv extends ModeleImports } // We add hidden fields (but only if there is at least one field to add into table) + // We process here all the fields that were declared into the array ->import_fieldshidden_array of the descriptor file. + // Previously we processed the ->import_fields_array. if (!empty($listfields) && is_array($objimport->array_import_fieldshidden[0])) { // Loop on each hidden fields to add them into listfields/listvalues foreach ($objimport->array_import_fieldshidden[0] as $key => $val) { diff --git a/htdocs/core/modules/import/import_xlsx.modules.php b/htdocs/core/modules/import/import_xlsx.modules.php index 1c38f52cbfc..0effa87cb3c 100644 --- a/htdocs/core/modules/import/import_xlsx.modules.php +++ b/htdocs/core/modules/import/import_xlsx.modules.php @@ -757,6 +757,8 @@ class ImportXlsx extends ModeleImports } // We add hidden fields (but only if there is at least one field to add into table) + // We process here all the fields that were declared into the array $this->import_fieldshidden_array of the descriptor file. + // Previously we processed the ->import_fields_array. if (!empty($listfields) && is_array($objimport->array_import_fieldshidden[0])) { // Loop on each hidden fields to add them into listfields/listvalues foreach ($objimport->array_import_fieldshidden[0] as $key => $val) { From 2b7797fa75c3252c119e3409f916d627e0be8350 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 23 Mar 2022 15:02:45 +0100 Subject: [PATCH 330/610] Clean code --- .../modules/import/import_csv.modules.php | 24 ++++--------------- .../modules/import/import_xlsx.modules.php | 22 +++-------------- 2 files changed, 7 insertions(+), 39 deletions(-) diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php index 7d535520496..da4e884d30f 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -613,18 +613,7 @@ class ImportCsv extends ModeleImports } $classinstance = new $class($this->db); $res = call_user_func_array(array($classinstance, $method), array(&$arrayrecord)); - if ($res < 0) { - if (!empty($objimport->array_import_convertvalue[0][$val]['dict'])) { - $this->errors[$error]['lib'] = $langs->trans('ErrorFieldValueNotIn', $key, $newval, 'code', $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['dict'])); - } else { - $this->errors[$error]['lib'] = 'ErrorFieldValueNotIn'; - } - $this->errors[$error]['type'] = 'FOREIGNKEY'; - $errorforthistable++; - $error++; - } else { - $newval = $arrayrecord[($key - 1)]['val']; //We get new value computed. - } + $newval = $res; // We get new value computed. } elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'numeric') { $newval = price2num($newval); } elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'accountingaccount') { @@ -751,14 +740,9 @@ class ImportCsv extends ModeleImports break; } $classinstance = new $class($this->db); - $res = call_user_func_array(array($classinstance, $method), array(&$arrayrecord, $fieldname, &$listfields, &$listvalues)); - if ($res < 0) { - if (!empty($objimport->array_import_convertvalue[0][$fieldname]['dict'])) $this->errors[$error]['lib'] = $langs->trans('ErrorFieldValueNotIn', $key, end($listvalues), 'code', $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$fieldname]['dict'])); - else $this->errors[$error]['lib'] = 'ErrorFieldValueNotIn'; - $this->errors[$error]['type'] = 'FOREIGNKEY'; - $errorforthistable++; - $error++; - } + $res = call_user_func_array(array($classinstance, $method), array(&$arrayrecord, $fieldname)); + $listfields[] = $fieldname; + $listvalues[] = $res; } } } else { diff --git a/htdocs/core/modules/import/import_xlsx.modules.php b/htdocs/core/modules/import/import_xlsx.modules.php index 0effa87cb3c..2b9d4f9af7c 100644 --- a/htdocs/core/modules/import/import_xlsx.modules.php +++ b/htdocs/core/modules/import/import_xlsx.modules.php @@ -654,18 +654,7 @@ class ImportXlsx extends ModeleImports } $classinstance = new $class($this->db); $res = call_user_func_array(array($classinstance, $method), array(&$arrayrecord)); - if ($res < 0) { - if (!empty($objimport->array_import_convertvalue[0][$val]['dict'])) { - $this->errors[$error]['lib'] = $langs->trans('ErrorFieldValueNotIn', $key, $newval, 'code', $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['dict'])); - } else { - $this->errors[$error]['lib'] = 'ErrorFieldValueNotIn'; - } - $this->errors[$error]['type'] = 'FOREIGNKEY'; - $errorforthistable++; - $error++; - } else { - $newval = $arrayrecord[($key)]['val']; //We get new value computed. - } + $newval = $res; // We get new value computed. } elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'numeric') { $newval = price2num($newval); } elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'accountingaccount') { @@ -793,13 +782,8 @@ class ImportXlsx extends ModeleImports } $classinstance = new $class($this->db); $res = call_user_func_array(array($classinstance, $method), array(&$arrayrecord, $fieldname, &$listfields, &$listvalues)); - if ($res < 0) { - if (!empty($objimport->array_import_convertvalue[0][$fieldname]['dict'])) $this->errors[$error]['lib'] = $langs->trans('ErrorFieldValueNotIn', $key, end($listvalues), 'code', $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$fieldname]['dict'])); - else $this->errors[$error]['lib'] = 'ErrorFieldValueNotIn'; - $this->errors[$error]['type'] = 'FOREIGNKEY'; - $errorforthistable++; - $error++; - } + $listfields[] = $fieldname; + $listvalues[] = $res; } } } else { From b59196d3f9717be7a11e18b818f39a01e671b38d Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 23 Mar 2022 15:55:50 +0100 Subject: [PATCH 331/610] fix : Nested ternary expressions (without parentheses) deprecated in PHP 7.4. Targeting PHP 8.1.0. --- htdocs/core/modules/facture/doc/pdf_sponge.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index c1e0468b868..39c76e780c8 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -1805,7 +1805,7 @@ class pdf_sponge extends ModelePDFFactures // Credit note if ($creditnoteamount) { $labeltouse = ($outputlangs->transnoentities("CreditNotesOrExcessReceived") != "CreditNotesOrExcessReceived") ? $outputlangs->transnoentities("CreditNotesOrExcessReceived") : $outputlangs->transnoentities("CreditNotes"); - $labeltouse .= (is_object($outputlangsbis) ? ' / '.($outputlangsbis->transnoentities("CreditNotesOrExcessReceived") != "CreditNotesOrExcessReceived") ? $outputlangsbis->transnoentities("CreditNotesOrExcessReceived") : $outputlangsbis->transnoentities("CreditNotes") : ''); + $labeltouse .= (is_object($outputlangsbis) ? (' / '.($outputlangsbis->transnoentities("CreditNotesOrExcessReceived") != "CreditNotesOrExcessReceived") ? $outputlangsbis->transnoentities("CreditNotesOrExcessReceived") : $outputlangsbis->transnoentities("CreditNotes")) : ''); $index++; $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($col2x - $col1x, $tab2_hl, $labeltouse, 0, 'L', 0); From 01396cc07aea83ae20565bb4feadb62e1348d362 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 23 Mar 2022 15:58:55 +0100 Subject: [PATCH 332/610] Code comment --- htdocs/core/actions_dellink.inc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/actions_dellink.inc.php b/htdocs/core/actions_dellink.inc.php index fbecacce515..9bf56b2f876 100644 --- a/htdocs/core/actions_dellink.inc.php +++ b/htdocs/core/actions_dellink.inc.php @@ -32,7 +32,7 @@ $addlinkid = GETPOST('idtolinkto', 'int'); $addlinkref = GETPOST('reftolinkto', 'alpha'); $cancellink = GETPOST('cancel', 'alpha'); -// Link invoice to order +// Link object to another object if ($action == 'addlink' && !empty($permissiondellink) && !$cancellink && $id > 0 && $addlinkid > 0) { $object->fetch($id); $object->fetch_thirdparty(); @@ -61,7 +61,7 @@ if ($action == 'addlinkbyref' && ! empty($permissiondellink) && !$cancellink && } } -// Delete link +// Delete link in table llx_element_element if ($action == 'dellink' && !empty($permissiondellink) && !$cancellink && $dellinkid > 0) { $result = $object->deleteObjectLinked(0, '', 0, '', $dellinkid); if ($result < 0) { From 61ed36e1814470398bb941dbff7651eb3ba6b6ed Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 23 Mar 2022 16:19:06 +0100 Subject: [PATCH 333/610] Update other.lang --- htdocs/langs/en_US/other.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/other.lang b/htdocs/langs/en_US/other.lang index 7b4c2d86bc9..3b71c29da24 100644 --- a/htdocs/langs/en_US/other.lang +++ b/htdocs/langs/en_US/other.lang @@ -302,4 +302,4 @@ SelectTheTypeOfObjectToAnalyze=Select an object to view its statistics... ConfirmBtnCommonContent = Are you sure you want to "%s" ? ConfirmBtnCommonTitle = Confirm your action CloseDialog = Close -Autofill = Auto fill +Autofill = Autofill From eac3a6cf86ac872f7cb868468fd715a44d08f634 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 23 Mar 2022 16:38:57 +0100 Subject: [PATCH 334/610] Update functions.lib.php --- htdocs/core/lib/functions.lib.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 517d09ba453..89ba7147694 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -8771,15 +8771,18 @@ function complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, complete_substitutions_array($substitutionarray, $langs, $object, array('needforkey'=>$values[2])); $label = make_substitutions($reg[1], $substitutionarray); } else { - $labeltemp = explode(',', $values[2]); + $labeltemp = explode(':', $values[2]); $label = $langs->trans($labeltemp[0]); if (!empty($labeltemp[1]) && is_object($object) && !empty($object->id)) { dol_include_once($labeltemp[2]); - $obj = new $labeltemp[1]($db); - $function = $labeltemp[3]; - if (method_exists($obj, $function)) { - $nbrec = $obj->$function($object->id, $obj); - $label .= ''.$nbrec.''; + $classtoload = $labeltemp[1]; + if (class_exists($classtoload)) { + $obj = new $classtoload($db); + $function = $labeltemp[3]; + if (method_exists($obj, $function)) { + $nbrec = $obj->$function($object->id, $obj); + $label .= ''.$nbrec.''; + } } } } From d82aae1871989014ca26d049e3540ba199e1ce04 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 23 Mar 2022 16:39:55 +0100 Subject: [PATCH 335/610] Update functions.lib.php --- htdocs/core/lib/functions.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 89ba7147694..4dd675f9a28 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -8779,7 +8779,7 @@ function complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, if (class_exists($classtoload)) { $obj = new $classtoload($db); $function = $labeltemp[3]; - if (method_exists($obj, $function)) { + if ($obj && $function && method_exists($obj, $function)) { $nbrec = $obj->$function($object->id, $obj); $label .= ''.$nbrec.''; } From fcc8a953ae6479c956ff34ef0689fa82eb1d1da7 Mon Sep 17 00:00:00 2001 From: BENKE Charlene <1179011+defrance@users.noreply.github.com> Date: Wed, 23 Mar 2022 16:51:36 +0100 Subject: [PATCH 336/610] Update 15.0.0-16.0.0.sql --- htdocs/install/mysql/migration/15.0.0-16.0.0.sql | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql index 2933acd00d7..8eb37fb4f31 100644 --- a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql +++ b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql @@ -30,6 +30,8 @@ -- -- VPGSQL8.2 SELECT dol_util_rebuild_sequences(); +ALTER TABLE llx_holiday ADD COLUMN nb_open_day double(24,8) DEFAULT 0; + -- Missing in v15 or lower ALTER TABLE llx_c_actioncomm MODIFY COLUMN libelle varchar(128); From 95c8dfcaa0676bde719be1db7fd305c69eb14d73 Mon Sep 17 00:00:00 2001 From: BENKE Charlene <1179011+defrance@users.noreply.github.com> Date: Wed, 23 Mar 2022 16:53:12 +0100 Subject: [PATCH 337/610] Update llx_holiday.sql --- htdocs/install/mysql/tables/llx_holiday.sql | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/install/mysql/tables/llx_holiday.sql b/htdocs/install/mysql/tables/llx_holiday.sql index 992f9502394..d21889e3116 100644 --- a/htdocs/install/mysql/tables/llx_holiday.sql +++ b/htdocs/install/mysql/tables/llx_holiday.sql @@ -31,7 +31,8 @@ description VARCHAR( 255 ) NOT NULL, date_debut DATE NOT NULL, date_fin DATE NOT NULL, halfday integer DEFAULT 0, -- 0=start morning and end afternoon, -1=start afternoon end afternoon, 1=start morning and end morning, 2=start afternoon and end morning -statut integer NOT NULL DEFAULT '1', +nb_open_day double(24,8) DEFAULT 0, +statut integer NOT NULL DEFAULT 1, fk_validator integer NOT NULL, -- who should approve date_valid DATETIME DEFAULT NULL, -- date approval (both date valid and date_approval) fk_user_valid integer DEFAULT NULL, -- user approval (both user valid and user that approved) From ee611e8517f2c0e5cc9520bc892f5a95a3615803 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 23 Mar 2022 16:56:07 +0100 Subject: [PATCH 338/610] Hide not important options --- htdocs/admin/propal.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/admin/propal.php b/htdocs/admin/propal.php index da886630ac9..3bc745a1101 100644 --- a/htdocs/admin/propal.php +++ b/htdocs/admin/propal.php @@ -625,6 +625,7 @@ print ''; print ''; // default update prices on cloning a proposal +/* print '
'; print ''; print ''; @@ -643,6 +644,7 @@ if (!empty($conf->use_javascript_ajax)) { print ''; print ''; print '
'; +*/ /* print '
'; From 161e79575905270a14f182a1591f861053db546a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 23 Mar 2022 17:12:25 +0100 Subject: [PATCH 339/610] Look and feel --- htdocs/compta/facture/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 4b78f22ceac..00b57141f68 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -3058,7 +3058,7 @@ if ($action == 'create') { if (empty($conf->global->INVOICE_DISABLE_AUTOMATIC_RECURRING_INVOICE)) { $text .= ' '.$langs->trans("ToCreateARecurringInvoiceGeneAuto", $langs->transnoentitiesnoconv('Module2300Name')); } - print info_admin($text, 0, 0, 0).'
'; + print info_admin($text, 0, 0, 0, 'opacitymedium').'
'; } print ''; From 958b6abdaafa0585ac6d8ef70559207b16cd5bb2 Mon Sep 17 00:00:00 2001 From: BB2A Anthony Berton Date: Wed, 23 Mar 2022 17:31:54 +0100 Subject: [PATCH 340/610] pdf_path --- htdocs/core/class/notify.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/notify.class.php b/htdocs/core/class/notify.class.php index 5bb448ad11d..54b0fbb749c 100644 --- a/htdocs/core/class/notify.class.php +++ b/htdocs/core/class/notify.class.php @@ -836,7 +836,7 @@ class Notify break; } $ref = dol_sanitizeFileName($newref); - $pdf_path = $dir_output."/".$ref.".pdf"; + $pdf_path = $dir_output."/".$ref."/".$ref.".pdf"; if (!dol_is_file($pdf_path)) { // We can't add PDF as it is not generated yet. $filepdf = ''; From 1266da05ef060cb09f594684138afb02e7115860 Mon Sep 17 00:00:00 2001 From: BB2A Anthony Berton Date: Wed, 23 Mar 2022 19:43:34 +0100 Subject: [PATCH 341/610] Lang fr --- htdocs/langs/fr_FR/bills.lang | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/langs/fr_FR/bills.lang b/htdocs/langs/fr_FR/bills.lang index d1a0dbbbe92..f03afd6a6b3 100644 --- a/htdocs/langs/fr_FR/bills.lang +++ b/htdocs/langs/fr_FR/bills.lang @@ -81,14 +81,14 @@ PaymentsReports=Rapports de règlements PaymentsAlreadyDone=Versements déjà effectués PaymentsBackAlreadyDone=Remboursements déjà effectués PaymentRule=Mode de paiement -PaymentMode=Payment method -PaymentModes=Payment methods -DefaultPaymentMode=Default Payment method +PaymentMode=Mode de paiement +PaymentModes=Modes de paiement +DefaultPaymentMode=Default Mode de paiement DefaultBankAccount=Compte bancaire par défaut -IdPaymentMode=Payment method (id) -CodePaymentMode=Payment method (code) -LabelPaymentMode=Payment method (label) -PaymentModeShort=Payment method +IdPaymentMode=Mode de paiement (id) +CodePaymentMode=Mode de paiement (code) +LabelPaymentMode=Mode de paiement (label) +PaymentModeShort=Mode de paiement PaymentTerm=Condition de règlement PaymentConditions=Conditions de règlement PaymentConditionsShort=Conditions de règlement From f70ceb93989921f906bf86c67be09b1b937a6543 Mon Sep 17 00:00:00 2001 From: atm-greg Date: Tue, 15 Mar 2022 11:18:11 +0100 Subject: [PATCH 342/610] add more specific context and doAction hook --- htdocs/admin/dict.php | 806 ++++++++++++++++++++++-------------------- 1 file changed, 416 insertions(+), 390 deletions(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 05699347806..7ea895c506a 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -694,445 +694,471 @@ if ($id == 10) { * Actions */ +$parameters = array( + 'id' =>$id, + 'rowid' =>$rowid, + 'code' =>$code, + 'confirm' =>$confirm, + 'entity' =>$entity, + 'taborder' =>$taborder, + 'tabname' =>$tabname, + 'tablib' =>$tablib, + 'tabsql' =>$tabsql, + 'tabsqlsort' =>$tabsqlsort, + 'tabfield' =>$tabfield, + 'tabfieldvalue' =>$tabfieldvalue, + 'tabfieldinsert'=>$tabfieldinsert, + 'tabrowid' =>$tabrowid, + 'tabcond' =>$tabcond, + 'tabhelp' =>$tabhelp, + 'tabcomplete' =>$tabcomplete +); +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); +} + if (GETPOST('button_removefilter', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter_x', 'alpha')) { $search_country_id = ''; $search_code = ''; } -// Actions add or modify an entry into a dictionary -if (GETPOST('actionadd') || GETPOST('actionmodify')) { - $listfield = explode(',', str_replace(' ', '', $tabfield[$id])); - $listfieldinsert = explode(',', $tabfieldinsert[$id]); - $listfieldmodify = explode(',', $tabfieldinsert[$id]); - $listfieldvalue = explode(',', $tabfieldvalue[$id]); +if (empty($reshook)) +{ + // Actions add or modify an entry into a dictionary + if (GETPOST('actionadd') || GETPOST('actionmodify')) { + $listfield = explode(',', str_replace(' ', '', $tabfield[$id])); + $listfieldinsert = explode(',', $tabfieldinsert[$id]); + $listfieldmodify = explode(',', $tabfieldinsert[$id]); + $listfieldvalue = explode(',', $tabfieldvalue[$id]); - // Check that all mandatory fields are filled - $ok = 1; - foreach ($listfield as $f => $value) { - // Discard check of mandatory fields for country for some tables - if ($value == 'country_id' && in_array($tablib[$id], array('DictionaryPublicHolidays', 'DictionaryVAT', 'DictionaryRegion', 'DictionaryCompanyType', 'DictionaryHolidayTypes', 'DictionaryRevenueStamp', 'DictionaryAccountancysystem', 'DictionaryAccountancyCategory'))) { - continue; // For some pages, country is not mandatory + // Check that all mandatory fields are filled + $ok = 1; + foreach ($listfield as $f => $value) { + // Discard check of mandatory fields for country for some tables + if ($value == 'country_id' && in_array($tablib[$id], array('DictionaryPublicHolidays', 'DictionaryVAT', 'DictionaryRegion', 'DictionaryCompanyType', 'DictionaryHolidayTypes', 'DictionaryRevenueStamp', 'DictionaryAccountancysystem', 'DictionaryAccountancyCategory'))) { + continue; // For some pages, country is not mandatory + } + if ($value == 'country' && in_array($tablib[$id], array('DictionaryPublicHolidays', 'DictionaryCanton', 'DictionaryCompanyType', 'DictionaryHolidayTypes', 'DictionaryRevenueStamp'))) { + continue; // For some pages, country is not mandatory + } + // Discard check of mandatory fiedls for other fields + if ($value == 'localtax1' && !GETPOST('localtax1_type')) { + continue; + } + if ($value == 'localtax2' && !GETPOST('localtax2_type')) { + continue; + } + if ($value == 'color' && !GETPOST('color')) { + continue; + } + if ($value == 'formula' && !GETPOST('formula')) { + continue; + } + if ($value == 'dayrule' && !GETPOST('dayrule')) { + continue; + } + if ($value == 'sortorder') { + continue; // For a column name 'sortorder', we use the field name 'position' + } + if ((!GETPOSTISSET($value) || GETPOST($value) == '') + && (!in_array($value, array('decalage', 'module', 'accountancy_code', 'accountancy_code_sell', 'accountancy_code_buy', 'tracking', 'picto')) // Fields that are not mandatory + && ($id != 10 || ($value != 'code' && $value != 'note')) // Field code and note is not mandatory for dictionary table 10 + ) + ) { + $ok = 0; + $fieldnamekey = $value; + // We take translate key of field + if ($fieldnamekey == 'libelle' || ($fieldnamekey == 'label')) { + $fieldnamekey = 'Label'; + } + if ($fieldnamekey == 'libelle_facture') { + $fieldnamekey = 'LabelOnDocuments'; + } + if ($fieldnamekey == 'nbjour') { + $fieldnamekey = 'NbOfDays'; + } + if ($fieldnamekey == 'decalage') { + $fieldnamekey = 'Offset'; + } + if ($fieldnamekey == 'module') { + $fieldnamekey = 'Module'; + } + if ($fieldnamekey == 'code') { + $fieldnamekey = 'Code'; + } + if ($fieldnamekey == 'note') { + $fieldnamekey = 'Note'; + } + if ($fieldnamekey == 'taux') { + $fieldnamekey = 'Rate'; + } + if ($fieldnamekey == 'type') { + $fieldnamekey = 'Type'; + } + if ($fieldnamekey == 'position') { + $fieldnamekey = 'Position'; + } + if ($fieldnamekey == 'unicode') { + $fieldnamekey = 'Unicode'; + } + if ($fieldnamekey == 'deductible') { + $fieldnamekey = 'Deductible'; + } + if ($fieldnamekey == 'sortorder') { + $fieldnamekey = 'SortOrder'; + } + if ($fieldnamekey == 'category_type') { + $fieldnamekey = 'Calculated'; + } + if ($fieldnamekey == 'revenuestamp_type') { + $fieldnamekey = 'TypeOfRevenueStamp'; + } + if ($fieldnamekey == 'use_default') { + $fieldnamekey = 'UseByDefault'; + } + + setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors'); + } } - if ($value == 'country' && in_array($tablib[$id], array('DictionaryPublicHolidays', 'DictionaryCanton', 'DictionaryCompanyType', 'DictionaryHolidayTypes', 'DictionaryRevenueStamp'))) { - continue; // For some pages, country is not mandatory + // Other checks + if (GETPOST('actionadd') && $tabname[$id] == MAIN_DB_PREFIX."c_actioncomm" && GETPOSTISSET("type") && in_array(GETPOST("type"), array('system', 'systemauto'))) { + $ok = 0; + setEventMessages($langs->transnoentities('ErrorReservedTypeSystemSystemAuto'), null, 'errors'); } - // Discard check of mandatory fiedls for other fields - if ($value == 'localtax1' && !GETPOST('localtax1_type')) { - continue; - } - if ($value == 'localtax2' && !GETPOST('localtax2_type')) { - continue; - } - if ($value == 'color' && !GETPOST('color')) { - continue; - } - if ($value == 'formula' && !GETPOST('formula')) { - continue; - } - if ($value == 'dayrule' && !GETPOST('dayrule')) { - continue; - } - if ($value == 'sortorder') { - continue; // For a column name 'sortorder', we use the field name 'position' - } - if ((!GETPOSTISSET($value) || GETPOST($value) == '') - && (!in_array($value, array('decalage', 'module', 'accountancy_code', 'accountancy_code_sell', 'accountancy_code_buy', 'tracking', 'picto')) // Fields that are not mandatory - && ($id != 10 || ($value != 'code' && $value != 'note')) // Field code and note is not mandatory for dictionary table 10 - ) - ) { + if (GETPOSTISSET("code")) { + if (GETPOST("code") == '0') { $ok = 0; - $fieldnamekey = $value; - // We take translate key of field - if ($fieldnamekey == 'libelle' || ($fieldnamekey == 'label')) { - $fieldnamekey = 'Label'; + setEventMessages($langs->transnoentities('ErrorCodeCantContainZero'), null, 'errors'); } - if ($fieldnamekey == 'libelle_facture') { - $fieldnamekey = 'LabelOnDocuments'; - } - if ($fieldnamekey == 'nbjour') { - $fieldnamekey = 'NbOfDays'; - } - if ($fieldnamekey == 'decalage') { - $fieldnamekey = 'Offset'; - } - if ($fieldnamekey == 'module') { - $fieldnamekey = 'Module'; - } - if ($fieldnamekey == 'code') { - $fieldnamekey = 'Code'; - } - if ($fieldnamekey == 'note') { - $fieldnamekey = 'Note'; - } - if ($fieldnamekey == 'taux') { - $fieldnamekey = 'Rate'; - } - if ($fieldnamekey == 'type') { - $fieldnamekey = 'Type'; - } - if ($fieldnamekey == 'position') { - $fieldnamekey = 'Position'; - } - if ($fieldnamekey == 'unicode') { - $fieldnamekey = 'Unicode'; - } - if ($fieldnamekey == 'deductible') { - $fieldnamekey = 'Deductible'; - } - if ($fieldnamekey == 'sortorder') { - $fieldnamekey = 'SortOrder'; - } - if ($fieldnamekey == 'category_type') { - $fieldnamekey = 'Calculated'; - } - if ($fieldnamekey == 'revenuestamp_type') { - $fieldnamekey = 'TypeOfRevenueStamp'; - } - if ($fieldnamekey == 'use_default') { - $fieldnamekey = 'UseByDefault'; - } - - setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors'); } - } - // Other checks - if (GETPOST('actionadd') && $tabname[$id] == MAIN_DB_PREFIX."c_actioncomm" && GETPOSTISSET("type") && in_array(GETPOST("type"), array('system', 'systemauto'))) { - $ok = 0; - setEventMessages($langs->transnoentities('ErrorReservedTypeSystemSystemAuto'), null, 'errors'); - } - if (GETPOSTISSET("code")) { - if (GETPOST("code") == '0') { + if (GETPOSTISSET("country") && (GETPOST("country") == '0') && ($id != 2)) { + if (in_array($tablib[$id], array('DictionaryCompanyType', 'DictionaryHolidayTypes'))) { // Field country is no mandatory for such dictionaries + $_POST["country"] = ''; + } else { + $ok = 0; + setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities("Country")), null, 'errors'); + } + } + if (($id == 3 || $id == 42) && !is_numeric(GETPOST("code"))) { $ok = 0; - setEventMessages($langs->transnoentities('ErrorCodeCantContainZero'), null, 'errors'); + setEventMessages($langs->transnoentities("ErrorFieldMustBeANumeric", $langs->transnoentities("Code")), null, 'errors'); } - } - if (GETPOSTISSET("country") && (GETPOST("country") == '0') && ($id != 2)) { - if (in_array($tablib[$id], array('DictionaryCompanyType', 'DictionaryHolidayTypes'))) { // Field country is no mandatory for such dictionaries - $_POST["country"] = ''; - } else { - $ok = 0; - setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities("Country")), null, 'errors'); + + // Clean some parameters + if ((GETPOST("localtax1_type") || (GETPOST('localtax1_type') == '0')) && !GETPOST("localtax1")) { + $_POST["localtax1"] = '0'; // If empty, we force to 0 + } + if ((GETPOST("localtax2_type") || (GETPOST('localtax2_type') == '0')) && !GETPOST("localtax2")) { + $_POST["localtax2"] = '0'; // If empty, we force to 0 + } + if (GETPOST("accountancy_code") <= 0) { + $_POST["accountancy_code"] = ''; // If empty, we force to null + } + if (GETPOST("accountancy_code_sell") <= 0) { + $_POST["accountancy_code_sell"] = ''; // If empty, we force to null + } + if (GETPOST("accountancy_code_buy") <= 0) { + $_POST["accountancy_code_buy"] = ''; // If empty, we force to null + } + if ($id == 10 && GETPOSTISSET("code")) { // Spaces are not allowed into code for tax dictionary + $_POST["code"] = preg_replace('/[^a-zA-Z0-9\-\+]/', '', GETPOST("code")); } - } - if (($id == 3 || $id == 42) && !is_numeric(GETPOST("code"))) { - $ok = 0; - setEventMessages($langs->transnoentities("ErrorFieldMustBeANumeric", $langs->transnoentities("Code")), null, 'errors'); - } - // Clean some parameters - if ((GETPOST("localtax1_type") || (GETPOST('localtax1_type') == '0')) && !GETPOST("localtax1")) { - $_POST["localtax1"] = '0'; // If empty, we force to 0 - } - if ((GETPOST("localtax2_type") || (GETPOST('localtax2_type') == '0')) && !GETPOST("localtax2")) { - $_POST["localtax2"] = '0'; // If empty, we force to 0 - } - if (GETPOST("accountancy_code") <= 0) { - $_POST["accountancy_code"] = ''; // If empty, we force to null - } - if (GETPOST("accountancy_code_sell") <= 0) { - $_POST["accountancy_code_sell"] = ''; // If empty, we force to null - } - if (GETPOST("accountancy_code_buy") <= 0) { - $_POST["accountancy_code_buy"] = ''; // If empty, we force to null - } - if ($id == 10 && GETPOSTISSET("code")) { // Spaces are not allowed into code for tax dictionary - $_POST["code"] = preg_replace('/[^a-zA-Z0-9\-\+]/', '', GETPOST("code")); - } + // If check ok and action add, add the line + if ($ok && GETPOST('actionadd')) { + if ($tabrowid[$id]) { + // Get free id for insert + $newid = 0; + $sql = "SELECT max(".$tabrowid[$id].") newid from ".$tabname[$id]; + $result = $db->query($sql); + if ($result) { + $obj = $db->fetch_object($result); + $newid = ($obj->newid + 1); + } else { + dol_print_error($db); + } + } - // If check ok and action add, add the line - if ($ok && GETPOST('actionadd')) { - if ($tabrowid[$id]) { - // Get free id for insert - $newid = 0; - $sql = "SELECT max(".$tabrowid[$id].") newid from ".$tabname[$id]; - $result = $db->query($sql); - if ($result) { - $obj = $db->fetch_object($result); - $newid = ($obj->newid + 1); + // Add new entry + $sql = "INSERT INTO ".$tabname[$id]." ("; + // List of fields + if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldinsert)) { + $sql .= $tabrowid[$id].","; + } + $sql .= $tabfieldinsert[$id]; + $sql .= ",active)"; + $sql .= " VALUES("; + + // List of values + if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldinsert)) { + $sql .= $newid.","; + } + $i = 0; + foreach ($listfieldinsert as $f => $value) { + $keycode = $listfieldvalue[$i]; + if (empty($keycode)) { + $keycode = $value; + } + + if ($value == 'price' || preg_match('/^amount/i', $value)) { + $_POST[$keycode] = price2num(GETPOST($keycode), 'MU'); + } elseif ($value == 'taux' || $value == 'localtax1') { + $_POST[$keycode] = price2num(GETPOST($keycode), 8); // Note that localtax2 can be a list of rates separated by coma like X:Y:Z + } elseif ($value == 'entity') { + $_POST[$keycode] = getEntity($tabname[$id]); + } + + if ($i) { + $sql .= ","; + } + + if ($keycode == 'sortorder') { // For column name 'sortorder', we use the field name 'position' + $sql .= (int) GETPOST('position', 'int'); + } elseif (GETPOST($keycode) == '' && !($keycode == 'code' && $id == 10)) { + $sql .= "null"; // For vat, we want/accept code = '' + } elseif ($keycode == 'content') { + $sql .= "'".$db->escape(GETPOST($keycode, 'restricthtml'))."'"; + } elseif (in_array($keycode, array('joinfile', 'private', 'pos', 'position', 'scale', 'use_default'))) { + $sql .= (int) GETPOST($keycode, 'int'); + } else { + $sql .= "'".$db->escape(GETPOST($keycode, 'nohtml'))."'"; + } + + $i++; + } + $sql .= ",1)"; + + dol_syslog("actionadd", LOG_DEBUG); + $resql = $db->query($sql); + if ($resql) { // Add is ok + setEventMessages($langs->transnoentities("RecordCreatedSuccessfully"), null, 'mesgs'); + + // Clean $_POST array, we keep only id of dictionary + if ($id == 10 && GETPOST('country', 'int') > 0) { + $search_country_id = GETPOST('country', 'int'); + } + $_POST = array('id'=>$id); } else { - dol_print_error($db); + if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { + setEventMessages($langs->transnoentities("ErrorRecordAlreadyExists"), null, 'errors'); + } else { + dol_print_error($db); + } } } - // Add new entry - $sql = "INSERT INTO ".$tabname[$id]." ("; - // List of fields - if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldinsert)) { - $sql .= $tabrowid[$id].","; - } - $sql .= $tabfieldinsert[$id]; - $sql .= ",active)"; - $sql .= " VALUES("; - - // List of values - if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldinsert)) { - $sql .= $newid.","; - } - $i = 0; - foreach ($listfieldinsert as $f => $value) { - $keycode = $listfieldvalue[$i]; - if (empty($keycode)) { - $keycode = $value; - } - - if ($value == 'price' || preg_match('/^amount/i', $value)) { - $_POST[$keycode] = price2num(GETPOST($keycode), 'MU'); - } elseif ($value == 'taux' || $value == 'localtax1') { - $_POST[$keycode] = price2num(GETPOST($keycode), 8); // Note that localtax2 can be a list of rates separated by coma like X:Y:Z - } elseif ($value == 'entity') { - $_POST[$keycode] = getEntity($tabname[$id]); - } - - if ($i) { - $sql .= ","; - } - - if ($keycode == 'sortorder') { // For column name 'sortorder', we use the field name 'position' - $sql .= (int) GETPOST('position', 'int'); - } elseif (GETPOST($keycode) == '' && !($keycode == 'code' && $id == 10)) { - $sql .= "null"; // For vat, we want/accept code = '' - } elseif ($keycode == 'content') { - $sql .= "'".$db->escape(GETPOST($keycode, 'restricthtml'))."'"; - } elseif (in_array($keycode, array('joinfile', 'private', 'pos', 'position', 'scale', 'use_default'))) { - $sql .= (int) GETPOST($keycode, 'int'); + // If verif ok and action modify, modify the line + if ($ok && GETPOST('actionmodify')) { + if ($tabrowid[$id]) { + $rowidcol = $tabrowid[$id]; } else { - $sql .= "'".$db->escape(GETPOST($keycode, 'nohtml'))."'"; + $rowidcol = "rowid"; } - $i++; - } - $sql .= ",1)"; - - dol_syslog("actionadd", LOG_DEBUG); - $resql = $db->query($sql); - if ($resql) { // Add is ok - setEventMessages($langs->transnoentities("RecordCreatedSuccessfully"), null, 'mesgs'); - - // Clean $_POST array, we keep only id of dictionary - if ($id == 10 && GETPOST('country', 'int') > 0) { - $search_country_id = GETPOST('country', 'int'); + // Modify entry + $sql = "UPDATE ".$tabname[$id]." SET "; + // Modifie valeur des champs + if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldmodify)) { + $sql .= $tabrowid[$id]."="; + $sql .= "'".$db->escape($rowid)."', "; } - $_POST = array('id'=>$id); - } else { - if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { - setEventMessages($langs->transnoentities("ErrorRecordAlreadyExists"), null, 'errors'); + $i = 0; + foreach ($listfieldmodify as $field) { + $keycode = $listfieldvalue[$i]; + if (empty($keycode)) { + $keycode = $field; + } + + if ($field == 'price' || preg_match('/^amount/i', $field)) { + $_POST[$keycode] = price2num(GETPOST($keycode), 'MU'); + } elseif ($field == 'taux' || $field == 'localtax1') { + $_POST[$keycode] = price2num(GETPOST($keycode), 8); // Note that localtax2 can be a list of rates separated by coma like X:Y:Z + } elseif ($field == 'entity') { + $_POST[$keycode] = getEntity($tabname[$id]); + } + + if ($i) { + $sql .= ","; + } + $sql .= $field."="; + if ($listfieldvalue[$i] == 'sortorder') { // For column name 'sortorder', we use the field name 'position' + $sql .= (int) GETPOST('position', 'int'); + } elseif (GETPOST($keycode) == '' && !($keycode == 'code' && $id == 10)) { + $sql .= "null"; // For vat, we want/accept code = '' + } elseif ($keycode == 'content') { + $sql .= "'".$db->escape(GETPOST($keycode, 'restricthtml'))."'"; + } elseif (in_array($keycode, array('joinfile', 'private', 'pos', 'position', 'scale', 'use_default'))) { + $sql .= (int) GETPOST($keycode, 'int'); + } else { + $sql .= "'".$db->escape(GETPOST($keycode, 'nohtml'))."'"; + } + + $i++; + } + if (in_array($rowidcol, array('code', 'code_iso'))) { + $sql .= " WHERE ".$rowidcol." = '".$db->escape($rowid)."'"; } else { - dol_print_error($db); + $sql .= " WHERE ".$rowidcol." = ".((int) $rowid); + } + if (in_array('entity', $listfieldmodify)) { + $sql .= " AND entity = ".((int) getEntity($tabname[$id], 0)); + } + + dol_syslog("actionmodify", LOG_DEBUG); + //print $sql; + $resql = $db->query($sql); + if (!$resql) { + setEventMessages($db->error(), null, 'errors'); } } + //$_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition } - // If verif ok and action modify, modify the line - if ($ok && GETPOST('actionmodify')) { + if (GETPOST('actioncancel')) { + //$_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition + } + + if ($action == 'confirm_delete' && $confirm == 'yes') { // delete if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } else { $rowidcol = "rowid"; } - // Modify entry - $sql = "UPDATE ".$tabname[$id]." SET "; - // Modifie valeur des champs - if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldmodify)) { - $sql .= $tabrowid[$id]."="; - $sql .= "'".$db->escape($rowid)."', "; - } - $i = 0; - foreach ($listfieldmodify as $field) { - $keycode = $listfieldvalue[$i]; - if (empty($keycode)) { - $keycode = $field; - } + $sql = "DELETE FROM ".$tabname[$id]." WHERE ".$rowidcol."='".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); - if ($field == 'price' || preg_match('/^amount/i', $field)) { - $_POST[$keycode] = price2num(GETPOST($keycode), 'MU'); - } elseif ($field == 'taux' || $field == 'localtax1') { - $_POST[$keycode] = price2num(GETPOST($keycode), 8); // Note that localtax2 can be a list of rates separated by coma like X:Y:Z - } elseif ($field == 'entity') { - $_POST[$keycode] = getEntity($tabname[$id]); - } - - if ($i) { - $sql .= ","; - } - $sql .= $field."="; - if ($listfieldvalue[$i] == 'sortorder') { // For column name 'sortorder', we use the field name 'position' - $sql .= (int) GETPOST('position', 'int'); - } elseif (GETPOST($keycode) == '' && !($keycode == 'code' && $id == 10)) { - $sql .= "null"; // For vat, we want/accept code = '' - } elseif ($keycode == 'content') { - $sql .= "'".$db->escape(GETPOST($keycode, 'restricthtml'))."'"; - } elseif (in_array($keycode, array('joinfile', 'private', 'pos', 'position', 'scale', 'use_default'))) { - $sql .= (int) GETPOST($keycode, 'int'); + dol_syslog("delete", LOG_DEBUG); + $result = $db->query($sql); + if (!$result) { + if ($db->errno() == 'DB_ERROR_CHILD_EXISTS') { + setEventMessages($langs->transnoentities("ErrorRecordIsUsedByChild"), null, 'errors'); } else { - $sql .= "'".$db->escape(GETPOST($keycode, 'nohtml'))."'"; + dol_print_error($db); } - - $i++; - } - if (in_array($rowidcol, array('code', 'code_iso'))) { - $sql .= " WHERE ".$rowidcol." = '".$db->escape($rowid)."'"; - } else { - $sql .= " WHERE ".$rowidcol." = ".((int) $rowid); - } - if (in_array('entity', $listfieldmodify)) { - $sql .= " AND entity = ".((int) getEntity($tabname[$id], 0)); - } - - dol_syslog("actionmodify", LOG_DEBUG); - //print $sql; - $resql = $db->query($sql); - if (!$resql) { - setEventMessages($db->error(), null, 'errors'); } } - //$_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition -} -if (GETPOST('actioncancel')) { - //$_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition -} + // activate + if ($action == $acts[0]) { + if ($tabrowid[$id]) { + $rowidcol = $tabrowid[$id]; + } else { + $rowidcol = "rowid"; + } -if ($action == 'confirm_delete' && $confirm == 'yes') { // delete - if ($tabrowid[$id]) { - $rowidcol = $tabrowid[$id]; - } else { - $rowidcol = "rowid"; + if ($rowid) { + $sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE ".$rowidcol."='".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); + } elseif ($code) { + $sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); + } + + $result = $db->query($sql); + if (!$result) { + dol_print_error($db); + } } - $sql = "DELETE FROM ".$tabname[$id]." WHERE ".$rowidcol."='".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); - - dol_syslog("delete", LOG_DEBUG); - $result = $db->query($sql); - if (!$result) { - if ($db->errno() == 'DB_ERROR_CHILD_EXISTS') { - setEventMessages($langs->transnoentities("ErrorRecordIsUsedByChild"), null, 'errors'); + // disable + if ($action == $acts[1]) { + if ($tabrowid[$id]) { + $rowidcol = $tabrowid[$id]; } else { + $rowidcol = "rowid"; + } + + if ($rowid) { + $sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE ".$rowidcol."='".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); + } elseif ($code) { + $sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); + } + + $result = $db->query($sql); + if (!$result) { + dol_print_error($db); + } + } + + // favorite + if ($action == 'activate_favorite') { + if ($tabrowid[$id]) { + $rowidcol = $tabrowid[$id]; + } else { + $rowidcol = "rowid"; + } + + if ($rowid) { + $sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE ".$rowidcol."='".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); + } elseif ($code) { + $sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); + } + + $result = $db->query($sql); + if (!$result) { + dol_print_error($db); + } + } + + // disable favorite + if ($action == 'disable_favorite') { + if ($tabrowid[$id]) { + $rowidcol = $tabrowid[$id]; + } else { + $rowidcol = "rowid"; + } + + if ($rowid) { + $sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE ".$rowidcol."='".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); + } elseif ($code) { + $sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); + } + + $result = $db->query($sql); + if (!$result) { + dol_print_error($db); + } + } + + // Is in EEC - Activate + if ($action == 'activate_eec') { + if ($tabrowid[$id]) { + $rowidcol = $tabrowid[$id]; + } else { + $rowidcol = "rowid"; + } + + if ($rowid) { + $sql = "UPDATE ".$tabname[$id]." SET eec = 1 WHERE ".$rowidcol."='".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); + } elseif ($code) { + $sql = "UPDATE ".$tabname[$id]." SET eec = 1 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); + } + + $result = $db->query($sql); + if (!$result) { + dol_print_error($db); + } + } + + // Is in EEC - Disable + if ($action == 'disable_eec') { + if ($tabrowid[$id]) { + $rowidcol = $tabrowid[$id]; + } else { + $rowidcol = "rowid"; + } + + if ($rowid) { + $sql = "UPDATE ".$tabname[$id]." SET eec = 0 WHERE ".$rowidcol."='".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); + } elseif ($code) { + $sql = "UPDATE ".$tabname[$id]." SET eec = 0 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); + } + + $result = $db->query($sql); + if (!$result) { dol_print_error($db); } } } - -// activate -if ($action == $acts[0]) { - if ($tabrowid[$id]) { - $rowidcol = $tabrowid[$id]; - } else { - $rowidcol = "rowid"; - } - - if ($rowid) { - $sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE ".$rowidcol."='".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); - } elseif ($code) { - $sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); - } - - $result = $db->query($sql); - if (!$result) { - dol_print_error($db); - } -} - -// disable -if ($action == $acts[1]) { - if ($tabrowid[$id]) { - $rowidcol = $tabrowid[$id]; - } else { - $rowidcol = "rowid"; - } - - if ($rowid) { - $sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE ".$rowidcol."='".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); - } elseif ($code) { - $sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); - } - - $result = $db->query($sql); - if (!$result) { - dol_print_error($db); - } -} - -// favorite -if ($action == 'activate_favorite') { - if ($tabrowid[$id]) { - $rowidcol = $tabrowid[$id]; - } else { - $rowidcol = "rowid"; - } - - if ($rowid) { - $sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE ".$rowidcol."='".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); - } elseif ($code) { - $sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); - } - - $result = $db->query($sql); - if (!$result) { - dol_print_error($db); - } -} - -// disable favorite -if ($action == 'disable_favorite') { - if ($tabrowid[$id]) { - $rowidcol = $tabrowid[$id]; - } else { - $rowidcol = "rowid"; - } - - if ($rowid) { - $sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE ".$rowidcol."='".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); - } elseif ($code) { - $sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); - } - - $result = $db->query($sql); - if (!$result) { - dol_print_error($db); - } -} - -// Is in EEC - Activate -if ($action == 'activate_eec') { - if ($tabrowid[$id]) { - $rowidcol = $tabrowid[$id]; - } else { - $rowidcol = "rowid"; - } - - if ($rowid) { - $sql = "UPDATE ".$tabname[$id]." SET eec = 1 WHERE ".$rowidcol."='".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); - } elseif ($code) { - $sql = "UPDATE ".$tabname[$id]." SET eec = 1 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); - } - - $result = $db->query($sql); - if (!$result) { - dol_print_error($db); - } -} - -// Is in EEC - Disable -if ($action == 'disable_eec') { - if ($tabrowid[$id]) { - $rowidcol = $tabrowid[$id]; - } else { - $rowidcol = "rowid"; - } - - if ($rowid) { - $sql = "UPDATE ".$tabname[$id]." SET eec = 0 WHERE ".$rowidcol."='".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); - } elseif ($code) { - $sql = "UPDATE ".$tabname[$id]." SET eec = 0 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); - } - - $result = $db->query($sql); - if (!$result) { - dol_print_error($db); - } -} - /* * View */ From efbaf030ec90c0003843d36f5e90e46c6eff716e Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 24 Mar 2022 08:41:13 +0000 Subject: [PATCH 343/610] Fixing style errors. --- htdocs/admin/dict.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 7ea895c506a..e0daa01c417 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -723,8 +723,7 @@ if (GETPOST('button_removefilter', 'alpha') || GETPOST('button_removefilter.x', $search_code = ''; } -if (empty($reshook)) -{ +if (empty($reshook)) { // Actions add or modify an entry into a dictionary if (GETPOST('actionadd') || GETPOST('actionmodify')) { $listfield = explode(',', str_replace(' ', '', $tabfield[$id])); From 7fb343b3ef66b8e2835f4676c0a17ecffdeec7a4 Mon Sep 17 00:00:00 2001 From: atm-greg Date: Thu, 24 Mar 2022 09:42:02 +0100 Subject: [PATCH 344/610] add context --- htdocs/admin/dict.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 7ea895c506a..346d6bec216 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -94,7 +94,7 @@ if (!GETPOSTISSET('search_country_id') && $search_country_id == '' && ($id == 2 $search_code = GETPOST('search_code', 'alpha'); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context -$hookmanager->initHooks(array('admin')); +$hookmanager->initHooks(array('admin', 'dictionaryadmin')); // This page is a generic page to edit dictionaries // Put here declaration of dictionaries properties From 37e589807d6ae1e6178d281a56f68068ff7aefbd Mon Sep 17 00:00:00 2001 From: jpb Date: Wed, 23 Mar 2022 14:01:30 +0100 Subject: [PATCH 345/610] add trigger create on expensereportdet --- .../class/expensereport.class.php | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index be49b0a8c0c..fa8f9a6e1a8 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -2752,6 +2752,17 @@ class ExpenseReportLine if ($resql) { $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.'expensereport_det'); + + if (!$error && !$notrigger) { + // Call triggers + $result = $this->call_trigger('EXPENSE_REPORT_DET_CREATE', $user); + if ($result < 0) { + $error++; + } + // End call triggers + } + + if (!$fromaddline) { $tmpparent = new ExpenseReport($this->db); $tmpparent->fetch($this->fk_expensereport); @@ -2908,4 +2919,40 @@ class ExpenseReportLine return -2; } } + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Call trigger based on this instance. + * Some context information may also be provided into array property this->context. + * 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 $triggerName trigger's name to execute + * @param User $user Object user + * @return int Result of run_triggers + */ + public function call_trigger($triggerName, $user) + { + // phpcs:enable + global $langs, $conf; + + if (!is_object($langs)) { // If lang was not defined, we set it. It is required by run_triggers. + include_once DOL_DOCUMENT_ROOT.'/core/class/translate.class.php'; + $langs = new Translate('', $conf); + } + + include_once DOL_DOCUMENT_ROOT.'/core/class/interfaces.class.php'; + $interface = new Interfaces($this->db); + $result = $interface->run_triggers($triggerName, $this, $user, $langs, $conf); + + if ($result < 0) { + if (!empty($this->errors)) { + $this->errors = array_unique(array_merge($this->errors, $interface->errors)); // We use array_unique because when a trigger call another trigger on same object, this->errors is added twice. + } else { + $this->errors = $interface->errors; + } + } + return $result; + } + } From a577956b737813fb4625496361a0431afd82cc9c Mon Sep 17 00:00:00 2001 From: jpb Date: Wed, 23 Mar 2022 14:57:30 +0100 Subject: [PATCH 346/610] ajout de nom de class dans les entes de ligne det en affichage --- htdocs/expensereport/card.php | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 307294d5422..696faf88514 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -2043,24 +2043,24 @@ if ($action == 'create') { $i = 0; $total = 0; print ''; - print ''.$langs->trans('LineNb').''; + print ''.$langs->trans('LineNb').''; //print ''.$langs->trans('Piece').''; - print ''.$langs->trans('Date').''; + print ''.$langs->trans('Date').''; if (!empty($conf->projet->enabled)) { - print ''.$langs->trans('Project').''; + print ''.$langs->trans('Project').''; } - print ''.$langs->trans('Type').''; + print ''.$langs->trans('Type').''; if (!empty($conf->global->MAIN_USE_EXPENSE_IK)) { - print ''.$langs->trans('CarCategory').''; + print ''.$langs->trans('CarCategory').''; } - print ''.$langs->trans('Description').''; - print ''.$langs->trans('VAT').''; - print ''.$langs->trans('PriceUHT').''; - print ''.$langs->trans('PriceUTTC').''; - print ''.$langs->trans('Qty').''; + print ''.$langs->trans('Description').''; + print ''.$langs->trans('VAT').''; + print ''.$langs->trans('PriceUHT').''; + print ''.$langs->trans('PriceUTTC').''; + print ''.$langs->trans('Qty').''; if ($action != 'editline') { - print ''.$langs->trans('AmountHT').''; - print ''.$langs->trans('AmountTTC').''; + print ''.$langs->trans('AmountHT').''; + print ''.$langs->trans('AmountTTC').''; } // Picture print ''; From 4bc75f6487a83db12b85dd91d7b8457bc6e3bcc1 Mon Sep 17 00:00:00 2001 From: jpb Date: Wed, 23 Mar 2022 15:05:38 +0100 Subject: [PATCH 347/610] ajout class name on create det --- htdocs/expensereport/card.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 696faf88514..14b0b381ba7 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -2473,21 +2473,21 @@ if ($action == 'create') { include DOL_DOCUMENT_ROOT.'/expensereport/tpl/expensereport_linktofile.tpl.php'; include DOL_DOCUMENT_ROOT.'/expensereport/tpl/expensereport_addfile.tpl.php'; - print ''; + print ''; print ''; - print ''.$langs->trans('Date').''; + print ''.$langs->trans('Date').''; if (!empty($conf->projet->enabled)) { print ''.$form->textwithpicto($langs->trans('Project'), $langs->trans("ClosedProjectsAreHidden")).''; } - print ''.$langs->trans('Type').''; + print ''.$langs->trans('Type').''; if (!empty($conf->global->MAIN_USE_EXPENSE_IK)) { print ''.$langs->trans('CarCategory').''; } - print ''.$langs->trans('Description').''; - print ''.$langs->trans('VAT').''; - print ''.$langs->trans('PriceUHT').''; - print ''.$langs->trans('PriceUTTC').''; - print ''.$langs->trans('Qty').''; + print ''.$langs->trans('Description').''; + print ''.$langs->trans('VAT').''; + print ''.$langs->trans('PriceUHT').''; + print ''.$langs->trans('PriceUTTC').''; + print ''.$langs->trans('Qty').''; print ''; print ''; print ''; From 7be3c8b64d7577b7419cd65e2995019d2a91f6b6 Mon Sep 17 00:00:00 2001 From: jpb Date: Wed, 23 Mar 2022 17:21:11 +0100 Subject: [PATCH 348/610] ajout de class pour les --- htdocs/expensereport/card.php | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 14b0b381ba7..79dd5e3b1c1 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -2042,7 +2042,7 @@ if ($action == 'create') { if (!empty($object->lines)) { $i = 0; $total = 0; - print ''; + print ''; print ''.$langs->trans('LineNb').''; //print ''.$langs->trans('Piece').''; print ''.$langs->trans('Date').''; @@ -2080,19 +2080,19 @@ if ($action == 'create') { $numline = $i + 1; if ($action != 'editline' || $line->rowid != GETPOST('rowid', 'int')) { - print ''; + print ''; // Num - print ''; + print ''; print $numline; print ''; // Date - print ''.dol_print_date($db->jdate($line->date), 'day').''; + print ''.dol_print_date($db->jdate($line->date), 'day').''; // Project if (!empty($conf->projet->enabled)) { - print ''; + print ''; if ($line->fk_project > 0) { $projecttmp->id = $line->fk_project; $projecttmp->ref = $line->projet_ref; @@ -2118,26 +2118,26 @@ if ($action == 'create') { } // Type of fee - print ''; + print ''; $labeltype = ($langs->trans(($line->type_fees_code)) == $line->type_fees_code ? $line->type_fees_libelle : $langs->trans($line->type_fees_code)); print $labeltype; print ''; // IK if (!empty($conf->global->MAIN_USE_EXPENSE_IK)) { - print ''; + print ''; print dol_getIdFromCode($db, $line->fk_c_exp_tax_cat, 'c_exp_tax_cat', 'rowid', 'label'); print ''; } // Comment - print ''.dol_nl2br($line->comments).''; + print ''.dol_nl2br($line->comments).''; // VAT rate - print ''.vatrate($line->vatrate.($line->vat_src_code ? ' ('.$line->vat_src_code.')' : ''), true).''; + print ''.vatrate($line->vatrate.($line->vat_src_code ? ' ('.$line->vat_src_code.')' : ''), true).''; // Unit price HT - print ''; + print ''; if (!empty($line->value_unit_ht)) { print price($line->value_unit_ht); } else { @@ -2147,13 +2147,13 @@ if ($action == 'create') { } print ''; - print ''.price($line->value_unit).''; + print ''.price($line->value_unit).''; - print ''.dol_escape_htmltag($line->qty).''; + print ''.dol_escape_htmltag($line->qty).''; if ($action != 'editline') { - print ''.price($line->total_ht).''; - print ''.price($line->total_ttc).''; + print ''.price($line->total_ht).''; + print ''.price($line->total_ttc).''; } // Column with preview From 71c1f2de3cb2474928bf7a0039495e230e6e4576 Mon Sep 17 00:00:00 2001 From: jpb Date: Thu, 24 Mar 2022 09:38:23 +0100 Subject: [PATCH 349/610] add class td --- htdocs/expensereport/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 79dd5e3b1c1..1f874acca91 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -2420,7 +2420,7 @@ if ($action == 'create') { // Add line with link to add new file or attach to an existing file print ''; - print ''; + print ''; print ''.$langs->trans("UploadANewFileNow"); print img_picto($langs->trans("UploadANewFileNow"), 'chevron-down', '', false, 0, 0, '', 'marginleftonly'); print ''; From 671ab9a412b64cd926c08158cf2b3ab605f6f56b Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 24 Mar 2022 08:55:18 +0000 Subject: [PATCH 350/610] Fixing style errors. --- htdocs/expensereport/class/expensereport.class.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index fa8f9a6e1a8..b85691c586d 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -2954,5 +2954,4 @@ class ExpenseReportLine } return $result; } - } From 5f6437cbde2bac5d408b7f8ff5b21b8373bfbd77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 24 Mar 2022 10:46:30 +0100 Subject: [PATCH 351/610] remove debug --- htdocs/partnership/partnership_list.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/htdocs/partnership/partnership_list.php b/htdocs/partnership/partnership_list.php index dc9958fa3df..0f4aa61f621 100644 --- a/htdocs/partnership/partnership_list.php +++ b/htdocs/partnership/partnership_list.php @@ -245,10 +245,8 @@ if (empty($reshook)) { $nbok = 0; foreach ($toselect as $toselectid) { $result = $objecttmp->fetch($toselectid); - var_dump($objecttmp->status); if ($result > 0) { $result = $objecttmp->cancel($user, 0); - var_dump($result); if ($result == 0) { setEventMessages($langs->trans('StatusOfRefMustBe', $objecttmp->ref, $objecttmp->LibStatut($objecttmp::STATUS_APPROVED)), null, 'warnings'); $error++; From e157dc117db796e51061982685d8a03968e21c57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 24 Mar 2022 10:51:01 +0100 Subject: [PATCH 352/610] replace debug --- htdocs/salaries/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/salaries/card.php b/htdocs/salaries/card.php index 935b8deb83d..ebb46d775c7 100644 --- a/htdocs/salaries/card.php +++ b/htdocs/salaries/card.php @@ -3,7 +3,7 @@ * Copyright (C) 2014-2020 Laurent Destailleur * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2015 Charlie BENKE - * Copyright (C) 2018-2021 Frédéric France + * Copyright (C) 2018-2022 Frédéric France * Copyright (C) 2021 Gauthier VERDOL * * This program is free software; you can redistribute it and/or modify @@ -270,7 +270,7 @@ if ($action == 'add' && empty($cancel)) { $ret = $object->create($user); if ($ret < 0) { - var_dump($ret); + setEventMessages($object->error, $object->errors, 'errors'); $error++; } if (!empty($auto_create_paiement) && !$error) { From 2709e69a32610f2152209fd37a910f8794586653 Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Thu, 24 Mar 2022 10:59:18 +0100 Subject: [PATCH 353/610] rename $form into $formcategory --- htdocs/admin/ticket.php | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/htdocs/admin/ticket.php b/htdocs/admin/ticket.php index 6341e641194..ebf4187eabf 100644 --- a/htdocs/admin/ticket.php +++ b/htdocs/admin/ticket.php @@ -228,7 +228,7 @@ if ($action == 'setvarother') { $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); -$form = new FormCategory($db); +$formcategory = new FormCategory($db); $help_url = "FR:Module_Ticket"; $page_name = "TicketSetup"; @@ -335,7 +335,7 @@ foreach ($dirmodels as $reldir) { } print ''; - print $form->textwithpicto('', $htmltooltip, 1, 0); + print $formcategory->textwithpicto('', $htmltooltip, 1, 0); print ''; print ''; @@ -473,7 +473,7 @@ foreach ($dirmodels as $reldir) { print ''; - print $form->textwithpicto('', $htmltooltip, 1, 0); + print $formcategory->textwithpicto('', $htmltooltip, 1, 0); print ''; // Preview @@ -520,11 +520,11 @@ if ($conf->use_javascript_ajax) { print ajax_constantonoff('TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND'); } else { $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND", $arrval, $conf->global->TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND); + print $formcategory->selectarray("TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND", $arrval, $conf->global->TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND); } print ''; print ''; -print $form->textwithpicto('', $langs->trans("TicketsAutoReadTicketHelp"), 1, 'help'); +print $formcategory->textwithpicto('', $langs->trans("TicketsAutoReadTicketHelp"), 1, 'help'); print ''; print ''; @@ -536,11 +536,11 @@ if ($conf->use_javascript_ajax) { print ajax_constantonoff('TICKET_AUTO_ASSIGN_USER_CREATE'); } else { $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("TICKET_AUTO_ASSIGN_USER_CREATE", $arrval, $conf->global->TICKET_AUTO_ASSIGN_USER_CREATE); + print $formcategory->selectarray("TICKET_AUTO_ASSIGN_USER_CREATE", $arrval, $conf->global->TICKET_AUTO_ASSIGN_USER_CREATE); } print ''; print ''; -print $form->textwithpicto('', $langs->trans("TicketsAutoAssignTicketHelp"), 1, 'help'); +print $formcategory->textwithpicto('', $langs->trans("TicketsAutoAssignTicketHelp"), 1, 'help'); print ''; print ''; @@ -551,11 +551,11 @@ if ($conf->use_javascript_ajax) { print ajax_constantonoff('TICKET_NOTIFY_AT_CLOSING'); } else { $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("TICKET_NOTIFY_AT_CLOSING", $arrval, $conf->global->TICKET_NOTIFY_AT_CLOSING); + print $formcategory->selectarray("TICKET_NOTIFY_AT_CLOSING", $arrval, $conf->global->TICKET_NOTIFY_AT_CLOSING); } print ''; print ''; -print $form->textwithpicto('', $langs->trans("TicketsAutoNotifyCloseHelp"), 1, 'help'); +print $formcategory->textwithpicto('', $langs->trans("TicketsAutoNotifyCloseHelp"), 1, 'help'); print ''; print ''; @@ -568,13 +568,13 @@ if ($conf->use_javascript_ajax) { print ''.$langs->trans("TicketChooseProductCategory").''; print ''; -$form->selectProductCategory($conf->global->TICKET_PRODUCT_CATEGORY, 'product_category_id'); +$formcategory->selectProductCategory($conf->global->TICKET_PRODUCT_CATEGORY, 'product_category_id'); if ($conf->use_javascript_ajax) { print ajax_combobox('select_'.$htmlname); } print ''; print ''; -print $form->textwithpicto('', $langs->trans("TicketChooseProductCategoryHelp"), 1, 'help'); +print $formcategory->textwithpicto('', $langs->trans("TicketChooseProductCategoryHelp"), 1, 'help'); print ''; print ''; @@ -589,7 +589,7 @@ print ' '; print ''; -print $form->textwithpicto('', $langs->trans("TicketsDelayBeforeFirstAnswerHelp"), 1, 'help'); +print $formcategory->textwithpicto('', $langs->trans("TicketsDelayBeforeFirstAnswerHelp"), 1, 'help'); print ''; print ''; @@ -600,7 +600,7 @@ print ' '; print ''; -print $form->textwithpicto('', $langs->trans("TicketsDelayBetweenAnswersHelp"), 1, 'help'); +print $formcategory->textwithpicto('', $langs->trans("TicketsDelayBetweenAnswersHelp"), 1, 'help'); print ''; print ''; @@ -639,7 +639,7 @@ print ''.$langs->trans("TicketEmailNotificationFrom").'< print ''; print ''; print ''; -print $form->textwithpicto('', $langs->trans("TicketEmailNotificationFromHelp"), 1, 'help'); +print $formcategory->textwithpicto('', $langs->trans("TicketEmailNotificationFromHelp"), 1, 'help'); print ''; print ''; @@ -648,7 +648,7 @@ print ''.$langs->trans("TicketEmailNotificationTo").' (' print ''; print ''; print ''; -print $form->textwithpicto('', $langs->trans("TicketEmailNotificationToHelp"), 1, 'help'); +print $formcategory->textwithpicto('', $langs->trans("TicketEmailNotificationToHelp"), 1, 'help'); print ''; print ''; @@ -660,11 +660,11 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { print ajax_constantonoff('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS'); } else { $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS", $arrval, $conf->global->TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS); + print $formcategory->selectarray("TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS", $arrval, $conf->global->TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS); } print ''; print ''; - print $form->textwithpicto('', $langs->trans("TicketsEmailAlsoSendToMainAddressHelp"), 1, 'help'); + print $formcategory->textwithpicto('', $langs->trans("TicketsEmailAlsoSendToMainAddressHelp"), 1, 'help'); print ''; print ''; } @@ -678,7 +678,7 @@ $doleditor = new DolEditor('TICKET_MESSAGE_MAIL_INTRO', $mail_intro, '100%', 120 $doleditor->Create(); print ''; print ''; -print $form->textwithpicto('', $langs->trans("TicketMessageMailIntroHelpAdmin"), 1, 'help'); +print $formcategory->textwithpicto('', $langs->trans("TicketMessageMailIntroHelpAdmin"), 1, 'help'); print ''; // Texte de signature @@ -690,12 +690,12 @@ $doleditor = new DolEditor('TICKET_MESSAGE_MAIL_SIGNATURE', $mail_signature, '10 $doleditor->Create(); print ''; print ''; -print $form->textwithpicto('', $langs->trans("TicketMessageMailSignatureHelpAdmin"), 1, 'help'); +print $formcategory->textwithpicto('', $langs->trans("TicketMessageMailSignatureHelpAdmin"), 1, 'help'); print ''; print ''; -print $form->buttonsSaveCancel("Save", ''); +print $formcategory->buttonsSaveCancel("Save", ''); print ''; From 6dfad5d69fc97ae12f681e1ab974db66dc621b3d Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Thu, 24 Mar 2022 11:09:39 +0100 Subject: [PATCH 354/610] facture/card.php: replace redirection by = '' --- htdocs/compta/facture/card.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 1540846d99a..02120c57d99 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -306,8 +306,7 @@ if (empty($reshook)) { $last_of_type = $object->willBeLastOfSameType(); if (empty($object->date_validation) && !$last_of_type[0]) { setEventMessages($langs->transnoentities("ErrorInvoiceIsNotLastOfSameType", $object->ref, dol_print_date($object->date, 'day'), dol_print_date($last_of_type[1], 'day')), null, 'errors'); - header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$id); - exit; + $action = ''; } } From 6abeb2804eefa77cc9b1bce8ebad1534c147147e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 24 Mar 2022 11:47:12 +0100 Subject: [PATCH 355/610] Fix phpcs --- htdocs/comm/propal/list.php | 1 - htdocs/projet/card.php | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index ae9ff62c5b0..f193a9ab87b 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -382,7 +382,6 @@ if ($action == "sign" && $permissiontoclose) { foreach ($toselect as $checked) { if ($tmpproposal->fetch($checked) > 0) { if ($tmpproposal->statut == $tmpproposal::STATUS_VALIDATED) { - $tmpproposal->statut = $tmpproposal::STATUS_SIGNED;; if ($tmpproposal->closeProposal($user, $tmpproposal::STATUS_SIGNED) >= 0) { setEventMessage($tmpproposal->ref." ".$langs->trans('Signed'), 'mesgs'); diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 6ce6e20e753..93344b39cd0 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -186,7 +186,7 @@ if (empty($reshook)) { // -3 means type not found (PROJECTLEADER renamed, de-activated or deleted), so don't prevent creation if it has been the case if ($result == -3) { setEventMessage('ErrorPROJECTLEADERRoleMissingRestoreIt', 'errors'); - $error++; + $error++; } elseif ($result < 0) { $langs->load("errors"); setEventMessages($object->error, $object->errors, 'errors'); From 6438a9996036f7e47e1c87e5d0761889fa91f947 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 24 Mar 2022 11:48:51 +0100 Subject: [PATCH 356/610] Fix php syntax --- htdocs/comm/propal/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index f193a9ab87b..7a8fe187570 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -382,7 +382,7 @@ if ($action == "sign" && $permissiontoclose) { foreach ($toselect as $checked) { if ($tmpproposal->fetch($checked) > 0) { if ($tmpproposal->statut == $tmpproposal::STATUS_VALIDATED) { - $tmpproposal->statut = $tmpproposal::STATUS_SIGNED;; + $tmpproposal->statut = $tmpproposal::STATUS_SIGNED; if ($tmpproposal->closeProposal($user, $tmpproposal::STATUS_SIGNED) >= 0) { setEventMessage($tmpproposal->ref." ".$langs->trans('Signed'), 'mesgs'); } else { From 6c28426b3aacd6917f39196b3fe0eab83cdd037c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 24 Mar 2022 11:49:34 +0100 Subject: [PATCH 357/610] Fix tab --- htdocs/viewimage.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/viewimage.php b/htdocs/viewimage.php index 45f46159aa8..db03a0a79e6 100644 --- a/htdocs/viewimage.php +++ b/htdocs/viewimage.php @@ -113,7 +113,7 @@ if (is_numeric($entity)) { * @ignore * @return void */ -function llxHeader() +function llxHeader()sql { } /** @@ -237,8 +237,8 @@ if (empty($modulepart)) { // When logged in a different entity, medias cannot be accessed because $conf->$module->multidir_output // is not set on the requested entity, but they are public documents, so reset entity if ($modulepart === 'medias' && $entity != $conf->entity) { - $conf->entity = $entity; - $conf->setValues($db); + $conf->entity = $entity; + $conf->setValues($db); } $check_access = dol_check_secure_access_document($modulepart, $original_file, $entity, $user, $refname); From 154069179b5958ccde7531e58c43f38bcfb4594d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 24 Mar 2022 11:51:06 +0100 Subject: [PATCH 358/610] Fix php syntax --- htdocs/viewimage.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/viewimage.php b/htdocs/viewimage.php index db03a0a79e6..feec8acf254 100644 --- a/htdocs/viewimage.php +++ b/htdocs/viewimage.php @@ -113,7 +113,7 @@ if (is_numeric($entity)) { * @ignore * @return void */ -function llxHeader()sql +function llxHeader() { } /** From fdfbf05705751fd852e4957bd262c92d48fb8ddd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 24 Mar 2022 12:00:11 +0100 Subject: [PATCH 359/610] Update card.php --- htdocs/expensereport/card.php | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 1f874acca91..1718425e907 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -2080,15 +2080,15 @@ if ($action == 'create') { $numline = $i + 1; if ($action != 'editline' || $line->rowid != GETPOST('rowid', 'int')) { - print ''; + print ''; // Num - print ''; + print ''; print $numline; print ''; // Date - print ''.dol_print_date($db->jdate($line->date), 'day').''; + print ''.dol_print_date($db->jdate($line->date), 'day').''; // Project if (!empty($conf->projet->enabled)) { @@ -2118,26 +2118,26 @@ if ($action == 'create') { } // Type of fee - print ''; + print ''; $labeltype = ($langs->trans(($line->type_fees_code)) == $line->type_fees_code ? $line->type_fees_libelle : $langs->trans($line->type_fees_code)); print $labeltype; print ''; // IK if (!empty($conf->global->MAIN_USE_EXPENSE_IK)) { - print ''; + print ''; print dol_getIdFromCode($db, $line->fk_c_exp_tax_cat, 'c_exp_tax_cat', 'rowid', 'label'); print ''; } // Comment - print ''.dol_nl2br($line->comments).''; + print ''.dol_nl2br($line->comments).''; // VAT rate - print ''.vatrate($line->vatrate.($line->vat_src_code ? ' ('.$line->vat_src_code.')' : ''), true).''; + print ''.vatrate($line->vatrate.($line->vat_src_code ? ' ('.$line->vat_src_code.')' : ''), true).''; // Unit price HT - print ''; + print ''; if (!empty($line->value_unit_ht)) { print price($line->value_unit_ht); } else { @@ -2147,17 +2147,17 @@ if ($action == 'create') { } print ''; - print ''.price($line->value_unit).''; + print ''.price($line->value_unit).''; - print ''.dol_escape_htmltag($line->qty).''; + print ''.dol_escape_htmltag($line->qty).''; if ($action != 'editline') { - print ''.price($line->total_ht).''; - print ''.price($line->total_ttc).''; + print ''.price($line->total_ht).''; + print ''.price($line->total_ttc).''; } // Column with preview - print ''; + print ''; if ($line->fk_ecm_files > 0) { $modulepart = 'expensereport'; $maxheightmini = 32; @@ -2227,13 +2227,13 @@ if ($action == 'create') { } print ''; - print ''; + print ''; print !empty($line->rule_warning_message) ? img_warning(html_entity_decode($line->rule_warning_message)) : ' '; print ''; // Ajout des boutons de modification/suppression if (($object->status < ExpenseReport::STATUS_VALIDATED || $object->status == ExpenseReport::STATUS_REFUSED) && $user->rights->expensereport->creer) { - print ''; + print ''; print 'rowid.'">'; print img_edit(); From ea4b842c865d40cf61c9b224cb81e0e0615228a6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 24 Mar 2022 12:01:53 +0100 Subject: [PATCH 360/610] Update card.php --- htdocs/expensereport/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 1718425e907..9d9eebae245 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -2080,7 +2080,7 @@ if ($action == 'create') { $numline = $i + 1; if ($action != 'editline' || $line->rowid != GETPOST('rowid', 'int')) { - print ''; + print ''; // Num print ''; From cd969449f23acd0ae78170faf99dd0d2c22421c8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 24 Mar 2022 12:07:04 +0100 Subject: [PATCH 361/610] Replaced duplicated code with extends of CommonObjectLine --- .../class/expensereport.class.php | 38 +------------------ 1 file changed, 2 insertions(+), 36 deletions(-) diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index b85691c586d..f2f0b7dbf0d 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -26,6 +26,7 @@ * \brief File to manage Expense Reports */ require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/commonobjectline.class.php'; require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport_ik.class.php'; require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport_rule.class.php'; @@ -2545,7 +2546,7 @@ class ExpenseReport extends CommonObject /** * Class of expense report details lines */ -class ExpenseReportLine +class ExpenseReportLine extends CommonObjectLine { /** * @var DoliDB Database handler. @@ -2919,39 +2920,4 @@ class ExpenseReportLine return -2; } } - - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * Call trigger based on this instance. - * Some context information may also be provided into array property this->context. - * 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 $triggerName trigger's name to execute - * @param User $user Object user - * @return int Result of run_triggers - */ - public function call_trigger($triggerName, $user) - { - // phpcs:enable - global $langs, $conf; - - if (!is_object($langs)) { // If lang was not defined, we set it. It is required by run_triggers. - include_once DOL_DOCUMENT_ROOT.'/core/class/translate.class.php'; - $langs = new Translate('', $conf); - } - - include_once DOL_DOCUMENT_ROOT.'/core/class/interfaces.class.php'; - $interface = new Interfaces($this->db); - $result = $interface->run_triggers($triggerName, $this, $user, $langs, $conf); - - if ($result < 0) { - if (!empty($this->errors)) { - $this->errors = array_unique(array_merge($this->errors, $interface->errors)); // We use array_unique because when a trigger call another trigger on same object, this->errors is added twice. - } else { - $this->errors = $interface->errors; - } - } - return $result; - } } From 6302e114714752651beec391dd9c8c1a3872da34 Mon Sep 17 00:00:00 2001 From: GregM Date: Thu, 24 Mar 2022 12:24:33 +0100 Subject: [PATCH 362/610] update GRH redirection position --- htdocs/hrm/position.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/hrm/position.php b/htdocs/hrm/position.php index 86f7a5c74d3..f2fc49197a7 100644 --- a/htdocs/hrm/position.php +++ b/htdocs/hrm/position.php @@ -160,9 +160,9 @@ if (empty($reshook)) { $backurlforlist = dol_buildpath('/hrm/position_list.php', 1); //$backtopage = dol_buildpath('/hrm/position.php', 1) . '?fk_job=' . ($fk_job > 0 ? $fk_job : '__ID__'); - if (!empty($backtopage) || ($cancel && empty($fk_job))) { + if (!empty($backtopage) || ($cancel && $fk_job <= 0)) { if (!empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) { - if (empty($fk_job) && (($action != 'add' && $action != 'create') || $cancel)) { + if ($fk_job == -1 && (($action != 'add' && $action != 'create') || $cancel)) { $backtopage = $backurlforlist; } else { if ($fk_job > 0) { @@ -631,7 +631,7 @@ function DisplayPositionList() print ''; print ''; - $newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/hrm/position.php', 1) . '?action=create&backtopage=' . urlencode($_SERVER['PHP_SELF'].'?fk_job=' . $fk_job).'&fk_job=' . $fk_job, '', $permissiontoadd); + $newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/hrm/position.php', 1) . '?action=create&backtopage=' . urlencode($_SERVER['PHP_SELF']).'&fk_job=' . $fk_job, '', $permissiontoadd); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_' . $object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1); From d952419fac2ef68ca1e062141bd09e352a007e90 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 24 Mar 2022 12:25:42 +0100 Subject: [PATCH 363/610] Update llx_holiday.sql --- htdocs/install/mysql/tables/llx_holiday.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/tables/llx_holiday.sql b/htdocs/install/mysql/tables/llx_holiday.sql index d21889e3116..85bf97ebe62 100644 --- a/htdocs/install/mysql/tables/llx_holiday.sql +++ b/htdocs/install/mysql/tables/llx_holiday.sql @@ -31,7 +31,7 @@ description VARCHAR( 255 ) NOT NULL, date_debut DATE NOT NULL, date_fin DATE NOT NULL, halfday integer DEFAULT 0, -- 0=start morning and end afternoon, -1=start afternoon end afternoon, 1=start morning and end morning, 2=start afternoon and end morning -nb_open_day double(24,8) DEFAULT 0, +nb_open_day double(24,8) DEFAULT 0, -- denormalized number of open days of holiday. More reliable when re-calculated with num_open_days(date_debut, date_fin, halfday). statut integer NOT NULL DEFAULT 1, fk_validator integer NOT NULL, -- who should approve date_valid DATETIME DEFAULT NULL, -- date approval (both date valid and date_approval) From 8661902bfa51caf629d3679f52dcefad3f13db60 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 24 Mar 2022 12:26:31 +0100 Subject: [PATCH 364/610] Update llx_holiday.sql --- htdocs/install/mysql/tables/llx_holiday.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/tables/llx_holiday.sql b/htdocs/install/mysql/tables/llx_holiday.sql index 85bf97ebe62..54d5525bd54 100644 --- a/htdocs/install/mysql/tables/llx_holiday.sql +++ b/htdocs/install/mysql/tables/llx_holiday.sql @@ -31,7 +31,7 @@ description VARCHAR( 255 ) NOT NULL, date_debut DATE NOT NULL, date_fin DATE NOT NULL, halfday integer DEFAULT 0, -- 0=start morning and end afternoon, -1=start afternoon end afternoon, 1=start morning and end morning, 2=start afternoon and end morning -nb_open_day double(24,8) DEFAULT 0, -- denormalized number of open days of holiday. More reliable when re-calculated with num_open_days(date_debut, date_fin, halfday). +nb_open_day double(24,8) DEFAULT 0, -- denormalized number of open days of holiday. Not always set. More reliable when re-calculated with num_open_days(date_debut, date_fin, halfday). statut integer NOT NULL DEFAULT 1, fk_validator integer NOT NULL, -- who should approve date_valid DATETIME DEFAULT NULL, -- date approval (both date valid and date_approval) From 27d8691fccec80f6db4d0bf956f86008552e54c9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 24 Mar 2022 12:30:26 +0100 Subject: [PATCH 365/610] Use default to null --- htdocs/install/mysql/migration/15.0.0-16.0.0.sql | 2 +- htdocs/install/mysql/tables/llx_holiday.sql | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql index 8eb37fb4f31..26e424fca35 100644 --- a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql +++ b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql @@ -30,7 +30,7 @@ -- -- VPGSQL8.2 SELECT dol_util_rebuild_sequences(); -ALTER TABLE llx_holiday ADD COLUMN nb_open_day double(24,8) DEFAULT 0; +ALTER TABLE llx_holiday ADD COLUMN nb_open_day double(24,8) DEFAULT NULL; -- Missing in v15 or lower diff --git a/htdocs/install/mysql/tables/llx_holiday.sql b/htdocs/install/mysql/tables/llx_holiday.sql index 54d5525bd54..be468bd32a5 100644 --- a/htdocs/install/mysql/tables/llx_holiday.sql +++ b/htdocs/install/mysql/tables/llx_holiday.sql @@ -31,11 +31,11 @@ description VARCHAR( 255 ) NOT NULL, date_debut DATE NOT NULL, date_fin DATE NOT NULL, halfday integer DEFAULT 0, -- 0=start morning and end afternoon, -1=start afternoon end afternoon, 1=start morning and end morning, 2=start afternoon and end morning -nb_open_day double(24,8) DEFAULT 0, -- denormalized number of open days of holiday. Not always set. More reliable when re-calculated with num_open_days(date_debut, date_fin, halfday). -statut integer NOT NULL DEFAULT 1, -fk_validator integer NOT NULL, -- who should approve -date_valid DATETIME DEFAULT NULL, -- date approval (both date valid and date_approval) -fk_user_valid integer DEFAULT NULL, -- user approval (both user valid and user that approved) +nb_open_day double(24,8) DEFAULT NULL, -- denormalized number of open days of holiday. Not always set. More reliable when re-calculated with num_open_days(date_debut, date_fin, halfday). +statut integer NOT NULL DEFAULT 1, -- status of leave request +fk_validator integer NOT NULL, -- who should approve the leave +date_valid DATETIME DEFAULT NULL, -- date approval (currently both date valid and date_approval) +fk_user_valid integer DEFAULT NULL, -- user approval (currently both user valid and user that approved) date_approve DATETIME DEFAULT NULL, -- date approval (not used yet) fk_user_approve integer DEFAULT NULL, -- user approval (not used yet) date_refuse DATETIME DEFAULT NULL, From ef204b26206f9bfbc489d3afc21c634b19eb36fe Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 24 Mar 2022 12:52:04 +0100 Subject: [PATCH 366/610] Fix column conditions --- htdocs/mrp/mo_production.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/htdocs/mrp/mo_production.php b/htdocs/mrp/mo_production.php index bc1a0457325..1c6f3f7ec39 100644 --- a/htdocs/mrp/mo_production.php +++ b/htdocs/mrp/mo_production.php @@ -735,9 +735,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print $langs->trans("Warehouse"); } print ''; - if ($conf->productbatch->enabled) { + if ($conf->stock->enabled) { // Available - print ''; + print ''; if ($collapse || in_array($action, array('consumeorproduce', 'consumeandproduceall'))) { print $langs->trans("Stock"); } @@ -958,12 +958,14 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } // Lot Batch - print ''; - if ($line2['batch'] != '') { - $tmpbatch->fetch(0, $line2['fk_product'], $line2['batch']); - print $tmpbatch->getNomUrl(1); + if ($conf->productbatch->enabled) { + print ''; + if ($line2['batch'] != '') { + $tmpbatch->fetch(0, $line2['fk_product'], $line2['batch']); + print $tmpbatch->getNomUrl(1); + } + print ''; } - print ''; // Action delete line if ($permissiontodelete) { From a22d66b021344eae2a0ea7352ad37da73c5d63a1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 24 Mar 2022 13:31:03 +0100 Subject: [PATCH 367/610] css --- htdocs/bom/class/bom.class.php | 4 ++-- htdocs/core/class/commonobject.class.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index 20ff5fe27b1..09f69993310 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -78,7 +78,7 @@ class BOM extends CommonObject * 'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommanded to name the field fk_...). * 'searchall' is 1 if we want to search in this field when making a search from the quick search button. * 'isameasure' must be set to 1 if you want to have a total on list for this field. Field type must be summable like integer or double(24,8). - * 'css' and 'cssview' and 'csslist' is the CSS style to use on field. 'css' is used in creation and update. 'cssview' is used in view mode. 'csslist' is used for columns in lists. For example: 'maxwidth200', 'wordbreak', 'tdoverflowmax200' + * 'css' and 'cssview' and 'csslist' is the CSS style to use on field. 'css' is used in creation and update. 'cssview' is used in view mode. 'csslist' is used for columns in lists. For example: 'css'=>'minwidth300 maxwidth500 widthcentpercentminusx', 'cssview'=>'wordbreak', 'csslist'=>'tdoverflowmax200' * 'help' is a 'TranslationString' to use to show a tooltip on field. You can also use 'TranslationString:keyfortooltiponlick' for a tooltip on click. * 'showoncombobox' if value of the field must be visible into the label of the combobox that list record * 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code. @@ -97,7 +97,7 @@ class BOM extends CommonObject 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>"Id",), 'entity' => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=> 1, 'default'=>1, 'index'=>1, 'position'=>5), 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'noteditable'=>1, 'visible'=>4, 'position'=>10, 'notnull'=>1, 'default'=>'(PROV)', 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of BOM", 'showoncombobox'=>'1',), - 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'notnull'=>1, 'searchall'=>1, 'showoncombobox'=>'2', 'autofocusoncreate'=>1, 'css'=>'maxwidth300', 'csslist'=>'tdoverflowmax200'), + 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'notnull'=>1, 'searchall'=>1, 'showoncombobox'=>'2', 'autofocusoncreate'=>1, 'css'=>'minwidth300 maxwidth400', 'csslist'=>'tdoverflowmax200'), 'bomtype' => array('type'=>'integer', 'label'=>'Type', 'enabled'=>1, 'visible'=>1, 'position'=>33, 'notnull'=>1, 'default'=>'0', 'arrayofkeyval'=>array(0=>'Manufacturing', 1=>'Disassemble'), 'css'=>'minwidth175', 'csslist'=>'minwidth175 center'), //'bomtype' => array('type'=>'integer', 'label'=>'Type', 'enabled'=>1, 'visible'=>-1, 'position'=>32, 'notnull'=>1, 'default'=>'0', 'arrayofkeyval'=>array(0=>'Manufacturing')), 'fk_product' => array('type'=>'integer:Product:product/class/product.class.php:1:(finished IS NULL or finished <> 0)', 'label'=>'Product', 'picto'=>'product', 'enabled'=>1, 'visible'=>1, 'position'=>35, 'notnull'=>1, 'index'=>1, 'help'=>'ProductBOMHelp', 'css'=>'maxwidth500', 'csslist'=>'tdoverflowmax100'), diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index d76d39230ab..a0d1079072a 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -6668,7 +6668,7 @@ abstract class CommonObject // Add validation state class if (!empty($validationClass)) { - $morecss.= ' '.$validationClass; + $morecss.= $validationClass; } if (in_array($type, array('date'))) { From 8f25477db6844fa8530e1b192da9e88897427d48 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 24 Mar 2022 13:41:11 +0100 Subject: [PATCH 368/610] Debug v16 --- htdocs/bom/bom_net_needs.php | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/htdocs/bom/bom_net_needs.php b/htdocs/bom/bom_net_needs.php index 4b2d5cdecab..b0e8b544cb0 100644 --- a/htdocs/bom/bom_net_needs.php +++ b/htdocs/bom/bom_net_needs.php @@ -30,7 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php'; require_once DOL_DOCUMENT_ROOT.'/bom/lib/bom.lib.php'; // Load translation files required by the page -$langs->loadLangs(array("mrp", "other")); +$langs->loadLangs(array("mrp", "other", "stocks")); // Get parameters $id = GETPOST('id', 'int'); @@ -211,9 +211,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''.img_picto('', 'folder', 'class="paddingright"').$langs->trans("UndoExpandAll").' '; } print ''; - print ''.$langs->trans('Quantity').''; - print ''.$form->textwithpicto($langs->trans("PhysicalStock"), $text_stock_options, 1).''; - print ''.$form->textwithpicto($langs->trans("VirtualStock"), $langs->trans("VirtualStockDesc")).''; + print ''.$langs->trans('Quantity').''; + print ''.$form->textwithpicto($langs->trans("PhysicalStock"), $text_stock_options, 1).''; + print ''.$form->textwithpicto($langs->trans("VirtualStock"), $langs->trans("VirtualStockDesc")).''; print ''; if (! empty($TChildBom)) { if ($action == 'treeview') { @@ -227,9 +227,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print img_picto('', 'folder-open'); print ''; print ''; - print ''.$TProduct['qty'].''; - print ''; - print ''; + print ''.$TProduct['qty'].''; + print ''; + print ''; print ''; } if (! empty($TProduct['product'])) { @@ -241,9 +241,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if ($fk_bom != $object->id) print ''; else print ''; print ''.str_repeat($repeatChar, $TInfos['level']).$prod->getNomUrl(1).''; - print ''.$TInfos['qty'].''; - print ''.$prod->stock_reel.''; - print ''.$prod->stock_theorique.''; + print ''.$TInfos['qty'].''; + print ''.price2num($prod->stock_reel, 'MS').''; + print ''.$prod->stock_theorique.''; print ''; } } @@ -256,9 +256,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (empty($prod->stock_reel)) $prod->stock_reel = 0; print ''; print ''.$prod->getNomUrl(1).''; - print ''.$qty.''; - print ''.$prod->stock_reel.''; - print ''.$prod->stock_theorique.''; + print ''.$qty.''; + print ''.price2num($prod->stock_reel, 'MS').''; + print ''.$prod->stock_theorique.''; print ''; } } From 3056635aafc498519069befd631fb5d46af35430 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 24 Mar 2022 14:04:03 +0100 Subject: [PATCH 369/610] css --- htdocs/bom/bom_card.php | 2 +- htdocs/bom/bom_net_needs.php | 2 +- htdocs/bom/tpl/objectline_view.tpl.php | 18 ++++++++++-------- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index f6e40b511f1..96fb68b6e9b 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -519,7 +519,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $keyforbreak = 'duration'; include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php'; $object->calculateCosts(); - print ''.$form->textwithpicto($langs->trans("TotalCost"), $langs->trans("BOMTotalCost")).''.price($object->total_cost).''; + print ''.$form->textwithpicto($langs->trans("TotalCost"), $langs->trans("BOMTotalCost")).''.price($object->total_cost).''; print ''.$langs->trans("UnitCost").''.price($object->unit_cost).''; // Other attributes diff --git a/htdocs/bom/bom_net_needs.php b/htdocs/bom/bom_net_needs.php index b0e8b544cb0..30cd6792c55 100644 --- a/htdocs/bom/bom_net_needs.php +++ b/htdocs/bom/bom_net_needs.php @@ -170,7 +170,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $keyforbreak = 'duration'; include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php'; - print ''.$form->textwithpicto($langs->trans("TotalCost"), $langs->trans("BOMTotalCost")).''.price($object->total_cost).''; + print ''.$form->textwithpicto($langs->trans("TotalCost"), $langs->trans("BOMTotalCost")).''.price($object->total_cost).''; print ''.$langs->trans("UnitCost").''.price($object->unit_cost).''; // Other attributes diff --git a/htdocs/bom/tpl/objectline_view.tpl.php b/htdocs/bom/tpl/objectline_view.tpl.php index 8040310ea53..61b394a3b0f 100644 --- a/htdocs/bom/tpl/objectline_view.tpl.php +++ b/htdocs/bom/tpl/objectline_view.tpl.php @@ -126,7 +126,7 @@ print ''; $total_cost = 0; print ''; $coldisplay++; -echo price($line->total_cost); +echo ''.price($line->total_cost).''; print ''; if ($this->status == 0 && ($object_rights->write) && $action != 'selectlines') { @@ -152,12 +152,12 @@ if ($this->status == 0 && ($object_rights->write) && $action != 'selectlines') { print ''; $coldisplay++; if ($i > 0) { - print 'id.'">'; + print 'id.'">'; echo img_up('default', 0, 'imgupforline'); print ''; } if ($i < $num - 1) { - print 'id.'">'; + print 'id.'">'; echo img_down('default', 0, 'imgdownforline'); print ''; } @@ -236,15 +236,16 @@ if ($resql) { // Efficiency print ''.$sub_bom_line->efficiency.''; + // Cost if (!empty($sub_bom->id)) { $sub_bom->calculateCosts(); - print ''.price($sub_bom->total_cost * $sub_bom_line->qty * $line->qty).''; + print ''.price($sub_bom->total_cost * $sub_bom_line->qty * $line->qty).''; $total_cost+= $sub_bom->total_cost * $sub_bom_line->qty * $line->qty; } elseif ($sub_bom_product->cost_price > 0) { - print ''.price($sub_bom_product->cost_price * $sub_bom_line->qty * $line->qty).''; + print ''.price($sub_bom_product->cost_price * $sub_bom_line->qty * $line->qty).''; $total_cost+= $sub_bom_product->cost_price * $sub_bom_line->qty * $line->qty; } elseif ($sub_bom_product->pmp > 0) { // PMP if cost price isn't defined - print ''.price($sub_bom_product->pmp * $sub_bom_line->qty * $line->qty).''; + print ''.price($sub_bom_product->pmp * $sub_bom_line->qty * $line->qty).''; $total_cost.= $sub_bom_product->pmp * $sub_bom_line->qty * $line->qty; } else { // Minimum purchase price if cost price and PMP aren't defined $sql_supplier_price = 'SELECT MIN(price) AS min_price, quantity AS qty FROM '.MAIN_DB_PREFIX.'product_fournisseur_price'; @@ -254,7 +255,7 @@ if ($resql) { $obj = $object->db->fetch_object($resql_supplier_price); $line_cost = $obj->min_price/$obj->qty * $sub_bom_line->qty * $line->qty; - print ''.price($line_cost).''; + print ''.price($line_cost).''; $total_cost+= $line_cost; } } @@ -266,11 +267,12 @@ if ($resql) { } // Replace of the total_cost value by the sum of all sub-BOM lines total_cost +// TODO Remove this bad practice. We should not replace content of ouput using javascript but value should be good during generation of output. if ($total_cost > 0) { $line->total_cost = price($total_cost); ?> Date: Thu, 24 Mar 2022 14:09:46 +0100 Subject: [PATCH 370/610] Fix phpcs --- htdocs/compta/prelevement/card.php | 1 - htdocs/variants/card.php | 12 ++++-------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/htdocs/compta/prelevement/card.php b/htdocs/compta/prelevement/card.php index 0b1b82998b2..a56ba593a9c 100644 --- a/htdocs/compta/prelevement/card.php +++ b/htdocs/compta/prelevement/card.php @@ -312,7 +312,6 @@ if ($id > 0 || $ref) { $parameters = array(); $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook if (empty($reshook)) { - if (empty($object->date_trans)) { if ($object->type == 'bank-transfer') print dolGetButtonAction($langs->trans("SetToStatusSent"), '', 'default', 'card.php?action=settransmitted&token='.newToken().'&id='.$object->id, '', $user->rights->paymentbybanktransfer->send); else print dolGetButtonAction($langs->trans("SetToStatusSent"), '', 'default', 'card.php?action=settransmitted&token='.newToken().'&id='.$object->id, '', $user->rights->prelevement->bons->send); diff --git a/htdocs/variants/card.php b/htdocs/variants/card.php index 1a97c2252df..68bb8d60998 100644 --- a/htdocs/variants/card.php +++ b/htdocs/variants/card.php @@ -191,10 +191,8 @@ if ($action == 'create') { print ''; dol_set_focus('input[name="label"]'); -} - -// Part to edit record -elseif (($id || $ref) && $action == 'edit') { +} elseif (($id || $ref) && $action == 'edit') { + // Part to edit record print load_fiche_titre($langs->trans("ProductAttribute"), '', 'object_' . $object->picto); print '
'; @@ -224,10 +222,8 @@ elseif (($id || $ref) && $action == 'edit') { print '
'; print ''; -} - -// Part to show record -elseif ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'))) { +} elseif ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'))) { + // Part to show record $res = $object->fetch_optionals(); $head = productAttributePrepareHead($object); From e9aab2188ece8c83c7e994a6a0fdb066d4ac6a6c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 24 Mar 2022 15:39:02 +0100 Subject: [PATCH 371/610] css --- htdocs/website/index.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/website/index.php b/htdocs/website/index.php index d916d0a0e5f..5a093e898cd 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -2825,13 +2825,13 @@ if (!GETPOST('hide_websitemenu')) { if (in_array($action, array('editcss', 'editmenu', 'file_manager', 'replacesite', 'replacesiteconfirm'))) { if ($action == 'editcss') { - print ''; + print ''; } if (preg_match('/^create/', $action) && $action != 'file_manager' && $action != 'replacesite' && $action != 'replacesiteconfirm') { - print ''; + print ''; } if (preg_match('/^edit/', $action) && $action != 'file_manager' && $action != 'replacesite' && $action != 'replacesiteconfirm') { - print ''; + print ''; } if ($action != 'preview') { print ''; From d91db3fe55e7734babaf33fda0991aa7f75f2a89 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 24 Mar 2022 15:42:01 +0100 Subject: [PATCH 372/610] Fix: when cloning a website page, the page has the status draft. --- htdocs/website/class/websitepage.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/website/class/websitepage.class.php b/htdocs/website/class/websitepage.class.php index 0126f8a4dc4..db9e1e035e7 100644 --- a/htdocs/website/class/websitepage.class.php +++ b/htdocs/website/class/websitepage.class.php @@ -725,6 +725,7 @@ class WebsitePage extends CommonObject $object->fk_website = $newwebsite; } $object->import_key = ''; + $object->status = self::STATUS_DRAFT; // Create clone $object->context['createfromclone'] = 'createfromclone'; From e8dae7a8dbf556b01028fcaec1ca2e02d1754840 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 24 Mar 2022 16:34:08 +0100 Subject: [PATCH 373/610] FIX Multiccompany sharings compatibility --- htdocs/core/class/commonobject.class.php | 30 ++++++++++++++++-------- htdocs/product/class/product.class.php | 14 +++++------ htdocs/societe/class/societe.class.php | 24 +++++++++---------- 3 files changed, 39 insertions(+), 29 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index a0d1079072a..bedc17a8fc2 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -4374,9 +4374,10 @@ abstract class CommonObject * Check is done into this->childtables. There is no check into llx_element_element. * * @param int $id Force id of object + * @param int $entity Force entity to check * @return int <0 if KO, 0 if not used, >0 if already used */ - public function isObjectUsed($id = 0) + public function isObjectUsed($id = 0, $entity = 0) { global $langs; @@ -4399,11 +4400,21 @@ abstract class CommonObject // Test if child exists $haschild = 0; - foreach ($arraytoscan as $table => $elementname) { + foreach ($arraytoscan as $table => $element) { //print $id.'-'.$table.'-'.$elementname.'
'; - // Check if third party can be deleted - $sql = "SELECT COUNT(*) as nb from ".$this->db->prefix().$table; - $sql .= " WHERE ".$this->fk_element." = ".((int) $id); + // Check if element can be deleted + $sql = "SELECT COUNT(*) as nb"; + $sql.= " FROM ".$this->db->prefix().$table." as c"; + if (!empty($element['parent']) && !empty($element['parentkey'])) { + $sql.= ", ".$this->db->prefix().$element['parent']." as p"; + } + $sql.= " WHERE c.".$this->fk_element." = ".((int) $id); + if (!empty($element['parent']) && !empty($element['parentkey'])) { + $sql.= " AND c.".$element['parentkey']." = p.rowid"; + } + if (!empty($entity)) { + $sql.= " AND entity = ".((int) $entity); + } $resql = $this->db->query($sql); if ($resql) { $obj = $this->db->fetch_object($resql); @@ -4411,11 +4422,10 @@ abstract class CommonObject $langs->load("errors"); //print 'Found into table '.$table.', type '.$langs->transnoentitiesnoconv($elementname).', haschild='.$haschild; $haschild += $obj->nb; - if (is_numeric($elementname)) { // old usage - $this->errors[] = $langs->transnoentities("ErrorRecordHasAtLeastOneChildOfType", method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref, $table); - } else // new usage: $elementname=Translation key - { - $this->errors[] = $langs->transnoentities("ErrorRecordHasAtLeastOneChildOfType", method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref, $langs->transnoentitiesnoconv($elementname)); + if (is_numeric($element) || empty($element['name'])) { // old usage + $this->errors[] = $langs->trans("ErrorRecordHasAtLeastOneChildOfType", method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref, $table); + } else { // new usage: $element['name']=Translation key + $this->errors[] = $langs->trans("ErrorRecordHasAtLeastOneChildOfType", method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref, $langs->transnoentitiesnoconv($element['name'])); } break; // We found at least one, we stop here } diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 6e97e80fece..9792b11ce39 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -64,13 +64,13 @@ class Product extends CommonObject * @var array List of child tables. To test if we can delete object. */ protected $childtables = array( - 'supplier_proposaldet', - 'propaldet', - 'commandedet', - 'facturedet', - 'contratdet', - 'facture_fourn_det', - 'commande_fournisseurdet' + 'supplier_proposaldet' => array('parent' => 'supplier_proposal', 'parentkey' => 'fk_supplier_proposal'), + 'propaldet' => array('parent' => 'propal', 'parentkey' => 'fk_propal'), + 'commandedet' => array('parent' => 'commande', 'parentkey' => 'fk_commande'), + 'facturedet' => array('parent' => 'facture', 'parentkey' => 'fk_facture'), + 'contratdet' => array('parent' => 'contrat', 'parentkey' => 'fk_contrat'), + 'facture_fourn_det' => array('parent' => 'facture_fourn', 'parentkey' => 'fk_facture_fourn'), + 'commande_fournisseurdet' => array('parent' => 'commande_fournisseur', 'parentkey' => 'fk_commande') ); /** diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 89eeeaca8e5..bfcdce7d348 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -73,18 +73,18 @@ class Societe extends CommonObject * @var array List of child tables. To test if we can delete object. */ protected $childtables = array( - "supplier_proposal" => 'SupplierProposal', - "propal" => 'Proposal', - "commande" => 'Order', - "facture" => 'Invoice', - "facture_rec" => 'RecurringInvoiceTemplate', - "contrat" => 'Contract', - "fichinter" => 'Fichinter', - "facture_fourn" => 'SupplierInvoice', - "commande_fournisseur" => 'SupplierOrder', - "projet" => 'Project', - "expedition" => 'Shipment', - "prelevement_lignes" => 'DirectDebitRecord', + "supplier_proposal" => array('name' => 'SupplierProposal'), + "propal" => array('name' => 'Proposal'), + "commande" => array('name' => 'Order'), + "facture" => array('name' => 'Invoice'), + "facture_rec" => array('name' => 'RecurringInvoiceTemplate'), + "contrat" => array('name' => 'Contract'), + "fichinter" => array('name' => 'Fichinter'), + "facture_fourn" => array('name' => 'SupplierInvoice'), + "commande_fournisseur" => array('name' => 'SupplierOrder'), + "projet" => array('name' => 'Project'), + "expedition" => array('name' => 'Shipment'), + "prelevement_lignes" => array('name' => 'DirectDebitRecord'), ); /** From 6fdb140f0402a598ae7e2482f38b680859a94fb8 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 24 Mar 2022 16:54:02 +0100 Subject: [PATCH 374/610] FIX missing table alias --- htdocs/core/class/commonobject.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index bedc17a8fc2..23e66ed2064 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -4413,7 +4413,7 @@ abstract class CommonObject $sql.= " AND c.".$element['parentkey']." = p.rowid"; } if (!empty($entity)) { - $sql.= " AND entity = ".((int) $entity); + $sql.= " AND p.entity = ".((int) $entity); } $resql = $this->db->query($sql); if ($resql) { From c38437f0ded7c54fad4c363f6d44ff07119b2339 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 24 Mar 2022 17:12:37 +0100 Subject: [PATCH 375/610] FIX wrong error message --- htdocs/core/class/commonobject.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 23e66ed2064..ea7d0265ec1 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -4423,9 +4423,9 @@ abstract class CommonObject //print 'Found into table '.$table.', type '.$langs->transnoentitiesnoconv($elementname).', haschild='.$haschild; $haschild += $obj->nb; if (is_numeric($element) || empty($element['name'])) { // old usage - $this->errors[] = $langs->trans("ErrorRecordHasAtLeastOneChildOfType", method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref, $table); + $this->errors[] = $langs->transnoentitiesnoconv("ErrorRecordHasAtLeastOneChildOfType", method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref, $table); } else { // new usage: $element['name']=Translation key - $this->errors[] = $langs->trans("ErrorRecordHasAtLeastOneChildOfType", method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref, $langs->transnoentitiesnoconv($element['name'])); + $this->errors[] = $langs->transnoentitiesnoconv("ErrorRecordHasAtLeastOneChildOfType", method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref, $langs->transnoentitiesnoconv($element['name'])); } break; // We found at least one, we stop here } From 1c43617d9363eb26a4a65bb0c39bb87531fb103f Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Thu, 24 Mar 2022 17:34:50 +0100 Subject: [PATCH 376/610] FIX: contact card: single extrafield update failed --- htdocs/contact/card.php | 23 +++++++++++++++++++++++ htdocs/core/tpl/extrafields_view.tpl.php | 3 +++ 2 files changed, 26 insertions(+) diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index 0c95ecb7fd4..28a61ce5190 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -479,6 +479,29 @@ if (empty($reshook)) if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); } + // Update extrafields + if ($action == 'update_extras' && ! empty($user->rights->societe->contact->creer)) { + $object->oldcopy = dol_clone($object); + + // Fill array 'array_options' with data from update form + $ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'restricthtml')); + if ($ret < 0) { + $error++; + } + + if (!$error) { + $result = $object->insertExtraFields('CONTACT_MODIFY'); + if ($result < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + $error++; + } + } + + if ($error) { + $action = 'edit_extras'; + } + } + // Actions to send emails $triggersendname = 'CONTACT_SENTBYMAIL'; $paramname = 'id'; diff --git a/htdocs/core/tpl/extrafields_view.tpl.php b/htdocs/core/tpl/extrafields_view.tpl.php index 40ea3e0ce50..7f1ee1f37cb 100644 --- a/htdocs/core/tpl/extrafields_view.tpl.php +++ b/htdocs/core/tpl/extrafields_view.tpl.php @@ -150,6 +150,9 @@ if (empty($reshook) && is_array($extrafields->attributes[$object->table_element] if ($object->element == 'productlot') $permok = $user->rights->stock->creer; if ($object->element == 'facturerec') $permok = $user->rights->facture->creer; if ($object->element == 'mo') $permok = $user->rights->mrp->write; + if ($object->element == 'contact') { + $permok = $user->rights->societe->contact->creer; + } $isdraft = ((isset($object->statut) && $object->statut == 0) || (isset($object->status) && $object->status == 0)); if (($isdraft || !empty($extrafields->attributes[$object->table_element]['alwayseditable'][$tmpkeyextra])) From 1db60116e160344a4660901dd27e7f42175acb65 Mon Sep 17 00:00:00 2001 From: lvessiller Date: Thu, 24 Mar 2022 18:02:32 +0100 Subject: [PATCH 377/610] FIX search bracode rule and avoid undefined quantity on search in takepos --- htdocs/takepos/ajax/ajax.php | 4 +++- htdocs/takepos/index.php | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/takepos/ajax/ajax.php b/htdocs/takepos/ajax/ajax.php index 9b44e536a2b..a3bcc04b5c8 100644 --- a/htdocs/takepos/ajax/ajax.php +++ b/htdocs/takepos/ajax/ajax.php @@ -142,7 +142,7 @@ if ($action == 'getProducts') { } if (isset($barcode_value_list['ref'])) { - //search product from reference + // search product from reference $sql = "SELECT rowid, ref, label, tosell, tobuy, barcode, price"; $sql .= " FROM " . $db->prefix() . "product as p"; $sql .= " WHERE entity IN (" . getEntity('product') . ")"; @@ -151,6 +151,7 @@ if ($action == 'getProducts') { $sql .= " AND EXISTS (SELECT cp.fk_product FROM " . $db->prefix() . "categorie_product as cp WHERE cp.fk_product = p.rowid AND cp.fk_categorie IN (".$db->sanitize($filteroncategids)."))"; } $sql .= " AND tosell = 1"; + $sql .= " AND (barcode IS NULL OR barcode != '" . $db->escape($term) . "')"; $resql = $db->query($sql); if ($resql && $db->num_rows($resql) == 1) { @@ -263,6 +264,7 @@ if ($action == 'getProducts') { 'price' => $obj->price, 'object' => 'product', 'img' => $ig, + 'qty' => 1, //'price_formated' => price(price2num($obj->price, 'MU'), 1, $langs, 1, -1, -1, $conf->currency) ); } diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index 24a30b8ea7e..5650c0d4fdd 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -620,7 +620,7 @@ function Search2(keyCodeForEnter) { ChangeThirdparty(data[0]['rowid']); } else if ('product' == data[0]['object']) { - console.log("There is only 1 answer with barcode matching the search, so we add the product in basket"); + console.log("There is only 1 answer matching the search, so we add the product in basket, qty="+data[0]['qty']); ClickProduct(0, data[0]['qty']); } } From 08bc2a7ac0ce88ebd5fa58cbd485a95eef8c2b9a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 24 Mar 2022 19:27:42 +0100 Subject: [PATCH 378/610] Better modulebuilder design pattern --- .../class/fournisseur.commande.class.php | 113 +++++++++++------- htdocs/fourn/commande/list.php | 92 +++++++------- htdocs/langs/en_US/orders.lang | 2 + .../template/class/myobject.class.php | 2 +- .../modulebuilder/template/myobject_list.php | 2 +- 5 files changed, 116 insertions(+), 95 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 4c6ee247aeb..a195a2ed2e1 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -185,56 +185,79 @@ class CommandeFournisseur extends CommonOrder public $multicurrency_total_ttc; - + /** + * 'type' field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter[:Sortfield]]]', 'sellist:TableName:LabelFieldName[:KeyFieldName[:KeyFieldParent[:Filter[:Sortfield]]]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'text:none', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password') + * Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)" + * 'label' the translation key. + * 'picto' is code of a picto to show before value in forms + * 'enabled' is a condition when the field must be managed (Example: 1 or '$conf->global->MY_SETUP_PARAM' or '!empty($conf->multicurrency->enabled)' ...) + * 'position' is the sort order of field. + * 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0). + * 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). 5=Visible on list and view only (not create/not update). Using a negative value means field is not shown by default on list but can be selected for viewing) + * 'noteditable' says if field is not editable (1 or 0) + * 'default' is a default value for creation (can still be overwrote by the Setup of Default Values if field is editable in creation form). Note: If default is set to '(PROV)' and field is 'ref', the default value will be set to '(PROVid)' where id is rowid when a new record is created. + * 'index' if we want an index in database. + * 'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommanded to name the field fk_...). + * 'searchall' is 1 if we want to search in this field when making a search from the quick search button. + * 'isameasure' must be set to 1 or 2 if field can be used for measure. Field type must be summable like integer or double(24,8). Use 1 in most cases, or 2 if you don't want to see the column total into list (for example for percentage) + * 'css' and 'cssview' and 'csslist' is the CSS style to use on field. 'css' is used in creation and update. 'cssview' is used in view mode. 'csslist' is used for columns in lists. For example: 'css'=>'minwidth300 maxwidth500 widthcentpercentminusx', 'cssview'=>'wordbreak', 'csslist'=>'tdoverflowmax200' + * 'help' is a 'TranslationString' to use to show a tooltip on field. You can also use 'TranslationString:keyfortooltiponlick' for a tooltip on click. + * 'showoncombobox' if value of the field must be visible into the label of the combobox that list record + * 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code. + * 'arrayofkeyval' to set a list of values if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel"). Note that type can be 'integer' or 'varchar' + * 'autofocusoncreate' to have field having the focus on a create form. Only 1 field should have this property set to 1. + * 'comment' is not used. You can store here any text of your choice. It is not used by application. + * 'validate' is 1 if need to validate with $this->validateField() + * 'copytoclipboard' is 1 or 2 to allow to add a picto to copy value into clipboard (1=picto after label, 2=picto after value) + * + * Note: To have value dynamic, you can set value to 0 in definition and edit the value on the fly into the constructor. + */ public $fields = array( - 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10), - 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>15), - 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>20), - 'ref' =>array('type'=>'varchar(255)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'showoncombobox'=>1, 'position'=>25), - 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>30, 'index'=>1), + 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>10), + 'ref' =>array('type'=>'varchar(255)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'showoncombobox'=>1, 'position'=>25, 'searchall'=>1), 'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'Ref ext', 'enabled'=>1, 'visible'=>0, 'position'=>35), - 'ref_supplier' =>array('type'=>'varchar(255)', 'label'=>'RefSupplier', 'enabled'=>1, 'visible'=>-1, 'position'=>40), - 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>1, 'visible'=>-1, 'position'=>45), - 'date_creation' =>array('type'=>'datetime', 'label'=>'Date creation', 'enabled'=>1, 'visible'=>-1, 'position'=>50), - 'date_valid' =>array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>55), - 'date_approve' =>array('type'=>'datetime', 'label'=>'Date approve', 'enabled'=>1, 'visible'=>-1, 'position'=>60), - 'date_approve2' =>array('type'=>'datetime', 'label'=>'Date approve2', 'enabled'=>1, 'visible'=>-1, 'position'=>65), - 'date_commande' =>array('type'=>'date', 'label'=>'Date commande', 'enabled'=>1, 'visible'=>-1, 'position'=>70), - 'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user author', 'enabled'=>1, 'visible'=>-1, 'position'=>75), - 'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>80), - 'fk_user_valid' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>85), - 'fk_user_approve' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserApproval', 'enabled'=>1, 'visible'=>-1, 'position'=>90), - 'fk_user_approve2' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserSecondApproval', 'enabled'=>1, 'visible'=>-1, 'position'=>95), - 'source' =>array('type'=>'smallint(6)', 'label'=>'Source', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>100), - 'billed' =>array('type'=>'smallint(6)', 'label'=>'Billed', 'enabled'=>1, 'visible'=>-1, 'position'=>110), - 'amount_ht' =>array('type'=>'double(24,8)', 'label'=>'Amount ht', 'enabled'=>1, 'visible'=>-1, 'position'=>115), - 'remise_percent' =>array('type'=>'double', 'label'=>'Remise percent', 'enabled'=>1, 'visible'=>-1, 'position'=>120), - 'remise' =>array('type'=>'double', 'label'=>'Remise', 'enabled'=>1, 'visible'=>-1, 'position'=>125), - 'total_tva' =>array('type'=>'double(24,8)', 'label'=>'Tva', 'enabled'=>1, 'visible'=>-1, 'position'=>130, 'isameasure'=>1), - 'localtax1' =>array('type'=>'double(24,8)', 'label'=>'Localtax1', 'enabled'=>1, 'visible'=>-1, 'position'=>135, 'isameasure'=>1), - 'localtax2' =>array('type'=>'double(24,8)', 'label'=>'Localtax2', 'enabled'=>1, 'visible'=>-1, 'position'=>140, 'isameasure'=>1), - 'total_ht' =>array('type'=>'double(24,8)', 'label'=>'TotalHT', 'enabled'=>1, 'visible'=>-1, 'position'=>145, 'isameasure'=>1), + 'ref_supplier' =>array('type'=>'varchar(255)', 'label'=>'RefOrderSupplierShort', 'enabled'=>1, 'visible'=>1, 'position'=>40, 'searchall'=>1), + 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>1, 'visible'=>-1, 'position'=>45), + 'date_valid' =>array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>60), + 'date_approve' =>array('type'=>'datetime', 'label'=>'DateApprove', 'enabled'=>1, 'visible'=>-1, 'position'=>62), + 'date_approve2' =>array('type'=>'datetime', 'label'=>'DateApprove2', 'enabled'=>1, 'visible'=>3, 'position'=>64), + 'date_commande' =>array('type'=>'date', 'label'=>'OrderDateShort', 'enabled'=>1, 'visible'=>1, 'position'=>70), + 'date_livraison' =>array('type'=>'datetime', 'label'=>'DeliveryDate', 'enabled'=>'empty($conf->global->ORDER_DISABLE_DELIVERY_DATE)', 'visible'=>1, 'position'=>74), + 'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>3, 'position'=>75), + 'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>3, 'notnull'=>-1, 'position'=>80), + 'fk_user_valid' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>3, 'position'=>85), + 'fk_user_approve' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserApproval', 'enabled'=>1, 'visible'=>3, 'position'=>90), + 'fk_user_approve2' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserApproval2', 'enabled'=>1, 'visible'=>3, 'position'=>95), + 'source' =>array('type'=>'smallint(6)', 'label'=>'Source', 'enabled'=>1, 'visible'=>3, 'notnull'=>1, 'position'=>100), + 'billed' =>array('type'=>'smallint(6)', 'label'=>'Billed', 'enabled'=>1, 'visible'=>1, 'position'=>110), + 'total_tva' =>array('type'=>'double(24,8)', 'label'=>'Tva', 'enabled'=>1, 'visible'=>1, 'position'=>130, 'isameasure'=>1), + 'localtax1' =>array('type'=>'double(24,8)', 'label'=>'Localtax1', 'enabled'=>1, 'visible'=>3, 'position'=>135, 'isameasure'=>1), + 'localtax2' =>array('type'=>'double(24,8)', 'label'=>'Localtax2', 'enabled'=>1, 'visible'=>3, 'position'=>140, 'isameasure'=>1), + 'total_ht' =>array('type'=>'double(24,8)', 'label'=>'TotalHT', 'enabled'=>1, 'visible'=>1, 'position'=>145, 'isameasure'=>1), 'total_ttc' =>array('type'=>'double(24,8)', 'label'=>'TotalTTC', 'enabled'=>1, 'visible'=>-1, 'position'=>150, 'isameasure'=>1), 'note_private' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>155), - 'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>160), + 'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>160, 'searchall'=>1), 'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'ModelPDF', 'enabled'=>1, 'visible'=>0, 'position'=>165), - 'fk_input_method' =>array('type'=>'integer', 'label'=>'InputMethod', 'enabled'=>1, 'visible'=>-1, 'position'=>170), - 'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'PaymentTerm', 'enabled'=>1, 'visible'=>-1, 'position'=>175), - 'fk_mode_reglement' =>array('type'=>'integer', 'label'=>'PaymentMode', 'enabled'=>1, 'visible'=>-1, 'position'=>180), - 'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>-1, 'position'=>190), - 'date_livraison' =>array('type'=>'datetime', 'label'=>'DeliveryDate', 'enabled'=>1, 'visible'=>-1, 'position'=>195), - 'fk_account' =>array('type'=>'integer', 'label'=>'Fk account', 'enabled'=>1, 'visible'=>-1, 'position'=>200), - 'fk_incoterms' =>array('type'=>'integer', 'label'=>'IncotermCode', 'enabled'=>1, 'visible'=>-1, 'position'=>205), - 'location_incoterms' =>array('type'=>'varchar(255)', 'label'=>'IncotermLocation', 'enabled'=>1, 'visible'=>-1, 'position'=>210), - 'fk_multicurrency' =>array('type'=>'integer', 'label'=>'Fk multicurrency', 'enabled'=>1, 'visible'=>-1, 'position'=>215), - 'multicurrency_code' =>array('type'=>'varchar(255)', 'label'=>'MulticurrencyCode', 'enabled'=>1, 'visible'=>-1, 'position'=>220), - 'multicurrency_tx' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyRate', 'enabled'=>1, 'visible'=>-1, 'position'=>225), - 'multicurrency_total_ht' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyTotalHT', 'enabled'=>1, 'visible'=>-1, 'position'=>230), - 'multicurrency_total_tva' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyTotalVAT', 'enabled'=>1, 'visible'=>-1, 'position'=>235), - 'multicurrency_total_ttc' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyTotalTTC', 'enabled'=>1, 'visible'=>-1, 'position'=>240), - 'last_main_doc' =>array('type'=>'varchar(255)', 'label'=>'LastMainDoc', 'enabled'=>1, 'visible'=>-1, 'position'=>245), - 'fk_statut' =>array('type'=>'smallint(6)', 'label'=>'Status', 'enabled'=>1, 'visible'=>-1, 'position'=>500), - 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>900), + 'fk_input_method' =>array('type'=>'integer', 'label'=>'OrderMode', 'enabled'=>1, 'visible'=>3, 'position'=>170), + 'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'PaymentTerm', 'enabled'=>1, 'visible'=>3, 'position'=>175), + 'fk_mode_reglement' =>array('type'=>'integer', 'label'=>'PaymentMode', 'enabled'=>1, 'visible'=>3, 'position'=>180), + 'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>0, 'position'=>190), + 'fk_account' =>array('type'=>'integer', 'label'=>'BankAccount', 'enabled'=>1, 'visible'=>3, 'position'=>200), + 'fk_incoterms' =>array('type'=>'integer', 'label'=>'IncotermCode', 'enabled'=>1, 'visible'=>3, 'position'=>205), + 'location_incoterms' =>array('type'=>'varchar(255)', 'label'=>'IncotermLocation', 'enabled'=>1, 'visible'=>3, 'position'=>210), + 'fk_multicurrency' =>array('type'=>'integer', 'label'=>'Fk multicurrency', 'enabled'=>1, 'visible'=>0, 'position'=>215), + 'multicurrency_code' =>array('type'=>'varchar(255)', 'label'=>'Currency', 'enabled'=>'!empty($conf->multicurrency->enabled)', 'visible'=>-1, 'position'=>220), + 'multicurrency_tx' =>array('type'=>'double(24,8)', 'label'=>'CurrencyRate', 'enabled'=>'!empty($conf->multicurrency->enabled)', 'visible'=>-1, 'position'=>225), + 'multicurrency_total_ht' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyAmountHT', 'enabled'=>'!empty($conf->multicurrency->enabled)', 'visible'=>-1, 'position'=>230), + 'multicurrency_total_tva' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyAmountVAT', 'enabled'=>'!empty($conf->multicurrency->enabled)', 'visible'=>-1, 'position'=>235), + 'multicurrency_total_ttc' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyAmountTTC', 'enabled'=>'!empty($conf->multicurrency->enabled)', 'visible'=>-1, 'position'=>240), + 'date_creation' =>array('type'=>'datetime', 'label'=>'Date creation', 'enabled'=>1, 'visible'=>-1, 'position'=>500), + 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>46), + 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>1000, 'index'=>1), + 'tms'=>array('type'=>'datetime', 'label'=>"DateModificationShort", 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>501), + 'last_main_doc' =>array('type'=>'varchar(255)', 'label'=>'LastMainDoc', 'enabled'=>1, 'visible'=>0, 'position'=>700), + 'fk_statut' =>array('type'=>'smallint(6)', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'position'=>701), + 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>0, 'position'=>900), ); diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index e5cc12fe1c4..cd9a1922524 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -162,49 +162,45 @@ $extrafields->fetch_name_optionals_label($object->table_element); $search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_'); // List of fields to search into when doing a "search in all" -$fieldstosearchall = array( - 'cf.ref'=>'Ref', - 'cf.ref_supplier'=>'RefOrderSupplier', - 'pd.description'=>'Description', - 's.nom'=>"ThirdParty", - 's.name_alias'=>"AliasNameShort", - 's.zip'=>"Zip", - 's.town'=>"Town", - 'cf.note_public'=>'NotePublic', -); +$fieldstosearchall = array(); +foreach ($object->fields as $key => $val) { + if (!empty($val['searchall'])) { + $fieldstosearchall['cf.'.$key] = $val['label']; + } +} +$fieldstosearchall['pd.description'] = 'Description'; +$fieldstosearchall['s.nom'] = "ThirdParty"; +$fieldstosearchall['s.name_alias'] = "AliasNameShort"; +$fieldstosearchall['s.zip'] = "Zip"; +$fieldstosearchall['s.town'] = "Town"; if (empty($user->socid)) { $fieldstosearchall["cf.note_private"] = "NotePrivate"; } $checkedtypetiers = 0; + +// Definition of array of fields for columns $arrayfields = array( - 'cf.ref'=>array('label'=>"Ref", 'checked'=>1), - 'cf.ref_supplier'=>array('label'=>"RefOrderSupplierShort", 'checked'=>1, 'enabled'=>1), - 'p.project_ref'=>array('label'=>"ProjectRef", 'checked'=>0, 'enabled'=>1), - 'u.login'=>array('label'=>"AuthorRequest", 'checked'=>1), - 's.nom'=>array('label'=>"ThirdParty", 'checked'=>1), - 's.town'=>array('label'=>"Town", 'checked'=>1), - 's.zip'=>array('label'=>"Zip", 'checked'=>1), - 'state.nom'=>array('label'=>"StateShort", 'checked'=>0), - 'country.code_iso'=>array('label'=>"Country", 'checked'=>0), - 'typent.code'=>array('label'=>"ThirdPartyType", 'checked'=>$checkedtypetiers), - 'cf.date_commande'=>array('label'=>"OrderDateShort", 'checked'=>1), - 'cf.date_livraison'=>array('label'=>"DateDeliveryPlanned", 'checked'=>1, 'enabled'=>empty($conf->global->ORDER_DISABLE_DELIVERY_DATE)), - 'cf.total_ht'=>array('label'=>"AmountHT", 'checked'=>1), - 'cf.total_tva'=>array('label'=>"AmountVAT", 'checked'=>0), - 'cf.total_ttc'=>array('label'=>"AmountTTC", 'checked'=>0), - 'cf.multicurrency_code'=>array('label'=>'Currency', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)), - 'cf.multicurrency_tx'=>array('label'=>'CurrencyRate', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)), - 'cf.multicurrency_total_ht'=>array('label'=>'MulticurrencyAmountHT', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)), - 'cf.multicurrency_total_tva'=>array('label'=>'MulticurrencyAmountVAT', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)), - 'cf.multicurrency_total_ttc'=>array('label'=>'MulticurrencyAmountTTC', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)), - 'cf.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500), - 'cf.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500), - 'cf.fk_statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000), - 'cf.billed'=>array('label'=>"Billed", 'checked'=>1, 'position'=>1000, 'enabled'=>1), - 'cf.date_valid' =>array('label' => 'DateValidation', 'checked' => 0), - 'cf.date_approve' =>array('label' => 'DateApprove', 'checked' => 0) + 's.town'=>array('label'=>"Town", 'enabled'=>1, 'position'=>47, 'checked'=>1), + 's.zip'=>array('label'=>"Zip", 'enabled'=>1, 'position'=>47, 'checked'=>1), + 'state.nom'=>array('label'=>"StateShort", 'enabled'=>1, 'position'=>48), + 'country.code_iso'=>array('label'=>"Country", 'enabled'=>1, 'position'=>49), + 'typent.code'=>array('label'=>"ThirdPartyType", 'enabled'=>$checkedtypetiers, 'position'=>50), + 'u.login'=>array('label'=>"AuthorRequest", 'enabled'=>1, 'position'=>51) ); +foreach ($object->fields as $key => $val) { + // If $val['visible']==0, then we never show the field + if (!empty($val['visible'])) { + $visible = (int) dol_eval($val['visible'], 1); + $arrayfields['cf.'.$key] = array( + 'label'=>$val['label'], + 'checked'=>(($visible < 0) ? 0 : 1), + 'enabled'=>(abs($visible) != 3 && dol_eval($val['enabled'], 1)), + 'position'=>$val['position'], + 'help'=> isset($val['help']) ? $val['help'] : '' + ); + } +} // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; @@ -1262,7 +1258,7 @@ if ($resql) { print ''; } // Project ref - if (!empty($arrayfields['p.project_ref']['checked'])) { + if (!empty($arrayfields['cf.fk_projet']['checked'])) { print ''; } // Request author @@ -1272,7 +1268,7 @@ if ($resql) { print ''; } // Thirpdarty - if (!empty($arrayfields['s.nom']['checked'])) { + if (!empty($arrayfields['cf.fk_soc']['checked'])) { print ''; } // Town @@ -1379,7 +1375,7 @@ if ($resql) { $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Date creation - if (!empty($arrayfields['cf.datec']['checked'])) { + if (!empty($arrayfields['cf.date_creation']['checked'])) { print ''; print ''; } @@ -1438,14 +1434,14 @@ if ($resql) { if (!empty($arrayfields['cf.ref_supplier']['checked'])) { print_liste_field_titre($arrayfields['cf.ref_supplier']['label'], $_SERVER["PHP_SELF"], "cf.ref_supplier", "", $param, '', $sortfield, $sortorder, 'tdoverflowmax100imp '); } - if (!empty($arrayfields['p.project_ref']['checked'])) { - print_liste_field_titre($arrayfields['p.project_ref']['label'], $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder); + if (!empty($arrayfields['cf.fk_projet']['checked'])) { + print_liste_field_titre($arrayfields['cf.fk_projet']['label'], $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder); } if (!empty($arrayfields['u.login']['checked'])) { print_liste_field_titre($arrayfields['u.login']['label'], $_SERVER["PHP_SELF"], "u.login", "", $param, '', $sortfield, $sortorder); } - if (!empty($arrayfields['s.nom']['checked'])) { - print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder); + if (!empty($arrayfields['cf.fk_soc']['checked'])) { + print_liste_field_titre($arrayfields['cf.fk_soc']['label'], $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder); } if (!empty($arrayfields['s.town']['checked'])) { print_liste_field_titre($arrayfields['s.town']['label'], $_SERVER["PHP_SELF"], 's.town', '', $param, '', $sortfield, $sortorder); @@ -1501,8 +1497,8 @@ if ($resql) { $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - if (!empty($arrayfields['cf.datec']['checked'])) { - print_liste_field_titre($arrayfields['cf.datec']['label'], $_SERVER["PHP_SELF"], "cf.date_creation", "", $param, '', $sortfield, $sortorder, 'center nowrap '); + if (!empty($arrayfields['cf.date_creation']['checked'])) { + print_liste_field_titre($arrayfields['cf.date_creation']['label'], $_SERVER["PHP_SELF"], "cf.date_creation", "", $param, '', $sortfield, $sortorder, 'center nowrap '); } if (!empty($arrayfields['cf.tms']['checked'])) { print_liste_field_titre($arrayfields['cf.tms']['label'], $_SERVER["PHP_SELF"], "cf.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap '); @@ -1584,7 +1580,7 @@ if ($resql) { } } // Project - if (!empty($arrayfields['p.project_ref']['checked'])) { + if (!empty($arrayfields['cf.fk_projet']['checked'])) { $projectstatic->id = $obj->project_id; $projectstatic->ref = $obj->project_ref; $projectstatic->title = $obj->project_title; @@ -1616,7 +1612,7 @@ if ($resql) { } } // Thirdparty - if (!empty($arrayfields['s.nom']['checked'])) { + if (!empty($arrayfields['cf.fk_soc']['checked'])) { print ''; $thirdpartytmp->id = $obj->socid; $thirdpartytmp->name = $obj->name; @@ -1783,7 +1779,7 @@ if ($resql) { $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Date creation - if (!empty($arrayfields['cf.datec']['checked'])) { + if (!empty($arrayfields['cf.date_creation']['checked'])) { print ''; print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); print ''; diff --git a/htdocs/langs/en_US/orders.lang b/htdocs/langs/en_US/orders.lang index 11220633d61..aa78c97f2e3 100644 --- a/htdocs/langs/en_US/orders.lang +++ b/htdocs/langs/en_US/orders.lang @@ -68,6 +68,8 @@ CreateOrder=Create Order RefuseOrder=Refuse order ApproveOrder=Approve order Approve2Order=Approve order (second level) +UserApproval=User for approval +UserApproval2=User for approval (second level) ValidateOrder=Validate order UnvalidateOrder=Unvalidate order DeleteOrder=Delete order diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index 4e88703b454..d6e59e4b2bd 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -74,7 +74,7 @@ class MyObject extends CommonObject * Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)" * 'label' the translation key. * 'picto' is code of a picto to show before value in forms - * 'enabled' is a condition when the field must be managed (Example: 1 or '$conf->global->MY_SETUP_PARAM) + * 'enabled' is a condition when the field must be managed (Example: 1 or '$conf->global->MY_SETUP_PARAM' or '!empty($conf->multicurrency->enabled)' ...) * 'position' is the sort order of field. * 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0). * 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). 5=Visible on list and view only (not create/not update). Using a negative value means field is not shown by default on list but can be selected for viewing) diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index 902969ee430..040dc074be1 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -165,7 +165,7 @@ foreach ($object->fields as $key => $val) { $arrayfields['t.'.$key] = array( 'label'=>$val['label'], 'checked'=>(($visible < 0) ? 0 : 1), - 'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1)), + 'enabled'=>(abs($visible) != 3 && dol_eval($val['enabled'], 1)), 'position'=>$val['position'], 'help'=> isset($val['help']) ? $val['help'] : '' ); From 391c02993d2a6d2fc8257ebe77d6f5b866eb35e0 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 24 Mar 2022 20:26:47 +0100 Subject: [PATCH 379/610] FIX better test for all usage --- htdocs/core/class/commonobject.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index ea7d0265ec1..7dcf9d09805 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -4422,8 +4422,10 @@ abstract class CommonObject $langs->load("errors"); //print 'Found into table '.$table.', type '.$langs->transnoentitiesnoconv($elementname).', haschild='.$haschild; $haschild += $obj->nb; - if (is_numeric($element) || empty($element['name'])) { // old usage + if (is_numeric($element)) { // very old usage array('table1', 'table2', ...) $this->errors[] = $langs->transnoentitiesnoconv("ErrorRecordHasAtLeastOneChildOfType", method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref, $table); + } elseif (is_string($element)) { // old usage array('table1' => 'TranslateKey1', 'table2' => 'TranslateKey2', ...) + $this->errors[] = $langs->transnoentitiesnoconv("ErrorRecordHasAtLeastOneChildOfType", method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref, $langs->transnoentitiesnoconv($element)); } else { // new usage: $element['name']=Translation key $this->errors[] = $langs->transnoentitiesnoconv("ErrorRecordHasAtLeastOneChildOfType", method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref, $langs->transnoentitiesnoconv($element['name'])); } From ffa79c59f97561f4761fbc939c2ca60e74ebfc3d Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 24 Mar 2022 20:48:43 +0100 Subject: [PATCH 380/610] FIX wrong alias of table if no parent and parentkey --- htdocs/core/class/commonobject.class.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 7dcf9d09805..3bb84eac492 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -4413,7 +4413,11 @@ abstract class CommonObject $sql.= " AND c.".$element['parentkey']." = p.rowid"; } if (!empty($entity)) { - $sql.= " AND p.entity = ".((int) $entity); + if (!empty($element['parent']) && !empty($element['parentkey'])) { + $sql.= " AND p.entity = ".((int) $entity); + } else { + $sql.= " AND c.entity = ".((int) $entity); + } } $resql = $this->db->query($sql); if ($resql) { From 9db7d29237cb56347f6828e6af16d25a2474b986 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Thu, 24 Mar 2022 23:14:23 +0100 Subject: [PATCH 381/610] Accountancy - Removed old code for reconciled (or lettering...) --- .../thirdparty_lettering_customer.php | 325 ------------------ .../thirdparty_lettering_supplier.php | 322 ----------------- htdocs/core/lib/company.lib.php | 18 - 3 files changed, 665 deletions(-) delete mode 100644 htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php delete mode 100644 htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php diff --git a/htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php b/htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php deleted file mode 100644 index a563b653ac1..00000000000 --- a/htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php +++ /dev/null @@ -1,325 +0,0 @@ - - * Copyright (C) 2005 Laurent Destailleur - * Copyright (C) 2013 Olivier Geffroy - * Copyright (C) 2013 Florian Henry - * Copyright (C) 2013-2019 Alexandre Spangaro - * Copyright (C) 2018-2020 Frédéric France - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ - -/** - * \file htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php - * \ingroup accountancy - * \brief Tab to manage customer lettering - */ -require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; -require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php'; -require_once DOL_DOCUMENT_ROOT.'/accountancy/class/lettering.class.php'; -require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php'; -require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; - -// Load translation files required by the page -$langs->loadLangs(array("compta", "accountancy")); - -$action = GETPOST('action', 'aZ09'); -$massaction = GETPOST('massaction', 'alpha'); -$show_files = GETPOST('show_files', 'int'); -$confirm = GETPOST('confirm', 'alpha'); -$toselect = GETPOST('toselect', 'array'); -// $socid = GETPOST('socid', 'int') ?GETPOST('socid', 'int') : GETPOST('id', 'int'); -// Security check -$socid = GETPOSTINT("socid"); -// if ($user->socid) $socid=$user->socid; - -$limit = GETPOSTISSET('limit') ? GETPOST('limit', 'int') : $conf->liste_limit; -$sortfield = GETPOST('sortfield', 'aZ09comma'); -$sortorder = GETPOST('sortorder', 'aZ09comma'); -$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); -if (empty($page) || $page == - 1) { - $page = 0; -} // If $page is not defined, or '' or -1 -$offset = $limit * $page; -$pageprev = $page - 1; -$pagenext = $page + 1; -if ($sortorder == "") { - $sortorder = "ASC"; -} -if ($sortfield == "") { - $sortfield = "bk.doc_date"; -} - -/* -$search_date_start = dol_mktime(0, 0, 0, GETPOST('date_startmonth', 'int'), GETPOST('date_startday', 'int'), GETPOST('date_startyear', 'int')); -$search_date_end = dol_mktime(0, 0, 0, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', 'int')); -//$search_doc_type = GETPOST("search_doc_type", 'alpha'); -$search_doc_ref = GETPOST("search_doc_ref", 'alpha'); -*/ - -$lettering = GETPOST('lettering', 'alpha'); -if (!empty($lettering)) { - $action = $lettering; -} - -/* -if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers -{ - $search_date_start = ''; - $search_date_end = ''; - //$search_doc_type = ''; - $search_doc_ref = ''; -} -*/ - -$lettering = new Lettering($db); -$object = new Societe($db); -$object->id = $socid; -$result = $object->fetch($socid); -if ($result < 0) { - setEventMessages($object->error, $object->errors, 'errors'); -} - -if (empty($conf->accounting->enabled)) { - accessforbidden(); -} -if ($user->socid > 0) { - accessforbidden(); -} -if (empty($user->rights->accounting->mouvements->lire)) { - accessforbidden(); -} - - -/* - * Action - */ - -if ($action == 'lettering') { - $result = $lettering->updateLettering($toselect); - - if ($result < 0) { - setEventMessages('', $lettering->errors, 'errors'); - $error++; - } -} - -/* -if ($action == 'autolettrage') { - - $result = $lettering->letteringThirdparty($socid); - - if ($result < 0) { - setEventMessages('', $lettering->errors, 'errors'); - $error++; - } -} -*/ - -/* - * View - */ - -$form = new Form($db); -$formaccounting = new FormAccounting($db); - -$title = $object->name." - ".$langs->trans('TabLetteringCustomer'); -$help_url = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas|DE:Modul_Geschäftspartner'; -llxHeader('', $title, $help_url); - -$head = societe_prepare_head($object); - -dol_htmloutput_mesg(is_numeric($error) ? '' : $error, $errors, 'error'); - -print dol_get_fiche_head($head, 'lettering_customer', $langs->trans("ThirdParty"), 0, 'company'); - -$linkback = ''.$langs->trans("BackToList").''; - -dol_banner_tab($object, 'socid', $linkback, ($user->socid ? 0 : 1), 'rowid', 'nom', '', '', 0, '', '', 'arearefnobottom'); - -print dol_get_fiche_end(); - -$sql = "SELECT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, "; -$sql .= " bk.subledger_account, bk.numero_compte , bk.label_compte, bk.debit, "; -$sql .= " bk.credit, bk.montant, bk.sens, bk.code_journal, bk.piece_num, bk.lettering_code"; -$sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as bk"; -$sql .= " WHERE (bk.subledger_account = '".$db->escape($object->code_compta)."' AND bk.numero_compte = '".$db->escape($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER)."' )"; - -/* -if (dol_strlen($search_date_start) || dol_strlen($search_date_end)) { - $sql .= " AND ( bk.doc_date BETWEEN '" . $db->idate($search_date_start) . "' AND '" . $db->idate($search_date_end) . "' )"; -} -*/ - -$sql .= ' AND bk.entity IN ('.getEntity('accountingbookkeeping').')'; -$sql .= $db->order($sortfield, $sortorder); - -$debit = 0; -$credit = 0; -$solde = 0; -// Count total nb of records and calc total sum -$nbtotalofrecords = ''; -$resql = $db->query($sql); -if (!$resql) { - dol_print_error($db); - exit(); -} -$nbtotalofrecords = $db->num_rows($resql); - -while ($obj = $db->fetch_object($resql)) { - $debit += $obj->debit; - $credit += $obj->credit; - - $solde += ($obj->credit - $obj->debit); -} - -$sql .= $db->plimit($limit + 1, $offset); - -dol_syslog("/accountancy/bookkeeping/thirdparty_lettering_customer.php", LOG_DEBUG); -$resql = $db->query($sql); -if (!$resql) { - dol_print_error($db); - exit(); -} - -$param = ''; -$param .= "&socid=".urlencode($socid); - -$num = $db->num_rows($resql); - -dol_syslog("/accountancy/bookkeeping/thirdparty_lettering_customer.php", LOG_DEBUG); -if ($resql) { - $i = 0; - - $param = "&socid=".$socid; - print '
'; - print ''; - print ''; - - $letteringbutton = ''; - - print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies', 0, $letteringbutton, '', $limit); - - print '
'; - print ''."\n"; - - /* - print ''; - //print ''; - - // Date - print ''; - - // Piece - print ''; - print ''; - print ''; - print ''; - */ - - print ''; - //print_liste_field_titre("Doctype", $_SERVER["PHP_SELF"], "bk.doc_type", "", $param, "", $sortfield, $sortorder); - print_liste_field_titre("Docdate", $_SERVER["PHP_SELF"], "bk.doc_date", "", $param, "", $sortfield, $sortorder, 'center '); - print_liste_field_titre("Piece", $_SERVER["PHP_SELF"], "bk.doc_ref", "", $param, "", $sortfield, $sortorder); - print_liste_field_titre("LabelAccount", $_SERVER["PHP_SELF"], "bk.label_compte", "", $param, "", $sortfield, $sortorder); - print_liste_field_titre("Debit", $_SERVER["PHP_SELF"], "bk.debit", "", $param, "", $sortfield, $sortorder); - print_liste_field_titre("Credit", $_SERVER["PHP_SELF"], "bk.credit", "", $param, "", $sortfield, $sortorder); - print_liste_field_titre("Balancing", $_SERVER["PHP_SELF"], "", "", $param, "", $sortfield, $sortorder); - print_liste_field_titre("Codejournal", $_SERVER["PHP_SELF"], "bk.code_journal", "", $param, "", $sortfield, $sortorder, 'center '); - print_liste_field_titre("LetteringCode", $_SERVER["PHP_SELF"], "bk.lettering_code", "", $param, "", $sortfield, $sortorder, 'center '); - print_liste_field_titre("", "", "", '', '', "", $sortfield, $sortorder, 'maxwidthsearch center '); - print "\n"; - - $solde = 0; - $tmp = ''; - - while ($obj = $db->fetch_object($resql)) { - if ($tmp != $obj->lettering_code || empty($tmp)) { - $tmp = $obj->lettering_code; - } - /*if ($tmp != $obj->lettering_code || empty($obj->lettering_code))*/ $solde += ($obj->credit - $obj->debit); - - print ''; - - //print '' . "\n"; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - // Journal - $accountingjournal = new AccountingJournal($db); - $result = $accountingjournal->fetch('', $obj->code_journal); - $journaltoshow = (($result > 0) ? $accountingjournal->getNomUrl(0, 0, 0, '', 0) : $obj->code_journal); - print ''; - - if (empty($obj->lettering_code) && empty($obj->date_validated)) { - print ''; - print ''."\n"; - } else { - print ''; - print ''; - } - - print "\n"; - } - - print ''; - print ''."\n"; - print ''; - print ''; - print ''; - print "\n"; - - print ''; - print ''."\n"; - print ''; - print ''; - print ''; - print "\n"; - - print "
'; - print '
'; - print $langs->trans('From') . ' '; - print $form->selectDate($search_date_start, 'date_creation_start', 0, 0, 1); - print '
'; - print '
'; - print $langs->trans('to') . ' '; - print $form->selectDate($search_date_end, 'date_creation_end', 0, 0, 1); - print '
'; - print '
 '; - $searchpicto = $form->showFilterButtons(); - print $searchpicto; - print '
' . $obj->doc_type . ''.dol_print_date($db->jdate($obj->doc_date), 'day').''.$obj->doc_ref.''.$obj->label_compte.''.price($obj->debit).''.price($obj->credit).''.price(round($solde, 2)).''.$journaltoshow.''; - print img_edit(); - print ''.$obj->lettering_code.'
'.$langs->trans("Total").':'.price($debit).''.price($credit).'
'.$langs->trans("Balancing").': '.price($credit - $debit).'
"; - - print '
'."\n"; - print $letteringbutton; - print '
'; - - print ""; - $db->free($resql); -} else { - dol_print_error($db); -} - -// End of page -llxFooter(); -$db->close(); diff --git a/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php b/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php deleted file mode 100644 index 5c315bee9fc..00000000000 --- a/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php +++ /dev/null @@ -1,322 +0,0 @@ - - * Copyright (C) 2005 Laurent Destailleur - * Copyright (C) 2013 Olivier Geffroy - * Copyright (C) 2013 Florian Henry - * Copyright (C) 2013-2019 Alexandre Spangaro - * Copyright (C) 2018-2020 Frédéric France - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php - * \ingroup Accountancy (Double entries) - * \brief Tab to setup lettering - */ -require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; -require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php'; -require_once DOL_DOCUMENT_ROOT.'/accountancy/class/lettering.class.php'; -require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php'; -require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; - -// Load translation files required by the page -$langs->loadLangs(array("compta", "accountancy")); - -$action = GETPOST('action', 'aZ09'); -$massaction = GETPOST('massaction', 'alpha'); -$show_files = GETPOST('show_files', 'int'); -$confirm = GETPOST('confirm', 'alpha'); -$toselect = GETPOST('toselect', 'array'); -// $socid = GETPOST('socid', 'int') ? ((int) GETPOST('socid', 'int')) : ((int) GETPOST('id', 'int')); -// Security check -$socid = GETPOSTINT("socid"); -// if ($user->socid) $socid=$user->socid; - - -$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; -$sortfield = GETPOST('sortfield', 'aZ09comma'); -$sortorder = GETPOST('sortorder', 'aZ09comma'); -$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); -if (empty($page) || $page == - 1) { - $page = 0; -} // If $page is not defined, or '' or -1 -$offset = $limit * $page; -$pageprev = $page - 1; -$pagenext = $page + 1; -if ($sortorder == "") { - $sortorder = "ASC"; -} -if ($sortfield == "") { - $sortfield = "bk.doc_date"; -} - -/* -$search_date_start = dol_mktime(0, 0, 0, GETPOST('date_startmonth', 'int'), GETPOST('date_startday', 'int'), GETPOST('date_startyear', 'int')); -$search_date_end = dol_mktime(0, 0, 0, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', 'int')); -//$search_doc_type = GETPOST("search_doc_type",'alpha'); -$search_doc_ref = GETPOST("search_doc_ref",'alpha'); -*/ - -$lettering = GETPOST('lettering', 'alpha'); -if (!empty($lettering)) { - $action = $lettering; -} - -/* -if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers -{ - $search_date_start = ''; - $search_date_end = ''; - //$search_doc_type=''; - $search_doc_ref=''; -} -*/ - -$lettering = new Lettering($db); -$object = new Societe($db); -$object->id = $socid; -$result = $object->fetch($socid); -if ($result < 0) { - setEventMessages($object->error, $object->errors, 'errors'); -} - -if (empty($conf->accounting->enabled)) { - accessforbidden(); -} -if ($user->socid > 0) { - accessforbidden(); -} -if (empty($user->rights->accounting->mouvements->lire)) { - accessforbidden(); -} - - -/* - * Action - */ - -if ($action == 'lettering') { - $result = $lettering->updateLettering($toselect); - - if ($result < 0) { - setEventMessages('', $lettering->errors, 'errors'); - $error++; - } -} - -/* -if ($action == 'autolettrage') { - - $result = $lettering->letteringThirdparty($socid); - - if ($result < 0) { - setEventMessages('', $lettering->errors, 'errors'); - $error++; - } -} -*/ - -/* - * View - */ - -$form = new Form($db); -$formaccounting = new FormAccounting($db); - -$title = $object->name." - ".$langs->trans('TabLetteringSupplier'); -$help_url = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas|DE:Modul_Geschäftspartner'; -llxHeader('', $title, $help_url); - -$head = societe_prepare_head($object); - -dol_htmloutput_mesg(is_numeric($error) ? '' : $error, $errors, 'error'); - -print dol_get_fiche_head($head, 'lettering_supplier', $langs->trans("ThirdParty"), 0, 'company'); - -$linkback = ''.$langs->trans("BackToList").''; - -dol_banner_tab($object, 'socid', $linkback, ($user->socid ? 0 : 1), 'rowid', 'nom', '', '', 0, '', '', 'arearefnobottom'); - -print dol_get_fiche_end(); - -$sql = "SELECT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, "; -$sql .= " bk.subledger_account, bk.numero_compte , bk.label_compte, bk.debit, "; -$sql .= " bk.credit, bk.montant, bk.sens, bk.code_journal, bk.piece_num, bk.lettering_code, bk.date_validated "; -$sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as bk"; -$sql .= " WHERE (bk.subledger_account = '".$db->escape($object->code_compta_fournisseur)."' AND bk.numero_compte = '".$db->escape($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER)."' )"; -if (dol_strlen($search_date_start) || dol_strlen($search_date_end)) { - $sql .= " AND (bk.doc_date BETWEEN '".$db->idate($search_date_start)."' AND '".$db->idate($search_date_end)."' )"; -} -$sql .= ' AND bk.entity IN ('.getEntity('accountingbookkeeping').')'; -$sql .= $db->order($sortfield, $sortorder); - -$debit = 0; -$credit = 0; -$solde = 0; -// Count total nb of records and calc total sum -$nbtotalofrecords = ''; -$resql = $db->query($sql); -if (!$resql) { - dol_print_error($db); - exit; -} -$nbtotalofrecords = $db->num_rows($resql); - -while ($obj = $db->fetch_object($resql)) { - $debit += $obj->debit; - $credit += $obj->credit; - - $solde += ($obj->credit - $obj->debit); -} - -$sql .= $db->plimit($limit + 1, $offset); - -dol_syslog("/accountancy/bookkeeping/thirdparty_lettering_supplier.php", LOG_DEBUG); -$resql = $db->query($sql); -if (!$resql) { - dol_print_error($db); - exit; -} - -$param = ''; -$param .= "&socid=".urlencode($socid); - -$num = $db->num_rows($resql); - -dol_syslog("/accountancy/bookkeeping/thirdparty_lettering_supplier.php", LOG_DEBUG); -$resql = $db->query($sql); -if ($resql) { - $num = $db->num_rows($resql); - $i = 0; - - $param = "&socid=".$socid; - print '
'; - print ''; - print ''; - - $letteringbutton = ''; - - print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies', 0, $letteringbutton, '', $limit); - - print '
'; - print ''."\n"; - - /* - print ''; - //print ''; - - // Date - print ''; - - // Piece - print ''; - print ''; - print ''; - print ''; - */ - - print ''; - //print_liste_field_titre("Doctype", $_SERVER["PHP_SELF"], "bk.doc_type", "", $param, "", $sortfield, $sortorder); - print_liste_field_titre("Docdate", $_SERVER["PHP_SELF"], "bk.doc_date", "", $param, "", $sortfield, $sortorder, 'center '); - print_liste_field_titre("Piece", $_SERVER["PHP_SELF"], "bk.doc_ref", "", $param, "", $sortfield, $sortorder); - print_liste_field_titre("LabelAccount", $_SERVER["PHP_SELF"], "bk.label_compte", "", $param, "", $sortfield, $sortorder); - print_liste_field_titre("Debit", $_SERVER["PHP_SELF"], "bk.debit", "", $param, "", $sortfield, $sortorder); - print_liste_field_titre("Credit", $_SERVER["PHP_SELF"], "bk.credit", "", $param, "", $sortfield, $sortorder); - print_liste_field_titre("Balancing", $_SERVER["PHP_SELF"], "", "", $param, "", $sortfield, $sortorder); - print_liste_field_titre("Codejournal", $_SERVER["PHP_SELF"], "bk.code_journal", "", $param, "", $sortfield, $sortorder, 'center '); - print_liste_field_titre("LetteringCode", $_SERVER["PHP_SELF"], "bk.lettering_code", "", $param, "", $sortfield, $sortorder, 'center '); - print_liste_field_titre("", "", "", '', '', "", $sortfield, $sortorder, 'maxwidthsearch center '); - print "\n"; - - $solde = 0; - $tmp = ''; - while ($obj = $db->fetch_object($resql)) { - if ($tmp != $obj->lettering_code || empty($tmp)) { - $tmp = $obj->lettering_code; - } - /*if ($tmp != $obj->lettering_code || empty($obj->lettering_code))*/ $solde += ($obj->credit - $obj->debit); - - print ''; - - //print '' . "\n"; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - // Journal - $accountingjournal = new AccountingJournal($db); - $result = $accountingjournal->fetch('', $obj->code_journal); - $journaltoshow = (($result > 0) ? $accountingjournal->getNomUrl(0, 0, 0, '', 0) : $obj->code_journal); - print ''; - - if (empty($obj->lettering_code) && empty($obj->date_validated)) { - print ''; - print ''."\n"; - } else { - print ''; - print ''; - } - - print "\n"; - } - - print ''; - print ''."\n"; - print ''; - print ''; - print ''; - print "\n"; - - print ''; - print ''."\n"; - print ''; - print ''; - print ''; - print "\n"; - - print "
'; - print '
'; - print $langs->trans('From') . ' '; - print $form->selectDate($search_date_start, 'date_creation_start', 0, 0, 1); - print '
'; - print '
'; - print $langs->trans('to') . ' '; - print $form->selectDate($search_date_end, 'date_creation_end', 0, 0, 1); - print '
'; - print '
 '; - $searchpicto = $form->showFilterButtons(); - print $searchpicto; - print '
' . $obj->doc_type . ''.dol_print_date($db->jdate($obj->doc_date), 'day').''.$obj->doc_ref.''.$obj->label_compte.''.price($obj->debit).''.price($obj->credit).''.price(round($solde, 2)).''.$journaltoshow.''; - print img_edit(); - print ''.$obj->lettering_code.'
'.$langs->trans("Total").':'.price($debit).''.price($credit).'
'.$langs->trans("Balancing").': '.price($credit - $debit).'
"; - - print '
'."\n"; - print $letteringbutton; - print '
'; - - print ""; - $db->free($resql); -} else { - dol_print_error($db); -} - -// End of page -llxFooter(); -$db->close(); diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 7f1f03cd121..8ebf2e02047 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -168,24 +168,6 @@ function societe_prepare_head(Societe $object) $h++; } - if (!empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) { - // Tab to accountancy - if (!empty($conf->accounting->enabled) && $object->client > 0) { - $head[$h][0] = DOL_URL_ROOT.'/accountancy/bookkeeping/thirdparty_lettering_customer.php?socid='.$object->id; - $head[$h][1] = $langs->trans("TabLetteringCustomer"); - $head[$h][2] = 'lettering_customer'; - $h++; - } - - // Tab to accountancy - if (!empty($conf->accounting->enabled) && $object->fournisseur > 0) { - $head[$h][0] = DOL_URL_ROOT.'/accountancy/bookkeeping/thirdparty_lettering_supplier.php?socid='.$object->id; - $head[$h][1] = $langs->trans("TabLetteringSupplier"); - $head[$h][2] = 'lettering_supplier'; - $h++; - } - } - // Related items if ((!empty($conf->commande->enabled) || !empty($conf->propal->enabled) || !empty($conf->facture->enabled) || !empty($conf->ficheinter->enabled) || (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && empty($conf->global->THIRPARTIES_DISABLE_RELATED_OBJECT_TAB)) { From 6774f0e57130c0ef8a07d7a7e89b56fdea0fe459 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 25 Mar 2022 11:53:27 +0100 Subject: [PATCH 382/610] new: entities is now updated on project update method --- htdocs/projet/class/project.class.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 8aa25154111..510d7e23e62 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -479,6 +479,8 @@ class Project extends CommonObject return -3; } + $this->entity = ((isset($this->entity) && is_numeric($this->entity)) ? $this->entity : $conf->entity); + if (dol_strlen(trim($this->ref)) > 0) { $this->db->begin(); @@ -507,6 +509,7 @@ class Project extends CommonObject $sql .= ", accept_booth_suggestions = ".($this->accept_booth_suggestions ? 1 : 0); $sql .= ", price_registration = ".(strcmp($this->price_registration, '') ? price2num($this->price_registration) : "null"); $sql .= ", price_booth = ".(strcmp($this->price_booth, '') ? price2num($this->price_booth) : "null"); + $sql .= ", entity = ".((int) $this->entity); $sql .= " WHERE rowid = ".((int) $this->id); dol_syslog(get_class($this)."::update", LOG_DEBUG); From 8d2d0f1e847d3e87db6d20ad3cf67fac173e99d0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 25 Mar 2022 12:22:52 +0100 Subject: [PATCH 383/610] Fix trans --- htdocs/core/tpl/filemanager.tpl.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/core/tpl/filemanager.tpl.php b/htdocs/core/tpl/filemanager.tpl.php index e776388ac53..573ae315913 100644 --- a/htdocs/core/tpl/filemanager.tpl.php +++ b/htdocs/core/tpl/filemanager.tpl.php @@ -34,6 +34,8 @@ if (empty($conf) || !is_object($conf)) { require_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmdirectory.class.php'; +$langs->load("ecm"); + if (empty($module)) { $module = 'ecm'; } From 644e50926592bd658a13f3eac94397f99206433d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 25 Mar 2022 14:43:48 +0100 Subject: [PATCH 384/610] Rename "Reconciled" with "BankLineReconciled" for bank conciliation --- htdocs/adherents/class/subscription.class.php | 2 +- htdocs/compta/bank/bankentries_list.php | 2 +- htdocs/compta/paiement/cheque/class/remisecheque.class.php | 4 ++-- htdocs/core/lib/functions2.lib.php | 2 +- htdocs/core/modules/modBanque.class.php | 2 +- htdocs/langs/en_US/banks.lang | 6 +++--- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/adherents/class/subscription.class.php b/htdocs/adherents/class/subscription.class.php index 885c8981d93..9aef78174de 100644 --- a/htdocs/adherents/class/subscription.class.php +++ b/htdocs/adherents/class/subscription.class.php @@ -358,7 +358,7 @@ class Subscription extends CommonObject $result = $member->update_end_date($user); if ($this->fk_bank > 0 && is_object($accountline) && $accountline->id > 0) { // If we found bank account line (this means this->fk_bank defined) - $result = $accountline->delete($user); // Return false if refused because line is conciliated + $result = $accountline->delete($user); // Return false if refused because line is reconciled if ($result > 0) { $this->db->commit(); return 1; diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index e991831a6dd..8893f91c2c2 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -170,7 +170,7 @@ $arrayfields = array( 'balancebefore'=>array('label'=>$langs->trans("BalanceBefore"), 'checked'=>0, 'position'=>1000), 'balance'=>array('label'=>$langs->trans("Balance"), 'checked'=>1, 'position'=>1001), 'b.num_releve'=>array('label'=>$langs->trans("AccountStatement"), 'checked'=>1, 'position'=>1010), - 'b.conciliated'=>array('label'=>$langs->trans("Conciliated"), 'enabled'=> $object->rappro, 'checked'=>($action == 'reconcile' ? 1 : 0), 'position'=>1020), + 'b.conciliated'=>array('label'=>$langs->trans("BankLineReconciled"), 'enabled'=> $object->rappro, 'checked'=>($action == 'reconcile' ? 1 : 0), 'position'=>1020), ); // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; diff --git a/htdocs/compta/paiement/cheque/class/remisecheque.class.php b/htdocs/compta/paiement/cheque/class/remisecheque.class.php index 6b1053240c8..451a18ab05b 100644 --- a/htdocs/compta/paiement/cheque/class/remisecheque.class.php +++ b/htdocs/compta/paiement/cheque/class/remisecheque.class.php @@ -730,7 +730,7 @@ class RemiseCheque extends CommonObject $bankline = new AccountLine($db); $bankline->fetch($bank_id); - /* Conciliation is allowed because when check is returned, a new line is created onto bank transaction log. + /* Reconciliation is allowed because when check is returned, a new line is created onto bank transaction log. if ($bankline->rappro) { $this->error='ActionRefusedLineAlreadyConciliated'; @@ -739,7 +739,7 @@ class RemiseCheque extends CommonObject $this->db->begin(); - // Not conciliated, we can delete it + // Not reconciled, we can delete it //$bankline->delete($user); // We delete $bankaccount = $payment->fk_account; diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 3a0b077be6b..eae29bf4036 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -628,7 +628,7 @@ function dol_print_object_info($object, $usetable = 0) if ($usetable) { print ''; } - print $langs->trans("ConciliatedBy"); + print $langs->trans("ReconciledBy"); if ($usetable) { print ''; } else { diff --git a/htdocs/core/modules/modBanque.class.php b/htdocs/core/modules/modBanque.class.php index b4135294293..e44d8b59374 100644 --- a/htdocs/core/modules/modBanque.class.php +++ b/htdocs/core/modules/modBanque.class.php @@ -151,7 +151,7 @@ class modBanque extends DolibarrModules $this->export_fields_array[$r] = array( 'b.rowid'=>'IdTransaction', 'ba.ref'=>'AccountRef', 'ba.label'=>'AccountLabel', 'b.datev'=>'DateValue', 'b.dateo'=>'DateOperation', 'b.label'=>'Label', 'b.num_chq'=>'ChequeOrTransferNumber', 'b.fk_bordereau'=>'ChequeBordereau', '-b.amount'=>'Debit', 'b.amount'=>'Credit', - 'b.num_releve'=>'AccountStatement', 'b.rappro'=>'Conciliated', 'b.datec'=>"DateCreation", "bu.url_id"=>"IdThirdParty", + 'b.num_releve'=>'AccountStatement', 'b.rappro'=>'BankLineReconciled', 'b.datec'=>"DateCreation", "bu.url_id"=>"IdThirdParty", "s.nom"=>"ThirdParty", "s.code_compta"=>"CustomerAccountancyCode", "s.code_compta_fournisseur"=>"SupplierAccountancyCode" ); $this->export_TypeFields_array[$r] = array('ba.ref'=>'Text', 'ba.label'=>'Text', 'b.datev'=>'Date', 'b.dateo'=>'Date', 'b.label'=>'Text', 'b.num_chq'=>'Text', 'b.fk_bordereau'=>'Text', '-b.amount'=>'Numeric', 'b.amount'=>'Numeric', 'b.num_releve'=>'Text', 'b.rappro'=>'Boolean', 'b.datec'=>"Date", "bu.url_id"=>"Text", "s.nom"=>"Text", "s.code_compta"=>"Text", "s.code_compta_fournisseur"=>"Text"); diff --git a/htdocs/langs/en_US/banks.lang b/htdocs/langs/en_US/banks.lang index 959db0f1a5f..331ddb62e7f 100644 --- a/htdocs/langs/en_US/banks.lang +++ b/htdocs/langs/en_US/banks.lang @@ -95,11 +95,11 @@ LineRecord=Transaction AddBankRecord=Add entry AddBankRecordLong=Add entry manually Conciliated=Reconciled -ConciliatedBy=Reconciled by +ReConciliedBy=Reconciled by DateConciliating=Reconcile date BankLineConciliated=Entry reconciled with bank receipt -Reconciled=Reconciled -NotReconciled=Not reconciled +BankLineReconciled=Reconciled +BankLineNotReconciled=Not reconciled CustomerInvoicePayment=Customer payment SupplierInvoicePayment=Vendor payment SubscriptionPayment=Subscription payment From 4d91e448cec7865f6556f32125f55a8aeca5c236 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 25 Mar 2022 15:35:49 +0100 Subject: [PATCH 385/610] Fix bad test for button to show / hide canceled orders --- htdocs/projet/element.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index b5e789ec3f2..80fccce7912 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -1050,7 +1050,8 @@ foreach ($listofreferent as $key => $value) { } $addform .= '
'; } - if (is_array($elementarray) && !count($elementarray) > 0 && $key == "order_supplier") { + + if (is_array($elementarray) && count($elementarray) > 0 && $key == "order_supplier") { $addform = '
'.$langs->trans("CanceledShown").' @@ -1061,13 +1062,13 @@ foreach ($listofreferent as $key => $value) { if (typeof attr !== "undefined" && attr !== false) { console.log("Show canceled"); $(".tr_canceled").show(); - $("#textBtnShow").text("'.dol_escape_js($langs->trans("CanceledShown")).'"); + $("#textBtnShow").text("'.dol_escape_js($langs->transnoentitiesnoconv("CanceledShown")).'"); $("#btnShow").removeAttr("data-canceledarehidden"); $("#minus-circle").removeClass("fa-eye-slash").addClass("fa-eye"); } else { console.log("Hide canceled"); $(".tr_canceled").hide(); - $("#textBtnShow").text("'.dol_escape_js($langs->trans("CanceledHidden")).'"); + $("#textBtnShow").text("'.dol_escape_js($langs->transnoentitiesnoconv("CanceledHidden")).'"); $("#btnShow").attr("data-canceledarehidden", 1); $("#minus-circle").removeClass("fa-eye").addClass("fa-eye-slash"); } From 8236a8e846e49cf6ea6597ac38495012853f3297 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 25 Mar 2022 15:35:49 +0100 Subject: [PATCH 386/610] Fix bad test for button to show / hide canceled orders --- htdocs/projet/element.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index b5e789ec3f2..80fccce7912 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -1050,7 +1050,8 @@ foreach ($listofreferent as $key => $value) { } $addform .= '
'; } - if (is_array($elementarray) && !count($elementarray) > 0 && $key == "order_supplier") { + + if (is_array($elementarray) && count($elementarray) > 0 && $key == "order_supplier") { $addform = '
'.$langs->trans("CanceledShown").' @@ -1061,13 +1062,13 @@ foreach ($listofreferent as $key => $value) { if (typeof attr !== "undefined" && attr !== false) { console.log("Show canceled"); $(".tr_canceled").show(); - $("#textBtnShow").text("'.dol_escape_js($langs->trans("CanceledShown")).'"); + $("#textBtnShow").text("'.dol_escape_js($langs->transnoentitiesnoconv("CanceledShown")).'"); $("#btnShow").removeAttr("data-canceledarehidden"); $("#minus-circle").removeClass("fa-eye-slash").addClass("fa-eye"); } else { console.log("Hide canceled"); $(".tr_canceled").hide(); - $("#textBtnShow").text("'.dol_escape_js($langs->trans("CanceledHidden")).'"); + $("#textBtnShow").text("'.dol_escape_js($langs->transnoentitiesnoconv("CanceledHidden")).'"); $("#btnShow").attr("data-canceledarehidden", 1); $("#minus-circle").removeClass("fa-eye").addClass("fa-eye-slash"); } From ab2e6ddf4359584ff1d33ecaccdd1d219c7536d2 Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Fri, 25 Mar 2022 16:41:41 +0100 Subject: [PATCH 387/610] FIX : forgotten form confirm before various payment delete --- htdocs/compta/bank/various_payment/card.php | 8 +++++++- htdocs/langs/en_US/compta.lang | 4 +++- htdocs/langs/fr_FR/compta.lang | 2 ++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/bank/various_payment/card.php b/htdocs/compta/bank/various_payment/card.php index dd734074481..def2abba3a1 100644 --- a/htdocs/compta/bank/various_payment/card.php +++ b/htdocs/compta/bank/various_payment/card.php @@ -179,7 +179,7 @@ if (empty($reshook)) { $action = 'create'; } - if ($action == 'delete') { + if ($action == 'confirm_delete' && $confirm == 'yes') { $result = $object->fetch($id); if ($object->rappro == 0) { @@ -548,6 +548,12 @@ if ($id) { print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneVariousPayment', $object->ref), 'confirm_clone', $formquestion, 'yes', 1, 350); } + // Confirmation of the removal of the Social Contribution + if ($action == 'delete') { + $text = $langs->trans('ConfirmDeleteVariousPayment'); + print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id, $langs->trans('DeleteVariousPayment'), $text, 'confirm_delete', '', '', 2); + } + print dol_get_fiche_head($head, 'card', $langs->trans("VariousPayment"), -1, $object->picto); $morehtmlref = '
'; diff --git a/htdocs/langs/en_US/compta.lang b/htdocs/langs/en_US/compta.lang index c5e1a58d243..efe1e51482b 100644 --- a/htdocs/langs/en_US/compta.lang +++ b/htdocs/langs/en_US/compta.lang @@ -146,9 +146,11 @@ ConfirmPaySalary=Are you sure you want to classify this salary card as paid? DeleteSocialContribution=Delete a social or fiscal tax payment DeleteVAT=Delete a VAT declaration DeleteSalary=Delete a salary card +DeleteVariousPayment=Delete a various payment ConfirmDeleteSocialContribution=Are you sure you want to delete this social/fiscal tax payment ? ConfirmDeleteVAT=Are you sure you want to delete this VAT declaration ? -ConfirmDeleteSalary=Are you sure you want to delete this salary? +ConfirmDeleteSalary=Are you sure you want to delete this salary ? +ConfirmDeleteVariousPayment=Are you sure you want to delete this various payment ? ExportDataset_tax_1=Social and fiscal taxes and payments CalcModeVATDebt=Mode %sVAT on commitment accounting%s. CalcModeVATEngagement=Mode %sVAT on incomes-expenses%s. diff --git a/htdocs/langs/fr_FR/compta.lang b/htdocs/langs/fr_FR/compta.lang index 280069f5cf9..be7a5f464ff 100644 --- a/htdocs/langs/fr_FR/compta.lang +++ b/htdocs/langs/fr_FR/compta.lang @@ -146,9 +146,11 @@ ConfirmPaySalary=Voulez-vous vraiment classer ce salaire comme payé ? DeleteSocialContribution=Effacer une charge fiscale ou sociale DeleteVAT=Supprimer une déclaration de TVA DeleteSalary=Supprimer un salaire +DeleteVariousPayment=Supprimer un paiement divers ConfirmDeleteSocialContribution=Voulez-vous vraiment supprimer ce paiement de taxe sociale / fiscale? ConfirmDeleteVAT=Voulez-vous vraiment supprimer cette déclaration de TVA ? ConfirmDeleteSalary=Êtes-vous sûr de vouloir supprimer ce salaire ? +ConfirmDeleteVariousPayment=Voulez-vous vraiment supprimer ce paiement divers ? ExportDataset_tax_1=Taxes sociales et fiscales et paiements CalcModeVATDebt=Mode %sTVA sur débit%s. CalcModeVATEngagement=Mode %sTVA sur encaissement%s. From fdf8a3f4adc655d9e51ac71e1e84f02e93170d82 Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Fri, 25 Mar 2022 16:43:54 +0100 Subject: [PATCH 388/610] FIX : comment --- htdocs/compta/bank/various_payment/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/bank/various_payment/card.php b/htdocs/compta/bank/various_payment/card.php index def2abba3a1..a2c6c2b21ae 100644 --- a/htdocs/compta/bank/various_payment/card.php +++ b/htdocs/compta/bank/various_payment/card.php @@ -548,7 +548,7 @@ if ($id) { print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneVariousPayment', $object->ref), 'confirm_clone', $formquestion, 'yes', 1, 350); } - // Confirmation of the removal of the Social Contribution + // Confirmation of the removal of the Various Payment if ($action == 'delete') { $text = $langs->trans('ConfirmDeleteVariousPayment'); print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id, $langs->trans('DeleteVariousPayment'), $text, 'confirm_delete', '', '', 2); From 8a7b97bed150e33f37e9601ef1b75e2fd42f644e Mon Sep 17 00:00:00 2001 From: lvessiller Date: Fri, 25 Mar 2022 16:47:41 +0100 Subject: [PATCH 389/610] FIX check thirdparty object loaded and properties exist --- htdocs/compta/facture/class/facture.class.php | 14 ++++++++++++++ htdocs/langs/en_US/errors.lang | 4 +++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 00734ccb680..0269babd064 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2518,6 +2518,20 @@ class Facture extends CommonInvoice { $keymin = strtolower($key); $i = (int) preg_replace('/[^0-9]/', '', $key); + if ($i == 1) { + if (!is_object($this->thirdparty)) { + $langs->load('errors'); + $this->error = $langs->trans('ErrorInvoiceLoadThirdParty', $this->ref); + dol_syslog(__METHOD__.' '.$this->error, LOG_ERR); + return -1; + } + } + if (!property_exists($this->thirdparty, $keymin)) { + $langs->load('errors'); + $this->error = $langs->trans('ErrorInvoiceLoadThirdPartyKey', $keymin, $this->ref); + dol_syslog(__METHOD__.' '.$this->error, LOG_ERR); + return -1; + } $vallabel = $this->thirdparty->$keymin; if ($i > 0) diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 087fcba9e56..94a1cf16a38 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -257,6 +257,8 @@ ErrorLanguageRequiredIfPageIsTranslationOfAnother=The language of new page must ErrorLanguageMustNotBeSourceLanguageIfPageIsTranslationOfAnother=The language of new page must not be the source language if it is set as a translation of another page ErrorAParameterIsRequiredForThisOperation=A parameter is mandatory for this operation ErrorYouMustFirstSetupYourChartOfAccount=You must first setup your chart of account +ErrorInvoiceLoadThirdParty=Can't load third-party object for invoice "%s" +ErrorInvoiceLoadThirdPartyKey=Third-party key "%s" no set for invoice "%s" # Warnings WarningParamUploadMaxFileSizeHigherThanPostMaxSize=Your PHP parameter upload_max_filesize (%s) is higher than PHP parameter post_max_size (%s). This is not a consistent setup. @@ -289,4 +291,4 @@ WarningFailedToAddFileIntoDatabaseIndex=Warning, failed to add file entry into E WarningTheHiddenOptionIsOn=Warning, the hidden option %s is on. WarningCreateSubAccounts=Warning, you can't create directly a sub account, you must create a third party or an user and assign them an accounting code to find them in this list WarningAvailableOnlyForHTTPSServers=Available only if using HTTPS secured connection. -WarningModuleXDisabledSoYouMayMissEventHere=Module %s has not been enabled. So you may miss a lot of event here. \ No newline at end of file +WarningModuleXDisabledSoYouMayMissEventHere=Module %s has not been enabled. So you may miss a lot of event here. From 4479ba801552c09e462e2346f9ec9880f4c651c7 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sat, 26 Mar 2022 08:32:20 +0100 Subject: [PATCH 390/610] FIX missing translation keys --- htdocs/product/class/product.class.php | 14 +++---- htdocs/projet/class/task.class.php | 4 +- htdocs/societe/class/societe.class.php | 56 +++++++++++++------------- 3 files changed, 38 insertions(+), 36 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 9792b11ce39..d308ceb8e53 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -64,13 +64,13 @@ class Product extends CommonObject * @var array List of child tables. To test if we can delete object. */ protected $childtables = array( - 'supplier_proposaldet' => array('parent' => 'supplier_proposal', 'parentkey' => 'fk_supplier_proposal'), - 'propaldet' => array('parent' => 'propal', 'parentkey' => 'fk_propal'), - 'commandedet' => array('parent' => 'commande', 'parentkey' => 'fk_commande'), - 'facturedet' => array('parent' => 'facture', 'parentkey' => 'fk_facture'), - 'contratdet' => array('parent' => 'contrat', 'parentkey' => 'fk_contrat'), - 'facture_fourn_det' => array('parent' => 'facture_fourn', 'parentkey' => 'fk_facture_fourn'), - 'commande_fournisseurdet' => array('parent' => 'commande_fournisseur', 'parentkey' => 'fk_commande') + 'supplier_proposaldet' => array('name' => 'SupplierProposal', 'parent' => 'supplier_proposal', 'parentkey' => 'fk_supplier_proposal'), + 'propaldet' => array('name' => 'Proposal', 'parent' => 'propal', 'parentkey' => 'fk_propal'), + 'commandedet' => array('name' => 'Order', 'parent' => 'commande', 'parentkey' => 'fk_commande'), + 'facturedet' => array('name' => 'Invoice', 'parent' => 'facture', 'parentkey' => 'fk_facture'), + 'contratdet' => array('name' => 'Contract', 'parent' => 'contrat', 'parentkey' => 'fk_contrat'), + 'facture_fourn_det' => array('name' => 'SupplierInvoice', 'parent' => 'facture_fourn', 'parentkey' => 'fk_facture_fourn'), + 'commande_fournisseurdet' => array('name' => 'SupplierOrder', 'parent' => 'commande_fournisseur', 'parentkey' => 'fk_commande') ); /** diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 443e945aecb..d99b13b29c7 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -59,7 +59,9 @@ class Task extends CommonObjectLine /** * @var array List of child tables. To test if we can delete object. */ - protected $childtables = array('projet_task_time'); + protected $childtables = array( + 'projet_task_time' => array('name' => 'Task', 'parent' => 'projet_task', 'parentkey' => 'fk_task') + ); /** * @var int ID parent task diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index bfcdce7d348..7fab734a12c 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -73,18 +73,18 @@ class Societe extends CommonObject * @var array List of child tables. To test if we can delete object. */ protected $childtables = array( - "supplier_proposal" => array('name' => 'SupplierProposal'), - "propal" => array('name' => 'Proposal'), - "commande" => array('name' => 'Order'), - "facture" => array('name' => 'Invoice'), - "facture_rec" => array('name' => 'RecurringInvoiceTemplate'), - "contrat" => array('name' => 'Contract'), - "fichinter" => array('name' => 'Fichinter'), - "facture_fourn" => array('name' => 'SupplierInvoice'), - "commande_fournisseur" => array('name' => 'SupplierOrder'), - "projet" => array('name' => 'Project'), - "expedition" => array('name' => 'Shipment'), - "prelevement_lignes" => array('name' => 'DirectDebitRecord'), + 'supplier_proposal' => array('name' => 'SupplierProposal'), + 'propal' => array('name' => 'Proposal'), + 'commande' => array('name' => 'Order'), + 'facture' => array('name' => 'Invoice'), + 'facture_rec' => array('name' => 'RecurringInvoiceTemplate'), + 'contrat' => array('name' => 'Contract'), + 'fichinter' => array('name' => 'Fichinter'), + 'facture_fourn' => array('name' => 'SupplierInvoice'), + 'commande_fournisseur' => array('name' => 'SupplierOrder'), + 'projet' => array('name' => 'Project'), + 'expedition' => array('name' => 'Shipment'), + 'prelevement_lignes' => array('name' => 'DirectDebitRecord'), ); /** @@ -92,22 +92,22 @@ class Societe extends CommonObject * if name like with @ClassName:FilePathClass:ParentFkFieldName' it will call method deleteByParentField (with parentId as parameters) and FieldName to fetch and delete child object */ protected $childtablesoncascade = array( - "societe_prices", - "societe_address", - "product_fournisseur_price", - "product_customer_price_log", - "product_customer_price", - "@Contact:/contact/class/contact.class.php:fk_soc", - "adherent", - "societe_account", - "societe_rib", - "societe_remise", - "societe_remise_except", - "societe_commerciaux", - "categorie", - "notify", - "notify_def", - "actioncomm", + 'societe_prices', + 'societe_address', + 'product_fournisseur_price', + 'product_customer_price_log', + 'product_customer_price', + '@Contact:/contact/class/contact.class.php:fk_soc', + 'adherent', + 'societe_account', + 'societe_rib', + 'societe_remise', + 'societe_remise_except', + 'societe_commerciaux', + 'categorie', + 'notify', + 'notify_def', + 'actioncomm', ); /** From 396b5324001257e0e6bae997c211b3dc2bf2c05b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 26 Mar 2022 09:40:22 +0100 Subject: [PATCH 391/610] Can cumulate error message on different authentication modes --- htdocs/core/lib/security2.lib.php | 4 +++- htdocs/main.inc.php | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/security2.lib.php b/htdocs/core/lib/security2.lib.php index e156c83b147..1cacd70d602 100644 --- a/htdocs/core/lib/security2.lib.php +++ b/htdocs/core/lib/security2.lib.php @@ -69,6 +69,8 @@ function checkLoginPassEntity($usertotest, $passwordtotest, $entitytotest, $auth // Validation of login/pass/entity with standard modules if (empty($login)) { + unset($_SESSION["dol_loginmesg"]); + $test = true; foreach ($authmode as $mode) { if ($test && $mode && !$login) { @@ -111,7 +113,7 @@ function checkLoginPassEntity($usertotest, $passwordtotest, $entitytotest, $auth // Load translation files required by the page $langs->loadLangs(array('other', 'main', 'errors')); - $_SESSION["dol_loginmesg"] = $langs->transnoentitiesnoconv("ErrorFailedToLoadLoginFileForMode", $mode); + $_SESSION["dol_loginmesg"] = (isset($_SESSION["dol_loginmesg"]) ? $_SESSION["dol_loginmesg"].', ' : '').$langs->transnoentitiesnoconv("ErrorFailedToLoadLoginFileForMode", $mode); } } } diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index a8e99f05856..51a7dcfafcb 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -736,6 +736,7 @@ if (!defined('NOLOGIN')) { // Validation of login/pass/entity // If ok, the variable login will be returned // If error, we will put error message in session under the name dol_loginmesg + // Note authmode is an array for example: array('0'=>'dolibarr', '1'=>'google'); if ($test && $goontestloop && (GETPOST('actionlogin', 'aZ09') == 'login' || $dolibarr_main_authentication != 'dolibarr')) { $login = checkLoginPassEntity($usertotest, $passwordtotest, $entitytotest, $authmode); if ($login === '--bad-login-validity--') { From e8a9a7b73213eafcf3448e728faa088e5420111d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 26 Mar 2022 09:40:34 +0100 Subject: [PATCH 392/610] Responsive --- htdocs/core/tpl/objectline_create.tpl.php | 2 +- htdocs/core/tpl/objectline_edit.tpl.php | 6 +++--- htdocs/fourn/facture/card.php | 11 +++++++---- htdocs/theme/eldy/global.inc.php | 6 ++++++ htdocs/theme/md/style.css.php | 6 ++++++ 5 files changed, 23 insertions(+), 8 deletions(-) diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 9c5ddf44229..428a1163df9 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -371,7 +371,7 @@ if ($nolinesbefore) { if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier' || $object->element == 'invoice_supplier_rec') { // We must have same test in printObjectLines $coldisplay++; ?> - "> + "> '; $coldisplay++; diff --git a/htdocs/core/tpl/objectline_edit.tpl.php b/htdocs/core/tpl/objectline_edit.tpl.php index b07ea5042f0..c59949d5fb7 100644 --- a/htdocs/core/tpl/objectline_edit.tpl.php +++ b/htdocs/core/tpl/objectline_edit.tpl.php @@ -90,7 +90,7 @@ $coldisplay = 0; $coldisplay++; ?> - +
@@ -196,7 +196,7 @@ $coldisplay++; if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier' || $object->element == 'invoice_supplier_rec') { // We must have same test in printObjectLines $coldisplay++; ?> - + - + info_bits & 2) != 2) { print ''.$langs->trans('AmountHT').''.price($object->total_ht, 1, $langs, 0, -1, -1, $conf->currency).''; - print ''.$langs->trans('AmountVAT').''.price($object->total_tva, 1, $langs, 0, -1, -1, $conf->currency).'
        '; + print ''.$langs->trans('AmountVAT').''.price($object->total_tva, 1, $langs, 0, -1, -1, $conf->currency); if (GETPOST('calculationrule')) { $calculationrule = GETPOST('calculationrule', 'alpha'); } else { @@ -3177,13 +3177,16 @@ if ($action == 'create') { } // Show link for "recalculate" if ($object->getVentilExportCompta() == 0) { - $s = $langs->trans("ReCalculate").' '; + $s = ''.$langs->trans("ReCalculate").' '; $s .= ''.$langs->trans("Mode1").''; $s .= ' / '; $s .= ''.$langs->trans("Mode2").''; - print $form->textwithtooltip($s, $langs->trans("CalculationRuleDesc", $calculationrulenum).'
'.$langs->trans("CalculationRuleDescSupplier"), 2, 1, img_picto('', 'help')); + print '
'; + print '         '; + print $form->textwithtooltip($s, $langs->trans("CalculationRuleDesc", $calculationrulenum).'
'.$langs->trans("CalculationRuleDescSupplier"), 2, 1, img_picto('', 'help'), '', 3, '', 0, 'recalculate'); + print '
'; } - print '
'; + print ''; // Amount Local Taxes //TODO: Place into a function to control showing by country or study better option diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 65b8bdcf542..4ce28a34cf2 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -1555,6 +1555,11 @@ table[summary="list_of_modules"] .fa-cog { .maxwidth1000 { max-width: 1000px; } .maxwidth50imp { max-width: 50px !important; } .maxwidth75imp { max-width: 75px !important; } + +.minwidth100onall { min-width: 100px !important; } +.minwidth200onall { min-width: 200px !important; } +.minwidth250onall { min-width: 250px !important; } + .minheight20 { min-height: 20px; } .minheight30 { min-height: 30px; } .minheight40 { min-height: 40px; } @@ -1763,6 +1768,7 @@ select.widthcentpercentminusxx, span.widthcentpercentminusxx:not(.select2-select .maxwidth50onsmartphone { max-width: 40px; } .maxwidth75onsmartphone { max-width: 50px; } .maxwidth100onsmartphone { max-width: 70px; } + .maxwidth125onsmartphone { max-width: 100px; } .maxwidth150onsmartphone { max-width: 120px; } .maxwidth150onsmartphoneimp { max-width: 120px !important; } .maxwidth200onsmartphone { max-width: 200px; } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 8fbe02beba9..15095b3b3e8 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -1643,6 +1643,11 @@ tr.nobottom td { .maxwidth500 { max-width: 500px; } .maxwidth50imp { max-width: 50px !important; } .maxwidth75imp { max-width: 75px !important; } + +.minwidth100onall { min-width: 100px !important; } +.minwidth200onall { min-width: 200px !important; } +.minwidth250onall { min-width: 250px !important; } + .minheight20 { min-height: 20px; } .minheight30 { min-height: 30px; } .minheight40 { min-height: 40px; } @@ -1835,6 +1840,7 @@ select.widthcentpercentminusxx, span.widthcentpercentminusxx:not(.select2-select .maxwidth50onsmartphone { max-width: 40px; } .maxwidth75onsmartphone { max-width: 50px; } .maxwidth100onsmartphone { max-width: 70px; } + .maxwidth125onsmartphone { max-width: 100px; } .maxwidth150onsmartphone { max-width: 120px; } .maxwidth150onsmartphoneimp { max-width: 120px !important; } .maxwidth200onsmartphone { max-width: 200px; } From bc938d86bae39a8d6b0ed5cc79299c0624a31b60 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 26 Mar 2022 11:22:54 +0100 Subject: [PATCH 393/610] NEW Can enter price with tax for predefined products on purchase objects --- htdocs/core/tpl/objectline_create.tpl.php | 12 +- .../class/fournisseur.commande.class.php | 4 +- htdocs/fourn/commande/card.php | 66 +++++----- htdocs/fourn/facture/card.php | 25 +++- htdocs/supplier_proposal/card.php | 123 +++++++++++++----- 5 files changed, 153 insertions(+), 77 deletions(-) diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 428a1163df9..b09a33f44f6 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -1034,18 +1034,18 @@ if (!empty($usemargins) && $user->rights->margins->creer) { jQuery("#multicurrency_price_ht").val('').show(); jQuery("#title_up_ht, #title_up_ht_currency").show(); - jQuery("#price_ht").val('').hide(); + //jQuery("#price_ht").val('').hide(); jQuery("#multicurrency_price_ht").val('').hide(); jQuery("#title_up_ht, #title_up_ht_currency").hide(); - global->MAIN_ENABLE_EDIT_PREDEF_PRICETTC)) { ?> - jQuery("#price_ttc").val('').hide(); - jQuery("#multicurrency_price_ttc").val('').hide(); - jQuery("#title_up_ttc, #title_up_ttc_currency").hide(); - + global->MAIN_DISABLE_EDIT_PREDEF_PRICETTC)) { ?> jQuery("#price_ttc").val('').show(); jQuery("#multicurrency_price_ttc").val('').show(); jQuery("#title_up_ttc, #title_up_ttc_currency").show(); + + jQuery("#price_ttc").val('').hide(); + jQuery("#multicurrency_price_ttc").val('').hide(); + jQuery("#title_up_ttc, #title_up_ttc_currency").hide(); jQuery("#fourn_ref, #tva_tx, #title_vat").hide(); /* jQuery("#title_fourn_ref").hide(); */ diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index a195a2ed2e1..2dcf70765f9 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1718,7 +1718,7 @@ class CommandeFournisseur extends CommonOrder * Add order line * * @param string $desc Description - * @param float $pu_ht Unit price + * @param float $pu_ht Unit price (used if $price_base_type is 'HT') * @param float $qty Quantity * @param float $txtva Taux tva * @param float $txlocaltax1 Localtax1 tax @@ -1728,7 +1728,7 @@ class CommandeFournisseur extends CommonOrder * @param string $ref_supplier Supplier reference price * @param float $remise_percent Remise * @param string $price_base_type HT or TTC - * @param float $pu_ttc Unit price TTC + * @param float $pu_ttc Unit price TTC (used if $price_base_type is 'TTC') * @param int $type Type of line (0=product, 1=service) * @param int $info_bits More information * @param bool $notrigger Disable triggers diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index c7a937518d7..b71ba0de941 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -412,10 +412,9 @@ if (empty($reshook)) { // Set if we used free entry or predefined product $predef = ''; $product_desc = (GETPOSTISSET('dp_desc') ? GETPOST('dp_desc', 'restricthtml') : ''); - $price_ht = price2num(GETPOST('price_ht'), 'MU', 2); - $price_ht_devise = price2num(GETPOST('multicurrency_price_ht'), 'CU', 2); $date_start = dol_mktime(GETPOST('date_start'.$predef.'hour'), GETPOST('date_start'.$predef.'min'), GETPOST('date_start'.$predef.'sec'), GETPOST('date_start'.$predef.'month'), GETPOST('date_start'.$predef.'day'), GETPOST('date_start'.$predef.'year')); $date_end = dol_mktime(GETPOST('date_end'.$predef.'hour'), GETPOST('date_end'.$predef.'min'), GETPOST('date_end'.$predef.'sec'), GETPOST('date_end'.$predef.'month'), GETPOST('date_end'.$predef.'day'), GETPOST('date_end'.$predef.'year')); + $prod_entry_mode = GETPOST('prod_entry_mode'); if ($prod_entry_mode == 'free') { $idprod = 0; @@ -425,6 +424,8 @@ if (empty($reshook)) { $tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0); // Can be '1.2' or '1.2 (CODE)' + $price_ht = price2num(GETPOST('price_ht'), 'MU', 2); + $price_ht_devise = price2num(GETPOST('multicurrency_price_ht'), 'CU', 2); $price_ttc = price2num(GETPOST('price_ttc'), 'MU', 2); $price_ttc_devise = price2num(GETPOST('multicurrency_price_ttc'), 'CU', 2); $qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS'); @@ -461,7 +462,7 @@ if (empty($reshook)) { setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Description')), null, 'errors'); $error++; } - if (GETPOST('qty', 'int') == '') { + if (GETPOST('qty', 'alpha') == '') { // 0 is allowed for order setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Qty')), null, 'errors'); $error++; } @@ -506,13 +507,14 @@ if (empty($reshook)) { } } elseif (GETPOST('idprodfournprice', 'alpha') > 0) { $qtytosearch = $qty; // Just to see if a price exists for the quantity. Not used to found vat. - //$qtytosearch=-1; // We force qty to -1 to be sure to find if a supplier price exist + //$qtytosearch = -1; // We force qty to -1 to be sure to find if a supplier price exist $idprod = $productsupplier->get_buyprice(GETPOST('idprodfournprice', 'alpha'), $qtytosearch); $res = $productsupplier->fetch($idprod); } if ($idprod > 0) { $label = $productsupplier->label; + // Define output language if (!empty($conf->global->MAIN_MULTILANGS) && !empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) { $outputlangs = $langs; @@ -550,41 +552,44 @@ if (empty($reshook)) { $ref_supplier = $productsupplier->ref_supplier; - $type = $productsupplier->type; - if (GETPOST('price_ht') != '' || GETPOST('price_ht_devise') != '') { - $price_base_type = 'HT'; - $pu = price2num($price_ht, 'MU'); - $pu_ht_devise = price2num($price_ht_devise, 'CU'); - } elseif (GETPOST('price_ttc') != '' || GETPOST('price_ttc_devise') != '') { - $price_base_type = 'TTC'; - $pu = price2num($price_ttc, 'MU'); - $pu_ht_devise = price2num($price_ttc_devise, 'CU'); - } else { - $price_base_type = ($productsupplier->fourn_price_base_type ? $productsupplier->fourn_price_base_type : 'HT'); - if (empty($object->multicurrency_code) || ($productsupplier->fourn_multicurrency_code != $object->multicurrency_code)) { // If object is in a different currency and price not in this currency - $pu = $productsupplier->fourn_pu; - $pu_ht_devise = 0; - } else { - $pu = $productsupplier->fourn_pu; - $pu_ht_devise = $productsupplier->fourn_multicurrency_unitprice; - } + // Get vat rate + if (!GETPOSTISSET('tva_tx')) { // If vat rate not provided from the form (the form has the priority) + $tva_tx = get_default_tva($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice', 'alpha')); + $tva_npr = get_default_npr($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice', 'alpha')); } - - $tva_tx = get_default_tva($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice', 'alpha')); - $tva_npr = get_default_npr($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice', 'alpha')); if (empty($tva_tx)) { $tva_npr = 0; } $localtax1_tx = get_localtax($tva_tx, 1, $mysoc, $object->thirdparty, $tva_npr); $localtax2_tx = get_localtax($tva_tx, 2, $mysoc, $object->thirdparty, $tva_npr); + $type = $productsupplier->type; + if (GETPOST('price_ht') != '' || GETPOST('price_ht_devise') != '') { + $price_base_type = 'HT'; + $pu = price2num($price_ht, 'MU'); + $pu_devise = price2num($price_ht_devise, 'CU'); + } elseif (GETPOST('price_ttc') != '' || GETPOST('price_ttc_devise') != '') { + $price_base_type = 'TTC'; + $pu = price2num($price_ttc, 'MU'); + $pu_devise = price2num($price_ttc_devise, 'CU'); + } else { + $price_base_type = ($productsupplier->fourn_price_base_type ? $productsupplier->fourn_price_base_type : 'HT'); + if (empty($object->multicurrency_code) || ($productsupplier->fourn_multicurrency_code != $object->multicurrency_code)) { // If object is in a different currency and price not in this currency + $pu = $productsupplier->fourn_pu; + $pu_devise = 0; + } else { + $pu = $productsupplier->fourn_pu; + $pu_devise = $productsupplier->fourn_multicurrency_unitprice; + } + } + if (empty($pu)) { $pu = 0; // If pu is '' or null, we force to have a numeric value } $result = $object->addline( $desc, - $pu, + ($price_base_type == 'HT' ? $pu : 0), $qty, $tva_tx, $localtax1_tx, @@ -594,7 +599,7 @@ if (empty($reshook)) { $ref_supplier, $remise_percent, $price_base_type, - $pu_ttc, + ($price_base_type == 'TTC' ? $pu : 0), $type, $tva_npr, '', @@ -602,7 +607,7 @@ if (empty($reshook)) { $date_end, $array_options, $productsupplier->fk_unit, - $pu_ht_devise, + $pu_devise, '', 0 ); @@ -645,7 +650,7 @@ if (empty($reshook)) { } $price_base_type = 'HT'; $pu_ht_devise = price2num($price_ht_devise, 'CU'); - // var_dump($pu_ht.' '.$tva_tx.' '.$pu_ttc.' '.$price_base_type.' '.$pu_ht_devise); exit; + $result = $object->addline($desc, $pu_ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, 0, 0, $ref_supplier, $remise_percent, $price_base_type, $pu_ttc, $type, '', '', $date_start, $date_end, $array_options, $fk_unit, $pu_ht_devise); } @@ -759,6 +764,7 @@ if (empty($reshook)) { $price_base_type = 'HT'; $ht = price2num(GETPOST('price_ht'), '', 2); } else { + $reg = array(); $vatratecleaned = $vat_rate; if (preg_match('/^(.*)\s*\((.*)\)$/', $vat_rate, $reg)) { // If vat is "xx (yy)" $vatratecleaned = trim($reg[1]); @@ -770,7 +776,7 @@ if (empty($reshook)) { $price_base_type = 'HT'; } - $pu_ht_devise = price2num(GETPOST('multicurrency_subprice'), '', 2); + $pu_ht_devise = price2num(GETPOST('multicurrency_subprice'), 'CU', 2); // Extrafields Lines $extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line); diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 8778e0d40b8..f4d628d5882 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1447,7 +1447,7 @@ if (empty($reshook)) { setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Description')), null, 'errors'); $error++; } - if (!GETPOST('qty')) { + if (!GETPOST('qty', 'alpha')) { // 0 is NOT allowed for invoices setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Qty')), null, 'errors'); $error++; } @@ -1499,12 +1499,27 @@ if (empty($reshook)) { if ($idprod > 0) { $label = $productsupplier->label; - + // Define output language + if (!empty($conf->global->MAIN_MULTILANGS) && !empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) { + $outputlangs = $langs; + $newlang = ''; + if (empty($newlang) && GETPOST('lang_id', 'aZ09')) { + $newlang = GETPOST('lang_id', 'aZ09'); + } + if (empty($newlang)) { + $newlang = $object->thirdparty->default_lang; + } + if (!empty($newlang)) { + $outputlangs = new Translate("", $conf); + $outputlangs->setDefaultLang($newlang); + } + $desc = (!empty($productsupplier->multilangs[$outputlangs->defaultlang]["description"])) ? $productsupplier->multilangs[$outputlangs->defaultlang]["description"] : $productsupplier->description; + } else { + $desc = $productsupplier->description; + } // if we use supplier description of the products if (!empty($productsupplier->desc_supplier) && !empty($conf->global->PRODUIT_FOURN_TEXTS)) { $desc = $productsupplier->desc_supplier; - } else { - $desc = $productsupplier->description; } //If text set in desc is the same as product descpription (as now it's preloaded) whe add it only one time @@ -3555,7 +3570,7 @@ if ($action == 'create') { } print '
'; - print ''; + print '
'; global $forceall, $senderissupplier, $dateSelector, $inputalsopricewithtax; $forceall = 1; $dateSelector = 0; $inputalsopricewithtax = 1; diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index b66dfc94ed6..f0594b90b6f 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -541,21 +541,28 @@ if (empty($reshook)) { $product_desc = (GETPOSTISSET('dp_desc') ? GETPOST('dp_desc', 'restricthtml') : ''); $date_start = dol_mktime(GETPOST('date_start'.$predef.'hour'), GETPOST('date_start'.$predef.'min'), GETPOST('date_start'.$predef.'sec'), GETPOST('date_start'.$predef.'month'), GETPOST('date_start'.$predef.'day'), GETPOST('date_start'.$predef.'year')); $date_end = dol_mktime(GETPOST('date_end'.$predef.'hour'), GETPOST('date_end'.$predef.'min'), GETPOST('date_end'.$predef.'sec'), GETPOST('date_end'.$predef.'month'), GETPOST('date_end'.$predef.'day'), GETPOST('date_end'.$predef.'year')); + $ref_supplier = GETPOST('fourn_ref', 'alpha'); + $prod_entry_mode = GETPOST('prod_entry_mode'); if ($prod_entry_mode == 'free') { $idprod = 0; - $price_ht = price2num(GETPOST('price_ht'), 'MU', 2); - $tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0); } else { $idprod = GETPOST('idprod', 'int'); - $price_ht = price2num(GETPOST('price_ht'), 'MU', 2); - $tva_tx = ''; } - $qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS'); - $remise_percent = price2num(GETPOST('remise_percent'.$predef), 2); + $tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0); // Can be '1.2' or '1.2 (CODE)' + + $price_ht = price2num(GETPOST('price_ht'), 'MU', 2); $price_ht_devise = price2num(GETPOST('multicurrency_price_ht'), 'CU', 2); + $price_ttc = price2num(GETPOST('price_ttc'), 'MU', 2); + $price_ttc_devise = price2num(GETPOST('multicurrency_price_ttc'), 'CU', 2); + $qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS'); + + $remise_percent = (GETPOSTISSET('remise_percent'.$predef) ? price2num(GETPOST('remise_percent'.$predef, 'alpha'), '', 2) : 0); + if (empty($remise_percent)) { + $remise_percent = 0; + } // Extrafields $extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line); @@ -568,6 +575,10 @@ if (empty($reshook)) { } } + if ($prod_entry_mode == 'free' && GETPOST('price_ht') < 0 && $qty < 0) { + setEventMessages($langs->trans('ErrorBothFieldCantBeNegative', $langs->transnoentitiesnoconv('UnitPrice'), $langs->transnoentitiesnoconv('Qty')), null, 'errors'); + $error++; + } if ($prod_entry_mode == 'free' && (empty($idprod) || $idprod < 0) && GETPOST('type') < 0) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors'); $error++; @@ -589,10 +600,7 @@ if (empty($reshook)) { $db->begin(); - // Ecrase $pu par celui du produit - // Ecrase $desc par celui du produit - // Ecrase $txtva par celui du produit - if (($prod_entry_mode != 'free') && empty($error)) { // With combolist mode idprodfournprice is > 0 or -1. With autocomplete, idprodfournprice is > 0 or '' + if ($prod_entry_mode != 'free' && empty($error)) { // With combolist mode idprodfournprice is > 0 or -1. With autocomplete, idprodfournprice is > 0 or '' $productsupplier = new ProductFournisseur($db); $idprod = 0; @@ -603,7 +611,7 @@ if (empty($reshook)) { $reg = array(); if (preg_match('/^idprod_([0-9]+)$/', GETPOST('idprodfournprice', 'alpha'), $reg)) { $idprod = $reg[1]; - $res = $productsupplier->fetch($idprod); // Load product from its ID + $res = $productsupplier->fetch($idprod); // Load product from its id // Call to init some price properties of $productsupplier // So if a supplier price already exists for another thirdparty (first one found), we use it as reference price if (!empty($conf->global->SUPPLIER_TAKE_FIRST_PRICE_IF_NO_PRICE_FOR_CURRENT_SUPPLIER)) { @@ -626,42 +634,85 @@ if (empty($reshook)) { if ($idprod > 0) { $label = $productsupplier->label; - // if we use supplier description of the products - if (!empty($productsupplier->desc_supplier) && !empty($conf->global->PRODUIT_FOURN_TEXTS)) { - $desc = $productsupplier->desc_supplier; + // Define output language + if (!empty($conf->global->MAIN_MULTILANGS) && !empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) { + $outputlangs = $langs; + $newlang = ''; + if (empty($newlang) && GETPOST('lang_id', 'aZ09')) { + $newlang = GETPOST('lang_id', 'aZ09'); + } + if (empty($newlang)) { + $newlang = $object->thirdparty->default_lang; + } + if (!empty($newlang)) { + $outputlangs = new Translate("", $conf); + $outputlangs->setDefaultLang($newlang); + } + $desc = (!empty($productsupplier->multilangs[$outputlangs->defaultlang]["description"])) ? $productsupplier->multilangs[$outputlangs->defaultlang]["description"] : $productsupplier->description; } else { $desc = $productsupplier->description; } + // if we use supplier description of the products + if (!empty($productsupplier->desc_supplier) && !empty($conf->global->PRODUIT_FOURN_TEXTS)) { + $desc = $productsupplier->desc_supplier; + } - if (trim($product_desc) != trim($desc)) { + //If text set in desc is the same as product descpription (as now it's preloaded) whe add it only one time + if (trim($product_desc) == trim($desc) && !empty($conf->global->PRODUIT_AUTOFILL_DESC)) { + $product_desc=''; + } + + if (!empty($product_desc) && !empty($conf->global->MAIN_NO_CONCAT_DESCRIPTION)) { + $desc = $product_desc; + } + if (!empty($product_desc) && trim($product_desc) != trim($desc)) { $desc = dol_concatdesc($desc, $product_desc, '', !empty($conf->global->MAIN_CHANGE_ORDER_CONCAT_DESCRIPTION)); } - $type = $productsupplier->type; - $price_base_type = ($productsupplier->fourn_price_base_type ? $productsupplier->fourn_price_base_type : 'HT'); - $ref_supplier = $productsupplier->ref_supplier; - $tva_tx = get_default_tva($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice', 'alpha')); - $tva_npr = get_default_npr($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice', 'alpha')); + // Get vat rate + if (!GETPOSTISSET('tva_tx')) { // If vat rate not provided from the form (the form has the priority) + $tva_tx = get_default_tva($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice', 'alpha')); + $tva_npr = get_default_npr($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice', 'alpha')); + } if (empty($tva_tx)) { $tva_npr = 0; } $localtax1_tx = get_localtax($tva_tx, 1, $mysoc, $object->thirdparty, $tva_npr); $localtax2_tx = get_localtax($tva_tx, 2, $mysoc, $object->thirdparty, $tva_npr); - if (empty($pu_ht)) { - $pu_ht = 0; // If pu is '' or null, we force to have a numeric value + $type = $productsupplier->type; + if (GETPOST('price_ht') != '' || GETPOST('price_ht_devise') != '') { + $price_base_type = 'HT'; + $pu = price2num($price_ht, 'MU'); + $pu_devise = price2num($price_ht_devise, 'CU'); + } elseif (GETPOST('price_ttc') != '' || GETPOST('price_ttc_devise') != '') { + $price_base_type = 'TTC'; + $pu = price2num($price_ttc, 'MU'); + $pu_devise = price2num($price_ttc_devise, 'CU'); + } else { + $price_base_type = ($productsupplier->fourn_price_base_type ? $productsupplier->fourn_price_base_type : 'HT'); + if (empty($object->multicurrency_code) || ($productsupplier->fourn_multicurrency_code != $object->multicurrency_code)) { // If object is in a different currency and price not in this currency + $pu = $productsupplier->fourn_pu; + $pu_devise = 0; + } else { + $pu = $productsupplier->fourn_pu; + $pu_devise = $productsupplier->fourn_multicurrency_unitprice; + } + } + + if (empty($pu)) { + $pu = 0; // If pu is '' or null, we force to have a numeric value } // If GETPOST('idprodfournprice') is a numeric, we can use it. If it is empty or if it is 'idprod_123', we should use -1 (not used) $fournprice = (is_numeric(GETPOST('idprodfournprice', 'alpha')) ? GETPOST('idprodfournprice', 'alpha') : -1); $buyingprice = 0; - $pu_ht_devise = price2num($price_ht_devise, 'MU'); $result = $object->addline( $desc, - $pu_ht, + ($price_base_type == 'HT' ? $pu : 0), $qty, $tva_tx, $localtax1_tx, @@ -669,7 +720,7 @@ if (empty($reshook)) { $productsupplier->id, $remise_percent, $price_base_type, - $pu_ttc, + ($price_base_type == 'TTC' ? $pu : 0), $tva_npr, $type, -1, @@ -683,7 +734,7 @@ if (empty($reshook)) { $productsupplier->fk_unit, '', 0, - $pu_ht_devise, + $pu_devise, $date_start, $date_end ); @@ -709,6 +760,7 @@ if (empty($reshook)) { } elseif ((GETPOST('price_ht') !== '' || GETPOST('price_ttc') !== '' || GETPOST('multicurrency_price_ht') != '') && empty($error)) { // Free product. // $price_ht is already set $pu_ht = price2num($price_ht, 'MU'); $pu_ttc = price2num(GETPOST('price_ttc'), 'MU'); + $tva_npr = (preg_match('/\*/', $tva_tx) ? 1 : 0); $tva_tx = str_replace('*', '', $tva_tx); $label = (GETPOST('product_label') ? GETPOST('product_label') : ''); @@ -718,21 +770,22 @@ if (empty($reshook)) { $fk_unit = GETPOST('units', 'alpha'); if (!preg_match('/\((.*)\)/', $tva_tx)) { - $tva_tx = price2num($tva_tx); // When vat is text input field + $tva_tx = price2num($tva_tx); // $txtva can have format '5,1' or '5.1' or '5.1(XXX)', we must clean only if '5,1' } // Local Taxes $localtax1_tx = get_localtax($tva_tx, 1, $mysoc, $object->thirdparty); $localtax2_tx = get_localtax($tva_tx, 2, $mysoc, $object->thirdparty); - if ($price_ht !== '') { + if (GETPOST('price_ht') != '' || GETPOST('price_ht_devise') != '') { $pu_ht = price2num($price_ht, 'MU'); // $pu_ht must be rounded according to settings } else { $pu_ttc = price2num(GETPOST('price_ttc'), 'MU'); $pu_ht = price2num($pu_ttc / (1 + ($tva_tx / 100)), 'MU'); // $pu_ht must be rounded according to settings } $price_base_type = 'HT'; - $pu_ht_devise = price2num($price_ht_devise, 'MU'); + $pu_ht_devise = price2num($price_ht_devise, 'CU'); + $info_bits = 0; $result = $object->addline( $desc, @@ -800,6 +853,7 @@ if (empty($reshook)) { unset($_POST['price_ht']); unset($_POST['multicurrency_price_ht']); unset($_POST['price_ttc']); + unset($_POST['fourn_ref']); unset($_POST['tva_tx']); unset($_POST['label']); unset($_POST['product_ref']); @@ -813,6 +867,8 @@ if (empty($reshook)) { unset($_POST['np_markRate']); unset($_POST['dp_desc']); unset($_POST['idprodfournprice']); + unset($_POST['units']); + unset($_POST['idprod']); unset($_POST['date_starthour']); @@ -852,10 +908,9 @@ if (empty($reshook)) { $localtax2_rate = get_localtax($vat_rate, 2, $mysoc, $object->thirdparty); if (GETPOST('price_ht') != '') { + $price_base_type = 'HT'; $ht = price2num(GETPOST('price_ht'), '', 2); - } - - if (GETPOST('price_ttc') != '') { + } else { $reg = array(); $vatratecleaned = $vat_rate; if (preg_match('/^(.*)\s*\((.*)\)$/', $vat_rate, $reg)) { // If vat is "xx (yy)" @@ -865,10 +920,10 @@ if (empty($reshook)) { $ttc = price2num(GETPOST('price_ttc'), '', 2); $ht = $ttc / (1 + ($vatratecleaned / 100)); + $price_base_type = 'HT'; } - $price_base_type = 'HT'; - $pu_ht_devise = price2num(GETPOST('multicurrency_subprice'), 'CU'); + $pu_ht_devise = price2num(GETPOST('multicurrency_subprice'), 'CU', 2); // Add buying price $fournprice = (GETPOST('fournprice') ? GETPOST('fournprice') : ''); From 50847efdf8fe0f5bd0e248c916f852937b72d768 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 26 Mar 2022 11:44:36 +0100 Subject: [PATCH 394/610] Add the country into the popup with info on company. --- htdocs/core/tpl/objectline_create.tpl.php | 17 ++++++++++------- htdocs/main.inc.php | 5 ++++- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index b09a33f44f6..17683562be5 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -645,17 +645,20 @@ if (!empty($usemargins) && $user->rights->margins->creer) { $("#select_type").change(function() { setforfree(); - if (jQuery('#select_type').val() >= 0) - { - /* focus work on a standard textarea but not if field was replaced with CKEDITOR */ + + if (jQuery('#select_type').val() >= 0) { + console.log("Set focus on description field"); + /* this focus code works on a standard textarea but not if field was replaced with CKEDITOR */ jQuery('#dp_desc').focus(); - /* focus if CKEDITOR */ - if (typeof CKEDITOR == "object" && typeof CKEDITOR.instances != "undefined") - { + /* this focus code works for CKEDITOR */ + if (typeof CKEDITOR == "object" && typeof CKEDITOR.instances != "undefined") { var editor = CKEDITOR.instances['dp_desc']; - if (editor) { editor.focus(); } + if (editor) { + editor.focus(); + } } } + console.log("Hide/show date according to product type"); if (jQuery('#select_type').val() == '0') { diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 51a7dcfafcb..fe0986e8d13 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -2104,6 +2104,7 @@ function top_menu_user($hideloginname = 0, $urllogout = '') $dropdownBody .= '
'.$langs->transcountry("ProfId6", $mysoc->country_code).': '.dol_print_profids(getDolGlobalString("MAIN_INFO_PROFID6"), 6).''; } $dropdownBody .= '
'.$langs->trans("VATIntraShort").': '.dol_print_profids(getDolGlobalString("MAIN_INFO_TVAINTRA"), 'VAT').''; + $dropdownBody .= '
'.$langs->trans("Country").': '.$langs->trans("Country".$mysoc->country_code).''; $dropdownBody .= ''; @@ -2242,7 +2243,7 @@ function top_menu_user($hideloginname = 0, $urllogout = '') '; } else { $btnUser = ' -
'; } + print ''; } else { print ''; @@ -501,26 +503,27 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie // Bank check number print ''; print ''; // Check transmitter print ''; print ''; // Bank name print ''; print ''; // Comments print ''; print ''; + print ''; + print ''; print '
'; + print '
aa'; $tooltiphelp = (($langs->trans($constname . 'Tooltip') != $constname . 'Tooltip') ? $langs->trans($constname . 'Tooltip') : ''); + $tooltiphelp .= (($langs->trans($constname . 'Tooltip2') && $langs->trans($constname . 'Tooltip2') != $constname . 'Tooltip2') ? '

'."\n".$langs->trans($constname . 'Tooltip2') : ''); print ''.$form->textwithpicto($langs->trans($constname), $tooltiphelp, 1, 'info', '', 0, 3, 'tootips'.$constname).''; print '
'; @@ -314,6 +315,7 @@ if ($action == 'edit') { $setupnotempty++; print '
'; $tooltiphelp = (($langs->trans($constname . 'Tooltip') != $constname . 'Tooltip') ? $langs->trans($constname . 'Tooltip') : ''); + $tooltiphelp .= (($langs->trans($constname . 'Tooltip2') && $langs->trans($constname . 'Tooltip2') != $constname . 'Tooltip2') ? '

'."\n".$langs->trans($constname . 'Tooltip2') : ''); print $form->textwithpicto($langs->trans($constname), $tooltiphelp); print '
'; diff --git a/htdocs/core/modules/modPartnership.class.php b/htdocs/core/modules/modPartnership.class.php index 516c2b41e13..3bec23d0d37 100644 --- a/htdocs/core/modules/modPartnership.class.php +++ b/htdocs/core/modules/modPartnership.class.php @@ -75,7 +75,7 @@ class modPartnership extends DolibarrModules // $this->editor_url = 'https://www.example.com'; // Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z' - $this->version = 'development'; + $this->version = 'experimental'; // Url to the file with your last numberversion of this module //$this->url_last_version = 'http://www.example.com/versionmodule.txt'; diff --git a/htdocs/langs/en_US/eventorganization.lang b/htdocs/langs/en_US/eventorganization.lang index bc334fe08cf..9cd52930714 100644 --- a/htdocs/langs/en_US/eventorganization.lang +++ b/htdocs/langs/en_US/eventorganization.lang @@ -37,7 +37,8 @@ EventOrganization=Event organization Settings=Settings EventOrganizationSetupPage = Event Organization setup page EVENTORGANIZATION_TASK_LABEL = Label of tasks to create automatically when project is validated -EVENTORGANIZATION_TASK_LABELTooltip = When you validate an organized event, some tasks can be automatically created in the project

For example:
Send Call for Conference
Send Call for Booth
Receive call for conferences
Receive call for Booth
Open subscriptions to events for attendees
Send remind of event to speakers
Send remind of event to Booth hoster
Send remind of event to attendees +EVENTORGANIZATION_TASK_LABELTooltip = When you validate an event to organize, some tasks can be automatically created in the project

For example:
Send Call for Conferences
Send Call for Booths
Validate suggestions of Conferences
Validate application for Booths
Open subscriptions to the event for attendees
Send a remind of the event to speakers
Send a remind of the event to Booth hosters
Send a remind of the event to attendees +EVENTORGANIZATION_TASK_LABELTooltip2=Keep empty if you don't need to create tasks automatically. EVENTORGANIZATION_CATEG_THIRDPARTY_CONF = Category to add to third-parties automatically created when someone suggests a conference EVENTORGANIZATION_CATEG_THIRDPARTY_BOOTH = Category to add to third-parties automatically created when they suggests a booth EVENTORGANIZATION_TEMPLATE_EMAIL_ASK_CONF = Template of email to send after receiving a suggestion of a conference. diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 4ce28a34cf2..062f0592020 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -2402,7 +2402,7 @@ img.photorefnoborder { } .trextrafieldseparator td, .trextrafields_collapse_last td { /* border-bottom: 2px solid var(--colorbackhmenu1) !important; */ - border-bottom: 2px solid var(--colortopbordertitle1) !important; + /* border-bottom: 2px solid var(--colortopbordertitle1) !important; */ } .tdhrthin { From 453c8981e835c6dbd956be607dfdc5325e1da4b1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 26 Mar 2022 12:24:28 +0100 Subject: [PATCH 396/610] CSS --- htdocs/core/class/extrafields.class.php | 2 +- htdocs/core/tpl/extrafields_view.tpl.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 996f1f90f9c..08e4503748f 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1886,7 +1886,7 @@ class ExtraFields $out = '<'.$tagtype.' id="trextrafieldseparator'.$key.(!empty($object->id)?'_'.$object->id:'').'" class="trextrafieldseparator trextrafieldseparator'.$key.(!empty($object->id)?'_'.$object->id:'').'">'; $out .= '<'.$tagtype_dyn.' '.(!empty($colspan)?'colspan="' . $colspan . '"':'').'>'; // Some js code will be injected here to manage the collapsing of extrafields - $out .= ' '; + $out .= ' '; $out .= ''; $out .= $langs->trans($this->attributes[$object->table_element]['label'][$key]); $out .= ''; diff --git a/htdocs/core/tpl/extrafields_view.tpl.php b/htdocs/core/tpl/extrafields_view.tpl.php index ac243396c72..da6f90892c4 100644 --- a/htdocs/core/tpl/extrafields_view.tpl.php +++ b/htdocs/core/tpl/extrafields_view.tpl.php @@ -1,7 +1,7 @@ * Copyright (C) 2014 Juanjo Menent - * Copyright (C) 2021 Frédéric France + * Copyright (C) 2021 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by From c2a088c5ff022e3eec4eb4342f401950fde1a5a5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 26 Mar 2022 12:34:52 +0100 Subject: [PATCH 397/610] Fix regression in phpunit --- htdocs/core/lib/security2.lib.php | 4 +--- test/phpunit/SecurityTest.php | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/htdocs/core/lib/security2.lib.php b/htdocs/core/lib/security2.lib.php index 1cacd70d602..4b70419630f 100644 --- a/htdocs/core/lib/security2.lib.php +++ b/htdocs/core/lib/security2.lib.php @@ -69,8 +69,6 @@ function checkLoginPassEntity($usertotest, $passwordtotest, $entitytotest, $auth // Validation of login/pass/entity with standard modules if (empty($login)) { - unset($_SESSION["dol_loginmesg"]); - $test = true; foreach ($authmode as $mode) { if ($test && $mode && !$login) { @@ -113,7 +111,7 @@ function checkLoginPassEntity($usertotest, $passwordtotest, $entitytotest, $auth // Load translation files required by the page $langs->loadLangs(array('other', 'main', 'errors')); - $_SESSION["dol_loginmesg"] = (isset($_SESSION["dol_loginmesg"]) ? $_SESSION["dol_loginmesg"].', ' : '').$langs->transnoentitiesnoconv("ErrorFailedToLoadLoginFileForMode", $mode); + $_SESSION["dol_loginmesg"] = (empty($_SESSION["dol_loginmesg"]) ? '' : $_SESSION["dol_loginmesg"].', ').$langs->transnoentitiesnoconv("ErrorFailedToLoadLoginFileForMode", $mode); } } } diff --git a/test/phpunit/SecurityTest.php b/test/phpunit/SecurityTest.php index eabfe389174..e1180c980ef 100644 --- a/test/phpunit/SecurityTest.php +++ b/test/phpunit/SecurityTest.php @@ -604,7 +604,7 @@ class SecurityTest extends PHPUnit\Framework\TestCase $login=checkLoginPassEntity('admin', 'admin', 1, array('forceuser')); print __METHOD__." login=".$login."\n"; - $this->assertEquals($login, ''); // Expected '' because should failed because login 'auto' does not exists + $this->assertEquals('', $login, 'Error'); // Expected '' because should failed because login 'auto' does not exists } /** From 97a1774bf3a55fec7e92e563f934103f5027fc7a Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sat, 26 Mar 2022 12:57:30 +0100 Subject: [PATCH 398/610] NEW add hooks contact tab badge and hooks parameter for avoid conflicts --- htdocs/core/class/html.form.class.php | 2 +- htdocs/core/lib/company.lib.php | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index eca88386656..0f8a55960c9 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -8864,7 +8864,7 @@ class Form // Add where from hooks if (is_object($hookmanager)) { - $parameters = array(); + $parameters = array('showrefnav' => true); $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook $object->next_prev_filter .= $hookmanager->resPrint; } diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 8ebf2e02047..a98931ab79f 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -65,6 +65,15 @@ function societe_prepare_head(Societe $object) $sql = "SELECT COUNT(p.rowid) as nb"; $sql .= " FROM ".MAIN_DB_PREFIX."socpeople as p"; $sql .= " WHERE p.fk_soc = ".((int) $object->id); + // Add table from hooks + $parameters = array('contacttab' => true); + $reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook + $sql .= $hookmanager->resPrint; + $sql .= " WHERE p.fk_soc = ".$object->id; + // Add where from hooks + $parameters = array('contacttab' => true); + $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook + $sql .= $hookmanager->resPrint; $resql = $db->query($sql); if ($resql) { $obj = $db->fetch_object($resql); From 009ad3be0f052e239f7a60f2db2effe6fc5c90c1 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sat, 26 Mar 2022 13:10:23 +0100 Subject: [PATCH 399/610] FIX remove unused code --- htdocs/core/lib/company.lib.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index a98931ab79f..116c2beeb20 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -64,12 +64,11 @@ function societe_prepare_head(Societe $object) } else { $sql = "SELECT COUNT(p.rowid) as nb"; $sql .= " FROM ".MAIN_DB_PREFIX."socpeople as p"; - $sql .= " WHERE p.fk_soc = ".((int) $object->id); // Add table from hooks $parameters = array('contacttab' => true); $reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; - $sql .= " WHERE p.fk_soc = ".$object->id; + $sql .= " WHERE p.fk_soc = ".((int) $object->id); // Add where from hooks $parameters = array('contacttab' => true); $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook From d75483552d3400da9b7a8e1919460032c19ae4df Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 26 Mar 2022 15:48:36 +0100 Subject: [PATCH 400/610] Responsive --- htdocs/compta/paiement.php | 13 ++++++++----- htdocs/fourn/facture/paiement.php | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php index 9f40d2daa88..324c4161ac6 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -491,8 +491,10 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie if ($facture->type == 2) { print '
'.$langs->trans('AccountToDebit').''; - print $form->select_comptes($accountid, 'accountid', 0, '', 2, '', 0, '', 1); + print img_picto('', 'bank_account'); + print $form->select_comptes($accountid, 'accountid', 0, '', 2, '', 0, 'widthcentpercentminusx maxwidth500', 1); print ' 
'.$langs->trans('Numero'); - print ' ('.$langs->trans("ChequeOrTransferNumber").')'; + print ' ('.$langs->trans("ChequeOrTransferNumber").')'; print '
'.$langs->trans('CheckTransmitter'); - print ' ('.$langs->trans("ChequeMaker").')'; + print ' ('.$langs->trans("ChequeMaker").')'; print '
'.$langs->trans('Bank'); - print ' ('.$langs->trans("ChequeBank").')'; + print ' ('.$langs->trans("ChequeBank").')'; print '
'.$langs->trans('Comments').''; - print '
'; diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php index 4b6e5bf151c..2662e38951d 100644 --- a/htdocs/fourn/facture/paiement.php +++ b/htdocs/fourn/facture/paiement.php @@ -499,7 +499,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie if (!empty($conf->banque->enabled)) { print ''.$langs->trans('Account').''; print img_picto('', 'bank_account', 'class="pictofixedwidth"'); - $form->select_comptes(empty($accountid) ? $obj->fk_account : $accountid, 'accountid', 0, '', 2); + print $form->select_comptes(empty($accountid) ? $obj->fk_account : $accountid, 'accountid', 0, '', 2, '', 0, 'widthcentpercentminusx maxwidth500', 1); print ''; } else { print ' '; From 55e414ca306aae45118a7ba5f271421fb8b527e4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 26 Mar 2022 16:02:53 +0100 Subject: [PATCH 401/610] Fix sql --- htdocs/install/mysql/migration/15.0.0-16.0.0.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql index 85e9350eac3..59f0d640ba7 100644 --- a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql +++ b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql @@ -261,7 +261,7 @@ ALTER TABLE llx_product_attribute CHANGE rang position INTEGER DEFAULT 0 NOT NUL ALTER TABLE llx_advtargetemailing RENAME TO llx_mailing_advtarget; -ALTER TABLE llx_mailing ADD UNIQUE uk_mailing(titre, entity); +ALTER TABLE llx_mailing ADD UNIQUE INDEX uk_mailing(titre, entity); create table llx_inventory_extrafields ( From 35c57988a06a84c359d2fa691fafb024b0fe70cf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 26 Mar 2022 20:06:50 +0100 Subject: [PATCH 402/610] Responsive --- htdocs/takepos/css/pos.css.php | 16 +++++++++++++++- htdocs/takepos/index.php | 4 ++-- htdocs/takepos/invoice.php | 2 +- htdocs/takepos/split.php | 4 ++-- htdocs/theme/eldy/global.inc.php | 3 ++- 5 files changed, 22 insertions(+), 7 deletions(-) diff --git a/htdocs/takepos/css/pos.css.php b/htdocs/takepos/css/pos.css.php index c57b145d94c..ba85c111bcd 100644 --- a/htdocs/takepos/css/pos.css.php +++ b/htdocs/takepos/css/pos.css.php @@ -794,7 +794,8 @@ div#moreinfo, div#infowarehouse { .headersplit { height: 10%; width: 100%; - padding: 10px; + padding-top: 20px; + padding-bottom: 2px; } .headercontent { @@ -806,6 +807,19 @@ div#moreinfo, div#infowarehouse { background-color: rgb(233,234,237); } + +@media only screen and (max-width: 767px) +{ + .headercontent { + width: 80%; + } + + .headersplit .headercontent { + font-size: 1em; + } +} + + .row:after { content: ""; display: table; diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index 5650c0d4fdd..31c51a4c7b1 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -910,7 +910,7 @@ if (empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) {
'."\n"; -print ''; +print ''."\n"; // End of page llxFooter(); diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index bd37c650f2f..ba260737678 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -6475,6 +6475,17 @@ dd.dropdowndd ul li { white-space: nowrap; } +/* ============================================================================== */ +/* Kanban */ +/* ============================================================================== */ + +.info-box-label { + max-width: 180px; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + /* ============================================================================== */ /* Markdown rendering */ diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 117bebe12ca..764b21bba77 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -6345,6 +6345,18 @@ dd.dropdowndd ul li { } +/* ============================================================================== */ +/* Kanban */ +/* ============================================================================== */ + +.info-box-label { + max-width: 180px; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + + /* ============================================================================== */ /* Markdown rendering */ /* ============================================================================== */ From e7db103b57d527a15f7a8fc4e52ee7e8077a3995 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 31 Mar 2022 18:55:54 +0200 Subject: [PATCH 467/610] fix: on update with action reminder in future there is user key error --- htdocs/comm/action/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 0833929c82a..adfd3f34429 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -659,7 +659,7 @@ if (empty($reshook) && $action == 'update') { $categories = GETPOST('categories', 'array'); $object->setCategories($categories); - $object->loadReminders(); + $object->loadReminders($remindertype,0,false); if (!empty($object->reminders) && $object->datep > dol_now()) { foreach ($object->reminders as $reminder) { $reminder->delete($user); From 7f4e71f66f7db0a7b4699ac4871c74a4bd836223 Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Thu, 31 Mar 2022 21:43:48 +0200 Subject: [PATCH 468/610] Comments --- htdocs/takepos/invoice.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index d7de5ffd7e8..1dbf033482d 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -535,6 +535,7 @@ if ($action == "addline") { } $idoflineadded = 0; + // Group if enabled. Skip group if line already sent to the printer if (!empty($conf->global->TAKEPOS_GROUP_SAME_PRODUCT) && $line->special_code != "4") { foreach ($invoice->lines as $line) { if ($line->product_ref == $prod->ref) { From 5df5050418461383fbabb72fad6dac0eb5df1c04 Mon Sep 17 00:00:00 2001 From: Florian Mortgat <50440633+atm-florianm@users.noreply.github.com> Date: Fri, 1 Apr 2022 09:14:04 +0200 Subject: [PATCH 469/610] Apply suggestions from code review replace spaces with tabs --- htdocs/core/boxes/box_dolibarr_state_board.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/boxes/box_dolibarr_state_board.php b/htdocs/core/boxes/box_dolibarr_state_board.php index 028547f7867..9661b1d363e 100644 --- a/htdocs/core/boxes/box_dolibarr_state_board.php +++ b/htdocs/core/boxes/box_dolibarr_state_board.php @@ -79,9 +79,9 @@ class box_dolibarr_state_board extends ModeleBoxes if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS)) { $hookmanager = new HookManager($this->db); $hookmanager->initHooks(array('index')); - $object = new stdClass; - $action = ''; - $hookmanager->executeHooks('addStatisticLine', array(), $object, $action); + $object = new stdClass; + $action = ''; + $hookmanager->executeHooks('addStatisticLine', array(), $object, $action); $boxstatItems = array(); $boxstatFromHook = ''; $boxstatFromHook = $hookmanager->resPrint; From 113af78a9c4f0e042578bc78e68606a8b8b01630 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 1 Apr 2022 09:35:45 +0200 Subject: [PATCH 470/610] Add column for private widgets --- htdocs/install/mysql/migration/15.0.0-16.0.0.sql | 1 + htdocs/install/mysql/tables/llx_boxes_def.sql | 2 ++ 2 files changed, 3 insertions(+) diff --git a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql index 59f0d640ba7..e62ee2fa8aa 100644 --- a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql +++ b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql @@ -299,3 +299,4 @@ UPDATE llx_c_availability SET type_duration = 'w', qty = 2 WHERE code = 'AV_2W'; UPDATE llx_c_availability SET type_duration = 'w', qty = 3 WHERE code = 'AV_3W'; UPDATE llx_c_availability SET type_duration = 'w', qty = 4 WHERE code = 'AV_4W'; +ALTER TABLE llx_boxes_def ADD COLUMN fk_user integer DEFAULT 0 NOT NULL; diff --git a/htdocs/install/mysql/tables/llx_boxes_def.sql b/htdocs/install/mysql/tables/llx_boxes_def.sql index fbdf0e3ed36..804079df8b5 100644 --- a/htdocs/install/mysql/tables/llx_boxes_def.sql +++ b/htdocs/install/mysql/tables/llx_boxes_def.sql @@ -18,11 +18,13 @@ -- -- =========================================================================== +-- Table create table llx_boxes_def ( rowid integer AUTO_INCREMENT PRIMARY KEY, file varchar(200) NOT NULL, -- Do not increase this as file+note must be small to allow index entity integer DEFAULT 1 NOT NULL, -- multi company id + fk_user integer DEFAULT 0 NOT NULL, -- if widget is privte to one user tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, note varchar(130) -- Do not increase this as file+note must be small to allow index )ENGINE=innodb; From 0c44f164c73d6da4db054da03bf2e150c2fa0b56 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 1 Apr 2022 09:38:06 +0200 Subject: [PATCH 471/610] fix: Show error message on inventory input line for serial num product --- htdocs/product/inventory/inventory.php | 12 +++++++++--- htdocs/product/stock/class/mouvementstock.class.php | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/htdocs/product/inventory/inventory.php b/htdocs/product/inventory/inventory.php index 6026e4316e4..6a6d4c345ce 100644 --- a/htdocs/product/inventory/inventory.php +++ b/htdocs/product/inventory/inventory.php @@ -307,6 +307,7 @@ if (empty($reshook)) { include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';*/ if (GETPOST('addline', 'alpha')) { + $qty= (GETPOST('qtytoadd') != '' ? price2num(GETPOST('qtytoadd', 'MS')) : null); if ($fk_warehouse <= 0) { $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Warehouse")), null, 'errors'); @@ -323,12 +324,17 @@ if (empty($reshook)) { $tmpproduct = new Product($db); $result = $tmpproduct->fetch($fk_product); - if (!$error && $tmpproduct->status_batch && !$batch) { + if (empty($error) && $tmpproduct->status_batch>0 && empty($batch)) { $error++; $langs->load("errors"); setEventMessages($langs->trans("ErrorProductNeedBatchNumber", $tmpproduct->ref), null, 'errors'); } - if (!$error && !$tmpproduct->status_batch && $batch) { + if (empty($error) && $tmpproduct->status_batch==2 && !empty($batch) && $qty>1) { + $error++; + $langs->load("errors"); + setEventMessages($langs->trans("TooManyQtyForSerialNumber", $tmpproduct->ref, $batch), null, 'errors'); + } + if (empty($error) && empty($tmpproduct->status_batch) && !empty($batch)) { $error++; $langs->load("errors"); setEventMessages($langs->trans("ErrorProductDoesNotNeedBatchNumber", $tmpproduct->ref), null, 'errors'); @@ -341,7 +347,7 @@ if (empty($reshook)) { $tmp->fk_product = $fk_product; $tmp->batch = $batch; $tmp->datec = $now; - $tmp->qty_view = (GETPOST('qtytoadd') != '' ? price2num(GETPOST('qtytoadd', 'MS')) : null); + $tmp->qty_view = $qty; $result = $tmp->create($user); if ($result < 0) { diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index 44b91549c40..f64c83fa015 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -597,7 +597,7 @@ class MouvementStock extends CommonObject if ($product->status_batch == 2 && $qty > 0) { // We check only if we increased qty if ($this->getBatchCount($fk_product, $batch) > 1) { $error++; - $this->errors[] = $langs->trans("TooManyQtyForSerialNumber", $batch, $product->ref); + $this->errors[] = $langs->trans("TooManyQtyForSerialNumber", $product->ref, $batch); } } } From fa0e7a641c7d2c0030e304f550ec1020584f41e0 Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Fri, 1 Apr 2022 09:52:16 +0200 Subject: [PATCH 472/610] FIX : Missing unset fields after updateline expensereport --- htdocs/expensereport/card.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 240fdcfb73c..a1b26318a1b 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -1282,6 +1282,16 @@ if (empty($reshook)) { $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); } + + unset($qty); + unset($value_unit_ht); + unset($value_unit); + unset($vatrate); + unset($comments); + unset($fk_c_type_fees); + unset($fk_project); + unset($date); + } //header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); From d188f44a4c036e484bbfd740652163ccdfbbeb90 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Fri, 1 Apr 2022 07:58:41 +0000 Subject: [PATCH 473/610] Fixing style errors. --- htdocs/expensereport/card.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index a1b26318a1b..50ee78b4097 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -1291,7 +1291,6 @@ if (empty($reshook)) { unset($fk_c_type_fees); unset($fk_project); unset($date); - } //header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); From 8349e4855993f74300f8e53518730dbac457ecfa Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 1 Apr 2022 11:24:45 +0200 Subject: [PATCH 474/610] Reponsive --- htdocs/compta/accounting-files.php | 27 ++++++++++++++++------- htdocs/core/class/html.formfile.class.php | 10 ++++++--- htdocs/theme/eldy/global.inc.php | 2 +- htdocs/theme/md/style.css.php | 2 +- 4 files changed, 28 insertions(+), 13 deletions(-) diff --git a/htdocs/compta/accounting-files.php b/htdocs/compta/accounting-files.php index 1f821bf733b..ea0bd9de49e 100644 --- a/htdocs/compta/accounting-files.php +++ b/htdocs/compta/accounting-files.php @@ -672,7 +672,7 @@ if (!empty($date_start) && !empty($date_stop)) { print ''; // Type - print ''.$langs->trans($data['item']).''; + print ''.$langs->trans($data['item']).''; // Date print ''; @@ -685,7 +685,7 @@ if (!empty($date_start) && !empty($date_stop)) { print "\n"; // Ref - print ''; + print ''; if ($data['item'] == 'Invoice') { $invoice->id = $data['id']; @@ -733,23 +733,33 @@ if (!empty($date_start) && !empty($date_stop)) { print ''; // File link - print ''; + print ''; if (!empty($data['files'])) { foreach ($data['files'] as $id => $filecursor) { - print ''.($filecursor['name'] ? $filecursor['name'] : $filecursor['ref']).' '.$formfile->showPreview($filecursor, $filecursor['modulepart'], $filecursor['subdir'].'/'.$filecursor['name']).'
'; + $tmppreview = $formfile->showPreview($filecursor, $filecursor['modulepart'], $filecursor['subdir'].'/'.$filecursor['name'], 0); + if ($tmppreview) { + print $tmppreview; + } + $filename = ($filecursor['name'] ? $filecursor['name'] : $filecursor['ref']); + print ''; + if (empty($tmppreview)) { + print img_picto('', 'generic', '', false, 0, 0, '', 'pictonopreview pictofixedwidth paddingright'); + } + print $filename; + print '
'; } } print "\n"; // Paid - print ''.$data['paid'].''; + print ''.($data['paid'] ? yn($data['paid']) : '').''; // Total ET - print ''.price(price2num($data['sens'] ? $data['amount_ht'] : -$data['amount_ht'], 'MT'))."\n"; + print ''.price(price2num($data['sens'] ? $data['amount_ht'] : -$data['amount_ht'], 'MT'))."\n"; // Total IT - print ''.price(price2num($data['sens'] ? $data['amount_ttc'] : -$data['amount_ttc'], 'MT'))."\n"; + print ''.price(price2num($data['sens'] ? $data['amount_ttc'] : -$data['amount_ttc'], 'MT'))."\n"; // Total VAT - print ''.price(price2num($data['sens'] ? $data['amount_vat'] : -$data['amount_vat'], 'MT'))."\n"; + print ''.price(price2num($data['sens'] ? $data['amount_vat'] : -$data['amount_vat'], 'MT'))."\n"; print ''.dol_escape_htmltag($data['thirdparty_name'])."\n"; @@ -757,6 +767,7 @@ if (!empty($date_start) && !empty($date_stop)) { print ''.$data['country_code']."\n"; + // VAT number print ''.dol_escape_htmltag($data['vatnum'])."\n"; if ($data['sens']) { diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 6c4ff6e30f1..b955fa4a51d 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -2144,7 +2144,7 @@ class FormFile * @param array $file Array with data of file. Example: array('name'=>...) * @param string $modulepart propal, facture, facture_fourn, ... * @param string $relativepath Relative path of docs - * @param integer $ruleforpicto Rule for picto: 0=Use the generic preview picto, 1=Use the picto of mime type of file) + * @param integer $ruleforpicto Rule for picto: 0=Use the generic preview picto, 1=Use the picto of mime type of file). Use a negative value to show a generic picto even if preview not available. * @param string $param More param on http links * @return string $out Output string with HTML */ @@ -2160,11 +2160,15 @@ class FormFile //$out.= ''; if (empty($ruleforpicto)) { //$out.= img_picto($langs->trans('Preview').' '.$file['name'], 'detail'); - $out .= ''; + $out .= ''; } else { - $out .= img_mime($relativepath, $langs->trans('Preview').' '.$file['name']); + $out .= img_mime($relativepath, $langs->trans('Preview').' '.$file['name'], 'pictofixedwidth'); } $out .= ''; + } else { + if ($ruleforpicto < 0) { + $out .= img_picto('', 'generic', '', false, 0, 0, '', 'paddingright pictofixedwidth'); + } } } return $out; diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index ba260737678..11dea235094 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -2280,7 +2280,7 @@ span.widthpictotitle.pictotitle { vertical-align: middle; margin-top: -3px } -.pictowarning, .pictoerror, .pictopreview, .picto.error { +.pictowarning, .pictoerror, .pictopreview, .pictonopreview, .picto.error { padding-: 3px; } .pictowarning { diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 764b21bba77..83d656196e2 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -2294,7 +2294,7 @@ td.nobordernopadding.widthpictotitle.col-picto { vertical-align: middle; margin-top: -3px } -.pictowarning, .pictoerror, .pictopreview { +.pictowarning, .pictoerror, .pictopreview, .pictonopreview { padding-: 3px; } .pictowarning { From 9be7bae765778020680d9ca96a9ce9051bdf482b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 1 Apr 2022 11:24:58 +0200 Subject: [PATCH 475/610] Fix menu entry invalid --- htdocs/core/menus/standard/eldy.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index c03b8aebfe1..b44f082d650 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1687,8 +1687,8 @@ function get_left_menu_accountancy($mainmenu, &$newmenu, $usemenuhider = 1, $lef if ($objp->nature == 5 && !empty($conf->expensereport->enabled) && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS)) { $nature = "expensereports"; } - if ($objp->nature == 1) { - $nature = "various"; + if ($objp->nature == 1 && !empty($conf->asset->enabled)) { + $nature = "various"; // Warning: The page /accountancy/journal/variousjournal.php is bugged. It read tables that does not exists. } if ($objp->nature == 8) { $nature = "inventory"; From a9faf5fb54791c14e995c30e98cc9c826210db59 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 1 Apr 2022 11:29:38 +0200 Subject: [PATCH 476/610] feat: Add rank column into contract line --- htdocs/install/mysql/migration/15.0.0-16.0.0.sql | 2 ++ htdocs/install/mysql/tables/llx_contratdet.sql | 1 + 2 files changed, 3 insertions(+) diff --git a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql index e62ee2fa8aa..353eb71eac4 100644 --- a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql +++ b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql @@ -300,3 +300,5 @@ UPDATE llx_c_availability SET type_duration = 'w', qty = 3 WHERE code = 'AV_3W'; UPDATE llx_c_availability SET type_duration = 'w', qty = 4 WHERE code = 'AV_4W'; ALTER TABLE llx_boxes_def ADD COLUMN fk_user integer DEFAULT 0 NOT NULL; + +ALTER TABLE llx_contratdet ADD COLUMN rang integer DEFAULT 0 AFTER info_bits; diff --git a/htdocs/install/mysql/tables/llx_contratdet.sql b/htdocs/install/mysql/tables/llx_contratdet.sql index 075de80270d..6d52cfc3462 100644 --- a/htdocs/install/mysql/tables/llx_contratdet.sql +++ b/htdocs/install/mysql/tables/llx_contratdet.sql @@ -56,6 +56,7 @@ create table llx_contratdet product_type integer DEFAULT 1, -- Type of line (1=service by default) info_bits integer DEFAULT 0, -- TVA NPR ou non + rang integer DEFAULT 0, buy_price_ht double(24,8) DEFAULT NULL, -- buying price fk_product_fournisseur_price integer DEFAULT NULL, -- reference of supplier price when line was added was created (may be used to update buy_price_ht when future invoice will be created) From cbf89df591050b0fa90fec73d5840818dfe402c4 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 1 Apr 2022 11:54:16 +0200 Subject: [PATCH 477/610] new: add hidden option on contract PDF line --- htdocs/core/modules/contract/doc/pdf_strato.modules.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/contract/doc/pdf_strato.modules.php b/htdocs/core/modules/contract/doc/pdf_strato.modules.php index 67dca0ecf1b..085f7bee190 100644 --- a/htdocs/core/modules/contract/doc/pdf_strato.modules.php +++ b/htdocs/core/modules/contract/doc/pdf_strato.modules.php @@ -355,7 +355,12 @@ class pdf_strato extends ModelePDFContract $desc = dol_htmlentitiesbr($objectligne->desc, 1); // Desc (not empty for free lines) $txt = ''; - $txt .= $outputlangs->transnoentities("Quantity").' : '.$objectligne->qty.' - '.$outputlangs->transnoentities("UnitPrice").' : '.price($objectligne->subprice).''; // Desc (not empty for free lines) + if (empty($conf->global->CONTRACT_HIDE_QTY_ON_PDF)) { + $txt .= $outputlangs->transnoentities("Quantity") . ' : ' . $objectligne->qty . ''; + } + if (empty($conf->global->CONTRACT_HIDE_PRICE_ON_PDF)) { + $txt .= ' - ' . $outputlangs->transnoentities("UnitPrice") . ' : ' . price($objectligne->subprice) . ''; + } if (empty($conf->global->CONTRACT_HIDE_PLANNED_DATE_ON_PDF)) { $txt .= '
'; $txt .= $outputlangs->transnoentities("DateStartPlannedShort")." : ".$datei." - ".$outputlangs->transnoentities("DateEndPlanned")." : ".$datee.''; From a3dbcd0c27f0844283a8940ccb45d60fc6311890 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 1 Apr 2022 13:09:11 +0200 Subject: [PATCH 478/610] Clean language files --- htdocs/comm/propal/list.php | 4 ++-- htdocs/commande/list.php | 2 +- htdocs/core/modules/modVariants.class.php | 6 +++--- htdocs/langs/en_US/admin.lang | 6 +++--- htdocs/langs/en_US/orders.lang | 1 - htdocs/langs/en_US/projects.lang | 1 + htdocs/langs/en_US/propal.lang | 3 --- 7 files changed, 10 insertions(+), 13 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 6eb9ba5014c..73b4c479b2e 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -361,7 +361,7 @@ if ($action == 'validate' && $permissiontovalidate) { if ($tmpproposal->valid($user) > 0) { setEventMessage($langs->trans('hasBeenValidated', $tmpproposal->ref), 'mesgs'); } else { - setEventMessage($langs->trans('CantBeValidated'), 'errors'); + setEventMessage($tmpproposal->error, $tmpproposal->errors, 'errors'); $error++; } } else { @@ -398,7 +398,7 @@ if ($action == "sign" && $permissiontoclose) { $error++; } } else { - setEventMessage($tmpproposal->ref." ".$langs->trans('CantBeSign'), 'errors'); + setEventMessage($langs->trans('MustBeValidatedToBeSigned', $tmpproposal->ref), 'errors'); $error++; } } else { diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index c819bd1dc55..fcbd00fe945 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -318,7 +318,7 @@ if ($action == 'validate' && $permissiontoadd) { if ($objecttmp->valid($user, $idwarehouse)) { setEventMessage($langs->trans('hasBeenValidated', $objecttmp->ref), 'mesgs'); } else { - setEventMessage($langs->trans('CantBeValidated'), 'errors'); + setEventMessage($objecttmp->error, $objecttmp->errors, 'errors'); $error++; } } else { diff --git a/htdocs/core/modules/modVariants.class.php b/htdocs/core/modules/modVariants.class.php index ad71d2ca300..e1364fd845e 100644 --- a/htdocs/core/modules/modVariants.class.php +++ b/htdocs/core/modules/modVariants.class.php @@ -112,15 +112,15 @@ class modVariants extends DolibarrModules $r = 0; $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used) - $this->rights[$r][1] = 'Read objects of ProductAttribute'; // Permission label + $this->rights[$r][1] = 'Read attributes of variants'; // Permission label $this->rights[$r][4] = 'read'; // In php code, permission will be checked by test if ($user->rights->eventorganization->level1) $r++; $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used) - $this->rights[$r][1] = 'Create/Update objects of ProductAttribute'; // Permission label + $this->rights[$r][1] = 'Create/Update attributes of variants'; // Permission label $this->rights[$r][4] = 'write'; // In php code, permission will be checked by test if ($user->rights->eventorganization->level1) $r++; $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used) - $this->rights[$r][1] = 'Delete objects of ProductAttribute'; // Permission label + $this->rights[$r][1] = 'Delete attributes of variants'; // Permission label $this->rights[$r][4] = 'delete'; // In php code, permission will be checked by test if ($user->rights->eventorganization->level1) $r++; } diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 794893e2133..d4073f80b7c 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -883,9 +883,9 @@ Permission564=Record Debits/Rejections of credit transfer Permission601=Read stickers Permission602=Create/modify stickers Permission609=Delete stickers -Permission611=Read objects of ProductAttribute -Permission612=Create/Update objects of ProductAttribute -Permission613=Delete objects of ProductAttribute +Permission611=Read attributes of variants +Permission612=Create/Update attributes of variants +Permission613=Delete attributes of variants Permission650=Read Bills of Materials Permission651=Create/Update Bills of Materials Permission652=Delete Bills of Materials diff --git a/htdocs/langs/en_US/orders.lang b/htdocs/langs/en_US/orders.lang index fb30758aba9..a4261f8e62c 100644 --- a/htdocs/langs/en_US/orders.lang +++ b/htdocs/langs/en_US/orders.lang @@ -106,7 +106,6 @@ GenerateBill=Generate invoice ClassifyShipped=Classify delivered PassedInShippedStatus=classified delivered YouCantShipThis=I can't classify this. Please check user permissions -MustBeValidatedBefore=must be Validated or In process in order to be classified as shipped DraftOrders=Draft orders DraftSuppliersOrders=Draft purchase orders OnProcessOrders=In process orders diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang index cc63f8e7c68..1e0ed42d3e3 100644 --- a/htdocs/langs/en_US/projects.lang +++ b/htdocs/langs/en_US/projects.lang @@ -190,6 +190,7 @@ PlannedWorkload=Planned workload PlannedWorkloadShort=Workload ProjectReferers=Related items ProjectMustBeValidatedFirst=Project must be validated first +MustBeValidatedToBeSigned=%s must be validated first to be set to Signed. FirstAddRessourceToAllocateTime=Assign a user resource as contact of project to allocate time InputPerDay=Input per day InputPerWeek=Input per week diff --git a/htdocs/langs/en_US/propal.lang b/htdocs/langs/en_US/propal.lang index 4c95b3b1851..ed25b5501dc 100644 --- a/htdocs/langs/en_US/propal.lang +++ b/htdocs/langs/en_US/propal.lang @@ -93,11 +93,8 @@ ConfirmMassNoSignature=Bulk Not signed confirmation ConfirmMassNoSignatureQuestion=Are you sure you want to set not signed the selected records ? IsNotADraft=is not a draft PassedInOpenStatus=has been validated -CantBeSign=cannot be signed Sign=Sign Signed=signed -CantBeSign=cannot be signed -CantBeValidated=cannot be validated ConfirmMassValidation=Bulk Validate confirmation ConfirmMassSignature=Bulk Signature confirmation ConfirmMassValidationQuestion=Are you sure you want to validate the selected records ? From 106e3072dcbbe1415c9f4a34822b2843f305e451 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 1 Apr 2022 13:20:40 +0200 Subject: [PATCH 479/610] Update card.php --- htdocs/comm/action/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index adfd3f34429..a5a898ef7f2 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -659,7 +659,7 @@ if (empty($reshook) && $action == 'update') { $categories = GETPOST('categories', 'array'); $object->setCategories($categories); - $object->loadReminders($remindertype,0,false); + $object->loadReminders($remindertype, 0, false); if (!empty($object->reminders) && $object->datep > dol_now()) { foreach ($object->reminders as $reminder) { $reminder->delete($user); From 4c150d85c9ad25f533dcf049e725365d2810a07f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 1 Apr 2022 13:23:45 +0200 Subject: [PATCH 480/610] Doc --- htdocs/conf/conf.php.example | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/conf/conf.php.example b/htdocs/conf/conf.php.example index 6bf2873b50c..44f0d63d69f 100644 --- a/htdocs/conf/conf.php.example +++ b/htdocs/conf/conf.php.example @@ -204,7 +204,7 @@ $dolibarr_main_authentication='dolibarr'; // $dolibarr_main_auth_ldap_servertype='openldap'; // openldap, activedirectory or egroupware // $dolibarr_main_auth_ldap_login_attribute='loginfield'; // Ex: uid or samaccountname for active directory // $dolibarr_main_auth_ldap_dn='ou=users,dc=my-domain,dc=com'; // Ex: ou=users,dc=my-domain,dc=com -// $dolibarr_main_auth_ldap_filter = ''; // If defined, two previous parameters are not used to find a user into LDAP. Ex: (uid=%1%) or &(uid=%1%)(isMemberOf=cn=Sales,ou=Groups,dc=opencsi,dc=com). +// $dolibarr_main_auth_ldap_filter = ''; // If defined, the two previous parameters (dolibarr_main_auth_ldap_login_attribute and dolibarr_main_auth_ldap_dn) are not used to find a user into LDAP. Instead we use this search string. Ex: (uid=%1%) or &(uid=%1%)(isMemberOf=cn=Sales,ou=Groups,dc=opencsi,dc=com). // $dolibarr_main_auth_ldap_admin_login=''; // Required only if anonymous bind disabled. Ex: cn=admin,dc=example,dc=com // $dolibarr_main_auth_ldap_admin_pass=''; // Required only if anonymous bind disabled. Ex: secret // $dolibarr_main_auth_ldap_debug='false'; From f2480b6443d1450f5924541ce9d7759ad52bad84 Mon Sep 17 00:00:00 2001 From: jpb Date: Fri, 1 Apr 2022 13:56:10 +0200 Subject: [PATCH 481/610] fix : remove tds add by mistake --- htdocs/expensereport/card.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 5ffef81e4c0..7696e8c9807 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -2493,8 +2493,6 @@ if ($action == 'create') { print ''; print ''; print ''; - print ''; - print ''; print ''; print ''; From 1cdf55fea0bd48a7f49e354940a8925f73707305 Mon Sep 17 00:00:00 2001 From: jpb Date: Fri, 1 Apr 2022 14:21:13 +0200 Subject: [PATCH 482/610] remove empty line --- htdocs/expensereport/card.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 7696e8c9807..a39a14dbab4 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -2494,7 +2494,6 @@ if ($action == 'create') { print ''; print ''; print ''; - print ''; // Line number From 88e6c67c10ab8459833dd158939f213ffb2d336e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 1 Apr 2022 14:29:11 +0200 Subject: [PATCH 483/610] Look and feel v16 of media manager --- .../browser/default/browser.css | 6 ++-- .../browser/default/browser.php | 29 ++++++++++++---- .../browser/default/frmactualfolder.php | 19 +++++++++++ .../browser/default/frmcreatefolder.php | 31 +++++++++++++----- .../browser/default/frmfolders.php | 21 +++++++++++- .../browser/default/frmresourceslist.php | 19 +++++++++++ .../browser/default/frmupload.php | 30 ++++++++++++++--- .../filemanagerdol/browser/default/spacer.gif | Bin 43 -> 0 bytes 8 files changed, 131 insertions(+), 24 deletions(-) delete mode 100644 htdocs/core/filemanagerdol/browser/default/spacer.gif diff --git a/htdocs/core/filemanagerdol/browser/default/browser.css b/htdocs/core/filemanagerdol/browser/default/browser.css index 0df72be1a35..d6ec1e212aa 100644 --- a/htdocs/core/filemanagerdol/browser/default/browser.css +++ b/htdocs/core/filemanagerdol/browser/default/browser.css @@ -42,8 +42,8 @@ body.FileArea body, td, input, select { - font-size: 11px; - font-family: 'Microsoft Sans Serif', Arial, Helvetica, Verdana, sans-serif; + /* font-size: 11px; */ + /* font-family: 'Microsoft Sans Serif', Arial, Helvetica, Verdana, sans-serif; */ } .ActualFolder @@ -78,4 +78,6 @@ body, td, input, select .fullHeight { height: 100%; + padding-left: 10px; + padding-right: 10px; } diff --git a/htdocs/core/filemanagerdol/browser/default/browser.php b/htdocs/core/filemanagerdol/browser/default/browser.php index 50bd538078b..b5bce100d39 100644 --- a/htdocs/core/filemanagerdol/browser/default/browser.php +++ b/htdocs/core/filemanagerdol/browser/default/browser.php @@ -25,15 +25,30 @@ require '../../connectors/php/config.php'; // This include the define('NOTOKENRE global $Config; - - ?> - + <?php echo $langs->trans("MediaBrowser").' - '.$Config['UserFilesAbsolutePathRelative']; ?> +'."\n"; +// Output style sheets (optioncss='print' or ''). Note: $conf->css looks like '/theme/eldy/style.css.php' +$themepath = dol_buildpath($conf->css, 1); +$themesubdir = ''; +if (!empty($conf->modules_parts['theme'])) { // This slow down + foreach ($conf->modules_parts['theme'] as $reldir) { + if (file_exists(dol_buildpath($reldir.$conf->css, 0))) { + $themepath = dol_buildpath($reldir.$conf->css, 1); + $themesubdir = $reldir; + break; + } + } +} + +//print 'themepath='.$themepath.' themeparam='.$themeparam;exit; +print ''."\n"; +?> - + - + - + diff --git a/htdocs/core/filemanagerdol/browser/default/frmactualfolder.php b/htdocs/core/filemanagerdol/browser/default/frmactualfolder.php index d2d7a0966ce..c66187ee433 100644 --- a/htdocs/core/filemanagerdol/browser/default/frmactualfolder.php +++ b/htdocs/core/filemanagerdol/browser/default/frmactualfolder.php @@ -22,6 +22,7 @@ define('NOTOKENRENEWAL', 1); // Disables token renewal require '../../../../main.inc.php'; + ?> '."\n"; +// Output style sheets (optioncss='print' or ''). Note: $conf->css looks like '/theme/eldy/style.css.php' +$themepath = dol_buildpath($conf->css, 1); +$themesubdir = ''; +if (!empty($conf->modules_parts['theme'])) { // This slow down + foreach ($conf->modules_parts['theme'] as $reldir) { + if (file_exists(dol_buildpath($reldir.$conf->css, 0))) { + $themepath = dol_buildpath($reldir.$conf->css, 1); + $themesubdir = $reldir; + break; + } + } +} + +//print 'themepath='.$themepath.' themeparam='.$themeparam;exit; +print ''."\n"; +?> '."\n"; + print ''."\n"; } // jQuery jeditable for Edit In Place features diff --git a/htdocs/projet/ganttview.php b/htdocs/projet/ganttview.php index 9c20aa562d7..7266e029985 100644 --- a/htdocs/projet/ganttview.php +++ b/htdocs/projet/ganttview.php @@ -243,7 +243,7 @@ if ($user->rights->projet->all->creer || $user->rights->projet->creer) { } } -$linktocreatetask = dolGetButtonTitle($langs->trans('AddTask'), '', 'fa fa-plus-circle paddingleft', DOL_URL_ROOT.'/projet/tasks.php?id='.$object->id.'&action=create'.$param.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$object->id), '', $linktocreatetaskUserRight, $linktocreatetaskParam); +$linktocreatetask = dolGetButtonTitle($langs->trans('AddTask'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/projet/tasks.php?id='.$object->id.'&action=create'.$param.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$object->id), '', $linktocreatetaskUserRight, $linktocreatetaskParam); $linktotasks = dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-list-alt paddingleft imgforviewmode', DOL_URL_ROOT.'/projet/tasks.php?id='.$object->id, '', 1, array('morecss'=>'reposition')); $linktotasks .= dolGetButtonTitle($langs->trans('ViewGantt'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.'/projet/ganttview.php?id='.$object->id.'&withproject=1', '', 1, array('morecss'=>'reposition marginleftonly btnTitleSelected')); diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 11dea235094..0715723bf55 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -3646,9 +3646,11 @@ table.liste tr:last-of-type td, table.noborder:not(#tablelines) tr:last-of-type border-bottom-color: var(--colortopbordertitle1); border-bottom-style: solid; } +/* div.tabBar div.fichehalfright table.noborder:not(.margintable):not(.paymenttable):not(.lastrecordtable):last-of-type { border-bottom: 1px solid var(--colortopbordertitle1); } +*/ div.tabBar table.border>tbody>tr:last-of-type>td { border-bottom-width: 1px; border-bottom-color: var(--colortopbordertitle1); From 395758f213699a126e2e36ce22a329a7c1279e01 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 3 Apr 2022 12:24:03 +0200 Subject: [PATCH 508/610] Doxygen --- .../emailcollector/lib/emailcollector.lib.php | 46 +++++++++++-------- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/htdocs/emailcollector/lib/emailcollector.lib.php b/htdocs/emailcollector/lib/emailcollector.lib.php index 9b63bbea66a..60611c35841 100644 --- a/htdocs/emailcollector/lib/emailcollector.lib.php +++ b/htdocs/emailcollector/lib/emailcollector.lib.php @@ -87,9 +87,10 @@ function emailcollectorPrepareHead($object) } /** - * Récupère les parties d'un message - * @param object $structure structure du message - * @return object|boolean parties du message|false en cas d'erreur + * Get parts of a message + * + * @param object $structure Structure of message + * @return object|boolean Parties du message|false en cas d'erreur */ function getParts($structure) { @@ -97,9 +98,10 @@ function getParts($structure) } /** - * Tableau définissant la pièce jointe - * @param object $part partie du message - * @return object|boolean définition du message|false en cas d'erreur + * Array with joined files + * + * @param object $part Part of message + * @return object|boolean Definition of message|false en cas d'erreur */ function getDParameters($part) { @@ -107,10 +109,11 @@ function getDParameters($part) } /** - * Récupère les pièces d'un mail donné - * @param integer $jk numéro du mail - * @param object $mbox object connection imaap - * @return array type, filename, pos + * Get attachments of a given mail + * + * @param integer $jk Number of email + * @param object $mbox object connection imaap + * @return array type, filename, pos */ function getAttachments($jk, $mbox) { @@ -140,7 +143,8 @@ function getAttachments($jk, $mbox) } /** - * Récupère la contenu de la pièce jointe par rapport a sa position dans un mail donné + * Get content of a joined file from its position into a given email + * * @param integer $jk numéro du mail * @param integer $fpos position de la pièce jointe * @param integer $type type de la pièce jointe @@ -156,11 +160,12 @@ function getFileData($jk, $fpos, $type, $mbox) } /** - * Sauvegarde de la pièce jointe dans le dossier défini avec un nom unique - * @param string $path chemin de sauvegarde dui fichier - * @param string $filename nom du fichier - * @param mixed $data contenu à sauvegarder - * @return string emplacement du fichier + * Save joined file into a directory with a given name + * + * @param string $path Path to file + * @param string $filename Name of file + * @param mixed $data contenu à sauvegarder + * @return string emplacement du fichier **/ function saveAttachment($path, $filename, $data) { @@ -186,10 +191,11 @@ function saveAttachment($path, $filename, $data) } /** - * Décode le contenu du message - * @param string $message message - * @param integer $coding type de contenu - * @return message décodé + * Decode content of a message + * + * @param string $message Message + * @param integer $coding Type of content + * @return string Decoded message **/ function getDecodeValue($message, $coding) { From d514d72ac5671ab342bb5e5b2336b387d9f58190 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 3 Apr 2022 12:25:43 +0200 Subject: [PATCH 509/610] Doxygen --- htdocs/core/class/html.form.class.php | 2 +- htdocs/core/lib/images.lib.php | 1 + .../class/fournisseur.facture-rec.class.php | 44 +++++++++---------- htdocs/hrm/class/skill.class.php | 2 +- htdocs/hrm/class/skilldet.class.php | 21 --------- htdocs/hrm/class/skillrank.class.php | 2 + .../template/class/api_mymodule.class.php | 2 +- .../class/api_recruitment.class.php | 9 +++- 8 files changed, 35 insertions(+), 48 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 2c094ea56c7..f07b82a4c74 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -7187,7 +7187,7 @@ class Form * @param int $limit Limit on number of returned lines * @param int $status Ticket status * @param string $selected_input_value Value of preselected input text (for use with ajax) - * @param int $hidelabel Hide label (0=no, 1=yes, 2=show search icon (before) and placeholder, 3 search icon after) + * @param int $hidelabel Hide label (0=no, 1=yes, 2=show search icon before and placeholder, 3 search icon after) * @param array $ajaxoptions Options for ajax_autocompleter * @param int $socid Thirdparty Id (to get also price dedicated to this customer) * @param string $showempty '' to not show empty line. Translation key to show an empty line. '1' show empty line with no text. diff --git a/htdocs/core/lib/images.lib.php b/htdocs/core/lib/images.lib.php index 6b973d89887..b8202b8e361 100644 --- a/htdocs/core/lib/images.lib.php +++ b/htdocs/core/lib/images.lib.php @@ -590,6 +590,7 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small', break; } + // Before PHP8, img was a resource, With PHP8, it is a GdImage if (!is_resource($img) && !($img instanceof \GdImage)) { dol_syslog('Failed to detect type of image. We found infoImg[2]='.$infoImg[2], LOG_WARNING); return 0; diff --git a/htdocs/fourn/class/fournisseur.facture-rec.class.php b/htdocs/fourn/class/fournisseur.facture-rec.class.php index 3d6c0868f01..f77dd5638f7 100644 --- a/htdocs/fourn/class/fournisseur.facture-rec.class.php +++ b/htdocs/fourn/class/fournisseur.facture-rec.class.php @@ -1031,29 +1031,29 @@ class FactureFournisseurRec extends CommonInvoice } /** - * Update a line to supplier invoice template + * Update a line to supplier invoice template * - * @param $rowid ID - * @param int $fk_product Product/Service ID predefined - * @param $ref Ref - * @param string $label Label of the line - * @param string $desc Description de la ligne - * @param double $pu_ht Prix unitaire HT (> 0 even for credit note) - * @param double $qty Quantity - * @param int $remise_percent Percentage discount of the line - * @param double $txtva Taux de tva force, sinon -1 - * @param int $txlocaltax1 Local tax 1 rate (deprecated) - * @param int $txlocaltax2 Local tax 2 rate (deprecated) - * @param string $price_base_type HT or TTC - * @param int $type Type of line (0=product, 1=service) - * @param int $date_start Date start - * @param int $date_end Date end - * @param int $info_bits Bits of type of lines - * @param int $special_code Special code - * @param int $rang Position of line - * @param string $fk_unit Unit - * @param int $pu_ht_devise Unit price in currency - * @return int <0 if KO, Id of line if OK + * @param int $rowid ID + * @param int $fk_product Product/Service ID predefined + * @param string $ref Ref + * @param string $label Label of the line + * @param string $desc Description de la ligne + * @param double $pu_ht Prix unitaire HT (> 0 even for credit note) + * @param double $qty Quantity + * @param int $remise_percent Percentage discount of the line + * @param double $txtva Taux de tva force, sinon -1 + * @param int $txlocaltax1 Local tax 1 rate (deprecated) + * @param int $txlocaltax2 Local tax 2 rate (deprecated) + * @param string $price_base_type HT or TTC + * @param int $type Type of line (0=product, 1=service) + * @param int $date_start Date start + * @param int $date_end Date end + * @param int $info_bits Bits of type of lines + * @param int $special_code Special code + * @param int $rang Position of line + * @param string $fk_unit Unit + * @param int $pu_ht_devise Unit price in currency + * @return int <0 if KO, Id of line if OK * @throws Exception */ public function updateline($rowid, $fk_product, $ref, $label, $desc, $pu_ht, $qty, $remise_percent, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $price_base_type = 'HT', $type = 0, $date_start = 0, $date_end = 0, $info_bits = 0, $special_code = 0, $rang = -1, $fk_unit = null, $pu_ht_devise = 0) diff --git a/htdocs/hrm/class/skill.class.php b/htdocs/hrm/class/skill.class.php index 724c14b93c0..ececc70b4f1 100644 --- a/htdocs/hrm/class/skill.class.php +++ b/htdocs/hrm/class/skill.class.php @@ -977,7 +977,7 @@ class Skill extends CommonObject { $this->lines = array(); - $objectline = new SkillLine($this->db); + $objectline = new Skilldet($this->db); $result = $objectline->fetchAll('ASC', 'rankorder', 0, 0, array('customsql'=>'fk_skill = '.$this->id)); if (is_numeric($result)) { diff --git a/htdocs/hrm/class/skilldet.class.php b/htdocs/hrm/class/skilldet.class.php index 5e2da1ba7aa..ac91e2ef21a 100644 --- a/htdocs/hrm/class/skilldet.class.php +++ b/htdocs/hrm/class/skilldet.class.php @@ -882,27 +882,6 @@ class Skilldet extends CommonObject $this->initAsSpecimenCommon(); } - /** - * Create an array of lines - * - * @return array|int array of lines if OK, <0 if KO - */ - public function getLinesArray() - { - $this->lines = array(); - - $objectline = new SkilldetLine($this->db); - $result = $objectline->fetchAll('ASC', 'position', 0, 0, array('customsql'=>'fk_skilldet = '.$this->id)); - - if (is_numeric($result)) { - $this->error = $this->error; - $this->errors = $this->errors; - return $result; - } else { - $this->lines = $result; - return $this->lines; - } - } /** * Returns the reference to the following non used object depending on the active numbering module. diff --git a/htdocs/hrm/class/skillrank.class.php b/htdocs/hrm/class/skillrank.class.php index eb93208040b..aa1d70b430f 100644 --- a/htdocs/hrm/class/skillrank.class.php +++ b/htdocs/hrm/class/skillrank.class.php @@ -930,6 +930,7 @@ class SkillRank extends CommonObject { $this->lines = array(); + /* $objectline = new SkillRankLine($this->db); $result = $objectline->fetchAll('ASC', 'position', 0, 0, array('customsql'=>'fk_skillrank = '.((int) $this->id))); @@ -941,6 +942,7 @@ class SkillRank extends CommonObject $this->lines = $result; return $this->lines; } + */ } /** diff --git a/htdocs/modulebuilder/template/class/api_mymodule.class.php b/htdocs/modulebuilder/template/class/api_mymodule.class.php index 4cb50c8de2f..04bf641930d 100644 --- a/htdocs/modulebuilder/template/class/api_mymodule.class.php +++ b/htdocs/modulebuilder/template/class/api_mymodule.class.php @@ -49,7 +49,7 @@ class MyModuleApi extends DolibarrApi */ public function __construct() { - global $db, $conf; + global $db; $this->db = $db; $this->myobject = new MyObject($this->db); } diff --git a/htdocs/recruitment/class/api_recruitment.class.php b/htdocs/recruitment/class/api_recruitment.class.php index e0c2cb5da11..ff6f3c3d65a 100644 --- a/htdocs/recruitment/class/api_recruitment.class.php +++ b/htdocs/recruitment/class/api_recruitment.class.php @@ -37,11 +37,15 @@ dol_include_once('/recruitment/class/recruitmentcandidature.class.php'); class Recruitment extends DolibarrApi { /** - * @var jobposition $jobposition {@type jobposition} + * @var RecruitmentJobPosition $jobposition {@type RecruitmentJobPosition} */ public $jobposition; + /** + * @var RecruitmentCandidature $candidature {@type RecruitmentCandidature} + */ public $candidature; + /** * Constructor * @@ -50,12 +54,13 @@ class Recruitment extends DolibarrApi */ public function __construct() { - global $db, $conf; + global $db; $this->db = $db; $this->jobposition = new RecruitmentJobPosition($this->db); $this->candidature = new RecruitmentCandidature($this->db); } + /** * Get properties of a jobposition object * From 564382ec6c24a1cfd0531500a6a63739ada15a08 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 3 Apr 2022 12:56:07 +0200 Subject: [PATCH 510/610] Upgrade ACE Editor from 1.4.7 to 1.4.14 --- COPYRIGHT | 2 +- htdocs/admin/dolistore/ajax/image.php | 5 +- htdocs/admin/dolistore/css/dolistore.css | 3 - htdocs/includes/ace/.npmignore | 3 + htdocs/includes/ace/ChangeLog.txt | 23 + htdocs/includes/ace/ace-modules.d.ts | 34 +- htdocs/includes/ace/ace.d.ts | 28 +- htdocs/includes/ace/kitchen-sink.html | 10 +- htdocs/includes/ace/package.json | 2 +- htdocs/includes/ace/src/ace.js | 1618 +-- htdocs/includes/ace/src/ext-beautify.js | 42 +- htdocs/includes/ace/src/ext-code_lens.js | 24 +- htdocs/includes/ace/src/ext-emmet.js | 35 +- htdocs/includes/ace/src/ext-hardwrap.js | 125 + .../includes/ace/src/ext-keybinding_menu.js | 2 +- htdocs/includes/ace/src/ext-language_tools.js | 128 +- htdocs/includes/ace/src/ext-modelist.js | 31 +- htdocs/includes/ace/src/ext-options.js | 74 +- htdocs/includes/ace/src/ext-prompt.js | 138 +- htdocs/includes/ace/src/ext-searchbox.js | 2 +- htdocs/includes/ace/src/ext-settings_menu.js | 74 +- htdocs/includes/ace/src/ext-textarea.js | 135 +- htdocs/includes/ace/src/ext-themelist.js | 4 +- htdocs/includes/ace/src/keybinding-emacs.js | 47 +- htdocs/includes/ace/src/keybinding-vim.js | 827 +- htdocs/includes/ace/src/keybinding-vscode.js | 6 +- htdocs/includes/ace/src/mode-abc.js | 3 + htdocs/includes/ace/src/mode-actionscript.js | 1 + htdocs/includes/ace/src/mode-alda.js | 311 + htdocs/includes/ace/src/mode-asl.js | 33 +- htdocs/includes/ace/src/mode-bro.js | 334 - htdocs/includes/ace/src/mode-c_cpp.js | 3 +- htdocs/includes/ace/src/mode-clojure.js | 1 + htdocs/includes/ace/src/mode-coffee.js | 1 + htdocs/includes/ace/src/mode-coldfusion.js | 3 + .../includes/ace/src/mode-csound_document.js | 126 +- .../includes/ace/src/mode-csound_orchestra.js | 123 +- htdocs/includes/ace/src/mode-csound_score.js | 3 +- htdocs/includes/ace/src/mode-css.js | 1 + htdocs/includes/ace/src/mode-curly.js | 3 + htdocs/includes/ace/src/mode-d.js | 2 +- htdocs/includes/ace/src/mode-dart.js | 4 +- htdocs/includes/ace/src/mode-diff.js | 1 + htdocs/includes/ace/src/mode-django.js | 4 + htdocs/includes/ace/src/mode-dockerfile.js | 1 + htdocs/includes/ace/src/mode-drools.js | 3 +- htdocs/includes/ace/src/mode-edifact.js | 1 + htdocs/includes/ace/src/mode-ejs.js | 860 +- htdocs/includes/ace/src/mode-erlang.js | 1 + htdocs/includes/ace/src/mode-fsl.js | 1 + htdocs/includes/ace/src/mode-glsl.js | 3 +- htdocs/includes/ace/src/mode-gobstones.js | 2 + htdocs/includes/ace/src/mode-graphqlschema.js | 1 + htdocs/includes/ace/src/mode-groovy.js | 1 + htdocs/includes/ace/src/mode-haml.js | 525 +- htdocs/includes/ace/src/mode-handlebars.js | 3 + htdocs/includes/ace/src/mode-haskell.js | 1 + htdocs/includes/ace/src/mode-html.js | 3 + htdocs/includes/ace/src/mode-html_elixir.js | 3 + htdocs/includes/ace/src/mode-html_ruby.js | 860 +- htdocs/includes/ace/src/mode-io.js | 1 + htdocs/includes/ace/src/mode-java.js | 4 +- htdocs/includes/ace/src/mode-javascript.js | 1 + htdocs/includes/ace/src/mode-json.js | 3 + htdocs/includes/ace/src/mode-jsoniq.js | 1 + htdocs/includes/ace/src/mode-jsp.js | 3 +- htdocs/includes/ace/src/mode-kotlin.js | 2 + htdocs/includes/ace/src/mode-latte.js | 2708 ++++ htdocs/includes/ace/src/mode-liquid.js | 4 + htdocs/includes/ace/src/mode-lsl.js | 1 + htdocs/includes/ace/src/mode-lua.js | 1 + htdocs/includes/ace/src/mode-luapage.js | 4 + htdocs/includes/ace/src/mode-makefile.js | 1 + htdocs/includes/ace/src/mode-markdown.js | 5 + htdocs/includes/ace/src/mode-maze.js | 1 + htdocs/includes/ace/src/mode-mediawiki.js | 592 + htdocs/includes/ace/src/mode-mips.js | 264 + htdocs/includes/ace/src/mode-nix.js | 3 +- htdocs/includes/ace/src/mode-nsis.js | 2 +- htdocs/includes/ace/src/mode-nunjucks.js | 3 + htdocs/includes/ace/src/mode-objectivec.js | 2 +- htdocs/includes/ace/src/mode-perl.js | 1 + htdocs/includes/ace/src/mode-pgsql.js | 4 +- htdocs/includes/ace/src/mode-php.js | 773 +- .../ace/src/mode-php_laravel_blade.js | 773 +- htdocs/includes/ace/src/mode-prisma.js | 489 + htdocs/includes/ace/src/mode-protobuf.js | 3 +- htdocs/includes/ace/src/mode-puppet.js | 11 +- htdocs/includes/ace/src/mode-python.js | 5 +- htdocs/includes/ace/src/mode-qml.js | 381 + htdocs/includes/ace/src/mode-r.js | 1 + .../ace/src/{mode-perl6.js => mode-raku.js} | 22 +- htdocs/includes/ace/src/mode-razor.js | 4 + htdocs/includes/ace/src/mode-rhtml.js | 3 + htdocs/includes/ace/src/mode-rst.js | 1 + htdocs/includes/ace/src/mode-ruby.js | 857 +- htdocs/includes/ace/src/mode-rust.js | 9 +- htdocs/includes/ace/src/mode-scala.js | 1 + htdocs/includes/ace/src/mode-scrypt.js | 364 + htdocs/includes/ace/src/mode-sh.js | 1 + htdocs/includes/ace/src/mode-sjs.js | 1 + htdocs/includes/ace/src/mode-slim.js | 820 +- htdocs/includes/ace/src/mode-smarty.js | 3 + htdocs/includes/ace/src/mode-smithy.js | 507 + htdocs/includes/ace/src/mode-snippets.js | 1 + htdocs/includes/ace/src/mode-soy_template.js | 3 + htdocs/includes/ace/src/mode-sql.js | 163 +- htdocs/includes/ace/src/mode-sqlserver.js | 3 +- htdocs/includes/ace/src/mode-svg.js | 1 + htdocs/includes/ace/src/mode-swift.js | 6 + htdocs/includes/ace/src/mode-tcl.js | 1 + htdocs/includes/ace/src/mode-terraform.js | 17 +- htdocs/includes/ace/src/mode-tex.js | 1 + htdocs/includes/ace/src/mode-textile.js | 1 + htdocs/includes/ace/src/mode-tsx.js | 1 + htdocs/includes/ace/src/mode-twig.js | 3 + htdocs/includes/ace/src/mode-typescript.js | 1 + htdocs/includes/ace/src/mode-vala.js | 1 + htdocs/includes/ace/src/mode-vbscript.js | 459 +- htdocs/includes/ace/src/mode-velocity.js | 4 + htdocs/includes/ace/src/mode-vhdl.js | 21 +- htdocs/includes/ace/src/mode-visualforce.js | 3 + htdocs/includes/ace/src/mode-wollok.js | 2 + htdocs/includes/ace/src/mode-xquery.js | 1 + htdocs/includes/ace/src/snippets/abap.js | 7 +- htdocs/includes/ace/src/snippets/ada.js | 7 +- htdocs/includes/ace/src/snippets/alda.js | 9 + .../includes/ace/src/snippets/apache_conf.js | 7 +- htdocs/includes/ace/src/snippets/apex.js | 7 +- .../includes/ace/src/snippets/applescript.js | 7 +- htdocs/includes/ace/src/snippets/aql.js | 7 +- htdocs/includes/ace/src/snippets/asciidoc.js | 7 +- htdocs/includes/ace/src/snippets/asl.js | 6 +- .../includes/ace/src/snippets/assembly_x86.js | 7 +- .../includes/ace/src/snippets/autohotkey.js | 7 +- htdocs/includes/ace/src/snippets/batchfile.js | 7 +- htdocs/includes/ace/src/snippets/bro.js | 14 - htdocs/includes/ace/src/snippets/c9search.js | 7 +- htdocs/includes/ace/src/snippets/cirru.js | 7 +- htdocs/includes/ace/src/snippets/cobol.js | 7 +- .../includes/ace/src/snippets/coldfusion.js | 7 +- htdocs/includes/ace/src/snippets/crystal.js | 7 +- htdocs/includes/ace/src/snippets/csharp.js | 7 +- .../includes/ace/src/snippets/csound_score.js | 7 +- htdocs/includes/ace/src/snippets/csp.js | 7 +- htdocs/includes/ace/src/snippets/curly.js | 7 +- htdocs/includes/ace/src/snippets/d.js | 7 +- .../includes/ace/src/snippets/dockerfile.js | 7 +- htdocs/includes/ace/src/snippets/dot.js | 7 +- htdocs/includes/ace/src/snippets/eiffel.js | 7 +- htdocs/includes/ace/src/snippets/ejs.js | 7 +- htdocs/includes/ace/src/snippets/elixir.js | 7 +- htdocs/includes/ace/src/snippets/elm.js | 7 +- htdocs/includes/ace/src/snippets/forth.js | 7 +- htdocs/includes/ace/src/snippets/fortran.js | 7 +- htdocs/includes/ace/src/snippets/fsharp.js | 7 +- htdocs/includes/ace/src/snippets/ftl.js | 7 +- htdocs/includes/ace/src/snippets/gcode.js | 7 +- htdocs/includes/ace/src/snippets/gherkin.js | 7 +- htdocs/includes/ace/src/snippets/gitignore.js | 7 +- htdocs/includes/ace/src/snippets/glsl.js | 7 +- htdocs/includes/ace/src/snippets/golang.js | 7 +- htdocs/includes/ace/src/snippets/groovy.js | 7 +- .../includes/ace/src/snippets/handlebars.js | 7 +- .../ace/src/snippets/haskell_cabal.js | 7 +- htdocs/includes/ace/src/snippets/haxe.js | 7 +- htdocs/includes/ace/src/snippets/hjson.js | 7 +- htdocs/includes/ace/src/snippets/html.js | 6 +- .../includes/ace/src/snippets/html_elixir.js | 7 +- htdocs/includes/ace/src/snippets/html_ruby.js | 7 +- htdocs/includes/ace/src/snippets/ini.js | 7 +- htdocs/includes/ace/src/snippets/jack.js | 7 +- htdocs/includes/ace/src/snippets/jade.js | 7 +- htdocs/includes/ace/src/snippets/json.js | 7 +- htdocs/includes/ace/src/snippets/json5.js | 7 +- htdocs/includes/ace/src/snippets/jssm.js | 7 +- htdocs/includes/ace/src/snippets/jsx.js | 7 +- htdocs/includes/ace/src/snippets/julia.js | 7 +- htdocs/includes/ace/src/snippets/kotlin.js | 7 +- htdocs/includes/ace/src/snippets/latex.js | 7 +- htdocs/includes/ace/src/snippets/latte.js | 9 + htdocs/includes/ace/src/snippets/less.js | 7 +- htdocs/includes/ace/src/snippets/lisp.js | 7 +- .../includes/ace/src/snippets/livescript.js | 7 +- htdocs/includes/ace/src/snippets/logiql.js | 7 +- htdocs/includes/ace/src/snippets/logtalk.js | 7 +- htdocs/includes/ace/src/snippets/luapage.js | 7 +- htdocs/includes/ace/src/snippets/lucene.js | 7 +- htdocs/includes/ace/src/snippets/mask.js | 7 +- htdocs/includes/ace/src/snippets/matlab.js | 7 +- htdocs/includes/ace/src/snippets/mediawiki.js | 9 + htdocs/includes/ace/src/snippets/mel.js | 7 +- htdocs/includes/ace/src/snippets/mips.js | 9 + htdocs/includes/ace/src/snippets/mixal.js | 7 +- htdocs/includes/ace/src/snippets/mushcode.js | 7 +- htdocs/includes/ace/src/snippets/mysql.js | 7 +- htdocs/includes/ace/src/snippets/nginx.js | 7 +- htdocs/includes/ace/src/snippets/nim.js | 7 +- htdocs/includes/ace/src/snippets/nix.js | 7 +- htdocs/includes/ace/src/snippets/nsis.js | 7 +- htdocs/includes/ace/src/snippets/nunjucks.js | 7 +- .../includes/ace/src/snippets/objectivec.js | 7 +- htdocs/includes/ace/src/snippets/ocaml.js | 7 +- htdocs/includes/ace/src/snippets/pascal.js | 7 +- htdocs/includes/ace/src/snippets/perl6.js | 14 - htdocs/includes/ace/src/snippets/pgsql.js | 7 +- .../ace/src/snippets/php_laravel_blade.js | 7 +- htdocs/includes/ace/src/snippets/pig.js | 7 +- .../includes/ace/src/snippets/plain_text.js | 7 +- .../includes/ace/src/snippets/powershell.js | 7 +- htdocs/includes/ace/src/snippets/praat.js | 7 +- htdocs/includes/ace/src/snippets/prisma.js | 9 + htdocs/includes/ace/src/snippets/prolog.js | 7 +- .../includes/ace/src/snippets/properties.js | 7 +- htdocs/includes/ace/src/snippets/protobuf.js | 7 +- htdocs/includes/ace/src/snippets/puppet.js | 7 +- htdocs/includes/ace/src/snippets/qml.js | 9 + htdocs/includes/ace/src/snippets/raku.js | 9 + htdocs/includes/ace/src/snippets/rdoc.js | 7 +- htdocs/includes/ace/src/snippets/red.js | 7 +- htdocs/includes/ace/src/snippets/redshift.js | 7 +- htdocs/includes/ace/src/snippets/rhtml.js | 7 +- htdocs/includes/ace/src/snippets/rust.js | 7 +- htdocs/includes/ace/src/snippets/sass.js | 7 +- htdocs/includes/ace/src/snippets/scad.js | 7 +- htdocs/includes/ace/src/snippets/scala.js | 7 +- htdocs/includes/ace/src/snippets/scheme.js | 7 +- htdocs/includes/ace/src/snippets/scrypt.js | 9 + htdocs/includes/ace/src/snippets/scss.js | 7 +- htdocs/includes/ace/src/snippets/sjs.js | 7 +- htdocs/includes/ace/src/snippets/slim.js | 7 +- htdocs/includes/ace/src/snippets/smarty.js | 7 +- htdocs/includes/ace/src/snippets/smithy.js | 9 + .../includes/ace/src/snippets/soy_template.js | 7 +- htdocs/includes/ace/src/snippets/space.js | 7 +- htdocs/includes/ace/src/snippets/sparql.js | 7 +- htdocs/includes/ace/src/snippets/stylus.js | 7 +- htdocs/includes/ace/src/snippets/svg.js | 7 +- htdocs/includes/ace/src/snippets/swift.js | 7 +- htdocs/includes/ace/src/snippets/terraform.js | 7 +- htdocs/includes/ace/src/snippets/text.js | 7 +- htdocs/includes/ace/src/snippets/toml.js | 7 +- htdocs/includes/ace/src/snippets/tsx.js | 7 +- htdocs/includes/ace/src/snippets/turtle.js | 7 +- htdocs/includes/ace/src/snippets/twig.js | 7 +- .../includes/ace/src/snippets/typescript.js | 7 +- htdocs/includes/ace/src/snippets/vbscript.js | 7 +- htdocs/includes/ace/src/snippets/verilog.js | 7 +- htdocs/includes/ace/src/snippets/vhdl.js | 7 +- .../includes/ace/src/snippets/visualforce.js | 7 +- htdocs/includes/ace/src/snippets/xml.js | 7 +- htdocs/includes/ace/src/snippets/yaml.js | 7 +- htdocs/includes/ace/src/snippets/zeek.js | 7 +- htdocs/includes/ace/src/theme-ambiance.js | 7 +- htdocs/includes/ace/src/theme-chaos.js | 4 +- htdocs/includes/ace/src/theme-chrome.js | 2 +- htdocs/includes/ace/src/theme-clouds.js | 2 +- .../includes/ace/src/theme-clouds_midnight.js | 2 +- htdocs/includes/ace/src/theme-cobalt.js | 2 +- .../includes/ace/src/theme-crimson_editor.js | 2 +- htdocs/includes/ace/src/theme-dawn.js | 2 +- htdocs/includes/ace/src/theme-dracula.js | 2 +- htdocs/includes/ace/src/theme-dreamweaver.js | 2 +- htdocs/includes/ace/src/theme-eclipse.js | 2 +- htdocs/includes/ace/src/theme-github.js | 2 +- htdocs/includes/ace/src/theme-gob.js | 2 +- htdocs/includes/ace/src/theme-gruvbox.js | 2 +- htdocs/includes/ace/src/theme-idle_fingers.js | 2 +- htdocs/includes/ace/src/theme-iplastic.js | 2 +- htdocs/includes/ace/src/theme-katzenmilch.js | 2 +- htdocs/includes/ace/src/theme-kr_theme.js | 2 +- htdocs/includes/ace/src/theme-kuroir.js | 2 +- htdocs/includes/ace/src/theme-merbivore.js | 2 +- .../includes/ace/src/theme-merbivore_soft.js | 2 +- .../includes/ace/src/theme-mono_industrial.js | 2 +- htdocs/includes/ace/src/theme-monokai.js | 2 +- htdocs/includes/ace/src/theme-nord_dark.js | 102 + htdocs/includes/ace/src/theme-one_dark.js | 139 + .../includes/ace/src/theme-pastel_on_dark.js | 2 +- .../includes/ace/src/theme-solarized_dark.js | 2 +- .../includes/ace/src/theme-solarized_light.js | 2 +- htdocs/includes/ace/src/theme-sqlserver.js | 2 +- htdocs/includes/ace/src/theme-terminal.js | 2 +- htdocs/includes/ace/src/theme-textmate.js | 2 +- htdocs/includes/ace/src/theme-tomorrow.js | 2 +- .../includes/ace/src/theme-tomorrow_night.js | 2 +- .../ace/src/theme-tomorrow_night_blue.js | 2 +- .../ace/src/theme-tomorrow_night_bright.js | 2 +- .../ace/src/theme-tomorrow_night_eighties.js | 2 +- htdocs/includes/ace/src/theme-twilight.js | 8 +- htdocs/includes/ace/src/theme-vibrant_ink.js | 2 +- htdocs/includes/ace/src/theme-xcode.js | 2 +- htdocs/includes/ace/src/worker-base.js | 1421 ++ htdocs/includes/ace/src/worker-coffee.js | 720 +- htdocs/includes/ace/src/worker-css.js | 6965 +++++----- htdocs/includes/ace/src/worker-html.js | 720 +- htdocs/includes/ace/src/worker-javascript.js | 10814 ++++++++++------ htdocs/includes/ace/src/worker-json.js | 720 +- htdocs/includes/ace/src/worker-lua.js | 1986 ++- htdocs/includes/ace/src/worker-php.js | 2332 ++-- htdocs/includes/ace/src/worker-xml.js | 720 +- htdocs/includes/ace/src/worker-xquery.js | 720 +- htdocs/includes/ace/webpack-resolver.js | 32 +- 303 files changed, 26642 insertions(+), 17750 deletions(-) create mode 100644 htdocs/includes/ace/.npmignore create mode 100644 htdocs/includes/ace/src/ext-hardwrap.js create mode 100644 htdocs/includes/ace/src/mode-alda.js delete mode 100644 htdocs/includes/ace/src/mode-bro.js create mode 100644 htdocs/includes/ace/src/mode-latte.js create mode 100644 htdocs/includes/ace/src/mode-mediawiki.js create mode 100644 htdocs/includes/ace/src/mode-mips.js create mode 100644 htdocs/includes/ace/src/mode-prisma.js create mode 100644 htdocs/includes/ace/src/mode-qml.js rename htdocs/includes/ace/src/{mode-perl6.js => mode-raku.js} (96%) create mode 100644 htdocs/includes/ace/src/mode-scrypt.js create mode 100644 htdocs/includes/ace/src/mode-smithy.js create mode 100644 htdocs/includes/ace/src/snippets/alda.js delete mode 100644 htdocs/includes/ace/src/snippets/bro.js create mode 100644 htdocs/includes/ace/src/snippets/latte.js create mode 100644 htdocs/includes/ace/src/snippets/mediawiki.js create mode 100644 htdocs/includes/ace/src/snippets/mips.js delete mode 100644 htdocs/includes/ace/src/snippets/perl6.js create mode 100644 htdocs/includes/ace/src/snippets/prisma.js create mode 100644 htdocs/includes/ace/src/snippets/qml.js create mode 100644 htdocs/includes/ace/src/snippets/raku.js create mode 100644 htdocs/includes/ace/src/snippets/scrypt.js create mode 100644 htdocs/includes/ace/src/snippets/smithy.js create mode 100644 htdocs/includes/ace/src/theme-nord_dark.js create mode 100644 htdocs/includes/ace/src/theme-one_dark.js create mode 100644 htdocs/includes/ace/src/worker-base.js diff --git a/COPYRIGHT b/COPYRIGHT index eaa3e2e963e..a5e1f4a4005 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -48,7 +48,7 @@ TCPDF 6.3.2 LGPL-3+ Yes TCPDI 1.0.0 LGPL-3+ / Apache 2.0 Yes FPDI replacement JS libraries: -Ace 1.4.8 BSD Yes JS library to get code syntaxique coloration in a textarea. +Ace 1.4.14 BSD Yes JS library to get code syntaxique coloration in a textarea. ChartJS 3.7.1 MIT License Yes JS library for graph jQuery 3.5.1 MIT License Yes JS library jQuery UI 1.12.1 GPL and MIT License Yes JS library plugin UI diff --git a/htdocs/admin/dolistore/ajax/image.php b/htdocs/admin/dolistore/ajax/image.php index af844edaa68..e601da43e06 100644 --- a/htdocs/admin/dolistore/ajax/image.php +++ b/htdocs/admin/dolistore/ajax/image.php @@ -1,7 +1,7 @@ . * Copyright (C) 2008-2011 Laurent Destailleur - * Copyright (C) 2020 Frédéric France + * Copyright (C) 2020 Frédéric France * * This program is free software; you can redistribute it and/or modifyion 2.0 (the "License"); * it under the terms of the GNU General Public License as published bypliance with the License. @@ -17,9 +17,6 @@ * or see https://www.gnu.org/ */ -if (!defined('REQUIRE_JQUERY_BLOCKUI')) { - define('REQUIRE_JQUERY_BLOCKUI', 1); -} if (!defined('NOTOKENRENEWAL')) { define('NOTOKENRENEWAL', 1); } diff --git a/htdocs/admin/dolistore/css/dolistore.css b/htdocs/admin/dolistore/css/dolistore.css index 3d8f163caf2..c3a8b6ca7ce 100644 --- a/htdocs/admin/dolistore/css/dolistore.css +++ b/htdocs/admin/dolistore/css/dolistore.css @@ -67,9 +67,6 @@ div.divsearchfield { .tree li:last-child:after{ display: none } -.blockUI { - cursor: auto!important; -} .newAppParent{ position: relative; overflow: hidden; diff --git a/htdocs/includes/ace/.npmignore b/htdocs/includes/ace/.npmignore new file mode 100644 index 00000000000..b7e6c1b552d --- /dev/null +++ b/htdocs/includes/ace/.npmignore @@ -0,0 +1,3 @@ +demo/ +kitchen-sink.html +* * \ No newline at end of file diff --git a/htdocs/includes/ace/ChangeLog.txt b/htdocs/includes/ace/ChangeLog.txt index 824f8750e12..2819a6014d0 100644 --- a/htdocs/includes/ace/ChangeLog.txt +++ b/htdocs/includes/ace/ChangeLog.txt @@ -1,3 +1,26 @@ +2022.01.26 Version 1.4.14 +* update vim mode +* remove slow regex in beautify extension + +2021.09.30 Version 1.4.13 +* added useStrictCSP global option to use in environments where dynamic style creation is disabled + see demo/csp.html for an example of a page which loads external css files instead of generating styles with javascript +* updated vim mode, added support for gqq command + +2020.07.06 Version 1.4.12 +* removed unused es5-shim +* imporved ruby and vbscript highlighting and folding +* workaround for double space being converted to dot on mobile keyboards + +2020.04.15 Version 1.4.10 +* added workaround for chrome bug causing memory leak after calling editor.destroy +* added code folding support for vbscript mode + +2020.04.01 Version 1.4.9 +* added option to disable autoindent +* added new language modes +* fixed backspace not working with some mobile keyboards + 2020.01.14 Version 1.4.8 * highlight both matched braces, and highlight unmatched brace in red * improve snippet manager diff --git a/htdocs/includes/ace/ace-modules.d.ts b/htdocs/includes/ace/ace-modules.d.ts index a25e20c9c84..0f0bac5fbfd 100644 --- a/htdocs/includes/ace/ace-modules.d.ts +++ b/htdocs/includes/ace/ace-modules.d.ts @@ -1,7 +1,11 @@ +declare module 'ace-builds/webpack-resolver'; +declare module 'ace-builds/src-noconflict/ace'; declare module 'ace-builds/src-noconflict/ext-beautify'; +declare module 'ace-builds/src-noconflict/ext-code_lens'; declare module 'ace-builds/src-noconflict/ext-elastic_tabstops_lite'; declare module 'ace-builds/src-noconflict/ext-emmet'; declare module 'ace-builds/src-noconflict/ext-error_marker'; +declare module 'ace-builds/src-noconflict/ext-hardwrap'; declare module 'ace-builds/src-noconflict/ext-keybinding_menu'; declare module 'ace-builds/src-noconflict/ext-language_tools'; declare module 'ace-builds/src-noconflict/ext-linking'; @@ -21,10 +25,12 @@ declare module 'ace-builds/src-noconflict/ext-whitespace'; declare module 'ace-builds/src-noconflict/keybinding-emacs'; declare module 'ace-builds/src-noconflict/keybinding-sublime'; declare module 'ace-builds/src-noconflict/keybinding-vim'; +declare module 'ace-builds/src-noconflict/keybinding-vscode'; declare module 'ace-builds/src-noconflict/mode-abap'; declare module 'ace-builds/src-noconflict/mode-abc'; declare module 'ace-builds/src-noconflict/mode-actionscript'; declare module 'ace-builds/src-noconflict/mode-ada'; +declare module 'ace-builds/src-noconflict/mode-alda'; declare module 'ace-builds/src-noconflict/mode-apache_conf'; declare module 'ace-builds/src-noconflict/mode-apex'; declare module 'ace-builds/src-noconflict/mode-applescript'; @@ -34,7 +40,6 @@ declare module 'ace-builds/src-noconflict/mode-asl'; declare module 'ace-builds/src-noconflict/mode-assembly_x86'; declare module 'ace-builds/src-noconflict/mode-autohotkey'; declare module 'ace-builds/src-noconflict/mode-batchfile'; -declare module 'ace-builds/src-noconflict/mode-bro'; declare module 'ace-builds/src-noconflict/mode-c9search'; declare module 'ace-builds/src-noconflict/mode-cirru'; declare module 'ace-builds/src-noconflict/mode-clojure'; @@ -92,6 +97,7 @@ declare module 'ace-builds/src-noconflict/mode-jade'; declare module 'ace-builds/src-noconflict/mode-java'; declare module 'ace-builds/src-noconflict/mode-javascript'; declare module 'ace-builds/src-noconflict/mode-json'; +declare module 'ace-builds/src-noconflict/mode-json5'; declare module 'ace-builds/src-noconflict/mode-jsoniq'; declare module 'ace-builds/src-noconflict/mode-jsp'; declare module 'ace-builds/src-noconflict/mode-jssm'; @@ -99,6 +105,7 @@ declare module 'ace-builds/src-noconflict/mode-jsx'; declare module 'ace-builds/src-noconflict/mode-julia'; declare module 'ace-builds/src-noconflict/mode-kotlin'; declare module 'ace-builds/src-noconflict/mode-latex'; +declare module 'ace-builds/src-noconflict/mode-latte'; declare module 'ace-builds/src-noconflict/mode-less'; declare module 'ace-builds/src-noconflict/mode-liquid'; declare module 'ace-builds/src-noconflict/mode-lisp'; @@ -114,7 +121,9 @@ declare module 'ace-builds/src-noconflict/mode-markdown'; declare module 'ace-builds/src-noconflict/mode-mask'; declare module 'ace-builds/src-noconflict/mode-matlab'; declare module 'ace-builds/src-noconflict/mode-maze'; +declare module 'ace-builds/src-noconflict/mode-mediawiki'; declare module 'ace-builds/src-noconflict/mode-mel'; +declare module 'ace-builds/src-noconflict/mode-mips'; declare module 'ace-builds/src-noconflict/mode-mixal'; declare module 'ace-builds/src-noconflict/mode-mushcode'; declare module 'ace-builds/src-noconflict/mode-mysql'; @@ -122,11 +131,11 @@ declare module 'ace-builds/src-noconflict/mode-nginx'; declare module 'ace-builds/src-noconflict/mode-nim'; declare module 'ace-builds/src-noconflict/mode-nix'; declare module 'ace-builds/src-noconflict/mode-nsis'; +declare module 'ace-builds/src-noconflict/mode-nunjucks'; declare module 'ace-builds/src-noconflict/mode-objectivec'; declare module 'ace-builds/src-noconflict/mode-ocaml'; declare module 'ace-builds/src-noconflict/mode-pascal'; declare module 'ace-builds/src-noconflict/mode-perl'; -declare module 'ace-builds/src-noconflict/mode-perl6'; declare module 'ace-builds/src-noconflict/mode-pgsql'; declare module 'ace-builds/src-noconflict/mode-php'; declare module 'ace-builds/src-noconflict/mode-php_laravel_blade'; @@ -134,12 +143,15 @@ declare module 'ace-builds/src-noconflict/mode-pig'; declare module 'ace-builds/src-noconflict/mode-plain_text'; declare module 'ace-builds/src-noconflict/mode-powershell'; declare module 'ace-builds/src-noconflict/mode-praat'; +declare module 'ace-builds/src-noconflict/mode-prisma'; declare module 'ace-builds/src-noconflict/mode-prolog'; declare module 'ace-builds/src-noconflict/mode-properties'; declare module 'ace-builds/src-noconflict/mode-protobuf'; declare module 'ace-builds/src-noconflict/mode-puppet'; declare module 'ace-builds/src-noconflict/mode-python'; +declare module 'ace-builds/src-noconflict/mode-qml'; declare module 'ace-builds/src-noconflict/mode-r'; +declare module 'ace-builds/src-noconflict/mode-raku'; declare module 'ace-builds/src-noconflict/mode-razor'; declare module 'ace-builds/src-noconflict/mode-rdoc'; declare module 'ace-builds/src-noconflict/mode-red'; @@ -152,11 +164,13 @@ declare module 'ace-builds/src-noconflict/mode-sass'; declare module 'ace-builds/src-noconflict/mode-scad'; declare module 'ace-builds/src-noconflict/mode-scala'; declare module 'ace-builds/src-noconflict/mode-scheme'; +declare module 'ace-builds/src-noconflict/mode-scrypt'; declare module 'ace-builds/src-noconflict/mode-scss'; declare module 'ace-builds/src-noconflict/mode-sh'; declare module 'ace-builds/src-noconflict/mode-sjs'; declare module 'ace-builds/src-noconflict/mode-slim'; declare module 'ace-builds/src-noconflict/mode-smarty'; +declare module 'ace-builds/src-noconflict/mode-smithy'; declare module 'ace-builds/src-noconflict/mode-snippets'; declare module 'ace-builds/src-noconflict/mode-soy_template'; declare module 'ace-builds/src-noconflict/mode-space'; @@ -210,6 +224,8 @@ declare module 'ace-builds/src-noconflict/theme-merbivore'; declare module 'ace-builds/src-noconflict/theme-merbivore_soft'; declare module 'ace-builds/src-noconflict/theme-monokai'; declare module 'ace-builds/src-noconflict/theme-mono_industrial'; +declare module 'ace-builds/src-noconflict/theme-nord_dark'; +declare module 'ace-builds/src-noconflict/theme-one_dark'; declare module 'ace-builds/src-noconflict/theme-pastel_on_dark'; declare module 'ace-builds/src-noconflict/theme-solarized_dark'; declare module 'ace-builds/src-noconflict/theme-solarized_light'; @@ -228,6 +244,7 @@ declare module 'ace-builds/src-noconflict/snippets/abap'; declare module 'ace-builds/src-noconflict/snippets/abc'; declare module 'ace-builds/src-noconflict/snippets/actionscript'; declare module 'ace-builds/src-noconflict/snippets/ada'; +declare module 'ace-builds/src-noconflict/snippets/alda'; declare module 'ace-builds/src-noconflict/snippets/apache_conf'; declare module 'ace-builds/src-noconflict/snippets/apex'; declare module 'ace-builds/src-noconflict/snippets/applescript'; @@ -237,7 +254,6 @@ declare module 'ace-builds/src-noconflict/snippets/asl'; declare module 'ace-builds/src-noconflict/snippets/assembly_x86'; declare module 'ace-builds/src-noconflict/snippets/autohotkey'; declare module 'ace-builds/src-noconflict/snippets/batchfile'; -declare module 'ace-builds/src-noconflict/snippets/bro'; declare module 'ace-builds/src-noconflict/snippets/c9search'; declare module 'ace-builds/src-noconflict/snippets/cirru'; declare module 'ace-builds/src-noconflict/snippets/clojure'; @@ -295,6 +311,7 @@ declare module 'ace-builds/src-noconflict/snippets/jade'; declare module 'ace-builds/src-noconflict/snippets/java'; declare module 'ace-builds/src-noconflict/snippets/javascript'; declare module 'ace-builds/src-noconflict/snippets/json'; +declare module 'ace-builds/src-noconflict/snippets/json5'; declare module 'ace-builds/src-noconflict/snippets/jsoniq'; declare module 'ace-builds/src-noconflict/snippets/jsp'; declare module 'ace-builds/src-noconflict/snippets/jssm'; @@ -302,6 +319,7 @@ declare module 'ace-builds/src-noconflict/snippets/jsx'; declare module 'ace-builds/src-noconflict/snippets/julia'; declare module 'ace-builds/src-noconflict/snippets/kotlin'; declare module 'ace-builds/src-noconflict/snippets/latex'; +declare module 'ace-builds/src-noconflict/snippets/latte'; declare module 'ace-builds/src-noconflict/snippets/less'; declare module 'ace-builds/src-noconflict/snippets/liquid'; declare module 'ace-builds/src-noconflict/snippets/lisp'; @@ -317,7 +335,9 @@ declare module 'ace-builds/src-noconflict/snippets/markdown'; declare module 'ace-builds/src-noconflict/snippets/mask'; declare module 'ace-builds/src-noconflict/snippets/matlab'; declare module 'ace-builds/src-noconflict/snippets/maze'; +declare module 'ace-builds/src-noconflict/snippets/mediawiki'; declare module 'ace-builds/src-noconflict/snippets/mel'; +declare module 'ace-builds/src-noconflict/snippets/mips'; declare module 'ace-builds/src-noconflict/snippets/mixal'; declare module 'ace-builds/src-noconflict/snippets/mushcode'; declare module 'ace-builds/src-noconflict/snippets/mysql'; @@ -325,11 +345,11 @@ declare module 'ace-builds/src-noconflict/snippets/nginx'; declare module 'ace-builds/src-noconflict/snippets/nim'; declare module 'ace-builds/src-noconflict/snippets/nix'; declare module 'ace-builds/src-noconflict/snippets/nsis'; +declare module 'ace-builds/src-noconflict/snippets/nunjucks'; declare module 'ace-builds/src-noconflict/snippets/objectivec'; declare module 'ace-builds/src-noconflict/snippets/ocaml'; declare module 'ace-builds/src-noconflict/snippets/pascal'; declare module 'ace-builds/src-noconflict/snippets/perl'; -declare module 'ace-builds/src-noconflict/snippets/perl6'; declare module 'ace-builds/src-noconflict/snippets/pgsql'; declare module 'ace-builds/src-noconflict/snippets/php'; declare module 'ace-builds/src-noconflict/snippets/php_laravel_blade'; @@ -337,12 +357,15 @@ declare module 'ace-builds/src-noconflict/snippets/pig'; declare module 'ace-builds/src-noconflict/snippets/plain_text'; declare module 'ace-builds/src-noconflict/snippets/powershell'; declare module 'ace-builds/src-noconflict/snippets/praat'; +declare module 'ace-builds/src-noconflict/snippets/prisma'; declare module 'ace-builds/src-noconflict/snippets/prolog'; declare module 'ace-builds/src-noconflict/snippets/properties'; declare module 'ace-builds/src-noconflict/snippets/protobuf'; declare module 'ace-builds/src-noconflict/snippets/puppet'; declare module 'ace-builds/src-noconflict/snippets/python'; +declare module 'ace-builds/src-noconflict/snippets/qml'; declare module 'ace-builds/src-noconflict/snippets/r'; +declare module 'ace-builds/src-noconflict/snippets/raku'; declare module 'ace-builds/src-noconflict/snippets/razor'; declare module 'ace-builds/src-noconflict/snippets/rdoc'; declare module 'ace-builds/src-noconflict/snippets/red'; @@ -355,11 +378,13 @@ declare module 'ace-builds/src-noconflict/snippets/sass'; declare module 'ace-builds/src-noconflict/snippets/scad'; declare module 'ace-builds/src-noconflict/snippets/scala'; declare module 'ace-builds/src-noconflict/snippets/scheme'; +declare module 'ace-builds/src-noconflict/snippets/scrypt'; declare module 'ace-builds/src-noconflict/snippets/scss'; declare module 'ace-builds/src-noconflict/snippets/sh'; declare module 'ace-builds/src-noconflict/snippets/sjs'; declare module 'ace-builds/src-noconflict/snippets/slim'; declare module 'ace-builds/src-noconflict/snippets/smarty'; +declare module 'ace-builds/src-noconflict/snippets/smithy'; declare module 'ace-builds/src-noconflict/snippets/snippets'; declare module 'ace-builds/src-noconflict/snippets/soy_template'; declare module 'ace-builds/src-noconflict/snippets/space'; @@ -390,4 +415,3 @@ declare module 'ace-builds/src-noconflict/snippets/xml'; declare module 'ace-builds/src-noconflict/snippets/xquery'; declare module 'ace-builds/src-noconflict/snippets/yaml'; declare module 'ace-builds/src-noconflict/snippets/zeek'; -declare module 'ace-builds/webpack-resolver'; diff --git a/htdocs/includes/ace/ace.d.ts b/htdocs/includes/ace/ace.d.ts index dd1a2952a06..bdf62ffd3a4 100644 --- a/htdocs/includes/ace/ace.d.ts +++ b/htdocs/includes/ace/ace.d.ts @@ -21,10 +21,12 @@ export namespace Ace { getLine(row: number): string; getLines(firstRow: number, lastRow: number): string[]; getAllLines(): string[]; + getLength(): number; getTextRange(range: Range): string; getLinesForRange(range: Range): string[]; insert(position: Point, text: string): Point; insertInLine(position: Point, text: string): Point; + insertNewLine(position: Point): Point; clippedPos(row: number, column: number): Point; clonePos(pos: Point): Point; pos(row: number, column: number): Point; @@ -153,7 +155,7 @@ export namespace Ace { } export interface EditSessionOptions { - wrap: string | number; + wrap: "off" | "free" | "printmargin" | boolean | number; wrapMethod: 'code' | 'text' | 'auto'; indentedSoftWrap: boolean; firstLineNumber: number; @@ -212,6 +214,7 @@ export namespace Ace { mergeUndoDeltas: true | false | 'always'; behavioursEnabled: boolean; wrapBehavioursEnabled: boolean; + enableAutoIndent: boolean; autoScrollEditorIntoView: boolean; keyboardHandler: string; placeholder: string; @@ -228,7 +231,7 @@ export namespace Ace { range: Range; preserveCase: boolean; regExp: RegExp; - wholeWord: string; + wholeWord: boolean; caseSensitive: boolean; wrap: boolean; } @@ -362,7 +365,7 @@ export namespace Ace { moduleUrl(name: string, component?: string): string; setModuleUrl(name: string, subst: string): string; loadModule(moduleName: string | [string, string], - onLoad: (module: any) => void): void; + onLoad?: (module: any) => void): void; init(packaged: any): any; defineOptions(obj: any, path: string, options: { [key: string]: any }): Config; resetOptions(obj: any): void; @@ -398,6 +401,8 @@ export namespace Ace { export interface EditSession extends EventEmitter, OptionsProvider, Folding { selection: Selection; + // TODO: define BackgroundTokenizer + on(name: 'changeFold', callback: (obj: { data: Fold, action: string }) => void): Function; on(name: 'changeScrollLeft', callback: (scrollLeft: number) => void): Function; @@ -519,6 +524,8 @@ export namespace Ace { removeKeyboardHandler(handler: KeyboardHandler): boolean; getKeyboardHandler(): KeyboardHandler; getStatusText(): string; + onCommandKey(e: any, hashId: number, keyCode: number): boolean; + onTextInput(text: string): boolean; } interface CommandMap { @@ -549,10 +556,17 @@ export namespace Ace { toggleRecording(editor: Editor): void; replay(editor: Editor): void; addCommand(command: Command): void; - removeCommand(command: Command, keepCommand?: boolean): void; + addCommands(command: Command[]): void; + removeCommand(command: Command | string, keepCommand?: boolean): void; + removeCommands(command: Command[]): void; bindKey(key: string | { mac?: string, win?: string }, command: CommandLike, position?: number): void; + bindKeys(keys: {[s: string]: Function}): void; + parseKeys(keyPart: string): {key: string, hashId: number}; + findKeyCommand(hashId: number, keyString: string): string | undefined; + handleKeyboard(data: {}, hashId: number, keyString: string, keyCode: string | number): void | {command: string}; + getStatusText(editor: Editor, data: {}): string; } export interface VirtualRenderer extends OptionsProvider, EventEmitter { @@ -746,7 +760,7 @@ export namespace Ace { setFontSize(size: string): void; focus(): void; isFocused(): boolean; - flur(): void; + blur(): void; getSelectedText(): string; getCopyText(): string; execCommand(command: string | string[], args?: any): boolean; @@ -844,9 +858,10 @@ export namespace Ace { replace(replacement: string, options?: Partial): number; replaceAll(replacement: string, options?: Partial): number; getLastSearchOptions(): Partial; - find(needle: string, options?: Partial, animate?: boolean): void; + find(needle: string | RegExp, options?: Partial, animate?: boolean): Ace.Range | undefined; findNext(options?: Partial, animate?: boolean): void; findPrevious(options?: Partial, animate?: boolean): void; + findAll(needle: string | RegExp, options?: Partial, additive?: boolean): number; undo(): void; redo(): void; destroy(): void; @@ -857,6 +872,7 @@ export namespace Ace { type CompleterCallback = (error: any, completions: Completion[]) => void; interface Completer { + identifierRegexps?: Array, getCompletions(editor: Editor, session: EditSession, position: Point, diff --git a/htdocs/includes/ace/kitchen-sink.html b/htdocs/includes/ace/kitchen-sink.html index 27014fa6004..026b357ca4a 100644 --- a/htdocs/includes/ace/kitchen-sink.html +++ b/htdocs/includes/ace/kitchen-sink.html @@ -8,7 +8,7 @@ @@ -21,18 +21,18 @@
-
+
- - + +
diff --git a/htdocs/includes/ace/package.json b/htdocs/includes/ace/package.json index a00dddeb40a..5deb5e6d478 100644 --- a/htdocs/includes/ace/package.json +++ b/htdocs/includes/ace/package.json @@ -2,7 +2,7 @@ "name": "ace-builds", "main": "./src-noconflict/ace.js", "typings": "ace.d.ts", - "version": "1.4.8", + "version": "1.4.14", "description": "Ace (Ajax.org Cloud9 Editor)", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" diff --git a/htdocs/includes/ace/src/ace.js b/htdocs/includes/ace/src/ace.js index 43d9931a3c4..74913993af1 100644 --- a/htdocs/includes/ace/src/ace.js +++ b/htdocs/includes/ace/src/ace.js @@ -173,781 +173,8 @@ exportAce(ACE_NAMESPACE); })(); -define("ace/lib/regexp",["require","exports","module"], function(require, exports, module) { +define("ace/lib/fixoldbrowsers",["require","exports","module"], function(require, exports, module) { "use strict"; - - var real = { - exec: RegExp.prototype.exec, - test: RegExp.prototype.test, - match: String.prototype.match, - replace: String.prototype.replace, - split: String.prototype.split - }, - compliantExecNpcg = real.exec.call(/()??/, "")[1] === undefined, // check `exec` handling of nonparticipating capturing groups - compliantLastIndexIncrement = function () { - var x = /^/g; - real.test.call(x, ""); - return !x.lastIndex; - }(); - - if (compliantLastIndexIncrement && compliantExecNpcg) - return; - RegExp.prototype.exec = function (str) { - var match = real.exec.apply(this, arguments), - name, r2; - if ( typeof(str) == 'string' && match) { - if (!compliantExecNpcg && match.length > 1 && indexOf(match, "") > -1) { - r2 = RegExp(this.source, real.replace.call(getNativeFlags(this), "g", "")); - real.replace.call(str.slice(match.index), r2, function () { - for (var i = 1; i < arguments.length - 2; i++) { - if (arguments[i] === undefined) - match[i] = undefined; - } - }); - } - if (this._xregexp && this._xregexp.captureNames) { - for (var i = 1; i < match.length; i++) { - name = this._xregexp.captureNames[i - 1]; - if (name) - match[name] = match[i]; - } - } - if (!compliantLastIndexIncrement && this.global && !match[0].length && (this.lastIndex > match.index)) - this.lastIndex--; - } - return match; - }; - if (!compliantLastIndexIncrement) { - RegExp.prototype.test = function (str) { - var match = real.exec.call(this, str); - if (match && this.global && !match[0].length && (this.lastIndex > match.index)) - this.lastIndex--; - return !!match; - }; - } - - function getNativeFlags (regex) { - return (regex.global ? "g" : "") + - (regex.ignoreCase ? "i" : "") + - (regex.multiline ? "m" : "") + - (regex.extended ? "x" : "") + // Proposed for ES4; included in AS3 - (regex.sticky ? "y" : ""); - } - - function indexOf (array, item, from) { - if (Array.prototype.indexOf) // Use the native array method if available - return array.indexOf(item, from); - for (var i = from || 0; i < array.length; i++) { - if (array[i] === item) - return i; - } - return -1; - } - -}); - -define("ace/lib/es5-shim",["require","exports","module"], function(require, exports, module) { - -function Empty() {} - -if (!Function.prototype.bind) { - Function.prototype.bind = function bind(that) { // .length is 1 - var target = this; - if (typeof target != "function") { - throw new TypeError("Function.prototype.bind called on incompatible " + target); - } - var args = slice.call(arguments, 1); // for normal call - var bound = function () { - - if (this instanceof bound) { - - var result = target.apply( - this, - args.concat(slice.call(arguments)) - ); - if (Object(result) === result) { - return result; - } - return this; - - } else { - return target.apply( - that, - args.concat(slice.call(arguments)) - ); - - } - - }; - if(target.prototype) { - Empty.prototype = target.prototype; - bound.prototype = new Empty(); - Empty.prototype = null; - } - return bound; - }; -} -var call = Function.prototype.call; -var prototypeOfArray = Array.prototype; -var prototypeOfObject = Object.prototype; -var slice = prototypeOfArray.slice; -var _toString = call.bind(prototypeOfObject.toString); -var owns = call.bind(prototypeOfObject.hasOwnProperty); -var defineGetter; -var defineSetter; -var lookupGetter; -var lookupSetter; -var supportsAccessors; -if ((supportsAccessors = owns(prototypeOfObject, "__defineGetter__"))) { - defineGetter = call.bind(prototypeOfObject.__defineGetter__); - defineSetter = call.bind(prototypeOfObject.__defineSetter__); - lookupGetter = call.bind(prototypeOfObject.__lookupGetter__); - lookupSetter = call.bind(prototypeOfObject.__lookupSetter__); -} -if ([1,2].splice(0).length != 2) { - if(function() { // test IE < 9 to splice bug - see issue #138 - function makeArray(l) { - var a = new Array(l+2); - a[0] = a[1] = 0; - return a; - } - var array = [], lengthBefore; - - array.splice.apply(array, makeArray(20)); - array.splice.apply(array, makeArray(26)); - - lengthBefore = array.length; //46 - array.splice(5, 0, "XXX"); // add one element - - lengthBefore + 1 == array.length - - if (lengthBefore + 1 == array.length) { - return true;// has right splice implementation without bugs - } - }()) {//IE 6/7 - var array_splice = Array.prototype.splice; - Array.prototype.splice = function(start, deleteCount) { - if (!arguments.length) { - return []; - } else { - return array_splice.apply(this, [ - start === void 0 ? 0 : start, - deleteCount === void 0 ? (this.length - start) : deleteCount - ].concat(slice.call(arguments, 2))) - } - }; - } else {//IE8 - Array.prototype.splice = function(pos, removeCount){ - var length = this.length; - if (pos > 0) { - if (pos > length) - pos = length; - } else if (pos == void 0) { - pos = 0; - } else if (pos < 0) { - pos = Math.max(length + pos, 0); - } - - if (!(pos+removeCount < length)) - removeCount = length - pos; - - var removed = this.slice(pos, pos+removeCount); - var insert = slice.call(arguments, 2); - var add = insert.length; - if (pos === length) { - if (add) { - this.push.apply(this, insert); - } - } else { - var remove = Math.min(removeCount, length - pos); - var tailOldPos = pos + remove; - var tailNewPos = tailOldPos + add - remove; - var tailCount = length - tailOldPos; - var lengthAfterRemove = length - remove; - - if (tailNewPos < tailOldPos) { // case A - for (var i = 0; i < tailCount; ++i) { - this[tailNewPos+i] = this[tailOldPos+i]; - } - } else if (tailNewPos > tailOldPos) { // case B - for (i = tailCount; i--; ) { - this[tailNewPos+i] = this[tailOldPos+i]; - } - } // else, add == remove (nothing to do) - - if (add && pos === lengthAfterRemove) { - this.length = lengthAfterRemove; // truncate array - this.push.apply(this, insert); - } else { - this.length = lengthAfterRemove + add; // reserves space - for (i = 0; i < add; ++i) { - this[pos+i] = insert[i]; - } - } - } - return removed; - }; - } -} -if (!Array.isArray) { - Array.isArray = function isArray(obj) { - return _toString(obj) == "[object Array]"; - }; -} -var boxedString = Object("a"), - splitString = boxedString[0] != "a" || !(0 in boxedString); - -if (!Array.prototype.forEach) { - Array.prototype.forEach = function forEach(fun /*, thisp*/) { - var object = toObject(this), - self = splitString && _toString(this) == "[object String]" ? - this.split("") : - object, - thisp = arguments[1], - i = -1, - length = self.length >>> 0; - if (_toString(fun) != "[object Function]") { - throw new TypeError(); // TODO message - } - - while (++i < length) { - if (i in self) { - fun.call(thisp, self[i], i, object); - } - } - }; -} -if (!Array.prototype.map) { - Array.prototype.map = function map(fun /*, thisp*/) { - var object = toObject(this), - self = splitString && _toString(this) == "[object String]" ? - this.split("") : - object, - length = self.length >>> 0, - result = Array(length), - thisp = arguments[1]; - if (_toString(fun) != "[object Function]") { - throw new TypeError(fun + " is not a function"); - } - - for (var i = 0; i < length; i++) { - if (i in self) - result[i] = fun.call(thisp, self[i], i, object); - } - return result; - }; -} -if (!Array.prototype.filter) { - Array.prototype.filter = function filter(fun /*, thisp */) { - var object = toObject(this), - self = splitString && _toString(this) == "[object String]" ? - this.split("") : - object, - length = self.length >>> 0, - result = [], - value, - thisp = arguments[1]; - if (_toString(fun) != "[object Function]") { - throw new TypeError(fun + " is not a function"); - } - - for (var i = 0; i < length; i++) { - if (i in self) { - value = self[i]; - if (fun.call(thisp, value, i, object)) { - result.push(value); - } - } - } - return result; - }; -} -if (!Array.prototype.every) { - Array.prototype.every = function every(fun /*, thisp */) { - var object = toObject(this), - self = splitString && _toString(this) == "[object String]" ? - this.split("") : - object, - length = self.length >>> 0, - thisp = arguments[1]; - if (_toString(fun) != "[object Function]") { - throw new TypeError(fun + " is not a function"); - } - - for (var i = 0; i < length; i++) { - if (i in self && !fun.call(thisp, self[i], i, object)) { - return false; - } - } - return true; - }; -} -if (!Array.prototype.some) { - Array.prototype.some = function some(fun /*, thisp */) { - var object = toObject(this), - self = splitString && _toString(this) == "[object String]" ? - this.split("") : - object, - length = self.length >>> 0, - thisp = arguments[1]; - if (_toString(fun) != "[object Function]") { - throw new TypeError(fun + " is not a function"); - } - - for (var i = 0; i < length; i++) { - if (i in self && fun.call(thisp, self[i], i, object)) { - return true; - } - } - return false; - }; -} -if (!Array.prototype.reduce) { - Array.prototype.reduce = function reduce(fun /*, initial*/) { - var object = toObject(this), - self = splitString && _toString(this) == "[object String]" ? - this.split("") : - object, - length = self.length >>> 0; - if (_toString(fun) != "[object Function]") { - throw new TypeError(fun + " is not a function"); - } - if (!length && arguments.length == 1) { - throw new TypeError("reduce of empty array with no initial value"); - } - - var i = 0; - var result; - if (arguments.length >= 2) { - result = arguments[1]; - } else { - do { - if (i in self) { - result = self[i++]; - break; - } - if (++i >= length) { - throw new TypeError("reduce of empty array with no initial value"); - } - } while (true); - } - - for (; i < length; i++) { - if (i in self) { - result = fun.call(void 0, result, self[i], i, object); - } - } - - return result; - }; -} -if (!Array.prototype.reduceRight) { - Array.prototype.reduceRight = function reduceRight(fun /*, initial*/) { - var object = toObject(this), - self = splitString && _toString(this) == "[object String]" ? - this.split("") : - object, - length = self.length >>> 0; - if (_toString(fun) != "[object Function]") { - throw new TypeError(fun + " is not a function"); - } - if (!length && arguments.length == 1) { - throw new TypeError("reduceRight of empty array with no initial value"); - } - - var result, i = length - 1; - if (arguments.length >= 2) { - result = arguments[1]; - } else { - do { - if (i in self) { - result = self[i--]; - break; - } - if (--i < 0) { - throw new TypeError("reduceRight of empty array with no initial value"); - } - } while (true); - } - - do { - if (i in this) { - result = fun.call(void 0, result, self[i], i, object); - } - } while (i--); - - return result; - }; -} -if (!Array.prototype.indexOf || ([0, 1].indexOf(1, 2) != -1)) { - Array.prototype.indexOf = function indexOf(sought /*, fromIndex */ ) { - var self = splitString && _toString(this) == "[object String]" ? - this.split("") : - toObject(this), - length = self.length >>> 0; - - if (!length) { - return -1; - } - - var i = 0; - if (arguments.length > 1) { - i = toInteger(arguments[1]); - } - i = i >= 0 ? i : Math.max(0, length + i); - for (; i < length; i++) { - if (i in self && self[i] === sought) { - return i; - } - } - return -1; - }; -} -if (!Array.prototype.lastIndexOf || ([0, 1].lastIndexOf(0, -3) != -1)) { - Array.prototype.lastIndexOf = function lastIndexOf(sought /*, fromIndex */) { - var self = splitString && _toString(this) == "[object String]" ? - this.split("") : - toObject(this), - length = self.length >>> 0; - - if (!length) { - return -1; - } - var i = length - 1; - if (arguments.length > 1) { - i = Math.min(i, toInteger(arguments[1])); - } - i = i >= 0 ? i : length - Math.abs(i); - for (; i >= 0; i--) { - if (i in self && sought === self[i]) { - return i; - } - } - return -1; - }; -} -if (!Object.getPrototypeOf) { - Object.getPrototypeOf = function getPrototypeOf(object) { - return object.__proto__ || ( - object.constructor ? - object.constructor.prototype : - prototypeOfObject - ); - }; -} -if (!Object.getOwnPropertyDescriptor) { - var ERR_NON_OBJECT = "Object.getOwnPropertyDescriptor called on a " + - "non-object: "; - Object.getOwnPropertyDescriptor = function getOwnPropertyDescriptor(object, property) { - if ((typeof object != "object" && typeof object != "function") || object === null) - throw new TypeError(ERR_NON_OBJECT + object); - if (!owns(object, property)) - return; - - var descriptor, getter, setter; - descriptor = { enumerable: true, configurable: true }; - if (supportsAccessors) { - var prototype = object.__proto__; - object.__proto__ = prototypeOfObject; - - var getter = lookupGetter(object, property); - var setter = lookupSetter(object, property); - object.__proto__ = prototype; - - if (getter || setter) { - if (getter) descriptor.get = getter; - if (setter) descriptor.set = setter; - return descriptor; - } - } - descriptor.value = object[property]; - return descriptor; - }; -} -if (!Object.getOwnPropertyNames) { - Object.getOwnPropertyNames = function getOwnPropertyNames(object) { - return Object.keys(object); - }; -} -if (!Object.create) { - var createEmpty; - if (Object.prototype.__proto__ === null) { - createEmpty = function () { - return { "__proto__": null }; - }; - } else { - createEmpty = function () { - var empty = {}; - for (var i in empty) - empty[i] = null; - empty.constructor = - empty.hasOwnProperty = - empty.propertyIsEnumerable = - empty.isPrototypeOf = - empty.toLocaleString = - empty.toString = - empty.valueOf = - empty.__proto__ = null; - return empty; - } - } - - Object.create = function create(prototype, properties) { - var object; - if (prototype === null) { - object = createEmpty(); - } else { - if (typeof prototype != "object") - throw new TypeError("typeof prototype["+(typeof prototype)+"] != 'object'"); - var Type = function () {}; - Type.prototype = prototype; - object = new Type(); - object.__proto__ = prototype; - } - if (properties !== void 0) - Object.defineProperties(object, properties); - return object; - }; -} - -function doesDefinePropertyWork(object) { - try { - Object.defineProperty(object, "sentinel", {}); - return "sentinel" in object; - } catch (exception) { - } -} -if (Object.defineProperty) { - var definePropertyWorksOnObject = doesDefinePropertyWork({}); - var definePropertyWorksOnDom = typeof document == "undefined" || - doesDefinePropertyWork(document.createElement("div")); - if (!definePropertyWorksOnObject || !definePropertyWorksOnDom) { - var definePropertyFallback = Object.defineProperty; - } -} - -if (!Object.defineProperty || definePropertyFallback) { - var ERR_NON_OBJECT_DESCRIPTOR = "Property description must be an object: "; - var ERR_NON_OBJECT_TARGET = "Object.defineProperty called on non-object: " - var ERR_ACCESSORS_NOT_SUPPORTED = "getters & setters can not be defined " + - "on this javascript engine"; - - Object.defineProperty = function defineProperty(object, property, descriptor) { - if ((typeof object != "object" && typeof object != "function") || object === null) - throw new TypeError(ERR_NON_OBJECT_TARGET + object); - if ((typeof descriptor != "object" && typeof descriptor != "function") || descriptor === null) - throw new TypeError(ERR_NON_OBJECT_DESCRIPTOR + descriptor); - if (definePropertyFallback) { - try { - return definePropertyFallback.call(Object, object, property, descriptor); - } catch (exception) { - } - } - if (owns(descriptor, "value")) { - - if (supportsAccessors && (lookupGetter(object, property) || - lookupSetter(object, property))) - { - var prototype = object.__proto__; - object.__proto__ = prototypeOfObject; - delete object[property]; - object[property] = descriptor.value; - object.__proto__ = prototype; - } else { - object[property] = descriptor.value; - } - } else { - if (!supportsAccessors) - throw new TypeError(ERR_ACCESSORS_NOT_SUPPORTED); - if (owns(descriptor, "get")) - defineGetter(object, property, descriptor.get); - if (owns(descriptor, "set")) - defineSetter(object, property, descriptor.set); - } - - return object; - }; -} -if (!Object.defineProperties) { - Object.defineProperties = function defineProperties(object, properties) { - for (var property in properties) { - if (owns(properties, property)) - Object.defineProperty(object, property, properties[property]); - } - return object; - }; -} -if (!Object.seal) { - Object.seal = function seal(object) { - return object; - }; -} -if (!Object.freeze) { - Object.freeze = function freeze(object) { - return object; - }; -} -try { - Object.freeze(function () {}); -} catch (exception) { - Object.freeze = (function freeze(freezeObject) { - return function freeze(object) { - if (typeof object == "function") { - return object; - } else { - return freezeObject(object); - } - }; - })(Object.freeze); -} -if (!Object.preventExtensions) { - Object.preventExtensions = function preventExtensions(object) { - return object; - }; -} -if (!Object.isSealed) { - Object.isSealed = function isSealed(object) { - return false; - }; -} -if (!Object.isFrozen) { - Object.isFrozen = function isFrozen(object) { - return false; - }; -} -if (!Object.isExtensible) { - Object.isExtensible = function isExtensible(object) { - if (Object(object) === object) { - throw new TypeError(); // TODO message - } - var name = ''; - while (owns(object, name)) { - name += '?'; - } - object[name] = true; - var returnValue = owns(object, name); - delete object[name]; - return returnValue; - }; -} -if (!Object.keys) { - var hasDontEnumBug = true, - dontEnums = [ - "toString", - "toLocaleString", - "valueOf", - "hasOwnProperty", - "isPrototypeOf", - "propertyIsEnumerable", - "constructor" - ], - dontEnumsLength = dontEnums.length; - - for (var key in {"toString": null}) { - hasDontEnumBug = false; - } - - Object.keys = function keys(object) { - - if ( - (typeof object != "object" && typeof object != "function") || - object === null - ) { - throw new TypeError("Object.keys called on a non-object"); - } - - var keys = []; - for (var name in object) { - if (owns(object, name)) { - keys.push(name); - } - } - - if (hasDontEnumBug) { - for (var i = 0, ii = dontEnumsLength; i < ii; i++) { - var dontEnum = dontEnums[i]; - if (owns(object, dontEnum)) { - keys.push(dontEnum); - } - } - } - return keys; - }; - -} -if (!Date.now) { - Date.now = function now() { - return new Date().getTime(); - }; -} -var ws = "\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003" + - "\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028" + - "\u2029\uFEFF"; -if (!String.prototype.trim) { - ws = "[" + ws + "]"; - var trimBeginRegexp = new RegExp("^" + ws + ws + "*"), - trimEndRegexp = new RegExp(ws + ws + "*$"); - String.prototype.trim = function trim() { - return String(this).replace(trimBeginRegexp, "").replace(trimEndRegexp, ""); - }; -} - -function toInteger(n) { - n = +n; - if (n !== n) { // isNaN - n = 0; - } else if (n !== 0 && n !== (1/0) && n !== -(1/0)) { - n = (n > 0 || -1) * Math.floor(Math.abs(n)); - } - return n; -} - -function isPrimitive(input) { - var type = typeof input; - return ( - input === null || - type === "undefined" || - type === "boolean" || - type === "number" || - type === "string" - ); -} - -function toPrimitive(input) { - var val, valueOf, toString; - if (isPrimitive(input)) { - return input; - } - valueOf = input.valueOf; - if (typeof valueOf === "function") { - val = valueOf.call(input); - if (isPrimitive(val)) { - return val; - } - } - toString = input.toString; - if (typeof toString === "function") { - val = toString.call(input); - if (isPrimitive(val)) { - return val; - } - } - throw new TypeError(); -} -var toObject = function (o) { - if (o == null) { // this matches both null and undefined - throw new TypeError("can't convert "+o+" to object"); - } - return Object(o); -}; - -}); - -define("ace/lib/fixoldbrowsers",["require","exports","module","ace/lib/regexp","ace/lib/es5-shim"], function(require, exports, module) { -"use strict"; - -require("./regexp"); -require("./es5-shim"); if (typeof Element != "undefined" && !Element.prototype.remove) { Object.defineProperty(Element.prototype, "remove", { enumerable: false, @@ -1026,8 +253,11 @@ exports.buildDom = function buildDom(arr, parent, refs) { return txt; } - if (!Array.isArray(arr)) + if (!Array.isArray(arr)) { + if (arr && arr.appendChild && parent) + parent.appendChild(arr); return arr; + } if (typeof arr[0] != "string" || !arr[0]) { var els = []; for (var i = 0; i < arr.length; i++) { @@ -1049,10 +279,12 @@ exports.buildDom = function buildDom(arr, parent, refs) { var val = options[n]; if (n === "class") { el.className = Array.isArray(val) ? val.join(" ") : val; - } else if (typeof val == "function" || n == "value") { + } else if (typeof val == "function" || n == "value" || n[0] == "$") { el[n] = val; } else if (n === "ref") { if (refs) refs[val] = el; + } else if (n === "style") { + if (typeof val == "string") el.style.cssText = val; } else if (val != null) { el.setAttribute(n, val); } @@ -1144,7 +376,34 @@ exports.hasCssString = function(id, doc) { } }; -exports.importCssString = function importCssString(cssText, id, target) { +var strictCSP; +var cssCache = []; +exports.useStrictCSP = function(value) { + strictCSP = value; + if (value == false) insertPendingStyles(); + else if (!cssCache) cssCache = []; +}; + +function insertPendingStyles() { + var cache = cssCache; + cssCache = null; + cache && cache.forEach(function(item) { + importCssString(item[0], item[1]); + }); +} + +function importCssString(cssText, id, target) { + if (typeof document == "undefined") + return; + if (cssCache) { + if (target) { + insertPendingStyles(); + } else if (target === false) { + return cssCache.push([cssText, id]); + } + } + if (strictCSP) return; + var container = target; if (!target || !target.getRootNode) { container = document; @@ -1169,7 +428,8 @@ exports.importCssString = function importCssString(cssText, id, target) { if (container == doc) container = exports.getDocumentHead(doc); container.insertBefore(style, container.firstChild); -}; +} +exports.importCssString = importCssString; exports.importCssStylsheet = function(uri, doc) { exports.buildDom(["link", {rel: "stylesheet", href: uri}], exports.getDocumentHead(doc)); @@ -1211,10 +471,6 @@ exports.scrollbarWidth = function(document) { return noScrollbar-withScrollbar; }; -if (typeof document == "undefined") { - exports.importCssString = function() {}; -} - exports.computedStyle = function(element, style) { return window.getComputedStyle(element, "") || {}; }; @@ -1231,6 +487,8 @@ exports.HI_DPI = useragent.isWin ? typeof window !== "undefined" && window.devicePixelRatio >= 1.5 : true; +if (useragent.isChromeOS) exports.HI_DPI = false; + if (typeof document !== "undefined") { var div = document.createElement("div"); if (exports.HI_DPI && div.style.transform !== undefined) @@ -1294,7 +552,8 @@ var Keys = (function() { KEY_MODS: { "ctrl": 1, "alt": 2, "option" : 2, "shift": 4, - "super": 8, "meta": 8, "command": 8, "cmd": 8 + "super": 8, "meta": 8, "command": 8, "cmd": 8, + "control": 1 }, FUNCTION_KEYS : { @@ -1422,12 +681,24 @@ function getListenerOptions() { return activeListenerOptions; } -exports.addListener = function(elem, type, callback) { - return elem.addEventListener(type, callback, getListenerOptions()); +function EventListener(elem, type, callback) { + this.elem = elem; + this.type = type; + this.callback = callback; +} +EventListener.prototype.destroy = function() { + removeListener(this.elem, this.type, this.callback); + this.elem = this.type = this.callback = undefined; }; -exports.removeListener = function(elem, type, callback) { - return elem.removeEventListener(type, callback, getListenerOptions()); +var addListener = exports.addListener = function(elem, type, callback, destroyer) { + elem.addEventListener(type, callback, getListenerOptions()); + if (destroyer) + destroyer.$toDestroy.push(new EventListener(elem, type, callback)); +}; + +var removeListener = exports.removeListener = function(elem, type, callback) { + elem.removeEventListener(type, callback, getListenerOptions()); }; exports.stopEvent = function(e) { exports.stopPropagation(e); @@ -1453,25 +724,26 @@ exports.getButton = function(e) { }; exports.capture = function(el, eventHandler, releaseCaptureHandler) { + var ownerDocument = el && el.ownerDocument || document; function onMouseUp(e) { eventHandler && eventHandler(e); releaseCaptureHandler && releaseCaptureHandler(e); - exports.removeListener(document, "mousemove", eventHandler, true); - exports.removeListener(document, "mouseup", onMouseUp, true); - exports.removeListener(document, "dragstart", onMouseUp, true); + removeListener(ownerDocument, "mousemove", eventHandler); + removeListener(ownerDocument, "mouseup", onMouseUp); + removeListener(ownerDocument, "dragstart", onMouseUp); } - exports.addListener(document, "mousemove", eventHandler, true); - exports.addListener(document, "mouseup", onMouseUp, true); - exports.addListener(document, "dragstart", onMouseUp, true); + addListener(ownerDocument, "mousemove", eventHandler); + addListener(ownerDocument, "mouseup", onMouseUp); + addListener(ownerDocument, "dragstart", onMouseUp); return onMouseUp; }; -exports.addMouseWheelListener = function(el, callback) { +exports.addMouseWheelListener = function(el, callback, destroyer) { if ("onmousewheel" in el) { - exports.addListener(el, "mousewheel", function(e) { + addListener(el, "mousewheel", function(e) { var factor = 8; if (e.wheelDeltaX !== undefined) { e.wheelX = -e.wheelDeltaX / factor; @@ -1481,9 +753,9 @@ exports.addMouseWheelListener = function(el, callback) { e.wheelY = -e.wheelDelta / factor; } callback(e); - }); + }, destroyer); } else if ("onwheel" in el) { - exports.addListener(el, "wheel", function(e) { + addListener(el, "wheel", function(e) { var factor = 0.35; switch (e.deltaMode) { case e.DOM_DELTA_PIXEL: @@ -1498,9 +770,9 @@ exports.addMouseWheelListener = function(el, callback) { } callback(e); - }); + }, destroyer); } else { - exports.addListener(el, "DOMMouseScroll", function(e) { + addListener(el, "DOMMouseScroll", function(e) { if (e.axis && e.axis == e.HORIZONTAL_AXIS) { e.wheelX = (e.detail || 0) * 5; e.wheelY = 0; @@ -1509,11 +781,11 @@ exports.addMouseWheelListener = function(el, callback) { e.wheelY = (e.detail || 0) * 5; } callback(e); - }); + }, destroyer); } }; -exports.addMultiMouseDownListener = function(elements, timeouts, eventHandler, callbackName) { +exports.addMultiMouseDownListener = function(elements, timeouts, eventHandler, callbackName, destroyer) { var clicks = 0; var startX, startY, timer; var eventNames = { @@ -1558,7 +830,7 @@ exports.addMultiMouseDownListener = function(elements, timeouts, eventHandler, c if (!Array.isArray(elements)) elements = [elements]; elements.forEach(function(el) { - exports.addListener(el, "mousedown", onMousedown); + addListener(el, "mousedown", onMousedown, destroyer); }); }; @@ -1623,16 +895,15 @@ function normalizeCommandKeys(callback, e, keyCode) { } -exports.addCommandKeyListener = function(el, callback) { - var addListener = exports.addListener; +exports.addCommandKeyListener = function(el, callback, destroyer) { if (useragent.isOldGecko || (useragent.isOpera && !("KeyboardEvent" in window))) { var lastKeyDownKeyCode = null; addListener(el, "keydown", function(e) { lastKeyDownKeyCode = e.keyCode; - }); + }, destroyer); addListener(el, "keypress", function(e) { return normalizeCommandKeys(callback, e, lastKeyDownKeyCode); - }); + }, destroyer); } else { var lastDefaultPrevented = null; @@ -1641,18 +912,18 @@ exports.addCommandKeyListener = function(el, callback) { var result = normalizeCommandKeys(callback, e, e.keyCode); lastDefaultPrevented = e.defaultPrevented; return result; - }); + }, destroyer); addListener(el, "keypress", function(e) { if (lastDefaultPrevented && (e.ctrlKey || e.altKey || e.shiftKey || e.metaKey)) { exports.stopEvent(e); lastDefaultPrevented = null; } - }); + }, destroyer); addListener(el, "keyup", function(e) { pressedKeys[e.keyCode] = null; - }); + }, destroyer); if (!pressedKeys) { resetPressedKeys(); @@ -1673,12 +944,12 @@ if (typeof window == "object" && window.postMessage && !useragent.isOldIE) { var listener = function(e) { if (e.data == messageName) { exports.stopPropagation(e); - exports.removeListener(win, "message", listener); + removeListener(win, "message", listener); callback(); } }; - exports.addListener(win, "message", listener); + addListener(win, "message", listener); win.postMessage(messageName, "*"); }; } @@ -2181,6 +1452,7 @@ var KEYS = require("../lib/keys"); var MODS = KEYS.KEY_MODS; var isIOS = useragent.isIOS; var valueResetRegex = isIOS ? /\s/ : /\n/; +var isMobile = useragent.isMobile; var TextInput = function(parentNode, host) { var text = dom.createElement("textarea"); @@ -2200,7 +1472,7 @@ var TextInput = function(parentNode, host) { var sendingText = false; var tempStyle = ''; - if (!useragent.isMobile) + if (!isMobile) text.style.fontSize = "1px"; var commandMode = false; @@ -2216,7 +1488,7 @@ var TextInput = function(parentNode, host) { if (ignoreFocusEvents) return; host.onBlur(e); isFocused = false; - }); + }, host); event.addListener(text, "focus", function(e) { if (ignoreFocusEvents) return; isFocused = true; @@ -2231,7 +1503,7 @@ var TextInput = function(parentNode, host) { setTimeout(resetSelection); else resetSelection(); - }); + }, host); this.$focusScroll = false; this.focus = function() { if (tempStyle || HAS_FOCUS_ARGS || this.$focusScroll == "browser") @@ -2277,9 +1549,12 @@ var TextInput = function(parentNode, host) { }; host.on("beforeEndOperation", function() { - if (host.curOp && host.curOp.command.name == "insertstring") + var curOp = host.curOp; + var commandName = curOp && curOp.command && curOp.command.name; + if (commandName == "insertstring") return; - if (inComposition) { + var isUserAction = commandName && (curOp.docChanged || curOp.selectionChanged); + if (inComposition && isUserAction) { lastValue = text.value = ""; onCompositionEnd(); } @@ -2311,33 +1586,49 @@ var TextInput = function(parentNode, host) { return; inComposition = true; - var selection = host.selection; - var range = selection.getRange(); - var row = selection.cursor.row; - var selectionStart = range.start.column; - var selectionEnd = range.end.column; - var line = host.session.getLine(row); + var selectionStart = 0; + var selectionEnd = 0; + var line = ""; - if (range.start.row != row) { - var prevLine = host.session.getLine(row - 1); - selectionStart = range.start.row < row - 1 ? 0 : selectionStart; - selectionEnd += prevLine.length + 1; - line = prevLine + "\n" + line; - } - else if (range.end.row != row) { - var nextLine = host.session.getLine(row + 1); - selectionEnd = range.end.row > row + 1 ? nextLine.length : selectionEnd; - selectionEnd += line.length + 1; - line = line + "\n" + nextLine; - } + if (host.session) { + var selection = host.selection; + var range = selection.getRange(); + var row = selection.cursor.row; + selectionStart = range.start.column; + selectionEnd = range.end.column; + line = host.session.getLine(row); - if (line.length > MAX_LINE_LENGTH) { - if (selectionStart < MAX_LINE_LENGTH && selectionEnd < MAX_LINE_LENGTH) { - line = line.slice(0, MAX_LINE_LENGTH); - } else { - line = "\n"; - selectionStart = 0; - selectionEnd = 1; + if (range.start.row != row) { + var prevLine = host.session.getLine(row - 1); + selectionStart = range.start.row < row - 1 ? 0 : selectionStart; + selectionEnd += prevLine.length + 1; + line = prevLine + "\n" + line; + } + else if (range.end.row != row) { + var nextLine = host.session.getLine(row + 1); + selectionEnd = range.end.row > row + 1 ? nextLine.length : selectionEnd; + selectionEnd += line.length + 1; + line = line + "\n" + nextLine; + } + else if (isMobile && row > 0) { + line = "\n" + line; + selectionEnd += 1; + selectionStart += 1; + } + + if (line.length > MAX_LINE_LENGTH) { + if (selectionStart < MAX_LINE_LENGTH && selectionEnd < MAX_LINE_LENGTH) { + line = line.slice(0, MAX_LINE_LENGTH); + } else { + line = "\n"; + if (selectionStart == selectionEnd) { + selectionStart = selectionEnd = 0; + } + else { + selectionStart = 0; + selectionEnd = 1; + } + } } } @@ -2363,6 +1654,7 @@ var TextInput = function(parentNode, host) { } inComposition = false; }; + this.resetSelection = resetSelection; if (isFocused) host.onFocus(); @@ -2382,6 +1674,8 @@ var TextInput = function(parentNode, host) { } else if (isAllSelected(text)) { host.selectAll(); resetSelection(); + } else if (isMobile && text.selectionStart != lastSelectionStart) { + resetSelection(); } }; @@ -2432,6 +1726,12 @@ var TextInput = function(parentNode, host) { if (!fromInput && !inserted && !restoreStart && !extendLeft && !extendRight && !restoreEnd) return ""; sendingText = true; + var shouldReset = false; + if (useragent.isAndroid && inserted == ". ") { + inserted = " "; + shouldReset = true; + } + if (inserted && !extendLeft && !extendRight && !restoreStart && !restoreEnd || commandMode) { host.onTextInput(inserted); } else { @@ -2448,7 +1748,7 @@ var TextInput = function(parentNode, host) { lastSelectionStart = selectionStart; lastSelectionEnd = selectionEnd; lastRestoreEnd = restoreEnd; - return inserted; + return shouldReset ? "\n" : inserted; } }; var onInput = function(e) { @@ -2460,8 +1760,13 @@ var TextInput = function(parentNode, host) { } var data = text.value; var inserted = sendText(data, true); - if (data.length > MAX_LINE_LENGTH + 100 || valueResetRegex.test(inserted)) + if ( + data.length > MAX_LINE_LENGTH + 100 + || valueResetRegex.test(inserted) + || isMobile && lastSelectionStart < 1 && lastSelectionStart == lastSelectionEnd + ) { resetSelection(); + } }; var handleClipboardData = function(e, data, forceIEMime) { @@ -2533,14 +1838,14 @@ var TextInput = function(parentNode, host) { } }; - event.addCommandKeyListener(text, host.onCommandKey.bind(host)); + event.addCommandKeyListener(text, host.onCommandKey.bind(host), host); - event.addListener(text, "select", onSelect); - event.addListener(text, "input", onInput); + event.addListener(text, "select", onSelect, host); + event.addListener(text, "input", onInput, host); - event.addListener(text, "cut", onCut); - event.addListener(text, "copy", onCopy); - event.addListener(text, "paste", onPaste); + event.addListener(text, "cut", onCut, host); + event.addListener(text, "copy", onCopy, host); + event.addListener(text, "paste", onPaste, host); if (!('oncut' in text) || !('oncopy' in text) || !('onpaste' in text)) { event.addListener(parentNode, "keydown", function(e) { if ((useragent.isMac && !e.metaKey) || !e.ctrlKey) @@ -2557,7 +1862,7 @@ var TextInput = function(parentNode, host) { onCut(e); break; } - }); + }, host); } var onCompositionStart = function(e) { if (inComposition || !host.onCompositionStart || host.$readOnly) @@ -2568,7 +1873,11 @@ var TextInput = function(parentNode, host) { if (commandMode) return; + if (e.data) + inComposition.useTextareaForIME = false; + setTimeout(onCompositionUpdate, 0); + host._signal("compositionStart"); host.on("mousedown", cancelComposition); var range = host.getSelectionRange(); @@ -2579,8 +1888,7 @@ var TextInput = function(parentNode, host) { host.onCompositionStart(inComposition); if (inComposition.useTextareaForIME) { - text.value = ""; - lastValue = ""; + lastValue = text.value = ""; lastSelectionStart = 0; lastSelectionEnd = 0; } @@ -2643,11 +1951,11 @@ var TextInput = function(parentNode, host) { syncComposition(); } - event.addListener(text, "compositionstart", onCompositionStart); - event.addListener(text, "compositionupdate", onCompositionUpdate); - event.addListener(text, "keyup", onKeyup); - event.addListener(text, "keydown", syncComposition); - event.addListener(text, "compositionend", onCompositionEnd); + event.addListener(text, "compositionstart", onCompositionStart, host); + event.addListener(text, "compositionupdate", onCompositionUpdate, host); + event.addListener(text, "keyup", onKeyup, host); + event.addListener(text, "keydown", syncComposition, host); + event.addListener(text, "compositionend", onCompositionEnd, host); this.getElement = function() { return text; @@ -2718,13 +2026,13 @@ var TextInput = function(parentNode, host) { host.textInput.onContextMenu(e); onContextMenuClose(); }; - event.addListener(text, "mouseup", onContextMenu); + event.addListener(text, "mouseup", onContextMenu, host); event.addListener(text, "mousedown", function(e) { e.preventDefault(); onContextMenuClose(); - }); - event.addListener(host.renderer.scroller, "contextmenu", onContextMenu); - event.addListener(text, "contextmenu", onContextMenu); + }, host); + event.addListener(host.renderer.scroller, "contextmenu", onContextMenu, host); + event.addListener(text, "contextmenu", onContextMenu, host); if (isIOS) addIosSelectionHandler(parentNode, host, text); @@ -2810,10 +2118,13 @@ var TextInput = function(parentNode, host) { document.removeEventListener("selectionchange", detectArrowKeys); }); } - }; exports.TextInput = TextInput; +exports.$setUserAgentForTests = function(_isMobile, _isIOS) { + isMobile = _isMobile; + isIOS = _isIOS; +}; }); define("ace/mouse/default_handlers",["require","exports","module","ace/lib/useragent"], function(require, exports, module) { @@ -3243,7 +2554,7 @@ function GutterHandler(mouseHandler) { tooltip.hide(); tooltipAnnotation = null; editor._signal("hideGutterTooltip", tooltip); - editor.removeEventListener("mousewheel", hideTooltip); + editor.off("mousewheel", hideTooltip); } } @@ -3280,7 +2591,7 @@ function GutterHandler(mouseHandler) { tooltipTimeout = null; hideTooltip(); }, 50); - }); + }, editor); editor.on("changeSession", hideTooltip); } @@ -3405,18 +2716,16 @@ function DragdropHandler(mouseHandler) { var editor = mouseHandler.editor; - var blankImage = dom.createElement("img"); - blankImage.src = "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="; - if (useragent.isOpera) - blankImage.style.cssText = "width:1px;height:1px;position:fixed;top:0;left:0;z-index:2147483647;opacity:0;"; + var dragImage = dom.createElement("div"); + dragImage.style.cssText = "top:-100px;position:absolute;z-index:2147483647;opacity:0.5"; + dragImage.textContent = "\xa0"; var exports = ["dragWait", "dragWaitEnd", "startDrag", "dragReadyEnd", "onMouseDrag"]; - exports.forEach(function(x) { - mouseHandler[x] = this[x]; + exports.forEach(function(x) { + mouseHandler[x] = this[x]; }, this); - editor.addEventListener("mousedown", this.onMouseDown.bind(mouseHandler)); - + editor.on("mousedown", this.onMouseDown.bind(mouseHandler)); var mouseTarget = editor.container; var dragSelectionMarker, x, y; @@ -3441,14 +2750,12 @@ function DragdropHandler(mouseHandler) { var dataTransfer = e.dataTransfer; dataTransfer.effectAllowed = editor.getReadOnly() ? "copy" : "copyMove"; - if (useragent.isOpera) { - editor.container.appendChild(blankImage); - blankImage.scrollTop = 0; - } - dataTransfer.setDragImage && dataTransfer.setDragImage(blankImage, 0, 0); - if (useragent.isOpera) { - editor.container.removeChild(blankImage); - } + editor.container.appendChild(dragImage); + + dataTransfer.setDragImage && dataTransfer.setDragImage(dragImage, 0, 0); + setTimeout(function() { + editor.container.removeChild(dragImage); + }); dataTransfer.clearData(); dataTransfer.setData("Text", editor.session.getTextRange()); @@ -3540,12 +2847,12 @@ function DragdropHandler(mouseHandler) { return event.preventDefault(e); }; - event.addListener(mouseTarget, "dragstart", this.onDragStart.bind(mouseHandler)); - event.addListener(mouseTarget, "dragend", this.onDragEnd.bind(mouseHandler)); - event.addListener(mouseTarget, "dragenter", this.onDragEnter.bind(mouseHandler)); - event.addListener(mouseTarget, "dragover", this.onDragOver.bind(mouseHandler)); - event.addListener(mouseTarget, "dragleave", this.onDragLeave.bind(mouseHandler)); - event.addListener(mouseTarget, "drop", this.onDrop.bind(mouseHandler)); + event.addListener(mouseTarget, "dragstart", this.onDragStart.bind(mouseHandler), editor); + event.addListener(mouseTarget, "dragend", this.onDragEnd.bind(mouseHandler), editor); + event.addListener(mouseTarget, "dragenter", this.onDragEnter.bind(mouseHandler), editor); + event.addListener(mouseTarget, "dragover", this.onDragOver.bind(mouseHandler), editor); + event.addListener(mouseTarget, "dragleave", this.onDragLeave.bind(mouseHandler), editor); + event.addListener(mouseTarget, "drop", this.onDrop.bind(mouseHandler), editor); function scrollCursorIntoView(cursor, prevCursor) { var now = Date.now(); @@ -3860,9 +3167,17 @@ exports.addTouchListeners = function(el, editor) { if (!contextMenu) createContextMenu(); var cursor = editor.selection.cursor; var pagePos = editor.renderer.textToScreenCoordinates(cursor.row, cursor.column); + var leftOffset = editor.renderer.textToScreenCoordinates(0, 0).pageX; + var scrollLeft = editor.renderer.scrollLeft; var rect = editor.container.getBoundingClientRect(); contextMenu.style.top = pagePos.pageY - rect.top - 3 + "px"; - contextMenu.style.right = "10px"; + if (pagePos.pageX - rect.left < rect.width - 70) { + contextMenu.style.left = ""; + contextMenu.style.right = "10px"; + } else { + contextMenu.style.right = ""; + contextMenu.style.left = leftOffset + scrollLeft - rect.left + "px"; + } contextMenu.style.display = ""; contextMenu.firstChild.style.display = "none"; editor.on("input", hideContextMenu); @@ -3903,7 +3218,7 @@ exports.addTouchListeners = function(el, editor) { if (!pressed) return; var textarea = editor.textInput.getElement(); textarea.focus(); - }); + }, editor); event.addListener(el, "touchstart", function (e) { var touches = e.touches; if (longTouchTimer || touches.length > 1) { @@ -3945,6 +3260,8 @@ exports.addTouchListeners = function(el, editor) { var cursorPos = editor.renderer.$cursorLayer.getPixelPosition(cursor, true); var anchorPos = editor.renderer.$cursorLayer.getPixelPosition(anchor, true); var rect = editor.renderer.scroller.getBoundingClientRect(); + var offsetTop = editor.renderer.layerConfig.offset; + var offsetLeft = editor.renderer.scrollLeft; var weightedDistance = function(x, y) { x = x / w; y = y / h - 0.75; @@ -3957,12 +3274,12 @@ exports.addTouchListeners = function(el, editor) { } var diff1 = weightedDistance( - e.clientX - rect.left - cursorPos.left, - e.clientY - rect.top - cursorPos.top + e.clientX - rect.left - cursorPos.left + offsetLeft, + e.clientY - rect.top - cursorPos.top + offsetTop ); var diff2 = weightedDistance( - e.clientX - rect.left - anchorPos.left, - e.clientY - rect.top - anchorPos.top + e.clientX - rect.left - anchorPos.left + offsetLeft, + e.clientY - rect.top - anchorPos.top + offsetTop ); if (diff1 < 3.5 && diff2 < 3.5) mode = diff1 > diff2 ? "cursor" : "anchor"; @@ -3976,7 +3293,7 @@ exports.addTouchListeners = function(el, editor) { longTouchTimer = setTimeout(handleLongTap, 450); } touchStartT = t; - }); + }, editor); event.addListener(el, "touchend", function (e) { pressed = editor.$mouseHandler.isMousePressed = false; @@ -3990,14 +3307,13 @@ exports.addTouchListeners = function(el, editor) { showContextMenu(); } else if (mode == "scroll") { animate(); - e.preventDefault(); hideContextMenu(); } else { showContextMenu(); } clearTimeout(longTouchTimer); longTouchTimer = null; - }); + }, editor); event.addListener(el, "touchmove", function (e) { if (longTouchTimer) { clearTimeout(longTouchTimer); @@ -4053,7 +3369,7 @@ exports.addTouchListeners = function(el, editor) { editor.renderer.scrollCursorIntoView(pos); e.preventDefault(); } - }); + }, editor); function animate() { animationSteps += 60; @@ -4164,8 +3480,8 @@ EventEmitter._signal = function(eventName, e) { EventEmitter.once = function(eventName, callback) { var _self = this; - this.addEventListener(eventName, function newCallback() { - _self.removeEventListener(eventName, newCallback); + this.on(eventName, function newCallback() { + _self.off(eventName, newCallback); callback.apply(null, arguments); }); if (!callback) { @@ -4237,7 +3553,9 @@ EventEmitter.removeEventListener = function(eventName, callback) { }; EventEmitter.removeAllListeners = function(eventName) { - if (this._eventRegistry) this._eventRegistry[eventName] = []; + if (!eventName) this._eventRegistry = this._defaultHandlers = undefined; + if (this._eventRegistry) this._eventRegistry[eventName] = undefined; + if (this._defaultHandlers) this._defaultHandlers[eventName] = undefined; }; exports.EventEmitter = EventEmitter; @@ -4376,12 +3694,13 @@ exports.AppConfig = AppConfig; }); -define("ace/config",["require","exports","module","ace/lib/lang","ace/lib/oop","ace/lib/net","ace/lib/app_config"], function(require, exports, module) { +define("ace/config",["require","exports","module","ace/lib/lang","ace/lib/oop","ace/lib/net","ace/lib/dom","ace/lib/app_config"], function(require, exports, module) { "no use strict"; var lang = require("./lib/lang"); var oop = require("./lib/oop"); var net = require("./lib/net"); +var dom = require("./lib/dom"); var AppConfig = require("./lib/app_config").AppConfig; module.exports = exports = new AppConfig(); @@ -4399,13 +3718,13 @@ var options = { suffix: ".js", $moduleUrls: {}, loadWorkerFromBlob: true, - sharedPopups: false + sharedPopups: false, + useStrictCSP: null }; exports.get = function(key) { if (!options.hasOwnProperty(key)) throw new Error("Unknown config key: " + key); - return options[key]; }; @@ -4414,6 +3733,8 @@ exports.set = function(key, value) { options[key] = value; else if (this.setDefaultValue("", key, value) == false) throw new Error("Unknown config key: " + key); + if (key == "useStrictCSP") + dom.useStrictCSP(value); }; exports.all = function() { @@ -4560,7 +3881,7 @@ function deHyphenate(str) { return str.replace(/-(.)/g, function(m, m1) { return m1.toUpperCase(); }); } -exports.version = "1.4.8"; +exports.version = "1.4.14"; }); @@ -4593,28 +3914,28 @@ var MouseHandler = function(editor) { }; var mouseTarget = editor.renderer.getMouseEventTarget(); - event.addListener(mouseTarget, "click", this.onMouseEvent.bind(this, "click")); - event.addListener(mouseTarget, "mousemove", this.onMouseMove.bind(this, "mousemove")); + event.addListener(mouseTarget, "click", this.onMouseEvent.bind(this, "click"), editor); + event.addListener(mouseTarget, "mousemove", this.onMouseMove.bind(this, "mousemove"), editor); event.addMultiMouseDownListener([ mouseTarget, editor.renderer.scrollBarV && editor.renderer.scrollBarV.inner, editor.renderer.scrollBarH && editor.renderer.scrollBarH.inner, editor.textInput && editor.textInput.getElement() - ].filter(Boolean), [400, 300, 250], this, "onMouseEvent"); - event.addMouseWheelListener(editor.container, this.onMouseWheel.bind(this, "mousewheel")); + ].filter(Boolean), [400, 300, 250], this, "onMouseEvent", editor); + event.addMouseWheelListener(editor.container, this.onMouseWheel.bind(this, "mousewheel"), editor); addTouchListeners(editor.container, editor); var gutterEl = editor.renderer.$gutter; - event.addListener(gutterEl, "mousedown", this.onMouseEvent.bind(this, "guttermousedown")); - event.addListener(gutterEl, "click", this.onMouseEvent.bind(this, "gutterclick")); - event.addListener(gutterEl, "dblclick", this.onMouseEvent.bind(this, "gutterdblclick")); - event.addListener(gutterEl, "mousemove", this.onMouseEvent.bind(this, "guttermousemove")); + event.addListener(gutterEl, "mousedown", this.onMouseEvent.bind(this, "guttermousedown"), editor); + event.addListener(gutterEl, "click", this.onMouseEvent.bind(this, "gutterclick"), editor); + event.addListener(gutterEl, "dblclick", this.onMouseEvent.bind(this, "gutterdblclick"), editor); + event.addListener(gutterEl, "mousemove", this.onMouseEvent.bind(this, "guttermousemove"), editor); - event.addListener(mouseTarget, "mousedown", focusEditor); - event.addListener(gutterEl, "mousedown", focusEditor); + event.addListener(mouseTarget, "mousedown", focusEditor, editor); + event.addListener(gutterEl, "mousedown", focusEditor, editor); if (useragent.isIE && editor.renderer.scrollBarV) { - event.addListener(editor.renderer.scrollBarV.element, "mousedown", focusEditor); - event.addListener(editor.renderer.scrollBarH.element, "mousedown", focusEditor); + event.addListener(editor.renderer.scrollBarV.element, "mousedown", focusEditor, editor); + event.addListener(editor.renderer.scrollBarH.element, "mousedown", focusEditor, editor); } editor.on("mousemove", function(e){ @@ -4630,11 +3951,12 @@ var MouseHandler = function(editor) { } else { renderer.setCursorStyle(""); } - }); + }, editor); }; (function() { this.onMouseEvent = function(name, e) { + if (!this.editor.session) return; this.editor._emit(name, new MouseEvent(e, this.editor)); }; @@ -4684,7 +4006,7 @@ var MouseHandler = function(editor) { var onCaptureEnd = function(e) { editor.off("beforeEndOperation", onOperationEnd); clearInterval(timerId); - onCaptureInterval(); + if (editor.session) onCaptureInterval(); self[self.state + "End"] && self[self.state + "End"](e); self.state = ""; self.isMousePressed = renderer.$isMousePressed = false; @@ -4732,6 +4054,9 @@ var MouseHandler = function(editor) { setTimeout(stop, 10); this.editor.on("nativecontextmenu", stop); }; + this.destroy = function() { + if (this.releaseMouse) this.releaseMouse(); + }; }).call(MouseHandler.prototype); config.defineOptions(MouseHandler.prototype, "mouseHandler", { @@ -6102,7 +5427,6 @@ var Selection = function(session) { this.detach = function() { this.lead.detach(); this.anchor.detach(); - this.session = this.doc = null; }; this.fromOrientedRange = function(range) { @@ -6318,7 +5642,7 @@ var Tokenizer = function(rules) { this.removeCapturingGroups = function(src) { var r = src.replace( - /\\.|\[(?:\\.|[^\\\]])*|\(\?[:=!]|(\()/g, + /\\.|\[(?:\\.|[^\\\]])*|\(\?[:=!<]|(\()/g, function(x, y) {return y ? "(?:" : x;} ); return r; @@ -6677,18 +6001,18 @@ var TextHighlightRules = function() { this.createKeywordMapper = function(map, defaultToken, ignoreCase, splitChar) { var keywords = Object.create(null); + this.$keywordList = []; Object.keys(map).forEach(function(className) { var a = map[className]; - if (ignoreCase) - a = a.toLowerCase(); var list = a.split(splitChar || "|"); - for (var i = list.length; i--; ) - keywords[list[i]] = className; - }); - if (Object.getPrototypeOf(keywords)) { - keywords.__proto__ = null; - } - this.$keywordList = Object.keys(keywords); + for (var i = list.length; i--; ) { + var word = list[i]; + this.$keywordList.push(word); + if (ignoreCase) + word = word.toLowerCase(); + keywords[word] = className; + } + }, this); map = null; return ignoreCase ? function(value) {return keywords[value.toLowerCase()] || defaultToken; } @@ -7751,7 +7075,7 @@ var Anchor = exports.Anchor = function(doc, row, column) { }); }; this.detach = function() { - this.document.removeEventListener("change", this.$onChange); + this.document.off("change", this.$onChange); }; this.attach = function(doc) { this.document = doc || this.document; @@ -8083,6 +7407,16 @@ var Document = function(textOrLines) { } }; + this.$safeApplyDelta = function(delta) { + var docLength = this.$lines.length; + if ( + delta.action == "remove" && delta.start.row < docLength && delta.end.row < docLength + || delta.action == "insert" && delta.start.row <= docLength + ) { + this.applyDelta(delta); + } + }; + this.$splitAndapplyLargeDelta = function(delta, MAX) { var lines = delta.lines; var l = lines.length - MAX + 1; @@ -8105,7 +7439,7 @@ var Document = function(textOrLines) { this.applyDelta(delta, true); }; this.revertDelta = function(delta) { - this.applyDelta({ + this.$safeApplyDelta({ start: this.clonePos(delta.start), end: this.clonePos(delta.end), action: (delta.action == "insert" ? "remove" : "insert"), @@ -9142,9 +8476,11 @@ function Folding() { var folds = this.getFoldsInRange(fold.range); if (folds.length > 0) { this.removeFolds(folds); - folds.forEach(function(subFold) { - fold.addSubFold(subFold); - }); + if (!fold.collapseChildren) { + folds.forEach(function(subFold) { + fold.addSubFold(subFold); + }); + } } for (var i = 0; i < foldData.length; i++) { @@ -9263,26 +8599,39 @@ function Folding() { var range, folds; if (location == null) { range = new Range(0, 0, this.getLength(), 0); - expandInner = true; - } else if (typeof location == "number") + if (expandInner == null) expandInner = true; + } else if (typeof location == "number") { range = new Range(location, 0, location, this.getLine(location).length); - else if ("row" in location) + } else if ("row" in location) { range = Range.fromPoints(location, location); - else + } else if (Array.isArray(location)) { + folds = []; + location.forEach(function(range) { + folds = folds.concat(this.unfold(range)); + }, this); + return folds; + } else { range = location; + } folds = this.getFoldsInRangeList(range); - if (expandInner) { + var outermostFolds = folds; + while ( + folds.length == 1 + && Range.comparePoints(folds[0].start, range.start) < 0 + && Range.comparePoints(folds[0].end, range.end) > 0 + ) { + this.expandFolds(folds); + folds = this.getFoldsInRangeList(range); + } + + if (expandInner != false) { this.removeFolds(folds); } else { - var subFolds = folds; - while (subFolds.length) { - this.expandFolds(subFolds); - subFolds = this.getFoldsInRangeList(range); - } + this.expandFolds(folds); } - if (folds.length) - return folds; + if (outermostFolds.length) + return outermostFolds; }; this.isRowFolded = function(docRow, startFoldRow) { return !!this.getFoldLine(docRow, startFoldRow); @@ -9416,7 +8765,7 @@ function Folding() { this.getCommentFoldRange = function(row, column, dir) { var iterator = new TokenIterator(this, row, column); var token = iterator.getCurrentToken(); - var type = token.type; + var type = token && token.type; if (token && /^comment|string/.test(type)) { type = type.match(/comment|string/)[0]; if (type == "comment") @@ -9457,7 +8806,7 @@ function Folding() { } }; - this.foldAll = function(startRow, endRow, depth) { + this.foldAll = function(startRow, endRow, depth, test) { if (depth == undefined) depth = 100000; // JSON.stringify doesn't hanle Infinity var foldWidgets = this.foldWidgets; @@ -9470,6 +8819,8 @@ function Folding() { foldWidgets[row] = this.getFoldWidget(row); if (foldWidgets[row] != "start") continue; + + if (test && !test(row)) continue; var range = this.getFoldWidgetRange(row); if (range && range.isMultiLine() @@ -9477,14 +8828,32 @@ function Folding() { && range.start.row >= startRow ) { row = range.end.row; - try { - var fold = this.addFold("...", range); - if (fold) - fold.collapseChildren = depth; - } catch(e) {} + range.collapseChildren = depth; + this.addFold("...", range); } } }; + + this.foldToLevel = function(level) { + this.foldAll(); + while (level-- > 0) + this.unfold(null, false); + }; + + this.foldAllComments = function() { + var session = this; + this.foldAll(null, null, null, function(row) { + var tokens = session.getTokens(row); + for (var i = 0; i < tokens.length; i++) { + var token = tokens[i]; + if (token.type == "text" && /^\s+$/.test(token.value)) + continue; + if (/comment/.test(token.type)) + return true; + return false; + } + }); + }; this.$foldStyles = { "manual": 1, "markbegin": 1, @@ -9929,7 +9298,7 @@ EditSession.$uid = 0; oop.implement(this, EventEmitter); this.setDocument = function(doc) { if (this.doc) - this.doc.removeListener("change", this.$onChange); + this.doc.off("change", this.$onChange); this.doc = doc; doc.on("change", this.$onChange); @@ -10356,7 +9725,8 @@ EditSession.$uid = 0; this.$modeId = mode.$id; if (this.$mode === mode) return; - + + var oldMode = this.$mode; this.$mode = mode; this.$stopWorker(); @@ -10366,15 +9736,15 @@ EditSession.$uid = 0; var tokenizer = mode.getTokenizer(); - if(tokenizer.addEventListener !== undefined) { + if(tokenizer.on !== undefined) { var onReloadTokenizer = this.onReloadTokenizer.bind(this); - tokenizer.addEventListener("update", onReloadTokenizer); + tokenizer.on("update", onReloadTokenizer); } if (!this.bgTokenizer) { this.bgTokenizer = new BackgroundTokenizer(tokenizer); var _self = this; - this.bgTokenizer.addEventListener("update", function(e) { + this.bgTokenizer.on("update", function(e) { _self._signal("tokenizerUpdate", e); }); } else { @@ -10393,7 +9763,7 @@ EditSession.$uid = 0; this.$options.wrapMethod.set.call(this, this.$wrapMethod); this.$setFolding(mode.foldingRules); this.bgTokenizer.start(0); - this._emit("changeMode"); + this._emit("changeMode", {oldMode: oldMode, mode: mode}); } }; @@ -10539,7 +9909,7 @@ EditSession.$uid = 0; for (var i = 0; i < deltas.length; i++) { var delta = deltas[i]; if (delta.action == "insert" || delta.action == "remove") { - this.doc.applyDelta(delta); + this.doc.$safeApplyDelta(delta); } } @@ -10561,7 +9931,6 @@ EditSession.$uid = 0; } var range, point; - var lastDeltaIsInsert; for (var i = 0; i < deltas.length; i++) { var delta = deltas[i]; @@ -10569,10 +9938,8 @@ EditSession.$uid = 0; if (!range) { if (isInsert(delta)) { range = Range.fromPoints(delta.start, delta.end); - lastDeltaIsInsert = true; } else { range = Range.fromPoints(delta.start, delta.start); - lastDeltaIsInsert = false; } continue; } @@ -10586,13 +9953,11 @@ EditSession.$uid = 0; if (range.compare(point.row, point.column) == 1) { range.setEnd(point); } - lastDeltaIsInsert = true; } else { point = delta.start; if (range.compare(point.row, point.column) == -1) { range = Range.fromPoints(delta.start, delta.start); } - lastDeltaIsInsert = false; } } return range; @@ -11458,6 +10823,11 @@ EditSession.$uid = 0; this.bgTokenizer = null; } this.$stopWorker(); + this.removeAllListeners(); + if (this.doc) { + this.doc.off("change", this.$onChange); + } + this.selection.detach(); }; this.isFullWidth = isFullWidth; @@ -11848,7 +11218,7 @@ var Search = function() { var len = re.length; var forEachInLine = function(row, offset, callback) { var startRow = backwards ? row - len + 1 : row; - if (startRow < 0) return; + if (startRow < 0 || startRow + len > session.getLength()) return; var line = session.getLine(startRow); var startIndex = line.search(re[0]); if (!backwards && startIndex < offset || startIndex === -1) return; @@ -12199,7 +11569,7 @@ oop.inherits(CommandManager, MultiHashHandler); editor && editor._emit("changeStatus"); if (this.recording) { this.macro.pop(); - this.removeEventListener("exec", this.$addCommandToMacro); + this.off("exec", this.$addCommandToMacro); if (!this.macro.length) this.macro = this.oldMacro; @@ -12266,6 +11636,7 @@ function bindKey(win, mac) { } exports.commands = [{ name: "showSettingsMenu", + description: "Show settings menu", bindKey: bindKey("Ctrl-,", "Command-,"), exec: function(editor) { config.loadModule("ace/ext/settings_menu", function(module) { @@ -12276,6 +11647,7 @@ exports.commands = [{ readOnly: true }, { name: "goToNextError", + description: "Go to next error", bindKey: bindKey("Alt-E", "F4"), exec: function(editor) { config.loadModule("./ext/error_marker", function(module) { @@ -12286,6 +11658,7 @@ exports.commands = [{ readOnly: true }, { name: "goToPreviousError", + description: "Go to previous error", bindKey: bindKey("Alt-Shift-E", "Shift-F4"), exec: function(editor) { config.loadModule("./ext/error_marker", function(module) { @@ -12332,6 +11705,7 @@ exports.commands = [{ readOnly: true }, { name: "toggleFoldWidget", + description: "Toggle fold widget", bindKey: bindKey("F2", "F2"), exec: function(editor) { editor.session.toggleFoldWidget(); }, multiSelectAction: "forEach", @@ -12339,6 +11713,7 @@ exports.commands = [{ readOnly: true }, { name: "toggleParentFoldWidget", + description: "Toggle parent fold widget", bindKey: bindKey("Alt-F2", "Alt-F2"), exec: function(editor) { editor.session.toggleFoldWidget(true); }, multiSelectAction: "forEach", @@ -12351,6 +11726,13 @@ exports.commands = [{ exec: function(editor) { editor.session.foldAll(); }, scrollIntoView: "center", readOnly: true +}, { + name: "foldAllComments", + description: "Fold all comments", + bindKey: bindKey(null, "Ctrl-Command-Option-0"), + exec: function(editor) { editor.session.foldAllComments(); }, + scrollIntoView: "center", + readOnly: true }, { name: "foldOther", description: "Fold other", @@ -12959,6 +12341,13 @@ exports.commands = [{ exec: function(editor) { editor.toLowerCase(); }, multiSelectAction: "forEach", scrollIntoView: "cursor" +}, { + name: "autoindent", + description: "Auto Indent", + bindKey: bindKey(null, null), + exec: function(editor) { editor.autoIndent(); }, + multiSelectAction: "forEachLine", + scrollIntoView: "animate" }, { name: "expandtoline", description: "Expand to line", @@ -13051,6 +12440,7 @@ exports.commands = [{ scrollIntoView: "none" }, { name: "addLineAfter", + description: "Add new line after the current line", exec: function(editor) { editor.selection.clearSelection(); editor.navigateLineEnd(); @@ -13060,6 +12450,7 @@ exports.commands = [{ scrollIntoView: "cursor" }, { name: "addLineBefore", + description: "Add new line before the current line", exec: function(editor) { editor.selection.clearSelection(); var cursor = editor.getCursorPosition(); @@ -13087,6 +12478,17 @@ exports.commands = [{ readOnly: true }]; +for (var i = 1; i < 9; i++) { + exports.commands.push({ + name: "foldToLevel" + i, + description: "Fold To Level " + i, + level: i, + exec: function(editor) { editor.session.foldToLevel(this.level); }, + scrollIntoView: "center", + readOnly: true + }); +} + }); define("ace/editor",["require","exports","module","ace/lib/fixoldbrowsers","ace/lib/oop","ace/lib/dom","ace/lib/lang","ace/lib/useragent","ace/keyboard/textinput","ace/mouse/mouse_handler","ace/mouse/fold_handler","ace/keyboard/keybinding","ace/edit_session","ace/search","ace/range","ace/lib/event_emitter","ace/commands/command_manager","ace/commands/default_commands","ace/config","ace/token_iterator","ace/clipboard"], function(require, exports, module) { @@ -13113,6 +12515,7 @@ var TokenIterator = require("./token_iterator").TokenIterator; var clipboard = require("./clipboard"); var Editor = function(renderer, session, options) { + this.$toDestroy = []; var container = renderer.getContainerElement(); this.container = container; this.renderer = renderer; @@ -13205,8 +12608,8 @@ Editor.$uid = 0; }; this.endOperation = function(e) { - if (this.curOp) { - if (e && e.returnValue === false) + if (this.curOp && this.session) { + if (e && e.returnValue === false || !this.session) return (this.curOp = null); if (e == true && this.curOp.command && this.curOp.command.name == "mouse") return; @@ -13517,25 +12920,33 @@ Editor.$uid = 0; return; } - if (token.type.indexOf("tag-open") != -1) { + if (token.type.indexOf("tag-open") !== -1) { token = iterator.stepForward(); if (!token) return; } var tag = token.value; + var currentTag = token.value; var depth = 0; var prevToken = iterator.stepBackward(); - if (prevToken.value == '<'){ + if (prevToken.value === '<'){ do { prevToken = token; token = iterator.stepForward(); - - if (token && token.value === tag && token.type.indexOf('tag-name') !== -1) { - if (prevToken.value === '<'){ - depth++; - } else if (prevToken.value === '') { // self closing tag depth--; } } @@ -13545,12 +12956,32 @@ Editor.$uid = 0; do { token = prevToken; prevToken = iterator.stepBackward(); - - if (token && token.value === tag && token.type.indexOf('tag-name') !== -1) { - if (prevToken.value === '<') { - depth++; - } else if (prevToken.value === '') { // self closing tag + var stepCount = 0; + var tmpToken = prevToken; + while (tmpToken) { + if (tmpToken.type.indexOf('tag-name') !== -1 && tmpToken.value === tag) { + depth--; + break; + } else if (tmpToken.value === '<') { + break; + } + tmpToken = iterator.stepBackward(); + stepCount++; + } + for (var i = 0; i < stepCount; i++) { + iterator.stepForward(); + } } } } while (prevToken && depth <= 0); @@ -13609,6 +13040,9 @@ Editor.$uid = 0; this.$cursorChange = function() { this.renderer.updateCursor(); + this.$highlightBrackets(); + this.$highlightTags(); + this.$updateHighlightActiveLine(); }; this.onDocumentChange = function(delta) { var wrap = this.session.$useWrapMode; @@ -13617,7 +13051,6 @@ Editor.$uid = 0; this._signal("change", delta); this.$cursorChange(); - this.$updateHighlightActiveLine(); }; this.onTokenizerUpdate = function(e) { @@ -13635,10 +13068,6 @@ Editor.$uid = 0; }; this.onCursorChange = function() { this.$cursorChange(); - - this.$highlightBrackets(); - this.$highlightTags(); - this.$updateHighlightActiveLine(); this._signal("changeSelection"); }; @@ -13777,7 +13206,7 @@ Editor.$uid = 0; } var e = {text: text}; this._signal("copy", e); - clipboard.lineMode = copyLine ? e.text : ""; + clipboard.lineMode = copyLine ? e.text : false; return e.text; }; this.onCopy = function() { @@ -13797,7 +13226,7 @@ Editor.$uid = 0; this._signal("paste", e); var text = e.text; - var lineMode = text == clipboard.lineMode; + var lineMode = text === clipboard.lineMode; var session = this.session; if (!this.inMultiSelectMode || this.inVirtualSelectionMode) { if (lineMode) @@ -13889,16 +13318,62 @@ Editor.$uid = 0; transform.selection[3])); } } + if (this.$enableAutoIndent) { + if (session.getDocument().isNewLine(text)) { + var lineIndent = mode.getNextLineIndent(lineState, line.slice(0, cursor.column), session.getTabString()); - if (session.getDocument().isNewLine(text)) { - var lineIndent = mode.getNextLineIndent(lineState, line.slice(0, cursor.column), session.getTabString()); - - session.insert({row: cursor.row+1, column: 0}, lineIndent); + session.insert({row: cursor.row+1, column: 0}, lineIndent); + } + if (shouldOutdent) + mode.autoOutdent(lineState, session, cursor.row); } - if (shouldOutdent) - mode.autoOutdent(lineState, session, cursor.row); }; + this.autoIndent = function () { + var session = this.session; + var mode = session.getMode(); + + var startRow, endRow; + if (this.selection.isEmpty()) { + startRow = 0; + endRow = session.doc.getLength() - 1; + } else { + var selectedRange = this.getSelectionRange(); + + startRow = selectedRange.start.row; + endRow = selectedRange.end.row; + } + + var prevLineState = ""; + var prevLine = ""; + var lineIndent = ""; + var line, currIndent, range; + var tab = session.getTabString(); + + for (var row = startRow; row <= endRow; row++) { + if (row > 0) { + prevLineState = session.getState(row - 1); + prevLine = session.getLine(row - 1); + lineIndent = mode.getNextLineIndent(prevLineState, prevLine, tab); + } + + line = session.getLine(row); + currIndent = mode.$getIndent(line); + if (lineIndent !== currIndent) { + if (currIndent.length > 0) { + range = new Range(row, 0, row, currIndent.length); + session.remove(range); + } + if (lineIndent.length > 0) { + session.insert({row: row, column: 0}, lineIndent); + } + } + + mode.autoOutdent(prevLineState, session, row); + } + }; + + this.onTextInput = function(text, composition) { if (!composition) return this.keyBinding.onTextInput(text); @@ -13917,6 +13392,10 @@ Editor.$uid = 0; var r = this.selection.getRange(); r.start.column -= composition.extendLeft; r.end.column += composition.extendRight; + if (r.start.column < 0) { + r.start.row--; + r.start.column += this.session.getLine(r.start.row).length + 1; + } this.selection.setRange(r); if (!text && !r.isEmpty()) this.remove(); @@ -14922,13 +14401,21 @@ Editor.$uid = 0; this.renderer.scrollCursorIntoView(null, 0.5); }; this.destroy = function() { + if (this.$toDestroy) { + this.$toDestroy.forEach(function(el) { + el.destroy(); + }); + this.$toDestroy = null; + } + if (this.$mouseHandler) + this.$mouseHandler.destroy(); this.renderer.destroy(); this._signal("destroy", this); if (this.session) this.session.destroy(); if (this._$emitInputEvent) this._$emitInputEvent.cancel(); - this.session = null; + this.removeAllListeners(); }; this.setAutoScrollEditorIntoView = function(enable) { if (!enable) @@ -15044,6 +14531,7 @@ config.defineOptions(Editor.prototype, "editor", { }, behavioursEnabled: {initialValue: true}, wrapBehavioursEnabled: {initialValue: true}, + enableAutoIndent: {initialValue: true}, autoScrollEditorIntoView: { set: function(val) {this.setAutoScrollEditorIntoView(val);} }, @@ -15088,7 +14576,7 @@ config.defineOptions(Editor.prototype, "editor", { set: function(message) { if (!this.$updatePlaceholder) { this.$updatePlaceholder = function() { - var value = this.renderer.$composition || this.getValue(); + var value = this.session && (this.renderer.$composition || this.getValue()); if (value && this.renderer.placeholderNode) { this.renderer.off("afterRender", this.$updatePlaceholder); dom.removeCssClass(this.container, "ace_hasPlaceholder"); @@ -15102,6 +14590,8 @@ config.defineOptions(Editor.prototype, "editor", { el.textContent = this.$placeholder || ""; this.renderer.placeholderNode = el; this.renderer.content.appendChild(this.renderer.placeholderNode); + } else if (!value && this.renderer.placeholderNode) { + this.renderer.placeholderNode.textContent = this.$placeholder || ""; } }.bind(this); this.on("input", this.$updatePlaceholder); @@ -15276,25 +14766,6 @@ var UndoManager = function() { if (to == null) to = this.$rev + 1; }; - - this.validateDeltaBoundaries = function(deltaSet, docLength, invertAction) { - if (!deltaSet) { - return false; - } - return deltaSet.every(function(delta) { - var action = delta.action; - if (invertAction && delta.action === "insert") action = "remove"; - if (invertAction && delta.action === "remove") action = "insert"; - switch(action) { - case "insert": - return delta.start.row <= docLength; - case "remove": - return delta.start.row < docLength && delta.end.row < docLength; - default: - return true; - } - }); - }; this.undo = function(session, dontSelect) { this.lastDeltas = null; var stack = this.$undoStack; @@ -15312,7 +14783,7 @@ var UndoManager = function() { var deltaSet = stack.pop(); var undoSelectionRange = null; - if (this.validateDeltaBoundaries(deltaSet, session.getLength(), true)) { + if (deltaSet) { undoSelectionRange = session.undoChanges(deltaSet, dontSelect); this.$redoStack.push(deltaSet); this.$syncRev(); @@ -15340,7 +14811,7 @@ var UndoManager = function() { var deltaSet = this.$redoStack.pop(); var redoSelectionRange = null; - if (this.validateDeltaBoundaries(deltaSet, session.getLength(), false)) { + if (deltaSet) { redoSelectionRange = session.redoChanges(deltaSet, dontSelect); this.$undoStack.push(deltaSet); this.$syncRev(); @@ -15840,7 +15311,7 @@ var Gutter = function(parentEl) { this.setSession = function(session) { if (this.session) - this.session.removeEventListener("change", this.$updateAnnotations); + this.session.off("change", this.$updateAnnotations); this.session = session; if (session) session.on("change", this.$updateAnnotations); @@ -16529,11 +16000,21 @@ var Text = function(parentEl) { }; this.showInvisibles = false; + this.showSpaces = false; + this.showTabs = false; + this.showEOL = false; this.setShowInvisibles = function(showInvisibles) { if (this.showInvisibles == showInvisibles) return false; this.showInvisibles = showInvisibles; + if (typeof showInvisibles == "string") { + this.showSpaces = /tab/i.test(showInvisibles); + this.showTabs = /space/i.test(showInvisibles); + this.showEOL = /eol/i.test(showInvisibles); + } else { + this.showSpaces = this.showTabs = this.showEOL = showInvisibles; + } this.$computeTabString(); return true; }; @@ -16555,7 +16036,7 @@ var Text = function(parentEl) { this.tabSize = tabSize; var tabStr = this.$tabStrings = [0]; for (var i = 1; i < tabSize + 1; i++) { - if (this.showInvisibles) { + if (this.showTabs) { var span = this.dom.createElement("span"); span.className = "ace_invisible ace_invisible_tab"; span.textContent = lang.stringRepeat(this.TAB_CHAR, i); @@ -16567,18 +16048,15 @@ var Text = function(parentEl) { if (this.displayIndentGuides) { this.$indentGuideRe = /\s\S| \t|\t |\s$/; var className = "ace_indent-guide"; - var spaceClass = ""; - var tabClass = ""; - if (this.showInvisibles) { - className += " ace_invisible"; - spaceClass = " ace_invisible_space"; - tabClass = " ace_invisible_tab"; - var spaceContent = lang.stringRepeat(this.SPACE_CHAR, this.tabSize); - var tabContent = lang.stringRepeat(this.TAB_CHAR, this.tabSize); - } else { - var spaceContent = lang.stringRepeat(" ", this.tabSize); - var tabContent = spaceContent; - } + var spaceClass = this.showSpaces ? " ace_invisible ace_invisible_space" : ""; + var spaceContent = this.showSpaces + ? lang.stringRepeat(this.SPACE_CHAR, this.tabSize) + : lang.stringRepeat(" ", this.tabSize); + + var tabClass = this.showTabs ? " ace_invisible ace_invisible_tab" : ""; + var tabContent = this.showTabs + ? lang.stringRepeat(this.TAB_CHAR, this.tabSize) + : spaceContent; var span = this.dom.createElement("span"); span.className = className + spaceClass; @@ -16771,7 +16249,7 @@ var Text = function(parentEl) { var cjkSpace = m[4]; var cjk = m[5]; - if (!self.showInvisibles && simpleSpace) + if (!self.showSpaces && simpleSpace) continue; var before = i != m.index ? value.slice(i, m.index) : ""; @@ -16787,7 +16265,7 @@ var Text = function(parentEl) { valueFragment.appendChild(self.$tabStrings[tabSize].cloneNode(true)); screenColumn += tabSize - 1; } else if (simpleSpace) { - if (self.showInvisibles) { + if (self.showSpaces) { var span = this.dom.createElement("span"); span.className = "ace_invisible ace_invisible_space"; span.textContent = lang.stringRepeat(self.SPACE_CHAR, simpleSpace.length); @@ -16805,8 +16283,8 @@ var Text = function(parentEl) { var span = this.dom.createElement("span"); span.style.width = (self.config.characterWidth * 2) + "px"; - span.className = self.showInvisibles ? "ace_cjk ace_invisible ace_invisible_space" : "ace_cjk"; - span.textContent = self.showInvisibles ? self.SPACE_CHAR : cjkSpace; + span.className = self.showSpaces ? "ace_cjk ace_invisible ace_invisible_space" : "ace_cjk"; + span.textContent = self.showSpaces ? self.SPACE_CHAR : cjkSpace; valueFragment.appendChild(span); } else if (cjk) { screenColumn += 1; @@ -16975,7 +16453,7 @@ var Text = function(parentEl) { parent.appendChild(lastLineEl); } - if (this.showInvisibles && lastLineEl) { + if (this.showEOL && lastLineEl) { if (foldLine) row = foldLine.end.row; @@ -17092,12 +16570,16 @@ var Cursor = function(parentEl) { for (var i = cursors.length; i--; ) cursors[i].style.animationDuration = this.blinkInterval + "ms"; + this.$isAnimating = true; setTimeout(function() { - dom.addCssClass(this.element, "ace_animate-blinking"); + if (this.$isAnimating) { + dom.addCssClass(this.element, "ace_animate-blinking"); + } }.bind(this)); }; this.$stopCssAnimation = function() { + this.$isAnimating = false; dom.removeCssClass(this.element, "ace_animate-blinking"); }; @@ -17168,6 +16650,7 @@ var Cursor = function(parentEl) { this.$stopCssAnimation(); if (this.smoothBlinking) { + this.$isSmoothBlinking = false; dom.removeCssClass(this.element, "ace_smooth-blinking"); } @@ -17179,8 +16662,11 @@ var Cursor = function(parentEl) { } if (this.smoothBlinking) { - setTimeout(function(){ - dom.addCssClass(this.element, "ace_smooth-blinking"); + this.$isSmoothBlinking = true; + setTimeout(function() { + if (this.$isSmoothBlinking) { + dom.addCssClass(this.element, "ace_smooth-blinking"); + } }.bind(this)); } @@ -17506,7 +16992,7 @@ var FontMetrics = exports.FontMetrics = function(parentEl) { this.el.appendChild(this.$measureNode); parentEl.appendChild(this.el); - this.$measureNode.innerHTML = lang.stringRepeat("X", CHAR_COUNT); + this.$measureNode.textContent = lang.stringRepeat("X", CHAR_COUNT); this.$characterSize = {width: 0, height: 0}; @@ -17555,11 +17041,7 @@ var FontMetrics = exports.FontMetrics = function(parentEl) { this.$addObserver = function() { var self = this; this.$observer = new window.ResizeObserver(function(e) { - var rect = e[0].contentRect; - self.checkForSizeChanges({ - height: rect.height, - width: rect.width / CHAR_COUNT - }); + self.checkForSizeChanges(); }); this.$observer.observe(this.$measureNode); }; @@ -17595,7 +17077,7 @@ var FontMetrics = exports.FontMetrics = function(parentEl) { }; this.$measureCharWidth = function(ch) { - this.$main.innerHTML = lang.stringRepeat(ch, CHAR_COUNT); + this.$main.textContent = lang.stringRepeat(ch, CHAR_COUNT); var rect = this.$main.getBoundingClientRect(); return rect.width / CHAR_COUNT; }; @@ -17618,7 +17100,7 @@ var FontMetrics = exports.FontMetrics = function(parentEl) { this.$getZoom = function getZoom(element) { - if (!element) return 1; + if (!element || !element.parentElement) return 1; return (window.getComputedStyle(element).zoom || 1) * getZoom(element.parentElement); }; this.$initTransformMeasureNodes = function() { @@ -17712,6 +17194,7 @@ var editorCss = "\ .ace_editor {\ position: relative;\ overflow: hidden;\ +padding: 0;\ font: 12px/normal 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace;\ direction: ltr;\ text-align: left;\ @@ -18184,7 +17667,7 @@ margin: 0 10px;\ var useragent = require("./lib/useragent"); var HIDE_TEXTAREA = useragent.isIE; -dom.importCssString(editorCss, "ace_editor.css"); +dom.importCssString(editorCss, "ace_editor.css", false); var VirtualRenderer = function(container, theme) { var _self = this; @@ -18195,6 +17678,8 @@ var VirtualRenderer = function(container, theme) { if (dom.HI_DPI) dom.addCssClass(this.container, "ace_hidpi"); this.setTheme(theme); + if (config.get("useStrictCSP") == null) + config.set("useStrictCSP", false); this.$gutter = dom.createElement("div"); this.$gutter.className = "ace_gutter"; @@ -18227,11 +17712,11 @@ var VirtualRenderer = function(container, theme) { this.scrollBar = this.scrollBarV = new VScrollBar(this.container, this); this.scrollBarH = new HScrollBar(this.container, this); - this.scrollBarV.addEventListener("scroll", function(e) { + this.scrollBarV.on("scroll", function(e) { if (!_self.$scrollAnimation) _self.session.setScrollTop(e.data - _self.scrollMargin.top); }); - this.scrollBarH.addEventListener("scroll", function(e) { + this.scrollBarH.on("scroll", function(e) { if (!_self.$scrollAnimation) _self.session.setScrollLeft(e.data - _self.scrollMargin.left); }); @@ -18246,7 +17731,7 @@ var VirtualRenderer = function(container, theme) { this.$fontMetrics = new FontMetrics(this.container); this.$textLayer.$setFontMetrics(this.$fontMetrics); - this.$textLayer.addEventListener("changeCharacterSize", function(e) { + this.$textLayer.on("changeCharacterSize", function(e) { _self.updateCharacterSize(); _self.onResize(true, _self.gutterWidth, _self.$size.width, _self.$size.height); _self._signal("changeCharacterSize", e); @@ -18446,7 +17931,7 @@ var VirtualRenderer = function(container, theme) { if (this.resizing) this.resizing = 0; - this.scrollBarV.scrollLeft = this.scrollBarV.scrollTop = null; + this.scrollBarH.scrollLeft = this.scrollBarV.scrollTop = null; }; this.$updateCachedSize = function(force, gutterWidth, width, height) { @@ -19183,6 +18668,8 @@ var VirtualRenderer = function(container, theme) { _self.session.setScrollTop(steps.shift()); _self.session.$scrollTop = toValue; this.$timer = setInterval(function() { + if (!_self.session) + return clearInterval(_self.$timer); if (steps.length) { _self.session.setScrollTop(steps.shift()); _self.session.$scrollTop = toValue; @@ -19210,7 +18697,7 @@ var VirtualRenderer = function(container, theme) { }; this.scrollTo = function(x, y) { this.session.setScrollTop(y); - this.session.setScrollLeft(y); + this.session.setScrollLeft(x); }; this.scrollBy = function(deltaX, deltaY) { deltaY && this.session.setScrollTop(this.session.getScrollTop() + deltaY); @@ -19293,7 +18780,8 @@ var VirtualRenderer = function(container, theme) { if (!composition.cssText) { composition.cssText = this.textarea.style.cssText; } - composition.useTextareaForIME = this.$useTextareaForIME; + if (composition.useTextareaForIME == undefined) + composition.useTextareaForIME = this.$useTextareaForIME; if (this.$useTextareaForIME) { dom.addCssClass(this.textarea, "ace_composition"); @@ -19319,6 +18807,8 @@ var VirtualRenderer = function(container, theme) { dom.removeCssClass(this.textarea, "ace_composition"); this.textarea.style.cssText = this.$composition.cssText; + var cursor = this.session.selection.cursor; + this.removeExtraToken(cursor.row, cursor.column); this.$composition = null; this.$cursorLayer.element.style.display = ""; }; @@ -19347,6 +18837,10 @@ var VirtualRenderer = function(container, theme) { } this.updateLines(row, row); }; + + this.removeExtraToken = function(row, column) { + this.updateLines(row, row); + }; this.setTheme = function(theme, cb) { var _self = this; this.$themeId = theme; @@ -19417,6 +18911,8 @@ var VirtualRenderer = function(container, theme) { this.freeze(); this.$fontMetrics.destroy(); this.$cursorLayer.destroy(); + this.removeAllListeners(); + this.container.textContent = ""; }; }).call(VirtualRenderer.prototype); @@ -19943,8 +19439,8 @@ var PlaceHolder = function(session, length, pos, others, mainClass, othersClass) this.detach = function() { this.session.removeMarker(this.pos && this.pos.markerId); this.hideOtherMarkers(); - this.doc.removeEventListener("change", this.$onUpdate); - this.session.selection.removeEventListener("changeCursor", this.$onCursorChange); + this.doc.off("change", this.$onUpdate); + this.session.selection.off("changeCursor", this.$onCursorChange); this.session.setUndoSelect(true); this.session = null; }; @@ -20998,10 +20494,10 @@ function addAltCursorListeners(editor){ } else if (altCursor) { reset(); } - }); + }, editor); - event.addListener(el, "keyup", reset); - event.addListener(el, "blur", reset); + event.addListener(el, "keyup", reset, editor); + event.addListener(el, "blur", reset, editor); function reset(e) { if (altCursor) { editor.renderer.setMouseCursor(""); @@ -21259,7 +20755,7 @@ background: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZ exports.$id = "ace/theme/textmate"; var dom = require("../lib/dom"); -dom.importCssString(exports.cssText, exports.cssClass); +dom.importCssString(exports.cssText, exports.cssClass, false); }); define("ace/line_widgets",["require","exports","module","ace/lib/dom"], function(require, exports, module) { @@ -21806,7 +21302,7 @@ dom.importCssString("\ border-left-color: transparent!important;\ top: -5px;\ }\ -", ""); +", "error_marker.css", false); }); diff --git a/htdocs/includes/ace/src/ext-beautify.js b/htdocs/includes/ace/src/ext-beautify.js index a39074326a2..674cf671131 100644 --- a/htdocs/includes/ace/src/ext-beautify.js +++ b/htdocs/includes/ace/src/ext-beautify.js @@ -40,16 +40,28 @@ exports.beautify = function(session) { var inBlock = false; var levels = {0: 0}; var parents = []; + var caseBody = false; var trimNext = function() { if (nextToken && nextToken.value && nextToken.type !== 'string.regexp') - nextToken.value = nextToken.value.trim(); + nextToken.value = nextToken.value.replace(/^\s*/, ""); }; - + var trimLine = function() { - code = code.replace(/ +$/, ""); - }; + var end = code.length - 1; + while (true) { + if (end == 0) + break; + if (code[end] !== " ") + break; + + end = end - 1; + } + + code = code.slice(0, end + 1); + }; + var trimCode = function() { code = code.trimRight(); breakBefore = false; @@ -201,8 +213,11 @@ exports.beautify = function(session) { trimLine(); if(value === "/>") spaceBefore = true; + } else if (token.type === "keyword" && value.match(/^(case|default)$/)) { + if (caseBody) + unindent = 1; } - if (breakBefore && !(token.type.match(/^(comment)$/) && !value.substr(0, 1).match(/^[/#]$/)) && !(token.type.match(/^(string)$/) && !value.substr(0, 1).match(/^['"]$/))) { + if (breakBefore && !(token.type.match(/^(comment)$/) && !value.substr(0, 1).match(/^[/#]$/)) && !(token.type.match(/^(string)$/) && !value.substr(0, 1).match(/^['"@]$/))) { indent = lastIndent; @@ -229,16 +244,16 @@ exports.beautify = function(session) { code += tabString; } - if (token.type === "keyword" && value.match(/^(case|default)$/)) { - parents[depth] = value; - depth++; - } - - - if (token.type === "keyword" && value.match(/^(break)$/)) { + if (caseBody === false) { + parents[depth] = value; + depth++; + caseBody = true; + } + } else if (token.type === "keyword" && value.match(/^(break)$/)) { if(parents[depth-1] && parents[depth-1].match(/^(case|default)$/)) { depth--; + caseBody = false; } } if (token.type === "paren.lparen") { @@ -264,6 +279,9 @@ exports.beautify = function(session) { } } } + + if (token.type == "text") + value = value.replace(/\s+$/, " "); if (spaceBefore && !breakBefore) { trimLine(); if (code.substr(-1) !== "\n") diff --git a/htdocs/includes/ace/src/ext-code_lens.js b/htdocs/includes/ace/src/ext-code_lens.js index 4b7e4340f22..ee4653d8595 100644 --- a/htdocs/includes/ace/src/ext-code_lens.js +++ b/htdocs/includes/ace/src/ext-code_lens.js @@ -1,6 +1,7 @@ -define("ace/ext/code_lens",["require","exports","module","ace/line_widgets","ace/lib/lang","ace/lib/dom","ace/editor","ace/config"], function(require, exports, module) { +define("ace/ext/code_lens",["require","exports","module","ace/line_widgets","ace/lib/event","ace/lib/lang","ace/lib/dom","ace/editor","ace/config"], function(require, exports, module) { "use strict"; var LineWidgets = require("../line_widgets").LineWidgets; +var event = require("../lib/event"); var lang = require("../lib/lang"); var dom = require("../lib/dom"); @@ -120,12 +121,14 @@ exports.setLenses = function(session, lenses) { function attachToEditor(editor) { editor.codeLensProviders = []; editor.renderer.on("afterRender", renderWidgets); - editor.$codeLensClickHandler = function(e) { - var command = e.target.lensCommand; - if (command) - editor.execCommand(command.id, command.arguments); - }; - editor.container.addEventListener("click", editor.$codeLensClickHandler); + if (!editor.$codeLensClickHandler) { + editor.$codeLensClickHandler = function(e) { + var command = e.target.lensCommand; + if (command) + editor.execCommand(command.id, command.arguments); + }; + event.addListener(editor.container, "click", editor.$codeLensClickHandler, editor); + } editor.$updateLenses = function() { var session = editor.session; if (!session) return; @@ -138,8 +141,9 @@ function attachToEditor(editor) { var providersToWaitNum = editor.codeLensProviders.length; var lenses = []; editor.codeLensProviders.forEach(function(provider) { - provider.provideCodeLenses(session, function(currentLenses) { - currentLenses.forEach(function(lens) { + provider.provideCodeLenses(session, function(err, payload) { + if (err) return; + payload.forEach(function(lens) { lenses.push(lens); }); providersToWaitNum--; @@ -222,7 +226,7 @@ dom.importCssString("\ .ace_dark > .ace_codeLens > a:hover {\ color: #4e94ce;\ }\ -", ""); +", "codelense.css", false); }); (function() { window.require(["ace/ext/code_lens"], function(m) { diff --git a/htdocs/includes/ace/src/ext-emmet.js b/htdocs/includes/ace/src/ext-emmet.js index 3cb3818d1b5..68fc0ff1367 100644 --- a/htdocs/includes/ace/src/ext-emmet.js +++ b/htdocs/includes/ace/src/ext-emmet.js @@ -1,5 +1,6 @@ -define("ace/snippets",["require","exports","module","ace/lib/oop","ace/lib/event_emitter","ace/lib/lang","ace/range","ace/range_list","ace/keyboard/hash_handler","ace/tokenizer","ace/clipboard","ace/lib/dom","ace/editor"], function(require, exports, module) { +define("ace/snippets",["require","exports","module","ace/lib/dom","ace/lib/oop","ace/lib/event_emitter","ace/lib/lang","ace/range","ace/range_list","ace/keyboard/hash_handler","ace/tokenizer","ace/clipboard","ace/editor"], function(require, exports, module) { "use strict"; +var dom = require("./lib/dom"); var oop = require("./lib/oop"); var EventEmitter = require("./lib/event_emitter").EventEmitter; var lang = require("./lib/lang"); @@ -144,7 +145,9 @@ var SnippetManager = function() { {regex: "\\|" + escape("\\|") + "*\\|", onMatch: function(val, state, stack) { var choices = val.slice(1, -1).replace(/\\[,|\\]|,/g, function(operator) { return operator.length == 2 ? operator[1] : "\x00"; - }).split("\x00"); + }).split("\x00").map(function(value){ + return {value: value}; + }); stack[0].choices = choices; return [choices[0]]; }, next: "start"}, @@ -615,6 +618,12 @@ var SnippetManager = function() { } snippetMap[scope].push(s); + if (s.prefix) + s.tabTrigger = s.prefix; + + if (!s.content && s.body) + s.content = Array.isArray(s.body) ? s.body.join("\n") : s.body; + if (s.tabTrigger && !s.trigger) { if (!s.guard && /^\w/.test(s.tabTrigger)) s.guard = "\\b"; @@ -631,10 +640,13 @@ var SnippetManager = function() { s.endTriggerRe = new RegExp(s.endTrigger); } - if (snippets && snippets.content) - addSnippet(snippets); - else if (Array.isArray(snippets)) + if (Array.isArray(snippets)) { snippets.forEach(addSnippet); + } else { + Object.keys(snippets).forEach(function(key) { + addSnippet(snippets[key]); + }); + } this._signal("registerSnippets", {scope: scope}); }; @@ -684,7 +696,7 @@ var SnippetManager = function() { snippet.tabTrigger = val.match(/^\S*/)[0]; if (!snippet.name) snippet.name = val; - } else { + } else if (key) { snippet[key] = val; } } @@ -833,18 +845,17 @@ var TabstopManager = function(editor) { this.selectedTabstop = ts; var range = ts.firstNonLinked || ts; + if (ts.choices) range.cursor = range.start; if (!this.editor.inVirtualSelectionMode) { var sel = this.editor.multiSelect; - sel.toSingleRange(range.clone()); + sel.toSingleRange(range); for (var i = 0; i < ts.length; i++) { if (ts.hasLinkedRanges && ts[i].linked) continue; sel.addRange(ts[i].clone(), true); } - if (sel.ranges[0]) - sel.addRange(sel.ranges[0].clone()); } else { - this.editor.selection.setRange(range); + this.editor.selection.fromOrientedRange(range); } this.editor.keyBinding.addKeyboardHandler(this.keyboardHandler); @@ -971,14 +982,14 @@ var moveRelative = function(point, start) { }; -require("./lib/dom").importCssString("\ +dom.importCssString("\ .ace_snippet-marker {\ -moz-box-sizing: border-box;\ box-sizing: border-box;\ background: rgba(194, 193, 208, 0.09);\ border: 1px dotted rgba(211, 208, 235, 0.62);\ position: absolute;\ -}"); +}", "snippets.css", false); exports.snippetManager = new SnippetManager(); diff --git a/htdocs/includes/ace/src/ext-hardwrap.js b/htdocs/includes/ace/src/ext-hardwrap.js new file mode 100644 index 00000000000..a2037b9113e --- /dev/null +++ b/htdocs/includes/ace/src/ext-hardwrap.js @@ -0,0 +1,125 @@ +define("ace/ext/hardwrap",["require","exports","module","ace/range","ace/editor","ace/config"], function(require, exports, module) { +"use strict"; + +var Range = require("../range").Range; + +function hardWrap(editor, options) { + var max = options.column || editor.getOption("printMarginColumn"); + var allowMerge = options.allowMerge != false; + + var row = Math.min(options.startRow, options.endRow); + var endRow = Math.max(options.startRow, options.endRow); + + var session = editor.session; + + while (row <= endRow) { + var line = session.getLine(row); + if (line.length > max) { + var space = findSpace(line, max, 5); + if (space) { + var indentation = /^\s*/.exec(line)[0]; + session.replace(new Range(row,space.start,row,space.end), "\n" + indentation); + } + endRow++; + } else if (allowMerge && /\S/.test(line) && row != endRow) { + var nextLine = session.getLine(row + 1); + if (nextLine && /\S/.test(nextLine)) { + var trimmedLine = line.replace(/\s+$/, ""); + var trimmedNextLine = nextLine.replace(/^\s+/, ""); + var mergedLine = trimmedLine + " " + trimmedNextLine; + + var space = findSpace(mergedLine, max, 5); + if (space && space.start > trimmedLine.length || mergedLine.length < max) { + var replaceRange = new Range(row,trimmedLine.length,row + 1,nextLine.length - trimmedNextLine.length); + session.replace(replaceRange, " "); + row--; + endRow--; + } else if (trimmedLine.length < line.length) { + session.remove(new Range(row, trimmedLine.length, row, line.length)); + } + } + } + row++; + } + + function findSpace(line, max, min) { + if (line.length < max) + return; + var before = line.slice(0, max); + var after = line.slice(max); + var spaceAfter = /^(?:(\s+)|(\S+)(\s+))/.exec(after); + var spaceBefore = /(?:(\s+)|(\s+)(\S+))$/.exec(before); + var start = 0; + var end = 0; + if (spaceBefore && !spaceBefore[2]) { + start = max - spaceBefore[1].length; + end = max; + } + if (spaceAfter && !spaceAfter[2]) { + if (!start) + start = max; + end = max + spaceAfter[1].length; + } + if (start) { + return { + start: start, + end: end + }; + } + if (spaceBefore && spaceBefore[2] && spaceBefore.index > min) { + return { + start: spaceBefore.index, + end: spaceBefore.index + spaceBefore[2].length + }; + } + if (spaceAfter && spaceAfter[2]) { + start = max + spaceAfter[2].length; + return { + start: start, + end: start + spaceAfter[3].length + }; + } + } + +} + +function wrapAfterInput(e) { + if (e.command.name == "insertstring" && /\S/.test(e.args)) { + var editor = e.editor; + var cursor = editor.selection.cursor; + if (cursor.column <= editor.renderer.$printMarginColumn) return; + var lastDelta = editor.session.$undoManager.$lastDelta; + + hardWrap(editor, { + startRow: cursor.row, endRow: cursor.row, + allowMerge: false + }); + if (lastDelta != editor.session.$undoManager.$lastDelta) + editor.session.markUndoGroup(); + } +} + +var Editor = require("../editor").Editor; +require("../config").defineOptions(Editor.prototype, "editor", { + hardWrap: { + set: function(val) { + if (val) { + this.commands.on("afterExec", wrapAfterInput); + } else { + this.commands.off("afterExec", wrapAfterInput); + } + }, + value: false + } +}); + +exports.hardWrap = hardWrap; + +}); (function() { + window.require(["ace/ext/hardwrap"], function(m) { + if (typeof module == "object" && typeof exports == "object" && module) { + module.exports = m; + } + }); + })(); + \ No newline at end of file diff --git a/htdocs/includes/ace/src/ext-keybinding_menu.js b/htdocs/includes/ace/src/ext-keybinding_menu.js index 4f980686e68..b9ad46ee724 100644 --- a/htdocs/includes/ace/src/ext-keybinding_menu.js +++ b/htdocs/includes/ace/src/ext-keybinding_menu.js @@ -61,7 +61,7 @@ margin: 0px;\ .ace_optionsMenuEntry button:hover{\ background: #f0f0f0;\ }"; -dom.importCssString(cssText); +dom.importCssString(cssText, "settings_menu.css", false); module.exports.overlayPage = function overlayPage(editor, contentElement, callback) { var closer = document.createElement('div'); diff --git a/htdocs/includes/ace/src/ext-language_tools.js b/htdocs/includes/ace/src/ext-language_tools.js index 7e6967e0d7a..b561c3bc87d 100644 --- a/htdocs/includes/ace/src/ext-language_tools.js +++ b/htdocs/includes/ace/src/ext-language_tools.js @@ -1,5 +1,6 @@ -define("ace/snippets",["require","exports","module","ace/lib/oop","ace/lib/event_emitter","ace/lib/lang","ace/range","ace/range_list","ace/keyboard/hash_handler","ace/tokenizer","ace/clipboard","ace/lib/dom","ace/editor"], function(require, exports, module) { +define("ace/snippets",["require","exports","module","ace/lib/dom","ace/lib/oop","ace/lib/event_emitter","ace/lib/lang","ace/range","ace/range_list","ace/keyboard/hash_handler","ace/tokenizer","ace/clipboard","ace/editor"], function(require, exports, module) { "use strict"; +var dom = require("./lib/dom"); var oop = require("./lib/oop"); var EventEmitter = require("./lib/event_emitter").EventEmitter; var lang = require("./lib/lang"); @@ -144,7 +145,9 @@ var SnippetManager = function() { {regex: "\\|" + escape("\\|") + "*\\|", onMatch: function(val, state, stack) { var choices = val.slice(1, -1).replace(/\\[,|\\]|,/g, function(operator) { return operator.length == 2 ? operator[1] : "\x00"; - }).split("\x00"); + }).split("\x00").map(function(value){ + return {value: value}; + }); stack[0].choices = choices; return [choices[0]]; }, next: "start"}, @@ -615,6 +618,12 @@ var SnippetManager = function() { } snippetMap[scope].push(s); + if (s.prefix) + s.tabTrigger = s.prefix; + + if (!s.content && s.body) + s.content = Array.isArray(s.body) ? s.body.join("\n") : s.body; + if (s.tabTrigger && !s.trigger) { if (!s.guard && /^\w/.test(s.tabTrigger)) s.guard = "\\b"; @@ -631,10 +640,13 @@ var SnippetManager = function() { s.endTriggerRe = new RegExp(s.endTrigger); } - if (snippets && snippets.content) - addSnippet(snippets); - else if (Array.isArray(snippets)) + if (Array.isArray(snippets)) { snippets.forEach(addSnippet); + } else { + Object.keys(snippets).forEach(function(key) { + addSnippet(snippets[key]); + }); + } this._signal("registerSnippets", {scope: scope}); }; @@ -684,7 +696,7 @@ var SnippetManager = function() { snippet.tabTrigger = val.match(/^\S*/)[0]; if (!snippet.name) snippet.name = val; - } else { + } else if (key) { snippet[key] = val; } } @@ -833,18 +845,17 @@ var TabstopManager = function(editor) { this.selectedTabstop = ts; var range = ts.firstNonLinked || ts; + if (ts.choices) range.cursor = range.start; if (!this.editor.inVirtualSelectionMode) { var sel = this.editor.multiSelect; - sel.toSingleRange(range.clone()); + sel.toSingleRange(range); for (var i = 0; i < ts.length; i++) { if (ts.hasLinkedRanges && ts[i].linked) continue; sel.addRange(ts[i].clone(), true); } - if (sel.ranges[0]) - sel.addRange(sel.ranges[0].clone()); } else { - this.editor.selection.setRange(range); + this.editor.selection.fromOrientedRange(range); } this.editor.keyBinding.addKeyboardHandler(this.keyboardHandler); @@ -971,14 +982,14 @@ var moveRelative = function(point, start) { }; -require("./lib/dom").importCssString("\ +dom.importCssString("\ .ace_snippet-marker {\ -moz-box-sizing: border-box;\ box-sizing: border-box;\ background: rgba(194, 193, 208, 0.09);\ border: 1px dotted rgba(211, 208, 235, 0.62);\ position: absolute;\ -}"); +}", "snippets.css", false); exports.snippetManager = new SnippetManager(); @@ -1330,7 +1341,7 @@ dom.importCssString("\ line-height: 1.4;\ background: #25282c;\ color: #c1c1c1;\ -}", "autocompletion.css"); +}", "autocompletion.css", false); exports.AcePopup = AcePopup; exports.$singleLineEditor = $singleLineEditor; @@ -1476,6 +1487,7 @@ var Autocomplete = function() { } else if (keepPopupPosition && !prefix) { this.detach(); } + this.changeTimer.cancel(); }; this.detach = function() { @@ -1538,13 +1550,15 @@ var Autocomplete = function() { if (!data) return false; + var completions = this.completions; + this.editor.startOperation({command: {name: "insertMatch"}}); if (data.completer && data.completer.insertMatch) { data.completer.insertMatch(this.editor, data); } else { - if (this.completions.filterText) { + if (completions.filterText) { var ranges = this.editor.selection.getAllRanges(); for (var i = 0, range; range = ranges[i]; i++) { - range.start.column -= this.completions.filterText.length; + range.start.column -= completions.filterText.length; this.editor.session.remove(range); } } @@ -1553,7 +1567,9 @@ var Autocomplete = function() { else this.editor.execCommand("insertstring", data.value || data); } - this.detach(); + if (this.completions == completions) + this.detach(); + this.editor.endOperation(); }; @@ -1649,19 +1665,14 @@ var Autocomplete = function() { return this.openPopup(this.editor, "", keepPopupPosition); } var _id = this.gatherCompletionsId; - this.gatherCompletions(this.editor, function(err, results) { - var detachIfFinished = function() { - if (!results.finished) return; - return this.detach(); - }.bind(this); + var detachIfFinished = function(results) { + if (!results.finished) return; + return this.detach(); + }.bind(this); + var processResults = function(results) { var prefix = results.prefix; - var matches = results && results.matches; - - if (!matches || !matches.length) - return detachIfFinished(); - if (prefix.indexOf(results.prefix) !== 0 || _id != this.gatherCompletionsId) - return; + var matches = results.matches; this.completions = new FilteredList(matches); @@ -1671,14 +1682,39 @@ var Autocomplete = function() { this.completions.setFilter(prefix); var filtered = this.completions.filtered; if (!filtered.length) - return detachIfFinished(); + return detachIfFinished(results); if (filtered.length == 1 && filtered[0].value == prefix && !filtered[0].snippet) - return detachIfFinished(); + return detachIfFinished(results); if (this.autoInsert && filtered.length == 1 && results.finished) return this.insertMatch(filtered[0]); this.openPopup(this.editor, prefix, keepPopupPosition); + }.bind(this); + + var isImmediate = true; + var immediateResults = null; + this.gatherCompletions(this.editor, function(err, results) { + var prefix = results.prefix; + var matches = results && results.matches; + + if (!matches || !matches.length) + return detachIfFinished(results); + if (prefix.indexOf(results.prefix) !== 0 || _id != this.gatherCompletionsId) + return; + if (isImmediate) { + immediateResults = results; + return; + } + + processResults(results); }.bind(this)); + + isImmediate = false; + if (immediateResults) { + var results = immediateResults; + immediateResults = null; + processResults(results); + } }; this.cancelContextMenu = function() { @@ -2032,31 +2068,33 @@ var onChangeMode = function(e, editor) { }; var loadSnippetsForMode = function(mode) { - var id = mode.$id; + if (typeof mode == "string") + mode = config.$modes[mode]; + if (!mode) + return; if (!snippetManager.files) snippetManager.files = {}; - loadSnippetFile(id); + + loadSnippetFile(mode.$id, mode.snippetFileId); if (mode.modes) mode.modes.forEach(loadSnippetsForMode); }; -var loadSnippetFile = function(id) { - if (!id || snippetManager.files[id]) +var loadSnippetFile = function(id, snippetFilePath) { + if (!snippetFilePath || !id || snippetManager.files[id]) return; - var snippetFilePath = id.replace("mode", "snippets"); snippetManager.files[id] = {}; config.loadModule(snippetFilePath, function(m) { - if (m) { - snippetManager.files[id] = m; - if (!m.snippets && m.snippetText) - m.snippets = snippetManager.parseSnippetFile(m.snippetText); - snippetManager.register(m.snippets || [], m.scope); - if (m.includeScopes) { - snippetManager.snippetMap[m.scope].includeScopes = m.includeScopes; - m.includeScopes.forEach(function(x) { - loadSnippetFile("ace/mode/" + x); - }); - } + if (!m) return; + snippetManager.files[id] = m; + if (!m.snippets && m.snippetText) + m.snippets = snippetManager.parseSnippetFile(m.snippetText); + snippetManager.register(m.snippets || [], m.scope); + if (m.includeScopes) { + snippetManager.snippetMap[m.scope].includeScopes = m.includeScopes; + m.includeScopes.forEach(function(x) { + loadSnippetsForMode("ace/mode/" + x); + }); } }); }; diff --git a/htdocs/includes/ace/src/ext-modelist.js b/htdocs/includes/ace/src/ext-modelist.js index 8b771ffeb99..064e398db75 100644 --- a/htdocs/includes/ace/src/ext-modelist.js +++ b/htdocs/includes/ace/src/ext-modelist.js @@ -39,22 +39,23 @@ var supportedModes = { ABC: ["abc"], ActionScript:["as"], ADA: ["ada|adb"], + Alda: ["alda"], Apache_Conf: ["^htaccess|^htgroups|^htpasswd|^conf|htaccess|htgroups|htpasswd"], - AsciiDoc: ["asciidoc|adoc"], - ASL: ["dsl|asl"], - Assembly_x86:["asm|a"], - AutoHotKey: ["ahk"], Apex: ["apex|cls|trigger|tgr"], AQL: ["aql"], + AsciiDoc: ["asciidoc|adoc"], + ASL: ["dsl|asl|asl.json"], + Assembly_x86:["asm|a"], + AutoHotKey: ["ahk"], BatchFile: ["bat|cmd"], C_Cpp: ["cpp|c|cc|cxx|h|hh|hpp|ino"], C9Search: ["c9search_results"], - Crystal: ["cr"], Cirru: ["cirru|cr"], Clojure: ["clj|cljs"], Cobol: ["CBL|COB"], coffee: ["coffee|cf|cson|^Cakefile"], ColdFusion: ["cfm"], + Crystal: ["cr"], CSharp: ["cs"], Csound_Document: ["csd"], Csound_Orchestra: ["orc"], @@ -101,8 +102,8 @@ var supportedModes = { Jade: ["jade|pug"], Java: ["java"], JavaScript: ["js|jsm|jsx"], - JSON5: ["json5"], JSON: ["json"], + JSON5: ["json5"], JSONiq: ["jq"], JSP: ["jsp"], JSSM: ["jssm|jssm_state"], @@ -110,6 +111,7 @@ var supportedModes = { Julia: ["jl"], Kotlin: ["kt|kts"], LaTeX: ["tex|latex|ltx|bib"], + Latte: ["latte"], LESS: ["less"], Liquid: ["liquid"], Lisp: ["lisp"], @@ -124,32 +126,36 @@ var supportedModes = { Mask: ["mask"], MATLAB: ["matlab"], Maze: ["mz"], + MediaWiki: ["wiki|mediawiki"], MEL: ["mel"], + MIPS: ["s|asm"], MIXAL: ["mixal"], MUSHCode: ["mc|mush"], MySQL: ["mysql"], Nginx: ["nginx|conf"], - Nix: ["nix"], Nim: ["nim"], + Nix: ["nix"], NSIS: ["nsi|nsh"], Nunjucks: ["nunjucks|nunjs|nj|njk"], ObjectiveC: ["m|mm"], OCaml: ["ml|mli"], Pascal: ["pas|p"], Perl: ["pl|pm"], - Perl6: ["p6|pl6|pm6"], pgSQL: ["pgsql"], - PHP_Laravel_blade: ["blade.php"], PHP: ["php|inc|phtml|shtml|php3|php4|php5|phps|phpt|aw|ctp|module"], - Puppet: ["epp|pp"], + PHP_Laravel_blade: ["blade.php"], Pig: ["pig"], Powershell: ["ps1"], Praat: ["praat|praatscript|psc|proc"], + Prisma: ["prisma"], Prolog: ["plg|prolog"], Properties: ["properties"], Protobuf: ["proto"], + Puppet: ["epp|pp"], Python: ["py"], + QML: ["qml"], R: ["r"], + Raku: ["raku|rakumod|rakutest|p6|pl6|pm6"], Razor: ["cshtml|asp"], RDoc: ["Rd"], Red: ["red|reds"], @@ -161,11 +167,13 @@ var supportedModes = { SCAD: ["scad"], Scala: ["scala|sbt"], Scheme: ["scm|sm|rkt|oak|scheme"], + Scrypt: ["scrypt"], SCSS: ["scss"], SH: ["sh|bash|^.bashrc"], SJS: ["sjs"], Slim: ["slim|skim"], Smarty: ["smarty|tpl"], + Smithy: ["smithy"], snippets: ["snippets"], Soy_Template:["soy"], Space: ["space"], @@ -181,7 +189,7 @@ var supportedModes = { Textile: ["textile"], Toml: ["toml"], TSX: ["tsx"], - Twig: ["latte|twig|swig"], + Twig: ["twig|swig"], Typescript: ["ts|typescript|str"], Vala: ["vala"], VBScript: ["vbs|vb"], @@ -213,6 +221,7 @@ var nameOverrides = { Perl6: "Perl 6", AutoHotKey: "AutoHotkey / AutoIt" }; + var modesByName = {}; for (var name in supportedModes) { var data = supportedModes[name]; diff --git a/htdocs/includes/ace/src/ext-options.js b/htdocs/includes/ace/src/ext-options.js index d1d01cefa05..d200e821a3e 100644 --- a/htdocs/includes/ace/src/ext-options.js +++ b/htdocs/includes/ace/src/ext-options.js @@ -61,7 +61,7 @@ margin: 0px;\ .ace_optionsMenuEntry button:hover{\ background: #f0f0f0;\ }"; -dom.importCssString(cssText); +dom.importCssString(cssText, "settings_menu.css", false); module.exports.overlayPage = function overlayPage(editor, contentElement, callback) { var closer = document.createElement('div'); @@ -160,22 +160,23 @@ var supportedModes = { ABC: ["abc"], ActionScript:["as"], ADA: ["ada|adb"], + Alda: ["alda"], Apache_Conf: ["^htaccess|^htgroups|^htpasswd|^conf|htaccess|htgroups|htpasswd"], - AsciiDoc: ["asciidoc|adoc"], - ASL: ["dsl|asl"], - Assembly_x86:["asm|a"], - AutoHotKey: ["ahk"], Apex: ["apex|cls|trigger|tgr"], AQL: ["aql"], + AsciiDoc: ["asciidoc|adoc"], + ASL: ["dsl|asl|asl.json"], + Assembly_x86:["asm|a"], + AutoHotKey: ["ahk"], BatchFile: ["bat|cmd"], C_Cpp: ["cpp|c|cc|cxx|h|hh|hpp|ino"], C9Search: ["c9search_results"], - Crystal: ["cr"], Cirru: ["cirru|cr"], Clojure: ["clj|cljs"], Cobol: ["CBL|COB"], coffee: ["coffee|cf|cson|^Cakefile"], ColdFusion: ["cfm"], + Crystal: ["cr"], CSharp: ["cs"], Csound_Document: ["csd"], Csound_Orchestra: ["orc"], @@ -222,8 +223,8 @@ var supportedModes = { Jade: ["jade|pug"], Java: ["java"], JavaScript: ["js|jsm|jsx"], - JSON5: ["json5"], JSON: ["json"], + JSON5: ["json5"], JSONiq: ["jq"], JSP: ["jsp"], JSSM: ["jssm|jssm_state"], @@ -231,6 +232,7 @@ var supportedModes = { Julia: ["jl"], Kotlin: ["kt|kts"], LaTeX: ["tex|latex|ltx|bib"], + Latte: ["latte"], LESS: ["less"], Liquid: ["liquid"], Lisp: ["lisp"], @@ -245,32 +247,36 @@ var supportedModes = { Mask: ["mask"], MATLAB: ["matlab"], Maze: ["mz"], + MediaWiki: ["wiki|mediawiki"], MEL: ["mel"], + MIPS: ["s|asm"], MIXAL: ["mixal"], MUSHCode: ["mc|mush"], MySQL: ["mysql"], Nginx: ["nginx|conf"], - Nix: ["nix"], Nim: ["nim"], + Nix: ["nix"], NSIS: ["nsi|nsh"], Nunjucks: ["nunjucks|nunjs|nj|njk"], ObjectiveC: ["m|mm"], OCaml: ["ml|mli"], Pascal: ["pas|p"], Perl: ["pl|pm"], - Perl6: ["p6|pl6|pm6"], pgSQL: ["pgsql"], - PHP_Laravel_blade: ["blade.php"], PHP: ["php|inc|phtml|shtml|php3|php4|php5|phps|phpt|aw|ctp|module"], - Puppet: ["epp|pp"], + PHP_Laravel_blade: ["blade.php"], Pig: ["pig"], Powershell: ["ps1"], Praat: ["praat|praatscript|psc|proc"], + Prisma: ["prisma"], Prolog: ["plg|prolog"], Properties: ["properties"], Protobuf: ["proto"], + Puppet: ["epp|pp"], Python: ["py"], + QML: ["qml"], R: ["r"], + Raku: ["raku|rakumod|rakutest|p6|pl6|pm6"], Razor: ["cshtml|asp"], RDoc: ["Rd"], Red: ["red|reds"], @@ -282,11 +288,13 @@ var supportedModes = { SCAD: ["scad"], Scala: ["scala|sbt"], Scheme: ["scm|sm|rkt|oak|scheme"], + Scrypt: ["scrypt"], SCSS: ["scss"], SH: ["sh|bash|^.bashrc"], SJS: ["sjs"], Slim: ["slim|skim"], Smarty: ["smarty|tpl"], + Smithy: ["smithy"], snippets: ["snippets"], Soy_Template:["soy"], Space: ["space"], @@ -302,7 +310,7 @@ var supportedModes = { Textile: ["textile"], Toml: ["toml"], TSX: ["tsx"], - Twig: ["latte|twig|swig"], + Twig: ["twig|swig"], Typescript: ["ts|typescript|str"], Vala: ["vala"], VBScript: ["vbs|vb"], @@ -334,6 +342,7 @@ var nameOverrides = { Perl6: "Perl 6", AutoHotKey: "AutoHotkey / AutoIt" }; + var modesByName = {}; for (var name in supportedModes) { var data = supportedModes[name]; @@ -367,7 +376,7 @@ var themeData = [ ["Solarized Light"], ["TextMate" ], ["Tomorrow" ], - ["XCode" ], + ["Xcode" ], ["Kuroir"], ["KatzenMilch"], ["SQL Server" ,"sqlserver" , "light"], @@ -384,6 +393,8 @@ var themeData = [ ["Merbivore Soft" ,"merbivore_soft" , "dark"], ["Mono Industrial" ,"mono_industrial" , "dark"], ["Monokai" ,"monokai" , "dark"], + ["Nord Dark" ,"nord_dark" , "dark"], + ["One Dark" ,"one_dark" , "dark"], ["Pastel on dark" ,"pastel_on_dark" , "dark"], ["Solarized Dark" ,"solarized_dark" , "dark"], ["Terminal" ,"terminal" , "dark"], @@ -498,6 +509,7 @@ var optionGroups = { "Soft Tabs": [{ path: "useSoftTabs" }, { + ariaLabel: "Tab Size", path: "tabSize", type: "number", values: [2, 3, 4, 8, 16] @@ -519,6 +531,12 @@ var optionGroups = { "Enable Behaviours": { path: "behavioursEnabled" }, + "Wrap with quotes": { + path: "wrapBehavioursEnabled" + }, + "Enable Auto Indent": { + path: "enableAutoIndent" + }, "Full Line Selection": { type: "checkbox", values: "text|line", @@ -533,11 +551,12 @@ var optionGroups = { "Show Indent Guides": { path: "displayIndentGuides" }, - "Persistent Scrollbar": [{ + "Persistent HScrollbar": { path: "hScrollBarAlwaysVisible" - }, { + }, + "Persistent VScrollbar": { path: "vScrollBarAlwaysVisible" - }], + }, "Animate scrolling": { path: "animatedScroll" }, @@ -556,6 +575,7 @@ var optionGroups = { "Show Print Margin": [{ path: "showPrintMargin" }, { + ariaLabel: "Print Margin", type: "number", path: "printMarginColumn" }], @@ -618,10 +638,10 @@ var OptionPanel = function(editor, element) { this.render = function() { this.container.innerHTML = ""; - buildDom(["table", {id: "controls"}, + buildDom(["table", {role: "presentation", id: "controls"}, this.renderOptionGroup(optionGroups.Main), ["tr", null, ["td", {colspan: 2}, - ["table", {id: "more-controls"}, + ["table", {role: "presentation", id: "more-controls"}, this.renderOptionGroup(optionGroups.More) ] ]], @@ -664,17 +684,20 @@ var OptionPanel = function(editor, element) { } if (option.type == "buttonBar") { - control = ["div", option.items.map(function(item) { + control = ["div", {role: "group", "aria-labelledby": option.path + "-label"}, option.items.map(function(item) { return ["button", { value: item.value, ace_selected_button: value == item.value, + 'aria-pressed': value == item.value, onclick: function() { self.setOption(option, item.value); var nodes = this.parentNode.querySelectorAll("[ace_selected_button]"); for (var i = 0; i < nodes.length; i++) { nodes[i].removeAttribute("ace_selected_button"); + nodes[i].setAttribute("aria-pressed", false); } this.setAttribute("ace_selected_button", true); + this.setAttribute("aria-pressed", true); } }, item.desc || item.caption || item.name]; })]; @@ -682,6 +705,11 @@ var OptionPanel = function(editor, element) { control = ["input", {type: "number", value: value || option.defaultValue, style:"width:3em", oninput: function() { self.setOption(option, parseInt(this.value)); }}]; + if (option.ariaLabel) { + control[1]["aria-label"] = option.ariaLabel; + } else { + control[1].id = key; + } if (option.defaults) { control = [control, option.defaults.map(function(item) { return ["button", {onclick: function() { @@ -725,11 +753,13 @@ var OptionPanel = function(editor, element) { this.renderOption = function(key, option) { if (option.path && !option.onchange && !this.editor.$options[option.path]) return; - this.options[option.path] = option; - var safeKey = "-" + option.path; + var path = Array.isArray(option) ? option[0].path : option.path; + this.options[path] = option; + var safeKey = "-" + path; + var safeId = path + "-label"; var control = this.renderOptionControl(safeKey, option); return ["tr", {class: "ace_optionsMenuEntry"}, ["td", - ["label", {for: safeKey}, key] + ["label", {for: safeKey, id: safeId}, key] ], ["td", control]]; }; diff --git a/htdocs/includes/ace/src/ext-prompt.js b/htdocs/includes/ace/src/ext-prompt.js index bcc99f70806..34d7e36d513 100644 --- a/htdocs/includes/ace/src/ext-prompt.js +++ b/htdocs/includes/ace/src/ext-prompt.js @@ -364,7 +364,7 @@ dom.importCssString("\ line-height: 1.4;\ background: #25282c;\ color: #c1c1c1;\ -}", "autocompletion.css"); +}", "autocompletion.css", false); exports.AcePopup = AcePopup; exports.$singleLineEditor = $singleLineEditor; @@ -430,8 +430,9 @@ exports.getCompletionPrefix = function (editor) { }); -define("ace/snippets",["require","exports","module","ace/lib/oop","ace/lib/event_emitter","ace/lib/lang","ace/range","ace/range_list","ace/keyboard/hash_handler","ace/tokenizer","ace/clipboard","ace/lib/dom","ace/editor"], function(require, exports, module) { +define("ace/snippets",["require","exports","module","ace/lib/dom","ace/lib/oop","ace/lib/event_emitter","ace/lib/lang","ace/range","ace/range_list","ace/keyboard/hash_handler","ace/tokenizer","ace/clipboard","ace/editor"], function(require, exports, module) { "use strict"; +var dom = require("./lib/dom"); var oop = require("./lib/oop"); var EventEmitter = require("./lib/event_emitter").EventEmitter; var lang = require("./lib/lang"); @@ -576,7 +577,9 @@ var SnippetManager = function() { {regex: "\\|" + escape("\\|") + "*\\|", onMatch: function(val, state, stack) { var choices = val.slice(1, -1).replace(/\\[,|\\]|,/g, function(operator) { return operator.length == 2 ? operator[1] : "\x00"; - }).split("\x00"); + }).split("\x00").map(function(value){ + return {value: value}; + }); stack[0].choices = choices; return [choices[0]]; }, next: "start"}, @@ -1047,6 +1050,12 @@ var SnippetManager = function() { } snippetMap[scope].push(s); + if (s.prefix) + s.tabTrigger = s.prefix; + + if (!s.content && s.body) + s.content = Array.isArray(s.body) ? s.body.join("\n") : s.body; + if (s.tabTrigger && !s.trigger) { if (!s.guard && /^\w/.test(s.tabTrigger)) s.guard = "\\b"; @@ -1063,10 +1072,13 @@ var SnippetManager = function() { s.endTriggerRe = new RegExp(s.endTrigger); } - if (snippets && snippets.content) - addSnippet(snippets); - else if (Array.isArray(snippets)) + if (Array.isArray(snippets)) { snippets.forEach(addSnippet); + } else { + Object.keys(snippets).forEach(function(key) { + addSnippet(snippets[key]); + }); + } this._signal("registerSnippets", {scope: scope}); }; @@ -1116,7 +1128,7 @@ var SnippetManager = function() { snippet.tabTrigger = val.match(/^\S*/)[0]; if (!snippet.name) snippet.name = val; - } else { + } else if (key) { snippet[key] = val; } } @@ -1265,18 +1277,17 @@ var TabstopManager = function(editor) { this.selectedTabstop = ts; var range = ts.firstNonLinked || ts; + if (ts.choices) range.cursor = range.start; if (!this.editor.inVirtualSelectionMode) { var sel = this.editor.multiSelect; - sel.toSingleRange(range.clone()); + sel.toSingleRange(range); for (var i = 0; i < ts.length; i++) { if (ts.hasLinkedRanges && ts[i].linked) continue; sel.addRange(ts[i].clone(), true); } - if (sel.ranges[0]) - sel.addRange(sel.ranges[0].clone()); } else { - this.editor.selection.setRange(range); + this.editor.selection.fromOrientedRange(range); } this.editor.keyBinding.addKeyboardHandler(this.keyboardHandler); @@ -1403,14 +1414,14 @@ var moveRelative = function(point, start) { }; -require("./lib/dom").importCssString("\ +dom.importCssString("\ .ace_snippet-marker {\ -moz-box-sizing: border-box;\ box-sizing: border-box;\ background: rgba(194, 193, 208, 0.09);\ border: 1px dotted rgba(211, 208, 235, 0.62);\ position: absolute;\ -}"); +}", "snippets.css", false); exports.snippetManager = new SnippetManager(); @@ -1507,6 +1518,7 @@ var Autocomplete = function() { } else if (keepPopupPosition && !prefix) { this.detach(); } + this.changeTimer.cancel(); }; this.detach = function() { @@ -1569,13 +1581,15 @@ var Autocomplete = function() { if (!data) return false; + var completions = this.completions; + this.editor.startOperation({command: {name: "insertMatch"}}); if (data.completer && data.completer.insertMatch) { data.completer.insertMatch(this.editor, data); } else { - if (this.completions.filterText) { + if (completions.filterText) { var ranges = this.editor.selection.getAllRanges(); for (var i = 0, range; range = ranges[i]; i++) { - range.start.column -= this.completions.filterText.length; + range.start.column -= completions.filterText.length; this.editor.session.remove(range); } } @@ -1584,7 +1598,9 @@ var Autocomplete = function() { else this.editor.execCommand("insertstring", data.value || data); } - this.detach(); + if (this.completions == completions) + this.detach(); + this.editor.endOperation(); }; @@ -1680,19 +1696,14 @@ var Autocomplete = function() { return this.openPopup(this.editor, "", keepPopupPosition); } var _id = this.gatherCompletionsId; - this.gatherCompletions(this.editor, function(err, results) { - var detachIfFinished = function() { - if (!results.finished) return; - return this.detach(); - }.bind(this); + var detachIfFinished = function(results) { + if (!results.finished) return; + return this.detach(); + }.bind(this); + var processResults = function(results) { var prefix = results.prefix; - var matches = results && results.matches; - - if (!matches || !matches.length) - return detachIfFinished(); - if (prefix.indexOf(results.prefix) !== 0 || _id != this.gatherCompletionsId) - return; + var matches = results.matches; this.completions = new FilteredList(matches); @@ -1702,14 +1713,39 @@ var Autocomplete = function() { this.completions.setFilter(prefix); var filtered = this.completions.filtered; if (!filtered.length) - return detachIfFinished(); + return detachIfFinished(results); if (filtered.length == 1 && filtered[0].value == prefix && !filtered[0].snippet) - return detachIfFinished(); + return detachIfFinished(results); if (this.autoInsert && filtered.length == 1 && results.finished) return this.insertMatch(filtered[0]); this.openPopup(this.editor, prefix, keepPopupPosition); + }.bind(this); + + var isImmediate = true; + var immediateResults = null; + this.gatherCompletions(this.editor, function(err, results) { + var prefix = results.prefix; + var matches = results && results.matches; + + if (!matches || !matches.length) + return detachIfFinished(results); + if (prefix.indexOf(results.prefix) !== 0 || _id != this.gatherCompletionsId) + return; + if (isImmediate) { + immediateResults = results; + return; + } + + processResults(results); }.bind(this)); + + isImmediate = false; + if (immediateResults) { + var results = immediateResults; + immediateResults = null; + processResults(results); + } }; this.cancelContextMenu = function() { @@ -1998,7 +2034,7 @@ margin: 0px;\ .ace_optionsMenuEntry button:hover{\ background: #f0f0f0;\ }"; -dom.importCssString(cssText); +dom.importCssString(cssText, "settings_menu.css", false); module.exports.overlayPage = function overlayPage(editor, contentElement, callback) { var closer = document.createElement('div'); @@ -2097,22 +2133,23 @@ var supportedModes = { ABC: ["abc"], ActionScript:["as"], ADA: ["ada|adb"], + Alda: ["alda"], Apache_Conf: ["^htaccess|^htgroups|^htpasswd|^conf|htaccess|htgroups|htpasswd"], - AsciiDoc: ["asciidoc|adoc"], - ASL: ["dsl|asl"], - Assembly_x86:["asm|a"], - AutoHotKey: ["ahk"], Apex: ["apex|cls|trigger|tgr"], AQL: ["aql"], + AsciiDoc: ["asciidoc|adoc"], + ASL: ["dsl|asl|asl.json"], + Assembly_x86:["asm|a"], + AutoHotKey: ["ahk"], BatchFile: ["bat|cmd"], C_Cpp: ["cpp|c|cc|cxx|h|hh|hpp|ino"], C9Search: ["c9search_results"], - Crystal: ["cr"], Cirru: ["cirru|cr"], Clojure: ["clj|cljs"], Cobol: ["CBL|COB"], coffee: ["coffee|cf|cson|^Cakefile"], ColdFusion: ["cfm"], + Crystal: ["cr"], CSharp: ["cs"], Csound_Document: ["csd"], Csound_Orchestra: ["orc"], @@ -2159,8 +2196,8 @@ var supportedModes = { Jade: ["jade|pug"], Java: ["java"], JavaScript: ["js|jsm|jsx"], - JSON5: ["json5"], JSON: ["json"], + JSON5: ["json5"], JSONiq: ["jq"], JSP: ["jsp"], JSSM: ["jssm|jssm_state"], @@ -2168,6 +2205,7 @@ var supportedModes = { Julia: ["jl"], Kotlin: ["kt|kts"], LaTeX: ["tex|latex|ltx|bib"], + Latte: ["latte"], LESS: ["less"], Liquid: ["liquid"], Lisp: ["lisp"], @@ -2182,32 +2220,36 @@ var supportedModes = { Mask: ["mask"], MATLAB: ["matlab"], Maze: ["mz"], + MediaWiki: ["wiki|mediawiki"], MEL: ["mel"], + MIPS: ["s|asm"], MIXAL: ["mixal"], MUSHCode: ["mc|mush"], MySQL: ["mysql"], Nginx: ["nginx|conf"], - Nix: ["nix"], Nim: ["nim"], + Nix: ["nix"], NSIS: ["nsi|nsh"], Nunjucks: ["nunjucks|nunjs|nj|njk"], ObjectiveC: ["m|mm"], OCaml: ["ml|mli"], Pascal: ["pas|p"], Perl: ["pl|pm"], - Perl6: ["p6|pl6|pm6"], pgSQL: ["pgsql"], - PHP_Laravel_blade: ["blade.php"], PHP: ["php|inc|phtml|shtml|php3|php4|php5|phps|phpt|aw|ctp|module"], - Puppet: ["epp|pp"], + PHP_Laravel_blade: ["blade.php"], Pig: ["pig"], Powershell: ["ps1"], Praat: ["praat|praatscript|psc|proc"], + Prisma: ["prisma"], Prolog: ["plg|prolog"], Properties: ["properties"], Protobuf: ["proto"], + Puppet: ["epp|pp"], Python: ["py"], + QML: ["qml"], R: ["r"], + Raku: ["raku|rakumod|rakutest|p6|pl6|pm6"], Razor: ["cshtml|asp"], RDoc: ["Rd"], Red: ["red|reds"], @@ -2219,11 +2261,13 @@ var supportedModes = { SCAD: ["scad"], Scala: ["scala|sbt"], Scheme: ["scm|sm|rkt|oak|scheme"], + Scrypt: ["scrypt"], SCSS: ["scss"], SH: ["sh|bash|^.bashrc"], SJS: ["sjs"], Slim: ["slim|skim"], Smarty: ["smarty|tpl"], + Smithy: ["smithy"], snippets: ["snippets"], Soy_Template:["soy"], Space: ["space"], @@ -2239,7 +2283,7 @@ var supportedModes = { Textile: ["textile"], Toml: ["toml"], TSX: ["tsx"], - Twig: ["latte|twig|swig"], + Twig: ["twig|swig"], Typescript: ["ts|typescript|str"], Vala: ["vala"], VBScript: ["vbs|vb"], @@ -2271,6 +2315,7 @@ var nameOverrides = { Perl6: "Perl 6", AutoHotKey: "AutoHotkey / AutoIt" }; + var modesByName = {}; for (var name in supportedModes) { var data = supportedModes[name]; @@ -2586,13 +2631,10 @@ prompt.commands = function(editor, callback) { var platform = handler.platform; var cbn = handler.byName; for (var i in cbn) { - var key; - if (cbn[i].bindKey && cbn[i].bindKey[platform] !== null) { - key = cbn[i].bindKey["win"]; - } else { - key = ""; + var key = cbn[i].bindKey; + if (typeof key !== "string") { + key = key && key[platform] || ""; } - var commands = cbn[i]; var description = commands.description || normalizeName(commands.name); if (!Array.isArray(commands)) @@ -2749,7 +2791,7 @@ dom.importCssString(".ace_prompt_container {\ background: white;\ border-radius: 2px;\ box-shadow: 0px 2px 3px 0px #555;\ -}"); +}", "promtp.css", false); exports.prompt = prompt; diff --git a/htdocs/includes/ace/src/ext-searchbox.js b/htdocs/includes/ace/src/ext-searchbox.js index 4fbe7933506..8be7e8c12e7 100644 --- a/htdocs/includes/ace/src/ext-searchbox.js +++ b/htdocs/includes/ace/src/ext-searchbox.js @@ -160,7 +160,7 @@ var keyUtil = require("../lib/keys"); var MAX_COUNT = 999; -dom.importCssString(searchboxCss, "ace_searchbox"); +dom.importCssString(searchboxCss, "ace_searchbox", false); var SearchBox = function(editor, range, showReplaceForm) { var div = dom.createElement("div"); diff --git a/htdocs/includes/ace/src/ext-settings_menu.js b/htdocs/includes/ace/src/ext-settings_menu.js index ebfa4108519..1d88965b63b 100644 --- a/htdocs/includes/ace/src/ext-settings_menu.js +++ b/htdocs/includes/ace/src/ext-settings_menu.js @@ -61,7 +61,7 @@ margin: 0px;\ .ace_optionsMenuEntry button:hover{\ background: #f0f0f0;\ }"; -dom.importCssString(cssText); +dom.importCssString(cssText, "settings_menu.css", false); module.exports.overlayPage = function overlayPage(editor, contentElement, callback) { var closer = document.createElement('div'); @@ -160,22 +160,23 @@ var supportedModes = { ABC: ["abc"], ActionScript:["as"], ADA: ["ada|adb"], + Alda: ["alda"], Apache_Conf: ["^htaccess|^htgroups|^htpasswd|^conf|htaccess|htgroups|htpasswd"], - AsciiDoc: ["asciidoc|adoc"], - ASL: ["dsl|asl"], - Assembly_x86:["asm|a"], - AutoHotKey: ["ahk"], Apex: ["apex|cls|trigger|tgr"], AQL: ["aql"], + AsciiDoc: ["asciidoc|adoc"], + ASL: ["dsl|asl|asl.json"], + Assembly_x86:["asm|a"], + AutoHotKey: ["ahk"], BatchFile: ["bat|cmd"], C_Cpp: ["cpp|c|cc|cxx|h|hh|hpp|ino"], C9Search: ["c9search_results"], - Crystal: ["cr"], Cirru: ["cirru|cr"], Clojure: ["clj|cljs"], Cobol: ["CBL|COB"], coffee: ["coffee|cf|cson|^Cakefile"], ColdFusion: ["cfm"], + Crystal: ["cr"], CSharp: ["cs"], Csound_Document: ["csd"], Csound_Orchestra: ["orc"], @@ -222,8 +223,8 @@ var supportedModes = { Jade: ["jade|pug"], Java: ["java"], JavaScript: ["js|jsm|jsx"], - JSON5: ["json5"], JSON: ["json"], + JSON5: ["json5"], JSONiq: ["jq"], JSP: ["jsp"], JSSM: ["jssm|jssm_state"], @@ -231,6 +232,7 @@ var supportedModes = { Julia: ["jl"], Kotlin: ["kt|kts"], LaTeX: ["tex|latex|ltx|bib"], + Latte: ["latte"], LESS: ["less"], Liquid: ["liquid"], Lisp: ["lisp"], @@ -245,32 +247,36 @@ var supportedModes = { Mask: ["mask"], MATLAB: ["matlab"], Maze: ["mz"], + MediaWiki: ["wiki|mediawiki"], MEL: ["mel"], + MIPS: ["s|asm"], MIXAL: ["mixal"], MUSHCode: ["mc|mush"], MySQL: ["mysql"], Nginx: ["nginx|conf"], - Nix: ["nix"], Nim: ["nim"], + Nix: ["nix"], NSIS: ["nsi|nsh"], Nunjucks: ["nunjucks|nunjs|nj|njk"], ObjectiveC: ["m|mm"], OCaml: ["ml|mli"], Pascal: ["pas|p"], Perl: ["pl|pm"], - Perl6: ["p6|pl6|pm6"], pgSQL: ["pgsql"], - PHP_Laravel_blade: ["blade.php"], PHP: ["php|inc|phtml|shtml|php3|php4|php5|phps|phpt|aw|ctp|module"], - Puppet: ["epp|pp"], + PHP_Laravel_blade: ["blade.php"], Pig: ["pig"], Powershell: ["ps1"], Praat: ["praat|praatscript|psc|proc"], + Prisma: ["prisma"], Prolog: ["plg|prolog"], Properties: ["properties"], Protobuf: ["proto"], + Puppet: ["epp|pp"], Python: ["py"], + QML: ["qml"], R: ["r"], + Raku: ["raku|rakumod|rakutest|p6|pl6|pm6"], Razor: ["cshtml|asp"], RDoc: ["Rd"], Red: ["red|reds"], @@ -282,11 +288,13 @@ var supportedModes = { SCAD: ["scad"], Scala: ["scala|sbt"], Scheme: ["scm|sm|rkt|oak|scheme"], + Scrypt: ["scrypt"], SCSS: ["scss"], SH: ["sh|bash|^.bashrc"], SJS: ["sjs"], Slim: ["slim|skim"], Smarty: ["smarty|tpl"], + Smithy: ["smithy"], snippets: ["snippets"], Soy_Template:["soy"], Space: ["space"], @@ -302,7 +310,7 @@ var supportedModes = { Textile: ["textile"], Toml: ["toml"], TSX: ["tsx"], - Twig: ["latte|twig|swig"], + Twig: ["twig|swig"], Typescript: ["ts|typescript|str"], Vala: ["vala"], VBScript: ["vbs|vb"], @@ -334,6 +342,7 @@ var nameOverrides = { Perl6: "Perl 6", AutoHotKey: "AutoHotkey / AutoIt" }; + var modesByName = {}; for (var name in supportedModes) { var data = supportedModes[name]; @@ -367,7 +376,7 @@ var themeData = [ ["Solarized Light"], ["TextMate" ], ["Tomorrow" ], - ["XCode" ], + ["Xcode" ], ["Kuroir"], ["KatzenMilch"], ["SQL Server" ,"sqlserver" , "light"], @@ -384,6 +393,8 @@ var themeData = [ ["Merbivore Soft" ,"merbivore_soft" , "dark"], ["Mono Industrial" ,"mono_industrial" , "dark"], ["Monokai" ,"monokai" , "dark"], + ["Nord Dark" ,"nord_dark" , "dark"], + ["One Dark" ,"one_dark" , "dark"], ["Pastel on dark" ,"pastel_on_dark" , "dark"], ["Solarized Dark" ,"solarized_dark" , "dark"], ["Terminal" ,"terminal" , "dark"], @@ -498,6 +509,7 @@ var optionGroups = { "Soft Tabs": [{ path: "useSoftTabs" }, { + ariaLabel: "Tab Size", path: "tabSize", type: "number", values: [2, 3, 4, 8, 16] @@ -519,6 +531,12 @@ var optionGroups = { "Enable Behaviours": { path: "behavioursEnabled" }, + "Wrap with quotes": { + path: "wrapBehavioursEnabled" + }, + "Enable Auto Indent": { + path: "enableAutoIndent" + }, "Full Line Selection": { type: "checkbox", values: "text|line", @@ -533,11 +551,12 @@ var optionGroups = { "Show Indent Guides": { path: "displayIndentGuides" }, - "Persistent Scrollbar": [{ + "Persistent HScrollbar": { path: "hScrollBarAlwaysVisible" - }, { + }, + "Persistent VScrollbar": { path: "vScrollBarAlwaysVisible" - }], + }, "Animate scrolling": { path: "animatedScroll" }, @@ -556,6 +575,7 @@ var optionGroups = { "Show Print Margin": [{ path: "showPrintMargin" }, { + ariaLabel: "Print Margin", type: "number", path: "printMarginColumn" }], @@ -618,10 +638,10 @@ var OptionPanel = function(editor, element) { this.render = function() { this.container.innerHTML = ""; - buildDom(["table", {id: "controls"}, + buildDom(["table", {role: "presentation", id: "controls"}, this.renderOptionGroup(optionGroups.Main), ["tr", null, ["td", {colspan: 2}, - ["table", {id: "more-controls"}, + ["table", {role: "presentation", id: "more-controls"}, this.renderOptionGroup(optionGroups.More) ] ]], @@ -664,17 +684,20 @@ var OptionPanel = function(editor, element) { } if (option.type == "buttonBar") { - control = ["div", option.items.map(function(item) { + control = ["div", {role: "group", "aria-labelledby": option.path + "-label"}, option.items.map(function(item) { return ["button", { value: item.value, ace_selected_button: value == item.value, + 'aria-pressed': value == item.value, onclick: function() { self.setOption(option, item.value); var nodes = this.parentNode.querySelectorAll("[ace_selected_button]"); for (var i = 0; i < nodes.length; i++) { nodes[i].removeAttribute("ace_selected_button"); + nodes[i].setAttribute("aria-pressed", false); } this.setAttribute("ace_selected_button", true); + this.setAttribute("aria-pressed", true); } }, item.desc || item.caption || item.name]; })]; @@ -682,6 +705,11 @@ var OptionPanel = function(editor, element) { control = ["input", {type: "number", value: value || option.defaultValue, style:"width:3em", oninput: function() { self.setOption(option, parseInt(this.value)); }}]; + if (option.ariaLabel) { + control[1]["aria-label"] = option.ariaLabel; + } else { + control[1].id = key; + } if (option.defaults) { control = [control, option.defaults.map(function(item) { return ["button", {onclick: function() { @@ -725,11 +753,13 @@ var OptionPanel = function(editor, element) { this.renderOption = function(key, option) { if (option.path && !option.onchange && !this.editor.$options[option.path]) return; - this.options[option.path] = option; - var safeKey = "-" + option.path; + var path = Array.isArray(option) ? option[0].path : option.path; + this.options[path] = option; + var safeKey = "-" + path; + var safeId = path + "-label"; var control = this.renderOptionControl(safeKey, option); return ["tr", {class: "ace_optionsMenuEntry"}, ["td", - ["label", {for: safeKey}, key] + ["label", {for: safeKey, id: safeId}, key] ], ["td", control]]; }; diff --git a/htdocs/includes/ace/src/ext-textarea.js b/htdocs/includes/ace/src/ext-textarea.js index b876bd3854e..c4bc96bdd1a 100644 --- a/htdocs/includes/ace/src/ext-textarea.js +++ b/htdocs/includes/ace/src/ext-textarea.js @@ -1,135 +1,4 @@ -define("ace/theme/textmate",["require","exports","module","ace/lib/dom"], function(require, exports, module) { -"use strict"; - -exports.isDark = false; -exports.cssClass = "ace-tm"; -exports.cssText = ".ace-tm .ace_gutter {\ -background: #f0f0f0;\ -color: #333;\ -}\ -.ace-tm .ace_print-margin {\ -width: 1px;\ -background: #e8e8e8;\ -}\ -.ace-tm .ace_fold {\ -background-color: #6B72E6;\ -}\ -.ace-tm {\ -background-color: #FFFFFF;\ -color: black;\ -}\ -.ace-tm .ace_cursor {\ -color: black;\ -}\ -.ace-tm .ace_invisible {\ -color: rgb(191, 191, 191);\ -}\ -.ace-tm .ace_storage,\ -.ace-tm .ace_keyword {\ -color: blue;\ -}\ -.ace-tm .ace_constant {\ -color: rgb(197, 6, 11);\ -}\ -.ace-tm .ace_constant.ace_buildin {\ -color: rgb(88, 72, 246);\ -}\ -.ace-tm .ace_constant.ace_language {\ -color: rgb(88, 92, 246);\ -}\ -.ace-tm .ace_constant.ace_library {\ -color: rgb(6, 150, 14);\ -}\ -.ace-tm .ace_invalid {\ -background-color: rgba(255, 0, 0, 0.1);\ -color: red;\ -}\ -.ace-tm .ace_support.ace_function {\ -color: rgb(60, 76, 114);\ -}\ -.ace-tm .ace_support.ace_constant {\ -color: rgb(6, 150, 14);\ -}\ -.ace-tm .ace_support.ace_type,\ -.ace-tm .ace_support.ace_class {\ -color: rgb(109, 121, 222);\ -}\ -.ace-tm .ace_keyword.ace_operator {\ -color: rgb(104, 118, 135);\ -}\ -.ace-tm .ace_string {\ -color: rgb(3, 106, 7);\ -}\ -.ace-tm .ace_comment {\ -color: rgb(76, 136, 107);\ -}\ -.ace-tm .ace_comment.ace_doc {\ -color: rgb(0, 102, 255);\ -}\ -.ace-tm .ace_comment.ace_doc.ace_tag {\ -color: rgb(128, 159, 191);\ -}\ -.ace-tm .ace_constant.ace_numeric {\ -color: rgb(0, 0, 205);\ -}\ -.ace-tm .ace_variable {\ -color: rgb(49, 132, 149);\ -}\ -.ace-tm .ace_xml-pe {\ -color: rgb(104, 104, 91);\ -}\ -.ace-tm .ace_entity.ace_name.ace_function {\ -color: #0000A2;\ -}\ -.ace-tm .ace_heading {\ -color: rgb(12, 7, 255);\ -}\ -.ace-tm .ace_list {\ -color:rgb(185, 6, 144);\ -}\ -.ace-tm .ace_meta.ace_tag {\ -color:rgb(0, 22, 142);\ -}\ -.ace-tm .ace_string.ace_regex {\ -color: rgb(255, 0, 0)\ -}\ -.ace-tm .ace_marker-layer .ace_selection {\ -background: rgb(181, 213, 255);\ -}\ -.ace-tm.ace_multiselect .ace_selection.ace_start {\ -box-shadow: 0 0 3px 0px white;\ -}\ -.ace-tm .ace_marker-layer .ace_step {\ -background: rgb(252, 255, 0);\ -}\ -.ace-tm .ace_marker-layer .ace_stack {\ -background: rgb(164, 229, 101);\ -}\ -.ace-tm .ace_marker-layer .ace_bracket {\ -margin: -1px 0 0 -1px;\ -border: 1px solid rgb(192, 192, 192);\ -}\ -.ace-tm .ace_marker-layer .ace_active-line {\ -background: rgba(0, 0, 0, 0.07);\ -}\ -.ace-tm .ace_gutter-active-line {\ -background-color : #dcdcdc;\ -}\ -.ace-tm .ace_marker-layer .ace_selected-word {\ -background: rgb(250, 250, 255);\ -border: 1px solid rgb(200, 200, 250);\ -}\ -.ace-tm .ace_indent-guide {\ -background: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==\") right repeat-y;\ -}\ -"; -exports.$id = "ace/theme/textmate"; - -var dom = require("../lib/dom"); -dom.importCssString(exports.cssText, exports.cssClass); -}); - -define("ace/ext/textarea",["require","exports","module","ace/lib/event","ace/lib/useragent","ace/lib/net","ace/ace","ace/theme/textmate"], function(require, exports, module) { +define("ace/ext/textarea",["require","exports","module","ace/lib/event","ace/lib/useragent","ace/lib/net","ace/ace"], function(require, exports, module) { "use strict"; var event = require("../lib/event"); @@ -137,8 +6,6 @@ var UA = require("../lib/useragent"); var net = require("../lib/net"); var ace = require("../ace"); -require("../theme/textmate"); - module.exports = exports = ace; var getCSSProperty = function(element, container, property) { var ret = element.style[property]; diff --git a/htdocs/includes/ace/src/ext-themelist.js b/htdocs/includes/ace/src/ext-themelist.js index 712700a64bd..e8a8ea8974a 100644 --- a/htdocs/includes/ace/src/ext-themelist.js +++ b/htdocs/includes/ace/src/ext-themelist.js @@ -13,7 +13,7 @@ var themeData = [ ["Solarized Light"], ["TextMate" ], ["Tomorrow" ], - ["XCode" ], + ["Xcode" ], ["Kuroir"], ["KatzenMilch"], ["SQL Server" ,"sqlserver" , "light"], @@ -30,6 +30,8 @@ var themeData = [ ["Merbivore Soft" ,"merbivore_soft" , "dark"], ["Mono Industrial" ,"mono_industrial" , "dark"], ["Monokai" ,"monokai" , "dark"], + ["Nord Dark" ,"nord_dark" , "dark"], + ["One Dark" ,"one_dark" , "dark"], ["Pastel on dark" ,"pastel_on_dark" , "dark"], ["Solarized Dark" ,"solarized_dark" , "dark"], ["Terminal" ,"terminal" , "dark"], diff --git a/htdocs/includes/ace/src/keybinding-emacs.js b/htdocs/includes/ace/src/keybinding-emacs.js index 58e79cd44fc..07ffa85cd9d 100644 --- a/htdocs/includes/ace/src/keybinding-emacs.js +++ b/htdocs/includes/ace/src/keybinding-emacs.js @@ -98,7 +98,7 @@ dom.importCssString(".ace_occur-highlight {\n\ .ace_dark .ace_occur-highlight {\n\ background-color: rgb(80, 140, 85);\n\ box-shadow: 0 0 4px rgb(60, 120, 70);\n\ -}\n", "incremental-occur-highlighting"); +}\n", "incremental-occur-highlighting", false); exports.Occur = Occur; @@ -325,7 +325,7 @@ oop.inherits(IncrementalSearchKeyboardHandler, HashHandler); this.attach = function(editor) { var iSearch = this.$iSearch; HashHandler.call(this, exports.iSearchCommands, editor.commands.platform); - this.$commandExecHandler = editor.commands.addEventListener('exec', function(e) { + this.$commandExecHandler = editor.commands.on('exec', function(e) { if (!e.command.isIncrementalSearchCommand) return iSearch.deactivate(); e.stopPropagation(); @@ -340,7 +340,7 @@ oop.inherits(IncrementalSearchKeyboardHandler, HashHandler); this.detach = function(editor) { if (!this.$commandExecHandler) return; - editor.commands.removeEventListener('exec', this.$commandExecHandler); + editor.commands.off('exec', this.$commandExecHandler); delete this.$commandExecHandler; }; @@ -349,7 +349,7 @@ oop.inherits(IncrementalSearchKeyboardHandler, HashHandler); if (((hashId === 1/*ctrl*/ || hashId === 8/*command*/) && key === 'v') || (hashId === 1/*ctrl*/ && key === 'y')) return null; var cmd = handleKeyboard$super.call(this, data, hashId, key, keyCode); - if (cmd.command) { return cmd; } + if (cmd && cmd.command) { return cmd; } if (hashId == -1) { var extendCmd = this.commands.extendSearchTerm; if (extendCmd) { return {command: extendCmd, args: key}; } @@ -406,27 +406,28 @@ function objectToRegExp(obj) { (function() { - this.activate = function(ed, backwards) { - this.$editor = ed; - this.$startPos = this.$currentPos = ed.getCursorPosition(); + this.activate = function(editor, backwards) { + this.$editor = editor; + this.$startPos = this.$currentPos = editor.getCursorPosition(); this.$options.needle = ''; this.$options.backwards = backwards; - ed.keyBinding.addKeyboardHandler(this.$keyboardHandler); - this.$originalEditorOnPaste = ed.onPaste; ed.onPaste = this.onPaste.bind(this); - this.$mousedownHandler = ed.addEventListener('mousedown', this.onMouseDown.bind(this)); - this.selectionFix(ed); + editor.keyBinding.addKeyboardHandler(this.$keyboardHandler); + this.$originalEditorOnPaste = editor.onPaste; + editor.onPaste = this.onPaste.bind(this); + this.$mousedownHandler = editor.on('mousedown', this.onMouseDown.bind(this)); + this.selectionFix(editor); this.statusMessage(true); }; this.deactivate = function(reset) { this.cancelSearch(reset); - var ed = this.$editor; - ed.keyBinding.removeKeyboardHandler(this.$keyboardHandler); + var editor = this.$editor; + editor.keyBinding.removeKeyboardHandler(this.$keyboardHandler); if (this.$mousedownHandler) { - ed.removeEventListener('mousedown', this.$mousedownHandler); + editor.off('mousedown', this.$mousedownHandler); delete this.$mousedownHandler; } - ed.onPaste = this.$originalEditorOnPaste; + editor.onPaste = this.$originalEditorOnPaste; this.message(''); }; @@ -557,7 +558,7 @@ function objectToRegExp(obj) { exports.IncrementalSearch = IncrementalSearch; var dom = require('./lib/dom'); -dom.importCssString && dom.importCssString("\ +dom.importCssString("\ .ace_marker-layer .ace_isearch-result {\ position: absolute;\ z-index: 6;\ @@ -571,7 +572,7 @@ div.ace_isearch-result {\ .ace_dark div.ace_isearch-result {\ background-color: rgb(100, 110, 160);\ box-shadow: 0 0 4px rgb(80, 90, 140);\ -}", "incremental-search-highlighting"); +}", "incremental-search-highlighting", false); var commands = require("./commands/command_manager"); (function() { this.setupIncrementalSearch = function(editor, val) { @@ -700,20 +701,20 @@ exports.handler.attach = function(editor) { editor.commands.addCommands(commands); exports.handler.platform = editor.commands.platform; editor.$emacsModeHandler = this; - editor.addEventListener('copy', this.onCopy); - editor.addEventListener('paste', this.onPaste); + editor.on('copy', this.onCopy); + editor.on('paste', this.onPaste); }; exports.handler.detach = function(editor) { editor.renderer.$blockCursor = false; editor.session.$selectLongWords = $formerLongWords; editor.session.$useEmacsStyleLineStart = $formerLineStart; - editor.removeEventListener("click", $resetMarkMode); - editor.removeEventListener("changeSession", $kbSessionChange); + editor.off("click", $resetMarkMode); + editor.off("changeSession", $kbSessionChange); editor.unsetStyle("emacs-mode"); editor.commands.removeCommands(commands); - editor.removeEventListener('copy', this.onCopy); - editor.removeEventListener('paste', this.onPaste); + editor.off('copy', this.onCopy); + editor.off('paste', this.onPaste); editor.$emacsModeHandler = null; }; diff --git a/htdocs/includes/ace/src/keybinding-vim.js b/htdocs/includes/ace/src/keybinding-vim.js index 79761280e93..bfb7e0bafe5 100644 --- a/htdocs/includes/ace/src/keybinding-vim.js +++ b/htdocs/includes/ace/src/keybinding-vim.js @@ -1,4 +1,123 @@ -define("ace/keyboard/vim",["require","exports","module","ace/range","ace/lib/event_emitter","ace/lib/dom","ace/lib/oop","ace/lib/keys","ace/lib/event","ace/search","ace/lib/useragent","ace/search_highlight","ace/commands/multi_select_commands","ace/mode/text","ace/multi_select"], function(require, exports, module) { +define("ace/ext/hardwrap",["require","exports","module","ace/range","ace/editor","ace/config"], function(require, exports, module) { +"use strict"; + +var Range = require("../range").Range; + +function hardWrap(editor, options) { + var max = options.column || editor.getOption("printMarginColumn"); + var allowMerge = options.allowMerge != false; + + var row = Math.min(options.startRow, options.endRow); + var endRow = Math.max(options.startRow, options.endRow); + + var session = editor.session; + + while (row <= endRow) { + var line = session.getLine(row); + if (line.length > max) { + var space = findSpace(line, max, 5); + if (space) { + var indentation = /^\s*/.exec(line)[0]; + session.replace(new Range(row,space.start,row,space.end), "\n" + indentation); + } + endRow++; + } else if (allowMerge && /\S/.test(line) && row != endRow) { + var nextLine = session.getLine(row + 1); + if (nextLine && /\S/.test(nextLine)) { + var trimmedLine = line.replace(/\s+$/, ""); + var trimmedNextLine = nextLine.replace(/^\s+/, ""); + var mergedLine = trimmedLine + " " + trimmedNextLine; + + var space = findSpace(mergedLine, max, 5); + if (space && space.start > trimmedLine.length || mergedLine.length < max) { + var replaceRange = new Range(row,trimmedLine.length,row + 1,nextLine.length - trimmedNextLine.length); + session.replace(replaceRange, " "); + row--; + endRow--; + } else if (trimmedLine.length < line.length) { + session.remove(new Range(row, trimmedLine.length, row, line.length)); + } + } + } + row++; + } + + function findSpace(line, max, min) { + if (line.length < max) + return; + var before = line.slice(0, max); + var after = line.slice(max); + var spaceAfter = /^(?:(\s+)|(\S+)(\s+))/.exec(after); + var spaceBefore = /(?:(\s+)|(\s+)(\S+))$/.exec(before); + var start = 0; + var end = 0; + if (spaceBefore && !spaceBefore[2]) { + start = max - spaceBefore[1].length; + end = max; + } + if (spaceAfter && !spaceAfter[2]) { + if (!start) + start = max; + end = max + spaceAfter[1].length; + } + if (start) { + return { + start: start, + end: end + }; + } + if (spaceBefore && spaceBefore[2] && spaceBefore.index > min) { + return { + start: spaceBefore.index, + end: spaceBefore.index + spaceBefore[2].length + }; + } + if (spaceAfter && spaceAfter[2]) { + start = max + spaceAfter[2].length; + return { + start: start, + end: start + spaceAfter[3].length + }; + } + } + +} + +function wrapAfterInput(e) { + if (e.command.name == "insertstring" && /\S/.test(e.args)) { + var editor = e.editor; + var cursor = editor.selection.cursor; + if (cursor.column <= editor.renderer.$printMarginColumn) return; + var lastDelta = editor.session.$undoManager.$lastDelta; + + hardWrap(editor, { + startRow: cursor.row, endRow: cursor.row, + allowMerge: false + }); + if (lastDelta != editor.session.$undoManager.$lastDelta) + editor.session.markUndoGroup(); + } +} + +var Editor = require("../editor").Editor; +require("../config").defineOptions(Editor.prototype, "editor", { + hardWrap: { + set: function(val) { + if (val) { + this.commands.on("afterExec", wrapAfterInput); + } else { + this.commands.off("afterExec", wrapAfterInput); + } + }, + value: false + } +}); + +exports.hardWrap = hardWrap; + +}); + +define("ace/keyboard/vim",["require","exports","module","ace/range","ace/lib/event_emitter","ace/lib/dom","ace/lib/oop","ace/lib/keys","ace/lib/event","ace/search","ace/lib/useragent","ace/search_highlight","ace/commands/multi_select_commands","ace/mode/text","ace/ext/hardwrap","ace/multi_select"], function(require, exports, module) { 'use strict'; function log() { @@ -36,12 +155,14 @@ define("ace/keyboard/vim",["require","exports","module","ace/range","ace/lib/eve var SearchHighlight = require("../search_highlight").SearchHighlight; var multiSelectCommands = require("../commands/multi_select_commands"); var TextModeTokenRe = require("../mode/text").Mode.prototype.tokenRe; + var hardWrap = require("../ext/hardwrap").hardWrap; require("../multi_select"); var CodeMirror = function(ace) { this.ace = ace; this.state = {}; this.marks = {}; + this.options = {}; this.$uid = 0; this.onChange = this.onChange.bind(this); this.onSelectionChange = this.onSelectionChange.bind(this); @@ -58,7 +179,9 @@ define("ace/keyboard/vim",["require","exports","module","ace/range","ace/lib/eve CodeMirror.commands = { redo: function(cm) { cm.ace.redo(); }, undo: function(cm) { cm.ace.undo(); }, - newlineAndIndent: function(cm) { cm.ace.insert("\n"); } + newlineAndIndent: function(cm) { cm.ace.insert("\n"); }, + goLineLeft: function(cm) { cm.ace.selection.moveCursorLineStart(); }, + goLineRight: function(cm) { cm.ace.selection.moveCursorLineEnd(); } }; CodeMirror.keyMap = {}; CodeMirror.addClass = CodeMirror.rmClass = function() {}; @@ -96,6 +219,11 @@ define("ace/keyboard/vim",["require","exports","module","ace/range","ace/lib/eve } }; + + CodeMirror.findMatchingTag = function(cm, head) { + + }; + CodeMirror.signal = function(o, name, e) { return o._signal(name, e) }; CodeMirror.on = event.addListener; CodeMirror.off = event.removeListener; @@ -104,10 +232,10 @@ define("ace/keyboard/vim",["require","exports","module","ace/range","ace/lib/eve TextModeTokenRe.lastIndex = 0; return TextModeTokenRe.test(ch); }; - + (function() { oop.implement(CodeMirror.prototype, EventEmitter); - + this.destroy = function() { this.ace.off('change', this.onChange); this.ace.off('changeSelection', this.onSelectionChange); @@ -194,10 +322,15 @@ define("ace/keyboard/vim",["require","exports","module","ace/range","ace/lib/eve ch = line.ch; line = line.line; } + var shouldScroll = !this.curOp && !this.ace.inVirtualSelectionMode; if (!this.ace.inVirtualSelectionMode) this.ace.exitMultiSelectMode(); this.ace.session.unfold({row: line, column: ch}); this.ace.selection.moveTo(line, ch); + if (shouldScroll) { + this.ace.renderer.scrollCursorIntoView(); + this.ace.endOperation(); + } }; this.getCursor = function(p) { var sel = this.ace.selection; @@ -227,7 +360,7 @@ define("ace/keyboard/vim",["require","exports","module","ace/range","ace/lib/eve r.cursor = Range.comparePoints(r.start, head) ? r.end : r.start; return r; }); - + if (this.ace.inVirtualSelectionMode) { this.ace.selection.fromOrientedRange(ranges[0]); return; @@ -259,6 +392,9 @@ define("ace/keyboard/vim",["require","exports","module","ace/range","ace/lib/eve var pos = this.ace.session.$clipPositionToDocument(p.line, p.ch); return toCmPos(pos); }; + this.foldCode = function(pos) { + this.ace.session.$toggleFoldWidget(pos.line, {}); + }; this.markText = function(cursor) { return {clear: function() {}, find: function() {}}; }; @@ -269,7 +405,7 @@ define("ace/keyboard/vim",["require","exports","module","ace/range","ace/lib/eve var rowShift = (end.row - start.row) * (isInsert ? 1 : -1); var colShift = (end.column - start.column) * (isInsert ? 1 : -1); if (isInsert) end = start; - + for (var i in this.marks) { var point = this.marks[i]; var cmp = Range.comparePoints(point, start); @@ -374,6 +510,7 @@ define("ace/keyboard/vim",["require","exports","module","ace/range","ace/lib/eve query = query.source; isRegexp = true; } + if (query == "\\n") { query = "\n"; isRegexp = false; } var search = new Search(); if (pos.ch == undefined) pos.ch = Number.MAX_VALUE; var acePos = {row: pos.line, column: pos.ch}; @@ -392,14 +529,8 @@ define("ace/keyboard/vim",["require","exports","module","ace/range","ace/lib/eve start: last || acePos }); var range = search.find(cm.ace.session); - if (range && range.isEmpty()) { - if (cm.getLine(range.start.row).length == range.start.column) { - search.$options.start = range; - range = search.find(cm.ace.session); - } - } last = range; - return last; + return last && [!last.isEmpty()]; }, from: function() { return last && toCmPos(last.start) }, to: function() { return last && toCmPos(last.end) }, @@ -433,9 +564,11 @@ define("ace/keyboard/vim",["require","exports","module","ace/range","ace/lib/eve }; this.replaceRange = function(text, s, e) { if (!e) e = s; - return this.ace.session.replace(new Range(s.line, s.ch, e.line, e.ch), text); + var range = new Range(s.line, s.ch, e.line, e.ch); + this.ace.session.$clipRangeToDocument(range); + return this.ace.session.replace(range, text); }; - this.replaceSelection = + this.replaceSelection = this.replaceSelections = function(p) { var sel = this.ace.selection; if (this.ace.inVirtualSelectionMode) { @@ -487,7 +620,8 @@ define("ace/keyboard/vim",["require","exports","module","ace/range","ace/lib/eve if (name) this.ace.setOption(name, val); }; - this.getOption = function(name, val) { + this.getOption = function(name) { + var val; var aceOpt = optMap[name]; if (aceOpt) val = this.ace.getOption(aceOpt); @@ -496,7 +630,7 @@ define("ace/keyboard/vim",["require","exports","module","ace/range","ace/lib/eve name = optMap[name]; return !val; case 'keyMap': - return this.state.$keyMap; + return this.state.$keyMap || 'vim'; } return aceOpt ? val : this.state[name]; }; @@ -597,9 +731,17 @@ define("ace/keyboard/vim",["require","exports","module","ace/range","ace/lib/eve this.getMode = function() { return { name : this.getOption("mode") }; }; - this.execCommand = function() { - + this.execCommand = function(name) { + if (CodeMirror.commands.hasOwnProperty(name)) return CodeMirror.commands[name](this); + if (name == "indentAuto") return this.ace.execCommand("autoindent"); + console.log(name + " is not implemented"); }; + this.getLineNumber = function(handle) { + return handle.row; + } + this.getLineHandle = function(row) { + return {text: this.ace.session.getLine(row), row: row}; + } }).call(CodeMirror.prototype); function toAcePos(cmPos) { return {row: cmPos.line, column: cmPos.ch}; @@ -710,7 +852,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ width: 20em;\ color: inherit;\ font-family: monospace;\ -}", "vimMode"); +}", "vimMode", false); (function() { function dialogDiv(cm, template, bottom) { var wrap = cm.ace.container; @@ -749,18 +891,26 @@ dom.importCssString(".normal-mode .ace_cursor{\ inp.value = newVal; } else { if (closed) return; - + if (newVal && newVal.type == "blur") { if (document.activeElement === inp) return; } - - me.state.dialog = null; + + if (me.state.dialog == dialog) { + me.state.dialog = null; + me.focus(); + } closed = true; - dialog.parentNode.removeChild(dialog); - me.focus(); + dialog.remove(); if (options.onClose) options.onClose(dialog); + var cm = me; + if (cm.state.vim) { + cm.state.vim.status = null; + cm.ace._signal("changeStatus"); + cm.ace.renderer.$loop.schedule(cm.ace.renderer.CHANGE_CURSOR); + } } } @@ -780,7 +930,6 @@ dom.importCssString(".normal-mode .ace_cursor{\ if (options && options.onKeyDown && options.onKeyDown(e, inp.value, close)) { return; } if (e.keyCode == 13) callback(inp.value); if (e.keyCode == 27 || (options.closeOnEnter !== false && e.keyCode == 13)) { - inp.blur(); CodeMirror.e_stop(e); close(); } @@ -813,7 +962,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ if (closed) return; closed = true; clearTimeout(doneTimer); - dialog.parentNode.removeChild(dialog); + dialog.remove(); } CodeMirror.on(dialog, 'click', function(e) { @@ -828,12 +977,35 @@ dom.importCssString(".normal-mode .ace_cursor{\ }); })(); - + + var Pos = CodeMirror.Pos; + + function transformCursor(cm, range) { + var vim = cm.state.vim; + if (!vim || vim.insertMode) return range.head; + var head = vim.sel.head; + if (!head) return range.head; + + if (vim.visualBlock) { + if (range.head.line != head.line) { + return; + } + } + if (range.from() == range.anchor && !range.empty()) { + if (range.head.line == head.line && range.head.ch != head.ch) + return new Pos(range.head.line, range.head.ch - 1); + } + + return range.head; + } + var defaultKeymap = [ { keys: '', type: 'keyToKey', toKeys: 'h' }, { keys: '', type: 'keyToKey', toKeys: 'l' }, { keys: '', type: 'keyToKey', toKeys: 'k' }, { keys: '', type: 'keyToKey', toKeys: 'j' }, + { keys: 'g', type: 'keyToKey', toKeys: 'gk' }, + { keys: 'g', type: 'keyToKey', toKeys: 'gj' }, { keys: '', type: 'keyToKey', toKeys: 'l' }, { keys: '', type: 'keyToKey', toKeys: 'h', context: 'normal'}, { keys: '', type: 'keyToKey', toKeys: 'x', context: 'normal'}, @@ -858,6 +1030,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ { keys: '', type: 'keyToKey', toKeys: '' }, { keys: '', type: 'keyToKey', toKeys: '' }, { keys: '', type: 'keyToKey', toKeys: 'j^', context: 'normal' }, + { keys: '', type: 'keyToKey', toKeys: 'i', context: 'normal'}, { keys: '', type: 'action', action: 'toggleOverwrite', context: 'insert' }, { keys: 'H', type: 'motion', motion: 'moveToTopLine', motionArgs: { linewise: true, toJumplist: true }}, { keys: 'M', type: 'motion', motion: 'moveToMiddleLine', motionArgs: { linewise: true, toJumplist: true }}, @@ -886,6 +1059,9 @@ dom.importCssString(".normal-mode .ace_cursor{\ { keys: '', type: 'motion', motion: 'moveByScroll', motionArgs: { forward: false, explicitRepeat: true }}, { keys: 'gg', type: 'motion', motion: 'moveToLineOrEdgeOfDocument', motionArgs: { forward: false, explicitRepeat: true, linewise: true, toJumplist: true }}, { keys: 'G', type: 'motion', motion: 'moveToLineOrEdgeOfDocument', motionArgs: { forward: true, explicitRepeat: true, linewise: true, toJumplist: true }}, + {keys: "g$", type: "motion", motion: "moveToEndOfDisplayLine"}, + {keys: "g^", type: "motion", motion: "moveToStartOfDisplayLine"}, + {keys: "g0", type: "motion", motion: "moveToStartOfDisplayLine"}, { keys: '0', type: 'motion', motion: 'moveToStartOfLine' }, { keys: '^', type: 'motion', motion: 'moveToFirstNonWhiteSpaceCharacter' }, { keys: '+', type: 'motion', motion: 'moveByLines', motionArgs: { forward: true, toFirstChar:true }}, @@ -923,6 +1099,8 @@ dom.importCssString(".normal-mode .ace_cursor{\ { keys: 'gU', type: 'operator', operator: 'changeCase', operatorArgs: {toLower: false}, isEdit: true }, { keys: 'n', type: 'motion', motion: 'findNext', motionArgs: { forward: true, toJumplist: true }}, { keys: 'N', type: 'motion', motion: 'findNext', motionArgs: { forward: false, toJumplist: true }}, + { keys: 'gn', type: 'motion', motion: 'findAndSelectNextInclusive', motionArgs: { forward: true }}, + { keys: 'gN', type: 'motion', motion: 'findAndSelectNextInclusive', motionArgs: { forward: false }}, { keys: 'x', type: 'operatorMotion', operator: 'delete', motion: 'moveByCharacters', motionArgs: { forward: true }, operatorMotionArgs: { visualLine: false }}, { keys: 'X', type: 'operatorMotion', operator: 'delete', motion: 'moveByCharacters', motionArgs: { forward: false }, operatorMotionArgs: { visualLine: true }}, { keys: 'D', type: 'operatorMotion', operator: 'delete', motion: 'moveToEol', motionArgs: { inclusive: true }, context: 'normal'}, @@ -1002,7 +1180,6 @@ dom.importCssString(".normal-mode .ace_cursor{\ { name: 'undo', shortName: 'u' }, { name: 'redo', shortName: 'red' }, { name: 'set', shortName: 'se' }, - { name: 'set', shortName: 'se' }, { name: 'setlocal', shortName: 'setl' }, { name: 'setglobal', shortName: 'setg' }, { name: 'sort', shortName: 'sor' }, @@ -1011,11 +1188,10 @@ dom.importCssString(".normal-mode .ace_cursor{\ { name: 'yank', shortName: 'y' }, { name: 'delmarks', shortName: 'delm' }, { name: 'registers', shortName: 'reg', excludeFromCommandHistory: true }, + { name: 'vglobal', shortName: 'v' }, { name: 'global', shortName: 'g' } ]; - var Pos = CodeMirror.Pos; - var Vim = function() { return vimApi; } //{ function enterVimMode(cm) { cm.setOption('disableInput', true); @@ -1032,16 +1208,22 @@ dom.importCssString(".normal-mode .ace_cursor{\ CodeMirror.off(cm.getInputField(), 'paste', getOnPasteFn(cm)); cm.state.vim = null; } + function detachVimMap(cm, next) { - if (this == CodeMirror.keyMap.vim) + if (this == CodeMirror.keyMap.vim) { + cm.options.$customCursor = null; CodeMirror.rmClass(cm.getWrapperElement(), "cm-fat-cursor"); + } if (!next || next.attach != attachVimMap) leaveVimMode(cm); } function attachVimMap(cm, prev) { - if (this == CodeMirror.keyMap.vim) + if (this == CodeMirror.keyMap.vim) { + if (cm.curOp) cm.curOp.selectionChanged = true; + cm.options.$customCursor = transformCursor; CodeMirror.addClass(cm.getWrapperElement(), "cm-fat-cursor"); + } if (!prev || prev.attach != attachVimMap) enterVimMode(cm); @@ -1060,14 +1242,14 @@ dom.importCssString(".normal-mode .ace_cursor{\ if (!vimKey) { return false; } - var cmd = CodeMirror.Vim.findKey(cm, vimKey); + var cmd = vimApi.findKey(cm, vimKey); if (typeof cmd == 'function') { CodeMirror.signal(cm, 'vim-keypress', vimKey); } return cmd; } - var modifiers = {'Shift': 'S', 'Ctrl': 'C', 'Alt': 'A', 'Cmd': 'D', 'Mod': 'A'}; + var modifiers = {Shift:'S',Ctrl:'C',Alt:'A',Cmd:'D',Mod:'A',CapsLock:''}; var specialKeys = {Enter:'CR',Backspace:'BS',Delete:'Del',Insert:'Ins'}; function cmKeyToVimKey(key) { if (key.charAt(0) == '\'') { @@ -1126,7 +1308,10 @@ dom.importCssString(".normal-mode .ace_cursor{\ var lowerCaseAlphabet = makeKeyRange(97, 26); var numbers = makeKeyRange(48, 10); var validMarks = [].concat(upperCaseAlphabet, lowerCaseAlphabet, numbers, ['<', '>']); - var validRegisters = [].concat(upperCaseAlphabet, lowerCaseAlphabet, numbers, ['-', '"', '.', ':', '/']); + var validRegisters = [].concat(upperCaseAlphabet, lowerCaseAlphabet, numbers, ['-', '"', '.', ':', '_', '/']); + var upperCaseChars; + try { upperCaseChars = new RegExp("^[\\p{Lu}]$", "u"); } + catch (_) { upperCaseChars = /^[A-Z]$/; } function isLine(cm, line) { return line >= cm.firstLine() && line <= cm.lastLine(); @@ -1141,7 +1326,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ return numberRegex.test(k); } function isUpperCase(k) { - return (/^[A-Z]$/).test(k); + return upperCaseChars.test(k); } function isWhiteSpaceString(k) { return (/^\s*$/).test(k); @@ -1352,7 +1537,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ this.latestRegister = registerName; if (cm.openDialog) { this.onRecordingDone = cm.openDialog( - '(recording)['+registerName+']', null, {bottom:true}); + document.createTextNode('(recording)['+registerName+']'), null, {bottom:true}); } this.isRecording = true; } @@ -1369,7 +1554,6 @@ dom.importCssString(".normal-mode .ace_cursor{\ lastHSPos: -1, lastMotion: null, marks: {}, - fakeCursor: null, insertMode: false, insertModeRepeat: undefined, visualMode: false, @@ -1422,7 +1606,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ exCommandDispatcher.map(lhs, rhs, ctx); }, unmap: function(lhs, ctx) { - exCommandDispatcher.unmap(lhs, ctx); + return exCommandDispatcher.unmap(lhs, ctx); }, noremap: function(lhs, rhs, ctx) { function toCtxArray(ctx) { @@ -1530,7 +1714,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ match = (/<\w+-.+?>|<\w+>|./).exec(keys); key = match[0]; keys = keys.substring(match.index + key.length); - CodeMirror.Vim.handleKey(cm, key, 'mapping'); + vimApi.handleKey(cm, key, 'mapping'); } } @@ -1576,9 +1760,14 @@ dom.importCssString(".normal-mode .ace_cursor{\ if (!keysMatcher) { clearInputState(cm); return false; } var context = vim.visualMode ? 'visual' : 'normal'; - var match = commandDispatcher.matchCommand(keysMatcher[2] || keysMatcher[1], defaultKeymap, vim.inputState, context); + var mainKey = keysMatcher[2] || keysMatcher[1]; + if (vim.inputState.operatorShortcut && vim.inputState.operatorShortcut.slice(-1) == mainKey) { + mainKey = vim.inputState.operatorShortcut; + } + var match = commandDispatcher.matchCommand(mainKey, defaultKeymap, vim.inputState, context); if (match.type == 'none') { clearInputState(cm); return false; } else if (match.type == 'partial') { return true; } + else if (match.type == 'clear') { clearInputState(cm); return true; } // ace_patch vim.inputState.keyBuffer = ''; var keysMatcher = /^(\d*)(.*)$/.exec(keys); @@ -1610,7 +1799,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ } catch (e) { cm.state.vim = undefined; maybeInitVimState(cm); - if (!CodeMirror.Vim.suppressErrorLogging) { + if (!vimApi.suppressErrorLogging) { console['log'](e); } throw e; @@ -1727,6 +1916,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ } RegisterController.prototype = { pushText: function(registerName, operator, text, linewise, blockwise) { + if (registerName === '_') return; if (linewise && text.charAt(text.length - 1) !== '\n'){ text += '\n'; } @@ -1830,7 +2020,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ } if (bestMatch.keys.slice(-11) == '') { var character = lastChar(keys); - if (//.test(character) || !character) return {type: 'none'}; //ace_patch + if (!character || character.length > 1) return {type: 'clear'}; //ace_patch inputState.selectedCharacter = character; } return {type: 'full', command: bestMatch}; @@ -1880,6 +2070,9 @@ dom.importCssString(".normal-mode .ace_cursor{\ } inputState.operator = command.operator; inputState.operatorArgs = copyArgs(command.operatorArgs); + if (command.keys.length > 1) { + inputState.operatorShortcut = command.keys; + } if (command.exitVisualBlock) { vim.visualBlock = false; updateCmSelection(cm); @@ -1955,7 +2148,6 @@ dom.importCssString(".normal-mode .ace_cursor{\ }); } function onPromptClose(query) { - cm.scrollTo(originalScrollPos.left, originalScrollPos.top); handleQuery(query, true /** ignoreCase */, true /** smartCase */); var macroModeState = vimGlobalState.macroModeState; if (macroModeState.isRecording) { @@ -2017,7 +2209,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ showPrompt(cm, { onClose: onPromptClose, prefix: promptPrefix, - desc: searchPromptDesc, + desc: '(JavaScript regexp)', onKeyUp: onPromptKeyUp, onKeyDown: onPromptKeyDown }); @@ -2131,7 +2323,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ motionArgs.repeat = repeat; clearInputState(cm); if (motion) { - var motionResult = motions[motion](cm, origHead, motionArgs, vim); + var motionResult = motions[motion](cm, origHead, motionArgs, vim, inputState); vim.lastMotion = motions[motion]; if (!motionResult) { return; @@ -2159,10 +2351,10 @@ dom.importCssString(".normal-mode .ace_cursor{\ } if (vim.visualMode) { if (!(vim.visualBlock && newHead.ch === Infinity)) { - newHead = clipCursorToContent(cm, newHead, vim.visualBlock); + newHead = clipCursorToContent(cm, newHead); } if (newAnchor) { - newAnchor = clipCursorToContent(cm, newAnchor, true); + newAnchor = clipCursorToContent(cm, newAnchor); } newAnchor = newAnchor || oldAnchor; sel.anchor = newAnchor; @@ -2186,13 +2378,13 @@ dom.importCssString(".normal-mode .ace_cursor{\ var lineOffset = Math.abs(lastSel.head.line - lastSel.anchor.line); var chOffset = Math.abs(lastSel.head.ch - lastSel.anchor.ch); if (lastSel.visualLine) { - newHead = Pos(oldAnchor.line + lineOffset, oldAnchor.ch); + newHead = new Pos(oldAnchor.line + lineOffset, oldAnchor.ch); } else if (lastSel.visualBlock) { - newHead = Pos(oldAnchor.line + lineOffset, oldAnchor.ch + chOffset); + newHead = new Pos(oldAnchor.line + lineOffset, oldAnchor.ch + chOffset); } else if (lastSel.head.line == lastSel.anchor.line) { - newHead = Pos(oldAnchor.line, oldAnchor.ch + chOffset); + newHead = new Pos(oldAnchor.line, oldAnchor.ch + chOffset); } else { - newHead = Pos(oldAnchor.line + lineOffset, oldAnchor.ch); + newHead = new Pos(oldAnchor.line + lineOffset, oldAnchor.ch); } vim.visualMode = true; vim.visualLine = lastSel.visualLine; @@ -2230,7 +2422,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ ranges[i].head.ch = lineLength(cm, ranges[i].head.line); } } else if (mode == 'line') { - ranges[0].head = Pos(ranges[0].head.line + 1, 0); + ranges[0].head = new Pos(ranges[0].head.line + 1, 0); } } } else { @@ -2282,20 +2474,20 @@ dom.importCssString(".normal-mode .ace_cursor{\ var motions = { moveToTopLine: function(cm, _head, motionArgs) { var line = getUserVisibleLines(cm).top + motionArgs.repeat -1; - return Pos(line, findFirstNonWhiteSpaceCharacter(cm.getLine(line))); + return new Pos(line, findFirstNonWhiteSpaceCharacter(cm.getLine(line))); }, moveToMiddleLine: function(cm) { var range = getUserVisibleLines(cm); var line = Math.floor((range.top + range.bottom) * 0.5); - return Pos(line, findFirstNonWhiteSpaceCharacter(cm.getLine(line))); + return new Pos(line, findFirstNonWhiteSpaceCharacter(cm.getLine(line))); }, moveToBottomLine: function(cm, _head, motionArgs) { var line = getUserVisibleLines(cm).bottom - motionArgs.repeat +1; - return Pos(line, findFirstNonWhiteSpaceCharacter(cm.getLine(line))); + return new Pos(line, findFirstNonWhiteSpaceCharacter(cm.getLine(line))); }, expandToLine: function(_cm, head, motionArgs) { var cur = head; - return Pos(cur.line + motionArgs.repeat - 1, Infinity); + return new Pos(cur.line + motionArgs.repeat - 1, Infinity); }, findNext: function(cm, _head, motionArgs) { var state = getSearchState(cm); @@ -2308,6 +2500,58 @@ dom.importCssString(".normal-mode .ace_cursor{\ highlightSearchMatches(cm, query); return findNext(cm, prev/** prev */, query, motionArgs.repeat); }, + findAndSelectNextInclusive: function(cm, _head, motionArgs, vim, prevInputState) { + var state = getSearchState(cm); + var query = state.getQuery(); + + if (!query) { + return; + } + + var prev = !motionArgs.forward; + prev = (state.isReversed()) ? !prev : prev; + var next = findNextFromAndToInclusive(cm, prev, query, motionArgs.repeat, vim); + if (!next) { + return; + } + if (prevInputState.operator) { + return next; + } + + var from = next[0]; + var to = new Pos(next[1].line, next[1].ch - 1); + + if (vim.visualMode) { + if (vim.visualLine || vim.visualBlock) { + vim.visualLine = false; + vim.visualBlock = false; + CodeMirror.signal(cm, "vim-mode-change", {mode: "visual", subMode: ""}); + } + var anchor = vim.sel.anchor; + if (anchor) { + if (state.isReversed()) { + if (motionArgs.forward) { + return [anchor, from]; + } + + return [anchor, to]; + } else { + if (motionArgs.forward) { + return [anchor, to]; + } + + return [anchor, from]; + } + } + } else { + vim.visualMode = true; + vim.visualLine = false; + vim.visualBlock = false; + CodeMirror.signal(cm, "vim-mode-change", {mode: "visual", subMode: ""}); + } + + return prev ? [to, from] : [from, to]; + }, goToMark: function(cm, _head, motionArgs, vim) { var pos = getMarkPos(cm, vim, motionArgs.selectedCharacter); if (pos) { @@ -2319,8 +2563,8 @@ dom.importCssString(".normal-mode .ace_cursor{\ if (vim.visualBlock && motionArgs.sameLine) { var sel = vim.sel; return [ - clipCursorToContent(cm, Pos(sel.anchor.line, sel.head.ch)), - clipCursorToContent(cm, Pos(sel.head.line, sel.anchor.ch)) + clipCursorToContent(cm, new Pos(sel.anchor.line, sel.head.ch)), + clipCursorToContent(cm, new Pos(sel.head.line, sel.anchor.ch)) ]; } else { return ([vim.sel.head, vim.sel.anchor]); @@ -2357,7 +2601,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ } if (motionArgs.linewise) { - best = Pos(best.line, findFirstNonWhiteSpaceCharacter(cm.getLine(best.line))); + best = new Pos(best.line, findFirstNonWhiteSpaceCharacter(cm.getLine(best.line))); } return best; }, @@ -2365,7 +2609,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ var cur = head; var repeat = motionArgs.repeat; var ch = motionArgs.forward ? cur.ch + repeat : cur.ch - repeat; - return Pos(cur.line, ch); + return new Pos(cur.line, ch); }, moveByLines: function(cm, head, motionArgs, vim) { var cur = head; @@ -2387,8 +2631,8 @@ dom.importCssString(".normal-mode .ace_cursor{\ var last = cm.lastLine(); if (line < first && cur.line == first){ return this.moveToStartOfLine(cm, head, motionArgs, vim); - }else if (line > last && cur.line == last){ - return this.moveToEol(cm, head, motionArgs, vim, true); + } else if (line > last && cur.line == last){ + return moveToEol(cm, head, motionArgs, vim, true); } var fold = cm.ace.session.getFoldLine(line); if (fold) { @@ -2403,8 +2647,8 @@ dom.importCssString(".normal-mode .ace_cursor{\ endCh=findFirstNonWhiteSpaceCharacter(cm.getLine(line)); vim.lastHPos = endCh; } - vim.lastHSPos = cm.charCoords(Pos(line, endCh),'div').left; - return Pos(line, endCh); + vim.lastHSPos = cm.charCoords(new Pos(line, endCh),'div').left; + return new Pos(line, endCh); }, moveByDisplayLines: function(cm, head, motionArgs, vim) { var cur = head; @@ -2426,7 +2670,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ var goalCoords = { top: lastCharCoords.top + 8, left: vim.lastHSPos }; var res = cm.coordsChar(goalCoords, 'div'); } else { - var resCoords = cm.charCoords(Pos(cm.firstLine(), 0), 'div'); + var resCoords = cm.charCoords(new Pos(cm.firstLine(), 0), 'div'); resCoords.left = vim.lastHSPos; res = cm.coordsChar(resCoords, 'div'); } @@ -2495,20 +2739,12 @@ dom.importCssString(".normal-mode .ace_cursor{\ vim.lastHSPos = cm.charCoords(head,'div').left; return moveToColumn(cm, repeat); }, - moveToEol: function(cm, head, motionArgs, vim, keepHPos) { - var cur = head; - var retval= Pos(cur.line + motionArgs.repeat - 1, Infinity); - var end=cm.clipPos(retval); - end.ch--; - if (!keepHPos) { - vim.lastHPos = Infinity; - vim.lastHSPos = cm.charCoords(end,'div').left; - } - return retval; + moveToEol: function(cm, head, motionArgs, vim) { + return moveToEol(cm, head, motionArgs, vim, false); }, moveToFirstNonWhiteSpaceCharacter: function(cm, head) { var cursor = head; - return Pos(cursor.line, + return new Pos(cursor.line, findFirstNonWhiteSpaceCharacter(cm.getLine(cursor.line))); }, moveToMatchedSymbol: function(cm, head) { @@ -2520,7 +2756,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ for (; ch < lineText.length; ch++) { symbol = lineText.charAt(ch); if (symbol && isMatchableSymbol(symbol)) { - var style = cm.getTokenTypeAt(Pos(line, ch + 1)); + var style = cm.getTokenTypeAt(new Pos(line, ch + 1)); if (style !== "string" && style !== "comment") { break; } @@ -2528,23 +2764,33 @@ dom.importCssString(".normal-mode .ace_cursor{\ } if (ch < lineText.length) { var re = /[<>]/.test(lineText[ch]) ? /[(){}[\]<>]/ : /[(){}[\]]/; //ace_patch? - var matched = cm.findMatchingBracket(Pos(line, ch+1), {bracketRegex: re}); + var matched = cm.findMatchingBracket(new Pos(line, ch+1), {bracketRegex: re}); return matched.to; } else { return cursor; } }, moveToStartOfLine: function(_cm, head) { - return Pos(head.line, 0); + return new Pos(head.line, 0); }, moveToLineOrEdgeOfDocument: function(cm, _head, motionArgs) { var lineNum = motionArgs.forward ? cm.lastLine() : cm.firstLine(); if (motionArgs.repeatIsExplicit) { lineNum = motionArgs.repeat - cm.getOption('firstLineNumber'); } - return Pos(lineNum, + return new Pos(lineNum, findFirstNonWhiteSpaceCharacter(cm.getLine(lineNum))); }, + moveToStartOfDisplayLine: function(cm) { + cm.execCommand("goLineLeft"); + return cm.getCursor(); + }, + moveToEndOfDisplayLine: function(cm) { + cm.execCommand("goLineRight"); + var head = cm.getCursor(); + if (head.sticky == "before") head.ch--; + return head; + }, textObjectManipulation: function(cm, head, motionArgs, vim) { var mirroredPairs = {'(': ')', ')': '(', '{': '}', '}': '{', @@ -2581,6 +2827,8 @@ dom.importCssString(".normal-mode .ace_cursor{\ if (operatorArgs) { operatorArgs.linewise = true; } tmp.end.line--; } + } else if (character === 't') { + tmp = expandTagUnderCursor(cm, head, inclusive); } else { return null; } @@ -2682,7 +2930,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ if (anchor.line == cm.firstLine()) { anchor.ch = 0; } else { - anchor = Pos(anchor.line - 1, lineLength(cm, anchor.line - 1)); + anchor = new Pos(anchor.line - 1, lineLength(cm, anchor.line - 1)); } } text = cm.getRange(anchor, head); @@ -2695,13 +2943,12 @@ dom.importCssString(".normal-mode .ace_cursor{\ text = cm.getSelection(); var replacement = fillArray('', ranges.length); cm.replaceSelections(replacement); - finalHead = ranges[0].anchor; + finalHead = cursorMin(ranges[0].head, ranges[0].anchor); } vimGlobalState.registerController.pushText( args.registerName, 'delete', text, args.linewise, vim.visualBlock); - var includeLineBreak = vim.insertMode - return clipCursorToContent(cm, finalHead, includeLineBreak); + return clipCursorToContent(cm, finalHead); }, indent: function(cm, args, ranges) { var vim = cm.state.vim; @@ -2721,6 +2968,9 @@ dom.importCssString(".normal-mode .ace_cursor{\ return motions.moveToFirstNonWhiteSpaceCharacter(cm, ranges[0].anchor); }, indentAuto: function(cm, _args, ranges) { + if (ranges.length > 1) { // ace_patch + cm.setSelection(ranges[0].anchor, ranges[ranges.length - 1].head); + } cm.execCommand("indentAuto"); return motions.moveToFirstNonWhiteSpaceCharacter(cm, ranges[0].anchor); }, @@ -2824,7 +3074,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ }, scrollToCursor: function(cm, actionArgs) { var lineNum = cm.getCursor().line; - var charCoords = cm.charCoords(Pos(lineNum, 0), 'local'); + var charCoords = cm.charCoords(new Pos(lineNum, 0), 'local'); var height = cm.getScrollInfo().clientHeight; var y = charCoords.top; var lineHeight = charCoords.bottom - y; @@ -2876,9 +3126,9 @@ dom.importCssString(".normal-mode .ace_cursor{\ var head = actionArgs.head || cm.getCursor('head'); var height = cm.listSelections().length; if (insertAt == 'eol') { - head = Pos(head.line, lineLength(cm, head.line)); + head = new Pos(head.line, lineLength(cm, head.line)); } else if (insertAt == 'bol') { - head = Pos(head.line, 0); + head = new Pos(head.line, 0); } else if (insertAt == 'charAfter') { head = offsetCursor(head, 0, 1); } else if (insertAt == 'firstNonBlank') { @@ -2890,10 +3140,10 @@ dom.importCssString(".normal-mode .ace_cursor{\ if (sel.head.line < sel.anchor.line) { head = sel.head; } else { - head = Pos(sel.anchor.line, 0); + head = new Pos(sel.anchor.line, 0); } } else { - head = Pos( + head = new Pos( Math.min(sel.head.line, sel.anchor.line), Math.min(sel.head.ch, sel.anchor.ch)); height = Math.abs(sel.head.line - sel.anchor.line) + 1; @@ -2905,12 +3155,12 @@ dom.importCssString(".normal-mode .ace_cursor{\ if (sel.head.line >= sel.anchor.line) { head = offsetCursor(sel.head, 0, 1); } else { - head = Pos(sel.anchor.line, 0); + head = new Pos(sel.anchor.line, 0); } } else { - head = Pos( + head = new Pos( Math.min(sel.head.line, sel.anchor.line), - Math.max(sel.head.ch + 1, sel.anchor.ch)); + Math.max(sel.head.ch, sel.anchor.ch) + 1); height = Math.abs(sel.head.line - sel.anchor.line) + 1; } } else if (insertAt == 'inplace') { @@ -2948,8 +3198,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ vim.visualLine = !!actionArgs.linewise; vim.visualBlock = !!actionArgs.blockwise; head = clipCursorToContent( - cm, Pos(anchor.line, anchor.ch + repeat - 1), - true /** includeLineBreak */); + cm, new Pos(anchor.line, anchor.ch + repeat - 1)); vim.sel = { anchor: anchor, head: head @@ -3009,13 +3258,13 @@ dom.importCssString(".normal-mode .ace_cursor{\ } else { var repeat = Math.max(actionArgs.repeat, 2); curStart = cm.getCursor(); - curEnd = clipCursorToContent(cm, Pos(curStart.line + repeat - 1, + curEnd = clipCursorToContent(cm, new Pos(curStart.line + repeat - 1, Infinity)); } var finalCh = 0; for (var i = curStart.line; i < curEnd.line; i++) { finalCh = lineLength(cm, curStart.line); - var tmp = Pos(curStart.line + 1, + var tmp = new Pos(curStart.line + 1, lineLength(cm, curStart.line + 1)); var text = cm.getRange(curStart, tmp); text = actionArgs.keepSpaces @@ -3023,7 +3272,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ : text.replace(/\n\s*/g, ' '); cm.replaceRange(text, curStart, tmp); } - var curFinalPos = Pos(curStart.line, finalCh); + var curFinalPos = new Pos(curStart.line, finalCh); if (vim.visualMode) { exitVisualMode(cm, false); } @@ -3033,7 +3282,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ vim.insertMode = true; var insertAt = copyCursor(cm.getCursor()); if (insertAt.line === cm.firstLine() && !actionArgs.after) { - cm.replaceRange('\n', Pos(cm.firstLine(), 0)); + cm.replaceRange('\n', new Pos(cm.firstLine(), 0)); cm.setCursor(cm.firstLine(), 0); } else { insertAt.line = (actionArgs.after) ? insertAt.line : @@ -3125,7 +3374,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ vimGlobalState.registerController.unnamedRegister.setText(selectedText); if (blockwise) { cm.replaceSelections(emptyStrings); - selectionEnd = Pos(selectionStart.line + text.length-1, selectionStart.ch); + selectionEnd = new Pos(selectionStart.line + text.length-1, selectionStart.ch); cm.setCursor(selectionStart); selectBlock(cm, selectionEnd); cm.replaceSelections(text); @@ -3151,7 +3400,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ for (var i = 0; i < text.length; i++) { var line = cur.line+i; if (line > cm.lastLine()) { - cm.replaceRange('\n', Pos(line, 0)); + cm.replaceRange('\n', new Pos(line, 0)); } var lastCh = lineLength(cm, line); if (lastCh < cur.ch) { @@ -3159,17 +3408,17 @@ dom.importCssString(".normal-mode .ace_cursor{\ } } cm.setCursor(cur); - selectBlock(cm, Pos(cur.line + text.length-1, cur.ch)); + selectBlock(cm, new Pos(cur.line + text.length-1, cur.ch)); cm.replaceSelections(text); curPosFinal = cur; } else { cm.replaceRange(text, cur); if (linewise && actionArgs.after) { - curPosFinal = Pos( + curPosFinal = new Pos( cur.line + 1, findFirstNonWhiteSpaceCharacter(cm.getLine(cur.line + 1))); } else if (linewise && !actionArgs.after) { - curPosFinal = Pos( + curPosFinal = new Pos( cur.line, findFirstNonWhiteSpaceCharacter(cm.getLine(cur.line))); } else if (!linewise && actionArgs.after) { @@ -3217,7 +3466,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ if (replaceTo > line.length) { replaceTo=line.length; } - curEnd = Pos(curStart.line, replaceTo); + curEnd = new Pos(curStart.line, replaceTo); } if (replaceWith=='\n') { if (!vim.visualMode) cm.replaceRange('', curStart, curEnd); @@ -3270,13 +3519,13 @@ dom.importCssString(".normal-mode .ace_cursor{\ } else { numberStr = baseStr + zeroPadding + numberStr; } - var from = Pos(cur.line, start); - var to = Pos(cur.line, end); + var from = new Pos(cur.line, start); + var to = new Pos(cur.line, end); cm.replaceRange(numberStr, from, to); } else { return; } - cm.setCursor(Pos(cur.line, start + numberStr.length - 1)); + cm.setCursor(new Pos(cur.line, start + numberStr.length - 1)); }, repeatLastEdit: function(cm, actionArgs, vim) { var lastEditInputState = vim.lastEditInputState; @@ -3298,12 +3547,13 @@ dom.importCssString(".normal-mode .ace_cursor{\ function defineAction(name, fn) { actions[name] = fn; } - function clipCursorToContent(cm, cur, includeLineBreak) { + function clipCursorToContent(cm, cur) { + var vim = cm.state.vim; + var includeLineBreak = vim.insertMode || vim.visualMode; var line = Math.min(Math.max(cm.firstLine(), cur.line), cm.lastLine() ); - var maxCh = lineLength(cm, line) - 1; - maxCh = (includeLineBreak) ? maxCh + 1 : maxCh; + var maxCh = lineLength(cm, line) - 1 + !!includeLineBreak; var ch = Math.min(Math.max(0, cur.ch), maxCh); - return Pos(line, ch); + return new Pos(line, ch); } function copyArgs(args) { var ret = {}; @@ -3319,7 +3569,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ offsetCh = offsetLine.ch; offsetLine = offsetLine.line; } - return Pos(cur.line + offsetLine, cur.ch + offsetCh); + return new Pos(cur.line + offsetLine, cur.ch + offsetCh); } function commandMatches(keys, keyMap, context, inputState) { var match, partial = [], full = []; @@ -3375,7 +3625,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ }; } function copyCursor(cur) { - return Pos(cur.line, cur.ch); + return new Pos(cur.line, cur.ch); } function cursorEqual(cur1, cur2) { return cur1.ch == cur2.ch && cur1.line == cur2.line; @@ -3421,7 +3671,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ function extendLineToColumn(cm, lineNum, column) { var endCh = lineLength(cm, lineNum); var spaces = new Array(column-endCh+1).join(' '); - cm.setCursor(Pos(lineNum, endCh)); + cm.setCursor(new Pos(lineNum, endCh)); cm.replaceRange(spaces, cm.getCursor()); } function selectBlock(cm, selectionEnd) { @@ -3495,11 +3745,11 @@ dom.importCssString(".normal-mode .ace_cursor{\ if (block) { var width = block.width; var height = block.height; - selectionEnd = Pos(selectionStart.line + height, selectionStart.ch + width); + selectionEnd = new Pos(selectionStart.line + height, selectionStart.ch + width); var selections = []; for (var i = selectionStart.line; i < selectionEnd.line; i++) { - var anchor = Pos(i, selectionStart.ch); - var head = Pos(i, selectionEnd.ch); + var anchor = new Pos(i, selectionStart.ch); + var head = new Pos(i, selectionEnd.ch); var range = {anchor: anchor, head: head}; selections.push(range); } @@ -3511,8 +3761,8 @@ dom.importCssString(".normal-mode .ace_cursor{\ var ch = end.ch - start.ch; selectionEnd = {line: selectionEnd.line + line, ch: line ? selectionEnd.ch : ch + selectionEnd.ch}; if (lastSelection.visualLine) { - selectionStart = Pos(selectionStart.line, 0); - selectionEnd = Pos(selectionEnd.line, lineLength(cm, selectionEnd.line)); + selectionStart = new Pos(selectionStart.line, 0); + selectionEnd = new Pos(selectionEnd.line, lineLength(cm, selectionEnd.line)); } cm.setSelection(selectionStart, selectionEnd); } @@ -3557,7 +3807,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ head = cursorMax(head, end); head = offsetCursor(head, 0, -1); if (head.ch == -1 && head.line != cm.firstLine()) { - head = Pos(head.line - 1, lineLength(cm, head.line - 1)); + head = new Pos(head.line - 1, lineLength(cm, head.line - 1)); } } return [anchor, head]; @@ -3569,7 +3819,6 @@ dom.importCssString(".normal-mode .ace_cursor{\ vim.visualLine ? 'line' : vim.visualBlock ? 'block' : 'char'; var cmSel = makeCmSelection(cm, sel, mode); cm.setSelections(cmSel.ranges, cmSel.primary); - updateFakeCursor(cm); } function makeCmSelection(cm, sel, mode, exclusive) { var head = copyCursor(sel.head); @@ -3602,16 +3851,18 @@ dom.importCssString(".normal-mode .ace_cursor{\ }; } else if (mode == 'block') { var top = Math.min(anchor.line, head.line), - left = Math.min(anchor.ch, head.ch), + fromCh = anchor.ch, bottom = Math.max(anchor.line, head.line), - right = Math.max(anchor.ch, head.ch) + 1; + toCh = head.ch; + if (fromCh < toCh) { toCh += 1 } + else { fromCh += 1 }; var height = bottom - top + 1; var primary = head.line == top ? 0 : height - 1; var ranges = []; for (var i = 0; i < height; i++) { ranges.push({ - anchor: Pos(top + i, left), - head: Pos(top + i, right) + anchor: new Pos(top + i, fromCh), + head: new Pos(top + i, toCh) }); } return { @@ -3636,10 +3887,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ vim.visualMode = false; vim.visualLine = false; vim.visualBlock = false; - CodeMirror.signal(cm, "vim-mode-change", {mode: "normal"}); - if (vim.fakeCursor) { - vim.fakeCursor.clear(); - } + if (!vim.insertMode) CodeMirror.signal(cm, "vim-mode-change", {mode: "normal"}); } function clipToLine(cm, curStart, curEnd) { var selection = cm.getRange(curStart, curEnd); @@ -3706,7 +3954,23 @@ dom.importCssString(".normal-mode .ace_cursor{\ if (!start) { start = wordStart; } } } - return { start: Pos(cur.line, start), end: Pos(cur.line, end) }; + return { start: new Pos(cur.line, start), end: new Pos(cur.line, end) }; + } + function expandTagUnderCursor(cm, head, inclusive) { + var cur = head; + if (!CodeMirror.findMatchingTag || !CodeMirror.findEnclosingTag) { + return { start: cur, end: cur }; + } + + var tags = CodeMirror.findMatchingTag(cm, head) || CodeMirror.findEnclosingTag(cm, head); + if (!tags || !tags.open || !tags.close) { + return { start: cur, end: cur }; + } + + if (inclusive) { + return { start: tags.open.from, end: tags.close.to }; + } + return { start: tags.open.to, end: tags.close.from }; } function recordJumpPosition(cm, oldCur, newCur) { @@ -3772,7 +4036,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ }, isComplete: function(state) { if (state.nextCh === '#') { - var token = state.lineText.match(/#(\w+)/)[1]; + var token = state.lineText.match(/^#(\w+)/)[1]; if (token === 'endif') { if (state.forward && state.depth === 0) { return true; @@ -3834,7 +4098,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ } } if (state.nextCh || state.curMoveThrough) { - return Pos(line, state.index); + return new Pos(line, state.index); } return cur; } @@ -3910,7 +4174,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ break; } words.push(word); - cur = Pos(word.line, forward ? (word.to - 1) : word.from); + cur = new Pos(word.line, forward ? (word.to - 1) : word.from); } var shortCircuit = words.length != repeat; var firstWord = words[0]; @@ -3919,19 +4183,31 @@ dom.importCssString(".normal-mode .ace_cursor{\ if (!shortCircuit && (firstWord.from != curStart.ch || firstWord.line != curStart.line)) { lastWord = words.pop(); } - return Pos(lastWord.line, lastWord.from); + return new Pos(lastWord.line, lastWord.from); } else if (forward && wordEnd) { - return Pos(lastWord.line, lastWord.to - 1); + return new Pos(lastWord.line, lastWord.to - 1); } else if (!forward && wordEnd) { if (!shortCircuit && (firstWord.to != curStart.ch || firstWord.line != curStart.line)) { lastWord = words.pop(); } - return Pos(lastWord.line, lastWord.to); + return new Pos(lastWord.line, lastWord.to); } else { - return Pos(lastWord.line, lastWord.from); + return new Pos(lastWord.line, lastWord.from); } } + function moveToEol(cm, head, motionArgs, vim, keepHPos) { + var cur = head; + var retval= new Pos(cur.line + motionArgs.repeat - 1, Infinity); + var end=cm.clipPos(retval); + end.ch--; + if (!keepHPos) { + vim.lastHPos = Infinity; + vim.lastHSPos = cm.charCoords(end,'div').left; + } + return retval; + } + function moveToCharacter(cm, repeat, forward, character) { var cur = cm.getCursor(); var start = cur.ch; @@ -3944,12 +4220,12 @@ dom.importCssString(".normal-mode .ace_cursor{\ } start = idx; } - return Pos(cm.getCursor().line, idx); + return new Pos(cm.getCursor().line, idx); } function moveToColumn(cm, repeat) { var line = cm.getCursor().line; - return clipCursorToContent(cm, Pos(line, repeat - 1)); + return clipCursorToContent(cm, new Pos(line, repeat - 1)); } function updateMark(cm, vim, markName, pos) { @@ -4167,7 +4443,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ repeat--; } - return Pos(curr_index.ln, curr_index.pos); + return new Pos(curr_index.ln, curr_index.pos); } function selectCompanionObject(cm, head, symb, inclusive) { var cur = head, start, end; @@ -4185,8 +4461,8 @@ dom.importCssString(".normal-mode .ace_cursor{\ var curChar = cm.getLine(cur.line).charAt(cur.ch); var offset = curChar === openSym ? 1 : 0; - start = cm.scanForBracket(Pos(cur.line, cur.ch + offset), -1, undefined, {'bracketRegex': bracketRegexp}); - end = cm.scanForBracket(Pos(cur.line, cur.ch + offset), 1, undefined, {'bracketRegex': bracketRegexp}); + start = cm.scanForBracket(new Pos(cur.line, cur.ch + offset), -1, undefined, {'bracketRegex': bracketRegexp}); + end = cm.scanForBracket(new Pos(cur.line, cur.ch + offset), 1, undefined, {'bracketRegex': bracketRegexp}); if (!start || !end) { return { start: cur, end: cur }; @@ -4247,8 +4523,8 @@ dom.importCssString(".normal-mode .ace_cursor{\ } return { - start: Pos(cur.line, start), - end: Pos(cur.line, end) + start: new Pos(cur.line, start), + end: new Pos(cur.line, end) }; } defineOption('pcre', true, 'boolean'); @@ -4283,21 +4559,6 @@ dom.importCssString(".normal-mode .ace_cursor{\ var vim = cm.state.vim; return vim.searchState_ || (vim.searchState_ = new SearchState()); } - function dialog(cm, template, shortText, onClose, options) { - if (cm.openDialog) { - cm.openDialog(template, onClose, { bottom: true, value: options.value, - onKeyDown: options.onKeyDown, onKeyUp: options.onKeyUp, - selectValueOnOpen: false, onClose: function() { - if (cm.state.vim) { - cm.state.vim.status = ""; - cm.ace.renderer.$loop.schedule(cm.ace.renderer.CHANGE_CURSOR); - } - }}); - } - else { - onClose(prompt(shortText, '')); - } - } function splitBySlash(argString) { return splitBySeparator(argString, '/'); } @@ -4400,7 +4661,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ } return out.join(''); } - var unescapes = {'\\/': '/', '\\\\': '\\', '\\n': '\n', '\\r': '\r', '\\t': '\t'}; + var unescapes = {'\\/': '/', '\\\\': '\\', '\\n': '\n', '\\r': '\r', '\\t': '\t', '\\&':'&'}; function unescapeRegexReplace(str) { var stream = new CodeMirror.StringStream(str); var output = []; @@ -4446,30 +4707,58 @@ dom.importCssString(".normal-mode .ace_cursor{\ ignoreCase = (/^[^A-Z]*$/).test(regexPart); } var regexp = new RegExp(regexPart, - (ignoreCase || forceIgnoreCase) ? 'i' : undefined); + (ignoreCase || forceIgnoreCase) ? 'im' : 'm'); return regexp; } - function showConfirm(cm, text) { + function hdom(n) { + if (typeof n === 'string') n = document.createElement(n); + for (var a, i = 1; i < arguments.length; i++) { + if (!(a = arguments[i])) continue; + if (typeof a !== 'object') a = document.createTextNode(a); + if (a.nodeType) n.appendChild(a); + else for (var key in a) { + if (!Object.prototype.hasOwnProperty.call(a, key)) continue; + if (key[0] === '$') n.style[key.slice(1)] = a[key]; + else n.setAttribute(key, a[key]); + } + } + return n; + } + + function showConfirm(cm, template) { + var pre = hdom('span', {$color: 'red', $whiteSpace: 'pre', class: 'cm-vim-message'}, template); //ace_patch span instead of pre if (cm.openNotification) { - cm.openNotification('' + text + '', - {bottom: true, duration: 5000}); + cm.openNotification(pre, {bottom: true, duration: 5000}); } else { - alert(text); + alert(pre.innerText); } } + function makePrompt(prefix, desc) { - var raw = '' + - (prefix || "") + ''; - if (desc) - raw += ' ' + desc + ''; - return raw; + return hdom(document.createDocumentFragment(), + hdom('span', {$fontFamily: 'monospace', $whiteSpace: 'pre'}, + prefix, + hdom('input', {type: 'text', autocorrect: 'off', + autocapitalize: 'off', spellcheck: 'false'})), + desc && hdom('span', {$color: '#888'}, desc)); } - var searchPromptDesc = '(Javascript regexp)'; + function showPrompt(cm, options) { - var shortText = (options.prefix || '') + ' ' + (options.desc || ''); - var prompt = makePrompt(options.prefix, options.desc); - dialog(cm, prompt, shortText, options.onClose, options); + var template = makePrompt(options.prefix, options.desc); + if (cm.openDialog) { + cm.openDialog(template, options.onClose, { + onKeyDown: options.onKeyDown, onKeyUp: options.onKeyUp, + bottom: true, selectValueOnOpen: false, value: options.value + }); + } + else { + var shortText = ''; + if (typeof options.prefix != "string" && options.prefix) shortText += options.prefix.textContent; + if (options.desc) shortText += " " + options.desc; + options.onClose(prompt(shortText, '')); + } } + function regexEqual(r1, r2) { if (r1 instanceof RegExp && r2 instanceof RegExp) { var props = ['global', 'multiline', 'ignoreCase', 'source']; @@ -4558,10 +4847,17 @@ dom.importCssString(".normal-mode .ace_cursor{\ var cursor = cm.getSearchCursor(query, pos); for (var i = 0; i < repeat; i++) { var found = cursor.find(prev); - if (i == 0 && found && cursorEqual(cursor.from(), pos)) { found = cursor.find(prev); } + if (i == 0 && found && cursorEqual(cursor.from(), pos)) { + var lastEndPos = prev ? cursor.from() : cursor.to(); + found = cursor.find(prev); + if (found && !found[0] && cursorEqual(cursor.from(), lastEndPos)) { + if (cm.getLine(lastEndPos.line).length == lastEndPos.ch) + found = cursor.find(prev); + } + } if (!found) { cursor = cm.getSearchCursor(query, - (prev) ? Pos(cm.lastLine()) : Pos(cm.firstLine(), 0) ); + (prev) ? new Pos(cm.lastLine()) : new Pos(cm.firstLine(), 0) ); if (!cursor.find(prev)) { return; } @@ -4570,6 +4866,29 @@ dom.importCssString(".normal-mode .ace_cursor{\ return cursor.from(); }); } + function findNextFromAndToInclusive(cm, prev, query, repeat, vim) { + if (repeat === undefined) { repeat = 1; } + return cm.operation(function() { + var pos = cm.getCursor(); + var cursor = cm.getSearchCursor(query, pos); + var found = cursor.find(!prev); + if (!vim.visualMode && found && cursorEqual(cursor.from(), pos)) { + cursor.find(!prev); + } + + for (var i = 0; i < repeat; i++) { + found = cursor.find(prev); + if (!found) { + cursor = cm.getSearchCursor(query, + (prev) ? new Pos(cm.lastLine()) : new Pos(cm.firstLine(), 0) ); + if (!cursor.find(prev)) { + return; + } + } + } + return [cursor.from(), cursor.to()]; + }); + } function clearSearchHighlight(cm) { var state = getSearchState(cm); cm.removeOverlay(getSearchState(cm).getOverlay()); @@ -4586,7 +4905,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ if (start instanceof Array) { return inArray(pos, start); } else { - if (end) { + if (typeof end == 'number') { return (pos >= start && pos <= end); } else { return pos == start; @@ -4603,7 +4922,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ function getMarkPos(cm, vim, markName) { if (markName == '\'' || markName == '`') { - return vimGlobalState.jumpList.find(cm, -1) || Pos(0, 0); + return vimGlobalState.jumpList.find(cm, -1) || new Pos(0, 0); } else if (markName == '.') { return getLastEditPos(cm); } @@ -4643,7 +4962,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ try { this.parseInput_(cm, inputStream, params); } catch(e) { - showConfirm(cm, e); + showConfirm(cm, e.toString()); throw e; } var command; @@ -4662,7 +4981,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ this.parseCommandArgs_(inputStream, params, command); if (command.type == 'exToKey') { for (var i = 0; i < command.toKeys.length; i++) { - CodeMirror.Vim.handleKey(cm, command.toKeys[i], 'mapping'); + vimApi.handleKey(cm, command.toKeys[i], 'mapping'); } return; } else if (command.type == 'exToEx') { @@ -4681,7 +5000,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ params.callback(); } } catch(e) { - showConfirm(cm, e); + showConfirm(cm, e.toString()); throw e; } }, @@ -4696,7 +5015,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ result.lineEnd = this.parseLineSpec_(cm, inputStream); } } - var commandMatch = inputStream.match(/^(\w+)/); + var commandMatch = inputStream.match(/^(\w+|!!|@@|[!#&*<=>@~])/); if (commandMatch) { result.commandName = commandMatch[1]; } else { @@ -4817,7 +5136,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ var commandName = lhs.substring(1); if (this.commandMap_[commandName] && this.commandMap_[commandName].user) { delete this.commandMap_[commandName]; - return; + return true; } } else { var keys = lhs; @@ -4825,7 +5144,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ if (keys == defaultKeymap[i].keys && defaultKeymap[i].context === ctx) { defaultKeymap.splice(i, 1); - return; + return true; } } } @@ -4855,13 +5174,11 @@ dom.importCssString(".normal-mode .ace_cursor{\ vmap: function(cm, params) { this.map(cm, params, 'visual'); }, unmap: function(cm, params, ctx) { var mapArgs = params.args; - if (!mapArgs || mapArgs.length < 1) { + if (!mapArgs || mapArgs.length < 1 || !exCommandDispatcher.unmap(mapArgs[0], ctx)) { if (cm) { showConfirm(cm, 'No such mapping: ' + params.input); } - return; } - exCommandDispatcher.unmap(mapArgs[0], ctx); }, move: function(cm, params) { commandDispatcher.processCommand(cm, cm.state.vim, { @@ -4926,12 +5243,12 @@ dom.importCssString(".normal-mode .ace_cursor{\ registers: function(cm, params) { var regArgs = params.args; var registers = vimGlobalState.registerController.registers; - var regInfo = '----------Registers----------

'; + var regInfo = '----------Registers----------\n\n'; if (!regArgs) { for (var registerName in registers) { var text = registers[registerName].toString(); if (text.length) { - regInfo += '"' + registerName + ' ' + text + '
'; + regInfo += '"' + registerName + ' ' + text + '\n' } } } else { @@ -4943,7 +5260,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ continue; } var register = registers[registerName] || new Register(); - regInfo += '"' + registerName + ' ' + register.toString() + '
'; + regInfo += '"' + registerName + ' ' + register.toString() + '\n' } } showConfirm(cm, regInfo); @@ -4980,8 +5297,8 @@ dom.importCssString(".normal-mode .ace_cursor{\ var lineStart = params.line || cm.firstLine(); var lineEnd = params.lineEnd || params.line || cm.lastLine(); if (lineStart == lineEnd) { return; } - var curStart = Pos(lineStart, 0); - var curEnd = Pos(lineEnd, lineLength(cm, lineEnd)); + var curStart = new Pos(lineStart, 0); + var curEnd = new Pos(lineEnd, lineLength(cm, lineEnd)); var text = cm.getRange(curStart, curEnd).split('\n'); var numberRegex = pattern ? pattern : (number == 'decimal') ? /(-?)([\d]+)/ : @@ -5038,12 +5355,16 @@ dom.importCssString(".normal-mode .ace_cursor{\ } cm.replaceRange(text.join('\n'), curStart, curEnd); }, + vglobal: function(cm, params) { + this.global(cm, params); + }, global: function(cm, params) { var argString = params.argString; if (!argString) { showConfirm(cm, 'Regular Expression missing from global'); return; } + var inverted = params.commandName[0] === 'v'; var lineStart = (params.line !== undefined) ? params.line : cm.firstLine(); var lineEnd = params.lineEnd || params.line || cm.lastLine(); var tokens = splitBySlash(argString); @@ -5062,27 +5383,32 @@ dom.importCssString(".normal-mode .ace_cursor{\ } } var query = getSearchState(cm).getQuery(); - var matchedLines = [], content = ''; + var matchedLines = []; for (var i = lineStart; i <= lineEnd; i++) { - var matched = query.test(cm.getLine(i)); - if (matched) { - matchedLines.push(i+1); - content+= cm.getLine(i) + '
'; + var line = cm.getLineHandle(i); + var matched = query.test(line.text); + if (matched !== inverted) { + matchedLines.push(cmd ? line : line.text); } } if (!cmd) { - showConfirm(cm, content); + showConfirm(cm, matchedLines.join('\n')); return; } var index = 0; var nextCommand = function() { if (index < matchedLines.length) { - var command = matchedLines[index] + cmd; + var line = matchedLines[index++]; + var lineNum = cm.getLineNumber(line); + if (lineNum == null) { + nextCommand(); + return; + } + var command = (lineNum + 1) + cmd; exCommandDispatcher.processCommand(cm, command, { callback: nextCommand }); } - index++; }; nextCommand(); }, @@ -5102,10 +5428,6 @@ dom.importCssString(".normal-mode .ace_cursor{\ regexPart = new RegExp(regexPart).source; //normalize not escaped characters } replacePart = tokens[1]; - if (regexPart && regexPart[regexPart.length - 1] === '$') { - regexPart = regexPart.slice(0, regexPart.length - 1) + '\\n'; - replacePart = replacePart ? replacePart + '\n' : '\n'; - } if (replacePart !== undefined) { if (getOption('pcre')) { replacePart = unescapeRegexReplace(replacePart.replace(/([^\\])&/g,"$1$$&")); @@ -5128,11 +5450,9 @@ dom.importCssString(".normal-mode .ace_cursor{\ if (flagsPart) { if (flagsPart.indexOf('c') != -1) { confirm = true; - flagsPart.replace('c', ''); } if (flagsPart.indexOf('g') != -1) { global = true; - flagsPart.replace('g', ''); } if (getOption('pcre')) { regexPart = regexPart + '/' + flagsPart; @@ -5166,7 +5486,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ lineStart = lineEnd; lineEnd = lineStart + count - 1; } - var startPos = clipCursorToContent(cm, Pos(lineStart, 0)); + var startPos = clipCursorToContent(cm, new Pos(lineStart, 0)); var cursor = cm.getSearchCursor(query, startPos); doReplace(cm, confirm, global, lineStart, lineEnd, cursor, query, replacePart, params.callback); }, @@ -5243,7 +5563,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ replaceWith, callback) { cm.state.vim.exMode = true; var done = false; - var lastPos = searchCursor.from(); + var lastPos, modifiedLineNumber, joined; function replaceAll() { cm.operation(function() { while (!done) { @@ -5256,12 +5576,24 @@ dom.importCssString(".normal-mode .ace_cursor{\ function replace() { var text = cm.getRange(searchCursor.from(), searchCursor.to()); var newText = text.replace(query, replaceWith); + var unmodifiedLineNumber = searchCursor.to().line; searchCursor.replace(newText); + modifiedLineNumber = searchCursor.to().line; + lineEnd += modifiedLineNumber - unmodifiedLineNumber; + joined = modifiedLineNumber < unmodifiedLineNumber; + } + function findNextValidMatch() { + var lastMatchTo = lastPos && copyCursor(searchCursor.to()); + var match = searchCursor.findNext(); + if (match && !match[0] && lastMatchTo && cursorEqual(searchCursor.from(), lastMatchTo)) { + match = searchCursor.findNext(); + } + return match; } function next() { - while(searchCursor.findNext() && + while(findNextValidMatch() && isInRange(searchCursor.from(), lineStart, lineEnd)) { - if (!global && lastPos && searchCursor.from().line == lastPos.line) { + if (!global && searchCursor.from().line == modifiedLineNumber && !joined) { continue; } cm.scrollIntoView(searchCursor.from(), 30); @@ -5320,7 +5652,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ return; } showPrompt(cm, { - prefix: 'replace with ' + replaceWith + ' (y/n/a/q/l)', + prefix: hdom('span', 'replace with ', hdom('strong', replaceWith), ' (y/n/a/q/l)'), onKeyDown: onPromptKeyDown }); } @@ -5408,7 +5740,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ match = (/<\w+-.+?>|<\w+>|./).exec(text); key = match[0]; text = text.substring(match.index + key.length); - CodeMirror.Vim.handleKey(cm, key, 'macro'); + vimApi.handleKey(cm, key, 'macro'); if (vim.insertMode) { var changes = register.insertModeChanges[imc++].changes; vimGlobalState.macroModeState.lastInsertModeChanges.changes = @@ -5491,18 +5823,6 @@ dom.importCssString(".normal-mode .ace_cursor{\ } else if (!cm.curOp.isVimOp) { handleExternalSelection(cm, vim); } - if (vim.visualMode) { - updateFakeCursor(cm); - } - } - function updateFakeCursor(cm) { - var vim = cm.state.vim; - var from = clipCursorToContent(cm, copyCursor(vim.sel.head)); - var to = offsetCursor(from, 0, 1); - if (vim.fakeCursor) { - vim.fakeCursor.clear(); - } - vim.fakeCursor = cm.markText(from, to, {className: 'cm-animate-fat-cursor'}); } function handleExternalSelection(cm, vim, keepHPos) { var anchor = cm.getCursor('anchor'); @@ -5612,12 +5932,12 @@ dom.importCssString(".normal-mode .ace_cursor{\ if (change instanceof InsertModeKey) { CodeMirror.lookupKey(change.keyName, 'vim-insert', keyHandler); } else if (typeof change == "string") { - var cur = cm.getCursor(); - cm.replaceRange(change, cur, cur); + cm.replaceSelection(change); } else { var start = cm.getCursor(); var end = offsetCursor(start, 0, change[0].length); cm.replaceRange(change[0], start, end); + cm.setCursor(end); } } } @@ -5632,7 +5952,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ Vim = CodeMirror.Vim; var specialKey = {'return':'CR',backspace:'BS','delete':'Del',esc:'Esc', - left:'Left',right:'Right',up:'Up',down:'Down',space: 'Space', + left:'Left',right:'Right',up:'Up',down:'Down',space: 'Space',insert: 'Ins', home:'Home',end:'End',pageup:'PageUp',pagedown:'PageDown', enter: 'CR' }; function lookupKey(hashId, key, e) { @@ -5684,7 +6004,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ } else if (wasMultiselect && vim.visualBlock) { vim.wasInVisualBlock = true; } - + if (key == '' && !vim.insertMode && !vim.visualMode && wasMultiselect) { cm.ace.exitMultiSelectMode(); } else if (visualBlock || !wasMultiselect || cm.ace.inVirtualSelectionMode) { @@ -5703,7 +6023,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ anchor = offsetCursor(anchor, 0, anchorOffset); cm.state.vim.sel.head = head; cm.state.vim.sel.anchor = anchor; - + isHandled = handleKey(cm, key, origin); sel.$desiredColumn = cm.state.vim.lastHPos == -1 ? null : cm.state.vim.lastHPos; if (cm.virtualSelectionMode()) { @@ -5730,12 +6050,12 @@ dom.importCssString(".normal-mode .ace_cursor{\ var top = pixelPos.top; var left = pixelPos.left; if (!vim.insertMode) { - var isbackwards = !sel.cursor + var isbackwards = !sel.cursor ? session.selection.isBackwards() || session.selection.isEmpty() : Range.comparePoints(sel.cursor, sel.start) <= 0; if (!isbackwards && left > w) left -= w; - } + } if (!vim.insertMode && vim.status) { h = h / 2; top += h; @@ -5775,21 +6095,26 @@ dom.importCssString(".normal-mode .ace_cursor{\ data.inputChar = data.inputKey = null; } } + + if (cm.state.overwrite && vim.insertMode && key == "backspace" && hashId == 0) { + return {command: "gotoleft"} + } if (key == "c" && hashId == 1) { // key == "ctrl-c" if (!useragent.isMac && editor.getCopyText()) { editor.once("copy", function() { - editor.selection.clearSelection(); + if (vim.insertMode) editor.selection.clearSelection(); + else cm.operation(function() { exitVisualMode(cm); }); }); return {command: "null", passEvent: true}; } } - + if (key == "esc" && !vim.insertMode && !vim.visualMode && !cm.ace.inMultiSelectMode) { var searchState = getSearchState(cm); var overlay = searchState.getOverlay(); if (overlay) cm.removeOverlay(overlay); } - + if (hashId == -1 || hashId & 1 || hashId === 0 && key.length > 1) { var insertMode = vim.insertMode; var name = lookupKey(hashId, key, e || {}); @@ -5887,7 +6212,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ { keys: 'zA', type: 'action', action: 'fold', actionArgs: { toggle: true, all: true } }, { keys: 'zf', type: 'action', action: 'fold', actionArgs: { open: true, all: true } }, { keys: 'zd', type: 'action', action: 'fold', actionArgs: { open: true, all: true } }, - + { keys: '', type: 'action', action: 'aceCommand', actionArgs: { name: "addCursorAbove" } }, { keys: '', type: 'action', action: 'aceCommand', actionArgs: { name: "addCursorBelow" } }, { keys: '', type: 'action', action: 'aceCommand', actionArgs: { name: "addCursorAboveSkipCurrent" } }, @@ -5897,6 +6222,34 @@ dom.importCssString(".normal-mode .ace_cursor{\ { keys: '', type: 'action', action: 'aceCommand', actionArgs: { name: "selectNextBefore" } }, { keys: '', type: 'action', action: 'aceCommand', actionArgs: { name: "selectNextAfter" } } ); + + defaultKeymap.push({ + keys: 'gq', + type: 'operator', + operator: 'hardWrap' + }); + Vim.defineOperator("hardWrap", function(cm, operatorArgs, ranges, oldAnchor, newHead) { + var anchor = ranges[0].anchor.line; + var head = ranges[0].head.line; + if (operatorArgs.linewise) head--; + hardWrap(cm.ace, {startRow: anchor, endRow: head}); + return Pos(head, 0); + }); + defineOption('textwidth', undefined, 'number', ['tw'], function(width, cm) { + if (cm === undefined) { + return; + } + if (width === undefined) { + var value = cm.ace.getOption('printMarginColumn'); + return value; + } else { + var column = Math.round(width); + if (column > 1) { + cm.ace.setOption('printMarginColumn', column); + } + } + }); + actions.aceCommand = function(cm, actionArgs, vim) { cm.vimCmd = actionArgs; if (cm.ace.inVirtualSelectionMode) diff --git a/htdocs/includes/ace/src/keybinding-vscode.js b/htdocs/includes/ace/src/keybinding-vscode.js index 45ac5cf03ff..5ab34483c33 100644 --- a/htdocs/includes/ace/src/keybinding-vscode.js +++ b/htdocs/includes/ace/src/keybinding-vscode.js @@ -116,7 +116,7 @@ exports.handler.addCommands([{ [{ - bindKey: {mac: "Control-G", win: "Ctrl-G"}, + bindKey: {mac: "Ctrl-G", win: "Ctrl-G"}, name: "gotoline" }, { bindKey: {mac: "Command-Shift-L|Command-F2", win: "Ctrl-Shift-L|Ctrl-F2"}, @@ -158,10 +158,10 @@ exports.handler.addCommands([{ bindKey: {mac: "Command-[", win: "Ctrl-["}, name: "blockoutdent" }, { - bindKey: {mac: "Control-PageDown", win: "Alt-PageDown"}, + bindKey: {mac: "Ctrl-PageDown", win: "Alt-PageDown"}, name: "pagedown" }, { - bindKey: {mac: "Control-PageUp", win: "Alt-PageUp"}, + bindKey: {mac: "Ctrl-PageUp", win: "Alt-PageUp"}, name: "pageup" }, { bindKey: {mac: "Shift-Option-A", win: "Shift-Alt-A"}, diff --git a/htdocs/includes/ace/src/mode-abc.js b/htdocs/includes/ace/src/mode-abc.js index 94cb1605ec2..a1dd531b807 100644 --- a/htdocs/includes/ace/src/mode-abc.js +++ b/htdocs/includes/ace/src/mode-abc.js @@ -254,7 +254,10 @@ define("ace/mode/abc",["require","exports","module","ace/lib/oop","ace/mode/text oop.inherits(Mode, TextMode); (function () { + this.lineCommentStart = "%"; + this.$id = "ace/mode/abc"; + this.snippetFileId = "ace/snippets/abc"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-actionscript.js b/htdocs/includes/ace/src/mode-actionscript.js index f23c9d3ceb4..d9e6634b0d7 100644 --- a/htdocs/includes/ace/src/mode-actionscript.js +++ b/htdocs/includes/ace/src/mode-actionscript.js @@ -261,6 +261,7 @@ oop.inherits(Mode, TextMode); this.lineCommentStart = "//"; this.blockComment = {start: "/*", end: "*/"}; this.$id = "ace/mode/actionscript"; + this.snippetFileId = "ace/snippets/actionscript"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-alda.js b/htdocs/includes/ace/src/mode-alda.js new file mode 100644 index 00000000000..72470be79d0 --- /dev/null +++ b/htdocs/includes/ace/src/mode-alda.js @@ -0,0 +1,311 @@ +define("ace/mode/alda_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) { + "use strict"; + + var oop = require("../lib/oop"); + var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; + + var AldaHighlightRules = function() { + + this.$rules = { + pitch: [{ + token: "variable.parameter.operator.pitch.alda", + regex: /(?:[+\-]+|\=)/ + }, { + token: "", + regex: "", + next: "timing" + }], + timing: [{ + token: "string.quoted.operator.timing.alda", + regex: /\d+(?:s|ms)?/ + }, { + token: "", + regex: "", + next: "start" + }], + start: [{ + token: [ + "constant.language.instrument.alda", + "constant.language.instrument.alda", + "meta.part.call.alda", + "storage.type.nickname.alda", + "meta.part.call.alda" + ], + regex: /^([a-zA-Z]{2}[\w\-+\'()]*)((?:\s*\/\s*[a-zA-Z]{2}[\w\-+\'()]*)*)(?:(\s*)(\"[a-zA-Z]{2}[\w\-+\'()]*\"))?(\s*:)/ + }, { + token: [ + "text", + "entity.other.inherited-class.voice.alda", + "text" + ], + regex: /^(\s*)(V\d+)(:)/ + }, { + token: "comment.line.number-sign.alda", + regex: /#.*$/ + }, { + token: "entity.name.function.pipe.measure.alda", + regex: /\|/ + }, { + token: "comment.block.inline.alda", + regex: /\(comment\b/, + push: [{ + token: "comment.block.inline.alda", + regex: /\)/, + next: "pop" + }, { + defaultToken: "comment.block.inline.alda" + }] + }, { + token: "entity.name.function.marker.alda", + regex: /%[a-zA-Z]{2}[\w\-+\'()]*/ + }, { + token: "entity.name.function.at-marker.alda", + regex: /@[a-zA-Z]{2}[\w\-+\'()]*/ + }, { + token: "keyword.operator.octave-change.alda", + regex: /\bo\d+\b/ + }, { + token: "keyword.operator.octave-shift.alda", + regex: /[><]/ + }, { + token: "keyword.operator.repeat.alda", + regex: /\*\s*\d+/ + }, { + token: "string.quoted.operator.timing.alda", + regex: /[.]|r\d*(?:s|ms)?/ + },{ + token: "text", + regex: /([cdefgab])/, + next: "pitch" + }, { + token: "string.quoted.operator.timing.alda", + regex: /~/, + next: "timing" + }, { + token: "punctuation.section.embedded.cram.alda", + regex: /\}/, + next: "timing" + }, { + token: "constant.numeric.subchord.alda", + regex: /\// + }, { + todo: { + token: "punctuation.section.embedded.cram.alda", + regex: /\{/, + push: [{ + token: "punctuation.section.embedded.cram.alda", + regex: /\}/, + next: "pop" + }, { + include: "$self" + }] + } + }, { + todo: { + token: "keyword.control.sequence.alda", + regex: /\[/, + push: [{ + token: "keyword.control.sequence.alda", + regex: /\]/, + next: "pop" + }, { + include: "$self" + }] + } + }, { + token: "meta.inline.clojure.alda", + regex: /\(/, + push: [{ + token: "meta.inline.clojure.alda", + regex: /\)/, + next: "pop" + }, { + include: "source.clojure" + }, { + defaultToken: "meta.inline.clojure.alda" + }] + }] + }; + + this.normalizeRules(); + }; + + AldaHighlightRules.metaData = { + scopeName: "source.alda", + fileTypes: ["alda"], + name: "Alda" + }; + + + oop.inherits(AldaHighlightRules, TextHighlightRules); + + exports.AldaHighlightRules = AldaHighlightRules; + }); + +define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) { +"use strict"; + +var oop = require("../../lib/oop"); +var Range = require("../../range").Range; +var BaseFoldMode = require("./fold_mode").FoldMode; + +var FoldMode = exports.FoldMode = function(commentRegex) { + if (commentRegex) { + this.foldingStartMarker = new RegExp( + this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start) + ); + this.foldingStopMarker = new RegExp( + this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end) + ); + } +}; +oop.inherits(FoldMode, BaseFoldMode); + +(function() { + + this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/; + this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/; + this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/; + this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/; + this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/; + this._getFoldWidgetBase = this.getFoldWidget; + this.getFoldWidget = function(session, foldStyle, row) { + var line = session.getLine(row); + + if (this.singleLineBlockCommentRe.test(line)) { + if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line)) + return ""; + } + + var fw = this._getFoldWidgetBase(session, foldStyle, row); + + if (!fw && this.startRegionRe.test(line)) + return "start"; // lineCommentRegionStart + + return fw; + }; + + this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) { + var line = session.getLine(row); + + if (this.startRegionRe.test(line)) + return this.getCommentRegionBlock(session, line, row); + + var match = line.match(this.foldingStartMarker); + if (match) { + var i = match.index; + + if (match[1]) + return this.openingBracketBlock(session, match[1], row, i); + + var range = session.getCommentFoldRange(row, i + match[0].length, 1); + + if (range && !range.isMultiLine()) { + if (forceMultiline) { + range = this.getSectionRange(session, row); + } else if (foldStyle != "all") + range = null; + } + + return range; + } + + if (foldStyle === "markbegin") + return; + + var match = line.match(this.foldingStopMarker); + if (match) { + var i = match.index + match[0].length; + + if (match[1]) + return this.closingBracketBlock(session, match[1], row, i); + + return session.getCommentFoldRange(row, i, -1); + } + }; + + this.getSectionRange = function(session, row) { + var line = session.getLine(row); + var startIndent = line.search(/\S/); + var startRow = row; + var startColumn = line.length; + row = row + 1; + var endRow = row; + var maxRow = session.getLength(); + while (++row < maxRow) { + line = session.getLine(row); + var indent = line.search(/\S/); + if (indent === -1) + continue; + if (startIndent > indent) + break; + var subRange = this.getFoldWidgetRange(session, "all", row); + + if (subRange) { + if (subRange.start.row <= startRow) { + break; + } else if (subRange.isMultiLine()) { + row = subRange.end.row; + } else if (startIndent == indent) { + break; + } + } + endRow = row; + } + + return new Range(startRow, startColumn, endRow, session.getLine(endRow).length); + }; + this.getCommentRegionBlock = function(session, line, row) { + var startColumn = line.search(/\s*$/); + var maxRow = session.getLength(); + var startRow = row; + + var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/; + var depth = 1; + while (++row < maxRow) { + line = session.getLine(row); + var m = re.exec(line); + if (!m) continue; + if (m[1]) depth--; + else depth++; + + if (!depth) break; + } + + var endRow = row; + if (endRow > startRow) { + return new Range(startRow, startColumn, endRow, line.length); + } + }; + +}).call(FoldMode.prototype); + +}); + +define("ace/mode/alda",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/alda_highlight_rules","ace/mode/folding/cstyle"], function(require, exports, module) { +"use strict"; + +var oop = require("../lib/oop"); +var TextMode = require("./text").Mode; +var AldaHighlightRules = require("./alda_highlight_rules").AldaHighlightRules; +var FoldMode = require("./folding/cstyle").FoldMode; + +var Mode = function() { + this.HighlightRules = AldaHighlightRules; + this.foldingRules = new FoldMode(); +}; +oop.inherits(Mode, TextMode); + +(function() { + this.$id = "ace/mode/alda"; +}).call(Mode.prototype); + +exports.Mode = Mode; +}); (function() { + window.require(["ace/mode/alda"], function(m) { + if (typeof module == "object" && typeof exports == "object" && module) { + module.exports = m; + } + }); + })(); + \ No newline at end of file diff --git a/htdocs/includes/ace/src/mode-asl.js b/htdocs/includes/ace/src/mode-asl.js index 58c82631449..955838a94b4 100644 --- a/htdocs/includes/ace/src/mode-asl.js +++ b/htdocs/includes/ace/src/mode-asl.js @@ -58,16 +58,7 @@ define("ace/mode/asl_highlight_rules",["require","exports","module","ace/lib/oop var ASLHighlightRules = function() { var keywords = ( "Default|DefinitionBlock|Device|Method|Else|ElseIf|For|Function|If|Include|Method|Return|" + - "Scope|Switch|Case|While|Break|BreakPoint|Continue|NoOp|Wait" - ); - - var keywordOperators = ( - "Add|And|Decrement|Divide|Increment|Index|LAnd|LEqual|LGreater|LGreaterEqual|" + - "LLess|LLessEqual|LNot|LNotEqual|LOr|Mod|Multiply|NAnd|NOr|Not|Or|RefOf|Revision|" + - "ShiftLeft|ShiftRight|Subtract|XOr|DerefOf" - ); - - var buildinFunctions = ( + "Scope|Switch|Case|While|Break|BreakPoint|Continue|NoOp|Wait|True|False|" + "AccessAs|Acquire|Alias|BankField|Buffer|Concatenate|ConcatenateResTemplate|" + "CondRefOf|Connection|CopyObject|CreateBitField|CreateByteField|CreateDWordField|" + "CreateField|CreateQWordField|CreateWordField|DataTableRegion|Debug|" + @@ -83,6 +74,12 @@ define("ace/mode/asl_highlight_rules",["require","exports","module","ace/lib/oop "WordSpace" ); + var keywordOperators = ( + "Add|And|Decrement|Divide|Increment|Index|LAnd|LEqual|LGreater|LGreaterEqual|" + + "LLess|LLessEqual|LNot|LNotEqual|LOr|Mod|Multiply|NAnd|NOr|Not|Or|RefOf|Revision|" + + "ShiftLeft|ShiftRight|Subtract|XOr|DerefOf" + ); + var flags = ( "AttribQuick|AttribSendReceive|AttribByte|AttribBytes|AttribRawBytes|" + "AttribRawProcessBytes|AttribWord|AttribBlock|AttribProcessCall|AttribBlockProcessCall|" + @@ -121,21 +118,25 @@ define("ace/mode/asl_highlight_rules",["require","exports","module","ace/lib/oop "ThermalZoneObj|BuffFieldObj|DDBHandleObj" ); - var buildinConstants = ( + var builtinConstants = ( "__FILE__|__PATH__|__LINE__|__DATE__|__IASL__" ); + var strNumbers = ( + "One|Ones|Zero" + ); + var deprecated = ( "Memory24|Processor" ); var keywordMapper = this.createKeywordMapper({ "keyword": keywords, + "constant.numeric": strNumbers, "keyword.operator": keywordOperators, - "function.buildin": buildinFunctions, - "constant.language": buildinConstants, + "constant.language": builtinConstants, "storage.type": storageTypes, - "constant.character": flags, + "constant.library": flags, "invalid.deprecated": deprecated }, "identifier"); @@ -174,13 +175,13 @@ define("ace/mode/asl_highlight_rules",["require","exports","module","ace/lib/oop regex : /0[xX][0-9a-fA-F]+\b/ }, { token : "constant.numeric", - regex : /(One(s)?|Zero|True|False|[0-9]+)\b/ + regex : /[0-9]+\b/ }, { token : keywordMapper, regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" }, { token : "keyword.operator", - regex : "/|!|\\$|%|&|\\||\\*|\\-\\-|\\-|\\+\\+|\\+|~|==|=|!=|\\^|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\|=" + regex : /[!\~\*\/%+-<>\^|=&]/ }, { token : "lparen", regex : "[[({]" diff --git a/htdocs/includes/ace/src/mode-bro.js b/htdocs/includes/ace/src/mode-bro.js deleted file mode 100644 index 86521764689..00000000000 --- a/htdocs/includes/ace/src/mode-bro.js +++ /dev/null @@ -1,334 +0,0 @@ -define("ace/mode/bro_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) { -"use strict"; - -var oop = require("../lib/oop"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var BroHighlightRules = function() { - - this.$rules = { - start: [{ - token: "punctuation.definition.comment.bro", - regex: /#/, - push: [{ - token: "comment.line.number-sign.bro", - regex: /$/, - next: "pop" - }, { - defaultToken: "comment.line.number-sign.bro" - }] - }, { - token: "keyword.control.bro", - regex: /\b(?:break|case|continue|else|for|if|return|switch|next|when|timeout|schedule)\b/ - }, { - token: [ - "meta.function.bro", - "meta.function.bro", - "storage.type.bro", - "meta.function.bro", - "entity.name.function.bro", - "meta.function.bro" - ], - regex: /^(\s*)(?:function|hook|event)(\s*)(.*)(\s*\()(.*)(\).*$)/ - }, { - token: "storage.type.bro", - regex: /\b(?:bool|enum|double|int|count|port|addr|subnet|any|file|interval|time|string|table|vector|set|record|pattern|hook)\b/ - }, { - token: "storage.modifier.bro", - regex: /\b(?:global|const|redef|local|&(?:optional|rotate_interval|rotate_size|add_func|del_func|expire_func|expire_create|expire_read|expire_write|persistent|synchronized|encrypt|mergeable|priority|group|type_column|log|error_handler))\b/ - }, { - token: "keyword.operator.bro", - regex: /\s*(?:\||&&|(?:>|<|!)=?|==)\s*|\b!?in\b/ - }, { - token: "constant.language.bro", - regex: /\b(?:T|F)\b/ - }, { - token: "constant.numeric.bro", - regex: /\b(?:0(?:x|X)[0-9a-fA-F]*|(?:[0-9]+\.?[0-9]*|\.[0-9]+)(?:(?:e|E)(?:\+|-)?[0-9]+)?)(?:\/(?:tcp|udp|icmp)|\s*(?:u?sec|min|hr|day)s?)?\b/ - }, { - token: "punctuation.definition.string.begin.bro", - regex: /"/, - push: [{ - token: "punctuation.definition.string.end.bro", - regex: /"/, - next: "pop" - }, { - include: "#string_escaped_char" - }, { - include: "#string_placeholder" - }, { - defaultToken: "string.quoted.double.bro" - }] - }, { - token: "punctuation.definition.string.begin.bro", - regex: /\//, - push: [{ - token: "punctuation.definition.string.end.bro", - regex: /\//, - next: "pop" - }, { - include: "#string_escaped_char" - }, { - include: "#string_placeholder" - }, { - defaultToken: "string.quoted.regex.bro" - }] - }, { - token: [ - "meta.preprocessor.bro.load", - "keyword.other.special-method.bro" - ], - regex: /^(\s*)(\@load(?:-sigs)?)\b/, - push: [{ - token: [], - regex: /(?=\#)|$/, - next: "pop" - }, { - defaultToken: "meta.preprocessor.bro.load" - }] - }, { - token: [ - "meta.preprocessor.bro.if", - "keyword.other.special-method.bro", - "meta.preprocessor.bro.if" - ], - regex: /^(\s*)(\@endif|\@if(?:n?def)?)(.*$)/, - push: [{ - token: [], - regex: /$/, - next: "pop" - }, { - defaultToken: "meta.preprocessor.bro.if" - }] - }], - "#disabled": [{ - token: "text", - regex: /^\s*\@if(?:n?def)?\b.*$/, - push: [{ - token: "text", - regex: /^\s*\@endif\b.*$/, - next: "pop" - }, { - include: "#disabled" - }, { - include: "#pragma-mark" - }], - comment: "eat nested preprocessor ifdefs" - }], - "#preprocessor-rule-other": [{ - token: [ - "text", - "meta.preprocessor.bro", - "meta.preprocessor.bro", - "text" - ], - regex: /^(\s*)(@if)((?:n?def)?)\b(.*?)(?:(?=)|$)/, - push: [{ - token: ["text", "meta.preprocessor.bro", "text"], - regex: /^(\s*)(@endif)\b(.*$)/, - next: "pop" - }, { - include: "$base" - }] - }], - "#string_escaped_char": [{ - token: "constant.character.escape.bro", - regex: /\\(?:\\|[abefnprtv'"?]|[0-3]\d{,2}|[4-7]\d?|x[a-fA-F0-9]{,2})/ - }, { - token: "invalid.illegal.unknown-escape.bro", - regex: /\\./ - }], - "#string_placeholder": [{ - token: "constant.other.placeholder.bro", - regex: /%(?:\d+\$)?[#0\- +']*[,;:_]?(?:-?\d+|\*(?:-?\d+\$)?)?(?:\.(?:-?\d+|\*(?:-?\d+\$)?)?)?(?:hh|h|ll|l|j|t|z|q|L|vh|vl|v|hv|hl)?[diouxXDOUeEfFgGaACcSspn%]/ - }, { - token: "invalid.illegal.placeholder.bro", - regex: /%/ - }] - }; - - this.normalizeRules(); -}; - -BroHighlightRules.metaData = { - fileTypes: ["bro"], - foldingStartMarker: "^(\\@if(n?def)?)", - foldingStopMarker: "^\\@endif", - keyEquivalent: "@B", - name: "Bro", - scopeName: "source.bro" -}; - - -oop.inherits(BroHighlightRules, TextHighlightRules); - -exports.BroHighlightRules = BroHighlightRules; -}); - -define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) { -"use strict"; - -var oop = require("../../lib/oop"); -var Range = require("../../range").Range; -var BaseFoldMode = require("./fold_mode").FoldMode; - -var FoldMode = exports.FoldMode = function(commentRegex) { - if (commentRegex) { - this.foldingStartMarker = new RegExp( - this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start) - ); - this.foldingStopMarker = new RegExp( - this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end) - ); - } -}; -oop.inherits(FoldMode, BaseFoldMode); - -(function() { - - this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/; - this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/; - this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/; - this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/; - this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/; - this._getFoldWidgetBase = this.getFoldWidget; - this.getFoldWidget = function(session, foldStyle, row) { - var line = session.getLine(row); - - if (this.singleLineBlockCommentRe.test(line)) { - if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line)) - return ""; - } - - var fw = this._getFoldWidgetBase(session, foldStyle, row); - - if (!fw && this.startRegionRe.test(line)) - return "start"; // lineCommentRegionStart - - return fw; - }; - - this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) { - var line = session.getLine(row); - - if (this.startRegionRe.test(line)) - return this.getCommentRegionBlock(session, line, row); - - var match = line.match(this.foldingStartMarker); - if (match) { - var i = match.index; - - if (match[1]) - return this.openingBracketBlock(session, match[1], row, i); - - var range = session.getCommentFoldRange(row, i + match[0].length, 1); - - if (range && !range.isMultiLine()) { - if (forceMultiline) { - range = this.getSectionRange(session, row); - } else if (foldStyle != "all") - range = null; - } - - return range; - } - - if (foldStyle === "markbegin") - return; - - var match = line.match(this.foldingStopMarker); - if (match) { - var i = match.index + match[0].length; - - if (match[1]) - return this.closingBracketBlock(session, match[1], row, i); - - return session.getCommentFoldRange(row, i, -1); - } - }; - - this.getSectionRange = function(session, row) { - var line = session.getLine(row); - var startIndent = line.search(/\S/); - var startRow = row; - var startColumn = line.length; - row = row + 1; - var endRow = row; - var maxRow = session.getLength(); - while (++row < maxRow) { - line = session.getLine(row); - var indent = line.search(/\S/); - if (indent === -1) - continue; - if (startIndent > indent) - break; - var subRange = this.getFoldWidgetRange(session, "all", row); - - if (subRange) { - if (subRange.start.row <= startRow) { - break; - } else if (subRange.isMultiLine()) { - row = subRange.end.row; - } else if (startIndent == indent) { - break; - } - } - endRow = row; - } - - return new Range(startRow, startColumn, endRow, session.getLine(endRow).length); - }; - this.getCommentRegionBlock = function(session, line, row) { - var startColumn = line.search(/\s*$/); - var maxRow = session.getLength(); - var startRow = row; - - var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/; - var depth = 1; - while (++row < maxRow) { - line = session.getLine(row); - var m = re.exec(line); - if (!m) continue; - if (m[1]) depth--; - else depth++; - - if (!depth) break; - } - - var endRow = row; - if (endRow > startRow) { - return new Range(startRow, startColumn, endRow, line.length); - } - }; - -}).call(FoldMode.prototype); - -}); - -define("ace/mode/bro",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/bro_highlight_rules","ace/mode/folding/cstyle"], function(require, exports, module) { -"use strict"; - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var BroHighlightRules = require("./bro_highlight_rules").BroHighlightRules; -var FoldMode = require("./folding/cstyle").FoldMode; - -var Mode = function() { - this.HighlightRules = BroHighlightRules; - this.foldingRules = new FoldMode(); -}; -oop.inherits(Mode, TextMode); - -(function() { - this.$id = "ace/mode/bro"; -}).call(Mode.prototype); - -exports.Mode = Mode; -}); (function() { - window.require(["ace/mode/bro"], function(m) { - if (typeof module == "object" && typeof exports == "object" && module) { - module.exports = m; - } - }); - })(); - \ No newline at end of file diff --git a/htdocs/includes/ace/src/mode-c_cpp.js b/htdocs/includes/ace/src/mode-c_cpp.js index 4e653ebe028..da730717d6c 100644 --- a/htdocs/includes/ace/src/mode-c_cpp.js +++ b/htdocs/includes/ace/src/mode-c_cpp.js @@ -65,7 +65,7 @@ var c_cppHighlightRules = function() { var storageType = ( "asm|__asm__|auto|bool|_Bool|char|_Complex|double|enum|float|" + - "_Imaginary|int|long|short|signed|struct|typedef|union|unsigned|void|" + + "_Imaginary|int|int8_t|int16_t|int32_t|int64_t|long|short|signed|size_t|struct|typedef|uint8_t|uint16_t|uint32_t|uint64_t|union|unsigned|void|" + "class|wchar_t|template|char16_t|char32_t" ); @@ -489,6 +489,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/c_cpp"; + this.snippetFileId = "ace/snippets/c_cpp"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-clojure.js b/htdocs/includes/ace/src/mode-clojure.js index 1f7f41841a7..dd10ec76dd2 100644 --- a/htdocs/includes/ace/src/mode-clojure.js +++ b/htdocs/includes/ace/src/mode-clojure.js @@ -301,6 +301,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/clojure"; + this.snippetFileId = "ace/snippets/clojure"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-coffee.js b/htdocs/includes/ace/src/mode-coffee.js index 75d19d4d3ff..063883c9f58 100644 --- a/htdocs/includes/ace/src/mode-coffee.js +++ b/htdocs/includes/ace/src/mode-coffee.js @@ -385,6 +385,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/coffee"; + this.snippetFileId = "ace/snippets/coffee"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-coldfusion.js b/htdocs/includes/ace/src/mode-coldfusion.js index 8b85c12e940..fcb742db282 100644 --- a/htdocs/includes/ace/src/mode-coldfusion.js +++ b/htdocs/includes/ace/src/mode-coldfusion.js @@ -784,6 +784,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/javascript"; + this.snippetFileId = "ace/snippets/javascript"; }).call(Mode.prototype); exports.Mode = Mode; @@ -1316,6 +1317,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/css"; + this.snippetFileId = "ace/snippets/css"; }).call(Mode.prototype); exports.Mode = Mode; @@ -2493,6 +2495,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/html"; + this.snippetFileId = "ace/snippets/html"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-csound_document.js b/htdocs/includes/ace/src/mode-csound_document.js index ae92fce17e1..de242e5c184 100644 --- a/htdocs/includes/ace/src/mode-csound_document.js +++ b/htdocs/includes/ace/src/mode-csound_document.js @@ -300,7 +300,7 @@ var CsoundScoreHighlightRules = function(embeddedRulePrefix) { start.push( { token : "keyword.control.csound-score", - regex : /[abCdefiqstvxy]/ + regex : /[aBbCdefiqstvxy]/ }, { token : "invalid.illegal.csound-score", regex : /w/ @@ -935,10 +935,10 @@ var PythonHighlightRules = function() { regex: "\\s+" }, { token: "string", - regex: "'(.)*'" + regex: "'[^']*'" }, { token: "string", - regex: '"(.)*"' + regex: '"[^"]*"' }, { token: "function.support", regex: "(!s|!r|!a)" @@ -1141,6 +1141,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "adsynt", "adsynt2", "aftouch", + "allpole", "alpass", "alwayson", "ampdb", @@ -1148,11 +1149,17 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "ampmidi", "ampmidicurve", "ampmidid", + "apoleparams", + "arduinoRead", + "arduinoReadF", + "arduinoStart", + "arduinoStop", "areson", "aresonk", "atone", "atonek", "atonex", + "autocorr", "babo", "balance", "balance2", @@ -1160,8 +1167,6 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "barmodel", "bbcutm", "bbcuts", - "beadsynt", - "beosc", "betarand", "bexprnd", "bformdec1", @@ -1170,6 +1175,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "biquad", "biquada", "birnd", + "bob", "bpf", "bpfcos", "bqrez", @@ -1195,6 +1201,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "ceps", "cepsinv", "chanctrl", + "changed", "changed2", "chani", "chano", @@ -1206,11 +1213,19 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "chnclear", "chnexport", "chnget", + "chngeta", + "chngeti", + "chngetk", "chngetks", + "chngets", "chnmix", "chnparams", "chnset", + "chnseta", + "chnseti", + "chnsetk", "chnsetks", + "chnsets", "chuap", "clear", "clfilt", @@ -1219,6 +1234,13 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "clockon", "cmp", "cmplxprod", + "cntCreate", + "cntCycles", + "cntDelete", + "cntDelete_i", + "cntRead", + "cntReset", + "cntState", "comb", "combinv", "compilecsd", @@ -1238,6 +1260,8 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "cosseg", "cossegb", "cossegr", + "count", + "count_i", "cps2pch", "cpsmidi", "cpsmidib", @@ -1263,6 +1287,11 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "ctrl21", "ctrl7", "ctrlinit", + "ctrlpreset", + "ctrlprint", + "ctrlprintpresets", + "ctrlsave", + "ctrlselect", "cuserrnd", "dam", "date", @@ -1408,6 +1437,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "ftchnls", "ftconv", "ftcps", + "ftexists", "ftfree", "ftgen", "ftgenonce", @@ -1424,7 +1454,9 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "ftsamplebank", "ftsave", "ftsavek", + "ftset", "ftslice", + "ftslicei", "ftsr", "gain", "gainslider", @@ -1441,7 +1473,6 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "getcol", "getftargs", "getrow", - "getrowlin", "getseed", "gogobel", "grain", @@ -1689,8 +1720,12 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "la_k_upper_solve_mr", "la_k_vc_set", "la_k_vr_set", + "lag", + "lagud", + "lastcycle", "lenarray", "lfo", + "lfsr", "limit", "limit1", "lincos", @@ -1734,6 +1769,8 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "lowpass2", "lowres", "lowresx", + "lpcanal", + "lpcfilter", "lpf18", "lpform", "lpfreson", @@ -1749,14 +1786,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "lpshold", "lpsholdp", "lpslot", - "lua_exec", - "lua_iaopcall", - "lua_iaopcall_off", - "lua_ikopcall", - "lua_ikopcall_off", - "lua_iopcall", - "lua_iopcall_off", - "lua_opdef", + "lufs", "mac", "maca", "madsr", @@ -1779,6 +1809,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "median", "mediank", "metro", + "metro2", "mfb", "midglobal", "midiarp", @@ -1831,6 +1862,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "mp3sr", "mpulse", "mrtmsg", + "ms2st", "mtof", "mton", "multitap", @@ -1840,6 +1872,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "mvclpf2", "mvclpf3", "mvclpf4", + "mvmfilter", "mxadsr", "nchnls_hw", "nestedap", @@ -1883,6 +1916,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "oscilx", "out", "out32", + "outall", "outc", "outch", "outh", @@ -1983,12 +2017,11 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "printk2", "printks", "printks2", + "println", "prints", + "printsk", "product", "pset", - "ptable", - "ptable3", - "ptablei", "ptablew", "ptrack", "puts", @@ -2005,6 +2038,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "pvsarp", "pvsbandp", "pvsbandr", + "pvsbandwidth", "pvsbin", "pvsblur", "pvsbuffer", @@ -2013,6 +2047,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "pvscale", "pvscent", "pvsceps", + "pvscfs", "pvscross", "pvsdemix", "pvsdiskin", @@ -2032,6 +2067,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "pvsinfo", "pvsinit", "pvslock", + "pvslpc", "pvsmaska", "pvsmix", "pvsmooth", @@ -2133,6 +2169,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "qnan", "r2c", "rand", + "randc", "randh", "randi", "random", @@ -2156,6 +2193,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "repluck", "reshapearray", "reson", + "resonbnk", "resonk", "resonr", "resonx", @@ -2173,6 +2211,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "rms", "rnd", "rnd31", + "rndseed", "round", "rspline", "rtclock", @@ -2185,14 +2224,17 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "sc_phasor", "sc_trig", "scale", + "scale2", "scalearray", "scanhammer", "scans", "scantable", "scanu", + "scanu2", "schedkwhen", "schedkwhennamed", "schedule", + "schedulek", "schedwhen", "scoreline", "scoreline_i", @@ -2238,6 +2280,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "sinh", "sininv", "sinsyn", + "skf", "sleighbells", "slicearray", "slicearray_i", @@ -2273,13 +2316,16 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "spat3di", "spat3dt", "spdist", + "spf", "splitrig", "sprintf", "sprintfk", "spsend", "sqrt", "squinewave", + "st2ms", "statevar", + "sterrain", "stix", "strcat", "strcatk", @@ -2303,6 +2349,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "strrindex", "strrindexk", "strset", + "strstrip", "strsub", "strsubk", "strtod", @@ -2317,6 +2364,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "sum", "sumarray", "svfilter", + "svn", "syncgrain", "syncloop", "syncphasor", @@ -2357,7 +2405,6 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "tabmorphi", "tabplay", "tabrec", - "tabrowlin", "tabsum", "tabw", "tabw_i", @@ -2389,7 +2436,11 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "trcross", "trfilter", "trhighest", + "trigExpseg", + "trigLinseg", "trigger", + "trighold", + "trigphasor", "trigseq", "trim", "trim_i", @@ -2401,6 +2452,8 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "trsplit", "turnoff", "turnoff2", + "turnoff2_i", + "turnoff3", "turnon", "tvconv", "unirand", @@ -2424,6 +2477,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "vbapz", "vbapzmove", "vcella", + "vclpf", "vco", "vco2", "vco2ft", @@ -2472,6 +2526,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "vpow_i", "vpowv", "vpowv_i", + "vps", "vpvoc", "vrandh", "vrandi", @@ -2511,6 +2566,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "wrap", "writescratch", "wterrain", + "wterrain2", "xadsr", "xin", "xout", @@ -2543,24 +2599,47 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "zkwm" ]; var deprecatedOpcodes = [ + "OSCsendA", "array", + "beadsynt", + "beosc", "bformdec", "bformenc", - "changed", + "buchla", "copy2ftab", "copy2ttab", + "getrowlin", "hrtfer", "ktableseg", "lentab", + "lua_exec", + "lua_iaopcall", + "lua_iaopcall_off", + "lua_ikopcall", + "lua_ikopcall_off", + "lua_iopcall", + "lua_iopcall_off", + "lua_opdef", "maxtab", "mintab", + "mp3scal_check", + "mp3scal_load", + "mp3scal_load2", + "mp3scal_play", + "mp3scal_play2", "pop", "pop_f", + "ptable", + "ptable3", + "ptablei", "ptableiw", "push", "push_f", + "pvsgendy", "scalet", + "signalflowgraph", "sndload", + "socksend_k", "soundout", "soundouts", "specaddm", @@ -2573,11 +2652,14 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "specsum", "spectrum", "stack", + "sumTableFilter", "sumtab", + "systime", "tabgen", "tableiw", "tabmap", "tabmap_i", + "tabrowlin", "tabslice", "tb0", "tb0_init", @@ -2612,6 +2694,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "tb9", "tb9_init", "vbap16", + "vbap1move", "vbap4", "vbap4move", "vbap8", @@ -4006,6 +4089,11 @@ var Mode = function() { }; oop.inherits(Mode, TextMode); +(function() { + this.$id = "ace/mode/csound_document"; + this.snippetFileId = "ace/snippets/csound_document"; +}).call(Mode.prototype); + exports.Mode = Mode; }); (function() { window.require(["ace/mode/csound_document"], function(m) { diff --git a/htdocs/includes/ace/src/mode-csound_orchestra.js b/htdocs/includes/ace/src/mode-csound_orchestra.js index 7cb3917c9f4..58f932eceee 100644 --- a/htdocs/includes/ace/src/mode-csound_orchestra.js +++ b/htdocs/includes/ace/src/mode-csound_orchestra.js @@ -300,7 +300,7 @@ var CsoundScoreHighlightRules = function(embeddedRulePrefix) { start.push( { token : "keyword.control.csound-score", - regex : /[abCdefiqstvxy]/ + regex : /[aBbCdefiqstvxy]/ }, { token : "invalid.illegal.csound-score", regex : /w/ @@ -935,10 +935,10 @@ var PythonHighlightRules = function() { regex: "\\s+" }, { token: "string", - regex: "'(.)*'" + regex: "'[^']*'" }, { token: "string", - regex: '"(.)*"' + regex: '"[^"]*"' }, { token: "function.support", regex: "(!s|!r|!a)" @@ -1141,6 +1141,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "adsynt", "adsynt2", "aftouch", + "allpole", "alpass", "alwayson", "ampdb", @@ -1148,11 +1149,17 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "ampmidi", "ampmidicurve", "ampmidid", + "apoleparams", + "arduinoRead", + "arduinoReadF", + "arduinoStart", + "arduinoStop", "areson", "aresonk", "atone", "atonek", "atonex", + "autocorr", "babo", "balance", "balance2", @@ -1160,8 +1167,6 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "barmodel", "bbcutm", "bbcuts", - "beadsynt", - "beosc", "betarand", "bexprnd", "bformdec1", @@ -1170,6 +1175,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "biquad", "biquada", "birnd", + "bob", "bpf", "bpfcos", "bqrez", @@ -1195,6 +1201,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "ceps", "cepsinv", "chanctrl", + "changed", "changed2", "chani", "chano", @@ -1206,11 +1213,19 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "chnclear", "chnexport", "chnget", + "chngeta", + "chngeti", + "chngetk", "chngetks", + "chngets", "chnmix", "chnparams", "chnset", + "chnseta", + "chnseti", + "chnsetk", "chnsetks", + "chnsets", "chuap", "clear", "clfilt", @@ -1219,6 +1234,13 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "clockon", "cmp", "cmplxprod", + "cntCreate", + "cntCycles", + "cntDelete", + "cntDelete_i", + "cntRead", + "cntReset", + "cntState", "comb", "combinv", "compilecsd", @@ -1238,6 +1260,8 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "cosseg", "cossegb", "cossegr", + "count", + "count_i", "cps2pch", "cpsmidi", "cpsmidib", @@ -1263,6 +1287,11 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "ctrl21", "ctrl7", "ctrlinit", + "ctrlpreset", + "ctrlprint", + "ctrlprintpresets", + "ctrlsave", + "ctrlselect", "cuserrnd", "dam", "date", @@ -1408,6 +1437,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "ftchnls", "ftconv", "ftcps", + "ftexists", "ftfree", "ftgen", "ftgenonce", @@ -1424,7 +1454,9 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "ftsamplebank", "ftsave", "ftsavek", + "ftset", "ftslice", + "ftslicei", "ftsr", "gain", "gainslider", @@ -1441,7 +1473,6 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "getcol", "getftargs", "getrow", - "getrowlin", "getseed", "gogobel", "grain", @@ -1689,8 +1720,12 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "la_k_upper_solve_mr", "la_k_vc_set", "la_k_vr_set", + "lag", + "lagud", + "lastcycle", "lenarray", "lfo", + "lfsr", "limit", "limit1", "lincos", @@ -1734,6 +1769,8 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "lowpass2", "lowres", "lowresx", + "lpcanal", + "lpcfilter", "lpf18", "lpform", "lpfreson", @@ -1749,14 +1786,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "lpshold", "lpsholdp", "lpslot", - "lua_exec", - "lua_iaopcall", - "lua_iaopcall_off", - "lua_ikopcall", - "lua_ikopcall_off", - "lua_iopcall", - "lua_iopcall_off", - "lua_opdef", + "lufs", "mac", "maca", "madsr", @@ -1779,6 +1809,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "median", "mediank", "metro", + "metro2", "mfb", "midglobal", "midiarp", @@ -1831,6 +1862,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "mp3sr", "mpulse", "mrtmsg", + "ms2st", "mtof", "mton", "multitap", @@ -1840,6 +1872,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "mvclpf2", "mvclpf3", "mvclpf4", + "mvmfilter", "mxadsr", "nchnls_hw", "nestedap", @@ -1883,6 +1916,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "oscilx", "out", "out32", + "outall", "outc", "outch", "outh", @@ -1983,12 +2017,11 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "printk2", "printks", "printks2", + "println", "prints", + "printsk", "product", "pset", - "ptable", - "ptable3", - "ptablei", "ptablew", "ptrack", "puts", @@ -2005,6 +2038,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "pvsarp", "pvsbandp", "pvsbandr", + "pvsbandwidth", "pvsbin", "pvsblur", "pvsbuffer", @@ -2013,6 +2047,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "pvscale", "pvscent", "pvsceps", + "pvscfs", "pvscross", "pvsdemix", "pvsdiskin", @@ -2032,6 +2067,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "pvsinfo", "pvsinit", "pvslock", + "pvslpc", "pvsmaska", "pvsmix", "pvsmooth", @@ -2133,6 +2169,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "qnan", "r2c", "rand", + "randc", "randh", "randi", "random", @@ -2156,6 +2193,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "repluck", "reshapearray", "reson", + "resonbnk", "resonk", "resonr", "resonx", @@ -2173,6 +2211,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "rms", "rnd", "rnd31", + "rndseed", "round", "rspline", "rtclock", @@ -2185,14 +2224,17 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "sc_phasor", "sc_trig", "scale", + "scale2", "scalearray", "scanhammer", "scans", "scantable", "scanu", + "scanu2", "schedkwhen", "schedkwhennamed", "schedule", + "schedulek", "schedwhen", "scoreline", "scoreline_i", @@ -2238,6 +2280,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "sinh", "sininv", "sinsyn", + "skf", "sleighbells", "slicearray", "slicearray_i", @@ -2273,13 +2316,16 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "spat3di", "spat3dt", "spdist", + "spf", "splitrig", "sprintf", "sprintfk", "spsend", "sqrt", "squinewave", + "st2ms", "statevar", + "sterrain", "stix", "strcat", "strcatk", @@ -2303,6 +2349,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "strrindex", "strrindexk", "strset", + "strstrip", "strsub", "strsubk", "strtod", @@ -2317,6 +2364,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "sum", "sumarray", "svfilter", + "svn", "syncgrain", "syncloop", "syncphasor", @@ -2357,7 +2405,6 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "tabmorphi", "tabplay", "tabrec", - "tabrowlin", "tabsum", "tabw", "tabw_i", @@ -2389,7 +2436,11 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "trcross", "trfilter", "trhighest", + "trigExpseg", + "trigLinseg", "trigger", + "trighold", + "trigphasor", "trigseq", "trim", "trim_i", @@ -2401,6 +2452,8 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "trsplit", "turnoff", "turnoff2", + "turnoff2_i", + "turnoff3", "turnon", "tvconv", "unirand", @@ -2424,6 +2477,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "vbapz", "vbapzmove", "vcella", + "vclpf", "vco", "vco2", "vco2ft", @@ -2472,6 +2526,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "vpow_i", "vpowv", "vpowv_i", + "vps", "vpvoc", "vrandh", "vrandi", @@ -2511,6 +2566,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "wrap", "writescratch", "wterrain", + "wterrain2", "xadsr", "xin", "xout", @@ -2543,24 +2599,47 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "zkwm" ]; var deprecatedOpcodes = [ + "OSCsendA", "array", + "beadsynt", + "beosc", "bformdec", "bformenc", - "changed", + "buchla", "copy2ftab", "copy2ttab", + "getrowlin", "hrtfer", "ktableseg", "lentab", + "lua_exec", + "lua_iaopcall", + "lua_iaopcall_off", + "lua_ikopcall", + "lua_ikopcall_off", + "lua_iopcall", + "lua_iopcall_off", + "lua_opdef", "maxtab", "mintab", + "mp3scal_check", + "mp3scal_load", + "mp3scal_load2", + "mp3scal_play", + "mp3scal_play2", "pop", "pop_f", + "ptable", + "ptable3", + "ptablei", "ptableiw", "push", "push_f", + "pvsgendy", "scalet", + "signalflowgraph", "sndload", + "socksend_k", "soundout", "soundouts", "specaddm", @@ -2573,11 +2652,14 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "specsum", "spectrum", "stack", + "sumTableFilter", "sumtab", + "systime", "tabgen", "tableiw", "tabmap", "tabmap_i", + "tabrowlin", "tabslice", "tb0", "tb0_init", @@ -2612,6 +2694,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "tb9", "tb9_init", "vbap16", + "vbap1move", "vbap4", "vbap4move", "vbap8", @@ -2937,6 +3020,8 @@ oop.inherits(Mode, TextMode); this.lineCommentStart = ";"; this.blockComment = {start: "/*", end: "*/"}; + this.$id = "ace/mode/csound_orchestra"; + this.snippetFileId = "ace/snippets/csound_orchestra"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-csound_score.js b/htdocs/includes/ace/src/mode-csound_score.js index e7168662e1a..3155ca1ab67 100644 --- a/htdocs/includes/ace/src/mode-csound_score.js +++ b/htdocs/includes/ace/src/mode-csound_score.js @@ -300,7 +300,7 @@ var CsoundScoreHighlightRules = function(embeddedRulePrefix) { start.push( { token : "keyword.control.csound-score", - regex : /[abCdefiqstvxy]/ + regex : /[aBbCdefiqstvxy]/ }, { token : "invalid.illegal.csound-score", regex : /w/ @@ -448,6 +448,7 @@ oop.inherits(Mode, TextMode); this.lineCommentStart = ";"; this.blockComment = {start: "/*", end: "*/"}; + this.$id = "ace/mode/csound_score"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-css.js b/htdocs/includes/ace/src/mode-css.js index 5ccc1ae304c..04560163b76 100644 --- a/htdocs/includes/ace/src/mode-css.js +++ b/htdocs/includes/ace/src/mode-css.js @@ -705,6 +705,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/css"; + this.snippetFileId = "ace/snippets/css"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-curly.js b/htdocs/includes/ace/src/mode-curly.js index c408fed95ed..a3a7e712980 100644 --- a/htdocs/includes/ace/src/mode-curly.js +++ b/htdocs/includes/ace/src/mode-curly.js @@ -784,6 +784,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/javascript"; + this.snippetFileId = "ace/snippets/javascript"; }).call(Mode.prototype); exports.Mode = Mode; @@ -1316,6 +1317,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/css"; + this.snippetFileId = "ace/snippets/css"; }).call(Mode.prototype); exports.Mode = Mode; @@ -2493,6 +2495,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/html"; + this.snippetFileId = "ace/snippets/html"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-d.js b/htdocs/includes/ace/src/mode-d.js index 8615c468b48..15379fb9992 100644 --- a/htdocs/includes/ace/src/mode-d.js +++ b/htdocs/includes/ace/src/mode-d.js @@ -308,7 +308,7 @@ var DHighlightRules = function() { regex: '[a-zA-Z]+' }, { token: 'string', - regex: '".*"' + regex: '"[^"]*"' }, { token: 'comment', regex: '//.*$' diff --git a/htdocs/includes/ace/src/mode-dart.js b/htdocs/includes/ace/src/mode-dart.js index 4a228361e6e..9abd9ecc054 100644 --- a/htdocs/includes/ace/src/mode-dart.js +++ b/htdocs/includes/ace/src/mode-dart.js @@ -65,7 +65,7 @@ var c_cppHighlightRules = function() { var storageType = ( "asm|__asm__|auto|bool|_Bool|char|_Complex|double|enum|float|" + - "_Imaginary|int|long|short|signed|struct|typedef|union|unsigned|void|" + + "_Imaginary|int|int8_t|int16_t|int32_t|int64_t|long|short|signed|size_t|struct|typedef|uint8_t|uint16_t|uint32_t|uint64_t|union|unsigned|void|" + "class|wchar_t|template|char16_t|char32_t" ); @@ -489,6 +489,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/c_cpp"; + this.snippetFileId = "ace/snippets/c_cpp"; }).call(Mode.prototype); exports.Mode = Mode; @@ -700,6 +701,7 @@ oop.inherits(Mode, CMode); this.lineCommentStart = "//"; this.blockComment = {start: "/*", end: "*/"}; this.$id = "ace/mode/dart"; + this.snippetFileId = "ace/snippets/dart"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-diff.js b/htdocs/includes/ace/src/mode-diff.js index b8237149bef..8a0ec7e722a 100644 --- a/htdocs/includes/ace/src/mode-diff.js +++ b/htdocs/includes/ace/src/mode-diff.js @@ -132,6 +132,7 @@ oop.inherits(Mode, TextMode); (function() { this.$id = "ace/mode/diff"; + this.snippetFileId = "ace/snippets/diff"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-django.js b/htdocs/includes/ace/src/mode-django.js index 81ce28dc73f..3a5d519bda7 100644 --- a/htdocs/includes/ace/src/mode-django.js +++ b/htdocs/includes/ace/src/mode-django.js @@ -784,6 +784,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/javascript"; + this.snippetFileId = "ace/snippets/javascript"; }).call(Mode.prototype); exports.Mode = Mode; @@ -1316,6 +1317,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/css"; + this.snippetFileId = "ace/snippets/css"; }).call(Mode.prototype); exports.Mode = Mode; @@ -2493,6 +2495,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/html"; + this.snippetFileId = "ace/snippets/html"; }).call(Mode.prototype); exports.Mode = Mode; @@ -2578,6 +2581,7 @@ oop.inherits(Mode, HtmlMode); (function() { this.$id = "ace/mode/django"; + this.snippetFileId = "ace/snippets/django"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-dockerfile.js b/htdocs/includes/ace/src/mode-dockerfile.js index 6b4e85c871b..26d64de860b 100644 --- a/htdocs/includes/ace/src/mode-dockerfile.js +++ b/htdocs/includes/ace/src/mode-dockerfile.js @@ -435,6 +435,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/sh"; + this.snippetFileId = "ace/snippets/sh"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-drools.js b/htdocs/includes/ace/src/mode-drools.js index d208011c997..adcc08f45f7 100644 --- a/htdocs/includes/ace/src/mode-drools.js +++ b/htdocs/includes/ace/src/mode-drools.js @@ -168,7 +168,7 @@ var JavaHighlightRules = function() { regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" }, { token : "keyword.operator", - regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)" + regex : "!|\\$|%|&|\\||\\^|\\*|\\/|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?|\\:|\\*=|\\/=|%=|\\+=|\\-=|&=|\\|=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)" }, { token : "lparen", regex : "[[({]" @@ -483,6 +483,7 @@ oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "//"; this.$id = "ace/mode/drools"; + this.snippetFileId = "ace/snippets/drools"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-edifact.js b/htdocs/includes/ace/src/mode-edifact.js index cffe68e2532..3fc865aee9a 100644 --- a/htdocs/includes/ace/src/mode-edifact.js +++ b/htdocs/includes/ace/src/mode-edifact.js @@ -152,6 +152,7 @@ oop.inherits(Mode, TextMode); (function() { this.$id = "ace/mode/edifact"; + this.snippetFileId = "ace/snippets/edifact"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-ejs.js b/htdocs/includes/ace/src/mode-ejs.js index 95323019651..5825e8385ca 100644 --- a/htdocs/includes/ace/src/mode-ejs.js +++ b/htdocs/includes/ace/src/mode-ejs.js @@ -1264,6 +1264,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/javascript"; + this.snippetFileId = "ace/snippets/javascript"; }).call(Mode.prototype); exports.Mode = Mode; @@ -1601,6 +1602,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/css"; + this.snippetFileId = "ace/snippets/css"; }).call(Mode.prototype); exports.Mode = Mode; @@ -2493,6 +2495,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/html"; + this.snippetFileId = "ace/snippets/html"; }).call(Mode.prototype); exports.Mode = Mode; @@ -2508,17 +2511,17 @@ var constantOtherSymbol = exports.constantOtherSymbol = { regex : "[:](?:[A-Za-z_]|[@$](?=[a-zA-Z0-9_]))[a-zA-Z0-9_]*[!=?]?" }; -var qString = exports.qString = { +exports.qString = { token : "string", // single line regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" }; -var qqString = exports.qqString = { +exports.qqString = { token : "string", // single line regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' }; -var tString = exports.tString = { +exports.tString = { token : "string", // backtick string regex : "[`](?:(?:\\\\.)|(?:[^'\\\\]))*?[`]" }; @@ -2528,9 +2531,34 @@ var constantNumericHex = exports.constantNumericHex = { regex : "0[xX][0-9a-fA-F](?:[0-9a-fA-F]|_(?=[0-9a-fA-F]))*\\b" }; +var constantNumericBinary = exports.constantNumericBinary = { + token: "constant.numeric", + regex: /\b(0[bB][01](?:[01]|_(?=[01]))*)\b/ +}; + +var constantNumericDecimal = exports.constantNumericDecimal = { + token: "constant.numeric", + regex: /\b(0[dD](?:[1-9](?:[\d]|_(?=[\d]))*|0))\b/ +}; + +var constantNumericOctal = exports.constantNumericDecimal = { + token: "constant.numeric", + regex: /\b(0[oO]?(?:[1-7](?:[0-7]|_(?=[0-7]))*|0))\b/ +}; + +var constantNumericRational = exports.constantNumericRational = { + token: "constant.numeric", //rational + complex + regex: /\b([\d]+(?:[./][\d]+)?ri?)\b/ +}; + +var constantNumericComplex = exports.constantNumericComplex = { + token: "constant.numeric", //simple complex numbers + regex: /\b([\d]i)\b/ +}; + var constantNumericFloat = exports.constantNumericFloat = { - token : "constant.numeric", // float - regex : "[+-]?\\d(?:\\d|_(?=\\d))*(?:(?:\\.\\d(?:\\d|_(?=\\d))*)?(?:[eE][+-]?\\d+)?)?\\b" + token : "constant.numeric", // float + complex + regex : "[+-]?\\d(?:\\d|_(?=\\d))*(?:(?:\\.\\d(?:\\d|_(?=\\d))*)?(?:[eE][+-]?\\d+)?)?i?\\b" }; var instanceVariable = exports.instanceVariable = { @@ -2570,18 +2598,19 @@ var RubyHighlightRules = function() { "filter_parameter_logging|match|get|post|resources|redirect|scope|assert_routing|" + "translate|localize|extract_locale_from_tld|caches_page|expire_page|caches_action|expire_action|" + "cache|expire_fragment|expire_cache_for|observe|cache_sweeper|" + - "has_many|has_one|belongs_to|has_and_belongs_to_many" + "has_many|has_one|belongs_to|has_and_belongs_to_many|p|warn|refine|using|module_function|extend|alias_method|" + + "private_class_method|remove_method|undef_method" ); var keywords = ( "alias|and|BEGIN|begin|break|case|class|def|defined|do|else|elsif|END|end|ensure|" + "__FILE__|finally|for|gem|if|in|__LINE__|module|next|not|or|private|protected|public|" + - "redo|rescue|retry|return|super|then|undef|unless|until|when|while|yield" + "redo|rescue|retry|return|super|then|undef|unless|until|when|while|yield|__ENCODING__|prepend" ); var buildinConstants = ( "true|TRUE|false|FALSE|nil|NIL|ARGF|ARGV|DATA|ENV|RUBY_PLATFORM|RUBY_RELEASE_DATE|" + - "RUBY_VERSION|STDERR|STDIN|STDOUT|TOPLEVEL_BINDING" + "RUBY_VERSION|STDERR|STDIN|STDOUT|TOPLEVEL_BINDING|RUBY_PATCHLEVEL|RUBY_REVISION|RUBY_COPYRIGHT|RUBY_ENGINE|RUBY_ENGINE_VERSION|RUBY_DESCRIPTION" ); var builtinVariables = ( @@ -2597,126 +2626,191 @@ var RubyHighlightRules = function() { "invalid.deprecated": "debugger" // TODO is this a remnant from js mode? }, "identifier"); + var escapedChars = "\\\\(?:n(?:[1-7][0-7]{0,2}|0)|[nsrtvfbae'\"\\\\]|c(?:\\\\M-)?.|M-(?:\\\\C-|\\\\c)?.|C-(?:\\\\M-)?.|[0-7]{3}|x[\\da-fA-F]{2}|u[\\da-fA-F]{4}|u{[\\da-fA-F]{1,6}(?:\\s[\\da-fA-F]{1,6})*})"; + + var closeParen = { + "(": ")", + "[": "]", + "{": "}", + "<": ">", + "^": "^", + "|": "|", + "%": "%" + }; + this.$rules = { - "start" : [ + "start": [ { - token : "comment", - regex : "#.*$" + token: "comment", + regex: "#.*$" }, { - token : "comment", // multi line comment - regex : "^=begin(?:$|\\s.*$)", - next : "comment" + token: "comment.multiline", // multi line comment + regex: "^=begin(?=$|\\s.*$)", + next: "comment" }, { - token : "string.regexp", - regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)" + token: "string.regexp", + regex: /[/](?=.*\/)/, + next: "regex" }, [{ - regex: "[{}]", onMatch: function(val, state, stack) { - this.next = val == "{" ? this.nextState : ""; - if (val == "{" && stack.length) { - stack.unshift("start", state); - return "paren.lparen"; - } - if (val == "}" && stack.length) { - stack.shift(); - this.next = stack.shift(); - if (this.next.indexOf("string") != -1) - return "paren.end"; - } - return val == "{" ? "paren.lparen" : "paren.rparen"; - }, - nextState: "start" - }, { - token : "string.start", - regex : /"/, - push : [{ - token : "constant.language.escape", - regex : /\\(?:[nsrtvfbae'"\\]|c.|C-.|M-.(?:\\C-.)?|[0-7]{3}|x[\da-fA-F]{2}|u[\da-fA-F]{4})/ + token: ["constant.other.symbol.ruby", "string.start"], + regex: /(:)?(")/, + push: [{ + token: "constant.language.escape", + regex: escapedChars }, { - token : "paren.start", - regex : /#{/, - push : "start" + token: "paren.start", + regex: /#{/, + push: "start" }, { - token : "string.end", - regex : /"/, - next : "pop" + token: "string.end", + regex: /"/, + next: "pop" }, { defaultToken: "string" }] }, { - token : "string.start", - regex : /`/, - push : [{ - token : "constant.language.escape", - regex : /\\(?:[nsrtvfbae'"\\]|c.|C-.|M-.(?:\\C-.)?|[0-7]{3}|x[\da-fA-F]{2}|u[\da-fA-F]{4})/ + token: "string.start", + regex: /`/, + push: [{ + token: "constant.language.escape", + regex: escapedChars }, { - token : "paren.start", - regex : /#{/, - push : "start" + token: "paren.start", + regex: /#{/, + push: "start" }, { - token : "string.end", - regex : /`/, - next : "pop" + token: "string.end", + regex: /`/, + next: "pop" }, { defaultToken: "string" }] }, { - token : "string.start", - regex : /'/, - push : [{ - token : "constant.language.escape", - regex : /\\['\\]/ - }, { - token : "string.end", - regex : /'/, - next : "pop" + token: ["constant.other.symbol.ruby", "string.start"], + regex: /(:)?(')/, + push: [{ + token: "constant.language.escape", + regex: /\\['\\]/ + }, { + token: "string.end", + regex: /'/, + next: "pop" }, { defaultToken: "string" }] + }, { + token: "string.start",//doesn't see any differences between strings and array of strings in highlighting + regex: /%[qwx]([(\[<{^|%])/, onMatch: function (val, state, stack) { + if (stack.length) + stack = []; + var paren = val[val.length - 1]; + stack.unshift(paren, state); + this.next = "qStateWithoutInterpolation"; + return this.token; + } + }, { + token: "string.start", //doesn't see any differences between strings and array of strings in highlighting + regex: /%[QWX]?([(\[<{^|%])/, onMatch: function (val, state, stack) { + if (stack.length) + stack = []; + var paren = val[val.length - 1]; + stack.unshift(paren, state); + this.next = "qStateWithInterpolation"; + return this.token; + } + }, { + token: "constant.other.symbol.ruby", //doesn't see any differences between symbols and array of symbols in highlighting + regex: /%[si]([(\[<{^|%])/, onMatch: function (val, state, stack) { + if (stack.length) + stack = []; + var paren = val[val.length - 1]; + stack.unshift(paren, state); + this.next = "sStateWithoutInterpolation"; + return this.token; + } + }, { + token: "constant.other.symbol.ruby", //doesn't see any differences between symbols and array of symbols in highlighting + regex: /%[SI]([(\[<{^|%])/, onMatch: function (val, state, stack) { + if (stack.length) + stack = []; + var paren = val[val.length - 1]; + stack.unshift(paren, state); + this.next = "sStateWithInterpolation"; + return this.token; + } + }, { + token: "string.regexp", + regex: /%[r]([(\[<{^|%])/, onMatch: function (val, state, stack) { + if (stack.length) + stack = []; + var paren = val[val.length - 1]; + stack.unshift(paren, state); + this.next = "rState"; + return this.token; + } }], { - token : "text", // namespaces aren't symbols - regex : "::" + token: "punctuation", // namespaces aren't symbols + regex: "::" + }, + instanceVariable, + { + token: "variable.global", // global variable + regex: "[$][a-zA-Z_\\d]+" }, { - token : "variable.instance", // instance variable - regex : "@{1,2}[a-zA-Z_\\d]+" + token: "support.class", // class name + regex: "[A-Z][a-zA-Z_\\d]*" }, { - token : "support.class", // class name - regex : "[A-Z][a-zA-Z_\\d]+" + token: ["punctuation.operator", "support.function"], + regex: /(\.)([a-zA-Z_\d]+)(?=\()/ + }, { + token: ["punctuation.operator", "identifier"], + regex: /(\.)([a-zA-Z_][a-zA-Z_\d]*)/ + }, { + token: "string.character", + regex: "\\B\\?(?:" + escapedChars + "|\\S)" + }, { + token: "punctuation.operator", + regex: /\?(?=.+:)/ }, + constantNumericRational, + constantNumericComplex, constantOtherSymbol, constantNumericHex, constantNumericFloat, - + constantNumericBinary, + constantNumericDecimal, + constantNumericOctal, { - token : "constant.language.boolean", - regex : "(?:true|false)\\b" + token: "constant.language.boolean", + regex: "(?:true|false)\\b" }, { - token : keywordMapper, - regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" + token: keywordMapper, + regex: "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" }, { - token : "punctuation.separator.key-value", - regex : "=>" + token: "punctuation.separator.key-value", + regex: "=>" }, { stateName: "heredoc", - onMatch : function(value, currentState, stack) { - var next = value[2] == '-' ? "indentedHeredoc" : "heredoc"; + onMatch: function (value, currentState, stack) { + var next = (value[2] == '-' || value[2] == '~') ? "indentedHeredoc" : "heredoc"; var tokens = value.split(this.splitRegex); stack.push(next, tokens[3]); return [ - {type:"constant", value: tokens[1]}, - {type:"string", value: tokens[2]}, - {type:"support.class", value: tokens[3]}, - {type:"string", value: tokens[4]} + {type: "constant", value: tokens[1]}, + {type: "string", value: tokens[2]}, + {type: "support.class", value: tokens[3]}, + {type: "string", value: tokens[4]} ]; }, - regex : "(<<-?)(['\"`]?)([\\w]+)(['\"`]?)", + regex: "(<<[-~]?)(['\"`]?)([\\w]+)(['\"`]?)", rules: { heredoc: [{ - onMatch: function(value, currentState, stack) { + onMatch: function(value, currentState, stack) { if (value === stack[1]) { stack.shift(); stack.shift(); @@ -2733,7 +2827,7 @@ var RubyHighlightRules = function() { token: "string", regex: "^ +" }, { - onMatch: function(value, currentState, stack) { + onMatch: function(value, currentState, stack) { if (value === stack[1]) { stack.shift(); stack.shift(); @@ -2748,38 +2842,261 @@ var RubyHighlightRules = function() { }] } }, { - regex : "$", - token : "empty", - next : function(currentState, stack) { + regex: "$", + token: "empty", + next: function(currentState, stack) { if (stack[0] === "heredoc" || stack[0] === "indentedHeredoc") return stack[0]; return currentState; } + }, { + token: "keyword.operator", + regex: "!|\\$|%|&|\\*|/|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\||\\b(?:in|instanceof|new|delete|typeof|void)" }, { - token : "string.character", - regex : "\\B\\?." + token: "paren.lparen", + regex: "[[({]" }, { - token : "keyword.operator", - regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)" + token: "paren.rparen", + regex: "[\\])}]", + onMatch: function(value, currentState, stack) { + this.next = ''; + if (value == "}" && stack.length > 1 && stack[1] != "start") { + stack.shift(); + this.next = stack.shift(); + } + return this.token; + } }, { - token : "paren.lparen", - regex : "[[({]" + token: "text", + regex: "\\s+" }, { - token : "paren.rparen", - regex : "[\\])}]" - }, { - token : "text", - regex : "\\s+" + token: "punctuation.operator", + regex: /[?:,;.]/ } ], - "comment" : [ + "comment": [ { - token : "comment", // closing comment - regex : "^=end(?:$|\\s.*$)", - next : "start" + token: "comment.multiline", // closing comment + regex: "^=end(?=$|\\s.*$)", + next: "start" }, { - token : "comment", // comment spanning whole line - regex : ".+" + token: "comment", // comment spanning whole line + regex: ".+" + } + ], + "qStateWithInterpolation": [{ + token: "string.start",// excluded nested |^% due to difficulty in realization + regex: /[(\[<{]/, onMatch: function (val, state, stack) { + if (stack.length && val === stack[0]) { + stack.unshift(val, state); + return this.token; + } + return "string"; + } + }, { + token: "constant.language.escape", + regex: escapedChars + }, { + token: "constant.language.escape", + regex: /\\./ + }, { + token: "paren.start", + regex: /#{/, + push: "start" + }, { + token: "string.end", + regex: /[)\]>}^|%]/, onMatch: function (val, state, stack) { + if (stack.length && val === closeParen[stack[0]]) { + stack.shift(); + this.next = stack.shift(); + return this.token; + } + this.next = ''; + return "string"; + } + }, { + defaultToken: "string" + }], + "qStateWithoutInterpolation": [{ + token: "string.start",// excluded nested |^% due to difficulty in realization + regex: /[(\[<{]/, onMatch: function (val, state, stack) { + if (stack.length && val === stack[0]) { + stack.unshift(val, state); + return this.token; + } + return "string"; + } + }, { + token: "constant.language.escape", + regex: /\\['\\]/ + }, { + token: "constant.language.escape", + regex: /\\./ + }, { + token: "string.end", + regex: /[)\]>}^|%]/, onMatch: function (val, state, stack) { + if (stack.length && val === closeParen[stack[0]]) { + stack.shift(); + this.next = stack.shift(); + return this.token; + } + this.next = ''; + return "string"; + } + }, { + defaultToken: "string" + }], + "sStateWithoutInterpolation": [{ + token: "constant.other.symbol.ruby",// excluded nested |^% due to difficulty in realization + regex: /[(\[<{]/, onMatch: function (val, state, stack) { + if (stack.length && val === stack[0]) { + stack.unshift(val, state); + return this.token; + } + return "constant.other.symbol.ruby"; + } + }, { + token: "constant.other.symbol.ruby", + regex: /[)\]>}^|%]/, onMatch: function (val, state, stack) { + if (stack.length && val === closeParen[stack[0]]) { + stack.shift(); + this.next = stack.shift(); + return this.token; + } + this.next = ''; + return "constant.other.symbol.ruby"; + } + }, { + defaultToken: "constant.other.symbol.ruby" + }], + "sStateWithInterpolation": [{ + token: "constant.other.symbol.ruby",// excluded nested |^% due to difficulty in realization + regex: /[(\[<{]/, onMatch: function (val, state, stack) { + if (stack.length && val === stack[0]) { + stack.unshift(val, state); + return this.token; + } + return "constant.other.symbol.ruby"; + } + }, { + token: "constant.language.escape", + regex: escapedChars + }, { + token: "constant.language.escape", + regex: /\\./ + }, { + token: "paren.start", + regex: /#{/, + push: "start" + }, { + token: "constant.other.symbol.ruby", + regex: /[)\]>}^|%]/, onMatch: function (val, state, stack) { + if (stack.length && val === closeParen[stack[0]]) { + stack.shift(); + this.next = stack.shift(); + return this.token; + } + this.next = ''; + return "constant.other.symbol.ruby"; + } + }, { + defaultToken: "constant.other.symbol.ruby" + }], + "rState": [{ + token: "string.regexp",// excluded nested |^% due to difficulty in realization + regex: /[(\[<{]/, onMatch: function (val, state, stack) { + if (stack.length && val === stack[0]) { + stack.unshift(val, state); + return this.token; + } + return "constant.language.escape"; + } + }, { + token: "paren.start", + regex: /#{/, + push: "start" + }, { + token: "string.regexp", + regex: /\// + }, { + token: "string.regexp", + regex: /[)\]>}^|%][imxouesn]*/, onMatch: function (val, state, stack) { + if (stack.length && val[0] === closeParen[stack[0]]) { + stack.shift(); + this.next = stack.shift(); + return this.token; + } + this.next = ''; + return "constant.language.escape"; + } + }, + {include: "regex"}, + { + defaultToken: "string.regexp" + }], + "regex": [ + {// character classes + token: "regexp.keyword", + regex: /\\[wWdDhHsS]/ + }, { + token: "constant.language.escape", + regex: /\\[AGbBzZ]/ + }, { + token: "constant.language.escape", + regex: /\\g<[a-zA-Z0-9]*>/ + }, { + token: ["constant.language.escape", "regexp.keyword", "constant.language.escape"], + regex: /(\\p{\^?)(Alnum|Alpha|Blank|Cntrl|Digit|Graph|Lower|Print|Punct|Space|Upper|XDigit|Word|ASCII|Any|Assigned|Arabic|Armenian|Balinese|Bengali|Bopomofo|Braille|Buginese|Buhid|Canadian_Aboriginal|Carian|Cham|Cherokee|Common|Coptic|Cuneiform|Cypriot|Cyrillic|Deseret|Devanagari|Ethiopic|Georgian|Glagolitic|Gothic|Greek|Gujarati|Gurmukhi|Han|Hangul|Hanunoo|Hebrew|Hiragana|Inherited|Kannada|Katakana|Kayah_Li|Kharoshthi|Khmer|Lao|Latin|Lepcha|Limbu|Linear_B|Lycian|Lydian|Malayalam|Mongolian|Myanmar|New_Tai_Lue|Nko|Ogham|Ol_Chiki|Old_Italic|Old_Persian|Oriya|Osmanya|Phags_Pa|Phoenician|Rejang|Runic|Saurashtra|Shavian|Sinhala|Sundanese|Syloti_Nagri|Syriac|Tagalog|Tagbanwa|Tai_Le|Tamil|Telugu|Thaana|Thai|Tibetan|Tifinagh|Ugaritic|Vai|Yi|Ll|Lm|Lt|Lu|Lo|Mn|Mc|Me|Nd|Nl|Pc|Pd|Ps|Pe|Pi|Pf|Po|No|Sm|Sc|Sk|So|Zs|Zl|Zp|Cc|Cf|Cn|Co|Cs|N|L|M|P|S|Z|C)(})/ + }, { + token: ["constant.language.escape", "invalid", "constant.language.escape"], + regex: /(\\p{\^?)([^/]*)(})/ + }, {// escapes + token: "regexp.keyword.operator", + regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" + }, {// flag + token: "string.regexp", + regex: /[/][imxouesn]*/, + next: "start" + }, {// invalid operators + token: "invalid", + regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/ + }, {// operators + token: "constant.language.escape", + regex: /\(\?(?:[:=!>]|<'?[a-zA-Z]*'?>|<[=!])|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/ + }, { + token: "constant.language.delimiter", + regex: /\|/ + }, { + token: "regexp.keyword", + regex: /\[\[:(?:alnum|alpha|blank|cntrl|digit|graph|lower|print|punct|space|upper|xdigit|word|ascii):\]\]/ + }, { + token: "constant.language.escape", + regex: /\[\^?/, + push: "regex_character_class" + }, { + defaultToken: "string.regexp" + } + ], + "regex_character_class": [ + { + token: "regexp.keyword", + regex: /\\[wWdDhHsS]/ + }, { + token: "regexp.charclass.keyword.operator", + regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" + }, { + token: "constant.language.escape", + regex: /&?&?\[\^?/, + push: "regex_character_class" + }, { + token: "constant.language.escape", + regex: "]", + next: "pop" + }, { + token: "constant.language.escape", + regex: "-" + }, { + defaultToken: "string.regexp.characterclass" } ] }; @@ -2792,94 +3109,271 @@ oop.inherits(RubyHighlightRules, TextHighlightRules); exports.RubyHighlightRules = RubyHighlightRules; }); -define("ace/mode/folding/coffee",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range"], function(require, exports, module) { +define("ace/mode/folding/ruby",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range","ace/token_iterator"], function (require, exports, module) { "use strict"; var oop = require("../../lib/oop"); var BaseFoldMode = require("./fold_mode").FoldMode; var Range = require("../../range").Range; +var TokenIterator = require("../../token_iterator").TokenIterator; + + +var FoldMode = exports.FoldMode = function () { +}; -var FoldMode = exports.FoldMode = function() {}; oop.inherits(FoldMode, BaseFoldMode); -(function() { - - this.getFoldWidgetRange = function(session, foldStyle, row) { - var range = this.indentationBlock(session, row); - if (range) - return range; - - var re = /\S/; - var line = session.getLine(row); - var startLevel = line.search(re); - if (startLevel == -1 || line[startLevel] != "#") - return; - - var startColumn = line.length; - var maxRow = session.getLength(); - var startRow = row; - var endRow = row; - - while (++row < maxRow) { - line = session.getLine(row); - var level = line.search(re); - - if (level == -1) - continue; - - if (line[level] != "#") - break; - - endRow = row; - } - - if (endRow > startRow) { - var endColumn = session.getLine(endRow).length; - return new Range(startRow, startColumn, endRow, endColumn); - } +(function () { + this.indentKeywords = { + "class": 1, + "def": 1, + "module": 1, + "do": 1, + "unless": 1, + "if": 1, + "while": 1, + "for": 1, + "until": 1, + "begin": 1, + "else": 0, + "elsif": 0, + "rescue": 0, + "ensure": 0, + "when": 0, + "end": -1, + "case": 1, + "=begin": 1, + "=end": -1 }; - this.getFoldWidget = function(session, foldStyle, row) { - var line = session.getLine(row); - var indent = line.search(/\S/); - var next = session.getLine(row + 1); - var prev = session.getLine(row - 1); - var prevIndent = prev.search(/\S/); - var nextIndent = next.search(/\S/); - if (indent == -1) { - session.foldWidgets[row - 1] = prevIndent!= -1 && prevIndent < nextIndent ? "start" : ""; - return ""; - } - if (prevIndent == -1) { - if (indent == nextIndent && line[indent] == "#" && next[indent] == "#") { - session.foldWidgets[row - 1] = ""; - session.foldWidgets[row + 1] = ""; + this.foldingStartMarker = /(?:\s|^)(def|do|while|class|unless|module|if|for|until|begin|else|elsif|case|rescue|ensure|when)\b|({\s*$)|(=begin)/; + this.foldingStopMarker = /(=end(?=$|\s.*$))|(^\s*})|\b(end)\b/; + + this.getFoldWidget = function (session, foldStyle, row) { + var line = session.getLine(row); + var isStart = this.foldingStartMarker.test(line); + var isEnd = this.foldingStopMarker.test(line); + + if (isStart && !isEnd) { + var match = line.match(this.foldingStartMarker); + if (match[1]) { + if (match[1] == "if" || match[1] == "else" || match[1] == "while" || match[1] == "until" || match[1] == "unless") { + if (match[1] == "else" && /^\s*else\s*$/.test(line) === false) { + return; + } + if (/^\s*(?:if|else|while|until|unless)\s*/.test(line) === false) { + return; + } + } + + if (match[1] == "when") { + if (/\sthen\s/.test(line) === true) { + return; + } + } + if (session.getTokenAt(row, match.index + 2).type === "keyword") + return "start"; + } else if (match[3]) { + if (session.getTokenAt(row, match.index + 1).type === "comment.multiline") + return "start"; + } else { return "start"; } - } else if (prevIndent == indent && line[indent] == "#" && prev[indent] == "#") { - if (session.getLine(row - 2).search(/\S/) == -1) { - session.foldWidgets[row - 1] = "start"; - session.foldWidgets[row + 1] = ""; - return ""; + } + if (foldStyle != "markbeginend" || !isEnd || isStart && isEnd) + return ""; + + var match = line.match(this.foldingStopMarker); + if (match[3] === "end") { + if (session.getTokenAt(row, match.index + 1).type === "keyword") + return "end"; + } else if (match[1]) { + if (session.getTokenAt(row, match.index + 1).type === "comment.multiline") + return "end"; + } else + return "end"; + }; + + this.getFoldWidgetRange = function (session, foldStyle, row) { + var line = session.doc.getLine(row); + var match = this.foldingStartMarker.exec(line); + if (match) { + if (match[1] || match[3]) + return this.rubyBlock(session, row, match.index + 2); + + return this.openingBracketBlock(session, "{", row, match.index); + } + + var match = this.foldingStopMarker.exec(line); + if (match) { + if (match[3] === "end") { + if (session.getTokenAt(row, match.index + 1).type === "keyword") + return this.rubyBlock(session, row, match.index + 1); + } + + if (match[1] === "=end") { + if (session.getTokenAt(row, match.index + 1).type === "comment.multiline") + return this.rubyBlock(session, row, match.index + 1); + } + + return this.closingBracketBlock(session, "}", row, match.index + match[0].length); + } + }; + + this.rubyBlock = function (session, row, column, tokenRange) { + var stream = new TokenIterator(session, row, column); + + var token = stream.getCurrentToken(); + if (!token || (token.type != "keyword" && token.type != "comment.multiline")) + return; + + var val = token.value; + var line = session.getLine(row); + switch (token.value) { + case "if": + case "unless": + case "while": + case "until": + var checkToken = new RegExp("^\\s*" + token.value); + if (!checkToken.test(line)) { + return; + } + var dir = this.indentKeywords[val]; + break; + case "when": + if (/\sthen\s/.test(line)) { + return; + } + case "elsif": + case "rescue": + case "ensure": + var dir = 1; + break; + case "else": + var checkToken = new RegExp("^\\s*" + token.value + "\\s*$"); + if (!checkToken.test(line)) { + return; + } + var dir = 1; + break; + default: + var dir = this.indentKeywords[val]; + break; + } + + var stack = [val]; + if (!dir) + return; + + var startColumn = dir === -1 ? session.getLine(row - 1).length : session.getLine(row).length; + var startRow = row; + var ranges = []; + ranges.push(stream.getCurrentTokenRange()); + + stream.step = dir === -1 ? stream.stepBackward : stream.stepForward; + if (token.type == "comment.multiline") { + while (token = stream.step()) { + if (token.type !== "comment.multiline") + continue; + if (dir == 1) { + startColumn = 6; + if (token.value == "=end") { + break; + } + } else { + if (token.value == "=begin") { + break; + } + } + } + } else { + while (token = stream.step()) { + var ignore = false; + if (token.type !== "keyword") + continue; + var level = dir * this.indentKeywords[token.value]; + line = session.getLine(stream.getCurrentTokenRow()); + switch (token.value) { + case "do": + for (var i = stream.$tokenIndex - 1; i >= 0; i--) { + var prevToken = stream.$rowTokens[i]; + if (prevToken && (prevToken.value == "while" || prevToken.value == "until" || prevToken.value == "for")) { + level = 0; + break; + } + } + break; + case "else": + var checkToken = new RegExp("^\\s*" + token.value + "\\s*$"); + if (!checkToken.test(line) || val == "case") { + level = 0; + ignore = true; + } + break; + case "if": + case "unless": + case "while": + case "until": + var checkToken = new RegExp("^\\s*" + token.value); + if (!checkToken.test(line)) { + level = 0; + ignore = true; + } + break; + case "when": + if (/\sthen\s/.test(line) || val == "case") { + level = 0; + ignore = true; + } + break; + } + + if (level > 0) { + stack.unshift(token.value); + } else if (level <= 0 && ignore === false) { + stack.shift(); + if (!stack.length) { + if ((val == "while" || val == "until" || val == "for") && token.value != "do") { + break; + } + if (token.value == "do" && dir == -1 && level != 0) + break; + if (token.value != "do") + break; + } + + if (level === 0) { + stack.unshift(token.value); + } + } } } - if (prevIndent!= -1 && prevIndent < indent) - session.foldWidgets[row - 1] = "start"; - else - session.foldWidgets[row - 1] = ""; + if (!token) + return null; - if (indent < nextIndent) - return "start"; - else - return ""; + if (tokenRange) { + ranges.push(stream.getCurrentTokenRange()); + return ranges; + } + + var row = stream.getCurrentTokenRow(); + if (dir === -1) { + if (token.type === "comment.multiline") { + var endColumn = 6; + } else { + var endColumn = session.getLine(row).length; + } + return new Range(row, endColumn, startRow - 1, startColumn); + } else + return new Range(startRow, startColumn, row - 1, session.getLine(row - 1).length); }; }).call(FoldMode.prototype); }); -define("ace/mode/ruby",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/ruby_highlight_rules","ace/mode/matching_brace_outdent","ace/range","ace/mode/behaviour/cstyle","ace/mode/folding/coffee"], function(require, exports, module) { +define("ace/mode/ruby",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/ruby_highlight_rules","ace/mode/matching_brace_outdent","ace/range","ace/mode/behaviour/cstyle","ace/mode/folding/ruby"], function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); @@ -2888,13 +3382,14 @@ var RubyHighlightRules = require("./ruby_highlight_rules").RubyHighlightRules; var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; var Range = require("../range").Range; var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour; -var FoldMode = require("./folding/coffee").FoldMode; +var FoldMode = require("./folding/ruby").FoldMode; var Mode = function() { this.HighlightRules = RubyHighlightRules; this.$outdent = new MatchingBraceOutdent(); this.$behaviour = new CstyleBehaviour(); this.foldingRules = new FoldMode(); + this.indentKeywords = this.foldingRules.indentKeywords; }; oop.inherits(Mode, TextMode); @@ -2909,7 +3404,7 @@ oop.inherits(Mode, TextMode); var tokenizedLine = this.getTokenizer().getLineTokens(line, state); var tokens = tokenizedLine.tokens; - if (tokens.length && tokens[tokens.length-1].type == "comment") { + if (tokens.length && tokens[tokens.length - 1].type == "comment") { return indent; } @@ -2917,7 +3412,7 @@ oop.inherits(Mode, TextMode); var match = line.match(/^.*[\{\(\[]\s*$/); var startingClassOrMethod = line.match(/^\s*(class|def|module)\s.*$/); var startingDoBlock = line.match(/.*do(\s*|\s+\|.*\|\s*)$/); - var startingConditional = line.match(/^\s*(if|else|when)\s*/); + var startingConditional = line.match(/^\s*(if|else|when|elsif|unless|while|for|begin|rescue|ensure)\s*/); if (match || startingClassOrMethod || startingDoBlock || startingConditional) { indent += tab; } @@ -2927,7 +3422,7 @@ oop.inherits(Mode, TextMode); }; this.checkOutdent = function(state, line, input) { - return /^\s+(end|else)$/.test(line + input) || this.$outdent.checkOutdent(line, input); + return /^\s+(end|else|rescue|ensure)$/.test(line + input) || this.$outdent.checkOutdent(line, input); }; this.autoOutdent = function(state, session, row) { @@ -2940,11 +3435,24 @@ oop.inherits(Mode, TextMode); var tab = session.getTabString(); if (prevIndent.length <= indent.length) { if (indent.slice(-tab.length) == tab) - session.remove(new Range(row, indent.length-tab.length, row, indent.length)); + session.remove(new Range(row, indent.length - tab.length, row, indent.length)); } }; + this.getMatching = function(session, row, column) { + if (row == undefined) { + var pos = session.selection.lead; + column = pos.column; + row = pos.row; + } + + var startToken = session.getTokenAt(row, column); + if (startToken && startToken.value in this.indentKeywords) + return this.foldingRules.rubyBlock(session, row, column, true); + }; + this.$id = "ace/mode/ruby"; + this.snippetFileId = "ace/snippets/ruby"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-erlang.js b/htdocs/includes/ace/src/mode-erlang.js index 3f91c0098c8..fd1143d9e87 100644 --- a/htdocs/includes/ace/src/mode-erlang.js +++ b/htdocs/includes/ace/src/mode-erlang.js @@ -996,6 +996,7 @@ oop.inherits(Mode, TextMode); this.lineCommentStart = "%"; this.blockComment = null; this.$id = "ace/mode/erlang"; + this.snippetFileId = "ace/snippets/erlang"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-fsl.js b/htdocs/includes/ace/src/mode-fsl.js index 9bfde7ebaba..9bd21d96c15 100644 --- a/htdocs/includes/ace/src/mode-fsl.js +++ b/htdocs/includes/ace/src/mode-fsl.js @@ -245,6 +245,7 @@ oop.inherits(Mode, TextMode); this.lineCommentStart = "//"; this.blockComment = {start: "/*", end: "*/"}; this.$id = "ace/mode/fsl"; + this.snippetFileId = "ace/snippets/fsl"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-glsl.js b/htdocs/includes/ace/src/mode-glsl.js index b5bc6e699e1..f5d0c815c94 100644 --- a/htdocs/includes/ace/src/mode-glsl.js +++ b/htdocs/includes/ace/src/mode-glsl.js @@ -65,7 +65,7 @@ var c_cppHighlightRules = function() { var storageType = ( "asm|__asm__|auto|bool|_Bool|char|_Complex|double|enum|float|" + - "_Imaginary|int|long|short|signed|struct|typedef|union|unsigned|void|" + + "_Imaginary|int|int8_t|int16_t|int32_t|int64_t|long|short|signed|size_t|struct|typedef|uint8_t|uint16_t|uint32_t|uint64_t|union|unsigned|void|" + "class|wchar_t|template|char16_t|char32_t" ); @@ -489,6 +489,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/c_cpp"; + this.snippetFileId = "ace/snippets/c_cpp"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-gobstones.js b/htdocs/includes/ace/src/mode-gobstones.js index 1ab66a8b898..cd2fc3aaf82 100644 --- a/htdocs/includes/ace/src/mode-gobstones.js +++ b/htdocs/includes/ace/src/mode-gobstones.js @@ -784,6 +784,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/javascript"; + this.snippetFileId = "ace/snippets/javascript"; }).call(Mode.prototype); exports.Mode = Mode; @@ -1075,6 +1076,7 @@ oop.inherits(Mode, JavaScriptMode); }; this.$id = "ace/mode/gobstones"; + this.snippetFileId = "ace/snippets/gobstones"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-graphqlschema.js b/htdocs/includes/ace/src/mode-graphqlschema.js index e252b70c78c..cf0931e3c8a 100644 --- a/htdocs/includes/ace/src/mode-graphqlschema.js +++ b/htdocs/includes/ace/src/mode-graphqlschema.js @@ -200,6 +200,7 @@ oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "#"; this.$id = "ace/mode/graphqlschema"; + this.snippetFileId = "ace/snippets/graphqlschema"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-groovy.js b/htdocs/includes/ace/src/mode-groovy.js index 4c48df1f925..8395de92087 100644 --- a/htdocs/includes/ace/src/mode-groovy.js +++ b/htdocs/includes/ace/src/mode-groovy.js @@ -784,6 +784,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/javascript"; + this.snippetFileId = "ace/snippets/javascript"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-haml.js b/htdocs/includes/ace/src/mode-haml.js index e6821c8a45e..db8e69343ca 100644 --- a/htdocs/includes/ace/src/mode-haml.js +++ b/htdocs/includes/ace/src/mode-haml.js @@ -1012,17 +1012,17 @@ var constantOtherSymbol = exports.constantOtherSymbol = { regex : "[:](?:[A-Za-z_]|[@$](?=[a-zA-Z0-9_]))[a-zA-Z0-9_]*[!=?]?" }; -var qString = exports.qString = { +exports.qString = { token : "string", // single line regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" }; -var qqString = exports.qqString = { +exports.qqString = { token : "string", // single line regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' }; -var tString = exports.tString = { +exports.tString = { token : "string", // backtick string regex : "[`](?:(?:\\\\.)|(?:[^'\\\\]))*?[`]" }; @@ -1032,9 +1032,34 @@ var constantNumericHex = exports.constantNumericHex = { regex : "0[xX][0-9a-fA-F](?:[0-9a-fA-F]|_(?=[0-9a-fA-F]))*\\b" }; +var constantNumericBinary = exports.constantNumericBinary = { + token: "constant.numeric", + regex: /\b(0[bB][01](?:[01]|_(?=[01]))*)\b/ +}; + +var constantNumericDecimal = exports.constantNumericDecimal = { + token: "constant.numeric", + regex: /\b(0[dD](?:[1-9](?:[\d]|_(?=[\d]))*|0))\b/ +}; + +var constantNumericOctal = exports.constantNumericDecimal = { + token: "constant.numeric", + regex: /\b(0[oO]?(?:[1-7](?:[0-7]|_(?=[0-7]))*|0))\b/ +}; + +var constantNumericRational = exports.constantNumericRational = { + token: "constant.numeric", //rational + complex + regex: /\b([\d]+(?:[./][\d]+)?ri?)\b/ +}; + +var constantNumericComplex = exports.constantNumericComplex = { + token: "constant.numeric", //simple complex numbers + regex: /\b([\d]i)\b/ +}; + var constantNumericFloat = exports.constantNumericFloat = { - token : "constant.numeric", // float - regex : "[+-]?\\d(?:\\d|_(?=\\d))*(?:(?:\\.\\d(?:\\d|_(?=\\d))*)?(?:[eE][+-]?\\d+)?)?\\b" + token : "constant.numeric", // float + complex + regex : "[+-]?\\d(?:\\d|_(?=\\d))*(?:(?:\\.\\d(?:\\d|_(?=\\d))*)?(?:[eE][+-]?\\d+)?)?i?\\b" }; var instanceVariable = exports.instanceVariable = { @@ -1074,18 +1099,19 @@ var RubyHighlightRules = function() { "filter_parameter_logging|match|get|post|resources|redirect|scope|assert_routing|" + "translate|localize|extract_locale_from_tld|caches_page|expire_page|caches_action|expire_action|" + "cache|expire_fragment|expire_cache_for|observe|cache_sweeper|" + - "has_many|has_one|belongs_to|has_and_belongs_to_many" + "has_many|has_one|belongs_to|has_and_belongs_to_many|p|warn|refine|using|module_function|extend|alias_method|" + + "private_class_method|remove_method|undef_method" ); var keywords = ( "alias|and|BEGIN|begin|break|case|class|def|defined|do|else|elsif|END|end|ensure|" + "__FILE__|finally|for|gem|if|in|__LINE__|module|next|not|or|private|protected|public|" + - "redo|rescue|retry|return|super|then|undef|unless|until|when|while|yield" + "redo|rescue|retry|return|super|then|undef|unless|until|when|while|yield|__ENCODING__|prepend" ); var buildinConstants = ( "true|TRUE|false|FALSE|nil|NIL|ARGF|ARGV|DATA|ENV|RUBY_PLATFORM|RUBY_RELEASE_DATE|" + - "RUBY_VERSION|STDERR|STDIN|STDOUT|TOPLEVEL_BINDING" + "RUBY_VERSION|STDERR|STDIN|STDOUT|TOPLEVEL_BINDING|RUBY_PATCHLEVEL|RUBY_REVISION|RUBY_COPYRIGHT|RUBY_ENGINE|RUBY_ENGINE_VERSION|RUBY_DESCRIPTION" ); var builtinVariables = ( @@ -1101,126 +1127,191 @@ var RubyHighlightRules = function() { "invalid.deprecated": "debugger" // TODO is this a remnant from js mode? }, "identifier"); + var escapedChars = "\\\\(?:n(?:[1-7][0-7]{0,2}|0)|[nsrtvfbae'\"\\\\]|c(?:\\\\M-)?.|M-(?:\\\\C-|\\\\c)?.|C-(?:\\\\M-)?.|[0-7]{3}|x[\\da-fA-F]{2}|u[\\da-fA-F]{4}|u{[\\da-fA-F]{1,6}(?:\\s[\\da-fA-F]{1,6})*})"; + + var closeParen = { + "(": ")", + "[": "]", + "{": "}", + "<": ">", + "^": "^", + "|": "|", + "%": "%" + }; + this.$rules = { - "start" : [ + "start": [ { - token : "comment", - regex : "#.*$" + token: "comment", + regex: "#.*$" }, { - token : "comment", // multi line comment - regex : "^=begin(?:$|\\s.*$)", - next : "comment" + token: "comment.multiline", // multi line comment + regex: "^=begin(?=$|\\s.*$)", + next: "comment" }, { - token : "string.regexp", - regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)" + token: "string.regexp", + regex: /[/](?=.*\/)/, + next: "regex" }, [{ - regex: "[{}]", onMatch: function(val, state, stack) { - this.next = val == "{" ? this.nextState : ""; - if (val == "{" && stack.length) { - stack.unshift("start", state); - return "paren.lparen"; - } - if (val == "}" && stack.length) { - stack.shift(); - this.next = stack.shift(); - if (this.next.indexOf("string") != -1) - return "paren.end"; - } - return val == "{" ? "paren.lparen" : "paren.rparen"; - }, - nextState: "start" - }, { - token : "string.start", - regex : /"/, - push : [{ - token : "constant.language.escape", - regex : /\\(?:[nsrtvfbae'"\\]|c.|C-.|M-.(?:\\C-.)?|[0-7]{3}|x[\da-fA-F]{2}|u[\da-fA-F]{4})/ + token: ["constant.other.symbol.ruby", "string.start"], + regex: /(:)?(")/, + push: [{ + token: "constant.language.escape", + regex: escapedChars }, { - token : "paren.start", - regex : /#{/, - push : "start" + token: "paren.start", + regex: /#{/, + push: "start" }, { - token : "string.end", - regex : /"/, - next : "pop" + token: "string.end", + regex: /"/, + next: "pop" }, { defaultToken: "string" }] }, { - token : "string.start", - regex : /`/, - push : [{ - token : "constant.language.escape", - regex : /\\(?:[nsrtvfbae'"\\]|c.|C-.|M-.(?:\\C-.)?|[0-7]{3}|x[\da-fA-F]{2}|u[\da-fA-F]{4})/ + token: "string.start", + regex: /`/, + push: [{ + token: "constant.language.escape", + regex: escapedChars }, { - token : "paren.start", - regex : /#{/, - push : "start" + token: "paren.start", + regex: /#{/, + push: "start" }, { - token : "string.end", - regex : /`/, - next : "pop" + token: "string.end", + regex: /`/, + next: "pop" }, { defaultToken: "string" }] }, { - token : "string.start", - regex : /'/, - push : [{ - token : "constant.language.escape", - regex : /\\['\\]/ - }, { - token : "string.end", - regex : /'/, - next : "pop" + token: ["constant.other.symbol.ruby", "string.start"], + regex: /(:)?(')/, + push: [{ + token: "constant.language.escape", + regex: /\\['\\]/ + }, { + token: "string.end", + regex: /'/, + next: "pop" }, { defaultToken: "string" }] + }, { + token: "string.start",//doesn't see any differences between strings and array of strings in highlighting + regex: /%[qwx]([(\[<{^|%])/, onMatch: function (val, state, stack) { + if (stack.length) + stack = []; + var paren = val[val.length - 1]; + stack.unshift(paren, state); + this.next = "qStateWithoutInterpolation"; + return this.token; + } + }, { + token: "string.start", //doesn't see any differences between strings and array of strings in highlighting + regex: /%[QWX]?([(\[<{^|%])/, onMatch: function (val, state, stack) { + if (stack.length) + stack = []; + var paren = val[val.length - 1]; + stack.unshift(paren, state); + this.next = "qStateWithInterpolation"; + return this.token; + } + }, { + token: "constant.other.symbol.ruby", //doesn't see any differences between symbols and array of symbols in highlighting + regex: /%[si]([(\[<{^|%])/, onMatch: function (val, state, stack) { + if (stack.length) + stack = []; + var paren = val[val.length - 1]; + stack.unshift(paren, state); + this.next = "sStateWithoutInterpolation"; + return this.token; + } + }, { + token: "constant.other.symbol.ruby", //doesn't see any differences between symbols and array of symbols in highlighting + regex: /%[SI]([(\[<{^|%])/, onMatch: function (val, state, stack) { + if (stack.length) + stack = []; + var paren = val[val.length - 1]; + stack.unshift(paren, state); + this.next = "sStateWithInterpolation"; + return this.token; + } + }, { + token: "string.regexp", + regex: /%[r]([(\[<{^|%])/, onMatch: function (val, state, stack) { + if (stack.length) + stack = []; + var paren = val[val.length - 1]; + stack.unshift(paren, state); + this.next = "rState"; + return this.token; + } }], { - token : "text", // namespaces aren't symbols - regex : "::" + token: "punctuation", // namespaces aren't symbols + regex: "::" + }, + instanceVariable, + { + token: "variable.global", // global variable + regex: "[$][a-zA-Z_\\d]+" }, { - token : "variable.instance", // instance variable - regex : "@{1,2}[a-zA-Z_\\d]+" + token: "support.class", // class name + regex: "[A-Z][a-zA-Z_\\d]*" }, { - token : "support.class", // class name - regex : "[A-Z][a-zA-Z_\\d]+" + token: ["punctuation.operator", "support.function"], + regex: /(\.)([a-zA-Z_\d]+)(?=\()/ + }, { + token: ["punctuation.operator", "identifier"], + regex: /(\.)([a-zA-Z_][a-zA-Z_\d]*)/ + }, { + token: "string.character", + regex: "\\B\\?(?:" + escapedChars + "|\\S)" + }, { + token: "punctuation.operator", + regex: /\?(?=.+:)/ }, + constantNumericRational, + constantNumericComplex, constantOtherSymbol, constantNumericHex, constantNumericFloat, - + constantNumericBinary, + constantNumericDecimal, + constantNumericOctal, { - token : "constant.language.boolean", - regex : "(?:true|false)\\b" + token: "constant.language.boolean", + regex: "(?:true|false)\\b" }, { - token : keywordMapper, - regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" + token: keywordMapper, + regex: "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" }, { - token : "punctuation.separator.key-value", - regex : "=>" + token: "punctuation.separator.key-value", + regex: "=>" }, { stateName: "heredoc", - onMatch : function(value, currentState, stack) { - var next = value[2] == '-' ? "indentedHeredoc" : "heredoc"; + onMatch: function (value, currentState, stack) { + var next = (value[2] == '-' || value[2] == '~') ? "indentedHeredoc" : "heredoc"; var tokens = value.split(this.splitRegex); stack.push(next, tokens[3]); return [ - {type:"constant", value: tokens[1]}, - {type:"string", value: tokens[2]}, - {type:"support.class", value: tokens[3]}, - {type:"string", value: tokens[4]} + {type: "constant", value: tokens[1]}, + {type: "string", value: tokens[2]}, + {type: "support.class", value: tokens[3]}, + {type: "string", value: tokens[4]} ]; }, - regex : "(<<-?)(['\"`]?)([\\w]+)(['\"`]?)", + regex: "(<<[-~]?)(['\"`]?)([\\w]+)(['\"`]?)", rules: { heredoc: [{ - onMatch: function(value, currentState, stack) { + onMatch: function(value, currentState, stack) { if (value === stack[1]) { stack.shift(); stack.shift(); @@ -1237,7 +1328,7 @@ var RubyHighlightRules = function() { token: "string", regex: "^ +" }, { - onMatch: function(value, currentState, stack) { + onMatch: function(value, currentState, stack) { if (value === stack[1]) { stack.shift(); stack.shift(); @@ -1252,38 +1343,261 @@ var RubyHighlightRules = function() { }] } }, { - regex : "$", - token : "empty", - next : function(currentState, stack) { + regex: "$", + token: "empty", + next: function(currentState, stack) { if (stack[0] === "heredoc" || stack[0] === "indentedHeredoc") return stack[0]; return currentState; } + }, { + token: "keyword.operator", + regex: "!|\\$|%|&|\\*|/|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\||\\b(?:in|instanceof|new|delete|typeof|void)" }, { - token : "string.character", - regex : "\\B\\?." + token: "paren.lparen", + regex: "[[({]" }, { - token : "keyword.operator", - regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)" + token: "paren.rparen", + regex: "[\\])}]", + onMatch: function(value, currentState, stack) { + this.next = ''; + if (value == "}" && stack.length > 1 && stack[1] != "start") { + stack.shift(); + this.next = stack.shift(); + } + return this.token; + } }, { - token : "paren.lparen", - regex : "[[({]" + token: "text", + regex: "\\s+" }, { - token : "paren.rparen", - regex : "[\\])}]" - }, { - token : "text", - regex : "\\s+" + token: "punctuation.operator", + regex: /[?:,;.]/ } ], - "comment" : [ + "comment": [ { - token : "comment", // closing comment - regex : "^=end(?:$|\\s.*$)", - next : "start" + token: "comment.multiline", // closing comment + regex: "^=end(?=$|\\s.*$)", + next: "start" }, { - token : "comment", // comment spanning whole line - regex : ".+" + token: "comment", // comment spanning whole line + regex: ".+" + } + ], + "qStateWithInterpolation": [{ + token: "string.start",// excluded nested |^% due to difficulty in realization + regex: /[(\[<{]/, onMatch: function (val, state, stack) { + if (stack.length && val === stack[0]) { + stack.unshift(val, state); + return this.token; + } + return "string"; + } + }, { + token: "constant.language.escape", + regex: escapedChars + }, { + token: "constant.language.escape", + regex: /\\./ + }, { + token: "paren.start", + regex: /#{/, + push: "start" + }, { + token: "string.end", + regex: /[)\]>}^|%]/, onMatch: function (val, state, stack) { + if (stack.length && val === closeParen[stack[0]]) { + stack.shift(); + this.next = stack.shift(); + return this.token; + } + this.next = ''; + return "string"; + } + }, { + defaultToken: "string" + }], + "qStateWithoutInterpolation": [{ + token: "string.start",// excluded nested |^% due to difficulty in realization + regex: /[(\[<{]/, onMatch: function (val, state, stack) { + if (stack.length && val === stack[0]) { + stack.unshift(val, state); + return this.token; + } + return "string"; + } + }, { + token: "constant.language.escape", + regex: /\\['\\]/ + }, { + token: "constant.language.escape", + regex: /\\./ + }, { + token: "string.end", + regex: /[)\]>}^|%]/, onMatch: function (val, state, stack) { + if (stack.length && val === closeParen[stack[0]]) { + stack.shift(); + this.next = stack.shift(); + return this.token; + } + this.next = ''; + return "string"; + } + }, { + defaultToken: "string" + }], + "sStateWithoutInterpolation": [{ + token: "constant.other.symbol.ruby",// excluded nested |^% due to difficulty in realization + regex: /[(\[<{]/, onMatch: function (val, state, stack) { + if (stack.length && val === stack[0]) { + stack.unshift(val, state); + return this.token; + } + return "constant.other.symbol.ruby"; + } + }, { + token: "constant.other.symbol.ruby", + regex: /[)\]>}^|%]/, onMatch: function (val, state, stack) { + if (stack.length && val === closeParen[stack[0]]) { + stack.shift(); + this.next = stack.shift(); + return this.token; + } + this.next = ''; + return "constant.other.symbol.ruby"; + } + }, { + defaultToken: "constant.other.symbol.ruby" + }], + "sStateWithInterpolation": [{ + token: "constant.other.symbol.ruby",// excluded nested |^% due to difficulty in realization + regex: /[(\[<{]/, onMatch: function (val, state, stack) { + if (stack.length && val === stack[0]) { + stack.unshift(val, state); + return this.token; + } + return "constant.other.symbol.ruby"; + } + }, { + token: "constant.language.escape", + regex: escapedChars + }, { + token: "constant.language.escape", + regex: /\\./ + }, { + token: "paren.start", + regex: /#{/, + push: "start" + }, { + token: "constant.other.symbol.ruby", + regex: /[)\]>}^|%]/, onMatch: function (val, state, stack) { + if (stack.length && val === closeParen[stack[0]]) { + stack.shift(); + this.next = stack.shift(); + return this.token; + } + this.next = ''; + return "constant.other.symbol.ruby"; + } + }, { + defaultToken: "constant.other.symbol.ruby" + }], + "rState": [{ + token: "string.regexp",// excluded nested |^% due to difficulty in realization + regex: /[(\[<{]/, onMatch: function (val, state, stack) { + if (stack.length && val === stack[0]) { + stack.unshift(val, state); + return this.token; + } + return "constant.language.escape"; + } + }, { + token: "paren.start", + regex: /#{/, + push: "start" + }, { + token: "string.regexp", + regex: /\// + }, { + token: "string.regexp", + regex: /[)\]>}^|%][imxouesn]*/, onMatch: function (val, state, stack) { + if (stack.length && val[0] === closeParen[stack[0]]) { + stack.shift(); + this.next = stack.shift(); + return this.token; + } + this.next = ''; + return "constant.language.escape"; + } + }, + {include: "regex"}, + { + defaultToken: "string.regexp" + }], + "regex": [ + {// character classes + token: "regexp.keyword", + regex: /\\[wWdDhHsS]/ + }, { + token: "constant.language.escape", + regex: /\\[AGbBzZ]/ + }, { + token: "constant.language.escape", + regex: /\\g<[a-zA-Z0-9]*>/ + }, { + token: ["constant.language.escape", "regexp.keyword", "constant.language.escape"], + regex: /(\\p{\^?)(Alnum|Alpha|Blank|Cntrl|Digit|Graph|Lower|Print|Punct|Space|Upper|XDigit|Word|ASCII|Any|Assigned|Arabic|Armenian|Balinese|Bengali|Bopomofo|Braille|Buginese|Buhid|Canadian_Aboriginal|Carian|Cham|Cherokee|Common|Coptic|Cuneiform|Cypriot|Cyrillic|Deseret|Devanagari|Ethiopic|Georgian|Glagolitic|Gothic|Greek|Gujarati|Gurmukhi|Han|Hangul|Hanunoo|Hebrew|Hiragana|Inherited|Kannada|Katakana|Kayah_Li|Kharoshthi|Khmer|Lao|Latin|Lepcha|Limbu|Linear_B|Lycian|Lydian|Malayalam|Mongolian|Myanmar|New_Tai_Lue|Nko|Ogham|Ol_Chiki|Old_Italic|Old_Persian|Oriya|Osmanya|Phags_Pa|Phoenician|Rejang|Runic|Saurashtra|Shavian|Sinhala|Sundanese|Syloti_Nagri|Syriac|Tagalog|Tagbanwa|Tai_Le|Tamil|Telugu|Thaana|Thai|Tibetan|Tifinagh|Ugaritic|Vai|Yi|Ll|Lm|Lt|Lu|Lo|Mn|Mc|Me|Nd|Nl|Pc|Pd|Ps|Pe|Pi|Pf|Po|No|Sm|Sc|Sk|So|Zs|Zl|Zp|Cc|Cf|Cn|Co|Cs|N|L|M|P|S|Z|C)(})/ + }, { + token: ["constant.language.escape", "invalid", "constant.language.escape"], + regex: /(\\p{\^?)([^/]*)(})/ + }, {// escapes + token: "regexp.keyword.operator", + regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" + }, {// flag + token: "string.regexp", + regex: /[/][imxouesn]*/, + next: "start" + }, {// invalid operators + token: "invalid", + regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/ + }, {// operators + token: "constant.language.escape", + regex: /\(\?(?:[:=!>]|<'?[a-zA-Z]*'?>|<[=!])|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/ + }, { + token: "constant.language.delimiter", + regex: /\|/ + }, { + token: "regexp.keyword", + regex: /\[\[:(?:alnum|alpha|blank|cntrl|digit|graph|lower|print|punct|space|upper|xdigit|word|ascii):\]\]/ + }, { + token: "constant.language.escape", + regex: /\[\^?/, + push: "regex_character_class" + }, { + defaultToken: "string.regexp" + } + ], + "regex_character_class": [ + { + token: "regexp.keyword", + regex: /\\[wWdDhHsS]/ + }, { + token: "regexp.charclass.keyword.operator", + regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" + }, { + token: "constant.language.escape", + regex: /&?&?\[\^?/, + push: "regex_character_class" + }, { + token: "constant.language.escape", + regex: "]", + next: "pop" + }, { + token: "constant.language.escape", + regex: "-" + }, { + defaultToken: "string.regexp.characterclass" } ] }; @@ -1545,6 +1859,7 @@ oop.inherits(Mode, TextMode); this.lineCommentStart = "//"; this.$id = "ace/mode/haml"; + this.snippetFileId = "ace/snippets/haml"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-handlebars.js b/htdocs/includes/ace/src/mode-handlebars.js index 620074baff2..ba8f7e015fc 100644 --- a/htdocs/includes/ace/src/mode-handlebars.js +++ b/htdocs/includes/ace/src/mode-handlebars.js @@ -784,6 +784,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/javascript"; + this.snippetFileId = "ace/snippets/javascript"; }).call(Mode.prototype); exports.Mode = Mode; @@ -1316,6 +1317,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/css"; + this.snippetFileId = "ace/snippets/css"; }).call(Mode.prototype); exports.Mode = Mode; @@ -2493,6 +2495,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/html"; + this.snippetFileId = "ace/snippets/html"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-haskell.js b/htdocs/includes/ace/src/mode-haskell.js index af5eff5693a..bf5f1d6edb3 100644 --- a/htdocs/includes/ace/src/mode-haskell.js +++ b/htdocs/includes/ace/src/mode-haskell.js @@ -366,6 +366,7 @@ oop.inherits(Mode, TextMode); this.lineCommentStart = "--"; this.blockComment = null; this.$id = "ace/mode/haskell"; + this.snippetFileId = "ace/snippets/haskell"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-html.js b/htdocs/includes/ace/src/mode-html.js index 2d7ddabbdaa..f8466c2ddb7 100644 --- a/htdocs/includes/ace/src/mode-html.js +++ b/htdocs/includes/ace/src/mode-html.js @@ -784,6 +784,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/javascript"; + this.snippetFileId = "ace/snippets/javascript"; }).call(Mode.prototype); exports.Mode = Mode; @@ -1316,6 +1317,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/css"; + this.snippetFileId = "ace/snippets/css"; }).call(Mode.prototype); exports.Mode = Mode; @@ -2493,6 +2495,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/html"; + this.snippetFileId = "ace/snippets/html"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-html_elixir.js b/htdocs/includes/ace/src/mode-html_elixir.js index 5d80fcbbcef..53fa828bdde 100644 --- a/htdocs/includes/ace/src/mode-html_elixir.js +++ b/htdocs/includes/ace/src/mode-html_elixir.js @@ -1704,6 +1704,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/javascript"; + this.snippetFileId = "ace/snippets/javascript"; }).call(Mode.prototype); exports.Mode = Mode; @@ -2041,6 +2042,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/css"; + this.snippetFileId = "ace/snippets/css"; }).call(Mode.prototype); exports.Mode = Mode; @@ -2933,6 +2935,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/html"; + this.snippetFileId = "ace/snippets/html"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-html_ruby.js b/htdocs/includes/ace/src/mode-html_ruby.js index ec77543f358..e3eb0f7761a 100644 --- a/htdocs/includes/ace/src/mode-html_ruby.js +++ b/htdocs/includes/ace/src/mode-html_ruby.js @@ -1012,17 +1012,17 @@ var constantOtherSymbol = exports.constantOtherSymbol = { regex : "[:](?:[A-Za-z_]|[@$](?=[a-zA-Z0-9_]))[a-zA-Z0-9_]*[!=?]?" }; -var qString = exports.qString = { +exports.qString = { token : "string", // single line regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" }; -var qqString = exports.qqString = { +exports.qqString = { token : "string", // single line regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' }; -var tString = exports.tString = { +exports.tString = { token : "string", // backtick string regex : "[`](?:(?:\\\\.)|(?:[^'\\\\]))*?[`]" }; @@ -1032,9 +1032,34 @@ var constantNumericHex = exports.constantNumericHex = { regex : "0[xX][0-9a-fA-F](?:[0-9a-fA-F]|_(?=[0-9a-fA-F]))*\\b" }; +var constantNumericBinary = exports.constantNumericBinary = { + token: "constant.numeric", + regex: /\b(0[bB][01](?:[01]|_(?=[01]))*)\b/ +}; + +var constantNumericDecimal = exports.constantNumericDecimal = { + token: "constant.numeric", + regex: /\b(0[dD](?:[1-9](?:[\d]|_(?=[\d]))*|0))\b/ +}; + +var constantNumericOctal = exports.constantNumericDecimal = { + token: "constant.numeric", + regex: /\b(0[oO]?(?:[1-7](?:[0-7]|_(?=[0-7]))*|0))\b/ +}; + +var constantNumericRational = exports.constantNumericRational = { + token: "constant.numeric", //rational + complex + regex: /\b([\d]+(?:[./][\d]+)?ri?)\b/ +}; + +var constantNumericComplex = exports.constantNumericComplex = { + token: "constant.numeric", //simple complex numbers + regex: /\b([\d]i)\b/ +}; + var constantNumericFloat = exports.constantNumericFloat = { - token : "constant.numeric", // float - regex : "[+-]?\\d(?:\\d|_(?=\\d))*(?:(?:\\.\\d(?:\\d|_(?=\\d))*)?(?:[eE][+-]?\\d+)?)?\\b" + token : "constant.numeric", // float + complex + regex : "[+-]?\\d(?:\\d|_(?=\\d))*(?:(?:\\.\\d(?:\\d|_(?=\\d))*)?(?:[eE][+-]?\\d+)?)?i?\\b" }; var instanceVariable = exports.instanceVariable = { @@ -1074,18 +1099,19 @@ var RubyHighlightRules = function() { "filter_parameter_logging|match|get|post|resources|redirect|scope|assert_routing|" + "translate|localize|extract_locale_from_tld|caches_page|expire_page|caches_action|expire_action|" + "cache|expire_fragment|expire_cache_for|observe|cache_sweeper|" + - "has_many|has_one|belongs_to|has_and_belongs_to_many" + "has_many|has_one|belongs_to|has_and_belongs_to_many|p|warn|refine|using|module_function|extend|alias_method|" + + "private_class_method|remove_method|undef_method" ); var keywords = ( "alias|and|BEGIN|begin|break|case|class|def|defined|do|else|elsif|END|end|ensure|" + "__FILE__|finally|for|gem|if|in|__LINE__|module|next|not|or|private|protected|public|" + - "redo|rescue|retry|return|super|then|undef|unless|until|when|while|yield" + "redo|rescue|retry|return|super|then|undef|unless|until|when|while|yield|__ENCODING__|prepend" ); var buildinConstants = ( "true|TRUE|false|FALSE|nil|NIL|ARGF|ARGV|DATA|ENV|RUBY_PLATFORM|RUBY_RELEASE_DATE|" + - "RUBY_VERSION|STDERR|STDIN|STDOUT|TOPLEVEL_BINDING" + "RUBY_VERSION|STDERR|STDIN|STDOUT|TOPLEVEL_BINDING|RUBY_PATCHLEVEL|RUBY_REVISION|RUBY_COPYRIGHT|RUBY_ENGINE|RUBY_ENGINE_VERSION|RUBY_DESCRIPTION" ); var builtinVariables = ( @@ -1101,126 +1127,191 @@ var RubyHighlightRules = function() { "invalid.deprecated": "debugger" // TODO is this a remnant from js mode? }, "identifier"); + var escapedChars = "\\\\(?:n(?:[1-7][0-7]{0,2}|0)|[nsrtvfbae'\"\\\\]|c(?:\\\\M-)?.|M-(?:\\\\C-|\\\\c)?.|C-(?:\\\\M-)?.|[0-7]{3}|x[\\da-fA-F]{2}|u[\\da-fA-F]{4}|u{[\\da-fA-F]{1,6}(?:\\s[\\da-fA-F]{1,6})*})"; + + var closeParen = { + "(": ")", + "[": "]", + "{": "}", + "<": ">", + "^": "^", + "|": "|", + "%": "%" + }; + this.$rules = { - "start" : [ + "start": [ { - token : "comment", - regex : "#.*$" + token: "comment", + regex: "#.*$" }, { - token : "comment", // multi line comment - regex : "^=begin(?:$|\\s.*$)", - next : "comment" + token: "comment.multiline", // multi line comment + regex: "^=begin(?=$|\\s.*$)", + next: "comment" }, { - token : "string.regexp", - regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)" + token: "string.regexp", + regex: /[/](?=.*\/)/, + next: "regex" }, [{ - regex: "[{}]", onMatch: function(val, state, stack) { - this.next = val == "{" ? this.nextState : ""; - if (val == "{" && stack.length) { - stack.unshift("start", state); - return "paren.lparen"; - } - if (val == "}" && stack.length) { - stack.shift(); - this.next = stack.shift(); - if (this.next.indexOf("string") != -1) - return "paren.end"; - } - return val == "{" ? "paren.lparen" : "paren.rparen"; - }, - nextState: "start" - }, { - token : "string.start", - regex : /"/, - push : [{ - token : "constant.language.escape", - regex : /\\(?:[nsrtvfbae'"\\]|c.|C-.|M-.(?:\\C-.)?|[0-7]{3}|x[\da-fA-F]{2}|u[\da-fA-F]{4})/ + token: ["constant.other.symbol.ruby", "string.start"], + regex: /(:)?(")/, + push: [{ + token: "constant.language.escape", + regex: escapedChars }, { - token : "paren.start", - regex : /#{/, - push : "start" + token: "paren.start", + regex: /#{/, + push: "start" }, { - token : "string.end", - regex : /"/, - next : "pop" + token: "string.end", + regex: /"/, + next: "pop" }, { defaultToken: "string" }] }, { - token : "string.start", - regex : /`/, - push : [{ - token : "constant.language.escape", - regex : /\\(?:[nsrtvfbae'"\\]|c.|C-.|M-.(?:\\C-.)?|[0-7]{3}|x[\da-fA-F]{2}|u[\da-fA-F]{4})/ + token: "string.start", + regex: /`/, + push: [{ + token: "constant.language.escape", + regex: escapedChars }, { - token : "paren.start", - regex : /#{/, - push : "start" + token: "paren.start", + regex: /#{/, + push: "start" }, { - token : "string.end", - regex : /`/, - next : "pop" + token: "string.end", + regex: /`/, + next: "pop" }, { defaultToken: "string" }] }, { - token : "string.start", - regex : /'/, - push : [{ - token : "constant.language.escape", - regex : /\\['\\]/ - }, { - token : "string.end", - regex : /'/, - next : "pop" + token: ["constant.other.symbol.ruby", "string.start"], + regex: /(:)?(')/, + push: [{ + token: "constant.language.escape", + regex: /\\['\\]/ + }, { + token: "string.end", + regex: /'/, + next: "pop" }, { defaultToken: "string" }] + }, { + token: "string.start",//doesn't see any differences between strings and array of strings in highlighting + regex: /%[qwx]([(\[<{^|%])/, onMatch: function (val, state, stack) { + if (stack.length) + stack = []; + var paren = val[val.length - 1]; + stack.unshift(paren, state); + this.next = "qStateWithoutInterpolation"; + return this.token; + } + }, { + token: "string.start", //doesn't see any differences between strings and array of strings in highlighting + regex: /%[QWX]?([(\[<{^|%])/, onMatch: function (val, state, stack) { + if (stack.length) + stack = []; + var paren = val[val.length - 1]; + stack.unshift(paren, state); + this.next = "qStateWithInterpolation"; + return this.token; + } + }, { + token: "constant.other.symbol.ruby", //doesn't see any differences between symbols and array of symbols in highlighting + regex: /%[si]([(\[<{^|%])/, onMatch: function (val, state, stack) { + if (stack.length) + stack = []; + var paren = val[val.length - 1]; + stack.unshift(paren, state); + this.next = "sStateWithoutInterpolation"; + return this.token; + } + }, { + token: "constant.other.symbol.ruby", //doesn't see any differences between symbols and array of symbols in highlighting + regex: /%[SI]([(\[<{^|%])/, onMatch: function (val, state, stack) { + if (stack.length) + stack = []; + var paren = val[val.length - 1]; + stack.unshift(paren, state); + this.next = "sStateWithInterpolation"; + return this.token; + } + }, { + token: "string.regexp", + regex: /%[r]([(\[<{^|%])/, onMatch: function (val, state, stack) { + if (stack.length) + stack = []; + var paren = val[val.length - 1]; + stack.unshift(paren, state); + this.next = "rState"; + return this.token; + } }], { - token : "text", // namespaces aren't symbols - regex : "::" + token: "punctuation", // namespaces aren't symbols + regex: "::" + }, + instanceVariable, + { + token: "variable.global", // global variable + regex: "[$][a-zA-Z_\\d]+" }, { - token : "variable.instance", // instance variable - regex : "@{1,2}[a-zA-Z_\\d]+" + token: "support.class", // class name + regex: "[A-Z][a-zA-Z_\\d]*" }, { - token : "support.class", // class name - regex : "[A-Z][a-zA-Z_\\d]+" + token: ["punctuation.operator", "support.function"], + regex: /(\.)([a-zA-Z_\d]+)(?=\()/ + }, { + token: ["punctuation.operator", "identifier"], + regex: /(\.)([a-zA-Z_][a-zA-Z_\d]*)/ + }, { + token: "string.character", + regex: "\\B\\?(?:" + escapedChars + "|\\S)" + }, { + token: "punctuation.operator", + regex: /\?(?=.+:)/ }, + constantNumericRational, + constantNumericComplex, constantOtherSymbol, constantNumericHex, constantNumericFloat, - + constantNumericBinary, + constantNumericDecimal, + constantNumericOctal, { - token : "constant.language.boolean", - regex : "(?:true|false)\\b" + token: "constant.language.boolean", + regex: "(?:true|false)\\b" }, { - token : keywordMapper, - regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" + token: keywordMapper, + regex: "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" }, { - token : "punctuation.separator.key-value", - regex : "=>" + token: "punctuation.separator.key-value", + regex: "=>" }, { stateName: "heredoc", - onMatch : function(value, currentState, stack) { - var next = value[2] == '-' ? "indentedHeredoc" : "heredoc"; + onMatch: function (value, currentState, stack) { + var next = (value[2] == '-' || value[2] == '~') ? "indentedHeredoc" : "heredoc"; var tokens = value.split(this.splitRegex); stack.push(next, tokens[3]); return [ - {type:"constant", value: tokens[1]}, - {type:"string", value: tokens[2]}, - {type:"support.class", value: tokens[3]}, - {type:"string", value: tokens[4]} + {type: "constant", value: tokens[1]}, + {type: "string", value: tokens[2]}, + {type: "support.class", value: tokens[3]}, + {type: "string", value: tokens[4]} ]; }, - regex : "(<<-?)(['\"`]?)([\\w]+)(['\"`]?)", + regex: "(<<[-~]?)(['\"`]?)([\\w]+)(['\"`]?)", rules: { heredoc: [{ - onMatch: function(value, currentState, stack) { + onMatch: function(value, currentState, stack) { if (value === stack[1]) { stack.shift(); stack.shift(); @@ -1237,7 +1328,7 @@ var RubyHighlightRules = function() { token: "string", regex: "^ +" }, { - onMatch: function(value, currentState, stack) { + onMatch: function(value, currentState, stack) { if (value === stack[1]) { stack.shift(); stack.shift(); @@ -1252,38 +1343,261 @@ var RubyHighlightRules = function() { }] } }, { - regex : "$", - token : "empty", - next : function(currentState, stack) { + regex: "$", + token: "empty", + next: function(currentState, stack) { if (stack[0] === "heredoc" || stack[0] === "indentedHeredoc") return stack[0]; return currentState; } + }, { + token: "keyword.operator", + regex: "!|\\$|%|&|\\*|/|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\||\\b(?:in|instanceof|new|delete|typeof|void)" }, { - token : "string.character", - regex : "\\B\\?." + token: "paren.lparen", + regex: "[[({]" }, { - token : "keyword.operator", - regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)" + token: "paren.rparen", + regex: "[\\])}]", + onMatch: function(value, currentState, stack) { + this.next = ''; + if (value == "}" && stack.length > 1 && stack[1] != "start") { + stack.shift(); + this.next = stack.shift(); + } + return this.token; + } }, { - token : "paren.lparen", - regex : "[[({]" + token: "text", + regex: "\\s+" }, { - token : "paren.rparen", - regex : "[\\])}]" - }, { - token : "text", - regex : "\\s+" + token: "punctuation.operator", + regex: /[?:,;.]/ } ], - "comment" : [ + "comment": [ { - token : "comment", // closing comment - regex : "^=end(?:$|\\s.*$)", - next : "start" + token: "comment.multiline", // closing comment + regex: "^=end(?=$|\\s.*$)", + next: "start" }, { - token : "comment", // comment spanning whole line - regex : ".+" + token: "comment", // comment spanning whole line + regex: ".+" + } + ], + "qStateWithInterpolation": [{ + token: "string.start",// excluded nested |^% due to difficulty in realization + regex: /[(\[<{]/, onMatch: function (val, state, stack) { + if (stack.length && val === stack[0]) { + stack.unshift(val, state); + return this.token; + } + return "string"; + } + }, { + token: "constant.language.escape", + regex: escapedChars + }, { + token: "constant.language.escape", + regex: /\\./ + }, { + token: "paren.start", + regex: /#{/, + push: "start" + }, { + token: "string.end", + regex: /[)\]>}^|%]/, onMatch: function (val, state, stack) { + if (stack.length && val === closeParen[stack[0]]) { + stack.shift(); + this.next = stack.shift(); + return this.token; + } + this.next = ''; + return "string"; + } + }, { + defaultToken: "string" + }], + "qStateWithoutInterpolation": [{ + token: "string.start",// excluded nested |^% due to difficulty in realization + regex: /[(\[<{]/, onMatch: function (val, state, stack) { + if (stack.length && val === stack[0]) { + stack.unshift(val, state); + return this.token; + } + return "string"; + } + }, { + token: "constant.language.escape", + regex: /\\['\\]/ + }, { + token: "constant.language.escape", + regex: /\\./ + }, { + token: "string.end", + regex: /[)\]>}^|%]/, onMatch: function (val, state, stack) { + if (stack.length && val === closeParen[stack[0]]) { + stack.shift(); + this.next = stack.shift(); + return this.token; + } + this.next = ''; + return "string"; + } + }, { + defaultToken: "string" + }], + "sStateWithoutInterpolation": [{ + token: "constant.other.symbol.ruby",// excluded nested |^% due to difficulty in realization + regex: /[(\[<{]/, onMatch: function (val, state, stack) { + if (stack.length && val === stack[0]) { + stack.unshift(val, state); + return this.token; + } + return "constant.other.symbol.ruby"; + } + }, { + token: "constant.other.symbol.ruby", + regex: /[)\]>}^|%]/, onMatch: function (val, state, stack) { + if (stack.length && val === closeParen[stack[0]]) { + stack.shift(); + this.next = stack.shift(); + return this.token; + } + this.next = ''; + return "constant.other.symbol.ruby"; + } + }, { + defaultToken: "constant.other.symbol.ruby" + }], + "sStateWithInterpolation": [{ + token: "constant.other.symbol.ruby",// excluded nested |^% due to difficulty in realization + regex: /[(\[<{]/, onMatch: function (val, state, stack) { + if (stack.length && val === stack[0]) { + stack.unshift(val, state); + return this.token; + } + return "constant.other.symbol.ruby"; + } + }, { + token: "constant.language.escape", + regex: escapedChars + }, { + token: "constant.language.escape", + regex: /\\./ + }, { + token: "paren.start", + regex: /#{/, + push: "start" + }, { + token: "constant.other.symbol.ruby", + regex: /[)\]>}^|%]/, onMatch: function (val, state, stack) { + if (stack.length && val === closeParen[stack[0]]) { + stack.shift(); + this.next = stack.shift(); + return this.token; + } + this.next = ''; + return "constant.other.symbol.ruby"; + } + }, { + defaultToken: "constant.other.symbol.ruby" + }], + "rState": [{ + token: "string.regexp",// excluded nested |^% due to difficulty in realization + regex: /[(\[<{]/, onMatch: function (val, state, stack) { + if (stack.length && val === stack[0]) { + stack.unshift(val, state); + return this.token; + } + return "constant.language.escape"; + } + }, { + token: "paren.start", + regex: /#{/, + push: "start" + }, { + token: "string.regexp", + regex: /\// + }, { + token: "string.regexp", + regex: /[)\]>}^|%][imxouesn]*/, onMatch: function (val, state, stack) { + if (stack.length && val[0] === closeParen[stack[0]]) { + stack.shift(); + this.next = stack.shift(); + return this.token; + } + this.next = ''; + return "constant.language.escape"; + } + }, + {include: "regex"}, + { + defaultToken: "string.regexp" + }], + "regex": [ + {// character classes + token: "regexp.keyword", + regex: /\\[wWdDhHsS]/ + }, { + token: "constant.language.escape", + regex: /\\[AGbBzZ]/ + }, { + token: "constant.language.escape", + regex: /\\g<[a-zA-Z0-9]*>/ + }, { + token: ["constant.language.escape", "regexp.keyword", "constant.language.escape"], + regex: /(\\p{\^?)(Alnum|Alpha|Blank|Cntrl|Digit|Graph|Lower|Print|Punct|Space|Upper|XDigit|Word|ASCII|Any|Assigned|Arabic|Armenian|Balinese|Bengali|Bopomofo|Braille|Buginese|Buhid|Canadian_Aboriginal|Carian|Cham|Cherokee|Common|Coptic|Cuneiform|Cypriot|Cyrillic|Deseret|Devanagari|Ethiopic|Georgian|Glagolitic|Gothic|Greek|Gujarati|Gurmukhi|Han|Hangul|Hanunoo|Hebrew|Hiragana|Inherited|Kannada|Katakana|Kayah_Li|Kharoshthi|Khmer|Lao|Latin|Lepcha|Limbu|Linear_B|Lycian|Lydian|Malayalam|Mongolian|Myanmar|New_Tai_Lue|Nko|Ogham|Ol_Chiki|Old_Italic|Old_Persian|Oriya|Osmanya|Phags_Pa|Phoenician|Rejang|Runic|Saurashtra|Shavian|Sinhala|Sundanese|Syloti_Nagri|Syriac|Tagalog|Tagbanwa|Tai_Le|Tamil|Telugu|Thaana|Thai|Tibetan|Tifinagh|Ugaritic|Vai|Yi|Ll|Lm|Lt|Lu|Lo|Mn|Mc|Me|Nd|Nl|Pc|Pd|Ps|Pe|Pi|Pf|Po|No|Sm|Sc|Sk|So|Zs|Zl|Zp|Cc|Cf|Cn|Co|Cs|N|L|M|P|S|Z|C)(})/ + }, { + token: ["constant.language.escape", "invalid", "constant.language.escape"], + regex: /(\\p{\^?)([^/]*)(})/ + }, {// escapes + token: "regexp.keyword.operator", + regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" + }, {// flag + token: "string.regexp", + regex: /[/][imxouesn]*/, + next: "start" + }, {// invalid operators + token: "invalid", + regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/ + }, {// operators + token: "constant.language.escape", + regex: /\(\?(?:[:=!>]|<'?[a-zA-Z]*'?>|<[=!])|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/ + }, { + token: "constant.language.delimiter", + regex: /\|/ + }, { + token: "regexp.keyword", + regex: /\[\[:(?:alnum|alpha|blank|cntrl|digit|graph|lower|print|punct|space|upper|xdigit|word|ascii):\]\]/ + }, { + token: "constant.language.escape", + regex: /\[\^?/, + push: "regex_character_class" + }, { + defaultToken: "string.regexp" + } + ], + "regex_character_class": [ + { + token: "regexp.keyword", + regex: /\\[wWdDhHsS]/ + }, { + token: "regexp.charclass.keyword.operator", + regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" + }, { + token: "constant.language.escape", + regex: /&?&?\[\^?/, + push: "regex_character_class" + }, { + token: "constant.language.escape", + regex: "]", + next: "pop" + }, { + token: "constant.language.escape", + regex: "-" + }, { + defaultToken: "string.regexp.characterclass" } ] }; @@ -1613,6 +1927,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/javascript"; + this.snippetFileId = "ace/snippets/javascript"; }).call(Mode.prototype); exports.Mode = Mode; @@ -1950,6 +2265,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/css"; + this.snippetFileId = "ace/snippets/css"; }).call(Mode.prototype); exports.Mode = Mode; @@ -2842,99 +3158,277 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/html"; + this.snippetFileId = "ace/snippets/html"; }).call(Mode.prototype); exports.Mode = Mode; }); -define("ace/mode/folding/coffee",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range"], function(require, exports, module) { +define("ace/mode/folding/ruby",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range","ace/token_iterator"], function (require, exports, module) { "use strict"; var oop = require("../../lib/oop"); var BaseFoldMode = require("./fold_mode").FoldMode; var Range = require("../../range").Range; +var TokenIterator = require("../../token_iterator").TokenIterator; + + +var FoldMode = exports.FoldMode = function () { +}; -var FoldMode = exports.FoldMode = function() {}; oop.inherits(FoldMode, BaseFoldMode); -(function() { - - this.getFoldWidgetRange = function(session, foldStyle, row) { - var range = this.indentationBlock(session, row); - if (range) - return range; - - var re = /\S/; - var line = session.getLine(row); - var startLevel = line.search(re); - if (startLevel == -1 || line[startLevel] != "#") - return; - - var startColumn = line.length; - var maxRow = session.getLength(); - var startRow = row; - var endRow = row; - - while (++row < maxRow) { - line = session.getLine(row); - var level = line.search(re); - - if (level == -1) - continue; - - if (line[level] != "#") - break; - - endRow = row; - } - - if (endRow > startRow) { - var endColumn = session.getLine(endRow).length; - return new Range(startRow, startColumn, endRow, endColumn); - } +(function () { + this.indentKeywords = { + "class": 1, + "def": 1, + "module": 1, + "do": 1, + "unless": 1, + "if": 1, + "while": 1, + "for": 1, + "until": 1, + "begin": 1, + "else": 0, + "elsif": 0, + "rescue": 0, + "ensure": 0, + "when": 0, + "end": -1, + "case": 1, + "=begin": 1, + "=end": -1 }; - this.getFoldWidget = function(session, foldStyle, row) { - var line = session.getLine(row); - var indent = line.search(/\S/); - var next = session.getLine(row + 1); - var prev = session.getLine(row - 1); - var prevIndent = prev.search(/\S/); - var nextIndent = next.search(/\S/); - if (indent == -1) { - session.foldWidgets[row - 1] = prevIndent!= -1 && prevIndent < nextIndent ? "start" : ""; - return ""; - } - if (prevIndent == -1) { - if (indent == nextIndent && line[indent] == "#" && next[indent] == "#") { - session.foldWidgets[row - 1] = ""; - session.foldWidgets[row + 1] = ""; + this.foldingStartMarker = /(?:\s|^)(def|do|while|class|unless|module|if|for|until|begin|else|elsif|case|rescue|ensure|when)\b|({\s*$)|(=begin)/; + this.foldingStopMarker = /(=end(?=$|\s.*$))|(^\s*})|\b(end)\b/; + + this.getFoldWidget = function (session, foldStyle, row) { + var line = session.getLine(row); + var isStart = this.foldingStartMarker.test(line); + var isEnd = this.foldingStopMarker.test(line); + + if (isStart && !isEnd) { + var match = line.match(this.foldingStartMarker); + if (match[1]) { + if (match[1] == "if" || match[1] == "else" || match[1] == "while" || match[1] == "until" || match[1] == "unless") { + if (match[1] == "else" && /^\s*else\s*$/.test(line) === false) { + return; + } + if (/^\s*(?:if|else|while|until|unless)\s*/.test(line) === false) { + return; + } + } + + if (match[1] == "when") { + if (/\sthen\s/.test(line) === true) { + return; + } + } + if (session.getTokenAt(row, match.index + 2).type === "keyword") + return "start"; + } else if (match[3]) { + if (session.getTokenAt(row, match.index + 1).type === "comment.multiline") + return "start"; + } else { return "start"; } - } else if (prevIndent == indent && line[indent] == "#" && prev[indent] == "#") { - if (session.getLine(row - 2).search(/\S/) == -1) { - session.foldWidgets[row - 1] = "start"; - session.foldWidgets[row + 1] = ""; - return ""; + } + if (foldStyle != "markbeginend" || !isEnd || isStart && isEnd) + return ""; + + var match = line.match(this.foldingStopMarker); + if (match[3] === "end") { + if (session.getTokenAt(row, match.index + 1).type === "keyword") + return "end"; + } else if (match[1]) { + if (session.getTokenAt(row, match.index + 1).type === "comment.multiline") + return "end"; + } else + return "end"; + }; + + this.getFoldWidgetRange = function (session, foldStyle, row) { + var line = session.doc.getLine(row); + var match = this.foldingStartMarker.exec(line); + if (match) { + if (match[1] || match[3]) + return this.rubyBlock(session, row, match.index + 2); + + return this.openingBracketBlock(session, "{", row, match.index); + } + + var match = this.foldingStopMarker.exec(line); + if (match) { + if (match[3] === "end") { + if (session.getTokenAt(row, match.index + 1).type === "keyword") + return this.rubyBlock(session, row, match.index + 1); + } + + if (match[1] === "=end") { + if (session.getTokenAt(row, match.index + 1).type === "comment.multiline") + return this.rubyBlock(session, row, match.index + 1); + } + + return this.closingBracketBlock(session, "}", row, match.index + match[0].length); + } + }; + + this.rubyBlock = function (session, row, column, tokenRange) { + var stream = new TokenIterator(session, row, column); + + var token = stream.getCurrentToken(); + if (!token || (token.type != "keyword" && token.type != "comment.multiline")) + return; + + var val = token.value; + var line = session.getLine(row); + switch (token.value) { + case "if": + case "unless": + case "while": + case "until": + var checkToken = new RegExp("^\\s*" + token.value); + if (!checkToken.test(line)) { + return; + } + var dir = this.indentKeywords[val]; + break; + case "when": + if (/\sthen\s/.test(line)) { + return; + } + case "elsif": + case "rescue": + case "ensure": + var dir = 1; + break; + case "else": + var checkToken = new RegExp("^\\s*" + token.value + "\\s*$"); + if (!checkToken.test(line)) { + return; + } + var dir = 1; + break; + default: + var dir = this.indentKeywords[val]; + break; + } + + var stack = [val]; + if (!dir) + return; + + var startColumn = dir === -1 ? session.getLine(row - 1).length : session.getLine(row).length; + var startRow = row; + var ranges = []; + ranges.push(stream.getCurrentTokenRange()); + + stream.step = dir === -1 ? stream.stepBackward : stream.stepForward; + if (token.type == "comment.multiline") { + while (token = stream.step()) { + if (token.type !== "comment.multiline") + continue; + if (dir == 1) { + startColumn = 6; + if (token.value == "=end") { + break; + } + } else { + if (token.value == "=begin") { + break; + } + } + } + } else { + while (token = stream.step()) { + var ignore = false; + if (token.type !== "keyword") + continue; + var level = dir * this.indentKeywords[token.value]; + line = session.getLine(stream.getCurrentTokenRow()); + switch (token.value) { + case "do": + for (var i = stream.$tokenIndex - 1; i >= 0; i--) { + var prevToken = stream.$rowTokens[i]; + if (prevToken && (prevToken.value == "while" || prevToken.value == "until" || prevToken.value == "for")) { + level = 0; + break; + } + } + break; + case "else": + var checkToken = new RegExp("^\\s*" + token.value + "\\s*$"); + if (!checkToken.test(line) || val == "case") { + level = 0; + ignore = true; + } + break; + case "if": + case "unless": + case "while": + case "until": + var checkToken = new RegExp("^\\s*" + token.value); + if (!checkToken.test(line)) { + level = 0; + ignore = true; + } + break; + case "when": + if (/\sthen\s/.test(line) || val == "case") { + level = 0; + ignore = true; + } + break; + } + + if (level > 0) { + stack.unshift(token.value); + } else if (level <= 0 && ignore === false) { + stack.shift(); + if (!stack.length) { + if ((val == "while" || val == "until" || val == "for") && token.value != "do") { + break; + } + if (token.value == "do" && dir == -1 && level != 0) + break; + if (token.value != "do") + break; + } + + if (level === 0) { + stack.unshift(token.value); + } + } } } - if (prevIndent!= -1 && prevIndent < indent) - session.foldWidgets[row - 1] = "start"; - else - session.foldWidgets[row - 1] = ""; + if (!token) + return null; - if (indent < nextIndent) - return "start"; - else - return ""; + if (tokenRange) { + ranges.push(stream.getCurrentTokenRange()); + return ranges; + } + + var row = stream.getCurrentTokenRow(); + if (dir === -1) { + if (token.type === "comment.multiline") { + var endColumn = 6; + } else { + var endColumn = session.getLine(row).length; + } + return new Range(row, endColumn, startRow - 1, startColumn); + } else + return new Range(startRow, startColumn, row - 1, session.getLine(row - 1).length); }; }).call(FoldMode.prototype); }); -define("ace/mode/ruby",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/ruby_highlight_rules","ace/mode/matching_brace_outdent","ace/range","ace/mode/behaviour/cstyle","ace/mode/folding/coffee"], function(require, exports, module) { +define("ace/mode/ruby",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/ruby_highlight_rules","ace/mode/matching_brace_outdent","ace/range","ace/mode/behaviour/cstyle","ace/mode/folding/ruby"], function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); @@ -2943,13 +3437,14 @@ var RubyHighlightRules = require("./ruby_highlight_rules").RubyHighlightRules; var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; var Range = require("../range").Range; var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour; -var FoldMode = require("./folding/coffee").FoldMode; +var FoldMode = require("./folding/ruby").FoldMode; var Mode = function() { this.HighlightRules = RubyHighlightRules; this.$outdent = new MatchingBraceOutdent(); this.$behaviour = new CstyleBehaviour(); this.foldingRules = new FoldMode(); + this.indentKeywords = this.foldingRules.indentKeywords; }; oop.inherits(Mode, TextMode); @@ -2964,7 +3459,7 @@ oop.inherits(Mode, TextMode); var tokenizedLine = this.getTokenizer().getLineTokens(line, state); var tokens = tokenizedLine.tokens; - if (tokens.length && tokens[tokens.length-1].type == "comment") { + if (tokens.length && tokens[tokens.length - 1].type == "comment") { return indent; } @@ -2972,7 +3467,7 @@ oop.inherits(Mode, TextMode); var match = line.match(/^.*[\{\(\[]\s*$/); var startingClassOrMethod = line.match(/^\s*(class|def|module)\s.*$/); var startingDoBlock = line.match(/.*do(\s*|\s+\|.*\|\s*)$/); - var startingConditional = line.match(/^\s*(if|else|when)\s*/); + var startingConditional = line.match(/^\s*(if|else|when|elsif|unless|while|for|begin|rescue|ensure)\s*/); if (match || startingClassOrMethod || startingDoBlock || startingConditional) { indent += tab; } @@ -2982,7 +3477,7 @@ oop.inherits(Mode, TextMode); }; this.checkOutdent = function(state, line, input) { - return /^\s+(end|else)$/.test(line + input) || this.$outdent.checkOutdent(line, input); + return /^\s+(end|else|rescue|ensure)$/.test(line + input) || this.$outdent.checkOutdent(line, input); }; this.autoOutdent = function(state, session, row) { @@ -2995,11 +3490,24 @@ oop.inherits(Mode, TextMode); var tab = session.getTabString(); if (prevIndent.length <= indent.length) { if (indent.slice(-tab.length) == tab) - session.remove(new Range(row, indent.length-tab.length, row, indent.length)); + session.remove(new Range(row, indent.length - tab.length, row, indent.length)); } }; + this.getMatching = function(session, row, column) { + if (row == undefined) { + var pos = session.selection.lead; + column = pos.column; + row = pos.row; + } + + var startToken = session.getTokenAt(row, column); + if (startToken && startToken.value in this.indentKeywords) + return this.foldingRules.rubyBlock(session, row, column, true); + }; + this.$id = "ace/mode/ruby"; + this.snippetFileId = "ace/snippets/ruby"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-io.js b/htdocs/includes/ace/src/mode-io.js index aba935b2011..452a803f8d7 100644 --- a/htdocs/includes/ace/src/mode-io.js +++ b/htdocs/includes/ace/src/mode-io.js @@ -234,6 +234,7 @@ oop.inherits(Mode, TextMode); this.lineCommentStart = "//"; this.blockComment = {start: "/*", end: "*/"}; this.$id = "ace/mode/io"; + this.snippetFileId = "ace/snippets/io"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-java.js b/htdocs/includes/ace/src/mode-java.js index ed9cbe351ba..b61e2a90a78 100644 --- a/htdocs/includes/ace/src/mode-java.js +++ b/htdocs/includes/ace/src/mode-java.js @@ -784,6 +784,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/javascript"; + this.snippetFileId = "ace/snippets/javascript"; }).call(Mode.prototype); exports.Mode = Mode; @@ -909,7 +910,7 @@ var JavaHighlightRules = function() { regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" }, { token : "keyword.operator", - regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)" + regex : "!|\\$|%|&|\\||\\^|\\*|\\/|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?|\\:|\\*=|\\/=|%=|\\+=|\\-=|&=|\\|=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)" }, { token : "lparen", regex : "[[({]" @@ -1023,6 +1024,7 @@ oop.inherits(Mode, JavaScriptMode); }; this.$id = "ace/mode/java"; + this.snippetFileId = "ace/snippets/java"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-javascript.js b/htdocs/includes/ace/src/mode-javascript.js index f9640e85d95..be3d822c23d 100644 --- a/htdocs/includes/ace/src/mode-javascript.js +++ b/htdocs/includes/ace/src/mode-javascript.js @@ -784,6 +784,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/javascript"; + this.snippetFileId = "ace/snippets/javascript"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-json.js b/htdocs/includes/ace/src/mode-json.js index 5ade1857f98..2446e39c6a1 100644 --- a/htdocs/includes/ace/src/mode-json.js +++ b/htdocs/includes/ace/src/mode-json.js @@ -275,6 +275,9 @@ oop.inherits(Mode, TextMode); (function() { + this.lineCommentStart = "//"; + this.blockComment = {start: "/*", end: "*/"}; + this.getNextLineIndent = function(state, line, tab) { var indent = this.$getIndent(line); diff --git a/htdocs/includes/ace/src/mode-jsoniq.js b/htdocs/includes/ace/src/mode-jsoniq.js index 2d717609bd9..323317aa4ae 100644 --- a/htdocs/includes/ace/src/mode-jsoniq.js +++ b/htdocs/includes/ace/src/mode-jsoniq.js @@ -2618,6 +2618,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/jsoniq"; + this.snippetFileId = "ace/snippets/jsoniq"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-jsp.js b/htdocs/includes/ace/src/mode-jsp.js index 42cc5f54321..b6c4233441a 100644 --- a/htdocs/includes/ace/src/mode-jsp.js +++ b/htdocs/includes/ace/src/mode-jsp.js @@ -1122,7 +1122,7 @@ var JavaHighlightRules = function() { regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" }, { token : "keyword.operator", - regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)" + regex : "!|\\$|%|&|\\||\\^|\\*|\\/|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?|\\:|\\*=|\\/=|%=|\\+=|\\-=|&=|\\|=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)" }, { token : "lparen", regex : "[[({]" @@ -1419,6 +1419,7 @@ oop.inherits(Mode, TextMode); (function() { this.$id = "ace/mode/jsp"; + this.snippetFileId = "ace/snippets/jsp"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-kotlin.js b/htdocs/includes/ace/src/mode-kotlin.js index 11021b5890a..394271de33c 100644 --- a/htdocs/includes/ace/src/mode-kotlin.js +++ b/htdocs/includes/ace/src/mode-kotlin.js @@ -781,6 +781,8 @@ var Mode = function() { oop.inherits(Mode, TextMode); (function() { + this.lineCommentStart = "//"; + this.blockComment = {start: "/*", end: "*/"}; this.$id = "ace/mode/kotlin"; }).call(Mode.prototype); diff --git a/htdocs/includes/ace/src/mode-latte.js b/htdocs/includes/ace/src/mode-latte.js new file mode 100644 index 00000000000..0377c843865 --- /dev/null +++ b/htdocs/includes/ace/src/mode-latte.js @@ -0,0 +1,2708 @@ +define("ace/mode/doc_comment_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) { +"use strict"; + +var oop = require("../lib/oop"); +var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; + +var DocCommentHighlightRules = function() { + this.$rules = { + "start" : [ { + token : "comment.doc.tag", + regex : "@[\\w\\d_]+" // TODO: fix email addresses + }, + DocCommentHighlightRules.getTagRule(), + { + defaultToken : "comment.doc", + caseInsensitive: true + }] + }; +}; + +oop.inherits(DocCommentHighlightRules, TextHighlightRules); + +DocCommentHighlightRules.getTagRule = function(start) { + return { + token : "comment.doc.tag.storage.type", + regex : "\\b(?:TODO|FIXME|XXX|HACK)\\b" + }; +}; + +DocCommentHighlightRules.getStartRule = function(start) { + return { + token : "comment.doc", // doc comment + regex : "\\/\\*(?=\\*)", + next : start + }; +}; + +DocCommentHighlightRules.getEndRule = function (start) { + return { + token : "comment.doc", // closing comment + regex : "\\*\\/", + next : start + }; +}; + + +exports.DocCommentHighlightRules = DocCommentHighlightRules; + +}); + +define("ace/mode/javascript_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/doc_comment_highlight_rules","ace/mode/text_highlight_rules"], function(require, exports, module) { +"use strict"; + +var oop = require("../lib/oop"); +var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; +var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; +var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*"; + +var JavaScriptHighlightRules = function(options) { + var keywordMapper = this.createKeywordMapper({ + "variable.language": + "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors + "Namespace|QName|XML|XMLList|" + // E4X + "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" + + "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" + + "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors + "SyntaxError|TypeError|URIError|" + + "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions + "isNaN|parseFloat|parseInt|" + + "JSON|Math|" + // Other + "this|arguments|prototype|window|document" , // Pseudo + "keyword": + "const|yield|import|get|set|async|await|" + + "break|case|catch|continue|default|delete|do|else|finally|for|function|" + + "if|in|of|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" + + "__parent__|__count__|escape|unescape|with|__proto__|" + + "class|enum|extends|super|export|implements|private|public|interface|package|protected|static", + "storage.type": + "const|let|var|function", + "constant.language": + "null|Infinity|NaN|undefined", + "support.function": + "alert", + "constant.language.boolean": "true|false" + }, "identifier"); + var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void"; + + var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex + "u[0-9a-fA-F]{4}|" + // unicode + "u{[0-9a-fA-F]{1,6}}|" + // es6 unicode + "[0-2][0-7]{0,2}|" + // oct + "3[0-7][0-7]?|" + // oct + "[4-7][0-7]?|" + //oct + ".)"; + + this.$rules = { + "no_regex" : [ + DocCommentHighlightRules.getStartRule("doc-start"), + comments("no_regex"), + { + token : "string", + regex : "'(?=.)", + next : "qstring" + }, { + token : "string", + regex : '"(?=.)', + next : "qqstring" + }, { + token : "constant.numeric", // hexadecimal, octal and binary + regex : /0(?:[xX][0-9a-fA-F]+|[oO][0-7]+|[bB][01]+)\b/ + }, { + token : "constant.numeric", // decimal integers and floats + regex : /(?:\d\d*(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+\b)?/ + }, { + token : [ + "storage.type", "punctuation.operator", "support.function", + "punctuation.operator", "entity.name.function", "text","keyword.operator" + ], + regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)", + next: "function_arguments" + }, { + token : [ + "storage.type", "punctuation.operator", "entity.name.function", "text", + "keyword.operator", "text", "storage.type", "text", "paren.lparen" + ], + regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()", + next: "function_arguments" + }, { + token : [ + "entity.name.function", "text", "keyword.operator", "text", "storage.type", + "text", "paren.lparen" + ], + regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()", + next: "function_arguments" + }, { + token : [ + "storage.type", "punctuation.operator", "entity.name.function", "text", + "keyword.operator", "text", + "storage.type", "text", "entity.name.function", "text", "paren.lparen" + ], + regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()", + next: "function_arguments" + }, { + token : [ + "storage.type", "text", "entity.name.function", "text", "paren.lparen" + ], + regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()", + next: "function_arguments" + }, { + token : [ + "entity.name.function", "text", "punctuation.operator", + "text", "storage.type", "text", "paren.lparen" + ], + regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()", + next: "function_arguments" + }, { + token : [ + "text", "text", "storage.type", "text", "paren.lparen" + ], + regex : "(:)(\\s*)(function)(\\s*)(\\()", + next: "function_arguments" + }, { + token : "keyword", + regex : "from(?=\\s*('|\"))" + }, { + token : "keyword", + regex : "(?:" + kwBeforeRe + ")\\b", + next : "start" + }, { + token : ["support.constant"], + regex : /that\b/ + }, { + token : ["storage.type", "punctuation.operator", "support.function.firebug"], + regex : /(console)(\.)(warn|info|log|error|time|trace|timeEnd|assert)\b/ + }, { + token : keywordMapper, + regex : identifierRe + }, { + token : "punctuation.operator", + regex : /[.](?![.])/, + next : "property" + }, { + token : "storage.type", + regex : /=>/, + next : "start" + }, { + token : "keyword.operator", + regex : /--|\+\+|\.{3}|===|==|=|!=|!==|<+=?|>+=?|!|&&|\|\||\?:|[!$%&*+\-~\/^]=?/, + next : "start" + }, { + token : "punctuation.operator", + regex : /[?:,;.]/, + next : "start" + }, { + token : "paren.lparen", + regex : /[\[({]/, + next : "start" + }, { + token : "paren.rparen", + regex : /[\])}]/ + }, { + token: "comment", + regex: /^#!.*$/ + } + ], + property: [{ + token : "text", + regex : "\\s+" + }, { + token : [ + "storage.type", "punctuation.operator", "entity.name.function", "text", + "keyword.operator", "text", + "storage.type", "text", "entity.name.function", "text", "paren.lparen" + ], + regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(?:(\\s+)(\\w+))?(\\s*)(\\()", + next: "function_arguments" + }, { + token : "punctuation.operator", + regex : /[.](?![.])/ + }, { + token : "support.function", + regex : /(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/ + }, { + token : "support.function.dom", + regex : /(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName|ClassName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/ + }, { + token : "support.constant", + regex : /(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/ + }, { + token : "identifier", + regex : identifierRe + }, { + regex: "", + token: "empty", + next: "no_regex" + } + ], + "start": [ + DocCommentHighlightRules.getStartRule("doc-start"), + comments("start"), + { + token: "string.regexp", + regex: "\\/", + next: "regex" + }, { + token : "text", + regex : "\\s+|^$", + next : "start" + }, { + token: "empty", + regex: "", + next: "no_regex" + } + ], + "regex": [ + { + token: "regexp.keyword.operator", + regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" + }, { + token: "string.regexp", + regex: "/[sxngimy]*", + next: "no_regex" + }, { + token : "invalid", + regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/ + }, { + token : "constant.language.escape", + regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/ + }, { + token : "constant.language.delimiter", + regex: /\|/ + }, { + token: "constant.language.escape", + regex: /\[\^?/, + next: "regex_character_class" + }, { + token: "empty", + regex: "$", + next: "no_regex" + }, { + defaultToken: "string.regexp" + } + ], + "regex_character_class": [ + { + token: "regexp.charclass.keyword.operator", + regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" + }, { + token: "constant.language.escape", + regex: "]", + next: "regex" + }, { + token: "constant.language.escape", + regex: "-" + }, { + token: "empty", + regex: "$", + next: "no_regex" + }, { + defaultToken: "string.regexp.charachterclass" + } + ], + "function_arguments": [ + { + token: "variable.parameter", + regex: identifierRe + }, { + token: "punctuation.operator", + regex: "[, ]+" + }, { + token: "punctuation.operator", + regex: "$" + }, { + token: "empty", + regex: "", + next: "no_regex" + } + ], + "qqstring" : [ + { + token : "constant.language.escape", + regex : escapedRe + }, { + token : "string", + regex : "\\\\$", + consumeLineEnd : true + }, { + token : "string", + regex : '"|$', + next : "no_regex" + }, { + defaultToken: "string" + } + ], + "qstring" : [ + { + token : "constant.language.escape", + regex : escapedRe + }, { + token : "string", + regex : "\\\\$", + consumeLineEnd : true + }, { + token : "string", + regex : "'|$", + next : "no_regex" + }, { + defaultToken: "string" + } + ] + }; + + + if (!options || !options.noES6) { + this.$rules.no_regex.unshift({ + regex: "[{}]", onMatch: function(val, state, stack) { + this.next = val == "{" ? this.nextState : ""; + if (val == "{" && stack.length) { + stack.unshift("start", state); + } + else if (val == "}" && stack.length) { + stack.shift(); + this.next = stack.shift(); + if (this.next.indexOf("string") != -1 || this.next.indexOf("jsx") != -1) + return "paren.quasi.end"; + } + return val == "{" ? "paren.lparen" : "paren.rparen"; + }, + nextState: "start" + }, { + token : "string.quasi.start", + regex : /`/, + push : [{ + token : "constant.language.escape", + regex : escapedRe + }, { + token : "paren.quasi.start", + regex : /\${/, + push : "start" + }, { + token : "string.quasi.end", + regex : /`/, + next : "pop" + }, { + defaultToken: "string.quasi" + }] + }); + + if (!options || options.jsx != false) + JSX.call(this); + } + + this.embedRules(DocCommentHighlightRules, "doc-", + [ DocCommentHighlightRules.getEndRule("no_regex") ]); + + this.normalizeRules(); +}; + +oop.inherits(JavaScriptHighlightRules, TextHighlightRules); + +function JSX() { + var tagRegex = identifierRe.replace("\\d", "\\d\\-"); + var jsxTag = { + onMatch : function(val, state, stack) { + var offset = val.charAt(1) == "/" ? 2 : 1; + if (offset == 1) { + if (state != this.nextState) + stack.unshift(this.next, this.nextState, 0); + else + stack.unshift(this.next); + stack[2]++; + } else if (offset == 2) { + if (state == this.nextState) { + stack[1]--; + if (!stack[1] || stack[1] < 0) { + stack.shift(); + stack.shift(); + } + } + } + return [{ + type: "meta.tag.punctuation." + (offset == 1 ? "" : "end-") + "tag-open.xml", + value: val.slice(0, offset) + }, { + type: "meta.tag.tag-name.xml", + value: val.substr(offset) + }]; + }, + regex : "", + onMatch : function(value, currentState, stack) { + if (currentState == stack[0]) + stack.shift(); + if (value.length == 2) { + if (stack[0] == this.nextState) + stack[1]--; + if (!stack[1] || stack[1] < 0) { + stack.splice(0, 2); + } + } + this.next = stack[0] || "start"; + return [{type: this.token, value: value}]; + }, + nextState: "jsx" + }, + jsxJsRule, + comments("jsxAttributes"), + { + token : "entity.other.attribute-name.xml", + regex : tagRegex + }, { + token : "keyword.operator.attribute-equals.xml", + regex : "=" + }, { + token : "text.tag-whitespace.xml", + regex : "\\s+" + }, { + token : "string.attribute-value.xml", + regex : "'", + stateName : "jsx_attr_q", + push : [ + {token : "string.attribute-value.xml", regex: "'", next: "pop"}, + {include : "reference"}, + {defaultToken : "string.attribute-value.xml"} + ] + }, { + token : "string.attribute-value.xml", + regex : '"', + stateName : "jsx_attr_qq", + push : [ + {token : "string.attribute-value.xml", regex: '"', next: "pop"}, + {include : "reference"}, + {defaultToken : "string.attribute-value.xml"} + ] + }, + jsxTag + ]; + this.$rules.reference = [{ + token : "constant.language.escape.reference.xml", + regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)" + }]; +} + +function comments(next) { + return [ + { + token : "comment", // multi line comment + regex : /\/\*/, + next: [ + DocCommentHighlightRules.getTagRule(), + {token : "comment", regex : "\\*\\/", next : next || "pop"}, + {defaultToken : "comment", caseInsensitive: true} + ] + }, { + token : "comment", + regex : "\\/\\/", + next: [ + DocCommentHighlightRules.getTagRule(), + {token : "comment", regex : "$|^", next : next || "pop"}, + {defaultToken : "comment", caseInsensitive: true} + ] + } + ]; +} +exports.JavaScriptHighlightRules = JavaScriptHighlightRules; +}); + +define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module) { +"use strict"; + +var Range = require("../range").Range; + +var MatchingBraceOutdent = function() {}; + +(function() { + + this.checkOutdent = function(line, input) { + if (! /^\s+$/.test(line)) + return false; + + return /^\s*\}/.test(input); + }; + + this.autoOutdent = function(doc, row) { + var line = doc.getLine(row); + var match = line.match(/^(\s*\})/); + + if (!match) return 0; + + var column = match[1].length; + var openBracePos = doc.findMatchingBracket({row: row, column: column}); + + if (!openBracePos || openBracePos.row == row) return 0; + + var indent = this.$getIndent(doc.getLine(openBracePos.row)); + doc.replace(new Range(row, 0, row, column-1), indent); + }; + + this.$getIndent = function(line) { + return line.match(/^\s*/)[0]; + }; + +}).call(MatchingBraceOutdent.prototype); + +exports.MatchingBraceOutdent = MatchingBraceOutdent; +}); + +define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) { +"use strict"; + +var oop = require("../../lib/oop"); +var Range = require("../../range").Range; +var BaseFoldMode = require("./fold_mode").FoldMode; + +var FoldMode = exports.FoldMode = function(commentRegex) { + if (commentRegex) { + this.foldingStartMarker = new RegExp( + this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start) + ); + this.foldingStopMarker = new RegExp( + this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end) + ); + } +}; +oop.inherits(FoldMode, BaseFoldMode); + +(function() { + + this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/; + this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/; + this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/; + this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/; + this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/; + this._getFoldWidgetBase = this.getFoldWidget; + this.getFoldWidget = function(session, foldStyle, row) { + var line = session.getLine(row); + + if (this.singleLineBlockCommentRe.test(line)) { + if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line)) + return ""; + } + + var fw = this._getFoldWidgetBase(session, foldStyle, row); + + if (!fw && this.startRegionRe.test(line)) + return "start"; // lineCommentRegionStart + + return fw; + }; + + this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) { + var line = session.getLine(row); + + if (this.startRegionRe.test(line)) + return this.getCommentRegionBlock(session, line, row); + + var match = line.match(this.foldingStartMarker); + if (match) { + var i = match.index; + + if (match[1]) + return this.openingBracketBlock(session, match[1], row, i); + + var range = session.getCommentFoldRange(row, i + match[0].length, 1); + + if (range && !range.isMultiLine()) { + if (forceMultiline) { + range = this.getSectionRange(session, row); + } else if (foldStyle != "all") + range = null; + } + + return range; + } + + if (foldStyle === "markbegin") + return; + + var match = line.match(this.foldingStopMarker); + if (match) { + var i = match.index + match[0].length; + + if (match[1]) + return this.closingBracketBlock(session, match[1], row, i); + + return session.getCommentFoldRange(row, i, -1); + } + }; + + this.getSectionRange = function(session, row) { + var line = session.getLine(row); + var startIndent = line.search(/\S/); + var startRow = row; + var startColumn = line.length; + row = row + 1; + var endRow = row; + var maxRow = session.getLength(); + while (++row < maxRow) { + line = session.getLine(row); + var indent = line.search(/\S/); + if (indent === -1) + continue; + if (startIndent > indent) + break; + var subRange = this.getFoldWidgetRange(session, "all", row); + + if (subRange) { + if (subRange.start.row <= startRow) { + break; + } else if (subRange.isMultiLine()) { + row = subRange.end.row; + } else if (startIndent == indent) { + break; + } + } + endRow = row; + } + + return new Range(startRow, startColumn, endRow, session.getLine(endRow).length); + }; + this.getCommentRegionBlock = function(session, line, row) { + var startColumn = line.search(/\s*$/); + var maxRow = session.getLength(); + var startRow = row; + + var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/; + var depth = 1; + while (++row < maxRow) { + line = session.getLine(row); + var m = re.exec(line); + if (!m) continue; + if (m[1]) depth--; + else depth++; + + if (!depth) break; + } + + var endRow = row; + if (endRow > startRow) { + return new Range(startRow, startColumn, endRow, line.length); + } + }; + +}).call(FoldMode.prototype); + +}); + +define("ace/mode/javascript",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/javascript_highlight_rules","ace/mode/matching_brace_outdent","ace/worker/worker_client","ace/mode/behaviour/cstyle","ace/mode/folding/cstyle"], function(require, exports, module) { +"use strict"; + +var oop = require("../lib/oop"); +var TextMode = require("./text").Mode; +var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules; +var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; +var WorkerClient = require("../worker/worker_client").WorkerClient; +var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour; +var CStyleFoldMode = require("./folding/cstyle").FoldMode; + +var Mode = function() { + this.HighlightRules = JavaScriptHighlightRules; + + this.$outdent = new MatchingBraceOutdent(); + this.$behaviour = new CstyleBehaviour(); + this.foldingRules = new CStyleFoldMode(); +}; +oop.inherits(Mode, TextMode); + +(function() { + + this.lineCommentStart = "//"; + this.blockComment = {start: "/*", end: "*/"}; + this.$quotes = {'"': '"', "'": "'", "`": "`"}; + + this.getNextLineIndent = function(state, line, tab) { + var indent = this.$getIndent(line); + + var tokenizedLine = this.getTokenizer().getLineTokens(line, state); + var tokens = tokenizedLine.tokens; + var endState = tokenizedLine.state; + + if (tokens.length && tokens[tokens.length-1].type == "comment") { + return indent; + } + + if (state == "start" || state == "no_regex") { + var match = line.match(/^.*(?:\bcase\b.*:|[\{\(\[])\s*$/); + if (match) { + indent += tab; + } + } else if (state == "doc-start") { + if (endState == "start" || endState == "no_regex") { + return ""; + } + var match = line.match(/^\s*(\/?)\*/); + if (match) { + if (match[1]) { + indent += " "; + } + indent += "* "; + } + } + + return indent; + }; + + this.checkOutdent = function(state, line, input) { + return this.$outdent.checkOutdent(line, input); + }; + + this.autoOutdent = function(state, doc, row) { + this.$outdent.autoOutdent(doc, row); + }; + + this.createWorker = function(session) { + var worker = new WorkerClient(["ace"], "ace/mode/javascript_worker", "JavaScriptWorker"); + worker.attachToDocument(session.getDocument()); + + worker.on("annotate", function(results) { + session.setAnnotations(results.data); + }); + + worker.on("terminate", function() { + session.clearAnnotations(); + }); + + return worker; + }; + + this.$id = "ace/mode/javascript"; + this.snippetFileId = "ace/snippets/javascript"; +}).call(Mode.prototype); + +exports.Mode = Mode; +}); + +define("ace/mode/css_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules"], function(require, exports, module) { +"use strict"; + +var oop = require("../lib/oop"); +var lang = require("../lib/lang"); +var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; +var supportType = exports.supportType = "align-content|align-items|align-self|all|animation|animation-delay|animation-direction|animation-duration|animation-fill-mode|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|backface-visibility|background|background-attachment|background-blend-mode|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|border|border-bottom|border-bottom-color|border-bottom-left-radius|border-bottom-right-radius|border-bottom-style|border-bottom-width|border-collapse|border-color|border-image|border-image-outset|border-image-repeat|border-image-slice|border-image-source|border-image-width|border-left|border-left-color|border-left-style|border-left-width|border-radius|border-right|border-right-color|border-right-style|border-right-width|border-spacing|border-style|border-top|border-top-color|border-top-left-radius|border-top-right-radius|border-top-style|border-top-width|border-width|bottom|box-shadow|box-sizing|caption-side|clear|clip|color|column-count|column-fill|column-gap|column-rule|column-rule-color|column-rule-style|column-rule-width|column-span|column-width|columns|content|counter-increment|counter-reset|cursor|direction|display|empty-cells|filter|flex|flex-basis|flex-direction|flex-flow|flex-grow|flex-shrink|flex-wrap|float|font|font-family|font-size|font-size-adjust|font-stretch|font-style|font-variant|font-weight|hanging-punctuation|height|justify-content|left|letter-spacing|line-height|list-style|list-style-image|list-style-position|list-style-type|margin|margin-bottom|margin-left|margin-right|margin-top|max-height|max-width|max-zoom|min-height|min-width|min-zoom|nav-down|nav-index|nav-left|nav-right|nav-up|opacity|order|outline|outline-color|outline-offset|outline-style|outline-width|overflow|overflow-x|overflow-y|padding|padding-bottom|padding-left|padding-right|padding-top|page-break-after|page-break-before|page-break-inside|perspective|perspective-origin|position|quotes|resize|right|tab-size|table-layout|text-align|text-align-last|text-decoration|text-decoration-color|text-decoration-line|text-decoration-style|text-indent|text-justify|text-overflow|text-shadow|text-transform|top|transform|transform-origin|transform-style|transition|transition-delay|transition-duration|transition-property|transition-timing-function|unicode-bidi|user-select|user-zoom|vertical-align|visibility|white-space|width|word-break|word-spacing|word-wrap|z-index"; +var supportFunction = exports.supportFunction = "rgb|rgba|url|attr|counter|counters"; +var supportConstant = exports.supportConstant = "absolute|after-edge|after|all-scroll|all|alphabetic|always|antialiased|armenian|auto|avoid-column|avoid-page|avoid|balance|baseline|before-edge|before|below|bidi-override|block-line-height|block|bold|bolder|border-box|both|bottom|box|break-all|break-word|capitalize|caps-height|caption|center|central|char|circle|cjk-ideographic|clone|close-quote|col-resize|collapse|column|consider-shifts|contain|content-box|cover|crosshair|cubic-bezier|dashed|decimal-leading-zero|decimal|default|disabled|disc|disregard-shifts|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ease-in|ease-in-out|ease-out|ease|ellipsis|end|exclude-ruby|fill|fixed|georgian|glyphs|grid-height|groove|hand|hanging|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|icon|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|ideographic|inactive|include-ruby|inherit|initial|inline-block|inline-box|inline-line-height|inline-table|inline|inset|inside|inter-ideograph|inter-word|invert|italic|justify|katakana-iroha|katakana|keep-all|last|left|lighter|line-edge|line-through|line|linear|list-item|local|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|mathematical|max-height|max-size|medium|menu|message-box|middle|move|n-resize|ne-resize|newspaper|no-change|no-close-quote|no-drop|no-open-quote|no-repeat|none|normal|not-allowed|nowrap|nw-resize|oblique|open-quote|outset|outside|overline|padding-box|page|pointer|pre-line|pre-wrap|pre|preserve-3d|progress|relative|repeat-x|repeat-y|repeat|replaced|reset-size|ridge|right|round|row-resize|rtl|s-resize|scroll|se-resize|separate|slice|small-caps|small-caption|solid|space|square|start|static|status-bar|step-end|step-start|steps|stretch|strict|sub|super|sw-resize|table-caption|table-cell|table-column-group|table-column|table-footer-group|table-header-group|table-row-group|table-row|table|tb-rl|text-after-edge|text-before-edge|text-bottom|text-size|text-top|text|thick|thin|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero|zoom"; +var supportConstantColor = exports.supportConstantColor = "aliceblue|antiquewhite|aqua|aquamarine|azure|beige|bisque|black|blanchedalmond|blue|blueviolet|brown|burlywood|cadetblue|chartreuse|chocolate|coral|cornflowerblue|cornsilk|crimson|cyan|darkblue|darkcyan|darkgoldenrod|darkgray|darkgreen|darkgrey|darkkhaki|darkmagenta|darkolivegreen|darkorange|darkorchid|darkred|darksalmon|darkseagreen|darkslateblue|darkslategray|darkslategrey|darkturquoise|darkviolet|deeppink|deepskyblue|dimgray|dimgrey|dodgerblue|firebrick|floralwhite|forestgreen|fuchsia|gainsboro|ghostwhite|gold|goldenrod|gray|green|greenyellow|grey|honeydew|hotpink|indianred|indigo|ivory|khaki|lavender|lavenderblush|lawngreen|lemonchiffon|lightblue|lightcoral|lightcyan|lightgoldenrodyellow|lightgray|lightgreen|lightgrey|lightpink|lightsalmon|lightseagreen|lightskyblue|lightslategray|lightslategrey|lightsteelblue|lightyellow|lime|limegreen|linen|magenta|maroon|mediumaquamarine|mediumblue|mediumorchid|mediumpurple|mediumseagreen|mediumslateblue|mediumspringgreen|mediumturquoise|mediumvioletred|midnightblue|mintcream|mistyrose|moccasin|navajowhite|navy|oldlace|olive|olivedrab|orange|orangered|orchid|palegoldenrod|palegreen|paleturquoise|palevioletred|papayawhip|peachpuff|peru|pink|plum|powderblue|purple|rebeccapurple|red|rosybrown|royalblue|saddlebrown|salmon|sandybrown|seagreen|seashell|sienna|silver|skyblue|slateblue|slategray|slategrey|snow|springgreen|steelblue|tan|teal|thistle|tomato|turquoise|violet|wheat|white|whitesmoke|yellow|yellowgreen"; +var supportConstantFonts = exports.supportConstantFonts = "arial|century|comic|courier|cursive|fantasy|garamond|georgia|helvetica|impact|lucida|symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|serif|monospace"; + +var numRe = exports.numRe = "\\-?(?:(?:[0-9]+(?:\\.[0-9]+)?)|(?:\\.[0-9]+))"; +var pseudoElements = exports.pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b"; +var pseudoClasses = exports.pseudoClasses = "(:)\\b(active|checked|disabled|empty|enabled|first-child|first-of-type|focus|hover|indeterminate|invalid|last-child|last-of-type|link|not|nth-child|nth-last-child|nth-last-of-type|nth-of-type|only-child|only-of-type|required|root|target|valid|visited)\\b"; + +var CssHighlightRules = function() { + + var keywordMapper = this.createKeywordMapper({ + "support.function": supportFunction, + "support.constant": supportConstant, + "support.type": supportType, + "support.constant.color": supportConstantColor, + "support.constant.fonts": supportConstantFonts + }, "text", true); + + this.$rules = { + "start" : [{ + include : ["strings", "url", "comments"] + }, { + token: "paren.lparen", + regex: "\\{", + next: "ruleset" + }, { + token: "paren.rparen", + regex: "\\}" + }, { + token: "string", + regex: "@(?!viewport)", + next: "media" + }, { + token: "keyword", + regex: "#[a-z0-9-_]+" + }, { + token: "keyword", + regex: "%" + }, { + token: "variable", + regex: "\\.[a-z0-9-_]+" + }, { + token: "string", + regex: ":[a-z0-9-_]+" + }, { + token : "constant.numeric", + regex : numRe + }, { + token: "constant", + regex: "[a-z0-9-_]+" + }, { + caseInsensitive: true + }], + + "media": [{ + include : ["strings", "url", "comments"] + }, { + token: "paren.lparen", + regex: "\\{", + next: "start" + }, { + token: "paren.rparen", + regex: "\\}", + next: "start" + }, { + token: "string", + regex: ";", + next: "start" + }, { + token: "keyword", + regex: "(?:media|supports|document|charset|import|namespace|media|supports|document" + + "|page|font|keyframes|viewport|counter-style|font-feature-values" + + "|swash|ornaments|annotation|stylistic|styleset|character-variant)" + }], + + "comments" : [{ + token: "comment", // multi line comment + regex: "\\/\\*", + push: [{ + token : "comment", + regex : "\\*\\/", + next : "pop" + }, { + defaultToken : "comment" + }] + }], + + "ruleset" : [{ + regex : "-(webkit|ms|moz|o)-", + token : "text" + }, { + token : "punctuation.operator", + regex : "[:;]" + }, { + token : "paren.rparen", + regex : "\\}", + next : "start" + }, { + include : ["strings", "url", "comments"] + }, { + token : ["constant.numeric", "keyword"], + regex : "(" + numRe + ")(ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vmax|vmin|vm|vw|%)" + }, { + token : "constant.numeric", + regex : numRe + }, { + token : "constant.numeric", // hex6 color + regex : "#[a-f0-9]{6}" + }, { + token : "constant.numeric", // hex3 color + regex : "#[a-f0-9]{3}" + }, { + token : ["punctuation", "entity.other.attribute-name.pseudo-element.css"], + regex : pseudoElements + }, { + token : ["punctuation", "entity.other.attribute-name.pseudo-class.css"], + regex : pseudoClasses + }, { + include: "url" + }, { + token : keywordMapper, + regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*" + }, { + caseInsensitive: true + }], + + url: [{ + token : "support.function", + regex : "(?:url(:?-prefix)?|domain|regexp)\\(", + push: [{ + token : "support.function", + regex : "\\)", + next : "pop" + }, { + defaultToken: "string" + }] + }], + + strings: [{ + token : "string.start", + regex : "'", + push : [{ + token : "string.end", + regex : "'|$", + next: "pop" + }, { + include : "escapes" + }, { + token : "constant.language.escape", + regex : /\\$/, + consumeLineEnd: true + }, { + defaultToken: "string" + }] + }, { + token : "string.start", + regex : '"', + push : [{ + token : "string.end", + regex : '"|$', + next: "pop" + }, { + include : "escapes" + }, { + token : "constant.language.escape", + regex : /\\$/, + consumeLineEnd: true + }, { + defaultToken: "string" + }] + }], + escapes: [{ + token : "constant.language.escape", + regex : /\\([a-fA-F\d]{1,6}|[^a-fA-F\d])/ + }] + + }; + + this.normalizeRules(); +}; + +oop.inherits(CssHighlightRules, TextHighlightRules); + +exports.CssHighlightRules = CssHighlightRules; + +}); + +define("ace/mode/css_completions",["require","exports","module"], function(require, exports, module) { +"use strict"; + +var propertyMap = { + "background": {"#$0": 1}, + "background-color": {"#$0": 1, "transparent": 1, "fixed": 1}, + "background-image": {"url('/$0')": 1}, + "background-repeat": {"repeat": 1, "repeat-x": 1, "repeat-y": 1, "no-repeat": 1, "inherit": 1}, + "background-position": {"bottom":2, "center":2, "left":2, "right":2, "top":2, "inherit":2}, + "background-attachment": {"scroll": 1, "fixed": 1}, + "background-size": {"cover": 1, "contain": 1}, + "background-clip": {"border-box": 1, "padding-box": 1, "content-box": 1}, + "background-origin": {"border-box": 1, "padding-box": 1, "content-box": 1}, + "border": {"solid $0": 1, "dashed $0": 1, "dotted $0": 1, "#$0": 1}, + "border-color": {"#$0": 1}, + "border-style": {"solid":2, "dashed":2, "dotted":2, "double":2, "groove":2, "hidden":2, "inherit":2, "inset":2, "none":2, "outset":2, "ridged":2}, + "border-collapse": {"collapse": 1, "separate": 1}, + "bottom": {"px": 1, "em": 1, "%": 1}, + "clear": {"left": 1, "right": 1, "both": 1, "none": 1}, + "color": {"#$0": 1, "rgb(#$00,0,0)": 1}, + "cursor": {"default": 1, "pointer": 1, "move": 1, "text": 1, "wait": 1, "help": 1, "progress": 1, "n-resize": 1, "ne-resize": 1, "e-resize": 1, "se-resize": 1, "s-resize": 1, "sw-resize": 1, "w-resize": 1, "nw-resize": 1}, + "display": {"none": 1, "block": 1, "inline": 1, "inline-block": 1, "table-cell": 1}, + "empty-cells": {"show": 1, "hide": 1}, + "float": {"left": 1, "right": 1, "none": 1}, + "font-family": {"Arial":2,"Comic Sans MS":2,"Consolas":2,"Courier New":2,"Courier":2,"Georgia":2,"Monospace":2,"Sans-Serif":2, "Segoe UI":2,"Tahoma":2,"Times New Roman":2,"Trebuchet MS":2,"Verdana": 1}, + "font-size": {"px": 1, "em": 1, "%": 1}, + "font-weight": {"bold": 1, "normal": 1}, + "font-style": {"italic": 1, "normal": 1}, + "font-variant": {"normal": 1, "small-caps": 1}, + "height": {"px": 1, "em": 1, "%": 1}, + "left": {"px": 1, "em": 1, "%": 1}, + "letter-spacing": {"normal": 1}, + "line-height": {"normal": 1}, + "list-style-type": {"none": 1, "disc": 1, "circle": 1, "square": 1, "decimal": 1, "decimal-leading-zero": 1, "lower-roman": 1, "upper-roman": 1, "lower-greek": 1, "lower-latin": 1, "upper-latin": 1, "georgian": 1, "lower-alpha": 1, "upper-alpha": 1}, + "margin": {"px": 1, "em": 1, "%": 1}, + "margin-right": {"px": 1, "em": 1, "%": 1}, + "margin-left": {"px": 1, "em": 1, "%": 1}, + "margin-top": {"px": 1, "em": 1, "%": 1}, + "margin-bottom": {"px": 1, "em": 1, "%": 1}, + "max-height": {"px": 1, "em": 1, "%": 1}, + "max-width": {"px": 1, "em": 1, "%": 1}, + "min-height": {"px": 1, "em": 1, "%": 1}, + "min-width": {"px": 1, "em": 1, "%": 1}, + "overflow": {"hidden": 1, "visible": 1, "auto": 1, "scroll": 1}, + "overflow-x": {"hidden": 1, "visible": 1, "auto": 1, "scroll": 1}, + "overflow-y": {"hidden": 1, "visible": 1, "auto": 1, "scroll": 1}, + "padding": {"px": 1, "em": 1, "%": 1}, + "padding-top": {"px": 1, "em": 1, "%": 1}, + "padding-right": {"px": 1, "em": 1, "%": 1}, + "padding-bottom": {"px": 1, "em": 1, "%": 1}, + "padding-left": {"px": 1, "em": 1, "%": 1}, + "page-break-after": {"auto": 1, "always": 1, "avoid": 1, "left": 1, "right": 1}, + "page-break-before": {"auto": 1, "always": 1, "avoid": 1, "left": 1, "right": 1}, + "position": {"absolute": 1, "relative": 1, "fixed": 1, "static": 1}, + "right": {"px": 1, "em": 1, "%": 1}, + "table-layout": {"fixed": 1, "auto": 1}, + "text-decoration": {"none": 1, "underline": 1, "line-through": 1, "blink": 1}, + "text-align": {"left": 1, "right": 1, "center": 1, "justify": 1}, + "text-transform": {"capitalize": 1, "uppercase": 1, "lowercase": 1, "none": 1}, + "top": {"px": 1, "em": 1, "%": 1}, + "vertical-align": {"top": 1, "bottom": 1}, + "visibility": {"hidden": 1, "visible": 1}, + "white-space": {"nowrap": 1, "normal": 1, "pre": 1, "pre-line": 1, "pre-wrap": 1}, + "width": {"px": 1, "em": 1, "%": 1}, + "word-spacing": {"normal": 1}, + "filter": {"alpha(opacity=$0100)": 1}, + + "text-shadow": {"$02px 2px 2px #777": 1}, + "text-overflow": {"ellipsis-word": 1, "clip": 1, "ellipsis": 1}, + "-moz-border-radius": 1, + "-moz-border-radius-topright": 1, + "-moz-border-radius-bottomright": 1, + "-moz-border-radius-topleft": 1, + "-moz-border-radius-bottomleft": 1, + "-webkit-border-radius": 1, + "-webkit-border-top-right-radius": 1, + "-webkit-border-top-left-radius": 1, + "-webkit-border-bottom-right-radius": 1, + "-webkit-border-bottom-left-radius": 1, + "-moz-box-shadow": 1, + "-webkit-box-shadow": 1, + "transform": {"rotate($00deg)": 1, "skew($00deg)": 1}, + "-moz-transform": {"rotate($00deg)": 1, "skew($00deg)": 1}, + "-webkit-transform": {"rotate($00deg)": 1, "skew($00deg)": 1 } +}; + +var CssCompletions = function() { + +}; + +(function() { + + this.completionsDefined = false; + + this.defineCompletions = function() { + if (document) { + var style = document.createElement('c').style; + + for (var i in style) { + if (typeof style[i] !== 'string') + continue; + + var name = i.replace(/[A-Z]/g, function(x) { + return '-' + x.toLowerCase(); + }); + + if (!propertyMap.hasOwnProperty(name)) + propertyMap[name] = 1; + } + } + + this.completionsDefined = true; + }; + + this.getCompletions = function(state, session, pos, prefix) { + if (!this.completionsDefined) { + this.defineCompletions(); + } + + if (state==='ruleset' || session.$mode.$id == "ace/mode/scss") { + var line = session.getLine(pos.row).substr(0, pos.column); + if (/:[^;]+$/.test(line)) { + /([\w\-]+):[^:]*$/.test(line); + + return this.getPropertyValueCompletions(state, session, pos, prefix); + } else { + return this.getPropertyCompletions(state, session, pos, prefix); + } + } + + return []; + }; + + this.getPropertyCompletions = function(state, session, pos, prefix) { + var properties = Object.keys(propertyMap); + return properties.map(function(property){ + return { + caption: property, + snippet: property + ': $0;', + meta: "property", + score: 1000000 + }; + }); + }; + + this.getPropertyValueCompletions = function(state, session, pos, prefix) { + var line = session.getLine(pos.row).substr(0, pos.column); + var property = (/([\w\-]+):[^:]*$/.exec(line) || {})[1]; + + if (!property) + return []; + var values = []; + if (property in propertyMap && typeof propertyMap[property] === "object") { + values = Object.keys(propertyMap[property]); + } + return values.map(function(value){ + return { + caption: value, + snippet: value, + meta: "property value", + score: 1000000 + }; + }); + }; + +}).call(CssCompletions.prototype); + +exports.CssCompletions = CssCompletions; +}); + +define("ace/mode/behaviour/css",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/mode/behaviour/cstyle","ace/token_iterator"], function(require, exports, module) { +"use strict"; + +var oop = require("../../lib/oop"); +var Behaviour = require("../behaviour").Behaviour; +var CstyleBehaviour = require("./cstyle").CstyleBehaviour; +var TokenIterator = require("../../token_iterator").TokenIterator; + +var CssBehaviour = function () { + + this.inherit(CstyleBehaviour); + + this.add("colon", "insertion", function (state, action, editor, session, text) { + if (text === ':' && editor.selection.isEmpty()) { + var cursor = editor.getCursorPosition(); + var iterator = new TokenIterator(session, cursor.row, cursor.column); + var token = iterator.getCurrentToken(); + if (token && token.value.match(/\s+/)) { + token = iterator.stepBackward(); + } + if (token && token.type === 'support.type') { + var line = session.doc.getLine(cursor.row); + var rightChar = line.substring(cursor.column, cursor.column + 1); + if (rightChar === ':') { + return { + text: '', + selection: [1, 1] + }; + } + if (/^(\s+[^;]|\s*$)/.test(line.substring(cursor.column))) { + return { + text: ':;', + selection: [1, 1] + }; + } + } + } + }); + + this.add("colon", "deletion", function (state, action, editor, session, range) { + var selected = session.doc.getTextRange(range); + if (!range.isMultiLine() && selected === ':') { + var cursor = editor.getCursorPosition(); + var iterator = new TokenIterator(session, cursor.row, cursor.column); + var token = iterator.getCurrentToken(); + if (token && token.value.match(/\s+/)) { + token = iterator.stepBackward(); + } + if (token && token.type === 'support.type') { + var line = session.doc.getLine(range.start.row); + var rightChar = line.substring(range.end.column, range.end.column + 1); + if (rightChar === ';') { + range.end.column ++; + return range; + } + } + } + }); + + this.add("semicolon", "insertion", function (state, action, editor, session, text) { + if (text === ';' && editor.selection.isEmpty()) { + var cursor = editor.getCursorPosition(); + var line = session.doc.getLine(cursor.row); + var rightChar = line.substring(cursor.column, cursor.column + 1); + if (rightChar === ';') { + return { + text: '', + selection: [1, 1] + }; + } + } + }); + + this.add("!important", "insertion", function (state, action, editor, session, text) { + if (text === '!' && editor.selection.isEmpty()) { + var cursor = editor.getCursorPosition(); + var line = session.doc.getLine(cursor.row); + + if (/^\s*(;|}|$)/.test(line.substring(cursor.column))) { + return { + text: '!important', + selection: [10, 10] + }; + } + } + }); + +}; +oop.inherits(CssBehaviour, CstyleBehaviour); + +exports.CssBehaviour = CssBehaviour; +}); + +define("ace/mode/css",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/css_highlight_rules","ace/mode/matching_brace_outdent","ace/worker/worker_client","ace/mode/css_completions","ace/mode/behaviour/css","ace/mode/folding/cstyle"], function(require, exports, module) { +"use strict"; + +var oop = require("../lib/oop"); +var TextMode = require("./text").Mode; +var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules; +var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; +var WorkerClient = require("../worker/worker_client").WorkerClient; +var CssCompletions = require("./css_completions").CssCompletions; +var CssBehaviour = require("./behaviour/css").CssBehaviour; +var CStyleFoldMode = require("./folding/cstyle").FoldMode; + +var Mode = function() { + this.HighlightRules = CssHighlightRules; + this.$outdent = new MatchingBraceOutdent(); + this.$behaviour = new CssBehaviour(); + this.$completer = new CssCompletions(); + this.foldingRules = new CStyleFoldMode(); +}; +oop.inherits(Mode, TextMode); + +(function() { + + this.foldingRules = "cStyle"; + this.blockComment = {start: "/*", end: "*/"}; + + this.getNextLineIndent = function(state, line, tab) { + var indent = this.$getIndent(line); + var tokens = this.getTokenizer().getLineTokens(line, state).tokens; + if (tokens.length && tokens[tokens.length-1].type == "comment") { + return indent; + } + + var match = line.match(/^.*\{\s*$/); + if (match) { + indent += tab; + } + + return indent; + }; + + this.checkOutdent = function(state, line, input) { + return this.$outdent.checkOutdent(line, input); + }; + + this.autoOutdent = function(state, doc, row) { + this.$outdent.autoOutdent(doc, row); + }; + + this.getCompletions = function(state, session, pos, prefix) { + return this.$completer.getCompletions(state, session, pos, prefix); + }; + + this.createWorker = function(session) { + var worker = new WorkerClient(["ace"], "ace/mode/css_worker", "Worker"); + worker.attachToDocument(session.getDocument()); + + worker.on("annotate", function(e) { + session.setAnnotations(e.data); + }); + + worker.on("terminate", function() { + session.clearAnnotations(); + }); + + return worker; + }; + + this.$id = "ace/mode/css"; + this.snippetFileId = "ace/snippets/css"; +}).call(Mode.prototype); + +exports.Mode = Mode; + +}); + +define("ace/mode/xml_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) { +"use strict"; + +var oop = require("../lib/oop"); +var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; + +var XmlHighlightRules = function(normalize) { + var tagRegex = "[_:a-zA-Z\xc0-\uffff][-_:.a-zA-Z0-9\xc0-\uffff]*"; + + this.$rules = { + start : [ + {token : "string.cdata.xml", regex : "<\\!\\[CDATA\\[", next : "cdata"}, + { + token : ["punctuation.instruction.xml", "keyword.instruction.xml"], + regex : "(<\\?)(" + tagRegex + ")", next : "processing_instruction" + }, + {token : "comment.start.xml", regex : "<\\!--", next : "comment"}, + { + token : ["xml-pe.doctype.xml", "xml-pe.doctype.xml"], + regex : "(<\\!)(DOCTYPE)(?=[\\s])", next : "doctype", caseInsensitive: true + }, + {include : "tag"}, + {token : "text.end-tag-open.xml", regex: "", + next : "start" + }], + + doctype : [ + {include : "whitespace"}, + {include : "string"}, + {token : "xml-pe.doctype.xml", regex : ">", next : "start"}, + {token : "xml-pe.xml", regex : "[-_a-zA-Z0-9:]+"}, + {token : "punctuation.int-subset", regex : "\\[", push : "int_subset"} + ], + + int_subset : [{ + token : "text.xml", + regex : "\\s+" + }, { + token: "punctuation.int-subset.xml", + regex: "]", + next: "pop" + }, { + token : ["punctuation.markup-decl.xml", "keyword.markup-decl.xml"], + regex : "(<\\!)(" + tagRegex + ")", + push : [{ + token : "text", + regex : "\\s+" + }, + { + token : "punctuation.markup-decl.xml", + regex : ">", + next : "pop" + }, + {include : "string"}] + }], + + cdata : [ + {token : "string.cdata.xml", regex : "\\]\\]>", next : "start"}, + {token : "text.xml", regex : "\\s+"}, + {token : "text.xml", regex : "(?:[^\\]]|\\](?!\\]>))+"} + ], + + comment : [ + {token : "comment.end.xml", regex : "-->", next : "start"}, + {defaultToken : "comment.xml"} + ], + + reference : [{ + token : "constant.language.escape.reference.xml", + regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)" + }], + + attr_reference : [{ + token : "constant.language.escape.reference.attribute-value.xml", + regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)" + }], + + tag : [{ + token : ["meta.tag.punctuation.tag-open.xml", "meta.tag.punctuation.end-tag-open.xml", "meta.tag.tag-name.xml"], + regex : "(?:(<)|(", next : "start"} + ] + }], + + tag_whitespace : [ + {token : "text.tag-whitespace.xml", regex : "\\s+"} + ], + whitespace : [ + {token : "text.whitespace.xml", regex : "\\s+"} + ], + string: [{ + token : "string.xml", + regex : "'", + push : [ + {token : "string.xml", regex: "'", next: "pop"}, + {defaultToken : "string.xml"} + ] + }, { + token : "string.xml", + regex : '"', + push : [ + {token : "string.xml", regex: '"', next: "pop"}, + {defaultToken : "string.xml"} + ] + }], + + attributes: [{ + token : "entity.other.attribute-name.xml", + regex : tagRegex + }, { + token : "keyword.operator.attribute-equals.xml", + regex : "=" + }, { + include: "tag_whitespace" + }, { + include: "attribute_value" + }], + + attribute_value: [{ + token : "string.attribute-value.xml", + regex : "'", + push : [ + {token : "string.attribute-value.xml", regex: "'", next: "pop"}, + {include : "attr_reference"}, + {defaultToken : "string.attribute-value.xml"} + ] + }, { + token : "string.attribute-value.xml", + regex : '"', + push : [ + {token : "string.attribute-value.xml", regex: '"', next: "pop"}, + {include : "attr_reference"}, + {defaultToken : "string.attribute-value.xml"} + ] + }] + }; + + if (this.constructor === XmlHighlightRules) + this.normalizeRules(); +}; + + +(function() { + + this.embedTagRules = function(HighlightRules, prefix, tag){ + this.$rules.tag.unshift({ + token : ["meta.tag.punctuation.tag-open.xml", "meta.tag." + tag + ".tag-name.xml"], + regex : "(<)(" + tag + "(?=\\s|>|$))", + next: [ + {include : "attributes"}, + {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : prefix + "start"} + ] + }); + + this.$rules[tag + "-end"] = [ + {include : "attributes"}, + {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next: "start", + onMatch : function(value, currentState, stack) { + stack.splice(0); + return this.token; + }} + ]; + + this.embedRules(HighlightRules, prefix, [{ + token: ["meta.tag.punctuation.end-tag-open.xml", "meta.tag." + tag + ".tag-name.xml"], + regex : "(|$))", + next: tag + "-end" + }, { + token: "string.cdata.xml", + regex : "<\\!\\[CDATA\\[" + }, { + token: "string.cdata.xml", + regex : "\\]\\]>" + }]); + }; + +}).call(TextHighlightRules.prototype); + +oop.inherits(XmlHighlightRules, TextHighlightRules); + +exports.XmlHighlightRules = XmlHighlightRules; +}); + +define("ace/mode/html_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/css_highlight_rules","ace/mode/javascript_highlight_rules","ace/mode/xml_highlight_rules"], function(require, exports, module) { +"use strict"; + +var oop = require("../lib/oop"); +var lang = require("../lib/lang"); +var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules; +var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules; +var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules; + +var tagMap = lang.createMap({ + a : 'anchor', + button : 'form', + form : 'form', + img : 'image', + input : 'form', + label : 'form', + option : 'form', + script : 'script', + select : 'form', + textarea : 'form', + style : 'style', + table : 'table', + tbody : 'table', + td : 'table', + tfoot : 'table', + th : 'table', + tr : 'table' +}); + +var HtmlHighlightRules = function() { + XmlHighlightRules.call(this); + + this.addRules({ + attributes: [{ + include : "tag_whitespace" + }, { + token : "entity.other.attribute-name.xml", + regex : "[-_a-zA-Z0-9:.]+" + }, { + token : "keyword.operator.attribute-equals.xml", + regex : "=", + push : [{ + include: "tag_whitespace" + }, { + token : "string.unquoted.attribute-value.html", + regex : "[^<>='\"`\\s]+", + next : "pop" + }, { + token : "empty", + regex : "", + next : "pop" + }] + }, { + include : "attribute_value" + }], + tag: [{ + token : function(start, tag) { + var group = tagMap[tag]; + return ["meta.tag.punctuation." + (start == "<" ? "" : "end-") + "tag-open.xml", + "meta.tag" + (group ? "." + group : "") + ".tag-name.xml"]; + }, + regex : "(", next : "start"} + ] + }); + + this.embedTagRules(CssHighlightRules, "css-", "style"); + this.embedTagRules(new JavaScriptHighlightRules({jsx: false}).getRules(), "js-", "script"); + + if (this.constructor === HtmlHighlightRules) + this.normalizeRules(); +}; + +oop.inherits(HtmlHighlightRules, XmlHighlightRules); + +exports.HtmlHighlightRules = HtmlHighlightRules; +}); + +define("ace/mode/behaviour/xml",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/token_iterator","ace/lib/lang"], function(require, exports, module) { +"use strict"; + +var oop = require("../../lib/oop"); +var Behaviour = require("../behaviour").Behaviour; +var TokenIterator = require("../../token_iterator").TokenIterator; +var lang = require("../../lib/lang"); + +function is(token, type) { + return token && token.type.lastIndexOf(type + ".xml") > -1; +} + +var XmlBehaviour = function () { + + this.add("string_dquotes", "insertion", function (state, action, editor, session, text) { + if (text == '"' || text == "'") { + var quote = text; + var selected = session.doc.getTextRange(editor.getSelectionRange()); + if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) { + return { + text: quote + selected + quote, + selection: false + }; + } + + var cursor = editor.getCursorPosition(); + var line = session.doc.getLine(cursor.row); + var rightChar = line.substring(cursor.column, cursor.column + 1); + var iterator = new TokenIterator(session, cursor.row, cursor.column); + var token = iterator.getCurrentToken(); + + if (rightChar == quote && (is(token, "attribute-value") || is(token, "string"))) { + return { + text: "", + selection: [1, 1] + }; + } + + if (!token) + token = iterator.stepBackward(); + + if (!token) + return; + + while (is(token, "tag-whitespace") || is(token, "whitespace")) { + token = iterator.stepBackward(); + } + var rightSpace = !rightChar || rightChar.match(/\s/); + if (is(token, "attribute-equals") && (rightSpace || rightChar == '>') || (is(token, "decl-attribute-equals") && (rightSpace || rightChar == '?'))) { + return { + text: quote + quote, + selection: [1, 1] + }; + } + } + }); + + this.add("string_dquotes", "deletion", function(state, action, editor, session, range) { + var selected = session.doc.getTextRange(range); + if (!range.isMultiLine() && (selected == '"' || selected == "'")) { + var line = session.doc.getLine(range.start.row); + var rightChar = line.substring(range.start.column + 1, range.start.column + 2); + if (rightChar == selected) { + range.end.column++; + return range; + } + } + }); + + this.add("autoclosing", "insertion", function (state, action, editor, session, text) { + if (text == '>') { + var position = editor.getSelectionRange().start; + var iterator = new TokenIterator(session, position.row, position.column); + var token = iterator.getCurrentToken() || iterator.stepBackward(); + if (!token || !(is(token, "tag-name") || is(token, "tag-whitespace") || is(token, "attribute-name") || is(token, "attribute-equals") || is(token, "attribute-value"))) + return; + if (is(token, "reference.attribute-value")) + return; + if (is(token, "attribute-value")) { + var tokenEndColumn = iterator.getCurrentTokenColumn() + token.value.length; + if (position.column < tokenEndColumn) + return; + if (position.column == tokenEndColumn) { + var nextToken = iterator.stepForward(); + if (nextToken && is(nextToken, "attribute-value")) + return; + iterator.stepBackward(); + } + } + + if (/^\s*>/.test(session.getLine(position.row).slice(position.column))) + return; + while (!is(token, "tag-name")) { + token = iterator.stepBackward(); + if (token.value == "<") { + token = iterator.stepForward(); + break; + } + } + + var tokenRow = iterator.getCurrentTokenRow(); + var tokenColumn = iterator.getCurrentTokenColumn(); + if (is(iterator.stepBackward(), "end-tag-open")) + return; + + var element = token.value; + if (tokenRow == position.row) + element = element.substring(0, position.column - tokenColumn); + + if (this.voidElements.hasOwnProperty(element.toLowerCase())) + return; + + return { + text: ">" + "", + selection: [1, 1] + }; + } + }); + + this.add("autoindent", "insertion", function (state, action, editor, session, text) { + if (text == "\n") { + var cursor = editor.getCursorPosition(); + var line = session.getLine(cursor.row); + var iterator = new TokenIterator(session, cursor.row, cursor.column); + var token = iterator.getCurrentToken(); + + if (token && token.type.indexOf("tag-close") !== -1) { + if (token.value == "/>") + return; + while (token && token.type.indexOf("tag-name") === -1) { + token = iterator.stepBackward(); + } + + if (!token) { + return; + } + + var tag = token.value; + var row = iterator.getCurrentTokenRow(); + token = iterator.stepBackward(); + if (!token || token.type.indexOf("end-tag") !== -1) { + return; + } + + if (this.voidElements && !this.voidElements[tag]) { + var nextToken = session.getTokenAt(cursor.row, cursor.column+1); + var line = session.getLine(row); + var nextIndent = this.$getIndent(line); + var indent = nextIndent + session.getTabString(); + + if (nextToken && nextToken.value === " -1; +} + +(function() { + + this.getFoldWidget = function(session, foldStyle, row) { + var tag = this._getFirstTagInLine(session, row); + + if (!tag) + return this.getCommentFoldWidget(session, row); + + if (tag.closing || (!tag.tagName && tag.selfClosing)) + return foldStyle == "markbeginend" ? "end" : ""; + + if (!tag.tagName || tag.selfClosing || this.voidElements.hasOwnProperty(tag.tagName.toLowerCase())) + return ""; + + if (this._findEndTagInLine(session, row, tag.tagName, tag.end.column)) + return ""; + + return "start"; + }; + + this.getCommentFoldWidget = function(session, row) { + if (/comment/.test(session.getState(row)) && /'; + break; + } + } + return tag; + } else if (is(token, "tag-close")) { + tag.selfClosing = token.value == '/>'; + return tag; + } + tag.start.column += token.value.length; + } + + return null; + }; + + this._findEndTagInLine = function(session, row, tagName, startColumn) { + var tokens = session.getTokens(row); + var column = 0; + for (var i = 0; i < tokens.length; i++) { + var token = tokens[i]; + column += token.value.length; + if (column < startColumn) + continue; + if (is(token, "end-tag-open")) { + token = tokens[i + 1]; + if (token && token.value == tagName) + return true; + } + } + return false; + }; + this._readTagForward = function(iterator) { + var token = iterator.getCurrentToken(); + if (!token) + return null; + + var tag = new Tag(); + do { + if (is(token, "tag-open")) { + tag.closing = is(token, "end-tag-open"); + tag.start.row = iterator.getCurrentTokenRow(); + tag.start.column = iterator.getCurrentTokenColumn(); + } else if (is(token, "tag-name")) { + tag.tagName = token.value; + } else if (is(token, "tag-close")) { + tag.selfClosing = token.value == "/>"; + tag.end.row = iterator.getCurrentTokenRow(); + tag.end.column = iterator.getCurrentTokenColumn() + token.value.length; + iterator.stepForward(); + return tag; + } + } while(token = iterator.stepForward()); + + return null; + }; + + this._readTagBackward = function(iterator) { + var token = iterator.getCurrentToken(); + if (!token) + return null; + + var tag = new Tag(); + do { + if (is(token, "tag-open")) { + tag.closing = is(token, "end-tag-open"); + tag.start.row = iterator.getCurrentTokenRow(); + tag.start.column = iterator.getCurrentTokenColumn(); + iterator.stepBackward(); + return tag; + } else if (is(token, "tag-name")) { + tag.tagName = token.value; + } else if (is(token, "tag-close")) { + tag.selfClosing = token.value == "/>"; + tag.end.row = iterator.getCurrentTokenRow(); + tag.end.column = iterator.getCurrentTokenColumn() + token.value.length; + } + } while(token = iterator.stepBackward()); + + return null; + }; + + this._pop = function(stack, tag) { + while (stack.length) { + + var top = stack[stack.length-1]; + if (!tag || top.tagName == tag.tagName) { + return stack.pop(); + } + else if (this.optionalEndTags.hasOwnProperty(top.tagName)) { + stack.pop(); + continue; + } else { + return null; + } + } + }; + + this.getFoldWidgetRange = function(session, foldStyle, row) { + var firstTag = this._getFirstTagInLine(session, row); + + if (!firstTag) { + return this.getCommentFoldWidget(session, row) + && session.getCommentFoldRange(row, session.getLine(row).length); + } + + var isBackward = firstTag.closing || firstTag.selfClosing; + var stack = []; + var tag; + + if (!isBackward) { + var iterator = new TokenIterator(session, row, firstTag.start.column); + var start = { + row: row, + column: firstTag.start.column + firstTag.tagName.length + 2 + }; + if (firstTag.start.row == firstTag.end.row) + start.column = firstTag.end.column; + while (tag = this._readTagForward(iterator)) { + if (tag.selfClosing) { + if (!stack.length) { + tag.start.column += tag.tagName.length + 2; + tag.end.column -= 2; + return Range.fromPoints(tag.start, tag.end); + } else + continue; + } + + if (tag.closing) { + this._pop(stack, tag); + if (stack.length == 0) + return Range.fromPoints(start, tag.start); + } + else { + stack.push(tag); + } + } + } + else { + var iterator = new TokenIterator(session, row, firstTag.end.column); + var end = { + row: row, + column: firstTag.start.column + }; + + while (tag = this._readTagBackward(iterator)) { + if (tag.selfClosing) { + if (!stack.length) { + tag.start.column += tag.tagName.length + 2; + tag.end.column -= 2; + return Range.fromPoints(tag.start, tag.end); + } else + continue; + } + + if (!tag.closing) { + this._pop(stack, tag); + if (stack.length == 0) { + tag.start.column += tag.tagName.length + 2; + if (tag.start.row == tag.end.row && tag.start.column < tag.end.column) + tag.start.column = tag.end.column; + return Range.fromPoints(tag.start, end); + } + } + else { + stack.push(tag); + } + } + } + + }; + +}).call(FoldMode.prototype); + +}); + +define("ace/mode/folding/html",["require","exports","module","ace/lib/oop","ace/mode/folding/mixed","ace/mode/folding/xml","ace/mode/folding/cstyle"], function(require, exports, module) { +"use strict"; + +var oop = require("../../lib/oop"); +var MixedFoldMode = require("./mixed").FoldMode; +var XmlFoldMode = require("./xml").FoldMode; +var CStyleFoldMode = require("./cstyle").FoldMode; + +var FoldMode = exports.FoldMode = function(voidElements, optionalTags) { + MixedFoldMode.call(this, new XmlFoldMode(voidElements, optionalTags), { + "js-": new CStyleFoldMode(), + "css-": new CStyleFoldMode() + }); +}; + +oop.inherits(FoldMode, MixedFoldMode); + +}); + +define("ace/mode/html_completions",["require","exports","module","ace/token_iterator"], function(require, exports, module) { +"use strict"; + +var TokenIterator = require("../token_iterator").TokenIterator; + +var commonAttributes = [ + "accesskey", + "class", + "contenteditable", + "contextmenu", + "dir", + "draggable", + "dropzone", + "hidden", + "id", + "inert", + "itemid", + "itemprop", + "itemref", + "itemscope", + "itemtype", + "lang", + "spellcheck", + "style", + "tabindex", + "title", + "translate" +]; + +var eventAttributes = [ + "onabort", + "onblur", + "oncancel", + "oncanplay", + "oncanplaythrough", + "onchange", + "onclick", + "onclose", + "oncontextmenu", + "oncuechange", + "ondblclick", + "ondrag", + "ondragend", + "ondragenter", + "ondragleave", + "ondragover", + "ondragstart", + "ondrop", + "ondurationchange", + "onemptied", + "onended", + "onerror", + "onfocus", + "oninput", + "oninvalid", + "onkeydown", + "onkeypress", + "onkeyup", + "onload", + "onloadeddata", + "onloadedmetadata", + "onloadstart", + "onmousedown", + "onmousemove", + "onmouseout", + "onmouseover", + "onmouseup", + "onmousewheel", + "onpause", + "onplay", + "onplaying", + "onprogress", + "onratechange", + "onreset", + "onscroll", + "onseeked", + "onseeking", + "onselect", + "onshow", + "onstalled", + "onsubmit", + "onsuspend", + "ontimeupdate", + "onvolumechange", + "onwaiting" +]; + +var globalAttributes = commonAttributes.concat(eventAttributes); + +var attributeMap = { + "a": {"href": 1, "target": {"_blank": 1, "top": 1}, "ping": 1, "rel": {"nofollow": 1, "alternate": 1, "author": 1, "bookmark": 1, "help": 1, "license": 1, "next": 1, "noreferrer": 1, "prefetch": 1, "prev": 1, "search": 1, "tag": 1}, "media": 1, "hreflang": 1, "type": 1}, + "abbr": {}, + "address": {}, + "area": {"shape": 1, "coords": 1, "href": 1, "hreflang": 1, "alt": 1, "target": 1, "media": 1, "rel": 1, "ping": 1, "type": 1}, + "article": {"pubdate": 1}, + "aside": {}, + "audio": {"src": 1, "autobuffer": 1, "autoplay": {"autoplay": 1}, "loop": {"loop": 1}, "controls": {"controls": 1}, "muted": {"muted": 1}, "preload": {"auto": 1, "metadata": 1, "none": 1 }}, + "b": {}, + "base": {"href": 1, "target": 1}, + "bdi": {}, + "bdo": {}, + "blockquote": {"cite": 1}, + "body": {"onafterprint": 1, "onbeforeprint": 1, "onbeforeunload": 1, "onhashchange": 1, "onmessage": 1, "onoffline": 1, "onpopstate": 1, "onredo": 1, "onresize": 1, "onstorage": 1, "onundo": 1, "onunload": 1}, + "br": {}, + "button": {"autofocus": 1, "disabled": {"disabled": 1}, "form": 1, "formaction": 1, "formenctype": 1, "formmethod": 1, "formnovalidate": 1, "formtarget": 1, "name": 1, "value": 1, "type": {"button": 1, "submit": 1}}, + "canvas": {"width": 1, "height": 1}, + "caption": {}, + "cite": {}, + "code": {}, + "col": {"span": 1}, + "colgroup": {"span": 1}, + "command": {"type": 1, "label": 1, "icon": 1, "disabled": 1, "checked": 1, "radiogroup": 1, "command": 1}, + "data": {}, + "datalist": {}, + "dd": {}, + "del": {"cite": 1, "datetime": 1}, + "details": {"open": 1}, + "dfn": {}, + "dialog": {"open": 1}, + "div": {}, + "dl": {}, + "dt": {}, + "em": {}, + "embed": {"src": 1, "height": 1, "width": 1, "type": 1}, + "fieldset": {"disabled": 1, "form": 1, "name": 1}, + "figcaption": {}, + "figure": {}, + "footer": {}, + "form": {"accept-charset": 1, "action": 1, "autocomplete": 1, "enctype": {"multipart/form-data": 1, "application/x-www-form-urlencoded": 1}, "method": {"get": 1, "post": 1}, "name": 1, "novalidate": 1, "target": {"_blank": 1, "top": 1}}, + "h1": {}, + "h2": {}, + "h3": {}, + "h4": {}, + "h5": {}, + "h6": {}, + "head": {}, + "header": {}, + "hr": {}, + "html": {"manifest": 1}, + "i": {}, + "iframe": {"name": 1, "src": 1, "height": 1, "width": 1, "sandbox": {"allow-same-origin": 1, "allow-top-navigation": 1, "allow-forms": 1, "allow-scripts": 1}, "seamless": {"seamless": 1}}, + "img": {"alt": 1, "src": 1, "height": 1, "width": 1, "usemap": 1, "ismap": 1}, + "input": { + "type": {"text": 1, "password": 1, "hidden": 1, "checkbox": 1, "submit": 1, "radio": 1, "file": 1, "button": 1, "reset": 1, "image": 31, "color": 1, "date": 1, "datetime": 1, "datetime-local": 1, "email": 1, "month": 1, "number": 1, "range": 1, "search": 1, "tel": 1, "time": 1, "url": 1, "week": 1}, + "accept": 1, "alt": 1, "autocomplete": {"on": 1, "off": 1}, "autofocus": {"autofocus": 1}, "checked": {"checked": 1}, "disabled": {"disabled": 1}, "form": 1, "formaction": 1, "formenctype": {"application/x-www-form-urlencoded": 1, "multipart/form-data": 1, "text/plain": 1}, "formmethod": {"get": 1, "post": 1}, "formnovalidate": {"formnovalidate": 1}, "formtarget": {"_blank": 1, "_self": 1, "_parent": 1, "_top": 1}, "height": 1, "list": 1, "max": 1, "maxlength": 1, "min": 1, "multiple": {"multiple": 1}, "name": 1, "pattern": 1, "placeholder": 1, "readonly": {"readonly": 1}, "required": {"required": 1}, "size": 1, "src": 1, "step": 1, "width": 1, "files": 1, "value": 1}, + "ins": {"cite": 1, "datetime": 1}, + "kbd": {}, + "keygen": {"autofocus": 1, "challenge": {"challenge": 1}, "disabled": {"disabled": 1}, "form": 1, "keytype": {"rsa": 1, "dsa": 1, "ec": 1}, "name": 1}, + "label": {"form": 1, "for": 1}, + "legend": {}, + "li": {"value": 1}, + "link": {"href": 1, "hreflang": 1, "rel": {"stylesheet": 1, "icon": 1}, "media": {"all": 1, "screen": 1, "print": 1}, "type": {"text/css": 1, "image/png": 1, "image/jpeg": 1, "image/gif": 1}, "sizes": 1}, + "main": {}, + "map": {"name": 1}, + "mark": {}, + "math": {}, + "menu": {"type": 1, "label": 1}, + "meta": {"http-equiv": {"content-type": 1}, "name": {"description": 1, "keywords": 1}, "content": {"text/html; charset=UTF-8": 1}, "charset": 1}, + "meter": {"value": 1, "min": 1, "max": 1, "low": 1, "high": 1, "optimum": 1}, + "nav": {}, + "noscript": {"href": 1}, + "object": {"param": 1, "data": 1, "type": 1, "height" : 1, "width": 1, "usemap": 1, "name": 1, "form": 1, "classid": 1}, + "ol": {"start": 1, "reversed": 1}, + "optgroup": {"disabled": 1, "label": 1}, + "option": {"disabled": 1, "selected": 1, "label": 1, "value": 1}, + "output": {"for": 1, "form": 1, "name": 1}, + "p": {}, + "param": {"name": 1, "value": 1}, + "pre": {}, + "progress": {"value": 1, "max": 1}, + "q": {"cite": 1}, + "rp": {}, + "rt": {}, + "ruby": {}, + "s": {}, + "samp": {}, + "script": {"charset": 1, "type": {"text/javascript": 1}, "src": 1, "defer": 1, "async": 1}, + "select": {"autofocus": 1, "disabled": 1, "form": 1, "multiple": {"multiple": 1}, "name": 1, "size": 1, "readonly":{"readonly": 1}}, + "small": {}, + "source": {"src": 1, "type": 1, "media": 1}, + "span": {}, + "strong": {}, + "style": {"type": 1, "media": {"all": 1, "screen": 1, "print": 1}, "scoped": 1}, + "sub": {}, + "sup": {}, + "svg": {}, + "table": {"summary": 1}, + "tbody": {}, + "td": {"headers": 1, "rowspan": 1, "colspan": 1}, + "textarea": {"autofocus": {"autofocus": 1}, "disabled": {"disabled": 1}, "form": 1, "maxlength": 1, "name": 1, "placeholder": 1, "readonly": {"readonly": 1}, "required": {"required": 1}, "rows": 1, "cols": 1, "wrap": {"on": 1, "off": 1, "hard": 1, "soft": 1}}, + "tfoot": {}, + "th": {"headers": 1, "rowspan": 1, "colspan": 1, "scope": 1}, + "thead": {}, + "time": {"datetime": 1}, + "title": {}, + "tr": {}, + "track": {"kind": 1, "src": 1, "srclang": 1, "label": 1, "default": 1}, + "section": {}, + "summary": {}, + "u": {}, + "ul": {}, + "var": {}, + "video": {"src": 1, "autobuffer": 1, "autoplay": {"autoplay": 1}, "loop": {"loop": 1}, "controls": {"controls": 1}, "width": 1, "height": 1, "poster": 1, "muted": {"muted": 1}, "preload": {"auto": 1, "metadata": 1, "none": 1}}, + "wbr": {} +}; + +var elements = Object.keys(attributeMap); + +function is(token, type) { + return token.type.lastIndexOf(type + ".xml") > -1; +} + +function findTagName(session, pos) { + var iterator = new TokenIterator(session, pos.row, pos.column); + var token = iterator.getCurrentToken(); + while (token && !is(token, "tag-name")){ + token = iterator.stepBackward(); + } + if (token) + return token.value; +} + +function findAttributeName(session, pos) { + var iterator = new TokenIterator(session, pos.row, pos.column); + var token = iterator.getCurrentToken(); + while (token && !is(token, "attribute-name")){ + token = iterator.stepBackward(); + } + if (token) + return token.value; +} + +var HtmlCompletions = function() { + +}; + +(function() { + + this.getCompletions = function(state, session, pos, prefix) { + var token = session.getTokenAt(pos.row, pos.column); + + if (!token) + return []; + if (is(token, "tag-name") || is(token, "tag-open") || is(token, "end-tag-open")) + return this.getTagCompletions(state, session, pos, prefix); + if (is(token, "tag-whitespace") || is(token, "attribute-name")) + return this.getAttributeCompletions(state, session, pos, prefix); + if (is(token, "attribute-value")) + return this.getAttributeValueCompletions(state, session, pos, prefix); + var line = session.getLine(pos.row).substr(0, pos.column); + if (/&[a-z]*$/i.test(line)) + return this.getHTMLEntityCompletions(state, session, pos, prefix); + + return []; + }; + + this.getTagCompletions = function(state, session, pos, prefix) { + return elements.map(function(element){ + return { + value: element, + meta: "tag", + score: 1000000 + }; + }); + }; + + this.getAttributeCompletions = function(state, session, pos, prefix) { + var tagName = findTagName(session, pos); + if (!tagName) + return []; + var attributes = globalAttributes; + if (tagName in attributeMap) { + attributes = attributes.concat(Object.keys(attributeMap[tagName])); + } + return attributes.map(function(attribute){ + return { + caption: attribute, + snippet: attribute + '="$0"', + meta: "attribute", + score: 1000000 + }; + }); + }; + + this.getAttributeValueCompletions = function(state, session, pos, prefix) { + var tagName = findTagName(session, pos); + var attributeName = findAttributeName(session, pos); + + if (!tagName) + return []; + var values = []; + if (tagName in attributeMap && attributeName in attributeMap[tagName] && typeof attributeMap[tagName][attributeName] === "object") { + values = Object.keys(attributeMap[tagName][attributeName]); + } + return values.map(function(value){ + return { + caption: value, + snippet: value, + meta: "attribute value", + score: 1000000 + }; + }); + }; + + this.getHTMLEntityCompletions = function(state, session, pos, prefix) { + var values = ['Aacute;', 'aacute;', 'Acirc;', 'acirc;', 'acute;', 'AElig;', 'aelig;', 'Agrave;', 'agrave;', 'alefsym;', 'Alpha;', 'alpha;', 'amp;', 'and;', 'ang;', 'Aring;', 'aring;', 'asymp;', 'Atilde;', 'atilde;', 'Auml;', 'auml;', 'bdquo;', 'Beta;', 'beta;', 'brvbar;', 'bull;', 'cap;', 'Ccedil;', 'ccedil;', 'cedil;', 'cent;', 'Chi;', 'chi;', 'circ;', 'clubs;', 'cong;', 'copy;', 'crarr;', 'cup;', 'curren;', 'Dagger;', 'dagger;', 'dArr;', 'darr;', 'deg;', 'Delta;', 'delta;', 'diams;', 'divide;', 'Eacute;', 'eacute;', 'Ecirc;', 'ecirc;', 'Egrave;', 'egrave;', 'empty;', 'emsp;', 'ensp;', 'Epsilon;', 'epsilon;', 'equiv;', 'Eta;', 'eta;', 'ETH;', 'eth;', 'Euml;', 'euml;', 'euro;', 'exist;', 'fnof;', 'forall;', 'frac12;', 'frac14;', 'frac34;', 'frasl;', 'Gamma;', 'gamma;', 'ge;', 'gt;', 'hArr;', 'harr;', 'hearts;', 'hellip;', 'Iacute;', 'iacute;', 'Icirc;', 'icirc;', 'iexcl;', 'Igrave;', 'igrave;', 'image;', 'infin;', 'int;', 'Iota;', 'iota;', 'iquest;', 'isin;', 'Iuml;', 'iuml;', 'Kappa;', 'kappa;', 'Lambda;', 'lambda;', 'lang;', 'laquo;', 'lArr;', 'larr;', 'lceil;', 'ldquo;', 'le;', 'lfloor;', 'lowast;', 'loz;', 'lrm;', 'lsaquo;', 'lsquo;', 'lt;', 'macr;', 'mdash;', 'micro;', 'middot;', 'minus;', 'Mu;', 'mu;', 'nabla;', 'nbsp;', 'ndash;', 'ne;', 'ni;', 'not;', 'notin;', 'nsub;', 'Ntilde;', 'ntilde;', 'Nu;', 'nu;', 'Oacute;', 'oacute;', 'Ocirc;', 'ocirc;', 'OElig;', 'oelig;', 'Ograve;', 'ograve;', 'oline;', 'Omega;', 'omega;', 'Omicron;', 'omicron;', 'oplus;', 'or;', 'ordf;', 'ordm;', 'Oslash;', 'oslash;', 'Otilde;', 'otilde;', 'otimes;', 'Ouml;', 'ouml;', 'para;', 'part;', 'permil;', 'perp;', 'Phi;', 'phi;', 'Pi;', 'pi;', 'piv;', 'plusmn;', 'pound;', 'Prime;', 'prime;', 'prod;', 'prop;', 'Psi;', 'psi;', 'quot;', 'radic;', 'rang;', 'raquo;', 'rArr;', 'rarr;', 'rceil;', 'rdquo;', 'real;', 'reg;', 'rfloor;', 'Rho;', 'rho;', 'rlm;', 'rsaquo;', 'rsquo;', 'sbquo;', 'Scaron;', 'scaron;', 'sdot;', 'sect;', 'shy;', 'Sigma;', 'sigma;', 'sigmaf;', 'sim;', 'spades;', 'sub;', 'sube;', 'sum;', 'sup;', 'sup1;', 'sup2;', 'sup3;', 'supe;', 'szlig;', 'Tau;', 'tau;', 'there4;', 'Theta;', 'theta;', 'thetasym;', 'thinsp;', 'THORN;', 'thorn;', 'tilde;', 'times;', 'trade;', 'Uacute;', 'uacute;', 'uArr;', 'uarr;', 'Ucirc;', 'ucirc;', 'Ugrave;', 'ugrave;', 'uml;', 'upsih;', 'Upsilon;', 'upsilon;', 'Uuml;', 'uuml;', 'weierp;', 'Xi;', 'xi;', 'Yacute;', 'yacute;', 'yen;', 'Yuml;', 'yuml;', 'Zeta;', 'zeta;', 'zwj;', 'zwnj;']; + + return values.map(function(value){ + return { + caption: value, + snippet: value, + meta: "html entity", + score: 1000000 + }; + }); + }; + +}).call(HtmlCompletions.prototype); + +exports.HtmlCompletions = HtmlCompletions; +}); + +define("ace/mode/html",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text","ace/mode/javascript","ace/mode/css","ace/mode/html_highlight_rules","ace/mode/behaviour/xml","ace/mode/folding/html","ace/mode/html_completions","ace/worker/worker_client"], function(require, exports, module) { +"use strict"; + +var oop = require("../lib/oop"); +var lang = require("../lib/lang"); +var TextMode = require("./text").Mode; +var JavaScriptMode = require("./javascript").Mode; +var CssMode = require("./css").Mode; +var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules; +var XmlBehaviour = require("./behaviour/xml").XmlBehaviour; +var HtmlFoldMode = require("./folding/html").FoldMode; +var HtmlCompletions = require("./html_completions").HtmlCompletions; +var WorkerClient = require("../worker/worker_client").WorkerClient; +var voidElements = ["area", "base", "br", "col", "embed", "hr", "img", "input", "keygen", "link", "meta", "menuitem", "param", "source", "track", "wbr"]; +var optionalEndTags = ["li", "dt", "dd", "p", "rt", "rp", "optgroup", "option", "colgroup", "td", "th"]; + +var Mode = function(options) { + this.fragmentContext = options && options.fragmentContext; + this.HighlightRules = HtmlHighlightRules; + this.$behaviour = new XmlBehaviour(); + this.$completer = new HtmlCompletions(); + + this.createModeDelegates({ + "js-": JavaScriptMode, + "css-": CssMode + }); + + this.foldingRules = new HtmlFoldMode(this.voidElements, lang.arrayToMap(optionalEndTags)); +}; +oop.inherits(Mode, TextMode); + +(function() { + + this.blockComment = {start: ""}; + + this.voidElements = lang.arrayToMap(voidElements); + + this.getNextLineIndent = function(state, line, tab) { + return this.$getIndent(line); + }; + + this.checkOutdent = function(state, line, input) { + return false; + }; + + this.getCompletions = function(state, session, pos, prefix) { + return this.$completer.getCompletions(state, session, pos, prefix); + }; + + this.createWorker = function(session) { + if (this.constructor != Mode) + return; + var worker = new WorkerClient(["ace"], "ace/mode/html_worker", "Worker"); + worker.attachToDocument(session.getDocument()); + + if (this.fragmentContext) + worker.call("setOptions", [{context: this.fragmentContext}]); + + worker.on("error", function(e) { + session.setAnnotations(e.data); + }); + + worker.on("terminate", function() { + session.clearAnnotations(); + }); + + return worker; + }; + + this.$id = "ace/mode/html"; + this.snippetFileId = "ace/snippets/html"; +}).call(Mode.prototype); + +exports.Mode = Mode; +}); + +define("ace/mode/latte_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/html_highlight_rules","ace/mode/text_highlight_rules"], function(require, exports, module) { +"use strict"; + +var oop = require("../lib/oop"); +var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules; +var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; + +var LatteHighlightRules = function() { + HtmlHighlightRules.call(this); + for (var rule in this.$rules) { + this.$rules[rule].unshift( + { + token : "comment.start.latte", + regex : "\\{\\*", + push : [{ + token : "comment.end.latte", + regex : ".*\\*\\}", + next : "pop" + }, { + defaultToken : "comment" + }] + }, { + token : "meta.tag.punctuation.tag-open.latte", + regex : "\\{(?![\\s'\"{}]|$)/?", + push : [{ + token : "meta.tag.latte", + regex : "(?:_|=|[a-z]\\w*(?:[.:-]\\w+)*)?", + next: [{ + token : "meta.tag.punctuation.tag-close.latte", + regex : "\\}", + next : "pop" + }, { + include: "latte-content" + }] + }] + }); + } + this.$rules['tag_stuff'].unshift({ + token : "meta.attribute.latte", + regex : "n:[\\w-]+", + next : [{ + include: "tag_whitespace" + }, { + token : "keyword.operator.attribute-equals.xml", + regex : "=", + next : [{ + token : "string.attribute-value.xml", + regex : "'", + next : [ + {token : "string.attribute-value.xml", regex: "'", next: "tag_stuff"}, + {include : "latte-content"} + ] + }, { + token : "string.attribute-value.xml", + regex : '"', + next : [ + {token : "string.attribute-value.xml", regex: '"', next: "tag_stuff"}, + {include : "latte-content"} + ] + }, { + token : "text.tag-whitespace.xml", + regex : "\\s", + next: "tag_stuff" + }, { + token : "meta.tag.punctuation.tag-close.xml", + regex : "/?>", + next: "tag_stuff" + }, { + include : "latte-content" + }] + }, { + token : "empty", + regex : "", + next : "tag_stuff" + }] + }); + this.$rules["latte-content"] = [ + { + token : "comment.start.latte", // multi line comment + regex : "\\/\\*", + push : [ + { + token : "comment.end.latte", + regex : "\\*\\/", + next : "pop" + }, { + defaultToken : "comment" + } + ] + }, { + token : "string.start", // " string start + regex : '"', + push : [ + { + token : "constant.language.escape", + regex : '\\\\(?:[nrtvef\\\\"$]|[0-7]{1,3}|x[0-9A-Fa-f]{1,2})' + }, { + token : "variable", + regex : /\$[\w]+(?:\[[\w\]+]|[=\-]>\w+)?/ + }, { + token : "variable", + regex : /\$\{[^"\}]+\}?/ // this is wrong but ok for now + }, + {token : "string.end", regex : '"', next : "pop"}, + {defaultToken : "string"} + ] + }, { + token : "string.start", // ' string start + regex : "'", + push : [ + {token : "constant.language.escape", regex : /\\['\\]/}, + {token : "string.end", regex : "'", next : "pop"}, + {defaultToken : "string"} + ] + }, { + token : "keyword.control", + regex : "\\b(?:INF|NAN|and|or|xor|AND|OR|XOR|clone|new|instanceof|return|continue|break|as)\\b" + }, { + token : "constant.language", + regex : "\\b(?:true|false|null|TRUE|FALSE|NULL)\\b" + }, { + token : "variable", + regex : /\$\w+/ + }, { + token : "constant.numeric", + regex : "[+-]?[0-9]+(?:\\.[0-9]+)?(?:e[0-9]+)?" + }, { + token : ["support.class", "keyword.operator"], + regex : "\\b(\\w+)(::)" + }, { + token : "constant.language", // constants + regex : "\\b(?:[A-Z0-9_]+)\\b" + }, { + token : "string.unquoted", + regex : "\\w+(?:-+\\w+)*" + }, { + token : "paren.lparen", + regex : "[[({]" + }, { + token : "paren.rparen", + regex : "[\\])}]" + }, { + token : "keyword.operator", + regex : "::|=>|->|\\?->|\\?\\?->|\\+\\+|--|<<|>>|<=>|<=|>=|===|!==|==|!=|<>|&&|\\|\\||\\?\\?|\\?>|\\*\\*|\\.\\.\\.|[^'\"]" // =>, any char except quotes + } + ]; + + this.normalizeRules(); +}; + +oop.inherits(LatteHighlightRules, TextHighlightRules); + +exports.LatteHighlightRules = LatteHighlightRules; +}); + +define("ace/mode/latte",["require","exports","module","ace/lib/oop","ace/mode/html","ace/mode/latte_highlight_rules","ace/mode/matching_brace_outdent"], function(require, exports, module) { +"use strict"; + +var oop = require("../lib/oop"); +var HtmlMode = require("./html").Mode; +var LatteHighlightRules = require("./latte_highlight_rules").LatteHighlightRules; +var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; + +var Mode = function() { + HtmlMode.call(this); + this.HighlightRules = LatteHighlightRules; + this.$outdent = new MatchingBraceOutdent(); +}; +oop.inherits(Mode, HtmlMode); + +(function() { + this.blockComment = {start: "{*", end: "*}"}; + + this.getNextLineIndent = function(state, line, tab) { + var indent = this.$getIndent(line); + + if (state == "start") { + var match = line.match(/^.*\{(?:if|else|elseif|ifset|elseifset|ifchanged|switch|case|foreach|iterateWhile|for|while|first|last|sep|try|capture|spaceless|snippet|block|define|embed|snippetArea)\b[^{]*$/); + if (match) { + indent += tab; + } + } + + return indent; + }; + + this.checkOutdent = function(state, line, input) { + return /^\s+\{\/$/.test(line + input); + }; + + this.autoOutdent = function(state, doc, row) { + }; + + this.$id = "ace/mode/latte"; +}).call(Mode.prototype); + +exports.Mode = Mode; +}); (function() { + window.require(["ace/mode/latte"], function(m) { + if (typeof module == "object" && typeof exports == "object" && module) { + module.exports = m; + } + }); + })(); + \ No newline at end of file diff --git a/htdocs/includes/ace/src/mode-liquid.js b/htdocs/includes/ace/src/mode-liquid.js index 6bbf7d1e9d6..f22cfa98a4a 100644 --- a/htdocs/includes/ace/src/mode-liquid.js +++ b/htdocs/includes/ace/src/mode-liquid.js @@ -784,6 +784,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/javascript"; + this.snippetFileId = "ace/snippets/javascript"; }).call(Mode.prototype); exports.Mode = Mode; @@ -1316,6 +1317,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/css"; + this.snippetFileId = "ace/snippets/css"; }).call(Mode.prototype); exports.Mode = Mode; @@ -2493,6 +2495,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/html"; + this.snippetFileId = "ace/snippets/html"; }).call(Mode.prototype); exports.Mode = Mode; @@ -2725,6 +2728,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/liquid"; + this.snippetFileId = "ace/snippets/liquid"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-lsl.js b/htdocs/includes/ace/src/mode-lsl.js index f6d7a7497f5..a08ff25f31b 100644 --- a/htdocs/includes/ace/src/mode-lsl.js +++ b/htdocs/includes/ace/src/mode-lsl.js @@ -329,6 +329,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/lsl"; + this.snippetFileId = "ace/snippets/lsl"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-lua.js b/htdocs/includes/ace/src/mode-lua.js index e96b6c37a9b..a87f127a893 100644 --- a/htdocs/includes/ace/src/mode-lua.js +++ b/htdocs/includes/ace/src/mode-lua.js @@ -438,6 +438,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/lua"; + this.snippetFileId = "ace/snippets/lua"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-luapage.js b/htdocs/includes/ace/src/mode-luapage.js index 5f5ecce9079..49bbde3f148 100644 --- a/htdocs/includes/ace/src/mode-luapage.js +++ b/htdocs/includes/ace/src/mode-luapage.js @@ -784,6 +784,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/javascript"; + this.snippetFileId = "ace/snippets/javascript"; }).call(Mode.prototype); exports.Mode = Mode; @@ -1316,6 +1317,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/css"; + this.snippetFileId = "ace/snippets/css"; }).call(Mode.prototype); exports.Mode = Mode; @@ -2493,6 +2495,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/html"; + this.snippetFileId = "ace/snippets/html"; }).call(Mode.prototype); exports.Mode = Mode; @@ -2938,6 +2941,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/lua"; + this.snippetFileId = "ace/snippets/lua"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-makefile.js b/htdocs/includes/ace/src/mode-makefile.js index 0314c6a216b..f8d853bd52c 100644 --- a/htdocs/includes/ace/src/mode-makefile.js +++ b/htdocs/includes/ace/src/mode-makefile.js @@ -398,6 +398,7 @@ oop.inherits(Mode, TextMode); this.$indentWithTabs = true; this.$id = "ace/mode/makefile"; + this.snippetFileId = "ace/snippets/makefile"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-markdown.js b/htdocs/includes/ace/src/mode-markdown.js index ac4072175ec..42fa514fdf5 100644 --- a/htdocs/includes/ace/src/mode-markdown.js +++ b/htdocs/includes/ace/src/mode-markdown.js @@ -784,6 +784,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/javascript"; + this.snippetFileId = "ace/snippets/javascript"; }).call(Mode.prototype); exports.Mode = Mode; @@ -1986,6 +1987,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/css"; + this.snippetFileId = "ace/snippets/css"; }).call(Mode.prototype); exports.Mode = Mode; @@ -2539,6 +2541,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/html"; + this.snippetFileId = "ace/snippets/html"; }).call(Mode.prototype); exports.Mode = Mode; @@ -3124,6 +3127,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/sh"; + this.snippetFileId = "ace/snippets/sh"; }).call(Mode.prototype); exports.Mode = Mode; @@ -3176,6 +3180,7 @@ oop.inherits(Mode, TextMode); } }; this.$id = "ace/mode/markdown"; + this.snippetFileId = "ace/snippets/markdown"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-maze.js b/htdocs/includes/ace/src/mode-maze.js index faa82968572..75e1da782da 100644 --- a/htdocs/includes/ace/src/mode-maze.js +++ b/htdocs/includes/ace/src/mode-maze.js @@ -278,6 +278,7 @@ oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "//"; this.$id = "ace/mode/maze"; + this.snippetFileId = "ace/snippets/maze"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-mediawiki.js b/htdocs/includes/ace/src/mode-mediawiki.js new file mode 100644 index 00000000000..199e90b9101 --- /dev/null +++ b/htdocs/includes/ace/src/mode-mediawiki.js @@ -0,0 +1,592 @@ +define("ace/mode/mediawiki_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) { +"use strict"; + +var oop = require("../lib/oop"); +var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; + +var MediaWikiHighlightRules = function() { + this.$rules = { + start: [{ + include: "#switch" + }, { + include: "#redirect" + }, { + include: "#variable" + }, { + include: "#comment" + }, { + include: "#entity" + }, { + include: "#emphasis" + }, { + include: "#tag" + }, { + include: "#table" + }, { + include: "#hr" + }, { + include: "#heading" + }, { + include: "#link" + }, { + include: "#list" + }, { + include: "#template" + }], + "#hr": [{ + token: "markup.bold", + regex: /^[-]{4,}/ + }], + "#switch": [{ + token: "constant.language", + regex: /(__NOTOC__|__FORCETOC__|__TOC__|__NOEDITSECTION__|__NEWSECTIONLINK__|__NONEWSECTIONLINK__|__NOWYSIWYG__|__NOGALLERY__|__HIDDENCAT__|__EXPECTUNUSEDCATEGORY__|__NOCONTENTCONVERT__|__NOCC__|__NOTITLECONVERT__|__NOTC__|__START__|__END__|__INDEX__|__NOINDEX__|__STATICREDIRECT__|__NOGLOBAL__|__DISAMBIG__)/ + }], + "#redirect": [{ + token: [ + "keyword.control.redirect", + "meta.keyword.control" + ], + regex: /(^#REDIRECT|^#redirect|^#Redirect)(\s+)/ + }], + "#variable": [{ + token: "storage.type.variable", + regex: /{{{/, + push: [{ + token: "storage.type.variable", + regex: /}}}/, + next: "pop" + }, { + token: [ + "text", + "variable.other", + "text", + "keyword.operator" + ], + regex: /(\s*)(\w+)(\s*)((?:\|)?)/ + }, { + defaultToken: "storage.type.variable" + }] + }], + "#entity": [{ + token: "constant.character.entity", + regex: /&\w+;/ + }], + "#list": [{ + token: "markup.bold", + regex: /^[#*;:]+/, + push: [{ + token: "markup.list", + regex: /$/, + next: "pop" + }, { + include: "$self" + }, { + defaultToken: "markup.list" + }] + }], + "#template": [{ + token: [ + "storage.type.function", + "meta.template", + "entity.name.function", + "meta.template" + ], + regex: /({{)(\s*)([#\w: ]+)(\s*)/, + push: [{ + token: "storage.type.function", + regex: /}}/, + next: "pop" + }, { + token: [ + "storage", + "meta.structure.dictionary", + "support.type.property-name", + "meta.structure.dictionary", + "punctuation.separator.dictionary.key-value", + "meta.structure.dictionary", + "meta.structure.dictionary.value" + ], + regex: /(\|)(\s*)([a-zA-Z-]*)(\s*)(=)(\s*)([^|}]*)/, + push: [{ + token: "meta.structure.dictionary", + regex: /(?=}}|[|])/, + next: "pop" + }, { + defaultToken: "meta.structure.dictionary" + }] + }, { + token: ["storage", "meta.template.value"], + regex: /(\|)(.*?)/, + push: [{ + token: [], + regex: /(?=}}|[|])/, + next: "pop" + }, { + include: "$self" + }, { + defaultToken: "meta.template.value" + }] + }, { + defaultToken: "meta.template" + }] + }], + "#link": [{ + token: [ + "punctuation.definition.tag.begin", + "meta.tag.link.internal", + "entity.name.tag", + "meta.tag.link.internal", + "string.other.link.title", + "meta.tag.link.internal", + "punctuation.definition.tag" + ], + regex: /(\[\[)(\s*)((?:Category|Wikipedia)?)(:?)([^\]\]\|]+)(\s*)((?:\|)*)/, + push: [{ + token: "punctuation.definition.tag.end", + regex: /\]\]/, + next: "pop" + }, { + include: "$self" + }, { + defaultToken: "meta.tag.link.internal" + }] + }, { + token: [ + "punctuation.definition.tag.begin", + "meta.tag.link.external", + "meta.tag.link.external", + "string.unquoted", + "punctuation.definition.tag.end" + ], + regex: /(\[)(.*?)([\s]+)(.*?)(\])/ + }], + "#comment": [{ + token: "punctuation.definition.comment.html", + regex: //, + next: "pop" + }, { + defaultToken: "comment.block.html" + }] + }], + "#emphasis": [{ + token: [ + "punctuation.definition.tag.begin", + "markup.italic.bold", + "punctuation.definition.tag.end" + ], + regex: /(''''')(?!')(.*?)('''''|$)/ + }, { + token: [ + "punctuation.definition.tag.begin", + "markup.bold", + "punctuation.definition.tag.end" + ], + regex: /(''')(?!')(.*?)('''|$)/ + }, { + token: [ + "punctuation.definition.tag.begin", + "markup.italic", + "punctuation.definition.tag.end" + ], + regex: /('')(?!')(.*?)(''|$)/ + }], + "#heading": [{ + token: [ + "punctuation.definition.heading", + "entity.name.section", + "punctuation.definition.heading" + ], + regex: /(={1,6})(.+?)(\1)(?!=)/ + }], + "#tag": [{ + token: [ + "punctuation.definition.tag.begin", + "entity.name.tag", + "meta.tag.block.ref", + "punctuation.definition.tag.end" + ], + regex: /(<)(ref)((?:\s+.*?)?)(>)/, + caseInsensitive: true, + push: [{ + token: [ + "punctuation.definition.tag.begin", + "entity.name.tag", + "meta.tag.block.ref", + "punctuation.definition.tag.end" + ], + regex: /(<\/)(ref)(\s*)(>)/, + caseInsensitive: true, + next: "pop" + }, { + include: "$self" + }, { + defaultToken: "meta.tag.block.ref" + }] + }, + { + token: [ + "punctuation.definition.tag.begin", + "entity.name.tag", + "meta.tag.block.nowiki", + "punctuation.definition.tag.end" + ], + regex: /(<)(nowiki)((?:\s+.*?)?)(>)/, + caseInsensitive: true, + push: [{ + token: [ + "punctuation.definition.tag.begin", + "entity.name.tag", + "meta.tag.block.nowiki", + "punctuation.definition.tag.end" + ], + regex: /(<\/)(nowiki)(\s*)(>)/, + caseInsensitive: true, + next: "pop" + }, { + defaultToken: "meta.tag.block.nowiki" + }] + }, { + token: [ + "punctuation.definition.tag.begin", + "entity.name.tag" + ], + regex: /(<\/?)(noinclude|includeonly|onlyinclude)(?=\W)/, + caseInsensitive: true, + push: [{ + token: [ + "invalid.illegal", + "punctuation.definition.tag.end" + ], + regex: /((?:\/)?)(>)/, + next: "pop" + }, { + include: "#attribute" + }, { + defaultToken: "meta.tag.block.any" + }] + }, { + token: [ + "punctuation.definition.tag.begin", + "entity.name.tag" + ], + regex: /(<)(br|wbr|hr|meta|link)(?=\W)/, + caseInsensitive: true, + push: [{ + token: "punctuation.definition.tag.end", + regex: /\/?>/, + next: "pop" + }, { + include: "#attribute" + }, { + defaultToken: "meta.tag.other" + }] + }, { + token: [ + "punctuation.definition.tag.begin", + "entity.name.tag" + ], + regex: /(<\/?)(div|center|span|h1|h2|h3|h4|h5|h6|bdo|em|strong|cite|dfn|code|samp|kbd|var|abbr|blockquote|q|sub|sup|p|pre|ins|del|ul|ol|li|dl|dd|dt|table|caption|thead|tfoot|tbody|colgroup|col|tr|td|th|a|img|video|source|track|tt|b|i|big|small|strike|s|u|font|ruby|rb|rp|rt|rtc|math|figure|figcaption|bdi|data|time|mark|html)(?=\W)/, + caseInsensitive: true, + push: [{ + token: [ + "invalid.illegal", + "punctuation.definition.tag.end" + ], + regex: /((?:\/)?)(>)/, + next: "pop" + }, { + include: "#attribute" + }, { + defaultToken: "meta.tag.block" + }] + }, { + token: [ + "punctuation.definition.tag.begin", + "invalid.illegal" + ], + regex: /(<\/)(br|wbr|hr|meta|link)(?=\W)/, + caseInsensitive: true, + push: [{ + token: "punctuation.definition.tag.end", + regex: /\/?>/, + next: "pop" + }, { + include: "#attribute" + }, { + defaultToken: "meta.tag.other" + }] + }], + "#caption": [{ + token: [ + "meta.tag.block.table-caption", + "punctuation.definition.tag.begin" + ], + regex: /^(\s*)(\|\+)/, + push: [{ + token: "meta.tag.block.table-caption", + regex: /$/, + next: "pop" + }, { + defaultToken: "meta.tag.block.table-caption" + }] + }], + "#tr": [{ + token: [ + "meta.tag.block.tr", + "punctuation.definition.tag.begin", + "meta.tag.block.tr", + "invalid.illegal" + ], + regex: /^(\s*)(\|\-)([\s]*)(.*)/ + }], + "#th": [{ + token: [ + "meta.tag.block.th.heading", + "punctuation.definition.tag.begin", + "meta.tag.block.th.heading", + "punctuation.definition.tag", + "markup.bold" + ], + regex: /^(\s*)(!)(?:(.*?)(\|))?(.*?)(?=!!|$)/, + push: [{ + token: "meta.tag.block.th.heading", + regex: /$/, + next: "pop" + }, { + token: [ + "punctuation.definition.tag.begin", + "meta.tag.block.th.inline", + "punctuation.definition.tag", + "markup.bold" + ], + regex: /(!!)(?:(.*?)(\|))?(.*?)(?=!!|$)/ + }, { + include: "$self" + }, { + defaultToken: "meta.tag.block.th.heading" + }] + }], + "#td": [{ + token: [ + "meta.tag.block.td", + "punctuation.definition.tag.begin" + ], + regex: /^(\s*)(\|)/, + push: [{ + token: "meta.tag.block.td", + regex: /$/, + next: "pop" + }, { + include: "$self" + }, { + defaultToken: "meta.tag.block.td" + }] + }], + "#table": [{ + patterns: [{ + name: "meta.tag.block.table", + begin: "^\\s*({\\|)(.*?)$", + end: "^\\s*\\|}", + beginCaptures: { + 1: { + name: "punctuation.definition.tag.begin" + }, + 2: { + patterns: [{ + include: "#attribute" + }] + }, + 3: { + name: "invalid.illegal" + } + }, + endCaptures: { + 0: { + name: "punctuation.definition.tag.end" + } + }, + patterns: [{ + include: "#comment" + }, { + include: "#template" + }, { + include: "#caption" + }, { + include: "#tr" + }, { + include: "#th" + }, { + include: "#td" + }] + }], + repository: { + caption: { + name: "meta.tag.block.table-caption", + begin: "^\\s*(\\|\\+)", + end: "$", + beginCaptures: { + 1: { + name: "punctuation.definition.tag.begin" + } + } + }, + tr: { + name: "meta.tag.block.tr", + match: "^\\s*(\\|\\-)[\\s]*(.*)", + captures: { + 1: { + name: "punctuation.definition.tag.begin" + }, + 2: { + name: "invalid.illegal" + } + } + }, + th: { + name: "meta.tag.block.th.heading", + begin: "^\\s*(!)((.*?)(\\|))?(.*?)(?=(!!)|$)", + end: "$", + beginCaptures: { + 1: { + name: "punctuation.definition.tag.begin" + }, + 3: { + patterns: [{ + include: "#attribute" + }] + }, + 4: { + name: "punctuation.definition.tag" + }, + 5: { + name: "markup.bold" + } + }, + patterns: [{ + name: "meta.tag.block.th.inline", + match: "(!!)((.*?)(\\|))?(.*?)(?=(!!)|$)", + captures: { + 1: { + name: "punctuation.definition.tag.begin" + }, + 3: { + patterns: [{ + include: "#attribute" + }] + }, + 4: { + name: "punctuation.definition.tag" + }, + 5: { + name: "markup.bold" + } + } + }, { + include: "$self" + }] + }, + td: { + name: "meta.tag.block.td", + begin: "^\\s*(\\|)", + end: "$", + beginCaptures: { + 1: { + name: "punctuation.definition.tag.begin" + }, + 2: { + patterns: [{ + include: "#attribute" + }] + }, + 3: { + name: "punctuation.definition.tag" + } + }, + patterns: [{ + include: "$self" + }] + } + } + }], + "#attribute": [{ + include: "#string" + }, { + token: "entity.other.attribute-name", + regex: /\w+/ + }], + "#string": [{ + token: "string.quoted.double", + regex: /\"/, + push: [{ + token: "string.quoted.double", + regex: /\"/, + next: "pop" + }, { + defaultToken: "string.quoted.double" + }] + }, { + token: "string.quoted.single", + regex: /\'/, + push: [{ + token: "string.quoted.single", + regex: /\'/, + next: "pop" + }, { + defaultToken: "string.quoted.single" + }] + }], + "#url": [{ + token: "markup.underline.link", + regex: /(?:http(?:s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:\/?#\[\]@!\$&'\(\)\*\+,;=.]+/ + }, { + token: "invalid.illegal", + regex: /.*/ + }] + }; + + + this.normalizeRules(); +}; + +MediaWikiHighlightRules.metaData = { + name: "MediaWiki", + scopeName: "text.html.mediawiki", + fileTypes: ["mediawiki", "wiki"] +}; + + +oop.inherits(MediaWikiHighlightRules, TextHighlightRules); + +exports.MediaWikiHighlightRules = MediaWikiHighlightRules; +}); + +define("ace/mode/mediawiki",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/mediawiki_highlight_rules"], function(require, exports, module) { +"use strict"; + +var oop = require("../lib/oop"); +var TextMode = require("./text").Mode; +var MediaWikiHighlightRules = require("./mediawiki_highlight_rules").MediaWikiHighlightRules; + +var Mode = function() { + this.HighlightRules = MediaWikiHighlightRules; +}; +oop.inherits(Mode, TextMode); + +(function() { + this.type = "text"; + this.blockComment = {start: ""}; + this.$id = "ace/mode/mediawiki"; +}).call(Mode.prototype); + +exports.Mode = Mode; +}); (function() { + window.require(["ace/mode/mediawiki"], function(m) { + if (typeof module == "object" && typeof exports == "object" && module) { + module.exports = m; + } + }); + })(); + \ No newline at end of file diff --git a/htdocs/includes/ace/src/mode-mips.js b/htdocs/includes/ace/src/mode-mips.js new file mode 100644 index 00000000000..4d28b88d676 --- /dev/null +++ b/htdocs/includes/ace/src/mode-mips.js @@ -0,0 +1,264 @@ +define("ace/mode/mips_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) { +"use strict"; + +var oop = require("../lib/oop"); +var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; + +var MIPSHighlightRules = function() { + + var escapeRe = /\\(?:['"?\\abfnrtv]|[0-7]{1,3}|x[a-fA-F\d]{2}|u[a-fA-F\d]{4}U[a-fA-F\d]{8}|.)/.source; + + this.$rules = { + start: [{ + token: "storage.modifier.mips", + regex: /\.\b(?:align|ascii|asciiz|byte|double|extern|float|globl|space|word)\b/, + comment: "Assembler directives for data storage" + }, { + token: "entity.name.section.mips", + regex: /\.\b(?:data|text|kdata|ktext|)\b/, + comment: "Segements: .data .text" + }, { + token: "variable.parameter.mips", + regex: /\$(?:(?:3[01]|[12]?[0-9]|[0-9])|zero|at|v[01]|a[0-3]|s[0-7]|t[0-9]|k[01]|gp|sp|fp|ra)/, + comment: "Registers by id $1, $2, ..." + }, { + token: "variable.parameter.mips", + regex: /\$f(?:[0-9]|[1-2][0-9]|3[0-1])/, + comment: "Floating point registers" + }, { + token: "support.function.source.mips", + regex: /\b(?:(?:add|sub|div|l|mov|mult|neg|s|c\.eq|c\.le|c\.lt)\.[ds]|cvt\.s\.[dw]|cvt\.d\.[sw]|cvt\.w\.[ds]|bc1[tf])\b/, + comment: "The MIPS floating-point instruction set" + }, { + token: "support.function.source.mips", + regex: /\b(?:add|addu|addi|addiu|sub|subu|and|andi|or|not|ori|nor|xor|xori|slt|sltu|slti|sltiu|sll|sllv|rol|srl|sra|srlv|ror|j|jr|jal|beq|bne|lw|sw|lb|sb|lui|move|mfhi|mflo|mthi|mtlo)\b/, + comment: "Just the hardcoded instructions provided by the MIPS assembly language" + }, { + token: "support.function.other.mips", + regex: /\b(?:abs|b|beqz|bge|bgt|bgtu|ble|bleu|blt|bltu|bnez|div|divu|la|li|move|mul|neg|not|rem|remu|seq|sge|sgt|sle|sne)\b/, + comment: "Pseudo instructions" + }, { + token: "entity.name.function.mips", + regex: /\bsyscall\b/, + comment: "Other" + }, { + token : "string", // character + regex : "(?:'\")(?:" + escapeRe + "|.)?(?:'\")" + }, { + token : "string.start", + regex : '\'', + stateName: "qstring", + next: [ + { token: "string", regex: /\\\s*$/, next: "qqstring" }, + { token: "constant.language.escape", regex: escapeRe }, + { token: "string.end", regex: '\'|$', next: "start" }, + { defaultToken: "string"} + ] + }, { + token : "string.start", + regex : '"', + stateName: "qqstring", + next: [ + { token: "string", regex: /\\\s*$/, next: "qqstring" }, + { token: "constant.language.escape", regex: escapeRe }, + { token: "string.end", regex: '"|$', next: "start" }, + { defaultToken: "string"} + ] + }, { + token: "constant.numeric.mips", + regex: /\b(?:\d+|0(?:x|X)[a-fA-F0-9]+)\b/, + comment: "Numbers like +12, -3, 55, 0x3F" + }, { + token: "entity.name.tag.mips", + regex: /\b[\w]+\b:/, + comment: "Labels at line start: begin_repeat: add ..." + }, { + token: "comment.assembly", + regex: /#.*$/, + comment: "Single line comments" + }] + }; + + this.normalizeRules(); +}; + +MIPSHighlightRules.metaData = { + fileTypes: ["s", "asm"], + name: "MIPS", + scopeName: "source.mips" +}; + + +oop.inherits(MIPSHighlightRules, TextHighlightRules); + +exports.MIPSHighlightRules = MIPSHighlightRules; +}); + +define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) { +"use strict"; + +var oop = require("../../lib/oop"); +var Range = require("../../range").Range; +var BaseFoldMode = require("./fold_mode").FoldMode; + +var FoldMode = exports.FoldMode = function(commentRegex) { + if (commentRegex) { + this.foldingStartMarker = new RegExp( + this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start) + ); + this.foldingStopMarker = new RegExp( + this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end) + ); + } +}; +oop.inherits(FoldMode, BaseFoldMode); + +(function() { + + this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/; + this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/; + this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/; + this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/; + this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/; + this._getFoldWidgetBase = this.getFoldWidget; + this.getFoldWidget = function(session, foldStyle, row) { + var line = session.getLine(row); + + if (this.singleLineBlockCommentRe.test(line)) { + if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line)) + return ""; + } + + var fw = this._getFoldWidgetBase(session, foldStyle, row); + + if (!fw && this.startRegionRe.test(line)) + return "start"; // lineCommentRegionStart + + return fw; + }; + + this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) { + var line = session.getLine(row); + + if (this.startRegionRe.test(line)) + return this.getCommentRegionBlock(session, line, row); + + var match = line.match(this.foldingStartMarker); + if (match) { + var i = match.index; + + if (match[1]) + return this.openingBracketBlock(session, match[1], row, i); + + var range = session.getCommentFoldRange(row, i + match[0].length, 1); + + if (range && !range.isMultiLine()) { + if (forceMultiline) { + range = this.getSectionRange(session, row); + } else if (foldStyle != "all") + range = null; + } + + return range; + } + + if (foldStyle === "markbegin") + return; + + var match = line.match(this.foldingStopMarker); + if (match) { + var i = match.index + match[0].length; + + if (match[1]) + return this.closingBracketBlock(session, match[1], row, i); + + return session.getCommentFoldRange(row, i, -1); + } + }; + + this.getSectionRange = function(session, row) { + var line = session.getLine(row); + var startIndent = line.search(/\S/); + var startRow = row; + var startColumn = line.length; + row = row + 1; + var endRow = row; + var maxRow = session.getLength(); + while (++row < maxRow) { + line = session.getLine(row); + var indent = line.search(/\S/); + if (indent === -1) + continue; + if (startIndent > indent) + break; + var subRange = this.getFoldWidgetRange(session, "all", row); + + if (subRange) { + if (subRange.start.row <= startRow) { + break; + } else if (subRange.isMultiLine()) { + row = subRange.end.row; + } else if (startIndent == indent) { + break; + } + } + endRow = row; + } + + return new Range(startRow, startColumn, endRow, session.getLine(endRow).length); + }; + this.getCommentRegionBlock = function(session, line, row) { + var startColumn = line.search(/\s*$/); + var maxRow = session.getLength(); + var startRow = row; + + var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/; + var depth = 1; + while (++row < maxRow) { + line = session.getLine(row); + var m = re.exec(line); + if (!m) continue; + if (m[1]) depth--; + else depth++; + + if (!depth) break; + } + + var endRow = row; + if (endRow > startRow) { + return new Range(startRow, startColumn, endRow, line.length); + } + }; + +}).call(FoldMode.prototype); + +}); + +define("ace/mode/mips",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/mips_highlight_rules","ace/mode/folding/cstyle"], function(require, exports, module) { +"use strict"; + +var oop = require("../lib/oop"); +var TextMode = require("./text").Mode; +var MIPSHighlightRules = require("./mips_highlight_rules").MIPSHighlightRules; +var FoldMode = require("./folding/cstyle").FoldMode; + +var Mode = function() { + this.HighlightRules = MIPSHighlightRules; + this.foldingRules = new FoldMode(); +}; +oop.inherits(Mode, TextMode); + +(function() { + this.lineCommentStart = ["#"]; + this.$id = "ace/mode/mips"; +}).call(Mode.prototype); + +exports.Mode = Mode; +}); (function() { + window.require(["ace/mode/mips"], function(m) { + if (typeof module == "object" && typeof exports == "object" && module) { + module.exports = m; + } + }); + })(); + \ No newline at end of file diff --git a/htdocs/includes/ace/src/mode-nix.js b/htdocs/includes/ace/src/mode-nix.js index b1a426fb9b3..d5698eb141b 100644 --- a/htdocs/includes/ace/src/mode-nix.js +++ b/htdocs/includes/ace/src/mode-nix.js @@ -65,7 +65,7 @@ var c_cppHighlightRules = function() { var storageType = ( "asm|__asm__|auto|bool|_Bool|char|_Complex|double|enum|float|" + - "_Imaginary|int|long|short|signed|struct|typedef|union|unsigned|void|" + + "_Imaginary|int|int8_t|int16_t|int32_t|int64_t|long|short|signed|size_t|struct|typedef|uint8_t|uint16_t|uint32_t|uint64_t|union|unsigned|void|" + "class|wchar_t|template|char16_t|char32_t" ); @@ -489,6 +489,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/c_cpp"; + this.snippetFileId = "ace/snippets/c_cpp"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-nsis.js b/htdocs/includes/ace/src/mode-nsis.js index 67c2abec063..10816422adf 100644 --- a/htdocs/includes/ace/src/mode-nsis.js +++ b/htdocs/includes/ace/src/mode-nsis.js @@ -13,7 +13,7 @@ var NSISHighlightRules = function() { caseInsensitive: true }, { token: "keyword.command.nsis", - regex: /^\s*(?:Abort|AddBrandingImage|AddSize|AllowRootDirInstall|AllowSkipFiles|AutoCloseWindow|BGFont|BGGradient|BrandingText|BringToFront|Call|CallInstDLL|Caption|ChangeUI|CheckBitmap|ClearErrors|CompletedText|ComponentText|CopyFiles|CRCCheck|CreateDirectory|CreateFont|CreateShortCut|Delete|DeleteINISec|DeleteINIStr|DeleteRegKey|DeleteRegValue|DetailPrint|DetailsButtonText|DirText|DirVar|DirVerify|EnableWindow|EnumRegKey|EnumRegValue|Exch|Exec|ExecShell|ExecShellWait|ExecWait|ExpandEnvStrings|File|FileBufSize|FileClose|FileErrorText|FileOpen|FileRead|FileReadByte|FileReadUTF16LE|FileReadWord|FileWriteUTF16LE|FileSeek|FileWrite|FileWriteByte|FileWriteWord|FindClose|FindFirst|FindNext|FindWindow|FlushINI|GetCurInstType|GetCurrentAddress|GetDlgItem|GetDLLVersion|GetDLLVersionLocal|GetErrorLevel|GetFileTime|GetFileTimeLocal|GetFullPathName|GetFunctionAddress|GetInstDirError|GetLabelAddress|GetTempFileName|Goto|HideWindow|Icon|IfAbort|IfErrors|IfFileExists|IfRebootFlag|IfSilent|InitPluginsDir|InstallButtonText|InstallColors|InstallDir|InstallDirRegKey|InstProgressFlags|InstType|InstTypeGetText|InstTypeSetText|Int64Cmp|Int64CmpU|Int64Fmt|IntCmp|IntCmpU|IntFmt|IntOp|IntPtrCmp|IntPtrCmpU|IntPtrOp|IsWindow|LangString|LicenseBkColor|LicenseData|LicenseForceSelection|LicenseLangString|LicenseText|LoadAndSetImage|LoadLanguageFile|LockWindow|LogSet|LogText|ManifestDPIAware|ManifestLongPathAware|ManifestMaxVersionTested|ManifestSupportedOS|MessageBox|MiscButtonText|Name|Nop|OutFile|Page|PageCallbacks|PEAddResource|PEDllCharacteristics|PERemoveResource|PESubsysVer|Pop|Push|Quit|ReadEnvStr|ReadINIStr|ReadRegDWORD|ReadRegStr|Reboot|RegDLL|Rename|RequestExecutionLevel|ReserveFile|Return|RMDir|SearchPath|SectionGetFlags|SectionGetInstTypes|SectionGetSize|SectionGetText|SectionIn|SectionSetFlags|SectionSetInstTypes|SectionSetSize|SectionSetText|SendMessage|SetAutoClose|SetBrandingImage|SetCompress|SetCompressor|SetCompressorDictSize|SetCtlColors|SetCurInstType|SetDatablockOptimize|SetDateSave|SetDetailsPrint|SetDetailsView|SetErrorLevel|SetErrors|SetFileAttributes|SetFont|SetOutPath|SetOverwrite|SetRebootFlag|SetRegView|SetShellVarContext|SetSilent|ShowInstDetails|ShowUninstDetails|ShowWindow|SilentInstall|SilentUnInstall|Sleep|SpaceTexts|StrCmp|StrCmpS|StrCpy|StrLen|SubCaption|Unicode|UninstallButtonText|UninstallCaption|UninstallIcon|UninstallSubCaption|UninstallText|UninstPage|UnRegDLL|Var|VIAddVersionKey|VIFileVersion|VIProductVersion|WindowIcon|WriteINIStr|WriteRegBin|WriteRegDWORD|WriteRegExpandStr|WriteRegMultiStr|WriteRegNone|WriteRegStr|WriteUninstaller|XPStyle)\b/, + regex: /^\s*(?:Abort|AddBrandingImage|AddSize|AllowRootDirInstall|AllowSkipFiles|AutoCloseWindow|BGFont|BGGradient|BrandingText|BringToFront|Call|CallInstDLL|Caption|ChangeUI|CheckBitmap|ClearErrors|CompletedText|ComponentText|CopyFiles|CRCCheck|CreateDirectory|CreateFont|CreateShortCut|Delete|DeleteINISec|DeleteINIStr|DeleteRegKey|DeleteRegValue|DetailPrint|DetailsButtonText|DirText|DirVar|DirVerify|EnableWindow|EnumRegKey|EnumRegValue|Exch|Exec|ExecShell|ExecShellWait|ExecWait|ExpandEnvStrings|File|FileBufSize|FileClose|FileErrorText|FileOpen|FileRead|FileReadByte|FileReadUTF16LE|FileReadWord|FileWriteUTF16LE|FileSeek|FileWrite|FileWriteByte|FileWriteWord|FindClose|FindFirst|FindNext|FindWindow|FlushINI|GetCurInstType|GetCurrentAddress|GetDlgItem|GetDLLVersion|GetDLLVersionLocal|GetErrorLevel|GetFileTime|GetFileTimeLocal|GetFullPathName|GetFunctionAddress|GetInstDirError|GetKnownFolderPath|GetLabelAddress|GetTempFileName|Goto|HideWindow|Icon|IfAbort|IfErrors|IfFileExists|IfRebootFlag|IfRtlLanguage|IfShellVarContextAll|IfSilent|InitPluginsDir|InstallButtonText|InstallColors|InstallDir|InstallDirRegKey|InstProgressFlags|InstType|InstTypeGetText|InstTypeSetText|Int64Cmp|Int64CmpU|Int64Fmt|IntCmp|IntCmpU|IntFmt|IntOp|IntPtrCmp|IntPtrCmpU|IntPtrOp|IsWindow|LangString|LicenseBkColor|LicenseData|LicenseForceSelection|LicenseLangString|LicenseText|LoadAndSetImage|LoadLanguageFile|LockWindow|LogSet|LogText|ManifestDPIAware|ManifestLongPathAware|ManifestMaxVersionTested|ManifestSupportedOS|MessageBox|MiscButtonText|Name|Nop|OutFile|Page|PageCallbacks|PEAddResource|PEDllCharacteristics|PERemoveResource|PESubsysVer|Pop|Push|Quit|ReadEnvStr|ReadINIStr|ReadRegDWORD|ReadRegStr|Reboot|RegDLL|Rename|RequestExecutionLevel|ReserveFile|Return|RMDir|SearchPath|SectionGetFlags|SectionGetInstTypes|SectionGetSize|SectionGetText|SectionIn|SectionSetFlags|SectionSetInstTypes|SectionSetSize|SectionSetText|SendMessage|SetAutoClose|SetBrandingImage|SetCompress|SetCompressor|SetCompressorDictSize|SetCtlColors|SetCurInstType|SetDatablockOptimize|SetDateSave|SetDetailsPrint|SetDetailsView|SetErrorLevel|SetErrors|SetFileAttributes|SetFont|SetOutPath|SetOverwrite|SetRebootFlag|SetRegView|SetShellVarContext|SetSilent|ShowInstDetails|ShowUninstDetails|ShowWindow|SilentInstall|SilentUnInstall|Sleep|SpaceTexts|StrCmp|StrCmpS|StrCpy|StrLen|SubCaption|Unicode|UninstallButtonText|UninstallCaption|UninstallIcon|UninstallSubCaption|UninstallText|UninstPage|UnRegDLL|Var|VIAddVersionKey|VIFileVersion|VIProductVersion|WindowIcon|WriteINIStr|WriteRegBin|WriteRegDWORD|WriteRegExpandStr|WriteRegMultiStr|WriteRegNone|WriteRegStr|WriteUninstaller|XPStyle)\b/, caseInsensitive: true }, { token: "keyword.control.nsis", diff --git a/htdocs/includes/ace/src/mode-nunjucks.js b/htdocs/includes/ace/src/mode-nunjucks.js index 57f1e9f32bb..c59a814e67d 100644 --- a/htdocs/includes/ace/src/mode-nunjucks.js +++ b/htdocs/includes/ace/src/mode-nunjucks.js @@ -784,6 +784,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/javascript"; + this.snippetFileId = "ace/snippets/javascript"; }).call(Mode.prototype); exports.Mode = Mode; @@ -1316,6 +1317,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/css"; + this.snippetFileId = "ace/snippets/css"; }).call(Mode.prototype); exports.Mode = Mode; @@ -2493,6 +2495,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/html"; + this.snippetFileId = "ace/snippets/html"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-objectivec.js b/htdocs/includes/ace/src/mode-objectivec.js index 28a56917f03..0a2dbd08fba 100644 --- a/htdocs/includes/ace/src/mode-objectivec.js +++ b/htdocs/includes/ace/src/mode-objectivec.js @@ -65,7 +65,7 @@ var c_cppHighlightRules = function() { var storageType = ( "asm|__asm__|auto|bool|_Bool|char|_Complex|double|enum|float|" + - "_Imaginary|int|long|short|signed|struct|typedef|union|unsigned|void|" + + "_Imaginary|int|int8_t|int16_t|int32_t|int64_t|long|short|signed|size_t|struct|typedef|uint8_t|uint16_t|uint32_t|uint64_t|union|unsigned|void|" + "class|wchar_t|template|char16_t|char32_t" ); diff --git a/htdocs/includes/ace/src/mode-perl.js b/htdocs/includes/ace/src/mode-perl.js index 978979b1e47..bc8d178c968 100644 --- a/htdocs/includes/ace/src/mode-perl.js +++ b/htdocs/includes/ace/src/mode-perl.js @@ -367,6 +367,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/perl"; + this.snippetFileId = "ace/snippets/perl"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-pgsql.js b/htdocs/includes/ace/src/mode-pgsql.js index 952319ef862..069b750eab6 100644 --- a/htdocs/includes/ace/src/mode-pgsql.js +++ b/htdocs/includes/ace/src/mode-pgsql.js @@ -526,10 +526,10 @@ var PythonHighlightRules = function() { regex: "\\s+" }, { token: "string", - regex: "'(.)*'" + regex: "'[^']*'" }, { token: "string", - regex: '"(.)*"' + regex: '"[^"]*"' }, { token: "function.support", regex: "(!s|!r|!a)" diff --git a/htdocs/includes/ace/src/mode-php.js b/htdocs/includes/ace/src/mode-php.js index b9acd2c8073..7db8bf2c7bd 100644 --- a/htdocs/includes/ace/src/mode-php.js +++ b/htdocs/includes/ace/src/mode-php.js @@ -2138,15 +2138,15 @@ var functionMap = { "Escapes single quote, double quotes and backslash characters in a string with backslashes" ], "apache_child_terminate": [ - "bool apache_child_terminate(void)", + "bool apache_child_terminate()", "Terminate apache process after this request" ], "apache_get_modules": [ - "array apache_get_modules(void)", + "array apache_get_modules()", "Get a list of loaded Apache modules" ], "apache_get_version": [ - "string apache_get_version(void)", + "string apache_get_version()", "Fetch Apache version" ], "apache_getenv": [ @@ -2178,7 +2178,7 @@ var functionMap = { "* fetch all headers that go out in case of an error or a subrequest" ], "apache_request_headers": [ - "array apache_request_headers(void)", + "array apache_request_headers()", "Fetch all HTTP request headers" ], "apache_request_headers_in": [ @@ -2194,7 +2194,7 @@ var functionMap = { "" ], "apache_request_log_error": [ - "boolean apache_request_log_error(string message, [long facility])", + "bool apache_request_log_error(string message, [long facility])", "" ], "apache_request_meets_conditions": [ @@ -2246,11 +2246,11 @@ var functionMap = { "" ], "apache_reset_timeout": [ - "bool apache_reset_timeout(void)", + "bool apache_reset_timeout()", "Reset the Apache write timer" ], "apache_response_headers": [ - "array apache_response_headers(void)", + "array apache_response_headers()", "Fetch all HTTP response headers" ], "apache_setenv": [ @@ -2337,6 +2337,14 @@ var functionMap = { "array array_keys(array input [, mixed search_value[, bool strict]])", "Return just the keys from the input array, optionally only for the specified search_value" ], + "array_key_first": [ + "mixed array_key_first(array arr)", + "Returns the first key of arr if the array is not empty; NULL otherwise" + ], + "array_key_last": [ + "mixed array_key_last(array arr)", + "Returns the last key of arr if the array is not empty; NULL otherwise" + ], "array_map": [ "array array_map(mixed callback, array input1 [, array input2 ,...])", "Applies the callback to the elements in given arrays." @@ -2694,7 +2702,7 @@ var functionMap = { "Change file mode" ], "chown": [ - "bool chown (string filename, mixed user)", + "bool chown(string filename, mixed user)", "Change file owner" ], "chr": [ @@ -2722,7 +2730,7 @@ var functionMap = { "Return all classes and interfaces implemented by SPL" ], "class_parents": [ - "array class_parents(object instance [, boolean autoload = true])", + "array class_parents(object instance [, bool autoload = true])", "Return an array containing the names of all parent classes" ], "clearstatcache": [ @@ -2734,7 +2742,7 @@ var functionMap = { "Close directory connection identified by the dir_handle" ], "closelog": [ - "bool closelog(void)", + "bool closelog()", "Close connection to system logger" ], "collator_asort": [ @@ -2826,11 +2834,11 @@ var functionMap = { "Return a string to confirm that the module is compiled in" ], "connection_aborted": [ - "int connection_aborted(void)", + "int connection_aborted()", "Returns true if client disconnected" ], "connection_status": [ - "int connection_status(void)", + "int connection_status()", "Returns the connection status bitfield" ], "constant": [ @@ -2875,7 +2883,7 @@ var functionMap = { ], "create_function": [ "string create_function(string args, string code)", - "Creates an anonymous function, and returns its name (funny, eh?)" + "Creates an anonymous function, and returns its name" ], "crypt": [ "string crypt(string str [, string salt])", @@ -2974,7 +2982,7 @@ var functionMap = { "Get information about the current transfers" ], "curl_multi_init": [ - "resource curl_multi_init(void)", + "resource curl_multi_init()", "Returns a new cURL multi handle" ], "curl_multi_remove_handle": [ @@ -3170,7 +3178,7 @@ var functionMap = { "* Set formatter pattern." ], "datefmt_set_timezone_id": [ - "boolean datefmt_set_timezone_id( IntlDateFormatter $mf,$timezone_id)", + "bool datefmt_set_timezone_id( IntlDateFormatter $mf,$timezone_id)", "* Set formatter timezone_id." ], "dba_close": [ @@ -3238,7 +3246,7 @@ var functionMap = { "Return the translation of msgid for domain_name and category, or msgid unaltered if a translation does not exist" ], "dcngettext": [ - "string dcngettext (string domain, string msgid1, string msgid2, int n, int category)", + "string dcngettext(string domain, string msgid1, string msgid2, int n, int category)", "Plural version of dcgettext()" ], "debug_backtrace": [ @@ -3246,44 +3254,231 @@ var functionMap = { "Return backtrace as array" ], "debug_print_backtrace": [ - "void debug_print_backtrace(void) */", - "ZEND_FUNCTION(debug_print_backtrace) { zend_execute_data *ptr, *skip; int lineno; char *function_name; char *filename; char *class_name = NULL; char *call_type; char *include_filename = NULL; zval *arg_array = NULL; int indent = 0; if (zend_parse_parameters_none() == FAILURE) { return; } ptr = EG(current_execute_data);", + "void debug_print_backtrace()", + "Prints a PHP backtrace" + ], + "debug_zval_dump": [ + "void debug_zval_dump(mixed var)", + "Dumps a string representation of an internal Zend value to output" + ], + "decbin": [ + "string decbin(int decimal_number)", + "Returns a string containing a binary representation of the number" + ], + "dechex": [ + "string dechex(int decimal_number)", + "Returns a string containing a hexadecimal representation of the given number" + ], + "decoct": [ + "string decoct(int decimal_number)", + "Returns a string containing an octal representation of the given number" + ], + "define": [ + "bool define(string constant_name, mixed value, bool case_insensitive=false)", + "Define a new constant" + ], + "define_syslog_variables": [ + "void define_syslog_variables()", + "Initializes all syslog-related variables" + ], + "defined": [ + "bool defined(string constant_name)", + "Check whether a constant exists" + ], + "deg2rad": [ + "float deg2rad(float number)", + "Converts the number in degrees to the radian equivalent" + ], + "dgettext": [ + "string dgettext(string domain_name, string msgid)", + "Return the translation of msgid for domain_name, or msgid unaltered if a translation does not exist" + ], + "die": [ + "void die([mixed status])", + "Output a message and terminate the current script" + ], + "dir": [ + "object dir(string directory[, resource context])", + "Directory class with properties, handle and class and methods read, rewind and close" + ], + "dirname": [ + "string dirname(string path)", + "Returns the directory name component of the path" + ], + "disk_free_space": [ + "float disk_free_space(string path)", + "Get free disk space for filesystem that path is on" + ], + "disk_total_space": [ + "float disk_total_space(string path)", + "Get total disk space for filesystem that path is on" + ], + "display_disabled_function": [ + "void display_disabled_function()", + "Dummy function which displays an error when a disabled function is called." + ], + "dl": [ + "int dl(string extension_filename)", + "Load a PHP extension at runtime" + ], + "dngettext": [ + "string dngettext(string domain, string msgid1, string msgid2, int count)", + "Plural version of dgettext()" + ], + "dns_check_record": [ + "bool dns_check_record(string host [, string type])", + "Check DNS records corresponding to a given Internet host name or IP address" + ], + "dns_get_mx": [ + "bool dns_get_mx(string hostname, array mxhosts [, array weight])", + "Get MX records corresponding to a given Internet host name" + ], + "dns_get_record": [ + "array|false dns_get_record(string hostname [, int type[, array authns, array addtl]])", + "Get any Resource Record corresponding to a given Internet host name" + ], + "dom_attr_is_id": [ + "bool dom_attr_is_id()", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Attr-isId Since: DOM Level 3" + ], + "dom_characterdata_append_data": [ + "void dom_characterdata_append_data(string arg)", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-32791A2F Since:" + ], + "dom_characterdata_delete_data": [ + "void dom_characterdata_delete_data(int offset, int count)", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-7C603781 Since:" + ], + "dom_characterdata_insert_data": [ + "void dom_characterdata_insert_data(int offset, string arg)", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-3EDB695F Since:" + ], + "dom_characterdata_replace_data": [ + "void dom_characterdata_replace_data(int offset, int count, string arg)", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-E5CBA7FB Since:" + ], + "dom_characterdata_substring_data": [ + "string dom_characterdata_substring_data(int offset, int count)", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-6531BCCF Since:" + ], + "dom_document_adopt_node": [ + "DOMNode dom_document_adopt_node(DOMNode source)", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Document3-adoptNode Since: DOM Level 3" + ], + "dom_document_create_attribute": [ + "DOMAttr dom_document_create_attribute(string name)", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1084891198 Since:" + ], + "dom_document_create_attribute_ns": [ + "DOMAttr dom_document_create_attribute_ns(string namespaceURI, string qualifiedName)", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-DocCrAttrNS Since: DOM Level 2" + ], + "dom_document_create_cdatasection": [ + "DOMCdataSection dom_document_create_cdatasection(string data)", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-D26C0AF8 Since:" + ], + "dom_document_create_comment": [ + "DOMComment dom_document_create_comment(string data)", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1334481328 Since:" + ], + "dom_document_create_document_fragment": [ + "DOMDocumentFragment dom_document_create_document_fragment()", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-35CB04B5 Since:" + ], + "dom_document_create_element": [ + "DOMElement dom_document_create_element(string tagName [, string value])", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-2141741547 Since:" + ], + "dom_document_create_element_ns": [ + "DOMElement dom_document_create_element_ns(string namespaceURI, string qualifiedName [,string value])", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-DocCrElNS Since: DOM Level 2" + ], + "dom_document_create_entity_reference": [ + "DOMEntityReference dom_document_create_entity_reference(string name)", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-392B75AE Since:" + ], + "dom_document_create_processing_instruction": [ + "DOMProcessingInstruction dom_document_create_processing_instruction(string target, string data)", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-135944439 Since:" + ], + "dom_document_create_text_node": [ + "DOMText dom_document_create_text_node(string data)", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1975348127 Since:" + ], + "dom_document_get_element_by_id": [ + "DOMElement dom_document_get_element_by_id(string elementId)", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-getElBId Since: DOM Level 2" + ], + "dom_document_get_elements_by_tag_name": [ + "DOMNodeList dom_document_get_elements_by_tag_name(string tagname)", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-A6C9094 Since:" + ], + "dom_document_get_elements_by_tag_name_ns": [ + "DOMNodeList dom_document_get_elements_by_tag_name_ns(string namespaceURI, string localName)", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-getElBTNNS Since: DOM Level 2" + ], + "dom_document_import_node": [ + "DOMNode dom_document_import_node(DOMNode importedNode, bool deep)", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Core-Document-importNode Since: DOM Level 2" + ], + "dom_document_load": [ + "DOMNode dom_document_load(string source [, int options])", + "URL: http://www.w3.org/TR/DOM-Level-3-LS/load-save.html#LS-DocumentLS-load Since: DOM Level 3" + ], + "dom_document_load_html": [ + "DOMNode dom_document_load_html(string source)", + "Since: DOM extended" + ], + "dom_document_load_html_file": [ + "DOMNode dom_document_load_html_file(string source)", + "Since: DOM extended" + ], + "dom_document_loadxml": [ + "DOMNode dom_document_loadxml(string source [, int options])", + "URL: http://www.w3.org/TR/DOM-Level-3-LS/load-save.html#LS-DocumentLS-loadXML Since: DOM Level 3" + ], + "dom_document_normalize_document": [ + "void dom_document_normalize_document()", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Document3-normalizeDocument Since: DOM Level 3" + ], + "dom_document_relaxNG_validate_file": [ + "bool dom_document_relaxNG_validate_file(string filename); */", "PHP_FUNCTION(dom_document_relaxNG_validate_file) { _dom_document_relaxNG_validate(INTERNAL_FUNCTION_PARAM_PASSTHRU, DOM_LOAD_FILE); } /* }}} end dom_document_relaxNG_validate_file" ], "dom_document_relaxNG_validate_xml": [ - "boolean dom_document_relaxNG_validate_xml(string source); */", + "bool dom_document_relaxNG_validate_xml(string source); */", "PHP_FUNCTION(dom_document_relaxNG_validate_xml) { _dom_document_relaxNG_validate(INTERNAL_FUNCTION_PARAM_PASSTHRU, DOM_LOAD_STRING); } /* }}} end dom_document_relaxNG_validate_xml" ], "dom_document_rename_node": [ - "DOMNode dom_document_rename_node(node n, string namespaceURI, string qualifiedName);", + "DOMNode dom_document_rename_node(node n, string namespaceURI, string qualifiedName)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Document3-renameNode Since: DOM Level 3" ], "dom_document_save": [ - "int dom_document_save(string file);", + "int dom_document_save(string file)", "Convenience method to save to file" ], "dom_document_save_html": [ - "string dom_document_save_html();", + "string dom_document_save_html()", "Convenience method to output as html" ], "dom_document_save_html_file": [ - "int dom_document_save_html_file(string file);", + "int dom_document_save_html_file(string file)", "Convenience method to save to file as html" ], "dom_document_savexml": [ - "string dom_document_savexml([node n]);", + "string dom_document_savexml([node n])", "URL: http://www.w3.org/TR/DOM-Level-3-LS/load-save.html#LS-DocumentLS-saveXML Since: DOM Level 3" ], "dom_document_schema_validate": [ - "boolean dom_document_schema_validate(string source); */", + "bool dom_document_schema_validate(string source); */", "PHP_FUNCTION(dom_document_schema_validate_xml) { _dom_document_schema_validate(INTERNAL_FUNCTION_PARAM_PASSTHRU, DOM_LOAD_STRING); } /* }}} end dom_document_schema_validate" ], "dom_document_schema_validate_file": [ - "boolean dom_document_schema_validate_file(string filename); */", + "bool dom_document_schema_validate_file(string filename); */", "PHP_FUNCTION(dom_document_schema_validate_file) { _dom_document_schema_validate(INTERNAL_FUNCTION_PARAM_PASSTHRU, DOM_LOAD_FILE); } /* }}} end dom_document_schema_validate_file" ], "dom_document_validate": [ - "boolean dom_document_validate();", + "bool dom_document_validate()", "Since: DOM extended" ], "dom_document_xinclude": [ @@ -3291,123 +3486,123 @@ var functionMap = { "Substitutues xincludes in a DomDocument" ], "dom_domconfiguration_can_set_parameter": [ - "boolean dom_domconfiguration_can_set_parameter(string name, domuserdata value);", + "bool dom_domconfiguration_can_set_parameter(string name, domuserdata value)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#DOMConfiguration-canSetParameter Since:" ], "dom_domconfiguration_get_parameter": [ - "domdomuserdata dom_domconfiguration_get_parameter(string name);", + "domdomuserdata dom_domconfiguration_get_parameter(string name)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#DOMConfiguration-getParameter Since:" ], "dom_domconfiguration_set_parameter": [ - "dom_void dom_domconfiguration_set_parameter(string name, domuserdata value);", + "dom_void dom_domconfiguration_set_parameter(string name, domuserdata value)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#DOMConfiguration-property Since:" ], "dom_domerrorhandler_handle_error": [ - "dom_boolean dom_domerrorhandler_handle_error(domerror error);", + "dom_bool dom_domerrorhandler_handle_error(domerror error)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-ERRORS-DOMErrorHandler-handleError Since:" ], "dom_domimplementation_create_document": [ - "DOMDocument dom_domimplementation_create_document(string namespaceURI, string qualifiedName, DOMDocumentType doctype);", + "DOMDocument dom_domimplementation_create_document(string namespaceURI, string qualifiedName, DOMDocumentType doctype)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Level-2-Core-DOM-createDocument Since: DOM Level 2" ], "dom_domimplementation_create_document_type": [ - "DOMDocumentType dom_domimplementation_create_document_type(string qualifiedName, string publicId, string systemId);", + "DOMDocumentType dom_domimplementation_create_document_type(string qualifiedName, string publicId, string systemId)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Level-2-Core-DOM-createDocType Since: DOM Level 2" ], "dom_domimplementation_get_feature": [ - "DOMNode dom_domimplementation_get_feature(string feature, string version);", + "DOMNode dom_domimplementation_get_feature(string feature, string version)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#DOMImplementation3-getFeature Since: DOM Level 3" ], "dom_domimplementation_has_feature": [ - "boolean dom_domimplementation_has_feature(string feature, string version);", + "bool dom_domimplementation_has_feature(string feature, string version)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-5CED94D7 Since:" ], "dom_domimplementationlist_item": [ - "domdomimplementation dom_domimplementationlist_item(int index);", + "domdomimplementation dom_domimplementationlist_item(int index)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#DOMImplementationList-item Since:" ], "dom_domimplementationsource_get_domimplementation": [ - "domdomimplementation dom_domimplementationsource_get_domimplementation(string features);", + "domdomimplementation dom_domimplementationsource_get_domimplementation(string features)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-getDOMImpl Since:" ], "dom_domimplementationsource_get_domimplementations": [ - "domimplementationlist dom_domimplementationsource_get_domimplementations(string features);", + "domimplementationlist dom_domimplementationsource_get_domimplementations(string features)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-getDOMImpls Since:" ], "dom_domstringlist_item": [ - "domstring dom_domstringlist_item(int index);", + "domstring dom_domstringlist_item(int index)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#DOMStringList-item Since:" ], "dom_element_get_attribute": [ - "string dom_element_get_attribute(string name);", + "string dom_element_get_attribute(string name)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-666EE0F9 Since:" ], "dom_element_get_attribute_node": [ - "DOMAttr dom_element_get_attribute_node(string name);", + "DOMAttr dom_element_get_attribute_node(string name)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-217A91B8 Since:" ], "dom_element_get_attribute_node_ns": [ - "DOMAttr dom_element_get_attribute_node_ns(string namespaceURI, string localName);", + "DOMAttr dom_element_get_attribute_node_ns(string namespaceURI, string localName)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-ElGetAtNodeNS Since: DOM Level 2" ], "dom_element_get_attribute_ns": [ - "string dom_element_get_attribute_ns(string namespaceURI, string localName);", + "string dom_element_get_attribute_ns(string namespaceURI, string localName)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-ElGetAttrNS Since: DOM Level 2" ], "dom_element_get_elements_by_tag_name": [ - "DOMNodeList dom_element_get_elements_by_tag_name(string name);", + "DOMNodeList dom_element_get_elements_by_tag_name(string name)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1938918D Since:" ], "dom_element_get_elements_by_tag_name_ns": [ - "DOMNodeList dom_element_get_elements_by_tag_name_ns(string namespaceURI, string localName);", + "DOMNodeList dom_element_get_elements_by_tag_name_ns(string namespaceURI, string localName)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-A6C90942 Since: DOM Level 2" ], "dom_element_has_attribute": [ - "boolean dom_element_has_attribute(string name);", + "bool dom_element_has_attribute(string name)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-ElHasAttr Since: DOM Level 2" ], "dom_element_has_attribute_ns": [ - "boolean dom_element_has_attribute_ns(string namespaceURI, string localName);", + "bool dom_element_has_attribute_ns(string namespaceURI, string localName)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-ElHasAttrNS Since: DOM Level 2" ], "dom_element_remove_attribute": [ - "void dom_element_remove_attribute(string name);", + "void dom_element_remove_attribute(string name)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-6D6AC0F9 Since:" ], "dom_element_remove_attribute_node": [ - "DOMAttr dom_element_remove_attribute_node(DOMAttr oldAttr);", + "DOMAttr dom_element_remove_attribute_node(DOMAttr oldAttr)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-D589198 Since:" ], "dom_element_remove_attribute_ns": [ - "void dom_element_remove_attribute_ns(string namespaceURI, string localName);", + "void dom_element_remove_attribute_ns(string namespaceURI, string localName)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-ElRemAtNS Since: DOM Level 2" ], "dom_element_set_attribute": [ - "void dom_element_set_attribute(string name, string value);", + "void dom_element_set_attribute(string name, string value)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-F68F082 Since:" ], "dom_element_set_attribute_node": [ - "DOMAttr dom_element_set_attribute_node(DOMAttr newAttr);", + "DOMAttr dom_element_set_attribute_node(DOMAttr newAttr)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-887236154 Since:" ], "dom_element_set_attribute_node_ns": [ - "DOMAttr dom_element_set_attribute_node_ns(DOMAttr newAttr);", + "DOMAttr dom_element_set_attribute_node_ns(DOMAttr newAttr)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-ElSetAtNodeNS Since: DOM Level 2" ], "dom_element_set_attribute_ns": [ - "void dom_element_set_attribute_ns(string namespaceURI, string qualifiedName, string value);", + "void dom_element_set_attribute_ns(string namespaceURI, string qualifiedName, string value)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-ElSetAttrNS Since: DOM Level 2" ], "dom_element_set_id_attribute": [ - "void dom_element_set_id_attribute(string name, boolean isId);", + "void dom_element_set_id_attribute(string name, bool isId)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-ElSetIdAttr Since: DOM Level 3" ], "dom_element_set_id_attribute_node": [ - "void dom_element_set_id_attribute_node(attr idAttr, boolean isId);", + "void dom_element_set_id_attribute_node(attr idAttr, bool isId)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-ElSetIdAttrNode Since: DOM Level 3" ], "dom_element_set_id_attribute_ns": [ - "void dom_element_set_id_attribute_ns(string namespaceURI, string localName, boolean isId);", + "void dom_element_set_id_attribute_ns(string namespaceURI, string localName, bool isId)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-ElSetIdAttrNS Since: DOM Level 3" ], "dom_import_simplexml": [ @@ -3415,156 +3610,156 @@ var functionMap = { "Get a simplexml_element object from dom to allow for processing" ], "dom_namednodemap_get_named_item": [ - "DOMNode dom_namednodemap_get_named_item(string name);", + "DOMNode dom_namednodemap_get_named_item(string name)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1074577549 Since:" ], "dom_namednodemap_get_named_item_ns": [ - "DOMNode dom_namednodemap_get_named_item_ns(string namespaceURI, string localName);", + "DOMNode dom_namednodemap_get_named_item_ns(string namespaceURI, string localName)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-getNamedItemNS Since: DOM Level 2" ], "dom_namednodemap_item": [ - "DOMNode dom_namednodemap_item(int index);", + "DOMNode dom_namednodemap_item(int index)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-349467F9 Since:" ], "dom_namednodemap_remove_named_item": [ - "DOMNode dom_namednodemap_remove_named_item(string name);", + "DOMNode dom_namednodemap_remove_named_item(string name)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-D58B193 Since:" ], "dom_namednodemap_remove_named_item_ns": [ - "DOMNode dom_namednodemap_remove_named_item_ns(string namespaceURI, string localName);", + "DOMNode dom_namednodemap_remove_named_item_ns(string namespaceURI, string localName)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-removeNamedItemNS Since: DOM Level 2" ], "dom_namednodemap_set_named_item": [ - "DOMNode dom_namednodemap_set_named_item(DOMNode arg);", + "DOMNode dom_namednodemap_set_named_item(DOMNode arg)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1025163788 Since:" ], "dom_namednodemap_set_named_item_ns": [ - "DOMNode dom_namednodemap_set_named_item_ns(DOMNode arg);", + "DOMNode dom_namednodemap_set_named_item_ns(DOMNode arg)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-setNamedItemNS Since: DOM Level 2" ], "dom_namelist_get_name": [ - "string dom_namelist_get_name(int index);", + "string dom_namelist_get_name(int index)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#NameList-getName Since:" ], "dom_namelist_get_namespace_uri": [ - "string dom_namelist_get_namespace_uri(int index);", + "string dom_namelist_get_namespace_uri(int index)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#NameList-getNamespaceURI Since:" ], "dom_node_append_child": [ - "DomNode dom_node_append_child(DomNode newChild);", + "DomNode dom_node_append_child(DomNode newChild)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-184E7107 Since:" ], "dom_node_clone_node": [ - "DomNode dom_node_clone_node(boolean deep);", + "DomNode dom_node_clone_node(bool deep)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-3A0ED0A4 Since:" ], "dom_node_compare_document_position": [ - "short dom_node_compare_document_position(DomNode other);", + "short dom_node_compare_document_position(DomNode other)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Node3-compareDocumentPosition Since: DOM Level 3" ], "dom_node_get_feature": [ - "DomNode dom_node_get_feature(string feature, string version);", + "DomNode dom_node_get_feature(string feature, string version)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Node3-getFeature Since: DOM Level 3" ], "dom_node_get_user_data": [ - "mixed dom_node_get_user_data(string key);", + "mixed dom_node_get_user_data(string key)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Node3-getUserData Since: DOM Level 3" ], "dom_node_has_attributes": [ - "boolean dom_node_has_attributes();", + "bool dom_node_has_attributes()", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-NodeHasAttrs Since: DOM Level 2" ], "dom_node_has_child_nodes": [ - "boolean dom_node_has_child_nodes();", + "bool dom_node_has_child_nodes()", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-810594187 Since:" ], "dom_node_insert_before": [ - "domnode dom_node_insert_before(DomNode newChild, DomNode refChild);", + "domnode dom_node_insert_before(DomNode newChild, DomNode refChild)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-952280727 Since:" ], "dom_node_is_default_namespace": [ - "boolean dom_node_is_default_namespace(string namespaceURI);", + "bool dom_node_is_default_namespace(string namespaceURI)", "URL: http://www.w3.org/TR/DOM-Level-3-Core/core.html#Node3-isDefaultNamespace Since: DOM Level 3" ], "dom_node_is_equal_node": [ - "boolean dom_node_is_equal_node(DomNode arg);", + "bool dom_node_is_equal_node(DomNode arg)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Node3-isEqualNode Since: DOM Level 3" ], "dom_node_is_same_node": [ - "boolean dom_node_is_same_node(DomNode other);", + "bool dom_node_is_same_node(DomNode other)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Node3-isSameNode Since: DOM Level 3" ], "dom_node_is_supported": [ - "boolean dom_node_is_supported(string feature, string version);", + "bool dom_node_is_supported(string feature, string version)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Level-2-Core-Node-supports Since: DOM Level 2" ], "dom_node_lookup_namespace_uri": [ - "string dom_node_lookup_namespace_uri(string prefix);", + "string dom_node_lookup_namespace_uri(string prefix)", "URL: http://www.w3.org/TR/DOM-Level-3-Core/core.html#Node3-lookupNamespaceURI Since: DOM Level 3" ], "dom_node_lookup_prefix": [ - "string dom_node_lookup_prefix(string namespaceURI);", + "string dom_node_lookup_prefix(string namespaceURI)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Node3-lookupNamespacePrefix Since: DOM Level 3" ], "dom_node_normalize": [ - "void dom_node_normalize();", + "void dom_node_normalize()", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-normalize Since:" ], "dom_node_remove_child": [ - "DomNode dom_node_remove_child(DomNode oldChild);", + "DomNode dom_node_remove_child(DomNode oldChild)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1734834066 Since:" ], "dom_node_replace_child": [ - "DomNode dom_node_replace_child(DomNode newChild, DomNode oldChild);", + "DomNode dom_node_replace_child(DomNode newChild, DomNode oldChild)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-785887307 Since:" ], "dom_node_set_user_data": [ - "mixed dom_node_set_user_data(string key, mixed data, userdatahandler handler);", + "mixed dom_node_set_user_data(string key, mixed data, userdatahandler handler)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Node3-setUserData Since: DOM Level 3" ], "dom_nodelist_item": [ - "DOMNode dom_nodelist_item(int index);", + "DOMNode dom_nodelist_item(int index)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-844377136 Since:" ], "dom_string_extend_find_offset16": [ - "int dom_string_extend_find_offset16(int offset32);", + "int dom_string_extend_find_offset16(int offset32)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#i18n-methods-StringExtend-findOffset16 Since:" ], "dom_string_extend_find_offset32": [ - "int dom_string_extend_find_offset32(int offset16);", + "int dom_string_extend_find_offset32(int offset16)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#i18n-methods-StringExtend-findOffset32 Since:" ], "dom_text_is_whitespace_in_element_content": [ - "boolean dom_text_is_whitespace_in_element_content();", + "bool dom_text_is_whitespace_in_element_content()", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Text3-isWhitespaceInElementContent Since: DOM Level 3" ], "dom_text_replace_whole_text": [ - "DOMText dom_text_replace_whole_text(string content);", + "DOMText dom_text_replace_whole_text(string content)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Text3-replaceWholeText Since: DOM Level 3" ], "dom_text_split_text": [ - "DOMText dom_text_split_text(int offset);", + "DOMText dom_text_split_text(int offset)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-38853C1D Since:" ], "dom_userdatahandler_handle": [ - "dom_void dom_userdatahandler_handle(short operation, string key, domobject data, node src, node dst);", + "dom_void dom_userdatahandler_handle(short operation, string key, domobject data, node src, node dst)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-handleUserDataEvent Since:" ], "dom_xpath_evaluate": [ - "mixed dom_xpath_evaluate(string expr [,DOMNode context]); */", - "PHP_FUNCTION(dom_xpath_evaluate) { php_xpath_eval(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_DOM_XPATH_EVALUATE); } /* }}} end dom_xpath_evaluate" + "mixed dom_xpath_evaluate(string expr [,DOMNode context])", + "" ], "dom_xpath_query": [ - "DOMNodeList dom_xpath_query(string expr [,DOMNode context]); */", - "PHP_FUNCTION(dom_xpath_query) { php_xpath_eval(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_DOM_XPATH_QUERY); } /* }}} end dom_xpath_query" + "DOMNodeList dom_xpath_query(string expr [,DOMNode context])", + "" ], "dom_xpath_register_ns": [ - "boolean dom_xpath_register_ns(string prefix, string uri); */", - "PHP_FUNCTION(dom_xpath_register_ns) { zval *id; xmlXPathContextPtr ctxp; int prefix_len, ns_uri_len; dom_xpath_object *intern; unsigned char *prefix, *ns_uri; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), \"Oss\", &id, dom_xpath_class_entry, &prefix, &prefix_len, &ns_uri, &ns_uri_len) == FAILURE) { return; } intern = (dom_xpath_object *)zend_object_store_get_object(id TSRMLS_CC); ctxp = (xmlXPathContextPtr) intern->ptr; if (ctxp == NULL) { php_error_docref(NULL TSRMLS_CC, E_WARNING, \"Invalid XPath Context\"); RETURN_FALSE; } if (xmlXPathRegisterNs(ctxp, prefix, ns_uri) != 0) { RETURN_FALSE } RETURN_TRUE; } /* }}}" + "bool dom_xpath_register_ns(string prefix, string uri)", + "" ], "dom_xpath_register_php_functions": [ - "void dom_xpath_register_php_functions() */", - "PHP_FUNCTION(dom_xpath_register_php_functions) { zval *id; dom_xpath_object *intern; zval *array_value, **entry, *new_string; int name_len = 0; char *name; DOM_GET_THIS(id); if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, \"a\", &array_value) == SUCCESS) { intern = (dom_xpath_object *)zend_object_store_get_object(id TSRMLS_CC); zend_hash_internal_pointer_reset(Z_ARRVAL_P(array_value)); while (zend_hash_get_current_data(Z_ARRVAL_P(array_value), (void **)&entry) == SUCCESS) { SEPARATE_ZVAL(entry); convert_to_string_ex(entry); MAKE_STD_ZVAL(new_string); ZVAL_LONG(new_string,1); zend_hash_update(intern->registered_phpfunctions, Z_STRVAL_PP(entry), Z_STRLEN_PP(entry) + 1, &new_string, sizeof(zval*), NULL); zend_hash_move_forward(Z_ARRVAL_P(array_value)); } intern->registerPhpFunctions = 2; RETURN_TRUE; } else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, \"s\", &name, &name_len) == SUCCESS) { intern = (dom_xpath_object *)zend_object_store_get_object(id TSRMLS_CC); MAKE_STD_ZVAL(new_string); ZVAL_LONG(new_string,1); zend_hash_update(intern->registered_phpfunctions, name, name_len + 1, &new_string, sizeof(zval*), NULL); intern->registerPhpFunctions = 2; } else { intern = (dom_xpath_object *)zend_object_store_get_object(id TSRMLS_CC); intern->registerPhpFunctions = 1; } } /* }}} end dom_xpath_register_php_functions" + "void dom_xpath_register_php_functions()", + "" ], "each": [ "array each(array arr)", @@ -3583,7 +3778,7 @@ var functionMap = { "Output one or more strings" ], "empty": [ - "bool empty( mixed var )", + "bool empty(mixed var)", "Determine whether a variable is empty" ], "enchant_broker_describe": [ @@ -3595,7 +3790,7 @@ var functionMap = { "Whether a dictionary exists or not. Using non-empty tag" ], "enchant_broker_free": [ - "boolean enchant_broker_free(resource broker)", + "bool enchant_broker_free(resource broker)", "Destroys the broker object and its dictionnaries" ], "enchant_broker_free_dict": [ @@ -3891,7 +4086,7 @@ var functionMap = { "Returns the next lowest integer value from the number" ], "flush": [ - "void flush(void)", + "void flush()", "Flush the output buffer" ], "fmod": [ @@ -4099,7 +4294,7 @@ var functionMap = { "Get an array of the arguments that were passed to the function" ], "func_num_args": [ - "int func_num_args(void)", + "int func_num_args()", "Get the number of arguments that were passed to the function" ], "function ": ["", ""], @@ -4113,19 +4308,19 @@ var functionMap = { "Binary-safe file write" ], "gc_collect_cycles": [ - "int gc_collect_cycles(void)", + "int gc_collect_cycles()", "Forces collection of any existing garbage cycles. Returns number of freed zvals" ], "gc_disable": [ - "void gc_disable(void)", + "void gc_disable()", "Deactivates the circular reference collector" ], "gc_enable": [ - "void gc_enable(void)", + "void gc_enable()", "Activates the circular reference collector" ], "gc_enabled": [ - "void gc_enabled(void)", + "void gc_enabled()", "Returns status of the circular reference collector" ], "gd_info": [ @@ -4134,7 +4329,7 @@ var functionMap = { ], "getKeywords": [ "static array getKeywords(string $locale) {", - "* return an associative array containing keyword-value * pairs for this locale. The keys are keys to the array (doh!) * }}}" + "* return an associative array containing keyword-value * pairs for this locale. The keys are keys to the array * }}}" ], "get_browser": [ "mixed get_browser([string browser_name [, bool return_array]])", @@ -4161,7 +4356,7 @@ var functionMap = { "Returns an array of default properties of the class." ], "get_current_user": [ - "string get_current_user(void)", + "string get_current_user()", "Get the name of the owner of the current PHP script" ], "get_declared_classes": [ @@ -4177,11 +4372,11 @@ var functionMap = { "Return an array containing the names and values of all defined constants" ], "get_defined_functions": [ - "array get_defined_functions(void)", + "array get_defined_functions()", "Returns an array of all defined functions" ], "get_defined_vars": [ - "array get_defined_vars(void)", + "array get_defined_vars()", "Returns an associative array of names and values of all currently defined variable names (variables in the current scope)" ], "get_display_language": [ @@ -4217,7 +4412,7 @@ var functionMap = { "Get the current include_path configuration option" ], "get_included_files": [ - "array get_included_files(void)", + "array get_included_files()", "Returns an array with the file names that were include_once()'d" ], "get_loaded_extensions": [ @@ -4225,11 +4420,11 @@ var functionMap = { "Return an array containing names of loaded extensions" ], "get_magic_quotes_gpc": [ - "int get_magic_quotes_gpc(void)", + "int get_magic_quotes_gpc()", "Get the current active configuration setting of magic_quotes_gpc" ], "get_magic_quotes_runtime": [ - "int get_magic_quotes_runtime(void)", + "int get_magic_quotes_runtime()", "Get the current active configuration setting of magic_quotes_runtime" ], "get_meta_tags": [ @@ -4249,11 +4444,11 @@ var functionMap = { "Get the resource type name for a given resource" ], "getallheaders": [ - "array getallheaders(void)", + "array getallheaders()", "" ], "getcwd": [ - "mixed getcwd(void)", + "mixed getcwd()", "Gets the current directory" ], "getdate": [ @@ -4285,23 +4480,23 @@ var functionMap = { "Get the size of an image as 4-element array" ], "getlastmod": [ - "int getlastmod(void)", + "int getlastmod()", "Get time of last page modification" ], "getmygid": [ - "int getmygid(void)", + "int getmygid()", "Get PHP script owner's GID" ], "getmyinode": [ - "int getmyinode(void)", + "int getmyinode()", "Get the inode of the current script being parsed" ], "getmypid": [ - "int getmypid(void)", + "int getmypid()", "Get current process ID" ], "getmyuid": [ - "int getmyuid(void)", + "int getmyuid()", "Get PHP script owner's UID" ], "getopt": [ @@ -4317,7 +4512,7 @@ var functionMap = { "Returns protocol name associated with protocol number proto" ], "getrandmax": [ - "int getrandmax(void)", + "int getrandmax()", "Returns the maximum value a random number can have" ], "getrusage": [ @@ -4593,7 +4788,7 @@ var functionMap = { "Generate a hash of a given input string Returns lowercase hexits by default" ], "hash_algos": [ - "array hash_algos(void)", + "array hash_algos()", "Return a list of registered hashing algorithms" ], "hash_copy": [ @@ -4641,7 +4836,7 @@ var functionMap = { "Removes an HTTP header previously set using header()" ], "headers_list": [ - "array headers_list(void)", + "array headers_list()", "Return list of headers to be sent / already sent" ], "headers_sent": [ @@ -4769,11 +4964,11 @@ var functionMap = { "Drop an InterBase database" ], "ibase_errcode": [ - "int ibase_errcode(void)", + "int ibase_errcode()", "Return error code" ], "ibase_errmsg": [ - "string ibase_errmsg(void)", + "string ibase_errmsg()", "Return error message" ], "ibase_execute": [ @@ -5242,7 +5437,7 @@ var functionMap = { ], "imagepsextendfont": [ "bool imagepsextendfont(resource font_index, float extend)", - "Extend or or condense (if extend < 1) a font" + "Extend or or condense if (extend < 1) a font" ], "imagepsfreefont": [ "bool imagepsfreefont(resource font_index)", @@ -5321,7 +5516,7 @@ var functionMap = { "Write text to the image using a TrueType font" ], "imagetypes": [ - "int imagetypes(void)", + "int imagetypes()", "Return the types of images supported in a bitfield - 1=GIF, 2=JPEG, 4=PNG, 8=WBMP, 16=XPM" ], "imagewbmp": [ @@ -5337,7 +5532,7 @@ var functionMap = { "Convert an 8-bit string to a quoted-printable string" ], "imap_alerts": [ - "array imap_alerts(void)", + "array imap_alerts()", "Returns an array of all IMAP alerts that have been generated since the last page load or since the last imap_alerts() call, whichever came last. The alert stack is cleared after imap_alerts() is called." ], "imap_append": [ @@ -5385,7 +5580,7 @@ var functionMap = { "Delete a mailbox" ], "imap_errors": [ - "array imap_errors(void)", + "array imap_errors()", "Returns an array of all IMAP errors generated since the last page load, or since the last imap_errors() call, whichever came last. The error stack is cleared after imap_errors() is called." ], "imap_expunge": [ @@ -5441,7 +5636,7 @@ var functionMap = { "Returns headers for all messages in a mailbox" ], "imap_last_error": [ - "string imap_last_error(void)", + "string imap_last_error()", "Returns the last error that was generated by an IMAP function. The error stack is NOT cleared after this call." ], "imap_list": [ @@ -5692,6 +5887,10 @@ var functionMap = { "bool is_callable(mixed var [, bool syntax_only [, string callable_name]])", "Returns true if var is callable." ], + "is_countable": [ + "bool is_countable(mixed var)", + "Returns true if var is countable, false otherwise" + ], "is_dir": [ "bool is_dir(string filename)", "Returns true if file is directory" @@ -5773,15 +5972,15 @@ var functionMap = { "Determine whether a variable is set" ], "iterator_apply": [ - "int iterator_apply(Traversable it, mixed function [, mixed params])", + "int iterator_apply(Traversable iterator, callable function [, array args = null)", "Calls a function for every element in an iterator" ], "iterator_count": [ - "int iterator_count(Traversable it)", + "int iterator_count(Traversable iterator)", "Count the elements in an iterator" ], "iterator_to_array": [ - "array iterator_to_array(Traversable it [, bool use_keys = true])", + "array iterator_to_array(Traversable iterator [, bool use_keys = true])", "Copy the iterator into an array" ], "jddayofweek": [ @@ -5817,11 +6016,11 @@ var functionMap = { "Converts a jewish calendar date to a julian day count" ], "join": [ - "string join(array src, string glue)", - "An alias for implode" + "string join([string glue,] array pieces)", + "Returns a string containing a string representation of all the arrayelements in the same order, with the glue string between each element" ], "jpeg2wbmp": [ - "bool jpeg2wbmp (string f_org, string f_dest, int d_height, int d_width, int threshold)", + "bool jpeg2wbmp(string f_org, string f_dest, int d_height, int d_width, int threshold)", "Convert JPEG image to WBMP image" ], "json_decode": [ @@ -5989,7 +6188,7 @@ var functionMap = { "Read an entry" ], "ldap_rename": [ - "bool ldap_rename(resource link, string dn, string newrdn, string newparent, bool deleteoldrdn);", + "bool ldap_rename(resource link, string dn, string newrdn, string newparent, bool deleteoldrdn)", "Modify the name of an entry" ], "ldap_sasl_bind": [ @@ -6037,7 +6236,7 @@ var functionMap = { "Clear last error from libxml" ], "libxml_disable_entity_loader": [ - "bool libxml_disable_entity_loader([boolean disable])", + "bool libxml_disable_entity_loader([bool disable])", "Disable/Enable ability to load external entities" ], "libxml_get_errors": [ @@ -6053,7 +6252,7 @@ var functionMap = { "Set the streams context for the next libxml document load or write" ], "libxml_use_internal_errors": [ - "bool libxml_use_internal_errors([boolean use_errors])", + "bool libxml_use_internal_errors([bool use_errors])", "Disable libxml errors and allow user to fetch error information as needed" ], "link": [ @@ -6065,11 +6264,11 @@ var functionMap = { "Returns the st_dev field of the UNIX C stat structure describing the link" ], "litespeed_request_headers": [ - "array litespeed_request_headers(void)", + "array litespeed_request_headers()", "Fetch all HTTP request headers" ], "litespeed_response_headers": [ - "array litespeed_response_headers(void)", + "array litespeed_response_headers()", "Fetch all HTTP response headers" ], "locale_accept_from_http": [ @@ -6081,7 +6280,7 @@ var functionMap = { "* @param string $locale The locale string to canonicalize" ], "locale_filter_matches": [ - "boolean locale_filter_matches(string $langtag, string $locale[, bool $canonicalize])", + "bool locale_filter_matches(string $langtag, string $locale[, bool $canonicalize])", "* Checks if a $langtag filter matches with $locale according to RFC 4647's basic filtering algorithm" ], "locale_get_all_variants": [ @@ -6094,7 +6293,7 @@ var functionMap = { ], "locale_get_keywords": [ "static array locale_get_keywords(string $locale) {", - "* return an associative array containing keyword-value * pairs for this locale. The keys are keys to the array (doh!)" + "* return an associative array containing keyword-value * pairs for this locale. The keys are keys to the array" ], "locale_get_primary_language": [ "static string locale_get_primary_language($locale)", @@ -6117,7 +6316,7 @@ var functionMap = { "Set default locale" ], "localeconv": [ - "array localeconv(void)", + "array localeconv()", "Returns numeric formatting information based on the current locale" ], "localtime": [ @@ -6221,11 +6420,11 @@ var functionMap = { "Regular expression search for multibyte string" ], "mb_ereg_search_getpos": [ - "int mb_ereg_search_getpos(void)", + "int mb_ereg_search_getpos()", "Get search start position" ], "mb_ereg_search_getregs": [ - "array mb_ereg_search_getregs(void)", + "array mb_ereg_search_getregs()", "Get matched substring of the last time" ], "mb_ereg_search_init": [ @@ -6545,7 +6744,7 @@ var functionMap = { "Hash data with hash" ], "mhash_count": [ - "int mhash_count(void)", + "int mhash_count()", "Gets the number of available hashes" ], "mhash_get_block_size": [ @@ -6721,7 +6920,7 @@ var functionMap = { "Free a MS-SQL statement index" ], "mssql_get_last_message": [ - "string mssql_get_last_message(void)", + "string mssql_get_last_message()", "Gets the last message from the MS-SQL server" ], "mssql_guid_string": [ @@ -6773,7 +6972,7 @@ var functionMap = { "Select a MS-SQL database" ], "mt_getrandmax": [ - "int mt_getrandmax(void)", + "int mt_getrandmax()", "Returns the maximum value a random number from Mersenne Twister can have" ], "mt_rand": [ @@ -6881,7 +7080,7 @@ var functionMap = { "Free result memory" ], "mysql_get_client_info": [ - "string mysql_get_client_info(void)", + "string mysql_get_client_info()", "Returns a string that represents the client library version" ], "mysql_get_host_info": [ @@ -6977,7 +7176,7 @@ var functionMap = { "Turn auto commit on or of" ], "mysqli_cache_stats": [ - "array mysqli_cache_stats(void)", + "array mysqli_cache_stats()", "Returns statistics about the zval cache" ], "mysqli_change_user": [ @@ -7001,11 +7200,11 @@ var functionMap = { "Open a connection to a mysql server" ], "mysqli_connect_errno": [ - "int mysqli_connect_errno(void)", + "int mysqli_connect_errno()", "Returns the numerical value of the error message from last connect command" ], "mysqli_connect_error": [ - "string mysqli_connect_error(void)", + "string mysqli_connect_error()", "Returns the text of the error message from previous MySQL operation" ], "mysqli_data_seek": [ @@ -7021,7 +7220,7 @@ var functionMap = { "" ], "mysqli_embedded_server_end": [ - "void mysqli_embedded_server_end(void)", + "void mysqli_embedded_server_end()", "" ], "mysqli_embedded_server_start": [ @@ -7037,39 +7236,39 @@ var functionMap = { "Returns the text of the error message from previous MySQL operation" ], "mysqli_fetch_all": [ - "mixed mysqli_fetch_all (object result [,int resulttype])", + "mixed mysqli_fetch_all(object result [,int resulttype])", "Fetches all result rows as an associative array, a numeric array, or both" ], "mysqli_fetch_array": [ - "mixed mysqli_fetch_array (object result [,int resulttype])", + "mixed mysqli_fetch_array(object result [,int resulttype])", "Fetch a result row as an associative array, a numeric array, or both" ], "mysqli_fetch_assoc": [ - "mixed mysqli_fetch_assoc (object result)", + "mixed mysqli_fetch_assoc(object result)", "Fetch a result row as an associative array" ], "mysqli_fetch_field": [ - "mixed mysqli_fetch_field (object result)", + "mixed mysqli_fetch_field(object result)", "Get column information from a result and return as an object" ], "mysqli_fetch_field_direct": [ - "mixed mysqli_fetch_field_direct (object result, int offset)", + "mixed mysqli_fetch_field_direct(object result, int offset)", "Fetch meta-data for a single field" ], "mysqli_fetch_fields": [ - "mixed mysqli_fetch_fields (object result)", + "mixed mysqli_fetch_fields(object result)", "Return array of objects containing field meta-data" ], "mysqli_fetch_lengths": [ - "mixed mysqli_fetch_lengths (object result)", + "mixed mysqli_fetch_lengths(object result)", "Get the length of each output in a result" ], "mysqli_fetch_object": [ - "mixed mysqli_fetch_object (object result [, string class_name [, NULL|array ctor_params]])", + "mixed mysqli_fetch_object(object result [, string class_name [, NULL|array ctor_params]])", "Fetch a result row as an object" ], "mysqli_fetch_row": [ - "array mysqli_fetch_row (object result)", + "array mysqli_fetch_row(object result)", "Get a result row as an enumerated array" ], "mysqli_field_count": [ @@ -7093,23 +7292,23 @@ var functionMap = { "returns a character set object" ], "mysqli_get_client_info": [ - "string mysqli_get_client_info(void)", + "string mysqli_get_client_info()", "Get MySQL client info" ], "mysqli_get_client_stats": [ - "array mysqli_get_client_stats(void)", + "array mysqli_get_client_stats()", "Returns statistics about the zval cache" ], "mysqli_get_client_version": [ - "int mysqli_get_client_version(void)", + "int mysqli_get_client_version()", "Get MySQL client info" ], "mysqli_get_connection_stats": [ - "array mysqli_get_connection_stats(void)", + "array mysqli_get_connection_stats()", "Returns statistics about the zval cache" ], "mysqli_get_host_info": [ - "string mysqli_get_host_info (object link)", + "string mysqli_get_host_info(object link)", "Get MySQL host info" ], "mysqli_get_proto_info": [ @@ -7125,15 +7324,15 @@ var functionMap = { "Return the MySQL version for the server referenced by the given link" ], "mysqli_get_warnings": [ - "object mysqli_get_warnings(object link) */", - "PHP_FUNCTION(mysqli_get_warnings) { MY_MYSQL *mysql; zval *mysql_link; MYSQLI_RESOURCE *mysqli_resource; MYSQLI_WARNING *w; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), \"O\", &mysql_link, mysqli_link_class_entry) == FAILURE) { return; } MYSQLI_FETCH_RESOURCE(mysql, MY_MYSQL*, &mysql_link, \"mysqli_link\", MYSQLI_STATUS_VALID); if (mysql_warning_count(mysql->mysql)) { w = php_get_warnings(mysql->mysql TSRMLS_CC); } else { RETURN_FALSE; } mysqli_resource = (MYSQLI_RESOURCE *)ecalloc (1, sizeof(MYSQLI_RESOURCE)); mysqli_resource->ptr = mysqli_resource->info = (void *)w; mysqli_resource->status = MYSQLI_STATUS_VALID; MYSQLI_RETURN_RESOURCE(mysqli_resource, mysqli_warning_class_entry); } /* }}}" + "object mysqli_get_warnings(object link)", + "" ], "mysqli_info": [ "string mysqli_info(object link)", "Get information about the most recent query" ], "mysqli_init": [ - "resource mysqli_init(void)", + "resource mysqli_init()", "Initialize mysqli and return a resource for use with mysql_real_connect" ], "mysqli_insert_id": [ @@ -7185,8 +7384,8 @@ var functionMap = { "Prepare a SQL statement for execution" ], "mysqli_query": [ - "mixed mysqli_query(object link, string query [,int resultmode]) */", - "PHP_FUNCTION(mysqli_query) { MY_MYSQL *mysql; zval *mysql_link; MYSQLI_RESOURCE *mysqli_resource; MYSQL_RES *result; char *query = NULL; unsigned int query_len; unsigned long resultmode = MYSQLI_STORE_RESULT; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), \"Os|l\", &mysql_link, mysqli_link_class_entry, &query, &query_len, &resultmode) == FAILURE) { return; } if (!query_len) { php_error_docref(NULL TSRMLS_CC, E_WARNING, \"Empty query\"); RETURN_FALSE; } if ((resultmode & ~MYSQLI_ASYNC) != MYSQLI_USE_RESULT && (resultmode & ~MYSQLI_ASYNC) != MYSQLI_STORE_RESULT) { php_error_docref(NULL TSRMLS_CC, E_WARNING, \"Invalid value for resultmode\"); RETURN_FALSE; } MYSQLI_FETCH_RESOURCE(mysql, MY_MYSQL*, &mysql_link, \"mysqli_link\", MYSQLI_STATUS_VALID); MYSQLI_DISABLE_MQ; #ifdef MYSQLI_USE_MYSQLND if (resultmode & MYSQLI_ASYNC) { if (mysqli_async_query(mysql->mysql, query, query_len)) { MYSQLI_REPORT_MYSQL_ERROR(mysql->mysql); RETURN_FALSE; } mysql->async_result_fetch_type = resultmode & ~MYSQLI_ASYNC; RETURN_TRUE; } #endif if (mysql_real_query(mysql->mysql, query, query_len)) { MYSQLI_REPORT_MYSQL_ERROR(mysql->mysql); RETURN_FALSE; } if (!mysql_field_count(mysql->mysql)) { /* no result set - not a SELECT" + "mixed mysqli_query(object link, string query [,int resultmode])", + "" ], "mysqli_real_connect": [ "bool mysqli_real_connect(object link [,string hostname [,string username [,string passwd [,string dbname [,int port [,string socket [,int flags]]]]]]])", @@ -7301,8 +7500,8 @@ var functionMap = { "Buffer result set on client" ], "mysqli_stmt_get_warnings": [ - "object mysqli_stmt_get_warnings(object link) */", - "PHP_FUNCTION(mysqli_stmt_get_warnings) { MY_STMT *stmt; zval *stmt_link; MYSQLI_RESOURCE *mysqli_resource; MYSQLI_WARNING *w; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), \"O\", &stmt_link, mysqli_stmt_class_entry) == FAILURE) { return; } MYSQLI_FETCH_RESOURCE(stmt, MY_STMT*, &stmt_link, \"mysqli_stmt\", MYSQLI_STATUS_VALID); if (mysqli_stmt_warning_count(stmt->stmt)) { w = php_get_warnings(mysqli_stmt_get_connection(stmt->stmt) TSRMLS_CC); } else { RETURN_FALSE; } mysqli_resource = (MYSQLI_RESOURCE *)ecalloc (1, sizeof(MYSQLI_RESOURCE)); mysqli_resource->ptr = mysqli_resource->info = (void *)w; mysqli_resource->status = MYSQLI_STATUS_VALID; MYSQLI_RETURN_RESOURCE(mysqli_resource, mysqli_warning_class_entry); } /* }}}" + "object mysqli_stmt_get_warnings(object link)", + "" ], "mysqli_stmt_init": [ "mixed mysqli_stmt_init(object link)", @@ -7357,7 +7556,7 @@ var functionMap = { "Return the current thread ID" ], "mysqli_thread_safe": [ - "bool mysqli_thread_safe(void)", + "bool mysqli_thread_safe()", "Return whether thread safety is given or not" ], "mysqli_use_result": [ @@ -7365,7 +7564,7 @@ var functionMap = { "Directly retrieve query results - do not buffer results on client side" ], "mysqli_warning_count": [ - "int mysqli_warning_count (object link)", + "int mysqli_warning_count(object link)", "Return number of warnings from the last query for the given link" ], "natcasesort": [ @@ -7401,11 +7600,11 @@ var functionMap = { "* Normalize a string." ], "nsapi_request_headers": [ - "array nsapi_request_headers(void)", + "array nsapi_request_headers()", "Get all headers from the request" ], "nsapi_response_headers": [ - "array nsapi_response_headers(void)", + "array nsapi_response_headers()", "Get all headers from the response" ], "nsapi_virtual": [ @@ -7485,39 +7684,39 @@ var functionMap = { "* Get formatter attribute value." ], "ob_clean": [ - "bool ob_clean(void)", + "bool ob_clean()", "Clean (delete) the current output buffer" ], "ob_end_clean": [ - "bool ob_end_clean(void)", + "bool ob_end_clean()", "Clean the output buffer, and delete current output buffer" ], "ob_end_flush": [ - "bool ob_end_flush(void)", + "bool ob_end_flush()", "Flush (send) the output buffer, and delete current output buffer" ], "ob_flush": [ - "bool ob_flush(void)", + "bool ob_flush()", "Flush (send) contents of the output buffer. The last buffer content is sent to next buffer" ], "ob_get_clean": [ - "bool ob_get_clean(void)", + "bool ob_get_clean()", "Get current buffer contents and delete current output buffer" ], "ob_get_contents": [ - "string ob_get_contents(void)", + "string ob_get_contents()", "Return the contents of the output buffer" ], "ob_get_flush": [ - "bool ob_get_flush(void)", + "bool ob_get_flush()", "Get current buffer contents, flush (send) the output buffer, and delete current output buffer" ], "ob_get_length": [ - "int ob_get_length(void)", + "int ob_get_length()", "Return the length of the output buffer" ], "ob_get_level": [ - "int ob_get_level(void)", + "int ob_get_level()", "Return the nesting level of the output buffer" ], "ob_get_status": [ @@ -7837,7 +8036,7 @@ var functionMap = { "Returns current state of buffering for a LOB" ], "ocisetbufferinglob": [ - "bool ocisetbufferinglob( boolean flag )", + "bool ocisetbufferinglob( bool flag )", "Enables/disables buffering for a LOB" ], "octdec": [ @@ -7857,7 +8056,7 @@ var functionMap = { "Close an ODBC connection" ], "odbc_close_all": [ - "void odbc_close_all(void)", + "void odbc_close_all()", "Close all ODBC connections" ], "odbc_columnprivileges": [ @@ -8065,7 +8264,7 @@ var functionMap = { "Encrypts given data with given method and key, returns raw or base64 encoded string" ], "openssl_error_string": [ - "mixed openssl_error_string(void)", + "mixed openssl_error_string()", "Returns a description of the last error, and alters the index of the error messages. Returns false when the are no more messages" ], "openssl_get_cipher_methods": [ @@ -8205,7 +8404,7 @@ var functionMap = { "Add URL rewriter values" ], "output_reset_rewrite_vars": [ - "bool output_reset_rewrite_vars(void)", + "bool output_reset_rewrite_vars()", "Reset(clear) URL rewriter values" ], "pack": [ @@ -8257,7 +8456,7 @@ var functionMap = { "Executes specified program in current process space as defined by exec(2)" ], "pcntl_fork": [ - "int pcntl_fork(void)", + "int pcntl_fork()", "Forks the currently running process following the same behavior as the UNIX fork() system call" ], "pcntl_getpriority": [ @@ -8374,7 +8573,7 @@ var functionMap = { ], "pg_delete": [ "mixed pg_delete(resource db, string table, array ids[, int options])", - "Delete records has ids (id=>value)" + "Delete records has ids (id => value)" ], "pg_end_copy": [ "bool pg_end_copy([resource connection])", @@ -8474,7 +8673,7 @@ var functionMap = { ], "pg_insert": [ "mixed pg_insert(resource db, string table, array values[, int options])", - "Insert values (filed=>value) to table" + "Insert values (filed => value) to table" ], "pg_last_error": [ "string pg_last_error([resource connection])", @@ -8598,7 +8797,7 @@ var functionMap = { ], "pg_select": [ "mixed pg_select(resource db, string table, array ids[, int options])", - "Select records that has ids (id=>value)" + "Select records that has ids (id => value)" ], "pg_send_execute": [ "bool pg_send_execute(resource connection, string stmtname, array params)", @@ -8646,34 +8845,34 @@ var functionMap = { ], "pg_update": [ "mixed pg_update(resource db, string table, array fields, array ids[, int options])", - "Update table using values (field=>value) and ids (id=>value)" + "Update table using values (field => value) and ids (id => value)" ], "pg_version": [ "array pg_version([resource connection])", "Returns an array with client, protocol and server version (when available)" ], "php_egg_logo_guid": [ - "string php_egg_logo_guid(void)", + "string php_egg_logo_guid()", "Return the special ID used to request the PHP logo in phpinfo screens" ], "php_ini_loaded_file": [ - "string php_ini_loaded_file(void)", + "string php_ini_loaded_file()", "Return the actual loaded ini filename" ], "php_ini_scanned_files": [ - "string php_ini_scanned_files(void)", + "string php_ini_scanned_files()", "Return comma-separated string of .ini files parsed from the additional ini dir" ], "php_logo_guid": [ - "string php_logo_guid(void)", + "string php_logo_guid()", "Return the special ID used to request the PHP logo in phpinfo screens" ], "php_real_logo_guid": [ - "string php_real_logo_guid(void)", + "string php_real_logo_guid()", "Return the special ID used to request the PHP logo in phpinfo screens" ], "php_sapi_name": [ - "string php_sapi_name(void)", + "string php_sapi_name()", "Return the current SAPI module name" ], "php_snmpv3": [ @@ -8685,7 +8884,7 @@ var functionMap = { "Return source with stripped comments and whitespace" ], "php_uname": [ - "string php_uname(void)", + "string php_uname()", "Return information about the system PHP was built on" ], "phpcredits": [ @@ -8701,11 +8900,11 @@ var functionMap = { "Return the current PHP version" ], "pi": [ - "float pi(void)", + "float pi()", "Returns an approximation of pi" ], "png2wbmp": [ - "bool png2wbmp (string f_org, string f_dest, int d_height, int d_width, int threshold)", + "bool png2wbmp(string f_org, string f_dest, int d_height, int d_width, int threshold)", "Convert PNG image to WBMP image" ], "popen": [ @@ -8717,27 +8916,27 @@ var functionMap = { "Determine accessibility of a file (POSIX.1 5.6.3)" ], "posix_ctermid": [ - "string posix_ctermid(void)", + "string posix_ctermid()", "Generate terminal path name (POSIX.1, 4.7.1)" ], "posix_get_last_error": [ - "int posix_get_last_error(void)", + "int posix_get_last_error()", "Retrieve the error number set by the last posix function which failed." ], "posix_getcwd": [ - "string posix_getcwd(void)", + "string posix_getcwd()", "Get working directory pathname (POSIX.1, 5.2.2)" ], "posix_getegid": [ - "int posix_getegid(void)", + "int posix_getegid()", "Get the current effective group id (POSIX.1, 4.2.1)" ], "posix_geteuid": [ - "int posix_geteuid(void)", + "int posix_geteuid()", "Get the current effective user id (POSIX.1, 4.2.1)" ], "posix_getgid": [ - "int posix_getgid(void)", + "int posix_getgid()", "Get the current group id (POSIX.1, 4.2.1)" ], "posix_getgrgid": [ @@ -8749,27 +8948,27 @@ var functionMap = { "Group database access (POSIX.1, 9.2.1)" ], "posix_getgroups": [ - "array posix_getgroups(void)", + "array posix_getgroups()", "Get supplementary group id's (POSIX.1, 4.2.3)" ], "posix_getlogin": [ - "string posix_getlogin(void)", + "string posix_getlogin()", "Get user name (POSIX.1, 4.2.4)" ], "posix_getpgid": [ - "int posix_getpgid(void)", + "int posix_getpgid()", "Get the process group id of the specified process (This is not a POSIX function, but a SVR4ism, so we compile conditionally)" ], "posix_getpgrp": [ - "int posix_getpgrp(void)", + "int posix_getpgrp()", "Get current process group id (POSIX.1, 4.3.1)" ], "posix_getpid": [ - "int posix_getpid(void)", + "int posix_getpid()", "Get the current process id (POSIX.1, 4.1.1)" ], "posix_getppid": [ - "int posix_getppid(void)", + "int posix_getppid()", "Get the parent process id (POSIX.1, 4.1.1)" ], "posix_getpwnam": [ @@ -8781,15 +8980,15 @@ var functionMap = { "User database access (POSIX.1, 9.2.2)" ], "posix_getrlimit": [ - "array posix_getrlimit(void)", + "array posix_getrlimit()", "Get system resource consumption limits (This is not a POSIX function, but a BSDism and a SVR4ism. We compile conditionally)" ], "posix_getsid": [ - "int posix_getsid(void)", + "int posix_getsid()", "Get process group id of session leader (This is not a POSIX function, but a SVR4ism, so be compile conditionally)" ], "posix_getuid": [ - "int posix_getuid(void)", + "int posix_getuid()", "Get the current user id (POSIX.1, 4.2.1)" ], "posix_initgroups": [ @@ -8829,7 +9028,7 @@ var functionMap = { "Set process group id for job control (POSIX.1, 4.3.3)" ], "posix_setsid": [ - "int posix_setsid(void)", + "int posix_setsid()", "Create session and set process group id (POSIX.1, 4.3.2)" ], "posix_setuid": [ @@ -8841,7 +9040,7 @@ var functionMap = { "Retrieve the system error message associated with the given errno." ], "posix_times": [ - "array posix_times(void)", + "array posix_times()", "Get process times (POSIX.1, 4.5.2)" ], "posix_ttyname": [ @@ -8849,7 +9048,7 @@ var functionMap = { "Determine terminal device name (POSIX.1, 4.7.2)" ], "posix_uname": [ - "array posix_uname(void)", + "array posix_uname()", "Get system name (POSIX.1, 4.4.1)" ], "pow": [ @@ -9017,8 +9216,8 @@ var functionMap = { "Convert a quoted-printable string to an 8 bit string" ], "quoted_printable_encode": [ - "string quoted_printable_encode(string str) */", - "PHP_FUNCTION(quoted_printable_encode) { char *str, *new_str; int str_len; size_t new_str_len; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, \"s\", &str, &str_len) != SUCCESS) { return; } if (!str_len) { RETURN_EMPTY_STRING(); } new_str = (char *)php_quot_print_encode((unsigned char *)str, (size_t)str_len, &new_str_len); RETURN_STRINGL(new_str, new_str_len, 0); } /* }}}" + "string quoted_printable_encode(string str)", + "" ], "quotemeta": [ "string quotemeta(string str)", @@ -9077,7 +9276,7 @@ var functionMap = { "Informs the readline callback interface that a character is ready for input" ], "readline_clear_history": [ - "bool readline_clear_history(void)", + "bool readline_clear_history()", "Clears the history" ], "readline_completion_function": [ @@ -9089,11 +9288,11 @@ var functionMap = { "Gets/sets various internal readline variables." ], "readline_list_history": [ - "array readline_list_history(void)", + "array readline_list_history()", "Lists the history" ], "readline_on_new_line": [ - "void readline_on_new_line(void)", + "void readline_on_new_line()", "Inform readline that the cursor has moved to a new line" ], "readline_read_history": [ @@ -9101,7 +9300,7 @@ var functionMap = { "Reads the history" ], "readline_redisplay": [ - "void readline_redisplay(void)", + "void readline_redisplay()", "Ask readline to redraw the display" ], "readline_write_history": [ @@ -9157,11 +9356,11 @@ var functionMap = { "Set array argument's internal pointer to the first element and return it" ], "restore_error_handler": [ - "void restore_error_handler(void)", + "void restore_error_handler()", "Restores the previously defined error handler function" ], "restore_exception_handler": [ - "void restore_exception_handler(void)", + "void restore_exception_handler()", "Restores the previously defined exception handler function" ], "restore_include_path": [ @@ -9229,15 +9428,15 @@ var functionMap = { "Deserializes data and reinitializes the variables" ], "session_destroy": [ - "bool session_destroy(void)", + "bool session_destroy()", "Destroy the current session and all data associated with it" ], "session_encode": [ - "string session_encode(void)", + "string session_encode()", "Serializes the current setup and returns the serialized representation" ], "session_get_cookie_params": [ - "array session_get_cookie_params(void)", + "array session_get_cookie_params()", "Return the session cookie parameters" ], "session_id": [ @@ -9277,7 +9476,7 @@ var functionMap = { "Sets user-level functions" ], "session_start": [ - "bool session_start(void)", + "bool session_start()", "Begin session - reinitializes freezed variables, registers browsers etc" ], "session_unregister": [ @@ -9285,11 +9484,11 @@ var functionMap = { "Removes varname from the list of variables which are freezed at the session end" ], "session_unset": [ - "void session_unset(void)", + "void session_unset()", "Unset all registered variables" ], "session_write_close": [ - "void session_write_close(void)", + "void session_write_close()", "Write session data and end session" ], "set_error_handler": [ @@ -9369,27 +9568,27 @@ var functionMap = { "Removes variable from shared memory" ], "shmop_close": [ - "void shmop_close (int shmid)", + "void shmop_close(int shmid)", "closes a shared memory segment" ], "shmop_delete": [ - "bool shmop_delete (int shmid)", + "bool shmop_delete(int shmid)", "mark segment for deletion" ], "shmop_open": [ - "int shmop_open (int key, string flags, int mode, int size)", + "int shmop_open(int key, string flags, int mode, int size)", "gets and attaches a shared memory segment" ], "shmop_read": [ - "string shmop_read (int shmid, int start, int count)", + "string shmop_read(int shmid, int start, int count)", "reads from a shm segment" ], "shmop_size": [ - "int shmop_size (int shmid)", + "int shmop_size(int shmid)", "returns the shm size" ], "shmop_write": [ - "int shmop_write (int shmid, string data, int offset)", + "int shmop_write(int shmid, string data, int offset)", "writes to a shared memory segment" ], "shuffle": [ @@ -9501,7 +9700,7 @@ var functionMap = { "Fetch the value of a SNMP object" ], "snmp_get_quick_print": [ - "bool snmp_get_quick_print(void)", + "bool snmp_get_quick_print()", "Return the current status of quick_print" ], "snmp_get_valueretrieval": [ @@ -9749,7 +9948,7 @@ var functionMap = { "Escapes a string for use as a query parameter." ], "sqlite_exec": [ - "boolean sqlite_exec(string query, resource db[, string &error_message])", + "bool sqlite_exec(string query, resource db[, string &error_message])", "Executes a result-less query against a given database" ], "sqlite_factory": [ @@ -10001,7 +10200,7 @@ var functionMap = { "Reads all remaining bytes (or up to maxlen bytes) from a stream and returns them as a string." ], "stream_get_filters": [ - "array stream_get_filters(void)", + "array stream_get_filters()", "Returns a list of registered filters" ], "stream_get_line": [ @@ -10265,7 +10464,7 @@ var functionMap = { "Free result memory" ], "sybase_get_last_message": [ - "string sybase_get_last_message(void)", + "string sybase_get_last_message()", "Returns the last message from server (over min_message_severity)" ], "sybase_min_client_severity": [ @@ -10349,7 +10548,7 @@ var functionMap = { "Returns the Number of Tidy accessibility warnings encountered for specified document." ], "tidy_clean_repair": [ - "boolean tidy_clean_repair()", + "bool tidy_clean_repair()", "Execute configured cleanup and repair operations on parsed markup" ], "tidy_config_count": [ @@ -10357,7 +10556,7 @@ var functionMap = { "Returns the Number of Tidy configuration errors encountered for specified document." ], "tidy_diagnose": [ - "boolean tidy_diagnose()", + "bool tidy_diagnose()", "Run configured diagnostics on parsed and repaired markup." ], "tidy_error_count": [ @@ -10373,7 +10572,7 @@ var functionMap = { "Get current Tidy configuarion" ], "tidy_get_error_buffer": [ - "string tidy_get_error_buffer([boolean detailed])", + "string tidy_get_error_buffer([bool detailed])", "Return warnings and errors which occured parsing the specified document" ], "tidy_get_head": [ @@ -10413,15 +10612,15 @@ var functionMap = { "Returns the value of the specified configuration option for the tidy document." ], "tidy_is_xhtml": [ - "boolean tidy_is_xhtml()", + "bool tidy_is_xhtml()", "Indicates if the document is a XHTML document." ], "tidy_is_xml": [ - "boolean tidy_is_xml()", + "bool tidy_is_xml()", "Indicates if the document is a generic (non HTML/XHTML) XML document." ], "tidy_parse_file": [ - "boolean tidy_parse_file(string file [, mixed config_options [, string encoding [, bool use_include_path]]])", + "bool tidy_parse_file(string file [, mixed config_options [, string encoding [, bool use_include_path]]])", "Parse markup in file or URI" ], "tidy_parse_string": [ @@ -10429,11 +10628,11 @@ var functionMap = { "Parse a document stored in a string" ], "tidy_repair_file": [ - "boolean tidy_repair_file(string filename [, mixed config_file [, string encoding [, bool use_include_path]]])", + "bool tidy_repair_file(string filename [, mixed config_file [, string encoding [, bool use_include_path]]])", "Repair a file using an optionally provided configuration file" ], "tidy_repair_string": [ - "boolean tidy_repair_string(string data [, mixed config_file [, string encoding]])", + "bool tidy_repair_string(string data [, mixed config_file [, string encoding]])", "Repair a string using an optionally provided configuration file" ], "tidy_warning_count": [ @@ -10441,7 +10640,7 @@ var functionMap = { "Returns the Number of Tidy warnings encountered for specified document." ], "time": [ - "int time(void)", + "int time()", "Return current UNIX timestamp" ], "time_nanosleep": [ @@ -10489,7 +10688,7 @@ var functionMap = { "Returns the Olson database version number." ], "tmpfile": [ - "resource tmpfile(void)", + "resource tmpfile()", "Create a temporary file that will be deleted automatically after use" ], "token_get_all": [ @@ -10557,7 +10756,7 @@ var functionMap = { "Takes a string representation of variable and recreates it" ], "unset": [ - "void unset (mixed var [, mixed var])", + "void unset(mixed var [, mixed var])", "Unset a given variable" ], "urldecode": [ @@ -10589,7 +10788,7 @@ var functionMap = { "Dumps a string representation of variable to output" ], "var_export": [ - "mixed var_export(mixed var [, bool return])", + "string var_export(mixed var [, bool return])", "Outputs or returns a string representation of a variable" ], "variant_abs": [ @@ -10717,7 +10916,7 @@ var functionMap = { "Return a formatted string" ], "wddx_add_vars": [ - "int wddx_add_vars(resource packet_id, mixed var_names [, mixed ...])", + "int wddx_add_vars(resource packet_id, mixed var_names [, mixed ...])", "Serializes given variables and adds them to packet given by packet_id" ], "wddx_deserialize": [ @@ -10741,7 +10940,7 @@ var functionMap = { "Creates a new packet and serializes given variables into a struct" ], "wordwrap": [ - "string wordwrap(string str [, int width [, string break [, boolean cut]]])", + "string wordwrap(string str [, int width [, string break [, bool cut]]])", "Wraps buffer to selected number of characters using string break char" ], "xml_error_string": [ @@ -10869,7 +11068,7 @@ var functionMap = { "Parses XML requests and call methods" ], "xmlrpc_server_create": [ - "resource xmlrpc_server_create(void)", + "resource xmlrpc_server_create()", "Creates an xmlrpc server" ], "xmlrpc_server_destroy": [ @@ -11057,51 +11256,51 @@ var functionMap = { "Write text - returns FALSE on error" ], "xsl_xsltprocessor_get_parameter": [ - "string xsl_xsltprocessor_get_parameter(string namespace, string name);", + "string xsl_xsltprocessor_get_parameter(string namespace, string name)", "" ], "xsl_xsltprocessor_has_exslt_support": [ - "bool xsl_xsltprocessor_has_exslt_support();", + "bool xsl_xsltprocessor_has_exslt_support()", "" ], "xsl_xsltprocessor_import_stylesheet": [ - "void xsl_xsltprocessor_import_stylesheet(domdocument doc);", - "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html# Since:" + "void xsl_xsltprocessor_import_stylesheet(domdocument doc)", + "" ], "xsl_xsltprocessor_register_php_functions": [ - "void xsl_xsltprocessor_register_php_functions([mixed $restrict]);", + "void xsl_xsltprocessor_register_php_functions([mixed $restrict])", "" ], "xsl_xsltprocessor_remove_parameter": [ - "bool xsl_xsltprocessor_remove_parameter(string namespace, string name);", + "bool xsl_xsltprocessor_remove_parameter(string namespace, string name)", "" ], "xsl_xsltprocessor_set_parameter": [ - "bool xsl_xsltprocessor_set_parameter(string namespace, mixed name [, string value]);", + "bool xsl_xsltprocessor_set_parameter(string namespace, mixed name [, string value])", "" ], "xsl_xsltprocessor_set_profiling": [ - "bool xsl_xsltprocessor_set_profiling(string filename) */", - "PHP_FUNCTION(xsl_xsltprocessor_set_profiling) { zval *id; xsl_object *intern; char *filename = NULL; int filename_len; DOM_GET_THIS(id); if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, \"s!\", &filename, &filename_len) == SUCCESS) { intern = (xsl_object *)zend_object_store_get_object(id TSRMLS_CC); if (intern->profiling) { efree(intern->profiling); } if (filename != NULL) { intern->profiling = estrndup(filename,filename_len); } else { intern->profiling = NULL; } RETURN_TRUE; } else { WRONG_PARAM_COUNT; } } /* }}} end xsl_xsltprocessor_set_profiling" + "bool xsl_xsltprocessor_set_profiling(string filename)", + "" ], "xsl_xsltprocessor_transform_to_doc": [ - "domdocument xsl_xsltprocessor_transform_to_doc(domnode doc);", - "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html# Since:" + "domdocument xsl_xsltprocessor_transform_to_doc(domnode doc)", + "" ], "xsl_xsltprocessor_transform_to_uri": [ - "int xsl_xsltprocessor_transform_to_uri(domdocument doc, string uri);", + "int xsl_xsltprocessor_transform_to_uri(domdocument doc, string uri)", "" ], "xsl_xsltprocessor_transform_to_xml": [ - "string xsl_xsltprocessor_transform_to_xml(domdocument doc);", + "string xsl_xsltprocessor_transform_to_xml(domdocument doc)", "" ], "zend_logo_guid": [ - "string zend_logo_guid(void)", + "string zend_logo_guid()", "Return the special ID used to request the Zend logo in phpinfo screens" ], "zend_version": [ - "string zend_version(void)", + "string zend_version()", "Get the version of the Zend Engine" ], "zip_close": [ @@ -11145,7 +11344,7 @@ var functionMap = { "Returns the next file in the archive" ], "zlib_get_coding_type": [ - "string zlib_get_coding_type(void)", + "string zlib_get_coding_type()", "Returns the coding type used for output compression" ] }; @@ -11196,7 +11395,9 @@ var variableMap = { "SERVER_PORT": 1, "SERVER_PROTOCOL": 1, "SERVER_SIGNATURE": 1, - "SERVER_SOFTWARE": 1 + "SERVER_SOFTWARE": 1, + "argv": 1, + "argc": 1 } }, "$_SESSION": { @@ -11204,6 +11405,12 @@ var variableMap = { }, "$GLOBALS": { type: "array" + }, + '$argv': { + type: "array" + }, + '$argc': { + type: "int" } }; @@ -11531,6 +11738,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/javascript"; + this.snippetFileId = "ace/snippets/javascript"; }).call(Mode.prototype); exports.Mode = Mode; @@ -11868,6 +12076,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/css"; + this.snippetFileId = "ace/snippets/css"; }).call(Mode.prototype); exports.Mode = Mode; @@ -12760,6 +12969,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/html"; + this.snippetFileId = "ace/snippets/html"; }).call(Mode.prototype); exports.Mode = Mode; @@ -12886,6 +13096,7 @@ oop.inherits(Mode, HtmlMode); }; this.$id = "ace/mode/php"; + this.snippetFileId = "ace/snippets/php"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-php_laravel_blade.js b/htdocs/includes/ace/src/mode-php_laravel_blade.js index cd09a1f11fa..b9393a8a281 100644 --- a/htdocs/includes/ace/src/mode-php_laravel_blade.js +++ b/htdocs/includes/ace/src/mode-php_laravel_blade.js @@ -2309,15 +2309,15 @@ var functionMap = { "Escapes single quote, double quotes and backslash characters in a string with backslashes" ], "apache_child_terminate": [ - "bool apache_child_terminate(void)", + "bool apache_child_terminate()", "Terminate apache process after this request" ], "apache_get_modules": [ - "array apache_get_modules(void)", + "array apache_get_modules()", "Get a list of loaded Apache modules" ], "apache_get_version": [ - "string apache_get_version(void)", + "string apache_get_version()", "Fetch Apache version" ], "apache_getenv": [ @@ -2349,7 +2349,7 @@ var functionMap = { "* fetch all headers that go out in case of an error or a subrequest" ], "apache_request_headers": [ - "array apache_request_headers(void)", + "array apache_request_headers()", "Fetch all HTTP request headers" ], "apache_request_headers_in": [ @@ -2365,7 +2365,7 @@ var functionMap = { "" ], "apache_request_log_error": [ - "boolean apache_request_log_error(string message, [long facility])", + "bool apache_request_log_error(string message, [long facility])", "" ], "apache_request_meets_conditions": [ @@ -2417,11 +2417,11 @@ var functionMap = { "" ], "apache_reset_timeout": [ - "bool apache_reset_timeout(void)", + "bool apache_reset_timeout()", "Reset the Apache write timer" ], "apache_response_headers": [ - "array apache_response_headers(void)", + "array apache_response_headers()", "Fetch all HTTP response headers" ], "apache_setenv": [ @@ -2508,6 +2508,14 @@ var functionMap = { "array array_keys(array input [, mixed search_value[, bool strict]])", "Return just the keys from the input array, optionally only for the specified search_value" ], + "array_key_first": [ + "mixed array_key_first(array arr)", + "Returns the first key of arr if the array is not empty; NULL otherwise" + ], + "array_key_last": [ + "mixed array_key_last(array arr)", + "Returns the last key of arr if the array is not empty; NULL otherwise" + ], "array_map": [ "array array_map(mixed callback, array input1 [, array input2 ,...])", "Applies the callback to the elements in given arrays." @@ -2865,7 +2873,7 @@ var functionMap = { "Change file mode" ], "chown": [ - "bool chown (string filename, mixed user)", + "bool chown(string filename, mixed user)", "Change file owner" ], "chr": [ @@ -2893,7 +2901,7 @@ var functionMap = { "Return all classes and interfaces implemented by SPL" ], "class_parents": [ - "array class_parents(object instance [, boolean autoload = true])", + "array class_parents(object instance [, bool autoload = true])", "Return an array containing the names of all parent classes" ], "clearstatcache": [ @@ -2905,7 +2913,7 @@ var functionMap = { "Close directory connection identified by the dir_handle" ], "closelog": [ - "bool closelog(void)", + "bool closelog()", "Close connection to system logger" ], "collator_asort": [ @@ -2997,11 +3005,11 @@ var functionMap = { "Return a string to confirm that the module is compiled in" ], "connection_aborted": [ - "int connection_aborted(void)", + "int connection_aborted()", "Returns true if client disconnected" ], "connection_status": [ - "int connection_status(void)", + "int connection_status()", "Returns the connection status bitfield" ], "constant": [ @@ -3046,7 +3054,7 @@ var functionMap = { ], "create_function": [ "string create_function(string args, string code)", - "Creates an anonymous function, and returns its name (funny, eh?)" + "Creates an anonymous function, and returns its name" ], "crypt": [ "string crypt(string str [, string salt])", @@ -3145,7 +3153,7 @@ var functionMap = { "Get information about the current transfers" ], "curl_multi_init": [ - "resource curl_multi_init(void)", + "resource curl_multi_init()", "Returns a new cURL multi handle" ], "curl_multi_remove_handle": [ @@ -3341,7 +3349,7 @@ var functionMap = { "* Set formatter pattern." ], "datefmt_set_timezone_id": [ - "boolean datefmt_set_timezone_id( IntlDateFormatter $mf,$timezone_id)", + "bool datefmt_set_timezone_id( IntlDateFormatter $mf,$timezone_id)", "* Set formatter timezone_id." ], "dba_close": [ @@ -3409,7 +3417,7 @@ var functionMap = { "Return the translation of msgid for domain_name and category, or msgid unaltered if a translation does not exist" ], "dcngettext": [ - "string dcngettext (string domain, string msgid1, string msgid2, int n, int category)", + "string dcngettext(string domain, string msgid1, string msgid2, int n, int category)", "Plural version of dcgettext()" ], "debug_backtrace": [ @@ -3417,44 +3425,231 @@ var functionMap = { "Return backtrace as array" ], "debug_print_backtrace": [ - "void debug_print_backtrace(void) */", - "ZEND_FUNCTION(debug_print_backtrace) { zend_execute_data *ptr, *skip; int lineno; char *function_name; char *filename; char *class_name = NULL; char *call_type; char *include_filename = NULL; zval *arg_array = NULL; int indent = 0; if (zend_parse_parameters_none() == FAILURE) { return; } ptr = EG(current_execute_data);", + "void debug_print_backtrace()", + "Prints a PHP backtrace" + ], + "debug_zval_dump": [ + "void debug_zval_dump(mixed var)", + "Dumps a string representation of an internal Zend value to output" + ], + "decbin": [ + "string decbin(int decimal_number)", + "Returns a string containing a binary representation of the number" + ], + "dechex": [ + "string dechex(int decimal_number)", + "Returns a string containing a hexadecimal representation of the given number" + ], + "decoct": [ + "string decoct(int decimal_number)", + "Returns a string containing an octal representation of the given number" + ], + "define": [ + "bool define(string constant_name, mixed value, bool case_insensitive=false)", + "Define a new constant" + ], + "define_syslog_variables": [ + "void define_syslog_variables()", + "Initializes all syslog-related variables" + ], + "defined": [ + "bool defined(string constant_name)", + "Check whether a constant exists" + ], + "deg2rad": [ + "float deg2rad(float number)", + "Converts the number in degrees to the radian equivalent" + ], + "dgettext": [ + "string dgettext(string domain_name, string msgid)", + "Return the translation of msgid for domain_name, or msgid unaltered if a translation does not exist" + ], + "die": [ + "void die([mixed status])", + "Output a message and terminate the current script" + ], + "dir": [ + "object dir(string directory[, resource context])", + "Directory class with properties, handle and class and methods read, rewind and close" + ], + "dirname": [ + "string dirname(string path)", + "Returns the directory name component of the path" + ], + "disk_free_space": [ + "float disk_free_space(string path)", + "Get free disk space for filesystem that path is on" + ], + "disk_total_space": [ + "float disk_total_space(string path)", + "Get total disk space for filesystem that path is on" + ], + "display_disabled_function": [ + "void display_disabled_function()", + "Dummy function which displays an error when a disabled function is called." + ], + "dl": [ + "int dl(string extension_filename)", + "Load a PHP extension at runtime" + ], + "dngettext": [ + "string dngettext(string domain, string msgid1, string msgid2, int count)", + "Plural version of dgettext()" + ], + "dns_check_record": [ + "bool dns_check_record(string host [, string type])", + "Check DNS records corresponding to a given Internet host name or IP address" + ], + "dns_get_mx": [ + "bool dns_get_mx(string hostname, array mxhosts [, array weight])", + "Get MX records corresponding to a given Internet host name" + ], + "dns_get_record": [ + "array|false dns_get_record(string hostname [, int type[, array authns, array addtl]])", + "Get any Resource Record corresponding to a given Internet host name" + ], + "dom_attr_is_id": [ + "bool dom_attr_is_id()", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Attr-isId Since: DOM Level 3" + ], + "dom_characterdata_append_data": [ + "void dom_characterdata_append_data(string arg)", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-32791A2F Since:" + ], + "dom_characterdata_delete_data": [ + "void dom_characterdata_delete_data(int offset, int count)", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-7C603781 Since:" + ], + "dom_characterdata_insert_data": [ + "void dom_characterdata_insert_data(int offset, string arg)", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-3EDB695F Since:" + ], + "dom_characterdata_replace_data": [ + "void dom_characterdata_replace_data(int offset, int count, string arg)", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-E5CBA7FB Since:" + ], + "dom_characterdata_substring_data": [ + "string dom_characterdata_substring_data(int offset, int count)", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-6531BCCF Since:" + ], + "dom_document_adopt_node": [ + "DOMNode dom_document_adopt_node(DOMNode source)", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Document3-adoptNode Since: DOM Level 3" + ], + "dom_document_create_attribute": [ + "DOMAttr dom_document_create_attribute(string name)", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1084891198 Since:" + ], + "dom_document_create_attribute_ns": [ + "DOMAttr dom_document_create_attribute_ns(string namespaceURI, string qualifiedName)", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-DocCrAttrNS Since: DOM Level 2" + ], + "dom_document_create_cdatasection": [ + "DOMCdataSection dom_document_create_cdatasection(string data)", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-D26C0AF8 Since:" + ], + "dom_document_create_comment": [ + "DOMComment dom_document_create_comment(string data)", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1334481328 Since:" + ], + "dom_document_create_document_fragment": [ + "DOMDocumentFragment dom_document_create_document_fragment()", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-35CB04B5 Since:" + ], + "dom_document_create_element": [ + "DOMElement dom_document_create_element(string tagName [, string value])", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-2141741547 Since:" + ], + "dom_document_create_element_ns": [ + "DOMElement dom_document_create_element_ns(string namespaceURI, string qualifiedName [,string value])", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-DocCrElNS Since: DOM Level 2" + ], + "dom_document_create_entity_reference": [ + "DOMEntityReference dom_document_create_entity_reference(string name)", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-392B75AE Since:" + ], + "dom_document_create_processing_instruction": [ + "DOMProcessingInstruction dom_document_create_processing_instruction(string target, string data)", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-135944439 Since:" + ], + "dom_document_create_text_node": [ + "DOMText dom_document_create_text_node(string data)", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1975348127 Since:" + ], + "dom_document_get_element_by_id": [ + "DOMElement dom_document_get_element_by_id(string elementId)", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-getElBId Since: DOM Level 2" + ], + "dom_document_get_elements_by_tag_name": [ + "DOMNodeList dom_document_get_elements_by_tag_name(string tagname)", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-A6C9094 Since:" + ], + "dom_document_get_elements_by_tag_name_ns": [ + "DOMNodeList dom_document_get_elements_by_tag_name_ns(string namespaceURI, string localName)", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-getElBTNNS Since: DOM Level 2" + ], + "dom_document_import_node": [ + "DOMNode dom_document_import_node(DOMNode importedNode, bool deep)", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Core-Document-importNode Since: DOM Level 2" + ], + "dom_document_load": [ + "DOMNode dom_document_load(string source [, int options])", + "URL: http://www.w3.org/TR/DOM-Level-3-LS/load-save.html#LS-DocumentLS-load Since: DOM Level 3" + ], + "dom_document_load_html": [ + "DOMNode dom_document_load_html(string source)", + "Since: DOM extended" + ], + "dom_document_load_html_file": [ + "DOMNode dom_document_load_html_file(string source)", + "Since: DOM extended" + ], + "dom_document_loadxml": [ + "DOMNode dom_document_loadxml(string source [, int options])", + "URL: http://www.w3.org/TR/DOM-Level-3-LS/load-save.html#LS-DocumentLS-loadXML Since: DOM Level 3" + ], + "dom_document_normalize_document": [ + "void dom_document_normalize_document()", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Document3-normalizeDocument Since: DOM Level 3" + ], + "dom_document_relaxNG_validate_file": [ + "bool dom_document_relaxNG_validate_file(string filename); */", "PHP_FUNCTION(dom_document_relaxNG_validate_file) { _dom_document_relaxNG_validate(INTERNAL_FUNCTION_PARAM_PASSTHRU, DOM_LOAD_FILE); } /* }}} end dom_document_relaxNG_validate_file" ], "dom_document_relaxNG_validate_xml": [ - "boolean dom_document_relaxNG_validate_xml(string source); */", + "bool dom_document_relaxNG_validate_xml(string source); */", "PHP_FUNCTION(dom_document_relaxNG_validate_xml) { _dom_document_relaxNG_validate(INTERNAL_FUNCTION_PARAM_PASSTHRU, DOM_LOAD_STRING); } /* }}} end dom_document_relaxNG_validate_xml" ], "dom_document_rename_node": [ - "DOMNode dom_document_rename_node(node n, string namespaceURI, string qualifiedName);", + "DOMNode dom_document_rename_node(node n, string namespaceURI, string qualifiedName)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Document3-renameNode Since: DOM Level 3" ], "dom_document_save": [ - "int dom_document_save(string file);", + "int dom_document_save(string file)", "Convenience method to save to file" ], "dom_document_save_html": [ - "string dom_document_save_html();", + "string dom_document_save_html()", "Convenience method to output as html" ], "dom_document_save_html_file": [ - "int dom_document_save_html_file(string file);", + "int dom_document_save_html_file(string file)", "Convenience method to save to file as html" ], "dom_document_savexml": [ - "string dom_document_savexml([node n]);", + "string dom_document_savexml([node n])", "URL: http://www.w3.org/TR/DOM-Level-3-LS/load-save.html#LS-DocumentLS-saveXML Since: DOM Level 3" ], "dom_document_schema_validate": [ - "boolean dom_document_schema_validate(string source); */", + "bool dom_document_schema_validate(string source); */", "PHP_FUNCTION(dom_document_schema_validate_xml) { _dom_document_schema_validate(INTERNAL_FUNCTION_PARAM_PASSTHRU, DOM_LOAD_STRING); } /* }}} end dom_document_schema_validate" ], "dom_document_schema_validate_file": [ - "boolean dom_document_schema_validate_file(string filename); */", + "bool dom_document_schema_validate_file(string filename); */", "PHP_FUNCTION(dom_document_schema_validate_file) { _dom_document_schema_validate(INTERNAL_FUNCTION_PARAM_PASSTHRU, DOM_LOAD_FILE); } /* }}} end dom_document_schema_validate_file" ], "dom_document_validate": [ - "boolean dom_document_validate();", + "bool dom_document_validate()", "Since: DOM extended" ], "dom_document_xinclude": [ @@ -3462,123 +3657,123 @@ var functionMap = { "Substitutues xincludes in a DomDocument" ], "dom_domconfiguration_can_set_parameter": [ - "boolean dom_domconfiguration_can_set_parameter(string name, domuserdata value);", + "bool dom_domconfiguration_can_set_parameter(string name, domuserdata value)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#DOMConfiguration-canSetParameter Since:" ], "dom_domconfiguration_get_parameter": [ - "domdomuserdata dom_domconfiguration_get_parameter(string name);", + "domdomuserdata dom_domconfiguration_get_parameter(string name)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#DOMConfiguration-getParameter Since:" ], "dom_domconfiguration_set_parameter": [ - "dom_void dom_domconfiguration_set_parameter(string name, domuserdata value);", + "dom_void dom_domconfiguration_set_parameter(string name, domuserdata value)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#DOMConfiguration-property Since:" ], "dom_domerrorhandler_handle_error": [ - "dom_boolean dom_domerrorhandler_handle_error(domerror error);", + "dom_bool dom_domerrorhandler_handle_error(domerror error)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-ERRORS-DOMErrorHandler-handleError Since:" ], "dom_domimplementation_create_document": [ - "DOMDocument dom_domimplementation_create_document(string namespaceURI, string qualifiedName, DOMDocumentType doctype);", + "DOMDocument dom_domimplementation_create_document(string namespaceURI, string qualifiedName, DOMDocumentType doctype)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Level-2-Core-DOM-createDocument Since: DOM Level 2" ], "dom_domimplementation_create_document_type": [ - "DOMDocumentType dom_domimplementation_create_document_type(string qualifiedName, string publicId, string systemId);", + "DOMDocumentType dom_domimplementation_create_document_type(string qualifiedName, string publicId, string systemId)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Level-2-Core-DOM-createDocType Since: DOM Level 2" ], "dom_domimplementation_get_feature": [ - "DOMNode dom_domimplementation_get_feature(string feature, string version);", + "DOMNode dom_domimplementation_get_feature(string feature, string version)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#DOMImplementation3-getFeature Since: DOM Level 3" ], "dom_domimplementation_has_feature": [ - "boolean dom_domimplementation_has_feature(string feature, string version);", + "bool dom_domimplementation_has_feature(string feature, string version)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-5CED94D7 Since:" ], "dom_domimplementationlist_item": [ - "domdomimplementation dom_domimplementationlist_item(int index);", + "domdomimplementation dom_domimplementationlist_item(int index)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#DOMImplementationList-item Since:" ], "dom_domimplementationsource_get_domimplementation": [ - "domdomimplementation dom_domimplementationsource_get_domimplementation(string features);", + "domdomimplementation dom_domimplementationsource_get_domimplementation(string features)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-getDOMImpl Since:" ], "dom_domimplementationsource_get_domimplementations": [ - "domimplementationlist dom_domimplementationsource_get_domimplementations(string features);", + "domimplementationlist dom_domimplementationsource_get_domimplementations(string features)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-getDOMImpls Since:" ], "dom_domstringlist_item": [ - "domstring dom_domstringlist_item(int index);", + "domstring dom_domstringlist_item(int index)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#DOMStringList-item Since:" ], "dom_element_get_attribute": [ - "string dom_element_get_attribute(string name);", + "string dom_element_get_attribute(string name)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-666EE0F9 Since:" ], "dom_element_get_attribute_node": [ - "DOMAttr dom_element_get_attribute_node(string name);", + "DOMAttr dom_element_get_attribute_node(string name)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-217A91B8 Since:" ], "dom_element_get_attribute_node_ns": [ - "DOMAttr dom_element_get_attribute_node_ns(string namespaceURI, string localName);", + "DOMAttr dom_element_get_attribute_node_ns(string namespaceURI, string localName)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-ElGetAtNodeNS Since: DOM Level 2" ], "dom_element_get_attribute_ns": [ - "string dom_element_get_attribute_ns(string namespaceURI, string localName);", + "string dom_element_get_attribute_ns(string namespaceURI, string localName)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-ElGetAttrNS Since: DOM Level 2" ], "dom_element_get_elements_by_tag_name": [ - "DOMNodeList dom_element_get_elements_by_tag_name(string name);", + "DOMNodeList dom_element_get_elements_by_tag_name(string name)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1938918D Since:" ], "dom_element_get_elements_by_tag_name_ns": [ - "DOMNodeList dom_element_get_elements_by_tag_name_ns(string namespaceURI, string localName);", + "DOMNodeList dom_element_get_elements_by_tag_name_ns(string namespaceURI, string localName)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-A6C90942 Since: DOM Level 2" ], "dom_element_has_attribute": [ - "boolean dom_element_has_attribute(string name);", + "bool dom_element_has_attribute(string name)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-ElHasAttr Since: DOM Level 2" ], "dom_element_has_attribute_ns": [ - "boolean dom_element_has_attribute_ns(string namespaceURI, string localName);", + "bool dom_element_has_attribute_ns(string namespaceURI, string localName)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-ElHasAttrNS Since: DOM Level 2" ], "dom_element_remove_attribute": [ - "void dom_element_remove_attribute(string name);", + "void dom_element_remove_attribute(string name)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-6D6AC0F9 Since:" ], "dom_element_remove_attribute_node": [ - "DOMAttr dom_element_remove_attribute_node(DOMAttr oldAttr);", + "DOMAttr dom_element_remove_attribute_node(DOMAttr oldAttr)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-D589198 Since:" ], "dom_element_remove_attribute_ns": [ - "void dom_element_remove_attribute_ns(string namespaceURI, string localName);", + "void dom_element_remove_attribute_ns(string namespaceURI, string localName)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-ElRemAtNS Since: DOM Level 2" ], "dom_element_set_attribute": [ - "void dom_element_set_attribute(string name, string value);", + "void dom_element_set_attribute(string name, string value)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-F68F082 Since:" ], "dom_element_set_attribute_node": [ - "DOMAttr dom_element_set_attribute_node(DOMAttr newAttr);", + "DOMAttr dom_element_set_attribute_node(DOMAttr newAttr)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-887236154 Since:" ], "dom_element_set_attribute_node_ns": [ - "DOMAttr dom_element_set_attribute_node_ns(DOMAttr newAttr);", + "DOMAttr dom_element_set_attribute_node_ns(DOMAttr newAttr)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-ElSetAtNodeNS Since: DOM Level 2" ], "dom_element_set_attribute_ns": [ - "void dom_element_set_attribute_ns(string namespaceURI, string qualifiedName, string value);", + "void dom_element_set_attribute_ns(string namespaceURI, string qualifiedName, string value)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-ElSetAttrNS Since: DOM Level 2" ], "dom_element_set_id_attribute": [ - "void dom_element_set_id_attribute(string name, boolean isId);", + "void dom_element_set_id_attribute(string name, bool isId)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-ElSetIdAttr Since: DOM Level 3" ], "dom_element_set_id_attribute_node": [ - "void dom_element_set_id_attribute_node(attr idAttr, boolean isId);", + "void dom_element_set_id_attribute_node(attr idAttr, bool isId)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-ElSetIdAttrNode Since: DOM Level 3" ], "dom_element_set_id_attribute_ns": [ - "void dom_element_set_id_attribute_ns(string namespaceURI, string localName, boolean isId);", + "void dom_element_set_id_attribute_ns(string namespaceURI, string localName, bool isId)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-ElSetIdAttrNS Since: DOM Level 3" ], "dom_import_simplexml": [ @@ -3586,156 +3781,156 @@ var functionMap = { "Get a simplexml_element object from dom to allow for processing" ], "dom_namednodemap_get_named_item": [ - "DOMNode dom_namednodemap_get_named_item(string name);", + "DOMNode dom_namednodemap_get_named_item(string name)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1074577549 Since:" ], "dom_namednodemap_get_named_item_ns": [ - "DOMNode dom_namednodemap_get_named_item_ns(string namespaceURI, string localName);", + "DOMNode dom_namednodemap_get_named_item_ns(string namespaceURI, string localName)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-getNamedItemNS Since: DOM Level 2" ], "dom_namednodemap_item": [ - "DOMNode dom_namednodemap_item(int index);", + "DOMNode dom_namednodemap_item(int index)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-349467F9 Since:" ], "dom_namednodemap_remove_named_item": [ - "DOMNode dom_namednodemap_remove_named_item(string name);", + "DOMNode dom_namednodemap_remove_named_item(string name)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-D58B193 Since:" ], "dom_namednodemap_remove_named_item_ns": [ - "DOMNode dom_namednodemap_remove_named_item_ns(string namespaceURI, string localName);", + "DOMNode dom_namednodemap_remove_named_item_ns(string namespaceURI, string localName)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-removeNamedItemNS Since: DOM Level 2" ], "dom_namednodemap_set_named_item": [ - "DOMNode dom_namednodemap_set_named_item(DOMNode arg);", + "DOMNode dom_namednodemap_set_named_item(DOMNode arg)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1025163788 Since:" ], "dom_namednodemap_set_named_item_ns": [ - "DOMNode dom_namednodemap_set_named_item_ns(DOMNode arg);", + "DOMNode dom_namednodemap_set_named_item_ns(DOMNode arg)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-setNamedItemNS Since: DOM Level 2" ], "dom_namelist_get_name": [ - "string dom_namelist_get_name(int index);", + "string dom_namelist_get_name(int index)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#NameList-getName Since:" ], "dom_namelist_get_namespace_uri": [ - "string dom_namelist_get_namespace_uri(int index);", + "string dom_namelist_get_namespace_uri(int index)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#NameList-getNamespaceURI Since:" ], "dom_node_append_child": [ - "DomNode dom_node_append_child(DomNode newChild);", + "DomNode dom_node_append_child(DomNode newChild)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-184E7107 Since:" ], "dom_node_clone_node": [ - "DomNode dom_node_clone_node(boolean deep);", + "DomNode dom_node_clone_node(bool deep)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-3A0ED0A4 Since:" ], "dom_node_compare_document_position": [ - "short dom_node_compare_document_position(DomNode other);", + "short dom_node_compare_document_position(DomNode other)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Node3-compareDocumentPosition Since: DOM Level 3" ], "dom_node_get_feature": [ - "DomNode dom_node_get_feature(string feature, string version);", + "DomNode dom_node_get_feature(string feature, string version)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Node3-getFeature Since: DOM Level 3" ], "dom_node_get_user_data": [ - "mixed dom_node_get_user_data(string key);", + "mixed dom_node_get_user_data(string key)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Node3-getUserData Since: DOM Level 3" ], "dom_node_has_attributes": [ - "boolean dom_node_has_attributes();", + "bool dom_node_has_attributes()", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-NodeHasAttrs Since: DOM Level 2" ], "dom_node_has_child_nodes": [ - "boolean dom_node_has_child_nodes();", + "bool dom_node_has_child_nodes()", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-810594187 Since:" ], "dom_node_insert_before": [ - "domnode dom_node_insert_before(DomNode newChild, DomNode refChild);", + "domnode dom_node_insert_before(DomNode newChild, DomNode refChild)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-952280727 Since:" ], "dom_node_is_default_namespace": [ - "boolean dom_node_is_default_namespace(string namespaceURI);", + "bool dom_node_is_default_namespace(string namespaceURI)", "URL: http://www.w3.org/TR/DOM-Level-3-Core/core.html#Node3-isDefaultNamespace Since: DOM Level 3" ], "dom_node_is_equal_node": [ - "boolean dom_node_is_equal_node(DomNode arg);", + "bool dom_node_is_equal_node(DomNode arg)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Node3-isEqualNode Since: DOM Level 3" ], "dom_node_is_same_node": [ - "boolean dom_node_is_same_node(DomNode other);", + "bool dom_node_is_same_node(DomNode other)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Node3-isSameNode Since: DOM Level 3" ], "dom_node_is_supported": [ - "boolean dom_node_is_supported(string feature, string version);", + "bool dom_node_is_supported(string feature, string version)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Level-2-Core-Node-supports Since: DOM Level 2" ], "dom_node_lookup_namespace_uri": [ - "string dom_node_lookup_namespace_uri(string prefix);", + "string dom_node_lookup_namespace_uri(string prefix)", "URL: http://www.w3.org/TR/DOM-Level-3-Core/core.html#Node3-lookupNamespaceURI Since: DOM Level 3" ], "dom_node_lookup_prefix": [ - "string dom_node_lookup_prefix(string namespaceURI);", + "string dom_node_lookup_prefix(string namespaceURI)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Node3-lookupNamespacePrefix Since: DOM Level 3" ], "dom_node_normalize": [ - "void dom_node_normalize();", + "void dom_node_normalize()", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-normalize Since:" ], "dom_node_remove_child": [ - "DomNode dom_node_remove_child(DomNode oldChild);", + "DomNode dom_node_remove_child(DomNode oldChild)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1734834066 Since:" ], "dom_node_replace_child": [ - "DomNode dom_node_replace_child(DomNode newChild, DomNode oldChild);", + "DomNode dom_node_replace_child(DomNode newChild, DomNode oldChild)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-785887307 Since:" ], "dom_node_set_user_data": [ - "mixed dom_node_set_user_data(string key, mixed data, userdatahandler handler);", + "mixed dom_node_set_user_data(string key, mixed data, userdatahandler handler)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Node3-setUserData Since: DOM Level 3" ], "dom_nodelist_item": [ - "DOMNode dom_nodelist_item(int index);", + "DOMNode dom_nodelist_item(int index)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-844377136 Since:" ], "dom_string_extend_find_offset16": [ - "int dom_string_extend_find_offset16(int offset32);", + "int dom_string_extend_find_offset16(int offset32)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#i18n-methods-StringExtend-findOffset16 Since:" ], "dom_string_extend_find_offset32": [ - "int dom_string_extend_find_offset32(int offset16);", + "int dom_string_extend_find_offset32(int offset16)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#i18n-methods-StringExtend-findOffset32 Since:" ], "dom_text_is_whitespace_in_element_content": [ - "boolean dom_text_is_whitespace_in_element_content();", + "bool dom_text_is_whitespace_in_element_content()", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Text3-isWhitespaceInElementContent Since: DOM Level 3" ], "dom_text_replace_whole_text": [ - "DOMText dom_text_replace_whole_text(string content);", + "DOMText dom_text_replace_whole_text(string content)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Text3-replaceWholeText Since: DOM Level 3" ], "dom_text_split_text": [ - "DOMText dom_text_split_text(int offset);", + "DOMText dom_text_split_text(int offset)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-38853C1D Since:" ], "dom_userdatahandler_handle": [ - "dom_void dom_userdatahandler_handle(short operation, string key, domobject data, node src, node dst);", + "dom_void dom_userdatahandler_handle(short operation, string key, domobject data, node src, node dst)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-handleUserDataEvent Since:" ], "dom_xpath_evaluate": [ - "mixed dom_xpath_evaluate(string expr [,DOMNode context]); */", - "PHP_FUNCTION(dom_xpath_evaluate) { php_xpath_eval(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_DOM_XPATH_EVALUATE); } /* }}} end dom_xpath_evaluate" + "mixed dom_xpath_evaluate(string expr [,DOMNode context])", + "" ], "dom_xpath_query": [ - "DOMNodeList dom_xpath_query(string expr [,DOMNode context]); */", - "PHP_FUNCTION(dom_xpath_query) { php_xpath_eval(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_DOM_XPATH_QUERY); } /* }}} end dom_xpath_query" + "DOMNodeList dom_xpath_query(string expr [,DOMNode context])", + "" ], "dom_xpath_register_ns": [ - "boolean dom_xpath_register_ns(string prefix, string uri); */", - "PHP_FUNCTION(dom_xpath_register_ns) { zval *id; xmlXPathContextPtr ctxp; int prefix_len, ns_uri_len; dom_xpath_object *intern; unsigned char *prefix, *ns_uri; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), \"Oss\", &id, dom_xpath_class_entry, &prefix, &prefix_len, &ns_uri, &ns_uri_len) == FAILURE) { return; } intern = (dom_xpath_object *)zend_object_store_get_object(id TSRMLS_CC); ctxp = (xmlXPathContextPtr) intern->ptr; if (ctxp == NULL) { php_error_docref(NULL TSRMLS_CC, E_WARNING, \"Invalid XPath Context\"); RETURN_FALSE; } if (xmlXPathRegisterNs(ctxp, prefix, ns_uri) != 0) { RETURN_FALSE } RETURN_TRUE; } /* }}}" + "bool dom_xpath_register_ns(string prefix, string uri)", + "" ], "dom_xpath_register_php_functions": [ - "void dom_xpath_register_php_functions() */", - "PHP_FUNCTION(dom_xpath_register_php_functions) { zval *id; dom_xpath_object *intern; zval *array_value, **entry, *new_string; int name_len = 0; char *name; DOM_GET_THIS(id); if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, \"a\", &array_value) == SUCCESS) { intern = (dom_xpath_object *)zend_object_store_get_object(id TSRMLS_CC); zend_hash_internal_pointer_reset(Z_ARRVAL_P(array_value)); while (zend_hash_get_current_data(Z_ARRVAL_P(array_value), (void **)&entry) == SUCCESS) { SEPARATE_ZVAL(entry); convert_to_string_ex(entry); MAKE_STD_ZVAL(new_string); ZVAL_LONG(new_string,1); zend_hash_update(intern->registered_phpfunctions, Z_STRVAL_PP(entry), Z_STRLEN_PP(entry) + 1, &new_string, sizeof(zval*), NULL); zend_hash_move_forward(Z_ARRVAL_P(array_value)); } intern->registerPhpFunctions = 2; RETURN_TRUE; } else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, \"s\", &name, &name_len) == SUCCESS) { intern = (dom_xpath_object *)zend_object_store_get_object(id TSRMLS_CC); MAKE_STD_ZVAL(new_string); ZVAL_LONG(new_string,1); zend_hash_update(intern->registered_phpfunctions, name, name_len + 1, &new_string, sizeof(zval*), NULL); intern->registerPhpFunctions = 2; } else { intern = (dom_xpath_object *)zend_object_store_get_object(id TSRMLS_CC); intern->registerPhpFunctions = 1; } } /* }}} end dom_xpath_register_php_functions" + "void dom_xpath_register_php_functions()", + "" ], "each": [ "array each(array arr)", @@ -3754,7 +3949,7 @@ var functionMap = { "Output one or more strings" ], "empty": [ - "bool empty( mixed var )", + "bool empty(mixed var)", "Determine whether a variable is empty" ], "enchant_broker_describe": [ @@ -3766,7 +3961,7 @@ var functionMap = { "Whether a dictionary exists or not. Using non-empty tag" ], "enchant_broker_free": [ - "boolean enchant_broker_free(resource broker)", + "bool enchant_broker_free(resource broker)", "Destroys the broker object and its dictionnaries" ], "enchant_broker_free_dict": [ @@ -4062,7 +4257,7 @@ var functionMap = { "Returns the next lowest integer value from the number" ], "flush": [ - "void flush(void)", + "void flush()", "Flush the output buffer" ], "fmod": [ @@ -4270,7 +4465,7 @@ var functionMap = { "Get an array of the arguments that were passed to the function" ], "func_num_args": [ - "int func_num_args(void)", + "int func_num_args()", "Get the number of arguments that were passed to the function" ], "function ": ["", ""], @@ -4284,19 +4479,19 @@ var functionMap = { "Binary-safe file write" ], "gc_collect_cycles": [ - "int gc_collect_cycles(void)", + "int gc_collect_cycles()", "Forces collection of any existing garbage cycles. Returns number of freed zvals" ], "gc_disable": [ - "void gc_disable(void)", + "void gc_disable()", "Deactivates the circular reference collector" ], "gc_enable": [ - "void gc_enable(void)", + "void gc_enable()", "Activates the circular reference collector" ], "gc_enabled": [ - "void gc_enabled(void)", + "void gc_enabled()", "Returns status of the circular reference collector" ], "gd_info": [ @@ -4305,7 +4500,7 @@ var functionMap = { ], "getKeywords": [ "static array getKeywords(string $locale) {", - "* return an associative array containing keyword-value * pairs for this locale. The keys are keys to the array (doh!) * }}}" + "* return an associative array containing keyword-value * pairs for this locale. The keys are keys to the array * }}}" ], "get_browser": [ "mixed get_browser([string browser_name [, bool return_array]])", @@ -4332,7 +4527,7 @@ var functionMap = { "Returns an array of default properties of the class." ], "get_current_user": [ - "string get_current_user(void)", + "string get_current_user()", "Get the name of the owner of the current PHP script" ], "get_declared_classes": [ @@ -4348,11 +4543,11 @@ var functionMap = { "Return an array containing the names and values of all defined constants" ], "get_defined_functions": [ - "array get_defined_functions(void)", + "array get_defined_functions()", "Returns an array of all defined functions" ], "get_defined_vars": [ - "array get_defined_vars(void)", + "array get_defined_vars()", "Returns an associative array of names and values of all currently defined variable names (variables in the current scope)" ], "get_display_language": [ @@ -4388,7 +4583,7 @@ var functionMap = { "Get the current include_path configuration option" ], "get_included_files": [ - "array get_included_files(void)", + "array get_included_files()", "Returns an array with the file names that were include_once()'d" ], "get_loaded_extensions": [ @@ -4396,11 +4591,11 @@ var functionMap = { "Return an array containing names of loaded extensions" ], "get_magic_quotes_gpc": [ - "int get_magic_quotes_gpc(void)", + "int get_magic_quotes_gpc()", "Get the current active configuration setting of magic_quotes_gpc" ], "get_magic_quotes_runtime": [ - "int get_magic_quotes_runtime(void)", + "int get_magic_quotes_runtime()", "Get the current active configuration setting of magic_quotes_runtime" ], "get_meta_tags": [ @@ -4420,11 +4615,11 @@ var functionMap = { "Get the resource type name for a given resource" ], "getallheaders": [ - "array getallheaders(void)", + "array getallheaders()", "" ], "getcwd": [ - "mixed getcwd(void)", + "mixed getcwd()", "Gets the current directory" ], "getdate": [ @@ -4456,23 +4651,23 @@ var functionMap = { "Get the size of an image as 4-element array" ], "getlastmod": [ - "int getlastmod(void)", + "int getlastmod()", "Get time of last page modification" ], "getmygid": [ - "int getmygid(void)", + "int getmygid()", "Get PHP script owner's GID" ], "getmyinode": [ - "int getmyinode(void)", + "int getmyinode()", "Get the inode of the current script being parsed" ], "getmypid": [ - "int getmypid(void)", + "int getmypid()", "Get current process ID" ], "getmyuid": [ - "int getmyuid(void)", + "int getmyuid()", "Get PHP script owner's UID" ], "getopt": [ @@ -4488,7 +4683,7 @@ var functionMap = { "Returns protocol name associated with protocol number proto" ], "getrandmax": [ - "int getrandmax(void)", + "int getrandmax()", "Returns the maximum value a random number can have" ], "getrusage": [ @@ -4764,7 +4959,7 @@ var functionMap = { "Generate a hash of a given input string Returns lowercase hexits by default" ], "hash_algos": [ - "array hash_algos(void)", + "array hash_algos()", "Return a list of registered hashing algorithms" ], "hash_copy": [ @@ -4812,7 +5007,7 @@ var functionMap = { "Removes an HTTP header previously set using header()" ], "headers_list": [ - "array headers_list(void)", + "array headers_list()", "Return list of headers to be sent / already sent" ], "headers_sent": [ @@ -4940,11 +5135,11 @@ var functionMap = { "Drop an InterBase database" ], "ibase_errcode": [ - "int ibase_errcode(void)", + "int ibase_errcode()", "Return error code" ], "ibase_errmsg": [ - "string ibase_errmsg(void)", + "string ibase_errmsg()", "Return error message" ], "ibase_execute": [ @@ -5413,7 +5608,7 @@ var functionMap = { ], "imagepsextendfont": [ "bool imagepsextendfont(resource font_index, float extend)", - "Extend or or condense (if extend < 1) a font" + "Extend or or condense if (extend < 1) a font" ], "imagepsfreefont": [ "bool imagepsfreefont(resource font_index)", @@ -5492,7 +5687,7 @@ var functionMap = { "Write text to the image using a TrueType font" ], "imagetypes": [ - "int imagetypes(void)", + "int imagetypes()", "Return the types of images supported in a bitfield - 1=GIF, 2=JPEG, 4=PNG, 8=WBMP, 16=XPM" ], "imagewbmp": [ @@ -5508,7 +5703,7 @@ var functionMap = { "Convert an 8-bit string to a quoted-printable string" ], "imap_alerts": [ - "array imap_alerts(void)", + "array imap_alerts()", "Returns an array of all IMAP alerts that have been generated since the last page load or since the last imap_alerts() call, whichever came last. The alert stack is cleared after imap_alerts() is called." ], "imap_append": [ @@ -5556,7 +5751,7 @@ var functionMap = { "Delete a mailbox" ], "imap_errors": [ - "array imap_errors(void)", + "array imap_errors()", "Returns an array of all IMAP errors generated since the last page load, or since the last imap_errors() call, whichever came last. The error stack is cleared after imap_errors() is called." ], "imap_expunge": [ @@ -5612,7 +5807,7 @@ var functionMap = { "Returns headers for all messages in a mailbox" ], "imap_last_error": [ - "string imap_last_error(void)", + "string imap_last_error()", "Returns the last error that was generated by an IMAP function. The error stack is NOT cleared after this call." ], "imap_list": [ @@ -5863,6 +6058,10 @@ var functionMap = { "bool is_callable(mixed var [, bool syntax_only [, string callable_name]])", "Returns true if var is callable." ], + "is_countable": [ + "bool is_countable(mixed var)", + "Returns true if var is countable, false otherwise" + ], "is_dir": [ "bool is_dir(string filename)", "Returns true if file is directory" @@ -5944,15 +6143,15 @@ var functionMap = { "Determine whether a variable is set" ], "iterator_apply": [ - "int iterator_apply(Traversable it, mixed function [, mixed params])", + "int iterator_apply(Traversable iterator, callable function [, array args = null)", "Calls a function for every element in an iterator" ], "iterator_count": [ - "int iterator_count(Traversable it)", + "int iterator_count(Traversable iterator)", "Count the elements in an iterator" ], "iterator_to_array": [ - "array iterator_to_array(Traversable it [, bool use_keys = true])", + "array iterator_to_array(Traversable iterator [, bool use_keys = true])", "Copy the iterator into an array" ], "jddayofweek": [ @@ -5988,11 +6187,11 @@ var functionMap = { "Converts a jewish calendar date to a julian day count" ], "join": [ - "string join(array src, string glue)", - "An alias for implode" + "string join([string glue,] array pieces)", + "Returns a string containing a string representation of all the arrayelements in the same order, with the glue string between each element" ], "jpeg2wbmp": [ - "bool jpeg2wbmp (string f_org, string f_dest, int d_height, int d_width, int threshold)", + "bool jpeg2wbmp(string f_org, string f_dest, int d_height, int d_width, int threshold)", "Convert JPEG image to WBMP image" ], "json_decode": [ @@ -6160,7 +6359,7 @@ var functionMap = { "Read an entry" ], "ldap_rename": [ - "bool ldap_rename(resource link, string dn, string newrdn, string newparent, bool deleteoldrdn);", + "bool ldap_rename(resource link, string dn, string newrdn, string newparent, bool deleteoldrdn)", "Modify the name of an entry" ], "ldap_sasl_bind": [ @@ -6208,7 +6407,7 @@ var functionMap = { "Clear last error from libxml" ], "libxml_disable_entity_loader": [ - "bool libxml_disable_entity_loader([boolean disable])", + "bool libxml_disable_entity_loader([bool disable])", "Disable/Enable ability to load external entities" ], "libxml_get_errors": [ @@ -6224,7 +6423,7 @@ var functionMap = { "Set the streams context for the next libxml document load or write" ], "libxml_use_internal_errors": [ - "bool libxml_use_internal_errors([boolean use_errors])", + "bool libxml_use_internal_errors([bool use_errors])", "Disable libxml errors and allow user to fetch error information as needed" ], "link": [ @@ -6236,11 +6435,11 @@ var functionMap = { "Returns the st_dev field of the UNIX C stat structure describing the link" ], "litespeed_request_headers": [ - "array litespeed_request_headers(void)", + "array litespeed_request_headers()", "Fetch all HTTP request headers" ], "litespeed_response_headers": [ - "array litespeed_response_headers(void)", + "array litespeed_response_headers()", "Fetch all HTTP response headers" ], "locale_accept_from_http": [ @@ -6252,7 +6451,7 @@ var functionMap = { "* @param string $locale The locale string to canonicalize" ], "locale_filter_matches": [ - "boolean locale_filter_matches(string $langtag, string $locale[, bool $canonicalize])", + "bool locale_filter_matches(string $langtag, string $locale[, bool $canonicalize])", "* Checks if a $langtag filter matches with $locale according to RFC 4647's basic filtering algorithm" ], "locale_get_all_variants": [ @@ -6265,7 +6464,7 @@ var functionMap = { ], "locale_get_keywords": [ "static array locale_get_keywords(string $locale) {", - "* return an associative array containing keyword-value * pairs for this locale. The keys are keys to the array (doh!)" + "* return an associative array containing keyword-value * pairs for this locale. The keys are keys to the array" ], "locale_get_primary_language": [ "static string locale_get_primary_language($locale)", @@ -6288,7 +6487,7 @@ var functionMap = { "Set default locale" ], "localeconv": [ - "array localeconv(void)", + "array localeconv()", "Returns numeric formatting information based on the current locale" ], "localtime": [ @@ -6392,11 +6591,11 @@ var functionMap = { "Regular expression search for multibyte string" ], "mb_ereg_search_getpos": [ - "int mb_ereg_search_getpos(void)", + "int mb_ereg_search_getpos()", "Get search start position" ], "mb_ereg_search_getregs": [ - "array mb_ereg_search_getregs(void)", + "array mb_ereg_search_getregs()", "Get matched substring of the last time" ], "mb_ereg_search_init": [ @@ -6716,7 +6915,7 @@ var functionMap = { "Hash data with hash" ], "mhash_count": [ - "int mhash_count(void)", + "int mhash_count()", "Gets the number of available hashes" ], "mhash_get_block_size": [ @@ -6892,7 +7091,7 @@ var functionMap = { "Free a MS-SQL statement index" ], "mssql_get_last_message": [ - "string mssql_get_last_message(void)", + "string mssql_get_last_message()", "Gets the last message from the MS-SQL server" ], "mssql_guid_string": [ @@ -6944,7 +7143,7 @@ var functionMap = { "Select a MS-SQL database" ], "mt_getrandmax": [ - "int mt_getrandmax(void)", + "int mt_getrandmax()", "Returns the maximum value a random number from Mersenne Twister can have" ], "mt_rand": [ @@ -7052,7 +7251,7 @@ var functionMap = { "Free result memory" ], "mysql_get_client_info": [ - "string mysql_get_client_info(void)", + "string mysql_get_client_info()", "Returns a string that represents the client library version" ], "mysql_get_host_info": [ @@ -7148,7 +7347,7 @@ var functionMap = { "Turn auto commit on or of" ], "mysqli_cache_stats": [ - "array mysqli_cache_stats(void)", + "array mysqli_cache_stats()", "Returns statistics about the zval cache" ], "mysqli_change_user": [ @@ -7172,11 +7371,11 @@ var functionMap = { "Open a connection to a mysql server" ], "mysqli_connect_errno": [ - "int mysqli_connect_errno(void)", + "int mysqli_connect_errno()", "Returns the numerical value of the error message from last connect command" ], "mysqli_connect_error": [ - "string mysqli_connect_error(void)", + "string mysqli_connect_error()", "Returns the text of the error message from previous MySQL operation" ], "mysqli_data_seek": [ @@ -7192,7 +7391,7 @@ var functionMap = { "" ], "mysqli_embedded_server_end": [ - "void mysqli_embedded_server_end(void)", + "void mysqli_embedded_server_end()", "" ], "mysqli_embedded_server_start": [ @@ -7208,39 +7407,39 @@ var functionMap = { "Returns the text of the error message from previous MySQL operation" ], "mysqli_fetch_all": [ - "mixed mysqli_fetch_all (object result [,int resulttype])", + "mixed mysqli_fetch_all(object result [,int resulttype])", "Fetches all result rows as an associative array, a numeric array, or both" ], "mysqli_fetch_array": [ - "mixed mysqli_fetch_array (object result [,int resulttype])", + "mixed mysqli_fetch_array(object result [,int resulttype])", "Fetch a result row as an associative array, a numeric array, or both" ], "mysqli_fetch_assoc": [ - "mixed mysqli_fetch_assoc (object result)", + "mixed mysqli_fetch_assoc(object result)", "Fetch a result row as an associative array" ], "mysqli_fetch_field": [ - "mixed mysqli_fetch_field (object result)", + "mixed mysqli_fetch_field(object result)", "Get column information from a result and return as an object" ], "mysqli_fetch_field_direct": [ - "mixed mysqli_fetch_field_direct (object result, int offset)", + "mixed mysqli_fetch_field_direct(object result, int offset)", "Fetch meta-data for a single field" ], "mysqli_fetch_fields": [ - "mixed mysqli_fetch_fields (object result)", + "mixed mysqli_fetch_fields(object result)", "Return array of objects containing field meta-data" ], "mysqli_fetch_lengths": [ - "mixed mysqli_fetch_lengths (object result)", + "mixed mysqli_fetch_lengths(object result)", "Get the length of each output in a result" ], "mysqli_fetch_object": [ - "mixed mysqli_fetch_object (object result [, string class_name [, NULL|array ctor_params]])", + "mixed mysqli_fetch_object(object result [, string class_name [, NULL|array ctor_params]])", "Fetch a result row as an object" ], "mysqli_fetch_row": [ - "array mysqli_fetch_row (object result)", + "array mysqli_fetch_row(object result)", "Get a result row as an enumerated array" ], "mysqli_field_count": [ @@ -7264,23 +7463,23 @@ var functionMap = { "returns a character set object" ], "mysqli_get_client_info": [ - "string mysqli_get_client_info(void)", + "string mysqli_get_client_info()", "Get MySQL client info" ], "mysqli_get_client_stats": [ - "array mysqli_get_client_stats(void)", + "array mysqli_get_client_stats()", "Returns statistics about the zval cache" ], "mysqli_get_client_version": [ - "int mysqli_get_client_version(void)", + "int mysqli_get_client_version()", "Get MySQL client info" ], "mysqli_get_connection_stats": [ - "array mysqli_get_connection_stats(void)", + "array mysqli_get_connection_stats()", "Returns statistics about the zval cache" ], "mysqli_get_host_info": [ - "string mysqli_get_host_info (object link)", + "string mysqli_get_host_info(object link)", "Get MySQL host info" ], "mysqli_get_proto_info": [ @@ -7296,15 +7495,15 @@ var functionMap = { "Return the MySQL version for the server referenced by the given link" ], "mysqli_get_warnings": [ - "object mysqli_get_warnings(object link) */", - "PHP_FUNCTION(mysqli_get_warnings) { MY_MYSQL *mysql; zval *mysql_link; MYSQLI_RESOURCE *mysqli_resource; MYSQLI_WARNING *w; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), \"O\", &mysql_link, mysqli_link_class_entry) == FAILURE) { return; } MYSQLI_FETCH_RESOURCE(mysql, MY_MYSQL*, &mysql_link, \"mysqli_link\", MYSQLI_STATUS_VALID); if (mysql_warning_count(mysql->mysql)) { w = php_get_warnings(mysql->mysql TSRMLS_CC); } else { RETURN_FALSE; } mysqli_resource = (MYSQLI_RESOURCE *)ecalloc (1, sizeof(MYSQLI_RESOURCE)); mysqli_resource->ptr = mysqli_resource->info = (void *)w; mysqli_resource->status = MYSQLI_STATUS_VALID; MYSQLI_RETURN_RESOURCE(mysqli_resource, mysqli_warning_class_entry); } /* }}}" + "object mysqli_get_warnings(object link)", + "" ], "mysqli_info": [ "string mysqli_info(object link)", "Get information about the most recent query" ], "mysqli_init": [ - "resource mysqli_init(void)", + "resource mysqli_init()", "Initialize mysqli and return a resource for use with mysql_real_connect" ], "mysqli_insert_id": [ @@ -7356,8 +7555,8 @@ var functionMap = { "Prepare a SQL statement for execution" ], "mysqli_query": [ - "mixed mysqli_query(object link, string query [,int resultmode]) */", - "PHP_FUNCTION(mysqli_query) { MY_MYSQL *mysql; zval *mysql_link; MYSQLI_RESOURCE *mysqli_resource; MYSQL_RES *result; char *query = NULL; unsigned int query_len; unsigned long resultmode = MYSQLI_STORE_RESULT; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), \"Os|l\", &mysql_link, mysqli_link_class_entry, &query, &query_len, &resultmode) == FAILURE) { return; } if (!query_len) { php_error_docref(NULL TSRMLS_CC, E_WARNING, \"Empty query\"); RETURN_FALSE; } if ((resultmode & ~MYSQLI_ASYNC) != MYSQLI_USE_RESULT && (resultmode & ~MYSQLI_ASYNC) != MYSQLI_STORE_RESULT) { php_error_docref(NULL TSRMLS_CC, E_WARNING, \"Invalid value for resultmode\"); RETURN_FALSE; } MYSQLI_FETCH_RESOURCE(mysql, MY_MYSQL*, &mysql_link, \"mysqli_link\", MYSQLI_STATUS_VALID); MYSQLI_DISABLE_MQ; #ifdef MYSQLI_USE_MYSQLND if (resultmode & MYSQLI_ASYNC) { if (mysqli_async_query(mysql->mysql, query, query_len)) { MYSQLI_REPORT_MYSQL_ERROR(mysql->mysql); RETURN_FALSE; } mysql->async_result_fetch_type = resultmode & ~MYSQLI_ASYNC; RETURN_TRUE; } #endif if (mysql_real_query(mysql->mysql, query, query_len)) { MYSQLI_REPORT_MYSQL_ERROR(mysql->mysql); RETURN_FALSE; } if (!mysql_field_count(mysql->mysql)) { /* no result set - not a SELECT" + "mixed mysqli_query(object link, string query [,int resultmode])", + "" ], "mysqli_real_connect": [ "bool mysqli_real_connect(object link [,string hostname [,string username [,string passwd [,string dbname [,int port [,string socket [,int flags]]]]]]])", @@ -7472,8 +7671,8 @@ var functionMap = { "Buffer result set on client" ], "mysqli_stmt_get_warnings": [ - "object mysqli_stmt_get_warnings(object link) */", - "PHP_FUNCTION(mysqli_stmt_get_warnings) { MY_STMT *stmt; zval *stmt_link; MYSQLI_RESOURCE *mysqli_resource; MYSQLI_WARNING *w; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), \"O\", &stmt_link, mysqli_stmt_class_entry) == FAILURE) { return; } MYSQLI_FETCH_RESOURCE(stmt, MY_STMT*, &stmt_link, \"mysqli_stmt\", MYSQLI_STATUS_VALID); if (mysqli_stmt_warning_count(stmt->stmt)) { w = php_get_warnings(mysqli_stmt_get_connection(stmt->stmt) TSRMLS_CC); } else { RETURN_FALSE; } mysqli_resource = (MYSQLI_RESOURCE *)ecalloc (1, sizeof(MYSQLI_RESOURCE)); mysqli_resource->ptr = mysqli_resource->info = (void *)w; mysqli_resource->status = MYSQLI_STATUS_VALID; MYSQLI_RETURN_RESOURCE(mysqli_resource, mysqli_warning_class_entry); } /* }}}" + "object mysqli_stmt_get_warnings(object link)", + "" ], "mysqli_stmt_init": [ "mixed mysqli_stmt_init(object link)", @@ -7528,7 +7727,7 @@ var functionMap = { "Return the current thread ID" ], "mysqli_thread_safe": [ - "bool mysqli_thread_safe(void)", + "bool mysqli_thread_safe()", "Return whether thread safety is given or not" ], "mysqli_use_result": [ @@ -7536,7 +7735,7 @@ var functionMap = { "Directly retrieve query results - do not buffer results on client side" ], "mysqli_warning_count": [ - "int mysqli_warning_count (object link)", + "int mysqli_warning_count(object link)", "Return number of warnings from the last query for the given link" ], "natcasesort": [ @@ -7572,11 +7771,11 @@ var functionMap = { "* Normalize a string." ], "nsapi_request_headers": [ - "array nsapi_request_headers(void)", + "array nsapi_request_headers()", "Get all headers from the request" ], "nsapi_response_headers": [ - "array nsapi_response_headers(void)", + "array nsapi_response_headers()", "Get all headers from the response" ], "nsapi_virtual": [ @@ -7656,39 +7855,39 @@ var functionMap = { "* Get formatter attribute value." ], "ob_clean": [ - "bool ob_clean(void)", + "bool ob_clean()", "Clean (delete) the current output buffer" ], "ob_end_clean": [ - "bool ob_end_clean(void)", + "bool ob_end_clean()", "Clean the output buffer, and delete current output buffer" ], "ob_end_flush": [ - "bool ob_end_flush(void)", + "bool ob_end_flush()", "Flush (send) the output buffer, and delete current output buffer" ], "ob_flush": [ - "bool ob_flush(void)", + "bool ob_flush()", "Flush (send) contents of the output buffer. The last buffer content is sent to next buffer" ], "ob_get_clean": [ - "bool ob_get_clean(void)", + "bool ob_get_clean()", "Get current buffer contents and delete current output buffer" ], "ob_get_contents": [ - "string ob_get_contents(void)", + "string ob_get_contents()", "Return the contents of the output buffer" ], "ob_get_flush": [ - "bool ob_get_flush(void)", + "bool ob_get_flush()", "Get current buffer contents, flush (send) the output buffer, and delete current output buffer" ], "ob_get_length": [ - "int ob_get_length(void)", + "int ob_get_length()", "Return the length of the output buffer" ], "ob_get_level": [ - "int ob_get_level(void)", + "int ob_get_level()", "Return the nesting level of the output buffer" ], "ob_get_status": [ @@ -8008,7 +8207,7 @@ var functionMap = { "Returns current state of buffering for a LOB" ], "ocisetbufferinglob": [ - "bool ocisetbufferinglob( boolean flag )", + "bool ocisetbufferinglob( bool flag )", "Enables/disables buffering for a LOB" ], "octdec": [ @@ -8028,7 +8227,7 @@ var functionMap = { "Close an ODBC connection" ], "odbc_close_all": [ - "void odbc_close_all(void)", + "void odbc_close_all()", "Close all ODBC connections" ], "odbc_columnprivileges": [ @@ -8236,7 +8435,7 @@ var functionMap = { "Encrypts given data with given method and key, returns raw or base64 encoded string" ], "openssl_error_string": [ - "mixed openssl_error_string(void)", + "mixed openssl_error_string()", "Returns a description of the last error, and alters the index of the error messages. Returns false when the are no more messages" ], "openssl_get_cipher_methods": [ @@ -8376,7 +8575,7 @@ var functionMap = { "Add URL rewriter values" ], "output_reset_rewrite_vars": [ - "bool output_reset_rewrite_vars(void)", + "bool output_reset_rewrite_vars()", "Reset(clear) URL rewriter values" ], "pack": [ @@ -8428,7 +8627,7 @@ var functionMap = { "Executes specified program in current process space as defined by exec(2)" ], "pcntl_fork": [ - "int pcntl_fork(void)", + "int pcntl_fork()", "Forks the currently running process following the same behavior as the UNIX fork() system call" ], "pcntl_getpriority": [ @@ -8545,7 +8744,7 @@ var functionMap = { ], "pg_delete": [ "mixed pg_delete(resource db, string table, array ids[, int options])", - "Delete records has ids (id=>value)" + "Delete records has ids (id => value)" ], "pg_end_copy": [ "bool pg_end_copy([resource connection])", @@ -8645,7 +8844,7 @@ var functionMap = { ], "pg_insert": [ "mixed pg_insert(resource db, string table, array values[, int options])", - "Insert values (filed=>value) to table" + "Insert values (filed => value) to table" ], "pg_last_error": [ "string pg_last_error([resource connection])", @@ -8769,7 +8968,7 @@ var functionMap = { ], "pg_select": [ "mixed pg_select(resource db, string table, array ids[, int options])", - "Select records that has ids (id=>value)" + "Select records that has ids (id => value)" ], "pg_send_execute": [ "bool pg_send_execute(resource connection, string stmtname, array params)", @@ -8817,34 +9016,34 @@ var functionMap = { ], "pg_update": [ "mixed pg_update(resource db, string table, array fields, array ids[, int options])", - "Update table using values (field=>value) and ids (id=>value)" + "Update table using values (field => value) and ids (id => value)" ], "pg_version": [ "array pg_version([resource connection])", "Returns an array with client, protocol and server version (when available)" ], "php_egg_logo_guid": [ - "string php_egg_logo_guid(void)", + "string php_egg_logo_guid()", "Return the special ID used to request the PHP logo in phpinfo screens" ], "php_ini_loaded_file": [ - "string php_ini_loaded_file(void)", + "string php_ini_loaded_file()", "Return the actual loaded ini filename" ], "php_ini_scanned_files": [ - "string php_ini_scanned_files(void)", + "string php_ini_scanned_files()", "Return comma-separated string of .ini files parsed from the additional ini dir" ], "php_logo_guid": [ - "string php_logo_guid(void)", + "string php_logo_guid()", "Return the special ID used to request the PHP logo in phpinfo screens" ], "php_real_logo_guid": [ - "string php_real_logo_guid(void)", + "string php_real_logo_guid()", "Return the special ID used to request the PHP logo in phpinfo screens" ], "php_sapi_name": [ - "string php_sapi_name(void)", + "string php_sapi_name()", "Return the current SAPI module name" ], "php_snmpv3": [ @@ -8856,7 +9055,7 @@ var functionMap = { "Return source with stripped comments and whitespace" ], "php_uname": [ - "string php_uname(void)", + "string php_uname()", "Return information about the system PHP was built on" ], "phpcredits": [ @@ -8872,11 +9071,11 @@ var functionMap = { "Return the current PHP version" ], "pi": [ - "float pi(void)", + "float pi()", "Returns an approximation of pi" ], "png2wbmp": [ - "bool png2wbmp (string f_org, string f_dest, int d_height, int d_width, int threshold)", + "bool png2wbmp(string f_org, string f_dest, int d_height, int d_width, int threshold)", "Convert PNG image to WBMP image" ], "popen": [ @@ -8888,27 +9087,27 @@ var functionMap = { "Determine accessibility of a file (POSIX.1 5.6.3)" ], "posix_ctermid": [ - "string posix_ctermid(void)", + "string posix_ctermid()", "Generate terminal path name (POSIX.1, 4.7.1)" ], "posix_get_last_error": [ - "int posix_get_last_error(void)", + "int posix_get_last_error()", "Retrieve the error number set by the last posix function which failed." ], "posix_getcwd": [ - "string posix_getcwd(void)", + "string posix_getcwd()", "Get working directory pathname (POSIX.1, 5.2.2)" ], "posix_getegid": [ - "int posix_getegid(void)", + "int posix_getegid()", "Get the current effective group id (POSIX.1, 4.2.1)" ], "posix_geteuid": [ - "int posix_geteuid(void)", + "int posix_geteuid()", "Get the current effective user id (POSIX.1, 4.2.1)" ], "posix_getgid": [ - "int posix_getgid(void)", + "int posix_getgid()", "Get the current group id (POSIX.1, 4.2.1)" ], "posix_getgrgid": [ @@ -8920,27 +9119,27 @@ var functionMap = { "Group database access (POSIX.1, 9.2.1)" ], "posix_getgroups": [ - "array posix_getgroups(void)", + "array posix_getgroups()", "Get supplementary group id's (POSIX.1, 4.2.3)" ], "posix_getlogin": [ - "string posix_getlogin(void)", + "string posix_getlogin()", "Get user name (POSIX.1, 4.2.4)" ], "posix_getpgid": [ - "int posix_getpgid(void)", + "int posix_getpgid()", "Get the process group id of the specified process (This is not a POSIX function, but a SVR4ism, so we compile conditionally)" ], "posix_getpgrp": [ - "int posix_getpgrp(void)", + "int posix_getpgrp()", "Get current process group id (POSIX.1, 4.3.1)" ], "posix_getpid": [ - "int posix_getpid(void)", + "int posix_getpid()", "Get the current process id (POSIX.1, 4.1.1)" ], "posix_getppid": [ - "int posix_getppid(void)", + "int posix_getppid()", "Get the parent process id (POSIX.1, 4.1.1)" ], "posix_getpwnam": [ @@ -8952,15 +9151,15 @@ var functionMap = { "User database access (POSIX.1, 9.2.2)" ], "posix_getrlimit": [ - "array posix_getrlimit(void)", + "array posix_getrlimit()", "Get system resource consumption limits (This is not a POSIX function, but a BSDism and a SVR4ism. We compile conditionally)" ], "posix_getsid": [ - "int posix_getsid(void)", + "int posix_getsid()", "Get process group id of session leader (This is not a POSIX function, but a SVR4ism, so be compile conditionally)" ], "posix_getuid": [ - "int posix_getuid(void)", + "int posix_getuid()", "Get the current user id (POSIX.1, 4.2.1)" ], "posix_initgroups": [ @@ -9000,7 +9199,7 @@ var functionMap = { "Set process group id for job control (POSIX.1, 4.3.3)" ], "posix_setsid": [ - "int posix_setsid(void)", + "int posix_setsid()", "Create session and set process group id (POSIX.1, 4.3.2)" ], "posix_setuid": [ @@ -9012,7 +9211,7 @@ var functionMap = { "Retrieve the system error message associated with the given errno." ], "posix_times": [ - "array posix_times(void)", + "array posix_times()", "Get process times (POSIX.1, 4.5.2)" ], "posix_ttyname": [ @@ -9020,7 +9219,7 @@ var functionMap = { "Determine terminal device name (POSIX.1, 4.7.2)" ], "posix_uname": [ - "array posix_uname(void)", + "array posix_uname()", "Get system name (POSIX.1, 4.4.1)" ], "pow": [ @@ -9188,8 +9387,8 @@ var functionMap = { "Convert a quoted-printable string to an 8 bit string" ], "quoted_printable_encode": [ - "string quoted_printable_encode(string str) */", - "PHP_FUNCTION(quoted_printable_encode) { char *str, *new_str; int str_len; size_t new_str_len; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, \"s\", &str, &str_len) != SUCCESS) { return; } if (!str_len) { RETURN_EMPTY_STRING(); } new_str = (char *)php_quot_print_encode((unsigned char *)str, (size_t)str_len, &new_str_len); RETURN_STRINGL(new_str, new_str_len, 0); } /* }}}" + "string quoted_printable_encode(string str)", + "" ], "quotemeta": [ "string quotemeta(string str)", @@ -9248,7 +9447,7 @@ var functionMap = { "Informs the readline callback interface that a character is ready for input" ], "readline_clear_history": [ - "bool readline_clear_history(void)", + "bool readline_clear_history()", "Clears the history" ], "readline_completion_function": [ @@ -9260,11 +9459,11 @@ var functionMap = { "Gets/sets various internal readline variables." ], "readline_list_history": [ - "array readline_list_history(void)", + "array readline_list_history()", "Lists the history" ], "readline_on_new_line": [ - "void readline_on_new_line(void)", + "void readline_on_new_line()", "Inform readline that the cursor has moved to a new line" ], "readline_read_history": [ @@ -9272,7 +9471,7 @@ var functionMap = { "Reads the history" ], "readline_redisplay": [ - "void readline_redisplay(void)", + "void readline_redisplay()", "Ask readline to redraw the display" ], "readline_write_history": [ @@ -9328,11 +9527,11 @@ var functionMap = { "Set array argument's internal pointer to the first element and return it" ], "restore_error_handler": [ - "void restore_error_handler(void)", + "void restore_error_handler()", "Restores the previously defined error handler function" ], "restore_exception_handler": [ - "void restore_exception_handler(void)", + "void restore_exception_handler()", "Restores the previously defined exception handler function" ], "restore_include_path": [ @@ -9400,15 +9599,15 @@ var functionMap = { "Deserializes data and reinitializes the variables" ], "session_destroy": [ - "bool session_destroy(void)", + "bool session_destroy()", "Destroy the current session and all data associated with it" ], "session_encode": [ - "string session_encode(void)", + "string session_encode()", "Serializes the current setup and returns the serialized representation" ], "session_get_cookie_params": [ - "array session_get_cookie_params(void)", + "array session_get_cookie_params()", "Return the session cookie parameters" ], "session_id": [ @@ -9448,7 +9647,7 @@ var functionMap = { "Sets user-level functions" ], "session_start": [ - "bool session_start(void)", + "bool session_start()", "Begin session - reinitializes freezed variables, registers browsers etc" ], "session_unregister": [ @@ -9456,11 +9655,11 @@ var functionMap = { "Removes varname from the list of variables which are freezed at the session end" ], "session_unset": [ - "void session_unset(void)", + "void session_unset()", "Unset all registered variables" ], "session_write_close": [ - "void session_write_close(void)", + "void session_write_close()", "Write session data and end session" ], "set_error_handler": [ @@ -9540,27 +9739,27 @@ var functionMap = { "Removes variable from shared memory" ], "shmop_close": [ - "void shmop_close (int shmid)", + "void shmop_close(int shmid)", "closes a shared memory segment" ], "shmop_delete": [ - "bool shmop_delete (int shmid)", + "bool shmop_delete(int shmid)", "mark segment for deletion" ], "shmop_open": [ - "int shmop_open (int key, string flags, int mode, int size)", + "int shmop_open(int key, string flags, int mode, int size)", "gets and attaches a shared memory segment" ], "shmop_read": [ - "string shmop_read (int shmid, int start, int count)", + "string shmop_read(int shmid, int start, int count)", "reads from a shm segment" ], "shmop_size": [ - "int shmop_size (int shmid)", + "int shmop_size(int shmid)", "returns the shm size" ], "shmop_write": [ - "int shmop_write (int shmid, string data, int offset)", + "int shmop_write(int shmid, string data, int offset)", "writes to a shared memory segment" ], "shuffle": [ @@ -9672,7 +9871,7 @@ var functionMap = { "Fetch the value of a SNMP object" ], "snmp_get_quick_print": [ - "bool snmp_get_quick_print(void)", + "bool snmp_get_quick_print()", "Return the current status of quick_print" ], "snmp_get_valueretrieval": [ @@ -9920,7 +10119,7 @@ var functionMap = { "Escapes a string for use as a query parameter." ], "sqlite_exec": [ - "boolean sqlite_exec(string query, resource db[, string &error_message])", + "bool sqlite_exec(string query, resource db[, string &error_message])", "Executes a result-less query against a given database" ], "sqlite_factory": [ @@ -10172,7 +10371,7 @@ var functionMap = { "Reads all remaining bytes (or up to maxlen bytes) from a stream and returns them as a string." ], "stream_get_filters": [ - "array stream_get_filters(void)", + "array stream_get_filters()", "Returns a list of registered filters" ], "stream_get_line": [ @@ -10436,7 +10635,7 @@ var functionMap = { "Free result memory" ], "sybase_get_last_message": [ - "string sybase_get_last_message(void)", + "string sybase_get_last_message()", "Returns the last message from server (over min_message_severity)" ], "sybase_min_client_severity": [ @@ -10520,7 +10719,7 @@ var functionMap = { "Returns the Number of Tidy accessibility warnings encountered for specified document." ], "tidy_clean_repair": [ - "boolean tidy_clean_repair()", + "bool tidy_clean_repair()", "Execute configured cleanup and repair operations on parsed markup" ], "tidy_config_count": [ @@ -10528,7 +10727,7 @@ var functionMap = { "Returns the Number of Tidy configuration errors encountered for specified document." ], "tidy_diagnose": [ - "boolean tidy_diagnose()", + "bool tidy_diagnose()", "Run configured diagnostics on parsed and repaired markup." ], "tidy_error_count": [ @@ -10544,7 +10743,7 @@ var functionMap = { "Get current Tidy configuarion" ], "tidy_get_error_buffer": [ - "string tidy_get_error_buffer([boolean detailed])", + "string tidy_get_error_buffer([bool detailed])", "Return warnings and errors which occured parsing the specified document" ], "tidy_get_head": [ @@ -10584,15 +10783,15 @@ var functionMap = { "Returns the value of the specified configuration option for the tidy document." ], "tidy_is_xhtml": [ - "boolean tidy_is_xhtml()", + "bool tidy_is_xhtml()", "Indicates if the document is a XHTML document." ], "tidy_is_xml": [ - "boolean tidy_is_xml()", + "bool tidy_is_xml()", "Indicates if the document is a generic (non HTML/XHTML) XML document." ], "tidy_parse_file": [ - "boolean tidy_parse_file(string file [, mixed config_options [, string encoding [, bool use_include_path]]])", + "bool tidy_parse_file(string file [, mixed config_options [, string encoding [, bool use_include_path]]])", "Parse markup in file or URI" ], "tidy_parse_string": [ @@ -10600,11 +10799,11 @@ var functionMap = { "Parse a document stored in a string" ], "tidy_repair_file": [ - "boolean tidy_repair_file(string filename [, mixed config_file [, string encoding [, bool use_include_path]]])", + "bool tidy_repair_file(string filename [, mixed config_file [, string encoding [, bool use_include_path]]])", "Repair a file using an optionally provided configuration file" ], "tidy_repair_string": [ - "boolean tidy_repair_string(string data [, mixed config_file [, string encoding]])", + "bool tidy_repair_string(string data [, mixed config_file [, string encoding]])", "Repair a string using an optionally provided configuration file" ], "tidy_warning_count": [ @@ -10612,7 +10811,7 @@ var functionMap = { "Returns the Number of Tidy warnings encountered for specified document." ], "time": [ - "int time(void)", + "int time()", "Return current UNIX timestamp" ], "time_nanosleep": [ @@ -10660,7 +10859,7 @@ var functionMap = { "Returns the Olson database version number." ], "tmpfile": [ - "resource tmpfile(void)", + "resource tmpfile()", "Create a temporary file that will be deleted automatically after use" ], "token_get_all": [ @@ -10728,7 +10927,7 @@ var functionMap = { "Takes a string representation of variable and recreates it" ], "unset": [ - "void unset (mixed var [, mixed var])", + "void unset(mixed var [, mixed var])", "Unset a given variable" ], "urldecode": [ @@ -10760,7 +10959,7 @@ var functionMap = { "Dumps a string representation of variable to output" ], "var_export": [ - "mixed var_export(mixed var [, bool return])", + "string var_export(mixed var [, bool return])", "Outputs or returns a string representation of a variable" ], "variant_abs": [ @@ -10888,7 +11087,7 @@ var functionMap = { "Return a formatted string" ], "wddx_add_vars": [ - "int wddx_add_vars(resource packet_id, mixed var_names [, mixed ...])", + "int wddx_add_vars(resource packet_id, mixed var_names [, mixed ...])", "Serializes given variables and adds them to packet given by packet_id" ], "wddx_deserialize": [ @@ -10912,7 +11111,7 @@ var functionMap = { "Creates a new packet and serializes given variables into a struct" ], "wordwrap": [ - "string wordwrap(string str [, int width [, string break [, boolean cut]]])", + "string wordwrap(string str [, int width [, string break [, bool cut]]])", "Wraps buffer to selected number of characters using string break char" ], "xml_error_string": [ @@ -11040,7 +11239,7 @@ var functionMap = { "Parses XML requests and call methods" ], "xmlrpc_server_create": [ - "resource xmlrpc_server_create(void)", + "resource xmlrpc_server_create()", "Creates an xmlrpc server" ], "xmlrpc_server_destroy": [ @@ -11228,51 +11427,51 @@ var functionMap = { "Write text - returns FALSE on error" ], "xsl_xsltprocessor_get_parameter": [ - "string xsl_xsltprocessor_get_parameter(string namespace, string name);", + "string xsl_xsltprocessor_get_parameter(string namespace, string name)", "" ], "xsl_xsltprocessor_has_exslt_support": [ - "bool xsl_xsltprocessor_has_exslt_support();", + "bool xsl_xsltprocessor_has_exslt_support()", "" ], "xsl_xsltprocessor_import_stylesheet": [ - "void xsl_xsltprocessor_import_stylesheet(domdocument doc);", - "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html# Since:" + "void xsl_xsltprocessor_import_stylesheet(domdocument doc)", + "" ], "xsl_xsltprocessor_register_php_functions": [ - "void xsl_xsltprocessor_register_php_functions([mixed $restrict]);", + "void xsl_xsltprocessor_register_php_functions([mixed $restrict])", "" ], "xsl_xsltprocessor_remove_parameter": [ - "bool xsl_xsltprocessor_remove_parameter(string namespace, string name);", + "bool xsl_xsltprocessor_remove_parameter(string namespace, string name)", "" ], "xsl_xsltprocessor_set_parameter": [ - "bool xsl_xsltprocessor_set_parameter(string namespace, mixed name [, string value]);", + "bool xsl_xsltprocessor_set_parameter(string namespace, mixed name [, string value])", "" ], "xsl_xsltprocessor_set_profiling": [ - "bool xsl_xsltprocessor_set_profiling(string filename) */", - "PHP_FUNCTION(xsl_xsltprocessor_set_profiling) { zval *id; xsl_object *intern; char *filename = NULL; int filename_len; DOM_GET_THIS(id); if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, \"s!\", &filename, &filename_len) == SUCCESS) { intern = (xsl_object *)zend_object_store_get_object(id TSRMLS_CC); if (intern->profiling) { efree(intern->profiling); } if (filename != NULL) { intern->profiling = estrndup(filename,filename_len); } else { intern->profiling = NULL; } RETURN_TRUE; } else { WRONG_PARAM_COUNT; } } /* }}} end xsl_xsltprocessor_set_profiling" + "bool xsl_xsltprocessor_set_profiling(string filename)", + "" ], "xsl_xsltprocessor_transform_to_doc": [ - "domdocument xsl_xsltprocessor_transform_to_doc(domnode doc);", - "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html# Since:" + "domdocument xsl_xsltprocessor_transform_to_doc(domnode doc)", + "" ], "xsl_xsltprocessor_transform_to_uri": [ - "int xsl_xsltprocessor_transform_to_uri(domdocument doc, string uri);", + "int xsl_xsltprocessor_transform_to_uri(domdocument doc, string uri)", "" ], "xsl_xsltprocessor_transform_to_xml": [ - "string xsl_xsltprocessor_transform_to_xml(domdocument doc);", + "string xsl_xsltprocessor_transform_to_xml(domdocument doc)", "" ], "zend_logo_guid": [ - "string zend_logo_guid(void)", + "string zend_logo_guid()", "Return the special ID used to request the Zend logo in phpinfo screens" ], "zend_version": [ - "string zend_version(void)", + "string zend_version()", "Get the version of the Zend Engine" ], "zip_close": [ @@ -11316,7 +11515,7 @@ var functionMap = { "Returns the next file in the archive" ], "zlib_get_coding_type": [ - "string zlib_get_coding_type(void)", + "string zlib_get_coding_type()", "Returns the coding type used for output compression" ] }; @@ -11367,7 +11566,9 @@ var variableMap = { "SERVER_PORT": 1, "SERVER_PROTOCOL": 1, "SERVER_SIGNATURE": 1, - "SERVER_SOFTWARE": 1 + "SERVER_SOFTWARE": 1, + "argv": 1, + "argc": 1 } }, "$_SESSION": { @@ -11375,6 +11576,12 @@ var variableMap = { }, "$GLOBALS": { type: "array" + }, + '$argv': { + type: "array" + }, + '$argc': { + type: "int" } }; @@ -11702,6 +11909,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/javascript"; + this.snippetFileId = "ace/snippets/javascript"; }).call(Mode.prototype); exports.Mode = Mode; @@ -12039,6 +12247,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/css"; + this.snippetFileId = "ace/snippets/css"; }).call(Mode.prototype); exports.Mode = Mode; @@ -12931,6 +13140,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/html"; + this.snippetFileId = "ace/snippets/html"; }).call(Mode.prototype); exports.Mode = Mode; @@ -13057,6 +13267,7 @@ oop.inherits(Mode, HtmlMode); }; this.$id = "ace/mode/php"; + this.snippetFileId = "ace/snippets/php"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-prisma.js b/htdocs/includes/ace/src/mode-prisma.js new file mode 100644 index 00000000000..fc7048378e3 --- /dev/null +++ b/htdocs/includes/ace/src/mode-prisma.js @@ -0,0 +1,489 @@ +define("ace/mode/prisma_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) { +"use strict"; + +var oop = require("../lib/oop"); +var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; + +var PrismaHighlightRules = function() { + + this.$rules = { + start: [{ + include: "#triple_comment" + }, { + include: "#double_comment" + }, { + include: "#model_block_definition" + }, { + include: "#config_block_definition" + }, { + include: "#enum_block_definition" + }, { + include: "#type_definition" + }], + "#model_block_definition": [{ + token: [ + "source.prisma.embedded.source", + "storage.type.model.prisma", + "source.prisma.embedded.source", + "entity.name.type.model.prisma", + "source.prisma.embedded.source", + "punctuation.definition.tag.prisma" + ], + regex: /^(\s*)(model|type)(\s+)([A-Za-z][\w]*)(\s+)({)/, + push: [{ + token: "punctuation.definition.tag.prisma", + regex: /\s*\}/, + next: "pop" + }, { + include: "#triple_comment" + }, { + include: "#double_comment" + }, { + include: "#field_definition" + }, { + defaultToken: "source.prisma.embedded.source" + }] + }], + "#enum_block_definition": [{ + token: [ + "source.prisma.embedded.source", + "storage.type.enum.prisma", + "source.prisma.embedded.source", + "entity.name.type.enum.prisma", + "source.prisma.embedded.source", + "punctuation.definition.tag.prisma" + ], + regex: /^(\s*)(enum)(\s+)([A-Za-z][\w]*)(\s+)({)/, + push: [{ + token: "punctuation.definition.tag.prisma", + regex: /\s*\}/, + next: "pop" + }, { + include: "#triple_comment" + }, { + include: "#double_comment" + }, { + include: "#enum_value_definition" + }, { + defaultToken: "source.prisma.embedded.source" + }] + }], + "#config_block_definition": [{ + token: [ + "source.prisma.embedded.source", + "storage.type.config.prisma", + "source.prisma.embedded.source", + "entity.name.type.config.prisma", + "source.prisma.embedded.source", + "punctuation.definition.tag.prisma" + ], + regex: /^(\s*)(generator|datasource)(\s+)([A-Za-z][\w]*)(\s+)({)/, + push: [{ + token: "source.prisma.embedded.source", + regex: /\s*\}/, + next: "pop" + }, { + include: "#triple_comment" + }, { + include: "#double_comment" + }, { + include: "#assignment" + }, { + defaultToken: "source.prisma.embedded.source" + }] + }], + "#assignment": [{ + token: [ + "text", + "variable.other.assignment.prisma", + "text", + "keyword.operator.terraform", + "text" + ], + regex: /^(\s*)(\w+)(\s*)(=)(\s*)/, + push: [{ + token: "text", + regex: /$/, + next: "pop" + }, { + include: "#value" + }, { + include: "#double_comment_inline" + }] + }], + "#field_definition": [{ + token: [ + "text", + "variable.other.assignment.prisma", + "invalid.illegal.colon.prisma", + "text", + "support.type.primitive.prisma", + "keyword.operator.list_type.prisma", + "keyword.operator.optional_type.prisma", + "invalid.illegal.required_type.prisma" + ], + regex: /^(\s*)(\w+)((?:\s*:)?)(\s+)(\w+)((?:\[\])?)((?:\?)?)((?:\!)?)/ + }, { + include: "#attribute_with_arguments" + }, { + include: "#attribute" + }], + "#type_definition": [{ + token: [ + "text", + "storage.type.type.prisma", + "text", + "entity.name.type.type.prisma", + "text", + "support.type.primitive.prisma" + ], + regex: /^(\s*)(type)(\s+)(\w+)(\s*=\s*)(\w+)/ + }, { + include: "#attribute_with_arguments" + }, { + include: "#attribute" + }], + "#enum_value_definition": [{ + token: [ + "text", + "variable.other.assignment.prisma", + "text" + ], + regex: /^(\s*)(\w+)(\s*$)/ + }, { + include: "#attribute_with_arguments" + }, { + include: "#attribute" + }], + "#attribute_with_arguments": [{ + token: [ + "entity.name.function.attribute.prisma", + "punctuation.definition.tag.prisma" + ], + regex: /(@@?[\w\.]+)(\()/, + push: [{ + token: "punctuation.definition.tag.prisma", + regex: /\)/, + next: "pop" + }, { + include: "#named_argument" + }, { + include: "#value" + }, { + defaultToken: "source.prisma.attribute.with_arguments" + }] + }], + "#attribute": [{ + token: "entity.name.function.attribute.prisma", + regex: /@@?[\w\.]+/ + }], + "#array": [{ + token: "source.prisma.array", + regex: /\[/, + push: [{ + token: "source.prisma.array", + regex: /\]/, + next: "pop" + }, { + include: "#value" + }, { + defaultToken: "source.prisma.array" + }] + }], + "#value": [{ + include: "#array" + }, { + include: "#functional" + }, { + include: "#literal" + }], + "#functional": [{ + token: [ + "support.function.functional.prisma", + "punctuation.definition.tag.prisma" + ], + regex: /(\w+)(\()/, + push: [{ + token: "punctuation.definition.tag.prisma", + regex: /\)/, + next: "pop" + }, { + include: "#value" + }, { + defaultToken: "source.prisma.functional" + }] + }], + "#literal": [{ + include: "#boolean" + }, { + include: "#number" + }, { + include: "#double_quoted_string" + }, { + include: "#identifier" + }], + "#identifier": [{ + token: "support.constant.constant.prisma", + regex: /\b(?:\w)+\b/ + }], + "#map_key": [{ + token: [ + "variable.parameter.key.prisma", + "text", + "punctuation.definition.separator.key-value.prisma", + "text" + ], + regex: /(\w+)(\s*)(:)(\s*)/ + }], + "#named_argument": [{ + include: "#map_key" + }, { + include: "#value" + }], + "#triple_comment": [{ + token: "comment.prisma", + regex: /\/\/\//, + push: [{ + token: "comment.prisma", + regex: /$/, + next: "pop" + }, { + defaultToken: "comment.prisma" + }] + }], + "#double_comment": [{ + token: "comment.prisma", + regex: /\/\//, + push: [{ + token: "comment.prisma", + regex: /$/, + next: "pop" + }, { + defaultToken: "comment.prisma" + }] + }], + "#double_comment_inline": [{ + token: "comment.prisma", + regex: /\/\/[^$]*/ + }], + "#boolean": [{ + token: "constant.language.boolean.prisma", + regex: /\b(?:true|false)\b/ + }], + "#number": [{ + token: "constant.numeric.prisma", + regex: /(?:0(?:x|X)[0-9a-fA-F]*|(?:\+|-)?\b(?:[0-9]+\.?[0-9]*|\.[0-9]+)(?:(?:e|E)(?:\+|-)?[0-9]+)?)(?:[LlFfUuDdg]|UL|ul)?\b/ + }], + "#double_quoted_string": [{ + token: "string.quoted.double.start.prisma", + regex: /"/, + push: [{ + token: "string.quoted.double.end.prisma", + regex: /"/, + next: "pop" + }, { + include: "#string_interpolation" + }, { + token: "string.quoted.double.prisma", + regex: /[\w\-\/\._\\%@:\?=]+/ + }, { + defaultToken: "unnamed" + }] + }], + "#string_interpolation": [{ + token: "keyword.control.interpolation.start.prisma", + regex: /\$\{/, + push: [{ + token: "keyword.control.interpolation.end.prisma", + regex: /\s*\}/, + next: "pop" + }, { + include: "#value" + }, { + defaultToken: "source.tag.embedded.source.prisma" + }] + }] + }; + + this.normalizeRules(); +}; + +PrismaHighlightRules.metaData = { + name: "Prisma", + scopeName: "source.prisma" +}; + + +oop.inherits(PrismaHighlightRules, TextHighlightRules); + +exports.PrismaHighlightRules = PrismaHighlightRules; +}); + +define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) { +"use strict"; + +var oop = require("../../lib/oop"); +var Range = require("../../range").Range; +var BaseFoldMode = require("./fold_mode").FoldMode; + +var FoldMode = exports.FoldMode = function(commentRegex) { + if (commentRegex) { + this.foldingStartMarker = new RegExp( + this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start) + ); + this.foldingStopMarker = new RegExp( + this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end) + ); + } +}; +oop.inherits(FoldMode, BaseFoldMode); + +(function() { + + this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/; + this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/; + this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/; + this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/; + this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/; + this._getFoldWidgetBase = this.getFoldWidget; + this.getFoldWidget = function(session, foldStyle, row) { + var line = session.getLine(row); + + if (this.singleLineBlockCommentRe.test(line)) { + if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line)) + return ""; + } + + var fw = this._getFoldWidgetBase(session, foldStyle, row); + + if (!fw && this.startRegionRe.test(line)) + return "start"; // lineCommentRegionStart + + return fw; + }; + + this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) { + var line = session.getLine(row); + + if (this.startRegionRe.test(line)) + return this.getCommentRegionBlock(session, line, row); + + var match = line.match(this.foldingStartMarker); + if (match) { + var i = match.index; + + if (match[1]) + return this.openingBracketBlock(session, match[1], row, i); + + var range = session.getCommentFoldRange(row, i + match[0].length, 1); + + if (range && !range.isMultiLine()) { + if (forceMultiline) { + range = this.getSectionRange(session, row); + } else if (foldStyle != "all") + range = null; + } + + return range; + } + + if (foldStyle === "markbegin") + return; + + var match = line.match(this.foldingStopMarker); + if (match) { + var i = match.index + match[0].length; + + if (match[1]) + return this.closingBracketBlock(session, match[1], row, i); + + return session.getCommentFoldRange(row, i, -1); + } + }; + + this.getSectionRange = function(session, row) { + var line = session.getLine(row); + var startIndent = line.search(/\S/); + var startRow = row; + var startColumn = line.length; + row = row + 1; + var endRow = row; + var maxRow = session.getLength(); + while (++row < maxRow) { + line = session.getLine(row); + var indent = line.search(/\S/); + if (indent === -1) + continue; + if (startIndent > indent) + break; + var subRange = this.getFoldWidgetRange(session, "all", row); + + if (subRange) { + if (subRange.start.row <= startRow) { + break; + } else if (subRange.isMultiLine()) { + row = subRange.end.row; + } else if (startIndent == indent) { + break; + } + } + endRow = row; + } + + return new Range(startRow, startColumn, endRow, session.getLine(endRow).length); + }; + this.getCommentRegionBlock = function(session, line, row) { + var startColumn = line.search(/\s*$/); + var maxRow = session.getLength(); + var startRow = row; + + var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/; + var depth = 1; + while (++row < maxRow) { + line = session.getLine(row); + var m = re.exec(line); + if (!m) continue; + if (m[1]) depth--; + else depth++; + + if (!depth) break; + } + + var endRow = row; + if (endRow > startRow) { + return new Range(startRow, startColumn, endRow, line.length); + } + }; + +}).call(FoldMode.prototype); + +}); + +define("ace/mode/prisma",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/prisma_highlight_rules","ace/mode/folding/cstyle"], function(require, exports, module) { +"use strict"; + +var oop = require("../lib/oop"); +var TextMode = require("./text").Mode; +var PrismaHighlightRules = require("./prisma_highlight_rules").PrismaHighlightRules; +var FoldMode = require("./folding/cstyle").FoldMode; + +var Mode = function() { + this.HighlightRules = PrismaHighlightRules; + this.foldingRules = new FoldMode(); +}; +oop.inherits(Mode, TextMode); + +(function() { + this.lineCommentStart = "//"; + this.$id = "ace/mode/prisma"; +}).call(Mode.prototype); + +exports.Mode = Mode; +}); (function() { + window.require(["ace/mode/prisma"], function(m) { + if (typeof module == "object" && typeof exports == "object" && module) { + module.exports = m; + } + }); + })(); + \ No newline at end of file diff --git a/htdocs/includes/ace/src/mode-protobuf.js b/htdocs/includes/ace/src/mode-protobuf.js index 0d1a19a5cc4..a4463de826b 100644 --- a/htdocs/includes/ace/src/mode-protobuf.js +++ b/htdocs/includes/ace/src/mode-protobuf.js @@ -65,7 +65,7 @@ var c_cppHighlightRules = function() { var storageType = ( "asm|__asm__|auto|bool|_Bool|char|_Complex|double|enum|float|" + - "_Imaginary|int|long|short|signed|struct|typedef|union|unsigned|void|" + + "_Imaginary|int|int8_t|int16_t|int32_t|int64_t|long|short|signed|size_t|struct|typedef|uint8_t|uint16_t|uint32_t|uint64_t|union|unsigned|void|" + "class|wchar_t|template|char16_t|char32_t" ); @@ -489,6 +489,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/c_cpp"; + this.snippetFileId = "ace/snippets/c_cpp"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-puppet.js b/htdocs/includes/ace/src/mode-puppet.js index ea6b2356261..d647dea6f7e 100644 --- a/htdocs/includes/ace/src/mode-puppet.js +++ b/htdocs/includes/ace/src/mode-puppet.js @@ -44,7 +44,7 @@ var PuppetHighlightRules = function () { }, { token: "multiline.comment.begin.puppet", - regex: '^\\s*\\/\\*\\s*$', + regex: '^\\s*\\/\\*', push: "blockComment" }, { @@ -82,11 +82,7 @@ var PuppetHighlightRules = function () { } ], blockComment: [{ - regex: "^\\s*\\/\\*\\s*$", - token: "multiline.comment.begin.puppet", - push: "blockComment" - }, { - regex: "^\\s*\\*\\/\\s*$", + regex: "\\*\\/", token: "multiline.comment.end.puppet", next: "pop" }, { @@ -355,6 +351,9 @@ oop.inherits(Mode, TextMode); (function () { + this.lineCommentStart = "#"; + this.blockComment = {start: "/*", end: "*/"}; + this.$id = "ace/mode/puppet"; }).call(Mode.prototype); diff --git a/htdocs/includes/ace/src/mode-python.js b/htdocs/includes/ace/src/mode-python.js index e2045c8ac18..6c46043a46b 100644 --- a/htdocs/includes/ace/src/mode-python.js +++ b/htdocs/includes/ace/src/mode-python.js @@ -343,10 +343,10 @@ var PythonHighlightRules = function() { regex: "\\s+" }, { token: "string", - regex: "'(.)*'" + regex: "'[^']*'" }, { token: "string", - regex: '"(.)*"' + regex: '"[^"]*"' }, { token: "function.support", regex: "(!s|!r|!a)" @@ -494,6 +494,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/python"; + this.snippetFileId = "ace/snippets/python"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-qml.js b/htdocs/includes/ace/src/mode-qml.js new file mode 100644 index 00000000000..ba61ca66439 --- /dev/null +++ b/htdocs/includes/ace/src/mode-qml.js @@ -0,0 +1,381 @@ +define("ace/mode/qml_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) { + "use strict"; + + var oop = require("../lib/oop"); + var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; + + var QmlHighlightRules = function() { + var keywordMapper = this.createKeywordMapper({ + "variable.language": + "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors + "Namespace|QName|XML|XMLList|" + // E4X + "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" + + "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" + + "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors + "SyntaxError|TypeError|URIError|" + + "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions + "isNaN|parseFloat|parseInt|" + + "JSON|Math|" + // Other + "this|arguments|prototype|window|document" , // Pseudo + "keyword": + "const|yield|import|get|set|async|await|" + + "break|case|catch|continue|default|delete|do|else|finally|for|function|" + + "if|in|of|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" + + "__parent__|__count__|escape|unescape|with|__proto__|" + + "class|enum|extends|super|export|implements|private|public|interface|package|protected|static|" + + "readonly|string|int|bool|date|color|url|real|double|var|variant|" + + "height|width|anchors|parent|" + + "Abstract3DSeries|AbstractActionInput|AbstractAnimation|AbstractAxis|AbstractAxis3D|AbstractAxisInput|" + + "AbstractBarSeries|AbstractButton|AbstractClipAnimator|AbstractClipBlendNode|AbstractDataProxy|AbstractGraph3D|" + + "AbstractInputHandler3D|AbstractPhysicalDevice|AbstractRayCaster|AbstractSeries|AbstractSkeleton|AbstractTextureImage|" + + "Accelerometer|AccelerometerReading|Accessible|Action|ActionGroup|ActionInput|" + + "AdditiveClipBlend|Address|Affector|Age|AlphaCoverage|AlphaTest|" + + "Altimeter|AltimeterReading|AmbientLightReading|AmbientLightSensor|AmbientTemperatureReading|AmbientTemperatureSensor|" + + "AnalogAxisInput|AnchorAnimation|AnchorChanges|AngleDirection|AnimatedImage|AnimatedSprite|" + + "Animation|AnimationController|AnimationGroup|Animator|ApplicationWindow|ApplicationWindowStyle|" + + "AreaSeries|Armature|AttenuationModelInverse|AttenuationModelLinear|Attractor|Attribute|" + + "Audio|AudioCategory|AudioEngine|AudioListener|AudioSample|AuthenticationDialogRequest|" + + "Axis|AxisAccumulator|AxisSetting|BackspaceKey|Bar3DSeries|BarCategoryAxis|" + + "BarDataProxy|BarSeries|BarSet|Bars3D|BaseKey|Behavior|" + + "Binding|Blend|BlendEquation|BlendEquationArguments|BlendedClipAnimator|BlitFramebuffer|" + + "BluetoothDiscoveryModel|BluetoothService|BluetoothSocket|BorderImage|BorderImageMesh|BoxPlotSeries|" + + "BoxSet|BrightnessContrast|Buffer|BusyIndicator|BusyIndicatorStyle|Button|" + + "ButtonAxisInput|ButtonGroup|ButtonStyle|Calendar|CalendarStyle|Camera|" + + "Camera3D|CameraCapabilities|CameraCapture|CameraExposure|CameraFlash|CameraFocus|" + + "CameraImageProcessing|CameraLens|CameraRecorder|CameraSelector|CandlestickSeries|CandlestickSet|" + + "Canvas|Canvas3D|Canvas3DAbstractObject|Canvas3DActiveInfo|Canvas3DBuffer|Canvas3DContextAttributes|" + + "Canvas3DFrameBuffer|Canvas3DProgram|Canvas3DRenderBuffer|Canvas3DShader|Canvas3DShaderPrecisionFormat|Canvas3DTexture|" + + "Canvas3DTextureProvider|Canvas3DUniformLocation|CanvasGradient|CanvasImageData|CanvasPixelArray|Category|" + + "CategoryAxis|CategoryAxis3D|CategoryModel|CategoryRange|ChangeLanguageKey|ChartView|" + + "CheckBox|CheckBoxStyle|CheckDelegate|CircularGauge|CircularGaugeStyle|ClearBuffers|" + + "ClipAnimator|ClipPlane|CloseEvent|ColorAnimation|ColorDialog|ColorDialogRequest|" + + "ColorGradient|ColorGradientStop|ColorMask|ColorOverlay|Colorize|Column|" + + "ColumnLayout|ComboBox|ComboBoxStyle|Compass|CompassReading|Component|Component3D|" + + "ComputeCommand|ConeGeometry|ConeMesh|ConicalGradient|Connections|ContactDetail|" + + "ContactDetails|Container|Context2D|Context3D|ContextMenuRequest|Control|" + + "CoordinateAnimation|CuboidGeometry|CuboidMesh|CullFace|CumulativeDirection|" + + "Custom3DItem|Custom3DLabel|Custom3DVolume|CustomParticle|CylinderGeometry|CylinderMesh|" + + "Date|DateTimeAxis|DelayButton|DelayButtonStyle|DelegateChoice|DelegateChooser|DelegateModel|" + + "DelegateModelGroup|DepthTest|Desaturate|Dial|DialStyle|Dialog|DialogButtonBox|DiffuseMapMaterial|" + + "DiffuseSpecularMapMaterial|DiffuseSpecularMaterial|Direction|DirectionalBlur|DirectionalLight|DispatchCompute|" + + "Displace|DistanceReading|DistanceSensor|Dithering|DoubleValidator|Drag|DragEvent|DragHandler|Drawer|DropArea|" + + "DropShadow|DwmFeatures|DynamicParameter|EditorialModel|Effect|EllipseShape|Emitter|EnterKey|EnterKeyAction|" + + "Entity|EntityLoader|EnvironmentLight|EventConnection|EventPoint|EventTouchPoint|ExclusiveGroup|ExtendedAttributes|" + + "ExtrudedTextGeometry|ExtrudedTextMesh|FastBlur|FileDialog|FileDialogRequest|FillerKey|FilterKey|FinalState|" + + "FirstPersonCameraController|Flickable|Flipable|Flow|FocusScope|FolderListModel|FontDialog|FontLoader|" + + "FontMetrics|FormValidationMessageRequest|ForwardRenderer|Frame|FrameAction|FrameGraphNode|Friction|" + + "FrontFace|FrustumCulling|FullScreenRequest|GLStateDumpExt|GammaAdjust|Gauge|GaugeStyle|GaussianBlur|" + + "GeocodeModel|Geometry|GeometryRenderer|GestureEvent|Glow|GoochMaterial|Gradient|GradientStop|GraphicsApiFilter|" + + "GraphicsInfo|Gravity|Grid|GridLayout|GridMesh|GridView|GroupBox|GroupGoal|Gyroscope|GyroscopeReading|HBarModelMapper|" + + "HBoxPlotModelMapper|HCandlestickModelMapper|HPieModelMapper|HXYModelMapper|HandlerPoint|HandwritingInputPanel|" + + "HandwritingModeKey|HeightMapSurfaceDataProxy|HideKeyboardKey|HistoryState|HolsterReading|HolsterSensor|HorizontalBarSeries|" + + "|HorizontalPercentBarSeries|HorizontalStackedBarSeries|HoverHandler|HueSaturation|HumidityReading|HumiditySensor|" + + "IRProximityReading|IRProximitySensor|Icon|Image|ImageModel|ImageParticle|InnerShadow|InputChord|InputContext|InputEngine|" + + "InputHandler3D|InputMethod|InputModeKey|InputPanel|InputSequence|InputSettings|Instantiator|IntValidator|InvokedServices|" + + "Item|ItemDelegate|ItemGrabResult|ItemModelBarDataProxy|ItemModelScatterDataProxy|ItemModelSurfaceDataProxy|ItemParticle|" + + "ItemSelectionModel|IviApplication|IviSurface|JavaScriptDialogRequest|Joint|JumpList|JumpListCategory|JumpListDestination|" + + "JumpListLink|JumpListSeparator|Key|KeyEvent|KeyIcon|KeyNavigation|KeyPanel|KeyboardColumn|KeyboardDevice|KeyboardHandler|" + + "KeyboardLayout|KeyboardLayoutLoader|KeyboardRow|KeyboardStyle|KeyframeAnimation|Keys|Label|Layer|LayerFilter|Layout|" + + "LayoutMirroring|Legend|LerpBlend|LevelAdjust|LevelOfDetail|LevelOfDetailBoundingSphere|LevelOfDetailLoader|" + + "LevelOfDetailSwitch|LidReading|LidSensor|Light|Light3D|LightReading|LightSensor|LineSeries|LineShape|LineWidth|" + + "LinearGradient|ListElement|ListModel|ListView|Loader|Locale|Location|LogValueAxis|LogValueAxis3DFormatter|LoggingCategory|" + + "LogicalDevice|Magnetometer|MagnetometerReading|Map|MapCircle|MapCircleObject|MapCopyrightNotice|MapGestureArea|MapIconObject|" + + "MapItemGroup|MapItemView|MapObjectView|MapParameter|MapPinchEvent|MapPolygon|MapPolygonObject|MapPolyline|MapPolylineObject|" + + "MapQuickItem|MapRectangle|MapRoute|MapRouteObject|MapType|Margins|MaskShape|MaskedBlur|Material|Matrix4x4|MediaPlayer|" + + "MemoryBarrier|Menu|MenuBar|MenuBarItem|MenuBarStyle|MenuItem|MenuSeparator|MenuStyle|Mesh|MessageDialog|ModeKey|MorphTarget|" + + "MorphingAnimation|MouseArea|MouseDevice|MouseEvent|MouseHandler|MultiPointHandler|MultiPointTouchArea|MultiSampleAntiAliasing|" + + "Navigator|NdefFilter|NdefMimeRecord|NdefRecord|NdefTextRecord|NdefUriRecord|NearField|NoDepthMask|NoDraw|Node|NodeInstantiator|" + + "NormalDiffuseMapAlphaMaterial|NormalDiffuseMapMaterial|NormalDiffuseSpecularMapMaterial|Number|NumberAnimation|NumberKey|Object3D|" + + "ObjectModel|ObjectPicker|OpacityAnimator|OpacityMask|OpenGLInfo|OrbitCameraController|OrientationReading|OrientationSensor|Overlay|" + + "Package|Page|PageIndicator|Pane|ParallelAnimation|Parameter|ParentAnimation|ParentChange|Particle|ParticleGroup|ParticlePainter|" + + "ParticleSystem|Path|PathAngleArc|PathAnimation|PathArc|PathAttribute|PathCubic|PathCurve|PathElement|PathInterpolator|PathLine|" + + "PathMove|PathPercent|PathQuad|PathSvg|PathView|PauseAnimation|PerVertexColorMaterial|PercentBarSeries|PhongAlphaMaterial|" + + "PhongMaterial|PickEvent|PickLineEvent|PickPointEvent|PickTriangleEvent|PickingSettings|Picture|PieMenu|PieMenuStyle|PieSeries|" + + "PieSlice|PinchArea|PinchEvent|PinchHandler|Place|PlaceAttribute|PlaceSearchModel|PlaceSearchSuggestionModel|PlaneGeometry|" + + "PlaneMesh|PlayVariation|Playlist|PlaylistItem|Plugin|PluginParameter|PointDirection|PointHandler|PointLight|PointSize|" + + "PointerDevice|PointerDeviceHandler|PointerEvent|PointerHandler|PolarChartView|PolygonOffset|Popup|Position|PositionSource|" + + "Positioner|PressureReading|PressureSensor|Product|ProgressBar|ProgressBarStyle|PropertyAction|PropertyAnimation|PropertyChanges|" + + "ProximityFilter|ProximityReading|ProximitySensor|QAbstractState|QAbstractTransition|QSignalTransition|" + + "QVirtualKeyboardSelectionListModel|Qt|QtMultimedia|QtObject|QtPositioning|QuaternionAnimation|QuotaRequest|RadialBlur|" + + "RadialGradient|Radio|RadioButton|RadioButtonStyle|RadioData|RadioDelegate|RangeSlider|Ratings|RayCaster|Rectangle|" + + "RectangleShape|RectangularGlow|RecursiveBlur|RegExpValidator|RegisterProtocolHandlerRequest|RenderCapture|" + + "RenderCaptureReply|RenderPass|RenderPassFilter|RenderSettings|RenderState|RenderStateSet|RenderSurfaceSelector|" + + "RenderTarget|RenderTargetOutput|RenderTargetSelector|Repeater|ReviewModel|Rotation|RotationAnimation|RotationAnimator|" + + "RotationReading|RotationSensor|RoundButton|Route|RouteLeg|RouteManeuver|RouteModel|RouteQuery|RouteSegment|Row|" + + "RowLayout|Scale|ScaleAnimator|Scatter3D|Scatter3DSeries|ScatterDataProxy|ScatterSeries|Scene2D|Scene3D|SceneLoader|" + + "ScissorTest|Screen|ScreenRayCaster|ScriptAction|ScrollBar|ScrollIndicator|ScrollView|ScrollViewStyle|ScxmlStateMachine|" + + "SeamlessCubemap|SelectionListItem|Sensor|SensorGesture|SensorGlobal|SensorReading|SequentialAnimation|Settings|" + + "SettingsStore|ShaderEffect|ShaderEffectSource|ShaderProgram|ShaderProgramBuilder|Shape|ShellSurface|ShellSurfaceItem|" + + "ShiftHandler|ShiftKey|Shortcut|SignalSpy|SignalTransition|SinglePointHandler|Skeleton|SkeletonLoader|Slider|SliderStyle|" + + "SmoothedAnimation|SortPolicy|Sound|SoundEffect|SoundInstance|SpaceKey|SphereGeometry|SphereMesh|SpinBox|SpinBoxStyle|" + + "SplineSeries|SplitView|SpotLight|SpringAnimation|Sprite|SpriteGoal|SpriteSequence|Stack|StackLayout|StackView|" + + "StackViewDelegate|StackedBarSeries|State|StateChangeScript|StateGroup|StateMachine|StateMachineLoader|StatusBar|" + + "StatusBarStyle|StatusIndicator|StatusIndicatorStyle|StencilMask|StencilOperation|StencilOperationArguments|StencilTest|" + + "StencilTestArguments|Store|String|Supplier|Surface3D|Surface3DSeries|SurfaceDataProxy|SwipeDelegate|SwipeView|Switch|" + + "SwitchDelegate|SwitchStyle|SymbolModeKey|SystemPalette|Tab|TabBar|TabButton|TabView|TabViewStyle|TableView|TableViewColumn|" + + "TableViewStyle|TapHandler|TapReading|TapSensor|TargetDirection|TaskbarButton|Technique|TechniqueFilter|TestCase|Text|TextArea|" + + "TextAreaStyle|TextEdit|TextField|TextFieldStyle|TextInput|TextMetrics|TextureImage|TextureImageFactory|Theme3D|ThemeColor|" + + "ThresholdMask|ThumbnailToolBar|ThumbnailToolButton|TiltReading|TiltSensor|TimeoutTransition|Timer|ToggleButton|" + + "ToggleButtonStyle|ToolBar|ToolBarStyle|ToolButton|ToolSeparator|ToolTip|Torch|TorusGeometry|TorusMesh|TouchEventSequence|" + + "TouchInputHandler3D|TouchPoint|Trace|TraceCanvas|TraceInputArea|TraceInputKey|TraceInputKeyPanel|TrailEmitter|Transaction|" + + "Transform|Transition|Translate|TreeView|TreeViewStyle|Tumbler|TumblerColumn|TumblerStyle|Turbulence|UniformAnimator|User|" + + "VBarModelMapper|VBoxPlotModelMapper|VCandlestickModelMapper|VPieModelMapper|VXYModelMapper|ValueAxis|ValueAxis3D|" + + "ValueAxis3DFormatter|Vector3dAnimation|VertexBlendAnimation|Video|VideoOutput|ViewTransition|Viewport|" + + "VirtualKeyboardSettings|Wander|WavefrontMesh|WaylandClient|WaylandCompositor|WaylandHardwareLayer|" + + "WaylandOutput|WaylandQuickItem|WaylandSeat|WaylandSurface|WaylandView|Waypoint|" + + "WebChannel|WebEngine|WebEngineAction|WebEngineCertificateError|WebEngineDownloadItem|WebEngineHistory|" + + "WebEngineHistoryListModel|WebEngineLoadRequest|WebEngineNavigationRequest|WebEngineNewViewRequest|WebEngineProfile|WebEngineScript|" + + "WebEngineSettings|WebEngineView|WebSocket|WebSocketServer|WebView|WebViewLoadRequest|" + + "WheelEvent|Window|WlShell|WlShellSurface|WorkerScript|XAnimator|" + + "XYPoint|XYSeries|XdgDecorationManagerV1|XdgPopup|XdgPopupV5|XdgPopupV6|" + + "XdgShell|XdgShellV5|XdgShellV6|XdgSurface|XdgSurfaceV5|XdgSurfaceV6|" + + "XdgToplevel|XdgToplevelV6|XmlListModel|XmlRole|YAnimator|ZoomBlur", + "storage.type": + "const|let|var|function|" + // js + "property|", // qml + "constant.language": + "null|Infinity|NaN|undefined", + "support.function": + "print|console\\.log", + "constant.language.boolean": "true|false" + }, "identifier"); + this.$rules = { + "start" : [ + { + token : "string", // single line + regex : '"', + next : "string" + }, { + token : "constant.numeric", // hex + regex : "0[xX][0-9a-fA-F]+\\b" + }, { + token : "constant.numeric", // float + regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" + }, { + token : "constant.language.boolean", + regex : "(?:true|false)\\b" + }, { + token : "text", + regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" + }, { + token : "comment", + regex : "\\/\\/.*$" + }, { + token : "comment.start", + regex : "\\/\\*", + next : "comment" + }, { + token : "paren.lparen", + regex : "[[({]" + }, { + token : "paren.rparen", + regex : "[\\])}]" + }, { + token : "text", + regex : "\\s+" + }, { + token : keywordMapper, + regex : "\\b\\w+\\b" + } + ], + "string" : [ + { + token : "constant.language.escape", + regex : /\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|["\\\/bfnrt])/ + }, { + token : "string", + regex : '"|$', + next : "start" + }, { + defaultToken : "string" + } + ], + "comment" : [ + { + token : "comment.end", + regex : "\\*\\/", + next : "start" + }, { + defaultToken: "comment" + } + ] + }; + + }; + + oop.inherits(QmlHighlightRules, TextHighlightRules); + + exports.QmlHighlightRules = QmlHighlightRules; + }); + +define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) { +"use strict"; + +var oop = require("../../lib/oop"); +var Range = require("../../range").Range; +var BaseFoldMode = require("./fold_mode").FoldMode; + +var FoldMode = exports.FoldMode = function(commentRegex) { + if (commentRegex) { + this.foldingStartMarker = new RegExp( + this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start) + ); + this.foldingStopMarker = new RegExp( + this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end) + ); + } +}; +oop.inherits(FoldMode, BaseFoldMode); + +(function() { + + this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/; + this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/; + this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/; + this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/; + this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/; + this._getFoldWidgetBase = this.getFoldWidget; + this.getFoldWidget = function(session, foldStyle, row) { + var line = session.getLine(row); + + if (this.singleLineBlockCommentRe.test(line)) { + if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line)) + return ""; + } + + var fw = this._getFoldWidgetBase(session, foldStyle, row); + + if (!fw && this.startRegionRe.test(line)) + return "start"; // lineCommentRegionStart + + return fw; + }; + + this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) { + var line = session.getLine(row); + + if (this.startRegionRe.test(line)) + return this.getCommentRegionBlock(session, line, row); + + var match = line.match(this.foldingStartMarker); + if (match) { + var i = match.index; + + if (match[1]) + return this.openingBracketBlock(session, match[1], row, i); + + var range = session.getCommentFoldRange(row, i + match[0].length, 1); + + if (range && !range.isMultiLine()) { + if (forceMultiline) { + range = this.getSectionRange(session, row); + } else if (foldStyle != "all") + range = null; + } + + return range; + } + + if (foldStyle === "markbegin") + return; + + var match = line.match(this.foldingStopMarker); + if (match) { + var i = match.index + match[0].length; + + if (match[1]) + return this.closingBracketBlock(session, match[1], row, i); + + return session.getCommentFoldRange(row, i, -1); + } + }; + + this.getSectionRange = function(session, row) { + var line = session.getLine(row); + var startIndent = line.search(/\S/); + var startRow = row; + var startColumn = line.length; + row = row + 1; + var endRow = row; + var maxRow = session.getLength(); + while (++row < maxRow) { + line = session.getLine(row); + var indent = line.search(/\S/); + if (indent === -1) + continue; + if (startIndent > indent) + break; + var subRange = this.getFoldWidgetRange(session, "all", row); + + if (subRange) { + if (subRange.start.row <= startRow) { + break; + } else if (subRange.isMultiLine()) { + row = subRange.end.row; + } else if (startIndent == indent) { + break; + } + } + endRow = row; + } + + return new Range(startRow, startColumn, endRow, session.getLine(endRow).length); + }; + this.getCommentRegionBlock = function(session, line, row) { + var startColumn = line.search(/\s*$/); + var maxRow = session.getLength(); + var startRow = row; + + var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/; + var depth = 1; + while (++row < maxRow) { + line = session.getLine(row); + var m = re.exec(line); + if (!m) continue; + if (m[1]) depth--; + else depth++; + + if (!depth) break; + } + + var endRow = row; + if (endRow > startRow) { + return new Range(startRow, startColumn, endRow, line.length); + } + }; + +}).call(FoldMode.prototype); + +}); + +define("ace/mode/qml",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/qml_highlight_rules","ace/mode/folding/cstyle"], function(require, exports, module) { + "use strict"; + + var oop = require("../lib/oop"); + var TextMode = require("./text").Mode; + var QmlHighlightRules = require("./qml_highlight_rules").QmlHighlightRules; + var FoldMode = require("./folding/cstyle").FoldMode; + + var Mode = function() { + this.HighlightRules = QmlHighlightRules; + this.foldingRules = new FoldMode(); + this.$behaviour = this.$defaultBehaviour; + }; + oop.inherits(Mode, TextMode); + + (function() { + this.lineCommentStart = "//"; + this.blockComment = {start: "/*", end: "*/"}; + this.$quotes = { '"': '"', "'": "'" }; + this.$id = "ace/mode/qml"; + }).call(Mode.prototype); + + exports.Mode = Mode; + }); (function() { + window.require(["ace/mode/qml"], function(m) { + if (typeof module == "object" && typeof exports == "object" && module) { + module.exports = m; + } + }); + })(); + \ No newline at end of file diff --git a/htdocs/includes/ace/src/mode-r.js b/htdocs/includes/ace/src/mode-r.js index 5a6ca976129..2fd49378749 100644 --- a/htdocs/includes/ace/src/mode-r.js +++ b/htdocs/includes/ace/src/mode-r.js @@ -299,6 +299,7 @@ define("ace/mode/r",["require","exports","module","ace/unicode","ace/range","ace this.nonTokenRe = new RegExp("^(?:[^" + unicode.wordChars + "._]|\s])+", "g"); this.$id = "ace/mode/r"; + this.snippetFileId = "ace/snippets/r"; }).call(Mode.prototype); exports.Mode = Mode; }); (function() { diff --git a/htdocs/includes/ace/src/mode-perl6.js b/htdocs/includes/ace/src/mode-raku.js similarity index 96% rename from htdocs/includes/ace/src/mode-perl6.js rename to htdocs/includes/ace/src/mode-raku.js index 4d25513c3ee..d2a829c08cc 100644 --- a/htdocs/includes/ace/src/mode-perl6.js +++ b/htdocs/includes/ace/src/mode-raku.js @@ -1,10 +1,10 @@ -define("ace/mode/perl6_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) { +define("ace/mode/raku_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; -var Perl6HighlightRules = function() { +var RakuHighlightRules = function() { var keywords = ( "my|our|class|role|grammar|is|does|sub|method|submethod|try|" + @@ -34,7 +34,7 @@ var Perl6HighlightRules = function() { "Pod::Block|Pod::Block::Code|Pod::Block::Comment|Pod::Block::Declarator|"+ "Pod::Block::Named|Pod::Block::Para|Pod::Block::Table|Pod::Heading|Pod::Item|"+ "Positional|PositionalBindFailover|Proc|Proc::Async|Promise|Proxy|PseudoStash|"+ - "QuantHash|Range|Rat|Rational|RatStr|Real|Regex|Routine|Scalar|Scheduler|"+ + "Raku|QuantHash|Range|Rat|Rational|RatStr|Real|Regex|Routine|Scalar|Scheduler|"+ "Semaphore|Seq|Set|SetHash|Setty|Signature|Slip|Stash|Str|StrDistance|Stringy|"+ "Sub|Submethod|Supplier|Supplier::Preserving|Supply|Systemic|Tap|Telemetry|"+ "Telemetry::Instrument::Thread|Telemetry::Instrument::Usage|Telemetry::Period|"+ @@ -120,7 +120,7 @@ var Perl6HighlightRules = function() { "positional|posix|postfix|postmatch|precomp-ext|precomp-target|pred|prefix|prematch|prepend|"+ "print|printf|print-nl|print-to|private|private_method_table|proc|produce|Promise|prompt|"+ "protect|pull-one|push|push-all|push-at-least|push-exactly|push-until-lazy|put|"+ - "qualifier-type|quit|r|race|radix|rand|range|raw|re|read|readchars|readonly|"+ + "qualifier-type|quit|r|race|radix|raku|rand|range|raw|re|read|readchars|readonly|"+ "ready|Real|reallocate|reals|reason|rebless|receive|recv|redispatcher|redo|reduce|"+ "rel2abs|relative|release|rename|repeated|replacement|report|reserved|resolve|"+ "restore|result|resume|rethrow|reverse|right|rindex|rmdir|roles_to_compose|"+ @@ -339,9 +339,9 @@ var Perl6HighlightRules = function() { }; }; -oop.inherits(Perl6HighlightRules, TextHighlightRules); +oop.inherits(RakuHighlightRules, TextHighlightRules); -exports.Perl6HighlightRules = Perl6HighlightRules; +exports.RakuHighlightRules = RakuHighlightRules; }); define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module) { @@ -524,17 +524,17 @@ oop.inherits(FoldMode, BaseFoldMode); }); -define("ace/mode/perl6",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/perl6_highlight_rules","ace/mode/matching_brace_outdent","ace/mode/folding/cstyle"], function(require, exports, module) { +define("ace/mode/raku",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/raku_highlight_rules","ace/mode/matching_brace_outdent","ace/mode/folding/cstyle"], function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; -var Perl6HighlightRules = require("./perl6_highlight_rules").Perl6HighlightRules; +var RakuHighlightRules = require("./raku_highlight_rules").RakuHighlightRules; var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; var CStyleFoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { - this.HighlightRules = Perl6HighlightRules; + this.HighlightRules = RakuHighlightRules; this.$outdent = new MatchingBraceOutdent(); this.foldingRules = new CStyleFoldMode({start: "^=(begin)\\b", end: "^=(end)\\b"}); @@ -579,12 +579,12 @@ oop.inherits(Mode, TextMode); this.$outdent.autoOutdent(doc, row); }; - this.$id = "ace/mode/perl6"; + this.$id = "ace/mode/raku"; }).call(Mode.prototype); exports.Mode = Mode; }); (function() { - window.require(["ace/mode/perl6"], function(m) { + window.require(["ace/mode/raku"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; } diff --git a/htdocs/includes/ace/src/mode-razor.js b/htdocs/includes/ace/src/mode-razor.js index 5733efd213e..49b7588eee5 100644 --- a/htdocs/includes/ace/src/mode-razor.js +++ b/htdocs/includes/ace/src/mode-razor.js @@ -784,6 +784,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/javascript"; + this.snippetFileId = "ace/snippets/javascript"; }).call(Mode.prototype); exports.Mode = Mode; @@ -1316,6 +1317,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/css"; + this.snippetFileId = "ace/snippets/css"; }).call(Mode.prototype); exports.Mode = Mode; @@ -2493,6 +2495,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/html"; + this.snippetFileId = "ace/snippets/html"; }).call(Mode.prototype); exports.Mode = Mode; @@ -2858,6 +2861,7 @@ oop.inherits(Mode, HtmlMode); }; this.$id = "ace/mode/razor"; + this.snippetFileId = "ace/snippets/razor"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-rhtml.js b/htdocs/includes/ace/src/mode-rhtml.js index f389e63d28e..de4788dfd88 100644 --- a/htdocs/includes/ace/src/mode-rhtml.js +++ b/htdocs/includes/ace/src/mode-rhtml.js @@ -784,6 +784,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/javascript"; + this.snippetFileId = "ace/snippets/javascript"; }).call(Mode.prototype); exports.Mode = Mode; @@ -1316,6 +1317,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/css"; + this.snippetFileId = "ace/snippets/css"; }).call(Mode.prototype); exports.Mode = Mode; @@ -2493,6 +2495,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/html"; + this.snippetFileId = "ace/snippets/html"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-rst.js b/htdocs/includes/ace/src/mode-rst.js index 8a093c05701..23e17db0989 100644 --- a/htdocs/includes/ace/src/mode-rst.js +++ b/htdocs/includes/ace/src/mode-rst.js @@ -242,6 +242,7 @@ oop.inherits(Mode, TextMode); this.type = "text"; this.$id = "ace/mode/rst"; + this.snippetFileId = "ace/snippets/rst"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-ruby.js b/htdocs/includes/ace/src/mode-ruby.js index 6e8afa36877..12398cc9193 100644 --- a/htdocs/includes/ace/src/mode-ruby.js +++ b/htdocs/includes/ace/src/mode-ruby.js @@ -8,17 +8,17 @@ var constantOtherSymbol = exports.constantOtherSymbol = { regex : "[:](?:[A-Za-z_]|[@$](?=[a-zA-Z0-9_]))[a-zA-Z0-9_]*[!=?]?" }; -var qString = exports.qString = { +exports.qString = { token : "string", // single line regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" }; -var qqString = exports.qqString = { +exports.qqString = { token : "string", // single line regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' }; -var tString = exports.tString = { +exports.tString = { token : "string", // backtick string regex : "[`](?:(?:\\\\.)|(?:[^'\\\\]))*?[`]" }; @@ -28,9 +28,34 @@ var constantNumericHex = exports.constantNumericHex = { regex : "0[xX][0-9a-fA-F](?:[0-9a-fA-F]|_(?=[0-9a-fA-F]))*\\b" }; +var constantNumericBinary = exports.constantNumericBinary = { + token: "constant.numeric", + regex: /\b(0[bB][01](?:[01]|_(?=[01]))*)\b/ +}; + +var constantNumericDecimal = exports.constantNumericDecimal = { + token: "constant.numeric", + regex: /\b(0[dD](?:[1-9](?:[\d]|_(?=[\d]))*|0))\b/ +}; + +var constantNumericOctal = exports.constantNumericDecimal = { + token: "constant.numeric", + regex: /\b(0[oO]?(?:[1-7](?:[0-7]|_(?=[0-7]))*|0))\b/ +}; + +var constantNumericRational = exports.constantNumericRational = { + token: "constant.numeric", //rational + complex + regex: /\b([\d]+(?:[./][\d]+)?ri?)\b/ +}; + +var constantNumericComplex = exports.constantNumericComplex = { + token: "constant.numeric", //simple complex numbers + regex: /\b([\d]i)\b/ +}; + var constantNumericFloat = exports.constantNumericFloat = { - token : "constant.numeric", // float - regex : "[+-]?\\d(?:\\d|_(?=\\d))*(?:(?:\\.\\d(?:\\d|_(?=\\d))*)?(?:[eE][+-]?\\d+)?)?\\b" + token : "constant.numeric", // float + complex + regex : "[+-]?\\d(?:\\d|_(?=\\d))*(?:(?:\\.\\d(?:\\d|_(?=\\d))*)?(?:[eE][+-]?\\d+)?)?i?\\b" }; var instanceVariable = exports.instanceVariable = { @@ -70,18 +95,19 @@ var RubyHighlightRules = function() { "filter_parameter_logging|match|get|post|resources|redirect|scope|assert_routing|" + "translate|localize|extract_locale_from_tld|caches_page|expire_page|caches_action|expire_action|" + "cache|expire_fragment|expire_cache_for|observe|cache_sweeper|" + - "has_many|has_one|belongs_to|has_and_belongs_to_many" + "has_many|has_one|belongs_to|has_and_belongs_to_many|p|warn|refine|using|module_function|extend|alias_method|" + + "private_class_method|remove_method|undef_method" ); var keywords = ( "alias|and|BEGIN|begin|break|case|class|def|defined|do|else|elsif|END|end|ensure|" + "__FILE__|finally|for|gem|if|in|__LINE__|module|next|not|or|private|protected|public|" + - "redo|rescue|retry|return|super|then|undef|unless|until|when|while|yield" + "redo|rescue|retry|return|super|then|undef|unless|until|when|while|yield|__ENCODING__|prepend" ); var buildinConstants = ( "true|TRUE|false|FALSE|nil|NIL|ARGF|ARGV|DATA|ENV|RUBY_PLATFORM|RUBY_RELEASE_DATE|" + - "RUBY_VERSION|STDERR|STDIN|STDOUT|TOPLEVEL_BINDING" + "RUBY_VERSION|STDERR|STDIN|STDOUT|TOPLEVEL_BINDING|RUBY_PATCHLEVEL|RUBY_REVISION|RUBY_COPYRIGHT|RUBY_ENGINE|RUBY_ENGINE_VERSION|RUBY_DESCRIPTION" ); var builtinVariables = ( @@ -97,126 +123,191 @@ var RubyHighlightRules = function() { "invalid.deprecated": "debugger" // TODO is this a remnant from js mode? }, "identifier"); + var escapedChars = "\\\\(?:n(?:[1-7][0-7]{0,2}|0)|[nsrtvfbae'\"\\\\]|c(?:\\\\M-)?.|M-(?:\\\\C-|\\\\c)?.|C-(?:\\\\M-)?.|[0-7]{3}|x[\\da-fA-F]{2}|u[\\da-fA-F]{4}|u{[\\da-fA-F]{1,6}(?:\\s[\\da-fA-F]{1,6})*})"; + + var closeParen = { + "(": ")", + "[": "]", + "{": "}", + "<": ">", + "^": "^", + "|": "|", + "%": "%" + }; + this.$rules = { - "start" : [ + "start": [ { - token : "comment", - regex : "#.*$" + token: "comment", + regex: "#.*$" }, { - token : "comment", // multi line comment - regex : "^=begin(?:$|\\s.*$)", - next : "comment" + token: "comment.multiline", // multi line comment + regex: "^=begin(?=$|\\s.*$)", + next: "comment" }, { - token : "string.regexp", - regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)" + token: "string.regexp", + regex: /[/](?=.*\/)/, + next: "regex" }, [{ - regex: "[{}]", onMatch: function(val, state, stack) { - this.next = val == "{" ? this.nextState : ""; - if (val == "{" && stack.length) { - stack.unshift("start", state); - return "paren.lparen"; - } - if (val == "}" && stack.length) { - stack.shift(); - this.next = stack.shift(); - if (this.next.indexOf("string") != -1) - return "paren.end"; - } - return val == "{" ? "paren.lparen" : "paren.rparen"; - }, - nextState: "start" - }, { - token : "string.start", - regex : /"/, - push : [{ - token : "constant.language.escape", - regex : /\\(?:[nsrtvfbae'"\\]|c.|C-.|M-.(?:\\C-.)?|[0-7]{3}|x[\da-fA-F]{2}|u[\da-fA-F]{4})/ + token: ["constant.other.symbol.ruby", "string.start"], + regex: /(:)?(")/, + push: [{ + token: "constant.language.escape", + regex: escapedChars }, { - token : "paren.start", - regex : /#{/, - push : "start" + token: "paren.start", + regex: /#{/, + push: "start" }, { - token : "string.end", - regex : /"/, - next : "pop" + token: "string.end", + regex: /"/, + next: "pop" }, { defaultToken: "string" }] }, { - token : "string.start", - regex : /`/, - push : [{ - token : "constant.language.escape", - regex : /\\(?:[nsrtvfbae'"\\]|c.|C-.|M-.(?:\\C-.)?|[0-7]{3}|x[\da-fA-F]{2}|u[\da-fA-F]{4})/ + token: "string.start", + regex: /`/, + push: [{ + token: "constant.language.escape", + regex: escapedChars }, { - token : "paren.start", - regex : /#{/, - push : "start" + token: "paren.start", + regex: /#{/, + push: "start" }, { - token : "string.end", - regex : /`/, - next : "pop" + token: "string.end", + regex: /`/, + next: "pop" }, { defaultToken: "string" }] }, { - token : "string.start", - regex : /'/, - push : [{ - token : "constant.language.escape", - regex : /\\['\\]/ - }, { - token : "string.end", - regex : /'/, - next : "pop" + token: ["constant.other.symbol.ruby", "string.start"], + regex: /(:)?(')/, + push: [{ + token: "constant.language.escape", + regex: /\\['\\]/ + }, { + token: "string.end", + regex: /'/, + next: "pop" }, { defaultToken: "string" }] + }, { + token: "string.start",//doesn't see any differences between strings and array of strings in highlighting + regex: /%[qwx]([(\[<{^|%])/, onMatch: function (val, state, stack) { + if (stack.length) + stack = []; + var paren = val[val.length - 1]; + stack.unshift(paren, state); + this.next = "qStateWithoutInterpolation"; + return this.token; + } + }, { + token: "string.start", //doesn't see any differences between strings and array of strings in highlighting + regex: /%[QWX]?([(\[<{^|%])/, onMatch: function (val, state, stack) { + if (stack.length) + stack = []; + var paren = val[val.length - 1]; + stack.unshift(paren, state); + this.next = "qStateWithInterpolation"; + return this.token; + } + }, { + token: "constant.other.symbol.ruby", //doesn't see any differences between symbols and array of symbols in highlighting + regex: /%[si]([(\[<{^|%])/, onMatch: function (val, state, stack) { + if (stack.length) + stack = []; + var paren = val[val.length - 1]; + stack.unshift(paren, state); + this.next = "sStateWithoutInterpolation"; + return this.token; + } + }, { + token: "constant.other.symbol.ruby", //doesn't see any differences between symbols and array of symbols in highlighting + regex: /%[SI]([(\[<{^|%])/, onMatch: function (val, state, stack) { + if (stack.length) + stack = []; + var paren = val[val.length - 1]; + stack.unshift(paren, state); + this.next = "sStateWithInterpolation"; + return this.token; + } + }, { + token: "string.regexp", + regex: /%[r]([(\[<{^|%])/, onMatch: function (val, state, stack) { + if (stack.length) + stack = []; + var paren = val[val.length - 1]; + stack.unshift(paren, state); + this.next = "rState"; + return this.token; + } }], { - token : "text", // namespaces aren't symbols - regex : "::" + token: "punctuation", // namespaces aren't symbols + regex: "::" + }, + instanceVariable, + { + token: "variable.global", // global variable + regex: "[$][a-zA-Z_\\d]+" }, { - token : "variable.instance", // instance variable - regex : "@{1,2}[a-zA-Z_\\d]+" + token: "support.class", // class name + regex: "[A-Z][a-zA-Z_\\d]*" }, { - token : "support.class", // class name - regex : "[A-Z][a-zA-Z_\\d]+" + token: ["punctuation.operator", "support.function"], + regex: /(\.)([a-zA-Z_\d]+)(?=\()/ + }, { + token: ["punctuation.operator", "identifier"], + regex: /(\.)([a-zA-Z_][a-zA-Z_\d]*)/ + }, { + token: "string.character", + regex: "\\B\\?(?:" + escapedChars + "|\\S)" + }, { + token: "punctuation.operator", + regex: /\?(?=.+:)/ }, + constantNumericRational, + constantNumericComplex, constantOtherSymbol, constantNumericHex, constantNumericFloat, - + constantNumericBinary, + constantNumericDecimal, + constantNumericOctal, { - token : "constant.language.boolean", - regex : "(?:true|false)\\b" + token: "constant.language.boolean", + regex: "(?:true|false)\\b" }, { - token : keywordMapper, - regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" + token: keywordMapper, + regex: "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" }, { - token : "punctuation.separator.key-value", - regex : "=>" + token: "punctuation.separator.key-value", + regex: "=>" }, { stateName: "heredoc", - onMatch : function(value, currentState, stack) { - var next = value[2] == '-' ? "indentedHeredoc" : "heredoc"; + onMatch: function (value, currentState, stack) { + var next = (value[2] == '-' || value[2] == '~') ? "indentedHeredoc" : "heredoc"; var tokens = value.split(this.splitRegex); stack.push(next, tokens[3]); return [ - {type:"constant", value: tokens[1]}, - {type:"string", value: tokens[2]}, - {type:"support.class", value: tokens[3]}, - {type:"string", value: tokens[4]} + {type: "constant", value: tokens[1]}, + {type: "string", value: tokens[2]}, + {type: "support.class", value: tokens[3]}, + {type: "string", value: tokens[4]} ]; }, - regex : "(<<-?)(['\"`]?)([\\w]+)(['\"`]?)", + regex: "(<<[-~]?)(['\"`]?)([\\w]+)(['\"`]?)", rules: { heredoc: [{ - onMatch: function(value, currentState, stack) { + onMatch: function(value, currentState, stack) { if (value === stack[1]) { stack.shift(); stack.shift(); @@ -233,7 +324,7 @@ var RubyHighlightRules = function() { token: "string", regex: "^ +" }, { - onMatch: function(value, currentState, stack) { + onMatch: function(value, currentState, stack) { if (value === stack[1]) { stack.shift(); stack.shift(); @@ -248,38 +339,261 @@ var RubyHighlightRules = function() { }] } }, { - regex : "$", - token : "empty", - next : function(currentState, stack) { + regex: "$", + token: "empty", + next: function(currentState, stack) { if (stack[0] === "heredoc" || stack[0] === "indentedHeredoc") return stack[0]; return currentState; } + }, { + token: "keyword.operator", + regex: "!|\\$|%|&|\\*|/|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\||\\b(?:in|instanceof|new|delete|typeof|void)" }, { - token : "string.character", - regex : "\\B\\?." + token: "paren.lparen", + regex: "[[({]" }, { - token : "keyword.operator", - regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)" + token: "paren.rparen", + regex: "[\\])}]", + onMatch: function(value, currentState, stack) { + this.next = ''; + if (value == "}" && stack.length > 1 && stack[1] != "start") { + stack.shift(); + this.next = stack.shift(); + } + return this.token; + } }, { - token : "paren.lparen", - regex : "[[({]" + token: "text", + regex: "\\s+" }, { - token : "paren.rparen", - regex : "[\\])}]" - }, { - token : "text", - regex : "\\s+" + token: "punctuation.operator", + regex: /[?:,;.]/ } ], - "comment" : [ + "comment": [ { - token : "comment", // closing comment - regex : "^=end(?:$|\\s.*$)", - next : "start" + token: "comment.multiline", // closing comment + regex: "^=end(?=$|\\s.*$)", + next: "start" }, { - token : "comment", // comment spanning whole line - regex : ".+" + token: "comment", // comment spanning whole line + regex: ".+" + } + ], + "qStateWithInterpolation": [{ + token: "string.start",// excluded nested |^% due to difficulty in realization + regex: /[(\[<{]/, onMatch: function (val, state, stack) { + if (stack.length && val === stack[0]) { + stack.unshift(val, state); + return this.token; + } + return "string"; + } + }, { + token: "constant.language.escape", + regex: escapedChars + }, { + token: "constant.language.escape", + regex: /\\./ + }, { + token: "paren.start", + regex: /#{/, + push: "start" + }, { + token: "string.end", + regex: /[)\]>}^|%]/, onMatch: function (val, state, stack) { + if (stack.length && val === closeParen[stack[0]]) { + stack.shift(); + this.next = stack.shift(); + return this.token; + } + this.next = ''; + return "string"; + } + }, { + defaultToken: "string" + }], + "qStateWithoutInterpolation": [{ + token: "string.start",// excluded nested |^% due to difficulty in realization + regex: /[(\[<{]/, onMatch: function (val, state, stack) { + if (stack.length && val === stack[0]) { + stack.unshift(val, state); + return this.token; + } + return "string"; + } + }, { + token: "constant.language.escape", + regex: /\\['\\]/ + }, { + token: "constant.language.escape", + regex: /\\./ + }, { + token: "string.end", + regex: /[)\]>}^|%]/, onMatch: function (val, state, stack) { + if (stack.length && val === closeParen[stack[0]]) { + stack.shift(); + this.next = stack.shift(); + return this.token; + } + this.next = ''; + return "string"; + } + }, { + defaultToken: "string" + }], + "sStateWithoutInterpolation": [{ + token: "constant.other.symbol.ruby",// excluded nested |^% due to difficulty in realization + regex: /[(\[<{]/, onMatch: function (val, state, stack) { + if (stack.length && val === stack[0]) { + stack.unshift(val, state); + return this.token; + } + return "constant.other.symbol.ruby"; + } + }, { + token: "constant.other.symbol.ruby", + regex: /[)\]>}^|%]/, onMatch: function (val, state, stack) { + if (stack.length && val === closeParen[stack[0]]) { + stack.shift(); + this.next = stack.shift(); + return this.token; + } + this.next = ''; + return "constant.other.symbol.ruby"; + } + }, { + defaultToken: "constant.other.symbol.ruby" + }], + "sStateWithInterpolation": [{ + token: "constant.other.symbol.ruby",// excluded nested |^% due to difficulty in realization + regex: /[(\[<{]/, onMatch: function (val, state, stack) { + if (stack.length && val === stack[0]) { + stack.unshift(val, state); + return this.token; + } + return "constant.other.symbol.ruby"; + } + }, { + token: "constant.language.escape", + regex: escapedChars + }, { + token: "constant.language.escape", + regex: /\\./ + }, { + token: "paren.start", + regex: /#{/, + push: "start" + }, { + token: "constant.other.symbol.ruby", + regex: /[)\]>}^|%]/, onMatch: function (val, state, stack) { + if (stack.length && val === closeParen[stack[0]]) { + stack.shift(); + this.next = stack.shift(); + return this.token; + } + this.next = ''; + return "constant.other.symbol.ruby"; + } + }, { + defaultToken: "constant.other.symbol.ruby" + }], + "rState": [{ + token: "string.regexp",// excluded nested |^% due to difficulty in realization + regex: /[(\[<{]/, onMatch: function (val, state, stack) { + if (stack.length && val === stack[0]) { + stack.unshift(val, state); + return this.token; + } + return "constant.language.escape"; + } + }, { + token: "paren.start", + regex: /#{/, + push: "start" + }, { + token: "string.regexp", + regex: /\// + }, { + token: "string.regexp", + regex: /[)\]>}^|%][imxouesn]*/, onMatch: function (val, state, stack) { + if (stack.length && val[0] === closeParen[stack[0]]) { + stack.shift(); + this.next = stack.shift(); + return this.token; + } + this.next = ''; + return "constant.language.escape"; + } + }, + {include: "regex"}, + { + defaultToken: "string.regexp" + }], + "regex": [ + {// character classes + token: "regexp.keyword", + regex: /\\[wWdDhHsS]/ + }, { + token: "constant.language.escape", + regex: /\\[AGbBzZ]/ + }, { + token: "constant.language.escape", + regex: /\\g<[a-zA-Z0-9]*>/ + }, { + token: ["constant.language.escape", "regexp.keyword", "constant.language.escape"], + regex: /(\\p{\^?)(Alnum|Alpha|Blank|Cntrl|Digit|Graph|Lower|Print|Punct|Space|Upper|XDigit|Word|ASCII|Any|Assigned|Arabic|Armenian|Balinese|Bengali|Bopomofo|Braille|Buginese|Buhid|Canadian_Aboriginal|Carian|Cham|Cherokee|Common|Coptic|Cuneiform|Cypriot|Cyrillic|Deseret|Devanagari|Ethiopic|Georgian|Glagolitic|Gothic|Greek|Gujarati|Gurmukhi|Han|Hangul|Hanunoo|Hebrew|Hiragana|Inherited|Kannada|Katakana|Kayah_Li|Kharoshthi|Khmer|Lao|Latin|Lepcha|Limbu|Linear_B|Lycian|Lydian|Malayalam|Mongolian|Myanmar|New_Tai_Lue|Nko|Ogham|Ol_Chiki|Old_Italic|Old_Persian|Oriya|Osmanya|Phags_Pa|Phoenician|Rejang|Runic|Saurashtra|Shavian|Sinhala|Sundanese|Syloti_Nagri|Syriac|Tagalog|Tagbanwa|Tai_Le|Tamil|Telugu|Thaana|Thai|Tibetan|Tifinagh|Ugaritic|Vai|Yi|Ll|Lm|Lt|Lu|Lo|Mn|Mc|Me|Nd|Nl|Pc|Pd|Ps|Pe|Pi|Pf|Po|No|Sm|Sc|Sk|So|Zs|Zl|Zp|Cc|Cf|Cn|Co|Cs|N|L|M|P|S|Z|C)(})/ + }, { + token: ["constant.language.escape", "invalid", "constant.language.escape"], + regex: /(\\p{\^?)([^/]*)(})/ + }, {// escapes + token: "regexp.keyword.operator", + regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" + }, {// flag + token: "string.regexp", + regex: /[/][imxouesn]*/, + next: "start" + }, {// invalid operators + token: "invalid", + regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/ + }, {// operators + token: "constant.language.escape", + regex: /\(\?(?:[:=!>]|<'?[a-zA-Z]*'?>|<[=!])|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/ + }, { + token: "constant.language.delimiter", + regex: /\|/ + }, { + token: "regexp.keyword", + regex: /\[\[:(?:alnum|alpha|blank|cntrl|digit|graph|lower|print|punct|space|upper|xdigit|word|ascii):\]\]/ + }, { + token: "constant.language.escape", + regex: /\[\^?/, + push: "regex_character_class" + }, { + defaultToken: "string.regexp" + } + ], + "regex_character_class": [ + { + token: "regexp.keyword", + regex: /\\[wWdDhHsS]/ + }, { + token: "regexp.charclass.keyword.operator", + regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" + }, { + token: "constant.language.escape", + regex: /&?&?\[\^?/, + push: "regex_character_class" + }, { + token: "constant.language.escape", + regex: "]", + next: "pop" + }, { + token: "constant.language.escape", + regex: "-" + }, { + defaultToken: "string.regexp.characterclass" } ] }; @@ -332,94 +646,271 @@ var MatchingBraceOutdent = function() {}; exports.MatchingBraceOutdent = MatchingBraceOutdent; }); -define("ace/mode/folding/coffee",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range"], function(require, exports, module) { +define("ace/mode/folding/ruby",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range","ace/token_iterator"], function (require, exports, module) { "use strict"; var oop = require("../../lib/oop"); var BaseFoldMode = require("./fold_mode").FoldMode; var Range = require("../../range").Range; +var TokenIterator = require("../../token_iterator").TokenIterator; + + +var FoldMode = exports.FoldMode = function () { +}; -var FoldMode = exports.FoldMode = function() {}; oop.inherits(FoldMode, BaseFoldMode); -(function() { - - this.getFoldWidgetRange = function(session, foldStyle, row) { - var range = this.indentationBlock(session, row); - if (range) - return range; - - var re = /\S/; - var line = session.getLine(row); - var startLevel = line.search(re); - if (startLevel == -1 || line[startLevel] != "#") - return; - - var startColumn = line.length; - var maxRow = session.getLength(); - var startRow = row; - var endRow = row; - - while (++row < maxRow) { - line = session.getLine(row); - var level = line.search(re); - - if (level == -1) - continue; - - if (line[level] != "#") - break; - - endRow = row; - } - - if (endRow > startRow) { - var endColumn = session.getLine(endRow).length; - return new Range(startRow, startColumn, endRow, endColumn); - } +(function () { + this.indentKeywords = { + "class": 1, + "def": 1, + "module": 1, + "do": 1, + "unless": 1, + "if": 1, + "while": 1, + "for": 1, + "until": 1, + "begin": 1, + "else": 0, + "elsif": 0, + "rescue": 0, + "ensure": 0, + "when": 0, + "end": -1, + "case": 1, + "=begin": 1, + "=end": -1 }; - this.getFoldWidget = function(session, foldStyle, row) { - var line = session.getLine(row); - var indent = line.search(/\S/); - var next = session.getLine(row + 1); - var prev = session.getLine(row - 1); - var prevIndent = prev.search(/\S/); - var nextIndent = next.search(/\S/); - if (indent == -1) { - session.foldWidgets[row - 1] = prevIndent!= -1 && prevIndent < nextIndent ? "start" : ""; - return ""; - } - if (prevIndent == -1) { - if (indent == nextIndent && line[indent] == "#" && next[indent] == "#") { - session.foldWidgets[row - 1] = ""; - session.foldWidgets[row + 1] = ""; + this.foldingStartMarker = /(?:\s|^)(def|do|while|class|unless|module|if|for|until|begin|else|elsif|case|rescue|ensure|when)\b|({\s*$)|(=begin)/; + this.foldingStopMarker = /(=end(?=$|\s.*$))|(^\s*})|\b(end)\b/; + + this.getFoldWidget = function (session, foldStyle, row) { + var line = session.getLine(row); + var isStart = this.foldingStartMarker.test(line); + var isEnd = this.foldingStopMarker.test(line); + + if (isStart && !isEnd) { + var match = line.match(this.foldingStartMarker); + if (match[1]) { + if (match[1] == "if" || match[1] == "else" || match[1] == "while" || match[1] == "until" || match[1] == "unless") { + if (match[1] == "else" && /^\s*else\s*$/.test(line) === false) { + return; + } + if (/^\s*(?:if|else|while|until|unless)\s*/.test(line) === false) { + return; + } + } + + if (match[1] == "when") { + if (/\sthen\s/.test(line) === true) { + return; + } + } + if (session.getTokenAt(row, match.index + 2).type === "keyword") + return "start"; + } else if (match[3]) { + if (session.getTokenAt(row, match.index + 1).type === "comment.multiline") + return "start"; + } else { return "start"; } - } else if (prevIndent == indent && line[indent] == "#" && prev[indent] == "#") { - if (session.getLine(row - 2).search(/\S/) == -1) { - session.foldWidgets[row - 1] = "start"; - session.foldWidgets[row + 1] = ""; - return ""; + } + if (foldStyle != "markbeginend" || !isEnd || isStart && isEnd) + return ""; + + var match = line.match(this.foldingStopMarker); + if (match[3] === "end") { + if (session.getTokenAt(row, match.index + 1).type === "keyword") + return "end"; + } else if (match[1]) { + if (session.getTokenAt(row, match.index + 1).type === "comment.multiline") + return "end"; + } else + return "end"; + }; + + this.getFoldWidgetRange = function (session, foldStyle, row) { + var line = session.doc.getLine(row); + var match = this.foldingStartMarker.exec(line); + if (match) { + if (match[1] || match[3]) + return this.rubyBlock(session, row, match.index + 2); + + return this.openingBracketBlock(session, "{", row, match.index); + } + + var match = this.foldingStopMarker.exec(line); + if (match) { + if (match[3] === "end") { + if (session.getTokenAt(row, match.index + 1).type === "keyword") + return this.rubyBlock(session, row, match.index + 1); + } + + if (match[1] === "=end") { + if (session.getTokenAt(row, match.index + 1).type === "comment.multiline") + return this.rubyBlock(session, row, match.index + 1); + } + + return this.closingBracketBlock(session, "}", row, match.index + match[0].length); + } + }; + + this.rubyBlock = function (session, row, column, tokenRange) { + var stream = new TokenIterator(session, row, column); + + var token = stream.getCurrentToken(); + if (!token || (token.type != "keyword" && token.type != "comment.multiline")) + return; + + var val = token.value; + var line = session.getLine(row); + switch (token.value) { + case "if": + case "unless": + case "while": + case "until": + var checkToken = new RegExp("^\\s*" + token.value); + if (!checkToken.test(line)) { + return; + } + var dir = this.indentKeywords[val]; + break; + case "when": + if (/\sthen\s/.test(line)) { + return; + } + case "elsif": + case "rescue": + case "ensure": + var dir = 1; + break; + case "else": + var checkToken = new RegExp("^\\s*" + token.value + "\\s*$"); + if (!checkToken.test(line)) { + return; + } + var dir = 1; + break; + default: + var dir = this.indentKeywords[val]; + break; + } + + var stack = [val]; + if (!dir) + return; + + var startColumn = dir === -1 ? session.getLine(row - 1).length : session.getLine(row).length; + var startRow = row; + var ranges = []; + ranges.push(stream.getCurrentTokenRange()); + + stream.step = dir === -1 ? stream.stepBackward : stream.stepForward; + if (token.type == "comment.multiline") { + while (token = stream.step()) { + if (token.type !== "comment.multiline") + continue; + if (dir == 1) { + startColumn = 6; + if (token.value == "=end") { + break; + } + } else { + if (token.value == "=begin") { + break; + } + } + } + } else { + while (token = stream.step()) { + var ignore = false; + if (token.type !== "keyword") + continue; + var level = dir * this.indentKeywords[token.value]; + line = session.getLine(stream.getCurrentTokenRow()); + switch (token.value) { + case "do": + for (var i = stream.$tokenIndex - 1; i >= 0; i--) { + var prevToken = stream.$rowTokens[i]; + if (prevToken && (prevToken.value == "while" || prevToken.value == "until" || prevToken.value == "for")) { + level = 0; + break; + } + } + break; + case "else": + var checkToken = new RegExp("^\\s*" + token.value + "\\s*$"); + if (!checkToken.test(line) || val == "case") { + level = 0; + ignore = true; + } + break; + case "if": + case "unless": + case "while": + case "until": + var checkToken = new RegExp("^\\s*" + token.value); + if (!checkToken.test(line)) { + level = 0; + ignore = true; + } + break; + case "when": + if (/\sthen\s/.test(line) || val == "case") { + level = 0; + ignore = true; + } + break; + } + + if (level > 0) { + stack.unshift(token.value); + } else if (level <= 0 && ignore === false) { + stack.shift(); + if (!stack.length) { + if ((val == "while" || val == "until" || val == "for") && token.value != "do") { + break; + } + if (token.value == "do" && dir == -1 && level != 0) + break; + if (token.value != "do") + break; + } + + if (level === 0) { + stack.unshift(token.value); + } + } } } - if (prevIndent!= -1 && prevIndent < indent) - session.foldWidgets[row - 1] = "start"; - else - session.foldWidgets[row - 1] = ""; + if (!token) + return null; - if (indent < nextIndent) - return "start"; - else - return ""; + if (tokenRange) { + ranges.push(stream.getCurrentTokenRange()); + return ranges; + } + + var row = stream.getCurrentTokenRow(); + if (dir === -1) { + if (token.type === "comment.multiline") { + var endColumn = 6; + } else { + var endColumn = session.getLine(row).length; + } + return new Range(row, endColumn, startRow - 1, startColumn); + } else + return new Range(startRow, startColumn, row - 1, session.getLine(row - 1).length); }; }).call(FoldMode.prototype); }); -define("ace/mode/ruby",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/ruby_highlight_rules","ace/mode/matching_brace_outdent","ace/range","ace/mode/behaviour/cstyle","ace/mode/folding/coffee"], function(require, exports, module) { +define("ace/mode/ruby",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/ruby_highlight_rules","ace/mode/matching_brace_outdent","ace/range","ace/mode/behaviour/cstyle","ace/mode/folding/ruby"], function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); @@ -428,13 +919,14 @@ var RubyHighlightRules = require("./ruby_highlight_rules").RubyHighlightRules; var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; var Range = require("../range").Range; var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour; -var FoldMode = require("./folding/coffee").FoldMode; +var FoldMode = require("./folding/ruby").FoldMode; var Mode = function() { this.HighlightRules = RubyHighlightRules; this.$outdent = new MatchingBraceOutdent(); this.$behaviour = new CstyleBehaviour(); this.foldingRules = new FoldMode(); + this.indentKeywords = this.foldingRules.indentKeywords; }; oop.inherits(Mode, TextMode); @@ -449,7 +941,7 @@ oop.inherits(Mode, TextMode); var tokenizedLine = this.getTokenizer().getLineTokens(line, state); var tokens = tokenizedLine.tokens; - if (tokens.length && tokens[tokens.length-1].type == "comment") { + if (tokens.length && tokens[tokens.length - 1].type == "comment") { return indent; } @@ -457,7 +949,7 @@ oop.inherits(Mode, TextMode); var match = line.match(/^.*[\{\(\[]\s*$/); var startingClassOrMethod = line.match(/^\s*(class|def|module)\s.*$/); var startingDoBlock = line.match(/.*do(\s*|\s+\|.*\|\s*)$/); - var startingConditional = line.match(/^\s*(if|else|when)\s*/); + var startingConditional = line.match(/^\s*(if|else|when|elsif|unless|while|for|begin|rescue|ensure)\s*/); if (match || startingClassOrMethod || startingDoBlock || startingConditional) { indent += tab; } @@ -467,7 +959,7 @@ oop.inherits(Mode, TextMode); }; this.checkOutdent = function(state, line, input) { - return /^\s+(end|else)$/.test(line + input) || this.$outdent.checkOutdent(line, input); + return /^\s+(end|else|rescue|ensure)$/.test(line + input) || this.$outdent.checkOutdent(line, input); }; this.autoOutdent = function(state, session, row) { @@ -480,11 +972,24 @@ oop.inherits(Mode, TextMode); var tab = session.getTabString(); if (prevIndent.length <= indent.length) { if (indent.slice(-tab.length) == tab) - session.remove(new Range(row, indent.length-tab.length, row, indent.length)); + session.remove(new Range(row, indent.length - tab.length, row, indent.length)); } }; + this.getMatching = function(session, row, column) { + if (row == undefined) { + var pos = session.selection.lead; + column = pos.column; + row = pos.row; + } + + var startToken = session.getTokenAt(row, column); + if (startToken && startToken.value in this.indentKeywords) + return this.foldingRules.rubyBlock(session, row, column, true); + }; + this.$id = "ace/mode/ruby"; + this.snippetFileId = "ace/snippets/ruby"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-rust.js b/htdocs/includes/ace/src/mode-rust.js index e24ed47a680..19f6a989963 100644 --- a/htdocs/includes/ace/src/mode-rust.js +++ b/htdocs/includes/ace/src/mode-rust.js @@ -5,15 +5,16 @@ var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var stringEscape = /\\(?:[nrt0'"\\]|x[\da-fA-F]{2}|u\{[\da-fA-F]{6}\})/.source; +var wordPattern = /[a-zA-Z_\xa1-\uffff][a-zA-Z0-9_\xa1-\uffff]*/.source; var RustHighlightRules = function() { this.$rules = { start: [ { token: 'variable.other.source.rust', - regex: '\'[a-zA-Z_][a-zA-Z0-9_]*(?![\\\'])' }, + regex: '\'' + wordPattern + '(?![\\\'])' }, { token: 'string.quoted.single.source.rust', regex: "'(?:[^'\\\\]|" + stringEscape + ")'" }, { token: 'identifier', - regex: /r#[a-zA-Z_][a-zA-Z0-9_]*\b/ }, + regex: "r#" + wordPattern + "\\b" }, { stateName: "bracketedComment", onMatch : function(value, currentState, stack){ @@ -53,8 +54,8 @@ var RustHighlightRules = function() { regex: stringEscape }, { defaultToken: 'string.quoted.double.source.rust' } ] }, { token: [ 'keyword.source.rust', 'text', 'entity.name.function.source.rust' ], - regex: '\\b(fn)(\\s+)((?:r#)?[a-zA-Z_][a-zA-Z0-9_]*)' }, - { token: 'support.constant', regex: '\\b[a-zA-Z_][\\w\\d]*::' }, + regex: '\\b(fn)(\\s+)((?:r#)?'+ wordPattern + ')' }, + { token: 'support.constant', regex: wordPattern + '::' }, { token: 'keyword.source.rust', regex: '\\b(?:abstract|alignof|as|async|await|become|box|break|catch|continue|const|crate|default|do|dyn|else|enum|extern|for|final|if|impl|in|let|loop|macro|match|mod|move|mut|offsetof|override|priv|proc|pub|pure|ref|return|self|sizeof|static|struct|super|trait|type|typeof|union|unsafe|unsized|use|virtual|where|while|yield)\\b' }, { token: 'storage.type.source.rust', diff --git a/htdocs/includes/ace/src/mode-scala.js b/htdocs/includes/ace/src/mode-scala.js index b3cd18a601b..68a320ca8fd 100644 --- a/htdocs/includes/ace/src/mode-scala.js +++ b/htdocs/includes/ace/src/mode-scala.js @@ -784,6 +784,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/javascript"; + this.snippetFileId = "ace/snippets/javascript"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-scrypt.js b/htdocs/includes/ace/src/mode-scrypt.js new file mode 100644 index 00000000000..80feb0ed02d --- /dev/null +++ b/htdocs/includes/ace/src/mode-scrypt.js @@ -0,0 +1,364 @@ +define("ace/mode/doc_comment_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) { +"use strict"; + +var oop = require("../lib/oop"); +var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; + +var DocCommentHighlightRules = function() { + this.$rules = { + "start" : [ { + token : "comment.doc.tag", + regex : "@[\\w\\d_]+" // TODO: fix email addresses + }, + DocCommentHighlightRules.getTagRule(), + { + defaultToken : "comment.doc", + caseInsensitive: true + }] + }; +}; + +oop.inherits(DocCommentHighlightRules, TextHighlightRules); + +DocCommentHighlightRules.getTagRule = function(start) { + return { + token : "comment.doc.tag.storage.type", + regex : "\\b(?:TODO|FIXME|XXX|HACK)\\b" + }; +}; + +DocCommentHighlightRules.getStartRule = function(start) { + return { + token : "comment.doc", // doc comment + regex : "\\/\\*(?=\\*)", + next : start + }; +}; + +DocCommentHighlightRules.getEndRule = function (start) { + return { + token : "comment.doc", // closing comment + regex : "\\*\\/", + next : start + }; +}; + + +exports.DocCommentHighlightRules = DocCommentHighlightRules; + +}); + +define("ace/mode/scrypt_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/doc_comment_highlight_rules","ace/mode/text_highlight_rules"], function (require, exports, module) { + "use strict"; + + var oop = require("../lib/oop"); + var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; + var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; + + var scryptHighlightRules = function () { + + var keywords = ( + "contract|library|loop|new|private|" + + "public|if|else|struct|type|" + + "require|static|const|import|exit|return|asm" + ); + + var buildinConstants = ("true|false"); + + + var langClasses = ( + "function|auto|constructor|bytes|int|bool|SigHashPreimage|PrivKey|PubKey|Sig|Ripemd160|Sha1|Sha256|" + + "SigHashType|SigHashPreimage|OpCodeType" + ); + + var keywordMapper = this.createKeywordMapper({ + "variable.language": "this", + "keyword": keywords, + "constant.language": buildinConstants, + "support.function": langClasses + }, "identifier"); + + this.$rules = { + "start": [ + { + token: "comment", + regex: "\\/\\/.*$" + }, + DocCommentHighlightRules.getStartRule("doc-start"), + { + token: "comment", // multi line comment + regex: "\\/\\*", + next: "comment" + }, { + token: "string", // single line + regex: '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' + }, { + token: "string", // single line + regex: "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" + }, { + token: "constant.numeric", // hex + regex: /0(?:[xX][0-9a-fA-F][0-9a-fA-F_]*|[bB][01][01_]*)[LlSsDdFfYy]?\b/ + }, { + token: "constant.numeric", // float + regex: /[+-]?\d[\d_]*(?:(?:\.[\d_]*)?(?:[eE][+-]?[\d_]+)?)?[LlSsDdFfYy]?\b/ + }, { + token: "constant.language.boolean", + regex: "(?:true|false)\\b" + }, + { + token: ["support.function.math.scrypt", "text", "text"], + regex: /\b(abs|min|max|within|ripemd160|sha1|sha256|hash160|hash256|checkSig|checkMultiSig|num2bin|pack|unpack|len|reverseBytes|repeat)(\s*)(\()/ + }, { + token: [ + "entity.name.type.scrypt", + "text", + "text", + "text", + "variable.object.property.scrypt" + ], + regex: /\b(SigHash)(\s*)(\.)(\s*)(ANYONECANPAY|ALL|FORKID|NONE|SINGLE)\b/ + }, + { + token: [ + "entity.name.type.scrypt", + "text", + "text", + "text", + "variable.object.property.scrypt" + ], + regex: /\b(OpCode)(\s*)(\.)(\s*)(OP_PUSHDATA1|OP_PUSHDATA2|OP_PUSHDATA4|OP_0|OP_FALSE|OP_1NEGATE|OP_1|OP_TRUE|OP_2|OP_3|OP_4|OP_5|OP_6|OP_7|OP_8|OP_9|OP_10|OP_11|OP_12|OP_13|OP_14|OP_15|OP_16|OP_1ADD|OP_1SUB|OP_NEGATE|OP_ABS|OP_NOT|OP_0NOTEQUAL|OP_ADD|OP_SUB|OP_MUL|OP_DIV|OP_MOD|OP_LSHIFT|OP_RSHIFT|OP_BOOLAND|OP_BOOLOR|OP_NUMEQUAL|OP_NUMEQUALVERIFY|OP_NUMNOTEQUAL|OP_LESSTHAN|OP_GREATERTHAN|OP_LESSTHANOREQUAL|OP_GREATERTHANOREQUAL|OP_MIN|OP_MAX|OP_WITHIN|OP_CAT|OP_SPLIT|OP_BIN2NUM|OP_NUM2BIN|OP_SIZE|OP_NOP|OP_IF|OP_NOTIF|OP_ELSE|OP_ENDIF|OP_VERIFY|OP_RETURN|OP_TOALTSTACK|OP_FROMALTSTACK|OP_IFDUP|OP_DEPTH|OP_DROP|OP_DUP|OP_NIP|OP_OVER|OP_PICK|OP_ROLL|OP_ROT|OP_SWAP|OP_TUCK|OP_2DROP|OP_2DUP|OP_3DUP|OP_2OVER|OP_2ROT|OP_2SWAP|OP_RIPEMD160|OP_SHA1|OP_SHA256|OP_HASH160|OP_HASH256|OP_CODESEPARATOR|OP_CHECKSIG|OP_CHECKSIGVERIFY|OP_CHECKMULTISIG|OP_CHECKMULTISIGVERIFY|OP_INVERT|OP_AND|OP_OR|OP_XOR|OP_EQUAL|OP_EQUALVERIFY)\b/ + }, { + token: "entity.name.type.scrypt", + regex: /\b(?:P2PKH|P2PK|Tx|HashPuzzleRipemd160|HashPuzzleSha1|HashPuzzleSha256|HashPuzzleHash160|OpCode|SigHash)\b/ + }, { + token: [ + "punctuation.separator.period.scrypt", + 'text', + "entity.name.function.scrypt", + "text", + "punctuation.definition.parameters.begin.bracket.round.scrypt" + ], + regex: /(\.)([^\S$\r]*)([\w][\w\d]*)(\s*)(\()/, + push: [{ + token: "punctuation.definition.parameters.end.bracket.round.scrypt", + regex: /\)/, + next: "pop" + }, { + defaultToken: "start" + }] + }, { + token: keywordMapper, + regex: "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" + }, { + token: "keyword.operator", + regex: "!|\\$|%|&|\\||\\^|\\*|\\/|\\-\\-|\\-|\\+\\+|\\+|~|==|=|!=|<=|>=|<>|<|>|!|&&|\\|\\||\\?|\\:|\\*=|\\/=|%=|\\+=|\\-=|&=|\\|=|\\^=" + }, { + token: "lparen", + regex: "[[({]" + }, { + token: "rparen", + regex: "[\\])}]" + }, { + token: "text", + regex: "\\s+" + } + ], + "comment": [ + { + token: "comment", // closing comment + regex: "\\*\\/", + next: "start" + }, { + defaultToken: "comment" + } + ] + }; + + + this.embedRules(DocCommentHighlightRules, "doc-", + [DocCommentHighlightRules.getEndRule("start")]); + this.normalizeRules(); + }; + + oop.inherits(scryptHighlightRules, TextHighlightRules); + + exports.scryptHighlightRules = scryptHighlightRules; +}); + +define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) { +"use strict"; + +var oop = require("../../lib/oop"); +var Range = require("../../range").Range; +var BaseFoldMode = require("./fold_mode").FoldMode; + +var FoldMode = exports.FoldMode = function(commentRegex) { + if (commentRegex) { + this.foldingStartMarker = new RegExp( + this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start) + ); + this.foldingStopMarker = new RegExp( + this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end) + ); + } +}; +oop.inherits(FoldMode, BaseFoldMode); + +(function() { + + this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/; + this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/; + this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/; + this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/; + this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/; + this._getFoldWidgetBase = this.getFoldWidget; + this.getFoldWidget = function(session, foldStyle, row) { + var line = session.getLine(row); + + if (this.singleLineBlockCommentRe.test(line)) { + if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line)) + return ""; + } + + var fw = this._getFoldWidgetBase(session, foldStyle, row); + + if (!fw && this.startRegionRe.test(line)) + return "start"; // lineCommentRegionStart + + return fw; + }; + + this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) { + var line = session.getLine(row); + + if (this.startRegionRe.test(line)) + return this.getCommentRegionBlock(session, line, row); + + var match = line.match(this.foldingStartMarker); + if (match) { + var i = match.index; + + if (match[1]) + return this.openingBracketBlock(session, match[1], row, i); + + var range = session.getCommentFoldRange(row, i + match[0].length, 1); + + if (range && !range.isMultiLine()) { + if (forceMultiline) { + range = this.getSectionRange(session, row); + } else if (foldStyle != "all") + range = null; + } + + return range; + } + + if (foldStyle === "markbegin") + return; + + var match = line.match(this.foldingStopMarker); + if (match) { + var i = match.index + match[0].length; + + if (match[1]) + return this.closingBracketBlock(session, match[1], row, i); + + return session.getCommentFoldRange(row, i, -1); + } + }; + + this.getSectionRange = function(session, row) { + var line = session.getLine(row); + var startIndent = line.search(/\S/); + var startRow = row; + var startColumn = line.length; + row = row + 1; + var endRow = row; + var maxRow = session.getLength(); + while (++row < maxRow) { + line = session.getLine(row); + var indent = line.search(/\S/); + if (indent === -1) + continue; + if (startIndent > indent) + break; + var subRange = this.getFoldWidgetRange(session, "all", row); + + if (subRange) { + if (subRange.start.row <= startRow) { + break; + } else if (subRange.isMultiLine()) { + row = subRange.end.row; + } else if (startIndent == indent) { + break; + } + } + endRow = row; + } + + return new Range(startRow, startColumn, endRow, session.getLine(endRow).length); + }; + this.getCommentRegionBlock = function(session, line, row) { + var startColumn = line.search(/\s*$/); + var maxRow = session.getLength(); + var startRow = row; + + var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/; + var depth = 1; + while (++row < maxRow) { + line = session.getLine(row); + var m = re.exec(line); + if (!m) continue; + if (m[1]) depth--; + else depth++; + + if (!depth) break; + } + + var endRow = row; + if (endRow > startRow) { + return new Range(startRow, startColumn, endRow, line.length); + } + }; + +}).call(FoldMode.prototype); + +}); + +define("ace/mode/scrypt",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/scrypt_highlight_rules","ace/mode/folding/cstyle"], function (require, exports, module) { + "use strict"; + + var oop = require("../lib/oop"); + var TextMode = require("./text").Mode; + var scryptHighlightRules = require("./scrypt_highlight_rules").scryptHighlightRules; + var FoldMode = require("./folding/cstyle").FoldMode; + + var Mode = function () { + this.HighlightRules = scryptHighlightRules; + this.foldingRules = new FoldMode(); + }; + oop.inherits(Mode, TextMode); + + (function () { + this.lineCommentStart = "//"; + this.blockComment = { start: "/*", end: "*/" }; + this.$quotes = { '"': '"', "'": "'" }; + + this.createWorker = function (session) { + + return null; + }; + + + this.$id = "ace/mode/scrypt"; + }).call(Mode.prototype); + + exports.Mode = Mode; +}); (function() { + window.require(["ace/mode/scrypt"], function(m) { + if (typeof module == "object" && typeof exports == "object" && module) { + module.exports = m; + } + }); + })(); + \ No newline at end of file diff --git a/htdocs/includes/ace/src/mode-sh.js b/htdocs/includes/ace/src/mode-sh.js index db130f99563..56df9c69694 100644 --- a/htdocs/includes/ace/src/mode-sh.js +++ b/htdocs/includes/ace/src/mode-sh.js @@ -435,6 +435,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/sh"; + this.snippetFileId = "ace/snippets/sh"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-sjs.js b/htdocs/includes/ace/src/mode-sjs.js index 218cab19b44..93855df3cee 100644 --- a/htdocs/includes/ace/src/mode-sjs.js +++ b/htdocs/includes/ace/src/mode-sjs.js @@ -784,6 +784,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/javascript"; + this.snippetFileId = "ace/snippets/javascript"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-slim.js b/htdocs/includes/ace/src/mode-slim.js index 7f243bde705..85d09c8693d 100644 --- a/htdocs/includes/ace/src/mode-slim.js +++ b/htdocs/includes/ace/src/mode-slim.js @@ -990,6 +990,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/javascript"; + this.snippetFileId = "ace/snippets/javascript"; }).call(Mode.prototype); exports.Mode = Mode; @@ -2192,6 +2193,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/css"; + this.snippetFileId = "ace/snippets/css"; }).call(Mode.prototype); exports.Mode = Mode; @@ -2745,6 +2747,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/html"; + this.snippetFileId = "ace/snippets/html"; }).call(Mode.prototype); exports.Mode = Mode; @@ -3330,6 +3333,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/sh"; + this.snippetFileId = "ace/snippets/sh"; }).call(Mode.prototype); exports.Mode = Mode; @@ -3382,6 +3386,7 @@ oop.inherits(Mode, TextMode); } }; this.$id = "ace/mode/markdown"; + this.snippetFileId = "ace/snippets/markdown"; }).call(Mode.prototype); exports.Mode = Mode; @@ -3734,6 +3739,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/coffee"; + this.snippetFileId = "ace/snippets/coffee"; }).call(Mode.prototype); exports.Mode = Mode; @@ -4247,17 +4253,17 @@ var constantOtherSymbol = exports.constantOtherSymbol = { regex : "[:](?:[A-Za-z_]|[@$](?=[a-zA-Z0-9_]))[a-zA-Z0-9_]*[!=?]?" }; -var qString = exports.qString = { +exports.qString = { token : "string", // single line regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" }; -var qqString = exports.qqString = { +exports.qqString = { token : "string", // single line regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' }; -var tString = exports.tString = { +exports.tString = { token : "string", // backtick string regex : "[`](?:(?:\\\\.)|(?:[^'\\\\]))*?[`]" }; @@ -4267,9 +4273,34 @@ var constantNumericHex = exports.constantNumericHex = { regex : "0[xX][0-9a-fA-F](?:[0-9a-fA-F]|_(?=[0-9a-fA-F]))*\\b" }; +var constantNumericBinary = exports.constantNumericBinary = { + token: "constant.numeric", + regex: /\b(0[bB][01](?:[01]|_(?=[01]))*)\b/ +}; + +var constantNumericDecimal = exports.constantNumericDecimal = { + token: "constant.numeric", + regex: /\b(0[dD](?:[1-9](?:[\d]|_(?=[\d]))*|0))\b/ +}; + +var constantNumericOctal = exports.constantNumericDecimal = { + token: "constant.numeric", + regex: /\b(0[oO]?(?:[1-7](?:[0-7]|_(?=[0-7]))*|0))\b/ +}; + +var constantNumericRational = exports.constantNumericRational = { + token: "constant.numeric", //rational + complex + regex: /\b([\d]+(?:[./][\d]+)?ri?)\b/ +}; + +var constantNumericComplex = exports.constantNumericComplex = { + token: "constant.numeric", //simple complex numbers + regex: /\b([\d]i)\b/ +}; + var constantNumericFloat = exports.constantNumericFloat = { - token : "constant.numeric", // float - regex : "[+-]?\\d(?:\\d|_(?=\\d))*(?:(?:\\.\\d(?:\\d|_(?=\\d))*)?(?:[eE][+-]?\\d+)?)?\\b" + token : "constant.numeric", // float + complex + regex : "[+-]?\\d(?:\\d|_(?=\\d))*(?:(?:\\.\\d(?:\\d|_(?=\\d))*)?(?:[eE][+-]?\\d+)?)?i?\\b" }; var instanceVariable = exports.instanceVariable = { @@ -4309,18 +4340,19 @@ var RubyHighlightRules = function() { "filter_parameter_logging|match|get|post|resources|redirect|scope|assert_routing|" + "translate|localize|extract_locale_from_tld|caches_page|expire_page|caches_action|expire_action|" + "cache|expire_fragment|expire_cache_for|observe|cache_sweeper|" + - "has_many|has_one|belongs_to|has_and_belongs_to_many" + "has_many|has_one|belongs_to|has_and_belongs_to_many|p|warn|refine|using|module_function|extend|alias_method|" + + "private_class_method|remove_method|undef_method" ); var keywords = ( "alias|and|BEGIN|begin|break|case|class|def|defined|do|else|elsif|END|end|ensure|" + "__FILE__|finally|for|gem|if|in|__LINE__|module|next|not|or|private|protected|public|" + - "redo|rescue|retry|return|super|then|undef|unless|until|when|while|yield" + "redo|rescue|retry|return|super|then|undef|unless|until|when|while|yield|__ENCODING__|prepend" ); var buildinConstants = ( "true|TRUE|false|FALSE|nil|NIL|ARGF|ARGV|DATA|ENV|RUBY_PLATFORM|RUBY_RELEASE_DATE|" + - "RUBY_VERSION|STDERR|STDIN|STDOUT|TOPLEVEL_BINDING" + "RUBY_VERSION|STDERR|STDIN|STDOUT|TOPLEVEL_BINDING|RUBY_PATCHLEVEL|RUBY_REVISION|RUBY_COPYRIGHT|RUBY_ENGINE|RUBY_ENGINE_VERSION|RUBY_DESCRIPTION" ); var builtinVariables = ( @@ -4336,126 +4368,191 @@ var RubyHighlightRules = function() { "invalid.deprecated": "debugger" // TODO is this a remnant from js mode? }, "identifier"); + var escapedChars = "\\\\(?:n(?:[1-7][0-7]{0,2}|0)|[nsrtvfbae'\"\\\\]|c(?:\\\\M-)?.|M-(?:\\\\C-|\\\\c)?.|C-(?:\\\\M-)?.|[0-7]{3}|x[\\da-fA-F]{2}|u[\\da-fA-F]{4}|u{[\\da-fA-F]{1,6}(?:\\s[\\da-fA-F]{1,6})*})"; + + var closeParen = { + "(": ")", + "[": "]", + "{": "}", + "<": ">", + "^": "^", + "|": "|", + "%": "%" + }; + this.$rules = { - "start" : [ + "start": [ { - token : "comment", - regex : "#.*$" + token: "comment", + regex: "#.*$" }, { - token : "comment", // multi line comment - regex : "^=begin(?:$|\\s.*$)", - next : "comment" + token: "comment.multiline", // multi line comment + regex: "^=begin(?=$|\\s.*$)", + next: "comment" }, { - token : "string.regexp", - regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)" + token: "string.regexp", + regex: /[/](?=.*\/)/, + next: "regex" }, [{ - regex: "[{}]", onMatch: function(val, state, stack) { - this.next = val == "{" ? this.nextState : ""; - if (val == "{" && stack.length) { - stack.unshift("start", state); - return "paren.lparen"; - } - if (val == "}" && stack.length) { - stack.shift(); - this.next = stack.shift(); - if (this.next.indexOf("string") != -1) - return "paren.end"; - } - return val == "{" ? "paren.lparen" : "paren.rparen"; - }, - nextState: "start" - }, { - token : "string.start", - regex : /"/, - push : [{ - token : "constant.language.escape", - regex : /\\(?:[nsrtvfbae'"\\]|c.|C-.|M-.(?:\\C-.)?|[0-7]{3}|x[\da-fA-F]{2}|u[\da-fA-F]{4})/ + token: ["constant.other.symbol.ruby", "string.start"], + regex: /(:)?(")/, + push: [{ + token: "constant.language.escape", + regex: escapedChars }, { - token : "paren.start", - regex : /#{/, - push : "start" + token: "paren.start", + regex: /#{/, + push: "start" }, { - token : "string.end", - regex : /"/, - next : "pop" + token: "string.end", + regex: /"/, + next: "pop" }, { defaultToken: "string" }] }, { - token : "string.start", - regex : /`/, - push : [{ - token : "constant.language.escape", - regex : /\\(?:[nsrtvfbae'"\\]|c.|C-.|M-.(?:\\C-.)?|[0-7]{3}|x[\da-fA-F]{2}|u[\da-fA-F]{4})/ + token: "string.start", + regex: /`/, + push: [{ + token: "constant.language.escape", + regex: escapedChars }, { - token : "paren.start", - regex : /#{/, - push : "start" + token: "paren.start", + regex: /#{/, + push: "start" }, { - token : "string.end", - regex : /`/, - next : "pop" + token: "string.end", + regex: /`/, + next: "pop" }, { defaultToken: "string" }] }, { - token : "string.start", - regex : /'/, - push : [{ - token : "constant.language.escape", - regex : /\\['\\]/ - }, { - token : "string.end", - regex : /'/, - next : "pop" + token: ["constant.other.symbol.ruby", "string.start"], + regex: /(:)?(')/, + push: [{ + token: "constant.language.escape", + regex: /\\['\\]/ + }, { + token: "string.end", + regex: /'/, + next: "pop" }, { defaultToken: "string" }] + }, { + token: "string.start",//doesn't see any differences between strings and array of strings in highlighting + regex: /%[qwx]([(\[<{^|%])/, onMatch: function (val, state, stack) { + if (stack.length) + stack = []; + var paren = val[val.length - 1]; + stack.unshift(paren, state); + this.next = "qStateWithoutInterpolation"; + return this.token; + } + }, { + token: "string.start", //doesn't see any differences between strings and array of strings in highlighting + regex: /%[QWX]?([(\[<{^|%])/, onMatch: function (val, state, stack) { + if (stack.length) + stack = []; + var paren = val[val.length - 1]; + stack.unshift(paren, state); + this.next = "qStateWithInterpolation"; + return this.token; + } + }, { + token: "constant.other.symbol.ruby", //doesn't see any differences between symbols and array of symbols in highlighting + regex: /%[si]([(\[<{^|%])/, onMatch: function (val, state, stack) { + if (stack.length) + stack = []; + var paren = val[val.length - 1]; + stack.unshift(paren, state); + this.next = "sStateWithoutInterpolation"; + return this.token; + } + }, { + token: "constant.other.symbol.ruby", //doesn't see any differences between symbols and array of symbols in highlighting + regex: /%[SI]([(\[<{^|%])/, onMatch: function (val, state, stack) { + if (stack.length) + stack = []; + var paren = val[val.length - 1]; + stack.unshift(paren, state); + this.next = "sStateWithInterpolation"; + return this.token; + } + }, { + token: "string.regexp", + regex: /%[r]([(\[<{^|%])/, onMatch: function (val, state, stack) { + if (stack.length) + stack = []; + var paren = val[val.length - 1]; + stack.unshift(paren, state); + this.next = "rState"; + return this.token; + } }], { - token : "text", // namespaces aren't symbols - regex : "::" + token: "punctuation", // namespaces aren't symbols + regex: "::" + }, + instanceVariable, + { + token: "variable.global", // global variable + regex: "[$][a-zA-Z_\\d]+" }, { - token : "variable.instance", // instance variable - regex : "@{1,2}[a-zA-Z_\\d]+" + token: "support.class", // class name + regex: "[A-Z][a-zA-Z_\\d]*" }, { - token : "support.class", // class name - regex : "[A-Z][a-zA-Z_\\d]+" + token: ["punctuation.operator", "support.function"], + regex: /(\.)([a-zA-Z_\d]+)(?=\()/ + }, { + token: ["punctuation.operator", "identifier"], + regex: /(\.)([a-zA-Z_][a-zA-Z_\d]*)/ + }, { + token: "string.character", + regex: "\\B\\?(?:" + escapedChars + "|\\S)" + }, { + token: "punctuation.operator", + regex: /\?(?=.+:)/ }, + constantNumericRational, + constantNumericComplex, constantOtherSymbol, constantNumericHex, constantNumericFloat, - + constantNumericBinary, + constantNumericDecimal, + constantNumericOctal, { - token : "constant.language.boolean", - regex : "(?:true|false)\\b" + token: "constant.language.boolean", + regex: "(?:true|false)\\b" }, { - token : keywordMapper, - regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" + token: keywordMapper, + regex: "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" }, { - token : "punctuation.separator.key-value", - regex : "=>" + token: "punctuation.separator.key-value", + regex: "=>" }, { stateName: "heredoc", - onMatch : function(value, currentState, stack) { - var next = value[2] == '-' ? "indentedHeredoc" : "heredoc"; + onMatch: function (value, currentState, stack) { + var next = (value[2] == '-' || value[2] == '~') ? "indentedHeredoc" : "heredoc"; var tokens = value.split(this.splitRegex); stack.push(next, tokens[3]); return [ - {type:"constant", value: tokens[1]}, - {type:"string", value: tokens[2]}, - {type:"support.class", value: tokens[3]}, - {type:"string", value: tokens[4]} + {type: "constant", value: tokens[1]}, + {type: "string", value: tokens[2]}, + {type: "support.class", value: tokens[3]}, + {type: "string", value: tokens[4]} ]; }, - regex : "(<<-?)(['\"`]?)([\\w]+)(['\"`]?)", + regex: "(<<[-~]?)(['\"`]?)([\\w]+)(['\"`]?)", rules: { heredoc: [{ - onMatch: function(value, currentState, stack) { + onMatch: function(value, currentState, stack) { if (value === stack[1]) { stack.shift(); stack.shift(); @@ -4472,7 +4569,7 @@ var RubyHighlightRules = function() { token: "string", regex: "^ +" }, { - onMatch: function(value, currentState, stack) { + onMatch: function(value, currentState, stack) { if (value === stack[1]) { stack.shift(); stack.shift(); @@ -4487,38 +4584,261 @@ var RubyHighlightRules = function() { }] } }, { - regex : "$", - token : "empty", - next : function(currentState, stack) { + regex: "$", + token: "empty", + next: function(currentState, stack) { if (stack[0] === "heredoc" || stack[0] === "indentedHeredoc") return stack[0]; return currentState; } + }, { + token: "keyword.operator", + regex: "!|\\$|%|&|\\*|/|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\||\\b(?:in|instanceof|new|delete|typeof|void)" }, { - token : "string.character", - regex : "\\B\\?." + token: "paren.lparen", + regex: "[[({]" }, { - token : "keyword.operator", - regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)" + token: "paren.rparen", + regex: "[\\])}]", + onMatch: function(value, currentState, stack) { + this.next = ''; + if (value == "}" && stack.length > 1 && stack[1] != "start") { + stack.shift(); + this.next = stack.shift(); + } + return this.token; + } }, { - token : "paren.lparen", - regex : "[[({]" + token: "text", + regex: "\\s+" }, { - token : "paren.rparen", - regex : "[\\])}]" - }, { - token : "text", - regex : "\\s+" + token: "punctuation.operator", + regex: /[?:,;.]/ } ], - "comment" : [ + "comment": [ { - token : "comment", // closing comment - regex : "^=end(?:$|\\s.*$)", - next : "start" + token: "comment.multiline", // closing comment + regex: "^=end(?=$|\\s.*$)", + next: "start" }, { - token : "comment", // comment spanning whole line - regex : ".+" + token: "comment", // comment spanning whole line + regex: ".+" + } + ], + "qStateWithInterpolation": [{ + token: "string.start",// excluded nested |^% due to difficulty in realization + regex: /[(\[<{]/, onMatch: function (val, state, stack) { + if (stack.length && val === stack[0]) { + stack.unshift(val, state); + return this.token; + } + return "string"; + } + }, { + token: "constant.language.escape", + regex: escapedChars + }, { + token: "constant.language.escape", + regex: /\\./ + }, { + token: "paren.start", + regex: /#{/, + push: "start" + }, { + token: "string.end", + regex: /[)\]>}^|%]/, onMatch: function (val, state, stack) { + if (stack.length && val === closeParen[stack[0]]) { + stack.shift(); + this.next = stack.shift(); + return this.token; + } + this.next = ''; + return "string"; + } + }, { + defaultToken: "string" + }], + "qStateWithoutInterpolation": [{ + token: "string.start",// excluded nested |^% due to difficulty in realization + regex: /[(\[<{]/, onMatch: function (val, state, stack) { + if (stack.length && val === stack[0]) { + stack.unshift(val, state); + return this.token; + } + return "string"; + } + }, { + token: "constant.language.escape", + regex: /\\['\\]/ + }, { + token: "constant.language.escape", + regex: /\\./ + }, { + token: "string.end", + regex: /[)\]>}^|%]/, onMatch: function (val, state, stack) { + if (stack.length && val === closeParen[stack[0]]) { + stack.shift(); + this.next = stack.shift(); + return this.token; + } + this.next = ''; + return "string"; + } + }, { + defaultToken: "string" + }], + "sStateWithoutInterpolation": [{ + token: "constant.other.symbol.ruby",// excluded nested |^% due to difficulty in realization + regex: /[(\[<{]/, onMatch: function (val, state, stack) { + if (stack.length && val === stack[0]) { + stack.unshift(val, state); + return this.token; + } + return "constant.other.symbol.ruby"; + } + }, { + token: "constant.other.symbol.ruby", + regex: /[)\]>}^|%]/, onMatch: function (val, state, stack) { + if (stack.length && val === closeParen[stack[0]]) { + stack.shift(); + this.next = stack.shift(); + return this.token; + } + this.next = ''; + return "constant.other.symbol.ruby"; + } + }, { + defaultToken: "constant.other.symbol.ruby" + }], + "sStateWithInterpolation": [{ + token: "constant.other.symbol.ruby",// excluded nested |^% due to difficulty in realization + regex: /[(\[<{]/, onMatch: function (val, state, stack) { + if (stack.length && val === stack[0]) { + stack.unshift(val, state); + return this.token; + } + return "constant.other.symbol.ruby"; + } + }, { + token: "constant.language.escape", + regex: escapedChars + }, { + token: "constant.language.escape", + regex: /\\./ + }, { + token: "paren.start", + regex: /#{/, + push: "start" + }, { + token: "constant.other.symbol.ruby", + regex: /[)\]>}^|%]/, onMatch: function (val, state, stack) { + if (stack.length && val === closeParen[stack[0]]) { + stack.shift(); + this.next = stack.shift(); + return this.token; + } + this.next = ''; + return "constant.other.symbol.ruby"; + } + }, { + defaultToken: "constant.other.symbol.ruby" + }], + "rState": [{ + token: "string.regexp",// excluded nested |^% due to difficulty in realization + regex: /[(\[<{]/, onMatch: function (val, state, stack) { + if (stack.length && val === stack[0]) { + stack.unshift(val, state); + return this.token; + } + return "constant.language.escape"; + } + }, { + token: "paren.start", + regex: /#{/, + push: "start" + }, { + token: "string.regexp", + regex: /\// + }, { + token: "string.regexp", + regex: /[)\]>}^|%][imxouesn]*/, onMatch: function (val, state, stack) { + if (stack.length && val[0] === closeParen[stack[0]]) { + stack.shift(); + this.next = stack.shift(); + return this.token; + } + this.next = ''; + return "constant.language.escape"; + } + }, + {include: "regex"}, + { + defaultToken: "string.regexp" + }], + "regex": [ + {// character classes + token: "regexp.keyword", + regex: /\\[wWdDhHsS]/ + }, { + token: "constant.language.escape", + regex: /\\[AGbBzZ]/ + }, { + token: "constant.language.escape", + regex: /\\g<[a-zA-Z0-9]*>/ + }, { + token: ["constant.language.escape", "regexp.keyword", "constant.language.escape"], + regex: /(\\p{\^?)(Alnum|Alpha|Blank|Cntrl|Digit|Graph|Lower|Print|Punct|Space|Upper|XDigit|Word|ASCII|Any|Assigned|Arabic|Armenian|Balinese|Bengali|Bopomofo|Braille|Buginese|Buhid|Canadian_Aboriginal|Carian|Cham|Cherokee|Common|Coptic|Cuneiform|Cypriot|Cyrillic|Deseret|Devanagari|Ethiopic|Georgian|Glagolitic|Gothic|Greek|Gujarati|Gurmukhi|Han|Hangul|Hanunoo|Hebrew|Hiragana|Inherited|Kannada|Katakana|Kayah_Li|Kharoshthi|Khmer|Lao|Latin|Lepcha|Limbu|Linear_B|Lycian|Lydian|Malayalam|Mongolian|Myanmar|New_Tai_Lue|Nko|Ogham|Ol_Chiki|Old_Italic|Old_Persian|Oriya|Osmanya|Phags_Pa|Phoenician|Rejang|Runic|Saurashtra|Shavian|Sinhala|Sundanese|Syloti_Nagri|Syriac|Tagalog|Tagbanwa|Tai_Le|Tamil|Telugu|Thaana|Thai|Tibetan|Tifinagh|Ugaritic|Vai|Yi|Ll|Lm|Lt|Lu|Lo|Mn|Mc|Me|Nd|Nl|Pc|Pd|Ps|Pe|Pi|Pf|Po|No|Sm|Sc|Sk|So|Zs|Zl|Zp|Cc|Cf|Cn|Co|Cs|N|L|M|P|S|Z|C)(})/ + }, { + token: ["constant.language.escape", "invalid", "constant.language.escape"], + regex: /(\\p{\^?)([^/]*)(})/ + }, {// escapes + token: "regexp.keyword.operator", + regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" + }, {// flag + token: "string.regexp", + regex: /[/][imxouesn]*/, + next: "start" + }, {// invalid operators + token: "invalid", + regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/ + }, {// operators + token: "constant.language.escape", + regex: /\(\?(?:[:=!>]|<'?[a-zA-Z]*'?>|<[=!])|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/ + }, { + token: "constant.language.delimiter", + regex: /\|/ + }, { + token: "regexp.keyword", + regex: /\[\[:(?:alnum|alpha|blank|cntrl|digit|graph|lower|print|punct|space|upper|xdigit|word|ascii):\]\]/ + }, { + token: "constant.language.escape", + regex: /\[\^?/, + push: "regex_character_class" + }, { + defaultToken: "string.regexp" + } + ], + "regex_character_class": [ + { + token: "regexp.keyword", + regex: /\\[wWdDhHsS]/ + }, { + token: "regexp.charclass.keyword.operator", + regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" + }, { + token: "constant.language.escape", + regex: /&?&?\[\^?/, + push: "regex_character_class" + }, { + token: "constant.language.escape", + regex: "]", + next: "pop" + }, { + token: "constant.language.escape", + regex: "-" + }, { + defaultToken: "string.regexp.characterclass" } ] }; @@ -4531,7 +4851,271 @@ oop.inherits(RubyHighlightRules, TextHighlightRules); exports.RubyHighlightRules = RubyHighlightRules; }); -define("ace/mode/ruby",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/ruby_highlight_rules","ace/mode/matching_brace_outdent","ace/range","ace/mode/behaviour/cstyle","ace/mode/folding/coffee"], function(require, exports, module) { +define("ace/mode/folding/ruby",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range","ace/token_iterator"], function (require, exports, module) { +"use strict"; + +var oop = require("../../lib/oop"); +var BaseFoldMode = require("./fold_mode").FoldMode; +var Range = require("../../range").Range; +var TokenIterator = require("../../token_iterator").TokenIterator; + + +var FoldMode = exports.FoldMode = function () { +}; + +oop.inherits(FoldMode, BaseFoldMode); + +(function () { + this.indentKeywords = { + "class": 1, + "def": 1, + "module": 1, + "do": 1, + "unless": 1, + "if": 1, + "while": 1, + "for": 1, + "until": 1, + "begin": 1, + "else": 0, + "elsif": 0, + "rescue": 0, + "ensure": 0, + "when": 0, + "end": -1, + "case": 1, + "=begin": 1, + "=end": -1 + }; + + this.foldingStartMarker = /(?:\s|^)(def|do|while|class|unless|module|if|for|until|begin|else|elsif|case|rescue|ensure|when)\b|({\s*$)|(=begin)/; + this.foldingStopMarker = /(=end(?=$|\s.*$))|(^\s*})|\b(end)\b/; + + this.getFoldWidget = function (session, foldStyle, row) { + var line = session.getLine(row); + var isStart = this.foldingStartMarker.test(line); + var isEnd = this.foldingStopMarker.test(line); + + if (isStart && !isEnd) { + var match = line.match(this.foldingStartMarker); + if (match[1]) { + if (match[1] == "if" || match[1] == "else" || match[1] == "while" || match[1] == "until" || match[1] == "unless") { + if (match[1] == "else" && /^\s*else\s*$/.test(line) === false) { + return; + } + if (/^\s*(?:if|else|while|until|unless)\s*/.test(line) === false) { + return; + } + } + + if (match[1] == "when") { + if (/\sthen\s/.test(line) === true) { + return; + } + } + if (session.getTokenAt(row, match.index + 2).type === "keyword") + return "start"; + } else if (match[3]) { + if (session.getTokenAt(row, match.index + 1).type === "comment.multiline") + return "start"; + } else { + return "start"; + } + } + if (foldStyle != "markbeginend" || !isEnd || isStart && isEnd) + return ""; + + var match = line.match(this.foldingStopMarker); + if (match[3] === "end") { + if (session.getTokenAt(row, match.index + 1).type === "keyword") + return "end"; + } else if (match[1]) { + if (session.getTokenAt(row, match.index + 1).type === "comment.multiline") + return "end"; + } else + return "end"; + }; + + this.getFoldWidgetRange = function (session, foldStyle, row) { + var line = session.doc.getLine(row); + var match = this.foldingStartMarker.exec(line); + if (match) { + if (match[1] || match[3]) + return this.rubyBlock(session, row, match.index + 2); + + return this.openingBracketBlock(session, "{", row, match.index); + } + + var match = this.foldingStopMarker.exec(line); + if (match) { + if (match[3] === "end") { + if (session.getTokenAt(row, match.index + 1).type === "keyword") + return this.rubyBlock(session, row, match.index + 1); + } + + if (match[1] === "=end") { + if (session.getTokenAt(row, match.index + 1).type === "comment.multiline") + return this.rubyBlock(session, row, match.index + 1); + } + + return this.closingBracketBlock(session, "}", row, match.index + match[0].length); + } + }; + + this.rubyBlock = function (session, row, column, tokenRange) { + var stream = new TokenIterator(session, row, column); + + var token = stream.getCurrentToken(); + if (!token || (token.type != "keyword" && token.type != "comment.multiline")) + return; + + var val = token.value; + var line = session.getLine(row); + switch (token.value) { + case "if": + case "unless": + case "while": + case "until": + var checkToken = new RegExp("^\\s*" + token.value); + if (!checkToken.test(line)) { + return; + } + var dir = this.indentKeywords[val]; + break; + case "when": + if (/\sthen\s/.test(line)) { + return; + } + case "elsif": + case "rescue": + case "ensure": + var dir = 1; + break; + case "else": + var checkToken = new RegExp("^\\s*" + token.value + "\\s*$"); + if (!checkToken.test(line)) { + return; + } + var dir = 1; + break; + default: + var dir = this.indentKeywords[val]; + break; + } + + var stack = [val]; + if (!dir) + return; + + var startColumn = dir === -1 ? session.getLine(row - 1).length : session.getLine(row).length; + var startRow = row; + var ranges = []; + ranges.push(stream.getCurrentTokenRange()); + + stream.step = dir === -1 ? stream.stepBackward : stream.stepForward; + if (token.type == "comment.multiline") { + while (token = stream.step()) { + if (token.type !== "comment.multiline") + continue; + if (dir == 1) { + startColumn = 6; + if (token.value == "=end") { + break; + } + } else { + if (token.value == "=begin") { + break; + } + } + } + } else { + while (token = stream.step()) { + var ignore = false; + if (token.type !== "keyword") + continue; + var level = dir * this.indentKeywords[token.value]; + line = session.getLine(stream.getCurrentTokenRow()); + switch (token.value) { + case "do": + for (var i = stream.$tokenIndex - 1; i >= 0; i--) { + var prevToken = stream.$rowTokens[i]; + if (prevToken && (prevToken.value == "while" || prevToken.value == "until" || prevToken.value == "for")) { + level = 0; + break; + } + } + break; + case "else": + var checkToken = new RegExp("^\\s*" + token.value + "\\s*$"); + if (!checkToken.test(line) || val == "case") { + level = 0; + ignore = true; + } + break; + case "if": + case "unless": + case "while": + case "until": + var checkToken = new RegExp("^\\s*" + token.value); + if (!checkToken.test(line)) { + level = 0; + ignore = true; + } + break; + case "when": + if (/\sthen\s/.test(line) || val == "case") { + level = 0; + ignore = true; + } + break; + } + + if (level > 0) { + stack.unshift(token.value); + } else if (level <= 0 && ignore === false) { + stack.shift(); + if (!stack.length) { + if ((val == "while" || val == "until" || val == "for") && token.value != "do") { + break; + } + if (token.value == "do" && dir == -1 && level != 0) + break; + if (token.value != "do") + break; + } + + if (level === 0) { + stack.unshift(token.value); + } + } + } + } + + if (!token) + return null; + + if (tokenRange) { + ranges.push(stream.getCurrentTokenRange()); + return ranges; + } + + var row = stream.getCurrentTokenRow(); + if (dir === -1) { + if (token.type === "comment.multiline") { + var endColumn = 6; + } else { + var endColumn = session.getLine(row).length; + } + return new Range(row, endColumn, startRow - 1, startColumn); + } else + return new Range(startRow, startColumn, row - 1, session.getLine(row - 1).length); + }; + +}).call(FoldMode.prototype); + +}); + +define("ace/mode/ruby",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/ruby_highlight_rules","ace/mode/matching_brace_outdent","ace/range","ace/mode/behaviour/cstyle","ace/mode/folding/ruby"], function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); @@ -4540,13 +5124,14 @@ var RubyHighlightRules = require("./ruby_highlight_rules").RubyHighlightRules; var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; var Range = require("../range").Range; var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour; -var FoldMode = require("./folding/coffee").FoldMode; +var FoldMode = require("./folding/ruby").FoldMode; var Mode = function() { this.HighlightRules = RubyHighlightRules; this.$outdent = new MatchingBraceOutdent(); this.$behaviour = new CstyleBehaviour(); this.foldingRules = new FoldMode(); + this.indentKeywords = this.foldingRules.indentKeywords; }; oop.inherits(Mode, TextMode); @@ -4561,7 +5146,7 @@ oop.inherits(Mode, TextMode); var tokenizedLine = this.getTokenizer().getLineTokens(line, state); var tokens = tokenizedLine.tokens; - if (tokens.length && tokens[tokens.length-1].type == "comment") { + if (tokens.length && tokens[tokens.length - 1].type == "comment") { return indent; } @@ -4569,7 +5154,7 @@ oop.inherits(Mode, TextMode); var match = line.match(/^.*[\{\(\[]\s*$/); var startingClassOrMethod = line.match(/^\s*(class|def|module)\s.*$/); var startingDoBlock = line.match(/.*do(\s*|\s+\|.*\|\s*)$/); - var startingConditional = line.match(/^\s*(if|else|when)\s*/); + var startingConditional = line.match(/^\s*(if|else|when|elsif|unless|while|for|begin|rescue|ensure)\s*/); if (match || startingClassOrMethod || startingDoBlock || startingConditional) { indent += tab; } @@ -4579,7 +5164,7 @@ oop.inherits(Mode, TextMode); }; this.checkOutdent = function(state, line, input) { - return /^\s+(end|else)$/.test(line + input) || this.$outdent.checkOutdent(line, input); + return /^\s+(end|else|rescue|ensure)$/.test(line + input) || this.$outdent.checkOutdent(line, input); }; this.autoOutdent = function(state, session, row) { @@ -4592,11 +5177,24 @@ oop.inherits(Mode, TextMode); var tab = session.getTabString(); if (prevIndent.length <= indent.length) { if (indent.slice(-tab.length) == tab) - session.remove(new Range(row, indent.length-tab.length, row, indent.length)); + session.remove(new Range(row, indent.length - tab.length, row, indent.length)); } }; + this.getMatching = function(session, row, column) { + if (row == undefined) { + var pos = session.selection.lead; + column = pos.column; + row = pos.row; + } + + var startToken = session.getTokenAt(row, column); + if (startToken && startToken.value in this.indentKeywords) + return this.foldingRules.rubyBlock(session, row, column, true); + }; + this.$id = "ace/mode/ruby"; + this.snippetFileId = "ace/snippets/ruby"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-smarty.js b/htdocs/includes/ace/src/mode-smarty.js index 8c044c1698b..03a1654ffac 100644 --- a/htdocs/includes/ace/src/mode-smarty.js +++ b/htdocs/includes/ace/src/mode-smarty.js @@ -784,6 +784,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/javascript"; + this.snippetFileId = "ace/snippets/javascript"; }).call(Mode.prototype); exports.Mode = Mode; @@ -1316,6 +1317,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/css"; + this.snippetFileId = "ace/snippets/css"; }).call(Mode.prototype); exports.Mode = Mode; @@ -2493,6 +2495,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/html"; + this.snippetFileId = "ace/snippets/html"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-smithy.js b/htdocs/includes/ace/src/mode-smithy.js new file mode 100644 index 00000000000..6dd0bcfaa81 --- /dev/null +++ b/htdocs/includes/ace/src/mode-smithy.js @@ -0,0 +1,507 @@ +define("ace/mode/smithy_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) { +"use strict"; + +var oop = require("../lib/oop"); +var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; + +var SmithyHighlightRules = function() { + + this.$rules = { + start: [{ + include: "#comment" + }, { + token: [ + "meta.keyword.statement.smithy", + "variable.other.smithy", + "text", + "keyword.operator.smithy" + ], + regex: /^(\$)(\s+.+)(\s*)(=)/ + }, { + token: [ + "keyword.statement.smithy", + "text", + "entity.name.type.namespace.smithy" + ], + regex: /^(namespace)(\s+)([A-Z-a-z0-9_\.#$-]+)/ + }, { + token: [ + "keyword.statement.smithy", + "text", + "keyword.statement.smithy", + "text", + "entity.name.type.smithy" + ], + regex: /^(use)(\s+)(shape|trait)(\s+)([A-Z-a-z0-9_\.#$-]+)\b/ + }, { + token: [ + "keyword.statement.smithy", + "variable.other.smithy", + "text", + "keyword.operator.smithy" + ], + regex: /^(metadata)(\s+.+)(\s*)(=)/ + }, { + token: [ + "keyword.statement.smithy", + "text", + "entity.name.type.smithy" + ], + regex: /^(apply|byte|short|integer|long|float|double|bigInteger|bigDecimal|boolean|blob|string|timestamp|service|resource|trait|list|map|set|structure|union|document)(\s+)([A-Z-a-z0-9_\.#$-]+)\b/ + }, { + token: [ + "keyword.operator.smithy", + "text", + "entity.name.type.smithy", + "text", + "text", + "support.function.smithy", + "text", + "text", + "support.function.smithy" + ], + regex: /^(operation)(\s+)([A-Z-a-z0-9_\.#$-]+)(\(.*\))(?:(\s*)(->)(\s*[A-Z-a-z0-9_\.#$-]+))?(?:(\s+)(errors))?/ + }, { + include: "#trait" + }, { + token: [ + "support.type.property-name.smithy", + "punctuation.separator.dictionary.pair.smithy" + ], + regex: /([A-Z-a-z0-9_\.#$-]+)(:)/ + }, { + include: "#value" + }, { + token: "keyword.other.smithy", + regex: /\->/ + }], + "#comment": [{ + include: "#doc_comment" + }, { + include: "#line_comment" + }], + "#doc_comment": [{ + token: "comment.block.documentation.smithy", + regex: /\/\/\/.*/ + }], + "#line_comment": [{ + token: "comment.line.double-slash.smithy", + regex: /\/\/.*/ + }], + "#trait": [{ + token: [ + "punctuation.definition.annotation.smithy", + "storage.type.annotation.smithy" + ], + regex: /(@)([0-9a-zA-Z\.#-]+)/ + }, { + token: [ + "punctuation.definition.annotation.smithy", + "punctuation.definition.object.end.smithy", + "meta.structure.smithy" + ], + regex: /(@)([0-9a-zA-Z\.#-]+)(\()/, + push: [{ + token: "punctuation.definition.object.end.smithy", + regex: /\)/, + next: "pop" + }, { + include: "#value" + }, { + include: "#object_inner" + }, { + defaultToken: "meta.structure.smithy" + }] + }], + "#value": [{ + include: "#constant" + }, { + include: "#number" + }, { + include: "#string" + }, { + include: "#array" + }, { + include: "#object" + }], + "#array": [{ + token: "punctuation.definition.array.begin.smithy", + regex: /\[/, + push: [{ + token: "punctuation.definition.array.end.smithy", + regex: /\]/, + next: "pop" + }, { + include: "#comment" + }, { + include: "#value" + }, { + token: "punctuation.separator.array.smithy", + regex: /,/ + }, { + token: "invalid.illegal.expected-array-separator.smithy", + regex: /[^\s\]]/ + }, { + defaultToken: "meta.structure.array.smithy" + }] + }], + "#constant": [{ + token: "constant.language.smithy", + regex: /\b(?:true|false|null)\b/ + }], + "#number": [{ + token: "constant.numeric.smithy", + regex: /-?(?:0|[1-9]\d*)(?:(?:\.\d+)?(?:[eE][+-]?\d+)?)?/ + }], + "#object": [{ + token: "punctuation.definition.dictionary.begin.smithy", + regex: /\{/, + push: [{ + token: "punctuation.definition.dictionary.end.smithy", + regex: /\}/, + next: "pop" + }, { + include: "#trait" + }, { + include: "#object_inner" + }, { + defaultToken: "meta.structure.dictionary.smithy" + }] + }], + "#object_inner": [{ + include: "#comment" + }, { + include: "#string_key" + }, { + token: "punctuation.separator.dictionary.key-value.smithy", + regex: /:/, + push: [{ + token: "punctuation.separator.dictionary.pair.smithy", + regex: /,|(?=\})/, + next: "pop" + }, { + include: "#value" + }, { + token: "invalid.illegal.expected-dictionary-separator.smithy", + regex: /[^\s,]/ + }, { + defaultToken: "meta.structure.dictionary.value.smithy" + }] + }, { + token: "invalid.illegal.expected-dictionary-separator.smithy", + regex: /[^\s\}]/ + }], + "#string_key": [{ + include: "#identifier_key" + }, { + include: "#dquote_key" + }, { + include: "#squote_key" + }], + "#identifier_key": [{ + token: "support.type.property-name.smithy", + regex: /[A-Z-a-z0-9_\.#$-]+/ + }], + "#dquote_key": [{ + include: "#dquote" + }], + "#squote_key": [{ + include: "#squote" + }], + "#string": [{ + include: "#textblock" + }, { + include: "#dquote" + }, { + include: "#squote" + }, { + include: "#identifier" + }], + "#textblock": [{ + token: "punctuation.definition.string.begin.smithy", + regex: /"""/, + push: [{ + token: "punctuation.definition.string.end.smithy", + regex: /"""/, + next: "pop" + }, { + token: "constant.character.escape.smithy", + regex: /\\./ + }, { + defaultToken: "string.quoted.double.smithy" + }] + }], + "#dquote": [{ + token: "punctuation.definition.string.begin.smithy", + regex: /"/, + push: [{ + token: "punctuation.definition.string.end.smithy", + regex: /"/, + next: "pop" + }, { + token: "constant.character.escape.smithy", + regex: /\\./ + }, { + defaultToken: "string.quoted.double.smithy" + }] + }], + "#squote": [{ + token: "punctuation.definition.string.begin.smithy", + regex: /'/, + push: [{ + token: "punctuation.definition.string.end.smithy", + regex: /'/, + next: "pop" + }, { + token: "constant.character.escape.smithy", + regex: /\\./ + }, { + defaultToken: "string.quoted.single.smithy" + }] + }], + "#identifier": [{ + token: "storage.type.smithy", + regex: /[A-Z-a-z_][A-Z-a-z0-9_\.#$-]*/ + }] + }; + + this.normalizeRules(); +}; + +SmithyHighlightRules.metaData = { + name: "Smithy", + fileTypes: ["smithy"], + scopeName: "source.smithy", + foldingStartMarker: "(\\{|\\[)\\s*", + foldingStopMarker: "\\s*(\\}|\\])" +}; + + +oop.inherits(SmithyHighlightRules, TextHighlightRules); + +exports.SmithyHighlightRules = SmithyHighlightRules; +}); + +define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module) { +"use strict"; + +var Range = require("../range").Range; + +var MatchingBraceOutdent = function() {}; + +(function() { + + this.checkOutdent = function(line, input) { + if (! /^\s+$/.test(line)) + return false; + + return /^\s*\}/.test(input); + }; + + this.autoOutdent = function(doc, row) { + var line = doc.getLine(row); + var match = line.match(/^(\s*\})/); + + if (!match) return 0; + + var column = match[1].length; + var openBracePos = doc.findMatchingBracket({row: row, column: column}); + + if (!openBracePos || openBracePos.row == row) return 0; + + var indent = this.$getIndent(doc.getLine(openBracePos.row)); + doc.replace(new Range(row, 0, row, column-1), indent); + }; + + this.$getIndent = function(line) { + return line.match(/^\s*/)[0]; + }; + +}).call(MatchingBraceOutdent.prototype); + +exports.MatchingBraceOutdent = MatchingBraceOutdent; +}); + +define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) { +"use strict"; + +var oop = require("../../lib/oop"); +var Range = require("../../range").Range; +var BaseFoldMode = require("./fold_mode").FoldMode; + +var FoldMode = exports.FoldMode = function(commentRegex) { + if (commentRegex) { + this.foldingStartMarker = new RegExp( + this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start) + ); + this.foldingStopMarker = new RegExp( + this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end) + ); + } +}; +oop.inherits(FoldMode, BaseFoldMode); + +(function() { + + this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/; + this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/; + this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/; + this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/; + this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/; + this._getFoldWidgetBase = this.getFoldWidget; + this.getFoldWidget = function(session, foldStyle, row) { + var line = session.getLine(row); + + if (this.singleLineBlockCommentRe.test(line)) { + if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line)) + return ""; + } + + var fw = this._getFoldWidgetBase(session, foldStyle, row); + + if (!fw && this.startRegionRe.test(line)) + return "start"; // lineCommentRegionStart + + return fw; + }; + + this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) { + var line = session.getLine(row); + + if (this.startRegionRe.test(line)) + return this.getCommentRegionBlock(session, line, row); + + var match = line.match(this.foldingStartMarker); + if (match) { + var i = match.index; + + if (match[1]) + return this.openingBracketBlock(session, match[1], row, i); + + var range = session.getCommentFoldRange(row, i + match[0].length, 1); + + if (range && !range.isMultiLine()) { + if (forceMultiline) { + range = this.getSectionRange(session, row); + } else if (foldStyle != "all") + range = null; + } + + return range; + } + + if (foldStyle === "markbegin") + return; + + var match = line.match(this.foldingStopMarker); + if (match) { + var i = match.index + match[0].length; + + if (match[1]) + return this.closingBracketBlock(session, match[1], row, i); + + return session.getCommentFoldRange(row, i, -1); + } + }; + + this.getSectionRange = function(session, row) { + var line = session.getLine(row); + var startIndent = line.search(/\S/); + var startRow = row; + var startColumn = line.length; + row = row + 1; + var endRow = row; + var maxRow = session.getLength(); + while (++row < maxRow) { + line = session.getLine(row); + var indent = line.search(/\S/); + if (indent === -1) + continue; + if (startIndent > indent) + break; + var subRange = this.getFoldWidgetRange(session, "all", row); + + if (subRange) { + if (subRange.start.row <= startRow) { + break; + } else if (subRange.isMultiLine()) { + row = subRange.end.row; + } else if (startIndent == indent) { + break; + } + } + endRow = row; + } + + return new Range(startRow, startColumn, endRow, session.getLine(endRow).length); + }; + this.getCommentRegionBlock = function(session, line, row) { + var startColumn = line.search(/\s*$/); + var maxRow = session.getLength(); + var startRow = row; + + var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/; + var depth = 1; + while (++row < maxRow) { + line = session.getLine(row); + var m = re.exec(line); + if (!m) continue; + if (m[1]) depth--; + else depth++; + + if (!depth) break; + } + + var endRow = row; + if (endRow > startRow) { + return new Range(startRow, startColumn, endRow, line.length); + } + }; + +}).call(FoldMode.prototype); + +}); + +define("ace/mode/smithy",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/smithy_highlight_rules","ace/mode/matching_brace_outdent","ace/mode/behaviour/cstyle","ace/mode/folding/cstyle"], function(require, exports, module) { +"use strict"; + +var oop = require("../lib/oop"); +var TextMode = require("./text").Mode; +var SmithyHighlightRules = require("./smithy_highlight_rules").SmithyHighlightRules; +var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; +var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour; +var CStyleFoldMode = require("./folding/cstyle").FoldMode; + +var Mode = function() { + this.HighlightRules = SmithyHighlightRules; + + this.$outdent = new MatchingBraceOutdent(); + this.$behaviour = new CstyleBehaviour(); + this.foldingRules = new CStyleFoldMode(); +}; +oop.inherits(Mode, TextMode); + +(function() { + this.lineCommentStart = "//"; + this.$quotes = {'"': '"'}; + + this.checkOutdent = function(state, line, input) { + return this.$outdent.checkOutdent(line, input); + }; + + this.autoOutdent = function(state, doc, row) { + this.$outdent.autoOutdent(doc, row); + }; + + this.$id = "ace/mode/smithy"; +}).call(Mode.prototype); + +exports.Mode = Mode; +}); (function() { + window.require(["ace/mode/smithy"], function(m) { + if (typeof module == "object" && typeof exports == "object" && module) { + module.exports = m; + } + }); + })(); + \ No newline at end of file diff --git a/htdocs/includes/ace/src/mode-snippets.js b/htdocs/includes/ace/src/mode-snippets.js index 600463bf3e5..32276191d16 100644 --- a/htdocs/includes/ace/src/mode-snippets.js +++ b/htdocs/includes/ace/src/mode-snippets.js @@ -192,6 +192,7 @@ oop.inherits(Mode, TextMode); this.$indentWithTabs = true; this.lineCommentStart = "#"; this.$id = "ace/mode/snippets"; + this.snippetFileId = "ace/snippets/snippets"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-soy_template.js b/htdocs/includes/ace/src/mode-soy_template.js index 83b35c0c673..a9674ac5730 100644 --- a/htdocs/includes/ace/src/mode-soy_template.js +++ b/htdocs/includes/ace/src/mode-soy_template.js @@ -784,6 +784,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/javascript"; + this.snippetFileId = "ace/snippets/javascript"; }).call(Mode.prototype); exports.Mode = Mode; @@ -1316,6 +1317,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/css"; + this.snippetFileId = "ace/snippets/css"; }).call(Mode.prototype); exports.Mode = Mode; @@ -2493,6 +2495,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/html"; + this.snippetFileId = "ace/snippets/html"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-sql.js b/htdocs/includes/ace/src/mode-sql.js index 77ba37a8ed1..3bb9e83b7af 100644 --- a/htdocs/includes/ace/src/mode-sql.js +++ b/htdocs/includes/ace/src/mode-sql.js @@ -78,15 +78,174 @@ oop.inherits(SqlHighlightRules, TextHighlightRules); exports.SqlHighlightRules = SqlHighlightRules; }); -define("ace/mode/sql",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/sql_highlight_rules"], function(require, exports, module) { +define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) { +"use strict"; + +var oop = require("../../lib/oop"); +var Range = require("../../range").Range; +var BaseFoldMode = require("./fold_mode").FoldMode; + +var FoldMode = exports.FoldMode = function(commentRegex) { + if (commentRegex) { + this.foldingStartMarker = new RegExp( + this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start) + ); + this.foldingStopMarker = new RegExp( + this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end) + ); + } +}; +oop.inherits(FoldMode, BaseFoldMode); + +(function() { + + this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/; + this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/; + this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/; + this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/; + this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/; + this._getFoldWidgetBase = this.getFoldWidget; + this.getFoldWidget = function(session, foldStyle, row) { + var line = session.getLine(row); + + if (this.singleLineBlockCommentRe.test(line)) { + if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line)) + return ""; + } + + var fw = this._getFoldWidgetBase(session, foldStyle, row); + + if (!fw && this.startRegionRe.test(line)) + return "start"; // lineCommentRegionStart + + return fw; + }; + + this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) { + var line = session.getLine(row); + + if (this.startRegionRe.test(line)) + return this.getCommentRegionBlock(session, line, row); + + var match = line.match(this.foldingStartMarker); + if (match) { + var i = match.index; + + if (match[1]) + return this.openingBracketBlock(session, match[1], row, i); + + var range = session.getCommentFoldRange(row, i + match[0].length, 1); + + if (range && !range.isMultiLine()) { + if (forceMultiline) { + range = this.getSectionRange(session, row); + } else if (foldStyle != "all") + range = null; + } + + return range; + } + + if (foldStyle === "markbegin") + return; + + var match = line.match(this.foldingStopMarker); + if (match) { + var i = match.index + match[0].length; + + if (match[1]) + return this.closingBracketBlock(session, match[1], row, i); + + return session.getCommentFoldRange(row, i, -1); + } + }; + + this.getSectionRange = function(session, row) { + var line = session.getLine(row); + var startIndent = line.search(/\S/); + var startRow = row; + var startColumn = line.length; + row = row + 1; + var endRow = row; + var maxRow = session.getLength(); + while (++row < maxRow) { + line = session.getLine(row); + var indent = line.search(/\S/); + if (indent === -1) + continue; + if (startIndent > indent) + break; + var subRange = this.getFoldWidgetRange(session, "all", row); + + if (subRange) { + if (subRange.start.row <= startRow) { + break; + } else if (subRange.isMultiLine()) { + row = subRange.end.row; + } else if (startIndent == indent) { + break; + } + } + endRow = row; + } + + return new Range(startRow, startColumn, endRow, session.getLine(endRow).length); + }; + this.getCommentRegionBlock = function(session, line, row) { + var startColumn = line.search(/\s*$/); + var maxRow = session.getLength(); + var startRow = row; + + var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/; + var depth = 1; + while (++row < maxRow) { + line = session.getLine(row); + var m = re.exec(line); + if (!m) continue; + if (m[1]) depth--; + else depth++; + + if (!depth) break; + } + + var endRow = row; + if (endRow > startRow) { + return new Range(startRow, startColumn, endRow, line.length); + } + }; + +}).call(FoldMode.prototype); + +}); + +define("ace/mode/folding/sql",["require","exports","module","ace/lib/oop","ace/mode/folding/cstyle"], function(require, exports, module) { +"use strict"; + +var oop = require("../../lib/oop"); +var BaseFoldMode = require("./cstyle").FoldMode; + +var FoldMode = exports.FoldMode = function() {}; + +oop.inherits(FoldMode, BaseFoldMode); + +(function() { + + +}).call(FoldMode.prototype); + +}); + +define("ace/mode/sql",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/sql_highlight_rules","ace/mode/folding/sql"], function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var SqlHighlightRules = require("./sql_highlight_rules").SqlHighlightRules; +var SqlFoldMode = require("./folding/sql").FoldMode; var Mode = function() { this.HighlightRules = SqlHighlightRules; + this.foldingRules = new SqlFoldMode(); this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); @@ -94,8 +253,10 @@ oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "--"; + this.blockComment = {start: "/*", end: "*/"}; this.$id = "ace/mode/sql"; + this.snippetFileId = "ace/snippets/sql"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-sqlserver.js b/htdocs/includes/ace/src/mode-sqlserver.js index 41f53c3e598..69aa4384ff1 100644 --- a/htdocs/includes/ace/src/mode-sqlserver.js +++ b/htdocs/includes/ace/src/mode-sqlserver.js @@ -429,7 +429,8 @@ oop.inherits(Mode, TextMode); return session.$mode.$highlightRules.completions; }; - this.$id = "ace/mode/sql"; + this.$id = "ace/mode/sqlserver"; + this.snippetFileId = "ace/snippets/sqlserver"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-svg.js b/htdocs/includes/ace/src/mode-svg.js index 6dc3c60c6dd..d8e0358d1b5 100644 --- a/htdocs/includes/ace/src/mode-svg.js +++ b/htdocs/includes/ace/src/mode-svg.js @@ -1454,6 +1454,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/javascript"; + this.snippetFileId = "ace/snippets/javascript"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-swift.js b/htdocs/includes/ace/src/mode-swift.js index b207deb7652..06644d6fdda 100644 --- a/htdocs/includes/ace/src/mode-swift.js +++ b/htdocs/includes/ace/src/mode-swift.js @@ -165,6 +165,12 @@ var SwiftHighlightRules = function() { this.$rules = { start: [ + string('"""', { + escape: /\\(?:[0\\tnr"']|u{[a-fA-F1-9]{0,8}})/, + interpolation: {lead: "\\", open: "(", close: ")"}, + error: /\\./, + multiline: true + }), string('"', { escape: /\\(?:[0\\tnr"']|u{[a-fA-F1-9]{0,8}})/, interpolation: {lead: "\\", open: "(", close: ")"}, diff --git a/htdocs/includes/ace/src/mode-tcl.js b/htdocs/includes/ace/src/mode-tcl.js index b898da9c528..632f928adbc 100644 --- a/htdocs/includes/ace/src/mode-tcl.js +++ b/htdocs/includes/ace/src/mode-tcl.js @@ -373,6 +373,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/tcl"; + this.snippetFileId = "ace/snippets/tcl"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-terraform.js b/htdocs/includes/ace/src/mode-terraform.js index 76e2cf2db63..bd252bc32b5 100644 --- a/htdocs/includes/ace/src/mode-terraform.js +++ b/htdocs/includes/ace/src/mode-terraform.js @@ -40,11 +40,15 @@ var TerraformHighlightRules = function () { { token: "singleline.comment.terraform", - regex: '#(.)*$' + regex: '#.*$' + }, + { + token: "singleline.comment.terraform", + regex: '//.*$' }, { token: "multiline.comment.begin.terraform", - regex: '^\\s*\\/\\*', + regex: /\/\*/, push: "blockComment" }, { @@ -66,11 +70,7 @@ var TerraformHighlightRules = function () { {include: "variables"} ], blockComment: [{ - regex: "^\\s*\\/\\*", - token: "multiline.comment.begin.terraform", - push: "blockComment" - }, { - regex: "\\*\\/\\s*$", + regex: /\*\//, token: "multiline.comment.end.terraform", next: "pop" }, { @@ -383,6 +383,9 @@ oop.inherits(Mode, TextMode); (function () { + this.lineCommentStart = ["#", "//"]; + this.blockComment = {start: "/*", end: "*/"}; + this.$id = "ace/mode/terraform"; }).call(Mode.prototype); diff --git a/htdocs/includes/ace/src/mode-tex.js b/htdocs/includes/ace/src/mode-tex.js index 22673ec6222..9b3fb3b3722 100644 --- a/htdocs/includes/ace/src/mode-tex.js +++ b/htdocs/includes/ace/src/mode-tex.js @@ -146,6 +146,7 @@ oop.inherits(Mode, TextMode); return false; }; this.$id = "ace/mode/tex"; + this.snippetFileId = "ace/snippets/tex"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-textile.js b/htdocs/includes/ace/src/mode-textile.js index 203bbbeb31a..8ce8ad64dfd 100644 --- a/htdocs/includes/ace/src/mode-textile.js +++ b/htdocs/includes/ace/src/mode-textile.js @@ -135,6 +135,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/textile"; + this.snippetFileId = "ace/snippets/textile"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-tsx.js b/htdocs/includes/ace/src/mode-tsx.js index b4292219847..2b5d18d632c 100644 --- a/htdocs/includes/ace/src/mode-tsx.js +++ b/htdocs/includes/ace/src/mode-tsx.js @@ -784,6 +784,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/javascript"; + this.snippetFileId = "ace/snippets/javascript"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-twig.js b/htdocs/includes/ace/src/mode-twig.js index a7c3c2b4bd2..b5eac5b2b68 100644 --- a/htdocs/includes/ace/src/mode-twig.js +++ b/htdocs/includes/ace/src/mode-twig.js @@ -784,6 +784,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/javascript"; + this.snippetFileId = "ace/snippets/javascript"; }).call(Mode.prototype); exports.Mode = Mode; @@ -1316,6 +1317,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/css"; + this.snippetFileId = "ace/snippets/css"; }).call(Mode.prototype); exports.Mode = Mode; @@ -2493,6 +2495,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/html"; + this.snippetFileId = "ace/snippets/html"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-typescript.js b/htdocs/includes/ace/src/mode-typescript.js index d4e8cdb3876..3bebbdaba3d 100644 --- a/htdocs/includes/ace/src/mode-typescript.js +++ b/htdocs/includes/ace/src/mode-typescript.js @@ -784,6 +784,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/javascript"; + this.snippetFileId = "ace/snippets/javascript"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-vala.js b/htdocs/includes/ace/src/mode-vala.js index 5e51a584107..2fe15bac55d 100644 --- a/htdocs/includes/ace/src/mode-vala.js +++ b/htdocs/includes/ace/src/mode-vala.js @@ -663,6 +663,7 @@ oop.inherits(Mode, TextMode); this.$outdent.autoOutdent(doc, row); }; this.$id = "ace/mode/vala"; + this.snippetFileId = "ace/snippets/vala"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-vbscript.js b/htdocs/includes/ace/src/mode-vbscript.js index 482c2f95c96..19a3a002781 100644 --- a/htdocs/includes/ace/src/mode-vbscript.js +++ b/htdocs/includes/ace/src/mode-vbscript.js @@ -8,11 +8,13 @@ var VBScriptHighlightRules = function() { var keywordMapper = this.createKeywordMapper({ "keyword.control.asp": "If|Then|Else|ElseIf|End|While|Wend|For|To|Each|Case|Select|Return" - + "|Continue|Do|Until|Loop|Next|With|Exit|Function|Property|Type|Enum|Sub|IIf", - "storage.type.asp": "Dim|Call|Class|Const|Dim|Redim|Set|Let|Get|New|Randomize|Option|Explicit", + + "|Continue|Do|Until|Loop|Next|With|Exit|Function|Property|Type|Enum|Sub|IIf|Class", + "storage.type.asp": "Dim|Call|Const|Redim|Set|Let|Get|New|Randomize|Option|Explicit|Preserve|Erase|Execute|ExecuteGlobal", "storage.modifier.asp": "Private|Public|Default", - "keyword.operator.asp": "Mod|And|Not|Or|Xor|as", + "keyword.operator.asp": "Mod|And|Not|Or|Xor|As|Eqv|Imp|Is", "constant.language.asp": "Empty|False|Nothing|Null|True", + "variable.language.vb.asp": "Me", + "support.class.vb.asp": "RegExp", "support.class.asp": "Application|ObjectContext|Request|Response|Server|Session", "support.class.collection.asp": "Contents|StaticObjects|ClientCertificate|Cookies|Form|QueryString|ServerVariables", "support.constant.asp": "TotalBytes|Buffer|CacheControl|Charset|ContentType|Expires|ExpiresAbsolute" @@ -30,13 +32,17 @@ var VBScriptHighlightRules = function() { + "|Trim|Maths|Mid|Minute|Month|MonthName|MsgBox|Now|Oct|Remove|RemoveAll|Replace" + "|RGB|Right|Rnd|Round|ScriptEngine|ScriptEngineBuildVersion|ScriptEngineMajorVersion" + "|ScriptEngineMinorVersion|Second|SetLocale|Sgn|Sin|Space|Split|Sqr|StrComp|String|StrReverse" - + "|Tan|Time|Timer|TimeSerial|TimeValue|TypeName|UBound|UCase|Unescape|VarType|Weekday|WeekdayName|Year", - "support.type.vb.asp": "vbtrue|vbfalse|vbcr|vbcrlf|vbformfeed|vblf|vbnewline|vbnullchar|vbnullstring|" - + "int32|vbtab|vbverticaltab|vbbinarycompare|vbtextcomparevbsunday|vbmonday|vbtuesday|vbwednesday" - + "|vbthursday|vbfriday|vbsaturday|vbusesystemdayofweek|vbfirstjan1|vbfirstfourdays|vbfirstfullweek" - + "|vbgeneraldate|vblongdate|vbshortdate|vblongtime|vbshorttime|vbobjecterror|vbEmpty|vbNull|vbInteger" + + "|Tan|Time|Timer|TimeSerial|TimeValue|TypeName|UBound|UCase|Unescape|VarType|Weekday|WeekdayName|Year" + + "|AscB|AscW|ChrB|ChrW|InStrB|LeftB|LenB|MidB|RightB|Abs|GetUILanguage", + "support.type.vb.asp": "vbTrue|vbFalse|vbCr|vbCrLf|vbFormFeed|vbLf|vbNewLine|vbNullChar|vbNullString" + + "|vbTab|vbVerticalTab|vbBinaryCompare|vbTextCompare|vbSunday|vbMonday|vbTuesday|vbWednesday" + + "|vbThursday|vbFriday|vbSaturday|vbUseSystemDayOfWeek|vbFirstJan1|vbFirstFourDays|vbFirstFullWeek" + + "|vbGeneralDate|vbLongDate|vbShortDate|vbLongTime|vbShortTime|vbObjectError|vbEmpty|vbNull|vbInteger" + "|vbLong|vbSingle|vbDouble|vbCurrency|vbDate|vbString|vbObject|vbError|vbBoolean|vbVariant" - + "|vbDataObject|vbDecimal|vbByte|vbArray" + + "|vbDataObject|vbDecimal|vbByte|vbArray|vbOKOnly|vbOKCancel|vbAbortRetryIgnore|vbYesNoCancel|vbYesNo" + + "|vbRetryCancel|vbCritical|vbQuestion|vbExclamation|vbInformation|vbDefaultButton1|vbDefaultButton2" + + "|vbDefaultButton3|vbDefaultButton4|vbApplicationModal|vbSystemModal|vbOK|vbCancel|vbAbort|vbRetry|vbIgnore|vbYes|vbNo" + + "|vbUseDefault" }, "identifier", true); this.$rules = { @@ -78,7 +84,7 @@ var VBScriptHighlightRules = function() { }, { token: "storage.type.asp", - regex: "On Error Resume Next|On Error GoTo", + regex: "On\\s+Error\\s+(?:Resume\\s+Next|GoTo)\\b", caseInsensitive: true }, { @@ -106,7 +112,7 @@ var VBScriptHighlightRules = function() { }, { token: ["keyword.operator.asp"], - regex: "\\-|\\+|\\*\\/|\\>|\\<|\\=|\\&" + regex: "\\-|\\+|\\*|\\/|\\>|\\<|\\=|\\&|\\\\|\\^" } ], "state_3": [ @@ -145,7 +151,7 @@ var VBScriptHighlightRules = function() { "comment": [ { token: "comment.line.apostrophe.asp", - regex: "$|(?=(?:%>))", + regex: "$", next: "start" }, { @@ -175,23 +181,446 @@ oop.inherits(VBScriptHighlightRules, TextHighlightRules); exports.VBScriptHighlightRules = VBScriptHighlightRules; }); -define("ace/mode/vbscript",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/vbscript_highlight_rules"], function(require, exports, module) { +define("ace/mode/folding/vbscript",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range","ace/token_iterator"], function(require, exports, module) { +"use strict"; + +var oop = require("../../lib/oop"); +var BaseFoldMode = require("./fold_mode").FoldMode; +var Range = require("../../range").Range; +var TokenIterator = require("../../token_iterator").TokenIterator; + + +var FoldMode = exports.FoldMode = function() {}; + +oop.inherits(FoldMode, BaseFoldMode); + +(function() { + this.indentKeywords = { + "class": 1, + "function": 1, + "sub": 1, + "if": 1, + "select": 1, + "do": 1, + "for": 1, + "while": 1, + "with": 1, + "property": 1, + "else": 1, + "elseif": 1, + "end": -1, + "loop": -1, + "next": -1, + "wend": -1 + }; + + this.foldingStartMarker = /(?:\s|^)(class|function|sub|if|select|do|for|while|with|property|else|elseif)\b/i; + this.foldingStopMarker = /\b(end|loop|next|wend)\b/i; + + this.getFoldWidgetRange = function (session, foldStyle, row) { + var line = session.getLine(row); + var isStart = this.foldingStartMarker.test(line); + var isEnd = this.foldingStopMarker.test(line); + if (isStart || isEnd) { + var match = (isEnd) ? this.foldingStopMarker.exec(line) : this.foldingStartMarker.exec(line); + var keyword = match && match[1].toLowerCase(); + if (keyword) { + var type = session.getTokenAt(row, match.index + 2).type; + if (type === "keyword.control.asp" || type === "storage.type.function.asp") + return this.vbsBlock(session, row, match.index + 2); + } + } + }; + this.getFoldWidget = function(session, foldStyle, row) { + var line = session.getLine(row); + var isStart = this.foldingStartMarker.test(line); + var isEnd = this.foldingStopMarker.test(line); + if (isStart && !isEnd) { + var match = this.foldingStartMarker.exec(line); + var keyword = match && match[1].toLowerCase(); + if (keyword) { + var type = session.getTokenAt(row, match.index + 2).type; + if (type == "keyword.control.asp" || type == "storage.type.function.asp") { + if (keyword == "if" && !/then\s*('|$)/i.test(line)) + return ""; + return "start"; + } + } + } + return ""; + }; + + this.vbsBlock = function(session, row, column, tokenRange) { + var stream = new TokenIterator(session, row, column); + + var endOpenings = { + "class": 1, + "function": 1, + "sub": 1, + "if": 1, + "select": 1, + "with": 1, + "property": 1, + "else": 1, + "elseif": 1 + }; + + var token = stream.getCurrentToken(); + if (!token || (token.type != "keyword.control.asp" && token.type != "storage.type.function.asp")) + return; + + var startTokenValue = token.value.toLowerCase(); + var val = token.value.toLowerCase(); + + var stack = [val]; + var dir = this.indentKeywords[val]; + + if (!dir) + return; + + var firstRange = stream.getCurrentTokenRange(); + switch (val) { + case "property": + case "sub": + case "function": + case "if": + case "select": + case "do": + case "for": + case "class": + case "while": + case "with": + var line = session.getLine(row); + var singleLineCondition = /^\s*If\s+.*\s+Then(?!')\s+(?!')\S/i.test(line); + if (singleLineCondition) + return; + var checkToken = new RegExp("(?:^|\\s)" + val, "i"); + var endTest = /^\s*End\s(If|Sub|Select|Function|Class|With|Property)\s*/i.test(line); + if (!checkToken.test(line) && !endTest) { + return; + } + if (endTest) { + var tokenRange = stream.getCurrentTokenRange(); + stream.step = stream.stepBackward; + stream.step(); + stream.step(); + token = stream.getCurrentToken(); + if (token) { + val = token.value.toLowerCase(); + if (val == "end") { + firstRange = stream.getCurrentTokenRange(); + firstRange = new Range(firstRange.start.row, firstRange.start.column, tokenRange.start.row, tokenRange.end.column); + } + } + dir = -1; + } + break; + case "end": + var tokenPos = stream.getCurrentTokenPosition(); + firstRange = stream.getCurrentTokenRange(); + stream.step = stream.stepForward; + stream.step(); + stream.step(); + token = stream.getCurrentToken(); + if (token) { + val = token.value.toLowerCase(); + if (val in endOpenings) { + startTokenValue = val; + var nextTokenPos = stream.getCurrentTokenPosition(); + var endColumn = nextTokenPos.column + val.length; + firstRange = new Range(tokenPos.row, tokenPos.column, nextTokenPos.row, endColumn); + } + } + stream.step = stream.stepBackward; + stream.step(); + stream.step(); + break; + } + var startColumn = dir === -1 ? session.getLine(row - 1).length : session.getLine(row).length; + var startRow = row; + var ranges = []; + ranges.push(firstRange); + + stream.step = dir === -1 ? stream.stepBackward : stream.stepForward; + while(token = stream.step()) { + var outputRange = null; + var ignore = false; + if (token.type != "keyword.control.asp" && token.type != "storage.type.function.asp") + continue; + val = token.value.toLowerCase(); + var level = dir * this.indentKeywords[val]; + + switch (val) { + case "property": + case "sub": + case "function": + case "if": + case "select": + case "do": + case "for": + case "class": + case "while": + case "with": + var line = session.getLine(stream.getCurrentTokenRow()); + var singleLineCondition = /^\s*If\s+.*\s+Then(?!')\s+(?!')\S/i.test(line); + if (singleLineCondition) { + level = 0; + ignore = true; + } + var checkToken = new RegExp("^\\s* end\\s+" + val, "i"); + if (checkToken.test(line)) { + level = 0; + ignore = true; + } + break; + case "elseif": + case "else": + level = 0; + if (startTokenValue != "elseif") { + ignore = true; + } + break; + } + + if (level > 0) { + stack.unshift(val); + } else if (level <= 0 && ignore === false) { + stack.shift(); + if (!stack.length) { + switch (val) { + case "end": + var tokenPos = stream.getCurrentTokenPosition(); + outputRange = stream.getCurrentTokenRange(); + stream.step(); + stream.step(); + token = stream.getCurrentToken(); + if (token) { + val = token.value.toLowerCase(); + if (val in endOpenings) { + if ((startTokenValue == "else" || startTokenValue == "elseif")) { + if (val !== "if") { + ranges.shift(); + } + } else { + if (val != startTokenValue) + ranges.shift(); + } + var nextTokenPos = stream.getCurrentTokenPosition(); + var endColumn = nextTokenPos.column + val.length; + outputRange = new Range(tokenPos.row, tokenPos.column, nextTokenPos.row, endColumn); + } else { + ranges.shift(); + } + } else { + ranges.shift(); + } + stream.step = stream.stepBackward; + stream.step(); + stream.step(); + token = stream.getCurrentToken(); + val = token.value.toLowerCase(); + break; + case "select": + case "sub": + case "if": + case "function": + case "class": + case "with": + case "property": + if (val != startTokenValue) + ranges.shift(); + break; + case "do": + if (startTokenValue != "loop") + ranges.shift(); + break; + case "loop": + if (startTokenValue != "do") + ranges.shift(); + break; + case "for": + if (startTokenValue != "next") + ranges.shift(); + break; + case "next": + if (startTokenValue != "for") + ranges.shift(); + break; + case "while": + if (startTokenValue != "wend") + ranges.shift(); + break; + case "wend": + if (startTokenValue != "while") + ranges.shift(); + break; + } + break; + } + + if (level === 0){ + stack.unshift(val); + } + } + } + + if (!token) + return null; + + if (tokenRange) { + if (!outputRange) { + ranges.push(stream.getCurrentTokenRange()); + } else { + ranges.push(outputRange); + } + return ranges; + } + + var row = stream.getCurrentTokenRow(); + if (dir === -1) { + var endColumn = session.getLine(row).length; + return new Range(row, endColumn, startRow - 1, startColumn); + } else + return new Range(startRow, startColumn, row - 1, session.getLine(row - 1).length); + }; + +}).call(FoldMode.prototype); + +}); + +define("ace/mode/vbscript",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/vbscript_highlight_rules","ace/mode/folding/vbscript","ace/range"], function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var VBScriptHighlightRules = require("./vbscript_highlight_rules").VBScriptHighlightRules; +var FoldMode = require("./folding/vbscript").FoldMode; +var Range = require("../range").Range; var Mode = function() { this.HighlightRules = VBScriptHighlightRules; + this.foldingRules = new FoldMode(); this.$behaviour = this.$defaultBehaviour; + this.indentKeywords = this.foldingRules.indentKeywords; }; oop.inherits(Mode, TextMode); (function() { - + this.lineCommentStart = ["'", "REM"]; - + + var outdentKeywords = [ + "else", + "elseif", + "end", + "loop", + "next", + "wend" + ]; + + function getNetIndentLevel(tokens, line, indentKeywords) { + var level = 0; + for (var i = 0; i < tokens.length; i++) { + var token = tokens[i]; + if (token.type == "keyword.control.asp" || token.type == "storage.type.function.asp") { + var val = token.value.toLowerCase(); + if (val in indentKeywords) { + switch (val) { + case "property": + case "sub": + case "function": + case "select": + case "do": + case "for": + case "class": + case "while": + case "with": + case "if": + var checkToken = new RegExp("^\\s* end\\s+" + val, "i"); + var singleLineCondition = /^\s*If\s+.*\s+Then(?!')\s+(?!')\S/i.test(line); + if (!singleLineCondition && !checkToken.test(line)) + level += indentKeywords[val]; + break; + default: + level += indentKeywords[val]; + break; + } + } + } + } + if (level < 0) { + return -1; + } else if (level > 0) { + return 1; + } else { + return 0; + } + } + + this.getNextLineIndent = function(state, line, tab) { + var indent = this.$getIndent(line); + var level = 0; + + var tokenizedLine = this.getTokenizer().getLineTokens(line, state); + var tokens = tokenizedLine.tokens; + + if (state == "start") { + level = getNetIndentLevel(tokens, line, this.indentKeywords); + } + if (level > 0) { + return indent + tab; + } else if (level < 0 && indent.substr(indent.length - tab.length) == tab) { + if (!this.checkOutdent(state, line, "\n")) { + return indent.substr(0, indent.length - tab.length); + } + } + return indent; + }; + + this.checkOutdent = function(state, line, input) { + if (input != "\n" && input != "\r" && input != "\r\n") + return false; + + var tokens = this.getTokenizer().getLineTokens(line.trim(), state).tokens; + + if (!tokens || !tokens.length) + return false; + var val = tokens[0].value.toLowerCase(); + return ((tokens[0].type == "keyword.control.asp" || tokens[0].type == "storage.type.function.asp") && outdentKeywords.indexOf(val) != -1); + }; + + this.getMatching = function(session, row, column, tokenRange) { + if (row == undefined) { + var pos = session.selection.lead; + column = pos.column; + row = pos.row; + } + if (tokenRange == undefined) + tokenRange = true; + + var startToken = session.getTokenAt(row, column); + if (startToken) { + var val = startToken.value.toLowerCase(); + if (val in this.indentKeywords) + return this.foldingRules.vbsBlock(session, row, column, tokenRange); + } + }; + + this.autoOutdent = function(state, session, row) { + var line = session.getLine(row); + var column = line.match(/^\s*/)[0].length; + if (!column || !row) return; + + var startRange = this.getMatching(session, row, column + 1, false); + if (!startRange || startRange.start.row == row) + return; + var indent = this.$getIndent(session.getLine(startRange.start.row)); + if (indent.length != column) { + session.replace(new Range(row, 0, row, column), indent); + session.outdentRows(new Range(row + 1, 0, row + 1, 0)); + } + }; + this.$id = "ace/mode/vbscript"; }).call(Mode.prototype); diff --git a/htdocs/includes/ace/src/mode-velocity.js b/htdocs/includes/ace/src/mode-velocity.js index ea94a8fd9ad..98458db2d49 100644 --- a/htdocs/includes/ace/src/mode-velocity.js +++ b/htdocs/includes/ace/src/mode-velocity.js @@ -784,6 +784,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/javascript"; + this.snippetFileId = "ace/snippets/javascript"; }).call(Mode.prototype); exports.Mode = Mode; @@ -1316,6 +1317,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/css"; + this.snippetFileId = "ace/snippets/css"; }).call(Mode.prototype); exports.Mode = Mode; @@ -2493,6 +2495,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/html"; + this.snippetFileId = "ace/snippets/html"; }).call(Mode.prototype); exports.Mode = Mode; @@ -2775,6 +2778,7 @@ oop.inherits(Mode, HtmlMode); this.lineCommentStart = "##"; this.blockComment = {start: "#*", end: "*#"}; this.$id = "ace/mode/velocity"; + this.snippetFileId = "ace/snippets/velocity"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-vhdl.js b/htdocs/includes/ace/src/mode-vhdl.js index 75f22a1f512..d3e4ba6fd59 100644 --- a/htdocs/includes/ace/src/mode-vhdl.js +++ b/htdocs/includes/ace/src/mode-vhdl.js @@ -8,18 +8,21 @@ var VHDLHighlightRules = function() { - var keywords = "access|after|ailas|all|architecture|assert|attribute|"+ - "begin|block|buffer|bus|case|component|configuration|"+ - "disconnect|downto|else|elsif|end|entity|file|for|function|"+ - "generate|generic|guarded|if|impure|in|inertial|inout|is|"+ - "label|linkage|literal|loop|mapnew|next|of|on|open|others|"+ - "out|port|process|pure|range|record|reject|report|return|"+ - "select|severity|shared|signal|subtype|then|to|transport|"+ - "type|unaffected|united|until|wait|when|while|with"; + var keywords = "access|after|alias|all|architecture|assert|attribute|"+ + "begin|block|body|buffer|bus|case|component|configuration|"+ + "context|disconnect|downto|else|elsif|end|entity|exit|"+ + "file|for|force|function|generate|generic|group|guarded|"+ + "if|impure|in|inertial|inout|is|label|library|linkage|"+ + "literal|loop|map|new|next|of|on|or|open|others|out|"+ + "package|parameter|port|postponed|procedure|process|"+ + "protected|pure|range|record|register|reject|release|"+ + "report|return|select|severity|shared|signal|subtype|then|"+ + "to|transport|type|unaffected|units|until|use|variable|"+ + "wait|when|while|with"; var storageType = "bit|bit_vector|boolean|character|integer|line|natural|"+ "positive|real|register|signed|std_logic|"+ - "std_logic_vector|string||text|time|unsigned|variable"; + "std_logic_vector|string||text|time|unsigned"; var storageModifiers = "array|constant"; diff --git a/htdocs/includes/ace/src/mode-visualforce.js b/htdocs/includes/ace/src/mode-visualforce.js index ad9ab780b74..30c2cd90d18 100644 --- a/htdocs/includes/ace/src/mode-visualforce.js +++ b/htdocs/includes/ace/src/mode-visualforce.js @@ -784,6 +784,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/javascript"; + this.snippetFileId = "ace/snippets/javascript"; }).call(Mode.prototype); exports.Mode = Mode; @@ -1316,6 +1317,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/css"; + this.snippetFileId = "ace/snippets/css"; }).call(Mode.prototype); exports.Mode = Mode; @@ -2493,6 +2495,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/html"; + this.snippetFileId = "ace/snippets/html"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-wollok.js b/htdocs/includes/ace/src/mode-wollok.js index a4dba0f9ce4..e62e249a84d 100644 --- a/htdocs/includes/ace/src/mode-wollok.js +++ b/htdocs/includes/ace/src/mode-wollok.js @@ -784,6 +784,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/javascript"; + this.snippetFileId = "ace/snippets/javascript"; }).call(Mode.prototype); exports.Mode = Mode; @@ -899,6 +900,7 @@ oop.inherits(Mode, JavaScriptMode); }; this.$id = "ace/mode/wollok"; + this.snippetFileId = "ace/snippets/wollok"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-xquery.js b/htdocs/includes/ace/src/mode-xquery.js index 0a87a75fa2b..4512ba9d91e 100644 --- a/htdocs/includes/ace/src/mode-xquery.js +++ b/htdocs/includes/ace/src/mode-xquery.js @@ -2630,6 +2630,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/xquery"; + this.snippetFileId = "ace/snippets/xquery"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/snippets/abap.js b/htdocs/includes/ace/src/snippets/abap.js index 39342f476a4..8a6b11f7d6f 100644 --- a/htdocs/includes/ace/src/snippets/abap.js +++ b/htdocs/includes/ace/src/snippets/abap.js @@ -1,10 +1,5 @@ -define("ace/snippets/abap",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "abap"; - -}); (function() { +; (function() { window.require(["ace/snippets/abap"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/ada.js b/htdocs/includes/ace/src/snippets/ada.js index 94be2e5962e..8eb30a101bd 100644 --- a/htdocs/includes/ace/src/snippets/ada.js +++ b/htdocs/includes/ace/src/snippets/ada.js @@ -1,10 +1,5 @@ -define("ace/snippets/ada",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "ada"; - -}); (function() { +; (function() { window.require(["ace/snippets/ada"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/alda.js b/htdocs/includes/ace/src/snippets/alda.js new file mode 100644 index 00000000000..a7827995831 --- /dev/null +++ b/htdocs/includes/ace/src/snippets/alda.js @@ -0,0 +1,9 @@ + +; (function() { + window.require(["ace/snippets/alda"], function(m) { + if (typeof module == "object" && typeof exports == "object" && module) { + module.exports = m; + } + }); + })(); + \ No newline at end of file diff --git a/htdocs/includes/ace/src/snippets/apache_conf.js b/htdocs/includes/ace/src/snippets/apache_conf.js index c4e29459270..21986504c25 100644 --- a/htdocs/includes/ace/src/snippets/apache_conf.js +++ b/htdocs/includes/ace/src/snippets/apache_conf.js @@ -1,10 +1,5 @@ -define("ace/snippets/apache_conf",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "apache_conf"; - -}); (function() { +; (function() { window.require(["ace/snippets/apache_conf"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/apex.js b/htdocs/includes/ace/src/snippets/apex.js index 0c1f767377d..2dbcd0fce11 100644 --- a/htdocs/includes/ace/src/snippets/apex.js +++ b/htdocs/includes/ace/src/snippets/apex.js @@ -1,10 +1,5 @@ -define("ace/snippets/apex",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "apex"; - -}); (function() { +; (function() { window.require(["ace/snippets/apex"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/applescript.js b/htdocs/includes/ace/src/snippets/applescript.js index 2412c72c9af..ea322dbde2b 100644 --- a/htdocs/includes/ace/src/snippets/applescript.js +++ b/htdocs/includes/ace/src/snippets/applescript.js @@ -1,10 +1,5 @@ -define("ace/snippets/applescript",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "applescript"; - -}); (function() { +; (function() { window.require(["ace/snippets/applescript"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/aql.js b/htdocs/includes/ace/src/snippets/aql.js index f9ef46d179d..5568f6a1084 100644 --- a/htdocs/includes/ace/src/snippets/aql.js +++ b/htdocs/includes/ace/src/snippets/aql.js @@ -1,10 +1,5 @@ -define("ace/snippets/aql",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "aql"; - -}); (function() { +; (function() { window.require(["ace/snippets/aql"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/asciidoc.js b/htdocs/includes/ace/src/snippets/asciidoc.js index 7c68e42e3f0..e5b47cfa570 100644 --- a/htdocs/includes/ace/src/snippets/asciidoc.js +++ b/htdocs/includes/ace/src/snippets/asciidoc.js @@ -1,10 +1,5 @@ -define("ace/snippets/asciidoc",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "asciidoc"; - -}); (function() { +; (function() { window.require(["ace/snippets/asciidoc"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/asl.js b/htdocs/includes/ace/src/snippets/asl.js index e077ac0e4ab..0166b95535e 100644 --- a/htdocs/includes/ace/src/snippets/asl.js +++ b/htdocs/includes/ace/src/snippets/asl.js @@ -1,9 +1,5 @@ -define("ace/snippets/asl",["require","exports","module"], function (require, exports, module) { - "use strict"; - exports.snippetText =undefined; - exports.scope = "asl"; -}); (function() { +; (function() { window.require(["ace/snippets/asl"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/assembly_x86.js b/htdocs/includes/ace/src/snippets/assembly_x86.js index 7b16369e1be..ffbf5971f61 100644 --- a/htdocs/includes/ace/src/snippets/assembly_x86.js +++ b/htdocs/includes/ace/src/snippets/assembly_x86.js @@ -1,10 +1,5 @@ -define("ace/snippets/assembly_x86",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "assembly_x86"; - -}); (function() { +; (function() { window.require(["ace/snippets/assembly_x86"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/autohotkey.js b/htdocs/includes/ace/src/snippets/autohotkey.js index 601d201ce16..e0674d4eac6 100644 --- a/htdocs/includes/ace/src/snippets/autohotkey.js +++ b/htdocs/includes/ace/src/snippets/autohotkey.js @@ -1,10 +1,5 @@ -define("ace/snippets/autohotkey",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "autohotkey"; - -}); (function() { +; (function() { window.require(["ace/snippets/autohotkey"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/batchfile.js b/htdocs/includes/ace/src/snippets/batchfile.js index dfae8ab00bc..0404a41ee28 100644 --- a/htdocs/includes/ace/src/snippets/batchfile.js +++ b/htdocs/includes/ace/src/snippets/batchfile.js @@ -1,10 +1,5 @@ -define("ace/snippets/batchfile",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "batchfile"; - -}); (function() { +; (function() { window.require(["ace/snippets/batchfile"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/bro.js b/htdocs/includes/ace/src/snippets/bro.js deleted file mode 100644 index 9412c6003e3..00000000000 --- a/htdocs/includes/ace/src/snippets/bro.js +++ /dev/null @@ -1,14 +0,0 @@ -define("ace/snippets/bro",["require","exports","module"], function(require, exports, module) { -"use strict"; - -exports.snippetText =undefined; -exports.scope = ""; - -}); (function() { - window.require(["ace/snippets/bro"], function(m) { - if (typeof module == "object" && typeof exports == "object" && module) { - module.exports = m; - } - }); - })(); - \ No newline at end of file diff --git a/htdocs/includes/ace/src/snippets/c9search.js b/htdocs/includes/ace/src/snippets/c9search.js index b5c7058137b..d83a158fc79 100644 --- a/htdocs/includes/ace/src/snippets/c9search.js +++ b/htdocs/includes/ace/src/snippets/c9search.js @@ -1,10 +1,5 @@ -define("ace/snippets/c9search",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "c9search"; - -}); (function() { +; (function() { window.require(["ace/snippets/c9search"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/cirru.js b/htdocs/includes/ace/src/snippets/cirru.js index 882b0c9741f..8bd664ed3f9 100644 --- a/htdocs/includes/ace/src/snippets/cirru.js +++ b/htdocs/includes/ace/src/snippets/cirru.js @@ -1,10 +1,5 @@ -define("ace/snippets/cirru",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "cirru"; - -}); (function() { +; (function() { window.require(["ace/snippets/cirru"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/cobol.js b/htdocs/includes/ace/src/snippets/cobol.js index 303dea71778..1fece5b6445 100644 --- a/htdocs/includes/ace/src/snippets/cobol.js +++ b/htdocs/includes/ace/src/snippets/cobol.js @@ -1,10 +1,5 @@ -define("ace/snippets/cobol",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "cobol"; - -}); (function() { +; (function() { window.require(["ace/snippets/cobol"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/coldfusion.js b/htdocs/includes/ace/src/snippets/coldfusion.js index db72fad9320..0f1ff4d2b8a 100644 --- a/htdocs/includes/ace/src/snippets/coldfusion.js +++ b/htdocs/includes/ace/src/snippets/coldfusion.js @@ -1,10 +1,5 @@ -define("ace/snippets/coldfusion",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "coldfusion"; - -}); (function() { +; (function() { window.require(["ace/snippets/coldfusion"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/crystal.js b/htdocs/includes/ace/src/snippets/crystal.js index ef64a9fdce1..39614eb1fe5 100644 --- a/htdocs/includes/ace/src/snippets/crystal.js +++ b/htdocs/includes/ace/src/snippets/crystal.js @@ -1,10 +1,5 @@ -define("ace/snippets/crystal",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "crystal"; - -}); (function() { +; (function() { window.require(["ace/snippets/crystal"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/csharp.js b/htdocs/includes/ace/src/snippets/csharp.js index f36041cbcd7..22c8f86c0a7 100644 --- a/htdocs/includes/ace/src/snippets/csharp.js +++ b/htdocs/includes/ace/src/snippets/csharp.js @@ -1,10 +1,5 @@ -define("ace/snippets/csharp",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "csharp"; - -}); (function() { +; (function() { window.require(["ace/snippets/csharp"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/csound_score.js b/htdocs/includes/ace/src/snippets/csound_score.js index 82ee2c17d35..3d7ae0e6720 100644 --- a/htdocs/includes/ace/src/snippets/csound_score.js +++ b/htdocs/includes/ace/src/snippets/csound_score.js @@ -1,10 +1,5 @@ -define("ace/snippets/csound_score",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "csound_score"; - -}); (function() { +; (function() { window.require(["ace/snippets/csound_score"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/csp.js b/htdocs/includes/ace/src/snippets/csp.js index 8225367a49b..685814919fa 100644 --- a/htdocs/includes/ace/src/snippets/csp.js +++ b/htdocs/includes/ace/src/snippets/csp.js @@ -1,10 +1,5 @@ -define("ace/snippets/csp",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = ""; - -}); (function() { +; (function() { window.require(["ace/snippets/csp"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/curly.js b/htdocs/includes/ace/src/snippets/curly.js index 1d7b8f7b290..d0c5487d9f0 100644 --- a/htdocs/includes/ace/src/snippets/curly.js +++ b/htdocs/includes/ace/src/snippets/curly.js @@ -1,10 +1,5 @@ -define("ace/snippets/curly",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "curly"; - -}); (function() { +; (function() { window.require(["ace/snippets/curly"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/d.js b/htdocs/includes/ace/src/snippets/d.js index 117da84d0eb..18257d4f6c6 100644 --- a/htdocs/includes/ace/src/snippets/d.js +++ b/htdocs/includes/ace/src/snippets/d.js @@ -1,10 +1,5 @@ -define("ace/snippets/d",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "d"; - -}); (function() { +; (function() { window.require(["ace/snippets/d"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/dockerfile.js b/htdocs/includes/ace/src/snippets/dockerfile.js index 6ebfb397359..cd5d4182f1a 100644 --- a/htdocs/includes/ace/src/snippets/dockerfile.js +++ b/htdocs/includes/ace/src/snippets/dockerfile.js @@ -1,10 +1,5 @@ -define("ace/snippets/dockerfile",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "dockerfile"; - -}); (function() { +; (function() { window.require(["ace/snippets/dockerfile"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/dot.js b/htdocs/includes/ace/src/snippets/dot.js index 0af0a491752..aec363b01d6 100644 --- a/htdocs/includes/ace/src/snippets/dot.js +++ b/htdocs/includes/ace/src/snippets/dot.js @@ -1,10 +1,5 @@ -define("ace/snippets/dot",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "dot"; - -}); (function() { +; (function() { window.require(["ace/snippets/dot"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/eiffel.js b/htdocs/includes/ace/src/snippets/eiffel.js index bc6a66a93b3..60a36440f0d 100644 --- a/htdocs/includes/ace/src/snippets/eiffel.js +++ b/htdocs/includes/ace/src/snippets/eiffel.js @@ -1,10 +1,5 @@ -define("ace/snippets/eiffel",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "eiffel"; - -}); (function() { +; (function() { window.require(["ace/snippets/eiffel"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/ejs.js b/htdocs/includes/ace/src/snippets/ejs.js index 83368d91ee0..3e0f355e747 100644 --- a/htdocs/includes/ace/src/snippets/ejs.js +++ b/htdocs/includes/ace/src/snippets/ejs.js @@ -1,10 +1,5 @@ -define("ace/snippets/ejs",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "ejs"; - -}); (function() { +; (function() { window.require(["ace/snippets/ejs"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/elixir.js b/htdocs/includes/ace/src/snippets/elixir.js index 8ddaf1c4495..f408337980b 100644 --- a/htdocs/includes/ace/src/snippets/elixir.js +++ b/htdocs/includes/ace/src/snippets/elixir.js @@ -1,10 +1,5 @@ -define("ace/snippets/elixir",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = ""; - -}); (function() { +; (function() { window.require(["ace/snippets/elixir"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/elm.js b/htdocs/includes/ace/src/snippets/elm.js index 71d7a7e15b0..c1122649f1b 100644 --- a/htdocs/includes/ace/src/snippets/elm.js +++ b/htdocs/includes/ace/src/snippets/elm.js @@ -1,10 +1,5 @@ -define("ace/snippets/elm",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "elm"; - -}); (function() { +; (function() { window.require(["ace/snippets/elm"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/forth.js b/htdocs/includes/ace/src/snippets/forth.js index 0861c05f3e9..a7a0c053f63 100644 --- a/htdocs/includes/ace/src/snippets/forth.js +++ b/htdocs/includes/ace/src/snippets/forth.js @@ -1,10 +1,5 @@ -define("ace/snippets/forth",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "forth"; - -}); (function() { +; (function() { window.require(["ace/snippets/forth"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/fortran.js b/htdocs/includes/ace/src/snippets/fortran.js index 69bffe8f2aa..ec3ae4e6457 100644 --- a/htdocs/includes/ace/src/snippets/fortran.js +++ b/htdocs/includes/ace/src/snippets/fortran.js @@ -1,10 +1,5 @@ -define("ace/snippets/fortran",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "fortran"; - -}); (function() { +; (function() { window.require(["ace/snippets/fortran"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/fsharp.js b/htdocs/includes/ace/src/snippets/fsharp.js index bbc8eb65b5e..dfe6a1391e1 100644 --- a/htdocs/includes/ace/src/snippets/fsharp.js +++ b/htdocs/includes/ace/src/snippets/fsharp.js @@ -1,10 +1,5 @@ -define("ace/snippets/fsharp",["require","exports","module"], function(require, exports, module) { - "use strict"; - exports.snippetText =undefined; - exports.scope = "fsharp"; - -}); (function() { +; (function() { window.require(["ace/snippets/fsharp"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/ftl.js b/htdocs/includes/ace/src/snippets/ftl.js index 7b7cb67948e..aa9f0e0bbfc 100644 --- a/htdocs/includes/ace/src/snippets/ftl.js +++ b/htdocs/includes/ace/src/snippets/ftl.js @@ -1,10 +1,5 @@ -define("ace/snippets/ftl",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "ftl"; - -}); (function() { +; (function() { window.require(["ace/snippets/ftl"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/gcode.js b/htdocs/includes/ace/src/snippets/gcode.js index b44f1656ce3..d85b1b4838b 100644 --- a/htdocs/includes/ace/src/snippets/gcode.js +++ b/htdocs/includes/ace/src/snippets/gcode.js @@ -1,10 +1,5 @@ -define("ace/snippets/gcode",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "gcode"; - -}); (function() { +; (function() { window.require(["ace/snippets/gcode"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/gherkin.js b/htdocs/includes/ace/src/snippets/gherkin.js index 8986e377a7d..11c54661bdc 100644 --- a/htdocs/includes/ace/src/snippets/gherkin.js +++ b/htdocs/includes/ace/src/snippets/gherkin.js @@ -1,10 +1,5 @@ -define("ace/snippets/gherkin",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "gherkin"; - -}); (function() { +; (function() { window.require(["ace/snippets/gherkin"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/gitignore.js b/htdocs/includes/ace/src/snippets/gitignore.js index aea0fb0df9a..a6af8361d76 100644 --- a/htdocs/includes/ace/src/snippets/gitignore.js +++ b/htdocs/includes/ace/src/snippets/gitignore.js @@ -1,10 +1,5 @@ -define("ace/snippets/gitignore",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "gitignore"; - -}); (function() { +; (function() { window.require(["ace/snippets/gitignore"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/glsl.js b/htdocs/includes/ace/src/snippets/glsl.js index f638fbc6eac..bdea4bfaa64 100644 --- a/htdocs/includes/ace/src/snippets/glsl.js +++ b/htdocs/includes/ace/src/snippets/glsl.js @@ -1,10 +1,5 @@ -define("ace/snippets/glsl",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "glsl"; - -}); (function() { +; (function() { window.require(["ace/snippets/glsl"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/golang.js b/htdocs/includes/ace/src/snippets/golang.js index b16e805474f..18a9f97b64c 100644 --- a/htdocs/includes/ace/src/snippets/golang.js +++ b/htdocs/includes/ace/src/snippets/golang.js @@ -1,10 +1,5 @@ -define("ace/snippets/golang",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "golang"; - -}); (function() { +; (function() { window.require(["ace/snippets/golang"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/groovy.js b/htdocs/includes/ace/src/snippets/groovy.js index 56091acbccd..72f2f32ecb1 100644 --- a/htdocs/includes/ace/src/snippets/groovy.js +++ b/htdocs/includes/ace/src/snippets/groovy.js @@ -1,10 +1,5 @@ -define("ace/snippets/groovy",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "groovy"; - -}); (function() { +; (function() { window.require(["ace/snippets/groovy"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/handlebars.js b/htdocs/includes/ace/src/snippets/handlebars.js index ca8b6354867..2eaf61de444 100644 --- a/htdocs/includes/ace/src/snippets/handlebars.js +++ b/htdocs/includes/ace/src/snippets/handlebars.js @@ -1,10 +1,5 @@ -define("ace/snippets/handlebars",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "handlebars"; - -}); (function() { +; (function() { window.require(["ace/snippets/handlebars"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/haskell_cabal.js b/htdocs/includes/ace/src/snippets/haskell_cabal.js index 471feb12baa..1a90a9cbf97 100644 --- a/htdocs/includes/ace/src/snippets/haskell_cabal.js +++ b/htdocs/includes/ace/src/snippets/haskell_cabal.js @@ -1,10 +1,5 @@ -define("ace/snippets/haskell_cabal",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "haskell_cabal"; - -}); (function() { +; (function() { window.require(["ace/snippets/haskell_cabal"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/haxe.js b/htdocs/includes/ace/src/snippets/haxe.js index 8feed8d150c..b1f2dbe6c37 100644 --- a/htdocs/includes/ace/src/snippets/haxe.js +++ b/htdocs/includes/ace/src/snippets/haxe.js @@ -1,10 +1,5 @@ -define("ace/snippets/haxe",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "haxe"; - -}); (function() { +; (function() { window.require(["ace/snippets/haxe"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/hjson.js b/htdocs/includes/ace/src/snippets/hjson.js index 79be57d0cf3..96938d67d7a 100644 --- a/htdocs/includes/ace/src/snippets/hjson.js +++ b/htdocs/includes/ace/src/snippets/hjson.js @@ -1,10 +1,5 @@ -define("ace/snippets/hjson",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = ""; - -}); (function() { +; (function() { window.require(["ace/snippets/hjson"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/html.js b/htdocs/includes/ace/src/snippets/html.js index 975496c1b49..885d2a2d64f 100644 --- a/htdocs/includes/ace/src/snippets/html.js +++ b/htdocs/includes/ace/src/snippets/html.js @@ -237,9 +237,7 @@ snippet button:s\n\ snippet button:r\n\ \n\ snippet canvas\n\ - \n\ - ${1}\n\ - \n\ + \n\ snippet caption\n\ ${1}\n\ snippet cite\n\ @@ -853,7 +851,7 @@ snippet ul+\n\ snippet var\n\ ${1}\n\ snippet video\n\ - ${8}\n\ + ${8}\n\ snippet wbr\n\ ${1}\n\ "; diff --git a/htdocs/includes/ace/src/snippets/html_elixir.js b/htdocs/includes/ace/src/snippets/html_elixir.js index c8521b55ca8..0db3e076f71 100644 --- a/htdocs/includes/ace/src/snippets/html_elixir.js +++ b/htdocs/includes/ace/src/snippets/html_elixir.js @@ -1,10 +1,5 @@ -define("ace/snippets/html_elixir",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "html_elixir"; - -}); (function() { +; (function() { window.require(["ace/snippets/html_elixir"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/html_ruby.js b/htdocs/includes/ace/src/snippets/html_ruby.js index ba20e65e72d..5d4499743c0 100644 --- a/htdocs/includes/ace/src/snippets/html_ruby.js +++ b/htdocs/includes/ace/src/snippets/html_ruby.js @@ -1,10 +1,5 @@ -define("ace/snippets/html_ruby",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "html_ruby"; - -}); (function() { +; (function() { window.require(["ace/snippets/html_ruby"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/ini.js b/htdocs/includes/ace/src/snippets/ini.js index 07200fda5b7..f31743c5b0d 100644 --- a/htdocs/includes/ace/src/snippets/ini.js +++ b/htdocs/includes/ace/src/snippets/ini.js @@ -1,10 +1,5 @@ -define("ace/snippets/ini",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "ini"; - -}); (function() { +; (function() { window.require(["ace/snippets/ini"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/jack.js b/htdocs/includes/ace/src/snippets/jack.js index 2688a3a1011..fc242d3c2a6 100644 --- a/htdocs/includes/ace/src/snippets/jack.js +++ b/htdocs/includes/ace/src/snippets/jack.js @@ -1,10 +1,5 @@ -define("ace/snippets/jack",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "jack"; - -}); (function() { +; (function() { window.require(["ace/snippets/jack"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/jade.js b/htdocs/includes/ace/src/snippets/jade.js index 6a4676b883d..1a1c1c25e37 100644 --- a/htdocs/includes/ace/src/snippets/jade.js +++ b/htdocs/includes/ace/src/snippets/jade.js @@ -1,10 +1,5 @@ -define("ace/snippets/jade",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "jade"; - -}); (function() { +; (function() { window.require(["ace/snippets/jade"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/json.js b/htdocs/includes/ace/src/snippets/json.js index 7c9c2eaf295..f1c015c4264 100644 --- a/htdocs/includes/ace/src/snippets/json.js +++ b/htdocs/includes/ace/src/snippets/json.js @@ -1,10 +1,5 @@ -define("ace/snippets/json",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "json"; - -}); (function() { +; (function() { window.require(["ace/snippets/json"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/json5.js b/htdocs/includes/ace/src/snippets/json5.js index 8afbead737d..4ae9f4b7b1f 100644 --- a/htdocs/includes/ace/src/snippets/json5.js +++ b/htdocs/includes/ace/src/snippets/json5.js @@ -1,10 +1,5 @@ -define("ace/snippets/json5",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "json5"; - -}); (function() { +; (function() { window.require(["ace/snippets/json5"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/jssm.js b/htdocs/includes/ace/src/snippets/jssm.js index fceb11ddfe9..2fcea71ccf0 100644 --- a/htdocs/includes/ace/src/snippets/jssm.js +++ b/htdocs/includes/ace/src/snippets/jssm.js @@ -1,10 +1,5 @@ -define("ace/snippets/jssm",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = ""; - -}); (function() { +; (function() { window.require(["ace/snippets/jssm"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/jsx.js b/htdocs/includes/ace/src/snippets/jsx.js index 38f276f80a2..b26a3586bbb 100644 --- a/htdocs/includes/ace/src/snippets/jsx.js +++ b/htdocs/includes/ace/src/snippets/jsx.js @@ -1,10 +1,5 @@ -define("ace/snippets/jsx",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "jsx"; - -}); (function() { +; (function() { window.require(["ace/snippets/jsx"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/julia.js b/htdocs/includes/ace/src/snippets/julia.js index 360f7c3d200..30a74650766 100644 --- a/htdocs/includes/ace/src/snippets/julia.js +++ b/htdocs/includes/ace/src/snippets/julia.js @@ -1,10 +1,5 @@ -define("ace/snippets/julia",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "julia"; - -}); (function() { +; (function() { window.require(["ace/snippets/julia"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/kotlin.js b/htdocs/includes/ace/src/snippets/kotlin.js index b2e3d3cbb52..c9e543c7d58 100644 --- a/htdocs/includes/ace/src/snippets/kotlin.js +++ b/htdocs/includes/ace/src/snippets/kotlin.js @@ -1,10 +1,5 @@ -define("ace/snippets/kotlin",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = ""; - -}); (function() { +; (function() { window.require(["ace/snippets/kotlin"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/latex.js b/htdocs/includes/ace/src/snippets/latex.js index 6afc3775b98..711a30b780f 100644 --- a/htdocs/includes/ace/src/snippets/latex.js +++ b/htdocs/includes/ace/src/snippets/latex.js @@ -1,10 +1,5 @@ -define("ace/snippets/latex",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "latex"; - -}); (function() { +; (function() { window.require(["ace/snippets/latex"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/latte.js b/htdocs/includes/ace/src/snippets/latte.js new file mode 100644 index 00000000000..d5c341ce881 --- /dev/null +++ b/htdocs/includes/ace/src/snippets/latte.js @@ -0,0 +1,9 @@ + +; (function() { + window.require(["ace/snippets/latte"], function(m) { + if (typeof module == "object" && typeof exports == "object" && module) { + module.exports = m; + } + }); + })(); + \ No newline at end of file diff --git a/htdocs/includes/ace/src/snippets/less.js b/htdocs/includes/ace/src/snippets/less.js index a87b47b185c..2b4c6b3b469 100644 --- a/htdocs/includes/ace/src/snippets/less.js +++ b/htdocs/includes/ace/src/snippets/less.js @@ -1,10 +1,5 @@ -define("ace/snippets/less",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "less"; - -}); (function() { +; (function() { window.require(["ace/snippets/less"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/lisp.js b/htdocs/includes/ace/src/snippets/lisp.js index f6c13860ec9..a971e2131e5 100644 --- a/htdocs/includes/ace/src/snippets/lisp.js +++ b/htdocs/includes/ace/src/snippets/lisp.js @@ -1,10 +1,5 @@ -define("ace/snippets/lisp",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "lisp"; - -}); (function() { +; (function() { window.require(["ace/snippets/lisp"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/livescript.js b/htdocs/includes/ace/src/snippets/livescript.js index 08b6cb107d6..ed4b397ac34 100644 --- a/htdocs/includes/ace/src/snippets/livescript.js +++ b/htdocs/includes/ace/src/snippets/livescript.js @@ -1,10 +1,5 @@ -define("ace/snippets/livescript",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "livescript"; - -}); (function() { +; (function() { window.require(["ace/snippets/livescript"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/logiql.js b/htdocs/includes/ace/src/snippets/logiql.js index 073da94b692..d0fea2bdae5 100644 --- a/htdocs/includes/ace/src/snippets/logiql.js +++ b/htdocs/includes/ace/src/snippets/logiql.js @@ -1,10 +1,5 @@ -define("ace/snippets/logiql",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "logiql"; - -}); (function() { +; (function() { window.require(["ace/snippets/logiql"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/logtalk.js b/htdocs/includes/ace/src/snippets/logtalk.js index 4ab4f1f9e8c..4ae82ed92b1 100644 --- a/htdocs/includes/ace/src/snippets/logtalk.js +++ b/htdocs/includes/ace/src/snippets/logtalk.js @@ -1,10 +1,5 @@ -define("ace/snippets/logtalk",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "logtalk"; - -}); (function() { +; (function() { window.require(["ace/snippets/logtalk"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/luapage.js b/htdocs/includes/ace/src/snippets/luapage.js index 8f52b58fc01..db7de782348 100644 --- a/htdocs/includes/ace/src/snippets/luapage.js +++ b/htdocs/includes/ace/src/snippets/luapage.js @@ -1,10 +1,5 @@ -define("ace/snippets/luapage",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "luapage"; - -}); (function() { +; (function() { window.require(["ace/snippets/luapage"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/lucene.js b/htdocs/includes/ace/src/snippets/lucene.js index c61509bea79..bb248e9c4b2 100644 --- a/htdocs/includes/ace/src/snippets/lucene.js +++ b/htdocs/includes/ace/src/snippets/lucene.js @@ -1,10 +1,5 @@ -define("ace/snippets/lucene",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "lucene"; - -}); (function() { +; (function() { window.require(["ace/snippets/lucene"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/mask.js b/htdocs/includes/ace/src/snippets/mask.js index 1b9c0c56dc2..f63c0a61b6d 100644 --- a/htdocs/includes/ace/src/snippets/mask.js +++ b/htdocs/includes/ace/src/snippets/mask.js @@ -1,10 +1,5 @@ -define("ace/snippets/mask",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "mask"; - -}); (function() { +; (function() { window.require(["ace/snippets/mask"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/matlab.js b/htdocs/includes/ace/src/snippets/matlab.js index d8fcd2bd071..cc5fb70e7a5 100644 --- a/htdocs/includes/ace/src/snippets/matlab.js +++ b/htdocs/includes/ace/src/snippets/matlab.js @@ -1,10 +1,5 @@ -define("ace/snippets/matlab",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "matlab"; - -}); (function() { +; (function() { window.require(["ace/snippets/matlab"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/mediawiki.js b/htdocs/includes/ace/src/snippets/mediawiki.js new file mode 100644 index 00000000000..bd73d00064b --- /dev/null +++ b/htdocs/includes/ace/src/snippets/mediawiki.js @@ -0,0 +1,9 @@ + +; (function() { + window.require(["ace/snippets/mediawiki"], function(m) { + if (typeof module == "object" && typeof exports == "object" && module) { + module.exports = m; + } + }); + })(); + \ No newline at end of file diff --git a/htdocs/includes/ace/src/snippets/mel.js b/htdocs/includes/ace/src/snippets/mel.js index 4e43ab1be3f..fa5ecbc8985 100644 --- a/htdocs/includes/ace/src/snippets/mel.js +++ b/htdocs/includes/ace/src/snippets/mel.js @@ -1,10 +1,5 @@ -define("ace/snippets/mel",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "mel"; - -}); (function() { +; (function() { window.require(["ace/snippets/mel"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/mips.js b/htdocs/includes/ace/src/snippets/mips.js new file mode 100644 index 00000000000..9badca8efcf --- /dev/null +++ b/htdocs/includes/ace/src/snippets/mips.js @@ -0,0 +1,9 @@ + +; (function() { + window.require(["ace/snippets/mips"], function(m) { + if (typeof module == "object" && typeof exports == "object" && module) { + module.exports = m; + } + }); + })(); + \ No newline at end of file diff --git a/htdocs/includes/ace/src/snippets/mixal.js b/htdocs/includes/ace/src/snippets/mixal.js index 60b08ea8f52..8246ef784c3 100644 --- a/htdocs/includes/ace/src/snippets/mixal.js +++ b/htdocs/includes/ace/src/snippets/mixal.js @@ -1,10 +1,5 @@ -define("ace/snippets/mixal",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "mixal"; - -}); (function() { +; (function() { window.require(["ace/snippets/mixal"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/mushcode.js b/htdocs/includes/ace/src/snippets/mushcode.js index 1ff99c4abae..8eddd370b3d 100644 --- a/htdocs/includes/ace/src/snippets/mushcode.js +++ b/htdocs/includes/ace/src/snippets/mushcode.js @@ -1,10 +1,5 @@ -define("ace/snippets/mushcode",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "mushcode"; - -}); (function() { +; (function() { window.require(["ace/snippets/mushcode"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/mysql.js b/htdocs/includes/ace/src/snippets/mysql.js index 2791c37f87a..d8544a1b7a8 100644 --- a/htdocs/includes/ace/src/snippets/mysql.js +++ b/htdocs/includes/ace/src/snippets/mysql.js @@ -1,10 +1,5 @@ -define("ace/snippets/mysql",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "mysql"; - -}); (function() { +; (function() { window.require(["ace/snippets/mysql"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/nginx.js b/htdocs/includes/ace/src/snippets/nginx.js index 4305b2cae3e..565e3b8a6ce 100644 --- a/htdocs/includes/ace/src/snippets/nginx.js +++ b/htdocs/includes/ace/src/snippets/nginx.js @@ -1,10 +1,5 @@ -define("ace/snippets/nginx",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "nginx"; - -}); (function() { +; (function() { window.require(["ace/snippets/nginx"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/nim.js b/htdocs/includes/ace/src/snippets/nim.js index f73018ce124..b3b4dfc0489 100644 --- a/htdocs/includes/ace/src/snippets/nim.js +++ b/htdocs/includes/ace/src/snippets/nim.js @@ -1,10 +1,5 @@ -define("ace/snippets/nim",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "nim"; - -}); (function() { +; (function() { window.require(["ace/snippets/nim"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/nix.js b/htdocs/includes/ace/src/snippets/nix.js index c7d9035a6d3..bc63bd3d5ce 100644 --- a/htdocs/includes/ace/src/snippets/nix.js +++ b/htdocs/includes/ace/src/snippets/nix.js @@ -1,10 +1,5 @@ -define("ace/snippets/nix",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "nix"; - -}); (function() { +; (function() { window.require(["ace/snippets/nix"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/nsis.js b/htdocs/includes/ace/src/snippets/nsis.js index 423a1a8b336..caf0839d1af 100644 --- a/htdocs/includes/ace/src/snippets/nsis.js +++ b/htdocs/includes/ace/src/snippets/nsis.js @@ -1,10 +1,5 @@ -define("ace/snippets/nsis",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = ""; - -}); (function() { +; (function() { window.require(["ace/snippets/nsis"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/nunjucks.js b/htdocs/includes/ace/src/snippets/nunjucks.js index 961adec5778..748d2d9ffc4 100644 --- a/htdocs/includes/ace/src/snippets/nunjucks.js +++ b/htdocs/includes/ace/src/snippets/nunjucks.js @@ -1,10 +1,5 @@ -define("ace/snippets/nunjucks",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "nunjucks"; - -}); (function() { +; (function() { window.require(["ace/snippets/nunjucks"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/objectivec.js b/htdocs/includes/ace/src/snippets/objectivec.js index 32816f0b2a1..77bad68f2c2 100644 --- a/htdocs/includes/ace/src/snippets/objectivec.js +++ b/htdocs/includes/ace/src/snippets/objectivec.js @@ -1,10 +1,5 @@ -define("ace/snippets/objectivec",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "objectivec"; - -}); (function() { +; (function() { window.require(["ace/snippets/objectivec"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/ocaml.js b/htdocs/includes/ace/src/snippets/ocaml.js index 2d1f07a0043..23789d1ec6f 100644 --- a/htdocs/includes/ace/src/snippets/ocaml.js +++ b/htdocs/includes/ace/src/snippets/ocaml.js @@ -1,10 +1,5 @@ -define("ace/snippets/ocaml",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "ocaml"; - -}); (function() { +; (function() { window.require(["ace/snippets/ocaml"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/pascal.js b/htdocs/includes/ace/src/snippets/pascal.js index 296a7565525..f6d60d88ec4 100644 --- a/htdocs/includes/ace/src/snippets/pascal.js +++ b/htdocs/includes/ace/src/snippets/pascal.js @@ -1,10 +1,5 @@ -define("ace/snippets/pascal",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "pascal"; - -}); (function() { +; (function() { window.require(["ace/snippets/pascal"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/perl6.js b/htdocs/includes/ace/src/snippets/perl6.js deleted file mode 100644 index 90ecfbe0c82..00000000000 --- a/htdocs/includes/ace/src/snippets/perl6.js +++ /dev/null @@ -1,14 +0,0 @@ -define("ace/snippets/perl6",["require","exports","module"], function(require, exports, module) { -"use strict"; - -exports.snippetText =undefined; -exports.scope = "perl6"; - -}); (function() { - window.require(["ace/snippets/perl6"], function(m) { - if (typeof module == "object" && typeof exports == "object" && module) { - module.exports = m; - } - }); - })(); - \ No newline at end of file diff --git a/htdocs/includes/ace/src/snippets/pgsql.js b/htdocs/includes/ace/src/snippets/pgsql.js index b8b45fb8acb..c15cb260ae6 100644 --- a/htdocs/includes/ace/src/snippets/pgsql.js +++ b/htdocs/includes/ace/src/snippets/pgsql.js @@ -1,10 +1,5 @@ -define("ace/snippets/pgsql",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "pgsql"; - -}); (function() { +; (function() { window.require(["ace/snippets/pgsql"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/php_laravel_blade.js b/htdocs/includes/ace/src/snippets/php_laravel_blade.js index 9a722c9b371..d4790ba2852 100644 --- a/htdocs/includes/ace/src/snippets/php_laravel_blade.js +++ b/htdocs/includes/ace/src/snippets/php_laravel_blade.js @@ -1,10 +1,5 @@ -define("ace/snippets/php_laravel_blade",["require","exports","module"], function(require, exports, module) { - "use strict"; - exports.snippetText =undefined; - exports.scope = "php"; - -}); (function() { +; (function() { window.require(["ace/snippets/php_laravel_blade"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/pig.js b/htdocs/includes/ace/src/snippets/pig.js index 94d46c7cc7f..157d1921126 100644 --- a/htdocs/includes/ace/src/snippets/pig.js +++ b/htdocs/includes/ace/src/snippets/pig.js @@ -1,10 +1,5 @@ -define("ace/snippets/pig",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "pig"; - -}); (function() { +; (function() { window.require(["ace/snippets/pig"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/plain_text.js b/htdocs/includes/ace/src/snippets/plain_text.js index 988880c9c97..92dfce5cd7b 100644 --- a/htdocs/includes/ace/src/snippets/plain_text.js +++ b/htdocs/includes/ace/src/snippets/plain_text.js @@ -1,10 +1,5 @@ -define("ace/snippets/plain_text",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "plain_text"; - -}); (function() { +; (function() { window.require(["ace/snippets/plain_text"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/powershell.js b/htdocs/includes/ace/src/snippets/powershell.js index 4d8388a81ea..0f36eededab 100644 --- a/htdocs/includes/ace/src/snippets/powershell.js +++ b/htdocs/includes/ace/src/snippets/powershell.js @@ -1,10 +1,5 @@ -define("ace/snippets/powershell",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "powershell"; - -}); (function() { +; (function() { window.require(["ace/snippets/powershell"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/praat.js b/htdocs/includes/ace/src/snippets/praat.js index 75fa2e423e5..e4e734fc77b 100644 --- a/htdocs/includes/ace/src/snippets/praat.js +++ b/htdocs/includes/ace/src/snippets/praat.js @@ -1,10 +1,5 @@ -define("ace/snippets/praat",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "praat"; - -}); (function() { +; (function() { window.require(["ace/snippets/praat"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/prisma.js b/htdocs/includes/ace/src/snippets/prisma.js new file mode 100644 index 00000000000..4a9e2b3e3e6 --- /dev/null +++ b/htdocs/includes/ace/src/snippets/prisma.js @@ -0,0 +1,9 @@ + +; (function() { + window.require(["ace/snippets/prisma"], function(m) { + if (typeof module == "object" && typeof exports == "object" && module) { + module.exports = m; + } + }); + })(); + \ No newline at end of file diff --git a/htdocs/includes/ace/src/snippets/prolog.js b/htdocs/includes/ace/src/snippets/prolog.js index 9147ec6dfaf..4c23dac3852 100644 --- a/htdocs/includes/ace/src/snippets/prolog.js +++ b/htdocs/includes/ace/src/snippets/prolog.js @@ -1,10 +1,5 @@ -define("ace/snippets/prolog",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "prolog"; - -}); (function() { +; (function() { window.require(["ace/snippets/prolog"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/properties.js b/htdocs/includes/ace/src/snippets/properties.js index 1ef5ff3e732..36c01dcb83e 100644 --- a/htdocs/includes/ace/src/snippets/properties.js +++ b/htdocs/includes/ace/src/snippets/properties.js @@ -1,10 +1,5 @@ -define("ace/snippets/properties",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "properties"; - -}); (function() { +; (function() { window.require(["ace/snippets/properties"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/protobuf.js b/htdocs/includes/ace/src/snippets/protobuf.js index 98f00415c7e..b169bbfc539 100644 --- a/htdocs/includes/ace/src/snippets/protobuf.js +++ b/htdocs/includes/ace/src/snippets/protobuf.js @@ -1,10 +1,5 @@ -define("ace/snippets/protobuf",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText = ""; -exports.scope = "protobuf"; - -}); (function() { +; (function() { window.require(["ace/snippets/protobuf"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/puppet.js b/htdocs/includes/ace/src/snippets/puppet.js index 5c7b31650a3..52021e3a5a5 100644 --- a/htdocs/includes/ace/src/snippets/puppet.js +++ b/htdocs/includes/ace/src/snippets/puppet.js @@ -1,10 +1,5 @@ -define("ace/snippets/puppet",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "puppet"; - -}); (function() { +; (function() { window.require(["ace/snippets/puppet"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/qml.js b/htdocs/includes/ace/src/snippets/qml.js new file mode 100644 index 00000000000..cb4f66ede73 --- /dev/null +++ b/htdocs/includes/ace/src/snippets/qml.js @@ -0,0 +1,9 @@ + +; (function() { + window.require(["ace/snippets/qml"], function(m) { + if (typeof module == "object" && typeof exports == "object" && module) { + module.exports = m; + } + }); + })(); + \ No newline at end of file diff --git a/htdocs/includes/ace/src/snippets/raku.js b/htdocs/includes/ace/src/snippets/raku.js new file mode 100644 index 00000000000..8beaf95dc05 --- /dev/null +++ b/htdocs/includes/ace/src/snippets/raku.js @@ -0,0 +1,9 @@ + +; (function() { + window.require(["ace/snippets/raku"], function(m) { + if (typeof module == "object" && typeof exports == "object" && module) { + module.exports = m; + } + }); + })(); + \ No newline at end of file diff --git a/htdocs/includes/ace/src/snippets/rdoc.js b/htdocs/includes/ace/src/snippets/rdoc.js index f4dc8927f84..e4845db4c67 100644 --- a/htdocs/includes/ace/src/snippets/rdoc.js +++ b/htdocs/includes/ace/src/snippets/rdoc.js @@ -1,10 +1,5 @@ -define("ace/snippets/rdoc",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "rdoc"; - -}); (function() { +; (function() { window.require(["ace/snippets/rdoc"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/red.js b/htdocs/includes/ace/src/snippets/red.js index 900634e691e..80cbd1b55af 100644 --- a/htdocs/includes/ace/src/snippets/red.js +++ b/htdocs/includes/ace/src/snippets/red.js @@ -1,10 +1,5 @@ -define("ace/snippets/red",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText = " "; -exports.scope = "red"; - -}); (function() { +; (function() { window.require(["ace/snippets/red"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/redshift.js b/htdocs/includes/ace/src/snippets/redshift.js index 088f0febf03..bedd1473317 100644 --- a/htdocs/includes/ace/src/snippets/redshift.js +++ b/htdocs/includes/ace/src/snippets/redshift.js @@ -1,10 +1,5 @@ -define("ace/snippets/redshift",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "redshift"; - -}); (function() { +; (function() { window.require(["ace/snippets/redshift"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/rhtml.js b/htdocs/includes/ace/src/snippets/rhtml.js index e31ed6f8e92..7eb8a5eba86 100644 --- a/htdocs/includes/ace/src/snippets/rhtml.js +++ b/htdocs/includes/ace/src/snippets/rhtml.js @@ -1,10 +1,5 @@ -define("ace/snippets/rhtml",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "rhtml"; - -}); (function() { +; (function() { window.require(["ace/snippets/rhtml"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/rust.js b/htdocs/includes/ace/src/snippets/rust.js index 9ee8633e254..63d42815a5d 100644 --- a/htdocs/includes/ace/src/snippets/rust.js +++ b/htdocs/includes/ace/src/snippets/rust.js @@ -1,10 +1,5 @@ -define("ace/snippets/rust",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "rust"; - -}); (function() { +; (function() { window.require(["ace/snippets/rust"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/sass.js b/htdocs/includes/ace/src/snippets/sass.js index 684485dd0ee..0a4de9b4442 100644 --- a/htdocs/includes/ace/src/snippets/sass.js +++ b/htdocs/includes/ace/src/snippets/sass.js @@ -1,10 +1,5 @@ -define("ace/snippets/sass",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "sass"; - -}); (function() { +; (function() { window.require(["ace/snippets/sass"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/scad.js b/htdocs/includes/ace/src/snippets/scad.js index 4d7eec20085..2fb0826416f 100644 --- a/htdocs/includes/ace/src/snippets/scad.js +++ b/htdocs/includes/ace/src/snippets/scad.js @@ -1,10 +1,5 @@ -define("ace/snippets/scad",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "scad"; - -}); (function() { +; (function() { window.require(["ace/snippets/scad"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/scala.js b/htdocs/includes/ace/src/snippets/scala.js index 03eb329e7a4..adc0abbd496 100644 --- a/htdocs/includes/ace/src/snippets/scala.js +++ b/htdocs/includes/ace/src/snippets/scala.js @@ -1,10 +1,5 @@ -define("ace/snippets/scala",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "scala"; - -}); (function() { +; (function() { window.require(["ace/snippets/scala"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/scheme.js b/htdocs/includes/ace/src/snippets/scheme.js index 0f0906f147f..29c3d357914 100644 --- a/htdocs/includes/ace/src/snippets/scheme.js +++ b/htdocs/includes/ace/src/snippets/scheme.js @@ -1,10 +1,5 @@ -define("ace/snippets/scheme",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "scheme"; - -}); (function() { +; (function() { window.require(["ace/snippets/scheme"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/scrypt.js b/htdocs/includes/ace/src/snippets/scrypt.js new file mode 100644 index 00000000000..2d0601a1046 --- /dev/null +++ b/htdocs/includes/ace/src/snippets/scrypt.js @@ -0,0 +1,9 @@ + +; (function() { + window.require(["ace/snippets/scrypt"], function(m) { + if (typeof module == "object" && typeof exports == "object" && module) { + module.exports = m; + } + }); + })(); + \ No newline at end of file diff --git a/htdocs/includes/ace/src/snippets/scss.js b/htdocs/includes/ace/src/snippets/scss.js index 8e636cea79c..6e808dea9f3 100644 --- a/htdocs/includes/ace/src/snippets/scss.js +++ b/htdocs/includes/ace/src/snippets/scss.js @@ -1,10 +1,5 @@ -define("ace/snippets/scss",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "scss"; - -}); (function() { +; (function() { window.require(["ace/snippets/scss"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/sjs.js b/htdocs/includes/ace/src/snippets/sjs.js index a0756ae154d..bc8c1872023 100644 --- a/htdocs/includes/ace/src/snippets/sjs.js +++ b/htdocs/includes/ace/src/snippets/sjs.js @@ -1,10 +1,5 @@ -define("ace/snippets/sjs",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "sjs"; - -}); (function() { +; (function() { window.require(["ace/snippets/sjs"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/slim.js b/htdocs/includes/ace/src/snippets/slim.js index 7b159a94d6a..2fcd039ac1c 100644 --- a/htdocs/includes/ace/src/snippets/slim.js +++ b/htdocs/includes/ace/src/snippets/slim.js @@ -1,10 +1,5 @@ -define("ace/snippets/slim",["require","exports","module"], function(require, exports, module) { - "use strict"; - exports.snippetText =undefined; - exports.scope = "slim"; - -}); (function() { +; (function() { window.require(["ace/snippets/slim"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/smarty.js b/htdocs/includes/ace/src/snippets/smarty.js index 84c3d8eee1c..3affd2eac6e 100644 --- a/htdocs/includes/ace/src/snippets/smarty.js +++ b/htdocs/includes/ace/src/snippets/smarty.js @@ -1,10 +1,5 @@ -define("ace/snippets/smarty",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "smarty"; - -}); (function() { +; (function() { window.require(["ace/snippets/smarty"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/smithy.js b/htdocs/includes/ace/src/snippets/smithy.js new file mode 100644 index 00000000000..4077f9eeeaa --- /dev/null +++ b/htdocs/includes/ace/src/snippets/smithy.js @@ -0,0 +1,9 @@ + +; (function() { + window.require(["ace/snippets/smithy"], function(m) { + if (typeof module == "object" && typeof exports == "object" && module) { + module.exports = m; + } + }); + })(); + \ No newline at end of file diff --git a/htdocs/includes/ace/src/snippets/soy_template.js b/htdocs/includes/ace/src/snippets/soy_template.js index d087ef1d21a..c7409658633 100644 --- a/htdocs/includes/ace/src/snippets/soy_template.js +++ b/htdocs/includes/ace/src/snippets/soy_template.js @@ -1,10 +1,5 @@ -define("ace/snippets/soy_template",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "soy_template"; - -}); (function() { +; (function() { window.require(["ace/snippets/soy_template"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/space.js b/htdocs/includes/ace/src/snippets/space.js index ae87ec48d82..8f485977088 100644 --- a/htdocs/includes/ace/src/snippets/space.js +++ b/htdocs/includes/ace/src/snippets/space.js @@ -1,10 +1,5 @@ -define("ace/snippets/space",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "space"; - -}); (function() { +; (function() { window.require(["ace/snippets/space"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/sparql.js b/htdocs/includes/ace/src/snippets/sparql.js index e021a74fb94..fe60397edb4 100644 --- a/htdocs/includes/ace/src/snippets/sparql.js +++ b/htdocs/includes/ace/src/snippets/sparql.js @@ -1,10 +1,5 @@ -define("ace/snippets/sparql",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = ""; - -}); (function() { +; (function() { window.require(["ace/snippets/sparql"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/stylus.js b/htdocs/includes/ace/src/snippets/stylus.js index 0172b391622..34f1d714119 100644 --- a/htdocs/includes/ace/src/snippets/stylus.js +++ b/htdocs/includes/ace/src/snippets/stylus.js @@ -1,10 +1,5 @@ -define("ace/snippets/stylus",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "stylus"; - -}); (function() { +; (function() { window.require(["ace/snippets/stylus"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/svg.js b/htdocs/includes/ace/src/snippets/svg.js index 9f63d38fa3b..1aa4a8502e7 100644 --- a/htdocs/includes/ace/src/snippets/svg.js +++ b/htdocs/includes/ace/src/snippets/svg.js @@ -1,10 +1,5 @@ -define("ace/snippets/svg",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "svg"; - -}); (function() { +; (function() { window.require(["ace/snippets/svg"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/swift.js b/htdocs/includes/ace/src/snippets/swift.js index 8b510938dd3..143e32b7acd 100644 --- a/htdocs/includes/ace/src/snippets/swift.js +++ b/htdocs/includes/ace/src/snippets/swift.js @@ -1,10 +1,5 @@ -define("ace/snippets/swift",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "swift"; - -}); (function() { +; (function() { window.require(["ace/snippets/swift"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/terraform.js b/htdocs/includes/ace/src/snippets/terraform.js index 7e0593733b5..c9d8d31d601 100644 --- a/htdocs/includes/ace/src/snippets/terraform.js +++ b/htdocs/includes/ace/src/snippets/terraform.js @@ -1,10 +1,5 @@ -define("ace/snippets/terraform",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "terraform"; - -}); (function() { +; (function() { window.require(["ace/snippets/terraform"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/text.js b/htdocs/includes/ace/src/snippets/text.js index 949bb2a72dd..85b4d10e5f7 100644 --- a/htdocs/includes/ace/src/snippets/text.js +++ b/htdocs/includes/ace/src/snippets/text.js @@ -1,10 +1,5 @@ -define("ace/snippets/text",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "text"; - -}); (function() { +; (function() { window.require(["ace/snippets/text"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/toml.js b/htdocs/includes/ace/src/snippets/toml.js index 4f0c1fa463f..e585672c285 100644 --- a/htdocs/includes/ace/src/snippets/toml.js +++ b/htdocs/includes/ace/src/snippets/toml.js @@ -1,10 +1,5 @@ -define("ace/snippets/toml",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "toml"; - -}); (function() { +; (function() { window.require(["ace/snippets/toml"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/tsx.js b/htdocs/includes/ace/src/snippets/tsx.js index fd1bba27203..f0456fdd9a1 100644 --- a/htdocs/includes/ace/src/snippets/tsx.js +++ b/htdocs/includes/ace/src/snippets/tsx.js @@ -1,10 +1,5 @@ -define("ace/snippets/tsx",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "tsx"; - -}); (function() { +; (function() { window.require(["ace/snippets/tsx"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/turtle.js b/htdocs/includes/ace/src/snippets/turtle.js index c6bc21bfa50..7e0a30cec5b 100644 --- a/htdocs/includes/ace/src/snippets/turtle.js +++ b/htdocs/includes/ace/src/snippets/turtle.js @@ -1,10 +1,5 @@ -define("ace/snippets/turtle",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = ""; - -}); (function() { +; (function() { window.require(["ace/snippets/turtle"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/twig.js b/htdocs/includes/ace/src/snippets/twig.js index fe757895eb6..2cec7aaa7ff 100644 --- a/htdocs/includes/ace/src/snippets/twig.js +++ b/htdocs/includes/ace/src/snippets/twig.js @@ -1,10 +1,5 @@ -define("ace/snippets/twig",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "twig"; - -}); (function() { +; (function() { window.require(["ace/snippets/twig"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/typescript.js b/htdocs/includes/ace/src/snippets/typescript.js index 2da2fb807fa..27dc42bf129 100644 --- a/htdocs/includes/ace/src/snippets/typescript.js +++ b/htdocs/includes/ace/src/snippets/typescript.js @@ -1,10 +1,5 @@ -define("ace/snippets/typescript",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "typescript"; - -}); (function() { +; (function() { window.require(["ace/snippets/typescript"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/vbscript.js b/htdocs/includes/ace/src/snippets/vbscript.js index 0989a0810c9..637e51913ff 100644 --- a/htdocs/includes/ace/src/snippets/vbscript.js +++ b/htdocs/includes/ace/src/snippets/vbscript.js @@ -1,10 +1,5 @@ -define("ace/snippets/vbscript",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "vbscript"; - -}); (function() { +; (function() { window.require(["ace/snippets/vbscript"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/verilog.js b/htdocs/includes/ace/src/snippets/verilog.js index 2ed2eef0e45..d824e8463ef 100644 --- a/htdocs/includes/ace/src/snippets/verilog.js +++ b/htdocs/includes/ace/src/snippets/verilog.js @@ -1,10 +1,5 @@ -define("ace/snippets/verilog",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "verilog"; - -}); (function() { +; (function() { window.require(["ace/snippets/verilog"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/vhdl.js b/htdocs/includes/ace/src/snippets/vhdl.js index d9b716461be..015c2fbf371 100644 --- a/htdocs/includes/ace/src/snippets/vhdl.js +++ b/htdocs/includes/ace/src/snippets/vhdl.js @@ -1,10 +1,5 @@ -define("ace/snippets/vhdl",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "vhdl"; - -}); (function() { +; (function() { window.require(["ace/snippets/vhdl"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/visualforce.js b/htdocs/includes/ace/src/snippets/visualforce.js index 11c0781cef2..135cf6bdea8 100644 --- a/htdocs/includes/ace/src/snippets/visualforce.js +++ b/htdocs/includes/ace/src/snippets/visualforce.js @@ -1,10 +1,5 @@ -define("ace/snippets/visualforce",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "visualforce"; - -}); (function() { +; (function() { window.require(["ace/snippets/visualforce"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/xml.js b/htdocs/includes/ace/src/snippets/xml.js index 9bbe62ad7b6..927c6659786 100644 --- a/htdocs/includes/ace/src/snippets/xml.js +++ b/htdocs/includes/ace/src/snippets/xml.js @@ -1,10 +1,5 @@ -define("ace/snippets/xml",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "xml"; - -}); (function() { +; (function() { window.require(["ace/snippets/xml"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/yaml.js b/htdocs/includes/ace/src/snippets/yaml.js index bbfecbc21da..13a274dc84c 100644 --- a/htdocs/includes/ace/src/snippets/yaml.js +++ b/htdocs/includes/ace/src/snippets/yaml.js @@ -1,10 +1,5 @@ -define("ace/snippets/yaml",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "yaml"; - -}); (function() { +; (function() { window.require(["ace/snippets/yaml"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/zeek.js b/htdocs/includes/ace/src/snippets/zeek.js index e432c22e116..a1fc7cdff3c 100644 --- a/htdocs/includes/ace/src/snippets/zeek.js +++ b/htdocs/includes/ace/src/snippets/zeek.js @@ -1,10 +1,5 @@ -define("ace/snippets/zeek",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = ""; - -}); (function() { +; (function() { window.require(["ace/snippets/zeek"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/theme-ambiance.js b/htdocs/includes/ace/src/theme-ambiance.js index bac9b4d6339..0830aed50b4 100644 --- a/htdocs/includes/ace/src/theme-ambiance.js +++ b/htdocs/includes/ace/src/theme-ambiance.js @@ -25,7 +25,7 @@ color: #777;\ .ace-ambiance .ace_fold-widget.ace_start,\ .ace-ambiance .ace_fold-widget.ace_end,\ .ace-ambiance .ace_fold-widget.ace_closed{\ -background: none;\ +background: none !important;\ border: none;\ box-shadow: none;\ }\ @@ -169,10 +169,11 @@ background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICA }\ .ace-ambiance .ace_indent-guide {\ background: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWNQUFD4z6Crq/sfAAuYAuYl+7lfAAAAAElFTkSuQmCC\") right repeat-y;\ -}"; +}\ +"; var dom = require("../lib/dom"); -dom.importCssString(exports.cssText, exports.cssClass); +dom.importCssString(exports.cssText, exports.cssClass, false); }); (function() { window.require(["ace/theme/ambiance"], function(m) { diff --git a/htdocs/includes/ace/src/theme-chaos.js b/htdocs/includes/ace/src/theme-chaos.js index 1a46b5b1d02..630a72f72ce 100644 --- a/htdocs/includes/ace/src/theme-chaos.js +++ b/htdocs/includes/ace/src/theme-chaos.js @@ -121,7 +121,7 @@ color: #777;\ .ace-chaos .ace_fold-widget.ace_start,\ .ace-chaos .ace_fold-widget.ace_end,\ .ace-chaos .ace_fold-widget.ace_closed{\ -background: none;\ +background: none !important;\ border: none;\ box-shadow: none;\ }\ @@ -151,7 +151,7 @@ color: #000;\ "; var dom = require("../lib/dom"); -dom.importCssString(exports.cssText, exports.cssClass); +dom.importCssString(exports.cssText, exports.cssClass, false); }); (function() { window.require(["ace/theme/chaos"], function(m) { diff --git a/htdocs/includes/ace/src/theme-chrome.js b/htdocs/includes/ace/src/theme-chrome.js index e55118cb13d..9fa527e4a3f 100644 --- a/htdocs/includes/ace/src/theme-chrome.js +++ b/htdocs/includes/ace/src/theme-chrome.js @@ -124,7 +124,7 @@ background: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZ "; var dom = require("../lib/dom"); -dom.importCssString(exports.cssText, exports.cssClass); +dom.importCssString(exports.cssText, exports.cssClass, false); }); (function() { window.require(["ace/theme/chrome"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { diff --git a/htdocs/includes/ace/src/theme-clouds.js b/htdocs/includes/ace/src/theme-clouds.js index 01e6cc0b172..2673f62f815 100644 --- a/htdocs/includes/ace/src/theme-clouds.js +++ b/htdocs/includes/ace/src/theme-clouds.js @@ -91,7 +91,7 @@ background: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZ }"; var dom = require("../lib/dom"); -dom.importCssString(exports.cssText, exports.cssClass); +dom.importCssString(exports.cssText, exports.cssClass, false); }); (function() { window.require(["ace/theme/clouds"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { diff --git a/htdocs/includes/ace/src/theme-clouds_midnight.js b/htdocs/includes/ace/src/theme-clouds_midnight.js index 60f0f654365..d88ece21d43 100644 --- a/htdocs/includes/ace/src/theme-clouds_midnight.js +++ b/htdocs/includes/ace/src/theme-clouds_midnight.js @@ -92,7 +92,7 @@ background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgb }"; var dom = require("../lib/dom"); -dom.importCssString(exports.cssText, exports.cssClass); +dom.importCssString(exports.cssText, exports.cssClass, false); }); (function() { window.require(["ace/theme/clouds_midnight"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { diff --git a/htdocs/includes/ace/src/theme-cobalt.js b/htdocs/includes/ace/src/theme-cobalt.js index 74f20385609..5459c756153 100644 --- a/htdocs/includes/ace/src/theme-cobalt.js +++ b/htdocs/includes/ace/src/theme-cobalt.js @@ -109,7 +109,7 @@ background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgb "; var dom = require("../lib/dom"); -dom.importCssString(exports.cssText, exports.cssClass); +dom.importCssString(exports.cssText, exports.cssClass, false); }); (function() { window.require(["ace/theme/cobalt"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { diff --git a/htdocs/includes/ace/src/theme-crimson_editor.js b/htdocs/includes/ace/src/theme-crimson_editor.js index 88d70538c49..b162e5be5a3 100644 --- a/htdocs/includes/ace/src/theme-crimson_editor.js +++ b/htdocs/includes/ace/src/theme-crimson_editor.js @@ -114,7 +114,7 @@ background: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZ exports.cssClass = "ace-crimson-editor"; var dom = require("../lib/dom"); -dom.importCssString(exports.cssText, exports.cssClass); +dom.importCssString(exports.cssText, exports.cssClass, false); }); (function() { window.require(["ace/theme/crimson_editor"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { diff --git a/htdocs/includes/ace/src/theme-dawn.js b/htdocs/includes/ace/src/theme-dawn.js index 8a635b3ddff..923dad68d5f 100644 --- a/htdocs/includes/ace/src/theme-dawn.js +++ b/htdocs/includes/ace/src/theme-dawn.js @@ -104,7 +104,7 @@ background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgb }"; var dom = require("../lib/dom"); -dom.importCssString(exports.cssText, exports.cssClass); +dom.importCssString(exports.cssText, exports.cssClass, false); }); (function() { window.require(["ace/theme/dawn"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { diff --git a/htdocs/includes/ace/src/theme-dracula.js b/htdocs/includes/ace/src/theme-dracula.js index 78942e2867b..3085b9d9693 100644 --- a/htdocs/includes/ace/src/theme-dracula.js +++ b/htdocs/includes/ace/src/theme-dracula.js @@ -124,7 +124,7 @@ background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgb exports.$selectionColorConflict = true; var dom = require("../lib/dom"); -dom.importCssString(exports.cssText, exports.cssClass); +dom.importCssString(exports.cssText, exports.cssClass, false); }); (function() { window.require(["ace/theme/dracula"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { diff --git a/htdocs/includes/ace/src/theme-dreamweaver.js b/htdocs/includes/ace/src/theme-dreamweaver.js index 26abc55bf93..fa9771e9233 100644 --- a/htdocs/includes/ace/src/theme-dreamweaver.js +++ b/htdocs/includes/ace/src/theme-dreamweaver.js @@ -137,7 +137,7 @@ background: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZ }"; var dom = require("../lib/dom"); -dom.importCssString(exports.cssText, exports.cssClass); +dom.importCssString(exports.cssText, exports.cssClass, false); }); (function() { window.require(["ace/theme/dreamweaver"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { diff --git a/htdocs/includes/ace/src/theme-eclipse.js b/htdocs/includes/ace/src/theme-eclipse.js index 31057e66f0f..5deddde3f19 100644 --- a/htdocs/includes/ace/src/theme-eclipse.js +++ b/htdocs/includes/ace/src/theme-eclipse.js @@ -94,7 +94,7 @@ background: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZ exports.cssClass = "ace-eclipse"; var dom = require("../lib/dom"); -dom.importCssString(exports.cssText, exports.cssClass); +dom.importCssString(exports.cssText, exports.cssClass, false); }); (function() { window.require(["ace/theme/eclipse"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { diff --git a/htdocs/includes/ace/src/theme-github.js b/htdocs/includes/ace/src/theme-github.js index 7f6baf4acd2..12d70bc7746 100644 --- a/htdocs/includes/ace/src/theme-github.js +++ b/htdocs/includes/ace/src/theme-github.js @@ -99,7 +99,7 @@ background: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZ }"; var dom = require("../lib/dom"); - dom.importCssString(exports.cssText, exports.cssClass); + dom.importCssString(exports.cssText, exports.cssClass, false); }); (function() { window.require(["ace/theme/github"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { diff --git a/htdocs/includes/ace/src/theme-gob.js b/htdocs/includes/ace/src/theme-gob.js index 9c03e7bd055..7326db1ec07 100644 --- a/htdocs/includes/ace/src/theme-gob.js +++ b/htdocs/includes/ace/src/theme-gob.js @@ -108,7 +108,7 @@ background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgb "; var dom = require("../lib/dom"); -dom.importCssString(exports.cssText, exports.cssClass); +dom.importCssString(exports.cssText, exports.cssClass, false); }); (function() { window.require(["ace/theme/gob"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { diff --git a/htdocs/includes/ace/src/theme-gruvbox.js b/htdocs/includes/ace/src/theme-gruvbox.js index d2e6ded6b27..c52e8f0fca8 100644 --- a/htdocs/includes/ace/src/theme-gruvbox.js +++ b/htdocs/includes/ace/src/theme-gruvbox.js @@ -77,7 +77,7 @@ background: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZ }"; var dom = require("../lib/dom"); -dom.importCssString(exports.cssText, exports.cssClass); +dom.importCssString(exports.cssText, exports.cssClass, false); }); (function() { window.require(["ace/theme/gruvbox"], function(m) { diff --git a/htdocs/includes/ace/src/theme-idle_fingers.js b/htdocs/includes/ace/src/theme-idle_fingers.js index 877b884dc3c..1af5e27a28b 100644 --- a/htdocs/includes/ace/src/theme-idle_fingers.js +++ b/htdocs/includes/ace/src/theme-idle_fingers.js @@ -92,7 +92,7 @@ background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgb }"; var dom = require("../lib/dom"); -dom.importCssString(exports.cssText, exports.cssClass); +dom.importCssString(exports.cssText, exports.cssClass, false); }); (function() { window.require(["ace/theme/idle_fingers"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { diff --git a/htdocs/includes/ace/src/theme-iplastic.js b/htdocs/includes/ace/src/theme-iplastic.js index d09b09f2b42..6eaf7abe3c7 100644 --- a/htdocs/includes/ace/src/theme-iplastic.js +++ b/htdocs/includes/ace/src/theme-iplastic.js @@ -117,7 +117,7 @@ background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgb }"; var dom = require("../lib/dom"); -dom.importCssString(exports.cssText, exports.cssClass); +dom.importCssString(exports.cssText, exports.cssClass, false); }); (function() { window.require(["ace/theme/iplastic"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { diff --git a/htdocs/includes/ace/src/theme-katzenmilch.js b/htdocs/includes/ace/src/theme-katzenmilch.js index 45dd629a12b..596d9702050 100644 --- a/htdocs/includes/ace/src/theme-katzenmilch.js +++ b/htdocs/includes/ace/src/theme-katzenmilch.js @@ -117,7 +117,7 @@ rbackground-color: rgba(73, 166, 210, 0.039)\ }"; var dom = require("../lib/dom"); -dom.importCssString(exports.cssText, exports.cssClass); +dom.importCssString(exports.cssText, exports.cssClass, false); }); (function() { window.require(["ace/theme/katzenmilch"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { diff --git a/htdocs/includes/ace/src/theme-kr_theme.js b/htdocs/includes/ace/src/theme-kr_theme.js index bb32770a2a4..1509c0b1ead 100644 --- a/htdocs/includes/ace/src/theme-kr_theme.js +++ b/htdocs/includes/ace/src/theme-kr_theme.js @@ -100,7 +100,7 @@ background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgb }"; var dom = require("../lib/dom"); -dom.importCssString(exports.cssText, exports.cssClass); +dom.importCssString(exports.cssText, exports.cssClass, false); }); (function() { window.require(["ace/theme/kr_theme"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { diff --git a/htdocs/includes/ace/src/theme-kuroir.js b/htdocs/includes/ace/src/theme-kuroir.js index 6d12d2c71c0..85af8e85ba9 100644 --- a/htdocs/includes/ace/src/theme-kuroir.js +++ b/htdocs/includes/ace/src/theme-kuroir.js @@ -57,7 +57,7 @@ background-color:rgba(191, 97, 51, 0.051);}.ace-kuroir .ace_markup.ace_list{colo "; var dom = require("../lib/dom"); -dom.importCssString(exports.cssText, exports.cssClass); +dom.importCssString(exports.cssText, exports.cssClass, false); }); (function() { window.require(["ace/theme/kuroir"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { diff --git a/htdocs/includes/ace/src/theme-merbivore.js b/htdocs/includes/ace/src/theme-merbivore.js index 636fbe44d43..e638fb1c6e7 100644 --- a/htdocs/includes/ace/src/theme-merbivore.js +++ b/htdocs/includes/ace/src/theme-merbivore.js @@ -91,7 +91,7 @@ background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgb }"; var dom = require("../lib/dom"); -dom.importCssString(exports.cssText, exports.cssClass); +dom.importCssString(exports.cssText, exports.cssClass, false); }); (function() { window.require(["ace/theme/merbivore"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { diff --git a/htdocs/includes/ace/src/theme-merbivore_soft.js b/htdocs/includes/ace/src/theme-merbivore_soft.js index 4ce881ae5a7..d79865b0f66 100644 --- a/htdocs/includes/ace/src/theme-merbivore_soft.js +++ b/htdocs/includes/ace/src/theme-merbivore_soft.js @@ -92,7 +92,7 @@ background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgb }"; var dom = require("../lib/dom"); -dom.importCssString(exports.cssText, exports.cssClass); +dom.importCssString(exports.cssText, exports.cssClass, false); }); (function() { window.require(["ace/theme/merbivore_soft"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { diff --git a/htdocs/includes/ace/src/theme-mono_industrial.js b/htdocs/includes/ace/src/theme-mono_industrial.js index 6a00097b0d2..0bd57662e85 100644 --- a/htdocs/includes/ace/src/theme-mono_industrial.js +++ b/htdocs/includes/ace/src/theme-mono_industrial.js @@ -103,7 +103,7 @@ background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgb }"; var dom = require("../lib/dom"); -dom.importCssString(exports.cssText, exports.cssClass); +dom.importCssString(exports.cssText, exports.cssClass, false); }); (function() { window.require(["ace/theme/mono_industrial"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { diff --git a/htdocs/includes/ace/src/theme-monokai.js b/htdocs/includes/ace/src/theme-monokai.js index ce64226bda5..7eed6b445d9 100644 --- a/htdocs/includes/ace/src/theme-monokai.js +++ b/htdocs/includes/ace/src/theme-monokai.js @@ -101,7 +101,7 @@ background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgb }"; var dom = require("../lib/dom"); -dom.importCssString(exports.cssText, exports.cssClass); +dom.importCssString(exports.cssText, exports.cssClass, false); }); (function() { window.require(["ace/theme/monokai"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { diff --git a/htdocs/includes/ace/src/theme-nord_dark.js b/htdocs/includes/ace/src/theme-nord_dark.js new file mode 100644 index 00000000000..c97f58317ad --- /dev/null +++ b/htdocs/includes/ace/src/theme-nord_dark.js @@ -0,0 +1,102 @@ +define("ace/theme/nord_dark",["require","exports","module","ace/lib/dom"], function(require, exports, module) { + +exports.isDark = true; +exports.cssClass = "ace-nord-dark"; +exports.cssText = ".ace-nord-dark .ace_gutter {\ +color: #616e88;\ +}\ +.ace-nord-dark .ace_print-margin {\ +width: 1px;\ +background: #4c566a;\ +}\ +.ace-nord-dark {\ +background-color: #2e3440;\ +color: #d8dee9;\ +}\ +.ace-nord-dark .ace_entity.ace_other.ace_attribute-name,\ +.ace-nord-dark .ace_storage {\ +color: #d8dee9;\ +}\ +.ace-nord-dark .ace_cursor {\ +color: #d8dee9;\ +},\ +.ace-nord-dark .ace_string.ace_regexp {\ +color: #bf616a;\ +}\ +.ace-nord-dark .ace_marker-layer .ace_active-line {\ +background: #434c5ecc;\ +}\ +.ace-nord-dark .ace_marker-layer .ace_selection {\ +background: #434c5ecc;\ +}\ +.ace-nord-dark.ace_multiselect .ace_selection.ace_start {\ +box-shadow: 0 0 3px 0px #2e3440;\ +}\ +.ace-nord-dark .ace_marker-layer .ace_step {\ +background: #ebcb8b;\ +}\ +.ace-nord-dark .ace_marker-layer .ace_bracket {\ +margin: -1px 0 0 -1px;\ +border: 1px solid #88c0d066;\ +}\ +.ace-nord-dark .ace_gutter-active-line {\ +background-color: #434c5ecc;\ +}\ +.ace-nord-dark .ace_marker-layer .ace_selected-word {\ +border: 1px solid #88c0d066;\ +}\ +.ace-nord-dark .ace_invisible {\ +color: #4c566a;\ +}\ +.ace-nord-dark .ace_keyword,\ +.ace-nord-dark .ace_meta,\ +.ace-nord-dark .ace_support.ace_class,\ +.ace-nord-dark .ace_support.ace_type {\ +color: #81a1c1;\ +}\ +.ace-nord-dark .ace_constant.ace_character,\ +.ace-nord-dark .ace_constant.ace_other {\ +color: #d8dee9;\ +}\ +.ace-nord-dark .ace_constant.ace_language {\ +color: #5e81ac;\ +}\ +.ace-nord-dark .ace_constant.ace_escape {\ +color: #ebcB8b;\ +}\ +.ace-nord-dark .ace_constant.ace_numeric {\ +color: #b48ead;\ +}\ +.ace-nord-dark .ace_fold {\ +background-color: #4c566a;\ +border-color: #d8dee9;\ +}\ +.ace-nord-dark .ace_entity.ace_name.ace_function,\ +.ace-nord-dark .ace_entity.ace_name.ace_tag,\ +.ace-nord-dark .ace_support.ace_function,\ +.ace-nord-dark .ace_variable,\ +.ace-nord-dark .ace_variable.ace_language {\ +color: #8fbcbb;\ +}\ +.ace-nord-dark .ace_string {\ +color: #a3be8c;\ +}\ +.ace-nord-dark .ace_comment {\ +color: #616e88;\ +}\ +.ace-nord-dark .ace_indent-guide {\ +box-shadow: inset -1px 0 0 0 #434c5eb3;\ +}\ +"; +exports.$selectionColorConflict = true; + +var dom = require("../lib/dom"); +dom.importCssString(exports.cssText, exports.cssClass, false); +}); (function() { + window.require(["ace/theme/nord_dark"], function(m) { + if (typeof module == "object" && typeof exports == "object" && module) { + module.exports = m; + } + }); + })(); + \ No newline at end of file diff --git a/htdocs/includes/ace/src/theme-one_dark.js b/htdocs/includes/ace/src/theme-one_dark.js new file mode 100644 index 00000000000..b99f2287b92 --- /dev/null +++ b/htdocs/includes/ace/src/theme-one_dark.js @@ -0,0 +1,139 @@ +define("ace/theme/one_dark",["require","exports","module","ace/lib/dom"], function(require, exports, module) { + + exports.isDark = true; + exports.cssClass = "ace-one-dark"; + exports.cssText = ".ace-one-dark .ace_gutter {\ +background: #282c34;\ +color: #6a6f7a\ +}\ +.ace-one-dark .ace_print-margin {\ +width: 1px;\ +background: #e8e8e8\ +}\ +.ace-one-dark {\ +background-color: #282c34;\ +color: #abb2bf\ +}\ +.ace-one-dark .ace_cursor {\ +color: #528bff\ +}\ +.ace-one-dark .ace_marker-layer .ace_selection {\ +background: #3d4350\ +}\ +.ace-one-dark.ace_multiselect .ace_selection.ace_start {\ +box-shadow: 0 0 3px 0 #282c34;\ +border-radius: 2px\ +}\ +.ace-one-dark .ace_marker-layer .ace_step {\ +background: #c6dbae\ +}\ +.ace-one-dark .ace_marker-layer .ace_bracket {\ +margin: -1px 0 0 -1px;\ +border: 1px solid #747369\ +}\ +.ace-one-dark .ace_marker-layer .ace_active-line {\ +background: rgba(76, 87, 103, .19)\ +}\ +.ace-one-dark .ace_gutter-active-line {\ +background-color: rgba(76, 87, 103, .19)\ +}\ +.ace-one-dark .ace_marker-layer .ace_selected-word {\ +border: 1px solid #3d4350\ +}\ +.ace-one-dark .ace_fold {\ +background-color: #61afef;\ +border-color: #abb2bf\ +}\ +.ace-one-dark .ace_keyword {\ +color: #c678dd\ +}\ +.ace-one-dark .ace_keyword.ace_operator {\ +color: #c678dd\ +}\ +.ace-one-dark .ace_keyword.ace_other.ace_unit {\ +color: #d19a66\ +}\ +.ace-one-dark .ace_constant.ace_language {\ +color: #d19a66\ +}\ +.ace-one-dark .ace_constant.ace_numeric {\ +color: #d19a66\ +}\ +.ace-one-dark .ace_constant.ace_character {\ +color: #56b6c2\ +}\ +.ace-one-dark .ace_constant.ace_other {\ +color: #56b6c2\ +}\ +.ace-one-dark .ace_support.ace_function {\ +color: #61afef\ +}\ +.ace-one-dark .ace_support.ace_constant {\ +color: #d19a66\ +}\ +.ace-one-dark .ace_support.ace_class {\ +color: #e5c07b\ +}\ +.ace-one-dark .ace_support.ace_type {\ +color: #e5c07b\ +}\ +.ace-one-dark .ace_storage {\ +color: #c678dd\ +}\ +.ace-one-dark .ace_storage.ace_type {\ +color: #c678dd\ +}\ +.ace-one-dark .ace_invalid {\ +color: #fff;\ +background-color: #f2777a\ +}\ +.ace-one-dark .ace_invalid.ace_deprecated {\ +color: #272b33;\ +background-color: #d27b53\ +}\ +.ace-one-dark .ace_string {\ +color: #98c379\ +}\ +.ace-one-dark .ace_string.ace_regexp {\ +color: #e06c75\ +}\ +.ace-one-dark .ace_comment {\ +font-style: italic;\ +color: #5c6370\ +}\ +.ace-one-dark .ace_variable {\ +color: #e06c75\ +}\ +.ace-one-dark .ace_variable.ace_parameter {\ +color: #d19a66\ +}\ +.ace-one-dark .ace_meta.ace_tag {\ +color: #e06c75\ +}\ +.ace-one-dark .ace_entity.ace_other.ace_attribute-name {\ +color: #e06c75\ +}\ +.ace-one-dark .ace_entity.ace_name.ace_function {\ +color: #61afef\ +}\ +.ace-one-dark .ace_entity.ace_name.ace_tag {\ +color: #e06c75\ +}\ +.ace-one-dark .ace_markup.ace_heading {\ +color: #98c379\ +}\ +.ace-one-dark .ace_indent-guide {\ +background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWPQ09NrYAgMjP4PAAtGAwchHMyAAAAAAElFTkSuQmCC) right repeat-y\ +}\ +"; + + var dom = require("../lib/dom"); + dom.importCssString(exports.cssText, exports.cssClass, false); + }); (function() { + window.require(["ace/theme/one_dark"], function(m) { + if (typeof module == "object" && typeof exports == "object" && module) { + module.exports = m; + } + }); + })(); + \ No newline at end of file diff --git a/htdocs/includes/ace/src/theme-pastel_on_dark.js b/htdocs/includes/ace/src/theme-pastel_on_dark.js index e02957c99b8..cc51053dc43 100644 --- a/htdocs/includes/ace/src/theme-pastel_on_dark.js +++ b/htdocs/includes/ace/src/theme-pastel_on_dark.js @@ -104,7 +104,7 @@ background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgb }"; var dom = require("../lib/dom"); -dom.importCssString(exports.cssText, exports.cssClass); +dom.importCssString(exports.cssText, exports.cssClass, false); }); (function() { window.require(["ace/theme/pastel_on_dark"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { diff --git a/htdocs/includes/ace/src/theme-solarized_dark.js b/htdocs/includes/ace/src/theme-solarized_dark.js index dad8d3896b9..e9a2664d166 100644 --- a/htdocs/includes/ace/src/theme-solarized_dark.js +++ b/htdocs/includes/ace/src/theme-solarized_dark.js @@ -84,7 +84,7 @@ background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgb }"; var dom = require("../lib/dom"); -dom.importCssString(exports.cssText, exports.cssClass); +dom.importCssString(exports.cssText, exports.cssClass, false); }); (function() { window.require(["ace/theme/solarized_dark"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { diff --git a/htdocs/includes/ace/src/theme-solarized_light.js b/htdocs/includes/ace/src/theme-solarized_light.js index 70f9383041c..2746ea63c78 100644 --- a/htdocs/includes/ace/src/theme-solarized_light.js +++ b/htdocs/includes/ace/src/theme-solarized_light.js @@ -87,7 +87,7 @@ background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgb }"; var dom = require("../lib/dom"); -dom.importCssString(exports.cssText, exports.cssClass); +dom.importCssString(exports.cssText, exports.cssClass, false); }); (function() { window.require(["ace/theme/solarized_light"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { diff --git a/htdocs/includes/ace/src/theme-sqlserver.js b/htdocs/includes/ace/src/theme-sqlserver.js index 91724014b01..1b626a28fcf 100644 --- a/htdocs/includes/ace/src/theme-sqlserver.js +++ b/htdocs/includes/ace/src/theme-sqlserver.js @@ -134,7 +134,7 @@ background: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZ "; var dom = require("../lib/dom"); -dom.importCssString(exports.cssText, exports.cssClass); +dom.importCssString(exports.cssText, exports.cssClass, false); }); (function() { window.require(["ace/theme/sqlserver"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { diff --git a/htdocs/includes/ace/src/theme-terminal.js b/htdocs/includes/ace/src/theme-terminal.js index 8f87077cae7..b10de0bd323 100644 --- a/htdocs/includes/ace/src/theme-terminal.js +++ b/htdocs/includes/ace/src/theme-terminal.js @@ -110,7 +110,7 @@ background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgb "; var dom = require("../lib/dom"); -dom.importCssString(exports.cssText, exports.cssClass); +dom.importCssString(exports.cssText, exports.cssClass, false); }); (function() { window.require(["ace/theme/terminal"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { diff --git a/htdocs/includes/ace/src/theme-textmate.js b/htdocs/includes/ace/src/theme-textmate.js index 6ad09556895..dc651d74b73 100644 --- a/htdocs/includes/ace/src/theme-textmate.js +++ b/htdocs/includes/ace/src/theme-textmate.js @@ -126,7 +126,7 @@ background: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZ exports.$id = "ace/theme/textmate"; var dom = require("../lib/dom"); -dom.importCssString(exports.cssText, exports.cssClass); +dom.importCssString(exports.cssText, exports.cssClass, false); }); (function() { window.require(["ace/theme/textmate"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { diff --git a/htdocs/includes/ace/src/theme-tomorrow.js b/htdocs/includes/ace/src/theme-tomorrow.js index 5a2e3b5a4f2..b1f73da83b6 100644 --- a/htdocs/includes/ace/src/theme-tomorrow.js +++ b/htdocs/includes/ace/src/theme-tomorrow.js @@ -104,7 +104,7 @@ background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgb }"; var dom = require("../lib/dom"); -dom.importCssString(exports.cssText, exports.cssClass); +dom.importCssString(exports.cssText, exports.cssClass, false); }); (function() { window.require(["ace/theme/tomorrow"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { diff --git a/htdocs/includes/ace/src/theme-tomorrow_night.js b/htdocs/includes/ace/src/theme-tomorrow_night.js index 9cdeedce37b..36c748fd64b 100644 --- a/htdocs/includes/ace/src/theme-tomorrow_night.js +++ b/htdocs/includes/ace/src/theme-tomorrow_night.js @@ -104,7 +104,7 @@ background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgb }"; var dom = require("../lib/dom"); -dom.importCssString(exports.cssText, exports.cssClass); +dom.importCssString(exports.cssText, exports.cssClass, false); }); (function() { window.require(["ace/theme/tomorrow_night"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { diff --git a/htdocs/includes/ace/src/theme-tomorrow_night_blue.js b/htdocs/includes/ace/src/theme-tomorrow_night_blue.js index 52afc918d78..7bf7fc64680 100644 --- a/htdocs/includes/ace/src/theme-tomorrow_night_blue.js +++ b/htdocs/includes/ace/src/theme-tomorrow_night_blue.js @@ -102,7 +102,7 @@ background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgb }"; var dom = require("../lib/dom"); -dom.importCssString(exports.cssText, exports.cssClass); +dom.importCssString(exports.cssText, exports.cssClass, false); }); (function() { window.require(["ace/theme/tomorrow_night_blue"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { diff --git a/htdocs/includes/ace/src/theme-tomorrow_night_bright.js b/htdocs/includes/ace/src/theme-tomorrow_night_bright.js index b90c17921a4..3bf12ddd420 100644 --- a/htdocs/includes/ace/src/theme-tomorrow_night_bright.js +++ b/htdocs/includes/ace/src/theme-tomorrow_night_bright.js @@ -117,7 +117,7 @@ background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgb }"; var dom = require("../lib/dom"); -dom.importCssString(exports.cssText, exports.cssClass); +dom.importCssString(exports.cssText, exports.cssClass, false); }); (function() { window.require(["ace/theme/tomorrow_night_bright"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { diff --git a/htdocs/includes/ace/src/theme-tomorrow_night_eighties.js b/htdocs/includes/ace/src/theme-tomorrow_night_eighties.js index 5759eadbc3d..e5c48fcaedf 100644 --- a/htdocs/includes/ace/src/theme-tomorrow_night_eighties.js +++ b/htdocs/includes/ace/src/theme-tomorrow_night_eighties.js @@ -104,7 +104,7 @@ background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgb }"; var dom = require("../lib/dom"); -dom.importCssString(exports.cssText, exports.cssClass); +dom.importCssString(exports.cssText, exports.cssClass, false); }); (function() { window.require(["ace/theme/tomorrow_night_eighties"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { diff --git a/htdocs/includes/ace/src/theme-twilight.js b/htdocs/includes/ace/src/theme-twilight.js index 34857c311a4..03e9d07da2a 100644 --- a/htdocs/includes/ace/src/theme-twilight.js +++ b/htdocs/includes/ace/src/theme-twilight.js @@ -80,8 +80,7 @@ color: #DAD085\ color: #F9EE98\ }\ .ace-twilight .ace_entity.ace_name.ace_function,\ -.ace-twilight .ace_meta.ace_tag,\ -.ace-twilight .ace_variable {\ +.ace-twilight .ace_meta.ace_tag {\ color: #AC885B\ }\ .ace-twilight .ace_string {\ @@ -102,10 +101,11 @@ color: #494949\ }\ .ace-twilight .ace_indent-guide {\ background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWMQERFpYLC1tf0PAAgOAnPnhxyiAAAAAElFTkSuQmCC) right repeat-y\ -}"; +}\ +"; var dom = require("../lib/dom"); -dom.importCssString(exports.cssText, exports.cssClass); +dom.importCssString(exports.cssText, exports.cssClass, false); }); (function() { window.require(["ace/theme/twilight"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { diff --git a/htdocs/includes/ace/src/theme-vibrant_ink.js b/htdocs/includes/ace/src/theme-vibrant_ink.js index 6fbc5094c93..26f7de9043a 100644 --- a/htdocs/includes/ace/src/theme-vibrant_ink.js +++ b/htdocs/includes/ace/src/theme-vibrant_ink.js @@ -90,7 +90,7 @@ background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgb }"; var dom = require("../lib/dom"); -dom.importCssString(exports.cssText, exports.cssClass); +dom.importCssString(exports.cssText, exports.cssClass, false); }); (function() { window.require(["ace/theme/vibrant_ink"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { diff --git a/htdocs/includes/ace/src/theme-xcode.js b/htdocs/includes/ace/src/theme-xcode.js index 99a5b75ef9a..daded3a15eb 100644 --- a/htdocs/includes/ace/src/theme-xcode.js +++ b/htdocs/includes/ace/src/theme-xcode.js @@ -84,7 +84,7 @@ background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgb }"; var dom = require("../lib/dom"); -dom.importCssString(exports.cssText, exports.cssClass); +dom.importCssString(exports.cssText, exports.cssClass, false); }); (function() { window.require(["ace/theme/xcode"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { diff --git a/htdocs/includes/ace/src/worker-base.js b/htdocs/includes/ace/src/worker-base.js new file mode 100644 index 00000000000..ca582ac58ec --- /dev/null +++ b/htdocs/includes/ace/src/worker-base.js @@ -0,0 +1,1421 @@ +"no use strict"; +!(function(window) { +if (typeof window.window != "undefined" && window.document) + return; +if (window.require && window.define) + return; + +if (!window.console) { + window.console = function() { + var msgs = Array.prototype.slice.call(arguments, 0); + postMessage({type: "log", data: msgs}); + }; + window.console.error = + window.console.warn = + window.console.log = + window.console.trace = window.console; +} +window.window = window; +window.ace = window; + +window.onerror = function(message, file, line, col, err) { + postMessage({type: "error", data: { + message: message, + data: err.data, + file: file, + line: line, + col: col, + stack: err.stack + }}); +}; + +window.normalizeModule = function(parentId, moduleName) { + // normalize plugin requires + if (moduleName.indexOf("!") !== -1) { + var chunks = moduleName.split("!"); + return window.normalizeModule(parentId, chunks[0]) + "!" + window.normalizeModule(parentId, chunks[1]); + } + // normalize relative requires + if (moduleName.charAt(0) == ".") { + var base = parentId.split("/").slice(0, -1).join("/"); + moduleName = (base ? base + "/" : "") + moduleName; + + while (moduleName.indexOf(".") !== -1 && previous != moduleName) { + var previous = moduleName; + moduleName = moduleName.replace(/^\.\//, "").replace(/\/\.\//, "/").replace(/[^\/]+\/\.\.\//, ""); + } + } + + return moduleName; +}; + +window.require = function require(parentId, id) { + if (!id) { + id = parentId; + parentId = null; + } + if (!id.charAt) + throw new Error("worker.js require() accepts only (parentId, id) as arguments"); + + id = window.normalizeModule(parentId, id); + + var module = window.require.modules[id]; + if (module) { + if (!module.initialized) { + module.initialized = true; + module.exports = module.factory().exports; + } + return module.exports; + } + + if (!window.require.tlns) + return console.log("unable to load " + id); + + var path = resolveModuleId(id, window.require.tlns); + if (path.slice(-3) != ".js") path += ".js"; + + window.require.id = id; + window.require.modules[id] = {}; // prevent infinite loop on broken modules + importScripts(path); + return window.require(parentId, id); +}; +function resolveModuleId(id, paths) { + var testPath = id, tail = ""; + while (testPath) { + var alias = paths[testPath]; + if (typeof alias == "string") { + return alias + tail; + } else if (alias) { + return alias.location.replace(/\/*$/, "/") + (tail || alias.main || alias.name); + } else if (alias === false) { + return ""; + } + var i = testPath.lastIndexOf("/"); + if (i === -1) break; + tail = testPath.substr(i) + tail; + testPath = testPath.slice(0, i); + } + return id; +} +window.require.modules = {}; +window.require.tlns = {}; + +window.define = function(id, deps, factory) { + if (arguments.length == 2) { + factory = deps; + if (typeof id != "string") { + deps = id; + id = window.require.id; + } + } else if (arguments.length == 1) { + factory = id; + deps = []; + id = window.require.id; + } + + if (typeof factory != "function") { + window.require.modules[id] = { + exports: factory, + initialized: true + }; + return; + } + + if (!deps.length) + // If there is no dependencies, we inject "require", "exports" and + // "module" as dependencies, to provide CommonJS compatibility. + deps = ["require", "exports", "module"]; + + var req = function(childId) { + return window.require(id, childId); + }; + + window.require.modules[id] = { + exports: {}, + factory: function() { + var module = this; + var returnExports = factory.apply(this, deps.slice(0, factory.length).map(function(dep) { + switch (dep) { + // Because "require", "exports" and "module" aren't actual + // dependencies, we must handle them seperately. + case "require": return req; + case "exports": return module.exports; + case "module": return module; + // But for all other dependencies, we can just go ahead and + // require them. + default: return req(dep); + } + })); + if (returnExports) + module.exports = returnExports; + return module; + } + }; +}; +window.define.amd = {}; +require.tlns = {}; +window.initBaseUrls = function initBaseUrls(topLevelNamespaces) { + for (var i in topLevelNamespaces) + require.tlns[i] = topLevelNamespaces[i]; +}; + +window.initSender = function initSender() { + + var EventEmitter = window.require("ace/lib/event_emitter").EventEmitter; + var oop = window.require("ace/lib/oop"); + + var Sender = function() {}; + + (function() { + + oop.implement(this, EventEmitter); + + this.callback = function(data, callbackId) { + postMessage({ + type: "call", + id: callbackId, + data: data + }); + }; + + this.emit = function(name, data) { + postMessage({ + type: "event", + name: name, + data: data + }); + }; + + }).call(Sender.prototype); + + return new Sender(); +}; + +var main = window.main = null; +var sender = window.sender = null; + +window.onmessage = function(e) { + var msg = e.data; + if (msg.event && sender) { + sender._signal(msg.event, msg.data); + } + else if (msg.command) { + if (main[msg.command]) + main[msg.command].apply(main, msg.args); + else if (window[msg.command]) + window[msg.command].apply(window, msg.args); + else + throw new Error("Unknown command:" + msg.command); + } + else if (msg.init) { + window.initBaseUrls(msg.tlns); + sender = window.sender = window.initSender(); + var clazz = require(msg.module)[msg.classname]; + main = window.main = new clazz(sender); + } +}; +})(this); + +define("ace/range",[], function(require, exports, module) { +"use strict"; +var comparePoints = function(p1, p2) { + return p1.row - p2.row || p1.column - p2.column; +}; +var Range = function(startRow, startColumn, endRow, endColumn) { + this.start = { + row: startRow, + column: startColumn + }; + + this.end = { + row: endRow, + column: endColumn + }; +}; + +(function() { + this.isEqual = function(range) { + return this.start.row === range.start.row && + this.end.row === range.end.row && + this.start.column === range.start.column && + this.end.column === range.end.column; + }; + this.toString = function() { + return ("Range: [" + this.start.row + "/" + this.start.column + + "] -> [" + this.end.row + "/" + this.end.column + "]"); + }; + + this.contains = function(row, column) { + return this.compare(row, column) == 0; + }; + this.compareRange = function(range) { + var cmp, + end = range.end, + start = range.start; + + cmp = this.compare(end.row, end.column); + if (cmp == 1) { + cmp = this.compare(start.row, start.column); + if (cmp == 1) { + return 2; + } else if (cmp == 0) { + return 1; + } else { + return 0; + } + } else if (cmp == -1) { + return -2; + } else { + cmp = this.compare(start.row, start.column); + if (cmp == -1) { + return -1; + } else if (cmp == 1) { + return 42; + } else { + return 0; + } + } + }; + this.comparePoint = function(p) { + return this.compare(p.row, p.column); + }; + this.containsRange = function(range) { + return this.comparePoint(range.start) == 0 && this.comparePoint(range.end) == 0; + }; + this.intersects = function(range) { + var cmp = this.compareRange(range); + return (cmp == -1 || cmp == 0 || cmp == 1); + }; + this.isEnd = function(row, column) { + return this.end.row == row && this.end.column == column; + }; + this.isStart = function(row, column) { + return this.start.row == row && this.start.column == column; + }; + this.setStart = function(row, column) { + if (typeof row == "object") { + this.start.column = row.column; + this.start.row = row.row; + } else { + this.start.row = row; + this.start.column = column; + } + }; + this.setEnd = function(row, column) { + if (typeof row == "object") { + this.end.column = row.column; + this.end.row = row.row; + } else { + this.end.row = row; + this.end.column = column; + } + }; + this.inside = function(row, column) { + if (this.compare(row, column) == 0) { + if (this.isEnd(row, column) || this.isStart(row, column)) { + return false; + } else { + return true; + } + } + return false; + }; + this.insideStart = function(row, column) { + if (this.compare(row, column) == 0) { + if (this.isEnd(row, column)) { + return false; + } else { + return true; + } + } + return false; + }; + this.insideEnd = function(row, column) { + if (this.compare(row, column) == 0) { + if (this.isStart(row, column)) { + return false; + } else { + return true; + } + } + return false; + }; + this.compare = function(row, column) { + if (!this.isMultiLine()) { + if (row === this.start.row) { + return column < this.start.column ? -1 : (column > this.end.column ? 1 : 0); + } + } + + if (row < this.start.row) + return -1; + + if (row > this.end.row) + return 1; + + if (this.start.row === row) + return column >= this.start.column ? 0 : -1; + + if (this.end.row === row) + return column <= this.end.column ? 0 : 1; + + return 0; + }; + this.compareStart = function(row, column) { + if (this.start.row == row && this.start.column == column) { + return -1; + } else { + return this.compare(row, column); + } + }; + this.compareEnd = function(row, column) { + if (this.end.row == row && this.end.column == column) { + return 1; + } else { + return this.compare(row, column); + } + }; + this.compareInside = function(row, column) { + if (this.end.row == row && this.end.column == column) { + return 1; + } else if (this.start.row == row && this.start.column == column) { + return -1; + } else { + return this.compare(row, column); + } + }; + this.clipRows = function(firstRow, lastRow) { + if (this.end.row > lastRow) + var end = {row: lastRow + 1, column: 0}; + else if (this.end.row < firstRow) + var end = {row: firstRow, column: 0}; + + if (this.start.row > lastRow) + var start = {row: lastRow + 1, column: 0}; + else if (this.start.row < firstRow) + var start = {row: firstRow, column: 0}; + + return Range.fromPoints(start || this.start, end || this.end); + }; + this.extend = function(row, column) { + var cmp = this.compare(row, column); + + if (cmp == 0) + return this; + else if (cmp == -1) + var start = {row: row, column: column}; + else + var end = {row: row, column: column}; + + return Range.fromPoints(start || this.start, end || this.end); + }; + + this.isEmpty = function() { + return (this.start.row === this.end.row && this.start.column === this.end.column); + }; + this.isMultiLine = function() { + return (this.start.row !== this.end.row); + }; + this.clone = function() { + return Range.fromPoints(this.start, this.end); + }; + this.collapseRows = function() { + if (this.end.column == 0) + return new Range(this.start.row, 0, Math.max(this.start.row, this.end.row-1), 0); + else + return new Range(this.start.row, 0, this.end.row, 0); + }; + this.toScreenRange = function(session) { + var screenPosStart = session.documentToScreenPosition(this.start); + var screenPosEnd = session.documentToScreenPosition(this.end); + + return new Range( + screenPosStart.row, screenPosStart.column, + screenPosEnd.row, screenPosEnd.column + ); + }; + this.moveBy = function(row, column) { + this.start.row += row; + this.start.column += column; + this.end.row += row; + this.end.column += column; + }; + +}).call(Range.prototype); +Range.fromPoints = function(start, end) { + return new Range(start.row, start.column, end.row, end.column); +}; +Range.comparePoints = comparePoints; + +Range.comparePoints = function(p1, p2) { + return p1.row - p2.row || p1.column - p2.column; +}; + + +exports.Range = Range; +}); + +define("ace/lib/oop",[], function(require, exports, module) { +"use strict"; + +exports.inherits = function(ctor, superCtor) { + ctor.super_ = superCtor; + ctor.prototype = Object.create(superCtor.prototype, { + constructor: { + value: ctor, + enumerable: false, + writable: true, + configurable: true + } + }); +}; + +exports.mixin = function(obj, mixin) { + for (var key in mixin) { + obj[key] = mixin[key]; + } + return obj; +}; + +exports.implement = function(proto, mixin) { + exports.mixin(proto, mixin); +}; + +}); + +define("ace/apply_delta",[], function(require, exports, module) { +"use strict"; + +function throwDeltaError(delta, errorText){ + console.log("Invalid Delta:", delta); + throw "Invalid Delta: " + errorText; +} + +function positionInDocument(docLines, position) { + return position.row >= 0 && position.row < docLines.length && + position.column >= 0 && position.column <= docLines[position.row].length; +} + +function validateDelta(docLines, delta) { + if (delta.action != "insert" && delta.action != "remove") + throwDeltaError(delta, "delta.action must be 'insert' or 'remove'"); + if (!(delta.lines instanceof Array)) + throwDeltaError(delta, "delta.lines must be an Array"); + if (!delta.start || !delta.end) + throwDeltaError(delta, "delta.start/end must be an present"); + var start = delta.start; + if (!positionInDocument(docLines, delta.start)) + throwDeltaError(delta, "delta.start must be contained in document"); + var end = delta.end; + if (delta.action == "remove" && !positionInDocument(docLines, end)) + throwDeltaError(delta, "delta.end must contained in document for 'remove' actions"); + var numRangeRows = end.row - start.row; + var numRangeLastLineChars = (end.column - (numRangeRows == 0 ? start.column : 0)); + if (numRangeRows != delta.lines.length - 1 || delta.lines[numRangeRows].length != numRangeLastLineChars) + throwDeltaError(delta, "delta.range must match delta lines"); +} + +exports.applyDelta = function(docLines, delta, doNotValidate) { + + var row = delta.start.row; + var startColumn = delta.start.column; + var line = docLines[row] || ""; + switch (delta.action) { + case "insert": + var lines = delta.lines; + if (lines.length === 1) { + docLines[row] = line.substring(0, startColumn) + delta.lines[0] + line.substring(startColumn); + } else { + var args = [row, 1].concat(delta.lines); + docLines.splice.apply(docLines, args); + docLines[row] = line.substring(0, startColumn) + docLines[row]; + docLines[row + delta.lines.length - 1] += line.substring(startColumn); + } + break; + case "remove": + var endColumn = delta.end.column; + var endRow = delta.end.row; + if (row === endRow) { + docLines[row] = line.substring(0, startColumn) + line.substring(endColumn); + } else { + docLines.splice( + row, endRow - row + 1, + line.substring(0, startColumn) + docLines[endRow].substring(endColumn) + ); + } + break; + } +}; +}); + +define("ace/lib/event_emitter",[], function(require, exports, module) { +"use strict"; + +var EventEmitter = {}; +var stopPropagation = function() { this.propagationStopped = true; }; +var preventDefault = function() { this.defaultPrevented = true; }; + +EventEmitter._emit = +EventEmitter._dispatchEvent = function(eventName, e) { + this._eventRegistry || (this._eventRegistry = {}); + this._defaultHandlers || (this._defaultHandlers = {}); + + var listeners = this._eventRegistry[eventName] || []; + var defaultHandler = this._defaultHandlers[eventName]; + if (!listeners.length && !defaultHandler) + return; + + if (typeof e != "object" || !e) + e = {}; + + if (!e.type) + e.type = eventName; + if (!e.stopPropagation) + e.stopPropagation = stopPropagation; + if (!e.preventDefault) + e.preventDefault = preventDefault; + + listeners = listeners.slice(); + for (var i=0; i this.row) + return; + + var point = $getTransformedPoint(delta, {row: this.row, column: this.column}, this.$insertRight); + this.setPosition(point.row, point.column, true); + }; + + function $pointsInOrder(point1, point2, equalPointsInOrder) { + var bColIsAfter = equalPointsInOrder ? point1.column <= point2.column : point1.column < point2.column; + return (point1.row < point2.row) || (point1.row == point2.row && bColIsAfter); + } + + function $getTransformedPoint(delta, point, moveIfEqual) { + var deltaIsInsert = delta.action == "insert"; + var deltaRowShift = (deltaIsInsert ? 1 : -1) * (delta.end.row - delta.start.row); + var deltaColShift = (deltaIsInsert ? 1 : -1) * (delta.end.column - delta.start.column); + var deltaStart = delta.start; + var deltaEnd = deltaIsInsert ? deltaStart : delta.end; // Collapse insert range. + if ($pointsInOrder(point, deltaStart, moveIfEqual)) { + return { + row: point.row, + column: point.column + }; + } + if ($pointsInOrder(deltaEnd, point, !moveIfEqual)) { + return { + row: point.row + deltaRowShift, + column: point.column + (point.row == deltaEnd.row ? deltaColShift : 0) + }; + } + + return { + row: deltaStart.row, + column: deltaStart.column + }; + } + this.setPosition = function(row, column, noClip) { + var pos; + if (noClip) { + pos = { + row: row, + column: column + }; + } else { + pos = this.$clipPositionToDocument(row, column); + } + + if (this.row == pos.row && this.column == pos.column) + return; + + var old = { + row: this.row, + column: this.column + }; + + this.row = pos.row; + this.column = pos.column; + this._signal("change", { + old: old, + value: pos + }); + }; + this.detach = function() { + this.document.off("change", this.$onChange); + }; + this.attach = function(doc) { + this.document = doc || this.document; + this.document.on("change", this.$onChange); + }; + this.$clipPositionToDocument = function(row, column) { + var pos = {}; + + if (row >= this.document.getLength()) { + pos.row = Math.max(0, this.document.getLength() - 1); + pos.column = this.document.getLine(pos.row).length; + } + else if (row < 0) { + pos.row = 0; + pos.column = 0; + } + else { + pos.row = row; + pos.column = Math.min(this.document.getLine(pos.row).length, Math.max(0, column)); + } + + if (column < 0) + pos.column = 0; + + return pos; + }; + +}).call(Anchor.prototype); + +}); + +define("ace/document",[], function(require, exports, module) { +"use strict"; + +var oop = require("./lib/oop"); +var applyDelta = require("./apply_delta").applyDelta; +var EventEmitter = require("./lib/event_emitter").EventEmitter; +var Range = require("./range").Range; +var Anchor = require("./anchor").Anchor; + +var Document = function(textOrLines) { + this.$lines = [""]; + if (textOrLines.length === 0) { + this.$lines = [""]; + } else if (Array.isArray(textOrLines)) { + this.insertMergedLines({row: 0, column: 0}, textOrLines); + } else { + this.insert({row: 0, column:0}, textOrLines); + } +}; + +(function() { + + oop.implement(this, EventEmitter); + this.setValue = function(text) { + var len = this.getLength() - 1; + this.remove(new Range(0, 0, len, this.getLine(len).length)); + this.insert({row: 0, column: 0}, text); + }; + this.getValue = function() { + return this.getAllLines().join(this.getNewLineCharacter()); + }; + this.createAnchor = function(row, column) { + return new Anchor(this, row, column); + }; + if ("aaa".split(/a/).length === 0) { + this.$split = function(text) { + return text.replace(/\r\n|\r/g, "\n").split("\n"); + }; + } else { + this.$split = function(text) { + return text.split(/\r\n|\r|\n/); + }; + } + + + this.$detectNewLine = function(text) { + var match = text.match(/^.*?(\r\n|\r|\n)/m); + this.$autoNewLine = match ? match[1] : "\n"; + this._signal("changeNewLineMode"); + }; + this.getNewLineCharacter = function() { + switch (this.$newLineMode) { + case "windows": + return "\r\n"; + case "unix": + return "\n"; + default: + return this.$autoNewLine || "\n"; + } + }; + + this.$autoNewLine = ""; + this.$newLineMode = "auto"; + this.setNewLineMode = function(newLineMode) { + if (this.$newLineMode === newLineMode) + return; + + this.$newLineMode = newLineMode; + this._signal("changeNewLineMode"); + }; + this.getNewLineMode = function() { + return this.$newLineMode; + }; + this.isNewLine = function(text) { + return (text == "\r\n" || text == "\r" || text == "\n"); + }; + this.getLine = function(row) { + return this.$lines[row] || ""; + }; + this.getLines = function(firstRow, lastRow) { + return this.$lines.slice(firstRow, lastRow + 1); + }; + this.getAllLines = function() { + return this.getLines(0, this.getLength()); + }; + this.getLength = function() { + return this.$lines.length; + }; + this.getTextRange = function(range) { + return this.getLinesForRange(range).join(this.getNewLineCharacter()); + }; + this.getLinesForRange = function(range) { + var lines; + if (range.start.row === range.end.row) { + lines = [this.getLine(range.start.row).substring(range.start.column, range.end.column)]; + } else { + lines = this.getLines(range.start.row, range.end.row); + lines[0] = (lines[0] || "").substring(range.start.column); + var l = lines.length - 1; + if (range.end.row - range.start.row == l) + lines[l] = lines[l].substring(0, range.end.column); + } + return lines; + }; + this.insertLines = function(row, lines) { + console.warn("Use of document.insertLines is deprecated. Use the insertFullLines method instead."); + return this.insertFullLines(row, lines); + }; + this.removeLines = function(firstRow, lastRow) { + console.warn("Use of document.removeLines is deprecated. Use the removeFullLines method instead."); + return this.removeFullLines(firstRow, lastRow); + }; + this.insertNewLine = function(position) { + console.warn("Use of document.insertNewLine is deprecated. Use insertMergedLines(position, ['', '']) instead."); + return this.insertMergedLines(position, ["", ""]); + }; + this.insert = function(position, text) { + if (this.getLength() <= 1) + this.$detectNewLine(text); + + return this.insertMergedLines(position, this.$split(text)); + }; + this.insertInLine = function(position, text) { + var start = this.clippedPos(position.row, position.column); + var end = this.pos(position.row, position.column + text.length); + + this.applyDelta({ + start: start, + end: end, + action: "insert", + lines: [text] + }, true); + + return this.clonePos(end); + }; + + this.clippedPos = function(row, column) { + var length = this.getLength(); + if (row === undefined) { + row = length; + } else if (row < 0) { + row = 0; + } else if (row >= length) { + row = length - 1; + column = undefined; + } + var line = this.getLine(row); + if (column == undefined) + column = line.length; + column = Math.min(Math.max(column, 0), line.length); + return {row: row, column: column}; + }; + + this.clonePos = function(pos) { + return {row: pos.row, column: pos.column}; + }; + + this.pos = function(row, column) { + return {row: row, column: column}; + }; + + this.$clipPosition = function(position) { + var length = this.getLength(); + if (position.row >= length) { + position.row = Math.max(0, length - 1); + position.column = this.getLine(length - 1).length; + } else { + position.row = Math.max(0, position.row); + position.column = Math.min(Math.max(position.column, 0), this.getLine(position.row).length); + } + return position; + }; + this.insertFullLines = function(row, lines) { + row = Math.min(Math.max(row, 0), this.getLength()); + var column = 0; + if (row < this.getLength()) { + lines = lines.concat([""]); + column = 0; + } else { + lines = [""].concat(lines); + row--; + column = this.$lines[row].length; + } + this.insertMergedLines({row: row, column: column}, lines); + }; + this.insertMergedLines = function(position, lines) { + var start = this.clippedPos(position.row, position.column); + var end = { + row: start.row + lines.length - 1, + column: (lines.length == 1 ? start.column : 0) + lines[lines.length - 1].length + }; + + this.applyDelta({ + start: start, + end: end, + action: "insert", + lines: lines + }); + + return this.clonePos(end); + }; + this.remove = function(range) { + var start = this.clippedPos(range.start.row, range.start.column); + var end = this.clippedPos(range.end.row, range.end.column); + this.applyDelta({ + start: start, + end: end, + action: "remove", + lines: this.getLinesForRange({start: start, end: end}) + }); + return this.clonePos(start); + }; + this.removeInLine = function(row, startColumn, endColumn) { + var start = this.clippedPos(row, startColumn); + var end = this.clippedPos(row, endColumn); + + this.applyDelta({ + start: start, + end: end, + action: "remove", + lines: this.getLinesForRange({start: start, end: end}) + }, true); + + return this.clonePos(start); + }; + this.removeFullLines = function(firstRow, lastRow) { + firstRow = Math.min(Math.max(0, firstRow), this.getLength() - 1); + lastRow = Math.min(Math.max(0, lastRow ), this.getLength() - 1); + var deleteFirstNewLine = lastRow == this.getLength() - 1 && firstRow > 0; + var deleteLastNewLine = lastRow < this.getLength() - 1; + var startRow = ( deleteFirstNewLine ? firstRow - 1 : firstRow ); + var startCol = ( deleteFirstNewLine ? this.getLine(startRow).length : 0 ); + var endRow = ( deleteLastNewLine ? lastRow + 1 : lastRow ); + var endCol = ( deleteLastNewLine ? 0 : this.getLine(endRow).length ); + var range = new Range(startRow, startCol, endRow, endCol); + var deletedLines = this.$lines.slice(firstRow, lastRow + 1); + + this.applyDelta({ + start: range.start, + end: range.end, + action: "remove", + lines: this.getLinesForRange(range) + }); + return deletedLines; + }; + this.removeNewLine = function(row) { + if (row < this.getLength() - 1 && row >= 0) { + this.applyDelta({ + start: this.pos(row, this.getLine(row).length), + end: this.pos(row + 1, 0), + action: "remove", + lines: ["", ""] + }); + } + }; + this.replace = function(range, text) { + if (!(range instanceof Range)) + range = Range.fromPoints(range.start, range.end); + if (text.length === 0 && range.isEmpty()) + return range.start; + if (text == this.getTextRange(range)) + return range.end; + + this.remove(range); + var end; + if (text) { + end = this.insert(range.start, text); + } + else { + end = range.start; + } + + return end; + }; + this.applyDeltas = function(deltas) { + for (var i=0; i=0; i--) { + this.revertDelta(deltas[i]); + } + }; + this.applyDelta = function(delta, doNotValidate) { + var isInsert = delta.action == "insert"; + if (isInsert ? delta.lines.length <= 1 && !delta.lines[0] + : !Range.comparePoints(delta.start, delta.end)) { + return; + } + + if (isInsert && delta.lines.length > 20000) { + this.$splitAndapplyLargeDelta(delta, 20000); + } + else { + applyDelta(this.$lines, delta, doNotValidate); + this._signal("change", delta); + } + }; + + this.$safeApplyDelta = function(delta) { + var docLength = this.$lines.length; + if ( + delta.action == "remove" && delta.start.row < docLength && delta.end.row < docLength + || delta.action == "insert" && delta.start.row <= docLength + ) { + this.applyDelta(delta); + } + }; + + this.$splitAndapplyLargeDelta = function(delta, MAX) { + var lines = delta.lines; + var l = lines.length - MAX + 1; + var row = delta.start.row; + var column = delta.start.column; + for (var from = 0, to = 0; from < l; from = to) { + to += MAX - 1; + var chunk = lines.slice(from, to); + chunk.push(""); + this.applyDelta({ + start: this.pos(row + from, column), + end: this.pos(row + to, column = 0), + action: delta.action, + lines: chunk + }, true); + } + delta.lines = lines.slice(from); + delta.start.row = row + from; + delta.start.column = column; + this.applyDelta(delta, true); + }; + this.revertDelta = function(delta) { + this.$safeApplyDelta({ + start: this.clonePos(delta.start), + end: this.clonePos(delta.end), + action: (delta.action == "insert" ? "remove" : "insert"), + lines: delta.lines.slice() + }); + }; + this.indexToPosition = function(index, startRow) { + var lines = this.$lines || this.getAllLines(); + var newlineLength = this.getNewLineCharacter().length; + for (var i = startRow || 0, l = lines.length; i < l; i++) { + index -= lines[i].length + newlineLength; + if (index < 0) + return {row: i, column: index + lines[i].length + newlineLength}; + } + return {row: l-1, column: index + lines[l-1].length + newlineLength}; + }; + this.positionToIndex = function(pos, startRow) { + var lines = this.$lines || this.getAllLines(); + var newlineLength = this.getNewLineCharacter().length; + var index = 0; + var row = Math.min(pos.row, lines.length); + for (var i = startRow || 0; i < row; ++i) + index += lines[i].length + newlineLength; + + return index + pos.column; + }; + +}).call(Document.prototype); + +exports.Document = Document; +}); + +define("ace/lib/lang",[], function(require, exports, module) { +"use strict"; + +exports.last = function(a) { + return a[a.length - 1]; +}; + +exports.stringReverse = function(string) { + return string.split("").reverse().join(""); +}; + +exports.stringRepeat = function (string, count) { + var result = ''; + while (count > 0) { + if (count & 1) + result += string; + + if (count >>= 1) + string += string; + } + return result; +}; + +var trimBeginRegexp = /^\s\s*/; +var trimEndRegexp = /\s\s*$/; + +exports.stringTrimLeft = function (string) { + return string.replace(trimBeginRegexp, ''); +}; + +exports.stringTrimRight = function (string) { + return string.replace(trimEndRegexp, ''); +}; + +exports.copyObject = function(obj) { + var copy = {}; + for (var key in obj) { + copy[key] = obj[key]; + } + return copy; +}; + +exports.copyArray = function(array){ + var copy = []; + for (var i=0, l=array.length; i 0) { - if (pos > length) - pos = length; - } else if (pos == void 0) { - pos = 0; - } else if (pos < 0) { - pos = Math.max(length + pos, 0); - } - - if (!(pos+removeCount < length)) - removeCount = length - pos; - - var removed = this.slice(pos, pos+removeCount); - var insert = slice.call(arguments, 2); - var add = insert.length; - if (pos === length) { - if (add) { - this.push.apply(this, insert); - } - } else { - var remove = Math.min(removeCount, length - pos); - var tailOldPos = pos + remove; - var tailNewPos = tailOldPos + add - remove; - var tailCount = length - tailOldPos; - var lengthAfterRemove = length - remove; - - if (tailNewPos < tailOldPos) { // case A - for (var i = 0; i < tailCount; ++i) { - this[tailNewPos+i] = this[tailOldPos+i]; - } - } else if (tailNewPos > tailOldPos) { // case B - for (i = tailCount; i--; ) { - this[tailNewPos+i] = this[tailOldPos+i]; - } - } // else, add == remove (nothing to do) - - if (add && pos === lengthAfterRemove) { - this.length = lengthAfterRemove; // truncate array - this.push.apply(this, insert); - } else { - this.length = lengthAfterRemove + add; // reserves space - for (i = 0; i < add; ++i) { - this[pos+i] = insert[i]; - } - } - } - return removed; - }; - } -} -if (!Array.isArray) { - Array.isArray = function isArray(obj) { - return _toString(obj) == "[object Array]"; - }; -} -var boxedString = Object("a"), - splitString = boxedString[0] != "a" || !(0 in boxedString); - -if (!Array.prototype.forEach) { - Array.prototype.forEach = function forEach(fun /*, thisp*/) { - var object = toObject(this), - self = splitString && _toString(this) == "[object String]" ? - this.split("") : - object, - thisp = arguments[1], - i = -1, - length = self.length >>> 0; - if (_toString(fun) != "[object Function]") { - throw new TypeError(); // TODO message - } - - while (++i < length) { - if (i in self) { - fun.call(thisp, self[i], i, object); - } - } - }; -} -if (!Array.prototype.map) { - Array.prototype.map = function map(fun /*, thisp*/) { - var object = toObject(this), - self = splitString && _toString(this) == "[object String]" ? - this.split("") : - object, - length = self.length >>> 0, - result = Array(length), - thisp = arguments[1]; - if (_toString(fun) != "[object Function]") { - throw new TypeError(fun + " is not a function"); - } - - for (var i = 0; i < length; i++) { - if (i in self) - result[i] = fun.call(thisp, self[i], i, object); - } - return result; - }; -} -if (!Array.prototype.filter) { - Array.prototype.filter = function filter(fun /*, thisp */) { - var object = toObject(this), - self = splitString && _toString(this) == "[object String]" ? - this.split("") : - object, - length = self.length >>> 0, - result = [], - value, - thisp = arguments[1]; - if (_toString(fun) != "[object Function]") { - throw new TypeError(fun + " is not a function"); - } - - for (var i = 0; i < length; i++) { - if (i in self) { - value = self[i]; - if (fun.call(thisp, value, i, object)) { - result.push(value); - } - } - } - return result; - }; -} -if (!Array.prototype.every) { - Array.prototype.every = function every(fun /*, thisp */) { - var object = toObject(this), - self = splitString && _toString(this) == "[object String]" ? - this.split("") : - object, - length = self.length >>> 0, - thisp = arguments[1]; - if (_toString(fun) != "[object Function]") { - throw new TypeError(fun + " is not a function"); - } - - for (var i = 0; i < length; i++) { - if (i in self && !fun.call(thisp, self[i], i, object)) { - return false; - } - } - return true; - }; -} -if (!Array.prototype.some) { - Array.prototype.some = function some(fun /*, thisp */) { - var object = toObject(this), - self = splitString && _toString(this) == "[object String]" ? - this.split("") : - object, - length = self.length >>> 0, - thisp = arguments[1]; - if (_toString(fun) != "[object Function]") { - throw new TypeError(fun + " is not a function"); - } - - for (var i = 0; i < length; i++) { - if (i in self && fun.call(thisp, self[i], i, object)) { - return true; - } - } - return false; - }; -} -if (!Array.prototype.reduce) { - Array.prototype.reduce = function reduce(fun /*, initial*/) { - var object = toObject(this), - self = splitString && _toString(this) == "[object String]" ? - this.split("") : - object, - length = self.length >>> 0; - if (_toString(fun) != "[object Function]") { - throw new TypeError(fun + " is not a function"); - } - if (!length && arguments.length == 1) { - throw new TypeError("reduce of empty array with no initial value"); - } - - var i = 0; - var result; - if (arguments.length >= 2) { - result = arguments[1]; - } else { - do { - if (i in self) { - result = self[i++]; - break; - } - if (++i >= length) { - throw new TypeError("reduce of empty array with no initial value"); - } - } while (true); - } - - for (; i < length; i++) { - if (i in self) { - result = fun.call(void 0, result, self[i], i, object); - } - } - - return result; - }; -} -if (!Array.prototype.reduceRight) { - Array.prototype.reduceRight = function reduceRight(fun /*, initial*/) { - var object = toObject(this), - self = splitString && _toString(this) == "[object String]" ? - this.split("") : - object, - length = self.length >>> 0; - if (_toString(fun) != "[object Function]") { - throw new TypeError(fun + " is not a function"); - } - if (!length && arguments.length == 1) { - throw new TypeError("reduceRight of empty array with no initial value"); - } - - var result, i = length - 1; - if (arguments.length >= 2) { - result = arguments[1]; - } else { - do { - if (i in self) { - result = self[i--]; - break; - } - if (--i < 0) { - throw new TypeError("reduceRight of empty array with no initial value"); - } - } while (true); - } - - do { - if (i in this) { - result = fun.call(void 0, result, self[i], i, object); - } - } while (i--); - - return result; - }; -} -if (!Array.prototype.indexOf || ([0, 1].indexOf(1, 2) != -1)) { - Array.prototype.indexOf = function indexOf(sought /*, fromIndex */ ) { - var self = splitString && _toString(this) == "[object String]" ? - this.split("") : - toObject(this), - length = self.length >>> 0; - - if (!length) { - return -1; - } - - var i = 0; - if (arguments.length > 1) { - i = toInteger(arguments[1]); - } - i = i >= 0 ? i : Math.max(0, length + i); - for (; i < length; i++) { - if (i in self && self[i] === sought) { - return i; - } - } - return -1; - }; -} -if (!Array.prototype.lastIndexOf || ([0, 1].lastIndexOf(0, -3) != -1)) { - Array.prototype.lastIndexOf = function lastIndexOf(sought /*, fromIndex */) { - var self = splitString && _toString(this) == "[object String]" ? - this.split("") : - toObject(this), - length = self.length >>> 0; - - if (!length) { - return -1; - } - var i = length - 1; - if (arguments.length > 1) { - i = Math.min(i, toInteger(arguments[1])); - } - i = i >= 0 ? i : length - Math.abs(i); - for (; i >= 0; i--) { - if (i in self && sought === self[i]) { - return i; - } - } - return -1; - }; -} -if (!Object.getPrototypeOf) { - Object.getPrototypeOf = function getPrototypeOf(object) { - return object.__proto__ || ( - object.constructor ? - object.constructor.prototype : - prototypeOfObject - ); - }; -} -if (!Object.getOwnPropertyDescriptor) { - var ERR_NON_OBJECT = "Object.getOwnPropertyDescriptor called on a " + - "non-object: "; - Object.getOwnPropertyDescriptor = function getOwnPropertyDescriptor(object, property) { - if ((typeof object != "object" && typeof object != "function") || object === null) - throw new TypeError(ERR_NON_OBJECT + object); - if (!owns(object, property)) - return; - - var descriptor, getter, setter; - descriptor = { enumerable: true, configurable: true }; - if (supportsAccessors) { - var prototype = object.__proto__; - object.__proto__ = prototypeOfObject; - - var getter = lookupGetter(object, property); - var setter = lookupSetter(object, property); - object.__proto__ = prototype; - - if (getter || setter) { - if (getter) descriptor.get = getter; - if (setter) descriptor.set = setter; - return descriptor; - } - } - descriptor.value = object[property]; - return descriptor; - }; -} -if (!Object.getOwnPropertyNames) { - Object.getOwnPropertyNames = function getOwnPropertyNames(object) { - return Object.keys(object); - }; -} -if (!Object.create) { - var createEmpty; - if (Object.prototype.__proto__ === null) { - createEmpty = function () { - return { "__proto__": null }; - }; - } else { - createEmpty = function () { - var empty = {}; - for (var i in empty) - empty[i] = null; - empty.constructor = - empty.hasOwnProperty = - empty.propertyIsEnumerable = - empty.isPrototypeOf = - empty.toLocaleString = - empty.toString = - empty.valueOf = - empty.__proto__ = null; - return empty; - } - } - - Object.create = function create(prototype, properties) { - var object; - if (prototype === null) { - object = createEmpty(); - } else { - if (typeof prototype != "object") - throw new TypeError("typeof prototype["+(typeof prototype)+"] != 'object'"); - var Type = function () {}; - Type.prototype = prototype; - object = new Type(); - object.__proto__ = prototype; - } - if (properties !== void 0) - Object.defineProperties(object, properties); - return object; - }; -} - -function doesDefinePropertyWork(object) { - try { - Object.defineProperty(object, "sentinel", {}); - return "sentinel" in object; - } catch (exception) { - } -} -if (Object.defineProperty) { - var definePropertyWorksOnObject = doesDefinePropertyWork({}); - var definePropertyWorksOnDom = typeof document == "undefined" || - doesDefinePropertyWork(document.createElement("div")); - if (!definePropertyWorksOnObject || !definePropertyWorksOnDom) { - var definePropertyFallback = Object.defineProperty; - } -} - -if (!Object.defineProperty || definePropertyFallback) { - var ERR_NON_OBJECT_DESCRIPTOR = "Property description must be an object: "; - var ERR_NON_OBJECT_TARGET = "Object.defineProperty called on non-object: " - var ERR_ACCESSORS_NOT_SUPPORTED = "getters & setters can not be defined " + - "on this javascript engine"; - - Object.defineProperty = function defineProperty(object, property, descriptor) { - if ((typeof object != "object" && typeof object != "function") || object === null) - throw new TypeError(ERR_NON_OBJECT_TARGET + object); - if ((typeof descriptor != "object" && typeof descriptor != "function") || descriptor === null) - throw new TypeError(ERR_NON_OBJECT_DESCRIPTOR + descriptor); - if (definePropertyFallback) { - try { - return definePropertyFallback.call(Object, object, property, descriptor); - } catch (exception) { - } - } - if (owns(descriptor, "value")) { - - if (supportsAccessors && (lookupGetter(object, property) || - lookupSetter(object, property))) - { - var prototype = object.__proto__; - object.__proto__ = prototypeOfObject; - delete object[property]; - object[property] = descriptor.value; - object.__proto__ = prototype; - } else { - object[property] = descriptor.value; - } - } else { - if (!supportsAccessors) - throw new TypeError(ERR_ACCESSORS_NOT_SUPPORTED); - if (owns(descriptor, "get")) - defineGetter(object, property, descriptor.get); - if (owns(descriptor, "set")) - defineSetter(object, property, descriptor.set); - } - - return object; - }; -} -if (!Object.defineProperties) { - Object.defineProperties = function defineProperties(object, properties) { - for (var property in properties) { - if (owns(properties, property)) - Object.defineProperty(object, property, properties[property]); - } - return object; - }; -} -if (!Object.seal) { - Object.seal = function seal(object) { - return object; - }; -} -if (!Object.freeze) { - Object.freeze = function freeze(object) { - return object; - }; -} -try { - Object.freeze(function () {}); -} catch (exception) { - Object.freeze = (function freeze(freezeObject) { - return function freeze(object) { - if (typeof object == "function") { - return object; - } else { - return freezeObject(object); - } - }; - })(Object.freeze); -} -if (!Object.preventExtensions) { - Object.preventExtensions = function preventExtensions(object) { - return object; - }; -} -if (!Object.isSealed) { - Object.isSealed = function isSealed(object) { - return false; - }; -} -if (!Object.isFrozen) { - Object.isFrozen = function isFrozen(object) { - return false; - }; -} -if (!Object.isExtensible) { - Object.isExtensible = function isExtensible(object) { - if (Object(object) === object) { - throw new TypeError(); // TODO message - } - var name = ''; - while (owns(object, name)) { - name += '?'; - } - object[name] = true; - var returnValue = owns(object, name); - delete object[name]; - return returnValue; - }; -} -if (!Object.keys) { - var hasDontEnumBug = true, - dontEnums = [ - "toString", - "toLocaleString", - "valueOf", - "hasOwnProperty", - "isPrototypeOf", - "propertyIsEnumerable", - "constructor" - ], - dontEnumsLength = dontEnums.length; - - for (var key in {"toString": null}) { - hasDontEnumBug = false; - } - - Object.keys = function keys(object) { - - if ( - (typeof object != "object" && typeof object != "function") || - object === null - ) { - throw new TypeError("Object.keys called on a non-object"); - } - - var keys = []; - for (var name in object) { - if (owns(object, name)) { - keys.push(name); - } - } - - if (hasDontEnumBug) { - for (var i = 0, ii = dontEnumsLength; i < ii; i++) { - var dontEnum = dontEnums[i]; - if (owns(object, dontEnum)) { - keys.push(dontEnum); - } - } - } - return keys; - }; - -} -if (!Date.now) { - Date.now = function now() { - return new Date().getTime(); - }; -} -var ws = "\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003" + - "\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028" + - "\u2029\uFEFF"; -if (!String.prototype.trim) { - ws = "[" + ws + "]"; - var trimBeginRegexp = new RegExp("^" + ws + ws + "*"), - trimEndRegexp = new RegExp(ws + ws + "*$"); - String.prototype.trim = function trim() { - return String(this).replace(trimBeginRegexp, "").replace(trimEndRegexp, ""); - }; -} - -function toInteger(n) { - n = +n; - if (n !== n) { // isNaN - n = 0; - } else if (n !== 0 && n !== (1/0) && n !== -(1/0)) { - n = (n > 0 || -1) * Math.floor(Math.abs(n)); - } - return n; -} - -function isPrimitive(input) { - var type = typeof input; - return ( - input === null || - type === "undefined" || - type === "boolean" || - type === "number" || - type === "string" - ); -} - -function toPrimitive(input) { - var val, valueOf, toString; - if (isPrimitive(input)) { - return input; - } - valueOf = input.valueOf; - if (typeof valueOf === "function") { - val = valueOf.call(input); - if (isPrimitive(val)) { - return val; - } - } - toString = input.toString; - if (typeof toString === "function") { - val = toString.call(input); - if (isPrimitive(val)) { - return val; - } - } - throw new TypeError(); -} -var toObject = function (o) { - if (o == null) { // this matches both null and undefined - throw new TypeError("can't convert "+o+" to object"); - } - return Object(o); -}; - -}); diff --git a/htdocs/includes/ace/src/worker-css.js b/htdocs/includes/ace/src/worker-css.js index a7d914e3397..8cccc059adb 100644 --- a/htdocs/includes/ace/src/worker-css.js +++ b/htdocs/includes/ace/src/worker-css.js @@ -209,7 +209,6 @@ window.onmessage = function(e) { } else if (msg.init) { window.initBaseUrls(msg.tlns); - require("ace/lib/es5-shim"); sender = window.sender = window.initSender(); var clazz = require(msg.module)[msg.classname]; main = window.main = new clazz(sender); @@ -787,8 +786,8 @@ EventEmitter._signal = function(eventName, e) { EventEmitter.once = function(eventName, callback) { var _self = this; - this.addEventListener(eventName, function newCallback() { - _self.removeEventListener(eventName, newCallback); + this.on(eventName, function newCallback() { + _self.off(eventName, newCallback); callback.apply(null, arguments); }); if (!callback) { @@ -860,7 +859,9 @@ EventEmitter.removeEventListener = function(eventName, callback) { }; EventEmitter.removeAllListeners = function(eventName) { - if (this._eventRegistry) this._eventRegistry[eventName] = []; + if (!eventName) this._eventRegistry = this._defaultHandlers = undefined; + if (this._eventRegistry) this._eventRegistry[eventName] = undefined; + if (this._defaultHandlers) this._defaultHandlers[eventName] = undefined; }; exports.EventEmitter = EventEmitter; @@ -960,7 +961,7 @@ var Anchor = exports.Anchor = function(doc, row, column) { }); }; this.detach = function() { - this.document.removeEventListener("change", this.$onChange); + this.document.off("change", this.$onChange); }; this.attach = function(doc) { this.document = doc || this.document; @@ -1292,6 +1293,16 @@ var Document = function(textOrLines) { } }; + this.$safeApplyDelta = function(delta) { + var docLength = this.$lines.length; + if ( + delta.action == "remove" && delta.start.row < docLength && delta.end.row < docLength + || delta.action == "insert" && delta.start.row <= docLength + ) { + this.applyDelta(delta); + } + }; + this.$splitAndapplyLargeDelta = function(delta, MAX) { var lines = delta.lines; var l = lines.length - MAX + 1; @@ -1314,7 +1325,7 @@ var Document = function(textOrLines) { this.applyDelta(delta, true); }; this.revertDelta = function(delta) { - this.applyDelta({ + this.$safeApplyDelta({ start: this.clonePos(delta.start), end: this.clonePos(delta.end), action: (delta.action == "insert" ? "remove" : "insert"), @@ -1410,589 +1421,217 @@ var Mirror = exports.Mirror = function(sender) { }); define("ace/mode/css/csslint",[], function(require, exports, module) { -var parserlib = {}; -(function(){ -function EventTarget(){ - this._listeners = {}; -} -EventTarget.prototype = { - constructor: EventTarget, - addListener: function(type, listener){ - if (!this._listeners[type]){ - this._listeners[type] = []; - } +var CSSLint = (function(){ + var module = module || {}, + exports = exports || {}; +var parserlib = (function () { +var require; +require=(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i= 0 && this._ltIndex < this._lt.length){ - - i++; - this._token = this._lt[this._ltIndex++]; - info = tokenInfo[this._token.type]; - while((info.channel !== undefined && channel !== info.channel) && - this._ltIndex < this._lt.length){ - this._token = this._lt[this._ltIndex++]; - info = tokenInfo[this._token.type]; - i++; - } - if ((info.channel === undefined || channel === info.channel) && - this._ltIndex <= this._lt.length){ - this._ltIndexCache.push(i); - return this._token.type; - } - } - token = this._getToken(); - if (token.type > -1 && !tokenInfo[token.type].hide){ - token.channel = tokenInfo[token.type].channel; - this._token = token; - this._lt.push(token); - this._ltIndexCache.push(this._lt.length - this._ltIndex + i); - if (this._lt.length > 5){ - this._lt.shift(); - } - if (this._ltIndexCache.length > 5){ - this._ltIndexCache.shift(); - } - this._ltIndex = this._lt.length; - } - info = tokenInfo[token.type]; - if (info && - (info.hide || - (info.channel !== undefined && channel !== info.channel))){ - return this.get(channel); - } else { - return token.type; - } - }, - LA: function(index){ - var total = index, - tt; - if (index > 0){ - if (index > 5){ - throw new Error("Too much lookahead."); - } - while(total){ - tt = this.get(); - total--; - } - while(total < index){ - this.unget(); - total++; - } - } else if (index < 0){ - - if(this._lt[this._ltIndex+index]){ - tt = this._lt[this._ltIndex+index].type; - } else { - throw new Error("Too much lookbehind."); - } - - } else { - tt = this._token.type; - } - - return tt; - - }, - LT: function(index){ - this.LA(index); - return this._lt[this._ltIndex+index-1]; - }, - peek: function(){ - return this.LA(1); - }, - token: function(){ - return this._token; - }, - tokenName: function(tokenType){ - if (tokenType < 0 || tokenType > this._tokenData.length){ - return "UNKNOWN_TOKEN"; - } else { - return this._tokenData[tokenType].name; - } - }, - tokenType: function(tokenName){ - return this._tokenData[tokenName] || -1; - }, - unget: function(){ - if (this._ltIndexCache.length){ - this._ltIndex -= this._ltIndexCache.pop();//--; - this._token = this._lt[this._ltIndex - 1]; - } else { - throw new Error("Too much lookahead."); - } - } - -}; - - -parserlib.util = { -StringReader: StringReader, -SyntaxError : SyntaxError, -SyntaxUnit : SyntaxUnit, -EventTarget : EventTarget, -TokenStreamBase : TokenStreamBase -}; -})(); -(function(){ -var EventTarget = parserlib.util.EventTarget, -TokenStreamBase = parserlib.util.TokenStreamBase, -StringReader = parserlib.util.StringReader, -SyntaxError = parserlib.util.SyntaxError, -SyntaxUnit = parserlib.util.SyntaxUnit; - -var Colors = { - aliceblue :"#f0f8ff", - antiquewhite :"#faebd7", - aqua :"#00ffff", - aquamarine :"#7fffd4", - azure :"#f0ffff", - beige :"#f5f5dc", - bisque :"#ffe4c4", - black :"#000000", - blanchedalmond :"#ffebcd", - blue :"#0000ff", - blueviolet :"#8a2be2", - brown :"#a52a2a", - burlywood :"#deb887", - cadetblue :"#5f9ea0", - chartreuse :"#7fff00", - chocolate :"#d2691e", - coral :"#ff7f50", - cornflowerblue :"#6495ed", - cornsilk :"#fff8dc", - crimson :"#dc143c", - cyan :"#00ffff", - darkblue :"#00008b", - darkcyan :"#008b8b", - darkgoldenrod :"#b8860b", - darkgray :"#a9a9a9", - darkgrey :"#a9a9a9", - darkgreen :"#006400", - darkkhaki :"#bdb76b", - darkmagenta :"#8b008b", - darkolivegreen :"#556b2f", - darkorange :"#ff8c00", - darkorchid :"#9932cc", - darkred :"#8b0000", - darksalmon :"#e9967a", - darkseagreen :"#8fbc8f", - darkslateblue :"#483d8b", - darkslategray :"#2f4f4f", - darkslategrey :"#2f4f4f", - darkturquoise :"#00ced1", - darkviolet :"#9400d3", - deeppink :"#ff1493", - deepskyblue :"#00bfff", - dimgray :"#696969", - dimgrey :"#696969", - dodgerblue :"#1e90ff", - firebrick :"#b22222", - floralwhite :"#fffaf0", - forestgreen :"#228b22", - fuchsia :"#ff00ff", - gainsboro :"#dcdcdc", - ghostwhite :"#f8f8ff", - gold :"#ffd700", - goldenrod :"#daa520", - gray :"#808080", - grey :"#808080", - green :"#008000", - greenyellow :"#adff2f", - honeydew :"#f0fff0", - hotpink :"#ff69b4", - indianred :"#cd5c5c", - indigo :"#4b0082", - ivory :"#fffff0", - khaki :"#f0e68c", - lavender :"#e6e6fa", - lavenderblush :"#fff0f5", - lawngreen :"#7cfc00", - lemonchiffon :"#fffacd", - lightblue :"#add8e6", - lightcoral :"#f08080", - lightcyan :"#e0ffff", - lightgoldenrodyellow :"#fafad2", - lightgray :"#d3d3d3", - lightgrey :"#d3d3d3", - lightgreen :"#90ee90", - lightpink :"#ffb6c1", - lightsalmon :"#ffa07a", - lightseagreen :"#20b2aa", - lightskyblue :"#87cefa", - lightslategray :"#778899", - lightslategrey :"#778899", - lightsteelblue :"#b0c4de", - lightyellow :"#ffffe0", - lime :"#00ff00", - limegreen :"#32cd32", - linen :"#faf0e6", - magenta :"#ff00ff", - maroon :"#800000", - mediumaquamarine:"#66cdaa", - mediumblue :"#0000cd", - mediumorchid :"#ba55d3", - mediumpurple :"#9370d8", - mediumseagreen :"#3cb371", - mediumslateblue :"#7b68ee", - mediumspringgreen :"#00fa9a", - mediumturquoise :"#48d1cc", - mediumvioletred :"#c71585", - midnightblue :"#191970", - mintcream :"#f5fffa", - mistyrose :"#ffe4e1", - moccasin :"#ffe4b5", - navajowhite :"#ffdead", - navy :"#000080", - oldlace :"#fdf5e6", - olive :"#808000", - olivedrab :"#6b8e23", - orange :"#ffa500", - orangered :"#ff4500", - orchid :"#da70d6", - palegoldenrod :"#eee8aa", - palegreen :"#98fb98", - paleturquoise :"#afeeee", - palevioletred :"#d87093", - papayawhip :"#ffefd5", - peachpuff :"#ffdab9", - peru :"#cd853f", - pink :"#ffc0cb", - plum :"#dda0dd", - powderblue :"#b0e0e6", - purple :"#800080", - red :"#ff0000", - rosybrown :"#bc8f8f", - royalblue :"#4169e1", - saddlebrown :"#8b4513", - salmon :"#fa8072", - sandybrown :"#f4a460", - seagreen :"#2e8b57", - seashell :"#fff5ee", - sienna :"#a0522d", - silver :"#c0c0c0", - skyblue :"#87ceeb", - slateblue :"#6a5acd", - slategray :"#708090", - slategrey :"#708090", - snow :"#fffafa", - springgreen :"#00ff7f", - steelblue :"#4682b4", - tan :"#d2b48c", - teal :"#008080", - thistle :"#d8bfd8", - tomato :"#ff6347", - turquoise :"#40e0d0", - violet :"#ee82ee", - wheat :"#f5deb3", - white :"#ffffff", - whitesmoke :"#f5f5f5", - yellow :"#ffff00", - yellowgreen :"#9acd32", - activeBorder :"Active window border.", - activecaption :"Active window caption.", - appworkspace :"Background color of multiple document interface.", - background :"Desktop background.", - buttonface :"The face background color for 3-D elements that appear 3-D due to one layer of surrounding border.", - buttonhighlight :"The color of the border facing the light source for 3-D elements that appear 3-D due to one layer of surrounding border.", - buttonshadow :"The color of the border away from the light source for 3-D elements that appear 3-D due to one layer of surrounding border.", - buttontext :"Text on push buttons.", - captiontext :"Text in caption, size box, and scrollbar arrow box.", - graytext :"Grayed (disabled) text. This color is set to #000 if the current display driver does not support a solid gray color.", - greytext :"Greyed (disabled) text. This color is set to #000 if the current display driver does not support a solid grey color.", - highlight :"Item(s) selected in a control.", - highlighttext :"Text of item(s) selected in a control.", - inactiveborder :"Inactive window border.", - inactivecaption :"Inactive window caption.", - inactivecaptiontext :"Color of text in an inactive caption.", - infobackground :"Background color for tooltip controls.", - infotext :"Text color for tooltip controls.", - menu :"Menu background.", - menutext :"Text in menus.", - scrollbar :"Scroll bar gray area.", - threeddarkshadow :"The color of the darker (generally outer) of the two borders away from the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.", - threedface :"The face background color for 3-D elements that appear 3-D due to two concentric layers of surrounding border.", - threedhighlight :"The color of the lighter (generally outer) of the two borders facing the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.", - threedlightshadow :"The color of the darker (generally inner) of the two borders facing the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.", - threedshadow :"The color of the lighter (generally inner) of the two borders away from the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.", - window :"Window background.", - windowframe :"Window frame.", - windowtext :"Text in windows." -}; -function Combinator(text, line, col){ +var Parser = require("./Parser"); +function Combinator(text, line, col) { SyntaxUnit.call(this, text, line, col, Parser.COMBINATOR_TYPE); this.type = "unknown"; - if (/^\s+$/.test(text)){ + if (/^\s+$/.test(text)) { this.type = "descendant"; - } else if (text == ">"){ + } else if (text === ">") { this.type = "child"; - } else if (text == "+"){ + } else if (text === "+") { this.type = "adjacent-sibling"; - } else if (text == "~"){ + } else if (text === "~") { this.type = "sibling"; } @@ -2000,7 +1639,322 @@ function Combinator(text, line, col){ Combinator.prototype = new SyntaxUnit(); Combinator.prototype.constructor = Combinator; -function MediaFeature(name, value){ + + +},{"../util/SyntaxUnit":26,"./Parser":6}],3:[function(require,module,exports){ +"use strict"; + +module.exports = Matcher; + +var StringReader = require("../util/StringReader"); +var SyntaxError = require("../util/SyntaxError"); +function Matcher(matchFunc, toString) { + this.match = function(expression) { + var result; + expression.mark(); + result = matchFunc(expression); + if (result) { + expression.drop(); + } else { + expression.restore(); + } + return result; + }; + this.toString = typeof toString === "function" ? toString : function() { + return toString; + }; +} +Matcher.prec = { + MOD: 5, + SEQ: 4, + ANDAND: 3, + OROR: 2, + ALT: 1 +}; +Matcher.parse = function(str) { + var reader, eat, expr, oror, andand, seq, mod, term, result; + reader = new StringReader(str); + eat = function(matcher) { + var result = reader.readMatch(matcher); + if (result === null) { + throw new SyntaxError( + "Expected " + matcher, reader.getLine(), reader.getCol()); + } + return result; + }; + expr = function() { + var m = [ oror() ]; + while (reader.readMatch(" | ") !== null) { + m.push(oror()); + } + return m.length === 1 ? m[0] : Matcher.alt.apply(Matcher, m); + }; + oror = function() { + var m = [ andand() ]; + while (reader.readMatch(" || ") !== null) { + m.push(andand()); + } + return m.length === 1 ? m[0] : Matcher.oror.apply(Matcher, m); + }; + andand = function() { + var m = [ seq() ]; + while (reader.readMatch(" && ") !== null) { + m.push(seq()); + } + return m.length === 1 ? m[0] : Matcher.andand.apply(Matcher, m); + }; + seq = function() { + var m = [ mod() ]; + while (reader.readMatch(/^ (?![&|\]])/) !== null) { + m.push(mod()); + } + return m.length === 1 ? m[0] : Matcher.seq.apply(Matcher, m); + }; + mod = function() { + var m = term(); + if (reader.readMatch("?") !== null) { + return m.question(); + } else if (reader.readMatch("*") !== null) { + return m.star(); + } else if (reader.readMatch("+") !== null) { + return m.plus(); + } else if (reader.readMatch("#") !== null) { + return m.hash(); + } else if (reader.readMatch(/^\{\s*/) !== null) { + var min = eat(/^\d+/); + eat(/^\s*,\s*/); + var max = eat(/^\d+/); + eat(/^\s*\}/); + return m.braces(Number(min), Number(max)); + } + return m; + }; + term = function() { + if (reader.readMatch("[ ") !== null) { + var m = expr(); + eat(" ]"); + return m; + } + return Matcher.fromType(eat(/^[^ ?*+#{]+/)); + }; + result = expr(); + if (!reader.eof()) { + throw new SyntaxError( + "Expected end of string", reader.getLine(), reader.getCol()); + } + return result; +}; +Matcher.cast = function(m) { + if (m instanceof Matcher) { + return m; + } + return Matcher.parse(m); +}; +Matcher.fromType = function(type) { + var ValidationTypes = require("./ValidationTypes"); + return new Matcher(function(expression) { + return expression.hasNext() && ValidationTypes.isType(expression, type); + }, type); +}; +Matcher.seq = function() { + var ms = Array.prototype.slice.call(arguments).map(Matcher.cast); + if (ms.length === 1) { + return ms[0]; + } + return new Matcher(function(expression) { + var i, result = true; + for (i = 0; result && i < ms.length; i++) { + result = ms[i].match(expression); + } + return result; + }, function(prec) { + var p = Matcher.prec.SEQ; + var s = ms.map(function(m) { + return m.toString(p); + }).join(" "); + if (prec > p) { + s = "[ " + s + " ]"; + } + return s; + }); +}; +Matcher.alt = function() { + var ms = Array.prototype.slice.call(arguments).map(Matcher.cast); + if (ms.length === 1) { + return ms[0]; + } + return new Matcher(function(expression) { + var i, result = false; + for (i = 0; !result && i < ms.length; i++) { + result = ms[i].match(expression); + } + return result; + }, function(prec) { + var p = Matcher.prec.ALT; + var s = ms.map(function(m) { + return m.toString(p); + }).join(" | "); + if (prec > p) { + s = "[ " + s + " ]"; + } + return s; + }); +}; +Matcher.many = function(required) { + var ms = Array.prototype.slice.call(arguments, 1).reduce(function(acc, v) { + if (v.expand) { + var ValidationTypes = require("./ValidationTypes"); + acc.push.apply(acc, ValidationTypes.complex[v.expand].options); + } else { + acc.push(Matcher.cast(v)); + } + return acc; + }, []); + + if (required === true) { + required = ms.map(function() { + return true; + }); + } + + var result = new Matcher(function(expression) { + var seen = [], max = 0, pass = 0; + var success = function(matchCount) { + if (pass === 0) { + max = Math.max(matchCount, max); + return matchCount === ms.length; + } else { + return matchCount === max; + } + }; + var tryMatch = function(matchCount) { + for (var i = 0; i < ms.length; i++) { + if (seen[i]) { + continue; + } + expression.mark(); + if (ms[i].match(expression)) { + seen[i] = true; + if (tryMatch(matchCount + (required === false || required[i] ? 1 : 0))) { + expression.drop(); + return true; + } + expression.restore(); + seen[i] = false; + } else { + expression.drop(); + } + } + return success(matchCount); + }; + if (!tryMatch(0)) { + pass++; + tryMatch(0); + } + + if (required === false) { + return max > 0; + } + for (var i = 0; i < ms.length; i++) { + if (required[i] && !seen[i]) { + return false; + } + } + return true; + }, function(prec) { + var p = required === false ? Matcher.prec.OROR : Matcher.prec.ANDAND; + var s = ms.map(function(m, i) { + if (required !== false && !required[i]) { + return m.toString(Matcher.prec.MOD) + "?"; + } + return m.toString(p); + }).join(required === false ? " || " : " && "); + if (prec > p) { + s = "[ " + s + " ]"; + } + return s; + }); + result.options = ms; + return result; +}; +Matcher.andand = function() { + var args = Array.prototype.slice.call(arguments); + args.unshift(true); + return Matcher.many.apply(Matcher, args); +}; +Matcher.oror = function() { + var args = Array.prototype.slice.call(arguments); + args.unshift(false); + return Matcher.many.apply(Matcher, args); +}; +Matcher.prototype = { + constructor: Matcher, + match: function() { + throw new Error("unimplemented"); + }, + toString: function() { + throw new Error("unimplemented"); + }, + func: function() { + return this.match.bind(this); + }, + then: function(m) { + return Matcher.seq(this, m); + }, + or: function(m) { + return Matcher.alt(this, m); + }, + andand: function(m) { + return Matcher.many(true, this, m); + }, + oror: function(m) { + return Matcher.many(false, this, m); + }, + star: function() { + return this.braces(0, Infinity, "*"); + }, + plus: function() { + return this.braces(1, Infinity, "+"); + }, + question: function() { + return this.braces(0, 1, "?"); + }, + hash: function() { + return this.braces(1, Infinity, "#", Matcher.cast(",")); + }, + braces: function(min, max, marker, optSep) { + var m1 = this, m2 = optSep ? optSep.then(this) : this; + if (!marker) { + marker = "{" + min + "," + max + "}"; + } + return new Matcher(function(expression) { + var result = true, i; + for (i = 0; i < max; i++) { + if (i > 0 && optSep) { + result = m2.match(expression); + } else { + result = m1.match(expression); + } + if (!result) { + break; + } + } + return i >= min; + }, function() { + return m1.toString(Matcher.prec.MOD) + marker; + }); + } +}; + +},{"../util/StringReader":24,"../util/SyntaxError":25,"./ValidationTypes":21}],4:[function(require,module,exports){ +"use strict"; + +module.exports = MediaFeature; + +var SyntaxUnit = require("../util/SyntaxUnit"); + +var Parser = require("./Parser"); +function MediaFeature(name, value) { SyntaxUnit.call(this, "(" + name + (value !== null ? ":" + value : "") + ")", name.startLine, name.startCol, Parser.MEDIA_FEATURE_TYPE); this.name = name; @@ -2009,9 +1963,19 @@ function MediaFeature(name, value){ MediaFeature.prototype = new SyntaxUnit(); MediaFeature.prototype.constructor = MediaFeature; -function MediaQuery(modifier, mediaType, features, line, col){ - SyntaxUnit.call(this, (modifier ? modifier + " ": "") + (mediaType ? mediaType : "") + (mediaType && features.length > 0 ? " and " : "") + features.join(" and "), line, col, Parser.MEDIA_QUERY_TYPE); + +},{"../util/SyntaxUnit":26,"./Parser":6}],5:[function(require,module,exports){ +"use strict"; + +module.exports = MediaQuery; + +var SyntaxUnit = require("../util/SyntaxUnit"); + +var Parser = require("./Parser"); +function MediaQuery(modifier, mediaType, features, line, col) { + + SyntaxUnit.call(this, (modifier ? modifier + " " : "") + (mediaType ? mediaType : "") + (mediaType && features.length > 0 ? " and " : "") + features.join(" and "), line, col, Parser.MEDIA_QUERY_TYPE); this.modifier = modifier; this.mediaType = mediaType; this.features = features; @@ -2020,7 +1984,30 @@ function MediaQuery(modifier, mediaType, features, line, col){ MediaQuery.prototype = new SyntaxUnit(); MediaQuery.prototype.constructor = MediaQuery; -function Parser(options){ + + +},{"../util/SyntaxUnit":26,"./Parser":6}],6:[function(require,module,exports){ +"use strict"; + +module.exports = Parser; + +var EventTarget = require("../util/EventTarget"); +var SyntaxError = require("../util/SyntaxError"); +var SyntaxUnit = require("../util/SyntaxUnit"); + +var Combinator = require("./Combinator"); +var MediaFeature = require("./MediaFeature"); +var MediaQuery = require("./MediaQuery"); +var PropertyName = require("./PropertyName"); +var PropertyValue = require("./PropertyValue"); +var PropertyValuePart = require("./PropertyValuePart"); +var Selector = require("./Selector"); +var SelectorPart = require("./SelectorPart"); +var SelectorSubPart = require("./SelectorSubPart"); +var TokenStream = require("./TokenStream"); +var Tokens = require("./Tokens"); +var Validation = require("./Validation"); +function Parser(options) { EventTarget.call(this); @@ -2039,11 +2026,12 @@ Parser.SELECTOR_TYPE = 7; Parser.SELECTOR_PART_TYPE = 8; Parser.SELECTOR_SUB_PART_TYPE = 9; -Parser.prototype = function(){ +Parser.prototype = function() { - var proto = new EventTarget(), //new prototype + var proto = new EventTarget(), // new prototype prop, additions = { + __proto__: null, constructor: Parser, DEFAULT_TYPE : 0, COMBINATOR_TYPE : 1, @@ -2056,10 +2044,9 @@ Parser.prototype = function(){ SELECTOR_PART_TYPE : 8, SELECTOR_SUB_PART_TYPE : 9, - _stylesheet: function(){ + _stylesheet: function() { var tokenStream = this._tokenStream, - charset = null, count, token, tt; @@ -2068,20 +2055,20 @@ Parser.prototype = function(){ this._charset(); this._skipCruft(); - while (tokenStream.peek() == Tokens.IMPORT_SYM){ + while (tokenStream.peek() === Tokens.IMPORT_SYM) { this._import(); this._skipCruft(); } - while (tokenStream.peek() == Tokens.NAMESPACE_SYM){ + while (tokenStream.peek() === Tokens.NAMESPACE_SYM) { this._namespace(); this._skipCruft(); } tt = tokenStream.peek(); - while(tt > Tokens.EOF){ + while (tt > Tokens.EOF) { try { - switch(tt){ + switch (tt) { case Tokens.MEDIA_SYM: this._media(); this._skipCruft(); @@ -2102,9 +2089,17 @@ Parser.prototype = function(){ this._viewport(); this._skipCruft(); break; - case Tokens.UNKNOWN_SYM: //unknown @ rule + case Tokens.DOCUMENT_SYM: + this._document(); + this._skipCruft(); + break; + case Tokens.SUPPORTS_SYM: + this._supports(); + this._skipCruft(); + break; + case Tokens.UNKNOWN_SYM: // unknown @ rule tokenStream.get(); - if (!this.options.strict){ + if (!this.options.strict) { this.fire({ type: "error", error: null, @@ -2112,12 +2107,12 @@ Parser.prototype = function(){ line: tokenStream.LT(0).startLine, col: tokenStream.LT(0).startCol }); - count=0; - while (tokenStream.advance([Tokens.LBRACE, Tokens.RBRACE]) == Tokens.LBRACE){ - count++; //keep track of nesting depth + count = 0; + while (tokenStream.advance([Tokens.LBRACE, Tokens.RBRACE]) === Tokens.LBRACE) { + count++; // keep track of nesting depth } - while(count){ + while (count) { tokenStream.advance([Tokens.RBRACE]); count--; } @@ -2130,8 +2125,8 @@ Parser.prototype = function(){ this._readWhitespace(); break; default: - if(!this._ruleset()){ - switch(tt){ + if (!this._ruleset()) { + switch (tt) { case Tokens.CHARSET_SYM: token = tokenStream.LT(1); this._charset(false); @@ -2145,14 +2140,14 @@ Parser.prototype = function(){ this._namespace(false); throw new SyntaxError("@namespace not allowed here.", token.startLine, token.startCol); default: - tokenStream.get(); //get the last token + tokenStream.get(); // get the last token this._unexpectedToken(tokenStream.token()); } } } - } catch(ex) { - if (ex instanceof SyntaxError && !this.options.strict){ + } catch (ex) { + if (ex instanceof SyntaxError && !this.options.strict) { this.fire({ type: "error", error: ex, @@ -2168,21 +2163,21 @@ Parser.prototype = function(){ tt = tokenStream.peek(); } - if (tt != Tokens.EOF){ + if (tt !== Tokens.EOF) { this._unexpectedToken(tokenStream.token()); } this.fire("endstylesheet"); }, - _charset: function(emit){ + _charset: function(emit) { var tokenStream = this._tokenStream, charset, token, line, col; - if (tokenStream.match(Tokens.CHARSET_SYM)){ + if (tokenStream.match(Tokens.CHARSET_SYM)) { line = tokenStream.token().startLine; col = tokenStream.token().startCol; @@ -2195,7 +2190,7 @@ Parser.prototype = function(){ this._readWhitespace(); tokenStream.mustMatch(Tokens.SEMICOLON); - if (emit !== false){ + if (emit !== false) { this.fire({ type: "charset", charset:charset, @@ -2206,10 +2201,9 @@ Parser.prototype = function(){ } }, - _import: function(emit){ + _import: function(emit) { var tokenStream = this._tokenStream, - tt, uri, importToken, mediaList = []; @@ -2226,7 +2220,7 @@ Parser.prototype = function(){ tokenStream.mustMatch(Tokens.SEMICOLON); this._readWhitespace(); - if (emit !== false){ + if (emit !== false) { this.fire({ type: "import", uri: uri, @@ -2238,7 +2232,7 @@ Parser.prototype = function(){ }, - _namespace: function(emit){ + _namespace: function(emit) { var tokenStream = this._tokenStream, line, @@ -2249,7 +2243,7 @@ Parser.prototype = function(){ line = tokenStream.token().startLine; col = tokenStream.token().startCol; this._readWhitespace(); - if (tokenStream.match(Tokens.IDENT)){ + if (tokenStream.match(Tokens.IDENT)) { prefix = tokenStream.token().value; this._readWhitespace(); } @@ -2261,7 +2255,7 @@ Parser.prototype = function(){ tokenStream.mustMatch(Tokens.SEMICOLON); this._readWhitespace(); - if (emit !== false){ + if (emit !== false) { this.fire({ type: "namespace", prefix: prefix, @@ -2273,11 +2267,119 @@ Parser.prototype = function(){ }, - _media: function(){ + _supports: function(emit) { + var tokenStream = this._tokenStream, + line, + col; + + if (tokenStream.match(Tokens.SUPPORTS_SYM)) { + line = tokenStream.token().startLine; + col = tokenStream.token().startCol; + + this._readWhitespace(); + this._supports_condition(); + this._readWhitespace(); + + tokenStream.mustMatch(Tokens.LBRACE); + this._readWhitespace(); + + if (emit !== false) { + this.fire({ + type: "startsupports", + line: line, + col: col + }); + } + + while (true) { + if (!this._ruleset()) { + break; + } + } + + tokenStream.mustMatch(Tokens.RBRACE); + this._readWhitespace(); + + this.fire({ + type: "endsupports", + line: line, + col: col + }); + } + }, + + _supports_condition: function() { + var tokenStream = this._tokenStream, + ident; + + if (tokenStream.match(Tokens.IDENT)) { + ident = tokenStream.token().value.toLowerCase(); + + if (ident === "not") { + tokenStream.mustMatch(Tokens.S); + this._supports_condition_in_parens(); + } else { + tokenStream.unget(); + } + } else { + this._supports_condition_in_parens(); + this._readWhitespace(); + + while (tokenStream.peek() === Tokens.IDENT) { + ident = tokenStream.LT(1).value.toLowerCase(); + if (ident === "and" || ident === "or") { + tokenStream.mustMatch(Tokens.IDENT); + this._readWhitespace(); + this._supports_condition_in_parens(); + this._readWhitespace(); + } + } + } + }, + + _supports_condition_in_parens: function() { + var tokenStream = this._tokenStream, + ident; + + if (tokenStream.match(Tokens.LPAREN)) { + this._readWhitespace(); + if (tokenStream.match(Tokens.IDENT)) { + ident = tokenStream.token().value.toLowerCase(); + if (ident === "not") { + this._readWhitespace(); + this._supports_condition(); + this._readWhitespace(); + tokenStream.mustMatch(Tokens.RPAREN); + } else { + tokenStream.unget(); + this._supports_declaration_condition(false); + } + } else { + this._supports_condition(); + this._readWhitespace(); + tokenStream.mustMatch(Tokens.RPAREN); + } + } else { + this._supports_declaration_condition(); + } + }, + + _supports_declaration_condition: function(requireStartParen) { + var tokenStream = this._tokenStream; + + if (requireStartParen !== false) { + tokenStream.mustMatch(Tokens.LPAREN); + } + this._readWhitespace(); + this._declaration(); + tokenStream.mustMatch(Tokens.RPAREN); + }, + + _media: function() { var tokenStream = this._tokenStream, line, col, - mediaList;// = []; + mediaList; // = []; tokenStream.mustMatch(Tokens.MEDIA_SYM); line = tokenStream.token().startLine; col = tokenStream.token().startCol; @@ -2296,14 +2398,20 @@ Parser.prototype = function(){ col: col }); - while(true) { - if (tokenStream.peek() == Tokens.PAGE_SYM){ + while (true) { + if (tokenStream.peek() === Tokens.PAGE_SYM) { this._page(); - } else if (tokenStream.peek() == Tokens.FONT_FACE_SYM){ + } else if (tokenStream.peek() === Tokens.FONT_FACE_SYM) { this._font_face(); - } else if (tokenStream.peek() == Tokens.VIEWPORT_SYM){ + } else if (tokenStream.peek() === Tokens.VIEWPORT_SYM) { this._viewport(); - } else if (!this._ruleset()){ + } else if (tokenStream.peek() === Tokens.DOCUMENT_SYM) { + this._document(); + } else if (tokenStream.peek() === Tokens.SUPPORTS_SYM) { + this._supports(); + } else if (tokenStream.peek() === Tokens.MEDIA_SYM) { + this._media(); + } else if (!this._ruleset()) { break; } } @@ -2318,34 +2426,34 @@ Parser.prototype = function(){ col: col }); }, - _media_query_list: function(){ + _media_query_list: function() { var tokenStream = this._tokenStream, mediaList = []; this._readWhitespace(); - if (tokenStream.peek() == Tokens.IDENT || tokenStream.peek() == Tokens.LPAREN){ + if (tokenStream.peek() === Tokens.IDENT || tokenStream.peek() === Tokens.LPAREN) { mediaList.push(this._media_query()); } - while(tokenStream.match(Tokens.COMMA)){ + while (tokenStream.match(Tokens.COMMA)) { this._readWhitespace(); mediaList.push(this._media_query()); } return mediaList; }, - _media_query: function(){ + _media_query: function() { var tokenStream = this._tokenStream, type = null, ident = null, token = null, expressions = []; - if (tokenStream.match(Tokens.IDENT)){ + if (tokenStream.match(Tokens.IDENT)) { ident = tokenStream.token().value.toLowerCase(); - if (ident != "only" && ident != "not"){ + if (ident !== "only" && ident !== "not") { tokenStream.unget(); ident = null; } else { @@ -2355,24 +2463,24 @@ Parser.prototype = function(){ this._readWhitespace(); - if (tokenStream.peek() == Tokens.IDENT){ + if (tokenStream.peek() === Tokens.IDENT) { type = this._media_type(); - if (token === null){ + if (token === null) { token = tokenStream.token(); } - } else if (tokenStream.peek() == Tokens.LPAREN){ - if (token === null){ + } else if (tokenStream.peek() === Tokens.LPAREN) { + if (token === null) { token = tokenStream.LT(1); } expressions.push(this._media_expression()); } - if (type === null && expressions.length === 0){ + if (type === null && expressions.length === 0) { return null; } else { this._readWhitespace(); - while (tokenStream.match(Tokens.IDENT)){ - if (tokenStream.token().value.toLowerCase() != "and"){ + while (tokenStream.match(Tokens.IDENT)) { + if (tokenStream.token().value.toLowerCase() !== "and") { this._unexpectedToken(tokenStream.token()); } @@ -2383,10 +2491,10 @@ Parser.prototype = function(){ return new MediaQuery(ident, type, expressions, token.startLine, token.startCol); }, - _media_type: function(){ + _media_type: function() { return this._media_feature(); }, - _media_expression: function(){ + _media_expression: function() { var tokenStream = this._tokenStream, feature = null, token, @@ -2398,7 +2506,7 @@ Parser.prototype = function(){ feature = this._media_feature(); this._readWhitespace(); - if (tokenStream.match(Tokens.COLON)){ + if (tokenStream.match(Tokens.COLON)) { this._readWhitespace(); token = tokenStream.LT(1); expression = this._expression(); @@ -2407,16 +2515,18 @@ Parser.prototype = function(){ tokenStream.mustMatch(Tokens.RPAREN); this._readWhitespace(); - return new MediaFeature(feature, (expression ? new SyntaxUnit(expression, token.startLine, token.startCol) : null)); + return new MediaFeature(feature, expression ? new SyntaxUnit(expression, token.startLine, token.startCol) : null); }, - _media_feature: function(){ + _media_feature: function() { var tokenStream = this._tokenStream; + this._readWhitespace(); + tokenStream.mustMatch(Tokens.IDENT); return SyntaxUnit.fromToken(tokenStream.token()); }, - _page: function(){ + _page: function() { var tokenStream = this._tokenStream, line, col, @@ -2428,13 +2538,13 @@ Parser.prototype = function(){ this._readWhitespace(); - if (tokenStream.match(Tokens.IDENT)){ + if (tokenStream.match(Tokens.IDENT)) { identifier = tokenStream.token().value; - if (identifier.toLowerCase() === "auto"){ + if (identifier.toLowerCase() === "auto") { this._unexpectedToken(tokenStream.token()); } } - if (tokenStream.peek() == Tokens.COLON){ + if (tokenStream.peek() === Tokens.COLON) { pseudoPage = this._pseudo_page(); } @@ -2459,13 +2569,13 @@ Parser.prototype = function(){ }); }, - _margin: function(){ + _margin: function() { var tokenStream = this._tokenStream, line, col, marginSym = this._margin_sym(); - if (marginSym){ + if (marginSym) { line = tokenStream.token().startLine; col = tokenStream.token().startCol; @@ -2489,18 +2599,17 @@ Parser.prototype = function(){ return false; } }, - _margin_sym: function(){ + _margin_sym: function() { var tokenStream = this._tokenStream; - if(tokenStream.match([Tokens.TOPLEFTCORNER_SYM, Tokens.TOPLEFT_SYM, - Tokens.TOPCENTER_SYM, Tokens.TOPRIGHT_SYM, Tokens.TOPRIGHTCORNER_SYM, - Tokens.BOTTOMLEFTCORNER_SYM, Tokens.BOTTOMLEFT_SYM, - Tokens.BOTTOMCENTER_SYM, Tokens.BOTTOMRIGHT_SYM, - Tokens.BOTTOMRIGHTCORNER_SYM, Tokens.LEFTTOP_SYM, - Tokens.LEFTMIDDLE_SYM, Tokens.LEFTBOTTOM_SYM, Tokens.RIGHTTOP_SYM, - Tokens.RIGHTMIDDLE_SYM, Tokens.RIGHTBOTTOM_SYM])) - { + if (tokenStream.match([Tokens.TOPLEFTCORNER_SYM, Tokens.TOPLEFT_SYM, + Tokens.TOPCENTER_SYM, Tokens.TOPRIGHT_SYM, Tokens.TOPRIGHTCORNER_SYM, + Tokens.BOTTOMLEFTCORNER_SYM, Tokens.BOTTOMLEFT_SYM, + Tokens.BOTTOMCENTER_SYM, Tokens.BOTTOMRIGHT_SYM, + Tokens.BOTTOMRIGHTCORNER_SYM, Tokens.LEFTTOP_SYM, + Tokens.LEFTMIDDLE_SYM, Tokens.LEFTBOTTOM_SYM, Tokens.RIGHTTOP_SYM, + Tokens.RIGHTMIDDLE_SYM, Tokens.RIGHTBOTTOM_SYM])) { return SyntaxUnit.fromToken(tokenStream.token()); } else { return null; @@ -2508,7 +2617,7 @@ Parser.prototype = function(){ }, - _pseudo_page: function(){ + _pseudo_page: function() { var tokenStream = this._tokenStream; @@ -2518,7 +2627,7 @@ Parser.prototype = function(){ return tokenStream.token().value; }, - _font_face: function(){ + _font_face: function() { var tokenStream = this._tokenStream, line, col; @@ -2543,40 +2652,126 @@ Parser.prototype = function(){ }); }, - _viewport: function(){ - var tokenStream = this._tokenStream, + _viewport: function() { + var tokenStream = this._tokenStream, line, col; - tokenStream.mustMatch(Tokens.VIEWPORT_SYM); - line = tokenStream.token().startLine; - col = tokenStream.token().startCol; + tokenStream.mustMatch(Tokens.VIEWPORT_SYM); + line = tokenStream.token().startLine; + col = tokenStream.token().startCol; - this._readWhitespace(); + this._readWhitespace(); - this.fire({ - type: "startviewport", - line: line, - col: col - }); + this.fire({ + type: "startviewport", + line: line, + col: col + }); - this._readDeclarations(true); + this._readDeclarations(true); - this.fire({ - type: "endviewport", - line: line, - col: col - }); + this.fire({ + type: "endviewport", + line: line, + col: col + }); }, - _operator: function(inFunction){ + _document: function() { + + var tokenStream = this._tokenStream, + token, + functions = [], + prefix = ""; + + tokenStream.mustMatch(Tokens.DOCUMENT_SYM); + token = tokenStream.token(); + if (/^@-([^-]+)-/.test(token.value)) { + prefix = RegExp.$1; + } + + this._readWhitespace(); + functions.push(this._document_function()); + + while (tokenStream.match(Tokens.COMMA)) { + this._readWhitespace(); + functions.push(this._document_function()); + } + + tokenStream.mustMatch(Tokens.LBRACE); + this._readWhitespace(); + + this.fire({ + type: "startdocument", + functions: functions, + prefix: prefix, + line: token.startLine, + col: token.startCol + }); + + var ok = true; + while (ok) { + switch (tokenStream.peek()) { + case Tokens.PAGE_SYM: + this._page(); + break; + case Tokens.FONT_FACE_SYM: + this._font_face(); + break; + case Tokens.VIEWPORT_SYM: + this._viewport(); + break; + case Tokens.MEDIA_SYM: + this._media(); + break; + case Tokens.KEYFRAMES_SYM: + this._keyframes(); + break; + case Tokens.DOCUMENT_SYM: + this._document(); + break; + default: + ok = Boolean(this._ruleset()); + } + } + + tokenStream.mustMatch(Tokens.RBRACE); + token = tokenStream.token(); + this._readWhitespace(); + + this.fire({ + type: "enddocument", + functions: functions, + prefix: prefix, + line: token.startLine, + col: token.startCol + }); + }, + + _document_function: function() { + + var tokenStream = this._tokenStream, + value; + + if (tokenStream.match(Tokens.URI)) { + value = tokenStream.token().value; + this._readWhitespace(); + } else { + value = this._function(); + } + + return value; + }, + + _operator: function(inFunction) { var tokenStream = this._tokenStream, token = null; if (tokenStream.match([Tokens.SLASH, Tokens.COMMA]) || - (inFunction && tokenStream.match([Tokens.PLUS, Tokens.STAR, Tokens.MINUS]))){ + inFunction && tokenStream.match([Tokens.PLUS, Tokens.STAR, Tokens.MINUS])) { token = tokenStream.token(); this._readWhitespace(); } @@ -2584,13 +2779,13 @@ Parser.prototype = function(){ }, - _combinator: function(){ + _combinator: function() { var tokenStream = this._tokenStream, value = null, token; - if(tokenStream.match([Tokens.PLUS, Tokens.GREATER, Tokens.TILDE])){ + if (tokenStream.match([Tokens.PLUS, Tokens.GREATER, Tokens.TILDE])) { token = tokenStream.token(); value = new Combinator(token.value, token.startLine, token.startCol); this._readWhitespace(); @@ -2599,57 +2794,67 @@ Parser.prototype = function(){ return value; }, - _unary_operator: function(){ + _unary_operator: function() { var tokenStream = this._tokenStream; - if (tokenStream.match([Tokens.MINUS, Tokens.PLUS])){ + if (tokenStream.match([Tokens.MINUS, Tokens.PLUS])) { return tokenStream.token().value; } else { return null; } }, - _property: function(){ + _property: function() { - var tokenStream = this._tokenStream, - value = null, - hack = null, - tokenValue, + var tokenStream = this._tokenStream, + value = null, + hack = null, + propertyName = "", token, line, col; - if (tokenStream.peek() == Tokens.STAR && this.options.starHack){ + if (tokenStream.peek() === Tokens.STAR && this.options.starHack) { tokenStream.get(); token = tokenStream.token(); hack = token.value; line = token.startLine; col = token.startCol; } - - if(tokenStream.match(Tokens.IDENT)){ + if (tokenStream.peek() === Tokens.MINUS) { + tokenStream.get(); token = tokenStream.token(); - tokenValue = token.value; - if (tokenValue.charAt(0) == "_" && this.options.underscoreHack){ + propertyName = token.value; + line = token.startLine; + col = token.startCol; + } + + if (tokenStream.match(Tokens.IDENT)) { + token = tokenStream.token(); + propertyName += token.value; + if (propertyName.charAt(0) === "_" && this.options.underscoreHack) { hack = "_"; - tokenValue = tokenValue.substring(1); + propertyName = propertyName.substring(1); } - value = new PropertyName(tokenValue, hack, (line||token.startLine), (col||token.startCol)); + value = new PropertyName(propertyName, hack, line || token.startLine, col || token.startCol); this._readWhitespace(); + } else if (tokenStream.peek() === Tokens.RBRACE) { + } else { + this._unexpectedToken(tokenStream.LT(1)); } return value; }, - _ruleset: function(){ + _ruleset: function() { var tokenStream = this._tokenStream, tt, selectors; try { selectors = this._selectors_group(); - } catch (ex){ - if (ex instanceof SyntaxError && !this.options.strict){ + } catch (ex) { + if (ex instanceof SyntaxError && !this.options.strict) { this.fire({ type: "error", error: ex, @@ -2658,7 +2863,7 @@ Parser.prototype = function(){ col: ex.col }); tt = tokenStream.advance([Tokens.RBRACE]); - if (tt == Tokens.RBRACE){ + if (tt === Tokens.RBRACE) { } else { throw ex; } @@ -2668,7 +2873,7 @@ Parser.prototype = function(){ } return true; } - if (selectors){ + if (selectors) { this.fire({ type: "startrule", @@ -2691,19 +2896,19 @@ Parser.prototype = function(){ return selectors; }, - _selectors_group: function(){ + _selectors_group: function() { var tokenStream = this._tokenStream, selectors = [], selector; selector = this._selector(); - if (selector !== null){ + if (selector !== null) { selectors.push(selector); - while(tokenStream.match(Tokens.COMMA)){ + while (tokenStream.match(Tokens.COMMA)) { this._readWhitespace(); selector = this._selector(); - if (selector !== null){ + if (selector !== null) { selectors.push(selector); } else { this._unexpectedToken(tokenStream.LT(1)); @@ -2713,7 +2918,7 @@ Parser.prototype = function(){ return selectors.length ? selectors : null; }, - _selector: function(){ + _selector: function() { var tokenStream = this._tokenStream, selector = [], @@ -2721,7 +2926,7 @@ Parser.prototype = function(){ combinator = null, ws = null; nextSelector = this._simple_selector_sequence(); - if (nextSelector === null){ + if (nextSelector === null) { return null; } @@ -2730,26 +2935,26 @@ Parser.prototype = function(){ do { combinator = this._combinator(); - if (combinator !== null){ + if (combinator !== null) { selector.push(combinator); nextSelector = this._simple_selector_sequence(); - if (nextSelector === null){ + if (nextSelector === null) { this._unexpectedToken(tokenStream.LT(1)); } else { selector.push(nextSelector); } } else { - if (this._readWhitespace()){ + if (this._readWhitespace()) { ws = new Combinator(tokenStream.token().value, tokenStream.token().startLine, tokenStream.token().startCol); combinator = this._combinator(); nextSelector = this._simple_selector_sequence(); - if (nextSelector === null){ - if (combinator !== null){ + if (nextSelector === null) { + if (combinator !== null) { this._unexpectedToken(tokenStream.LT(1)); } } else { - if (combinator !== null){ + if (combinator !== null) { selector.push(combinator); } else { selector.push(ws); @@ -2762,18 +2967,18 @@ Parser.prototype = function(){ } } - } while(true); + } while (true); return new Selector(selector, selector[0].line, selector[0].col); }, - _simple_selector_sequence: function(){ + _simple_selector_sequence: function() { var tokenStream = this._tokenStream, elementName = null, modifiers = [], - selectorText= "", + selectorText = "", components = [ - function(){ + function() { return tokenStream.match(Tokens.HASH) ? new SelectorSubPart(tokenStream.token().value, "id", tokenStream.token().startLine, tokenStream.token().startCol) : null; @@ -2786,31 +2991,30 @@ Parser.prototype = function(){ i = 0, len = components.length, component = null, - found = false, line, col; line = tokenStream.LT(1).startLine; col = tokenStream.LT(1).startCol; elementName = this._type_selector(); - if (!elementName){ + if (!elementName) { elementName = this._universal(); } - if (elementName !== null){ + if (elementName !== null) { selectorText += elementName; } - while(true){ - if (tokenStream.peek() === Tokens.S){ + while (true) { + if (tokenStream.peek() === Tokens.S) { break; } - while(i < len && component === null){ + while (i < len && component === null) { component = components[i++].call(this); } - if (component === null){ - if (selectorText === ""){ + if (component === null) { + if (selectorText === "") { return null; } else { break; @@ -2828,35 +3032,35 @@ Parser.prototype = function(){ new SelectorPart(elementName, modifiers, selectorText, line, col) : null; }, - _type_selector: function(){ + _type_selector: function() { var tokenStream = this._tokenStream, ns = this._namespace_prefix(), elementName = this._element_name(); - if (!elementName){ - if (ns){ + if (!elementName) { + if (ns) { tokenStream.unget(); - if (ns.length > 1){ + if (ns.length > 1) { tokenStream.unget(); } } return null; } else { - if (ns){ + if (ns) { elementName.text = ns + elementName.text; elementName.col -= ns.length; } return elementName; } }, - _class: function(){ + _class: function() { var tokenStream = this._tokenStream, token; - if (tokenStream.match(Tokens.DOT)){ + if (tokenStream.match(Tokens.DOT)) { tokenStream.mustMatch(Tokens.IDENT); token = tokenStream.token(); return new SelectorSubPart("." + token.value, "class", token.startLine, token.startCol - 1); @@ -2865,12 +3069,12 @@ Parser.prototype = function(){ } }, - _element_name: function(){ + _element_name: function() { var tokenStream = this._tokenStream, token; - if (tokenStream.match(Tokens.IDENT)){ + if (tokenStream.match(Tokens.IDENT)) { token = tokenStream.token(); return new SelectorSubPart(token.value, "elementName", token.startLine, token.startCol); @@ -2878,12 +3082,12 @@ Parser.prototype = function(){ return null; } }, - _namespace_prefix: function(){ + _namespace_prefix: function() { var tokenStream = this._tokenStream, value = ""; - if (tokenStream.LA(1) === Tokens.PIPE || tokenStream.LA(2) === Tokens.PIPE){ + if (tokenStream.LA(1) === Tokens.PIPE || tokenStream.LA(2) === Tokens.PIPE) { - if(tokenStream.match([Tokens.IDENT, Tokens.STAR])){ + if (tokenStream.match([Tokens.IDENT, Tokens.STAR])) { value += tokenStream.token().value; } @@ -2894,38 +3098,38 @@ Parser.prototype = function(){ return value.length ? value : null; }, - _universal: function(){ + _universal: function() { var tokenStream = this._tokenStream, value = "", ns; ns = this._namespace_prefix(); - if(ns){ + if (ns) { value += ns; } - if(tokenStream.match(Tokens.STAR)){ + if (tokenStream.match(Tokens.STAR)) { value += "*"; } return value.length ? value : null; - }, - _attrib: function(){ + }, + _attrib: function() { var tokenStream = this._tokenStream, value = null, ns, token; - if (tokenStream.match(Tokens.LBRACKET)){ + if (tokenStream.match(Tokens.LBRACKET)) { token = tokenStream.token(); value = token.value; value += this._readWhitespace(); ns = this._namespace_prefix(); - if (ns){ + if (ns) { value += ns; } @@ -2933,8 +3137,8 @@ Parser.prototype = function(){ value += tokenStream.token().value; value += this._readWhitespace(); - if(tokenStream.match([Tokens.PREFIXMATCH, Tokens.SUFFIXMATCH, Tokens.SUBSTRINGMATCH, - Tokens.EQUALS, Tokens.INCLUDES, Tokens.DASHMATCH])){ + if (tokenStream.match([Tokens.PREFIXMATCH, Tokens.SUFFIXMATCH, Tokens.SUBSTRINGMATCH, + Tokens.EQUALS, Tokens.INCLUDES, Tokens.DASHMATCH])) { value += tokenStream.token().value; value += this._readWhitespace(); @@ -2951,7 +3155,7 @@ Parser.prototype = function(){ return null; } }, - _pseudo: function(){ + _pseudo: function() { var tokenStream = this._tokenStream, pseudo = null, @@ -2959,35 +3163,39 @@ Parser.prototype = function(){ line, col; - if (tokenStream.match(Tokens.COLON)){ + if (tokenStream.match(Tokens.COLON)) { - if (tokenStream.match(Tokens.COLON)){ + if (tokenStream.match(Tokens.COLON)) { colons += ":"; } - if (tokenStream.match(Tokens.IDENT)){ + if (tokenStream.match(Tokens.IDENT)) { pseudo = tokenStream.token().value; line = tokenStream.token().startLine; col = tokenStream.token().startCol - colons.length; - } else if (tokenStream.peek() == Tokens.FUNCTION){ + } else if (tokenStream.peek() === Tokens.FUNCTION) { line = tokenStream.LT(1).startLine; col = tokenStream.LT(1).startCol - colons.length; pseudo = this._functional_pseudo(); } - if (pseudo){ + if (pseudo) { pseudo = new SelectorSubPart(colons + pseudo, "pseudo", line, col); + } else { + var startLine = tokenStream.LT(1).startLine, + startCol = tokenStream.LT(0).startCol; + throw new SyntaxError("Expected a `FUNCTION` or `IDENT` after colon at line " + startLine + ", col " + startCol + ".", startLine, startCol); } } return pseudo; }, - _functional_pseudo: function(){ + _functional_pseudo: function() { var tokenStream = this._tokenStream, value = null; - if(tokenStream.match(Tokens.FUNCTION)){ + if (tokenStream.match(Tokens.FUNCTION)) { value = tokenStream.token().value; value += this._readWhitespace(); value += this._expression(); @@ -2997,15 +3205,15 @@ Parser.prototype = function(){ return value; }, - _expression: function(){ + _expression: function() { var tokenStream = this._tokenStream, value = ""; - while(tokenStream.match([Tokens.PLUS, Tokens.MINUS, Tokens.DIMENSION, - Tokens.NUMBER, Tokens.STRING, Tokens.IDENT, Tokens.LENGTH, - Tokens.FREQ, Tokens.ANGLE, Tokens.TIME, - Tokens.RESOLUTION, Tokens.SLASH])){ + while (tokenStream.match([Tokens.PLUS, Tokens.MINUS, Tokens.DIMENSION, + Tokens.NUMBER, Tokens.STRING, Tokens.IDENT, Tokens.LENGTH, + Tokens.FREQ, Tokens.ANGLE, Tokens.TIME, + Tokens.RESOLUTION, Tokens.SLASH])) { value += tokenStream.token().value; value += this._readWhitespace(); @@ -3014,7 +3222,7 @@ Parser.prototype = function(){ return value.length ? value : null; }, - _negation: function(){ + _negation: function() { var tokenStream = this._tokenStream, line, @@ -3023,7 +3231,7 @@ Parser.prototype = function(){ arg, subpart = null; - if (tokenStream.match(Tokens.NOT)){ + if (tokenStream.match(Tokens.NOT)) { value = tokenStream.token().value; line = tokenStream.token().startLine; col = tokenStream.token().startCol; @@ -3040,13 +3248,13 @@ Parser.prototype = function(){ return subpart; }, - _negation_arg: function(){ + _negation_arg: function() { var tokenStream = this._tokenStream, args = [ this._type_selector, this._universal, - function(){ + function() { return tokenStream.match(Tokens.HASH) ? new SelectorSubPart(tokenStream.token().value, "id", tokenStream.token().startLine, tokenStream.token().startCol) : null; @@ -3058,7 +3266,6 @@ Parser.prototype = function(){ arg = null, i = 0, len = args.length, - elementName, line, col, part; @@ -3066,15 +3273,15 @@ Parser.prototype = function(){ line = tokenStream.LT(1).startLine; col = tokenStream.LT(1).startCol; - while(i < len && arg === null){ + while (i < len && arg === null) { arg = args[i].call(this); i++; } - if (arg === null){ + if (arg === null) { this._unexpectedToken(tokenStream.LT(1)); } - if (arg.type == "elementName"){ + if (arg.type === "elementName") { part = new SelectorPart(arg, [], arg.toString(), line, col); } else { part = new SelectorPart(null, [arg], arg.toString(), line, col); @@ -3083,31 +3290,30 @@ Parser.prototype = function(){ return part; }, - _declaration: function(){ + _declaration: function() { - var tokenStream = this._tokenStream, - property = null, - expr = null, - prio = null, - error = null, - invalid = null, - propertyName= ""; + var tokenStream = this._tokenStream, + property = null, + expr = null, + prio = null, + invalid = null, + propertyName = ""; property = this._property(); - if (property !== null){ + if (property !== null) { tokenStream.mustMatch(Tokens.COLON); this._readWhitespace(); expr = this._expr(); - if (!expr || expr.length === 0){ + if (!expr || expr.length === 0) { this._unexpectedToken(tokenStream.LT(1)); } prio = this._prio(); propertyName = property.toString(); - if (this.options.starHack && property.hack == "*" || - this.options.underscoreHack && property.hack == "_") { + if (this.options.starHack && property.hack === "*" || + this.options.underscoreHack && property.hack === "_") { propertyName = property.text; } @@ -3134,7 +3340,7 @@ Parser.prototype = function(){ } }, - _prio: function(){ + _prio: function() { var tokenStream = this._tokenStream, result = tokenStream.match(Tokens.IMPORTANT_SYM); @@ -3143,21 +3349,20 @@ Parser.prototype = function(){ return result; }, - _expr: function(inFunction){ + _expr: function(inFunction) { - var tokenStream = this._tokenStream, - values = [], + var values = [], value = null, operator = null; value = this._term(inFunction); - if (value !== null){ + if (value !== null) { values.push(value); do { operator = this._operator(inFunction); - if (operator){ + if (operator) { values.push(operator); } /*else { values.push(new PropertyValue(valueParts, valueParts[0].line, valueParts[0].col)); @@ -3166,44 +3371,45 @@ Parser.prototype = function(){ value = this._term(inFunction); - if (value === null){ + if (value === null) { break; } else { values.push(value); } - } while(true); + } while (true); } return values.length > 0 ? new PropertyValue(values, values[0].line, values[0].col) : null; }, - _term: function(inFunction){ + _term: function(inFunction) { var tokenStream = this._tokenStream, unary = null, value = null, endChar = null, + part = null, token, line, col; unary = this._unary_operator(); - if (unary !== null){ + if (unary !== null) { line = tokenStream.token().startLine; col = tokenStream.token().startCol; } - if (tokenStream.peek() == Tokens.IE_FUNCTION && this.options.ieFilters){ + if (tokenStream.peek() === Tokens.IE_FUNCTION && this.options.ieFilters) { value = this._ie_function(); - if (unary === null){ + if (unary === null) { line = tokenStream.token().startLine; col = tokenStream.token().startCol; } - } else if (inFunction && tokenStream.match([Tokens.LPAREN, Tokens.LBRACE, Tokens.LBRACKET])){ + } else if (inFunction && tokenStream.match([Tokens.LPAREN, Tokens.LBRACE, Tokens.LBRACKET])) { token = tokenStream.token(); endChar = token.endChar; value = token.value + this._expr(inFunction).text; - if (unary === null){ + if (unary === null) { line = tokenStream.token().startLine; col = tokenStream.token().startCol; } @@ -3211,24 +3417,25 @@ Parser.prototype = function(){ value += endChar; this._readWhitespace(); } else if (tokenStream.match([Tokens.NUMBER, Tokens.PERCENTAGE, Tokens.LENGTH, - Tokens.ANGLE, Tokens.TIME, - Tokens.FREQ, Tokens.STRING, Tokens.IDENT, Tokens.URI, Tokens.UNICODE_RANGE])){ + Tokens.ANGLE, Tokens.TIME, + Tokens.FREQ, Tokens.STRING, Tokens.IDENT, Tokens.URI, Tokens.UNICODE_RANGE])) { value = tokenStream.token().value; - if (unary === null){ + if (unary === null) { line = tokenStream.token().startLine; col = tokenStream.token().startCol; + part = PropertyValuePart.fromToken(tokenStream.token()); } this._readWhitespace(); } else { token = this._hexcolor(); - if (token === null){ - if (unary === null){ + if (token === null) { + if (unary === null) { line = tokenStream.LT(1).startLine; col = tokenStream.LT(1).startCol; } - if (value === null){ - if (tokenStream.LA(3) == Tokens.EQUALS && this.options.ieFilters){ + if (value === null) { + if (tokenStream.LA(3) === Tokens.EQUALS && this.options.ieFilters) { value = this._ie_function(); } else { value = this._function(); @@ -3237,7 +3444,7 @@ Parser.prototype = function(){ } else { value = token.value; - if (unary === null){ + if (unary === null) { line = token.startLine; col = token.startCol; } @@ -3245,31 +3452,31 @@ Parser.prototype = function(){ } - return value !== null ? + return part !== null ? part : value !== null ? new PropertyValuePart(unary !== null ? unary + value : value, line, col) : null; }, - _function: function(){ + _function: function() { var tokenStream = this._tokenStream, functionText = null, expr = null, lt; - if (tokenStream.match(Tokens.FUNCTION)){ + if (tokenStream.match(Tokens.FUNCTION)) { functionText = tokenStream.token().value; this._readWhitespace(); expr = this._expr(true); functionText += expr; - if (this.options.ieFilters && tokenStream.peek() == Tokens.EQUALS){ + if (this.options.ieFilters && tokenStream.peek() === Tokens.EQUALS) { do { - if (this._readWhitespace()){ + if (this._readWhitespace()) { functionText += tokenStream.token().value; } - if (tokenStream.LA(0) == Tokens.COMMA){ + if (tokenStream.LA(0) === Tokens.COMMA) { functionText += tokenStream.token().value; } @@ -3279,12 +3486,12 @@ Parser.prototype = function(){ tokenStream.match(Tokens.EQUALS); functionText += tokenStream.token().value; lt = tokenStream.peek(); - while(lt != Tokens.COMMA && lt != Tokens.S && lt != Tokens.RPAREN){ + while (lt !== Tokens.COMMA && lt !== Tokens.S && lt !== Tokens.RPAREN) { tokenStream.get(); functionText += tokenStream.token().value; lt = tokenStream.peek(); } - } while(tokenStream.match([Tokens.COMMA, Tokens.S])); + } while (tokenStream.match([Tokens.COMMA, Tokens.S])); } tokenStream.match(Tokens.RPAREN); @@ -3295,21 +3502,20 @@ Parser.prototype = function(){ return functionText; }, - _ie_function: function(){ + _ie_function: function() { var tokenStream = this._tokenStream, functionText = null, - expr = null, lt; - if (tokenStream.match([Tokens.IE_FUNCTION, Tokens.FUNCTION])){ + if (tokenStream.match([Tokens.IE_FUNCTION, Tokens.FUNCTION])) { functionText = tokenStream.token().value; do { - if (this._readWhitespace()){ + if (this._readWhitespace()) { functionText += tokenStream.token().value; } - if (tokenStream.LA(0) == Tokens.COMMA){ + if (tokenStream.LA(0) === Tokens.COMMA) { functionText += tokenStream.token().value; } @@ -3319,12 +3525,12 @@ Parser.prototype = function(){ tokenStream.match(Tokens.EQUALS); functionText += tokenStream.token().value; lt = tokenStream.peek(); - while(lt != Tokens.COMMA && lt != Tokens.S && lt != Tokens.RPAREN){ + while (lt !== Tokens.COMMA && lt !== Tokens.S && lt !== Tokens.RPAREN) { tokenStream.get(); functionText += tokenStream.token().value; lt = tokenStream.peek(); } - } while(tokenStream.match([Tokens.COMMA, Tokens.S])); + } while (tokenStream.match([Tokens.COMMA, Tokens.S])); tokenStream.match(Tokens.RPAREN); functionText += ")"; @@ -3334,17 +3540,17 @@ Parser.prototype = function(){ return functionText; }, - _hexcolor: function(){ + _hexcolor: function() { var tokenStream = this._tokenStream, token = null, color; - if(tokenStream.match(Tokens.HASH)){ + if (tokenStream.match(Tokens.HASH)) { token = tokenStream.token(); color = token.value; - if (!/#[a-f0-9]{3,6}/i.test(color)){ + if (!/#[a-f0-9]{3,6}/i.test(color)) { throw new SyntaxError("Expected a hex color but found '" + color + "' at line " + token.startLine + ", col " + token.startCol + ".", token.startLine, token.startCol); } this._readWhitespace(); @@ -3353,7 +3559,7 @@ Parser.prototype = function(){ return token; }, - _keyframes: function(){ + _keyframes: function() { var tokenStream = this._tokenStream, token, tt, @@ -3362,7 +3568,7 @@ Parser.prototype = function(){ tokenStream.mustMatch(Tokens.KEYFRAMES_SYM); token = tokenStream.token(); - if (/^@\-([^\-]+)\-/.test(token.value)) { + if (/^@-([^-]+)-/.test(token.value)) { prefix = RegExp.$1; } @@ -3382,7 +3588,7 @@ Parser.prototype = function(){ this._readWhitespace(); tt = tokenStream.peek(); - while(tt == Tokens.IDENT || tt == Tokens.PERCENTAGE) { + while (tt === Tokens.IDENT || tt === Tokens.PERCENTAGE) { this._keyframe_rule(); this._readWhitespace(); tt = tokenStream.peek(); @@ -3398,21 +3604,19 @@ Parser.prototype = function(){ this._readWhitespace(); tokenStream.mustMatch(Tokens.RBRACE); + this._readWhitespace(); }, - _keyframe_name: function(){ - var tokenStream = this._tokenStream, - token; + _keyframe_name: function() { + var tokenStream = this._tokenStream; tokenStream.mustMatch([Tokens.IDENT, Tokens.STRING]); return SyntaxUnit.fromToken(tokenStream.token()); }, - _keyframe_rule: function(){ - var tokenStream = this._tokenStream, - token, - keyList = this._key_list(); + _keyframe_rule: function() { + var keyList = this._key_list(); this.fire({ type: "startkeyframerule", @@ -3432,16 +3636,14 @@ Parser.prototype = function(){ }, - _key_list: function(){ + _key_list: function() { var tokenStream = this._tokenStream, - token, - key, keyList = []; keyList.push(this._key()); this._readWhitespace(); - while(tokenStream.match(Tokens.COMMA)){ + while (tokenStream.match(Tokens.COMMA)) { this._readWhitespace(); keyList.push(this._key()); this._readWhitespace(); @@ -3450,17 +3652,17 @@ Parser.prototype = function(){ return keyList; }, - _key: function(){ + _key: function() { var tokenStream = this._tokenStream, token; - if (tokenStream.match(Tokens.PERCENTAGE)){ + if (tokenStream.match(Tokens.PERCENTAGE)) { return SyntaxUnit.fromToken(tokenStream.token()); - } else if (tokenStream.match(Tokens.IDENT)){ + } else if (tokenStream.match(Tokens.IDENT)) { token = tokenStream.token(); - if (/from|to/i.test(token.value)){ + if (/from|to/i.test(token.value)) { return SyntaxUnit.fromToken(token); } @@ -3468,18 +3670,18 @@ Parser.prototype = function(){ } this._unexpectedToken(tokenStream.LT(1)); }, - _skipCruft: function(){ - while(this._tokenStream.match([Tokens.S, Tokens.CDO, Tokens.CDC])){ + _skipCruft: function() { + while (this._tokenStream.match([Tokens.S, Tokens.CDO, Tokens.CDC])) { } }, - _readDeclarations: function(checkStart, readMargins){ + _readDeclarations: function(checkStart, readMargins) { var tokenStream = this._tokenStream, tt; this._readWhitespace(); - if (checkStart){ + if (checkStart) { tokenStream.mustMatch(Tokens.LBRACE); } @@ -3487,11 +3689,11 @@ Parser.prototype = function(){ try { - while(true){ + while (true) { - if (tokenStream.match(Tokens.SEMICOLON) || (readMargins && this._margin())){ - } else if (this._declaration()){ - if (!tokenStream.match(Tokens.SEMICOLON)){ + if (tokenStream.match(Tokens.SEMICOLON) || (readMargins && this._margin())) { + } else if (this._declaration()) { + if (!tokenStream.match(Tokens.SEMICOLON)) { break; } } else { @@ -3504,7 +3706,7 @@ Parser.prototype = function(){ this._readWhitespace(); } catch (ex) { - if (ex instanceof SyntaxError && !this.options.strict){ + if (ex instanceof SyntaxError && !this.options.strict) { this.fire({ type: "error", error: ex, @@ -3513,9 +3715,9 @@ Parser.prototype = function(){ col: ex.col }); tt = tokenStream.advance([Tokens.SEMICOLON, Tokens.RBRACE]); - if (tt == Tokens.SEMICOLON){ + if (tt === Tokens.SEMICOLON) { this._readDeclarations(false, readMargins); - } else if (tt != Tokens.RBRACE){ + } else if (tt !== Tokens.RBRACE) { throw ex; } @@ -3525,45 +3727,45 @@ Parser.prototype = function(){ } }, - _readWhitespace: function(){ + _readWhitespace: function() { var tokenStream = this._tokenStream, ws = ""; - while(tokenStream.match(Tokens.S)){ + while (tokenStream.match(Tokens.S)) { ws += tokenStream.token().value; } return ws; }, - _unexpectedToken: function(token){ + _unexpectedToken: function(token) { throw new SyntaxError("Unexpected token '" + token.value + "' at line " + token.startLine + ", col " + token.startCol + ".", token.startLine, token.startCol); }, - _verifyEnd: function(){ - if (this._tokenStream.LA(1) != Tokens.EOF){ + _verifyEnd: function() { + if (this._tokenStream.LA(1) !== Tokens.EOF) { this._unexpectedToken(this._tokenStream.LT(1)); } }, - _validateProperty: function(property, value){ + _validateProperty: function(property, value) { Validation.validate(property, value); }, - parse: function(input){ + parse: function(input) { this._tokenStream = new TokenStream(input, Tokens); this._stylesheet(); }, - parseStyleSheet: function(input){ + parseStyleSheet: function(input) { return this.parse(input); }, - parseMediaQuery: function(input){ + parseMediaQuery: function(input) { this._tokenStream = new TokenStream(input, Tokens); var result = this._media_query(); this._verifyEnd(); return result; }, - parsePropertyValue: function(input){ + parsePropertyValue: function(input) { this._tokenStream = new TokenStream(input, Tokens); this._readWhitespace(); @@ -3573,7 +3775,7 @@ Parser.prototype = function(){ this._verifyEnd(); return result; }, - parseRule: function(input){ + parseRule: function(input) { this._tokenStream = new TokenStream(input, Tokens); this._readWhitespace(); @@ -3582,7 +3784,7 @@ Parser.prototype = function(){ this._verifyEnd(); return result; }, - parseSelector: function(input){ + parseSelector: function(input) { this._tokenStream = new TokenStream(input, Tokens); this._readWhitespace(); @@ -3592,510 +3794,482 @@ Parser.prototype = function(){ this._verifyEnd(); return result; }, - parseStyleAttribute: function(input){ - input += "}"; // for error recovery in _readDeclarations() + parseStyleAttribute: function(input) { + input += "}"; // for error recovery in _readDeclarations() this._tokenStream = new TokenStream(input, Tokens); this._readDeclarations(); } }; - for (prop in additions){ - if (additions.hasOwnProperty(prop)){ + for (prop in additions) { + if (Object.prototype.hasOwnProperty.call(additions, prop)) { proto[prop] = additions[prop]; } } return proto; }(); -var Properties = { - "align-items" : "flex-start | flex-end | center | baseline | stretch", - "align-content" : "flex-start | flex-end | center | space-between | space-around | stretch", - "align-self" : "auto | flex-start | flex-end | center | baseline | stretch", - "-webkit-align-items" : "flex-start | flex-end | center | baseline | stretch", - "-webkit-align-content" : "flex-start | flex-end | center | space-between | space-around | stretch", - "-webkit-align-self" : "auto | flex-start | flex-end | center | baseline | stretch", - "alignment-adjust" : "auto | baseline | before-edge | text-before-edge | middle | central | after-edge | text-after-edge | ideographic | alphabetic | hanging | mathematical | | ", - "alignment-baseline" : "baseline | use-script | before-edge | text-before-edge | after-edge | text-after-edge | central | middle | ideographic | alphabetic | hanging | mathematical", - "animation" : 1, - "animation-delay" : { multi: "
'; } From d0ed15ce5c6f3918807681fc9eeaaa001c7ef605 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 3 Apr 2022 17:12:54 +0200 Subject: [PATCH 512/610] Typo --- htdocs/accountancy/admin/export.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/admin/export.php b/htdocs/accountancy/admin/export.php index 8cef3a05cf4..03cd41a43a9 100644 --- a/htdocs/accountancy/admin/export.php +++ b/htdocs/accountancy/admin/export.php @@ -24,7 +24,7 @@ /** * \file htdocs/accountancy/admin/export.php * \ingroup Accountancy (Double entries) - * \brief Setup page to configure accounting expert module + * \brief Setup page to configure accounting export module */ require '../../main.inc.php'; From 440b5350df6511f5076803fcdf1b696e6cfa90ae Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 3 Apr 2022 17:12:45 +0200 Subject: [PATCH 513/610] # WARNING: head commit changed in the meantime Merge branch '14.0' of git@github.com:Dolibarr/dolibarr.git into 14.0 --- htdocs/compta/accounting-files.php | 368 ++++++++++++++++------------- 1 file changed, 199 insertions(+), 169 deletions(-) diff --git a/htdocs/compta/accounting-files.php b/htdocs/compta/accounting-files.php index a06dd8dacaf..3942e7cb6dd 100644 --- a/htdocs/compta/accounting-files.php +++ b/htdocs/compta/accounting-files.php @@ -19,11 +19,11 @@ * along with this program. If not, see . */ - /** - * \file htdocs/compta/accounting-files.php - * \ingroup compta - * \brief Page to show portoflio and files of a thirdparty and download it - */ +/** + * \file htdocs/compta/accounting-files.php + * \ingroup compta + * \brief Page to show portoflio and files of a thirdparty and download it + */ if ((array_key_exists('action', $_GET) && $_GET['action'] == 'dl') || (array_key_exists('action', $_POST) && $_POST['action'] == 'dl')) { // To not replace token when downloading file if (!defined('NOTOKENRENEWAL')) { @@ -499,7 +499,7 @@ if ($result && $action == "dl" && !$error) { $zip->addFromString('transactions.csv', $log); $zip->close(); - ///Then download the zipped file. + // Then download the zipped file. header('Content-Type: application/zip'); header('Content-disposition: attachment; filename='.basename($zipname)); header('Content-Length: '.filesize($zipname)); @@ -578,7 +578,7 @@ print '
'; foreach ($listofchoices as $choice => $val) { if (empty($val['enabled'])) { - continue; // list not qualified + continue; // list not qualified } $disabled = ''; if (empty($val['perms'])) { @@ -588,14 +588,13 @@ foreach ($listofchoices as $choice => $val) { print '
'; } -print ''; +print ''; print ''."\n"; print dol_get_fiche_end(); if (!empty($date_start) && !empty($date_stop)) { - $param = 'action=searchfiles'; $param .= '&date_startday='.GETPOST('date_startday', 'int'); $param .= '&date_startmonth='.GETPOST('date_startmonth', 'int'); $param .= '&date_startyear='.GETPOST('date_startyear', 'int'); @@ -603,25 +602,47 @@ if (!empty($date_start) && !empty($date_stop)) { $param .= '&date_stopmonth='.GETPOST('date_stopmonth', 'int'); $param .= '&date_stopyear='.GETPOST('date_stopyear', 'int'); foreach ($listofchoices as $choice => $val) { - $param .= '&'.$choice.'='.(GETPOST($choice, 'int') ? 1 : 0); + if (GETPOST($choice, 'int')) { + $param .= '&'.$choice.'=1'; + } } - print '
'."\n"; - print ''; + + $TData = dol_sort_array($filesarray, $sortfield, $sortorder); + + + $filename = dol_print_date($date_start, 'dayrfc', 'tzuserrel')."-".dol_print_date($date_stop, 'dayrfc', 'tzuserrel').'_export.zip'; echo dol_print_date($date_start, 'day', 'tzuserrel')." - ".dol_print_date($date_stop, 'day', 'tzuserrel'); - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - foreach ($listofchoices as $choice => $val) { - print ''; + print ''."\n"; + print $langs->trans("Download"); + print '
'; - print ''; - print '
'."\n"; + $param .= '&action=searchfiles'; + + /* + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + foreach ($listofchoices as $choice => $val) { + print ''; + } + + print ''; + print ''."\n"; + */ print '
'; @@ -645,172 +666,181 @@ if (!empty($date_start) && !empty($date_stop)) { print ''.$langs->trans("Currency").''; } print ''; - if ($result) { - $TData = dol_sort_array($filesarray, $sortfield, $sortorder); - if (empty($TData)) { - print ''.$langs->trans("NoItem").''; - if (!empty($conf->multicurrency->enabled)) { - print ''; + if (empty($TData)) { + print ''.$langs->trans("NoRecordFound").''; + if (!empty($conf->multicurrency->enabled)) { + print ''; + } + print ''; + } else { + // Sort array by date ASC to calculate balance + + $totalET_debit = 0; + $totalIT_debit = 0; + $totalVAT_debit = 0; + $totalET_credit = 0; + $totalIT_credit = 0; + $totalVAT_credit = 0; + + // Display array + foreach ($TData as $data) { + $html_class = ''; + //if (!empty($data['fk_facture'])) $html_class = 'facid-'.$data['fk_facture']; + //elseif (!empty($data['fk_paiement'])) $html_class = 'payid-'.$data['fk_paiement']; + print ''; + + // Type + print ''.$langs->trans($data['item']).''; + + // Date + print ''; + print dol_print_date($data['date'], 'day'); + print "\n"; + + // Date due + print ''; + print dol_print_date($data['date_due'], 'day'); + print "\n"; + + // Ref + print ''; + + if ($data['item'] == 'Invoice') { + $invoice->id = $data['id']; + $invoice->ref = $data['ref']; + $invoice->total_ht = $data['amount_ht']; + $invoice->total_ttc = $data['amount_ttc']; + $invoice->total_tva = $data['amount_vat']; + $invoice->multicurrency_code = $data['currency']; + print $invoice->getNomUrl(1, '', 0, 0, '', 0, 0, 0); + } elseif ($data['item'] == 'SupplierInvoice') { + $supplier_invoice->id = $data['id']; + $supplier_invoice->ref = $data['ref']; + $supplier_invoice->total_ht = $data['amount_ht']; + $supplier_invoice->total_ttc = $data['amount_ttc']; + $supplier_invoice->total_tva = $data['amount_vat']; + $supplier_invoice->multicurrency_code = $data['currency']; + print $supplier_invoice->getNomUrl(1, '', 0, 0, '', 0, 0, 0); + } elseif ($data['item'] == 'ExpenseReport') { + $expensereport->id = $data['id']; + $expensereport->ref = $data['ref']; + print $expensereport->getNomUrl(1, 0, 0, '', 0, 0); + } elseif ($data['item'] == 'SalaryPayment') { + $salary_payment->id = $data['id']; + $salary_payment->ref = $data['ref']; + print $salary_payment->getNomUrl(1); + } elseif ($data['item'] == 'Donation') { + $don->id = $data['id']; + $don->ref = $data['ref']; + print $don->getNomUrl(1, 0, '', 0); + } elseif ($data['item'] == 'SocialContributions') { + $charge_sociales->id = $data['id']; + $charge_sociales->ref = $data['ref']; + print $charge_sociales->getNomUrl(1, 0, 0, 0, 0); + } elseif ($data['item'] == 'VariousPayment') { + $various_payment->id = $data['id']; + $various_payment->ref = $data['ref']; + print $various_payment->getNomUrl(1, '', 0, 0); + } elseif ($data['item'] == 'LoanPayment') { + $payment_loan->id = $data['id']; + $payment_loan->ref = $data['ref']; + print $payment_loan->getNomUrl(1, 0, 0, '', 0); + } else { + print $data['ref']; } - print ''; - } else { - // Sort array by date ASC to calculate balance + print ''; - $totalET_debit = 0; - $totalIT_debit = 0; - $totalVAT_debit = 0; - $totalET_credit = 0; - $totalIT_credit = 0; - $totalVAT_credit = 0; - - // Display array - foreach ($TData as $data) { - $html_class = ''; - //if (!empty($data['fk_facture'])) $html_class = 'facid-'.$data['fk_facture']; - //elseif (!empty($data['fk_paiement'])) $html_class = 'payid-'.$data['fk_paiement']; - print ''; - - // Type - print ''.$langs->trans($data['item']).''; - - // Date - print ''; - print dol_print_date($data['date'], 'day'); - print "\n"; - - // Date due - print ''; - print dol_print_date($data['date_due'], 'day'); - print "\n"; - - // Ref - print ''; - - if ($data['item'] == 'Invoice') { - $invoice->id = $data['id']; - $invoice->ref = $data['ref']; - $invoice->total_ht = $data['amount_ht']; - $invoice->total_ttc = $data['amount_ttc']; - $invoice->total_tva = $data['amount_vat']; - $invoice->multicurrency_code = $data['currency']; - print $invoice->getNomUrl(1, '', 0, 0, '', 0, 0, 0); - } elseif ($data['item'] == 'SupplierInvoice') { - $supplier_invoice->id = $data['id']; - $supplier_invoice->ref = $data['ref']; - $supplier_invoice->total_ht = $data['amount_ht']; - $supplier_invoice->total_ttc = $data['amount_ttc']; - $supplier_invoice->total_tva = $data['amount_vat']; - $supplier_invoice->multicurrency_code = $data['currency']; - print $supplier_invoice->getNomUrl(1, '', 0, 0, '', 0, 0, 0); - } elseif ($data['item'] == 'ExpenseReport') { - $expensereport->id = $data['id']; - $expensereport->ref = $data['ref']; - print $expensereport->getNomUrl(1, 0, 0, '', 0, 0); - } elseif ($data['item'] == 'SalaryPayment') { - $salary_payment->id = $data['id']; - $salary_payment->ref = $data['ref']; - print $salary_payment->getNomUrl(1); - } elseif ($data['item'] == 'Donation') { - $don->id = $data['id']; - $don->ref = $data['ref']; - print $don->getNomUrl(1, 0, '', 0); - } elseif ($data['item'] == 'SocialContributions') { - $charge_sociales->id = $data['id']; - $charge_sociales->ref = $data['ref']; - print $charge_sociales->getNomUrl(1, 0, 0, 0, 0); - } elseif ($data['item'] == 'VariousPayment') { - $various_payment->id = $data['id']; - $various_payment->ref = $data['ref']; - print $various_payment->getNomUrl(1, '', 0, 0); - } elseif ($data['item'] == 'LoanPayment') { - $payment_loan->id = $data['id']; - $payment_loan->ref = $data['ref']; - print $payment_loan->getNomUrl(1, 0, 0, '', 0); - } else { - print $data['ref']; - } - print ''; - - // File link - print ''; - if (!empty($data['files'])) { - foreach ($data['files'] as $id => $filecursor) { - print ''.($filecursor['name'] ? $filecursor['name'] : $filecursor['ref']).' '.$formfile->showPreview($filecursor, $filecursor['modulepart'], $filecursor['subdir'].'/'.$filecursor['name']).'
'; + // File link + print ''; + if (!empty($data['files'])) { + foreach ($data['files'] as $id => $filecursor) { + $tmppreview = $formfile->showPreview($filecursor, $filecursor['modulepart'], $filecursor['subdir'].'/'.$filecursor['name'], 0); + if ($tmppreview) { + print $tmppreview; } + $filename = ($filecursor['name'] ? $filecursor['name'] : $filecursor['ref']); + print ''; + if (empty($tmppreview)) { + print img_picto('', 'generic', '', false, 0, 0, '', 'pictonopreview pictofixedwidth paddingright'); + } + print $filename; + print '
'; } - print "\n"; + } + print "\n"; - // Paid - print ''.$data['paid'].''; + // Paid + print ''.($data['paid'] ? yn($data['paid']) : '').''; - // Total ET - print ''.price(price2num($data['sens'] ? $data['amount_ht'] : -$data['amount_ht'], 'MT'))."\n"; - // Total IT - print ''.price(price2num($data['sens'] ? $data['amount_ttc'] : -$data['amount_ttc'], 'MT'))."\n"; - // Total VAT - print ''.price(price2num($data['sens'] ? $data['amount_vat'] : -$data['amount_vat'], 'MT'))."\n"; + // Total ET + print ''.price(price2num($data['sens'] ? $data['amount_ht'] : -$data['amount_ht'], 'MT'))."\n"; + // Total IT + print ''.price(price2num($data['sens'] ? $data['amount_ttc'] : -$data['amount_ttc'], 'MT'))."\n"; + // Total VAT + print ''.price(price2num($data['sens'] ? $data['amount_vat'] : -$data['amount_vat'], 'MT'))."\n"; - print ''.dol_escape_htmltag($data['thirdparty_name'])."\n"; + print ''.dol_escape_htmltag($data['thirdparty_name'])."\n"; - print ''.$data['thirdparty_code']."\n"; + print ''.$data['thirdparty_code']."\n"; - print ''.$data['country_code']."\n"; + print ''.$data['country_code']."\n"; - print ''.dol_escape_htmltag($data['vatnum'])."\n"; + // VAT number + print ''.dol_escape_htmltag($data['vatnum'])."\n"; - if ($data['sens']) { - $totalET_credit += $data['amount_ht']; - $totalIT_credit += $data['amount_ttc']; - $totalVAT_credit += $data['amount_vat']; - } else { - $totalET_debit -= $data['amount_ht']; - $totalIT_debit -= $data['amount_ttc']; - $totalVAT_debit -= $data['amount_vat']; - } - - if (!empty($conf->multicurrency->enabled)) { - print ''.$data['currency']."\n"; - } - - print "\n"; + if ($data['sens']) { + $totalET_credit += $data['amount_ht']; + $totalIT_credit += $data['amount_ttc']; + $totalVAT_credit += $data['amount_vat']; + } else { + $totalET_debit -= $data['amount_ht']; + $totalIT_debit -= $data['amount_ttc']; + $totalVAT_debit -= $data['amount_vat']; } - // Total credits - print ''; - print ''.$langs->trans('Total').' '.$langs->trans('Income').''; - print ''.price(price2num($totalET_credit, 'MT')).''; - print ''.price(price2num($totalIT_credit, 'MT')).''; - print ''.price(price2num($totalVAT_credit, 'MT')).''; - print ''; if (!empty($conf->multicurrency->enabled)) { - print ''; - } - print "\n"; - // Total debits - print ''; - print ''.$langs->trans('Total').' '.$langs->trans('Outcome').''; - print ''.price(price2num($totalET_debit, 'MT')).''; - print ''.price(price2num($totalIT_debit, 'MT')).''; - print ''.price(price2num($totalVAT_debit, 'MT')).''; - print ''; - if (!empty($conf->multicurrency->enabled)) { - print ''; - } - print "\n"; - // Balance - print ''; - print ''.$langs->trans('Total').''; - print ''.price(price2num($totalET_credit + $totalET_debit, 'MT')).''; - print ''.price(price2num($totalIT_credit + $totalIT_debit, 'MT')).''; - print ''.price(price2num($totalVAT_credit + $totalVAT_debit, 'MT')).''; - print ''; - if (!empty($conf->multicurrency->enabled)) { - print ''; + print ''.$data['currency']."\n"; } + print "\n"; } + + // Total credits + print ''; + print ''.$langs->trans('Total').' '.$langs->trans('Income').''; + print ''.price(price2num($totalET_credit, 'MT')).''; + print ''.price(price2num($totalIT_credit, 'MT')).''; + print ''.price(price2num($totalVAT_credit, 'MT')).''; + print ''; + if (!empty($conf->multicurrency->enabled)) { + print ''; + } + print "\n"; + // Total debits + print ''; + print ''.$langs->trans('Total').' '.$langs->trans('Outcome').''; + print ''.price(price2num($totalET_debit, 'MT')).''; + print ''.price(price2num($totalIT_debit, 'MT')).''; + print ''.price(price2num($totalVAT_debit, 'MT')).''; + print ''; + if (!empty($conf->multicurrency->enabled)) { + print ''; + } + print "\n"; + // Balance + print ''; + print ''.$langs->trans('Total').''; + print ''.price(price2num($totalET_credit + $totalET_debit, 'MT')).''; + print ''.price(price2num($totalIT_credit + $totalIT_debit, 'MT')).''; + print ''.price(price2num($totalVAT_credit + $totalVAT_debit, 'MT')).''; + print ''; + if (!empty($conf->multicurrency->enabled)) { + print ''; + } + print "\n"; } + print ""; print '
'; } From 0c0ff4dec9c77f18a84110f4aa42d2e6b61d6a5f Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Thu, 10 Feb 2022 17:06:46 +0100 Subject: [PATCH 514/610] add WORKFLOW_TICKET_CREATE_INTERVENTION to workflow constants --- htdocs/core/modules/modWorkflow.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/modWorkflow.class.php b/htdocs/core/modules/modWorkflow.class.php index dc05bf9dc66..248d3c006ce 100644 --- a/htdocs/core/modules/modWorkflow.class.php +++ b/htdocs/core/modules/modWorkflow.class.php @@ -95,7 +95,8 @@ class modWorkflow extends DolibarrModules 8=>array('WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER', 'chaine', '1', 'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER', 0, 'current', 0), 9=>array('WORKFLOW_BILL_ON_RECEPTION', 'chaine', '1', 'WORKFLOW_BILL_ON_RECEPTION', 0, 'current', 0), 10=>array('WORKFLOW_TICKET_LINK_CONTRACT', 'chaine', '0', 'Automatically link a ticket to available contracts', 0, 'current', 0), - 11=>array('WORKFLOW_TICKET_USE_PARENT_COMPANY_CONTRACTS', 'chaine', '0', 'Search among parent companies contracts when automatically linking a ticket to available contracts', 0, 'current', 0) + 11=>array('WORKFLOW_TICKET_USE_PARENT_COMPANY_CONTRACTS', 'chaine', '0', 'Search among parent companies contracts when automatically linking a ticket to available contracts', 0, 'current', 0), + 11=>array('WORKFLOW_TICKET_CREATE_INTERVENTION', 'chaine', '1', 'WORKFLOW_TICKET_CREATE_INTERVENTION', 0, 'current', 0) ); // Boxes From 4790006c3a1adabd9e87af11efb0cc9cc6469af4 Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Thu, 10 Feb 2022 17:09:09 +0100 Subject: [PATCH 515/610] workflow config: add button for WORKFLOW_TICKET_CREATE_INTERVENTION --- htdocs/admin/workflow.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/htdocs/admin/workflow.php b/htdocs/admin/workflow.php index da82f163a7f..a684d642b2f 100644 --- a/htdocs/admin/workflow.php +++ b/htdocs/admin/workflow.php @@ -71,6 +71,12 @@ $workflowcodes = array( 'enabled'=>(!empty($conf->commande->enabled) && !empty($conf->facture->enabled)), 'picto'=>'bill' ), + 'WORKFLOW_TICKET_CREATE_INTERVENTION' => array ( + 'family'=>'create', + 'position'=>25, + 'enabled'=>(!empty($conf->ticket->enabled) && !empty($conf->ficheinter->enabled)), + 'picto'=>'ticket' + ), 'separator1'=>array('family'=>'separator', 'position'=>25, 'title'=>''), From 8db171ae4153dbafc41bf3037b8d575d2d5ba912 Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Thu, 10 Feb 2022 17:11:35 +0100 Subject: [PATCH 516/610] add translation string for workflow ticket fichinter creation --- htdocs/langs/en_US/workflow.lang | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/langs/en_US/workflow.lang b/htdocs/langs/en_US/workflow.lang index 6ddf8d9c6a3..e5c07583931 100644 --- a/htdocs/langs/en_US/workflow.lang +++ b/htdocs/langs/en_US/workflow.lang @@ -7,6 +7,7 @@ descWORKFLOW_PROPAL_AUTOCREATE_ORDER=Automatically create a sales order after a descWORKFLOW_PROPAL_AUTOCREATE_INVOICE=Automatically create a customer invoice after a commercial proposal is signed (the new invoice will have same amount as the proposal) descWORKFLOW_CONTRACT_AUTOCREATE_INVOICE=Automatically create a customer invoice after a contract is validated descWORKFLOW_ORDER_AUTOCREATE_INVOICE=Automatically create a customer invoice after a sales order is closed (the new invoice will have same amount as the order) +descWORKFLOW_TICKET_CREATE_INTERVENTION=Create an intervention when opening a ticket from backend and link it to the ticket. # Autoclassify customer proposal or order descWORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL=Classify linked source proposal as billed when sales order is set to billed (and if the amount of the order is the same as the total amount of the signed linked proposal) descWORKFLOW_INVOICE_CLASSIFY_BILLED_PROPAL=Classify linked source proposal as billed when customer invoice is validated (and if the amount of the invoice is the same as the total amount of the signed linked proposal) From ea68ed9c07e55e84cc3a356d906db27960d2c3a6 Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Mon, 7 Feb 2022 17:02:19 +0100 Subject: [PATCH 517/610] move automatic intervention creation from ticket/card.php to triggers/workflow.php --- ...e_20_modWorkflow_WorkflowManager.class.php | 23 ++++++++++++++++++- htdocs/ticket/card.php | 22 ------------------ 2 files changed, 22 insertions(+), 23 deletions(-) diff --git a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php index 4e98af5c6c7..ff9787dbb06 100644 --- a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php +++ b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php @@ -435,7 +435,6 @@ class InterfaceWorkflowManager extends DolibarrTriggers $number_contracts_found = 0; foreach ($company_ids as $company_id) { $contrat->socid = $company_id; - $list = $contrat->getListOfContracts($option = 'all', $status = [Contrat::STATUS_DRAFT, Contrat::STATUS_VALIDATED], $product_categories = [$conf->global->TICKET_PRODUCT_CATEGORY], $line_status = [ContratLigne::STATUS_INITIAL, ContratLigne::STATUS_OPEN]); if (is_array($list) && !empty($list)) { $number_contracts_found = count($list); @@ -457,6 +456,28 @@ class InterfaceWorkflowManager extends DolibarrTriggers if (empty(NOLOGIN)) setEventMessage($langs->trans('TicketNoContractFoundToLink'), 'mesgs'); } } + // Automatically create intervention + if (!empty($conf->ficheinter->enabled) && !empty($conf->ticket->enabled) && !empty($conf->workflow->enabled) && !empty($conf->global->WORKFLOW_TICKET_CREATE_INTERVENTION) && !empty($object->fk_soc)) { + $fichinter = new Fichinter($this->db); + $fichinter->socid = $object->fk_soc; + $fichinter->fk_project = $projectid; + $fichinter->fk_contrat = (int) $object->fk_contract; + $fichinter->author = $user->id; + $fichinter->model_pdf = 'soleil'; + $fichinter->origin = $object->element; + $fichinter->origin_id = $object->id; + + // Extrafields + $extrafields = new ExtraFields($this->db); + $extrafields->fetch_name_optionals_label($fichinter->table_element); + $array_options = $extrafields->getOptionalsFromPost($fichinter->table_element); + $fichinter->array_options = $array_options; + + $id = $fichinter->create($user); + if ($id <= 0) { + setEventMessages($fichinter->error, null, 'errors'); + } + } } return 0; } diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index 1cebeec3506..99913e6c997 100755 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -254,28 +254,6 @@ if (empty($reshook)) { $result = $object->assignUser($user, $user->id, 1); $object->add_contact($user->id, "SUPPORTTEC", 'internal'); } - - // Auto create fiche intervention - if (!empty($conf->global->TICKET_AUTO_CREATE_FICHINTER_CREATE)) { - $fichinter = new Fichinter($db); - $fichinter->socid = $object->fk_soc; - $fichinter->fk_project = $projectid; - $fichinter->fk_contrat = $object->fk_contract; - $fichinter->author = $user->id; - $fichinter->model_pdf = 'soleil'; - $fichinter->origin = $object->element; - $fichinter->origin_id = $object->id; - - // Extrafields - $extrafields->fetch_name_optionals_label($fichinter->table_element); - $array_options = $extrafields->getOptionalsFromPost($fichinter->table_element); - $fichinter->array_options = $array_options; - - $id = $fichinter->create($user); - if ($id <= 0) { - setEventMessages($fichinter->error, null, 'errors'); - } - } } if (!$error) { From 424125ca03403532778069c430e381b323064ca9 Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Tue, 8 Feb 2022 11:22:38 +0100 Subject: [PATCH 518/610] Workflow fichinter: use default fichinter pdf model --- .../triggers/interface_20_modWorkflow_WorkflowManager.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php index ff9787dbb06..e229e40fd8a 100644 --- a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php +++ b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php @@ -463,7 +463,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers $fichinter->fk_project = $projectid; $fichinter->fk_contrat = (int) $object->fk_contract; $fichinter->author = $user->id; - $fichinter->model_pdf = 'soleil'; + $fichinter->model_pdf = (!empty($conf->global->FICHEINTER_ADDON_PDF)) ? $conf->global->FICHEINTER_ADDON_PDF : 'soleil'; $fichinter->origin = $object->element; $fichinter->origin_id = $object->id; From 35d596e1dcedd7634c39a16b6e0ceea005c505e3 Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Thu, 10 Feb 2022 17:28:18 +0100 Subject: [PATCH 519/610] rename constant TICKET_AUTO_CREATE_FICHINTER_CREATE to WORKFLOW_TICKET_CREATE_INTERVENTION --- htdocs/install/mysql/migration/15.0.0-16.0.0.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql index 1876d3428b4..3859c1331e2 100644 --- a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql +++ b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql @@ -117,6 +117,7 @@ INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) value ALTER TABLE llx_ticket ADD COLUMN date_last_msg_sent datetime AFTER date_read; UPDATE llx_const SET name = 'WORKFLOW_TICKET_LINK_CONTRACT' WHERE name = 'TICKET_AUTO_ASSIGN_CONTRACT_CREATE'; +UPDATE llx_const SET name = 'WORKFLOW_TICKET_CREATE_INTERVENTION' WHERE name = 'TICKET_AUTO_CREATE_FICHINTER_CREATE'; CREATE TABLE llx_stock_mouvement_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, From ac7f02e0d37bff9e45884f3630287155158eadd1 Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Thu, 10 Feb 2022 17:47:40 +0100 Subject: [PATCH 520/610] stickler corrections --- htdocs/admin/workflow.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/admin/workflow.php b/htdocs/admin/workflow.php index a684d642b2f..a68f49e36e3 100644 --- a/htdocs/admin/workflow.php +++ b/htdocs/admin/workflow.php @@ -72,10 +72,10 @@ $workflowcodes = array( 'picto'=>'bill' ), 'WORKFLOW_TICKET_CREATE_INTERVENTION' => array ( - 'family'=>'create', - 'position'=>25, - 'enabled'=>(!empty($conf->ticket->enabled) && !empty($conf->ficheinter->enabled)), - 'picto'=>'ticket' + 'family'=>'create', + 'position'=>25, + 'enabled'=>(!empty($conf->ticket->enabled) && !empty($conf->ficheinter->enabled)), + 'picto'=>'ticket' ), 'separator1'=>array('family'=>'separator', 'position'=>25, 'title'=>''), From 2ec7818c75cdf2c03801a074aade499e6e2fe7c2 Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Fri, 18 Mar 2022 10:13:19 +0100 Subject: [PATCH 521/610] When the ficheinter can't be created, display an error. --- .../interface_20_modWorkflow_WorkflowManager.class.php | 4 ++-- htdocs/fichinter/class/fichinter.class.php | 2 +- htdocs/langs/en_US/interventions.lang | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php index e229e40fd8a..1d46aec1008 100644 --- a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php +++ b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php @@ -457,9 +457,9 @@ class InterfaceWorkflowManager extends DolibarrTriggers } } // Automatically create intervention - if (!empty($conf->ficheinter->enabled) && !empty($conf->ticket->enabled) && !empty($conf->workflow->enabled) && !empty($conf->global->WORKFLOW_TICKET_CREATE_INTERVENTION) && !empty($object->fk_soc)) { + if (!empty($conf->ficheinter->enabled) && !empty($conf->ticket->enabled) && !empty($conf->workflow->enabled) && !empty($conf->global->WORKFLOW_TICKET_CREATE_INTERVENTION)) { $fichinter = new Fichinter($this->db); - $fichinter->socid = $object->fk_soc; + $fichinter->socid = (int) $object->fk_soc; $fichinter->fk_project = $projectid; $fichinter->fk_contrat = (int) $object->fk_contract; $fichinter->author = $user->id; diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index fac008ec304..ee2bf9269ce 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -255,7 +255,7 @@ class Fichinter extends CommonObject } if ($this->socid <= 0) { - $this->error = 'ErrorBadParameterForFunc'; + $this->error = 'ErrorFicheinterCompanyDoesNotExist'; dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR); return -1; } diff --git a/htdocs/langs/en_US/interventions.lang b/htdocs/langs/en_US/interventions.lang index 7c117fcd1f2..a57a84fc4c8 100644 --- a/htdocs/langs/en_US/interventions.lang +++ b/htdocs/langs/en_US/interventions.lang @@ -67,3 +67,4 @@ ToCreateAPredefinedIntervention=To create a predefined or recurring intervention ConfirmReopenIntervention=Are you sure you want to open back the intervention %s? GenerateInter=Generate intervention FichinterNoContractLinked=Intervention %s has been created without a linked contract. +ErrorFicheinterCompanyDoesNotExist=Company does not exist. Intervention has not been created. From 7469cf79f5b5694242c0f4c1715828c9f387ea01 Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Fri, 18 Mar 2022 10:17:16 +0100 Subject: [PATCH 522/610] enhance option explanation string --- htdocs/langs/en_US/workflow.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/workflow.lang b/htdocs/langs/en_US/workflow.lang index e5c07583931..803a31c9646 100644 --- a/htdocs/langs/en_US/workflow.lang +++ b/htdocs/langs/en_US/workflow.lang @@ -7,7 +7,7 @@ descWORKFLOW_PROPAL_AUTOCREATE_ORDER=Automatically create a sales order after a descWORKFLOW_PROPAL_AUTOCREATE_INVOICE=Automatically create a customer invoice after a commercial proposal is signed (the new invoice will have same amount as the proposal) descWORKFLOW_CONTRACT_AUTOCREATE_INVOICE=Automatically create a customer invoice after a contract is validated descWORKFLOW_ORDER_AUTOCREATE_INVOICE=Automatically create a customer invoice after a sales order is closed (the new invoice will have same amount as the order) -descWORKFLOW_TICKET_CREATE_INTERVENTION=Create an intervention when opening a ticket from backend and link it to the ticket. +descWORKFLOW_TICKET_CREATE_INTERVENTION=On ticket creation, automatically create an intervention. # Autoclassify customer proposal or order descWORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL=Classify linked source proposal as billed when sales order is set to billed (and if the amount of the order is the same as the total amount of the signed linked proposal) descWORKFLOW_INVOICE_CLASSIFY_BILLED_PROPAL=Classify linked source proposal as billed when customer invoice is validated (and if the amount of the invoice is the same as the total amount of the signed linked proposal) From a913bf387546a30f5176281640e632ecab2387f9 Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Mon, 4 Apr 2022 09:47:34 +0200 Subject: [PATCH 523/610] fix regression: use $hookmanager as a global variable to avoid errors on thirdparty page. --- htdocs/core/lib/company.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 116c2beeb20..99921ac5fb0 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -41,7 +41,7 @@ */ function societe_prepare_head(Societe $object) { - global $db, $langs, $conf, $user; + global $db, $langs, $conf, $user, $hookmanager; $h = 0; $head = array(); From 563716b633badb6b8db073f2abacd55063bea098 Mon Sep 17 00:00:00 2001 From: atm-florian Date: Mon, 4 Apr 2022 10:00:10 +0200 Subject: [PATCH 524/610] 16.0 - Proposal for trigger prefix consistency: instead of adding missing prefix, check that trigger starts with declared prefix --- htdocs/core/class/commonobject.class.php | 26 ++---------------------- 1 file changed, 2 insertions(+), 24 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index ef9856a2035..c4d0635dde7 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1988,10 +1988,6 @@ abstract class CommonObject $result = $this->fetchCommon($id); } if ($result >= 0) { - - if (!empty(self::TRIGGER_PREFIX) && strpos($trigkey, self::TRIGGER_PREFIX) !== 0) { - $trigkey = self::TRIGGER_PREFIX . '_' . $trigkey; - } $result = $this->call_trigger($trigkey, (!empty($fuser) && is_object($fuser)) ? $fuser : $user); // This may set this->errors } if ($result < 0) { @@ -4274,9 +4270,6 @@ abstract class CommonObject if ($trigkey) { // Call trigger - if (!empty(self::TRIGGER_PREFIX) && strpos($trigkey, self::TRIGGER_PREFIX) !== 0) { - $trigkey = self::TRIGGER_PREFIX . '_' . $trigkey; - } $result = $this->call_trigger($trigkey, $user); if ($result < 0) { $error++; @@ -5610,9 +5603,8 @@ abstract class CommonObject { // phpcs:enable global $langs, $conf; - - if (!empty(self::TRIGGER_PREFIX) && strpos($triggerName, self::TRIGGER_PREFIX) !== 0) { - $triggerName = self::TRIGGER_PREFIX . '_' . $triggerName; + if (!empty(self::TRIGGER_PREFIX) && strpos($triggerName, self::TRIGGER_PREFIX . '_') !== 0) { + throw new Exception('The trigger "' . $triggerName . '" does not start with "' . self::TRIGGER_PREFIX . '_" as required.'); } if (!is_object($langs)) { // If lang was not defined, we set it. It is required by run_triggers. include_once DOL_DOCUMENT_ROOT.'/core/class/translate.class.php'; @@ -6201,9 +6193,6 @@ abstract class CommonObject if (!$error && $trigger) { // Call trigger $this->context = array('extrafieldaddupdate'=>1); - if (!empty(self::TRIGGER_PREFIX) && strpos($trigger, self::TRIGGER_PREFIX) !== 0) { - $trigger = self::TRIGGER_PREFIX . '_' . $trigger; - } $result = $this->call_trigger($trigger, $userused); if ($result < 0) { $error++; @@ -6322,9 +6311,6 @@ abstract class CommonObject if (!$error && $trigger) { // Call trigger $this->context = array('extralanguagesaddupdate'=>1); - if (!empty(self::TRIGGER_PREFIX) && strpos($trigger, self::TRIGGER_PREFIX) !== 0) { - $trigger = self::TRIGGER_PREFIX . '_' . $trigger; - } $result = $this->call_trigger($trigger, $userused); if ($result < 0) { $error++; @@ -6523,10 +6509,6 @@ abstract class CommonObject if (!$error && $trigger) { // Call trigger $this->context = array('extrafieldupdate'=>1); - - if (!empty(self::TRIGGER_PREFIX) && strpos($trigger, self::TRIGGER_PREFIX) !== 0) { - $trigger = self::TRIGGER_PREFIX . '_' . $trigger; - } $result = $this->call_trigger($trigger, $userused); if ($result < 0) { $error++; @@ -9447,10 +9429,6 @@ abstract class CommonObject if (!$error && !$notrigger) { // Call trigger - - if (!empty(self::TRIGGER_PREFIX) && strpos($triggercode, self::TRIGGER_PREFIX) !== 0) { - $triggercode = self::TRIGGER_PREFIX . '_' . $triggercode; - } $result = $this->call_trigger($triggercode, $user); if ($result < 0) { $error++; From 53b185ce9c987f4dbd8b0aae80e380c8f78f8f17 Mon Sep 17 00:00:00 2001 From: Atm-Gregr Date: Mon, 4 Apr 2022 10:19:51 +0200 Subject: [PATCH 525/610] fix condition on remx --- htdocs/comm/remx.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/remx.php b/htdocs/comm/remx.php index f8a4c12fba7..1e3f56c30db 100644 --- a/htdocs/comm/remx.php +++ b/htdocs/comm/remx.php @@ -62,7 +62,7 @@ if (GETPOST('cancel', 'alpha') && !empty($backtopage)) { exit; } -if ($action == 'confirm_split' && GETPOST("confirm", "alpha") == 'yes' && $user->rights->societe->creer) { +if ($action == 'confirm_split' && GETPOST("confirm", "alpha") == 'yes' && ($user->rights->societe->creer || $user->rights->facture->creer)) { //if ($user->rights->societe->creer) //if ($user->rights->facture->creer) @@ -153,7 +153,7 @@ if ($action == 'confirm_split' && GETPOST("confirm", "alpha") == 'yes' && $user- } } -if ($action == 'setremise' && $user->rights->societe->creer) { +if ($action == 'setremise' && ($user->rights->societe->creer || $user->rights->facture->creer)) { //if ($user->rights->societe->creer) //if ($user->rights->facture->creer) @@ -192,7 +192,7 @@ if ($action == 'setremise' && $user->rights->societe->creer) { } } -if (GETPOST('action', 'aZ09') == 'confirm_remove' && GETPOST("confirm") == 'yes' && $user->rights->societe->creer) { +if (GETPOST('action', 'aZ09') == 'confirm_remove' && GETPOST("confirm") == 'yes' && ($user->rights->societe->creer || $user->rights->facture->creer)) { //if ($user->rights->societe->creer) //if ($user->rights->facture->creer) From 9fec63c9088c75c83da68dde7ffcac19cedfc047 Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Mon, 4 Apr 2022 10:20:43 +0200 Subject: [PATCH 526/610] Empty commit to re-launch Travis From 2009cc96e0e7d31a2e1cf3a422cd850a59112198 Mon Sep 17 00:00:00 2001 From: Atm-Gregr Date: Mon, 4 Apr 2022 10:21:06 +0200 Subject: [PATCH 527/610] clean branch --- htdocs/core/lib/security.lib.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index b26c723a014..3ea554a4a8f 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -615,9 +615,6 @@ function checkUserAccessToObject($user, array $featuresarray, $objectid = 0, $ta if ($feature == 'task') { $feature = 'projet_task'; } - if ($feature == 'banque') { - $feature = 'fk_account@bank_account'; - } $check = array('adherent', 'banque', 'bom', 'don', 'mrp', 'user', 'usergroup', 'payment', 'payment_supplier', 'product', 'produit', 'service', 'produit|service', 'categorie', 'resource', 'expensereport', 'holiday', 'salaries', 'website'); // Test on entity only (Objects with no link to company) $checksoc = array('societe'); // Test for societe object From 2913759bb705712b94b6d8e2591215e23d7b3cb6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 4 Apr 2022 10:45:50 +0200 Subject: [PATCH 528/610] Fix syntax --- htdocs/core/modules/modCommande.class.php | 24 +++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/htdocs/core/modules/modCommande.class.php b/htdocs/core/modules/modCommande.class.php index cc6f8baab80..b31db42658d 100644 --- a/htdocs/core/modules/modCommande.class.php +++ b/htdocs/core/modules/modCommande.class.php @@ -335,35 +335,35 @@ class modCommande extends DolibarrModules } // End add extra fields - $this->import_fieldshidden_array[$r] = ['extra.fk_object' => 'lastrowid-'.MAIN_DB_PREFIX.'commande']; - $this->import_regex_array[$r] = [ + $this->import_fieldshidden_array[$r] = array('extra.fk_object' => 'lastrowid-'.MAIN_DB_PREFIX.'commande'); + $this->import_regex_array[$r] = array( 'c.multicurrency_code' => 'code@'.MAIN_DB_PREFIX.'multicurrency' - ]; + ); - $this->import_updatekeys_array[$r] = ['c.ref' => 'Ref']; - $this->import_convertvalue_array[$r] = [ - 'c.fk_soc' => [ + $this->import_updatekeys_array[$r] = array('c.ref' => 'Ref'); + $this->import_convertvalue_array[$r] = array( + 'c.fk_soc' => array( 'rule' => 'fetchidfromref', 'file' => '/societe/class/societe.class.php', 'class' => 'Societe', 'method' => 'fetch', 'element' => 'ThirdParty' - ], - 'c.fk_user_valid' => [ + ), + 'c.fk_user_valid' => array( 'rule' => 'fetchidfromref', 'file' => '/user/class/user.class.php', 'class' => 'User', 'method' => 'fetch', 'element' => 'user' - ], - 'c.fk_mode_reglement' => [ + ), + 'c.fk_mode_reglement' => array( 'rule' => 'fetchidfromcodeorlabel', 'file' => '/compta/paiement/class/cpaiement.class.php', 'class' => 'Cpaiement', 'method' => 'fetch', 'element' => 'cpayment' - ], - ]; + ), + ); //Import CPV Lines $r++; From 2690f4459f58eebeacb7b1905282f61e9bfd8aa3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 4 Apr 2022 13:17:45 +0200 Subject: [PATCH 529/610] NEW Enhance the import. Can use 'auto' for the ref (import of orders) --- htdocs/commande/list.php | 18 ++++- htdocs/core/commonfieldsinimport.inc.php | 63 ++++++++++++++++ htdocs/core/extrafieldsinexport.inc.php | 2 +- htdocs/core/extrafieldsinimport.inc.php | 75 +++++++++++++++++++ .../barcode/mod_barcode_product_standard.php | 2 +- .../core/modules/facture/mod_facture_mars.php | 2 +- .../modules/facture/mod_facture_mercure.php | 2 +- .../modules/facture/mod_facture_terre.php | 4 +- .../core/modules/facture/modules_facture.php | 5 +- .../modules/fichinter/modules_fichinter.php | 6 +- .../holiday/mod_holiday_immaculate.php | 6 +- .../core/modules/holiday/modules_holiday.php | 6 +- .../modules/import/import_csv.modules.php | 27 ++++++- .../modules/import/import_xlsx.modules.php | 31 ++++++-- htdocs/core/modules/modCommande.class.php | 54 ++++++------- .../product_batch/mod_lot_advanced.php | 2 +- .../modules/product_batch/mod_lot_free.php | 6 +- .../product_batch/mod_lot_standard.php | 4 +- .../modules/product_batch/mod_sn_advanced.php | 4 +- .../modules/product_batch/mod_sn_free.php | 6 +- .../modules/product_batch/mod_sn_standard.php | 2 +- .../modules/reception/mod_reception_beryl.php | 4 +- .../modules/reception/modules_reception.php | 4 +- .../modules_facturefournisseur.php | 2 +- .../modules_commandefournisseur.php | 6 +- .../mod_supplier_proposal_marbre.php | 6 +- .../mod_supplier_proposal_saphir.php | 6 +- .../modules_supplier_proposal.php | 8 +- .../takepos/mod_takepos_ref_universal.php | 2 +- .../core/modules/takepos/modules_takepos.php | 7 +- htdocs/core/modules/ticket/modules_ticket.php | 8 +- .../template/class/myobject.class.php | 2 +- .../core/modules/modMyModule.class.php | 37 +++++---- 33 files changed, 311 insertions(+), 108 deletions(-) create mode 100644 htdocs/core/commonfieldsinimport.inc.php create mode 100644 htdocs/core/extrafieldsinimport.inc.php diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index fcbd00fe945..52071b672fe 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -201,6 +201,7 @@ $arrayfields = array( 'c.note_private'=>array('label'=>'NotePrivate', 'checked'=>0, 'enabled'=>(empty($conf->global->MAIN_LIST_ALLOW_PRIVATE_NOTES)), 'position'=>140), 'shippable'=>array('label'=>"Shippable", 'checked'=>1,'enabled'=>(!empty($conf->expedition->enabled)), 'position'=>990), 'c.facture'=>array('label'=>"Billed", 'checked'=>1, 'enabled'=>(empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)), 'position'=>995), + 'c.import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>999), 'c.fk_statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000) ); // Extra fields @@ -441,7 +442,7 @@ $sql .= ' c.date_creation as date_creation, c.tms as date_update, c.date_cloture $sql .= ' p.rowid as project_id, p.ref as project_ref, p.title as project_label,'; $sql .= ' u.login, u.lastname, u.firstname, u.email as user_email, u.statut as user_statut, u.entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender,'; $sql .= ' c.fk_cond_reglement,c.fk_mode_reglement,c.fk_shipping_method,'; -$sql .= ' c.fk_input_reason'; +$sql .= ' c.fk_input_reason, c.import_key'; if (($search_categ_cus > 0) || ($search_categ_cus == -2)) { $sql .= ", cc.fk_categorie, cc.fk_soc"; } @@ -1275,6 +1276,11 @@ if ($resql) { print $form->selectyesno('search_billed', $search_billed, 1, 0, 1, 1); print ''; } + // Import key + if (!empty($arrayfields['c.import_key']['checked'])) { + print ''; + print ''; + } // Status if (!empty($arrayfields['c.fk_statut']['checked'])) { print ''; @@ -1436,6 +1442,9 @@ if ($resql) { if (!empty($arrayfields['c.facture']['checked'])) { print_liste_field_titre($arrayfields['c.facture']['label'], $_SERVER["PHP_SELF"], 'c.facture', '', $param, '', $sortfield, $sortorder, 'center '); } + if (!empty($arrayfields['c.import_key']['checked'])) { + print_liste_field_titre($arrayfields['c.import_key']['label'], $_SERVER["PHP_SELF"], "c.import_key", "", $param, '', $sortfield, $sortorder, 'center '); + } if (!empty($arrayfields['c.fk_statut']['checked'])) { print_liste_field_titre($arrayfields['c.fk_statut']['label'], $_SERVER["PHP_SELF"], "c.fk_statut", "", $param, '', $sortfield, $sortorder, 'center '); } @@ -2063,6 +2072,13 @@ if ($resql) { $totalarray['nbfield']++; } } + // Import key + if (!empty($arrayfields['c.import_key']['checked'])) { + print ''.$obj->import_key.''; + if (!$i) { + $totalarray['nbfield']++; + } + } // Status if (!empty($arrayfields['c.fk_statut']['checked'])) { print ''.$generic_commande->LibStatut($obj->fk_statut, $obj->billed, 5, 1).''; diff --git a/htdocs/core/commonfieldsinimport.inc.php b/htdocs/core/commonfieldsinimport.inc.php new file mode 100644 index 00000000000..60716b8b109 --- /dev/null +++ b/htdocs/core/commonfieldsinimport.inc.php @@ -0,0 +1,63 @@ +db); + + // Add common fields + foreach ($tmpobject->fields as $keyfield => $valuefield) { + $fieldname = $keyforalias.'.'.$keyfield; + $fieldlabel = ucfirst($valuefield['label']); + $typeFilter = "Text"; + $typefield = preg_replace('/\(.*$/', '', $valuefield['type']); // double(24,8) -> double + switch ($typefield) { + case 'int': + case 'integer': + case 'double': + case 'price': + $typeFilter = "Numeric"; + break; + case 'date': + case 'datetime': + case 'timestamp': + $typeFilter = "Date"; + break; + case 'boolean': + $typeFilter = "Boolean"; + break; + /* + * case 'sellist': + * $tmp=''; + * $tmpparam=jsonOrUnserialize($obj->param); // $tmp ay be array 'options' => array 'c_currencies:code_iso:code_iso' => null + * if ($tmpparam['options'] && is_array($tmpparam['options'])) { + * $tmpkeys=array_keys($tmpparam['options']); + * $tmp=array_shift($tmpkeys); + * } + * if (preg_match('/[a-z0-9_]+:[a-z0-9_]+:[a-z0-9_]+/', $tmp)) $typeFilter="List:".$tmp; + * break; + */ + } + $helpfield = ''; + if (!empty($valuefield['help'])) { + $helpfield = preg_replace('/\(.*$/', '', $valuefield['help']); + } + if ($valuefield['enabled']) { + $this->import_fields_array[$r][$fieldname] = $fieldlabel; + $this->import_TypeFields_array[$r][$fieldname] = $typeFilter; + $this->import_entities_array[$r][$fieldname] = $keyforelement; + $this->import_help_array[$r][$fieldname] = $helpfield; + } + } +} else { + dol_print_error($this->db, 'Failed to find class '.$keyforclass.', even after the include of '.$keyforclassfile); +} +// End add common fields diff --git a/htdocs/core/extrafieldsinexport.inc.php b/htdocs/core/extrafieldsinexport.inc.php index fc2210eabd8..4962e353741 100644 --- a/htdocs/core/extrafieldsinexport.inc.php +++ b/htdocs/core/extrafieldsinexport.inc.php @@ -12,7 +12,7 @@ if (empty($keyforselect) || empty($keyforelement) || empty($keyforaliasextra)) { // Add extra fields $sql = "SELECT name, label, type, param, fieldcomputed, fielddefault FROM ".MAIN_DB_PREFIX."extrafields"; -$sql .= " WHERE elementtype = '".$this->db->escape($keyforselect)."' AND type != 'separate' AND entity IN (0, ".$conf->entity.') ORDER BY pos ASC'; +$sql .= " WHERE elementtype = '".$this->db->escape($keyforselect)."' AND type <> 'separate' AND entity IN (0, ".$conf->entity.') ORDER BY pos ASC'; //print $sql; $resql = $this->db->query($sql); if ($resql) { // This can fail when class is used on old database (during migration for example) diff --git a/htdocs/core/extrafieldsinimport.inc.php b/htdocs/core/extrafieldsinimport.inc.php new file mode 100644 index 00000000000..bbfcd7b9fdb --- /dev/null +++ b/htdocs/core/extrafieldsinimport.inc.php @@ -0,0 +1,75 @@ +db->escape($keyforselect)."' AND type <> 'separate' AND entity IN (0, ".$conf->entity.') ORDER BY pos ASC'; +//print $sql; +$resql = $this->db->query($sql); +if ($resql) { // This can fail when class is used on old database (during migration for example) + while ($obj = $this->db->fetch_object($resql)) { + $fieldname = $keyforaliasextra.'.'.$obj->name; + $fieldlabel = ucfirst($obj->label); + $typeFilter = "Text"; + $typefield = preg_replace('/\(.*$/', '', $obj->type); // double(24,8) -> double + switch ($typefield) { + case 'int': + case 'integer': + case 'double': + case 'price': + $typeFilter = "Numeric"; + break; + case 'date': + case 'datetime': + case 'timestamp': + $typeFilter = "Date"; + break; + case 'boolean': + $typeFilter = "Boolean"; + break; + case 'checkbox': + case 'select': + if (!empty($conf->global->EXPORT_LABEL_FOR_SELECT)) { + $tmpparam = jsonOrUnserialize($obj->param); // $tmpparam may be array with 'options' = array(key1=>val1, key2=>val2 ...) + if ($tmpparam['options'] && is_array($tmpparam['options'])) { + $typeFilter = "Select:".$obj->param; + } + } + break; + case 'sellist': + $tmp = ''; + $tmpparam = jsonOrUnserialize($obj->param); // $tmp may be array 'options' => array 'c_currencies:code_iso:code_iso' => null + if (is_array($tmpparam) && array_key_exists('options', $tmpparam) && $tmpparam['options'] && is_array($tmpparam['options'])) { + $tmpkeys = array_keys($tmpparam['options']); + $tmp = array_shift($tmpkeys); + } + if (preg_match('/[a-z0-9_]+:[a-z0-9_]+:[a-z0-9_]+/', $tmp)) { + $typeFilter = "List:".$tmp; + } + break; + } + if ($obj->type != 'separate') { + // If not a computed field + if (empty($obj->fieldcomputed)) { + $this->import_fields_array[$r][$fieldname] = $fieldlabel.($obj->fieldrequired ? '*' : ''); + $this->import_TypeFields_array[$r][$fieldname] = $typeFilter; + $this->import_entities_array[$r][$fieldname] = $keyforelement; + } else { + // If this is a computed field + $this->import_fields_array[$r][$fieldname] = $fieldlabel.($obj->fieldrequired ? '*' : ''); + $this->import_TypeFields_array[$r][$fieldname] = $typeFilter.'Compute'; + $this->import_entities_array[$r][$fieldname] = $keyforelement; + } + } + } +} +// End add axtra fields diff --git a/htdocs/core/modules/barcode/mod_barcode_product_standard.php b/htdocs/core/modules/barcode/mod_barcode_product_standard.php index c101001af4c..17b5a9bb16a 100644 --- a/htdocs/core/modules/barcode/mod_barcode_product_standard.php +++ b/htdocs/core/modules/barcode/mod_barcode_product_standard.php @@ -176,7 +176,7 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode * @param string $type Type of barcode (EAN, ISBN, ...) * @return string Value if OK, '' if module not configured, <0 if KO */ - public function getNextValue($objproduct = null, $type = '') + public function getNextValue($objproduct, $type = '') { global $db, $conf; diff --git a/htdocs/core/modules/facture/mod_facture_mars.php b/htdocs/core/modules/facture/mod_facture_mars.php index c7a69a82caa..ef34b145e52 100644 --- a/htdocs/core/modules/facture/mod_facture_mars.php +++ b/htdocs/core/modules/facture/mod_facture_mars.php @@ -150,7 +150,7 @@ class mod_facture_mars extends ModeleNumRefFactures * @param Societe $objsoc Object third party * @param Facture $invoice Object invoice * @param string $mode 'next' for next value or 'last' for last value - * @return string Value + * @return string Value if OK, 0 if KO */ public function getNextValue($objsoc, $invoice, $mode = 'next') { diff --git a/htdocs/core/modules/facture/mod_facture_mercure.php b/htdocs/core/modules/facture/mod_facture_mercure.php index 621bb8e6d2d..7a572615a21 100644 --- a/htdocs/core/modules/facture/mod_facture_mercure.php +++ b/htdocs/core/modules/facture/mod_facture_mercure.php @@ -171,7 +171,7 @@ class mod_facture_mercure extends ModeleNumRefFactures $this->error = $numFinal; } - return $numFinal; + return $numFinal; } diff --git a/htdocs/core/modules/facture/mod_facture_terre.php b/htdocs/core/modules/facture/mod_facture_terre.php index 55f6dd816d1..9660be93266 100644 --- a/htdocs/core/modules/facture/mod_facture_terre.php +++ b/htdocs/core/modules/facture/mod_facture_terre.php @@ -185,7 +185,7 @@ class mod_facture_terre extends ModeleNumRefFactures * @param Societe $objsoc Object third party * @param Facture $invoice Object invoice * @param string $mode 'next' for next value or 'last' for last value - * @return string Next ref value or last ref if $mode is 'last' + * @return string Next ref value or last ref if $mode is 'last', <= 0 if KO */ public function getNextValue($objsoc, $invoice, $mode = 'next') { @@ -259,6 +259,8 @@ class mod_facture_terre extends ModeleNumRefFactures } else { dol_print_error('', 'Bad parameter for getNextValue'); } + + return 0; } /** diff --git a/htdocs/core/modules/facture/modules_facture.php b/htdocs/core/modules/facture/modules_facture.php index e188f66b1ad..480c532cc1f 100644 --- a/htdocs/core/modules/facture/modules_facture.php +++ b/htdocs/core/modules/facture/modules_facture.php @@ -132,10 +132,11 @@ abstract class ModeleNumRefFactures * Renvoi prochaine valeur attribuee * * @param Societe $objsoc Objet societe - * @param Facture $facture Objet facture + * @param Facture $invoice Objet facture + * @param string $mode 'next' for next value or 'last' for last value * @return string Value */ - public function getNextValue($objsoc, $facture) + public function getNextValue($objsoc, $invoice, $mode = 'next') { global $langs; return $langs->trans("NotAvailable"); diff --git a/htdocs/core/modules/fichinter/modules_fichinter.php b/htdocs/core/modules/fichinter/modules_fichinter.php index 8cf79227d4f..185ef4cf73b 100644 --- a/htdocs/core/modules/fichinter/modules_fichinter.php +++ b/htdocs/core/modules/fichinter/modules_fichinter.php @@ -122,9 +122,11 @@ abstract class ModeleNumRefFicheinter /** * Return the next assigned value * - * @return string Value + * @param Societe $objsoc Object thirdparty + * @param Object $object Object we need next value for + * @return string Value if KO, <0 if KO */ - public function getNextValue() + public function getNextValue($objsoc = 0, $object = '') { global $langs; return $langs->trans("NotAvailable"); diff --git a/htdocs/core/modules/holiday/mod_holiday_immaculate.php b/htdocs/core/modules/holiday/mod_holiday_immaculate.php index 84d6638a27e..a1647a67953 100644 --- a/htdocs/core/modules/holiday/mod_holiday_immaculate.php +++ b/htdocs/core/modules/holiday/mod_holiday_immaculate.php @@ -117,11 +117,11 @@ class mod_holiday_immaculate extends ModelNumRefHolidays /** * Return next value * - * @param Societe $user user object + * @param Societe $objsoc third party object * @param Object $holiday holiday object * @return string Value if OK, 0 if KO */ - public function getNextValue($user, $holiday) + public function getNextValue($objsoc, $holiday) { global $db, $conf; @@ -134,7 +134,7 @@ class mod_holiday_immaculate extends ModelNumRefHolidays return 0; } - $numFinal = get_next_value($db, $mask, 'holiday', 'ref', '', $user, $holiday->date_create); + $numFinal = get_next_value($db, $mask, 'holiday', 'ref', '', $objsoc, $holiday->date_create); return $numFinal; } diff --git a/htdocs/core/modules/holiday/modules_holiday.php b/htdocs/core/modules/holiday/modules_holiday.php index 65b08f4bba8..7b6e13ea992 100644 --- a/htdocs/core/modules/holiday/modules_holiday.php +++ b/htdocs/core/modules/holiday/modules_holiday.php @@ -126,10 +126,10 @@ class ModelNumRefHolidays * Return next value * * @param Societe $objsoc third party object - * @param Object $contract contract object - * @return string Value + * @param Object $holiday Holiday object + * @return string Value if OK, 0 if KO */ - public function getNextValue($objsoc, $contract) + public function getNextValue($objsoc, $holiday) { global $langs; return $langs->trans("NotAvailable"); diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php index 947dd3d18d3..e45630df298 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -324,7 +324,8 @@ class ImportCsv extends ModeleImports //dol_syslog("import_csv.modules maxfields=".$maxfields." importid=".$importid); //var_dump($array_match_file_to_database); - //var_dump($arrayrecord); + //var_dump($arrayrecord); exit; + $array_match_database_to_file = array_flip($array_match_file_to_database); $sort_array_match_file_to_database = $array_match_file_to_database; ksort($sort_array_match_file_to_database); @@ -367,12 +368,15 @@ class ImportCsv extends ModeleImports //dol_syslog("Table ".$tablename." check for entity into cache is ".$tablewithentity_cache[$tablename]); } - // array of fields to column index + // Define array to convert fields ('c.ref', ...) into column index (1, ...) $arrayfield = array(); foreach ($sort_array_match_file_to_database as $key => $val) { $arrayfield[$val] = ($key - 1); } + // $arrayrecord start at key 0 + // $sort_array_match_file_to_database start at key 1 + // Loop on each fields in the match array: $key = 1..n, $val=alias of field (s.nom) foreach ($sort_array_match_file_to_database as $key => $val) { $fieldalias = preg_replace('/\..*$/i', '', $val); @@ -595,9 +599,24 @@ class ImportCsv extends ModeleImports if (!empty($classModForNumber) && !empty($pathModForNumber) && is_readable(DOL_DOCUMENT_ROOT.$pathModForNumber)) { require_once DOL_DOCUMENT_ROOT.$pathModForNumber; $modForNumber = new $classModForNumber; - $defaultref = $modForNumber->getNextValue(null, null); + + $tmpobject = null; + // Set the object when we can + if (!empty($objimport->array_import_convertvalue[0][$val]['classobject'])) { + $pathForObject = $objimport->array_import_convertvalue[0][$val]['pathobject']; + require_once DOL_DOCUMENT_ROOT.$pathForObject; + $tmpclassobject = $objimport->array_import_convertvalue[0][$val]['classobject']; + $tmpobject = new $tmpclassobject($this->db); + foreach ($arrayfield as $tmpkey => $tmpval) { // $arrayfield is array('c.ref'=>0, ...) + if (in_array($tmpkey, array('t.date', 'c.date_commande'))) { + $tmpobject->date = dol_stringtotime($arrayrecord[$arrayfield[$tmpkey]]['val'], 1); + } + } + } + + $defaultref = $modForNumber->getNextValue(null, $tmpobject); } - if (is_numeric($defaultref) && $defaultref <= 0) { + if (is_numeric($defaultref) && $defaultref <= 0) { // If error $defaultref = ''; } $newval = $defaultref; diff --git a/htdocs/core/modules/import/import_xlsx.modules.php b/htdocs/core/modules/import/import_xlsx.modules.php index 3747e8f6847..9fa5cbf2c44 100644 --- a/htdocs/core/modules/import/import_xlsx.modules.php +++ b/htdocs/core/modules/import/import_xlsx.modules.php @@ -367,7 +367,8 @@ class ImportXlsx extends ModeleImports //dol_syslog("import_csv.modules maxfields=".$maxfields." importid=".$importid); //var_dump($array_match_file_to_database); - //var_dump($arrayrecord); + //var_dump($arrayrecord); exit; + $array_match_database_to_file = array_flip($array_match_file_to_database); $sort_array_match_file_to_database = $array_match_file_to_database; ksort($sort_array_match_file_to_database); @@ -410,12 +411,15 @@ class ImportXlsx extends ModeleImports //dol_syslog("Table ".$tablename." check for entity into cache is ".$tablewithentity_cache[$tablename]); } - // array of fields to column index + // Define array to convert fields ('c.ref', ...) into column index (1, ...) $arrayfield = array(); foreach ($sort_array_match_file_to_database as $key => $val) { - $arrayfield[$val] = ($key - 1); + $arrayfield[$val] = ($key); } + // $arrayrecord start at key 1 + // $sort_array_match_file_to_database start at key 1 + // Loop on each fields in the match array: $key = 1..n, $val=alias of field (s.nom) foreach ($sort_array_match_file_to_database as $key => $val) { $fieldalias = preg_replace('/\..*$/i', '', $val); @@ -619,7 +623,7 @@ class ImportXlsx extends ModeleImports $this->thirpartyobject->get_codecompta('supplier'); $newval = $this->thirpartyobject->code_compta_fournisseur; if (empty($newval)) { - $arrayrecord[($key - 1)]['type'] = -1; // If we get empty value, we will use "null" + $arrayrecord[($key)]['type'] = -1; // If we get empty value, we will use "null" } //print 'code_compta_fournisseur='.$newval; } @@ -636,9 +640,24 @@ class ImportXlsx extends ModeleImports if (!empty($classModForNumber) && !empty($pathModForNumber) && is_readable(DOL_DOCUMENT_ROOT.$pathModForNumber)) { require_once DOL_DOCUMENT_ROOT.$pathModForNumber; $modForNumber = new $classModForNumber; - $defaultref = $modForNumber->getNextValue(null, null); + + $tmpobject = null; + // Set the object with the date property when we can + if (!empty($objimport->array_import_convertvalue[0][$val]['classobject'])) { + $pathForObject = $objimport->array_import_convertvalue[0][$val]['pathobject']; + require_once DOL_DOCUMENT_ROOT.$pathForObject; + $tmpclassobject = $objimport->array_import_convertvalue[0][$val]['classobject']; + $tmpobject = new $tmpclassobject($this->db); + foreach ($arrayfield as $tmpkey => $tmpval) { // $arrayfield is array('c.ref'=>1, ...) + if (in_array($tmpkey, array('t.date', 'c.date_commande'))) { + $tmpobject->date = dol_stringtotime($arrayrecord[$arrayfield[$tmpkey]]['val'], 1); + } + } + } + + $defaultref = $modForNumber->getNextValue(null, $tmpobject); } - if (is_numeric($defaultref) && $defaultref <= 0) { + if (is_numeric($defaultref) && $defaultref <= 0) { // If error $defaultref = ''; } $newval = $defaultref; diff --git a/htdocs/core/modules/modCommande.class.php b/htdocs/core/modules/modCommande.class.php index b5c07d5221e..af3d033e670 100644 --- a/htdocs/core/modules/modCommande.class.php +++ b/htdocs/core/modules/modCommande.class.php @@ -296,18 +296,18 @@ class modCommande extends DolibarrModules $this->import_entities_array[$r] = array(); $this->import_tables_array[$r] = array('c' => MAIN_DB_PREFIX.'commande', 'extra' => MAIN_DB_PREFIX.'commande_extrafields'); $this->import_tables_creator_array[$r] = array('c' => 'fk_user_author'); // Fields to store import user id + $import_sample = array(); $this->import_fields_array[$r] = array( 'c.ref' => 'Ref*', 'c.ref_client' => 'RefCustomer', 'c.fk_soc' => 'ThirdPartyName*', 'c.fk_projet' => 'ProjectId', 'c.date_creation' => 'DateCreation', - 'c.date_valid' => 'DateValid', - 'c.date_commande' => 'DateOrder', + 'c.date_valid' => 'DateValidation', + 'c.date_commande' => 'OrderDate*', 'c.fk_user_modif' => 'ModifiedById', 'c.fk_user_valid' => 'ValidatedById', - 'c.fk_statut' => 'Status*', - 'c.remise_percent' => 'GlobalDiscount', + //'c.remise_percent' => 'GlobalDiscount', 'c.total_tva' => 'TotalTVA', 'c.total_ht' => 'TotalHT', 'c.total_ttc' => 'TotalTTC', @@ -317,7 +317,8 @@ class modCommande extends DolibarrModules 'c.date_livraison' => 'DeliveryDate', 'c.fk_cond_reglement' => 'Payment Condition', 'c.fk_mode_reglement' => 'Payment Mode', - 'c.model_pdf' => 'Model' + 'c.model_pdf' => 'Model', + 'c.fk_statut' => 'Status*' ); if (!empty($conf->multicurrency->enabled)) { @@ -327,29 +328,26 @@ class modCommande extends DolibarrModules $this->import_fields_array[$r]['c.multicurrency_total_tva'] = 'MulticurrencyAmountVAT'; $this->import_fields_array[$r]['c.multicurrency_total_ttc'] = 'MulticurrencyAmountTTC'; } - - // Add extra fields $import_extrafield_sample = array(); - $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE type <> 'separate' AND elementtype = 'commande' AND entity IN (0, ".$conf->entity.")"; - $resql = $this->db->query($sql); - - if ($resql) { - while ($obj = $this->db->fetch_object($resql)) { - $fieldname = 'extra.'.$obj->name; - $fieldlabel = ucfirst($obj->label); - $this->import_fields_array[$r][$fieldname] = $fieldlabel.($obj->fieldrequired ? '*' : ''); - $import_extrafield_sample[$fieldname] = $fieldlabel; - } - } - // End add extra fields + $keyforselect = 'commande'; + $keyforelement = 'order'; + $keyforaliasextra = 'extra'; + include DOL_DOCUMENT_ROOT.'/core/extrafieldsinimport.inc.php'; $this->import_fieldshidden_array[$r] = array('extra.fk_object' => 'lastrowid-'.MAIN_DB_PREFIX.'commande'); $this->import_regex_array[$r] = array( 'c.multicurrency_code' => 'code@'.MAIN_DB_PREFIX.'multicurrency' ); - + $this->import_examplevalues_array[$r] = array_merge($import_sample, $import_extrafield_sample); $this->import_updatekeys_array[$r] = array('c.ref' => 'Ref'); $this->import_convertvalue_array[$r] = array( + 'c.ref' => array( + 'rule'=>'getrefifauto', + 'class'=>(empty($conf->global->COMMANDE_ADDON) ? 'mod_commande_marbre' : $conf->global->COMMANDE_ADDON), + 'path'=>"/core/modules/commande/".(empty($conf->global->COMMANDE_ADDON) ? 'mod_commande_marbre' : $conf->global->COMMANDE_ADDON).'.php', + 'classobject'=>'Commande', + 'pathobject'=>'/commande/class/commande.class.php', + ), 'c.fk_soc' => array( 'rule' => 'fetchidfromref', 'file' => '/societe/class/societe.class.php', @@ -410,17 +408,11 @@ class modCommande extends DolibarrModules $this->import_fields_array[$r]['cd.multicurrency_total_ttc'] = 'MulticurrencyAmountTTC'; } - // Add extra fields - $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE type <> 'separate' AND elementtype = 'commandedet' AND entity IN (0, ".$conf->entity.")"; - $resql = $this->db->query($sql); - if ($resql) { - while ($obj = $this->db->fetch_object($resql)) { - $fieldname = 'extra.'.$obj->name; - $fieldlabel = ucfirst($obj->label); - $this->import_fields_array[$r][$fieldname] = $fieldlabel.($obj->fieldrequired ? '*' : ''); - } - } - // End add extra fields + $import_extrafield_sample = array(); + $keyforselect = 'commandedet'; + $keyforelement = 'orderline'; + $keyforaliasextra = 'extra'; + include DOL_DOCUMENT_ROOT.'/core/extrafieldsinimport.inc.php'; $this->import_fieldshidden_array[$r] = ['extra.fk_object' => 'lastrowid-'.MAIN_DB_PREFIX.'commandedet']; $this->import_regex_array[$r] = [ diff --git a/htdocs/core/modules/product_batch/mod_lot_advanced.php b/htdocs/core/modules/product_batch/mod_lot_advanced.php index d44a261a16b..d56178697f5 100644 --- a/htdocs/core/modules/product_batch/mod_lot_advanced.php +++ b/htdocs/core/modules/product_batch/mod_lot_advanced.php @@ -128,7 +128,7 @@ class mod_lot_advanced extends ModeleNumRefBatch /** * Return next free value * - * @param Societe $objsoc Object Societe + * @param Societe $objsoc Object thirdparty * @param Object $object Object we need next value for * @return string Value if KO, <0 if KO */ diff --git a/htdocs/core/modules/product_batch/mod_lot_free.php b/htdocs/core/modules/product_batch/mod_lot_free.php index def14bd37b3..d6b24945ab0 100644 --- a/htdocs/core/modules/product_batch/mod_lot_free.php +++ b/htdocs/core/modules/product_batch/mod_lot_free.php @@ -93,11 +93,11 @@ class mod_lot_free extends ModeleNumRefBatch /** * Return an example of result returned by getNextValue * - * @param product $objproduct Object product - * @param int $type Type of third party (1:customer, 2:supplier, -1:autodetect) + * @param Societe $objsoc Object thirdparty + * @param Object $object Object we need next value for * @return string Return next value */ - public function getNextValue($objproduct = 0, $type = -1) + public function getNextValue($objsoc, $object) { global $langs; return ''; diff --git a/htdocs/core/modules/product_batch/mod_lot_standard.php b/htdocs/core/modules/product_batch/mod_lot_standard.php index 59de1965a6e..fc8d1389a00 100644 --- a/htdocs/core/modules/product_batch/mod_lot_standard.php +++ b/htdocs/core/modules/product_batch/mod_lot_standard.php @@ -111,11 +111,11 @@ class mod_lot_standard extends ModeleNumRefBatch /** * Return next free value * - * @param Product $objprod Object product + * @param Societe $objsoc Object thirdparty * @param Object $object Object we need next value for * @return string Value if KO, <0 if KO */ - public function getNextValue($objprod, $object) + public function getNextValue($objsoc, $object) { global $db, $conf; diff --git a/htdocs/core/modules/product_batch/mod_sn_advanced.php b/htdocs/core/modules/product_batch/mod_sn_advanced.php index abe094220d2..6ee931d51a9 100644 --- a/htdocs/core/modules/product_batch/mod_sn_advanced.php +++ b/htdocs/core/modules/product_batch/mod_sn_advanced.php @@ -128,11 +128,11 @@ class mod_sn_advanced extends ModeleNumRefBatch /** * Return next free value * - * @param Product $objprod Object product + * @param Societe $objsoc Object thirdparty * @param Object $object Object we need next value for * @return string Value if KO, <0 if KO */ - public function getNextValue($objprod, $object) + public function getNextValue($objsoc, $object) { global $db, $conf; diff --git a/htdocs/core/modules/product_batch/mod_sn_free.php b/htdocs/core/modules/product_batch/mod_sn_free.php index 67d39ec085a..f6b2417d34b 100644 --- a/htdocs/core/modules/product_batch/mod_sn_free.php +++ b/htdocs/core/modules/product_batch/mod_sn_free.php @@ -92,11 +92,11 @@ class mod_sn_free extends ModeleNumRefBatch /** * Return an example of result returned by getNextValue * - * @param product $objproduct Object product - * @param int $type Type of third party (1:customer, 2:supplier, -1:autodetect) + * @param Societe $objsoc Object thirdparty + * @param Object $object Object we need next value for * @return string Return next value */ - public function getNextValue($objproduct = 0, $type = -1) + public function getNextValue($objsoc, $object) { global $langs; return ''; diff --git a/htdocs/core/modules/product_batch/mod_sn_standard.php b/htdocs/core/modules/product_batch/mod_sn_standard.php index 845044c39f3..d6c109cff81 100644 --- a/htdocs/core/modules/product_batch/mod_sn_standard.php +++ b/htdocs/core/modules/product_batch/mod_sn_standard.php @@ -111,7 +111,7 @@ class mod_sn_standard extends ModeleNumRefBatch /** * Return next free value * - * @param Societe $objsoc Object product + * @param Societe $objsoc Object thirdparty * @param Object $object Object we need next value for * @return string Value if KO, <0 if KO */ diff --git a/htdocs/core/modules/reception/mod_reception_beryl.php b/htdocs/core/modules/reception/mod_reception_beryl.php index bbfc0daee45..6570f2c864a 100644 --- a/htdocs/core/modules/reception/mod_reception_beryl.php +++ b/htdocs/core/modules/reception/mod_reception_beryl.php @@ -96,10 +96,10 @@ class mod_reception_beryl extends ModelNumRefReception * Return next value * * @param Societe $objsoc Third party object - * @param Object $shipment Shipment object + * @param Object $reception Reception object * @return string Value if OK, 0 if KO */ - public function getNextValue($objsoc, $shipment) + public function getNextValue($objsoc, $reception) { global $db, $conf; diff --git a/htdocs/core/modules/reception/modules_reception.php b/htdocs/core/modules/reception/modules_reception.php index 145a04fbd31..f519974382b 100644 --- a/htdocs/core/modules/reception/modules_reception.php +++ b/htdocs/core/modules/reception/modules_reception.php @@ -110,10 +110,10 @@ abstract class ModelNumRefReception * Returns next value assigned * * @param Societe $objsoc Third party object - * @param Object $shipment Shipment object + * @param Object $reception Reception object * @return string Value */ - public function getNextValue($objsoc, $shipment) + public function getNextValue($objsoc, $reception) { global $langs; return $langs->trans("NotAvailable"); diff --git a/htdocs/core/modules/supplier_invoice/modules_facturefournisseur.php b/htdocs/core/modules/supplier_invoice/modules_facturefournisseur.php index acb3ad8fa2a..546596ab640 100644 --- a/htdocs/core/modules/supplier_invoice/modules_facturefournisseur.php +++ b/htdocs/core/modules/supplier_invoice/modules_facturefournisseur.php @@ -120,7 +120,7 @@ abstract class ModeleNumRefSuppliersInvoices * @param string $mode 'next' for next value or 'last' for last value * @return string Value if OK, 0 if KO */ - public function getNextValue($objsoc, $object, $mode) + public function getNextValue($objsoc, $object, $mode = 'next') { global $langs; return $langs->trans("NotAvailable"); diff --git a/htdocs/core/modules/supplier_order/modules_commandefournisseur.php b/htdocs/core/modules/supplier_order/modules_commandefournisseur.php index 6fe3cb8883d..51c4e5f07d3 100644 --- a/htdocs/core/modules/supplier_order/modules_commandefournisseur.php +++ b/htdocs/core/modules/supplier_order/modules_commandefournisseur.php @@ -120,9 +120,11 @@ abstract class ModeleNumRefSuppliersOrders /** Returns next value assigned * - * @return string Valeur + * @param Societe $objsoc Object third party + * @param Object $object Object + * @return string Valeur */ - public function getNextValue() + public function getNextValue($objsoc = 0, $object = '') { global $langs; return $langs->trans("NotAvailable"); diff --git a/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_marbre.php b/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_marbre.php index b225899cef2..2e618b3ece3 100644 --- a/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_marbre.php +++ b/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_marbre.php @@ -120,9 +120,9 @@ class mod_supplier_proposal_marbre extends ModeleNumRefSupplierProposal /** * Return next value * - * @param Societe $objsoc Object third party - * @param Propal $supplier_proposal Object commercial proposal - * @return string Next value + * @param Societe $objsoc Object third party + * @param SupplierProposal $supplier_proposal Object commercial proposal + * @return string Next value */ public function getNextValue($objsoc, $supplier_proposal) { diff --git a/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_saphir.php b/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_saphir.php index e7db54062cb..57cba16c01b 100644 --- a/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_saphir.php +++ b/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_saphir.php @@ -120,9 +120,9 @@ class mod_supplier_proposal_saphir extends ModeleNumRefSupplierProposal /** * Return next value * - * @param Societe $objsoc Object third party - * @param Propal $supplier_proposal Object supplier_proposal - * @return string Value if OK, 0 if KO + * @param Societe $objsoc Object third party + * @param SupplierProposal $supplier_proposal Object commercial proposal + * @return string Value if OK, 0 if KO */ public function getNextValue($objsoc, $supplier_proposal) { diff --git a/htdocs/core/modules/supplier_proposal/modules_supplier_proposal.php b/htdocs/core/modules/supplier_proposal/modules_supplier_proposal.php index 0b6f0b3725d..5a3d9e2280a 100644 --- a/htdocs/core/modules/supplier_proposal/modules_supplier_proposal.php +++ b/htdocs/core/modules/supplier_proposal/modules_supplier_proposal.php @@ -124,11 +124,11 @@ abstract class ModeleNumRefSupplierProposal /** * Renvoi prochaine valeur attribuee * - * @param Societe $objsoc Object third party - * @param Propal $propal Object commercial proposal - * @return string Valeur + * @param Societe $objsoc Object third party + * @param SupplierProposal $supplier_proposal Object commercial proposal + * @return string Valeur */ - public function getNextValue($objsoc, $propal) + public function getNextValue($objsoc, $supplier_proposal) { global $langs; return $langs->trans("NotAvailable"); diff --git a/htdocs/core/modules/takepos/mod_takepos_ref_universal.php b/htdocs/core/modules/takepos/mod_takepos_ref_universal.php index b3d26b39511..7e46c10a341 100644 --- a/htdocs/core/modules/takepos/mod_takepos_ref_universal.php +++ b/htdocs/core/modules/takepos/mod_takepos_ref_universal.php @@ -119,7 +119,7 @@ class mod_takepos_ref_universal extends ModeleNumRefTakepos * @param string $mode 'next' for next value or 'last' for last value * @return string Value if KO, <0 if KO */ - public function getNextValue($objsoc = 0, $invoice = null, $mode = 'next') + public function getNextValue($objsoc = null, $invoice = null, $mode = 'next') { global $db, $conf; diff --git a/htdocs/core/modules/takepos/modules_takepos.php b/htdocs/core/modules/takepos/modules_takepos.php index b9fae565647..24fa70b7f28 100644 --- a/htdocs/core/modules/takepos/modules_takepos.php +++ b/htdocs/core/modules/takepos/modules_takepos.php @@ -89,9 +89,12 @@ abstract class ModeleNumRefTakepos /** * Renvoi prochaine valeur attribuee * - * @return string Valeur + * @param Societe $objsoc Object thirdparty + * @param Facture $invoice Object invoice + * @param string $mode 'next' for next value or 'last' for last value + * @return string Value if KO, <0 if KO */ - public function getNextValue() + public function getNextValue($objsoc = null, $invoice = null, $mode = 'next') { global $langs; return $langs->trans('NotAvailable'); diff --git a/htdocs/core/modules/ticket/modules_ticket.php b/htdocs/core/modules/ticket/modules_ticket.php index 1d2bc944022..c8561382436 100644 --- a/htdocs/core/modules/ticket/modules_ticket.php +++ b/htdocs/core/modules/ticket/modules_ticket.php @@ -115,11 +115,11 @@ abstract class ModeleNumRefTicket /** * Renvoi prochaine valeur attribuee * - * @param Societe $objsoc Object third party - * @param Project $project Object project - * @return string Valeur + * @param Societe $objsoc Object third party + * @param Ticket $ticket Object ticket + * @return string Valeur */ - public function getNextValue($objsoc, $project) + public function getNextValue($objsoc, $ticket) { global $langs; return $langs->trans("NotAvailable"); diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index d6e59e4b2bd..288fd88eae6 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -122,7 +122,7 @@ class MyObject extends CommonObject 'last_main_doc' => array('type'=>'varchar(255)', 'label'=>'LastMainDoc', 'enabled'=>1, 'visible'=>0, 'notnull'=>0, 'position'=>600), 'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'index'=>0, 'position'=>1000), 'model_pdf' => array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'notnull'=>-1, 'position'=>1010), - 'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=> 1, 'default'=>0, 'index'=>1, 'position'=>1000, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Validated', 9=>'Canceled'), 'validate'=>1), + 'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=> 1, 'default'=>0, 'index'=>1, 'position'=>2000, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Validated', 9=>'Canceled'), 'validate'=>1), ); /** diff --git a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php index 874d964ad6e..898dd2692e4 100644 --- a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php +++ b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php @@ -382,20 +382,29 @@ class modMyModule extends DolibarrModules $r = 1; /* BEGIN MODULEBUILDER IMPORT MYOBJECT */ /* - $langs->load("mymodule@mymodule"); - $this->export_code[$r]=$this->rights_class.'_'.$r; - $this->export_label[$r]='MyObjectLines'; // Translation key (used only if key ExportDataset_xxx_z not found) - $this->export_icon[$r]='myobject@mymodule'; - $keyforclass = 'MyObject'; $keyforclassfile='/mymodule/class/myobject.class.php'; $keyforelement='myobject@mymodule'; - include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php'; - $keyforselect='myobject'; $keyforaliasextra='extra'; $keyforelement='myobject@mymodule'; - include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; - //$this->export_dependencies_array[$r]=array('mysubobject'=>'ts.rowid', 't.myfield'=>array('t.myfield2','t.myfield3')); // To force to activate one or several fields if we select some fields that need same (like to select a unique key if we ask a field of a child to avoid the DISTINCT to discard them, or for computed field than need several other fields) - $this->export_sql_start[$r]='SELECT DISTINCT '; - $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'myobject as t'; - $this->export_sql_end[$r] .=' WHERE 1 = 1'; - $this->export_sql_end[$r] .=' AND t.entity IN ('.getEntity('myobject').')'; - $r++; */ + $langs->load("mymodule@mymodule"); + $this->import_code[$r]=$this->rights_class.'_'.$r; + $this->import_label[$r]='MyObjectLines'; // Translation key (used only if key ExportDataset_xxx_z not found) + $this->import_icon[$r]='myobject@mymodule'; + $this->import_tables_array[$r] = array('t' => MAIN_DB_PREFIX.'mymodule_myobject', 'extra' => MAIN_DB_PREFIX.'mymodule_myobject_extrafields'); + $this->import_tables_creator_array[$r] = array('t' => 'fk_user_author'); // Fields to store import user id + $import_sample = array(); + $keyforclass = 'MyObject'; $keyforclassfile='/mymodule/class/myobject.class.php'; $keyforelement='myobject@mymodule'; + include DOL_DOCUMENT_ROOT.'/core/commonfieldsinimport.inc.php'; + $import_extrafield_sample = array(); + $keyforselect='myobject'; $keyforaliasextra='extra'; $keyforelement='myobject@mymodule'; + include DOL_DOCUMENT_ROOT.'/core/extrafieldsinimport.inc.php'; + $this->import_fieldshidden_array[$r] = array('extra.fk_object' => 'lastrowid-'.MAIN_DB_PREFIX.'mymodule_myobject'); + $this->import_regex_array[$r] = array(); + $this->import_examplevalues_array[$r] = array_merge($import_sample, $import_extrafield_sample); + $this->import_updatekeys_array[$r] = array('t.ref' => 'Ref'); + $this->import_convertvalue_array[$r] = array( + 't.ref' => array('rule'=>'getrefifauto', 'class'=>(empty($conf->global->MYMODULE_MYOBJECT_ADDON) ? 'mod_myobject_standard' : $conf->global->MYMODULE_MYOBJECT_ADDON), 'path'=>"/core/modules/commande/".(empty($conf->global->MYMODULE_MYOBJECT_ADDON) ? 'mod_myobject_standard' : $conf->global->MYMODULE_MYOBJECT_ADDON).'.php'), + 't.fk_soc' => array('rule' => 'fetchidfromref', 'file' => '/societe/class/societe.class.php', 'class' => 'Societe', 'method' => 'fetch', 'element' => 'ThirdParty'), + 't.fk_user_valid' => array('rule' => 'fetchidfromref', 'file' => '/user/class/user.class.php', 'class' => 'User', 'method' => 'fetch', 'element' => 'user'), + 't.fk_mode_reglement' => array('rule' => 'fetchidfromcodeorlabel', 'file' => '/compta/paiement/class/cpaiement.class.php', 'class' => 'Cpaiement', 'method' => 'fetch', 'element' => 'cpayment'), + ); + $r++; */ /* END MODULEBUILDER IMPORT MYOBJECT */ } From af45691c9d23255e3ced8c66eaef280767b4da74 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 4 Apr 2022 13:35:08 +0200 Subject: [PATCH 530/610] Clean import profiles --- htdocs/core/modules/modCommande.class.php | 19 ++++++++---------- htdocs/core/modules/modFacture.class.php | 4 ++-- htdocs/core/modules/modFournisseur.class.php | 9 ++------- htdocs/core/modules/modPropale.class.php | 20 +++++++------------ htdocs/langs/en_US/bills.lang | 1 - htdocs/langs/en_US/main.lang | 1 + htdocs/langs/en_US/propal.lang | 1 - .../core/modules/modMyModule.class.php | 8 +++++++- 8 files changed, 27 insertions(+), 36 deletions(-) diff --git a/htdocs/core/modules/modCommande.class.php b/htdocs/core/modules/modCommande.class.php index af3d033e670..9aac30fe8a5 100644 --- a/htdocs/core/modules/modCommande.class.php +++ b/htdocs/core/modules/modCommande.class.php @@ -196,10 +196,10 @@ class modCommande extends DolibarrModules 's.rowid'=>"IdCompany", 's.nom'=>'CompanyName', 'ps.nom'=>'ParentCompany', 's.address'=>'Address', 's.zip'=>'Zip', 's.town'=>'Town', 'd.nom'=>'State', 'co.label'=>'Country', 'co.code'=>"CountryCode", 's.phone'=>'Phone', 's.siren'=>'ProfId1', 's.siret'=>'ProfId2', 's.ape'=>'ProfId3', 's.idprof4'=>'ProfId4', 'c.rowid'=>"Id", 'c.ref'=>"Ref", 'c.ref_client'=>"RefCustomer", 'c.fk_soc'=>"IdCompany", 'c.date_creation'=>"DateCreation", 'c.date_commande'=>"OrderDate", - 'c.date_livraison'=>"DateDeliveryPlanned", 'c.amount_ht'=>"Amount", 'c.remise_percent'=>"GlobalDiscount", 'c.total_ht'=>"TotalHT", + 'c.date_livraison'=>"DateDeliveryPlanned", 'c.amount_ht'=>"Amount", 'c.total_ht'=>"TotalHT", 'c.total_ttc'=>"TotalTTC", 'c.facture'=>"Billed", 'c.fk_statut'=>'Status', 'c.note_public'=>"Note", 'c.date_livraison'=>'DeliveryDate', 'c.fk_user_author'=>'CreatedById', 'uc.login'=>'CreatedByLogin', 'c.fk_user_valid'=>'ValidatedById', 'uv.login'=>'ValidatedByLogin', - 'pj.ref'=>'ProjectRef', 'cd.rowid'=>'LineId', 'cd.label'=>"Label", 'cd.description'=>"LineDescription", 'cd.product_type'=>'TypeOfLineServiceOrProduct', + 'pj.ref'=>'ProjectRef', 'cd.rowid'=>'LineId', 'cd.description'=>"LineDescription", 'cd.product_type'=>'TypeOfLineServiceOrProduct', 'cd.tva_tx'=>"LineVATRate", 'cd.qty'=>"LineQty", 'cd.total_ht'=>"LineTotalHT", 'cd.total_tva'=>"LineTotalVAT", 'cd.total_ttc'=>"LineTotalTTC", 'p.rowid'=>'ProductId', 'p.ref'=>'ProductRef', 'p.label'=>'ProductLabel' ); @@ -220,7 +220,7 @@ class modCommande extends DolibarrModules //$this->export_TypeFields_array[$r]=array( // 's.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','co.label'=>'List:c_country:label:label', // 'co.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','c.ref'=>"Text",'c.ref_client'=>"Text", - // 'c.date_creation'=>"Date",'c.date_commande'=>"Date",'c.amount_ht'=>"Numeric",'c.remise_percent'=>"Numeric",'c.total_ht'=>"Numeric", + // 'c.date_creation'=>"Date",'c.date_commande'=>"Date",'c.amount_ht'=>"Numeric",'c.total_ht'=>"Numeric", // 'c.total_ttc'=>"Numeric",'c.facture'=>"Boolean",'c.fk_statut'=>'Status','c.note_public'=>"Text",'c.date_livraison'=>'Date','cd.description'=>"Text", // 'cd.product_type'=>'Boolean','cd.tva_tx'=>"Numeric",'cd.qty'=>"Numeric",'cd.total_ht'=>"Numeric",'cd.total_tva'=>"Numeric",'cd.total_ttc'=>"Numeric", // 'p.rowid'=>'List:product:ref','p.ref'=>'Text','p.label'=>'Text' @@ -228,7 +228,7 @@ class modCommande extends DolibarrModules $this->export_TypeFields_array[$r] = array( 's.nom'=>'Text', 'ps.nom'=>'Text', 's.address'=>'Text', 's.zip'=>'Text', 's.town'=>'Text', 'co.label'=>'List:c_country:label:label', 'co.code'=>'Text', 's.phone'=>'Text', 's.siren'=>'Text', 's.siret'=>'Text', 's.ape'=>'Text', 's.idprof4'=>'Text', 'c.ref'=>"Text", 'c.ref_client'=>"Text", 'c.date_creation'=>"Date", - 'c.date_commande'=>"Date", 'c.date_livraison'=>"Date", 'c.amount_ht'=>"Numeric", 'c.remise_percent'=>"Numeric", 'c.total_ht'=>"Numeric", + 'c.date_commande'=>"Date", 'c.date_livraison'=>"Date", 'c.amount_ht'=>"Numeric", 'c.total_ht'=>"Numeric", 'c.total_ttc'=>"Numeric", 'c.facture'=>"Boolean", 'c.fk_statut'=>'Status', 'c.note_public'=>"Text", 'c.date_livraison'=>'Date', 'pj.ref'=>'Text', 'cd.description'=>"Text", 'cd.product_type'=>'Boolean', 'cd.tva_tx'=>"Numeric", 'cd.qty'=>"Numeric", 'cd.total_ht'=>"Numeric", 'cd.total_tva'=>"Numeric", 'cd.total_ttc'=>"Numeric", 'p.rowid'=>'List:product:ref::product', 'p.ref'=>'Text', 'p.label'=>'Text', 'd.nom'=>'Text', @@ -238,8 +238,8 @@ class modCommande extends DolibarrModules 's.rowid'=>"company", 's.nom'=>'company', 'ps.nom'=>'company', 's.address'=>'company', 's.zip'=>'company', 's.town'=>'company', 'd.nom'=>'company', 'co.label'=>'company', 'co.code'=>'company', 's.phone'=>'company', 's.siren'=>'company', 's.ape'=>'company', 's.idprof4'=>'company', 's.siret'=>'company', 'c.rowid'=>"order", 'c.ref'=>"order", 'c.ref_client'=>"order", 'c.fk_soc'=>"order", 'c.date_creation'=>"order", 'c.date_commande'=>"order", 'c.amount_ht'=>"order", - 'c.remise_percent'=>"order", 'c.total_ht'=>"order", 'c.total_ttc'=>"order", 'c.facture'=>"order", 'c.fk_statut'=>"order", 'c.note'=>"order", - 'c.date_livraison'=>"order", 'pj.ref'=>'project', 'cd.rowid'=>'order_line', 'cd.label'=>"order_line", 'cd.description'=>"order_line", + 'c.total_ht'=>"order", 'c.total_ttc'=>"order", 'c.facture'=>"order", 'c.fk_statut'=>"order", 'c.note'=>"order", + 'c.date_livraison'=>"order", 'pj.ref'=>'project', 'cd.rowid'=>'order_line', 'cd.description'=>"order_line", 'cd.product_type'=>'order_line', 'cd.tva_tx'=>"order_line", 'cd.qty'=>"order_line", 'cd.total_ht'=>"order_line", 'cd.total_tva'=>"order_line", 'cd.total_ttc'=>"order_line", 'p.rowid'=>'product', 'p.ref'=>'product', 'p.label'=>'product' ); @@ -307,7 +307,6 @@ class modCommande extends DolibarrModules 'c.date_commande' => 'OrderDate*', 'c.fk_user_modif' => 'ModifiedById', 'c.fk_user_valid' => 'ValidatedById', - //'c.remise_percent' => 'GlobalDiscount', 'c.total_tva' => 'TotalTVA', 'c.total_ht' => 'TotalHT', 'c.total_ttc' => 'TotalTTC', @@ -379,15 +378,13 @@ class modCommande extends DolibarrModules $this->import_entities_array[$r] = array(); $this->import_tables_array[$r] = array('cd' => MAIN_DB_PREFIX.'commandedet', 'extra' => MAIN_DB_PREFIX.'commandedet_extrafields'); $this->import_fields_array[$r] = array( - 'cd.fk_commande' => 'SalesOrder*', - 'cd.fk_parent_line' => 'PrParentLine', + 'cd.fk_commande' => 'CustomerOrder*', + 'cd.fk_parent_line' => 'ParentLine', 'cd.fk_product' => 'IdProduct', - 'cd.label' => 'Label', 'cd.description' => 'LineDescription', 'cd.tva_tx' => 'LineVATRate', 'cd.qty' => 'LineQty', 'cd.remise_percent' => 'Reduc. Percent', - 'cd.remise' => 'Reduc.', 'cd.price' => 'Price', 'cd.subprice' => 'Sub Price', 'cd.total_ht' => 'LineTotalHT', diff --git a/htdocs/core/modules/modFacture.class.php b/htdocs/core/modules/modFacture.class.php index 72838e92079..b64ecca6cc1 100644 --- a/htdocs/core/modules/modFacture.class.php +++ b/htdocs/core/modules/modFacture.class.php @@ -276,7 +276,7 @@ class modFacture extends DolibarrModules 'f.total_ht'=>"Numeric", 'f.total_ttc'=>"Numeric", 'f.total_tva'=>"Numeric", 'f.localtax1'=>'Numeric', 'f.localtax2'=>'Numeric', 'f.paye'=>"Boolean", 'f.fk_statut'=>'Numeric', 'f.close_code'=>'Text', 'f.close_note'=>'Text', 'none.rest'=>"NumericCompute", 'f.note_private'=>"Text", 'f.note_public'=>"Text", 'f.fk_user_author'=>'Numeric', 'uc.login'=>'Text', 'f.fk_user_valid'=>'Numeric', 'uv.login'=>'Text', - 'pj.ref'=>'Text', 'pj.title'=>'Text', 'fd.rowid'=>'Numeric', 'fd.label'=>'Text', 'fd.description'=>"Text", 'fd.subprice'=>"Numeric", 'fd.tva_tx'=>"Numeric", + 'pj.ref'=>'Text', 'pj.title'=>'Text', 'fd.rowid'=>'Numeric', 'fd.description'=>"Text", 'fd.subprice'=>"Numeric", 'fd.tva_tx'=>"Numeric", 'fd.qty'=>"Numeric", 'fd.total_ht'=>"Numeric", 'fd.total_tva'=>"Numeric", 'fd.total_ttc'=>"Numeric", 'fd.date_start'=>"Date", 'fd.date_end'=>"Date", 'fd.special_code'=>'Numeric', 'fd.product_type'=>"Numeric", 'fd.fk_product'=>'List:product:label', 'p.ref'=>'Text', 'p.label'=>'Text', $alias_product_perentity . '.accountancy_code_sell'=>'Text', @@ -289,7 +289,7 @@ class modFacture extends DolibarrModules $this->export_entities_array[$r] = array( 's.rowid'=>"company", 's.nom'=>'company', 'ps.nom'=>'company', 's.code_client'=>'company', 's.address'=>'company', 's.zip'=>'company', 's.town'=>'company', 'c.code'=>'company', 'cd.nom'=>'company', 's.phone'=>'company', 's.siren'=>'company', 's.siret'=>'company', 's.ape'=>'company', 's.idprof4'=>'company', 's.code_compta'=>'company', 's.code_compta_fournisseur'=>'company', - 's.tva_intra'=>'company', 'pj.ref'=>'project', 'pj.title'=>'project', 'fd.rowid'=>'invoice_line', 'fd.label'=>"invoice_line", 'fd.description'=>"invoice_line", + 's.tva_intra'=>'company', 'pj.ref'=>'project', 'pj.title'=>'project', 'fd.rowid'=>'invoice_line', 'fd.description'=>"invoice_line", 'fd.subprice'=>"invoice_line", 'fd.total_ht'=>"invoice_line", 'fd.total_tva'=>"invoice_line", 'fd.total_ttc'=>"invoice_line", 'fd.tva_tx'=>"invoice_line", 'fd.qty'=>"invoice_line", 'fd.date_start'=>"invoice_line", 'fd.date_end'=>"invoice_line", 'fd.special_code'=>'invoice_line', 'fd.product_type'=>'invoice_line', 'fd.fk_product'=>'product', 'p.ref'=>'product', 'p.label'=>'product', $alias_product_perentity . '.accountancy_code_sell'=>'product', diff --git a/htdocs/core/modules/modFournisseur.class.php b/htdocs/core/modules/modFournisseur.class.php index befeb143ec9..e8ec02f0333 100644 --- a/htdocs/core/modules/modFournisseur.class.php +++ b/htdocs/core/modules/modFournisseur.class.php @@ -626,9 +626,8 @@ class modFournisseur extends DolibarrModules $this->import_tables_array[$r] = array('fd' => MAIN_DB_PREFIX.'facture_fourn_det', 'extra' => MAIN_DB_PREFIX.'facture_fourn_det_extrafields'); $this->import_fields_array[$r] = array( 'fd.fk_facture_fourn' => 'InvoiceRef*', - 'fd.fk_parent_line' => 'FacParentLine', + 'fd.fk_parent_line' => 'ParentLine', 'fd.fk_product' => 'IdProduct', - 'fd.label' => 'Label', 'fd.description' => 'LineDescription', 'fd.pu_ht' => 'PriceUHT', 'fd.pu_ttc' => 'PriceUTTC', @@ -670,7 +669,6 @@ class modFournisseur extends DolibarrModules 'fd.fk_facture_fourn' => '(PROV001)', 'fd.fk_parent_line' => '', 'fd.fk_product' => '', - 'fd.label' => '', 'fd.description' => 'Test Product', 'fd.pu_ht' => '50000', 'fd.pu_ttc' => '50000', @@ -720,7 +718,6 @@ class modFournisseur extends DolibarrModules 'c.source' => 'Source', 'c.fk_statut' => 'Status*', 'c.billed' => 'Billed(0/1)', - 'c.remise_percent' => 'GlobalDiscount', 'c.total_tva' => 'TotalTVA', 'c.total_ht' => 'TotalHT', 'c.total_ttc' => 'TotalTTC', @@ -788,14 +785,12 @@ class modFournisseur extends DolibarrModules $this->import_tables_array[$r] = array('cd' => MAIN_DB_PREFIX.'commande_fournisseurdet', 'extra' => MAIN_DB_PREFIX.'commande_fournisseurdet_extrafields'); $this->import_fields_array[$r] = array( 'cd.fk_commande' => 'PurchaseOrder*', - 'cd.fk_parent_line' => 'PrParentLine', + 'cd.fk_parent_line' => 'ParentLine', 'cd.fk_product' => 'IdProduct', - 'cd.label' => 'Label', 'cd.description' => 'LineDescription', 'cd.tva_tx' => 'LineVATRate', 'cd.qty' => 'LineQty', 'cd.remise_percent' => 'Reduc. Percent', - 'cd.remise' => 'Reduc.', 'cd.subprice' => 'Sub Price', 'cd.total_ht' => 'LineTotalHT', 'cd.total_tva' => 'LineTotalVAT', diff --git a/htdocs/core/modules/modPropale.class.php b/htdocs/core/modules/modPropale.class.php index 4f0633cd578..de6b026d899 100644 --- a/htdocs/core/modules/modPropale.class.php +++ b/htdocs/core/modules/modPropale.class.php @@ -190,10 +190,10 @@ class modPropale extends DolibarrModules $this->export_fields_array[$r] = array( 's.rowid'=>"IdCompany", 's.nom'=>'CompanyName', 'ps.nom'=>'ParentCompany', 's.address'=>'Address', 's.zip'=>'Zip', 's.town'=>'Town', 'co.code'=>'CountryCode', 's.phone'=>'Phone', 's.siren'=>'ProfId1', 's.siret'=>'ProfId2', 's.ape'=>'ProfId3', 's.idprof4'=>'ProfId4', 'c.rowid'=>"Id", 'c.ref'=>"Ref", 'c.ref_client'=>"RefCustomer", - 'c.fk_soc'=>"IdCompany", 'c.datec'=>"DateCreation", 'c.datep'=>"DatePropal", 'c.fin_validite'=>"DateEndPropal", 'c.remise_percent'=>"GlobalDiscount", + 'c.fk_soc'=>"IdCompany", 'c.datec'=>"DateCreation", 'c.datep'=>"DatePropal", 'c.fin_validite'=>"DateEndPropal", 'c.total_ht'=>"TotalHT", 'c.total_ttc'=>"TotalTTC", 'c.fk_statut'=>'Status', 'c.note_public'=>"Note", 'c.date_livraison'=>'DeliveryDate', 'c.fk_user_author'=>'CreatedById', 'uc.login'=>'CreatedByLogin', 'c.fk_user_valid'=>'ValidatedById', 'uv.login'=>'ValidatedByLogin', - 'pj.ref'=>'ProjectRef', 'cd.rowid'=>'LineId', 'cd.label'=>"Label", 'cd.description'=>"LineDescription", 'cd.product_type'=>'TypeOfLineServiceOrProduct', + 'pj.ref'=>'ProjectRef', 'cd.rowid'=>'LineId', 'cd.description'=>"LineDescription", 'cd.product_type'=>'TypeOfLineServiceOrProduct', 'cd.tva_tx'=>"LineVATRate", 'cd.qty'=>"LineQty", 'cd.total_ht'=>"LineTotalHT", 'cd.total_tva'=>"LineTotalVAT", 'cd.total_ttc'=>"LineTotalTTC", 'p.rowid'=>'ProductId', 'p.ref'=>'ProductRef', 'p.label'=>'ProductLabel' ); @@ -214,14 +214,14 @@ class modPropale extends DolibarrModules //$this->export_TypeFields_array[$r]=array( // 's.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','co.code'=>'Text','s.phone'=>'Text', // 's.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','c.ref'=>"Text",'c.ref_client'=>"Text",'c.datec'=>"Date",'c.datep'=>"Date", - // 'c.fin_validite'=>"Date",'c.remise_percent'=>"Numeric",'c.total_ht'=>"Numeric",'c.total_ttc'=>"Numeric",'c.fk_statut'=>'Status','c.note_public'=>"Text", + // 'c.fin_validite'=>"Date",'c.total_ht'=>"Numeric",'c.total_ttc'=>"Numeric",'c.fk_statut'=>'Status','c.note_public'=>"Text", // 'c.date_livraison'=>'Date','cd.description'=>"Text",'cd.product_type'=>'Boolean','cd.tva_tx'=>"Numeric",'cd.qty'=>"Numeric",'cd.total_ht'=>"Numeric", // 'cd.total_tva'=>"Numeric",'cd.total_ttc'=>"Numeric",'p.rowid'=>'List:product:label','p.ref'=>'Text','p.label'=>'Text' //); $this->export_TypeFields_array[$r] = array( 's.nom'=>'Text', 'ps.nom'=>'Text', 's.address'=>'Text', 's.zip'=>'Text', 's.town'=>'Text', 'co.code'=>'Text', 's.phone'=>'Text', 's.siren'=>'Text', 's.siret'=>'Text', 's.ape'=>'Text', 's.idprof4'=>'Text', 'c.ref'=>"Text", 'c.ref_client'=>"Text", 'c.datec'=>"Date", 'c.datep'=>"Date", 'c.fin_validite'=>"Date", - 'c.remise_percent'=>"Numeric", 'c.total_ht'=>"Numeric", 'c.total_ttc'=>"Numeric", 'c.fk_statut'=>'Status', 'c.note_public'=>"Text", 'c.date_livraison'=>'Date', + 'c.total_ht'=>"Numeric", 'c.total_ttc'=>"Numeric", 'c.fk_statut'=>'Status', 'c.note_public'=>"Text", 'c.date_livraison'=>'Date', 'pj.ref'=>'Text', 'cd.description'=>"Text", 'cd.product_type'=>'Boolean', 'cd.tva_tx'=>"Numeric", 'cd.qty'=>"Numeric", 'cd.total_ht'=>"Numeric", 'cd.total_tva'=>"Numeric", 'cd.total_ttc'=>"Numeric", 'p.ref'=>'Text', 'p.label'=>'Text', 'c.entity'=>'List:entity:label:rowid', @@ -229,9 +229,9 @@ class modPropale extends DolibarrModules $this->export_entities_array[$r] = array( 's.rowid'=>"company", 's.nom'=>'company', 'ps.nom'=>'company', 's.address'=>'company', 's.zip'=>'company', 's.town'=>'company', 'co.code'=>'company', 's.phone'=>'company', 's.siren'=>'company', 's.ape'=>'company', 's.idprof4'=>'company', 's.siret'=>'company', 'c.rowid'=>"propal", 'c.ref'=>"propal", 'c.ref_client'=>"propal", - 'c.fk_soc'=>"propal", 'c.datec'=>"propal", 'c.datep'=>"propal", 'c.fin_validite'=>"propal", 'c.remise_percent'=>"propal", 'c.total_ht'=>"propal", + 'c.fk_soc'=>"propal", 'c.datec'=>"propal", 'c.datep'=>"propal", 'c.fin_validite'=>"propal", 'c.total_ht'=>"propal", 'c.total_ttc'=>"propal", 'c.fk_statut'=>"propal", 'c.note_public'=>"propal", 'c.date_livraison'=>"propal", 'pj.ref'=>'project', 'cd.rowid'=>'propal_line', - 'cd.label'=>"propal_line", 'cd.description'=>"propal_line", 'cd.product_type'=>'propal_line', 'cd.tva_tx'=>"propal_line", 'cd.qty'=>"propal_line", + 'cd.description'=>"propal_line", 'cd.product_type'=>'propal_line', 'cd.tva_tx'=>"propal_line", 'cd.qty'=>"propal_line", 'cd.total_ht'=>"propal_line", 'cd.total_tva'=>"propal_line", 'cd.total_ttc'=>"propal_line", 'p.rowid'=>'product', 'p.ref'=>'product', 'p.label'=>'product' ); $this->export_dependencies_array[$r] = array('propal_line'=>'cd.rowid', 'product'=>'cd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them @@ -293,7 +293,6 @@ class modPropale extends DolibarrModules 'c.datec' => 'DateCreation', 'c.datep' => 'DatePropal', 'c.fin_validite' => 'DateEndPropal', - 'c.remise_percent' => 'GlobalDiscount', 'c.total_ht' => 'TotalHT', 'c.total_ttc' => 'TotalTTC', 'c.fk_statut' => 'Status*', @@ -330,7 +329,6 @@ class modPropale extends DolibarrModules 'c.datec' => '2020-01-01', 'c.datep' => '2020-01-01', 'c.fin_validite' => '2020-01-01', - 'c.remise_percent' => '', 'c.total_ht' => '0', 'c.total_ttc' => '0', 'c.fk_statut' => '1', @@ -367,15 +365,13 @@ class modPropale extends DolibarrModules ); $this->import_fields_array[$r] = array( 'cd.fk_propal' => 'Proposal*', - 'cd.fk_parent_line' => 'PrParentLine', + 'cd.fk_parent_line' => 'ParentLine', 'cd.fk_product' => 'IdProduct', - 'cd.label' => 'Label', 'cd.description' => 'LineDescription', 'cd.product_type' => 'TypeOfLineServiceOrProduct', 'cd.tva_tx' => 'LineVATRate', 'cd.qty' => 'LineQty', 'cd.remise_percent' => 'Reduc. Percent', - 'cd.remise' => 'Reduc.', 'cd.price' => 'Price', 'cd.subprice' => 'Sub Price', 'cd.total_ht' => 'LineTotalHT', @@ -411,13 +407,11 @@ class modPropale extends DolibarrModules 'cd.fk_propal' => 'PROV(0001)', 'cd.fk_parent_line' => '', 'cd.fk_product' => '', - 'cd.label' => '', 'cd.description' => 'Line description', 'cd.product_type' => '1', 'cd.tva_tx' => '0', 'cd.qty' => '2', 'cd.remise_percent' => '0', - 'cd.remise' => '0', 'cd.price' => '', 'cd.subprice' => '5000', 'cd.total_ht' => '10000', diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index 68c08c9f234..eada0da8899 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -601,7 +601,6 @@ BILL_SUPPLIER_DELETEInDolibarr=Supplier invoice deleted UnitPriceXQtyLessDiscount=Unit price x Qty - Discount CustomersInvoicesArea=Customer billing area SupplierInvoicesArea=Supplier billing area -FacParentLine=Invoice Line Parent SituationTotalRayToRest=Remainder to pay without taxe PDFSituationTitle=Situation n° %d SituationTotalProgress=Total progress %d %% diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 62d167ea233..7e57db2091b 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -244,6 +244,7 @@ Designation=Description DescriptionOfLine=Description of line DateOfLine=Date of line DurationOfLine=Duration of line +ParentLine=Parent line ID Model=Doc template DefaultModel=Default doc template Action=Event diff --git a/htdocs/langs/en_US/propal.lang b/htdocs/langs/en_US/propal.lang index ed25b5501dc..aa5ef73f7dc 100644 --- a/htdocs/langs/en_US/propal.lang +++ b/htdocs/langs/en_US/propal.lang @@ -101,7 +101,6 @@ ConfirmMassValidationQuestion=Are you sure you want to validate the selected rec ConfirmMassSignatureQuestion=Are you sure you want to sign the selected records ? IdProposal=Proposal ID IdProduct=Product ID -PrParentLine=Proposal Parent Line LineBuyPriceHT=Buy Price Amount net of tax for line SignPropal=Accept proposal RefusePropal=Refuse proposal diff --git a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php index 898dd2692e4..b1caea730f9 100644 --- a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php +++ b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php @@ -399,7 +399,13 @@ class modMyModule extends DolibarrModules $this->import_examplevalues_array[$r] = array_merge($import_sample, $import_extrafield_sample); $this->import_updatekeys_array[$r] = array('t.ref' => 'Ref'); $this->import_convertvalue_array[$r] = array( - 't.ref' => array('rule'=>'getrefifauto', 'class'=>(empty($conf->global->MYMODULE_MYOBJECT_ADDON) ? 'mod_myobject_standard' : $conf->global->MYMODULE_MYOBJECT_ADDON), 'path'=>"/core/modules/commande/".(empty($conf->global->MYMODULE_MYOBJECT_ADDON) ? 'mod_myobject_standard' : $conf->global->MYMODULE_MYOBJECT_ADDON).'.php'), + 't.ref' => array( + 'rule'=>'getrefifauto', + 'class'=>(empty($conf->global->MYMODULE_MYOBJECT_ADDON) ? 'mod_myobject_standard' : $conf->global->MYMODULE_MYOBJECT_ADDON), + 'path'=>"/core/modules/commande/".(empty($conf->global->MYMODULE_MYOBJECT_ADDON) ? 'mod_myobject_standard' : $conf->global->MYMODULE_MYOBJECT_ADDON).'.php' + 'classobject'=>'MyObject', + 'pathobject'=>'/mymodule/class/myobject.class.php', + ), 't.fk_soc' => array('rule' => 'fetchidfromref', 'file' => '/societe/class/societe.class.php', 'class' => 'Societe', 'method' => 'fetch', 'element' => 'ThirdParty'), 't.fk_user_valid' => array('rule' => 'fetchidfromref', 'file' => '/user/class/user.class.php', 'class' => 'User', 'method' => 'fetch', 'element' => 'user'), 't.fk_mode_reglement' => array('rule' => 'fetchidfromcodeorlabel', 'file' => '/compta/paiement/class/cpaiement.class.php', 'class' => 'Cpaiement', 'method' => 'fetch', 'element' => 'cpayment'), From ea61e517308a8f54ab974c0643a2b58023ecb55d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 4 Apr 2022 13:59:50 +0200 Subject: [PATCH 531/610] Fix phpunit --- htdocs/core/extrafieldsinexport.inc.php | 2 +- htdocs/core/extrafieldsinimport.inc.php | 2 +- test/phpunit/CodingPhpTest.php | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/extrafieldsinexport.inc.php b/htdocs/core/extrafieldsinexport.inc.php index 4962e353741..b31b02c3460 100644 --- a/htdocs/core/extrafieldsinexport.inc.php +++ b/htdocs/core/extrafieldsinexport.inc.php @@ -12,7 +12,7 @@ if (empty($keyforselect) || empty($keyforelement) || empty($keyforaliasextra)) { // Add extra fields $sql = "SELECT name, label, type, param, fieldcomputed, fielddefault FROM ".MAIN_DB_PREFIX."extrafields"; -$sql .= " WHERE elementtype = '".$this->db->escape($keyforselect)."' AND type <> 'separate' AND entity IN (0, ".$conf->entity.') ORDER BY pos ASC'; +$sql .= " WHERE elementtype = '".$this->db->escape($keyforselect)."' AND type <> 'separate' AND entity IN (0, ".((int) $conf->entity).') ORDER BY pos ASC'; //print $sql; $resql = $this->db->query($sql); if ($resql) { // This can fail when class is used on old database (during migration for example) diff --git a/htdocs/core/extrafieldsinimport.inc.php b/htdocs/core/extrafieldsinimport.inc.php index bbfcd7b9fdb..4845d9a6d44 100644 --- a/htdocs/core/extrafieldsinimport.inc.php +++ b/htdocs/core/extrafieldsinimport.inc.php @@ -12,7 +12,7 @@ if (empty($keyforselect) || empty($keyforelement) || empty($keyforaliasextra)) { // Add extra fields $sql = "SELECT name, label, type, param, fieldcomputed, fielddefault FROM ".MAIN_DB_PREFIX."extrafields"; -$sql .= " WHERE elementtype = '".$this->db->escape($keyforselect)."' AND type <> 'separate' AND entity IN (0, ".$conf->entity.') ORDER BY pos ASC'; +$sql .= " WHERE elementtype = '".$this->db->escape($keyforselect)."' AND type <> 'separate' AND entity IN (0, ".((int) $conf->entity).') ORDER BY pos ASC'; //print $sql; $resql = $this->db->query($sql); if ($resql) { // This can fail when class is used on old database (during migration for example) diff --git a/test/phpunit/CodingPhpTest.php b/test/phpunit/CodingPhpTest.php index 4ddab0b97c3..5637f0194ac 100644 --- a/test/phpunit/CodingPhpTest.php +++ b/test/phpunit/CodingPhpTest.php @@ -227,6 +227,7 @@ class CodingPhpTest extends PHPUnit\Framework\TestCase if (! in_array($file['name'], array( 'objectline_view.tpl.php', 'extrafieldsinexport.inc.php', + 'extrafieldsinimport.inc.php', 'DolQueryCollector.php' ))) { // Must not found $this->db-> From 2455d8fe5202fd040f9a522d6056dc3fab95a0f7 Mon Sep 17 00:00:00 2001 From: atm-greg Date: Mon, 4 Apr 2022 14:31:48 +0200 Subject: [PATCH 532/610] avoid fetch_objectlinked for each page of the document --- htdocs/core/class/commonobject.class.php | 8 ++++++++ htdocs/core/lib/pdf.lib.php | 4 +++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 232aa6b5789..f7eb6a67263 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -123,6 +123,11 @@ abstract class CommonObject */ public $linkedObjects; + /** + * @var boolean is linkedObjects full loaded. Loaded by ->fetchObjectLinked + */ + public $linkedObjectsFullLoaded = false; + /** * @var Object To store a cloned copy of object before to edit it and keep track of old properties */ @@ -3834,6 +3839,9 @@ abstract class CommonObject } else { $sql .= "(fk_source = ".((int) $sourceid)." AND sourcetype = '".$this->db->escape($sourcetype)."')"; $sql .= " ".$clause." (fk_target = ".((int) $targetid)." AND targettype = '".$this->db->escape($targettype)."')"; + if ($sourceid == $this->id && $sourcetype == $this->element && $targetid == $this->id && $targettype == $this->element && $clause == 'OR') { + $this->linkedObjectsFullLoaded = true; + } } $sql .= " ORDER BY ".$orderby; diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index ea8c6c2ce23..b273f93b69f 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -2282,7 +2282,9 @@ function pdf_getLinkedObjects(&$object, $outputlangs) $linkedobjects = array(); - $object->fetchObjectLinked(); + if (empty($object->linkedObjectsFullLoaded)) { + $object->fetchObjectLinked(); + } foreach ($object->linkedObjects as $objecttype => $objects) { if ($objecttype == 'facture') { From 01d100fc0cbaa6fca255dbd3324d98b50fb7ad8f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 4 Apr 2022 15:11:29 +0200 Subject: [PATCH 533/610] Missing autofocus on title field --- htdocs/compta/facture/card-rec.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/card-rec.php b/htdocs/compta/facture/card-rec.php index 6116db707e2..6d7f7f6010e 100644 --- a/htdocs/compta/facture/card-rec.php +++ b/htdocs/compta/facture/card-rec.php @@ -967,7 +967,7 @@ if ($action == 'create') { // Title print ''.$langs->trans("Title").''; - print ''; + print ''; print ''; // Third party From 71012a7933bfd44570377563546c4135fa6451e8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 7 Mar 2022 13:21:32 +0100 Subject: [PATCH 534/610] FIX #19777 #20281 --- htdocs/compta/paiement/cheque/card.php | 50 ++++++++++++------- .../cheque/class/remisecheque.class.php | 1 + htdocs/core/class/html.formfile.class.php | 6 +-- .../modules/cheque/modules_chequereceipts.php | 3 +- htdocs/ecm/class/ecmfiles.class.php | 6 ++- 5 files changed, 41 insertions(+), 25 deletions(-) diff --git a/htdocs/compta/paiement/cheque/card.php b/htdocs/compta/paiement/cheque/card.php index 32f81532ecf..2fcd4d780ff 100644 --- a/htdocs/compta/paiement/cheque/card.php +++ b/htdocs/compta/paiement/cheque/card.php @@ -41,12 +41,7 @@ $ref = GETPOST('ref', 'alpha'); $action = GETPOST('action', 'aZ09'); $confirm = GETPOST('confirm', 'alpha'); -// Security check -$fieldname = (!empty($ref) ? 'ref' : 'rowid'); -if ($user->socid) { - $socid = $user->socid; -} -$result = restrictedArea($user, 'cheque', $id, 'bordereau_cheque', '', 'fk_user_author', $fieldname); +$object = new RemiseCheque($db); $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); @@ -63,11 +58,22 @@ if (empty($page) || $page == -1) { $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $offset = $limit * $page; -$dir = $conf->bank->dir_output.'/checkdeposits/'; +$upload_dir = $conf->bank->multidir_output[$object->entity ? $object->entity : $conf->entity]."/checkdeposits"; + $filterdate = dol_mktime(0, 0, 0, GETPOST('fdmonth'), GETPOST('fdday'), GETPOST('fdyear')); $filteraccountid = GETPOST('accountid', 'int'); -$object = new RemiseCheque($db); +// Security check +$fieldname = (!empty($ref) ? 'ref' : 'rowid'); +if ($user->socid) { + $socid = $user->socid; +} +$result = restrictedArea($user, 'cheque', $id, 'bordereau_cheque', '', 'fk_user_author', $fieldname); + +$usercanread = $user->rights->banque->cheque; +$usercancreate = $user->rights->banque->cheque; +$usercandelete = $user->rights->banque->cheque; + /* @@ -242,7 +248,9 @@ if ($action == 'builddoc' && $user->rights->banque->cheque) { $langs->load("other"); - $file = $dir.get_exdir($object->ref, 0, 1, 0, $object, 'cheque').GETPOST('file'); + $filetodelete = GETPOST('file', 'alpha'); + $file = $upload_dir.'/'.$filetodelete; + $ret = dol_delete_file($file, 0, 0, 0, $object); if ($ret) { setEventMessages($langs->trans("FileWasRemoved", GETPOST('file')), null, 'mesgs'); @@ -633,6 +641,12 @@ if ($action == 'new') { $i = 1; if ($num > 0) { while ($objp = $db->fetch_object($resql)) { + $paymentstatic->id = $objp->pid; + $paymentstatic->ref = $objp->pref; + + $accountlinestatic->id = $objp->rowid; + $accountlinestatic->ref = $objp->ref; + print ''; print ''.$i.''; print ''.dol_print_date($db->jdate($objp->date), 'day').''; // Operation date @@ -642,8 +656,6 @@ if ($action == 'new') { print ''.price($objp->amount).''; // Link to payment print ''; - $paymentstatic->id = $objp->pid; - $paymentstatic->ref = $objp->pref; if ($paymentstatic->id) { print $paymentstatic->getNomUrl(1); } else { @@ -652,8 +664,6 @@ if ($action == 'new') { print ''; // Link to bank transaction print ''; - $accountlinestatic->id = $objp->rowid; - $accountlinestatic->ref = $objp->ref; if ($accountlinestatic->id > 0) { print $accountlinestatic->getNomUrl(1); } else { @@ -663,10 +673,10 @@ if ($action == 'new') { // Action button print ''; if ($object->statut == 0) { - print 'rowid.'">'.img_delete().''; + print 'rowid.'">'.img_delete().''; } if ($object->statut == 1 && $objp->statut != 2) { - print 'rowid.'">'.img_picto($langs->trans("RejectCheck"), 'disable').''; + print 'rowid.'">'.img_picto($langs->trans("RejectCheck"), 'disable').''; } if ($objp->statut == 2) { print '   '.img_picto($langs->trans('CheckRejected'), 'statut8').''; @@ -722,11 +732,13 @@ print '
'; if ($action != 'new') { if ($object->statut == 1) { - $filename = dol_sanitizeFileName($object->ref); - $filedir = $dir.get_exdir($object->ref, 0, 1, 0, $object, 'checkdeposits'); + // Documents + $objref = dol_sanitizeFileName($object->ref); + $filedir = $upload_dir.'/'.$objref; $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id; - - print $formfile->showdocuments('remisecheque', $filename, $filedir, $urlsource, 1, 1); + $genallowed = $usercancreate; + $delallowed = $usercandelete; + print $formfile->showdocuments('remisecheque', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $langs->defaultlang); print '
'; } diff --git a/htdocs/compta/paiement/cheque/class/remisecheque.class.php b/htdocs/compta/paiement/cheque/class/remisecheque.class.php index 683b2fd0423..559697bf495 100644 --- a/htdocs/compta/paiement/cheque/class/remisecheque.class.php +++ b/htdocs/compta/paiement/cheque/class/remisecheque.class.php @@ -615,6 +615,7 @@ class RemiseCheque extends CommonObject // We save charset_output to restore it because write_file can change it if needed for // output format that does not support UTF8. $sav_charseSupprimert_output = $outputlangs->charset_output; + $result = $docmodel->write_file($this, $conf->bank->dir_output.'/checkdeposits', $this->ref, $outputlangs); if ($result > 0) { //$outputlangs->charset_output=$sav_charset_output; diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index fcca60dad78..349b05416aa 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -359,9 +359,9 @@ class FormFile * Return a string to show the box with list of available documents for object. * This also set the property $this->numoffiles * - * @param string $modulepart Module the files are related to ('propal', 'facture', 'facture_fourn', 'mymodule', 'mymodule:myobject', 'mymodule_temp', ...) - * @param string $modulesubdir Existing (so sanitized) sub-directory to scan (Example: '0/1/10', 'FA/DD/MM/YY/9999'). Use '' if file is not into subdir of module. - * @param string $filedir Directory to scan + * @param string $modulepart Module the files are related to ('propal', 'facture', 'facture_fourn', 'mymodule', 'mymodule:MyObject', 'mymodule_temp', ...) + * @param string $modulesubdir Existing (so sanitized) sub-directory to scan (Example: '0/1/10', 'FA/DD/MM/YY/9999'). Use '' if file is not into a subdir of module. + * @param string $filedir Directory to scan (must not end with a /). Example: '/mydolibarrdocuments/facture/FAYYMM-1234' * @param string $urlsource Url of origin page (for return) * @param int|string[] $genallowed Generation is allowed (1/0 or array list of templates) * @param int $delallowed Remove is allowed (1/0) diff --git a/htdocs/core/modules/cheque/modules_chequereceipts.php b/htdocs/core/modules/cheque/modules_chequereceipts.php index dfdf0fbe363..e50a6877848 100644 --- a/htdocs/core/modules/cheque/modules_chequereceipts.php +++ b/htdocs/core/modules/cheque/modules_chequereceipts.php @@ -126,8 +126,7 @@ abstract class ModeleNumRefChequeReceipts } /** - * \class ModeleChequeReceipts - * \brief Classe mere des modeles de + * Class parent for templates of document generation */ abstract class ModeleChequeReceipts extends CommonDocGenerator { diff --git a/htdocs/ecm/class/ecmfiles.class.php b/htdocs/ecm/class/ecmfiles.class.php index 035a7aee9c6..a451a462ea3 100644 --- a/htdocs/ecm/class/ecmfiles.class.php +++ b/htdocs/ecm/class/ecmfiles.class.php @@ -327,7 +327,11 @@ class EcmFiles extends CommonObject $resql = $this->db->query($sql); if (!$resql) { $error++; - $this->errors[] = 'Error '.$this->db->lasterror(); + if ($this->db->lasterrno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { + $this->errors[] = 'Error DB_ERROR_RECORD_ALREADY_EXISTS : '.$this->db->lasterror(); + } else { + $this->errors[] = 'Error '.$this->db->lasterror(); + } dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR); } From 04140d8dc05b4186d302f16a86e91a2ba045bcf9 Mon Sep 17 00:00:00 2001 From: jpb Date: Mon, 4 Apr 2022 15:45:16 +0200 Subject: [PATCH 535/610] add class name on tds expensereport rule card --- htdocs/admin/expensereport_rules.php | 68 ++++++++++++++-------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/htdocs/admin/expensereport_rules.php b/htdocs/admin/expensereport_rules.php index 6799ab339bd..f15b996939d 100644 --- a/htdocs/admin/expensereport_rules.php +++ b/htdocs/admin/expensereport_rules.php @@ -185,31 +185,31 @@ if ($action != 'edit') { echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; echo ''; echo ''; echo ''; echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; echo ''; echo '
' . $langs->trans('ExpenseReportApplyTo') . '' . $langs->trans('Type') . '' . $langs->trans('ExpenseReportLimitOn') . '' . $langs->trans('ExpenseReportDateStart') . '' . $langs->trans('ExpenseReportDateEnd') . '' . $langs->trans('ExpenseReportLimitAmount') . '' . $langs->trans('ExpenseReportRestrictive') . '
' . $langs->trans('ExpenseReportApplyTo') . '' . $langs->trans('Type') . '' . $langs->trans('ExpenseReportLimitOn') . '' . $langs->trans('ExpenseReportDateStart') . '' . $langs->trans('ExpenseReportDateEnd') . '' . $langs->trans('ExpenseReportLimitAmount') . '' . $langs->trans('ExpenseReportRestrictive') . ' 
'; - echo '
' . $form->selectarray('apply_to', $tab_apply, '', 0) . '
'; - echo '
' . $form->select_dolusers('', 'fk_user') . '
'; - echo '
' . $form->select_dolgroups('', 'fk_usergroup') . '
'; + echo '
' . $form->selectarray('apply_to', $tab_apply, '', 0) . '
'; + echo '
' . $form->select_dolusers('', 'fk_user') . '
'; + echo '
' . $form->select_dolgroups('', 'fk_usergroup') . '
'; echo '
' . $form->selectExpense('', 'fk_c_type_fees', 0, 1, 1) . '' . $form->selectarray('code_expense_rules_type', $tab_rules_type, '', 0) . '' . $form->selectDate(strtotime(date('Y-m-01', dol_now())), 'start', '', '', 0, '', 1, 0) . '' . $form->selectDate(strtotime(date('Y-m-t', dol_now())), 'end', '', '', 0, '', 1, 0) . ' ' . $conf->currency . '' . $form->selectyesno('restrictive', 0, 1) . '' . $form->selectExpense('', 'fk_c_type_fees', 0, 1, 1) . '' . $form->selectarray('code_expense_rules_type', $tab_rules_type, '', 0) . '' . $form->selectDate(strtotime(date('Y-m-01', dol_now())), 'start', '', '', 0, '', 1, 0) . ' ' . $conf->currency . '' . $form->selectyesno('restrictive', 0, 1) . '
'; @@ -227,21 +227,21 @@ if ($action == 'edit') { echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; echo ''; echo ''; foreach ($rules as $rule) { - echo ''; + echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ' - + '; foreach ($rules as $rule) { - echo ''; + echo ''; echo ''; print ''; print ''; } From 3ab993127d516fce71df43815cf6f65b43d5e843 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 5 Apr 2022 02:17:01 +0200 Subject: [PATCH 540/610] NEW Accept 'auto' for ref of object on import of purchase order/proposal --- htdocs/core/modules/modFournisseur.class.php | 15 ++++++++++++++- htdocs/core/modules/modPropale.class.php | 17 ++++++++++++----- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/htdocs/core/modules/modFournisseur.class.php b/htdocs/core/modules/modFournisseur.class.php index e8ec02f0333..708cd1fb408 100644 --- a/htdocs/core/modules/modFournisseur.class.php +++ b/htdocs/core/modules/modFournisseur.class.php @@ -612,7 +612,13 @@ class modFournisseur extends DolibarrModules $this->import_examplevalues_array[$r] = array_merge($import_sample, $import_extrafield_sample); $this->import_updatekeys_array[$r] = array('f.ref' => 'Ref'); $this->import_convertvalue_array[$r] = array( - //'c.ref'=>array('rule'=>'getrefifauto'), + 'f.ref' => array( + 'rule'=>'getrefifauto', + 'class'=>(empty($conf->global->INVOICE_SUPPLIER_ADDON_NUMBER) ? 'mod_facture_fournisseur_cactus' : $conf->global->INVOICE_SUPPLIER_ADDON_NUMBER), + 'path'=>"/core/modules/supplier_invoice/".(empty($conf->global->INVOICE_SUPPLIER_ADDON_NUMBER) ? 'mod_facture_fournisseur_cactus' : $conf->global->INVOICE_SUPPLIER_ADDON_NUMBER).'.php', + 'classobject'=>'FactureFournisseur', + 'pathobject'=>'/fourn/class/fournisseur.facture.class.php', + ), 'f.fk_soc' => array('rule' => 'fetchidfromref', 'file' => '/societe/class/societe.class.php', 'class' => 'Societe', 'method' => 'fetch', 'element' => 'ThirdParty'), 'f.fk_account' => array('rule' => 'fetchidfromref', 'file' => '/compta/bank/class/account.class.php', 'class' => 'Account', 'method' => 'fetch', 'element' => 'bank_account'), ); @@ -759,6 +765,13 @@ class modFournisseur extends DolibarrModules $this->import_updatekeys_array[$r] = array('c.ref' => 'Ref'); $this->import_convertvalue_array[$r] = array( + 'c.ref' => array( + 'rule'=>'getrefifauto', + 'class'=>(empty($conf->global->COMMANDE_SUPPLIER_ADDON_NUMBER) ? 'mod_commande_fournisseur_muguet' : $conf->global->COMMANDE_SUPPLIER_ADDON_NUMBER), + 'path'=>"/core/modules/supplier_order/".(empty($conf->global->COMMANDE_SUPPLIER_ADDON_NUMBER) ? 'mod_commande_fournisseur_muguet' : $conf->global->COMMANDE_SUPPLIER_ADDON_NUMBER).'.php', + 'classobject'=>'CommandeFournisseur', + 'pathobject'=>'/fourn/class/fournisseur.commande.class.php', + ), 'c.fk_soc' => array( 'rule' => 'fetchidfromref', 'file' => '/societe/class/societe.class.php', diff --git a/htdocs/core/modules/modPropale.class.php b/htdocs/core/modules/modPropale.class.php index de6b026d899..3419d4c866e 100644 --- a/htdocs/core/modules/modPropale.class.php +++ b/htdocs/core/modules/modPropale.class.php @@ -342,16 +342,23 @@ class modPropale extends DolibarrModules 'c.multicurrency_total_ttc' => '0' ]; $this->import_examplevalues_array[$r] = array_merge($import_sample, $import_extrafield_sample); - $this->import_updatekeys_array[$r] = ['c.ref'=>'Ref']; - $this->import_convertvalue_array[$r] = [ - 'c.fk_soc' => [ + $this->import_updatekeys_array[$r] = array('c.ref'=>'Ref'); + $this->import_convertvalue_array[$r] = array( + 'c.ref' => array( + 'rule'=>'getrefifauto', + 'class'=>(empty($conf->global->PROPALE_ADDON) ? 'mod_propale_marbre' : $conf->global->PROPALE_ADDON), + 'path'=>"/core/modules/propale/".(empty($conf->global->PROPALE_ADDON) ? 'mod_propale_marbre' : $conf->global->PROPALE_ADDON).'.php', + 'classobject'=>'Propal', + 'pathobject'=>'/comm/propal/class/propal.class.php', + ), + 'c.fk_soc' => array( 'rule' => 'fetchidfromref', 'file' => '/societe/class/societe.class.php', 'class' => 'Societe', 'method' => 'fetch', 'element' => 'ThirdParty' - ] - ]; + ) + ); //Import Proposal Lines $r++; From b929c2f671908619ec69a4900eb6a196e023fc3e Mon Sep 17 00:00:00 2001 From: atm-florian Date: Tue, 5 Apr 2022 11:46:06 +0200 Subject: [PATCH 541/610] FIX 16.0 - supplier invoice card creates two invoices instead of one when creating from a template --- htdocs/fourn/facture/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index f4d628d5882..95bd9cbd136 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -929,7 +929,7 @@ if (empty($reshook)) { } // Standard invoice or Deposit invoice, not from a Predefined template invoice - if (GETPOST('type') == FactureFournisseur::TYPE_STANDARD || GETPOST('type') == FactureFournisseur::TYPE_DEPOSIT && GETPOST('fac_rec') <= 0) { + elseif (GETPOST('type') == FactureFournisseur::TYPE_STANDARD || GETPOST('type') == FactureFournisseur::TYPE_DEPOSIT && GETPOST('fac_rec') <= 0) { if (GETPOST('socid', 'int') < 1) { setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentities('Supplier')), null, 'errors'); $action = 'create'; From b199234afe1d9c7371a6ce35c789a95b0fee1893 Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Tue, 5 Apr 2022 12:01:09 +0200 Subject: [PATCH 542/610] FIX : each time we create a supplier order, we need to give it a ref_supplier --- htdocs/fourn/commande/list.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index de195504d39..56ebfb5cbf7 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -292,10 +292,8 @@ if (empty($reshook)) { $objecttmp->mode_reglement_id = $cmd->mode_reglement_id; $objecttmp->fk_project = $cmd->fk_project; $objecttmp->multicurrency_code = $cmd->multicurrency_code; - if (empty($createbills_onebythird)) { - $objecttmp->ref_supplier = !empty($cmd->ref_supplier) ? $cmd->ref_supplier : $default_ref_supplier; - $default_ref_supplier+=1; - } + $objecttmp->ref_supplier = !empty($cmd->ref_supplier) ? $cmd->ref_supplier : $default_ref_supplier; + $default_ref_supplier+=1; $datefacture = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); if (empty($datefacture)) { From 392ba6deedb42a31f7388bff636feecb1411058e Mon Sep 17 00:00:00 2001 From: atm-florian Date: Tue, 5 Apr 2022 12:16:06 +0200 Subject: [PATCH 543/610] FIX 16.0 - my previous fix was incomplete (missing parentheses around OR-separated conditions) + replace GETPOST('fac_rec', 'int') with variable + make sure it works even if, one day, the "nothing selected" value for the template supplier invoice selector changes to -1 instead of '' --- htdocs/fourn/facture/card.php | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 95bd9cbd136..02e77d13f58 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -76,7 +76,7 @@ $lineid = GETPOST('lineid', 'int'); $projectid = GETPOST('projectid', 'int'); $origin = GETPOST('origin', 'alpha'); $originid = GETPOST('originid', 'int'); -$fac_rec = GETPOST('fac_rec', 'int'); +$fac_recid = GETPOST('fac_rec', 'int'); // PDF $hidedetails = (GETPOST('hidedetails', 'int') ? GETPOST('hidedetails', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0)); @@ -885,7 +885,7 @@ if (empty($reshook)) { } // Standard invoice or Deposit invoice, created from a Predefined template invoice - if ((GETPOST('type') == FactureFournisseur::TYPE_STANDARD || GETPOST('type') == FactureFournisseur::TYPE_DEPOSIT) && GETPOST('fac_rec', 'int') > 0) { + elseif ($fac_recid > 0 && (GETPOST('type') == FactureFournisseur::TYPE_STANDARD || GETPOST('type') == FactureFournisseur::TYPE_DEPOSIT)) { if (empty($dateinvoice)) { $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors'); @@ -918,7 +918,7 @@ if (empty($reshook)) { $object->multicurrency_tx = GETPOST('originmulticurrency_tx', 'int'); // Source facture - $object->fac_rec = GETPOST('fac_rec', 'int'); + $object->fac_rec = $fac_recid; $fac_rec = new FactureFournisseurRec($db); $fac_rec->fetch($object->fac_rec); $fac_rec->fetch_lines(); @@ -929,7 +929,7 @@ if (empty($reshook)) { } // Standard invoice or Deposit invoice, not from a Predefined template invoice - elseif (GETPOST('type') == FactureFournisseur::TYPE_STANDARD || GETPOST('type') == FactureFournisseur::TYPE_DEPOSIT && GETPOST('fac_rec') <= 0) { + elseif ($fac_recid <= 0 && (GETPOST('type') == FactureFournisseur::TYPE_STANDARD || GETPOST('type') == FactureFournisseur::TYPE_DEPOSIT)) { if (GETPOST('socid', 'int') < 1) { setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentities('Supplier')), null, 'errors'); $action = 'create'; @@ -2024,15 +2024,15 @@ if ($action == 'create') { $exampletemplateinvoice = new FactureFournisseurRec($db); $invoice_predefined = new FactureFournisseurRec($db); - if (empty($origin) && empty($originid) && GETPOST('fac_rec', 'int') > 0) { - $invoice_predefined->fetch(GETPOST('fac_rec', 'int')); + if (empty($origin) && empty($originid) && $fac_recid > 0) { + $invoice_predefined->fetch($fac_recid); } // Third party print ''; print ''; // Overwrite some values if creation of invoice is from a predefined invoice - if (empty($origin) && empty($originid) && GETPOST('fac_rec', 'int') > 0) { - $invoice_predefined->fetch(GETPOST('fac_rec', 'int')); + if (empty($origin) && empty($originid) && $fac_recid > 0) { + $invoice_predefined->fetch($fac_recid); $dateinvoice = $invoice_predefined->date_when; // To use next gen date by default later if (empty($projectid)) { @@ -2088,15 +2088,15 @@ if ($action == 'create') { if ($num > 0) { print ''; } @@ -2432,7 +2432,7 @@ if ($action == 'create') { // Help of substitution key $htmltext = ''; - if (GETPOST('fac_rec', 'int') > 0) { + if ($fac_recid > 0) { $dateexample = $newdateinvoice ? $newdateinvoice : $dateinvoice; if (empty($dateexample)) { $dateexample = dol_now(); From b872fb2eac3ad2392ac0699a402add7aa69481d6 Mon Sep 17 00:00:00 2001 From: atm-florian Date: Tue, 5 Apr 2022 12:28:40 +0200 Subject: [PATCH 544/610] FIX 16.0 - missing quotes in SQL for frequency unit update for template supplier invoices --- htdocs/fourn/class/fournisseur.facture-rec.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/class/fournisseur.facture-rec.class.php b/htdocs/fourn/class/fournisseur.facture-rec.class.php index f77dd5638f7..5d109d7ad2c 100644 --- a/htdocs/fourn/class/fournisseur.facture-rec.class.php +++ b/htdocs/fourn/class/fournisseur.facture-rec.class.php @@ -1769,7 +1769,7 @@ class FactureFournisseurRec extends CommonInvoice $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element; $sql .= ' SET frequency = '.($frequency ? $this->db->escape($frequency) : 'null'); if (!empty($unit)) { - $sql .= ', unit_frequency = '.$this->db->escape($unit); + $sql .= ', unit_frequency = \''.$this->db->escape($unit).'\''; } $sql .= ' WHERE rowid = ' . (int) $this->id; From f0433244aa1a8809ceb0f2ca11d20cdb5fd4bfd2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 5 Apr 2022 13:36:25 +0200 Subject: [PATCH 545/610] Fix sql --- .../facture/class/facture-rec.class.php | 10 +- .../class/fournisseur.facture-rec.class.php | 131 +++++++++--------- 2 files changed, 67 insertions(+), 74 deletions(-) diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 2bfb250df83..290467a9d54 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -2130,7 +2130,7 @@ class FactureLigneRec extends CommonInvoiceLine include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; $sql = "UPDATE ".MAIN_DB_PREFIX."facturedet_rec SET"; - $sql .= " fk_facture = ".$this->fk_facture; + $sql .= " fk_facture = ".((int) $this->fk_facture); $sql .= ", label=".(!empty($this->label) ? "'".$this->db->escape($this->label)."'" : "null"); $sql .= ", description='".$this->db->escape($this->desc)."'"; $sql .= ", price=".price2num($this->price); @@ -2142,10 +2142,10 @@ class FactureLigneRec extends CommonInvoiceLine $sql .= ", localtax2_tx=".price2num($this->localtax2_tx); $sql .= ", localtax2_type='".$this->db->escape($this->localtax2_type)."'"; $sql .= ", fk_product=".($this->fk_product > 0 ? $this->fk_product : "null"); - $sql .= ", product_type=".$this->product_type; - $sql .= ", remise_percent='".price2num($this->remise_percent)."'"; - $sql .= ", subprice='".price2num($this->subprice)."'"; - $sql .= ", info_bits='".price2num($this->info_bits)."'"; + $sql .= ", product_type=".((int) $this->product_type); + $sql .= ", remise_percent=".price2num($this->remise_percent); + $sql .= ", subprice=".price2num($this->subprice); + $sql .= ", info_bits=".price2num($this->info_bits); $sql .= ", date_start_fill=".(int) $this->date_start_fill; $sql .= ", date_end_fill=".(int) $this->date_end_fill; if (empty($this->skip_update_total)) { diff --git a/htdocs/fourn/class/fournisseur.facture-rec.class.php b/htdocs/fourn/class/fournisseur.facture-rec.class.php index f77dd5638f7..ea725f7b1e9 100644 --- a/htdocs/fourn/class/fournisseur.facture-rec.class.php +++ b/htdocs/fourn/class/fournisseur.facture-rec.class.php @@ -299,40 +299,34 @@ class FactureFournisseurRec extends CommonInvoice $sql .= ') VALUES ('; $sql .= "'".$this->db->escape($this->titre)."'"; $sql .= ", '".$this->db->escape($this->ref_supplier)."'"; - $sql .= ', ' . (int) $conf->entity; - $sql .= ', ' . (int) $facfourn_src->socid; + $sql .= ", ".((int) $conf->entity); + $sql .= ", ".((int) $facfourn_src->socid); $sql .= ", '".$this->db->idate($now)."'"; - $sql .= ', ' . (int) $this->suspended; - if (!empty(GETPOST('libelle'))) { - $sql .= ", '" . $this->db->escape(GETPOST('libelle')) . "'"; - } elseif (! empty($this->libelle)) { - $sql .= ", '" . $this->db->escape($this->libelle) . "'"; - } else { - $sql .= ", ''"; - } - $sql .= ', ' .(!empty($facfourn_src->total_ttc) ? (float) $facfourn_src->total_ttc : '0'); // amount - $sql .= ', ' .(!empty($facfourn_src->remise) ? (float) $facfourn_src->remise : '0'); - $sql .= ', ' . (int) $user->id; - $sql .= ', ' .(!empty($this->fk_project) ? $this->fk_project : 'NULL'); // Fields declarded on creation - $sql .= ', ' .(!empty($facfourn_src->fk_account) ? $facfourn_src->fk_account : 'NULL'); - $sql .= ', ' .($this->cond_reglement_id > 0 ? (int) $this->cond_reglement_id : 'NULL'); - $sql .= ', ' .($this->mode_reglement_id > 0 ? (int) $this->mode_reglement_id : 'NULL'); - $sql .= ", '".($facfourn_src->date_echeance > 0 ? $this->db->idate($facfourn_src->date_echeance) : 'NULL')."'"; // date_lim_reglement - $sql .= ', ' .(!empty($this->note_private) ? "'".$this->db->escape($this->note_private)."'" : 'NULL'); // Fields declarded on creation - $sql .= ', ' .(!empty($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : 'NULL'); // Fields declarded on creation - $sql .= ', ' .(!empty($this->model_pdf) ? "'".$this->db->escape($this->model_pdf)."'" : 'NULL'); // Fields declarded on creation - $sql .= ', ' . (int) $facfourn_src->fk_multicurrency; + $sql .= ", ".((int) $this->suspended); + $sql .= ", '".$this->db->escape($this->libelle)."'"; + $sql .= ", " .(!empty($facfourn_src->total_ttc) ? (float) $facfourn_src->total_ttc : '0'); // amount + $sql .= ", " .(!empty($facfourn_src->remise) ? (float) $facfourn_src->remise : '0'); + $sql .= ", " .((int) $user->id); + $sql .= ", " .(!empty($this->fk_project) ? ((int) $this->fk_project) : 'NULL'); + $sql .= ", " .(!empty($facfourn_src->fk_account) ? ((int) $facfourn_src->fk_account) : 'NULL'); + $sql .= ", " .($this->cond_reglement_id > 0 ? (int) $this->cond_reglement_id : 'NULL'); + $sql .= ", " .($this->mode_reglement_id > 0 ? (int) $this->mode_reglement_id : 'NULL'); + $sql .= ", ".($facfourn_src->date_echeance > 0 ? "'".$this->db->idate($facfourn_src->date_echeance)."'" : 'NULL'); // date_lim_reglement + $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->model_pdf) ? "'".$this->db->escape($this->model_pdf)."'" : 'NULL'); + $sql .= ", " . (int) $facfourn_src->fk_multicurrency; $sql .= ", '".$this->db->escape($facfourn_src->multicurrency_code)."'"; - $sql .= ', ' . (float) $facfourn_src->multicurrency_tx; - $sql .= ', ' . (int) $this->usenewprice; // Fields declarded on creation - $sql .= ', ' . (int) $this->frequency; // Fields declarded on creation - $sql .= ", '".$this->db->escape($this->unit_frequency)."'"; // Fields declarded on creation - $sql .= ', ' .(!empty($this->date_when) ? "'".$this->db->idate($this->date_when)."'" : 'NULL'); // Fields declarded on creation - $sql .= ', ' .(!empty($this->date_last_gen) ? "'".$this->db->idate($this->date_last_gen)."'" : 'NULL'); // Fields declarded on creation - $sql .= ', ' . (int) $this->nb_gen_done; // Fields declarded on creation - $sql .= ', ' . (int) $this->nb_gen_max; // Fields declarded on creation - $sql .= ', ' . (int) $this->auto_validate; // Fields declarded on creation - $sql .= ', ' . (int) $this->generate_pdf; // Fields declarded on creation + $sql .= ", " . (float) $facfourn_src->multicurrency_tx; + $sql .= ", " . (int) $this->usenewprice; + $sql .= ", " . (int) $this->frequency; + $sql .= ", '".$this->db->escape($this->unit_frequency)."'"; + $sql .= ", " .(!empty($this->date_when) ? "'".$this->db->idate($this->date_when)."'" : 'NULL'); + $sql .= ", " .(!empty($this->date_last_gen) ? "'".$this->db->idate($this->date_last_gen)."'" : 'NULL'); + $sql .= ", " . (int) $this->nb_gen_done; + $sql .= ", " . (int) $this->nb_gen_max; + $sql .= ", " . (int) $this->auto_validate; + $sql .= ", " . (int) $this->generate_pdf; $sql .= ')'; if ($this->db->query($sql)) { @@ -475,44 +469,43 @@ class FactureFournisseurRec extends CommonInvoice $error = 0; $sql = "UPDATE ".MAIN_DB_PREFIX."facture_fourn_rec SET"; - $sql .= ' titre = "' . (!empty($this->titre) ? $this->titre .'",' : '"",') ; - $sql .= ' ref_supplier = "'. (!empty($this->ref_supplier) ? $this->ref_supplier .'",' : '" ",'); - $sql .= " entity = ". (!empty($this->entity) ? $this->entity : 1) . ','; + $sql .= " titre = '" . (!empty($this->titre) ? $this->db->escape($this->titre) : "")."'," ; + $sql .= " ref_supplier = '". (!empty($this->ref_supplier) ? $this->db->escape($this->ref_supplier) : "")."',"; + $sql .= " entity = ". (!empty($this->entity) ? ((int) $this->entity) : 1) . ','; if ($this->fk_soc > 0) $sql .= " fk_soc = ". (int) $this->fk_soc. ','; - $sql .= ' tms = "'. date('Y-m-d H:i:s', dol_now()) . '",'; - $sql .= " suspended = ". (!empty($this->suspended) ? $this->suspended : 0) . ','; - $sql .= ' libelle = "'. (!empty($this->libelle) ? $this->libelle : 'NULL') . '",'; - $sql .= " amount = ". (!empty($this->amount) ? $this->amount : 0.00) . ','; - $sql .= " remise = ". (!empty($this->remise) ? $this->remise : 'NULL') . ','; - $sql .= " vat_src_code = ". (!empty($this->vat_src_code) ? $this->vat_src_code : 'NULL') . ','; - $sql .= " localtax1 = ". (!empty($this->localtax1) ? $this->localtax1 : 0.00) . ','; - $sql .= " localtax2 = ". (!empty($this->localtax2) ? $this->localtax2 : 0.00) . ','; - $sql .= " total_ht = ". (!empty($this->total_ht) ? $this->total_ht : 0.00) . ','; - $sql .= " total_tva = ". (!empty($this->total_tva) ? $this->total_tva : 0.00) . ','; - $sql .= " total_ttc = ". (!empty($this->total_ttc) ? $this->total_ttc : 0.00) . ','; - $sql .= " fk_user_modif = ". $user->id . ','; - $sql .= " fk_projet = ". (!empty($this->fk_project) ? $this->fk_project : 'NULL') . ','; - $sql .= " fk_account = ". (!empty($this->fk_account) ? $this->fk_account : 'NULL') . ','; - $sql .= " fk_mode_reglement = ". (!empty($this->mode_reglement_id) ? $this->mode_reglement_id : 'NULL') . ','; - $sql .= " fk_cond_reglement = ". (!empty($this->cond_reglement_id) ? $this->cond_reglement_id : 'NULL') . ','; - $sql .= " date_lim_reglement = ". (!empty($this->date_lim_reglement) ? '"'.date("Y-m-d H:i:s", $this->date_lim_reglement).'"' : 'NULL') . ','; - $sql .= ' note_private = "'. (!empty($this->note_private) ? $this->note_private : '') . '",'; - $sql .= ' note_public = "'. (!empty($this->note_public) ? $this->note_public : '') . '",'; - $sql .= ' modelpdf = "'. (!empty($this->model_pdf) ? $this->model_pdf : 'NULL') . '",'; - $sql .= " fk_multicurrency = ". (!empty($this->fk_multicurrency) ? $this->fk_multicurrency : 'NULL') . ','; - $sql .= ' multicurrency_code = "'. (!empty($this->multicurrency_code) ? $this->multicurrency_code : 'NULL') . '",'; - $sql .= " multicurrency_tx = ". (!empty($this->multicurrency_tx) ? $this->multicurrency_tx : 1) . ','; - $sql .= " multicurrency_total_ht = ". (!empty($this->multicurrency_total_ht) ? $this->multicurrency_total_ht : 0.00) . ','; - $sql .= " multicurrency_total_tva = ". (!empty($this->multicurrency_total_tva) ? $this->multicurrency_total_tva : 0.00) . ','; - $sql .= " multicurrency_total_ttc = ". (!empty($this->multicurrency_total_ttc) ? $this->multicurrency_total_ttc : 0.00) . ','; - $sql .= " usenewprice = ". (!empty($this->usenewprice) ? $this->usenewprice : 0) . ','; - $sql .= " frequency = ". (!empty($this->frequency) ? $this->frequency : 0). ','; - $sql .= ' unit_frequency = "'. (!empty($this->unit_frequency) ? $this->unit_frequency : 0). '",'; - $sql .= " date_when = ". (!empty($this->date_when) ? '"'.date("Y-m-d H:i:s", $this->date_when).'"' : 0) . ','; - $sql .= " date_last_gen = ". (!empty($this->date_last_gen) ? '"'.date("Y-m-d H:i:s", $this->date_last_gen).'"' : 0) . ','; - $sql .= " nb_gen_done = ". (!empty($this->nb_gen_done) ? $this->nb_gen_done : 0) . ','; - $sql .= " nb_gen_max = ". (!empty($this->nb_gen_max) ? $this->nb_gen_max : 0) . ','; - $sql .= " auto_validate = ". (!empty($this->auto_validate) ? $this->auto_validate : 0); + $sql .= " suspended = ". (!empty($this->suspended) ? ((int) $this->suspended) : 0) . ','; + $sql .= " libelle = ". (!empty($this->libelle) ? "'".$this->db->escape($this->libelle)."'" : 'NULL') . ","; + $sql .= " amount = ". (!empty($this->amount) ? ((float) $this->amount) : 0.00) . ','; + $sql .= " remise = ". (!empty($this->remise) ? ((float) $this->remise) : 'NULL') . ','; + $sql .= " vat_src_code = ". (!empty($this->vat_src_code) ? "'".$this->vat_src_code."'" : 'NULL') . ','; + $sql .= " localtax1 = ". (!empty($this->localtax1) ? ((float) $this->localtax1) : 0.00) . ','; + $sql .= " localtax2 = ". (!empty($this->localtax2) ? ((float) $this->localtax2) : 0.00) . ','; + $sql .= " total_ht = ". (!empty($this->total_ht) ? ((float) $this->total_ht) : 0.00) . ','; + $sql .= " total_tva = ". (!empty($this->total_tva) ? ((float) $this->total_tva) : 0.00) . ','; + $sql .= " total_ttc = ". (!empty($this->total_ttc) ? ((float) $this->total_ttc) : 0.00) . ','; + $sql .= " fk_user_modif = ". ((int) $user->id) . ','; + $sql .= " fk_projet = ". (!empty($this->fk_project) ? ((int) $this->fk_project) : 'NULL') . ','; + $sql .= " fk_account = ". (!empty($this->fk_account) ? ((int) $this->fk_account) : 'NULL') . ','; + $sql .= " fk_mode_reglement = ". (!empty($this->mode_reglement_id) ? ((int) $this->mode_reglement_id) : 'NULL') . ','; + $sql .= " fk_cond_reglement = ". (!empty($this->cond_reglement_id) ? ((int) $this->cond_reglement_id) : 'NULL') . ','; + $sql .= " date_lim_reglement = ". (!empty($this->date_lim_reglement) ? "'".$this->db->idate($this->date_lim_reglement)."'" : 'NULL') . ','; + $sql .= " note_private = '". (!empty($this->note_private) ? $this->db->escape($this->note_private) : '') . "',"; + $sql .= " note_public = '". (!empty($this->note_public) ? $this->db->escape($this->note_public) : '') . "',"; + $sql .= " modelpdf = ". (!empty($this->model_pdf) ? "'".$this->db->escape($this->model_pdf)."'" : 'NULL') . ","; + $sql .= " fk_multicurrency = ". (!empty($this->fk_multicurrency) ? ((int) $this->fk_multicurrency) : 'NULL') . ','; + $sql .= " multicurrency_code = ". (!empty($this->multicurrency_code) ? "'".$this->db->escape($this->multicurrency_code)."'" : 'NULL') . ","; + $sql .= " multicurrency_tx = ". (!empty($this->multicurrency_tx) ? ((float) $this->multicurrency_tx) : 1) . ','; + $sql .= " multicurrency_total_ht = ". (!empty($this->multicurrency_total_ht) ? ((float) $this->multicurrency_total_ht) : 0.00) . ','; + $sql .= " multicurrency_total_tva = ". (!empty($this->multicurrency_total_tva) ? ((float) $this->multicurrency_total_tva) : 0.00) . ','; + $sql .= " multicurrency_total_ttc = ". (!empty($this->multicurrency_total_ttc) ? ((float) $this->multicurrency_total_ttc) : 0.00) . ','; + $sql .= " usenewprice = ". (!empty($this->usenewprice) ? ((int) $this->usenewprice) : 0) . ','; + $sql .= " frequency = ". (!empty($this->frequency) ? ((int) $this->frequency) : 0). ','; + $sql .= " unit_frequency = '". (!empty($this->unit_frequency) ? $this->db->escape($this->unit_frequency) : ''). "',"; + $sql .= " date_when = ". (!empty($this->date_when) ? "'".$this->db->idate($this->date_when)."'" : 'NULL') . ','; + $sql .= " date_last_gen = ". (!empty($this->date_last_gen) ? "'".$this->db->idate($this->date_last_gen)."'" : 'NULL') . ','; + $sql .= " nb_gen_done = ". (!empty($this->nb_gen_done) ? ((int) $this->nb_gen_done) : 0) . ','; + $sql .= " nb_gen_max = ". (!empty($this->nb_gen_max) ? ((int) $this->nb_gen_max) : 0) . ','; + $sql .= " auto_validate = ". (!empty($this->auto_validate) ? ((int) $this->auto_validate) : 0); $sql .= " WHERE rowid = ". (int) $this->id; dol_syslog(get_class($this)."::update", LOG_DEBUG); From 7c591d95d94b064ff2eac0cc31742d57dc087dbb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 5 Apr 2022 13:48:39 +0200 Subject: [PATCH 546/610] Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop --- .../class/fournisseur.facture-rec.class.php | 101 +++++++++--------- 1 file changed, 53 insertions(+), 48 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.facture-rec.class.php b/htdocs/fourn/class/fournisseur.facture-rec.class.php index b55246ad30e..abbf0db90fe 100644 --- a/htdocs/fourn/class/fournisseur.facture-rec.class.php +++ b/htdocs/fourn/class/fournisseur.facture-rec.class.php @@ -1759,14 +1759,15 @@ class FactureFournisseurRec extends CommonInvoice return -2; } - $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element; - $sql .= ' SET frequency = '.($frequency ? $this->db->escape($frequency) : 'null'); + $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element; + $sql .= " SET frequency = ".($frequency ? ((int) $this->db->escape($frequency)) : "NULL"); if (!empty($unit)) { - $sql .= ', unit_frequency = \''.$this->db->escape($unit).'\''; + $sql .= ", unit_frequency = '".$this->db->escape($unit)."'"; } - $sql .= ' WHERE rowid = ' . (int) $this->id; + $sql .= " WHERE rowid = ".((int) $this->id); + + dol_syslog(get_class($this).'::setFrequencyAndUnit', LOG_DEBUG); - dol_syslog(get_class($this). '::setFrequencyAndUnit', LOG_DEBUG); if ($this->db->query($sql)) { $this->frequency = $frequency; if (!empty($unit)) { @@ -1774,7 +1775,7 @@ class FactureFournisseurRec extends CommonInvoice } return 1; } else { - dol_print_error($this->db); + $this->error = $this->db->lasterror(); return -1; } } @@ -1789,17 +1790,18 @@ class FactureFournisseurRec extends CommonInvoice public function setNextDate($date, $increment_nb_gen_done = 0) { if (!$this->table_element) { - dol_syslog(get_class($this). '::setNextDate was called on objet with property table_element not defined', LOG_ERR); + dol_syslog(get_class($this).'::setNextDate was called on objet with property table_element not defined', LOG_ERR); return -1; } - $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element; - $sql .= ' SET date_when = ' .($date ? "'".$this->db->idate($date)."'" : 'null'); + $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element; + $sql .= " SET date_when = " .($date ? "'".$this->db->idate($date)."'" : "NULL"); if ($increment_nb_gen_done > 0) { - $sql .= ', nb_gen_done = nb_gen_done + 1'; + $sql .= ", nb_gen_done = nb_gen_done + 1"; } - $sql .= ' WHERE rowid = ' . (int) $this->id; + $sql .= " WHERE rowid = " . (int) $this->id; + + dol_syslog(get_class($this).'::setNextDate', LOG_DEBUG); - dol_syslog(get_class($this). '::setNextDate', LOG_DEBUG); if ($this->db->query($sql)) { $this->date_when = $date; if ($increment_nb_gen_done > 0) { @@ -1807,7 +1809,7 @@ class FactureFournisseurRec extends CommonInvoice } return 1; } else { - dol_print_error($this->db); + $this->error = $this->db->lasterror(); return -1; } } @@ -1821,7 +1823,7 @@ class FactureFournisseurRec extends CommonInvoice public function setMaxPeriod($nb) { if (!$this->table_element) { - dol_syslog(get_class($this). '::setMaxPeriod was called on objet with property table_element not defined', LOG_ERR); + dol_syslog(get_class($this).'::setMaxPeriod was called on objet with property table_element not defined', LOG_ERR); return -1; } @@ -1829,11 +1831,12 @@ class FactureFournisseurRec extends CommonInvoice $nb = 0; } - $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element; - $sql .= ' SET nb_gen_max = '. (int) $nb; - $sql .= ' WHERE rowid = ' . (int) $this->id; + $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element; + $sql .= " SET nb_gen_max = ". (int) $nb; + $sql .= " WHERE rowid = " . (int) $this->id; + + dol_syslog(get_class($this).'::setMaxPeriod', LOG_DEBUG); - dol_syslog(get_class($this). '::setMaxPeriod', LOG_DEBUG); if ($this->db->query($sql)) { $this->nb_gen_max = $nb; return 1; @@ -1852,15 +1855,16 @@ class FactureFournisseurRec extends CommonInvoice public function setAutoValidate($validate) { if (!$this->table_element) { - dol_syslog(get_class($this). '::setAutoValidate was called on objet with property table_element not defined', LOG_ERR); + dol_syslog(get_class($this).'::setAutoValidate was called on objet with property table_element not defined', LOG_ERR); return -1; } - $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element; - $sql .= ' SET auto_validate = '.((int) $validate); - $sql .= ' WHERE rowid = ' . (int) $this->id; + $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element; + $sql .= " SET auto_validate = ".((int) $validate); + $sql .= " WHERE rowid = " . (int) $this->id; + + dol_syslog(get_class($this).'::setAutoValidate', LOG_DEBUG); - dol_syslog(get_class($this). '::setAutoValidate', LOG_DEBUG); if ($this->db->query($sql)) { $this->auto_validate = $validate; return 1; @@ -1879,15 +1883,16 @@ class FactureFournisseurRec extends CommonInvoice public function setGeneratePdf($validate) { if (!$this->table_element) { - dol_syslog(get_class($this). '::setGeneratePdf was called on objet with property table_element not defined', LOG_ERR); + dol_syslog(get_class($this).'::setGeneratePdf was called on objet with property table_element not defined', LOG_ERR); return -1; } - $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element; - $sql .= ' SET generate_pdf = '. (int) $validate; - $sql .= ' WHERE rowid = ' . (int) $this->id; + $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element; + $sql .= " SET generate_pdf = ". (int) $validate; + $sql .= " WHERE rowid = " . (int) $this->id; + + dol_syslog(get_class($this).'::setGeneratePdf', LOG_DEBUG); - dol_syslog(get_class($this). '::setGeneratePdf', LOG_DEBUG); if ($this->db->query($sql)) { $this->generate_pdf = $validate; return 1; @@ -1906,15 +1911,16 @@ class FactureFournisseurRec extends CommonInvoice public function setModelPdf($model) { if (!$this->table_element) { - dol_syslog(get_class($this). '::setModelPdf was called on objet with property table_element not defined', LOG_ERR); + dol_syslog(get_class($this).'::setModelPdf was called on objet with property table_element not defined', LOG_ERR); return -1; } - $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element; + $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element; $sql .= " SET modelpdf = '".$this->db->escape($model)."'"; - $sql .= ' WHERE rowid = ' . (int) $this->id; + $sql .= " WHERE rowid = " . (int) $this->id; + + dol_syslog(get_class($this).'::setModelPdf', LOG_DEBUG); - dol_syslog(get_class($this). '::setModelPdf', LOG_DEBUG); if ($this->db->query($sql)) { $this->model_pdf = $model; return 1; @@ -2137,8 +2143,8 @@ class FactureFournisseurLigneRec extends CommonObjectLine $sql .= ' fk_facture_fourn = ' . (int) $this->fk_facture_fourn; $sql .= ', fk_parent_line = ' . (int) $this->fk_parent; $sql .= ', fk_product = ' . (int) $this->fk_product; - $sql .= ', ref = ' . (! empty($this->ref) ? "'" . $this->db->escape($this->ref) . "'" : 'null'); - $sql .= ", label = " . (! empty($this->label) ? "'" . $this->db->escape($this->label) . "'" : 'null'); + $sql .= ', ref = ' . (! empty($this->ref) ? "'" . $this->db->escape($this->ref) . "'" : 'NULL'); + $sql .= ", label = " . (! empty($this->label) ? "'" . $this->db->escape($this->label) . "'" : 'NULL'); $sql .= ", description = '" . $this->db->escape($this->description) . "'"; $sql .= ', pu_ht = ' . price2num($this->pu_ht); $sql .= ', pu_ttc = ' . price2num($this->pu_ttc); @@ -2146,27 +2152,26 @@ class FactureFournisseurLigneRec extends CommonObjectLine $sql .= ", remise_percent = '" . price2num($this->remise_percent) . "'"; $sql .= ', fk_remise_except = ' . (int) $this->fk_remise_except; $sql .= ", vat_src_code = '" . $this->db->escape($this->vat_src_code) . "'"; - $sql .= ', tva_tx =' . price2num($this->tva_tx); + $sql .= ', tva_tx = ' . price2num($this->tva_tx); $sql .= ', localtax1_tx = ' . price2num($this->localtax1_tx); $sql .= ", localtax1_type = '" . $this->db->escape($this->localtax1_type) . "'"; $sql .= ', localtax2_tx = ' . price2num($this->localtax2_tx); $sql .= ", localtax2_type = '" . $this->db->escape($this->localtax2_type) . "'"; if (empty($this->skip_update_total)) { - $sql .= ', total_ht =' . price2num($this->total_ht); - $sql .= ', total_tva =' . price2num($this->total_tva); - $sql .= ', total_localtax1 =' . price2num($this->total_localtax1); - $sql .= ', total_localtax2 =' . price2num($this->total_localtax2); - $sql .= ', total_ttc =' . price2num($this->total_ttc); + $sql .= ', total_ht = ' . price2num($this->total_ht); + $sql .= ', total_tva = ' . price2num($this->total_tva); + $sql .= ', total_localtax1 = ' . price2num($this->total_localtax1); + $sql .= ', total_localtax2 = ' . price2num($this->total_localtax2); + $sql .= ', total_ttc = ' . price2num($this->total_ttc); } - $sql .= ', product_type =' . (int) $this->product_type; - $sql .= ', date_start =' . (int) $this->date_start; - $sql .= ', date_end =' . (int) $this->date_end; - $sql .= ", info_bits ='" . price2num($this->info_bits) . "'"; + $sql .= ', product_type = ' . (int) $this->product_type; + $sql .= ', date_start = ' . (int) $this->date_start; + $sql .= ', date_end = ' . (int) $this->date_end; + $sql .= ", info_bits = " . ((int) $this->info_bits); $sql .= ', special_code =' . (int) $this->special_code; - $sql .= ', rang =' . (int) $this->rang; - $sql .= ', fk_unit =' .($this->fk_unit ? "'".$this->db->escape($this->fk_unit)."'" : 'null'); - $sql .= ', fk_user_modif =' . (int) $user; - + $sql .= ', rang = ' . (int) $this->rang; + $sql .= ', fk_unit = ' .($this->fk_unit ? "'".$this->db->escape($this->fk_unit)."'" : 'null'); + $sql .= ', fk_user_modif = ' . (int) $user; $sql .= ' WHERE rowid = ' . (int) $this->id; $this->db->begin(); From 9bf156b98107567788087ffabe223e0c1b920a30 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 5 Apr 2022 13:54:09 +0200 Subject: [PATCH 547/610] Doc --- htdocs/core/db/DoliDB.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/db/DoliDB.class.php b/htdocs/core/db/DoliDB.class.php index f23a66bbee4..66e54a4fc3c 100644 --- a/htdocs/core/db/DoliDB.class.php +++ b/htdocs/core/db/DoliDB.class.php @@ -106,7 +106,7 @@ abstract class DoliDB implements Database */ public function idate($param, $gm = 'tzserver') { - // TODO $param should be gmt, so we should add $gm to 'gmt' instead of default 'tzserver' + // TODO $param should be gmt, so we should have default $gm to 'gmt' instead of default 'tzserver' return dol_print_date($param, "%Y-%m-%d %H:%M:%S", $gm); } From 63016b79ea810157cf320c675d86741d1256c342 Mon Sep 17 00:00:00 2001 From: bomuux Date: Mon, 4 Apr 2022 18:06:11 +0200 Subject: [PATCH 548/610] Bug: Cannot set thirdparty customer accountancy code to empty string When thirdparty customer accountancy code is set to a non empty string, one cannot set it back to empty string due to thirdparty property deprecation : code_compta to code_compta_client --- htdocs/comm/card.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 90d3ed128f7..177d3e1f668 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -159,7 +159,8 @@ if (empty($reshook)) { // set accountancy code if ($action == 'setcustomeraccountancycode') { $result = $object->fetch($id); - $object->code_compta = GETPOST("customeraccountancycode"); + $object->code_compta_client = GETPOST("customeraccountancycode"); + $object->code_compta = $object->code_compta_client; // For Backward compatibility $result = $object->update($object->id, $user, 1, 1, 0); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); @@ -357,9 +358,9 @@ if ($object->id > 0) { print ''; print ''; print ''; } From 26f7a50838db4fee72c34800d366ea318ab96a8d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 5 Apr 2022 14:15:27 +0200 Subject: [PATCH 549/610] Update linkedobjectblock.tpl.php --- htdocs/reception/tpl/linkedobjectblock.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/reception/tpl/linkedobjectblock.tpl.php b/htdocs/reception/tpl/linkedobjectblock.tpl.php index 3d61a7da815..009534b91b5 100644 --- a/htdocs/reception/tpl/linkedobjectblock.tpl.php +++ b/htdocs/reception/tpl/linkedobjectblock.tpl.php @@ -56,7 +56,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) { } ?> - +
' . $langs->trans('ExpenseReportApplyTo') . '' . $langs->trans('Type') . '' . $langs->trans('ExpenseReportLimitOn') . '' . $langs->trans('ExpenseReportDateStart') . '' . $langs->trans('ExpenseReportDateEnd') . '' . $langs->trans('ExpenseReportLimitAmount') . '' . $langs->trans('ExpenseReportRestrictive') . '
' . $langs->trans('ExpenseReportApplyTo') . '' . $langs->trans('Type') . '' . $langs->trans('ExpenseReportLimitOn') . '' . $langs->trans('ExpenseReportDateStart') . '' . $langs->trans('ExpenseReportDateEnd') . '' . $langs->trans('ExpenseReportLimitAmount') . '' . $langs->trans('ExpenseReportRestrictive') . ' 
'; + echo ''; if ($action == 'edit' && $object->id == $rule->id) { $selected = ($object->is_for_all > 0) ? 'A' : ($object->fk_usergroup > 0 ? 'G' : 'U'); echo '
' . $form->selectarray('apply_to', $tab_apply, $selected, 0) . '
'; @@ -259,7 +259,7 @@ foreach ($rules as $rule) { echo '
'; + echo ''; if ($action == 'edit' && $object->id == $rule->id) { echo $form->selectExpense($object->fk_c_type_fees, 'fk_c_type_fees', 0, 1, 1); } else { @@ -278,7 +278,7 @@ foreach ($rules as $rule) { echo ''; + echo ''; if ($action == 'edit' && $object->id == $rule->id) { echo $form->selectarray('code_expense_rules_type', $tab_rules_type, $object->code_expense_rules_type, 0); } else { @@ -287,7 +287,7 @@ foreach ($rules as $rule) { echo ''; + echo ''; if ($action == 'edit' && $object->id == $rule->id) { print $form->selectDate(strtotime(date('Y-m-d', $object->dates)), 'start', '', '', 0, '', 1, 0); } else { @@ -296,7 +296,7 @@ foreach ($rules as $rule) { echo ''; + echo ''; if ($action == 'edit' && $object->id == $rule->id) { print $form->selectDate(strtotime(date('Y-m-d', $object->datee)), 'end', '', '', 0, '', 1, 0); } else { @@ -305,7 +305,7 @@ foreach ($rules as $rule) { echo ''; + echo ''; if ($action == 'edit' && $object->id == $rule->id) { echo '' . $conf->currency; } else { @@ -314,7 +314,7 @@ foreach ($rules as $rule) { echo ''; + echo ''; if ($action == 'edit' && $object->id == $rule->id) { echo $form->selectyesno('restrictive', $object->restrictive, 1); } else { From 5f6c5ccf926c38dce51a2a4fe3154530ba9ced9a Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 4 Apr 2022 16:25:31 +0200 Subject: [PATCH 536/610] NEW Supplier order - Show ref supplier of reception in linked object block --- htdocs/reception/tpl/linkedobjectblock.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/reception/tpl/linkedobjectblock.tpl.php b/htdocs/reception/tpl/linkedobjectblock.tpl.php index 1bfecac3f1d..3d61a7da815 100644 --- a/htdocs/reception/tpl/linkedobjectblock.tpl.php +++ b/htdocs/reception/tpl/linkedobjectblock.tpl.php @@ -56,7 +56,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) { } ?> getNomUrl(1); ?>ref_supplier; ?> date_delivery, 'day'); ?> rights->reception->lire) { From f4a780f3f66f149a762bab038e57eb5427b96a0d Mon Sep 17 00:00:00 2001 From: jpb Date: Mon, 4 Apr 2022 16:28:42 +0200 Subject: [PATCH 537/610] add name on tr data --- htdocs/admin/expensereport_rules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/expensereport_rules.php b/htdocs/admin/expensereport_rules.php index f15b996939d..9204e72f049 100644 --- a/htdocs/admin/expensereport_rules.php +++ b/htdocs/admin/expensereport_rules.php @@ -239,7 +239,7 @@ if ($action == 'edit') { echo '
'; if ($action == 'edit' && $object->id == $rule->id) { From ad145c94ca5a9ad2f4632e7b7621ab1ad5fd1547 Mon Sep 17 00:00:00 2001 From: atm-greg Date: Mon, 4 Apr 2022 17:23:34 +0200 Subject: [PATCH 538/610] add comment --- htdocs/core/class/commonobject.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index f7eb6a67263..a8233a3d29f 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -125,6 +125,7 @@ abstract class CommonObject /** * @var boolean is linkedObjects full loaded. Loaded by ->fetchObjectLinked + * important for pdf generation time reduction */ public $linkedObjectsFullLoaded = false; From b03d7c60ff30bc6cecfdce1ded14a5ab9faf962c Mon Sep 17 00:00:00 2001 From: bomuux Date: Mon, 4 Apr 2022 18:06:11 +0200 Subject: [PATCH 539/610] Bug: Cannot set thirdparty customer accountancy code to empty string When thirdparty customer accountancy code is set to a non empty string, one cannot set it back to empty string due to thirdparty property deprecation : code_compta to code_compta_client --- htdocs/comm/card.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index de387ce60f3..4aca208681b 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -162,7 +162,8 @@ if (empty($reshook)) { // set accountancy code if ($action == 'setcustomeraccountancycode') { $result = $object->fetch($id); - $object->code_compta = GETPOST("customeraccountancycode"); + $object->code_compta_client = GETPOST("customeraccountancycode"); + $object->code_compta = $object->code_compta_client; // For Backward compatibility $result = $object->update($object->id, $user, 1, 1, 0); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); @@ -360,9 +361,9 @@ if ($object->id > 0) { print '
'; - print $form->editfieldkey("CustomerAccountancyCode", 'customeraccountancycode', $object->code_compta, $object, $user->rights->societe->creer); + print $form->editfieldkey("CustomerAccountancyCode", 'customeraccountancycode', $object->code_compta_client, $object, $user->rights->societe->creer); print ''; - print $form->editfieldval("CustomerAccountancyCode", 'customeraccountancycode', $object->code_compta, $object, $user->rights->societe->creer); + print $form->editfieldval("CustomerAccountancyCode", 'customeraccountancycode', $object->code_compta_client, $object, $user->rights->societe->creer); print '
'.$langs->trans('Supplier').''; - if ($societe->id > 0 && (!GETPOST('fac_rec', 'int') || !empty($invoice_predefined->frequency))) { + if ($societe->id > 0 && ($fac_recid <= 0 || !empty($invoice_predefined->frequency))) { $absolute_discount = $societe->getAvailableDiscounts('', '', 0, 1); print $societe->getNomUrl(1, 'supplier'); print ''; @@ -2050,15 +2050,15 @@ if ($action == 'create') { }); '; } - if (!GETPOST('fac_rec', 'int')) { + if ($fac_recid <= 0) { print ' '; } } print '
'.$langs->trans('CreateFromRepeatableInvoice').''; - //print ''; + //print ''; print '
'.$langs->trans('Project').''; print img_picto('', 'project', 'class="pictofixedwidth"').$formproject->select_projects((empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) ? $societe->id : -1), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500 widthcentpercentminusxx'); - print ' id.($fac_rec ? '&fac_rec='.$fac_rec : '')).'">'; + print ' id.($fac_recid > 0 ? '&fac_rec='.$fac_recid : '')).'">'; print '
'; - print $form->editfieldkey("CustomerAccountancyCode", 'customeraccountancycode', $object->code_compta, $object, $user->rights->societe->creer); + print $form->editfieldkey("CustomerAccountancyCode", 'customeraccountancycode', $object->code_compta_client, $object, $user->rights->societe->creer); print ''; - print $form->editfieldval("CustomerAccountancyCode", 'customeraccountancycode', $object->code_compta, $object, $user->rights->societe->creer); + print $form->editfieldval("CustomerAccountancyCode", 'customeraccountancycode', $object->code_compta_client, $object, $user->rights->societe->creer); print '
getNomUrl(1); ?>ref_supplier; ?>ref_supplier); ?> date_delivery, 'day'); ?> rights->reception->lire) { From ed7fd099258ff780453dfd5739ca0db805182c95 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 5 Apr 2022 14:36:09 +0200 Subject: [PATCH 550/610] Fix regression --- htdocs/core/lib/company.lib.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 116c2beeb20..b8b6d1c728a 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -42,6 +42,8 @@ function societe_prepare_head(Societe $object) { global $db, $langs, $conf, $user; + global $hookmanager; + $h = 0; $head = array(); From 59fec7d0949cf860f01753d484242e7436f54e5f Mon Sep 17 00:00:00 2001 From: atm-greg Date: Tue, 5 Apr 2022 15:10:31 +0200 Subject: [PATCH 551/610] implement cache managed by current object --- htdocs/core/class/commonobject.class.php | 4 ++++ htdocs/core/lib/pdf.lib.php | 4 +--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index a8233a3d29f..e04ac12636d 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3779,6 +3779,10 @@ abstract class CommonObject { global $conf, $hookmanager, $action; + // important for pdf generation time reduction + // this boolean is true if $this->linkedObjects has already been loaded with all objects linked without filter + if ($this->linkedObjectsFullLoaded) return 1; + $this->linkedObjectsIds = array(); $this->linkedObjects = array(); diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index b273f93b69f..ea8c6c2ce23 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -2282,9 +2282,7 @@ function pdf_getLinkedObjects(&$object, $outputlangs) $linkedobjects = array(); - if (empty($object->linkedObjectsFullLoaded)) { - $object->fetchObjectLinked(); - } + $object->fetchObjectLinked(); foreach ($object->linkedObjects as $objecttype => $objects) { if ($objecttype == 'facture') { From aa42df9961e4c0865b8f1382b870317ab521281b Mon Sep 17 00:00:00 2001 From: atm-greg Date: Tue, 5 Apr 2022 15:11:37 +0200 Subject: [PATCH 552/610] just for glory --- htdocs/core/class/commonobject.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index e04ac12636d..02d016d2ce7 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -15,6 +15,7 @@ * Copyright (C) 2018-2021 Frédéric France * Copyright (C) 2018 Josep Lluís Amador * Copyright (C) 2021 Gauthier VERDOL + * Copyright (C) 2021 Grégory Blémand * * 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 From 759f7e051e62efe14dd593d032c80374af8dea45 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 5 Apr 2022 15:18:52 +0200 Subject: [PATCH 553/610] Update files.lib.php --- htdocs/core/lib/files.lib.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 37bc946a8b6..58e282bf7a5 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -2087,7 +2087,10 @@ function dol_uncompress($inputfile, $outputdir) include_once DOL_DOCUMENT_ROOT."/core/class/utils.class.php"; $utils = new Utils($db); + $fileinfo = pathinfo($inputfile); + $fileinfo["extension"] = strtolower($fileinfo["extension"]); + if ($fileinfo["extension"] == "zip") { if (defined('ODTPHP_PATHTOPCLZIP') && empty($conf->global->MAIN_USE_ZIPARCHIVE_FOR_ZIP_UNCOMPRESS)) { dol_syslog("Constant ODTPHP_PATHTOPCLZIP for pclzip library is set to ".ODTPHP_PATHTOPCLZIP.", so we use Pclzip to unzip into ".$outputdir); @@ -2146,8 +2149,8 @@ function dol_uncompress($inputfile, $outputdir) } return array('error'=>'ErrNoZipEngine'); - } elseif (in_array($fileinfo["extension"], array('gz','bz2','zst'))) { - $extension = pathinfo($fileinfo["filename"], PATHINFO_EXTENSION); + } elseif (in_array($fileinfo["extension"], array('gz', 'bz2', 'zst'))) { + $extension = strtolower(pathinfo($fileinfo["filename"], PATHINFO_EXTENSION)); if ($extension == "tar") { $cmd = 'tar -C '.escapeshellcmd(dol_sanitizePathName($outputdir)).' -xvf '.escapeshellcmd(dol_sanitizePathName($fileinfo["dirname"]).'/'.dol_sanitizeFileName($fileinfo["basename"])); $resarray = $utils->executeCLI($cmd, $outputdir); From 3385cb80718bc3baf77db81551cc9e4f74a93b56 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 5 Apr 2022 15:19:55 +0200 Subject: [PATCH 554/610] Update files.lib.php --- htdocs/core/lib/files.lib.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 58e282bf7a5..472636d7354 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -2085,9 +2085,6 @@ function dol_uncompress($inputfile, $outputdir) { global $conf, $langs, $db; - include_once DOL_DOCUMENT_ROOT."/core/class/utils.class.php"; - $utils = new Utils($db); - $fileinfo = pathinfo($inputfile); $fileinfo["extension"] = strtolower($fileinfo["extension"]); @@ -2150,6 +2147,9 @@ function dol_uncompress($inputfile, $outputdir) return array('error'=>'ErrNoZipEngine'); } elseif (in_array($fileinfo["extension"], array('gz', 'bz2', 'zst'))) { + include_once DOL_DOCUMENT_ROOT."/core/class/utils.class.php"; + $utils = new Utils($db); + $extension = strtolower(pathinfo($fileinfo["filename"], PATHINFO_EXTENSION)); if ($extension == "tar") { $cmd = 'tar -C '.escapeshellcmd(dol_sanitizePathName($outputdir)).' -xvf '.escapeshellcmd(dol_sanitizePathName($fileinfo["dirname"]).'/'.dol_sanitizeFileName($fileinfo["basename"])); From efa302f865566be627863efa68a16264101f16c7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 5 Apr 2022 15:23:17 +0200 Subject: [PATCH 555/610] Fix phpunit --- .../class/fournisseur.facture-rec.class.php | 46 +++++++++---------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.facture-rec.class.php b/htdocs/fourn/class/fournisseur.facture-rec.class.php index abbf0db90fe..fea334e43cf 100644 --- a/htdocs/fourn/class/fournisseur.facture-rec.class.php +++ b/htdocs/fourn/class/fournisseur.facture-rec.class.php @@ -477,7 +477,7 @@ class FactureFournisseurRec extends CommonInvoice $sql .= " libelle = ". (!empty($this->libelle) ? "'".$this->db->escape($this->libelle)."'" : 'NULL') . ","; $sql .= " amount = ". (!empty($this->amount) ? ((float) $this->amount) : 0.00) . ','; $sql .= " remise = ". (!empty($this->remise) ? ((float) $this->remise) : 'NULL') . ','; - $sql .= " vat_src_code = ". (!empty($this->vat_src_code) ? "'".$this->vat_src_code."'" : 'NULL') . ','; + $sql .= " vat_src_code = ". (!empty($this->vat_src_code) ? "'".$this->db->escape($this->vat_src_code)."'" : 'NULL') . ','; $sql .= " localtax1 = ". (!empty($this->localtax1) ? ((float) $this->localtax1) : 0.00) . ','; $sql .= " localtax2 = ". (!empty($this->localtax2) ? ((float) $this->localtax2) : 0.00) . ','; $sql .= " total_ht = ". (!empty($this->total_ht) ? ((float) $this->total_ht) : 0.00) . ','; @@ -1132,28 +1132,28 @@ class FactureFournisseurRec extends CommonInvoice $sql .= ", ref = '" . $this->db->escape($ref) . "'"; $sql .= ", label = '" . $this->db->escape($label) . "'"; $sql .= ", description = '" . $this->db->escape($desc) . "'"; - $sql .= ', pu_ht=' . price2num($pu_ht); - $sql .= ', qty=' . price2num($qty); - $sql .= ", remise_percent='" . price2num($remise_percent) . "'"; - $sql .= ", vat_src_code='" . $this->db->escape($vat_src_code) . "'"; - $sql .= ', tva_tx=' . price2num($txtva); - $sql .= ', localtax1_tx=' . (float) $txlocaltax1; - $sql .= ", localtax1_type='" . $this->db->escape($localtaxes_type[0]) . "'"; - $sql .= ', localtax2_tx=' . (float) $txlocaltax2; - $sql .= ", localtax2_type='" . $this->db->escape($localtaxes_type[2]) . "'"; - $sql .= ", total_ht='" . price2num($total_ht) . "'"; - $sql .= ", total_tva='" . price2num($total_tva) . "'"; - $sql .= ", total_localtax1='" . price2num($total_localtax1) . "'"; - $sql .= ", total_localtax2='" . price2num($total_localtax2) . "'"; - $sql .= ", total_ttc='" . price2num($total_ttc) . "'"; - $sql .= ', product_type=' . (int) $product_type; - $sql .= ', date_start=' . (empty($date_start) ? 'NULL' : (int) $date_start); - $sql .= ', date_end=' . (empty($date_end) ? 'NULL' : (int) $date_end); - $sql .= ', info_bits=' . (int) $info_bits; - $sql .= ', special_code=' . (int) $special_code; - $sql .= ', rang=' . (int) $rang; - $sql .= ', fk_unit=' . ($fk_unit ? "'" . $this->db->escape($fk_unit) . "'" : 'null'); - $sql .= ', fk_user_modif=' . (int) $user; + $sql .= ', pu_ht = ' . price2num($pu_ht); + $sql .= ', qty = ' . price2num($qty); + $sql .= ", remise_percent = '" . price2num($remise_percent) . "'"; + $sql .= ", vat_src_code = '" . $this->db->escape($vat_src_code) . "'"; + $sql .= ', tva_tx = ' . price2num($txtva); + $sql .= ', localtax1_tx = ' . (float) $txlocaltax1; + $sql .= ", localtax1_type = '" . $this->db->escape($localtaxes_type[0]) . "'"; + $sql .= ', localtax2_tx = ' . (float) $txlocaltax2; + $sql .= ", localtax2_type = '" . $this->db->escape($localtaxes_type[2]) . "'"; + $sql .= ", total_ht = '" . price2num($total_ht) . "'"; + $sql .= ", total_tva = '" . price2num($total_tva) . "'"; + $sql .= ", total_localtax1 = '" . price2num($total_localtax1) . "'"; + $sql .= ", total_localtax2 = '" . price2num($total_localtax2) . "'"; + $sql .= ", total_ttc = '" . price2num($total_ttc) . "'"; + $sql .= ', product_type = ' . (int) $product_type; + $sql .= ', date_start = ' . (empty($date_start) ? 'NULL' : (int) $date_start); + $sql .= ', date_end = ' . (empty($date_end) ? 'NULL' : (int) $date_end); + $sql .= ', info_bits = ' . (int) $info_bits; + $sql .= ', special_code = ' . (int) $special_code; + $sql .= ', rang = ' . (int) $rang; + $sql .= ', fk_unit = ' . ($fk_unit ? "'" . $this->db->escape($fk_unit) . "'" : 'null'); + $sql .= ', fk_user_modif = ' . (int) $user; $sql .= ', multicurrency_subprice = '.price2num($pu_ht_devise); $sql .= ', multicurrency_total_ht = '.price2num($multicurrency_total_ht); $sql .= ', multicurrency_total_tva = '.price2num($multicurrency_total_tva); From 046089f3716b55cfde7bcf6cce92e81b27072634 Mon Sep 17 00:00:00 2001 From: atm-florian Date: Tue, 5 Apr 2022 15:38:54 +0200 Subject: [PATCH 556/610] FIX 16.0 - ref_client set instead of ref_supplier (maybe copy-paste error) --- htdocs/fourn/facture/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 02e77d13f58..b1f2be177f6 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -903,7 +903,7 @@ if (empty($reshook)) { $object->date = $dateinvoice; $object->note_public = trim(GETPOST('note_public', 'restricthtml')); $object->note_private = trim(GETPOST('note_private', 'restricthtml')); - $object->ref_client = GETPOST('ref_client'); + $object->ref_supplier = GETPOST('ref_supplier', 'nohtml'); $object->model_pdf = GETPOST('model'); $object->fk_project = GETPOST('projectid', 'int'); $object->cond_reglement_id = (GETPOST('type') == 3 ? 1 : GETPOST('cond_reglement_id')); From d143b8bf6e4ee2eeb21c4b0152f4ad1123245d6d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 5 Apr 2022 17:19:12 +0200 Subject: [PATCH 557/610] Debug dol_uncompress and add phpunit tests --- htdocs/core/class/utils.class.php | 16 +++++++--- htdocs/core/lib/files.lib.php | 35 +++++++++++++++------- test/phpunit/FilesLibTest.php | 50 +++++++++++++++++++++++++++---- 3 files changed, 81 insertions(+), 20 deletions(-) diff --git a/htdocs/core/class/utils.class.php b/htdocs/core/class/utils.class.php index 4a4db439822..f3d46e09f30 100644 --- a/htdocs/core/class/utils.class.php +++ b/htdocs/core/class/utils.class.php @@ -651,12 +651,13 @@ class Utils * Warning: The command line is sanitize so can't contains any redirection char '>'. Use param $redirectionfile if you need it. * @param string $outputfile A path for an output file (used only when method is 2). For example: $conf->admin->dir_temp.'/out.tmp'; * @param int $execmethod 0=Use default method (that is 1 by default), 1=Use the PHP 'exec', 2=Use the 'popen' method - * @param string $redirectionfile If defined, a redirection of output to this files is added. + * @param string $redirectionfile If defined, a redirection of output to this file is added. * @param int $noescapecommand 1=Do not escape command. Warning: Using this parameter need you alreay sanitized the command. if not, it will lead to security vulnerability. * This parameter is provided for backward compatibility with external modules. Always use 0 in core. + * @param string $redirectionfileerr If defined, a redirection of error is added to this file instead of to channel 1. * @return array array('result'=>...,'output'=>...,'error'=>...). result = 0 means OK. */ - public function executeCLI($command, $outputfile, $execmethod = 0, $redirectionfile = null, $noescapecommand = 0) + public function executeCLI($command, $outputfile, $execmethod = 0, $redirectionfile = null, $noescapecommand = 0, $redirectionfileerr = null) { global $conf, $langs; @@ -667,10 +668,17 @@ class Utils if (empty($noescapecommand)) { $command = escapeshellcmd($command); } + if ($redirectionfile) { $command .= " > ".dol_sanitizePathName($redirectionfile); } - $command .= " 2>&1"; + + if ($redirectionfileerr && ($redirectionfileerr != $redirectionfile)) { + // If we ask a redirect of stderr on a given file not already used for stdout + $command .= " 2> ".dol_sanitizePathName($redirectionfileerr); + } else { + $command .= " 2>&1"; + } if (!empty($conf->global->MAIN_EXEC_USE_POPEN)) { $execmethod = $conf->global->MAIN_EXEC_USE_POPEN; @@ -679,7 +687,7 @@ class Utils $execmethod = 1; } //$execmethod=1; - dol_syslog("Utils::executeCLI execmethod=".$execmethod." system:".$command, LOG_DEBUG); + dol_syslog("Utils::executeCLI execmethod=".$execmethod." command=".$command, LOG_DEBUG); $output_arr = array(); if ($execmethod == 1) { diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 3bbef8b1b96..2cf0beb013f 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -2094,6 +2094,9 @@ function dol_uncompress($inputfile, $outputdir) include_once ODTPHP_PATHTOPCLZIP.'/pclzip.lib.php'; $archive = new PclZip($inputfile); + // We create output dir manually, so it uses the correct permission (When created by the archive->extract, dir is rwx for everybody). + dol_mkdir(dol_sanitizePathName($outputdir)); + // Extract into outputdir, but only files that match the regex '/^((?!\.\.).)*$/' that means "does not include .." $result = $archive->extract(PCLZIP_OPT_PATH, $outputdir, PCLZIP_OPT_BY_PREG, '/^((?!\.\.).)*$/'); @@ -2150,10 +2153,19 @@ function dol_uncompress($inputfile, $outputdir) include_once DOL_DOCUMENT_ROOT."/core/class/utils.class.php"; $utils = new Utils($db); + dol_mkdir(dol_sanitizePathName($outputdir)); + $outputfilename = escapeshellcmd(dol_sanitizePathName($outputdir).'/'.dol_sanitizeFileName($fileinfo["filename"])); + dol_delete_file($outputfilename.'.tmp'); + dol_delete_file($outputfilename.'.err'); + $extension = strtolower(pathinfo($fileinfo["filename"], PATHINFO_EXTENSION)); if ($extension == "tar") { $cmd = 'tar -C '.escapeshellcmd(dol_sanitizePathName($outputdir)).' -xvf '.escapeshellcmd(dol_sanitizePathName($fileinfo["dirname"]).'/'.dol_sanitizeFileName($fileinfo["basename"])); - $resarray = $utils->executeCLI($cmd, $outputdir); + + $resarray = $utils->executeCLI($cmd, $outputfilename.'.tmp', 0, $outputfilename.'.err', 0); + if ($resarray["result"] != 0) { + $resarray["error"] .= file_get_contents($outputfilename.'.err'); + } } else { $program = ""; if ($fileinfo["extension"] == "gz") { @@ -2163,22 +2175,23 @@ function dol_uncompress($inputfile, $outputdir) } elseif ($fileinfo["extension"] == "zst") { $program = 'zstd'; } else { - return array('error'=>'ErrFileExtension'); + return array('error'=>'ErrorBadFileExtension'); } $cmd = $program.' -dc '.escapeshellcmd(dol_sanitizePathName($fileinfo["dirname"]).'/'.dol_sanitizeFileName($fileinfo["basename"])); - $outputfilename = escapeshellcmd(dol_sanitizePathName($outputdir).'/'.dol_sanitizeFileName($fileinfo["filename"])); - $resarray = $utils->executeCLI($cmd, $outputfilename, 0, $outputfilename); - if ($resarray["output"] == 2) { - $resarray["error"] = "ErrFilePermOrFileNotFound"; - } - if ($resarray["output"] == 1) { - $resarray["error"] = "Error"; + $cmd .= ' > '.$outputfilename; + + $resarray = $utils->executeCLI($cmd, $outputfilename.'.tmp', 0, null, 1, $outputfilename.'.err'); + if ($resarray["result"] != 0) { + $errfilecontent = @file_get_contents($outputfilename.'.err'); + if ($errfilecontent) { + $resarray["error"] .= " - ".$errfilecontent; + } } } - return $resarray["output"] != 0 ? $resarray["error"] : array(); + return $resarray["result"] != 0 ? array('error' => $resarray["error"]) : array(); } - return array('error'=>'ErrFileExtension'); + return array('error'=>'ErrorBadFileExtension'); } diff --git a/test/phpunit/FilesLibTest.php b/test/phpunit/FilesLibTest.php index b98237d1b29..48a00c8214d 100644 --- a/test/phpunit/FilesLibTest.php +++ b/test/phpunit/FilesLibTest.php @@ -401,10 +401,14 @@ class FilesLibTest extends PHPUnit\Framework\TestCase $langs=$this->savlangs; $db=$this->savdb; + // Format zip + print "\n"; + print 'testDolCompressUnCompress zip'."\n"; + $format='zip'; $filein=dirname(__FILE__).'/Example_import_company_1.csv'; $fileout=$conf->admin->dir_temp.'/test.'.$format; - $dirout=$conf->admin->dir_temp.'/test'; + $dirout=$conf->admin->dir_temp.'/testdir'.$format; dol_delete_file($fileout); $count=0; @@ -417,18 +421,50 @@ class FilesLibTest extends PHPUnit\Framework\TestCase $conf->logbuffer=array(); $result=dol_compress_file($filein, $fileout, $format, $errorstring); - print __METHOD__." result=".$result."\n"; + print __METHOD__." compress result=".$result."\n"; print join(', ', $conf->logbuffer); $this->assertGreaterThanOrEqual(1, $result, "Pb with dol_compress_file on ".$filein." into ".$fileout." : ".$errorstring); $result=dol_uncompress($fileout, $dirout); - print __METHOD__." result=".join(',', $result)."\n"; + print __METHOD__." uncompress result=".join(',', $result)."\n"; $this->assertEquals(0, count($result), "Pb with dol_uncompress_file of file ".$fileout); + // Format gz + print "\n"; + print 'testDolCompressUnCompress gz'."\n"; + + $format='gz'; + $filein=dirname(__FILE__).'/Example_import_company_1.csv'; + $fileout=$conf->admin->dir_temp.'/test.'.$format; + $dirout=$conf->admin->dir_temp.'/testdir'.$format; + + dol_delete_file($fileout); + $count=0; + dol_delete_dir_recursive($dirout, $count, 1); + + $errorstring = ''; + + dol_mkdir($conf->admin->dir_temp); + $conf->global->MAIN_ENABLE_LOG_TO_HTML=1; $conf->syslog->enabled=1; $_REQUEST['logtohtml']=1; + $conf->logbuffer=array(); + + $result=dol_compress_file($filein, $fileout, $format, $errorstring); + print __METHOD__." compress result=".$result."\n"; + print join(', ', $conf->logbuffer); + $this->assertGreaterThanOrEqual(1, $result, "Pb with dol_compress_file on ".$filein." into ".$fileout." : ".$errorstring); + + $result=dol_uncompress($fileout, $dirout); + print __METHOD__." uncompress result=".join(',', $result)."\n"; + print join(', ', $conf->logbuffer); + $this->assertEquals(0, count($result), "Pb with dol_uncompress_file of file ".$fileout); + + + // Test compression of a directory + // $dirout is $conf->admin->dir_temp.'/testdirgz' $excludefiles = '/(\.back|\.old|\.log|documents[\/\\\]admin[\/\\\]documents[\/\\\])/i'; if (preg_match($excludefiles, 'a/temp/b')) { echo '----- Regex OK -----'."\n"; } - $result=dol_compress_dir($dirout, $conf->admin->dir_temp.'/testdir.zip', 'zip', $excludefiles); - print __METHOD__." result=".$result."\n"; + $result=dol_compress_dir($dirout, $conf->admin->dir_temp.'/testcompressdirzip.zip', 'zip', $excludefiles); + print __METHOD__." dol_compress_dir result=".$result."\n"; print join(', ', $conf->logbuffer); $this->assertGreaterThanOrEqual(1, $result, "Pb with dol_compress_dir of ".$dirout." into ".$conf->admin->dir_temp.'/testdir.zip'); } @@ -466,6 +502,10 @@ class FilesLibTest extends PHPUnit\Framework\TestCase $db=$this->savdb; + if (empty($user->rights->facture)) { + $user->rights->facture = new stdClass(); + } + //$dummyuser=new User($db); //$result=restrictedArea($dummyuser,'societe'); From 216b4b7309a601b4db04628a6b0ebc43f3152bf0 Mon Sep 17 00:00:00 2001 From: atm-florian Date: Tue, 5 Apr 2022 17:30:36 +0200 Subject: [PATCH 558/610] 16.0 - deprecate `amount` field of FactureFournisseur and FactureFournisseurRec --- htdocs/fourn/class/fournisseur.facture-rec.class.php | 5 +++++ htdocs/fourn/class/fournisseur.facture.class.php | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/htdocs/fourn/class/fournisseur.facture-rec.class.php b/htdocs/fourn/class/fournisseur.facture-rec.class.php index fea334e43cf..7d90c239ba7 100644 --- a/htdocs/fourn/class/fournisseur.facture-rec.class.php +++ b/htdocs/fourn/class/fournisseur.facture-rec.class.php @@ -79,6 +79,11 @@ class FactureFournisseurRec extends CommonInvoice public $suspended; public $libelle; + + /** + * @deprecated + * @var double $amount + */ public $amount; public $remise; public $vat_src_code; diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 24561e08785..b90fbbbd86a 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -181,6 +181,10 @@ class FactureFournisseur extends CommonInvoice */ public $date_echeance; + /** + * @deprecated + * @var double $amount + */ public $amount = 0; public $remise = 0; From bb30a1c8c6883033cfe6e489843a6237df324eb6 Mon Sep 17 00:00:00 2001 From: atm-florian Date: Tue, 5 Apr 2022 17:31:04 +0200 Subject: [PATCH 559/610] FIX 16.0 SQL error on update --- htdocs/fourn/class/fournisseur.facture.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index b90fbbbd86a..b602c27af57 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -1262,7 +1262,7 @@ class FactureFournisseur extends CommonInvoice } $sql .= " libelle=".(isset($this->label) ? "'".$this->db->escape($this->label)."'" : "null").","; $sql .= " paye=".(isset($this->paye) ? $this->paye : "null").","; - $sql .= " amount=".(isset($this->amount) ? $this->amount : "null").","; + $sql .= " amount=".(isset($this->amount) ? doubleval($this->amount) : "null").","; $sql .= " remise=".(isset($this->remise) ? $this->remise : "null").","; $sql .= " close_code=".(isset($this->close_code) ? "'".$this->db->escape($this->close_code)."'" : "null").","; $sql .= " close_note=".(isset($this->close_note) ? "'".$this->db->escape($this->close_note)."'" : "null").","; @@ -1276,7 +1276,7 @@ class FactureFournisseur extends CommonInvoice $sql .= " fk_user_author=".(isset($this->author) ? $this->author : "null").","; $sql .= " fk_user_valid=".(isset($this->fk_user_valid) ? $this->fk_user_valid : "null").","; $sql .= " fk_facture_source=".(isset($this->fk_facture_source) ? $this->fk_facture_source : "null").","; - $sql .= " fk_projet=".(isset($this->fk_project) ? $this->fk_project : "null").","; + $sql .= " fk_projet=".(isset($this->fk_project) ? intval($this->fk_project) : "null").","; $sql .= " fk_cond_reglement=".(isset($this->cond_reglement_id) ? $this->cond_reglement_id : "null").","; $sql .= " date_lim_reglement=".(dol_strlen($this->date_echeance) != 0 ? "'".$this->db->idate($this->date_echeance)."'" : 'null').","; $sql .= " note_private=".(isset($this->note_private) ? "'".$this->db->escape($this->note_private)."'" : "null").","; From c7d5ecd4f7f7cd1d37ca33fbfc4a21938f476cc9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 5 Apr 2022 17:39:56 +0200 Subject: [PATCH 560/610] Renamed hidden option INVOICE_CAN_ALWAYS_BE_EDITED into INVOICE_CAN_BE_EDITED_EVEN_IF_PAYMENT_DONE for better understanding. --- htdocs/compta/facture/card.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 0802a4c9bb8..102e0cf7f4a 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -737,7 +737,7 @@ if (empty($reshook)) { // On verifie si aucun paiement n'a ete effectue if ($ventilExportCompta == 0) { - if (!empty($conf->global->INVOICE_CAN_ALWAYS_BE_EDITED) || ($resteapayer == $object->total_ttc && empty($object->paye))) { + if (!empty($conf->global->INVOICE_CAN_BE_EDITED_EVEN_IF_PAYMENT_DONE) || ($resteapayer == $object->total_ttc && empty($object->paye))) { $result = $object->setDraft($user, $idwarehouse); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); @@ -5340,13 +5340,13 @@ if ($action == 'create') { $ventilExportCompta = $object->getVentilExportCompta(); if ($ventilExportCompta == 0) { - if (!empty($conf->global->INVOICE_CAN_ALWAYS_BE_EDITED) || ($resteapayer == price2num($object->total_ttc, 'MT', 1) && empty($object->paye))) { + if (!empty($conf->global->INVOICE_CAN_BE_EDITED_EVEN_IF_PAYMENT_DONE) || ($resteapayer == price2num($object->total_ttc, 'MT', 1) && empty($object->paye))) { if (!$objectidnext && $object->is_last_in_cycle()) { if ($usercanunvalidate) { - print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=modif', '', true, $params); + print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=modif&token='.newToken(), '', true, $params); } else { $params['attr']['title'] = $langs->trans('NotEnoughPermissions'); - print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=modif', '', false, $params); + print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=modif&token='.newToken(), '', false, $params); } } elseif (!$object->is_last_in_cycle()) { $params['attr']['title'] = $langs->trans('NotLastInCycle'); From a8a83b30dc709df50e9b5e3641d2924af4339fd5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 5 Apr 2022 18:17:45 +0200 Subject: [PATCH 561/610] FIX Can't edit bank record --- htdocs/compta/bank/card.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index f8cc88e1be4..61614b211bd 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -65,7 +65,8 @@ $hookmanager->initHooks(array('bankcard', 'globalcard')); // Security check $id = GETPOST("id", 'int') ? GETPOST("id", 'int') : GETPOST('ref', 'alpha'); -$fieldid = GETPOSTISSET("ref") ? 'ref' : 'rowid'; +$fieldid = GETPOST("id") ? 'rowid' : 'ref'; + $result = restrictedArea($user, 'banque', $id, 'bank_account&bank_account', '', '', $fieldid); From 8a9e8cd36b710034b98cd179c0c401d328c26482 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 5 Apr 2022 18:17:49 +0200 Subject: [PATCH 562/610] css --- htdocs/theme/md/style.css.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 04a3c948a80..f2fee83c291 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -119,7 +119,7 @@ $dol_no_mouse_hover = $conf->dol_no_mouse_hover; $useboldtitle = (isset($conf->global->THEME_ELDY_USEBOLDTITLE) ? $conf->global->THEME_ELDY_USEBOLDTITLE : 0); $borderwidth = 2; -$userborderontable = getDolGlobalInt('THEME_ELDY_USEBORDERONTABLE');; +$userborderontable = getDolGlobalInt('THEME_ELDY_USEBORDERONTABLE'); // Case of option always editable if (!isset($conf->global->THEME_ELDY_BACKBODY)) { @@ -3677,8 +3677,8 @@ div.colorback } .liste_titre_bydiv { - border-right: 1px solid var(--colortopbordertitle1); - border-left: 1px solid var(--colortopbordertitle1); + border-right: 1px solid #ccc; + border-left: 1px solid #ccc; } table.liste, table.noborder, table.formdoc, div.noborder { @@ -3692,13 +3692,13 @@ table.liste, table.noborder, table.formdoc, div.noborder { border-top-style: solid; border-bottom-width: 1px; - border-bottom-color: var(--colortopbordertitle1); + border-bottom-color: #BBB; border-bottom-style: solid; - border-right: 1px solid var(--colortopbordertitle1); - border-left: 1px solid var(--colortopbordertitle1); + border-right: 1px solid #ccc; + border-left: 1px solid #ccc; margin: 0px 0px 20px 0px; @@ -4094,15 +4094,15 @@ div.liste_titre { padding-bottom: 2px; /*border-right-width: 1px; - border-right-color: var(--colortopbordertitle1); + border-right-color: #BBB; border-right-style: solid; border-left-width: 1px; - border-left-color: var(--colortopbordertitle1); + border-left-color: #BBB; border-left-style: solid;*/ border-top-width: 1px; - border-top-color: var(--colortopbordertitle1); + border-top-color: #BBB; border-top-style: solid; } div.liste_titre_bydiv { From 91909928d4ca5c73038f1146c66ce1e89ce1d608 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 5 Apr 2022 18:19:06 +0200 Subject: [PATCH 563/610] FIX Can't edit bank record --- htdocs/compta/bank/card.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index 8430d9e7440..283258a08a0 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -65,7 +65,8 @@ $hookmanager->initHooks(array('bankcard', 'globalcard')); // Security check $id = GETPOST("id", 'int') ? GETPOST("id", 'int') : GETPOST('ref', 'alpha'); -$fieldid = GETPOSTISSET("ref") ? 'ref' : 'rowid'; +$fieldid = GETPOST("id", 'int') ? 'rowid' : 'ref'; + $result = restrictedArea($user, 'banque', $id, 'bank_account&bank_account', '', '', $fieldid); From 7896baa6c98ddcdac2a6f122583a11c619647125 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 5 Apr 2022 18:20:45 +0200 Subject: [PATCH 564/610] css --- htdocs/compta/bank/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index 61614b211bd..b0444b90dcc 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -725,7 +725,7 @@ if ($action == 'create') { print '
'; if ($object->type == Account::TYPE_SAVINGS || $object->type == Account::TYPE_CURRENT) { - print '
'; + //print '
'; print ''; From 3eabb52176e76f1180a02b9712f3e8a9fc2042ce Mon Sep 17 00:00:00 2001 From: "goup2cloud.com" Date: Tue, 5 Apr 2022 18:21:28 +0200 Subject: [PATCH 565/610] Changed --- htdocs/contrat/services_list.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/contrat/services_list.php b/htdocs/contrat/services_list.php index 39dfe336a31..adf7a4b6ed7 100644 --- a/htdocs/contrat/services_list.php +++ b/htdocs/contrat/services_list.php @@ -326,25 +326,25 @@ if (!empty($filter_opouvertureprevue) && $filter_opouvertureprevue != -1 && $fil $sql .= " AND cd.date_ouverture_prevue ".$filter_opouvertureprevue." '".$db->idate($filter_dateouvertureprevue_start)."'"; } if (!empty($filter_opouvertureprevue) && $filter_opouvertureprevue == ' BETWEEN ') { - $sql .= " AND '".$db->idate($filter_dateouvertureprevue_end)."'"; + $sql .= " AND cd.date_ouverture_prevue ".$filter_opouvertureprevue." '".$db->idate($filter_dateouvertureprevue_start)."' AND '".$db->idate($filter_dateouvertureprevue_end)."'"; } if (!empty($filter_op1) && $filter_op1 != -1 && $filter_op1 != ' BETWEEN ' && $filter_date1_start != '') { $sql .= " AND cd.date_ouverture ".$filter_op1." '".$db->idate($filter_date1_start)."'"; } if (!empty($filter_op1) && $filter_op1 == ' BETWEEN ') { - $sql .= " AND '".$db->idate($filter_date1_end)."'"; + $sql .= " AND cd.date_ouverture ".$filter_op1." '".$db->idate($filter_date1_start)."' AND '".$db->idate($filter_date1_end)."'"; } if (!empty($filter_op2) && $filter_op2 != -1 && $filter_op2 != ' BETWEEN ' && $filter_date2_start != '') { $sql .= " AND cd.date_fin_validite ".$filter_op2." '".$db->idate($filter_date2_start)."'"; } if (!empty($filter_op2) && $filter_op2 == ' BETWEEN ') { - $sql .= " AND '".$db->idate($filter_date2_end)."'"; + $sql .= " AND cd.date_fin_validite ".$filter_op2." '".$db->idate($filter_date2_start)."' AND '".$db->idate($filter_date2_end)."'"; } if (!empty($filter_opcloture) && $filter_opcloture != ' BETWEEN ' && $filter_opcloture != -1 && $filter_datecloture_start != '') { $sql .= " AND cd.date_cloture ".$filter_opcloture." '".$db->idate($filter_datecloture_start)."'"; } if (!empty($filter_opcloture) && $filter_opcloture == ' BETWEEN ') { - $sql .= " AND '".$db->idate($filter_datecloture_end)."'"; + $sql .= " AND cd.date_cloture ".$filter_opcloture." '".$db->idate($filter_datecloture_start)."' AND '".$db->idate($filter_datecloture_end)."'"; } // Add where from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; From d213be235eef7917902898f45da6e6b04e16d1c7 Mon Sep 17 00:00:00 2001 From: atm-florian Date: Tue, 5 Apr 2022 18:32:29 +0200 Subject: [PATCH 566/610] Cleaner way of fixing the SQL error on update --- htdocs/fourn/class/fournisseur.facture.class.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index b602c27af57..176f79a51de 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -1178,7 +1178,8 @@ class FactureFournisseur extends CommonInvoice $this->paye = trim($this->paye); } if (isset($this->amount)) { - $this->amount = trim($this->amount); + if (empty($this->amount)) $this->amount = 0; + else $this->amount = doubleval($this->amount); } if (isset($this->remise)) { $this->remise = trim($this->remise); @@ -1225,7 +1226,8 @@ class FactureFournisseur extends CommonInvoice $this->fk_facture_source = trim($this->fk_facture_source); } if (isset($this->fk_project)) { - $this->fk_project = trim($this->fk_project); + if (empty($this->fk_project)) $this->fk_project = null; + else $this->fk_project = intval($this->fk_project); } if (isset($this->cond_reglement_id)) { $this->cond_reglement_id = trim($this->cond_reglement_id); @@ -1262,7 +1264,7 @@ class FactureFournisseur extends CommonInvoice } $sql .= " libelle=".(isset($this->label) ? "'".$this->db->escape($this->label)."'" : "null").","; $sql .= " paye=".(isset($this->paye) ? $this->paye : "null").","; - $sql .= " amount=".(isset($this->amount) ? doubleval($this->amount) : "null").","; + $sql .= " amount=".(isset($this->amount) ? $this->amount : "null").","; $sql .= " remise=".(isset($this->remise) ? $this->remise : "null").","; $sql .= " close_code=".(isset($this->close_code) ? "'".$this->db->escape($this->close_code)."'" : "null").","; $sql .= " close_note=".(isset($this->close_note) ? "'".$this->db->escape($this->close_note)."'" : "null").","; @@ -1276,7 +1278,7 @@ class FactureFournisseur extends CommonInvoice $sql .= " fk_user_author=".(isset($this->author) ? $this->author : "null").","; $sql .= " fk_user_valid=".(isset($this->fk_user_valid) ? $this->fk_user_valid : "null").","; $sql .= " fk_facture_source=".(isset($this->fk_facture_source) ? $this->fk_facture_source : "null").","; - $sql .= " fk_projet=".(isset($this->fk_project) ? intval($this->fk_project) : "null").","; + $sql .= " fk_projet=".(isset($this->fk_project) ? $this->fk_project : "null").","; $sql .= " fk_cond_reglement=".(isset($this->cond_reglement_id) ? $this->cond_reglement_id : "null").","; $sql .= " date_lim_reglement=".(dol_strlen($this->date_echeance) != 0 ? "'".$this->db->idate($this->date_echeance)."'" : 'null').","; $sql .= " note_private=".(isset($this->note_private) ? "'".$this->db->escape($this->note_private)."'" : "null").","; From f9c9e518c356e60e316c2bf524143289f896bdb8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 5 Apr 2022 19:14:00 +0200 Subject: [PATCH 567/610] Load tables for opensurvey only when module opensurvey is enabled --- htdocs/core/modules/modOpenSurvey.class.php | 7 +++++++ ....key.sql => llx_opensurvey_comments-opensurvey.key.sql} | 0 ...comments.sql => llx_opensurvey_comments-opensurvey.sql} | 0 ...ons.sql => llx_opensurvey_formquestions-opensurvey.sql} | 0 ...e.key.sql => llx_opensurvey_sondage-opensurvey.key.sql} | 0 ...y_sondage.sql => llx_opensurvey_sondage-opensurvey.sql} | 0 ....sql => llx_opensurvey_user_formanswers-opensurvey.sql} | 0 ...ey.sql => llx_opensurvey_user_studs-opensurvey.key.sql} | 0 ..._studs.sql => llx_opensurvey_user_studs-opensurvey.sql} | 0 9 files changed, 7 insertions(+) rename htdocs/install/mysql/tables/{llx_opensurvey_comments.key.sql => llx_opensurvey_comments-opensurvey.key.sql} (100%) rename htdocs/install/mysql/tables/{llx_opensurvey_comments.sql => llx_opensurvey_comments-opensurvey.sql} (100%) rename htdocs/install/mysql/tables/{llx_opensurvey_formquestions.sql => llx_opensurvey_formquestions-opensurvey.sql} (100%) rename htdocs/install/mysql/tables/{llx_opensurvey_sondage.key.sql => llx_opensurvey_sondage-opensurvey.key.sql} (100%) rename htdocs/install/mysql/tables/{llx_opensurvey_sondage.sql => llx_opensurvey_sondage-opensurvey.sql} (100%) rename htdocs/install/mysql/tables/{llx_opensurvey_user_formanswers.sql => llx_opensurvey_user_formanswers-opensurvey.sql} (100%) rename htdocs/install/mysql/tables/{llx_opensurvey_user_studs.key.sql => llx_opensurvey_user_studs-opensurvey.key.sql} (100%) rename htdocs/install/mysql/tables/{llx_opensurvey_user_studs.sql => llx_opensurvey_user_studs-opensurvey.sql} (100%) diff --git a/htdocs/core/modules/modOpenSurvey.class.php b/htdocs/core/modules/modOpenSurvey.class.php index 87a4f453801..9cc9310cd19 100644 --- a/htdocs/core/modules/modOpenSurvey.class.php +++ b/htdocs/core/modules/modOpenSurvey.class.php @@ -182,6 +182,13 @@ class modOpenSurvey extends DolibarrModules */ public function init($options = '') { + global $conf, $langs; + + $result = $this->_load_tables('/install/mysql/tables/', 'opensurvey'); + if ($result < 0) { + return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default') + } + // Permissions $this->remove($options); diff --git a/htdocs/install/mysql/tables/llx_opensurvey_comments.key.sql b/htdocs/install/mysql/tables/llx_opensurvey_comments-opensurvey.key.sql similarity index 100% rename from htdocs/install/mysql/tables/llx_opensurvey_comments.key.sql rename to htdocs/install/mysql/tables/llx_opensurvey_comments-opensurvey.key.sql diff --git a/htdocs/install/mysql/tables/llx_opensurvey_comments.sql b/htdocs/install/mysql/tables/llx_opensurvey_comments-opensurvey.sql similarity index 100% rename from htdocs/install/mysql/tables/llx_opensurvey_comments.sql rename to htdocs/install/mysql/tables/llx_opensurvey_comments-opensurvey.sql diff --git a/htdocs/install/mysql/tables/llx_opensurvey_formquestions.sql b/htdocs/install/mysql/tables/llx_opensurvey_formquestions-opensurvey.sql similarity index 100% rename from htdocs/install/mysql/tables/llx_opensurvey_formquestions.sql rename to htdocs/install/mysql/tables/llx_opensurvey_formquestions-opensurvey.sql diff --git a/htdocs/install/mysql/tables/llx_opensurvey_sondage.key.sql b/htdocs/install/mysql/tables/llx_opensurvey_sondage-opensurvey.key.sql similarity index 100% rename from htdocs/install/mysql/tables/llx_opensurvey_sondage.key.sql rename to htdocs/install/mysql/tables/llx_opensurvey_sondage-opensurvey.key.sql diff --git a/htdocs/install/mysql/tables/llx_opensurvey_sondage.sql b/htdocs/install/mysql/tables/llx_opensurvey_sondage-opensurvey.sql similarity index 100% rename from htdocs/install/mysql/tables/llx_opensurvey_sondage.sql rename to htdocs/install/mysql/tables/llx_opensurvey_sondage-opensurvey.sql diff --git a/htdocs/install/mysql/tables/llx_opensurvey_user_formanswers.sql b/htdocs/install/mysql/tables/llx_opensurvey_user_formanswers-opensurvey.sql similarity index 100% rename from htdocs/install/mysql/tables/llx_opensurvey_user_formanswers.sql rename to htdocs/install/mysql/tables/llx_opensurvey_user_formanswers-opensurvey.sql diff --git a/htdocs/install/mysql/tables/llx_opensurvey_user_studs.key.sql b/htdocs/install/mysql/tables/llx_opensurvey_user_studs-opensurvey.key.sql similarity index 100% rename from htdocs/install/mysql/tables/llx_opensurvey_user_studs.key.sql rename to htdocs/install/mysql/tables/llx_opensurvey_user_studs-opensurvey.key.sql diff --git a/htdocs/install/mysql/tables/llx_opensurvey_user_studs.sql b/htdocs/install/mysql/tables/llx_opensurvey_user_studs-opensurvey.sql similarity index 100% rename from htdocs/install/mysql/tables/llx_opensurvey_user_studs.sql rename to htdocs/install/mysql/tables/llx_opensurvey_user_studs-opensurvey.sql From 946061af384798cdcb9df2633f70934447ca3ae2 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Tue, 5 Apr 2022 20:21:48 +0200 Subject: [PATCH 568/610] Update README.md --- htdocs/datapolicy/README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/datapolicy/README.md b/htdocs/datapolicy/README.md index e2bde95a6d8..0d70b287a81 100644 --- a/htdocs/datapolicy/README.md +++ b/htdocs/datapolicy/README.md @@ -1,5 +1,7 @@ DataPolicy ========== + This module provides features to be compliant with data privacy rules of your country. -A schedlued job is installed to automatically clean old record in your database. You defined what to delete and when in the setup of module. \ No newline at end of file +A scheduled job is installed to automatically delete old records in your database. +In the setup of the module you define what should be deleted and when. From 32f601a48b6707afd7e6a0726da8835c57a17444 Mon Sep 17 00:00:00 2001 From: jpb Date: Wed, 6 Apr 2022 09:15:53 +0200 Subject: [PATCH 569/610] rename css class name --- htdocs/admin/expensereport_rules.php | 30 ++++++++++++++-------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/htdocs/admin/expensereport_rules.php b/htdocs/admin/expensereport_rules.php index 9204e72f049..1146232dca3 100644 --- a/htdocs/admin/expensereport_rules.php +++ b/htdocs/admin/expensereport_rules.php @@ -185,14 +185,14 @@ if ($action != 'edit') { echo '
'; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; echo ''; echo ''; @@ -227,14 +227,14 @@ if ($action == 'edit') { echo '
' . $langs->trans('ExpenseReportApplyTo') . '' . $langs->trans('Type') . '' . $langs->trans('ExpenseReportLimitOn') . '' . $langs->trans('ExpenseReportDateStart') . '' . $langs->trans('ExpenseReportDateEnd') . '' . $langs->trans('ExpenseReportLimitAmount') . '' . $langs->trans('ExpenseReportRestrictive') . '
' . $langs->trans('ExpenseReportApplyTo') . '' . $langs->trans('Type') . '' . $langs->trans('ExpenseReportLimitOn') . '' . $langs->trans('ExpenseReportDateStart') . '' . $langs->trans('ExpenseReportDateEnd') . '' . $langs->trans('ExpenseReportLimitAmount') . '' . $langs->trans('ExpenseReportRestrictive') . ' 
'; - echo ''; + echo ''; echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; echo ''; echo ''; From a0cb04bafc1651e24b4ff763857460fb04045b7a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 6 Apr 2022 11:21:46 +0200 Subject: [PATCH 570/610] Fix css --- htdocs/core/boxes/box_birthdays.php | 6 +++--- htdocs/core/boxes/box_birthdays_members.php | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/core/boxes/box_birthdays.php b/htdocs/core/boxes/box_birthdays.php index 62cfaa590ab..41e51eee45e 100644 --- a/htdocs/core/boxes/box_birthdays.php +++ b/htdocs/core/boxes/box_birthdays.php @@ -131,7 +131,7 @@ class box_birthdays extends ModeleBoxes } if ($num == 0) { - $this->info_box_contents[$line][0] = array('td' => 'class="center opacitymedium"', 'text'=>$langs->trans("None")); + $this->info_box_contents[$line][0] = array('td' => 'class="center"', 'text' => ''.$langs->trans("None").''); } $this->db->free($result); @@ -144,8 +144,8 @@ class box_birthdays extends ModeleBoxes } } else { $this->info_box_contents[0][0] = array( - 'td' => 'class="nohover opacitymedium left"', - 'text' => $langs->trans("ReadPermissionNotAllowed") + 'td' => 'class="nohover left"', + 'text' => ''.$langs->trans("ReadPermissionNotAllowed").'' ); } } diff --git a/htdocs/core/boxes/box_birthdays_members.php b/htdocs/core/boxes/box_birthdays_members.php index 5e772ff3593..6138664db2d 100644 --- a/htdocs/core/boxes/box_birthdays_members.php +++ b/htdocs/core/boxes/box_birthdays_members.php @@ -128,7 +128,7 @@ class box_birthdays_members extends ModeleBoxes } if ($num == 0) { - $this->info_box_contents[$line][0] = array('td' => 'class="center opacitymedium"', 'text'=>$langs->trans("None")); + $this->info_box_contents[$line][0] = array('td' => 'class="center"', 'text' => ''.$langs->trans("None").''); } $this->db->free($result); @@ -141,8 +141,8 @@ class box_birthdays_members extends ModeleBoxes } } else { $this->info_box_contents[0][0] = array( - 'td' => 'class="nohover opacitymedium left"', - 'text' => $langs->trans("ReadPermissionNotAllowed") + 'td' => 'class="nohover left"', + 'text' => ''.$langs->trans("ReadPermissionNotAllowed").'' ); } } From c3ae63f587f76670c113746f0d2f1e62b129548a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 6 Apr 2022 11:34:49 +0200 Subject: [PATCH 571/610] FIX out of memory when more than 100 000 invoices. --- htdocs/compta/facture/list.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index ccf3c2f3f0c..f2cc5943e7a 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -757,12 +757,28 @@ $sql .= ' f.rowid DESC '; $nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { + /* This old and fast method to get and count full list returns all record so use a high amount of memory. $result = $db->query($sql); $nbtotalofrecords = $db->num_rows($result); - if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0 + */ + /* The fast and low memory method to get and count full list converts the sql into a sql count */ + if ($sall || $search_product_category > 0 || $search_user > 0) { + $sqlforcount = preg_replace('/^SELECT[a-zA-Z0-9\._\s\(\),=<>\:\-\']+\sFROM/', 'SELECT COUNT(DISTINCT f.rowid) as nbtotalofrecords FROM', $sql); + } else { + $sqlforcount = preg_replace('/^SELECT[a-zA-Z0-9\._\s\(\),=<>\:\-\']+\sFROM/', 'SELECT COUNT(f.rowid) as nbtotalofrecords FROM', $sql); + $sqlforcount = preg_replace('/LEFT JOIN '.MAIN_DB_PREFIX.'paiement_facture as pf ON pf.fk_facture = f.rowid/', '', $sqlforcount); + } + $sqlforcount = preg_replace('/GROUP BY.*$/', '', $sqlforcount); + + $resql = $db->query($sqlforcount); + $objforcount = $db->fetch_object($resql); + $nbtotalofrecords = $objforcount->nbtotalofrecords; + + if (($page * $limit) > $nbtotalofrecords) { // if total of record found is smaller than page * limit, goto and load page 0 $page = 0; $offset = 0; } + $db->free($resql); } $sql .= $db->plimit($limit + 1, $offset); From 370965a0bbd7feba44c60f8ea3509f5813184e7a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 6 Apr 2022 13:29:52 +0200 Subject: [PATCH 572/610] Rename build_path_from_id_categ into buildPathFromId and set it private --- ChangeLog | 1 + htdocs/categories/class/categorie.class.php | 14 ++++++-------- htdocs/ecm/class/ecmdirectory.class.php | 18 ++++++++---------- 3 files changed, 15 insertions(+), 18 deletions(-) diff --git a/ChangeLog b/ChangeLog index 36c645dfef0..880406bb189 100644 --- a/ChangeLog +++ b/ChangeLog @@ -32,6 +32,7 @@ Following changes may create regressions for some external modules, but were nec * verifCond('stringtoevaluate') now return false when string contains a bad syntax content instead of true. * The deprecated method thirdparty_doc_create() has been removed. You can use the generateDocument() instead. * All triggers with a name XXX_UPDATE have been rename with name XXX_MODIFY for code consistency purpose. +* Rename build_path_from_id_categ() into buildPathFromId() and set method to private ***** ChangeLog for 15.0.1 compared to 15.0.0 ***** diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index a3d2dc3e57f..434b994ccd2 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -1141,10 +1141,10 @@ class Categorie extends CommonObject } // We add the fullpath property to each elements of first level (no parent exists) - dol_syslog(get_class($this)."::get_full_arbo call to build_path_from_id_categ", LOG_DEBUG); + dol_syslog(get_class($this)."::get_full_arbo call to buildPathFromId", LOG_DEBUG); foreach ($this->cats as $key => $val) { //print 'key='.$key.'
'."\n"; - $this->build_path_from_id_categ($key, 0); // Process a branch from the root category key (this category has no parent) + $this->buildPathFromId($key, 0); // Process a branch from the root category key (this category has no parent) } // Include or exclude leaf including $markafterid from tree @@ -1174,7 +1174,6 @@ class Categorie extends CommonObject return $this->cats; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * For category id_categ and its childs available in this->cats, define property fullpath and fulllabel. * It is called by get_full_arbo() @@ -1185,19 +1184,18 @@ class Categorie extends CommonObject * @return void * @see get_full_arbo() */ - public function build_path_from_id_categ($id_categ, $protection = 1000) + private function buildPathFromId($id_categ, $protection = 1000) { - // phpcs:enable - dol_syslog(get_class($this)."::build_path_from_id_categ id_categ=".$id_categ." protection=".$protection, LOG_DEBUG); + //dol_syslog(get_class($this)."::buildPathFromId id_categ=".$id_categ." protection=".$protection, LOG_DEBUG); if (!empty($this->cats[$id_categ]['fullpath'])) { // Already defined - dol_syslog(get_class($this)."::build_path_from_id_categ fullpath and fulllabel already defined", LOG_WARNING); + dol_syslog(get_class($this)."::buildPathFromId fullpath and fulllabel already defined", LOG_WARNING); return; } // First build full array $motherof - //$this->load_motherof(); // Disabled because already done by caller of build_path_from_id_categ + //$this->load_motherof(); // Disabled because already done by caller of buildPathFromId // $this->cats[$id_categ] is supposed to be already an array. We just want to complete it with property fullpath and fulllabel diff --git a/htdocs/ecm/class/ecmdirectory.class.php b/htdocs/ecm/class/ecmdirectory.class.php index f99a567a314..fb9b2a35dd0 100644 --- a/htdocs/ecm/class/ecmdirectory.class.php +++ b/htdocs/ecm/class/ecmdirectory.class.php @@ -627,10 +627,10 @@ class EcmDirectory extends CommonObject * date_c Date creation * fk_user_c User creation * login_c Login creation - * fullpath Full path of id (Added by build_path_from_id_categ call) - * fullrelativename Full path name (Added by build_path_from_id_categ call) - * fulllabel Full label (Added by build_path_from_id_categ call) - * level Level of line (Added by build_path_from_id_categ call) + * fullpath Full path of id (Added by buildPathFromId call) + * fullrelativename Full path name (Added by buildPathFromId call) + * fulllabel Full label (Added by buildPathFromId call) + * level Level of line (Added by buildPathFromId call) * * @param int $force Force reload of full arbo even if already loaded in cache $this->cats * @return array Tableau de array @@ -698,10 +698,10 @@ class EcmDirectory extends CommonObject // We add properties fullxxx to all elements foreach ($this->cats as $key => $val) { - if (isset($motherof[$key])) { + if (isset($this->motherof[$key])) { continue; } - $this->build_path_from_id_categ($key, 0); + $this->buildPathFromId($key, 0); } $this->cats = dol_sort_array($this->cats, 'fulllabel', 'asc', true, false); @@ -710,7 +710,6 @@ class EcmDirectory extends CommonObject return $this->cats; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Define properties fullpath, fullrelativename, fulllabel of a directory of array this->cats and all its childs. * Separator between directories is always '/', whatever is OS. @@ -719,9 +718,8 @@ class EcmDirectory extends CommonObject * @param int $protection Deep counter to avoid infinite loop * @return void */ - public function build_path_from_id_categ($id_categ, $protection = 0) + private function buildPathFromId($id_categ, $protection = 0) { - // phpcs:enable // Define fullpath if (!empty($this->cats[$id_categ]['id_mere'])) { $this->cats[$id_categ]['fullpath'] = $this->cats[$this->cats[$id_categ]['id_mere']]['fullpath']; @@ -745,7 +743,7 @@ class EcmDirectory extends CommonObject } if (isset($this->cats[$id_categ]['id_children']) && is_array($this->cats[$id_categ]['id_children'])) { foreach ($this->cats[$id_categ]['id_children'] as $key => $val) { - $this->build_path_from_id_categ($val, $protection); + $this->buildPathFromId($val, $protection); } } } From 9459971ba4412815b005f6d6680b683587afac93 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 6 Apr 2022 14:53:22 +0200 Subject: [PATCH 573/610] Removed the awful "group by" on list of invoices. Add index on datef. --- htdocs/compta/facture/list.php | 21 ++++++++++++++----- .../install/mysql/migration/15.0.0-16.0.0.sql | 2 ++ .../install/mysql/tables/llx_facture.key.sql | 1 + htdocs/install/mysql/tables/llx_facture.sql | 2 +- 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index c92b744c03f..02c0ec21e7a 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -194,12 +194,12 @@ $search_array_options = $extrafields->getOptionalsFromPost($object->table_elemen $fieldstosearchall = array( 'f.ref'=>'Ref', 'f.ref_client'=>'RefCustomer', - 'pd.description'=>'Description', + 'f.note_public'=>'NotePublic', 's.nom'=>"ThirdParty", 's.name_alias'=>"AliasNameShort", 's.zip'=>"Zip", 's.town'=>"Town", - 'f.note_public'=>'NotePublic', + 'pd.description'=>'Description', ); if (empty($user->socid)) { $fieldstosearchall["f.note_private"] = "NotePrivate"; @@ -568,11 +568,14 @@ $sql .= ' state.code_departement as state_code, state.nom as state_name,'; $sql .= ' country.code as country_code,'; $sql .= ' p.rowid as project_id, p.ref as project_ref, p.title as project_label,'; $sql .= ' u.login, u.lastname, u.firstname, u.email as user_email, u.statut as user_statut, u.entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender'; -// We need dynamount_payed to be able to sort on status (value is surely wrong because we can count several lines several times due to other left join or link with contacts. But what we need is just 0 or > 0) -// TODO Better solution to be able to sort on already payed or remain to pay is to store amount_payed in a denormalized field. +// We need dynamount_payed to be able to sort on status (value is surely wrong because we can count several lines several times due to other left join or link with contacts. But what we need is just 0 or > 0). +// A Better solution to be able to sort on already payed or remain to pay is to store amount_payed in a denormalized field. +// We disable this. It create a bug when searching with sall and sorting on status. Also it create performance troubles. +/* if (!$sall) { $sql .= ', SUM(pf.amount) as dynamount_payed, SUM(pf.multicurrency_amount) as multicurrency_dynamount_payed'; } +*/ if ($search_categ_cus && $search_categ_cus != -1) { $sql .= ", cc.fk_categorie, cc.fk_soc"; } @@ -598,9 +601,13 @@ $sql .= ', '.MAIN_DB_PREFIX.'facture as f'; if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (f.rowid = ef.fk_object)"; } + +// We disable this. It create a bug when searching with sall and sorting on status. Also it create performance troubles. +/* if (!$sall) { $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiement_facture as pf ON pf.fk_facture = f.rowid'; } +*/ if ($sall || $search_product_category > 0) { $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'facturedet as pd ON f.rowid=pd.fk_facture'; } @@ -798,6 +805,8 @@ $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; +// We disable this. It create a bug when searching with sall and sorting on status. Also it create performance troubles. +/* if (!$sall) { $sql .= ' GROUP BY f.rowid, f.ref, ref_client, f.fk_soc, f.type, f.note_private, f.note_public, f.increment, f.fk_mode_reglement, f.fk_cond_reglement, f.total_ht, f.total_tva, f.total_ttc,'; $sql .= ' f.localtax1, f.localtax2,'; @@ -827,6 +836,8 @@ if (!$sall) { $reshook = $hookmanager->executeHooks('printFieldListGroupBy', $parameters, $object); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; } else { +*/ +if ($sall) { $sql .= natural_search(array_keys($fieldstosearchall), $sall); } @@ -1624,7 +1635,7 @@ if ($resql) { print_liste_field_titre($arrayfields['f.note_private']['label'], $_SERVER["PHP_SELF"], "f.note_private", "", $param, '', $sortfield, $sortorder, 'center nowrap '); } if (!empty($arrayfields['f.fk_statut']['checked'])) { - print_liste_field_titre($arrayfields['f.fk_statut']['label'], $_SERVER["PHP_SELF"], "f.fk_statut,f.paye,f.type,dynamount_payed", "", $param, 'class="right"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['f.fk_statut']['label'], $_SERVER["PHP_SELF"], "f.fk_statut,f.paye,f.type", "", $param, 'class="right"', $sortfield, $sortorder); } print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); print "\n"; diff --git a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql index 16e2943045a..fdb34f2191e 100644 --- a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql +++ b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql @@ -99,6 +99,8 @@ ALTER TABLE llx_partnership ADD UNIQUE INDEX uk_fk_type_fk_member (fk_type, fk_m -- v16 +ALTER TABLE llx_facture ADD INDEX idx_facture_datef (datef); + ALTER TABLE llx_projet_task_time ADD COLUMN fk_product integer NULL; INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPAL_MODIFY','Customer proposal modified','Executed when a customer proposal is modified','propal',2); diff --git a/htdocs/install/mysql/tables/llx_facture.key.sql b/htdocs/install/mysql/tables/llx_facture.key.sql index a46e27c851d..ee25f8c09d8 100644 --- a/htdocs/install/mysql/tables/llx_facture.key.sql +++ b/htdocs/install/mysql/tables/llx_facture.key.sql @@ -29,6 +29,7 @@ ALTER TABLE llx_facture ADD INDEX idx_facture_fk_projet (fk_projet); ALTER TABLE llx_facture ADD INDEX idx_facture_fk_account (fk_account); ALTER TABLE llx_facture ADD INDEX idx_facture_fk_currency (fk_currency); ALTER TABLE llx_facture ADD INDEX idx_facture_fk_statut (fk_statut); +ALTER TABLE llx_facture ADD INDEX idx_facture_datef (datef); ALTER TABLE llx_facture ADD CONSTRAINT fk_facture_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe (rowid); ALTER TABLE llx_facture ADD CONSTRAINT fk_facture_fk_user_author FOREIGN KEY (fk_user_author) REFERENCES llx_user (rowid); diff --git a/htdocs/install/mysql/tables/llx_facture.sql b/htdocs/install/mysql/tables/llx_facture.sql index d701005666c..8c7e2db385c 100644 --- a/htdocs/install/mysql/tables/llx_facture.sql +++ b/htdocs/install/mysql/tables/llx_facture.sql @@ -26,7 +26,7 @@ create table llx_facture ( rowid integer AUTO_INCREMENT PRIMARY KEY, - ref varchar(30) NOT NULL, -- invoice reference number + ref varchar(30) NOT NULL, -- invoice reference number entity integer DEFAULT 1 NOT NULL, -- multi company id ref_ext varchar(255), -- reference into an external system (not used by dolibarr) From 091ca31b6cc661edc38ded9b1b4d0947a4740fb5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 6 Apr 2022 17:32:56 +0200 Subject: [PATCH 574/610] NEW Add method hintindex() in database handlers. --- htdocs/compta/facture/list.php | 31 ++++++++++++++++++++----------- htdocs/core/db/DoliDB.class.php | 11 +++++++++++ htdocs/core/db/mysqli.class.php | 13 +++++++++++++ 3 files changed, 44 insertions(+), 11 deletions(-) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 06da94e8e2b..eedc3297018 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -598,6 +598,9 @@ if (!empty($search_categ_cus) && $search_categ_cus != '-1') { } $sql .= ', '.MAIN_DB_PREFIX.'facture as f'; +if ($sortfield == "f.datef") { + $sql .= $db->hintindex('idx_facture_datef'); +} if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (f.rowid = ef.fk_object)"; } @@ -846,14 +849,6 @@ $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListHaving', $parameters, $object); // Note that $action and $object may have been modified by hook $sql .= empty($hookmanager->resPrint) ? "" : " HAVING 1=1 ".$hookmanager->resPrint; -$sql .= ' ORDER BY '; -$listfield = explode(',', $sortfield); -$listorder = explode(',', $sortorder); -foreach ($listfield as $key => $value) { - $sql .= $listfield[$key].' '.($listorder[$key] ? $listorder[$key] : 'DESC').','; -} -$sql .= ' f.rowid DESC '; - $nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { /* This old and fast method to get and count full list returns all record so use a high amount of memory. @@ -870,8 +865,12 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $sqlforcount = preg_replace('/GROUP BY.*$/', '', $sqlforcount); $resql = $db->query($sqlforcount); - $objforcount = $db->fetch_object($resql); - $nbtotalofrecords = $objforcount->nbtotalofrecords; + if ($resql) { + $objforcount = $db->fetch_object($resql); + $nbtotalofrecords = $objforcount->nbtotalofrecords; + } else { + dol_print_error($db); + } if (($page * $limit) > $nbtotalofrecords) { // if total of record found is smaller than page * limit, goto and load page 0 $page = 0; @@ -880,7 +879,17 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $db->free($resql); } -$sql .= $db->plimit($limit + 1, $offset); +// Complete request and execute it with limit +$sql .= ' ORDER BY '; +$listfield = explode(',', $sortfield); +$listorder = explode(',', $sortorder); +foreach ($listfield as $key => $value) { + $sql .= $listfield[$key].' '.($listorder[$key] ? $listorder[$key] : 'DESC').','; +} +$sql .= ' f.rowid DESC '; +if ($limit) { + $sql .= $db->plimit($limit + 1, $offset); +} $resql = $db->query($sql); diff --git a/htdocs/core/db/DoliDB.class.php b/htdocs/core/db/DoliDB.class.php index 66e54a4fc3c..aae315ec992 100644 --- a/htdocs/core/db/DoliDB.class.php +++ b/htdocs/core/db/DoliDB.class.php @@ -96,6 +96,17 @@ abstract class DoliDB implements Database return '(CASE WHEN '.$test.' THEN '.$resok.' ELSE '.$resko.' END)'; } + /** + * Return SQL string to force an index + * + * @param string $nameofindex Name of index + * @return string SQL string + */ + public function hintindex($nameofindex) + { + return ''; + } + /** * Convert (by PHP) a GM Timestamp date into a string date with PHP server TZ to insert into a date field. * Function to use to build INSERT, UPDATE or WHERE predica diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index 81a331add8a..582fd08811f 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -168,6 +168,18 @@ class DoliDBMysqli extends DoliDB } + /** + * Return SQL string to force an index + * + * @param string $nameofindex Name of index + * @return string SQL string + */ + public function hintindex($nameofindex) + { + return " FORCE INDEX(".preg_replace('/[^a-z0-9_]/', '', $nameofindex).")"; + } + + /** * Convert a SQL request in Mysql syntax to native syntax * @@ -180,6 +192,7 @@ class DoliDBMysqli extends DoliDB return $line; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Select a database From 4f1e280355badfbb46527acbf81a56c36084e223 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Wed, 6 Apr 2022 20:09:50 +0200 Subject: [PATCH 575/610] Update interface_80_modStripe_Stripe.class.php add D at THIR-D-PARTY if (!empty($conf->global->STRIPE_DELETE_STRIPE_ACCOUNT_WHEN_DELETING_THIRDPARTY)) --- htdocs/core/triggers/interface_80_modStripe_Stripe.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/triggers/interface_80_modStripe_Stripe.class.php b/htdocs/core/triggers/interface_80_modStripe_Stripe.class.php index 0e571f26c98..dfac4c5b84d 100644 --- a/htdocs/core/triggers/interface_80_modStripe_Stripe.class.php +++ b/htdocs/core/triggers/interface_80_modStripe_Stripe.class.php @@ -183,7 +183,7 @@ class InterfaceStripe extends DolibarrTriggers if ($action == 'COMPANY_DELETE') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - if (!empty($conf->global->STRIPE_DELETE_STRIPE_ACCOUNT_WHEN_DELETING_THIRPARTY)) { + if (!empty($conf->global->STRIPE_DELETE_STRIPE_ACCOUNT_WHEN_DELETING_THIRDPARTY)) { // By default, we do not delete the stripe account. We may need to reuse it with its payment_intent, for example if delete is for a merge of thirdparties. $stripeacc = $stripe->getStripeAccount($service); // No need of network access for this. May return '' if no Oauth defined. From 9db2f2c3f235f5dedd14c568e7e906955002c65c Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Wed, 6 Apr 2022 20:12:35 +0200 Subject: [PATCH 576/610] Update company.lib.php add D of THIR-D-PARTIES ($conf->global->THIRDPARTIES_DISABLE_RELATED_OBJECT_TAB) --- htdocs/core/lib/company.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index b8b6d1c728a..197a6c95687 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -180,7 +180,7 @@ function societe_prepare_head(Societe $object) // Related items if ((!empty($conf->commande->enabled) || !empty($conf->propal->enabled) || !empty($conf->facture->enabled) || !empty($conf->ficheinter->enabled) || (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) - && empty($conf->global->THIRPARTIES_DISABLE_RELATED_OBJECT_TAB)) { + && empty($conf->global->THIRDPARTIES_DISABLE_RELATED_OBJECT_TAB)) { $head[$h][0] = DOL_URL_ROOT.'/societe/consumption.php?socid='.$object->id; $head[$h][1] = $langs->trans("Referers"); $head[$h][2] = 'consumption'; From 81e68c892d292ec9633a3001b06dda69467c58ad Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Wed, 6 Apr 2022 20:43:07 +0200 Subject: [PATCH 577/610] Update currencies_iso-4217.txt --- dev/resources/iso-normes/currencies_iso-4217.txt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/dev/resources/iso-normes/currencies_iso-4217.txt b/dev/resources/iso-normes/currencies_iso-4217.txt index bc392b72e9c..e24faa4283e 100644 --- a/dev/resources/iso-normes/currencies_iso-4217.txt +++ b/dev/resources/iso-normes/currencies_iso-4217.txt @@ -1,8 +1,12 @@ # File of all ISO-4217 currencies codes -# http://en.wikipedia.org/wiki/ISO_4217 -# http://fx.sauder.ubc.ca/currency_table.html for symbols for 2 letter code # -# Code,Name,Nb decimals +# https://en.wikipedia.org/wiki/ISO_4217 +# https://en.wikipedia.org/wiki/Currency_symbol for symbols for 2 letter code +# + + +# Code, Currency Name, Nb decimals + AED,UAE Dirham,2 AFN,Afghanistan Afghani,2 ALL,Albanian Lek,2 From 2e890d9d283e36e27b422cd6a6ed527667dfb69e Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Wed, 6 Apr 2022 21:08:23 +0200 Subject: [PATCH 578/610] Update societe.class.php note_public => NotePublic note_private => NotePrivate see #20419 --- htdocs/societe/class/societe.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 015a8c92af6..25d2831f853 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -193,8 +193,8 @@ class Societe extends CommonObject 'tva_intra' =>array('type'=>'varchar(20)', 'label'=>'Tva intra', 'enabled'=>1, 'visible'=>-1, 'position'=>210), 'capital' =>array('type'=>'double(24,8)', 'label'=>'Capital', 'enabled'=>1, 'visible'=>-1, 'position'=>215), 'fk_stcomm' =>array('type'=>'integer', 'label'=>'CommercialStatus', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>220), - 'note_private' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>225), - 'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>230), + 'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>225), + 'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>230), 'prefix_comm' =>array('type'=>'varchar(5)', 'label'=>'Prefix comm', 'enabled'=>'$conf->global->SOCIETE_USEPREFIX', 'visible'=>-1, 'position'=>235), 'client' =>array('type'=>'tinyint(4)', 'label'=>'Client', 'enabled'=>1, 'visible'=>-1, 'position'=>240), 'fournisseur' =>array('type'=>'tinyint(4)', 'label'=>'Fournisseur', 'enabled'=>1, 'visible'=>-1, 'position'=>245), From 524b001f3b565e5741c75f347f3e2a73a7ad864d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 6 Apr 2022 21:14:35 +0200 Subject: [PATCH 579/610] Add $dolibarr_main_restrict_os_commands in security center. --- htdocs/admin/system/security.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/htdocs/admin/system/security.php b/htdocs/admin/system/security.php index 40656928824..8a480ea49ca 100644 --- a/htdocs/admin/system/security.php +++ b/htdocs/admin/system/security.php @@ -266,10 +266,20 @@ print '
'; print '$dolibarr_main_restrict_ip: '; if (empty($dolibarr_main_restrict_ip)) { - print ''.$langs->trans("None").''; + print $langs->trans("None"); //print ' ('.$langs->trans("RecommendedValueIs", $langs->transnoentitiesnoconv("IPsOfUsers")).')'; +} else { + print $dolibarr_main_restrict_ip; } +print '
'; +print '$dolibarr_main_restrict_os_commands: '; +if (empty($dolibarr_main_restrict_os_commands)) { + print $langs->trans("None"); +} else { + print $dolibarr_main_restrict_os_commands; +} +print ' ('.$langs->trans("RecommendedValueIs", 'mysqldump, mysql, pg_dump, pgrestore').')'; print '
'; if (empty($conf->global->SECURITY_DISABLE_TEST_ON_OBFUSCATED_CONF)) { From ed1bdd26dbbf1e3b20ba3483d212df5358ac0435 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 7 Apr 2022 00:09:11 +0200 Subject: [PATCH 580/610] Rename some jobs --- htdocs/core/modules/modFacture.class.php | 4 ++-- htdocs/core/modules/modFournisseur.class.php | 4 ++-- htdocs/install/mysql/migration/15.0.0-16.0.0.sql | 3 +++ htdocs/langs/en_US/bills.lang | 2 ++ 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/htdocs/core/modules/modFacture.class.php b/htdocs/core/modules/modFacture.class.php index b64ecca6cc1..817fa1b53cf 100644 --- a/htdocs/core/modules/modFacture.class.php +++ b/htdocs/core/modules/modFacture.class.php @@ -113,7 +113,7 @@ class modFacture extends DolibarrModules $datestart = dol_mktime(23, 0, 0, $arraydate['mon'], $arraydate['mday'], $arraydate['year']); $this->cronjobs = array( 0 => array( - 'label'=>'RecurringInvoices', + 'label'=>'RecurringInvoicesJob', 'jobtype'=>'method', 'class'=>'compta/facture/class/facture-rec.class.php', 'objectname'=>'FactureRec', @@ -122,7 +122,7 @@ class modFacture extends DolibarrModules 'comment'=>'Generate recurring invoices', 'frequency'=>1, 'unitfrequency'=>3600 * 24, - 'priority'=>50, + 'priority'=>51, 'status'=>1, 'test'=>'$conf->facture->enabled', 'datestart'=>$datestart diff --git a/htdocs/core/modules/modFournisseur.class.php b/htdocs/core/modules/modFournisseur.class.php index 708cd1fb408..aef28514c61 100644 --- a/htdocs/core/modules/modFournisseur.class.php +++ b/htdocs/core/modules/modFournisseur.class.php @@ -133,7 +133,7 @@ class modFournisseur extends DolibarrModules $datestart = dol_mktime(23, 0, 0, $arraydate['mon'], $arraydate['mday'], $arraydate['year']); $this->cronjobs = array( 0 => array( - 'label'=>'RecurringSupplierInvoices', + 'label'=>'RecurringSupplierInvoicesJob', 'jobtype'=>'method', 'class'=>'fourn/class/fournisseur.facture-rec.class.php', 'objectname'=>'FactureFournisseurRec', @@ -142,7 +142,7 @@ class modFournisseur extends DolibarrModules 'comment'=>'Generate recurring supplier invoices', 'frequency'=>1, 'unitfrequency'=>3600 * 24, - 'priority'=>50, + 'priority'=>51, 'status'=>1, 'datestart'=>$datestart )); diff --git a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql index fdb34f2191e..7aa4ff82e4b 100644 --- a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql +++ b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql @@ -99,6 +99,9 @@ ALTER TABLE llx_partnership ADD UNIQUE INDEX uk_fk_type_fk_member (fk_type, fk_m -- v16 +UPDATE llx_cronjob set label = 'RecurringInvoicesJob' where label = 'RecurringInvoices'; +UPDATE llx_cronjob set label = 'RecurringSupplierInvoicesJob' where label = 'RecurringSupplierInvoices'; + ALTER TABLE llx_facture ADD INDEX idx_facture_datef (datef); ALTER TABLE llx_projet_task_time ADD COLUMN fk_product integer NULL; diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index eada0da8899..a70d2eb8f21 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -283,6 +283,8 @@ RecurringInvoices=Recurring invoices RecurringInvoice=Recurring invoice RepeatableInvoice=Template invoice RepeatableInvoices=Template invoices +RecurringInvoicesJob=Generation of recurring invoices (sales invoices) +RecurringSupplierInvoicesJob=Generation of recurring invoices (purchase invoices) Repeatable=Template Repeatables=Templates ChangeIntoRepeatableInvoice=Convert into template invoice From 35ee6096b6346a489ac9f8434f2248be72b4d52f Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 7 Apr 2022 10:38:46 +0200 Subject: [PATCH 581/610] FIX increased the size of the "note" field --- htdocs/install/mysql/migration/15.0.0-16.0.0.sql | 3 +++ htdocs/install/mysql/tables/llx_actioncomm.sql | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql index 7aa4ff82e4b..634e17b33b4 100644 --- a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql +++ b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql @@ -312,3 +312,6 @@ UPDATE llx_c_availability SET type_duration = 'w', qty = 4 WHERE code = 'AV_4W'; ALTER TABLE llx_boxes_def ADD COLUMN fk_user integer DEFAULT 0 NOT NULL; ALTER TABLE llx_contratdet ADD COLUMN rang integer DEFAULT 0 AFTER info_bits; + +ALTER TABLE llx_actioncomm MODIFY COLUMN note mediumtext; + diff --git a/htdocs/install/mysql/tables/llx_actioncomm.sql b/htdocs/install/mysql/tables/llx_actioncomm.sql index 2f3f7660698..d4d0b65ef25 100644 --- a/htdocs/install/mysql/tables/llx_actioncomm.sql +++ b/htdocs/install/mysql/tables/llx_actioncomm.sql @@ -55,7 +55,7 @@ create table llx_actioncomm durationp real, -- planed duration label varchar(255) NOT NULL, -- label/title of event or topic of email - note text, -- private note of event or content of email + note mediumtext, -- private note of event or content of email calling_duration integer, -- when event is a phone call, duration of phone call From 75b74a5fd352c94e51f17fc22fafbf0edda04533 Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Thu, 7 Apr 2022 10:43:31 +0200 Subject: [PATCH 582/610] FIX : identification new td --- htdocs/core/class/commonobject.class.php | 2 +- htdocs/core/tpl/originproductline.tpl.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 59d6ab59f34..62a8038d4d4 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -4948,7 +4948,7 @@ abstract class CommonObject print '
'; } print ''; - print ''; + print ''; print ''; print ''; $i = 0; diff --git a/htdocs/core/tpl/originproductline.tpl.php b/htdocs/core/tpl/originproductline.tpl.php index dfbf2ac3ea4..c19ef7bcf59 100644 --- a/htdocs/core/tpl/originproductline.tpl.php +++ b/htdocs/core/tpl/originproductline.tpl.php @@ -41,7 +41,7 @@ if (!empty($conf->global->PRODUCT_USE_UNITS)) { } print ''; -print ''; +print ''; $selected = 1; if (!empty($selectedLines) && !in_array($this->tpl['id'], $selectedLines)) { From 49a0485427cc0e126fa0eaf50612eb6f2a905e1c Mon Sep 17 00:00:00 2001 From: habot-it Date: Fri, 18 Feb 2022 08:43:36 +0000 Subject: [PATCH 583/610] Add options in function pdf_pagefoot of pdf.lib.php - Revision --- htdocs/core/lib/pdf.lib.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index c79cbbca645..278b1aeb512 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1154,8 +1154,6 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_ } } - $pdf->SetAutoPageBreak(0, 0); // Disable auto pagebreak - // For customize footer if (is_object($hookmanager)) { $parameters = array('line1' => $line1, 'line2' => $line2, 'line3' => $line3, 'line4' => $line4, 'outputlangs'=>$outputlangs); @@ -1171,7 +1169,9 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_ // Option for footer background color (without freetext zone) if (!empty($conf->global->PDF_FOOTER_BACKGROUND_COLOR)) { list($r, $g, $b) = sscanf($conf->global->PDF_FOOTER_BACKGROUND_COLOR, '%d, %d, %d'); + $pdf->SetAutoPageBreak(0, 0); // Disable auto pagebreak $pdf->Rect(0, $dims['hk'] - $posy + $freetextheight, $dims['wk'] + 1, $marginwithfooter + 1, 'F', '', $fill_color = array($r, $g, $b)); + $pdf->SetAutoPageBreak(1, 0); // Restore pagebreak } if ($line) { // Free text @@ -1196,7 +1196,9 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_ $posy -= $conf->global->PDF_FOOTER_TOP_MARGIN; } else { $posy--; } + if ($conf->global->PDF_FOOTER_DISABLE_PAGEBREAK === '1') { $pdf->SetAutoPageBreak(0, 0); } // Option for disable auto pagebreak $pdf->writeHTMLCell($pdf->page_largeur - $pdf->margin_left - $pdf->margin_right, $mycustomfooterheight, $dims['lm'], $dims['hk'] - $posy, dol_htmlentitiesbr($mycustomfooter, 1, 'UTF-8', 0)); + if ($conf->global->PDF_FOOTER_DISABLE_PAGEBREAK === '1') { $pdf->SetAutoPageBreak(1, 0); } // Restore pagebreak $posy -= $mycustomfooterheight - 3; } else { @@ -1207,7 +1209,9 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_ // Option for footer background color (without freetext zone) if (!empty($conf->global->PDF_FOOTER_BACKGROUND_COLOR)) { list($r, $g, $b) = sscanf($conf->global->PDF_FOOTER_BACKGROUND_COLOR, '%d, %d, %d'); + $pdf->SetAutoPageBreak(0, 0); // Disable auto pagebreak $pdf->Rect(0, $dims['hk'] - $posy + $freetextheight, $dims['wk'] + 1, $marginwithfooter + 1, 'F', '', $fill_color = array($r, $g, $b)); + $pdf->SetAutoPageBreak(1, 0); // Restore pagebreak } if ($line) { // Free text @@ -1267,8 +1271,6 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_ $pdf->MultiCell(15, 2, $pdf->PageNo().'/'.$pdf->getAliasNbPages(), 0, 'R', 0); } - $pdf->SetAutoPageBreak(1, 0); // Restore pagebreak - return $marginwithfooter; } From 4693ef42bd10a4d64df843357a20c4c35ca2d9d1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 7 Apr 2022 11:18:56 +0200 Subject: [PATCH 584/610] Enhance responsive --- htdocs/comm/propal/card.php | 2 ++ htdocs/commande/card.php | 2 ++ htdocs/compta/facture/card.php | 2 ++ htdocs/fichinter/card.php | 2 ++ htdocs/fourn/commande/card.php | 2 ++ htdocs/fourn/facture/card.php | 2 ++ htdocs/supplier_proposal/card.php | 2 ++ 7 files changed, 14 insertions(+) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 10903ea3556..d73a9769d17 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1892,11 +1892,13 @@ if ($action == 'create') { $title = $langs->trans('ProductsAndServices'); print load_fiche_titre($title); + print '
'; print '
' . $langs->trans('ExpenseReportApplyTo') . '' . $langs->trans('Type') . '' . $langs->trans('ExpenseReportLimitOn') . '' . $langs->trans('ExpenseReportDateStart') . '' . $langs->trans('ExpenseReportDateEnd') . '' . $langs->trans('ExpenseReportLimitAmount') . '' . $langs->trans('ExpenseReportRestrictive') . '' . $langs->trans('Type') . '' . $langs->trans('ExpenseReportLimitOn') . '' . $langs->trans('ExpenseReportDateStart') . '' . $langs->trans('ExpenseReportDateEnd') . '' . $langs->trans('ExpenseReportLimitAmount') . '' . $langs->trans('ExpenseReportRestrictive') . ' 
'.$langs->trans('Unit').''.$langs->trans('ReductionShort').''.$langs->trans('TotalHT').''.$langs->trans('TotalHT').''.$form->showCheckAddButtons('checkforselect', 1).'
'.$this->tpl['remise_percent'].''.$this->tpl['total_ht'].''.$this->tpl['total_ht'].'
'; $objectsrc->printOriginLinesList(); print '
'; + print '
'; } } elseif ($object->id > 0) { /* diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index e8f88800693..b54784a82b2 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1862,11 +1862,13 @@ if ($action == 'create' && $usercancreate) { $title = $langs->trans('ProductsAndServices'); print load_fiche_titre($title); + print '
'; print ''; $objectsrc->printOriginLinesList('', $selectedLines); print '
'; + print '
'; } print ''; diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 102e0cf7f4a..2273fc27c3b 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -3815,11 +3815,13 @@ if ($action == 'create') { $title = $langs->trans('ProductsAndServices'); print load_fiche_titre($title); + print '
'; print ''; $objectsrc->printOriginLinesList('', $selectedLines); print '
'; + print '
'; } print "\n"; diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index 80f39e17730..0d7e5278a14 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -1003,11 +1003,13 @@ if ($action == 'create') { $title = $langs->trans('Services'); print load_fiche_titre($title); + print '
'; print ''; $objectsrc->printOriginLinesList(empty($conf->global->FICHINTER_PRINT_PRODUCTS) ? 'services' : ''); // Show only service, except if option FICHINTER_PRINT_PRODUCTS is on print '
'; + print '
'; } print ''; diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index b71ba0de941..d895e688080 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -1840,11 +1840,13 @@ if ($action == 'create') { $title = $langs->trans('ProductsAndServices'); print load_fiche_titre($title); + print '
'; print ''; $objectsrc->printOriginLinesList('', $selectedLines); print '
'; + print '
'; } print "\n"; } elseif (!empty($object->id)) { diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index f4d628d5882..37bcd3199c5 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -2557,11 +2557,13 @@ if ($action == 'create') { $title = $langs->trans('ProductsAndServices'); print load_fiche_titre($title); + print '
'; print ''; $objectsrc->printOriginLinesList('', $selectedLines); print '
'; + print '
'; } print "\n"; diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index f0594b90b6f..077300f9386 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -1425,11 +1425,13 @@ if ($action == 'create') { $title = $langs->trans('ProductsAndServices'); print load_fiche_titre($title); + print '
'; print ''; $objectsrc->printOriginLinesList(); print '
'; + print '
'; } } else { /* From 5e8f632a9ba8393f44b57a6b0cf5a986f275df12 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 7 Apr 2022 11:22:28 +0200 Subject: [PATCH 585/610] Close #20571 --- htdocs/install/mysql/data/llx_c_paiement.sql | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/install/mysql/data/llx_c_paiement.sql b/htdocs/install/mysql/data/llx_c_paiement.sql index e29b47639f2..400e2f24276 100644 --- a/htdocs/install/mysql/data/llx_c_paiement.sql +++ b/htdocs/install/mysql/data/llx_c_paiement.sql @@ -30,6 +30,7 @@ -- Types paiement -- +-- Payment modes insert into llx_c_paiement (id,code,libelle,type,active) values ( 1, 'TIP', 'TIP', 2, 0); insert into llx_c_paiement (id,code,libelle,type,active) values ( 2, 'VIR', 'Transfer', 2, 1); insert into llx_c_paiement (id,code,libelle,type,active) values ( 3, 'PRE', 'Debit order', 2, 1); @@ -40,8 +41,10 @@ insert into llx_c_paiement (id,code,libelle,type,active) values (50, 'VAD', 'Onl insert into llx_c_paiement (id,code,libelle,type,active) values (51, 'TRA', 'Traite', 2, 0); insert into llx_c_paiement (id,code,libelle,type,active) values (52, 'LCR', 'LCR', 2, 0); insert into llx_c_paiement (id,code,libelle,type,active) values (53, 'FAC', 'Factor', 2, 0); +-- Payment services INSERT INTO llx_c_paiement (id,code,libelle,type,active) values (100, 'KLA', 'Klarna', 1, 0); INSERT INTO llx_c_paiement (id,code,libelle,type,active) values (101, 'SOF', 'Sofort', 1, 0); INSERT INTO llx_c_paiement (id,code,libelle,type,active) values (102, 'BAN', 'Bancontact', 1, 0); INSERT INTO llx_c_paiement (id,code,libelle,type,active) values (103, 'IDE', 'iDeal', 1, 0); INSERT INTO llx_c_paiement (id,code,libelle,type,active) values (104, 'GIR', 'Giropay', 1, 0); +INSERT INTO llx_c_paiement (id,code,libelle,type,active) values (105, 'PPL', 'PayPal', 1, 0); From 93777f81f367d085c6a7a3f6edc0faab5ab72e3c Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Thu, 7 Apr 2022 11:23:27 +0200 Subject: [PATCH 586/610] NEW : identification tr by data-id --- htdocs/core/tpl/originproductline.tpl.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/tpl/originproductline.tpl.php b/htdocs/core/tpl/originproductline.tpl.php index c19ef7bcf59..55d385fcd50 100644 --- a/htdocs/core/tpl/originproductline.tpl.php +++ b/htdocs/core/tpl/originproductline.tpl.php @@ -1,6 +1,7 @@ * Copyright (C) 2017 Charlie Benke + * Copyright (C) 2022 Gauthier VERDOL * * 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,7 +27,7 @@ if (empty($conf) || !is_object($conf)) { tpl['strike']) ? '' : ' strikefordisabled').'">'; +print ''; print ''.$this->tpl['label'].''; print ''.$this->tpl['description'].''; print ''.$this->tpl['vat_rate'].''; From 06f8af71effc40ba3b04a2c6ebacda1839bbb4d2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 7 Apr 2022 11:24:39 +0200 Subject: [PATCH 587/610] Code comment --- htdocs/install/mysql/data/llx_c_paiement.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/install/mysql/data/llx_c_paiement.sql b/htdocs/install/mysql/data/llx_c_paiement.sql index 400e2f24276..a266070da2b 100644 --- a/htdocs/install/mysql/data/llx_c_paiement.sql +++ b/htdocs/install/mysql/data/llx_c_paiement.sql @@ -37,6 +37,7 @@ insert into llx_c_paiement (id,code,libelle,type,active) values ( 3, 'PRE', 'Deb insert into llx_c_paiement (id,code,libelle,type,active) values ( 4, 'LIQ', 'Cash', 2, 1); insert into llx_c_paiement (id,code,libelle,type,active) values ( 6, 'CB', 'Credit card', 2, 1); insert into llx_c_paiement (id,code,libelle,type,active) values ( 7, 'CHQ', 'Cheque', 2, 1); +-- Alternative not common payment modes insert into llx_c_paiement (id,code,libelle,type,active) values (50, 'VAD', 'Online payment', 2, 0); insert into llx_c_paiement (id,code,libelle,type,active) values (51, 'TRA', 'Traite', 2, 0); insert into llx_c_paiement (id,code,libelle,type,active) values (52, 'LCR', 'LCR', 2, 0); From a4b9883eac9a6dbdaf5a967be042cbbf2bd53fd9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 7 Apr 2022 13:14:51 +0200 Subject: [PATCH 588/610] Use checkbox instead of combo to save clicks when adding a resource --- htdocs/core/tpl/resource_add.tpl.php | 25 ++++++++++++++++++------- htdocs/resource/element_resource.php | 17 ++++++++++++----- 2 files changed, 30 insertions(+), 12 deletions(-) diff --git a/htdocs/core/tpl/resource_add.tpl.php b/htdocs/core/tpl/resource_add.tpl.php index 64d545ba583..5e605337c0c 100644 --- a/htdocs/core/tpl/resource_add.tpl.php +++ b/htdocs/core/tpl/resource_add.tpl.php @@ -13,9 +13,11 @@ require_once DOL_DOCUMENT_ROOT.'/resource/class/html.formresource.class.php'; $form = new Form($db); $formresources = new FormResource($db); -$out = '
'; +$out = ''; -$out .= '
'; +$out .= '
'; + +$out .= ''; $out .= ''; $out .= ''; $out .= ''; @@ -23,21 +25,30 @@ $out .= ''; $out .= ''; $out .= ''; +$out .= '
'; // Place -$out .= '
'.$langs->trans("SelectResource").'
'; -$out .= '
'; +$out .= '
'.$langs->trans("SelectResource").'
'; +$out .= '
'; $events = array(); $out .= $formresources->select_resource_list('', 'fk_resource', '', 1, 1, 0, $events, '', 2, null); $out .= '
'; -$out .= '
'.$form->selectyesno('busy', (GETPOSTISSET('busy') ? GETPOST('busy') : 1), 1).'
'; -$out .= '
'.$form->selectyesno('mandatory', (GETPOSTISSET('mandatory') ? GETPOST('mandatory') : 0), 1).'
'; +$out .= '
'; +//$out .= $form->selectyesno('busy', (GETPOSTISSET('busy') ? GETPOST('busy') : 1), 1); +$out .= ''; +$out .= '
'; +$out .= '
'; +//$out .= $form->selectyesno('mandatory', (GETPOSTISSET('mandatory') ? GETPOST('mandatory') : 0), 1); +$out .= ''; +$out .= '
'; -$out .= '
'; +$out .= '
'; $out .= ''; $out .= '
'; +$out .= '
'; + $out .= ''; $out .= '
'; diff --git a/htdocs/resource/element_resource.php b/htdocs/resource/element_resource.php index 068dba8c50a..f4c6f3d3856 100644 --- a/htdocs/resource/element_resource.php +++ b/htdocs/resource/element_resource.php @@ -46,10 +46,6 @@ $sortfield = GETPOST('sortfield','alpha'); $page = GETPOST('page','int'); */ -if (!$user->rights->resource->read) { - accessforbidden(); -} - $object = new Dolresource($db); $hookmanager->initHooks(array('element_resource')); @@ -71,11 +67,22 @@ $cancel = GETPOST('cancel', 'alpha'); $confirm = GETPOST('confirm', 'alpha'); $socid = GETPOST('socid', 'int'); +if (empty($mandatory)) { + $mandatory = 0; +} +if (empty($busy)) { + $busy = 0; +} + if ($socid > 0) { // Special for thirdparty $element_id = $socid; $element = 'societe'; } +if (!$user->rights->resource->read) { + accessforbidden(); +} + // Permission is not permission on resources. We just make link here on objects. if ($element == 'action') { $result = restrictedArea($user, 'agenda', $element_id, 'actioncomm&societe', 'myactions|allactions', 'fk_soc', 'id'); @@ -365,7 +372,7 @@ if (!$ret) { print '
'; - print ''; + print '
'; // Type if (!empty($conf->global->AGENDA_USE_EVENT_TYPE)) { From 485e163cf6df25570c010bd30a88ad1418bd7c17 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 7 Apr 2022 13:16:51 +0200 Subject: [PATCH 589/610] default value --- htdocs/core/tpl/resource_add.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/resource_add.tpl.php b/htdocs/core/tpl/resource_add.tpl.php index 5e605337c0c..02bc8ce421f 100644 --- a/htdocs/core/tpl/resource_add.tpl.php +++ b/htdocs/core/tpl/resource_add.tpl.php @@ -40,7 +40,7 @@ $out .= 'trans('Mandatory').' '; //$out .= $form->selectyesno('mandatory', (GETPOSTISSET('mandatory') ? GETPOST('mandatory') : 0), 1); -$out .= ''; +$out .= ''; $out .= ''; $out .= '
'; From 0ed7c643f88886c3820110f0a01b2df01a541f8d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 7 Apr 2022 13:28:24 +0200 Subject: [PATCH 590/610] Close #20547 --- htdocs/comm/action/class/actioncomm.class.php | 32 +++++++++++++++++-- htdocs/core/actions_sendmails.inc.php | 8 ++--- ...terface_50_modAgenda_ActionsAuto.class.php | 4 ++- 3 files changed, 36 insertions(+), 8 deletions(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index a5b4f1d8ce9..f93f5aeccb7 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -868,6 +868,16 @@ class ActionComm extends CommonObject $this->event_paid = $obj->event_paid; $this->status = $obj->status; + //email information + $this->email_msgid=$obj->email_msgid; + $this->email_from=$obj->email_from; + $this->email_sender=$obj->email_sender; + $this->email_to=$obj->email_to; + $this->email_tocc=$obj->email_tocc; + $this->email_tobcc=$obj->email_tobcc; + $this->email_subject=$obj->email_subject; + $this->errors_to=$obj->errors_to; + $this->fetch_optionals(); if ($loadresources) { @@ -1582,8 +1592,25 @@ class ActionComm extends CommonObject if (isset($this->transparency)) { $tooltip .= '
'.$langs->trans('Busy').': '.yn($this->transparency); } + if (!empty($this->email_msgid)) { + $langs->load("mails"); + $tooltip .= '
'; + //$tooltip .= '
'.img_picto('', 'email').' '.$langs->trans("Email").''; + $tooltip .= '
'.$langs->trans('MailTopic').': '.$this->email_subject; + $tooltip .= '
'.$langs->trans('MailFrom').': '.str_replace(array('<', '>'), array('&lt', '&gt'), $this->email_from); + $tooltip .= '
'.$langs->trans('MailTo').':, '.str_replace(array('<', '>'), array('&lt', '&gt'), $this->email_to); + if (!empty($this->email_tocc)) { + $tooltip .= '
'.$langs->trans('MailCC').': '.str_replace(array('<', '>'), array('&lt', '&gt'), $this->email_tocc); + } + /* Disabled because bcc must remain by defintion not visible + if (!empty($this->email_tobcc)) { + $tooltip .= '
'.$langs->trans('MailCCC').': '.$this->email_tobcc; + } */ + } if (!empty($this->note_private)) { - $tooltip .= '
'.$langs->trans('Note').': '.(dol_textishtml($this->note_private) ? str_replace(array("\r", "\n"), "", $this->note_private) : str_replace(array("\r", "\n"), '
', $this->note_private)); + $tooltip .= '

'.$langs->trans('Description').':
'; + $texttoshow = dolGetFirstLineOfText($this->note_private, 10); + $tooltip .= (dol_textishtml($texttoshow) ? str_replace(array("\r", "\n"), "", $texttoshow) : str_replace(array("\r", "\n"), '
', $texttoshow)); } $linkclose = ''; //if (!empty($conf->global->AGENDA_USE_EVENT_TYPE) && $this->type_color) @@ -1594,9 +1621,8 @@ class ActionComm extends CommonObject $label = $langs->trans("ShowAction"); $linkclose .= ' alt="'.dol_escape_htmltag($tooltip, 1).'"'; } - $linkclose .= ' title="'.dol_escape_htmltag($tooltip, 1).'"'; + $linkclose .= ' title="'.dol_escape_htmltag($tooltip, 1, 0, 0, '', 1).'"'; $linkclose .= ' class="'.$classname.' classfortooltip"'; - /* $hookmanager->initHooks(array('actiondao')); $parameters=array('id'=>$this->id); diff --git a/htdocs/core/actions_sendmails.inc.php b/htdocs/core/actions_sendmails.inc.php index d31f8d60dfc..f0ef66eb78b 100644 --- a/htdocs/core/actions_sendmails.inc.php +++ b/htdocs/core/actions_sendmails.inc.php @@ -109,7 +109,7 @@ if (($action == 'send' || $action == 'relance') && !GETPOST('addfile') && !GETPO } $subject = ''; - $actionmsg = ''; + //$actionmsg = ''; $actionmsg2 = ''; $langs->load('mails'); @@ -317,7 +317,7 @@ if (($action == 'send' || $action == 'relance') && !GETPOST('addfile') && !GETPO if ($action == 'send' || $action == 'relance') { $actionmsg2 = $langs->transnoentities('MailSentBy').' '.CMailFile::getValidAddress($from, 4, 0, 1).' '.$langs->transnoentities('To').' '.CMailFile::getValidAddress($sendto, 4, 0, 1); - if ($message) { + /*if ($message) { $actionmsg = $langs->transnoentities('MailFrom').': '.dol_escape_htmltag($from); $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTo').': '.dol_escape_htmltag($sendto)); if ($sendtocc) { @@ -326,7 +326,7 @@ if (($action == 'send' || $action == 'relance') && !GETPOST('addfile') && !GETPO $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic').": ".$subject); $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody').":"); $actionmsg = dol_concatdesc($actionmsg, $message); - } + }*/ } // Create form object @@ -376,7 +376,7 @@ if (($action == 'send' || $action == 'relance') && !GETPOST('addfile') && !GETPO $object->socid = $sendtosocid; // To link to a company $object->sendtoid = $sendtoid; // To link to contact-addresses. This is an array. $object->actiontypecode = $actiontypecode; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...) - $object->actionmsg = $actionmsg; // Long text (@todo Replace this with $message, we already have details of email in dedicated properties) + $object->actionmsg = $message; // Long text $object->actionmsg2 = $actionmsg2; // Short text ($langs->transnoentities('MailSentBy')...); $object->trackid = $trackid; diff --git a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php index 2ff5d3f9c43..cf6a8220c29 100644 --- a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php +++ b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php @@ -958,11 +958,13 @@ class InterfaceActionsAuto extends DolibarrTriggers } } + /* Seems no more required: We have the data in dedicated field now. if (!empty($user->login)) { $object->actionmsg = dol_concatdesc($langs->transnoentities("Author").': '.$user->login, $object->actionmsg); } elseif (isset($object->origin_email)) { $object->actionmsg = dol_concatdesc($langs->transnoentities("Author").': '.$object->origin_email, $object->actionmsg); } + */ dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); @@ -1019,7 +1021,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $actioncomm->type_code = $object->actiontypecode; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...) $actioncomm->code = 'AC_'.$action; $actioncomm->label = $object->actionmsg2; - $actioncomm->note_private = $object->actionmsg; // TODO Replace with ($actioncomm->email_msgid ? $object->email_content : $object->actionmsg) + $actioncomm->note_private = $object->actionmsg; $actioncomm->fk_project = $projectid; $actioncomm->datep = $now; $actioncomm->datef = $now; From 4cac6b7e29e36f44f0dfa37a90b86179237c25f7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 7 Apr 2022 14:03:14 +0200 Subject: [PATCH 591/610] css --- htdocs/compta/facture/card.php | 8 ++++---- htdocs/core/tpl/contacts.tpl.php | 2 +- htdocs/langs/en_US/companies.lang | 2 +- htdocs/theme/eldy/global.inc.php | 12 +++++++----- htdocs/theme/md/style.css.php | 17 +++++++++++------ 5 files changed, 24 insertions(+), 17 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 2273fc27c3b..9956fd32b97 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -3522,7 +3522,7 @@ if ($action == 'create') { if ($socid > 0) { // Discounts for third party - print '
'; + print '"; - //} if (!empty($conf->global->THIRDPARTY_SUGGEST_ALSO_ADDRESS_CREATION)) { print ''; print ''; print ''; - // Parent company - if (empty($conf->global->SOCIETE_DISABLE_PARENTCOMPANY)) { - print ''; - print ''; - print ''; - } - // Prospect/Customer print ''; print ''; + print ''; + print ''; + } + // Assign a sale representative print ''; print ''; diff --git a/htdocs/theme/eldy/dropdown.inc.php b/htdocs/theme/eldy/dropdown.inc.php index 242250c8835..2bb2f61375b 100644 --- a/htdocs/theme/eldy/dropdown.inc.php +++ b/htdocs/theme/eldy/dropdown.inc.php @@ -21,8 +21,8 @@ button.dropdown-item.global-search-item { } #topmenu-bookmark-dropdown .dropdown-menu { - min-width: 300px; - max-width: 360px; + min-width: 360px; + max-width: 400px; } @@ -499,4 +499,9 @@ div.quickaddblock:focus { margin-left: 5px; right: 0; } + + #topmenu-bookmark-dropdown .dropdown-menu { + min-width: 280px; + max-width: 360px; + } } From 96c866400f5ef23e07b87e2990ecf3b9bf7d4487 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 7 Apr 2022 16:05:55 +0200 Subject: [PATCH 598/610] css --- htdocs/contact/card.php | 4 ++-- htdocs/societe/card.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index 229bfc0530b..ee1d10181ca 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -624,7 +624,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { */ $object->canvas = $canvas; - $object->state_id = GETPOST("state_id"); + $object->state_id = GETPOST("state_id", "int"); // We set country_id, country_code and label for the selected country $object->country_id = GETPOST("country_id") ? GETPOST("country_id", "int") : (empty($objsoc->country_id) ? $mysoc->country_id : $objsoc->country_id); @@ -697,7 +697,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''; } else { print ''; } } diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 37ac9805374..a8b2fb151c6 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -1671,7 +1671,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''; print ''; } From fc7a4dba4a3eff50248bf1abf87b146be5b6b9e1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 7 Apr 2022 16:26:22 +0200 Subject: [PATCH 599/610] Removed not up to date notices --- README.md | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/README.md b/README.md index 0d0e2d89d00..b227b16ccba 100644 --- a/README.md +++ b/README.md @@ -220,15 +220,7 @@ These are features that Dolibarr does **not** yet fully support: - Payroll module - No native embedded Webmail, but you can send email to contacts in Dolibarr with e.g. offers, invoices, etc. - Dolibarr can't do coffee (yet) -- The REST API currently cannot: - - Add new ledger entry [#14675](https://github.com/Dolibarr/dolibarr/issues/14675) - - Get virtual products (aka lots) [#14457](https://github.com/Dolibarr/dolibarr/issues/14457) - - Add special taxcodes to a line on a supplier invoice (vat_src_code) [#14404](https://github.com/Dolibarr/dolibarr/issues/14404) - - Get or post shipments on customer orders [#18074](https://github.com/Dolibarr/dolibarr/issues/18074) - - Get or post shipments on supplier orders [#14334](https://github.com/Dolibarr/dolibarr/issues/14334) - - Add an image to a product [#14262](https://github.com/Dolibarr/dolibarr/issues/14262) - - Add multiprices to products [#12812](https://github.com/Dolibarr/dolibarr/issues/12812) - +- ## DOCUMENTATION From a120f6552125dd96fd07857b0e86f2b2252d6576 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 7 Apr 2022 16:32:03 +0200 Subject: [PATCH 600/610] FIX country not visible into list of states --- htdocs/core/class/html.formcompany.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php index fbaee3331c5..f976fac978d 100644 --- a/htdocs/core/class/html.formcompany.class.php +++ b/htdocs/core/class/html.formcompany.class.php @@ -406,7 +406,7 @@ class FormCompany extends Form // Show break $key = $langs->trans("Country".strtoupper($obj->country_code)); $valuetoshow = ($key != "Country".strtoupper($obj->country_code)) ? $obj->country_code." - ".$key : $obj->country; - print '\n"; + print '\n"; $country = $obj->country; } From f884137433c42a8d10ed1c0d766973be263e0e35 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 7 Apr 2022 17:12:17 +0200 Subject: [PATCH 601/610] Forgot to update the COPYRIGHT 4 days ago after jqquery upgrade. --- COPYRIGHT | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/COPYRIGHT b/COPYRIGHT index a5e1f4a4005..a2101a1db0a 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -50,8 +50,8 @@ TCPDI 1.0.0 LGPL-3+ / Apache 2.0 Yes JS libraries: Ace 1.4.14 BSD Yes JS library to get code syntaxique coloration in a textarea. ChartJS 3.7.1 MIT License Yes JS library for graph -jQuery 3.5.1 MIT License Yes JS library -jQuery UI 1.12.1 GPL and MIT License Yes JS library plugin UI +jQuery 3.6.0 MIT License Yes JS library +jQuery UI 1.13.1 GPL and MIT License Yes JS library plugin UI jQuery select2 4.0.13 GPL and Apache License Yes JS library plugin for sexier multiselect. Warning: 4.0.6+ create troubles without patching css jQuery blockUI 2.70.0 GPL and MIT License Yes JS library plugin blockUI (to use ajax popups) jQuery Colorpicker 1.1 MIT License Yes JS library for color picker for a defined list of colors From 746cec015b77341a4e80084e4a7132523bd68913 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 7 Apr 2022 17:50:18 +0200 Subject: [PATCH 602/610] Fix remove warning on chartjs 3.5 --- htdocs/core/class/dolgraph.class.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/dolgraph.class.php b/htdocs/core/class/dolgraph.class.php index b46ca096547..488becd06b7 100644 --- a/htdocs/core/class/dolgraph.class.php +++ b/htdocs/core/class/dolgraph.class.php @@ -1303,11 +1303,13 @@ class DolGraph $this->stringtoshow .= $xaxis; /* For Chartjs v2.9 */ + /* if (empty($showlegend)) { $this->stringtoshow .= 'legend: { display: false }, '."\n"; } else { $this->stringtoshow .= 'legend: { maxWidth: '.round($this->width / 2).', labels: { boxWidth: 15 }, position: \'' . ($showlegend == 2 ? 'right' : 'top') . '\' }, '."\n"; } + */ /* For Chartjs v3.5 */ $this->stringtoshow .= 'plugins: { '."\n"; @@ -1318,7 +1320,9 @@ class DolGraph } $this->stringtoshow .= "}, \n"; - $this->stringtoshow .= 'scales: { xAxes: [{ '; + /* For Chartjs v2.9 */ + /* + $this->stringtoshow .= 'scales: { xAxis: [{ '; if ($this->hideXValues) { $this->stringtoshow .= ' ticks: { display: false }, display: true,'; } @@ -1328,11 +1332,12 @@ class DolGraph $this->stringtoshow .= ', stacked: true'; } $this->stringtoshow .= ' }]'; - $this->stringtoshow .= ', yAxes: [{ ticks: { beginAtZero: true }'; + $this->stringtoshow .= ', yAxis: [{ ticks: { beginAtZero: true }'; if ($type == 'bar' && count($arrayofgroupslegend) > 0) { $this->stringtoshow .= ', stacked: true'; } $this->stringtoshow .= ' }] }'; + */ // Add a callback to change label to show only positive value if (is_array($this->tooltipsLabels) || is_array($this->tooltipsTitles)) { From cbae64f9aab1b3a15dae9d2265cb64c643917e1d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 7 Apr 2022 17:51:38 +0200 Subject: [PATCH 603/610] FIX Add a hack to fix a bug in jquery 3.6.0/select 2 --- htdocs/core/js/lib_head.js.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/htdocs/core/js/lib_head.js.php b/htdocs/core/js/lib_head.js.php index 5d47fa5f605..3fe6dee8820 100644 --- a/htdocs/core/js/lib_head.js.php +++ b/htdocs/core/js/lib_head.js.php @@ -1198,4 +1198,22 @@ $(document).ready(function() { } }); + +/* + * Hacky fix for a bug in select2 with jQuery 3.6.0's new nested-focus "protection" + * see: https://github.com/select2/select2/issues/5993 + * see: https://github.com/jquery/jquery/issues/4382 + * + * TODO: Recheck with the select2 GH issue and remove once this is fixed on their side + */ +$(document).on('select2:open', () => { + console.log("Execute the focus (click on combo or use space when on component"); + let allFound = document.querySelectorAll('.select2-container--open .select2-search__field'); + $(this).one('mouseup keyup',()=>{ + setTimeout(()=>{ + allFound[allFound.length - 1].focus(); + },0); + }); +}); + // End of lib_head.js.php From baa4608812230ad89a6e0db5574350afa3ebb8f1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 7 Apr 2022 18:16:06 +0200 Subject: [PATCH 604/610] Debug v16 --- htdocs/adherents/list.php | 14 ++++++-------- htdocs/holiday/list.php | 15 +++++++++------ htdocs/hrm/index.php | 2 +- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index 996f2d16c8d..e58def3f481 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -505,7 +505,7 @@ if (GETPOSTISSET("search_status")) { if ($search_type > 0) { $membertype = new AdherentType($db); - $result = $membertype->fetch(GETPOST("type", 'int')); + $result = $membertype->fetch($search_type); $titre .= " (".$membertype->label.")"; } @@ -767,7 +767,7 @@ if (!empty($arrayfields['d.email']['checked'])) { } // End of subscription date if (!empty($arrayfields['d.datefin']['checked'])) { - print ''; @@ -858,7 +858,7 @@ if (!empty($arrayfields['state.nom']['checked'])) { print_liste_field_titre($arrayfields['state.nom']['label'], $_SERVER["PHP_SELF"], "state.nom", "", $param, '', $sortfield, $sortorder); } if (!empty($arrayfields['country.code_iso']['checked'])) { - print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, 'align="center"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, '', $sortfield, $sortorder, 'center '); } if (!empty($arrayfields['d.phone']['checked'])) { print_liste_field_titre($arrayfields['d.phone']['label'], $_SERVER["PHP_SELF"], 'd.phone', '', $param, '', $sortfield, $sortorder); @@ -873,7 +873,7 @@ if (!empty($arrayfields['d.email']['checked'])) { print_liste_field_titre($arrayfields['d.email']['label'], $_SERVER["PHP_SELF"], 'd.email', '', $param, '', $sortfield, $sortorder); } if (!empty($arrayfields['d.datefin']['checked'])) { - print_liste_field_titre($arrayfields['d.datefin']['label'], $_SERVER["PHP_SELF"], 'd.datefin', '', $param, 'align="center"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['d.datefin']['label'], $_SERVER["PHP_SELF"], 'd.datefin', '', $param, '', $sortfield, $sortorder, 'center '); } // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; @@ -1110,16 +1110,14 @@ while ($i < min($num, $limit)) { // End of subscription date $datefin = $db->jdate($obj->datefin); if (!empty($arrayfields['d.datefin']['checked'])) { + print ''; } else { - print ''; } + print ''; } // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index b4985100e44..bcae536f720 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -721,7 +721,7 @@ if ($resql) { if (!empty($arrayfields['cp.statut']['checked'])) { print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "cp.statut", "", $param, '', $sortfield, $sortorder, 'right '); } - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch center '); print "\n"; $listhalfday = array('morning'=>$langs->trans("Morning"), "afternoon"=>$langs->trans("Afternoon")); @@ -789,21 +789,23 @@ if ($resql) { } } if (!empty($arrayfields['cp.fk_user']['checked'])) { - print ''; + print ''; if (!$i) { $totalarray['nbfield']++; } } if (!empty($arrayfields['cp.fk_validator']['checked'])) { - print ''; + print ''; if (!$i) { $totalarray['nbfield']++; } } if (!empty($arrayfields['cp.fk_type']['checked'])) { - print ''; if (!$i) { $totalarray['nbfield']++; @@ -813,7 +815,8 @@ if ($resql) { print ''; if (!$i) { $totalarray['nbfield']++; diff --git a/htdocs/hrm/index.php b/htdocs/hrm/index.php index 2603d73ab81..84e336c9b97 100644 --- a/htdocs/hrm/index.php +++ b/htdocs/hrm/index.php @@ -235,7 +235,7 @@ if (!empty($conf->holiday->enabled) && $user->rights->holiday->read) { print ''; print ''; - print ''; + print ''; print ''; $starthalfday = ($obj->halfday == -1 || $obj->halfday == 2) ? 'afternoon' : 'morning'; From 0e36097eba04d730554d05b7ce9ef7a9053e0f1a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 7 Apr 2022 19:16:50 +0200 Subject: [PATCH 605/610] Save result of some methods into cached properties. --- htdocs/core/class/commoninvoice.class.php | 37 ++++++++++++++++++----- htdocs/core/class/discount.class.php | 6 ++-- 2 files changed, 33 insertions(+), 10 deletions(-) diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index eedc1b2fa10..e49f8a6a728 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -93,6 +93,14 @@ abstract class CommonInvoice extends CommonObject const STATUS_ABANDONED = 3; + public $sumpayed; + public $sumpayed_multicurrency; + public $sumdeposit; + public $sumdeposit_multicurrency; + public $sumcreditnote; + public $sumcreditnote_multicurrency; + + /** * Return remain amount to pay. Property ->id and ->total_ttc must be set. * This does not include open direct debit requests. @@ -118,8 +126,8 @@ abstract class CommonInvoice extends CommonObject * Return amount of payments already done. This must include ONLY the record into the payment table. * Payments dones using discounts, credit notes, etc are not included. * - * @param int $multicurrency Return multicurrency_amount instead of amount - * @return float Amount of payment already done, <0 if KO + * @param int $multicurrency Return multicurrency_amount instead of amount + * @return float Amount of payment already done, <0 and set ->error if KO */ public function getSommePaiement($multicurrency = 0) { @@ -138,10 +146,13 @@ abstract class CommonInvoice extends CommonObject $resql = $this->db->query($sql); if ($resql) { $obj = $this->db->fetch_object($resql); + $this->db->free($resql); if ($multicurrency) { + $this->sumpayed_multicurrency = $obj->multicurrency_amount; return $obj->multicurrency_amount; } else { + $this->sumpayed = $obj->amount; return $obj->amount; } } else { @@ -154,13 +165,13 @@ abstract class CommonInvoice extends CommonObject * Return amount (with tax) of all deposits invoices used by invoice. * Should always be empty, except if option FACTURE_DEPOSITS_ARE_JUST_PAYMENTS is on (not recommended). * - * @param int $multicurrency Return multicurrency_amount instead of amount - * @return float <0 if KO, Sum of deposits amount otherwise + * @param int $multicurrency Return multicurrency_amount instead of amount + * @return float <0 and set ->error if KO, Sum of deposits amount otherwise */ public function getSumDepositsUsed($multicurrency = 0) { if ($this->element == 'facture_fourn' || $this->element == 'invoice_supplier') { - // TODO + // FACTURE_DEPOSITS_ARE_JUST_PAYMENTS was never supported for purchase invoice, so we can return 0 with no need of SQL for this case. return 0.0; } @@ -170,6 +181,12 @@ abstract class CommonInvoice extends CommonObject $result = $discountstatic->getSumDepositsUsed($this, $multicurrency); if ($result >= 0) { + if ($multicurrency) { + $this->sumdeposit_multicurrency = $result; + } else { + $this->sumdeposit = $result; + } + return $result; } else { $this->error = $discountstatic->error; @@ -180,8 +197,8 @@ abstract class CommonInvoice extends CommonObject /** * Return amount (with tax) of all credit notes invoices + excess received used by invoice * - * @param int $multicurrency Return multicurrency_amount instead of amount - * @return float <0 if KO, Sum of credit notes and deposits amount otherwise + * @param int $multicurrency Return multicurrency_amount instead of amount + * @return float <0 and set ->error if KO, Sum of credit notes and deposits amount otherwise */ public function getSumCreditNotesUsed($multicurrency = 0) { @@ -190,6 +207,12 @@ abstract class CommonInvoice extends CommonObject $discountstatic = new DiscountAbsolute($this->db); $result = $discountstatic->getSumCreditNotesUsed($this, $multicurrency); if ($result >= 0) { + if ($multicurrency) { + $this->sumcreditnote_multicurrency = $result; + } else { + $this->sumcreditnote = $result; + } + return $result; } else { $this->error = $discountstatic->error; diff --git a/htdocs/core/class/discount.class.php b/htdocs/core/class/discount.class.php index bdc5e746566..dff1383a629 100644 --- a/htdocs/core/class/discount.class.php +++ b/htdocs/core/class/discount.class.php @@ -562,7 +562,7 @@ class DiscountAbsolute * Should always be empty, except if option FACTURE_DEPOSITS_ARE_JUST_PAYMENTS is on (not recommended). * * @param CommonInvoice $invoice Object invoice (customer of supplier) - * @param int $multicurrency 1=Return multicurrency_amount instead of amount + * @param int $multicurrency 1=Return multicurrency_amount instead of amount. TODO Add a mode multicurrency = -1 to return array with amount + multicurrency amount * @return int <0 if KO, Sum of credit notes and deposits amount otherwise */ public function getSumDepositsUsed($invoice, $multicurrency = 0) @@ -603,7 +603,7 @@ class DiscountAbsolute * Return amount (with tax) of all credit notes invoices + excess received used by invoice as a payment * * @param CommonInvoice $invoice Object invoice - * @param int $multicurrency 1=Return multicurrency_amount instead of amount + * @param int $multicurrency 1=Return multicurrency_amount instead of amount. TODO Add a mode multicurrency = -1 to return array with amount + multicurrency amount * @return int <0 if KO, Sum of credit notes and excess received amount otherwise */ public function getSumCreditNotesUsed($invoice, $multicurrency = 0) @@ -643,7 +643,7 @@ class DiscountAbsolute * Return amount (with tax) of all converted amount for this credit note * * @param CommonInvoice $invoice Object invoice - * @param int $multicurrency Return multicurrency_amount instead of amount + * @param int $multicurrency Return multicurrency_amount instead of amount. TODO Add a mode multicurrency = -1 to return array with amount + multicurrency amount * @return int <0 if KO, Sum of credit notes and deposits amount otherwise */ public function getSumFromThisCreditNotesNotUsed($invoice, $multicurrency = 0) From e66b4a687dd3286b38b80ae3ff5cd28d0bc514b8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 7 Apr 2022 19:23:45 +0200 Subject: [PATCH 606/610] Close #19414 --- htdocs/core/lib/functions.lib.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index a9739989c41..50d0e8ee9e3 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -7470,13 +7470,23 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, $substitutionarray['__DATE_YMD__'] = is_object($object) ? (isset($object->date) ? dol_print_date($object->date, 'day', 0, $outputlangs) : null) : ''; $substitutionarray['__DATE_DUE_YMD__'] = is_object($object) ? (isset($object->date_lim_reglement) ? dol_print_date($object->date_lim_reglement, 'day', 0, $outputlangs) : null) : ''; + $already_payed_all = 0; + if (is_object($object) && ($object instanceof Facture)) { + $already_payed_all = $object->sumpayed + $object->sumdeposit + $object->sumcreditnote; + } + + $substitutionarray['__AMOUNT_EXCL_TAX__'] = is_object($object) ? $object->total_ht : ''; + $substitutionarray['__AMOUNT__'] = is_object($object) ? $object->total_ttc : ''; $substitutionarray['__AMOUNT_TEXT__'] = is_object($object) ? dol_convertToWord($object->total_ttc, $outputlangs, '', true) : ''; $substitutionarray['__AMOUNT_TEXTCURRENCY__'] = is_object($object) ? dol_convertToWord($object->total_ttc, $outputlangs, $conf->currency, true) : ''; - $substitutionarray['__AMOUNT_EXCL_TAX__'] = is_object($object) ? $object->total_ht : ''; + + $substitutionarray['__AMOUNT_REMAIN__'] = is_object($object) ? $object->total_ttc - $already_payed_all : ''; + $substitutionarray['__AMOUNT_VAT__'] = is_object($object) ? (isset($object->total_vat) ? $object->total_vat : $object->total_tva) : ''; $substitutionarray['__AMOUNT_VAT_TEXT__'] = is_object($object) ? (isset($object->total_vat) ? dol_convertToWord($object->total_vat, $outputlangs, '', true) : dol_convertToWord($object->total_tva, $outputlangs, '', true)) : ''; $substitutionarray['__AMOUNT_VAT_TEXTCURRENCY__'] = is_object($object) ? (isset($object->total_vat) ? dol_convertToWord($object->total_vat, $outputlangs, $conf->currency, true) : dol_convertToWord($object->total_tva, $outputlangs, $conf->currency, true)) : ''; + if ($onlykey != 2 || $mysoc->useLocalTax(1)) { $substitutionarray['__AMOUNT_TAX2__'] = is_object($object) ? $object->total_localtax1 : ''; } @@ -7484,8 +7494,10 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, $substitutionarray['__AMOUNT_TAX3__'] = is_object($object) ? $object->total_localtax2 : ''; } - $substitutionarray['__AMOUNT_FORMATED__'] = is_object($object) ? ($object->total_ttc ? price($object->total_ttc, 0, $outputlangs, 0, -1, -1, $conf->currency) : null) : ''; + // Amount keys formated in a currency $substitutionarray['__AMOUNT_EXCL_TAX_FORMATED__'] = is_object($object) ? ($object->total_ht ? price($object->total_ht, 0, $outputlangs, 0, -1, -1, $conf->currency) : null) : ''; + $substitutionarray['__AMOUNT_FORMATED__'] = is_object($object) ? ($object->total_ttc ? price($object->total_ttc, 0, $outputlangs, 0, -1, -1, $conf->currency) : null) : ''; + $substitutionarray['__AMOUNT_REMAIN_FORMATED__'] = is_object($object) ? ($object->total_ttc ? price($object->total_ttc - $already_payed_all, 0, $outputlangs, 0, -1, -1, $conf->currency) : null) : ''; $substitutionarray['__AMOUNT_VAT_FORMATED__'] = is_object($object) ? (isset($object->total_vat) ? price($object->total_vat, 0, $outputlangs, 0, -1, -1, $conf->currency) : ($object->total_tva ? price($object->total_tva, 0, $outputlangs, 0, -1, -1, $conf->currency) : null)) : ''; if ($onlykey != 2 || $mysoc->useLocalTax(1)) { $substitutionarray['__AMOUNT_TAX2_FORMATED__'] = is_object($object) ? ($object->total_localtax1 ? price($object->total_localtax1, 0, $outputlangs, 0, -1, -1, $conf->currency) : null) : ''; From 3a2815a9c0c4278ab00364a5b95a62bbf4d1be18 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 7 Apr 2022 23:44:57 +0200 Subject: [PATCH 607/610] Debug and clean v16 --- htdocs/core/login/functions_dolibarr.php | 4 ++++ .../install/mysql/migration/15.0.0-16.0.0.sql | 9 ++++++- htdocs/install/mysql/tables/llx_user.sql | 3 +-- htdocs/install/repair.php | 24 ++++++++++++------- htdocs/user/class/user.class.php | 1 + 5 files changed, 30 insertions(+), 11 deletions(-) diff --git a/htdocs/core/login/functions_dolibarr.php b/htdocs/core/login/functions_dolibarr.php index 292ce1b44f5..610072aa35a 100644 --- a/htdocs/core/login/functions_dolibarr.php +++ b/htdocs/core/login/functions_dolibarr.php @@ -143,7 +143,11 @@ function check_user_password_dolibarr($usertotest, $passwordtotest, $entitytotes $ret = $mc->checkRight($obj->rowid, $entitytotest); if ($ret < 0) { dol_syslog("functions_dolibarr::check_user_password_dolibarr Authentication KO entity '".$entitytotest."' not allowed for user '".$obj->rowid."'", LOG_NOTICE); + $login = ''; // force authentication failure + if ($mc->db->lasterror()) { + $_SESSION["dol_loginmesg"] = $mc->db->lasterror(); + } } } } diff --git a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql index 634e17b33b4..3aa5cd9c9cd 100644 --- a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql +++ b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql @@ -288,9 +288,16 @@ ALTER TABLE llx_bank_account ADD COLUMN pti_in_ctti smallint DEFAULT 0 AFTER dom -- Set default ticket type to OTHER if no default exists UPDATE llx_c_ticket_type SET use_default=1 WHERE code='OTHER' AND NOT EXISTS(SELECT * FROM (SELECT * FROM llx_c_ticket_type) AS t WHERE use_default=1); -ALTER TABLE llx_user ADD COLUMN ref_employee varchar(50) DEFAULT NULL; + +ALTER TABLE llx_user DROP COLUMN webcal_login; +ALTER TABLE llx_user DROP COLUMN module_comm; +ALTER TABLE llx_user DROP COLUMN module_compta; +ALTER TABLE llx_user DROP COLUMN ref_int; + +ALTER TABLE llx_user ADD COLUMN ref_employee varchar(50) DEFAULT NULL AFTER entity; ALTER TABLE llx_user ADD COLUMN national_registration_number varchar(50) DEFAULT NULL; + ALTER TABLE llx_propal ADD last_main_doc VARCHAR(255) NULL AFTER model_pdf; UPDATE llx_c_country SET eec=0 WHERE eec IS NULL; diff --git a/htdocs/install/mysql/tables/llx_user.sql b/htdocs/install/mysql/tables/llx_user.sql index 694ed360b21..ae3715eb028 100644 --- a/htdocs/install/mysql/tables/llx_user.sql +++ b/htdocs/install/mysql/tables/llx_user.sql @@ -22,8 +22,8 @@ create table llx_user rowid integer AUTO_INCREMENT PRIMARY KEY, entity integer DEFAULT 1 NOT NULL, -- multi company id + ref_employee varchar(50), ref_ext varchar(50), -- reference into an external system (not used by dolibarr) - ref_int varchar(50), -- reference into an internal system (deprecated) admin smallint DEFAULT 0, -- user has admin profile @@ -108,7 +108,6 @@ create table llx_user import_key varchar(14), -- import key default_range integer, default_c_exp_tax_cat integer, - employee_number varchar(50), national_registration_number varchar(50), fk_warehouse integer -- default warehouse os user )ENGINE=innodb; diff --git a/htdocs/install/repair.php b/htdocs/install/repair.php index 8e4cc851d28..802711f4ff3 100644 --- a/htdocs/install/repair.php +++ b/htdocs/install/repair.php @@ -94,8 +94,8 @@ print 'Option repair_link_dispatch_lines_supplier_order_lines, (\'test\' or \'co // Init data print 'Option set_empty_time_spent_amount (\'test\' or \'confirmed\') is '.(GETPOST('set_empty_time_spent_amount', 'alpha') ?GETPOST('set_empty_time_spent_amount', 'alpha') : 'undefined').'
'."\n"; // Structure -print 'Option force_utf8_on_tables, for mysql/mariadb only (\'test\' or \'confirmed\') is '.(GETPOST('force_utf8_on_tables', 'alpha') ?GETPOST('force_utf8_on_tables', 'alpha') : 'undefined').'
'."\n"; -print "Option force_utf8mb4_on_tables (EXPERIMENTAL!), for mysql/mariadb only ('test' or 'confirmed') is ".(GETPOST('force_utf8mb4_on_tables', 'alpha') ? GETPOST('force_utf8mb4_on_tables', 'alpha') : 'undefined')."
\n"; +print 'Option force_utf8_on_tables (force utf8 + row=dynamic), for mysql/mariadb only (\'test\' or \'confirmed\') is '.(GETPOST('force_utf8_on_tables', 'alpha') ?GETPOST('force_utf8_on_tables', 'alpha') : 'undefined').'
'."\n"; +print "Option force_utf8mb4_on_tables (force utf8mb4 + row=dynamic, EXPERIMENTAL!), for mysql/mariadb only ('test' or 'confirmed') is ".(GETPOST('force_utf8mb4_on_tables', 'alpha') ? GETPOST('force_utf8mb4_on_tables', 'alpha') : 'undefined')."
\n"; // Rebuild sequence print 'Option rebuild_sequences, for postgresql only (\'test\' or \'confirmed\') is '.(GETPOST('rebuild_sequences', 'alpha') ?GETPOST('rebuild_sequences', 'alpha') : 'undefined').'
'."\n"; print '
'; @@ -176,7 +176,8 @@ $oneoptionset = 0; $oneoptionset = (GETPOST('standard', 'alpha') || GETPOST('restore_thirdparties_logos', 'alpha') || GETPOST('clean_linked_elements', 'alpha') || GETPOST('clean_menus', 'alpha') || GETPOST('clean_orphelin_dir', 'alpha') || GETPOST('clean_product_stock_batch', 'alpha') || GETPOST('set_empty_time_spent_amount', 'alpha') || GETPOST('rebuild_product_thumbs', 'alpha') || GETPOST('clean_perm_table', 'alpha') - || GETPOST('force_disable_of_modules_not_found', 'alpha') || GETPOST('force_utf8_on_tables', 'alpha') + || GETPOST('force_disable_of_modules_not_found', 'alpha') + || GETPOST('force_utf8_on_tables', 'alpha') || GETPOST('force_utf8mb4_on_tables', 'alpha') || GETPOST('rebuild_sequences', 'alpha')); if ($ok && $oneoptionset) { @@ -1218,7 +1219,7 @@ if ($ok && GETPOST('clean_perm_table', 'alpha')) { // force utf8 on tables if ($ok && GETPOST('force_utf8_on_tables', 'alpha')) { - print '
'; + print ''; if ($db->type == "mysql" || $db->type == "mysqli") { $force_utf8_on_tables = GETPOST('force_utf8_on_tables', 'alpha'); @@ -1240,11 +1241,18 @@ if ($ok && GETPOST('force_utf8_on_tables', 'alpha')) { print ''; print ''; print ''; - print ''; + + $leavecode = empty($typeleaves[$obj->fk_type]) ? 'Undefined' : $typeleaves[$obj->fk_type]['code']; + print ''; $starthalfday = ($obj->halfday == -1 || $obj->halfday == 2) ? 'afternoon' : 'morning'; $endhalfday = ($obj->halfday == 1 || $obj->halfday == 2) ? 'morning' : 'afternoon'; diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index e2d36ab4695..fb04930299b 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -756,6 +756,8 @@ if (!defined('NOLOGIN')) { $login = ''; } + $dol_authmode = ''; + if ($login) { $dol_authmode = $conf->authmode; // This properties is defined only when logged, to say what mode was successfully used $dol_tz = $_POST["tz"]; diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index fb9178e1ed0..dc94669d54f 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -312,8 +312,8 @@ print 'dol_hide_topmenu='.$dol_hide_topmenu."\n"; print 'dol_hide_leftmenu='.$dol_hide_leftmenu."\n"; print 'dol_optimize_smallscreen='.$dol_optimize_smallscreen."\n"; print 'dol_no_mouse_hover='.$dol_no_mouse_hover."\n"; -print 'dol_screenwidth='.$_SESSION['dol_screenwidth']."\n"; -print 'dol_screenheight='.$_SESSION['dol_screenheight']."\n"; +print 'dol_screenwidth='.(empty($_SESSION['dol_screenwidth']) ? '' : $_SESSION['dol_screenwidth'])."\n"; +print 'dol_screenheight='.(empty($_SESSION['dol_screenheight']) ? '' : $_SESSION['dol_screenheight'])."\n"; print 'fontsize='.$fontsize."\n"; print 'nbtopmenuentries='.$nbtopmenuentries."\n"; print 'fontsizesmaller='.$fontsizesmaller."\n"; From 1f73f19ff70d09d7a021133dfb82c57720cb643f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 8 Apr 2022 00:42:39 +0200 Subject: [PATCH 610/610] php8 --- htdocs/takepos/index.php | 41 ++++++++++++++++++++++---------------- htdocs/takepos/invoice.php | 7 ++++--- 2 files changed, 28 insertions(+), 20 deletions(-) diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index 31c51a4c7b1..b23907b64f1 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -57,7 +57,7 @@ $action = GETPOST('action', 'aZ09'); $setterminal = GETPOST('setterminal', 'int'); $setcurrency = GETPOST('setcurrency', 'aZ09'); -if ($_SESSION["takeposterminal"] == "") { +if (empty($_SESSION["takeposterminal"])) { if ($conf->global->TAKEPOS_NUM_TERMINALS == "1") { $_SESSION["takeposterminal"] = 1; // Use terminal 1 if there is only 1 terminal } elseif (!empty($_COOKIE["takeposterminal"])) { @@ -114,6 +114,11 @@ $result = restrictedArea($user, 'takepos', 0, ''); $form = new Form($db); +$disablejs = 0; +$disablehead = 0; +$arrayofjs = array(); +$arrayofcss = array(); + // Title $title = 'TakePOS - Dolibarr '.DOL_VERSION; if (!empty($conf->global->MAIN_APPLICATION_TITLE)) { @@ -129,22 +134,22 @@ top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); global->TAKEPOS_COLOR_THEME == 1) { +if (getDolGlobalInt('TAKEPOS_COLOR_THEME') == 1) { print ''; } ?>
'.$langs->trans('Discounts').''; + print '
'.$langs->trans('DiscountStillRemaining').''; $thirdparty = $soc; $discount_type = 0; @@ -4355,8 +4355,8 @@ if ($action == 'create') { // Relative and absolute discounts print ''."\n"; - print '
'.$langs->trans('Discounts'); - print ''; + print '
'.$langs->trans('DiscountStillRemaining').''; $thirdparty = $soc; $discount_type = 0; $backtopage = urlencode($_SERVER["PHP_SELF"].'?facid='.$object->id); @@ -5222,7 +5222,7 @@ if ($action == 'create') { print ''; print ''; - print '

'; + print '


'; if (!empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) { $blocname = 'contacts'; diff --git a/htdocs/core/tpl/contacts.tpl.php b/htdocs/core/tpl/contacts.tpl.php index 2dd9751a4c6..5f463e44846 100644 --- a/htdocs/core/tpl/contacts.tpl.php +++ b/htdocs/core/tpl/contacts.tpl.php @@ -259,7 +259,7 @@ $arrayfields = array( 'rowid' => array('label'=>$langs->trans("Id"), 'checked'=>1), 'nature' => array('label'=>$langs->trans("NatureOfContact"), 'checked'=>1), 'thirdparty' => array('label'=>$langs->trans("ThirdParty"), 'checked'=>1), - 'contact' => array('label'=>$langs->trans("Users").'/'.$langs->trans("Contacts"), 'checked'=>1), + 'contact' => array('label'=>$langs->trans("Users").' | '.$langs->trans("Contacts"), 'checked'=>1), 'type' => array('label'=>$langs->trans("ContactType"), 'checked'=>1), 'status' => array('label'=>$langs->trans("Status"), 'checked'=>1), 'link' => array('label'=>$langs->trans("Link"), 'checked'=>1), diff --git a/htdocs/langs/en_US/companies.lang b/htdocs/langs/en_US/companies.lang index edd6f7b7dd8..093fb47189d 100644 --- a/htdocs/langs/en_US/companies.lang +++ b/htdocs/langs/en_US/companies.lang @@ -361,7 +361,7 @@ ListOfThirdParties=List of Third Parties ShowCompany=Third Party ShowContact=Contact-Address ContactsAllShort=All (No filter) -ContactType=Contact type +ContactType=Contact role ContactForOrders=Order's contact ContactForOrdersOrShipments=Order's or shipment's contact ContactForProposals=Proposal's contact diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 0715723bf55..70b1028bca2 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -3612,6 +3612,13 @@ td.border, div.tagtable div div.border { .fichehalfright table.noborder { margin: 0px 0px 0px 0px; } +table.liste, table.noborder:not(.paymenttable):not(.margintable):not(.tableforcontact), table.formdoc, div.noborder:not(.paymenttable):not(.margintable):not(.tableforcontact) { + + border-left: 1px solid var(--colortopbordertitle1); + border-right: 1px solid var(--colortopbordertitle1); + +} table.liste, table.noborder, table.formdoc, div.noborder { width: 100%; border-collapse: separate !important; @@ -3621,11 +3628,6 @@ table.liste, table.noborder, table.formdoc, div.noborder { border-top-style: solid; margin: 0px 0px 20px 0px; - - border-left: 1px solid var(--colortopbordertitle1); - border-right: 1px solid var(--colortopbordertitle1); - /*width: calc(100% - 7px); border-collapse: separate !important; border-spacing: 0px; diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index f2fee83c291..9189f81856a 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -3681,6 +3681,17 @@ div.colorback border-left: 1px solid #ccc; } +table.liste, table.noborder:not(.paymenttable):not(.margintable):not(.tableforcontact), table.formdoc, div.noborder:not(.paymenttable):not(.margintable):not(.tableforcontact) { + + border-left: 1px solid #BBB; + border-right: 1px solid #BBB; + +} +table.liste, table.noborder.paymenttable, table.noborder.margintable, table.noborder.tableforcontact, table.formdoc, div.noborder.paymenttable, div.noborder.margintable, div.noborder.tableforcontact { + border-left: 1px solid #f0f0f0; + border-right: 1px solid #f0f0f0; +} table.liste, table.noborder, table.formdoc, div.noborder { width: calc(100% - 2px); /* -2 to fix a bug. Without, a scroll appears due to overflow-x: auto; of div-table-responsive */ @@ -3695,12 +3706,6 @@ table.liste, table.noborder, table.formdoc, div.noborder { border-bottom-color: #BBB; border-bottom-style: solid; - - border-right: 1px solid #ccc; - border-left: 1px solid #ccc; - - margin: 0px 0px 20px 0px; -webkit-border-radius: 0.1em; From 27acaa45f515341b59a1cc15621cba54b481a29d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 7 Apr 2022 14:18:24 +0200 Subject: [PATCH 592/610] Clean deprecated field --- .../class/fournisseur.facture-rec.class.php | 23 ++++++------ .../fourn/class/fournisseur.facture.class.php | 36 ++++--------------- 2 files changed, 17 insertions(+), 42 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.facture-rec.class.php b/htdocs/fourn/class/fournisseur.facture-rec.class.php index 7d90c239ba7..ab68cd3ecc6 100644 --- a/htdocs/fourn/class/fournisseur.facture-rec.class.php +++ b/htdocs/fourn/class/fournisseur.facture-rec.class.php @@ -79,13 +79,19 @@ class FactureFournisseurRec extends CommonInvoice public $suspended; public $libelle; + public $label; /** - * @deprecated * @var double $amount + * @deprecated */ public $amount; + /** + * @var double $remise + * @deprecated + */ public $remise; + public $vat_src_code; public $localtax1; public $localtax2; @@ -173,8 +179,6 @@ class FactureFournisseurRec extends CommonInvoice 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>40), 'suspended' =>array('type'=>'integer', 'label'=>'Suspended', 'enabled'=>1, 'visible'=>-1, 'position'=>225), 'libelle' =>array('type'=>'varchar(100)', 'label'=>'Libelle', 'enabled'=>1, 'showoncombobox' => 0, 'visible'=>-1, 'position'=>15), - 'amount' =>array('type'=>'double(24,8)', 'label'=>'Amount', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>35), - 'remise' =>array('type'=>'double', 'label'=>'Remise', 'enabled'=>1, 'visible'=>-1, 'position'=>40), 'localtax1' =>array('type'=>'double(24,8)', 'label'=>'Localtax1', 'enabled'=>1, 'visible'=>-1, 'position'=>60, 'isameasure'=>1), 'localtax2' =>array('type'=>'double(24,8)', 'label'=>'Localtax2', 'enabled'=>1, 'visible'=>-1, 'position'=>65, 'isameasure'=>1), @@ -278,8 +282,7 @@ class FactureFournisseurRec extends CommonInvoice $sql .= ', datec'; $sql .= ', suspended'; $sql .= ', libelle'; - $sql .= ', amount'; - $sql .= ', remise'; + $sql .= ', total_ttc'; $sql .= ', fk_user_author'; $sql .= ', fk_projet'; $sql .= ', fk_account'; @@ -310,7 +313,6 @@ class FactureFournisseurRec extends CommonInvoice $sql .= ", ".((int) $this->suspended); $sql .= ", '".$this->db->escape($this->libelle)."'"; $sql .= ", " .(!empty($facfourn_src->total_ttc) ? (float) $facfourn_src->total_ttc : '0'); // amount - $sql .= ", " .(!empty($facfourn_src->remise) ? (float) $facfourn_src->remise : '0'); $sql .= ", " .((int) $user->id); $sql .= ", " .(!empty($this->fk_project) ? ((int) $this->fk_project) : 'NULL'); $sql .= ", " .(!empty($facfourn_src->fk_account) ? ((int) $facfourn_src->fk_account) : 'NULL'); @@ -480,8 +482,6 @@ class FactureFournisseurRec extends CommonInvoice if ($this->fk_soc > 0) $sql .= " fk_soc = ". (int) $this->fk_soc. ','; $sql .= " suspended = ". (!empty($this->suspended) ? ((int) $this->suspended) : 0) . ','; $sql .= " libelle = ". (!empty($this->libelle) ? "'".$this->db->escape($this->libelle)."'" : 'NULL') . ","; - $sql .= " amount = ". (!empty($this->amount) ? ((float) $this->amount) : 0.00) . ','; - $sql .= " remise = ". (!empty($this->remise) ? ((float) $this->remise) : 'NULL') . ','; $sql .= " vat_src_code = ". (!empty($this->vat_src_code) ? "'".$this->db->escape($this->vat_src_code)."'" : 'NULL') . ','; $sql .= " localtax1 = ". (!empty($this->localtax1) ? ((float) $this->localtax1) : 0.00) . ','; $sql .= " localtax2 = ". (!empty($this->localtax2) ? ((float) $this->localtax2) : 0.00) . ','; @@ -553,7 +553,7 @@ class FactureFournisseurRec extends CommonInvoice { $sql = 'SELECT f.rowid, f.titre, f.ref_supplier, f.entity, f.fk_soc'; $sql .= ', f.datec, f.tms, f.suspended'; - $sql .= ', f.libelle, f.amount, f.remise'; + $sql .= ', f.libelle as label'; $sql .= ', f.vat_src_code, f.localtax1, f.localtax2'; $sql .= ', f.total_tva, f.total_ht, f.total_ttc'; $sql .= ', f.fk_user_author, f.fk_user_modif'; @@ -593,9 +593,8 @@ class FactureFournisseurRec extends CommonInvoice $this->date_creation = $obj->datec; $this->date_modification = $obj->tms; $this->suspended = $obj->suspended; - $this->libelle = $obj->libelle; - $this->amount = $obj->amount; - $this->remise = $obj->remise; + $this->libelle = $obj->label; + $this->label = $obj->label; $this->vat_src_code = $obj->vat_src_code; $this->total_localtax1 = $obj->localtax1; $this->total_localtax2 = $obj->localtax2; diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 176f79a51de..9912f71df4b 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -182,10 +182,14 @@ class FactureFournisseur extends CommonInvoice public $date_echeance; /** - * @deprecated * @var double $amount + * @deprecated */ public $amount = 0; + /** + * @var double $remise + * @deprecated + */ public $remise = 0; /** @@ -404,11 +408,6 @@ class FactureFournisseur extends CommonInvoice $this->date = $now; } - $socid = $this->socid; - $ref_supplier = $this->ref_supplier; - $amount = $this->amount; - $remise = $this->remise; - // Multicurrency (test on $this->multicurrency_tx because we should take the default rate only if not using origin rate) if (!empty($this->multicurrency_code) && empty($this->multicurrency_tx)) { list($this->fk_multicurrency, $this->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code, $this->date); @@ -456,7 +455,6 @@ class FactureFournisseur extends CommonInvoice $this->total_ttc = $_facrec->total_ttc; // Fields always coming from template - $this->remise = $_facrec->remise; $this->fk_incoterms = $_facrec->fk_incoterms; $this->location_incoterms = $_facrec->location_incoterms; @@ -475,7 +473,6 @@ class FactureFournisseur extends CommonInvoice $this->array_options = $_facrec->array_options; - //if (! $this->remise) $this->remise = 0; if (! $this->mode_reglement_id) { $this->mode_reglement_id = 0; } @@ -545,10 +542,6 @@ class FactureFournisseur extends CommonInvoice $this->date_echeance = $forceduedate; } - if (!$remise) { - $remise = 0; - } - $sql = "INSERT INTO ".MAIN_DB_PREFIX."facture_fourn ("; $sql .= "ref"; $sql .= ", ref_supplier"; @@ -882,8 +875,6 @@ class FactureFournisseur extends CommonInvoice $sql .= " t.tms,"; $sql .= " t.libelle as label,"; $sql .= " t.paye,"; - $sql .= " t.amount,"; - $sql .= " t.remise,"; $sql .= " t.close_code,"; $sql .= " t.close_note,"; $sql .= " t.tva,"; @@ -948,11 +939,8 @@ class FactureFournisseur extends CommonInvoice $this->label = $obj->label; $this->paye = $obj->paye; $this->paid = $obj->paye; - $this->amount = $obj->amount; - $this->remise = $obj->remise; $this->close_code = $obj->close_code; $this->close_note = $obj->close_note; - //$this->tva = $obj->tva; $this->total_localtax1 = $obj->localtax1; $this->total_localtax2 = $obj->localtax2; $this->total_ht = $obj->total_ht; @@ -1177,22 +1165,12 @@ class FactureFournisseur extends CommonInvoice if (isset($this->paye)) { $this->paye = trim($this->paye); } - if (isset($this->amount)) { - if (empty($this->amount)) $this->amount = 0; - else $this->amount = doubleval($this->amount); - } - if (isset($this->remise)) { - $this->remise = trim($this->remise); - } if (isset($this->close_code)) { $this->close_code = trim($this->close_code); } if (isset($this->close_note)) { $this->close_note = trim($this->close_note); } - /*if (isset($this->tva)) { - $this->tva = trim($this->tva); - }*/ if (isset($this->localtax1)) { $this->localtax1 = trim($this->localtax1); } @@ -1264,8 +1242,6 @@ class FactureFournisseur extends CommonInvoice } $sql .= " libelle=".(isset($this->label) ? "'".$this->db->escape($this->label)."'" : "null").","; $sql .= " paye=".(isset($this->paye) ? $this->paye : "null").","; - $sql .= " amount=".(isset($this->amount) ? $this->amount : "null").","; - $sql .= " remise=".(isset($this->remise) ? $this->remise : "null").","; $sql .= " close_code=".(isset($this->close_code) ? "'".$this->db->escape($this->close_code)."'" : "null").","; $sql .= " close_note=".(isset($this->close_note) ? "'".$this->db->escape($this->close_note)."'" : "null").","; //$sql .= " tva=".(isset($this->tva) ? $this->tva : "null").","; @@ -2452,7 +2428,7 @@ class FactureFournisseur extends CommonInvoice $this->db->begin(); - // Libere remise liee a ligne de facture + // Free the discount linked to a line of invoice $sql = 'UPDATE '.MAIN_DB_PREFIX.'societe_remise_except'; $sql .= ' SET fk_invoice_supplier_line = NULL'; $sql .= ' WHERE fk_invoice_supplier_line = '.((int) $rowid); From 4ced0bac8965f4ca1cf54a4cb291d025aaa6808f Mon Sep 17 00:00:00 2001 From: atm-florian Date: Thu, 7 Apr 2022 14:39:14 +0200 Subject: [PATCH 593/610] =?UTF-8?q?replace=20throw=20new=20Exception(?= =?UTF-8?q?=E2=80=A6)=20with=20dol=5Fprint=5Ferror=20+=20exit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/core/class/commonobject.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index b1f7997b4f7..6713157c78f 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -5620,7 +5620,8 @@ abstract class CommonObject // phpcs:enable global $langs, $conf; if (!empty(self::TRIGGER_PREFIX) && strpos($triggerName, self::TRIGGER_PREFIX . '_') !== 0) { - throw new Exception('The trigger "' . $triggerName . '" does not start with "' . self::TRIGGER_PREFIX . '_" as required.'); + dol_print_error('', 'The trigger "' . $triggerName . '" does not start with "' . self::TRIGGER_PREFIX . '_" as required.'); + exit; } if (!is_object($langs)) { // If lang was not defined, we set it. It is required by run_triggers. include_once DOL_DOCUMENT_ROOT.'/core/class/translate.class.php'; From bc7ad806e7f4185dd38fede5d4ecd1e955e19081 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 7 Apr 2022 15:01:20 +0200 Subject: [PATCH 594/610] Try to fix a strange logic. --- htdocs/societe/card.php | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 2f2b1bcd89d..a591465cb23 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -1180,14 +1180,15 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { document.formsoc.private.value=1; }); - var canHaveCategoryIfNotCustomerProspectSupplier = ' . (empty($conf->global->THIRDPARTY_CAN_HAVE_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT_SUPPLIER) ? '0' : '1') . '; + var canHaveCategoryIfNotCustomerProspectSupplier = ' . (empty($conf->global->THIRDPARTY_CAN_HAVE_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT) ? '0' : '1') . '; + init_customer_categ(); $("#customerprospect").change(function() { init_customer_categ(); }); function init_customer_categ() { console.log("is customer or prospect = "+jQuery("#customerprospect").val()); - if (jQuery("#customerprospect").val() == 0 && (jQuery("#fournisseur").val() != 0 || !canHaveCategoryIfNotCustomerProspectSupplier)) + if (jQuery("#customerprospect").val() == 0 && !canHaveCategoryIfNotCustomerProspectSupplier) { jQuery(".visibleifcustomer").hide(); } @@ -1206,16 +1207,10 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { if (jQuery("#fournisseur").val() == 0) { jQuery(".visibleifsupplier").hide(); - if (jQuery("#customerprospect").val() == 0 && canHaveCategoryIfNotCustomerProspectSupplier && jQuery(".visibleifcustomer").is(":hidden")) { - jQuery(".visibleifcustomer").show(); - } } else { jQuery(".visibleifsupplier").show(); - if (jQuery("#customerprospect").val() == 0 && jQuery(".visibleifcustomer").is(":visible")) { - jQuery(".visibleifcustomer").hide(); - } } } @@ -1646,12 +1641,10 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { $langs->load('categories'); // Customer - //if ($object->prospect || $object->client || (! $object->fournisseur && ! empty($conf->global->THIRDPARTY_CAN_HAVE_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT_SUPPLIER))) { print '
'.$form->editfieldkey('CustomersProspectsCategoriesShort', 'custcats', '', $object, 0).''; $cate_arbo = $form->select_all_categories(Categorie::TYPE_CUSTOMER, null, 'parent', null, null, 1); print img_picto('', 'category', 'class="pictofixedwidth"').$form->multiselectarray('custcats', $cate_arbo, GETPOST('custcats', 'array'), null, null, 'quatrevingtpercent widthcentpercentminusx', 0, 0); print "
'.$form->editfieldkey('ContactCategoriesShort', 'contcats', '', $object, 0).''; @@ -1921,14 +1914,15 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { } }); - var canHaveCategoryIfNotCustomerProspectSupplier = ' . (empty($conf->global->THIRDPARTY_CAN_HAVE_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT_SUPPLIER) ? '0' : '1') . '; + var canHaveCategoryIfNotCustomerProspectSupplier = ' . (empty($conf->global->THIRDPARTY_CAN_HAVE_CUSTOMER_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT) ? '0' : '1') . '; + init_customer_categ(); $("#customerprospect").change(function() { init_customer_categ(); }); function init_customer_categ() { console.log("is customer or prospect = "+jQuery("#customerprospect").val()); - if (jQuery("#customerprospect").val() == 0 && (jQuery("#fournisseur").val() != 0 || !canHaveCategoryIfNotCustomerProspectSupplier)) + if (jQuery("#customerprospect").val() == 0 && !canHaveCategoryIfNotCustomerProspectSupplier) { jQuery(".visibleifcustomer").hide(); } @@ -1947,16 +1941,10 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { if (jQuery("#fournisseur").val() == 0) { jQuery(".visibleifsupplier").hide(); - if (jQuery("#customerprospect").val() == 0 && canHaveCategoryIfNotCustomerProspectSupplier && jQuery(".visibleifcustomer").is(":hidden")) { - jQuery(".visibleifcustomer").show(); - } } else { jQuery(".visibleifsupplier").show(); - if (jQuery("#customerprospect").val() == 0 && jQuery(".visibleifcustomer").is(":visible")) { - jQuery(".visibleifcustomer").hide(); - } } }; @@ -2748,7 +2736,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // Tags / categories if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) { // Customer - if ($object->prospect || $object->client || (!$object->fournisseur && !empty($conf->global->THIRDPARTY_CAN_HAVE_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT_SUPPLIER))) { + if ($object->prospect || $object->client || !empty($conf->global->THIRDPARTY_CAN_HAVE_CUSTOMER_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT)) { print '
'.$langs->trans("CustomersCategoriesShort").''; print $form->showCategories($object->id, Categorie::TYPE_CUSTOMER, 1); From 3e5e74c68759fe2b1b84ea4e2dd75fe286539e67 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 7 Apr 2022 15:39:03 +0200 Subject: [PATCH 595/610] Close #17632 --- htdocs/contrat/list.php | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index 55bd7071ee8..6c23cfcf720 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -338,18 +338,24 @@ if (!empty($extrafields->attributes[$object->table_element]['label'])) { } } // Add where from hooks -$parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldListGroupBy', $parameters); // Note that $action and $object may have been modified by hook +$parameters = array('search_dfyear' => $search_dfyear, 'search_op2df'=>$search_op2df); +$reshook = $hookmanager->executeHooks('printFieldListGroupBy', $parameters, $object); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; -if ($search_dfyear > 0 && $search_op2df) { - if ($search_op2df == '<=') { - $sql .= " HAVING MIN(".$db->ifsql("cd.statut=4", "cd.date_fin_validite", "null").") <= '".$db->idate(dol_get_last_day($search_dfyear, $search_dfmonth, false))."'"; - } elseif ($search_op2df == '>=') { - $sql .= " HAVING MIN(".$db->ifsql("cd.statut=4", "cd.date_fin_validite", "null").") >= '".$db->idate(dol_get_first_day($search_dfyear, $search_dfmonth, false))."'"; - } else { - $sql .= " HAVING MIN(".$db->ifsql("cd.statut=4", "cd.date_fin_validite", "null").") <= '".$db->idate(dol_get_last_day($search_dfyear, $search_dfmonth, false))."' AND MIN(".$db->ifsql("cd.statut=4", "cd.date_fin_validite", "null").") >= '".$db->idate(dol_get_first_day($search_dfyear, $search_dfmonth, false))."'"; +// Add HAVING from hooks +$parameters = array('search_dfyear' => $search_dfyear, 'search_op2df'=>$search_op2df); +$reshook = $hookmanager->executeHooks('printFieldListHaving', $parameters, $object); // Note that $action and $object may have been modified by hook +if (empty($reshook)) { + if ($search_dfyear > 0 && $search_op2df) { + if ($search_op2df == '<=') { + $sql .= " HAVING MIN(".$db->ifsql("cd.statut=4", "cd.date_fin_validite", "null").") <= '".$db->idate(dol_get_last_day($search_dfyear, $search_dfmonth, false))."'"; + } elseif ($search_op2df == '>=') { + $sql .= " HAVING MIN(".$db->ifsql("cd.statut=4", "cd.date_fin_validite", "null").") >= '".$db->idate(dol_get_first_day($search_dfyear, $search_dfmonth, false))."'"; + } else { + $sql .= " HAVING MIN(".$db->ifsql("cd.statut=4", "cd.date_fin_validite", "null").") <= '".$db->idate(dol_get_last_day($search_dfyear, $search_dfmonth, false))."' AND MIN(".$db->ifsql("cd.statut=4", "cd.date_fin_validite", "null").") >= '".$db->idate(dol_get_first_day($search_dfyear, $search_dfmonth, false))."'"; + } } } +$sql .= $hookmanager->resPrint; $nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { From 56bfa20d7044001723a6fe5944441132ca863b7c Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Thu, 7 Apr 2022 15:59:42 +0200 Subject: [PATCH 596/610] FIX : dont update object price on each iteration when updating situation for all lines --- htdocs/compta/facture/card.php | 3 ++- htdocs/compta/facture/class/facture.class.php | 13 +++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 9956fd32b97..2cf5e13ff8b 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -2560,9 +2560,10 @@ if (empty($reshook)) { setEventMessages($mesg, null, 'warnings'); $result = -1; } else { - $object->update_percent($line, GETPOST('all_progress')); + $object->update_percent($line, GETPOST('all_progress'), false); } } + $object->update_price(1); } } elseif ($action == 'updateline' && $usercancreate && !$cancel) { header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$id); // To show again edited page diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 5fe58adcd7b..2b368d7bd75 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -3725,11 +3725,12 @@ class Facture extends CommonInvoice /** * Update invoice line with percentage * - * @param FactureLigne $line Invoice line - * @param int $percent Percentage + * @param FactureLigne $line Invoice line + * @param int $percent Percentage + * @param boolean $update_price Update object price * @return void */ - public function update_percent($line, $percent) + public function update_percent($line, $percent, $update_price = true) { // phpcs:enable global $mysoc, $user; @@ -3756,7 +3757,11 @@ class Facture extends CommonInvoice $line->multicurrency_total_tva = $tabprice[17]; $line->multicurrency_total_ttc = $tabprice[18]; $line->update($user); - $this->update_price(1); + + // sometimes it is better to not update price for each line, ie when updating situation on all lines + if ($update_price) { + $this->update_price(1); + } } /** From b8d19c9311c2a01de0bb5d53ed5ea2d97d97c61a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 7 Apr 2022 15:59:50 +0200 Subject: [PATCH 597/610] Debug v16 --- htdocs/main.inc.php | 2 +- htdocs/societe/card.php | 20 ++++++++++---------- htdocs/theme/eldy/dropdown.inc.php | 9 +++++++-- 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index dc8b49c775f..e2d36ab4695 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -2410,7 +2410,7 @@ function printDropdownQuickadd() "position" => 50, ), array( - "url" => "/compta/facture/card.php?action=create", + "url" => "/contrat/card.php?action=create", "title" => "NewContractSubscription@contracts", "name" => "Contract@contracts", "picto" => "object_contract", diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index a591465cb23..37ac9805374 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -1320,16 +1320,6 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print '
'.$langs->trans('ParentCompany').''; - print img_picto('', 'company', 'class="paddingrightonly"'); - print $form->select_thirdparty_list('', 'parent_company_id', '', $langs->trans("ThirdParty")); - print '
'.$form->editfieldkey('ProspectCustomer', 'customerprospect', '', $object, 0, 'string', '', 1).''; @@ -1675,6 +1665,16 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { $parameters = array('socid'=>$socid, 'colspan' => ' colspan="3"', 'colspanvalue' => '3'); include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php'; + // Parent company + if (empty($conf->global->SOCIETE_DISABLE_PARENTCOMPANY)) { + print '
'.$langs->trans('ParentCompany').''; + print img_picto('', 'company', 'class="paddingrightonly"'); + print $form->select_company(GETPOST('parent_company_id'), 'parent_company_id'); + print '
'.$form->editfieldkey('AllocateCommercial', 'commercial_id', '', $object, 0).'
'; - print img_picto('', 'company').$form->select_company($socid, 'socid', '', 'SelectThirdParty'); + print img_picto('', 'company').$form->select_company($socid, 'socid', '', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300 maxwidth500 widthcentpercentminusxx'); print '
'.$langs->trans('ParentCompany').''; print img_picto('', 'company', 'class="paddingrightonly"'); - print $form->select_company(GETPOST('parent_company_id'), 'parent_company_id'); + print $form->select_company(GETPOST('parent_company_id'), 'parent_company_id', '', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300 maxwidth500 widthcentpercentminusxx'); print '
'; + print ''; $selectarray = array('-1'=>'', 'withoutsubscription'=>$langs->trans("WithoutSubscription"), 'uptodate'=>$langs->trans("UpToDate"), 'outofdate'=>$langs->trans("OutOfDate")); print $form->selectarray('search_filter', $selectarray, $search_filter); print ''; if ($datefin) { - print ''; print dol_print_date($datefin, 'day'); if ($memberstatic->hasDelay()) { $textlate = ' ('.$langs->trans("DateReference").' > '.$langs->trans("DateToday").' '.(ceil($conf->adherent->subscription->warning_delay / 60 / 60 / 24) >= 0 ? '+' : '').ceil($conf->adherent->subscription->warning_delay / 60 / 60 / 24).' '.$langs->trans("days").')'; print " ".img_warning($langs->trans("SubscriptionLate").$textlate); } - print ''; if (!empty($obj->subscription)) { print $langs->trans("SubscriptionNotReceived"); if ($obj->statut > 0) { @@ -1128,8 +1126,8 @@ while ($i < min($num, $limit)) { } else { print ' '; } - print '
'.$userstatic->getNomUrl(-1, 'leave').''.$userstatic->getNomUrl(-1, 'leave').''.$approbatorstatic->getNomUrl(-1).''.$approbatorstatic->getNomUrl(-1).''; $labeltypeleavetoshow = ($langs->trans($typeleaves[$obj->fk_type]['code']) != $typeleaves[$obj->fk_type]['code'] ? $langs->trans($typeleaves[$obj->fk_type]['code']) : $typeleaves[$obj->fk_type]['label']); - print empty($typeleaves[$obj->fk_type]['label']) ? $langs->trans("TypeWasDisabledOrRemoved", $obj->fk_type) : $labeltypeleavetoshow; + $labeltypeleavetoshow = empty($typeleaves[$obj->fk_type]['label']) ? $langs->trans("TypeWasDisabledOrRemoved", $obj->fk_type) : $labeltypeleavetoshow; + + print ''; + print $labeltypeleavetoshow; print ''; $nbopenedday = num_open_day($db->jdate($obj->date_debut, 1), $db->jdate($obj->date_fin, 1), 0, 1, $obj->halfday); // user jdate(..., 1) because num_open_day need UTC dates $totalduration += $nbopenedday; - print $nbopenedday.' '.$langs->trans('DurationDays'); + print $nbopenedday; + //print ' '.$langs->trans('DurationDays'); print '
'.$holidaystatic->getNomUrl(1).''.$userstatic->getNomUrl(-1, 'leave').''.$userstatic->getNomUrl(-1, 'leave').''.dol_escape_htmltag($langs->trans($typeleaves[$obj->fk_type]['code'])).'

*** Force page code and collation of tables into utf8/utf8_unicode_ci (for mysql/mariadb only)

*** Force page code and collation of tables into utf8/utf8_unicode_ci and row_format=dynamic (for mysql/mariadb only)
'; print $table; - $sql = "ALTER TABLE ".$table." CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci"; - print ''; + $sql1 = "ALTER TABLE ".$table." ROW_FORMAT=dynamic"; + $sql2 = "ALTER TABLE ".$table." CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci"; + print ''; + print ''; if ($force_utf8_on_tables == 'confirmed') { - $resql = $db->query($sql); - print ' - Done ('.($resql ? 'OK' : 'KO').')'; + $resql1 = $db->query($sql1); + if ($resql1) { + $resql2 = $db->query($sql2); + } else { + $resql2 = false; + } + print ' - Done ('.(($resql1 && $resql2) ? 'OK' : 'KO').')'; } else { print ' - Disabled'; } diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 84118961692..28542667dff 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -357,6 +357,7 @@ class User extends CommonObject */ public $fk_warehouse; + public $fields = array( 'rowid'=>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'index'=>1, 'position'=>1, 'comment'=>'Id'), 'lastname'=>array('type'=>'varchar(50)', 'label'=>'LastName', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>20, 'searchall'=>1), From 88066d3fca6adc5fbe920eaf31d34ebcfcdb4a44 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 7 Apr 2022 23:53:02 +0200 Subject: [PATCH 608/610] Clean data --- htdocs/install/mysql/migration/15.0.0-16.0.0.sql | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql index 3aa5cd9c9cd..5f8b1d886c3 100644 --- a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql +++ b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql @@ -322,3 +322,5 @@ ALTER TABLE llx_contratdet ADD COLUMN rang integer DEFAULT 0 AFTER info_bits; ALTER TABLE llx_actioncomm MODIFY COLUMN note mediumtext; +DELETE FROM llx_boxes WHERE box_id IN (select rowid FROM llx_boxes_def WHERE file IN ('box_bom.php@bom', 'box_bom.php')); +DELETE FROM llx_boxes_def WHERE file IN ('box_bom.php@bom', 'box_bom.php'); From 994b500a6820eafc5c208276187d62bf42a0241a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 8 Apr 2022 00:14:29 +0200 Subject: [PATCH 609/610] PHP 8.0 compatibility --- ChangeLog | 3 ++- htdocs/core/lib/agenda.lib.php | 6 +++--- htdocs/core/tpl/list_print_total.tpl.php | 2 +- htdocs/fourn/class/fournisseur.facture.class.php | 2 +- htdocs/hrm/index.php | 12 +++++++----- htdocs/main.inc.php | 2 ++ htdocs/theme/eldy/style.css.php | 4 ++-- 7 files changed, 18 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 880406bb189..31bfa1c1cff 100644 --- a/ChangeLog +++ b/ChangeLog @@ -9,7 +9,8 @@ English Dolibarr ChangeLog For users: --------------- -NEW: ... +NEW: PHP 8.0 compatibility + Modules diff --git a/htdocs/core/lib/agenda.lib.php b/htdocs/core/lib/agenda.lib.php index d2528f45dfa..488010609f9 100644 --- a/htdocs/core/lib/agenda.lib.php +++ b/htdocs/core/lib/agenda.lib.php @@ -93,7 +93,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh print $form->select_dolgroups($usergroupid, 'usergroup', 1, '', !$canedit, '', '', '0', false, 'minwidth100 maxwidth500 widthcentpercentminusxx'); print ''; - if ($conf->resource->enabled) { + if (!empty($conf->resource->enabled)) { include_once DOL_DOCUMENT_ROOT.'/resource/class/html.formresource.class.php'; $formresource = new FormResource($db); @@ -105,14 +105,14 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh } } - if (!empty($conf->societe->enabled) && $user->rights->societe->lire) { + if (!empty($conf->societe->enabled) && !empty($user->rights->societe->lire)) { print '
'; print img_picto($langs->trans("ThirdParty"), 'company', 'class="fawidth30 inline-block"'); print $form->select_company($socid, 'search_socid', '', ' ', 0, 0, null, 0, 'minwidth100 maxwidth500'); print '
'; } - if (!empty($conf->projet->enabled) && $user->rights->projet->lire) { + if (!empty($conf->projet->enabled) && !empty($user->rights->projet->lire)) { require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; $formproject = new FormProjets($db); diff --git a/htdocs/core/tpl/list_print_total.tpl.php b/htdocs/core/tpl/list_print_total.tpl.php index b015dc51fdc..8d84228e2ec 100644 --- a/htdocs/core/tpl/list_print_total.tpl.php +++ b/htdocs/core/tpl/list_print_total.tpl.php @@ -14,7 +14,7 @@ if (isset($totalarray['pos'])) { $i++; if (!empty($totalarray['pos'][$i])) { print '
'; - if ($totalarray['type'][$i] == 'duration') { + if (isset($totalarray['type']) && $totalarray['type'][$i] == 'duration') { print (!empty($totalarray['val'][$totalarray['pos'][$i]])?convertSecondToTime($totalarray['val'][$totalarray['pos'][$i]], 'allhourmin'):0); } else { print price(!empty($totalarray['val'][$totalarray['pos'][$i]])?$totalarray['val'][$totalarray['pos'][$i]]:0); diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index da71a2a795d..0af7e083aec 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -2627,7 +2627,7 @@ class FactureFournisseur extends CommonInvoice // phpcs:enable global $conf, $langs; - $sql = 'SELECT ff.rowid, ff.date_lim_reglement as datefin, ff.fk_statut as status'; + $sql = 'SELECT ff.rowid, ff.date_lim_reglement as datefin, ff.fk_statut as status, ff.total_ht, ff.total_ttc'; $sql .= ' FROM '.MAIN_DB_PREFIX.'facture_fourn as ff'; if (empty($user->rights->societe->client->voir) && !$user->socid) { $sql .= " JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON ff.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id); diff --git a/htdocs/hrm/index.php b/htdocs/hrm/index.php index 84e336c9b97..c573b78ed51 100644 --- a/htdocs/hrm/index.php +++ b/htdocs/hrm/index.php @@ -34,17 +34,17 @@ require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; require_once DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; -if ($conf->deplacement->enabled) { +if (!empty($conf->deplacement->enabled)) { require_once DOL_DOCUMENT_ROOT.'/compta/deplacement/class/deplacement.class.php'; } -if ($conf->expensereport->enabled) { +if (!empty($conf->expensereport->enabled)) { require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; } -if ($conf->recruitment->enabled) { +if (!empty($conf->recruitment->enabled)) { require_once DOL_DOCUMENT_ROOT.'/recruitment/class/recruitmentcandidature.class.php'; require_once DOL_DOCUMENT_ROOT.'/recruitment/class/recruitmentjobposition.class.php'; } -if ($conf->holiday->enabled) { +if (!empty($conf->holiday->enabled)) { require_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php'; } @@ -236,7 +236,9 @@ if (!empty($conf->holiday->enabled) && $user->rights->holiday->read) { print '
'.$holidaystatic->getNomUrl(1).''.$userstatic->getNomUrl(-1, 'leave').''.dol_escape_htmltag($langs->trans($typeleaves[$obj->fk_type]['code'])).''.dol_escape_htmltag($langs->trans($leavecode)).'